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
|
@@ -1,603 +0,0 @@
|
|
|
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`(2026-09-27 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(2026-10-13 ledger-shard-default,
|
|
17
|
-
// 协议对齐 Shipyard 参考实现;--no-shard / CONFIRM_SHARDED=0 回退主台账 .agents/confirmations.jsonl)
|
|
18
|
-
// ——两者入 git、追加式。每行 {ts, doc, stage, fingerprint(64位), prev, source:"tty"|"chat-delegated",
|
|
19
|
-
// quote?(仅委托行), batch, seq, of}。
|
|
20
|
-
// batch/seq/of(2026-09-28 batch-ledger-audit 新增,纯增字段、向后兼容、历史行不回填):
|
|
21
|
-
// 记「本次进程调用落了几份态」这一**写入时确定已知的事实**——batch 为本次调用生成的短随机串
|
|
22
|
-
// (无时间语义、无全局唯一要求,仅需单台账内不碰撞),seq 为该次调用内件序(从 1),of 为本次
|
|
23
|
-
// 调用总份数。check-loop 检查 15 的并录审计据此直读事实判定,不再从 quote 相等 + ts 接近反推
|
|
24
|
-
// (旧判据可被「换 quote」平凡规避、且合规逐件复用同句必然误报——见同名 incident)。
|
|
25
|
-
// 指纹:内容 CRLF 归一 → 剔除「确认指纹:」行(防自引用)→ sha256;frontmatter 存前 16 位,台账存全量。
|
|
26
|
-
// 用法:node .agents/scripts/confirm-doc.mjs <workflow/intents|x.md> [<doc2>...] [--root <仓库根>]
|
|
27
|
-
// node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<用户对话原话>"(委托代录)
|
|
28
|
-
// node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<原话>" --batch(协作道批量:L1 多份一次代录)
|
|
29
|
-
// node .agents/scripts/confirm-doc.mjs <doc...> --to superseded|cancelled(放弃态:取代/取消,留指纹与台账)
|
|
30
|
-
// node .agents/scripts/confirm-doc.mjs <doc...> --no-shard(回退主台账 .agents/confirmations.jsonl:
|
|
31
|
-
// 分片已是默认写入口径,环境变量 CONFIRM_SHARDED=0 同效;里程碑可选跑 compact-ledgers.mjs 归并分片)
|
|
32
|
-
// 多文档一次传入:TTY 模式天然逐份过目键入;--delegated 默认一次仅一份(2026-09-27
|
|
33
|
-
// confirm-gate-one-per-call:多份并录曾系统性塌掉 build.md「逐件确认」三道门),L1 协作道可
|
|
34
|
-
// `--batch` 多份一次代录(2026-09-30 hybrid-governance-risk-lanes):逐份读「级别」,L2/L3 逐份拒绝
|
|
35
|
-
// (防御道不批量);台账行带 `brief:true` 简洁审计标记(quote 原话仍入账供对质),check-loop 检查 15
|
|
36
|
-
// 并录审计对全行带标记的批次豁免「确认并录」告警。--auto 一次仍仅一份(自治放行不批量)。
|
|
37
|
-
// 逐阶段前置门(2026-09-30 stage-gate-machine):specs/plans 的 draft→approved 须同主题入口已确认
|
|
38
|
-
// (plan 另须入口级别 L2/L3 时同名 spec 已确认;判定口径见 stage-gates.mjs)——未过拒绝落账:
|
|
39
|
-
// 不写盘、不 append 台账、该份计为「拒绝」,任一被拒进程 exit 2。
|
|
40
|
-
// 测试:node templates/_agents/scripts/confirm-doc.test.mjs(纯函数逐项 + 非 TTY spawn 拒绝断言 + 委托场景)
|
|
41
|
-
import fs from 'node:fs';
|
|
42
|
-
import path from 'node:path';
|
|
43
|
-
import readline from 'node:readline';
|
|
44
|
-
import { createHash, randomBytes } from 'node:crypto';
|
|
45
|
-
import { execFileSync, spawnSync } from 'node:child_process';
|
|
46
|
-
import { readLedgerEntries, readLedgerRows } from './ledger-loader.mjs';
|
|
47
|
-
import { confirmGateFor, clarifyGateFor, doneGateFor, laneOfEntry, laneOfDoc } from './stage-gates.mjs';
|
|
48
|
-
import { loadKitPolicy, hasFreshVerifyLine, ledgerChainHash, ledgerDocChainActive, ledgerDocChainPrev, scopeDigest } from './policy.mjs';
|
|
49
|
-
|
|
50
|
-
// hasFreshVerify(root, doc):读 <root>/.agents/verifications.jsonl 判 24h 窗口绿行(判定单源
|
|
51
|
-
// policy.hasFreshVerifyLine)。只读,台账缺失/不可读一律 false(=无凭证,advisory 层 fail-open)。
|
|
52
|
-
// doc 绑定(2026-10-08 verify-doc-binding):非空时只认 e.doc === doc 的绿行——不带 doc 的绿行
|
|
53
|
-
// (CI 场景)与**别的单**的绿行都不给本单背证。调用方负责「仅 v6+ 才传 doc」,本函数不做版本判断。
|
|
54
|
-
function hasFreshVerify(root, doc = null) {
|
|
55
|
-
try {
|
|
56
|
-
const p = path.join(root, '.agents', 'verifications.jsonl');
|
|
57
|
-
if (!fs.existsSync(p)) return false;
|
|
58
|
-
return hasFreshVerifyLine(fs.readFileSync(p, 'utf8').split(/\r?\n/), Date.now(), doc);
|
|
59
|
-
} catch {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// docRelOf:把用户传入的 doc 路径归一成「相对仓库根的 posix 相对路径」——与 verify.mjs --doc 的落账口径
|
|
65
|
-
// 必须逐字一致(一个转得动、另一个转不动 = 凭证永远匹配不上)。win32 反斜杠 / posix / 绝对路径三者同值。
|
|
66
|
-
function docRelOf(root, doc) {
|
|
67
|
-
try {
|
|
68
|
-
return path.relative(root, path.resolve(root, doc)).split(path.sep).join('/');
|
|
69
|
-
} catch {
|
|
70
|
-
return doc;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// gitDirtyFiles(root):机器实测的「工作树处于改动态的文件集合」(已跟踪改动 + 未跟踪新件,gitignore 项天然排除)。
|
|
75
|
-
// 解析 `git status --porcelain`(-z 不用,逐行解析足够;重命名行取 `->` 后段)。
|
|
76
|
-
// 非 git 仓库 / git 不可用 / 命令失败 → [](**静默降级为「无额外改动面」而非假装有**——scope 退化成
|
|
77
|
-
// 只含被确认文档本身,仍然自洽可验;不因探测失败而拒绝关单)。
|
|
78
|
-
function gitDirtyFiles(root) {
|
|
79
|
-
try {
|
|
80
|
-
const r = spawnSync('git', ['-C', root, 'status', '--porcelain'], { encoding: 'utf8', timeout: 10_000 });
|
|
81
|
-
if (r.status !== 0 || !r.stdout) return [];
|
|
82
|
-
return r.stdout.split(/\r?\n/).filter(Boolean).map((line) => {
|
|
83
|
-
const p = line.slice(3).trim();
|
|
84
|
-
const arrow = p.lastIndexOf(' -> ');
|
|
85
|
-
const rel = arrow >= 0 ? p.slice(arrow + 4) : p;
|
|
86
|
-
return rel.replace(/^"(.*)"$/, '$1');
|
|
87
|
-
}).filter(Boolean);
|
|
88
|
-
} catch {
|
|
89
|
-
return [];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// machineScope(root, doc):落账用的改动面事实(2026-10-09 审查 A1 干净版)。
|
|
94
|
-
// **AI 无输入面**——files 全部由机器派生(被确认文档 + git 实测工作树改动集),不是调用方能填的参数。
|
|
95
|
-
// 这正是相对旧设计的核心改进:旧的 quote 是 AI 自填的自由文本(可复用、可伪造、机器不可校验);
|
|
96
|
-
// scope 是机器事实,AI 填不了假,对质时问的是「这 N 个文件」而非「一句说过的话」。
|
|
97
|
-
// 归一/摘要计算单源在 policy.scopeDigest(check-loop 检查 15 侧校验复用同一实现)。
|
|
98
|
-
export function machineScope(root, doc) {
|
|
99
|
-
return scopeDigest([docRelOf(root, doc), ...gitDirtyFiles(root)]);
|
|
100
|
-
}
|
|
101
|
-
// computeFingerprint(text):CRLF 归一 → 剔指纹行 → sha256 hex(64 位)
|
|
102
|
-
export function computeFingerprint(text) {
|
|
103
|
-
const norm = String(text).replace(/\r\n/g, '\n').split('\n')
|
|
104
|
-
.filter((l) => !/^确认指纹:/.test(l))
|
|
105
|
-
.join('\n');
|
|
106
|
-
return createHash('sha256').update(norm, 'utf8').digest('hex');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// nextStage(status):唯一合法前向跳转(docs 两跳 + incidents 两跳);其余(done/closed/superseded/cancelled/缺失)返回 null
|
|
110
|
-
export function nextStage(status) {
|
|
111
|
-
if (status === 'draft') return 'approved';
|
|
112
|
-
if (status === 'approved') return 'done';
|
|
113
|
-
if (status === 'open') return 'fixed'; // incidents:修复落地确认(三件套全落地)
|
|
114
|
-
if (status === 'fixed') return 'closed'; // incidents:关单确认(防复发验证已落地)
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 放弃态跳转表(2026-09-27 closing-coverage):cancelled 自未确认/进行态,superseded 自已确认态——
|
|
119
|
-
// draft/open 未被确认过,谈不上「被取代」,只能 cancelled;终态间仅允许 done/closed→superseded(结论被新档取代),其余互跳拒绝
|
|
120
|
-
const CANCELLABLE = new Set(['draft', 'approved', 'open', 'fixed']);
|
|
121
|
-
const SUPERSEDABLE = new Set(['approved', 'done', 'fixed', 'closed']);
|
|
122
|
-
export const ABANDON_TARGETS = ['superseded', 'cancelled'];
|
|
123
|
-
|
|
124
|
-
// resolveTransition(status, to):带 --to 目标的跳转裁决(pure)。to 为空 = 默认前向(nextStage);
|
|
125
|
-
// to ∈ {superseded, cancelled} 按上表判合法性;其余值或非法组合返回 null
|
|
126
|
-
export function resolveTransition(status, to) {
|
|
127
|
-
if (!to) return nextStage(status);
|
|
128
|
-
if (to === 'cancelled') return CANCELLABLE.has(status) ? 'cancelled' : null;
|
|
129
|
-
if (to === 'superseded') return SUPERSEDABLE.has(status) ? 'superseded' : null;
|
|
130
|
-
return null;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// applyTransition(text, targetStage, fingerprint16):frontmatter 内只改「状态:」行值 + 增/换「确认指纹:」行,
|
|
134
|
-
// 其余字节原样保留;无 frontmatter(首行非 ---)或未闭合 → 返回 null(调用方跳过不写)
|
|
135
|
-
export function applyTransition(text, targetStage, fingerprint16) {
|
|
136
|
-
const lines = String(text).replace(/\r\n/g, '\n').split('\n');
|
|
137
|
-
if (!/^---\s*$/.test(lines[0] || '')) return null;
|
|
138
|
-
let end = -1;
|
|
139
|
-
for (let i = 1; i < lines.length; i++) {
|
|
140
|
-
if (/^---\s*$/.test(lines[i])) { end = i; break; }
|
|
141
|
-
}
|
|
142
|
-
if (end === -1) return null;
|
|
143
|
-
let hasStatus = false;
|
|
144
|
-
let hasFp = false;
|
|
145
|
-
for (let i = 1; i < end; i++) {
|
|
146
|
-
if (!hasStatus && /^状态:/.test(lines[i])) { lines[i] = `状态: ${targetStage}`; hasStatus = true; }
|
|
147
|
-
else if (!hasFp && /^确认指纹:/.test(lines[i])) { lines[i] = `确认指纹: ${fingerprint16}`; hasFp = true; }
|
|
148
|
-
}
|
|
149
|
-
const fm = lines.slice(1, end);
|
|
150
|
-
if (!hasStatus) fm.unshift(`状态: ${targetStage}`); // 防御:无状态键本应被 nextStage 拦,不至此
|
|
151
|
-
if (!hasFp) fm.push(`确认指纹: ${fingerprint16}`);
|
|
152
|
-
return [lines[0], ...fm, ...lines.slice(end)].join('\n');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// appendLedger(root, entry):追加一行 JSON(目录不存在自动建;只 append 不重写)
|
|
156
|
-
// 哈希链(2026-10-09 engine-quality-round2 D):每行追加 prevHash 与 hash(ledgerChainHash 单源计算,
|
|
157
|
-
// check-loop 15 同函数验链)——「就地改/删中间行」必留断链痕迹;历史行零回填(无 hash 行后链重启),
|
|
158
|
-
// 整文件重写不可机器防(边界声明见 policy.ledgerChainHash)。
|
|
159
|
-
// 链域(2026-10-12 ledger-doc-chain):policy.ledgerDocChainSince 存在且合法 → prevHash 取**同行 doc 的
|
|
160
|
-
// 最后一个带 hash 行**(ledgerDocChainPrev),不再取物理末行。理由见 POLICIES v8 注释:物理链隐含
|
|
161
|
-
// 「单写者顺序追加」前提,而并发 append / git 并集合并 / 分片归并三种**正常协作**都会打断它。
|
|
162
|
-
// 缺键(v1-v7)→ 走旧物理链口径,存量零变化。
|
|
163
|
-
// shard(2026-10-12 ledger-shard-write;2026-10-13 ledger-shard-default 升为默认):多 worktree 并行时
|
|
164
|
-
// 两个进程同时 append 同一台账文件会互相覆盖(各自读到同一末行 → 同 prevHash → 后写者覆盖前写者)。
|
|
165
|
-
// 分片把本行写入 `.agents/confirmations.d/<doc基名>.jsonl`,各 worktree 各写各的、互不冲突。
|
|
166
|
-
// **默认写分片**(CLI 层;--no-shard / CONFIRM_SHARDED=0 显式回退主台账)——doc 链未激活
|
|
167
|
-
// (policyVersion < 8)时 CLI 层自动回退主台账(见 isMain 内 ledger-shard-default 注释),
|
|
168
|
-
// 存量装户升级后行为零变化。函数层契约不变:shard 显式传入,默认 false。
|
|
169
|
-
export function appendLedger(root, entry, { shard = false } = {}) {
|
|
170
|
-
const p = shard && entry.doc
|
|
171
|
-
? path.join(root, '.agents', 'confirmations.d', `${path.basename(entry.doc, '.md')}.jsonl`)
|
|
172
|
-
: path.join(root, '.agents', 'confirmations.jsonl');
|
|
173
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
174
|
-
let prevHash = '';
|
|
175
|
-
try {
|
|
176
|
-
if (ledgerDocChainActive(loadKitPolicy(root))) {
|
|
177
|
-
// doc 链取前驱走**台账视图**(主台账 + 分片)而非单个文件:--shard 写入时,该 doc 的历史行
|
|
178
|
-
// 很可能在主台账里,只读分片文件会从 '' 重启 → 链断裂。视图取法天然跨来源衔接。
|
|
179
|
-
const rows = readLedgerEntries(root).map((e) => e.row);
|
|
180
|
-
prevHash = ledgerDocChainPrev(rows, entry.doc);
|
|
181
|
-
} else if (fs.existsSync(p)) {
|
|
182
|
-
// 旧物理链口径:取**本次写入目标文件**的末行 hash(v1-v7 存量行为,逐字不变)
|
|
183
|
-
const lines = fs.readFileSync(p, 'utf8').split(/\r?\n/).filter((l) => l.trim());
|
|
184
|
-
if (lines.length) {
|
|
185
|
-
const last = JSON.parse(lines[lines.length - 1]);
|
|
186
|
-
prevHash = last && typeof last.hash === 'string' ? last.hash : '';
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} catch { /* 不可解析 → prevHash ''(链从本行重启;断裂由 check-loop 15 出账) */ }
|
|
190
|
-
const { hash: _h, prevHash: _p, ...rest } = entry;
|
|
191
|
-
const row = { ...rest, prevHash, hash: ledgerChainHash(rest, prevHash) };
|
|
192
|
-
fs.appendFileSync(p, JSON.stringify(row) + '\n');
|
|
193
|
-
return p;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const DOC_RE = /^workflow\/(intents|specs|plans|incidents)\/[^/]+\.md$/;
|
|
197
|
-
|
|
198
|
-
// fmLevel(nl):frontmatter「级别:」值(无 frontmatter / 无该键 → '')——AI 自治门与协作道批量门共用
|
|
199
|
-
export function fmLevel(nl) {
|
|
200
|
-
if (!/^---\s*$/.test(nl[0] || '')) return '';
|
|
201
|
-
for (let i = 1; i < nl.length && !/^---\s*$/.test(nl[i]); i++) {
|
|
202
|
-
const m = nl[i].match(/^级别:\s*(.*)$/);
|
|
203
|
-
if (m) return m[1].trim();
|
|
204
|
-
}
|
|
205
|
-
return '';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const isMain = process.argv[1] && process.argv[1].endsWith('confirm-doc.mjs');
|
|
209
|
-
if (isMain) {
|
|
210
|
-
const argv = process.argv.slice(2);
|
|
211
|
-
let root = process.cwd();
|
|
212
|
-
let delegatedQuote = null; // null = TTY 模式;字符串 = 委托代录的用户对话原话
|
|
213
|
-
let toTarget = null; // null = 默认前向跳转;superseded|cancelled = 放弃态显式目标
|
|
214
|
-
let autoMode = false; // AI 自治模式(信任等级授权,2026-09-30 ai-autonomy-trust)
|
|
215
|
-
let batchMode = false; // 协作道批量代录(--batch,2026-09-30 hybrid-governance-risk-lanes:仅 --delegated + L1)
|
|
216
|
-
let shardWrite = process.env.CONFIRM_SHARDED !== '0'; // 分片默认写入口径(2026-10-13 ledger-shard-default):CONFIRM_SHARDED=0 显式回退主台账
|
|
217
|
-
const docs = [];
|
|
218
|
-
for (let i = 0; i < argv.length; i++) {
|
|
219
|
-
if (argv[i] === '--root') root = path.resolve(argv[++i]);
|
|
220
|
-
else if (argv[i] === '--delegated') delegatedQuote = argv[++i] ?? '';
|
|
221
|
-
else if (argv[i] === '--to') toTarget = argv[++i] ?? '';
|
|
222
|
-
else if (argv[i] === '--auto') autoMode = true;
|
|
223
|
-
else if (argv[i] === '--batch') batchMode = true;
|
|
224
|
-
else if (argv[i] === '--shard') shardWrite = true;
|
|
225
|
-
else if (argv[i] === '--no-shard') shardWrite = false;
|
|
226
|
-
else docs.push(argv[i].replace(/\\/g, '/'));
|
|
227
|
-
}
|
|
228
|
-
if (toTarget !== null && !ABANDON_TARGETS.includes(toTarget)) {
|
|
229
|
-
console.error(`用法:--to 仅接受 superseded|cancelled(现「${toTarget}」)——cancelled 自 draft/approved/open/fixed;superseded 自 approved/done/fixed/closed(未确认态只能 cancelled;终态间仅允许 done/closed→superseded)`);
|
|
230
|
-
process.exit(1);
|
|
231
|
-
}
|
|
232
|
-
// 分片默认写入口径(2026-10-13 ledger-shard-default,对齐 Shipyard 参考实现):
|
|
233
|
-
// 确认行默认写 `.agents/confirmations.d/<doc基名>.jsonl`——多 worktree / 多人并行天然各写各的,
|
|
234
|
-
// 互不覆盖;跨分支合并走 .gitattributes 的 union driver(confirmations.d/*.jsonl merge=jsonl-union),
|
|
235
|
-
// 里程碑可选跑 compact-ledgers.mjs 收敛碎片。--no-shard / CONFIRM_SHARDED=0 显式回退主台账。
|
|
236
|
-
// doc 链仍是分片的前提(2026-10-12 ledger-shard-write 口径保留):分片与主台账分属不同文件,
|
|
237
|
-
// 只有 doc 链能跨来源接续;旧物理链口径下分片行的 prevHash 会与主台账末行失配 → 提交即断链。故:
|
|
238
|
-
// 显式 --shard + doc 链未激活 → 参数期直接拒(友好报错,原口径不变);
|
|
239
|
-
// 默认分片 + doc 链未激活 → 自动回退主台账并出 ℹ️——存量装户(policyVersion < 8)升级模板后
|
|
240
|
-
// 行为零变化,分片默认仅对 doc 链已激活的装户生效;升级法:.agents/kit.json 设 policyVersion: 8。
|
|
241
|
-
if (argv.includes('--shard') && argv.includes('--no-shard')) {
|
|
242
|
-
console.error('用法:--shard 与 --no-shard 互斥——分片已是默认写入口径,显式回退主台账只需 --no-shard');
|
|
243
|
-
process.exit(1);
|
|
244
|
-
}
|
|
245
|
-
if (shardWrite && !ledgerDocChainActive(loadKitPolicy(root))) {
|
|
246
|
-
if (argv.includes('--shard')) {
|
|
247
|
-
console.error('❌ --shard 需要台账 doc 链口径(policy.ledgerDocChainSince),当前 policyVersion 无此键。\n 原因:分片与主台账是不同文件,只有 doc 链能跨来源接续;旧物理链口径下分片行会与主台账断链。\n 修法:在 .agents/kit.json 设 policyVersion: 8(或更高的支持版本)后重试,或改用 --no-shard 显式写主台账。');
|
|
248
|
-
process.exit(1);
|
|
249
|
-
}
|
|
250
|
-
shardWrite = false; // 存量装户回退:分片默认仅对 doc 链已激活(policyVersion ≥ 8)的装户生效
|
|
251
|
-
console.error('ℹ️ 分片默认写入口径需 doc 链口径(policy.ledgerDocChainSince),当前 policyVersion 未激活——本次写主台账 .agents/confirmations.jsonl。升级法:.agents/kit.json 设 policyVersion: 8。');
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const delegated = delegatedQuote !== null;
|
|
255
|
-
if (delegated && autoMode) {
|
|
256
|
-
console.error('❌ --auto 与 --delegated 互斥:自治模式是用户预先授权的机器放行,委托代录是单次对话确认');
|
|
257
|
-
process.exit(1);
|
|
258
|
-
}
|
|
259
|
-
if (batchMode && autoMode) {
|
|
260
|
-
console.error('❌ --batch 与 --auto 互斥:批量代录是协作道的对话委托形态,自治放行不批量(一次一份)');
|
|
261
|
-
process.exit(1);
|
|
262
|
-
}
|
|
263
|
-
if (batchMode && toTarget) {
|
|
264
|
-
console.error('❌ --batch 不支持 --to 放弃态——放弃须逐份显式确认,不批量');
|
|
265
|
-
process.exit(1);
|
|
266
|
-
}
|
|
267
|
-
// AI 自治门(2026-09-30 ai-autonomy-trust;2026-09-30 hybrid-governance-explore-hardening 加隐式形态):
|
|
268
|
-
// 读 .agents/trust-mode.json。除显式 --auto 外,Trusted(level=2)下的非 TTY 单份调用在 TTY 门处
|
|
269
|
-
// 免旗标自动转入本分支(见「Trusted 自动泳道」)——L1 门 / incidents 排除 / 逐阶段与 done 门照常执行。
|
|
270
|
-
let trustConfig = null;
|
|
271
|
-
if (autoMode) {
|
|
272
|
-
try {
|
|
273
|
-
trustConfig = JSON.parse(fs.readFileSync(path.join(root, '.agents', 'trust-mode.json'), 'utf8'));
|
|
274
|
-
} catch { trustConfig = { enabled: false, level: 0 }; }
|
|
275
|
-
if (!trustConfig.enabled || ![1, 2].includes(trustConfig.level)) {
|
|
276
|
-
console.error('❌ AI 自治未开启或等级非法(.agents/trust-mode.json enabled=false 或 level∉[1,2])——跑 node .agents/scripts/trust-mode.mjs --enable --level <1|2> 开启');
|
|
277
|
-
process.exit(1);
|
|
278
|
-
}
|
|
279
|
-
if (toTarget) {
|
|
280
|
-
console.error('❌ AI 自治模式不支持 --to 放弃态(放弃态必须由用户显式确认)');
|
|
281
|
-
process.exit(1);
|
|
282
|
-
}
|
|
283
|
-
if (docs.length > 1) {
|
|
284
|
-
console.error('❌ AI 自治模式一次仅接受一份文档(与 --delegated 同口径,逐件放行)');
|
|
285
|
-
process.exit(1);
|
|
286
|
-
}
|
|
287
|
-
console.error(`⚠️ AI 自治模式(Trust L${trustConfig.level}):仅限 L1 文档;Level 1 只放行 draft→approved,Level 2 放行至 done`);
|
|
288
|
-
}
|
|
289
|
-
if (delegated && !String(delegatedQuote).trim()) {
|
|
290
|
-
console.error('用法:--delegated 须带用户对话原话(node .agents/scripts/confirm-doc.mjs <doc...> --delegated "<用户原话>")——原话入台账供事后对质,不可缺省');
|
|
291
|
-
process.exit(1);
|
|
292
|
-
}
|
|
293
|
-
// TTY 门(仅 TTY 模式;先于文档参数校验):AI 会话内非委托调用一律拒绝
|
|
294
|
-
// CONFIRM_DOC_TEST_TTY:**仅测试用**逃生门——本测试环境无 TTY,而 TTY 多文档分支
|
|
295
|
-
// (batch 相同 / seq 递增 / of=N)是并录审计的判别基础,必须可测(复核 P2-2)。
|
|
296
|
-
// 双条件(2026-09-28 check16-inline-debt):须同时 NODE_ENV === 'test' 才放行——单看
|
|
297
|
-
// 「TEST」字样的变量名不构成机器约束,AI 会话可能「顺手」在生产路径设置它绕过 TTY 门;
|
|
298
|
-
// 加 NODE_ENV 双条件后,生产路径(不设 NODE_ENV=test)即便误设 CONFIRM_DOC_TEST_TTY 也不生效。
|
|
299
|
-
// **信任边界声明(沿 check8-git-anchor 口径)**:本地信任边界内不可机器防——环境变量终究可被
|
|
300
|
-
// 本机进程任意设置,刻意伪造 `NODE_ENV=test CONFIRM_DOC_TEST_TTY=1` 仍可绕过,与伪造 git 时间戳 /
|
|
301
|
-
// 手改台账同属事后对质(git 历史与台账)兜底的范畴;此处只把「顺手设置单变量」的成本抬到
|
|
302
|
-
// 「主动伪造双变量组合」,不宣称「通道已关闭」。
|
|
303
|
-
// 两变量只影响 isTTY 判定,不改动任何落态/记账语义;生产路径不设置这两个变量。
|
|
304
|
-
const ttyForced = process.env.CONFIRM_DOC_TEST_TTY === '1' && process.env.NODE_ENV === 'test';
|
|
305
|
-
if (!delegated && !autoMode && !ttyForced && (!process.stdin.isTTY || !process.stdout.isTTY)) {
|
|
306
|
-
// Trusted 自动泳道(2026-09-30 hybrid-governance-explore-hardening):trust-mode.json 为 Trusted
|
|
307
|
-
// (enabled 且 level=2)时,非 TTY 调用(AI 会话)对文档**免手工触发**(无需 --delegated 原话 /
|
|
308
|
-
// --auto 旗标)自动转入 AI 自治放行——单份、非放弃态才可隐式(与 --auto 同口径,L1 门与
|
|
309
|
-
// incidents 排除由主循环自治门照常执行);不满足则维持原拒绝(fail-closed,Standard/Strict 不隐式)。
|
|
310
|
-
let implicitTrust = null;
|
|
311
|
-
try {
|
|
312
|
-
implicitTrust = JSON.parse(fs.readFileSync(path.join(root, '.agents', 'trust-mode.json'), 'utf8'));
|
|
313
|
-
} catch { implicitTrust = { enabled: false, level: 0 }; }
|
|
314
|
-
if (implicitTrust.enabled && implicitTrust.level === 2 && docs.length === 1 && !toTarget) {
|
|
315
|
-
autoMode = true;
|
|
316
|
-
trustConfig = implicitTrust; // 主循环自治门(L1 与 incidents 排除)直读本配置——顶部 if (autoMode) 块先于 TTY 门执行,须在此补装
|
|
317
|
-
console.error('⚠️ Trusted 自动泳道(隐式):单份 L1 文档按 AI 自治放行(Level 2 全闭环,台账 source=ai-auto-trust-L2);L2/L3 与 incidents 仍须人工确认');
|
|
318
|
-
} else {
|
|
319
|
-
console.error('确认门须由用户在终端亲手运行(node .agents/scripts/confirm-doc.mjs <workflow/文档>...)——AI 会话内不可代确认;用户对话内明确确认后可用 --delegated "<用户原话>" 委托代录(台账如实记来源)');
|
|
320
|
-
process.exit(1);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (!docs.length) {
|
|
324
|
-
console.error('用法:node .agents/scripts/confirm-doc.mjs <workflow/intents|specs|plans/x.md> [...] [--root <仓库根>] [--delegated "<用户原话>" [--batch]]');
|
|
325
|
-
process.exit(1);
|
|
326
|
-
}
|
|
327
|
-
if (delegated) {
|
|
328
|
-
console.error('⚠️ 委托代录模式:确认语义 = 用户已在对话中明确放行;台账行将如实记 source=chat-delegated 与原话,不伪装 TTY 确认');
|
|
329
|
-
console.error(` 用户原话:「${delegatedQuote}」`);
|
|
330
|
-
// 单文档默认(2026-09-27 confirm-gate-one-per-call):delegated 没有TTY「逐份过目」的天然机制——
|
|
331
|
-
// 多文档并录曾系统性塌掉三道阶段门(build.md「逐件确认不得并作一次」)。逐件调用:一次一份、
|
|
332
|
-
// 每次带当次用户原话。TTY 形态不受限(用户亲手逐份过目键入,天然逐件)。
|
|
333
|
-
// 协作道批量(2026-09-30 hybrid-governance-risk-lanes):L1 可 `--batch` 多份一次代录——
|
|
334
|
-
// 逐份读「级别」,L2/L3 逐份拒绝(见主循环协作道门);台账行带 brief:true,检查 15 据此豁免并录告警。
|
|
335
|
-
if (docs.length > 1) {
|
|
336
|
-
if (!batchMode) {
|
|
337
|
-
console.error(`❌ --delegated 一次仅接受一份文档(现 ${docs.length} 份:${docs.join(' ')})——逐件确认口径(build.md):每份一次调用、每次带当次用户原话;L1 协作道批量可加 --batch`);
|
|
338
|
-
process.exit(1);
|
|
339
|
-
}
|
|
340
|
-
console.error(` 批量代录(--batch):${docs.length} 份,仅受理 L1(协作道,异步审计兜底);L2/L3 逐份拒绝`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
// 调用事实(2026-09-28 batch-ledger-audit):本次进程调用的批次标识与件序——
|
|
344
|
-
// 供 check-loop 检查 15 的并录审计直读(替代「同 quote + ts 接近」的反推)。
|
|
345
|
-
const batch = randomBytes(3).toString('hex');
|
|
346
|
-
let seq = 1;
|
|
347
|
-
// 应答来源(**仅测试用**注入,见 CONFIRM_DOC_TEST_ANSWERS):TTY 多文档路径的 batch/seq/of 是并录
|
|
348
|
-
// 审计的判别基础,必须可端到端验证;而 spawnSync 的管道 stdin 是「写完即关」,readline 会在第二个
|
|
349
|
-
// question 注册前吞掉后续行、且 stdin 已 EOF → 第 2 份必然挂住(**不是无 TTY 的限制**,是管道 EOF;
|
|
350
|
-
// 2026-09-28 复核 P2-2 更正:此前测试注释把根因误记为「管道输入不被逐次消费」)。
|
|
351
|
-
// 故提供问答注入:按序取预置应答,绕开 stdin/EOF 时序,不改动任何落态与记账语义。
|
|
352
|
-
const injected = process.env.CONFIRM_DOC_TEST_ANSWERS !== undefined
|
|
353
|
-
? String(process.env.CONFIRM_DOC_TEST_ANSWERS).split(',').map((s) => s.trim())
|
|
354
|
-
: null;
|
|
355
|
-
const rl = delegated || injected ? null : readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
356
|
-
const ask = (q) => new Promise((res) => {
|
|
357
|
-
if (injected) {
|
|
358
|
-
process.stdout.write(q);
|
|
359
|
-
return res(injected.shift() ?? '');
|
|
360
|
-
}
|
|
361
|
-
return rl.question(q, res);
|
|
362
|
-
});
|
|
363
|
-
let confirmed = 0;
|
|
364
|
-
let refused = 0; // 逐阶段前置门拒绝数(exit 2 信号;2026-09-30 stage-gate-machine)
|
|
365
|
-
for (const doc of docs) {
|
|
366
|
-
if (!DOC_RE.test(doc)) {
|
|
367
|
-
console.error(`跳过 ${doc}:路径须匹配 workflow/{intents,specs,plans,incidents}/<文件>.md`);
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
const abs = path.join(root, doc);
|
|
371
|
-
let text;
|
|
372
|
-
try { text = fs.readFileSync(abs, 'utf8'); }
|
|
373
|
-
catch { console.error(`跳过 ${doc}:文件不可读`); continue; }
|
|
374
|
-
// 状态键只在 frontmatter 区(首 --- 至闭合 ---)取——防正文误命中
|
|
375
|
-
const nl = text.replace(/\r\n/g, '\n').split('\n');
|
|
376
|
-
let st = '';
|
|
377
|
-
if (/^---\s*$/.test(nl[0] || '')) {
|
|
378
|
-
for (let i = 1; i < nl.length && !/^---\s*$/.test(nl[i]); i++) {
|
|
379
|
-
const m = nl[i].match(/^状态:\s*(.*)$/);
|
|
380
|
-
if (m) { st = m[1].trim(); break; }
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
const target = resolveTransition(st, toTarget);
|
|
384
|
-
const lvl = fmLevel(nl); // 级别(AI 自治门 / 协作道批量门共用;缺 = '')
|
|
385
|
-
// 泳道单源(2026-10-02 caliber-convergence 方案 C 分歧双严):intent 双字段(级别+risk_level,协议
|
|
386
|
-
// 锚 policy.riskLevelSince)三态判定;其余件级别单字段。suspect(缺失/非法/分歧)按 high——--auto
|
|
387
|
-
// 与 --batch 均不受理,须先两字段对齐(fill-intent 双写口径)。
|
|
388
|
-
const fmOf = (key) => {
|
|
389
|
-
const m = nl.find((l) => l.startsWith(`${key}:`));
|
|
390
|
-
return m ? m.slice(key.length + 1).trim() : '';
|
|
391
|
-
};
|
|
392
|
-
const lane = doc.includes('/intents/')
|
|
393
|
-
? laneOfEntry(lvl, fmOf('risk_level'), loadKitPolicy(root).riskLevelSince, fmOf('日期'))
|
|
394
|
-
: laneOfDoc(lvl);
|
|
395
|
-
if (!target) {
|
|
396
|
-
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)`);
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
// 逐阶段前置门(2026-09-30 stage-gate-machine):specs/plans 的 draft→approved 须前置已确认
|
|
400
|
-
// (plan 另须入口级别 L2/L3 时同名 spec 已确认)——未过拒绝落账(不写盘、不 append 台账)。
|
|
401
|
-
if (target === 'approved' && (doc.startsWith('workflow/specs/') || doc.startsWith('workflow/plans/'))) {
|
|
402
|
-
const gate = confirmGateFor(root, doc);
|
|
403
|
-
if (!gate.ok) {
|
|
404
|
-
console.error(`❌ ${doc} 未过逐阶段前置门(stage-gates):${gate.reason}`);
|
|
405
|
-
console.error(` ${gate.hint}(本份未落账、未写盘)`);
|
|
406
|
-
refused++;
|
|
407
|
-
continue;
|
|
408
|
-
}
|
|
409
|
-
// 待澄清项门(2026-10-12 needs-clarification):起草期挂「待澄清」标记**不阻断**(零阻塞),
|
|
410
|
-
// 但 draft→approved 确认时若仍挂着未澄清项则拒绝——确认即「认可这份文档」,文档里还写着
|
|
411
|
-
// 「这里我不知道」,确认就没有意义。与上面的前置门分开出账:拒绝原因必须指向真正的原因
|
|
412
|
-
// (合并会让作者去查「前置」,而前置其实是好的)。
|
|
413
|
-
// ⚠️ 文案锚点硬约束:本段禁止并入上方 gate 分支的输出契约(既有 confirm-doc.test.mjs 断言
|
|
414
|
-
// 锚定「未过逐阶段前置门(stage-gates)」子串),故单列独立分支。
|
|
415
|
-
const cl = clarifyGateFor(abs);
|
|
416
|
-
if (!cl.ok) {
|
|
417
|
-
console.error(`❌ ${doc} 含未澄清项(needs-clarification):${cl.reason}`);
|
|
418
|
-
console.error(` ${cl.hint}(本份未落账、未写盘)`);
|
|
419
|
-
refused++;
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
// done 前置门(2026-09-30 confirm-gate-approved-history):→done 须 git 历史已留 approved 态
|
|
424
|
-
// (先 done 后提交 / 两跳同批提交 → 拒绝;防「确认态缺失」缺陷复发;判据单源见 stage-gates.doneGateFor)。
|
|
425
|
-
if (target === 'done') {
|
|
426
|
-
const gate = doneGateFor(root, abs, doc);
|
|
427
|
-
if (!gate.ok) {
|
|
428
|
-
console.error(`❌ ${doc} 未过 done 前置门(approved 历史):${gate.reason}`);
|
|
429
|
-
console.error(` ${gate.hint}(本份未落账、未写盘)`);
|
|
430
|
-
refused++;
|
|
431
|
-
continue;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
// 测试绿凭证前置(2026-10-07 verify-evidence,advisory 不拦):→done 且文档含「验收标准」节且
|
|
435
|
-
// policy v5(verifySince)→ 24h 窗口内须有 verifications.jsonl 绿行。只读判定,任何读取异常降级
|
|
436
|
-
// 静默(fail-open——advisory 层不因台账缺失/坏行阻断关单);升 hard 走后续 policyVersion 演进。
|
|
437
|
-
// 2026-10-08 verify-doc-binding:v6+(verifyDocSince)时按本 doc 精确匹配绿行——他单的绿行不再
|
|
438
|
-
// 给本单背书;v1-v5 维持 v5 全局行为逐字不变。
|
|
439
|
-
// ⚠️ 文案锚点硬约束(既有 confirm-doc.test.mjs 断言锚定子串,零改动前提):
|
|
440
|
-
// 「无测试绿凭证」六字须**连续**,doc 与命令只能追加在其后——不得写成「无本单(x)的测试绿凭证」。
|
|
441
|
-
if (target === 'done' && typeof loadKitPolicy(root).verifySince === 'string'
|
|
442
|
-
&& /^##\s*[^#]*验收标准/m.test(text)) {
|
|
443
|
-
const pol = loadKitPolicy(root);
|
|
444
|
-
const rel = docRelOf(root, doc);
|
|
445
|
-
const bound = typeof pol.verifyDocSince === 'string' ? rel : null;
|
|
446
|
-
if (!hasFreshVerify(root, bound)) {
|
|
447
|
-
console.error(`⚠️ ${doc} 置 done:24h 内无测试绿凭证(${bound ? `本单 ${rel} 须带 --doc 落账` : '凭证未按单绑定'})——关单勾验的「测试绿」声明缺机器事实`);
|
|
448
|
-
console.error(` 跑 node .agents/scripts/verify.mjs${bound ? ` --doc ${rel}` : ''} 后重新关单;本次不拦截(advisory,灰度第一档)`);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
const fp = computeFingerprint(text);
|
|
452
|
-
// 改动面事实(2026-10-09 审查 A1 干净版):机器派生,三形态(TTY / 委托代录 / AI 自治)一律记入——
|
|
453
|
-
// TTY 形态同样需要(事后对质问的是「放行时盘面上哪些文件在动」,与谁点的确认无关)。
|
|
454
|
-
const scope = machineScope(root, doc);
|
|
455
|
-
// AI 自治放行分支(2026-09-30 ai-autonomy-trust):
|
|
456
|
-
// ① 仅 L1(读 frontmatter「级别」,缺级别按不可自治处理——fail-closed);
|
|
457
|
-
// ② Level 1:仅 draft→approved;Level 2:draft→approved 与 approved→done;
|
|
458
|
-
// ③ incidents 永不自治(open→fixed/fixed→closed 必须人工)。
|
|
459
|
-
if (autoMode) {
|
|
460
|
-
const isLowLevel = lane === 'low';
|
|
461
|
-
const stageAllowed = trustConfig.level === 2
|
|
462
|
-
? (target === 'approved' || target === 'done')
|
|
463
|
-
: target === 'approved';
|
|
464
|
-
if (!isLowLevel || !stageAllowed || doc.startsWith('workflow/incidents/')) {
|
|
465
|
-
console.error(`❌ ${doc} 未过 AI 自治门(级别「${lvl || '缺失'}」/ 泳道「${lane}」/ 目标态「${target}」/ 类型):Level ${trustConfig.level} 仅授权泳道 low(intent 级别 L1;suspect 须先对齐「级别/risk_level」)的 ${trustConfig.level === 2 ? 'approved/done' : 'approved'} 且不含 incidents`);
|
|
466
|
-
refused++;
|
|
467
|
-
continue;
|
|
468
|
-
}
|
|
469
|
-
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
470
|
-
// shard 走第三参 options(不进 entry):appendLedger(root, entry, { shard }) 的契约是 options 形参,
|
|
471
|
-
// 写进 entry 会让旗标混入台账行数据且分片开关失效(2026-10-13 ledger-shard-default 修复的存量缺陷)。
|
|
472
|
-
appendLedger(root, {
|
|
473
|
-
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
474
|
-
source: `ai-auto-trust-L${trustConfig.level}`, quote: `AI 自治放行 (Trust Level ${trustConfig.level})`,
|
|
475
|
-
batch, seq, of: docs.length, scope,
|
|
476
|
-
}, { shard: shardWrite });
|
|
477
|
-
console.log(`✓ ${doc} ${st} → ${target}(指纹 ${fp.slice(0, 16)},AI 自治已记账:source=ai-auto-trust-L${trustConfig.level})`);
|
|
478
|
-
confirmed++;
|
|
479
|
-
seq++;
|
|
480
|
-
continue;
|
|
481
|
-
}
|
|
482
|
-
if (delegated) {
|
|
483
|
-
// 协作道门(2026-09-30 hybrid-governance-risk-lanes;2026-10-02 caliber-convergence 起单源泳道):
|
|
484
|
-
// --batch 批量仅受理泳道 low(intent 级别 L1;suspect 拒)——high/suspect 逐份拒绝落账;
|
|
485
|
-
// 不带 --batch 的单份代录不限级别(既有口径不变)。
|
|
486
|
-
const low = lane === 'low';
|
|
487
|
-
if (batchMode && !low) {
|
|
488
|
-
console.error(`❌ ${doc} 泳道「${lane}」(级别「${lvl || '缺失'}」)不在协作道——--batch 批量代录仅限级别 L1;suspect(级别/risk_level 缺失、非法或分歧)须先对齐两字段,L2/L3 防御道须逐份确认(本份未落账、未写盘)`);
|
|
489
|
-
refused++;
|
|
490
|
-
continue;
|
|
491
|
-
}
|
|
492
|
-
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
493
|
-
appendLedger(root, {
|
|
494
|
-
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
495
|
-
source: 'chat-delegated', quote: String(delegatedQuote),
|
|
496
|
-
// 调用事实(batch-ledger-audit):seq=本次调用内件序(从 1),of=本次调用总份数
|
|
497
|
-
batch, seq, of: docs.length,
|
|
498
|
-
// 改动面事实(A1 干净版):quote 降级为「人类可读摘要」,分辨力改由 scope(机器派生)+ fingerprint
|
|
499
|
-
// (文档内容)承担——「不复用同句」纪律据此退役(复用一句摘要不再削弱任何判据)。
|
|
500
|
-
scope,
|
|
501
|
-
// 简洁审计标记(hybrid-governance-risk-lanes):L1 协作道行带 brief(quote 仍入账供对质),
|
|
502
|
-
// 检查 15 并录审计对全 brief 批次豁免「确认并录」告警
|
|
503
|
-
...(low ? { brief: true } : {}),
|
|
504
|
-
}, { shard: shardWrite });
|
|
505
|
-
console.log(low
|
|
506
|
-
? `✓ ${doc} ${st} → ${target} [${lvl} 协作道/异步审计](指纹 ${fp.slice(0, 16)})`
|
|
507
|
-
: `✓ ${doc} ${st} → ${target}(指纹 ${fp.slice(0, 16)},代录已记账:source=chat-delegated)`);
|
|
508
|
-
confirmed++;
|
|
509
|
-
seq++;
|
|
510
|
-
continue;
|
|
511
|
-
}
|
|
512
|
-
console.log('\n'.repeat(3) + '='.repeat(72));
|
|
513
|
-
console.log(`文档:${doc} 状态:${st} → ${target} 指纹:${fp.slice(0, 16)}`);
|
|
514
|
-
console.log('='.repeat(72));
|
|
515
|
-
console.log(text);
|
|
516
|
-
console.log('='.repeat(72));
|
|
517
|
-
const ans = (await ask(`键入"可以"确认本份(${st} → ${target}),其他任意输入跳过:`)).trim();
|
|
518
|
-
if (ans !== '可以') {
|
|
519
|
-
console.log(`× 已跳过 ${doc}(未落状态)`);
|
|
520
|
-
continue;
|
|
521
|
-
}
|
|
522
|
-
fs.writeFileSync(abs, applyTransition(text, target, fp.slice(0, 16)));
|
|
523
|
-
appendLedger(root, {
|
|
524
|
-
ts: new Date().toISOString(), doc, stage: target, fingerprint: fp, prev: st,
|
|
525
|
-
source: 'tty',
|
|
526
|
-
batch, seq, of: docs.length, // 调用事实(形态无关:TTY 多文档天然逐件过目,of>1 不构成违规)
|
|
527
|
-
}, { shard: shardWrite });
|
|
528
|
-
console.log(`✓ ${doc} → ${target}(指纹 ${fp.slice(0, 16)},台账已记)`);
|
|
529
|
-
confirmed++;
|
|
530
|
-
seq++;
|
|
531
|
-
}
|
|
532
|
-
if (rl) rl.close();
|
|
533
|
-
// --- 终态件滚动归档(2026-10-13 archive-on-close;B9 自 Shipyard.Material 回灌,行为边界逐字对齐)---
|
|
534
|
-
// 关单即归档:本进程刚落终态的文档,其同名家族若已全终态且超窗、无活跃引用 → git mv 进
|
|
535
|
-
// workflow/archive/<家族最晚终态月>/{类型}/。动机:archive-sweep 是手工工具、无人跑,活跃目录
|
|
536
|
-
// 无限膨胀(源仓实测 885 篇、733 篇终态零引用——留痕在包源仓 git 历史与 CHANGELOG);挂进确认门
|
|
537
|
-
// 后活跃目录恒定。判定单源 = archive-sweep.analyze(禁第二套口径);归档单位 = 同名家族
|
|
538
|
-
// (check-loop 检查 1 的结构配对是家族双向在场审计,单篇归档会造配对断裂——源仓首批返工实证)。
|
|
539
|
-
// 时序:**台账行已写、状态已落盘之后**才 mv——check-loop 检查 15 的内容绑定按台账 doc 路径读
|
|
540
|
-
// 四目录直下文件,归档后该路径不在 buildDocList() 扫描面内,绑定检查自然跳过(归档件不再受
|
|
541
|
-
// 内容绑定约束,与既有归档批次同口径)。失败一律 fail-open:归档是卫生动作,不得回滚已完成的
|
|
542
|
-
// 确认(**归档失败不阻断关单**——与源仓语义逐字一致)。启用锚(照搬源仓,无 policy 锚):
|
|
543
|
-
// ① 仓库已建立归档约定(workflow/archive/ 存在)——真实装户仓有,临时 fixture 无,避免测试夹具
|
|
544
|
-
// 被静默搬走(也避免在未采纳归档的仓库里凭空造目录);② env 逃生门 CONFIRM_DOC_NO_ARCHIVE;
|
|
545
|
-
// ③ 特性分支默认不归档(2026-10-16 自源仓 13f67ef7 回灌):分支上先关单再合并时,diff 只剩
|
|
546
|
-
// archive/ 路径,泳道/配对增量门只认 workflow 活跃直路径,合法合并被拦。main/master/develop 与
|
|
547
|
-
// 游离 HEAD 维持关单即归档。CONFIRM_DOC_NO_ARCHIVE=1 仍强制关;CONFIRM_DOC_ARCHIVE=1 可在特性分支强制归档。
|
|
548
|
-
const archiveRoot = path.join(root, 'workflow', 'archive');
|
|
549
|
-
let featureHold = false;
|
|
550
|
-
if (confirmed > 0 && !process.env.CONFIRM_DOC_NO_ARCHIVE && process.env.CONFIRM_DOC_ARCHIVE !== '1') {
|
|
551
|
-
let branch = '';
|
|
552
|
-
try { branch = execFileSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: root, encoding: 'utf8' }).trim(); } catch { branch = ''; }
|
|
553
|
-
featureHold = !!branch && branch !== 'HEAD' && !['main', 'master', 'develop'].includes(branch);
|
|
554
|
-
if (featureHold && fs.existsSync(archiveRoot)) {
|
|
555
|
-
console.log(`📦 特性分支 ${branch} 不归档(合并前保持 workflow 活跃路径;main/develop 关单才归档)。CONFIRM_DOC_ARCHIVE=1 可强制`);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
if (confirmed > 0 && !process.env.CONFIRM_DOC_NO_ARCHIVE && !featureHold && fs.existsSync(archiveRoot)) {
|
|
559
|
-
try {
|
|
560
|
-
const { analyze, buildDocList, loadLastTouch, parseStatus, TERMINAL, ACTIVE } = await import('./archive-sweep.mjs');
|
|
561
|
-
// 台账终态锚:kit 读侧单源 = readLedgerRows(主台账+分片透明合并;源仓走
|
|
562
|
-
// loadAllConfirmations——「每 doc 终态行最大日期」的 max 判据对去重口径无语义差,
|
|
563
|
-
// 见 archive-sweep.loadLedgerTs 同款注释)。CONFIRM_DOC_TEST_NOW 仅测试注入,生产不设。
|
|
564
|
-
const ledgerTs = {};
|
|
565
|
-
for (const e of readLedgerRows(root)) {
|
|
566
|
-
if (TERMINAL.has(e.stage) && e.doc) {
|
|
567
|
-
const d = (e.ts || '').slice(0, 10);
|
|
568
|
-
if (d && (!ledgerTs[e.doc] || d > ledgerTs[e.doc])) ledgerTs[e.doc] = d;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
const allDocs = buildDocList(root);
|
|
572
|
-
// 窗口口径:本次确认的文档**刚**落终态,其台账 ts = 今日 → 21 天窗口必然拦下(窗口的用途是
|
|
573
|
-
// 「防归档仍在编辑的在途件」,而刚过确认门的终态件按定义已定稿,窗口对它冗余)。故对本进程
|
|
574
|
-
// 确认过的家族用 windowDays=-1(判据 `floor((today-tTime)/864e5) <= windowDays` 恒 false = 窗口
|
|
575
|
-
// 关闭;注意 0 不等于关闭——0 表示「同日也算未满窗」);未涉及的家族不在此次归档范围(touched
|
|
576
|
-
// 过滤),历史积压仍走 archive-sweep 手工批次 + 21 天窗口。
|
|
577
|
-
const r = analyze({
|
|
578
|
-
docs: allDocs,
|
|
579
|
-
ledgerTs,
|
|
580
|
-
lastTouch: loadLastTouch(root),
|
|
581
|
-
activeTexts: allDocs.filter((d) => ACTIVE.has(parseStatus(d.text))).map((d) => d.text),
|
|
582
|
-
windowDays: -1,
|
|
583
|
-
});
|
|
584
|
-
// 只归档「本次确认涉及的家族」——不越权清理历史积压(积压走 archive-sweep 手工批次)
|
|
585
|
-
const touched = new Set(docs.map((d) => path.basename(d)));
|
|
586
|
-
const mine = r.candidates.filter((x) => touched.has(x.file));
|
|
587
|
-
if (mine.length) {
|
|
588
|
-
for (const x of mine) {
|
|
589
|
-
const destDir = path.join(root, 'workflow', 'archive', x.month, x.dir);
|
|
590
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
591
|
-
execFileSync('git', ['mv', x.rel, path.join('workflow', 'archive', x.month, x.dir, x.file)], { cwd: root });
|
|
592
|
-
}
|
|
593
|
-
const fams = new Set(mine.map((x) => x.file));
|
|
594
|
-
console.log(`📦 归档 ${mine.length} 篇 / ${fams.size} 族 → workflow/archive/<终态月>/(家族原子;活跃目录不再累积终态件)`);
|
|
595
|
-
}
|
|
596
|
-
} catch (err) {
|
|
597
|
-
console.error(`⚠️ 归档跳过(fail-open,不影响已完成的确认):${err.message}`);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
console.log(`\n完成:确认 ${confirmed} 份 / 跳过 ${docs.length - confirmed - refused} 份 / 拒绝 ${refused} 份${delegated ? '(委托代录)' : ''}`);
|
|
601
|
-
process.exit(refused ? 2 : 0);
|
|
602
|
-
}
|
|
603
|
-
export default { computeFingerprint, nextStage, applyTransition, appendLedger, fmLevel };
|