agentic-flow-kit 1.8.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -148
- package/bin/flow-kit.mjs +5 -2
- package/locales/en/installer.json +25 -0
- package/locales/en/overrides/.agents/commands/deploy.md +52 -0
- package/locales/en/overrides/.agents/commands/maintain.md +76 -0
- package/locales/en/overrides/.agents/commands/new-task.md +89 -0
- package/locales/en/overrides/.agents/commands/pipeline-run.md +56 -0
- package/locales/en/overrides/.agents/commands/pr-review.md +30 -0
- package/locales/en/overrides/.agents/commands/review.md +93 -0
- package/locales/en/overrides/.agents/commands/stages.md +256 -0
- package/locales/en/overrides/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/locales/en/overrides/.agents/notes/process-order-rule.md +21 -0
- package/locales/en/overrides/.agents/notes/runtime-env.local.example.md +21 -0
- package/locales/en/overrides/.agents/pipelines/_TEMPLATE.md +75 -0
- package/locales/en/overrides/.agents/pipelines/pipeline-closing.md +28 -0
- package/locales/en/overrides/.agents/roles/implementer.md +28 -0
- package/locales/en/overrides/.agents/roles/independent-reviewer.md +39 -0
- package/locales/en/overrides/.agents/roles/pr-adjudicator.md +27 -0
- package/locales/en/overrides/.agents/roles/pr-finder.md +51 -0
- package/locales/en/overrides/.agents/roles/pr-verifier.md +44 -0
- package/locales/en/overrides/.agents/roles/ui-verifier.md +22 -0
- package/locales/en/overrides/.agents/roles/wiki-compiler.md +47 -0
- package/locales/en/overrides/.agents/skills/arena/SKILL.md +50 -0
- package/locales/en/overrides/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/locales/en/overrides/.agents/skills/blast-radius/SKILL.md +53 -0
- package/locales/en/overrides/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/dev-tour/SKILL.md +98 -0
- package/locales/en/overrides/.agents/skills/dream/SKILL.md +63 -0
- package/locales/en/overrides/.agents/skills/eval/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/interrogate/SKILL.md +49 -0
- package/locales/en/overrides/.agents/skills/number-vetting/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/page-refactor/SKILL.md +192 -0
- package/locales/en/overrides/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/pause-safely/SKILL.md +31 -0
- package/locales/en/overrides/.agents/skills/perf/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/review-method/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/session-resume/SKILL.md +69 -0
- package/locales/en/overrides/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/locales/en/overrides/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/locales/en/overrides/.agents/skills/verify-ui/SKILL.md +116 -0
- package/locales/en/overrides/.agents/skills/visual-parity/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/why/SKILL.md +56 -0
- package/locales/en/overrides/.agents/skills/wiki/SKILL.md +53 -0
- package/locales/en/overrides/.claude/agents/implementer.md +9 -0
- package/locales/en/overrides/.claude/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.claude/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.cline/agents/implementer.yml +13 -0
- package/locales/en/overrides/.cline/agents/independent-reviewer.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-adjudicator.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-finder.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-verifier.yml +11 -0
- package/locales/en/overrides/.cline/agents/ui-verifier.yml +8 -0
- package/locales/en/overrides/.cline/agents/wiki-compiler.yml +14 -0
- package/locales/en/overrides/.cline/workflows/wf-deploy.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-maintain.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-new-task.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pr-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/CODEBUDDY.md +7 -0
- package/locales/en/overrides/.codebuddy/agents/implementer.md +9 -0
- package/locales/en/overrides/.codebuddy/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.codebuddy/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.codebuddy/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/locales/en/overrides/.commandcode/agents/implementer.md +10 -0
- package/locales/en/overrides/.commandcode/agents/independent-reviewer.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-adjudicator.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-finder.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-verifier.md +9 -0
- package/locales/en/overrides/.commandcode/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.commandcode/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.commandcode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.opencode/agents/implementer.md +51 -0
- package/locales/en/overrides/.opencode/agents/independent-reviewer.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-adjudicator.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-finder.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-verifier.md +18 -0
- package/locales/en/overrides/.opencode/agents/ui-verifier.md +45 -0
- package/locales/en/overrides/.opencode/agents/wiki-compiler.md +51 -0
- package/locales/en/overrides/.opencode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.pi/agents/implementer.md +11 -0
- package/locales/en/overrides/.pi/agents/independent-reviewer.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-adjudicator.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-finder.md +11 -0
- package/locales/en/overrides/.pi/agents/pr-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/wiki-compiler.md +11 -0
- package/locales/en/overrides/.qoder/agents/implementer.md +9 -0
- package/locales/en/overrides/.qoder/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.qoder/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.qwen/agents/implementer.md +10 -0
- package/locales/en/overrides/.qwen/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/wiki-compiler.md +13 -0
- package/locales/en/overrides/.qwen/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.trae/agents/implementer.md +9 -0
- package/locales/en/overrides/.trae/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.trae/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.trae/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.trae/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.zcode/agents/implementer.md +8 -0
- package/locales/en/overrides/.zcode/agents/independent-reviewer.md +8 -0
- package/locales/en/overrides/.zcode/agents/ui-verifier.md +8 -0
- package/locales/en/overrides/.zcode/agents/wiki-compiler.md +8 -0
- package/locales/en/overrides/AGENTS.md +52 -0
- package/locales/en/overrides/CLAUDE.md +20 -0
- package/locales/en/overrides/wiki/INDEX.md +33 -0
- package/locales/en/overrides/wiki/drafts-archive/README.md +6 -0
- package/locales/en/overrides/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/locales/en/overrides/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/locales/en/overrides/workflow/INDEX.md +13 -0
- package/locales/en/overrides/workflow/README.md +67 -0
- package/locales/en/overrides/workflow/archive/README.md +3 -0
- package/locales/en/overrides/workflow/delegations.md +4 -0
- package/locales/en/overrides/workflow/effective-policy.md +4 -0
- package/locales/en/overrides/workflow/gate-cost.md +4 -0
- package/locales/en/overrides/workflow/incidents/_TEMPLATE.md +49 -0
- package/locales/en/overrides/workflow/intents/_TEMPLATE.md +43 -0
- package/locales/en/overrides/workflow/metrics.md +4 -0
- package/locales/en/overrides/workflow/papercuts.md +3 -0
- package/locales/en/overrides/workflow/plans/_TEMPLATE.md +47 -0
- package/locales/en/overrides/workflow/regression-checklist.md +3 -0
- package/locales/en/overrides/workflow/specs/_TEMPLATE.md +86 -0
- package/locales/en/overrides/workflow/verify-evidence.md +4 -0
- package/locales/zh-CN/installer.json +25 -0
- package/package.json +23 -36
- package/schemas/install-manifest.schema.json +24 -0
- package/schemas/project-profile.schema.json +28 -0
- package/src/cli/args.mjs +41 -0
- package/src/cli/main.mjs +72 -0
- package/src/commands/add-host.mjs +29 -0
- package/src/commands/doctor.mjs +80 -0
- package/src/commands/install.mjs +149 -0
- package/src/commands/upgrade.mjs +30 -0
- package/src/git/config.mjs +61 -0
- package/src/hosts/registry.mjs +26 -0
- package/src/i18n.mjs +32 -0
- package/src/install/apply.mjs +124 -0
- package/src/install/manifest.mjs +40 -0
- package/src/install/plan.mjs +83 -0
- package/src/render/tokens.mjs +58 -0
- package/templates/engine/.agents/board/dev-tour.html +1940 -0
- package/templates/engine/.agents/board/index.html +835 -0
- package/templates/engine/.agents/commands/deploy.md +52 -0
- package/templates/engine/.agents/commands/maintain.md +76 -0
- package/templates/engine/.agents/commands/new-task.md +89 -0
- package/templates/engine/.agents/commands/pipeline-run.md +56 -0
- package/templates/engine/.agents/commands/pr-review.md +30 -0
- package/templates/engine/.agents/commands/review.md +93 -0
- package/templates/engine/.agents/commands/stages.md +256 -0
- package/templates/engine/.agents/config/commit-msg-rules.json +7 -0
- package/templates/engine/.agents/config/engine.json +11 -0
- package/templates/engine/.agents/config/gate-budgets.json +5 -0
- package/templates/engine/.agents/config/mechanism-registry.md +62 -0
- package/templates/engine/.agents/config/model-roles.json +26 -0
- package/templates/engine/.agents/config/model-roles.local.example.json +7 -0
- package/templates/engine/.agents/config/pr-review.json +67 -0
- package/templates/engine/.agents/config/principles.md +32 -0
- package/templates/engine/.agents/config/workflow-enums.txt +25 -0
- package/templates/engine/.agents/hooks/check-architecture.mjs +168 -0
- package/templates/engine/.agents/hooks/check-audit-fields.mjs +56 -0
- package/templates/engine/.agents/hooks/check-commit-plan-ref.mjs +84 -0
- package/templates/engine/.agents/hooks/check-confirm-order.mjs +281 -0
- package/templates/engine/.agents/hooks/check-delete-guard.mjs +63 -0
- package/templates/engine/.agents/hooks/check-notify-guard.mjs +55 -0
- package/templates/engine/.agents/hooks/commit-check.cjs +208 -0
- package/templates/engine/.agents/hooks/gates.json +33 -0
- package/templates/engine/.agents/hooks/local-pre-commit.mjs +27 -0
- package/templates/engine/.agents/hooks/pre-shell-check.cjs +361 -0
- package/templates/engine/.agents/hooks/pre-write-check.cjs +220 -0
- package/templates/engine/.agents/notes/gate-diet.md +75 -0
- package/templates/engine/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/templates/engine/.agents/notes/process-order-rule.md +21 -0
- package/templates/engine/.agents/notes/runtime-env.local.example.md +21 -0
- package/templates/engine/.agents/pipelines/_TEMPLATE.md +75 -0
- package/templates/engine/.agents/pipelines/pipeline-closing.md +28 -0
- package/templates/engine/.agents/pipelines//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +16 -0
- package/templates/engine/.agents/roles/implementer.md +28 -0
- package/templates/engine/.agents/roles/independent-reviewer.md +39 -0
- package/templates/engine/.agents/roles/pr-adjudicator.md +27 -0
- package/templates/engine/.agents/roles/pr-finder.md +51 -0
- package/templates/engine/.agents/roles/pr-verifier.md +44 -0
- package/templates/engine/.agents/roles/ui-verifier.md +22 -0
- package/templates/engine/.agents/roles/wiki-compiler.md +47 -0
- package/templates/engine/.agents/scripts/agg-delegations.mjs +439 -0
- package/templates/engine/.agents/scripts/agg-judgments.mjs +301 -0
- package/templates/engine/.agents/scripts/agg-kb-usage.mjs +196 -0
- package/templates/engine/.agents/scripts/append-compensation.mjs +109 -0
- package/templates/engine/.agents/scripts/archive-sweep.mjs +229 -0
- package/templates/engine/.agents/scripts/auto-tour.mjs +77 -0
- package/templates/engine/.agents/scripts/board-port.mjs +17 -0
- package/templates/engine/.agents/scripts/check-doc-body-drift.mjs +102 -0
- package/templates/engine/.agents/scripts/check-engine-artifacts.mjs +54 -0
- package/templates/engine/.agents/scripts/check-hook-wiring.mjs +75 -0
- package/templates/engine/.agents/scripts/check-lane-surface.mjs +393 -0
- package/templates/engine/.agents/scripts/check-ledger-doc-presence.mjs +71 -0
- package/templates/engine/.agents/scripts/check-ledger-invariant.mjs +873 -0
- package/templates/engine/.agents/scripts/check-local-gate-config.mjs +95 -0
- package/templates/engine/.agents/scripts/check-local-gates.mjs +248 -0
- package/templates/engine/.agents/scripts/check-loop-kit.mjs +550 -0
- package/templates/engine/.agents/scripts/check-loop-rev-semantics.mjs +59 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s01-pairing.mjs +116 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s03x-regr-evidence.mjs +38 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s08-acceptance.mjs +130 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s15-fingerprint.mjs +152 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s23-convergence-audit.mjs +182 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s29-regr-enforcer.mjs +69 -0
- package/templates/engine/.agents/scripts/check-loop.mjs +131 -0
- package/templates/engine/.agents/scripts/check-regression-consistency.mjs +252 -0
- package/templates/engine/.agents/scripts/check-schema-residue.mjs +144 -0
- package/templates/engine/.agents/scripts/check-scope-range.mjs +156 -0
- package/templates/engine/.agents/scripts/check-scope.mjs +121 -0
- package/templates/engine/.agents/scripts/check-scripts-syntax.mjs +138 -0
- package/templates/engine/.agents/scripts/check-secrets-lite.mjs +239 -0
- package/templates/engine/.agents/scripts/check-secrets.mjs +104 -0
- package/templates/engine/.agents/scripts/check-test-impact-map.mjs +107 -0
- package/templates/engine/.agents/scripts/ci-assert-frontend-deps.mjs +42 -0
- package/templates/engine/.agents/scripts/ci-commit-hygiene.mjs +86 -0
- package/templates/engine/.agents/scripts/ci-install-gitleaks.mjs +75 -0
- package/templates/engine/.agents/scripts/ci-push-before.mjs +49 -0
- package/templates/engine/.agents/scripts/closeout.mjs +127 -0
- package/templates/engine/.agents/scripts/compact-ledgers.mjs +70 -0
- package/templates/engine/.agents/scripts/confirm-doc.mjs +737 -0
- package/templates/engine/.agents/scripts/delegation-presence.mjs +38 -0
- package/templates/engine/.agents/scripts/dev-tour-model.mjs +1398 -0
- package/templates/engine/.agents/scripts/dream-run.mjs +283 -0
- package/templates/engine/.agents/scripts/ensure-board.mjs +187 -0
- package/templates/engine/.agents/scripts/failure-attribution.mjs +11 -0
- package/templates/engine/.agents/scripts/fill-intent.mjs +60 -0
- package/templates/engine/.agents/scripts/fill-plan.mjs +105 -0
- package/templates/engine/.agents/scripts/fill-spec.mjs +72 -0
- package/templates/engine/.agents/scripts/gen-dev-tour.mjs +191 -0
- package/templates/engine/.agents/scripts/gen-effective-policy.mjs +113 -0
- package/templates/engine/.agents/scripts/gen-engine-map.mjs +292 -0
- package/templates/engine/.agents/scripts/gen-narrative-claims.mjs +275 -0
- package/templates/engine/.agents/scripts/gen-verify-evidence.mjs +115 -0
- package/templates/engine/.agents/scripts/gen-wiki-board.mjs +221 -0
- package/templates/engine/.agents/scripts/gen-workflow-index.mjs +201 -0
- package/templates/engine/.agents/scripts/gen-workflow-metrics.mjs +692 -0
- package/templates/engine/.agents/scripts/git-merge-jsonl.mjs +62 -0
- package/templates/engine/.agents/scripts/judgment-ledger.mjs +68 -0
- package/templates/engine/.agents/scripts/kb-cache-evict.mjs +50 -0
- package/templates/engine/.agents/scripts/kb-search.mjs +423 -0
- package/templates/engine/.agents/scripts/lane-surface-audit.mjs +145 -0
- package/templates/engine/.agents/scripts/ledger-loader.mjs +77 -0
- package/templates/engine/.agents/scripts/ledger-shards.mjs +346 -0
- package/templates/engine/.agents/scripts/metrics-core.mjs +131 -0
- package/templates/engine/.agents/scripts/pipeline-run.mjs +964 -0
- package/templates/engine/.agents/scripts/policy.mjs +250 -0
- package/templates/engine/.agents/scripts/pr-create.mjs +54 -0
- package/templates/engine/.agents/scripts/pr-review.mjs +1551 -0
- package/templates/engine/.agents/scripts/quote-grounding.mjs +233 -0
- package/templates/engine/.agents/scripts/regen-ledgers.mjs +59 -0
- package/templates/engine/.agents/scripts/rewrite-file.mjs +135 -0
- package/templates/engine/.agents/scripts/rule-budget.mjs +246 -0
- package/templates/engine/.agents/scripts/stage-gates.mjs +812 -0
- package/templates/engine/.agents/scripts/test-impact-lib.mjs +451 -0
- package/templates/engine/.agents/scripts/test-impact.mjs +105 -0
- package/templates/engine/.agents/scripts/trust-mode.mjs +130 -0
- package/templates/engine/.agents/scripts/verify-scope.mjs +163 -0
- package/templates/engine/.agents/scripts/verify-wiki-consistency.mjs +264 -0
- package/templates/engine/.agents/scripts/verify.mjs +847 -0
- package/templates/engine/.agents/scripts/warn-format.mjs +57 -0
- package/templates/engine/.agents/scripts/wf-journal.mjs +230 -0
- package/templates/engine/.agents/scripts/workflow-board-server.mjs +696 -0
- package/templates/engine/.agents/scripts/workflow-enums.mjs +70 -0
- package/templates/engine/.agents/scripts/workflows-check.mjs +260 -0
- package/templates/engine/.agents/settings.json +33 -0
- package/templates/engine/.agents/skills/arena/SKILL.md +50 -0
- package/templates/engine/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/templates/engine/.agents/skills/blast-radius/SKILL.md +53 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/scripts/quality-gates.mjs +430 -0
- package/templates/engine/.agents/skills/dev-tour/SKILL.md +98 -0
- package/templates/engine/.agents/skills/dream/SKILL.md +63 -0
- package/templates/engine/.agents/skills/eval/SKILL.md +42 -0
- package/templates/engine/.agents/skills/eval/scripts/eval-score.mjs +59 -0
- package/templates/engine/.agents/skills/interrogate/SKILL.md +49 -0
- package/templates/engine/.agents/skills/interrogate/scripts/interrogate-plan.mjs +72 -0
- package/templates/engine/.agents/skills/number-vetting/SKILL.md +35 -0
- package/templates/engine/.agents/skills/page-refactor/SKILL.md +192 -0
- package/templates/engine/.agents/skills/page-refactor/references/templates.md +989 -0
- package/templates/engine/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/templates/engine/.agents/skills/papercut-fix/references/response-template.md +81 -0
- package/templates/engine/.agents/skills/pause-safely/SKILL.md +31 -0
- package/templates/engine/.agents/skills/perf/SKILL.md +42 -0
- package/templates/engine/.agents/skills/review-method/SKILL.md +92 -0
- package/templates/engine/.agents/skills/review-method/golden-set.md +61 -0
- package/templates/engine/.agents/skills/session-resume/SKILL.md +69 -0
- package/templates/engine/.agents/skills/session-resume/scripts/worktree-audit.mjs +110 -0
- package/templates/engine/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/templates/engine/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/templates/engine/.agents/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/templates/engine/.agents/skills/show-me-your-work/scripts/decision-log.mjs +24 -0
- package/templates/engine/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/templates/engine/.agents/skills/tfs-pr/scripts/tfs-pr.mjs +947 -0
- package/templates/engine/.agents/skills/verify-ui/SKILL.md +116 -0
- package/templates/engine/.agents/skills/verify-ui/features/.gitkeep +0 -0
- package/templates/engine/.agents/skills/verify-ui/scripts/gen-verify-feature.mjs +114 -0
- package/templates/engine/.agents/skills/visual-parity/SKILL.md +35 -0
- package/templates/engine/.agents/skills/why/SKILL.md +56 -0
- package/templates/engine/.agents/skills/why/scripts/why-evidence.mjs +74 -0
- package/templates/engine/.agents/skills/wiki/SKILL.md +53 -0
- package/templates/engine/.agents/tests/auto-tour.test.mjs +82 -0
- package/templates/engine/.agents/tests/dev-tour-model.test.mjs +452 -0
- package/templates/engine/.agents/tests/fill-plan-lite.test.mjs +46 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.md +14 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.model.json +179 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.md +21 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.model.json +194 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.md +20 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.model.json +225 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.md +15 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.model.json +160 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.model.json +266 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.md +17 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.model.json +359 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.md +16 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.model.json +131 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.model.json +190 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.model.json +362 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.model.json +224 -0
- package/templates/engine/.agents/tests/tools/gen-synthetic-plan.mjs +108 -0
- package/templates/git/.gitattributes +22 -0
- package/templates/git/.githooks/commit-msg +72 -0
- package/templates/git/.githooks/post-commit +62 -0
- package/templates/git/.githooks/pre-commit +197 -0
- package/templates/git/.githooks/pre-merge-commit +28 -0
- package/templates/git/.githooks/pre-push +201 -0
- package/templates/git/.gitignore.engine +11 -0
- package/templates/hosts/claude/CLAUDE.md +55 -0
- package/templates/hosts/claude/agents/implementer.md +7 -0
- package/templates/hosts/claude/agents/independent-reviewer.md +8 -0
- package/templates/hosts/claude/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/claude/agents/pr-finder.md +8 -0
- package/templates/hosts/claude/agents/pr-verifier.md +8 -0
- package/templates/hosts/claude/agents/ui-verifier.md +8 -0
- package/templates/hosts/claude/agents/wiki-compiler.md +8 -0
- package/templates/hosts/claude/commands/wf-deploy.md +10 -0
- package/templates/hosts/claude/commands/wf-maintain.md +10 -0
- package/templates/hosts/claude/commands/wf-new-task.md +10 -0
- package/templates/hosts/claude/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/claude/commands/wf-pr-review.md +10 -0
- package/templates/hosts/claude/commands/wf-review.md +10 -0
- package/templates/hosts/claude/commands/wf-stages.md +10 -0
- package/templates/hosts/claude/settings.json +57 -0
- package/templates/hosts/cline/agents/implementer.yml +15 -0
- package/templates/hosts/cline/agents/independent-reviewer.yml +20 -0
- package/templates/hosts/cline/agents/pr-adjudicator.yml +18 -0
- package/templates/hosts/cline/agents/pr-finder.yml +19 -0
- package/templates/hosts/cline/agents/pr-verifier.yml +18 -0
- package/templates/hosts/cline/agents/ui-verifier.yml +17 -0
- package/templates/hosts/cline/agents/wiki-compiler.yml +20 -0
- package/templates/hosts/cline/hooks/PreToolUse.cjs +260 -0
- package/templates/hosts/cline/workflows/wf-deploy.md +8 -0
- package/templates/hosts/cline/workflows/wf-maintain.md +8 -0
- package/templates/hosts/cline/workflows/wf-new-task.md +8 -0
- package/templates/hosts/cline/workflows/wf-pipeline-run.md +8 -0
- package/templates/hosts/cline/workflows/wf-pr-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-stages.md +8 -0
- package/templates/hosts/codebuddy/CODEBUDDY.md +7 -0
- package/templates/hosts/codebuddy/agents/implementer.md +9 -0
- package/templates/hosts/codebuddy/agents/independent-reviewer.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-finder.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-verifier.md +10 -0
- package/templates/hosts/codebuddy/agents/ui-verifier.md +11 -0
- package/templates/hosts/codebuddy/agents/wiki-compiler.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-deploy.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-maintain.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-new-task.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pr-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-stages.md +10 -0
- package/templates/hosts/codebuddy/rules/backend-scope.md +5 -0
- package/templates/hosts/codebuddy/rules/frontend-scope.md +5 -0
- package/templates/hosts/codebuddy/settings.json +31 -0
- package/templates/hosts/codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/templates/hosts/commandcode/agents/implementer.md +10 -0
- package/templates/hosts/commandcode/agents/independent-reviewer.md +9 -0
- package/templates/hosts/commandcode/agents/pr-adjudicator.md +9 -0
- package/templates/hosts/commandcode/agents/pr-finder.md +9 -0
- package/templates/hosts/commandcode/agents/pr-verifier.md +9 -0
- package/templates/hosts/commandcode/agents/ui-verifier.md +11 -0
- package/templates/hosts/commandcode/agents/wiki-compiler.md +10 -0
- package/templates/hosts/commandcode/commands/wf-deploy.md +9 -0
- package/templates/hosts/commandcode/commands/wf-maintain.md +9 -0
- package/templates/hosts/commandcode/commands/wf-new-task.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pr-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-stages.md +9 -0
- package/templates/hosts/commandcode/settings.json +59 -0
- package/templates/hosts/opencode/agents/implementer.md +51 -0
- package/templates/hosts/opencode/agents/independent-reviewer.md +18 -0
- package/templates/hosts/opencode/agents/pr-adjudicator.md +18 -0
- package/templates/hosts/opencode/agents/pr-finder.md +18 -0
- package/templates/hosts/opencode/agents/pr-verifier.md +18 -0
- package/templates/hosts/opencode/agents/ui-verifier.md +45 -0
- package/templates/hosts/opencode/agents/wiki-compiler.md +51 -0
- package/templates/hosts/opencode/commands/wf-deploy.md +7 -0
- package/templates/hosts/opencode/commands/wf-maintain.md +7 -0
- package/templates/hosts/opencode/commands/wf-new-task.md +7 -0
- package/templates/hosts/opencode/commands/wf-pipeline-run.md +7 -0
- package/templates/hosts/opencode/commands/wf-pr-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-stages.md +7 -0
- package/templates/hosts/pi/agents/implementer.md +10 -0
- package/templates/hosts/pi/agents/independent-reviewer.md +11 -0
- package/templates/hosts/pi/agents/pr-adjudicator.md +11 -0
- package/templates/hosts/pi/agents/pr-finder.md +10 -0
- package/templates/hosts/pi/agents/pr-verifier.md +10 -0
- package/templates/hosts/pi/agents/ui-verifier.md +10 -0
- package/templates/hosts/pi/agents/wiki-compiler.md +10 -0
- package/templates/hosts/pi/extensions/lib/gates-core.cjs +196 -0
- package/templates/hosts/pi/extensions/shipyard-gates.ts +95 -0
- package/templates/hosts/pi/settings.json +5 -0
- package/templates/hosts/qoder/agents/implementer.md +9 -0
- package/templates/hosts/qoder/agents/independent-reviewer.md +10 -0
- package/templates/hosts/qoder/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/qoder/agents/pr-finder.md +10 -0
- package/templates/hosts/qoder/agents/pr-verifier.md +10 -0
- package/templates/hosts/qoder/agents/ui-verifier.md +10 -0
- package/templates/hosts/qoder/agents/wiki-compiler.md +10 -0
- package/templates/hosts/qoder/commands/wf-deploy.md +8 -0
- package/templates/hosts/qoder/commands/wf-maintain.md +8 -0
- package/templates/hosts/qoder/commands/wf-new-task.md +8 -0
- package/templates/hosts/qoder/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/qoder/commands/wf-pr-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-stages.md +8 -0
- package/templates/hosts/qoder/settings.json +63 -0
- package/templates/hosts/qwen/agents/implementer.md +8 -0
- package/templates/hosts/qwen/agents/independent-reviewer.md +8 -0
- package/templates/hosts/qwen/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/qwen/agents/pr-finder.md +8 -0
- package/templates/hosts/qwen/agents/pr-verifier.md +8 -0
- package/templates/hosts/qwen/agents/ui-verifier.md +8 -0
- package/templates/hosts/qwen/agents/wiki-compiler.md +11 -0
- package/templates/hosts/qwen/commands/wf-deploy.md +9 -0
- package/templates/hosts/qwen/commands/wf-maintain.md +9 -0
- package/templates/hosts/qwen/commands/wf-new-task.md +9 -0
- package/templates/hosts/qwen/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/qwen/commands/wf-pr-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-stages.md +9 -0
- package/templates/hosts/qwen/settings.json +59 -0
- package/templates/hosts/trae/agents/implementer.md +9 -0
- package/templates/hosts/trae/agents/independent-reviewer.md +10 -0
- package/templates/hosts/trae/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/trae/agents/pr-finder.md +10 -0
- package/templates/hosts/trae/agents/pr-verifier.md +10 -0
- package/templates/hosts/trae/agents/ui-verifier.md +10 -0
- package/templates/hosts/trae/agents/wiki-compiler.md +10 -0
- package/templates/hosts/trae/commands/wf-deploy.md +8 -0
- package/templates/hosts/trae/commands/wf-maintain.md +8 -0
- package/templates/hosts/trae/commands/wf-new-task.md +8 -0
- package/templates/hosts/trae/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/trae/commands/wf-pr-review.md +8 -0
- package/templates/hosts/trae/commands/wf-review.md +8 -0
- package/templates/hosts/trae/commands/wf-stages.md +8 -0
- package/templates/hosts/trae/hooks.json +17 -0
- package/templates/hosts/trae/rules/backend-scope.md +5 -0
- package/templates/hosts/trae/rules/frontend-scope.md +5 -0
- package/templates/hosts/zcode/agents/implementer.md +8 -0
- package/templates/hosts/zcode/agents/independent-reviewer.md +8 -0
- package/templates/hosts/zcode/agents/ui-verifier.md +8 -0
- package/templates/hosts/zcode/agents/wiki-compiler.md +8 -0
- package/templates/hosts/zcode/config.json +31 -0
- package/templates/hosts/zcode/workflows/code-review.dwf.ts +428 -0
- package/templates/hosts/zcode/workflows/fullchain-flow-test.dwf.ts +898 -0
- package/templates/profiles/dotnet/.agents/config/lane-surfaces.txt +33 -0
- package/templates/profiles/dotnet/.agents/config/rule-budgets.txt +84 -0
- package/templates/profiles/dotnet/.agents/config/test-impact-map.json +590 -0
- package/templates/profiles/dotnet/.agents/config/workflow-modules.txt +18 -0
- package/templates/profiles/dotnet/.agents/hooks/commit-check.config.json +18 -0
- package/templates/profiles/dotnet/.agents/hooks/delete-guard-allowlist.txt +28 -0
- package/templates/profiles/dotnet/.agents/notes/runtime-env.md +178 -0
- package/templates/profiles/dotnet/AGENTS.md +52 -0
- package/templates/profiles/empty/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/empty/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/empty/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/empty/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/empty/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/empty/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/empty/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/empty/AGENTS.md +52 -0
- package/templates/profiles/node/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/node/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/node/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/node/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/node/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/node/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/node/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/node/AGENTS.md +52 -0
- package/templates/scaffold/wiki/INDEX.md +33 -0
- package/templates/scaffold/wiki/drafts-archive/README.md +7 -0
- package/templates/scaffold/wiki//344/272/247/345/223/201/351/234/200/346/261/202/.gitkeep +0 -0
- package/templates/scaffold/wiki//345/274/200/345/217/221/346/226/271/346/241/210/.gitkeep +0 -0
- package/templates/scaffold/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/templates/scaffold/wiki//346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/224/250/346/210/267/345/212/237/350/203/275/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/templates/scaffold/wiki//351/241/271/347/233/256/350/247/204/350/214/203/.gitkeep +0 -0
- package/templates/scaffold/workflow/INDEX.md +13 -0
- package/templates/scaffold/workflow/README.md +67 -0
- package/templates/scaffold/workflow/archive/README.md +3 -0
- package/templates/scaffold/workflow/delegations.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/delegations.md +4 -0
- package/templates/scaffold/workflow/effective-policy.md +4 -0
- package/templates/scaffold/workflow/evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/gate-cost.md +4 -0
- package/templates/scaffold/workflow/gate-metrics.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/incidents/_TEMPLATE.md +49 -0
- package/templates/scaffold/workflow/intents/_TEMPLATE.md +43 -0
- package/templates/scaffold/workflow/metrics.md +4 -0
- package/templates/scaffold/workflow/papercuts.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/papercuts.md +3 -0
- package/templates/scaffold/workflow/plans/_TEMPLATE.md +47 -0
- package/templates/scaffold/workflow/regression-checklist.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/regression-checklist.md +3 -0
- package/templates/scaffold/workflow/research/.gitkeep +0 -0
- package/templates/scaffold/workflow/reviews.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/specs/_TEMPLATE.md +87 -0
- package/templates/scaffold/workflow/verify-evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/verify-evidence.md +4 -0
- package/LICENSE +0 -21
- package/modules/gates/README.md +0 -25
- package/modules/gates/dotnet-ca/README.md +0 -24
- package/modules/gates/dotnet-ca/check-architecture.sh +0 -150
- package/modules/gates/dotnet-ca/local-pre-commit.line +0 -1
- package/modules/gates/generated-readonly/README.md +0 -13
- package/modules/gates/generated-readonly/check-generated.mjs +0 -61
- package/modules/gates/generated-readonly/local-pre-commit.line +0 -1
- package/modules/gates/node-layer/README.md +0 -9
- package/modules/gates/node-layer/check-node-layer.mjs +0 -29
- package/modules/gates/node-layer/local-pre-commit.line +0 -1
- package/modules/gates/py-import/README.md +0 -9
- package/modules/gates/py-import/check-py-import.mjs +0 -30
- package/modules/gates/py-import/local-pre-commit.line +0 -1
- package/modules/gates/test-protect/README.md +0 -23
- package/modules/gates/test-protect/check-test-protect.mjs +0 -64
- package/modules/gates/test-protect/local-pre-commit.line +0 -1
- package/modules/hosts/README.md +0 -57
- package/modules/hosts/claude/agents/implementer.md +0 -51
- package/modules/hosts/claude/agents/independent-reviewer.md +0 -49
- package/modules/hosts/claude/agents/ui-verifier.md +0 -48
- package/modules/hosts/claude/commands/wf-build.md +0 -69
- package/modules/hosts/claude/commands/wf-deploy.md +0 -58
- package/modules/hosts/claude/commands/wf-design.md +0 -49
- package/modules/hosts/claude/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/claude/commands/wf-maintain.md +0 -76
- package/modules/hosts/claude/commands/wf-new-task.md +0 -102
- package/modules/hosts/claude/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/claude/commands/wf-plan.md +0 -40
- package/modules/hosts/claude/commands/wf-review.md +0 -49
- package/modules/hosts/claude/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/claude/commands/wf-test.md +0 -68
- package/modules/hosts/codex/agents/implementer.md +0 -51
- package/modules/hosts/codex/agents/independent-reviewer.md +0 -49
- package/modules/hosts/codex/agents/ui-verifier.md +0 -48
- package/modules/hosts/codex/commands/wf-build.md +0 -69
- package/modules/hosts/codex/commands/wf-deploy.md +0 -58
- package/modules/hosts/codex/commands/wf-design.md +0 -49
- package/modules/hosts/codex/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/codex/commands/wf-maintain.md +0 -76
- package/modules/hosts/codex/commands/wf-new-task.md +0 -102
- package/modules/hosts/codex/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/codex/commands/wf-plan.md +0 -40
- package/modules/hosts/codex/commands/wf-review.md +0 -49
- package/modules/hosts/codex/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/codex/commands/wf-test.md +0 -68
- package/modules/hosts/codex/skills/flow-kit/SKILL.md +0 -14
- package/modules/hosts/cursor/agents/implementer.md +0 -51
- package/modules/hosts/cursor/agents/independent-reviewer.md +0 -49
- package/modules/hosts/cursor/agents/ui-verifier.md +0 -48
- package/modules/hosts/cursor/commands/wf-build.md +0 -69
- package/modules/hosts/cursor/commands/wf-deploy.md +0 -58
- package/modules/hosts/cursor/commands/wf-design.md +0 -49
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/cursor/commands/wf-maintain.md +0 -76
- package/modules/hosts/cursor/commands/wf-new-task.md +0 -102
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/cursor/commands/wf-plan.md +0 -40
- package/modules/hosts/cursor/commands/wf-review.md +0 -49
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/cursor/commands/wf-test.md +0 -68
- package/modules/hosts/omp/agents/implementer.md +0 -52
- package/modules/hosts/omp/agents/independent-reviewer.md +0 -50
- package/modules/hosts/omp/agents/ui-verifier.md +0 -49
- package/modules/hosts/opencode/agents/implementer.md +0 -59
- package/modules/hosts/opencode/agents/independent-reviewer.md +0 -53
- package/modules/hosts/opencode/agents/ui-verifier.md +0 -52
- package/modules/hosts/opencode/commands/wf-build.md +0 -69
- package/modules/hosts/opencode/commands/wf-deploy.md +0 -58
- package/modules/hosts/opencode/commands/wf-design.md +0 -49
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/opencode/commands/wf-maintain.md +0 -76
- package/modules/hosts/opencode/commands/wf-new-task.md +0 -102
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/opencode/commands/wf-plan.md +0 -40
- package/modules/hosts/opencode/commands/wf-review.md +0 -49
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/opencode/commands/wf-test.md +0 -68
- package/modules/hosts/trae/agents/implementer.md +0 -52
- package/modules/hosts/trae/agents/independent-reviewer.md +0 -51
- package/modules/hosts/trae/agents/ui-verifier.md +0 -50
- package/modules/hosts/trae/commands/wf-build.md +0 -70
- package/modules/hosts/trae/commands/wf-deploy.md +0 -59
- package/modules/hosts/trae/commands/wf-design.md +0 -50
- package/modules/hosts/trae/commands/wf-gate-checklist.md +0 -78
- package/modules/hosts/trae/commands/wf-maintain.md +0 -77
- package/modules/hosts/trae/commands/wf-new-task.md +0 -103
- package/modules/hosts/trae/commands/wf-pipeline-run.md +0 -36
- package/modules/hosts/trae/commands/wf-plan.md +0 -41
- package/modules/hosts/trae/commands/wf-review.md +0 -50
- package/modules/hosts/trae/commands/wf-sync-hosts.md +0 -65
- package/modules/hosts/trae/commands/wf-test.md +0 -69
- package/modules/hosts/trae/hooks/post-edit-check.cjs +0 -98
- package/modules/hosts/trae/hooks/pre-shell-check.cjs +0 -192
- package/modules/hosts/trae/hooks/resolve-shell.cjs +0 -30
- package/modules/hosts/trae/hooks.json +0 -29
- package/modules/hosts/trae/rules/beautify-input-chinese.md +0 -6
- package/modules/hosts/trae/rules/git-commit-message.md +0 -10
- package/modules/hosts/trae/rules/project-workflow.md +0 -14
- package/modules/hosts/zcode/agents/implementer.md +0 -51
- package/modules/hosts/zcode/agents/independent-reviewer.md +0 -49
- package/modules/hosts/zcode/agents/ui-verifier.md +0 -48
- package/src/add-gate.mjs +0 -116
- package/src/add-gate.test.mjs +0 -103
- package/src/add-host.mjs +0 -68
- package/src/cli.mjs +0 -169
- package/src/doctor.mjs +0 -629
- package/src/executor.mjs +0 -262
- package/src/executor.test.mjs +0 -295
- package/src/fresh-init.test.mjs +0 -64
- package/src/gate-dotnet-ca.test.mjs +0 -124
- package/src/gates.test.mjs +0 -143
- package/src/init.mjs +0 -382
- package/src/init.test.mjs +0 -163
- package/src/instance-ref.test.mjs +0 -62
- package/src/jscpd-drift.test.mjs +0 -145
- package/src/pack.test.mjs +0 -24
- package/src/profiles.mjs +0 -183
- package/src/render.mjs +0 -132
- package/src/rule-budget.test.mjs +0 -103
- package/src/run-tests.mjs +0 -56
- package/src/stack-profile.test.mjs +0 -95
- package/src/sync-hosts.mjs +0 -257
- package/src/sync-hosts.test.mjs +0 -291
- package/src/sync.mjs +0 -228
- package/src/sync.test.mjs +0 -452
- package/src/trae-hooks.test.mjs +0 -127
- package/src/validate.mjs +0 -77
- package/src/validate.test.mjs +0 -95
- package/templates/.gitattributes +0 -17
- package/templates/AGENTS.md +0 -58
- package/templates/_agents/board/index.html +0 -676
- package/templates/_agents/commands/build.md +0 -84
- package/templates/_agents/commands/deploy.md +0 -66
- package/templates/_agents/commands/design.md +0 -63
- package/templates/_agents/commands/gate-checklist.md +0 -91
- package/templates/_agents/commands/maintain.md +0 -90
- package/templates/_agents/commands/new-task.md +0 -110
- package/templates/_agents/commands/pipeline-run.md +0 -43
- package/templates/_agents/commands/plan.md +0 -48
- package/templates/_agents/commands/review.md +0 -62
- package/templates/_agents/commands/sync-hosts.md +0 -77
- package/templates/_agents/commands/test.md +0 -87
- package/templates/_agents/control-surfaces.txt +0 -53
- package/templates/_agents/engine-lock.json +0 -342
- package/templates/_agents/hooks/check-index-incremental.mjs +0 -48
- package/templates/_agents/hooks/check-pairing-incremental.mjs +0 -66
- package/templates/_agents/hooks/check-wiki-ledger.mjs +0 -30
- package/templates/_agents/hooks/commit-check.cjs +0 -193
- package/templates/_agents/hooks/local-pre-commit +0 -6
- package/templates/_agents/lane-surfaces.txt +0 -17
- package/templates/_agents/level-hints.txt +0 -30
- package/templates/_agents/loop/papercut-debt/DESIGN.md +0 -112
- package/templates/_agents/mechanism-registry.md +0 -35
- package/templates/_agents/metric-claims.txt +0 -81
- package/templates/_agents/notes/engine-internals.md +0 -17
- package/templates/_agents/notes/runtime-env.md +0 -18
- package/templates/_agents/roles/implementer.md +0 -47
- package/templates/_agents/roles/independent-reviewer.md +0 -45
- package/templates/_agents/roles/ui-verifier.md +0 -44
- package/templates/_agents/rule-budgets.txt +0 -20
- package/templates/_agents/scripts/agg-delegations.cjs +0 -302
- package/templates/_agents/scripts/agg-delegations.test.mjs +0 -282
- package/templates/_agents/scripts/agg-gate-stats.mjs +0 -113
- package/templates/_agents/scripts/agg-gate-stats.test.mjs +0 -95
- package/templates/_agents/scripts/agg-judgments.mjs +0 -156
- package/templates/_agents/scripts/agg-judgments.test.mjs +0 -93
- package/templates/_agents/scripts/archive-sweep.mjs +0 -235
- package/templates/_agents/scripts/archive-sweep.test.mjs +0 -129
- package/templates/_agents/scripts/check-attribution.mjs +0 -37
- package/templates/_agents/scripts/check-convergence.mjs +0 -124
- package/templates/_agents/scripts/check-engine-integrity.mjs +0 -220
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +0 -215
- package/templates/_agents/scripts/check-funnel.mjs +0 -56
- package/templates/_agents/scripts/check-hygiene.mjs +0 -167
- package/templates/_agents/scripts/check-hygiene.test.mjs +0 -182
- package/templates/_agents/scripts/check-index-incremental.test.mjs +0 -73
- package/templates/_agents/scripts/check-lane-surface.mjs +0 -238
- package/templates/_agents/scripts/check-lane-surface.test.mjs +0 -302
- package/templates/_agents/scripts/check-ledger-invariant.mjs +0 -586
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +0 -639
- package/templates/_agents/scripts/check-loop-rev.test.mjs +0 -336
- package/templates/_agents/scripts/check-loop-unit.test.mjs +0 -103
- package/templates/_agents/scripts/check-loop.mjs +0 -1987
- package/templates/_agents/scripts/check-loop.sh +0 -6
- package/templates/_agents/scripts/check-loop.test.mjs +0 -3912
- package/templates/_agents/scripts/check-metric-claims.mjs +0 -277
- package/templates/_agents/scripts/check-prejudgment.mjs +0 -64
- package/templates/_agents/scripts/check-registry.mjs +0 -45
- package/templates/_agents/scripts/check-scope.mjs +0 -96
- package/templates/_agents/scripts/check-scope.test.mjs +0 -99
- package/templates/_agents/scripts/check-scripts-syntax.mjs +0 -84
- package/templates/_agents/scripts/check-scripts-syntax.test.mjs +0 -72
- package/templates/_agents/scripts/check-spec-verif.mjs +0 -47
- package/templates/_agents/scripts/check-stage-index.mjs +0 -40
- package/templates/_agents/scripts/check-stage-index.test.mjs +0 -77
- package/templates/_agents/scripts/closeout-l1.mjs +0 -217
- package/templates/_agents/scripts/closeout-l1.test.mjs +0 -105
- package/templates/_agents/scripts/commit-check-trigger.test.mjs +0 -205
- package/templates/_agents/scripts/compact-ledgers.mjs +0 -97
- package/templates/_agents/scripts/compact-ledgers.test.mjs +0 -162
- package/templates/_agents/scripts/confirm-doc.mjs +0 -610
- package/templates/_agents/scripts/confirm-doc.test.mjs +0 -1119
- package/templates/_agents/scripts/doctor.test.mjs +0 -770
- package/templates/_agents/scripts/draft-sediment.mjs +0 -178
- package/templates/_agents/scripts/draft-sediment.test.mjs +0 -272
- package/templates/_agents/scripts/edit-face-check.mjs +0 -109
- package/templates/_agents/scripts/edit-face-check.test.mjs +0 -99
- package/templates/_agents/scripts/ensure-board.mjs +0 -185
- package/templates/_agents/scripts/fill-intent.mjs +0 -91
- package/templates/_agents/scripts/fill-intent.test.mjs +0 -113
- package/templates/_agents/scripts/fill-plan.mjs +0 -79
- package/templates/_agents/scripts/fill-plan.test.mjs +0 -224
- package/templates/_agents/scripts/fill-spec.mjs +0 -70
- package/templates/_agents/scripts/fill-spec.test.mjs +0 -266
- package/templates/_agents/scripts/fixture-scripts.mjs +0 -153
- package/templates/_agents/scripts/fixture-scripts.test.mjs +0 -112
- package/templates/_agents/scripts/gate-checklist.mjs +0 -209
- package/templates/_agents/scripts/gate-checklist.test.mjs +0 -201
- package/templates/_agents/scripts/gate-seg.mjs +0 -54
- package/templates/_agents/scripts/gate-seg.test.mjs +0 -112
- package/templates/_agents/scripts/gen-effective-policy.mjs +0 -107
- package/templates/_agents/scripts/gen-effective-policy.test.mjs +0 -100
- package/templates/_agents/scripts/gen-verify-evidence.mjs +0 -107
- package/templates/_agents/scripts/gen-verify-evidence.test.mjs +0 -84
- package/templates/_agents/scripts/gen-wiki-board.mjs +0 -276
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +0 -249
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +0 -251
- package/templates/_agents/scripts/gen-workflow-dashboard.test.mjs +0 -188
- package/templates/_agents/scripts/gen-workflow-index.mjs +0 -201
- package/templates/_agents/scripts/gen-workflow-index.test.mjs +0 -152
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +0 -466
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +0 -343
- package/templates/_agents/scripts/git-merge-jsonl.mjs +0 -63
- package/templates/_agents/scripts/git-merge-jsonl.test.mjs +0 -125
- package/templates/_agents/scripts/judgment-ledger.mjs +0 -65
- package/templates/_agents/scripts/judgment-ledger.test.mjs +0 -129
- package/templates/_agents/scripts/kb-cache-evict.mjs +0 -50
- package/templates/_agents/scripts/kb-cache-evict.test.mjs +0 -104
- package/templates/_agents/scripts/kb-search.mjs +0 -413
- package/templates/_agents/scripts/kb-search.test.mjs +0 -299
- package/templates/_agents/scripts/lane-surface-audit.mjs +0 -143
- package/templates/_agents/scripts/lane-surface-audit.test.mjs +0 -93
- package/templates/_agents/scripts/ledger-doc-chain.test.mjs +0 -166
- package/templates/_agents/scripts/ledger-loader.mjs +0 -108
- package/templates/_agents/scripts/ledger-loader.test.mjs +0 -131
- package/templates/_agents/scripts/ledger-prune.mjs +0 -96
- package/templates/_agents/scripts/ledger-prune.test.mjs +0 -120
- package/templates/_agents/scripts/ledger-shards.mjs +0 -344
- package/templates/_agents/scripts/ledger-shards.test.mjs +0 -356
- package/templates/_agents/scripts/ledger-ts-monotonic.test.mjs +0 -135
- package/templates/_agents/scripts/level-criteria.mjs +0 -231
- package/templates/_agents/scripts/level-criteria.test.mjs +0 -281
- package/templates/_agents/scripts/mechanism-retire-watch.mjs +0 -183
- package/templates/_agents/scripts/mechanism-retire-watch.test.mjs +0 -114
- package/templates/_agents/scripts/papercut-debt-controller.mjs +0 -141
- package/templates/_agents/scripts/papercut-debt-controller.test.mjs +0 -127
- package/templates/_agents/scripts/papercut-debt-sensor.mjs +0 -170
- package/templates/_agents/scripts/papercut-debt-sensor.test.mjs +0 -146
- package/templates/_agents/scripts/pipeline-run-docs.mjs +0 -76
- package/templates/_agents/scripts/pipeline-run-run.mjs +0 -63
- package/templates/_agents/scripts/pipeline-run.mjs +0 -867
- package/templates/_agents/scripts/pipeline-run.test.mjs +0 -517
- package/templates/_agents/scripts/policy.mjs +0 -281
- package/templates/_agents/scripts/pre-push.test.mjs +0 -105
- package/templates/_agents/scripts/resolve-merge-conflicts.mjs +0 -110
- package/templates/_agents/scripts/resolve-merge-conflicts.test.mjs +0 -87
- package/templates/_agents/scripts/rewrite-file.mjs +0 -133
- package/templates/_agents/scripts/rewrite-file.test.mjs +0 -148
- package/templates/_agents/scripts/rule-budget.mjs +0 -96
- package/templates/_agents/scripts/rule-budget.test.mjs +0 -118
- package/templates/_agents/scripts/run-tests.mjs +0 -99
- package/templates/_agents/scripts/run-tests.test.mjs +0 -105
- package/templates/_agents/scripts/solidify-task.mjs +0 -109
- package/templates/_agents/scripts/solidify-task.test.mjs +0 -129
- package/templates/_agents/scripts/stage-gates.mjs +0 -343
- package/templates/_agents/scripts/stage-gates.test.mjs +0 -105
- package/templates/_agents/scripts/trust-mode.mjs +0 -67
- package/templates/_agents/scripts/trust-mode.test.mjs +0 -110
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +0 -253
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +0 -123
- package/templates/_agents/scripts/verify.mjs +0 -345
- package/templates/_agents/scripts/verify.test.mjs +0 -373
- package/templates/_agents/scripts/wf-journal.mjs +0 -231
- package/templates/_agents/scripts/wf-journal.test.mjs +0 -216
- package/templates/_agents/scripts/wiki-search.mjs +0 -19
- package/templates/_agents/scripts/wiki-search.test.mjs +0 -57
- package/templates/_agents/scripts/workflow-board-server.mjs +0 -393
- package/templates/_agents/scripts/workflow-board-server.test.mjs +0 -201
- package/templates/_agents/scripts/workflow-enums.mjs +0 -70
- package/templates/_agents/scripts/workflow-enums.test.mjs +0 -118
- package/templates/_agents/scripts/workflows-check.mjs +0 -260
- package/templates/_agents/scripts/workflows-check.test.mjs +0 -278
- package/templates/_agents/scripts-test-exempt.txt +0 -16
- package/templates/_agents/skills/papercut-fix/SKILL.md +0 -60
- package/templates/_agents/skills/papercut-fix/references/response-template.md +0 -81
- package/templates/_agents/skills/review-method/SKILL.md +0 -58
- package/templates/_agents/skills/verify-ui/SKILL.md +0 -61
- package/templates/_agents/skills/wiki/SKILL.md +0 -106
- package/templates/_agents/workflow-enums.txt +0 -26
- package/templates/_agents/workflow-modules.txt +0 -11
- package/templates/_agents/workflows/_TEMPLATE.md +0 -75
- package/templates/_agents/workflows/pipeline-closing.md +0 -28
- package/templates/_agents/workflows//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +0 -16
- package/templates/_githooks/commit-msg +0 -17
- package/templates/_githooks/post-commit +0 -10
- package/templates/_githooks/pre-commit +0 -126
- package/templates/_githooks/pre-merge-commit +0 -29
- package/templates/_githooks/pre-push +0 -136
- package/templates/_github/workflows/kit-ci.yml +0 -49
- package/templates/wiki/INDEX.md +0 -73
- package/templates/wiki/drafts-archive/README.md +0 -3
- package/templates/wiki//344/272/247/345/223/201/351/234/200/346/261/202/README.md +0 -3
- package/templates/wiki//345/274/200/345/217/221/346/226/271/346/241/210/README.md +0 -3
- package/templates/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +0 -3
- package/templates/wiki//346/265/213/350/257/225/346/212/245/345/221/212/README.md +0 -3
- package/templates/wiki//347/224/250/346/210/267/345/212/237/350/203/275/README.md +0 -3
- package/templates/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +0 -77
- package/templates/wiki//351/241/271/347/233/256/350/247/204/350/214/203/README.md +0 -3
- package/templates/wiki//351/241/271/347/233/256/350/256/241/345/210/222/README.md +0 -3
- package/templates/workflow/README.md +0 -91
- package/templates/workflow/delegations.md +0 -29
- package/templates/workflow/incidents/_TEMPLATE.md +0 -51
- package/templates/workflow/intents/_TEMPLATE.md +0 -51
- package/templates/workflow/papercuts.md +0 -9
- package/templates/workflow/plans/_TEMPLATE.md +0 -47
- package/templates/workflow/regression-checklist.md +0 -23
- package/templates/workflow/specs/_TEMPLATE.md +0 -80
- /package/templates/{_agents → engine/.agents}/board/marked.min.js +0 -0
- /package/templates/{_agents/workflows → engine/.agents/pipelines}/steps//347/244/272/344/276/213-/351/203/250/347/275/262/351/252/214/350/257/201.md" +0 -0
- /package/templates/{_agents → engine/.agents}/scripts/git-core.mjs +0 -0
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// verify.mjs — 统一静态门编排(2026-10-09 质量增强版;2026-10-09 守护者自守护批次)
|
|
3
|
+
// 用途:在关单或 CI 前一键过门——执行全部静态检查,逐项输出 pass/fail。
|
|
4
|
+
// 语义:单源口径。确保本地 run-verify 与 Azure Pipeline 行为 100% 一致。
|
|
5
|
+
// 凭证落账:全绿才落绿凭证;任一步红即落失败行,供根因分析。
|
|
6
|
+
// 自守护:scripts-syntax 门守引擎自身(2026-10-09 审计 P0-1:本文件曾因
|
|
7
|
+
// SyntaxError 进 CI 而全链静默)。--test-cmd 为 fixture 测试注入缝:给了它则只跑
|
|
8
|
+
// [test, check-loop] 两步夹具,绿行带 testCmd:true 标记(生产凭证不与之混淆,
|
|
9
|
+
// 且 fixture 模式不触真实 npm/dotnet)。fail-fast:任一门红立即 exit 1。
|
|
10
|
+
// 编排(2026-10-16 并行化):guardian 门(scripts-syntax)串行先跑、未过即止;其余门进工作池并发
|
|
11
|
+
// (--jobs N / --serial,缺省 clamp(2..4, floor(cpus/4))),各自缓冲输出、完成即整块回放。
|
|
12
|
+
// 任一门红 → 停排新门 + taskkill /T 树杀在跑门(fail-fast 语义与「未执行门」清单口径保留)。
|
|
13
|
+
// 实测(12 逻辑核,15 门时):串行 ~300s → 并发墙钟 ~120s(j3 膝点;见 run() 内档位注释)。
|
|
14
|
+
// 门数沿革:2026-10-09 九门 → 2026-10-14 18 门(G5 安全段 +2、依赖审计分两面)→
|
|
15
|
+
// 2026-10-16 15 门(依赖漏洞审计三门退役,理由见 GATES 内安全段注释)→
|
|
16
|
+
// 2026-10-22 16 门(引擎地图漂移门挂入第 6 位,改进 3)。
|
|
17
|
+
// 2026-10-24 19 门(复核 P1:工作流索引/指标自洽两门 + 台账指针存在性门)。
|
|
18
|
+
// 2026-10-25 20 门(优化1:本地门禁挂载自检 WARN 档挂入引擎段第 4 位——core.hooksPath 不随
|
|
19
|
+
// clone 传播的静默失效面从「靠人记得跑 check-local-gates」升格为每次关单自动对质)。
|
|
20
|
+
// 2026-11-11 增 4 门至 20(审计 P2「--no-verify 远端兜底缺口」:.agents/hooks 代码四门接入
|
|
21
|
+
// product cohort,本地增量档单边化 CI——执法点 = --mid/--full)。
|
|
22
|
+
// 用法:node .agents/scripts/verify.mjs [--full | --scope | --face <面> | --product | --mid] [--list] [--jobs N | --serial] [--help]
|
|
23
|
+
// **档位口径(命令侧单源,2026-11-08 补记)**:--scope = diff 面增量档(判据同缺省档,单源
|
|
24
|
+
// verify-scope.mjs);--full = 显式全量;--scope 与 --full 互斥。命令侧档位口径以此头注为准。
|
|
25
|
+
// --product = 业务面分档(cohort product + security),不落 all-gates 凭证。
|
|
26
|
+
// --mid = CI 中档(PR→develop / develop 直推):业务面同 --product,但 backend-test 仅跑单元测试
|
|
27
|
+
// (--unit-only,不碰集成测试库);不落 all-gates 凭证。三档口径见 §6.5(本地轻 / PR 中 / main 重)。
|
|
28
|
+
// **产品门单边化 CI(2026-11-08 档 1 减重;2026-11-11 增代码四门)**:缺省档与 --scope / --face 增量档
|
|
29
|
+
// 不再执行产品 cohort 5 门(backend-build / backend-test / frontend-lint / frontend-unit-test /
|
|
30
|
+
// frontend-build)+代码四门(code-architecture / code-audit-fields / code-delete-guard /
|
|
31
|
+
// code-notify-guard,审计 P2「--no-verify 远端兜底缺口」接入)——执法点单边移交
|
|
32
|
+
// CI(--full / --mid / --product 三档与 azure-pipelines 一字不变);secrets-scan、引擎段与
|
|
33
|
+
// wiki-consistency 照跑。门表叙事锚恒 20(裸 --list),增量档裁剪在执行期与 --list --scope / --face
|
|
34
|
+
// 干跑可见(跳过说明行)。
|
|
35
|
+
// --face <面> = 显式面覆盖(合法值 = verify-scope 面枚举 backend|frontend|docs,逗号多值):不做工作区
|
|
36
|
+
// 脏路径自动面检测,直接按给定面裁门;与 --full 互斥(亦拒 --scope / 分档 / 夹具旗标);跳过 24h 兜底
|
|
37
|
+
// (显式面 = 操作者已判读);绿行记 entry.face,face 绿行因 loud-skip ledger-invariant 不作增量锚。
|
|
38
|
+
// node .agents/scripts/verify.mjs --stub-gate <cmd> (仅 CHECK_LOOP_ROOT 夹具;走生产尾段,不打 testCmd)
|
|
39
|
+
// **默认档 = diff 面增量**(verify-scope-default 2026-10-22):不带参数即按变更面裁门;`--full` 显式全量。
|
|
40
|
+
// 兜底:最近 24h 无全量绿行(或 diff 面解析失败)→ 自动退回全量并打印 ⏭️ 兜底行,不静默降档。
|
|
41
|
+
// 基线候选 = 本地台账 ∪ 仓库凭证(workflow/verify-evidence.md,verify-evidence-fallback 2026-10-22):
|
|
42
|
+
// 新 worktree 无本地绿行时不再必然重付全量税;候选须为 HEAD 祖先,否则回落 origin/main。
|
|
43
|
+
// **门禁健康(gate-health 2026-10-22)**:成本预算 advisory(.agents/config/gate-budgets.json,
|
|
44
|
+
// 超限只告警不阻断,点名「下一批须退役一门」)+ 失败归因(env/flaky/real,failure-attribution.mjs,
|
|
45
|
+
// 只标注不改裁决)——把「体感重」变成可对质数字,假红不再训练人绕过门禁。
|
|
46
|
+
// (flaky 隔离重跑已退役 2026-11-08 减重档 3-U1:近 30 天零触发;flaky 一律人工立项处置。)
|
|
47
|
+
// **分层跑(2026-10-23,P0-1 改口径)**:engine-code 触面 → 引擎套件全量;业务/文档面 →
|
|
48
|
+
// `npm test -- --fast`(跳过最慢 9 套件,不再整门跳过)。全量 / --engine / CI / 零裁剪仍全量。
|
|
49
|
+
// 绿行 `fastTests` 标记可审计。
|
|
50
|
+
// --list:按执行序打印门 id 后退出(含 RUN_E2E=1 时的条件门),不执行;裸 --list 不参与裁剪(门表恒 20),
|
|
51
|
+
// 配 --scope / --face 干跑展示增量档裁剪结果(跳过说明行走 stderr,stdout 保持纯 id 可管道)。
|
|
52
|
+
// --jobs / --serial:并发档位与串行回退(见上「编排」)。
|
|
53
|
+
// 沿革:verify-evidence(凭证落账);2026-10-09 统一质量检查门禁 d009965(九门);
|
|
54
|
+
// guardian-selfcheck(修 :31 缺 =、GATES 加 scripts-syntax/engine-tests、
|
|
55
|
+
// 恢复 --test-cmd 夹具缝供 verify.test.mjs 断言);
|
|
56
|
+
// verify-parallel(串行编排 = 各门之和,本机 318s → 并发墙钟 ~130s;绿行加 wallMs)。
|
|
57
|
+
// verify-diet(2026-10-21):③backend-test --no-build 消双构建;①失败门输出留痕 tmp/ 并回显尾部;
|
|
58
|
+
// ④前端关单门 vue-tsc 分离(TF_BUILD 下仍全量 build);②--scope diff 面增量关单(口径单源 verify-scope.mjs)。
|
|
59
|
+
// verify-diet 二批(2026-10-21 P0,owner 拍板):⑤--scope 引擎自检面——engine-tests 引擎面触 = 全量、
|
|
60
|
+
// 业务面 = --fast(2026-10-23 改口径,不再整门跳过);⑥ledger-invariant
|
|
61
|
+
// 全史扫描默认 CI-only(diff 面触及台账时本地回列;门表/--list 恒 20,绿行 envSkips 记录跳过事实)。
|
|
62
|
+
// 引擎减重档 1-B(2026-11-08):增量档(缺省/--scope/--face)产品 5 门单边化 CI + --face 显式面覆盖。
|
|
63
|
+
// 引擎减重档 2-E(2026-11-08):engine-artifacts 门「漂移即红」改「自动重生成后通过」——生成物是
|
|
64
|
+
// 磁盘态的确定函数,漂移原地重生成自愈(复检确认),失败才红;并行会话在途立档不再误伤关单 verify。
|
|
65
|
+
|
|
66
|
+
import fs from 'node:fs';
|
|
67
|
+
import os from 'node:os';
|
|
68
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
69
|
+
import path from 'node:path';
|
|
70
|
+
import { fileURLToPath } from 'node:url';
|
|
71
|
+
import { computeDiffScope, parseEvidenceGreens, EVIDENCE_REL, CI_UNILATERAL_GATE_IDS, PRODUCT_FACES } from './verify-scope.mjs';
|
|
72
|
+
import { classifyFailure } from './failure-attribution.mjs';
|
|
73
|
+
|
|
74
|
+
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
75
|
+
const ROOT = process.env.CHECK_LOOP_ROOT || path.resolve(SCRIPT_DIR, '..', '..');
|
|
76
|
+
|
|
77
|
+
// --- 门禁定义 ---
|
|
78
|
+
// 引擎段在前(2026-10-10):语法与引擎测试仍最先;编排/预算/生效规则/闭环硬门/泳道接在其后。
|
|
79
|
+
// 产品段维持原相对顺序。遇红即停,但产品面的红不再挡在引擎段前面。
|
|
80
|
+
// --list 只打印 id 后退出,不执行。
|
|
81
|
+
const GATES = [
|
|
82
|
+
// guardian(2026-10-16 并行编排):本门未过则后序门一并不启动——引擎脚本不可解析时其余门无意义,
|
|
83
|
+
// 且夹具根(CHECK_LOOP_ROOT 指向无脚本目录)下若并行铺开,16 门会在假根里乱跑(原 verify.test 场景 7 口径)。
|
|
84
|
+
{ id: 'scripts-syntax', cohort: 'engine', guardian: true, name: '引擎脚本语法自检', cmd: 'node .agents/scripts/check-scripts-syntax.mjs', folder: '.', type: 'shell' },
|
|
85
|
+
{ id: 'workflows-check', cohort: 'engine', name: '编排脚本检查', cmd: 'node .agents/scripts/workflows-check.mjs', folder: '.', type: 'shell' },
|
|
86
|
+
{ id: 'rule-budget', cohort: 'engine', name: '常驻面预算检查', cmd: 'node .agents/scripts/rule-budget.mjs --all', folder: '.', type: 'shell' },
|
|
87
|
+
// 本地门禁挂载自检(2026-10-25 优化1,WARN 档):判据与 check-local-gates.mjs ①-④ 对齐(单源,一边改
|
|
88
|
+
// 另一边须跟)。默认 WARN 缺配只告警;CI(TF_BUILD)/非 git 根 loud-skip;升格 = cmd 加 --strict(owner 拍板)。
|
|
89
|
+
{ id: 'local-gate-config', cohort: 'engine', name: '本地门禁挂载自检(WARN 档)', cmd: 'node .agents/scripts/check-local-gate-config.mjs', folder: '.', type: 'shell' },
|
|
90
|
+
// 生成物漂移单门(2026-10-28 引擎减重第三刀;2026-11-08 档 2-E 改自愈):effective-policy / engine-map /
|
|
91
|
+
// workflow-index 三门机制相同(跑生成器 --check 比对磁盘),合并为一次调用;漂移 → 原地重生成自愈后按
|
|
92
|
+
// 通过计,重生成/复检失败才红(判据与自愈单源在 check-engine-artifacts.mjs,各档含 --full 同语义)。
|
|
93
|
+
{ id: 'engine-artifacts', cohort: 'engine', name: '生成物漂移检查(3 份)', cmd: 'node .agents/scripts/check-engine-artifacts.mjs', folder: '.', type: 'shell' },
|
|
94
|
+
// 默认硬门。hygiene 段已于 2026-10-28 全部退役(只跑 hard 5 段)。
|
|
95
|
+
{ id: 'check-loop', cohort: 'engine', name: '闭环门禁校验', cmd: 'node .agents/scripts/check-loop.mjs', folder: '.', type: 'shell' },
|
|
96
|
+
{ id: 'ledger-doc-presence', cohort: 'engine', name: '台账指针存在性', cmd: 'node .agents/scripts/check-ledger-doc-presence.mjs', folder: '.', type: 'shell' },
|
|
97
|
+
// 确认台账不变量(ledger-invariant-ci):历史全扫挂进引擎段——此前该门自称 CI 机器门
|
|
98
|
+
// 却从未进任何门表,71 处存量断档积累数月无人见(当日 DAG 感知重写 + HISTORY_BASELINE 声明后
|
|
99
|
+
// 首次全绿,方具挂门条件)。pre-commit 仅 --staged 前缀面,全史审计由此门独担。
|
|
100
|
+
// verify-diet 二批(2026-10-21 P0-2,owner 拍板):本地关单不再重复付全史扫描(~37s)——TF_BUILD 外
|
|
101
|
+
// 执行期 loud-skip(diff 面触台账即回列;门表/--list 恒 20,同 lane-surface-ci「本地跳过」先例);全史审计由 CI 独担
|
|
102
|
+
// (main 全量 verify 含本门;develop 最小 CI 面 secrets+check-loop 不含本门——2026-10-25 起),新违规仍被提交时刻 --staged 增量门当场拦。
|
|
103
|
+
{ id: 'ledger-invariant', cohort: 'engine', name: '确认台账不变量(历史全扫)', cmd: 'node .agents/scripts/check-ledger-invariant.mjs', folder: '.', type: 'shell' },
|
|
104
|
+
// 泳道 diff 面(ai-native-review-p1):CI(TF_BUILD/合并提交检出)按基准执法——产品契约面
|
|
105
|
+
// 改动须 diff 内协伴 L2+ 入口;本地手跑无基准事实 → 脚本内 advisory 跳过(显式 --base origin/main 可预检)。
|
|
106
|
+
{ id: 'lane-surface-ci', cohort: 'engine', name: '泳道完整性(CI diff 面;本地无基准则跳过)', cmd: 'node .agents/scripts/check-lane-surface.mjs --ci', folder: '.', type: 'shell' },
|
|
107
|
+
// 安全段(2026-10-14 决定 4 / G5 插队):密钥扫描。
|
|
108
|
+
// secrets-scan:gitleaks detect + 基线(.gitleaks-baseline.json,存量豁免清单,用户拍板——
|
|
109
|
+
// 2026-10-15 扩 6 处权限Key 标识符,见 check-secrets.mjs 头注);
|
|
110
|
+
// **2026-10-29 起恒执法**:gitleaks 三处解析皆缺(典型 = CI agent 装不上)→ 自动降级为纯 Node
|
|
111
|
+
// 兜底扫描 check-secrets-lite.mjs(同一基线做文件级豁免),不再 loud-skip;输出首行标明执法者。
|
|
112
|
+
// 需要缺二进制即红:SECRETS_SCAN_REQUIRE_GITLEAKS=1(check-secrets exit 2)。
|
|
113
|
+
{ id: 'secrets-scan', cohort: 'security', name: '密钥扫描(gitleaks 优先 / lite 兜底,+基线)', cmd: 'node .agents/scripts/check-secrets.mjs', folder: '.', type: 'shell' },
|
|
114
|
+
// 依赖漏洞审计三门(nuget-audit / frontend-audit-prod / frontend-audit-devtool)2026-10-16 退役
|
|
115
|
+
// (owner 指令):三者皆依赖公网漏洞服务(npm `/-/npm/v1/security/*`、NuGet 源索引的
|
|
116
|
+
// `VulnerabilityInfo`),内网镜像均不代理该面(实测见 runtime-env §6.4「漏洞数据源实测」),
|
|
117
|
+
// 冷缓存/网络抖动即假红、换内网源即假绿——判据不可靠,故整族退出关单门表。
|
|
118
|
+
// 退役留档:机制台账两行(NuGet 漏洞门 / 前端依赖审计)+ papercuts 2026-10-16 行。
|
|
119
|
+
// —— 代码四门(2026-11-11 owner 拍板接入 product cohort;2026-11-10 审计 P2「--no-verify 远端兜底缺口」
|
|
120
|
+
// 修复):原 .agents/hooks pre-commit 专用四门(local-pre-commit.mjs 同批脚本,判据单源不变),
|
|
121
|
+
// 随本表进 CI --mid/--full 执法;本地 pre-commit 保留为最早拦截点(.githooks/pre-commit 口径已同步)。
|
|
122
|
+
// 四门 id 已入 verify-scope 的 CI_UNILATERAL_GATE_IDS——本地增量档单边化 CI。
|
|
123
|
+
{ id: 'code-architecture', cohort: 'product', name: '架构红线(Application 禁引 Infrastructure 等)', cmd: 'node .agents/hooks/check-architecture.mjs', folder: '.', type: 'shell' },
|
|
124
|
+
// CI_PUSH_BEFORE 在场(azure-pipelines ci-push-before 步注入的 pipeline 变量)扫该区间新增行;
|
|
125
|
+
// 缺省扫暂存区新增行——存量不拦(渐进收口语义与 pre-commit 一字不变)。
|
|
126
|
+
{ id: 'code-audit-fields', cohort: 'product',
|
|
127
|
+
name: '审计字段守卫(禁手工写 Operator 等)',
|
|
128
|
+
cmd: process.env.CI_PUSH_BEFORE ? `node .agents/hooks/check-audit-fields.mjs --range ${process.env.CI_PUSH_BEFORE}..HEAD` : 'node .agents/hooks/check-audit-fields.mjs',
|
|
129
|
+
folder: '.', type: 'shell' },
|
|
130
|
+
// 删除守卫默认即全仓面(Application/API 全目录计数比对 allowlist,非暂存面)——静态 cmd 零改接入。
|
|
131
|
+
{ id: 'code-delete-guard', cohort: 'product', name: '删除守卫(Remove/RemoveRange 须登记 allowlist)', cmd: 'node .agents/hooks/check-delete-guard.mjs', folder: '.', type: 'shell' },
|
|
132
|
+
{ id: 'code-notify-guard', cohort: 'product', name: '通知守卫(frontend 禁直调 antd message)', cmd: 'node .agents/hooks/check-notify-guard.mjs', folder: '.', type: 'shell' },
|
|
133
|
+
{ id: 'frontend-lint', cohort: 'product', name: '前端代码规范检查', cmd: 'npm run lint:check', folder: 'frontend', type: 'shell' },
|
|
134
|
+
// 前端单测硬门(2026-10-09):Vitest 纯 node 面零外部依赖,CI 可执法——
|
|
135
|
+
// 补齐「后端 1426 用例 vs 前端 0」的验证面不对称(AI-Native 架构审查 P1-1)。
|
|
136
|
+
{ id: 'frontend-unit-test', cohort: 'product', name: '前端单测 (Vitest)', cmd: 'npm run test:unit', folder: 'frontend', type: 'shell' },
|
|
137
|
+
{ id: 'wiki-consistency', cohort: 'product', name: 'wiki 三方一致性', cmd: 'node .agents/scripts/verify-wiki-consistency.mjs', folder: '.', type: 'shell' },
|
|
138
|
+
{ id: 'backend-build', cohort: 'product', name: '后端编译', cmd: 'dotnet build Shipyard.Material.sln', folder: '.', type: 'shell' },
|
|
139
|
+
// --no-build(verify-diet 2026-10-21 ③):测试直接消费 backend-build 产物,消「build → test 内部再
|
|
140
|
+
// 构建同一 sln」的双构建。deps 仍必需:--no-build 无产物即红,且保持依赖门序(依赖门红 → 本门不启动)。
|
|
141
|
+
// 入口收敛(gate-diet #1' 2026-10-23):dotnet test sln --no-build 单库串行
|
|
142
|
+
// (TEST_DB_CONN=Deve_CSS_SuHao;2026-10-30 分区机制退役,owner 裁定「不要搞三分区」)。
|
|
143
|
+
{ id: 'backend-test', cohort: 'product', name: '后端自动化测试', cmd: 'node scripts/verify/backend/run-backend-tests.mjs', folder: '.', type: 'shell', deps: ['backend-build'] },
|
|
144
|
+
// 前端关单门(verify-diet ④ 分离):本地关单只执法类型检查——vite bundle 产物不进任何断言,
|
|
145
|
+
// 对验证语义无贡献,完整构建留在 deploy 与 CI(TF_BUILD 时仍 npm run build 全量)。
|
|
146
|
+
// 门 id/计数变更(--list 恒 20,2026-11-11 增代码四门;2026-10-25 local-gate-config 加入引擎段;2026-10-24 复核加三门);s23 GATE_CMD 已同步收 vue-tsc。
|
|
147
|
+
{ id: 'frontend-build', cohort: 'product',
|
|
148
|
+
name: process.env.TF_BUILD ? '前端构建 (含类型检查)' : '前端类型检查 (vue-tsc)',
|
|
149
|
+
cmd: process.env.TF_BUILD ? 'npm run build' : 'npm run type-check',
|
|
150
|
+
folder: 'frontend', type: 'shell' },
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
// diff 面 lint 降范围(2026-11-05,--scope 档只 lint 变更面文件)随 2026-11-08 档 1-B 单边化退役:
|
|
154
|
+
// frontend-lint 已整体移 CI,本地增量档不再出现该门(scopedLintCmd 与阈值常量一并移除)。
|
|
155
|
+
|
|
156
|
+
// 产品门单边化 CI 跳过说明(档 1-B):增量档门清单上方恒打印一行(--list 走 stderr,保持 stdout 纯 id)。
|
|
157
|
+
const UNILATERAL_NOTE = `产品门单边化 CI(2026-11-08 档 1 减重;2026-11-11 增代码四门):${[...CI_UNILATERAL_GATE_IDS].join('、')} 共 ${CI_UNILATERAL_GATE_IDS.size} 门本地增量档(缺省/--scope/--face)不执行——执法点移交 CI(--full/--mid/--product 档不变)`;
|
|
158
|
+
|
|
159
|
+
// fixture 夹具门(--test-cmd 注入时替换全部生产门——原 verify.test.mjs 1/2、2/2 断言依赖此口径,测试面已退役 2026-10-28)
|
|
160
|
+
// check-loop 用绝对路径直调真实脚本——夹具根里没有脚本本体,root 归属仍由 CHECK_LOOP_ROOT 裁决。
|
|
161
|
+
const fixtureGates = (cmd) => [
|
|
162
|
+
{ id: 'test', name: '测试步(注入)', cmd, folder: '.', type: 'shell' },
|
|
163
|
+
{ id: 'check-loop', name: '闭环门禁校验', cmd: `node "${path.join(SCRIPT_DIR, 'check-loop.mjs')}"`, folder: '.', type: 'shell' },
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
// E2E 冒烟条件门(2026-10-09):RUN_E2E=1 才执法——前置是全栈在线
|
|
167
|
+
// (前端 5203 + API 8932 + SMOKE_ADMIN/SMOKE_ADMIN_PASSWORD 凭证),CI 未配全栈前不假装执法;
|
|
168
|
+
// 未启用时开跑前显式打印 loud-skip(跳过可见,与 fail-loud 对称)。
|
|
169
|
+
if (process.env.RUN_E2E === '1') {
|
|
170
|
+
GATES.push({ id: 'frontend-e2e', cohort: 'product', name: '前端 E2E 冒烟 (Playwright)', cmd: 'npm run test:e2e', folder: 'frontend', type: 'shell' });
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Stack profile(agentic-flow-kit 通用化):基础门表里的 product 门是 dotnet/Vue 专用。
|
|
174
|
+
// node/empty 装户只保留 engine + security + wiki 门;node 栈在 package.json 有 test 脚本时追加 npm test。
|
|
175
|
+
const STACK = (() => {
|
|
176
|
+
try { return JSON.parse(fs.readFileSync('.agents/config/engine.json', 'utf8')).options?.stack || 'dotnet'; }
|
|
177
|
+
catch { return 'dotnet'; }
|
|
178
|
+
})();
|
|
179
|
+
if (STACK !== 'dotnet') {
|
|
180
|
+
for (let i = GATES.length - 1; i >= 0; i -= 1) {
|
|
181
|
+
if (/^(backend-|frontend-|code-)/.test(GATES[i].id)) GATES.splice(i, 1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (STACK === 'node') {
|
|
185
|
+
try {
|
|
186
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
187
|
+
if (pkg.scripts && pkg.scripts.test) {
|
|
188
|
+
GATES.push({ id: 'node-test', cohort: 'product', name: 'Node tests', cmd: 'npm test', folder: '.', type: 'shell' });
|
|
189
|
+
}
|
|
190
|
+
} catch { /* not a node project root */ }
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// 计数捕获:优先 run-tests 的「断言合计」汇总行,退路取末条「合计: PASS x / FAIL y」
|
|
194
|
+
//(夹具假命令与单套件输出皆走退路;无匹配则省略计数键,exitCode 才是硬事实)。
|
|
195
|
+
const parseCounts = (out) => {
|
|
196
|
+
const agg = /断言合计 PASS (\d+) \/ FAIL (\d+)/.exec(out || '');
|
|
197
|
+
if (agg) return { passed: Number(agg[1]), failed: Number(agg[2]) };
|
|
198
|
+
const all = [...(out || '').matchAll(/合计: PASS (\d+) \/ FAIL (\d+)/g)];
|
|
199
|
+
if (all.length) return { passed: Number(all[all.length - 1][1]), failed: Number(all[all.length - 1][2]) };
|
|
200
|
+
return null;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
// 门禁成本预算(gate-budget 2026-10-22):advisory——超限只告警不阻断;连续两月超限由 owner
|
|
204
|
+
// 裁决降档/退役一门(一进一出)。配置缺失/非法 = 不告警(fail-open,观测面不挡裁决面)。
|
|
205
|
+
const readGateConfig = (root) => {
|
|
206
|
+
try { return JSON.parse(fs.readFileSync(path.join(root, '.agents', 'config', 'gate-budgets.json'), 'utf8')); } catch { return {}; }
|
|
207
|
+
};
|
|
208
|
+
const readGateBudget = (root, key) => {
|
|
209
|
+
const v = Number(readGateConfig(root)[key]);
|
|
210
|
+
return Number.isFinite(v) && v > 0 ? v : null;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const recordFailure = (step, exitInfo, note, attribution) => {
|
|
214
|
+
try {
|
|
215
|
+
const entry = { ts: new Date().toISOString(), exitCode: typeof exitInfo === 'number' ? exitInfo : -1, suite: step, note };
|
|
216
|
+
// 归因(gate-health 2026-10-22):env / flaky / real——红单可读,AI 不在假红上反复重跑。
|
|
217
|
+
// 存量豁免(2026-11-10):此锚前的失败行与全部绿行(绿行无失败可归因,attribution 只标注失败,
|
|
218
|
+
// 恒不落)可缺该字段——消费侧按未知处理,不回填不追溯(同 policy.mjs attributionSince 存量豁免纪律)。
|
|
219
|
+
if (attribution) entry.attribution = attribution;
|
|
220
|
+
if (process.env.PIPELINE_RUN_ID) entry.runId = process.env.PIPELINE_RUN_ID;
|
|
221
|
+
fs.mkdirSync(path.join(ROOT, '.agents'), { recursive: true });
|
|
222
|
+
fs.appendFileSync(path.join(ROOT, '.agents', 'verifications.jsonl'), `${JSON.stringify(entry)}\n`);
|
|
223
|
+
console.log(`[verify] 🧾 失败行已留痕 verifications.jsonl(suite=${step}${attribution ? `,归因 ${attribution}` : ''})`);
|
|
224
|
+
} catch (e) {
|
|
225
|
+
console.error(`[verify] ⚠️ 失败行落账失败(${e.code || e.message})`);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// 门输出留痕(verify-diet 2026-10-21 ①):失败门完整 stdout/stderr 落 tmp/verify-<id>.log 并回显
|
|
230
|
+
// 尾部 40 行——fail-fast 红从「只知道 exit 1」变为可当场定性(papercuts 2026-10-17 拟修①;
|
|
231
|
+
// 先例:后端门红无法区分已知负载偶发与新回归,只能盲跑复跑)。落盘失败不改裁决(同 recordFailure 容错)。
|
|
232
|
+
const persistGateLog = (gate, r) => {
|
|
233
|
+
try {
|
|
234
|
+
const dir = path.join(ROOT, 'tmp');
|
|
235
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
236
|
+
const p = path.join(dir, `verify-${gate.id}.log`);
|
|
237
|
+
fs.writeFileSync(p, [
|
|
238
|
+
`# gate=${gate.id} name=${gate.name}`,
|
|
239
|
+
`# cmd=${gate.cmd}`,
|
|
240
|
+
`# status=${r.status ?? r.error?.code} duration=${r.durMs}ms`,
|
|
241
|
+
'=== stdout ===', r.stdout || '(空)',
|
|
242
|
+
'=== stderr ===', r.stderr || '(空)', '',
|
|
243
|
+
].join('\n'));
|
|
244
|
+
const tail = `${r.stdout || ''}\n${r.stderr || ''}`.trimEnd().split(/\r?\n/).slice(-40).join('\n');
|
|
245
|
+
if (tail) console.error(`[verify] 🧾 门输出尾部 40 行(全文 ${path.relative(ROOT, p)}):\n${tail}`);
|
|
246
|
+
return p;
|
|
247
|
+
} catch { return null; }
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// --help 出口(2026-11-06):只出用法——不读 git、不裁变更面、不落凭证、不跑门
|
|
251
|
+
function usageText() {
|
|
252
|
+
return [
|
|
253
|
+
'用法:node .agents/scripts/verify.mjs [档位] [选项]',
|
|
254
|
+
'',
|
|
255
|
+
'档位(缺省 = diff 面增量;最近 24h 无全量绿行时自动回落 --full 并打印 ⏭️ 兜底行):',
|
|
256
|
+
' --full 全量门(关单凭证;引擎段 + 业务面 + 安全段)',
|
|
257
|
+
' --scope diff 面增量(基线 = 最近全量绿行 headShort,回退 origin/main merge-base)',
|
|
258
|
+
' --face <面> 显式面覆盖增量档(backend|frontend|docs,逗号多值;与 --full/--scope 互斥;跳过 24h 兜底)',
|
|
259
|
+
' --product 业务面(product + security)',
|
|
260
|
+
' --mid CI 中档(PR→develop / develop 直推):业务面 + 后端只跑单测',
|
|
261
|
+
' --engine 仅引擎段自检',
|
|
262
|
+
'',
|
|
263
|
+
'增量档(缺省 / --scope / --face)产品门单边化 CI(2026-11-08 档 1 减重;2026-11-11 增代码四门):',
|
|
264
|
+
' 产品 9 门(backend-build/backend-test/frontend-lint/frontend-unit-test/frontend-build + 代码四门',
|
|
265
|
+
' code-architecture/code-audit-fields/code-delete-guard/code-notify-guard)由 CI 执法,本地不跑;',
|
|
266
|
+
' secrets-scan + 引擎段 + wiki-consistency 照跑。',
|
|
267
|
+
'',
|
|
268
|
+
'选项:',
|
|
269
|
+
' --list 只列本轮门 id(配 --verbose 出「id<TAB>命令」),不执行门',
|
|
270
|
+
' --help, -h 本帮助,立即退出',
|
|
271
|
+
' --jobs N 并发档位(缺省 clamp(2..4, cpus/4));--serial 回退串行',
|
|
272
|
+
' --verbose --list 时附带每门命令',
|
|
273
|
+
' --test-cmd <cmd> 夹具:整表替换为单门(测试通道)',
|
|
274
|
+
' --stub-gate <cmd> 夹具:单门但走生产尾段(须配 CHECK_LOOP_ROOT)',
|
|
275
|
+
'',
|
|
276
|
+
'退出码:0 全绿 | 1 有门失败(fail-fast,未跑门标「已中止」)| 2 参数或配置失守',
|
|
277
|
+
].join('\n');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
async function run() {
|
|
281
|
+
const argv = process.argv.slice(2);
|
|
282
|
+
// 2026-11-06:此前 --help 是未知旗标——被静默忽略后照常解析档位并开跑全量门(敲 help 反付一次全量税)。
|
|
283
|
+
// 帮助必须是最便宜的路径:早于一切 git 解析与门表装配。
|
|
284
|
+
if (argv.includes('--help') || argv.includes('-h')) {
|
|
285
|
+
console.log(usageText());
|
|
286
|
+
process.exit(0);
|
|
287
|
+
}
|
|
288
|
+
// 未知旗标告警(同上一行的教训):静默忽略会把「参数拼错」伪装成「按缺省档跑」。只告警不阻断。
|
|
289
|
+
const VALUED_FLAGS = new Set(['--jobs', '--test-cmd', '--stub-gate', '--face']);
|
|
290
|
+
const KNOWN_FLAGS = new Set([
|
|
291
|
+
'--full', '--scope', '--face', '--product', '--mid', '--engine', '--list', '--verbose', '--serial', '--help', '-h',
|
|
292
|
+
...VALUED_FLAGS,
|
|
293
|
+
]);
|
|
294
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
295
|
+
if (VALUED_FLAGS.has(argv[i])) {
|
|
296
|
+
i += 1;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (argv[i].startsWith('-') && argv[i].length > 1 && !KNOWN_FLAGS.has(argv[i])) {
|
|
300
|
+
console.error(`[verify] ⚠️ 未知参数 ${argv[i]}(node .agents/scripts/verify.mjs --help 看用法)`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const ti = argv.indexOf('--test-cmd');
|
|
304
|
+
const testCmd = ti >= 0 ? argv[ti + 1] : null;
|
|
305
|
+
// --stub-gate(2026-10-15):单门夹具但走生产尾段(落凭证 / 门禁成本 / gen-verify-evidence)。
|
|
306
|
+
// 不打 testCmd 标记。必须配 CHECK_LOOP_ROOT,禁止在真实仓库写出可被当成关单凭证的绿行。
|
|
307
|
+
const si = argv.indexOf('--stub-gate');
|
|
308
|
+
const stubCmd = si >= 0 ? argv[si + 1] : null;
|
|
309
|
+
if (si >= 0 && !stubCmd) {
|
|
310
|
+
console.error('[verify] --stub-gate 需要一条命令');
|
|
311
|
+
process.exit(2);
|
|
312
|
+
}
|
|
313
|
+
if (stubCmd && testCmd) {
|
|
314
|
+
console.error('[verify] --stub-gate 与 --test-cmd 互斥');
|
|
315
|
+
process.exit(2);
|
|
316
|
+
}
|
|
317
|
+
if (stubCmd && !process.env.CHECK_LOOP_ROOT) {
|
|
318
|
+
console.error('[verify] --stub-gate 只允许配合 CHECK_LOOP_ROOT 夹具根(禁止在真实仓库落无关单凭证)');
|
|
319
|
+
process.exit(2);
|
|
320
|
+
}
|
|
321
|
+
// --face(2026-11-08 档 1-B):显式面覆盖——不做工作区脏路径自动面检测,直接按给定面裁门(增量档)。
|
|
322
|
+
// 合法值单源 = verify-scope 面枚举(PRODUCT_FACES 的 face 字段,docs = 显式「无产品面」);逗号多值。
|
|
323
|
+
const fi = argv.indexOf('--face');
|
|
324
|
+
const faceRaw = fi >= 0 ? argv[fi + 1] : null;
|
|
325
|
+
let faceArg = null;
|
|
326
|
+
if (fi >= 0) {
|
|
327
|
+
const faces = String(faceRaw || '').split(',').map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
328
|
+
const legal = PRODUCT_FACES.map((pf) => pf.face);
|
|
329
|
+
const illegal = faces.filter((f) => !legal.includes(f));
|
|
330
|
+
if (!faceRaw || !faces.length || illegal.length) {
|
|
331
|
+
console.error(`[verify] --face 需要面清单(合法值:${legal.join('|')};逗号多值)${illegal.length ? `;非法值:${illegal.join(',')}` : ''}`);
|
|
332
|
+
process.exit(2);
|
|
333
|
+
}
|
|
334
|
+
faceArg = faces;
|
|
335
|
+
}
|
|
336
|
+
// --scope(verify-diet 2026-10-21 ②;复核后基线升级):diff 面增量关单——变更面(基线..HEAD ∪
|
|
337
|
+
// 工作区 ∪ untracked;基线 = 最近全量绿行 headShort,回落在 origin/main merge-base)未触及的产品
|
|
338
|
+
// 重门与引擎自检门跳过(密钥扫描 + wiki 一致性 + 关单主干引擎门恒跑;引擎测试门已退役,
|
|
339
|
+
// .agents/ 不映射任何门——2026-10-28)。
|
|
340
|
+
// 纯文档/业务面分支把关单压到分钟级以下;面触及对应路径自动回列,基线/面解析失败 fail-loud 拒增量。
|
|
341
|
+
// 与 --test-cmd/--engine 互斥(夹具行不带生产标记、与引擎段增量门语义重叠);--stub-gate 下只记
|
|
342
|
+
// entry.scope 标记不裁门(stub 整表替换,测试通道用它做凭证渲染的集成断言)。
|
|
343
|
+
const engineOnly = argv.includes('--engine');
|
|
344
|
+
const productOnly = argv.includes('--product');
|
|
345
|
+
// --mid(2026-10-29 三档门禁):CI 中档 = PR→develop / develop 直推。业务面(product + security)
|
|
346
|
+
// 与 --product 同集合,唯 backend-test 换「只跑单测」(不碰集成测试库)——PR 阶段不依赖测试库
|
|
347
|
+
// 副本,DB 回归留给 develop→main 的重档(全量 20 门)。同 --product 不落 all-gates 凭证:
|
|
348
|
+
// 分档绿不是关单凭证(关单仍要本地全量)。
|
|
349
|
+
const midOnly = argv.includes('--mid');
|
|
350
|
+
const explicitScope = argv.includes('--scope');
|
|
351
|
+
const explicitFull = argv.includes('--full');
|
|
352
|
+
// 重档判定(2026-11-06 修复):显式 `--full` 或默认档回落全量(24h 无绿行 / diff 面解析失败)——
|
|
353
|
+
// 门禁链据此让 backend-test 跑含集成的全量;默认档/中档仍单测档(集成执法点 = pre-push --select-range + CI 重档)。
|
|
354
|
+
let fullTier = explicitFull;
|
|
355
|
+
const listOnly = argv.includes('--list');
|
|
356
|
+
if (explicitScope && explicitFull) {
|
|
357
|
+
console.error('[verify] --scope 与 --full 互斥');
|
|
358
|
+
process.exit(2);
|
|
359
|
+
}
|
|
360
|
+
if (explicitScope && (testCmd || engineOnly)) {
|
|
361
|
+
console.error('[verify] --scope 与 --test-cmd / --engine 互斥');
|
|
362
|
+
process.exit(2);
|
|
363
|
+
}
|
|
364
|
+
if (productOnly && (engineOnly || explicitScope)) {
|
|
365
|
+
console.error('[verify] --product 与 --engine / --scope 互斥(业务面全量分档,CI main 用)');
|
|
366
|
+
process.exit(2);
|
|
367
|
+
}
|
|
368
|
+
if (midOnly && (engineOnly || productOnly || explicitScope)) {
|
|
369
|
+
console.error('[verify] --mid 与 --engine / --product / --scope 互斥(业务面分档,CI 中档用)');
|
|
370
|
+
process.exit(2);
|
|
371
|
+
}
|
|
372
|
+
if (faceArg && explicitFull) {
|
|
373
|
+
console.error('[verify] --face 与 --full 互斥(显式面覆盖属增量档)');
|
|
374
|
+
process.exit(2);
|
|
375
|
+
}
|
|
376
|
+
if (faceArg && (explicitScope || engineOnly || productOnly || midOnly || testCmd || stubCmd)) {
|
|
377
|
+
console.error('[verify] --face 与 --scope / --engine / --product / --mid / 夹具旗标互斥(面来源与档位二选一)');
|
|
378
|
+
process.exit(2);
|
|
379
|
+
}
|
|
380
|
+
// 默认档(verify-scope-default 2026-10-22,owner 拍板):未显式 --full、且非夹具/非引擎段/非 --list →
|
|
381
|
+
// 默认走 diff 面增量,`--full` 才全量。实测依据:一日 23 次全量、墙钟中位 234s ≈ 90 分钟纯等待,而
|
|
382
|
+
// 绝大多数分支只动文档面;「默认便宜、全量显式」是把关单压到分钟级以下的唯一杠杆。
|
|
383
|
+
// --list 不参与:门表恒 20 是叙事锚与对外契约,裁剪只在执行期生效。
|
|
384
|
+
let scopeMode = explicitScope ? 'diff'
|
|
385
|
+
: faceArg ? 'face'
|
|
386
|
+
: (!explicitFull && !testCmd && !stubCmd && !engineOnly && !productOnly && !midOnly && !listOnly) ? 'diff' : null;
|
|
387
|
+
let scope = null;
|
|
388
|
+
let ledgerBase = null;
|
|
389
|
+
let baseSourceHint = 'ledger';
|
|
390
|
+
// 绿行锚点(verify-evidence-fallback 2026-10-22 立;2026-10-29 secrets-incr/unit-tier 常算并放宽):
|
|
391
|
+
// 本地台账最近一次绿行 ∪ 仓库级凭证 workflow/verify-evidence.md(入库追加保全,跨机/换 worktree 不失历史),
|
|
392
|
+
// 取「最新且为 HEAD 祖先」者(非祖先 = 别的分支/rebase 残留,拒用回落 origin/main)。
|
|
393
|
+
// **scope 行自 2026-10-29 起可作锚**(owner 拍板「关单只跑单测」):默认档 backend-test 恒为单测档、
|
|
394
|
+
// 集成测试移推送/CI——scope 绿行对面外重门的面裁担保仍是传递链,密钥门每行都执法(未装机时降级 lite,
|
|
395
|
+
// 仍执法;envSkips 行见落账段)。锚点三消费方:diff 面基线、24h 兜底、secrets-scan 增量基线。
|
|
396
|
+
const candidates = [];
|
|
397
|
+
try {
|
|
398
|
+
const vp = path.join(ROOT, '.agents', 'verifications.jsonl');
|
|
399
|
+
const rows = fs.existsSync(vp) ? fs.readFileSync(vp, 'utf8').trim().split(/\r?\n/).filter(Boolean) : [];
|
|
400
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
401
|
+
try {
|
|
402
|
+
const e = JSON.parse(rows[i]);
|
|
403
|
+
// fastTests 行(engine-tests 降 --fast、无 scope 标记的裁剪绿)禁作锚——
|
|
404
|
+
// 否则增量担保建立在漏跑慢套件的树上(2026-10-24 复核 P1-5)
|
|
405
|
+
// envSkips 行(2026-10-27 anchor-envskip):有门被 loud-skip 的「看似全量」行同样禁作锚——
|
|
406
|
+
// 该行实跑门数 < 门表(实测 12 条 gates=14/15 + envSkips=ledger-invariant),
|
|
407
|
+
// 一旦当锚,后续增量担保会建立在「没跑 ledger-invariant」的树上;
|
|
408
|
+
// 2026-10-29 起密钥门恒执法(gitleaks 缺装机则降级 lite),故 secrets 不再产生 envSkips;
|
|
409
|
+
if (e.exitCode === 0 && e.suite === 'all-gates' && e.headShort && !e.fastTests && !e.testCmd && !e.engineOnly
|
|
410
|
+
&& !(Array.isArray(e.envSkips) && e.envSkips.length)) {
|
|
411
|
+
candidates.push({ sha: e.headShort, ts: e.ts, source: 'ledger' });
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
} catch { /* 坏行跳过 */ }
|
|
415
|
+
}
|
|
416
|
+
} catch { /* 读不到台账 = 无本地候选 */ }
|
|
417
|
+
try {
|
|
418
|
+
const ep = path.join(ROOT, EVIDENCE_REL);
|
|
419
|
+
if (fs.existsSync(ep)) {
|
|
420
|
+
for (const row of parseEvidenceGreens(fs.readFileSync(ep, 'utf8'))) {
|
|
421
|
+
candidates.push({ sha: row.headShort, ts: row.ts, source: 'evidence' });
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
} catch { /* 读不到凭证 = 无仓库候选 */ }
|
|
425
|
+
const seen = new Set();
|
|
426
|
+
const ordered = candidates
|
|
427
|
+
.filter((c) => c.sha && Number.isFinite(Date.parse(c.ts)))
|
|
428
|
+
.sort((a, b) => Date.parse(b.ts) - Date.parse(a.ts))
|
|
429
|
+
.filter((c) => (seen.has(c.sha) ? false : (seen.add(c.sha), true)));
|
|
430
|
+
const isAncestor = (sha) => spawnSync('git', ['merge-base', '--is-ancestor', sha, 'HEAD'], { encoding: 'utf8', cwd: ROOT }).status === 0;
|
|
431
|
+
const chosen = ordered.find((c) => isAncestor(c.sha)) || null;
|
|
432
|
+
const lastFullTs = chosen ? chosen.ts : null;
|
|
433
|
+
if (chosen) { ledgerBase = chosen.sha; baseSourceHint = chosen.source; }
|
|
434
|
+
if (scopeMode) {
|
|
435
|
+
// 24h 绿行兜底:**只约束默认档**(显式 --scope / --face = 操作者已判读面,且夹具端到端用例依赖无历史绿行算面)。
|
|
436
|
+
// 判据 = 最近绿行(scope 计入,2026-10-29 单测档口径)age < 24h;过期或不存在 → 本次退回全量。
|
|
437
|
+
// 刻意**不认失败行**:红树上的增量绿会伪造安全感,「跑过」不等于「跑绿」。代价是树长期红时默认档
|
|
438
|
+
// 恒失效——这是有意的取舍:门禁全红时该修树,不该降档。
|
|
439
|
+
if (!explicitScope && !faceArg) {
|
|
440
|
+
const age = lastFullTs ? Date.now() - Date.parse(lastFullTs) : null;
|
|
441
|
+
const freshFull = age !== null && Number.isFinite(age) && age >= 0 && age < 24 * 3600 * 1000;
|
|
442
|
+
if (!freshFull) {
|
|
443
|
+
const why = lastFullTs ? `最近绿行 ${lastFullTs.slice(0, 16)}(已 ${(age / 3600000).toFixed(1)}h)` : '本地台账与仓库凭证均无绿行';
|
|
444
|
+
console.log(`[verify] ⏭️ 24h 内无绿行(${why})→ 本次全量执法(兜底)\n`);
|
|
445
|
+
scopeMode = null; fullTier = true;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
if (scopeMode === 'face') {
|
|
450
|
+
// --face 显式面(档 1-B):不读 git 变更面,直接按给定面组装配裁。ledgerTouched 恒 false——
|
|
451
|
+
// ledger-invariant 照 CI-only 口径本地 loud-skip(绿行 envSkips 留痕,故 face 绿行不作增量锚,
|
|
452
|
+
// 24h 兜底锚链语义不变)。
|
|
453
|
+
const touched = new Set(faceArg);
|
|
454
|
+
scope = {
|
|
455
|
+
baseShort: ledgerBase || 'none',
|
|
456
|
+
baseSource: 'manual',
|
|
457
|
+
fileCount: 0,
|
|
458
|
+
touched,
|
|
459
|
+
skippedGateIds: PRODUCT_FACES.filter((pf) => !touched.has(pf.face)).flatMap((pf) => pf.gates),
|
|
460
|
+
matched: [],
|
|
461
|
+
files: [],
|
|
462
|
+
ledgerTouched: false,
|
|
463
|
+
};
|
|
464
|
+
} else if (scopeMode) {
|
|
465
|
+
const git = (args) => spawnSync('git', args, { encoding: 'utf8', cwd: ROOT });
|
|
466
|
+
try {
|
|
467
|
+
scope = computeDiffScope(git, ledgerBase, baseSourceHint);
|
|
468
|
+
} catch (e) {
|
|
469
|
+
// 显式 --scope 保持 fail-loud(拒增量);默认档退回全量——默认档不该因基线缺失整体失败。
|
|
470
|
+
if (explicitScope) {
|
|
471
|
+
console.error(`[verify] --scope: ${e.message}`);
|
|
472
|
+
process.exit(2);
|
|
473
|
+
}
|
|
474
|
+
console.log(`[verify] ⏭️ diff 面解析失败(${e.message})→ 本次全量执法(兜底)\n`);
|
|
475
|
+
scopeMode = null; fullTier = true;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
// engine-tests 门已随引擎测试面退役删除(2026-10-28,owner 决策:不再跑引擎面全量测试);
|
|
479
|
+
// fastTests 字段保留为历史凭证兼容(恒 false)。
|
|
480
|
+
let fastEngineTests = false;
|
|
481
|
+
// 增量档实际裁剪 = 面裁(skipSet 源)∪ 产品门单边化 CI(档 1-B 产品 5 门;2026-11-11 增代码四门,增量档恒裁,执法点在 CI)。
|
|
482
|
+
let effSkipped = [];
|
|
483
|
+
if (scopeMode && scope && !stubCmd) {
|
|
484
|
+
effSkipped = [...new Set([...scope.skippedGateIds, ...CI_UNILATERAL_GATE_IDS])];
|
|
485
|
+
if (scopeMode === 'face') {
|
|
486
|
+
console.log(`[verify] 🔀 face=${faceRaw}(显式指定,跳过变更面自动检测):裁 ${effSkipped.length} 门(${effSkipped.join('、') || '无'})\n`);
|
|
487
|
+
} else {
|
|
488
|
+
const faceNote = ['backend', 'frontend'].map((f) => `${f}:${scope.touched.has(f) ? '触' : '未触'}`).join(' ');
|
|
489
|
+
const skipNote = `跳过 ${effSkipped.length} 门(${effSkipped.join('、')})`;
|
|
490
|
+
const baseWhy = scope.baseSource === 'ledger' ? '上次绿行'
|
|
491
|
+
: scope.baseSource === 'evidence' ? '仓库凭证' : 'origin/main';
|
|
492
|
+
console.log(`[verify] 🔀 scope=diff:基线 ${scope.baseShort}(${baseWhy})|变更面 ${scope.fileCount} 文件(${faceNote})——${skipNote}\n`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
// --engine(2026-10-11 C7 方案②):只跑 cohort=engine 的引擎段门——原设计供 develop 增量 CI
|
|
496
|
+
// (该 CI 步已随 2026-10-21 死步清理删除;--engine 保留本地/手动用法)。与全量的关键差异:
|
|
497
|
+
// 全绿**不落 all-gates 绿行、不生成摘要**——增量段绿不是 20 门全量关单凭证,落了会被 hasFreshVerifyLine
|
|
498
|
+
// 与 gen-verify-evidence 误认成全量绿(伪凭证);失败行照记(suite=门 id,诊断用)。
|
|
499
|
+
const skipSet = scope ? new Set(scope.skippedGateIds) : new Set();
|
|
500
|
+
// CI-only 门(verify-diet 二批 2026-10-21 P0-2;2026-10-24 复核 P1 收紧):ledger-invariant 全史扫描
|
|
501
|
+
// 在 TF_BUILD 外默认 loud-skip,但 diff 面触及台账/修剪 manifest 时回列(verify-scope.ledgerTouched)
|
|
502
|
+
// ——台账变更才付 ~90s,未触及仍跳过;全量档(无 scope)与 CI 照跑。绿行 envSkips 记录跳过事实。
|
|
503
|
+
const CI_ONLY_GATE_IDS = new Set(['ledger-invariant']);
|
|
504
|
+
const localLedgerSkip = !testCmd && !stubCmd && !process.env.TF_BUILD
|
|
505
|
+
&& !!scope && !scope.ledgerTouched;
|
|
506
|
+
const envSkipIds = localLedgerSkip ? CI_ONLY_GATE_IDS : new Set();
|
|
507
|
+
const gates = testCmd ? fixtureGates(testCmd)
|
|
508
|
+
: stubCmd ? [{ id: 'stub', cohort: 'engine', name: '夹具单门', cmd: stubCmd, folder: '.', type: 'shell' }]
|
|
509
|
+
: engineOnly ? GATES.filter((g) => g.cohort === 'engine')
|
|
510
|
+
: productOnly ? GATES.filter((g) => g.cohort !== 'engine') // 业务面:product + security(CI main)
|
|
511
|
+
// 中档(--mid):业务面同 --product,唯一差异 = backend-test 只跑单元测试(不碰集成测试库)。
|
|
512
|
+
// 门 id/名称不变,deps 边(backend-test ← backend-build)照旧成立。
|
|
513
|
+
: midOnly ? GATES.filter((g) => g.cohort !== 'engine')
|
|
514
|
+
.map((g) => (g.id === 'backend-test'
|
|
515
|
+
? { ...g, cmd: `${g.cmd} --unit-only`, name: '后端单元测试(不含集成测试)' }
|
|
516
|
+
: g))
|
|
517
|
+
// 重档(--full / 默认档回落,2026-11-06 修复):全量 20 门,backend-test 不附 --unit-only(含集成)——
|
|
518
|
+
// 直推 main 与 PR→main 的 CI 重档执法面(CI 已备 TEST_DB_ALLOW_DEV=1 逃生,见 azure-pipelines.yml);
|
|
519
|
+
// 本地默认档/中档仍单测档(集成在 pre-push --select-range / CI 重档)。
|
|
520
|
+
// !scopeMode 兜住裸 --list:门表叙事锚恒 20(裁剪只在增量档执行期与 --list --scope/--face 生效)。
|
|
521
|
+
: fullTier || !scopeMode ? GATES
|
|
522
|
+
// 增量档(缺省 / --scope / --face;2026-11-08 档 1-B 产品门单边化 CI):
|
|
523
|
+
// ① 产品 cohort 5 门(backend-build / backend-test / frontend-lint / frontend-unit-test / frontend-build)
|
|
524
|
+
// +代码四门(code-architecture / code-audit-fields / code-delete-guard / code-notify-guard,2026-11-11)
|
|
525
|
+
// 恒不执行——执法点单边移交 CI(--full/--mid/--product 与 azure-pipelines 一字不变);门清单上方
|
|
526
|
+
// 打印跳过说明行(UNILATERAL_NOTE)。面裁(skipSet)保留:给定/计算面仍决定 entry.scope 审计事实。
|
|
527
|
+
// ② secrets-scan 降范围增量——锚点 = 上方绿行锚(祖先校验过),每轮只扫 锚..HEAD 新提交
|
|
528
|
+
// (实测全史 15s → 0.8s);无锚点(首跑/树红后)自动全量,全史兜底留 --full 与 CI main 重档。
|
|
529
|
+
// ③ 引擎段 + wiki-consistency 恒跑(关单主干;单测档 --unit-only 随 backend-test 单边化一并退役)。
|
|
530
|
+
: GATES.filter((g) => !skipSet.has(g.id) && !CI_UNILATERAL_GATE_IDS.has(g.id))
|
|
531
|
+
.map((g) => {
|
|
532
|
+
if (g.id === 'secrets-scan' && ledgerBase) {
|
|
533
|
+
return { ...g, env: { SECRETS_SCAN_BASE: ledgerBase }, name: '密钥扫描(gitleaks 增量+基线)' };
|
|
534
|
+
}
|
|
535
|
+
return g;
|
|
536
|
+
});
|
|
537
|
+
// deps 完整性断言(复核 P2):依赖门被裁剪/表形态破坏时,worker 会把依赖孤儿静默 continue——
|
|
538
|
+
// 门从绿跑里无声消失、绿凭证残缺。此处 fail-loud,不带病跑(--no-build 放大此陷阱的后果)。
|
|
539
|
+
{
|
|
540
|
+
const gateIds = new Set(gates.map((g) => g.id));
|
|
541
|
+
for (const g of gates) {
|
|
542
|
+
for (const d of g.deps || []) {
|
|
543
|
+
if (!gateIds.has(d)) {
|
|
544
|
+
console.error(`[verify] 门 ${g.id} 依赖 ${d} 不在本轮门清单——裁剪/表形态错误,拒绝运行`);
|
|
545
|
+
process.exit(2);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
if (argv.includes('--list')) {
|
|
552
|
+
if (testCmd) {
|
|
553
|
+
console.error('[verify] --list 与 --test-cmd 互斥');
|
|
554
|
+
process.exit(1);
|
|
555
|
+
}
|
|
556
|
+
// 干跑展示裁剪(档 1-B):跳过说明走 stderr——stdout 保持纯 id,管道消费方不受影响。
|
|
557
|
+
if (scopeMode) console.error(`[verify] ⏭️ ${UNILATERAL_NOTE}`);
|
|
558
|
+
const verbose = argv.includes('--verbose');
|
|
559
|
+
for (const g of gates) console.log(verbose ? `${g.id}\t${g.cmd}` : g.id);
|
|
560
|
+
process.exit(0);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// 并发档位(2026-10-16 并行编排):门之间无共享状态(各自独立进程 + 独立工作目录),串行编排下
|
|
564
|
+
// 总耗时 = 各门之和(本机实测(15 门时)~300s:engine-tests 118s / backend-test 63s / ledger-invariant 55s…)。
|
|
565
|
+
// 工作池并发后墙钟 ≈ max(最长门, 各门之和 / 并发)——门自身已内部并行(npm test 套件池 6、dotnet 多核、
|
|
566
|
+
// check-loop.test 分片 6),并发档位越高越互相抢核,最长门(engine-tests)反而变慢。本机 12 逻辑核
|
|
567
|
+
// 实测(×2 取均值,全绿):j2 177.8s / **j3 122.3s** / j4 129.3s / j6 136.6s——膝点在 3。
|
|
568
|
+
// 缺省 = clamp(2..4, floor(cpus/4))(12 核 → 3);--serial 回退串行(排障/对比);--jobs N 显式钉档。
|
|
569
|
+
const serial = argv.includes('--serial');
|
|
570
|
+
const jobsRaw = argv.includes('--jobs') ? Number(argv[argv.indexOf('--jobs') + 1]) : null;
|
|
571
|
+
if (jobsRaw !== null && (!Number.isInteger(jobsRaw) || jobsRaw < 1)) {
|
|
572
|
+
console.error(`[verify] --jobs 须为正整数(现 ${argv[argv.indexOf('--jobs') + 1]})`);
|
|
573
|
+
process.exit(2);
|
|
574
|
+
}
|
|
575
|
+
const JOBS = serial ? 1 : Math.min(jobsRaw ?? Math.max(2, Math.min(4, Math.floor(os.cpus().length / 4))), gates.length);
|
|
576
|
+
// 单门输出上限(与旧 spawnSync maxBuffer 同口径):超限即树杀判红,不静默截断
|
|
577
|
+
const MAX_GATE_OUTPUT = 32 * 1024 * 1024;
|
|
578
|
+
// 树杀(fail-fast 中止在跑门):Windows 下 shell:true 起的是 cmd.exe,kill 只杀壳不杀孙进程
|
|
579
|
+
// (npm→node、dotnet→vstest 会成孤儿并占住 bin 锁)——故走 taskkill /T /F 整树。
|
|
580
|
+
const killTree = (child) => {
|
|
581
|
+
try {
|
|
582
|
+
if (process.platform === 'win32' && child.pid) {
|
|
583
|
+
spawnSync('taskkill', ['/pid', String(child.pid), '/T', '/F'], { stdio: 'ignore' });
|
|
584
|
+
} else {
|
|
585
|
+
child.kill('SIGTERM');
|
|
586
|
+
}
|
|
587
|
+
} catch { /* best-effort:杀不动不改变裁决 */ }
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
if (scopeMode) console.log(`[verify] ⏭️ ${UNILATERAL_NOTE}\n`);
|
|
591
|
+
console.log(`[verify] 🚀 开始全量静态门验证 (共 ${gates.length} 项,并发 ${JOBS}${serial ? '·串行' : ''})${testCmd ? '【fixture 模式】' : ''}${stubCmd ? '【stub 尾段】' : ''}${engineOnly ? '【引擎段增量门】' : ''}${productOnly ? '【业务面分档】' : ''}${midOnly ? '【中档:业务面+单测】' : ''}\n`);
|
|
592
|
+
if (!testCmd && !stubCmd && process.env.RUN_E2E !== '1') {
|
|
593
|
+
console.log('[verify] ⏭️ E2E 冒烟门未启用(RUN_E2E≠1)——前置为全栈在线(前端 5203 + API 8932 + SMOKE_ADMIN/SMOKE_ADMIN_PASSWORD);启用方式:RUN_E2E=1 node .agents/scripts/verify.mjs\n');
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
let passedCount = 0;
|
|
597
|
+
const outputs = {};
|
|
598
|
+
// 逐门耗时埋点(2026-10-14 G8 门禁计时):durations 随 all-gates 绿行入 verifications.jsonl,
|
|
599
|
+
// metrics.md「门禁成本/迭代」表消费——G10(影响面裁剪)的判据数据源。
|
|
600
|
+
const durations = {};
|
|
601
|
+
let cohortSeen = '';
|
|
602
|
+
const cohortLabel = { engine: '引擎段', security: '安全段', product: '产品段' };
|
|
603
|
+
const doneIdx = new Set(); // 已出裁决的门序(成功/失败/中止;未列入者 = fail-fast 后状态未知)
|
|
604
|
+
const aborted = new Set(); // 因他门失败被树杀中止的门序
|
|
605
|
+
const running = new Map(); // 门序 -> child(树杀目标)
|
|
606
|
+
let failedIdx = -1;
|
|
607
|
+
|
|
608
|
+
const startGate = (i) => {
|
|
609
|
+
const gate = gates[i];
|
|
610
|
+
// CI-only 门本地 loud-skip:合成「通过」裁决(不 spawn、不计耗时、不进 passedCount)——
|
|
611
|
+
// 跳过在 finishGate 以 ⏭️ 行显式可见(与 E2E loud-skip 对称:没跑 ≠ 过了,台账可区分)。
|
|
612
|
+
if (envSkipIds.has(gate.id)) {
|
|
613
|
+
return Promise.resolve({ status: 0, skip: true, stdout: '', stderr: '', durMs: 0 });
|
|
614
|
+
}
|
|
615
|
+
if (gate.cohort && gate.cohort !== cohortSeen) {
|
|
616
|
+
cohortSeen = gate.cohort;
|
|
617
|
+
const n = gates.filter((g) => g.cohort === cohortSeen).length;
|
|
618
|
+
console.log(`[verify] —— ${cohortLabel[cohortSeen] || cohortSeen}(${n})——`);
|
|
619
|
+
}
|
|
620
|
+
console.log(`[verify] ▶ ${i + 1}/${gates.length} ${gate.name}...`);
|
|
621
|
+
const t0 = performance.now();
|
|
622
|
+
const child = spawn(gate.cmd, { shell: true, cwd: path.join(ROOT, gate.folder), env: gate.env ? { ...process.env, ...gate.env } : process.env });
|
|
623
|
+
running.set(i, child);
|
|
624
|
+
const buf = { stdout: '', stderr: '', overflow: false };
|
|
625
|
+
const pump = (src, key) => {
|
|
626
|
+
src.setEncoding('utf8');
|
|
627
|
+
src.on('data', (d) => {
|
|
628
|
+
if (buf.overflow) return;
|
|
629
|
+
buf[key] += d;
|
|
630
|
+
// 与旧 spawnSync maxBuffer 同口径:超限即中止判红(不静默截断——截断后的输出不可当证据)
|
|
631
|
+
if (buf[key].length > MAX_GATE_OUTPUT) { buf.overflow = true; killTree(child); }
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
pump(child.stdout, 'stdout');
|
|
635
|
+
pump(child.stderr, 'stderr');
|
|
636
|
+
return new Promise((resolve) => {
|
|
637
|
+
let settled = false;
|
|
638
|
+
const settle = (status, error) => {
|
|
639
|
+
if (settled) return;
|
|
640
|
+
settled = true;
|
|
641
|
+
running.delete(i);
|
|
642
|
+
resolve({ status, error, ...buf, durMs: Math.round(performance.now() - t0) });
|
|
643
|
+
};
|
|
644
|
+
child.on('error', (e) => settle(null, e));
|
|
645
|
+
child.on('close', (status) => settle(status, null));
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
// 出裁决:先回放该门缓冲输出(并发下输出按门整块回放,逐门可读,与 run-tests 同口径),再打结论行。
|
|
650
|
+
// 返回 true = 该门红(调用方据此 fail-fast)。
|
|
651
|
+
const finishGate = (i, r) => {
|
|
652
|
+
const gate = gates[i];
|
|
653
|
+
doneIdx.add(i);
|
|
654
|
+
if (r.skip) {
|
|
655
|
+
console.log(`[verify] ⏭️ ${i + 1}/${gates.length} ${gate.name}:CI-only(TF_BUILD 外跳过——提交时刻 --staged 增量门已执法,全史扫描 CI 兜底)\n`);
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
durations[gate.id] = r.durMs;
|
|
659
|
+
if (r.stdout) process.stdout.write(r.stdout);
|
|
660
|
+
if (r.stderr) process.stderr.write(r.stderr);
|
|
661
|
+
if (aborted.has(i)) {
|
|
662
|
+
console.error(`[verify] ⏹ ${i + 1}/${gates.length} ${gate.name} 已中止(他门失败触发 fail-fast,状态未知)`);
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
if (r.overflow) {
|
|
666
|
+
console.error(`[verify] ❌ ${i + 1}/${gates.length} ${gate.name} 未通过(输出超 ${MAX_GATE_OUTPUT / 1024 / 1024}MB 上限,已中止)`);
|
|
667
|
+
persistGateLog(gate, r);
|
|
668
|
+
// 归因恒带(2026-11-10):溢出前已捕获的输出仍可供 failure-attribution 启发式签名匹配,
|
|
669
|
+
// 无签名则落保守默认 real(同 classifyFailure「否则 real」口径)——失败行不留无归因空洞。
|
|
670
|
+
recordFailure(gate.id, -1, 'output-overflow', classifyFailure(`${r.stdout || ''}\n${r.stderr || ''}`));
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
if (r.status !== 0) {
|
|
674
|
+
const logPath = persistGateLog(gate, r);
|
|
675
|
+
const note = `exit ${r.status ?? r.error?.code}${logPath ? `·log ${path.relative(ROOT, logPath)}` : ''}`;
|
|
676
|
+
// 归因(gate-health 2026-10-22):env / flaky / real——只标注不改裁决;假红可当场定性。
|
|
677
|
+
const attribution = classifyFailure(`${r.stdout || ''}\n${r.stderr || ''}`);
|
|
678
|
+
console.error(`[verify] ❌ ${i + 1}/${gates.length} ${gate.name} 未通过 (${note})|归因 ${attribution}`);
|
|
679
|
+
recordFailure(gate.id, r.status, note, attribution);
|
|
680
|
+
return true;
|
|
681
|
+
}
|
|
682
|
+
// stdout+stderr 都留档(2026-10-29 secrets-incr):loud-skip 类声明多走 stderr(check-secrets 用
|
|
683
|
+
// console.error),只存 stdout 会让落账段的 envSkips 动态探测落空——锚点空洞堵不住。
|
|
684
|
+
outputs[gate.id] = `${r.stdout || ''}\n${r.stderr || ''}`;
|
|
685
|
+
console.log(`[verify] ✅ ${i + 1}/${gates.length} ${gate.name} 通过 [${r.durMs} ms]\n`);
|
|
686
|
+
passedCount++;
|
|
687
|
+
return false;
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
const wallStart = performance.now();
|
|
691
|
+
|
|
692
|
+
// flaky 隔离重跑已退役(2026-11-08 减重档 3-U1:近 30 天零触发)——门结果即首跑结果;
|
|
693
|
+
// 首跑红按归因标注(上方 startGate),处置一律人工立项(commands/stages.md),不再自动重跑。
|
|
694
|
+
const runGate = startGate;
|
|
695
|
+
|
|
696
|
+
// 依赖边(deps):本门须待所列门**成功**后才启动——backend-test 走 --no-build 直接消费 backend-build
|
|
697
|
+
// 产物(verify-diet ③,双构建已消);deps 兼任门序:构建红 → 测试不启动。串行后 19s+81s 仍在
|
|
698
|
+
// engine-tests 的影子里,不增墙钟。依赖门红/未跑 → 本门不启动(状态未知,由尾段清单兜底)。
|
|
699
|
+
const idxOf = new Map(gates.map((g, i) => [g.id, i]));
|
|
700
|
+
const gatePromise = new Map(); // 门序 -> 该门结果 Promise(依赖方 await 用)
|
|
701
|
+
|
|
702
|
+
// 守卫段(guardian):串行先跑、未过即止——后序门一并不启动
|
|
703
|
+
for (let i = 0; i < gates.length && failedIdx < 0; i++) {
|
|
704
|
+
if (!gates[i].guardian) continue;
|
|
705
|
+
const p = runGate(i);
|
|
706
|
+
gatePromise.set(i, p);
|
|
707
|
+
if (finishGate(i, await p) && failedIdx < 0) failedIdx = i;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (failedIdx < 0) {
|
|
711
|
+
// 主体段:工作池并发(完成一个补一个);任一门红 → 停排新门 + 树杀在跑门(fail-fast 语义保留)
|
|
712
|
+
const bodyIdx = gates.map((_, i) => i).filter((i) => !gates[i].guardian);
|
|
713
|
+
let cursor = 0;
|
|
714
|
+
const worker = async () => {
|
|
715
|
+
while (failedIdx < 0 && cursor < bodyIdx.length) {
|
|
716
|
+
const i = bodyIdx[cursor++];
|
|
717
|
+
const deps = gates[i].deps || [];
|
|
718
|
+
if (deps.length) {
|
|
719
|
+
const depResults = await Promise.all(deps.map((d) => gatePromise.get(idxOf.get(d)) ?? Promise.resolve(null)));
|
|
720
|
+
if (failedIdx >= 0) return;
|
|
721
|
+
if (depResults.some((r) => !r || r.status !== 0)) continue; // 依赖未过 → 本门不启动
|
|
722
|
+
}
|
|
723
|
+
const p = runGate(i);
|
|
724
|
+
gatePromise.set(i, p);
|
|
725
|
+
if (finishGate(i, await p) && failedIdx < 0) {
|
|
726
|
+
failedIdx = i;
|
|
727
|
+
for (const [j, child] of [...running]) { aborted.add(j); killTree(child); }
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
await Promise.all(Array.from({ length: Math.min(JOBS, bodyIdx.length) }, worker));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
if (failedIdx >= 0) {
|
|
735
|
+
// 未执行门清单(2026-10-11 D2;2026-10-16 并发编排后按「已出裁决」算):fail-fast 后状态未知≠通过——
|
|
736
|
+
// 验证系统输出须完备,与 E2E loud-skip 对称(否则「没跑」在台账里与「过了」不可区分)。
|
|
737
|
+
const remaining = gates.map((g, i) => i).filter((i) => !doneIdx.has(i)).map((i) => gates[i].id);
|
|
738
|
+
if (remaining.length) console.error(`[verify] ⏭️ 未执行门(fail-fast,状态未知):${remaining.join('、')}`);
|
|
739
|
+
process.exit(1);
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// ---- 全绿尾段(任一门红已在上方 exit 1 返回,能走到这里即全绿)----
|
|
743
|
+
// 引擎段增量门不落 all-gates 凭证(增量段绿 ≠ 20 门全量关单凭证)——台账/摘要双跳过;
|
|
744
|
+
// fixture 绿行照落(带 testCmd:true 标记,hasFreshVerifyLine 不认——测试面沿既有契约)
|
|
745
|
+
if (!engineOnly && !productOnly && !midOnly) {
|
|
746
|
+
let entry = null;
|
|
747
|
+
try {
|
|
748
|
+
entry = { ts: new Date().toISOString(), exitCode: 0, suite: 'all-gates', gates: passedCount };
|
|
749
|
+
// 档位标记(2026-11-06 P0-1 续测):显式 `--full` / 默认 diff / 默认回落全量 / 夹具——
|
|
750
|
+
// 使「关单是否按默认档走」可直接对质(此前只能靠 unitOnly 有无间接推断,且与「未裁门」不可分)。
|
|
751
|
+
entry.mode = testCmd ? 'fixture' : (explicitFull ? 'full' : (scopeMode === 'face' ? 'face' : (scopeMode ? 'diff' : 'fallback')));
|
|
752
|
+
// --face 落账(档 1-B):绿行原样记录给定面清单,审计可对质「该凭证按哪个面裁的门」。
|
|
753
|
+
if (scopeMode === 'face') entry.face = faceRaw;
|
|
754
|
+
// HEAD 短 SHA 钉进绿行本体(2026-10-09 AI-Native 架构审查修复收尾):确定性证据此前只存在于测试
|
|
755
|
+
// 夹具、绿行无 SHA 可锚定验证对象;非 git 环境(fixture 根在 os.tmpdir)解析失败则省略该键,不伪造。
|
|
756
|
+
const rev = spawnSync('git', ['rev-parse', '--short', 'HEAD'], { encoding: 'utf8', cwd: ROOT });
|
|
757
|
+
if (rev.status === 0 && rev.stdout) entry.headShort = rev.stdout.trim();
|
|
758
|
+
// 业务脏路径快照(closeout-skill-hardening 2026-11-08):confirm-doc 关单时比对当前
|
|
759
|
+
// backend/ frontend/ 脏路径——绿行之后新出现的业务改动使凭证过期(HEAD 判不出未提交改动)。
|
|
760
|
+
// 只记路径列表(不记内容、不记哈希):重跑 verify 即刷新;非 git 环境省略该键,
|
|
761
|
+
// confirm-doc 对存量/缺字段绿行维持 fail-open(与 v1–v7 advisory 同口径)。
|
|
762
|
+
const st = spawnSync('git', ['status', '--porcelain'], { encoding: 'utf8', cwd: ROOT });
|
|
763
|
+
if (st.status === 0 && st.stdout) {
|
|
764
|
+
entry.dirty = st.stdout.split(/\r?\n/)
|
|
765
|
+
.map((l) => l.slice(3).split(' -> ').pop().trim().replace(/^"|"$/g, '').replace(/\\/g, '/'))
|
|
766
|
+
.filter((p) => /^(backend|frontend)\//.test(p)).sort();
|
|
767
|
+
}
|
|
768
|
+
const counts = parseCounts(outputs['test'] || '');
|
|
769
|
+
if (counts) Object.assign(entry, counts);
|
|
770
|
+
// 门禁成本入账(G8):逐门毫秒 + 总耗时,metrics 消费。
|
|
771
|
+
// totalMs = 各门之和(并发后已非墙钟,保留以续接历史口径);wallMs = 本次实际墙钟(2026-10-16
|
|
772
|
+
// 并行编排引入)——「一次迭代的等待成本」是墙钟,metrics 表以 wallMs 优先。
|
|
773
|
+
entry.totalMs = Object.values(durations).reduce((a, b) => a + b, 0);
|
|
774
|
+
entry.wallMs = Math.round(performance.now() - wallStart);
|
|
775
|
+
entry.durations = durations;
|
|
776
|
+
if (testCmd) entry.testCmd = true;
|
|
777
|
+
// CI-only 本地跳过(verify-diet 二批 P0-2):绿行记录跳过事实——审计面可对质「该行没跑哪些门、为何」。
|
|
778
|
+
// secrets 执法者(2026-10-29 lite-fallback):gitleaks 缺装机时门自动降级为纯 Node 兜底扫描(仍执法),
|
|
779
|
+
// 不再是跳过——故不再落 envSkips(可作增量锚),改记 entry.secretsEnforcer='lite' 供审计对质;
|
|
780
|
+
// 仅当输出里真的出现 loud-skip(旧脚本/人工包装)时才落 envSkips。
|
|
781
|
+
const secretsOut = outputs['secrets-scan'] || '';
|
|
782
|
+
const secretsLoudSkip = !envSkipIds.has('secrets-scan') && secretsOut.includes('loud-skip');
|
|
783
|
+
if (envSkipIds.size || secretsLoudSkip) entry.envSkips = [...envSkipIds, ...(secretsLoudSkip ? ['secrets-scan'] : [])];
|
|
784
|
+
if (!secretsLoudSkip && secretsOut.includes('执法者=lite')) entry.secretsEnforcer = 'lite';
|
|
785
|
+
// scope 增量凭证标记(verify-diet ②):gen-verify-evidence 渲染进摘要行,审计面可对质
|
|
786
|
+
// 「该绿行跑了哪些门、基于哪个基线」;hasFreshVerifyLine 认其为合法关单凭证(口径见 verify-scope.mjs)。
|
|
787
|
+
// **只在真裁掉门时打标记**(verify-scope-default 2026-10-22 修复):变截面全触及 → 门表照跑全量,
|
|
788
|
+
// 该行实质是全量绿。2026-10-29 锚语义放宽(backend-unit-tier):带 scope 标记的行**本地台账侧**
|
|
789
|
+
// 亦可作锚(单测档口径下面裁担保仍是传递链);evidence 文件侧锚候选仍只认无标记行(parseEvidenceGreens)。
|
|
790
|
+
if (scopeMode && scope && effSkipped.length) entry.scope = { mode: scopeMode, base: scope.baseShort, baseSource: scope.baseSource, skipped: effSkipped, fileCount: scope.fileCount };
|
|
791
|
+
// 分层跑标记(2026-10-23):diff 档 engine-tests 用 --fast——绿行记录,审计可对质。
|
|
792
|
+
if (fastEngineTests) entry.fastTests = true;
|
|
793
|
+
// 单测档标记(unitOnly,2026-10-29 backend-unit-tier)随档 1-B 退役:增量档 backend-test 已整体
|
|
794
|
+
// 单边化 CI(本地不再有「只跑单测」的后端门),该字段若继续落账反而失真;无消费方读它
|
|
795
|
+
// (policy.mjs hasFreshVerifyLine / gen-verify-evidence 均不消费),集成执法点照旧在 pre-push 与 CI 重档。
|
|
796
|
+
if (process.env.PIPELINE_RUN_ID) entry.runId = process.env.PIPELINE_RUN_ID;
|
|
797
|
+
fs.mkdirSync(path.join(ROOT, '.agents'), { recursive: true });
|
|
798
|
+
fs.appendFileSync(path.join(ROOT, '.agents', 'verifications.jsonl'), `${JSON.stringify(entry)}\n`);
|
|
799
|
+
console.log(`[verify] 🧾 全绿凭证已落账 verifications.jsonl`);
|
|
800
|
+
} catch (e) {
|
|
801
|
+
console.error(`[verify] ⚠️ 凭证落账失败: ${e.message}`);
|
|
802
|
+
}
|
|
803
|
+
// 摘要事件原子化(2026-10-11 C4):全绿事实与仓内摘要(workflow/verify-evidence.md——检查 23 收敛
|
|
804
|
+
// 硬门自 convergenceHardSince 2026-10-12 起的读源)同刻生成,消除「本地台账已绿、committed 摘要滞后」
|
|
805
|
+
// 的双真相分叉。仅生产全量模式(fixture 假门 / 引擎段增量门均不得产凭证);生成失败响亮告警但不
|
|
806
|
+
// 推翻绿裁决(同落账口径)。
|
|
807
|
+
if (!testCmd) {
|
|
808
|
+
const top3 = Object.entries(durations).sort((a, b) => b[1] - a[1]).slice(0, 3)
|
|
809
|
+
.map(([id, ms]) => `${id}(${(ms / 1000).toFixed(1)}s)`).join(' ');
|
|
810
|
+
const wallMs = entry ? entry.wallMs : Math.round(performance.now() - wallStart);
|
|
811
|
+
const totalMs = entry ? entry.totalMs : Object.values(durations).reduce((a, b) => a + b, 0);
|
|
812
|
+
// 成本预算(gate-budget 2026-10-22):advisory——超限只告警不阻断;把「体感重」变成可对质的数字。
|
|
813
|
+
// 预算档按「**实际裁掉了几门**」选,不按 --scope 开关选(2026-10-27 修正):变截面全触及 /
|
|
814
|
+
// 只触及非前端面时,--scope 仍会跑重活门(现役 backend-test;engine-tests 已随引擎测试面退役),
|
|
815
|
+
// 实质是全量成本——此时拿增量档 scopeMs(120s) 去比会产出假超限告警(实测 129.5s 报「超 7.9%」,
|
|
816
|
+
// 而全量档 240s 本就富余)。与绿行 scope 标记同口径:零裁剪即零标记。
|
|
817
|
+
const skippedGateIds = effSkipped;
|
|
818
|
+
const budget = readGateBudget(ROOT, skippedGateIds.length ? 'scopeMs' : 'fullMs');
|
|
819
|
+
const over = budget !== null && wallMs > budget;
|
|
820
|
+
const budgetNote = budget === null ? '' : `(预算 ${(budget / 1000).toFixed(0)}s${over ? `,超 ${((wallMs / budget - 1) * 100).toFixed(1)}%` : ''})`;
|
|
821
|
+
console.log(`[verify] ⏱️ 门禁成本:墙钟 ${(wallMs / 1000).toFixed(1)}s${budgetNote}|各门合计 ${(totalMs / 1000).toFixed(1)}s|最慢三门 ${top3}`);
|
|
822
|
+
if (over) {
|
|
823
|
+
console.log('[verify] ⚠️ 门禁成本超预算——下一批须退役一门(一进一出;候选 node .agents/scripts/agg-judgments.mjs --retire-candidates)');
|
|
824
|
+
}
|
|
825
|
+
const gen = spawnSync(process.execPath, [path.join(SCRIPT_DIR, 'gen-verify-evidence.mjs'), '--root', ROOT], { encoding: 'utf8' });
|
|
826
|
+
if (gen.status === 0) {
|
|
827
|
+
if (gen.stdout) process.stdout.write(String(gen.stdout).trimEnd() + '\n');
|
|
828
|
+
} else {
|
|
829
|
+
console.error(`[verify] ⚠️ 绿凭证摘要生成失败(${String(gen.stderr || gen.stdout || '').trim().slice(0, 200)})——绿裁决不变,手动补跑 node .agents/scripts/gen-verify-evidence.mjs`);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
if (engineOnly) {
|
|
834
|
+
console.log(`\n[verify] ✅ 引擎段 ${passedCount} 门全绿——增量门通过(非 20 门关单凭证,不落 all-gates 台账与摘要)`);
|
|
835
|
+
} else if (productOnly) {
|
|
836
|
+
console.log(`\n[verify] ✅ 业务面 ${passedCount} 门全绿——分面凭证(非 20 门关单凭证,不落 all-gates 台账与摘要)`);
|
|
837
|
+
} else if (midOnly) {
|
|
838
|
+
console.log(`\n[verify] ✅ 中档 ${passedCount} 门全绿——业务面 + 后端单测(集成测试未跑;非 20 门关单凭证,不落 all-gates 台账与摘要)`);
|
|
839
|
+
} else {
|
|
840
|
+
console.log(`\n[verify] 🎉 全绿——可以关单(共 ${passedCount} 项通过)`);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
run().catch(e => {
|
|
845
|
+
console.error(`[verify] 💥 运行时崩溃: ${e.stack}`);
|
|
846
|
+
process.exit(1);
|
|
847
|
+
});
|