agentic-flow-kit 1.8.2 → 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 -144
- 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 -57
- 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 -27
- 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 -18
- 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 -527
- 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 -1958
- package/templates/_agents/scripts/check-loop.sh +0 -6
- package/templates/_agents/scripts/check-loop.test.mjs +0 -3875
- 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 -96
- package/templates/_agents/scripts/check-scripts-syntax.mjs +0 -61
- 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 -603
- package/templates/_agents/scripts/confirm-doc.test.mjs +0 -1103
- 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 -334
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +0 -224
- 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 -107
- 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 -210
- package/templates/_agents/scripts/verify.test.mjs +0 -358
- 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 -55
- 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 -90
- package/templates/workflow/delegations.md +0 -29
- package/templates/workflow/incidents/_TEMPLATE.md +0 -51
- package/templates/workflow/intents/_TEMPLATE.md +0 -46
- 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,550 @@
|
|
|
1
|
+
// check-loop-kit.mjs — 闭环门禁基础设施层(2026-10-10 收敛系列 4a:自 check-loop.mjs 原位切出,
|
|
2
|
+
// 逐字未改;check-loop.mjs 以解构铺平消费、段体零漂移)。被 import 即执行(ROOT 解析/枚举加载
|
|
3
|
+
// /git 索引构建)——沿主脚本「无 isMain 守卫」既有语义,仅限 check-loop.mjs 与 section 模块 import。
|
|
4
|
+
// 拆分挂起(2026-10-11 C6 定案):本层「~30 符号含可变共享态铺给全部 24 段」是迁移装置的历史遗留
|
|
5
|
+
// (零观测故障 + 高爆炸半径)——缓修,触发条件 = 下次必触本层时以零漂移技法(机械 re-export 垫片 +
|
|
6
|
+
// 逐字节等价比对)改窄接口,勿顺手重构。
|
|
7
|
+
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { spawnSync } from 'node:child_process';
|
|
12
|
+
import { createHash } from 'node:crypto';
|
|
13
|
+
import { createRequire } from 'node:module';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { loadEnums } from './workflow-enums.mjs';
|
|
16
|
+
import { auditEnabled, loadKitPolicy, hasFreshVerifyLine } from './policy.mjs';
|
|
17
|
+
import { laneOfDoc } from './stage-gates.mjs';
|
|
18
|
+
// MARK_RE:incident 留痕形态的单源(第七轮复核 N3——此前 check-loop 内联复制一份同口径字面量,
|
|
19
|
+
// 两处靠注释与人工同步;改为复用 stage-gates.mjs 的导出,从结构上消除漂移可能)
|
|
20
|
+
import { MARK_RE, commitmentFingerprint } from './stage-gates.mjs';
|
|
21
|
+
import { GIT, spawnGit as coreSpawnGit, gitOut as coreGitOut, clearGitCache } from './git-core.mjs';
|
|
22
|
+
|
|
23
|
+
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
|
|
25
|
+
function usage() {
|
|
26
|
+
console.error('check-loop: 用法 node check-loop.mjs [--rev <sha> | --range <oldSha> <newSha>] [--all | --hygiene]');
|
|
27
|
+
console.error(' 默认只跑硬门(配对/判低/指纹/证据/发版未收口)。--hygiene 只跑卫生段。--all 两段都跑。');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
function takeOpts() {
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
const opts = { rev: null, range: null, mode: 'hard' };
|
|
33
|
+
for (let i = 0; i < args.length; i++) {
|
|
34
|
+
if (args[i] === '--rev') {
|
|
35
|
+
opts.rev = args[++i] ?? '';
|
|
36
|
+
if (!opts.rev) usage();
|
|
37
|
+
} else if (args[i] === '--range') {
|
|
38
|
+
opts.range = [args[++i] ?? '', args[++i] ?? ''];
|
|
39
|
+
if (!opts.range[0] || !opts.range[1]) usage();
|
|
40
|
+
} else if (args[i] === '--all') {
|
|
41
|
+
if (opts.mode === 'hygiene') usage();
|
|
42
|
+
opts.mode = 'all';
|
|
43
|
+
} else if (args[i] === '--hygiene') {
|
|
44
|
+
if (opts.mode === 'all') usage();
|
|
45
|
+
opts.mode = 'hygiene';
|
|
46
|
+
} else usage();
|
|
47
|
+
}
|
|
48
|
+
return opts;
|
|
49
|
+
}
|
|
50
|
+
// 仅当本模块由 check-loop.mjs 直接运行时解析 CLI 参数;被其他脚本 import(如 append-compensation.mjs
|
|
51
|
+
// 复用 bindingSha256)时不得解析——否则 import 侧会因参数不匹配直接 usage() 退出(2026-10-25 实测踩坑)。
|
|
52
|
+
const IS_CHECK_LOOP_MAIN = (process.argv[1] || '').endsWith('check-loop.mjs');
|
|
53
|
+
const { rev: REV_ARG, range: RANGE_ARG, mode: LOOP_MODE } = IS_CHECK_LOOP_MAIN ? takeOpts() : { rev: null, range: null, mode: 'hard' };
|
|
54
|
+
if ((REV_ARG || RANGE_ARG) && process.env.CHECK_LOOP_ROOT) {
|
|
55
|
+
console.error('check-loop: CHECK_LOOP_ROOT 与 --rev/--range 不能同时使用');
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
if (REV_ARG && RANGE_ARG) {
|
|
59
|
+
console.error('check-loop: --rev 与 --range 不能同时使用');
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
if ((REV_ARG && /^0+$/.test(REV_ARG)) || (RANGE_ARG && RANGE_ARG.some((s) => /^0+$/.test(s)))) {
|
|
63
|
+
console.error('check-loop: --rev/--range 不是提交(全零 sha)');
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
let REV = null;
|
|
67
|
+
let RANGE_OLD = null;
|
|
68
|
+
|
|
69
|
+
// ---- 根目录与枚举单源 ----
|
|
70
|
+
let ROOT;
|
|
71
|
+
let MAIN_ROOT;
|
|
72
|
+
if (process.env.CHECK_LOOP_ROOT) {
|
|
73
|
+
ROOT = path.resolve(process.env.CHECK_LOOP_ROOT);
|
|
74
|
+
if (!fs.existsSync(ROOT)) {
|
|
75
|
+
console.error('check-loop: CHECK_LOOP_ROOT 不可访问:' + process.env.CHECK_LOOP_ROOT);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
MAIN_ROOT = ROOT;
|
|
79
|
+
} else {
|
|
80
|
+
const top = gitOut(['rev-parse', '--show-toplevel']);
|
|
81
|
+
if (top === null) {
|
|
82
|
+
if (REV_ARG) {
|
|
83
|
+
console.error(`check-loop: --rev 剥不到提交 ${REV_ARG}`);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
console.error('check-loop: 不在 git 仓库内,跳过扫描');
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
ROOT = top.trim();
|
|
90
|
+
MAIN_ROOT = ROOT;
|
|
91
|
+
if (REV_ARG || RANGE_ARG) {
|
|
92
|
+
const want = REV_ARG || RANGE_ARG[1];
|
|
93
|
+
const peeled = gitOut(['rev-parse', '--verify', `${want}^{commit}`]);
|
|
94
|
+
if (!peeled) {
|
|
95
|
+
console.error(`check-loop: --rev/--range 剥不到提交 ${want}`);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
REV = peeled.trim();
|
|
99
|
+
if (RANGE_ARG) {
|
|
100
|
+
const peeledOld = gitOut(['rev-parse', '--verify', `${RANGE_ARG[0]}^{commit}`]);
|
|
101
|
+
if (!peeledOld) {
|
|
102
|
+
console.error(`check-loop: --range 剥不到起点提交 ${RANGE_ARG[0]}`);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
RANGE_OLD = peeledOld.trim();
|
|
106
|
+
}
|
|
107
|
+
const parent = fs.mkdtempSync(path.join(os.tmpdir(), 'ck-rev-'));
|
|
108
|
+
const wt = path.join(parent, 'wt');
|
|
109
|
+
const main = ROOT;
|
|
110
|
+
const add = spawnSync(GIT, ['worktree', 'add', '--detach', '--quiet', wt, REV], {
|
|
111
|
+
cwd: main, encoding: 'utf8',
|
|
112
|
+
});
|
|
113
|
+
if (add.status !== 0) {
|
|
114
|
+
fs.rmSync(parent, { recursive: true, force: true });
|
|
115
|
+
console.error(`check-loop: 导出提交失败 ${REV_ARG}\n${add.stderr || add.stdout || ''}`);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
process.on('exit', () => {
|
|
119
|
+
spawnSync(GIT, ['worktree', 'remove', '--force', wt], { cwd: main });
|
|
120
|
+
fs.rmSync(parent, { recursive: true, force: true });
|
|
121
|
+
});
|
|
122
|
+
ROOT = wt;
|
|
123
|
+
clearGitCache(); // 换根(main→worktree)后作废缓存(core 键含 cwd,此为防御性清空)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// 枚举单源(<root>/.agents/config/workflow-enums.txt——fixture 契约:缺文件/缺键 fail-loud)
|
|
127
|
+
let ENUMS;
|
|
128
|
+
try {
|
|
129
|
+
ENUMS = loadEnums(path.join(ROOT, '.agents', 'config', 'workflow-enums.txt'));
|
|
130
|
+
} catch (e) {
|
|
131
|
+
const msg = String(e.message || '');
|
|
132
|
+
if (msg.includes('不可读')) {
|
|
133
|
+
console.error(`check-loop: 缺 ${path.join('.agents', 'config', 'workflow-enums.txt')}(枚举单源)——本仓自有件,从 git 历史恢复后重试`);
|
|
134
|
+
} else {
|
|
135
|
+
console.error('check-loop: 枚举单源 ' + msg);
|
|
136
|
+
}
|
|
137
|
+
process.exit(1);
|
|
138
|
+
}
|
|
139
|
+
const inSet = (v, arr) => arr.includes(v);
|
|
140
|
+
const stOkDoc = (st) => inSet(st, ENUMS['doc.status.confirmed']);
|
|
141
|
+
|
|
142
|
+
// git 调用单源(2026-10-10 收敛系列 5):git-core 供给(记忆化/瞬时重试/基础设施响亮出账),
|
|
143
|
+
// cwd 恒本仓 ROOT。语义沿革(2026-10-05-gitout-fail-open)见 git-core.mjs 头注。
|
|
144
|
+
function spawnGit(args) {
|
|
145
|
+
return coreSpawnGit(args, ROOT);
|
|
146
|
+
}
|
|
147
|
+
function gitOut(args, { ok = () => true } = {}) {
|
|
148
|
+
return coreGitOut(args, ROOT, { ok });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 测试绿凭证只在本机。--rev 把 ROOT 换成临时 worktree,gitignore 的 verifications.jsonl
|
|
152
|
+
// 不会出现在那棵树上。文件不在树上时回退主工作区;树上已有文件仍以树为准。
|
|
153
|
+
// 非 --rev(含 CHECK_LOOP_ROOT)不回退,避免夹具读到开发者自己的凭证。
|
|
154
|
+
function readVerifyLedgerText() {
|
|
155
|
+
const name = path.join('.agents', 'verifications.jsonl');
|
|
156
|
+
const primary = path.join(ROOT, name);
|
|
157
|
+
try {
|
|
158
|
+
if (fs.existsSync(primary)) return fs.readFileSync(primary, 'utf8');
|
|
159
|
+
if (!REV || !MAIN_ROOT || path.resolve(MAIN_ROOT) === path.resolve(ROOT)) return null;
|
|
160
|
+
const fallback = path.join(MAIN_ROOT, name);
|
|
161
|
+
if (fs.existsSync(fallback)) return fs.readFileSync(fallback, 'utf8');
|
|
162
|
+
} catch {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ---- frontmatter 受限子集读取(fm_get 语义:首行 --- 进入、下一 --- 闭合、键在行首、首个命中、值两侧去空白)----
|
|
169
|
+
// fs 读取同走 fail-loud(2026-10-05-gitout-fail-open 实现期诊断追加,与 spawnGit 同一故障类):
|
|
170
|
+
// readFileSync 瞬时异常(宿主资源压力 EMFILE/共享冲突类)重试一次,仍失败响亮出账(进程级去重)
|
|
171
|
+
// 后按 null 降级——调用方按空文档跳过该件,但异常本身不再静默
|
|
172
|
+
let fsReadWarned = new Set();
|
|
173
|
+
const fileLinesCache = new Map();
|
|
174
|
+
function linesOf(file) {
|
|
175
|
+
if (!fileLinesCache.has(file)) {
|
|
176
|
+
let lines = null;
|
|
177
|
+
try {
|
|
178
|
+
lines = fs.readFileSync(file, 'utf8').split(/\r?\n/);
|
|
179
|
+
} catch (e) {
|
|
180
|
+
try { lines = fs.readFileSync(file, 'utf8').split(/\r?\n/); } catch { lines = null; }
|
|
181
|
+
if (!lines && !fsReadWarned.has(file)) {
|
|
182
|
+
fsReadWarned.add(file);
|
|
183
|
+
console.error(`check-loop: 文档读取异常 ${path.basename(file)}(${e.code || e.message})——按空文档降级,检查面可能收窄`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
fileLinesCache.set(file, lines);
|
|
187
|
+
}
|
|
188
|
+
return fileLinesCache.get(file);
|
|
189
|
+
}
|
|
190
|
+
function fmGet(file, key) {
|
|
191
|
+
const lines = linesOf(file);
|
|
192
|
+
if (!lines) return '';
|
|
193
|
+
const isDelim = (l) => /^---\s*$/.test(l);
|
|
194
|
+
if (!isDelim(lines[0] || '')) return '';
|
|
195
|
+
for (let i = 1; i < lines.length; i++) {
|
|
196
|
+
if (isDelim(lines[i])) return '';
|
|
197
|
+
if (lines[i].startsWith(key + ':')) return lines[i].slice(key.length + 1).trim();
|
|
198
|
+
}
|
|
199
|
+
return '';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const WF = 'workflow';
|
|
203
|
+
const DOC_DIRS = ['intents', 'specs', 'plans', 'incidents'];
|
|
204
|
+
const blockers = [];
|
|
205
|
+
const warnings = [];
|
|
206
|
+
// audit:false(init 新装)只保留 blockers。缺省与 audit:true 保持全量警告。
|
|
207
|
+
// 硬规则:配对 / 验收勾验的阻断 / 确认留痕 / 发版草稿。卫生项走 warnings。
|
|
208
|
+
const kitPolicy = loadKitPolicy(ROOT);
|
|
209
|
+
if (!auditEnabled(kitPolicy)) {
|
|
210
|
+
warnings.push = () => warnings.length;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ---- 已提交(HEAD)过滤:仓库模式只扫 tracked(fixture 模式恒真;ls-tree 失败退化全扫)----
|
|
214
|
+
let trackedSet = null; // null = 不过滤
|
|
215
|
+
if (!process.env.CHECK_LOOP_ROOT) {
|
|
216
|
+
const out = gitOut(['ls-tree', '-r', '--name-only', 'HEAD', '--', 'workflow']);
|
|
217
|
+
if (out !== null) trackedSet = new Set(out.split('\n').map((l) => l.trim()).filter(Boolean));
|
|
218
|
+
}
|
|
219
|
+
const isTracked = (abs) => trackedSet === null || trackedSet.has(path.relative(ROOT, abs).split(path.sep).join('/'));
|
|
220
|
+
// ---- 增量扫描面(2026-10-28 引擎减重第二刀:只扫本次 diff 触及的文档)----
|
|
221
|
+
// 本地 / pre-push 默认只扫「本轮变更触及的 workflow 文档」——s01 配对与 s15 指纹此前每次全扫
|
|
222
|
+
// 440 份(check-loop 26s 的主要成本)。面源:REV 模式 = 该提交 first-parent diff(普通提交等价
|
|
223
|
+
// git show,合并提交取 ^1..REV——合并提交 git show 默认无文件面,见下);本地 = HEAD..工作区 ∪ untracked。
|
|
224
|
+
// 全量兜底 = 环境变量 CHECK_LOOP_FULL=1(仅本地手动;CI 不跑治理门——2026-10-28 减重裁定 CI 只留
|
|
225
|
+
// 业务面,azure-pipelines.yml 无 CHECK_LOOP_FULL)。
|
|
226
|
+
// 诚实边界:未触及文档的存量配对断裂/指纹漂移本地不再发现,全量审计须手动 CHECK_LOOP_FULL=1
|
|
227
|
+
// ——本地门禁只拦「本轮引入」。
|
|
228
|
+
const FULL_SCAN = process.env.CHECK_LOOP_FULL === '1';
|
|
229
|
+
let CHANGED_DOCS = null;
|
|
230
|
+
const changedDocSet = () => {
|
|
231
|
+
if (CHANGED_DOCS) return CHANGED_DOCS;
|
|
232
|
+
// 夹具根(CHECK_LOOP_ROOT)无「本轮变更」事实,按全量扫——保持既有夹具语义。
|
|
233
|
+
if (process.env.CHECK_LOOP_ROOT) return null;
|
|
234
|
+
const set = new Set();
|
|
235
|
+
const add = (text) => String(text || '').split(/\r?\n/).forEach((l) => {
|
|
236
|
+
const p = l.trim().replace(/\\/g, '/');
|
|
237
|
+
if (p.startsWith(WF + '/') && p.endsWith('.md')) set.add(p);
|
|
238
|
+
});
|
|
239
|
+
if (REV) {
|
|
240
|
+
if (RANGE_OLD) {
|
|
241
|
+
// C3(2026-10-28):--range old new(pre-push 推送范围)——两端树差覆盖中间全部提交(含合并,无 -m 盲区)。
|
|
242
|
+
add(gitOut(['diff', '--name-only', '--no-renames', RANGE_OLD, REV]));
|
|
243
|
+
} else {
|
|
244
|
+
// P0-A(2026-10-28 复核实证):合并提交的 git show 默认无文件面 → 增量面空集 → hard 段空扫报绿。
|
|
245
|
+
// first-parent diff 统一两种提交形态:普通提交等价 git show;合并提交 = 该合并引入本分支的文件面。
|
|
246
|
+
// ^1 不存在(root commit)时回退 git show(沿 gitOut null fail-open 口径)。
|
|
247
|
+
const fp = gitOut(['diff', '--name-only', '--no-renames', `${REV}^1`, REV]);
|
|
248
|
+
add(fp !== null ? fp : gitOut(['show', '--name-only', '--format=', '--no-renames', REV]));
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
add(gitOut(['diff', '--name-only', '--no-renames', 'HEAD'])); // HEAD..工作区(含暂存)
|
|
252
|
+
add(gitOut(['ls-files', '--others', '--exclude-standard'])); // untracked 新档
|
|
253
|
+
}
|
|
254
|
+
CHANGED_DOCS = set;
|
|
255
|
+
return set;
|
|
256
|
+
};
|
|
257
|
+
const docFiles = (sub) => {
|
|
258
|
+
const dir = path.join(ROOT, WF, sub);
|
|
259
|
+
if (!fs.existsSync(dir)) return [];
|
|
260
|
+
const all = fs.readdirSync(dir)
|
|
261
|
+
.filter((f) => f.endsWith('.md') && /^\d/.test(f))
|
|
262
|
+
.map((f) => path.join(dir, f))
|
|
263
|
+
.filter((f) => isTracked(f))
|
|
264
|
+
.sort();
|
|
265
|
+
if (FULL_SCAN) return all;
|
|
266
|
+
const changed = changedDocSet();
|
|
267
|
+
if (!changed) return all;
|
|
268
|
+
return all.filter((f) => changed.has(path.relative(ROOT, f).split(path.sep).join('/')));
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
// --- 共享:文件「首次加入 git」的日期索引(check8-git-anchor)---
|
|
273
|
+
// 用途:检查 8 的生效日锚从**可手填的文件名前缀**(项目命名规范本身即 `YYYY-MM-DD-<主题>`,作者
|
|
274
|
+
// 日常手写该前缀,「写早」零成本、顺手即发生——一条 hard 门可被平凡绕过)改为**首次加入 git 的日期**。
|
|
275
|
+
// **诚实边界(复核 P1 更正)**:该锚取 `git log --diff-filter=A --format=@%aI`,即 **author date
|
|
276
|
+
// (作者自报时间戳)**,**不是** commit 时刻——`git commit --date=<过去>` 一条参数即可伪造,故
|
|
277
|
+
// 「锚不可手填」的说法**不成立**。本改动的确切收益是:关掉「改文件名(日常必写、零成本)」这条通道,
|
|
278
|
+
// 把伪造成本抬到「主动加参数伪造时间戳」——后者与「伪造台账」同属**本地信任边界内不可机器防**的范畴
|
|
279
|
+
// (事后对质靠 git 历史与台账)。此处如实声明,不宣称「通道已关闭」。
|
|
280
|
+
// 口径:git 按时间新→旧遍历,同一文件首遇即最早那次加入(与检查 10 的 addpath 同款判据)。
|
|
281
|
+
// 非 git / 命令失败 → null,调用方按既有「非 git 跳过」语义退化(不 fail-loud)。
|
|
282
|
+
// 注:检查 10 需要的是「文件→加入 commit」+「commit→文件清单」两份映射(判断同提交是否触及迁移 SQL),
|
|
283
|
+
// 与本索引「文件→日期」不同构,故**不合并**——避免把两处判据耦死。
|
|
284
|
+
// HEAD 增量磁盘缓存(2026-11-06 P1 减重):上一版每轮全史扫描 2.2s(history walk 是地板,实测
|
|
285
|
+
// `<range>..HEAD -- workflow` 5 提交仅 75ms)。缓存 = { root, head, dates }:
|
|
286
|
+
// ① HEAD 未动 → 直接用(零 git 调用);② HEAD 前进(cache.head 是 HEAD 祖先)→ 只走
|
|
287
|
+
// `<cache.head>..<head>` 并合并(首遇即最早,已存在的键不覆盖);③ HEAD 回退 / 缓存缺失损坏
|
|
288
|
+
// → 全量重建。写缓存用 tmp+rename 原子替换(并发跑不产半份);git 命令失败时不写,
|
|
289
|
+
// 有旧缓存则沿用(新文件日期缺失 → '',与「查不到」同语义)。
|
|
290
|
+
const addedDates = (() => {
|
|
291
|
+
if (gitOut(['rev-parse', '--git-dir']) === null) return null;
|
|
292
|
+
const head = (gitOut(['rev-parse', '--short', 'HEAD']) || '').trim();
|
|
293
|
+
if (!head) return null;
|
|
294
|
+
const cacheFile = path.join(ROOT, '.agents', 'cache', 'added-dates.json');
|
|
295
|
+
let cached = null;
|
|
296
|
+
try {
|
|
297
|
+
const c = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
|
298
|
+
if (c && c.root === ROOT && typeof c.head === 'string' && c.head && c.dates && typeof c.dates === 'object') cached = c;
|
|
299
|
+
} catch { /* 无缓存/损坏 → 全量重建 */ }
|
|
300
|
+
const m = new Map(cached ? Object.entries(cached.dates) : []);
|
|
301
|
+
let log = null;
|
|
302
|
+
if (cached && cached.head === head) {
|
|
303
|
+
// 命中:HEAD 未动,历史不变
|
|
304
|
+
} else if (cached && spawnSync(GIT, ['merge-base', '--is-ancestor', cached.head, head], { cwd: ROOT, encoding: 'utf8' }).status === 0) {
|
|
305
|
+
log = gitOut(['log', `${cached.head}..${head}`, '--diff-filter=A', '--format=@%aI', '--name-only', '--', 'workflow']);
|
|
306
|
+
} else {
|
|
307
|
+
log = gitOut(['log', '--diff-filter=A', '--format=@%aI', '--name-only', '--', 'workflow']);
|
|
308
|
+
}
|
|
309
|
+
if (log === null) return cached ? m : null;
|
|
310
|
+
let cur = null;
|
|
311
|
+
for (const line of log.split('\n')) {
|
|
312
|
+
if (line.startsWith('@')) { cur = line.slice(1); continue; }
|
|
313
|
+
if (line.trim() && cur && !m.has(line.trim())) m.set(line.trim(), cur); // 新→旧序首遇 = 最早
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
fs.mkdirSync(path.dirname(cacheFile), { recursive: true });
|
|
317
|
+
const tmp = `${cacheFile}.tmp`;
|
|
318
|
+
fs.writeFileSync(tmp, JSON.stringify({ root: ROOT, head, dates: Object.fromEntries(m) }));
|
|
319
|
+
fs.renameSync(tmp, cacheFile);
|
|
320
|
+
} catch { /* 缓存写失败不影响门禁裁决 */ }
|
|
321
|
+
return m;
|
|
322
|
+
})();
|
|
323
|
+
// 某文档「首次加入日期」(YYYY-MM-DD);不可判定(非 git / 查不到)返回 ''
|
|
324
|
+
const addedDateOf = (absDoc) => {
|
|
325
|
+
if (!addedDates) return '';
|
|
326
|
+
const rel = path.relative(ROOT, absDoc).split(path.sep).join('/');
|
|
327
|
+
const iso = addedDates.get(rel);
|
|
328
|
+
return iso ? iso.slice(0, 10) : '';
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
// 豁免/放行分支出账(fail-loud 口径——「裁决消失」不可归因的教训:豁免路径零痕迹;
|
|
333
|
+
// 2026-10-05-check8-digit-sha-misfire):按 type 进程级去重,每类至多一条;stderr 不改 stdout 协议
|
|
334
|
+
const evidenceExemptWarned = new Set();
|
|
335
|
+
function warnEvidenceExempt(type, base) {
|
|
336
|
+
if (evidenceExemptWarned.has(type)) return;
|
|
337
|
+
evidenceExemptWarned.add(type);
|
|
338
|
+
console.error(`check-loop: 证据豁免 ${type} ${base}——该文档的验收证据未做真相核验`);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// 证据真相校验:检查证据字符串是否包含合法的 commit SHA,且该 commit 触及了 plan 声明的文件
|
|
342
|
+
// 测试绿声明对账(verify-evidence):ctx = { verifyRelevant, hasFresh } 时,无 SHA 且命中
|
|
343
|
+
// 关键词的证据走凭证对账——有 24h 绿行 → verify 型豁免出账;无 → verify-missing(聚合段出 warning,
|
|
344
|
+
// 灰度第一档非 blocker)。ctx 由调用方按「intent 加入 git ≥ verifySince(v5 锚)」组装;锚不可判定
|
|
345
|
+
// → ctx null → 维持 text 豁免(无判定依据不产出告警)。关键词表最小集起步(check2-datetime 先例:
|
|
346
|
+
// 只豁免实证形态,变体实证再扩)。
|
|
347
|
+
const VERIFY_GREEN_RE = /测试通过|测试全绿|测试绿|全绿/;
|
|
348
|
+
// 证据残差单源(大写预筛与 rev-parse 失败分类共用同一判据,防两份字面量漂移):
|
|
349
|
+
// 剔除 SHA 与泛指词后的残余内容——非空(项目名/路径/单据上下文)→ external 豁免;
|
|
350
|
+
// 为空(纯「commit a1b2c3d」「提交 a1b2c3d」)→ 本地引用伪造,硬拦。
|
|
351
|
+
// 多 SHA(2026-10-27):剔除**全部** hex token 再判残差——否则同一行里的另一个 SHA 会充当
|
|
352
|
+
// 「上下文」,把裸引用的伪造 SHA 误判成 external 而豁免(行内互洗白面)。
|
|
353
|
+
const evidenceResidue = (evidenceStr, sha) => evidenceStr.replace(sha, '')
|
|
354
|
+
.replace(/\b[a-f0-9]{7,40}\b/gi, '')
|
|
355
|
+
.replace(/证据[::]|commit|提交|[()()。—-]/gi, '')
|
|
356
|
+
// 连接词/停顿(多 SHA 行常见「A 与 B」「A、B」):不构成可核验上下文,剔除后仍判伪造。
|
|
357
|
+
.replace(/[与和及、,,;;::\/]+/g, '')
|
|
358
|
+
.trim();
|
|
359
|
+
|
|
360
|
+
// 多 SHA(2026-10-27 evidence-multi-sha):证据行常同时引实现提交与「同款记录」的关单提交,
|
|
361
|
+
// 此前只取首个 token → 实现提交排在后面时被判「未触及声明文件」(实测误拦 2026-10-27 plan)。
|
|
362
|
+
// 现全部核验:任一「实质放行」(sha/process)即通过;但若同批还有「解析成功却未触及、且非 docs
|
|
363
|
+
// 记录型」的 SHA → 仍拦(防「真 SHA + 伪造 SHA」混排洗白)。无实质放行时优先报伪造、其次无关。
|
|
364
|
+
function verifyEvidenceTruth(evidenceStr, planBase, root, ctx) {
|
|
365
|
+
const shaTokens = [...new Set([...evidenceStr.matchAll(/\b([a-f0-9]{7,40})\b/gi)].map((m) => m[1]))];
|
|
366
|
+
if (!shaTokens.length) {
|
|
367
|
+
if (ctx && ctx.verifyRelevant && VERIFY_GREEN_RE.test(evidenceStr)) {
|
|
368
|
+
if (ctx.hasFresh) {
|
|
369
|
+
warnEvidenceExempt('verify', planBase);
|
|
370
|
+
return { ok: true, type: 'verify' };
|
|
371
|
+
}
|
|
372
|
+
return { ok: true, type: 'verify-missing' };
|
|
373
|
+
}
|
|
374
|
+
warnEvidenceExempt('text', planBase);
|
|
375
|
+
return { ok: true, type: 'text' };
|
|
376
|
+
}
|
|
377
|
+
const verdicts = shaTokens.map((t) => verifyOneSha(t, evidenceStr, planBase));
|
|
378
|
+
const pass = verdicts.find((v) => v.ok && (v.type === 'sha' || v.type === 'process'));
|
|
379
|
+
if (pass) {
|
|
380
|
+
// 已有实质放行时,只拦「伪造」(不存在的 SHA)——那是硬错。
|
|
381
|
+
// irrelevant 的旁证提交(同批 fix/chore 提交、实测脚本提交)不拦:它们不是伪造,
|
|
382
|
+
// 且实测三条存量 done plan 都是「真实现提交 + 旁证提交」形态(2026-10-27 复核)。
|
|
383
|
+
const forged = verdicts.find((v) => !v.ok && v.type === 'forged');
|
|
384
|
+
return forged || pass;
|
|
385
|
+
}
|
|
386
|
+
const forgedOnly = verdicts.find((v) => !v.ok && v.type === 'forged');
|
|
387
|
+
if (forgedOnly) return forgedOnly;
|
|
388
|
+
const firstBad = verdicts.find((v) => !v.ok);
|
|
389
|
+
return firstBad || verdicts[0];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// 单 SHA 核验(verifyEvidenceTruth 的核验主体;多 SHA 版逐 token 调用)。
|
|
393
|
+
function verifyOneSha(shaRaw, evidenceStr, planBase) {
|
|
394
|
+
let sha = shaRaw;
|
|
395
|
+
// 大写 A-F 预筛(perf-evidence-git-memoize):含大写 A-F 的 token(船厂单据号
|
|
396
|
+
// BCCAC121100001 类)占证据 hex token 相当比例且 rev-parse 必失败(对象名的规范输出恒小写),
|
|
397
|
+
// 逐个 spawn 纯耗——带上下文残余的(单据号典型形态)直接按 external 豁免,不再实证。
|
|
398
|
+
// 纯数字 token 不预筛:全数字短 SHA 真实存在(2026-10-05-check8-digit-sha-misfire 锚),必须实证。
|
|
399
|
+
// 诚实边界(2026-10-10 实证:git hex 解析大小写不敏感——大写拼写的真 SHA 可解析成功):
|
|
400
|
+
// - 裸引用形态(残差为空)本会硬拦——为防「真 SHA 被人工大写粘贴」误拦,小写化 rev-parse 兜底,
|
|
401
|
+
// 解析成功则回正常核验链;大小写不敏感 ⇒ 小写化解析与原 token 逐点等价,行为与现行一致。
|
|
402
|
+
// - 带上下文形态的放宽面:真 SHA 被大写粘贴且带上下文 → 不再进交集核验、按 external 豁免
|
|
403
|
+
// (git 工具链输出恒小写,该形态仅罕见人工转换产生——接受并在此声明)。
|
|
404
|
+
if (/[A-F]/.test(sha)) {
|
|
405
|
+
const residue = evidenceResidue(evidenceStr, sha);
|
|
406
|
+
if (residue.length > 0) {
|
|
407
|
+
warnEvidenceExempt('external', planBase);
|
|
408
|
+
return { ok: true, type: 'external' };
|
|
409
|
+
}
|
|
410
|
+
const lowerProbe = spawnGit(['rev-parse', sha.toLowerCase()]);
|
|
411
|
+
if (lowerProbe.status !== 0) return { ok: false, type: 'forged', msg: `提交 ${sha} 不存在` };
|
|
412
|
+
sha = sha.toLowerCase();
|
|
413
|
+
}
|
|
414
|
+
// 直连走 spawnGit(与 gitOut 同一 loud+retry 通道,注释互引):spawn 异常不再被静默算作业务失败;
|
|
415
|
+
// 重试后仍异常按下方 status!==0 判定(fail-closed 保持——本地核验不了就按伪造拦)
|
|
416
|
+
const revParse = spawnGit(['rev-parse', sha]);
|
|
417
|
+
if (revParse.status !== 0) {
|
|
418
|
+
// 纯数字串且解析失败 → 时间戳/ID 维持文本豁免(2026-10-05-check8-digit-sha-misfire:形态守卫
|
|
419
|
+
// 曾把全数字短 SHA≈4.4%/夹具 误分类为文本致核验静默跳过——改由 rev-parse 实证分流)。
|
|
420
|
+
// 纪律:文本启发式须可被实证兜底,禁以字符形态抢先分类。
|
|
421
|
+
// 兜底成立的前提是「解析失败 = 业务裁决(git 可用、对象不存在)」。git 自身起不来(revParse.error,
|
|
422
|
+
// 基础设施异常,重试后仍异常)时实证无从发生,数字形态不得抢先豁免——否则「全数字短 SHA + git 缺失」
|
|
423
|
+
// 正好落进无人兜底的静默降级(2026-10-09 AI-Native 架构审查修复::225 intentional-simple 声称的
|
|
424
|
+
// 「仍异常走拦截语义」在本分支实为放行;夹具是否踩中取决于哈希运气,≈4.4%/夹具)。
|
|
425
|
+
// 装户无 git 仓(status 128、非 r.error)不受影响——那是合法装户语义,维持豁免。
|
|
426
|
+
if (/^\d+$/.test(sha) && !revParse.error) {
|
|
427
|
+
warnEvidenceExempt('text', planBase);
|
|
428
|
+
return { ok: true, type: 'text' };
|
|
429
|
+
}
|
|
430
|
+
// 区分本地伪造与外部仓库引用(残差判据单源 evidenceResidue——与上方大写预筛共用,防漂移)
|
|
431
|
+
const residue = evidenceResidue(evidenceStr, sha);
|
|
432
|
+
if (residue.length > 0) {
|
|
433
|
+
warnEvidenceExempt('external', planBase);
|
|
434
|
+
return { ok: true, type: 'external' };
|
|
435
|
+
}
|
|
436
|
+
return { ok: false, type: 'forged', msg: `提交 ${sha} 不存在` };
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// 解析成功(含纯数字短 SHA 命中提交/ref 的情形)→ 真相核验
|
|
440
|
+
const planPath = path.join(ROOT, WF, 'plans', planBase + '.md');
|
|
441
|
+
if (!fs.existsSync(planPath)) {
|
|
442
|
+
warnEvidenceExempt('no-plan', planBase);
|
|
443
|
+
return { ok: true, type: 'no-plan' }; // 缺 plan 走 Check 1 拦截
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const planLines = linesOf(planPath) || [];
|
|
447
|
+
const declaredFiles = [];
|
|
448
|
+
// 扫描「改动面」「任务拆解」「改动方案」或「改动文件清单」(2026-10-11 C4 收尾发现:2026-09-23 期
|
|
449
|
+
// 存量 L2 plan 用「改动文件清单」节名,提取面为空 → 一切 SHA 证据误判「未触及声明文件」——arrival
|
|
450
|
+
// 关单实证;扩名而非改档,存量 done 档内容受指纹绑定禁改)
|
|
451
|
+
let inDeclaredSec = false;
|
|
452
|
+
for (const line of planLines) {
|
|
453
|
+
if (/^##\s+(改动面|任务拆解|改动方案|改动文件清单)/.test(line)) { inDeclaredSec = true; continue; }
|
|
454
|
+
if (inDeclaredSec && /^##\s+/.test(line)) { inDeclaredSec = false; continue; }
|
|
455
|
+
if (inDeclaredSec) {
|
|
456
|
+
const fileMatch = line.match(/([a-zA-Z0-9._\/-]+\.[a-zA-Z0-9]+)/);
|
|
457
|
+
if (fileMatch) declaredFiles.push(fileMatch[1]);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
const show = spawnGit(['show', '--name-only', sha]);
|
|
462
|
+
if (show.status !== 0) return { ok: false, type: 'error', msg: `无法读取提交 ${sha} 的文件列表` };
|
|
463
|
+
|
|
464
|
+
const changedFiles = show.stdout.split(/\r?\n/).filter(Boolean);
|
|
465
|
+
const hasIntersection = changedFiles.some(f => declaredFiles.some(df => f.includes(df) || df.includes(f)));
|
|
466
|
+
|
|
467
|
+
if (!hasIntersection) {
|
|
468
|
+
// 过程证据(check-evidence-process):执行器驱动的提交可作验收证据——提交信息带
|
|
469
|
+
// 「pipeline-run <runId>」标记(docsCommit 四种格式共有段,runId 严格形态 日期8-时间4-主题-尾;
|
|
470
|
+
// 与 run 事件流同源,git 历史留痕可对质)。只救 irrelevant:forged(SHA 不存在)在前已判,其余判据不动。
|
|
471
|
+
// 记录型标志(2026-10-06-v114-backflow-batch):docs 系 Conventional Commit(冒烟报告 / 留痕 / 关单台账)
|
|
472
|
+
// 不触 plan 声明面属预期——是否降级豁免由检查 8 聚合段判(须同文档存在可过检实现证据),此处只出标志。
|
|
473
|
+
const subj = spawnGit(['log', '-1', '--format=%s', sha]);
|
|
474
|
+
const recordCommit = subj.status === 0 && /^docs[(:]/.test(subj.stdout.trim());
|
|
475
|
+
if (subj.status === 0 && /pipeline-run [0-9]{8}-[0-9]{4}-[A-Za-z0-9-]+/.test(subj.stdout)) {
|
|
476
|
+
warnEvidenceExempt('process', planBase);
|
|
477
|
+
return { ok: true, type: 'process' };
|
|
478
|
+
}
|
|
479
|
+
return { ok: false, type: 'irrelevant', msg: `提交 ${sha} 未触及 plan 声明的任何文件`, recordCommit };
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return { ok: true, type: 'sha' };
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
function versionGreater(a, b) {
|
|
487
|
+
const parse = (v) => {
|
|
488
|
+
const m = /^(\d+)\.(\d+)\.(\d+)$/.exec(String(v ?? ''));
|
|
489
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
490
|
+
};
|
|
491
|
+
const x = parse(a);
|
|
492
|
+
const y = parse(b);
|
|
493
|
+
if (!x || !y) return false;
|
|
494
|
+
for (let i = 0; i < 3; i++) {
|
|
495
|
+
if (x[i] !== y[i]) return x[i] > y[i];
|
|
496
|
+
}
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function fmStatus(text) {
|
|
501
|
+
const lines = String(text || '').split(/\r?\n/);
|
|
502
|
+
if (!/^---\s*$/.test(lines[0] || '')) return '';
|
|
503
|
+
for (let i = 1; i < lines.length; i++) {
|
|
504
|
+
if (/^---\s*$/.test(lines[i])) return '';
|
|
505
|
+
if (lines[i].startsWith('状态:')) return lines[i].slice('状态:'.length).trim();
|
|
506
|
+
}
|
|
507
|
+
return '';
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
// bindingSha256:done 内容绑定的复原重算(检查 15 专用)——confirm-doc.mjs computeFingerprint 的逆推:
|
|
512
|
+
// lines 已 CRLF 归一(split(/\r?\n/)),frontmatter 区内首个「状态:」行保分隔符换值为 prev(`状态: done`
|
|
513
|
+
// 双空格 → `状态: approved`——与前向按原行字面计算对称,非规范分隔符不误伤;行尾空白等更奇异格式仍会
|
|
514
|
+
// 失配,触发前提本身已违反「确认落态唯一入口」约定,接受),全文剔「确认指纹:」行后 join('\n') 再 sha256。
|
|
515
|
+
function bindingSha256(lines, prevStatus) {
|
|
516
|
+
const isDelim = (l) => /^---\s*$/.test(l);
|
|
517
|
+
const out = [];
|
|
518
|
+
let i = 0;
|
|
519
|
+
if (isDelim(lines[0] || '')) {
|
|
520
|
+
out.push(lines[0]);
|
|
521
|
+
let replaced = false;
|
|
522
|
+
for (i = 1; i < lines.length; i++) {
|
|
523
|
+
if (isDelim(lines[i])) { out.push(lines[i]); i++; break; }
|
|
524
|
+
if (!replaced && /^状态:/.test(lines[i])) {
|
|
525
|
+
out.push(lines[i].replace(/^(\s*状态:\s*)\S.*$/, `$1${prevStatus}`));
|
|
526
|
+
replaced = true;
|
|
527
|
+
} else out.push(lines[i]);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
for (; i < lines.length; i++) out.push(lines[i]);
|
|
531
|
+
return createHash('sha256').update(out.filter((l) => !/^确认指纹:/.test(l)).join('\n'), 'utf8').digest('hex');
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function readdirOrNull(dir) {
|
|
535
|
+
try { return fs.readdirSync(dir); } catch { return null; }
|
|
536
|
+
}
|
|
537
|
+
function isDirectoryOrNull(p) {
|
|
538
|
+
try { return fs.statSync(p).isDirectory(); } catch { return false; }
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
export {
|
|
543
|
+
fs, os, path, spawnSync, createHash, createRequire, fileURLToPath,
|
|
544
|
+
loadEnums, auditEnabled, loadKitPolicy, hasFreshVerifyLine, readVerifyLedgerText, laneOfDoc, MARK_RE,
|
|
545
|
+
SCRIPT_DIR, GIT, REV_ARG, REV, RANGE_OLD, FULL_SCAN, LOOP_MODE, ROOT, MAIN_ROOT, ENUMS, inSet, stOkDoc,
|
|
546
|
+
spawnGit, gitOut, linesOf, fmGet, WF, DOC_DIRS, blockers, warnings, kitPolicy, isTracked, docFiles,
|
|
547
|
+
addedDateOf, warnEvidenceExempt, VERIFY_GREEN_RE, verifyEvidenceTruth,
|
|
548
|
+
versionGreater, fmStatus, bindingSha256, readdirOrNull, isDirectoryOrNull,
|
|
549
|
+
commitmentFingerprint,
|
|
550
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// check-loop-rev-semantics.mjs — 合并提交增量面语义对拍探针(2026-10-28 C1,P0-A 防退化钉子)
|
|
3
|
+
// 背景(P0-A,2026-10-28 复核实证):check-loop-kit 的 REV 面曾用 `git show --name-only` 取文件面,
|
|
4
|
+
// 合并提交默认无文件面 → hard 5 段空扫报绿(近三天 6/6 合并提交实证)。修复改为 first-parent diff
|
|
5
|
+
// (普通提交等价 git show;合并提交 = REV^1..REV)。f7de5922 的教训「合并必须取全文件面」此前只靠
|
|
6
|
+
// commit message 口头声明 + 已删测试守护——本探针把该语义钉成机器可证伪:
|
|
7
|
+
// A) 等价性:first-parent 结果 ⊆ `git show -m` 双侧并集(防现行实现本身算错面);
|
|
8
|
+
// B) 退化钉子:样本合并提交中至少 1 个满足「旧语义 git show 为空集且 first-parent 非空」——
|
|
9
|
+
// 实现被改回 git show 时两条语义重合、pinned 归零,B 即红。
|
|
10
|
+
// 用法:node .agents/scripts/check-loop-rev-semantics.mjs [样本数,默认 12];
|
|
11
|
+
// check-loop FULL 模式(本地手动审计)末尾自动调用。手动工具:不占 verify 门表(16 门不变)、不进 CI。
|
|
12
|
+
import { spawnSync } from 'node:child_process';
|
|
13
|
+
|
|
14
|
+
const SAMPLES = Math.max(1, Number(process.argv[2] || 12));
|
|
15
|
+
const git = (args) => {
|
|
16
|
+
const r = spawnSync('git', args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
17
|
+
return r.status === 0 ? r.stdout : null;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const head = git(['rev-parse', '--verify', 'HEAD']);
|
|
21
|
+
if (!head) {
|
|
22
|
+
console.log('[rev-semantics] 不在 git 仓库内或无 HEAD——跳过(fail-open)');
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
const merges = (git(['rev-list', '--merges', '-n', String(SAMPLES), 'HEAD']) || '')
|
|
26
|
+
.split(/\r?\n/).filter(Boolean);
|
|
27
|
+
if (!merges.length) {
|
|
28
|
+
console.log('[rev-semantics] 仓内无合并提交样本——跳过(exit 0)');
|
|
29
|
+
process.exit(0);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let equivFails = 0;
|
|
33
|
+
let pinned = 0;
|
|
34
|
+
for (const rev of merges) {
|
|
35
|
+
const legacy = git(['show', '--name-only', '--format=', '--no-renames', rev]) ?? '';
|
|
36
|
+
const fp = git(['diff', '--name-only', '--no-renames', `${rev}^1`, rev]) ?? '';
|
|
37
|
+
const showM = git(['show', '-m', '--name-only', '--format=', '--no-renames', rev]) ?? '';
|
|
38
|
+
const fpLines = fp.split(/\r?\n/).filter(Boolean);
|
|
39
|
+
const showMLines = new Set(showM.split(/\r?\n/).filter(Boolean));
|
|
40
|
+
const outside = fpLines.filter((f) => !showMLines.has(f));
|
|
41
|
+
if (outside.length) {
|
|
42
|
+
equivFails++;
|
|
43
|
+
console.error(`FAIL ${rev.slice(0, 10)} first-parent 有 ${outside.length} 个文件不在 show -m 并集中(例:${outside[0]})`);
|
|
44
|
+
}
|
|
45
|
+
// 旧语义空集而现行非空 = 「合并必须取全文件面」语义的实际命中
|
|
46
|
+
const legacyEmpty = !legacy.split(/\r?\n/).filter(Boolean).length;
|
|
47
|
+
if (legacyEmpty && fpLines.length) pinned++;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
console.log(`[rev-semantics] 合并样本 ${merges.length}|等价性违例 ${equivFails}|退化钉子命中 ${pinned}`);
|
|
51
|
+
if (equivFails > 0) {
|
|
52
|
+
console.error('[rev-semantics] FAIL——first-parent 实现与 show -m 并集不等价,REV 面取面逻辑有误');
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
if (pinned === 0) {
|
|
56
|
+
console.error('[rev-semantics] FAIL——全部样本「git show 空」与「first-parent 非空」不再分化,REV 面实现疑似退化为 git show(P0-A 复发)');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
console.log('[rev-semantics] PASS');
|