agentic-flow-kit 1.8.7 → 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 -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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// check-loop-sections/s29-regr-enforcer.mjs — 29. 回归清单执法者配对 [hard-block](2026-11-11;锚 regrEnforcerSince)
|
|
2
|
+
// 背景(2026-11-10 审计 P1):回归清单「执法者」列 168 条空置长期无告警——规则已写但没有任何东西执法 =
|
|
3
|
+
// 重犯信号(清单规则 7 的人工纪律没有机器面)。2026-11-11 owner 拍板决策二:机器执法补位(当日已人工
|
|
4
|
+
// 清零 + 170 条显式 [prompt-only] 挂债 papercuts;本段让锚后新增行从此有门)。
|
|
5
|
+
// 判据:主台账「## 防复发验证」节 + 全部分片 workflow/regression-checklist.d/<YYYY-MM>.md 的数据行
|
|
6
|
+
// (双 | 包边、非表头非分隔行;首列剥反引号后以 \d{4}- 开头——主台账 2026-11-10 两行系反引号
|
|
7
|
+
// incident-slug 形态,同认)。行日期 = 首列前 10 字符;< regrEnforcerSince → 跳过(存量不追溯,
|
|
8
|
+
// 同 convergenceSince 惯例)。锚后行:第 4 列(执法者)非空且非 —/- → 通过;为空或行被切成非 4 列
|
|
9
|
+
// → HARD-BLOCK(填真执法资产:测试类/脚本/门禁 §N/regression-smoke/verify-ui 证据路径,或显式
|
|
10
|
+
// [prompt-only] 并登记 papercuts 挂债)。表头行/分隔行/非数据行跳过;主台账无该节不报错。
|
|
11
|
+
// 分工:check-regression-consistency.mjs 查清单引用的资产存在性(关单时触发);本段查执法者配对
|
|
12
|
+
// (每次 check-loop 扫描触发)——两门互补,互不替代。
|
|
13
|
+
import {
|
|
14
|
+
fs, os, path, spawnSync, createHash, createRequire, fileURLToPath,
|
|
15
|
+
loadEnums, auditEnabled, loadKitPolicy, hasFreshVerifyLine, laneOfDoc, MARK_RE,
|
|
16
|
+
SCRIPT_DIR, GIT, REV_ARG, REV, ROOT, MAIN_ROOT, ENUMS, inSet, stOkDoc,
|
|
17
|
+
spawnGit, gitOut, linesOf, fmGet, WF, DOC_DIRS, blockers, warnings, kitPolicy, isTracked, docFiles,
|
|
18
|
+
addedDateOf, warnEvidenceExempt, VERIFY_GREEN_RE, verifyEvidenceTruth,
|
|
19
|
+
versionGreater, fmStatus, bindingSha256, readdirOrNull, isDirectoryOrNull,
|
|
20
|
+
} from '../check-loop-kit.mjs';
|
|
21
|
+
|
|
22
|
+
export function run() {
|
|
23
|
+
// --- 29. 回归清单执法者配对 [hard-block](2026-11-11;锚 regrEnforcerSince)---
|
|
24
|
+
{
|
|
25
|
+
const anchor = kitPolicy.regrEnforcerSince;
|
|
26
|
+
if (anchor) {
|
|
27
|
+
// 行切分沿用 s23 / agg-delegations splitTables 口径:双 | 包边、slice(1,-1)、逐格 trim
|
|
28
|
+
const cellsOf = (l) => l.split('|').slice(1, -1).map((c) => c.trim());
|
|
29
|
+
const isSep = (l) => /^\s*\|[\s:|-]+\|\s*$/.test(l);
|
|
30
|
+
// 数据行 = 双 | 包边表行、非分隔行、首列(剥反引号)以 \d{4}- 开头;日期 = 首列前 10 字符
|
|
31
|
+
const isDataRow = (l) => {
|
|
32
|
+
if (!/^\s*\|.*\|\s*$/.test(l) || isSep(l)) return false;
|
|
33
|
+
const first = (cellsOf(l)[0] || '').replace(/^`+|`+$/g, '').trim();
|
|
34
|
+
return /^\d{4}-/.test(first);
|
|
35
|
+
};
|
|
36
|
+
const dateOf = (cells) => (cells[0] || '').replace(/^`+|`+$/g, '').trim().slice(0, 10);
|
|
37
|
+
// 扫描面:主台账「防复发验证」节(## 级开节,### 子节不停)+ 全部分片整文件
|
|
38
|
+
const targets = [];
|
|
39
|
+
const secLines = [];
|
|
40
|
+
let inSec = false;
|
|
41
|
+
for (const l of linesOf(path.join(ROOT, WF, 'regression-checklist.md')) || []) {
|
|
42
|
+
if (/^##\s+.*防复发验证/.test(l)) { inSec = true; continue; }
|
|
43
|
+
if (inSec && /^##\s+/.test(l)) { inSec = false; continue; }
|
|
44
|
+
if (inSec) secLines.push(l);
|
|
45
|
+
}
|
|
46
|
+
targets.push({ base: 'regression-checklist.md', lines: secLines });
|
|
47
|
+
const shardDir = path.join(ROOT, WF, 'regression-checklist.d');
|
|
48
|
+
for (const f of (readdirOrNull(shardDir) || []).filter((n) => n.endsWith('.md')).sort()) {
|
|
49
|
+
targets.push({ base: f, lines: linesOf(path.join(shardDir, f)) || [] });
|
|
50
|
+
}
|
|
51
|
+
for (const t of targets) {
|
|
52
|
+
const missed = [];
|
|
53
|
+
for (const l of t.lines) {
|
|
54
|
+
if (!isDataRow(l)) continue; // 表头行/分隔行/非数据行跳过
|
|
55
|
+
const cells = cellsOf(l);
|
|
56
|
+
const d = dateOf(cells);
|
|
57
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(d) || d < anchor) continue; // 不可判定或锚前存量不追溯
|
|
58
|
+
const enforcer = cells.length === 4 ? cells[3] : '';
|
|
59
|
+
if (enforcer && enforcer !== '—' && enforcer !== '-') continue; // [prompt-only] 合法显式声明
|
|
60
|
+
const topic = (cells[1] || cells[0] || l).replace(/\s+/g, ' ').trim().slice(0, 40);
|
|
61
|
+
missed.push(`${d}「${topic}」${cells.length === 4 ? '执法者列为空' : `行被切成 ${cells.length} 列(表头口径 4 列)`}`);
|
|
62
|
+
}
|
|
63
|
+
if (missed.length) {
|
|
64
|
+
blockers.push(`- [回归执法者缺失] ${t.base} ${missed.length} 行执法者未配对(${missed.join('; ')})——回归清单锚(${anchor})后行须指认「复发时谁会红」:填真执法资产(测试类 / 脚本 / 门禁 §N / regression-smoke / verify-ui 证据路径)或显式 \`[prompt-only]\` 并登记 papercuts 挂债(检查 29;锚前存量不追溯)`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// 用法:node .agents/scripts/check-loop.mjs [--rev <sha>] [--all | --hygiene]
|
|
2
|
+
// 默认(现状,2026-11-11 起):只跑 hard 6 段 = §1 §3x §8 §15 §23 §29(全部有阻断力);
|
|
3
|
+
// §14 §17 §25 等历史段已退役或下沉(编号留疤不重排),演化史见下方日期注记。
|
|
4
|
+
// 2026-10-21 门禁极小化第 1 批:§17 退役删除;§1 配对/L3 三件、§3 配对/回路、§14 留痕降 WARN——
|
|
5
|
+
// 段仍在 hard 车道默认跑,但只报告不阻断(红线判低/L3 状态例外,保 hard 阻断);hard 阻断面 =
|
|
6
|
+
// 红线判低(§1) + L3 状态(§1) + 回归证据(§3x) + 验收勾验(§8) + 确认指纹(§15) + 收敛对账(§23)。
|
|
7
|
+
// 2026-10-22 门禁收敛批 1:§3 三件套、§14 留痕、§25 路由预判三段由 hard 车道下沉 hygiene——
|
|
8
|
+
// 实测三段 blockers.push 均为 0(427 次 hard 运行产出 419 次 WARN、0 次阻断),占着默认关单/
|
|
9
|
+
// pre-push 车道却从不拦任何东西;承载力已前移到动作时刻(§3 → closeout skill §0 第 2 项;
|
|
10
|
+
// §14 → confirm-doc/stage-gates 落态前置门),下沉不丢校验,只改何时跑。
|
|
11
|
+
// hard 车道现存 5 段 = §1 §3x §8 §15 §23(全部有阻断力)。
|
|
12
|
+
// 2026-10-22 门禁收敛批 4:§20 已退役(挂载条件为包源环境,本仓恒不触发)。编号留疤不重排。
|
|
13
|
+
// 2026-10-28 引擎测试面退役:§28 脚本覆盖对账随 `.agents/**/*.test.mjs` 与 run-tests 一并删除
|
|
14
|
+
// (owner 决策:不再跑引擎面全量测试)。编号留疤不重排。
|
|
15
|
+
// 2026-10-28 引擎减重第一刀:hygiene 16 段(§2 §3 §4 §5 §9 §10 §14 §16 §18 §19 §21 §22 §24 §25
|
|
16
|
+
// §26 §27)全部退役——实测一周 845 次运行 8028 条 WARN、0 条阻断;段体删除,编号留疤。
|
|
17
|
+
// --hygiene / --all 从此等价,均只跑 hard 5 段。
|
|
18
|
+
// 2026-10-22 门禁收敛批 3:judgment-ledger 规则名归一(剥 WARN/NOTE 严重度前缀)——同一逻辑规则
|
|
19
|
+
// 因前缀写法不同被拆成两条 rule,污染 per-rule 计数与「连续 6 月 = 0」退役候选判据(实证 s27 的
|
|
20
|
+
// 「NOTE 回归清单临时脚本缺失」以带前缀的全名落账 114 次,与无前缀写法分裂)。
|
|
21
|
+
// 2026-10-22 门禁收敛批 2「信噪比」:advisory 告警(WARN/NOTE)按标签折叠输出(同类多行折为
|
|
22
|
+
// 「×N 条同类」单行,明细落 tmp/check-loop-warn.log)——**BLOCK 一律不折**;无标签条目逐条输出。
|
|
23
|
+
// 折叠只改呈现不改判据;实现见 warn-format.mjs(原锁折叠规则的 warn-format.test.mjs 已随引擎测试面退役 2026-10-28)。
|
|
24
|
+
// 2026-11-08 引擎减重档 2-G:三类高频纯 WARN(状态未确认 / L3 确认缺失 / 复核上下文缺失,近 30 天
|
|
25
|
+
// 台账 4185 条、纯检出不阻断)输出层默认静默——stderr 只留一行合计示意有量,judgments 落账与
|
|
26
|
+
// 折叠明细(tmp/check-loop-warn.log)完整保留;CHECK_LOOP_VERBOSE=1 恢复逐条(与折叠开关同门)。
|
|
27
|
+
// 2026-11-08 引擎减重档 3-U1:§23 登记式跳过退役(PREPUSH_SKIP_CONVERGENCE,2026-11-04 建,
|
|
28
|
+
// 仅首日一用、近 30 天零触发)——§23 恒跑;跨机证据不对称红改走人工立项处置。
|
|
29
|
+
// 2026-11-11 owner 拍板决策二:新增 §29 回归清单执法者配对(2026-11-10 审计 P1「168 条空执法者
|
|
30
|
+
// 长期无告警」的机器补位;锚 regrEnforcerSince=2026-11-12,锚前存量不追溯)。hard 阻断面新增
|
|
31
|
+
// 执法者配对(§29);2026-10-22 gate-health「新增 hard 段须先退役一个」本次由 owner 显式拍板扩界(未退役段)。
|
|
32
|
+
// 现状(2026-10-28):5 段全部 hard(§1 §3x §8 §15 §23);2026-11-11 owner 拍板决策二新增 §29
|
|
33
|
+
// 回归清单执法者配对(审计 P1 168 条空执法者补位,扩界理由见 rule-budgets 同日注)→ 6 段全部 hard
|
|
34
|
+
// (§1 §3x §8 §15 §23 §29)。
|
|
35
|
+
// 段数棘轮见 .agents/config/rule-budgets.txt(check-loop-sections 计数上限 6,退役一段同降一)。
|
|
36
|
+
// --hygiene / --all 等价(hygiene 段已全部退役,见上)。
|
|
37
|
+
// 扫描面(2026-10-28 减重第二刀):s01/s15 默认只扫本轮 diff 触及的 workflow 文档(3s 级);
|
|
38
|
+
// CHECK_LOOP_FULL=1 全量(CI 兜底,见 azure-pipelines.yml)——本地只拦「本轮引入」。
|
|
39
|
+
import * as kit from './check-loop-kit.mjs';
|
|
40
|
+
import { formatWarnings, writeWarnLog, WARN_LOG_REL } from './warn-format.mjs';
|
|
41
|
+
import { recordRun } from './judgment-ledger.mjs';
|
|
42
|
+
|
|
43
|
+
// 基础设施解构铺平(4a):段体自单文件时代逐字保留,名字由本解构供给——零漂移迁移
|
|
44
|
+
const {
|
|
45
|
+
fs, os, path, spawnSync, createHash, createRequire, fileURLToPath,
|
|
46
|
+
loadEnums, auditEnabled, loadKitPolicy, hasFreshVerifyLine, laneOfDoc, MARK_RE,
|
|
47
|
+
SCRIPT_DIR, GIT, REV_ARG, REV, ROOT, ENUMS, inSet, stOkDoc,
|
|
48
|
+
spawnGit, gitOut, linesOf, fmGet, WF, DOC_DIRS, blockers, warnings, kitPolicy, isTracked, docFiles,
|
|
49
|
+
addedDateOf, warnEvidenceExempt, VERIFY_GREEN_RE, verifyEvidenceTruth,
|
|
50
|
+
versionGreater, fmStatus, bindingSha256, readdirOrNull, isDirectoryOrNull,
|
|
51
|
+
} = kit;
|
|
52
|
+
|
|
53
|
+
import { run as s01_pairing } from './check-loop-sections/s01-pairing.mjs';
|
|
54
|
+
import { run as s03x_regr_evidence } from './check-loop-sections/s03x-regr-evidence.mjs';
|
|
55
|
+
import { run as s08_acceptance } from './check-loop-sections/s08-acceptance.mjs';
|
|
56
|
+
import { run as s15_fingerprint } from './check-loop-sections/s15-fingerprint.mjs';
|
|
57
|
+
import { run as s23_convergence_audit } from './check-loop-sections/s23-convergence-audit.mjs';
|
|
58
|
+
import { run as s29_regr_enforcer } from './check-loop-sections/s29-regr-enforcer.mjs';
|
|
59
|
+
// §2 §3 §4 §5 §9 §10 §14 §16 §18 §19 §21 §22 §24 §25 §26 §27 已退役(2026-10-28 引擎减重第一刀:
|
|
60
|
+
// 全部 hygiene 段为纯 WARN、零阻断;段体删除,编号留疤不重排)。
|
|
61
|
+
|
|
62
|
+
// 顺序 = 原单文件段序。仅 hard 车道(6 段,全部有阻断力);hygiene 段已于 2026-10-28 全部退役。
|
|
63
|
+
// 编号是承重引用(2026-10-11 D3 定案):§N 被 policy 锚名(check14Since)、机制台账「门禁位置」列、
|
|
64
|
+
// wiki 车道表、judgments rule 串跨文件引用——§7 空缺与 §3x 插号为历史疤,永不重编号(重编号=打断引用图)。
|
|
65
|
+
const SECTIONS = [
|
|
66
|
+
{ lane: 'hard', run: s01_pairing },
|
|
67
|
+
{ lane: 'hard', run: s03x_regr_evidence },
|
|
68
|
+
{ lane: 'hard', run: s08_acceptance },
|
|
69
|
+
{ lane: 'hard', run: s15_fingerprint },
|
|
70
|
+
{ lane: 'hard', run: s23_convergence_audit },
|
|
71
|
+
{ lane: 'hard', run: s29_regr_enforcer },
|
|
72
|
+
];
|
|
73
|
+
// hygiene 车道已全部退役(2026-10-28 引擎减重第一刀):--hygiene 与 --all 等价,均只跑 hard 6 段。
|
|
74
|
+
if (kit.LOOP_MODE === 'hygiene') {
|
|
75
|
+
console.error('check-loop: hygiene 段已全部退役(2026-10-28)——本次只跑 hard 6 段');
|
|
76
|
+
}
|
|
77
|
+
// §23 收敛对账登记式跳过已退役(2026-11-08 减重档 3-U1,头注有记)——§23 恒跑,无环境变量开关。
|
|
78
|
+
for (const section of SECTIONS) {
|
|
79
|
+
section.run();
|
|
80
|
+
}
|
|
81
|
+
// --- 判定流水落账(judgment-ledger,灰度消费端数据底座)---
|
|
82
|
+
// 每次真实运行追加一行 per-rule 判定计数到 .agents/judgments.jsonl(本地 gitignore;fixture 经
|
|
83
|
+
// CHECK_LOOP_ROOT 守卫自动跳过)——mechanism-registry 月度对账与 advisory→hard 升格判定的数据源
|
|
84
|
+
// 由「人工 grep 输出」升级为 agg-judgments.mjs 查账。fail-open:落账失败不改变门禁裁决与输出契约。
|
|
85
|
+
recordRun({ root: ROOT, mode: kit.LOOP_MODE, blockers, warnings });
|
|
86
|
+
// --- 输出(banner 沿 sh 版格式 = 稳定输出契约:banner 后空行、条目 '- ' 前缀;文件名自称用 check-loop.mjs)---
|
|
87
|
+
// 告警聚合(2026-10-22 门禁收敛批 2「信噪比」):**折 advisory(WARN / NOTE),一律不折 BLOCK**。
|
|
88
|
+
// 动机(实测):一次 --all 跑出 17 条 WARN + 19 条 NOTE,其中同类多行 + 多行告警把 actionable 项淹掉——
|
|
89
|
+
// 告警不精确比告警多更伤,输出一旦不可读,门禁即退化形式。折叠后逐条明细仍完整落
|
|
90
|
+
// tmp/check-loop-warn.log(供排障与事后对质),不丢信息、不降判据。
|
|
91
|
+
// 开关口径:只在「真引擎自跑」时折叠——判据取 ROOT 下是否有脚本本体(.agents/scripts/check-loop.mjs),
|
|
92
|
+
// 夹具/临时仓从不落引擎副本(场景 91 用真 git 仓但无脚本本体),断言面因此零变化;
|
|
93
|
+
// CHECK_LOOP_VERBOSE=1 强制逐条(排障用)。worktree 检出同样带脚本,正常折叠。
|
|
94
|
+
// 实现落位:.agents/scripts/warn-format.mjs——本文件无 isMain 守卫(被 import 即全量执行并 exit),
|
|
95
|
+
// 聚合逻辑不可在此直接单测;抽成无副作用模块 warn-format.mjs(原锁折叠规则的 warn-format.test.mjs 已随引擎测试面退役 2026-10-28)。
|
|
96
|
+
const WARN_LOG = path.join(ROOT, 'tmp', 'check-loop-warn.log');
|
|
97
|
+
const selfRun = fs.existsSync(path.join(ROOT, '.agents', 'scripts', 'check-loop.mjs'));
|
|
98
|
+
const compactOn = selfRun && process.env.CHECK_LOOP_VERBOSE !== '1';
|
|
99
|
+
// 三类高频纯 WARN 默认静默(2026-11-08 档 2-G,与头注同源):仅折叠门(compactOn)开启时静默——
|
|
100
|
+
// 夹具/VERBOSE=1 口径逐条输出不变。只滤 stderr 呈现:judgments 落账(recordRun 用全量 warnings)
|
|
101
|
+
// 与明细日志(writeWarnLog 写全量清单)不受影响,非这三类标签的 WARN 行为不变。
|
|
102
|
+
const QUIET_WARN_TAGS = ['WARN 状态未确认', 'WARN L3 确认缺失', 'WARN 复核上下文缺失'];
|
|
103
|
+
const isQuietWarn = (line) => QUIET_WARN_TAGS.some((t) => line.startsWith(`- [${t}]`));
|
|
104
|
+
const renderWarnings = (list) => {
|
|
105
|
+
if (!compactOn) return formatWarnings(list, { enabled: false });
|
|
106
|
+
writeWarnLog(list, WARN_LOG); // 完整明细照旧落盘(含静默三类)——静默只作用于 stderr
|
|
107
|
+
const quiet = list.filter(isQuietWarn);
|
|
108
|
+
const rest = list.filter((line) => !isQuietWarn(line));
|
|
109
|
+
const out = [];
|
|
110
|
+
if (rest.length) out.push(formatWarnings(rest, { enabled: true, logNote: WARN_LOG_REL }));
|
|
111
|
+
if (quiet.length) out.push(`- ${quiet.length} 条高频 WARN 已静默(状态未确认/L3 确认缺失/复核上下文缺失;明细 CHECK_LOOP_VERBOSE=1)`);
|
|
112
|
+
return out.join('\n');
|
|
113
|
+
};
|
|
114
|
+
if (blockers.length) {
|
|
115
|
+
process.stderr.write(`闭环骨架断档(check-loop.mjs)— HARD-BLOCK:\n\n${blockers.join('\n')}\n\n`);
|
|
116
|
+
if (warnings.length) process.stderr.write(`WARN(advisory,不阻断):\n\n${renderWarnings(warnings)}\n`);
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
if (warnings.length) {
|
|
120
|
+
process.stderr.write(`check-loop.mjs WARN(advisory,不阻断):\n\n${renderWarnings(warnings)}\n`);
|
|
121
|
+
}
|
|
122
|
+
// C1(2026-10-28):FULL 手动审计末尾跑合并语义对拍探针——P0-A 修复(first-parent diff)被退化回
|
|
123
|
+
// git show 时立红。仅本地 FULL(无 --rev/worktree、无夹具根)自动跑;探针可独立手动直跑。
|
|
124
|
+
if (kit.FULL_SCAN && !kit.REV && !process.env.CHECK_LOOP_ROOT) {
|
|
125
|
+
const probe = kit.spawnSync(process.execPath, [path.join('.agents', 'scripts', 'check-loop-rev-semantics.mjs')], { stdio: 'inherit' });
|
|
126
|
+
if (probe.status !== 0) {
|
|
127
|
+
process.stderr.write('闭环骨架断档(check-loop.mjs)— 合并语义对拍探针未过(check-loop-rev-semantics.mjs)——REV 面实现疑似退化。HARD-BLOCK\n');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
process.exit(0);
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// check-regression-consistency — 回归清单 + verify-ui 特性地图的引用存在性检查(2026-10-17 关单活文档门,A1;
|
|
3
|
+
// 2026-10-22 扩特性地图漂移:features/*.md 引用的路由/组件/文档/脚本必须还在,符号只做 advisory)
|
|
4
|
+
// 动机:独立复核反复抓到「回归清单/wiki 残留旧口径」这类活文档债(规格内断言失效、被删测试仍被
|
|
5
|
+
// 引用),却只在复核阶段可见。把「清单引用的资产还在吗」前移到关单 + 提交双闸,让残留当场被拦。
|
|
6
|
+
// 口径(弱档 / 存在性,不猜语义):清单条目是自由文本,无法机器对账语义,故只校验「引用指向的
|
|
7
|
+
// 资产在仓库里仍存在、未改名/删除」。能抓「删了带外列但清单还说有」「测试类改名后清单未跟」;
|
|
8
|
+
// 抓不到「值口径变了但符号还在」——那是强档语义对账,自由文本无结构化契约,显式不做。
|
|
9
|
+
// 特性地图(verify-ui features/):地图是验证的源,不是验证的果——路由/组件/文档/脚本引用悬空
|
|
10
|
+
// 即漂移;「驱动步骤还能不能走通」仍需实测,机器不假装能证明行为。
|
|
11
|
+
// 检查面(由复核抓到的残留类型定):
|
|
12
|
+
// ① *Tests.cs 测试类 —— 在测试项目里确实存在(守卫被删/改名即引用悬空)
|
|
13
|
+
// ② tmp/*.mjs 脚本 —— 仅 advisory:tmp/ 在 .gitignore 第 67 行,脚本易失,不作为关单硬拦(防
|
|
14
|
+
// 「脚本被本地清掉但条目仍有效」恒误报),只提示「清单引用了一个当前不在的 tmp 脚本」
|
|
15
|
+
// ③ workflow/*.md 文档 —— 引用的 intent/spec/plan/incident 文件名确实存在
|
|
16
|
+
// 落点:
|
|
17
|
+
// - confirm-doc.mjs 关单(docs→done / incidents→closed)前置 —— 关单时拦,防残留进归档
|
|
18
|
+
// 用法:node .agents/scripts/check-regression-consistency.mjs [--root <仓库根>]
|
|
19
|
+
// exit 0 = 无悬空引用;exit 1 = 存在悬空测试类/文档引用;tmp 缺失只警告不拦。
|
|
20
|
+
// 测试面已随引擎减重退役(2026-10-28,owner 决策),本脚本现无测试兜底
|
|
21
|
+
// 非独立门:由 confirm-doc.mjs 关单时动态调用(confirm-doc.mjs:551 附近);按 check-* 命名易误判为钩子门,勿在钩子/verify 挂载。
|
|
22
|
+
import fs from 'node:fs';
|
|
23
|
+
import path from 'node:path';
|
|
24
|
+
import { spawnSync } from 'node:child_process';
|
|
25
|
+
import { fileURLToPath } from 'node:url';
|
|
26
|
+
|
|
27
|
+
// 提取清单里引用的标识符(纯函数)。
|
|
28
|
+
// classes: `*Tests` 类名(门禁/单测/集成用例的标准命名)
|
|
29
|
+
// tmpScripts: `tmp/.../*.mjs` 临时验证脚本(e2e/headless 走查产物)
|
|
30
|
+
// docs: `workflow/.../*.md` 流程文档(intent/spec/plan/incident 引用)
|
|
31
|
+
// 刻意不含表名/字段名——SQL 标识符在自由文本里误报率过高(MM_/frontend/ 等常见词会被误抓)。
|
|
32
|
+
// 命名空间词排除(修真实误报):`IntegrationTests` 是 tests/ 的项目目录名,清单叙述「集成测试残留
|
|
33
|
+
// 审计」时以独立词出现,并非类名引用——但它以 Tests 结尾会被类名正则误抓,故显式排除(真实测试类
|
|
34
|
+
// 不会取这个名,它永远是目录/命名空间)。这是唯一的已知系统性误报。
|
|
35
|
+
export function extractRefs(text) {
|
|
36
|
+
const classes = new Set();
|
|
37
|
+
const tmpScripts = new Set();
|
|
38
|
+
const docs = new Set();
|
|
39
|
+
for (const m of text.matchAll(/\b[A-Za-z][A-Za-z0-9_]*Tests\b/g)) {
|
|
40
|
+
if (m[0] !== 'IntegrationTests') classes.add(m[0]);
|
|
41
|
+
}
|
|
42
|
+
for (const m of text.matchAll(/\btmp\/[A-Za-z0-9_./-]+\.mjs\b/g)) tmpScripts.add(m[0]);
|
|
43
|
+
for (const m of text.matchAll(/\bworkflow\/[A-Za-z0-9_./-]+\.md\b/g)) docs.add(m[0]);
|
|
44
|
+
return { classes, tmpScripts, docs };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 收集测试项目里实际存在的测试类名(纯函数)。
|
|
48
|
+
// 测试项目根:tests/ 下两个项目(Shipyard.Material.Tests / Shipyard.Material.IntegrationTests)。
|
|
49
|
+
// 类名 = 文件名去 .cs(C# 一文件一类型约定)。fixture 目录可能不存在——返回空集,调用方按悬空判。
|
|
50
|
+
function collectTestClasses(root) {
|
|
51
|
+
const names = new Set();
|
|
52
|
+
const testsDir = path.join(root, 'tests');
|
|
53
|
+
if (!fs.existsSync(testsDir)) return names;
|
|
54
|
+
const walk = (dir) => {
|
|
55
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
56
|
+
const p = path.join(dir, e.name);
|
|
57
|
+
if (e.isDirectory()) walk(p);
|
|
58
|
+
else if (/\.cs$/i.test(e.name) && /Tests?\.cs$/i.test(e.name)) {
|
|
59
|
+
names.add(e.name.replace(/\.cs$/i, ''));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
walk(testsDir);
|
|
64
|
+
return names;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 主检查(纯函数)。读回归清单主文件 + 全部分片,对照仓库实际资产。
|
|
68
|
+
// 返回 { danglingClasses, danglingDocs, missingTmp } —— 均为排序后的字符串数组。
|
|
69
|
+
export function scanRegressionRefs(root) {
|
|
70
|
+
const wf = path.join(root, 'workflow');
|
|
71
|
+
const readIf = (p) => (fs.existsSync(p) ? fs.readFileSync(p, 'utf8') : '');
|
|
72
|
+
let text = readIf(path.join(wf, 'regression-checklist.md'));
|
|
73
|
+
const shardDir = path.join(wf, 'regression-checklist.d');
|
|
74
|
+
if (fs.existsSync(shardDir)) {
|
|
75
|
+
for (const f of fs.readdirSync(shardDir)) {
|
|
76
|
+
if (f.endsWith('.md')) text += '\n' + readIf(path.join(shardDir, f));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const refs = extractRefs(text);
|
|
80
|
+
const existing = collectTestClasses(root);
|
|
81
|
+
const danglingClasses = [...refs.classes].filter((c) => !existing.has(c)).sort();
|
|
82
|
+
const danglingDocs = [...refs.docs].filter((d) => !fs.existsSync(path.join(root, d))).sort();
|
|
83
|
+
const missingTmp = [...refs.tmpScripts].filter((s) => !fs.existsSync(path.join(root, s))).sort();
|
|
84
|
+
return { danglingClasses, danglingDocs, missingTmp };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ---- 特性地图漂移(verify-ui features/,2026-10-22)----
|
|
88
|
+
// 地图是验证的源:它引用的路由/组件/文档/脚本必须还在。机器只查「引用存在性」;
|
|
89
|
+
// 「驱动步骤是否还能走通」仍需实测(月度/关单抽验),机器不假装能证明行为。
|
|
90
|
+
// 符号(`OrderedContribution` / `Service.Method`)只做 advisory——自由文本里的代码符号
|
|
91
|
+
// 可能来自生成物/外部库,硬拦误报率高。
|
|
92
|
+
export function extractFeatureRefs(text) {
|
|
93
|
+
const routes = new Set();
|
|
94
|
+
const components = new Set();
|
|
95
|
+
const docs = new Set();
|
|
96
|
+
const scripts = new Set();
|
|
97
|
+
const symbols = new Set();
|
|
98
|
+
for (const m of text.matchAll(/#\/[A-Za-z0-9_./:-]+/g)) {
|
|
99
|
+
const r = m[0].replace(/^#/, '').replace(/[.,;)]+$/, '');
|
|
100
|
+
routes.add(r.length > 1 ? r.replace(/\/+$/, '') : r);
|
|
101
|
+
}
|
|
102
|
+
for (const m of text.matchAll(/\bfrontend\/src\/[A-Za-z0-9_./-]+\.(?:vue|ts|js)\b/g)) components.add(m[0]);
|
|
103
|
+
for (const m of text.matchAll(/\bworkflow\/[A-Za-z0-9_./-]+\.md\b/g)) docs.add(m[0]);
|
|
104
|
+
for (const m of text.matchAll(/\bscripts\/verify\/[A-Za-z0-9_./-]+\.mjs\b/g)) scripts.add(m[0]);
|
|
105
|
+
for (const m of text.matchAll(/`([A-Z][A-Za-z0-9_]{5,}(?:\.[A-Za-z0-9_]+)*)`/g)) symbols.add(m[1]);
|
|
106
|
+
return { routes, components, docs, scripts, symbols };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 路由表:frontend/src/router/index.ts 的 path 字面量(相对路径补 /)。
|
|
110
|
+
function collectRouterRoutes(root) {
|
|
111
|
+
const p = path.join(root, 'frontend', 'src', 'router', 'index.ts');
|
|
112
|
+
if (!fs.existsSync(p)) return null;
|
|
113
|
+
const routes = new Set();
|
|
114
|
+
for (const m of fs.readFileSync(p, 'utf8').matchAll(/path:\s*'([^']+)'/g)) {
|
|
115
|
+
const raw = m[1];
|
|
116
|
+
routes.add(raw.startsWith('/') ? raw : `/${raw}`);
|
|
117
|
+
}
|
|
118
|
+
return routes;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// 符号存在性:单点符号一次 git grep 扫 backend/ + frontend/;点号符号(Type.Member)先找同名
|
|
122
|
+
// 类型文件(Type.cs/ts/js/vue)再查成员名——避免把 `Service.Method` 当字面量搜导致假悬空。
|
|
123
|
+
function missingSymbols(root, symbols) {
|
|
124
|
+
if (!symbols.length) return [];
|
|
125
|
+
const simple = symbols.filter((s) => !s.includes('.'));
|
|
126
|
+
const qualified = symbols.filter((s) => s.includes('.'));
|
|
127
|
+
const missing = [];
|
|
128
|
+
if (simple.length) {
|
|
129
|
+
const args = ['grep', '-h', '-F'];
|
|
130
|
+
for (const s of simple) args.push('-e', s);
|
|
131
|
+
args.push('--', 'backend', 'frontend');
|
|
132
|
+
const r = spawnSync('git', args, { cwd: root, encoding: 'utf8' });
|
|
133
|
+
const hay = String(r.stdout || '');
|
|
134
|
+
for (const s of simple) if (!hay.includes(s)) missing.push(s);
|
|
135
|
+
}
|
|
136
|
+
for (const s of qualified) {
|
|
137
|
+
const member = s.split('.').pop();
|
|
138
|
+
const r = spawnSync('git', ['grep', '-l', '-F', '--', member, '--', 'backend', 'frontend'], { cwd: root, encoding: 'utf8' });
|
|
139
|
+
const files = String(r.stdout || '').split(/\r?\n/).filter(Boolean);
|
|
140
|
+
// 成员名在仓库任何位置存在即不判悬空(类型文件可能拆分/部分类/外部库);成员完全不存在才是漂移信号。
|
|
141
|
+
if (!files.length) missing.push(s);
|
|
142
|
+
}
|
|
143
|
+
return missing.sort();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 主检查(纯函数):读 features/*.md,对照路由表 / 文件系统 / 符号面。
|
|
147
|
+
export function scanFeatureMapRefs(root) {
|
|
148
|
+
const dir = path.join(root, '.agents', 'skills', 'verify-ui', 'features');
|
|
149
|
+
const empty = { danglingRoutes: [], danglingComponents: [], danglingDocs: [], danglingScripts: [], missingSymbols: [], files: 0 };
|
|
150
|
+
if (!fs.existsSync(dir)) return empty;
|
|
151
|
+
const router = collectRouterRoutes(root);
|
|
152
|
+
const routes = new Set();
|
|
153
|
+
const components = new Set();
|
|
154
|
+
const docs = new Set();
|
|
155
|
+
const scripts = new Set();
|
|
156
|
+
const symbols = new Set();
|
|
157
|
+
let files = 0;
|
|
158
|
+
for (const f of fs.readdirSync(dir).filter((x) => x.endsWith('.md'))) {
|
|
159
|
+
files++;
|
|
160
|
+
const r = extractFeatureRefs(fs.readFileSync(path.join(dir, f), 'utf8'));
|
|
161
|
+
for (const x of r.routes) routes.add(x);
|
|
162
|
+
for (const x of r.components) components.add(x);
|
|
163
|
+
for (const x of r.docs) docs.add(x);
|
|
164
|
+
for (const x of r.scripts) scripts.add(x);
|
|
165
|
+
for (const x of r.symbols) symbols.add(x);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
danglingRoutes: router ? [...routes].filter((r) => !router.has(r)).sort() : [],
|
|
169
|
+
danglingComponents: [...components].filter((c) => !fs.existsSync(path.join(root, c))).sort(),
|
|
170
|
+
danglingDocs: [...docs].filter((d) => !fs.existsSync(path.join(root, d))).sort(),
|
|
171
|
+
danglingScripts: [...scripts].filter((s) => !fs.existsSync(path.join(root, s))).sort(),
|
|
172
|
+
missingSymbols: missingSymbols(root, [...symbols]),
|
|
173
|
+
files,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ---- 验证脚本锚点(scripts/verify/**/*.mjs,2026-10-22)----
|
|
178
|
+
// 脚本里的 #/路由 与 data-testid 必须还在路由表/源码里——文件存在不等于脚本还能跑。
|
|
179
|
+
// advisory:脚本可能引用外部/动态路由,硬拦误报率高。
|
|
180
|
+
export function scanVerifyScriptAnchors(root) {
|
|
181
|
+
const dir = path.join(root, 'scripts', 'verify');
|
|
182
|
+
if (!fs.existsSync(dir)) return { danglingRoutes: [], danglingTestIds: [], files: 0 };
|
|
183
|
+
const router = collectRouterRoutes(root);
|
|
184
|
+
const routes = new Set();
|
|
185
|
+
const testIds = new Set();
|
|
186
|
+
let files = 0;
|
|
187
|
+
const walk = (d) => {
|
|
188
|
+
for (const e of fs.readdirSync(d, { withFileTypes: true })) {
|
|
189
|
+
const p = path.join(d, e.name);
|
|
190
|
+
if (e.isDirectory()) { walk(p); continue; }
|
|
191
|
+
if (!/\.mjs$/i.test(e.name)) continue;
|
|
192
|
+
files++;
|
|
193
|
+
const text = fs.readFileSync(p, 'utf8');
|
|
194
|
+
for (const m of text.matchAll(/#\/[A-Za-z0-9_./:-]+/g)) {
|
|
195
|
+
const r = m[0].replace(/^#/, '').replace(/[.,;)]+$/, '');
|
|
196
|
+
routes.add(r.length > 1 ? r.replace(/\/+$/, '') : r);
|
|
197
|
+
}
|
|
198
|
+
for (const m of text.matchAll(/data-testid=["']([^"']+)["']/g)) testIds.add(m[1]);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
walk(dir);
|
|
202
|
+
const danglingRoutes = router ? [...routes].filter((r) => !router.has(r)).sort() : [];
|
|
203
|
+
const danglingTestIds = [...testIds].filter((id) => {
|
|
204
|
+
const a = spawnSync('git', ['grep', '-l', '-F', '--', `data-testid="${id}"`, '--', 'frontend/src'], { cwd: root, encoding: 'utf8' });
|
|
205
|
+
const b = spawnSync('git', ['grep', '-l', '-F', '--', `data-testid='${id}'`, '--', 'frontend/src'], { cwd: root, encoding: 'utf8' });
|
|
206
|
+
return a.status !== 0 && b.status !== 0;
|
|
207
|
+
}).sort();
|
|
208
|
+
return { danglingRoutes, danglingTestIds, files };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const isMain = process.argv[1] && process.argv[1].endsWith('check-regression-consistency.mjs');
|
|
212
|
+
if (isMain) {
|
|
213
|
+
const argv = process.argv.slice(2);
|
|
214
|
+
let root = process.cwd();
|
|
215
|
+
for (let i = 0; i < argv.length; i++) {
|
|
216
|
+
if (argv[i] === '--root') root = path.resolve(argv[++i]);
|
|
217
|
+
else if (argv[i] === '--help' || argv[i] === '-h') {
|
|
218
|
+
console.log('用法:node .agents/scripts/check-regression-consistency.mjs [--root <仓库根>]');
|
|
219
|
+
process.exit(0);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const r = scanRegressionRefs(root);
|
|
223
|
+
for (const t of r.missingTmp) {
|
|
224
|
+
console.log(`ℹ️ 清单引用的临时脚本当前不在(tmp/ 易失,不拦):${t}`);
|
|
225
|
+
}
|
|
226
|
+
const fm = scanFeatureMapRefs(root);
|
|
227
|
+
for (const s of fm.missingSymbols) {
|
|
228
|
+
console.log(`ℹ️ 特性地图引用的符号未在 backend/frontend 找到(advisory,可能是生成物/外部库):${s}`);
|
|
229
|
+
}
|
|
230
|
+
const sa = scanVerifyScriptAnchors(root);
|
|
231
|
+
for (const r of sa.danglingRoutes) {
|
|
232
|
+
console.log(`ℹ️ 验证脚本引用的路由不在 router(advisory):${r}`);
|
|
233
|
+
}
|
|
234
|
+
for (const t of sa.danglingTestIds) {
|
|
235
|
+
console.log(`ℹ️ 验证脚本引用的 data-testid 不在 frontend/src(advisory):${t}`);
|
|
236
|
+
}
|
|
237
|
+
const problems = [];
|
|
238
|
+
for (const c of r.danglingClasses) problems.push(`悬空测试类:${c}`);
|
|
239
|
+
for (const d of r.danglingDocs) problems.push(`悬空流程文档:${d}`);
|
|
240
|
+
for (const x of fm.danglingRoutes) problems.push(`特性地图悬空路由:${x}`);
|
|
241
|
+
for (const x of fm.danglingComponents) problems.push(`特性地图悬空组件:${x}`);
|
|
242
|
+
for (const x of fm.danglingDocs) problems.push(`特性地图悬空文档:${x}`);
|
|
243
|
+
for (const x of fm.danglingScripts) problems.push(`特性地图悬空脚本:${x}`);
|
|
244
|
+
if (problems.length) {
|
|
245
|
+
console.error(`\n❌ 活文档引用了不存在的资产(${problems.length} 处)——残留未清:`);
|
|
246
|
+
for (const p of problems) console.error(' - ' + p);
|
|
247
|
+
console.error(' 处理:删除/改写清单或特性地图里已过时的条目(维护规则 4),或恢复被误删的资产。');
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
console.log(`✅ 活文档引用一致:回归清单无悬空测试类/文档;特性地图 ${fm.files} 件无悬空路由/组件/文档/脚本;验证脚本 ${sa.files} 件锚点无悬空${r.missingTmp.length ? `(${r.missingTmp.length} 个 tmp 脚本缺失仅提示)` : ''}`);
|
|
251
|
+
process.exit(0);
|
|
252
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* check-schema-residue.mjs — 「已删列/新增列 vs 实库」残留审计(只读)
|
|
4
|
+
*
|
|
5
|
+
* 用途:批次(wiki/数据维护/schema变更/*)登记的列变更与 dev 实库比对,
|
|
6
|
+
* 找出「批次已删却仍在」(残留=带外加列/批次语句静默失效)
|
|
7
|
+
* 与「批次已加却不存在」(缺失=带外删列)两类漂移。
|
|
8
|
+
*
|
|
9
|
+
* 起源:2026-10-12 dev 库带外加列反复回加(incident 2026-10-12-outband-column-readd-recurring);
|
|
10
|
+
* 同日发现 `LINENO` 为 T-SQL 关键字致 `DROP COLUMN LineNo` 静默不生效 —— 本脚本可一次扫出该类。
|
|
11
|
+
*
|
|
12
|
+
* 口径:
|
|
13
|
+
* - 取各批次 `0N-*.sql` 中**动作类**脚本:排除 `99-*`(回滚)、`*rollback*`(语义反转)、`*verify*`(核验脚本非动作);
|
|
14
|
+
* - 逐条 `ALTER TABLE` 语句内扫描 `ADD [COLUMN]` / `DROP [COLUMN]` 的**多列清单**(顶层逗号切分;跳过 CONSTRAINT/PRIMARY/UNIQUE/… 等约束子句);
|
|
15
|
+
* - 同(表,列)以批次目录名排序取**最后一次**动作;
|
|
16
|
+
* - `ADD` 后缺失 → 缺失;`DROP` 后仍存在 → 残留。
|
|
17
|
+
*
|
|
18
|
+
* 已知盲区(人工兜底,勿当全量证明):
|
|
19
|
+
* - 动态 SQL(`EXEC(N'ALTER TABLE … DROP COLUMN …')`)解析不可见(如 2026-09-29-consignment-vmi-rollback);
|
|
20
|
+
* - 同目录内名为 `0N-rollback-*.sql` 的回滚脚本按文件名排除(其语义为撤销 01,判定会反转)。
|
|
21
|
+
*
|
|
22
|
+
* 豁免(EXEMPT):**带方向**的已判定项——只在登记的该方向上豁免,反方向仍照常报警:
|
|
23
|
+
* - `direction: 'missing'`:批次已加但实库不存在,且已人工核实为「更晚批次删除」等台账侧过时;
|
|
24
|
+
* - `direction: 'residue'`:批次已删但实库仍在,且已人工核实为「实体确实声明该列」(台账注释过时)。
|
|
25
|
+
*
|
|
26
|
+
* 依赖:sqlcmd(PATH 可达)与 backend/material/Shipyard.Material.API/appsettings.json 的 DBConnParameter。
|
|
27
|
+
* 用法:node .agents/scripts/check-schema-residue.mjs [--verbose]
|
|
28
|
+
* 退出码:0 = 无未解释残留/缺失;1 = 有;2 = 前置缺失(appsettings/sqlcmd)。
|
|
29
|
+
*/
|
|
30
|
+
import { execFileSync } from 'node:child_process';
|
|
31
|
+
import fs from 'node:fs';
|
|
32
|
+
import path from 'node:path';
|
|
33
|
+
|
|
34
|
+
const root = process.cwd();
|
|
35
|
+
const base = path.join(root, 'wiki', '数据维护', 'schema变更');
|
|
36
|
+
const verbose = process.argv.includes('--verbose');
|
|
37
|
+
const SKIP = new Set(['CONSTRAINT', 'PRIMARY', 'UNIQUE', 'INDEX', 'CHECK', 'FOREIGN', 'NONCLUSTERED', 'CLUSTERED', 'KEY', 'COLUMN', 'ADD', 'DROP']);
|
|
38
|
+
|
|
39
|
+
// 已判定豁免(带方向;人工核过,不计入对应方向的残留/缺失信号)
|
|
40
|
+
const EXEMPT = new Map([
|
|
41
|
+
['MM_PML_ProductionPMLMaterial.MTOMaterialID', { direction: 'residue', reason: '实体(本仓 ProductionPMLMaterial.cs:18 与并行分支)均声明该属性 → 2026-09-28 批次「实体中无此字段」注释已过期,列合法保留;台账/核验脚本待更新' }],
|
|
42
|
+
['MM_INV_InventoryRecord.OwnershipType', { direction: 'missing', reason: '2026-09-29-consignment-vmi-rollback 已用动态 SQL 删除(VMI 货权回滚),旧批次断言过时' }],
|
|
43
|
+
['MM_INV_InventoryRecord.OwnerSupplierID', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
44
|
+
['MM_INV_InventoryRecord.OwnerSupplierName', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
45
|
+
['MM_INV_InventoryTransaction.OwnershipType', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
46
|
+
['MM_INV_InventoryTransaction.OwnerSupplierID', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
47
|
+
['MM_ISS_OutboundRequestDetail.OwnershipType', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
48
|
+
['MM_ISS_OutboundRequestDetail.OwnerSupplierID', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
49
|
+
['MM_ISS_OutboundRequestDetail.OwnerSupplierName', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
50
|
+
['MM_ISS_OutboundOrderDetail.OwnershipType', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
51
|
+
['MM_ISS_OutboundOrderDetail.OwnerSupplierID', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
52
|
+
['MM_ISS_OutboundOrderDetail.OwnerSupplierName', { direction: 'missing', reason: '同上(VMI 货权回滚删除)' }],
|
|
53
|
+
['MM_PML_ProductionPMLQuota.SourceMaterialCode', { direction: 'missing', reason: '2026-10-23-pml-quota-substitute-columns 批次已 sp_rename 为 SubstituteMaterialCode(本脚本只解析 ADD/DROP,sp_rename 不可见)→ 2026-09-28-pml-source-material-fields 的 ADD 期望过时' }],
|
|
54
|
+
['MM_PML_ProductionPMLQuota.SourceMaterialName', { direction: 'missing', reason: '同上(2026-10-23 批次已 sp_rename 为 SubstituteMaterialName)' }],
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
const appsettings = path.join(root, 'backend', 'material', 'Shipyard.Material.API', 'appsettings.json');
|
|
58
|
+
if (!fs.existsSync(appsettings)) { console.error(`未找到 ${appsettings}`); process.exit(2); }
|
|
59
|
+
const conn = JSON.parse(fs.readFileSync(appsettings, 'utf8')).DBConnParameter;
|
|
60
|
+
if (!conn) { console.error('appsettings.json 缺 DBConnParameter'); process.exit(2); }
|
|
61
|
+
const pick = (k) => (conn.match(new RegExp(`(?:^|;)\\s*${k}\\s*=\\s*([^;]+)`, 'i')) || [])[1];
|
|
62
|
+
const sqlcmdArgs = ['-S', pick('Server'), '-d', pick('Database'), '-U', pick('User Id'), '-P', pick('Password'), '-h', '-1', '-W', '-f', '65001'];
|
|
63
|
+
|
|
64
|
+
const sqlcmd = (query) => execFileSync('sqlcmd', [...sqlcmdArgs, '-Q', query], { encoding: 'utf8' });
|
|
65
|
+
|
|
66
|
+
/** 顶层逗号切分(忽略括号内逗号) */
|
|
67
|
+
function splitTopLevel(text) {
|
|
68
|
+
const parts = []; let depth = 0; let cur = '';
|
|
69
|
+
for (const ch of text) {
|
|
70
|
+
if (ch === '(') depth++;
|
|
71
|
+
else if (ch === ')') depth = Math.max(0, depth - 1);
|
|
72
|
+
if (ch === ',' && depth === 0) { parts.push(cur); cur = ''; continue; }
|
|
73
|
+
cur += ch;
|
|
74
|
+
}
|
|
75
|
+
parts.push(cur);
|
|
76
|
+
return parts;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 取一条 ALTER 语句体里的目标列标识符(多列清单 + 跳过约束子句) */
|
|
80
|
+
function targetsOf(body) {
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const m of body.matchAll(/\b(ADD|DROP)\s+(?:COLUMN\s+)?/gi)) {
|
|
83
|
+
const tail = body.slice(m.index + m[0].length);
|
|
84
|
+
for (const seg of splitTopLevel(tail)) {
|
|
85
|
+
const cleaned = seg.replace(/^\s*COLUMN\s+/i, ''); // `ADD COLUMN a INT, COLUMN b INT` 的第二段
|
|
86
|
+
const id = /^\s*\[?(\w+)\]?/.exec(cleaned);
|
|
87
|
+
if (!id) continue;
|
|
88
|
+
const name = id[1];
|
|
89
|
+
if (SKIP.has(name.toUpperCase())) continue;
|
|
90
|
+
out.push({ action: m[1].toUpperCase(), name });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// 1) 解析批次登记动作(表 | 列 → 最后动作)
|
|
97
|
+
const acts = new Map();
|
|
98
|
+
const isActionFile = (x) => /^0\d-.*\.sql$/i.test(x) && !/^99-/.test(x) && !/rollback/i.test(x) && !/verify/i.test(x);
|
|
99
|
+
for (const d of fs.readdirSync(base, { withFileTypes: true }).filter((x) => x.isDirectory()).map((x) => x.name).sort()) {
|
|
100
|
+
for (const f of fs.readdirSync(path.join(base, d)).filter(isActionFile).sort()) {
|
|
101
|
+
const raw = fs.readFileSync(path.join(base, d, f), 'utf8')
|
|
102
|
+
.replace(/\/\*[\s\S]*?\*\//g, ' ')
|
|
103
|
+
.split(/\r?\n/).map((l) => l.replace(/--.*$/, '')).join('\n');
|
|
104
|
+
// 语句体边界:分号 **或** 下一条 ALTER TABLE 起(防「无分号 + GO」写法把列记到前一张表名下)
|
|
105
|
+
for (const m of raw.matchAll(/ALTER\s+TABLE\s+(?:\[?dbo\]?\.)?\[?(\w+)\]?\s+([\s\S]*?)(?=;|\bALTER\s+TABLE\b|$)/gi)) {
|
|
106
|
+
const [, table, body] = m;
|
|
107
|
+
for (const { action, name } of targetsOf(body)) {
|
|
108
|
+
const key = `${table}|${name}`;
|
|
109
|
+
const cur = acts.get(key);
|
|
110
|
+
if (!cur || d >= cur.order) acts.set(key, { order: d, action, src: `${d}/${f}` });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// 2) 与实库比对
|
|
117
|
+
const exists = (t, c) => sqlcmd(`SET NOCOUNT ON; SELECT CASE WHEN EXISTS(SELECT 1 FROM sys.columns WHERE object_id=OBJECT_ID('dbo.${t}') AND name='${c}') THEN 'Y' ELSE 'N' END;`).split(/\r?\n/)[0].trim() === 'Y';
|
|
118
|
+
const residue = []; const missing = []; const exempted = [];
|
|
119
|
+
for (const [key, v] of acts) {
|
|
120
|
+
const [t, c] = key.split('|');
|
|
121
|
+
if (!/^[A-Za-z_]\w*$/.test(t) || !/^[A-Za-z_]\w*$/.test(c)) continue;
|
|
122
|
+
const dir = v.action === 'ADD' ? 'missing' : 'residue';
|
|
123
|
+
const bad = dir === 'missing' ? !exists(t, c) : exists(t, c);
|
|
124
|
+
if (!bad) continue;
|
|
125
|
+
const ex = EXEMPT.get(`${t}.${c}`);
|
|
126
|
+
if (ex && ex.direction === dir) exempted.push([`${t}.${c}`, dir, ex.reason]);
|
|
127
|
+
else (dir === 'missing' ? missing : residue).push([t, c, v.src]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log(`[schema-residue] 扫描批次动作 ${acts.size} 项(wiki/数据维护/schema变更;排除 99-rollback / *rollback* / *verify*)`);
|
|
131
|
+
console.log(`[schema-residue] 残留(批次已删仍存在)${residue.length} 项 / 缺失(批次已加不存在)${missing.length} 项 / 已豁免 ${exempted.length} 项(按方向)`);
|
|
132
|
+
for (const [t, c, s] of residue) console.log(` ⚠ 残留 ${t}.${c} ← ${s}`);
|
|
133
|
+
for (const [t, c, s] of missing) console.log(` ⚠ 缺失 ${t}.${c} ← ${s}`);
|
|
134
|
+
if (process.argv.includes('--dump')) {
|
|
135
|
+
const filter = process.argv[process.argv.indexOf('--dump') + 1];
|
|
136
|
+
const re = new RegExp(filter ?? '.', 'i');
|
|
137
|
+
console.log(`[schema-residue] --dump ${filter ?? '.'} 命中:`);
|
|
138
|
+
for (const [k, v] of acts) if (re.test(k)) console.log(` · ${k} ${v.action} ← ${v.src}`);
|
|
139
|
+
}
|
|
140
|
+
if (verbose) {
|
|
141
|
+
console.log('[schema-residue] 豁免明细(带方向;反方向仍会报警):');
|
|
142
|
+
for (const [k, dir, reason] of exempted) console.log(` · [${dir}] ${k} — ${reason}`);
|
|
143
|
+
}
|
|
144
|
+
process.exit(residue.length || missing.length ? 1 : 0);
|