@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,368 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GenomeSplitIndexError = void 0;
|
|
37
|
+
/**
|
|
38
|
+
* GRD GENOME.md — meta-strategy snapshots.
|
|
39
|
+
*
|
|
40
|
+
* Tier-2 #8 follow-up: write path for the registry that PR #39 shipped
|
|
41
|
+
* the read half of. The proposal's caveat for #8 was "needs rollback
|
|
42
|
+
* policy"; we answer it by:
|
|
43
|
+
*
|
|
44
|
+
* - NOT mutating existing content. cmdGenomeSnapshot appends a new
|
|
45
|
+
* dated section; older snapshots stay readable in the same file.
|
|
46
|
+
* - Each write committed to git via the project's normal flow, so
|
|
47
|
+
* `git revert <hash>` is the rollback mechanism (same as PR #39).
|
|
48
|
+
*
|
|
49
|
+
* Three operations:
|
|
50
|
+
*
|
|
51
|
+
* cmdGenomeInit Writes a starter template if no GENOME.md
|
|
52
|
+
* exists. Errors if one already exists (the
|
|
53
|
+
* caller should `show` first to inspect).
|
|
54
|
+
* cmdGenomeShow Prints the current content (raw or as JSON
|
|
55
|
+
* with metadata).
|
|
56
|
+
* cmdGenomeSnapshot Appends a new `## Snapshot YYYY-MM-DD` section
|
|
57
|
+
* derived from current project state (drift,
|
|
58
|
+
* verdict mix, dead-ends count, completed
|
|
59
|
+
* phases). Creates GENOME.md if absent.
|
|
60
|
+
*
|
|
61
|
+
* The schema is documented in agents/grd-planner.md <genome>.
|
|
62
|
+
*/
|
|
63
|
+
const fs = __importStar(require("fs"));
|
|
64
|
+
const path = __importStar(require("path"));
|
|
65
|
+
const { planningDir: getPlanningDir, } = require('./paths');
|
|
66
|
+
const { safeReadFile, safeReadMarkdown, output, error, } = require('./utils');
|
|
67
|
+
const { atomicWriteFileSync } = require('./autopilot-waves');
|
|
68
|
+
const { isIndexFile } = require('./markdown-split');
|
|
69
|
+
const { computeDriftScore, DEFAULT_WEIGHTS: DRIFT_WEIGHTS, } = require('./drift');
|
|
70
|
+
const { parseReflectionSection, } = require('./dead-ends');
|
|
71
|
+
// ─── Starter template ──────────────────────────────────────────────────────
|
|
72
|
+
const _STARTER_TEMPLATE = `# Strategy Genome
|
|
73
|
+
|
|
74
|
+
Project-scoped meta-strategy snapshot. Captures how this project plans
|
|
75
|
+
— heuristics in use, agent preferences, verdict-thresholds the team
|
|
76
|
+
has settled on. The planner reads this before composing PLAN.md.
|
|
77
|
+
|
|
78
|
+
See agents/grd-planner.md \`<genome>\` for the consumer contract.
|
|
79
|
+
|
|
80
|
+
## Heuristics in use
|
|
81
|
+
|
|
82
|
+
_Add lines like:_
|
|
83
|
+
- Use \`verification_level: proxy\` for ML phases.
|
|
84
|
+
- Split phases past 50% context degradation.
|
|
85
|
+
|
|
86
|
+
## Agent preferences
|
|
87
|
+
|
|
88
|
+
_Add lines like:_
|
|
89
|
+
- Run \`grd-deep-diver\` before plan when research_level >= 2.
|
|
90
|
+
|
|
91
|
+
## Verdict thresholds
|
|
92
|
+
|
|
93
|
+
_Add lines like:_
|
|
94
|
+
- Promote falsified reflections to DEAD-ENDS automatically.
|
|
95
|
+
- Stop autopilot on ontology similarity >= 0.95.
|
|
96
|
+
|
|
97
|
+
## Snapshots
|
|
98
|
+
|
|
99
|
+
_Each \`gd-tools genome snapshot\` call appends a dated section below._
|
|
100
|
+
`;
|
|
101
|
+
// ─── Snapshot composition ──────────────────────────────────────────────────
|
|
102
|
+
/**
|
|
103
|
+
* Walk completed phase dirs to count verdict kinds across all
|
|
104
|
+
* Reflection sections. Matches the heuristic from lib/think.ts but
|
|
105
|
+
* does not depend on it.
|
|
106
|
+
*/
|
|
107
|
+
function _verdictCounts(cwd) {
|
|
108
|
+
const counts = {
|
|
109
|
+
confirmed: 0,
|
|
110
|
+
partial: 0,
|
|
111
|
+
falsified: 0,
|
|
112
|
+
unknown: 0,
|
|
113
|
+
};
|
|
114
|
+
const milestones = path.join(getPlanningDir(cwd), 'milestones');
|
|
115
|
+
if (!fs.existsSync(milestones))
|
|
116
|
+
return counts;
|
|
117
|
+
for (const ms of fs.readdirSync(milestones, { withFileTypes: true })) {
|
|
118
|
+
if (!ms.isDirectory())
|
|
119
|
+
continue;
|
|
120
|
+
const phasesDir = path.join(milestones, ms.name, 'phases');
|
|
121
|
+
if (!fs.existsSync(phasesDir))
|
|
122
|
+
continue;
|
|
123
|
+
for (const ph of fs.readdirSync(phasesDir, { withFileTypes: true })) {
|
|
124
|
+
if (!ph.isDirectory())
|
|
125
|
+
continue;
|
|
126
|
+
const phaseDir = path.join(phasesDir, ph.name);
|
|
127
|
+
const files = fs.readdirSync(phaseDir);
|
|
128
|
+
const verFile = files.find((f) => /-VERIFICATION\.md$/i.test(f) || f === 'VERIFICATION.md');
|
|
129
|
+
if (!verFile)
|
|
130
|
+
continue;
|
|
131
|
+
// safeReadMarkdown reassembles split-index files so verdicts
|
|
132
|
+
// are counted correctly on projects that have split large
|
|
133
|
+
// VERIFICATION.md files (codex r2 P2 on PR #43).
|
|
134
|
+
const content = safeReadMarkdown(path.join(phaseDir, verFile));
|
|
135
|
+
if (!content)
|
|
136
|
+
continue;
|
|
137
|
+
const r = parseReflectionSection(content);
|
|
138
|
+
if (!r)
|
|
139
|
+
continue;
|
|
140
|
+
const v = r.verdict.toLowerCase();
|
|
141
|
+
if (counts[v] !== undefined)
|
|
142
|
+
counts[v]++;
|
|
143
|
+
else
|
|
144
|
+
counts[v] = 1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return counts;
|
|
148
|
+
}
|
|
149
|
+
function _countCompletedPhases(cwd) {
|
|
150
|
+
const milestones = path.join(getPlanningDir(cwd), 'milestones');
|
|
151
|
+
if (!fs.existsSync(milestones))
|
|
152
|
+
return 0;
|
|
153
|
+
let count = 0;
|
|
154
|
+
for (const ms of fs.readdirSync(milestones, { withFileTypes: true })) {
|
|
155
|
+
if (!ms.isDirectory())
|
|
156
|
+
continue;
|
|
157
|
+
const phasesDir = path.join(milestones, ms.name, 'phases');
|
|
158
|
+
if (!fs.existsSync(phasesDir))
|
|
159
|
+
continue;
|
|
160
|
+
for (const ph of fs.readdirSync(phasesDir, { withFileTypes: true })) {
|
|
161
|
+
if (!ph.isDirectory())
|
|
162
|
+
continue;
|
|
163
|
+
if (!/^\d+(?:\.\d+)?/.test(ph.name))
|
|
164
|
+
continue;
|
|
165
|
+
const hasSummary = fs
|
|
166
|
+
.readdirSync(path.join(phasesDir, ph.name))
|
|
167
|
+
.some((f) => /-SUMMARY\.md$/i.test(f) || f === 'SUMMARY.md');
|
|
168
|
+
if (hasSummary)
|
|
169
|
+
count++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return count;
|
|
173
|
+
}
|
|
174
|
+
function _countDeadEnds(cwd) {
|
|
175
|
+
// safeReadMarkdown reassembles split-index files so DEAD-ENDS count
|
|
176
|
+
// matches what the planner sees (codex r2 P2 on PR #43).
|
|
177
|
+
const deadEnds = safeReadMarkdown(path.join(getPlanningDir(cwd), 'DEAD-ENDS.md'));
|
|
178
|
+
if (!deadEnds)
|
|
179
|
+
return 0;
|
|
180
|
+
return (deadEnds.match(/^## (\S+)\s*$/gm) ?? []).length;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Build the markdown body of a fresh snapshot section. Output is
|
|
184
|
+
* deterministic given the same input files.
|
|
185
|
+
*/
|
|
186
|
+
function _composeSnapshotSection(cwd, isoDate) {
|
|
187
|
+
const completed = _countCompletedPhases(cwd);
|
|
188
|
+
const drift = computeDriftScore(cwd, DRIFT_WEIGHTS, 0.3);
|
|
189
|
+
const counts = _verdictCounts(cwd);
|
|
190
|
+
const deadEnds = _countDeadEnds(cwd);
|
|
191
|
+
const lines = [];
|
|
192
|
+
lines.push(`## Snapshot ${isoDate}`);
|
|
193
|
+
lines.push('');
|
|
194
|
+
lines.push('| Field | Value |');
|
|
195
|
+
lines.push('|-------|-------|');
|
|
196
|
+
lines.push(`| completed_phases | ${completed} |`);
|
|
197
|
+
lines.push(`| drift_weighted | ${drift.weighted.toFixed(3)}${drift.exceeded ? ' (exceeds threshold)' : ''} |`);
|
|
198
|
+
lines.push(`| dead_ends_registered | ${deadEnds} |`);
|
|
199
|
+
lines.push(`| verdicts.confirmed | ${counts.confirmed} |`);
|
|
200
|
+
lines.push(`| verdicts.partial | ${counts.partial} |`);
|
|
201
|
+
lines.push(`| verdicts.falsified | ${counts.falsified} |`);
|
|
202
|
+
lines.push(`| verdicts.unknown | ${counts.unknown} |`);
|
|
203
|
+
lines.push('');
|
|
204
|
+
lines.push('_Snapshot derived from project state. No LLM ran. Curate heuristic sections above by hand; this auto-appended block is the deterministic floor._');
|
|
205
|
+
lines.push('');
|
|
206
|
+
return lines.join('\n');
|
|
207
|
+
}
|
|
208
|
+
// ─── Commands ──────────────────────────────────────────────────────────────
|
|
209
|
+
function cmdGenomeInit(cwd, raw) {
|
|
210
|
+
const filePath = path.join(getPlanningDir(cwd), 'GENOME.md');
|
|
211
|
+
if (fs.existsSync(filePath)) {
|
|
212
|
+
error(`GENOME.md already exists at ${path.relative(cwd, filePath)} — use \`genome show\` to inspect`);
|
|
213
|
+
}
|
|
214
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
215
|
+
atomicWriteFileSync(filePath, _STARTER_TEMPLATE);
|
|
216
|
+
output({ action: 'created', path: path.relative(cwd, filePath) }, raw, `created: ${path.relative(cwd, filePath)}`);
|
|
217
|
+
}
|
|
218
|
+
function cmdGenomeShow(cwd, raw) {
|
|
219
|
+
const filePath = path.join(getPlanningDir(cwd), 'GENOME.md');
|
|
220
|
+
// safeReadMarkdown reassembles split-index files so `show` returns
|
|
221
|
+
// what the planner actually consumes, not just the index stub
|
|
222
|
+
// (codex r2 P2 on PR #43).
|
|
223
|
+
const content = safeReadMarkdown(filePath);
|
|
224
|
+
if (content === null) {
|
|
225
|
+
output({ exists: false, content: null }, raw, '(none)');
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
output({ exists: true, content, path: path.relative(cwd, filePath) }, raw, content);
|
|
229
|
+
}
|
|
230
|
+
/** Sentinel error thrown by runGenomeSnapshot when GENOME.md is split-index. */
|
|
231
|
+
class GenomeSplitIndexError extends Error {
|
|
232
|
+
constructor(message) {
|
|
233
|
+
super(message);
|
|
234
|
+
this.name = 'GenomeSplitIndexError';
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.GenomeSplitIndexError = GenomeSplitIndexError;
|
|
238
|
+
/**
|
|
239
|
+
* Pure-ish helper: same logic as cmdGenomeSnapshot but returns instead
|
|
240
|
+
* of calling `output()` (which exits the process). Lets callers like
|
|
241
|
+
* lib/evolve/orchestrator.ts append a snapshot at the end of a cycle
|
|
242
|
+
* without terminating the parent process. Throws
|
|
243
|
+
* GenomeSplitIndexError if GENOME.md is in split-index format —
|
|
244
|
+
* caller chooses whether to surface or swallow.
|
|
245
|
+
*/
|
|
246
|
+
function runGenomeSnapshot(cwd) {
|
|
247
|
+
const filePath = path.join(getPlanningDir(cwd), 'GENOME.md');
|
|
248
|
+
const today = new Date();
|
|
249
|
+
const isoDate = today.toISOString().slice(0, 10);
|
|
250
|
+
const section = _composeSnapshotSection(cwd, isoDate);
|
|
251
|
+
let prior;
|
|
252
|
+
let action;
|
|
253
|
+
if (fs.existsSync(filePath)) {
|
|
254
|
+
prior = safeReadFile(filePath) ?? '';
|
|
255
|
+
if (isIndexFile(prior)) {
|
|
256
|
+
throw new GenomeSplitIndexError(`GENOME.md is in split-index format (<!-- GRD-INDEX -->). Snapshots cannot be appended to the stub — they would never reach planner context. Either edit the linked partial directly, or reassemble GENOME.md before snapshotting.`);
|
|
257
|
+
}
|
|
258
|
+
if (!prior.endsWith('\n'))
|
|
259
|
+
prior += '\n';
|
|
260
|
+
action = 'appended';
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
prior = _STARTER_TEMPLATE;
|
|
264
|
+
action = 'created';
|
|
265
|
+
}
|
|
266
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
267
|
+
atomicWriteFileSync(filePath, prior + '\n' + section);
|
|
268
|
+
return { action, snapshot_date: isoDate, path: path.relative(cwd, filePath) };
|
|
269
|
+
}
|
|
270
|
+
function cmdGenomeSnapshot(cwd, raw) {
|
|
271
|
+
let result;
|
|
272
|
+
try {
|
|
273
|
+
result = runGenomeSnapshot(cwd);
|
|
274
|
+
}
|
|
275
|
+
catch (e) {
|
|
276
|
+
if (e instanceof GenomeSplitIndexError) {
|
|
277
|
+
error(e.message);
|
|
278
|
+
}
|
|
279
|
+
throw e;
|
|
280
|
+
}
|
|
281
|
+
output(result, raw, `${result.action} snapshot ${result.snapshot_date}`);
|
|
282
|
+
}
|
|
283
|
+
// ─── promote-suggestion (v0.4 Phase 5) ──────────────────────────────────────
|
|
284
|
+
/**
|
|
285
|
+
* Human-curated promotion of a `gd patterns` suggestion from
|
|
286
|
+
* .planning/GENOME-SUGGESTIONS.md into the prescriptive GENOME.md.
|
|
287
|
+
*
|
|
288
|
+
* Finds the suggestion block whose `Promote with: gd genome
|
|
289
|
+
* promote-suggestion <slug>` line matches `slug`, copies its
|
|
290
|
+
* "Suggested heuristic:" text into GENOME.md under a
|
|
291
|
+
* "## Heuristics in use (promoted)" section as a human-editable draft,
|
|
292
|
+
* and records provenance (date + source slug). This is the ONLY path
|
|
293
|
+
* from advisory suggestion to prescriptive heuristic — keeping the
|
|
294
|
+
* deterministic-or-human-reviewed write contract
|
|
295
|
+
* (DEAD-ENDS: auto-suggestions-in-genome-file). The human is expected to
|
|
296
|
+
* refine the wording afterward; the command just moves the text across
|
|
297
|
+
* the prescriptive boundary deliberately.
|
|
298
|
+
*/
|
|
299
|
+
function cmdGenomePromoteSuggestion(cwd, slug, raw) {
|
|
300
|
+
if (!slug)
|
|
301
|
+
error('slug required. Usage: gd genome promote-suggestion <slug>');
|
|
302
|
+
const planning = getPlanningDir(cwd);
|
|
303
|
+
const suggPath = path.join(planning, 'GENOME-SUGGESTIONS.md');
|
|
304
|
+
const suggContent = safeReadMarkdown(suggPath);
|
|
305
|
+
if (!suggContent) {
|
|
306
|
+
error(`no GENOME-SUGGESTIONS.md found at ${path.relative(cwd, suggPath)}. Run \`gd patterns --apply --yes\` first.`);
|
|
307
|
+
}
|
|
308
|
+
// Find the suggested-heuristic line for this slug. Blocks end with
|
|
309
|
+
// `Promote with: ... promote-suggestion <slug>`; the heuristic is the
|
|
310
|
+
// preceding `Suggested heuristic: "..."` line.
|
|
311
|
+
const heuristic = extractSuggestedHeuristic(suggContent, slug);
|
|
312
|
+
if (!heuristic) {
|
|
313
|
+
error(`slug "${slug}" not found in GENOME-SUGGESTIONS.md.`);
|
|
314
|
+
}
|
|
315
|
+
const genomePath = path.join(planning, 'GENOME.md');
|
|
316
|
+
const existing = safeReadFile(genomePath);
|
|
317
|
+
if (existing !== null && isIndexFile(existing)) {
|
|
318
|
+
error('GENOME.md is a GRD-INDEX split file; promote into the reassembled source manually.');
|
|
319
|
+
}
|
|
320
|
+
const date = new Date().toISOString().slice(0, 10);
|
|
321
|
+
const entry = `- ${heuristic} _(promoted ${date} from suggestion \`${slug}\`; edit wording as needed)_\n`;
|
|
322
|
+
const header = '## Heuristics in use (promoted)';
|
|
323
|
+
let next;
|
|
324
|
+
const base = existing ?? '# GENOME\n\nProject meta-strategy.\n';
|
|
325
|
+
if (base.includes(header)) {
|
|
326
|
+
// Append under the existing section (right after the header line).
|
|
327
|
+
next = base.replace(header, `${header}\n${entry.trimEnd()}`);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
next = `${base.trimEnd()}\n\n${header}\n\n${entry}`;
|
|
331
|
+
}
|
|
332
|
+
atomicWriteFileSync(genomePath, next);
|
|
333
|
+
output({ promoted: slug, heuristic, genome_path: path.relative(cwd, genomePath) }, raw, `promoted "${slug}" into ${path.relative(cwd, genomePath)} (edit wording as needed)`);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Extract the "Suggested heuristic" text for a given promote slug.
|
|
337
|
+
*
|
|
338
|
+
* Codex review P2: `gd patterns` appends repeatable `${token}-rate` slugs, so
|
|
339
|
+
* the same slug can recur across run blocks with a LATER run reporting the
|
|
340
|
+
* opposite direction. Scan BOTTOM-UP so the most recent run wins, and match
|
|
341
|
+
* the promote command EXACTLY (anchored to end-of-token) so `foo-rate` does
|
|
342
|
+
* not collide with `foo-rate-2` or `xfoo-rate`.
|
|
343
|
+
*/
|
|
344
|
+
function extractSuggestedHeuristic(suggestions, slug) {
|
|
345
|
+
const lines = suggestions.split('\n');
|
|
346
|
+
// Exact match: the slug is the final token of the promote command line
|
|
347
|
+
// (allow a trailing backtick from the markdown formatting).
|
|
348
|
+
const promoteRe = new RegExp(`promote-suggestion ${slug.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\`?\\s*$`);
|
|
349
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
350
|
+
if (promoteRe.test(lines[i])) {
|
|
351
|
+
for (let j = i; j >= 0 && j > i - 6; j--) {
|
|
352
|
+
const m = lines[j].match(/Suggested heuristic:\s*"([^"]+)"/);
|
|
353
|
+
if (m)
|
|
354
|
+
return m[1];
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
module.exports = {
|
|
361
|
+
cmdGenomeInit,
|
|
362
|
+
cmdGenomeShow,
|
|
363
|
+
cmdGenomeSnapshot,
|
|
364
|
+
cmdGenomePromoteSuggestion,
|
|
365
|
+
runGenomeSnapshot,
|
|
366
|
+
GenomeSplitIndexError,
|
|
367
|
+
};
|
|
368
|
+
//# sourceMappingURL=genome.js.map
|
|
@@ -0,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AC,CAAC,CAAC,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;gBAC7D,IAAI,CAAC;oBAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,OAAO,GAAG;IACf,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,0BAA0B;IAC1B,iBAAiB;IACjB,qBAAqB;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"got.d.ts","sourceRoot":"","sources":["../../lib/got.ts"],"names":[],"mappings":""}
|
package/dist/lib/got.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const { buildArtifactDAG, } = require('./deps');
|
|
4
|
+
// ─── freezeInterfaces ─────────────────────────────────────────────────────────
|
|
5
|
+
/**
|
|
6
|
+
* Freeze interface contracts for all artifact-providing nodes in the DAG.
|
|
7
|
+
*
|
|
8
|
+
* For each node that declares `provides` artifacts, creates a FrozenInterface
|
|
9
|
+
* entry containing the plan_id, artifact name, and a contract comment string.
|
|
10
|
+
* Downstream nodes can reference these frozen contracts when building prompts.
|
|
11
|
+
*
|
|
12
|
+
* @param dag - The artifact DAG built from plan artifacts
|
|
13
|
+
* @returns Array of FrozenInterface entries for all provides declarations
|
|
14
|
+
*/
|
|
15
|
+
function freezeInterfaces(dag) {
|
|
16
|
+
const frozen = [];
|
|
17
|
+
for (const node of dag.nodes) {
|
|
18
|
+
for (const artifact of node.provides) {
|
|
19
|
+
frozen.push({
|
|
20
|
+
plan_id: node.id,
|
|
21
|
+
artifact,
|
|
22
|
+
contract: `// FROZEN CONTRACT: ${artifact} provided by plan ${node.id}\n// Downstream plans may depend on this interface.`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return frozen;
|
|
27
|
+
}
|
|
28
|
+
// ─── buildNodePrompt ──────────────────────────────────────────────────────────
|
|
29
|
+
/**
|
|
30
|
+
* Build an execution prompt string for a single DAG node.
|
|
31
|
+
*
|
|
32
|
+
* The prompt includes:
|
|
33
|
+
* 1. Header with node ID and phase name.
|
|
34
|
+
* 2. Section listing what this node provides.
|
|
35
|
+
* 3. Section listing what this node requires.
|
|
36
|
+
* 4. Section with frozen interface contracts from dependencies.
|
|
37
|
+
* 5. Section with paths (phase_dir, research_dir if present).
|
|
38
|
+
* 6. Execution instructions.
|
|
39
|
+
*
|
|
40
|
+
* @param node - The DAG node to build a prompt for
|
|
41
|
+
* @param frozenInterfaces - All frozen interface contracts for the DAG
|
|
42
|
+
* @param context - Phase name and directory paths
|
|
43
|
+
* @returns Assembled prompt string
|
|
44
|
+
*/
|
|
45
|
+
function buildNodePrompt(node, frozenInterfaces, context) {
|
|
46
|
+
const lines = [];
|
|
47
|
+
// Header
|
|
48
|
+
lines.push(`## Execute Plan ${node.id}: ${context.phase_name}`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
// Provides section
|
|
51
|
+
lines.push('### Provides');
|
|
52
|
+
if (node.provides.length === 0) {
|
|
53
|
+
lines.push('- (none declared)');
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
for (const artifact of node.provides) {
|
|
57
|
+
lines.push(`- ${artifact}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
lines.push('');
|
|
61
|
+
// Requires section
|
|
62
|
+
lines.push('### Requires');
|
|
63
|
+
if (node.requires.length === 0) {
|
|
64
|
+
lines.push('- (none)');
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
for (const req of node.requires) {
|
|
68
|
+
lines.push(`- ${req}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
lines.push('');
|
|
72
|
+
// Frozen contracts from dependencies
|
|
73
|
+
const relevantContracts = frozenInterfaces.filter((fi) => node.requires.includes(fi.artifact));
|
|
74
|
+
if (relevantContracts.length > 0) {
|
|
75
|
+
lines.push('### Frozen Interface Contracts');
|
|
76
|
+
for (const fi of relevantContracts) {
|
|
77
|
+
lines.push('```');
|
|
78
|
+
lines.push(fi.contract);
|
|
79
|
+
lines.push('```');
|
|
80
|
+
}
|
|
81
|
+
lines.push('');
|
|
82
|
+
}
|
|
83
|
+
// Paths section
|
|
84
|
+
lines.push('### Paths');
|
|
85
|
+
lines.push(`- phase_dir: ${context.phase_dir}`);
|
|
86
|
+
if (context.research_dir) {
|
|
87
|
+
lines.push(`- research_dir: ${context.research_dir}`);
|
|
88
|
+
}
|
|
89
|
+
lines.push('');
|
|
90
|
+
// Instructions
|
|
91
|
+
lines.push('### Instructions');
|
|
92
|
+
lines.push('Implement all provides artifacts. Respect frozen contracts from dependencies.');
|
|
93
|
+
return lines.join('\n');
|
|
94
|
+
}
|
|
95
|
+
// ─── runSmokeTest ─────────────────────────────────────────────────────────────
|
|
96
|
+
/**
|
|
97
|
+
* Verify that a node's execution result includes all artifacts it was supposed to provide.
|
|
98
|
+
*
|
|
99
|
+
* Compares the node's declared `provides` artifacts against the `artifacts_produced`
|
|
100
|
+
* array in the execution result. Returns a SmokeTestResult describing what was
|
|
101
|
+
* produced, what is missing, and an overall pass/fail assessment.
|
|
102
|
+
*
|
|
103
|
+
* @param node - The DAG node that was executed
|
|
104
|
+
* @param result - The execution result to smoke test
|
|
105
|
+
* @returns SmokeTestResult with pass/fail, missing artifacts, and message
|
|
106
|
+
*/
|
|
107
|
+
function runSmokeTest(node, result) {
|
|
108
|
+
const produced = new Set(result.artifacts_produced);
|
|
109
|
+
const missing_artifacts = node.provides.filter((a) => !produced.has(a));
|
|
110
|
+
const passed = missing_artifacts.length === 0 && result.success === true;
|
|
111
|
+
let message;
|
|
112
|
+
if (passed) {
|
|
113
|
+
message = `All ${node.provides.length} artifacts produced successfully`;
|
|
114
|
+
}
|
|
115
|
+
else if (!result.success) {
|
|
116
|
+
message = `Execution failed: ${result.error ?? 'unknown error'}`;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
message = `Missing artifacts: ${missing_artifacts.join(', ')}`;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
node_id: node.id,
|
|
123
|
+
passed,
|
|
124
|
+
missing_artifacts,
|
|
125
|
+
message,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// ─── _buildWavesFromDAG ───────────────────────────────────────────────────────
|
|
129
|
+
/**
|
|
130
|
+
* Group DAG nodes into topological execution waves using Kahn's algorithm.
|
|
131
|
+
*
|
|
132
|
+
* Wave 0: nodes with no incoming edges (no requires).
|
|
133
|
+
* Wave N: nodes whose ALL dependencies are in waves < N.
|
|
134
|
+
*
|
|
135
|
+
* @param dag - The artifact DAG to wave-group
|
|
136
|
+
* @returns Array of waves; each wave is an array of plan IDs
|
|
137
|
+
*/
|
|
138
|
+
function _buildWavesFromDAG(dag) {
|
|
139
|
+
// Build in-degree map and adjacency list (producer → [consumers])
|
|
140
|
+
const inDegree = new Map();
|
|
141
|
+
const adjacency = new Map();
|
|
142
|
+
for (const node of dag.nodes) {
|
|
143
|
+
if (!inDegree.has(node.id))
|
|
144
|
+
inDegree.set(node.id, 0);
|
|
145
|
+
if (!adjacency.has(node.id))
|
|
146
|
+
adjacency.set(node.id, []);
|
|
147
|
+
}
|
|
148
|
+
for (const edge of dag.edges) {
|
|
149
|
+
// edge: from_plan (consumer) requires to_plan (producer)
|
|
150
|
+
// producer must execute before consumer
|
|
151
|
+
inDegree.set(edge.from_plan, (inDegree.get(edge.from_plan) ?? 0) + 1);
|
|
152
|
+
const consumers = adjacency.get(edge.to_plan);
|
|
153
|
+
if (consumers !== undefined) {
|
|
154
|
+
consumers.push(edge.from_plan);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const waves = [];
|
|
158
|
+
const remaining = new Set(dag.nodes.map((n) => n.id));
|
|
159
|
+
while (remaining.size > 0) {
|
|
160
|
+
const wave = [];
|
|
161
|
+
for (const nodeId of remaining) {
|
|
162
|
+
if ((inDegree.get(nodeId) ?? 0) === 0) {
|
|
163
|
+
wave.push(nodeId);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (wave.length === 0) {
|
|
167
|
+
// Cycle prevents completion — collect all remaining and emit as last wave
|
|
168
|
+
wave.push(...Array.from(remaining));
|
|
169
|
+
for (const nodeId of wave) {
|
|
170
|
+
remaining.delete(nodeId);
|
|
171
|
+
}
|
|
172
|
+
waves.push(wave.sort());
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
wave.sort();
|
|
176
|
+
for (const nodeId of wave) {
|
|
177
|
+
remaining.delete(nodeId);
|
|
178
|
+
for (const consumer of (adjacency.get(nodeId) ?? [])) {
|
|
179
|
+
if (remaining.has(consumer)) {
|
|
180
|
+
inDegree.set(consumer, inDegree.get(consumer) - 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
waves.push(wave);
|
|
185
|
+
}
|
|
186
|
+
return waves;
|
|
187
|
+
}
|
|
188
|
+
// ─── executeArtifactDAG ───────────────────────────────────────────────────────
|
|
189
|
+
/**
|
|
190
|
+
* Orchestrate execution of an ArtifactDAG using GoT topological wave processing.
|
|
191
|
+
*
|
|
192
|
+
* Groups nodes into topological waves, freezes interface contracts, then for
|
|
193
|
+
* each node: builds a prompt, executes (dry-run stub by default), runs a
|
|
194
|
+
* smoke test, and retries on failure up to maxRetries times.
|
|
195
|
+
*
|
|
196
|
+
* The actual agent spawning is NOT implemented — callers integrate by replacing
|
|
197
|
+
* the dry-run stub with their own dispatch logic.
|
|
198
|
+
*
|
|
199
|
+
* @param dag - The artifact DAG to execute
|
|
200
|
+
* @param options - Execution options (maxRetries, dryRun)
|
|
201
|
+
* @returns GoTExecutionResult with waves, per-node results, smoke tests, and overall success
|
|
202
|
+
*/
|
|
203
|
+
function executeArtifactDAG(dag, options) {
|
|
204
|
+
const maxRetries = options?.maxRetries ?? 1;
|
|
205
|
+
const dryRun = options?.dryRun !== false; // default true
|
|
206
|
+
// Step 1: group into waves
|
|
207
|
+
const waves = _buildWavesFromDAG(dag);
|
|
208
|
+
// Step 2: freeze interfaces once
|
|
209
|
+
const frozenInterfaces = freezeInterfaces(dag);
|
|
210
|
+
const results = [];
|
|
211
|
+
const smoke_tests = [];
|
|
212
|
+
let retries = 0;
|
|
213
|
+
// Build a nodeId → node lookup
|
|
214
|
+
const nodeMap = new Map();
|
|
215
|
+
for (const node of dag.nodes) {
|
|
216
|
+
nodeMap.set(node.id, node);
|
|
217
|
+
}
|
|
218
|
+
// Step 3: process each wave sequentially
|
|
219
|
+
for (const wave of waves) {
|
|
220
|
+
for (const nodeId of wave) {
|
|
221
|
+
const node = nodeMap.get(nodeId);
|
|
222
|
+
if (!node)
|
|
223
|
+
continue;
|
|
224
|
+
// Build prompt (context is minimal for dry-run; result captured for future dispatch)
|
|
225
|
+
void buildNodePrompt(node, frozenInterfaces, {
|
|
226
|
+
phase_name: node.id,
|
|
227
|
+
phase_dir: '',
|
|
228
|
+
});
|
|
229
|
+
// Execute the node
|
|
230
|
+
let execResult;
|
|
231
|
+
if (dryRun) {
|
|
232
|
+
// Stub: success with all provides produced
|
|
233
|
+
execResult = {
|
|
234
|
+
node_id: node.id,
|
|
235
|
+
success: true,
|
|
236
|
+
artifacts_produced: [...node.provides],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
// Real dispatch is deferred to integration phase
|
|
241
|
+
execResult = {
|
|
242
|
+
node_id: node.id,
|
|
243
|
+
success: false,
|
|
244
|
+
artifacts_produced: [],
|
|
245
|
+
error: 'Real execution not implemented — use dryRun mode',
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
// Smoke test + retry loop
|
|
249
|
+
let smokeResult = runSmokeTest(node, execResult);
|
|
250
|
+
let attempt = 0;
|
|
251
|
+
while (!smokeResult.passed && attempt < maxRetries) {
|
|
252
|
+
retries++;
|
|
253
|
+
attempt++;
|
|
254
|
+
// Re-execute (same dry-run stub)
|
|
255
|
+
if (dryRun) {
|
|
256
|
+
execResult = {
|
|
257
|
+
node_id: node.id,
|
|
258
|
+
success: true,
|
|
259
|
+
artifacts_produced: [...node.provides],
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
smokeResult = runSmokeTest(node, execResult);
|
|
263
|
+
}
|
|
264
|
+
results.push(execResult);
|
|
265
|
+
smoke_tests.push(smokeResult);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const success = smoke_tests.every((s) => s.passed);
|
|
269
|
+
return { waves, results, smoke_tests, retries, success };
|
|
270
|
+
}
|
|
271
|
+
// ─── Exports ──────────────────────────────────────────────────────────────────
|
|
272
|
+
// Expose buildArtifactDAG re-export so callers can use it without double-requiring deps
|
|
273
|
+
void buildArtifactDAG; // used by callers; silence unused-import linting
|
|
274
|
+
module.exports = {
|
|
275
|
+
freezeInterfaces,
|
|
276
|
+
buildNodePrompt,
|
|
277
|
+
runSmokeTest,
|
|
278
|
+
executeArtifactDAG,
|
|
279
|
+
};
|
|
280
|
+
//# sourceMappingURL=got.js.map
|