agentic-flow-kit 1.8.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -148
- package/bin/flow-kit.mjs +5 -2
- package/locales/en/installer.json +25 -0
- package/locales/en/overrides/.agents/commands/deploy.md +52 -0
- package/locales/en/overrides/.agents/commands/maintain.md +76 -0
- package/locales/en/overrides/.agents/commands/new-task.md +89 -0
- package/locales/en/overrides/.agents/commands/pipeline-run.md +56 -0
- package/locales/en/overrides/.agents/commands/pr-review.md +30 -0
- package/locales/en/overrides/.agents/commands/review.md +93 -0
- package/locales/en/overrides/.agents/commands/stages.md +256 -0
- package/locales/en/overrides/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/locales/en/overrides/.agents/notes/process-order-rule.md +21 -0
- package/locales/en/overrides/.agents/notes/runtime-env.local.example.md +21 -0
- package/locales/en/overrides/.agents/pipelines/_TEMPLATE.md +75 -0
- package/locales/en/overrides/.agents/pipelines/pipeline-closing.md +28 -0
- package/locales/en/overrides/.agents/roles/implementer.md +28 -0
- package/locales/en/overrides/.agents/roles/independent-reviewer.md +39 -0
- package/locales/en/overrides/.agents/roles/pr-adjudicator.md +27 -0
- package/locales/en/overrides/.agents/roles/pr-finder.md +51 -0
- package/locales/en/overrides/.agents/roles/pr-verifier.md +44 -0
- package/locales/en/overrides/.agents/roles/ui-verifier.md +22 -0
- package/locales/en/overrides/.agents/roles/wiki-compiler.md +47 -0
- package/locales/en/overrides/.agents/skills/arena/SKILL.md +50 -0
- package/locales/en/overrides/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/locales/en/overrides/.agents/skills/blast-radius/SKILL.md +53 -0
- package/locales/en/overrides/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/dev-tour/SKILL.md +98 -0
- package/locales/en/overrides/.agents/skills/dream/SKILL.md +63 -0
- package/locales/en/overrides/.agents/skills/eval/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/interrogate/SKILL.md +49 -0
- package/locales/en/overrides/.agents/skills/number-vetting/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/page-refactor/SKILL.md +192 -0
- package/locales/en/overrides/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/pause-safely/SKILL.md +31 -0
- package/locales/en/overrides/.agents/skills/perf/SKILL.md +42 -0
- package/locales/en/overrides/.agents/skills/review-method/SKILL.md +92 -0
- package/locales/en/overrides/.agents/skills/session-resume/SKILL.md +69 -0
- package/locales/en/overrides/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/locales/en/overrides/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/locales/en/overrides/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/locales/en/overrides/.agents/skills/verify-ui/SKILL.md +116 -0
- package/locales/en/overrides/.agents/skills/visual-parity/SKILL.md +35 -0
- package/locales/en/overrides/.agents/skills/why/SKILL.md +56 -0
- package/locales/en/overrides/.agents/skills/wiki/SKILL.md +53 -0
- package/locales/en/overrides/.claude/agents/implementer.md +9 -0
- package/locales/en/overrides/.claude/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.claude/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.claude/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.claude/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-review.md +8 -0
- package/locales/en/overrides/.claude/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.cline/agents/implementer.yml +13 -0
- package/locales/en/overrides/.cline/agents/independent-reviewer.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-adjudicator.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-finder.yml +11 -0
- package/locales/en/overrides/.cline/agents/pr-verifier.yml +11 -0
- package/locales/en/overrides/.cline/agents/ui-verifier.yml +8 -0
- package/locales/en/overrides/.cline/agents/wiki-compiler.yml +14 -0
- package/locales/en/overrides/.cline/workflows/wf-deploy.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-maintain.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-new-task.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-pr-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-review.md +8 -0
- package/locales/en/overrides/.cline/workflows/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/CODEBUDDY.md +7 -0
- package/locales/en/overrides/.codebuddy/agents/implementer.md +9 -0
- package/locales/en/overrides/.codebuddy/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.codebuddy/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.codebuddy/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.codebuddy/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-review.md +8 -0
- package/locales/en/overrides/.codebuddy/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.codebuddy/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/locales/en/overrides/.commandcode/agents/implementer.md +10 -0
- package/locales/en/overrides/.commandcode/agents/independent-reviewer.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-adjudicator.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-finder.md +9 -0
- package/locales/en/overrides/.commandcode/agents/pr-verifier.md +9 -0
- package/locales/en/overrides/.commandcode/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.commandcode/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.commandcode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.commandcode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.opencode/agents/implementer.md +51 -0
- package/locales/en/overrides/.opencode/agents/independent-reviewer.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-adjudicator.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-finder.md +18 -0
- package/locales/en/overrides/.opencode/agents/pr-verifier.md +18 -0
- package/locales/en/overrides/.opencode/agents/ui-verifier.md +45 -0
- package/locales/en/overrides/.opencode/agents/wiki-compiler.md +51 -0
- package/locales/en/overrides/.opencode/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-review.md +7 -0
- package/locales/en/overrides/.opencode/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.pi/agents/implementer.md +11 -0
- package/locales/en/overrides/.pi/agents/independent-reviewer.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-adjudicator.md +12 -0
- package/locales/en/overrides/.pi/agents/pr-finder.md +11 -0
- package/locales/en/overrides/.pi/agents/pr-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/ui-verifier.md +11 -0
- package/locales/en/overrides/.pi/agents/wiki-compiler.md +11 -0
- package/locales/en/overrides/.qoder/agents/implementer.md +9 -0
- package/locales/en/overrides/.qoder/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qoder/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qoder/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.qoder/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-review.md +8 -0
- package/locales/en/overrides/.qoder/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.qwen/agents/implementer.md +10 -0
- package/locales/en/overrides/.qwen/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.qwen/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.qwen/agents/wiki-compiler.md +13 -0
- package/locales/en/overrides/.qwen/commands/wf-deploy.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-maintain.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-new-task.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pipeline-run.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-pr-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-review.md +7 -0
- package/locales/en/overrides/.qwen/commands/wf-stages.md +7 -0
- package/locales/en/overrides/.trae/agents/implementer.md +9 -0
- package/locales/en/overrides/.trae/agents/independent-reviewer.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-adjudicator.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-finder.md +10 -0
- package/locales/en/overrides/.trae/agents/pr-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/ui-verifier.md +10 -0
- package/locales/en/overrides/.trae/agents/wiki-compiler.md +10 -0
- package/locales/en/overrides/.trae/commands/wf-deploy.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-maintain.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-new-task.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pipeline-run.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-pr-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-review.md +8 -0
- package/locales/en/overrides/.trae/commands/wf-stages.md +8 -0
- package/locales/en/overrides/.trae/rules/backend-scope.md +5 -0
- package/locales/en/overrides/.trae/rules/frontend-scope.md +5 -0
- package/locales/en/overrides/.zcode/agents/implementer.md +8 -0
- package/locales/en/overrides/.zcode/agents/independent-reviewer.md +8 -0
- package/locales/en/overrides/.zcode/agents/ui-verifier.md +8 -0
- package/locales/en/overrides/.zcode/agents/wiki-compiler.md +8 -0
- package/locales/en/overrides/AGENTS.md +52 -0
- package/locales/en/overrides/CLAUDE.md +20 -0
- package/locales/en/overrides/wiki/INDEX.md +33 -0
- package/locales/en/overrides/wiki/drafts-archive/README.md +6 -0
- package/locales/en/overrides/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/locales/en/overrides/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/locales/en/overrides/workflow/INDEX.md +13 -0
- package/locales/en/overrides/workflow/README.md +67 -0
- package/locales/en/overrides/workflow/archive/README.md +3 -0
- package/locales/en/overrides/workflow/delegations.md +4 -0
- package/locales/en/overrides/workflow/effective-policy.md +4 -0
- package/locales/en/overrides/workflow/gate-cost.md +4 -0
- package/locales/en/overrides/workflow/incidents/_TEMPLATE.md +49 -0
- package/locales/en/overrides/workflow/intents/_TEMPLATE.md +43 -0
- package/locales/en/overrides/workflow/metrics.md +4 -0
- package/locales/en/overrides/workflow/papercuts.md +3 -0
- package/locales/en/overrides/workflow/plans/_TEMPLATE.md +47 -0
- package/locales/en/overrides/workflow/regression-checklist.md +3 -0
- package/locales/en/overrides/workflow/specs/_TEMPLATE.md +86 -0
- package/locales/en/overrides/workflow/verify-evidence.md +4 -0
- package/locales/zh-CN/installer.json +25 -0
- package/package.json +23 -36
- package/schemas/install-manifest.schema.json +24 -0
- package/schemas/project-profile.schema.json +28 -0
- package/src/cli/args.mjs +41 -0
- package/src/cli/main.mjs +72 -0
- package/src/commands/add-host.mjs +29 -0
- package/src/commands/doctor.mjs +80 -0
- package/src/commands/install.mjs +149 -0
- package/src/commands/upgrade.mjs +30 -0
- package/src/git/config.mjs +61 -0
- package/src/hosts/registry.mjs +26 -0
- package/src/i18n.mjs +32 -0
- package/src/install/apply.mjs +124 -0
- package/src/install/manifest.mjs +40 -0
- package/src/install/plan.mjs +83 -0
- package/src/render/tokens.mjs +58 -0
- package/templates/engine/.agents/board/dev-tour.html +1940 -0
- package/templates/engine/.agents/board/index.html +835 -0
- package/templates/engine/.agents/commands/deploy.md +52 -0
- package/templates/engine/.agents/commands/maintain.md +76 -0
- package/templates/engine/.agents/commands/new-task.md +89 -0
- package/templates/engine/.agents/commands/pipeline-run.md +56 -0
- package/templates/engine/.agents/commands/pr-review.md +30 -0
- package/templates/engine/.agents/commands/review.md +93 -0
- package/templates/engine/.agents/commands/stages.md +256 -0
- package/templates/engine/.agents/config/commit-msg-rules.json +7 -0
- package/templates/engine/.agents/config/engine.json +11 -0
- package/templates/engine/.agents/config/gate-budgets.json +5 -0
- package/templates/engine/.agents/config/mechanism-registry.md +62 -0
- package/templates/engine/.agents/config/model-roles.json +26 -0
- package/templates/engine/.agents/config/model-roles.local.example.json +7 -0
- package/templates/engine/.agents/config/pr-review.json +67 -0
- package/templates/engine/.agents/config/principles.md +32 -0
- package/templates/engine/.agents/config/workflow-enums.txt +25 -0
- package/templates/engine/.agents/hooks/check-architecture.mjs +168 -0
- package/templates/engine/.agents/hooks/check-audit-fields.mjs +56 -0
- package/templates/engine/.agents/hooks/check-commit-plan-ref.mjs +84 -0
- package/templates/engine/.agents/hooks/check-confirm-order.mjs +281 -0
- package/templates/engine/.agents/hooks/check-delete-guard.mjs +63 -0
- package/templates/engine/.agents/hooks/check-notify-guard.mjs +55 -0
- package/templates/engine/.agents/hooks/commit-check.cjs +208 -0
- package/templates/engine/.agents/hooks/gates.json +33 -0
- package/templates/engine/.agents/hooks/local-pre-commit.mjs +27 -0
- package/templates/engine/.agents/hooks/pre-shell-check.cjs +361 -0
- package/templates/engine/.agents/hooks/pre-write-check.cjs +220 -0
- package/templates/engine/.agents/notes/gate-diet.md +75 -0
- package/templates/engine/.agents/notes/pr-review-cost-discipline.md +48 -0
- package/templates/engine/.agents/notes/process-order-rule.md +21 -0
- package/templates/engine/.agents/notes/runtime-env.local.example.md +21 -0
- package/templates/engine/.agents/pipelines/_TEMPLATE.md +75 -0
- package/templates/engine/.agents/pipelines/pipeline-closing.md +28 -0
- package/templates/engine/.agents/pipelines//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +16 -0
- package/templates/engine/.agents/roles/implementer.md +28 -0
- package/templates/engine/.agents/roles/independent-reviewer.md +39 -0
- package/templates/engine/.agents/roles/pr-adjudicator.md +27 -0
- package/templates/engine/.agents/roles/pr-finder.md +51 -0
- package/templates/engine/.agents/roles/pr-verifier.md +44 -0
- package/templates/engine/.agents/roles/ui-verifier.md +22 -0
- package/templates/engine/.agents/roles/wiki-compiler.md +47 -0
- package/templates/engine/.agents/scripts/agg-delegations.mjs +439 -0
- package/templates/engine/.agents/scripts/agg-judgments.mjs +301 -0
- package/templates/engine/.agents/scripts/agg-kb-usage.mjs +196 -0
- package/templates/engine/.agents/scripts/append-compensation.mjs +109 -0
- package/templates/engine/.agents/scripts/archive-sweep.mjs +229 -0
- package/templates/engine/.agents/scripts/auto-tour.mjs +77 -0
- package/templates/engine/.agents/scripts/board-port.mjs +17 -0
- package/templates/engine/.agents/scripts/check-doc-body-drift.mjs +102 -0
- package/templates/engine/.agents/scripts/check-engine-artifacts.mjs +54 -0
- package/templates/engine/.agents/scripts/check-hook-wiring.mjs +75 -0
- package/templates/engine/.agents/scripts/check-lane-surface.mjs +393 -0
- package/templates/engine/.agents/scripts/check-ledger-doc-presence.mjs +71 -0
- package/templates/engine/.agents/scripts/check-ledger-invariant.mjs +873 -0
- package/templates/engine/.agents/scripts/check-local-gate-config.mjs +95 -0
- package/templates/engine/.agents/scripts/check-local-gates.mjs +248 -0
- package/templates/engine/.agents/scripts/check-loop-kit.mjs +550 -0
- package/templates/engine/.agents/scripts/check-loop-rev-semantics.mjs +59 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s01-pairing.mjs +116 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s03x-regr-evidence.mjs +38 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s08-acceptance.mjs +130 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s15-fingerprint.mjs +152 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s23-convergence-audit.mjs +182 -0
- package/templates/engine/.agents/scripts/check-loop-sections/s29-regr-enforcer.mjs +69 -0
- package/templates/engine/.agents/scripts/check-loop.mjs +131 -0
- package/templates/engine/.agents/scripts/check-regression-consistency.mjs +252 -0
- package/templates/engine/.agents/scripts/check-schema-residue.mjs +144 -0
- package/templates/engine/.agents/scripts/check-scope-range.mjs +156 -0
- package/templates/engine/.agents/scripts/check-scope.mjs +121 -0
- package/templates/engine/.agents/scripts/check-scripts-syntax.mjs +138 -0
- package/templates/engine/.agents/scripts/check-secrets-lite.mjs +239 -0
- package/templates/engine/.agents/scripts/check-secrets.mjs +104 -0
- package/templates/engine/.agents/scripts/check-test-impact-map.mjs +107 -0
- package/templates/engine/.agents/scripts/ci-assert-frontend-deps.mjs +42 -0
- package/templates/engine/.agents/scripts/ci-commit-hygiene.mjs +86 -0
- package/templates/engine/.agents/scripts/ci-install-gitleaks.mjs +75 -0
- package/templates/engine/.agents/scripts/ci-push-before.mjs +49 -0
- package/templates/engine/.agents/scripts/closeout.mjs +127 -0
- package/templates/engine/.agents/scripts/compact-ledgers.mjs +70 -0
- package/templates/engine/.agents/scripts/confirm-doc.mjs +737 -0
- package/templates/engine/.agents/scripts/delegation-presence.mjs +38 -0
- package/templates/engine/.agents/scripts/dev-tour-model.mjs +1398 -0
- package/templates/engine/.agents/scripts/dream-run.mjs +283 -0
- package/templates/engine/.agents/scripts/ensure-board.mjs +187 -0
- package/templates/engine/.agents/scripts/failure-attribution.mjs +11 -0
- package/templates/engine/.agents/scripts/fill-intent.mjs +60 -0
- package/templates/engine/.agents/scripts/fill-plan.mjs +105 -0
- package/templates/engine/.agents/scripts/fill-spec.mjs +72 -0
- package/templates/engine/.agents/scripts/gen-dev-tour.mjs +191 -0
- package/templates/engine/.agents/scripts/gen-effective-policy.mjs +113 -0
- package/templates/engine/.agents/scripts/gen-engine-map.mjs +292 -0
- package/templates/engine/.agents/scripts/gen-narrative-claims.mjs +275 -0
- package/templates/engine/.agents/scripts/gen-verify-evidence.mjs +115 -0
- package/templates/engine/.agents/scripts/gen-wiki-board.mjs +221 -0
- package/templates/engine/.agents/scripts/gen-workflow-index.mjs +201 -0
- package/templates/engine/.agents/scripts/gen-workflow-metrics.mjs +692 -0
- package/templates/engine/.agents/scripts/git-merge-jsonl.mjs +62 -0
- package/templates/engine/.agents/scripts/judgment-ledger.mjs +68 -0
- package/templates/engine/.agents/scripts/kb-cache-evict.mjs +50 -0
- package/templates/engine/.agents/scripts/kb-search.mjs +423 -0
- package/templates/engine/.agents/scripts/lane-surface-audit.mjs +145 -0
- package/templates/engine/.agents/scripts/ledger-loader.mjs +77 -0
- package/templates/engine/.agents/scripts/ledger-shards.mjs +346 -0
- package/templates/engine/.agents/scripts/metrics-core.mjs +131 -0
- package/templates/engine/.agents/scripts/pipeline-run.mjs +964 -0
- package/templates/engine/.agents/scripts/policy.mjs +250 -0
- package/templates/engine/.agents/scripts/pr-create.mjs +54 -0
- package/templates/engine/.agents/scripts/pr-review.mjs +1551 -0
- package/templates/engine/.agents/scripts/quote-grounding.mjs +233 -0
- package/templates/engine/.agents/scripts/regen-ledgers.mjs +59 -0
- package/templates/engine/.agents/scripts/rewrite-file.mjs +135 -0
- package/templates/engine/.agents/scripts/rule-budget.mjs +246 -0
- package/templates/engine/.agents/scripts/stage-gates.mjs +812 -0
- package/templates/engine/.agents/scripts/test-impact-lib.mjs +451 -0
- package/templates/engine/.agents/scripts/test-impact.mjs +105 -0
- package/templates/engine/.agents/scripts/trust-mode.mjs +130 -0
- package/templates/engine/.agents/scripts/verify-scope.mjs +163 -0
- package/templates/engine/.agents/scripts/verify-wiki-consistency.mjs +264 -0
- package/templates/engine/.agents/scripts/verify.mjs +847 -0
- package/templates/engine/.agents/scripts/warn-format.mjs +57 -0
- package/templates/engine/.agents/scripts/wf-journal.mjs +230 -0
- package/templates/engine/.agents/scripts/workflow-board-server.mjs +696 -0
- package/templates/engine/.agents/scripts/workflow-enums.mjs +70 -0
- package/templates/engine/.agents/scripts/workflows-check.mjs +260 -0
- package/templates/engine/.agents/settings.json +33 -0
- package/templates/engine/.agents/skills/arena/SKILL.md +50 -0
- package/templates/engine/.agents/skills/autonomous-run/SKILL.md +45 -0
- package/templates/engine/.agents/skills/blast-radius/SKILL.md +53 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/SKILL.md +109 -0
- package/templates/engine/.agents/skills/csharp-quality-gates/scripts/quality-gates.mjs +430 -0
- package/templates/engine/.agents/skills/dev-tour/SKILL.md +98 -0
- package/templates/engine/.agents/skills/dream/SKILL.md +63 -0
- package/templates/engine/.agents/skills/eval/SKILL.md +42 -0
- package/templates/engine/.agents/skills/eval/scripts/eval-score.mjs +59 -0
- package/templates/engine/.agents/skills/interrogate/SKILL.md +49 -0
- package/templates/engine/.agents/skills/interrogate/scripts/interrogate-plan.mjs +72 -0
- package/templates/engine/.agents/skills/number-vetting/SKILL.md +35 -0
- package/templates/engine/.agents/skills/page-refactor/SKILL.md +192 -0
- package/templates/engine/.agents/skills/page-refactor/references/templates.md +989 -0
- package/templates/engine/.agents/skills/papercut-fix/SKILL.md +92 -0
- package/templates/engine/.agents/skills/papercut-fix/references/response-template.md +81 -0
- package/templates/engine/.agents/skills/pause-safely/SKILL.md +31 -0
- package/templates/engine/.agents/skills/perf/SKILL.md +42 -0
- package/templates/engine/.agents/skills/review-method/SKILL.md +92 -0
- package/templates/engine/.agents/skills/review-method/golden-set.md +61 -0
- package/templates/engine/.agents/skills/session-resume/SKILL.md +69 -0
- package/templates/engine/.agents/skills/session-resume/scripts/worktree-audit.mjs +110 -0
- package/templates/engine/.agents/skills/shipyard-workflow-closeout/SKILL.md +109 -0
- package/templates/engine/.agents/skills/show-me-your-work/SKILL.md +57 -0
- package/templates/engine/.agents/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/templates/engine/.agents/skills/show-me-your-work/scripts/decision-log.mjs +24 -0
- package/templates/engine/.agents/skills/tfs-pr/SKILL.md +95 -0
- package/templates/engine/.agents/skills/tfs-pr/scripts/tfs-pr.mjs +947 -0
- package/templates/engine/.agents/skills/verify-ui/SKILL.md +116 -0
- package/templates/engine/.agents/skills/verify-ui/features/.gitkeep +0 -0
- package/templates/engine/.agents/skills/verify-ui/scripts/gen-verify-feature.mjs +114 -0
- package/templates/engine/.agents/skills/visual-parity/SKILL.md +35 -0
- package/templates/engine/.agents/skills/why/SKILL.md +56 -0
- package/templates/engine/.agents/skills/why/scripts/why-evidence.mjs +74 -0
- package/templates/engine/.agents/skills/wiki/SKILL.md +53 -0
- package/templates/engine/.agents/tests/auto-tour.test.mjs +82 -0
- package/templates/engine/.agents/tests/dev-tour-model.test.mjs +452 -0
- package/templates/engine/.agents/tests/fill-plan-lite.test.mjs +46 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.md +14 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-bare-mid-path.model.json +179 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.md +21 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-fake-path-guard.model.json +194 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.md +20 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-h3-batches.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-issues.model.json +225 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.md +15 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-l1-single-file.model.json +160 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layer-word-unique.model.json +266 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.md +17 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-layers-fallback.model.json +207 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-numbered-steps.model.json +359 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.md +16 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-path-guess.model.json +131 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.md +29 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-table-rows.model.json +190 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.md +39 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-task-checkboxes.model.json +362 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.md +24 -0
- package/templates/engine/.agents/tests/fixtures/dev-tour/plan-union-label.model.json +224 -0
- package/templates/engine/.agents/tests/tools/gen-synthetic-plan.mjs +108 -0
- package/templates/git/.gitattributes +22 -0
- package/templates/git/.githooks/commit-msg +72 -0
- package/templates/git/.githooks/post-commit +62 -0
- package/templates/git/.githooks/pre-commit +197 -0
- package/templates/git/.githooks/pre-merge-commit +28 -0
- package/templates/git/.githooks/pre-push +201 -0
- package/templates/git/.gitignore.engine +11 -0
- package/templates/hosts/claude/CLAUDE.md +55 -0
- package/templates/hosts/claude/agents/implementer.md +7 -0
- package/templates/hosts/claude/agents/independent-reviewer.md +8 -0
- package/templates/hosts/claude/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/claude/agents/pr-finder.md +8 -0
- package/templates/hosts/claude/agents/pr-verifier.md +8 -0
- package/templates/hosts/claude/agents/ui-verifier.md +8 -0
- package/templates/hosts/claude/agents/wiki-compiler.md +8 -0
- package/templates/hosts/claude/commands/wf-deploy.md +10 -0
- package/templates/hosts/claude/commands/wf-maintain.md +10 -0
- package/templates/hosts/claude/commands/wf-new-task.md +10 -0
- package/templates/hosts/claude/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/claude/commands/wf-pr-review.md +10 -0
- package/templates/hosts/claude/commands/wf-review.md +10 -0
- package/templates/hosts/claude/commands/wf-stages.md +10 -0
- package/templates/hosts/claude/settings.json +57 -0
- package/templates/hosts/cline/agents/implementer.yml +15 -0
- package/templates/hosts/cline/agents/independent-reviewer.yml +20 -0
- package/templates/hosts/cline/agents/pr-adjudicator.yml +18 -0
- package/templates/hosts/cline/agents/pr-finder.yml +19 -0
- package/templates/hosts/cline/agents/pr-verifier.yml +18 -0
- package/templates/hosts/cline/agents/ui-verifier.yml +17 -0
- package/templates/hosts/cline/agents/wiki-compiler.yml +20 -0
- package/templates/hosts/cline/hooks/PreToolUse.cjs +260 -0
- package/templates/hosts/cline/workflows/wf-deploy.md +8 -0
- package/templates/hosts/cline/workflows/wf-maintain.md +8 -0
- package/templates/hosts/cline/workflows/wf-new-task.md +8 -0
- package/templates/hosts/cline/workflows/wf-pipeline-run.md +8 -0
- package/templates/hosts/cline/workflows/wf-pr-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-review.md +8 -0
- package/templates/hosts/cline/workflows/wf-stages.md +8 -0
- package/templates/hosts/codebuddy/CODEBUDDY.md +7 -0
- package/templates/hosts/codebuddy/agents/implementer.md +9 -0
- package/templates/hosts/codebuddy/agents/independent-reviewer.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-finder.md +10 -0
- package/templates/hosts/codebuddy/agents/pr-verifier.md +10 -0
- package/templates/hosts/codebuddy/agents/ui-verifier.md +11 -0
- package/templates/hosts/codebuddy/agents/wiki-compiler.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-deploy.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-maintain.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-new-task.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pipeline-run.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-pr-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-review.md +10 -0
- package/templates/hosts/codebuddy/commands/wf-stages.md +10 -0
- package/templates/hosts/codebuddy/rules/backend-scope.md +5 -0
- package/templates/hosts/codebuddy/rules/frontend-scope.md +5 -0
- package/templates/hosts/codebuddy/settings.json +31 -0
- package/templates/hosts/codebuddy/skills/tfs-pr/SKILL.md +6 -0
- package/templates/hosts/commandcode/agents/implementer.md +10 -0
- package/templates/hosts/commandcode/agents/independent-reviewer.md +9 -0
- package/templates/hosts/commandcode/agents/pr-adjudicator.md +9 -0
- package/templates/hosts/commandcode/agents/pr-finder.md +9 -0
- package/templates/hosts/commandcode/agents/pr-verifier.md +9 -0
- package/templates/hosts/commandcode/agents/ui-verifier.md +11 -0
- package/templates/hosts/commandcode/agents/wiki-compiler.md +10 -0
- package/templates/hosts/commandcode/commands/wf-deploy.md +9 -0
- package/templates/hosts/commandcode/commands/wf-maintain.md +9 -0
- package/templates/hosts/commandcode/commands/wf-new-task.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/commandcode/commands/wf-pr-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-review.md +9 -0
- package/templates/hosts/commandcode/commands/wf-stages.md +9 -0
- package/templates/hosts/commandcode/settings.json +59 -0
- package/templates/hosts/opencode/agents/implementer.md +51 -0
- package/templates/hosts/opencode/agents/independent-reviewer.md +18 -0
- package/templates/hosts/opencode/agents/pr-adjudicator.md +18 -0
- package/templates/hosts/opencode/agents/pr-finder.md +18 -0
- package/templates/hosts/opencode/agents/pr-verifier.md +18 -0
- package/templates/hosts/opencode/agents/ui-verifier.md +45 -0
- package/templates/hosts/opencode/agents/wiki-compiler.md +51 -0
- package/templates/hosts/opencode/commands/wf-deploy.md +7 -0
- package/templates/hosts/opencode/commands/wf-maintain.md +7 -0
- package/templates/hosts/opencode/commands/wf-new-task.md +7 -0
- package/templates/hosts/opencode/commands/wf-pipeline-run.md +7 -0
- package/templates/hosts/opencode/commands/wf-pr-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-review.md +7 -0
- package/templates/hosts/opencode/commands/wf-stages.md +7 -0
- package/templates/hosts/pi/agents/implementer.md +10 -0
- package/templates/hosts/pi/agents/independent-reviewer.md +11 -0
- package/templates/hosts/pi/agents/pr-adjudicator.md +11 -0
- package/templates/hosts/pi/agents/pr-finder.md +10 -0
- package/templates/hosts/pi/agents/pr-verifier.md +10 -0
- package/templates/hosts/pi/agents/ui-verifier.md +10 -0
- package/templates/hosts/pi/agents/wiki-compiler.md +10 -0
- package/templates/hosts/pi/extensions/lib/gates-core.cjs +196 -0
- package/templates/hosts/pi/extensions/shipyard-gates.ts +95 -0
- package/templates/hosts/pi/settings.json +5 -0
- package/templates/hosts/qoder/agents/implementer.md +9 -0
- package/templates/hosts/qoder/agents/independent-reviewer.md +10 -0
- package/templates/hosts/qoder/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/qoder/agents/pr-finder.md +10 -0
- package/templates/hosts/qoder/agents/pr-verifier.md +10 -0
- package/templates/hosts/qoder/agents/ui-verifier.md +10 -0
- package/templates/hosts/qoder/agents/wiki-compiler.md +10 -0
- package/templates/hosts/qoder/commands/wf-deploy.md +8 -0
- package/templates/hosts/qoder/commands/wf-maintain.md +8 -0
- package/templates/hosts/qoder/commands/wf-new-task.md +8 -0
- package/templates/hosts/qoder/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/qoder/commands/wf-pr-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-review.md +8 -0
- package/templates/hosts/qoder/commands/wf-stages.md +8 -0
- package/templates/hosts/qoder/settings.json +63 -0
- package/templates/hosts/qwen/agents/implementer.md +8 -0
- package/templates/hosts/qwen/agents/independent-reviewer.md +8 -0
- package/templates/hosts/qwen/agents/pr-adjudicator.md +8 -0
- package/templates/hosts/qwen/agents/pr-finder.md +8 -0
- package/templates/hosts/qwen/agents/pr-verifier.md +8 -0
- package/templates/hosts/qwen/agents/ui-verifier.md +8 -0
- package/templates/hosts/qwen/agents/wiki-compiler.md +11 -0
- package/templates/hosts/qwen/commands/wf-deploy.md +9 -0
- package/templates/hosts/qwen/commands/wf-maintain.md +9 -0
- package/templates/hosts/qwen/commands/wf-new-task.md +9 -0
- package/templates/hosts/qwen/commands/wf-pipeline-run.md +9 -0
- package/templates/hosts/qwen/commands/wf-pr-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-review.md +9 -0
- package/templates/hosts/qwen/commands/wf-stages.md +9 -0
- package/templates/hosts/qwen/settings.json +59 -0
- package/templates/hosts/trae/agents/implementer.md +9 -0
- package/templates/hosts/trae/agents/independent-reviewer.md +10 -0
- package/templates/hosts/trae/agents/pr-adjudicator.md +10 -0
- package/templates/hosts/trae/agents/pr-finder.md +10 -0
- package/templates/hosts/trae/agents/pr-verifier.md +10 -0
- package/templates/hosts/trae/agents/ui-verifier.md +10 -0
- package/templates/hosts/trae/agents/wiki-compiler.md +10 -0
- package/templates/hosts/trae/commands/wf-deploy.md +8 -0
- package/templates/hosts/trae/commands/wf-maintain.md +8 -0
- package/templates/hosts/trae/commands/wf-new-task.md +8 -0
- package/templates/hosts/trae/commands/wf-pipeline-run.md +8 -0
- package/templates/hosts/trae/commands/wf-pr-review.md +8 -0
- package/templates/hosts/trae/commands/wf-review.md +8 -0
- package/templates/hosts/trae/commands/wf-stages.md +8 -0
- package/templates/hosts/trae/hooks.json +17 -0
- package/templates/hosts/trae/rules/backend-scope.md +5 -0
- package/templates/hosts/trae/rules/frontend-scope.md +5 -0
- package/templates/hosts/zcode/agents/implementer.md +8 -0
- package/templates/hosts/zcode/agents/independent-reviewer.md +8 -0
- package/templates/hosts/zcode/agents/ui-verifier.md +8 -0
- package/templates/hosts/zcode/agents/wiki-compiler.md +8 -0
- package/templates/hosts/zcode/config.json +31 -0
- package/templates/hosts/zcode/workflows/code-review.dwf.ts +428 -0
- package/templates/hosts/zcode/workflows/fullchain-flow-test.dwf.ts +898 -0
- package/templates/profiles/dotnet/.agents/config/lane-surfaces.txt +33 -0
- package/templates/profiles/dotnet/.agents/config/rule-budgets.txt +84 -0
- package/templates/profiles/dotnet/.agents/config/test-impact-map.json +590 -0
- package/templates/profiles/dotnet/.agents/config/workflow-modules.txt +18 -0
- package/templates/profiles/dotnet/.agents/hooks/commit-check.config.json +18 -0
- package/templates/profiles/dotnet/.agents/hooks/delete-guard-allowlist.txt +28 -0
- package/templates/profiles/dotnet/.agents/notes/runtime-env.md +178 -0
- package/templates/profiles/dotnet/AGENTS.md +52 -0
- package/templates/profiles/empty/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/empty/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/empty/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/empty/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/empty/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/empty/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/empty/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/empty/AGENTS.md +52 -0
- package/templates/profiles/node/.agents/config/lane-surfaces.txt +12 -0
- package/templates/profiles/node/.agents/config/rule-budgets.txt +3 -0
- package/templates/profiles/node/.agents/config/test-impact-map.json +8 -0
- package/templates/profiles/node/.agents/config/workflow-modules.txt +2 -0
- package/templates/profiles/node/.agents/hooks/commit-check.config.json +5 -0
- package/templates/profiles/node/.agents/hooks/delete-guard-allowlist.txt +2 -0
- package/templates/profiles/node/.agents/notes/runtime-env.md +44 -0
- package/templates/profiles/node/AGENTS.md +52 -0
- package/templates/scaffold/wiki/INDEX.md +33 -0
- package/templates/scaffold/wiki/drafts-archive/README.md +7 -0
- package/templates/scaffold/wiki//344/272/247/345/223/201/351/234/200/346/261/202/.gitkeep +0 -0
- package/templates/scaffold/wiki//345/274/200/345/217/221/346/226/271/346/241/210/.gitkeep +0 -0
- package/templates/scaffold/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +22 -0
- package/templates/scaffold/wiki//346/265/213/350/257/225/346/212/245/345/221/212/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/224/250/346/210/267/345/212/237/350/203/275/.gitkeep +0 -0
- package/templates/scaffold/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +230 -0
- package/templates/scaffold/wiki//351/241/271/347/233/256/350/247/204/350/214/203/.gitkeep +0 -0
- package/templates/scaffold/workflow/INDEX.md +13 -0
- package/templates/scaffold/workflow/README.md +67 -0
- package/templates/scaffold/workflow/archive/README.md +3 -0
- package/templates/scaffold/workflow/delegations.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/delegations.md +4 -0
- package/templates/scaffold/workflow/effective-policy.md +4 -0
- package/templates/scaffold/workflow/evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/gate-cost.md +4 -0
- package/templates/scaffold/workflow/gate-metrics.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/incidents/_TEMPLATE.md +49 -0
- package/templates/scaffold/workflow/intents/_TEMPLATE.md +43 -0
- package/templates/scaffold/workflow/metrics.md +4 -0
- package/templates/scaffold/workflow/papercuts.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/papercuts.md +3 -0
- package/templates/scaffold/workflow/plans/_TEMPLATE.md +47 -0
- package/templates/scaffold/workflow/regression-checklist.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/regression-checklist.md +3 -0
- package/templates/scaffold/workflow/research/.gitkeep +0 -0
- package/templates/scaffold/workflow/reviews.d/.gitkeep +0 -0
- package/templates/scaffold/workflow/specs/_TEMPLATE.md +87 -0
- package/templates/scaffold/workflow/verify-evidence/.gitkeep +0 -0
- package/templates/scaffold/workflow/verify-evidence.md +4 -0
- package/LICENSE +0 -21
- package/modules/gates/README.md +0 -25
- package/modules/gates/dotnet-ca/README.md +0 -24
- package/modules/gates/dotnet-ca/check-architecture.sh +0 -150
- package/modules/gates/dotnet-ca/local-pre-commit.line +0 -1
- package/modules/gates/generated-readonly/README.md +0 -13
- package/modules/gates/generated-readonly/check-generated.mjs +0 -61
- package/modules/gates/generated-readonly/local-pre-commit.line +0 -1
- package/modules/gates/node-layer/README.md +0 -9
- package/modules/gates/node-layer/check-node-layer.mjs +0 -29
- package/modules/gates/node-layer/local-pre-commit.line +0 -1
- package/modules/gates/py-import/README.md +0 -9
- package/modules/gates/py-import/check-py-import.mjs +0 -30
- package/modules/gates/py-import/local-pre-commit.line +0 -1
- package/modules/gates/test-protect/README.md +0 -23
- package/modules/gates/test-protect/check-test-protect.mjs +0 -64
- package/modules/gates/test-protect/local-pre-commit.line +0 -1
- package/modules/hosts/README.md +0 -57
- package/modules/hosts/claude/agents/implementer.md +0 -51
- package/modules/hosts/claude/agents/independent-reviewer.md +0 -49
- package/modules/hosts/claude/agents/ui-verifier.md +0 -48
- package/modules/hosts/claude/commands/wf-build.md +0 -69
- package/modules/hosts/claude/commands/wf-deploy.md +0 -58
- package/modules/hosts/claude/commands/wf-design.md +0 -49
- package/modules/hosts/claude/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/claude/commands/wf-maintain.md +0 -76
- package/modules/hosts/claude/commands/wf-new-task.md +0 -102
- package/modules/hosts/claude/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/claude/commands/wf-plan.md +0 -40
- package/modules/hosts/claude/commands/wf-review.md +0 -49
- package/modules/hosts/claude/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/claude/commands/wf-test.md +0 -68
- package/modules/hosts/codex/agents/implementer.md +0 -51
- package/modules/hosts/codex/agents/independent-reviewer.md +0 -49
- package/modules/hosts/codex/agents/ui-verifier.md +0 -48
- package/modules/hosts/codex/commands/wf-build.md +0 -69
- package/modules/hosts/codex/commands/wf-deploy.md +0 -58
- package/modules/hosts/codex/commands/wf-design.md +0 -49
- package/modules/hosts/codex/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/codex/commands/wf-maintain.md +0 -76
- package/modules/hosts/codex/commands/wf-new-task.md +0 -102
- package/modules/hosts/codex/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/codex/commands/wf-plan.md +0 -40
- package/modules/hosts/codex/commands/wf-review.md +0 -49
- package/modules/hosts/codex/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/codex/commands/wf-test.md +0 -68
- package/modules/hosts/codex/skills/flow-kit/SKILL.md +0 -14
- package/modules/hosts/cursor/agents/implementer.md +0 -51
- package/modules/hosts/cursor/agents/independent-reviewer.md +0 -49
- package/modules/hosts/cursor/agents/ui-verifier.md +0 -48
- package/modules/hosts/cursor/commands/wf-build.md +0 -69
- package/modules/hosts/cursor/commands/wf-deploy.md +0 -58
- package/modules/hosts/cursor/commands/wf-design.md +0 -49
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/cursor/commands/wf-maintain.md +0 -76
- package/modules/hosts/cursor/commands/wf-new-task.md +0 -102
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/cursor/commands/wf-plan.md +0 -40
- package/modules/hosts/cursor/commands/wf-review.md +0 -49
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/cursor/commands/wf-test.md +0 -68
- package/modules/hosts/omp/agents/implementer.md +0 -52
- package/modules/hosts/omp/agents/independent-reviewer.md +0 -50
- package/modules/hosts/omp/agents/ui-verifier.md +0 -49
- package/modules/hosts/opencode/agents/implementer.md +0 -59
- package/modules/hosts/opencode/agents/independent-reviewer.md +0 -53
- package/modules/hosts/opencode/agents/ui-verifier.md +0 -52
- package/modules/hosts/opencode/commands/wf-build.md +0 -69
- package/modules/hosts/opencode/commands/wf-deploy.md +0 -58
- package/modules/hosts/opencode/commands/wf-design.md +0 -49
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +0 -77
- package/modules/hosts/opencode/commands/wf-maintain.md +0 -76
- package/modules/hosts/opencode/commands/wf-new-task.md +0 -102
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +0 -35
- package/modules/hosts/opencode/commands/wf-plan.md +0 -40
- package/modules/hosts/opencode/commands/wf-review.md +0 -49
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +0 -64
- package/modules/hosts/opencode/commands/wf-test.md +0 -68
- package/modules/hosts/trae/agents/implementer.md +0 -52
- package/modules/hosts/trae/agents/independent-reviewer.md +0 -51
- package/modules/hosts/trae/agents/ui-verifier.md +0 -50
- package/modules/hosts/trae/commands/wf-build.md +0 -70
- package/modules/hosts/trae/commands/wf-deploy.md +0 -59
- package/modules/hosts/trae/commands/wf-design.md +0 -50
- package/modules/hosts/trae/commands/wf-gate-checklist.md +0 -78
- package/modules/hosts/trae/commands/wf-maintain.md +0 -77
- package/modules/hosts/trae/commands/wf-new-task.md +0 -103
- package/modules/hosts/trae/commands/wf-pipeline-run.md +0 -36
- package/modules/hosts/trae/commands/wf-plan.md +0 -41
- package/modules/hosts/trae/commands/wf-review.md +0 -50
- package/modules/hosts/trae/commands/wf-sync-hosts.md +0 -65
- package/modules/hosts/trae/commands/wf-test.md +0 -69
- package/modules/hosts/trae/hooks/post-edit-check.cjs +0 -98
- package/modules/hosts/trae/hooks/pre-shell-check.cjs +0 -192
- package/modules/hosts/trae/hooks/resolve-shell.cjs +0 -30
- package/modules/hosts/trae/hooks.json +0 -29
- package/modules/hosts/trae/rules/beautify-input-chinese.md +0 -6
- package/modules/hosts/trae/rules/git-commit-message.md +0 -10
- package/modules/hosts/trae/rules/project-workflow.md +0 -14
- package/modules/hosts/zcode/agents/implementer.md +0 -51
- package/modules/hosts/zcode/agents/independent-reviewer.md +0 -49
- package/modules/hosts/zcode/agents/ui-verifier.md +0 -48
- package/src/add-gate.mjs +0 -116
- package/src/add-gate.test.mjs +0 -103
- package/src/add-host.mjs +0 -68
- package/src/cli.mjs +0 -169
- package/src/doctor.mjs +0 -629
- package/src/executor.mjs +0 -262
- package/src/executor.test.mjs +0 -295
- package/src/fresh-init.test.mjs +0 -64
- package/src/gate-dotnet-ca.test.mjs +0 -124
- package/src/gates.test.mjs +0 -143
- package/src/init.mjs +0 -382
- package/src/init.test.mjs +0 -163
- package/src/instance-ref.test.mjs +0 -62
- package/src/jscpd-drift.test.mjs +0 -144
- package/src/pack.test.mjs +0 -24
- package/src/profiles.mjs +0 -183
- package/src/render.mjs +0 -132
- package/src/rule-budget.test.mjs +0 -103
- package/src/run-tests.mjs +0 -56
- package/src/stack-profile.test.mjs +0 -95
- package/src/sync-hosts.mjs +0 -257
- package/src/sync-hosts.test.mjs +0 -291
- package/src/sync.mjs +0 -228
- package/src/sync.test.mjs +0 -452
- package/src/trae-hooks.test.mjs +0 -127
- package/src/validate.mjs +0 -77
- package/src/validate.test.mjs +0 -95
- package/templates/.gitattributes +0 -17
- package/templates/AGENTS.md +0 -57
- package/templates/_agents/board/index.html +0 -676
- package/templates/_agents/commands/build.md +0 -84
- package/templates/_agents/commands/deploy.md +0 -66
- package/templates/_agents/commands/design.md +0 -63
- package/templates/_agents/commands/gate-checklist.md +0 -91
- package/templates/_agents/commands/maintain.md +0 -90
- package/templates/_agents/commands/new-task.md +0 -110
- package/templates/_agents/commands/pipeline-run.md +0 -43
- package/templates/_agents/commands/plan.md +0 -48
- package/templates/_agents/commands/review.md +0 -62
- package/templates/_agents/commands/sync-hosts.md +0 -77
- package/templates/_agents/commands/test.md +0 -87
- package/templates/_agents/control-surfaces.txt +0 -53
- package/templates/_agents/engine-lock.json +0 -342
- package/templates/_agents/hooks/check-index-incremental.mjs +0 -48
- package/templates/_agents/hooks/check-pairing-incremental.mjs +0 -66
- package/templates/_agents/hooks/check-wiki-ledger.mjs +0 -30
- package/templates/_agents/hooks/commit-check.cjs +0 -193
- package/templates/_agents/hooks/local-pre-commit +0 -6
- package/templates/_agents/lane-surfaces.txt +0 -17
- package/templates/_agents/level-hints.txt +0 -30
- package/templates/_agents/loop/papercut-debt/DESIGN.md +0 -112
- package/templates/_agents/mechanism-registry.md +0 -27
- package/templates/_agents/metric-claims.txt +0 -81
- package/templates/_agents/notes/engine-internals.md +0 -17
- package/templates/_agents/notes/runtime-env.md +0 -18
- package/templates/_agents/roles/implementer.md +0 -47
- package/templates/_agents/roles/independent-reviewer.md +0 -45
- package/templates/_agents/roles/ui-verifier.md +0 -44
- package/templates/_agents/rule-budgets.txt +0 -18
- package/templates/_agents/scripts/agg-delegations.cjs +0 -302
- package/templates/_agents/scripts/agg-delegations.test.mjs +0 -282
- package/templates/_agents/scripts/agg-gate-stats.mjs +0 -113
- package/templates/_agents/scripts/agg-gate-stats.test.mjs +0 -95
- package/templates/_agents/scripts/agg-judgments.mjs +0 -156
- package/templates/_agents/scripts/agg-judgments.test.mjs +0 -93
- package/templates/_agents/scripts/archive-sweep.mjs +0 -235
- package/templates/_agents/scripts/archive-sweep.test.mjs +0 -129
- package/templates/_agents/scripts/check-attribution.mjs +0 -37
- package/templates/_agents/scripts/check-convergence.mjs +0 -124
- package/templates/_agents/scripts/check-engine-integrity.mjs +0 -220
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +0 -215
- package/templates/_agents/scripts/check-funnel.mjs +0 -56
- package/templates/_agents/scripts/check-hygiene.mjs +0 -167
- package/templates/_agents/scripts/check-hygiene.test.mjs +0 -182
- package/templates/_agents/scripts/check-index-incremental.test.mjs +0 -73
- package/templates/_agents/scripts/check-lane-surface.mjs +0 -238
- package/templates/_agents/scripts/check-lane-surface.test.mjs +0 -302
- package/templates/_agents/scripts/check-ledger-invariant.mjs +0 -527
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +0 -639
- package/templates/_agents/scripts/check-loop-rev.test.mjs +0 -336
- package/templates/_agents/scripts/check-loop-unit.test.mjs +0 -103
- package/templates/_agents/scripts/check-loop.mjs +0 -1958
- package/templates/_agents/scripts/check-loop.sh +0 -6
- package/templates/_agents/scripts/check-loop.test.mjs +0 -3875
- package/templates/_agents/scripts/check-metric-claims.mjs +0 -277
- package/templates/_agents/scripts/check-prejudgment.mjs +0 -64
- package/templates/_agents/scripts/check-registry.mjs +0 -45
- package/templates/_agents/scripts/check-scope.mjs +0 -96
- package/templates/_agents/scripts/check-scope.test.mjs +0 -96
- package/templates/_agents/scripts/check-scripts-syntax.mjs +0 -61
- package/templates/_agents/scripts/check-scripts-syntax.test.mjs +0 -72
- package/templates/_agents/scripts/check-spec-verif.mjs +0 -47
- package/templates/_agents/scripts/check-stage-index.mjs +0 -40
- package/templates/_agents/scripts/check-stage-index.test.mjs +0 -77
- package/templates/_agents/scripts/closeout-l1.mjs +0 -217
- package/templates/_agents/scripts/closeout-l1.test.mjs +0 -105
- package/templates/_agents/scripts/commit-check-trigger.test.mjs +0 -205
- package/templates/_agents/scripts/compact-ledgers.mjs +0 -97
- package/templates/_agents/scripts/compact-ledgers.test.mjs +0 -162
- package/templates/_agents/scripts/confirm-doc.mjs +0 -603
- package/templates/_agents/scripts/confirm-doc.test.mjs +0 -1103
- package/templates/_agents/scripts/doctor.test.mjs +0 -770
- package/templates/_agents/scripts/draft-sediment.mjs +0 -178
- package/templates/_agents/scripts/draft-sediment.test.mjs +0 -272
- package/templates/_agents/scripts/edit-face-check.mjs +0 -109
- package/templates/_agents/scripts/edit-face-check.test.mjs +0 -99
- package/templates/_agents/scripts/ensure-board.mjs +0 -185
- package/templates/_agents/scripts/fill-intent.mjs +0 -91
- package/templates/_agents/scripts/fill-intent.test.mjs +0 -113
- package/templates/_agents/scripts/fill-plan.mjs +0 -79
- package/templates/_agents/scripts/fill-plan.test.mjs +0 -224
- package/templates/_agents/scripts/fill-spec.mjs +0 -70
- package/templates/_agents/scripts/fill-spec.test.mjs +0 -266
- package/templates/_agents/scripts/fixture-scripts.mjs +0 -153
- package/templates/_agents/scripts/fixture-scripts.test.mjs +0 -112
- package/templates/_agents/scripts/gate-checklist.mjs +0 -209
- package/templates/_agents/scripts/gate-checklist.test.mjs +0 -201
- package/templates/_agents/scripts/gate-seg.mjs +0 -54
- package/templates/_agents/scripts/gate-seg.test.mjs +0 -112
- package/templates/_agents/scripts/gen-effective-policy.mjs +0 -107
- package/templates/_agents/scripts/gen-effective-policy.test.mjs +0 -100
- package/templates/_agents/scripts/gen-verify-evidence.mjs +0 -107
- package/templates/_agents/scripts/gen-verify-evidence.test.mjs +0 -84
- package/templates/_agents/scripts/gen-wiki-board.mjs +0 -276
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +0 -249
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +0 -251
- package/templates/_agents/scripts/gen-workflow-dashboard.test.mjs +0 -188
- package/templates/_agents/scripts/gen-workflow-index.mjs +0 -201
- package/templates/_agents/scripts/gen-workflow-index.test.mjs +0 -152
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +0 -334
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +0 -224
- package/templates/_agents/scripts/git-merge-jsonl.mjs +0 -63
- package/templates/_agents/scripts/git-merge-jsonl.test.mjs +0 -125
- package/templates/_agents/scripts/judgment-ledger.mjs +0 -65
- package/templates/_agents/scripts/judgment-ledger.test.mjs +0 -129
- package/templates/_agents/scripts/kb-cache-evict.mjs +0 -50
- package/templates/_agents/scripts/kb-cache-evict.test.mjs +0 -104
- package/templates/_agents/scripts/kb-search.mjs +0 -413
- package/templates/_agents/scripts/kb-search.test.mjs +0 -299
- package/templates/_agents/scripts/lane-surface-audit.mjs +0 -143
- package/templates/_agents/scripts/lane-surface-audit.test.mjs +0 -93
- package/templates/_agents/scripts/ledger-doc-chain.test.mjs +0 -166
- package/templates/_agents/scripts/ledger-loader.mjs +0 -108
- package/templates/_agents/scripts/ledger-loader.test.mjs +0 -131
- package/templates/_agents/scripts/ledger-prune.mjs +0 -96
- package/templates/_agents/scripts/ledger-prune.test.mjs +0 -120
- package/templates/_agents/scripts/ledger-shards.mjs +0 -344
- package/templates/_agents/scripts/ledger-shards.test.mjs +0 -356
- package/templates/_agents/scripts/ledger-ts-monotonic.test.mjs +0 -135
- package/templates/_agents/scripts/level-criteria.mjs +0 -231
- package/templates/_agents/scripts/level-criteria.test.mjs +0 -281
- package/templates/_agents/scripts/mechanism-retire-watch.mjs +0 -183
- package/templates/_agents/scripts/mechanism-retire-watch.test.mjs +0 -114
- package/templates/_agents/scripts/papercut-debt-controller.mjs +0 -141
- package/templates/_agents/scripts/papercut-debt-controller.test.mjs +0 -127
- package/templates/_agents/scripts/papercut-debt-sensor.mjs +0 -170
- package/templates/_agents/scripts/papercut-debt-sensor.test.mjs +0 -146
- package/templates/_agents/scripts/pipeline-run-docs.mjs +0 -76
- package/templates/_agents/scripts/pipeline-run-run.mjs +0 -63
- package/templates/_agents/scripts/pipeline-run.mjs +0 -867
- package/templates/_agents/scripts/pipeline-run.test.mjs +0 -517
- package/templates/_agents/scripts/policy.mjs +0 -281
- package/templates/_agents/scripts/pre-push.test.mjs +0 -105
- package/templates/_agents/scripts/resolve-merge-conflicts.mjs +0 -110
- package/templates/_agents/scripts/resolve-merge-conflicts.test.mjs +0 -87
- package/templates/_agents/scripts/rewrite-file.mjs +0 -133
- package/templates/_agents/scripts/rewrite-file.test.mjs +0 -148
- package/templates/_agents/scripts/rule-budget.mjs +0 -96
- package/templates/_agents/scripts/rule-budget.test.mjs +0 -118
- package/templates/_agents/scripts/run-tests.mjs +0 -99
- package/templates/_agents/scripts/run-tests.test.mjs +0 -105
- package/templates/_agents/scripts/solidify-task.mjs +0 -107
- package/templates/_agents/scripts/solidify-task.test.mjs +0 -129
- package/templates/_agents/scripts/stage-gates.mjs +0 -343
- package/templates/_agents/scripts/stage-gates.test.mjs +0 -105
- package/templates/_agents/scripts/trust-mode.mjs +0 -67
- package/templates/_agents/scripts/trust-mode.test.mjs +0 -110
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +0 -253
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +0 -123
- package/templates/_agents/scripts/verify.mjs +0 -210
- package/templates/_agents/scripts/verify.test.mjs +0 -358
- package/templates/_agents/scripts/wf-journal.mjs +0 -231
- package/templates/_agents/scripts/wf-journal.test.mjs +0 -216
- package/templates/_agents/scripts/wiki-search.mjs +0 -19
- package/templates/_agents/scripts/wiki-search.test.mjs +0 -57
- package/templates/_agents/scripts/workflow-board-server.mjs +0 -393
- package/templates/_agents/scripts/workflow-board-server.test.mjs +0 -201
- package/templates/_agents/scripts/workflow-enums.mjs +0 -70
- package/templates/_agents/scripts/workflow-enums.test.mjs +0 -118
- package/templates/_agents/scripts/workflows-check.mjs +0 -260
- package/templates/_agents/scripts/workflows-check.test.mjs +0 -278
- package/templates/_agents/scripts-test-exempt.txt +0 -16
- package/templates/_agents/skills/papercut-fix/SKILL.md +0 -60
- package/templates/_agents/skills/papercut-fix/references/response-template.md +0 -81
- package/templates/_agents/skills/review-method/SKILL.md +0 -55
- package/templates/_agents/skills/verify-ui/SKILL.md +0 -61
- package/templates/_agents/skills/wiki/SKILL.md +0 -106
- package/templates/_agents/workflow-enums.txt +0 -26
- package/templates/_agents/workflow-modules.txt +0 -11
- package/templates/_agents/workflows/_TEMPLATE.md +0 -75
- package/templates/_agents/workflows/pipeline-closing.md +0 -28
- package/templates/_agents/workflows//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +0 -16
- package/templates/_githooks/commit-msg +0 -17
- package/templates/_githooks/post-commit +0 -10
- package/templates/_githooks/pre-commit +0 -126
- package/templates/_githooks/pre-merge-commit +0 -29
- package/templates/_githooks/pre-push +0 -136
- package/templates/_github/workflows/kit-ci.yml +0 -49
- package/templates/wiki/INDEX.md +0 -73
- package/templates/wiki/drafts-archive/README.md +0 -3
- package/templates/wiki//344/272/247/345/223/201/351/234/200/346/261/202/README.md +0 -3
- package/templates/wiki//345/274/200/345/217/221/346/226/271/346/241/210/README.md +0 -3
- package/templates/wiki//346/225/260/346/215/256/347/273/264/346/212/244/README.md +0 -3
- package/templates/wiki//346/265/213/350/257/225/346/212/245/345/221/212/README.md +0 -3
- package/templates/wiki//347/224/250/346/210/267/345/212/237/350/203/275/README.md +0 -3
- package/templates/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +0 -77
- package/templates/wiki//351/241/271/347/233/256/350/247/204/350/214/203/README.md +0 -3
- package/templates/wiki//351/241/271/347/233/256/350/256/241/345/210/222/README.md +0 -3
- package/templates/workflow/README.md +0 -90
- package/templates/workflow/delegations.md +0 -29
- package/templates/workflow/incidents/_TEMPLATE.md +0 -51
- package/templates/workflow/intents/_TEMPLATE.md +0 -46
- package/templates/workflow/papercuts.md +0 -9
- package/templates/workflow/plans/_TEMPLATE.md +0 -47
- package/templates/workflow/regression-checklist.md +0 -23
- package/templates/workflow/specs/_TEMPLATE.md +0 -80
- /package/templates/{_agents → engine/.agents}/board/marked.min.js +0 -0
- /package/templates/{_agents/workflows → engine/.agents/pipelines}/steps//347/244/272/344/276/213-/351/203/250/347/275/262/351/252/214/350/257/201.md" +0 -0
- /package/templates/{_agents → engine/.agents}/scripts/git-core.mjs +0 -0
package/src/doctor.mjs
DELETED
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
// flow-kit doctor:安装体检——布局 / git 钩子 / managed 台账 / 占位符残留 / 索引漂移 / check-loop
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { execSync, spawnSync } from 'node:child_process';
|
|
5
|
-
import net from 'node:net';
|
|
6
|
-
import { createHash } from 'node:crypto';
|
|
7
|
-
import { listTree, scriptTrusted } from './render.mjs';
|
|
8
|
-
import { isOwned, HOSTS, pickStackVars, srcTemplatePath, templateDriftOf, TEMPLATE_DRIFT_EXCLUDE } from './profiles.mjs';
|
|
9
|
-
import { bodySha } from './sync-hosts.mjs';
|
|
10
|
-
// 委派台账分片感知读(2026-10-13 ledger-shard-ledgers 回灌):快照新鲜度判读的台账文本
|
|
11
|
-
// = 主台账 ∪ delegations.d/*.md,读侧单源复用随包模板模块(§6.5 数据行迁入分片后仍可判陈旧)。
|
|
12
|
-
import { readLedgerText } from '../templates/_agents/scripts/ledger-shards.mjs';
|
|
13
|
-
|
|
14
|
-
// 宿主目录映射(与 src/profiles.mjs#HOSTS 同源:装副本目录名前缀带点)
|
|
15
|
-
const HOST_DIR = Object.fromEntries(Object.entries(HOSTS).map(([k, v]) => [k, v.dir]));
|
|
16
|
-
// 命令层薄适配宿主:[装副本目录名, 文件名前缀](单源 profiles.mjs#HOSTS.commandPrefix;与 sync-hosts pairsFor 同口径)
|
|
17
|
-
const HOST_CMD_DIR = Object.entries(HOSTS).filter(([, v]) => v.commandPrefix).map(([, v]) => [v.dir, v.commandPrefix]);
|
|
18
|
-
|
|
19
|
-
function sh(cmd, cwd) {
|
|
20
|
-
try {
|
|
21
|
-
return { ok: true, out: execSync(cmd, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }) };
|
|
22
|
-
} catch (e) {
|
|
23
|
-
return { ok: false, out: String((e.stdout || '') + (e.stderr || '')) };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function portInUse(port) {
|
|
28
|
-
return new Promise((resolve) => {
|
|
29
|
-
const s = net.connect({ port: Number(port), host: '127.0.0.1', timeout: 400 });
|
|
30
|
-
s.on('connect', () => { s.destroy(); resolve(true); });
|
|
31
|
-
s.on('error', () => resolve(false));
|
|
32
|
-
s.on('timeout', () => { s.destroy(); resolve(false); });
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function doctor(args, pkgRoot) {
|
|
37
|
-
let target = process.cwd();
|
|
38
|
-
for (let i = 0; i < args.length; i++) {
|
|
39
|
-
if (args[i] === '--dir') target = path.resolve(args[++i]);
|
|
40
|
-
}
|
|
41
|
-
const results = []; // {level:'PASS'|'WARN'|'FAIL', msg}
|
|
42
|
-
const add = (level, msg) => results.push({ level, msg });
|
|
43
|
-
|
|
44
|
-
// 1. Node 版本
|
|
45
|
-
const major = Number(process.versions.node.split('.')[0]);
|
|
46
|
-
if (major >= 18) add('PASS', `Node ${process.versions.node}(≥18)`);
|
|
47
|
-
else add('FAIL', `Node ${process.versions.node} 过低(引擎脚本需 ≥18)`);
|
|
48
|
-
|
|
49
|
-
// 2. 目录布局
|
|
50
|
-
const required = [
|
|
51
|
-
'AGENTS.md',
|
|
52
|
-
'.agents/commands/new-task.md',
|
|
53
|
-
'.agents/roles/implementer.md',
|
|
54
|
-
'.agents/roles/independent-reviewer.md',
|
|
55
|
-
'.agents/roles/ui-verifier.md',
|
|
56
|
-
'.agents/scripts/check-loop.sh',
|
|
57
|
-
'.agents/scripts/kb-search.mjs',
|
|
58
|
-
'.agents/scripts/gen-workflow-index.mjs',
|
|
59
|
-
'.agents/scripts/gen-wiki-board.mjs',
|
|
60
|
-
'.agents/scripts/workflow-board-server.mjs',
|
|
61
|
-
'.agents/board/index.html',
|
|
62
|
-
'.agents/hooks/commit-check.cjs',
|
|
63
|
-
'.agents/workflow-modules.txt',
|
|
64
|
-
'.agents/workflow-enums.txt',
|
|
65
|
-
'.agents/rule-budgets.txt',
|
|
66
|
-
'.agents/settings.json',
|
|
67
|
-
'.agents/workflows/_TEMPLATE.md',
|
|
68
|
-
'.agents/scripts/check-loop.mjs',
|
|
69
|
-
'.agents/scripts/confirm-doc.mjs',
|
|
70
|
-
'.githooks/pre-commit',
|
|
71
|
-
'.githooks/pre-push',
|
|
72
|
-
'.githooks/commit-msg',
|
|
73
|
-
'.githooks/post-commit',
|
|
74
|
-
'.githooks/pre-merge-commit',
|
|
75
|
-
'workflow/README.md',
|
|
76
|
-
'workflow/intents/_TEMPLATE.md',
|
|
77
|
-
'workflow/specs/_TEMPLATE.md',
|
|
78
|
-
'workflow/plans/_TEMPLATE.md',
|
|
79
|
-
'workflow/incidents/_TEMPLATE.md',
|
|
80
|
-
'wiki/INDEX.md',
|
|
81
|
-
];
|
|
82
|
-
const missing = required.filter((p) => !fs.existsSync(path.join(target, p)));
|
|
83
|
-
if (missing.length === 0) add('PASS', `目录布局完整(${required.length} 个关键路径)`);
|
|
84
|
-
else add('FAIL', `布局缺失:${missing.join('、')}`);
|
|
85
|
-
|
|
86
|
-
// 3. git 仓库与钩子
|
|
87
|
-
const isRepo = sh('git rev-parse --git-dir', target).ok;
|
|
88
|
-
if (isRepo) {
|
|
89
|
-
const hp = sh('git config core.hooksPath', target);
|
|
90
|
-
if (hp.ok && hp.out.trim() === '.githooks') {
|
|
91
|
-
add('PASS', 'core.hooksPath=.githooks(钩子已挂载)');
|
|
92
|
-
// 执行位检查(init-p1-batch P1-1):POSIX 上 git 对不可执行钩子静默跳过、全部门禁失效且原不可发现;
|
|
93
|
-
// win32 无执行位语义(mode 恒 0666 系),跳过本检查
|
|
94
|
-
if (process.platform !== 'win32') {
|
|
95
|
-
try {
|
|
96
|
-
const hookDir = path.join(target, '.githooks');
|
|
97
|
-
const noExec = fs.readdirSync(hookDir)
|
|
98
|
-
.filter((f) => fs.statSync(path.join(hookDir, f)).isFile())
|
|
99
|
-
.filter((f) => !(fs.statSync(path.join(hookDir, f)).mode & 0o111));
|
|
100
|
-
if (noExec.length) add('FAIL', `钩子缺执行位(POSIX 上 git 静默跳过不可执行钩子,门禁全部失效):${noExec.join('、')}——执行 chmod +x .githooks/*`);
|
|
101
|
-
} catch { /* .githooks 目录缺失由 §2 布局检查覆盖 */ }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
else add('FAIL', `core.hooksPath 当前为「${(hp.ok ? hp.out : '').trim() || '未设置'}」——执行 git config core.hooksPath .githooks`);
|
|
105
|
-
} else {
|
|
106
|
-
add('WARN', '不在 git 仓库内——钩子未挂载(git init 后执行 git config core.hooksPath .githooks)');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 4. kit.json managed 台账(sha 校验:本地改动 → WARN,缺失 → FAIL)
|
|
110
|
-
const kitPath = path.join(target, '.agents', 'kit.json');
|
|
111
|
-
if (!fs.existsSync(kitPath)) {
|
|
112
|
-
add('WARN', '无 .agents/kit.json(非 flow-kit 安装或旧版手动安装)');
|
|
113
|
-
} else {
|
|
114
|
-
try {
|
|
115
|
-
const kit = JSON.parse(fs.readFileSync(kitPath, 'utf8'));
|
|
116
|
-
let ok = 0;
|
|
117
|
-
let modified = 0;
|
|
118
|
-
const gone = [];
|
|
119
|
-
for (const f of kit.managed || []) {
|
|
120
|
-
const p = path.join(target, f.rel);
|
|
121
|
-
if (!fs.existsSync(p)) { gone.push(f.rel); continue; }
|
|
122
|
-
const h = createHash('sha256').update(fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n'), 'utf8').digest('hex'); // LF 归一(closing-coverage:跨 checkout 稳定,同 sync shaText 口径)
|
|
123
|
-
if (h === f.sha256) ok++; else modified++;
|
|
124
|
-
}
|
|
125
|
-
add('PASS', `kit.json v${kit.version}:managed ${ok + modified} 份校验通过`);
|
|
126
|
-
if (modified) add('WARN', `managed 本地改动 ${modified} 份(升级时 flow-kit sync 会要求合并)`);
|
|
127
|
-
if (gone.length) add('FAIL', `managed 文件缺失:${gone.join('、')}`);
|
|
128
|
-
} catch (e) {
|
|
129
|
-
add('FAIL', `kit.json 解析失败:${e.message}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// 4.5 台账覆盖率(2026-09-26 managed-ledger-adopt):§4 只遍历台账条目做双向校验,
|
|
134
|
-
// 从不反向问「盘上还有谁没登记」——15 份 managed 类文件曾因此长期游离台账外,sync 只报不修。
|
|
135
|
-
// 本项由 pkgRoot 包源枚举应有 managed 清单(排除 isOwned)与台账取差集,补上「盘上有、台账无」一侧。
|
|
136
|
-
// 首次引入用 WARN:doctor 的 pkgRoot 是包安装目录,装户可能落后于包版本(包内新增 managed 件
|
|
137
|
-
// 在装户 sync 前必然未登记),直接 FAIL 会让存量装户升级包后一跑 doctor 即挂。
|
|
138
|
-
// 沿用本仓库三次先例(doctor-owned-drift / workflows-check / adapter 薄适配漂移均先 WARN)。
|
|
139
|
-
{
|
|
140
|
-
const covRes = checkLedgerCoverage(target, pkgRoot);
|
|
141
|
-
if (covRes.skipped) {
|
|
142
|
-
add('PASS', `台账覆盖率检查跳过(${covRes.note || '无包源模板'})`);
|
|
143
|
-
} else if (covRes.missing.length === 0) {
|
|
144
|
-
add('PASS', `台账覆盖率完整(${covRes.total} 份 managed 全在册)`);
|
|
145
|
-
} else {
|
|
146
|
-
const shown = covRes.missing.slice(0, 5).join('、');
|
|
147
|
-
add('WARN', `台账覆盖率缺口 ${covRes.missing.length} 份——盘上 managed 类文件未登记进 kit.json,包源改动不会同步到装副本;跑 node bin/flow-kit.mjs sync 收养(内容等于新版才登记)${covRes.missing.length > 5 ? `:${shown} …` : `:${shown}`}`);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// scriptGuard(init-p1-batch P1-3 供应链防线):spawn 目标侧脚本前校验其与包源渲染值(LF 归一)一致——
|
|
152
|
-
// 失配说明预置/被改动,不可信:调用方记 WARN 跳过(fail-visible,不执行也不下通过结论)。
|
|
153
|
-
// 无 pkgRoot(理论路径)不设防;vars 从 kit.json options 重建(与 sync 同源构造)。
|
|
154
|
-
const scriptGuard = (rel) => {
|
|
155
|
-
if (!pkgRoot) return { ok: true, note: '' };
|
|
156
|
-
let opts = null;
|
|
157
|
-
try { opts = JSON.parse(fs.readFileSync(kitPath, 'utf8')).options; } catch { /* 无/坏台账→用默认 vars */ }
|
|
158
|
-
const vars = { BOARD_PORT: String(opts?.boardPort || '8933'), ...pickStackVars(opts?.stack) };
|
|
159
|
-
return scriptTrusted({ pkgRoot, target, rel, vars });
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// 5. 占位符残留
|
|
163
|
-
const phFiles = ['AGENTS.md', 'workflow/README.md', '.agents/notes/runtime-env.md']
|
|
164
|
-
.concat(fs.existsSync(path.join(target, '.agents/commands')) ? fs.readdirSync(path.join(target, '.agents/commands')).filter((f) => f.endsWith('.md')).map((f) => `.agents/commands/${f}`) : []);
|
|
165
|
-
const phHits = [];
|
|
166
|
-
for (const rel of phFiles) {
|
|
167
|
-
const p = path.join(target, rel);
|
|
168
|
-
if (!fs.existsSync(p)) continue;
|
|
169
|
-
const txt = fs.readFileSync(p, 'utf8');
|
|
170
|
-
for (const m of txt.matchAll(/\{\{([A-Z][A-Z0-9_]*)\}\}/g)) phHits.push(`${rel}: {{${m[1]}}}`);
|
|
171
|
-
}
|
|
172
|
-
if (phHits.length === 0) add('PASS', '无占位符残留');
|
|
173
|
-
else add('WARN', `占位符残留 ${phHits.length} 处(init 变量缺失或需手改):${phHits.slice(0, 5).join(';')}${phHits.length > 5 ? ' …' : ''}`);
|
|
174
|
-
|
|
175
|
-
// 6. workflow 索引漂移
|
|
176
|
-
const idxGuard = scriptGuard('.agents/scripts/gen-workflow-index.mjs');
|
|
177
|
-
if (!idxGuard.ok) {
|
|
178
|
-
add('WARN', `workflow/INDEX.md 漂移检查跳过——${idxGuard.note}(供应链防线)`);
|
|
179
|
-
} else {
|
|
180
|
-
const idx = spawnSync(process.execPath, ['.agents/scripts/gen-workflow-index.mjs', '--check'], { cwd: target, encoding: 'utf8' });
|
|
181
|
-
if (idx.status === 0) add('PASS', 'workflow/INDEX.md 无漂移');
|
|
182
|
-
else add('WARN', `workflow/INDEX.md 漂移——跑 node .agents/scripts/gen-workflow-index.mjs 重生成`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// 6b. wiki 索引漂移(2026-10-10:镜像 §6 workflow 侧——wiki INDEX 计数/映射表/看板 DATA 原本无任何
|
|
186
|
-
// 机器校验,装户手改生成区或忘跑 gen-wiki-board 只有肉眼能发现;workflow 侧有 doctor + check-loop 11
|
|
187
|
-
// 双路,wiki 侧此前是单路都没有)。存在性先行:旧装户无此脚本 = 既有「静默跳过」语义(同 §6.5 口径)
|
|
188
|
-
if (fs.existsSync(path.join(target, '.agents/scripts/gen-wiki-board.mjs'))) {
|
|
189
|
-
const wikiGuard = scriptGuard('.agents/scripts/gen-wiki-board.mjs');
|
|
190
|
-
if (!wikiGuard.ok) {
|
|
191
|
-
add('WARN', `wiki/INDEX.md 漂移检查跳过——${wikiGuard.note}(供应链防线)`);
|
|
192
|
-
} else {
|
|
193
|
-
const wb = spawnSync(process.execPath, ['.agents/scripts/gen-wiki-board.mjs', '--check'], { cwd: target, encoding: 'utf8' });
|
|
194
|
-
if (wb.status === 0) add('PASS', 'wiki/INDEX.md 与看板无漂移');
|
|
195
|
-
else add('WARN', `wiki/INDEX.md 或看板漂移——跑 node .agents/scripts/gen-wiki-board.mjs 重生成`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// 6.5 delegations 台账结构(量化层非门禁:结构漂移曾静默吞掉全部记录,2026-09-24)
|
|
200
|
-
// 存在性先行(复核 P2-2):旧装户无此脚本 = 既有「静默跳过」语义,不产生防线 WARN 噪音
|
|
201
|
-
if (fs.existsSync(path.join(target, '.agents/scripts/agg-delegations.cjs'))) {
|
|
202
|
-
const aggGuard = scriptGuard('.agents/scripts/agg-delegations.cjs');
|
|
203
|
-
if (!aggGuard.ok) {
|
|
204
|
-
add('WARN', `delegations 台账结构检查跳过——${aggGuard.note}(供应链防线)`);
|
|
205
|
-
} else {
|
|
206
|
-
const agg = spawnSync(process.execPath, ['.agents/scripts/agg-delegations.cjs'], { cwd: target, encoding: 'utf8' });
|
|
207
|
-
if (agg.status === 0) add('PASS', 'delegations 台账结构有效(agg 可解析)');
|
|
208
|
-
else add('WARN', `delegations 台账结构漂移——${String(agg.stderr || agg.stdout || '').split('\n')[0]}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// 6.5b delegations 月度聚合快照新鲜度(p0-gate-noise-batch:回写无门致快照 3 周未更新)
|
|
213
|
-
const snapFresh = checkDelegationSnapshotFreshness(target);
|
|
214
|
-
if (snapFresh.skipped) {
|
|
215
|
-
add('PASS', `delegations 快照新鲜度检查跳过(${snapFresh.note})`);
|
|
216
|
-
} else if (snapFresh.stale) {
|
|
217
|
-
add('WARN', `delegations 月度快照陈旧(台账至 ${snapFresh.ledgerMonth},快照至 ${snapFresh.snapshotMonth || '缺失'})——跑 agg-delegations.cjs 更新 §月度聚合快照`);
|
|
218
|
-
} else {
|
|
219
|
-
add('PASS', `delegations 月度快照最新(${snapFresh.snapshotMonth})`);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// 6.6 owned 漂移校验(kit.owned 列表盘面 sha 不一致;engine 双源纪律对 owned 走「项目自持 + 哈希记账不约束」,
|
|
223
|
-
// 漂移信号靠本校验给装户可见性。2026-09-25 wf-runtime 复盘:包源改了装副本未同步 = 漂移但 sync 不报。)
|
|
224
|
-
const ownedRes = checkOwnedDrift(target);
|
|
225
|
-
if (ownedRes.error) {
|
|
226
|
-
add('WARN', `owned 校验跳过(kit.json 解析失败:${ownedRes.error})`);
|
|
227
|
-
} else if (ownedRes.skipped) {
|
|
228
|
-
add('PASS', 'owned 校验跳过(kit.json 无 owned 条目)');
|
|
229
|
-
} else if (ownedRes.total === 0) {
|
|
230
|
-
add('PASS', 'owned 校验跳过(kit.json 无 owned 条目)');
|
|
231
|
-
} else if (ownedRes.drift === 0 && ownedRes.gone.length === 0) {
|
|
232
|
-
add('PASS', `owned ${ownedRes.total} 份无漂移(装副本与台账 sha 对齐)`);
|
|
233
|
-
} else {
|
|
234
|
-
// owned 漂移已严化为 FAIL(2026-09-25 doctor-owned-drift-strict 复盘;首次引入用 WARN,installed 装户吃过警告后升级)
|
|
235
|
-
if (ownedRes.drift) add('FAIL', `owned 漂移 ${ownedRes.drift} 份——装副本手改未跑 sync 刷台账 / 包源改了装副本未同步;须手动同步装副本后跑 npx agentic-flow-kit sync 刷台账`);
|
|
236
|
-
if (ownedRes.gone.length) add('FAIL', `owned 文件缺失:${ownedRes.gone.join('、')}——sync 恢复或手动恢复`);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// 6.6b gate 安装锚校验(2026-10-11 P3-1 gate 防改锚):add-gate 给逐字拷贝安装的 gate 脚本写
|
|
240
|
-
// srcSha256=安装时刻包源 sha(见 src/add-gate.mjs 头注);sync 只按包源刷新模板条目锚,gate 条目
|
|
241
|
-
// 解析不到包源模板(srcTemplatePath→null 提前 return)故锚恒定 → 盘面 sha ≠ 锚即「装后手改」。
|
|
242
|
-
// 设计依据:2026-10-10 调研结论「gate 装户可改、hard 项缺防改」——sync 对 owned 的 sha256 按盘面
|
|
243
|
-
// 自愈使手改不留痕,本项补上可见性。不阻断(沿用「先 WARN 升级 FAIL」渐进路径):装户对门有最终
|
|
244
|
-
// 所有权,锚只提供可见性,有意改动知悉即可。
|
|
245
|
-
const gateRes = checkGateAnchors(target);
|
|
246
|
-
// 出账分级按信任档(2026-10-12 gate-trust-level):project 档 = WARN 永久可见(装户对门有最终
|
|
247
|
-
// 所有权);org 档 = FAIL(doctor exit 1,组织级强制位)。两种档位的**文案主干逐字相同**——
|
|
248
|
-
// 升档只改级别与追加一句「本仓已声明 org 档」,不改判据、不改修复指引(作者照同一套指引修即可)。
|
|
249
|
-
const orgMode = gateRes.trust === 'org';
|
|
250
|
-
const trustNote = orgMode ? '【本仓 kit.json gateTrust=org:组织级强制档,失配属 FAIL】' : '【本仓 kit.json gateTrust=project:项目自治档,失配属 WARN;改 org 可升级为强制】';
|
|
251
|
-
if (gateRes.error) {
|
|
252
|
-
add('WARN', `gate 安装锚校验跳过(kit.json 解析失败:${gateRes.error})`);
|
|
253
|
-
} else if (gateRes.skipped) {
|
|
254
|
-
add('PASS', `gate 安装锚校验跳过(无带锚 gate 条目——旧装户重装 add-gate 后生效)`);
|
|
255
|
-
} else if (gateRes.mismatch.length === 0 && gateRes.gone.length === 0) {
|
|
256
|
-
add('PASS', `gate 安装锚 ${gateRes.total} 份无失配`);
|
|
257
|
-
} else {
|
|
258
|
-
const lv = orgMode ? 'FAIL' : 'WARN';
|
|
259
|
-
if (gateRes.mismatch.length) add(lv, `gate 安装锚失配 ${gateRes.mismatch.length} 份:${gateRes.mismatch.join('、')}——.agents/hooks/ 门禁脚本与安装时包源 sha 不一致(手改会永久留痕)${orgMode ? '(org 档即不可接受)' : ';有意改动知悉即可'}(重装重锚:flow-kit add-gate <门名> --force;恢复原版:从包源 modules/gates/ 拷回)${trustNote}`);
|
|
260
|
-
if (gateRes.gone.length) add(lv, `gate 带锚文件缺失 ${gateRes.gone.length} 份:${gateRes.gone.join('、')}——门禁已不在盘面(失效${orgMode ? ';org 档即不可接受' : ''});恢复:flow-kit add-gate <门名> --force 或从包源 modules/gates/ 拷回${trustNote}`);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// 6.7 跨宿主薄适配正文段漂移校验(2026-09-25 cross-host-sync 立法)
|
|
264
|
-
// 装户侧视角:.agents/{commands,roles}/*.md 是权威源;4 宿主目录(.zcode/.omp/.opencode/.trae)下的
|
|
265
|
-
// {agents,commands}/*.md 是薄适配。按正文段 sha 比对(B-b 语义,frontmatter 不计入漂移),
|
|
266
|
-
// commands 层按 profiles.mjs#HOSTS.commandPrefix 前缀映射(2026-09-28 起 opencode/trae 同 wf-)。
|
|
267
|
-
// 首次引入为 WARN(沿用 wf-runtime 复盘「先 WARN 升级 FAIL」路径),
|
|
268
|
-
// 待装户升级视反馈升级 FAIL。包源侧对应工具是 flow-kit sync-hosts(src/sync-hosts.mjs)。
|
|
269
|
-
const adapterRes = checkAdapterDrift(target);
|
|
270
|
-
if (adapterRes.skipped) {
|
|
271
|
-
add('PASS', `跨宿主薄适配校验跳过(${adapterRes.note || '权威源目录不存在'})`);
|
|
272
|
-
} else if (adapterRes.drift === 0) {
|
|
273
|
-
add('PASS', `跨宿主薄适配 ${adapterRes.total} 对无正文漂移(装副本引擎 vs 注册表内宿主薄适配,B-b 语义)`);
|
|
274
|
-
} else {
|
|
275
|
-
add('WARN', `跨宿主薄适配正文漂移 ${adapterRes.drift} 对——权威源 .agents 与宿主薄适配正文段 sha 不一致。刷新用 flow-kit add-host <宿主> --force(flow-kit sync 不更新宿主适配;sync-hosts 只在包源仓比对 templates/_agents 与 modules/hosts)。`);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// 6.8 workflows 编排脚本 lint(stages 表解析校验:role/step/after 引用、无环、三形态互斥、数值枚举;
|
|
279
|
-
// 2026-09-25 workflows-linter 把 _TEMPLATE.md「解析校验先行」从 prose 变机器门。首次引入 WARN
|
|
280
|
-
// (沿用 wf-runtime 复盘「先 WARN 升级 FAIL」渐进路径),装户吃过警告后可升 FAIL。
|
|
281
|
-
// 旧版装户 sync 前 .agents/scripts/workflows-check.mjs 不存在 → 自然跳过不误报)
|
|
282
|
-
// 6.8 workflows 编排脚本 lint(stages 表解析校验:role/step/after 引用、无环、三形态互斥、数值枚举;
|
|
283
|
-
// 2026-09-25 workflows-linter 把 _TEMPLATE.md「解析校验先行」从 prose 变机器门。首次引入 WARN
|
|
284
|
-
// (沿用 wf-runtime 复盘「先 WARN 升级 FAIL」渐进路径),装户吃过警告后可升 FAIL。
|
|
285
|
-
// 旧版装户 sync 前 .agents/scripts/workflows-check.mjs 不存在 → 既有「静默跳过」语义保留(存在性先行,
|
|
286
|
-
// 复核 P2-2),防线只拦「存在但与包源不符」)
|
|
287
|
-
const wfExists = fs.existsSync(path.join(target, '.agents/scripts/workflows-check.mjs')) && fs.existsSync(path.join(target, '.agents/workflows'));
|
|
288
|
-
const wfGuard = wfExists ? scriptGuard('.agents/scripts/workflows-check.mjs') : { ok: true, note: '' };
|
|
289
|
-
if (wfExists && !wfGuard.ok) {
|
|
290
|
-
add('WARN', `workflows 编排脚本 lint 跳过——${wfGuard.note}(供应链防线)`);
|
|
291
|
-
} else if (wfExists) {
|
|
292
|
-
const wf = spawnSync(process.execPath, ['.agents/scripts/workflows-check.mjs'], { cwd: target, encoding: 'utf8' });
|
|
293
|
-
if (wf.status === 0) {
|
|
294
|
-
const warnN = (String(wf.stdout || '').match(/- ⚠️ W\d/g) || []).length;
|
|
295
|
-
add('PASS', `workflows 编排脚本 lint 干净${warnN ? `(${warnN} 条 advisory 告警)` : ''}`);
|
|
296
|
-
} else {
|
|
297
|
-
const firstHit = String(wf.stdout || wf.stderr || '').split('\n').find((l) => / E\d/.test(l)) || `exit ${wf.status}`;
|
|
298
|
-
add('WARN', `workflows 编排脚本 lint 未过——${firstHit.trim()};修 .agents/workflows/ 编排脚本(role/step/after 引用、三形态、retries)后重跑`);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// 6.9 模板下发感知(2026-10-06 template-downstream,只读 advisory——与 sync 出账同判据
|
|
303
|
-
// profiles.templateDriftOf 单源;doctor 不写 kit.json,两次 sync 之间持续回显,sync 后自然消隐)。
|
|
304
|
-
// 语义:源仓模板已演进且盘面未跟随 → WARN 提醒(owned 归项目所有,不自动覆盖);首次引入 WARN。
|
|
305
|
-
// 旧装户 owned[] 无 srcSha256 → no-anchor 静默跳过(无判定依据不产出告警),下次 sync 写锚后生效。
|
|
306
|
-
const tplRes = checkTemplateDrift(target, pkgRoot);
|
|
307
|
-
if (tplRes.skipped) {
|
|
308
|
-
if (tplRes.note) add('PASS', `模板感知跳过(${tplRes.note})`);
|
|
309
|
-
} else if (tplRes.stale.length === 0) {
|
|
310
|
-
add('PASS', `模板感知 ${tplRes.total} 份无陈旧分歧(源仓模板与上次同步锚一致或盘面已跟随)`);
|
|
311
|
-
} else {
|
|
312
|
-
add('WARN', `模板感知:源仓 ${tplRes.stale.length} 份模板自上次同步后有演进且盘面未跟随:${tplRes.stale.join('、')}——如需跟随从包源 templates/ 拷贝;有意定制可忽略(跑 flow-kit sync 刷新锚后本项静默)`);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
// 6.10 level-hints 配置体检(2026-10-13 hint-doctor)——非法档位/正则此前只在**跑 flow-kit route 时**
|
|
316
|
-
// 才抛 LEVEL_HINTS_INVALID,而 route 是可选调用 → 写错的清单能静默存活很久。写错配置比没配置危险:
|
|
317
|
-
// 没配置会提示补,写错会误判档位。故给一条主动体检通道。
|
|
318
|
-
// 口径纪律:doctor 不复刻解析器(复刻=判据双源漂移),spawn 装户 level-criteria.mjs 的 --check
|
|
319
|
-
// 入口(判据单源仍是 parseLevelHints 一份)。
|
|
320
|
-
{
|
|
321
|
-
const hr = checkLevelHints(target);
|
|
322
|
-
if (hr.skipped) add('PASS', `level-hints 体检跳过(${hr.note})`);
|
|
323
|
-
else if (hr.ok) add('PASS', `level-hints 配置合法(${hr.note})`);
|
|
324
|
-
else add('FAIL', `level-hints 配置有误——非法档位或正则会让 flow-kit route fail-loud 抛错、按错误下限定级:\n${hr.detail}`);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// 7. check-loop——2026-09-26 check-loop-node 起 node 实现直跑(sh 版曾需先探 sh 可用性:Windows
|
|
328
|
-
// PowerShell 常无 sh,ENOENT 曾被吞进 hard-block 分支报成空原因假警报,incident 2026-09-24-doctor-sh-enoent;
|
|
329
|
-
// 迁移后无 sh 依赖,探针退役。check-loop.sh 为兼容 shim,pre-push 钩子路径照常)
|
|
330
|
-
const clGuard = scriptGuard('.agents/scripts/check-loop.mjs');
|
|
331
|
-
if (!clGuard.ok) {
|
|
332
|
-
add('WARN', `check-loop 跳过——${clGuard.note}(供应链防线:目标侧脚本与包源渲染值不符,不执行不下结论)`);
|
|
333
|
-
} else {
|
|
334
|
-
// 判定流水守卫(2026-10-13 judgment-ledger 回灌 B4):doctor 是体检探针而非门裁决点,
|
|
335
|
-
// 不落 .agents/judgments.jsonl(同 validate.mjs 口径;裁决链 = CLI/pre-push/CI/verify 正常落账)
|
|
336
|
-
// --all 显式全量(2026-10-13 分道后裸跑=默认硬门):doctor 是体检面,advisory 计数沿分道前全量口径。
|
|
337
|
-
const cl = spawnSync(process.execPath, ['.agents/scripts/check-loop.mjs', '--all'],
|
|
338
|
-
{ cwd: target, encoding: 'utf8', env: { ...process.env, CHECK_LOOP_NO_LEDGER: '1' } });
|
|
339
|
-
if (cl.status === 0) {
|
|
340
|
-
const warnTxt = String(cl.stderr || '').trim();
|
|
341
|
-
add('PASS', `check-loop 干净${warnTxt ? `(${warnTxt.split('\n').filter((l) => l.includes('WARN')).length} 条 advisory 警告)` : ''}`);
|
|
342
|
-
} else {
|
|
343
|
-
add('FAIL', `check-loop 有 hard-block:\n${String(cl.stderr || '').split('\n').slice(0, 8).join('\n')}`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// 8. 看板端口(信息级)
|
|
348
|
-
const kit = fs.existsSync(kitPath) ? JSON.parse(fs.readFileSync(kitPath, 'utf8')) : null;
|
|
349
|
-
const port = kit?.options?.boardPort || '8933';
|
|
350
|
-
portInUse(port).then((inUse) => {
|
|
351
|
-
print(results);
|
|
352
|
-
console.log(inUse
|
|
353
|
-
? `ℹ️ 看板端口 ${port} 已有监听(ensure-board 探活:本项目看板复用/旧代码重启,他人进程不 kill 自动上探,见 workflow/README.md)`
|
|
354
|
-
: `ℹ️ 看板端口 ${port} 空闲(看板默认不拉起;需要时手动 .agents/scripts/ensure-board.mjs(跨平台)或 node .agents/scripts/workflow-board-server.mjs)`);
|
|
355
|
-
process.exit(results.some((r) => r.level === 'FAIL') ? 1 : 0);
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// checkLevelHints(2026-10-13 hint-doctor):.agents/level-hints.txt 的**主动**体检。
|
|
360
|
-
// 为什么不能靠 route:非法档位/ERE 此前只在跑 flow-kit route 时才抛 LEVEL_HINTS_INVALID,
|
|
361
|
-
// 而 route 是可选调用 → 写错的清单能静默存活很久,直到某次碰巧路由才炸(写错配置比没配置危险)。
|
|
362
|
-
// 口径纪律:doctor **不复刻解析器**(复刻=判据双源漂移),改为 spawn 装户 .agents/scripts/
|
|
363
|
-
// level-criteria.mjs 的 --check 入口——parseLevelHints 永远只有一份实现。
|
|
364
|
-
// 三态:skipped(无判据单源=1.7.15 前旧装户,不产出告警)/ ok(含未配置=默认空)/ 配置有误。
|
|
365
|
-
export function checkLevelHints(target) {
|
|
366
|
-
const script = path.join(target, '.agents', 'scripts', 'level-criteria.mjs');
|
|
367
|
-
if (!fs.existsSync(script)) return { skipped: true, ok: true, note: '无 .agents/scripts/level-criteria.mjs——1.7.15 之前版本无此判据单源' };
|
|
368
|
-
const r = spawnSync(process.execPath, [script, '--check', path.join(target, '.agents', 'level-hints.txt')], {
|
|
369
|
-
cwd: target, encoding: 'utf8',
|
|
370
|
-
});
|
|
371
|
-
// spawn 本身失败(ENOENT/EACCES/超时被杀)时 status 为 null 且 stderr 可能为空——
|
|
372
|
-
// 不区分会把「体检脚本跑不起来」误报成「配置有误」,排障方向直接被带偏(2026-10-13 executor-review)。
|
|
373
|
-
if (r.error) return { skipped: false, ok: false, detail: `无法执行体检脚本 ${path.basename(script)}:${r.error.message}` };
|
|
374
|
-
if (r.status === 0) return { skipped: false, ok: true, note: String(r.stdout || '').trim() || '通过' };
|
|
375
|
-
if (r.status === null) return { skipped: false, ok: false, detail: `体检脚本异常终止(无退出码,signal=${r.signal || '未知'})——无法判定 level-hints 是否合法` };
|
|
376
|
-
return {
|
|
377
|
-
skipped: false,
|
|
378
|
-
ok: false,
|
|
379
|
-
detail: String(r.stderr || '').split('\n').slice(0, 6).join('\n').trim(),
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function print(results) {
|
|
384
|
-
const icon = { PASS: '✅', WARN: '⚠️ ', FAIL: '❌' };
|
|
385
|
-
for (const r of results) console.log(`${icon[r.level]} ${r.msg}`);
|
|
386
|
-
const fails = results.filter((r) => r.level === 'FAIL').length;
|
|
387
|
-
const warns = results.filter((r) => r.level === 'WARN').length;
|
|
388
|
-
console.log(`\ndoctor:${results.length - fails - warns} PASS | ${warns} WARN | ${fails} FAIL`);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
export function checkLedgerCoverage(target, pkgRoot) {
|
|
392
|
-
const kitPath = path.join(target, '.agents', 'kit.json');
|
|
393
|
-
if (!fs.existsSync(kitPath)) return { missing: [], total: 0, skipped: true, note: 'kit.json 不存在' };
|
|
394
|
-
let kit;
|
|
395
|
-
try {
|
|
396
|
-
kit = JSON.parse(fs.readFileSync(kitPath, 'utf8'));
|
|
397
|
-
} catch (e) {
|
|
398
|
-
return { missing: [], total: 0, skipped: true, note: `kit.json 解析失败:${e.message}` };
|
|
399
|
-
}
|
|
400
|
-
if (!Array.isArray(kit.managed)) return { missing: [], total: 0, skipped: true, note: 'kit.json 无 managed 条目' };
|
|
401
|
-
// 无包源 = 装户环境:盘上没有 templates/,无法枚举应有清单,跳过
|
|
402
|
-
const tmplRoot = path.join(pkgRoot || '', 'templates');
|
|
403
|
-
if (!pkgRoot || !fs.existsSync(tmplRoot)) return { missing: [], total: 0, skipped: true, note: '无包源模板(templates/ 不存在)' };
|
|
404
|
-
|
|
405
|
-
// 应有清单 = 模板树 + 台账宿主层,排除 owned(与 src/sync.mjs 的 fresh 计算口径一致)
|
|
406
|
-
const expected = new Set(listTree(tmplRoot));
|
|
407
|
-
const hosts = Array.isArray(kit.options?.hosts) ? kit.options.hosts : [];
|
|
408
|
-
for (const h of hosts) {
|
|
409
|
-
if (!HOST_DIR[h]) continue;
|
|
410
|
-
const hostRoot = path.join(pkgRoot, 'modules', 'hosts', h);
|
|
411
|
-
if (!fs.existsSync(hostRoot)) continue;
|
|
412
|
-
for (const rel of listTree(hostRoot)) expected.add(`${HOST_DIR[h]}/${rel}`);
|
|
413
|
-
}
|
|
414
|
-
const ledger = new Set(kit.managed.map((f) => f.rel));
|
|
415
|
-
const missing = [...expected].filter((rel) => !ledger.has(rel) && !isOwned(rel)).sort();
|
|
416
|
-
return { missing, total: ledger.size, skipped: false };
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
// owned 漂移校验(独立 export 供 doctor 主流程 + 单元测试共用;2026-09-25 wf-runtime 复盘)
|
|
420
|
-
// 返回:{ drift, gone, total, skipped, error? }
|
|
421
|
-
// - skipped=true:kit.json 不存在或解析失败/无 owned 字段
|
|
422
|
-
// - drift:盘面 sha != kit.owned sha 的文件数
|
|
423
|
-
// - gone:盘面缺失的文件 rel 列表
|
|
424
|
-
// - total:kit.owned 列表总文件数
|
|
425
|
-
export function checkOwnedDrift(target) {
|
|
426
|
-
const kitPath = path.join(target, '.agents', 'kit.json');
|
|
427
|
-
if (!fs.existsSync(kitPath)) return { drift: 0, gone: [], total: 0, skipped: true };
|
|
428
|
-
let kit;
|
|
429
|
-
try {
|
|
430
|
-
kit = JSON.parse(fs.readFileSync(kitPath, 'utf8'));
|
|
431
|
-
} catch (e) {
|
|
432
|
-
return { drift: 0, gone: [], total: 0, skipped: true, error: e.message };
|
|
433
|
-
}
|
|
434
|
-
const owned = Array.isArray(kit.owned) ? kit.owned : [];
|
|
435
|
-
if (owned.length === 0) return { drift: 0, gone: [], total: 0, skipped: true };
|
|
436
|
-
let drift = 0;
|
|
437
|
-
const gone = [];
|
|
438
|
-
for (const f of owned) {
|
|
439
|
-
const p = path.join(target, f.rel);
|
|
440
|
-
if (!fs.existsSync(p)) { gone.push(f.rel); continue; }
|
|
441
|
-
// sha 按 LF 归一口径(同 rule-budgets「索引/HEAD 字节」约定):盘面 CRLF(autocrlf 检出)与克隆检出 LF
|
|
442
|
-
// 须同值,否则跨环境必漂移(CI 克隆 §6.6 必红——2026-09-27 gate-coverage 复核 P1-1 根因;owned 均为文本件)
|
|
443
|
-
const h = createHash('sha256').update(fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n'), 'utf8').digest('hex');
|
|
444
|
-
if (h !== f.sha256) drift++;
|
|
445
|
-
}
|
|
446
|
-
return { drift, gone, total: owned.length, skipped: false };
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
// ---- 门禁信任档(2026-10-12 gate-trust-level)----
|
|
450
|
-
// 单源:本文件(doctor §6.6b 判定 + init.mjs 写 kit.json 默认值,两处 import 同一份——
|
|
451
|
-
// 装户侧不消费(kit.json 是包源 CLI 写的台账),故不落 templates/_agents/scripts/policy.mjs:
|
|
452
|
-
// 放那边会让装副本带一个它自己不用的判据,两处真值反而更多。两档语义:
|
|
453
|
-
// 'project'(默认):gate 安装锚失配 = **WARN**。装户对门有最终所有权——锚只提供可见性,
|
|
454
|
-
// 有意改动知悉即可。这是 1.7.11 起的现状,本档只是把隐式默认显式命名为「项目自治」。
|
|
455
|
-
// 'org':失配 = **FAIL**(doctor exit 1)。给多仓/组织场景一个真实的强制位——对齐 Claude Code 的
|
|
456
|
-
// managed policy + allowManagedHooksOnly(组织级强制 + 可屏蔽项目自定义 hook)。
|
|
457
|
-
// 为什么**不把默认改成 org**:本仓诚实边界声明写明「门禁关不掉通道」(台账可写、哈希链防不住整文件
|
|
458
|
-
// 重写)。把可见性升成强制而不同步补上「组织侧锚源的不可篡改性」,等于宣称一个关不掉的通道能关——
|
|
459
|
-
// 那比 WARN 更不可信。默认档与现行为逐字一致(零行为变化),要升的人显式改 kit.json 并自行承担
|
|
460
|
-
// 「组织必须同步管住锚来源」的责任。
|
|
461
|
-
// 非法值 / 缺键(旧台账)→ 回退 'project'(= 零行为变化,**绝不因非法配置变严**)。
|
|
462
|
-
export const GATE_TRUST_LEVELS = ['project', 'org'];
|
|
463
|
-
export const GATE_TRUST_DEFAULT = 'project';
|
|
464
|
-
export function gateTrustOf(kit) {
|
|
465
|
-
const v = kit && kit.gateTrust;
|
|
466
|
-
return GATE_TRUST_LEVELS.includes(v) ? v : GATE_TRUST_DEFAULT;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
// gate 安装锚校验(独立 export 供 doctor 主流程 + 单元测试共用;2026-10-11 P3-1 gate 防改锚)
|
|
470
|
-
// 判据:kit.owned 中 rel 以 .agents/hooks/ 开头且带 srcSha256 的条目(=add-gate 逐字拷贝安装的 gate 脚本,
|
|
471
|
-
// 锚语义见 src/add-gate.mjs 头注),按 LF 归一算盘面 sha(与 checkOwnedDrift 同口径)比对锚。
|
|
472
|
-
// local-pre-commit 须排除:它是合并接线件,其 srcSha256 由 init/sync 按「模板语义」写(≠ 逐字拷贝锚),
|
|
473
|
-
// 且盘面含各门挂载行——纳入必恒失配误报。
|
|
474
|
-
// 不阻断(默认 'project' 档):装户对门有最终所有权,锚只提供可见性(2026-10-10 调研
|
|
475
|
-
// 「gate 装户可改、hard 项缺防改」结论)。'org' 档(2026-10-12 gate-trust-level,判据单源
|
|
476
|
-
// policy.mjs#gateTrustOf)下失配升 FAIL —— 多仓/组织场景的组织级强制位,对齐 managed policy。
|
|
477
|
-
// 返回:{ total, mismatch, gone, skipped, error?, trust }
|
|
478
|
-
export function checkGateAnchors(target) {
|
|
479
|
-
const kitPath = path.join(target, '.agents', 'kit.json');
|
|
480
|
-
if (!fs.existsSync(kitPath)) return { total: 0, mismatch: [], gone: [], skipped: true };
|
|
481
|
-
let kit;
|
|
482
|
-
try {
|
|
483
|
-
kit = JSON.parse(fs.readFileSync(kitPath, 'utf8'));
|
|
484
|
-
} catch (e) {
|
|
485
|
-
return { total: 0, mismatch: [], gone: [], skipped: true, error: e.message };
|
|
486
|
-
}
|
|
487
|
-
const trust = gateTrustOf(kit); // 缺键/非法 → 'project'(零行为变化)
|
|
488
|
-
const owned = Array.isArray(kit.owned) ? kit.owned : [];
|
|
489
|
-
const anchored = owned.filter((f) => f.rel.startsWith('.agents/hooks/')
|
|
490
|
-
&& f.rel !== '.agents/hooks/local-pre-commit' // 合并接线件,srcSha256 是模板语义锚,非逐字拷贝锚(见上)
|
|
491
|
-
&& typeof f.srcSha256 === 'string' && f.srcSha256);
|
|
492
|
-
if (anchored.length === 0) return { total: 0, mismatch: [], gone: [], skipped: true, trust };
|
|
493
|
-
const mismatch = [];
|
|
494
|
-
const gone = [];
|
|
495
|
-
for (const f of anchored) {
|
|
496
|
-
const p = path.join(target, f.rel);
|
|
497
|
-
if (!fs.existsSync(p)) { gone.push(f.rel); continue; }
|
|
498
|
-
// sha 按 LF 归一口径(同 checkOwnedDrift):CRLF 盘面(autocrlf 检出)与锚不误报
|
|
499
|
-
const h = createHash('sha256').update(fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n'), 'utf8').digest('hex');
|
|
500
|
-
if (h !== f.srcSha256) mismatch.push(f.rel);
|
|
501
|
-
}
|
|
502
|
-
return { total: anchored.length, mismatch, gone, skipped: false, trust };
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
// 模板下发感知(2026-10-06 template-downstream):只读判据——owned 模板条目三方 sha 比对,
|
|
506
|
-
// 判定单源 profiles.templateDriftOf(与 sync 出账同源,防两处字面量漂移)。恒不写 kit.json。
|
|
507
|
-
// 返回 { skipped, note?, total, stale[] }:skipped=true 时 note 说明原因(无 kit / 无 owned /
|
|
508
|
-
// 无锚——旧装户静默不追溯);total=参与比对的条目数;stale=stale-drift 的 rel 清单。
|
|
509
|
-
export function checkTemplateDrift(target, pkgRoot) {
|
|
510
|
-
const kitPath = path.join(target, '.agents', 'kit.json');
|
|
511
|
-
if (!fs.existsSync(kitPath)) return { skipped: true, note: 'kit.json 不存在', total: 0, stale: [] };
|
|
512
|
-
let kit;
|
|
513
|
-
try {
|
|
514
|
-
kit = JSON.parse(fs.readFileSync(kitPath, 'utf8'));
|
|
515
|
-
} catch (e) {
|
|
516
|
-
return { skipped: true, note: `kit.json 解析失败:${e.message}`, total: 0, stale: [] };
|
|
517
|
-
}
|
|
518
|
-
if (!pkgRoot) return { skipped: true, note: '无包源根', total: 0, stale: [] };
|
|
519
|
-
const owned = Array.isArray(kit.owned) ? kit.owned : [];
|
|
520
|
-
if (owned.length === 0) return { skipped: true, note: 'kit.json 无 owned 条目', total: 0, stale: [] };
|
|
521
|
-
const shaText = (p) => createHash('sha256').update(fs.readFileSync(p, 'utf8').replace(/\r\n/g, '\n'), 'utf8').digest('hex');
|
|
522
|
-
const stale = [];
|
|
523
|
-
let total = 0;
|
|
524
|
-
let anchored = 0;
|
|
525
|
-
for (const f of owned) {
|
|
526
|
-
if (TEMPLATE_DRIFT_EXCLUDE.has(f.rel)) continue;
|
|
527
|
-
const src = srcTemplatePath(pkgRoot, f.rel);
|
|
528
|
-
if (!src) continue;
|
|
529
|
-
total++;
|
|
530
|
-
if (typeof f.srcSha256 !== 'string' || !f.srcSha256) continue; // no-anchor:旧装户静默跳过
|
|
531
|
-
anchored++;
|
|
532
|
-
const srcCur = shaText(src);
|
|
533
|
-
const diskPath = path.join(target, f.rel);
|
|
534
|
-
const disk = fs.existsSync(diskPath) ? shaText(diskPath) : null;
|
|
535
|
-
if (templateDriftOf({ disk, srcRecord: f.srcSha256, srcCur }) === 'stale-drift') stale.push(f.rel);
|
|
536
|
-
}
|
|
537
|
-
if (anchored === 0) return { skipped: true, note: 'owned 模板条目均无 srcSha256 锚(旧装户,下次 sync 写锚后生效)', total: 0, stale: [] };
|
|
538
|
-
return { skipped: false, total, stale };
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// 跨宿主薄适配正文段漂移校验(独立 export 供 doctor 主流程 + 单元测试共用;2026-09-25 cross-host-sync)
|
|
542
|
-
// 装户侧视角:.agents/{commands,roles}/*.md 是权威源;4 宿主目录(zcode→.zcode、omp→.omp、
|
|
543
|
-
// opencode→.opencode、trae→.trae)下 {agents,commands}/*.md 是薄适配。按正文段 sha 比对
|
|
544
|
-
// (B-b 语义;frontmatter 不计入漂移);commands 层映射走 HOSTS.commandPrefix 前缀(2026-09-28 起
|
|
545
|
-
// opencode 与 trae 同为 wf- 前缀,单源见 profiles.mjs;roles 层映射全宿主无前缀)。
|
|
546
|
-
// 返回:{ drift, total, skipped, note? }
|
|
547
|
-
// - skipped=true:权威源目录不存在 / 包源环境 / 无 .md 文件
|
|
548
|
-
// - drift:权威源正文段与薄适配正文段 sha 不一致的对数
|
|
549
|
-
// - total:参与比对的对数(权威源文件 × 适配数)
|
|
550
|
-
export function checkAdapterDrift(target) {
|
|
551
|
-
const authorityRoot = path.join(target, '.agents');
|
|
552
|
-
if (!fs.existsSync(authorityRoot)) return { drift: 0, total: 0, skipped: true, note: '.agents 目录不存在' };
|
|
553
|
-
// 包源环境检测:包源仓库同时含 templates/ 与 modules/,装户不应有;包源下跑 doctor §7.x 永远是
|
|
554
|
-
// drift(装副本是历史 init 渲染产物,不会随包源改动而重渲),无信息价值——直接 skip
|
|
555
|
-
if (fs.existsSync(path.join(target, 'templates', '_agents')) && fs.existsSync(path.join(target, 'modules', 'hosts'))) {
|
|
556
|
-
return { drift: 0, total: 0, skipped: true, note: '包源环境(templates/ + modules/ 同时存在)——§7.x 仅在装户环境有意义' };
|
|
557
|
-
}
|
|
558
|
-
// 4 宿主目录映射(与顶层 HOST_DIR 同源)
|
|
559
|
-
// splitFm/bodySha 单源复用 sync-hosts(2026-10-11 bodysha-single-source:此前内联第二份实现靠
|
|
560
|
-
// 注释约束同口径,收敛为 import 消灭漂移面)
|
|
561
|
-
let total = 0;
|
|
562
|
-
let drift = 0;
|
|
563
|
-
const listMd = (dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory() ? fs.readdirSync(dir).filter((f) => f.endsWith('.md')) : [];
|
|
564
|
-
for (const sub of ['commands', 'roles']) {
|
|
565
|
-
const subAbs = path.join(authorityRoot, sub);
|
|
566
|
-
for (const f of listMd(subAbs)) {
|
|
567
|
-
const authRel = `${sub}/${f}`;
|
|
568
|
-
const authSha = bodySha(path.join(authorityRoot, authRel));
|
|
569
|
-
const name = f.slice(0, -'.md'.length);
|
|
570
|
-
// 构建映射:commands/* → 每个带 commandPrefix 的宿主 commands/<prefix><name>.md(单源 profiles.mjs#HOSTS);
|
|
571
|
-
// roles/* → 4 宿主 agents/<name>.md(无前缀)
|
|
572
|
-
const targets = [];
|
|
573
|
-
if (sub === 'commands') {
|
|
574
|
-
for (const [dir, prefix] of HOST_CMD_DIR) targets.push([dir, 'commands', `${prefix}${name}.md`]);
|
|
575
|
-
} else {
|
|
576
|
-
for (const h of Object.keys(HOST_DIR)) targets.push([HOST_DIR[h], 'agents', `${name}.md`]);
|
|
577
|
-
}
|
|
578
|
-
for (const [hostDir, subDir, fileName] of targets) {
|
|
579
|
-
const adapterAbs = path.join(target, hostDir, subDir, fileName);
|
|
580
|
-
const adapterSha = bodySha(adapterAbs);
|
|
581
|
-
if (adapterSha === null) continue; // 缺失不在 drift 统计(apply 不自动创建)
|
|
582
|
-
total++;
|
|
583
|
-
if (authSha !== adapterSha) drift++;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
if (total === 0) return { drift: 0, total: 0, skipped: true, note: '权威源无 commands/roles .md 文件' };
|
|
588
|
-
return { drift, total, skipped: false };
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
// delegations 月度聚合快照新鲜度(独立 export 供 doctor 主流程 + 单元测试共用;2026-09-29 p0-gate-noise-batch)
|
|
592
|
-
// 返回:{ stale, ledgerMonth, snapshotMonth, skipped, note? }
|
|
593
|
-
// - skipped=true:delegations.md 不存在 / 无台账数据行 → doctor 记 PASS(跳过),不误报 fresh 装户
|
|
594
|
-
// - stale=true:快照行缺失 或 快照最新月 < 台账数据行最新月
|
|
595
|
-
// - ledgerMonth:台账数据行首列(YYYY-MM-DD)中最大 YYYY-MM
|
|
596
|
-
// - snapshotMonth:快照行首列(YYYY-MM)中最大 YYYY-MM(无快照行则 null)
|
|
597
|
-
export function checkDelegationSnapshotFreshness(target) {
|
|
598
|
-
const file = path.join(target, 'workflow', 'delegations.md');
|
|
599
|
-
if (!fs.existsSync(file)) return { stale: false, ledgerMonth: null, snapshotMonth: null, skipped: true, note: 'delegations.md 不存在' };
|
|
600
|
-
let text;
|
|
601
|
-
// 分片感知读(2026-10-13 ledger-shard-ledgers):text = 主台账 ∪ delegations.d/*.md——数据行迁入
|
|
602
|
-
// 分片后 ledgerMonth 仍取全量数据行最大月,快照陈旧判定不失效(读侧单源 = ledger-shards.readLedgerText)。
|
|
603
|
-
try { text = readLedgerText(target, 'delegations'); } catch { return { stale: false, ledgerMonth: null, snapshotMonth: null, skipped: true, note: 'delegations.md 不可读' }; }
|
|
604
|
-
const lines = text.split(/\r?\n/);
|
|
605
|
-
let ledgerMonth = null;
|
|
606
|
-
let snapshotMonth = null;
|
|
607
|
-
let hasDataRows = false;
|
|
608
|
-
for (const line of lines) {
|
|
609
|
-
if (!/^\s*\|/.test(line)) continue;
|
|
610
|
-
const cells = line.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => c.trim());
|
|
611
|
-
if (!cells.length) continue;
|
|
612
|
-
// 台账数据行:首列 = YYYY-MM-DD
|
|
613
|
-
if (/^\d{4}-\d{2}-\d{2}$/.test(cells[0])) {
|
|
614
|
-
hasDataRows = true;
|
|
615
|
-
const m = cells[0].slice(0, 7);
|
|
616
|
-
if (!ledgerMonth || m > ledgerMonth) ledgerMonth = m;
|
|
617
|
-
continue;
|
|
618
|
-
}
|
|
619
|
-
// 快照行:首列 = YYYY-MM(与数据行正则互斥)
|
|
620
|
-
if (/^\d{4}-\d{2}$/.test(cells[0])) {
|
|
621
|
-
const m = cells[0];
|
|
622
|
-
if (!snapshotMonth || m > snapshotMonth) snapshotMonth = m;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
if (!hasDataRows) return { stale: false, ledgerMonth: null, snapshotMonth: null, skipped: true, note: '台账无数据行' };
|
|
626
|
-
if (!snapshotMonth) return { stale: true, ledgerMonth, snapshotMonth: null, skipped: false };
|
|
627
|
-
if (snapshotMonth < ledgerMonth) return { stale: true, ledgerMonth, snapshotMonth, skipped: false };
|
|
628
|
-
return { stale: false, ledgerMonth, snapshotMonth, skipped: false };
|
|
629
|
-
}
|