diff --git a/.codex-tasks/template-audit-execution/raw/completion-evidence.json b/.codex-tasks/template-audit-execution/raw/completion-evidence.json index a276d09..5f4ba0a 100644 --- a/.codex-tasks/template-audit-execution/raw/completion-evidence.json +++ b/.codex-tasks/template-audit-execution/raw/completion-evidence.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "scope": "模板完成证据登记,保留命令、日志与产物哈希", - "generatedAt": "2026-10-21T06:41:20.085Z", + "generatedAt": "2026-10-21T06:43:20.332Z", "templates": { "acheng-campus-food": { "real-manifest-interaction": { @@ -256,5 +256,5 @@ } } }, - "sourceTreeHash": "1b979d8c64ea424e32b7b20a96a2d97c692cc37099f8a9e41d3b45178655a410" + "sourceTreeHash": "3cd6b07396aadee64357dfd4fa865d8e62e86ed513d20264b9fb9a9622fcdcf2" } diff --git a/deploy/runner/install-runner.sh b/deploy/runner/install-runner.sh index 0aa51c1..746a4d9 100755 --- a/deploy/runner/install-runner.sh +++ b/deploy/runner/install-runner.sh @@ -28,8 +28,10 @@ RUNNER_CACHE_HOST=${RUNNER_CACHE_HOST:-172.17.0.1} CACHE_DIR=${CACHE_DIR:-$RUNNER_ROOT/cache-data} DRY_RUN=${DRY_RUN:-0} -command -v docker >/dev/null 2>&1 || { echo "缺少 docker,请先安装并启动 Docker" >&2; exit 1; } -command -v systemctl >/dev/null 2>&1 || { echo "缺少 systemd,当前脚本只支持 systemd 主机" >&2; exit 1; } +if [ "$DRY_RUN" != "1" ]; then + command -v docker >/dev/null 2>&1 || { echo "缺少 docker,请先安装并启动 Docker" >&2; exit 1; } + command -v systemctl >/dev/null 2>&1 || { echo "缺少 systemd,当前脚本只支持 systemd 主机" >&2; exit 1; } +fi case "$(uname -m)" in aarch64 | arm64) ARCH=arm64 ;; @@ -64,6 +66,8 @@ if [ ! -f "$RUNNER_ROOT/.runner" ]; then --token "$RUNNER_TOKEN" \ --name "$RUNNER_NAME" \ --labels "$RUNNER_LABELS" +fi +if [ -f "$RUNNER_ROOT/.runner" ]; then run chmod 600 "$RUNNER_ROOT/.runner" fi diff --git a/docs/template-completion-rules.md b/docs/template-completion-rules.md index c6629e1..fb50d9a 100644 --- a/docs/template-completion-rules.md +++ b/docs/template-completion-rules.md @@ -30,7 +30,7 @@ staticStatus 只代表支持范围内的静态检查。completionStatus 保持 u 已逐条完成源码审阅的 review 可登记在 `.codex-tasks/template-audit-execution/raw/manual-review.json`。登记必须使用和诊断报告一致的 `file/page/target/binding/line/message`,并保留结论与证据;doctor 只把精确匹配的 review 标记为 `source-reviewed`,不改变 `completionStatus`。未匹配的新 review 和全部 blocker 仍会让命令失败。 -完成证据登记在 `.codex-tasks/template-audit-execution/raw/completion-evidence.json`。每套模板必须提供 `real-manifest-interaction`、`save-reload-publish-isolation`、`visual-reference`、`empty-error-branches` 四类 `passed` 证据;每类证据必须包含实际命令、`exitCode=0`、日志或截图产物及其 SHA-256。registry 还必须记录 source tree hash;doctor 会计算当前仓库源码树的 hash,并在不匹配时拒绝完成态。哈希范围只包含会影响模板交付的源码:排除 `.codex-tasks/`、`.gitea/`、`deploy/` 以及除 `docs/template-completion-rules.md` 之外的全部 markdown。改文档、改 CI 或改部署脚本不再让已完成证据失效,改模板、renderer、诊断器或本文件仍然会。doctor 会校验证据覆盖全部模板、产物存在且哈希一致。全部通过时 `completionStatus=complete`;证据文件缺失时保持 `unverified`;登记不完整或哈希不匹配时对应模板为 `incomplete` 并让命令失败。 +完成证据登记在 `.codex-tasks/template-audit-execution/raw/completion-evidence.json`。每套模板必须提供 `real-manifest-interaction`、`save-reload-publish-isolation`、`visual-reference`、`empty-error-branches` 四类 `passed` 证据;每类证据必须包含实际命令、`exitCode=0`、日志或截图产物及其 SHA-256。registry 还必须记录 source tree hash;doctor 会计算当前仓库源码树的 hash,并在不匹配时拒绝完成态。哈希范围只包含会影响模板交付的源码:排除 `.codex-tasks/`、`.gitea/`、`deploy/`、`scripts/deploy/` 以及除 `docs/template-completion-rules.md` 之外的全部 markdown。改文档、改 CI 或改部署脚本不再让已完成证据失效,改模板、renderer、诊断器或本文件仍然会。doctor 会校验证据覆盖全部模板、产物存在且哈希一致。全部通过时 `completionStatus=complete`;证据文件缺失时保持 `unverified`;登记不完整或哈希不匹配时对应模板为 `incomplete` 并让命令失败。 AST 解析可追踪 workspace.brand、presentation、object 和局部别名。动态路径、跨组件和间接映射等未知情况标为 review,不能猜测为通过。诊断器包含正反故障注入测试。 diff --git a/scripts/lib/template-doctor.mjs b/scripts/lib/template-doctor.mjs index 3265a1c..41cd176 100644 --- a/scripts/lib/template-doctor.mjs +++ b/scripts/lib/template-doctor.mjs @@ -461,6 +461,7 @@ export function sourceTreeHash(root, options = {}) { .split("\0") .filter((file) => file && isEvidenceSourcePath(file)) .map((file) => path.join(rootPath, file)); + if (!staged) files = files.filter((file) => fs.existsSync(file) && fs.statSync(file).isFile()); readContent = staged ? (file) => execFileSync("git", ["show", ":" + path.relative(rootPath, file)], {