agent-bober 0.11.6 → 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 +311 -0
- package/README.md +124 -9
- 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 +127 -1
- package/agents/bober-generator.md +122 -3
- package/agents/bober-planner.md +293 -32
- 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/eval.js +6 -6
- package/dist/cli/commands/eval.js.map +1 -1
- 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 +82 -3
- 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/plan.d.ts +12 -0
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js +232 -37
- package/dist/cli/commands/plan.js.map +1 -1
- 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 +31 -2
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/sprint.d.ts.map +1 -1
- package/dist/cli/commands/sprint.js +8 -8
- package/dist/cli/commands/sprint.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 +73 -2
- 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 +1016 -96
- 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/contracts/eval-result.d.ts +38 -38
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +8 -4
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/spec.d.ts +335 -40
- package/dist/contracts/spec.d.ts.map +1 -1
- package/dist/contracts/spec.js +210 -18
- package/dist/contracts/spec.js.map +1 -1
- package/dist/contracts/sprint-contract.d.ts +155 -88
- package/dist/contracts/sprint-contract.d.ts.map +1 -1
- package/dist/contracts/sprint-contract.js +176 -29
- package/dist/contracts/sprint-contract.js.map +1 -1
- package/dist/evaluators/builtin/api-check.js +1 -1
- package/dist/evaluators/builtin/api-check.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 +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- 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/contracts.js +2 -2
- package/dist/mcp/tools/contracts.js.map +1 -1
- package/dist/mcp/tools/eval.js +8 -8
- package/dist/mcp/tools/eval.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/plan.d.ts.map +1 -1
- package/dist/mcp/tools/plan.js +40 -14
- package/dist/mcp/tools/plan.js.map +1 -1
- 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/sprint.d.ts.map +1 -1
- package/dist/mcp/tools/sprint.js +11 -11
- package/dist/mcp/tools/sprint.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/context-handoff.d.ts +484 -224
- package/dist/orchestrator/context-handoff.d.ts.map +1 -1
- package/dist/orchestrator/context-handoff.js +32 -12
- package/dist/orchestrator/context-handoff.js.map +1 -1
- package/dist/orchestrator/curator-agent.d.ts.map +1 -1
- package/dist/orchestrator/curator-agent.js +63 -12
- 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 +23 -10
- 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 +24 -11
- 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 +4 -2
- 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 +28 -0
- package/dist/orchestrator/pipeline.d.ts.map +1 -1
- package/dist/orchestrator/pipeline.js +223 -30
- package/dist/orchestrator/pipeline.js.map +1 -1
- package/dist/orchestrator/planner-agent.d.ts +21 -1
- package/dist/orchestrator/planner-agent.d.ts.map +1 -1
- package/dist/orchestrator/planner-agent.js +16 -6
- 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/history.d.ts.map +1 -1
- package/dist/state/history.js +3 -3
- package/dist/state/history.js.map +1 -1
- 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/plan-state.js +1 -1
- package/dist/state/plan-state.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/state/sprint-state.d.ts +9 -2
- package/dist/state/sprint-state.d.ts.map +1 -1
- package/dist/state/sprint-state.js +25 -11
- package/dist/state/sprint-state.js.map +1 -1
- 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 +6 -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/migrate-specs.mjs +127 -0
- package/scripts/run-kpi-gate.mjs +245 -0
- package/scripts/sync-skills.mjs +99 -0
- 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 +51 -0
- package/skills/bober.plan/references/spec-schema.md +31 -4
- package/skills/bober.postmortem/SKILL.md +231 -0
- package/skills/bober.run/SKILL.md +41 -7
- package/skills/bober.runbook/SKILL.md +335 -0
- package/skills/bober.sprint/SKILL.md +6 -259
- package/skills/bober.using-bober/SKILL.md +133 -0
- package/skills/bober.verify/SKILL.md +143 -0
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
// ── Constants ───────────────────────────────────────────────────────
|
|
3
|
+
/**
|
|
4
|
+
* Minimum length for a success criterion description.
|
|
5
|
+
* Short descriptions are usually vague ("works correctly", "looks good").
|
|
6
|
+
* Opus 4.7 takes prompts literally — vague criteria produce vague verification.
|
|
7
|
+
*/
|
|
8
|
+
export const MIN_CRITERION_DESCRIPTION_LENGTH = 25;
|
|
9
|
+
/**
|
|
10
|
+
* Minimum length for definitionOfDone.
|
|
11
|
+
* Single-sentence summaries leak too much intent that the model has to guess.
|
|
12
|
+
*/
|
|
13
|
+
export const MIN_DEFINITION_OF_DONE_LENGTH = 20;
|
|
14
|
+
/**
|
|
15
|
+
* Phrases that almost always indicate a vague criterion.
|
|
16
|
+
* Match is case-insensitive and substring-based.
|
|
17
|
+
*/
|
|
18
|
+
export const BANNED_VAGUE_PHRASES = [
|
|
19
|
+
"works correctly",
|
|
20
|
+
"works as expected",
|
|
21
|
+
"looks good",
|
|
22
|
+
"looks nice",
|
|
23
|
+
"is reasonable",
|
|
24
|
+
"behaves properly",
|
|
25
|
+
"behaves correctly",
|
|
26
|
+
"is correct",
|
|
27
|
+
"appears correct",
|
|
28
|
+
"as needed",
|
|
29
|
+
"if appropriate",
|
|
30
|
+
];
|
|
2
31
|
// ── Enums ───────────────────────────────────────────────────────────
|
|
3
32
|
export const ContractStatusSchema = z.enum([
|
|
4
33
|
"proposed",
|
|
@@ -9,55 +38,120 @@ export const ContractStatusSchema = z.enum([
|
|
|
9
38
|
"passed",
|
|
10
39
|
"failed",
|
|
11
40
|
"needs-rework",
|
|
41
|
+
"completed",
|
|
42
|
+
]);
|
|
43
|
+
/**
|
|
44
|
+
* Strict enum of verification methods the evaluator can actually execute.
|
|
45
|
+
* Free-form strings here cause the evaluator to silently skip checks.
|
|
46
|
+
*/
|
|
47
|
+
export const VerificationMethodSchema = z.enum([
|
|
48
|
+
"manual",
|
|
49
|
+
"typecheck",
|
|
50
|
+
"lint",
|
|
51
|
+
"unit-test",
|
|
52
|
+
"playwright",
|
|
53
|
+
"api-check",
|
|
54
|
+
"build",
|
|
55
|
+
"agent-evaluation",
|
|
12
56
|
]);
|
|
13
|
-
export const
|
|
57
|
+
export const EstimatedDurationSchema = z.enum(["small", "medium", "large"]);
|
|
14
58
|
// ── Sub-types ───────────────────────────────────────────────────────
|
|
15
59
|
export const SuccessCriterionSchema = z.object({
|
|
16
|
-
|
|
17
|
-
description: z.string().min(
|
|
18
|
-
verificationMethod:
|
|
19
|
-
|
|
20
|
-
notes: z.string().optional(),
|
|
21
|
-
});
|
|
22
|
-
export const FileChangeSchema = z.object({
|
|
23
|
-
path: z.string().min(1),
|
|
24
|
-
action: FileActionSchema,
|
|
25
|
-
description: z.string().min(1),
|
|
60
|
+
criterionId: z.string().min(1),
|
|
61
|
+
description: z.string().min(MIN_CRITERION_DESCRIPTION_LENGTH),
|
|
62
|
+
verificationMethod: VerificationMethodSchema,
|
|
63
|
+
required: z.boolean(),
|
|
26
64
|
});
|
|
27
65
|
// ── Sprint Contract ─────────────────────────────────────────────────
|
|
28
66
|
export const SprintContractSchema = z.object({
|
|
29
|
-
|
|
30
|
-
|
|
67
|
+
// Identity
|
|
68
|
+
contractId: z.string().min(1),
|
|
69
|
+
specId: z.string().min(1),
|
|
70
|
+
sprintNumber: z.number().int().min(1),
|
|
71
|
+
title: z.string().min(1),
|
|
31
72
|
description: z.string().min(1),
|
|
32
|
-
successCriteria: z.array(SuccessCriterionSchema),
|
|
33
|
-
expectedChanges: z.array(FileChangeSchema),
|
|
34
|
-
dependsOn: z.array(z.string()),
|
|
35
73
|
status: ContractStatusSchema,
|
|
36
|
-
|
|
74
|
+
// Dependencies and feature linkage
|
|
75
|
+
dependsOn: z.array(z.string()).default([]),
|
|
76
|
+
features: z.array(z.string()).default([]),
|
|
77
|
+
// Success criteria (must include at least one)
|
|
78
|
+
successCriteria: z.array(SuccessCriterionSchema).min(1),
|
|
79
|
+
// ── Precision fields (added to combat Opus 4.7 literal-following) ──
|
|
80
|
+
/** Things the generator MUST NOT do, even if tempting. Forces explicit scope. */
|
|
81
|
+
nonGoals: z.array(z.string().min(1)).min(1),
|
|
82
|
+
/** Concrete signals that the sprint is finished. "Stop when X" beats "stop when done". */
|
|
83
|
+
stopConditions: z.array(z.string().min(1)).min(1),
|
|
84
|
+
/** Plain-English paragraph the generator can re-read mid-task to recenter. */
|
|
85
|
+
definitionOfDone: z.string().min(MIN_DEFINITION_OF_DONE_LENGTH),
|
|
86
|
+
/** Assumptions the planner made (often self-answered clarifications). */
|
|
87
|
+
assumptions: z.array(z.string()).default([]),
|
|
88
|
+
/** Items explicitly outside this sprint's scope (deferred or never). */
|
|
89
|
+
outOfScope: z.array(z.string()).default([]),
|
|
90
|
+
/**
|
|
91
|
+
* Self-rated ambiguity, 0 (fully specified) to 10 (very ambiguous).
|
|
92
|
+
* In autonomous mode the planner should refuse to emit contracts with
|
|
93
|
+
* scores >= 7 and instead surface clarification questions.
|
|
94
|
+
*/
|
|
95
|
+
ambiguityScore: z.number().int().min(0).max(10).optional(),
|
|
96
|
+
// Implementation guidance
|
|
37
97
|
generatorNotes: z.string().optional(),
|
|
98
|
+
evaluatorNotes: z.string().optional(),
|
|
99
|
+
estimatedFiles: z.array(z.string()).default([]),
|
|
100
|
+
estimatedDuration: EstimatedDurationSchema.optional(),
|
|
101
|
+
// Runtime / iteration state
|
|
38
102
|
evaluatorFeedback: z.string().optional(),
|
|
39
|
-
|
|
40
|
-
|
|
103
|
+
iterationHistory: z.array(z.unknown()).default([]),
|
|
104
|
+
lastEvalId: z.string().nullable().optional(),
|
|
105
|
+
evalResults: z.array(z.unknown()).optional(),
|
|
106
|
+
// Timestamps
|
|
107
|
+
createdAt: z.string().datetime({ offset: true }).optional(),
|
|
108
|
+
updatedAt: z.string().datetime({ offset: true }).optional(),
|
|
109
|
+
startedAt: z.string().datetime({ offset: true }).optional(),
|
|
110
|
+
completedAt: z.string().datetime({ offset: true }).optional(),
|
|
41
111
|
});
|
|
42
112
|
// ── Helpers ─────────────────────────────────────────────────────────
|
|
43
113
|
let contractCounter = 0;
|
|
44
114
|
/**
|
|
45
115
|
* Create a new sprint contract in "proposed" status.
|
|
116
|
+
*
|
|
117
|
+
* Auto-generated contracts (e.g. one-feature-per-sprint pipelines) get
|
|
118
|
+
* placeholder precision fields that explicitly signal they were not authored
|
|
119
|
+
* by a planner agent. The generator preflight check should treat these as
|
|
120
|
+
* incomplete and request clarification before implementing.
|
|
46
121
|
*/
|
|
47
|
-
export function createContract(
|
|
122
|
+
export function createContract(title, description, criteria, options = {}) {
|
|
48
123
|
contractCounter++;
|
|
49
|
-
const
|
|
124
|
+
const contractId = `sprint-${Date.now()}-${contractCounter}`;
|
|
125
|
+
const now = new Date().toISOString();
|
|
50
126
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
127
|
+
contractId,
|
|
128
|
+
specId: options.specId ?? "spec-unknown",
|
|
129
|
+
sprintNumber: options.sprintNumber ?? 1,
|
|
130
|
+
title,
|
|
53
131
|
description,
|
|
132
|
+
status: "proposed",
|
|
133
|
+
dependsOn: [],
|
|
134
|
+
features: options.features ?? [],
|
|
54
135
|
successCriteria: criteria.map((c) => ({
|
|
55
136
|
...c,
|
|
56
|
-
|
|
137
|
+
required: true,
|
|
57
138
|
})),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
139
|
+
nonGoals: options.nonGoals ?? [
|
|
140
|
+
"Auto-generated contract — planner did not specify non-goals",
|
|
141
|
+
],
|
|
142
|
+
stopConditions: options.stopConditions ?? [
|
|
143
|
+
"All required success criteria pass evaluation",
|
|
144
|
+
],
|
|
145
|
+
definitionOfDone: options.definitionOfDone ??
|
|
146
|
+
`Sprint is done when the success criteria for "${title}" all pass evaluation and no regressions are introduced.`,
|
|
147
|
+
assumptions: [],
|
|
148
|
+
outOfScope: [],
|
|
149
|
+
estimatedFiles: options.estimatedFiles ?? [],
|
|
150
|
+
estimatedDuration: options.estimatedDuration,
|
|
151
|
+
iterationHistory: [],
|
|
152
|
+
lastEvalId: null,
|
|
153
|
+
createdAt: now,
|
|
154
|
+
updatedAt: now,
|
|
61
155
|
};
|
|
62
156
|
}
|
|
63
157
|
/**
|
|
@@ -67,14 +161,67 @@ export function createContract(feature, description, criteria) {
|
|
|
67
161
|
*/
|
|
68
162
|
export function updateContractStatus(contract, status) {
|
|
69
163
|
const now = new Date().toISOString();
|
|
70
|
-
const updates = { status };
|
|
164
|
+
const updates = { status, updatedAt: now };
|
|
71
165
|
if (status === "in-progress" && !contract.startedAt) {
|
|
72
166
|
updates.startedAt = now;
|
|
73
167
|
}
|
|
74
|
-
if ((status === "passed" ||
|
|
168
|
+
if ((status === "passed" ||
|
|
169
|
+
status === "failed" ||
|
|
170
|
+
status === "completed") &&
|
|
75
171
|
!contract.completedAt) {
|
|
76
172
|
updates.completedAt = now;
|
|
77
173
|
}
|
|
78
174
|
return { ...contract, ...updates };
|
|
79
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Check a contract for precision issues that the Zod schema can't express:
|
|
178
|
+
* banned vague phrases, etc. Returns an empty array when the contract is clean.
|
|
179
|
+
*
|
|
180
|
+
* Schema-level constraints (min lengths, required fields) are enforced
|
|
181
|
+
* separately by SprintContractSchema.parse().
|
|
182
|
+
*/
|
|
183
|
+
export function findPrecisionIssues(contract) {
|
|
184
|
+
const issues = [];
|
|
185
|
+
function checkPhrases(text, field) {
|
|
186
|
+
const lower = text.toLowerCase();
|
|
187
|
+
for (const phrase of BANNED_VAGUE_PHRASES) {
|
|
188
|
+
if (lower.includes(phrase)) {
|
|
189
|
+
issues.push({
|
|
190
|
+
field,
|
|
191
|
+
message: `contains vague phrase "${phrase}" — be specific about observable behavior`,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
checkPhrases(contract.description, "description");
|
|
197
|
+
checkPhrases(contract.definitionOfDone, "definitionOfDone");
|
|
198
|
+
for (const c of contract.successCriteria) {
|
|
199
|
+
checkPhrases(c.description, `successCriteria[${c.criterionId}].description`);
|
|
200
|
+
}
|
|
201
|
+
for (let i = 0; i < contract.nonGoals.length; i++) {
|
|
202
|
+
checkPhrases(contract.nonGoals[i], `nonGoals[${i}]`);
|
|
203
|
+
}
|
|
204
|
+
for (let i = 0; i < contract.stopConditions.length; i++) {
|
|
205
|
+
checkPhrases(contract.stopConditions[i], `stopConditions[${i}]`);
|
|
206
|
+
}
|
|
207
|
+
return issues;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Check whether a contract has the precision fields populated with substance,
|
|
211
|
+
* not just placeholders from createContract(). Use this in the generator
|
|
212
|
+
* preflight to refuse to start work on incomplete contracts.
|
|
213
|
+
*/
|
|
214
|
+
export function isContractPrecise(contract) {
|
|
215
|
+
if (contract.nonGoals.length === 1 &&
|
|
216
|
+
contract.nonGoals[0].startsWith("Auto-generated contract")) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
if (findPrecisionIssues(contract).length > 0) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
if (contract.ambiguityScore !== undefined && contract.ambiguityScore >= 7) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
80
227
|
//# sourceMappingURL=sprint-contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprint-contract.js","sourceRoot":"","sources":["../../src/contracts/sprint-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uEAAuE;AAEvE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,UAAU;IACV,aAAa;IACb,QAAQ;IACR,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,cAAc;
|
|
1
|
+
{"version":3,"file":"sprint-contract.js","sourceRoot":"","sources":["../../src/contracts/sprint-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uEAAuE;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,iBAAiB;IACjB,mBAAmB;IACnB,YAAY;IACZ,YA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CAAC;IAC/E,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClD,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxD,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAwB;IACxD,IACE,QAAQ,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC9B,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAC1D,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS,IAAI,QAAQ,CAAC,cAAc,IAAI,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -9,7 +9,7 @@ function inferEndpointsFromContract(contract) {
|
|
|
9
9
|
const allText = [
|
|
10
10
|
contract.description,
|
|
11
11
|
...contract.successCriteria.map((c) => c.description),
|
|
12
|
-
...contract.
|
|
12
|
+
...contract.estimatedFiles,
|
|
13
13
|
].join("\n");
|
|
14
14
|
// Match patterns like "GET /api/users", "POST /api/items"
|
|
15
15
|
const httpPattern = /\b(GET|POST|PUT|PATCH|DELETE)\s+(\/\S+)/gi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-check.js","sourceRoot":"","sources":["../../../src/evaluators/builtin/api-check.ts"],"names":[],"mappings":"AAmBA,sEAAsE;AAEtE;;;GAGG;AACH,SAAS,0BAA0B,CAAC,QAAwB;IAC1D,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,oDAAoD;IACpD,MAAM,OAAO,GAAG;QACd,QAAQ,CAAC,WAAW;QACpB,GAAG,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QACrD,GAAG,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"api-check.js","sourceRoot":"","sources":["../../../src/evaluators/builtin/api-check.ts"],"names":[],"mappings":"AAmBA,sEAAsE;AAEtE;;;GAGG;AACH,SAAS,0BAA0B,CAAC,QAAwB;IAC1D,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,oDAAoD;IACpD,MAAM,OAAO,GAAG;QACd,QAAQ,CAAC,WAAW;QACpB,GAAG,QAAQ,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QACrD,GAAG,QAAQ,CAAC,cAAc;KAC3B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,0DAA0D;IAC1D,MAAM,WAAW,GAAG,2CAA2C,CAAC;IAChE,IAAI,KAA6B,CAAC;IAElC,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACtB,2CAA2C;QAC3C,MAAM,cA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StalenessVerdict } from "./types.js";
|
|
2
|
+
export declare class GraphArtifactStore {
|
|
3
|
+
private readonly projectRoot;
|
|
4
|
+
private readonly graphDir;
|
|
5
|
+
private readonly manifestPath;
|
|
6
|
+
constructor(projectRoot: string, manifestRelPath?: string);
|
|
7
|
+
ensureLayout(): Promise<void>;
|
|
8
|
+
readManifest(): Promise<GraphManifest | null>;
|
|
9
|
+
writeManifest(m: GraphManifest): Promise<void>;
|
|
10
|
+
staleness(): Promise<StalenessVerdict>;
|
|
11
|
+
private gitHeadSha;
|
|
12
|
+
private filesNewerThan;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=artifact-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-store.d.ts","sourceRoot":"","sources":["../../src/graph/artifact-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAElE,qBAAa,kBAAkB;IAK3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAJ9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAGnB,WAAW,EAAE,MAAM,EACpC,eAAe,SAA+B;IAM1C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,YAAY,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAa7C,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9C,SAAS,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAgC9B,UAAU;YAcV,cAAc;CAmB7B"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { execa } from "execa";
|
|
4
|
+
import { glob } from "glob";
|
|
5
|
+
import { ensureDir, fileExists, readJson, writeJson } from "../utils/fs.js";
|
|
6
|
+
export class GraphArtifactStore {
|
|
7
|
+
projectRoot;
|
|
8
|
+
graphDir;
|
|
9
|
+
manifestPath;
|
|
10
|
+
constructor(projectRoot, manifestRelPath = ".bober/graph/manifest.json") {
|
|
11
|
+
this.projectRoot = projectRoot;
|
|
12
|
+
this.manifestPath = resolve(projectRoot, manifestRelPath);
|
|
13
|
+
this.graphDir = resolve(projectRoot, ".bober/graph");
|
|
14
|
+
}
|
|
15
|
+
async ensureLayout() {
|
|
16
|
+
await ensureDir(this.graphDir);
|
|
17
|
+
}
|
|
18
|
+
async readManifest() {
|
|
19
|
+
if (!(await fileExists(this.manifestPath)))
|
|
20
|
+
return null;
|
|
21
|
+
try {
|
|
22
|
+
return await readJson(this.manifestPath);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.error(`[GraphArtifactStore] Malformed manifest at ${this.manifestPath}:`, err instanceof Error ? err.message : err);
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async writeManifest(m) {
|
|
30
|
+
await this.ensureLayout();
|
|
31
|
+
await writeJson(this.manifestPath, m);
|
|
32
|
+
}
|
|
33
|
+
async staleness() {
|
|
34
|
+
const manifest = await this.readManifest();
|
|
35
|
+
if (!manifest) {
|
|
36
|
+
return { stale: true, reason: "NO_MANIFEST", detail: "No manifest exists yet" };
|
|
37
|
+
}
|
|
38
|
+
// ── Git HEAD-SHA path ──
|
|
39
|
+
const head = await this.gitHeadSha();
|
|
40
|
+
if (head) {
|
|
41
|
+
if (manifest.lastSyncedHeadSha === head) {
|
|
42
|
+
return { stale: false };
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
stale: true,
|
|
46
|
+
reason: "HEAD_DIFFERS",
|
|
47
|
+
detail: `HEAD ${head} != lastSyncedHeadSha ${manifest.lastSyncedHeadSha ?? "null"}`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// ── mtime fallback (non-git repo or git unavailable) ──
|
|
51
|
+
const newer = await this.filesNewerThan(manifest.lastSyncAt);
|
|
52
|
+
if (newer.length > 0) {
|
|
53
|
+
return {
|
|
54
|
+
stale: true,
|
|
55
|
+
reason: "NEWER_MTIME",
|
|
56
|
+
detail: `${newer.length} file(s) modified after lastSyncAt`,
|
|
57
|
+
newerFiles: newer.slice(0, 20),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return { stale: false };
|
|
61
|
+
}
|
|
62
|
+
async gitHeadSha() {
|
|
63
|
+
try {
|
|
64
|
+
const r = await execa("git", ["rev-parse", "HEAD"], {
|
|
65
|
+
cwd: this.projectRoot,
|
|
66
|
+
reject: false,
|
|
67
|
+
timeout: 2000,
|
|
68
|
+
});
|
|
69
|
+
if (r.exitCode !== 0)
|
|
70
|
+
return null;
|
|
71
|
+
return r.stdout.trim() || null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async filesNewerThan(isoTime) {
|
|
78
|
+
const cutoff = Date.parse(isoTime);
|
|
79
|
+
if (Number.isNaN(cutoff))
|
|
80
|
+
return [];
|
|
81
|
+
const candidates = await glob("**/*", {
|
|
82
|
+
cwd: this.projectRoot,
|
|
83
|
+
nodir: true,
|
|
84
|
+
ignore: ["node_modules/**", ".git/**", "dist/**", ".bober/**"],
|
|
85
|
+
});
|
|
86
|
+
const newer = [];
|
|
87
|
+
for (const rel of candidates) {
|
|
88
|
+
try {
|
|
89
|
+
const s = await stat(join(this.projectRoot, rel));
|
|
90
|
+
if (s.mtimeMs > cutoff)
|
|
91
|
+
newer.push(rel);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
/* skip */
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return newer;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=artifact-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-store.js","sourceR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interface SyncResult {
|
|
3
|
+
indexed: number;
|
|
4
|
+
}
|
|
5
|
+
export interface StatusResult {
|
|
6
|
+
ready: boolean;
|
|
7
|
+
indexedFileCount: number;
|
|
8
|
+
tokensaveVersion: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Short-lived execa wrapper for `tokensave init/sync/status`.
|
|
12
|
+
*
|
|
13
|
+
* Each method spawns a child process and waits for it to exit.
|
|
14
|
+
* Use `TokensaveMcpClient` for long-lived JSON-RPC calls.
|
|
15
|
+
*
|
|
16
|
+
* Constructor pattern mirrors `TokensavePrereqCheck` (src/graph/prereq.ts:7-8).
|
|
17
|
+
*/
|
|
18
|
+
export declare class TokensaveCli {
|
|
19
|
+
private readonly cwd;
|
|
20
|
+
private readonly store;
|
|
21
|
+
private readonly binary;
|
|
22
|
+
constructor(cwd: string, store?: GraphArtifactStore | null, binary?: string);
|
|
23
|
+
/**
|
|
24
|
+
* Run `tokensave init --tier <tier>`.
|
|
25
|
+
* Resolves on exit code 0; throws a structured Error on non-zero.
|
|
26
|
+
*/
|
|
27
|
+
init(opts: {
|
|
28
|
+
cwd?: string;
|
|
29
|
+
languageTier: string;
|
|
30
|
+
}): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Run `tokensave sync <paths...>` with a timeout.
|
|
33
|
+
* Returns `{indexed}` parsed from stdout JSON.
|
|
34
|
+
* Throws on timeout, non-zero exit, or unparseable output.
|
|
35
|
+
*
|
|
36
|
+
* After a successful sync, updates the manifest via the injected
|
|
37
|
+
* GraphArtifactStore (if provided), setting lastSyncAt and clearing
|
|
38
|
+
* pendingFiles (evaluator note #10).
|
|
39
|
+
*/
|
|
40
|
+
sync(paths: string[], timeoutMs: number): Promise<SyncResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Run `tokensave status --json`.
|
|
43
|
+
* Returns `{ready: false, indexedFileCount: 0, tokensaveVersion: ""}` when
|
|
44
|
+
* tokensave has not been initialised — does NOT throw in that case.
|
|
45
|
+
* Throws only on binary execution failure (ENOENT etc.).
|
|
46
|
+
*/
|
|
47
|
+
status(): Promise<StatusResult>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/graph/cli.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAID;;;;;;;GAOG;AACH,qBAAa,YAAY;IAErB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,kBAAkB,GAAG,IAAW,EACvC,MAAM,GAAE,MAAoB;IAG/C;;;OAGG;IACG,IAAI,CAAC,IAAI,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvE;;;;;;;;OAQG;IACG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IA6CnE;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC;CAkCtC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
// ── TokensaveCli ───────────────────────────────────────────────────
|
|
3
|
+
/**
|
|
4
|
+
* Short-lived execa wrapper for `tokensave init/sync/status`.
|
|
5
|
+
*
|
|
6
|
+
* Each method spawns a child process and waits for it to exit.
|
|
7
|
+
* Use `TokensaveMcpClient` for long-lived JSON-RPC calls.
|
|
8
|
+
*
|
|
9
|
+
* Constructor pattern mirrors `TokensavePrereqCheck` (src/graph/prereq.ts:7-8).
|
|
10
|
+
*/
|
|
11
|
+
export class TokensaveCli {
|
|
12
|
+
cwd;
|
|
13
|
+
store;
|
|
14
|
+
binary;
|
|
15
|
+
constructor(cwd, store = null, binary = "tokensave") {
|
|
16
|
+
this.cwd = cwd;
|
|
17
|
+
this.store = store;
|
|
18
|
+
this.binary = binary;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Run `tokensave init --tier <tier>`.
|
|
22
|
+
* Resolves on exit code 0; throws a structured Error on non-zero.
|
|
23
|
+
*/
|
|
24
|
+
async init(opts) {
|
|
25
|
+
const effectiveCwd = opts.cwd ?? this.cwd;
|
|
26
|
+
const result = await execa(this.binary, ["init", "--tier", opts.languageTier], {
|
|
27
|
+
cwd: effectiveCwd,
|
|
28
|
+
reject: false,
|
|
29
|
+
all: true,
|
|
30
|
+
});
|
|
31
|
+
if (result.exitCode !== 0) {
|
|
32
|
+
const output = result.all ?? result.stdout ?? result.stderr ?? "";
|
|
33
|
+
throw new Error(`tokensave init failed (exit ${result.exitCode ?? -1}): ${output.slice(0, 500)}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run `tokensave sync <paths...>` with a timeout.
|
|
38
|
+
* Returns `{indexed}` parsed from stdout JSON.
|
|
39
|
+
* Throws on timeout, non-zero exit, or unparseable output.
|
|
40
|
+
*
|
|
41
|
+
* After a successful sync, updates the manifest via the injected
|
|
42
|
+
* GraphArtifactStore (if provided), setting lastSyncAt and clearing
|
|
43
|
+
* pendingFiles (evaluator note #10).
|
|
44
|
+
*/
|
|
45
|
+
async sync(paths, timeoutMs) {
|
|
46
|
+
const result = await execa(this.binary, ["sync", ...paths], {
|
|
47
|
+
cwd: this.cwd,
|
|
48
|
+
timeout: timeoutMs,
|
|
49
|
+
reject: false,
|
|
50
|
+
all: true,
|
|
51
|
+
});
|
|
52
|
+
// Detect timeout — execa sets timedOut flag or ETIMEDOUT in message
|
|
53
|
+
if (result.timedOut) {
|
|
54
|
+
throw new Error(`tokensave sync timed out after ${timeoutMs}ms`);
|
|
55
|
+
}
|
|
56
|
+
if (result.exitCode !== 0) {
|
|
57
|
+
const output = result.all ?? result.stdout ?? result.stderr ?? "";
|
|
58
|
+
throw new Error(`tokensave sync failed (exit ${result.exitCode ?? -1}): ${output.slice(0, 500)}`);
|
|
59
|
+
}
|
|
60
|
+
const stdout = result.stdout ?? "";
|
|
61
|
+
const indexed = parseSyncOutput(stdout);
|
|
62
|
+
// Update manifest via store if injected
|
|
63
|
+
if (this.store) {
|
|
64
|
+
try {
|
|
65
|
+
const existing = await this.store.readManifest();
|
|
66
|
+
if (existing) {
|
|
67
|
+
await this.store.writeManifest({
|
|
68
|
+
...existing,
|
|
69
|
+
lastSyncAt: new Date().toISOString(),
|
|
70
|
+
indexedFileCount: indexed,
|
|
71
|
+
pendingFiles: [],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Manifest update is best-effort; sync result is still valid
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return { indexed };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Run `tokensave status --json`.
|
|
83
|
+
* Returns `{ready: false, indexedFileCount: 0, tokensaveVersion: ""}` when
|
|
84
|
+
* tokensave has not been initialised — does NOT throw in that case.
|
|
85
|
+
* Throws only on binary execution failure (ENOENT etc.).
|
|
86
|
+
*/
|
|
87
|
+
async status() {
|
|
88
|
+
const result = await execa(this.binary, ["status", "--json"], {
|
|
89
|
+
cwd: this.cwd,
|
|
90
|
+
reject: false,
|
|
91
|
+
all: true,
|
|
92
|
+
});
|
|
93
|
+
// If the binary can't be found at all, propagate the error
|
|
94
|
+
if (result.failed && result.exitCode === null) {
|
|
95
|
+
throw new Error(`tokensave binary not found or could not execute: ${result.stderr ?? ""}`);
|
|
96
|
+
}
|
|
97
|
+
// Any non-zero exit (e.g. "not initialised") → not-ready, don't throw
|
|
98
|
+
const stdout = result.stdout ?? "";
|
|
99
|
+
if (!stdout.trim()) {
|
|
100
|
+
return { ready: false, indexedFileCount: 0, tokensaveVersion: "" };
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const parsed = JSON.parse(stdout);
|
|
104
|
+
return {
|
|
105
|
+
ready: parsed.ready === true,
|
|
106
|
+
indexedFileCount: typeof parsed.indexedFileCount === "number" ? parsed.indexedFileCount : 0,
|
|
107
|
+
tokensaveVersion: typeof parsed.tokensaveVersion === "string" ? parsed.tokensaveVersion : "",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Unparseable output → treat as not-ready, not an error
|
|
112
|
+
return { ready: false, indexedFileCount: 0, tokensaveVersion: "" };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// ── Helpers ────────────────────────────────────────────────────────
|
|
117
|
+
/**
|
|
118
|
+
* Parse `{indexed: N}` from tokensave sync stdout.
|
|
119
|
+
* Accepts both plain JSON and a JSON object embedded in other text.
|
|
120
|
+
*/
|
|
121
|
+
function parseSyncOutput(stdout) {
|
|
122
|
+
const trimmed = stdout.trim();
|
|
123
|
+
if (!trimmed)
|
|
124
|
+
return 0;
|
|
125
|
+
// Try direct JSON parse
|
|
126
|
+
try {
|
|
127
|
+
const obj = JSON.parse(trimmed);
|
|
128
|
+
if (typeof obj.indexed === "number")
|
|
129
|
+
return obj.indexed;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Fall through
|
|
133
|
+
}
|
|
134
|
+
// Try to extract a number from a key-value pattern like "indexed: 42"
|
|
135
|
+
const match = /indexed["\s:]+(\d+)/.exec(trimmed);
|
|
136
|
+
if (match)
|
|
137
|
+
return parseInt(match[1], 10);
|
|
138
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