agentic-flow-kit 1.8.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -148
- package/bin/flow-kit.mjs +5 -2
- package/locales/en/installer.json +25 -0
- package/locales/en/overrides/.agents/commands/deploy.md +52 -0
- package/locales/en/overrides/.agents/commands/maintain.md +76 -0
- package/locales/en/overrides/.agents/commands/new-task.md +89 -0
- package/locales/en/overrides/.agents/commands/pipeline-run.md +56 -0
- package/locales/en/overrides/.agents/commands/pr-review.md +30 -0
- package/locales/en/overrides/.agents/commands/review.md +93 -0
- package/locales/en/overrides/.agents/commands/stages.md +256 -0
- package/locales/en/overrides/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/locales/en/overrides/.agents/notes/process-order-rule.md +21 -0
- package/locales/en/overrides/.agents/notes/runtime-env.local.example.md +21 -0
- package/locales/en/overrides/.agents/pipelines/_TEMPLATE.md +75 -0
- package/locales/en/overrides/.agents/pipelines/pipeline-closing.md +28 -0
- package/locales/en/overrides/.agents/roles/implementer.md +28 -0
- package/locales/en/overrides/.agents/roles/independent-reviewer.md +39 -0
- package/locales/en/overrides/.agents/roles/pr-adjudicator.md +27 -0
- package/locales/en/overrides/.agents/roles/pr-finder.md +51 -0
- package/locales/en/overrides/.agents/roles/pr-verifier.md +44 -0
- package/locales/en/overrides/.agents/roles/ui-verifier.md +22 -0
- package/locales/en/overrides/.agents/roles/wiki-compiler.md +47 -0
- package/locales/en/overrides/.agents/skills/arena/SKILL.md +50 -0
- package/locales/en/overrides/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/locales/en/overrides/.agents/skills/blast-radius/SKILL.md +53 -0
- package/locales/en/overrides/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/dev-tour/SKILL.md +98 -0
- package/locales/en/overrides/.agents/skills/dream/SKILL.md +63 -0
- package/locales/en/overrides/.agents/skills/eval/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/interrogate/SKILL.md +49 -0
- package/locales/en/overrides/.agents/skills/number-vetting/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/page-refactor/SKILL.md +192 -0
- package/locales/en/overrides/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/pause-safely/SKILL.md +31 -0
- package/locales/en/overrides/.agents/skills/perf/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/review-method/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/session-resume/SKILL.md +69 -0
- package/locales/en/overrides/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/locales/en/overrides/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/locales/en/overrides/.agents/skills/verify-ui/SKILL.md +116 -0
- package/locales/en/overrides/.agents/skills/visual-parity/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/why/SKILL.md +56 -0
- package/locales/en/overrides/.agents/skills/wiki/SKILL.md +53 -0
- package/locales/en/overrides/.claude/agents/implementer.md +9 -0
- package/locales/en/overrides/.claude/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.claude/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.cline/agents/implementer.yml +13 -0
- package/locales/en/overrides/.cline/agents/independent-reviewer.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-adjudicator.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-finder.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-verifier.yml +11 -0
- package/locales/en/overrides/.cline/agents/ui-verifier.yml +8 -0
- package/locales/en/overrides/.cline/agents/wiki-compiler.yml +14 -0
- package/locales/en/overrides/.cline/workflows/wf-deploy.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-maintain.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-new-task.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pr-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/CODEBUDDY.md +7 -0
- package/locales/en/overrides/.codebuddy/agents/implementer.md +9 -0
- package/locales/en/overrides/.codebuddy/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.codebuddy/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.codebuddy/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/locales/en/overrides/.commandcode/agents/implementer.md +10 -0
- package/locales/en/overrides/.commandcode/agents/independent-reviewer.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-adjudicator.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-finder.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-verifier.md +9 -0
- package/locales/en/overrides/.commandcode/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.commandcode/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.commandcode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.opencode/agents/implementer.md +51 -0
- package/locales/en/overrides/.opencode/agents/independent-reviewer.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-adjudicator.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-finder.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-verifier.md +18 -0
- package/locales/en/overrides/.opencode/agents/ui-verifier.md +45 -0
- package/locales/en/overrides/.opencode/agents/wiki-compiler.md +51 -0
- package/locales/en/overrides/.opencode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.pi/agents/implementer.md +11 -0
- package/locales/en/overrides/.pi/agents/independent-reviewer.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-adjudicator.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-finder.md +11 -0
- package/locales/en/overrides/.pi/agents/pr-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/wiki-compiler.md +11 -0
- package/locales/en/overrides/.qoder/agents/implementer.md +9 -0
- package/locales/en/overrides/.qoder/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.qoder/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.qwen/agents/implementer.md +10 -0
- package/locales/en/overrides/.qwen/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/wiki-compiler.md +13 -0
- package/locales/en/overrides/.qwen/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.trae/agents/implementer.md +9 -0
- package/locales/en/overrides/.trae/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.trae/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.trae/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.trae/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.zcode/agents/implementer.md +8 -0
- package/locales/en/overrides/.zcode/agents/independent-reviewer.md +8 -0
- package/locales/en/overrides/.zcode/agents/ui-verifier.md +8 -0
- package/locales/en/overrides/.zcode/agents/wiki-compiler.md +8 -0
- package/locales/en/overrides/AGENTS.md +52 -0
- package/locales/en/overrides/CLAUDE.md +20 -0
- package/locales/en/overrides/wiki/INDEX.md +33 -0
- package/locales/en/overrides/wiki/drafts-archive/README.md +6 -0
- package/locales/en/overrides/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/locales/en/overrides/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/locales/en/overrides/workflow/INDEX.md +13 -0
- package/locales/en/overrides/workflow/README.md +67 -0
- package/locales/en/overrides/workflow/archive/README.md +3 -0
- package/locales/en/overrides/workflow/delegations.md +4 -0
- package/locales/en/overrides/workflow/effective-policy.md +4 -0
- package/locales/en/overrides/workflow/gate-cost.md +4 -0
- package/locales/en/overrides/workflow/incidents/_TEMPLATE.md +49 -0
- package/locales/en/overrides/workflow/intents/_TEMPLATE.md +43 -0
- package/locales/en/overrides/workflow/metrics.md +4 -0
- package/locales/en/overrides/workflow/papercuts.md +3 -0
- package/locales/en/overrides/workflow/plans/_TEMPLATE.md +47 -0
- package/locales/en/overrides/workflow/regression-checklist.md +3 -0
- package/locales/en/overrides/workflow/specs/_TEMPLATE.md +86 -0
- package/locales/en/overrides/workflow/verify-evidence.md +4 -0
- package/locales/zh-CN/installer.json +25 -0
- package/package.json +23 -36
- package/schemas/install-manifest.schema.json +24 -0
- package/schemas/project-profile.schema.json +28 -0
- package/src/cli/args.mjs +41 -0
- package/src/cli/main.mjs +72 -0
- package/src/commands/add-host.mjs +29 -0
- package/src/commands/doctor.mjs +80 -0
- package/src/commands/install.mjs +149 -0
- package/src/commands/upgrade.mjs +30 -0
- package/src/git/config.mjs +61 -0
- package/src/hosts/registry.mjs +26 -0
- package/src/i18n.mjs +32 -0
- package/src/install/apply.mjs +124 -0
- package/src/install/manifest.mjs +40 -0
- package/src/install/plan.mjs +83 -0
- package/src/render/tokens.mjs +58 -0
- package/templates/engine/.agents/board/dev-tour.html +1940 -0
- package/templates/engine/.agents/board/index.html +835 -0
- package/templates/engine/.agents/commands/deploy.md +52 -0
- package/templates/engine/.agents/commands/maintain.md +76 -0
- package/templates/engine/.agents/commands/new-task.md +89 -0
- package/templates/engine/.agents/commands/pipeline-run.md +56 -0
- package/templates/engine/.agents/commands/pr-review.md +30 -0
- package/templates/engine/.agents/commands/review.md +93 -0
- package/templates/engine/.agents/commands/stages.md +256 -0
- package/templates/engine/.agents/config/commit-msg-rules.json +7 -0
- package/templates/engine/.agents/config/engine.json +11 -0
- package/templates/engine/.agents/config/gate-budgets.json +5 -0
- package/templates/engine/.agents/config/mechanism-registry.md +62 -0
- package/templates/engine/.agents/config/model-roles.json +26 -0
- package/templates/engine/.agents/config/model-roles.local.example.json +7 -0
- package/templates/engine/.agents/config/pr-review.json +67 -0
- package/templates/engine/.agents/config/principles.md +32 -0
- package/templates/engine/.agents/config/workflow-enums.txt +25 -0
- package/templates/engine/.agents/hooks/check-architecture.mjs +168 -0
- package/templates/engine/.agents/hooks/check-audit-fields.mjs +56 -0
- package/templates/engine/.agents/hooks/check-commit-plan-ref.mjs +84 -0
- package/templates/engine/.agents/hooks/check-confirm-order.mjs +281 -0
- package/templates/engine/.agents/hooks/check-delete-guard.mjs +63 -0
- package/templates/engine/.agents/hooks/check-notify-guard.mjs +55 -0
- package/templates/engine/.agents/hooks/commit-check.cjs +208 -0
- package/templates/engine/.agents/hooks/gates.json +33 -0
- package/templates/engine/.agents/hooks/local-pre-commit.mjs +27 -0
- package/templates/engine/.agents/hooks/pre-shell-check.cjs +361 -0
- package/templates/engine/.agents/hooks/pre-write-check.cjs +220 -0
- package/templates/engine/.agents/notes/gate-diet.md +75 -0
- package/templates/engine/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/templates/engine/.agents/notes/process-order-rule.md +21 -0
- package/templates/engine/.agents/notes/runtime-env.local.example.md +21 -0
- package/templates/engine/.agents/pipelines/_TEMPLATE.md +75 -0
- package/templates/engine/.agents/pipelines/pipeline-closing.md +28 -0
- package/templates/engine/.agents/pipelines//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +16 -0
- package/templates/engine/.agents/roles/implementer.md +28 -0
- package/templates/engine/.agents/roles/independent-reviewer.md +39 -0
- package/templates/engine/.agents/roles/pr-adjudicator.md +27 -0
- package/templates/engine/.agents/roles/pr-finder.md +51 -0
- package/templates/engine/.agents/roles/pr-verifier.md +44 -0
- package/templates/engine/.agents/roles/ui-verifier.md +22 -0
- package/templates/engine/.agents/roles/wiki-compiler.md +47 -0
- package/templates/engine/.agents/scripts/agg-delegations.mjs +439 -0
- package/templates/engine/.agents/scripts/agg-judgments.mjs +301 -0
- package/templates/engine/.agents/scripts/agg-kb-usage.mjs +196 -0
- package/templates/engine/.agents/scripts/append-compensation.mjs +109 -0
- package/templates/engine/.agents/scripts/archive-sweep.mjs +229 -0
- package/templates/engine/.agents/scripts/auto-tour.mjs +77 -0
- package/templates/engine/.agents/scripts/board-port.mjs +17 -0
- package/templates/engine/.agents/scripts/check-doc-body-drift.mjs +102 -0
- package/templates/engine/.agents/scripts/check-engine-artifacts.mjs +54 -0
- package/templates/engine/.agents/scripts/check-hook-wiring.mjs +75 -0
- package/templates/engine/.agents/scripts/check-lane-surface.mjs +393 -0
- package/templates/engine/.agents/scripts/check-ledger-doc-presence.mjs +71 -0
- package/templates/engine/.agents/scripts/check-ledger-invariant.mjs +873 -0
- package/templates/engine/.agents/scripts/check-local-gate-config.mjs +95 -0
- package/templates/engine/.agents/scripts/check-local-gates.mjs +248 -0
- package/templates/engine/.agents/scripts/check-loop-kit.mjs +550 -0
- package/templates/engine/.agents/scripts/check-loop-rev-semantics.mjs +59 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s01-pairing.mjs +116 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s03x-regr-evidence.mjs +38 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s08-acceptance.mjs +130 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s15-fingerprint.mjs +152 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s23-convergence-audit.mjs +182 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s29-regr-enforcer.mjs +69 -0
- package/templates/engine/.agents/scripts/check-loop.mjs +131 -0
- package/templates/engine/.agents/scripts/check-regression-consistency.mjs +252 -0
- package/templates/engine/.agents/scripts/check-schema-residue.mjs +144 -0
- package/templates/engine/.agents/scripts/check-scope-range.mjs +156 -0
- package/templates/engine/.agents/scripts/check-scope.mjs +121 -0
- package/templates/engine/.agents/scripts/check-scripts-syntax.mjs +138 -0
- package/templates/engine/.agents/scripts/check-secrets-lite.mjs +239 -0
- package/templates/engine/.agents/scripts/check-secrets.mjs +104 -0
- package/templates/engine/.agents/scripts/check-test-impact-map.mjs +107 -0
- package/templates/engine/.agents/scripts/ci-assert-frontend-deps.mjs +42 -0
- package/templates/engine/.agents/scripts/ci-commit-hygiene.mjs +86 -0
- package/templates/engine/.agents/scripts/ci-install-gitleaks.mjs +75 -0
- package/templates/engine/.agents/scripts/ci-push-before.mjs +49 -0
- package/templates/engine/.agents/scripts/closeout.mjs +127 -0
- package/templates/engine/.agents/scripts/compact-ledgers.mjs +70 -0
- package/templates/engine/.agents/scripts/confirm-doc.mjs +737 -0
- package/templates/engine/.agents/scripts/delegation-presence.mjs +38 -0
- package/templates/engine/.agents/scripts/dev-tour-model.mjs +1398 -0
- package/templates/engine/.agents/scripts/dream-run.mjs +283 -0
- package/templates/engine/.agents/scripts/ensure-board.mjs +187 -0
- package/templates/engine/.agents/scripts/failure-attribution.mjs +11 -0
- package/templates/engine/.agents/scripts/fill-intent.mjs +60 -0
- package/templates/engine/.agents/scripts/fill-plan.mjs +105 -0
- package/templates/engine/.agents/scripts/fill-spec.mjs +72 -0
- package/templates/engine/.agents/scripts/gen-dev-tour.mjs +191 -0
- package/templates/engine/.agents/scripts/gen-effective-policy.mjs +113 -0
- package/templates/engine/.agents/scripts/gen-engine-map.mjs +292 -0
- package/templates/engine/.agents/scripts/gen-narrative-claims.mjs +275 -0
- package/templates/engine/.agents/scripts/gen-verify-evidence.mjs +115 -0
- package/templates/engine/.agents/scripts/gen-wiki-board.mjs +221 -0
- package/templates/engine/.agents/scripts/gen-workflow-index.mjs +201 -0
- package/templates/engine/.agents/scripts/gen-workflow-metrics.mjs +692 -0
- package/templates/engine/.agents/scripts/git-merge-jsonl.mjs +62 -0
- package/templates/engine/.agents/scripts/judgment-ledger.mjs +68 -0
- package/templates/engine/.agents/scripts/kb-cache-evict.mjs +50 -0
- package/templates/engine/.agents/scripts/kb-search.mjs +423 -0
- package/templates/engine/.agents/scripts/lane-surface-audit.mjs +145 -0
- package/templates/engine/.agents/scripts/ledger-loader.mjs +77 -0
- package/templates/engine/.agents/scripts/ledger-shards.mjs +346 -0
- package/templates/engine/.agents/scripts/metrics-core.mjs +131 -0
- package/templates/engine/.agents/scripts/pipeline-run.mjs +964 -0
- package/templates/engine/.agents/scripts/policy.mjs +250 -0
- package/templates/engine/.agents/scripts/pr-create.mjs +54 -0
- package/templates/engine/.agents/scripts/pr-review.mjs +1551 -0
- package/templates/engine/.agents/scripts/quote-grounding.mjs +233 -0
- package/templates/engine/.agents/scripts/regen-ledgers.mjs +59 -0
- package/templates/engine/.agents/scripts/rewrite-file.mjs +135 -0
- package/templates/engine/.agents/scripts/rule-budget.mjs +246 -0
- package/templates/engine/.agents/scripts/stage-gates.mjs +812 -0
- package/templates/engine/.agents/scripts/test-impact-lib.mjs +451 -0
- package/templates/engine/.agents/scripts/test-impact.mjs +105 -0
- package/templates/engine/.agents/scripts/trust-mode.mjs +130 -0
- package/templates/engine/.agents/scripts/verify-scope.mjs +163 -0
- package/templates/engine/.agents/scripts/verify-wiki-consistency.mjs +264 -0
- package/templates/engine/.agents/scripts/verify.mjs +847 -0
- package/templates/engine/.agents/scripts/warn-format.mjs +57 -0
- package/templates/engine/.agents/scripts/wf-journal.mjs +230 -0
- package/templates/engine/.agents/scripts/workflow-board-server.mjs +696 -0
- package/templates/engine/.agents/scripts/workflow-enums.mjs +70 -0
- package/templates/engine/.agents/scripts/workflows-check.mjs +260 -0
- package/templates/engine/.agents/settings.json +33 -0
- package/templates/engine/.agents/skills/arena/SKILL.md +50 -0
- package/templates/engine/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/templates/engine/.agents/skills/blast-radius/SKILL.md +53 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/scripts/quality-gates.mjs +430 -0
- package/templates/engine/.agents/skills/dev-tour/SKILL.md +98 -0
- package/templates/engine/.agents/skills/dream/SKILL.md +63 -0
- package/templates/engine/.agents/skills/eval/SKILL.md +42 -0
- package/templates/engine/.agents/skills/eval/scripts/eval-score.mjs +59 -0
- package/templates/engine/.agents/skills/interrogate/SKILL.md +49 -0
- package/templates/engine/.agents/skills/interrogate/scripts/interrogate-plan.mjs +72 -0
- package/templates/engine/.agents/skills/number-vetting/SKILL.md +35 -0
- package/templates/engine/.agents/skills/page-refactor/SKILL.md +192 -0
- package/templates/engine/.agents/skills/page-refactor/references/templates.md +989 -0
- package/templates/engine/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/templates/engine/.agents/skills/papercut-fix/references/response-template.md +81 -0
- package/templates/engine/.agents/skills/pause-safely/SKILL.md +31 -0
- package/templates/engine/.agents/skills/perf/SKILL.md +42 -0
- package/templates/engine/.agents/skills/review-method/SKILL.md +92 -0
- package/templates/engine/.agents/skills/review-method/golden-set.md +61 -0
- package/templates/engine/.agents/skills/session-resume/SKILL.md +69 -0
- package/templates/engine/.agents/skills/session-resume/scripts/worktree-audit.mjs +110 -0
- package/templates/engine/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/templates/engine/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/templates/engine/.agents/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/templates/engine/.agents/skills/show-me-your-work/scripts/decision-log.mjs +24 -0
- package/templates/engine/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/templates/engine/.agents/skills/tfs-pr/scripts/tfs-pr.mjs +947 -0
- package/templates/engine/.agents/skills/verify-ui/SKILL.md +116 -0
- package/templates/engine/.agents/skills/verify-ui/features/.gitkeep +0 -0
- package/templates/engine/.agents/skills/verify-ui/scripts/gen-verify-feature.mjs +114 -0
- package/templates/engine/.agents/skills/visual-parity/SKILL.md +35 -0
- package/templates/engine/.agents/skills/why/SKILL.md +56 -0
- package/templates/engine/.agents/skills/why/scripts/why-evidence.mjs +74 -0
- package/templates/engine/.agents/skills/wiki/SKILL.md +53 -0
- package/templates/engine/.agents/tests/auto-tour.test.mjs +82 -0
- package/templates/engine/.agents/tests/dev-tour-model.test.mjs +452 -0
- package/templates/engine/.agents/tests/fill-plan-lite.test.mjs +46 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.md +14 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.model.json +179 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.md +21 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.model.json +194 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.md +20 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.model.json +225 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.md +15 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.model.json +160 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.model.json +266 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.md +17 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.model.json +359 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.md +16 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.model.json +131 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.model.json +190 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.model.json +362 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.model.json +224 -0
- package/templates/engine/.agents/tests/tools/gen-synthetic-plan.mjs +108 -0
- package/templates/git/.gitattributes +22 -0
- package/templates/git/.githooks/commit-msg +72 -0
- package/templates/git/.githooks/post-commit +62 -0
- package/templates/git/.githooks/pre-commit +197 -0
- package/templates/git/.githooks/pre-merge-commit +28 -0
- package/templates/git/.githooks/pre-push +201 -0
- package/templates/git/.gitignore.engine +11 -0
- package/templates/hosts/claude/CLAUDE.md +55 -0
- package/templates/hosts/claude/agents/implementer.md +7 -0
- package/templates/hosts/claude/agents/independent-reviewer.md +8 -0
- package/templates/hosts/claude/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/claude/agents/pr-finder.md +8 -0
- package/templates/hosts/claude/agents/pr-verifier.md +8 -0
- package/templates/hosts/claude/agents/ui-verifier.md +8 -0
- package/templates/hosts/claude/agents/wiki-compiler.md +8 -0
- package/templates/hosts/claude/commands/wf-deploy.md +10 -0
- package/templates/hosts/claude/commands/wf-maintain.md +10 -0
- package/templates/hosts/claude/commands/wf-new-task.md +10 -0
- package/templates/hosts/claude/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/claude/commands/wf-pr-review.md +10 -0
- package/templates/hosts/claude/commands/wf-review.md +10 -0
- package/templates/hosts/claude/commands/wf-stages.md +10 -0
- package/templates/hosts/claude/settings.json +57 -0
- package/templates/hosts/cline/agents/implementer.yml +15 -0
- package/templates/hosts/cline/agents/independent-reviewer.yml +20 -0
- package/templates/hosts/cline/agents/pr-adjudicator.yml +18 -0
- package/templates/hosts/cline/agents/pr-finder.yml +19 -0
- package/templates/hosts/cline/agents/pr-verifier.yml +18 -0
- package/templates/hosts/cline/agents/ui-verifier.yml +17 -0
- package/templates/hosts/cline/agents/wiki-compiler.yml +20 -0
- package/templates/hosts/cline/hooks/PreToolUse.cjs +260 -0
- package/templates/hosts/cline/workflows/wf-deploy.md +8 -0
- package/templates/hosts/cline/workflows/wf-maintain.md +8 -0
- package/templates/hosts/cline/workflows/wf-new-task.md +8 -0
- package/templates/hosts/cline/workflows/wf-pipeline-run.md +8 -0
- package/templates/hosts/cline/workflows/wf-pr-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-stages.md +8 -0
- package/templates/hosts/codebuddy/CODEBUDDY.md +7 -0
- package/templates/hosts/codebuddy/agents/implementer.md +9 -0
- package/templates/hosts/codebuddy/agents/independent-reviewer.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-finder.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-verifier.md +10 -0
- package/templates/hosts/codebuddy/agents/ui-verifier.md +11 -0
- package/templates/hosts/codebuddy/agents/wiki-compiler.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-deploy.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-maintain.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-new-task.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pr-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-stages.md +10 -0
- package/templates/hosts/codebuddy/rules/backend-scope.md +5 -0
- package/templates/hosts/codebuddy/rules/frontend-scope.md +5 -0
- package/templates/hosts/codebuddy/settings.json +31 -0
- package/templates/hosts/codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/templates/hosts/commandcode/agents/implementer.md +10 -0
- package/templates/hosts/commandcode/agents/independent-reviewer.md +9 -0
- package/templates/hosts/commandcode/agents/pr-adjudicator.md +9 -0
- package/templates/hosts/commandcode/agents/pr-finder.md +9 -0
- package/templates/hosts/commandcode/agents/pr-verifier.md +9 -0
- package/templates/hosts/commandcode/agents/ui-verifier.md +11 -0
- package/templates/hosts/commandcode/agents/wiki-compiler.md +10 -0
- package/templates/hosts/commandcode/commands/wf-deploy.md +9 -0
- package/templates/hosts/commandcode/commands/wf-maintain.md +9 -0
- package/templates/hosts/commandcode/commands/wf-new-task.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pr-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-stages.md +9 -0
- package/templates/hosts/commandcode/settings.json +59 -0
- package/templates/hosts/opencode/agents/implementer.md +51 -0
- package/templates/hosts/opencode/agents/independent-reviewer.md +18 -0
- package/templates/hosts/opencode/agents/pr-adjudicator.md +18 -0
- package/templates/hosts/opencode/agents/pr-finder.md +18 -0
- package/templates/hosts/opencode/agents/pr-verifier.md +18 -0
- package/templates/hosts/opencode/agents/ui-verifier.md +45 -0
- package/templates/hosts/opencode/agents/wiki-compiler.md +51 -0
- package/templates/hosts/opencode/commands/wf-deploy.md +7 -0
- package/templates/hosts/opencode/commands/wf-maintain.md +7 -0
- package/templates/hosts/opencode/commands/wf-new-task.md +7 -0
- package/templates/hosts/opencode/commands/wf-pipeline-run.md +7 -0
- package/templates/hosts/opencode/commands/wf-pr-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-stages.md +7 -0
- package/templates/hosts/pi/agents/implementer.md +10 -0
- package/templates/hosts/pi/agents/independent-reviewer.md +11 -0
- package/templates/hosts/pi/agents/pr-adjudicator.md +11 -0
- package/templates/hosts/pi/agents/pr-finder.md +10 -0
- package/templates/hosts/pi/agents/pr-verifier.md +10 -0
- package/templates/hosts/pi/agents/ui-verifier.md +10 -0
- package/templates/hosts/pi/agents/wiki-compiler.md +10 -0
- package/templates/hosts/pi/extensions/lib/gates-core.cjs +196 -0
- package/templates/hosts/pi/extensions/shipyard-gates.ts +95 -0
- package/templates/hosts/pi/settings.json +5 -0
- package/templates/hosts/qoder/agents/implementer.md +9 -0
- package/templates/hosts/qoder/agents/independent-reviewer.md +10 -0
- package/templates/hosts/qoder/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/qoder/agents/pr-finder.md +10 -0
- package/templates/hosts/qoder/agents/pr-verifier.md +10 -0
- package/templates/hosts/qoder/agents/ui-verifier.md +10 -0
- package/templates/hosts/qoder/agents/wiki-compiler.md +10 -0
- package/templates/hosts/qoder/commands/wf-deploy.md +8 -0
- package/templates/hosts/qoder/commands/wf-maintain.md +8 -0
- package/templates/hosts/qoder/commands/wf-new-task.md +8 -0
- package/templates/hosts/qoder/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/qoder/commands/wf-pr-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-stages.md +8 -0
- package/templates/hosts/qoder/settings.json +63 -0
- package/templates/hosts/qwen/agents/implementer.md +8 -0
- package/templates/hosts/qwen/agents/independent-reviewer.md +8 -0
- package/templates/hosts/qwen/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/qwen/agents/pr-finder.md +8 -0
- package/templates/hosts/qwen/agents/pr-verifier.md +8 -0
- package/templates/hosts/qwen/agents/ui-verifier.md +8 -0
- package/templates/hosts/qwen/agents/wiki-compiler.md +11 -0
- package/templates/hosts/qwen/commands/wf-deploy.md +9 -0
- package/templates/hosts/qwen/commands/wf-maintain.md +9 -0
- package/templates/hosts/qwen/commands/wf-new-task.md +9 -0
- package/templates/hosts/qwen/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/qwen/commands/wf-pr-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-stages.md +9 -0
- package/templates/hosts/qwen/settings.json +59 -0
- package/templates/hosts/trae/agents/implementer.md +9 -0
- package/templates/hosts/trae/agents/independent-reviewer.md +10 -0
- package/templates/hosts/trae/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/trae/agents/pr-finder.md +10 -0
- package/templates/hosts/trae/agents/pr-verifier.md +10 -0
- package/templates/hosts/trae/agents/ui-verifier.md +10 -0
- package/templates/hosts/trae/agents/wiki-compiler.md +10 -0
- package/templates/hosts/trae/commands/wf-deploy.md +8 -0
- package/templates/hosts/trae/commands/wf-maintain.md +8 -0
- package/templates/hosts/trae/commands/wf-new-task.md +8 -0
- package/templates/hosts/trae/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/trae/commands/wf-pr-review.md +8 -0
- package/templates/hosts/trae/commands/wf-review.md +8 -0
- package/templates/hosts/trae/commands/wf-stages.md +8 -0
- package/templates/hosts/trae/hooks.json +17 -0
- package/templates/hosts/trae/rules/backend-scope.md +5 -0
- package/templates/hosts/trae/rules/frontend-scope.md +5 -0
- package/templates/hosts/zcode/agents/implementer.md +8 -0
- package/templates/hosts/zcode/agents/independent-reviewer.md +8 -0
- package/templates/hosts/zcode/agents/ui-verifier.md +8 -0
- package/templates/hosts/zcode/agents/wiki-compiler.md +8 -0
- package/templates/hosts/zcode/config.json +31 -0
- package/templates/hosts/zcode/workflows/code-review.dwf.ts +428 -0
- package/templates/hosts/zcode/workflows/fullchain-flow-test.dwf.ts +898 -0
- package/templates/profiles/dotnet/.agents/config/lane-surfaces.txt +33 -0
- package/templates/profiles/dotnet/.agents/config/rule-budgets.txt +84 -0
- package/templates/profiles/dotnet/.agents/config/test-impact-map.json +590 -0
- package/templates/profiles/dotnet/.agents/config/workflow-modules.txt +18 -0
- package/templates/profiles/dotnet/.agents/hooks/commit-check.config.json +18 -0
- package/templates/profiles/dotnet/.agents/hooks/delete-guard-allowlist.txt +28 -0
- package/templates/profiles/dotnet/.agents/notes/runtime-env.md +178 -0
- package/templates/profiles/dotnet/AGENTS.md +52 -0
- package/templates/profiles/empty/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/empty/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/empty/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/empty/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/empty/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/empty/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/empty/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/empty/AGENTS.md +52 -0
- package/templates/profiles/node/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/node/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/node/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/node/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/node/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/node/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/node/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/node/AGENTS.md +52 -0
- package/templates/scaffold/wiki/INDEX.md +33 -0
- package/templates/scaffold/wiki/drafts-archive/README.md +7 -0
- package/templates/scaffold/wiki//344/272/247/345/223/201/351/234/200/346/261/202/.gitkeep +0 -0
- package/templates/scaffold/wiki//345/274/200/345/217/221/346/226/271/346/241/210/.gitkeep +0 -0
- package/templates/scaffold/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/templates/scaffold/wiki//346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/224/250/346/210/267/345/212/237/350/203/275/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/templates/scaffold/wiki//351/241/271/347/233/256/350/247/204/350/214/203/.gitkeep +0 -0
- package/templates/scaffold/workflow/INDEX.md +13 -0
- package/templates/scaffold/workflow/README.md +67 -0
- package/templates/scaffold/workflow/archive/README.md +3 -0
- package/templates/scaffold/workflow/delegations.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/delegations.md +4 -0
- package/templates/scaffold/workflow/effective-policy.md +4 -0
- package/templates/scaffold/workflow/evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/gate-cost.md +4 -0
- package/templates/scaffold/workflow/gate-metrics.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/incidents/_TEMPLATE.md +49 -0
- package/templates/scaffold/workflow/intents/_TEMPLATE.md +43 -0
- package/templates/scaffold/workflow/metrics.md +4 -0
- package/templates/scaffold/workflow/papercuts.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/papercuts.md +3 -0
- package/templates/scaffold/workflow/plans/_TEMPLATE.md +47 -0
- package/templates/scaffold/workflow/regression-checklist.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/regression-checklist.md +3 -0
- package/templates/scaffold/workflow/research/.gitkeep +0 -0
- package/templates/scaffold/workflow/reviews.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/specs/_TEMPLATE.md +87 -0
- package/templates/scaffold/workflow/verify-evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/verify-evidence.md +4 -0
- package/LICENSE +0 -21
- package/modules/gates/README.md +0 -25
- package/modules/gates/dotnet-ca/README.md +0 -24
- package/modules/gates/dotnet-ca/check-architecture.sh +0 -150
- package/modules/gates/dotnet-ca/local-pre-commit.line +0 -1
- package/modules/gates/generated-readonly/README.md +0 -13
- package/modules/gates/generated-readonly/check-generated.mjs +0 -61
- package/modules/gates/generated-readonly/local-pre-commit.line +0 -1
- package/modules/gates/node-layer/README.md +0 -9
- package/modules/gates/node-layer/check-node-layer.mjs +0 -29
- package/modules/gates/node-layer/local-pre-commit.line +0 -1
- package/modules/gates/py-import/README.md +0 -9
- package/modules/gates/py-import/check-py-import.mjs +0 -30
- package/modules/gates/py-import/local-pre-commit.line +0 -1
- package/modules/gates/test-protect/README.md +0 -23
- package/modules/gates/test-protect/check-test-protect.mjs +0 -64
- package/modules/gates/test-protect/local-pre-commit.line +0 -1
- package/modules/hosts/README.md +0 -57
- package/modules/hosts/claude/agents/implementer.md +0 -51
- package/modules/hosts/claude/agents/independent-reviewer.md +0 -49
- package/modules/hosts/claude/agents/ui-verifier.md +0 -48
- package/modules/hosts/claude/commands/wf-build.md +0 -69
- package/modules/hosts/claude/commands/wf-deploy.md +0 -58
- package/modules/hosts/claude/commands/wf-design.md +0 -49
- package/modules/hosts/claude/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/claude/commands/wf-maintain.md +0 -76
- package/modules/hosts/claude/commands/wf-new-task.md +0 -102
- package/modules/hosts/claude/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/claude/commands/wf-plan.md +0 -40
- package/modules/hosts/claude/commands/wf-review.md +0 -49
- package/modules/hosts/claude/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/claude/commands/wf-test.md +0 -68
- package/modules/hosts/codex/agents/implementer.md +0 -51
- package/modules/hosts/codex/agents/independent-reviewer.md +0 -49
- package/modules/hosts/codex/agents/ui-verifier.md +0 -48
- package/modules/hosts/codex/commands/wf-build.md +0 -69
- package/modules/hosts/codex/commands/wf-deploy.md +0 -58
- package/modules/hosts/codex/commands/wf-design.md +0 -49
- package/modules/hosts/codex/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/codex/commands/wf-maintain.md +0 -76
- package/modules/hosts/codex/commands/wf-new-task.md +0 -102
- package/modules/hosts/codex/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/codex/commands/wf-plan.md +0 -40
- package/modules/hosts/codex/commands/wf-review.md +0 -49
- package/modules/hosts/codex/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/codex/commands/wf-test.md +0 -68
- package/modules/hosts/codex/skills/flow-kit/SKILL.md +0 -14
- package/modules/hosts/cursor/agents/implementer.md +0 -51
- package/modules/hosts/cursor/agents/independent-reviewer.md +0 -49
- package/modules/hosts/cursor/agents/ui-verifier.md +0 -48
- package/modules/hosts/cursor/commands/wf-build.md +0 -69
- package/modules/hosts/cursor/commands/wf-deploy.md +0 -58
- package/modules/hosts/cursor/commands/wf-design.md +0 -49
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/cursor/commands/wf-maintain.md +0 -76
- package/modules/hosts/cursor/commands/wf-new-task.md +0 -102
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/cursor/commands/wf-plan.md +0 -40
- package/modules/hosts/cursor/commands/wf-review.md +0 -49
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/cursor/commands/wf-test.md +0 -68
- package/modules/hosts/omp/agents/implementer.md +0 -52
- package/modules/hosts/omp/agents/independent-reviewer.md +0 -50
- package/modules/hosts/omp/agents/ui-verifier.md +0 -49
- package/modules/hosts/opencode/agents/implementer.md +0 -59
- package/modules/hosts/opencode/agents/independent-reviewer.md +0 -53
- package/modules/hosts/opencode/agents/ui-verifier.md +0 -52
- package/modules/hosts/opencode/commands/wf-build.md +0 -69
- package/modules/hosts/opencode/commands/wf-deploy.md +0 -58
- package/modules/hosts/opencode/commands/wf-design.md +0 -49
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/opencode/commands/wf-maintain.md +0 -76
- package/modules/hosts/opencode/commands/wf-new-task.md +0 -102
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/opencode/commands/wf-plan.md +0 -40
- package/modules/hosts/opencode/commands/wf-review.md +0 -49
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/opencode/commands/wf-test.md +0 -68
- package/modules/hosts/trae/agents/implementer.md +0 -52
- package/modules/hosts/trae/agents/independent-reviewer.md +0 -51
- package/modules/hosts/trae/agents/ui-verifier.md +0 -50
- package/modules/hosts/trae/commands/wf-build.md +0 -70
- package/modules/hosts/trae/commands/wf-deploy.md +0 -59
- package/modules/hosts/trae/commands/wf-design.md +0 -50
- package/modules/hosts/trae/commands/wf-gate-checklist.md +0 -78
- package/modules/hosts/trae/commands/wf-maintain.md +0 -77
- package/modules/hosts/trae/commands/wf-new-task.md +0 -103
- package/modules/hosts/trae/commands/wf-pipeline-run.md +0 -36
- package/modules/hosts/trae/commands/wf-plan.md +0 -41
- package/modules/hosts/trae/commands/wf-review.md +0 -50
- package/modules/hosts/trae/commands/wf-sync-hosts.md +0 -65
- package/modules/hosts/trae/commands/wf-test.md +0 -69
- package/modules/hosts/trae/hooks/post-edit-check.cjs +0 -98
- package/modules/hosts/trae/hooks/pre-shell-check.cjs +0 -192
- package/modules/hosts/trae/hooks/resolve-shell.cjs +0 -30
- package/modules/hosts/trae/hooks.json +0 -29
- package/modules/hosts/trae/rules/beautify-input-chinese.md +0 -6
- package/modules/hosts/trae/rules/git-commit-message.md +0 -10
- package/modules/hosts/trae/rules/project-workflow.md +0 -14
- package/modules/hosts/zcode/agents/implementer.md +0 -51
- package/modules/hosts/zcode/agents/independent-reviewer.md +0 -49
- package/modules/hosts/zcode/agents/ui-verifier.md +0 -48
- package/src/add-gate.mjs +0 -116
- package/src/add-gate.test.mjs +0 -103
- package/src/add-host.mjs +0 -68
- package/src/cli.mjs +0 -169
- package/src/doctor.mjs +0 -629
- package/src/executor.mjs +0 -262
- package/src/executor.test.mjs +0 -295
- package/src/fresh-init.test.mjs +0 -64
- package/src/gate-dotnet-ca.test.mjs +0 -124
- package/src/gates.test.mjs +0 -143
- package/src/init.mjs +0 -382
- package/src/init.test.mjs +0 -163
- package/src/instance-ref.test.mjs +0 -62
- package/src/jscpd-drift.test.mjs +0 -144
- package/src/pack.test.mjs +0 -24
- package/src/profiles.mjs +0 -183
- package/src/render.mjs +0 -132
- package/src/rule-budget.test.mjs +0 -103
- package/src/run-tests.mjs +0 -56
- package/src/stack-profile.test.mjs +0 -95
- package/src/sync-hosts.mjs +0 -257
- package/src/sync-hosts.test.mjs +0 -291
- package/src/sync.mjs +0 -228
- package/src/sync.test.mjs +0 -452
- package/src/trae-hooks.test.mjs +0 -127
- package/src/validate.mjs +0 -77
- package/src/validate.test.mjs +0 -95
- package/templates/.gitattributes +0 -17
- package/templates/AGENTS.md +0 -57
- package/templates/_agents/board/index.html +0 -676
- package/templates/_agents/commands/build.md +0 -84
- package/templates/_agents/commands/deploy.md +0 -66
- package/templates/_agents/commands/design.md +0 -63
- package/templates/_agents/commands/gate-checklist.md +0 -91
- package/templates/_agents/commands/maintain.md +0 -90
- package/templates/_agents/commands/new-task.md +0 -110
- package/templates/_agents/commands/pipeline-run.md +0 -43
- package/templates/_agents/commands/plan.md +0 -48
- package/templates/_agents/commands/review.md +0 -62
- package/templates/_agents/commands/sync-hosts.md +0 -77
- package/templates/_agents/commands/test.md +0 -87
- package/templates/_agents/control-surfaces.txt +0 -53
- package/templates/_agents/engine-lock.json +0 -342
- package/templates/_agents/hooks/check-index-incremental.mjs +0 -48
- package/templates/_agents/hooks/check-pairing-incremental.mjs +0 -66
- package/templates/_agents/hooks/check-wiki-ledger.mjs +0 -30
- package/templates/_agents/hooks/commit-check.cjs +0 -193
- package/templates/_agents/hooks/local-pre-commit +0 -6
- package/templates/_agents/lane-surfaces.txt +0 -17
- package/templates/_agents/level-hints.txt +0 -30
- package/templates/_agents/loop/papercut-debt/DESIGN.md +0 -112
- package/templates/_agents/mechanism-registry.md +0 -27
- package/templates/_agents/metric-claims.txt +0 -81
- package/templates/_agents/notes/engine-internals.md +0 -17
- package/templates/_agents/notes/runtime-env.md +0 -18
- package/templates/_agents/roles/implementer.md +0 -47
- package/templates/_agents/roles/independent-reviewer.md +0 -45
- package/templates/_agents/roles/ui-verifier.md +0 -44
- package/templates/_agents/rule-budgets.txt +0 -18
- package/templates/_agents/scripts/agg-delegations.cjs +0 -302
- package/templates/_agents/scripts/agg-delegations.test.mjs +0 -282
- package/templates/_agents/scripts/agg-gate-stats.mjs +0 -113
- package/templates/_agents/scripts/agg-gate-stats.test.mjs +0 -95
- package/templates/_agents/scripts/agg-judgments.mjs +0 -156
- package/templates/_agents/scripts/agg-judgments.test.mjs +0 -93
- package/templates/_agents/scripts/archive-sweep.mjs +0 -235
- package/templates/_agents/scripts/archive-sweep.test.mjs +0 -129
- package/templates/_agents/scripts/check-attribution.mjs +0 -37
- package/templates/_agents/scripts/check-convergence.mjs +0 -124
- package/templates/_agents/scripts/check-engine-integrity.mjs +0 -220
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +0 -215
- package/templates/_agents/scripts/check-funnel.mjs +0 -56
- package/templates/_agents/scripts/check-hygiene.mjs +0 -167
- package/templates/_agents/scripts/check-hygiene.test.mjs +0 -182
- package/templates/_agents/scripts/check-index-incremental.test.mjs +0 -73
- package/templates/_agents/scripts/check-lane-surface.mjs +0 -238
- package/templates/_agents/scripts/check-lane-surface.test.mjs +0 -302
- package/templates/_agents/scripts/check-ledger-invariant.mjs +0 -527
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +0 -639
- package/templates/_agents/scripts/check-loop-rev.test.mjs +0 -336
- package/templates/_agents/scripts/check-loop-unit.test.mjs +0 -103
- package/templates/_agents/scripts/check-loop.mjs +0 -1958
- package/templates/_agents/scripts/check-loop.sh +0 -6
- package/templates/_agents/scripts/check-loop.test.mjs +0 -3875
- package/templates/_agents/scripts/check-metric-claims.mjs +0 -277
- package/templates/_agents/scripts/check-prejudgment.mjs +0 -64
- package/templates/_agents/scripts/check-registry.mjs +0 -45
- package/templates/_agents/scripts/check-scope.mjs +0 -96
- package/templates/_agents/scripts/check-scope.test.mjs +0 -96
- package/templates/_agents/scripts/check-scripts-syntax.mjs +0 -61
- package/templates/_agents/scripts/check-scripts-syntax.test.mjs +0 -72
- package/templates/_agents/scripts/check-spec-verif.mjs +0 -47
- package/templates/_agents/scripts/check-stage-index.mjs +0 -40
- package/templates/_agents/scripts/check-stage-index.test.mjs +0 -77
- package/templates/_agents/scripts/closeout-l1.mjs +0 -217
- package/templates/_agents/scripts/closeout-l1.test.mjs +0 -105
- package/templates/_agents/scripts/commit-check-trigger.test.mjs +0 -205
- package/templates/_agents/scripts/compact-ledgers.mjs +0 -97
- package/templates/_agents/scripts/compact-ledgers.test.mjs +0 -162
- package/templates/_agents/scripts/confirm-doc.mjs +0 -603
- package/templates/_agents/scripts/confirm-doc.test.mjs +0 -1103
- package/templates/_agents/scripts/doctor.test.mjs +0 -770
- package/templates/_agents/scripts/draft-sediment.mjs +0 -178
- package/templates/_agents/scripts/draft-sediment.test.mjs +0 -272
- package/templates/_agents/scripts/edit-face-check.mjs +0 -109
- package/templates/_agents/scripts/edit-face-check.test.mjs +0 -99
- package/templates/_agents/scripts/ensure-board.mjs +0 -185
- package/templates/_agents/scripts/fill-intent.mjs +0 -91
- package/templates/_agents/scripts/fill-intent.test.mjs +0 -113
- package/templates/_agents/scripts/fill-plan.mjs +0 -79
- package/templates/_agents/scripts/fill-plan.test.mjs +0 -224
- package/templates/_agents/scripts/fill-spec.mjs +0 -70
- package/templates/_agents/scripts/fill-spec.test.mjs +0 -266
- package/templates/_agents/scripts/fixture-scripts.mjs +0 -153
- package/templates/_agents/scripts/fixture-scripts.test.mjs +0 -112
- package/templates/_agents/scripts/gate-checklist.mjs +0 -209
- package/templates/_agents/scripts/gate-checklist.test.mjs +0 -201
- package/templates/_agents/scripts/gate-seg.mjs +0 -54
- package/templates/_agents/scripts/gate-seg.test.mjs +0 -112
- package/templates/_agents/scripts/gen-effective-policy.mjs +0 -107
- package/templates/_agents/scripts/gen-effective-policy.test.mjs +0 -100
- package/templates/_agents/scripts/gen-verify-evidence.mjs +0 -107
- package/templates/_agents/scripts/gen-verify-evidence.test.mjs +0 -84
- package/templates/_agents/scripts/gen-wiki-board.mjs +0 -276
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +0 -249
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +0 -251
- package/templates/_agents/scripts/gen-workflow-dashboard.test.mjs +0 -188
- package/templates/_agents/scripts/gen-workflow-index.mjs +0 -201
- package/templates/_agents/scripts/gen-workflow-index.test.mjs +0 -152
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +0 -334
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +0 -224
- package/templates/_agents/scripts/git-merge-jsonl.mjs +0 -63
- package/templates/_agents/scripts/git-merge-jsonl.test.mjs +0 -125
- package/templates/_agents/scripts/judgment-ledger.mjs +0 -65
- package/templates/_agents/scripts/judgment-ledger.test.mjs +0 -129
- package/templates/_agents/scripts/kb-cache-evict.mjs +0 -50
- package/templates/_agents/scripts/kb-cache-evict.test.mjs +0 -104
- package/templates/_agents/scripts/kb-search.mjs +0 -413
- package/templates/_agents/scripts/kb-search.test.mjs +0 -299
- package/templates/_agents/scripts/lane-surface-audit.mjs +0 -143
- package/templates/_agents/scripts/lane-surface-audit.test.mjs +0 -93
- package/templates/_agents/scripts/ledger-doc-chain.test.mjs +0 -166
- package/templates/_agents/scripts/ledger-loader.mjs +0 -108
- package/templates/_agents/scripts/ledger-loader.test.mjs +0 -131
- package/templates/_agents/scripts/ledger-prune.mjs +0 -96
- package/templates/_agents/scripts/ledger-prune.test.mjs +0 -120
- package/templates/_agents/scripts/ledger-shards.mjs +0 -344
- package/templates/_agents/scripts/ledger-shards.test.mjs +0 -356
- package/templates/_agents/scripts/ledger-ts-monotonic.test.mjs +0 -135
- package/templates/_agents/scripts/level-criteria.mjs +0 -231
- package/templates/_agents/scripts/level-criteria.test.mjs +0 -281
- package/templates/_agents/scripts/mechanism-retire-watch.mjs +0 -183
- package/templates/_agents/scripts/mechanism-retire-watch.test.mjs +0 -114
- package/templates/_agents/scripts/papercut-debt-controller.mjs +0 -141
- package/templates/_agents/scripts/papercut-debt-controller.test.mjs +0 -127
- package/templates/_agents/scripts/papercut-debt-sensor.mjs +0 -170
- package/templates/_agents/scripts/papercut-debt-sensor.test.mjs +0 -146
- package/templates/_agents/scripts/pipeline-run-docs.mjs +0 -76
- package/templates/_agents/scripts/pipeline-run-run.mjs +0 -63
- package/templates/_agents/scripts/pipeline-run.mjs +0 -867
- package/templates/_agents/scripts/pipeline-run.test.mjs +0 -517
- package/templates/_agents/scripts/policy.mjs +0 -281
- package/templates/_agents/scripts/pre-push.test.mjs +0 -105
- package/templates/_agents/scripts/resolve-merge-conflicts.mjs +0 -110
- package/templates/_agents/scripts/resolve-merge-conflicts.test.mjs +0 -87
- package/templates/_agents/scripts/rewrite-file.mjs +0 -133
- package/templates/_agents/scripts/rewrite-file.test.mjs +0 -148
- package/templates/_agents/scripts/rule-budget.mjs +0 -96
- package/templates/_agents/scripts/rule-budget.test.mjs +0 -118
- package/templates/_agents/scripts/run-tests.mjs +0 -99
- package/templates/_agents/scripts/run-tests.test.mjs +0 -105
- package/templates/_agents/scripts/solidify-task.mjs +0 -107
- package/templates/_agents/scripts/solidify-task.test.mjs +0 -129
- package/templates/_agents/scripts/stage-gates.mjs +0 -343
- package/templates/_agents/scripts/stage-gates.test.mjs +0 -105
- package/templates/_agents/scripts/trust-mode.mjs +0 -67
- package/templates/_agents/scripts/trust-mode.test.mjs +0 -110
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +0 -253
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +0 -123
- package/templates/_agents/scripts/verify.mjs +0 -210
- package/templates/_agents/scripts/verify.test.mjs +0 -358
- package/templates/_agents/scripts/wf-journal.mjs +0 -231
- package/templates/_agents/scripts/wf-journal.test.mjs +0 -216
- package/templates/_agents/scripts/wiki-search.mjs +0 -19
- package/templates/_agents/scripts/wiki-search.test.mjs +0 -57
- package/templates/_agents/scripts/workflow-board-server.mjs +0 -393
- package/templates/_agents/scripts/workflow-board-server.test.mjs +0 -201
- package/templates/_agents/scripts/workflow-enums.mjs +0 -70
- package/templates/_agents/scripts/workflow-enums.test.mjs +0 -118
- package/templates/_agents/scripts/workflows-check.mjs +0 -260
- package/templates/_agents/scripts/workflows-check.test.mjs +0 -278
- package/templates/_agents/scripts-test-exempt.txt +0 -16
- package/templates/_agents/skills/papercut-fix/SKILL.md +0 -60
- package/templates/_agents/skills/papercut-fix/references/response-template.md +0 -81
- package/templates/_agents/skills/review-method/SKILL.md +0 -55
- package/templates/_agents/skills/verify-ui/SKILL.md +0 -61
- package/templates/_agents/skills/wiki/SKILL.md +0 -106
- package/templates/_agents/workflow-enums.txt +0 -26
- package/templates/_agents/workflow-modules.txt +0 -11
- package/templates/_agents/workflows/_TEMPLATE.md +0 -75
- package/templates/_agents/workflows/pipeline-closing.md +0 -28
- package/templates/_agents/workflows//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +0 -16
- package/templates/_githooks/commit-msg +0 -17
- package/templates/_githooks/post-commit +0 -10
- package/templates/_githooks/pre-commit +0 -126
- package/templates/_githooks/pre-merge-commit +0 -29
- package/templates/_githooks/pre-push +0 -136
- package/templates/_github/workflows/kit-ci.yml +0 -49
- package/templates/wiki/INDEX.md +0 -73
- package/templates/wiki/drafts-archive/README.md +0 -3
- package/templates/wiki//344/272/247/345/223/201/351/234/200/346/261/202/README.md +0 -3
- package/templates/wiki//345/274/200/345/217/221/346/226/271/346/241/210/README.md +0 -3
- package/templates/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +0 -3
- package/templates/wiki//346/265/213/350/257/225/346/212/245/345/221/212/README.md +0 -3
- package/templates/wiki//347/224/250/346/210/267/345/212/237/350/203/275/README.md +0 -3
- package/templates/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +0 -77
- package/templates/wiki//351/241/271/347/233/256/350/247/204/350/214/203/README.md +0 -3
- package/templates/wiki//351/241/271/347/233/256/350/256/241/345/210/222/README.md +0 -3
- package/templates/workflow/README.md +0 -90
- package/templates/workflow/delegations.md +0 -29
- package/templates/workflow/incidents/_TEMPLATE.md +0 -51
- package/templates/workflow/intents/_TEMPLATE.md +0 -46
- package/templates/workflow/papercuts.md +0 -9
- package/templates/workflow/plans/_TEMPLATE.md +0 -47
- package/templates/workflow/regression-checklist.md +0 -23
- package/templates/workflow/specs/_TEMPLATE.md +0 -80
- /package/templates/{_agents → engine/.agents}/board/marked.min.js +0 -0
- /package/templates/{_agents/workflows → engine/.agents/pipelines}/steps//347/244/272/344/276/213-/351/203/250/347/275/262/351/252/214/350/257/201.md" +0 -0
- /package/templates/{_agents → engine/.agents}/scripts/git-core.mjs +0 -0
|
@@ -1,527 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// check-ledger-invariant — confirmations 台账提交不变量(2026-10-02 ledger-ci-invariant;
|
|
3
|
-
// 2026-10-12 ledger-shard-invariant:校验面自单一主台账扩展到「主台账 + confirmations.d 分片」;
|
|
4
|
-
// 2026-10-13 深水批次:合并感知删片 / 终树补登追认 / 补登语义身份 / DAG 感知 + 历史基线,
|
|
5
|
-
// 判据自多 worktree 合并丢行事故后的实战实现逐字回灌(出处留包源仓 git 历史与 CHANGELOG))
|
|
6
|
-
// 目的:把「台账本地可写」的伪造面从事后对质级升为机器可检出级(能力评审审计维度扣分项)。
|
|
7
|
-
// 台账不可变原则:confirmations 历史行禁删改——修正只能走追加补偿行(README 硬规则 6)。
|
|
8
|
-
//
|
|
9
|
-
// 分片形态(2026-10-10 中期方案;2026-10-12 起为 confirm-doc 默认写入口径):
|
|
10
|
-
// .agents/confirmations.d/<doc 基名>.jsonl —— 按 doc 分片,跨机/跨 worktree 确认不同 doc 时
|
|
11
|
-
// 写不同文件,从根上消除「每合并必冲突 + 手工重建」;同一 doc 被两端并发确认时由
|
|
12
|
-
// .gitattributes 的 merge=jsonl-union 驱动取并集(本地须配 merge.jsonl-union.driver:
|
|
13
|
-
// git config merge.jsonl-union.driver "node .agents/scripts/git-merge-jsonl.mjs %O %A %B")。
|
|
14
|
-
// 本脚本给分片补上主台账同级的 append-only 前缀不变量——否则分片是「无人校验的写入面」,
|
|
15
|
-
// 被改写/删除无人知。
|
|
16
|
-
//
|
|
17
|
-
// 特许修剪(2026-10-09 user-directed-prune):仓库所有者明令删除某批 workflow 文档并清理其台账行时,
|
|
18
|
-
// 允许**一次性、逐行对账**的修剪——暂存/提交须同时携带 .agents/ledger-prune-manifest.json
|
|
19
|
-
// ({ts, authority, reason, removes:[被删行 sha256...], docs:[家族名...]},判据单源 ledger-prune.mjs),
|
|
20
|
-
// 门禁逐行核验「新内容 = 旧内容 − manifest 所列各行」且每个哈希恰对应一行。未带 manifest 的
|
|
21
|
-
// 删/改/重排仍全拦——append-only 红线对其他一切场景不变;修剪凭据随 manifest 入库,事后可对质。
|
|
22
|
-
//
|
|
23
|
-
// 分片删除的唯一合法形态 = compact-ledgers 归并(2026-10-12):分片被删时,该分片**全部非空行必须
|
|
24
|
-
// 已存在于同一提交的主台账**(compact-ledgers 正是把这些行原样追加进主台账后才删片)——认不出
|
|
25
|
-
// 归并凭据的删片一律 hard fail,堵住「删片抹账」这条路。主台账自身永不因归并被删。其上三组深水
|
|
26
|
-
// 判据(2026-10-13,实战回灌):
|
|
27
|
-
// ① 合并感知删片(merge-aware-shard-delete):分片内容从**各父提交取并集**后对账——合并解析收口
|
|
28
|
-
// 删片时,分片可能只在第二父侧(首父早已归并删片,实战实证:单看首父会把合法收口误判成
|
|
29
|
-
// 「增删同提交」)。「分片删除丢行」(行未并入主台账)仍 hard 拦。
|
|
30
|
-
// ② 终树补登追认(merge-shard-restore-aware):合并删片缺行、但缺行已原样回 append 到终树主台账
|
|
31
|
-
// (补偿行:新 ts + note 引原 ts)→ 视为丢失已追认,放行——历史事实不可改写,终态无丢失即
|
|
32
|
-
// 审计实质。
|
|
33
|
-
// ③ 补登语义身份比对:补偿行与被删行的等价判定用**语义三元组 {doc, stage, fingerprint}**——
|
|
34
|
-
// 补偿行本就允许改 ts 加 note,逐字节比对会漏掉全部合法补偿行。
|
|
35
|
-
//
|
|
36
|
-
// 合并并集语义(2026-10-13 merge-union-aware):多父提交不按线性前缀判,改验「并集无丢失」——
|
|
37
|
-
// 合并结果的行集合须 ⊇ 各父行集之并(一行不丢)且 ⊆ 该并集(一行不造)。jsonl-union 策略
|
|
38
|
-
// (多 worktree 并行确认的根基)与线性前缀模型天生矛盾,本判据对齐审计实质:确认行不被丢、
|
|
39
|
-
// 不被造。union 不过再试「合并携带 manifest 的特许修剪集合对账」(对父母并集对账,非第一父——
|
|
40
|
-
// 堵 p2 独有行借 p1 相对 manifest 无凭据消失);支持「分支上修剪、合并时落地」的合法形态。
|
|
41
|
-
// 合并通过后以合并 blob 续扫。
|
|
42
|
-
//
|
|
43
|
-
// DAG 感知(2026-10-13 dag-aware-base):历史全扫按 DAG 而非线性——路径史用 --full-history 取全
|
|
44
|
-
// (TREESAME 合并也入列,防「ours 合并丢一侧行」被历史简化隐藏,审计门立场);每个提交自对
|
|
45
|
-
// 己父取基准 blob(第一父;根提交视为新文件起步)——线性化「前一承」在分支汇合处会拿另一侧
|
|
46
|
-
// 提交当基准产生伪前缀破坏。多父提交无条件走并集对账(前缀通过不得短路——ours-resolution 合并
|
|
47
|
-
// 树与第一父逐字节同 blob,嵌套判法对静默丢行全盲)。
|
|
48
|
-
//
|
|
49
|
-
// 历史基线(2026-10-13 ledger-history-baseline 机制,装户自定):LEDGER_HISTORY_BASELINE=<基线提交>
|
|
50
|
-
// 环境变量声明后,基线之前的提交不进前缀扫描——该时代(特许修剪/合并感知机制上线前)的删改
|
|
51
|
-
// 无对账凭据,原理上不可追溯验证(回填凭据须改写历史且属事后伪造授权);基线由 owner 一次性
|
|
52
|
-
// loud 声明,同「流程: legacy / 存量不回填」哲学。基线 blob 为可信起点,基线后提交照常全扫。
|
|
53
|
-
// kit 缺省为空 = 无基线声明 → 全量扫描(最严语义;装户如确认存在机制上线前的存量断档,自行设
|
|
54
|
-
// 基线豁免,豁免计数 loud 出账。env 覆盖亦供测试)。
|
|
55
|
-
//
|
|
56
|
-
// 模式:
|
|
57
|
-
// 历史全扫(缺省,CI 机器门):对主台账与每个分片各自遍历其提交历史,单父提交必须以第一父 blob
|
|
58
|
-
// 为**逐字节前缀**(允许纯追加;禁止删行/改行/重排)——或前缀破坏但该提交树上携带 manifest
|
|
59
|
-
// 恰好对账被删行(特许修剪认领,loud 记录后以新 blob 为基线继续)。多父提交无条件验并集。
|
|
60
|
-
// 分片另判「删除须已归并(①②③)」。blob 读取走 git 对象库(入库 LF 归一口径),不受工作树
|
|
61
|
-
// autocrlf 影响。
|
|
62
|
-
// --staged(pre-commit 前置):主台账暂存 blob ⊇ HEAD blob(或携带 manifest 的特许修剪);分片
|
|
63
|
-
// 三态——纯追加验前缀 / 暂存删除验「行已全部并入暂存主台账」(compact 归并形态放行、丢行
|
|
64
|
-
// hard 拦)/ 新分片首入库无 HEAD 基线跳过(历史全扫续管)。
|
|
65
|
-
//
|
|
66
|
-
// 行级校验(终树,五项;取数面 = ledger-loader 视图:主台账在前、分片按文件名序在后——既有
|
|
67
|
-
// ledger-line-exempt.json 的行号(校验序号即非空行序)不因引入分片而漂移):
|
|
68
|
-
// ① ts 为 ISO 字符串,且**同一 doc 内**非降序(跨 doc 物理序乱序不判、只计数出账——并集合并/
|
|
69
|
-
// 分片归并的正常形态;同 doc 内倒挂仍 hard 拦,跨 doc 插行/改行由检查 15 doc-chain 哈希链兜。
|
|
70
|
-
// 注:实战源实现用「单文件内非降序」——其主台账已单文件单 doc 化;kit 装户存量台账仍是
|
|
71
|
-
// 主台账多 doc 形态,全表判据会因正常并集协作报红逼出 --no-verify,故保留 kit 的 per-doc 口径)
|
|
72
|
-
// ② fingerprint 为 64 位 hex
|
|
73
|
-
// ③ source=chat-delegated 行必有非空 quote(原话对质面)
|
|
74
|
-
// ④ doc 匹配 workflow/(intents|specs|plans|incidents)/[^/]+.md 且当前树存在(**归档感知**,
|
|
75
|
-
// 2026-10-13 archive-aware-doc:四目录原路径未命中再探 workflow/archive/*/——关单即归档移动
|
|
76
|
-
// 文件后行仍指向真实文档;真消失(四目录与归档批次均未命中)仍拦)
|
|
77
|
-
// ⑤ stage ∈ 合法跳转终态集(approved/done/fixed/closed/superseded/cancelled + revert 注记行)
|
|
78
|
-
// 行级豁免(ledger-line-exempt.json)与跨 doc 乱序计数照 kit 既有口径出账。
|
|
79
|
-
//
|
|
80
|
-
// 静默条件:台账路径零提交历史(装户、新仓)/ --staged 且暂存未触任何台账或无 HEAD 版本。
|
|
81
|
-
// 有提交史的路径才进历史扫描**与终树行级校验**(否则新仓首版会被「doc 不存在」误杀)。
|
|
82
|
-
// 已知边界:git log --follow 未用——各台账路径自创建无重命名(单一路径取史);克隆深度不足时仅扫可得
|
|
83
|
-
// 历史(CI 侧 fetch-depth:0 兜全史,深度不足会告警声明边界,fail-open 于深度、fail-closed 于内容)。
|
|
84
|
-
// 用法:node check-ledger-invariant.mjs [--root <仓库根>] [--staged]
|
|
85
|
-
import { execFileSync, spawnSync } from 'node:child_process';
|
|
86
|
-
import fs from 'node:fs';
|
|
87
|
-
import path from 'node:path';
|
|
88
|
-
import { matchPrune, loadManifestFromRef, sha256line, PRUNE_REL } from './ledger-prune.mjs';
|
|
89
|
-
import { readLedgerEntries, SHARD_DIR_REL } from './ledger-loader.mjs';
|
|
90
|
-
|
|
91
|
-
const argv = process.argv.slice(2);
|
|
92
|
-
const argOf = (k) => {
|
|
93
|
-
const i = argv.indexOf(k);
|
|
94
|
-
return i >= 0 && i + 1 < argv.length ? argv[i + 1] : '';
|
|
95
|
-
};
|
|
96
|
-
const staged = argv.includes('--staged');
|
|
97
|
-
const ROOT = argOf('--root') || (staged ? process.cwd() : execFileSync('git', ['rev-parse', '--show-toplevel'], { encoding: 'utf8' }).trim());
|
|
98
|
-
const REL = '.agents/confirmations.jsonl';
|
|
99
|
-
const SHARD_DIR = SHARD_DIR_REL; // '.agents/confirmations.d'(读口径单源 ledger-loader)
|
|
100
|
-
const FILE = path.join(ROOT, REL);
|
|
101
|
-
const VALID_STAGES = new Set(['approved', 'done', 'fixed', 'closed', 'superseded', 'cancelled',
|
|
102
|
-
'revert-draft', 'revert-open']); // 回退注记行(check-loop :822 认可;fingerprint 恒 n/a)
|
|
103
|
-
// 历史基线(机制 2026-10-13 ledger-history-baseline,详见头注):kit 缺省空 = 全量扫描
|
|
104
|
-
const HISTORY_BASELINE = process.env.LEDGER_HISTORY_BASELINE || '';
|
|
105
|
-
|
|
106
|
-
const git = (args, opts = {}) => execFileSync('git', args, { cwd: ROOT, encoding: 'buffer', maxBuffer: 64 * 1024 * 1024, ...opts });
|
|
107
|
-
const gitText = (args) => execFileSync('git', args, { cwd: ROOT, encoding: 'utf8' });
|
|
108
|
-
const blobOf = (ref) => git(['show', ref]); // ref 必须为完整对象引用(<sha>:<path> / HEAD:<path> / :<path>)
|
|
109
|
-
// tryBlob:安全读 blob,失败返回 null 且**不向 stderr 外泄 git fatal 噪声**(删片场景读当前提交必失败,
|
|
110
|
-
// 那是预期路径不是错误——历史扫描的高频探针路径必须静默)。
|
|
111
|
-
const tryBlob = (ref) => {
|
|
112
|
-
const r = spawnSync('git', ['show', ref], { cwd: ROOT, encoding: 'buffer', maxBuffer: 64 * 1024 * 1024 });
|
|
113
|
-
return r.status === 0 ? r.stdout : null;
|
|
114
|
-
};
|
|
115
|
-
const linesOf = (buf) => buf.toString('utf8').split('\n').filter((l, i, a) => !(l === '' && i === a.length - 1) && l !== '');
|
|
116
|
-
const isShard = (rel) => rel.startsWith(`${SHARD_DIR}/`) && rel.endsWith('.jsonl');
|
|
117
|
-
|
|
118
|
-
// ④ 归档感知存在性(2026-10-13 archive-aware-doc):四目录原路径未命中再探 workflow/archive/*/——
|
|
119
|
-
// 归档是 sanctioned 的文档生命周期事件,行的审计价值(指向真实文档)不受移动影响;真消失(既不在
|
|
120
|
-
// 四目录也无归档批次)仍拦。
|
|
121
|
-
const docExists = (doc) => {
|
|
122
|
-
if (fs.existsSync(path.join(ROOT, doc))) return true;
|
|
123
|
-
const m = /^workflow\/(intents|specs|plans|incidents)\/([^/]+)\.md$/.exec(doc);
|
|
124
|
-
if (!m) return false;
|
|
125
|
-
try {
|
|
126
|
-
const arcRoot = path.join(ROOT, 'workflow', 'archive');
|
|
127
|
-
for (const batch of fs.readdirSync(arcRoot)) {
|
|
128
|
-
if (fs.existsSync(path.join(arcRoot, batch, m[1], `${m[2]}.md`))) return true;
|
|
129
|
-
}
|
|
130
|
-
} catch { /* archive 目录不存在 */ }
|
|
131
|
-
return false;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const problems = [];
|
|
135
|
-
const fail = (msg) => { console.error(msg); process.exit(1); };
|
|
136
|
-
|
|
137
|
-
// 终树主台账行集(CRLF 归一;补登追认的比对基准——与行级校验「终树」同语义)
|
|
138
|
-
// 补登追认按**语义身份**比对:{doc, stage, fingerprint} 三元组——补登合法形态是补偿行
|
|
139
|
-
// (原 ts 早于尾行时须记现时刻 + note,内容字段沿原行),逐字节比对会漏掉全部合法补偿。
|
|
140
|
-
const finalLedgerRows = () => {
|
|
141
|
-
try {
|
|
142
|
-
return fs.readFileSync(FILE, 'utf8').replace(/\r\n/g, '\n').split('\n')
|
|
143
|
-
.filter((l) => l.trim())
|
|
144
|
-
.map((l) => { try { return JSON.parse(l); } catch { return null; } });
|
|
145
|
-
} catch { return null; }
|
|
146
|
-
};
|
|
147
|
-
const restoredInFinal = (missingLines, finRows) => {
|
|
148
|
-
if (!finRows) return false;
|
|
149
|
-
return missingLines.every((l) => {
|
|
150
|
-
let e;
|
|
151
|
-
try { e = JSON.parse(l); } catch { return false; }
|
|
152
|
-
return finRows.some((r) => r && r.doc === e.doc && r.stage === e.stage && r.fingerprint === e.fingerprint);
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
// ---- 分片删除合法性:该分片全部非空行须存在于同一提交的主台账(compact-ledgers 归并凭据)----
|
|
157
|
-
// 返回 null = 合法归并(或缺行已终树补登追认);否则返回原因串。
|
|
158
|
-
// 读法要点(① 合并感知):分片在**该提交已被删除**,其内容从各父取并集——合并收口删片时分片可能
|
|
159
|
-
// 只在第二父(首父已归并删片),单读首父会误判「增删同提交」;主台账取该提交当时的版本
|
|
160
|
-
// (归并行把分片原样追加进主台账后同提交删片,故主台账须含全部行)。
|
|
161
|
-
const shardDeleteReason = (sha, rel) => {
|
|
162
|
-
const mainBuf = tryBlob(`${sha}:${REL}`);
|
|
163
|
-
if (mainBuf === null) return `该提交无主台账 ${REL}——无法认定归并`;
|
|
164
|
-
const shardLines = new Set();
|
|
165
|
-
let foundInParent = false;
|
|
166
|
-
for (const p of parentShas(sha)) {
|
|
167
|
-
const b = tryBlob(`${p}:${rel}`);
|
|
168
|
-
if (b === null) continue;
|
|
169
|
-
foundInParent = true;
|
|
170
|
-
for (const l of linesOf(b)) if (l.trim()) shardLines.add(l);
|
|
171
|
-
}
|
|
172
|
-
if (!foundInParent) return `父提交 ${sha.slice(0, 10)}^ 中无此分片(增删同提交?)——无法认定归并`;
|
|
173
|
-
const mainLines = new Set(linesOf(mainBuf).filter((l) => l.trim()));
|
|
174
|
-
const missing = [...shardLines].filter((l) => !mainLines.has(l));
|
|
175
|
-
if (missing.length) {
|
|
176
|
-
// ② 终树补登追认:缺行已按语义身份(③)回append进终树主台账 → 丢失已追认
|
|
177
|
-
if (restoredInFinal(missing, finalLedgerRows())) {
|
|
178
|
-
console.error(`[info] ${sha.slice(0, 10)}:${rel} 合并删片缺 ${missing.length} 行已在终树主台账补登(例:${missing[0].slice(0, 60)}…)——丢失追认,续扫`);
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
return `删除时分片有 ${missing.length} 行不在同提交主台账内(例:${missing[0].slice(0, 60)}…)——只有 compact-ledgers 归并后才允许删片`;
|
|
182
|
-
}
|
|
183
|
-
return null;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// ---- 历史前缀扫描(单台账路径;主台账与分片共用)----
|
|
187
|
-
// allowShardDelete:分片允许「已归并后删片(或缺行已终树补登)」这一种合法消失形态;主台账永不因归并被删。
|
|
188
|
-
// 返回该路径的提交史(空 = 从未入库:装户/新仓/尚在暂存区)——零史路径整体跳过,与原实现
|
|
189
|
-
// 「零提交历史即静默」的契约一致(行级校验也只覆盖有史的路径,否则新仓首版会被 doc 不存在误杀)。
|
|
190
|
-
function historyShas(rel) {
|
|
191
|
-
try {
|
|
192
|
-
// --full-history:不做历史简化——TREESAME 合并也入列,防「ours 合并丢一侧行」被简化隐藏(审计门立场)
|
|
193
|
-
return gitText(['log', '--full-history', '--format=%H', '--reverse', '--', rel]).split(/\s+/).filter(Boolean);
|
|
194
|
-
} catch {
|
|
195
|
-
return [];
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 基线后提交集(含基线可达性探测;无基线声明或基线不在本仓 → null = 基线不生效,全史扫描)
|
|
200
|
-
let _postBaseline;
|
|
201
|
-
const postBaselineSet = () => {
|
|
202
|
-
if (_postBaseline !== undefined) return _postBaseline;
|
|
203
|
-
if (!HISTORY_BASELINE) return (_postBaseline = null); // kit 缺省:无基线声明 → 全量扫描
|
|
204
|
-
try {
|
|
205
|
-
gitText(['rev-parse', '--verify', '--quiet', `${HISTORY_BASELINE}^{commit}`]);
|
|
206
|
-
_postBaseline = new Set(gitText(['rev-list', `${HISTORY_BASELINE}..HEAD`]).split(/\s+/).filter(Boolean));
|
|
207
|
-
} catch {
|
|
208
|
-
_postBaseline = null;
|
|
209
|
-
}
|
|
210
|
-
return _postBaseline;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// 多父提交的父列表(%P 全父)
|
|
214
|
-
const parentShas = (sha) => {
|
|
215
|
-
try {
|
|
216
|
-
return gitText(['log', '-1', '--format=%P', sha]).split(/\s+/).filter(Boolean);
|
|
217
|
-
} catch {
|
|
218
|
-
return [];
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
// 合并并集对账:cur 行集须恰为各父行集之并(无丢失、无凭空新增)。返回 null = 认可;否则返回原因。
|
|
223
|
-
// 父提交无此路径(单侧新增)跳过该父;行比对按整行字符串(与 linesOf/前缀判据同粒度)。
|
|
224
|
-
// 2026-10-16 自源仓回灌:签名自 sha 改收 parents 数组——--staged 合并态无提交 sha,由调用方传
|
|
225
|
-
// [HEAD, MERGE_HEAD…];历史全扫(传 parentShas(sha))与 --staged 共用本判据(不新开口子)。
|
|
226
|
-
const mergeUnionProblem = (parents, rel, curBuf) => {
|
|
227
|
-
const curLines = new Set(linesOf(curBuf));
|
|
228
|
-
const parentLines = new Set();
|
|
229
|
-
for (const p of parents) {
|
|
230
|
-
const b = tryBlob(`${p}:${rel}`);
|
|
231
|
-
if (b === null) continue;
|
|
232
|
-
for (const l of linesOf(b)) parentLines.add(l);
|
|
233
|
-
}
|
|
234
|
-
const lost = [...parentLines].filter((l) => !curLines.has(l));
|
|
235
|
-
if (lost.length) return `合并丢失 ${lost.length} 行(例:${lost[0].slice(0, 60)}…)——union 合并不得丢行`;
|
|
236
|
-
const made = [...curLines].filter((l) => !parentLines.has(l));
|
|
237
|
-
if (made.length) return `合并凭空多出 ${made.length} 行(例:${made[0].slice(0, 60)}…)——合并结果须为各父行集之并`;
|
|
238
|
-
return null;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
// 合并携带 manifest 的特许修剪对账(merge-prune-set):集合口径——每个 removes 哈希须恰命中
|
|
242
|
-
// 父母并集中一行;cur 行集须恰为「父母并集 − 被删行集」。支持「分支上修剪、合并时落地」的合法
|
|
243
|
-
// 形态(修剪凭据随合并入库);对父母并集对账(非第一父)堵住 p2 独有行借 p1 相对 manifest 无凭据
|
|
244
|
-
// 消失。返回 null = 认可;否则原因串。
|
|
245
|
-
const mergePruneProblem = (parents, rel, curBuf, manifest) => {
|
|
246
|
-
if (!manifest || !Array.isArray(manifest.removes) || !manifest.removes.length) return 'manifest 缺失或 removes 为空';
|
|
247
|
-
const union = new Set();
|
|
248
|
-
for (const p of parents) {
|
|
249
|
-
const b = tryBlob(`${p}:${rel}`);
|
|
250
|
-
if (b === null) continue;
|
|
251
|
-
for (const l of linesOf(b)) union.add(l);
|
|
252
|
-
}
|
|
253
|
-
const want = new Set(manifest.removes);
|
|
254
|
-
const removed = [...union].filter((l) => want.has(sha256line(l)));
|
|
255
|
-
if (removed.length !== manifest.removes.length) return `manifest 哈希在父母并集中命中 ${removed.length} 行 ≠ 声明 ${manifest.removes.length} 行`;
|
|
256
|
-
const removedSet = new Set(removed);
|
|
257
|
-
const expected = [...union].filter((l) => !removedSet.has(l));
|
|
258
|
-
const expectedSet = new Set(expected);
|
|
259
|
-
const curLines = new Set(linesOf(curBuf));
|
|
260
|
-
const extra = [...curLines].filter((l) => !expectedSet.has(l));
|
|
261
|
-
if (extra.length) return `合并多出对账外 ${extra.length} 行(例:${extra[0].slice(0, 60)}…)`;
|
|
262
|
-
const stillLost = expected.filter((l) => !curLines.has(l));
|
|
263
|
-
if (stillLost.length) return `合并仍丢失 manifest 外 ${stillLost.length} 行(例:${stillLost[0].slice(0, 60)}…)`;
|
|
264
|
-
const docs = new Set(manifest.docs || []);
|
|
265
|
-
if (docs.size) {
|
|
266
|
-
for (const l of removed) {
|
|
267
|
-
try {
|
|
268
|
-
const doc = JSON.parse(l).doc || '';
|
|
269
|
-
if (!docs.has(path.basename(doc).replace(/\.md$/, ''))) return `被删行 doc ${doc} 不在 manifest.docs 清单内`;
|
|
270
|
-
} catch { return '被删行非 JSON'; }
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return null;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
function scanHistory(rel, { allowShardDelete }) {
|
|
277
|
-
const allShas = historyShas(rel);
|
|
278
|
-
if (!allShas.length) return allShas;
|
|
279
|
-
let shas = allShas;
|
|
280
|
-
// 历史基线:只走基线后提交(详见头注)——DAG 感知比对下各提交自对己父,无需线性化起点
|
|
281
|
-
const post = postBaselineSet();
|
|
282
|
-
if (post) {
|
|
283
|
-
const kept = shas.filter((sha) => post.has(sha));
|
|
284
|
-
if (kept.length !== shas.length) {
|
|
285
|
-
console.error(`[info] ${rel}:${shas.length - kept.length} 个前基线提交按 HISTORY_BASELINE 声明豁免(owner 授权,见脚本头注)`);
|
|
286
|
-
}
|
|
287
|
-
shas = kept;
|
|
288
|
-
}
|
|
289
|
-
for (const sha of shas) {
|
|
290
|
-
let cur;
|
|
291
|
-
try { cur = blobOf(`${sha}:${rel}`); } catch {
|
|
292
|
-
// 删除提交不是静默边界(复核 P2 收口):主台账在 append-only 世界里永不应删除——任一历史提交删除
|
|
293
|
-
// 主台账即 hard fail(否则「删除→次提交重加」会把重加 blob 当新基线绕过前缀判据)。
|
|
294
|
-
if (!allowShardDelete) {
|
|
295
|
-
problems.push(`- [台账删除] ${sha.slice(0, 10)}:该提交删除了 ${rel}(append-only 世界禁删文件)`);
|
|
296
|
-
continue;
|
|
297
|
-
}
|
|
298
|
-
const reason = shardDeleteReason(sha, rel);
|
|
299
|
-
if (reason) {
|
|
300
|
-
problems.push(`- [分片删除丢行] ${sha.slice(0, 10)}:删除 ${rel} —— ${reason}`);
|
|
301
|
-
continue;
|
|
302
|
-
}
|
|
303
|
-
console.error(`[info] ${sha.slice(0, 10)}:${rel} 归并后删除(compact 归并形态——全部行已在同提交主台账对账,或缺行已终树补登追认)`);
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
// DAG 感知基准:本提交第一父的 blob(dag-aware-base)——线性化「前一承」在分支汇合处会拿
|
|
307
|
-
// 另一侧提交当基准产生伪前缀破坏;根提交(无父)视为新文件起步。
|
|
308
|
-
const parents = parentShas(sha);
|
|
309
|
-
const base = parents.length ? tryBlob(`${parents[0]}:${rel}`) : null;
|
|
310
|
-
if (base === null) continue; // 首现(父无此路径):无基线可比,行级校验兜底
|
|
311
|
-
if (parents.length >= 2) {
|
|
312
|
-
// 多父提交无条件走并集对账(前缀通过不得短路——ours-resolution 合并树与第一父逐字节同 blob,
|
|
313
|
-
// 嵌套判法对静默丢行全盲)
|
|
314
|
-
const unionFail = mergeUnionProblem(parentShas(sha), rel, cur);
|
|
315
|
-
if (!unionFail) {
|
|
316
|
-
console.error(`[info] ${sha.slice(0, 10)}:合并并集无丢失——union 合并语义认可,续扫`);
|
|
317
|
-
continue;
|
|
318
|
-
}
|
|
319
|
-
// union 不过 → manifest 集合对账(分支修剪合并落地;对父母并集对账,非第一父)
|
|
320
|
-
const setFail = mergePruneProblem(parents, rel, cur, loadManifestFromRef(`${sha}:${PRUNE_REL}`, ROOT));
|
|
321
|
-
if (!setFail) {
|
|
322
|
-
console.error(`[info] ${sha.slice(0, 10)}:合并携带特许修剪——父母并集集合对账通过`);
|
|
323
|
-
continue;
|
|
324
|
-
}
|
|
325
|
-
problems.push(`- [前缀破坏] ${sha.slice(0, 10)}(合并):${rel} 并集对账失败:${unionFail};修剪集合对账:${setFail}`);
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (!cur.subarray(0, base.length).equals(base)) {
|
|
329
|
-
// 前缀破坏 → 该提交树上携带 manifest 且逐行对账 = 特许修剪(loud 记录)
|
|
330
|
-
const m = matchPrune(base.toString('utf8'), cur.toString('utf8'), loadManifestFromRef(`${sha}:${PRUNE_REL}`, ROOT));
|
|
331
|
-
if (m && !m.err) {
|
|
332
|
-
console.error(`[info] ${sha.slice(0, 10)}:特许修剪 ${m.removed} 行(${m.docs.length} 家族)——manifest 对账通过,凭据 ${PRUNE_REL} 入库可对质`);
|
|
333
|
-
} else {
|
|
334
|
-
let off = 0;
|
|
335
|
-
while (off < Math.min(base.length, cur.length) && base[off] === cur[off]) off++;
|
|
336
|
-
const removed = base.length > cur.length;
|
|
337
|
-
problems.push(`- [前缀破坏] ${sha.slice(0, 10)}(父 ${parents[0].slice(0, 10)}):${rel} 历史内容被${removed ? `删减 ${base.length - cur.length}B` : `改写(首异偏移 ${off},旧 ${base.length}B → 新 ${cur.length}B)`}${m && m.err ? `;特许修剪对账失败:${m.err}` : ''}`);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
return allShas; // 交回该路径的全量提交史,供调用方判定「有史才进行级校验」
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// ---- 台账路径全集:主台账 + 历史上出现过的全部分片 ----
|
|
345
|
-
function ledgerPaths() {
|
|
346
|
-
const rels = [REL];
|
|
347
|
-
try {
|
|
348
|
-
const out = gitText(['log', '--name-only', '--pretty=format:', '--', SHARD_DIR]);
|
|
349
|
-
for (const line of out.split(/\r?\n/)) {
|
|
350
|
-
const p = line.trim();
|
|
351
|
-
if (p && isShard(p) && !rels.includes(p)) rels.push(p);
|
|
352
|
-
}
|
|
353
|
-
} catch { /* 非 git 或无历史:仅主台账 */ }
|
|
354
|
-
// 工作区里新出现(尚未入库)的分片也要进行 --staged 前缀判定
|
|
355
|
-
try {
|
|
356
|
-
const dir = path.join(ROOT, SHARD_DIR);
|
|
357
|
-
if (fs.existsSync(dir) && fs.statSync(dir).isDirectory()) {
|
|
358
|
-
for (const f of fs.readdirSync(dir)) {
|
|
359
|
-
const p = `${SHARD_DIR}/${f}`;
|
|
360
|
-
if (isShard(p) && !rels.includes(p)) rels.push(p);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
} catch { /* 忽略 */ }
|
|
364
|
-
return rels;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// ---- --staged:暂存台账面 ⊇ HEAD 前缀,或携带 manifest 的特许修剪;分片删除须已并入暂存主台账 ----
|
|
368
|
-
// 合并态口径(2026-10-16 自源仓 13f67ef7 回灌 staged-merge-union):MERGE_HEAD 在场时暂存内容是**多父
|
|
369
|
-
// 合并结果**,单看 HEAD 一父不够——合法合并形态下暂存 = 父母并集(− manifest removes),严格前缀等式
|
|
370
|
-
// 必然不等而误拦。此时在严格等格外**再试父母并集集合对账**——与历史全扫同一函数 mergeUnionProblem /
|
|
371
|
-
// mergePruneProblem、同一口径,不新开口子:并集须无丢失、无凭空行(既禁丢行也禁凭空行)。非合并态不启用。
|
|
372
|
-
const mergeParents = (() => {
|
|
373
|
-
const r = spawnSync('git', ['rev-parse', 'MERGE_HEAD'], { cwd: ROOT, encoding: 'utf8' }); // octopus 可多行
|
|
374
|
-
if (r.status !== 0) return null; // 非合并态;spawnSync 吞 stderr,不外泄 fatal 噪声
|
|
375
|
-
const shas = String(r.stdout || '').split(/\s+/).filter(Boolean);
|
|
376
|
-
if (!shas.length) return null;
|
|
377
|
-
const h = spawnSync('git', ['rev-parse', 'HEAD'], { cwd: ROOT, encoding: 'utf8' });
|
|
378
|
-
return [String(h.stdout || '').trim(), ...shas];
|
|
379
|
-
})();
|
|
380
|
-
if (staged) {
|
|
381
|
-
const stagedHit = gitText(['-c', 'core.quotepath=off', 'diff', '--cached', '--name-only']).split(/\r?\n/).filter(Boolean);
|
|
382
|
-
const touched = ledgerPaths().filter((rel) => stagedHit.includes(rel));
|
|
383
|
-
if (!touched.length) process.exit(0);
|
|
384
|
-
// 暂存主台账行集(分片删除的 compact 归并判据比对基准——与历史扫「同提交主台账」同语义,取暂存态)
|
|
385
|
-
let stagedMainLines = new Set();
|
|
386
|
-
try { stagedMainLines = new Set(linesOf(blobOf(`:${REL}`))); } catch { /* 暂存主台账缺失/未触 → 空集 */ }
|
|
387
|
-
for (const rel of touched) {
|
|
388
|
-
if (rel === REL) {
|
|
389
|
-
const headExists = (() => { try { gitText(['rev-parse', '--verify', '--quiet', `HEAD:${rel}`]); return true; } catch { return false; } })();
|
|
390
|
-
if (!headExists) continue; // 首次入库:无 HEAD 基线,历史全扫与终树行级校验覆盖
|
|
391
|
-
let head, cur;
|
|
392
|
-
try {
|
|
393
|
-
head = blobOf(`HEAD:${rel}`);
|
|
394
|
-
cur = blobOf(`:${rel}`); // 暂存区
|
|
395
|
-
} catch {
|
|
396
|
-
continue; // 对象读取异常(如极端并发)交由 CI 全扫兜底
|
|
397
|
-
}
|
|
398
|
-
if (!cur.subarray(0, head.length).equals(head)) {
|
|
399
|
-
// 前缀破坏 → 特许修剪对账(manifest 必须同在暂存集)
|
|
400
|
-
const m = matchPrune(head.toString('utf8'), cur.toString('utf8'), loadManifestFromRef(`:${PRUNE_REL}`, ROOT));
|
|
401
|
-
if (m && !m.err) {
|
|
402
|
-
console.log(`台账不变量(--staged)— ${rel} 特许修剪通过:移除 ${m.removed} 行(${m.docs.length} 家族)——凭据 ${PRUNE_REL} 随笔入库,被删行可在 git 历史对质`);
|
|
403
|
-
continue;
|
|
404
|
-
}
|
|
405
|
-
// 合并态(2026-10-16 回灌):严格前缀不适用 → 先纯并集对账,再落 manifest 修剪集合对账
|
|
406
|
-
// (与历史全扫的判定顺序一致)。非合并态两者皆拒。
|
|
407
|
-
const unionFail = mergeParents ? mergeUnionProblem(mergeParents, rel, cur) : '非合并态';
|
|
408
|
-
if (!unionFail) {
|
|
409
|
-
console.log(`台账不变量(--staged)— ${rel} 合并并集无丢失认可(${mergeParents.length} 父)——暂存行集恰为父母行集之并(无丢失、无凭空行),union 语义与历史全扫同口径`);
|
|
410
|
-
continue;
|
|
411
|
-
}
|
|
412
|
-
const setErr = mergeParents ? mergePruneProblem(mergeParents, rel, cur, loadManifestFromRef(`:${PRUNE_REL}`, ROOT)) : '非合并态';
|
|
413
|
-
if (!setErr) {
|
|
414
|
-
console.log(`台账不变量(--staged)— ${rel} 合并携带特许修剪通过:父母并集集合对账认可(${mergeParents.length} 父)——凭据 ${PRUNE_REL} 随笔入库,被删行可在 git 历史对质`);
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
let off = 0;
|
|
418
|
-
while (off < Math.min(head.length, cur.length) && head[off] === cur[off]) off++;
|
|
419
|
-
problems.push(`- [台账重写] ${rel} 暂存内容不是 HEAD 的前缀扩展(首异偏移 ${off},HEAD ${head.length}B → 暂存 ${cur.length}B)${m && m.err ? `;特许修剪对账失败:${m.err}` : ''}${mergeParents ? `;合并并集集合对账亦失败:${setErr}` : ''}${mergeParents ? `;合并纯并集对账失败:${unionFail}` : ''}`);
|
|
420
|
-
}
|
|
421
|
-
continue;
|
|
422
|
-
}
|
|
423
|
-
// 分片三态(2026-10-13 ledger-shard-default:分片为默认写入口径):纯追加验前缀 / 暂存删除验
|
|
424
|
-
// compact 归并(丢行 hard 拦)/ 新分片首入库无 HEAD 基线跳过(历史全扫续管)。
|
|
425
|
-
let sHead;
|
|
426
|
-
try { sHead = blobOf(`HEAD:${rel}`); } catch { continue; } // 新分片首入库
|
|
427
|
-
let sCur = null;
|
|
428
|
-
try { sCur = blobOf(`:${rel}`); } catch { sCur = null; }
|
|
429
|
-
if (sCur === null) {
|
|
430
|
-
// 暂存里分片被删 → compact 归并判据(行全并入暂存主台账才放行)
|
|
431
|
-
const shardLines = linesOf(sHead);
|
|
432
|
-
const missing = shardLines.filter((l) => !stagedMainLines.has(l));
|
|
433
|
-
if (missing.length === 0) {
|
|
434
|
-
console.log(`台账不变量(--staged)— 分片 ${rel} 删除:${shardLines.length} 行已全部并入暂存主台账(compact 归并形态,放行)`);
|
|
435
|
-
} else {
|
|
436
|
-
problems.push(`- [分片删除丢行] ${rel} 被删除,但其中 ${missing.length} 行未出现在暂存主台账(compact 归并须先并入再删)`);
|
|
437
|
-
}
|
|
438
|
-
continue;
|
|
439
|
-
}
|
|
440
|
-
if (!sCur.subarray(0, sHead.length).equals(sHead)) {
|
|
441
|
-
let off = 0;
|
|
442
|
-
while (off < Math.min(sHead.length, sCur.length) && sHead[off] === sCur[off]) off++;
|
|
443
|
-
problems.push(`- [分片重写] ${rel} 暂存内容不是 HEAD 的前缀扩展(首异偏移 ${off},HEAD ${sHead.length}B → 暂存 ${sCur.length}B)——分片同受 append-only 前缀不变量约束`);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
if (problems.length) {
|
|
447
|
-
console.error('台账不可变(--staged)— BLOCK:\n' + problems.join('\n'));
|
|
448
|
-
console.error(` 修法:台账历史行禁删改——误写走追加补偿行(node .agents/scripts/confirm-doc.mjs ...);确需撤销历史提交请 git revert 后重新追加。\n 所有者明令删除某批文档须同笔暂存 ${PRUNE_REL}(逐行 sha256 + 授权 + 理由),门禁逐行对账后才放行。`);
|
|
449
|
-
if (problems.some((p) => p.startsWith('- [分片重写] '))) {
|
|
450
|
-
console.error(' 分片重写另因:分片按 doc 命名、单端追加;跨端并发确认同一 doc 须有 merge=jsonl-union 驱动(git config merge.jsonl-union.driver "node .agents/scripts/git-merge-jsonl.mjs %O %A %B" + .gitattributes 标 merge=jsonl-union)——驱动生效则合并自动取并集、不破坏前缀');
|
|
451
|
-
}
|
|
452
|
-
process.exit(1);
|
|
453
|
-
}
|
|
454
|
-
process.exit(0);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// ---- 历史全扫(缺省)----
|
|
458
|
-
// 有提交史的路径才进历史扫描**与终树行级校验**——零史路径(装户/新仓/尚在暂存区)整体跳过,
|
|
459
|
-
// 与原实现「零提交历史即静默」的契约一致(否则新仓首版会被 doc 不存在误杀)。
|
|
460
|
-
const withHistory = new Set();
|
|
461
|
-
for (const rel of ledgerPaths()) {
|
|
462
|
-
const shas = scanHistory(rel, { allowShardDelete: isShard(rel) });
|
|
463
|
-
if (shas && shas.length) withHistory.add(rel);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// ---- 行级校验(终树:主台账 + 各现存分片;仅覆盖有提交史的路径)----
|
|
467
|
-
// 取数走 ledger-loader 带来源视图(主台账在前、分片按文件名序在后)——既有
|
|
468
|
-
// .agents/ledger-line-exempt.json 的行号(校验序号即非空行序)不因引入分片而漂移;
|
|
469
|
-
// 报文带来源标签(坏行点名所在台账文件)。JSON 坏行以 null 占位计号并显式报「非 JSON 对象行」。
|
|
470
|
-
const entries = readLedgerEntries(ROOT).filter((en) => withHistory.has(en.rel));
|
|
471
|
-
const EXEMPT_P = path.join(ROOT, '.agents', 'ledger-line-exempt.json');
|
|
472
|
-
const exemptLines = new Set();
|
|
473
|
-
try {
|
|
474
|
-
if (fs.existsSync(EXEMPT_P)) {
|
|
475
|
-
for (const e of JSON.parse(fs.readFileSync(EXEMPT_P, 'utf8'))) {
|
|
476
|
-
if (e && Number.isInteger(e.line)) exemptLines.add(e.line);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
} catch { /* 豁免表损坏 → 视同无豁免(fail-closed 于校验面) */ }
|
|
480
|
-
let exemptCount = 0;
|
|
481
|
-
// ① ts 单调口径(2026-10-12 ledger-doc-chain 配套修正):**按 doc 分组内单调**,跨 doc 物理序乱序
|
|
482
|
-
// 不判、只计数出账。为什么与实战源实现的「单文件内非降序」不同:并集合并与分片归都会把「别的 doc
|
|
483
|
-
// 的新行」追加到本文件尾部,而那些行的 ts 可能早于本文件末行的 ts → 全表判据必然因正常协作报红,
|
|
484
|
-
// 逼出 --no-verify;kit 装户存量台账仍是主台账单文件多 doc 形态,per-doc 才是可满足的判据。
|
|
485
|
-
// 仍保留的强判据:**同一 doc 内的 ts 倒挂照报**;跨 doc 的插行/改行由检查 15 doc-chain 哈希链兜。
|
|
486
|
-
const prevTsByDoc = new Map();
|
|
487
|
-
let crossDocOutOfOrder = 0;
|
|
488
|
-
let prevTsAny = '';
|
|
489
|
-
entries.forEach((en, idx) => {
|
|
490
|
-
const at = `${en.rel === REL ? '主台账' : en.rel} 第 ${idx + 1} 行`;
|
|
491
|
-
const e = en.row;
|
|
492
|
-
if (exemptLines.has(idx + 1)) { exemptCount++; return; } // 事故行豁免(登记文件入库可对质)
|
|
493
|
-
if (!e || typeof e !== 'object') { problems.push(`- [行级] ${at}:非 JSON 对象行`); return; }
|
|
494
|
-
if (typeof e.ts !== 'string' || Number.isNaN(Date.parse(e.ts))) problems.push(`- [行级] ${at}:ts 非 ISO 字符串`);
|
|
495
|
-
else {
|
|
496
|
-
const docKey = typeof e.doc === 'string' ? e.doc : '(doc 缺失)';
|
|
497
|
-
const prevSameDoc = prevTsByDoc.get(docKey);
|
|
498
|
-
if (prevSameDoc && e.ts < prevSameDoc) {
|
|
499
|
-
problems.push(`- [行级] ${at}:ts ${e.ts} 早于同 doc 前行 ${prevSameDoc}(${docKey} 追加时序倒挂)`);
|
|
500
|
-
}
|
|
501
|
-
prevTsByDoc.set(docKey, e.ts);
|
|
502
|
-
if (prevTsAny && e.ts < prevTsAny) crossDocOutOfOrder++;
|
|
503
|
-
prevTsAny = e.ts;
|
|
504
|
-
}
|
|
505
|
-
const isRevertNote = typeof e.stage === 'string' && e.stage.startsWith('revert-');
|
|
506
|
-
if (isRevertNote) {
|
|
507
|
-
if (e.fingerprint !== 'n/a') problems.push(`- [行级] ${at}:回退注记行 fingerprint 恒为「n/a」`);
|
|
508
|
-
} else if (typeof e.fingerprint !== 'string' || !/^[0-9a-f]{64}$/.test(e.fingerprint)) {
|
|
509
|
-
problems.push(`- [行级] ${at}:fingerprint 非 64 位 hex`);
|
|
510
|
-
}
|
|
511
|
-
if (e.source === 'chat-delegated' && !(typeof e.quote === 'string' && e.quote.trim())) problems.push(`- [行级] ${at}:chat-delegated 行缺非空 quote(原话对质面)`);
|
|
512
|
-
if (typeof e.doc !== 'string' || !/^workflow\/(intents|specs|plans|incidents)\/[^/]+\.md$/.test(e.doc)) {
|
|
513
|
-
problems.push(`- [行级] ${at}:doc 路径不在 workflow 四目录协议内`);
|
|
514
|
-
} else if (!docExists(e.doc)) {
|
|
515
|
-
problems.push(`- [行级] ${at}:doc ${e.doc} 在当前树不存在(四目录与归档批次均未命中)`);
|
|
516
|
-
}
|
|
517
|
-
if (!VALID_STAGES.has(e.stage)) problems.push(`- [行级] ${at}:stage「${e.stage || '缺失'}」不在合法跳转终态集`);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
if (exemptCount) console.log(`ℹ️ 台账豁免行 ${exemptCount} 条(定性见 .agents/ledger-line-exempt.json)`);
|
|
521
|
-
if (crossDocOutOfOrder) {
|
|
522
|
-
console.log(`ℹ️ 台账跨 doc 物理序 ts 乱序 ${crossDocOutOfOrder} 处(并集合并 / 分片归并的正常形态——不阻断;同 doc 内时序倒挂仍 hard 拦,插行/改行由检查 15 哈希链兜)`);
|
|
523
|
-
}
|
|
524
|
-
if (problems.length) {
|
|
525
|
-
fail(`台账不可变(历史全扫)— HARD-BLOCK:\n\n${problems.join('\n')}\n\n 修法:台账历史行禁删改(append-only 前缀不变量)——误写只能追加补偿行;确需撤销历史提交请 git revert 后重新追加。篡改属审计事件,保留现场联系仓库所有者。`);
|
|
526
|
-
}
|
|
527
|
-
process.exit(0);
|