agentic-flow-kit 1.8.7 → 2.1.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/LICENSE +2 -2
- package/README.md +172 -138
- package/bin/flow-kit.mjs +7 -2
- package/locales/en/installer.json +110 -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 +69 -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 +110 -0
- package/package.json +23 -36
- package/schemas/install-manifest.schema.json +26 -0
- package/schemas/project-profile.schema.json +28 -0
- package/src/cli/args.mjs +43 -0
- package/src/cli/main.mjs +79 -0
- package/src/commands/add-host.mjs +29 -0
- package/src/commands/doctor.mjs +126 -0
- package/src/commands/install.mjs +296 -0
- package/src/commands/upgrade.mjs +30 -0
- package/src/git/config.mjs +61 -0
- package/src/hosts/registry.mjs +170 -0
- package/src/i18n.mjs +35 -0
- package/src/install/apply.mjs +138 -0
- package/src/install/frontmatter.mjs +84 -0
- package/src/install/manifest.mjs +40 -0
- package/src/install/plan.mjs +241 -0
- package/src/models/known.mjs +13 -0
- package/src/models/probe.mjs +163 -0
- package/src/models/resolve.mjs +312 -0
- package/src/render/tokens.mjs +105 -0
- package/src/tui/ansi.mjs +55 -0
- package/src/tui/flows.mjs +306 -0
- package/src/tui/prompts.mjs +139 -0
- package/src/tui/screen.mjs +217 -0
- package/src/tui/widgets.mjs +111 -0
- package/src/tui/wizard.mjs +68 -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 +60 -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 +257 -0
- package/templates/engine/.agents/config/agent-eval.json +17 -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 +63 -0
- package/templates/engine/.agents/config/memory-tiers.json +13 -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/pipeline.json +36 -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/steering.json +28 -0
- package/templates/engine/.agents/config/workflow-enums.txt +25 -0
- package/templates/engine/.agents/evals/README.md +49 -0
- package/templates/engine/.agents/evals/tasks.tsv +6 -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 +247 -0
- package/templates/engine/.agents/notes/gate-diet.md +75 -0
- package/templates/engine/.agents/notes/injected-memory.md +14 -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/notes/steering-tiers.md +28 -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/agent-eval.mjs +268 -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-pipeline-state.mjs +85 -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/claims.mjs +166 -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 +358 -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/fix-task.mjs +77 -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/memory-tier.mjs +196 -0
- package/templates/engine/.agents/scripts/memory-wiki.mjs +296 -0
- package/templates/engine/.agents/scripts/metrics-core.mjs +131 -0
- package/templates/engine/.agents/scripts/outcome-metrics.mjs +195 -0
- package/templates/engine/.agents/scripts/path-lease.mjs +177 -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/session-log.mjs +157 -0
- package/templates/engine/.agents/scripts/stage-gates.mjs +812 -0
- package/templates/engine/.agents/scripts/steering.mjs +75 -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 +858 -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 +54 -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 +82 -0
- package/templates/engine/.agents/skills/eval/SKILL.md +58 -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/model-upgrade/SKILL.md +41 -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 +76 -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 +71 -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 +56 -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 +23 -0
- package/templates/git/.githooks/commit-msg +72 -0
- package/templates/git/.githooks/package.json +3 -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/.github/workflows/ci.yml +32 -0
- package/templates/git/.gitignore.engine +11 -0
- package/templates/git/azure-pipelines.yml +46 -0
- package/templates/host-meta/SKILLS.md +3 -0
- package/templates/host-meta/claude/skill-pointer.md +6 -0
- package/templates/host-meta/cline/skill-index.md +6 -0
- package/templates/host-meta/codebuddy/skill-pointer.md +6 -0
- package/templates/host-meta/commandcode/skill-index.md +5 -0
- package/templates/host-meta/opencode/skill-pointer.md +6 -0
- package/templates/host-meta/qoder/skill-index.md +5 -0
- package/templates/host-meta/qwen/skill-index.md +5 -0
- package/templates/host-meta/trae/skill-index.md +6 -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.hardened.json +94 -0
- package/templates/hosts/claude/settings.json +55 -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 +57 -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 +61 -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 +57 -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/go/AGENTS.md +52 -0
- package/templates/profiles/java/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/profiles/rust/AGENTS.md +52 -0
- package/templates/profiles/typescript/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 +29 -0
- package/templates/scaffold/workflow/README.md +69 -0
- package/templates/scaffold/workflow/archive/README.md +3 -0
- package/templates/scaffold/workflow/artifact-sources.md +25 -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/non-engineer-intent.md +51 -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/modules/gates/README.md +0 -25
- package/modules/gates/dotnet-ca/README.md +0 -24
- package/modules/gates/dotnet-ca/check-architecture.sh +0 -150
- package/modules/gates/dotnet-ca/local-pre-commit.line +0 -1
- package/modules/gates/generated-readonly/README.md +0 -13
- package/modules/gates/generated-readonly/check-generated.mjs +0 -61
- package/modules/gates/generated-readonly/local-pre-commit.line +0 -1
- package/modules/gates/node-layer/README.md +0 -9
- package/modules/gates/node-layer/check-node-layer.mjs +0 -29
- package/modules/gates/node-layer/local-pre-commit.line +0 -1
- package/modules/gates/py-import/README.md +0 -9
- package/modules/gates/py-import/check-py-import.mjs +0 -30
- package/modules/gates/py-import/local-pre-commit.line +0 -1
- package/modules/gates/test-protect/README.md +0 -23
- package/modules/gates/test-protect/check-test-protect.mjs +0 -64
- package/modules/gates/test-protect/local-pre-commit.line +0 -1
- package/modules/hosts/README.md +0 -57
- package/modules/hosts/claude/agents/implementer.md +0 -51
- package/modules/hosts/claude/agents/independent-reviewer.md +0 -49
- package/modules/hosts/claude/agents/ui-verifier.md +0 -48
- package/modules/hosts/claude/commands/wf-build.md +0 -69
- package/modules/hosts/claude/commands/wf-deploy.md +0 -58
- package/modules/hosts/claude/commands/wf-design.md +0 -49
- package/modules/hosts/claude/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/claude/commands/wf-maintain.md +0 -76
- package/modules/hosts/claude/commands/wf-new-task.md +0 -102
- package/modules/hosts/claude/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/claude/commands/wf-plan.md +0 -40
- package/modules/hosts/claude/commands/wf-review.md +0 -49
- package/modules/hosts/claude/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/claude/commands/wf-test.md +0 -68
- package/modules/hosts/codex/agents/implementer.md +0 -51
- package/modules/hosts/codex/agents/independent-reviewer.md +0 -49
- package/modules/hosts/codex/agents/ui-verifier.md +0 -48
- package/modules/hosts/codex/commands/wf-build.md +0 -69
- package/modules/hosts/codex/commands/wf-deploy.md +0 -58
- package/modules/hosts/codex/commands/wf-design.md +0 -49
- package/modules/hosts/codex/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/codex/commands/wf-maintain.md +0 -76
- package/modules/hosts/codex/commands/wf-new-task.md +0 -102
- package/modules/hosts/codex/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/codex/commands/wf-plan.md +0 -40
- package/modules/hosts/codex/commands/wf-review.md +0 -49
- package/modules/hosts/codex/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/codex/commands/wf-test.md +0 -68
- package/modules/hosts/codex/skills/flow-kit/SKILL.md +0 -14
- package/modules/hosts/cursor/agents/implementer.md +0 -51
- package/modules/hosts/cursor/agents/independent-reviewer.md +0 -49
- package/modules/hosts/cursor/agents/ui-verifier.md +0 -48
- package/modules/hosts/cursor/commands/wf-build.md +0 -69
- package/modules/hosts/cursor/commands/wf-deploy.md +0 -58
- package/modules/hosts/cursor/commands/wf-design.md +0 -49
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/cursor/commands/wf-maintain.md +0 -76
- package/modules/hosts/cursor/commands/wf-new-task.md +0 -102
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/cursor/commands/wf-plan.md +0 -40
- package/modules/hosts/cursor/commands/wf-review.md +0 -49
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/cursor/commands/wf-test.md +0 -68
- package/modules/hosts/omp/agents/implementer.md +0 -52
- package/modules/hosts/omp/agents/independent-reviewer.md +0 -50
- package/modules/hosts/omp/agents/ui-verifier.md +0 -49
- package/modules/hosts/opencode/agents/implementer.md +0 -59
- package/modules/hosts/opencode/agents/independent-reviewer.md +0 -53
- package/modules/hosts/opencode/agents/ui-verifier.md +0 -52
- package/modules/hosts/opencode/commands/wf-build.md +0 -69
- package/modules/hosts/opencode/commands/wf-deploy.md +0 -58
- package/modules/hosts/opencode/commands/wf-design.md +0 -49
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/opencode/commands/wf-maintain.md +0 -76
- package/modules/hosts/opencode/commands/wf-new-task.md +0 -102
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/opencode/commands/wf-plan.md +0 -40
- package/modules/hosts/opencode/commands/wf-review.md +0 -49
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/opencode/commands/wf-test.md +0 -68
- package/modules/hosts/trae/agents/implementer.md +0 -52
- package/modules/hosts/trae/agents/independent-reviewer.md +0 -51
- package/modules/hosts/trae/agents/ui-verifier.md +0 -50
- package/modules/hosts/trae/commands/wf-build.md +0 -70
- package/modules/hosts/trae/commands/wf-deploy.md +0 -59
- package/modules/hosts/trae/commands/wf-design.md +0 -50
- package/modules/hosts/trae/commands/wf-gate-checklist.md +0 -78
- package/modules/hosts/trae/commands/wf-maintain.md +0 -77
- package/modules/hosts/trae/commands/wf-new-task.md +0 -103
- package/modules/hosts/trae/commands/wf-pipeline-run.md +0 -36
- package/modules/hosts/trae/commands/wf-plan.md +0 -41
- package/modules/hosts/trae/commands/wf-review.md +0 -50
- package/modules/hosts/trae/commands/wf-sync-hosts.md +0 -65
- package/modules/hosts/trae/commands/wf-test.md +0 -69
- package/modules/hosts/trae/hooks/post-edit-check.cjs +0 -98
- package/modules/hosts/trae/hooks/pre-shell-check.cjs +0 -192
- package/modules/hosts/trae/hooks/resolve-shell.cjs +0 -30
- package/modules/hosts/trae/hooks.json +0 -29
- package/modules/hosts/trae/rules/beautify-input-chinese.md +0 -6
- package/modules/hosts/trae/rules/git-commit-message.md +0 -10
- package/modules/hosts/trae/rules/project-workflow.md +0 -14
- package/modules/hosts/zcode/agents/implementer.md +0 -51
- package/modules/hosts/zcode/agents/independent-reviewer.md +0 -49
- package/modules/hosts/zcode/agents/ui-verifier.md +0 -48
- package/src/add-gate.mjs +0 -116
- package/src/add-gate.test.mjs +0 -103
- package/src/add-host.mjs +0 -68
- package/src/cli.mjs +0 -169
- package/src/doctor.mjs +0 -629
- package/src/executor.mjs +0 -262
- package/src/executor.test.mjs +0 -295
- package/src/fresh-init.test.mjs +0 -64
- package/src/gate-dotnet-ca.test.mjs +0 -124
- package/src/gates.test.mjs +0 -143
- package/src/init.mjs +0 -382
- package/src/init.test.mjs +0 -163
- package/src/instance-ref.test.mjs +0 -62
- package/src/jscpd-drift.test.mjs +0 -145
- package/src/pack.test.mjs +0 -24
- package/src/profiles.mjs +0 -183
- package/src/render.mjs +0 -132
- package/src/rule-budget.test.mjs +0 -103
- package/src/run-tests.mjs +0 -56
- package/src/stack-profile.test.mjs +0 -95
- package/src/sync-hosts.mjs +0 -257
- package/src/sync-hosts.test.mjs +0 -291
- package/src/sync.mjs +0 -228
- package/src/sync.test.mjs +0 -452
- package/src/trae-hooks.test.mjs +0 -127
- package/src/validate.mjs +0 -77
- package/src/validate.test.mjs +0 -95
- package/templates/.gitattributes +0 -17
- package/templates/AGENTS.md +0 -58
- package/templates/_agents/board/index.html +0 -676
- package/templates/_agents/commands/build.md +0 -84
- package/templates/_agents/commands/deploy.md +0 -66
- package/templates/_agents/commands/design.md +0 -63
- package/templates/_agents/commands/gate-checklist.md +0 -91
- package/templates/_agents/commands/maintain.md +0 -90
- package/templates/_agents/commands/new-task.md +0 -110
- package/templates/_agents/commands/pipeline-run.md +0 -43
- package/templates/_agents/commands/plan.md +0 -48
- package/templates/_agents/commands/review.md +0 -62
- package/templates/_agents/commands/sync-hosts.md +0 -77
- package/templates/_agents/commands/test.md +0 -87
- package/templates/_agents/control-surfaces.txt +0 -53
- package/templates/_agents/engine-lock.json +0 -342
- package/templates/_agents/hooks/check-index-incremental.mjs +0 -48
- package/templates/_agents/hooks/check-pairing-incremental.mjs +0 -66
- package/templates/_agents/hooks/check-wiki-ledger.mjs +0 -30
- package/templates/_agents/hooks/commit-check.cjs +0 -193
- package/templates/_agents/hooks/local-pre-commit +0 -6
- package/templates/_agents/lane-surfaces.txt +0 -17
- package/templates/_agents/level-hints.txt +0 -30
- package/templates/_agents/loop/papercut-debt/DESIGN.md +0 -112
- package/templates/_agents/mechanism-registry.md +0 -35
- package/templates/_agents/metric-claims.txt +0 -81
- package/templates/_agents/notes/engine-internals.md +0 -17
- package/templates/_agents/notes/runtime-env.md +0 -18
- package/templates/_agents/roles/implementer.md +0 -47
- package/templates/_agents/roles/independent-reviewer.md +0 -45
- package/templates/_agents/roles/ui-verifier.md +0 -44
- package/templates/_agents/rule-budgets.txt +0 -20
- package/templates/_agents/scripts/agg-delegations.cjs +0 -302
- package/templates/_agents/scripts/agg-delegations.test.mjs +0 -282
- package/templates/_agents/scripts/agg-gate-stats.mjs +0 -113
- package/templates/_agents/scripts/agg-gate-stats.test.mjs +0 -95
- package/templates/_agents/scripts/agg-judgments.mjs +0 -156
- package/templates/_agents/scripts/agg-judgments.test.mjs +0 -93
- package/templates/_agents/scripts/archive-sweep.mjs +0 -235
- package/templates/_agents/scripts/archive-sweep.test.mjs +0 -129
- package/templates/_agents/scripts/check-attribution.mjs +0 -37
- package/templates/_agents/scripts/check-convergence.mjs +0 -124
- package/templates/_agents/scripts/check-engine-integrity.mjs +0 -220
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +0 -215
- package/templates/_agents/scripts/check-funnel.mjs +0 -56
- package/templates/_agents/scripts/check-hygiene.mjs +0 -167
- package/templates/_agents/scripts/check-hygiene.test.mjs +0 -182
- package/templates/_agents/scripts/check-index-incremental.test.mjs +0 -73
- package/templates/_agents/scripts/check-lane-surface.mjs +0 -238
- package/templates/_agents/scripts/check-lane-surface.test.mjs +0 -302
- package/templates/_agents/scripts/check-ledger-invariant.mjs +0 -586
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +0 -639
- package/templates/_agents/scripts/check-loop-rev.test.mjs +0 -336
- package/templates/_agents/scripts/check-loop-unit.test.mjs +0 -103
- package/templates/_agents/scripts/check-loop.mjs +0 -1987
- package/templates/_agents/scripts/check-loop.sh +0 -6
- package/templates/_agents/scripts/check-loop.test.mjs +0 -3912
- package/templates/_agents/scripts/check-metric-claims.mjs +0 -277
- package/templates/_agents/scripts/check-prejudgment.mjs +0 -64
- package/templates/_agents/scripts/check-registry.mjs +0 -45
- package/templates/_agents/scripts/check-scope.mjs +0 -96
- package/templates/_agents/scripts/check-scope.test.mjs +0 -99
- package/templates/_agents/scripts/check-scripts-syntax.mjs +0 -84
- package/templates/_agents/scripts/check-scripts-syntax.test.mjs +0 -72
- package/templates/_agents/scripts/check-spec-verif.mjs +0 -47
- package/templates/_agents/scripts/check-stage-index.mjs +0 -40
- package/templates/_agents/scripts/check-stage-index.test.mjs +0 -77
- package/templates/_agents/scripts/closeout-l1.mjs +0 -217
- package/templates/_agents/scripts/closeout-l1.test.mjs +0 -105
- package/templates/_agents/scripts/commit-check-trigger.test.mjs +0 -205
- package/templates/_agents/scripts/compact-ledgers.mjs +0 -97
- package/templates/_agents/scripts/compact-ledgers.test.mjs +0 -162
- package/templates/_agents/scripts/confirm-doc.mjs +0 -610
- package/templates/_agents/scripts/confirm-doc.test.mjs +0 -1119
- package/templates/_agents/scripts/doctor.test.mjs +0 -770
- package/templates/_agents/scripts/draft-sediment.mjs +0 -178
- package/templates/_agents/scripts/draft-sediment.test.mjs +0 -272
- package/templates/_agents/scripts/edit-face-check.mjs +0 -109
- package/templates/_agents/scripts/edit-face-check.test.mjs +0 -99
- package/templates/_agents/scripts/ensure-board.mjs +0 -185
- package/templates/_agents/scripts/fill-intent.mjs +0 -91
- package/templates/_agents/scripts/fill-intent.test.mjs +0 -113
- package/templates/_agents/scripts/fill-plan.mjs +0 -79
- package/templates/_agents/scripts/fill-plan.test.mjs +0 -224
- package/templates/_agents/scripts/fill-spec.mjs +0 -70
- package/templates/_agents/scripts/fill-spec.test.mjs +0 -266
- package/templates/_agents/scripts/fixture-scripts.mjs +0 -153
- package/templates/_agents/scripts/fixture-scripts.test.mjs +0 -112
- package/templates/_agents/scripts/gate-checklist.mjs +0 -209
- package/templates/_agents/scripts/gate-checklist.test.mjs +0 -201
- package/templates/_agents/scripts/gate-seg.mjs +0 -54
- package/templates/_agents/scripts/gate-seg.test.mjs +0 -112
- package/templates/_agents/scripts/gen-effective-policy.mjs +0 -107
- package/templates/_agents/scripts/gen-effective-policy.test.mjs +0 -100
- package/templates/_agents/scripts/gen-verify-evidence.mjs +0 -107
- package/templates/_agents/scripts/gen-verify-evidence.test.mjs +0 -84
- package/templates/_agents/scripts/gen-wiki-board.mjs +0 -276
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +0 -249
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +0 -251
- package/templates/_agents/scripts/gen-workflow-dashboard.test.mjs +0 -188
- package/templates/_agents/scripts/gen-workflow-index.mjs +0 -201
- package/templates/_agents/scripts/gen-workflow-index.test.mjs +0 -152
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +0 -466
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +0 -343
- package/templates/_agents/scripts/git-merge-jsonl.mjs +0 -63
- package/templates/_agents/scripts/git-merge-jsonl.test.mjs +0 -125
- package/templates/_agents/scripts/judgment-ledger.mjs +0 -65
- package/templates/_agents/scripts/judgment-ledger.test.mjs +0 -129
- package/templates/_agents/scripts/kb-cache-evict.mjs +0 -50
- package/templates/_agents/scripts/kb-cache-evict.test.mjs +0 -104
- package/templates/_agents/scripts/kb-search.mjs +0 -413
- package/templates/_agents/scripts/kb-search.test.mjs +0 -299
- package/templates/_agents/scripts/lane-surface-audit.mjs +0 -143
- package/templates/_agents/scripts/lane-surface-audit.test.mjs +0 -93
- package/templates/_agents/scripts/ledger-doc-chain.test.mjs +0 -166
- package/templates/_agents/scripts/ledger-loader.mjs +0 -108
- package/templates/_agents/scripts/ledger-loader.test.mjs +0 -131
- package/templates/_agents/scripts/ledger-prune.mjs +0 -96
- package/templates/_agents/scripts/ledger-prune.test.mjs +0 -120
- package/templates/_agents/scripts/ledger-shards.mjs +0 -344
- package/templates/_agents/scripts/ledger-shards.test.mjs +0 -356
- package/templates/_agents/scripts/ledger-ts-monotonic.test.mjs +0 -135
- package/templates/_agents/scripts/level-criteria.mjs +0 -231
- package/templates/_agents/scripts/level-criteria.test.mjs +0 -281
- package/templates/_agents/scripts/mechanism-retire-watch.mjs +0 -183
- package/templates/_agents/scripts/mechanism-retire-watch.test.mjs +0 -114
- package/templates/_agents/scripts/papercut-debt-controller.mjs +0 -141
- package/templates/_agents/scripts/papercut-debt-controller.test.mjs +0 -127
- package/templates/_agents/scripts/papercut-debt-sensor.mjs +0 -170
- package/templates/_agents/scripts/papercut-debt-sensor.test.mjs +0 -146
- package/templates/_agents/scripts/pipeline-run-docs.mjs +0 -76
- package/templates/_agents/scripts/pipeline-run-run.mjs +0 -63
- package/templates/_agents/scripts/pipeline-run.mjs +0 -867
- package/templates/_agents/scripts/pipeline-run.test.mjs +0 -517
- package/templates/_agents/scripts/policy.mjs +0 -281
- package/templates/_agents/scripts/pre-push.test.mjs +0 -105
- package/templates/_agents/scripts/resolve-merge-conflicts.mjs +0 -110
- package/templates/_agents/scripts/resolve-merge-conflicts.test.mjs +0 -87
- package/templates/_agents/scripts/rewrite-file.mjs +0 -133
- package/templates/_agents/scripts/rewrite-file.test.mjs +0 -148
- package/templates/_agents/scripts/rule-budget.mjs +0 -96
- package/templates/_agents/scripts/rule-budget.test.mjs +0 -118
- package/templates/_agents/scripts/run-tests.mjs +0 -99
- package/templates/_agents/scripts/run-tests.test.mjs +0 -105
- package/templates/_agents/scripts/solidify-task.mjs +0 -109
- package/templates/_agents/scripts/solidify-task.test.mjs +0 -129
- package/templates/_agents/scripts/stage-gates.mjs +0 -343
- package/templates/_agents/scripts/stage-gates.test.mjs +0 -105
- package/templates/_agents/scripts/trust-mode.mjs +0 -67
- package/templates/_agents/scripts/trust-mode.test.mjs +0 -110
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +0 -253
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +0 -123
- package/templates/_agents/scripts/verify.mjs +0 -345
- package/templates/_agents/scripts/verify.test.mjs +0 -373
- package/templates/_agents/scripts/wf-journal.mjs +0 -231
- package/templates/_agents/scripts/wf-journal.test.mjs +0 -216
- package/templates/_agents/scripts/wiki-search.mjs +0 -19
- package/templates/_agents/scripts/wiki-search.test.mjs +0 -57
- package/templates/_agents/scripts/workflow-board-server.mjs +0 -393
- package/templates/_agents/scripts/workflow-board-server.test.mjs +0 -201
- package/templates/_agents/scripts/workflow-enums.mjs +0 -70
- package/templates/_agents/scripts/workflow-enums.test.mjs +0 -118
- package/templates/_agents/scripts/workflows-check.mjs +0 -260
- package/templates/_agents/scripts/workflows-check.test.mjs +0 -278
- package/templates/_agents/scripts-test-exempt.txt +0 -16
- package/templates/_agents/skills/papercut-fix/SKILL.md +0 -60
- package/templates/_agents/skills/papercut-fix/references/response-template.md +0 -81
- package/templates/_agents/skills/review-method/SKILL.md +0 -58
- package/templates/_agents/skills/verify-ui/SKILL.md +0 -61
- package/templates/_agents/skills/wiki/SKILL.md +0 -106
- package/templates/_agents/workflow-enums.txt +0 -26
- package/templates/_agents/workflow-modules.txt +0 -11
- package/templates/_agents/workflows/_TEMPLATE.md +0 -75
- package/templates/_agents/workflows/pipeline-closing.md +0 -28
- package/templates/_agents/workflows//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +0 -16
- package/templates/_githooks/commit-msg +0 -17
- package/templates/_githooks/post-commit +0 -10
- package/templates/_githooks/pre-commit +0 -126
- package/templates/_githooks/pre-merge-commit +0 -29
- package/templates/_githooks/pre-push +0 -136
- package/templates/_github/workflows/kit-ci.yml +0 -49
- package/templates/wiki/INDEX.md +0 -73
- package/templates/wiki/drafts-archive/README.md +0 -3
- package/templates/wiki//344/272/247/345/223/201/351/234/200/346/261/202/README.md +0 -3
- package/templates/wiki//345/274/200/345/217/221/346/226/271/346/241/210/README.md +0 -3
- package/templates/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +0 -3
- package/templates/wiki//346/265/213/350/257/225/346/212/245/345/221/212/README.md +0 -3
- package/templates/wiki//347/224/250/346/210/267/345/212/237/350/203/275/README.md +0 -3
- package/templates/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +0 -77
- package/templates/wiki//351/241/271/347/233/256/350/247/204/350/214/203/README.md +0 -3
- package/templates/wiki//351/241/271/347/233/256/350/256/241/345/210/222/README.md +0 -3
- package/templates/workflow/README.md +0 -91
- package/templates/workflow/delegations.md +0 -29
- package/templates/workflow/incidents/_TEMPLATE.md +0 -51
- package/templates/workflow/intents/_TEMPLATE.md +0 -51
- package/templates/workflow/papercuts.md +0 -9
- package/templates/workflow/plans/_TEMPLATE.md +0 -47
- package/templates/workflow/regression-checklist.md +0 -23
- package/templates/workflow/specs/_TEMPLATE.md +0 -80
- /package/templates/{_agents → engine/.agents}/board/marked.min.js +0 -0
- /package/templates/{_agents/workflows → engine/.agents/pipelines}/steps//347/244/272/344/276/213-/351/203/250/347/275/262/351/252/214/350/257/201.md" +0 -0
- /package/templates/{_agents → engine/.agents}/scripts/git-core.mjs +0 -0
|
@@ -1,1119 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// confirm-doc.test.mjs — 用户确认门测试(2026-09-26 confirm-gate-machine;2026-09-27 confirm-gate-delegated 补委托场景)
|
|
3
|
-
// 判据:① 指纹算法(CRLF 归一 / 剔指纹行防自引用 / 内容敏感) ② 跳转唯一合法性 ③ 落态只动两行
|
|
4
|
-
// ④ 台账追加 schema ⑤ 核心——非 TTY spawn(模拟 AI 调用路径)无 --delegated 必须被拒
|
|
5
|
-
// ⑥ 委托代录(--delegated):免 TTY 落态 + 台账如实记 source/quote;空原话拒跑
|
|
6
|
-
// ⑦ 逐阶段前置门(2026-09-30 stage-gate-machine):specs/plans 的 draft→approved 须入口(plan 另须
|
|
7
|
-
// L2/L3 时同名 spec)已确认;未过 → exit 2 + 未落盘未记账(S19-S22)
|
|
8
|
-
// ⑧ done 前置门(2026-09-30 confirm-gate-approved-history):→done 须 git 历史已留 approved 态
|
|
9
|
-
// (先 done 后提交 / 两跳同批提交 → 拒绝);非 git / legacy / 存量豁免声明 → 跳过(S25-S29)
|
|
10
|
-
// ⑨ 关单即归档(2026-10-13 archive-on-close,B9 自源仓回灌):终态家族即时 git mv 进 archive、
|
|
11
|
-
// 未涉及家族不越权清理、无归档约定不启用、CONFIRM_DOC_NO_ARCHIVE 逃生门(S43-S45)
|
|
12
|
-
// 用法:node templates/_agents/scripts/confirm-doc.test.mjs(npm test 随跑)
|
|
13
|
-
import fs from 'node:fs';
|
|
14
|
-
import os from 'node:os';
|
|
15
|
-
import path from 'node:path';
|
|
16
|
-
import { spawnSync } from 'node:child_process';
|
|
17
|
-
import { fileURLToPath } from 'node:url';
|
|
18
|
-
import { computeFingerprint, nextStage, applyTransition, appendLedger, resolveTransition, machineScope } from './confirm-doc.mjs';
|
|
19
|
-
import { scopeDigest, scopeMatches } from './policy.mjs';
|
|
20
|
-
|
|
21
|
-
let pass = 0;
|
|
22
|
-
let fail = 0;
|
|
23
|
-
const check = (desc, cond, detail = '') => {
|
|
24
|
-
if (cond) { pass++; console.log(`PASS ${desc}`); }
|
|
25
|
-
else { fail++; console.log(`FAIL ${desc}${detail ? '\n ' + detail : ''}`); }
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
29
|
-
const CLI = path.join(SCRIPT_DIR, 'confirm-doc.mjs');
|
|
30
|
-
|
|
31
|
-
// 台账读取 helper(2026-09-30 复核 P2-1):缺失/空行 → 安全返回([])——防「门拒路径下台账未生成」时
|
|
32
|
-
// 未捕获 ENOENT 截断后续用例(注入验证实证:原裸读在门失效时崩溃、无「合计」行)
|
|
33
|
-
const readLedgerOf = (root) => {
|
|
34
|
-
const p = path.join(root, '.agents', 'confirmations.jsonl');
|
|
35
|
-
if (!fs.existsSync(p)) return [];
|
|
36
|
-
return fs.readFileSync(p, 'utf8').split('\n').filter(Boolean).map((l) => JSON.parse(l));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// ---- S1 指纹:CRLF 归一(同内容不同行尾同指纹)----
|
|
40
|
-
{
|
|
41
|
-
const lf = '---\n状态: draft\n---\n正文';
|
|
42
|
-
const crlf = lf.replace(/\n/g, '\r\n');
|
|
43
|
-
check('S1 CRLF 归一——同内容不同行尾指纹相同', computeFingerprint(lf) === computeFingerprint(crlf));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ---- S2 指纹:剔「确认指纹:」行(防自引用——加指纹行不改指纹)----
|
|
47
|
-
{
|
|
48
|
-
const a = '---\n状态: draft\n---\n正文';
|
|
49
|
-
const b = '---\n状态: draft\n确认指纹: abc123\n---\n正文';
|
|
50
|
-
check('S2 指纹行不参与指纹计算(防自引用)', computeFingerprint(a) === computeFingerprint(b));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// ---- S3 指纹:内容敏感(一字之差指纹不同;64 位 hex)----
|
|
54
|
-
{
|
|
55
|
-
const fp1 = computeFingerprint('---\n状态: draft\n---\n正文A');
|
|
56
|
-
const fp2 = computeFingerprint('---\n状态: draft\n---\n正文B');
|
|
57
|
-
check('S3 内容敏感且为 64 位 hex', fp1 !== fp2 && /^[0-9a-f]{64}$/.test(fp1));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// ---- S4 nextStage:合法前向跳转(docs 两跳 + incidents 两跳,2026-09-27 gate-coverage)----
|
|
61
|
-
{
|
|
62
|
-
check('S4 跳转表:draft→approved、approved→done、done/空/自造值→null',
|
|
63
|
-
nextStage('draft') === 'approved' && nextStage('approved') === 'done'
|
|
64
|
-
&& nextStage('done') === null && nextStage('') === null && nextStage('进行中') === null);
|
|
65
|
-
check('S4 incidents 跳转表:open→fixed、fixed→closed、closed→null(无 open→closed 单跳)',
|
|
66
|
-
nextStage('open') === 'fixed' && nextStage('fixed') === 'closed'
|
|
67
|
-
&& nextStage('closed') === null && nextStage('open') !== 'closed');
|
|
68
|
-
// --to 放弃态跳转表(2026-09-27 closing-coverage):cancelled 自未确认/进行态;superseded 自已确认态
|
|
69
|
-
const cancelOk = ['draft', 'approved', 'open', 'fixed'].every((s) => resolveTransition(s, 'cancelled') === 'cancelled');
|
|
70
|
-
const supersedeOk = ['approved', 'done', 'fixed', 'closed'].every((s) => resolveTransition(s, 'superseded') === 'superseded');
|
|
71
|
-
check('S4 --to 合法表:cancelled×{draft,approved,open,fixed} / superseded×{approved,done,fixed,closed} 全通',
|
|
72
|
-
cancelOk && supersedeOk);
|
|
73
|
-
check('S4 --to 非法表:draft→superseded / open→superseded / done→cancelled / cancelled→cancelled / 非法目标值 全拒',
|
|
74
|
-
resolveTransition('draft', 'superseded') === null && resolveTransition('open', 'superseded') === null
|
|
75
|
-
&& resolveTransition('done', 'cancelled') === null && resolveTransition('cancelled', 'cancelled') === null
|
|
76
|
-
&& resolveTransition('approved', 'deleted') === null && resolveTransition('approved', null) === 'done');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// ---- S5 applyTransition:只动状态行 + 增指纹行,正文逐字节原样 ----
|
|
80
|
-
{
|
|
81
|
-
const src = '---\n状态: draft\n级别: L2\n---\n\n# PLAN — x\n\n正文含 状态: 假行 不受影响';
|
|
82
|
-
const out = applyTransition(src, 'approved', 'a3f9000000000000');
|
|
83
|
-
check('S5 落态:状态行改值、指纹行追加、级别行与正文原样',
|
|
84
|
-
out.startsWith('---\n状态: approved\n级别: L2\n确认指纹: a3f9000000000000\n---\n\n# PLAN — x\n\n正文含 状态: 假行 不受影响'),
|
|
85
|
-
JSON.stringify(out));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// ---- S6 applyTransition:已有指纹行则覆盖(done 跳换新指纹)----
|
|
89
|
-
{
|
|
90
|
-
const src = '---\n状态: approved\n确认指纹: old\n---\nX';
|
|
91
|
-
const out = applyTransition(src, 'done', 'new1234567890abcd');
|
|
92
|
-
check('S6 已有指纹行覆盖为新值', out.includes('状态: done') && out.includes('确认指纹: new1234567890abcd') && !out.includes('old'));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// ---- S7 applyTransition:无 frontmatter → null 不写 ----
|
|
96
|
-
{
|
|
97
|
-
check('S7 无 frontmatter 返回 null', applyTransition('# 无 fm\n状态: draft', 'approved', 'x') === null);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ---- S8 appendLedger:追加行 schema(ts/doc/stage/fingerprint/prev)----
|
|
101
|
-
{
|
|
102
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-led-'));
|
|
103
|
-
appendLedger(root, { ts: 'T', doc: 'workflow/plans/a.md', stage: 'approved', fingerprint: 'f'.repeat(64), prev: 'draft' });
|
|
104
|
-
const lines = fs.readFileSync(path.join(root, '.agents', 'confirmations.jsonl'), 'utf8').trim().split('\n');
|
|
105
|
-
const j = JSON.parse(lines[0]);
|
|
106
|
-
check('S8 台账追加且 schema 齐', lines.length === 1 && j.doc === 'workflow/plans/a.md' && j.stage === 'approved' && j.fingerprint.length === 64 && j.prev === 'draft');
|
|
107
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// ---- S8b 哈希链(2026-10-09 engine-quality-round2 D):链字段写入 + 接续 + 重算自洽 ----
|
|
111
|
-
{
|
|
112
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-chain-'));
|
|
113
|
-
// 先写一行无 hash 的「存量」行(模拟 v1.5.0 前台账)——新行 prevHash 应为 ''(链重启)
|
|
114
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
115
|
-
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), JSON.stringify({ ts: 'T0', doc: 'workflow/plans/old.md', stage: 'done', fingerprint: 'e'.repeat(64), prev: 'approved' }) + '\n');
|
|
116
|
-
appendLedger(root, { ts: 'T1', doc: 'workflow/plans/a.md', stage: 'approved', fingerprint: 'f'.repeat(64), prev: 'draft' });
|
|
117
|
-
appendLedger(root, { ts: 'T2', doc: 'workflow/plans/a.md', stage: 'done', fingerprint: 'g'.repeat(64), prev: 'approved' });
|
|
118
|
-
const rows = fs.readFileSync(path.join(root, '.agents', 'confirmations.jsonl'), 'utf8').trim().split('\n').map((l) => JSON.parse(l));
|
|
119
|
-
check('S8b 存量行后首链行 prevHash 为空(链重启,历史零回填)', rows[0].hash === undefined && rows[1].prevHash === '');
|
|
120
|
-
check('S8b 第二链行 prevHash 接续第一链行 hash', rows[2].prevHash === rows[1].hash);
|
|
121
|
-
const { ledgerChainHash } = await import('./policy.mjs');
|
|
122
|
-
const recompute = (row) => { const { hash, prevHash, ...rest } = row; return ledgerChainHash(rest, prevHash) === hash; };
|
|
123
|
-
check('S8b 两链行 hash 重算自洽(CRLF/键序规范化单源)', recompute(rows[1]) && recompute(rows[2]));
|
|
124
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// ---- S9【核心】非 TTY spawn(AI 调用路径)必须被拒 ----
|
|
128
|
-
{
|
|
129
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-tty-'));
|
|
130
|
-
const docP = path.join(root, 'workflow', 'plans');
|
|
131
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
132
|
-
fs.writeFileSync(path.join(docP, '2026-09-27-x.md'), '---\n状态: draft\n---\n# P');
|
|
133
|
-
// spawnSync 无 TTY(管道 stdin)——模拟 AI 会话内调用;即使参数完全合法也必须拒绝
|
|
134
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-27-x.md'], { cwd: root, encoding: 'utf8', input: '可以\n' });
|
|
135
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-27-x.md'), 'utf8');
|
|
136
|
-
check('S9 非 TTY 调用被拒:exit 1 + 提示 + 文档未被改动(AI 无法代确认)',
|
|
137
|
-
r.status === 1 && /不可代确认/.test(r.stderr) && after === '---\n状态: draft\n---\n# P',
|
|
138
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, after }));
|
|
139
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// ---- S10 非 TTY 拒绝先于参数校验(无参数同拒)----
|
|
143
|
-
{
|
|
144
|
-
const r = spawnSync(process.execPath, [CLI], { encoding: 'utf8' });
|
|
145
|
-
check('S10 TTY 门最先(无参数也是拒绝而非用法提示)', r.status === 1 && /不可代确认/.test(r.stderr));
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// ---- S11 委托代录:非 TTY spawn + --delegated → 免 TTY 落态 + 台账如实记 source/quote ----
|
|
149
|
-
{
|
|
150
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-del-'));
|
|
151
|
-
const docP = path.join(root, 'workflow', 'plans');
|
|
152
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
153
|
-
fs.writeFileSync(path.join(docP, '2026-09-27-d.md'), '---\n状态: draft\n级别: L2\n---\n# P\n');
|
|
154
|
-
// 逐阶段门夹具(2026-09-30 stage-gate-machine):plan 批准须先有已确认入口——
|
|
155
|
-
// 入口用存量口径(日期早于 confirmDocsEffective)免台账;级别 L1 免 spec 档
|
|
156
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
157
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-d.md'), '---\n状态: approved\n级别: L1\n日期: 2026-01-01\n---\n# I(S11 入口夹具)\n');
|
|
158
|
-
const before = fs.readFileSync(path.join(docP, '2026-09-27-d.md'), 'utf8');
|
|
159
|
-
const fpExpect = computeFingerprint(before);
|
|
160
|
-
// spawnSync 无 TTY(管道 stdin)——模拟 AI 会话内委托代录调用
|
|
161
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-27-d.md', '--delegated', '2选2'], { cwd: root, encoding: 'utf8' });
|
|
162
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-27-d.md'), 'utf8');
|
|
163
|
-
const led = readLedgerOf(root);
|
|
164
|
-
const j = led[led.length - 1];
|
|
165
|
-
check('S11 委托代录:exit 0 + draft→approved + 指纹行 + 台账 source=chat-delegated / quote=原话 / 指纹全量与 frontmatter 前 16 位配对',
|
|
166
|
-
r.status === 0 && after.includes('状态: approved') && after.includes(`确认指纹: ${fpExpect.slice(0, 16)}`)
|
|
167
|
-
&& j.source === 'chat-delegated' && j.quote === '2选2' && j.stage === 'approved' && j.prev === 'draft'
|
|
168
|
-
&& j.fingerprint === fpExpect,
|
|
169
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, ledger: led }));
|
|
170
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// ---- S12 委托代录第二跳:approved→done 换新指纹(台账行仍如实记来源)----
|
|
174
|
-
{
|
|
175
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-del2-'));
|
|
176
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
177
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
178
|
-
const fp1 = computeFingerprint('---\n状态: draft\n---\n# I\n');
|
|
179
|
-
fs.writeFileSync(path.join(docP, '2026-09-27-e.md'), `---\n状态: approved\n确认指纹: ${fp1.slice(0, 16)}\n---\n# I\n`);
|
|
180
|
-
const before = fs.readFileSync(path.join(docP, '2026-09-27-e.md'), 'utf8');
|
|
181
|
-
const fp2 = computeFingerprint(before);
|
|
182
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-e.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
183
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-27-e.md'), 'utf8');
|
|
184
|
-
const led = readLedgerOf(root);
|
|
185
|
-
check('S12 委托第二跳:approved→done + 指纹行换新值 + 台账 stage=done / source 如实',
|
|
186
|
-
r.status === 0 && after.includes('状态: done') && after.includes(`确认指纹: ${fp2.slice(0, 16)}`) && !after.includes(fp1.slice(0, 16))
|
|
187
|
-
&& led[led.length - 1].stage === 'done' && led[led.length - 1].source === 'chat-delegated',
|
|
188
|
-
JSON.stringify({ status: r.status, after }));
|
|
189
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
// ---- S13 委托代录:--delegated 空原话 → exit 1 用法提示,零文件改动 ----
|
|
193
|
-
{
|
|
194
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-del3-'));
|
|
195
|
-
const docP = path.join(root, 'workflow', 'plans');
|
|
196
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
197
|
-
fs.writeFileSync(path.join(docP, '2026-09-27-f.md'), '---\n状态: draft\n---\n# P\n');
|
|
198
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-27-f.md', '--delegated', ' '], { cwd: root, encoding: 'utf8' });
|
|
199
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-27-f.md'), 'utf8');
|
|
200
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
201
|
-
check('S13 空原话拒跑:exit 1 + 用法提示 + 文档未动 + 无台账',
|
|
202
|
-
r.status === 1 && /--delegated 须带用户对话原话/.test(r.stderr) && after === '---\n状态: draft\n---\n# P\n' && noLedger,
|
|
203
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
204
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// ---- S15 incidents 委托代录(2026-09-27 gate-coverage):open→fixed 落态 + 台账 stage=fixed ----
|
|
208
|
-
{
|
|
209
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-inc-'));
|
|
210
|
-
const docP = path.join(root, 'workflow', 'incidents');
|
|
211
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
212
|
-
fs.writeFileSync(path.join(docP, '2026-09-28-i.md'), '---\n状态: open\n级别: L1\n---\n# I\n');
|
|
213
|
-
const before = fs.readFileSync(path.join(docP, '2026-09-28-i.md'), 'utf8');
|
|
214
|
-
const fpExpect = computeFingerprint(before);
|
|
215
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/incidents/2026-09-28-i.md', '--delegated', '修好了'], { cwd: root, encoding: 'utf8' });
|
|
216
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-28-i.md'), 'utf8');
|
|
217
|
-
const led = readLedgerOf(root);
|
|
218
|
-
const j = led[led.length - 1];
|
|
219
|
-
check('S15 incidents 委托代录:exit 0 + open→fixed + 指纹行 + 台账 stage=fixed / prev=open',
|
|
220
|
-
r.status === 0 && after.includes('状态: fixed') && after.includes(`确认指纹: ${fpExpect.slice(0, 16)}`)
|
|
221
|
-
&& j.source === 'chat-delegated' && j.quote === '修好了' && j.stage === 'fixed' && j.prev === 'open'
|
|
222
|
-
&& j.fingerprint === fpExpect,
|
|
223
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, ledger: led }));
|
|
224
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// ---- S16 放弃态 --to(2026-09-27 closing-coverage):draft --to cancelled 委托代录落态 + 台账 ----
|
|
228
|
-
{
|
|
229
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-to-'));
|
|
230
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
231
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
232
|
-
fs.writeFileSync(path.join(docP, '2026-09-28-c.md'), '---\n状态: draft\n级别: L1\n---\n# I\n');
|
|
233
|
-
const before = fs.readFileSync(path.join(docP, '2026-09-28-c.md'), 'utf8');
|
|
234
|
-
const fpExpect = computeFingerprint(before);
|
|
235
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-28-c.md', '--to', 'cancelled', '--delegated', '不做了'], { cwd: root, encoding: 'utf8' });
|
|
236
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-28-c.md'), 'utf8');
|
|
237
|
-
const led = readLedgerOf(root);
|
|
238
|
-
const j = led[led.length - 1];
|
|
239
|
-
check('S16 --to cancelled 委托代录:exit 0 + draft→cancelled + 台账 stage=cancelled / prev=draft',
|
|
240
|
-
r.status === 0 && after.includes('状态: cancelled') && after.includes(`确认指纹: ${fpExpect.slice(0, 16)}`)
|
|
241
|
-
&& j.stage === 'cancelled' && j.prev === 'draft' && j.quote === '不做了' && j.fingerprint === fpExpect,
|
|
242
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, ledger: led }));
|
|
243
|
-
// 调用事实(2026-09-28 batch-ledger-audit):委托单份 → of=1、seq=1、batch 为非空字符串
|
|
244
|
-
// (check-loop 检查 15 的并录审计据此判「是否一次调用落多份」——不再从 quote/ts 反推)
|
|
245
|
-
check('S16b 台账行含调用事实 batch/seq/of 且单份 = of=1 / seq=1',
|
|
246
|
-
typeof j.batch === 'string' && j.batch.length > 0 && j.seq === 1 && j.of === 1,
|
|
247
|
-
JSON.stringify({ batch: j.batch, seq: j.seq, of: j.of }));
|
|
248
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// ---- S17 --to 非法组合拒跑:done --to cancelled → 跳过且不落台账 ----
|
|
252
|
-
{
|
|
253
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-to2-'));
|
|
254
|
-
const docP = path.join(root, 'workflow', 'plans');
|
|
255
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
256
|
-
fs.writeFileSync(path.join(docP, '2026-09-28-d.md'), '---\n状态: done\n级别: L1\n---\n# P\n');
|
|
257
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-28-d.md', '--to', 'cancelled', '--delegated', '试试'], { cwd: root, encoding: 'utf8' });
|
|
258
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-28-d.md'), 'utf8');
|
|
259
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
260
|
-
check('S17 --to 非法组合(done→cancelled):跳过不落态 + 无台账 + 文档未动',
|
|
261
|
-
/无合法跳转/.test(r.stderr || '') && after.includes('状态: done') && noLedger,
|
|
262
|
-
JSON.stringify({ stderr: r.stderr }));
|
|
263
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// ---- S18 delegated 单文档强制(2026-09-27 confirm-gate-one-per-call)----
|
|
267
|
-
// 多文档并录曾系统性塌掉三道阶段门(build.md「逐件确认不得并作一次」)——机器层收口
|
|
268
|
-
{
|
|
269
|
-
const mk2docs = () => {
|
|
270
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-single-'));
|
|
271
|
-
for (const sub of ['intents', 'plans']) {
|
|
272
|
-
fs.mkdirSync(path.join(root, 'workflow', sub), { recursive: true });
|
|
273
|
-
fs.writeFileSync(path.join(root, 'workflow', sub, '2026-09-27-s.md'), `---\n状态: draft\n级别: L1\n---\n# ${sub === 'intents' ? 'I' : 'P'}\n`);
|
|
274
|
-
}
|
|
275
|
-
return root;
|
|
276
|
-
};
|
|
277
|
-
{
|
|
278
|
-
const root = mk2docs();
|
|
279
|
-
const before1 = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-s.md'), 'utf8');
|
|
280
|
-
const before2 = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-27-s.md'), 'utf8');
|
|
281
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-s.md', 'workflow/plans/2026-09-27-s.md', '--delegated', '两份一起'], { cwd: root, encoding: 'utf8' });
|
|
282
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
283
|
-
const after1 = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-s.md'), 'utf8');
|
|
284
|
-
const after2 = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-27-s.md'), 'utf8');
|
|
285
|
-
check('S18 delegated 双文档 → exit 1 拒绝 + 逐件口径提示 + 零台账 + 文档零改动',
|
|
286
|
-
r.status === 1 && /一次仅接受一份文档/.test(r.stderr) && /逐件/.test(r.stderr)
|
|
287
|
-
&& noLedger && after1 === before1 && after2 === before2,
|
|
288
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
289
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
290
|
-
}
|
|
291
|
-
{
|
|
292
|
-
const root = mk2docs();
|
|
293
|
-
const r1 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-s.md', '--delegated', '第一份可以'], { cwd: root, encoding: 'utf8' });
|
|
294
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-27-s.md', '--delegated', '第一份可以'], { cwd: root, encoding: 'utf8' });
|
|
295
|
-
check('S18 delegated 单文档逐次调用照常(两次各落态各记账)',
|
|
296
|
-
r1.status === 0 && r2.status === 0
|
|
297
|
-
&& fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-s.md'), 'utf8').includes('状态: approved')
|
|
298
|
-
&& fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-27-s.md'), 'utf8').includes('状态: approved'),
|
|
299
|
-
JSON.stringify({ r1: r1.status, r2: r2.status, stderr: r2.stderr }));
|
|
300
|
-
// 调用事实(2026-09-28 batch-ledger-audit):每次进程调用 **一个** batch;两次独立调用 batch **不同**,
|
|
301
|
-
// 各自 seq=1 / of=1——这是并录审计「逐件 vs 并录」的判别基础(复核 P2-2:plan 要求覆盖此面)
|
|
302
|
-
const led2 = readLedgerOf(root);
|
|
303
|
-
const [e1, e2] = led2.slice(-2);
|
|
304
|
-
check('S18b 两次独立调用各生成独立 batch(不同批、各自 seq=1/of=1)',
|
|
305
|
-
e1.batch !== e2.batch && e1.seq === 1 && e2.seq === 1 && e1.of === 1 && e2.of === 1,
|
|
306
|
-
JSON.stringify(led2.slice(-2)));
|
|
307
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
308
|
-
}
|
|
309
|
-
{
|
|
310
|
-
// 【复核 P2-2】单次调用落 N 份 → batch 相同 / seq 递增 1,2 / of=2 —— **端到端**验证 TTY 多文档路径。
|
|
311
|
-
// 该路径仅 TTY 可达(delegated 已被入口限为 1 份),故注入两个**仅测试用**逃生门:
|
|
312
|
-
// CONFIRM_DOC_TEST_TTY=1 —— 放行 isTTY 判定(本环境无 TTY)
|
|
313
|
-
// CONFIRM_DOC_TEST_ANSWERS —— 按序注入问答应答(见下「为什么不能用管道 stdin」)
|
|
314
|
-
// NODE_ENV=test —— TTY 逃生门双条件的第二键(2026-09-28 check16-inline-debt:
|
|
315
|
-
// 单变量可被生产会话顺手设置绕过 TTY 门,收紧为双条件)
|
|
316
|
-
// 三者均不改动任何落态/记账语义。
|
|
317
|
-
//
|
|
318
|
-
// **为什么不能用 spawnSync 的 input 管道(2026-09-28 更正)**:此前本用例用 `input:'可以\n可以\n'`
|
|
319
|
-
// 并断言「首份」了事,注释把根因误记为「readline 对第二份提问会 unsettled / 管道输入不被逐次消费」。
|
|
320
|
-
// 经复现,真实机制是:spawnSync 的管道**一次性写完即关闭写端**,readline 在第一个 question 注册前
|
|
321
|
-
// 就已把第二行读入并丢弃,且 stdin 随即 EOF —— 第二个 question 永远等不到输入。**与「有无 TTY」无关**,
|
|
322
|
-
// 是「管道 EOF + 跨 await 边界的 question 注册时序」所致(嵌套回调版同样两问两答可用,加 await 即挂)。
|
|
323
|
-
const root = mk2docs();
|
|
324
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-s.md', 'workflow/plans/2026-09-27-s.md'], {
|
|
325
|
-
cwd: root, encoding: 'utf8',
|
|
326
|
-
env: { ...process.env, CONFIRM_DOC_TEST_TTY: '1', CONFIRM_DOC_TEST_ANSWERS: '可以,可以', NODE_ENV: 'test' },
|
|
327
|
-
});
|
|
328
|
-
const ledN = readLedgerOf(root);
|
|
329
|
-
const stI = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-s.md'), 'utf8');
|
|
330
|
-
const stP = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-27-s.md'), 'utf8');
|
|
331
|
-
check('S18c 单次调用落 2 份(TTY 多文档)端到端 → batch 相同 / seq 1,2 / of 均=2 / 两份都落态',
|
|
332
|
-
r.status === 0 && ledN.length === 2
|
|
333
|
-
&& ledN[0].batch === ledN[1].batch && typeof ledN[0].batch === 'string' && ledN[0].batch.length > 0
|
|
334
|
-
&& ledN[0].seq === 1 && ledN[1].seq === 2
|
|
335
|
-
&& ledN[0].of === 2 && ledN[1].of === 2
|
|
336
|
-
&& ledN[0].source === 'tty' && ledN[1].source === 'tty'
|
|
337
|
-
&& stI.includes('状态: approved') && stP.includes('状态: approved'),
|
|
338
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 300), ledger: ledN }));
|
|
339
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
340
|
-
}
|
|
341
|
-
{
|
|
342
|
-
// 【复核 P2-2】注入应答不足时,剩余文档按「未确认」跳过(不落态、不记账)——钉住注入语义的边界,
|
|
343
|
-
// 避免测试逃生门被误用成「无条件放行」。
|
|
344
|
-
const root = mk2docs();
|
|
345
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-s.md', 'workflow/plans/2026-09-27-s.md'], {
|
|
346
|
-
cwd: root, encoding: 'utf8',
|
|
347
|
-
env: { ...process.env, CONFIRM_DOC_TEST_TTY: '1', CONFIRM_DOC_TEST_ANSWERS: '可以', NODE_ENV: 'test' }, // 只给一份应答
|
|
348
|
-
});
|
|
349
|
-
const led1 = readLedgerOf(root);
|
|
350
|
-
const stP1 = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-27-s.md'), 'utf8');
|
|
351
|
-
check('S18d 注入应答不足 → 仅首份落态,次份按跳过处理(不落态不记账)',
|
|
352
|
-
led1.length === 1 && led1[0].seq === 1 && led1[0].of === 2 && stP1.includes('状态: draft'),
|
|
353
|
-
JSON.stringify({ status: r.status, ledger: led1 }));
|
|
354
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
355
|
-
}
|
|
356
|
-
{
|
|
357
|
-
// 【T3 双条件】仅设 CONFIRM_DOC_TEST_TTY=1 而未设 NODE_ENV=test → 逃生门不生效,仍按非 TTY 拒绝
|
|
358
|
-
// (2026-09-28 check16-inline-debt:单变量可被生产会话顺手设置绕过 TTY 门,收紧为双条件——
|
|
359
|
-
// 本用例钉住「缺第二键即不放行」,与 S18c/S18d 的「双键齐 → 放行」构成双向覆盖)
|
|
360
|
-
const root = mk2docs();
|
|
361
|
-
const env1 = { ...process.env, CONFIRM_DOC_TEST_TTY: '1', CONFIRM_DOC_TEST_ANSWERS: '可以' };
|
|
362
|
-
delete env1.NODE_ENV; // 显式剔除——防宿主环境恰好携带 NODE_ENV 时用例失真
|
|
363
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-27-s.md'], {
|
|
364
|
-
cwd: root, encoding: 'utf8', env: env1,
|
|
365
|
-
});
|
|
366
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
367
|
-
const afterI = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-27-s.md'), 'utf8');
|
|
368
|
-
check('S18e 仅 CONFIRM_DOC_TEST_TTY=1 无 NODE_ENV=test → 仍非 TTY 拒绝(exit 1 + 零台账 + 文档未动)',
|
|
369
|
-
r.status === 1 && /不可代确认/.test(r.stderr) && noLedger && afterI.includes('状态: draft'),
|
|
370
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
371
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// ---- S19【逐阶段门】spec 无同名入口 → 拒绝落账(2026-09-30 stage-gate-machine)----
|
|
376
|
-
{
|
|
377
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-sg1-'));
|
|
378
|
-
const docP = path.join(root, 'workflow', 'specs');
|
|
379
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
380
|
-
fs.writeFileSync(path.join(docP, '2026-09-30-g.md'), '---\n状态: draft\n级别: L2\n---\n# S\n');
|
|
381
|
-
const before = fs.readFileSync(path.join(docP, '2026-09-30-g.md'), 'utf8');
|
|
382
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-09-30-g.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
383
|
-
const after = fs.readFileSync(path.join(docP, '2026-09-30-g.md'), 'utf8');
|
|
384
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
385
|
-
check('S19 逐阶段门:spec 无同名入口 → exit 2 + 未落盘未记账 + 回退提示',
|
|
386
|
-
r.status === 2 && /逐阶段前置门/.test(r.stderr) && /未找到同名入口/.test(r.stderr) && after === before && noLedger,
|
|
387
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
388
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// ---- S19b【待澄清门】spec 挂未澄清项 → 拒绝落账(2026-10-12 needs-clarification)----
|
|
392
|
-
// 夹具沿 S23 的正路入口(台账行 + approved),确保**前置门已过**——否则拒绝原因会指向前置而非待澄清,
|
|
393
|
-
// 用例就测不出新门。断言拒绝文案点名「needs-clarification」且**不含**前置门文案(两门分开出账)。
|
|
394
|
-
{
|
|
395
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-cl1-'));
|
|
396
|
-
for (const sub of ['intents', 'specs']) fs.mkdirSync(path.join(root, 'workflow', sub), { recursive: true });
|
|
397
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
398
|
-
const fp = 'c'.repeat(64);
|
|
399
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-10-12-n.md'), `---\n状态: approved\n级别: L2\n日期: 2026-10-12\n确认指纹: ${fp.slice(0, 16)}\n---\n# I\n`);
|
|
400
|
-
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), JSON.stringify({ ts: '2026-10-12T02:00:00.000Z', doc: 'workflow/intents/2026-10-12-n.md', stage: 'approved', fingerprint: fp, prev: 'draft', source: 'chat-delegated', batch: 'n1', seq: 1, of: 1 }) + '\n');
|
|
401
|
-
const specP = path.join(root, 'workflow', 'specs', '2026-10-12-n.md');
|
|
402
|
-
fs.writeFileSync(specP, '---\n状态: draft\n级别: L2\n---\n# S\n\n## 功能行为\n- 待澄清:错误率的判据是 5xx 占比还是全量?\n');
|
|
403
|
-
const before = fs.readFileSync(specP, 'utf8');
|
|
404
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-10-12-n.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
405
|
-
const after = fs.readFileSync(specP, 'utf8');
|
|
406
|
-
const led = readLedgerOf(root);
|
|
407
|
-
check('S19b 待澄清门:挂未澄清项 → exit 2 + 点名行号与内容 + 未落盘 + 零新增台账',
|
|
408
|
-
r.status === 2 && /needs-clarification/.test(r.stderr) && /第8行/.test(r.stderr) && /5xx 占比还是全量/.test(r.stderr)
|
|
409
|
-
&& after === before && led.length === 1,
|
|
410
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, ledger: led.length }));
|
|
411
|
-
check('S19b 待澄清门:拒绝原因不误指向前置门(两门分开出账,否则作者查错地方)',
|
|
412
|
-
!/逐阶段前置门/.test(r.stderr), r.stderr);
|
|
413
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// ---- S19c【待澄清门】解决后(行首改「已澄清」)→ 放行;纯删行亦可 ----
|
|
417
|
-
{
|
|
418
|
-
const mkClarified = (body) => {
|
|
419
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-cl2-'));
|
|
420
|
-
for (const sub of ['intents', 'specs']) fs.mkdirSync(path.join(root, 'workflow', sub), { recursive: true });
|
|
421
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
422
|
-
const fp = 'd'.repeat(64);
|
|
423
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-10-12-o.md'), `---\n状态: approved\n级别: L2\n日期: 2026-10-12\n确认指纹: ${fp.slice(0, 16)}\n---\n# I\n`);
|
|
424
|
-
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), JSON.stringify({ ts: '2026-10-12T02:00:00.000Z', doc: 'workflow/intents/2026-10-12-o.md', stage: 'approved', fingerprint: fp, prev: 'draft', source: 'chat-delegated', batch: 'o1', seq: 1, of: 1 }) + '\n');
|
|
425
|
-
fs.writeFileSync(path.join(root, 'workflow', 'specs', '2026-10-12-o.md'), body);
|
|
426
|
-
return root;
|
|
427
|
-
};
|
|
428
|
-
for (const [name, body] of [
|
|
429
|
-
['改前缀为「已澄清」(保留行、留痕曾不清楚)', '---\n状态: draft\n级别: L2\n---\n# S\n\n- 已澄清:错误率判据 = 5xx 占比(与用户 10-12 对齐)\n'],
|
|
430
|
-
['直接删行', '---\n状态: draft\n级别: L2\n---\n# S\n\n## 功能行为\n- 错误率判据 = 5xx 占比\n'],
|
|
431
|
-
]) {
|
|
432
|
-
const root = mkClarified(body);
|
|
433
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-10-12-o.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
434
|
-
const after = fs.readFileSync(path.join(root, 'workflow', 'specs', '2026-10-12-o.md'), 'utf8');
|
|
435
|
-
check(`S19c 待澄清门:${name} → 放行落态`, r.status === 0 && after.includes('状态: approved'),
|
|
436
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
437
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
438
|
-
}
|
|
439
|
-
// intents 挂门(2026-10-18 立项跳对称化,推翻旧判例「澄清天然发生在需求单处」——intent 是后链
|
|
440
|
-
// 全部文档的种子,立项时被含混带过的不确定项到 spec/plan 跳已无人能补标;存量无标记零回溯)
|
|
441
|
-
{
|
|
442
|
-
const root3 = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-cl3-'));
|
|
443
|
-
fs.mkdirSync(path.join(root3, 'workflow', 'intents'), { recursive: true });
|
|
444
|
-
const ip = path.join(root3, 'workflow', 'intents', '2026-10-12-p.md');
|
|
445
|
-
fs.writeFileSync(ip, '---\n状态: draft\n级别: L1\n---\n# I\n\n- 待澄清:范围含不含移动端?\n');
|
|
446
|
-
const r3 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-12-p.md', '--delegated', '可以'], { cwd: root3, encoding: 'utf8' });
|
|
447
|
-
check('S19c 待澄清门:intent 挂未澄清项 → exit 2 + 点名内容 + 未落盘(立项跳对称化)',
|
|
448
|
-
r3.status === 2 && /needs-clarification/.test(r3.stderr) && /移动端/.test(r3.stderr)
|
|
449
|
-
&& !/逐阶段前置门/.test(r3.stderr)
|
|
450
|
-
&& fs.readFileSync(ip, 'utf8').includes('状态: draft'),
|
|
451
|
-
JSON.stringify({ status: r3.status, stderr: r3.stderr }));
|
|
452
|
-
fs.writeFileSync(ip, '---\n状态: draft\n级别: L1\n---\n# I\n\n- 已澄清:范围仅桌面端(用户 10-12 拍板)\n');
|
|
453
|
-
const r4 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-12-p.md', '--delegated', '可以'], { cwd: root3, encoding: 'utf8' });
|
|
454
|
-
check('S19c 待澄清门:intent 已澄清 → 放行落态',
|
|
455
|
-
r4.status === 0 && fs.readFileSync(ip, 'utf8').includes('状态: approved'),
|
|
456
|
-
JSON.stringify({ status: r4.status, stderr: r4.stderr }));
|
|
457
|
-
fs.writeFileSync(ip, '---\n状态: draft\n级别: L1\n---\n# I\n\n## 目标\n- 无标记存量件\n');
|
|
458
|
-
const r5 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-12-p.md', '--delegated', '可以'], { cwd: root3, encoding: 'utf8' });
|
|
459
|
-
check('S19c 待澄清门:intent 无标记(存量口径)→ 放行零回溯',
|
|
460
|
-
r5.status === 0 && fs.readFileSync(ip, 'utf8').includes('状态: approved'),
|
|
461
|
-
JSON.stringify({ status: r5.status, stderr: r5.stderr }));
|
|
462
|
-
fs.rmSync(root3, { recursive: true, force: true });
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// ---- S20【逐阶段门】入口存在但未确认(draft)→ 拒绝 ----
|
|
467
|
-
{
|
|
468
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-sg2-'));
|
|
469
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
470
|
-
fs.mkdirSync(path.join(root, 'workflow', 'specs'), { recursive: true });
|
|
471
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-h.md'), '---\n状态: draft\n级别: L2\n日期: 2026-09-30\n---\n# I\n');
|
|
472
|
-
fs.writeFileSync(path.join(root, 'workflow', 'specs', '2026-09-30-h.md'), '---\n状态: draft\n级别: L2\n---\n# S\n');
|
|
473
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-09-30-h.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
474
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
475
|
-
check('S20 逐阶段门:入口未确认(draft)→ exit 2 + 提示状态、零落账',
|
|
476
|
-
r.status === 2 && /状态「draft」/.test(r.stderr) && noLedger,
|
|
477
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
478
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
// ---- S21【逐阶段门】L1 入口已确认 → plan 放行(存量口径免台账;级别 L1 免 spec 档)----
|
|
482
|
-
{
|
|
483
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-sg3-'));
|
|
484
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
485
|
-
fs.mkdirSync(path.join(root, 'workflow', 'plans'), { recursive: true });
|
|
486
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-j.md'), '---\n状态: approved\n级别: L1\n日期: 2026-01-01\n---\n# I\n');
|
|
487
|
-
fs.writeFileSync(path.join(root, 'workflow', 'plans', '2026-09-30-j.md'), '---\n状态: draft\n级别: L1\n---\n# P\n');
|
|
488
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-30-j.md', '--delegated', '继续'], { cwd: root, encoding: 'utf8' });
|
|
489
|
-
const after = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-30-j.md'), 'utf8');
|
|
490
|
-
check('S21 逐阶段门:L1 入口 approved(存量口径)→ plan 放行落态',
|
|
491
|
-
r.status === 0 && after.includes('状态: approved'),
|
|
492
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
493
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// ---- S22【逐阶段门】L2 入口已确认但缺 spec → plan 拒绝 ----
|
|
497
|
-
{
|
|
498
|
-
// 入口须有**台账行**(不复用存量日期短路路径)——夹具写 confirmed 行使前置成立,仅缺 spec
|
|
499
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-sg4-'));
|
|
500
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
501
|
-
fs.mkdirSync(path.join(root, 'workflow', 'plans'), { recursive: true });
|
|
502
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
503
|
-
const fp4 = '4'.repeat(64);
|
|
504
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-k.md'), `---\n状态: approved\n级别: L2\n日期: 2026-09-30\n确认指纹: ${fp4.slice(0, 16)}\n---\n# I\n`);
|
|
505
|
-
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), JSON.stringify({ ts: '2026-09-30T04:00:00.000Z', doc: 'workflow/intents/2026-09-30-k.md', stage: 'approved', fingerprint: fp4, prev: 'draft', source: 'chat-delegated', batch: 'k4', seq: 1, of: 1 }) + '\n');
|
|
506
|
-
fs.writeFileSync(path.join(root, 'workflow', 'plans', '2026-09-30-k.md'), '---\n状态: draft\n级别: L2\n---\n# P\n');
|
|
507
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-30-k.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
508
|
-
const after = fs.readFileSync(path.join(root, 'workflow', 'plans', '2026-09-30-k.md'), 'utf8');
|
|
509
|
-
check('S22 逐阶段门:L2 入口(台账行)缺同名 spec → plan 拒绝(exit 2 + 未落态)',
|
|
510
|
-
r.status === 2 && /缺同名 spec/.test(r.stderr) && after.includes('状态: draft'),
|
|
511
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
512
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// ---- S23【逐阶段门】入口「台账行」正路放行(非存量口径;复核 P2-4④)----
|
|
516
|
-
{
|
|
517
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-sg5-'));
|
|
518
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
519
|
-
fs.mkdirSync(path.join(root, 'workflow', 'specs'), { recursive: true });
|
|
520
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
521
|
-
const fp = 'b'.repeat(64);
|
|
522
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-m.md'), `---\n状态: approved\n级别: L2\n日期: 2026-09-30\n确认指纹: ${fp.slice(0, 16)}\n---\n# I\n`);
|
|
523
|
-
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), JSON.stringify({ ts: '2026-09-30T02:00:00.000Z', doc: 'workflow/intents/2026-09-30-m.md', stage: 'approved', fingerprint: fp, prev: 'draft', source: 'chat-delegated', batch: 't9', seq: 1, of: 1 }) + '\n');
|
|
524
|
-
fs.writeFileSync(path.join(root, 'workflow', 'specs', '2026-09-30-m.md'), '---\n状态: draft\n级别: L2\n---\n# S\n');
|
|
525
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-09-30-m.md', '--delegated', '继续'], { cwd: root, encoding: 'utf8' });
|
|
526
|
-
const after = fs.readFileSync(path.join(root, 'workflow', 'specs', '2026-09-30-m.md'), 'utf8');
|
|
527
|
-
check('S23 逐阶段门:入口状态 approved + 台账行(正路)→ spec 放行',
|
|
528
|
-
r.status === 0 && after.includes('状态: approved'),
|
|
529
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
530
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
{
|
|
534
|
-
// N1:存量短路(confirm-doc 侧)——legacy 入口无级别 → spec 放行
|
|
535
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-n1-'));
|
|
536
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
537
|
-
fs.mkdirSync(path.join(root, 'workflow', 'specs'), { recursive: true });
|
|
538
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-n1.md'), '---\n状态: approved\n日期: 2026-01-01\n流程: legacy\n---\n# I(存量、无级别)\n');
|
|
539
|
-
fs.writeFileSync(path.join(root, 'workflow', 'specs', '2026-09-30-n1.md'), '---\n状态: draft\n级别: L2\n---\n# S\n');
|
|
540
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-09-30-n1.md', '--delegated', 'n1 回归'], { cwd: root, encoding: 'utf8' });
|
|
541
|
-
const after = fs.readFileSync(path.join(root, 'workflow', 'specs', '2026-09-30-n1.md'), 'utf8');
|
|
542
|
-
check('S24 N1 存量短路:legacy 入口无级别 → confirm-doc 放行(不锁死确认)',
|
|
543
|
-
r.status === 0 && after.includes('状态: approved'),
|
|
544
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
545
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// ---- S25–S29【done 前置门】approved 历史留痕(2026-09-30 confirm-gate-approved-history)----
|
|
549
|
-
// git helper:与 check-loop.test 同口径(win32 → git.exe;-c 注入 user 免全局 config 依赖)
|
|
550
|
-
const GITBIN = process.platform === 'win32' ? 'git.exe' : 'git';
|
|
551
|
-
const gitAt = (root, ...args) => spawnSync(GITBIN, args, { cwd: root, encoding: 'utf8' });
|
|
552
|
-
const gitHead = (root) => {
|
|
553
|
-
gitAt(root, 'init', '-q');
|
|
554
|
-
gitAt(root, '-c', 'user.email=t@t', '-c', 'user.name=t', 'commit', '-q', '--allow-empty', '-m', 'init');
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
// S25:有 HEAD 但文档从未提交(先 done 后提交形态)→ done 拒绝
|
|
558
|
-
{
|
|
559
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-dh1-'));
|
|
560
|
-
fs.mkdirSync(path.join(root, 'workflow', 'plans'), { recursive: true });
|
|
561
|
-
const p = path.join(root, 'workflow', 'plans', '2026-09-30-d1.md');
|
|
562
|
-
fs.writeFileSync(p, '---\n状态: approved\n级别: L2\n日期: 2026-09-30\n---\n# P\n');
|
|
563
|
-
const before = fs.readFileSync(p, 'utf8');
|
|
564
|
-
gitHead(root);
|
|
565
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-30-d1.md', '--delegated', '关单'], { cwd: root, encoding: 'utf8' });
|
|
566
|
-
const after = fs.readFileSync(p, 'utf8');
|
|
567
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
568
|
-
check('S25 done 门:历史无 approved(先 done 后提交形态)→ exit 2 + 零落账 + 零写盘',
|
|
569
|
-
r.status === 2 && /done 前置门/.test(r.stderr) && /从未出现/.test(r.stderr) && after === before && noLedger,
|
|
570
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 260) }));
|
|
571
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
// S26:approved 态已提交(留痕)→ done 放行落账
|
|
575
|
-
{
|
|
576
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-dh2-'));
|
|
577
|
-
fs.mkdirSync(path.join(root, 'workflow', 'plans'), { recursive: true });
|
|
578
|
-
const p = path.join(root, 'workflow', 'plans', '2026-09-30-d2.md');
|
|
579
|
-
fs.writeFileSync(p, '---\n状态: approved\n级别: L2\n日期: 2026-09-30\n---\n# P\n');
|
|
580
|
-
gitHead(root);
|
|
581
|
-
gitAt(root, 'add', '-A');
|
|
582
|
-
gitAt(root, '-c', 'user.email=t@t', '-c', 'user.name=t', 'commit', '-q', '-m', 'approved');
|
|
583
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-30-d2.md', '--delegated', '关单'], { cwd: root, encoding: 'utf8' });
|
|
584
|
-
const after = fs.readFileSync(p, 'utf8');
|
|
585
|
-
const ledger = readLedgerOf(root); // 复核 P2-1:统一 helper(缺失 → [],不崩溃)
|
|
586
|
-
check('S26 done 门:approved 态已提交(留痕)→ 放行落态 + 台账 stage=done',
|
|
587
|
-
r.status === 0 && after.includes('状态: done') && ledger.some((e) => e.stage === 'done' && e.prev === 'approved'),
|
|
588
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
589
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
// S27:非 git 环境 → 跳过(不误拦;沿检查 14 口径)
|
|
593
|
-
{
|
|
594
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-dh3-'));
|
|
595
|
-
fs.mkdirSync(path.join(root, 'workflow', 'plans'), { recursive: true });
|
|
596
|
-
const p = path.join(root, 'workflow', 'plans', '2026-09-30-d3.md');
|
|
597
|
-
fs.writeFileSync(p, '---\n状态: approved\n级别: L2\n---\n# P\n');
|
|
598
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/plans/2026-09-30-d3.md', '--delegated', '关单'], { cwd: root, encoding: 'utf8' });
|
|
599
|
-
const after = fs.readFileSync(p, 'utf8');
|
|
600
|
-
check('S27 done 门:非 git 环境 → 跳过放行',
|
|
601
|
-
r.status === 0 && after.includes('状态: done'),
|
|
602
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
603
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
// S28:legacy 标记 → 跳过(存量口径;intent 文档承载——spec/plan 不产生 legacy 标记)
|
|
607
|
-
{
|
|
608
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-dh4-'));
|
|
609
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
610
|
-
const p = path.join(root, 'workflow', 'intents', '2026-09-30-d4.md');
|
|
611
|
-
fs.writeFileSync(p, '---\n状态: approved\n级别: L1\n日期: 2026-01-01\n流程: legacy\n---\n# I\n');
|
|
612
|
-
gitHead(root);
|
|
613
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-d4.md', '--delegated', '关单'], { cwd: root, encoding: 'utf8' });
|
|
614
|
-
const after = fs.readFileSync(p, 'utf8');
|
|
615
|
-
check('S28 done 门:legacy 标记 → 跳过放行',
|
|
616
|
-
r.status === 0 && after.includes('状态: done'),
|
|
617
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
618
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
// S29:正文「存量确认态豁免(」声明 → 跳过(显式逃生口;与检查 14 同标记)
|
|
622
|
-
{
|
|
623
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-dh5-'));
|
|
624
|
-
fs.mkdirSync(path.join(root, 'workflow', 'specs'), { recursive: true });
|
|
625
|
-
const p = path.join(root, 'workflow', 'specs', '2026-09-30-d5.md');
|
|
626
|
-
fs.writeFileSync(p, '---\n状态: approved\n级别: L2\n---\n# S\n\n存量确认态豁免(S29 构造:声明式逃生口覆盖)\n');
|
|
627
|
-
gitHead(root);
|
|
628
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/specs/2026-09-30-d5.md', '--delegated', '关单'], { cwd: root, encoding: 'utf8' });
|
|
629
|
-
const after = fs.readFileSync(p, 'utf8');
|
|
630
|
-
check('S29 done 门:存量豁免声明 → 跳过放行',
|
|
631
|
-
r.status === 0 && after.includes('状态: done'),
|
|
632
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
633
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// ---- S30【协作道批量】--batch:delegated 多份 L1 一次代录 → 全部落态 + 台账 brief:true(2026-09-30 hybrid-governance-risk-lanes)----
|
|
637
|
-
{
|
|
638
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt1-'));
|
|
639
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
640
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt1.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I1\n');
|
|
641
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt2.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I2\n');
|
|
642
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-bt1.md', 'workflow/intents/2026-09-30-bt2.md', '--delegated', '批量放行', '--batch'], { cwd: root, encoding: 'utf8' });
|
|
643
|
-
const led = readLedgerOf(root);
|
|
644
|
-
const st1 = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt1.md'), 'utf8');
|
|
645
|
-
const st2 = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt2.md'), 'utf8');
|
|
646
|
-
check('S30 --batch:2 份 L1 一次代录 → 全部 approved + 台账 brief:true / of=2 / seq 递增',
|
|
647
|
-
r.status === 0 && led.length === 2
|
|
648
|
-
&& led.every((e) => e.brief === true && e.source === 'chat-delegated' && e.of === 2 && e.stage === 'approved')
|
|
649
|
-
&& led[0].seq === 1 && led[1].seq === 2
|
|
650
|
-
&& st1.includes('状态: approved') && st2.includes('状态: approved'),
|
|
651
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 300), led }));
|
|
652
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
// ---- S31【协作道批量】--batch 混入 L2 → 该份逐份拒绝(exit 2 + 未落盘未记账),L1 份照常落态 ----
|
|
656
|
-
{
|
|
657
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt2-'));
|
|
658
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
659
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt3.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I3\n');
|
|
660
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt4.md'), '---\n状态: draft\n级别: L2\n日期: 2026-09-30\n---\n# I4\n');
|
|
661
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-bt3.md', 'workflow/intents/2026-09-30-bt4.md', '--delegated', '批量放行', '--batch'], { cwd: root, encoding: 'utf8' });
|
|
662
|
-
const led = readLedgerOf(root);
|
|
663
|
-
const st4 = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt4.md'), 'utf8');
|
|
664
|
-
check('S31 --batch 混入 L2 → L2 拒绝(exit 2 + 未落盘未记账)+ L1 落态',
|
|
665
|
-
r.status === 2 && /不在协作道/.test(r.stderr) && led.length === 1 && led[0].doc.endsWith('bt3.md') && st4.includes('状态: draft'),
|
|
666
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 300), led }));
|
|
667
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
// ---- S31b【方案 C 分歧双严】--batch 分歧件(级别 L1 / risk_level L2,协议期)→ 泳道 suspect 逐份拒绝(2026-10-02 caliber-convergence)----
|
|
671
|
-
{
|
|
672
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt3-'));
|
|
673
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
674
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
675
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: 2 }));
|
|
676
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-10-02-dv1.md'), '---\n状态: draft\n级别: L1\nrisk_level: L2\n日期: 2026-10-02\n---\n# DV\n');
|
|
677
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-02-dv1.md', '--delegated', '批量放行', '--batch'], { cwd: root, encoding: 'utf8' });
|
|
678
|
-
const led = readLedgerOf(root);
|
|
679
|
-
const st = fs.readFileSync(path.join(root, 'workflow', 'intents', '2026-10-02-dv1.md'), 'utf8');
|
|
680
|
-
check('S31b --batch 分歧件 → 泳道 suspect 拒(exit 2 + 对齐两字段提示 + 零台账未落盘)',
|
|
681
|
-
r.status === 2 && /泳道「suspect」/.test(r.stderr) && /对齐/.test(r.stderr) && led.length === 0 && st.includes('状态: draft'),
|
|
682
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 300), led }));
|
|
683
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
// ---- S31c【方案 C 分歧双严】--auto 分歧件 → suspect 拒(消息锁定,先于 trust 判定短路)----
|
|
687
|
-
{
|
|
688
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt4-'));
|
|
689
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
690
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
691
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: 2 }));
|
|
692
|
-
fs.writeFileSync(path.join(root, '.agents', 'trust-mode.json'), JSON.stringify({ enabled: true, level: 1, name: 'Standard', enabledAt: '2026-10-02T00:00:00.000Z' }));
|
|
693
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-10-02-dv2.md'), '---\n状态: draft\n级别: L1\nrisk_level: L2\n日期: 2026-10-02\n---\n# DV2\n');
|
|
694
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-02-dv2.md', '--auto'], { cwd: root, encoding: 'utf8' });
|
|
695
|
-
check('S31c --auto(trust=Standard)分歧件 → 泳道 suspect 拒(消息含 suspect 与对齐指引)',
|
|
696
|
-
r.status !== 0 && /suspect/.test(r.stderr) && /对齐/.test(r.stderr),
|
|
697
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 300) }));
|
|
698
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// ---- S32 --batch 组合约束:与 --auto / --to 互斥(exit 1,零落账)----
|
|
702
|
-
{
|
|
703
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt3-'));
|
|
704
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
705
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt5.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I5\n');
|
|
706
|
-
const r1 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-bt5.md', '--delegated', 'x', '--batch', '--auto'], { cwd: root, encoding: 'utf8' });
|
|
707
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-bt5.md', '--delegated', 'x', '--batch', '--to', 'cancelled'], { cwd: root, encoding: 'utf8' });
|
|
708
|
-
const noLedger = !fs.existsSync(path.join(root, '.agents', 'confirmations.jsonl'));
|
|
709
|
-
check('S32 --batch 与 --auto / --to 互斥 → 均 exit 1 + 零台账',
|
|
710
|
-
r1.status === 1 && r2.status === 1 && noLedger,
|
|
711
|
-
JSON.stringify({ r1: r1.status, r2: r2.status }));
|
|
712
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
// ---- S33 简洁审计:单份 delegated L1(无 --batch)→ 台账 brief:true + 紧凑输出;L2 份不带 brief ----
|
|
716
|
-
{
|
|
717
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-bt4-'));
|
|
718
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
719
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-bt6.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I6\n');
|
|
720
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-bt6.md', '--delegated', '单份放行'], { cwd: root, encoding: 'utf8' });
|
|
721
|
-
const led = readLedgerOf(root);
|
|
722
|
-
check('S33 单份 L1 代录 → brief:true + 紧凑输出(协作道/异步审计标记)',
|
|
723
|
-
r.status === 0 && led.length === 1 && led[0].brief === true && /协作道\/异步审计/.test(r.stdout),
|
|
724
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(0, 200), led }));
|
|
725
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
// ---- S34–S37【Trusted 自动泳道】trust-mode.json = Trusted(level 2)→ 非 TTY 免旗标隐式自治(2026-09-30 hybrid-governance-explore-hardening)----
|
|
729
|
-
const writeTrust = (root, cfg) => {
|
|
730
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
731
|
-
fs.writeFileSync(path.join(root, '.agents', 'trust-mode.json'), JSON.stringify(cfg));
|
|
732
|
-
};
|
|
733
|
-
// S34:Trusted + L1 intent 免旗标 → draft→approved 落态 + 台账 source=ai-auto-trust-L2;第二跳 → done(全闭环)
|
|
734
|
-
{
|
|
735
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-tr1-'));
|
|
736
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
737
|
-
writeTrust(root, { enabled: true, level: 2, name: 'Trusted', enabledAt: '2026-09-30T00:00:00.000Z' });
|
|
738
|
-
const p = path.join(root, 'workflow', 'intents', '2026-09-30-tr1.md');
|
|
739
|
-
fs.writeFileSync(p, '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I\n');
|
|
740
|
-
const r1 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr1.md'], { cwd: root, encoding: 'utf8' });
|
|
741
|
-
const led1 = readLedgerOf(root);
|
|
742
|
-
check('S34 Trusted 隐式:非 TTY 无旗标 L1 draft→approved + 台账 source=ai-auto-trust-L2',
|
|
743
|
-
r1.status === 0 && fs.readFileSync(p, 'utf8').includes('状态: approved')
|
|
744
|
-
&& led1.length === 1 && led1[0].source === 'ai-auto-trust-L2' && led1[0].stage === 'approved' && led1[0].prev === 'draft',
|
|
745
|
-
JSON.stringify({ status: r1.status, stderr: String(r1.stderr).slice(0, 300), led: led1 }));
|
|
746
|
-
// 第二跳:非 git 环境 done 门跳过(S27 同口径)→ Level 2 全闭环直达 done
|
|
747
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr1.md'], { cwd: root, encoding: 'utf8' });
|
|
748
|
-
const led2 = readLedgerOf(root);
|
|
749
|
-
check('S34b Trusted 隐式第二跳:approved→done(Level 2 全闭环)',
|
|
750
|
-
r2.status === 0 && fs.readFileSync(p, 'utf8').includes('状态: done')
|
|
751
|
-
&& led2.length === 2 && led2[1].stage === 'done' && led2[1].prev === 'approved',
|
|
752
|
-
JSON.stringify({ status: r2.status, stderr: String(r2.stderr).slice(0, 300), led: led2 }));
|
|
753
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
754
|
-
}
|
|
755
|
-
// S35:Trusted 隐式边界——L2 文档与 incidents 均不过自治门(exit 2 未落账)
|
|
756
|
-
{
|
|
757
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-tr2-'));
|
|
758
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
759
|
-
fs.mkdirSync(path.join(root, 'workflow', 'incidents'), { recursive: true });
|
|
760
|
-
writeTrust(root, { enabled: true, level: 2, name: 'Trusted' });
|
|
761
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-tr2.md'), '---\n状态: draft\n级别: L2\n日期: 2026-09-30\n---\n# I\n');
|
|
762
|
-
fs.writeFileSync(path.join(root, 'workflow', 'incidents', '2026-09-30-tr3.md'), '---\n状态: open\n级别: L1\n---\n# I\n');
|
|
763
|
-
const r1 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr2.md'], { cwd: root, encoding: 'utf8' });
|
|
764
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/incidents/2026-09-30-tr3.md'], { cwd: root, encoding: 'utf8' });
|
|
765
|
-
check('S35 Trusted 隐式边界:L2 文档与 incidents 均拒绝(exit 2 未过自治门)+ 零台账',
|
|
766
|
-
r1.status === 2 && r2.status === 2 && readLedgerOf(root).length === 0,
|
|
767
|
-
JSON.stringify({ r1: r1.status, r2: r2.status, stderr1: String(r1.stderr).slice(0, 200) }));
|
|
768
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
769
|
-
}
|
|
770
|
-
// S36:Standard(level 1)不隐式——非 TTY 无旗标仍拒(隐式泳道仅 Trusted;fail-closed)
|
|
771
|
-
{
|
|
772
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-tr3-'));
|
|
773
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
774
|
-
writeTrust(root, { enabled: true, level: 1, name: 'Standard' });
|
|
775
|
-
const p = path.join(root, 'workflow', 'intents', '2026-09-30-tr4.md');
|
|
776
|
-
fs.writeFileSync(p, '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I\n');
|
|
777
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr4.md'], { cwd: root, encoding: 'utf8' });
|
|
778
|
-
check('S36 Standard 不隐式:非 TTY 无旗标 → 仍 exit 1 拒绝 + 零写盘',
|
|
779
|
-
r.status === 1 && /不可代确认/.test(r.stderr) && fs.readFileSync(p, 'utf8').includes('状态: draft'),
|
|
780
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
781
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
782
|
-
}
|
|
783
|
-
// S37:Trusted 隐式边界——多份 / --to 放弃态 → 不隐式,仍拒(exit 1)
|
|
784
|
-
{
|
|
785
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-tr4-'));
|
|
786
|
-
fs.mkdirSync(path.join(root, 'workflow', 'intents'), { recursive: true });
|
|
787
|
-
writeTrust(root, { enabled: true, level: 2, name: 'Trusted' });
|
|
788
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-tr5.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I\n');
|
|
789
|
-
fs.writeFileSync(path.join(root, 'workflow', 'intents', '2026-09-30-tr6.md'), '---\n状态: draft\n级别: L1\n日期: 2026-09-30\n---\n# I\n');
|
|
790
|
-
const r1 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr5.md', 'workflow/intents/2026-09-30-tr6.md'], { cwd: root, encoding: 'utf8' });
|
|
791
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-30-tr5.md', '--to', 'cancelled'], { cwd: root, encoding: 'utf8' });
|
|
792
|
-
check('S37 Trusted 隐式边界:多份 / --to 放弃态 → 不隐式仍拒(exit 1 + 零台账)',
|
|
793
|
-
r1.status === 1 && r2.status === 1 && /不可代确认/.test(r1.stderr) && readLedgerOf(root).length === 0,
|
|
794
|
-
JSON.stringify({ r1: r1.status, r2: r2.status, stderr1: String(r1.stderr).slice(0, 160), stderr2: String(r2.stderr).slice(0, 160) }));
|
|
795
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
// ---- S38 测试绿凭证前置(2026-10-07 verify-evidence):v5 + 验收节 + 无凭证 → ⚠️ advisory 且仍落账 ----
|
|
799
|
-
{
|
|
800
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-verify1-'));
|
|
801
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
802
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
803
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
804
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: 5 }), 'utf8');
|
|
805
|
-
fs.writeFileSync(path.join(docP, '2026-10-07-v.md'),
|
|
806
|
-
'---\n状态: approved\n级别: L1\n确认指纹: aaaa1111aaaa1111\n---\n# I\n\n## 验收标准(可测试)\n- [x] 用例通过(证据:测试全绿)\n', 'utf8');
|
|
807
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-07-v.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
808
|
-
const after = fs.readFileSync(path.join(docP, '2026-10-07-v.md'), 'utf8');
|
|
809
|
-
check('S38 凭证前置:v5 + 验收节 + 无凭证 → ⚠️ 出账且 done 仍落态(advisory 不拦)',
|
|
810
|
-
r.status === 0 && /无测试绿凭证/.test(r.stderr) && /verify\.mjs/.test(r.stderr) && after.includes('状态: done'),
|
|
811
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
812
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// ---- S39 测试绿凭证前置:近期绿凭证在场 → 静默(无 ⚠️)----
|
|
816
|
-
{
|
|
817
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-verify2-'));
|
|
818
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
819
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
820
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
821
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: 5 }), 'utf8');
|
|
822
|
-
fs.writeFileSync(path.join(root, '.agents', 'verifications.jsonl'),
|
|
823
|
-
`${JSON.stringify({ ts: new Date().toISOString(), exitCode: 0, suite: 'npm test', passed: 1, failed: 0 })}\n`, 'utf8');
|
|
824
|
-
fs.writeFileSync(path.join(docP, '2026-10-07-w.md'),
|
|
825
|
-
'---\n状态: approved\n级别: L1\n确认指纹: bbbb2222bbbb2222\n---\n# I\n\n## 验收标准(可测试)\n- [x] 用例通过(证据:测试全绿)\n', 'utf8');
|
|
826
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-07-w.md', '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
827
|
-
const after = fs.readFileSync(path.join(docP, '2026-10-07-w.md'), 'utf8');
|
|
828
|
-
check('S39 凭证前置:24h 内有绿行 → 静默(无 ⚠️)且 done 落态',
|
|
829
|
-
r.status === 0 && !/无测试绿凭证/.test(r.stderr) && after.includes('状态: done'),
|
|
830
|
-
JSON.stringify({ status: r.status, stderr: String(r.stderr).slice(0, 200) }));
|
|
831
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
// ---- S40 测试绿凭证按 doc 绑定(2026-10-08 verify-doc-binding)----
|
|
835
|
-
// 核心防线三条:① v6 + 只有**他单**绿行 → advisory 出账(漏洞已堵);② v6 + 本单绿行 → 静默;
|
|
836
|
-
// ③ **v5 + 只有他单绿行 → 静默**(向后兼容反例——收紧只许对 v6+ 生效,存量装户零变化)。
|
|
837
|
-
// 文案锚点:既有 S38/S39 锚定「无测试绿凭证」六字连续 + 「verify.mjs」出现,本组不得破坏。
|
|
838
|
-
{
|
|
839
|
-
const mkVerifyRoot = (pv, lines) => {
|
|
840
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-docbind-'));
|
|
841
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
842
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
843
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
844
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: pv }), 'utf8');
|
|
845
|
-
fs.writeFileSync(path.join(root, '.agents', 'verifications.jsonl'), lines, 'utf8');
|
|
846
|
-
fs.writeFileSync(path.join(docP, '2026-10-08-m.md'),
|
|
847
|
-
'---\n状态: approved\n级别: L1\n确认指纹: cccc3333cccc3333\n---\n# I\n\n## 验收标准(可测试)\n- [x] 用例通过(证据:测试全绿)\n', 'utf8');
|
|
848
|
-
return root;
|
|
849
|
-
};
|
|
850
|
-
const green = (doc) => `${JSON.stringify({ ts: new Date().toISOString(), exitCode: 0, suite: 'npm test', passed: 1, failed: 0, ...(doc ? { doc } : {}) })}\n`;
|
|
851
|
-
const MINE = 'workflow/intents/2026-10-08-m.md';
|
|
852
|
-
const OTHER = 'workflow/intents/2026-10-08-other.md';
|
|
853
|
-
const runM = (root) => spawnSync(process.execPath, [CLI, MINE, '--delegated', '可以'], { cwd: root, encoding: 'utf8' });
|
|
854
|
-
|
|
855
|
-
const r40 = runM(mkVerifyRoot(6, green(OTHER)));
|
|
856
|
-
check('S40① v6 + 只有他单绿行 → advisory 出账(跨单背书漏洞已堵)+ 文案带 --doc',
|
|
857
|
-
r40.status === 0 && /无测试绿凭证/.test(r40.stderr) && /--doc/.test(r40.stderr), String(r40.stderr).slice(0, 200));
|
|
858
|
-
const r41 = runM(mkVerifyRoot(6, green(MINE)));
|
|
859
|
-
check('S40② v6 + 本单绿行 → 静默(绑定成立)',
|
|
860
|
-
r41.status === 0 && !/无测试绿凭证/.test(r41.stderr), String(r41.stderr).slice(0, 200));
|
|
861
|
-
const r42 = runM(mkVerifyRoot(5, green(OTHER)));
|
|
862
|
-
check('S40③ v5 + 只有他单绿行 → **静默**(兼容反例:收紧只对 v6+ 生效,存量装户零变化)',
|
|
863
|
-
r42.status === 0 && !/无测试绿凭证/.test(r42.stderr), String(r42.stderr).slice(0, 200));
|
|
864
|
-
const r43 = runM(mkVerifyRoot(6, green(null)));
|
|
865
|
-
check('S40④ v6 + 不带 doc 的绿行(CI 场景)→ 不给本单背书,advisory 出账',
|
|
866
|
-
r43.status === 0 && /无测试绿凭证/.test(r43.stderr), String(r43.stderr).slice(0, 200));
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
// ---- S41 台账 scope:机器派生改动面(2026-10-09 审查 A1 干净版)----
|
|
870
|
-
// 背景:委托代录的授权凭据原是 `--delegated` 的用户原话——自由文本机器不可校验、AI 可零成本复用。
|
|
871
|
-
// 干净版把分辨力换成机器派生的 scope{files,sha256}:写入侧机器派生(AI 无输入面),校验侧重算比对。
|
|
872
|
-
// ① 归一与摘要单源(反斜杠 / 前导 ./ / 重复项 / 顺序无关 → 同一摘要);② scopeMatches 抓「改了 files
|
|
873
|
-
// 没改摘要」;③ 委托落账行带 scope 且含被确认文档;④ 非 git 夹具降级不崩(scope 退化为仅含 doc)。
|
|
874
|
-
{
|
|
875
|
-
const d = scopeDigest(['b.md', 'a.md', './a.md', 'x\\y.md']);
|
|
876
|
-
check('S41① scopeDigest 归一:反斜杠→posix、去重、排序无关,摘要自洽',
|
|
877
|
-
d.files.join(',') === 'a.md,b.md,x/y.md' && d.sha256 === scopeDigest(['x/y.md', 'a.md', 'b.md']).sha256
|
|
878
|
-
&& scopeMatches({ scope: d }), JSON.stringify(d));
|
|
879
|
-
check('S41② scopeMatches:files 被改而摘要未同步 → 判否',
|
|
880
|
-
!scopeMatches({ scope: { files: [...d.files, 'zz.md'], sha256: d.sha256 } })
|
|
881
|
-
&& !scopeMatches({}) && !scopeMatches({ scope: { files: d.files } }));
|
|
882
|
-
|
|
883
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-scope-'));
|
|
884
|
-
const docP = path.join(root, 'workflow', 'intents'); // 用 intents:无逐阶段前置门,本用例只验 scope 落账
|
|
885
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
886
|
-
fs.writeFileSync(path.join(docP, '2026-10-09-s.md'), '---\n状态: draft\n---\n# I\n');
|
|
887
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-09-s.md', '--delegated', '放行'], { cwd: root, encoding: 'utf8' });
|
|
888
|
-
const led = readLedgerOf(root);
|
|
889
|
-
const j = led[led.length - 1];
|
|
890
|
-
check('S41③ 委托落账行带机器派生 scope:含被确认文档 + 摘要自洽',
|
|
891
|
-
r.status === 0 && j && j.scope && Array.isArray(j.scope.files)
|
|
892
|
-
&& j.scope.files.includes('workflow/intents/2026-10-09-s.md') && scopeMatches(j),
|
|
893
|
-
JSON.stringify({ status: r.status, stderr: r.stderr, scope: j && j.scope }));
|
|
894
|
-
check('S41④ 非 git 夹具降级:machineScope 不崩且仍含 doc(静默退化为无额外改动面,不拒绝关单)',
|
|
895
|
-
(() => { const s = machineScope(root, 'workflow/intents/2026-10-09-s.md');
|
|
896
|
-
return Array.isArray(s.files) && s.files.includes('workflow/intents/2026-10-09-s.md') && scopeMatches({ scope: s }); })(),
|
|
897
|
-
JSON.stringify(machineScope(root, 'workflow/intents/2026-10-09-s.md')));
|
|
898
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
// ---- S42 分片默认写入口径(2026-10-13 ledger-shard-default):CLI 默认写分片 / 两种回退 / 存量回退 / 显式拒 ----
|
|
902
|
-
{
|
|
903
|
-
const mkFixture = (withV8) => {
|
|
904
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-shard-'));
|
|
905
|
-
const docP = path.join(root, 'workflow', 'intents');
|
|
906
|
-
fs.mkdirSync(docP, { recursive: true });
|
|
907
|
-
fs.writeFileSync(path.join(docP, '2026-10-13-s.md'), '---\n状态: draft\n级别: L1\n---\n# I\n');
|
|
908
|
-
if (withV8) {
|
|
909
|
-
fs.mkdirSync(path.join(root, '.agents'), { recursive: true });
|
|
910
|
-
fs.writeFileSync(path.join(root, '.agents', 'kit.json'), JSON.stringify({ policyVersion: 8 }), 'utf8');
|
|
911
|
-
}
|
|
912
|
-
return root;
|
|
913
|
-
};
|
|
914
|
-
const shardPathOf = (root) => path.join(root, '.agents', 'confirmations.d', '2026-10-13-s.jsonl');
|
|
915
|
-
const mainPathOf = (root) => path.join(root, '.agents', 'confirmations.jsonl');
|
|
916
|
-
const readRows = (p) => (fs.existsSync(p) ? fs.readFileSync(p, 'utf8').split('\n').filter(Boolean).map((l) => JSON.parse(l)) : []);
|
|
917
|
-
const spawnConfirm = (root, args, env = {}) => spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-13-s.md', '--delegated', '可以', ...args], { cwd: root, encoding: 'utf8', env: { ...process.env, ...env } });
|
|
918
|
-
|
|
919
|
-
// S42① 默认(无旗标)+ doc 链已激活(policyVersion 8)→ 写分片,主台账零行
|
|
920
|
-
{
|
|
921
|
-
const root = mkFixture(true);
|
|
922
|
-
const r = spawnConfirm(root, []);
|
|
923
|
-
check('S42① 默认写分片:exit 0 + 行落 confirmations.d/<doc基名>.jsonl + 主台账零行',
|
|
924
|
-
r.status === 0 && readRows(shardPathOf(root)).length === 1
|
|
925
|
-
&& readRows(shardPathOf(root))[0].source === 'chat-delegated'
|
|
926
|
-
&& readRows(mainPathOf(root)).length === 0,
|
|
927
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
928
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
929
|
-
}
|
|
930
|
-
// S42② --no-shard → 显式回退主台账
|
|
931
|
-
{
|
|
932
|
-
const root = mkFixture(true);
|
|
933
|
-
const r = spawnConfirm(root, ['--no-shard']);
|
|
934
|
-
check('S42② --no-shard 回退主台账:exit 0 + 行落 confirmations.jsonl + 分片不存在',
|
|
935
|
-
r.status === 0 && readRows(mainPathOf(root)).length === 1 && !fs.existsSync(shardPathOf(root)),
|
|
936
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
937
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
938
|
-
}
|
|
939
|
-
// S42③ CONFIRM_SHARDED=0 → 环境变量回退主台账
|
|
940
|
-
{
|
|
941
|
-
const root = mkFixture(true);
|
|
942
|
-
const r = spawnConfirm(root, [], { CONFIRM_SHARDED: '0' });
|
|
943
|
-
check('S42③ CONFIRM_SHARDED=0 回退主台账:exit 0 + 行落 confirmations.jsonl + 分片不存在',
|
|
944
|
-
r.status === 0 && readRows(mainPathOf(root)).length === 1 && !fs.existsSync(shardPathOf(root)),
|
|
945
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
946
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
947
|
-
}
|
|
948
|
-
// S42④ 存量装户(无 kit.json → policyVersion 1,doc 链未激活)默认 → 自动回退主台账 + ℹ️ 升级指引
|
|
949
|
-
{
|
|
950
|
-
const root = mkFixture(false);
|
|
951
|
-
const r = spawnConfirm(root, []);
|
|
952
|
-
check('S42④ 存量装户默认:自动回退主台账(exit 0 + 行落 confirmations.jsonl)+ stderr 带 policyVersion: 8 升级指引 + 分片不存在',
|
|
953
|
-
r.status === 0 && readRows(mainPathOf(root)).length === 1
|
|
954
|
-
&& /policyVersion: 8/.test(r.stderr) && !fs.existsSync(shardPathOf(root)),
|
|
955
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
956
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
957
|
-
}
|
|
958
|
-
// S42⑤ 存量装户显式 --shard → 参数期直接拒(原口径不变)
|
|
959
|
-
{
|
|
960
|
-
const root = mkFixture(false);
|
|
961
|
-
const r = spawnConfirm(root, ['--shard']);
|
|
962
|
-
check('S42⑤ 显式 --shard 缺 doc 链锚:exit 1 + 报错带修法 + 零落账(文档/台账均未动)',
|
|
963
|
-
r.status === 1 && /--shard 需要台账 doc 链口径/.test(r.stderr)
|
|
964
|
-
&& !fs.existsSync(shardPathOf(root)) && !fs.existsSync(mainPathOf(root)),
|
|
965
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
966
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
967
|
-
}
|
|
968
|
-
// S42⑥ --shard 与 --no-shard 互斥 → 用法错误
|
|
969
|
-
{
|
|
970
|
-
const root = mkFixture(true);
|
|
971
|
-
const r = spawnConfirm(root, ['--shard', '--no-shard']);
|
|
972
|
-
check('S42⑥ --shard 与 --no-shard 互斥:exit 1 + 用法提示 + 零落账',
|
|
973
|
-
r.status === 1 && /互斥/.test(r.stderr) && !fs.existsSync(shardPathOf(root)) && !fs.existsSync(mainPathOf(root)),
|
|
974
|
-
JSON.stringify({ status: r.status, stderr: r.stderr }));
|
|
975
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
// ---- S43 关单即归档(2026-10-13 archive-on-close;B9 自源仓回灌随件测试):终态家族超窗 → git mv 进 archive ----
|
|
980
|
-
// 需真实 git 仓库(归档走 git mv);家族原子:intent+plan 同进同退。月份断言锚定「实时今月」——
|
|
981
|
-
// 与源仓同口径(台账终态锚 = 实时 now,归档月 = 家族最晚终态月),跨月运行需随今月更新断言。
|
|
982
|
-
{
|
|
983
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-arch-'));
|
|
984
|
-
const git = (...a) => spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', a, { cwd: root, encoding: 'utf8' });
|
|
985
|
-
git('init', '-q');
|
|
986
|
-
git('config', 'user.email', 't@t');
|
|
987
|
-
git('config', 'user.name', 't');
|
|
988
|
-
const ip = path.join(root, 'workflow', 'intents');
|
|
989
|
-
const pp = path.join(root, 'workflow', 'plans');
|
|
990
|
-
fs.mkdirSync(ip, { recursive: true });
|
|
991
|
-
fs.mkdirSync(pp, { recursive: true });
|
|
992
|
-
fs.mkdirSync(path.join(root, 'workflow', 'archive'), { recursive: true }); // 归档约定在场(启用条件)
|
|
993
|
-
// 家族:intent(本次关单)+ plan(已 done 且正文变更在 30 天前 → 超窗)
|
|
994
|
-
fs.writeFileSync(path.join(ip, '2026-09-01-fam.md'), '---\n状态: approved\n级别: L1\n确认指纹: aaaa1111aaaa1111\n---\n# I\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n', 'utf8');
|
|
995
|
-
fs.writeFileSync(path.join(pp, '2026-09-01-fam.md'), '---\n状态: done\n级别: L1\n---\n# P\n\n## 改动方案\n- 正文\n', 'utf8');
|
|
996
|
-
git('add', '-A');
|
|
997
|
-
spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', ['commit', '-q', '-m', 'c1'], { cwd: root, env: { ...process.env, GIT_AUTHOR_DATE: '2026-09-01T10:00:00+08:00', GIT_COMMITTER_DATE: '2026-09-01T10:00:00+08:00' } });
|
|
998
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-01-fam.md', '--delegated', '可以'],
|
|
999
|
-
{ cwd: root, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13' } });
|
|
1000
|
-
const intentArchived = fs.existsSync(path.join(root, 'workflow', 'archive', '2026-10', 'intents', '2026-09-01-fam.md'));
|
|
1001
|
-
const planArchived = fs.existsSync(path.join(root, 'workflow', 'archive', '2026-10', 'plans', '2026-09-01-fam.md'));
|
|
1002
|
-
check('S43 关单即归档:终态家族整族 git mv 进 archive(intent+plan 同批)',
|
|
1003
|
-
r.status === 0 && intentArchived && planArchived && /📦 归档/.test(r.stdout),
|
|
1004
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(-300), stderr: String(r.stderr).slice(-200), intentArchived, planArchived }));
|
|
1005
|
-
check('S43b 归档后活跃目录不再留该家族', !fs.existsSync(path.join(ip, '2026-09-01-fam.md')) && !fs.existsSync(path.join(pp, '2026-09-01-fam.md')));
|
|
1006
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
// ---- S44 归档边界:本次确认的家族即时归档(窗口对其冗余);未涉及的家族不越权清理 ----
|
|
1010
|
-
{
|
|
1011
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-arch2-'));
|
|
1012
|
-
const git = (...a) => spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', a, { cwd: root, encoding: 'utf8' });
|
|
1013
|
-
git('init', '-q');
|
|
1014
|
-
git('config', 'user.email', 't@t');
|
|
1015
|
-
git('config', 'user.name', 't');
|
|
1016
|
-
const ip = path.join(root, 'workflow', 'intents');
|
|
1017
|
-
fs.mkdirSync(ip, { recursive: true });
|
|
1018
|
-
fs.mkdirSync(path.join(root, 'workflow', 'archive'), { recursive: true }); // 归档约定在场(启用条件)
|
|
1019
|
-
// 本次确认的家族(刚落终态 → 即时归档,窗口不适用)
|
|
1020
|
-
fs.writeFileSync(path.join(ip, '2026-10-12-fresh.md'), '---\n状态: approved\n级别: L1\n确认指纹: bbbb2222bbbb2222\n---\n# I\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n', 'utf8');
|
|
1021
|
-
// 未涉及的家族(同为终态、超窗、零引用——但不在本次确认范围,须留守)
|
|
1022
|
-
fs.writeFileSync(path.join(ip, '2026-09-01-other.md'), '---\n状态: done\n级别: L1\n---\n# I2\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n', 'utf8');
|
|
1023
|
-
git('add', '-A');
|
|
1024
|
-
spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', ['commit', '-q', '-m', 'c1'], { cwd: root, env: { ...process.env, GIT_AUTHOR_DATE: '2026-10-12T10:00:00+08:00', GIT_COMMITTER_DATE: '2026-10-12T10:00:00+08:00' } });
|
|
1025
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-10-12-fresh.md', '--delegated', '可以'],
|
|
1026
|
-
{ cwd: root, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13' } });
|
|
1027
|
-
check('S44 本次确认家族即时归档(窗口对刚过确认门的终态件冗余)',
|
|
1028
|
-
r.status === 0 && fs.existsSync(path.join(root, 'workflow', 'archive', '2026-10', 'intents', '2026-10-12-fresh.md')) && /📦 归档/.test(r.stdout),
|
|
1029
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(-200), stderr: String(r.stderr).slice(-200) }));
|
|
1030
|
-
check('S44b 未涉及的家族不越权清理(历史积压走 archive-sweep 手工批次)',
|
|
1031
|
-
fs.existsSync(path.join(ip, '2026-09-01-other.md')),
|
|
1032
|
-
JSON.stringify({ exists: fs.existsSync(path.join(ip, '2026-09-01-other.md')) }));
|
|
1033
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
// ---- S45 归档约定缺席 → 不启用(未采纳归档的仓库不凭空造目录);env 逃生门 CONFIRM_DOC_NO_ARCHIVE ----
|
|
1037
|
-
{
|
|
1038
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-arch3-'));
|
|
1039
|
-
const git = (...a) => spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', a, { cwd: root, encoding: 'utf8' });
|
|
1040
|
-
git('init', '-q');
|
|
1041
|
-
git('config', 'user.email', 't@t');
|
|
1042
|
-
git('config', 'user.name', 't');
|
|
1043
|
-
const ip = path.join(root, 'workflow', 'intents');
|
|
1044
|
-
fs.mkdirSync(ip, { recursive: true });
|
|
1045
|
-
fs.writeFileSync(path.join(ip, '2026-09-01-noconv.md'), '---\n状态: approved\n级别: L1\n确认指纹: cccc3333cccc3333\n---\n# I\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n', 'utf8');
|
|
1046
|
-
git('add', '-A');
|
|
1047
|
-
spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', ['commit', '-q', '-m', 'c1'], { cwd: root, env: { ...process.env, GIT_AUTHOR_DATE: '2026-09-01T10:00:00+08:00', GIT_COMMITTER_DATE: '2026-09-01T10:00:00+08:00' } });
|
|
1048
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-01-noconv.md', '--delegated', '可以'],
|
|
1049
|
-
{ cwd: root, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13' } });
|
|
1050
|
-
check('S45 无 workflow/archive/ 约定 → 不归档、不造目录',
|
|
1051
|
-
r.status === 0 && fs.existsSync(path.join(ip, '2026-09-01-noconv.md')) && !fs.existsSync(path.join(root, 'workflow', 'archive')) && !/📦 归档/.test(r.stdout),
|
|
1052
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(-200) }));
|
|
1053
|
-
// S45b 有归档约定 + CONFIRM_DOC_NO_ARCHIVE=1 → 逃生门生效(关单不归档)
|
|
1054
|
-
const root2 = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-arch4-'));
|
|
1055
|
-
const git2 = (...a) => spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', a, { cwd: root2, encoding: 'utf8' });
|
|
1056
|
-
git2('init', '-q');
|
|
1057
|
-
git2('config', 'user.email', 't@t');
|
|
1058
|
-
git2('config', 'user.name', 't');
|
|
1059
|
-
const ip2 = path.join(root2, 'workflow', 'intents');
|
|
1060
|
-
fs.mkdirSync(ip2, { recursive: true });
|
|
1061
|
-
fs.mkdirSync(path.join(root2, 'workflow', 'archive'), { recursive: true });
|
|
1062
|
-
fs.writeFileSync(path.join(ip2, '2026-09-01-optout.md'), '---\n状态: approved\n级别: L1\n确认指纹: dddd4444dddd4444\n---\n# I\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n', 'utf8');
|
|
1063
|
-
git2('add', '-A');
|
|
1064
|
-
spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', ['commit', '-q', '-m', 'c1'], { cwd: root2, env: { ...process.env, GIT_AUTHOR_DATE: '2026-09-01T10:00:00+08:00', GIT_COMMITTER_DATE: '2026-09-01T10:00:00+08:00' } });
|
|
1065
|
-
const r2 = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-01-optout.md', '--delegated', '可以'],
|
|
1066
|
-
{ cwd: root2, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13', CONFIRM_DOC_NO_ARCHIVE: '1' } });
|
|
1067
|
-
check('S45b CONFIRM_DOC_NO_ARCHIVE 逃生门:关单成功且不归档(状态已置 done)',
|
|
1068
|
-
r2.status === 0 && /状态: done/.test(fs.readFileSync(path.join(ip2, '2026-09-01-optout.md'), 'utf8'))
|
|
1069
|
-
&& !fs.existsSync(path.join(root2, 'workflow', 'archive', 'intents')) && !/📦 归档/.test(r2.stdout),
|
|
1070
|
-
JSON.stringify({ status: r2.status, stdout: String(r2.stdout).slice(-200) }));
|
|
1071
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
1072
|
-
fs.rmSync(root2, { recursive: true, force: true });
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// ---- S45c/S45d 特性分支默认不归档(2026-10-16 自源仓 13f67ef7 回灌)----
|
|
1076
|
-
// 分支上先关单再合并时 diff 只剩 archive/ 路径,泳道/配对增量门只认 workflow 活跃直路径;
|
|
1077
|
-
// main/master/develop 与游离 HEAD 维持关单即归档。CONFIRM_DOC_ARCHIVE=1 可在特性分支强制归档。
|
|
1078
|
-
{
|
|
1079
|
-
const mkRepoBranch = (branchName) => {
|
|
1080
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'confirm-branch-'));
|
|
1081
|
-
const git = (...a) => spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', a, { cwd: root, encoding: 'utf8' });
|
|
1082
|
-
git('init', '-q');
|
|
1083
|
-
git('config', 'user.email', 't@t');
|
|
1084
|
-
git('config', 'user.name', 't');
|
|
1085
|
-
git('checkout', '-q', '-b', branchName);
|
|
1086
|
-
const ip = path.join(root, 'workflow', 'intents');
|
|
1087
|
-
fs.mkdirSync(ip, { recursive: true });
|
|
1088
|
-
fs.mkdirSync(path.join(root, 'workflow', 'archive'), { recursive: true });
|
|
1089
|
-
const fp = branchName === 'main' ? 'eeee5555eeee5555' : 'ffff6666ffff6666';
|
|
1090
|
-
fs.writeFileSync(path.join(ip, '2026-09-01-branch.md'), `---\n状态: approved\n级别: L1\n确认指纹: ${fp}\n---\n# I\n\n## 验收标准(可测试)\n- [x] 通过(证据:测试全绿)\n`, 'utf8');
|
|
1091
|
-
git('add', '-A');
|
|
1092
|
-
spawnSync(process.platform === 'win32' ? 'git.exe' : 'git', ['commit', '-q', '-m', 'c1'], { cwd: root, env: { ...process.env, GIT_AUTHOR_DATE: '2026-09-01T10:00:00+08:00', GIT_COMMITTER_DATE: '2026-09-01T10:00:00+08:00' } });
|
|
1093
|
-
return { root, ip };
|
|
1094
|
-
};
|
|
1095
|
-
// S45c:特性分支关单 → 不归档(保持 workflow 活跃直路径),但状态照常 done
|
|
1096
|
-
{
|
|
1097
|
-
const { root, ip } = mkRepoBranch('feature/x');
|
|
1098
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-01-branch.md', '--delegated', '可以'],
|
|
1099
|
-
{ cwd: root, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13' } });
|
|
1100
|
-
check('S45c 特性分支关单默认不归档(状态置 done、文档留活跃路径)',
|
|
1101
|
-
r.status === 0 && /状态: done/.test(fs.readFileSync(path.join(ip, '2026-09-01-branch.md'), 'utf8'))
|
|
1102
|
-
&& !fs.existsSync(path.join(root, 'workflow', 'archive', 'intents')) && /不归档/.test(r.stdout),
|
|
1103
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(-260) }));
|
|
1104
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
1105
|
-
}
|
|
1106
|
-
// S45d:特性分支 + CONFIRM_DOC_ARCHIVE=1 → 强制归档
|
|
1107
|
-
{
|
|
1108
|
-
const { root } = mkRepoBranch('feature/y');
|
|
1109
|
-
const r = spawnSync(process.execPath, [CLI, 'workflow/intents/2026-09-01-branch.md', '--delegated', '可以'],
|
|
1110
|
-
{ cwd: root, encoding: 'utf8', env: { ...process.env, CONFIRM_DOC_TEST_NOW: '2026-10-13', CONFIRM_DOC_ARCHIVE: '1' } });
|
|
1111
|
-
check('S45d 特性分支 CONFIRM_DOC_ARCHIVE=1 强制归档',
|
|
1112
|
-
r.status === 0 && /📦 归档/.test(r.stdout),
|
|
1113
|
-
JSON.stringify({ status: r.status, stdout: String(r.stdout).slice(-260) }));
|
|
1114
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
console.log(`\n合计: PASS ${pass} / FAIL ${fail}`);
|
|
1119
|
-
process.exit(fail ? 1 : 0);
|