@entelligentsia/forgecli 1.0.25 → 1.0.36
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/CHANGELOG.md +258 -0
- package/README.md +2 -0
- package/dist/CHANGELOG-forge-plugin.md +163 -0
- package/dist/bin/argv.d.ts +2 -2
- package/dist/bin/argv.js +25 -0
- package/dist/bin/argv.js.map +1 -1
- package/dist/bin/forge.js +12 -0
- package/dist/bin/forge.js.map +1 -1
- package/dist/bin/init.d.ts +23 -0
- package/dist/bin/init.js +123 -0
- package/dist/bin/init.js.map +1 -0
- package/dist/bin/uninstall.d.ts +20 -0
- package/dist/bin/uninstall.js +141 -0
- package/dist/bin/uninstall.js.map +1 -0
- package/dist/extensions/forgecli/add-pipeline.d.ts +19 -0
- package/dist/extensions/forgecli/add-pipeline.js +143 -0
- package/dist/extensions/forgecli/add-pipeline.js.map +1 -0
- package/dist/extensions/forgecli/add-task.d.ts +20 -0
- package/dist/extensions/forgecli/add-task.js +154 -0
- package/dist/extensions/forgecli/add-task.js.map +1 -0
- package/dist/extensions/forgecli/approve.d.ts +22 -0
- package/dist/extensions/forgecli/approve.js +152 -0
- package/dist/extensions/forgecli/approve.js.map +1 -0
- package/dist/extensions/forgecli/banner.d.ts +10 -0
- package/dist/extensions/forgecli/banner.js +36 -0
- package/dist/extensions/forgecli/banner.js.map +1 -0
- package/dist/extensions/forgecli/calibrate.d.ts +64 -0
- package/dist/extensions/forgecli/calibrate.js +481 -0
- package/dist/extensions/forgecli/calibrate.js.map +1 -0
- package/dist/extensions/forgecli/claude-bootstrap/bootstrap.d.ts +40 -0
- package/dist/extensions/forgecli/claude-bootstrap/bootstrap.js +593 -0
- package/dist/extensions/forgecli/claude-bootstrap/bootstrap.js.map +1 -0
- package/dist/extensions/forgecli/claude-bootstrap/settings-merge.d.ts +46 -0
- package/dist/extensions/forgecli/claude-bootstrap/settings-merge.js +245 -0
- package/dist/extensions/forgecli/claude-bootstrap/settings-merge.js.map +1 -0
- package/dist/extensions/forgecli/claude-bootstrap/uninstall.d.ts +23 -0
- package/dist/extensions/forgecli/claude-bootstrap/uninstall.js +215 -0
- package/dist/extensions/forgecli/claude-bootstrap/uninstall.js.map +1 -0
- package/dist/extensions/forgecli/collate.d.ts +22 -0
- package/dist/extensions/forgecli/collate.js +134 -0
- package/dist/extensions/forgecli/collate.js.map +1 -0
- package/dist/extensions/forgecli/commit.d.ts +22 -0
- package/dist/extensions/forgecli/commit.js +152 -0
- package/dist/extensions/forgecli/commit.js.map +1 -0
- package/dist/extensions/forgecli/config-command.d.ts +8 -0
- package/dist/extensions/forgecli/config-command.js +67 -0
- package/dist/extensions/forgecli/config-command.js.map +1 -0
- package/dist/extensions/forgecli/config-layer.d.ts +53 -0
- package/dist/extensions/forgecli/config-layer.js +72 -0
- package/dist/extensions/forgecli/config-layer.js.map +1 -0
- package/dist/extensions/forgecli/config-writer.d.ts +16 -0
- package/dist/extensions/forgecli/config-writer.js +69 -0
- package/dist/extensions/forgecli/config-writer.js.map +1 -0
- package/dist/extensions/forgecli/dashboard/component.js +10 -7
- package/dist/extensions/forgecli/dashboard/component.js.map +1 -1
- package/dist/extensions/forgecli/enhance.d.ts +27 -0
- package/dist/extensions/forgecli/enhance.js +199 -0
- package/dist/extensions/forgecli/enhance.js.map +1 -0
- package/dist/extensions/forgecli/fix-bug.d.ts +85 -0
- package/dist/extensions/forgecli/fix-bug.js +1580 -0
- package/dist/extensions/forgecli/fix-bug.js.map +1 -0
- package/dist/extensions/forgecli/forge-header.d.ts +12 -0
- package/dist/extensions/forgecli/forge-header.js +114 -0
- package/dist/extensions/forgecli/forge-header.js.map +1 -0
- package/dist/extensions/forgecli/forge-init.d.ts +26 -0
- package/dist/extensions/forgecli/forge-init.js +514 -0
- package/dist/extensions/forgecli/forge-init.js.map +1 -0
- package/dist/extensions/forgecli/forge-root.d.ts +10 -0
- package/dist/extensions/forgecli/forge-root.js +62 -0
- package/dist/extensions/forgecli/forge-root.js.map +1 -0
- package/dist/extensions/forgecli/forge-update-command.d.ts +100 -0
- package/dist/extensions/forgecli/forge-update-command.js +435 -0
- package/dist/extensions/forgecli/forge-update-command.js.map +1 -0
- package/dist/extensions/forgecli/friction-emit.d.ts +99 -0
- package/dist/extensions/forgecli/friction-emit.js +245 -0
- package/dist/extensions/forgecli/friction-emit.js.map +1 -0
- package/dist/extensions/forgecli/implement.d.ts +22 -0
- package/dist/extensions/forgecli/implement.js +170 -0
- package/dist/extensions/forgecli/implement.js.map +1 -0
- package/dist/extensions/forgecli/init-context.d.ts +99 -0
- package/dist/extensions/forgecli/init-context.js +178 -0
- package/dist/extensions/forgecli/init-context.js.map +1 -0
- package/dist/extensions/forgecli/init-progress.d.ts +39 -0
- package/dist/extensions/forgecli/init-progress.js +117 -0
- package/dist/extensions/forgecli/init-progress.js.map +1 -0
- package/dist/extensions/forgecli/input-router.d.ts +33 -0
- package/dist/extensions/forgecli/input-router.js +136 -0
- package/dist/extensions/forgecli/input-router.js.map +1 -0
- package/dist/extensions/forgecli/lib/halt-advisor.d.ts +59 -0
- package/dist/extensions/forgecli/lib/halt-advisor.js +113 -0
- package/dist/extensions/forgecli/lib/halt-advisor.js.map +1 -0
- package/dist/extensions/forgecli/lib/orchestrator-preflight.d.ts +46 -0
- package/dist/extensions/forgecli/lib/orchestrator-preflight.js +64 -0
- package/dist/extensions/forgecli/lib/orchestrator-preflight.js.map +1 -0
- package/dist/extensions/forgecli/materialize.d.ts +16 -0
- package/dist/extensions/forgecli/materialize.js +195 -0
- package/dist/extensions/forgecli/materialize.js.map +1 -0
- package/dist/extensions/forgecli/migrate.d.ts +22 -0
- package/dist/extensions/forgecli/migrate.js +260 -0
- package/dist/extensions/forgecli/migrate.js.map +1 -0
- package/dist/extensions/forgecli/migration-engine.d.ts +117 -0
- package/dist/extensions/forgecli/migration-engine.js +563 -0
- package/dist/extensions/forgecli/migration-engine.js.map +1 -0
- package/dist/extensions/forgecli/model-registry.d.ts +61 -0
- package/dist/extensions/forgecli/model-registry.js +127 -0
- package/dist/extensions/forgecli/model-registry.js.map +1 -0
- package/dist/extensions/forgecli/model-resolver.d.ts +32 -0
- package/dist/extensions/forgecli/model-resolver.js +65 -0
- package/dist/extensions/forgecli/model-resolver.js.map +1 -0
- package/dist/extensions/forgecli/model-validator.d.ts +29 -0
- package/dist/extensions/forgecli/model-validator.js +107 -0
- package/dist/extensions/forgecli/model-validator.js.map +1 -0
- package/dist/extensions/forgecli/orchestrator-status-bar.d.ts +26 -0
- package/dist/extensions/forgecli/orchestrator-status-bar.js +213 -0
- package/dist/extensions/forgecli/orchestrator-status-bar.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-body.d.ts +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-body.js +65 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-body.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-id.d.ts +23 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-id.js +140 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-id.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.d.ts +54 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.js +349 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phase-dispatch.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phases.d.ts +8 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phases.js +60 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-phases.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-state.d.ts +14 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-state.js +100 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-state.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.d.ts +72 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.js +204 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-triage-routing.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.d.ts +38 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.js +166 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict-loop.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.d.ts +3 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.js +55 -0
- package/dist/extensions/forgecli/orchestrators/bug/bug-verdict.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.d.ts +7 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.js +293 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-command.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.d.ts +2 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.js +501 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-pipeline.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.d.ts +41 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.js +5 -0
- package/dist/extensions/forgecli/orchestrators/bug/run-bug-types.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.d.ts +43 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.js +85 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-entry.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.d.ts +8 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.js +37 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-misc.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.d.ts +28 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.js +45 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-notify.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.d.ts +26 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.js +75 -0
- package/dist/extensions/forgecli/orchestrators/common/orchestrator-transcript-session.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/common/summary-recovery.d.ts +24 -0
- package/dist/extensions/forgecli/orchestrators/common/summary-recovery.js +37 -0
- package/dist/extensions/forgecli/orchestrators/common/summary-recovery.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/fix-bug.d.ts +9 -93
- package/dist/extensions/forgecli/orchestrators/fix-bug.js +23 -1721
- package/dist/extensions/forgecli/orchestrators/fix-bug.js.map +1 -1
- package/dist/extensions/forgecli/orchestrators/run-sprint.d.ts +3 -12
- package/dist/extensions/forgecli/orchestrators/run-sprint.js +48 -270
- package/dist/extensions/forgecli/orchestrators/run-sprint.js.map +1 -1
- package/dist/extensions/forgecli/orchestrators/run-task.d.ts +10 -214
- package/dist/extensions/forgecli/orchestrators/run-task.js +31 -1481
- package/dist/extensions/forgecli/orchestrators/run-task.js.map +1 -1
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.d.ts +33 -0
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.js +135 -0
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-ceremony.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.d.ts +18 -0
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.js +55 -0
- package/dist/extensions/forgecli/orchestrators/sprint/sprint-state.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-command.d.ts +9 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-command.js +174 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-command.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.d.ts +2 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.js +494 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-pipeline.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-types.d.ts +62 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-types.js +5 -0
- package/dist/extensions/forgecli/orchestrators/task/run-task-types.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-body.d.ts +4 -0
- package/dist/extensions/forgecli/orchestrators/task/task-body.js +48 -0
- package/dist/extensions/forgecli/orchestrators/task/task-body.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-events.d.ts +63 -0
- package/dist/extensions/forgecli/orchestrators/task/task-events.js +185 -0
- package/dist/extensions/forgecli/orchestrators/task/task-events.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-gates.d.ts +34 -0
- package/dist/extensions/forgecli/orchestrators/task/task-gates.js +78 -0
- package/dist/extensions/forgecli/orchestrators/task/task-gates.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.d.ts +42 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.js +370 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phase-dispatch.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phases.d.ts +14 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phases.js +26 -0
- package/dist/extensions/forgecli/orchestrators/task/task-phases.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-record.d.ts +9 -0
- package/dist/extensions/forgecli/orchestrators/task/task-record.js +58 -0
- package/dist/extensions/forgecli/orchestrators/task/task-record.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-state.d.ts +14 -0
- package/dist/extensions/forgecli/orchestrators/task/task-state.js +35 -0
- package/dist/extensions/forgecli/orchestrators/task/task-state.js.map +1 -0
- package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.d.ts +36 -0
- package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.js +152 -0
- package/dist/extensions/forgecli/orchestrators/task/task-verdict-loop.js.map +1 -0
- package/dist/extensions/forgecli/plan.d.ts +22 -0
- package/dist/extensions/forgecli/plan.js +167 -0
- package/dist/extensions/forgecli/plan.js.map +1 -0
- package/dist/extensions/forgecli/quiz-agent.d.ts +17 -0
- package/dist/extensions/forgecli/quiz-agent.js +98 -0
- package/dist/extensions/forgecli/quiz-agent.js.map +1 -0
- package/dist/extensions/forgecli/read-command.d.ts +2 -0
- package/dist/extensions/forgecli/read-command.js +100 -0
- package/dist/extensions/forgecli/read-command.js.map +1 -0
- package/dist/extensions/forgecli/regenerate.d.ts +40 -0
- package/dist/extensions/forgecli/regenerate.js +438 -0
- package/dist/extensions/forgecli/regenerate.js.map +1 -0
- package/dist/extensions/forgecli/remove-command.d.ts +17 -0
- package/dist/extensions/forgecli/remove-command.js +124 -0
- package/dist/extensions/forgecli/remove-command.js.map +1 -0
- package/dist/extensions/forgecli/report-bug.d.ts +25 -0
- package/dist/extensions/forgecli/report-bug.js +159 -0
- package/dist/extensions/forgecli/report-bug.js.map +1 -0
- package/dist/extensions/forgecli/retrospective.d.ts +20 -0
- package/dist/extensions/forgecli/retrospective.js +126 -0
- package/dist/extensions/forgecli/retrospective.js.map +1 -0
- package/dist/extensions/forgecli/review-code.d.ts +35 -0
- package/dist/extensions/forgecli/review-code.js +196 -0
- package/dist/extensions/forgecli/review-code.js.map +1 -0
- package/dist/extensions/forgecli/review-plan.d.ts +35 -0
- package/dist/extensions/forgecli/review-plan.js +200 -0
- package/dist/extensions/forgecli/review-plan.js.map +1 -0
- package/dist/extensions/forgecli/run-sprint.d.ts +27 -0
- package/dist/extensions/forgecli/run-sprint.js +716 -0
- package/dist/extensions/forgecli/run-sprint.js.map +1 -0
- package/dist/extensions/forgecli/run-task.d.ts +204 -0
- package/dist/extensions/forgecli/run-task.js +1403 -0
- package/dist/extensions/forgecli/run-task.js.map +1 -0
- package/dist/extensions/forgecli/skill-curation-flag.d.ts +21 -0
- package/dist/extensions/forgecli/skill-curation-flag.js +71 -0
- package/dist/extensions/forgecli/skill-curation-flag.js.map +1 -0
- package/dist/extensions/forgecli/skill-curator-subagent.d.ts +102 -0
- package/dist/extensions/forgecli/skill-curator-subagent.js +339 -0
- package/dist/extensions/forgecli/skill-curator-subagent.js.map +1 -0
- package/dist/extensions/forgecli/skill-retriever.d.ts +84 -0
- package/dist/extensions/forgecli/skill-retriever.js +246 -0
- package/dist/extensions/forgecli/skill-retriever.js.map +1 -0
- package/dist/extensions/forgecli/skill-usage-tracker.d.ts +91 -0
- package/dist/extensions/forgecli/skill-usage-tracker.js +224 -0
- package/dist/extensions/forgecli/skill-usage-tracker.js.map +1 -0
- package/dist/extensions/forgecli/sprint-intake.d.ts +10 -0
- package/dist/extensions/forgecli/sprint-intake.js +91 -0
- package/dist/extensions/forgecli/sprint-intake.js.map +1 -0
- package/dist/extensions/forgecli/sprint-plan.d.ts +14 -0
- package/dist/extensions/forgecli/sprint-plan.js +122 -0
- package/dist/extensions/forgecli/sprint-plan.js.map +1 -0
- package/dist/extensions/forgecli/status-command.d.ts +19 -0
- package/dist/extensions/forgecli/status-command.js +140 -0
- package/dist/extensions/forgecli/status-command.js.map +1 -0
- package/dist/extensions/forgecli/store-error-remediation.d.ts +65 -0
- package/dist/extensions/forgecli/store-error-remediation.js +307 -0
- package/dist/extensions/forgecli/store-error-remediation.js.map +1 -0
- package/dist/extensions/forgecli/store-query.d.ts +22 -0
- package/dist/extensions/forgecli/store-query.js +107 -0
- package/dist/extensions/forgecli/store-query.js.map +1 -0
- package/dist/extensions/forgecli/store-repair.d.ts +17 -0
- package/dist/extensions/forgecli/store-repair.js +123 -0
- package/dist/extensions/forgecli/store-repair.js.map +1 -0
- package/dist/extensions/forgecli/store-resolver.d.ts +56 -0
- package/dist/extensions/forgecli/store-resolver.js +263 -0
- package/dist/extensions/forgecli/store-resolver.js.map +1 -0
- package/dist/extensions/forgecli/store-validator.d.ts +16 -0
- package/dist/extensions/forgecli/store-validator.js +32 -0
- package/dist/extensions/forgecli/store-validator.js.map +1 -0
- package/dist/extensions/forgecli/test-orchestrate.d.ts +2 -0
- package/dist/extensions/forgecli/test-orchestrate.js +182 -0
- package/dist/extensions/forgecli/test-orchestrate.js.map +1 -0
- package/dist/extensions/forgecli/thread-switcher.d.ts +5 -0
- package/dist/extensions/forgecli/thread-switcher.js +189 -0
- package/dist/extensions/forgecli/thread-switcher.js.map +1 -0
- package/dist/extensions/forgecli/transition-guard.d.ts +20 -0
- package/dist/extensions/forgecli/transition-guard.js +89 -0
- package/dist/extensions/forgecli/transition-guard.js.map +1 -0
- package/dist/extensions/forgecli/update/forge-update-command.js +10 -7
- package/dist/extensions/forgecli/update/forge-update-command.js.map +1 -1
- package/dist/extensions/forgecli/update-check.d.ts +37 -0
- package/dist/extensions/forgecli/update-check.js +185 -0
- package/dist/extensions/forgecli/update-check.js.map +1 -0
- package/dist/extensions/forgecli/update-tools.d.ts +23 -0
- package/dist/extensions/forgecli/update-tools.js +135 -0
- package/dist/extensions/forgecli/update-tools.js.map +1 -0
- package/dist/extensions/forgecli/validate.d.ts +22 -0
- package/dist/extensions/forgecli/validate.js +152 -0
- package/dist/extensions/forgecli/validate.js.map +1 -0
- package/dist/extensions/forgecli/viewport-events.d.ts +78 -0
- package/dist/extensions/forgecli/viewport-events.js +243 -0
- package/dist/extensions/forgecli/viewport-events.js.map +1 -0
- package/dist/extensions/forgecli/viewport-renderer.d.ts +83 -0
- package/dist/extensions/forgecli/viewport-renderer.js +233 -0
- package/dist/extensions/forgecli/viewport-renderer.js.map +1 -0
- package/dist/extensions/forgecli/viewport-theme.d.ts +11 -0
- package/dist/extensions/forgecli/viewport-theme.js +128 -0
- package/dist/extensions/forgecli/viewport-theme.js.map +1 -0
- package/dist/extensions/forgecli/whats-new-widget.d.ts +26 -0
- package/dist/extensions/forgecli/whats-new-widget.js +376 -0
- package/dist/extensions/forgecli/whats-new-widget.js.map +1 -0
- package/dist/extensions/forgecli/whats-new.d.ts +120 -0
- package/dist/extensions/forgecli/whats-new.js +470 -0
- package/dist/extensions/forgecli/whats-new.js.map +1 -0
- package/dist/forge-payload/.base-pack/commands/approve.md +2 -2
- package/dist/forge-payload/.base-pack/commands/check-agent.md +2 -2
- package/dist/forge-payload/.base-pack/commands/collate.md +2 -2
- package/dist/forge-payload/.base-pack/commands/commit.md +2 -2
- package/dist/forge-payload/.base-pack/commands/enhance.md +2 -2
- package/dist/forge-payload/.base-pack/commands/fix-bug.md +2 -2
- package/dist/forge-payload/.base-pack/commands/implement.md +2 -2
- package/dist/forge-payload/.base-pack/commands/init.md +278 -0
- package/dist/forge-payload/.base-pack/commands/new-sprint.md +2 -2
- package/dist/forge-payload/.base-pack/commands/plan-sprint.md +2 -2
- package/dist/forge-payload/.base-pack/commands/plan.md +2 -2
- package/dist/forge-payload/.base-pack/commands/retro.md +2 -2
- package/dist/forge-payload/.base-pack/commands/review-code.md +2 -2
- package/dist/forge-payload/.base-pack/commands/review-plan.md +2 -2
- package/dist/forge-payload/.base-pack/commands/run-sprint.md +2 -2
- package/dist/forge-payload/.base-pack/commands/run-task.md +2 -2
- package/dist/forge-payload/.base-pack/commands/validate.md +2 -2
- package/dist/forge-payload/.base-pack/workflows/collator_agent.md +5 -6
- package/dist/forge-payload/.base-pack/workflows/migrate_structural.md +1 -1
- package/dist/forge-payload/.base-pack/workflows-js/wfl-init.js +449 -0
- package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
- package/dist/forge-payload/.schemas/enum-catalog.json +2 -2
- package/dist/forge-payload/.schemas/migrations.json +85 -0
- package/dist/forge-payload/commands/add-pipeline.md +1 -1
- package/dist/forge-payload/commands/add-task.md +3 -3
- package/dist/forge-payload/commands/ask.md +1 -1
- package/dist/forge-payload/commands/check-agent.md +1 -1
- package/dist/forge-payload/commands/config.md +1 -1
- package/dist/forge-payload/commands/health.md +1 -1
- package/dist/forge-payload/commands/init.md +62 -7
- package/dist/forge-payload/commands/rebuild.md +3 -3
- package/dist/forge-payload/commands/remove.md +1 -1
- package/dist/forge-payload/commands/repair.md +1 -1
- package/dist/forge-payload/commands/report-bug.md +1 -1
- package/dist/forge-payload/commands/status.md +1 -1
- package/dist/forge-payload/commands/update.md +3 -3
- package/dist/forge-payload/hooks/lib/common.cjs +228 -0
- package/dist/forge-payload/hooks/lib/plugin-detection.cjs +106 -0
- package/dist/forge-payload/hooks/lib/update-msg.cjs +23 -0
- package/dist/forge-payload/hooks/lib/update-url.cjs +46 -0
- package/dist/forge-payload/hooks/lib/write-registry.js +53 -0
- package/dist/forge-payload/init/discovery/discover-database.md +32 -0
- package/dist/forge-payload/init/discovery/discover-processes.md +31 -0
- package/dist/forge-payload/init/discovery/discover-routing.md +31 -0
- package/dist/forge-payload/init/discovery/discover-stack.md +33 -0
- package/dist/forge-payload/init/discovery/discover-testing.md +34 -0
- package/dist/forge-payload/init/generation/generate-commands.md +171 -0
- package/dist/forge-payload/init/generation/generate-kb-doc.md +60 -0
- package/dist/forge-payload/init/generation/generate-knowledge-base.md +56 -0
- package/dist/forge-payload/init/generation/generate-persona.md +73 -0
- package/dist/forge-payload/init/generation/generate-personas.md +54 -0
- package/dist/forge-payload/init/generation/generate-skill.md +66 -0
- package/dist/forge-payload/init/generation/generate-skills.md +36 -0
- package/dist/forge-payload/init/generation/generate-template.md +60 -0
- package/dist/forge-payload/init/generation/generate-templates.md +39 -0
- package/dist/forge-payload/init/generation/generate-tools.md +133 -0
- package/dist/forge-payload/init/generation/generate-workflows.md +78 -0
- package/dist/forge-payload/init/phases/phase-1-collect.md +10 -2
- package/dist/forge-payload/init/phases/phase-3-materialize.md +1 -1
- package/dist/forge-payload/init/phases/phase-4-register.md +8 -0
- package/dist/forge-payload/init/workflow-gen-plan.json +17 -0
- package/dist/forge-payload/integrity.json +16 -16
- package/dist/forge-payload/meta/workflows/meta-collate.md +5 -6
- package/dist/forge-payload/meta/workflows/meta-migrate.md +1 -1
- package/dist/forge-payload/schemas/enum-catalog.json +2 -2
- package/dist/forge-payload/schemas/structure-manifest.json +3 -12
- package/dist/forge-payload/tools/forge-preflight.cjs +268 -0
- package/dist/forge-payload/tools/lib/paths.cjs +12 -11
- package/dist/forge-payload/tools/lib/pricing.cjs +31 -11
- package/dist/forge-payload/tools/query-logger.cjs +34 -0
- package/dist/forge-payload/tools/substitute-placeholders.cjs +5 -6
- package/node_modules/@mariozechner/clipboard/package.json +1 -2
- package/package.json +2 -2
- package/node_modules/@mariozechner/clipboard-linux-x64-musl/README.md +0 -3
- package/node_modules/@mariozechner/clipboard-linux-x64-musl/package.json +0 -25
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// bug-body.ts — compose the per-phase subagent prompt body for a bug, with the
|
|
2
|
+
// entity-kind override block prepended before the workflow body. Extracted
|
|
3
|
+
// VERBATIM from fix-bug.ts (FORGE-S31 file-size refactor); no logic changes.
|
|
4
|
+
// ── Bug body composition ──────────────────────────────────────────────────
|
|
5
|
+
export function composeBugBody(subWorkflowMd, bugId, phaseRole, bugStatusBeforePhase, summariesBlock) {
|
|
6
|
+
// Entity-kind override block prepended before workflow body.
|
|
7
|
+
// Conforms to forge v0.44.x meta-fix-bug contract:
|
|
8
|
+
// - bug.status enum is {reported, triaged, in-progress, fixed}; `fixed` is terminal.
|
|
9
|
+
// - `approved` and `verified` are NOT valid bug status values (dropped in v0.44.0).
|
|
10
|
+
// - Approve phase: NO status write. Architect writes summaries.approve.verdict
|
|
11
|
+
// via set-bug-summary; verdict signal IS the summary (read by
|
|
12
|
+
// read-verdict.cjs § BUG_PHASE_VERDICT_SOURCE).
|
|
13
|
+
// - Commit phase: status → fixed (the only status transition post-triage).
|
|
14
|
+
//
|
|
15
|
+
// Earlier revisions of this prompt told the architect to write
|
|
16
|
+
// `update-status bug ... approved` and the engineer to write `... verified`.
|
|
17
|
+
// Those instructions produced the FORGE-BUG-002 trap (LLM-translation of
|
|
18
|
+
// task-shaped approve workflow → illegal transition through a terminal state).
|
|
19
|
+
// The new contract removes the trap at its source.
|
|
20
|
+
const entityKindLines = [
|
|
21
|
+
`Bug ID: ${bugId}`,
|
|
22
|
+
"",
|
|
23
|
+
"⚠ ENTITY KIND OVERRIDE: This is a bug, not a task.",
|
|
24
|
+
"- All `update-status` calls must use entity kind `bug` (not `task`).",
|
|
25
|
+
"- Approve phase: NO status write. Write the approval verdict via set-bug-summary:",
|
|
26
|
+
` node "$FORGE_ROOT/tools/store-cli.cjs" set-bug-summary ${bugId} approve <APPROVE-SUMMARY.json>`,
|
|
27
|
+
` The summary's "verdict" field MUST be "approved" or "revision". The downstream commit gate reads this, not bug.status.`,
|
|
28
|
+
`- Commit phase: on successful git commit, run \`node "$FORGE_ROOT/tools/store-cli.cjs" update-status bug ${bugId} status fixed\` (terminal).`,
|
|
29
|
+
`- Do NOT write "approved" or "verified" to bug.status — those values were removed from the schema in forge v0.44.0.`,
|
|
30
|
+
`- Do NOT reference task-specific status values (e.g., "committed") or task entity kind.`,
|
|
31
|
+
"- CRITICAL: All `set-summary` calls must use `set-bug-summary` (not `set-summary`).",
|
|
32
|
+
` e.g. node "$FORGE_ROOT/tools/store-cli.cjs" set-bug-summary ${bugId} review_plan <jsonFile>`,
|
|
33
|
+
`- Preflight gate: use \`--bug\` flag (not \`--task\`). e.g. node "$FORGE_ROOT/tools/preflight-gate.cjs" --phase review-plan --bug ${bugId}`,
|
|
34
|
+
"- Skip re-running preflight-gate — the orchestrator already checked it. Proceed directly to the review.",
|
|
35
|
+
'Any workflow text that says "task" should be read as "bug" for this context.',
|
|
36
|
+
];
|
|
37
|
+
// Phase-specific reinforcement when the orchestrator can name the current status.
|
|
38
|
+
if (phaseRole === "approve" && bugStatusBeforePhase) {
|
|
39
|
+
entityKindLines.push(`- Approve phase (reinforce): bug.status is currently '${bugStatusBeforePhase}' and MUST NOT change in this phase. Record verdict in summaries.approve only.`);
|
|
40
|
+
}
|
|
41
|
+
if (phaseRole === "commit" && bugStatusBeforePhase) {
|
|
42
|
+
entityKindLines.push(`- Commit phase: after the git commit lands, transition bug.status from '${bugStatusBeforePhase}' to 'fixed'.`);
|
|
43
|
+
}
|
|
44
|
+
// FORGE-BUG-040: the triage-phase hint block previously prepended here
|
|
45
|
+
// compensated for the orchestrator-only fix_bug.md being delivered to
|
|
46
|
+
// the triage subagent. With the new phase-scoped triage.md sub-workflow,
|
|
47
|
+
// the route-field contract and Path A/B criteria are documented natively
|
|
48
|
+
// in the workflow body — no compose-time injection required.
|
|
49
|
+
const parts = [
|
|
50
|
+
`Read the workflow below and follow it. Bug ID: ${bugId}.`,
|
|
51
|
+
"",
|
|
52
|
+
"---",
|
|
53
|
+
"",
|
|
54
|
+
entityKindLines.join("\n"),
|
|
55
|
+
"",
|
|
56
|
+
"---",
|
|
57
|
+
"",
|
|
58
|
+
];
|
|
59
|
+
if (summariesBlock) {
|
|
60
|
+
parts.push(summariesBlock, "", "---", "");
|
|
61
|
+
}
|
|
62
|
+
parts.push(subWorkflowMd.trim());
|
|
63
|
+
return parts.join("\n");
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=bug-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bug-body.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators/bug/bug-body.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,2EAA2E;AAC3E,6EAA6E;AAE7E,6EAA6E;AAE7E,MAAM,UAAU,cAAc,CAC7B,aAAqB,EACrB,KAAa,EACb,SAAiB,EACjB,oBAA6B,EAC7B,cAAuB;IAEvB,6DAA6D;IAC7D,mDAAmD;IACnD,uFAAuF;IACvF,sFAAsF;IACtF,iFAAiF;IACjF,kEAAkE;IAClE,oDAAoD;IACpD,6EAA6E;IAC7E,EAAE;IACF,+DAA+D;IAC/D,6EAA6E;IAC7E,yEAAyE;IACzE,+EAA+E;IAC/E,mDAAmD;IACnD,MAAM,eAAe,GAAa;QACjC,WAAW,KAAK,EAAE;QAClB,EAAE;QACF,oDAAoD;QACpD,sEAAsE;QACtE,mFAAmF;QACnF,4DAA4D,KAAK,iCAAiC;QAClG,0HAA0H;QAC1H,4GAA4G,KAAK,6BAA6B;QAC9I,qHAAqH;QACrH,yFAAyF;QACzF,qFAAqF;QACrF,iEAAiE,KAAK,yBAAyB;QAC/F,qIAAqI,KAAK,EAAE;QAC5I,yGAAyG;QACzG,8EAA8E;KAC9E,CAAC;IAEF,kFAAkF;IAClF,IAAI,SAAS,KAAK,SAAS,IAAI,oBAAoB,EAAE,CAAC;QACrD,eAAe,CAAC,IAAI,CACnB,yDAAyD,oBAAoB,gFAAgF,CAC7J,CAAC;IACH,CAAC;IACD,IAAI,SAAS,KAAK,QAAQ,IAAI,oBAAoB,EAAE,CAAC;QACpD,eAAe,CAAC,IAAI,CACnB,2EAA2E,oBAAoB,eAAe,CAC9G,CAAC;IACH,CAAC;IACD,uEAAuE;IACvE,sEAAsE;IACtE,yEAAyE;IACzE,yEAAyE;IACzE,6DAA6D;IAE7D,MAAM,KAAK,GAAG;QACb,kDAAkD,KAAK,GAAG;QAC1D,EAAE;QACF,KAAK;QACL,EAAE;QACF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;QAC1B,EAAE;QACF,KAAK;QACL,EAAE;KACF,CAAC;IACF,IAAI,cAAc,EAAE,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface BugRecord {
|
|
2
|
+
bugId?: string;
|
|
3
|
+
status?: string;
|
|
4
|
+
summaries?: Record<string, unknown>;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare function readBugRecord(bugId: string, storeCli: string, cwd: string): BugRecord | null;
|
|
8
|
+
export declare function computeNextBugId(bugIds: string[], prefix: string): string;
|
|
9
|
+
export declare function assignNextBugId(storeCli: string, cwd: string, prefix?: string): string;
|
|
10
|
+
export declare function extractBugIdFromReportText(text: string, prefix: string): string | null;
|
|
11
|
+
export declare function preCreateBug(bugId: string, title: string, storeCli: string, cwd: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Scan tool_execution_end events to extract the bugId written by a triage
|
|
14
|
+
* subagent. Returns the LAST matching tool call's bugId, or null if none found.
|
|
15
|
+
*
|
|
16
|
+
* In pi runtime, the forge_store tool is registered as "forge_store" (not
|
|
17
|
+
* "store-cli"). In Claude Code runtime, subagents may shell out via Bash.
|
|
18
|
+
* This function covers all three paths.
|
|
19
|
+
*/
|
|
20
|
+
export declare function extractBugIdFromEvents(events: Array<{
|
|
21
|
+
toolName?: string;
|
|
22
|
+
result?: unknown;
|
|
23
|
+
}>, prefix?: string): string | null;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// bug-id.ts — bug record read helper plus the bug-ID minting / capture
|
|
2
|
+
// utilities (computeNextBugId, assignNextBugId, extractBugIdFromReportText,
|
|
3
|
+
// preCreateBug, extractBugIdFromEvents). Extracted VERBATIM from fix-bug.ts
|
|
4
|
+
// (FORGE-S31 file-size refactor); no logic changes.
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
export function readBugRecord(bugId, storeCli, cwd) {
|
|
7
|
+
const result = spawnSync("node", [storeCli, "read", "bug", bugId], { cwd, encoding: "utf8" });
|
|
8
|
+
if (result.status !== 0)
|
|
9
|
+
return null;
|
|
10
|
+
try {
|
|
11
|
+
const raw = typeof result.stdout === "string" ? result.stdout : String(result.stdout);
|
|
12
|
+
return JSON.parse(raw);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// Pure helper: next <PREFIX>-BUG-NNN ID given the existing bug IDs.
|
|
19
|
+
// Only same-prefix bugs participate in the increment — exported for tests.
|
|
20
|
+
// The prefix is config-owned (project.prefix) and identifier-validated by
|
|
21
|
+
// loadGovernorProjectConfig, so it is safe to splice into a RegExp.
|
|
22
|
+
export function computeNextBugId(bugIds, prefix) {
|
|
23
|
+
const idPattern = new RegExp(`^${prefix}-BUG-(\\d+)$`);
|
|
24
|
+
let maxNum = 0;
|
|
25
|
+
for (const id of bugIds) {
|
|
26
|
+
const m = idPattern.exec(id);
|
|
27
|
+
if (m) {
|
|
28
|
+
const n = parseInt(m[1], 10);
|
|
29
|
+
if (n > maxNum)
|
|
30
|
+
maxNum = n;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return `${prefix}-BUG-${String(maxNum + 1).padStart(3, "0")}`;
|
|
34
|
+
}
|
|
35
|
+
// Pre-assigns a real <PREFIX>-BUG-NNN ID by listing existing bugs and
|
|
36
|
+
// incrementing. Prefix comes from .forge/config.json project.prefix — the
|
|
37
|
+
// hardcoded FORGE prefix minted phantom FORGE-BUG-* records in any project
|
|
38
|
+
// with a different prefix (CART testbench incident, FORGE-BUG-043 class).
|
|
39
|
+
export function assignNextBugId(storeCli, cwd, prefix = "FORGE") {
|
|
40
|
+
const result = spawnSync("node", [storeCli, "list", "bug", "--json"], { cwd, encoding: "utf8" });
|
|
41
|
+
let bugIds = [];
|
|
42
|
+
if (result.status === 0 && result.stdout) {
|
|
43
|
+
try {
|
|
44
|
+
const bugs = JSON.parse(result.stdout);
|
|
45
|
+
if (Array.isArray(bugs)) {
|
|
46
|
+
bugIds = bugs.map((b) => String(b.bugId ?? ""));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
/* empty store — start from 1 */
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return computeNextBugId(bugIds, prefix);
|
|
54
|
+
}
|
|
55
|
+
// Extracts the first canonical <PREFIX>-BUG-NNN referenced in a bug-report
|
|
56
|
+
// text (e.g. the "**Bug ID**: CART-BUG-001" header line BUG_REPORT.md files
|
|
57
|
+
// carry). Used by the @file intake path so /forge:fix-bug @BUG_REPORT.md
|
|
58
|
+
// operates on the referenced store record instead of minting a duplicate.
|
|
59
|
+
// Prefix is config-owned and identifier-validated (safe in a RegExp).
|
|
60
|
+
export function extractBugIdFromReportText(text, prefix) {
|
|
61
|
+
const m = text.match(new RegExp(`\\b${prefix}-BUG-\\d+\\b`));
|
|
62
|
+
return m ? m[0] : null;
|
|
63
|
+
}
|
|
64
|
+
// Pre-creates a minimal bug record so the subagent has a real ID to work with.
|
|
65
|
+
export function preCreateBug(bugId, title, storeCli, cwd) {
|
|
66
|
+
const data = {
|
|
67
|
+
bugId,
|
|
68
|
+
title,
|
|
69
|
+
severity: "minor",
|
|
70
|
+
status: "reported",
|
|
71
|
+
path: `engineering/bugs/${bugId}`,
|
|
72
|
+
reportedAt: new Date().toISOString(),
|
|
73
|
+
};
|
|
74
|
+
const result = spawnSync("node", [storeCli, "write", "bug", JSON.stringify(data)], { cwd, encoding: "utf8" });
|
|
75
|
+
return result.status === 0;
|
|
76
|
+
}
|
|
77
|
+
// ── BugId capture via tool_execution_end ──────────────────────────────────
|
|
78
|
+
/**
|
|
79
|
+
* Scan tool_execution_end events to extract the bugId written by a triage
|
|
80
|
+
* subagent. Returns the LAST matching tool call's bugId, or null if none found.
|
|
81
|
+
*
|
|
82
|
+
* In pi runtime, the forge_store tool is registered as "forge_store" (not
|
|
83
|
+
* "store-cli"). In Claude Code runtime, subagents may shell out via Bash.
|
|
84
|
+
* This function covers all three paths.
|
|
85
|
+
*/
|
|
86
|
+
export function extractBugIdFromEvents(events, prefix = "FORGE") {
|
|
87
|
+
// Prefix is config-owned (project.prefix) and identifier-validated by
|
|
88
|
+
// loadGovernorProjectConfig — the previous hardcoded FORGE-BUG- pattern
|
|
89
|
+
// missed every capture in differently-prefixed projects (CART incident).
|
|
90
|
+
const idPattern = new RegExp(`${prefix}-BUG-\\d+`);
|
|
91
|
+
const idPrefix = `${prefix}-BUG-`;
|
|
92
|
+
let lastBugId = null;
|
|
93
|
+
for (const event of events) {
|
|
94
|
+
if (!event.toolName)
|
|
95
|
+
continue;
|
|
96
|
+
// Check for store-cli write bug calls (Claude Code runtime)
|
|
97
|
+
if (event.toolName === "store-cli") {
|
|
98
|
+
const result = event.result;
|
|
99
|
+
if (typeof result === "string") {
|
|
100
|
+
const match = result.match(idPattern);
|
|
101
|
+
if (match)
|
|
102
|
+
lastBugId = match[0];
|
|
103
|
+
}
|
|
104
|
+
else if (result && typeof result === "object") {
|
|
105
|
+
const obj = result;
|
|
106
|
+
if (typeof obj.bugId === "string" && obj.bugId.startsWith(idPrefix)) {
|
|
107
|
+
lastBugId = obj.bugId;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Check for forge_store tool calls (pi runtime)
|
|
112
|
+
// The pi extension registers the tool as "forge_store", not "store-cli".
|
|
113
|
+
if (event.toolName === "forge_store" && event.result != null) {
|
|
114
|
+
const output = typeof event.result === "string" ? event.result : JSON.stringify(event.result);
|
|
115
|
+
const match = output.match(idPattern);
|
|
116
|
+
if (match)
|
|
117
|
+
lastBugId = match[0];
|
|
118
|
+
}
|
|
119
|
+
// Also check for write operations to .forge/store/bugs/
|
|
120
|
+
if (event.toolName === "write" && typeof event.result === "string") {
|
|
121
|
+
const match = event.result.match(idPattern);
|
|
122
|
+
if (match)
|
|
123
|
+
lastBugId = match[0];
|
|
124
|
+
}
|
|
125
|
+
// Bash events: subagents shelling out via Bash may run "store-cli write bug".
|
|
126
|
+
// Only match when output includes store-cli, write, and bug together
|
|
127
|
+
// to avoid false positives from unrelated Bash commands that happen to
|
|
128
|
+
// mention a bug ID in a different context.
|
|
129
|
+
if (event.toolName === "bash" && event.result != null) {
|
|
130
|
+
const output = typeof event.result === "string" ? event.result : JSON.stringify(event.result);
|
|
131
|
+
if (output.includes("store-cli") && output.includes("write") && output.includes("bug")) {
|
|
132
|
+
const match = output.match(idPattern);
|
|
133
|
+
if (match)
|
|
134
|
+
lastBugId = match[0];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return lastBugId;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=bug-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bug-id.js","sourceRoot":"","sources":["../../../../../src/extensions/forgecli/orchestrators/bug/bug-id.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { MergedConfig } from "../../config/config-layer.js";
|
|
3
|
+
import { type SubagentResult } from "../../forge-subagent.js";
|
|
4
|
+
import { attachViewportObserver } from "../../viewport/events.js";
|
|
5
|
+
import { type PhaseDescriptor } from "../run-task.js";
|
|
6
|
+
import type { BugRecord } from "./bug-id.js";
|
|
7
|
+
import type { RunBugPipelineOptions, RunBugPipelineResult } from "./run-bug-types.js";
|
|
8
|
+
export interface BugPhaseDispatchParams {
|
|
9
|
+
opts: RunBugPipelineOptions;
|
|
10
|
+
phase: PhaseDescriptor;
|
|
11
|
+
bugId: string;
|
|
12
|
+
cwd: string;
|
|
13
|
+
ctx: ExtensionCommandContext;
|
|
14
|
+
storeCli: string;
|
|
15
|
+
currentPhaseIndex: number;
|
|
16
|
+
iterationCounts: Record<string, number>;
|
|
17
|
+
dispatchCounts: Record<string, number>;
|
|
18
|
+
modelRoutingConfig: MergedConfig;
|
|
19
|
+
registry: RunBugPipelineOptions["registry"];
|
|
20
|
+
/** Whether this is a new bug — only used to decide the triage-prefix body. */
|
|
21
|
+
isNewBug: boolean | undefined;
|
|
22
|
+
originalArg: string | undefined;
|
|
23
|
+
/** Raw sub-workflow markdown already loaded + marker/audience-checked by the caller. */
|
|
24
|
+
subWorkflowMd: string;
|
|
25
|
+
/** Bug record read before this phase (status used for compose + cache key). */
|
|
26
|
+
bugRecordBefore: BugRecord | null;
|
|
27
|
+
bugStatusBeforePhase: string | undefined;
|
|
28
|
+
/** True when bugId is still a PENDING- placeholder (triage of a new bug). */
|
|
29
|
+
pendingBugId: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type BugPhaseDispatchOutcome = {
|
|
32
|
+
kind: "return";
|
|
33
|
+
result: RunBugPipelineResult;
|
|
34
|
+
} | {
|
|
35
|
+
kind: "ok";
|
|
36
|
+
result: SubagentResult;
|
|
37
|
+
finishPhaseNode: (status: "completed" | "failed" | "escalated") => void;
|
|
38
|
+
observer: ReturnType<typeof attachViewportObserver>;
|
|
39
|
+
phaseStart: number;
|
|
40
|
+
writeDebug: (rec: Record<string, unknown>) => void;
|
|
41
|
+
toolExecutionEvents: Array<{
|
|
42
|
+
toolName?: string;
|
|
43
|
+
result?: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
debugLogPath: string | null;
|
|
46
|
+
debugLogDisabled: boolean;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Run a single bug phase's subagent dispatch and classify the immediate outcome
|
|
50
|
+
* (persona-load failure, subagent throw, cancellation, or non-zero exit) into a
|
|
51
|
+
* discriminated result. On success returns `kind: "ok"` with the live locals the
|
|
52
|
+
* caller's loop needs for bugId capture / verdict / advance handling.
|
|
53
|
+
*/
|
|
54
|
+
export declare function dispatchBugPhase(p: BugPhaseDispatchParams): Promise<BugPhaseDispatchOutcome>;
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
// bug-phase-dispatch.ts — per-phase subagent dispatch for the fix-bug pipeline:
|
|
2
|
+
// persona load → bug-body compose → debug-log setup → viewport observer attach
|
|
3
|
+
// → model resolution → runForgeSubagent (IL10) → post-subagent abort /
|
|
4
|
+
// halt-on-failure detection. Extracted VERBATIM from fix-bug.ts's phase loop
|
|
5
|
+
// (FORGE-S31 file-size refactor) with no logic changes — the inline
|
|
6
|
+
// `return {...}` paths now return `{ kind: "return"; result }`, and the success
|
|
7
|
+
// path returns `{ kind: "ok"; ... }` carrying the live locals the loop needs
|
|
8
|
+
// (subagent result, finishPhaseNode closure, observer, phaseStart, writeDebug,
|
|
9
|
+
// the captured tool_execution_end events, and the debug-log handle/flags so the
|
|
10
|
+
// post-triage bugId-capture block can re-initialize the log under the real ID).
|
|
11
|
+
//
|
|
12
|
+
// IL10 — ALL LLM dispatch goes through runForgeSubagent (NO sendKickoff here).
|
|
13
|
+
import * as fs from "node:fs";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
import { CallerContextStore } from "../../audience-gate.js";
|
|
16
|
+
import { resolveModelForPhase } from "../../config/model-resolver.js";
|
|
17
|
+
import { loadForgePersona, runForgeSubagent } from "../../forge-subagent.js";
|
|
18
|
+
import { getSubagentTools } from "../../forge-tools.js";
|
|
19
|
+
import { getOrchestratorTree } from "../../orchestrator-tree.js";
|
|
20
|
+
import { attachViewportObserver } from "../../viewport/events.js";
|
|
21
|
+
import { buildSummariesBlock, emitIncompletePhaseEvent } from "../run-task.js";
|
|
22
|
+
import { composeBugBody } from "./bug-body.js";
|
|
23
|
+
import { writeBugState } from "./bug-state.js";
|
|
24
|
+
const STATUS_KEY = "forge:fix-bug";
|
|
25
|
+
/**
|
|
26
|
+
* Run a single bug phase's subagent dispatch and classify the immediate outcome
|
|
27
|
+
* (persona-load failure, subagent throw, cancellation, or non-zero exit) into a
|
|
28
|
+
* discriminated result. On success returns `kind: "ok"` with the live locals the
|
|
29
|
+
* caller's loop needs for bugId capture / verdict / advance handling.
|
|
30
|
+
*/
|
|
31
|
+
export async function dispatchBugPhase(p) {
|
|
32
|
+
const { opts, phase, bugId, cwd, ctx, storeCli, currentPhaseIndex, iterationCounts, dispatchCounts, modelRoutingConfig, registry, isNewBug, originalArg, subWorkflowMd, bugRecordBefore, bugStatusBeforePhase, pendingBugId, } = p;
|
|
33
|
+
const tree = getOrchestratorTree();
|
|
34
|
+
// ── Persona load ──────────────────────────────────────────────
|
|
35
|
+
let persona;
|
|
36
|
+
try {
|
|
37
|
+
persona = loadForgePersona(phase.personaNoun, cwd);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const e = err;
|
|
41
|
+
ctx.ui.notify(`× forge:fix-bug — persona '${phase.personaNoun}' not found for phase ${phase.role}: ${e.message ?? "unknown"}. ` +
|
|
42
|
+
"Run /forge:regenerate to materialize persona files.", "error");
|
|
43
|
+
writeBugState(cwd, {
|
|
44
|
+
bugId,
|
|
45
|
+
phaseIndex: currentPhaseIndex,
|
|
46
|
+
iterationCounts,
|
|
47
|
+
halted: true,
|
|
48
|
+
lastError: `persona load failed: ${e.message ?? "unknown"}`,
|
|
49
|
+
savedAt: new Date().toISOString(),
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
kind: "return",
|
|
53
|
+
result: {
|
|
54
|
+
status: "failed",
|
|
55
|
+
lastPhaseIndex: currentPhaseIndex,
|
|
56
|
+
iterationCounts,
|
|
57
|
+
lastError: `persona load failed: ${e.message ?? "unknown"}`,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// ── 4. Dispatch via runForgeSubagent (IL10) ───────────────────
|
|
62
|
+
// NEVER sendKickoff here — that would reproduce issue #30.
|
|
63
|
+
// Carry forward prior phase summaries (forge-cli#19).
|
|
64
|
+
const bugSummariesBlock = currentPhaseIndex > 0 ? buildSummariesBlock(bugRecordBefore?.summaries) || undefined : undefined;
|
|
65
|
+
let bugBody = composeBugBody(subWorkflowMd, bugId, phase.role, bugStatusBeforePhase, bugSummariesBlock);
|
|
66
|
+
// For new bugs in triage, prepend the original free-form text so the
|
|
67
|
+
// subagent knows the user-provided bug description to triage.
|
|
68
|
+
// The bug record already exists (pre-created with status "reported"),
|
|
69
|
+
// so the subagent should update it, not create a new one.
|
|
70
|
+
if (phase.role === "triage" && isNewBug && originalArg) {
|
|
71
|
+
bugBody = `Bug description: ${originalArg}\n\n---\n\n${bugBody}`;
|
|
72
|
+
}
|
|
73
|
+
// Phase-scoped progress counters
|
|
74
|
+
const phaseStart = Date.now();
|
|
75
|
+
// Track tool_execution_end events for bugId capture (Findings #1, #2).
|
|
76
|
+
const toolExecutionEvents = [];
|
|
77
|
+
// Stabilization debug log
|
|
78
|
+
// Skip for PENDING bugIds — create after real bugId is captured.
|
|
79
|
+
// Disable entirely with FORGE_DEBUG_LOG=0.
|
|
80
|
+
const debugLogDisabled = process.env.FORGE_DEBUG_LOG === "0";
|
|
81
|
+
let debugLogPath = null;
|
|
82
|
+
let writeDebug = () => { };
|
|
83
|
+
if (!pendingBugId && !debugLogDisabled) {
|
|
84
|
+
debugLogPath = path.join(cwd, ".forge", "cache", `fix-bug-debug-${bugId}.jsonl`);
|
|
85
|
+
writeDebug = (rec) => {
|
|
86
|
+
try {
|
|
87
|
+
fs.mkdirSync(path.dirname(debugLogPath), { recursive: true });
|
|
88
|
+
// Cap at 10 MB: truncate head when size exceeds the cap.
|
|
89
|
+
try {
|
|
90
|
+
const st = fs.statSync(debugLogPath);
|
|
91
|
+
if (st.size > 10 * 1024 * 1024) {
|
|
92
|
+
const all = fs.readFileSync(debugLogPath, "utf8");
|
|
93
|
+
const lines = all.split("\n");
|
|
94
|
+
// Keep last 80% of lines
|
|
95
|
+
const keep = Math.floor(lines.length * 0.8);
|
|
96
|
+
fs.writeFileSync(debugLogPath, lines.slice(-keep).join("\n"), "utf8");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
/* file may not exist yet */
|
|
101
|
+
}
|
|
102
|
+
fs.appendFileSync(debugLogPath, `${JSON.stringify({ ts: new Date().toISOString(), phase: phase.role, ...rec })}\n`, "utf8");
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// non-fatal; debug log is best-effort
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
writeDebug({ kind: "phase_start", phaseIndex: currentPhaseIndex });
|
|
110
|
+
registry.startPhase(bugId, phase.role, currentPhaseIndex);
|
|
111
|
+
// Bridge: register phase in OrchestratorTree. Node identity is
|
|
112
|
+
// per-dispatch (see dispatchCounts above) — never reuse an ID for
|
|
113
|
+
// a re-dispatched role.
|
|
114
|
+
const iteration = (dispatchCounts[phase.role] = (dispatchCounts[phase.role] ?? 0) + 1);
|
|
115
|
+
const phaseNodeId = `${bugId}:${phase.role}:${iteration}`;
|
|
116
|
+
tree.startNode(phaseNodeId, {
|
|
117
|
+
parentId: bugId,
|
|
118
|
+
label: `${phase.role}:${iteration}`,
|
|
119
|
+
kind: "leaf",
|
|
120
|
+
// Full body — display clamping/expansion is the view's decision
|
|
121
|
+
// (the tree applies only a storage cap).
|
|
122
|
+
promptPreview: bugBody,
|
|
123
|
+
});
|
|
124
|
+
const refreshStatus = () => {
|
|
125
|
+
if (process.env.FORGE_VERBOSE !== "1")
|
|
126
|
+
return;
|
|
127
|
+
const elapsed = Math.floor((Date.now() - phaseStart) / 1000);
|
|
128
|
+
const tail = observer.state.lastTool ? ` · ${observer.state.lastTool}` : "";
|
|
129
|
+
ctx.ui.setStatus?.(STATUS_KEY, `fix-bug ${bugId}: ${phase.role} · t${observer.state.turn} · tools ${observer.state.toolCount}${observer.state.errCount ? ` · err ${observer.state.errCount}` : ""} · ${elapsed}s${tail}`);
|
|
130
|
+
};
|
|
131
|
+
const observer = attachViewportObserver({
|
|
132
|
+
registry,
|
|
133
|
+
sessionId: bugId,
|
|
134
|
+
phaseRole: phase.role,
|
|
135
|
+
nodeId: phaseNodeId,
|
|
136
|
+
beginHeader: `─── phase ${phase.role} begin ───`,
|
|
137
|
+
writeDebug,
|
|
138
|
+
notify: (msg, level) => ctx.ui.notify(msg, level),
|
|
139
|
+
setStatusVerbose: process.env.FORGE_VERBOSE === "1" ? (k, v) => ctx.ui.setStatus?.(k, v) : undefined,
|
|
140
|
+
verboseKeys: { messageKey: `${STATUS_KEY}:message` },
|
|
141
|
+
afterEach: refreshStatus,
|
|
142
|
+
});
|
|
143
|
+
// Wrap the observer's onEvent to also capture tool_execution_end events
|
|
144
|
+
// for bugId capture downstream (findings #1, #2), plus the first turn_end
|
|
145
|
+
// per phase (IL10 visibility — stream-observed model id).
|
|
146
|
+
let modelObservedLogged = false;
|
|
147
|
+
const onSubagentEvent = (event) => {
|
|
148
|
+
if (event?.type === "tool_execution_end") {
|
|
149
|
+
toolExecutionEvents.push({ toolName: event.toolName, result: event.result });
|
|
150
|
+
}
|
|
151
|
+
if (!modelObservedLogged && event?.type === "turn_end" && event.message?.model) {
|
|
152
|
+
modelObservedLogged = true;
|
|
153
|
+
writeDebug({
|
|
154
|
+
kind: "model_observed",
|
|
155
|
+
provider: event.message.provider ?? null,
|
|
156
|
+
model: event.message.model,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
observer.onEvent(event);
|
|
160
|
+
};
|
|
161
|
+
// Per-phase model resolution. When config is absent or cascade bottoms
|
|
162
|
+
// out, resolves to inherit (model: undefined) — setModel is skipped and
|
|
163
|
+
// pi's current model is used. IL10 still holds: result.model below is
|
|
164
|
+
// the stream-observed runtime model, not whatever we requested here.
|
|
165
|
+
const modelResolution = resolveModelForPhase("fix-bug", phase.role, phase.personaNoun, modelRoutingConfig);
|
|
166
|
+
writeDebug({
|
|
167
|
+
kind: "requested_model",
|
|
168
|
+
requested: modelResolution.model ?? null,
|
|
169
|
+
source: modelResolution.source,
|
|
170
|
+
persona: phase.personaNoun,
|
|
171
|
+
});
|
|
172
|
+
let result;
|
|
173
|
+
try {
|
|
174
|
+
// FORGE-BUG-040: wrap the runForgeSubagent dispatch in the phase
|
|
175
|
+
// caller context so downstream tool calls (forge_preflight,
|
|
176
|
+
// forge_store update-status / set-bug-summary / set-summary / emit)
|
|
177
|
+
// can verify the caller's phase matches the phase named in the
|
|
178
|
+
// tool's arguments. This is the single setter of phase context
|
|
179
|
+
// for the bug pipeline; the audience-test wrap above is a
|
|
180
|
+
// short-lived test, not the canonical dispatch context.
|
|
181
|
+
result = await CallerContextStore.asSubagent(phase.role, () => runForgeSubagent({
|
|
182
|
+
persona,
|
|
183
|
+
task: bugBody,
|
|
184
|
+
cwd,
|
|
185
|
+
exportTag: `${bugId}__${phase.role}`,
|
|
186
|
+
tailLog: observer.state.tailLog,
|
|
187
|
+
// Sprint-scoped if the bug is attached to one, else bug-scoped.
|
|
188
|
+
// Keeps every phase of this bug-fix pipeline in a single cache
|
|
189
|
+
// namespace so the system-prompt + persona prefix stays warm
|
|
190
|
+
// across the ~10-minute phases.
|
|
191
|
+
cacheSessionId: typeof bugRecordBefore?.sprintId === "string"
|
|
192
|
+
? `forge:${bugRecordBefore.sprintId}`
|
|
193
|
+
: `forge:bug:${bugId}`,
|
|
194
|
+
onEvent: onSubagentEvent,
|
|
195
|
+
requestedModel: modelResolution.model,
|
|
196
|
+
modelRegistry: ctx.modelRegistry,
|
|
197
|
+
signal: opts.signal,
|
|
198
|
+
customTools: opts.forgeToolDefs ? getSubagentTools(opts.forgeToolDefs, persona.name) : undefined,
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
catch (err) {
|
|
202
|
+
const e = err;
|
|
203
|
+
ctx.ui.notify(`× forge:fix-bug — runForgeSubagent threw for phase ${phase.role}: ${e.message ?? "unknown"}`, "error");
|
|
204
|
+
tree.completeNode(phaseNodeId, "failed");
|
|
205
|
+
writeBugState(cwd, {
|
|
206
|
+
bugId,
|
|
207
|
+
phaseIndex: currentPhaseIndex,
|
|
208
|
+
iterationCounts,
|
|
209
|
+
halted: true,
|
|
210
|
+
lastError: `runForgeSubagent threw: ${e.message ?? "unknown"}`,
|
|
211
|
+
savedAt: new Date().toISOString(),
|
|
212
|
+
});
|
|
213
|
+
return {
|
|
214
|
+
kind: "return",
|
|
215
|
+
result: {
|
|
216
|
+
status: "failed",
|
|
217
|
+
lastPhaseIndex: currentPhaseIndex,
|
|
218
|
+
iterationCounts,
|
|
219
|
+
lastError: `runForgeSubagent threw: ${e.message ?? "unknown"}`,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
// Close this dispatch's tree node with final usage/model — MUST be
|
|
224
|
+
// called on every exit path below (failure, halt, escalation,
|
|
225
|
+
// loopback, advance). A node left `running` keeps a live spinner
|
|
226
|
+
// in the dashboard forever AND absorbs the next same-role
|
|
227
|
+
// dispatch's telemetry via the observer's legacy role-prefix scan.
|
|
228
|
+
const finishPhaseNode = (status) => {
|
|
229
|
+
tree.setNodeUsage(phaseNodeId, {
|
|
230
|
+
input: result.usage.input,
|
|
231
|
+
output: result.usage.output,
|
|
232
|
+
cacheRead: result.usage.cacheRead,
|
|
233
|
+
});
|
|
234
|
+
if (result.model)
|
|
235
|
+
tree.setNodeModel(phaseNodeId, result.model, result.provider ?? "");
|
|
236
|
+
tree.completeNode(phaseNodeId, status);
|
|
237
|
+
};
|
|
238
|
+
// ── Post-subagent abort detection ─────────────────────────────────
|
|
239
|
+
if (result.stopReason === "aborted" || opts.signal?.aborted) {
|
|
240
|
+
ctx.ui.notify(`⊘ forge:fix-bug — ${bugId} phase ${phase.role} cancelled.`, "info");
|
|
241
|
+
registry.completePhase(bugId, phase.role, "cancelled");
|
|
242
|
+
tree.completeNode(phaseNodeId, "cancelled");
|
|
243
|
+
registry.confirmCancelled(bugId);
|
|
244
|
+
// Bug B parity with run-task: account billed tokens of the aborted attempt.
|
|
245
|
+
// sprintId "bugs" = routing key for bug events (matches success path).
|
|
246
|
+
// The optional `type` token is omitted — verdict carries the outcome.
|
|
247
|
+
emitIncompletePhaseEvent({
|
|
248
|
+
emitCtx: {
|
|
249
|
+
entityType: "bug",
|
|
250
|
+
bugId,
|
|
251
|
+
sprintId: "bugs",
|
|
252
|
+
phase,
|
|
253
|
+
iteration: (iterationCounts[phase.role] ?? 0) + 1,
|
|
254
|
+
startMs: phaseStart,
|
|
255
|
+
endMs: Date.now(),
|
|
256
|
+
model: result.model ?? "unknown",
|
|
257
|
+
provider: result.provider ?? "unknown",
|
|
258
|
+
usage: {
|
|
259
|
+
input: result.usage.input,
|
|
260
|
+
output: result.usage.output,
|
|
261
|
+
cacheRead: result.usage.cacheRead,
|
|
262
|
+
cacheWrite: result.usage.cacheWrite,
|
|
263
|
+
},
|
|
264
|
+
judgement: undefined,
|
|
265
|
+
storeCli,
|
|
266
|
+
cwd,
|
|
267
|
+
},
|
|
268
|
+
outcome: "aborted",
|
|
269
|
+
notes: result.errorMessage ?? result.stopReason ?? undefined,
|
|
270
|
+
onDebug: writeDebug,
|
|
271
|
+
});
|
|
272
|
+
// ADR-S21-01: preserve state file so cancelled runs are resumable
|
|
273
|
+
writeBugState(cwd, {
|
|
274
|
+
bugId,
|
|
275
|
+
phaseIndex: currentPhaseIndex,
|
|
276
|
+
iterationCounts,
|
|
277
|
+
halted: false,
|
|
278
|
+
status: "cancelled",
|
|
279
|
+
lastError: undefined,
|
|
280
|
+
savedAt: new Date().toISOString(),
|
|
281
|
+
});
|
|
282
|
+
return {
|
|
283
|
+
kind: "return",
|
|
284
|
+
result: { status: "cancelled", lastPhaseIndex: currentPhaseIndex, iterationCounts },
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
// ── Halt-on-failure ───────────────────────────────────────────
|
|
288
|
+
if (result.exitCode !== 0) {
|
|
289
|
+
ctx.ui.notify(`× forge:fix-bug — phase ${phase.role} failed (exit ${result.exitCode})` +
|
|
290
|
+
(result.errorMessage ? `: ${result.errorMessage}` : "") +
|
|
291
|
+
(result.stopReason ? ` [${result.stopReason}]` : ""), "error");
|
|
292
|
+
finishPhaseNode("failed");
|
|
293
|
+
// Bug B parity with run-task: account billed tokens of the failed attempt.
|
|
294
|
+
emitIncompletePhaseEvent({
|
|
295
|
+
emitCtx: {
|
|
296
|
+
entityType: "bug",
|
|
297
|
+
bugId,
|
|
298
|
+
sprintId: "bugs",
|
|
299
|
+
phase,
|
|
300
|
+
iteration: (iterationCounts[phase.role] ?? 0) + 1,
|
|
301
|
+
startMs: phaseStart,
|
|
302
|
+
endMs: Date.now(),
|
|
303
|
+
model: result.model ?? "unknown",
|
|
304
|
+
provider: result.provider ?? "unknown",
|
|
305
|
+
usage: {
|
|
306
|
+
input: result.usage.input,
|
|
307
|
+
output: result.usage.output,
|
|
308
|
+
cacheRead: result.usage.cacheRead,
|
|
309
|
+
cacheWrite: result.usage.cacheWrite,
|
|
310
|
+
},
|
|
311
|
+
judgement: undefined,
|
|
312
|
+
storeCli,
|
|
313
|
+
cwd,
|
|
314
|
+
},
|
|
315
|
+
outcome: "failed",
|
|
316
|
+
notes: result.errorMessage ?? result.stopReason ?? undefined,
|
|
317
|
+
onDebug: writeDebug,
|
|
318
|
+
});
|
|
319
|
+
writeBugState(cwd, {
|
|
320
|
+
bugId,
|
|
321
|
+
phaseIndex: currentPhaseIndex,
|
|
322
|
+
iterationCounts,
|
|
323
|
+
halted: true,
|
|
324
|
+
lastError: result.errorMessage ?? result.stopReason ?? "subagent exit non-zero",
|
|
325
|
+
savedAt: new Date().toISOString(),
|
|
326
|
+
});
|
|
327
|
+
return {
|
|
328
|
+
kind: "return",
|
|
329
|
+
result: {
|
|
330
|
+
status: "failed",
|
|
331
|
+
lastPhaseIndex: currentPhaseIndex,
|
|
332
|
+
iterationCounts,
|
|
333
|
+
lastError: result.errorMessage ?? result.stopReason ?? "subagent exit non-zero",
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
kind: "ok",
|
|
339
|
+
result,
|
|
340
|
+
finishPhaseNode,
|
|
341
|
+
observer,
|
|
342
|
+
phaseStart,
|
|
343
|
+
writeDebug,
|
|
344
|
+
toolExecutionEvents,
|
|
345
|
+
debugLogPath,
|
|
346
|
+
debugLogDisabled,
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=bug-phase-dispatch.js.map
|