hivemind-pipeline 0.1.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/LICENSE +63 -0
- package/README.md +352 -0
- package/dist/bin/swarm.d.ts +3 -0
- package/dist/bin/swarm.d.ts.map +1 -0
- package/dist/bin/swarm.js +293 -0
- package/dist/bin/swarm.js.map +1 -0
- package/dist/dashboard/assets/index-Cf_KwDES.js +359 -0
- package/dist/dashboard/assets/index-SatEQz0u.css +1 -0
- package/dist/dashboard/index.html +16 -0
- package/dist/prompts/Architect-Go.md +455 -0
- package/dist/prompts/Architect-Node.md +379 -0
- package/dist/prompts/Architect-Python.md +63 -0
- package/dist/prompts/Architect-React.md +352 -0
- package/dist/prompts/Architect-Rust.md +63 -0
- package/dist/prompts/Architect-Swift.md +61 -0
- package/dist/prompts/Software-engineer-go.md +254 -0
- package/dist/prompts/Software-engineer-node.md +241 -0
- package/dist/prompts/Software-engineer-python.md +70 -0
- package/dist/prompts/Software-engineer-react.md +167 -0
- package/dist/prompts/Software-engineer-rust.md +69 -0
- package/dist/prompts/Software-engineer-swift.md +69 -0
- package/dist/prompts/Software-lead-go.md +247 -0
- package/dist/prompts/Software-lead-node.md +238 -0
- package/dist/prompts/Software-lead-python.md +53 -0
- package/dist/prompts/Software-lead-react.md +229 -0
- package/dist/prompts/Software-lead-rust.md +53 -0
- package/dist/prompts/Software-lead-swift.md +53 -0
- package/dist/prompts/analyst-go.md +351 -0
- package/dist/prompts/analyst-node.md +317 -0
- package/dist/prompts/analyst-python.md +139 -0
- package/dist/prompts/analyst-react.md +428 -0
- package/dist/prompts/analyst-rust.md +125 -0
- package/dist/prompts/analyst-swift.md +125 -0
- package/dist/prompts/test-engineer-go.md +99 -0
- package/dist/prompts/test-engineer-node.md +97 -0
- package/dist/prompts/test-engineer-python.md +61 -0
- package/dist/prompts/test-engineer-react.md +104 -0
- package/dist/prompts/test-engineer-rust.md +62 -0
- package/dist/prompts/test-engineer-swift.md +66 -0
- package/dist/src/__tests__/commands/analyze.test.d.ts +2 -0
- package/dist/src/__tests__/commands/analyze.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/analyze.test.js +61 -0
- package/dist/src/__tests__/commands/analyze.test.js.map +1 -0
- package/dist/src/__tests__/commands/architect.test.d.ts +2 -0
- package/dist/src/__tests__/commands/architect.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/architect.test.js +46 -0
- package/dist/src/__tests__/commands/architect.test.js.map +1 -0
- package/dist/src/__tests__/commands/build.test.d.ts +2 -0
- package/dist/src/__tests__/commands/build.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/build.test.js +69 -0
- package/dist/src/__tests__/commands/build.test.js.map +1 -0
- package/dist/src/__tests__/commands/dashboard.test.d.ts +2 -0
- package/dist/src/__tests__/commands/dashboard.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/dashboard.test.js +95 -0
- package/dist/src/__tests__/commands/dashboard.test.js.map +1 -0
- package/dist/src/__tests__/commands/doctor.test.d.ts +2 -0
- package/dist/src/__tests__/commands/doctor.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/doctor.test.js +69 -0
- package/dist/src/__tests__/commands/doctor.test.js.map +1 -0
- package/dist/src/__tests__/commands/fix.test.d.ts +2 -0
- package/dist/src/__tests__/commands/fix.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/fix.test.js +147 -0
- package/dist/src/__tests__/commands/fix.test.js.map +1 -0
- package/dist/src/__tests__/commands/init.test.d.ts +2 -0
- package/dist/src/__tests__/commands/init.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/init.test.js +79 -0
- package/dist/src/__tests__/commands/init.test.js.map +1 -0
- package/dist/src/__tests__/commands/learn.test.d.ts +2 -0
- package/dist/src/__tests__/commands/learn.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/learn.test.js +64 -0
- package/dist/src/__tests__/commands/learn.test.js.map +1 -0
- package/dist/src/__tests__/commands/mayday.test.d.ts +2 -0
- package/dist/src/__tests__/commands/mayday.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/mayday.test.js +115 -0
- package/dist/src/__tests__/commands/mayday.test.js.map +1 -0
- package/dist/src/__tests__/commands/memory.test.d.ts +2 -0
- package/dist/src/__tests__/commands/memory.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/memory.test.js +80 -0
- package/dist/src/__tests__/commands/memory.test.js.map +1 -0
- package/dist/src/__tests__/commands/plan.test.d.ts +2 -0
- package/dist/src/__tests__/commands/plan.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/plan.test.js +46 -0
- package/dist/src/__tests__/commands/plan.test.js.map +1 -0
- package/dist/src/__tests__/commands/pr.test.d.ts +2 -0
- package/dist/src/__tests__/commands/pr.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/pr.test.js +170 -0
- package/dist/src/__tests__/commands/pr.test.js.map +1 -0
- package/dist/src/__tests__/commands/refactor.test.d.ts +2 -0
- package/dist/src/__tests__/commands/refactor.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/refactor.test.js +107 -0
- package/dist/src/__tests__/commands/refactor.test.js.map +1 -0
- package/dist/src/__tests__/commands/review.test.d.ts +2 -0
- package/dist/src/__tests__/commands/review.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/review.test.js +125 -0
- package/dist/src/__tests__/commands/review.test.js.map +1 -0
- package/dist/src/__tests__/commands/shared.test.d.ts +2 -0
- package/dist/src/__tests__/commands/shared.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/shared.test.js +112 -0
- package/dist/src/__tests__/commands/shared.test.js.map +1 -0
- package/dist/src/__tests__/commands/spike.test.d.ts +2 -0
- package/dist/src/__tests__/commands/spike.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/spike.test.js +75 -0
- package/dist/src/__tests__/commands/spike.test.js.map +1 -0
- package/dist/src/__tests__/commands/stats.test.d.ts +2 -0
- package/dist/src/__tests__/commands/stats.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/stats.test.js +82 -0
- package/dist/src/__tests__/commands/stats.test.js.map +1 -0
- package/dist/src/__tests__/commands/status.test.d.ts +2 -0
- package/dist/src/__tests__/commands/status.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/status.test.js +60 -0
- package/dist/src/__tests__/commands/status.test.js.map +1 -0
- package/dist/src/__tests__/commands/test-cmd.test.d.ts +2 -0
- package/dist/src/__tests__/commands/test-cmd.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/test-cmd.test.js +76 -0
- package/dist/src/__tests__/commands/test-cmd.test.js.map +1 -0
- package/dist/src/__tests__/commands/test-gen.test.d.ts +2 -0
- package/dist/src/__tests__/commands/test-gen.test.d.ts.map +1 -0
- package/dist/src/__tests__/commands/test-gen.test.js +151 -0
- package/dist/src/__tests__/commands/test-gen.test.js.map +1 -0
- package/dist/src/__tests__/core/agent-manager.test.d.ts +2 -0
- package/dist/src/__tests__/core/agent-manager.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/agent-manager.test.js +167 -0
- package/dist/src/__tests__/core/agent-manager.test.js.map +1 -0
- package/dist/src/__tests__/core/agent-process.test.d.ts +2 -0
- package/dist/src/__tests__/core/agent-process.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/agent-process.test.js +178 -0
- package/dist/src/__tests__/core/agent-process.test.js.map +1 -0
- package/dist/src/__tests__/core/guardrails.test.d.ts +2 -0
- package/dist/src/__tests__/core/guardrails.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/guardrails.test.js +249 -0
- package/dist/src/__tests__/core/guardrails.test.js.map +1 -0
- package/dist/src/__tests__/core/pipeline.test.d.ts +2 -0
- package/dist/src/__tests__/core/pipeline.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/pipeline.test.js +331 -0
- package/dist/src/__tests__/core/pipeline.test.js.map +1 -0
- package/dist/src/__tests__/core/state.test.d.ts +2 -0
- package/dist/src/__tests__/core/state.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/state.test.js +132 -0
- package/dist/src/__tests__/core/state.test.js.map +1 -0
- package/dist/src/__tests__/core/ws-server.test.d.ts +2 -0
- package/dist/src/__tests__/core/ws-server.test.d.ts.map +1 -0
- package/dist/src/__tests__/core/ws-server.test.js +177 -0
- package/dist/src/__tests__/core/ws-server.test.js.map +1 -0
- package/dist/src/__tests__/helpers/temp-dir.d.ts +8 -0
- package/dist/src/__tests__/helpers/temp-dir.d.ts.map +1 -0
- package/dist/src/__tests__/helpers/temp-dir.js +25 -0
- package/dist/src/__tests__/helpers/temp-dir.js.map +1 -0
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/agent.d.ts.map +1 -0
- package/dist/src/commands/agent.js +103 -0
- package/dist/src/commands/agent.js.map +1 -0
- package/dist/src/commands/allocate.d.ts +3 -0
- package/dist/src/commands/allocate.d.ts.map +1 -0
- package/dist/src/commands/allocate.js +229 -0
- package/dist/src/commands/allocate.js.map +1 -0
- package/dist/src/commands/analyze.d.ts +3 -0
- package/dist/src/commands/analyze.d.ts.map +1 -0
- package/dist/src/commands/analyze.js +63 -0
- package/dist/src/commands/analyze.js.map +1 -0
- package/dist/src/commands/architect-review.d.ts +3 -0
- package/dist/src/commands/architect-review.d.ts.map +1 -0
- package/dist/src/commands/architect-review.js +695 -0
- package/dist/src/commands/architect-review.js.map +1 -0
- package/dist/src/commands/architect.d.ts +3 -0
- package/dist/src/commands/architect.d.ts.map +1 -0
- package/dist/src/commands/architect.js +49 -0
- package/dist/src/commands/architect.js.map +1 -0
- package/dist/src/commands/audit.d.ts +3 -0
- package/dist/src/commands/audit.d.ts.map +1 -0
- package/dist/src/commands/audit.js +55 -0
- package/dist/src/commands/audit.js.map +1 -0
- package/dist/src/commands/autopilot.d.ts +7 -0
- package/dist/src/commands/autopilot.d.ts.map +1 -0
- package/dist/src/commands/autopilot.js +377 -0
- package/dist/src/commands/autopilot.js.map +1 -0
- package/dist/src/commands/babysit-prs.d.ts +13 -0
- package/dist/src/commands/babysit-prs.d.ts.map +1 -0
- package/dist/src/commands/babysit-prs.js +283 -0
- package/dist/src/commands/babysit-prs.js.map +1 -0
- package/dist/src/commands/benchmark.d.ts +34 -0
- package/dist/src/commands/benchmark.d.ts.map +1 -0
- package/dist/src/commands/benchmark.js +534 -0
- package/dist/src/commands/benchmark.js.map +1 -0
- package/dist/src/commands/build.d.ts +3 -0
- package/dist/src/commands/build.d.ts.map +1 -0
- package/dist/src/commands/build.js +63 -0
- package/dist/src/commands/build.js.map +1 -0
- package/dist/src/commands/check.d.ts +3 -0
- package/dist/src/commands/check.d.ts.map +1 -0
- package/dist/src/commands/check.js +102 -0
- package/dist/src/commands/check.js.map +1 -0
- package/dist/src/commands/ci.d.ts +3 -0
- package/dist/src/commands/ci.d.ts.map +1 -0
- package/dist/src/commands/ci.js +124 -0
- package/dist/src/commands/ci.js.map +1 -0
- package/dist/src/commands/compete.d.ts +3 -0
- package/dist/src/commands/compete.d.ts.map +1 -0
- package/dist/src/commands/compete.js +164 -0
- package/dist/src/commands/compete.js.map +1 -0
- package/dist/src/commands/compliance.d.ts +3 -0
- package/dist/src/commands/compliance.d.ts.map +1 -0
- package/dist/src/commands/compliance.js +722 -0
- package/dist/src/commands/compliance.js.map +1 -0
- package/dist/src/commands/context.d.ts +3 -0
- package/dist/src/commands/context.d.ts.map +1 -0
- package/dist/src/commands/context.js +171 -0
- package/dist/src/commands/context.js.map +1 -0
- package/dist/src/commands/contract.d.ts +3 -0
- package/dist/src/commands/contract.d.ts.map +1 -0
- package/dist/src/commands/contract.js +384 -0
- package/dist/src/commands/contract.js.map +1 -0
- package/dist/src/commands/dashboard.d.ts +3 -0
- package/dist/src/commands/dashboard.d.ts.map +1 -0
- package/dist/src/commands/dashboard.js +114 -0
- package/dist/src/commands/dashboard.js.map +1 -0
- package/dist/src/commands/delegate.d.ts +3 -0
- package/dist/src/commands/delegate.d.ts.map +1 -0
- package/dist/src/commands/delegate.js +474 -0
- package/dist/src/commands/delegate.js.map +1 -0
- package/dist/src/commands/deploy.d.ts +17 -0
- package/dist/src/commands/deploy.d.ts.map +1 -0
- package/dist/src/commands/deploy.js +163 -0
- package/dist/src/commands/deploy.js.map +1 -0
- package/dist/src/commands/deps.d.ts +3 -0
- package/dist/src/commands/deps.d.ts.map +1 -0
- package/dist/src/commands/deps.js +548 -0
- package/dist/src/commands/deps.js.map +1 -0
- package/dist/src/commands/doctor.d.ts +3 -0
- package/dist/src/commands/doctor.d.ts.map +1 -0
- package/dist/src/commands/doctor.js +120 -0
- package/dist/src/commands/doctor.js.map +1 -0
- package/dist/src/commands/empathize.d.ts +3 -0
- package/dist/src/commands/empathize.d.ts.map +1 -0
- package/dist/src/commands/empathize.js +253 -0
- package/dist/src/commands/empathize.js.map +1 -0
- package/dist/src/commands/evaluate.d.ts +3 -0
- package/dist/src/commands/evaluate.d.ts.map +1 -0
- package/dist/src/commands/evaluate.js +49 -0
- package/dist/src/commands/evaluate.js.map +1 -0
- package/dist/src/commands/evolve.d.ts +3 -0
- package/dist/src/commands/evolve.d.ts.map +1 -0
- package/dist/src/commands/evolve.js +841 -0
- package/dist/src/commands/evolve.js.map +1 -0
- package/dist/src/commands/experiment.d.ts +3 -0
- package/dist/src/commands/experiment.d.ts.map +1 -0
- package/dist/src/commands/experiment.js +286 -0
- package/dist/src/commands/experiment.js.map +1 -0
- package/dist/src/commands/explain.d.ts +3 -0
- package/dist/src/commands/explain.d.ts.map +1 -0
- package/dist/src/commands/explain.js +159 -0
- package/dist/src/commands/explain.js.map +1 -0
- package/dist/src/commands/federate.d.ts +3 -0
- package/dist/src/commands/federate.d.ts.map +1 -0
- package/dist/src/commands/federate.js +148 -0
- package/dist/src/commands/federate.js.map +1 -0
- package/dist/src/commands/fingerprint.d.ts +3 -0
- package/dist/src/commands/fingerprint.d.ts.map +1 -0
- package/dist/src/commands/fingerprint.js +65 -0
- package/dist/src/commands/fingerprint.js.map +1 -0
- package/dist/src/commands/fix.d.ts +3 -0
- package/dist/src/commands/fix.d.ts.map +1 -0
- package/dist/src/commands/fix.js +160 -0
- package/dist/src/commands/fix.js.map +1 -0
- package/dist/src/commands/fleet.d.ts +3 -0
- package/dist/src/commands/fleet.d.ts.map +1 -0
- package/dist/src/commands/fleet.js +311 -0
- package/dist/src/commands/fleet.js.map +1 -0
- package/dist/src/commands/forecast.d.ts +3 -0
- package/dist/src/commands/forecast.d.ts.map +1 -0
- package/dist/src/commands/forecast.js +522 -0
- package/dist/src/commands/forecast.js.map +1 -0
- package/dist/src/commands/govern.d.ts +3 -0
- package/dist/src/commands/govern.d.ts.map +1 -0
- package/dist/src/commands/govern.js +280 -0
- package/dist/src/commands/govern.js.map +1 -0
- package/dist/src/commands/health.d.ts +17 -0
- package/dist/src/commands/health.d.ts.map +1 -0
- package/dist/src/commands/health.js +491 -0
- package/dist/src/commands/health.js.map +1 -0
- package/dist/src/commands/impact.d.ts +3 -0
- package/dist/src/commands/impact.d.ts.map +1 -0
- package/dist/src/commands/impact.js +186 -0
- package/dist/src/commands/impact.js.map +1 -0
- package/dist/src/commands/improve.d.ts +3 -0
- package/dist/src/commands/improve.d.ts.map +1 -0
- package/dist/src/commands/improve.js +240 -0
- package/dist/src/commands/improve.js.map +1 -0
- package/dist/src/commands/inbox.d.ts +29 -0
- package/dist/src/commands/inbox.d.ts.map +1 -0
- package/dist/src/commands/inbox.js +538 -0
- package/dist/src/commands/inbox.js.map +1 -0
- package/dist/src/commands/incident.d.ts +15 -0
- package/dist/src/commands/incident.d.ts.map +1 -0
- package/dist/src/commands/incident.js +318 -0
- package/dist/src/commands/incident.js.map +1 -0
- package/dist/src/commands/init.d.ts +3 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +97 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/journal.d.ts +3 -0
- package/dist/src/commands/journal.d.ts.map +1 -0
- package/dist/src/commands/journal.js +146 -0
- package/dist/src/commands/journal.js.map +1 -0
- package/dist/src/commands/learn.d.ts +9 -0
- package/dist/src/commands/learn.d.ts.map +1 -0
- package/dist/src/commands/learn.js +107 -0
- package/dist/src/commands/learn.js.map +1 -0
- package/dist/src/commands/mayday.d.ts +3 -0
- package/dist/src/commands/mayday.d.ts.map +1 -0
- package/dist/src/commands/mayday.js +145 -0
- package/dist/src/commands/mayday.js.map +1 -0
- package/dist/src/commands/memory.d.ts +3 -0
- package/dist/src/commands/memory.d.ts.map +1 -0
- package/dist/src/commands/memory.js +113 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/mentor.d.ts +3 -0
- package/dist/src/commands/mentor.d.ts.map +1 -0
- package/dist/src/commands/mentor.js +225 -0
- package/dist/src/commands/mentor.js.map +1 -0
- package/dist/src/commands/migrate.d.ts +3 -0
- package/dist/src/commands/migrate.d.ts.map +1 -0
- package/dist/src/commands/migrate.js +169 -0
- package/dist/src/commands/migrate.js.map +1 -0
- package/dist/src/commands/models.d.ts +3 -0
- package/dist/src/commands/models.d.ts.map +1 -0
- package/dist/src/commands/models.js +396 -0
- package/dist/src/commands/models.js.map +1 -0
- package/dist/src/commands/multi-repo.d.ts +18 -0
- package/dist/src/commands/multi-repo.d.ts.map +1 -0
- package/dist/src/commands/multi-repo.js +423 -0
- package/dist/src/commands/multi-repo.js.map +1 -0
- package/dist/src/commands/negotiate.d.ts +3 -0
- package/dist/src/commands/negotiate.d.ts.map +1 -0
- package/dist/src/commands/negotiate.js +239 -0
- package/dist/src/commands/negotiate.js.map +1 -0
- package/dist/src/commands/observe.d.ts +3 -0
- package/dist/src/commands/observe.d.ts.map +1 -0
- package/dist/src/commands/observe.js +445 -0
- package/dist/src/commands/observe.js.map +1 -0
- package/dist/src/commands/onboard.d.ts +3 -0
- package/dist/src/commands/onboard.d.ts.map +1 -0
- package/dist/src/commands/onboard.js +263 -0
- package/dist/src/commands/onboard.js.map +1 -0
- package/dist/src/commands/optimize.d.ts +3 -0
- package/dist/src/commands/optimize.d.ts.map +1 -0
- package/dist/src/commands/optimize.js +340 -0
- package/dist/src/commands/optimize.js.map +1 -0
- package/dist/src/commands/own.d.ts +3 -0
- package/dist/src/commands/own.d.ts.map +1 -0
- package/dist/src/commands/own.js +499 -0
- package/dist/src/commands/own.js.map +1 -0
- package/dist/src/commands/pair.d.ts +3 -0
- package/dist/src/commands/pair.d.ts.map +1 -0
- package/dist/src/commands/pair.js +206 -0
- package/dist/src/commands/pair.js.map +1 -0
- package/dist/src/commands/pipeline.d.ts +3 -0
- package/dist/src/commands/pipeline.d.ts.map +1 -0
- package/dist/src/commands/pipeline.js +143 -0
- package/dist/src/commands/pipeline.js.map +1 -0
- package/dist/src/commands/plan.d.ts +3 -0
- package/dist/src/commands/plan.d.ts.map +1 -0
- package/dist/src/commands/plan.js +49 -0
- package/dist/src/commands/plan.js.map +1 -0
- package/dist/src/commands/plugin.d.ts +3 -0
- package/dist/src/commands/plugin.d.ts.map +1 -0
- package/dist/src/commands/plugin.js +114 -0
- package/dist/src/commands/plugin.js.map +1 -0
- package/dist/src/commands/pm.d.ts +38 -0
- package/dist/src/commands/pm.d.ts.map +1 -0
- package/dist/src/commands/pm.js +664 -0
- package/dist/src/commands/pm.js.map +1 -0
- package/dist/src/commands/pr.d.ts +3 -0
- package/dist/src/commands/pr.d.ts.map +1 -0
- package/dist/src/commands/pr.js +225 -0
- package/dist/src/commands/pr.js.map +1 -0
- package/dist/src/commands/prompt-guard.d.ts +3 -0
- package/dist/src/commands/prompt-guard.d.ts.map +1 -0
- package/dist/src/commands/prompt-guard.js +54 -0
- package/dist/src/commands/prompt-guard.js.map +1 -0
- package/dist/src/commands/provenance.d.ts +3 -0
- package/dist/src/commands/provenance.d.ts.map +1 -0
- package/dist/src/commands/provenance.js +96 -0
- package/dist/src/commands/provenance.js.map +1 -0
- package/dist/src/commands/recover.d.ts +3 -0
- package/dist/src/commands/recover.d.ts.map +1 -0
- package/dist/src/commands/recover.js +32 -0
- package/dist/src/commands/recover.js.map +1 -0
- package/dist/src/commands/refactor.d.ts +3 -0
- package/dist/src/commands/refactor.d.ts.map +1 -0
- package/dist/src/commands/refactor.js +143 -0
- package/dist/src/commands/refactor.js.map +1 -0
- package/dist/src/commands/report.d.ts +66 -0
- package/dist/src/commands/report.d.ts.map +1 -0
- package/dist/src/commands/report.js +493 -0
- package/dist/src/commands/report.js.map +1 -0
- package/dist/src/commands/retro.d.ts +71 -0
- package/dist/src/commands/retro.d.ts.map +1 -0
- package/dist/src/commands/retro.js +449 -0
- package/dist/src/commands/retro.js.map +1 -0
- package/dist/src/commands/review.d.ts +3 -0
- package/dist/src/commands/review.d.ts.map +1 -0
- package/dist/src/commands/review.js +202 -0
- package/dist/src/commands/review.js.map +1 -0
- package/dist/src/commands/risk.d.ts +3 -0
- package/dist/src/commands/risk.d.ts.map +1 -0
- package/dist/src/commands/risk.js +110 -0
- package/dist/src/commands/risk.js.map +1 -0
- package/dist/src/commands/roadmap.d.ts +3 -0
- package/dist/src/commands/roadmap.d.ts.map +1 -0
- package/dist/src/commands/roadmap.js +506 -0
- package/dist/src/commands/roadmap.js.map +1 -0
- package/dist/src/commands/runtime-monitor.d.ts +3 -0
- package/dist/src/commands/runtime-monitor.d.ts.map +1 -0
- package/dist/src/commands/runtime-monitor.js +154 -0
- package/dist/src/commands/runtime-monitor.js.map +1 -0
- package/dist/src/commands/sandbox.d.ts +3 -0
- package/dist/src/commands/sandbox.d.ts.map +1 -0
- package/dist/src/commands/sandbox.js +201 -0
- package/dist/src/commands/sandbox.js.map +1 -0
- package/dist/src/commands/scope.d.ts +3 -0
- package/dist/src/commands/scope.d.ts.map +1 -0
- package/dist/src/commands/scope.js +192 -0
- package/dist/src/commands/scope.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +3 -0
- package/dist/src/commands/secrets.d.ts.map +1 -0
- package/dist/src/commands/secrets.js +99 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/secure.d.ts +3 -0
- package/dist/src/commands/secure.d.ts.map +1 -0
- package/dist/src/commands/secure.js +215 -0
- package/dist/src/commands/secure.js.map +1 -0
- package/dist/src/commands/server.d.ts +3 -0
- package/dist/src/commands/server.d.ts.map +1 -0
- package/dist/src/commands/server.js +228 -0
- package/dist/src/commands/server.js.map +1 -0
- package/dist/src/commands/shared.d.ts +18 -0
- package/dist/src/commands/shared.d.ts.map +1 -0
- package/dist/src/commands/shared.js +61 -0
- package/dist/src/commands/shared.js.map +1 -0
- package/dist/src/commands/simplify.d.ts +3 -0
- package/dist/src/commands/simplify.d.ts.map +1 -0
- package/dist/src/commands/simplify.js +194 -0
- package/dist/src/commands/simplify.js.map +1 -0
- package/dist/src/commands/simulate.d.ts +3 -0
- package/dist/src/commands/simulate.d.ts.map +1 -0
- package/dist/src/commands/simulate.js +275 -0
- package/dist/src/commands/simulate.js.map +1 -0
- package/dist/src/commands/slo.d.ts +3 -0
- package/dist/src/commands/slo.d.ts.map +1 -0
- package/dist/src/commands/slo.js +341 -0
- package/dist/src/commands/slo.js.map +1 -0
- package/dist/src/commands/spawn-capability.d.ts +3 -0
- package/dist/src/commands/spawn-capability.d.ts.map +1 -0
- package/dist/src/commands/spawn-capability.js +153 -0
- package/dist/src/commands/spawn-capability.js.map +1 -0
- package/dist/src/commands/specialize.d.ts +3 -0
- package/dist/src/commands/specialize.d.ts.map +1 -0
- package/dist/src/commands/specialize.js +266 -0
- package/dist/src/commands/specialize.js.map +1 -0
- package/dist/src/commands/spike.d.ts +3 -0
- package/dist/src/commands/spike.d.ts.map +1 -0
- package/dist/src/commands/spike.js +109 -0
- package/dist/src/commands/spike.js.map +1 -0
- package/dist/src/commands/standup.d.ts +3 -0
- package/dist/src/commands/standup.d.ts.map +1 -0
- package/dist/src/commands/standup.js +76 -0
- package/dist/src/commands/standup.js.map +1 -0
- package/dist/src/commands/stats.d.ts +39 -0
- package/dist/src/commands/stats.d.ts.map +1 -0
- package/dist/src/commands/stats.js +185 -0
- package/dist/src/commands/stats.js.map +1 -0
- package/dist/src/commands/status.d.ts +3 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +65 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/supply-chain.d.ts +3 -0
- package/dist/src/commands/supply-chain.d.ts.map +1 -0
- package/dist/src/commands/supply-chain.js +110 -0
- package/dist/src/commands/supply-chain.js.map +1 -0
- package/dist/src/commands/system.d.ts +3 -0
- package/dist/src/commands/system.d.ts.map +1 -0
- package/dist/src/commands/system.js +582 -0
- package/dist/src/commands/system.js.map +1 -0
- package/dist/src/commands/teach.d.ts +3 -0
- package/dist/src/commands/teach.d.ts.map +1 -0
- package/dist/src/commands/teach.js +420 -0
- package/dist/src/commands/teach.js.map +1 -0
- package/dist/src/commands/team.d.ts +44 -0
- package/dist/src/commands/team.d.ts.map +1 -0
- package/dist/src/commands/team.js +355 -0
- package/dist/src/commands/team.js.map +1 -0
- package/dist/src/commands/telemetry.d.ts +3 -0
- package/dist/src/commands/telemetry.d.ts.map +1 -0
- package/dist/src/commands/telemetry.js +87 -0
- package/dist/src/commands/telemetry.js.map +1 -0
- package/dist/src/commands/test-gen.d.ts +3 -0
- package/dist/src/commands/test-gen.d.ts.map +1 -0
- package/dist/src/commands/test-gen.js +541 -0
- package/dist/src/commands/test-gen.js.map +1 -0
- package/dist/src/commands/test.d.ts +3 -0
- package/dist/src/commands/test.d.ts.map +1 -0
- package/dist/src/commands/test.js +84 -0
- package/dist/src/commands/test.js.map +1 -0
- package/dist/src/commands/watch.d.ts +11 -0
- package/dist/src/commands/watch.d.ts.map +1 -0
- package/dist/src/commands/watch.js +317 -0
- package/dist/src/commands/watch.js.map +1 -0
- package/dist/src/core/activity-tracker.d.ts +70 -0
- package/dist/src/core/activity-tracker.d.ts.map +1 -0
- package/dist/src/core/activity-tracker.js +294 -0
- package/dist/src/core/activity-tracker.js.map +1 -0
- package/dist/src/core/agent-bus.d.ts +38 -0
- package/dist/src/core/agent-bus.d.ts.map +1 -0
- package/dist/src/core/agent-bus.js +128 -0
- package/dist/src/core/agent-bus.js.map +1 -0
- package/dist/src/core/agent-loop.d.ts +79 -0
- package/dist/src/core/agent-loop.d.ts.map +1 -0
- package/dist/src/core/agent-loop.js +225 -0
- package/dist/src/core/agent-loop.js.map +1 -0
- package/dist/src/core/agent-manager.d.ts +90 -0
- package/dist/src/core/agent-manager.d.ts.map +1 -0
- package/dist/src/core/agent-manager.js +549 -0
- package/dist/src/core/agent-manager.js.map +1 -0
- package/dist/src/core/agent-process.d.ts +95 -0
- package/dist/src/core/agent-process.d.ts.map +1 -0
- package/dist/src/core/agent-process.js +428 -0
- package/dist/src/core/agent-process.js.map +1 -0
- package/dist/src/core/ambiguity-detector.d.ts +31 -0
- package/dist/src/core/ambiguity-detector.d.ts.map +1 -0
- package/dist/src/core/ambiguity-detector.js +286 -0
- package/dist/src/core/ambiguity-detector.js.map +1 -0
- package/dist/src/core/anomaly-detector.d.ts +30 -0
- package/dist/src/core/anomaly-detector.d.ts.map +1 -0
- package/dist/src/core/anomaly-detector.js +300 -0
- package/dist/src/core/anomaly-detector.js.map +1 -0
- package/dist/src/core/api-lifecycle.d.ts +11 -0
- package/dist/src/core/api-lifecycle.d.ts.map +1 -0
- package/dist/src/core/api-lifecycle.js +178 -0
- package/dist/src/core/api-lifecycle.js.map +1 -0
- package/dist/src/core/audit.d.ts +36 -0
- package/dist/src/core/audit.d.ts.map +1 -0
- package/dist/src/core/audit.js +88 -0
- package/dist/src/core/audit.js.map +1 -0
- package/dist/src/core/capability-spawner.d.ts +17 -0
- package/dist/src/core/capability-spawner.d.ts.map +1 -0
- package/dist/src/core/capability-spawner.js +170 -0
- package/dist/src/core/capability-spawner.js.map +1 -0
- package/dist/src/core/codebase-index.d.ts +53 -0
- package/dist/src/core/codebase-index.d.ts.map +1 -0
- package/dist/src/core/codebase-index.js +540 -0
- package/dist/src/core/codebase-index.js.map +1 -0
- package/dist/src/core/codebase-scanner.d.ts +3 -0
- package/dist/src/core/codebase-scanner.d.ts.map +1 -0
- package/dist/src/core/codebase-scanner.js +179 -0
- package/dist/src/core/codebase-scanner.js.map +1 -0
- package/dist/src/core/competitive-intel.d.ts +18 -0
- package/dist/src/core/competitive-intel.d.ts.map +1 -0
- package/dist/src/core/competitive-intel.js +167 -0
- package/dist/src/core/competitive-intel.js.map +1 -0
- package/dist/src/core/config.d.ts +14 -0
- package/dist/src/core/config.d.ts.map +1 -0
- package/dist/src/core/config.js +116 -0
- package/dist/src/core/config.js.map +1 -0
- package/dist/src/core/convention-extractor.d.ts +8 -0
- package/dist/src/core/convention-extractor.d.ts.map +1 -0
- package/dist/src/core/convention-extractor.js +382 -0
- package/dist/src/core/convention-extractor.js.map +1 -0
- package/dist/src/core/cost-tracker.d.ts +23 -0
- package/dist/src/core/cost-tracker.d.ts.map +1 -0
- package/dist/src/core/cost-tracker.js +83 -0
- package/dist/src/core/cost-tracker.js.map +1 -0
- package/dist/src/core/decision-journal.d.ts +41 -0
- package/dist/src/core/decision-journal.d.ts.map +1 -0
- package/dist/src/core/decision-journal.js +204 -0
- package/dist/src/core/decision-journal.js.map +1 -0
- package/dist/src/core/experiment-engine.d.ts +31 -0
- package/dist/src/core/experiment-engine.d.ts.map +1 -0
- package/dist/src/core/experiment-engine.js +248 -0
- package/dist/src/core/experiment-engine.js.map +1 -0
- package/dist/src/core/federation.d.ts +18 -0
- package/dist/src/core/federation.d.ts.map +1 -0
- package/dist/src/core/federation.js +202 -0
- package/dist/src/core/federation.js.map +1 -0
- package/dist/src/core/fingerprint.d.ts +42 -0
- package/dist/src/core/fingerprint.d.ts.map +1 -0
- package/dist/src/core/fingerprint.js +316 -0
- package/dist/src/core/fingerprint.js.map +1 -0
- package/dist/src/core/git.d.ts +50 -0
- package/dist/src/core/git.d.ts.map +1 -0
- package/dist/src/core/git.js +342 -0
- package/dist/src/core/git.js.map +1 -0
- package/dist/src/core/governance.d.ts +53 -0
- package/dist/src/core/governance.d.ts.map +1 -0
- package/dist/src/core/governance.js +276 -0
- package/dist/src/core/governance.js.map +1 -0
- package/dist/src/core/guardrails.d.ts +34 -0
- package/dist/src/core/guardrails.d.ts.map +1 -0
- package/dist/src/core/guardrails.js +575 -0
- package/dist/src/core/guardrails.js.map +1 -0
- package/dist/src/core/impact-analyzer.d.ts +56 -0
- package/dist/src/core/impact-analyzer.d.ts.map +1 -0
- package/dist/src/core/impact-analyzer.js +309 -0
- package/dist/src/core/impact-analyzer.js.map +1 -0
- package/dist/src/core/input-listener.d.ts +45 -0
- package/dist/src/core/input-listener.d.ts.map +1 -0
- package/dist/src/core/input-listener.js +116 -0
- package/dist/src/core/input-listener.js.map +1 -0
- package/dist/src/core/memory-store.d.ts +61 -0
- package/dist/src/core/memory-store.d.ts.map +1 -0
- package/dist/src/core/memory-store.js +195 -0
- package/dist/src/core/memory-store.js.map +1 -0
- package/dist/src/core/observability.d.ts +56 -0
- package/dist/src/core/observability.d.ts.map +1 -0
- package/dist/src/core/observability.js +305 -0
- package/dist/src/core/observability.js.map +1 -0
- package/dist/src/core/pair-engine.d.ts +47 -0
- package/dist/src/core/pair-engine.d.ts.map +1 -0
- package/dist/src/core/pair-engine.js +355 -0
- package/dist/src/core/pair-engine.js.map +1 -0
- package/dist/src/core/perf-analyzer.d.ts +35 -0
- package/dist/src/core/perf-analyzer.d.ts.map +1 -0
- package/dist/src/core/perf-analyzer.js +598 -0
- package/dist/src/core/perf-analyzer.js.map +1 -0
- package/dist/src/core/pipeline-loader.d.ts +46 -0
- package/dist/src/core/pipeline-loader.d.ts.map +1 -0
- package/dist/src/core/pipeline-loader.js +182 -0
- package/dist/src/core/pipeline-loader.js.map +1 -0
- package/dist/src/core/pipeline.d.ts +183 -0
- package/dist/src/core/pipeline.d.ts.map +1 -0
- package/dist/src/core/pipeline.js +2264 -0
- package/dist/src/core/pipeline.js.map +1 -0
- package/dist/src/core/plugins.d.ts +61 -0
- package/dist/src/core/plugins.d.ts.map +1 -0
- package/dist/src/core/plugins.js +114 -0
- package/dist/src/core/plugins.js.map +1 -0
- package/dist/src/core/preflight.d.ts +7 -0
- package/dist/src/core/preflight.d.ts.map +1 -0
- package/dist/src/core/preflight.js +35 -0
- package/dist/src/core/preflight.js.map +1 -0
- package/dist/src/core/prompt-guard.d.ts +44 -0
- package/dist/src/core/prompt-guard.d.ts.map +1 -0
- package/dist/src/core/prompt-guard.js +274 -0
- package/dist/src/core/prompt-guard.js.map +1 -0
- package/dist/src/core/provenance.d.ts +39 -0
- package/dist/src/core/provenance.d.ts.map +1 -0
- package/dist/src/core/provenance.js +115 -0
- package/dist/src/core/provenance.js.map +1 -0
- package/dist/src/core/providers/anthropic-api.d.ts +34 -0
- package/dist/src/core/providers/anthropic-api.d.ts.map +1 -0
- package/dist/src/core/providers/anthropic-api.js +522 -0
- package/dist/src/core/providers/anthropic-api.js.map +1 -0
- package/dist/src/core/providers/api-agent-backend.d.ts +31 -0
- package/dist/src/core/providers/api-agent-backend.d.ts.map +1 -0
- package/dist/src/core/providers/api-agent-backend.js +127 -0
- package/dist/src/core/providers/api-agent-backend.js.map +1 -0
- package/dist/src/core/providers/api-text-backend.d.ts +35 -0
- package/dist/src/core/providers/api-text-backend.d.ts.map +1 -0
- package/dist/src/core/providers/api-text-backend.js +145 -0
- package/dist/src/core/providers/api-text-backend.js.map +1 -0
- package/dist/src/core/providers/claude-cli.d.ts +80 -0
- package/dist/src/core/providers/claude-cli.d.ts.map +1 -0
- package/dist/src/core/providers/claude-cli.js +489 -0
- package/dist/src/core/providers/claude-cli.js.map +1 -0
- package/dist/src/core/providers/cost-table.d.ts +46 -0
- package/dist/src/core/providers/cost-table.d.ts.map +1 -0
- package/dist/src/core/providers/cost-table.js +136 -0
- package/dist/src/core/providers/cost-table.js.map +1 -0
- package/dist/src/core/providers/google.d.ts +26 -0
- package/dist/src/core/providers/google.d.ts.map +1 -0
- package/dist/src/core/providers/google.js +165 -0
- package/dist/src/core/providers/google.js.map +1 -0
- package/dist/src/core/providers/model-catalog.d.ts +72 -0
- package/dist/src/core/providers/model-catalog.d.ts.map +1 -0
- package/dist/src/core/providers/model-catalog.js +290 -0
- package/dist/src/core/providers/model-catalog.js.map +1 -0
- package/dist/src/core/providers/openai-compat.d.ts +35 -0
- package/dist/src/core/providers/openai-compat.d.ts.map +1 -0
- package/dist/src/core/providers/openai-compat.js +479 -0
- package/dist/src/core/providers/openai-compat.js.map +1 -0
- package/dist/src/core/providers/prompt-adapter.d.ts +42 -0
- package/dist/src/core/providers/prompt-adapter.d.ts.map +1 -0
- package/dist/src/core/providers/prompt-adapter.js +282 -0
- package/dist/src/core/providers/prompt-adapter.js.map +1 -0
- package/dist/src/core/providers/registry.d.ts +93 -0
- package/dist/src/core/providers/registry.d.ts.map +1 -0
- package/dist/src/core/providers/registry.js +191 -0
- package/dist/src/core/providers/registry.js.map +1 -0
- package/dist/src/core/providers/types.d.ts +165 -0
- package/dist/src/core/providers/types.d.ts.map +1 -0
- package/dist/src/core/providers/types.js +13 -0
- package/dist/src/core/providers/types.js.map +1 -0
- package/dist/src/core/quality.d.ts +22 -0
- package/dist/src/core/quality.d.ts.map +1 -0
- package/dist/src/core/quality.js +209 -0
- package/dist/src/core/quality.js.map +1 -0
- package/dist/src/core/resource-allocator.d.ts +37 -0
- package/dist/src/core/resource-allocator.d.ts.map +1 -0
- package/dist/src/core/resource-allocator.js +480 -0
- package/dist/src/core/resource-allocator.js.map +1 -0
- package/dist/src/core/risk-scorer.d.ts +35 -0
- package/dist/src/core/risk-scorer.d.ts.map +1 -0
- package/dist/src/core/risk-scorer.js +226 -0
- package/dist/src/core/risk-scorer.js.map +1 -0
- package/dist/src/core/runtime-monitor.d.ts +49 -0
- package/dist/src/core/runtime-monitor.d.ts.map +1 -0
- package/dist/src/core/runtime-monitor.js +235 -0
- package/dist/src/core/runtime-monitor.js.map +1 -0
- package/dist/src/core/sandbox.d.ts +47 -0
- package/dist/src/core/sandbox.d.ts.map +1 -0
- package/dist/src/core/sandbox.js +277 -0
- package/dist/src/core/sandbox.js.map +1 -0
- package/dist/src/core/secret-detector.d.ts +25 -0
- package/dist/src/core/secret-detector.d.ts.map +1 -0
- package/dist/src/core/secret-detector.js +307 -0
- package/dist/src/core/secret-detector.js.map +1 -0
- package/dist/src/core/security-scanner.d.ts +36 -0
- package/dist/src/core/security-scanner.d.ts.map +1 -0
- package/dist/src/core/security-scanner.js +366 -0
- package/dist/src/core/security-scanner.js.map +1 -0
- package/dist/src/core/self-improvement.d.ts +26 -0
- package/dist/src/core/self-improvement.d.ts.map +1 -0
- package/dist/src/core/self-improvement.js +356 -0
- package/dist/src/core/self-improvement.js.map +1 -0
- package/dist/src/core/simulator.d.ts +28 -0
- package/dist/src/core/simulator.d.ts.map +1 -0
- package/dist/src/core/simulator.js +334 -0
- package/dist/src/core/simulator.js.map +1 -0
- package/dist/src/core/specialization.d.ts +47 -0
- package/dist/src/core/specialization.d.ts.map +1 -0
- package/dist/src/core/specialization.js +239 -0
- package/dist/src/core/specialization.js.map +1 -0
- package/dist/src/core/stakeholder-engine.d.ts +47 -0
- package/dist/src/core/stakeholder-engine.d.ts.map +1 -0
- package/dist/src/core/stakeholder-engine.js +380 -0
- package/dist/src/core/stakeholder-engine.js.map +1 -0
- package/dist/src/core/state.d.ts +99 -0
- package/dist/src/core/state.d.ts.map +1 -0
- package/dist/src/core/state.js +545 -0
- package/dist/src/core/state.js.map +1 -0
- package/dist/src/core/supply-chain.d.ts +26 -0
- package/dist/src/core/supply-chain.d.ts.map +1 -0
- package/dist/src/core/supply-chain.js +332 -0
- package/dist/src/core/supply-chain.js.map +1 -0
- package/dist/src/core/telemetry.d.ts +110 -0
- package/dist/src/core/telemetry.d.ts.map +1 -0
- package/dist/src/core/telemetry.js +276 -0
- package/dist/src/core/telemetry.js.map +1 -0
- package/dist/src/core/tools/definitions.d.ts +10 -0
- package/dist/src/core/tools/definitions.d.ts.map +1 -0
- package/dist/src/core/tools/definitions.js +165 -0
- package/dist/src/core/tools/definitions.js.map +1 -0
- package/dist/src/core/tools/executor.d.ts +27 -0
- package/dist/src/core/tools/executor.d.ts.map +1 -0
- package/dist/src/core/tools/executor.js +306 -0
- package/dist/src/core/tools/executor.js.map +1 -0
- package/dist/src/core/tools/sandbox.d.ts +41 -0
- package/dist/src/core/tools/sandbox.d.ts.map +1 -0
- package/dist/src/core/tools/sandbox.js +106 -0
- package/dist/src/core/tools/sandbox.js.map +1 -0
- package/dist/src/core/training-pipeline.d.ts +66 -0
- package/dist/src/core/training-pipeline.d.ts.map +1 -0
- package/dist/src/core/training-pipeline.js +267 -0
- package/dist/src/core/training-pipeline.js.map +1 -0
- package/dist/src/core/triage.d.ts +56 -0
- package/dist/src/core/triage.d.ts.map +1 -0
- package/dist/src/core/triage.js +227 -0
- package/dist/src/core/triage.js.map +1 -0
- package/dist/src/core/user-intelligence.d.ts +29 -0
- package/dist/src/core/user-intelligence.d.ts.map +1 -0
- package/dist/src/core/user-intelligence.js +172 -0
- package/dist/src/core/user-intelligence.js.map +1 -0
- package/dist/src/core/webhooks.d.ts +32 -0
- package/dist/src/core/webhooks.d.ts.map +1 -0
- package/dist/src/core/webhooks.js +126 -0
- package/dist/src/core/webhooks.js.map +1 -0
- package/dist/src/core/ws-server.d.ts +43 -0
- package/dist/src/core/ws-server.d.ts.map +1 -0
- package/dist/src/core/ws-server.js +3278 -0
- package/dist/src/core/ws-server.js.map +1 -0
- package/dist/src/prompts/loader.d.ts +36 -0
- package/dist/src/prompts/loader.d.ts.map +1 -0
- package/dist/src/prompts/loader.js +156 -0
- package/dist/src/prompts/loader.js.map +1 -0
- package/dist/src/types.d.ts +2539 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +62 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { loadConfig, requireSwarmDir, autoDetectStack, autoInit } from '../core/config.js';
|
|
6
|
+
import { extractConventions, buildConventionPrompt } from '../core/convention-extractor.js';
|
|
7
|
+
export function registerLearn(program) {
|
|
8
|
+
program
|
|
9
|
+
.command('learn')
|
|
10
|
+
.description('Scan codebase and extract project conventions for all agents to follow')
|
|
11
|
+
.option('-s, --stack <stack>', 'Tech stack override')
|
|
12
|
+
.option('--refresh', 'Re-scan even if conventions file exists')
|
|
13
|
+
.option('--merge', 'Update existing conventions without overwriting manual edits')
|
|
14
|
+
.option('--show', 'Print conventions to stdout without saving')
|
|
15
|
+
.action(async (opts) => {
|
|
16
|
+
let swarmDir;
|
|
17
|
+
try {
|
|
18
|
+
swarmDir = requireSwarmDir();
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
const stack = opts.stack || autoDetectStack(cwd);
|
|
23
|
+
const projectName = cwd.split('/').pop() || 'my-project';
|
|
24
|
+
console.log(chalk.yellow(`No .swarm/ found — auto-initializing (stack: ${stack})...`));
|
|
25
|
+
swarmDir = autoInit(projectName, stack, cwd);
|
|
26
|
+
}
|
|
27
|
+
const config = loadConfig();
|
|
28
|
+
const cwd = process.cwd();
|
|
29
|
+
const conventionsPath = join(swarmDir, 'conventions.md');
|
|
30
|
+
// Check for existing conventions
|
|
31
|
+
if (existsSync(conventionsPath) && !opts.refresh && !opts.merge && !opts.show) {
|
|
32
|
+
console.log(chalk.yellow(`Conventions already exist at ${conventionsPath}`));
|
|
33
|
+
console.log(chalk.dim('Use --refresh to re-scan, --merge to update, or --show to view'));
|
|
34
|
+
console.log('');
|
|
35
|
+
const existing = readFileSync(conventionsPath, 'utf-8');
|
|
36
|
+
console.log(existing);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const spinner = ora('Scanning codebase for conventions...').start();
|
|
40
|
+
try {
|
|
41
|
+
const conventions = extractConventions(cwd);
|
|
42
|
+
if (!conventions.trim()) {
|
|
43
|
+
spinner.warn('No conventions detected. Your project may be too small or use unfamiliar patterns.');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const conventionDoc = buildConventionPrompt(conventions);
|
|
47
|
+
if (opts.show) {
|
|
48
|
+
spinner.stop();
|
|
49
|
+
console.log(conventionDoc);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (opts.merge && existsSync(conventionsPath)) {
|
|
53
|
+
// Merge: append new conventions after a separator, preserving manual edits
|
|
54
|
+
const existing = readFileSync(conventionsPath, 'utf-8');
|
|
55
|
+
const merged = [
|
|
56
|
+
existing.trimEnd(),
|
|
57
|
+
'',
|
|
58
|
+
'---',
|
|
59
|
+
'',
|
|
60
|
+
'<!-- Auto-updated by hivemind learn --merge -->',
|
|
61
|
+
conventions,
|
|
62
|
+
].join('\n');
|
|
63
|
+
writeFileSync(conventionsPath, merged, 'utf-8');
|
|
64
|
+
spinner.succeed(`Conventions merged into ${conventionsPath}`);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Full write
|
|
68
|
+
const header = [
|
|
69
|
+
'# Project Conventions',
|
|
70
|
+
'',
|
|
71
|
+
`<!-- Generated by \`hivemind learn\` on ${new Date().toISOString().split('T')[0]} -->`,
|
|
72
|
+
'<!-- Edit freely — manual changes are preserved with --merge -->',
|
|
73
|
+
'',
|
|
74
|
+
].join('\n');
|
|
75
|
+
writeFileSync(conventionsPath, header + conventions + '\n', 'utf-8');
|
|
76
|
+
spinner.succeed(`Conventions saved to ${conventionsPath}`);
|
|
77
|
+
}
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log(chalk.dim('Conventions will be injected into all pipeline agents automatically.'));
|
|
80
|
+
console.log(chalk.dim('Edit .swarm/conventions.md to customize. Re-run with --refresh to re-scan.'));
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
spinner.fail(`Failed to extract conventions: ${err instanceof Error ? err.message : String(err)}`);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Load conventions from .swarm/conventions.md if it exists.
|
|
90
|
+
* Returns the convention text ready for injection into agent system prompts,
|
|
91
|
+
* or empty string if no conventions file.
|
|
92
|
+
*/
|
|
93
|
+
export function loadConventions(swarmDir) {
|
|
94
|
+
const conventionsPath = join(swarmDir, 'conventions.md');
|
|
95
|
+
if (!existsSync(conventionsPath))
|
|
96
|
+
return '';
|
|
97
|
+
try {
|
|
98
|
+
const raw = readFileSync(conventionsPath, 'utf-8');
|
|
99
|
+
if (!raw.trim())
|
|
100
|
+
return '';
|
|
101
|
+
return buildConventionPrompt(raw);
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=learn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learn.js","sourceRoot":"","sources":["../../../src/commands/learn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAa,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAE5F,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,wEAAwE,CAAC;SACrF,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;SACpD,MAAM,CAAC,WAAW,EAAE,yCAAyC,CAAC;SAC9D,MAAM,CAAC,SAAS,EAAE,8DAA8D,CAAC;SACjF,MAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,QAAgB,CAA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,EAAE,OAAO,GAAG,IAAI,CAoIrD"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
2
|
+
import { createInterface } from 'node:readline';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { loadConfig, requireSwarmDir, autoDetectStack, autoInit } from '../core/config.js';
|
|
5
|
+
import { createContext } from './shared.js';
|
|
6
|
+
import { Pipeline } from '../core/pipeline.js';
|
|
7
|
+
async function confirmCost(model, stageCount) {
|
|
8
|
+
const est = Pipeline.estimateCost(stageCount, model);
|
|
9
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
rl.question(chalk.yellow(`Estimated cost: ~$${est.low.toFixed(2)}-$${est.high.toFixed(2)}. Proceed? [Y/n] `), (answer) => {
|
|
12
|
+
rl.close();
|
|
13
|
+
resolve(answer.trim().toLowerCase() !== 'n');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export function registerMayday(program) {
|
|
18
|
+
program
|
|
19
|
+
.command('mayday')
|
|
20
|
+
.description('Autonomous end-to-end pipeline: analyze → build → test → fix loop until all tests pass')
|
|
21
|
+
.argument('[feature-request]', 'Feature request description (text or file path)')
|
|
22
|
+
.option('-s, --stack <stack>', 'Tech stack override (react, node, go)')
|
|
23
|
+
.option('-m, --model <model>', 'Model override (e.g., sonnet, openai/gpt-4o, ollama/llama3)')
|
|
24
|
+
.option('-p, --parallel <n>', 'Max parallel agents', '3')
|
|
25
|
+
.option('-n, --max-iterations <n>', 'Max fix-retest iterations', '5')
|
|
26
|
+
.option('--figma <url>', 'Figma design URL')
|
|
27
|
+
.option('-b, --budget <amount>', 'Max total budget in USD (default: from config, "none" for no limit)')
|
|
28
|
+
.option('--fix-budget <amount>', 'Max USD to spend on fix iterations (default: 15, "none" for no limit)', '15')
|
|
29
|
+
.option('-f, --file', 'Treat argument as a file path to read')
|
|
30
|
+
.option('--resume', 'Resume a previously interrupted MayDay session')
|
|
31
|
+
.option('-y, --yes', 'Skip cost confirmation prompt')
|
|
32
|
+
.option('--from <stage>', 'Skip stages before this one (analyze, architect, plan, build, test)')
|
|
33
|
+
.option('--approve', 'Require approval between pipeline stages')
|
|
34
|
+
.option('--no-git', 'Skip git branch creation and auto-commits')
|
|
35
|
+
.option('--lean', 'Lean mode: use haiku for docs stages (analyst/architect/lead/tester), keep engineer on default model')
|
|
36
|
+
.option('--smart', 'Smart model selection: sonnet for docs, opus for engineer')
|
|
37
|
+
.option('--headless', 'Skip all interactive pauses (for CI/automation)')
|
|
38
|
+
.action(async (featureRequest, opts) => {
|
|
39
|
+
let swarmDir;
|
|
40
|
+
try {
|
|
41
|
+
swarmDir = requireSwarmDir();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Auto-init if .swarm/ doesn't exist
|
|
45
|
+
const cwd = process.cwd();
|
|
46
|
+
const stack = opts.stack || autoDetectStack(cwd);
|
|
47
|
+
const projectName = cwd.split('/').pop() || 'my-project';
|
|
48
|
+
console.log(chalk.yellow(`No .swarm/ found — auto-initializing (stack: ${stack})...`));
|
|
49
|
+
swarmDir = autoInit(projectName, stack, cwd);
|
|
50
|
+
console.log(chalk.green(`Initialized .swarm/ for "${projectName}"`));
|
|
51
|
+
}
|
|
52
|
+
const config = loadConfig();
|
|
53
|
+
if (opts.model)
|
|
54
|
+
config.model = opts.model;
|
|
55
|
+
if (opts.budget) {
|
|
56
|
+
config.maxBudgetUsd = opts.budget === 'none' ? null : (parseFloat(opts.budget) || null);
|
|
57
|
+
}
|
|
58
|
+
// Lean mode: haiku for docs stages, keep engineer on default model
|
|
59
|
+
// TODO: Use ModelCatalog.suggestForTier('lean') when available
|
|
60
|
+
if (opts.lean) {
|
|
61
|
+
const engineerModel = config.models?.engineer ?? config.model;
|
|
62
|
+
config.models = {
|
|
63
|
+
...config.models,
|
|
64
|
+
analyst: 'haiku',
|
|
65
|
+
architect: 'haiku',
|
|
66
|
+
lead: 'haiku',
|
|
67
|
+
tester: 'haiku',
|
|
68
|
+
engineer: engineerModel,
|
|
69
|
+
};
|
|
70
|
+
console.log(chalk.dim(`[lean] Using haiku for docs stages, ${engineerModel} for engineer`));
|
|
71
|
+
}
|
|
72
|
+
// Smart mode: sonnet for docs stages, opus for engineer (best quality/cost balance)
|
|
73
|
+
// TODO: Use ModelCatalog.suggestForTier('smart') when available
|
|
74
|
+
if (opts.smart && !opts.lean) {
|
|
75
|
+
config.models = {
|
|
76
|
+
...config.models,
|
|
77
|
+
analyst: 'sonnet',
|
|
78
|
+
architect: 'sonnet',
|
|
79
|
+
lead: 'sonnet',
|
|
80
|
+
tester: 'sonnet',
|
|
81
|
+
engineer: 'opus',
|
|
82
|
+
};
|
|
83
|
+
console.log(chalk.dim(`[smart] Using sonnet for docs stages, opus for engineer`));
|
|
84
|
+
}
|
|
85
|
+
const stack = opts.stack || config.stack;
|
|
86
|
+
const { pipeline, state, cleanup } = createContext(swarmDir, config);
|
|
87
|
+
pipeline.gitEnabled = opts.git !== false;
|
|
88
|
+
try {
|
|
89
|
+
// Resume mode
|
|
90
|
+
if (opts.resume) {
|
|
91
|
+
const mayday = state.getMayday();
|
|
92
|
+
if (!mayday?.active) {
|
|
93
|
+
console.error(chalk.red('No active MayDay session to resume.'));
|
|
94
|
+
console.error(chalk.dim(`Start a new one: ${chalk.bold('hivemind mayday "your feature request"')}`));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
await pipeline.resumeMayday({ parallel: parseInt(opts.parallel, 10) });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// New run requires a feature request
|
|
101
|
+
if (!featureRequest) {
|
|
102
|
+
console.error(chalk.red('Feature request required. Usage: hivemind mayday "build a login page"'));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
let prompt = featureRequest;
|
|
106
|
+
if (opts.file) {
|
|
107
|
+
if (!existsSync(featureRequest)) {
|
|
108
|
+
console.error(chalk.red(`File not found: ${featureRequest}`));
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
prompt = readFileSync(featureRequest, 'utf-8');
|
|
112
|
+
}
|
|
113
|
+
const fixBudget = opts.fixBudget === 'none' ? null : (parseFloat(opts.fixBudget) || 15);
|
|
114
|
+
// Cost confirmation (MayDay = 5 stages + fix iterations, estimate 6x)
|
|
115
|
+
// Lean mode uses haiku for 4 stages + engineer model for 2 stages
|
|
116
|
+
if (!opts.yes) {
|
|
117
|
+
const confirmed = opts.lean
|
|
118
|
+
? await confirmCost('haiku', 4).then(ok => ok ? confirmCost(config.model, 2) : false)
|
|
119
|
+
: await confirmCost(config.model, 6);
|
|
120
|
+
if (!confirmed) {
|
|
121
|
+
console.log(chalk.dim('Aborted.'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
await pipeline.runMayday(prompt, {
|
|
126
|
+
stack,
|
|
127
|
+
maxIterations: parseInt(opts.maxIterations, 10),
|
|
128
|
+
figmaUrl: opts.figma,
|
|
129
|
+
parallel: parseInt(opts.parallel, 10),
|
|
130
|
+
maxFixBudgetUsd: fixBudget,
|
|
131
|
+
fromStage: opts.from,
|
|
132
|
+
approvalRequired: opts.approve ?? false,
|
|
133
|
+
headless: opts.headless ?? false,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error(chalk.red(err instanceof Error ? err.message : String(err)));
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
finally {
|
|
141
|
+
cleanup();
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=mayday.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mayday.js","sourceRoot":"","sources":["../../../src/commands/mayday.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC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ACrC,eAAe,EAAE,SAAS;gBAC1B,SAAS,EAAE,IAAI,CAAC,IAA6B;gBAC7C,gBAAgB,EAAE,IAAI,CAAC,OAAO,IAAI,KAAK;gBACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;aACjC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/commands/memory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2GrD"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { requireSwarmDir, autoDetectStack, autoInit } from '../core/config.js';
|
|
3
|
+
import { MemoryStore } from '../core/memory-store.js';
|
|
4
|
+
export function registerMemory(program) {
|
|
5
|
+
const mem = program
|
|
6
|
+
.command('memory')
|
|
7
|
+
.description('Manage cross-run pipeline memory — what worked, what failed, patterns learned');
|
|
8
|
+
mem
|
|
9
|
+
.command('list')
|
|
10
|
+
.description('List all active memories')
|
|
11
|
+
.option('-k, --kind <kind>', 'Filter by kind (fix-pattern, flaky-test, approach, performance, manual, success)')
|
|
12
|
+
.option('-t, --tag <tag>', 'Filter by tag')
|
|
13
|
+
.action((opts) => {
|
|
14
|
+
const swarmDir = getSwarmDir();
|
|
15
|
+
const store = new MemoryStore(swarmDir);
|
|
16
|
+
let entries = store.list();
|
|
17
|
+
if (opts.kind) {
|
|
18
|
+
entries = entries.filter(e => e.kind === opts.kind);
|
|
19
|
+
}
|
|
20
|
+
if (opts.tag) {
|
|
21
|
+
entries = entries.filter(e => e.tags.includes(opts.tag) || e.content.toLowerCase().includes(opts.tag.toLowerCase()));
|
|
22
|
+
}
|
|
23
|
+
if (entries.length === 0) {
|
|
24
|
+
console.log(chalk.dim('No memories stored. Memories are recorded automatically after pipeline runs.'));
|
|
25
|
+
console.log(chalk.dim('Add one manually: swarm memory add "note about your project"'));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log(chalk.bold(`\nStored memories (${entries.length}):\n`));
|
|
29
|
+
for (const entry of entries) {
|
|
30
|
+
const kindColor = {
|
|
31
|
+
'fix-pattern': chalk.yellow,
|
|
32
|
+
'flaky-test': chalk.red,
|
|
33
|
+
'approach': chalk.blue,
|
|
34
|
+
'performance': chalk.magenta,
|
|
35
|
+
'manual': chalk.green,
|
|
36
|
+
'success': chalk.cyan,
|
|
37
|
+
}[entry.kind] ?? chalk.white;
|
|
38
|
+
const confidence = entry.confidence >= 80 ? chalk.green('HIGH') :
|
|
39
|
+
entry.confidence >= 50 ? chalk.yellow('MED') : chalk.red('LOW');
|
|
40
|
+
console.log(` ${kindColor(`[${entry.kind}]`)} ${confidence} — ${entry.content}`);
|
|
41
|
+
console.log(chalk.dim(` ID: ${entry.id} | Expires: ${entry.expiresAt.split('T')[0]} | Tags: ${entry.tags.join(', ') || 'none'}`));
|
|
42
|
+
console.log('');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
mem
|
|
46
|
+
.command('add')
|
|
47
|
+
.description('Manually add a memory note')
|
|
48
|
+
.argument('<note>', 'Memory content')
|
|
49
|
+
.option('-k, --kind <kind>', 'Memory kind', 'manual')
|
|
50
|
+
.option('-c, --confidence <n>', 'Confidence score 0-100', '80')
|
|
51
|
+
.option('-t, --tags <tags>', 'Comma-separated tags')
|
|
52
|
+
.action((note, opts) => {
|
|
53
|
+
const swarmDir = getSwarmDir();
|
|
54
|
+
const store = new MemoryStore(swarmDir);
|
|
55
|
+
const entry = store.add({
|
|
56
|
+
kind: (opts.kind || 'manual'),
|
|
57
|
+
content: note,
|
|
58
|
+
confidence: parseInt(opts.confidence) || 80,
|
|
59
|
+
source: 'manual',
|
|
60
|
+
tags: opts.tags ? opts.tags.split(',').map((t) => t.trim()) : [],
|
|
61
|
+
});
|
|
62
|
+
console.log(chalk.green(`Memory added: ${entry.id}`));
|
|
63
|
+
});
|
|
64
|
+
mem
|
|
65
|
+
.command('clear')
|
|
66
|
+
.description('Clear all stored memories')
|
|
67
|
+
.action(() => {
|
|
68
|
+
const swarmDir = getSwarmDir();
|
|
69
|
+
const store = new MemoryStore(swarmDir);
|
|
70
|
+
store.clear();
|
|
71
|
+
console.log(chalk.yellow('All memories cleared.'));
|
|
72
|
+
});
|
|
73
|
+
mem
|
|
74
|
+
.command('remove')
|
|
75
|
+
.description('Remove a specific memory by ID')
|
|
76
|
+
.argument('<id>', 'Memory ID')
|
|
77
|
+
.action((id) => {
|
|
78
|
+
const swarmDir = getSwarmDir();
|
|
79
|
+
const store = new MemoryStore(swarmDir);
|
|
80
|
+
if (store.remove(id)) {
|
|
81
|
+
console.log(chalk.green(`Memory ${id} removed.`));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
console.log(chalk.red(`Memory ${id} not found.`));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
mem
|
|
88
|
+
.command('show')
|
|
89
|
+
.description('Show memory context as it would be injected into agents')
|
|
90
|
+
.action(() => {
|
|
91
|
+
const swarmDir = getSwarmDir();
|
|
92
|
+
const store = new MemoryStore(swarmDir);
|
|
93
|
+
const context = store.buildMemoryContext();
|
|
94
|
+
if (!context) {
|
|
95
|
+
console.log(chalk.dim('No memories to show.'));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
console.log(context);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function getSwarmDir() {
|
|
102
|
+
try {
|
|
103
|
+
return requireSwarmDir();
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
const cwd = process.cwd();
|
|
107
|
+
const stack = autoDetectStack(cwd);
|
|
108
|
+
const projectName = cwd.split('/').pop() || 'my-project';
|
|
109
|
+
console.log(chalk.yellow(`No .swarm/ found — auto-initializing (stack: ${stack})...`));
|
|
110
|
+
return autoInit(projectName, stack, cwd);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/commands/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGtD,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+EAA+E,CAAC,CAAC;IAEhG,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,mBAAmB,EAAE,kFAAkF,CAAC;SAC/G,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC;SAC1C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;QACxC,IAAI,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;QAE3B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;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,CAAC;AAoCpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8CrD"}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { loadConfig, requireSwarmDir, autoDetectStack, autoInit } from '../core/config.js';
|
|
6
|
+
import { createContext } from './shared.js';
|
|
7
|
+
import { scanCodebase } from '../core/codebase-scanner.js';
|
|
8
|
+
import { loadConventions } from './learn.js';
|
|
9
|
+
const MENTOR_SYSTEM_PROMPT = [
|
|
10
|
+
'You are a senior engineering mentor. Your goal is to TEACH and EXPLAIN, not just answer.',
|
|
11
|
+
'',
|
|
12
|
+
'When answering questions:',
|
|
13
|
+
'- Explain the "why" behind things, not just the "what"',
|
|
14
|
+
'- Use analogies and examples from the actual codebase',
|
|
15
|
+
'- Point to specific files and line numbers',
|
|
16
|
+
'- Suggest follow-up topics the developer should explore',
|
|
17
|
+
'- If the question reveals a misunderstanding, gently correct it',
|
|
18
|
+
'',
|
|
19
|
+
'When reviewing code:',
|
|
20
|
+
'- Focus on learning opportunities, not just errors',
|
|
21
|
+
'- Explain the reasoning behind best practices',
|
|
22
|
+
'- Suggest concrete improvements with examples',
|
|
23
|
+
'- Highlight what the developer did well (positive reinforcement)',
|
|
24
|
+
'',
|
|
25
|
+
'When explaining code:',
|
|
26
|
+
'- Start with the big picture, then zoom in',
|
|
27
|
+
'- Trace the flow of data through the system',
|
|
28
|
+
'- Explain design decisions and trade-offs',
|
|
29
|
+
'- Suggest related areas to explore next',
|
|
30
|
+
'',
|
|
31
|
+
'Always read the actual source files before answering. Do NOT guess.',
|
|
32
|
+
].join('\n');
|
|
33
|
+
export function registerMentor(program) {
|
|
34
|
+
const mentorCmd = program
|
|
35
|
+
.command('mentor')
|
|
36
|
+
.description('AI mentor — ask questions, get educational code reviews, or deep-dive into areas')
|
|
37
|
+
.argument('[question...]', 'Ask a contextual question about the codebase')
|
|
38
|
+
.option('-s, --stack <stack>', 'Tech stack override')
|
|
39
|
+
.option('-m, --model <model>', 'Model override (e.g., sonnet, openai/gpt-4o, ollama/llama3)')
|
|
40
|
+
.option('-b, --budget <amount>', 'Max budget in USD', '3')
|
|
41
|
+
.option('-i, --interactive', 'Interactive mode — follow-up Q&A in terminal')
|
|
42
|
+
.action(async (questionParts, opts) => {
|
|
43
|
+
const question = questionParts.join(' ');
|
|
44
|
+
if (!question) {
|
|
45
|
+
console.log(chalk.yellow('Usage: hivemind mentor <question>'));
|
|
46
|
+
console.log(chalk.dim(' hivemind mentor "How does authentication work?"'));
|
|
47
|
+
console.log(chalk.dim(' hivemind mentor review'));
|
|
48
|
+
console.log(chalk.dim(' hivemind mentor explain src/core/pipeline.ts'));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
await runMentor(question, opts, 'question');
|
|
52
|
+
});
|
|
53
|
+
// Subcommand: review
|
|
54
|
+
mentorCmd
|
|
55
|
+
.command('review')
|
|
56
|
+
.description('Educational code review of staged or recent changes')
|
|
57
|
+
.option('-s, --stack <stack>', 'Tech stack override')
|
|
58
|
+
.option('-m, --model <model>', 'Model override (e.g., sonnet, openai/gpt-4o, ollama/llama3)')
|
|
59
|
+
.option('-b, --budget <amount>', 'Max budget in USD', '3')
|
|
60
|
+
.option('--file <path>', 'Review a specific file instead of staged changes')
|
|
61
|
+
.option('--commit <sha>', 'Review a specific commit')
|
|
62
|
+
.action(async (opts) => {
|
|
63
|
+
await runMentor('', opts, 'review');
|
|
64
|
+
});
|
|
65
|
+
// Subcommand: explain
|
|
66
|
+
mentorCmd
|
|
67
|
+
.command('explain <path>')
|
|
68
|
+
.description('Deep educational dive into a file or directory')
|
|
69
|
+
.option('-s, --stack <stack>', 'Tech stack override')
|
|
70
|
+
.option('-m, --model <model>', 'Model override (e.g., sonnet, openai/gpt-4o, ollama/llama3)')
|
|
71
|
+
.option('-b, --budget <amount>', 'Max budget in USD', '3')
|
|
72
|
+
.option('-i, --interactive', 'Interactive mode — follow-up Q&A in terminal')
|
|
73
|
+
.action(async (path, opts) => {
|
|
74
|
+
await runMentor(path, opts, 'explain');
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async function runMentor(input, opts, mode) {
|
|
78
|
+
let swarmDir;
|
|
79
|
+
try {
|
|
80
|
+
swarmDir = requireSwarmDir();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
const cwd = process.cwd();
|
|
84
|
+
const stack = opts.stack || autoDetectStack(cwd);
|
|
85
|
+
const projectName = cwd.split('/').pop() || 'my-project';
|
|
86
|
+
console.log(chalk.yellow(`No .swarm/ found — auto-initializing (stack: ${stack})...`));
|
|
87
|
+
swarmDir = autoInit(projectName, stack, cwd);
|
|
88
|
+
}
|
|
89
|
+
const config = loadConfig();
|
|
90
|
+
config.model = opts.model || config.model;
|
|
91
|
+
const budgetStr = opts.budget || '3';
|
|
92
|
+
config.maxBudgetUsd = budgetStr === 'none' ? null : (parseFloat(budgetStr) || 3);
|
|
93
|
+
const cwd = process.cwd();
|
|
94
|
+
const stack = opts.stack || config.stack;
|
|
95
|
+
const interactive = opts.interactive ?? false;
|
|
96
|
+
const { agentManager, cleanup } = createContext(swarmDir, config);
|
|
97
|
+
try {
|
|
98
|
+
const prompt = buildMentorPrompt(cwd, swarmDir, input, mode, stack, opts, config.packages);
|
|
99
|
+
const modeLabel = {
|
|
100
|
+
question: `Answering: ${input.slice(0, 80)}`,
|
|
101
|
+
review: opts.file ? `Reviewing: ${opts.file}` : 'Educational code review',
|
|
102
|
+
explain: `Deep dive: ${input}`,
|
|
103
|
+
}[mode];
|
|
104
|
+
console.log(chalk.bold('\nSwarm Mentor'));
|
|
105
|
+
console.log(chalk.dim(`${modeLabel}`));
|
|
106
|
+
console.log(chalk.dim(`Model: ${config.model} | Stack: ${stack}\n`));
|
|
107
|
+
if (interactive) {
|
|
108
|
+
const agent = await agentManager.spawn({
|
|
109
|
+
name: `mentor-${mode}`,
|
|
110
|
+
persona: 'engineer',
|
|
111
|
+
stack,
|
|
112
|
+
prompt,
|
|
113
|
+
model: config.model,
|
|
114
|
+
cwd,
|
|
115
|
+
interactive: true,
|
|
116
|
+
disallowedTools: ['Edit', 'Write', 'NotebookEdit', 'Bash'],
|
|
117
|
+
});
|
|
118
|
+
await agentManager.waitForAgent(agent.id);
|
|
119
|
+
saveMentorHistory(swarmDir, mode, input, agent.output);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const spinner = ora('Thinking...').start();
|
|
123
|
+
const agent = await agentManager.spawn({
|
|
124
|
+
name: `mentor-${mode}`,
|
|
125
|
+
persona: 'engineer',
|
|
126
|
+
stack,
|
|
127
|
+
prompt,
|
|
128
|
+
model: config.model,
|
|
129
|
+
cwd,
|
|
130
|
+
interactive: false,
|
|
131
|
+
permissionMode: 'auto',
|
|
132
|
+
disallowedTools: ['Edit', 'Write', 'NotebookEdit', 'Bash'],
|
|
133
|
+
});
|
|
134
|
+
await agentManager.waitForAgent(agent.id);
|
|
135
|
+
const cost = agent.cost.totalUsd;
|
|
136
|
+
if (agent.status === 'done') {
|
|
137
|
+
spinner.succeed(`Done. Cost: $${cost.toFixed(2)}`);
|
|
138
|
+
saveMentorHistory(swarmDir, mode, input, agent.output);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
spinner.fail(`Mentor failed: ${agent.error || 'Unknown error'}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
console.error(chalk.red(err instanceof Error ? err.message : String(err)));
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
cleanup();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function buildMentorPrompt(cwd, swarmDir, input, mode, stack, opts, packages) {
|
|
154
|
+
const parts = [];
|
|
155
|
+
// Codebase context
|
|
156
|
+
const codebaseCtx = scanCodebase(cwd, packages);
|
|
157
|
+
if (codebaseCtx)
|
|
158
|
+
parts.push(codebaseCtx);
|
|
159
|
+
// Conventions
|
|
160
|
+
const conventions = loadConventions(swarmDir);
|
|
161
|
+
if (conventions)
|
|
162
|
+
parts.push(conventions);
|
|
163
|
+
// Mentor system prompt
|
|
164
|
+
parts.push('', MENTOR_SYSTEM_PROMPT, '');
|
|
165
|
+
switch (mode) {
|
|
166
|
+
case 'question':
|
|
167
|
+
parts.push('TASK: Answer the following question about this codebase in a teaching/mentoring style.', '', `QUESTION: "${input}"`, '', 'Instructions:', '1. Read relevant source files to give an accurate answer', '2. Explain the "why" behind the answer, not just the "what"', '3. Point to specific files and code locations', '4. Suggest 2-3 follow-up topics the developer should explore', '5. If the question touches on a design decision, explain the trade-offs');
|
|
168
|
+
break;
|
|
169
|
+
case 'review': {
|
|
170
|
+
parts.push('TASK: Educational code review — teach through reviewing code.', '');
|
|
171
|
+
if (opts.file) {
|
|
172
|
+
parts.push(`Review the file: ${opts.file}`, '', 'Instructions:', '1. Read the file and understand its purpose in the project', '2. Review for: correctness, patterns, readability, performance, security', '3. For each finding, EXPLAIN why it matters (teach, don\'t just critique)', '4. Highlight good practices the developer used', '5. Suggest concrete improvements with code examples', '6. Rate overall quality and suggest priority improvements');
|
|
173
|
+
}
|
|
174
|
+
else if (opts.commit) {
|
|
175
|
+
parts.push(`Review the changes in commit: ${opts.commit}`, '', `Run: git show ${opts.commit}`, '', 'Instructions:', '1. Understand the intent of the commit', '2. Review changes for: correctness, patterns, edge cases', '3. Explain any concerns in a teaching style', '4. Highlight good decisions in the commit');
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
parts.push('Review the currently staged changes (git diff --staged) or recent uncommitted changes (git diff).', '', 'Run: git diff --staged (or git diff if nothing is staged)', '', 'Instructions:', '1. Understand what the changes are trying to accomplish', '2. Review for: correctness, consistency with project patterns, edge cases', '3. Teach about any patterns being broken or improved', '4. Highlight good practices in the changes', '5. Suggest improvements with explanations');
|
|
179
|
+
}
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
case 'explain':
|
|
183
|
+
parts.push(`TASK: Educational deep-dive into: ${input}`, '', 'Instructions:', '1. Read the file/directory and understand its role in the project', '2. Start with the big picture — what problem does this solve?', '3. Walk through the code structure, explaining each key part', '4. Trace the data flow through this module', '5. Explain design decisions and trade-offs', '6. Show how this connects to the rest of the codebase', '7. Point out patterns a new developer should learn from this code', '8. Suggest related areas to explore next', '', 'Think of this as a pairing session where you\'re walking a junior developer through the code.');
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
return parts.filter(Boolean).join('\n');
|
|
187
|
+
}
|
|
188
|
+
function saveMentorHistory(swarmDir, mode, input, output) {
|
|
189
|
+
try {
|
|
190
|
+
const progressPath = join(swarmDir, 'onboard-progress.json');
|
|
191
|
+
let progress;
|
|
192
|
+
if (existsSync(progressPath)) {
|
|
193
|
+
progress = JSON.parse(readFileSync(progressPath, 'utf-8'));
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
progress = {
|
|
197
|
+
step: 0,
|
|
198
|
+
totalSteps: 5,
|
|
199
|
+
currentTopic: '',
|
|
200
|
+
content: '',
|
|
201
|
+
completed: [],
|
|
202
|
+
remaining: [],
|
|
203
|
+
mentorHistory: [],
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
progress.mentorHistory.push({
|
|
207
|
+
question: `[${mode}] ${input}`,
|
|
208
|
+
answer: output.slice(0, 1000),
|
|
209
|
+
timestamp: Date.now(),
|
|
210
|
+
});
|
|
211
|
+
// Keep last 50 entries
|
|
212
|
+
if (progress.mentorHistory.length > 50) {
|
|
213
|
+
progress.mentorHistory = progress.mentorHistory.slice(-50);
|
|
214
|
+
}
|
|
215
|
+
const dir = join(progressPath, '..');
|
|
216
|
+
if (!existsSync(dir)) {
|
|
217
|
+
mkdirSync(dir, { recursive: true });
|
|
218
|
+
}
|
|
219
|
+
writeFileSync(progressPath, JSON.stringify(progress, null, 2), 'utf-8');
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
// Non-critical — don't fail the command
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=mentor.js.map
|