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,224 @@
|
|
|
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 context_exports = {};
|
|
30
|
+
__export(context_exports, {
|
|
31
|
+
ContextBuilder: () => ContextBuilder
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(context_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var import_errors = require("../errors");
|
|
37
|
+
var import_query_utils = require("../search/query-utils");
|
|
38
|
+
var import_utils = require("../utils");
|
|
39
|
+
const EXCLUDED_NODE_KINDS = /* @__PURE__ */ new Set(["import", "export"]);
|
|
40
|
+
const DEFAULT_MAX_NODES = 20;
|
|
41
|
+
const DEFAULT_MAX_CODE_BLOCKS = 5;
|
|
42
|
+
const DEFAULT_MAX_CODE_BLOCK_SIZE = 1500;
|
|
43
|
+
const NO_RESULTS_MESSAGE = "No relevant context found for the given query.";
|
|
44
|
+
const FEATURE_REQUEST_WORDS = /* @__PURE__ */ new Set([
|
|
45
|
+
"add",
|
|
46
|
+
"create",
|
|
47
|
+
"implement",
|
|
48
|
+
"build",
|
|
49
|
+
"make",
|
|
50
|
+
"new",
|
|
51
|
+
"feature",
|
|
52
|
+
"support",
|
|
53
|
+
"enable",
|
|
54
|
+
"allow",
|
|
55
|
+
"introduce",
|
|
56
|
+
"generate",
|
|
57
|
+
"write",
|
|
58
|
+
"develop",
|
|
59
|
+
"design",
|
|
60
|
+
"extend"
|
|
61
|
+
]);
|
|
62
|
+
function isFeatureRequest(task) {
|
|
63
|
+
const words = task.toLowerCase().split(/\s+/);
|
|
64
|
+
return words.some((w) => FEATURE_REQUEST_WORDS.has(w));
|
|
65
|
+
}
|
|
66
|
+
class ContextBuilder {
|
|
67
|
+
constructor(db, resolver, vectors, projectRoot) {
|
|
68
|
+
this.db = db;
|
|
69
|
+
this.resolver = resolver;
|
|
70
|
+
this.vectors = vectors;
|
|
71
|
+
this.projectRoot = projectRoot;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Find relevant nodes for the given query using hybrid search.
|
|
75
|
+
*
|
|
76
|
+
* Pipeline:
|
|
77
|
+
* 1. Extract symbol tokens from query
|
|
78
|
+
* 2. Exact name lookup (priority: 'exact')
|
|
79
|
+
* 3. Semantic search via VectorManager (priority: 'semantic')
|
|
80
|
+
* 4. Full-text search fallback (priority: 'fts')
|
|
81
|
+
* 5. Merge and deduplicate by node ID
|
|
82
|
+
* 6. Resolve import nodes to their definitions via 'imports' edge
|
|
83
|
+
* 7. Exclude 'import' and 'export' node kinds
|
|
84
|
+
* 8. Priority-based trimming when exceeding maxNodes
|
|
85
|
+
*/
|
|
86
|
+
async findRelevantContext(query, opts) {
|
|
87
|
+
const maxNodes = opts?.maxNodes ?? DEFAULT_MAX_NODES;
|
|
88
|
+
const tokens = (0, import_query_utils.extractSearchTerms)(query);
|
|
89
|
+
(0, import_errors.logDebug)("ContextBuilder.findRelevantContext", { query, tokens });
|
|
90
|
+
const ranked = [];
|
|
91
|
+
const seen = /* @__PURE__ */ new Map();
|
|
92
|
+
for (const token of tokens) {
|
|
93
|
+
const nodes = this.db.findNodesByExactName(token);
|
|
94
|
+
for (const node of nodes) {
|
|
95
|
+
if (!seen.has(node.id)) {
|
|
96
|
+
seen.set(node.id, "exact");
|
|
97
|
+
ranked.push({ node, priority: "exact" });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (this.vectors.isInitialized()) {
|
|
102
|
+
const semanticNodes = await this.vectors.search(query, maxNodes);
|
|
103
|
+
for (const node of semanticNodes) {
|
|
104
|
+
if (!seen.has(node.id)) {
|
|
105
|
+
seen.set(node.id, "semantic");
|
|
106
|
+
ranked.push({ node, priority: "semantic" });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const ftsNodes = this.db.searchNodes(query, { limit: maxNodes });
|
|
111
|
+
for (const node of ftsNodes) {
|
|
112
|
+
if (!seen.has(node.id)) {
|
|
113
|
+
seen.set(node.id, "fts");
|
|
114
|
+
ranked.push({ node, priority: "fts" });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const importNodeIds = ranked.filter((r) => r.node.kind === "import").map((r) => r.node.id);
|
|
118
|
+
if (importNodeIds.length > 0) {
|
|
119
|
+
const edges = this.db.getEdgesForNodes(importNodeIds);
|
|
120
|
+
for (const edge of edges) {
|
|
121
|
+
if (edge.kind === "imports" && importNodeIds.includes(edge.source)) {
|
|
122
|
+
const targetNode = this.db.getNode(edge.target);
|
|
123
|
+
if (targetNode && !seen.has(targetNode.id)) {
|
|
124
|
+
const importPriority = seen.get(edge.source) ?? "fts";
|
|
125
|
+
seen.set(targetNode.id, importPriority);
|
|
126
|
+
ranked.push({ node: targetNode, priority: importPriority });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const filtered = ranked.filter((r) => !EXCLUDED_NODE_KINDS.has(r.node.kind));
|
|
132
|
+
if (filtered.length <= maxNodes) {
|
|
133
|
+
return filtered.map((r) => r.node);
|
|
134
|
+
}
|
|
135
|
+
const exact = filtered.filter((r) => r.priority === "exact");
|
|
136
|
+
const semantic = filtered.filter((r) => r.priority === "semantic");
|
|
137
|
+
const fts = filtered.filter((r) => r.priority === "fts");
|
|
138
|
+
const trimmed = [];
|
|
139
|
+
for (const group of [exact, semantic, fts]) {
|
|
140
|
+
for (const item of group) {
|
|
141
|
+
if (trimmed.length >= maxNodes) break;
|
|
142
|
+
trimmed.push(item);
|
|
143
|
+
}
|
|
144
|
+
if (trimmed.length >= maxNodes) break;
|
|
145
|
+
}
|
|
146
|
+
return trimmed.map((r) => r.node);
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Build a full TaskContext for the given task description.
|
|
150
|
+
* Finds relevant nodes, gathers their edges and source snippets, and returns
|
|
151
|
+
* the structured context used by MCP tools and the query API.
|
|
152
|
+
*/
|
|
153
|
+
async buildTaskContext(task, opts) {
|
|
154
|
+
const maxNodes = opts?.maxNodes ?? DEFAULT_MAX_NODES;
|
|
155
|
+
const nodes = await this.findRelevantContext(task, { maxNodes });
|
|
156
|
+
const entryPoints = nodes.slice(0, Math.ceil(maxNodes / 2));
|
|
157
|
+
const relatedNodes = nodes.slice(Math.ceil(maxNodes / 2));
|
|
158
|
+
const edges = this.db.getEdgesForNodes(nodes.map((n) => n.id));
|
|
159
|
+
const codeSnippets = /* @__PURE__ */ new Map();
|
|
160
|
+
if (opts?.includeCode !== false) {
|
|
161
|
+
for (const node of nodes.slice(0, 10)) {
|
|
162
|
+
const src = this._readNodeSource(node);
|
|
163
|
+
if (src) codeSnippets.set(node.id, src);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const hint = isFeatureRequest(task) ? " (feature request \u2014 showing existing patterns and extension points)" : "";
|
|
167
|
+
return {
|
|
168
|
+
task,
|
|
169
|
+
entryPoints,
|
|
170
|
+
relatedNodes,
|
|
171
|
+
edges,
|
|
172
|
+
codeSnippets,
|
|
173
|
+
summary: `Found ${entryPoints.length} entry points and ${relatedNodes.length} related symbols for: "${task}"${hint}`
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
_readNodeSource(node) {
|
|
177
|
+
const absPath = (0, import_utils.validatePathWithinRoot)(path.join(this.projectRoot, node.filePath), this.projectRoot);
|
|
178
|
+
if (!absPath) return null;
|
|
179
|
+
try {
|
|
180
|
+
return fs.readFileSync(absPath, "utf8").split("\n").slice(node.startLine - 1, node.endLine).join("\n");
|
|
181
|
+
} catch {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Build a formatted context string for the given query.
|
|
187
|
+
*
|
|
188
|
+
* Each node is formatted as:
|
|
189
|
+
* [filePath:line] kind name
|
|
190
|
+
* ```
|
|
191
|
+
* {snippet}
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* Returns NO_RESULTS_MESSAGE when no nodes are found.
|
|
195
|
+
*/
|
|
196
|
+
async build(query, opts) {
|
|
197
|
+
const maxCodeBlocks = opts?.maxCodeBlocks ?? DEFAULT_MAX_CODE_BLOCKS;
|
|
198
|
+
const maxCodeBlockSize = opts?.maxCodeBlockSize ?? DEFAULT_MAX_CODE_BLOCK_SIZE;
|
|
199
|
+
const nodes = await this.findRelevantContext(query, opts);
|
|
200
|
+
if (nodes.length === 0) {
|
|
201
|
+
return NO_RESULTS_MESSAGE;
|
|
202
|
+
}
|
|
203
|
+
const parts = [];
|
|
204
|
+
const limit = Math.min(nodes.length, maxCodeBlocks);
|
|
205
|
+
for (let i = 0; i < limit; i++) {
|
|
206
|
+
const node = nodes[i];
|
|
207
|
+
const snippet = getSnippet(node, maxCodeBlockSize);
|
|
208
|
+
parts.push(`[${node.filePath}:${node.startLine}] ${node.kind} ${node.name}
|
|
209
|
+
\`\`\`
|
|
210
|
+
${snippet}
|
|
211
|
+
\`\`\``);
|
|
212
|
+
}
|
|
213
|
+
return parts.join("\n\n");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function getSnippet(node, maxSize) {
|
|
217
|
+
const raw = node.signature ?? node.docstring ?? node.name;
|
|
218
|
+
return raw.length > maxSize ? raw.slice(0, maxSize) : raw;
|
|
219
|
+
}
|
|
220
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
221
|
+
0 && (module.exports = {
|
|
222
|
+
ContextBuilder
|
|
223
|
+
});
|
|
224
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/context/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * KiroGraph Context Builder\n *\n * Implements hybrid search (exact name + semantic + full-text) to assemble\n * relevant code context for a given query.\n * Mirrors CodeGraph src/context/index.ts\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport type { Node, TaskContext } from '../types';\nimport type { GraphDatabase } from '../db/database';\nimport type { ReferenceResolver } from '../resolution/index';\nimport type { VectorManager } from '../vectors/index';\nimport { logDebug } from '../errors';\nimport { extractSearchTerms } from '../search/query-utils';\nimport { validatePathWithinRoot } from '../utils';\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** Node kinds excluded from context results (low information density). */\nconst EXCLUDED_NODE_KINDS = new Set<string>(['import', 'export']);\n\nconst DEFAULT_MAX_NODES = 20;\nconst DEFAULT_MAX_CODE_BLOCKS = 5;\nconst DEFAULT_MAX_CODE_BLOCK_SIZE = 1500;\n\nconst NO_RESULTS_MESSAGE = 'No relevant context found for the given query.';\n\n// \u2500\u2500 Types \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface ContextOptions {\n maxNodes?: number;\n maxCodeBlocks?: number;\n maxCodeBlockSize?: number;\n traversalDepth?: number;\n}\n\ntype Priority = 'exact' | 'semantic' | 'fts';\n\ninterface RankedNode {\n node: Node;\n priority: Priority;\n}\n\n// \u2500\u2500 ContextBuilder \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst FEATURE_REQUEST_WORDS = new Set([\n 'add', 'create', 'implement', 'build', 'make', 'new', 'feature', 'support', 'enable', 'allow',\n 'introduce', 'generate', 'write', 'develop', 'design', 'extend',\n]);\n\nfunction isFeatureRequest(task: string): boolean {\n const words = task.toLowerCase().split(/\\s+/);\n return words.some(w => FEATURE_REQUEST_WORDS.has(w));\n}\n\nexport class ContextBuilder {\n constructor(\n private readonly db: GraphDatabase,\n private readonly resolver: ReferenceResolver,\n private readonly vectors: VectorManager,\n private readonly projectRoot: string,\n ) {}\n\n /**\n * Find relevant nodes for the given query using hybrid search.\n *\n * Pipeline:\n * 1. Extract symbol tokens from query\n * 2. Exact name lookup (priority: 'exact')\n * 3. Semantic search via VectorManager (priority: 'semantic')\n * 4. Full-text search fallback (priority: 'fts')\n * 5. Merge and deduplicate by node ID\n * 6. Resolve import nodes to their definitions via 'imports' edge\n * 7. Exclude 'import' and 'export' node kinds\n * 8. Priority-based trimming when exceeding maxNodes\n */\n async findRelevantContext(query: string, opts?: ContextOptions): Promise<Node[]> {\n const maxNodes = opts?.maxNodes ?? DEFAULT_MAX_NODES;\n\n const tokens = extractSearchTerms(query);\n logDebug('ContextBuilder.findRelevantContext', { query, tokens });\n\n const ranked: RankedNode[] = [];\n const seen = new Map<string, Priority>();\n\n // Step 2: Exact name lookup\n for (const token of tokens) {\n const nodes = this.db.findNodesByExactName(token);\n for (const node of nodes) {\n if (!seen.has(node.id)) {\n seen.set(node.id, 'exact');\n ranked.push({ node, priority: 'exact' });\n }\n }\n }\n\n // Step 3: Semantic search (if vectors enabled)\n if (this.vectors.isInitialized()) {\n const semanticNodes = await this.vectors.search(query, maxNodes);\n for (const node of semanticNodes) {\n if (!seen.has(node.id)) {\n seen.set(node.id, 'semantic');\n ranked.push({ node, priority: 'semantic' });\n }\n }\n }\n\n // Step 4: Full-text search fallback\n const ftsNodes = this.db.searchNodes(query, { limit: maxNodes });\n for (const node of ftsNodes) {\n if (!seen.has(node.id)) {\n seen.set(node.id, 'fts');\n ranked.push({ node, priority: 'fts' });\n }\n }\n\n // Step 5: Deduplicated by node ID (already handled via `seen` map above)\n\n // Step 6: Resolve import nodes to their definitions via 'imports' edge\n const importNodeIds = ranked\n .filter(r => r.node.kind === 'import')\n .map(r => r.node.id);\n\n if (importNodeIds.length > 0) {\n const edges = this.db.getEdgesForNodes(importNodeIds);\n for (const edge of edges) {\n if (edge.kind === 'imports' && importNodeIds.includes(edge.source)) {\n const targetNode = this.db.getNode(edge.target);\n if (targetNode && !seen.has(targetNode.id)) {\n // Inherit priority from the import node that resolved to this definition\n const importPriority = seen.get(edge.source) ?? 'fts';\n seen.set(targetNode.id, importPriority);\n ranked.push({ node: targetNode, priority: importPriority });\n }\n }\n }\n }\n\n // Step 7: Exclude 'import' and 'export' node kinds\n const filtered = ranked.filter(r => !EXCLUDED_NODE_KINDS.has(r.node.kind));\n\n // Step 8: Priority-based trimming\n if (filtered.length <= maxNodes) {\n return filtered.map(r => r.node);\n }\n\n const exact = filtered.filter(r => r.priority === 'exact');\n const semantic = filtered.filter(r => r.priority === 'semantic');\n const fts = filtered.filter(r => r.priority === 'fts');\n\n const trimmed: RankedNode[] = [];\n for (const group of [exact, semantic, fts]) {\n for (const item of group) {\n if (trimmed.length >= maxNodes) break;\n trimmed.push(item);\n }\n if (trimmed.length >= maxNodes) break;\n }\n\n return trimmed.map(r => r.node);\n }\n\n /**\n * Build a full TaskContext for the given task description.\n * Finds relevant nodes, gathers their edges and source snippets, and returns\n * the structured context used by MCP tools and the query API.\n */\n async buildTaskContext(task: string, opts?: { maxNodes?: number; includeCode?: boolean }): Promise<TaskContext> {\n const maxNodes = opts?.maxNodes ?? DEFAULT_MAX_NODES;\n const nodes = await this.findRelevantContext(task, { maxNodes });\n\n const entryPoints = nodes.slice(0, Math.ceil(maxNodes / 2));\n const relatedNodes = nodes.slice(Math.ceil(maxNodes / 2));\n const edges = this.db.getEdgesForNodes(nodes.map(n => n.id));\n\n const codeSnippets = new Map<string, string>();\n if (opts?.includeCode !== false) {\n for (const node of nodes.slice(0, 10)) {\n const src = this._readNodeSource(node);\n if (src) codeSnippets.set(node.id, src);\n }\n }\n\n const hint = isFeatureRequest(task)\n ? ' (feature request \u2014 showing existing patterns and extension points)'\n : '';\n\n return {\n task, entryPoints, relatedNodes, edges, codeSnippets,\n summary: `Found ${entryPoints.length} entry points and ${relatedNodes.length} related symbols for: \"${task}\"${hint}`,\n };\n }\n\n private _readNodeSource(node: Node): string | null {\n const absPath = validatePathWithinRoot(path.join(this.projectRoot, node.filePath), this.projectRoot);\n if (!absPath) return null;\n try {\n return fs.readFileSync(absPath, 'utf8').split('\\n').slice(node.startLine - 1, node.endLine).join('\\n');\n } catch { return null; }\n }\n\n /**\n * Build a formatted context string for the given query.\n *\n * Each node is formatted as:\n * [filePath:line] kind name\n * ```\n * {snippet}\n * ```\n *\n * Returns NO_RESULTS_MESSAGE when no nodes are found.\n */\n async build(query: string, opts?: ContextOptions): Promise<string> {\n const maxCodeBlocks = opts?.maxCodeBlocks ?? DEFAULT_MAX_CODE_BLOCKS;\n const maxCodeBlockSize = opts?.maxCodeBlockSize ?? DEFAULT_MAX_CODE_BLOCK_SIZE;\n\n const nodes = await this.findRelevantContext(query, opts);\n\n if (nodes.length === 0) {\n return NO_RESULTS_MESSAGE;\n }\n\n const parts: string[] = [];\n const limit = Math.min(nodes.length, maxCodeBlocks);\n\n for (let i = 0; i < limit; i++) {\n const node = nodes[i];\n const snippet = getSnippet(node, maxCodeBlockSize);\n parts.push(`[${node.filePath}:${node.startLine}] ${node.kind} ${node.name}\\n\\`\\`\\`\\n${snippet}\\n\\`\\`\\``);\n }\n\n return parts.join('\\n\\n');\n }\n}\n\n// \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Get the best available snippet for a node, truncated to maxSize.\n * Prefers signature > docstring > name.\n */\nfunction getSnippet(node: Node, maxSize: number): string {\n const raw = node.signature ?? node.docstring ?? node.name;\n return raw.length > maxSize ? raw.slice(0, maxSize) : raw;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAoB;AACpB,WAAsB;AAKtB,oBAAyB;AACzB,yBAAmC;AACnC,mBAAuC;AAKvC,MAAM,sBAAsB,oBAAI,IAAY,CAAC,UAAU,QAAQ,CAAC;AAEhE,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAChC,MAAM,8BAA8B;AAEpC,MAAM,qBAAqB;AAoB3B,MAAM,wBAAwB,oBAAI,IAAI;AAAA,EACpC;AAAA,EAAO;AAAA,EAAU;AAAA,EAAa;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAW;AAAA,EAAW;AAAA,EAAU;AAAA,EACtF;AAAA,EAAa;AAAA,EAAY;AAAA,EAAS;AAAA,EAAW;AAAA,EAAU;AACzD,CAAC;AAED,SAAS,iBAAiB,MAAuB;AAC/C,QAAM,QAAQ,KAAK,YAAY,EAAE,MAAM,KAAK;AAC5C,SAAO,MAAM,KAAK,OAAK,sBAAsB,IAA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D,UAAM,QAAQ,MAAM,KAAK,oBAAoB,OAAO,IAAI;AAExD,QAAI,MAAM,WAAW,GAAG;AACtB,aAAO;AAAA,IACT;AAEA,UAAM,QAAkB,CAAC;AACzB,UAAM,QAAQ,KAAK,IAAI,MAAM,QAAQ,aAAa;AAElD,aAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,YAAM,OAAO,MAAM,CAAC;AACpB,YAAM,UAAU,WAAW,MAAM,gBAAgB;AACjD,YAAM,KAAK,IAAI,KAAK,QAAQ,IAAI,KAAK,SAAS,KAAK,KAAK,IAAI,IAAI,KAAK,IAAI;AAAA;AAAA,EAAa,OAAO;AAAA,OAAU;AAAA,IACzG;AAEA,WAAO,MAAM,KAAK,MAAM;AAAA,EAC1B;AACF;AAQA,SAAS,WAAW,MAAY,SAAyB;AACvD,QAAM,MAAM,KAAK,aAAa,KAAK,aAAa,KAAK;AACrD,SAAO,IAAI,SAAS,UAAU,IAAI,MAAM,GAAG,OAAO,IAAI;AACxD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File tree builder — constructs a navigable directory tree from flat FileRecord list.
|
|
3
|
+
*/
|
|
4
|
+
import type { FileRecord } from '../types';
|
|
5
|
+
export interface FileTreeNode {
|
|
6
|
+
name: string;
|
|
7
|
+
path: string;
|
|
8
|
+
type: 'file' | 'dir';
|
|
9
|
+
language?: string;
|
|
10
|
+
symbolCount?: number;
|
|
11
|
+
children?: FileTreeNode[];
|
|
12
|
+
}
|
|
13
|
+
export type FileTree = FileTreeNode[];
|
|
14
|
+
export declare function buildFileTree(files: FileRecord[], maxDepth?: number): FileTree;
|
|
15
|
+
//# sourceMappingURL=file-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.d.ts","sourceRoot":"","sources":["../../src/core/file-tree.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;AAEtC,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,CA6C9E"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var file_tree_exports = {};
|
|
20
|
+
__export(file_tree_exports, {
|
|
21
|
+
buildFileTree: () => buildFileTree
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(file_tree_exports);
|
|
24
|
+
function buildFileTree(files, maxDepth) {
|
|
25
|
+
const rootMap = /* @__PURE__ */ new Map();
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
const parts = file.path.split("/");
|
|
28
|
+
let currentMap = rootMap;
|
|
29
|
+
for (let i = 0; i < parts.length; i++) {
|
|
30
|
+
if (maxDepth !== void 0 && i >= maxDepth) break;
|
|
31
|
+
const part = parts[i];
|
|
32
|
+
const currentPath = parts.slice(0, i + 1).join("/");
|
|
33
|
+
const isLast = i === parts.length - 1;
|
|
34
|
+
if (!currentMap.has(part)) {
|
|
35
|
+
if (isLast) {
|
|
36
|
+
currentMap.set(part, {
|
|
37
|
+
name: part,
|
|
38
|
+
path: currentPath,
|
|
39
|
+
type: "file",
|
|
40
|
+
language: file.language,
|
|
41
|
+
symbolCount: file.symbolCount
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
const dir = { name: part, path: currentPath, type: "dir", children: [], _childMap: /* @__PURE__ */ new Map() };
|
|
45
|
+
currentMap.set(part, dir);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!isLast) {
|
|
49
|
+
const dir = currentMap.get(part);
|
|
50
|
+
currentMap = dir._childMap;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function toTree(map) {
|
|
55
|
+
return [...map.values()].map((n) => {
|
|
56
|
+
if (n.type === "dir") {
|
|
57
|
+
const dir = n;
|
|
58
|
+
return { name: dir.name, path: dir.path, type: "dir", children: toTree(dir._childMap) };
|
|
59
|
+
}
|
|
60
|
+
return n;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return toTree(rootMap);
|
|
64
|
+
}
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
buildFileTree
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=file-tree.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/file-tree.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * File tree builder \u2014 constructs a navigable directory tree from flat FileRecord list.\n */\n\nimport type { FileRecord } from '../types';\n\nexport interface FileTreeNode {\n name: string;\n path: string;\n type: 'file' | 'dir';\n language?: string;\n symbolCount?: number;\n children?: FileTreeNode[];\n}\n\nexport type FileTree = FileTreeNode[];\n\nexport function buildFileTree(files: FileRecord[], maxDepth?: number): FileTree {\n interface DirNode extends FileTreeNode { _childMap: Map<string, DirNode | FileTreeNode> }\n\n const rootMap = new Map<string, DirNode | FileTreeNode>();\n\n for (const file of files) {\n const parts = file.path.split('/');\n let currentMap = rootMap;\n\n for (let i = 0; i < parts.length; i++) {\n if (maxDepth !== undefined && i >= maxDepth) break;\n const part = parts[i];\n const currentPath = parts.slice(0, i + 1).join('/');\n const isLast = i === parts.length - 1;\n\n if (!currentMap.has(part)) {\n if (isLast) {\n currentMap.set(part, {\n name: part, path: currentPath, type: 'file',\n language: file.language, symbolCount: file.symbolCount,\n });\n } else {\n const dir: DirNode = { name: part, path: currentPath, type: 'dir', children: [], _childMap: new Map() };\n currentMap.set(part, dir);\n }\n }\n\n if (!isLast) {\n const dir = currentMap.get(part) as DirNode;\n currentMap = dir._childMap;\n }\n }\n }\n\n function toTree(map: Map<string, DirNode | FileTreeNode>): FileTreeNode[] {\n return [...map.values()].map(n => {\n if (n.type === 'dir') {\n const dir = n as DirNode;\n return { name: dir.name, path: dir.path, type: 'dir' as const, children: toTree(dir._childMap) };\n }\n return n;\n });\n }\n\n return toTree(rootMap);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,cAAc,OAAqB,UAA6B;AAG9E,QAAM,UAAU,oBAAI,IAAoC;AAExD,aAAW,QAAQ,OAAO;AACxB,UAAM,QAAQ,KAAK,KAAK,MAAM,GAAG;AACjC,QAAI,aAAa;AAEjB,aAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAI,aAAa,UAAa,KAAK,SAAU;AAC7C,YAAM,OAAO,MAAM,CAAC;AACpB,YAAM,cAAc,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,KAAK,GAAG;AAClD,YAAM,SAAS,MAAM,MAAM,SAAS;AAEpC,UAAI,CAAC,WAAW,IAAI,IAAI,GAAG;AACzB,YAAI,QAAQ;AACV,qBAAW,IAAI,MAAM;AAAA,YACnB,MAAM;AAAA,YAAM,MAAM;AAAA,YAAa,MAAM;AAAA,YACrC,UAAU,KAAK;AAAA,YAAU,aAAa,KAAK;AAAA,UAC7C,CAAC;AAAA,QACH,OAAO;AACL,gBAAM,MAAe,EAAE,MAAM,MAAM,MAAM,aAAa,MAAM,OAAO,UAAU,CAAC,GAAG,WAAW,oBAAI,IAAI,EAAE;AACtG,qBAAW,IAAI,MAAM,GAAG;AAAA,QAC1B;AAAA,MACF;AAEA,UAAI,CAAC,QAAQ;AACX,cAAM,MAAM,WAAW,IAAI,IAAI;AAC/B,qBAAa,IAAI;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAEA,WAAS,OAAO,KAA0D;AACxE,WAAO,CAAC,GAAG,IAAI,OAAO,CAAC,EAAE,IAAI,OAAK;AAChC,UAAI,EAAE,SAAS,OAAO;AACpB,cAAM,MAAM;AACZ,eAAO,EAAE,MAAM,IAAI,MAAM,MAAM,IAAI,MAAM,MAAM,OAAgB,UAAU,OAAO,IAAI,SAAS,EAAE;AAAA,MACjG;AACA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAEA,SAAO,OAAO,OAAO;AACvB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LockManager — file-based process lock + dirty marker.
|
|
3
|
+
*
|
|
4
|
+
* The lock prevents concurrent indexing runs (even from separate processes).
|
|
5
|
+
* The dirty marker is a lightweight signal written on file-save hooks and
|
|
6
|
+
* consumed by sync-if-dirty to trigger deferred incremental syncs.
|
|
7
|
+
*/
|
|
8
|
+
export declare class LockManager {
|
|
9
|
+
private readonly projectRoot;
|
|
10
|
+
private readonly lockPath;
|
|
11
|
+
private readonly dirtyPath;
|
|
12
|
+
constructor(projectRoot: string);
|
|
13
|
+
acquire(): void;
|
|
14
|
+
release(): void;
|
|
15
|
+
forceRelease(): void;
|
|
16
|
+
markDirty(): void;
|
|
17
|
+
clearDirty(): void;
|
|
18
|
+
isDirty(): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=lock-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,WAAW;IAHxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,WAAW,EAAE,MAAM;IAQhD,OAAO,IAAI,IAAI;IA4Bf,OAAO,IAAI,IAAI;IAIf,YAAY,IAAI,IAAI;IAMpB,SAAS,IAAI,IAAI;IAIjB,UAAU,IAAI,IAAI;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
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 lock_manager_exports = {};
|
|
30
|
+
__export(lock_manager_exports, {
|
|
31
|
+
LockManager: () => LockManager
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(lock_manager_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
const KIROGRAPH_DIR = ".kirograph";
|
|
37
|
+
const LOCK_FILE = "kirograph.lock";
|
|
38
|
+
const DIRTY_FILE = "dirty";
|
|
39
|
+
const LOCK_STALE_MS = 5 * 60 * 1e3;
|
|
40
|
+
class LockManager {
|
|
41
|
+
constructor(projectRoot) {
|
|
42
|
+
this.projectRoot = projectRoot;
|
|
43
|
+
const dir = path.join(projectRoot, KIROGRAPH_DIR);
|
|
44
|
+
this.lockPath = path.join(dir, LOCK_FILE);
|
|
45
|
+
this.dirtyPath = path.join(dir, DIRTY_FILE);
|
|
46
|
+
}
|
|
47
|
+
// ── Process lock ───────────────────────────────────────────────────────────
|
|
48
|
+
acquire() {
|
|
49
|
+
if (fs.existsSync(this.lockPath)) {
|
|
50
|
+
try {
|
|
51
|
+
const content = fs.readFileSync(this.lockPath, "utf8").trim();
|
|
52
|
+
const [pidStr, tsStr] = content.split(":");
|
|
53
|
+
const pid = parseInt(pidStr, 10);
|
|
54
|
+
const ts = parseInt(tsStr, 10);
|
|
55
|
+
if (!isNaN(pid) && pid !== process.pid) {
|
|
56
|
+
const isStale = !isNaN(ts) && Date.now() - ts > LOCK_STALE_MS;
|
|
57
|
+
if (!isStale) {
|
|
58
|
+
try {
|
|
59
|
+
process.kill(pid, 0);
|
|
60
|
+
throw new Error(`KiroGraph is locked by PID ${pid}. Use 'kirograph unlock' to force-release.`);
|
|
61
|
+
} catch (e) {
|
|
62
|
+
if (e.message.includes("KiroGraph is locked")) throw e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
if (e.message.includes("KiroGraph is locked")) throw e;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
fs.writeFileSync(this.lockPath, `${process.pid}:${Date.now()}`);
|
|
71
|
+
}
|
|
72
|
+
release() {
|
|
73
|
+
try {
|
|
74
|
+
fs.unlinkSync(this.lockPath);
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
forceRelease() {
|
|
79
|
+
this.release();
|
|
80
|
+
}
|
|
81
|
+
// ── Dirty marker ───────────────────────────────────────────────────────────
|
|
82
|
+
markDirty() {
|
|
83
|
+
fs.writeFileSync(this.dirtyPath, String(Date.now()));
|
|
84
|
+
}
|
|
85
|
+
clearDirty() {
|
|
86
|
+
try {
|
|
87
|
+
fs.unlinkSync(this.dirtyPath);
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
isDirty() {
|
|
92
|
+
return fs.existsSync(this.dirtyPath);
|
|
93
|
+
}
|
|
94
|
+
/** Returns true if a sync/index is currently running (lock file held by another process). */
|
|
95
|
+
isLocked() {
|
|
96
|
+
if (!fs.existsSync(this.lockPath)) return false;
|
|
97
|
+
try {
|
|
98
|
+
const content = fs.readFileSync(this.lockPath, "utf8").trim();
|
|
99
|
+
const [pidStr, tsStr] = content.split(":");
|
|
100
|
+
const pid = parseInt(pidStr, 10);
|
|
101
|
+
const ts = parseInt(tsStr, 10);
|
|
102
|
+
if (isNaN(pid) || pid === process.pid) return false;
|
|
103
|
+
const isStale = !isNaN(ts) && Date.now() - ts > LOCK_STALE_MS;
|
|
104
|
+
if (isStale) return false;
|
|
105
|
+
try {
|
|
106
|
+
process.kill(pid, 0);
|
|
107
|
+
return true;
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
} catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
117
|
+
0 && (module.exports = {
|
|
118
|
+
LockManager
|
|
119
|
+
});
|
|
120
|
+
//# sourceMappingURL=lock-manager.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/core/lock-manager.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * LockManager \u2014 file-based process lock + dirty marker.\n *\n * The lock prevents concurrent indexing runs (even from separate processes).\n * The dirty marker is a lightweight signal written on file-save hooks and\n * consumed by sync-if-dirty to trigger deferred incremental syncs.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nconst KIROGRAPH_DIR = '.kirograph';\nconst LOCK_FILE = 'kirograph.lock';\nconst DIRTY_FILE = 'dirty';\nconst LOCK_STALE_MS = 5 * 60 * 1000; // 5 minutes\n\nexport class LockManager {\n private readonly lockPath: string;\n private readonly dirtyPath: string;\n\n constructor(private readonly projectRoot: string) {\n const dir = path.join(projectRoot, KIROGRAPH_DIR);\n this.lockPath = path.join(dir, LOCK_FILE);\n this.dirtyPath = path.join(dir, DIRTY_FILE);\n }\n\n // \u2500\u2500 Process lock \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n acquire(): void {\n if (fs.existsSync(this.lockPath)) {\n try {\n const content = fs.readFileSync(this.lockPath, 'utf8').trim();\n const [pidStr, tsStr] = content.split(':');\n const pid = parseInt(pidStr, 10);\n const ts = parseInt(tsStr, 10);\n\n if (!isNaN(pid) && pid !== process.pid) {\n const isStale = !isNaN(ts) && Date.now() - ts > LOCK_STALE_MS;\n if (!isStale) {\n try {\n process.kill(pid, 0);\n throw new Error(`KiroGraph is locked by PID ${pid}. Use 'kirograph unlock' to force-release.`);\n } catch (e: any) {\n if (e.message.includes('KiroGraph is locked')) throw e;\n // Process not found \u2014 stale lock, override it\n }\n }\n }\n } catch (e: any) {\n if (e.message.includes('KiroGraph is locked')) throw e;\n // Could not read lock file \u2014 override\n }\n }\n fs.writeFileSync(this.lockPath, `${process.pid}:${Date.now()}`);\n }\n\n release(): void {\n try { fs.unlinkSync(this.lockPath); } catch { /* ignore */ }\n }\n\n forceRelease(): void {\n this.release();\n }\n\n // \u2500\u2500 Dirty marker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n markDirty(): void {\n fs.writeFileSync(this.dirtyPath, String(Date.now()));\n }\n\n clearDirty(): void {\n try { fs.unlinkSync(this.dirtyPath); } catch { /* ignore */ }\n }\n\n isDirty(): boolean {\n return fs.existsSync(this.dirtyPath);\n }\n\n /** Returns true if a sync/index is currently running (lock file held by another process). */\n isLocked(): boolean {\n if (!fs.existsSync(this.lockPath)) return false;\n try {\n const content = fs.readFileSync(this.lockPath, 'utf8').trim();\n const [pidStr, tsStr] = content.split(':');\n const pid = parseInt(pidStr, 10);\n const ts = parseInt(tsStr, 10);\n if (isNaN(pid) || pid === process.pid) return false;\n const isStale = !isNaN(ts) && Date.now() - ts > LOCK_STALE_MS;\n if (isStale) return false;\n try { process.kill(pid, 0); return true; } catch { return false; }\n } catch { return false; }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,SAAoB;AACpB,WAAsB;AAEtB,MAAM,gBAAgB;AACtB,MAAM,YAAY;AAClB,MAAM,aAAa;AACnB,MAAM,gBAAgB,IAAI,KAAK;AAExB,MAAM,YAAY;AAAA,EAIvB,YAA6B,aAAqB;AAArB;AAC3B,UAAM,MAAM,KAAK,KAAK,aAAa,aAAa;AAChD,SAAK,WAAW,KAAK,KAAK,KAAK,SAAS;AACxC,SAAK,YAAY,KAAK,KAAK,KAAK,UAAU;AAAA,EAC5C;AAAA;AAAA,EAIA,UAAgB;AACd,QAAI,GAAG,WAAW,KAAK,QAAQ,GAAG;AAChC,UAAI;AACF,cAAM,UAAU,GAAG,aAAa,KAAK,UAAU,MAAM,EAAE,KAAK;AAC5D,cAAM,CAAC,QAAQ,KAAK,IAAI,QAAQ,MAAM,GAAG;AACzC,cAAM,MAAM,SAAS,QAAQ,EAAE;AAC/B,cAAM,KAAK,SAAS,OAAO,EAAE;AAE7B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AAS,OAAO,EAAE;AAC7B,UAAI,MAAM,GAAG,KAAK,QAAQ,QAAQ,IAAK,QAAO;AAC9C,YAAM,UAAU,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK;AAChD,UAAI,QAAS,QAAO;AACpB,UAAI;AAAE,gBAAQ,KAAK,KAAK,CAAC;AAAG,eAAO;AAAA,MAAM,QAAQ;AAAE,eAAO;AAAA,MAAO;AAAA,IACnE,QAAQ;AAAE,aAAO;AAAA,IAAO;AAAA,EAC1B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexPipeline — full-index and incremental-sync pipelines.
|
|
3
|
+
*
|
|
4
|
+
* Owns the two heavy workflows:
|
|
5
|
+
* - indexAll(): scan all files, extract, store, resolve, detect frameworks,
|
|
6
|
+
* generate embeddings, analyze architecture.
|
|
7
|
+
* - sync(): detect changed files via git (or full scan fallback),
|
|
8
|
+
* re-extract only what changed, then run the same tail pipeline.
|
|
9
|
+
*
|
|
10
|
+
* Everything that touches the filesystem or sub-systems is injected via the
|
|
11
|
+
* constructor, keeping this class testable and free of global state.
|
|
12
|
+
*/
|
|
13
|
+
import { GraphDatabase } from '../db/database';
|
|
14
|
+
import { ReferenceResolver } from '../resolution/index';
|
|
15
|
+
import { VectorManager } from '../vectors/index';
|
|
16
|
+
import { ArchitectureAnalyzer } from '../architecture/index';
|
|
17
|
+
import type { KiroGraphConfig } from '../config';
|
|
18
|
+
import type { IndexResult, IndexProgress, SyncResult } from '../types';
|
|
19
|
+
import { LockManager } from './lock-manager';
|
|
20
|
+
export declare class IndexPipeline {
|
|
21
|
+
private readonly db;
|
|
22
|
+
private readonly vectors;
|
|
23
|
+
private readonly resolver;
|
|
24
|
+
private readonly arch;
|
|
25
|
+
private readonly lock;
|
|
26
|
+
private readonly config;
|
|
27
|
+
private readonly projectRoot;
|
|
28
|
+
private readonly mutex;
|
|
29
|
+
constructor(db: GraphDatabase, vectors: VectorManager, resolver: ReferenceResolver, arch: ArchitectureAnalyzer, lock: LockManager, config: KiroGraphConfig, projectRoot: string);
|
|
30
|
+
indexAll(opts?: {
|
|
31
|
+
onProgress?: (p: IndexProgress) => void;
|
|
32
|
+
force?: boolean;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}): Promise<IndexResult>;
|
|
35
|
+
sync(changedFiles?: string[]): Promise<SyncResult>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/core/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;gBAGlB,EAAE,EAAE,aAAa,EACjB,OAAO,EAAE,aAAa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