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,737 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// confirm-doc — 用户确认门(2026-09-26 confirm-gate-machine;2026-09-27 confirm-gate-delegated 加委托代录形态;同日 gate-coverage 收 incidents;同日 closing-coverage 加放弃态 --to)
|
|
3
|
+
// 唯一确认入口:workflow/{intents,specs,plans} 文档(draft→approved 起草确认 / approved→done 关单确认)
|
|
4
|
+
// 与 workflow/incidents 文档(open→fixed 修复落地确认 / fixed→closed 关单确认——不支持 open→closed 单跳,
|
|
5
|
+
// 强制两跳留痕;2026-09-28 起 check-loop 15 对账)。放弃态走显式 `--to`(closing-coverage):
|
|
6
|
+
// --to cancelled 自 draft/approved/open/fixed(未确认过的东西谈不上被取代);--to superseded 自
|
|
7
|
+
// approved/done/fixed/closed(已确认/闭环的结论被新档取代)。check-loop 检查 15 按「确认指纹 + 台账配对」
|
|
8
|
+
// 对账(四终态另做内容绑定),无记录即 hard-block。
|
|
9
|
+
// 两形态:
|
|
10
|
+
// ① TTY 模式(默认):用户终端亲手运行、逐份过目全文、逐份键入「可以」——非交互环境直接拒绝
|
|
11
|
+
// (AI 会话的 spawnSync 无 TTY,本形态在 AI 手里跑不起来)。
|
|
12
|
+
// ② 委托代录模式(--delegated "<用户对话原话>",2026-09-27):用户已在对话中明确放行后,AI 代为
|
|
13
|
+
// 落态记账——免 TTY、免逐份问答,但台账行如实记 source:"chat-delegated" + quote:<原话>,
|
|
14
|
+
// 永不伪装 TTY 行。调用纪律(AI 须先取得用户对话内明确确认)由 AGENTS.md 确认门条款承载,
|
|
15
|
+
// quote 原话入账供事后对质。
|
|
16
|
+
// 台账:.agents/confirmations.d/<doc 基名>.jsonl 分片(入 git、追加式;2026-10-12 起为默认写入口径,
|
|
17
|
+
// --no-shard / CONFIRM_SHARDED=0 可回退主台账 .agents/confirmations.jsonl)——每行 {ts, doc, stage,
|
|
18
|
+
// fingerprint(64位), prev, source:"tty"|"chat-delegated", quote?(仅委托行), batch, seq, of}。
|
|
19
|
+
// 分片按 doc 命名:跨端确认不同 doc 写不同文件,从根上消除「每合并必冲突 + 手工重建」;同一 doc 被
|
|
20
|
+
// 两端并发确认时由 .gitattributes 的 merge=jsonl-union 驱动取并集(本地须配 merge.jsonl-union.driver,
|
|
21
|
+
// 见 check-local-gates.mjs --fix)。读取侧(check-loop 15/19、stage-gates、gen-workflow-metrics 等)
|
|
22
|
+
// 经 ledger-loader 统一视图透明合并主台账 + 全部分片,写侧改动对它们无感。
|
|
23
|
+
// batch/seq/of(batch-ledger-audit 新增,纯增字段、向后兼容、历史行不回填):
|
|
24
|
+
// 记「本次进程调用落了几份态」这一**写入时确定已知的事实**——batch 为本次调用生成的短随机串
|
|
25
|
+
// (无时间语义、无全局唯一要求,仅需单台账内不碰撞),seq 为该次调用内件序(从 1),of 为本次
|
|
26
|
+
// 调用总份数。check-loop 检查 15 的并录审计据此直读事实判定,不再从 quote 相等 + ts 接近反推
|
|
27
|
+
// (旧判据可被「换 quote」平凡规避、且合规逐件复用同句必然误报——见同名 incident)。
|
|
28
|
+
// 指纹:内容 CRLF 归一 → 剔除「确认指纹:」行(防自引用)→ sha256;frontmatter 存前 16 位,台账存全量。
|
|
29
|
+
// 用法:node .agents/scripts/confirm-doc.mjs <workflow/intents|x.md> [<doc2>...] [--root <仓库根>]
|
|
30
|
+
// node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<用户对话原话>"(委托代录)
|
|
31
|
+
// node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<原话>" --batch(协作道批量:L1 多份一次代录)
|
|
32
|
+
// node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<原话>" --strict-quote(引文接地收硬:不成立即拒)
|
|
33
|
+
// node .agents/scripts/confirm-doc.mjs <doc...> --to superseded|cancelled(放弃态:取代/取消,留指纹与台账)
|
|
34
|
+
// node .agents/scripts/confirm-doc.mjs <doc...> --reconfirm --delegated "<原话>"(重新确认:approved 档承诺面
|
|
35
|
+
// 被改写后用户重新点头——不推进状态,只重录指纹 + 承诺面指纹;状态行仍由本脚本写,无需手改 frontmatter)
|
|
36
|
+
// 台账写入形态:默认分片 .agents/confirmations.d/<doc>.jsonl;--no-shard 或 CONFIRM_SHARDED=0 写主台账
|
|
37
|
+
// 多文档一次传入:TTY 模式天然逐份过目键入;--delegated 默认一次仅一份(2026-09-27
|
|
38
|
+
// confirm-gate-one-per-call:多份并录曾系统性塌掉 stages.md Build 章「逐件确认」三道门),L1 协作道可
|
|
39
|
+
// `--batch` 多份一次代录(hybrid-governance-risk-lanes):逐份读「级别」,L2/L3 逐份拒绝
|
|
40
|
+
// (防御道不批量);台账行带 `brief:true` 简洁审计标记(quote 原话仍入账供对质),check-loop 检查 15
|
|
41
|
+
// 并录审计对全行带标记的批次豁免「确认并录」告警。--auto 一次仍仅一份(自治放行不批量)。
|
|
42
|
+
// 逐阶段前置门(stage-gate-machine):specs/plans 的 draft→approved 须同主题入口已确认
|
|
43
|
+
// (plan 另须入口级别 L2/L3 时同名 spec 已确认;判定口径见 stage-gates.mjs)——未过拒绝落账:
|
|
44
|
+
// 不写盘、不 append 台账、该份计为「拒绝」,任一被拒进程 exit 2。
|
|
45
|
+
// 测试面已随引擎减重退役(2026-10-28,owner 决策),本脚本现无测试兜底
|
|
46
|
+
import fs from 'node:fs';
|
|
47
|
+
import path from 'node:path';
|
|
48
|
+
import readline from 'node:readline';
|
|
49
|
+
import { execFileSync } from 'node:child_process';
|
|
50
|
+
import { createHash, randomBytes } from 'node:crypto';
|
|
51
|
+
import { fileURLToPath } from 'node:url';
|
|
52
|
+
import { confirmGateFor, doneGateFor, acceptanceEvidenceGate, incidentTrioGate, laneOfDoc, specConfirmed, planConfirmedFor, reviewLineFor, commitmentFingerprint } from './stage-gates.mjs';
|
|
53
|
+
import { loadKitPolicy, latestFreshVerifyLine } from './policy.mjs';
|
|
54
|
+
import { groundQuote, resolveFamilyTexts, GROUND_ANCHOR_MIN } from './quote-grounding.mjs';
|
|
55
|
+
|
|
56
|
+
// freshVerify(root):返回 24h 窗口内最新绿行对象(判定单源 policy.latestFreshVerifyLine)。只读,
|
|
57
|
+
// 台账缺失/不可读一律 null(=无凭证,advisory 层 fail-open)。返回对象而非布尔是为了比对绿行的
|
|
58
|
+
// 业务脏路径快照(「verify 之后又改了业务代码」)。
|
|
59
|
+
function freshVerify(root) {
|
|
60
|
+
try {
|
|
61
|
+
const p = path.join(root, '.agents', 'verifications.jsonl');
|
|
62
|
+
if (!fs.existsSync(p)) return null;
|
|
63
|
+
return latestFreshVerifyLine(fs.readFileSync(p, 'utf8').split(/\r?\n/));
|
|
64
|
+
} catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// businessDirty(root):当前 git status 的业务路径(backend/ frontend/)。关单期 workflow/.agents
|
|
70
|
+
// 文档改动合法,不纳入;绿行之后新出现的业务脏路径 = 凭证过期(closeout-skill-hardening 2026-11-08)。
|
|
71
|
+
function businessDirty(root) {
|
|
72
|
+
try {
|
|
73
|
+
return String(execFileSync('git', ['status', '--porcelain'], { cwd: root, encoding: 'utf8' }))
|
|
74
|
+
.split(/\r?\n/)
|
|
75
|
+
.map((l) => l.slice(3).split(' -> ').pop().trim().replace(/^"|"$/g, '').replace(/\\/g, '/'))
|
|
76
|
+
.filter((p) => /^(backend|frontend)\//.test(p));
|
|
77
|
+
} catch {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// computeFingerprint(text):CRLF 归一 → 剔指纹行 → sha256 hex(64 位)
|
|
83
|
+
export function computeFingerprint(text) {
|
|
84
|
+
const norm = String(text).replace(/\r\n/g, '\n').split('\n')
|
|
85
|
+
.filter((l) => !/^确认指纹:/.test(l))
|
|
86
|
+
.join('\n');
|
|
87
|
+
return createHash('sha256').update(norm, 'utf8').digest('hex');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// nextStage(status):唯一合法前向跳转(docs 两跳 + incidents 两跳);其余(done/closed/superseded/cancelled/缺失)返回 null
|
|
91
|
+
export function nextStage(status) {
|
|
92
|
+
if (status === 'draft') return 'approved';
|
|
93
|
+
if (status === 'approved') return 'done';
|
|
94
|
+
if (status === 'open') return 'fixed'; // incidents:修复落地确认(三件套全落地)
|
|
95
|
+
if (status === 'fixed') return 'closed'; // incidents:关单确认(防复发验证已落地)
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// 放弃态跳转表(closing-coverage):cancelled 自未确认/进行态,superseded 自已确认态——
|
|
100
|
+
// draft/open 未被确认过,谈不上「被取代」,只能 cancelled;终态间仅允许 done/closed→superseded(结论被新档取代),其余互跳拒绝
|
|
101
|
+
const CANCELLABLE = new Set(['draft', 'approved', 'open', 'fixed']);
|
|
102
|
+
const SUPERSEDABLE = new Set(['approved', 'done', 'fixed', 'closed']);
|
|
103
|
+
export const ABANDON_TARGETS = ['superseded', 'cancelled'];
|
|
104
|
+
|
|
105
|
+
// resolveTransition(status, to):带 --to 目标的跳转裁决(pure)。to 为空 = 默认前向(nextStage);
|
|
106
|
+
// to ∈ {superseded, cancelled} 按上表判合法性;其余值或非法组合返回 null
|
|
107
|
+
export function resolveTransition(status, to) {
|
|
108
|
+
if (!to) return nextStage(status);
|
|
109
|
+
if (to === 'cancelled') return CANCELLABLE.has(status) ? 'cancelled' : null;
|
|
110
|
+
if (to === 'superseded') return SUPERSEDABLE.has(status) ? 'superseded' : null;
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// applyTransition(text, targetStage, fingerprint16):frontmatter 内只改「状态:」行值 + 增/换「确认指纹:」行,
|
|
115
|
+
// 其余字节原样保留;无 frontmatter(首行非 ---)或未闭合 → 返回 null(调用方跳过不写)
|
|
116
|
+
export function applyTransition(text, targetStage, fingerprint16) {
|
|
117
|
+
const lines = String(text).replace(/\r\n/g, '\n').split('\n');
|
|
118
|
+
if (!/^---\s*$/.test(lines[0] || '')) return null;
|
|
119
|
+
let end = -1;
|
|
120
|
+
for (let i = 1; i < lines.length; i++) {
|
|
121
|
+
if (/^---\s*$/.test(lines[i])) { end = i; break; }
|
|
122
|
+
}
|
|
123
|
+
if (end === -1) return null;
|
|
124
|
+
let hasStatus = false;
|
|
125
|
+
let hasFp = false;
|
|
126
|
+
for (let i = 1; i < end; i++) {
|
|
127
|
+
if (!hasStatus && /^状态:/.test(lines[i])) { lines[i] = `状态: ${targetStage}`; hasStatus = true; }
|
|
128
|
+
else if (!hasFp && /^确认指纹:/.test(lines[i])) { lines[i] = `确认指纹: ${fingerprint16}`; hasFp = true; }
|
|
129
|
+
}
|
|
130
|
+
const fm = lines.slice(1, end);
|
|
131
|
+
if (!hasStatus) fm.unshift(`状态: ${targetStage}`); // 防御:无状态键本应被 nextStage 拦,不至此
|
|
132
|
+
if (!hasFp) fm.push(`确认指纹: ${fingerprint16}`);
|
|
133
|
+
return [lines[0], ...fm, ...lines.slice(end)].join('\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
import { writeConfirmation, loadAllConfirmations } from './ledger-loader.mjs';
|
|
137
|
+
import { delegationRowsOf, rowCovers } from './delegation-presence.mjs';
|
|
138
|
+
|
|
139
|
+
// appendLedger(root, entry, opts):追加一行 JSON(默认写 .agents/confirmations.d/<doc>.jsonl 分片;
|
|
140
|
+
// opts.shard === false 或 CONFIRM_SHARDED=0 时写主台账 .agents/confirmations.jsonl)
|
|
141
|
+
export function appendLedger(root, entry, opts = {}) {
|
|
142
|
+
const useShard = opts.shard !== undefined ? Boolean(opts.shard) : process.env.CONFIRM_SHARDED !== '0';
|
|
143
|
+
return writeConfirmation(root, entry, { shard: useShard });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const DOC_RE = /^workflow\/(intents|specs|plans|incidents)\/[^/]+\.md$/;
|
|
147
|
+
|
|
148
|
+
// fmLevel(nl):frontmatter「级别:」值(无 frontmatter / 无该键 → '')——AI 自治门与协作道批量门共用
|
|
149
|
+
export function fmLevel(nl) {
|
|
150
|
+
if (!/^---\s*$/.test(nl[0] || '')) return '';
|
|
151
|
+
for (let i = 1; i < nl.length && !/^---\s*$/.test(nl[i]); i++) {
|
|
152
|
+
const m = nl[i].match(/^级别:\s*(.*)$/);
|
|
153
|
+
if (m) return m[1].trim();
|
|
154
|
+
}
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const isMain = process.argv[1] && process.argv[1].endsWith('confirm-doc.mjs');
|
|
159
|
+
if (isMain) {
|
|
160
|
+
const argv = process.argv.slice(2);
|
|
161
|
+
let root = process.cwd();
|
|
162
|
+
let delegatedQuote = null; // null = TTY 模式;字符串 = 委托代录的用户对话原话
|
|
163
|
+
let toTarget = null; // null = 默认前向跳转;superseded|cancelled = 放弃态显式目标
|
|
164
|
+
let autoMode = false; // AI 自治模式(信任等级授权,2026-09-30 ai-autonomy-trust)
|
|
165
|
+
let batchMode = false; // 协作道批量代录(--batch,2026-09-30 hybrid-governance-risk-lanes:仅 --delegated + L1)
|
|
166
|
+
let strictQuote = false; // 引文接地收硬(--strict-quote):接地不成立即拒绝落账(默认 advisory)
|
|
167
|
+
let reconfirmMode = false; // 重新确认(--reconfirm):approved 档承诺面被改写后用户重新点头——不推进状态,只重录指纹
|
|
168
|
+
// 分片台账为默认写入口径(ledger-shard-default):确认行进 .agents/confirmations.d/<doc 基名>.jsonl,
|
|
169
|
+
// 跨端/跨 worktree 确认不同 doc 时写不同文件,从根上消除「每合并必冲突 + 手工重建仪式」;
|
|
170
|
+
// 同一 doc 被两端并发确认时由 .gitattributes 的 merge=jsonl-union 驱动取并集。
|
|
171
|
+
// 退出形态:--no-shard 或 CONFIRM_SHARDED=0 写主台账 .agents/confirmations.jsonl(批量归并/排障用)。
|
|
172
|
+
let shardMode = process.env.CONFIRM_SHARDED !== '0';
|
|
173
|
+
const docs = [];
|
|
174
|
+
for (let i = 0; i < argv.length; i++) {
|
|
175
|
+
if (argv[i] === '--root') root = path.resolve(argv[++i]);
|
|
176
|
+
else if (argv[i] === '--delegated') delegatedQuote = argv[++i] ?? '';
|
|
177
|
+
else if (argv[i] === '--to') toTarget = argv[++i] ?? '';
|
|
178
|
+
else if (argv[i] === '--auto') autoMode = true;
|
|
179
|
+
else if (argv[i] === '--batch') batchMode = true;
|
|
180
|
+
else if (argv[i] === '--strict-quote') strictQuote = true;
|
|
181
|
+
else if (argv[i] === '--reconfirm') reconfirmMode = true;
|
|
182
|
+
else if (argv[i] === '--shard') shardMode = true;
|
|
183
|
+
else if (argv[i] === '--no-shard') shardMode = false;
|
|
184
|
+
else docs.push(argv[i].replace(/\\/g, '/'));
|
|
185
|
+
}
|
|
186
|
+
if (argv.includes('--shard') && argv.includes('--no-shard')) {
|
|
187
|
+
console.error('用法:--shard 与 --no-shard 互斥——分片已是默认写入口径,显式回退主台账只需 --no-shard');
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
if (toTarget !== null && !ABANDON_TARGETS.includes(toTarget)) {
|
|
191
|
+
console.error(`用法:--to 仅接受 superseded|cancelled(现「${toTarget}」)——cancelled 自 draft/approved/open/fixed;superseded 自 approved/done/fixed/closed(未确认态只能 cancelled;终态间仅允许 done/closed→superseded)`);
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
194
|
+
const delegated = delegatedQuote !== null;
|
|
195
|
+
if (delegated && autoMode) {
|
|
196
|
+
console.error('❌ --auto 与 --delegated 互斥:自治模式是用户预先授权的机器放行,委托代录是单次对话确认');
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
if (reconfirmMode && toTarget) {
|
|
200
|
+
console.error('❌ --reconfirm 与 --to 互斥:重新确认不推进状态(approved 仍为 approved),只重录指纹 + 承诺面指纹');
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
if (reconfirmMode && !delegated) {
|
|
204
|
+
console.error('❌ --reconfirm 须配 --delegated "<用户对话原话>":重新确认是用户对改写后承诺的重新点头,不得静默发生');
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
if (batchMode && autoMode) {
|
|
208
|
+
console.error('❌ --batch 与 --auto 互斥:批量代录是协作道的对话委托形态,自治放行不批量(一次一份)');
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
if (batchMode && toTarget) {
|
|
212
|
+
console.error('❌ --batch 不支持 --to 放弃态——放弃须逐份显式确认,不批量');
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
// AI 自治门(ai-autonomy-trust;hybrid-governance-explore-hardening 加隐式形态):
|
|
216
|
+
// 读 .agents/trust-mode.json。除显式 --auto 外,Trusted(level=2)下的非 TTY 单份调用在 TTY 门处
|
|
217
|
+
// 免旗标自动转入本分支(见「Trusted 自动泳道」)——L1 门 / incidents 排除 / 逐阶段与 done 门照常执行。
|
|
218
|
+
let trustConfig = null;
|
|
219
|
+
if (autoMode) {
|
|
220
|
+
try {
|
|
221
|
+
trustConfig = JSON.parse(fs.readFileSync(path.join(root, '.agents', 'trust-mode.json'), 'utf8'));
|
|
222
|
+
} catch { trustConfig = { enabled: false, level: 0 }; }
|
|
223
|
+
if (!trustConfig.enabled || ![1, 2].includes(trustConfig.level)) {
|
|
224
|
+
console.error('❌ AI 自治未开启或等级非法(.agents/trust-mode.json enabled=false 或 level∉[1,2])——跑 node .agents/scripts/trust-mode.mjs --enable --level <1|2> 开启');
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
if (toTarget) {
|
|
228
|
+
console.error('❌ AI 自治模式不支持 --to 放弃态(放弃态必须由用户显式确认)');
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
if (docs.length > 1) {
|
|
232
|
+
console.error('❌ AI 自治模式一次仅接受一份文档(与 --delegated 同口径,逐件放行)');
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
console.error(`⚠️ AI 自治模式(Trust L${trustConfig.level}):仅限 L1 文档;Level 1 只放行 draft→approved,Level 2 放行至 done`);
|
|
236
|
+
}
|
|
237
|
+
if (delegated && !String(delegatedQuote).trim()) {
|
|
238
|
+
console.error('用法:--delegated 须带用户对话原话(node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<用户原话>")——原话入台账供事后对质,不可缺省');
|
|
239
|
+
process.exit(1);
|
|
240
|
+
}
|
|
241
|
+
// TTY 门(仅 TTY 模式;先于文档参数校验):AI 会话内非委托调用一律拒绝
|
|
242
|
+
// CONFIRM_DOC_TEST_TTY:**仅测试用**逃生门——本测试环境无 TTY,而 TTY 多文档分支
|
|
243
|
+
// (batch 相同 / seq 递增 / of=N)是并录审计的判别基础,必须可测(复核 P2-2)。
|
|
244
|
+
// 双条件(check16-inline-debt):须同时 NODE_ENV === 'test' 才放行——单看
|
|
245
|
+
// 「TEST」字样的变量名不构成机器约束,AI 会话可能「顺手」在生产路径设置它绕过 TTY 门;
|
|
246
|
+
// 加 NODE_ENV 双条件后,生产路径(不设 NODE_ENV=test)即便误设 CONFIRM_DOC_TEST_TTY 也不生效。
|
|
247
|
+
// **信任边界声明(沿 check8-git-anchor 口径)**:本地信任边界内不可机器防——环境变量终究可被
|
|
248
|
+
// 本机进程任意设置,刻意伪造 `NODE_ENV=test CONFIRM_DOC_TEST_TTY=1` 仍可绕过,与伪造 git 时间戳 /
|
|
249
|
+
// 手改台账同属事后对质(git 历史与台账)兜底的范畴;此处只把「顺手设置单变量」的成本抬到
|
|
250
|
+
// 「主动伪造双变量组合」,不宣称「通道已关闭」。
|
|
251
|
+
// 两变量只影响 isTTY 判定,不改动任何落态/记账语义;生产路径不设置这两个变量。
|
|
252
|
+
const ttyForced = process.env.CONFIRM_DOC_TEST_TTY === '1' && process.env.NODE_ENV === 'test';
|
|
253
|
+
if (!delegated && !autoMode && !ttyForced && (!process.stdin.isTTY || !process.stdout.isTTY)) {
|
|
254
|
+
// Trusted 自动泳道(hybrid-governance-explore-hardening):trust-mode.json 为 Trusted
|
|
255
|
+
// (enabled 且 level=2)时,非 TTY 调用(AI 会话)对文档**免手工触发**(无需 --delegated 原话 /
|
|
256
|
+
// --auto 旗标)自动转入 AI 自治放行——单份、非放弃态才可隐式(与 --auto 同口径,L1 门与
|
|
257
|
+
// incidents 排除由主循环自治门照常执行);不满足则维持原拒绝(fail-closed,Standard/Strict 不隐式)。
|
|
258
|
+
let implicitTrust = null;
|
|
259
|
+
try {
|
|
260
|
+
implicitTrust = JSON.parse(fs.readFileSync(path.join(root, '.agents', 'trust-mode.json'), 'utf8'));
|
|
261
|
+
} catch { implicitTrust = { enabled: false, level: 0 }; }
|
|
262
|
+
if (implicitTrust.enabled && implicitTrust.level === 2 && docs.length === 1 && !toTarget) {
|
|
263
|
+
autoMode = true;
|
|
264
|
+
trustConfig = implicitTrust; // 主循环自治门(L1 与 incidents 排除)直读本配置——顶部 if (autoMode) 块先于 TTY 门执行,须在此补装
|
|
265
|
+
console.error('⚠️ Trusted 自动泳道(隐式):单份 L1 文档按 AI 自治放行(Level 2 全闭环,台账 source=ai-auto-trust-L2);L2/L3 与 incidents 仍须人工确认');
|
|
266
|
+
} else {
|
|
267
|
+
console.error('确认门须由用户在终端亲手运行(node .agents/scripts/confirm-doc.mjs <workflow/文档>...)——AI 会话内不可代确认;用户对话内明确确认后可用 --delegated "<用户原话>" 委托代录(台账如实记来源)');
|
|
268
|
+
process.exit(1);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (!docs.length) {
|
|
272
|
+
console.error('用法:node .agents/scripts/confirm-doc.mjs <workflow/intents|specs|plans/x.md> [...] [--root <仓库根>] [--delegated "<用户原话>" [--batch]]');
|
|
273
|
+
process.exit(1);
|
|
274
|
+
}
|
|
275
|
+
if (delegated) {
|
|
276
|
+
console.error('⚠️ 委托代录模式:确认语义 = 用户已在对话中明确放行;台账行将如实记 source=chat-delegated 与原话,不伪装 TTY 确认');
|
|
277
|
+
console.error(` 用户原话:「${delegatedQuote}」`);
|
|
278
|
+
// 单文档默认(confirm-gate-one-per-call):delegated 没有TTY「逐份过目」的天然机制——
|
|
279
|
+
// 多文档并录曾系统性塌掉三道阶段门(stages.md Build 章「逐件确认不得并作一次」)。逐件调用:一次一份、
|
|
280
|
+
// 每次带当次用户原话。TTY 形态不受限(用户亲手逐份过目键入,天然逐件)。
|
|
281
|
+
// 协作道批量(hybrid-governance-risk-lanes):L1 可 `--batch` 多份一次代录——
|
|
282
|
+
// 逐份读「级别」,L2/L3 逐份拒绝(见主循环协作道门);台账行带 brief:true,检查 15 据此豁免并录告警。
|
|
283
|
+
if (docs.length > 1) {
|
|
284
|
+
if (!batchMode) {
|
|
285
|
+
console.error(`❌ --delegated 一次仅接受一份文档(现 ${docs.length} 份:${docs.join(' ')})——逐件确认口径(stages.md Build 章):每份一次调用、每次带当次用户原话;L1 协作道批量可加 --batch`);
|
|
286
|
+
process.exit(1);
|
|
287
|
+
}
|
|
288
|
+
console.error(` 批量代录(--batch):${docs.length} 份,仅受理 L1(协作道,异步审计兜底);L2/L3 逐份拒绝`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// 调用事实(batch-ledger-audit):本次进程调用的批次标识与件序——
|
|
292
|
+
// 供 check-loop 检查 15 的并录审计直读(替代「同 quote + ts 接近」的反推)。
|
|
293
|
+
const batch = randomBytes(3).toString('hex');
|
|
294
|
+
let seq = 1;
|
|
295
|
+
// 应答来源(**仅测试用**注入,见 CONFIRM_DOC_TEST_ANSWERS):TTY 多文档路径的 batch/seq/of 是并录
|
|
296
|
+
// 审计的判别基础,必须可端到端验证;而 spawnSync 的管道 stdin 是「写完即关」,readline 会在第二个
|
|
297
|
+
// question 注册前吞掉后续行、且 stdin 已 EOF → 第 2 份必然挂住(**不是无 TTY 的限制**,是管道 EOF;
|
|
298
|
+
// 2026-09-28 复核 P2-2 更正:此前测试注释把根因误记为「管道输入不被逐次消费」)。
|
|
299
|
+
// 故提供问答注入:按序取预置应答,绕开 stdin/EOF 时序,不改动任何落态与记账语义。
|
|
300
|
+
const injected = process.env.CONFIRM_DOC_TEST_ANSWERS !== undefined
|
|
301
|
+
? String(process.env.CONFIRM_DOC_TEST_ANSWERS).split(',').map((s) => s.trim())
|
|
302
|
+
: null;
|
|
303
|
+
const rl = delegated || injected ? null : readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
304
|
+
const ask = (q) => new Promise((res) => {
|
|
305
|
+
if (injected) {
|
|
306
|
+
process.stdout.write(q);
|
|
307
|
+
return res(injected.shift() ?? '');
|
|
308
|
+
}
|
|
309
|
+
return rl.question(q, res);
|
|
310
|
+
});
|
|
311
|
+
let confirmed = 0;
|
|
312
|
+
let refused = 0; // 逐阶段前置门拒绝数(exit 2 信号;2026-09-30 stage-gate-machine)
|
|
313
|
+
const famCache = new Map(); // 引文接地的同名家族正文缓存(一次调用内同一 doc 只读一次)
|
|
314
|
+
for (const doc of docs) {
|
|
315
|
+
if (!DOC_RE.test(doc)) {
|
|
316
|
+
console.error(`跳过 ${doc}:路径须匹配 workflow/{intents,specs,plans,incidents}/<文件>.md`);
|
|
317
|
+
continue;
|
|
318
|
+
}
|
|
319
|
+
const abs = path.join(root, doc);
|
|
320
|
+
let text;
|
|
321
|
+
try { text = fs.readFileSync(abs, 'utf8'); }
|
|
322
|
+
catch { console.error(`跳过 ${doc}:文件不可读`); continue; }
|
|
323
|
+
// 状态键只在 frontmatter 区(首 --- 至闭合 ---)取——防正文误命中
|
|
324
|
+
const nl = text.replace(/\r\n/g, '\n').split('\n');
|
|
325
|
+
let st = '';
|
|
326
|
+
if (/^---\s*$/.test(nl[0] || '')) {
|
|
327
|
+
for (let i = 1; i < nl.length && !/^---\s*$/.test(nl[i]); i++) {
|
|
328
|
+
const m = nl[i].match(/^状态:\s*(.*)$/);
|
|
329
|
+
if (m) { st = m[1].trim(); break; }
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const target = resolveTransition(st, toTarget);
|
|
333
|
+
const lvl = fmLevel(nl); // 级别(AI 自治门 / 协作道批量门共用;缺 = '')
|
|
334
|
+
// 泳道单源 laneOfDoc(2026-10-10 收敛系列 2 起级别单字段协议,原 risk_level 双字段退役,见机制
|
|
335
|
+
// 台账):suspect(缺失/非法)按 high——--auto 与 --batch 均不受理,须先补「级别」。
|
|
336
|
+
const fmOf = (key) => {
|
|
337
|
+
const m = nl.find((l) => l.startsWith(`${key}:`));
|
|
338
|
+
return m ? m.slice(key.length + 1).trim() : '';
|
|
339
|
+
};
|
|
340
|
+
const lane = laneOfDoc(lvl);
|
|
341
|
+
// 重新确认(--reconfirm,approved-content-binding 2026-10-27):approved 档承诺面被改写后,
|
|
342
|
+
// 用户重新点头的通道——不推进状态,只重录内容指纹 + 承诺面指纹。状态行仍由本脚本写(不需手改
|
|
343
|
+
// frontmatter),台账追加一行 stage=approved(新指纹)→ 检查 15 的承诺面绑定以该行为准。
|
|
344
|
+
if (reconfirmMode) {
|
|
345
|
+
if (st !== 'approved') {
|
|
346
|
+
console.error(`❌ ${doc} 未过重新确认前置:--reconfirm 仅受理当前状态为 approved 的文档(现「${st || '缺失'}」)`);
|
|
347
|
+
console.error(' 重新确认 = 承诺面被改写后用户重新点头;状态推进(draft→approved→done)走默认前向或 --to(本份未落账、未写盘)');
|
|
348
|
+
refused++;
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
if (!famCache.has(doc)) famCache.set(doc, resolveFamilyTexts(root, doc));
|
|
352
|
+
const grounding = groundQuote({
|
|
353
|
+
quote: delegatedQuote, docText: text, familyTexts: famCache.get(doc),
|
|
354
|
+
});
|
|
355
|
+
if (!grounding.ok) {
|
|
356
|
+
const detail = `引文接地未成立(${grounding.reason}):残余「${grounding.residual}」在 ${doc} 及同名家族里找不到落点(最长逐字锚点 ${grounding.anchor} 字 < ${GROUND_ANCHOR_MIN})`;
|
|
357
|
+
if (strictQuote) {
|
|
358
|
+
console.error(`❌ ${doc} ${detail}`);
|
|
359
|
+
console.error(' --strict-quote 已开启:本份未落账、未写盘——换一句能指涉该文档内容的原话,或去掉该开关走 advisory');
|
|
360
|
+
refused++;
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
console.error(`⚠️ ${doc} ${detail}——advisory 放行,台账行进记 quoteGrounding=${grounding.reason} 供事后对质`);
|
|
364
|
+
}
|
|
365
|
+
const rfp = computeFingerprint(text);
|
|
366
|
+
const rcommit = commitmentFingerprint(text);
|
|
367
|
+
const rtext = applyTransition(text, 'approved', rfp.slice(0, 16));
|
|
368
|
+
if (!rtext) {
|
|
369
|
+
console.error(`❌ ${doc} 重新确认失败:无 frontmatter(首行非 ---)——状态行只由本脚本写,不手改文件`);
|
|
370
|
+
refused++;
|
|
371
|
+
continue;
|
|
372
|
+
}
|
|
373
|
+
fs.writeFileSync(abs, rtext);
|
|
374
|
+
appendLedger(root, {
|
|
375
|
+
ts: new Date().toISOString(), doc, stage: 'approved', fingerprint: rfp, prev: st,
|
|
376
|
+
commit: rcommit,
|
|
377
|
+
source: 'chat-delegated', quote: String(delegatedQuote),
|
|
378
|
+
quoteGrounding: grounding.reason,
|
|
379
|
+
batch, seq, of: docs.length,
|
|
380
|
+
reconfirm: true, // 重新确认标记(纯增字段、向后兼容):区别于首次批准行
|
|
381
|
+
}, { shard: shardMode });
|
|
382
|
+
console.log(`✓ ${doc} 重新确认(状态仍为 approved;内容指纹 ${rfp.slice(0, 16)},承诺面指纹 ${rcommit})`);
|
|
383
|
+
confirmed++;
|
|
384
|
+
seq++;
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (!target) {
|
|
388
|
+
console.error(`跳过 ${doc}:当前状态「${st || '缺失'}」无合法跳转(前向:docs draft→approved / approved→done;incidents open→fixed / fixed→closed;放弃 --to:cancelled 自 draft/approved/open/fixed,superseded 自 approved/done/fixed/closed)`);
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
// 逐阶段前置门(stage-gate-machine):specs/plans 的 draft→approved 须前置已确认
|
|
392
|
+
// (plan 另须入口级别 L2/L3 时同名 spec 已确认)——未过拒绝落账(不写盘、不 append 台账)。
|
|
393
|
+
if (target === 'approved' && (doc.startsWith('workflow/specs/') || doc.startsWith('workflow/plans/'))) {
|
|
394
|
+
const gate = confirmGateFor(root, doc);
|
|
395
|
+
if (!gate.ok) {
|
|
396
|
+
console.error(`❌ ${doc} 未过逐阶段前置门(stage-gates):${gate.reason}`);
|
|
397
|
+
console.error(` ${gate.hint}(本份未落账、未写盘)`);
|
|
398
|
+
refused++;
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
// done 前置门(confirm-gate-approved-history):→done 须 git 历史已留 approved 态
|
|
403
|
+
// (先 done 后提交 / 两跳同批提交 → 拒绝;防「确认态缺失」缺陷复发;判据单源见 stage-gates.doneGateFor)。
|
|
404
|
+
if (target === 'done') {
|
|
405
|
+
// L2/L3 intent 关单门(2026-10-21 P0-1 整改):L2/L3 intent 置 done 须同名 spec 已确认。
|
|
406
|
+
// 配对硬门已于 2026-10-21「门禁极小化第 1 批」降为 WARN(s01-pairing.mjs),
|
|
407
|
+
// 「L2/L3 无 spec」遂失去唯一机器兜底(review.md P0 必拦项声明的兜底已名存实亡)——
|
|
408
|
+
// 执法点前移到关单动作时刻(与 §14 approved 留痕降档同一思路:门退了,闭环不退)。
|
|
409
|
+
if (doc.startsWith('workflow/intents/') && (lvl === 'L2' || lvl === 'L3')) {
|
|
410
|
+
const base = path.basename(doc, '.md');
|
|
411
|
+
const sp = specConfirmed(root, base);
|
|
412
|
+
if (!sp.ok) {
|
|
413
|
+
console.error(`❌ ${doc} 未过 L2/L3 intent 关单门(同名 spec 必确认):${sp.reason}`);
|
|
414
|
+
console.error(' 先走 stages.md Design 章完成同名 spec 确认,再关本 intent(本份未落账、未写盘)');
|
|
415
|
+
refused++;
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
// 关单完成度(closeout-completeness 2026-10-24):同名 plan 已确认 + 独立复核落盘行。
|
|
419
|
+
// 此前两项只有 closeout skill §0 的流程内自核(s01 仅 WARN)——agent 跳过自核即可合规关单。
|
|
420
|
+
const pl = planConfirmedFor(root, base);
|
|
421
|
+
if (!pl.ok) {
|
|
422
|
+
console.error(`❌ ${doc} 未过 L2/L3 intent 关单门(同名 plan 必已确认):${pl.reason}`);
|
|
423
|
+
console.error(' 先走 stages.md Build 章完成同名 plan 并确认(approved),再关本 intent(本份未落账、未写盘)');
|
|
424
|
+
refused++;
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
const rv = reviewLineFor(root, base);
|
|
428
|
+
if (!rv.ok) {
|
|
429
|
+
console.error(`❌ ${doc} 未过 L2/L3 intent 关单门(独立复核缺失):${rv.reason}`);
|
|
430
|
+
console.error(' 回 stages.md Test §4 补独立复核,落盘行须含「复核上下文:<会话/子代理 id>」,再关(本份未落账、未写盘)');
|
|
431
|
+
refused++;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
const gate = doneGateFor(root, abs, doc);
|
|
436
|
+
if (!gate.ok) {
|
|
437
|
+
console.error(`❌ ${doc} 未过 done 前置门(approved 历史):${gate.reason}`);
|
|
438
|
+
console.error(` ${gate.hint}(本份未落账、未写盘)`);
|
|
439
|
+
refused++;
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
442
|
+
// 关单格式门(done-evidence-gate):关单是最后一次写入——验收节证据标注(intent /
|
|
443
|
+
// 独立 L1 plan)与「验收判据」表(L2/L3 spec)须落账前就位,否则 s08/s23 关单后 hard 只能重确认返工
|
|
444
|
+
// (判据单源见 stage-gates.acceptanceEvidenceGate)。
|
|
445
|
+
const evGate = acceptanceEvidenceGate(root, abs, doc);
|
|
446
|
+
if (!evGate.ok) {
|
|
447
|
+
console.error(`❌ ${doc} 未过关单格式门:${evGate.reason}`);
|
|
448
|
+
console.error(` ${evGate.hint}(本份未落账、未写盘)`);
|
|
449
|
+
refused++;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
// 委派台账在场门(2026-10-25 优化4:写入时拦截):L2/L3 新需求族 →done 须已有 delegations
|
|
453
|
+
// 台账行(委派表或自做表,「任务一句话」含文件名)。判据与检查 18 事后对账逐条一致(单源
|
|
454
|
+
// delegation-presence.rowCovers);豁免口径亦同检查 18:非 L2/L3(自做 L1 2026-10-21 起不记)、
|
|
455
|
+
// 日期缺失/非法、日期 < delegationSince 锚前存量、同名 incident 在场(修复族——记法「修复类不记」)。
|
|
456
|
+
// 此前该条件只在 check-loop --hygiene §18 事后 WARN——「该写而未写」漂移数月才可见,前移到
|
|
457
|
+
// 关单动作时刻当场拦(与 §14 approved 留痕降档后执法点前移同一思路:门退了,闭环不退)。
|
|
458
|
+
if ((lvl === 'L2' || lvl === 'L3')
|
|
459
|
+
&& (doc.startsWith('workflow/intents/') || doc.startsWith('workflow/specs/') || doc.startsWith('workflow/plans/'))) {
|
|
460
|
+
const base = path.basename(doc, '.md');
|
|
461
|
+
// 日期:frontmatter 优先,缺则回落文件名前缀——plan 无「日期」字段(fill-plan 不写、模板亦无),
|
|
462
|
+
// 旧判据「无日期即整段跳过」使本门对绝大多数 L2/L3 plan 静默失效(2026-10-27 实证 57 份
|
|
463
|
+
// 2026-10-06 锚后新建 L2/L3 文档因缺日期整体绕开本门)。沿检查 15 / 19 既有口径补文件名兜底。
|
|
464
|
+
const dDate = fmOf('日期') || (/^\d{4}-\d{2}-\d{2}$/.test(base.slice(0, 10)) ? base.slice(0, 10) : '');
|
|
465
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(dDate)) {
|
|
466
|
+
const since = loadKitPolicy(root).delegationSince;
|
|
467
|
+
if (typeof since !== 'string' || dDate >= since) {
|
|
468
|
+
if (!fs.existsSync(path.join(root, 'workflow', 'incidents', `${base}.md`))) {
|
|
469
|
+
if (!rowCovers(delegationRowsOf(root), base, dDate)) {
|
|
470
|
+
console.error(`❌ ${doc} 未过委派台账在场门:delegations 台账(主表∪分片)没有日期 ≥ ${dDate} 且含「${base}」的结果行`);
|
|
471
|
+
console.error(' 先落一行再关单(委派走「委派结果」节、自做走「自做任务结果」节,任务一句话含文件名):');
|
|
472
|
+
console.error(' node .agents/scripts/ledger-shards.mjs --append delegations --section <委派结果|自做任务结果> --row "| YYYY-MM-DD | … | 一次通过 | 备注 | 返工原因 |"');
|
|
473
|
+
console.error(' (判据与检查 18 对账一致;修复族与锚前存量豁免,记法见 workflow/delegations.md 头部)(本份未落账、未写盘)');
|
|
474
|
+
refused++;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
// 承诺面绑定门(approved-content-binding 2026-10-27):approved→done 前,承诺面须与「用户点头
|
|
482
|
+
// 那一刻」的承诺面一致——承诺(判据文本/红线/目标/改动方案)在确认后被改写而未重新点头,
|
|
483
|
+
// 用户点头的就不是关单时兑现的那一份。归一掉关单期合法动作(勾验收/证据回填/确认结果/复核行),
|
|
484
|
+
// 判据单源 = stage-gates.commitmentFingerprint。存量(本次上线前确认,台账无 commit 字段)不追溯。
|
|
485
|
+
const apprRows = loadAllConfirmations(root)
|
|
486
|
+
.filter((e) => e && e.doc === doc && e.stage === 'approved' && typeof e.commit === 'string');
|
|
487
|
+
if (apprRows.length) {
|
|
488
|
+
const fmFp = fmOf('确认指纹');
|
|
489
|
+
const byFp = fmFp ? apprRows.filter((e) => typeof e.fingerprint === 'string' && e.fingerprint.startsWith(fmFp)) : [];
|
|
490
|
+
const pool = byFp.length ? byFp : apprRows;
|
|
491
|
+
const lastAppr = pool[pool.length - 1];
|
|
492
|
+
const nowCommit = commitmentFingerprint(text);
|
|
493
|
+
if (nowCommit !== lastAppr.commit) {
|
|
494
|
+
console.error(`❌ ${doc} 未过承诺面绑定门:承诺面自 approved 确认后已被改写(承诺面指纹 ${lastAppr.commit} → ${nowCommit})——用户点头的不是关单时兑现的那一份`);
|
|
495
|
+
console.error(' ① 承诺确有变更 → 请用户重新点头后重录:node .agents/scripts/confirm-doc.mjs ' + doc + ' --reconfirm --delegated "<用户对话原话>"');
|
|
496
|
+
console.error(' ② 仅勾验收/补证据/复核行改动 → 不应触发本门(归一口径有漏,请登记 papercut)');
|
|
497
|
+
console.error(' (本份未落账、未写盘)');
|
|
498
|
+
refused++;
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
// 测试绿凭证前置(verify-evidence 立 advisory 灰度第一档;2026-10-09 AI-Native 架构审查
|
|
504
|
+
// 升灰度第二档):→done 且文档含「验收标准」节且 policy v5+(verifySince)→ 24h 窗口内须有
|
|
505
|
+
// verifications.jsonl 绿行(判定单源 policy.latestFreshVerifyLine,夹具 testCmd 行不算)。
|
|
506
|
+
// 绿行之后改动判定(closeout-skill-hardening 2026-11-08):24h 只看时间窗,判不出「跑门后又改
|
|
507
|
+
// 业务代码」。verify.mjs 全绿行落账时记 dirty(当时业务脏路径);当前业务脏路径出现绿行未见
|
|
508
|
+
// 的路径即判凭证过期。存量绿行(无 dirty 字段)跳过本判据(fail-open,与 v1–v7 advisory 同口径)。
|
|
509
|
+
// policy 带 verifyHardSince 锚且跳转日 ≥ 锚 → hard:无凭证/凭证过期即拒绝落账;锚日之前与缺键
|
|
510
|
+
// (v1–v7)逐字节维持原 advisory。CONFIRM_DOC_TEST_NOW 仅测试注入日期,生产不设=取当日。
|
|
511
|
+
if (target === 'done') {
|
|
512
|
+
const pol = loadKitPolicy(root);
|
|
513
|
+
if (typeof pol.verifySince === 'string' && /^##\s*[^#]*验收标准/m.test(text)) {
|
|
514
|
+
const row = freshVerify(root);
|
|
515
|
+
const stale = row && Array.isArray(row.dirty)
|
|
516
|
+
? businessDirty(root).filter((p) => !row.dirty.includes(p))
|
|
517
|
+
: [];
|
|
518
|
+
if (!row || stale.length) {
|
|
519
|
+
const today = (process.env.CONFIRM_DOC_TEST_NOW || new Date().toISOString()).slice(0, 10);
|
|
520
|
+
const hard = typeof pol.verifyHardSince === 'string' && today >= pol.verifyHardSince;
|
|
521
|
+
const cause = !row
|
|
522
|
+
? '24h 内无测试绿凭证(verifications.jsonl)——关单勾验的「测试绿」声明缺机器事实'
|
|
523
|
+
: `绿行之后业务路径又有改动(${stale.slice(0, 3).join('、')}${stale.length > 3 ? '…' : ''})——凭证已过期`;
|
|
524
|
+
console.error(`${hard ? '❌' : '⚠️'} ${doc} 置 done:${cause}`);
|
|
525
|
+
console.error(` 跑 node .agents/scripts/verify.mjs(全绿自动落账、刷新 dirty 快照)后重新关单;本次${hard ? '拒绝落账、不改盘(hard,灰度第二档:policy v8 verifyHardSince)' : '不拦截(advisory,灰度第一档)'}`);
|
|
526
|
+
if (hard) {
|
|
527
|
+
refused++;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
// incident 复盘三件套门(closeout-skill-hardening 2026-11-08):incidents →fixed/→closed 前
|
|
534
|
+
// 机器核三节与「是否需要新 intent」引用(判据单源 stage-gates.incidentTrioGate)。此前只靠
|
|
535
|
+
// closeout skill §0 第 2 项自核,跳过即可合规关单;存量豁免与锚见该函数。
|
|
536
|
+
if (doc.startsWith('workflow/incidents/') && (target === 'fixed' || target === 'closed')) {
|
|
537
|
+
const trio = incidentTrioGate(root, abs, doc);
|
|
538
|
+
if (!trio.ok) {
|
|
539
|
+
console.error(`❌ ${doc} 未过 incident 复盘三件套门:${trio.reason}`);
|
|
540
|
+
console.error(` ${trio.hint}(本份未落账、未写盘)`);
|
|
541
|
+
refused++;
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
// 活文档一致性前置门(2026-10-17 关单活文档门 A1):docs→done / incidents→closed 关单时,回归
|
|
546
|
+
// 清单引用的测试类/流程文档须仍存在(判定单源 check-regression-consistency.mjs)。独立复核反复
|
|
547
|
+
// 抓到「清单残留旧口径」这类债(规格内断言失效、被删测试仍被引用),却只在复核阶段可见——前移
|
|
548
|
+
// 到关单,让残留当场被拦,不进归档。弱档存在性(不猜语义);tmp 脚本因易失只 advisory 不拦。
|
|
549
|
+
if (target === 'done' || target === 'closed') {
|
|
550
|
+
try {
|
|
551
|
+
const { scanRegressionRefs } = await import('./check-regression-consistency.mjs');
|
|
552
|
+
const rr = scanRegressionRefs(root);
|
|
553
|
+
const dangling = [...rr.danglingClasses.map((c) => `测试类 ${c}`), ...rr.danglingDocs.map((d) => `流程文档 ${d}`)];
|
|
554
|
+
if (dangling.length) {
|
|
555
|
+
console.error(`❌ ${doc} 未过关单活文档一致性门:回归清单引用了不存在的资产(${dangling.length} 处)——`);
|
|
556
|
+
for (const d of dangling.slice(0, 10)) console.error(` - ${d}`);
|
|
557
|
+
if (dangling.length > 10) console.error(` … 另 ${dangling.length - 10} 处`);
|
|
558
|
+
console.error(' 处理:按回归清单维护规则 4 删除/改写过时条目,或恢复被误删的资产(本份未落账、未写盘)');
|
|
559
|
+
refused++;
|
|
560
|
+
continue;
|
|
561
|
+
}
|
|
562
|
+
} catch (err) {
|
|
563
|
+
console.error(`⚠️ ${doc} 活文档一致性检查执行失败(${err.message})——不拦截(fail-open),但须人工确认清单无残留`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const fp = computeFingerprint(text);
|
|
567
|
+
// 承诺面指纹(approved-content-binding 2026-10-27):与内容指纹并列落台账——内容指纹管「整篇逐字
|
|
568
|
+
// 未变」,承诺面指纹管「承诺(判据/红线/目标/改动方案)未变」,后者容许关单期合法动作(勾验收、
|
|
569
|
+
// 证据回填、确认结果/复核行)而拒承诺改写。判据单源 = stage-gates.commitmentFingerprint。
|
|
570
|
+
const commitFp = commitmentFingerprint(text);
|
|
571
|
+
// AI 自治放行分支(ai-autonomy-trust):
|
|
572
|
+
// ① 仅 L1(读 frontmatter「级别」,缺级别按不可自治处理——fail-closed);
|
|
573
|
+
// ② Level 1:仅 draft→approved;Level 2:draft→approved 与 approved→done;
|
|
574
|
+
// ③ incidents 永不自治(open→fixed/fixed→closed 必须人工)。
|
|
575
|
+
if (autoMode) {
|
|
576
|
+
const isLowLevel = lane === 'low';
|
|
577
|
+
const stageAllowed = trustConfig.level === 2
|
|
578
|
+
? (target === 'approved' || target === 'done')
|
|
579
|
+
: target === 'approved';
|
|
580
|
+
if (!isLowLevel || !stageAllowed || doc.startsWith('workflow/incidents/')) {
|
|
581
|
+
console.error(`❌ ${doc} 未过 AI 自治门(级别「${lvl || '缺失'}」/ 泳道「${lane}」/ 目标态「${target}」/ 类型):Level ${trustConfig.level} 仅授权泳道 low(intent 级别 L1;suspect 须先补「级别」)的 ${trustConfig.level === 2 ? 'approved/done' : 'approved'} 且不含 incidents`);
|
|
582
|
+
refused++;
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
586
|
+
appendLedger(root, {
|
|
587
|
+
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
588
|
+
commit: commitFp,
|
|
589
|
+
source: `ai-auto-trust-L${trustConfig.level}`, quote: `AI 自治放行 (Trust Level ${trustConfig.level})`,
|
|
590
|
+
batch, seq, of: docs.length,
|
|
591
|
+
}, { shard: shardMode });
|
|
592
|
+
console.log(`✓ ${doc} ${st} → ${target}(指纹 ${fp.slice(0, 16)},AI 自治已记账:source=ai-auto-trust-L${trustConfig.level})`);
|
|
593
|
+
confirmed++;
|
|
594
|
+
seq++;
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
if (delegated) {
|
|
598
|
+
// 协作道门(hybrid-governance-risk-lanes;caliber-convergence 起单源泳道):
|
|
599
|
+
// --batch 批量仅受理泳道 low(intent 级别 L1;suspect 拒)——high/suspect 逐份拒绝落账;
|
|
600
|
+
// 不带 --batch 的单份代录不限级别(既有口径不变)。
|
|
601
|
+
const low = lane === 'low';
|
|
602
|
+
if (batchMode && !low) {
|
|
603
|
+
console.error(`❌ ${doc} 泳道「${lane}」(级别「${lvl || '缺失'}」)不在协作道——--batch 批量代录仅限级别 L1;suspect(级别缺失/非法)须先补级别,L2/L3 防御道须逐份确认(本份未落账、未写盘)`);
|
|
604
|
+
refused++;
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
// 引文接地校验(delegated-quote-grounding,2026-10-22):quote 是「事后对质」的唯一证据,
|
|
608
|
+
// 先判它对目标文档有没有指涉。判据与实测取舍见 quote-grounding.mjs 头注——中文口语是复述
|
|
609
|
+
// 不是引用,词面判据无法在「误杀合规口语」与「放过误配」之间同时成立(K=8 误杀 L2/L3 17.9%,
|
|
610
|
+
// 且对无关文档仍通过 71.2%),故**默认 advisory**(WARN + 台账行记 quoteGrounding),
|
|
611
|
+
// 策略收硬走显式 --strict-quote。
|
|
612
|
+
if (!famCache.has(doc)) famCache.set(doc, resolveFamilyTexts(root, doc));
|
|
613
|
+
const grounding = groundQuote({
|
|
614
|
+
quote: delegatedQuote, docText: text, familyTexts: famCache.get(doc),
|
|
615
|
+
});
|
|
616
|
+
if (!grounding.ok) {
|
|
617
|
+
const detail = `引文接地未成立(${grounding.reason}):残余「${grounding.residual}」在 ${doc} 及同名家族里找不到落点(最长逐字锚点 ${grounding.anchor} 字 < ${GROUND_ANCHOR_MIN})`;
|
|
618
|
+
if (strictQuote) {
|
|
619
|
+
console.error(`❌ ${doc} ${detail}`);
|
|
620
|
+
console.error(' --strict-quote 已开启:本份未落账、未写盘——换一句能指涉该文档内容的原话,或去掉该开关走 advisory');
|
|
621
|
+
refused++;
|
|
622
|
+
continue;
|
|
623
|
+
}
|
|
624
|
+
console.error(`⚠️ ${doc} ${detail}——advisory 放行,台账行进记 quoteGrounding=${grounding.reason} 供事后对质`);
|
|
625
|
+
}
|
|
626
|
+
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
627
|
+
appendLedger(root, {
|
|
628
|
+
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
629
|
+
commit: commitFp,
|
|
630
|
+
source: 'chat-delegated', quote: String(delegatedQuote),
|
|
631
|
+
// 引文接地判据结果(delegated-quote-grounding):verbatim/anchor/generic = 接地成立;
|
|
632
|
+
// ungrounded = 找不到落点(默认仅 WARN,台账留痕供审计与趋势;--strict-quote 则上面已拒绝)
|
|
633
|
+
quoteGrounding: grounding.reason,
|
|
634
|
+
// 调用事实(batch-ledger-audit):seq=本次调用内件序(从 1),of=本次调用总份数
|
|
635
|
+
batch, seq, of: docs.length,
|
|
636
|
+
// 简洁审计标记(hybrid-governance-risk-lanes):L1 协作道行带 brief(quote 仍入账供对质),
|
|
637
|
+
// 检查 15 并录审计对全 brief 批次豁免「确认并录」告警
|
|
638
|
+
...(low ? { brief: true } : {}),
|
|
639
|
+
}, { shard: shardMode });
|
|
640
|
+
console.log(low
|
|
641
|
+
? `✓ ${doc} ${st} → ${target} [${lvl} 协作道/异步审计](指纹 ${fp.slice(0, 16)})`
|
|
642
|
+
: `✓ ${doc} ${st} → ${target}(指纹 ${fp.slice(0, 16)},代录已记账:source=chat-delegated)`);
|
|
643
|
+
confirmed++;
|
|
644
|
+
seq++;
|
|
645
|
+
continue;
|
|
646
|
+
}
|
|
647
|
+
console.log('\n'.repeat(3) + '='.repeat(72));
|
|
648
|
+
console.log(`文档:${doc} 状态:${st} → ${target} 指纹:${fp.slice(0, 16)}`);
|
|
649
|
+
console.log('='.repeat(72));
|
|
650
|
+
console.log(text);
|
|
651
|
+
console.log('='.repeat(72));
|
|
652
|
+
const ans = (await ask(`键入"可以"确认本份(${st} → ${target}),其他任意输入跳过:`)).trim();
|
|
653
|
+
if (ans !== '可以') {
|
|
654
|
+
console.log(`× 已跳过 ${doc}(未落状态)`);
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
658
|
+
appendLedger(root, {
|
|
659
|
+
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
660
|
+
commit: commitFp,
|
|
661
|
+
source: 'tty',
|
|
662
|
+
batch, seq, of: docs.length, // 调用事实(形态无关:TTY 多文档天然逐件过目,of>1 不构成违规)
|
|
663
|
+
}, { shard: shardMode });
|
|
664
|
+
console.log(`✓ ${doc} → ${target}(指纹 ${fp.slice(0, 16)},台账已记)`);
|
|
665
|
+
confirmed++;
|
|
666
|
+
seq++;
|
|
667
|
+
}
|
|
668
|
+
if (rl) rl.close();
|
|
669
|
+
// --- 终态件滚动归档(archive-on-close)---
|
|
670
|
+
// 关单即归档:本进程刚落终态的文档,其同名家族若已全终态且超窗、无活跃引用 → git mv 进
|
|
671
|
+
// workflow/archive/<家族最晚终态月>/{类型}/。动机:archive-sweep 是手工工具、无人跑,活跃目录
|
|
672
|
+
// 无限膨胀(实测 885 篇,其中 733 篇终态零引用);挂进确认门后活跃目录恒定。
|
|
673
|
+
// 判定单源 = archive-sweep.analyze(禁第二套口径);归档单位 = 同名家族(check-loop 检查 1 的
|
|
674
|
+
// 结构配对是家族双向在场审计,单篇归档会造配对断裂——首批 89 篇返工实证)。
|
|
675
|
+
// 时序:**台账行已写、状态已落盘之后**才 mv——check-loop 检查 15 的内容绑定按台账 doc 路径读
|
|
676
|
+
// 四目录直下文件,归档后该路径不在 docFiles() 扫描面内,绑定检查自然跳过(归档件不再受内容绑定
|
|
677
|
+
// 约束,与既有 2026-09 批次同口径)。失败一律 fail-open:归档是卫生动作,不得回滚已完成的确认。
|
|
678
|
+
// 启用条件:仓库已建立归档约定(workflow/archive/ 存在)——真实仓库有(2026-09 批次起),
|
|
679
|
+
// 临时 fixture 无;避免测试夹具被静默搬走(也避免在未采纳归档的仓库里凭空造目录)。
|
|
680
|
+
const archiveRoot = path.join(root, 'workflow', 'archive');
|
|
681
|
+
// 特性分支默认不归档(2026-10-15):分支上先关单再合并时,diff 只剩 archive/ 路径,
|
|
682
|
+
// CI 泳道门只认 workflow/intents|incidents 活跃直路径,合法合并被拦。
|
|
683
|
+
// main / master / develop 与游离 HEAD 维持关单即归档。CONFIRM_DOC_NO_ARCHIVE=1 仍强制关;
|
|
684
|
+
// CONFIRM_DOC_ARCHIVE=1 可在特性分支强制归档。
|
|
685
|
+
let featureHold = false;
|
|
686
|
+
if (confirmed > 0 && !process.env.CONFIRM_DOC_NO_ARCHIVE && process.env.CONFIRM_DOC_ARCHIVE !== '1') {
|
|
687
|
+
let branch = '';
|
|
688
|
+
try { branch = execFileSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim(); } catch { branch = ''; }
|
|
689
|
+
featureHold = !!branch && branch !== 'HEAD' && !['main', 'master', 'develop'].includes(branch);
|
|
690
|
+
if (featureHold && fs.existsSync(archiveRoot)) {
|
|
691
|
+
console.log(`📦 特性分支 ${branch} 不归档(合并前保持 workflow 活跃路径;main/develop 关单才归档)。CONFIRM_DOC_ARCHIVE=1 可强制`);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
if (confirmed > 0 && !process.env.CONFIRM_DOC_NO_ARCHIVE && !featureHold && fs.existsSync(archiveRoot)) {
|
|
695
|
+
try {
|
|
696
|
+
const { analyze, buildDocList, loadLastTouch, parseStatus, TERMINAL, ACTIVE } = await import('./archive-sweep.mjs');
|
|
697
|
+
const { loadAllConfirmations } = await import('./ledger-loader.mjs');
|
|
698
|
+
const ledgerTs = {};
|
|
699
|
+
for (const e of loadAllConfirmations(root)) {
|
|
700
|
+
if (TERMINAL.has(e.stage) && e.doc) {
|
|
701
|
+
const d = (e.ts || '').slice(0, 10);
|
|
702
|
+
if (d && (!ledgerTs[e.doc] || d > ledgerTs[e.doc])) ledgerTs[e.doc] = d;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
const allDocs = buildDocList(root);
|
|
706
|
+
// 窗口口径:本次确认的文档**刚**落终态,其台账 ts = 今日 → 21 天窗口必然拦下(窗口的用途是
|
|
707
|
+
// 「防归档仍在编辑的在途件」,而刚过确认门的终态件按定义已定稿,窗口对它冗余)。故对本进程
|
|
708
|
+
// 确认过的家族用 windowDays=-1(判据 `floor((today-tTime)/864e5) <= windowDays` 恒 false = 窗口
|
|
709
|
+
// 关闭;注意 0 不等于关闭——0 表示「同日也算未满窗」);未涉及的家族不在此次归档范围(touched
|
|
710
|
+
// 过滤),历史积压仍走 archive-sweep 手工批次 + 21 天窗口。
|
|
711
|
+
const r = analyze({
|
|
712
|
+
docs: allDocs,
|
|
713
|
+
ledgerTs,
|
|
714
|
+
lastTouch: loadLastTouch(root),
|
|
715
|
+
activeTexts: allDocs.filter((d) => ACTIVE.has(parseStatus(d.text))).map((d) => d.text),
|
|
716
|
+
windowDays: -1,
|
|
717
|
+
});
|
|
718
|
+
// 只归档「本次确认涉及的家族」——不越权清理历史积压(积压走 archive-sweep 手工批次)
|
|
719
|
+
const touched = new Set(docs.map((d) => path.basename(d)));
|
|
720
|
+
const mine = r.candidates.filter((x) => touched.has(x.file));
|
|
721
|
+
if (mine.length) {
|
|
722
|
+
for (const x of mine) {
|
|
723
|
+
const destDir = path.join(root, 'workflow', 'archive', x.month, x.dir);
|
|
724
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
725
|
+
execFileSync('git', ['mv', x.rel, path.join('workflow', 'archive', x.month, x.dir, x.file)], { cwd: root });
|
|
726
|
+
}
|
|
727
|
+
const fams = new Set(mine.map((x) => x.file));
|
|
728
|
+
console.log(`📦 归档 ${mine.length} 篇 / ${fams.size} 族 → workflow/archive/<终态月>/(家族原子;活跃目录不再累积终态件)`);
|
|
729
|
+
}
|
|
730
|
+
} catch (err) {
|
|
731
|
+
console.error(`⚠️ 归档跳过(fail-open,不影响已完成的确认):${err.message}`);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
console.log(`\n完成:确认 ${confirmed} 份 / 跳过 ${docs.length - confirmed - refused} 份 / 拒绝 ${refused} 份${delegated ? '(委托代录)' : ''}`);
|
|
735
|
+
process.exit(refused ? 2 : 0);
|
|
736
|
+
}
|
|
737
|
+
export default { computeFingerprint, nextStage, applyTransition, appendLedger, fmLevel };
|