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,470 @@
|
|
|
1
|
+
import type { KnowledgeGraph, AnyNode, NodeType, Relationship } from "../domain/types.js"
|
|
2
|
+
import { GraphIndices } from "../graph/index.js"
|
|
3
|
+
import {
|
|
4
|
+
validateGraph,
|
|
5
|
+
type ValidationResult,
|
|
6
|
+
type ValidationError,
|
|
7
|
+
type ValidationWarning,
|
|
8
|
+
type ValidationPolicy,
|
|
9
|
+
} from "./validator.js"
|
|
10
|
+
import { getExclusionSets, isNodeExcludedOrDeprecated } from "../drift/exclusion.js"
|
|
11
|
+
import { ValidationIndex } from "./coverage-index.js"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Subsystem classification: which validation checks are relevant
|
|
15
|
+
* for each node type.
|
|
16
|
+
*/
|
|
17
|
+
const SUBSYSTEM_MAP: Record<string, string[]> = {
|
|
18
|
+
requirement: ["requirements", "semantic", "constitution"],
|
|
19
|
+
business_rule: ["rules", "semantic", "constitution"],
|
|
20
|
+
feature: ["features", "semantic"],
|
|
21
|
+
entity: ["entities", "persistence", "cross-layer"],
|
|
22
|
+
endpoint: ["endpoints", "api"],
|
|
23
|
+
api: ["endpoints", "api"],
|
|
24
|
+
architecture_component: ["architecture", "cross-layer"],
|
|
25
|
+
file: ["files", "cross-layer"],
|
|
26
|
+
symbol: ["files", "cross-layer"],
|
|
27
|
+
task: ["requirements"],
|
|
28
|
+
test: ["requirements"],
|
|
29
|
+
database: ["persistence"],
|
|
30
|
+
table: ["persistence"],
|
|
31
|
+
change: ["features", "semantic"],
|
|
32
|
+
constitution: ["constitution"],
|
|
33
|
+
project: ["completeness"],
|
|
34
|
+
domain: ["completeness"],
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Which validation subsystems exist and what they check.
|
|
39
|
+
*/
|
|
40
|
+
type ValidationSubsystem =
|
|
41
|
+
| "requirements"
|
|
42
|
+
| "features"
|
|
43
|
+
| "entities"
|
|
44
|
+
| "endpoints"
|
|
45
|
+
| "api"
|
|
46
|
+
| "architecture"
|
|
47
|
+
| "cross-layer"
|
|
48
|
+
| "persistence"
|
|
49
|
+
| "files"
|
|
50
|
+
| "semantic"
|
|
51
|
+
| "constitution"
|
|
52
|
+
| "completeness"
|
|
53
|
+
| "structural"
|
|
54
|
+
| "references"
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Map each subsystem to the node types it needs to check.
|
|
58
|
+
*/
|
|
59
|
+
const SUBSYSTEM_NODE_TYPES: Record<ValidationSubsystem, NodeType[]> = {
|
|
60
|
+
requirements: ["requirement", "task", "test"],
|
|
61
|
+
features: ["feature", "requirement", "change"],
|
|
62
|
+
entities: ["entity", "field"],
|
|
63
|
+
endpoints: ["endpoint"],
|
|
64
|
+
api: ["api", "endpoint"],
|
|
65
|
+
architecture: ["architecture_component"],
|
|
66
|
+
"cross-layer": ["file", "symbol", "architecture_component"],
|
|
67
|
+
persistence: ["entity", "table", "database"],
|
|
68
|
+
files: ["file", "symbol"],
|
|
69
|
+
semantic: ["requirement", "entity", "feature", "business_rule"],
|
|
70
|
+
constitution: ["constitution", "requirement", "business_rule"],
|
|
71
|
+
completeness: ["project", "feature", "requirement"],
|
|
72
|
+
structural: [], // Always runs - checks all nodes
|
|
73
|
+
references: [], // Always runs - checks all relationships
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Smart validation result with subsystem breakdown.
|
|
78
|
+
*/
|
|
79
|
+
export interface SmartValidationResult extends ValidationResult {
|
|
80
|
+
subsystems_checked: string[]
|
|
81
|
+
subsystems_skipped: string[]
|
|
82
|
+
nodes_checked: number
|
|
83
|
+
nodes_skipped: number
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Options for controlling smart validation scope.
|
|
88
|
+
* The AI can use these to request additional subsystems or exclude specific ones.
|
|
89
|
+
*/
|
|
90
|
+
export interface SmartValidationOptions {
|
|
91
|
+
/** Additional subsystems to validate beyond what was automatically detected. */
|
|
92
|
+
additionalSubsystems?: ValidationSubsystem[]
|
|
93
|
+
/** Subsystems to skip even if they were automatically detected. */
|
|
94
|
+
excludeSubsystems?: ValidationSubsystem[]
|
|
95
|
+
/** If true, validate ALL subsystems (ignore auto-detection). */
|
|
96
|
+
validateAll?: boolean
|
|
97
|
+
/** Maximum number of subsystems to validate (safety limit). */
|
|
98
|
+
maxSubsystems?: number
|
|
99
|
+
/** Shared validation index for coverage tracking across runs. */
|
|
100
|
+
coverageIndex?: ValidationIndex
|
|
101
|
+
/** Skip subsystems already verified in the coverage index. */
|
|
102
|
+
skipVerified?: boolean
|
|
103
|
+
/** Project-level severity policy for semantic validation. */
|
|
104
|
+
policy?: ValidationPolicy
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Determine which subsystems are affected by a set of changed nodes.
|
|
109
|
+
*/
|
|
110
|
+
export function getAffectedSubsystems(
|
|
111
|
+
dirtyNodeIds: Set<string>,
|
|
112
|
+
indices: GraphIndices,
|
|
113
|
+
): { subsystems: Set<ValidationSubsystem>; nodeIds: Set<string> } {
|
|
114
|
+
const subsystems = new Set<ValidationSubsystem>()
|
|
115
|
+
const relevantNodeIds = new Set<string>()
|
|
116
|
+
|
|
117
|
+
// Always check structural and references (cheap, global)
|
|
118
|
+
subsystems.add("structural")
|
|
119
|
+
subsystems.add("references")
|
|
120
|
+
|
|
121
|
+
for (const nodeId of dirtyNodeIds) {
|
|
122
|
+
const node = indices.byId.get(nodeId)
|
|
123
|
+
if (!node) continue
|
|
124
|
+
|
|
125
|
+
const nodeSubsystems = SUBSYSTEM_MAP[node.type] || []
|
|
126
|
+
for (const sub of nodeSubsystems) {
|
|
127
|
+
subsystems.add(sub as ValidationSubsystem)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Also include adjacent nodes (1-hop) for cross-checks
|
|
131
|
+
const outgoing = indices.getOutgoing(nodeId)
|
|
132
|
+
const incoming = indices.getIncoming(nodeId)
|
|
133
|
+
for (const rel of [...outgoing, ...incoming]) {
|
|
134
|
+
relevantNodeIds.add(rel.from)
|
|
135
|
+
relevantNodeIds.add(rel.to)
|
|
136
|
+
}
|
|
137
|
+
relevantNodeIds.add(nodeId)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { subsystems, nodeIds: relevantNodeIds }
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Smart validation: only checks subsystems affected by the changed nodes.
|
|
145
|
+
* Falls back to full validation if >50% of subsystems are affected.
|
|
146
|
+
*
|
|
147
|
+
* Uses GraphIndices for O(1) node lookups instead of O(n) array scans.
|
|
148
|
+
*/
|
|
149
|
+
export function validateSmart(
|
|
150
|
+
graph: KnowledgeGraph,
|
|
151
|
+
dirtyNodeIds: Set<string>,
|
|
152
|
+
options?: SmartValidationOptions,
|
|
153
|
+
): SmartValidationResult {
|
|
154
|
+
const indices = GraphIndices.from(graph)
|
|
155
|
+
const allSubsystems = new Set<ValidationSubsystem>([
|
|
156
|
+
"structural", "references", "requirements", "features", "entities",
|
|
157
|
+
"endpoints", "api", "architecture", "cross-layer", "persistence",
|
|
158
|
+
"files", "semantic", "constitution", "completeness",
|
|
159
|
+
])
|
|
160
|
+
|
|
161
|
+
// A caller that has no reliable change set is asking for validation of the
|
|
162
|
+
// current graph, not validation of an empty subset. Treating it as an
|
|
163
|
+
// incremental run used to produce successful validations without inspecting
|
|
164
|
+
// a single node.
|
|
165
|
+
if (dirtyNodeIds.size === 0 && !options?.additionalSubsystems && !options?.excludeSubsystems) {
|
|
166
|
+
const fullResult = validateGraph(graph, options?.policy)
|
|
167
|
+
const result: SmartValidationResult = {
|
|
168
|
+
...fullResult,
|
|
169
|
+
subsystems_checked: [...allSubsystems],
|
|
170
|
+
subsystems_skipped: [],
|
|
171
|
+
nodes_checked: graph.nodes.length,
|
|
172
|
+
nodes_skipped: 0,
|
|
173
|
+
}
|
|
174
|
+
if (options?.coverageIndex) options.coverageIndex.recordValidation(result)
|
|
175
|
+
return result
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Auto-detect affected subsystems from dirty nodes
|
|
179
|
+
const { subsystems: autoDetectedSubsystems, nodeIds: relevantNodeIds } =
|
|
180
|
+
getAffectedSubsystems(dirtyNodeIds, indices)
|
|
181
|
+
|
|
182
|
+
// Apply options: merge additional, exclude specific, or validate all
|
|
183
|
+
let subsystemsToCheck = new Set<ValidationSubsystem>(autoDetectedSubsystems)
|
|
184
|
+
|
|
185
|
+
if (options?.validateAll) {
|
|
186
|
+
// IA requested: validate everything
|
|
187
|
+
subsystemsToCheck = new Set(allSubsystems)
|
|
188
|
+
} else {
|
|
189
|
+
// Add additional subsystems requested by IA
|
|
190
|
+
if (options?.additionalSubsystems) {
|
|
191
|
+
for (const sub of options.additionalSubsystems) {
|
|
192
|
+
subsystemsToCheck.add(sub)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Exclude subsystems the IA wants to skip
|
|
196
|
+
if (options?.excludeSubsystems) {
|
|
197
|
+
for (const sub of options.excludeSubsystems) {
|
|
198
|
+
subsystemsToCheck.delete(sub)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Skip already-verified subsystems if coverage index is provided
|
|
204
|
+
if (options?.coverageIndex && options?.skipVerified) {
|
|
205
|
+
for (const sub of options.coverageIndex.getVerifiedSubsystems()) {
|
|
206
|
+
subsystemsToCheck.delete(sub as ValidationSubsystem)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Apply max limit if specified
|
|
211
|
+
if (options?.maxSubsystems && subsystemsToCheck.size > options.maxSubsystems) {
|
|
212
|
+
const arr = [...subsystemsToCheck].slice(0, options.maxSubsystems)
|
|
213
|
+
subsystemsToCheck = new Set(arr)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// If >50% of subsystems affected, just do full validation (cheaper than smart)
|
|
217
|
+
if (!options?.validateAll && subsystemsToCheck.size > allSubsystems.size * 0.5) {
|
|
218
|
+
const fullResult = validateGraph(graph, options?.policy)
|
|
219
|
+
return {
|
|
220
|
+
...fullResult,
|
|
221
|
+
subsystems_checked: [...allSubsystems],
|
|
222
|
+
subsystems_skipped: [],
|
|
223
|
+
nodes_checked: graph.nodes.length,
|
|
224
|
+
nodes_skipped: 0,
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const skippedSubsystems = [...allSubsystems].filter(
|
|
229
|
+
(s) => !subsystemsToCheck.has(s),
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
// For the affected subsystems, run targeted checks
|
|
233
|
+
const errors: ValidationError[] = []
|
|
234
|
+
const warnings: ValidationWarning[] = []
|
|
235
|
+
const { removed, deprecated } = getExclusionSets(graph)
|
|
236
|
+
|
|
237
|
+
// Collect only nodes in relevant subsystems
|
|
238
|
+
const relevantNodes = graph.nodes.filter((n) => relevantNodeIds.has(n.id))
|
|
239
|
+
const relevantRels = graph.relationships.filter(
|
|
240
|
+
(r) => relevantNodeIds.has(r.from) || relevantNodeIds.has(r.to),
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
// Subsystem-specific validation using indices
|
|
244
|
+
for (const subsystem of subsystemsToCheck) {
|
|
245
|
+
switch (subsystem) {
|
|
246
|
+
case "requirements":
|
|
247
|
+
validateRequirementsSmart(indices, relevantNodes, removed, deprecated, warnings)
|
|
248
|
+
break
|
|
249
|
+
case "entities":
|
|
250
|
+
validateEntitiesSmart(indices, relevantNodes, removed, deprecated, warnings)
|
|
251
|
+
break
|
|
252
|
+
case "endpoints":
|
|
253
|
+
validateEndpointsSmart(indices, relevantNodes, removed, deprecated, warnings)
|
|
254
|
+
break
|
|
255
|
+
case "cross-layer":
|
|
256
|
+
validateCrossLayerSmart(indices, relevantNodes, relevantRels, warnings)
|
|
257
|
+
break
|
|
258
|
+
case "structural":
|
|
259
|
+
validateStructuralSmart(relevantNodes, relevantRels, errors, warnings)
|
|
260
|
+
break
|
|
261
|
+
case "references":
|
|
262
|
+
validateReferencesSmart(relevantNodes, relevantRels, graph, errors)
|
|
263
|
+
break
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const result: SmartValidationResult = {
|
|
268
|
+
valid: errors.length === 0,
|
|
269
|
+
errors,
|
|
270
|
+
warnings,
|
|
271
|
+
subsystems_checked: subsystemsToCheck.size > 0 ? [...subsystemsToCheck] : ["structural"],
|
|
272
|
+
subsystems_skipped: skippedSubsystems,
|
|
273
|
+
nodes_checked: relevantNodes.length,
|
|
274
|
+
nodes_skipped: graph.nodes.length - relevantNodes.length,
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// Record coverage in the index if provided
|
|
278
|
+
if (options?.coverageIndex) {
|
|
279
|
+
options.coverageIndex.recordValidation(result)
|
|
280
|
+
// Record which specific nodes were checked
|
|
281
|
+
for (const sub of result.subsystems_checked) {
|
|
282
|
+
options.coverageIndex.recordNodesVerified(sub, relevantNodes.map(n => n.id))
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return result
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ── Smart subsystem validators (index-aware) ────────────────────────
|
|
290
|
+
|
|
291
|
+
function validateRequirementsSmart(
|
|
292
|
+
indices: GraphIndices,
|
|
293
|
+
nodes: AnyNode[],
|
|
294
|
+
removed: Set<string>,
|
|
295
|
+
deprecated: Set<string>,
|
|
296
|
+
warnings: ValidationWarning[],
|
|
297
|
+
): void {
|
|
298
|
+
const requirements = nodes.filter((n) => n.type === "requirement")
|
|
299
|
+
for (const req of requirements) {
|
|
300
|
+
if (isNodeExcludedOrDeprecated(req.id, req.status, removed, deprecated)) continue
|
|
301
|
+
|
|
302
|
+
// O(1) check using index
|
|
303
|
+
const outgoing = indices.getOutgoing(req.id)
|
|
304
|
+
const hasTask = outgoing.some(
|
|
305
|
+
(r) => r.type === "implemented_by" || r.type === "contains" || r.type === "belongs_to",
|
|
306
|
+
)
|
|
307
|
+
// VERIFIED requirements are already validated, skip warning
|
|
308
|
+
if (!hasTask && req.status !== "VERIFIED") {
|
|
309
|
+
warnings.push({
|
|
310
|
+
code: "REQUIREMENT_NO_TASK",
|
|
311
|
+
message: `Requirement ${req.id} has no implementing task`,
|
|
312
|
+
node_id: req.id,
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const meta = req.metadata as any
|
|
317
|
+
if (!meta.acceptance_criteria || meta.acceptance_criteria.length === 0) {
|
|
318
|
+
if (!req.description || req.description.length < 10) {
|
|
319
|
+
warnings.push({
|
|
320
|
+
code: "REQUIREMENT_NO_CRITERIA",
|
|
321
|
+
message: `Requirement "${req.name}" has no acceptance criteria and minimal description`,
|
|
322
|
+
node_id: req.id,
|
|
323
|
+
})
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function validateEntitiesSmart(
|
|
330
|
+
indices: GraphIndices,
|
|
331
|
+
nodes: AnyNode[],
|
|
332
|
+
removed: Set<string>,
|
|
333
|
+
deprecated: Set<string>,
|
|
334
|
+
warnings: ValidationWarning[],
|
|
335
|
+
): void {
|
|
336
|
+
const entities = nodes.filter((n) => n.type === "entity")
|
|
337
|
+
for (const entity of entities) {
|
|
338
|
+
if (isNodeExcludedOrDeprecated(entity.id, entity.status, removed, deprecated)) continue
|
|
339
|
+
|
|
340
|
+
const meta = entity.metadata as Record<string, unknown>
|
|
341
|
+
const fields = (meta.fields as any[]) || []
|
|
342
|
+
if (fields.length === 0) {
|
|
343
|
+
warnings.push({
|
|
344
|
+
code: "ENTITY_NO_FIELDS",
|
|
345
|
+
message: `Entity "${entity.name}" has no fields defined`,
|
|
346
|
+
node_id: entity.id,
|
|
347
|
+
})
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function validateEndpointsSmart(
|
|
353
|
+
indices: GraphIndices,
|
|
354
|
+
nodes: AnyNode[],
|
|
355
|
+
removed: Set<string>,
|
|
356
|
+
deprecated: Set<string>,
|
|
357
|
+
warnings: ValidationWarning[],
|
|
358
|
+
): void {
|
|
359
|
+
const endpoints = nodes.filter((n) => n.type === "endpoint")
|
|
360
|
+
for (const ep of endpoints) {
|
|
361
|
+
if (isNodeExcludedOrDeprecated(ep.id, ep.status, removed, deprecated)) continue
|
|
362
|
+
|
|
363
|
+
const meta = ep.metadata as any
|
|
364
|
+
if (!meta.method) warnings.push({ code: "ENDPOINT_NO_METHOD", message: `Endpoint ${ep.id} has no HTTP method`, node_id: ep.id })
|
|
365
|
+
if (!meta.path) warnings.push({ code: "ENDPOINT_NO_PATH", message: `Endpoint ${ep.id} has no path`, node_id: ep.id })
|
|
366
|
+
|
|
367
|
+
// O(1) check using index
|
|
368
|
+
const incoming = indices.getIncoming(ep.id)
|
|
369
|
+
const hasApi = incoming.some((r) => r.type === "contains")
|
|
370
|
+
if (!hasApi) warnings.push({ code: "ENDPOINT_ORPHAN", message: `Endpoint ${ep.id} is not contained by any API`, node_id: ep.id })
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function validateCrossLayerSmart(
|
|
375
|
+
indices: GraphIndices,
|
|
376
|
+
nodes: AnyNode[],
|
|
377
|
+
relationships: Relationship[],
|
|
378
|
+
warnings: ValidationWarning[],
|
|
379
|
+
): void {
|
|
380
|
+
const LAYER_ORDER: Record<string, number> = {
|
|
381
|
+
shared: 0, database: 1, backend: 2, frontend: 3, infrastructure: 4,
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function inferLayer(path: string): string | null {
|
|
385
|
+
const p = path.toLowerCase()
|
|
386
|
+
if (p.includes("client") || p.includes("frontend") || p.includes("pages/") || p.includes("components/")) return "frontend"
|
|
387
|
+
if (p.includes("server") || p.includes("backend") || p.includes("routes/") || p.includes("services/")) return "backend"
|
|
388
|
+
if (p.includes("database") || p.includes("migrations/") || p.includes("schema")) return "database"
|
|
389
|
+
if (p.includes("shared") || p.includes("common")) return "shared"
|
|
390
|
+
return null
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const fileNodes = nodes.filter((n) => n.type === "file")
|
|
394
|
+
const fileLayerMap = new Map<string, string>()
|
|
395
|
+
for (const f of fileNodes) {
|
|
396
|
+
const path = (f.metadata as any).path
|
|
397
|
+
if (path) {
|
|
398
|
+
const layer = inferLayer(path)
|
|
399
|
+
if (layer) fileLayerMap.set(f.id, layer)
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
for (const rel of relationships) {
|
|
404
|
+
if (rel.type !== "uses" && rel.type !== "depends_on") continue
|
|
405
|
+
const fromLayer = fileLayerMap.get(rel.from)
|
|
406
|
+
const toLayer = fileLayerMap.get(rel.to)
|
|
407
|
+
if (!fromLayer || !toLayer || fromLayer === toLayer || fromLayer === "shared" || toLayer === "shared") continue
|
|
408
|
+
|
|
409
|
+
const fromOrder = LAYER_ORDER[fromLayer] ?? 2
|
|
410
|
+
const toOrder = LAYER_ORDER[toLayer] ?? 2
|
|
411
|
+
if (fromOrder > toOrder) {
|
|
412
|
+
const fromNode = indices.byId.get(rel.from)
|
|
413
|
+
const toNode = indices.byId.get(rel.to)
|
|
414
|
+
warnings.push({
|
|
415
|
+
code: "CROSS_LAYER_IMPORT",
|
|
416
|
+
message: `${fromLayer} file "${fromNode?.name || rel.from}" imports from ${toLayer} file "${toNode?.name || rel.to}" — architecture violation`,
|
|
417
|
+
node_id: rel.from,
|
|
418
|
+
})
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
function validateStructuralSmart(
|
|
424
|
+
nodes: AnyNode[],
|
|
425
|
+
relationships: Relationship[],
|
|
426
|
+
errors: ValidationError[],
|
|
427
|
+
warnings: ValidationWarning[],
|
|
428
|
+
): void {
|
|
429
|
+
const ids = new Set<string>()
|
|
430
|
+
for (const rawNode of nodes) {
|
|
431
|
+
const node = rawNode as { id?: string; type?: string; name?: string; status?: string }
|
|
432
|
+
if (!node.id) {
|
|
433
|
+
errors.push({ code: "MISSING_ID", message: "Node missing ID" })
|
|
434
|
+
continue
|
|
435
|
+
}
|
|
436
|
+
if (ids.has(node.id)) {
|
|
437
|
+
errors.push({ code: "DUPLICATE_ID", message: `Duplicate node ID: ${node.id}`, node_id: node.id })
|
|
438
|
+
}
|
|
439
|
+
ids.add(node.id)
|
|
440
|
+
if (!node.type) errors.push({ code: "MISSING_TYPE", message: `Node ${node.id} missing type`, node_id: node.id })
|
|
441
|
+
if (!node.name) warnings.push({ code: "MISSING_NAME", message: `Node ${node.id} missing name`, node_id: node.id })
|
|
442
|
+
if (!node.status) warnings.push({ code: "MISSING_STATUS", message: `Node ${node.id} missing status`, node_id: node.id })
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
for (const rel of relationships) {
|
|
446
|
+
if (!rel.from) errors.push({ code: "MISSING_RELATIONSHIP_FROM", message: `Relationship ${rel.id} missing 'from'`, relationship_id: rel.id })
|
|
447
|
+
if (!rel.to) errors.push({ code: "MISSING_RELATIONSHIP_TO", message: `Relationship ${rel.id} missing 'to'`, relationship_id: rel.id })
|
|
448
|
+
if (!rel.type) errors.push({ code: "MISSING_RELATIONSHIP_TYPE", message: `Relationship ${rel.id} missing type`, relationship_id: rel.id })
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function validateReferencesSmart(
|
|
453
|
+
nodes: AnyNode[],
|
|
454
|
+
relationships: Relationship[],
|
|
455
|
+
graph: KnowledgeGraph,
|
|
456
|
+
errors: ValidationError[],
|
|
457
|
+
): void {
|
|
458
|
+
const nodeIds = new Set(nodes.map((n) => n.id))
|
|
459
|
+
// Also include ALL node IDs for reference checking (a rel might reference outside the subset)
|
|
460
|
+
const allNodeIds = new Set(graph.nodes.map((n) => n.id))
|
|
461
|
+
|
|
462
|
+
for (const rel of relationships) {
|
|
463
|
+
if (rel.from && !allNodeIds.has(rel.from)) {
|
|
464
|
+
errors.push({ code: "DANGLING_REFERENCE", message: `Relationship ${rel.id} references non-existent source: ${rel.from}`, relationship_id: rel.id })
|
|
465
|
+
}
|
|
466
|
+
if (rel.to && !allNodeIds.has(rel.to)) {
|
|
467
|
+
errors.push({ code: "DANGLING_REFERENCE", message: `Relationship ${rel.id} references non-existent target: ${rel.to}`, relationship_id: rel.id })
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|