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,722 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { parse as parseYaml } from 'yaml';
|
|
5
|
+
import { execSync } from 'node:child_process';
|
|
6
|
+
import { requireSwarmDir, loadConfig } from '../core/config.js';
|
|
7
|
+
// ── Helpers ────────────────────────────────────────────────────────────────────
|
|
8
|
+
function statusColor(status) {
|
|
9
|
+
switch (status) {
|
|
10
|
+
case 'pass': return chalk.green;
|
|
11
|
+
case 'fail': return chalk.red;
|
|
12
|
+
case 'partial': return chalk.yellow;
|
|
13
|
+
case 'not-applicable': return chalk.dim;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function statusIcon(status) {
|
|
17
|
+
switch (status) {
|
|
18
|
+
case 'pass': return 'PASS';
|
|
19
|
+
case 'fail': return 'FAIL';
|
|
20
|
+
case 'partial': return 'PART';
|
|
21
|
+
case 'not-applicable': return 'N/A';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function calculateScore(checks) {
|
|
25
|
+
const applicable = checks.filter(c => c.status !== 'not-applicable');
|
|
26
|
+
if (applicable.length === 0)
|
|
27
|
+
return 0;
|
|
28
|
+
const score = applicable.reduce((sum, c) => {
|
|
29
|
+
if (c.status === 'pass')
|
|
30
|
+
return sum + 1;
|
|
31
|
+
if (c.status === 'partial')
|
|
32
|
+
return sum + 0.5;
|
|
33
|
+
return sum;
|
|
34
|
+
}, 0);
|
|
35
|
+
return Math.round((score / applicable.length) * 100);
|
|
36
|
+
}
|
|
37
|
+
function shellCheck(cmd) {
|
|
38
|
+
try {
|
|
39
|
+
execSync(cmd, { encoding: 'utf-8', timeout: 15000, stdio: 'pipe' });
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function shellOutput(cmd) {
|
|
47
|
+
try {
|
|
48
|
+
return execSync(cmd, { encoding: 'utf-8', timeout: 15000, stdio: 'pipe' }).trim();
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function fileContainsPattern(filePath, pattern) {
|
|
55
|
+
try {
|
|
56
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
57
|
+
return pattern.test(content);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function searchFilesForPattern(dir, pattern, extensions) {
|
|
64
|
+
const matches = [];
|
|
65
|
+
try {
|
|
66
|
+
const entries = readdirSync(dir, { withFileTypes: true, recursive: true });
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
if (!entry.isFile())
|
|
69
|
+
continue;
|
|
70
|
+
const ext = entry.name.split('.').pop() ?? '';
|
|
71
|
+
if (!extensions.includes(ext))
|
|
72
|
+
continue;
|
|
73
|
+
const fullPath = join(entry.parentPath ?? dir, entry.name);
|
|
74
|
+
if (fileContainsPattern(fullPath, pattern)) {
|
|
75
|
+
matches.push(fullPath);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// directory may not exist
|
|
81
|
+
}
|
|
82
|
+
return matches;
|
|
83
|
+
}
|
|
84
|
+
// ── Framework Check Runners ────────────────────────────────────────────────────
|
|
85
|
+
function runSoc2Checks(swarmDir, cwd) {
|
|
86
|
+
const checks = [];
|
|
87
|
+
// SOC2-001: Audit trail exists
|
|
88
|
+
const auditPath = join(swarmDir, 'audit.jsonl');
|
|
89
|
+
const auditExists = existsSync(auditPath);
|
|
90
|
+
let auditEntryCount = 0;
|
|
91
|
+
if (auditExists) {
|
|
92
|
+
try {
|
|
93
|
+
const content = readFileSync(auditPath, 'utf-8').trim();
|
|
94
|
+
auditEntryCount = content ? content.split('\n').length : 0;
|
|
95
|
+
}
|
|
96
|
+
catch { /* ignore */ }
|
|
97
|
+
}
|
|
98
|
+
checks.push({
|
|
99
|
+
id: 'SOC2-001',
|
|
100
|
+
requirement: 'Audit trail for all system activities',
|
|
101
|
+
category: 'Monitoring',
|
|
102
|
+
status: auditExists && auditEntryCount > 0 ? 'pass' : auditExists ? 'partial' : 'fail',
|
|
103
|
+
evidence: auditExists ? `${auditEntryCount} audit entries in ${auditPath}` : 'No audit log found',
|
|
104
|
+
remediation: auditExists ? undefined : 'Run pipeline operations to generate audit trail in .swarm/audit.jsonl',
|
|
105
|
+
});
|
|
106
|
+
// SOC2-002: Change management via git
|
|
107
|
+
const hasGit = existsSync(join(cwd, '.git'));
|
|
108
|
+
const commitCount = shellOutput('git rev-list --count HEAD 2>/dev/null');
|
|
109
|
+
checks.push({
|
|
110
|
+
id: 'SOC2-002',
|
|
111
|
+
requirement: 'Change management with version control',
|
|
112
|
+
category: 'Change Management',
|
|
113
|
+
status: hasGit && commitCount && parseInt(commitCount, 10) > 0 ? 'pass' : hasGit ? 'partial' : 'fail',
|
|
114
|
+
evidence: hasGit ? `Git repository with ${commitCount ?? '0'} commits` : 'No git repository found',
|
|
115
|
+
remediation: hasGit ? undefined : 'Initialize git repository: git init',
|
|
116
|
+
});
|
|
117
|
+
// SOC2-003: Access controls (permission modes)
|
|
118
|
+
const configPath = join(swarmDir, 'config.yaml');
|
|
119
|
+
let hasPermissionConfig = false;
|
|
120
|
+
if (existsSync(configPath)) {
|
|
121
|
+
hasPermissionConfig = fileContainsPattern(configPath, /permission/i);
|
|
122
|
+
}
|
|
123
|
+
const statePath = join(swarmDir, 'state.json');
|
|
124
|
+
let stateHasPerms = false;
|
|
125
|
+
if (existsSync(statePath)) {
|
|
126
|
+
stateHasPerms = fileContainsPattern(statePath, /permissionMode/);
|
|
127
|
+
}
|
|
128
|
+
checks.push({
|
|
129
|
+
id: 'SOC2-003',
|
|
130
|
+
requirement: 'Access controls and permission management',
|
|
131
|
+
category: 'Access Control',
|
|
132
|
+
status: hasPermissionConfig || stateHasPerms ? 'pass' : 'partial',
|
|
133
|
+
evidence: hasPermissionConfig ? 'Permission configuration found in config.yaml' :
|
|
134
|
+
stateHasPerms ? 'Permission modes tracked in state' : 'Default permission modes in use',
|
|
135
|
+
remediation: hasPermissionConfig ? undefined : 'Configure explicit permission modes in .swarm/config.yaml',
|
|
136
|
+
});
|
|
137
|
+
// SOC2-004: Backup and recovery
|
|
138
|
+
const backupPath = join(swarmDir, 'state.json.bak');
|
|
139
|
+
checks.push({
|
|
140
|
+
id: 'SOC2-004',
|
|
141
|
+
requirement: 'Backup and disaster recovery procedures',
|
|
142
|
+
category: 'Availability',
|
|
143
|
+
status: existsSync(backupPath) ? 'pass' : 'partial',
|
|
144
|
+
evidence: existsSync(backupPath) ? 'State backup file exists (state.json.bak)' : 'No state backup found',
|
|
145
|
+
remediation: 'State backups are created automatically during pipeline runs',
|
|
146
|
+
});
|
|
147
|
+
// SOC2-005: Incident response
|
|
148
|
+
const hasIncidentCmd = shellCheck('command -v swarm 2>/dev/null');
|
|
149
|
+
checks.push({
|
|
150
|
+
id: 'SOC2-005',
|
|
151
|
+
requirement: 'Incident response procedures',
|
|
152
|
+
category: 'Incident Response',
|
|
153
|
+
status: existsSync(auditPath) && hasIncidentCmd ? 'pass' : 'partial',
|
|
154
|
+
evidence: 'Swarm CLI provides mayday pipeline and audit trail for incident tracking',
|
|
155
|
+
remediation: 'Use `hivemind mayday` for automated incident response',
|
|
156
|
+
});
|
|
157
|
+
// SOC2-006: Monitoring and alerting
|
|
158
|
+
const hasWebhooks = existsSync(configPath) && fileContainsPattern(configPath, /webhook/i);
|
|
159
|
+
checks.push({
|
|
160
|
+
id: 'SOC2-006',
|
|
161
|
+
requirement: 'Continuous monitoring and alerting',
|
|
162
|
+
category: 'Monitoring',
|
|
163
|
+
status: hasWebhooks ? 'pass' : 'partial',
|
|
164
|
+
evidence: hasWebhooks ? 'Webhook notifications configured' : 'No webhook alerting configured',
|
|
165
|
+
remediation: 'Configure webhooks in .swarm/config.yaml for real-time alerts',
|
|
166
|
+
});
|
|
167
|
+
return checks;
|
|
168
|
+
}
|
|
169
|
+
function runHipaaChecks(swarmDir, cwd) {
|
|
170
|
+
const checks = [];
|
|
171
|
+
// HIPAA-001: Data encryption at rest
|
|
172
|
+
const encryptionFiles = searchFilesForPattern(cwd, /encrypt|cipher|aes|crypto/i, ['ts', 'js', 'py', 'go', 'rs']);
|
|
173
|
+
checks.push({
|
|
174
|
+
id: 'HIPAA-001',
|
|
175
|
+
requirement: 'Data encryption at rest',
|
|
176
|
+
category: 'Data Protection',
|
|
177
|
+
status: encryptionFiles.length > 0 ? 'pass' : 'fail',
|
|
178
|
+
evidence: encryptionFiles.length > 0
|
|
179
|
+
? `${encryptionFiles.length} file(s) reference encryption patterns`
|
|
180
|
+
: 'No encryption patterns found in codebase',
|
|
181
|
+
remediation: 'Implement data encryption at rest for sensitive data stores',
|
|
182
|
+
});
|
|
183
|
+
// HIPAA-002: Data encryption in transit
|
|
184
|
+
const tlsFiles = searchFilesForPattern(cwd, /https|tls|ssl|wss:/i, ['ts', 'js', 'py', 'go', 'rs', 'yaml', 'yml']);
|
|
185
|
+
checks.push({
|
|
186
|
+
id: 'HIPAA-002',
|
|
187
|
+
requirement: 'Data encryption in transit',
|
|
188
|
+
category: 'Data Protection',
|
|
189
|
+
status: tlsFiles.length > 0 ? 'pass' : 'partial',
|
|
190
|
+
evidence: tlsFiles.length > 0
|
|
191
|
+
? `${tlsFiles.length} file(s) reference TLS/HTTPS`
|
|
192
|
+
: 'No explicit TLS configuration found',
|
|
193
|
+
remediation: 'Ensure all network communication uses TLS/HTTPS',
|
|
194
|
+
});
|
|
195
|
+
// HIPAA-003: Audit logging
|
|
196
|
+
const auditPath = join(swarmDir, 'audit.jsonl');
|
|
197
|
+
checks.push({
|
|
198
|
+
id: 'HIPAA-003',
|
|
199
|
+
requirement: 'Comprehensive audit logging of data access',
|
|
200
|
+
category: 'Audit Controls',
|
|
201
|
+
status: existsSync(auditPath) ? 'pass' : 'fail',
|
|
202
|
+
evidence: existsSync(auditPath) ? 'Structured audit log at .swarm/audit.jsonl' : 'No audit logging found',
|
|
203
|
+
remediation: 'Enable audit logging via swarm pipeline operations',
|
|
204
|
+
});
|
|
205
|
+
// HIPAA-004: Access controls
|
|
206
|
+
const authFiles = searchFilesForPattern(cwd, /auth|rbac|acl|permission|role/i, ['ts', 'js', 'py', 'go']);
|
|
207
|
+
checks.push({
|
|
208
|
+
id: 'HIPAA-004',
|
|
209
|
+
requirement: 'Role-based access controls',
|
|
210
|
+
category: 'Access Control',
|
|
211
|
+
status: authFiles.length > 0 ? 'pass' : 'partial',
|
|
212
|
+
evidence: authFiles.length > 0
|
|
213
|
+
? `${authFiles.length} file(s) implement access control patterns`
|
|
214
|
+
: 'Basic permission modes via CLI only',
|
|
215
|
+
remediation: 'Implement role-based access controls for data handling',
|
|
216
|
+
});
|
|
217
|
+
// HIPAA-005: Data integrity controls
|
|
218
|
+
const checksumFiles = searchFilesForPattern(cwd, /checksum|hash|integrity|sha256|md5/i, ['ts', 'js', 'py', 'go', 'rs']);
|
|
219
|
+
checks.push({
|
|
220
|
+
id: 'HIPAA-005',
|
|
221
|
+
requirement: 'Data integrity verification',
|
|
222
|
+
category: 'Data Integrity',
|
|
223
|
+
status: checksumFiles.length > 0 ? 'pass' : 'partial',
|
|
224
|
+
evidence: checksumFiles.length > 0
|
|
225
|
+
? `${checksumFiles.length} file(s) implement integrity checks`
|
|
226
|
+
: 'No explicit integrity verification found',
|
|
227
|
+
remediation: 'Implement checksums or hashes for critical data stores',
|
|
228
|
+
});
|
|
229
|
+
// HIPAA-006: Breach notification procedures
|
|
230
|
+
const hasWebhooks = existsSync(join(swarmDir, 'config.yaml')) &&
|
|
231
|
+
fileContainsPattern(join(swarmDir, 'config.yaml'), /webhook/i);
|
|
232
|
+
checks.push({
|
|
233
|
+
id: 'HIPAA-006',
|
|
234
|
+
requirement: 'Breach notification capability',
|
|
235
|
+
category: 'Breach Notification',
|
|
236
|
+
status: hasWebhooks ? 'partial' : 'fail',
|
|
237
|
+
evidence: hasWebhooks ? 'Webhook notifications available for alerting' : 'No notification system configured',
|
|
238
|
+
remediation: 'Configure webhooks and establish breach notification procedures',
|
|
239
|
+
});
|
|
240
|
+
return checks;
|
|
241
|
+
}
|
|
242
|
+
function runGdprChecks(swarmDir, cwd) {
|
|
243
|
+
const checks = [];
|
|
244
|
+
// GDPR-001: Data handling documentation
|
|
245
|
+
const hasPrivacyDocs = searchFilesForPattern(cwd, /privacy|data.?protection|gdpr/i, ['md', 'txt', 'yaml', 'yml']);
|
|
246
|
+
checks.push({
|
|
247
|
+
id: 'GDPR-001',
|
|
248
|
+
requirement: 'Data processing documentation',
|
|
249
|
+
category: 'Documentation',
|
|
250
|
+
status: hasPrivacyDocs.length > 0 ? 'pass' : 'fail',
|
|
251
|
+
evidence: hasPrivacyDocs.length > 0
|
|
252
|
+
? `${hasPrivacyDocs.length} file(s) document data processing`
|
|
253
|
+
: 'No data processing documentation found',
|
|
254
|
+
remediation: 'Create data processing documentation (privacy policy, data inventory)',
|
|
255
|
+
});
|
|
256
|
+
// GDPR-002: Consent tracking
|
|
257
|
+
const consentFiles = searchFilesForPattern(cwd, /consent|opt.?in|opt.?out|preference/i, ['ts', 'js', 'py', 'go']);
|
|
258
|
+
checks.push({
|
|
259
|
+
id: 'GDPR-002',
|
|
260
|
+
requirement: 'Consent management and tracking',
|
|
261
|
+
category: 'Consent',
|
|
262
|
+
status: consentFiles.length > 0 ? 'pass' : 'fail',
|
|
263
|
+
evidence: consentFiles.length > 0
|
|
264
|
+
? `${consentFiles.length} file(s) implement consent patterns`
|
|
265
|
+
: 'No consent management found',
|
|
266
|
+
remediation: 'Implement consent tracking for data collection and processing',
|
|
267
|
+
});
|
|
268
|
+
// GDPR-003: Right to deletion
|
|
269
|
+
const deletionFiles = searchFilesForPattern(cwd, /delete|purge|erasure|forget|remove.?data/i, ['ts', 'js', 'py', 'go']);
|
|
270
|
+
checks.push({
|
|
271
|
+
id: 'GDPR-003',
|
|
272
|
+
requirement: 'Right to erasure (data deletion capabilities)',
|
|
273
|
+
category: 'Data Subject Rights',
|
|
274
|
+
status: deletionFiles.length > 0 ? 'pass' : 'partial',
|
|
275
|
+
evidence: deletionFiles.length > 0
|
|
276
|
+
? `${deletionFiles.length} file(s) implement deletion patterns`
|
|
277
|
+
: 'No explicit data deletion capabilities found',
|
|
278
|
+
remediation: 'Implement data deletion endpoints and procedures for GDPR compliance',
|
|
279
|
+
});
|
|
280
|
+
// GDPR-004: Data portability
|
|
281
|
+
const exportFiles = searchFilesForPattern(cwd, /export|download|portab/i, ['ts', 'js', 'py', 'go']);
|
|
282
|
+
checks.push({
|
|
283
|
+
id: 'GDPR-004',
|
|
284
|
+
requirement: 'Data portability (export capabilities)',
|
|
285
|
+
category: 'Data Subject Rights',
|
|
286
|
+
status: exportFiles.length > 0 ? 'pass' : 'partial',
|
|
287
|
+
evidence: exportFiles.length > 0
|
|
288
|
+
? `${exportFiles.length} file(s) implement data export`
|
|
289
|
+
: 'No data export capabilities found',
|
|
290
|
+
remediation: 'Implement data export in machine-readable format',
|
|
291
|
+
});
|
|
292
|
+
// GDPR-005: Data minimization
|
|
293
|
+
const configPath = join(swarmDir, 'config.yaml');
|
|
294
|
+
const hasRetention = existsSync(configPath) && fileContainsPattern(configPath, /retention|ttl|expir/i);
|
|
295
|
+
checks.push({
|
|
296
|
+
id: 'GDPR-005',
|
|
297
|
+
requirement: 'Data minimization and retention policies',
|
|
298
|
+
category: 'Data Minimization',
|
|
299
|
+
status: hasRetention ? 'pass' : 'partial',
|
|
300
|
+
evidence: hasRetention ? 'Data retention configuration found' : 'No explicit retention policies configured',
|
|
301
|
+
remediation: 'Configure data retention policies in .swarm/config.yaml',
|
|
302
|
+
});
|
|
303
|
+
// GDPR-006: Audit trail for data processing
|
|
304
|
+
const auditPath = join(swarmDir, 'audit.jsonl');
|
|
305
|
+
checks.push({
|
|
306
|
+
id: 'GDPR-006',
|
|
307
|
+
requirement: 'Processing activity audit trail',
|
|
308
|
+
category: 'Accountability',
|
|
309
|
+
status: existsSync(auditPath) ? 'pass' : 'fail',
|
|
310
|
+
evidence: existsSync(auditPath) ? 'Audit log tracks processing activities' : 'No audit trail',
|
|
311
|
+
remediation: 'Enable audit logging for data processing accountability',
|
|
312
|
+
});
|
|
313
|
+
return checks;
|
|
314
|
+
}
|
|
315
|
+
function runPciChecks(swarmDir, cwd) {
|
|
316
|
+
const checks = [];
|
|
317
|
+
// PCI-001: Secret management
|
|
318
|
+
const envFiles = ['.env', '.env.local', '.env.production'];
|
|
319
|
+
const exposedSecrets = envFiles.filter(f => existsSync(join(cwd, f)));
|
|
320
|
+
const gitignorePath = join(cwd, '.gitignore');
|
|
321
|
+
let secretsIgnored = false;
|
|
322
|
+
if (existsSync(gitignorePath)) {
|
|
323
|
+
const gitignore = readFileSync(gitignorePath, 'utf-8');
|
|
324
|
+
secretsIgnored = /\.env/i.test(gitignore);
|
|
325
|
+
}
|
|
326
|
+
checks.push({
|
|
327
|
+
id: 'PCI-001',
|
|
328
|
+
requirement: 'Secure secret and credential management',
|
|
329
|
+
category: 'Secret Management',
|
|
330
|
+
status: secretsIgnored ? 'pass' : exposedSecrets.length > 0 ? 'fail' : 'pass',
|
|
331
|
+
evidence: secretsIgnored
|
|
332
|
+
? '.env files excluded from version control via .gitignore'
|
|
333
|
+
: exposedSecrets.length > 0
|
|
334
|
+
? `Found ${exposedSecrets.length} .env file(s) — verify they are gitignored`
|
|
335
|
+
: 'No .env files found in project root',
|
|
336
|
+
remediation: secretsIgnored ? undefined : 'Add .env to .gitignore and use a secret manager',
|
|
337
|
+
});
|
|
338
|
+
// PCI-002: Encryption patterns
|
|
339
|
+
const encryptionFiles = searchFilesForPattern(cwd, /encrypt|cipher|aes|crypto|bcrypt|argon/i, ['ts', 'js', 'py', 'go', 'rs']);
|
|
340
|
+
checks.push({
|
|
341
|
+
id: 'PCI-002',
|
|
342
|
+
requirement: 'Strong encryption for cardholder data',
|
|
343
|
+
category: 'Encryption',
|
|
344
|
+
status: encryptionFiles.length > 0 ? 'pass' : 'fail',
|
|
345
|
+
evidence: encryptionFiles.length > 0
|
|
346
|
+
? `${encryptionFiles.length} file(s) implement encryption`
|
|
347
|
+
: 'No encryption patterns found',
|
|
348
|
+
remediation: 'Implement encryption for sensitive data using industry-standard algorithms',
|
|
349
|
+
});
|
|
350
|
+
// PCI-003: Vulnerability scanning
|
|
351
|
+
const hasLockfile = existsSync(join(cwd, 'package-lock.json')) || existsSync(join(cwd, 'yarn.lock')) || existsSync(join(cwd, 'pnpm-lock.yaml'));
|
|
352
|
+
const auditResult = hasLockfile ? shellOutput('npm audit --json 2>/dev/null') : null;
|
|
353
|
+
let vulnCount = 0;
|
|
354
|
+
if (auditResult) {
|
|
355
|
+
try {
|
|
356
|
+
const parsed = JSON.parse(auditResult);
|
|
357
|
+
vulnCount = parsed.metadata?.vulnerabilities?.high ?? 0 + (parsed.metadata?.vulnerabilities?.critical ?? 0);
|
|
358
|
+
}
|
|
359
|
+
catch { /* ignore parse errors */ }
|
|
360
|
+
}
|
|
361
|
+
checks.push({
|
|
362
|
+
id: 'PCI-003',
|
|
363
|
+
requirement: 'Regular vulnerability scanning',
|
|
364
|
+
category: 'Vulnerability Management',
|
|
365
|
+
status: hasLockfile ? (vulnCount === 0 ? 'pass' : 'partial') : 'not-applicable',
|
|
366
|
+
evidence: hasLockfile
|
|
367
|
+
? vulnCount === 0 ? 'No high/critical vulnerabilities found' : `${vulnCount} high/critical vulnerabilities detected`
|
|
368
|
+
: 'No package lock file found',
|
|
369
|
+
remediation: vulnCount > 0 ? 'Run `npm audit fix` to resolve vulnerabilities' : undefined,
|
|
370
|
+
});
|
|
371
|
+
// PCI-004: Access logging
|
|
372
|
+
const auditPath = join(swarmDir, 'audit.jsonl');
|
|
373
|
+
checks.push({
|
|
374
|
+
id: 'PCI-004',
|
|
375
|
+
requirement: 'Access logging and monitoring',
|
|
376
|
+
category: 'Logging & Monitoring',
|
|
377
|
+
status: existsSync(auditPath) ? 'pass' : 'fail',
|
|
378
|
+
evidence: existsSync(auditPath) ? 'Audit trail captures access events' : 'No access logging configured',
|
|
379
|
+
remediation: 'Enable audit logging via swarm pipeline operations',
|
|
380
|
+
});
|
|
381
|
+
// PCI-005: Network security
|
|
382
|
+
const firewallFiles = searchFilesForPattern(cwd, /firewall|cors|csp|helmet|rate.?limit/i, ['ts', 'js', 'py', 'go', 'yaml', 'yml']);
|
|
383
|
+
checks.push({
|
|
384
|
+
id: 'PCI-005',
|
|
385
|
+
requirement: 'Network security controls',
|
|
386
|
+
category: 'Network Security',
|
|
387
|
+
status: firewallFiles.length > 0 ? 'pass' : 'partial',
|
|
388
|
+
evidence: firewallFiles.length > 0
|
|
389
|
+
? `${firewallFiles.length} file(s) implement network security controls`
|
|
390
|
+
: 'No explicit network security controls found',
|
|
391
|
+
remediation: 'Implement CORS, rate limiting, and CSP headers',
|
|
392
|
+
});
|
|
393
|
+
// PCI-006: Secure development practices
|
|
394
|
+
const hasGit = existsSync(join(cwd, '.git'));
|
|
395
|
+
const hasCi = existsSync(join(cwd, '.github')) || existsSync(join(cwd, '.gitlab-ci.yml'));
|
|
396
|
+
checks.push({
|
|
397
|
+
id: 'PCI-006',
|
|
398
|
+
requirement: 'Secure software development lifecycle',
|
|
399
|
+
category: 'Secure Development',
|
|
400
|
+
status: hasGit && hasCi ? 'pass' : hasGit ? 'partial' : 'fail',
|
|
401
|
+
evidence: [
|
|
402
|
+
hasGit ? 'Version control active' : null,
|
|
403
|
+
hasCi ? 'CI/CD pipeline configured' : null,
|
|
404
|
+
].filter(Boolean).join('; ') || 'No SDLC controls found',
|
|
405
|
+
remediation: hasCi ? undefined : 'Set up CI/CD pipeline for automated security testing',
|
|
406
|
+
});
|
|
407
|
+
return checks;
|
|
408
|
+
}
|
|
409
|
+
// ── Custom Checks ──────────────────────────────────────────────────────────────
|
|
410
|
+
function loadCustomChecks(swarmDir) {
|
|
411
|
+
const compliancePath = join(swarmDir, 'compliance.yaml');
|
|
412
|
+
if (!existsSync(compliancePath))
|
|
413
|
+
return [];
|
|
414
|
+
try {
|
|
415
|
+
const content = readFileSync(compliancePath, 'utf-8');
|
|
416
|
+
const parsed = parseYaml(content);
|
|
417
|
+
return (parsed?.checks ?? []);
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
return [];
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function runCustomChecks(swarmDir, cwd, framework) {
|
|
424
|
+
const customs = loadCustomChecks(swarmDir);
|
|
425
|
+
const filtered = customs.filter(c => c.framework.toLowerCase() === framework.toLowerCase());
|
|
426
|
+
const results = [];
|
|
427
|
+
for (const custom of filtered) {
|
|
428
|
+
let status = 'fail';
|
|
429
|
+
let evidence = '';
|
|
430
|
+
if (custom.command) {
|
|
431
|
+
const ok = shellCheck(custom.command);
|
|
432
|
+
status = ok ? 'pass' : 'fail';
|
|
433
|
+
evidence = ok ? `Command succeeded: ${custom.command}` : `Command failed: ${custom.command}`;
|
|
434
|
+
}
|
|
435
|
+
else if (custom.pattern && custom.path) {
|
|
436
|
+
const target = join(cwd, custom.path);
|
|
437
|
+
if (existsSync(target)) {
|
|
438
|
+
const matches = fileContainsPattern(target, new RegExp(custom.pattern, 'i'));
|
|
439
|
+
status = matches ? 'pass' : 'fail';
|
|
440
|
+
evidence = matches ? `Pattern "${custom.pattern}" found in ${custom.path}` : `Pattern "${custom.pattern}" not found in ${custom.path}`;
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
evidence = `File not found: ${custom.path}`;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
results.push({
|
|
447
|
+
id: custom.id,
|
|
448
|
+
requirement: custom.requirement,
|
|
449
|
+
category: custom.category,
|
|
450
|
+
status,
|
|
451
|
+
evidence,
|
|
452
|
+
remediation: custom.description,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
return results;
|
|
456
|
+
}
|
|
457
|
+
// ── Report Generation ──────────────────────────────────────────────────────────
|
|
458
|
+
function generateReport(framework, checks, swarmDir) {
|
|
459
|
+
const overallScore = calculateScore(checks);
|
|
460
|
+
const gaps = checks
|
|
461
|
+
.filter(c => c.status === 'fail' || c.status === 'partial')
|
|
462
|
+
.map(c => ({
|
|
463
|
+
requirement: c.requirement,
|
|
464
|
+
severity: c.status === 'fail' ? 'high' : 'medium',
|
|
465
|
+
remediation: c.remediation ?? 'Review and address this requirement',
|
|
466
|
+
}));
|
|
467
|
+
const data = {
|
|
468
|
+
framework,
|
|
469
|
+
overallScore,
|
|
470
|
+
checks,
|
|
471
|
+
gaps,
|
|
472
|
+
lastAudit: Date.now(),
|
|
473
|
+
};
|
|
474
|
+
// Save JSON report
|
|
475
|
+
const jsonPath = join(swarmDir, 'compliance-report.json');
|
|
476
|
+
writeFileSync(jsonPath, JSON.stringify(data, null, 2), 'utf-8');
|
|
477
|
+
// Save Markdown report
|
|
478
|
+
const mdPath = join(process.cwd(), 'COMPLIANCE-REPORT.md');
|
|
479
|
+
const md = renderMarkdownReport(framework, data);
|
|
480
|
+
writeFileSync(mdPath, md, 'utf-8');
|
|
481
|
+
return data;
|
|
482
|
+
}
|
|
483
|
+
function renderMarkdownReport(framework, data) {
|
|
484
|
+
const lines = [];
|
|
485
|
+
const frameworkLabel = framework.toUpperCase();
|
|
486
|
+
const now = new Date().toISOString();
|
|
487
|
+
lines.push(`# Compliance Report: ${frameworkLabel}`);
|
|
488
|
+
lines.push('');
|
|
489
|
+
lines.push(`**Generated:** ${now}`);
|
|
490
|
+
lines.push(`**Overall Score:** ${data.overallScore}%`);
|
|
491
|
+
lines.push('');
|
|
492
|
+
// Summary
|
|
493
|
+
const passCount = data.checks.filter(c => c.status === 'pass').length;
|
|
494
|
+
const failCount = data.checks.filter(c => c.status === 'fail').length;
|
|
495
|
+
const partialCount = data.checks.filter(c => c.status === 'partial').length;
|
|
496
|
+
const naCount = data.checks.filter(c => c.status === 'not-applicable').length;
|
|
497
|
+
lines.push('## Summary');
|
|
498
|
+
lines.push('');
|
|
499
|
+
lines.push(`| Status | Count |`);
|
|
500
|
+
lines.push(`|--------|-------|`);
|
|
501
|
+
lines.push(`| Pass | ${passCount} |`);
|
|
502
|
+
lines.push(`| Fail | ${failCount} |`);
|
|
503
|
+
lines.push(`| Partial | ${partialCount} |`);
|
|
504
|
+
lines.push(`| N/A | ${naCount} |`);
|
|
505
|
+
lines.push('');
|
|
506
|
+
// Detailed checks
|
|
507
|
+
lines.push('## Detailed Checks');
|
|
508
|
+
lines.push('');
|
|
509
|
+
lines.push('| ID | Requirement | Category | Status | Evidence |');
|
|
510
|
+
lines.push('|----|-------------|----------|--------|----------|');
|
|
511
|
+
for (const c of data.checks) {
|
|
512
|
+
const statusStr = c.status.toUpperCase();
|
|
513
|
+
lines.push(`| ${c.id} | ${c.requirement} | ${c.category} | ${statusStr} | ${c.evidence ?? '-'} |`);
|
|
514
|
+
}
|
|
515
|
+
lines.push('');
|
|
516
|
+
// Gaps and remediation
|
|
517
|
+
if (data.gaps.length > 0) {
|
|
518
|
+
lines.push('## Gaps & Remediation');
|
|
519
|
+
lines.push('');
|
|
520
|
+
for (const gap of data.gaps) {
|
|
521
|
+
lines.push(`### ${gap.requirement}`);
|
|
522
|
+
lines.push('');
|
|
523
|
+
lines.push(`- **Severity:** ${gap.severity}`);
|
|
524
|
+
lines.push(`- **Remediation:** ${gap.remediation}`);
|
|
525
|
+
lines.push('');
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
return lines.join('\n');
|
|
529
|
+
}
|
|
530
|
+
// ── Framework Dispatcher ───────────────────────────────────────────────────────
|
|
531
|
+
function runFrameworkChecks(framework, swarmDir, cwd) {
|
|
532
|
+
let checks;
|
|
533
|
+
switch (framework) {
|
|
534
|
+
case 'soc2':
|
|
535
|
+
checks = runSoc2Checks(swarmDir, cwd);
|
|
536
|
+
break;
|
|
537
|
+
case 'hipaa':
|
|
538
|
+
checks = runHipaaChecks(swarmDir, cwd);
|
|
539
|
+
break;
|
|
540
|
+
case 'gdpr':
|
|
541
|
+
checks = runGdprChecks(swarmDir, cwd);
|
|
542
|
+
break;
|
|
543
|
+
case 'pci':
|
|
544
|
+
checks = runPciChecks(swarmDir, cwd);
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
// Append custom checks
|
|
548
|
+
const customs = runCustomChecks(swarmDir, cwd, framework);
|
|
549
|
+
return [...checks, ...customs];
|
|
550
|
+
}
|
|
551
|
+
// ── CLI Registration ───────────────────────────────────────────────────────────
|
|
552
|
+
export function registerCompliance(program) {
|
|
553
|
+
const cmd = program
|
|
554
|
+
.command('compliance')
|
|
555
|
+
.description('Regulatory & policy compliance automation (SOC 2, HIPAA, GDPR, PCI DSS)');
|
|
556
|
+
// ── swarm compliance check ──────────────────────────────────────────────────
|
|
557
|
+
cmd
|
|
558
|
+
.command('check')
|
|
559
|
+
.description('Run all configured compliance checks')
|
|
560
|
+
.option('--framework <fw>', 'Run checks for a specific framework (soc2|hipaa|gdpr|pci)')
|
|
561
|
+
.option('--json', 'Output results as JSON')
|
|
562
|
+
.action(async (opts) => {
|
|
563
|
+
const swarmDir = requireSwarmDir();
|
|
564
|
+
loadConfig();
|
|
565
|
+
const cwd = process.cwd();
|
|
566
|
+
const frameworks = opts.framework
|
|
567
|
+
? [opts.framework]
|
|
568
|
+
: ['soc2', 'hipaa', 'gdpr', 'pci'];
|
|
569
|
+
const allResults = {};
|
|
570
|
+
for (const fw of frameworks) {
|
|
571
|
+
const checks = runFrameworkChecks(fw, swarmDir, cwd);
|
|
572
|
+
const score = calculateScore(checks);
|
|
573
|
+
allResults[fw] = { checks, score };
|
|
574
|
+
}
|
|
575
|
+
if (opts.json) {
|
|
576
|
+
console.log(JSON.stringify(allResults, null, 2));
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
console.log(chalk.bold('\nCompliance Check Results\n'));
|
|
580
|
+
for (const [fw, result] of Object.entries(allResults)) {
|
|
581
|
+
const scoreColor = result.score >= 80 ? chalk.green
|
|
582
|
+
: result.score >= 50 ? chalk.yellow
|
|
583
|
+
: chalk.red;
|
|
584
|
+
console.log(chalk.bold(` ${fw.toUpperCase()}`) + ' ' + scoreColor(`${result.score}%`));
|
|
585
|
+
console.log(chalk.dim(' ' + '-'.repeat(50)));
|
|
586
|
+
for (const check of result.checks) {
|
|
587
|
+
const color = statusColor(check.status);
|
|
588
|
+
console.log(` ${color(`[${statusIcon(check.status)}]`)} ${chalk.bold(check.id)} ${check.requirement}`);
|
|
589
|
+
if (check.evidence) {
|
|
590
|
+
console.log(chalk.dim(` ${check.evidence}`));
|
|
591
|
+
}
|
|
592
|
+
if (check.status === 'fail' && check.remediation) {
|
|
593
|
+
console.log(chalk.yellow(` Remediation: ${check.remediation}`));
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
console.log('');
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
// ── swarm compliance report ─────────────────────────────────────────────────
|
|
600
|
+
cmd
|
|
601
|
+
.command('report')
|
|
602
|
+
.description('Generate a compliance report')
|
|
603
|
+
.requiredOption('--framework <fw>', 'Compliance framework (soc2|hipaa|gdpr|pci)')
|
|
604
|
+
.option('--json', 'Output report as JSON only')
|
|
605
|
+
.action(async (opts) => {
|
|
606
|
+
const swarmDir = requireSwarmDir();
|
|
607
|
+
loadConfig();
|
|
608
|
+
const cwd = process.cwd();
|
|
609
|
+
const framework = opts.framework;
|
|
610
|
+
const validFrameworks = ['soc2', 'hipaa', 'gdpr', 'pci'];
|
|
611
|
+
if (!validFrameworks.includes(framework)) {
|
|
612
|
+
console.error(chalk.red(`Invalid framework: ${framework}. Choose from: ${validFrameworks.join(', ')}`));
|
|
613
|
+
process.exit(1);
|
|
614
|
+
}
|
|
615
|
+
console.log(chalk.dim(`Running ${framework.toUpperCase()} compliance checks...\n`));
|
|
616
|
+
const checks = runFrameworkChecks(framework, swarmDir, cwd);
|
|
617
|
+
const data = generateReport(framework, checks, swarmDir);
|
|
618
|
+
if (opts.json) {
|
|
619
|
+
console.log(JSON.stringify(data, null, 2));
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const scoreColor = data.overallScore >= 80 ? chalk.green
|
|
623
|
+
: data.overallScore >= 50 ? chalk.yellow
|
|
624
|
+
: chalk.red;
|
|
625
|
+
console.log(chalk.bold(`${framework.toUpperCase()} Compliance Report`));
|
|
626
|
+
console.log(chalk.bold(`Overall Score: `) + scoreColor(`${data.overallScore}%`));
|
|
627
|
+
console.log('');
|
|
628
|
+
const passCount = checks.filter(c => c.status === 'pass').length;
|
|
629
|
+
const failCount = checks.filter(c => c.status === 'fail').length;
|
|
630
|
+
const partialCount = checks.filter(c => c.status === 'partial').length;
|
|
631
|
+
console.log(` ${chalk.green(`${passCount} passed`)} ${chalk.red(`${failCount} failed`)} ${chalk.yellow(`${partialCount} partial`)}`);
|
|
632
|
+
console.log('');
|
|
633
|
+
for (const check of checks) {
|
|
634
|
+
const color = statusColor(check.status);
|
|
635
|
+
console.log(` ${color(`[${statusIcon(check.status)}]`)} ${chalk.bold(check.id)} ${check.requirement}`);
|
|
636
|
+
}
|
|
637
|
+
console.log('');
|
|
638
|
+
console.log(chalk.dim(`Report saved to:`));
|
|
639
|
+
console.log(chalk.dim(` JSON: ${join(swarmDir, 'compliance-report.json')}`));
|
|
640
|
+
console.log(chalk.dim(` Markdown: ${join(cwd, 'COMPLIANCE-REPORT.md')}`));
|
|
641
|
+
if (data.gaps.length > 0) {
|
|
642
|
+
console.log('');
|
|
643
|
+
console.log(chalk.bold(`Gaps requiring attention (${data.gaps.length}):`));
|
|
644
|
+
for (const gap of data.gaps) {
|
|
645
|
+
const sevColor = gap.severity === 'high' ? chalk.red : chalk.yellow;
|
|
646
|
+
console.log(` ${sevColor(`[${gap.severity.toUpperCase()}]`)} ${gap.requirement}`);
|
|
647
|
+
console.log(chalk.dim(` ${gap.remediation}`));
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
// ── swarm compliance monitor ────────────────────────────────────────────────
|
|
652
|
+
cmd
|
|
653
|
+
.command('monitor')
|
|
654
|
+
.description('Continuous compliance monitoring')
|
|
655
|
+
.option('--interval <minutes>', 'Check interval in minutes', '60')
|
|
656
|
+
.option('--framework <fw>', 'Monitor a specific framework (soc2|hipaa|gdpr|pci)')
|
|
657
|
+
.option('--fail-under <score>', 'Exit with error if score drops below threshold')
|
|
658
|
+
.action(async (opts) => {
|
|
659
|
+
const swarmDir = requireSwarmDir();
|
|
660
|
+
loadConfig();
|
|
661
|
+
const cwd = process.cwd();
|
|
662
|
+
const interval = Math.max(1, parseInt(opts.interval, 10) || 60) * 60 * 1000;
|
|
663
|
+
const failUnder = opts.failUnder ? parseInt(opts.failUnder, 10) : null;
|
|
664
|
+
const frameworks = opts.framework
|
|
665
|
+
? [opts.framework]
|
|
666
|
+
: ['soc2', 'hipaa', 'gdpr', 'pci'];
|
|
667
|
+
console.log(chalk.bold('Compliance Monitor'));
|
|
668
|
+
console.log(chalk.dim(`Monitoring: ${frameworks.map(f => f.toUpperCase()).join(', ')}`));
|
|
669
|
+
console.log(chalk.dim(`Interval: ${opts.interval} minutes`));
|
|
670
|
+
if (failUnder !== null) {
|
|
671
|
+
console.log(chalk.dim(`Fail threshold: ${failUnder}%`));
|
|
672
|
+
}
|
|
673
|
+
console.log(chalk.dim('Press Ctrl+C to stop.\n'));
|
|
674
|
+
const runCycle = () => {
|
|
675
|
+
const timestamp = new Date().toLocaleString();
|
|
676
|
+
console.log(chalk.dim(`\n--- Compliance scan at ${timestamp} ---\n`));
|
|
677
|
+
let allPassing = true;
|
|
678
|
+
for (const fw of frameworks) {
|
|
679
|
+
const checks = runFrameworkChecks(fw, swarmDir, cwd);
|
|
680
|
+
const score = calculateScore(checks);
|
|
681
|
+
const failCount = checks.filter(c => c.status === 'fail').length;
|
|
682
|
+
const scoreColor = score >= 80 ? chalk.green
|
|
683
|
+
: score >= 50 ? chalk.yellow
|
|
684
|
+
: chalk.red;
|
|
685
|
+
console.log(` ${chalk.bold(fw.toUpperCase().padEnd(6))} ${scoreColor(`${score}%`.padStart(5))} ${chalk.green(`${checks.filter(c => c.status === 'pass').length} pass`)} ${chalk.red(`${failCount} fail`)}`);
|
|
686
|
+
if (failUnder !== null && score < failUnder) {
|
|
687
|
+
allPassing = false;
|
|
688
|
+
}
|
|
689
|
+
// Persist latest results
|
|
690
|
+
const data = {
|
|
691
|
+
framework: fw,
|
|
692
|
+
overallScore: score,
|
|
693
|
+
checks,
|
|
694
|
+
gaps: checks.filter(c => c.status === 'fail' || c.status === 'partial').map(c => ({
|
|
695
|
+
requirement: c.requirement,
|
|
696
|
+
severity: c.status === 'fail' ? 'high' : 'medium',
|
|
697
|
+
remediation: c.remediation ?? 'Review and address this requirement',
|
|
698
|
+
})),
|
|
699
|
+
lastAudit: Date.now(),
|
|
700
|
+
};
|
|
701
|
+
writeFileSync(join(swarmDir, `compliance-${fw}.json`), JSON.stringify(data, null, 2), 'utf-8');
|
|
702
|
+
}
|
|
703
|
+
if (failUnder !== null && !allPassing) {
|
|
704
|
+
console.log(chalk.red(`\nCompliance score dropped below ${failUnder}% threshold.`));
|
|
705
|
+
process.exit(1);
|
|
706
|
+
}
|
|
707
|
+
};
|
|
708
|
+
// Initial run
|
|
709
|
+
runCycle();
|
|
710
|
+
// Schedule recurring checks
|
|
711
|
+
const timer = setInterval(runCycle, interval);
|
|
712
|
+
// Graceful shutdown
|
|
713
|
+
const shutdown = () => {
|
|
714
|
+
clearInterval(timer);
|
|
715
|
+
console.log(chalk.dim('\nCompliance monitor stopped.'));
|
|
716
|
+
process.exit(0);
|
|
717
|
+
};
|
|
718
|
+
process.on('SIGINT', shutdown);
|
|
719
|
+
process.on('SIGTERM', shutdown);
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
//# sourceMappingURL=compliance.js.map
|