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,409 @@
|
|
|
1
|
+
import * as yaml from "js-yaml"
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync } from "fs"
|
|
3
|
+
import { join, dirname } from "path"
|
|
4
|
+
import type { KnowledgeGraph, AnyNode, NodeType, NodeStatus, Relationship } from "../domain/types.js"
|
|
5
|
+
import { GraphIndices } from "../graph/index.js"
|
|
6
|
+
import type { GraphRepository } from "./repository.js"
|
|
7
|
+
import { getCacheManager } from "../cache/manager.js"
|
|
8
|
+
import { recordLegitimateSave, validateGraphIntegrity, isGraphTampered } from "../graph/integrity-guard.js"
|
|
9
|
+
|
|
10
|
+
export function readYaml<T>(filePath: string): T {
|
|
11
|
+
const content = readFileSync(filePath, "utf-8")
|
|
12
|
+
return yaml.load(content) as T
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function writeYaml(filePath: string, data: unknown): void {
|
|
16
|
+
const dir = dirname(filePath)
|
|
17
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
|
|
18
|
+
const content = yaml.dump(data, {
|
|
19
|
+
noRefs: true,
|
|
20
|
+
lineWidth: 120,
|
|
21
|
+
quotingType: '"',
|
|
22
|
+
forceQuotes: false,
|
|
23
|
+
})
|
|
24
|
+
writeFileSync(filePath, content, "utf-8")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function readJson<T>(filePath: string): T {
|
|
28
|
+
const content = readFileSync(filePath, "utf-8")
|
|
29
|
+
return JSON.parse(content) as T
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function writeJson(filePath: string, data: unknown): void {
|
|
33
|
+
const dir = dirname(filePath)
|
|
34
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
|
|
35
|
+
writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ensureDir(dirPath: string): void {
|
|
39
|
+
if (!existsSync(dirPath)) {
|
|
40
|
+
mkdirSync(dirPath, { recursive: true })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function fileExists(filePath: string): boolean {
|
|
45
|
+
return existsSync(filePath)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function listFiles(dirPath: string, extension?: string): string[] {
|
|
49
|
+
if (!existsSync(dirPath)) return []
|
|
50
|
+
const entries = readdirSync(dirPath, { withFileTypes: true })
|
|
51
|
+
const files: string[] = []
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
if (entry.isFile()) {
|
|
54
|
+
if (!extension || entry.name.endsWith(extension)) {
|
|
55
|
+
files.push(join(dirPath, entry.name))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return files
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function listDirs(dirPath: string): string[] {
|
|
63
|
+
if (!existsSync(dirPath)) return []
|
|
64
|
+
const entries = readdirSync(dirPath, { withFileTypes: true })
|
|
65
|
+
return entries
|
|
66
|
+
.filter((e) => e.isDirectory())
|
|
67
|
+
.map((e) => join(dirPath, e.name))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── Cache types ──────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
interface GraphCache {
|
|
73
|
+
graph: KnowledgeGraph
|
|
74
|
+
indices: GraphIndices
|
|
75
|
+
lastModified: number
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── Repository ───────────────────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* YAML-backed graph repository.
|
|
82
|
+
* Suitable for small to medium projects (<1000 nodes).
|
|
83
|
+
* Uses in-memory cache and pre-computed indices for fast queries.
|
|
84
|
+
*/
|
|
85
|
+
export class YamlGraphRepository implements GraphRepository {
|
|
86
|
+
private baseDir: string
|
|
87
|
+
private graphPath: string
|
|
88
|
+
private static cache: Map<string, GraphCache> = new Map()
|
|
89
|
+
|
|
90
|
+
constructor(projectDir: string) {
|
|
91
|
+
this.baseDir = join(projectDir, ".sdd")
|
|
92
|
+
this.graphPath = join(this.baseDir, "graph.yaml")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
ensureSddDir(): void {
|
|
96
|
+
ensureDir(this.baseDir)
|
|
97
|
+
ensureDir(join(this.baseDir, "nodes"))
|
|
98
|
+
ensureDir(join(this.baseDir, "relationships"))
|
|
99
|
+
ensureDir(join(this.baseDir, "changes"))
|
|
100
|
+
ensureDir(join(this.baseDir, "snapshots"))
|
|
101
|
+
ensureDir(join(this.baseDir, "transactions"))
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
isInitialized(): boolean {
|
|
105
|
+
return fileExists(this.graphPath)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
loadGraph(): KnowledgeGraph {
|
|
109
|
+
if (!this.isInitialized()) {
|
|
110
|
+
throw new Error("SDD not initialized. Run sdd.initialize first.")
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Check cache with revalidation
|
|
114
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
115
|
+
if (cached) {
|
|
116
|
+
// Revalidation: check if file was modified externally
|
|
117
|
+
const currentMtime = (() => { try { return require("fs").statSync(this.graphPath).mtimeMs } catch { return 0 } })()
|
|
118
|
+
if (currentMtime <= cached.lastModified) {
|
|
119
|
+
// Cache is valid — also check incremental hash
|
|
120
|
+
const cacheMgr = getCacheManager(require("path").dirname(this.baseDir))
|
|
121
|
+
if (cacheMgr.isGraphHashValid(cached.indices.totalNodes + ":" + cached.indices.totalRelationships)) {
|
|
122
|
+
// Never expose the cached snapshot itself: callers intentionally
|
|
123
|
+
// mutate the graph before saveGraph(), and leaking this reference
|
|
124
|
+
// makes old/new comparisons impossible.
|
|
125
|
+
return structuredClone(cached.graph)
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// File was modified externally or hash mismatch, invalidate cache
|
|
129
|
+
YamlGraphRepository.cache.delete(this.graphPath)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Cross-process check
|
|
133
|
+
const cacheMgr = getCacheManager(require("path").dirname(this.baseDir))
|
|
134
|
+
if (cacheMgr.checkCrossProcessInvalidation(this.graphPath)) {
|
|
135
|
+
YamlGraphRepository.cache.delete(this.graphPath)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const graph = readYaml<KnowledgeGraph>(this.graphPath)
|
|
139
|
+
const indices = GraphIndices.from(graph)
|
|
140
|
+
const stat = (() => { try { return require("fs").statSync(this.graphPath).mtimeMs } catch { return 0 } })()
|
|
141
|
+
|
|
142
|
+
YamlGraphRepository.cache.set(this.graphPath, {
|
|
143
|
+
graph,
|
|
144
|
+
indices,
|
|
145
|
+
lastModified: stat,
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
// Initialize incremental hash
|
|
149
|
+
cacheMgr.initGraphHash(graph.nodes.length, graph.relationships.length)
|
|
150
|
+
|
|
151
|
+
// Anti-bypass: check for out-of-band modifications
|
|
152
|
+
const projectDir = require("path").dirname(this.baseDir)
|
|
153
|
+
try {
|
|
154
|
+
const tamperResult = validateGraphIntegrity(projectDir, graph)
|
|
155
|
+
if (tamperResult.tampered) {
|
|
156
|
+
// Graph was modified outside SDD workflow — attach warning to graph metadata
|
|
157
|
+
;(graph.metadata as any).__tamper_warning = tamperResult.reason
|
|
158
|
+
}
|
|
159
|
+
} catch {}
|
|
160
|
+
|
|
161
|
+
return structuredClone(graph)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
getIndices(): GraphIndices {
|
|
165
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
166
|
+
if (cached) return cached.indices
|
|
167
|
+
|
|
168
|
+
const graph = this.loadGraph()
|
|
169
|
+
return GraphIndices.from(graph)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
saveGraph(graph: KnowledgeGraph): void {
|
|
173
|
+
this.ensureSddDir()
|
|
174
|
+
|
|
175
|
+
// Acquire cross-process lock
|
|
176
|
+
const cacheMgr = getCacheManager(require("path").dirname(this.baseDir))
|
|
177
|
+
cacheMgr.acquireWriteLock()
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
writeYaml(this.graphPath, graph)
|
|
181
|
+
} finally {
|
|
182
|
+
cacheMgr.releaseWriteLock()
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Record legitimate save for anti-bypass integrity tracking
|
|
186
|
+
const projectDir = require("path").dirname(this.baseDir)
|
|
187
|
+
try {
|
|
188
|
+
recordLegitimateSave(projectDir, graph)
|
|
189
|
+
} catch {}
|
|
190
|
+
|
|
191
|
+
// Keep an immutable cache snapshot. Compute the dirty state before
|
|
192
|
+
// replacing it; doing this afterwards compares the new graph to itself.
|
|
193
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
194
|
+
const { computeDirtyState } = require("../graph/index.js")
|
|
195
|
+
const snapshot = structuredClone(graph) as KnowledgeGraph
|
|
196
|
+
const dirty = computeDirtyState(cached?.graph || null, snapshot)
|
|
197
|
+
|
|
198
|
+
// Rebuilding the in-memory index is deterministic and avoids stale
|
|
199
|
+
// readonly totals/search entries after additions and removals. YAML is
|
|
200
|
+
// limited to small graphs; large graphs migrate to SQLite.
|
|
201
|
+
const indices = GraphIndices.from(snapshot)
|
|
202
|
+
YamlGraphRepository.cache.set(this.graphPath, {
|
|
203
|
+
graph: snapshot,
|
|
204
|
+
indices,
|
|
205
|
+
lastModified: Date.now(),
|
|
206
|
+
})
|
|
207
|
+
/*
|
|
208
|
+
if (cached) {
|
|
209
|
+
// Compute dirty nodes incrementally
|
|
210
|
+
const oldGraph = cached.graph
|
|
211
|
+
const { computeDirtyState } = require("../graph/index.js")
|
|
212
|
+
const dirty = computeDirtyState(oldGraph, graph)
|
|
213
|
+
|
|
214
|
+
if (!dirty.allChanged && dirty.dirtyNodeIds.size <= 50) {
|
|
215
|
+
// Incremental update: modify only affected entries
|
|
216
|
+
for (const nodeId of dirty.dirtyNodeIds) {
|
|
217
|
+
const oldNode = oldGraph.nodes.find(n => n.id === nodeId)
|
|
218
|
+
const newNode = graph.nodes.find(n => n.id === nodeId)
|
|
219
|
+
if (oldNode && newNode) {
|
|
220
|
+
cached.indices.updateNode(oldNode, newNode)
|
|
221
|
+
} else if (newNode) {
|
|
222
|
+
cached.indices.addNode(newNode)
|
|
223
|
+
} else if (oldNode) {
|
|
224
|
+
cached.indices.removeNode(nodeId)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// Update relationship indices incrementally
|
|
228
|
+
const oldRelKeys = new Set(oldGraph.relationships.map(r => `${r.from}||${r.to}||${r.type}`))
|
|
229
|
+
const newRelKeys = new Set(graph.relationships.map(r => `${r.from}||${r.to}||${r.type}`))
|
|
230
|
+
for (const rel of graph.relationships) {
|
|
231
|
+
const key = `${rel.from}||${rel.to}||${rel.type}`
|
|
232
|
+
if (!oldRelKeys.has(key)) {
|
|
233
|
+
cached.indices.addRelationship(rel)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
for (const rel of oldGraph.relationships) {
|
|
237
|
+
const key = `${rel.from}||${rel.to}||${rel.type}`
|
|
238
|
+
if (!newRelKeys.has(key)) {
|
|
239
|
+
cached.indices.removeRelationship(rel)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
// Full rebuild needed
|
|
244
|
+
YamlGraphRepository.cache.delete(this.graphPath)
|
|
245
|
+
const indices = GraphIndices.from(graph)
|
|
246
|
+
YamlGraphRepository.cache.set(this.graphPath, {
|
|
247
|
+
graph,
|
|
248
|
+
indices,
|
|
249
|
+
lastModified: Date.now(),
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
253
|
+
// No previous cache, full build
|
|
254
|
+
const indices = GraphIndices.from(graph)
|
|
255
|
+
YamlGraphRepository.cache.set(this.graphPath, {
|
|
256
|
+
graph,
|
|
257
|
+
indices,
|
|
258
|
+
lastModified: Date.now(),
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
// Update incremental hash
|
|
264
|
+
cacheMgr.initGraphHash(graph.nodes.length, graph.relationships.length)
|
|
265
|
+
|
|
266
|
+
// A: Granular invalidation — only invalidate caches for changed types
|
|
267
|
+
if (dirty.allChanged || dirty.dirtyTypes.size > 10) {
|
|
268
|
+
// Too many types changed — full invalidation is faster
|
|
269
|
+
cacheMgr.invalidateAll()
|
|
270
|
+
} else if (dirty.dirtyTypes.size > 0) {
|
|
271
|
+
// A: Partial invalidation — only affected types
|
|
272
|
+
cacheMgr.invalidatePartial([...dirty.dirtyTypes])
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// G: Save graph snapshot to disk for cross-session restore
|
|
276
|
+
cacheMgr.saveGraphSnapshot(graph)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
getStorageType(): "yaml" {
|
|
280
|
+
return "yaml"
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
isCacheValid(): boolean {
|
|
284
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
285
|
+
if (!cached) return false
|
|
286
|
+
try {
|
|
287
|
+
const stat = require("fs").statSync(this.graphPath)
|
|
288
|
+
return stat.mtimeMs <= cached.lastModified
|
|
289
|
+
} catch {
|
|
290
|
+
return false
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
invalidateCache(): void {
|
|
295
|
+
YamlGraphRepository.cache.delete(this.graphPath)
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
createProject(projectId: string, name: string, description?: string): KnowledgeGraph {
|
|
299
|
+
this.ensureSddDir()
|
|
300
|
+
const now = new Date().toISOString()
|
|
301
|
+
const graph: KnowledgeGraph = {
|
|
302
|
+
version: "1.0.0",
|
|
303
|
+
project_id: projectId,
|
|
304
|
+
nodes: [
|
|
305
|
+
{
|
|
306
|
+
id: projectId,
|
|
307
|
+
type: "project",
|
|
308
|
+
name,
|
|
309
|
+
description,
|
|
310
|
+
status: "DRAFT",
|
|
311
|
+
version: 1,
|
|
312
|
+
metadata: { name, description },
|
|
313
|
+
created_at: now,
|
|
314
|
+
updated_at: now,
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
relationships: [],
|
|
318
|
+
metadata: {
|
|
319
|
+
created_at: now,
|
|
320
|
+
updated_at: now,
|
|
321
|
+
sdd_version: "1.0.0",
|
|
322
|
+
},
|
|
323
|
+
}
|
|
324
|
+
this.saveGraph(graph)
|
|
325
|
+
return graph
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
createSnapshot(description: string): string {
|
|
329
|
+
const graph = this.loadGraph()
|
|
330
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, "-")
|
|
331
|
+
const snapshotId = `snapshot-${timestamp}`
|
|
332
|
+
const snapshotPath = join(this.baseDir, "snapshots", `${snapshotId}.yaml`)
|
|
333
|
+
writeYaml(snapshotPath, { id: snapshotId, timestamp: new Date().toISOString(), description, graph_state: graph })
|
|
334
|
+
return snapshotId
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
listSnapshots(): string[] {
|
|
338
|
+
const snapDir = join(this.baseDir, "snapshots")
|
|
339
|
+
// Get both YAML files and directories (for snapshot folders)
|
|
340
|
+
const yamlFiles = listFiles(snapDir, ".yaml")
|
|
341
|
+
const dirs = listDirs(snapDir)
|
|
342
|
+
return [...yamlFiles, ...dirs]
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
migrateTo(target: "yaml" | "sqlite", projectDir: string): GraphRepository {
|
|
346
|
+
const graph = this.loadGraph()
|
|
347
|
+
|
|
348
|
+
if (target === "sqlite") {
|
|
349
|
+
const { SqliteGraphRepository } = require("./sqlite.js")
|
|
350
|
+
const repo = new SqliteGraphRepository(projectDir)
|
|
351
|
+
repo.saveGraph(graph)
|
|
352
|
+
return repo
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Already YAML
|
|
356
|
+
return this
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// ── Optimized queries (use indices) ─────────────────────────────
|
|
360
|
+
|
|
361
|
+
getNodeCount(): number {
|
|
362
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
363
|
+
if (cached) return cached.indices.totalNodes
|
|
364
|
+
// Quick count without full parse
|
|
365
|
+
try {
|
|
366
|
+
const content = readFileSync(this.graphPath, "utf-8")
|
|
367
|
+
const matches = content.match(/^ - id:/gm)
|
|
368
|
+
return matches ? matches.length : 0
|
|
369
|
+
} catch {
|
|
370
|
+
return 0
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
getRelationshipCount(): number {
|
|
375
|
+
const cached = YamlGraphRepository.cache.get(this.graphPath)
|
|
376
|
+
if (cached) return cached.indices.totalRelationships
|
|
377
|
+
return 0
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
getNodesByType(type: NodeType): AnyNode[] {
|
|
381
|
+
// Check per-type cache first
|
|
382
|
+
const cacheMgr = getCacheManager(require("path").dirname(this.baseDir))
|
|
383
|
+
const graphVersion = (() => { try { return this.loadGraph().metadata.updated_at } catch { return "" } })()
|
|
384
|
+
const versionNum = graphVersion ? new Date(graphVersion).getTime() : 0
|
|
385
|
+
const cached = cacheMgr.getCachedNodesByType(type, versionNum)
|
|
386
|
+
if (cached) return cached
|
|
387
|
+
|
|
388
|
+
const indices = this.getIndices()
|
|
389
|
+
const nodes = indices.getNodesByType(type)
|
|
390
|
+
cacheMgr.setCachedNodesByType(type, nodes, versionNum)
|
|
391
|
+
return nodes
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
getNodesByStatus(status: NodeStatus): AnyNode[] {
|
|
395
|
+
const indices = this.getIndices()
|
|
396
|
+
return indices.getNodesByStatus(status)
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
getNodeById(id: string): AnyNode | undefined {
|
|
400
|
+
// Check byId map directly (O(1))
|
|
401
|
+
const indices = this.getIndices()
|
|
402
|
+
return indices.byId.get(id)
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
getRelationshipsForNode(nodeId: string): Relationship[] {
|
|
406
|
+
const indices = this.getIndices()
|
|
407
|
+
return indices.getRelationships(nodeId)
|
|
408
|
+
}
|
|
409
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { KnowledgeGraph } from "../domain/types.js"
|
|
2
|
+
import { getNodesByType, getNodesByTypeIndexed } from "../graph/engine.js"
|
|
3
|
+
import { GraphIndices } from "../graph/index.js"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A dependency rule maps a keyword pattern to the graph infrastructure
|
|
7
|
+
* required to verify a promise. If the infrastructure doesn't exist
|
|
8
|
+
* in the graph, the promise is marked as "unverifiable".
|
|
9
|
+
*
|
|
10
|
+
* The AI can configure these rules to adapt to different project types.
|
|
11
|
+
*/
|
|
12
|
+
export interface DependencyRule {
|
|
13
|
+
/** Keywords that trigger this rule (any match activates it) */
|
|
14
|
+
keywords: string[]
|
|
15
|
+
/** Description of what this rule checks */
|
|
16
|
+
description: string
|
|
17
|
+
/**
|
|
18
|
+
* Function that checks if the required infrastructure exists in the graph.
|
|
19
|
+
* Returns true if the promise CAN be verified (infrastructure exists).
|
|
20
|
+
*/
|
|
21
|
+
checkExists: (graph: KnowledgeGraph, indices: GraphIndices) => boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Default dependency rules for infrastructure detection.
|
|
26
|
+
* The AI can extend or override these per-project.
|
|
27
|
+
*/
|
|
28
|
+
export const DEFAULT_DEPENDENCY_RULES: DependencyRule[] = [
|
|
29
|
+
{
|
|
30
|
+
keywords: ["docker", "container", "dockerfile", "docker-compose", "image"],
|
|
31
|
+
description: "Docker infrastructure required",
|
|
32
|
+
checkExists: (graph) => {
|
|
33
|
+
// Check for Docker-related architecture components
|
|
34
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
35
|
+
const hasDockerArch = archNodes.some(n => {
|
|
36
|
+
const tech = (n.metadata as any).technology?.toLowerCase() || ""
|
|
37
|
+
return tech.includes("docker")
|
|
38
|
+
})
|
|
39
|
+
// Check for Docker files
|
|
40
|
+
const files = getNodesByType(graph, "file")
|
|
41
|
+
const hasDockerFiles = files.some(f => {
|
|
42
|
+
const path = (f.metadata as any).path?.toLowerCase() || ""
|
|
43
|
+
return path.includes("dockerfile") || path.includes("docker-compose") || path.includes(".dockerignore")
|
|
44
|
+
})
|
|
45
|
+
return hasDockerArch || hasDockerFiles
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
keywords: ["health check", "healthcheck", "liveness", "readiness", "probes"],
|
|
50
|
+
description: "Health check infrastructure required",
|
|
51
|
+
checkExists: (graph) => {
|
|
52
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
53
|
+
return archNodes.some(n => {
|
|
54
|
+
const name = n.name.toLowerCase()
|
|
55
|
+
const tech = (n.metadata as any).technology?.toLowerCase() || ""
|
|
56
|
+
return name.includes("health") || name.includes("monitoring") || tech.includes("health")
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
keywords: ["rollback", "roll-back", "auto-rollback", "automático"],
|
|
62
|
+
description: "Rollback infrastructure required",
|
|
63
|
+
checkExists: (graph) => {
|
|
64
|
+
// Check for migration nodes with rollback scripts
|
|
65
|
+
const migrations = getNodesByType(graph, "migration")
|
|
66
|
+
if (migrations.length > 0) return true
|
|
67
|
+
// Check for architecture components related to deployment
|
|
68
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
69
|
+
return archNodes.some(n => {
|
|
70
|
+
const name = n.name.toLowerCase()
|
|
71
|
+
return name.includes("deploy") || name.includes("ci") || name.includes("cd")
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
keywords: ["dlq", "dead letter", "dead-letter", "idempotency", "idempotent"],
|
|
77
|
+
description: "Message queue infrastructure required",
|
|
78
|
+
checkExists: (graph) => {
|
|
79
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
80
|
+
return archNodes.some(n => {
|
|
81
|
+
const tech = (n.metadata as any).technology?.toLowerCase() || ""
|
|
82
|
+
const name = n.name.toLowerCase()
|
|
83
|
+
return tech.includes("queue") || tech.includes("rabbitmq") || tech.includes("kafka") ||
|
|
84
|
+
tech.includes("bull") || tech.includes("redis") ||
|
|
85
|
+
name.includes("queue") || name.includes("worker") || name.includes("event")
|
|
86
|
+
})
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
keywords: ["observability", "observabilidade", "logging", "tracing", "metrics", "prometheus", "grafana", "datadog"],
|
|
91
|
+
description: "Observability stack required",
|
|
92
|
+
checkExists: (graph) => {
|
|
93
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
94
|
+
const hasObs = archNodes.some(n => {
|
|
95
|
+
const tech = (n.metadata as any).technology?.toLowerCase() || ""
|
|
96
|
+
const name = n.name.toLowerCase()
|
|
97
|
+
return tech.includes("prometheus") || tech.includes("grafana") || tech.includes("datadog") ||
|
|
98
|
+
tech.includes("opentelemetry") || tech.includes("otel") ||
|
|
99
|
+
name.includes("observ") || name.includes("monitor") || name.includes("log")
|
|
100
|
+
})
|
|
101
|
+
// Also check for metric/alert nodes
|
|
102
|
+
const metrics = getNodesByType(graph, "metric")
|
|
103
|
+
const alerts = getNodesByType(graph, "alert")
|
|
104
|
+
return hasObs || metrics.length > 0 || alerts.length > 0
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
keywords: ["semver", "semantic version", "versioning"],
|
|
109
|
+
description: "Versioning infrastructure required",
|
|
110
|
+
checkExists: (graph) => {
|
|
111
|
+
// Check for manifest/config files with versioning
|
|
112
|
+
const files = getNodesByType(graph, "file")
|
|
113
|
+
return files.some(f => {
|
|
114
|
+
const path = (f.metadata as any).path?.toLowerCase() || ""
|
|
115
|
+
return path.includes("package.json") || path.includes("manifest") || path.includes("version")
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
keywords: ["performance", "perf", "latência", "response time", "tempo de resposta"],
|
|
121
|
+
description: "Performance measurement infrastructure required",
|
|
122
|
+
checkExists: (graph) => {
|
|
123
|
+
// Check for SLA nodes or metric nodes related to performance
|
|
124
|
+
const slas = getNodesByType(graph, "sla")
|
|
125
|
+
const metrics = getNodesByType(graph, "metric")
|
|
126
|
+
const hasPerfSla = slas.some(s => {
|
|
127
|
+
const metric = (s.metadata as any).metric?.toLowerCase() || ""
|
|
128
|
+
return metric.includes("response") || metric.includes("latency") || metric.includes("performance")
|
|
129
|
+
})
|
|
130
|
+
const hasPerfMetric = metrics.some(m => {
|
|
131
|
+
const name = (m.metadata as any).metric_name?.toLowerCase() || ""
|
|
132
|
+
return name.includes("response") || name.includes("latency") || name.includes("p99")
|
|
133
|
+
})
|
|
134
|
+
return hasPerfSla || hasPerfMetric
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
keywords: ["cpt", "dynamic registration", "registro dinâmico"],
|
|
139
|
+
description: "Dynamic registration infrastructure required",
|
|
140
|
+
checkExists: (graph) => {
|
|
141
|
+
// Check for plugin system or module system architecture
|
|
142
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
143
|
+
return archNodes.some(n => {
|
|
144
|
+
const name = n.name.toLowerCase()
|
|
145
|
+
return name.includes("plugin") || name.includes("module") || name.includes("registry")
|
|
146
|
+
})
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
keywords: ["cli search", "busca cli", "search cli"],
|
|
151
|
+
description: "CLI search infrastructure required",
|
|
152
|
+
checkExists: (graph) => {
|
|
153
|
+
// Check for CLI-related architecture or files
|
|
154
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
155
|
+
const hasCliArch = archNodes.some(n => {
|
|
156
|
+
const name = n.name.toLowerCase()
|
|
157
|
+
return name.includes("cli") || name.includes("command")
|
|
158
|
+
})
|
|
159
|
+
const files = getNodesByType(graph, "file")
|
|
160
|
+
const hasCliFiles = files.some(f => {
|
|
161
|
+
const path = (f.metadata as any).path?.toLowerCase() || ""
|
|
162
|
+
return path.includes("cli") || path.includes("command")
|
|
163
|
+
})
|
|
164
|
+
return hasCliArch || hasCliFiles
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
keywords: ["layer ordering", "layer order", "ordering", "ordenação"],
|
|
169
|
+
description: "Layer ordering infrastructure required",
|
|
170
|
+
checkExists: (graph) => {
|
|
171
|
+
// Check for multiple architecture components with defined layers
|
|
172
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
173
|
+
const layers = new Set(archNodes.map(n => (n.metadata as any).layer).filter(Boolean))
|
|
174
|
+
return layers.size >= 2
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
keywords: ["checksum", "hash", "integridade"],
|
|
179
|
+
description: "Checksum infrastructure required",
|
|
180
|
+
checkExists: (graph) => {
|
|
181
|
+
// Check for build/deploy pipeline architecture
|
|
182
|
+
const archNodes = getNodesByType(graph, "architecture_component")
|
|
183
|
+
return archNodes.some(n => {
|
|
184
|
+
const name = n.name.toLowerCase()
|
|
185
|
+
return name.includes("build") || name.includes("pipeline") || name.includes("ci")
|
|
186
|
+
})
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Classify whether a promise is verifiable based on its description
|
|
193
|
+
* and the current graph state.
|
|
194
|
+
*
|
|
195
|
+
* The AI can pass custom rules to override or extend the defaults.
|
|
196
|
+
*/
|
|
197
|
+
export function classifyPromiseVerifiability(
|
|
198
|
+
description: string,
|
|
199
|
+
graph: KnowledgeGraph,
|
|
200
|
+
customRules?: DependencyRule[],
|
|
201
|
+
): { verifiable: boolean; reason?: string } {
|
|
202
|
+
const rules = customRules || DEFAULT_DEPENDENCY_RULES
|
|
203
|
+
const indices = GraphIndices.from(graph)
|
|
204
|
+
const descLower = description.toLowerCase()
|
|
205
|
+
|
|
206
|
+
for (const rule of rules) {
|
|
207
|
+
// Check if any keyword matches the promise description
|
|
208
|
+
const matchesKeyword = rule.keywords.some(kw => descLower.includes(kw.toLowerCase()))
|
|
209
|
+
if (!matchesKeyword) continue
|
|
210
|
+
|
|
211
|
+
// Keyword matched — now check if the required infrastructure exists
|
|
212
|
+
const infrastructureExists = rule.checkExists(graph, indices)
|
|
213
|
+
if (!infrastructureExists) {
|
|
214
|
+
return {
|
|
215
|
+
verifiable: false,
|
|
216
|
+
reason: `Requires ${rule.description} (no matching infrastructure in graph)`,
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return { verifiable: true }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Batch classify a list of promises, returning those that are unverifiable.
|
|
226
|
+
*/
|
|
227
|
+
export function findUnverifiablePromises(
|
|
228
|
+
promises: Array<{ id: string; description: string; status: string }>,
|
|
229
|
+
graph: KnowledgeGraph,
|
|
230
|
+
customRules?: DependencyRule[],
|
|
231
|
+
): Array<{ id: string; description: string; reason: string }> {
|
|
232
|
+
const results: Array<{ id: string; description: string; reason: string }> = []
|
|
233
|
+
|
|
234
|
+
for (const promise of promises) {
|
|
235
|
+
if (promise.status !== "pending") continue
|
|
236
|
+
|
|
237
|
+
const classification = classifyPromiseVerifiability(
|
|
238
|
+
promise.description,
|
|
239
|
+
graph,
|
|
240
|
+
customRules,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
if (!classification.verifiable && classification.reason) {
|
|
244
|
+
results.push({
|
|
245
|
+
id: promise.id,
|
|
246
|
+
description: promise.description,
|
|
247
|
+
reason: classification.reason,
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return results
|
|
253
|
+
}
|