agent-bober 0.12.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +213 -0
- package/README.md +112 -3
- package/agents/bober-architect.md +38 -0
- package/agents/bober-code-reviewer.md +236 -0
- package/agents/bober-curator.md +37 -0
- package/agents/bober-deployer.md +267 -0
- package/agents/bober-diagnoser.md +289 -0
- package/agents/bober-evaluator.md +89 -1
- package/agents/bober-generator.md +68 -3
- package/agents/bober-planner.md +39 -0
- package/agents/bober-postmortemer.md +185 -0
- package/agents/bober-researcher.md +38 -0
- package/dist/cli/commands/approve.d.ts +17 -0
- package/dist/cli/commands/approve.d.ts.map +1 -0
- package/dist/cli/commands/approve.js +64 -0
- package/dist/cli/commands/approve.js.map +1 -0
- package/dist/cli/commands/audit-show.d.ts +14 -0
- package/dist/cli/commands/audit-show.d.ts.map +1 -0
- package/dist/cli/commands/audit-show.js +85 -0
- package/dist/cli/commands/audit-show.js.map +1 -0
- package/dist/cli/commands/config.d.ts +10 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +73 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/graph.d.ts +8 -0
- package/dist/cli/commands/graph.d.ts.map +1 -0
- package/dist/cli/commands/graph.js +219 -0
- package/dist/cli/commands/graph.js.map +1 -0
- package/dist/cli/commands/impact.d.ts +19 -0
- package/dist/cli/commands/impact.d.ts.map +1 -0
- package/dist/cli/commands/impact.js +191 -0
- package/dist/cli/commands/impact.js.map +1 -0
- package/dist/cli/commands/incident.d.ts +19 -0
- package/dist/cli/commands/incident.d.ts.map +1 -0
- package/dist/cli/commands/incident.js +324 -0
- package/dist/cli/commands/incident.js.map +1 -0
- package/dist/cli/commands/init.js +36 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/list-approvals.d.ts +16 -0
- package/dist/cli/commands/list-approvals.d.ts.map +1 -0
- package/dist/cli/commands/list-approvals.js +57 -0
- package/dist/cli/commands/list-approvals.js.map +1 -0
- package/dist/cli/commands/onboard.d.ts +3 -0
- package/dist/cli/commands/onboard.d.ts.map +1 -0
- package/dist/cli/commands/onboard.js +190 -0
- package/dist/cli/commands/onboard.js.map +1 -0
- package/dist/cli/commands/playbook.d.ts +17 -0
- package/dist/cli/commands/playbook.d.ts.map +1 -0
- package/dist/cli/commands/playbook.js +123 -0
- package/dist/cli/commands/playbook.js.map +1 -0
- package/dist/cli/commands/postmortem.d.ts +12 -0
- package/dist/cli/commands/postmortem.d.ts.map +1 -0
- package/dist/cli/commands/postmortem.js +67 -0
- package/dist/cli/commands/postmortem.js.map +1 -0
- package/dist/cli/commands/reject.d.ts +17 -0
- package/dist/cli/commands/reject.d.ts.map +1 -0
- package/dist/cli/commands/reject.js +52 -0
- package/dist/cli/commands/reject.js.map +1 -0
- package/dist/cli/commands/rollback.d.ts +21 -0
- package/dist/cli/commands/rollback.d.ts.map +1 -0
- package/dist/cli/commands/rollback.js +90 -0
- package/dist/cli/commands/rollback.js.map +1 -0
- package/dist/cli/commands/run.d.ts +9 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +29 -0
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/telemetry.d.ts +16 -0
- package/dist/cli/commands/telemetry.d.ts.map +1 -0
- package/dist/cli/commands/telemetry.js +152 -0
- package/dist/cli/commands/telemetry.js.map +1 -0
- package/dist/cli/commands/worktree.d.ts +12 -0
- package/dist/cli/commands/worktree.d.ts.map +1 -0
- package/dist/cli/commands/worktree.js +57 -0
- package/dist/cli/commands/worktree.js.map +1 -0
- package/dist/cli/index.js +50 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +27 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +4 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +18 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +976 -56
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +147 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/graph/artifact-store.d.ts +14 -0
- package/dist/graph/artifact-store.d.ts.map +1 -0
- package/dist/graph/artifact-store.js +100 -0
- package/dist/graph/artifact-store.js.map +1 -0
- package/dist/graph/cli.d.ts +49 -0
- package/dist/graph/cli.d.ts.map +1 -0
- package/dist/graph/cli.js +140 -0
- package/dist/graph/cli.js.map +1 -0
- package/dist/graph/client.d.ts +64 -0
- package/dist/graph/client.d.ts.map +1 -0
- package/dist/graph/client.js +216 -0
- package/dist/graph/client.js.map +1 -0
- package/dist/graph/fallback.d.ts +13 -0
- package/dist/graph/fallback.d.ts.map +1 -0
- package/dist/graph/fallback.js +57 -0
- package/dist/graph/fallback.js.map +1 -0
- package/dist/graph/hook-handler.d.ts +50 -0
- package/dist/graph/hook-handler.d.ts.map +1 -0
- package/dist/graph/hook-handler.js +217 -0
- package/dist/graph/hook-handler.js.map +1 -0
- package/dist/graph/incidents.d.ts +59 -0
- package/dist/graph/incidents.d.ts.map +1 -0
- package/dist/graph/incidents.js +22 -0
- package/dist/graph/incidents.js.map +1 -0
- package/dist/graph/mcp-client.d.ts +51 -0
- package/dist/graph/mcp-client.d.ts.map +1 -0
- package/dist/graph/mcp-client.js +285 -0
- package/dist/graph/mcp-client.js.map +1 -0
- package/dist/graph/onboarding-composer.d.ts +30 -0
- package/dist/graph/onboarding-composer.d.ts.map +1 -0
- package/dist/graph/onboarding-composer.js +275 -0
- package/dist/graph/onboarding-composer.js.map +1 -0
- package/dist/graph/pipeline-lifecycle.d.ts +86 -0
- package/dist/graph/pipeline-lifecycle.d.ts.map +1 -0
- package/dist/graph/pipeline-lifecycle.js +329 -0
- package/dist/graph/pipeline-lifecycle.js.map +1 -0
- package/dist/graph/preflight-budgets.d.ts +52 -0
- package/dist/graph/preflight-budgets.d.ts.map +1 -0
- package/dist/graph/preflight-budgets.js +78 -0
- package/dist/graph/preflight-budgets.js.map +1 -0
- package/dist/graph/preflight-injector.d.ts +116 -0
- package/dist/graph/preflight-injector.d.ts.map +1 -0
- package/dist/graph/preflight-injector.js +538 -0
- package/dist/graph/preflight-injector.js.map +1 -0
- package/dist/graph/prereq.d.ts +12 -0
- package/dist/graph/prereq.d.ts.map +1 -0
- package/dist/graph/prereq.js +61 -0
- package/dist/graph/prereq.js.map +1 -0
- package/dist/graph/prompts.d.ts +42 -0
- package/dist/graph/prompts.d.ts.map +1 -0
- package/dist/graph/prompts.js +80 -0
- package/dist/graph/prompts.js.map +1 -0
- package/dist/graph/sandbox.d.ts +19 -0
- package/dist/graph/sandbox.d.ts.map +1 -0
- package/dist/graph/sandbox.js +25 -0
- package/dist/graph/sandbox.js.map +1 -0
- package/dist/graph/token-usage.d.ts +21 -0
- package/dist/graph/token-usage.d.ts.map +1 -0
- package/dist/graph/token-usage.js +22 -0
- package/dist/graph/token-usage.js.map +1 -0
- package/dist/graph/types.d.ts +129 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +12 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/incident/orchestrator.d.ts +168 -0
- package/dist/incident/orchestrator.d.ts.map +1 -0
- package/dist/incident/orchestrator.js +279 -0
- package/dist/incident/orchestrator.js.map +1 -0
- package/dist/incident/playbook-search.d.ts +67 -0
- package/dist/incident/playbook-search.d.ts.map +1 -0
- package/dist/incident/playbook-search.js +288 -0
- package/dist/incident/playbook-search.js.map +1 -0
- package/dist/incident/postmortem.d.ts +44 -0
- package/dist/incident/postmortem.d.ts.map +1 -0
- package/dist/incident/postmortem.js +486 -0
- package/dist/incident/postmortem.js.map +1 -0
- package/dist/incident/resolution-verify.d.ts +186 -0
- package/dist/incident/resolution-verify.d.ts.map +1 -0
- package/dist/incident/resolution-verify.js +210 -0
- package/dist/incident/resolution-verify.js.map +1 -0
- package/dist/incident/rollback.d.ts +137 -0
- package/dist/incident/rollback.d.ts.map +1 -0
- package/dist/incident/rollback.js +328 -0
- package/dist/incident/rollback.js.map +1 -0
- package/dist/incident/timeline.d.ts +147 -0
- package/dist/incident/timeline.d.ts.map +1 -0
- package/dist/incident/timeline.js +452 -0
- package/dist/incident/timeline.js.map +1 -0
- package/dist/incident/types.d.ts +335 -0
- package/dist/incident/types.d.ts.map +1 -0
- package/dist/incident/types.js +158 -0
- package/dist/incident/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/event-stream.d.ts +46 -0
- package/dist/mcp/event-stream.d.ts.map +1 -0
- package/dist/mcp/event-stream.js +421 -0
- package/dist/mcp/event-stream.js.map +1 -0
- package/dist/mcp/external-client.d.ts +38 -0
- package/dist/mcp/external-client.d.ts.map +1 -0
- package/dist/mcp/external-client.js +121 -0
- package/dist/mcp/external-client.js.map +1 -0
- package/dist/mcp/run-manager.d.ts +74 -9
- package/dist/mcp/run-manager.d.ts.map +1 -1
- package/dist/mcp/run-manager.js +127 -31
- package/dist/mcp/run-manager.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +56 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/abort-run.d.ts +2 -0
- package/dist/mcp/tools/abort-run.d.ts.map +1 -0
- package/dist/mcp/tools/abort-run.js +62 -0
- package/dist/mcp/tools/abort-run.js.map +1 -0
- package/dist/mcp/tools/anchor.js +1 -1
- package/dist/mcp/tools/anchor.js.map +1 -1
- package/dist/mcp/tools/approve-checkpoint.d.ts +2 -0
- package/dist/mcp/tools/approve-checkpoint.d.ts.map +1 -0
- package/dist/mcp/tools/approve-checkpoint.js +70 -0
- package/dist/mcp/tools/approve-checkpoint.js.map +1 -0
- package/dist/mcp/tools/brownfield.js +1 -1
- package/dist/mcp/tools/brownfield.js.map +1 -1
- package/dist/mcp/tools/get-project-state.d.ts +2 -0
- package/dist/mcp/tools/get-project-state.d.ts.map +1 -0
- package/dist/mcp/tools/get-project-state.js +107 -0
- package/dist/mcp/tools/get-project-state.js.map +1 -0
- package/dist/mcp/tools/get-run-status.d.ts +2 -0
- package/dist/mcp/tools/get-run-status.d.ts.map +1 -0
- package/dist/mcp/tools/get-run-status.js +40 -0
- package/dist/mcp/tools/get-run-status.js.map +1 -0
- package/dist/mcp/tools/graph-schemas.d.ts +100 -0
- package/dist/mcp/tools/graph-schemas.d.ts.map +1 -0
- package/dist/mcp/tools/graph-schemas.js +39 -0
- package/dist/mcp/tools/graph-schemas.js.map +1 -0
- package/dist/mcp/tools/graph.d.ts +19 -0
- package/dist/mcp/tools/graph.d.ts.map +1 -0
- package/dist/mcp/tools/graph.js +263 -0
- package/dist/mcp/tools/graph.js.map +1 -0
- package/dist/mcp/tools/incident.d.ts +2 -0
- package/dist/mcp/tools/incident.d.ts.map +1 -0
- package/dist/mcp/tools/incident.js +246 -0
- package/dist/mcp/tools/incident.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +38 -18
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +74 -18
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/list-active-runs.d.ts +2 -0
- package/dist/mcp/tools/list-active-runs.d.ts.map +1 -0
- package/dist/mcp/tools/list-active-runs.js +35 -0
- package/dist/mcp/tools/list-active-runs.js.map +1 -0
- package/dist/mcp/tools/list-pending-approvals.d.ts +2 -0
- package/dist/mcp/tools/list-pending-approvals.d.ts.map +1 -0
- package/dist/mcp/tools/list-pending-approvals.js +40 -0
- package/dist/mcp/tools/list-pending-approvals.js.map +1 -0
- package/dist/mcp/tools/list-projects.d.ts +2 -0
- package/dist/mcp/tools/list-projects.d.ts.map +1 -0
- package/dist/mcp/tools/list-projects.js +101 -0
- package/dist/mcp/tools/list-projects.js.map +1 -0
- package/dist/mcp/tools/list-specs.d.ts +2 -0
- package/dist/mcp/tools/list-specs.d.ts.map +1 -0
- package/dist/mcp/tools/list-specs.js +48 -0
- package/dist/mcp/tools/list-specs.js.map +1 -0
- package/dist/mcp/tools/playbook.d.ts +2 -0
- package/dist/mcp/tools/playbook.d.ts.map +1 -0
- package/dist/mcp/tools/playbook.js +104 -0
- package/dist/mcp/tools/playbook.js.map +1 -0
- package/dist/mcp/tools/postmortem.d.ts +2 -0
- package/dist/mcp/tools/postmortem.d.ts.map +1 -0
- package/dist/mcp/tools/postmortem.js +75 -0
- package/dist/mcp/tools/postmortem.js.map +1 -0
- package/dist/mcp/tools/react.js +1 -1
- package/dist/mcp/tools/react.js.map +1 -1
- package/dist/mcp/tools/reject-checkpoint.d.ts +2 -0
- package/dist/mcp/tools/reject-checkpoint.d.ts.map +1 -0
- package/dist/mcp/tools/reject-checkpoint.js +79 -0
- package/dist/mcp/tools/reject-checkpoint.js.map +1 -0
- package/dist/mcp/tools/rollback.d.ts +2 -0
- package/dist/mcp/tools/rollback.d.ts.map +1 -0
- package/dist/mcp/tools/rollback.js +78 -0
- package/dist/mcp/tools/rollback.js.map +1 -0
- package/dist/mcp/tools/run-in-worktree.d.ts +2 -0
- package/dist/mcp/tools/run-in-worktree.d.ts.map +1 -0
- package/dist/mcp/tools/run-in-worktree.js +90 -0
- package/dist/mcp/tools/run-in-worktree.js.map +1 -0
- package/dist/mcp/tools/run.js +1 -1
- package/dist/mcp/tools/run.js.map +1 -1
- package/dist/mcp/tools/solidity.js +1 -1
- package/dist/mcp/tools/solidity.js.map +1 -1
- package/dist/mcp/tools/status.d.ts.map +1 -1
- package/dist/mcp/tools/status.js +11 -0
- package/dist/mcp/tools/status.js.map +1 -1
- package/dist/mcp/tools/subscribe-events.d.ts +2 -0
- package/dist/mcp/tools/subscribe-events.d.ts.map +1 -0
- package/dist/mcp/tools/subscribe-events.js +48 -0
- package/dist/mcp/tools/subscribe-events.js.map +1 -0
- package/dist/mcp/tools/unsubscribe-events.d.ts +2 -0
- package/dist/mcp/tools/unsubscribe-events.d.ts.map +1 -0
- package/dist/mcp/tools/unsubscribe-events.js +45 -0
- package/dist/mcp/tools/unsubscribe-events.js.map +1 -0
- package/dist/orchestrator/agent-loader.d.ts +16 -0
- package/dist/orchestrator/agent-loader.d.ts.map +1 -1
- package/dist/orchestrator/agent-loader.js +16 -0
- package/dist/orchestrator/agent-loader.js.map +1 -1
- package/dist/orchestrator/architect-agent.d.ts.map +1 -1
- package/dist/orchestrator/architect-agent.js +37 -8
- package/dist/orchestrator/architect-agent.js.map +1 -1
- package/dist/orchestrator/checkpoints/audit.d.ts +128 -0
- package/dist/orchestrator/checkpoints/audit.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/audit.js +272 -0
- package/dist/orchestrator/checkpoints/audit.js.map +1 -0
- package/dist/orchestrator/checkpoints/feedback-router.d.ts +213 -0
- package/dist/orchestrator/checkpoints/feedback-router.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/feedback-router.js +438 -0
- package/dist/orchestrator/checkpoints/feedback-router.js.map +1 -0
- package/dist/orchestrator/checkpoints/index.d.ts +11 -0
- package/dist/orchestrator/checkpoints/index.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/index.js +12 -0
- package/dist/orchestrator/checkpoints/index.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts +35 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.js +153 -0
- package/dist/orchestrator/checkpoints/mechanisms/cli.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts +34 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.js +139 -0
- package/dist/orchestrator/checkpoints/mechanisms/disk.js.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts +141 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.js +445 -0
- package/dist/orchestrator/checkpoints/mechanisms/pr.js.map +1 -0
- package/dist/orchestrator/checkpoints/noop.d.ts +12 -0
- package/dist/orchestrator/checkpoints/noop.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/noop.js +13 -0
- package/dist/orchestrator/checkpoints/noop.js.map +1 -0
- package/dist/orchestrator/checkpoints/registry.d.ts +48 -0
- package/dist/orchestrator/checkpoints/registry.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/registry.js +89 -0
- package/dist/orchestrator/checkpoints/registry.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/_util.d.ts +50 -0
- package/dist/orchestrator/checkpoints/renderers/_util.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/_util.js +137 -0
- package/dist/orchestrator/checkpoints/renderers/_util.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.js +66 -0
- package/dist/orchestrator/checkpoints/renderers/code-review.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.js +40 -0
- package/dist/orchestrator/checkpoints/renderers/curator-briefing.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.js +54 -0
- package/dist/orchestrator/checkpoints/renderers/eval-result.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts +49 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.js +154 -0
- package/dist/orchestrator/checkpoints/renderers/generator-diff.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js +59 -0
- package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/plan.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/plan.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/plan.js +34 -0
- package/dist/orchestrator/checkpoints/renderers/plan.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/registry.d.ts +43 -0
- package/dist/orchestrator/checkpoints/renderers/registry.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/registry.js +83 -0
- package/dist/orchestrator/checkpoints/renderers/registry.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/research.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/research.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/research.js +39 -0
- package/dist/orchestrator/checkpoints/renderers/research.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts +20 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.js +57 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-contract.js.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts +15 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.js +38 -0
- package/dist/orchestrator/checkpoints/renderers/sprint-summary.js.map +1 -0
- package/dist/orchestrator/checkpoints/sites.d.ts +22 -0
- package/dist/orchestrator/checkpoints/sites.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/sites.js +57 -0
- package/dist/orchestrator/checkpoints/sites.js.map +1 -0
- package/dist/orchestrator/checkpoints/types.d.ts +51 -0
- package/dist/orchestrator/checkpoints/types.d.ts.map +1 -0
- package/dist/orchestrator/checkpoints/types.js +9 -0
- package/dist/orchestrator/checkpoints/types.js.map +1 -0
- package/dist/orchestrator/code-reviewer-agent.d.ts +50 -0
- package/dist/orchestrator/code-reviewer-agent.d.ts.map +1 -0
- package/dist/orchestrator/code-reviewer-agent.js +283 -0
- package/dist/orchestrator/code-reviewer-agent.js.map +1 -0
- package/dist/orchestrator/curator-agent.d.ts.map +1 -1
- package/dist/orchestrator/curator-agent.js +59 -8
- package/dist/orchestrator/curator-agent.js.map +1 -1
- package/dist/orchestrator/deploy/classify.d.ts +31 -0
- package/dist/orchestrator/deploy/classify.d.ts.map +1 -0
- package/dist/orchestrator/deploy/classify.js +109 -0
- package/dist/orchestrator/deploy/classify.js.map +1 -0
- package/dist/orchestrator/deploy/execute.d.ts +45 -0
- package/dist/orchestrator/deploy/execute.d.ts.map +1 -0
- package/dist/orchestrator/deploy/execute.js +146 -0
- package/dist/orchestrator/deploy/execute.js.map +1 -0
- package/dist/orchestrator/deploy/executor.d.ts +22 -0
- package/dist/orchestrator/deploy/executor.d.ts.map +1 -0
- package/dist/orchestrator/deploy/executor.js +31 -0
- package/dist/orchestrator/deploy/executor.js.map +1 -0
- package/dist/orchestrator/deploy/index.d.ts +21 -0
- package/dist/orchestrator/deploy/index.d.ts.map +1 -0
- package/dist/orchestrator/deploy/index.js +21 -0
- package/dist/orchestrator/deploy/index.js.map +1 -0
- package/dist/orchestrator/deploy/resolve.d.ts +51 -0
- package/dist/orchestrator/deploy/resolve.d.ts.map +1 -0
- package/dist/orchestrator/deploy/resolve.js +53 -0
- package/dist/orchestrator/deploy/resolve.js.map +1 -0
- package/dist/orchestrator/deploy/spawn.d.ts +60 -0
- package/dist/orchestrator/deploy/spawn.d.ts.map +1 -0
- package/dist/orchestrator/deploy/spawn.js +62 -0
- package/dist/orchestrator/deploy/spawn.js.map +1 -0
- package/dist/orchestrator/deploy/types.d.ts +98 -0
- package/dist/orchestrator/deploy/types.d.ts.map +1 -0
- package/dist/orchestrator/deploy/types.js +39 -0
- package/dist/orchestrator/deploy/types.js.map +1 -0
- package/dist/orchestrator/evaluator-agent.d.ts.map +1 -1
- package/dist/orchestrator/evaluator-agent.js +21 -8
- package/dist/orchestrator/evaluator-agent.js.map +1 -1
- package/dist/orchestrator/generator-agent.d.ts.map +1 -1
- package/dist/orchestrator/generator-agent.js +21 -8
- package/dist/orchestrator/generator-agent.js.map +1 -1
- package/dist/orchestrator/model-resolver.d.ts.map +1 -1
- package/dist/orchestrator/model-resolver.js +3 -1
- package/dist/orchestrator/model-resolver.js.map +1 -1
- package/dist/orchestrator/observability/index.d.ts +12 -0
- package/dist/orchestrator/observability/index.d.ts.map +1 -0
- package/dist/orchestrator/observability/index.js +12 -0
- package/dist/orchestrator/observability/index.js.map +1 -0
- package/dist/orchestrator/observability/merge.d.ts +73 -0
- package/dist/orchestrator/observability/merge.d.ts.map +1 -0
- package/dist/orchestrator/observability/merge.js +110 -0
- package/dist/orchestrator/observability/merge.js.map +1 -0
- package/dist/orchestrator/pipeline.d.ts +21 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -1
- package/dist/orchestrator/pipeline.js +156 -2
- package/dist/orchestrator/pipeline.js.map +1 -1
- package/dist/orchestrator/planner-agent.d.ts.map +1 -1
- package/dist/orchestrator/planner-agent.js +5 -4
- package/dist/orchestrator/planner-agent.js.map +1 -1
- package/dist/orchestrator/research-agent.d.ts.map +1 -1
- package/dist/orchestrator/research-agent.js +46 -9
- package/dist/orchestrator/research-agent.js.map +1 -1
- package/dist/orchestrator/tools/handlers.d.ts +2 -0
- package/dist/orchestrator/tools/handlers.d.ts.map +1 -1
- package/dist/orchestrator/tools/handlers.js +1 -1
- package/dist/orchestrator/tools/handlers.js.map +1 -1
- package/dist/orchestrator/tools/index.d.ts +84 -1
- package/dist/orchestrator/tools/index.d.ts.map +1 -1
- package/dist/orchestrator/tools/index.js +164 -1
- package/dist/orchestrator/tools/index.js.map +1 -1
- package/dist/orchestrator/worktree.d.ts +18 -0
- package/dist/orchestrator/worktree.d.ts.map +1 -0
- package/dist/orchestrator/worktree.js +129 -0
- package/dist/orchestrator/worktree.js.map +1 -0
- package/dist/providers/anthropic.d.ts +8 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +86 -5
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/factory.d.ts.map +1 -1
- package/dist/providers/factory.js +35 -2
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/google.d.ts.map +1 -1
- package/dist/providers/google.js +5 -0
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +4 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/types.d.ts +25 -2
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/state/approval-state.d.ts +74 -0
- package/dist/state/approval-state.d.ts.map +1 -0
- package/dist/state/approval-state.js +127 -0
- package/dist/state/approval-state.js.map +1 -0
- package/dist/state/index.d.ts +3 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +4 -1
- package/dist/state/index.js.map +1 -1
- package/dist/state/review-state.d.ts +15 -0
- package/dist/state/review-state.d.ts.map +1 -0
- package/dist/state/review-state.js +51 -0
- package/dist/state/review-state.js.map +1 -0
- package/dist/state/run-state.d.ts +39 -0
- package/dist/state/run-state.d.ts.map +1 -0
- package/dist/state/run-state.js +101 -0
- package/dist/state/run-state.js.map +1 -0
- package/dist/telemetry/emit.d.ts +41 -0
- package/dist/telemetry/emit.d.ts.map +1 -0
- package/dist/telemetry/emit.js +65 -0
- package/dist/telemetry/emit.js.map +1 -0
- package/dist/utils/git.d.ts +27 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +50 -0
- package/dist/utils/git.js.map +1 -1
- package/hooks/hooks.json +17 -1
- package/hooks/session-start +42 -0
- package/package.json +5 -2
- package/scripts/check-prereqs.sh +12 -0
- package/scripts/e2e-graph-smoke.sh +167 -0
- package/scripts/graph-hook.mjs +151 -0
- package/scripts/run-kpi-gate.mjs +245 -0
- package/scripts/sync-skills.mjs +4 -1
- package/skills/bober.code-review/SKILL.md +186 -0
- package/skills/bober.debug/SKILL.md +300 -0
- package/skills/bober.deploy/SKILL.md +262 -0
- package/skills/bober.diagnose/SKILL.md +254 -0
- package/skills/bober.graph/SKILL.md +85 -0
- package/skills/bober.impact/SKILL.md +101 -0
- package/skills/bober.incident/SKILL.md +245 -0
- package/skills/bober.onboard/SKILL.md +84 -0
- package/skills/bober.plan/SKILL.md +10 -0
- package/skills/bober.postmortem/SKILL.md +231 -0
- package/skills/bober.runbook/SKILL.md +335 -0
- package/skills/bober.using-bober/SKILL.md +133 -0
- package/skills/bober.verify/SKILL.md +143 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint type definitions for Tier 2 careful-flow plumbing.
|
|
3
|
+
*
|
|
4
|
+
* Sprint 7: establishes the type infrastructure used by Sprints 8-10
|
|
5
|
+
* to plug in real mechanisms (cli, disk, pr). Only the noop mechanism
|
|
6
|
+
* is registered in this sprint.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* One of the 9 pipeline decision points. Sprints 8-14 may add overrides per id;
|
|
10
|
+
* the registry resolves an id → mechanism.
|
|
11
|
+
*/
|
|
12
|
+
export type CheckpointId = "post-research" | "post-plan" | "post-sprint-contract" | "pre-curator" | "pre-generator" | "pre-evaluator" | "pre-code-reviewer" | "post-sprint" | "end-of-pipeline";
|
|
13
|
+
/**
|
|
14
|
+
* Opaque artifact passed to a mechanism. The shape varies per CheckpointId.
|
|
15
|
+
* Sprints 8-10 may narrow this via the id discriminator; this sprint treats it
|
|
16
|
+
* as `unknown` because the only mechanism (noop) ignores it.
|
|
17
|
+
*/
|
|
18
|
+
export type CheckpointArtifact = unknown;
|
|
19
|
+
/**
|
|
20
|
+
* Discriminated union of the three outcomes a mechanism can return.
|
|
21
|
+
*
|
|
22
|
+
* - approved:true → proceed unchanged (autopilot / accept)
|
|
23
|
+
* - approved:false + feedback → reject; Sprint 12 will propagate
|
|
24
|
+
* `feedback` back into the prior agent
|
|
25
|
+
* - edit:true + editDelta → user mutated the artifact in place
|
|
26
|
+
* (CLI edit, disk file rewrite, PR commit)
|
|
27
|
+
* and the coordinator must consume the
|
|
28
|
+
* delta before proceeding.
|
|
29
|
+
*
|
|
30
|
+
* Why all three exist now (per evaluatorNotes): "The Checkpoint types must be
|
|
31
|
+
* exhaustive enough to support all three mechanisms (CLI/disk/PR) without
|
|
32
|
+
* re-shaping in Sprints 8-10."
|
|
33
|
+
*/
|
|
34
|
+
export type CheckpointOutcome = {
|
|
35
|
+
approved: true;
|
|
36
|
+
editDelta?: unknown;
|
|
37
|
+
} | {
|
|
38
|
+
approved: false;
|
|
39
|
+
feedback: string;
|
|
40
|
+
} | {
|
|
41
|
+
edit: true;
|
|
42
|
+
editDelta: unknown;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A pluggable approval mechanism. Sprints 8-10 implement `cli`, `disk`, `pr`.
|
|
46
|
+
* This sprint registers ONLY `noop`.
|
|
47
|
+
*/
|
|
48
|
+
export interface CheckpointMechanism {
|
|
49
|
+
request(checkpoint: CheckpointId, artifact: CheckpointArtifact): Promise<CheckpointOutcome>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/checkpoints/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,WAAW,GACX,sBAAsB,GACtB,aAAa,GACb,eAAe,GACf,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,iBAAiB,CAAC;AAEtB;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACvC;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CACL,UAAU,EAAE,YAAY,EACxB,QAAQ,EAAE,kBAAkB,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint type definitions for Tier 2 careful-flow plumbing.
|
|
3
|
+
*
|
|
4
|
+
* Sprint 7: establishes the type infrastructure used by Sprints 8-10
|
|
5
|
+
* to plug in real mechanisms (cli, disk, pr). Only the noop mechanism
|
|
6
|
+
* is registered in this sprint.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/orchestrator/checkpoints/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { BoberConfig } from "../config/schema.js";
|
|
2
|
+
import type { SprintContract } from "../contracts/sprint-contract.js";
|
|
3
|
+
import type { EvaluationRunResult } from "../evaluators/registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* A finding in the ReviewResult — one entry in critical, important, or minor arrays.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReviewFinding {
|
|
8
|
+
description: string;
|
|
9
|
+
evidence: Array<{
|
|
10
|
+
path: string;
|
|
11
|
+
line: number;
|
|
12
|
+
snippet: string;
|
|
13
|
+
}>;
|
|
14
|
+
antiPattern?: string;
|
|
15
|
+
source?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The structured result emitted by the bober-code-reviewer subagent.
|
|
19
|
+
*/
|
|
20
|
+
export interface ReviewResult {
|
|
21
|
+
reviewId: string;
|
|
22
|
+
contractId: string;
|
|
23
|
+
specId: string;
|
|
24
|
+
timestamp: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
critical: ReviewFinding[];
|
|
27
|
+
important: ReviewFinding[];
|
|
28
|
+
minor: ReviewFinding[];
|
|
29
|
+
approvedAreas: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run the bober-code-reviewer subagent for advisory code review.
|
|
33
|
+
*
|
|
34
|
+
* Runs AFTER the evaluator returns passed=true. The review is advisory:
|
|
35
|
+
* findings surface in the run history but do NOT block sprint completion,
|
|
36
|
+
* do NOT trigger generator retry, and do NOT mutate contract status.
|
|
37
|
+
*
|
|
38
|
+
* @param contract The sprint contract that just passed.
|
|
39
|
+
* @param evaluation The evaluation result (passed=true) from runEvaluatorAgent.
|
|
40
|
+
* @param projectRoot Absolute path to the project root.
|
|
41
|
+
* @param config The resolved bober configuration.
|
|
42
|
+
* @returns A ReviewResult with structured findings.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runCodeReviewer(contract: SprintContract, evaluation: EvaluationRunResult, projectRoot: string, config: BoberConfig): Promise<ReviewResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Render a ReviewResult into the 6-section markdown format required by s5-c5.
|
|
47
|
+
* Exported for direct unit testing of the renderer.
|
|
48
|
+
*/
|
|
49
|
+
export declare function renderReviewMarkdown(review: ReviewResult): string;
|
|
50
|
+
//# sourceMappingURL=code-reviewer-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-reviewer-agent.d.ts","sourceRoot":"","sources":["../../src/orchestrator/code-reviewer-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAWrE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAID;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,YAAY,CAAC,CAoHvB;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA0EjE"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { createClient } from "../providers/factory.js";
|
|
2
|
+
import { logger } from "../utils/logger.js";
|
|
3
|
+
import { resolveModel } from "./model-resolver.js";
|
|
4
|
+
import { assembleSystemPrompt } from "./agent-loader.js";
|
|
5
|
+
import { resolveRoleTools, getGraphState, getGraphDeps } from "./tools/index.js";
|
|
6
|
+
import { runAgenticLoop } from "./agentic-loop.js";
|
|
7
|
+
import { saveReview } from "../state/review-state.js";
|
|
8
|
+
// ── Main ───────────────────────────────────────────────────────────
|
|
9
|
+
/**
|
|
10
|
+
* Run the bober-code-reviewer subagent for advisory code review.
|
|
11
|
+
*
|
|
12
|
+
* Runs AFTER the evaluator returns passed=true. The review is advisory:
|
|
13
|
+
* findings surface in the run history but do NOT block sprint completion,
|
|
14
|
+
* do NOT trigger generator retry, and do NOT mutate contract status.
|
|
15
|
+
*
|
|
16
|
+
* @param contract The sprint contract that just passed.
|
|
17
|
+
* @param evaluation The evaluation result (passed=true) from runEvaluatorAgent.
|
|
18
|
+
* @param projectRoot Absolute path to the project root.
|
|
19
|
+
* @param config The resolved bober configuration.
|
|
20
|
+
* @returns A ReviewResult with structured findings.
|
|
21
|
+
*/
|
|
22
|
+
export async function runCodeReviewer(contract, evaluation, projectRoot, config) {
|
|
23
|
+
const contractId = contract.contractId;
|
|
24
|
+
logger.sprint(contractId, `Code review: ${contract.title}`);
|
|
25
|
+
const reviewerModel = config.codeReview?.model ?? config.evaluator.model;
|
|
26
|
+
const model = resolveModel(reviewerModel);
|
|
27
|
+
const maxTurns = config.codeReview?.maxTurns ?? 15;
|
|
28
|
+
// Code reviewer reuses the "evaluator" role tool set — read-only (bash, read, grep, glob).
|
|
29
|
+
// Adding a distinct role is a separate refactor — out of scope per contract s5-c9.
|
|
30
|
+
const graphState = getGraphState(config);
|
|
31
|
+
const graphDeps = graphState.engineHealth === "ready" ? getGraphDeps() : undefined;
|
|
32
|
+
const toolSet = resolveRoleTools("evaluator", projectRoot, graphState, graphDeps ?? undefined);
|
|
33
|
+
const systemPrompt = await assembleSystemPrompt("evaluator", "bober-code-reviewer", projectRoot, graphState);
|
|
34
|
+
const client = createClient(config.codeReview?.provider ?? config.evaluator.provider ?? null, config.codeReview?.endpoint ?? config.evaluator.endpoint ?? null, config.codeReview?.providerConfig ?? config.evaluator.providerConfig, reviewerModel, "CodeReviewer");
|
|
35
|
+
const contractJson = JSON.stringify(contract, null, 2);
|
|
36
|
+
const evalSummary = JSON.stringify({
|
|
37
|
+
passed: evaluation.passed,
|
|
38
|
+
score: evaluation.score,
|
|
39
|
+
summary: evaluation.summary,
|
|
40
|
+
timestamp: evaluation.timestamp,
|
|
41
|
+
}, null, 2);
|
|
42
|
+
const userMessage = `# Sprint Contract
|
|
43
|
+
|
|
44
|
+
${contractJson}
|
|
45
|
+
|
|
46
|
+
# Evaluation Result (Already Passed)
|
|
47
|
+
|
|
48
|
+
${evalSummary}
|
|
49
|
+
|
|
50
|
+
# Project Root
|
|
51
|
+
|
|
52
|
+
${projectRoot}
|
|
53
|
+
|
|
54
|
+
# Context
|
|
55
|
+
|
|
56
|
+
- Contract ID: ${contractId}
|
|
57
|
+
- Spec ID: ${contract.specId}
|
|
58
|
+
- Review is ADVISORY ONLY — findings do NOT block completion or trigger retries
|
|
59
|
+
|
|
60
|
+
# Anti-Pattern Catalog
|
|
61
|
+
|
|
62
|
+
The catalog index is at .bober/anti-patterns/README.md. Consult it BEFORE classifying severity.
|
|
63
|
+
Catalogued anti-patterns:
|
|
64
|
+
- Testing anti-patterns → .bober/anti-patterns/testing-anti-patterns.md
|
|
65
|
+
- Condition-based waiting → .bober/anti-patterns/condition-based-waiting.md
|
|
66
|
+
- Root-cause tracing → .bober/anti-patterns/root-cause-tracing.md
|
|
67
|
+
- Defense in depth → .bober/anti-patterns/defense-in-depth.md
|
|
68
|
+
|
|
69
|
+
# Your Task
|
|
70
|
+
|
|
71
|
+
Review the sprint diff. Use your tools to:
|
|
72
|
+
1. Read .bober/contracts/${contractId}.json and .bober/anti-patterns/README.md
|
|
73
|
+
2. Run git diff HEAD~1 --stat to see what changed
|
|
74
|
+
3. Review each changed file for DRY violations, YAGNI, dead code, missing tests, anti-patterns
|
|
75
|
+
4. Produce a ReviewResult JSON
|
|
76
|
+
|
|
77
|
+
Output ONLY a JSON object (no markdown fences):
|
|
78
|
+
{
|
|
79
|
+
"reviewId": "review-${contractId}-<ISO-timestamp>",
|
|
80
|
+
"contractId": "${contractId}",
|
|
81
|
+
"specId": "${contract.specId}",
|
|
82
|
+
"timestamp": "<ISO-8601>",
|
|
83
|
+
"summary": "<2-3 sentence overall assessment>",
|
|
84
|
+
"critical": [],
|
|
85
|
+
"important": [],
|
|
86
|
+
"minor": [],
|
|
87
|
+
"approvedAreas": []
|
|
88
|
+
}`;
|
|
89
|
+
logger.info(`Calling code reviewer model (${reviewerModel} → ${model})...`);
|
|
90
|
+
const result = await runAgenticLoop({
|
|
91
|
+
client,
|
|
92
|
+
model,
|
|
93
|
+
systemPrompt,
|
|
94
|
+
userMessage,
|
|
95
|
+
tools: toolSet.schemas,
|
|
96
|
+
toolHandlers: toolSet.handlers,
|
|
97
|
+
maxTurns,
|
|
98
|
+
maxTokens: 16384,
|
|
99
|
+
onToolUse: (name, input) => {
|
|
100
|
+
const inp = input;
|
|
101
|
+
const inputStr = JSON.stringify(inp).slice(0, 120);
|
|
102
|
+
logger.debug(` [code-reviewer] ${name}(${inputStr})`);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
logger.debug(`Code reviewer completed in ${result.turnsUsed} turns (${result.toolsCalled.length} tool calls)`);
|
|
106
|
+
const reviewResult = parseReviewResult(result.finalText, contractId, contract.specId);
|
|
107
|
+
// Write the review markdown to .bober/reviews/<contractId>-review.md
|
|
108
|
+
const markdown = renderReviewMarkdown(reviewResult);
|
|
109
|
+
await saveReview(projectRoot, contractId, markdown);
|
|
110
|
+
logger.info(`Code review complete: ${reviewResult.critical.length} critical, ${reviewResult.important.length} important, ${reviewResult.minor.length} minor findings`);
|
|
111
|
+
return reviewResult;
|
|
112
|
+
}
|
|
113
|
+
// ── Markdown renderer ──────────────────────────────────────────────
|
|
114
|
+
/**
|
|
115
|
+
* Render a ReviewResult into the 6-section markdown format required by s5-c5.
|
|
116
|
+
* Exported for direct unit testing of the renderer.
|
|
117
|
+
*/
|
|
118
|
+
export function renderReviewMarkdown(review) {
|
|
119
|
+
const lines = [];
|
|
120
|
+
lines.push(`# Code Review: ${review.contractId}`);
|
|
121
|
+
lines.push("");
|
|
122
|
+
lines.push("## Summary");
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push(review.summary);
|
|
125
|
+
lines.push("");
|
|
126
|
+
lines.push("## Critical");
|
|
127
|
+
lines.push("");
|
|
128
|
+
if (review.critical.length === 0) {
|
|
129
|
+
lines.push("No critical findings.");
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
for (const finding of review.critical) {
|
|
133
|
+
lines.push(`- **${finding.description}**`);
|
|
134
|
+
for (const ev of finding.evidence) {
|
|
135
|
+
lines.push(` - \`${ev.path}:${ev.line}\`: ${ev.snippet}`);
|
|
136
|
+
}
|
|
137
|
+
if (finding.antiPattern) {
|
|
138
|
+
lines.push(` - Anti-pattern: ${finding.antiPattern} (${finding.source ?? ""})`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
lines.push("");
|
|
143
|
+
lines.push("## Important");
|
|
144
|
+
lines.push("");
|
|
145
|
+
if (review.important.length === 0) {
|
|
146
|
+
lines.push("No important findings.");
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
for (const finding of review.important) {
|
|
150
|
+
lines.push(`- **${finding.description}**`);
|
|
151
|
+
for (const ev of finding.evidence) {
|
|
152
|
+
lines.push(` - \`${ev.path}:${ev.line}\`: ${ev.snippet}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
lines.push("");
|
|
157
|
+
lines.push("## Minor");
|
|
158
|
+
lines.push("");
|
|
159
|
+
if (review.minor.length === 0) {
|
|
160
|
+
lines.push("No minor findings.");
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
for (const finding of review.minor) {
|
|
164
|
+
lines.push(`- **${finding.description}**`);
|
|
165
|
+
for (const ev of finding.evidence) {
|
|
166
|
+
lines.push(` - \`${ev.path}:${ev.line}\`: ${ev.snippet}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
lines.push("");
|
|
171
|
+
lines.push("## Approved Areas");
|
|
172
|
+
lines.push("");
|
|
173
|
+
if (review.approvedAreas.length === 0) {
|
|
174
|
+
lines.push("No areas specifically called out.");
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
for (const area of review.approvedAreas) {
|
|
178
|
+
lines.push(`- ${area}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
lines.push("");
|
|
182
|
+
lines.push(`---`);
|
|
183
|
+
lines.push(`*Review ID: ${review.reviewId} — ${review.timestamp}*`);
|
|
184
|
+
lines.push("");
|
|
185
|
+
return lines.join("\n");
|
|
186
|
+
}
|
|
187
|
+
// ── JSON parser ────────────────────────────────────────────────────
|
|
188
|
+
/**
|
|
189
|
+
* Parse the code reviewer's response into a ReviewResult.
|
|
190
|
+
* Mirrors the resilient JSON-parsing pattern from evaluator-agent.ts:parseEvalResult.
|
|
191
|
+
*/
|
|
192
|
+
function parseReviewResult(text, contractId, specId) {
|
|
193
|
+
const timestamp = new Date().toISOString();
|
|
194
|
+
let parsed;
|
|
195
|
+
// Try direct parse
|
|
196
|
+
try {
|
|
197
|
+
parsed = JSON.parse(text.trim());
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Try extracting from markdown fences
|
|
201
|
+
const fenceMatch = /```(?:json)?\s*\n?([\s\S]*?)\n?\s*```/.exec(text);
|
|
202
|
+
if (fenceMatch) {
|
|
203
|
+
try {
|
|
204
|
+
parsed = JSON.parse(fenceMatch[1].trim());
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// Fall through
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
// Try finding { ... }
|
|
211
|
+
if (!parsed) {
|
|
212
|
+
const braceStart = text.indexOf("{");
|
|
213
|
+
const braceEnd = text.lastIndexOf("}");
|
|
214
|
+
if (braceStart !== -1 && braceEnd > braceStart) {
|
|
215
|
+
try {
|
|
216
|
+
parsed = JSON.parse(text.slice(braceStart, braceEnd + 1));
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// Fall through to default
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (parsed && typeof parsed === "object" && parsed !== null) {
|
|
225
|
+
const obj = parsed;
|
|
226
|
+
return {
|
|
227
|
+
reviewId: typeof obj.reviewId === "string"
|
|
228
|
+
? obj.reviewId
|
|
229
|
+
: `review-${contractId}-${timestamp}`,
|
|
230
|
+
contractId: typeof obj.contractId === "string" ? obj.contractId : contractId,
|
|
231
|
+
specId: typeof obj.specId === "string" ? obj.specId : specId,
|
|
232
|
+
timestamp: typeof obj.timestamp === "string" ? obj.timestamp : timestamp,
|
|
233
|
+
summary: typeof obj.summary === "string"
|
|
234
|
+
? obj.summary
|
|
235
|
+
: "No summary provided.",
|
|
236
|
+
critical: parseFindingArray(obj.critical),
|
|
237
|
+
important: parseFindingArray(obj.important),
|
|
238
|
+
minor: parseFindingArray(obj.minor),
|
|
239
|
+
approvedAreas: parseStringArray(obj.approvedAreas),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
// Fallback — reviewer ran but response wasn't parseable
|
|
243
|
+
return {
|
|
244
|
+
reviewId: `review-${contractId}-${timestamp}`,
|
|
245
|
+
contractId,
|
|
246
|
+
specId,
|
|
247
|
+
timestamp,
|
|
248
|
+
summary: "Code reviewer response could not be parsed.",
|
|
249
|
+
critical: [],
|
|
250
|
+
important: [],
|
|
251
|
+
minor: [],
|
|
252
|
+
approvedAreas: [],
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function parseFindingArray(raw) {
|
|
256
|
+
if (!Array.isArray(raw))
|
|
257
|
+
return [];
|
|
258
|
+
return raw
|
|
259
|
+
.filter((item) => typeof item === "object" && item !== null)
|
|
260
|
+
.map((item) => ({
|
|
261
|
+
description: typeof item.description === "string" ? item.description : "Unknown finding",
|
|
262
|
+
evidence: parseEvidenceArray(item.evidence),
|
|
263
|
+
...(typeof item.antiPattern === "string" ? { antiPattern: item.antiPattern } : {}),
|
|
264
|
+
...(typeof item.source === "string" ? { source: item.source } : {}),
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
function parseEvidenceArray(raw) {
|
|
268
|
+
if (!Array.isArray(raw))
|
|
269
|
+
return [];
|
|
270
|
+
return raw
|
|
271
|
+
.filter((item) => typeof item === "object" && item !== null)
|
|
272
|
+
.map((item) => ({
|
|
273
|
+
path: typeof item.path === "string" ? item.path : "unknown",
|
|
274
|
+
line: typeof item.line === "number" ? item.line : 0,
|
|
275
|
+
snippet: typeof item.snippet === "string" ? item.snippet : "",
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
278
|
+
function parseStringArray(raw) {
|
|
279
|
+
if (!Array.isArray(raw))
|
|
280
|
+
return [];
|
|
281
|
+
return raw.filter((item) => typeof item === "string");
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=code-reviewer-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-reviewer-agent.js","sourceRoot":"","sources":["../../src/orchestrator/code-reviewer-agent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAA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,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAC9D,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAQ,GAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator-agent.d.ts","sourceRoot":"","sources":["../../src/orchestrator/curator-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curator-agent.d.ts","sourceRoot":"","sources":["../../src/orchestrator/curator-agent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAkBrD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,eAAe,EAAE,MAAM,CAAC;CACzB;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,QAAQ,EACd,gBAAgB,EAAE,cAAc,EAAE,EAClC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,cAAc,CAAC,CAyJzB"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { resolve } from "node:path";
|
|
1
3
|
import { createClient } from "../providers/factory.js";
|
|
2
4
|
import { logger } from "../utils/logger.js";
|
|
3
5
|
import { resolveModel } from "./model-resolver.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
+
import { assembleSystemPrompt } from "./agent-loader.js";
|
|
7
|
+
import { resolveRoleTools, getGraphState, getGraphDeps } from "./tools/index.js";
|
|
6
8
|
import { runAgenticLoop } from "./agentic-loop.js";
|
|
9
|
+
import { PreflightContextInjector } from "../graph/preflight-injector.js";
|
|
10
|
+
import { graphPipelineLifecycle } from "../graph/pipeline-lifecycle.js";
|
|
11
|
+
import { ensureDir } from "../utils/fs.js";
|
|
12
|
+
import { emit } from "../telemetry/emit.js";
|
|
7
13
|
// ── Constants ──────────────────────────────────────────────────────
|
|
8
14
|
const CURATOR_MAX_TURNS = 25;
|
|
9
15
|
// ── Main ───────────────────────────────────────────────────────────
|
|
@@ -24,15 +30,20 @@ const CURATOR_MAX_TURNS = 25;
|
|
|
24
30
|
export async function runCurator(contract, spec, completedSprints, projectRoot, config) {
|
|
25
31
|
const contractId = contract.contractId;
|
|
26
32
|
logger.sprint(contractId, `Curating: ${contract.title}`);
|
|
27
|
-
//
|
|
28
|
-
|
|
33
|
+
// Sprint 28 — telemetry: emit agent-spawn at entry (fire-and-forget)
|
|
34
|
+
void emit(projectRoot, config, "agent-spawn", { agentName: "curator", contractId });
|
|
29
35
|
// Curator uses its own model config, falling back to planner model
|
|
30
36
|
const curatorConfig = config.curator;
|
|
31
37
|
const curatorModel = curatorConfig?.model ?? config.planner.model;
|
|
32
38
|
const model = resolveModel(curatorModel);
|
|
33
39
|
const curatorMaxTurns = curatorConfig?.maxTurns ?? CURATOR_MAX_TURNS;
|
|
34
|
-
// Curator gets read-only tools
|
|
35
|
-
|
|
40
|
+
// Curator gets read-only tools. When graph is enabled and ready,
|
|
41
|
+
// bash/grep/glob are removed and graph_* tools are added (ADR-8).
|
|
42
|
+
const graphState = getGraphState(config);
|
|
43
|
+
const graphDeps = graphState.engineHealth === "ready" ? getGraphDeps() : undefined;
|
|
44
|
+
const toolSet = resolveRoleTools("curator", projectRoot, graphState, graphDeps ?? undefined);
|
|
45
|
+
// Assemble system prompt with graph-prompt decoration (ADR-5, Sprint 7).
|
|
46
|
+
const systemPrompt = await assembleSystemPrompt("curator", "bober-curator", projectRoot, graphState);
|
|
36
47
|
const client = createClient(curatorConfig?.provider ?? config.planner.provider ?? null, curatorConfig?.endpoint ?? config.planner.endpoint ?? null, curatorConfig?.providerConfig ?? config.planner.providerConfig, curatorModel, "Curator");
|
|
37
48
|
// Build the completed sprints summary
|
|
38
49
|
const completedSummary = completedSprints.length > 0
|
|
@@ -42,7 +53,7 @@ export async function runCurator(contract, spec, completedSprints, projectRoot,
|
|
|
42
53
|
: "No prior sprints completed.";
|
|
43
54
|
// Build the contract JSON for the curator's context
|
|
44
55
|
const contractJson = JSON.stringify(contract, null, 2);
|
|
45
|
-
const
|
|
56
|
+
const baseUserMessage = `# Sprint Contract
|
|
46
57
|
|
|
47
58
|
${contractJson}
|
|
48
59
|
|
|
@@ -84,12 +95,35 @@ Your final response must contain ONLY a JSON object (no markdown fences):
|
|
|
84
95
|
"utilsIdentified": <number>,
|
|
85
96
|
"summary": "<2-3 sentence summary>"
|
|
86
97
|
}`;
|
|
98
|
+
// Pre-flight graph context injection (ADR-9 — special Curator case).
|
|
99
|
+
// Curator: write pre-flight content to .bober/briefings/<contractId>-briefing.md
|
|
100
|
+
// and reference it in the user message. The curator's own exploration output
|
|
101
|
+
// appends to the same file during the agentic loop.
|
|
102
|
+
const graphClient = graphPipelineLifecycle.getGraphClient();
|
|
103
|
+
const preflightInjector = new PreflightContextInjector(graphClient, config.graph);
|
|
104
|
+
const preflightPath = `.bober/briefings/${contractId}-briefing.md`;
|
|
105
|
+
// Pass "" as firstMessage — we only want the pre-flight content itself (not prepended to anything).
|
|
106
|
+
const preflightContent = await preflightInjector.inject("curator", contract, "");
|
|
107
|
+
let preflightNotice = "";
|
|
108
|
+
if (preflightContent.trim().length > 0) {
|
|
109
|
+
try {
|
|
110
|
+
const absPath = resolve(projectRoot, preflightPath);
|
|
111
|
+
await ensureDir(resolve(absPath, ".."));
|
|
112
|
+
await writeFile(absPath, preflightContent, "utf-8");
|
|
113
|
+
preflightNotice = `\n\n# Graph Pre-Flight Context\n\nA graph pre-flight analysis has been prepared at ${preflightPath} — read it FIRST as part of your codebase exploration. It contains relevant graph queries (callers, tests, search results) to accelerate your analysis.\n`;
|
|
114
|
+
logger.debug(`[curator] Pre-flight graph context written to ${preflightPath}`);
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
logger.debug(`[curator] Pre-flight write failed (non-blocking): ${err instanceof Error ? err.message : String(err)}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
const userMessage = `${baseUserMessage}${preflightNotice}`;
|
|
87
121
|
logger.info(`Calling curator model (${curatorModel} → ${model})...`);
|
|
88
122
|
const filesRead = new Set();
|
|
89
123
|
const result = await runAgenticLoop({
|
|
90
124
|
client,
|
|
91
125
|
model,
|
|
92
|
-
systemPrompt
|
|
126
|
+
systemPrompt,
|
|
93
127
|
userMessage,
|
|
94
128
|
tools: toolSet.schemas,
|
|
95
129
|
toolHandlers: toolSet.handlers,
|
|
@@ -107,6 +141,23 @@ Your final response must contain ONLY a JSON object (no markdown fences):
|
|
|
107
141
|
},
|
|
108
142
|
});
|
|
109
143
|
logger.debug(`Curator completed in ${result.turnsUsed} turns (${result.toolsCalled.length} tool calls)`);
|
|
144
|
+
// Token-usage capture (graph integration sprint 2, s2-c8).
|
|
145
|
+
// Mirrors the cumulative-usage pattern from src/orchestrator/agentic-loop.ts:117-118.
|
|
146
|
+
// Failure to write must NOT break curation — swallow errors.
|
|
147
|
+
try {
|
|
148
|
+
const { TokenUsageLog } = await import("../graph/token-usage.js");
|
|
149
|
+
await new TokenUsageLog(projectRoot).append({
|
|
150
|
+
agent: "curator",
|
|
151
|
+
runId: contractId,
|
|
152
|
+
timestamp: new Date().toISOString(),
|
|
153
|
+
inputTokens: result.usage.inputTokens,
|
|
154
|
+
outputTokens: result.usage.outputTokens,
|
|
155
|
+
graphEnabled: config.graph?.enabled === true,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
logger.debug(`Token usage capture failed (curator): ${err instanceof Error ? err.message : String(err)}`);
|
|
160
|
+
}
|
|
110
161
|
return parseCuratorResult(result.finalText, contractId, filesRead);
|
|
111
162
|
}
|
|
112
163
|
// ── JSON parser ────────────────────────────────────────────────────
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/curator-agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"curator-agent.js","sourceRoot":"","sources":["../../src/orchestrator/curator-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,S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AE,CAAC;QAC5D,MAAM,GAAG,GAAG,MAAiC,CAAC;QAE9C,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;YACpD,CAAC,CAAE,GAAG,CAAC,aAA2B,CAAC,MAAM,CACrC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAC1C;YACH,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;QAEnB,OAAO;YACL,UAAU;YACV,SAAS;YACT,QAAQ,EAAE,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;YACtE,aAAa;YACb,aAAa,EACX,OAAO,GAAG,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC/D,eAAe,EACb,OAAO,GAAG,CAAC,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;SACpE,CAAC;IACJ,CAAC;IAED,uDAAuD;IACvD,OAAO;QACL,UAAU;QACV,SAAS;QACT,QAAQ,EAAE,EAAE;QACZ,aAAa,EAAE,CAAC,GAAG,SAAS,CAAC;QAC7B,aAAa,EAAE,CAAC;QAChB,eAAe,EAAE,CAAC;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command classifier for the deploy module (Sprint 20).
|
|
3
|
+
*
|
|
4
|
+
* classifyCommand(commandText) returns 'safe' | 'risky' based solely on the
|
|
5
|
+
* COMMAND CONTENT — never on the agent's self-declared classification.
|
|
6
|
+
*
|
|
7
|
+
* This is the safety guarantee against multi-command Bash invocations such as
|
|
8
|
+
* `echo 'safe' && kubectl scale ...`. The classifier scans the entire command
|
|
9
|
+
* string for state-mutating verbs before any execution occurs.
|
|
10
|
+
*
|
|
11
|
+
* Pattern sources:
|
|
12
|
+
* - agents/bober-diagnoser.md:188-198 (forbidden command list)
|
|
13
|
+
* - skills/bober.runbook/SKILL.md (risky-step examples)
|
|
14
|
+
* - Sprint 20 contract evaluatorNotes: multi-command gate requirement.
|
|
15
|
+
*
|
|
16
|
+
* Default-deny: when in doubt, classify risky.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Classify a command string by blast radius.
|
|
20
|
+
*
|
|
21
|
+
* Rules:
|
|
22
|
+
* 1. Scan the full command string for any risky pattern (takes priority over allowlist).
|
|
23
|
+
* 2. If no risky pattern matched AND the command has no chain operators (&&/||/;/|),
|
|
24
|
+
* check if it matches the safe allowlist.
|
|
25
|
+
* 3. When in doubt → risky (default-deny).
|
|
26
|
+
*
|
|
27
|
+
* @param commandText - The raw shell command string.
|
|
28
|
+
* @returns 'safe' if the command is confirmed read-only/reversible; 'risky' otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function classifyCommand(commandText: string): "safe" | "risky";
|
|
31
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/deploy/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAyDH;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAyBrE"}
|