@jokerized/getresearchdone 0.4.1
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/.claude-plugin/plugin.json +103 -0
- package/README.md +211 -0
- package/agents/grd-baseline-assessor.md +684 -0
- package/agents/grd-code-reviewer.md +300 -0
- package/agents/grd-codebase-mapper.md +355 -0
- package/agents/grd-critique-agent.md +119 -0
- package/agents/grd-debugger.md +519 -0
- package/agents/grd-deep-diver.md +737 -0
- package/agents/grd-eval-planner.md +913 -0
- package/agents/grd-eval-reporter.md +717 -0
- package/agents/grd-executor.md +683 -0
- package/agents/grd-feasibility-analyst.md +624 -0
- package/agents/grd-integration-checker.md +367 -0
- package/agents/grd-knowledge-miner.md +81 -0
- package/agents/grd-migrator.md +88 -0
- package/agents/grd-phase-researcher.md +697 -0
- package/agents/grd-plan-checker.md +443 -0
- package/agents/grd-planner.md +1532 -0
- package/agents/grd-product-owner.md +562 -0
- package/agents/grd-project-researcher.md +513 -0
- package/agents/grd-research-synthesizer.md +273 -0
- package/agents/grd-roadmapper.md +798 -0
- package/agents/grd-surveyor.md +566 -0
- package/agents/grd-verifier.md +893 -0
- package/bin/gd.js +4 -0
- package/bin/gd.ts +227 -0
- package/bin/grd-manifest.js +4 -0
- package/bin/grd-manifest.ts +286 -0
- package/bin/grd-mcp-server.js +4 -0
- package/bin/grd-mcp-server.ts +124 -0
- package/bin/grd-tools.js +4 -0
- package/bin/grd-tools.ts +2471 -0
- package/bin/postinstall.js +4 -0
- package/bin/postinstall.ts +80 -0
- package/commands/add-phase.md +123 -0
- package/commands/add-todo.md +87 -0
- package/commands/assess-baseline.md +289 -0
- package/commands/autopilot.md +100 -0
- package/commands/autoplan.md +55 -0
- package/commands/check-todos.md +87 -0
- package/commands/compare-methods.md +262 -0
- package/commands/complete-milestone.md +225 -0
- package/commands/debug.md +372 -0
- package/commands/deep-dive.md +288 -0
- package/commands/discover.md +281 -0
- package/commands/discuss-phase.md +188 -0
- package/commands/discuss.md +55 -0
- package/commands/eval-report.md +310 -0
- package/commands/evolve.md +79 -0
- package/commands/execute-phase.md +1017 -0
- package/commands/feasibility.md +292 -0
- package/commands/help.md +407 -0
- package/commands/init.md +1508 -0
- package/commands/insert-phase.md +113 -0
- package/commands/iterate.md +327 -0
- package/commands/list-phase-assumptions.md +217 -0
- package/commands/long-term-roadmap.md +202 -0
- package/commands/map-codebase.md +111 -0
- package/commands/migrate.md +159 -0
- package/commands/new-milestone.md +169 -0
- package/commands/pause-work.md +83 -0
- package/commands/plan-milestone-gaps.md +373 -0
- package/commands/plan-phase.md +655 -0
- package/commands/principles.md +328 -0
- package/commands/product-plan.md +319 -0
- package/commands/progress.md +481 -0
- package/commands/quick.md +167 -0
- package/commands/reapply-patches.md +154 -0
- package/commands/remove-phase.md +97 -0
- package/commands/requirement.md +96 -0
- package/commands/resume-project.md +113 -0
- package/commands/settings.md +1144 -0
- package/commands/survey.md +242 -0
- package/commands/sync.md +246 -0
- package/commands/tracker-setup.md +322 -0
- package/commands/update.md +202 -0
- package/commands/verify-phase.md +335 -0
- package/commands/verify-work.md +701 -0
- package/commands/wireup.md +29 -0
- package/dist/bin/gd.d.ts +3 -0
- package/dist/bin/gd.d.ts.map +1 -0
- package/dist/bin/gd.js +178 -0
- package/dist/bin/gd.js.map +1 -0
- package/dist/bin/grd-manifest.d.ts +3 -0
- package/dist/bin/grd-manifest.d.ts.map +1 -0
- package/dist/bin/grd-manifest.js +202 -0
- package/dist/bin/grd-manifest.js.map +1 -0
- package/dist/bin/grd-mcp-server.d.ts +3 -0
- package/dist/bin/grd-mcp-server.d.ts.map +1 -0
- package/dist/bin/grd-mcp-server.js +71 -0
- package/dist/bin/grd-mcp-server.js.map +1 -0
- package/dist/bin/grd-tools.d.ts +3 -0
- package/dist/bin/grd-tools.d.ts.map +1 -0
- package/dist/bin/grd-tools.js +1680 -0
- package/dist/bin/grd-tools.js.map +1 -0
- package/dist/bin/postinstall.d.ts +3 -0
- package/dist/bin/postinstall.d.ts.map +1 -0
- package/dist/bin/postinstall.js +61 -0
- package/dist/bin/postinstall.js.map +1 -0
- package/dist/lib/autopilot-milestone.d.ts +2 -0
- package/dist/lib/autopilot-milestone.d.ts.map +1 -0
- package/dist/lib/autopilot-milestone.js +94 -0
- package/dist/lib/autopilot-milestone.js.map +1 -0
- package/dist/lib/autopilot-pipeline.d.ts +2 -0
- package/dist/lib/autopilot-pipeline.d.ts.map +1 -0
- package/dist/lib/autopilot-pipeline.js +830 -0
- package/dist/lib/autopilot-pipeline.js.map +1 -0
- package/dist/lib/autopilot-waves.d.ts +2 -0
- package/dist/lib/autopilot-waves.d.ts.map +1 -0
- package/dist/lib/autopilot-waves.js +266 -0
- package/dist/lib/autopilot-waves.js.map +1 -0
- package/dist/lib/autopilot.d.ts +2 -0
- package/dist/lib/autopilot.d.ts.map +1 -0
- package/dist/lib/autopilot.js +1314 -0
- package/dist/lib/autopilot.js.map +1 -0
- package/dist/lib/autoplan.d.ts +2 -0
- package/dist/lib/autoplan.d.ts.map +1 -0
- package/dist/lib/autoplan.js +198 -0
- package/dist/lib/autoplan.js.map +1 -0
- package/dist/lib/autoresearch.d.ts +2 -0
- package/dist/lib/autoresearch.d.ts.map +1 -0
- package/dist/lib/autoresearch.js +626 -0
- package/dist/lib/autoresearch.js.map +1 -0
- package/dist/lib/backend.d.ts +2 -0
- package/dist/lib/backend.d.ts.map +1 -0
- package/dist/lib/backend.js +1036 -0
- package/dist/lib/backend.js.map +1 -0
- package/dist/lib/benchmark.d.ts +99 -0
- package/dist/lib/benchmark.d.ts.map +1 -0
- package/dist/lib/benchmark.js +278 -0
- package/dist/lib/benchmark.js.map +1 -0
- package/dist/lib/citations.d.ts +2 -0
- package/dist/lib/citations.d.ts.map +1 -0
- package/dist/lib/citations.js +642 -0
- package/dist/lib/citations.js.map +1 -0
- package/dist/lib/cleanup.d.ts +2 -0
- package/dist/lib/cleanup.d.ts.map +1 -0
- package/dist/lib/cleanup.js +1222 -0
- package/dist/lib/cleanup.js.map +1 -0
- package/dist/lib/cli/adapters.d.ts +10 -0
- package/dist/lib/cli/adapters.d.ts.map +1 -0
- package/dist/lib/cli/adapters.js +27 -0
- package/dist/lib/cli/adapters.js.map +1 -0
- package/dist/lib/cli/agent.d.ts +17 -0
- package/dist/lib/cli/agent.d.ts.map +1 -0
- package/dist/lib/cli/agent.js +53 -0
- package/dist/lib/cli/agent.js.map +1 -0
- package/dist/lib/cli/index.d.ts +21 -0
- package/dist/lib/cli/index.d.ts.map +1 -0
- package/dist/lib/cli/index.js +264 -0
- package/dist/lib/cli/index.js.map +1 -0
- package/dist/lib/cli/output.d.ts +20 -0
- package/dist/lib/cli/output.d.ts.map +1 -0
- package/dist/lib/cli/output.js +22 -0
- package/dist/lib/cli/output.js.map +1 -0
- package/dist/lib/cli/scan-dispatch.d.ts +9 -0
- package/dist/lib/cli/scan-dispatch.d.ts.map +1 -0
- package/dist/lib/cli/scan-dispatch.js +107 -0
- package/dist/lib/cli/scan-dispatch.js.map +1 -0
- package/dist/lib/cli/tools.d.ts +16 -0
- package/dist/lib/cli/tools.d.ts.map +1 -0
- package/dist/lib/cli/tools.js +168 -0
- package/dist/lib/cli/tools.js.map +1 -0
- package/dist/lib/commands/_dashboard-parsers.d.ts +2 -0
- package/dist/lib/commands/_dashboard-parsers.d.ts.map +1 -0
- package/dist/lib/commands/_dashboard-parsers.js +192 -0
- package/dist/lib/commands/_dashboard-parsers.js.map +1 -0
- package/dist/lib/commands/analysis.d.ts +2 -0
- package/dist/lib/commands/analysis.d.ts.map +1 -0
- package/dist/lib/commands/analysis.js +1418 -0
- package/dist/lib/commands/analysis.js.map +1 -0
- package/dist/lib/commands/assumptions.d.ts +2 -0
- package/dist/lib/commands/assumptions.d.ts.map +1 -0
- package/dist/lib/commands/assumptions.js +166 -0
- package/dist/lib/commands/assumptions.js.map +1 -0
- package/dist/lib/commands/blame.d.ts +2 -0
- package/dist/lib/commands/blame.d.ts.map +1 -0
- package/dist/lib/commands/blame.js +133 -0
- package/dist/lib/commands/blame.js.map +1 -0
- package/dist/lib/commands/budget.d.ts +2 -0
- package/dist/lib/commands/budget.d.ts.map +1 -0
- package/dist/lib/commands/budget.js +100 -0
- package/dist/lib/commands/budget.js.map +1 -0
- package/dist/lib/commands/check-plans.d.ts +2 -0
- package/dist/lib/commands/check-plans.d.ts.map +1 -0
- package/dist/lib/commands/check-plans.js +190 -0
- package/dist/lib/commands/check-plans.js.map +1 -0
- package/dist/lib/commands/config.d.ts +2 -0
- package/dist/lib/commands/config.d.ts.map +1 -0
- package/dist/lib/commands/config.js +188 -0
- package/dist/lib/commands/config.js.map +1 -0
- package/dist/lib/commands/dashboard.d.ts +2 -0
- package/dist/lib/commands/dashboard.d.ts.map +1 -0
- package/dist/lib/commands/dashboard.js +466 -0
- package/dist/lib/commands/dashboard.js.map +1 -0
- package/dist/lib/commands/estimate.d.ts +2 -0
- package/dist/lib/commands/estimate.d.ts.map +1 -0
- package/dist/lib/commands/estimate.js +148 -0
- package/dist/lib/commands/estimate.js.map +1 -0
- package/dist/lib/commands/eval-diff.d.ts +2 -0
- package/dist/lib/commands/eval-diff.d.ts.map +1 -0
- package/dist/lib/commands/eval-diff.js +213 -0
- package/dist/lib/commands/eval-diff.js.map +1 -0
- package/dist/lib/commands/freshness.d.ts +2 -0
- package/dist/lib/commands/freshness.d.ts.map +1 -0
- package/dist/lib/commands/freshness.js +163 -0
- package/dist/lib/commands/freshness.js.map +1 -0
- package/dist/lib/commands/health.d.ts +2 -0
- package/dist/lib/commands/health.d.ts.map +1 -0
- package/dist/lib/commands/health.js +435 -0
- package/dist/lib/commands/health.js.map +1 -0
- package/dist/lib/commands/index.d.ts +2 -0
- package/dist/lib/commands/index.d.ts.map +1 -0
- package/dist/lib/commands/index.js +128 -0
- package/dist/lib/commands/index.js.map +1 -0
- package/dist/lib/commands/install.d.ts +56 -0
- package/dist/lib/commands/install.d.ts.map +1 -0
- package/dist/lib/commands/install.js +214 -0
- package/dist/lib/commands/install.js.map +1 -0
- package/dist/lib/commands/knowhow-aggregator.d.ts +2 -0
- package/dist/lib/commands/knowhow-aggregator.d.ts.map +1 -0
- package/dist/lib/commands/knowhow-aggregator.js +279 -0
- package/dist/lib/commands/knowhow-aggregator.js.map +1 -0
- package/dist/lib/commands/knowledge-search.d.ts +2 -0
- package/dist/lib/commands/knowledge-search.d.ts.map +1 -0
- package/dist/lib/commands/knowledge-search.js +113 -0
- package/dist/lib/commands/knowledge-search.js.map +1 -0
- package/dist/lib/commands/long-term-roadmap.d.ts +2 -0
- package/dist/lib/commands/long-term-roadmap.d.ts.map +1 -0
- package/dist/lib/commands/long-term-roadmap.js +272 -0
- package/dist/lib/commands/long-term-roadmap.js.map +1 -0
- package/dist/lib/commands/patterns.d.ts +91 -0
- package/dist/lib/commands/patterns.d.ts.map +1 -0
- package/dist/lib/commands/patterns.js +391 -0
- package/dist/lib/commands/patterns.js.map +1 -0
- package/dist/lib/commands/phase-info.d.ts +2 -0
- package/dist/lib/commands/phase-info.d.ts.map +1 -0
- package/dist/lib/commands/phase-info.js +509 -0
- package/dist/lib/commands/phase-info.js.map +1 -0
- package/dist/lib/commands/plan-lint.d.ts +56 -0
- package/dist/lib/commands/plan-lint.d.ts.map +1 -0
- package/dist/lib/commands/plan-lint.js +481 -0
- package/dist/lib/commands/plan-lint.js.map +1 -0
- package/dist/lib/commands/plan-phase.d.ts +53 -0
- package/dist/lib/commands/plan-phase.d.ts.map +1 -0
- package/dist/lib/commands/plan-phase.js +288 -0
- package/dist/lib/commands/plan-phase.js.map +1 -0
- package/dist/lib/commands/progress.d.ts +2 -0
- package/dist/lib/commands/progress.d.ts.map +1 -0
- package/dist/lib/commands/progress.js +266 -0
- package/dist/lib/commands/progress.js.map +1 -0
- package/dist/lib/commands/quality.d.ts +2 -0
- package/dist/lib/commands/quality.d.ts.map +1 -0
- package/dist/lib/commands/quality.js +80 -0
- package/dist/lib/commands/quality.js.map +1 -0
- package/dist/lib/commands/rollback.d.ts +2 -0
- package/dist/lib/commands/rollback.d.ts.map +1 -0
- package/dist/lib/commands/rollback.js +145 -0
- package/dist/lib/commands/rollback.js.map +1 -0
- package/dist/lib/commands/scan.d.ts +25 -0
- package/dist/lib/commands/scan.d.ts.map +1 -0
- package/dist/lib/commands/scan.js +28 -0
- package/dist/lib/commands/scan.js.map +1 -0
- package/dist/lib/commands/search.d.ts +2 -0
- package/dist/lib/commands/search.d.ts.map +1 -0
- package/dist/lib/commands/search.js +212 -0
- package/dist/lib/commands/search.js.map +1 -0
- package/dist/lib/commands/select-candidate.d.ts +128 -0
- package/dist/lib/commands/select-candidate.d.ts.map +1 -0
- package/dist/lib/commands/select-candidate.js +518 -0
- package/dist/lib/commands/select-candidate.js.map +1 -0
- package/dist/lib/commands/singularity.d.ts +2 -0
- package/dist/lib/commands/singularity.d.ts.map +1 -0
- package/dist/lib/commands/singularity.js +185 -0
- package/dist/lib/commands/singularity.js.map +1 -0
- package/dist/lib/commands/slug-timestamp.d.ts +2 -0
- package/dist/lib/commands/slug-timestamp.d.ts.map +1 -0
- package/dist/lib/commands/slug-timestamp.js +54 -0
- package/dist/lib/commands/slug-timestamp.js.map +1 -0
- package/dist/lib/commands/tail.d.ts +2 -0
- package/dist/lib/commands/tail.d.ts.map +1 -0
- package/dist/lib/commands/tail.js +100 -0
- package/dist/lib/commands/tail.js.map +1 -0
- package/dist/lib/commands/todo.d.ts +2 -0
- package/dist/lib/commands/todo.d.ts.map +1 -0
- package/dist/lib/commands/todo.js +200 -0
- package/dist/lib/commands/todo.js.map +1 -0
- package/dist/lib/commands/watch.d.ts +2 -0
- package/dist/lib/commands/watch.d.ts.map +1 -0
- package/dist/lib/commands/watch.js +72 -0
- package/dist/lib/commands/watch.js.map +1 -0
- package/dist/lib/complexity.d.ts +55 -0
- package/dist/lib/complexity.d.ts.map +1 -0
- package/dist/lib/complexity.js +80 -0
- package/dist/lib/complexity.js.map +1 -0
- package/dist/lib/context/agents.d.ts +2 -0
- package/dist/lib/context/agents.d.ts.map +1 -0
- package/dist/lib/context/agents.js +344 -0
- package/dist/lib/context/agents.js.map +1 -0
- package/dist/lib/context/base.d.ts +2 -0
- package/dist/lib/context/base.d.ts.map +1 -0
- package/dist/lib/context/base.js +81 -0
- package/dist/lib/context/base.js.map +1 -0
- package/dist/lib/context/execute.d.ts +2 -0
- package/dist/lib/context/execute.d.ts.map +1 -0
- package/dist/lib/context/execute.js +753 -0
- package/dist/lib/context/execute.js.map +1 -0
- package/dist/lib/context/index.d.ts +2 -0
- package/dist/lib/context/index.d.ts.map +1 -0
- package/dist/lib/context/index.js +88 -0
- package/dist/lib/context/index.js.map +1 -0
- package/dist/lib/context/progress.d.ts +2 -0
- package/dist/lib/context/progress.d.ts.map +1 -0
- package/dist/lib/context/progress.js +178 -0
- package/dist/lib/context/progress.js.map +1 -0
- package/dist/lib/context/project.d.ts +2 -0
- package/dist/lib/context/project.d.ts.map +1 -0
- package/dist/lib/context/project.js +413 -0
- package/dist/lib/context/project.js.map +1 -0
- package/dist/lib/context/research.d.ts +2 -0
- package/dist/lib/context/research.d.ts.map +1 -0
- package/dist/lib/context/research.js +466 -0
- package/dist/lib/context/research.js.map +1 -0
- package/dist/lib/dead-ends.d.ts +28 -0
- package/dist/lib/dead-ends.d.ts.map +1 -0
- package/dist/lib/dead-ends.js +451 -0
- package/dist/lib/dead-ends.js.map +1 -0
- package/dist/lib/deps.d.ts +2 -0
- package/dist/lib/deps.d.ts.map +1 -0
- package/dist/lib/deps.js +630 -0
- package/dist/lib/deps.js.map +1 -0
- package/dist/lib/discussion.d.ts +2 -0
- package/dist/lib/discussion.d.ts.map +1 -0
- package/dist/lib/discussion.js +1041 -0
- package/dist/lib/discussion.js.map +1 -0
- package/dist/lib/drift.d.ts +36 -0
- package/dist/lib/drift.d.ts.map +1 -0
- package/dist/lib/drift.js +481 -0
- package/dist/lib/drift.js.map +1 -0
- package/dist/lib/evolve/_dimensions-features.d.ts +2 -0
- package/dist/lib/evolve/_dimensions-features.d.ts.map +1 -0
- package/dist/lib/evolve/_dimensions-features.js +369 -0
- package/dist/lib/evolve/_dimensions-features.js.map +1 -0
- package/dist/lib/evolve/_dimensions.d.ts +2 -0
- package/dist/lib/evolve/_dimensions.d.ts.map +1 -0
- package/dist/lib/evolve/_dimensions.js +358 -0
- package/dist/lib/evolve/_dimensions.js.map +1 -0
- package/dist/lib/evolve/_product-ideation.d.ts +2 -0
- package/dist/lib/evolve/_product-ideation.d.ts.map +1 -0
- package/dist/lib/evolve/_product-ideation.js +281 -0
- package/dist/lib/evolve/_product-ideation.js.map +1 -0
- package/dist/lib/evolve/_prompts.d.ts +2 -0
- package/dist/lib/evolve/_prompts.d.ts.map +1 -0
- package/dist/lib/evolve/_prompts.js +153 -0
- package/dist/lib/evolve/_prompts.js.map +1 -0
- package/dist/lib/evolve/cli.d.ts +2 -0
- package/dist/lib/evolve/cli.d.ts.map +1 -0
- package/dist/lib/evolve/cli.js +224 -0
- package/dist/lib/evolve/cli.js.map +1 -0
- package/dist/lib/evolve/discovery.d.ts +2 -0
- package/dist/lib/evolve/discovery.d.ts.map +1 -0
- package/dist/lib/evolve/discovery.js +391 -0
- package/dist/lib/evolve/discovery.js.map +1 -0
- package/dist/lib/evolve/index.d.ts +2 -0
- package/dist/lib/evolve/index.d.ts.map +1 -0
- package/dist/lib/evolve/index.js +88 -0
- package/dist/lib/evolve/index.js.map +1 -0
- package/dist/lib/evolve/orchestrator.d.ts +2 -0
- package/dist/lib/evolve/orchestrator.d.ts.map +1 -0
- package/dist/lib/evolve/orchestrator.js +851 -0
- package/dist/lib/evolve/orchestrator.js.map +1 -0
- package/dist/lib/evolve/scoring.d.ts +2 -0
- package/dist/lib/evolve/scoring.d.ts.map +1 -0
- package/dist/lib/evolve/scoring.js +118 -0
- package/dist/lib/evolve/scoring.js.map +1 -0
- package/dist/lib/evolve/state.d.ts +2 -0
- package/dist/lib/evolve/state.d.ts.map +1 -0
- package/dist/lib/evolve/state.js +264 -0
- package/dist/lib/evolve/state.js.map +1 -0
- package/dist/lib/evolve/types.d.ts +249 -0
- package/dist/lib/evolve/types.d.ts.map +1 -0
- package/dist/lib/evolve/types.js +3 -0
- package/dist/lib/evolve/types.js.map +1 -0
- package/dist/lib/frontmatter.d.ts +2 -0
- package/dist/lib/frontmatter.d.ts.map +1 -0
- package/dist/lib/frontmatter.js +513 -0
- package/dist/lib/frontmatter.js.map +1 -0
- package/dist/lib/gates.d.ts +2 -0
- package/dist/lib/gates.d.ts.map +1 -0
- package/dist/lib/gates.js +578 -0
- package/dist/lib/gates.js.map +1 -0
- package/dist/lib/genome.d.ts +10 -0
- package/dist/lib/genome.d.ts.map +1 -0
- package/dist/lib/genome.js +368 -0
- package/dist/lib/genome.js.map +1 -0
- package/dist/lib/got.d.ts +2 -0
- package/dist/lib/got.d.ts.map +1 -0
- package/dist/lib/got.js +280 -0
- package/dist/lib/got.js.map +1 -0
- package/dist/lib/invariants.d.ts +2 -0
- package/dist/lib/invariants.d.ts.map +1 -0
- package/dist/lib/invariants.js +298 -0
- package/dist/lib/invariants.js.map +1 -0
- package/dist/lib/knowledge.d.ts +2 -0
- package/dist/lib/knowledge.d.ts.map +1 -0
- package/dist/lib/knowledge.js +658 -0
- package/dist/lib/knowledge.js.map +1 -0
- package/dist/lib/long-term-roadmap.d.ts +2 -0
- package/dist/lib/long-term-roadmap.d.ts.map +1 -0
- package/dist/lib/long-term-roadmap.js +602 -0
- package/dist/lib/long-term-roadmap.js.map +1 -0
- package/dist/lib/markdown-split.d.ts +2 -0
- package/dist/lib/markdown-split.d.ts.map +1 -0
- package/dist/lib/markdown-split.js +199 -0
- package/dist/lib/markdown-split.js.map +1 -0
- package/dist/lib/mcp-server.d.ts +2 -0
- package/dist/lib/mcp-server.d.ts.map +1 -0
- package/dist/lib/mcp-server.js +2424 -0
- package/dist/lib/mcp-server.js.map +1 -0
- package/dist/lib/metrics.d.ts +16 -0
- package/dist/lib/metrics.d.ts.map +1 -0
- package/dist/lib/metrics.js +48 -0
- package/dist/lib/metrics.js.map +1 -0
- package/dist/lib/overstory.d.ts +2 -0
- package/dist/lib/overstory.d.ts.map +1 -0
- package/dist/lib/overstory.js +211 -0
- package/dist/lib/overstory.js.map +1 -0
- package/dist/lib/parallel.d.ts +2 -0
- package/dist/lib/parallel.d.ts.map +1 -0
- package/dist/lib/parallel.js +349 -0
- package/dist/lib/parallel.js.map +1 -0
- package/dist/lib/paths.d.ts +2 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +254 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/phase-complete-llm.d.ts +22 -0
- package/dist/lib/phase-complete-llm.d.ts.map +1 -0
- package/dist/lib/phase-complete-llm.js +331 -0
- package/dist/lib/phase-complete-llm.js.map +1 -0
- package/dist/lib/phase-complete.d.ts +46 -0
- package/dist/lib/phase-complete.d.ts.map +1 -0
- package/dist/lib/phase-complete.js +278 -0
- package/dist/lib/phase-complete.js.map +1 -0
- package/dist/lib/phase-io.d.ts +2 -0
- package/dist/lib/phase-io.d.ts.map +1 -0
- package/dist/lib/phase-io.js +126 -0
- package/dist/lib/phase-io.js.map +1 -0
- package/dist/lib/phase.d.ts +2 -0
- package/dist/lib/phase.d.ts.map +1 -0
- package/dist/lib/phase.js +1344 -0
- package/dist/lib/phase.js.map +1 -0
- package/dist/lib/plan-tournament.d.ts +63 -0
- package/dist/lib/plan-tournament.d.ts.map +1 -0
- package/dist/lib/plan-tournament.js +353 -0
- package/dist/lib/plan-tournament.js.map +1 -0
- package/dist/lib/refinement.d.ts +74 -0
- package/dist/lib/refinement.d.ts.map +1 -0
- package/dist/lib/refinement.js +283 -0
- package/dist/lib/refinement.js.map +1 -0
- package/dist/lib/requirements.d.ts +2 -0
- package/dist/lib/requirements.d.ts.map +1 -0
- package/dist/lib/requirements.js +355 -0
- package/dist/lib/requirements.js.map +1 -0
- package/dist/lib/research-bundle.d.ts +2 -0
- package/dist/lib/research-bundle.d.ts.map +1 -0
- package/dist/lib/research-bundle.js +246 -0
- package/dist/lib/research-bundle.js.map +1 -0
- package/dist/lib/roadmap.d.ts +2 -0
- package/dist/lib/roadmap.d.ts.map +1 -0
- package/dist/lib/roadmap.js +541 -0
- package/dist/lib/roadmap.js.map +1 -0
- package/dist/lib/sample.d.ts +16 -0
- package/dist/lib/sample.d.ts.map +1 -0
- package/dist/lib/sample.js +20 -0
- package/dist/lib/sample.js.map +1 -0
- package/dist/lib/scaffold.d.ts +2 -0
- package/dist/lib/scaffold.d.ts.map +1 -0
- package/dist/lib/scaffold.js +355 -0
- package/dist/lib/scaffold.js.map +1 -0
- package/dist/lib/scan/_utils.d.ts +11 -0
- package/dist/lib/scan/_utils.d.ts.map +1 -0
- package/dist/lib/scan/_utils.js +36 -0
- package/dist/lib/scan/_utils.js.map +1 -0
- package/dist/lib/scan/base64.d.ts +15 -0
- package/dist/lib/scan/base64.d.ts.map +1 -0
- package/dist/lib/scan/base64.js +66 -0
- package/dist/lib/scan/base64.js.map +1 -0
- package/dist/lib/scan/ignorefile.d.ts +30 -0
- package/dist/lib/scan/ignorefile.d.ts.map +1 -0
- package/dist/lib/scan/ignorefile.js +101 -0
- package/dist/lib/scan/ignorefile.js.map +1 -0
- package/dist/lib/scan/injection.d.ts +14 -0
- package/dist/lib/scan/injection.d.ts.map +1 -0
- package/dist/lib/scan/injection.js +39 -0
- package/dist/lib/scan/injection.js.map +1 -0
- package/dist/lib/scan/patterns.d.ts +17 -0
- package/dist/lib/scan/patterns.d.ts.map +1 -0
- package/dist/lib/scan/patterns.js +123 -0
- package/dist/lib/scan/patterns.js.map +1 -0
- package/dist/lib/scan/strip-markdown.d.ts +7 -0
- package/dist/lib/scan/strip-markdown.d.ts.map +1 -0
- package/dist/lib/scan/strip-markdown.js +38 -0
- package/dist/lib/scan/strip-markdown.js.map +1 -0
- package/dist/lib/scan/types.d.ts +23 -0
- package/dist/lib/scan/types.d.ts.map +1 -0
- package/dist/lib/scan/types.js +3 -0
- package/dist/lib/scan/types.js.map +1 -0
- package/dist/lib/scheduler-wait.d.ts +2 -0
- package/dist/lib/scheduler-wait.d.ts.map +1 -0
- package/dist/lib/scheduler-wait.js +59 -0
- package/dist/lib/scheduler-wait.js.map +1 -0
- package/dist/lib/scheduler.d.ts +254 -0
- package/dist/lib/scheduler.d.ts.map +1 -0
- package/dist/lib/scheduler.js +1147 -0
- package/dist/lib/scheduler.js.map +1 -0
- package/dist/lib/state.d.ts +2 -0
- package/dist/lib/state.d.ts.map +1 -0
- package/dist/lib/state.js +744 -0
- package/dist/lib/state.js.map +1 -0
- package/dist/lib/think.d.ts +18 -0
- package/dist/lib/think.d.ts.map +1 -0
- package/dist/lib/think.js +317 -0
- package/dist/lib/think.js.map +1 -0
- package/dist/lib/tracker.d.ts +2 -0
- package/dist/lib/tracker.d.ts.map +1 -0
- package/dist/lib/tracker.js +1121 -0
- package/dist/lib/tracker.js.map +1 -0
- package/dist/lib/types.d.ts +1514 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +4 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +1363 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/verify.d.ts +2 -0
- package/dist/lib/verify.d.ts.map +1 -0
- package/dist/lib/verify.js +1153 -0
- package/dist/lib/verify.js.map +1 -0
- package/dist/lib/wireup/autofix.d.ts +2 -0
- package/dist/lib/wireup/autofix.d.ts.map +1 -0
- package/dist/lib/wireup/autofix.js +188 -0
- package/dist/lib/wireup/autofix.js.map +1 -0
- package/dist/lib/wireup/cli.d.ts +2 -0
- package/dist/lib/wireup/cli.d.ts.map +1 -0
- package/dist/lib/wireup/cli.js +194 -0
- package/dist/lib/wireup/cli.js.map +1 -0
- package/dist/lib/wireup/detection.d.ts +47 -0
- package/dist/lib/wireup/detection.d.ts.map +1 -0
- package/dist/lib/wireup/detection.js +410 -0
- package/dist/lib/wireup/detection.js.map +1 -0
- package/dist/lib/wireup/discovery.d.ts +2 -0
- package/dist/lib/wireup/discovery.d.ts.map +1 -0
- package/dist/lib/wireup/discovery.js +934 -0
- package/dist/lib/wireup/discovery.js.map +1 -0
- package/dist/lib/wireup/execution.d.ts +2 -0
- package/dist/lib/wireup/execution.d.ts.map +1 -0
- package/dist/lib/wireup/execution.js +573 -0
- package/dist/lib/wireup/execution.js.map +1 -0
- package/dist/lib/wireup/index.d.ts +2 -0
- package/dist/lib/wireup/index.d.ts.map +1 -0
- package/dist/lib/wireup/index.js +85 -0
- package/dist/lib/wireup/index.js.map +1 -0
- package/dist/lib/wireup/orchestrator.d.ts +2 -0
- package/dist/lib/wireup/orchestrator.d.ts.map +1 -0
- package/dist/lib/wireup/orchestrator.js +366 -0
- package/dist/lib/wireup/orchestrator.js.map +1 -0
- package/dist/lib/wireup/report.d.ts +47 -0
- package/dist/lib/wireup/report.d.ts.map +1 -0
- package/dist/lib/wireup/report.js +201 -0
- package/dist/lib/wireup/report.js.map +1 -0
- package/dist/lib/wireup/scenarios.d.ts +2 -0
- package/dist/lib/wireup/scenarios.d.ts.map +1 -0
- package/dist/lib/wireup/scenarios.js +516 -0
- package/dist/lib/wireup/scenarios.js.map +1 -0
- package/dist/lib/wireup/state.d.ts +2 -0
- package/dist/lib/wireup/state.d.ts.map +1 -0
- package/dist/lib/wireup/state.js +102 -0
- package/dist/lib/wireup/state.js.map +1 -0
- package/dist/lib/wireup/types.d.ts +376 -0
- package/dist/lib/wireup/types.d.ts.map +1 -0
- package/dist/lib/wireup/types.js +3 -0
- package/dist/lib/wireup/types.js.map +1 -0
- package/dist/lib/worktree.d.ts +2 -0
- package/dist/lib/worktree.d.ts.map +1 -0
- package/dist/lib/worktree.js +999 -0
- package/dist/lib/worktree.js.map +1 -0
- package/lib/autopilot-milestone.ts +136 -0
- package/lib/autopilot-pipeline.ts +1179 -0
- package/lib/autopilot-waves.ts +361 -0
- package/lib/autopilot.ts +1874 -0
- package/lib/autoplan.ts +280 -0
- package/lib/autoresearch.js +4 -0
- package/lib/autoresearch.ts +886 -0
- package/lib/backend.ts +1252 -0
- package/lib/benchmark.ts +341 -0
- package/lib/citations.ts +760 -0
- package/lib/cleanup.ts +1588 -0
- package/lib/cli/adapters.ts +41 -0
- package/lib/cli/agent.ts +83 -0
- package/lib/cli/index.ts +273 -0
- package/lib/cli/output.ts +33 -0
- package/lib/cli/scan-dispatch.ts +130 -0
- package/lib/cli/tools.ts +198 -0
- package/lib/commands/_dashboard-parsers.ts +275 -0
- package/lib/commands/analysis.ts +1851 -0
- package/lib/commands/assumptions.ts +232 -0
- package/lib/commands/blame.ts +174 -0
- package/lib/commands/budget.ts +148 -0
- package/lib/commands/check-plans.ts +233 -0
- package/lib/commands/config.ts +287 -0
- package/lib/commands/dashboard.ts +680 -0
- package/lib/commands/estimate.ts +204 -0
- package/lib/commands/eval-diff.ts +252 -0
- package/lib/commands/freshness.ts +213 -0
- package/lib/commands/health.ts +607 -0
- package/lib/commands/index.ts +266 -0
- package/lib/commands/install.ts +307 -0
- package/lib/commands/knowhow-aggregator.ts +345 -0
- package/lib/commands/knowledge-search.ts +153 -0
- package/lib/commands/long-term-roadmap.ts +390 -0
- package/lib/commands/patterns.ts +465 -0
- package/lib/commands/phase-info.ts +698 -0
- package/lib/commands/plan-lint.ts +546 -0
- package/lib/commands/plan-phase.ts +375 -0
- package/lib/commands/progress.ts +319 -0
- package/lib/commands/quality.ts +138 -0
- package/lib/commands/rollback.ts +195 -0
- package/lib/commands/scan.ts +72 -0
- package/lib/commands/search.ts +300 -0
- package/lib/commands/select-candidate.ts +687 -0
- package/lib/commands/singularity.ts +222 -0
- package/lib/commands/slug-timestamp.ts +74 -0
- package/lib/commands/tail.ts +129 -0
- package/lib/commands/todo.ts +273 -0
- package/lib/commands/watch.ts +80 -0
- package/lib/complexity.ts +117 -0
- package/lib/context/agents.ts +505 -0
- package/lib/context/base.ts +123 -0
- package/lib/context/execute.ts +977 -0
- package/lib/context/index.ts +110 -0
- package/lib/context/progress.ts +278 -0
- package/lib/context/project.ts +531 -0
- package/lib/context/research.ts +646 -0
- package/lib/dead-ends.ts +506 -0
- package/lib/deps.ts +773 -0
- package/lib/discussion.ts +1275 -0
- package/lib/drift.ts +519 -0
- package/lib/evolve/_dimensions-features.ts +525 -0
- package/lib/evolve/_dimensions.ts +511 -0
- package/lib/evolve/_product-ideation.ts +405 -0
- package/lib/evolve/_prompts.ts +178 -0
- package/lib/evolve/cli.ts +330 -0
- package/lib/evolve/discovery.ts +571 -0
- package/lib/evolve/index.ts +105 -0
- package/lib/evolve/orchestrator.ts +1139 -0
- package/lib/evolve/scoring.ts +167 -0
- package/lib/evolve/state.ts +330 -0
- package/lib/evolve/types.ts +290 -0
- package/lib/frontmatter.ts +615 -0
- package/lib/gates.ts +695 -0
- package/lib/genome.ts +402 -0
- package/lib/got.js +4 -0
- package/lib/got.ts +361 -0
- package/lib/invariants.ts +378 -0
- package/lib/knowledge.ts +768 -0
- package/lib/long-term-roadmap.ts +806 -0
- package/lib/markdown-split.ts +273 -0
- package/lib/mcp-server.ts +3292 -0
- package/lib/metrics.ts +49 -0
- package/lib/overstory.ts +270 -0
- package/lib/parallel.ts +570 -0
- package/lib/paths.ts +293 -0
- package/lib/phase-complete-llm.ts +376 -0
- package/lib/phase-complete.ts +366 -0
- package/lib/phase-io.ts +101 -0
- package/lib/phase.ts +1981 -0
- package/lib/plan-tournament.ts +426 -0
- package/lib/refinement.ts +349 -0
- package/lib/requirements.ts +469 -0
- package/lib/research-bundle.ts +300 -0
- package/lib/roadmap.ts +775 -0
- package/lib/scaffold.ts +480 -0
- package/lib/scan/_utils.ts +37 -0
- package/lib/scan/base64.ts +90 -0
- package/lib/scan/ignorefile.ts +109 -0
- package/lib/scan/injection.ts +67 -0
- package/lib/scan/patterns.ts +139 -0
- package/lib/scan/strip-markdown.ts +39 -0
- package/lib/scan/types.ts +28 -0
- package/lib/scheduler-wait.ts +58 -0
- package/lib/scheduler.ts +1370 -0
- package/lib/state.ts +1000 -0
- package/lib/think.ts +365 -0
- package/lib/tracker.ts +1591 -0
- package/lib/types.ts +1663 -0
- package/lib/utils.ts +1479 -0
- package/lib/verify.ts +1434 -0
- package/lib/wireup/autofix.ts +241 -0
- package/lib/wireup/cli.ts +278 -0
- package/lib/wireup/detection.ts +542 -0
- package/lib/wireup/discovery.ts +1063 -0
- package/lib/wireup/execution.ts +686 -0
- package/lib/wireup/index.ts +117 -0
- package/lib/wireup/orchestrator.ts +519 -0
- package/lib/wireup/report.ts +286 -0
- package/lib/wireup/scenarios.ts +616 -0
- package/lib/wireup/state.ts +139 -0
- package/lib/wireup/types.ts +436 -0
- package/lib/worktree.ts +1309 -0
- package/package.json +67 -0
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** GRD Commands/PhaseInfo -- Phase lookup, model resolution, commit, plan indexing, summary extraction, history digest */
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
GrdConfig,
|
|
8
|
+
BackendId,
|
|
9
|
+
BackendCapabilities,
|
|
10
|
+
ModelTier,
|
|
11
|
+
FrontmatterObject,
|
|
12
|
+
AgentModelProfiles,
|
|
13
|
+
ExecGitResult,
|
|
14
|
+
} from '../types';
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const {
|
|
19
|
+
safeReadFile,
|
|
20
|
+
loadConfig,
|
|
21
|
+
isGitIgnored,
|
|
22
|
+
execGit,
|
|
23
|
+
normalizePhaseName,
|
|
24
|
+
MODEL_PROFILES,
|
|
25
|
+
output,
|
|
26
|
+
error,
|
|
27
|
+
}: {
|
|
28
|
+
safeReadFile: (p: string) => string | null;
|
|
29
|
+
loadConfig: (cwd: string) => GrdConfig;
|
|
30
|
+
isGitIgnored: (cwd: string, p: string) => boolean;
|
|
31
|
+
execGit: (cwd: string, args: string[]) => ExecGitResult;
|
|
32
|
+
normalizePhaseName: (phase: string) => string;
|
|
33
|
+
MODEL_PROFILES: AgentModelProfiles;
|
|
34
|
+
output: (result: unknown, raw: boolean, rawValue?: unknown) => never;
|
|
35
|
+
error: (message: string) => never;
|
|
36
|
+
} = require('../utils');
|
|
37
|
+
const {
|
|
38
|
+
extractFrontmatter,
|
|
39
|
+
}: {
|
|
40
|
+
extractFrontmatter: (content: string) => FrontmatterObject;
|
|
41
|
+
} = require('../frontmatter');
|
|
42
|
+
const {
|
|
43
|
+
detectBackend,
|
|
44
|
+
resolveBackendModel,
|
|
45
|
+
getBackendCapabilities,
|
|
46
|
+
getCachedModels,
|
|
47
|
+
}: {
|
|
48
|
+
detectBackend: (cwd: string) => BackendId;
|
|
49
|
+
resolveBackendModel: (
|
|
50
|
+
b: string,
|
|
51
|
+
t: ModelTier,
|
|
52
|
+
c?: Record<string, unknown>,
|
|
53
|
+
cwd?: string
|
|
54
|
+
) => string | undefined;
|
|
55
|
+
getBackendCapabilities: (b: string) => BackendCapabilities;
|
|
56
|
+
getCachedModels: (b: string, cwd?: string) => Record<string, string> | null;
|
|
57
|
+
} = require('../backend');
|
|
58
|
+
const {
|
|
59
|
+
phasesDir: getPhasesDirPath,
|
|
60
|
+
planningDir: getPlanningDir,
|
|
61
|
+
}: {
|
|
62
|
+
phasesDir: (cwd: string) => string;
|
|
63
|
+
planningDir: (cwd: string) => string;
|
|
64
|
+
} = require('../paths');
|
|
65
|
+
|
|
66
|
+
// ─── Domain Types ────────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
interface PlanIndexEntry {
|
|
69
|
+
id: string;
|
|
70
|
+
wave: number;
|
|
71
|
+
autonomous: boolean;
|
|
72
|
+
objective: string | null;
|
|
73
|
+
files_modified: string[];
|
|
74
|
+
task_count: number;
|
|
75
|
+
has_summary: boolean;
|
|
76
|
+
}
|
|
77
|
+
interface SummaryDecision {
|
|
78
|
+
summary: string;
|
|
79
|
+
rationale: string | null;
|
|
80
|
+
}
|
|
81
|
+
interface DigestPhaseEntry {
|
|
82
|
+
name: string;
|
|
83
|
+
provides: Set<string> | string[];
|
|
84
|
+
affects: Set<string> | string[];
|
|
85
|
+
patterns: Set<string> | string[];
|
|
86
|
+
}
|
|
87
|
+
interface HistoryDigest {
|
|
88
|
+
phases: Record<string, DigestPhaseEntry>;
|
|
89
|
+
decisions: { phase: string; decision: string }[];
|
|
90
|
+
tech_stack: Set<string> | string[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ─── Module-Level Caches ─────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
/** Cache for roadmap content reads across command calls. */
|
|
96
|
+
const _roadmapContentCache: Map<string, string> = new Map();
|
|
97
|
+
function readCachedRoadmap(roadmapPath: string): string | null {
|
|
98
|
+
if (!_roadmapContentCache.has(roadmapPath)) {
|
|
99
|
+
const content = safeReadFile(roadmapPath);
|
|
100
|
+
if (content !== null) _roadmapContentCache.set(roadmapPath, content);
|
|
101
|
+
return content;
|
|
102
|
+
}
|
|
103
|
+
return _roadmapContentCache.get(roadmapPath) ?? null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Cache for STATE.md reads across command calls. */
|
|
107
|
+
const _stateContentCache: Map<string, string> = new Map();
|
|
108
|
+
function readCachedState(statePath: string): string | null {
|
|
109
|
+
if (!_stateContentCache.has(statePath)) {
|
|
110
|
+
const content = safeReadFile(statePath);
|
|
111
|
+
if (content !== null) _stateContentCache.set(statePath, content);
|
|
112
|
+
return content;
|
|
113
|
+
}
|
|
114
|
+
return _stateContentCache.get(statePath) ?? null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ─── History Digest ─────────────────────────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
/** Aggregate metrics, decisions, and tech stack from all SUMMARY.md files. */
|
|
120
|
+
function cmdHistoryDigest(cwd: string, raw: boolean): void {
|
|
121
|
+
const phasesDir = getPhasesDirPath(cwd) as string;
|
|
122
|
+
const digest: HistoryDigest = { phases: {}, decisions: [], tech_stack: new Set<string>() };
|
|
123
|
+
|
|
124
|
+
if (!fs.existsSync(phasesDir)) {
|
|
125
|
+
(digest as unknown as Record<string, unknown>).tech_stack = [];
|
|
126
|
+
output(digest, raw, 'No phases found');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
try {
|
|
131
|
+
const phaseDirs: string[] = fs
|
|
132
|
+
.readdirSync(phasesDir, { withFileTypes: true })
|
|
133
|
+
.filter((e: { isDirectory: () => boolean }) => e.isDirectory())
|
|
134
|
+
.map((e: { name: string }) => e.name)
|
|
135
|
+
.sort();
|
|
136
|
+
|
|
137
|
+
for (const dir of phaseDirs) {
|
|
138
|
+
const dirPath = path.join(phasesDir, dir);
|
|
139
|
+
const summaries: string[] = fs
|
|
140
|
+
.readdirSync(dirPath)
|
|
141
|
+
.filter((f: string) => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md');
|
|
142
|
+
|
|
143
|
+
for (const summary of summaries) {
|
|
144
|
+
try {
|
|
145
|
+
const content: string = fs.readFileSync(path.join(dirPath, summary), 'utf-8');
|
|
146
|
+
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
|
147
|
+
const phaseNum = (fm.phase as string) || dir.split('-')[0];
|
|
148
|
+
|
|
149
|
+
if (!digest.phases[phaseNum]) {
|
|
150
|
+
digest.phases[phaseNum] = {
|
|
151
|
+
name: (fm.name as string) || dir.split('-').slice(1).join(' ') || 'Unknown',
|
|
152
|
+
provides: new Set<string>(),
|
|
153
|
+
affects: new Set<string>(),
|
|
154
|
+
patterns: new Set<string>(),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const pe = digest.phases[phaseNum];
|
|
158
|
+
const prov = pe.provides as Set<string>;
|
|
159
|
+
const aff = pe.affects as Set<string>;
|
|
160
|
+
const pats = pe.patterns as Set<string>;
|
|
161
|
+
|
|
162
|
+
const dg = fm['dependency-graph'] as
|
|
163
|
+
| { provides?: string[]; affects?: string[] }
|
|
164
|
+
| undefined;
|
|
165
|
+
if (dg && dg.provides) dg.provides.forEach((p: string) => prov.add(p));
|
|
166
|
+
else if (fm.provides && Array.isArray(fm.provides))
|
|
167
|
+
(fm.provides as string[]).forEach((p: string) => prov.add(p));
|
|
168
|
+
if (dg && dg.affects) dg.affects.forEach((a: string) => aff.add(a));
|
|
169
|
+
|
|
170
|
+
const pe2 = fm['patterns-established'] as string[] | undefined;
|
|
171
|
+
if (pe2) pe2.forEach((p: string) => pats.add(p));
|
|
172
|
+
|
|
173
|
+
const kd = fm['key-decisions'] as string[] | undefined;
|
|
174
|
+
if (kd)
|
|
175
|
+
kd.forEach((d: string) => {
|
|
176
|
+
digest.decisions.push({ phase: phaseNum, decision: d });
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const ts = fm['tech-stack'] as { added?: (string | { name: string })[] } | undefined;
|
|
180
|
+
if (ts && ts.added)
|
|
181
|
+
ts.added.forEach((t) =>
|
|
182
|
+
(digest.tech_stack as Set<string>).add(typeof t === 'string' ? t : t.name)
|
|
183
|
+
);
|
|
184
|
+
} catch {
|
|
185
|
+
/* skip malformed summaries */
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Convert Sets to Arrays for JSON output
|
|
191
|
+
Object.keys(digest.phases).forEach((p) => {
|
|
192
|
+
const e = digest.phases[p];
|
|
193
|
+
e.provides = Array.from(e.provides as Set<string>);
|
|
194
|
+
e.affects = Array.from(e.affects as Set<string>);
|
|
195
|
+
e.patterns = Array.from(e.patterns as Set<string>);
|
|
196
|
+
});
|
|
197
|
+
(digest as unknown as Record<string, unknown>).tech_stack = Array.from(
|
|
198
|
+
digest.tech_stack as Set<string>
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const phaseCount = Object.keys(digest.phases).length;
|
|
202
|
+
const techArr = digest.tech_stack as string[];
|
|
203
|
+
const techList = techArr.length > 0 ? techArr.join(', ') : 'none';
|
|
204
|
+
output(digest, raw, `${phaseCount} phases digested, tech: ${techList}`);
|
|
205
|
+
} catch (e: unknown) {
|
|
206
|
+
error('Failed to generate history digest: ' + (e as Error).message);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// ─── Model Resolution ────────────────────────────────────────────────────────
|
|
211
|
+
|
|
212
|
+
/** Resolve the model name for a given agent type from project configuration. */
|
|
213
|
+
function cmdResolveModel(cwd: string, agentType: string, raw: boolean): void {
|
|
214
|
+
if (!agentType) {
|
|
215
|
+
error('agent-type required');
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const config = loadConfig(cwd);
|
|
219
|
+
const profile = config.model_profile || 'balanced';
|
|
220
|
+
const agentModels = MODEL_PROFILES[agentType] as Record<string, string> | undefined;
|
|
221
|
+
if (!agentModels) {
|
|
222
|
+
output({ model: 'sonnet', profile, unknown_agent: true }, raw, 'sonnet');
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const model = agentModels[profile] || agentModels['balanced'] || 'sonnet';
|
|
226
|
+
output({ model, profile }, raw, model);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ─── Phase Lookup ────────────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
/** Find a phase directory by number and list its plans and summaries. */
|
|
232
|
+
function cmdFindPhase(cwd: string, phase: string, raw: boolean): void {
|
|
233
|
+
if (!phase) {
|
|
234
|
+
error('phase identifier required');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const phasesDir = getPhasesDirPath(cwd) as string;
|
|
238
|
+
const normalized = normalizePhaseName(phase);
|
|
239
|
+
const notFound = {
|
|
240
|
+
found: false,
|
|
241
|
+
directory: null as string | null,
|
|
242
|
+
phase_number: null as string | null,
|
|
243
|
+
phase_name: null as string | null,
|
|
244
|
+
plans: [] as string[],
|
|
245
|
+
summaries: [] as string[],
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
try {
|
|
249
|
+
const dirs: string[] = fs
|
|
250
|
+
.readdirSync(phasesDir, { withFileTypes: true })
|
|
251
|
+
.filter((e: { isDirectory: () => boolean }) => e.isDirectory())
|
|
252
|
+
.map((e: { name: string }) => e.name)
|
|
253
|
+
.sort();
|
|
254
|
+
const match = dirs.find((d: string) => d.startsWith(normalized + '-') || d === normalized);
|
|
255
|
+
if (!match) {
|
|
256
|
+
output(notFound, raw, '');
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const dm = match.match(/^(\d+(?:\.\d+)?)-?(.*)/);
|
|
261
|
+
const phaseNumber = dm ? dm[1] : normalized;
|
|
262
|
+
const phaseName = dm && dm[2] ? dm[2] : null;
|
|
263
|
+
const phaseDir = path.join(phasesDir, match);
|
|
264
|
+
const phaseFiles: string[] = fs.readdirSync(phaseDir);
|
|
265
|
+
const plans = phaseFiles
|
|
266
|
+
.filter((f: string) => f.endsWith('-PLAN.md') || f === 'PLAN.md')
|
|
267
|
+
.sort();
|
|
268
|
+
const summaries = phaseFiles
|
|
269
|
+
.filter((f: string) => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md')
|
|
270
|
+
.sort();
|
|
271
|
+
output(
|
|
272
|
+
{
|
|
273
|
+
found: true,
|
|
274
|
+
directory: path.relative(cwd, path.join(phasesDir, match)),
|
|
275
|
+
phase_number: phaseNumber,
|
|
276
|
+
phase_name: phaseName,
|
|
277
|
+
plans,
|
|
278
|
+
summaries,
|
|
279
|
+
},
|
|
280
|
+
raw,
|
|
281
|
+
path.relative(cwd, path.join(phasesDir, match))
|
|
282
|
+
);
|
|
283
|
+
} catch {
|
|
284
|
+
output(notFound, raw, '');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ─── Detect Backend ─────────────────────────────────────────────────────────
|
|
289
|
+
|
|
290
|
+
/** Detect the current AI coding CLI backend and return backend info. */
|
|
291
|
+
function cmdDetectBackend(cwd: string, raw: boolean): void {
|
|
292
|
+
const config = loadConfig(cwd);
|
|
293
|
+
const backend = detectBackend(cwd);
|
|
294
|
+
const cfgRec = config as unknown as Record<string, unknown>;
|
|
295
|
+
const models = {
|
|
296
|
+
opus: resolveBackendModel(backend, 'opus' as ModelTier, cfgRec, cwd),
|
|
297
|
+
sonnet: resolveBackendModel(backend, 'sonnet' as ModelTier, cfgRec, cwd),
|
|
298
|
+
haiku: resolveBackendModel(backend, 'haiku' as ModelTier, cfgRec, cwd),
|
|
299
|
+
};
|
|
300
|
+
const detected = getCachedModels(backend, cwd);
|
|
301
|
+
const models_source = detected ? 'detected' : 'defaults';
|
|
302
|
+
const capabilities = getBackendCapabilities(backend);
|
|
303
|
+
output({ backend, models, models_source, capabilities }, raw, backend);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// ─── Commit ─────────────────────────────────────────────────────────────────
|
|
307
|
+
|
|
308
|
+
/** Create a git commit with specified files, respecting commit_docs and gitignore config. */
|
|
309
|
+
function cmdCommit(
|
|
310
|
+
cwd: string,
|
|
311
|
+
message: string,
|
|
312
|
+
files: string[],
|
|
313
|
+
raw: boolean,
|
|
314
|
+
amend?: boolean
|
|
315
|
+
): void {
|
|
316
|
+
if (!message && !amend) {
|
|
317
|
+
error('commit message required');
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const config = loadConfig(cwd);
|
|
321
|
+
|
|
322
|
+
if (!config.commit_docs) {
|
|
323
|
+
output({ committed: false, hash: null, reason: 'skipped_commit_docs_false' }, raw, 'skipped');
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (isGitIgnored(cwd, getPlanningDir(cwd))) {
|
|
327
|
+
output({ committed: false, hash: null, reason: 'skipped_gitignored' }, raw, 'skipped');
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const filesToStage = files && files.length > 0 ? files : [getPlanningDir(cwd)];
|
|
332
|
+
for (const file of filesToStage) execGit(cwd, ['add', file]);
|
|
333
|
+
|
|
334
|
+
const commitArgs = amend ? ['commit', '--amend', '--no-edit'] : ['commit', '-m', message];
|
|
335
|
+
const commitResult = execGit(cwd, commitArgs);
|
|
336
|
+
if (commitResult.exitCode !== 0) {
|
|
337
|
+
if (
|
|
338
|
+
commitResult.stdout.includes('nothing to commit') ||
|
|
339
|
+
commitResult.stderr.includes('nothing to commit')
|
|
340
|
+
) {
|
|
341
|
+
output({ committed: false, hash: null, reason: 'nothing_to_commit' }, raw, 'nothing');
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
output(
|
|
345
|
+
{
|
|
346
|
+
committed: false,
|
|
347
|
+
hash: null as string | null,
|
|
348
|
+
reason: 'commit_failed',
|
|
349
|
+
error: commitResult.stderr || commitResult.stdout,
|
|
350
|
+
},
|
|
351
|
+
raw,
|
|
352
|
+
'failed'
|
|
353
|
+
);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const hashResult = execGit(cwd, ['rev-parse', '--short', 'HEAD']);
|
|
358
|
+
const hash = hashResult.exitCode === 0 ? hashResult.stdout : null;
|
|
359
|
+
output({ committed: true, hash, reason: 'committed' }, raw, hash || 'committed');
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// ─── Phase Plan Index ───────────────────────────────────────────────────────
|
|
363
|
+
|
|
364
|
+
/** Index plans in a phase with wave grouping, completion status, and checkpoint detection. */
|
|
365
|
+
function cmdPhasePlanIndex(cwd: string, phase: string, raw: boolean): void {
|
|
366
|
+
if (!phase) {
|
|
367
|
+
error(
|
|
368
|
+
'phase required for phase-plan-index. Usage: phase-plan-index <phase-number>. Run `grd-tools phase list` to see available phases, then pass a phase number, e.g.: phase-plan-index 2'
|
|
369
|
+
);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const phasesDir = getPhasesDirPath(cwd) as string;
|
|
373
|
+
const normalized = normalizePhaseName(phase);
|
|
374
|
+
|
|
375
|
+
let phaseDir: string | null = null;
|
|
376
|
+
try {
|
|
377
|
+
const dirs: string[] = fs
|
|
378
|
+
.readdirSync(phasesDir, { withFileTypes: true })
|
|
379
|
+
.filter((e: { isDirectory: () => boolean }) => e.isDirectory())
|
|
380
|
+
.map((e: { name: string }) => e.name)
|
|
381
|
+
.sort();
|
|
382
|
+
const match = dirs.find((d: string) => d.startsWith(normalized + '-') || d === normalized);
|
|
383
|
+
if (match) phaseDir = path.join(phasesDir, match);
|
|
384
|
+
} catch {
|
|
385
|
+
/* phases dir doesn't exist */
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (!phaseDir) {
|
|
389
|
+
output(
|
|
390
|
+
{
|
|
391
|
+
phase: normalized,
|
|
392
|
+
error: 'Phase not found',
|
|
393
|
+
plans: [],
|
|
394
|
+
waves: {},
|
|
395
|
+
incomplete: [],
|
|
396
|
+
has_checkpoints: false,
|
|
397
|
+
},
|
|
398
|
+
raw
|
|
399
|
+
);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const phaseFiles: string[] = fs.readdirSync(phaseDir);
|
|
404
|
+
const planFiles = phaseFiles
|
|
405
|
+
.filter((f: string) => f.endsWith('-PLAN.md') || f === 'PLAN.md')
|
|
406
|
+
.sort();
|
|
407
|
+
const summaryFiles = phaseFiles.filter(
|
|
408
|
+
(f: string) => f.endsWith('-SUMMARY.md') || f === 'SUMMARY.md'
|
|
409
|
+
);
|
|
410
|
+
const completedPlanIds = new Set(
|
|
411
|
+
summaryFiles.map((s: string) => s.replace('-SUMMARY.md', '').replace('SUMMARY.md', ''))
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
const plans: PlanIndexEntry[] = [];
|
|
415
|
+
const waves: Record<string, string[]> = {};
|
|
416
|
+
const incomplete: string[] = [];
|
|
417
|
+
let hasCheckpoints = false;
|
|
418
|
+
|
|
419
|
+
for (const planFile of planFiles) {
|
|
420
|
+
const planId = planFile.replace('-PLAN.md', '').replace('PLAN.md', '');
|
|
421
|
+
const planPath = path.join(phaseDir, planFile);
|
|
422
|
+
const content: string = fs.readFileSync(planPath, 'utf-8');
|
|
423
|
+
const fm = extractFrontmatter(content);
|
|
424
|
+
|
|
425
|
+
const taskMatches = content.match(/##\s*Task\s*\d+/gi);
|
|
426
|
+
const taskCount = taskMatches ? taskMatches.length : 0;
|
|
427
|
+
const wave = parseInt(String(fm.wave), 10) || 1;
|
|
428
|
+
|
|
429
|
+
let autonomous = true;
|
|
430
|
+
const rawAuto: unknown = fm.autonomous;
|
|
431
|
+
if (rawAuto !== undefined) autonomous = rawAuto === 'true' || rawAuto === true;
|
|
432
|
+
if (!autonomous) hasCheckpoints = true;
|
|
433
|
+
|
|
434
|
+
let filesModified: string[] = [];
|
|
435
|
+
const rawFm =
|
|
436
|
+
(fm as Record<string, unknown>).files_modified ||
|
|
437
|
+
(fm as Record<string, unknown>)['files-modified'];
|
|
438
|
+
if (rawFm) filesModified = Array.isArray(rawFm) ? (rawFm as string[]) : [rawFm as string];
|
|
439
|
+
|
|
440
|
+
const hasSummary = completedPlanIds.has(planId);
|
|
441
|
+
if (!hasSummary) incomplete.push(planId);
|
|
442
|
+
|
|
443
|
+
let objective: string | null = ((fm as Record<string, unknown>).objective as string) || null;
|
|
444
|
+
if (!objective) {
|
|
445
|
+
const bodyStart = content.match(/^---\n[\s\S]+?\n---\n?/);
|
|
446
|
+
const body = bodyStart ? content.slice(bodyStart[0].length) : content;
|
|
447
|
+
const objMatch = body.match(/<objective>\s*([\s\S]*?)\s*<\/objective>/i);
|
|
448
|
+
if (objMatch) objective = objMatch[1].trim().split('\n')[0].trim();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
plans.push({
|
|
452
|
+
id: planId,
|
|
453
|
+
wave,
|
|
454
|
+
autonomous,
|
|
455
|
+
objective,
|
|
456
|
+
files_modified: filesModified,
|
|
457
|
+
task_count: taskCount,
|
|
458
|
+
has_summary: hasSummary,
|
|
459
|
+
});
|
|
460
|
+
const waveKey = String(wave);
|
|
461
|
+
if (!waves[waveKey]) waves[waveKey] = [];
|
|
462
|
+
waves[waveKey].push(planId);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
output(
|
|
466
|
+
{ phase: normalized, plans, waves, incomplete, has_checkpoints: hasCheckpoints },
|
|
467
|
+
raw,
|
|
468
|
+
`Phase ${normalized}: ${plans.length} plans, ${incomplete.length} incomplete`
|
|
469
|
+
);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// ─── Summary Extract ────────────────────────────────────────────────────────
|
|
473
|
+
|
|
474
|
+
/** Extract structured data from a SUMMARY.md file. */
|
|
475
|
+
function cmdSummaryExtract(
|
|
476
|
+
cwd: string,
|
|
477
|
+
summaryPath: string,
|
|
478
|
+
fields: string[] | null,
|
|
479
|
+
raw: boolean
|
|
480
|
+
): void {
|
|
481
|
+
if (!summaryPath) {
|
|
482
|
+
error(
|
|
483
|
+
'summary-path required for summary-extract. Usage: summary-extract <path-to-SUMMARY.md>. Provide the relative path to a SUMMARY.md file, e.g.: summary-extract .planning/milestones/v1.0/phases/01-init/01-01-SUMMARY.md'
|
|
484
|
+
);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
const fullPath = path.join(cwd, summaryPath);
|
|
488
|
+
if (!fs.existsSync(fullPath)) {
|
|
489
|
+
output({ error: 'File not found', path: summaryPath }, raw);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const content: string = fs.readFileSync(fullPath, 'utf-8');
|
|
494
|
+
const fm = extractFrontmatter(content) as Record<string, unknown>;
|
|
495
|
+
|
|
496
|
+
const parseDecisions = (list: unknown): SummaryDecision[] => {
|
|
497
|
+
if (!list || !Array.isArray(list)) return [];
|
|
498
|
+
return (list as string[]).map((d) => {
|
|
499
|
+
const idx = d.indexOf(':');
|
|
500
|
+
return idx > 0
|
|
501
|
+
? { summary: d.substring(0, idx).trim(), rationale: d.substring(idx + 1).trim() }
|
|
502
|
+
: { summary: d, rationale: null };
|
|
503
|
+
});
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
const ts = fm['tech-stack'] as { added?: unknown[] } | undefined;
|
|
507
|
+
const fullResult = {
|
|
508
|
+
path: summaryPath,
|
|
509
|
+
one_liner: (fm['one-liner'] as string) || null,
|
|
510
|
+
key_files: (fm['key-files'] as unknown[]) || [],
|
|
511
|
+
tech_added: (ts && ts.added) || [],
|
|
512
|
+
patterns: (fm['patterns-established'] as string[]) || [],
|
|
513
|
+
decisions: parseDecisions(fm['key-decisions']),
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
if (fields && fields.length > 0) {
|
|
517
|
+
const filtered: Record<string, unknown> = { path: summaryPath };
|
|
518
|
+
const src = fullResult as unknown as Record<string, unknown>;
|
|
519
|
+
for (const field of fields) {
|
|
520
|
+
if (src[field] !== undefined) filtered[field] = src[field];
|
|
521
|
+
}
|
|
522
|
+
output(
|
|
523
|
+
filtered,
|
|
524
|
+
raw,
|
|
525
|
+
(filtered as { one_liner?: string }).one_liner || path.basename(summaryPath)
|
|
526
|
+
);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
output(fullResult, raw, fullResult.one_liner || path.basename(summaryPath));
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// ─── Phase Dependency Risk Scorer ────────────────────────────────────────────
|
|
533
|
+
|
|
534
|
+
type RiskLevel = 'green' | 'yellow' | 'red';
|
|
535
|
+
|
|
536
|
+
interface PhaseRiskRow {
|
|
537
|
+
phase: string;
|
|
538
|
+
risk: RiskLevel;
|
|
539
|
+
reasons: string[];
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
interface DepsRiskResult {
|
|
543
|
+
start_phase: string | null;
|
|
544
|
+
phases_checked: number;
|
|
545
|
+
risks: PhaseRiskRow[];
|
|
546
|
+
red_count: number;
|
|
547
|
+
yellow_count: number;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Traverse the phase dependency chain from start_phase, scoring each phase
|
|
552
|
+
* green/yellow/red based on: open DEFER- items, missing VERIFICATION.md,
|
|
553
|
+
* and failed test state from EVOLVE-STATE.json.
|
|
554
|
+
*/
|
|
555
|
+
function cmdDepsRisk(cwd: string, startPhase: string | null, raw: boolean): void {
|
|
556
|
+
const planningDir = getPlanningDir(cwd) as string;
|
|
557
|
+
|
|
558
|
+
// Load EVOLVE-STATE for last test-pass info
|
|
559
|
+
let evolveState: Record<string, unknown> = {};
|
|
560
|
+
const evolveStatePath = path.join(planningDir, 'EVOLVE-STATE.json');
|
|
561
|
+
if (fs.existsSync(evolveStatePath)) {
|
|
562
|
+
try {
|
|
563
|
+
evolveState = JSON.parse(safeReadFile(evolveStatePath) ?? '{}') as Record<string, unknown>;
|
|
564
|
+
} catch { /* use empty */ }
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Load ROADMAP.md to build ordered phase list
|
|
568
|
+
const roadmapPath = path.join(planningDir, 'ROADMAP.md');
|
|
569
|
+
const roadmapContent = safeReadFile(roadmapPath);
|
|
570
|
+
const phaseLineRe = /^\|\s*Phase\s+(\d+)\s*\|([^|]*)\|([^|]*)\|([^|]*)\|/;
|
|
571
|
+
const orderedPhases: string[] = [];
|
|
572
|
+
if (roadmapContent) {
|
|
573
|
+
for (const line of roadmapContent.split('\n')) {
|
|
574
|
+
const m = line.match(phaseLineRe);
|
|
575
|
+
if (m) orderedPhases.push(m[1].trim());
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// If no roadmap, fall back to scanning phase directories
|
|
580
|
+
const phasesDir = getPhasesDirPath(cwd) as string;
|
|
581
|
+
if (orderedPhases.length === 0 && fs.existsSync(phasesDir)) {
|
|
582
|
+
try {
|
|
583
|
+
(fs.readdirSync(phasesDir) as string[])
|
|
584
|
+
.filter((d: string) => /^\d+/.test(d))
|
|
585
|
+
.sort()
|
|
586
|
+
.forEach((d: string) => orderedPhases.push(d.replace(/^(\d+).*/, '$1')));
|
|
587
|
+
} catch { /* skip */ }
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// Determine which phases to scan
|
|
591
|
+
let phasesToCheck = orderedPhases;
|
|
592
|
+
if (startPhase) {
|
|
593
|
+
const idx = orderedPhases.findIndex((p) => p === startPhase.replace(/^Phase\s+/i, '').trim());
|
|
594
|
+
if (idx >= 0) phasesToCheck = orderedPhases.slice(idx);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const risks: PhaseRiskRow[] = [];
|
|
598
|
+
|
|
599
|
+
for (const phaseNum of phasesToCheck) {
|
|
600
|
+
const reasons: string[] = [];
|
|
601
|
+
|
|
602
|
+
// Check VERIFICATION.md
|
|
603
|
+
let verificationPath: string | null;
|
|
604
|
+
if (fs.existsSync(phasesDir)) {
|
|
605
|
+
try {
|
|
606
|
+
// Codex r10 P2: normalize phaseNum to the canonical zero-padded
|
|
607
|
+
// form (matches the rest of the CLI's resolver) so phase ids
|
|
608
|
+
// like `1` find the on-disk `01-test` directory.
|
|
609
|
+
const padded = /^\d+$/.test(phaseNum) ? phaseNum.padStart(2, '0') : phaseNum;
|
|
610
|
+
const phaseDir = (fs.readdirSync(phasesDir) as string[]).find((d: string) =>
|
|
611
|
+
d === phaseNum || d === padded ||
|
|
612
|
+
d.startsWith(`${phaseNum}-`) || d.startsWith(`${phaseNum}_`) ||
|
|
613
|
+
d.startsWith(`${padded}-`) || d.startsWith(`${padded}_`)
|
|
614
|
+
);
|
|
615
|
+
if (phaseDir) {
|
|
616
|
+
// Codex r20 P2: include prefixed VERIFICATION names (e.g.
|
|
617
|
+
// `99-VERIFICATION.md`) so completed phases are not flagged
|
|
618
|
+
// as missing verification.
|
|
619
|
+
const phaseAbsDir = path.join(phasesDir, phaseDir);
|
|
620
|
+
let vPath: string | null = path.join(phaseAbsDir, 'VERIFICATION.md');
|
|
621
|
+
if (!fs.existsSync(vPath)) {
|
|
622
|
+
try {
|
|
623
|
+
const prefixed = (fs.readdirSync(phaseAbsDir) as string[]).find(
|
|
624
|
+
(f: string) => /-VERIFICATION\.md$/.test(f)
|
|
625
|
+
);
|
|
626
|
+
vPath = prefixed ? path.join(phaseAbsDir, prefixed) : null;
|
|
627
|
+
} catch {
|
|
628
|
+
vPath = null;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
verificationPath = vPath;
|
|
632
|
+
if (!verificationPath) reasons.push('missing VERIFICATION.md');
|
|
633
|
+
|
|
634
|
+
if (verificationPath) {
|
|
635
|
+
const vContent = safeReadFile(verificationPath) ?? '';
|
|
636
|
+
const deferCount = (vContent.match(/DEFER-/g) ?? []).length;
|
|
637
|
+
if (deferCount > 0) reasons.push(`${deferCount} open DEFER- items`);
|
|
638
|
+
}
|
|
639
|
+
} else {
|
|
640
|
+
reasons.push('phase directory not found');
|
|
641
|
+
}
|
|
642
|
+
} catch { /* skip */ }
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
// Check test pass state from EVOLVE-STATE
|
|
646
|
+
const phaseTimings = evolveState['phase_timings'];
|
|
647
|
+
if (Array.isArray(phaseTimings)) {
|
|
648
|
+
const phaseRecord = (phaseTimings as Array<Record<string, unknown>>).find(
|
|
649
|
+
(r) => String(r['phase']) === phaseNum
|
|
650
|
+
);
|
|
651
|
+
if (phaseRecord && phaseRecord['tests_passed'] === false) {
|
|
652
|
+
reasons.push('tests failed in last recorded run');
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
let risk: RiskLevel;
|
|
657
|
+
if (reasons.some((r) => r.includes('DEFER') || r.includes('failed'))) {
|
|
658
|
+
risk = 'red';
|
|
659
|
+
} else if (reasons.length > 0) {
|
|
660
|
+
risk = 'yellow';
|
|
661
|
+
} else {
|
|
662
|
+
risk = 'green';
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
risks.push({ phase: phaseNum, risk, reasons });
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
const result: DepsRiskResult = {
|
|
669
|
+
start_phase: startPhase,
|
|
670
|
+
phases_checked: risks.length,
|
|
671
|
+
risks,
|
|
672
|
+
red_count: risks.filter((r) => r.risk === 'red').length,
|
|
673
|
+
yellow_count: risks.filter((r) => r.risk === 'yellow').length,
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
const redCount = result.red_count;
|
|
677
|
+
const yellowCount = result.yellow_count;
|
|
678
|
+
const summary = redCount === 0 && yellowCount === 0
|
|
679
|
+
? `All ${risks.length} phases green — safe to run autopilot`
|
|
680
|
+
: `${redCount} red, ${yellowCount} yellow across ${risks.length} phases`;
|
|
681
|
+
output(result, raw, summary);
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// ─── Exports ─────────────────────────────────────────────────────────────────
|
|
685
|
+
|
|
686
|
+
module.exports = {
|
|
687
|
+
readCachedRoadmap,
|
|
688
|
+
readCachedState,
|
|
689
|
+
_stateContentCache,
|
|
690
|
+
cmdHistoryDigest,
|
|
691
|
+
cmdResolveModel,
|
|
692
|
+
cmdFindPhase,
|
|
693
|
+
cmdDetectBackend,
|
|
694
|
+
cmdCommit,
|
|
695
|
+
cmdPhasePlanIndex,
|
|
696
|
+
cmdSummaryExtract,
|
|
697
|
+
cmdDepsRisk,
|
|
698
|
+
};
|