symbiote-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/bin/symbiote.d.ts +3 -0
- package/dist/bin/symbiote.d.ts.map +1 -0
- package/dist/bin/symbiote.js +202 -0
- package/dist/bin/symbiote.js.map +1 -0
- package/dist/bin/synapse.d.ts +3 -0
- package/dist/bin/synapse.d.ts.map +1 -0
- package/dist/bin/synapse.js +369 -0
- package/dist/bin/synapse.js.map +1 -0
- package/dist/src/brain/embeddings.d.ts +9 -0
- package/dist/src/brain/embeddings.d.ts.map +1 -0
- package/dist/src/brain/embeddings.js +24 -0
- package/dist/src/brain/embeddings.js.map +1 -0
- package/dist/src/brain/health/constraint-checker.d.ts +16 -0
- package/dist/src/brain/health/constraint-checker.d.ts.map +1 -0
- package/dist/src/brain/health/constraint-checker.js +93 -0
- package/dist/src/brain/health/constraint-checker.js.map +1 -0
- package/dist/src/brain/health/coupling-analyzer.d.ts +9 -0
- package/dist/src/brain/health/coupling-analyzer.d.ts.map +1 -0
- package/dist/src/brain/health/coupling-analyzer.js +105 -0
- package/dist/src/brain/health/coupling-analyzer.js.map +1 -0
- package/dist/src/brain/health/cycle-detector.d.ts +12 -0
- package/dist/src/brain/health/cycle-detector.d.ts.map +1 -0
- package/dist/src/brain/health/cycle-detector.js +79 -0
- package/dist/src/brain/health/cycle-detector.js.map +1 -0
- package/dist/src/brain/health/dead-code-detector.d.ts +9 -0
- package/dist/src/brain/health/dead-code-detector.d.ts.map +1 -0
- package/dist/src/brain/health/dead-code-detector.js +72 -0
- package/dist/src/brain/health/dead-code-detector.js.map +1 -0
- package/dist/src/brain/health/history.d.ts +21 -0
- package/dist/src/brain/health/history.d.ts.map +1 -0
- package/dist/src/brain/health/history.js +35 -0
- package/dist/src/brain/health/history.js.map +1 -0
- package/dist/src/brain/health/index.d.ts +25 -0
- package/dist/src/brain/health/index.d.ts.map +1 -0
- package/dist/src/brain/health/index.js +76 -0
- package/dist/src/brain/health/index.js.map +1 -0
- package/dist/src/brain/health/scorer.d.ts +19 -0
- package/dist/src/brain/health/scorer.d.ts.map +1 -0
- package/dist/src/brain/health/scorer.js +47 -0
- package/dist/src/brain/health/scorer.js.map +1 -0
- package/dist/src/brain/health/types.d.ts +67 -0
- package/dist/src/brain/health/types.d.ts.map +1 -0
- package/dist/src/brain/health/types.js +2 -0
- package/dist/src/brain/health/types.js.map +1 -0
- package/dist/src/brain/health.d.ts +30 -0
- package/dist/src/brain/health.d.ts.map +1 -0
- package/dist/src/brain/health.js +147 -0
- package/dist/src/brain/health.js.map +1 -0
- package/dist/src/brain/index.d.ts +3 -0
- package/dist/src/brain/index.d.ts.map +1 -0
- package/dist/src/brain/index.js +3 -0
- package/dist/src/brain/index.js.map +1 -0
- package/dist/src/brain/intent.d.ts +31 -0
- package/dist/src/brain/intent.d.ts.map +1 -0
- package/dist/src/brain/intent.js +120 -0
- package/dist/src/brain/intent.js.map +1 -0
- package/dist/src/commands/dna.d.ts +2 -0
- package/dist/src/commands/dna.d.ts.map +1 -0
- package/dist/src/commands/dna.js +128 -0
- package/dist/src/commands/dna.js.map +1 -0
- package/dist/src/commands/hooks.d.ts +6 -0
- package/dist/src/commands/hooks.d.ts.map +1 -0
- package/dist/src/commands/hooks.js +210 -0
- package/dist/src/commands/hooks.js.map +1 -0
- package/dist/src/commands/impact.d.ts +2 -0
- package/dist/src/commands/impact.d.ts.map +1 -0
- package/dist/src/commands/impact.js +50 -0
- package/dist/src/commands/impact.js.map +1 -0
- package/dist/src/commands/index.d.ts +9 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +9 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +2 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +132 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/install.d.ts +2 -0
- package/dist/src/commands/install.d.ts.map +1 -0
- package/dist/src/commands/install.js +67 -0
- package/dist/src/commands/install.js.map +1 -0
- package/dist/src/commands/mcp.d.ts +2 -0
- package/dist/src/commands/mcp.d.ts.map +1 -0
- package/dist/src/commands/mcp.js +51 -0
- package/dist/src/commands/mcp.js.map +1 -0
- package/dist/src/commands/scan.d.ts +2 -0
- package/dist/src/commands/scan.d.ts.map +1 -0
- package/dist/src/commands/scan.js +46 -0
- package/dist/src/commands/scan.js.map +1 -0
- package/dist/src/commands/serve.d.ts +2 -0
- package/dist/src/commands/serve.d.ts.map +1 -0
- package/dist/src/commands/serve.js +93 -0
- package/dist/src/commands/serve.js.map +1 -0
- package/dist/src/commands/shared.d.ts +11 -0
- package/dist/src/commands/shared.d.ts.map +1 -0
- package/dist/src/commands/shared.js +137 -0
- package/dist/src/commands/shared.js.map +1 -0
- package/dist/src/commands/unbond.d.ts +2 -0
- package/dist/src/commands/unbond.d.ts.map +1 -0
- package/dist/src/commands/unbond.js +29 -0
- package/dist/src/commands/unbond.js.map +1 -0
- package/dist/src/core/algorithms.d.ts +19 -0
- package/dist/src/core/algorithms.d.ts.map +1 -0
- package/dist/src/core/algorithms.js +98 -0
- package/dist/src/core/algorithms.js.map +1 -0
- package/dist/src/core/embeddings.d.ts +12 -0
- package/dist/src/core/embeddings.d.ts.map +1 -0
- package/dist/src/core/embeddings.js +64 -0
- package/dist/src/core/embeddings.js.map +1 -0
- package/dist/src/core/git-impact.d.ts +25 -0
- package/dist/src/core/git-impact.d.ts.map +1 -0
- package/dist/src/core/git-impact.js +97 -0
- package/dist/src/core/git-impact.js.map +1 -0
- package/dist/src/core/graph-builder.d.ts +5 -0
- package/dist/src/core/graph-builder.d.ts.map +1 -0
- package/dist/src/core/graph-builder.js +88 -0
- package/dist/src/core/graph-builder.js.map +1 -0
- package/dist/src/core/graph.d.ts +34 -0
- package/dist/src/core/graph.d.ts.map +1 -0
- package/dist/src/core/graph.js +95 -0
- package/dist/src/core/graph.js.map +1 -0
- package/dist/src/core/impact.d.ts +22 -0
- package/dist/src/core/impact.d.ts.map +1 -0
- package/dist/src/core/impact.js +68 -0
- package/dist/src/core/impact.js.map +1 -0
- package/dist/src/core/languages.d.ts +4 -0
- package/dist/src/core/languages.d.ts.map +1 -0
- package/dist/src/core/languages.js +59 -0
- package/dist/src/core/languages.js.map +1 -0
- package/dist/src/core/parser.d.ts +16 -0
- package/dist/src/core/parser.d.ts.map +1 -0
- package/dist/src/core/parser.js +689 -0
- package/dist/src/core/parser.js.map +1 -0
- package/dist/src/core/scanner.d.ts +26 -0
- package/dist/src/core/scanner.d.ts.map +1 -0
- package/dist/src/core/scanner.js +87 -0
- package/dist/src/core/scanner.js.map +1 -0
- package/dist/src/core/search.d.ts +34 -0
- package/dist/src/core/search.d.ts.map +1 -0
- package/dist/src/core/search.js +146 -0
- package/dist/src/core/search.js.map +1 -0
- package/dist/src/core/types.d.ts +29 -0
- package/dist/src/core/types.d.ts.map +1 -0
- package/dist/src/core/types.js +12 -0
- package/dist/src/core/types.js.map +1 -0
- package/dist/src/cortex/engine.d.ts +10 -0
- package/dist/src/cortex/engine.d.ts.map +1 -0
- package/dist/src/cortex/engine.js +93 -0
- package/dist/src/cortex/engine.js.map +1 -0
- package/dist/src/cortex/index.d.ts +13 -0
- package/dist/src/cortex/index.d.ts.map +1 -0
- package/dist/src/cortex/index.js +12 -0
- package/dist/src/cortex/index.js.map +1 -0
- package/dist/src/cortex/patterns.d.ts +63 -0
- package/dist/src/cortex/patterns.d.ts.map +1 -0
- package/dist/src/cortex/patterns.js +242 -0
- package/dist/src/cortex/patterns.js.map +1 -0
- package/dist/src/cortex/pgq-queries.d.ts +11 -0
- package/dist/src/cortex/pgq-queries.d.ts.map +1 -0
- package/dist/src/cortex/pgq-queries.js +23 -0
- package/dist/src/cortex/pgq-queries.js.map +1 -0
- package/dist/src/cortex/pgq.d.ts +5 -0
- package/dist/src/cortex/pgq.d.ts.map +1 -0
- package/dist/src/cortex/pgq.js +54 -0
- package/dist/src/cortex/pgq.js.map +1 -0
- package/dist/src/cortex/real-time-enrichment.d.ts +20 -0
- package/dist/src/cortex/real-time-enrichment.d.ts.map +1 -0
- package/dist/src/cortex/real-time-enrichment.js +96 -0
- package/dist/src/cortex/real-time-enrichment.js.map +1 -0
- package/dist/src/cortex/repository.d.ts +231 -0
- package/dist/src/cortex/repository.d.ts.map +1 -0
- package/dist/src/cortex/repository.js +1078 -0
- package/dist/src/cortex/repository.js.map +1 -0
- package/dist/src/cortex/schema.d.ts +9 -0
- package/dist/src/cortex/schema.d.ts.map +1 -0
- package/dist/src/cortex/schema.js +364 -0
- package/dist/src/cortex/schema.js.map +1 -0
- package/dist/src/cortex/stage-0-structure.d.ts +7 -0
- package/dist/src/cortex/stage-0-structure.d.ts.map +1 -0
- package/dist/src/cortex/stage-0-structure.js +119 -0
- package/dist/src/cortex/stage-0-structure.js.map +1 -0
- package/dist/src/cortex/stage-1-symbols.d.ts +7 -0
- package/dist/src/cortex/stage-1-symbols.d.ts.map +1 -0
- package/dist/src/cortex/stage-1-symbols.js +605 -0
- package/dist/src/cortex/stage-1-symbols.js.map +1 -0
- package/dist/src/cortex/stage-2-resolution.d.ts +7 -0
- package/dist/src/cortex/stage-2-resolution.d.ts.map +1 -0
- package/dist/src/cortex/stage-2-resolution.js +469 -0
- package/dist/src/cortex/stage-2-resolution.js.map +1 -0
- package/dist/src/cortex/stage-3-callgraph.d.ts +7 -0
- package/dist/src/cortex/stage-3-callgraph.d.ts.map +1 -0
- package/dist/src/cortex/stage-3-callgraph.js +323 -0
- package/dist/src/cortex/stage-3-callgraph.js.map +1 -0
- package/dist/src/cortex/stage-4-types.d.ts +7 -0
- package/dist/src/cortex/stage-4-types.d.ts.map +1 -0
- package/dist/src/cortex/stage-4-types.js +462 -0
- package/dist/src/cortex/stage-4-types.js.map +1 -0
- package/dist/src/cortex/stage-5-flow.d.ts +7 -0
- package/dist/src/cortex/stage-5-flow.d.ts.map +1 -0
- package/dist/src/cortex/stage-5-flow.js +702 -0
- package/dist/src/cortex/stage-5-flow.js.map +1 -0
- package/dist/src/cortex/stage-6-topology.d.ts +15 -0
- package/dist/src/cortex/stage-6-topology.d.ts.map +1 -0
- package/dist/src/cortex/stage-6-topology.js +382 -0
- package/dist/src/cortex/stage-6-topology.js.map +1 -0
- package/dist/src/cortex/stage-7-intelligence.d.ts +34 -0
- package/dist/src/cortex/stage-7-intelligence.d.ts.map +1 -0
- package/dist/src/cortex/stage-7-intelligence.js +258 -0
- package/dist/src/cortex/stage-7-intelligence.js.map +1 -0
- package/dist/src/cortex/topology-types.d.ts +78 -0
- package/dist/src/cortex/topology-types.d.ts.map +1 -0
- package/dist/src/cortex/topology-types.js +2 -0
- package/dist/src/cortex/topology-types.js.map +1 -0
- package/dist/src/cortex/types.d.ts +250 -0
- package/dist/src/cortex/types.d.ts.map +1 -0
- package/dist/src/cortex/types.js +2 -0
- package/dist/src/cortex/types.js.map +1 -0
- package/dist/src/dna/embeddings.d.ts +10 -0
- package/dist/src/dna/embeddings.d.ts.map +1 -0
- package/dist/src/dna/embeddings.js +46 -0
- package/dist/src/dna/embeddings.js.map +1 -0
- package/dist/src/dna/engine.d.ts +30 -0
- package/dist/src/dna/engine.d.ts.map +1 -0
- package/dist/src/dna/engine.js +254 -0
- package/dist/src/dna/engine.js.map +1 -0
- package/dist/src/dna/index.d.ts +5 -0
- package/dist/src/dna/index.d.ts.map +1 -0
- package/dist/src/dna/index.js +5 -0
- package/dist/src/dna/index.js.map +1 -0
- package/dist/src/dna/storage.d.ts +19 -0
- package/dist/src/dna/storage.d.ts.map +1 -0
- package/dist/src/dna/storage.js +112 -0
- package/dist/src/dna/storage.js.map +1 -0
- package/dist/src/dna/types.d.ts +38 -0
- package/dist/src/dna/types.d.ts.map +1 -0
- package/dist/src/dna/types.js +114 -0
- package/dist/src/dna/types.js.map +1 -0
- package/dist/src/events/bus.d.ts +10 -0
- package/dist/src/events/bus.d.ts.map +1 -0
- package/dist/src/events/bus.js +36 -0
- package/dist/src/events/bus.js.map +1 -0
- package/dist/src/events/ipc.d.ts +3 -0
- package/dist/src/events/ipc.d.ts.map +1 -0
- package/dist/src/events/ipc.js +25 -0
- package/dist/src/events/ipc.js.map +1 -0
- package/dist/src/events/session.d.ts +21 -0
- package/dist/src/events/session.d.ts.map +1 -0
- package/dist/src/events/session.js +39 -0
- package/dist/src/events/session.js.map +1 -0
- package/dist/src/events/types.d.ts +15 -0
- package/dist/src/events/types.d.ts.map +1 -0
- package/dist/src/events/types.js +26 -0
- package/dist/src/events/types.js.map +1 -0
- package/dist/src/hooks/attention.d.ts +26 -0
- package/dist/src/hooks/attention.d.ts.map +1 -0
- package/dist/src/hooks/attention.js +90 -0
- package/dist/src/hooks/attention.js.map +1 -0
- package/dist/src/hooks/handlers/post-tool-use-failure.d.ts +20 -0
- package/dist/src/hooks/handlers/post-tool-use-failure.d.ts.map +1 -0
- package/dist/src/hooks/handlers/post-tool-use-failure.js +60 -0
- package/dist/src/hooks/handlers/post-tool-use-failure.js.map +1 -0
- package/dist/src/hooks/handlers/post-tool-use.d.ts +22 -0
- package/dist/src/hooks/handlers/post-tool-use.d.ts.map +1 -0
- package/dist/src/hooks/handlers/post-tool-use.js +96 -0
- package/dist/src/hooks/handlers/post-tool-use.js.map +1 -0
- package/dist/src/hooks/handlers/pre-compact.d.ts +17 -0
- package/dist/src/hooks/handlers/pre-compact.d.ts.map +1 -0
- package/dist/src/hooks/handlers/pre-compact.js +28 -0
- package/dist/src/hooks/handlers/pre-compact.js.map +1 -0
- package/dist/src/hooks/handlers/pre-tool-use.d.ts +32 -0
- package/dist/src/hooks/handlers/pre-tool-use.d.ts.map +1 -0
- package/dist/src/hooks/handlers/pre-tool-use.js +219 -0
- package/dist/src/hooks/handlers/pre-tool-use.js.map +1 -0
- package/dist/src/hooks/handlers/session-end.d.ts +18 -0
- package/dist/src/hooks/handlers/session-end.d.ts.map +1 -0
- package/dist/src/hooks/handlers/session-end.js +42 -0
- package/dist/src/hooks/handlers/session-end.js.map +1 -0
- package/dist/src/hooks/handlers/session-start.d.ts +25 -0
- package/dist/src/hooks/handlers/session-start.d.ts.map +1 -0
- package/dist/src/hooks/handlers/session-start.js +61 -0
- package/dist/src/hooks/handlers/session-start.js.map +1 -0
- package/dist/src/hooks/handlers/stop.d.ts +21 -0
- package/dist/src/hooks/handlers/stop.d.ts.map +1 -0
- package/dist/src/hooks/handlers/stop.js +40 -0
- package/dist/src/hooks/handlers/stop.js.map +1 -0
- package/dist/src/hooks/handlers/subagent-start.d.ts +17 -0
- package/dist/src/hooks/handlers/subagent-start.d.ts.map +1 -0
- package/dist/src/hooks/handlers/subagent-start.js +48 -0
- package/dist/src/hooks/handlers/subagent-start.js.map +1 -0
- package/dist/src/hooks/handlers/user-prompt-submit.d.ts +12 -0
- package/dist/src/hooks/handlers/user-prompt-submit.d.ts.map +1 -0
- package/dist/src/hooks/handlers/user-prompt-submit.js +31 -0
- package/dist/src/hooks/handlers/user-prompt-submit.js.map +1 -0
- package/dist/src/hooks/index.d.ts +14 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +13 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/post-tool-use.d.ts +12 -0
- package/dist/src/hooks/post-tool-use.d.ts.map +1 -0
- package/dist/src/hooks/post-tool-use.js +33 -0
- package/dist/src/hooks/post-tool-use.js.map +1 -0
- package/dist/src/hooks/pre-tool-use.d.ts +24 -0
- package/dist/src/hooks/pre-tool-use.d.ts.map +1 -0
- package/dist/src/hooks/pre-tool-use.js +117 -0
- package/dist/src/hooks/pre-tool-use.js.map +1 -0
- package/dist/src/hooks/session-store.d.ts +55 -0
- package/dist/src/hooks/session-store.d.ts.map +1 -0
- package/dist/src/hooks/session-store.js +69 -0
- package/dist/src/hooks/session-store.js.map +1 -0
- package/dist/src/hooks/types.d.ts +67 -0
- package/dist/src/hooks/types.d.ts.map +1 -0
- package/dist/src/hooks/types.js +28 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +16 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/init/agent-connector.d.ts +43 -0
- package/dist/src/init/agent-connector.d.ts.map +1 -0
- package/dist/src/init/agent-connector.js +338 -0
- package/dist/src/init/agent-connector.js.map +1 -0
- package/dist/src/init/dna-bootstrap.d.ts +10 -0
- package/dist/src/init/dna-bootstrap.d.ts.map +1 -0
- package/dist/src/init/dna-bootstrap.js +32 -0
- package/dist/src/init/dna-bootstrap.js.map +1 -0
- package/dist/src/init/index.d.ts +29 -0
- package/dist/src/init/index.d.ts.map +1 -0
- package/dist/src/init/index.js +81 -0
- package/dist/src/init/index.js.map +1 -0
- package/dist/src/init/overview-generator.d.ts +5 -0
- package/dist/src/init/overview-generator.d.ts.map +1 -0
- package/dist/src/init/overview-generator.js +85 -0
- package/dist/src/init/overview-generator.js.map +1 -0
- package/dist/src/init/parsers/eslint-config.d.ts +10 -0
- package/dist/src/init/parsers/eslint-config.d.ts.map +1 -0
- package/dist/src/init/parsers/eslint-config.js +50 -0
- package/dist/src/init/parsers/eslint-config.js.map +1 -0
- package/dist/src/init/parsers/markdown-rules.d.ts +3 -0
- package/dist/src/init/parsers/markdown-rules.d.ts.map +1 -0
- package/dist/src/init/parsers/markdown-rules.js +90 -0
- package/dist/src/init/parsers/markdown-rules.js.map +1 -0
- package/dist/src/init/parsers/package-json.d.ts +17 -0
- package/dist/src/init/parsers/package-json.d.ts.map +1 -0
- package/dist/src/init/parsers/package-json.js +75 -0
- package/dist/src/init/parsers/package-json.js.map +1 -0
- package/dist/src/init/parsers/prettier-config.d.ts +16 -0
- package/dist/src/init/parsers/prettier-config.d.ts.map +1 -0
- package/dist/src/init/parsers/prettier-config.js +30 -0
- package/dist/src/init/parsers/prettier-config.js.map +1 -0
- package/dist/src/init/parsers/tsconfig.d.ts +32 -0
- package/dist/src/init/parsers/tsconfig.d.ts.map +1 -0
- package/dist/src/init/parsers/tsconfig.js +64 -0
- package/dist/src/init/parsers/tsconfig.js.map +1 -0
- package/dist/src/init/parsers/types.d.ts +27 -0
- package/dist/src/init/parsers/types.d.ts.map +1 -0
- package/dist/src/init/parsers/types.js +2 -0
- package/dist/src/init/parsers/types.js.map +1 -0
- package/dist/src/init/project-analyzer.d.ts +3 -0
- package/dist/src/init/project-analyzer.d.ts.map +1 -0
- package/dist/src/init/project-analyzer.js +102 -0
- package/dist/src/init/project-analyzer.js.map +1 -0
- package/dist/src/init/rule-importer.d.ts +3 -0
- package/dist/src/init/rule-importer.d.ts.map +1 -0
- package/dist/src/init/rule-importer.js +101 -0
- package/dist/src/init/rule-importer.js.map +1 -0
- package/dist/src/mcp/context.d.ts +43 -0
- package/dist/src/mcp/context.d.ts.map +1 -0
- package/dist/src/mcp/context.js +167 -0
- package/dist/src/mcp/context.js.map +1 -0
- package/dist/src/mcp/http-api.d.ts +10 -0
- package/dist/src/mcp/http-api.d.ts.map +1 -0
- package/dist/src/mcp/http-api.js +580 -0
- package/dist/src/mcp/http-api.js.map +1 -0
- package/dist/src/mcp/index.d.ts +8 -0
- package/dist/src/mcp/index.d.ts.map +1 -0
- package/dist/src/mcp/index.js +8 -0
- package/dist/src/mcp/index.js.map +1 -0
- package/dist/src/mcp/resources.d.ts +5 -0
- package/dist/src/mcp/resources.d.ts.map +1 -0
- package/dist/src/mcp/resources.js +78 -0
- package/dist/src/mcp/resources.js.map +1 -0
- package/dist/src/mcp/server.d.ts +6 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +265 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/tool-response.d.ts +6 -0
- package/dist/src/mcp/tool-response.d.ts.map +1 -0
- package/dist/src/mcp/tool-response.js +19 -0
- package/dist/src/mcp/tool-response.js.map +1 -0
- package/dist/src/mcp/tools/architecture-tools.d.ts +15 -0
- package/dist/src/mcp/tools/architecture-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/architecture-tools.js +56 -0
- package/dist/src/mcp/tools/architecture-tools.js.map +1 -0
- package/dist/src/mcp/tools/dna-tools.d.ts +21 -0
- package/dist/src/mcp/tools/dna-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/dna-tools.js +15 -0
- package/dist/src/mcp/tools/dna-tools.js.map +1 -0
- package/dist/src/mcp/tools/graph-tools.d.ts +49 -0
- package/dist/src/mcp/tools/graph-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/graph-tools.js +45 -0
- package/dist/src/mcp/tools/graph-tools.js.map +1 -0
- package/dist/src/mcp/tools/health-tools.d.ts +5 -0
- package/dist/src/mcp/tools/health-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/health-tools.js +7 -0
- package/dist/src/mcp/tools/health-tools.js.map +1 -0
- package/dist/src/mcp/tools/impact-tools.d.ts +21 -0
- package/dist/src/mcp/tools/impact-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/impact-tools.js +23 -0
- package/dist/src/mcp/tools/impact-tools.js.map +1 -0
- package/dist/src/mcp/tools/intent-tools.d.ts +32 -0
- package/dist/src/mcp/tools/intent-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/intent-tools.js +77 -0
- package/dist/src/mcp/tools/intent-tools.js.map +1 -0
- package/dist/src/mcp/tools/project-tools.d.ts +53 -0
- package/dist/src/mcp/tools/project-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/project-tools.js +91 -0
- package/dist/src/mcp/tools/project-tools.js.map +1 -0
- package/dist/src/mcp/tools/rename-tool.d.ts +25 -0
- package/dist/src/mcp/tools/rename-tool.d.ts.map +1 -0
- package/dist/src/mcp/tools/rename-tool.js +106 -0
- package/dist/src/mcp/tools/rename-tool.js.map +1 -0
- package/dist/src/mcp/tools/trace-tools.d.ts +4 -0
- package/dist/src/mcp/tools/trace-tools.d.ts.map +1 -0
- package/dist/src/mcp/tools/trace-tools.js +268 -0
- package/dist/src/mcp/tools/trace-tools.js.map +1 -0
- package/dist/src/storage/db.d.ts +13 -0
- package/dist/src/storage/db.d.ts.map +1 -0
- package/dist/src/storage/db.js +230 -0
- package/dist/src/storage/db.js.map +1 -0
- package/dist/src/storage/repository.d.ts +54 -0
- package/dist/src/storage/repository.d.ts.map +1 -0
- package/dist/src/storage/repository.js +257 -0
- package/dist/src/storage/repository.js.map +1 -0
- package/dist/src/utils/config.d.ts +18 -0
- package/dist/src/utils/config.d.ts.map +1 -0
- package/dist/src/utils/config.js +93 -0
- package/dist/src/utils/config.js.map +1 -0
- package/dist/src/utils/files.d.ts +3 -0
- package/dist/src/utils/files.d.ts.map +1 -0
- package/dist/src/utils/files.js +52 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/strings.d.ts +2 -0
- package/dist/src/utils/strings.d.ts.map +1 -0
- package/dist/src/utils/strings.js +11 -0
- package/dist/src/utils/strings.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/hooks/post-tool-use.sh +37 -0
- package/hooks/pre-tool-use.sh +43 -0
- package/hooks/session-start.sh +67 -0
- package/package.json +103 -0
- package/skills/symbiote-init/SKILL.md +104 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { handleGetProjectOverview } from './tools/project-tools.js';
|
|
2
|
+
export function handleDnaResource(ctx) {
|
|
3
|
+
const entries = ctx.dnaEngine.getActiveEntries();
|
|
4
|
+
if (entries.length === 0) {
|
|
5
|
+
return 'No developer DNA entries found. DNA is learned from your corrections and instructions to AI tools.';
|
|
6
|
+
}
|
|
7
|
+
const lines = [`Developer DNA — ${entries.length} active entries\n`];
|
|
8
|
+
for (const entry of entries) {
|
|
9
|
+
const fm = entry.frontmatter;
|
|
10
|
+
const statusLabel = fm.status === 'approved' ? 'APPROVED' : 'SUGGESTED';
|
|
11
|
+
lines.push(`[${statusLabel}] ${fm.category}/${fm.id} (confidence: ${fm.confidence})\n ${entry.content}\n`);
|
|
12
|
+
}
|
|
13
|
+
return lines.join('\n');
|
|
14
|
+
}
|
|
15
|
+
export async function handleProjectOverviewResource(ctx) {
|
|
16
|
+
const { data: overview } = await handleGetProjectOverview(ctx);
|
|
17
|
+
const lines = [
|
|
18
|
+
'Project Overview',
|
|
19
|
+
`Nodes: ${overview.totalNodes}`,
|
|
20
|
+
`Edges: ${overview.totalEdges}`,
|
|
21
|
+
`Files: ${overview.totalFiles}`,
|
|
22
|
+
'',
|
|
23
|
+
'Node Types:',
|
|
24
|
+
];
|
|
25
|
+
for (const [type, count] of Object.entries(overview.nodesByType)) {
|
|
26
|
+
lines.push(` ${type}: ${count}`);
|
|
27
|
+
}
|
|
28
|
+
if (overview.constraints.length > 0) {
|
|
29
|
+
lines.push('', 'Active Constraints:');
|
|
30
|
+
for (const c of overview.constraints) {
|
|
31
|
+
lines.push(` - [${c.frontmatter.id}] ${c.content.slice(0, 100)}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (overview.decisions.length > 0) {
|
|
35
|
+
lines.push('', 'Active Decisions:');
|
|
36
|
+
for (const d of overview.decisions) {
|
|
37
|
+
lines.push(` - [${d.frontmatter.id}] ${d.content.slice(0, 100)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return lines.join('\n');
|
|
41
|
+
}
|
|
42
|
+
export async function handleProjectHealthResource(ctx) {
|
|
43
|
+
const report = await ctx.health.analyze();
|
|
44
|
+
const lines = [
|
|
45
|
+
`Health Score: ${report.score}/100`,
|
|
46
|
+
'',
|
|
47
|
+
`Constraints: ${report.categories.constraints.score}/100 (${report.constraintViolations.length} violations, weight: ${report.categories.constraints.weight * 100}%)`,
|
|
48
|
+
`Circular Dependencies: ${report.categories.circularDeps.score}/100 (${report.circularDeps.length} cycles, weight: ${report.categories.circularDeps.weight * 100}%)`,
|
|
49
|
+
`Dead Code: ${report.categories.deadCode.score}/100 (${report.deadCode.length} unreferenced, weight: ${report.categories.deadCode.weight * 100}%)`,
|
|
50
|
+
`Coupling: ${report.categories.coupling.score}/100 (${report.couplingHotspots.length} hotspots, weight: ${report.categories.coupling.weight * 100}%)`,
|
|
51
|
+
];
|
|
52
|
+
if (report.constraintViolations.length > 0) {
|
|
53
|
+
lines.push('', '--- Constraint Violations ---');
|
|
54
|
+
for (const v of report.constraintViolations) {
|
|
55
|
+
lines.push(` ${v.filePath}:${v.lineStart} — ${v.constraintId}: ${v.matchedText}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (report.descriptiveConstraints.length > 0) {
|
|
59
|
+
lines.push('', '--- Active Constraints (descriptive) ---');
|
|
60
|
+
for (const c of report.descriptiveConstraints) {
|
|
61
|
+
lines.push(` [${c.constraintId}] ${c.description.slice(0, 80)}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (report.circularDeps.length > 0) {
|
|
65
|
+
lines.push('', '--- Circular Dependencies ---');
|
|
66
|
+
for (const cycle of report.circularDeps) {
|
|
67
|
+
lines.push(` ${cycle.filePaths.join(' → ')} → ${cycle.filePaths[0]}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (report.couplingHotspots.length > 0) {
|
|
71
|
+
lines.push('', '--- Coupling Hotspots ---');
|
|
72
|
+
for (const h of report.couplingHotspots) {
|
|
73
|
+
lines.push(` ${h.filePath}: ${h.incomingEdges} in, ${h.outgoingEdges} out (${h.totalEdges} total)`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return lines.join('\n');
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/mcp/resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,UAAU,iBAAiB,CAAC,GAAkB;IAChD,MAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;IAEjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,oG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,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3E,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,2BAA2B,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACtC,KAAK,CAAC,IAAI,CACN,KAAK,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,aAAa,QAAQ,CAAC,CAAC,aAAa,SAAS,CAAC,CAAC,UAAU,SAAS,CAC3F,CAAC;QACN,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAgDlD,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CA+XzE"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
import { ImpactAnalyzer } from '#core/impact.js';
|
|
8
|
+
import { handleGetDeveloperDna, handleRecordInstruction } from './tools/dna-tools.js';
|
|
9
|
+
import { handleGetProjectOverview, handleGetContextForFile, handleQueryGraph, handleSemanticSearch, } from './tools/project-tools.js';
|
|
10
|
+
import { handleGetHealth } from './tools/health-tools.js';
|
|
11
|
+
import { handleGetImpact, handleDetectChanges } from './tools/impact-tools.js';
|
|
12
|
+
import { registerTraceTools } from './tools/trace-tools.js';
|
|
13
|
+
import { handleFindPatterns, handleGetArchitecture } from './tools/architecture-tools.js';
|
|
14
|
+
import { handleQueryGraphV2, handleGetContextForSymbol, isLegacyQueryFormat, } from './tools/graph-tools.js';
|
|
15
|
+
import { handleRenameSymbol } from './tools/rename-tool.js';
|
|
16
|
+
import { handleGetConstraints, handleGetDecisions, handleProposeConstraint, handleProposeDecision, } from './tools/intent-tools.js';
|
|
17
|
+
import { handleDnaResource, handleProjectOverviewResource, handleProjectHealthResource, } from './resources.js';
|
|
18
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
function findPackageJson(dir) {
|
|
21
|
+
const candidate = path.join(dir, 'package.json');
|
|
22
|
+
if (existsSync(candidate))
|
|
23
|
+
return candidate;
|
|
24
|
+
const parent = path.dirname(dir);
|
|
25
|
+
if (parent === dir)
|
|
26
|
+
throw new Error('package.json not found');
|
|
27
|
+
return findPackageJson(parent);
|
|
28
|
+
}
|
|
29
|
+
const { version } = require(findPackageJson(__dirname));
|
|
30
|
+
function textResult(data) {
|
|
31
|
+
return { type: 'text', text: JSON.stringify(data, null, 2) };
|
|
32
|
+
}
|
|
33
|
+
export function createMcpServer(ctx) {
|
|
34
|
+
const server = new McpServer({
|
|
35
|
+
name: 'symbiote',
|
|
36
|
+
version,
|
|
37
|
+
});
|
|
38
|
+
let cachedImpact = null;
|
|
39
|
+
function getImpactAnalyzer() {
|
|
40
|
+
if (!cachedImpact) {
|
|
41
|
+
cachedImpact = new ImpactAnalyzer(ctx.graphology);
|
|
42
|
+
}
|
|
43
|
+
return cachedImpact;
|
|
44
|
+
}
|
|
45
|
+
server.tool('get_developer_dna', "Returns the developer's coding style, preferences, and anti-patterns.", {
|
|
46
|
+
category: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Filter by category: style, preferences, anti-patterns, decisions'),
|
|
50
|
+
taskContext: z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Description of the current task for relevance filtering'),
|
|
54
|
+
}, async (input) => ({
|
|
55
|
+
content: [textResult(handleGetDeveloperDna(ctx, input))],
|
|
56
|
+
}));
|
|
57
|
+
server.tool('record_instruction', 'Record a developer correction or coding preference as DNA. Call this whenever the developer corrects your output, states a preference, or gives style guidance. The instruction will be learned and applied in future sessions.', {
|
|
58
|
+
instruction: z
|
|
59
|
+
.string()
|
|
60
|
+
.describe('The correction or preference to record (e.g., "Use early returns instead of nested else blocks")'),
|
|
61
|
+
sessionId: z
|
|
62
|
+
.string()
|
|
63
|
+
.optional()
|
|
64
|
+
.default('')
|
|
65
|
+
.describe('Current session identifier (auto-generated if empty)'),
|
|
66
|
+
isExplicit: z
|
|
67
|
+
.boolean()
|
|
68
|
+
.optional()
|
|
69
|
+
.default(false)
|
|
70
|
+
.describe('True if the developer explicitly asked to record this, false if inferred from a correction'),
|
|
71
|
+
}, async (input) => {
|
|
72
|
+
const sid = input.sessionId || `session-${Date.now()}`;
|
|
73
|
+
const result = handleRecordInstruction(ctx, {
|
|
74
|
+
instruction: input.instruction,
|
|
75
|
+
sessionId: sid,
|
|
76
|
+
isExplicit: input.isExplicit,
|
|
77
|
+
});
|
|
78
|
+
return { content: [textResult(result)] };
|
|
79
|
+
});
|
|
80
|
+
server.tool('get_project_overview', "Returns the project's structure, stats, and health summary.", {}, async () => ({
|
|
81
|
+
content: [textResult(await handleGetProjectOverview(ctx))],
|
|
82
|
+
}));
|
|
83
|
+
server.tool('get_context_for_file', 'Returns everything about a specific file: symbols, dependencies, dependents, constraints, decisions.', {
|
|
84
|
+
filePath: z.string().describe('The file path to get context for'),
|
|
85
|
+
}, async (input) => ({
|
|
86
|
+
content: [textResult(await handleGetContextForFile(ctx, input))],
|
|
87
|
+
}));
|
|
88
|
+
server.tool('query_graph', 'Query the code graph using SQL/PGQ or plain SQL. Accepts any read-only SELECT query against cortex tables and the code_graph property graph.', {
|
|
89
|
+
query: z.string().describe('SQL or SQL/PGQ query (read-only SELECT only)'),
|
|
90
|
+
type: z
|
|
91
|
+
.enum(['search', 'dependencies', 'dependents', 'hubs'])
|
|
92
|
+
.optional()
|
|
93
|
+
.describe('[DEPRECATED] Legacy query type — use SQL query instead'),
|
|
94
|
+
limit: z
|
|
95
|
+
.number()
|
|
96
|
+
.optional()
|
|
97
|
+
.default(20)
|
|
98
|
+
.describe('[DEPRECATED] Legacy limit — use SQL LIMIT instead'),
|
|
99
|
+
}, async (input) => {
|
|
100
|
+
if (isLegacyQueryFormat(input)) {
|
|
101
|
+
console.warn('[symbiote] DEPRECATED: query_graph legacy format (type/limit) is deprecated. Use SQL/PGQ query string instead.');
|
|
102
|
+
const result = await handleQueryGraph(ctx, input);
|
|
103
|
+
return { content: [textResult(result)] };
|
|
104
|
+
}
|
|
105
|
+
const result = await handleQueryGraphV2({ db: ctx.db, cortexRepo: ctx.cortexRepo }, { query: input.query });
|
|
106
|
+
return { content: [textResult(result)] };
|
|
107
|
+
});
|
|
108
|
+
server.tool('semantic_search', 'Natural language search over the codebase using vector embeddings.', {
|
|
109
|
+
query: z.string().describe("Natural language description of what you're looking for"),
|
|
110
|
+
limit: z.number().optional().default(10).describe('Maximum number of results'),
|
|
111
|
+
}, async (input) => ({
|
|
112
|
+
content: [textResult(await handleSemanticSearch(ctx, input))],
|
|
113
|
+
}));
|
|
114
|
+
server.tool('get_health', "Returns the project's health report: dead code, circular deps, orphans, violations.", {}, async () => ({
|
|
115
|
+
content: [textResult(await handleGetHealth(ctx))],
|
|
116
|
+
}));
|
|
117
|
+
server.tool('get_impact', 'Analyze blast radius: what breaks if a given symbol changes. Returns affected nodes grouped by depth with confidence scores.', {
|
|
118
|
+
target: z
|
|
119
|
+
.string()
|
|
120
|
+
.describe('Node ID of the symbol to analyze (e.g., fn:auth.ts:login)'),
|
|
121
|
+
maxDepth: z
|
|
122
|
+
.number()
|
|
123
|
+
.optional()
|
|
124
|
+
.default(3)
|
|
125
|
+
.describe('Maximum traversal depth (default: 3)'),
|
|
126
|
+
}, async (input) => {
|
|
127
|
+
const result = await handleGetImpact({ graph: ctx.graphology, impact: getImpactAnalyzer(), cortexRepo: ctx.cortexRepo }, input);
|
|
128
|
+
return { content: [textResult(result)] };
|
|
129
|
+
});
|
|
130
|
+
server.tool('detect_changes', 'Analyze uncommitted git changes: maps modified files to affected modules with risk assessment.', {}, async () => {
|
|
131
|
+
const result = await handleDetectChanges({ graph: ctx.graphology, impact: getImpactAnalyzer(), cortexRepo: ctx.cortexRepo }, {});
|
|
132
|
+
return { content: [textResult(result)] };
|
|
133
|
+
});
|
|
134
|
+
server.resource('dna', 'symbiote://dna', {
|
|
135
|
+
description: 'Developer DNA summary — coding style, preferences, and anti-patterns',
|
|
136
|
+
}, async () => ({
|
|
137
|
+
contents: [
|
|
138
|
+
{
|
|
139
|
+
uri: 'symbiote://dna',
|
|
140
|
+
text: handleDnaResource(ctx),
|
|
141
|
+
mimeType: 'text/plain',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
}));
|
|
145
|
+
server.resource('project-overview', 'symbiote://project/overview', {
|
|
146
|
+
description: 'Project summary: structure, stats, active constraints and decisions',
|
|
147
|
+
}, async () => ({
|
|
148
|
+
contents: [
|
|
149
|
+
{
|
|
150
|
+
uri: 'symbiote://project/overview',
|
|
151
|
+
text: await handleProjectOverviewResource(ctx),
|
|
152
|
+
mimeType: 'text/plain',
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
}));
|
|
156
|
+
server.resource('project-health', 'symbiote://project/health', {
|
|
157
|
+
description: 'Current project health: violations, warnings, and score',
|
|
158
|
+
}, async () => ({
|
|
159
|
+
contents: [
|
|
160
|
+
{
|
|
161
|
+
uri: 'symbiote://project/health',
|
|
162
|
+
text: await handleProjectHealthResource(ctx),
|
|
163
|
+
mimeType: 'text/plain',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
}));
|
|
167
|
+
registerTraceTools(server, ctx.cortexRepo);
|
|
168
|
+
server.tool('find_patterns', 'Detect anti-patterns, architectural violations, and complexity hotspots within a scope', {
|
|
169
|
+
scope: z.string().describe('Scope to search: file path, directory, or "all"'),
|
|
170
|
+
kinds: z
|
|
171
|
+
.array(z.enum([
|
|
172
|
+
'god_class',
|
|
173
|
+
'circular_dependency',
|
|
174
|
+
'feature_envy',
|
|
175
|
+
'shotgun_surgery',
|
|
176
|
+
'layer_violation',
|
|
177
|
+
'dependency_direction',
|
|
178
|
+
'barrel_abuse',
|
|
179
|
+
'complexity_hotspot',
|
|
180
|
+
'style_deviation',
|
|
181
|
+
'decision_contradiction',
|
|
182
|
+
'predictive_impact',
|
|
183
|
+
]))
|
|
184
|
+
.optional()
|
|
185
|
+
.describe('Filter by specific finding kinds'),
|
|
186
|
+
severity: z
|
|
187
|
+
.enum(['info', 'warning', 'error'])
|
|
188
|
+
.optional()
|
|
189
|
+
.describe('Minimum severity to include'),
|
|
190
|
+
}, async (input) => {
|
|
191
|
+
const result = await handleFindPatterns(ctx.cortexRepo, input);
|
|
192
|
+
return { content: [textResult(result)] };
|
|
193
|
+
});
|
|
194
|
+
server.tool('get_architecture', 'Get detected architectural layers, boundaries, dependency direction, and violation summary', {}, async () => {
|
|
195
|
+
const result = await handleGetArchitecture(ctx.cortexRepo);
|
|
196
|
+
return { content: [textResult(result)] };
|
|
197
|
+
});
|
|
198
|
+
server.tool('get_context_for_symbol', 'Deep dive into one function, class, or method: callers, callees, type relationships, import references.', {
|
|
199
|
+
symbol: z
|
|
200
|
+
.string()
|
|
201
|
+
.describe('Symbol name or ID (e.g., "validateEmail" or "fn:utils.ts:validateEmail")'),
|
|
202
|
+
}, async (input) => {
|
|
203
|
+
const result = await handleGetContextForSymbol({ db: ctx.db, cortexRepo: ctx.cortexRepo }, input);
|
|
204
|
+
return { content: [textResult(result)] };
|
|
205
|
+
});
|
|
206
|
+
server.tool('rename_symbol', 'Graph-aware multi-file rename preview. Returns a diff — does NOT write to disk.', {
|
|
207
|
+
symbol: z.string().describe('Symbol name or ID to rename'),
|
|
208
|
+
new_name: z.string().describe('New name for the symbol'),
|
|
209
|
+
scope: z
|
|
210
|
+
.enum(['file', 'project'])
|
|
211
|
+
.optional()
|
|
212
|
+
.default('project')
|
|
213
|
+
.describe('Scope of rename: file or project (default: project)'),
|
|
214
|
+
}, async (input) => {
|
|
215
|
+
const { new_name: newName, ...rest } = input;
|
|
216
|
+
const result = await handleRenameSymbol({ cortexRepo: ctx.cortexRepo, rootDir: ctx.rootDir }, { ...rest, newName });
|
|
217
|
+
return { content: [textResult(result)] };
|
|
218
|
+
});
|
|
219
|
+
server.tool('get_constraints', 'Returns active project constraints — rules the codebase enforces.', {
|
|
220
|
+
scope: z
|
|
221
|
+
.string()
|
|
222
|
+
.optional()
|
|
223
|
+
.describe('Filter by scope (e.g. file path). Returns global + matching scoped constraints.'),
|
|
224
|
+
}, async (input) => {
|
|
225
|
+
const result = await handleGetConstraints(ctx, input);
|
|
226
|
+
return { content: [textResult(result)] };
|
|
227
|
+
});
|
|
228
|
+
server.tool('get_decisions', 'Returns architectural decisions — choices made with rationale.', {
|
|
229
|
+
scope: z
|
|
230
|
+
.string()
|
|
231
|
+
.optional()
|
|
232
|
+
.describe('Filter by scope (e.g. file path). Returns global + matching scoped decisions.'),
|
|
233
|
+
}, async (input) => {
|
|
234
|
+
const result = await handleGetDecisions(ctx, input);
|
|
235
|
+
return { content: [textResult(result)] };
|
|
236
|
+
});
|
|
237
|
+
server.tool('propose_constraint', 'Propose a new project constraint. Status starts as "proposed" for developer review.', {
|
|
238
|
+
id: z.string().describe('Unique constraint ID (slug format, e.g. "no-raw-sql")'),
|
|
239
|
+
content: z.string().describe('The constraint rule text'),
|
|
240
|
+
scope: z
|
|
241
|
+
.string()
|
|
242
|
+
.optional()
|
|
243
|
+
.default('global')
|
|
244
|
+
.describe('Scope: "global" or a file/dir path'),
|
|
245
|
+
}, (input) => {
|
|
246
|
+
const result = handleProposeConstraint(ctx, input);
|
|
247
|
+
return { content: [textResult(result)] };
|
|
248
|
+
});
|
|
249
|
+
server.tool('propose_decision', 'Record an architectural decision with rationale. Status starts as "proposed" for developer review.', {
|
|
250
|
+
id: z
|
|
251
|
+
.string()
|
|
252
|
+
.describe('Unique decision ID (slug format, e.g. "chose-vitest-over-jest")'),
|
|
253
|
+
content: z.string().describe('The decision text with rationale'),
|
|
254
|
+
scope: z
|
|
255
|
+
.string()
|
|
256
|
+
.optional()
|
|
257
|
+
.default('global')
|
|
258
|
+
.describe('Scope: "global" or a file/dir path'),
|
|
259
|
+
}, (input) => {
|
|
260
|
+
const result = handleProposeDecision(ctx, input);
|
|
261
|
+
return { content: [textResult(result)] };
|
|
262
|
+
});
|
|
263
|
+
return { server };
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EACH,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,GAEvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE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qF,EACrF;QACI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;QAChF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACxD,KAAK,EAAE,CAAC;aACH,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,OAAO,CAAC,QAAQ,CAAC;aACjB,QAAQ,CAAC,oCAAoC,CAAC;KACtD,EACD,CAAC,KAAK,EAAE,EAAE;QACN,MAAM,MAAM,GAAG,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC,CACJ,CAAC;IAEF,MAAM,CAAC,IAAI,CACP,kBAAkB,EAClB,oGAAoG,EACpG;QACI,EAAE,EAAE,CAAC;aACA,MAAM,EAAE;aACR,QAAQ,CAAC,iEAAiE,CAAC;QAChF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;QAChE,KAAK,EAAE,CAAC;aACH,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,OAAO,CAAC,QAAQ,CAAC;aACjB,QAAQ,CAAC,oCAAoC,CAAC;KACtD,EACD,CAAC,KAAK,EAAE,EAAE;QACN,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACjD,OAAO,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC,CACJ,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ToolResponse } from '#cortex/types.js';
|
|
2
|
+
import type { CortexRepository } from '#cortex/repository.js';
|
|
3
|
+
export declare function wrapResponse<T>(data: T, depth: number, deepening: boolean, staleSince?: string): ToolResponse<T>;
|
|
4
|
+
export declare function getMaxDepth(repo: CortexRepository): Promise<number>;
|
|
5
|
+
export declare function getDepthForFile(repo: CortexRepository, filePath: string): Promise<number>;
|
|
6
|
+
//# sourceMappingURL=tool-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../../src/mcp/tool-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,wBAAgB,YAAY,CAAC,CAAC,EAC1B,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,OAAO,EAClB,UAAU,CAAC,EAAE,MAAM,GACpB,YAAY,CAAC,CAAC,CAAC,CAMjB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAIzE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/F"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function wrapResponse(data, depth, deepening, staleSince) {
|
|
2
|
+
const response = { data, depth, deepening };
|
|
3
|
+
if (staleSince !== undefined) {
|
|
4
|
+
response.stale_since = staleSince;
|
|
5
|
+
}
|
|
6
|
+
return response;
|
|
7
|
+
}
|
|
8
|
+
export async function getMaxDepth(repo) {
|
|
9
|
+
const files = await repo.getAllFileNodes();
|
|
10
|
+
if (files.length === 0)
|
|
11
|
+
return 0;
|
|
12
|
+
return Math.min(...files.map((f) => f.depthLevel));
|
|
13
|
+
}
|
|
14
|
+
export async function getDepthForFile(repo, filePath) {
|
|
15
|
+
const fileId = `file:${filePath}`;
|
|
16
|
+
const file = await repo.getFileNode(fileId);
|
|
17
|
+
return file?.depthLevel ?? 0;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tool-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-response.js","sourceRoot":"","sources":["../../../src/mcp/tool-response.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,YAAY,CACxB,IAAO,EACP,KAAa,EACb,SAAkB,EAClB,UAAmB;IAEnB,MAAM,QAAQ,GAAoB,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC7D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;IACtC,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAsB;IACpD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAC3C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAsB,EAAE,QAAgB;IAC1E,MAAM,MAAM,GAAG,QAAQ,QAAQ,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,IAAI,EAAE,UAAU,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CortexRepository } from '#cortex/repository.js';
|
|
2
|
+
import type { Finding, FindingKind, FindingSeverity, ArchitectureOverview, ToolResponse } from '#cortex/types.js';
|
|
3
|
+
export interface FindPatternsInput {
|
|
4
|
+
scope: string;
|
|
5
|
+
kinds?: FindingKind[];
|
|
6
|
+
severity?: FindingSeverity;
|
|
7
|
+
}
|
|
8
|
+
export interface FindPatternsOutput {
|
|
9
|
+
findings: Finding[];
|
|
10
|
+
scope: string;
|
|
11
|
+
totalCount: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function handleFindPatterns(repo: CortexRepository, input: FindPatternsInput): Promise<ToolResponse<FindPatternsOutput>>;
|
|
14
|
+
export declare function handleGetArchitecture(repo: CortexRepository): Promise<ToolResponse<ArchitectureOverview>>;
|
|
15
|
+
//# sourceMappingURL=architecture-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture-tools.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/architecture-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EACR,OAAO,EACP,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,YAAY,EACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,GACzB,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAiC3C;AAED,wBAAsB,qBAAqB,CACvC,IAAI,EAAE,gBAAgB,GACvB,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAgC7C"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export async function handleFindPatterns(repo, input) {
|
|
2
|
+
const raw = await repo.getMeta('findings');
|
|
3
|
+
const maxDepth = await repo.getMaxDepthLevel();
|
|
4
|
+
let findings = raw ? JSON.parse(raw) : [];
|
|
5
|
+
if (input.scope !== 'all') {
|
|
6
|
+
findings = findings.filter((f) => f.filePaths.some((fp) => fp.includes(input.scope)));
|
|
7
|
+
}
|
|
8
|
+
if (input.kinds?.length) {
|
|
9
|
+
const kindSet = new Set(input.kinds);
|
|
10
|
+
findings = findings.filter((f) => kindSet.has(f.kind));
|
|
11
|
+
}
|
|
12
|
+
if (input.severity) {
|
|
13
|
+
const severityOrder = {
|
|
14
|
+
info: 0,
|
|
15
|
+
warning: 1,
|
|
16
|
+
error: 2,
|
|
17
|
+
};
|
|
18
|
+
const minSeverity = severityOrder[input.severity];
|
|
19
|
+
findings = findings.filter((f) => severityOrder[f.severity] >= minSeverity);
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
data: {
|
|
23
|
+
findings,
|
|
24
|
+
scope: input.scope,
|
|
25
|
+
totalCount: findings.length,
|
|
26
|
+
},
|
|
27
|
+
depth: maxDepth,
|
|
28
|
+
deepening: maxDepth < 7,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export async function handleGetArchitecture(repo) {
|
|
32
|
+
const layersRaw = await repo.getMeta('layers');
|
|
33
|
+
const layers = layersRaw ? JSON.parse(layersRaw) : [];
|
|
34
|
+
const boundariesRaw = await repo.getMeta('layer_boundaries');
|
|
35
|
+
const boundaries = boundariesRaw ? JSON.parse(boundariesRaw) : [];
|
|
36
|
+
const findingsRaw = await repo.getMeta('findings');
|
|
37
|
+
const allFindings = findingsRaw ? JSON.parse(findingsRaw) : [];
|
|
38
|
+
const violations = allFindings.filter((f) => f.kind === 'layer_violation' || f.kind === 'dependency_direction');
|
|
39
|
+
const communityCountRaw = await repo.getMeta('community_count');
|
|
40
|
+
const communityCount = communityCountRaw ? parseInt(communityCountRaw, 10) : 0;
|
|
41
|
+
const topHubsRaw = await repo.getMeta('top_hubs');
|
|
42
|
+
const topHubs = topHubsRaw ? JSON.parse(topHubsRaw) : [];
|
|
43
|
+
const maxDepth = await repo.getMaxDepthLevel();
|
|
44
|
+
return {
|
|
45
|
+
data: {
|
|
46
|
+
layers,
|
|
47
|
+
boundaries,
|
|
48
|
+
violations,
|
|
49
|
+
communityCount,
|
|
50
|
+
topHubs,
|
|
51
|
+
},
|
|
52
|
+
depth: maxDepth,
|
|
53
|
+
deepening: maxDepth < 7,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=architecture-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture-tools.js","sourceRoot":"","sources":["../../../../src/mcp/tools/architecture-tools.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACpC,IAAsB,EACtB,KAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC/C,IAAI,QAAQ,GAAc,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAErD,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QACxB,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,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,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CACjC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iBAAiB,IAAI,CAAC,CAAC,IAAI,KAAK,sBAAsB,CAC3E,CAAC;IAEF,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE/E,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAE/C,OAAO;QACH,IAAI,EAAE;YACF,MAAM;YACN,UAAU;YACV,UAAU;YACV,cAAc;YACd,OAAO;SACV;QACD,KAAK,EAAE,QAAQ;QACf,SAAS,EAAE,QAAQ,GAAG,CAAC;KAC1B,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ServerContext } from '../context.js';
|
|
2
|
+
import type { DnaEntry } from '#dna/types.js';
|
|
3
|
+
import type { ToolResponse } from '#cortex/types.js';
|
|
4
|
+
export interface GetDeveloperDnaInput {
|
|
5
|
+
category?: string;
|
|
6
|
+
taskContext?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GetDeveloperDnaOutput {
|
|
9
|
+
entries: DnaEntry[];
|
|
10
|
+
}
|
|
11
|
+
export declare function handleGetDeveloperDna(ctx: ServerContext, input: GetDeveloperDnaInput): ToolResponse<GetDeveloperDnaOutput>;
|
|
12
|
+
export interface RecordInstructionInput {
|
|
13
|
+
instruction: string;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
isExplicit: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface RecordInstructionOutput {
|
|
18
|
+
entry: DnaEntry;
|
|
19
|
+
}
|
|
20
|
+
export declare function handleRecordInstruction(ctx: ServerContext, input: RecordInstructionInput): ToolResponse<RecordInstructionOutput>;
|
|
21
|
+
//# sourceMappingURL=dna-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-tools.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/dna-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED,wBAAgB,qBAAqB,CACjC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,oBAAoB,GAC5B,YAAY,CAAC,qBAAqB,CAAC,CAUrC;AAED,MAAM,WAAW,sBAAsB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,EAAE,QAAQ,CAAC;CACnB;AAED,wBAAgB,uBAAuB,CACnC,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,sBAAsB,GAC9B,YAAY,CAAC,uBAAuB,CAAC,CAKvC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { wrapResponse } from '../tool-response.js';
|
|
2
|
+
export function handleGetDeveloperDna(ctx, input) {
|
|
3
|
+
let entries = ctx.dnaEngine.getActiveEntries();
|
|
4
|
+
if (input.category) {
|
|
5
|
+
entries = entries.filter((e) => e.frontmatter.category === input.category);
|
|
6
|
+
}
|
|
7
|
+
entries.sort((a, b) => b.frontmatter.confidence - a.frontmatter.confidence);
|
|
8
|
+
return wrapResponse({ entries }, 7, false);
|
|
9
|
+
}
|
|
10
|
+
export function handleRecordInstruction(ctx, input) {
|
|
11
|
+
const source = input.isExplicit ? 'explicit' : 'correction';
|
|
12
|
+
const entry = ctx.dnaEngine.captureInstruction(input.instruction, input.sessionId, source);
|
|
13
|
+
return wrapResponse({ entry }, 7, false);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=dna-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dna-tools.js","sourceRoot":"","sources":["../../../../src/mcp/tools/dna-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAWnD,MAAM,UAAU,qBAAqB,CACjC,GAAkB,EAClB,KAA2B;IAE3B,IAAI,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,gBAAgB,EAAE,CAAC;IAE/C,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,KAAK,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/E,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5E,OAAO,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAYD,MAAM,UAAU,uBAAuB,CACnC,GAAkB,EAClB,KAA6B;IAE7B,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAE3F,OAAO,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SymbioteDB } from '#storage/db.js';
|
|
2
|
+
import type { CortexRepository } from '#cortex/repository.js';
|
|
3
|
+
import type { ToolResponse } from '#cortex/types.js';
|
|
4
|
+
export interface GraphToolContext {
|
|
5
|
+
db: SymbioteDB;
|
|
6
|
+
cortexRepo: CortexRepository;
|
|
7
|
+
}
|
|
8
|
+
export interface QueryGraphV2Input {
|
|
9
|
+
query: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GetContextForSymbolInput {
|
|
12
|
+
symbol: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SymbolContext {
|
|
15
|
+
symbol: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
kind: string;
|
|
19
|
+
filePath: string;
|
|
20
|
+
lineStart: number;
|
|
21
|
+
lineEnd: number;
|
|
22
|
+
};
|
|
23
|
+
callers: Array<{
|
|
24
|
+
sourceId: string;
|
|
25
|
+
line: number | null;
|
|
26
|
+
confidence: number;
|
|
27
|
+
}>;
|
|
28
|
+
callees: Array<{
|
|
29
|
+
targetId: string;
|
|
30
|
+
line: number | null;
|
|
31
|
+
confidence: number;
|
|
32
|
+
}>;
|
|
33
|
+
importers: Array<{
|
|
34
|
+
sourceId: string;
|
|
35
|
+
kind: string;
|
|
36
|
+
}>;
|
|
37
|
+
extenders: Array<{
|
|
38
|
+
sourceId: string;
|
|
39
|
+
}>;
|
|
40
|
+
implementors: Array<{
|
|
41
|
+
sourceId: string;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export declare function isLegacyQueryFormat(input: Record<string, unknown>): boolean;
|
|
45
|
+
export declare function handleQueryGraphV2(ctx: GraphToolContext, input: QueryGraphV2Input): Promise<ToolResponse<Record<string, unknown>[]>>;
|
|
46
|
+
export declare function handleGetContextForSymbol(ctx: GraphToolContext, input: GetContextForSymbolInput): Promise<ToolResponse<SymbolContext | {
|
|
47
|
+
error: string;
|
|
48
|
+
}>>;
|
|
49
|
+
//# sourceMappingURL=graph-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-tools.d.ts","sourceRoot":"","sources":["../../../../src/mcp/tools/graph-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,UAAU,CAAC;IACf,UAAU,EAAE,gBAAgB,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,OAAO,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,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