opencode-telos 1.0.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/README.md +927 -0
- package/dist/code-intelligence/analyzer.d.ts +9 -0
- package/dist/code-intelligence/analyzer.d.ts.map +1 -0
- package/dist/code-intelligence/analyzer.js +321 -0
- package/dist/code-intelligence/analyzer.js.map +1 -0
- package/dist/code-intelligence/ast/cache.d.ts +16 -0
- package/dist/code-intelligence/ast/cache.d.ts.map +1 -0
- package/dist/code-intelligence/ast/cache.js +44 -0
- package/dist/code-intelligence/ast/cache.js.map +1 -0
- package/dist/code-intelligence/ast/common.d.ts +8 -0
- package/dist/code-intelligence/ast/common.d.ts.map +1 -0
- package/dist/code-intelligence/ast/common.js +42 -0
- package/dist/code-intelligence/ast/common.js.map +1 -0
- package/dist/code-intelligence/ast/component.d.ts +10 -0
- package/dist/code-intelligence/ast/component.d.ts.map +1 -0
- package/dist/code-intelligence/ast/component.js +38 -0
- package/dist/code-intelligence/ast/component.js.map +1 -0
- package/dist/code-intelligence/ast/fallback.d.ts +9 -0
- package/dist/code-intelligence/ast/fallback.d.ts.map +1 -0
- package/dist/code-intelligence/ast/fallback.js +38 -0
- package/dist/code-intelligence/ast/fallback.js.map +1 -0
- package/dist/code-intelligence/ast/index.d.ts +5 -0
- package/dist/code-intelligence/ast/index.d.ts.map +1 -0
- package/dist/code-intelligence/ast/index.js +5 -0
- package/dist/code-intelligence/ast/index.js.map +1 -0
- package/dist/code-intelligence/ast/ir.d.ts +72 -0
- package/dist/code-intelligence/ast/ir.d.ts.map +1 -0
- package/dist/code-intelligence/ast/ir.js +2 -0
- package/dist/code-intelligence/ast/ir.js.map +1 -0
- package/dist/code-intelligence/ast/metrics.d.ts +25 -0
- package/dist/code-intelligence/ast/metrics.d.ts.map +1 -0
- package/dist/code-intelligence/ast/metrics.js +38 -0
- package/dist/code-intelligence/ast/metrics.js.map +1 -0
- package/dist/code-intelligence/ast/registry.d.ts +5 -0
- package/dist/code-intelligence/ast/registry.d.ts.map +1 -0
- package/dist/code-intelligence/ast/registry.js +22 -0
- package/dist/code-intelligence/ast/registry.js.map +1 -0
- package/dist/code-intelligence/ast/tree-sitter.d.ts +8 -0
- package/dist/code-intelligence/ast/tree-sitter.d.ts.map +1 -0
- package/dist/code-intelligence/ast/tree-sitter.js +247 -0
- package/dist/code-intelligence/ast/tree-sitter.js.map +1 -0
- package/dist/code-intelligence/ast/typescript.d.ts +8 -0
- package/dist/code-intelligence/ast/typescript.d.ts.map +1 -0
- package/dist/code-intelligence/ast/typescript.js +147 -0
- package/dist/code-intelligence/ast/typescript.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/server.d.ts +27 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +67 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/opencode/hooks.d.ts +9 -0
- package/dist/opencode/hooks.d.ts.map +1 -0
- package/dist/opencode/hooks.js +583 -0
- package/dist/opencode/hooks.js.map +1 -0
- package/dist/opencode/router/categories.d.ts +31 -0
- package/dist/opencode/router/categories.d.ts.map +1 -0
- package/dist/opencode/router/categories.js +165 -0
- package/dist/opencode/router/categories.js.map +1 -0
- package/dist/opencode/router/embeddings.d.ts +41 -0
- package/dist/opencode/router/embeddings.d.ts.map +1 -0
- package/dist/opencode/router/embeddings.js +136 -0
- package/dist/opencode/router/embeddings.js.map +1 -0
- package/dist/opencode/router/graph-state-snapshot.d.ts +35 -0
- package/dist/opencode/router/graph-state-snapshot.d.ts.map +1 -0
- package/dist/opencode/router/graph-state-snapshot.js +129 -0
- package/dist/opencode/router/graph-state-snapshot.js.map +1 -0
- package/dist/opencode/router/index.d.ts +21 -0
- package/dist/opencode/router/index.d.ts.map +1 -0
- package/dist/opencode/router/index.js +23 -0
- package/dist/opencode/router/index.js.map +1 -0
- package/dist/opencode/router/intent-classifier.d.ts +35 -0
- package/dist/opencode/router/intent-classifier.d.ts.map +1 -0
- package/dist/opencode/router/intent-classifier.js +108 -0
- package/dist/opencode/router/intent-classifier.js.map +1 -0
- package/dist/opencode/router/semantic-nudge.d.ts +42 -0
- package/dist/opencode/router/semantic-nudge.d.ts.map +1 -0
- package/dist/opencode/router/semantic-nudge.js +73 -0
- package/dist/opencode/router/semantic-nudge.js.map +1 -0
- package/dist/opencode/router/state-gate.d.ts +25 -0
- package/dist/opencode/router/state-gate.d.ts.map +1 -0
- package/dist/opencode/router/state-gate.js +178 -0
- package/dist/opencode/router/state-gate.js.map +1 -0
- package/dist/opencode/router/tool-embeddings.d.ts +36 -0
- package/dist/opencode/router/tool-embeddings.d.ts.map +1 -0
- package/dist/opencode/router/tool-embeddings.js +140 -0
- package/dist/opencode/router/tool-embeddings.js.map +1 -0
- package/dist/opencode/router/tool-registry.d.ts +45 -0
- package/dist/opencode/router/tool-registry.d.ts.map +1 -0
- package/dist/opencode/router/tool-registry.js +103 -0
- package/dist/opencode/router/tool-registry.js.map +1 -0
- package/dist/opencode/router/tool-taxonomy.d.ts +51 -0
- package/dist/opencode/router/tool-taxonomy.d.ts.map +1 -0
- package/dist/opencode/router/tool-taxonomy.js +250 -0
- package/dist/opencode/router/tool-taxonomy.js.map +1 -0
- package/dist/opencode/router/tools-composite.d.ts +21 -0
- package/dist/opencode/router/tools-composite.d.ts.map +1 -0
- package/dist/opencode/router/tools-composite.js +684 -0
- package/dist/opencode/router/tools-composite.js.map +1 -0
- package/dist/opencode/shell-hooks.d.ts +7 -0
- package/dist/opencode/shell-hooks.d.ts.map +1 -0
- package/dist/opencode/shell-hooks.js +96 -0
- package/dist/opencode/shell-hooks.js.map +1 -0
- package/dist/opencode/system-prompt.d.ts +10 -0
- package/dist/opencode/system-prompt.d.ts.map +1 -0
- package/dist/opencode/system-prompt.js +600 -0
- package/dist/opencode/system-prompt.js.map +1 -0
- package/dist/opencode/tools.d.ts +8 -0
- package/dist/opencode/tools.d.ts.map +1 -0
- package/dist/opencode/tools.js +3731 -0
- package/dist/opencode/tools.js.map +1 -0
- package/dist/opencode/workflows/chains.d.ts +52 -0
- package/dist/opencode/workflows/chains.d.ts.map +1 -0
- package/dist/opencode/workflows/chains.js +170 -0
- package/dist/opencode/workflows/chains.js.map +1 -0
- package/dist/opencode/workflows/executor.d.ts +52 -0
- package/dist/opencode/workflows/executor.d.ts.map +1 -0
- package/dist/opencode/workflows/executor.js +130 -0
- package/dist/opencode/workflows/executor.js.map +1 -0
- package/dist/opencode/workflows/index.d.ts +14 -0
- package/dist/opencode/workflows/index.d.ts.map +1 -0
- package/dist/opencode/workflows/index.js +15 -0
- package/dist/opencode/workflows/index.js.map +1 -0
- package/dist/opencode/workflows/tools-workflow.d.ts +24 -0
- package/dist/opencode/workflows/tools-workflow.d.ts.map +1 -0
- package/dist/opencode/workflows/tools-workflow.js +85 -0
- package/dist/opencode/workflows/tools-workflow.js.map +1 -0
- package/dist/opencode/workflows/types.d.ts +32 -0
- package/dist/opencode/workflows/types.d.ts.map +1 -0
- package/dist/opencode/workflows/types.js +13 -0
- package/dist/opencode/workflows/types.js.map +1 -0
- package/dist/sdd/analysis/compliance.d.ts +30 -0
- package/dist/sdd/analysis/compliance.d.ts.map +1 -0
- package/dist/sdd/analysis/compliance.js +251 -0
- package/dist/sdd/analysis/compliance.js.map +1 -0
- package/dist/sdd/analysis/scalability.d.ts +15 -0
- package/dist/sdd/analysis/scalability.d.ts.map +1 -0
- package/dist/sdd/analysis/scalability.js +72 -0
- package/dist/sdd/analysis/scalability.js.map +1 -0
- package/dist/sdd/analysis/security.d.ts +25 -0
- package/dist/sdd/analysis/security.d.ts.map +1 -0
- package/dist/sdd/analysis/security.js +94 -0
- package/dist/sdd/analysis/security.js.map +1 -0
- package/dist/sdd/brownfield/scanner.d.ts +31 -0
- package/dist/sdd/brownfield/scanner.d.ts.map +1 -0
- package/dist/sdd/brownfield/scanner.js +228 -0
- package/dist/sdd/brownfield/scanner.js.map +1 -0
- package/dist/sdd/cache/manager.d.ts +237 -0
- package/dist/sdd/cache/manager.d.ts.map +1 -0
- package/dist/sdd/cache/manager.js +770 -0
- package/dist/sdd/cache/manager.js.map +1 -0
- package/dist/sdd/cache/snapshot-store.d.ts +39 -0
- package/dist/sdd/cache/snapshot-store.d.ts.map +1 -0
- package/dist/sdd/cache/snapshot-store.js +156 -0
- package/dist/sdd/cache/snapshot-store.js.map +1 -0
- package/dist/sdd/changes/manager.d.ts +58 -0
- package/dist/sdd/changes/manager.d.ts.map +1 -0
- package/dist/sdd/changes/manager.js +235 -0
- package/dist/sdd/changes/manager.js.map +1 -0
- package/dist/sdd/cicd/generators.d.ts +16 -0
- package/dist/sdd/cicd/generators.d.ts.map +1 -0
- package/dist/sdd/cicd/generators.js +1042 -0
- package/dist/sdd/cicd/generators.js.map +1 -0
- package/dist/sdd/code-quality/complexity.d.ts +38 -0
- package/dist/sdd/code-quality/complexity.d.ts.map +1 -0
- package/dist/sdd/code-quality/complexity.js +161 -0
- package/dist/sdd/code-quality/complexity.js.map +1 -0
- package/dist/sdd/code-quality/conventions.d.ts +33 -0
- package/dist/sdd/code-quality/conventions.d.ts.map +1 -0
- package/dist/sdd/code-quality/conventions.js +193 -0
- package/dist/sdd/code-quality/conventions.js.map +1 -0
- package/dist/sdd/code-quality/dependencies.d.ts +27 -0
- package/dist/sdd/code-quality/dependencies.d.ts.map +1 -0
- package/dist/sdd/code-quality/dependencies.js +142 -0
- package/dist/sdd/code-quality/dependencies.js.map +1 -0
- package/dist/sdd/code-quality/import-analyzer.d.ts +49 -0
- package/dist/sdd/code-quality/import-analyzer.d.ts.map +1 -0
- package/dist/sdd/code-quality/import-analyzer.js +213 -0
- package/dist/sdd/code-quality/import-analyzer.js.map +1 -0
- package/dist/sdd/code-quality/metrics.d.ts +35 -0
- package/dist/sdd/code-quality/metrics.d.ts.map +1 -0
- package/dist/sdd/code-quality/metrics.js +172 -0
- package/dist/sdd/code-quality/metrics.js.map +1 -0
- package/dist/sdd/code-quality/smells.d.ts +38 -0
- package/dist/sdd/code-quality/smells.d.ts.map +1 -0
- package/dist/sdd/code-quality/smells.js +319 -0
- package/dist/sdd/code-quality/smells.js.map +1 -0
- package/dist/sdd/code-quality/symbol-parser.d.ts +28 -0
- package/dist/sdd/code-quality/symbol-parser.d.ts.map +1 -0
- package/dist/sdd/code-quality/symbol-parser.js +230 -0
- package/dist/sdd/code-quality/symbol-parser.js.map +1 -0
- package/dist/sdd/code-quality/usage-tracker.d.ts +59 -0
- package/dist/sdd/code-quality/usage-tracker.d.ts.map +1 -0
- package/dist/sdd/code-quality/usage-tracker.js +402 -0
- package/dist/sdd/code-quality/usage-tracker.js.map +1 -0
- package/dist/sdd/code-quality/utils.d.ts +6 -0
- package/dist/sdd/code-quality/utils.d.ts.map +1 -0
- package/dist/sdd/code-quality/utils.js +14 -0
- package/dist/sdd/code-quality/utils.js.map +1 -0
- package/dist/sdd/codegen/generator.d.ts +42 -0
- package/dist/sdd/codegen/generator.d.ts.map +1 -0
- package/dist/sdd/codegen/generator.js +1023 -0
- package/dist/sdd/codegen/generator.js.map +1 -0
- package/dist/sdd/constitution/validator.d.ts +37 -0
- package/dist/sdd/constitution/validator.d.ts.map +1 -0
- package/dist/sdd/constitution/validator.js +192 -0
- package/dist/sdd/constitution/validator.js.map +1 -0
- package/dist/sdd/cost/estimator.d.ts +31 -0
- package/dist/sdd/cost/estimator.d.ts.map +1 -0
- package/dist/sdd/cost/estimator.js +92 -0
- package/dist/sdd/cost/estimator.js.map +1 -0
- package/dist/sdd/coverage/tracker.d.ts +47 -0
- package/dist/sdd/coverage/tracker.d.ts.map +1 -0
- package/dist/sdd/coverage/tracker.js +251 -0
- package/dist/sdd/coverage/tracker.js.map +1 -0
- package/dist/sdd/disaster/recovery.d.ts +11 -0
- package/dist/sdd/disaster/recovery.d.ts.map +1 -0
- package/dist/sdd/disaster/recovery.js +55 -0
- package/dist/sdd/disaster/recovery.js.map +1 -0
- package/dist/sdd/discovery/adaptive.d.ts +14 -0
- package/dist/sdd/discovery/adaptive.d.ts.map +1 -0
- package/dist/sdd/discovery/adaptive.js +145 -0
- package/dist/sdd/discovery/adaptive.js.map +1 -0
- package/dist/sdd/discovery/briefing-analyzer.d.ts +66 -0
- package/dist/sdd/discovery/briefing-analyzer.d.ts.map +1 -0
- package/dist/sdd/discovery/briefing-analyzer.js +672 -0
- package/dist/sdd/discovery/briefing-analyzer.js.map +1 -0
- package/dist/sdd/discovery/briefing.d.ts +109 -0
- package/dist/sdd/discovery/briefing.d.ts.map +1 -0
- package/dist/sdd/discovery/briefing.js +617 -0
- package/dist/sdd/discovery/briefing.js.map +1 -0
- package/dist/sdd/discovery/graph-builder.d.ts +10 -0
- package/dist/sdd/discovery/graph-builder.d.ts.map +1 -0
- package/dist/sdd/discovery/graph-builder.js +510 -0
- package/dist/sdd/discovery/graph-builder.js.map +1 -0
- package/dist/sdd/documentation/generator.d.ts +7 -0
- package/dist/sdd/documentation/generator.d.ts.map +1 -0
- package/dist/sdd/documentation/generator.js +119 -0
- package/dist/sdd/documentation/generator.js.map +1 -0
- package/dist/sdd/domain/types.d.ts +460 -0
- package/dist/sdd/domain/types.d.ts.map +1 -0
- package/dist/sdd/domain/types.js +25 -0
- package/dist/sdd/domain/types.js.map +1 -0
- package/dist/sdd/drift/detector.d.ts +28 -0
- package/dist/sdd/drift/detector.d.ts.map +1 -0
- package/dist/sdd/drift/detector.js +379 -0
- package/dist/sdd/drift/detector.js.map +1 -0
- package/dist/sdd/drift/exclusion.d.ts +54 -0
- package/dist/sdd/drift/exclusion.d.ts.map +1 -0
- package/dist/sdd/drift/exclusion.js +179 -0
- package/dist/sdd/drift/exclusion.js.map +1 -0
- package/dist/sdd/drift/signals.d.ts +52 -0
- package/dist/sdd/drift/signals.d.ts.map +1 -0
- package/dist/sdd/drift/signals.js +470 -0
- package/dist/sdd/drift/signals.js.map +1 -0
- package/dist/sdd/enforcement/interceptor.d.ts +47 -0
- package/dist/sdd/enforcement/interceptor.d.ts.map +1 -0
- package/dist/sdd/enforcement/interceptor.js +365 -0
- package/dist/sdd/enforcement/interceptor.js.map +1 -0
- package/dist/sdd/enforcement/workflow-tracker.d.ts +66 -0
- package/dist/sdd/enforcement/workflow-tracker.d.ts.map +1 -0
- package/dist/sdd/enforcement/workflow-tracker.js +229 -0
- package/dist/sdd/enforcement/workflow-tracker.js.map +1 -0
- package/dist/sdd/graph/engine.d.ts +44 -0
- package/dist/sdd/graph/engine.d.ts.map +1 -0
- package/dist/sdd/graph/engine.js +203 -0
- package/dist/sdd/graph/engine.js.map +1 -0
- package/dist/sdd/graph/index.d.ts +160 -0
- package/dist/sdd/graph/index.d.ts.map +1 -0
- package/dist/sdd/graph/index.js +624 -0
- package/dist/sdd/graph/index.js.map +1 -0
- package/dist/sdd/graph/integrity-guard.d.ts +129 -0
- package/dist/sdd/graph/integrity-guard.d.ts.map +1 -0
- package/dist/sdd/graph/integrity-guard.js +263 -0
- package/dist/sdd/graph/integrity-guard.js.map +1 -0
- package/dist/sdd/graph/integrity.d.ts +79 -0
- package/dist/sdd/graph/integrity.d.ts.map +1 -0
- package/dist/sdd/graph/integrity.js +462 -0
- package/dist/sdd/graph/integrity.js.map +1 -0
- package/dist/sdd/graph/pruner.d.ts +27 -0
- package/dist/sdd/graph/pruner.d.ts.map +1 -0
- package/dist/sdd/graph/pruner.js +203 -0
- package/dist/sdd/graph/pruner.js.map +1 -0
- package/dist/sdd/graph/traverse.d.ts +43 -0
- package/dist/sdd/graph/traverse.d.ts.map +1 -0
- package/dist/sdd/graph/traverse.js +265 -0
- package/dist/sdd/graph/traverse.js.map +1 -0
- package/dist/sdd/incidents/manager.d.ts +10 -0
- package/dist/sdd/incidents/manager.d.ts.map +1 -0
- package/dist/sdd/incidents/manager.js +63 -0
- package/dist/sdd/incidents/manager.js.map +1 -0
- package/dist/sdd/knowledge/transfer.d.ts +24 -0
- package/dist/sdd/knowledge/transfer.d.ts.map +1 -0
- package/dist/sdd/knowledge/transfer.js +94 -0
- package/dist/sdd/knowledge/transfer.js.map +1 -0
- package/dist/sdd/migrations/fixes.d.ts +2 -0
- package/dist/sdd/migrations/fixes.d.ts.map +1 -0
- package/dist/sdd/migrations/fixes.js +159 -0
- package/dist/sdd/migrations/fixes.js.map +1 -0
- package/dist/sdd/migrations/index.d.ts +2 -0
- package/dist/sdd/migrations/index.d.ts.map +1 -0
- package/dist/sdd/migrations/index.js +5 -0
- package/dist/sdd/migrations/index.js.map +1 -0
- package/dist/sdd/migrations/migration-runner.d.ts +41 -0
- package/dist/sdd/migrations/migration-runner.d.ts.map +1 -0
- package/dist/sdd/migrations/migration-runner.js +91 -0
- package/dist/sdd/migrations/migration-runner.js.map +1 -0
- package/dist/sdd/monitoring/setup.d.ts +40 -0
- package/dist/sdd/monitoring/setup.d.ts.map +1 -0
- package/dist/sdd/monitoring/setup.js +177 -0
- package/dist/sdd/monitoring/setup.js.map +1 -0
- package/dist/sdd/monitoring/telemetry.d.ts +18 -0
- package/dist/sdd/monitoring/telemetry.d.ts.map +1 -0
- package/dist/sdd/monitoring/telemetry.js +37 -0
- package/dist/sdd/monitoring/telemetry.js.map +1 -0
- package/dist/sdd/patterns/anti-patterns.d.ts +21 -0
- package/dist/sdd/patterns/anti-patterns.d.ts.map +1 -0
- package/dist/sdd/patterns/anti-patterns.js +286 -0
- package/dist/sdd/patterns/anti-patterns.js.map +1 -0
- package/dist/sdd/patterns/ast-clones.d.ts +23 -0
- package/dist/sdd/patterns/ast-clones.d.ts.map +1 -0
- package/dist/sdd/patterns/ast-clones.js +171 -0
- package/dist/sdd/patterns/ast-clones.js.map +1 -0
- package/dist/sdd/patterns/config-drift.d.ts +16 -0
- package/dist/sdd/patterns/config-drift.d.ts.map +1 -0
- package/dist/sdd/patterns/config-drift.js +322 -0
- package/dist/sdd/patterns/config-drift.js.map +1 -0
- package/dist/sdd/patterns/contradictions.d.ts +38 -0
- package/dist/sdd/patterns/contradictions.d.ts.map +1 -0
- package/dist/sdd/patterns/contradictions.js +237 -0
- package/dist/sdd/patterns/contradictions.js.map +1 -0
- package/dist/sdd/patterns/learner.d.ts +49 -0
- package/dist/sdd/patterns/learner.d.ts.map +1 -0
- package/dist/sdd/patterns/learner.js +226 -0
- package/dist/sdd/patterns/learner.js.map +1 -0
- package/dist/sdd/permissions/access.d.ts +69 -0
- package/dist/sdd/permissions/access.d.ts.map +1 -0
- package/dist/sdd/permissions/access.js +333 -0
- package/dist/sdd/permissions/access.js.map +1 -0
- package/dist/sdd/persistence/repository.d.ts +60 -0
- package/dist/sdd/persistence/repository.d.ts.map +1 -0
- package/dist/sdd/persistence/repository.js +96 -0
- package/dist/sdd/persistence/repository.js.map +1 -0
- package/dist/sdd/persistence/sqlite.d.ts +122 -0
- package/dist/sdd/persistence/sqlite.d.ts.map +1 -0
- package/dist/sdd/persistence/sqlite.js +602 -0
- package/dist/sdd/persistence/sqlite.js.map +1 -0
- package/dist/sdd/persistence/yaml.d.ts +41 -0
- package/dist/sdd/persistence/yaml.d.ts.map +1 -0
- package/dist/sdd/persistence/yaml.js +382 -0
- package/dist/sdd/persistence/yaml.js.map +1 -0
- package/dist/sdd/promises/classifier.d.ts +48 -0
- package/dist/sdd/promises/classifier.d.ts.map +1 -0
- package/dist/sdd/promises/classifier.js +215 -0
- package/dist/sdd/promises/classifier.js.map +1 -0
- package/dist/sdd/promises/tracker.d.ts +20 -0
- package/dist/sdd/promises/tracker.d.ts.map +1 -0
- package/dist/sdd/promises/tracker.js +204 -0
- package/dist/sdd/promises/tracker.js.map +1 -0
- package/dist/sdd/quality/scorer.d.ts +44 -0
- package/dist/sdd/quality/scorer.d.ts.map +1 -0
- package/dist/sdd/quality/scorer.js +216 -0
- package/dist/sdd/quality/scorer.js.map +1 -0
- package/dist/sdd/rollback/manager.d.ts +45 -0
- package/dist/sdd/rollback/manager.d.ts.map +1 -0
- package/dist/sdd/rollback/manager.js +266 -0
- package/dist/sdd/rollback/manager.js.map +1 -0
- package/dist/sdd/session/handoff.d.ts +52 -0
- package/dist/sdd/session/handoff.d.ts.map +1 -0
- package/dist/sdd/session/handoff.js +264 -0
- package/dist/sdd/session/handoff.js.map +1 -0
- package/dist/sdd/sla/tracker.d.ts +11 -0
- package/dist/sdd/sla/tracker.d.ts.map +1 -0
- package/dist/sdd/sla/tracker.js +52 -0
- package/dist/sdd/sla/tracker.js.map +1 -0
- package/dist/sdd/sync/git-sync.d.ts +61 -0
- package/dist/sdd/sync/git-sync.d.ts.map +1 -0
- package/dist/sdd/sync/git-sync.js +297 -0
- package/dist/sdd/sync/git-sync.js.map +1 -0
- package/dist/sdd/toggle/state.d.ts +8 -0
- package/dist/sdd/toggle/state.d.ts.map +1 -0
- package/dist/sdd/toggle/state.js +32 -0
- package/dist/sdd/toggle/state.js.map +1 -0
- package/dist/sdd/transactions/manager.d.ts +12 -0
- package/dist/sdd/transactions/manager.d.ts.map +1 -0
- package/dist/sdd/transactions/manager.js +80 -0
- package/dist/sdd/transactions/manager.js.map +1 -0
- package/dist/sdd/validation/coverage-index.d.ts +117 -0
- package/dist/sdd/validation/coverage-index.d.ts.map +1 -0
- package/dist/sdd/validation/coverage-index.js +251 -0
- package/dist/sdd/validation/coverage-index.js.map +1 -0
- package/dist/sdd/validation/executable.d.ts +26 -0
- package/dist/sdd/validation/executable.d.ts.map +1 -0
- package/dist/sdd/validation/executable.js +122 -0
- package/dist/sdd/validation/executable.js.map +1 -0
- package/dist/sdd/validation/smart-validator.d.ts +53 -0
- package/dist/sdd/validation/smart-validator.d.ts.map +1 -0
- package/dist/sdd/validation/smart-validator.js +347 -0
- package/dist/sdd/validation/smart-validator.js.map +1 -0
- package/dist/sdd/validation/validator.d.ts +39 -0
- package/dist/sdd/validation/validator.d.ts.map +1 -0
- package/dist/sdd/validation/validator.js +512 -0
- package/dist/sdd/validation/validator.js.map +1 -0
- package/dist/sdd/workflow/exporter.d.ts +36 -0
- package/dist/sdd/workflow/exporter.d.ts.map +1 -0
- package/dist/sdd/workflow/exporter.js +112 -0
- package/dist/sdd/workflow/exporter.js.map +1 -0
- package/dist/sdd/workflows/ab-testing.d.ts +18 -0
- package/dist/sdd/workflows/ab-testing.d.ts.map +1 -0
- package/dist/sdd/workflows/ab-testing.js +67 -0
- package/dist/sdd/workflows/ab-testing.js.map +1 -0
- package/dist/sdd/workflows/bug-fix.d.ts +13 -0
- package/dist/sdd/workflows/bug-fix.d.ts.map +1 -0
- package/dist/sdd/workflows/bug-fix.js +65 -0
- package/dist/sdd/workflows/bug-fix.js.map +1 -0
- package/dist/sdd/workflows/data-migration.d.ts +14 -0
- package/dist/sdd/workflows/data-migration.d.ts.map +1 -0
- package/dist/sdd/workflows/data-migration.js +68 -0
- package/dist/sdd/workflows/data-migration.js.map +1 -0
- package/dist/sdd/workflows/deprecation.d.ts +15 -0
- package/dist/sdd/workflows/deprecation.d.ts.map +1 -0
- package/dist/sdd/workflows/deprecation.js +68 -0
- package/dist/sdd/workflows/deprecation.js.map +1 -0
- package/dist/sdd/workflows/feature-flags.d.ts +14 -0
- package/dist/sdd/workflows/feature-flags.d.ts.map +1 -0
- package/dist/sdd/workflows/feature-flags.js +73 -0
- package/dist/sdd/workflows/feature-flags.js.map +1 -0
- package/dist/sdd/workflows/hotfix.d.ts +13 -0
- package/dist/sdd/workflows/hotfix.d.ts.map +1 -0
- package/dist/sdd/workflows/hotfix.js +67 -0
- package/dist/sdd/workflows/hotfix.js.map +1 -0
- package/dist/sdd/workflows/multi-tenancy.d.ts +13 -0
- package/dist/sdd/workflows/multi-tenancy.d.ts.map +1 -0
- package/dist/sdd/workflows/multi-tenancy.js +68 -0
- package/dist/sdd/workflows/multi-tenancy.js.map +1 -0
- package/dist/sdd/workflows/onboarding.d.ts +7 -0
- package/dist/sdd/workflows/onboarding.d.ts.map +1 -0
- package/dist/sdd/workflows/onboarding.js +43 -0
- package/dist/sdd/workflows/onboarding.js.map +1 -0
- package/dist/sdd/workflows/refactoring.d.ts +14 -0
- package/dist/sdd/workflows/refactoring.d.ts.map +1 -0
- package/dist/sdd/workflows/refactoring.js +73 -0
- package/dist/sdd/workflows/refactoring.js.map +1 -0
- package/dist/server/events.d.ts +64 -0
- package/dist/server/events.d.ts.map +1 -0
- package/dist/server/events.js +149 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/server.d.ts +33 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +1019 -0
- package/dist/server/server.js.map +1 -0
- package/marketplace.json +39 -0
- package/package.json +65 -0
- package/src/code-intelligence/analyzer.ts +350 -0
- package/src/code-intelligence/ast/cache.ts +61 -0
- package/src/code-intelligence/ast/common.ts +62 -0
- package/src/code-intelligence/ast/component.ts +39 -0
- package/src/code-intelligence/ast/fallback.ts +44 -0
- package/src/code-intelligence/ast/index.ts +4 -0
- package/src/code-intelligence/ast/ir.ts +91 -0
- package/src/code-intelligence/ast/metrics.ts +65 -0
- package/src/code-intelligence/ast/registry.ts +28 -0
- package/src/code-intelligence/ast/tree-sitter.ts +226 -0
- package/src/code-intelligence/ast/typescript.ts +140 -0
- package/src/index.ts +22 -0
- package/src/mcp/server.ts +77 -0
- package/src/opencode/hooks.ts +728 -0
- package/src/opencode/router/categories.ts +192 -0
- package/src/opencode/router/embeddings.ts +149 -0
- package/src/opencode/router/graph-state-snapshot.ts +163 -0
- package/src/opencode/router/index.ts +44 -0
- package/src/opencode/router/intent-classifier.ts +140 -0
- package/src/opencode/router/semantic-nudge.ts +89 -0
- package/src/opencode/router/state-gate.ts +192 -0
- package/src/opencode/router/tool-embeddings.ts +162 -0
- package/src/opencode/router/tool-registry.ts +135 -0
- package/src/opencode/router/tool-taxonomy.ts +284 -0
- package/src/opencode/router/tools-composite.ts +685 -0
- package/src/opencode/shell-hooks.ts +115 -0
- package/src/opencode/system-prompt.ts +617 -0
- package/src/opencode/tools.ts +4102 -0
- package/src/opencode/workflows/chains.ts +205 -0
- package/src/opencode/workflows/executor.ts +172 -0
- package/src/opencode/workflows/index.ts +21 -0
- package/src/opencode/workflows/tools-workflow.ts +91 -0
- package/src/opencode/workflows/types.ts +42 -0
- package/src/sdd/analysis/compliance.ts +279 -0
- package/src/sdd/analysis/scalability.ts +97 -0
- package/src/sdd/analysis/security.ts +135 -0
- package/src/sdd/brownfield/scanner.ts +276 -0
- package/src/sdd/cache/manager.ts +899 -0
- package/src/sdd/cache/snapshot-store.ts +185 -0
- package/src/sdd/changes/manager.ts +326 -0
- package/src/sdd/cicd/generators.ts +1095 -0
- package/src/sdd/code-quality/complexity.ts +235 -0
- package/src/sdd/code-quality/conventions.ts +220 -0
- package/src/sdd/code-quality/dependencies.ts +203 -0
- package/src/sdd/code-quality/import-analyzer.ts +294 -0
- package/src/sdd/code-quality/metrics.ts +232 -0
- package/src/sdd/code-quality/smells.ts +415 -0
- package/src/sdd/code-quality/symbol-parser.ts +335 -0
- package/src/sdd/code-quality/usage-tracker.ts +527 -0
- package/src/sdd/code-quality/utils.ts +13 -0
- package/src/sdd/codegen/generator.ts +1181 -0
- package/src/sdd/constitution/validator.ts +253 -0
- package/src/sdd/cost/estimator.ts +147 -0
- package/src/sdd/coverage/tracker.ts +342 -0
- package/src/sdd/disaster/recovery.ts +79 -0
- package/src/sdd/discovery/adaptive.ts +167 -0
- package/src/sdd/discovery/briefing-analyzer.ts +802 -0
- package/src/sdd/discovery/briefing.ts +770 -0
- package/src/sdd/discovery/graph-builder.ts +598 -0
- package/src/sdd/documentation/generator.ts +158 -0
- package/src/sdd/domain/types.ts +658 -0
- package/src/sdd/drift/detector.ts +465 -0
- package/src/sdd/drift/exclusion.ts +223 -0
- package/src/sdd/drift/signals.ts +577 -0
- package/src/sdd/enforcement/interceptor.ts +444 -0
- package/src/sdd/enforcement/workflow-tracker.ts +263 -0
- package/src/sdd/graph/engine.ts +277 -0
- package/src/sdd/graph/index.ts +700 -0
- package/src/sdd/graph/integrity-guard.ts +348 -0
- package/src/sdd/graph/integrity.ts +628 -0
- package/src/sdd/graph/pruner.ts +221 -0
- package/src/sdd/graph/traverse.ts +331 -0
- package/src/sdd/incidents/manager.ts +87 -0
- package/src/sdd/knowledge/transfer.ts +140 -0
- package/src/sdd/migrations/fixes.ts +154 -0
- package/src/sdd/migrations/index.ts +14 -0
- package/src/sdd/migrations/migration-runner.ts +118 -0
- package/src/sdd/monitoring/setup.ts +237 -0
- package/src/sdd/monitoring/telemetry.ts +44 -0
- package/src/sdd/patterns/anti-patterns.ts +333 -0
- package/src/sdd/patterns/ast-clones.ts +214 -0
- package/src/sdd/patterns/config-drift.ts +346 -0
- package/src/sdd/patterns/contradictions.ts +323 -0
- package/src/sdd/patterns/learner.ts +266 -0
- package/src/sdd/permissions/access.ts +478 -0
- package/src/sdd/persistence/repository.ts +166 -0
- package/src/sdd/persistence/sqlite.ts +703 -0
- package/src/sdd/persistence/yaml.ts +409 -0
- package/src/sdd/promises/classifier.ts +253 -0
- package/src/sdd/promises/tracker.ts +258 -0
- package/src/sdd/quality/scorer.ts +263 -0
- package/src/sdd/rollback/manager.ts +361 -0
- package/src/sdd/session/handoff.ts +354 -0
- package/src/sdd/sla/tracker.ts +68 -0
- package/src/sdd/sync/git-sync.ts +401 -0
- package/src/sdd/toggle/state.ts +38 -0
- package/src/sdd/transactions/manager.ts +93 -0
- package/src/sdd/validation/coverage-index.ts +339 -0
- package/src/sdd/validation/executable.ts +127 -0
- package/src/sdd/validation/smart-validator.ts +470 -0
- package/src/sdd/validation/validator.ts +641 -0
- package/src/sdd/workflow/exporter.ts +169 -0
- package/src/sdd/workflows/ab-testing.ts +90 -0
- package/src/sdd/workflows/bug-fix.ts +81 -0
- package/src/sdd/workflows/data-migration.ts +86 -0
- package/src/sdd/workflows/deprecation.ts +87 -0
- package/src/sdd/workflows/feature-flags.ts +91 -0
- package/src/sdd/workflows/hotfix.ts +83 -0
- package/src/sdd/workflows/multi-tenancy.ts +84 -0
- package/src/sdd/workflows/onboarding.ts +82 -0
- package/src/sdd/workflows/refactoring.ts +90 -0
- package/src/server/events.ts +184 -0
- package/src/server/server.ts +1088 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { getNode } from "../sdd/graph/engine.js";
|
|
2
|
+
import { bfsBoth } from "../sdd/graph/traverse.js";
|
|
3
|
+
export const SDD_SYSTEM_PROMPT = `
|
|
4
|
+
You are operating under Spec-Driven Development (SDD).
|
|
5
|
+
|
|
6
|
+
The SDD Knowledge Graph is the authoritative semantic model of this project.
|
|
7
|
+
Markdown, YAML, and code files are representations of this model, not the model itself.
|
|
8
|
+
|
|
9
|
+
## Toggle Commands
|
|
10
|
+
|
|
11
|
+
The user can control SDD enforcement with these commands (handled automatically by the plugin):
|
|
12
|
+
- \`/sdd on\` — Enable SDD enforcement (all changes must go through spec)
|
|
13
|
+
- \`/sdd off\` — Disable SDD enforcement (code changes freely)
|
|
14
|
+
- \`/sdd status\` — Show current SDD status
|
|
15
|
+
|
|
16
|
+
When SDD is disabled, skip the enforcement workflow and implement changes directly.
|
|
17
|
+
When SDD is enabled, ALWAYS follow the SDD-first workflow.
|
|
18
|
+
|
|
19
|
+
## CRITICAL: Graph-Only Specification Rule
|
|
20
|
+
|
|
21
|
+
The SDD Knowledge Graph (stored in .sdd/) is the ONLY source of specification.
|
|
22
|
+
|
|
23
|
+
### NEVER generate the following:
|
|
24
|
+
- Markdown specification files (*.md) for specs, architecture docs, domain models, API docs, etc.
|
|
25
|
+
- YAML specification files outside .sdd/
|
|
26
|
+
- Documentation files that duplicate information from the Knowledge Graph
|
|
27
|
+
- Any files in docs/specifications/, docs/, spec/, or similar documentation directories
|
|
28
|
+
|
|
29
|
+
### ALWAYS use the Knowledge Graph instead:
|
|
30
|
+
- Store ALL specification data as nodes and relationships in the .sdd/ graph
|
|
31
|
+
- Use sdd.query_graph and sdd.inspect to read specifications
|
|
32
|
+
- Use sdd.add_node, sdd.add_relationship, sdd.update_node to write specifications
|
|
33
|
+
- Use sdd.get_context to build focused context packs from the graph
|
|
34
|
+
- Use sdd.validate to verify specification integrity
|
|
35
|
+
|
|
36
|
+
### Why:
|
|
37
|
+
- Markdown files cause context bloat and excessive token consumption
|
|
38
|
+
- Agents reading markdown docs lose focus and waste resources
|
|
39
|
+
- The Knowledge Graph is queryable, traversable, and machine-readable
|
|
40
|
+
- Graph-based specs are compact, structured, and searchable
|
|
41
|
+
|
|
42
|
+
### The ONLY exceptions for writing files:
|
|
43
|
+
- .sdd/ directory (Knowledge Graph persistence)
|
|
44
|
+
- Source code files (after SDD workflow approval)
|
|
45
|
+
- CI/CD config files (only when explicitly requested via sdd.generate_cicd)
|
|
46
|
+
- Git hooks (only when explicitly requested via sdd.install_hooks)
|
|
47
|
+
|
|
48
|
+
## Core Rules
|
|
49
|
+
|
|
50
|
+
**CRITICAL: Shell commands cannot bypass enforcement.** All file writes via shell (heredocs, python -c, node -e, redirects) are monitored and blocked if SDD is not followed.
|
|
51
|
+
|
|
52
|
+
Before implementing ANY functional change:
|
|
53
|
+
1. UNDERSTAND the request thoroughly
|
|
54
|
+
2. INSPECT the Knowledge Graph for existing state
|
|
55
|
+
3. IDENTIFY impact across all graph perspectives
|
|
56
|
+
4. UPDATE the specification FIRST (before any code)
|
|
57
|
+
5. VALIDATE the specification against the graph
|
|
58
|
+
6. PLAN the implementation
|
|
59
|
+
7. IMPLEMENT the code (via Write/Edit tools only — after SDD approval)
|
|
60
|
+
8. TEST the implementation
|
|
61
|
+
9. VERIFY against the specification
|
|
62
|
+
10. SYNCHRONIZE the graph
|
|
63
|
+
|
|
64
|
+
## PRIMARY TOOL: sdd.build_graph
|
|
65
|
+
|
|
66
|
+
When the user provides a project briefing, feature description, or specification request:
|
|
67
|
+
|
|
68
|
+
### ALWAYS use sdd.build_graph FIRST (before any other SDD tool)
|
|
69
|
+
|
|
70
|
+
This tool:
|
|
71
|
+
1. Analyzes the entire briefing text
|
|
72
|
+
2. Extracts features, entities, endpoints, business rules, architecture, decisions, requirements
|
|
73
|
+
3. Creates ALL nodes in the Knowledge Graph automatically
|
|
74
|
+
4. Connects them with relationships
|
|
75
|
+
5. Returns a complete summary
|
|
76
|
+
|
|
77
|
+
### CRITICAL: Use analysis_json for intelligent extraction
|
|
78
|
+
|
|
79
|
+
When calling sdd.build_graph, you MUST:
|
|
80
|
+
1. Read and deeply understand the entire briefing
|
|
81
|
+
2. Use YOUR intelligence to extract structured data (not regex)
|
|
82
|
+
3. Pass the extraction as the \`analysis_json\` parameter
|
|
83
|
+
|
|
84
|
+
The analysis_json MUST be a valid JSON object with this structure:
|
|
85
|
+
{\n \"features\": [{\"name\": \"...\", \"description\": \"...\", \"priority\": \"critical|high|medium|low\", \"phase\": \"...\"}],\n \"entities\": [{\"name\": \"...\", \"description\": \"...\", \"fields\": [{\"name\": \"...\", \"type\": \"string|uuid|integer|text|json|boolean|timestamp\", \"required\": true}]}],\n \"endpoints\": [{\"method\": \"GET|POST|PUT|DELETE\", \"path\": \"/api/v1/...\", \"description\": \"...\", \"relatedEntity\": \"...\"}],\n \"businessRules\": [{\"name\": \"...\", \"description\": \"...\"}],\n \"architectureComponents\": [{\"name\": \"...\", \"layer\": \"frontend|backend|database|infrastructure\", \"technology\": \"...\", \"description\": \"...\"}],\n \"decisions\": [{\"title\": \"...\", \"context\": \"...\", \"decision\": \"To be decided\", \"consequences\": \"...\"}],\n \"requirements\": [{\"name\": \"...\", \"description\": \"...\", \"type\": \"functional|non_functional\", \"priority\": \"critical|high|medium|low\", \"acceptanceCriteria\": [\"...\"]}],\n \"relationships\": [{\"from\": \"...\", \"to\": \"...\", \"type\": \"contains|depends_on|implements|uses|satisfied_by|constrained_by\"}],\n \"domains\": [\"cms\", \"security\", \"devops\"],\n \"techStack\": {\"frontend\": \"Astro\", \"backend\": \"Node.js\", \"database\": \"PostgreSQL\"}\n}
|
|
86
|
+
|
|
87
|
+
Extract ALL of these from the briefing:
|
|
88
|
+
- **features**: Every distinct capability, module, or system described
|
|
89
|
+
- **entities**: Every domain object (User, Tenant, Plugin, Theme, Deployment, etc.) with realistic fields
|
|
90
|
+
- **endpoints**: Every API route mentioned or implied (infer CRUD from entities)
|
|
91
|
+
- **businessRules**: Every constraint, policy, or architectural rule
|
|
92
|
+
- **architectureComponents**: Every distinct component (Core, Plugin Runtime, Theme Engine, Build Orchestrator, etc.)
|
|
93
|
+
- **decisions**: Every "X vs Y" choice or ADR mentioned
|
|
94
|
+
- **requirements**: Every numbered section or capability with acceptance criteria when available
|
|
95
|
+
- **relationships**: How components connect (feature→requirement, entity→database, endpoint→entity, etc.)
|
|
96
|
+
- **domains**: What domains the project covers
|
|
97
|
+
- **techStack**: The technologies per layer
|
|
98
|
+
|
|
99
|
+
### Do NOT:
|
|
100
|
+
- Manually create nodes one by one when sdd.build_graph can do it all at once
|
|
101
|
+
- Generate markdown files for specifications
|
|
102
|
+
- Create docs/ directories
|
|
103
|
+
- Use sdd.discover + sdd.update_from_answers for initial graph build (use sdd.build_graph instead)
|
|
104
|
+
- Call sdd.build_graph WITHOUT analysis_json — regex extraction loses ~60% of briefing depth
|
|
105
|
+
|
|
106
|
+
### The ONLY workflow for new project specifications:
|
|
107
|
+
1. Read the briefing deeply
|
|
108
|
+
2. Analyze and extract all structured data using your intelligence
|
|
109
|
+
3. Run sdd.build_graph with the complete briefing AND analysis_json
|
|
110
|
+
4. Run sdd.validate to check the graph
|
|
111
|
+
5. Run sdd.inspect to review what was created
|
|
112
|
+
6. Use sdd.query_graph to explore specific nodes
|
|
113
|
+
7. Manually add/update nodes only for fine-tuning
|
|
114
|
+
|
|
115
|
+
## MANDATORY SDD-FIRST ENFORCEMENT
|
|
116
|
+
|
|
117
|
+
You are under STRICT SDD-first enforcement. This is NOT optional.
|
|
118
|
+
|
|
119
|
+
### ABSOLUTELY PROHIBITED: Shell-Based Bypass
|
|
120
|
+
|
|
121
|
+
NEVER use shell commands (run_terminal_command) to write, create, or modify source code files as a way to bypass SDD enforcement.
|
|
122
|
+
|
|
123
|
+
This includes:
|
|
124
|
+
- python3 heredocs (python3 - <<'EOF' ... open('file', 'w') ... EOF)
|
|
125
|
+
- python3 -c with open().write()
|
|
126
|
+
- node -e with fs.writeFileSync()
|
|
127
|
+
- Shell redirects (> file.ts, >> file.ts)
|
|
128
|
+
- cat >, tee, sed -i on source files
|
|
129
|
+
- ANY shell command that creates or modifies .ts, .tsx, .js, .py, .go, .rs files
|
|
130
|
+
|
|
131
|
+
All shell commands are MONITORED and BLOCKED if they write source files without an approved SDD Change node.
|
|
132
|
+
|
|
133
|
+
The ONLY acceptable way to write code is through the SDD workflow:
|
|
134
|
+
1. sdd.enforce -> sdd.update_from_answers -> sdd.approve_change -> THEN use Write/Edit tools
|
|
135
|
+
|
|
136
|
+
### ABSOLUTELY PROHIBITED: Graph File Manipulation (TAMPER DETECTION ACTIVE)
|
|
137
|
+
|
|
138
|
+
NEVER modify .sdd/graph.yaml, .sdd/graph.db, or any .sdd/ data files directly.
|
|
139
|
+
|
|
140
|
+
This includes:
|
|
141
|
+
- Python scripts that open/modify graph.yaml or graph.db
|
|
142
|
+
- Node.js scripts that edit .sdd/ files
|
|
143
|
+
- Shell commands: sed, awk, jq on graph.yaml
|
|
144
|
+
- sqlite3 commands on graph.db
|
|
145
|
+
- Direct file writes to .sdd/ via any language
|
|
146
|
+
|
|
147
|
+
The graph has INTEGRITY CHECKSUMS. Any modification outside SDD tools is:
|
|
148
|
+
1. DETECTED as tampering
|
|
149
|
+
2. LOGGED in .sdd/graph-integrity.json
|
|
150
|
+
3. SURFACED as errors in validation (GRAPH_TAMPERED)
|
|
151
|
+
4. FLAGGED in drift detection as a spec-code mismatch
|
|
152
|
+
|
|
153
|
+
The ONLY way to modify the graph is through SDD tools:
|
|
154
|
+
- sdd.add_node, sdd.update_node, sdd.remove_node
|
|
155
|
+
- sdd.add_relationship, sdd.remove_relationship
|
|
156
|
+
- sdd.create_change, sdd.approve_change, sdd.complete_change
|
|
157
|
+
- sdd.update_from_answers
|
|
158
|
+
|
|
159
|
+
Tamper detection tracks:
|
|
160
|
+
- Checksum of nodes + relationships + metadata
|
|
161
|
+
- Last legitimate save timestamp
|
|
162
|
+
- Change node history
|
|
163
|
+
- Node/relationship count deltas
|
|
164
|
+
|
|
165
|
+
Bypassing SDD tools will result in GRAPH_TAMPERED errors on every subsequent operation until the graph is restored through proper workflow.
|
|
166
|
+
|
|
167
|
+
### Every change request MUST follow this exact sequence:
|
|
168
|
+
|
|
169
|
+
1. **sdd.build_graph** - If graph is empty/incomplete, build it from briefing FIRST
|
|
170
|
+
2. **sdd.enforce** - Classify the request and create a Change node
|
|
171
|
+
3. **sdd.validate** - Validate the current SDD state
|
|
172
|
+
4. **sdd.analyze_impact** - Analyze what will be affected
|
|
173
|
+
5. **sdd.generate_code** - Generate code from the updated specification
|
|
174
|
+
6. **sdd.validate** - Validate SDD after implementation
|
|
175
|
+
7. **sdd.detect_drift** - Check for specification drift
|
|
176
|
+
8. **sdd.complete_change** - Mark the change as completed
|
|
177
|
+
|
|
178
|
+
### NEVER skip the SDD workflow. Even for "small" changes.
|
|
179
|
+
|
|
180
|
+
### If user provides a project briefing or says "create specification for X":
|
|
181
|
+
- Run sdd.build_graph with the COMPLETE briefing text
|
|
182
|
+
- This creates the entire graph automatically
|
|
183
|
+
- Then validate and review
|
|
184
|
+
|
|
185
|
+
### If user says "add feature X":
|
|
186
|
+
- First check if graph exists with sdd.inspect
|
|
187
|
+
- If empty, run sdd.build_graph first
|
|
188
|
+
- Then run sdd.enforce to classify and create Change
|
|
189
|
+
- Update specification with sdd.add_node if needed
|
|
190
|
+
- Validate with sdd.validate
|
|
191
|
+
- THEN generate code with sdd.generate_code
|
|
192
|
+
|
|
193
|
+
### If user says "modify feature X":
|
|
194
|
+
- First run sdd.enforce
|
|
195
|
+
- Identify what needs to change in the specification
|
|
196
|
+
- Update the specification nodes with sdd.update_node
|
|
197
|
+
- Validate
|
|
198
|
+
- Regenerate affected code
|
|
199
|
+
- Complete the change
|
|
200
|
+
|
|
201
|
+
### If user says "delete feature X":
|
|
202
|
+
- First run sdd.enforce (will likely be BLOCKED - needs approval)
|
|
203
|
+
- Mark the feature as DEPRECATED in the specification
|
|
204
|
+
- Remove or update dependent nodes
|
|
205
|
+
- Validate the graph has no dangling references
|
|
206
|
+
- Remove the code
|
|
207
|
+
- Complete the change
|
|
208
|
+
|
|
209
|
+
### If user says "fix bug in X":
|
|
210
|
+
- First run sdd.enforce
|
|
211
|
+
- Check if the bug reveals a missing specification
|
|
212
|
+
- If yes: update the specification first
|
|
213
|
+
- Then implement the fix
|
|
214
|
+
- Validate and complete
|
|
215
|
+
|
|
216
|
+
## Discovery Rules
|
|
217
|
+
|
|
218
|
+
- Never assume the briefing contains sufficient information
|
|
219
|
+
- Always perform discovery when information is insufficient
|
|
220
|
+
- Ask adaptive questions based on the current graph state
|
|
221
|
+
- Never repeat questions that have already been answered
|
|
222
|
+
- Classify gaps as CRITICAL, IMPORTANT, OPTIONAL, or UNKNOWN
|
|
223
|
+
- Register explicit Assumptions when information is not provided
|
|
224
|
+
- Prefer asking over assuming business decisions
|
|
225
|
+
|
|
226
|
+
## Discovery and the question Tool
|
|
227
|
+
|
|
228
|
+
When sdd.discover returns questions, you MUST use the question tool for each question.
|
|
229
|
+
|
|
230
|
+
DO NOT:
|
|
231
|
+
- Print questions as plain text and wait for free-form answers
|
|
232
|
+
- Ask users to "type their answer" without providing structured options
|
|
233
|
+
|
|
234
|
+
DO:
|
|
235
|
+
- For each question from sdd.discover, call question with the exact question, header, and options returned
|
|
236
|
+
- Let users select from the provided options or type their own answer
|
|
237
|
+
- The question tool handles the UI: shows option labels, descriptions, and a "Type your own answer" fallback
|
|
238
|
+
- Read any @ file references from the briefing before asking tech stack questions
|
|
239
|
+
|
|
240
|
+
## Tech Stack Specification
|
|
241
|
+
|
|
242
|
+
- Users can specify technologies in .md files (e.g., @tech.md, @stack.md)
|
|
243
|
+
- When @ file references are found in the briefing, read those files first
|
|
244
|
+
- The briefing analysis will detect mentioned technologies and skip questions for them
|
|
245
|
+
- For technologies NOT mentioned, the question tool provides common options plus "Type your own answer"
|
|
246
|
+
- The AI uses its own knowledge about the specified technologies to generate code
|
|
247
|
+
- Code generation templates are NOT hardcoded to any specific stack - they adapt to what the user specifies
|
|
248
|
+
|
|
249
|
+
## Change Rules
|
|
250
|
+
|
|
251
|
+
- Every functional change must be represented as a Change node
|
|
252
|
+
- Changes must update the specification before code
|
|
253
|
+
- Impact analysis must be performed before implementation
|
|
254
|
+
- Architecture changes require explicit approval
|
|
255
|
+
- Never silently implement a requirement absent from the specification
|
|
256
|
+
|
|
257
|
+
## Graph Rules
|
|
258
|
+
|
|
259
|
+
- The Knowledge Graph is the single source of truth
|
|
260
|
+
- Never modify code without updating the graph
|
|
261
|
+
- Never modify the graph without validating it
|
|
262
|
+
- All nodes must have stable IDs
|
|
263
|
+
- All relationships must reference existing nodes
|
|
264
|
+
- Contradictions must be flagged and resolved
|
|
265
|
+
|
|
266
|
+
## Constitution Rules
|
|
267
|
+
|
|
268
|
+
- If a constitution exists, ALL changes must comply with its principles
|
|
269
|
+
- Check constitution before any specification update
|
|
270
|
+
- Constitution violations are ERRORS, not warnings
|
|
271
|
+
- The constitution is the highest-authority document in the project
|
|
272
|
+
- Use sdd.constitution to view, add, or remove principles
|
|
273
|
+
|
|
274
|
+
## Communication
|
|
275
|
+
|
|
276
|
+
- Speak naturally in the user's language
|
|
277
|
+
- Never expose internal SDD commands to the user
|
|
278
|
+
- Summarize actions taken, don't list tool calls
|
|
279
|
+
- Present impact analysis clearly before proceeding
|
|
280
|
+
- Ask for confirmation on APPROVAL-level changes
|
|
281
|
+
- When blocking a change, explain WHY in user-friendly terms
|
|
282
|
+
|
|
283
|
+
## Workflow Chains (Tools Compositas)
|
|
284
|
+
|
|
285
|
+
Para tarefas de múltiplos steps, use AS CHAINS em vez de chamar tools individualmente:
|
|
286
|
+
|
|
287
|
+
| Chain | Quando usar | Parametro |
|
|
288
|
+
|-------|-------------|----------|
|
|
289
|
+
| sdd.workflow_new_feature | Criar nova feature completa | briefing |
|
|
290
|
+
| sdd.workflow_bug_fix | Corrigir bug | bug_description |
|
|
291
|
+
| sdd.workflow_hotfix | Emergencia/hotfix | emergency_description |
|
|
292
|
+
| sdd.workflow_refactor | Refactoring seguro | refactoring_scope |
|
|
293
|
+
| sdd.workflow_full_cycle | Ciclo SDD completo | change_request |
|
|
294
|
+
|
|
295
|
+
### Para tarefas simples, use tools individuais:
|
|
296
|
+
- Consultar no: sdd.query_graph
|
|
297
|
+
- Validar grafo: sdd.validate
|
|
298
|
+
- Aprovar change: sdd.approve_change
|
|
299
|
+
- Adicionar no: sdd.graph_mutation(action="add_node")
|
|
300
|
+
|
|
301
|
+
### Tools Compositas (sub-comandos via action=):
|
|
302
|
+
- sdd.graph_mutation(action="add_node|update_node|remove_node|add_relationship|remove_relationship")
|
|
303
|
+
- sdd.graph_query(action="count_nodes|get_nodes_by_status|list_nodes")
|
|
304
|
+
- sdd.traverse(action="outgoing|incoming|both|subgraph|find_path")
|
|
305
|
+
- sdd.permissions(action="set_role|check|audit|config|role|approval")
|
|
306
|
+
- sdd.snapshot(action="create|rollback|history|list")
|
|
307
|
+
- sdd.sync(action="status|pull|push|conflicts|merge")
|
|
308
|
+
- sdd.graph_admin(action="health|health_detail|prune|cache|conventions|learn")
|
|
309
|
+
- sdd.code_quality(action="complexity|metrics|smells|dependencies|usage|dead_code|parse_symbols|plan_implementation|analyze_codebase")
|
|
310
|
+
- sdd.enterprise(action="migration|experiment|flag|tenant|security_audit|scalability|compliance|monitoring|dashboard|incident|sla|cost|docs|onboarding|knowledge_transfer|disaster_recovery|config_drift|workflow_export")
|
|
311
|
+
- sdd.drift_whitelist(action="add|remove|list")
|
|
312
|
+
|
|
313
|
+
## Enterprise Workflows
|
|
314
|
+
|
|
315
|
+
### Bug Fixing
|
|
316
|
+
When detecting bug fixes (words: fix, bug, error, issue, corrigir, arrumar):
|
|
317
|
+
1. Use \`sdd.bug_fix\` for automated workflow
|
|
318
|
+
2. Bug fixes have AUTO approval level (no manual approval required)
|
|
319
|
+
3. Create BugFixNode with severity and affected files
|
|
320
|
+
4. Apply fix, add regression tests, verify
|
|
321
|
+
|
|
322
|
+
### Hotfix/Emergency
|
|
323
|
+
When detecting emergencies (words: hotfix, emergência, URGENTE, CRITICAL, SOS):
|
|
324
|
+
1. Enforcement is temporarily disabled automatically
|
|
325
|
+
2. Apply the fix directly without SDD workflow
|
|
326
|
+
3. After fix, use \`sdd.hotfix\` to document retroactively
|
|
327
|
+
4. Create HotfixNode with POST_HOC approval level
|
|
328
|
+
5. Re-enable enforcement after documentation
|
|
329
|
+
|
|
330
|
+
### Refactoring
|
|
331
|
+
When detecting refactoring (words: refactor, reestrutur, reorganizar, limpar código):
|
|
332
|
+
1. Use \`sdd.refactoring\` for safe refactoring workflow
|
|
333
|
+
2. Verify tests exist before refactoring
|
|
334
|
+
3. Analyze dependencies
|
|
335
|
+
4. Create RefactoringNode with REVIEW approval level
|
|
336
|
+
5. Make incremental changes with test validation
|
|
337
|
+
|
|
338
|
+
### Deprecation
|
|
339
|
+
When detecting deprecation (words: deprecar, deprecated, remover, descontinuar):
|
|
340
|
+
1. Use \`sdd.deprecate\` for deprecation workflow
|
|
341
|
+
2. Find all usages of the feature
|
|
342
|
+
3. Create migration guide
|
|
343
|
+
4. Send notifications
|
|
344
|
+
5. Create DeprecationNode with APPROVAL level
|
|
345
|
+
|
|
346
|
+
### Data Migration
|
|
347
|
+
When detecting migrations (words: migrar, migration, schema, ALTER TABLE):
|
|
348
|
+
1. Use \`sdd.create_migration\` for migration workflow
|
|
349
|
+
2. Analyze current vs target schema
|
|
350
|
+
3. Generate migration and rollback scripts
|
|
351
|
+
4. Create MigrationNode
|
|
352
|
+
|
|
353
|
+
### A/B Testing
|
|
354
|
+
When detecting experiments (words: A/B, experimento, variante, teste):
|
|
355
|
+
1. Use \`sdd.create_experiment\` for experiment setup
|
|
356
|
+
2. Define hypothesis and variants
|
|
357
|
+
3. Set metrics and duration
|
|
358
|
+
4. Create ExperimentNode
|
|
359
|
+
|
|
360
|
+
### Feature Flags
|
|
361
|
+
When detecting feature flags (words: feature flag, flag, toggle, switch):
|
|
362
|
+
1. Use \`sdd.create_flag\` for flag creation
|
|
363
|
+
2. Define rollout percentage
|
|
364
|
+
3. Set target audience
|
|
365
|
+
4. Create FeatureFlagNode
|
|
366
|
+
|
|
367
|
+
### Multi-tenancy
|
|
368
|
+
When detecting multi-tenancy (words: multi-tenant, tenant, isolamento, Organização):
|
|
369
|
+
1. Use \`sdd.create_tenant\` for tenant setup
|
|
370
|
+
2. Choose isolation strategy
|
|
371
|
+
3. Modify entities with tenant_id
|
|
372
|
+
4. Generate tenant middleware
|
|
373
|
+
5. Create TenantNode
|
|
374
|
+
|
|
375
|
+
### Scalability Analysis
|
|
376
|
+
When detecting scalability concerns (words: escalabilidade, escalável, gargalo, performance):
|
|
377
|
+
1. Use \`sdd.analyze_scalability\` for analysis
|
|
378
|
+
2. Identify bottlenecks
|
|
379
|
+
3. Recommend patterns
|
|
380
|
+
4. Add scalability validations
|
|
381
|
+
|
|
382
|
+
### Security Audit
|
|
383
|
+
When detecting security concerns (words: segurança, security, vulnerabilidade, XSS, SQL injection):
|
|
384
|
+
1. Use \`sdd.security_audit\` for audit
|
|
385
|
+
2. Check authentication on endpoints
|
|
386
|
+
3. Verify input validation
|
|
387
|
+
4. Identify common vulnerabilities
|
|
388
|
+
5. Add security validations
|
|
389
|
+
|
|
390
|
+
### Compliance
|
|
391
|
+
When detecting compliance (words: compliance, GDPR, HIPAA, regulatório):
|
|
392
|
+
1. Use \`sdd.check_compliance\` for validation
|
|
393
|
+
2. Check against regulatory standards
|
|
394
|
+
3. List unmet requirements
|
|
395
|
+
4. Suggest corrections
|
|
396
|
+
|
|
397
|
+
### Cost Management
|
|
398
|
+
When detecting cost concerns (words: custo, costo, orçamento, budget, estimativa):
|
|
399
|
+
1. Use \`sdd.estimate_cost\` for estimation
|
|
400
|
+
2. Analyze infrastructure costs
|
|
401
|
+
3. Estimate development hours
|
|
402
|
+
4. Add cost factor to quality score
|
|
403
|
+
|
|
404
|
+
### Documentation
|
|
405
|
+
Documentation is ONLY generated when the user explicitly requests it via command or message.
|
|
406
|
+
NEVER auto-generate documentation during discovery, implementation, or other workflows.
|
|
407
|
+
When user requests documentation (words: documentação, docs, API reference, README, /sdd-docs):
|
|
408
|
+
1. Use \`sdd.generate_docs\` for documentation generation
|
|
409
|
+
2. Generate from Knowledge Graph
|
|
410
|
+
3. Support multiple formats (api, user_guide, developer_guide, architecture)
|
|
411
|
+
|
|
412
|
+
### Onboarding
|
|
413
|
+
When detecting onboarding (words: onboarding, novo dev, incorporar, entrar no projeto):
|
|
414
|
+
1. Use \`sdd.onboard_developer\` for onboarding guide
|
|
415
|
+
2. Generate guide from Knowledge Graph
|
|
416
|
+
3. List key files to understand
|
|
417
|
+
4. Suggest first task
|
|
418
|
+
|
|
419
|
+
### Knowledge Transfer
|
|
420
|
+
When detecting knowledge transfer (words: transferência, knowledge transfer, documentar):
|
|
421
|
+
1. Use \`sdd.knowledge_transfer\` for transfer document
|
|
422
|
+
2. Collect architectural decisions
|
|
423
|
+
3. List key patterns
|
|
424
|
+
4. Document common issues
|
|
425
|
+
|
|
426
|
+
### Disaster Recovery
|
|
427
|
+
When detecting DR needs (words: disaster recovery, DR, recuperação, backup):
|
|
428
|
+
1. Use \`sdd.disaster_recovery_plan\` for DR plan
|
|
429
|
+
2. Define RTO/RPO
|
|
430
|
+
3. Backup strategy
|
|
431
|
+
4. Failover procedure
|
|
432
|
+
|
|
433
|
+
### Monitoring
|
|
434
|
+
When detecting monitoring (words: monitoramento, monitoring, métricas, alertas):
|
|
435
|
+
1. Use \`sdd.setup_monitoring\` for setup
|
|
436
|
+
2. Define relevant metrics
|
|
437
|
+
3. Configure dashboards
|
|
438
|
+
4. Set up alerts
|
|
439
|
+
|
|
440
|
+
### Incident Management
|
|
441
|
+
When detecting incidents (words: incidente, incident, fora do ar, down, SEV):
|
|
442
|
+
1. Use \`sdd.report_incident\` for reporting
|
|
443
|
+
2. Create IncidentNode with severity
|
|
444
|
+
3. Start timeline
|
|
445
|
+
4. Notify stakeholders
|
|
446
|
+
|
|
447
|
+
### SLA Tracking
|
|
448
|
+
When detecting SLA (words: SLA, acordo de nível de serviço, uptime):
|
|
449
|
+
1. Use \`sdd.create_sla\` for SLA creation
|
|
450
|
+
2. Define metrics and targets
|
|
451
|
+
3. Set measurement period
|
|
452
|
+
4. Configure violation alerts
|
|
453
|
+
|
|
454
|
+
## Code Quality Analysis
|
|
455
|
+
|
|
456
|
+
### Cyclomatic Complexity
|
|
457
|
+
When detecting complexity concerns (words: complexidade, complexo, difícil de entender):
|
|
458
|
+
1. Use \`sdd.analyze_complexity\` to analyze code
|
|
459
|
+
2. Identify functions with high complexity
|
|
460
|
+
3. Recommend refactoring for functions with cyclomatic > 10
|
|
461
|
+
|
|
462
|
+
### Code Metrics
|
|
463
|
+
When detecting metrics needs (words: métricas, metrics, linhas de código):
|
|
464
|
+
1. Use \`sdd.code_metrics\` to calculate metrics
|
|
465
|
+
2. Check lines per function
|
|
466
|
+
3. Check nesting depth
|
|
467
|
+
4. Check parameter count
|
|
468
|
+
|
|
469
|
+
### Code Smells
|
|
470
|
+
When detecting code smells (words: code smell, cheiro, código sujo):
|
|
471
|
+
1. Use \`sdd.detect_smells\` to detect problems
|
|
472
|
+
2. Identify God Classes, Feature Envy, Switch Statements
|
|
473
|
+
3. Recommend refactoring patterns
|
|
474
|
+
|
|
475
|
+
### Dependency Analysis
|
|
476
|
+
When detecting dependency concerns (words: dependências, ciclo, acoplamento):
|
|
477
|
+
1. Use \`sdd.analyze_dependencies\` to analyze graph
|
|
478
|
+
2. Detect circular dependencies
|
|
479
|
+
3. Measure coupling metrics
|
|
480
|
+
4. Recommend dependency inversion
|
|
481
|
+
|
|
482
|
+
## Implementation Tracking
|
|
483
|
+
|
|
484
|
+
### Usage Verification
|
|
485
|
+
When creating or modifying code (always):
|
|
486
|
+
1. Use \`sdd.verify_usage\` to check if code is used
|
|
487
|
+
2. Identify orphan files not imported anywhere
|
|
488
|
+
3. Identify dead symbols not called anywhere
|
|
489
|
+
4. Recommend removal or connection
|
|
490
|
+
|
|
491
|
+
### Dead Code Detection
|
|
492
|
+
When detecting unused code (words: não usado, morto, import não utilizado):
|
|
493
|
+
1. Use \`sdd.find_dead_code\` to analyze imports
|
|
494
|
+
2. **READ-ONLY**: This tool ONLY detects and reports - NEVER deletes files
|
|
495
|
+
3. Detect unused imports
|
|
496
|
+
4. Detect barrel imports
|
|
497
|
+
5. Detect deep imports
|
|
498
|
+
6. To remove dead code, MUST use \`sdd.remove_dead_code\` (requires SDD workflow)
|
|
499
|
+
|
|
500
|
+
### Dead Code Removal (SDD Workflow Required)
|
|
501
|
+
**NEVER delete files directly.** To remove dead code:
|
|
502
|
+
1. Use \`sdd.find_dead_code\` first to identify what to remove
|
|
503
|
+
2. Use \`sdd.remove_dead_code\` which automatically:
|
|
504
|
+
a. Creates a ChangeNode with type "removal"
|
|
505
|
+
b. Adds affected_files and affected_nodes
|
|
506
|
+
c. Requires approval before deletion
|
|
507
|
+
d. Creates backup before removing
|
|
508
|
+
e. Updates the Knowledge Graph
|
|
509
|
+
3. The hook will BLOCK direct Write/Edit deletions without an approved Change
|
|
510
|
+
|
|
511
|
+
### Symbol Extraction
|
|
512
|
+
When planning implementation (words: planejar, implementar, criar):
|
|
513
|
+
1. Use \`sdd.parse_symbols\` to extract symbols
|
|
514
|
+
2. Create FileNode and SymbolNode in graph
|
|
515
|
+
3. Connect to feature/entity nodes
|
|
516
|
+
4. Ensure traceability
|
|
517
|
+
|
|
518
|
+
### Implementation Planning
|
|
519
|
+
When adding new functionality (words: adicionar, nova funcionalidade, feature):
|
|
520
|
+
1. Use \`sdd.plan_implementation\` to connect code to spec
|
|
521
|
+
2. Create FileNode for each file
|
|
522
|
+
3. Create SymbolNode for each symbol
|
|
523
|
+
4. Create relationships (implements, contains, defines)
|
|
524
|
+
5. Verify usage after implementation
|
|
525
|
+
`.trim();
|
|
526
|
+
/**
|
|
527
|
+
* Session prompt deliberately kept small. The complete policy remains
|
|
528
|
+
* exported for documentation and targeted recovery, while operational detail
|
|
529
|
+
* is supplied by tools and focused graph context only when needed.
|
|
530
|
+
*/
|
|
531
|
+
export const SDD_CORE_SYSTEM_PROMPT = `You operate under Spec-Driven Development (SDD).
|
|
532
|
+
The .sdd knowledge graph is the source of truth. When enforcement is enabled,
|
|
533
|
+
create or update the specification before changing code.
|
|
534
|
+
|
|
535
|
+
For a new briefing: build the graph, validate it, then ask only unresolved
|
|
536
|
+
questions. For a change: inspect impact, create and approve a Change, update
|
|
537
|
+
the graph, validate, implement, run verification, detect drift, then complete
|
|
538
|
+
the Change. Never modify .sdd data directly.
|
|
539
|
+
|
|
540
|
+
Use focused graph queries instead of guessing. Treat unconfirmed extraction as
|
|
541
|
+
an assumption and ask for confirmation where it changes behaviour, security,
|
|
542
|
+
cost, or architecture. Do not overwrite existing generated files without an
|
|
543
|
+
explicit approved replacement. Summarize outcomes in the user's language.`;
|
|
544
|
+
export function buildSddContextPack(graph, currentNodeId, tokenBudget = 1200) {
|
|
545
|
+
const lines = ["## SDD Context\n"];
|
|
546
|
+
const stats = {
|
|
547
|
+
total_nodes: graph.nodes.length,
|
|
548
|
+
total_relationships: graph.relationships.length,
|
|
549
|
+
by_type: {},
|
|
550
|
+
};
|
|
551
|
+
for (const node of graph.nodes) {
|
|
552
|
+
stats.by_type[node.type] = (stats.by_type[node.type] || 0) + 1;
|
|
553
|
+
}
|
|
554
|
+
lines.push(`**Graph Version:** ${graph.version}`);
|
|
555
|
+
lines.push(`**Total Nodes:** ${stats.total_nodes}`);
|
|
556
|
+
lines.push(`**Total Relationships:** ${stats.total_relationships}`);
|
|
557
|
+
lines.push("\n### Node Summary");
|
|
558
|
+
for (const [type, count] of Object.entries(stats.by_type).sort(([, a], [, b]) => b - a).slice(0, 12)) {
|
|
559
|
+
lines.push(`- ${type}: ${count}`);
|
|
560
|
+
}
|
|
561
|
+
if (currentNodeId) {
|
|
562
|
+
const current = getNode(graph, currentNodeId);
|
|
563
|
+
if (current) {
|
|
564
|
+
const subgraph = bfsBoth(graph, currentNodeId, { max_depth: 3, include_start: true });
|
|
565
|
+
lines.push(`\n### Current Focus: ${current.id} (${current.type})`);
|
|
566
|
+
lines.push(`**Name:** ${current.name}`);
|
|
567
|
+
if (current.description)
|
|
568
|
+
lines.push(`**Description:** ${current.description}`);
|
|
569
|
+
lines.push(`**Status:** ${current.status}`);
|
|
570
|
+
if (subgraph.nodes.length > 1) {
|
|
571
|
+
lines.push("\n#### Related Nodes");
|
|
572
|
+
for (const node of subgraph.nodes) {
|
|
573
|
+
if (node.id !== currentNodeId) {
|
|
574
|
+
lines.push(`- ${node.id} (${node.type}): ${node.name} [${node.status}]`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const pendingChanges = graph.nodes.filter((n) => n.type === "change" && ["DRAFT", "PROPOSED"].includes(n.status));
|
|
581
|
+
if (pendingChanges.length > 0) {
|
|
582
|
+
lines.push("\n### Pending Changes");
|
|
583
|
+
for (const change of pendingChanges) {
|
|
584
|
+
lines.push(`- ${change.id}: ${change.name} [${change.status}]`);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
const blocked = graph.nodes.filter((n) => n.status === "BLOCKED");
|
|
588
|
+
if (blocked.length > 0) {
|
|
589
|
+
lines.push("\n### Blocked Items");
|
|
590
|
+
for (const item of blocked) {
|
|
591
|
+
lines.push(`- ${item.id} (${item.type}): ${item.name}`);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
// Keep a deterministic upper bound on injected context. Tool calls can
|
|
595
|
+
// retrieve full detail when necessary, avoiding prompt growth with graph size.
|
|
596
|
+
const maxChars = Math.max(800, tokenBudget * 4);
|
|
597
|
+
const context = lines.join("\n");
|
|
598
|
+
return context.length <= maxChars ? context : `${context.slice(0, maxChars)}\n… context truncated; query the graph for details.`;
|
|
599
|
+
}
|
|
600
|
+
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/opencode/system-prompt.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* Invalidate cache for specific node types after a mutation.
|
|
4
|
+
*/
|
|
5
|
+
export declare function invalidateCacheForMutation(directory: string, nodeTypes: string[], relTypes?: string[]): void;
|
|
6
|
+
export declare const invalidateCache: typeof invalidateCacheForMutation;
|
|
7
|
+
export declare function createSddTools(): Record<string, ToolDefinition>;
|
|
8
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/opencode/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAoH/D;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,IAAI,CAKhH;AAGD,eAAO,MAAM,eAAe,mCAA6B,CAAA;AAwBzD,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA82H/D"}
|