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,451 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* test-impact-lib: 影响面选测的唯一实现(config + 匹配 + 选类 + 滤器)
|
|
3
|
+
*
|
|
4
|
+
* 口径单源:.agents/config/test-impact-map.json
|
|
5
|
+
* areas = 测试类 → 业务域(同一测试类可跨域)
|
|
6
|
+
* always = 任何集成子集都必跑的基建/冒烟类
|
|
7
|
+
* paths = 生产文件 → 业务域,按序首命中;未命中或 area 含 "*" = 回退全量
|
|
8
|
+
*
|
|
9
|
+
* 失败语义(故意保守):任何无法判定的输入都返回 full,绝不静默跳过。
|
|
10
|
+
* 新增测试类未登记时:selector 回退全量;check-test-impact-map.mjs 在 CI 重档硬红。
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { spawnSync } from 'node:child_process';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
|
|
19
|
+
export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
|
20
|
+
export const MAP_PATH = path.join(ROOT, '.agents', 'config', 'test-impact-map.json');
|
|
21
|
+
|
|
22
|
+
const TEST_DIR = 'tests/Shipyard.Material.IntegrationTests/';
|
|
23
|
+
const UNIT_DIR = 'tests/Shipyard.Material.Tests/';
|
|
24
|
+
const FULLCHAIN_DIR = `${TEST_DIR}FullChain/`;
|
|
25
|
+
// 选测匹配统一小写键(P1 修复 2026-11-06)——startswith 判据须用小写常量。
|
|
26
|
+
const TEST_DIR_LC = TEST_DIR.toLowerCase();
|
|
27
|
+
const UNIT_DIR_LC = UNIT_DIR.toLowerCase();
|
|
28
|
+
const FULLCHAIN_DIR_LC = FULLCHAIN_DIR.toLowerCase();
|
|
29
|
+
const BUILD_FILE_RE = /\.(sln|csproj|props|targets)$/i;
|
|
30
|
+
const SQL_RE = /\.sql$/i;
|
|
31
|
+
const BACKEND_TEST_FACE_RE = /^(backend|tests|scripts)\//i;
|
|
32
|
+
const SCHEMA_CHANGE_SQL_RE = /^wiki\/数据维护\/schema变更\//i;
|
|
33
|
+
const DATA_REPAIR_SQL_RE = /^wiki\/数据维护\/数据修复\//i;
|
|
34
|
+
const AREA_RE = /^[a-z][a-z0-9-]*$/;
|
|
35
|
+
const CLASS_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
36
|
+
|
|
37
|
+
export const normalizePath = (p) =>
|
|
38
|
+
String(p || '')
|
|
39
|
+
.replace(/\\/g, '/')
|
|
40
|
+
.replace(/^\.\//, '')
|
|
41
|
+
.trim();
|
|
42
|
+
|
|
43
|
+
const escapeRe = (s) => s.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
44
|
+
|
|
45
|
+
/** 受控 glob:支持 **、*、?、{a,b};只用于本仓 manifest,不追求通用语义。 */
|
|
46
|
+
export function globToRegExp(glob) {
|
|
47
|
+
const g = normalizePath(glob);
|
|
48
|
+
let re = '^';
|
|
49
|
+
for (let i = 0; i < g.length; ) {
|
|
50
|
+
const ch = g[i];
|
|
51
|
+
if (ch === '*') {
|
|
52
|
+
if (g[i + 1] === '*') {
|
|
53
|
+
if (g[i + 2] === '/') {
|
|
54
|
+
re += '(?:[^/]+/)*';
|
|
55
|
+
i += 3;
|
|
56
|
+
} else {
|
|
57
|
+
re += '.*';
|
|
58
|
+
i += 2;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
re += '[^/]*';
|
|
62
|
+
i += 1;
|
|
63
|
+
}
|
|
64
|
+
} else if (ch === '?') {
|
|
65
|
+
re += '[^/]';
|
|
66
|
+
i += 1;
|
|
67
|
+
} else if (ch === '{') {
|
|
68
|
+
const end = g.indexOf('}', i);
|
|
69
|
+
if (end === -1) {
|
|
70
|
+
re += '\\{';
|
|
71
|
+
i += 1;
|
|
72
|
+
} else {
|
|
73
|
+
const options = g.slice(i + 1, end).split(',').map((x) => escapeRe(x));
|
|
74
|
+
re += `(?:${options.join('|')})`;
|
|
75
|
+
i = end + 1;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
re += escapeRe(ch);
|
|
79
|
+
i += 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
re += '$';
|
|
83
|
+
return new RegExp(re);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function validateMap(map) {
|
|
87
|
+
const errors = [];
|
|
88
|
+
if (!map || typeof map !== 'object' || Array.isArray(map)) {
|
|
89
|
+
throw new Error('test-impact-map: 顶层必须是对象');
|
|
90
|
+
}
|
|
91
|
+
if (typeof map.namespace !== 'string' || !map.namespace.trim()) {
|
|
92
|
+
errors.push('namespace 缺失');
|
|
93
|
+
}
|
|
94
|
+
if (!map.areas || typeof map.areas !== 'object' || Array.isArray(map.areas)) {
|
|
95
|
+
errors.push('areas 缺失或不是对象');
|
|
96
|
+
}
|
|
97
|
+
const areaNames = new Set(Object.keys(map.areas || {}));
|
|
98
|
+
const classAreas = new Map();
|
|
99
|
+
for (const [area, classes] of Object.entries(map.areas || {})) {
|
|
100
|
+
if (!AREA_RE.test(area)) errors.push(`area 名不合法:${area}`);
|
|
101
|
+
if (!Array.isArray(classes) || classes.length === 0) {
|
|
102
|
+
errors.push(`area ${area} 没有测试类`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
const local = new Set();
|
|
106
|
+
for (const cls of classes) {
|
|
107
|
+
if (typeof cls !== 'string' || !CLASS_RE.test(cls)) {
|
|
108
|
+
errors.push(`area ${area} 类名不合法:${cls}`);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (local.has(cls)) errors.push(`area ${area} 重复登记:${cls}`);
|
|
112
|
+
local.add(cls);
|
|
113
|
+
if (!classAreas.has(cls)) classAreas.set(cls, new Set());
|
|
114
|
+
classAreas.get(cls).add(area);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (!Array.isArray(map.always)) {
|
|
118
|
+
errors.push('always 必须是数组');
|
|
119
|
+
} else {
|
|
120
|
+
for (const cls of map.always) {
|
|
121
|
+
if (!classAreas.has(cls)) errors.push(`always 类未在 areas 登记:${cls}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (!Array.isArray(map.paths) || map.paths.length === 0) {
|
|
125
|
+
errors.push('paths 必须是非空数组');
|
|
126
|
+
} else {
|
|
127
|
+
map.paths.forEach((rule, idx) => {
|
|
128
|
+
if (!rule || typeof rule !== 'object') {
|
|
129
|
+
errors.push(`paths[${idx}] 不是对象`);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (typeof rule.glob !== 'string' || !rule.glob.trim()) {
|
|
133
|
+
errors.push(`paths[${idx}] 缺 glob`);
|
|
134
|
+
} else {
|
|
135
|
+
try {
|
|
136
|
+
globToRegExp(rule.glob);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
errors.push(`paths[${idx}] glob 无法解析:${rule.glob}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (!Array.isArray(rule.areas) || rule.areas.length === 0) {
|
|
142
|
+
errors.push(`paths[${idx}] 缺 areas`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
for (const area of rule.areas) {
|
|
146
|
+
if (area !== '*' && !areaNames.has(area)) {
|
|
147
|
+
errors.push(`paths[${idx}] 引用未知 area:${area}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
if (errors.length) {
|
|
153
|
+
const err = new Error(`test-impact-map 校验失败:\n- ${errors.join('\n- ')}`);
|
|
154
|
+
err.errors = errors;
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
return map;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function loadMap(mapPath = MAP_PATH) {
|
|
161
|
+
let raw;
|
|
162
|
+
try {
|
|
163
|
+
raw = fs.readFileSync(mapPath, 'utf8');
|
|
164
|
+
} catch (e) {
|
|
165
|
+
throw new Error(`test-impact-map 读取失败:${mapPath}(${e.message})`);
|
|
166
|
+
}
|
|
167
|
+
let map;
|
|
168
|
+
try {
|
|
169
|
+
map = JSON.parse(raw);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
throw new Error(`test-impact-map JSON 解析失败:${mapPath}(${e.message})`);
|
|
172
|
+
}
|
|
173
|
+
return validateMap(map);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** 返回 { files, reason };reason 非空表示范围不可判定,调用方应回退全量。 */
|
|
177
|
+
export function changedFilesFromRange(oldSha, newSha) {
|
|
178
|
+
const diff = (from, to) => {
|
|
179
|
+
// core.quotepath=off:Git 默认会把中文路径转义成 "wiki/\346...",选测会漏掉 schema SQL。
|
|
180
|
+
// --no-renames:重命名按删除+新增处理,新旧路径都进影响面,避免只看到新路径。
|
|
181
|
+
const r = spawnSync('git', ['-c', 'core.quotepath=off', 'diff', '--name-only', '--no-renames', `${from}..${to}`], {
|
|
182
|
+
cwd: ROOT,
|
|
183
|
+
encoding: 'utf8',
|
|
184
|
+
shell: false,
|
|
185
|
+
});
|
|
186
|
+
if (r.status !== 0) {
|
|
187
|
+
return {
|
|
188
|
+
files: [],
|
|
189
|
+
reason: `git diff 失败(${(r.stderr || '').trim()}),回退全量`,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
files: (r.stdout || '')
|
|
194
|
+
.split(/\r?\n/)
|
|
195
|
+
.map(normalizePath)
|
|
196
|
+
.filter(Boolean),
|
|
197
|
+
reason: null,
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// 新分支首推:远端无基线。优先与 origin/develop / origin/main 的 merge-base 比较,
|
|
202
|
+
// 避免「只推前端/文档的新分支也跑全量」;找不到基线仍 fail-safe 回退全量。
|
|
203
|
+
if (/^0+$/.test(oldSha || '')) {
|
|
204
|
+
for (const ref of ['origin/develop', 'origin/main', 'develop', 'main']) {
|
|
205
|
+
const verified = spawnSync('git', ['rev-parse', '--verify', '--quiet', ref], {
|
|
206
|
+
cwd: ROOT,
|
|
207
|
+
encoding: 'utf8',
|
|
208
|
+
shell: false,
|
|
209
|
+
});
|
|
210
|
+
if (verified.status !== 0) continue;
|
|
211
|
+
const base = spawnSync('git', ['merge-base', ref, newSha], {
|
|
212
|
+
cwd: ROOT,
|
|
213
|
+
encoding: 'utf8',
|
|
214
|
+
shell: false,
|
|
215
|
+
});
|
|
216
|
+
const baseSha = (base.stdout || '').trim();
|
|
217
|
+
if (base.status === 0 && baseSha) {
|
|
218
|
+
return diff(baseSha, newSha);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return { files: [], reason: '新分支首推且找不到本地基线,回退全量' };
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return diff(oldSha, newSha);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Count integration tests matched by a vstest filter. `dotnet test --list-tests`
|
|
229
|
+
* exits 0 even when nothing matches, so the caller must use this count to
|
|
230
|
+
* fail closed instead of trusting the exit code.
|
|
231
|
+
*/
|
|
232
|
+
export function countListedIntegrationTests(
|
|
233
|
+
filter,
|
|
234
|
+
{ cwd = ROOT, cspoj = 'tests/Shipyard.Material.IntegrationTests/Shipyard.Material.IntegrationTests.csproj' } = {},
|
|
235
|
+
) {
|
|
236
|
+
const r = spawnSync(
|
|
237
|
+
'dotnet',
|
|
238
|
+
[
|
|
239
|
+
'test',
|
|
240
|
+
cspoj,
|
|
241
|
+
'--list-tests',
|
|
242
|
+
'--no-build',
|
|
243
|
+
'--nologo',
|
|
244
|
+
'-v',
|
|
245
|
+
'q',
|
|
246
|
+
'--filter',
|
|
247
|
+
filter,
|
|
248
|
+
],
|
|
249
|
+
{ cwd, encoding: 'utf8', shell: false, maxBuffer: 8 * 1024 * 1024 },
|
|
250
|
+
);
|
|
251
|
+
if (r.status !== 0) {
|
|
252
|
+
throw new Error(
|
|
253
|
+
`集成用例预检失败(dotnet test --list-tests exit ${r.status}):${(r.stderr || '').trim()}`,
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return (r.stdout.match(/^\s+Shipyard\.Material\.IntegrationTests\./gm) || []).length;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export function assertFilterHasTests(filter, opts) {
|
|
260
|
+
const count = countListedIntegrationTests(filter, opts);
|
|
261
|
+
if (count === 0) {
|
|
262
|
+
throw new Error('选测 filter 匹配 0 个集成用例,拒绝绿灯');
|
|
263
|
+
}
|
|
264
|
+
return count;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export function classesInTestFile(absolutePath) {
|
|
268
|
+
let src;
|
|
269
|
+
try {
|
|
270
|
+
src = fs.readFileSync(absolutePath, 'utf8');
|
|
271
|
+
} catch {
|
|
272
|
+
return [];
|
|
273
|
+
}
|
|
274
|
+
const out = new Set();
|
|
275
|
+
const re = /^public\s+(?:sealed\s+|abstract\s+|partial\s+)*class\s+([A-Za-z_][A-Za-z0-9_]*)/gm;
|
|
276
|
+
for (const m of src.matchAll(re)) {
|
|
277
|
+
if (m[1].endsWith('Tests')) out.add(m[1]);
|
|
278
|
+
}
|
|
279
|
+
return [...out];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const buildClassIndex = (map) => {
|
|
283
|
+
const allClasses = new Set();
|
|
284
|
+
const classAreas = new Map();
|
|
285
|
+
for (const [area, classes] of Object.entries(map.areas)) {
|
|
286
|
+
for (const cls of classes) {
|
|
287
|
+
allClasses.add(cls);
|
|
288
|
+
if (!classAreas.has(cls)) classAreas.set(cls, new Set());
|
|
289
|
+
classAreas.get(cls).add(area);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return { allClasses, classAreas };
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @param {object} map 已校验的 manifest
|
|
297
|
+
* @param {string[]} files 变更文件(相对仓库根,正/反斜杠均可)
|
|
298
|
+
* @returns {{mode:'full'|'none'|'filter', reason:string, areas:string[], classes:string[],
|
|
299
|
+
* filter:string|null, warnings:string[], changedFiles:string[], totalClasses:number}}
|
|
300
|
+
*/
|
|
301
|
+
export function selectForFiles(map, files) {
|
|
302
|
+
const { allClasses, classAreas } = buildClassIndex(map);
|
|
303
|
+
// glob 与变更路径统一小写后匹配:map 里 glob 含大写(MTO*/Shipyard.Material…),
|
|
304
|
+
// 与入口判据(pre-push 带 /i)对齐,任何大小写 casing 都不漏判。
|
|
305
|
+
const rules = map.paths.map((rule) => ({ ...rule, re: globToRegExp(rule.glob.toLowerCase()) }));
|
|
306
|
+
const changedFiles = (files || []).map(normalizePath).filter(Boolean);
|
|
307
|
+
const areas = new Set();
|
|
308
|
+
const explicitClasses = new Set();
|
|
309
|
+
const warnings = [];
|
|
310
|
+
let forceFull = false;
|
|
311
|
+
|
|
312
|
+
for (const file of changedFiles) {
|
|
313
|
+
// P1 修复(2026-11-06):入口判据(pre-push isBackendFaceFile 等)带 /i,而本函数的
|
|
314
|
+
// startsWith/glob 匹配大小写敏感——非标大小写路径(如 Backend/…)曾被判 mode=none 静默漏跑。
|
|
315
|
+
// 统一用小写键 f 做判据匹配;读文件/告警仍用原 file。
|
|
316
|
+
const f = file.toLowerCase();
|
|
317
|
+
// 工程文件:构建口径可能影响全部集成用例,直接全量
|
|
318
|
+
if (BUILD_FILE_RE.test(file)) {
|
|
319
|
+
forceFull = true;
|
|
320
|
+
warnings.push(`${file} → 工程文件,回退全量`);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
// SQL:后端/测试/脚本面、schema 变更与数据修复会影响集成;其余 wiki 数据维护不触发
|
|
324
|
+
if (SQL_RE.test(file)) {
|
|
325
|
+
if (
|
|
326
|
+
BACKEND_TEST_FACE_RE.test(f) ||
|
|
327
|
+
SCHEMA_CHANGE_SQL_RE.test(f) ||
|
|
328
|
+
DATA_REPAIR_SQL_RE.test(f)
|
|
329
|
+
) {
|
|
330
|
+
forceFull = true;
|
|
331
|
+
warnings.push(`${file} → schema/数据修复 SQL,回退全量`);
|
|
332
|
+
}
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
// 单测面:集成无需重跑
|
|
336
|
+
if (f.startsWith(UNIT_DIR_LC)) continue;
|
|
337
|
+
// FullChain 默认不编译(#if FCLocal),不参与默认档
|
|
338
|
+
if (f.startsWith(FULLCHAIN_DIR_LC)) continue;
|
|
339
|
+
// 集成测试自身:只跑该文件里的测试类;测试基建无法判定则全量
|
|
340
|
+
if (f.startsWith(TEST_DIR_LC)) {
|
|
341
|
+
const classes = classesInTestFile(path.join(ROOT, file));
|
|
342
|
+
if (classes.length === 0) {
|
|
343
|
+
forceFull = true;
|
|
344
|
+
warnings.push(`${file} → 测试基建/未识别测试文件,回退全量`);
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
for (const cls of classes) {
|
|
348
|
+
const clsAreas = classAreas.get(cls);
|
|
349
|
+
if (!clsAreas) {
|
|
350
|
+
forceFull = true;
|
|
351
|
+
warnings.push(`${file} → 未登记测试类 ${cls},回退全量`);
|
|
352
|
+
} else {
|
|
353
|
+
explicitClasses.add(cls);
|
|
354
|
+
for (const area of clsAreas) areas.add(area);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
// 后端生产面:按序首命中
|
|
360
|
+
if (f.startsWith('backend/')) {
|
|
361
|
+
const rule = rules.find((r) => r.re.test(f));
|
|
362
|
+
if (!rule) {
|
|
363
|
+
forceFull = true;
|
|
364
|
+
warnings.push(`${file} → 未命中路径规则,回退全量`);
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (rule.areas.includes('*')) {
|
|
368
|
+
forceFull = true;
|
|
369
|
+
warnings.push(`${file} → 命中 ${rule.glob}(全量域),回退全量`);
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
for (const area of rule.areas) areas.add(area);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
// 前端 / workflow / .agents / docs / scripts:不触发后端集成
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (forceFull) {
|
|
379
|
+
return {
|
|
380
|
+
mode: 'full',
|
|
381
|
+
reason: '存在无法安全裁剪的变更',
|
|
382
|
+
areas: [],
|
|
383
|
+
classes: [...allClasses].sort(),
|
|
384
|
+
filter: null,
|
|
385
|
+
warnings,
|
|
386
|
+
changedFiles,
|
|
387
|
+
totalClasses: allClasses.size,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (areas.size === 0 && explicitClasses.size === 0) {
|
|
392
|
+
return {
|
|
393
|
+
mode: 'none',
|
|
394
|
+
reason: '变更面不涉及后端集成',
|
|
395
|
+
areas: [],
|
|
396
|
+
classes: [],
|
|
397
|
+
filter: null,
|
|
398
|
+
warnings,
|
|
399
|
+
changedFiles,
|
|
400
|
+
totalClasses: allClasses.size,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const classes = new Set([...explicitClasses, ...map.always]);
|
|
405
|
+
for (const area of areas) {
|
|
406
|
+
for (const cls of map.areas[area]) classes.add(cls);
|
|
407
|
+
}
|
|
408
|
+
const sorted = [...classes].sort();
|
|
409
|
+
if (sorted.length >= allClasses.size) {
|
|
410
|
+
return {
|
|
411
|
+
mode: 'full',
|
|
412
|
+
reason: '选中测试类覆盖全量',
|
|
413
|
+
areas: [...areas].sort(),
|
|
414
|
+
classes: [...allClasses].sort(),
|
|
415
|
+
filter: null,
|
|
416
|
+
warnings,
|
|
417
|
+
changedFiles,
|
|
418
|
+
totalClasses: allClasses.size,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const filter = sorted
|
|
423
|
+
.map((cls) => `FullyQualifiedName~${map.namespace}.${cls}.`)
|
|
424
|
+
.join('|');
|
|
425
|
+
return {
|
|
426
|
+
mode: 'filter',
|
|
427
|
+
reason: `按影响面选中 ${sorted.length}/${allClasses.size} 个测试类`,
|
|
428
|
+
areas: [...areas].sort(),
|
|
429
|
+
classes: sorted,
|
|
430
|
+
filter,
|
|
431
|
+
warnings,
|
|
432
|
+
changedFiles,
|
|
433
|
+
totalClasses: allClasses.size,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/** 供 CLI 与 run-backend-tests 共用:打印人类可读决策。 */
|
|
438
|
+
export function formatDecision(decision) {
|
|
439
|
+
const lines = [];
|
|
440
|
+
lines.push(`changed files: ${decision.changedFiles.length}`);
|
|
441
|
+
if (decision.areas.length) lines.push(`areas: ${decision.areas.join(', ')}`);
|
|
442
|
+
if (decision.mode === 'filter') {
|
|
443
|
+
lines.push(`classes: ${decision.classes.length}/${decision.totalClasses}`);
|
|
444
|
+
lines.push(`filter: ${decision.filter}`);
|
|
445
|
+
} else {
|
|
446
|
+
lines.push(`classes: ${decision.mode === 'full' ? decision.totalClasses : 0}/${decision.totalClasses}`);
|
|
447
|
+
}
|
|
448
|
+
lines.push(`mode: ${decision.mode}(${decision.reason})`);
|
|
449
|
+
for (const w of decision.warnings) lines.push(`warn: ${w}`);
|
|
450
|
+
return lines.join('\n');
|
|
451
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* test-impact: 影响面选测 CLI
|
|
3
|
+
*
|
|
4
|
+
* 已接线 pre-push(2026-11-08):集成档 --select-range、单测档 --unit-range 均经
|
|
5
|
+
* scripts/verify/backend/run-backend-tests.mjs 执行;本 CLI 保留作手动探查。
|
|
6
|
+
*
|
|
7
|
+
* 用法:
|
|
8
|
+
* node .agents/scripts/test-impact.mjs --range <old> <new> [--json]
|
|
9
|
+
* node .agents/scripts/test-impact.mjs --files <file1,file2,...> [--json]
|
|
10
|
+
*
|
|
11
|
+
* 输出:
|
|
12
|
+
* mode=filter → 给出 dotnet test --filter 表达式
|
|
13
|
+
* mode=full → 调用方跑全量
|
|
14
|
+
* mode=none → 不涉及集成测试
|
|
15
|
+
*
|
|
16
|
+
* 退出码:0 = 决策成功;2 = 参数/manifest 错误。full/none 不是错误。
|
|
17
|
+
*/
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
MAP_PATH,
|
|
22
|
+
changedFilesFromRange,
|
|
23
|
+
formatDecision,
|
|
24
|
+
loadMap,
|
|
25
|
+
normalizePath,
|
|
26
|
+
selectForFiles,
|
|
27
|
+
} from './test-impact-lib.mjs';
|
|
28
|
+
|
|
29
|
+
const argv = process.argv.slice(2);
|
|
30
|
+
const json = argv.includes('--json');
|
|
31
|
+
const filesArg = [];
|
|
32
|
+
let range = null;
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
35
|
+
const arg = argv[i];
|
|
36
|
+
if (arg === '--json') continue;
|
|
37
|
+
if (arg === '--files') {
|
|
38
|
+
const value = argv[i + 1];
|
|
39
|
+
if (!value) usage('--files 缺少参数');
|
|
40
|
+
filesArg.push(...value.split(',').map(normalizePath).filter(Boolean));
|
|
41
|
+
i += 1;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (arg === '--range') {
|
|
45
|
+
const oldSha = argv[i + 1];
|
|
46
|
+
const newSha = argv[i + 2];
|
|
47
|
+
if (!oldSha || !newSha) usage('--range 需要 <old> <new>');
|
|
48
|
+
range = { oldSha, newSha };
|
|
49
|
+
i += 2;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
usage(`未知参数:${arg}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function usage(message) {
|
|
56
|
+
if (message) console.error(`test-impact: ${message}`);
|
|
57
|
+
console.error('用法:node .agents/scripts/test-impact.mjs --range <old> <new> [--json]');
|
|
58
|
+
console.error(' node .agents/scripts/test-impact.mjs --files <a,b,c> [--json]');
|
|
59
|
+
process.exit(2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let decision;
|
|
63
|
+
try {
|
|
64
|
+
let files = filesArg;
|
|
65
|
+
let rangeFailure = null;
|
|
66
|
+
if (range) {
|
|
67
|
+
const result = changedFilesFromRange(range.oldSha, range.newSha);
|
|
68
|
+
files = result.files;
|
|
69
|
+
rangeFailure = result.reason;
|
|
70
|
+
}
|
|
71
|
+
if (rangeFailure) {
|
|
72
|
+
decision = {
|
|
73
|
+
mode: 'full',
|
|
74
|
+
reason: rangeFailure,
|
|
75
|
+
areas: [],
|
|
76
|
+
classes: [],
|
|
77
|
+
filter: null,
|
|
78
|
+
warnings: [rangeFailure],
|
|
79
|
+
changedFiles: [],
|
|
80
|
+
totalClasses: 0,
|
|
81
|
+
};
|
|
82
|
+
// 仍加载 manifest,尽早暴露配置错误
|
|
83
|
+
loadMap();
|
|
84
|
+
} else {
|
|
85
|
+
const map = loadMap();
|
|
86
|
+
decision = selectForFiles(map, files);
|
|
87
|
+
}
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error(`test-impact: ${e.message}`);
|
|
90
|
+
process.exit(2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (json) {
|
|
94
|
+
process.stdout.write(`${JSON.stringify({ map: MAP_PATH, ...decision }, null, 2)}\n`);
|
|
95
|
+
} else {
|
|
96
|
+
console.log('test-impact:');
|
|
97
|
+
console.log(formatDecision(decision));
|
|
98
|
+
if (decision.mode === 'filter') {
|
|
99
|
+
console.log('run: dotnet test tests/Shipyard.Material.IntegrationTests/Shipyard.Material.IntegrationTests.csproj --no-build --filter "<filter>"');
|
|
100
|
+
} else if (decision.mode === 'full') {
|
|
101
|
+
console.log('run: node scripts/verify/backend/run-backend-tests.mjs --full');
|
|
102
|
+
} else {
|
|
103
|
+
console.log('run: (跳过集成测试)');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// trust-mode: AI 自治信任等级管理(2026-09-30 ai-autonomy-trust;同日 hybrid-governance-risk-lanes 加名称双轨)
|
|
3
|
+
// 管理 .agents/trust-mode.json,授权 AI 对 L1 文档进行自治放行(--auto)。
|
|
4
|
+
// 等级语义(名称 ↔ 数值双轨:confirm-doc.mjs 读数值 enabled/level,人机接口名称与数值皆收):
|
|
5
|
+
// Strict (level 0, enabled=false): AI 自治关闭(默认)——confirm-doc --auto 一律拒绝
|
|
6
|
+
// Standard (level 1): AI 可自批 L1 draft -> approved
|
|
7
|
+
// Trusted (level 2): AI 可自批 L1 draft -> approved 及 approved -> done(全闭环)
|
|
8
|
+
// 安全默认值:未开启(enabled: false)时,confirm-doc.mjs --auto 一律拒绝。
|
|
9
|
+
// 审计链(2026-10-09 P3-3):升降级/开关写入本地追加式台账 .agents/trust-mode-audit.jsonl——
|
|
10
|
+
// 每行含前一行的 sha256(prev 链),--verify 校验链完整性。自治授权面的变化从此可追溯;
|
|
11
|
+
// 不进 .agents/confirmations.jsonl(该台账行协议钉死 workflow 四目录 doc 路径,见
|
|
12
|
+
// check-ledger-invariant.mjs 行级 ④)。诚实边界:本地文件、非签名——删整份台账=审计面全失
|
|
13
|
+
// (与 check-loop 检查 15 台账同类边界),篡改单行则链断可检。
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { createHash } from 'node:crypto';
|
|
17
|
+
|
|
18
|
+
const CONFIG_PATH = path.join(process.cwd(), '.agents', 'trust-mode.json');
|
|
19
|
+
const AUDIT_PATH = path.join(process.cwd(), '.agents', 'trust-mode-audit.jsonl');
|
|
20
|
+
const NAME_BY_LEVEL = { 0: 'Strict', 1: 'Standard', 2: 'Trusted' };
|
|
21
|
+
const LEVEL_BY_NAME = { Strict: 0, Standard: 1, Trusted: 2 };
|
|
22
|
+
|
|
23
|
+
const sha256 = (s) => createHash('sha256').update(s, 'utf8').digest('hex');
|
|
24
|
+
|
|
25
|
+
function readConfig() {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
|
28
|
+
} catch {
|
|
29
|
+
return { enabled: false, level: 0, name: 'Strict', enabledAt: null };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function writeConfig(config) {
|
|
34
|
+
fs.mkdirSync(path.dirname(CONFIG_PATH), { recursive: true });
|
|
35
|
+
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 追加审计行:prev = 末行原文 sha256(链式),行自身完整性由后一行 prev 递归保证
|
|
39
|
+
// (末行无后继——末行被改只影响其内容与 config 现值的对质,属已知残留面,如实声明)
|
|
40
|
+
function appendAudit(action, from, to) {
|
|
41
|
+
fs.mkdirSync(path.dirname(AUDIT_PATH), { recursive: true });
|
|
42
|
+
let prev = 'GENESIS';
|
|
43
|
+
try {
|
|
44
|
+
const lines = fs.readFileSync(AUDIT_PATH, 'utf8').split(/\r?\n/).filter(Boolean);
|
|
45
|
+
if (lines.length) prev = sha256(lines[lines.length - 1]);
|
|
46
|
+
} catch { /* 无台账 = GENESIS */ }
|
|
47
|
+
const row = {
|
|
48
|
+
ts: new Date().toISOString(),
|
|
49
|
+
action,
|
|
50
|
+
from: { enabled: !!from.enabled, level: from.level ?? 0, name: from.name || 'Strict' },
|
|
51
|
+
to: { enabled: !!to.enabled, level: to.level ?? 0, name: to.name || 'Strict' },
|
|
52
|
+
prev,
|
|
53
|
+
};
|
|
54
|
+
fs.appendFileSync(AUDIT_PATH, `${JSON.stringify(row)}\n`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function verifyAudit() {
|
|
58
|
+
let lines;
|
|
59
|
+
try {
|
|
60
|
+
lines = fs.readFileSync(AUDIT_PATH, 'utf8').split(/\r?\n/).filter(Boolean);
|
|
61
|
+
} catch {
|
|
62
|
+
console.log('✅ 无审计台账(从未变更过信任等级)');
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
let prev = 'GENESIS';
|
|
66
|
+
const problems = [];
|
|
67
|
+
lines.forEach((line, i) => {
|
|
68
|
+
let e;
|
|
69
|
+
try { e = JSON.parse(line); } catch { problems.push(`第 ${i + 1} 行:非 JSON`); return; }
|
|
70
|
+
if (e.prev !== prev) problems.push(`第 ${i + 1} 行:prev 链断裂(期望 ${prev.slice(0, 12)}…,实际 ${String(e.prev).slice(0, 12)}…)——前一行或本行被篡改/插入`);
|
|
71
|
+
if (typeof e.ts !== 'string' || Number.isNaN(Date.parse(e.ts))) problems.push(`第 ${i + 1} 行:ts 非 ISO`);
|
|
72
|
+
prev = sha256(line);
|
|
73
|
+
});
|
|
74
|
+
if (problems.length) {
|
|
75
|
+
console.error(`❌ 审计链校验失败(${problems.length} 处):\n ${problems.join('\n ')}`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
console.log(`✅ 审计链完整(${lines.length} 条变更记录,无篡改信号)`);
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function main() {
|
|
83
|
+
const args = process.argv.slice(2);
|
|
84
|
+
const config = readConfig();
|
|
85
|
+
|
|
86
|
+
if (args.includes('--verify')) {
|
|
87
|
+
verifyAudit();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (args.includes('--enable')) {
|
|
92
|
+
const levelIdx = args.indexOf('--level');
|
|
93
|
+
const raw = levelIdx !== -1 ? String(args[levelIdx + 1] ?? '') : '1';
|
|
94
|
+
const level = LEVEL_BY_NAME[raw] ?? (['0', '1', '2'].includes(raw) ? Number(raw) : NaN);
|
|
95
|
+
if (![0, 1, 2].includes(level)) {
|
|
96
|
+
console.error('❌ --level 必须为 Strict|Standard|Trusted(或 0|1|2)');
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (level === 0) {
|
|
100
|
+
writeConfig({ enabled: false, level: 0, name: 'Strict', enabledAt: null });
|
|
101
|
+
appendAudit('disable', config, { enabled: false, level: 0, name: 'Strict' });
|
|
102
|
+
console.log('🔒 AI 自治模式已关闭(Strict)');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const next = { enabled: true, level, name: NAME_BY_LEVEL[level], enabledAt: new Date().toISOString() };
|
|
106
|
+
writeConfig(next);
|
|
107
|
+
appendAudit('enable', config, next);
|
|
108
|
+
console.log(`✅ AI 自治模式已开启 (${NAME_BY_LEVEL[level]} / Level ${level})`);
|
|
109
|
+
console.log(level === 1 ? ' 授权范围:L1 文档 draft -> approved' : ' 授权范围:L1 文档全闭环 (approved + done)');
|
|
110
|
+
console.log(' 审计:本次变更已记入 .agents/trust-mode-audit.jsonl(--verify 校验链)');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (args.includes('--disable')) {
|
|
115
|
+
writeConfig({ enabled: false, level: 0, name: 'Strict', enabledAt: null });
|
|
116
|
+
appendAudit('disable', config, { enabled: false, level: 0, name: 'Strict' });
|
|
117
|
+
console.log('🔒 AI 自治模式已关闭 (Strict)');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (args.includes('--status')) {
|
|
122
|
+
console.log(JSON.stringify({ name: NAME_BY_LEVEL[config.level] || 'Strict', ...config }, null, 2));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log('用法: node .agents/scripts/trust-mode.mjs [--enable --level <Strict|Standard|Trusted|1|2> | --disable | --status | --verify]');
|
|
127
|
+
process.exit(config.enabled ? 0 : 1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main();
|