kirograph 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1171 -0
- package/dist/architecture/index.d.ts +11 -0
- package/dist/architecture/index.d.ts.map +1 -0
- package/dist/architecture/index.js +207 -0
- package/dist/architecture/index.js.map +7 -0
- package/dist/architecture/layers/csharp.d.ts +6 -0
- package/dist/architecture/layers/csharp.d.ts.map +1 -0
- package/dist/architecture/layers/csharp.js +100 -0
- package/dist/architecture/layers/csharp.js.map +7 -0
- package/dist/architecture/layers/elixir.js +116 -0
- package/dist/architecture/layers/elixir.js.map +7 -0
- package/dist/architecture/layers/go.d.ts +7 -0
- package/dist/architecture/layers/go.d.ts.map +1 -0
- package/dist/architecture/layers/go.js +117 -0
- package/dist/architecture/layers/go.js.map +7 -0
- package/dist/architecture/layers/index.d.ts +30 -0
- package/dist/architecture/layers/index.d.ts.map +1 -0
- package/dist/architecture/layers/index.js +100 -0
- package/dist/architecture/layers/index.js.map +7 -0
- package/dist/architecture/layers/java.d.ts +7 -0
- package/dist/architecture/layers/java.d.ts.map +1 -0
- package/dist/architecture/layers/java.js +119 -0
- package/dist/architecture/layers/java.js.map +7 -0
- package/dist/architecture/layers/python.d.ts +7 -0
- package/dist/architecture/layers/python.d.ts.map +1 -0
- package/dist/architecture/layers/python.js +111 -0
- package/dist/architecture/layers/python.js.map +7 -0
- package/dist/architecture/layers/ruby.d.ts +6 -0
- package/dist/architecture/layers/ruby.d.ts.map +1 -0
- package/dist/architecture/layers/ruby.js +95 -0
- package/dist/architecture/layers/ruby.js.map +7 -0
- package/dist/architecture/layers/rust.d.ts +6 -0
- package/dist/architecture/layers/rust.d.ts.map +1 -0
- package/dist/architecture/layers/rust.js +98 -0
- package/dist/architecture/layers/rust.js.map +7 -0
- package/dist/architecture/layers/types.d.ts +2 -0
- package/dist/architecture/layers/types.d.ts.map +1 -0
- package/dist/architecture/layers/types.js +17 -0
- package/dist/architecture/layers/types.js.map +7 -0
- package/dist/architecture/layers/typescript.d.ts +9 -0
- package/dist/architecture/layers/typescript.d.ts.map +1 -0
- package/dist/architecture/layers/typescript.js +143 -0
- package/dist/architecture/layers/typescript.js.map +7 -0
- package/dist/architecture/manifest/cargo.d.ts +3 -0
- package/dist/architecture/manifest/cargo.d.ts.map +1 -0
- package/dist/architecture/manifest/cargo.js +94 -0
- package/dist/architecture/manifest/cargo.js.map +7 -0
- package/dist/architecture/manifest/csproj.d.ts +3 -0
- package/dist/architecture/manifest/csproj.d.ts.map +1 -0
- package/dist/architecture/manifest/csproj.js +75 -0
- package/dist/architecture/manifest/csproj.js.map +7 -0
- package/dist/architecture/manifest/go.d.ts +3 -0
- package/dist/architecture/manifest/go.d.ts.map +1 -0
- package/dist/architecture/manifest/go.js +85 -0
- package/dist/architecture/manifest/go.js.map +7 -0
- package/dist/architecture/manifest/gradle.d.ts +3 -0
- package/dist/architecture/manifest/gradle.d.ts.map +1 -0
- package/dist/architecture/manifest/gradle.js +80 -0
- package/dist/architecture/manifest/gradle.js.map +7 -0
- package/dist/architecture/manifest/index.d.ts +12 -0
- package/dist/architecture/manifest/index.d.ts.map +1 -0
- package/dist/architecture/manifest/index.js +130 -0
- package/dist/architecture/manifest/index.js.map +7 -0
- package/dist/architecture/manifest/maven.d.ts +3 -0
- package/dist/architecture/manifest/maven.d.ts.map +1 -0
- package/dist/architecture/manifest/maven.js +76 -0
- package/dist/architecture/manifest/maven.js.map +7 -0
- package/dist/architecture/manifest/npm.d.ts +3 -0
- package/dist/architecture/manifest/npm.d.ts.map +1 -0
- package/dist/architecture/manifest/npm.js +103 -0
- package/dist/architecture/manifest/npm.js.map +7 -0
- package/dist/architecture/manifest/python.d.ts +3 -0
- package/dist/architecture/manifest/python.d.ts.map +1 -0
- package/dist/architecture/manifest/python.js +105 -0
- package/dist/architecture/manifest/python.js.map +7 -0
- package/dist/architecture/manifest/types.d.ts +2 -0
- package/dist/architecture/manifest/types.d.ts.map +1 -0
- package/dist/architecture/manifest/types.js +17 -0
- package/dist/architecture/manifest/types.js.map +7 -0
- package/dist/architecture/types.d.ts +91 -0
- package/dist/architecture/types.d.ts.map +1 -0
- package/dist/architecture/types.js +17 -0
- package/dist/architecture/types.js.map +7 -0
- package/dist/assets/logo.png +0 -0
- package/dist/banner.d.ts +6 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +67 -0
- package/dist/banner.js.map +1 -0
- package/dist/bin/banner.d.ts +6 -0
- package/dist/bin/banner.d.ts.map +1 -0
- package/dist/bin/banner.js +88 -0
- package/dist/bin/banner.js.map +7 -0
- package/dist/bin/commands/affected.d.ts +3 -0
- package/dist/bin/commands/affected.d.ts.map +1 -0
- package/dist/bin/commands/affected.js +78 -0
- package/dist/bin/commands/affected.js.map +7 -0
- package/dist/bin/commands/architecture.d.ts +3 -0
- package/dist/bin/commands/architecture.d.ts.map +1 -0
- package/dist/bin/commands/architecture.js +125 -0
- package/dist/bin/commands/architecture.js.map +7 -0
- package/dist/bin/commands/caveman.js +136 -0
- package/dist/bin/commands/caveman.js.map +7 -0
- package/dist/bin/commands/context.d.ts +3 -0
- package/dist/bin/commands/context.d.ts.map +1 -0
- package/dist/bin/commands/context.js +81 -0
- package/dist/bin/commands/context.js.map +7 -0
- package/dist/bin/commands/coupling.d.ts +3 -0
- package/dist/bin/commands/coupling.d.ts.map +1 -0
- package/dist/bin/commands/coupling.js +164 -0
- package/dist/bin/commands/coupling.js.map +7 -0
- package/dist/bin/commands/dashboard.d.ts +3 -0
- package/dist/bin/commands/dashboard.d.ts.map +1 -0
- package/dist/bin/commands/dashboard.js +209 -0
- package/dist/bin/commands/dashboard.js.map +7 -0
- package/dist/bin/commands/dead-code.js +77 -0
- package/dist/bin/commands/dead-code.js.map +7 -0
- package/dist/bin/commands/export.js +2620 -0
- package/dist/bin/commands/export.js.map +7 -0
- package/dist/bin/commands/files.d.ts +3 -0
- package/dist/bin/commands/files.d.ts.map +1 -0
- package/dist/bin/commands/files.js +104 -0
- package/dist/bin/commands/files.js.map +7 -0
- package/dist/bin/commands/help.d.ts +4 -0
- package/dist/bin/commands/help.d.ts.map +1 -0
- package/dist/bin/commands/help.js +212 -0
- package/dist/bin/commands/help.js.map +7 -0
- package/dist/bin/commands/hotspots.js +77 -0
- package/dist/bin/commands/hotspots.js.map +7 -0
- package/dist/bin/commands/index.d.ts +3 -0
- package/dist/bin/commands/index.d.ts.map +1 -0
- package/dist/bin/commands/index.js +58 -0
- package/dist/bin/commands/index.js.map +7 -0
- package/dist/bin/commands/init.d.ts +3 -0
- package/dist/bin/commands/init.d.ts.map +1 -0
- package/dist/bin/commands/init.js +68 -0
- package/dist/bin/commands/init.js.map +7 -0
- package/dist/bin/commands/install.d.ts +3 -0
- package/dist/bin/commands/install.d.ts.map +1 -0
- package/dist/bin/commands/install.js +34 -0
- package/dist/bin/commands/install.js.map +7 -0
- package/dist/bin/commands/mark-dirty.d.ts +3 -0
- package/dist/bin/commands/mark-dirty.d.ts.map +1 -0
- package/dist/bin/commands/mark-dirty.js +51 -0
- package/dist/bin/commands/mark-dirty.js.map +7 -0
- package/dist/bin/commands/package.d.ts +3 -0
- package/dist/bin/commands/package.d.ts.map +1 -0
- package/dist/bin/commands/package.js +139 -0
- package/dist/bin/commands/package.js.map +7 -0
- package/dist/bin/commands/path.js +93 -0
- package/dist/bin/commands/path.js.map +7 -0
- package/dist/bin/commands/qdrant.d.ts +3 -0
- package/dist/bin/commands/qdrant.d.ts.map +1 -0
- package/dist/bin/commands/qdrant.js +159 -0
- package/dist/bin/commands/qdrant.js.map +1 -0
- package/dist/bin/commands/query.d.ts +3 -0
- package/dist/bin/commands/query.d.ts.map +1 -0
- package/dist/bin/commands/query.js +47 -0
- package/dist/bin/commands/query.js.map +7 -0
- package/dist/bin/commands/serve.d.ts +3 -0
- package/dist/bin/commands/serve.d.ts.map +1 -0
- package/dist/bin/commands/serve.js +59 -0
- package/dist/bin/commands/serve.js.map +7 -0
- package/dist/bin/commands/snapshot.js +122 -0
- package/dist/bin/commands/snapshot.js.map +7 -0
- package/dist/bin/commands/status.d.ts +3 -0
- package/dist/bin/commands/status.d.ts.map +1 -0
- package/dist/bin/commands/status.js +107 -0
- package/dist/bin/commands/status.js.map +7 -0
- package/dist/bin/commands/stop.d.ts +3 -0
- package/dist/bin/commands/stop.d.ts.map +1 -0
- package/dist/bin/commands/stop.js +81 -0
- package/dist/bin/commands/stop.js.map +1 -0
- package/dist/bin/commands/surprising.js +79 -0
- package/dist/bin/commands/surprising.js.map +7 -0
- package/dist/bin/commands/sync-if-dirty.d.ts +3 -0
- package/dist/bin/commands/sync-if-dirty.d.ts.map +1 -0
- package/dist/bin/commands/sync-if-dirty.js +67 -0
- package/dist/bin/commands/sync-if-dirty.js.map +7 -0
- package/dist/bin/commands/sync.d.ts +3 -0
- package/dist/bin/commands/sync.d.ts.map +1 -0
- package/dist/bin/commands/sync.js +81 -0
- package/dist/bin/commands/sync.js.map +7 -0
- package/dist/bin/commands/typesense.d.ts +3 -0
- package/dist/bin/commands/typesense.d.ts.map +1 -0
- package/dist/bin/commands/typesense.js +126 -0
- package/dist/bin/commands/typesense.js.map +1 -0
- package/dist/bin/commands/uninit.d.ts +4 -0
- package/dist/bin/commands/uninit.d.ts.map +1 -0
- package/dist/bin/commands/uninit.js +123 -0
- package/dist/bin/commands/uninit.js.map +7 -0
- package/dist/bin/commands/unlock.d.ts +3 -0
- package/dist/bin/commands/unlock.d.ts.map +1 -0
- package/dist/bin/commands/unlock.js +53 -0
- package/dist/bin/commands/unlock.js.map +7 -0
- package/dist/bin/commands/utils.d.ts +12 -0
- package/dist/bin/commands/utils.d.ts.map +1 -0
- package/dist/bin/commands/utils.js +56 -0
- package/dist/bin/commands/utils.js.map +7 -0
- package/dist/bin/installer/archive.js +230 -0
- package/dist/bin/installer/archive.js.map +7 -0
- package/dist/bin/installer/caveman.js +57 -0
- package/dist/bin/installer/caveman.js.map +7 -0
- package/dist/bin/installer/cli-agent.d.ts +15 -0
- package/dist/bin/installer/cli-agent.d.ts.map +1 -0
- package/dist/bin/installer/cli-agent.js +89 -0
- package/dist/bin/installer/cli-agent.js.map +7 -0
- package/dist/bin/installer/config-prompt.d.ts +13 -0
- package/dist/bin/installer/config-prompt.d.ts.map +1 -0
- package/dist/bin/installer/config-prompt.js +158 -0
- package/dist/bin/installer/config-prompt.js.map +7 -0
- package/dist/bin/installer/dashboard.d.ts +3 -0
- package/dist/bin/installer/dashboard.d.ts.map +1 -0
- package/dist/bin/installer/dashboard.js +149 -0
- package/dist/bin/installer/dashboard.js.map +7 -0
- package/dist/bin/installer/hooks.d.ts +5 -0
- package/dist/bin/installer/hooks.d.ts.map +1 -0
- package/dist/bin/installer/hooks.js +155 -0
- package/dist/bin/installer/hooks.js.map +7 -0
- package/dist/bin/installer/index.d.ts +11 -0
- package/dist/bin/installer/index.d.ts.map +1 -0
- package/dist/bin/installer/index.js +228 -0
- package/dist/bin/installer/index.js.map +7 -0
- package/dist/bin/installer/mcp.d.ts +5 -0
- package/dist/bin/installer/mcp.d.ts.map +1 -0
- package/dist/bin/installer/mcp.js +80 -0
- package/dist/bin/installer/mcp.js.map +7 -0
- package/dist/bin/installer/prompts.d.ts +28 -0
- package/dist/bin/installer/prompts.d.ts.map +1 -0
- package/dist/bin/installer/prompts.js +134 -0
- package/dist/bin/installer/prompts.js.map +7 -0
- package/dist/bin/installer/qdrant-dashboard.d.ts +4 -0
- package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -0
- package/dist/bin/installer/qdrant-dashboard.js +115 -0
- package/dist/bin/installer/qdrant-dashboard.js.map +7 -0
- package/dist/bin/installer/steering.d.ts +5 -0
- package/dist/bin/installer/steering.d.ts.map +1 -0
- package/dist/bin/installer/steering.js +283 -0
- package/dist/bin/installer/steering.js.map +7 -0
- package/dist/bin/kirograph.d.ts +6 -0
- package/dist/bin/kirograph.d.ts.map +1 -0
- package/dist/bin/kirograph.js +95 -0
- package/dist/bin/kirograph.js.map +7 -0
- package/dist/bin/progress.d.ts +14 -0
- package/dist/bin/progress.d.ts.map +1 -0
- package/dist/bin/progress.js +201 -0
- package/dist/bin/progress.js.map +7 -0
- package/dist/bin/ui.d.ts +11 -0
- package/dist/bin/ui.d.ts.map +1 -0
- package/dist/bin/ui.js +71 -0
- package/dist/bin/ui.js.map +7 -0
- package/dist/config.d.ts +48 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +273 -0
- package/dist/config.js.map +7 -0
- package/dist/context/index.d.ts +61 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +224 -0
- package/dist/context/index.js.map +7 -0
- package/dist/core/file-tree.d.ts +15 -0
- package/dist/core/file-tree.d.ts.map +1 -0
- package/dist/core/file-tree.js +69 -0
- package/dist/core/file-tree.js.map +7 -0
- package/dist/core/lock-manager.d.ts +20 -0
- package/dist/core/lock-manager.d.ts.map +1 -0
- package/dist/core/lock-manager.js +120 -0
- package/dist/core/lock-manager.js.map +7 -0
- package/dist/core/pipeline.d.ts +37 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +375 -0
- package/dist/core/pipeline.js.map +7 -0
- package/dist/core/snapshot.js +141 -0
- package/dist/core/snapshot.js.map +7 -0
- package/dist/db/database.d.ts +133 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/database.js +929 -0
- package/dist/db/database.js.map +7 -0
- package/dist/db/schema.sql +174 -0
- package/dist/errors.d.ts +49 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +160 -0
- package/dist/errors.js.map +7 -0
- package/dist/extraction/extractor.d.ts +29 -0
- package/dist/extraction/extractor.d.ts.map +1 -0
- package/dist/extraction/extractor.js +764 -0
- package/dist/extraction/extractor.js.map +7 -0
- package/dist/extraction/grammars.d.ts +48 -0
- package/dist/extraction/grammars.d.ts.map +1 -0
- package/dist/extraction/grammars.js +166 -0
- package/dist/extraction/grammars.js.map +7 -0
- package/dist/extraction/languages.d.ts +9 -0
- package/dist/extraction/languages.d.ts.map +1 -0
- package/dist/extraction/languages.js +103 -0
- package/dist/extraction/languages.js.map +7 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/frameworks/csharp.d.ts +8 -0
- package/dist/frameworks/csharp.d.ts.map +1 -0
- package/dist/frameworks/csharp.js +93 -0
- package/dist/frameworks/csharp.js.map +7 -0
- package/dist/frameworks/elixir.js +142 -0
- package/dist/frameworks/elixir.js.map +7 -0
- package/dist/frameworks/express.d.ts +8 -0
- package/dist/frameworks/express.d.ts.map +1 -0
- package/dist/frameworks/express.js +143 -0
- package/dist/frameworks/express.js.map +7 -0
- package/dist/frameworks/go.d.ts +8 -0
- package/dist/frameworks/go.d.ts.map +1 -0
- package/dist/frameworks/go.js +85 -0
- package/dist/frameworks/go.js.map +7 -0
- package/dist/frameworks/index.d.ts +30 -0
- package/dist/frameworks/index.d.ts.map +1 -0
- package/dist/frameworks/index.js +243 -0
- package/dist/frameworks/index.js.map +7 -0
- package/dist/frameworks/java.d.ts +8 -0
- package/dist/frameworks/java.d.ts.map +1 -0
- package/dist/frameworks/java.js +87 -0
- package/dist/frameworks/java.js.map +7 -0
- package/dist/frameworks/laravel.d.ts +9 -0
- package/dist/frameworks/laravel.d.ts.map +1 -0
- package/dist/frameworks/laravel.js +115 -0
- package/dist/frameworks/laravel.js.map +7 -0
- package/dist/frameworks/python.d.ts +10 -0
- package/dist/frameworks/python.d.ts.map +1 -0
- package/dist/frameworks/python.js +158 -0
- package/dist/frameworks/python.js.map +7 -0
- package/dist/frameworks/react.d.ts +9 -0
- package/dist/frameworks/react.d.ts.map +1 -0
- package/dist/frameworks/react.js +230 -0
- package/dist/frameworks/react.js.map +7 -0
- package/dist/frameworks/ruby.d.ts +8 -0
- package/dist/frameworks/ruby.d.ts.map +1 -0
- package/dist/frameworks/ruby.js +136 -0
- package/dist/frameworks/ruby.js.map +7 -0
- package/dist/frameworks/rust.d.ts +8 -0
- package/dist/frameworks/rust.d.ts.map +1 -0
- package/dist/frameworks/rust.js +82 -0
- package/dist/frameworks/rust.js.map +7 -0
- package/dist/frameworks/svelte.d.ts +8 -0
- package/dist/frameworks/svelte.d.ts.map +1 -0
- package/dist/frameworks/svelte.js +174 -0
- package/dist/frameworks/svelte.js.map +7 -0
- package/dist/frameworks/swift.d.ts +10 -0
- package/dist/frameworks/swift.d.ts.map +1 -0
- package/dist/frameworks/swift.js +151 -0
- package/dist/frameworks/swift.js.map +7 -0
- package/dist/frameworks/types.d.ts +37 -0
- package/dist/frameworks/types.d.ts.map +1 -0
- package/dist/frameworks/types.js +17 -0
- package/dist/frameworks/types.js.map +7 -0
- package/dist/graph/queries.d.ts +53 -0
- package/dist/graph/queries.d.ts.map +1 -0
- package/dist/graph/queries.js +224 -0
- package/dist/graph/queries.js.map +7 -0
- package/dist/graph/traversal.d.ts +35 -0
- package/dist/graph/traversal.d.ts.map +1 -0
- package/dist/graph/traversal.js +148 -0
- package/dist/graph/traversal.js.map +7 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +303 -0
- package/dist/index.js.map +7 -0
- package/dist/installer/index.d.ts +10 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +526 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/mcp/server.d.ts +16 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +116 -0
- package/dist/mcp/server.js.map +7 -0
- package/dist/mcp/tools.d.ts +37 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +779 -0
- package/dist/mcp/tools.js.map +7 -0
- package/dist/mcp/transport.d.ts +29 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +70 -0
- package/dist/mcp/transport.js.map +7 -0
- package/dist/resolution/index.d.ts +56 -0
- package/dist/resolution/index.d.ts.map +1 -0
- package/dist/resolution/index.js +384 -0
- package/dist/resolution/index.js.map +7 -0
- package/dist/resolution/name-matcher.d.ts +25 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -0
- package/dist/resolution/name-matcher.js +60 -0
- package/dist/resolution/name-matcher.js.map +7 -0
- package/dist/scripts/postinstall.js +64 -0
- package/dist/search/query-utils.d.ts +21 -0
- package/dist/search/query-utils.d.ts.map +1 -0
- package/dist/search/query-utils.js +219 -0
- package/dist/search/query-utils.js.map +7 -0
- package/dist/search/searcher.d.ts +15 -0
- package/dist/search/searcher.d.ts.map +1 -0
- package/dist/search/searcher.js +49 -0
- package/dist/search/searcher.js.map +7 -0
- package/dist/sync/index.d.ts +33 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +200 -0
- package/dist/sync/index.js.map +7 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +37 -0
- package/dist/types.js.map +7 -0
- package/dist/utils.d.ts +52 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +254 -0
- package/dist/utils.js.map +7 -0
- package/dist/vectors/index.d.ts +71 -0
- package/dist/vectors/index.d.ts.map +1 -0
- package/dist/vectors/index.js +480 -0
- package/dist/vectors/index.js.map +7 -0
- package/dist/vectors/lancedb-index.d.ts +50 -0
- package/dist/vectors/lancedb-index.d.ts.map +1 -0
- package/dist/vectors/lancedb-index.js +153 -0
- package/dist/vectors/lancedb-index.js.map +7 -0
- package/dist/vectors/orama-index.d.ts +54 -0
- package/dist/vectors/orama-index.d.ts.map +1 -0
- package/dist/vectors/orama-index.js +213 -0
- package/dist/vectors/orama-index.js.map +7 -0
- package/dist/vectors/pglite-index.d.ts +53 -0
- package/dist/vectors/pglite-index.d.ts.map +1 -0
- package/dist/vectors/pglite-index.js +194 -0
- package/dist/vectors/pglite-index.js.map +7 -0
- package/dist/vectors/qdrant-index.d.ts +70 -0
- package/dist/vectors/qdrant-index.d.ts.map +1 -0
- package/dist/vectors/qdrant-index.js +364 -0
- package/dist/vectors/qdrant-index.js.map +7 -0
- package/dist/vectors/typesense-index.d.ts +75 -0
- package/dist/vectors/typesense-index.d.ts.map +1 -0
- package/dist/vectors/typesense-index.js +453 -0
- package/dist/vectors/typesense-index.js.map +7 -0
- package/dist/vectors/vec-index.d.ts +52 -0
- package/dist/vectors/vec-index.d.ts.map +1 -0
- package/dist/vectors/vec-index.js +198 -0
- package/dist/vectors/vec-index.js.map +7 -0
- package/package.json +67 -0
|
@@ -0,0 +1,779 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var tools_exports = {};
|
|
30
|
+
__export(tools_exports, {
|
|
31
|
+
ToolHandler: () => ToolHandler,
|
|
32
|
+
tools: () => tools
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(tools_exports);
|
|
35
|
+
var fs = __toESM(require("fs"));
|
|
36
|
+
var path = __toESM(require("path"));
|
|
37
|
+
var crypto = __toESM(require("crypto"));
|
|
38
|
+
var import__ = __toESM(require("../index"));
|
|
39
|
+
var import_errors = require("../errors");
|
|
40
|
+
const MAX_OUTPUT = 15e3;
|
|
41
|
+
function truncate(s) {
|
|
42
|
+
return s.length > MAX_OUTPUT ? s.slice(0, MAX_OUTPUT) + "\n\u2026[truncated]" : s;
|
|
43
|
+
}
|
|
44
|
+
function clampLimit(value, defaultValue) {
|
|
45
|
+
const n = typeof value === "number" ? value : defaultValue;
|
|
46
|
+
return Math.max(1, Math.min(100, Math.round(n)));
|
|
47
|
+
}
|
|
48
|
+
function mapKind(kind) {
|
|
49
|
+
if (kind === "type_alias") return "type";
|
|
50
|
+
return kind;
|
|
51
|
+
}
|
|
52
|
+
function writeSessionMarker(projectRoot) {
|
|
53
|
+
try {
|
|
54
|
+
const hash = crypto.createHash("sha256").update(projectRoot).digest("hex").slice(0, 16);
|
|
55
|
+
fs.writeFileSync(`/tmp/kirograph-consulted-${hash}`, String(Date.now()));
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const tools = [
|
|
60
|
+
{
|
|
61
|
+
name: "kirograph_search",
|
|
62
|
+
description: "Quick symbol search by name. Returns locations only (no code). Use kirograph_context for comprehensive task context.",
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
query: { type: "string", description: 'Symbol name or partial name (e.g., "auth", "signIn", "UserService")' },
|
|
67
|
+
kind: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Filter by node kind",
|
|
70
|
+
enum: ["function", "method", "class", "interface", "type_alias", "variable", "route", "component"]
|
|
71
|
+
},
|
|
72
|
+
limit: { type: "number", description: "Max results 1-100 (default: 10)", default: 10 },
|
|
73
|
+
projectPath: { type: "string", description: "Project root path (optional, defaults to current project)" }
|
|
74
|
+
},
|
|
75
|
+
required: ["query"]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "kirograph_context",
|
|
80
|
+
description: "PRIMARY TOOL: Build comprehensive context for a task or feature request. Returns entry points, related symbols, and key code \u2014 often enough to understand the codebase without additional tool calls.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: {
|
|
84
|
+
task: { type: "string", description: "Description of the task, bug, or feature to build context for" },
|
|
85
|
+
maxNodes: { type: "number", description: "Max symbols to include (default: 20)", default: 20 },
|
|
86
|
+
includeCode: { type: "boolean", description: "Include code snippets (default: true)", default: true },
|
|
87
|
+
projectPath: { type: "string", description: "Project root path (optional, defaults to current project)" }
|
|
88
|
+
},
|
|
89
|
+
required: ["task"]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "kirograph_callers",
|
|
94
|
+
description: "Find all functions/methods that call a specific symbol.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
symbol: { type: "string", description: "Symbol name to find callers for" },
|
|
99
|
+
limit: { type: "number", description: "Max results 1-100 (default: 20)", default: 20 },
|
|
100
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
101
|
+
},
|
|
102
|
+
required: ["symbol"]
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "kirograph_callees",
|
|
107
|
+
description: "Find all functions/methods that a specific symbol calls.",
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
symbol: { type: "string", description: "Symbol name to find callees for" },
|
|
112
|
+
limit: { type: "number", description: "Max results 1-100 (default: 20)", default: 20 },
|
|
113
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
114
|
+
},
|
|
115
|
+
required: ["symbol"]
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "kirograph_impact",
|
|
120
|
+
description: "Analyze what code would be affected by changing a symbol. Use before making changes.",
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
symbol: { type: "string", description: "Symbol name to analyze impact for" },
|
|
125
|
+
depth: { type: "number", description: "Traversal depth (default: 2)", default: 2 },
|
|
126
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
127
|
+
},
|
|
128
|
+
required: ["symbol"]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "kirograph_node",
|
|
133
|
+
description: "Get details about a specific symbol, optionally including its source code.",
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
symbol: { type: "string", description: "Symbol name to look up" },
|
|
138
|
+
includeCode: { type: "boolean", description: "Include source code (default: false)", default: false },
|
|
139
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
140
|
+
},
|
|
141
|
+
required: ["symbol"]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "kirograph_status",
|
|
146
|
+
description: "Check index health and statistics.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "kirograph_files",
|
|
156
|
+
description: "List the indexed file structure of the project. Supports filtering by path prefix, glob pattern, or depth.",
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: "object",
|
|
159
|
+
properties: {
|
|
160
|
+
filterPath: { type: "string", description: 'Filter by directory path prefix (e.g., "src/")' },
|
|
161
|
+
pattern: { type: "string", description: 'Filter by glob pattern (e.g., "**/*.ts")' },
|
|
162
|
+
maxDepth: { type: "number", description: "Limit tree depth" },
|
|
163
|
+
format: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: 'Output format: "tree" (default, visual tree), "flat" (one path per line), "grouped" (grouped by directory)',
|
|
166
|
+
enum: ["tree", "flat", "grouped"],
|
|
167
|
+
default: "tree"
|
|
168
|
+
},
|
|
169
|
+
includeMetadata: { type: "boolean", description: "Include language and symbol count (default: true)", default: true },
|
|
170
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "kirograph_dead_code",
|
|
176
|
+
description: "Find symbols with no incoming references (potential dead code). Only includes unexported symbols.",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
limit: { type: "number", description: "Max results 1-100 (default: 50)", default: 50 },
|
|
181
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "kirograph_circular_deps",
|
|
187
|
+
description: "Find circular import dependencies in the codebase.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
properties: {
|
|
191
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "kirograph_path",
|
|
197
|
+
description: "Find the shortest path between two symbols in the graph.",
|
|
198
|
+
inputSchema: {
|
|
199
|
+
type: "object",
|
|
200
|
+
properties: {
|
|
201
|
+
from: { type: "string", description: "Source symbol name" },
|
|
202
|
+
to: { type: "string", description: "Target symbol name" },
|
|
203
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
204
|
+
},
|
|
205
|
+
required: ["from", "to"]
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: "kirograph_architecture",
|
|
210
|
+
description: "Get the high-level software architecture: packages, layers, and their dependencies. Requires enableArchitecture=true in config. Call this first on a new task to orient yourself without reading files.",
|
|
211
|
+
inputSchema: {
|
|
212
|
+
type: "object",
|
|
213
|
+
properties: {
|
|
214
|
+
level: {
|
|
215
|
+
type: "string",
|
|
216
|
+
description: 'View level: "packages" (package graph), "layers" (architectural layers), or "both" (default)',
|
|
217
|
+
enum: ["packages", "layers", "both"],
|
|
218
|
+
default: "both"
|
|
219
|
+
},
|
|
220
|
+
includeFiles: { type: "boolean", description: "Include per-file package/layer assignments (default: false)", default: false },
|
|
221
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "kirograph_coupling",
|
|
227
|
+
description: "Show coupling metrics for packages: afferent (Ca), efferent (Ce), and instability (Ce/(Ca+Ce)). High instability = depends on many others; low instability = depended on by many. Requires enableArchitecture=true.",
|
|
228
|
+
inputSchema: {
|
|
229
|
+
type: "object",
|
|
230
|
+
properties: {
|
|
231
|
+
sortBy: {
|
|
232
|
+
type: "string",
|
|
233
|
+
description: 'Sort order: "instability" (default), "afferent", or "efferent"',
|
|
234
|
+
enum: ["instability", "afferent", "efferent"],
|
|
235
|
+
default: "instability"
|
|
236
|
+
},
|
|
237
|
+
limit: { type: "number", description: "Max results (default: 20)", default: 20 },
|
|
238
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "kirograph_package",
|
|
244
|
+
description: "Drill into one package: files it contains, symbols it exports, packages it depends on, and packages that depend on it. Requires enableArchitecture=true.",
|
|
245
|
+
inputSchema: {
|
|
246
|
+
type: "object",
|
|
247
|
+
properties: {
|
|
248
|
+
package: { type: "string", description: "Package name or path (partial match accepted)" },
|
|
249
|
+
includeFiles: { type: "boolean", description: "List files in the package (default: true)", default: true },
|
|
250
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
251
|
+
},
|
|
252
|
+
required: ["package"]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: "kirograph_hotspots",
|
|
257
|
+
description: "Find the most-connected symbols in the codebase by total edge degree (incoming + outgoing). Useful for identifying load-bearing code, core abstractions, or blast-radius hot zones.",
|
|
258
|
+
inputSchema: {
|
|
259
|
+
type: "object",
|
|
260
|
+
properties: {
|
|
261
|
+
limit: { type: "number", description: "Max results 1-100 (default: 20)", default: 20 },
|
|
262
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "kirograph_surprising",
|
|
268
|
+
description: "Find non-obvious cross-file connections: direct edges between symbols in structurally distant parts of the codebase. High-score pairs indicate unexpected coupling worth investigating.",
|
|
269
|
+
inputSchema: {
|
|
270
|
+
type: "object",
|
|
271
|
+
properties: {
|
|
272
|
+
limit: { type: "number", description: "Max results 1-100 (default: 20)", default: 20 },
|
|
273
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "kirograph_diff",
|
|
279
|
+
description: "Compare the current graph against a saved snapshot. Shows added/removed symbols and relationships since the snapshot was taken. Use `kirograph snapshot` CLI command to save a snapshot first.",
|
|
280
|
+
inputSchema: {
|
|
281
|
+
type: "object",
|
|
282
|
+
properties: {
|
|
283
|
+
snapshot: { type: "string", description: "Snapshot label to compare against. Omit to use the latest saved snapshot." },
|
|
284
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "kirograph_type_hierarchy",
|
|
290
|
+
description: "Traverse the type hierarchy of a class or interface (base types and derived types).",
|
|
291
|
+
inputSchema: {
|
|
292
|
+
type: "object",
|
|
293
|
+
properties: {
|
|
294
|
+
symbol: { type: "string", description: "Class or interface name" },
|
|
295
|
+
direction: {
|
|
296
|
+
type: "string",
|
|
297
|
+
description: 'Direction: "up" for base types, "down" for derived types, "both" for all (default)',
|
|
298
|
+
enum: ["up", "down", "both"],
|
|
299
|
+
default: "both"
|
|
300
|
+
},
|
|
301
|
+
projectPath: { type: "string", description: "Project root path (optional)" }
|
|
302
|
+
},
|
|
303
|
+
required: ["symbol"]
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
];
|
|
307
|
+
class ToolHandler {
|
|
308
|
+
constructor(cg) {
|
|
309
|
+
this.connections = /* @__PURE__ */ new Map();
|
|
310
|
+
this.defaultCg = cg;
|
|
311
|
+
}
|
|
312
|
+
setDefaultKiroGraph(cg) {
|
|
313
|
+
this.defaultCg = cg;
|
|
314
|
+
}
|
|
315
|
+
/** Close all cached cross-project connections. */
|
|
316
|
+
closeAll() {
|
|
317
|
+
for (const cg of this.connections.values()) {
|
|
318
|
+
try {
|
|
319
|
+
cg.close();
|
|
320
|
+
} catch {
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
this.connections.clear();
|
|
324
|
+
}
|
|
325
|
+
async getConnection(projectPath) {
|
|
326
|
+
if (!projectPath) return this.defaultCg;
|
|
327
|
+
const resolved = path.resolve(projectPath);
|
|
328
|
+
if (this.connections.has(resolved)) return this.connections.get(resolved);
|
|
329
|
+
try {
|
|
330
|
+
const cg = await import__.default.open(resolved);
|
|
331
|
+
this.connections.set(resolved, cg);
|
|
332
|
+
return cg;
|
|
333
|
+
} catch {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async handle(toolName, args) {
|
|
338
|
+
try {
|
|
339
|
+
const text = await this.dispatch(toolName, args);
|
|
340
|
+
return { content: [{ type: "text", text: truncate(text) }] };
|
|
341
|
+
} catch (err) {
|
|
342
|
+
(0, import_errors.logError)("MCP tool error", { tool: toolName, error: err });
|
|
343
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
344
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
async dispatch(toolName, args) {
|
|
348
|
+
const cg = await this.getConnection(args.projectPath);
|
|
349
|
+
if (!cg) return "KiroGraph not initialized. Run `kirograph init` in your project first.";
|
|
350
|
+
writeSessionMarker(cg.getProjectRoot());
|
|
351
|
+
switch (toolName) {
|
|
352
|
+
case "kirograph_search": {
|
|
353
|
+
const limit = clampLimit(args.limit, 10);
|
|
354
|
+
const results = cg.searchNodes(
|
|
355
|
+
args.query,
|
|
356
|
+
args.kind,
|
|
357
|
+
limit
|
|
358
|
+
);
|
|
359
|
+
if (results.length === 0) return `No symbols found matching "${args.query}".`;
|
|
360
|
+
return results.map(
|
|
361
|
+
(r) => `${mapKind(r.node.kind)} ${r.node.name}
|
|
362
|
+
File: ${r.node.filePath}:${r.node.startLine}
|
|
363
|
+
Qualified: ${r.node.qualifiedName}`
|
|
364
|
+
).join("\n\n");
|
|
365
|
+
}
|
|
366
|
+
case "kirograph_context": {
|
|
367
|
+
const ctx = await cg.buildContext(args.task, {
|
|
368
|
+
maxNodes: args.maxNodes ?? 20,
|
|
369
|
+
includeCode: args.includeCode ?? true
|
|
370
|
+
});
|
|
371
|
+
const lines = [ctx.summary, ""];
|
|
372
|
+
if (ctx.entryPoints.length === 0) {
|
|
373
|
+
lines.push("No matching symbols found. If this is a new feature, consider using kirograph_files to explore the codebase structure.");
|
|
374
|
+
} else {
|
|
375
|
+
lines.push("## Entry Points");
|
|
376
|
+
for (const n of ctx.entryPoints) {
|
|
377
|
+
lines.push(`- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`);
|
|
378
|
+
if (ctx.codeSnippets.has(n.id)) {
|
|
379
|
+
lines.push("```", ctx.codeSnippets.get(n.id), "```");
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (ctx.relatedNodes.length > 0) {
|
|
383
|
+
lines.push("", "## Related Symbols");
|
|
384
|
+
for (const n of ctx.relatedNodes.slice(0, 10)) {
|
|
385
|
+
lines.push(`- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return lines.join("\n");
|
|
390
|
+
}
|
|
391
|
+
case "kirograph_callers": {
|
|
392
|
+
const limit = clampLimit(args.limit, 20);
|
|
393
|
+
const results = cg.searchNodes(args.symbol, void 0, 5);
|
|
394
|
+
if (results.length === 0) return `Symbol "${args.symbol}" not found in index.`;
|
|
395
|
+
const node = results[0].node;
|
|
396
|
+
const callers = await cg.getCallers(node.id, limit);
|
|
397
|
+
if (callers.length === 0) return `No callers found for \`${node.name}\`.`;
|
|
398
|
+
return `Callers of \`${node.name}\`:
|
|
399
|
+
` + callers.map(
|
|
400
|
+
(n) => `- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`
|
|
401
|
+
).join("\n");
|
|
402
|
+
}
|
|
403
|
+
case "kirograph_callees": {
|
|
404
|
+
const limit = clampLimit(args.limit, 20);
|
|
405
|
+
const results = cg.searchNodes(args.symbol, void 0, 5);
|
|
406
|
+
if (results.length === 0) return `Symbol "${args.symbol}" not found in index.`;
|
|
407
|
+
const node = results[0].node;
|
|
408
|
+
const callees = await cg.getCallees(node.id, limit);
|
|
409
|
+
if (callees.length === 0) return `\`${node.name}\` doesn't call any indexed symbols.`;
|
|
410
|
+
return `\`${node.name}\` calls:
|
|
411
|
+
` + callees.map(
|
|
412
|
+
(n) => `- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`
|
|
413
|
+
).join("\n");
|
|
414
|
+
}
|
|
415
|
+
case "kirograph_impact": {
|
|
416
|
+
const results = cg.searchNodes(args.symbol, void 0, 5);
|
|
417
|
+
if (results.length === 0) return `Symbol "${args.symbol}" not found in index.`;
|
|
418
|
+
const node = results[0].node;
|
|
419
|
+
const affected = await cg.getImpactRadius(node.id, args.depth ?? 2);
|
|
420
|
+
if (affected.length === 0) return `No dependents found for \`${node.name}\`.`;
|
|
421
|
+
return `Changing \`${node.name}\` may affect ${affected.length} symbol(s):
|
|
422
|
+
` + affected.map((n) => `- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`).join("\n");
|
|
423
|
+
}
|
|
424
|
+
case "kirograph_node": {
|
|
425
|
+
const results = cg.searchNodes(args.symbol, void 0, 5);
|
|
426
|
+
if (results.length === 0) return `Symbol "${args.symbol}" not found in index.`;
|
|
427
|
+
const node = results[0].node;
|
|
428
|
+
const lines = [
|
|
429
|
+
`${mapKind(node.kind)} \`${node.name}\``,
|
|
430
|
+
`File: ${node.filePath}:${node.startLine}-${node.endLine}`,
|
|
431
|
+
`Qualified: ${node.qualifiedName}`,
|
|
432
|
+
node.signature ? `Signature: ${node.signature}` : "",
|
|
433
|
+
node.docstring ? `Docs: ${node.docstring}` : ""
|
|
434
|
+
].filter(Boolean);
|
|
435
|
+
if (args.includeCode) {
|
|
436
|
+
const src = cg.getNodeSource(node);
|
|
437
|
+
if (src) lines.push("", "```", src, "```");
|
|
438
|
+
}
|
|
439
|
+
return lines.join("\n");
|
|
440
|
+
}
|
|
441
|
+
case "kirograph_status": {
|
|
442
|
+
const stats = await cg.getStats();
|
|
443
|
+
const langLine = Object.entries(stats.filesByLanguage).sort((a, b) => b[1] - a[1]).map(([k, v]) => `${k}=${v}`).join(", ");
|
|
444
|
+
const dbMb = (stats.dbSizeBytes / 1024 / 1024).toFixed(2);
|
|
445
|
+
const semanticLines = stats.embeddingsEnabled ? [
|
|
446
|
+
` Semantic search: enabled`,
|
|
447
|
+
` Semantic model: ${stats.embeddingModel}`,
|
|
448
|
+
` Semantic engine: ${stats.semanticEngine === "sqlite-vec" ? `sqlite-vec (${stats.vecIndexCount} entries in ANN index)` : stats.semanticEngine === "orama" ? `orama hybrid (${stats.vecIndexCount} docs in index)` : stats.semanticEngine === "pglite" ? `pglite+pgvector (${stats.vecIndexCount} rows in DB)` : stats.semanticEngine === "lancedb" ? `lancedb (${stats.vecIndexCount} entries in ANN index)` : stats.semanticEngine === "qdrant" ? `qdrant (${stats.vecIndexCount} points in collection)` : stats.semanticEngine === "typesense" ? `typesense (${stats.vecIndexCount} documents in collection)` : "in-process cosine"}`,
|
|
449
|
+
` Embeddings: ${stats.embeddingCount} / ${stats.embeddableNodeCount || stats.nodes} embeddable symbols`,
|
|
450
|
+
...stats.engineFallback ? [` \u26A0 Engine fallback: ${stats.engineFallback}`] : []
|
|
451
|
+
] : [` Semantic search: disabled`];
|
|
452
|
+
const frameworkLine = stats.frameworks.length > 0 ? ` Frameworks: ${stats.frameworks.join(", ")}` : ` Frameworks: none detected`;
|
|
453
|
+
const archLine = stats.architectureEnabled ? stats.architectureStats ? ` Architecture: enabled \u2014 ${stats.architectureStats.packages} packages, ${stats.architectureStats.layers} layers, ${stats.architectureStats.packageDeps} deps` : ` Architecture: enabled (not yet analyzed \u2014 run kirograph index)` : ` Architecture: disabled`;
|
|
454
|
+
const threshold = stats.syncWarningThreshold ?? 10;
|
|
455
|
+
const pendingFiles = stats.pendingFiles ?? 0;
|
|
456
|
+
const syncRunning = stats.syncRunning ?? false;
|
|
457
|
+
const syncLines = [];
|
|
458
|
+
if (syncRunning) {
|
|
459
|
+
syncLines.push(` \u26A0 Sync is currently running in the background.`);
|
|
460
|
+
}
|
|
461
|
+
if (threshold > 0 && pendingFiles >= threshold) {
|
|
462
|
+
syncLines.push(
|
|
463
|
+
` \u26A0 Index may be incomplete \u2014 ${pendingFiles} file${pendingFiles !== 1 ? "s" : ""} pending sync.` + (syncRunning ? " Sync is running in background." : " Run `kirograph sync` to update.") + ` Would you like to wait before proceeding?`
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
return [
|
|
467
|
+
`KiroGraph Status`,
|
|
468
|
+
` Project: ${cg.getProjectRoot()}`,
|
|
469
|
+
` Files indexed: ${stats.files}`,
|
|
470
|
+
` Symbols: ${stats.nodes}`,
|
|
471
|
+
` Relationships: ${stats.edges}`,
|
|
472
|
+
` By kind: ${Object.entries(stats.nodesByKind).map(([k, v]) => `${k}=${v}`).join(", ")}`,
|
|
473
|
+
langLine ? ` By language: ${langLine}` : "",
|
|
474
|
+
frameworkLine,
|
|
475
|
+
archLine,
|
|
476
|
+
` DB size: ${dbMb} MB`,
|
|
477
|
+
...semanticLines,
|
|
478
|
+
...syncLines
|
|
479
|
+
].filter(Boolean).join("\n");
|
|
480
|
+
}
|
|
481
|
+
case "kirograph_files": {
|
|
482
|
+
let renderTree2 = function(nodes, prefix) {
|
|
483
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
484
|
+
const node = nodes[i];
|
|
485
|
+
const isLast = i === nodes.length - 1;
|
|
486
|
+
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
487
|
+
const childPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
488
|
+
const meta = includeMetadata && node.type === "file" && node.language ? ` [${node.language}${node.symbolCount ? ` \xB7 ${node.symbolCount} symbols` : ""}]` : "";
|
|
489
|
+
lines.push(`${prefix}${connector}${node.name}${meta}`);
|
|
490
|
+
if (node.children?.length) renderTree2(node.children, childPrefix);
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
var renderTree = renderTree2;
|
|
494
|
+
const format = args.format ?? "tree";
|
|
495
|
+
const includeMetadata = args.includeMetadata !== false;
|
|
496
|
+
const tree = cg.getFiles({
|
|
497
|
+
filterPath: args.filterPath,
|
|
498
|
+
pattern: args.pattern,
|
|
499
|
+
maxDepth: args.maxDepth
|
|
500
|
+
});
|
|
501
|
+
if (format === "flat") {
|
|
502
|
+
let flattenTree2 = function(nodes) {
|
|
503
|
+
for (const node of nodes) {
|
|
504
|
+
if (node.type === "file") {
|
|
505
|
+
const meta = includeMetadata && node.language ? ` [${node.language}${node.symbolCount ? ` \xB7 ${node.symbolCount}` : ""}]` : "";
|
|
506
|
+
flat.push(`${node.path}${meta}`);
|
|
507
|
+
}
|
|
508
|
+
if (node.children?.length) flattenTree2(node.children);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
var flattenTree = flattenTree2;
|
|
512
|
+
const flat = [];
|
|
513
|
+
flattenTree2(tree);
|
|
514
|
+
return flat.length > 0 ? flat.join("\n") : "No indexed files found.";
|
|
515
|
+
}
|
|
516
|
+
if (format === "grouped") {
|
|
517
|
+
let groupTree2 = function(nodes) {
|
|
518
|
+
for (const node of nodes) {
|
|
519
|
+
if (node.type === "file") {
|
|
520
|
+
const dir = node.path.includes("/") ? node.path.slice(0, node.path.lastIndexOf("/")) : ".";
|
|
521
|
+
if (!groups.has(dir)) groups.set(dir, []);
|
|
522
|
+
groups.get(dir).push(node);
|
|
523
|
+
}
|
|
524
|
+
if (node.children?.length) groupTree2(node.children);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
var groupTree = groupTree2;
|
|
528
|
+
const groups = /* @__PURE__ */ new Map();
|
|
529
|
+
groupTree2(tree);
|
|
530
|
+
const lines2 = [];
|
|
531
|
+
for (const [dir, files] of [...groups.entries()].sort()) {
|
|
532
|
+
lines2.push(`${dir}/`);
|
|
533
|
+
for (const f of files) {
|
|
534
|
+
const meta = includeMetadata && f.language ? ` [${f.language}${f.symbolCount ? ` \xB7 ${f.symbolCount}` : ""}]` : "";
|
|
535
|
+
lines2.push(` ${f.name}${meta}`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return lines2.length > 0 ? lines2.join("\n") : "No indexed files found.";
|
|
539
|
+
}
|
|
540
|
+
const lines = [];
|
|
541
|
+
renderTree2(tree, "");
|
|
542
|
+
return lines.length > 0 ? lines.join("\n") : "No indexed files found.";
|
|
543
|
+
}
|
|
544
|
+
case "kirograph_dead_code": {
|
|
545
|
+
const limit = clampLimit(args.limit, 50);
|
|
546
|
+
const dead = cg.findDeadCode(limit);
|
|
547
|
+
if (dead.length === 0) return "No dead code detected.";
|
|
548
|
+
return `Potential dead code (${dead.length} unexported symbols with no incoming references):
|
|
549
|
+
` + dead.map((n) => `- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`).join("\n");
|
|
550
|
+
}
|
|
551
|
+
case "kirograph_circular_deps": {
|
|
552
|
+
const cycles = cg.findCircularDependencies();
|
|
553
|
+
if (cycles.length === 0) return "No circular dependencies found.";
|
|
554
|
+
return `Found ${cycles.length} circular dependency cycle(s):
|
|
555
|
+
` + cycles.map((cycle, i) => `Cycle ${i + 1}: ${cycle.join(" \u2192 ")}`).join("\n");
|
|
556
|
+
}
|
|
557
|
+
case "kirograph_path": {
|
|
558
|
+
const fromResults = cg.searchNodes(args.from, void 0, 3);
|
|
559
|
+
const toResults = cg.searchNodes(args.to, void 0, 3);
|
|
560
|
+
if (fromResults.length === 0) return `Symbol "${args.from}" not found in index.`;
|
|
561
|
+
if (toResults.length === 0) return `Symbol "${args.to}" not found in index.`;
|
|
562
|
+
const fromNode = fromResults[0].node;
|
|
563
|
+
const toNode = toResults[0].node;
|
|
564
|
+
const pathNodes = await cg.findPath(fromNode.id, toNode.id);
|
|
565
|
+
if (pathNodes.length === 0) return `No path found between \`${fromNode.name}\` and \`${toNode.name}\`.`;
|
|
566
|
+
return `Path from \`${fromNode.name}\` to \`${toNode.name}\` (${pathNodes.length} nodes):
|
|
567
|
+
` + pathNodes.map((n, i) => `${i + 1}. ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`).join("\n");
|
|
568
|
+
}
|
|
569
|
+
case "kirograph_type_hierarchy": {
|
|
570
|
+
const results = cg.searchNodes(args.symbol, void 0, 5);
|
|
571
|
+
if (results.length === 0) return `Symbol "${args.symbol}" not found in index.`;
|
|
572
|
+
const node = results[0].node;
|
|
573
|
+
const direction = args.direction ?? "both";
|
|
574
|
+
const hierarchy = cg.getTypeHierarchy(node.id, direction);
|
|
575
|
+
if (hierarchy.length === 0) return `No type hierarchy found for \`${node.name}\`.`;
|
|
576
|
+
return `Type hierarchy for \`${node.name}\` (direction: ${direction}):
|
|
577
|
+
` + hierarchy.map((n) => `- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}:${n.startLine}`).join("\n");
|
|
578
|
+
}
|
|
579
|
+
case "kirograph_architecture": {
|
|
580
|
+
if (!cg.isArchitectureEnabled()) {
|
|
581
|
+
return "Architecture analysis is disabled. Set enableArchitecture=true in .kirograph/config.json and re-index.";
|
|
582
|
+
}
|
|
583
|
+
const level = args.level ?? "both";
|
|
584
|
+
const includeFiles = args.includeFiles === true;
|
|
585
|
+
const arch = cg.getArchitecture();
|
|
586
|
+
const lines = ["# Architecture"];
|
|
587
|
+
if ((level === "packages" || level === "both") && arch.packages.length > 0) {
|
|
588
|
+
lines.push("\n## Packages");
|
|
589
|
+
for (const pkg of arch.packages) {
|
|
590
|
+
const meta = [pkg.language, pkg.version].filter(Boolean).join(", ");
|
|
591
|
+
lines.push(`- **${pkg.name}** (${pkg.path}) [${pkg.source}${meta ? " \xB7 " + meta : ""}]`);
|
|
592
|
+
}
|
|
593
|
+
if (arch.packageDeps.length > 0) {
|
|
594
|
+
lines.push("\n## Package Dependencies");
|
|
595
|
+
for (const dep of arch.packageDeps) {
|
|
596
|
+
const src = arch.packages.find((p) => p.id === dep.sourcePkg)?.name ?? dep.sourcePkg;
|
|
597
|
+
const tgt = arch.packages.find((p) => p.id === dep.targetPkg)?.name ?? dep.targetPkg;
|
|
598
|
+
lines.push(`- ${src} \u2192 ${tgt} (${dep.depCount} import${dep.depCount !== 1 ? "s" : ""})`);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if ((level === "layers" || level === "both") && arch.layers.length > 0) {
|
|
603
|
+
lines.push("\n## Layers");
|
|
604
|
+
for (const layer of arch.layers) {
|
|
605
|
+
const fileCount = Object.values(arch.fileLayers).filter((fl) => fl.some((l) => l.layerId === layer.id)).length;
|
|
606
|
+
lines.push(`- **${layer.name}** [${layer.source}] \u2014 ${fileCount} file${fileCount !== 1 ? "s" : ""}`);
|
|
607
|
+
}
|
|
608
|
+
if (arch.layerDeps.length > 0) {
|
|
609
|
+
lines.push("\n## Layer Dependencies");
|
|
610
|
+
for (const dep of arch.layerDeps) {
|
|
611
|
+
const src = dep.sourceLayer.replace("layer:", "");
|
|
612
|
+
const tgt = dep.targetLayer.replace("layer:", "");
|
|
613
|
+
lines.push(`- ${src} \u2192 ${tgt} (${dep.depCount})`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (includeFiles && (level === "packages" || level === "both")) {
|
|
618
|
+
lines.push("\n## File \u2192 Package");
|
|
619
|
+
for (const [file, pkgIds] of Object.entries(arch.filePackages).slice(0, 50)) {
|
|
620
|
+
const names = pkgIds.map((id) => arch.packages.find((p) => p.id === id)?.name ?? id).join(", ");
|
|
621
|
+
lines.push(`- ${file}: ${names}`);
|
|
622
|
+
}
|
|
623
|
+
if (Object.keys(arch.filePackages).length > 50) lines.push(" \u2026(truncated)");
|
|
624
|
+
}
|
|
625
|
+
if (arch.packages.length === 0 && arch.layers.length === 0) {
|
|
626
|
+
return "No architecture data found. Run `kirograph index` with enableArchitecture=true.";
|
|
627
|
+
}
|
|
628
|
+
return lines.join("\n");
|
|
629
|
+
}
|
|
630
|
+
case "kirograph_coupling": {
|
|
631
|
+
if (!cg.isArchitectureEnabled()) {
|
|
632
|
+
return "Architecture analysis is disabled. Set enableArchitecture=true in .kirograph/config.json and re-index.";
|
|
633
|
+
}
|
|
634
|
+
const sortBy = args.sortBy ?? "instability";
|
|
635
|
+
const limit = clampLimit(args.limit, 20);
|
|
636
|
+
const arch = cg.getArchitecture();
|
|
637
|
+
if (arch.coupling.length === 0) {
|
|
638
|
+
return "No coupling data. Run `kirograph index` with enableArchitecture=true.";
|
|
639
|
+
}
|
|
640
|
+
const sorted = [...arch.coupling].sort((a, b) => {
|
|
641
|
+
if (sortBy === "afferent") return b.afferent - a.afferent;
|
|
642
|
+
if (sortBy === "efferent") return b.efferent - a.efferent;
|
|
643
|
+
return b.instability - a.instability;
|
|
644
|
+
}).slice(0, limit);
|
|
645
|
+
const lines = [
|
|
646
|
+
`Coupling Metrics (sorted by ${sortBy}):`,
|
|
647
|
+
"",
|
|
648
|
+
"Package Ca Ce I",
|
|
649
|
+
"\u2500".repeat(52)
|
|
650
|
+
];
|
|
651
|
+
for (const c of sorted) {
|
|
652
|
+
const pkg = arch.packages.find((p) => p.id === c.packageId);
|
|
653
|
+
const name = (pkg?.name ?? c.packageId).slice(0, 32).padEnd(32);
|
|
654
|
+
const ca = String(c.afferent).padStart(4);
|
|
655
|
+
const ce = String(c.efferent).padStart(4);
|
|
656
|
+
const inst = c.instability.toFixed(2).padStart(5);
|
|
657
|
+
lines.push(`${name} ${ca} ${ce} ${inst}`);
|
|
658
|
+
}
|
|
659
|
+
lines.push("", "Ca=afferent (depended on by), Ce=efferent (depends on), I=instability (Ce/(Ca+Ce))");
|
|
660
|
+
return lines.join("\n");
|
|
661
|
+
}
|
|
662
|
+
case "kirograph_package": {
|
|
663
|
+
if (!cg.isArchitectureEnabled()) {
|
|
664
|
+
return "Architecture analysis is disabled. Set enableArchitecture=true in .kirograph/config.json and re-index.";
|
|
665
|
+
}
|
|
666
|
+
const query = args.package.toLowerCase();
|
|
667
|
+
const includeFiles = args.includeFiles !== false;
|
|
668
|
+
const arch = cg.getArchitecture();
|
|
669
|
+
const pkg = arch.packages.find(
|
|
670
|
+
(p) => p.name.toLowerCase().includes(query) || p.path.toLowerCase().includes(query) || p.id.toLowerCase().includes(query)
|
|
671
|
+
);
|
|
672
|
+
if (!pkg) return `Package "${args.package}" not found. Use kirograph_architecture to list all packages.`;
|
|
673
|
+
const lines = [
|
|
674
|
+
`## Package: ${pkg.name}`,
|
|
675
|
+
`Path: ${pkg.path}`,
|
|
676
|
+
`Source: ${pkg.source}${pkg.manifestPath ? ` (${pkg.manifestPath})` : ""}`,
|
|
677
|
+
...pkg.version ? [`Version: ${pkg.version}`] : [],
|
|
678
|
+
...pkg.language ? [`Language: ${pkg.language}`] : []
|
|
679
|
+
];
|
|
680
|
+
const deps = arch.packageDeps.filter((d) => d.sourcePkg === pkg.id);
|
|
681
|
+
const dependents = arch.packageDeps.filter((d) => d.targetPkg === pkg.id);
|
|
682
|
+
const coupling = arch.coupling.find((c) => c.packageId === pkg.id);
|
|
683
|
+
if (coupling) {
|
|
684
|
+
lines.push("", `Coupling: Ca=${coupling.afferent} Ce=${coupling.efferent} I=${coupling.instability.toFixed(2)}`);
|
|
685
|
+
}
|
|
686
|
+
if (deps.length > 0) {
|
|
687
|
+
lines.push("", `Depends on (${deps.length}):`);
|
|
688
|
+
for (const dep of deps) {
|
|
689
|
+
const name = arch.packages.find((p) => p.id === dep.targetPkg)?.name ?? dep.targetPkg;
|
|
690
|
+
lines.push(` \u2192 ${name} (${dep.depCount} import${dep.depCount !== 1 ? "s" : ""})`);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (dependents.length > 0) {
|
|
694
|
+
lines.push("", `Depended on by (${dependents.length}):`);
|
|
695
|
+
for (const dep of dependents) {
|
|
696
|
+
const name = arch.packages.find((p) => p.id === dep.sourcePkg)?.name ?? dep.sourcePkg;
|
|
697
|
+
lines.push(` \u2190 ${name} (${dep.depCount} import${dep.depCount !== 1 ? "s" : ""})`);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
if (pkg.externalDeps && pkg.externalDeps.length > 0) {
|
|
701
|
+
lines.push("", `External deps (${pkg.externalDeps.length}): ${pkg.externalDeps.slice(0, 10).join(", ")}${pkg.externalDeps.length > 10 ? "\u2026" : ""}`);
|
|
702
|
+
}
|
|
703
|
+
if (includeFiles) {
|
|
704
|
+
const files = Object.entries(arch.filePackages).filter(([, ids]) => ids.includes(pkg.id)).map(([f]) => f).sort();
|
|
705
|
+
if (files.length > 0) {
|
|
706
|
+
lines.push("", `Files (${files.length}):`);
|
|
707
|
+
for (const f of files.slice(0, 30)) lines.push(` ${f}`);
|
|
708
|
+
if (files.length > 30) lines.push(` \u2026and ${files.length - 30} more`);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return lines.join("\n");
|
|
712
|
+
}
|
|
713
|
+
case "kirograph_hotspots": {
|
|
714
|
+
const limit = clampLimit(args.limit, 20);
|
|
715
|
+
const hotspots = cg.findHotspots(limit);
|
|
716
|
+
if (hotspots.length === 0) return "No symbols found in index.";
|
|
717
|
+
const lines = [`Top ${hotspots.length} most-connected symbols (by edge degree):
|
|
718
|
+
`];
|
|
719
|
+
for (const n of hotspots) {
|
|
720
|
+
lines.push(`${mapKind(n.kind)} \`${n.name}\` \u2014 degree ${n.degree} (in: ${n.inDegree}, out: ${n.outDegree})`);
|
|
721
|
+
lines.push(` File: ${n.filePath}:${n.startLine}`);
|
|
722
|
+
}
|
|
723
|
+
return lines.join("\n");
|
|
724
|
+
}
|
|
725
|
+
case "kirograph_surprising": {
|
|
726
|
+
const limit = clampLimit(args.limit, 20);
|
|
727
|
+
const connections = cg.findSurprisingConnections(limit);
|
|
728
|
+
if (connections.length === 0) return "No surprising cross-file connections found.";
|
|
729
|
+
const lines = [`Top ${connections.length} surprising cross-file connections:
|
|
730
|
+
`];
|
|
731
|
+
for (const c of connections) {
|
|
732
|
+
lines.push(`${mapKind(c.source.kind)} \`${c.source.name}\` ${c.kind}\u2192 ${mapKind(c.target.kind)} \`${c.target.name}\` (score: ${c.score.toFixed(2)})`);
|
|
733
|
+
lines.push(` ${c.source.filePath} \u2192 ${c.target.filePath}`);
|
|
734
|
+
}
|
|
735
|
+
return lines.join("\n");
|
|
736
|
+
}
|
|
737
|
+
case "kirograph_diff": {
|
|
738
|
+
const sm = cg.createSnapshotManager();
|
|
739
|
+
const snapshot = args.snapshot ? sm.load(args.snapshot) : sm.loadLatest();
|
|
740
|
+
if (!snapshot) {
|
|
741
|
+
return args.snapshot ? `Snapshot "${args.snapshot}" not found. Use \`kirograph snapshot list\` to see available snapshots.` : "No snapshots found. Run `kirograph snapshot` to save one first.";
|
|
742
|
+
}
|
|
743
|
+
const diff = sm.diff(snapshot, sm.currentSnapshot());
|
|
744
|
+
const fromDate = new Date(diff.from.timestamp).toISOString().slice(0, 19).replace("T", " ");
|
|
745
|
+
const lines = [
|
|
746
|
+
`Graph diff: "${diff.from.label}" (${fromDate}) \u2192 current`,
|
|
747
|
+
``,
|
|
748
|
+
`Symbols: +${diff.addedNodes.length} added, -${diff.removedNodes.length} removed`,
|
|
749
|
+
`Edges: +${diff.addedEdges.length} added, -${diff.removedEdges.length} removed`
|
|
750
|
+
];
|
|
751
|
+
if (diff.addedNodes.length > 0) {
|
|
752
|
+
lines.push(`
|
|
753
|
+
## Added symbols (${diff.addedNodes.length})`);
|
|
754
|
+
for (const n of diff.addedNodes.slice(0, 30)) {
|
|
755
|
+
lines.push(`+ ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}`);
|
|
756
|
+
}
|
|
757
|
+
if (diff.addedNodes.length > 30) lines.push(` \u2026and ${diff.addedNodes.length - 30} more`);
|
|
758
|
+
}
|
|
759
|
+
if (diff.removedNodes.length > 0) {
|
|
760
|
+
lines.push(`
|
|
761
|
+
## Removed symbols (${diff.removedNodes.length})`);
|
|
762
|
+
for (const n of diff.removedNodes.slice(0, 30)) {
|
|
763
|
+
lines.push(`- ${mapKind(n.kind)} \`${n.name}\` \u2014 ${n.filePath}`);
|
|
764
|
+
}
|
|
765
|
+
if (diff.removedNodes.length > 30) lines.push(` \u2026and ${diff.removedNodes.length - 30} more`);
|
|
766
|
+
}
|
|
767
|
+
return lines.join("\n");
|
|
768
|
+
}
|
|
769
|
+
default:
|
|
770
|
+
return `Unknown tool: ${toolName}`;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
775
|
+
0 && (module.exports = {
|
|
776
|
+
ToolHandler,
|
|
777
|
+
tools
|
|
778
|
+
});
|
|
779
|
+
//# sourceMappingURL=tools.js.map
|