opencode-swarm 7.0.0-beta.1 → 7.0.1
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 +21 -0
- package/README.md +1265 -40
- package/dist/__tests__/acknowledge-spec-drift.test.d.ts +1 -0
- package/dist/__tests__/cli-version.adversarial.test.d.ts +1 -0
- package/dist/__tests__/cli-version.test.d.ts +1 -0
- package/dist/__tests__/conflict-resolution.test.d.ts +1 -0
- package/dist/__tests__/convene-general-council.test.d.ts +10 -0
- package/dist/__tests__/critic_drift_verifier-whitelist.test.d.ts +1 -0
- package/dist/__tests__/critic_hallucination_verifier-whitelist.test.d.ts +1 -0
- package/dist/__tests__/disagreement-detector.test.d.ts +7 -0
- package/dist/__tests__/evidence-lock.adversarial.test.d.ts +8 -0
- package/dist/__tests__/evidence-lock.test.d.ts +6 -0
- package/dist/__tests__/gate-evidence.adversarial.test.d.ts +7 -0
- package/dist/__tests__/general-council-service.test.d.ts +7 -0
- package/dist/__tests__/lint-spec.test.d.ts +1 -0
- package/dist/__tests__/preflight-phase.test.d.ts +1 -0
- package/dist/__tests__/qa-gate-hardening.test.d.ts +12 -0
- package/dist/__tests__/req-coverage.test.d.ts +1 -0
- package/dist/__tests__/security-adversarial.test.d.ts +1 -0
- package/dist/__tests__/sounding-board-parser.test.d.ts +1 -0
- package/dist/__tests__/spec-hash.test.d.ts +1 -0
- package/dist/__tests__/spec-schema.test.d.ts +1 -0
- package/dist/__tests__/web-search-provider.test.d.ts +6 -0
- package/dist/__tests__/write-drift-evidence-requirement-coverage.test.d.ts +4 -0
- package/dist/adversarial-tests.test.d.ts +1 -0
- package/dist/agents/architect-permission.adversarial.test.d.ts +5 -0
- package/dist/agents/architect.commands-list.adversarial.test.d.ts +1 -0
- package/dist/agents/architect.commands-list.test.d.ts +1 -0
- package/dist/agents/architect.d.ts +57 -0
- package/dist/agents/architect.dark-matter.test.d.ts +1 -0
- package/dist/agents/architect.designer-gate.test.d.ts +1 -0
- package/dist/agents/coder.d.ts +2 -0
- package/dist/agents/council-member.d.ts +30 -0
- package/dist/agents/council-member.test.d.ts +8 -0
- package/dist/agents/council-moderator.d.ts +20 -0
- package/dist/agents/critic.d.ts +34 -0
- package/dist/agents/curator-agent.d.ts +14 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/docs.d.ts +2 -0
- package/dist/agents/explorer-consumer-contract.test.d.ts +1 -0
- package/dist/agents/explorer-role-boundary.test.d.ts +1 -0
- package/dist/agents/explorer.d.ts +5 -0
- package/dist/agents/index.d.ts +52 -0
- package/dist/agents/reviewer.d.ts +5 -0
- package/dist/agents/sme.d.ts +2 -0
- package/dist/agents/test-engineer.adversarial.test.d.ts +5 -0
- package/dist/agents/test-engineer.d.ts +2 -0
- package/dist/agents/test-engineer.security.test.d.ts +1 -0
- package/dist/background/circuit-breaker.d.ts +149 -0
- package/dist/background/event-bus.d.ts +60 -0
- package/dist/background/evidence-summary-integration.d.ts +73 -0
- package/dist/background/index.d.ts +22 -0
- package/dist/background/manager.d.ts +122 -0
- package/dist/background/plan-sync-worker.d.ts +122 -0
- package/dist/background/queue.d.ts +117 -0
- package/dist/background/status-artifact.d.ts +115 -0
- package/dist/background/trigger.d.ts +179 -0
- package/dist/background/trigger.vulnerability.test.d.ts +1 -0
- package/dist/background/worker.d.ts +92 -0
- package/dist/cli/index.d.ts +37 -0
- package/dist/cli/index.js +31346 -11426
- package/dist/commands/acknowledge-spec-drift.d.ts +5 -0
- package/dist/commands/brainstorm.d.ts +13 -0
- package/dist/commands/brainstorm.test.d.ts +1 -0
- package/dist/commands/checkpoint.d.ts +5 -0
- package/dist/commands/close.d.ts +11 -0
- package/dist/commands/command-adapters.security.test.d.ts +14 -0
- package/dist/commands/commands.test.d.ts +1 -0
- package/dist/commands/config.d.ts +5 -0
- package/dist/commands/council.d.ts +17 -0
- package/dist/commands/council.test.d.ts +4 -0
- package/dist/commands/curate.test.d.ts +1 -0
- package/dist/commands/doctor.d.ts +17 -0
- package/dist/commands/full-auto-config-guard.test.d.ts +7 -0
- package/dist/commands/full-auto-discoverability.test.d.ts +8 -0
- package/dist/commands/full-auto-registration.test.d.ts +5 -0
- package/dist/commands/full-auto-sessionid.test.d.ts +5 -0
- package/dist/commands/full-auto.d.ts +10 -0
- package/dist/commands/full-auto.regression.test.d.ts +10 -0
- package/dist/commands/full-auto.test.d.ts +6 -0
- package/dist/commands/index.d.ts +50 -0
- package/dist/commands/index.help-text.test.d.ts +1 -0
- package/dist/commands/issue.d.ts +13 -0
- package/dist/{knowledge.d.ts → commands/knowledge.d.ts} +2 -0
- package/dist/commands/pr-review.d.ts +11 -0
- package/dist/commands/qa-gates.d.ts +15 -0
- package/dist/commands/qa-gates.test.d.ts +1 -0
- package/dist/commands/registry-documentation.test.d.ts +1 -0
- package/dist/commands/registry-type.test.d.ts +1 -0
- package/dist/commands/registry.d.ts +282 -0
- package/dist/commands/reset-session.d.ts +7 -0
- package/dist/{reset.d.ts → commands/reset.d.ts} +1 -1
- package/dist/commands/shortcut-routing.test.d.ts +11 -0
- package/dist/{sync-plan.d.ts → commands/sync-plan.d.ts} +3 -1
- package/dist/commands/turbo-registration.test.d.ts +5 -0
- package/dist/commands/turbo-sessionid.test.d.ts +5 -0
- package/dist/commands/turbo.regression.test.d.ts +11 -0
- package/dist/commands/turbo.test.d.ts +5 -0
- package/dist/config/agent-categories.d.ts +12 -0
- package/dist/config/cache-paths.d.ts +17 -0
- package/dist/config/constants.architect-whitelist.test.d.ts +1 -0
- package/dist/config/constants.d.ts +72 -0
- package/dist/config/evidence-schema.d.ts +1352 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/{config.d.ts → config/loader.d.ts} +11 -6
- package/dist/config/plan-schema.d.ts +191 -0
- package/dist/config/schema.d.ts +1078 -0
- package/dist/config/spec-schema.d.ts +113 -0
- package/dist/context/role-filter.d.ts +27 -0
- package/dist/context/zone-classifier.d.ts +17 -0
- package/dist/council/__tests__/council-evidence-writer.adversarial.test.d.ts +6 -0
- package/dist/council/council-advisory.d.ts +46 -0
- package/dist/council/council-evidence-writer.d.ts +18 -0
- package/dist/council/council-service.d.ts +21 -0
- package/dist/council/criteria-store.d.ts +9 -0
- package/dist/council/disagreement-detector.d.ts +24 -0
- package/dist/council/general-council-advisory.d.ts +29 -0
- package/dist/council/general-council-service.d.ts +22 -0
- package/dist/council/general-council-types.d.ts +98 -0
- package/dist/council/types.d.ts +126 -0
- package/dist/council/web-search-provider.d.ts +35 -0
- package/dist/db/global-db.d.ts +22 -0
- package/dist/db/global-db.test.d.ts +7 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/project-db.d.ts +40 -0
- package/dist/db/project-db.test.d.ts +4 -0
- package/dist/db/qa-gate-profile.d.ts +107 -0
- package/dist/db/qa-gate-profile.test.d.ts +4 -0
- package/dist/diff/__tests__/semantic-classifier.test.d.ts +1 -0
- package/dist/diff/__tests__/summary-generator.test.d.ts +1 -0
- package/dist/diff/ast-diff.d.ts +21 -0
- package/dist/diff/semantic-classifier.d.ts +59 -0
- package/dist/diff/summary-generator.d.ts +33 -0
- package/dist/environment/index.d.ts +3 -0
- package/dist/environment/profile.d.ts +50 -0
- package/dist/environment/prompt-renderer.d.ts +6 -0
- package/dist/evidence/index.d.ts +2 -0
- package/dist/evidence/lock.d.ts +36 -0
- package/dist/evidence/manager.d.ts +78 -0
- package/dist/gate-evidence.d.ts +69 -0
- package/dist/gate-evidence.test.d.ts +1 -0
- package/dist/git/branch.d.ts +70 -0
- package/dist/git/index.d.ts +22 -0
- package/dist/git/pr.d.ts +28 -0
- package/dist/graph/graph-builder.d.ts +39 -0
- package/dist/graph/graph-query.d.ts +42 -0
- package/dist/graph/graph-store.d.ts +27 -0
- package/dist/graph/import-extractor.d.ts +44 -0
- package/dist/graph/index.d.ts +16 -0
- package/dist/graph/symbol-extractor.d.ts +17 -0
- package/dist/graph/types.d.ts +84 -0
- package/dist/hooks/__tests__/semantic-diff-injection.test.d.ts +1 -0
- package/dist/hooks/adversarial-detector.d.ts +50 -0
- package/dist/hooks/agent-activity.d.ts +38 -0
- package/dist/hooks/co-change-suggester.d.ts +51 -0
- package/dist/hooks/compaction-customizer.d.ts +11 -0
- package/dist/hooks/conflict-resolution.d.ts +12 -0
- package/dist/hooks/context-budget.d.ts +34 -0
- package/dist/hooks/context-scoring.d.ts +70 -0
- package/dist/hooks/curator-drift-advisory.test.d.ts +1 -0
- package/dist/hooks/curator-drift.d.ts +30 -0
- package/dist/hooks/curator-llm-factory.d.ts +20 -0
- package/dist/hooks/curator-types.d.ts +103 -0
- package/dist/hooks/curator.d.ts +108 -0
- package/dist/hooks/dark-matter-detector.d.ts +38 -0
- package/dist/hooks/delegation-gate.d.ts +78 -0
- package/dist/hooks/delegation-gate.evidence.test.d.ts +4 -0
- package/dist/hooks/delegation-gate.getEvidenceTaskId.test.d.ts +20 -0
- package/dist/hooks/delegation-gate.plan-fallback-security.test.d.ts +13 -0
- package/dist/hooks/delegation-gate.plan-fallback.test.d.ts +5 -0
- package/dist/hooks/delegation-gate.seed-state.test.d.ts +1 -0
- package/dist/hooks/delegation-gate.turbo-evidence.test.d.ts +8 -0
- package/dist/hooks/delegation-gate.verify.test.d.ts +11 -0
- package/dist/hooks/delegation-ledger.d.ts +37 -0
- package/dist/hooks/delegation-ledger.test.d.ts +11 -0
- package/dist/hooks/delegation-sanitizer.d.ts +24 -0
- package/dist/hooks/delegation-tracker.d.ts +15 -0
- package/dist/hooks/diff-scope.d.ts +12 -0
- package/dist/hooks/diff-scope.test.d.ts +1 -0
- package/dist/hooks/extractors.d.ts +53 -0
- package/dist/hooks/full-auto-intercept.d.ts +77 -0
- package/dist/hooks/guardrails.d.ts +174 -0
- package/dist/hooks/hive-promoter.d.ts +40 -0
- package/dist/hooks/incremental-verify.d.ts +34 -0
- package/dist/hooks/incremental-verify.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/knowledge-curator.d.ts +27 -0
- package/dist/hooks/knowledge-injector.d.ts +20 -0
- package/dist/hooks/knowledge-migrator.d.ts +11 -0
- package/dist/hooks/knowledge-reader.d.ts +22 -0
- package/dist/hooks/knowledge-store.d.ts +30 -0
- package/dist/hooks/knowledge-types.d.ts +131 -0
- package/dist/hooks/knowledge-validator.d.ts +29 -0
- package/dist/hooks/loop-detector.d.ts +17 -0
- package/dist/hooks/loop-detector.test.d.ts +1 -0
- package/dist/hooks/message-priority.d.ts +105 -0
- package/dist/hooks/messages-transform.d.ts +13 -0
- package/dist/hooks/model-limits.d.ts +96 -0
- package/dist/hooks/normalize-tool-name.d.ts +25 -0
- package/dist/hooks/phase-monitor.d.ts +29 -0
- package/dist/hooks/pipeline-tracker.d.ts +41 -0
- package/dist/hooks/repo-graph-builder.d.ts +32 -0
- package/dist/hooks/repo-graph-injection.d.ts +45 -0
- package/dist/hooks/review-receipt.d.ts +189 -0
- package/dist/hooks/scope-guard-throw-behavior.test.d.ts +15 -0
- package/dist/hooks/scope-guard.adversarial.test.d.ts +1 -0
- package/dist/hooks/scope-guard.d.ts +43 -0
- package/dist/hooks/scope-guard.test.d.ts +14 -0
- package/dist/hooks/self-review.d.ts +14 -0
- package/dist/hooks/self-review.test.d.ts +14 -0
- package/dist/hooks/semantic-diff-injection.d.ts +24 -0
- package/dist/hooks/slop-detector.adversarial.test.d.ts +1 -0
- package/dist/hooks/slop-detector.d.ts +17 -0
- package/dist/hooks/slop-detector.test.d.ts +1 -0
- package/dist/hooks/spawn-helper.d.ts +5 -0
- package/dist/hooks/spawn-helper.test.d.ts +1 -0
- package/dist/hooks/steering-consumed.d.ts +30 -0
- package/dist/hooks/system-enhancer.d.ts +30 -0
- package/dist/hooks/tool-summarizer.d.ts +28 -0
- package/dist/hooks/trajectory-logger.d.ts +69 -0
- package/dist/hooks/utils.d.ts +20 -0
- package/dist/hooks/watchdog.integration.test.d.ts +9 -0
- package/dist/index.adversarial-bootstrap.test.d.ts +1 -0
- package/dist/index.bootstrap-adversarial.test.d.ts +1 -0
- package/dist/index.bootstrap-directory.test.d.ts +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +74690 -47646
- package/dist/knowledge/identity.d.ts +25 -0
- package/dist/knowledge/index.d.ts +2 -0
- package/dist/lang/detector.d.ts +20 -0
- package/dist/lang/framework-detector.d.ts +98 -0
- package/dist/lang/grammars/tree-sitter-dart.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-kotlin.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-swift.wasm +0 -0
- package/dist/lang/grammars/tree-sitter.wasm +0 -0
- package/dist/lang/index.d.ts +4 -0
- package/dist/lang/profiles.d.ts +72 -0
- package/dist/lang/registry.d.ts +24 -0
- package/dist/lang/runtime.d.ts +35 -0
- package/dist/model-fallback.adversarial.test.d.ts +22 -0
- package/dist/model-fallback.test.d.ts +12 -0
- package/dist/mutation/__tests__/engine.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/engine.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.test.d.ts +1 -0
- package/dist/mutation/__tests__/generator.test.d.ts +1 -0
- package/dist/mutation/engine.d.ts +47 -0
- package/dist/mutation/equivalence.d.ts +35 -0
- package/dist/mutation/gate.d.ts +28 -0
- package/dist/mutation/generator.d.ts +16 -0
- package/dist/output/agent-writer.d.ts +27 -0
- package/dist/output/index.d.ts +1 -0
- package/dist/parallel/dependency-graph.d.ts +34 -0
- package/dist/parallel/dispatcher/index.d.ts +12 -0
- package/dist/parallel/dispatcher/noop-dispatcher.d.ts +18 -0
- package/dist/parallel/dispatcher/noop-dispatcher.test.d.ts +10 -0
- package/dist/parallel/dispatcher/parallel-dispatcher.d.ts +18 -0
- package/dist/parallel/dispatcher/types.d.ts +33 -0
- package/dist/parallel/file-locks.d.ts +40 -0
- package/dist/parallel/index.d.ts +5 -0
- package/dist/parallel/meta-indexer.d.ts +32 -0
- package/dist/parallel/review-router.d.ts +29 -0
- package/dist/plan/checkpoint.d.ts +25 -0
- package/dist/plan/checkpoint.test.d.ts +1 -0
- package/dist/plan/index.d.ts +1 -0
- package/dist/plan/ledger-integrity.test.d.ts +5 -0
- package/dist/plan/ledger-snapshot-adversarial.test.d.ts +1 -0
- package/dist/plan/ledger.d.ts +286 -0
- package/dist/plan/ledger.test.d.ts +1 -0
- package/dist/plan/manager.cas-backoff.test.d.ts +10 -0
- package/dist/plan/manager.d.ts +90 -0
- package/dist/plan/manager.ledger-aware.test.d.ts +1 -0
- package/dist/plan/manager.loadplan-validation-guard.test.d.ts +13 -0
- package/dist/plan/manager.update-task-status.test.d.ts +1 -0
- package/dist/plan/migration-revert.regression.test.d.ts +8 -0
- package/dist/prm/__tests__/course-correction.test.d.ts +1 -0
- package/dist/prm/__tests__/escalation-queue-drain.test.d.ts +1 -0
- package/dist/prm/__tests__/escalation.test.d.ts +1 -0
- package/dist/prm/__tests__/index.test.d.ts +1 -0
- package/dist/prm/__tests__/integration.test.d.ts +1 -0
- package/dist/prm/__tests__/pattern-detector.test.d.ts +5 -0
- package/dist/prm/__tests__/replay.test.d.ts +1 -0
- package/dist/prm/__tests__/trajectory-store.test.d.ts +7 -0
- package/dist/prm/course-correction.d.ts +20 -0
- package/dist/prm/escalation.d.ts +73 -0
- package/dist/prm/index.d.ts +58 -0
- package/dist/prm/pattern-detector.d.ts +71 -0
- package/dist/prm/replay.d.ts +44 -0
- package/dist/prm/trajectory-store.d.ts +66 -0
- package/dist/prm/types.d.ts +120 -0
- package/dist/quality/index.d.ts +1 -0
- package/dist/quality/metrics.d.ts +25 -0
- package/dist/sast/rules/c.d.ts +9 -0
- package/dist/sast/rules/csharp.d.ts +9 -0
- package/dist/sast/rules/go.d.ts +9 -0
- package/dist/sast/rules/index.d.ts +72 -0
- package/dist/sast/rules/java.d.ts +9 -0
- package/dist/sast/rules/javascript.d.ts +9 -0
- package/dist/sast/rules/php.d.ts +9 -0
- package/dist/sast/rules/python.d.ts +9 -0
- package/dist/sast/semgrep.d.ts +68 -0
- package/dist/sast/semgrep.test.d.ts +1 -0
- package/dist/sbom/cyclonedx.d.ts +101 -0
- package/dist/sbom/detectors/dart.d.ts +7 -0
- package/dist/sbom/detectors/dotnet.d.ts +7 -0
- package/dist/sbom/detectors/go.d.ts +7 -0
- package/dist/sbom/detectors/index.d.ts +53 -0
- package/dist/sbom/detectors/java.d.ts +7 -0
- package/dist/sbom/detectors/nodejs.d.ts +7 -0
- package/dist/sbom/detectors/python.d.ts +7 -0
- package/dist/sbom/detectors/rust.d.ts +7 -0
- package/dist/sbom/detectors/swift.d.ts +7 -0
- package/dist/scope/scope-persistence.d.ts +109 -0
- package/dist/scope/scope-persistence.test.d.ts +13 -0
- package/dist/services/compaction-service.d.ts +28 -0
- package/dist/services/compaction-service.test.d.ts +1 -0
- package/dist/services/config-doctor.d.ts +125 -0
- package/dist/services/config-doctor.security.test.d.ts +1 -0
- package/dist/services/config-doctor.test.d.ts +1 -0
- package/dist/services/context-budget-service.d.ts +101 -0
- package/dist/services/decision-drift-analyzer.d.ts +96 -0
- package/dist/services/diagnose-service.d.ts +41 -0
- package/dist/services/evidence-service.d.ts +65 -0
- package/dist/services/evidence-summary-service.d.ts +75 -0
- package/dist/services/export-service.d.ts +30 -0
- package/dist/services/handoff-service.d.ts +74 -0
- package/dist/services/history-service.d.ts +35 -0
- package/dist/services/index.d.ts +13 -0
- package/dist/services/plan-service.d.ts +25 -0
- package/dist/services/preflight-integration.d.ts +38 -0
- package/dist/services/preflight-service.d.ts +62 -0
- package/dist/services/run-memory.d.ts +66 -0
- package/dist/services/status-service.d.ts +35 -0
- package/dist/services/status-service.turbo-indicator.test.d.ts +5 -0
- package/dist/services/tool-doctor.d.ts +26 -0
- package/dist/services/tool-doctor.test.d.ts +1 -0
- package/dist/services/version-check.d.ts +28 -0
- package/dist/services/warning-buffer.d.ts +9 -0
- package/dist/session/snapshot-reader.d.ts +37 -0
- package/dist/session/snapshot-writer.d.ts +115 -0
- package/dist/skills/index.d.ts +30 -0
- package/dist/state/agent-run-context.d.ts +24 -0
- package/dist/state.agent-run-context.test.d.ts +10 -0
- package/dist/state.d.ts +501 -1
- package/dist/state.rehydrate.test.d.ts +1 -0
- package/dist/state.rehydration-adversarial.test.d.ts +1 -0
- package/dist/state.rehydration-integration.test.d.ts +1 -0
- package/dist/state.session-restart.test.d.ts +7 -0
- package/dist/summaries/index.d.ts +2 -0
- package/dist/summaries/manager.d.ts +29 -0
- package/dist/summaries/summarizer.d.ts +38 -0
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.test.d.ts +1 -0
- package/dist/test-impact/__tests__/council-fixes.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.test.d.ts +1 -0
- package/dist/test-impact/analyzer.d.ts +9 -0
- package/dist/test-impact/failure-classifier.d.ts +26 -0
- package/dist/test-impact/flaky-detector.d.ts +14 -0
- package/dist/test-impact/history-store.d.ts +15 -0
- package/dist/tools/__tests__/barrel-exports.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-ast-fallback.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-markdown-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-semantic.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.sourcefiles.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-history.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-source-files.test.d.ts +1 -0
- package/dist/tools/barrel-export-check-gate-status.test.d.ts +6 -0
- package/dist/tools/batch-symbols.d.ts +24 -0
- package/dist/tools/batch-symbols.test.d.ts +1 -0
- package/dist/tools/build-check.d.ts +50 -0
- package/dist/tools/check-gate-status.adversarial.test.d.ts +1 -0
- package/dist/tools/check-gate-status.d.ts +7 -0
- package/dist/tools/check-gate-status.gates.test.d.ts +1 -0
- package/dist/tools/check-gate-status.plugin-registration.test.d.ts +1 -0
- package/dist/tools/checkpoint.d.ts +12 -0
- package/dist/tools/co-change-analyzer.d.ts +45 -0
- package/dist/tools/completion-verify.d.ts +25 -0
- package/dist/tools/complexity-hotspots.d.ts +2 -0
- package/dist/tools/convene-council.d.ts +53 -0
- package/dist/tools/convene-general-council.d.ts +25 -0
- package/dist/{create-tool.d.ts → tools/create-tool.d.ts} +13 -1
- package/dist/tools/curator-analyze.d.ts +7 -0
- package/dist/tools/curator-analyze.test.d.ts +1 -0
- package/dist/tools/declare-council-criteria.d.ts +14 -0
- package/dist/tools/declare-scope.d.ts +50 -0
- package/dist/tools/diff-summary.d.ts +12 -0
- package/dist/tools/diff.d.ts +24 -0
- package/dist/tools/doc-scan.d.ts +38 -0
- package/dist/tools/domain-detector.d.ts +6 -0
- package/dist/tools/evidence-check.d.ts +8 -0
- package/dist/tools/file-extractor.d.ts +9 -0
- package/dist/tools/generate-mutants.d.ts +15 -0
- package/dist/tools/get-approved-plan.d.ts +55 -0
- package/dist/tools/get-qa-gate-profile.d.ts +27 -0
- package/dist/tools/gitingest.d.ts +18 -0
- package/dist/tools/imports.d.ts +5 -0
- package/dist/tools/index.d.ts +66 -0
- package/dist/tools/knowledge-add.d.ts +2 -0
- package/dist/tools/knowledge-query.d.ts +5 -0
- package/dist/tools/knowledge-recall.d.ts +2 -0
- package/dist/tools/knowledge-remove.d.ts +2 -0
- package/dist/tools/knowledge-tools.integration.test.d.ts +1 -0
- package/dist/tools/lint-spec.d.ts +2 -0
- package/dist/tools/lint.d.ts +63 -0
- package/dist/tools/mutation-test.d.ts +2 -0
- package/dist/tools/mutation-test.security.test.d.ts +1 -0
- package/dist/tools/phase-complete.d.ts +25 -0
- package/dist/tools/pkg-audit.d.ts +2 -0
- package/dist/tools/placeholder-scan.d.ts +28 -0
- package/dist/tools/plugin-registration-adversarial.test.d.ts +1 -0
- package/dist/tools/pre-check-batch.d.ts +89 -0
- package/dist/tools/quality-budget.d.ts +26 -0
- package/dist/tools/repo-graph.d.ts +226 -0
- package/dist/tools/repo-map.d.ts +2 -0
- package/dist/tools/req-coverage.d.ts +47 -0
- package/dist/tools/resolve-working-directory.d.ts +35 -0
- package/dist/tools/resolve-working-directory.test.d.ts +1 -0
- package/dist/tools/retrieve-summary.d.ts +2 -0
- package/dist/tools/sast-baseline.d.ts +126 -0
- package/dist/tools/sast-scan.d.ts +87 -0
- package/dist/tools/save-plan.d.ts +95 -0
- package/dist/tools/save-plan.subdirectory-rejection.test.d.ts +1 -0
- package/dist/tools/sbom-generate.d.ts +26 -0
- package/dist/tools/schema-drift.d.ts +2 -0
- package/dist/tools/search.adversarial.test.d.ts +1 -0
- package/dist/tools/search.d.ts +29 -0
- package/dist/tools/search.test.d.ts +1 -0
- package/dist/tools/secretscan.d.ts +35 -0
- package/dist/tools/set-qa-gates.d.ts +40 -0
- package/dist/tools/suggest-patch.adversarial.test.d.ts +1 -0
- package/dist/tools/suggest-patch.d.ts +37 -0
- package/dist/tools/suggest-patch.test.d.ts +1 -0
- package/dist/tools/symbols.d.ts +21 -0
- package/dist/tools/syntax-check.d.ts +37 -0
- package/dist/tools/test-impact.d.ts +2 -0
- package/dist/tools/test-runner.d.ts +86 -0
- package/dist/tools/test-runner.security-adversarial.test.d.ts +5 -0
- package/dist/tools/todo-extract.d.ts +2 -0
- package/dist/tools/tool-names.d.ts +10 -0
- package/dist/tools/update-task-status.adversarial.test.d.ts +13 -0
- package/dist/tools/update-task-status.d.ts +114 -0
- package/dist/tools/update-task-status.gates.test.d.ts +1 -0
- package/dist/tools/update-task-status.test.d.ts +1 -0
- package/dist/tools/update-task-status.turbo-bypass.test.d.ts +1 -0
- package/dist/tools/verify-six-tools-registration.test.d.ts +9 -0
- package/dist/tools/web-search.d.ts +13 -0
- package/dist/tools/write-drift-evidence.d.ts +31 -0
- package/dist/tools/write-hallucination-evidence.d.ts +30 -0
- package/dist/tools/write-mutation-evidence.d.ts +34 -0
- package/dist/tools/write-mutation-evidence.test.d.ts +1 -0
- package/dist/tools/write-retro.d.ts +55 -0
- package/dist/transient-retry.test.d.ts +10 -0
- package/dist/types/delegation.d.ts +24 -0
- package/dist/types/events.d.ts +125 -0
- package/dist/utils/errors.d.ts +33 -0
- package/dist/utils/gitignore-warning.d.ts +17 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/merge.d.ts +5 -0
- package/dist/utils/path-security.d.ts +36 -0
- package/dist/utils/regex.d.ts +30 -0
- package/dist/utils/spec-hash.d.ts +15 -0
- package/dist/utils/tool-output.d.ts +12 -0
- package/dist/validation/task-id.d.ts +43 -0
- package/package.json +21 -14
- package/dist/architect.d.ts +0 -7
- package/dist/checkpoint.d.ts +0 -7
- package/dist/co-change-analyzer.d.ts +0 -1
- package/dist/compat.d.ts +0 -12
- package/dist/config-doctor.d.ts +0 -1
- package/dist/detector.d.ts +0 -7
- package/dist/diagnose-service.d.ts +0 -1
- package/dist/doctor.d.ts +0 -5
- package/dist/evidence-schema.d.ts +0 -2
- package/dist/evidence-service.d.ts +0 -1
- package/dist/export-service.d.ts +0 -1
- package/dist/handoff-service.d.ts +0 -1
- package/dist/history-service.d.ts +0 -1
- package/dist/hive-promoter.d.ts +0 -2
- package/dist/knowledge-migrator.d.ts +0 -2
- package/dist/knowledge-store.d.ts +0 -1
- package/dist/knowledge-types.d.ts +0 -1
- package/dist/knowledge-validator.d.ts +0 -2
- package/dist/loader.d.ts +0 -1
- package/dist/manager.d.ts +0 -1
- package/dist/models.d.ts +0 -1
- package/dist/plan-service.d.ts +0 -1
- package/dist/preflight-service.d.ts +0 -1
- package/dist/profiles.d.ts +0 -7
- package/dist/register.d.ts +0 -36
- package/dist/schema.d.ts +0 -2
- package/dist/snapshot-writer.d.ts +0 -1
- package/dist/status-service.d.ts +0 -15
- package/dist/telemetry/src/events.d.ts +0 -308
- package/dist/telemetry/src/guards.d.ts +0 -14
- package/dist/telemetry/src/index.d.ts +0 -4
- package/dist/telemetry/src/version.d.ts +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/write-retro.d.ts +0 -1
- /package/dist/{discovery.d.ts → build/discovery.d.ts} +0 -0
- /package/dist/{agents.d.ts → commands/agents.d.ts} +0 -0
- /package/dist/{analyze.d.ts → commands/analyze.d.ts} +0 -0
- /package/dist/{archive.d.ts → commands/archive.d.ts} +0 -0
- /package/dist/{benchmark.d.ts → commands/benchmark.d.ts} +0 -0
- /package/dist/{clarify.d.ts → commands/clarify.d.ts} +0 -0
- /package/dist/{curate.d.ts → commands/curate.d.ts} +0 -0
- /package/dist/{dark-matter.d.ts → commands/dark-matter.d.ts} +0 -0
- /package/dist/{diagnose.d.ts → commands/diagnose.d.ts} +0 -0
- /package/dist/{evidence.d.ts → commands/evidence.d.ts} +0 -0
- /package/dist/{export.d.ts → commands/export.d.ts} +0 -0
- /package/dist/{handoff.d.ts → commands/handoff.d.ts} +0 -0
- /package/dist/{history.d.ts → commands/history.d.ts} +0 -0
- /package/dist/{plan.d.ts → commands/plan.d.ts} +0 -0
- /package/dist/{preflight.d.ts → commands/preflight.d.ts} +0 -0
- /package/dist/{promote.d.ts → commands/promote.d.ts} +0 -0
- /package/dist/{retrieve.d.ts → commands/retrieve.d.ts} +0 -0
- /package/dist/{rollback.d.ts → commands/rollback.d.ts} +0 -0
- /package/dist/{simulate.d.ts → commands/simulate.d.ts} +0 -0
- /package/dist/{specify.d.ts → commands/specify.d.ts} +0 -0
- /package/dist/{status.d.ts → commands/status.d.ts} +0 -0
- /package/dist/{turbo.d.ts → commands/turbo.d.ts} +0 -0
- /package/dist/{write_retro.d.ts → commands/write-retro.d.ts} +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo graph storage module for persisting code dependency graphs.
|
|
3
|
+
* Stores module-level in-memory cache and safe load/save to .swarm/repo-graph.json.
|
|
4
|
+
*
|
|
5
|
+
* Security: All file operations use validateSwarmPath to reject workspace-escaping paths.
|
|
6
|
+
* Uses atomic temp+rename writes to prevent partial writes.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A node in the dependency graph representing a source file.
|
|
10
|
+
*/
|
|
11
|
+
export interface GraphNode {
|
|
12
|
+
/** Resolved absolute path to the source file */
|
|
13
|
+
filePath: string;
|
|
14
|
+
/** Normalized module name (relative path from workspace root) */
|
|
15
|
+
moduleName: string;
|
|
16
|
+
/** Exported symbols from this file */
|
|
17
|
+
exports: string[];
|
|
18
|
+
/** Imported module specifiers */
|
|
19
|
+
imports: string[];
|
|
20
|
+
/** Language/extension of the file */
|
|
21
|
+
language: string;
|
|
22
|
+
/** Last modified timestamp */
|
|
23
|
+
mtime: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An edge in the dependency graph representing a dependency relationship.
|
|
27
|
+
*/
|
|
28
|
+
export interface GraphEdge {
|
|
29
|
+
/** Source file path */
|
|
30
|
+
source: string;
|
|
31
|
+
/** Target file path (resolved) */
|
|
32
|
+
target: string;
|
|
33
|
+
/** Import specifier used */
|
|
34
|
+
importSpecifier: string;
|
|
35
|
+
/** Type of import */
|
|
36
|
+
importType: 'default' | 'named' | 'namespace' | 'require' | 'sideeffect';
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The complete dependency graph for a workspace.
|
|
40
|
+
*/
|
|
41
|
+
export interface RepoGraph {
|
|
42
|
+
/** Schema version for future compatibility */
|
|
43
|
+
schema_version: string;
|
|
44
|
+
/** Workspace root directory */
|
|
45
|
+
workspaceRoot: string;
|
|
46
|
+
/** Graph nodes keyed by resolved file path */
|
|
47
|
+
nodes: Record<string, GraphNode>;
|
|
48
|
+
/** Graph edges representing dependencies */
|
|
49
|
+
edges: GraphEdge[];
|
|
50
|
+
/** Graph metadata */
|
|
51
|
+
metadata: {
|
|
52
|
+
generatedAt: string;
|
|
53
|
+
generator: string;
|
|
54
|
+
nodeCount: number;
|
|
55
|
+
edgeCount: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Validate that a workspace directory is safe to use.
|
|
60
|
+
* Accepts both absolute and relative paths.
|
|
61
|
+
*
|
|
62
|
+
* @param workspace - The workspace directory (path, absolute or relative, e.g. "/home/user/project" or "my-project")
|
|
63
|
+
* @throws Error if the workspace is invalid
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateWorkspace(workspace: string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Validate a graph node before adding to the graph.
|
|
68
|
+
* @param node - The node to validate
|
|
69
|
+
* @throws Error if the node is invalid
|
|
70
|
+
*/
|
|
71
|
+
export declare function validateGraphNode(node: GraphNode): void;
|
|
72
|
+
/**
|
|
73
|
+
* Validate a graph edge before adding to the graph.
|
|
74
|
+
* @param edge - The edge to validate
|
|
75
|
+
* @throws Error if the edge is invalid
|
|
76
|
+
*/
|
|
77
|
+
export declare function validateGraphEdge(edge: GraphEdge): void;
|
|
78
|
+
/**
|
|
79
|
+
* Resolve a module specifier relative to a source file within a workspace.
|
|
80
|
+
*
|
|
81
|
+
* CONTRACT for bare specifiers:
|
|
82
|
+
* - Bare specifiers (e.g., 'lodash', 'zod', '@scope/pkg') return null because
|
|
83
|
+
* they require node_modules traversal to resolve, which is outside the scope
|
|
84
|
+
* of this module's responsibilities.
|
|
85
|
+
* - Callers should treat null as "unresolvable at graph-build time" and may
|
|
86
|
+
* defer resolution to runtime or external tools.
|
|
87
|
+
*
|
|
88
|
+
* CONTRACT for workspace format:
|
|
89
|
+
* - workspaceRoot is normally a relative path (e.g., "my-project") validated by
|
|
90
|
+
* validateWorkspace, but when called by buildWorkspaceGraph it may be an
|
|
91
|
+
* absolute scan root path. Both forms are accepted - the function handles
|
|
92
|
+
* path boundary checks consistently regardless of which form is provided.
|
|
93
|
+
* - sourceFile must be an absolute path
|
|
94
|
+
* - Returns absolute path if resolved, null otherwise
|
|
95
|
+
*
|
|
96
|
+
* @param workspaceRoot - The workspace root directory (relative or absolute path)
|
|
97
|
+
* @param sourceFile - The file containing the import (absolute path)
|
|
98
|
+
* @param specifier - The module specifier from the import statement
|
|
99
|
+
* @returns Resolved absolute path or null if unresolvable
|
|
100
|
+
*/
|
|
101
|
+
export declare function resolveModuleSpecifier(workspaceRoot: string, sourceFile: string, specifier: string): string | null;
|
|
102
|
+
/**
|
|
103
|
+
* Create an empty graph for a workspace.
|
|
104
|
+
* @param workspaceRoot - The workspace root directory
|
|
105
|
+
* @returns Empty RepoGraph structure
|
|
106
|
+
*/
|
|
107
|
+
export declare function createEmptyGraph(workspaceRoot: string): RepoGraph;
|
|
108
|
+
/**
|
|
109
|
+
* Add or update a node in the graph.
|
|
110
|
+
* @param graph - The graph to modify
|
|
111
|
+
* @param node - The node to add/update
|
|
112
|
+
*/
|
|
113
|
+
export declare function upsertNode(graph: RepoGraph, node: GraphNode): void;
|
|
114
|
+
/**
|
|
115
|
+
* Add an edge to the graph.
|
|
116
|
+
* @param graph - The graph to modify
|
|
117
|
+
* @param edge - The edge to add
|
|
118
|
+
*/
|
|
119
|
+
export declare function addEdge(graph: RepoGraph, edge: GraphEdge): void;
|
|
120
|
+
/**
|
|
121
|
+
* Get the cached graph for a workspace.
|
|
122
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
123
|
+
* @returns The cached graph or undefined if not cached
|
|
124
|
+
*/
|
|
125
|
+
export declare function getCachedGraph(workspace: string): RepoGraph | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Set the cached graph for a workspace.
|
|
128
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
129
|
+
* @param graph - The graph to cache
|
|
130
|
+
* @param mtime - Optional file mtime to track for cache invalidation
|
|
131
|
+
*/
|
|
132
|
+
export declare function setCachedGraph(workspace: string, graph: RepoGraph, mtime?: number): void;
|
|
133
|
+
/**
|
|
134
|
+
* Mark a workspace's cache as dirty (modified since last save).
|
|
135
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
136
|
+
*/
|
|
137
|
+
export declare function markDirty(workspace: string): void;
|
|
138
|
+
/**
|
|
139
|
+
* Check if a workspace's cache is dirty.
|
|
140
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
141
|
+
* @returns True if the cache has been modified since last save
|
|
142
|
+
*/
|
|
143
|
+
export declare function isDirty(workspace: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Clear the cache for a workspace.
|
|
146
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
147
|
+
*/
|
|
148
|
+
export declare function clearCache(workspace: string): void;
|
|
149
|
+
/**
|
|
150
|
+
* Get the validated path for the repo-graph.json file.
|
|
151
|
+
* Resolves symlinks via realpath before validation to prevent
|
|
152
|
+
* workspace-escaping attacks via symlink manipulation.
|
|
153
|
+
*
|
|
154
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
155
|
+
* @returns Absolute path to repo-graph.json
|
|
156
|
+
* @throws Error if path validation fails or resolved path escapes workspace
|
|
157
|
+
*/
|
|
158
|
+
export declare function getGraphPath(workspace: string): string;
|
|
159
|
+
/**
|
|
160
|
+
* Load the graph from .swarm/repo-graph.json.
|
|
161
|
+
* Uses the in-memory cache if available, not dirty, and file mtime unchanged.
|
|
162
|
+
*
|
|
163
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
164
|
+
* @returns The loaded graph or null if not found
|
|
165
|
+
* @throws Error if file exists but is invalid/corrupted
|
|
166
|
+
*/
|
|
167
|
+
export declare function loadGraph(workspace: string): Promise<RepoGraph | null>;
|
|
168
|
+
/**
|
|
169
|
+
* Save the graph to .swarm/repo-graph.json atomically.
|
|
170
|
+
* Uses temp file + rename pattern to prevent partial writes.
|
|
171
|
+
*
|
|
172
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
173
|
+
* @param graph - The graph to save
|
|
174
|
+
* @param options.createAtomic - If true, fails if file already exists (for atomic create)
|
|
175
|
+
* @throws Error if validation fails, write fails, or file exists when createAtomic=true
|
|
176
|
+
*/
|
|
177
|
+
export declare function saveGraph(workspace: string, graph: RepoGraph, options?: {
|
|
178
|
+
createAtomic?: boolean;
|
|
179
|
+
}): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Load or create a graph for a workspace atomically.
|
|
182
|
+
* Returns existing graph or creates a new empty one.
|
|
183
|
+
* Handles concurrent creation by treating a create-fail as "graph exists".
|
|
184
|
+
*
|
|
185
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
186
|
+
* @returns The existing or new graph
|
|
187
|
+
*/
|
|
188
|
+
export declare function loadOrCreateGraph(workspace: string): Promise<RepoGraph>;
|
|
189
|
+
/**
|
|
190
|
+
* Save the cached graph for a workspace if it's dirty.
|
|
191
|
+
*
|
|
192
|
+
* @param workspace - The workspace directory (absolute or relative path)
|
|
193
|
+
* @throws Error if workspace is dirty but cache is missing (inconsistent state)
|
|
194
|
+
* @throws Error if save fails
|
|
195
|
+
*/
|
|
196
|
+
export declare function saveIfDirty(workspace: string): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Build a complete dependency graph for a workspace by scanning all source files.
|
|
199
|
+
*
|
|
200
|
+
* The scan is deterministic: files are processed in sorted order, and edges
|
|
201
|
+
* are added in a stable order based on source file and import specifier.
|
|
202
|
+
*
|
|
203
|
+
* @param workspaceRoot - Workspace root directory (absolute or relative path)
|
|
204
|
+
* @param options - Optional scan configuration
|
|
205
|
+
* @param options.maxFileSizeBytes - Maximum file size to scan (default 1MB)
|
|
206
|
+
* @returns Complete RepoGraph with nodes and edges
|
|
207
|
+
* @throws Error if workspace validation fails
|
|
208
|
+
*/
|
|
209
|
+
export declare function buildWorkspaceGraph(workspaceRoot: string, options?: {
|
|
210
|
+
maxFileSizeBytes?: number;
|
|
211
|
+
maxFiles?: number;
|
|
212
|
+
}): RepoGraph;
|
|
213
|
+
/**
|
|
214
|
+
* Incrementally update the graph for a set of changed files.
|
|
215
|
+
* Re-scans only the specified files, updates their nodes and edges,
|
|
216
|
+
* and falls back to a full rebuild if the incremental pass cannot be validated.
|
|
217
|
+
*
|
|
218
|
+
* @param workspaceRoot - Workspace root directory (relative path)
|
|
219
|
+
* @param filePaths - Array of absolute file paths that changed
|
|
220
|
+
* @param options - Optional configuration
|
|
221
|
+
* @param options.forceRebuild - Force a full rebuild instead of incremental
|
|
222
|
+
* @returns Updated RepoGraph
|
|
223
|
+
*/
|
|
224
|
+
export declare function updateGraphForFiles(workspaceRoot: string, filePaths: string[], options?: {
|
|
225
|
+
forceRebuild?: boolean;
|
|
226
|
+
}): Promise<RepoGraph>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Requirement coverage tool for analyzing FR requirements against touched files.
|
|
3
|
+
* Reads .swarm/spec.md for FR-### requirements and checks coverage against
|
|
4
|
+
* files touched during a phase via evidence files.
|
|
5
|
+
*/
|
|
6
|
+
import type { tool } from '@opencode-ai/plugin';
|
|
7
|
+
declare const OBLIGATION_KEYWORDS: readonly ["MUST", "SHOULD", "SHALL"];
|
|
8
|
+
type ObligationLevel = (typeof OBLIGATION_KEYWORDS)[number];
|
|
9
|
+
interface Requirement {
|
|
10
|
+
id: string;
|
|
11
|
+
obligation: ObligationLevel | null;
|
|
12
|
+
text: string;
|
|
13
|
+
status: 'covered' | 'missing';
|
|
14
|
+
filesSearched: string[];
|
|
15
|
+
}
|
|
16
|
+
interface RequirementMatch {
|
|
17
|
+
id: string;
|
|
18
|
+
obligation: ObligationLevel | null;
|
|
19
|
+
text: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Extract all FR-### requirements from spec content.
|
|
23
|
+
* For each requirement, identifies obligation level (MUST/SHOULD/SHALL) and text.
|
|
24
|
+
*/
|
|
25
|
+
export declare function extractRequirements(specContent: string): RequirementMatch[];
|
|
26
|
+
/**
|
|
27
|
+
* Extract obligation level (MUST/SHOULD/SHALL) and requirement text from a line.
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractObligationAndText(id: string, lineText: string): RequirementMatch | null;
|
|
30
|
+
/**
|
|
31
|
+
* Read evidence files from .swarm/evidence/{taskId}/ directory structure.
|
|
32
|
+
* Returns list of source files that were touched during the specified phase.
|
|
33
|
+
* Evidence is stored at .swarm/evidence/<taskId>/evidence.json (e.g., 1.1, 2.3.1).
|
|
34
|
+
* Only directories with numeric task IDs matching the phase prefix are processed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readTouchedFiles(evidenceDir: string, phase: number, cwd: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Search a file for keywords from a requirement.
|
|
39
|
+
* Returns true if any keyword is found.
|
|
40
|
+
*/
|
|
41
|
+
export declare function searchFileForKeywords(filePath: string, keywords: string[], cwd: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Analyze coverage for a requirement against touched files.
|
|
44
|
+
*/
|
|
45
|
+
export declare function analyzeRequirementCoverage(requirement: RequirementMatch, touchedFiles: string[], cwd: string): Requirement;
|
|
46
|
+
export declare const req_coverage: ReturnType<typeof tool>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility for resolving working_directory across swarm tools.
|
|
3
|
+
*
|
|
4
|
+
* Tools that read .swarm/ state (plan.json, evidence/) must resolve paths
|
|
5
|
+
* relative to the actual project root, not process.cwd(). When the MCP host's
|
|
6
|
+
* CWD differs from the project root (e.g. CWD=RAGAPPv2, project=RAGAPPv3),
|
|
7
|
+
* tools that lack a working_directory parameter silently read stale data from
|
|
8
|
+
* the wrong directory.
|
|
9
|
+
*
|
|
10
|
+
* This helper provides consistent validation and resolution, matching the
|
|
11
|
+
* pattern already used by save_plan and update_task_status.
|
|
12
|
+
*/
|
|
13
|
+
export interface ResolveResult {
|
|
14
|
+
success: true;
|
|
15
|
+
directory: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ResolveError {
|
|
18
|
+
success: false;
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the effective working directory for a swarm tool.
|
|
23
|
+
*
|
|
24
|
+
* Priority: explicit working_directory param > injected directory (from createSwarmTool).
|
|
25
|
+
*
|
|
26
|
+
* When working_directory is provided, it is validated for:
|
|
27
|
+
* - Null-byte injection
|
|
28
|
+
* - Path traversal sequences (..)
|
|
29
|
+
* - Windows device paths
|
|
30
|
+
* - Existence on disk
|
|
31
|
+
*
|
|
32
|
+
* @param workingDirectory - Explicit working_directory from tool args (caller-controlled)
|
|
33
|
+
* @param fallbackDirectory - Injected directory from createSwarmTool (ctx.directory ?? process.cwd())
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveWorkingDirectory(workingDirectory: string | undefined | null, fallbackDirectory: string): ResolveResult | ResolveError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAST Baseline — phase-scoped snapshot of pre-existing security findings.
|
|
3
|
+
*
|
|
4
|
+
* Enables baseline diffing so only NEW findings (introduced since baseline capture)
|
|
5
|
+
* drive the fail verdict in subsequent sast_scan calls.
|
|
6
|
+
*
|
|
7
|
+
* Storage: .swarm/evidence/{phase}/sast-baseline.json
|
|
8
|
+
* Mirrors the phase-scoped convention used by write-drift-evidence.ts and
|
|
9
|
+
* write-hallucination-evidence.ts (path.join('evidence', String(phase), filename)
|
|
10
|
+
* passed to validateSwarmPath).
|
|
11
|
+
*
|
|
12
|
+
* Fingerprint format (stable):
|
|
13
|
+
* `${relFile}|${rule_id}|${sha256(3lineWindow).slice(0,16)}|#${occurrenceIndex}`
|
|
14
|
+
*
|
|
15
|
+
* Fingerprint format (unstable — file unreadable or path escapes workspace):
|
|
16
|
+
* `${relFile}|${rule_id}|L${line}|UNSTABLE|#${occurrenceIndex}`
|
|
17
|
+
* Unstable fingerprints are ALWAYS treated as NEW findings (fail-closed).
|
|
18
|
+
*
|
|
19
|
+
* Merge semantics:
|
|
20
|
+
* On every capture for a set of files, ALL prior fingerprints for those files
|
|
21
|
+
* are removed (full prune, engine-agnostic) before inserting current findings.
|
|
22
|
+
* This prevents stale cross-engine fingerprints from causing false-pass verdicts.
|
|
23
|
+
*/
|
|
24
|
+
import type { SastScanFinding } from './sast-scan';
|
|
25
|
+
export declare const BASELINE_SCHEMA_VERSION: "1.0.0";
|
|
26
|
+
/** Maximum findings to store in baseline (heuristic — open for tuning). */
|
|
27
|
+
export declare const MAX_BASELINE_FINDINGS = 2000;
|
|
28
|
+
export interface SastBaselineFile {
|
|
29
|
+
schema_version: '1.0.0';
|
|
30
|
+
phase: number;
|
|
31
|
+
created_at: string;
|
|
32
|
+
updated_at: string;
|
|
33
|
+
engine: 'tier_a' | 'tier_a+tier_b';
|
|
34
|
+
/** Canonical relative paths of files indexed into this baseline. */
|
|
35
|
+
files_indexed: string[];
|
|
36
|
+
/** Fingerprint strings for all indexed findings. */
|
|
37
|
+
fingerprints: string[];
|
|
38
|
+
/** Full findings snapshot (for auditing / debugging). */
|
|
39
|
+
findings_snapshot: SastScanFinding[];
|
|
40
|
+
/** True if the snapshot was truncated at MAX_BASELINE_FINDINGS. */
|
|
41
|
+
truncated: boolean;
|
|
42
|
+
}
|
|
43
|
+
export type LoadBaselineResult = {
|
|
44
|
+
status: 'found';
|
|
45
|
+
fingerprints: Set<string>;
|
|
46
|
+
bundle: SastBaselineFile;
|
|
47
|
+
} | {
|
|
48
|
+
status: 'not_found';
|
|
49
|
+
} | {
|
|
50
|
+
status: 'invalid_schema';
|
|
51
|
+
errors: string[];
|
|
52
|
+
};
|
|
53
|
+
export interface FingerprintResult {
|
|
54
|
+
fingerprint: string;
|
|
55
|
+
/** False when the file was unreadable or the path escapes the workspace. */
|
|
56
|
+
stable: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface IndexedFinding {
|
|
59
|
+
finding: SastScanFinding;
|
|
60
|
+
index: number;
|
|
61
|
+
stable: boolean;
|
|
62
|
+
fingerprint: string;
|
|
63
|
+
}
|
|
64
|
+
export type CaptureResult = {
|
|
65
|
+
status: 'written';
|
|
66
|
+
path: string;
|
|
67
|
+
fingerprint_count: number;
|
|
68
|
+
} | {
|
|
69
|
+
status: 'merged';
|
|
70
|
+
path: string;
|
|
71
|
+
fingerprint_count: number;
|
|
72
|
+
} | {
|
|
73
|
+
status: 'error';
|
|
74
|
+
message: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Return the canonical relative path for a finding file.
|
|
78
|
+
* Mirrors the normalization in pre-check-batch.ts classifySastFindings.
|
|
79
|
+
*/
|
|
80
|
+
export declare function normalizeFindingPath(directory: string, file: string): string;
|
|
81
|
+
/**
|
|
82
|
+
* Compute a stable or unstable fingerprint for a single finding.
|
|
83
|
+
*
|
|
84
|
+
* Stable uses a 3-line content window (N-1, N, N+1) so the fingerprint
|
|
85
|
+
* survives line-number shifts caused by insertions above the finding.
|
|
86
|
+
*
|
|
87
|
+
* Unstable is produced when the file cannot be read or the path escapes
|
|
88
|
+
* the workspace — such findings are always classified NEW (fail-closed).
|
|
89
|
+
*/
|
|
90
|
+
export declare function fingerprintFinding(finding: SastScanFinding, directory: string, occurrenceIndex: number): FingerprintResult;
|
|
91
|
+
/**
|
|
92
|
+
* Assign occurrence indices to a batch of findings.
|
|
93
|
+
*
|
|
94
|
+
* Two findings that produce the same (relFile, rule_id, contentHash) tuple
|
|
95
|
+
* — e.g., copy-pasted vulnerable lines — receive different indices so they
|
|
96
|
+
* get distinct fingerprints and can be individually classified.
|
|
97
|
+
*/
|
|
98
|
+
export declare function assignOccurrenceIndices(findings: SastScanFinding[], directory: string): IndexedFinding[];
|
|
99
|
+
/**
|
|
100
|
+
* Capture or merge SAST findings into the phase-scoped baseline.
|
|
101
|
+
*
|
|
102
|
+
* Merge semantics:
|
|
103
|
+
* For every file in `scannedFiles`, ALL prior fingerprints for that file are
|
|
104
|
+
* removed from the baseline before inserting the current scan's fingerprints.
|
|
105
|
+
* This full-prune (engine-agnostic) prevents stale cross-engine entries from
|
|
106
|
+
* causing false-pass verdicts on later full-engine diff scans.
|
|
107
|
+
*
|
|
108
|
+
* Severity threshold:
|
|
109
|
+
* Callers MUST pass ALL findings regardless of severity threshold so the
|
|
110
|
+
* baseline captures the full pre-existing surface. Threshold filtering is
|
|
111
|
+
* the diff caller's responsibility.
|
|
112
|
+
*
|
|
113
|
+
* Idempotency:
|
|
114
|
+
* Calling twice with identical inputs produces an identical baseline file.
|
|
115
|
+
* Calling with a new file set adds/replaces only those files' fingerprints.
|
|
116
|
+
*/
|
|
117
|
+
export declare function captureOrMergeBaseline(directory: string, phase: number, findings: SastScanFinding[], engine: 'tier_a' | 'tier_a+tier_b', scannedFiles: string[], opts?: {
|
|
118
|
+
force?: boolean;
|
|
119
|
+
}): Promise<CaptureResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Load the SAST baseline for a given phase.
|
|
122
|
+
*
|
|
123
|
+
* Returns 'not_found' when no baseline file exists (first run for phase).
|
|
124
|
+
* Returns 'invalid_schema' when the file is present but unparseable.
|
|
125
|
+
*/
|
|
126
|
+
export declare function loadBaseline(directory: string, phase: number): LoadBaselineResult;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAST Scan Tool - Static Application Security Testing
|
|
3
|
+
* Integrates Tier A rules (offline) and optional Semgrep (Tier B)
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
6
|
+
import type { PluginConfig } from '../config';
|
|
7
|
+
import type { EvidenceVerdict } from '../config/evidence-schema';
|
|
8
|
+
export interface SastScanInput {
|
|
9
|
+
/** List of files to scan */
|
|
10
|
+
changed_files: string[];
|
|
11
|
+
/** Minimum severity that causes failure (default: 'medium') */
|
|
12
|
+
severity_threshold?: 'low' | 'medium' | 'high' | 'critical';
|
|
13
|
+
/**
|
|
14
|
+
* When true, capture/merge a phase-scoped baseline snapshot and return
|
|
15
|
+
* status:'baseline_captured'. Subsequent scans with the same phase will
|
|
16
|
+
* diff against this baseline so only NEW findings drive the fail verdict.
|
|
17
|
+
*
|
|
18
|
+
* Capture mode ignores severity_threshold — all severities are recorded.
|
|
19
|
+
* Requires `phase` to be provided.
|
|
20
|
+
*/
|
|
21
|
+
capture_baseline?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Current phase number (positive integer, >= 1). Required when
|
|
24
|
+
* capture_baseline is true. When provided without capture_baseline, enables
|
|
25
|
+
* baseline diff mode: only findings absent from the phase baseline fail.
|
|
26
|
+
*/
|
|
27
|
+
phase?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface SastScanResult {
|
|
30
|
+
/** Overall verdict: pass if no findings above threshold, fail otherwise */
|
|
31
|
+
verdict: EvidenceVerdict;
|
|
32
|
+
/** Array of security findings */
|
|
33
|
+
findings: SastScanFinding[];
|
|
34
|
+
/** Summary information */
|
|
35
|
+
summary: {
|
|
36
|
+
/** Engine used for scanning */
|
|
37
|
+
engine: 'tier_a' | 'tier_a+tier_b';
|
|
38
|
+
/** Number of files scanned */
|
|
39
|
+
files_scanned: number;
|
|
40
|
+
/** Total number of findings */
|
|
41
|
+
findings_count: number;
|
|
42
|
+
/** Breakdown of findings by severity */
|
|
43
|
+
findings_by_severity: {
|
|
44
|
+
critical: number;
|
|
45
|
+
high: number;
|
|
46
|
+
medium: number;
|
|
47
|
+
low: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** 'baseline_captured' when capture_baseline:true succeeded */
|
|
51
|
+
status?: 'baseline_captured' | 'baseline_merged';
|
|
52
|
+
/** Number of findings recorded in the baseline (capture mode only) */
|
|
53
|
+
finding_count?: number;
|
|
54
|
+
/** Findings NOT present in the baseline (diff mode only) */
|
|
55
|
+
new_findings?: SastScanFinding[];
|
|
56
|
+
/** Findings that match the baseline (diff mode only) */
|
|
57
|
+
pre_existing_findings?: SastScanFinding[];
|
|
58
|
+
/** True when a baseline was loaded and diff mode was active */
|
|
59
|
+
baseline_used?: boolean;
|
|
60
|
+
/** True when pre_existing_findings were truncated to fit result limits */
|
|
61
|
+
truncated_pre_existing?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface SastScanFinding {
|
|
64
|
+
rule_id: string;
|
|
65
|
+
severity: 'critical' | 'high' | 'medium' | 'low';
|
|
66
|
+
message: string;
|
|
67
|
+
location: {
|
|
68
|
+
file: string;
|
|
69
|
+
line: number;
|
|
70
|
+
column?: number;
|
|
71
|
+
};
|
|
72
|
+
remediation?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* SAST Scan tool - Static Application Security Testing
|
|
76
|
+
* Scans changed files for security vulnerabilities using:
|
|
77
|
+
* - Tier A: Built-in pattern-based rules (always runs)
|
|
78
|
+
* - Tier B: Semgrep (optional, if available on PATH)
|
|
79
|
+
*/
|
|
80
|
+
export declare function sastScan(input: SastScanInput, directory: string, config?: PluginConfig): Promise<SastScanResult>;
|
|
81
|
+
/**
|
|
82
|
+
* SAST Scan tool - Static Application Security Testing
|
|
83
|
+
* Scans changed files for security vulnerabilities using:
|
|
84
|
+
* - Tier A: Built-in pattern-based rules (always runs)
|
|
85
|
+
* - Tier B: Semgrep (optional, if available on PATH)
|
|
86
|
+
*/
|
|
87
|
+
export declare const sast_scan: ToolDefinition;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Save plan tool for persisting validated implementation plans.
|
|
3
|
+
* Allows the Architect agent to save structured plans to .swarm/plan.json and .swarm/plan.md.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolDefinition } from '@opencode-ai/plugin/tool';
|
|
6
|
+
/**
|
|
7
|
+
* Arguments for the save_plan tool
|
|
8
|
+
*/
|
|
9
|
+
export interface SavePlanArgs {
|
|
10
|
+
title: string;
|
|
11
|
+
swarm_id: string;
|
|
12
|
+
phases: Array<{
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
tasks: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
description: string;
|
|
18
|
+
size?: 'small' | 'medium' | 'large';
|
|
19
|
+
depends?: string[];
|
|
20
|
+
acceptance?: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Must be the project root directory. When provided, it anchors all .swarm directory
|
|
25
|
+
* creation and plan file operations to the project root (issue #577).
|
|
26
|
+
* Omit to use the fallback directory (injected by createSwarmTool, typically process.cwd()).
|
|
27
|
+
*/
|
|
28
|
+
working_directory?: string;
|
|
29
|
+
/**
|
|
30
|
+
* When true, all task statuses are reset to 'pending' and existing completed
|
|
31
|
+
* statuses are NOT preserved. Use this when creating a fresh revision of a
|
|
32
|
+
* plan where prior completion state should no longer apply (e.g., re-planning
|
|
33
|
+
* after a failed phase). Defaults to false (existing statuses preserved).
|
|
34
|
+
*/
|
|
35
|
+
reset_statuses?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Architect-facing concurrency controls for this plan.
|
|
38
|
+
* When execution_profile.locked is true the profile is immutable — subsequent
|
|
39
|
+
* save_plan calls that try to change it will be rejected (fail-closed).
|
|
40
|
+
* Omit to leave the current profile unchanged.
|
|
41
|
+
*/
|
|
42
|
+
execution_profile?: {
|
|
43
|
+
parallelization_enabled?: boolean;
|
|
44
|
+
max_concurrent_tasks?: number;
|
|
45
|
+
council_parallel?: boolean;
|
|
46
|
+
locked?: boolean;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Result from executing save_plan
|
|
51
|
+
*/
|
|
52
|
+
export interface SavePlanResult {
|
|
53
|
+
success: boolean;
|
|
54
|
+
message: string;
|
|
55
|
+
plan_path?: string;
|
|
56
|
+
phases_count?: number;
|
|
57
|
+
tasks_count?: number;
|
|
58
|
+
errors?: string[];
|
|
59
|
+
warnings?: string[];
|
|
60
|
+
recovery_guidance?: string;
|
|
61
|
+
/** The resolved execution_profile that was persisted, if any. */
|
|
62
|
+
execution_profile?: {
|
|
63
|
+
parallelization_enabled: boolean;
|
|
64
|
+
max_concurrent_tasks: number;
|
|
65
|
+
council_parallel: boolean;
|
|
66
|
+
locked: boolean;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Detect template placeholder content (e.g., [task], [Project], [description], [N]).
|
|
71
|
+
* These patterns indicate the LLM reproduced template examples literally rather than
|
|
72
|
+
* filling in real content from the specification.
|
|
73
|
+
* @param args - The save plan arguments to validate
|
|
74
|
+
* @returns Array of issue strings describing found placeholders
|
|
75
|
+
*/
|
|
76
|
+
export declare function detectPlaceholderContent(args: SavePlanArgs): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Validate target workspace path.
|
|
79
|
+
* Rejects missing, empty, whitespace-only, and traversal-style paths.
|
|
80
|
+
* @param target - The target workspace path to validate
|
|
81
|
+
* @param source - Description of the source (for error messages)
|
|
82
|
+
* @returns Error message if invalid, undefined if valid
|
|
83
|
+
*/
|
|
84
|
+
export declare function validateTargetWorkspace(target: string | undefined, source: string): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Execute the save_plan tool.
|
|
87
|
+
* Validates for placeholder content, builds a Plan object, and saves to disk.
|
|
88
|
+
* @param args - The save plan arguments
|
|
89
|
+
* @returns SavePlanResult with success status and details
|
|
90
|
+
*/
|
|
91
|
+
export declare function executeSavePlan(args: SavePlanArgs, fallbackDir?: string): Promise<SavePlanResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Tool definition for save_plan
|
|
94
|
+
*/
|
|
95
|
+
export declare const save_plan: ToolDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SBOM Generate Tool
|
|
3
|
+
*
|
|
4
|
+
* Generates Software Bill of Materials (SBOM) by scanning project
|
|
5
|
+
* for manifest/lock files and generating CycloneDX format output.
|
|
6
|
+
*/
|
|
7
|
+
import type { tool } from '@opencode-ai/plugin';
|
|
8
|
+
export interface SbomGenerateInput {
|
|
9
|
+
/** Scope of the scan: 'changed' for modified files only, 'all' for entire project */
|
|
10
|
+
scope: 'changed' | 'all';
|
|
11
|
+
/** Optional output directory (default: .swarm/evidence/sbom/) */
|
|
12
|
+
output_dir?: string;
|
|
13
|
+
/** Required if scope='changed': list of changed files */
|
|
14
|
+
changed_files?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface SbomGenerateResult {
|
|
17
|
+
/** Verdict: 'pass' if SBOM generated successfully, 'skip' if no manifests found */
|
|
18
|
+
verdict: 'pass' | 'skip';
|
|
19
|
+
/** Array of manifest/lock file paths discovered */
|
|
20
|
+
files: string[];
|
|
21
|
+
/** Number of components in the SBOM */
|
|
22
|
+
components_count: number;
|
|
23
|
+
/** Path to the generated SBOM file */
|
|
24
|
+
output_path: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const sbom_generate: ReturnType<typeof tool>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|