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,764 @@
|
|
|
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 extractor_exports = {};
|
|
30
|
+
__export(extractor_exports, {
|
|
31
|
+
extractFile: () => extractFile,
|
|
32
|
+
makeNodeId: () => makeNodeId
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(extractor_exports);
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var fs = __toESM(require("fs"));
|
|
37
|
+
var crypto = __toESM(require("crypto"));
|
|
38
|
+
var import_languages = require("./languages");
|
|
39
|
+
var import_grammars = require("./grammars");
|
|
40
|
+
function makeNodeId(filePath, kind, name, line) {
|
|
41
|
+
const hash = crypto.createHash("sha256").update(`${filePath}:${kind}:${name}:${line}`).digest("hex").slice(0, 32);
|
|
42
|
+
return `${kind}:${hash}`;
|
|
43
|
+
}
|
|
44
|
+
function validatePath(filePath, projectRoot) {
|
|
45
|
+
try {
|
|
46
|
+
const real = fs.realpathSync(filePath);
|
|
47
|
+
const realRoot = fs.realpathSync(projectRoot);
|
|
48
|
+
return real.startsWith(realRoot + path.sep) || real === realRoot;
|
|
49
|
+
} catch {
|
|
50
|
+
const normalized = path.resolve(filePath);
|
|
51
|
+
return normalized.startsWith(path.resolve(projectRoot));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function extractFile(filePath, projectRoot, content) {
|
|
55
|
+
const language = (0, import_languages.detectLanguage)(filePath);
|
|
56
|
+
if (!(0, import_languages.isSupportedLanguage)(language)) return null;
|
|
57
|
+
if (!validatePath(filePath, projectRoot)) return null;
|
|
58
|
+
let source;
|
|
59
|
+
try {
|
|
60
|
+
if (content !== void 0) {
|
|
61
|
+
source = typeof content === "string" ? content : content.toString("utf8");
|
|
62
|
+
} else {
|
|
63
|
+
source = fs.readFileSync(filePath, "utf8");
|
|
64
|
+
}
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const contentHash = crypto.createHash("sha256").update(source).digest("hex");
|
|
69
|
+
const fileSize = Buffer.byteLength(source, "utf8");
|
|
70
|
+
const relPath = path.relative(projectRoot, filePath).replace(/\\/g, "/");
|
|
71
|
+
await (0, import_grammars.initGrammars)();
|
|
72
|
+
const parser = await (0, import_grammars.getParser)(language);
|
|
73
|
+
if (!parser) {
|
|
74
|
+
if (!(0, import_grammars.hasWasmGrammar)(language)) {
|
|
75
|
+
return {
|
|
76
|
+
filePath: relPath,
|
|
77
|
+
language,
|
|
78
|
+
contentHash,
|
|
79
|
+
fileSize,
|
|
80
|
+
nodes: [],
|
|
81
|
+
edges: [],
|
|
82
|
+
unresolvedRefs: []
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
throw new Error(`Parser unavailable for ${language} (WASM grammar exists but failed to load)`);
|
|
86
|
+
}
|
|
87
|
+
const tree = parser.parse(source);
|
|
88
|
+
const nodes = [];
|
|
89
|
+
const edges = [];
|
|
90
|
+
const unresolvedRefs = [];
|
|
91
|
+
const now = Date.now();
|
|
92
|
+
walkTree(tree.rootNode, source, relPath, language, nodes, edges, unresolvedRefs, now);
|
|
93
|
+
return { filePath: relPath, language, contentHash, fileSize, nodes, edges, unresolvedRefs };
|
|
94
|
+
}
|
|
95
|
+
const ELIXIR_DEF_KINDS = {
|
|
96
|
+
defmodule: "module",
|
|
97
|
+
def: "function",
|
|
98
|
+
defp: "function",
|
|
99
|
+
defmacro: "function",
|
|
100
|
+
defmacrop: "function",
|
|
101
|
+
defprotocol: "interface",
|
|
102
|
+
defimpl: "class",
|
|
103
|
+
defstruct: "struct"
|
|
104
|
+
};
|
|
105
|
+
const ELIXIR_IMPORT_TARGETS = /* @__PURE__ */ new Set(["alias", "import", "require", "use"]);
|
|
106
|
+
function elixirCallTarget(node, source) {
|
|
107
|
+
const target = node.childForFieldName?.("target") ?? node.child(0);
|
|
108
|
+
if (!target) return null;
|
|
109
|
+
return source.slice(target.startIndex, target.endIndex).trim() || null;
|
|
110
|
+
}
|
|
111
|
+
function elixirFirstArg(node) {
|
|
112
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
113
|
+
const child = node.child(i);
|
|
114
|
+
if (child.type === "arguments") {
|
|
115
|
+
return child.namedChild(0) ?? child.child(0) ?? null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
function extractElixirName(node, source, kind) {
|
|
121
|
+
const firstArg = elixirFirstArg(node);
|
|
122
|
+
if (!firstArg) return null;
|
|
123
|
+
if (kind === "module" || kind === "interface" || kind === "class") {
|
|
124
|
+
return source.slice(firstArg.startIndex, firstArg.endIndex).trim();
|
|
125
|
+
}
|
|
126
|
+
if (kind === "function") {
|
|
127
|
+
if (firstArg.type === "call") {
|
|
128
|
+
const nameNode = firstArg.childForFieldName?.("target") ?? firstArg.child(0);
|
|
129
|
+
if (nameNode) return source.slice(nameNode.startIndex, nameNode.endIndex).trim();
|
|
130
|
+
}
|
|
131
|
+
return source.slice(firstArg.startIndex, firstArg.endIndex).trim();
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
function extractElixirImportSource(node, source) {
|
|
136
|
+
const firstArg = elixirFirstArg(node);
|
|
137
|
+
if (!firstArg) return null;
|
|
138
|
+
return source.slice(firstArg.startIndex, firstArg.endIndex).trim() || null;
|
|
139
|
+
}
|
|
140
|
+
function walkElixirCall(node, source, filePath, language, nodes, edges, unresolvedRefs, now, parentId) {
|
|
141
|
+
const targetText = elixirCallTarget(node, source);
|
|
142
|
+
if (!targetText) {
|
|
143
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
144
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, parentId);
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (ELIXIR_IMPORT_TARGETS.has(targetText)) {
|
|
149
|
+
const modPath = extractElixirImportSource(node, source);
|
|
150
|
+
if (modPath) {
|
|
151
|
+
const id = makeNodeId(filePath, "import", modPath, node.startPosition.row + 1);
|
|
152
|
+
nodes.push({
|
|
153
|
+
id,
|
|
154
|
+
kind: "import",
|
|
155
|
+
name: modPath,
|
|
156
|
+
qualifiedName: `${filePath}::import:${modPath}`,
|
|
157
|
+
filePath,
|
|
158
|
+
language,
|
|
159
|
+
startLine: node.startPosition.row + 1,
|
|
160
|
+
endLine: node.endPosition.row + 1,
|
|
161
|
+
startColumn: node.startPosition.column,
|
|
162
|
+
endColumn: node.endPosition.column,
|
|
163
|
+
updatedAt: now
|
|
164
|
+
});
|
|
165
|
+
unresolvedRefs.push({ sourceId: id, refName: modPath, refKind: "import", line: node.startPosition.row + 1, column: node.startPosition.column });
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const defKind = ELIXIR_DEF_KINDS[targetText];
|
|
170
|
+
if (defKind) {
|
|
171
|
+
const name = extractElixirName(node, source, defKind);
|
|
172
|
+
if (name) {
|
|
173
|
+
const id = makeNodeId(filePath, defKind, name, node.startPosition.row + 1);
|
|
174
|
+
const isPrivate = targetText === "defp" || targetText === "defmacrop";
|
|
175
|
+
nodes.push({
|
|
176
|
+
id,
|
|
177
|
+
kind: defKind,
|
|
178
|
+
name,
|
|
179
|
+
qualifiedName: `${filePath}::${name}`,
|
|
180
|
+
filePath,
|
|
181
|
+
language,
|
|
182
|
+
startLine: node.startPosition.row + 1,
|
|
183
|
+
endLine: node.endPosition.row + 1,
|
|
184
|
+
startColumn: node.startPosition.column,
|
|
185
|
+
endColumn: node.endPosition.column,
|
|
186
|
+
docstring: extractDocstring(node, source),
|
|
187
|
+
signature: extractSignature(node, source, defKind),
|
|
188
|
+
visibility: isPrivate ? "private" : "public",
|
|
189
|
+
isExported: !isPrivate,
|
|
190
|
+
updatedAt: now
|
|
191
|
+
});
|
|
192
|
+
if (parentId) edges.push({ source: parentId, target: id, kind: "contains" });
|
|
193
|
+
collectCallRefs(node, source, id, unresolvedRefs);
|
|
194
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
195
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, id);
|
|
196
|
+
}
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
201
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, parentId);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const TRANSPARENT_TYPES = /* @__PURE__ */ new Set([
|
|
205
|
+
"export_statement",
|
|
206
|
+
"program",
|
|
207
|
+
"source_file",
|
|
208
|
+
"module",
|
|
209
|
+
"translation_unit"
|
|
210
|
+
]);
|
|
211
|
+
const KIND_MAP = {
|
|
212
|
+
// Functions
|
|
213
|
+
function_declaration: "function",
|
|
214
|
+
function_expression: "function",
|
|
215
|
+
arrow_function: "function",
|
|
216
|
+
function_definition: "function",
|
|
217
|
+
// Python
|
|
218
|
+
function_item: "function",
|
|
219
|
+
// Rust
|
|
220
|
+
function_declaration_go: "function",
|
|
221
|
+
// Methods
|
|
222
|
+
method_definition: "method",
|
|
223
|
+
method_declaration: "method",
|
|
224
|
+
// Go, Java, C#
|
|
225
|
+
constructor_declaration: "method",
|
|
226
|
+
// Java, C#
|
|
227
|
+
// Classes / structs
|
|
228
|
+
class_declaration: "class",
|
|
229
|
+
class_expression: "class",
|
|
230
|
+
class_definition: "class",
|
|
231
|
+
// Python
|
|
232
|
+
impl_item: "class",
|
|
233
|
+
// Rust (impl blocks)
|
|
234
|
+
struct_item: "struct",
|
|
235
|
+
// Rust
|
|
236
|
+
// Interfaces / traits
|
|
237
|
+
interface_declaration: "interface",
|
|
238
|
+
trait_item: "trait",
|
|
239
|
+
// Rust
|
|
240
|
+
protocol_declaration: "interface",
|
|
241
|
+
// Swift
|
|
242
|
+
// Enums
|
|
243
|
+
enum_declaration: "enum",
|
|
244
|
+
enum_item: "enum",
|
|
245
|
+
// Rust
|
|
246
|
+
// Type aliases
|
|
247
|
+
type_alias_declaration: "type_alias",
|
|
248
|
+
type_declaration: "type_alias",
|
|
249
|
+
// Go
|
|
250
|
+
typealias_declaration: "type_alias",
|
|
251
|
+
// Swift
|
|
252
|
+
type_item: "type_alias",
|
|
253
|
+
// Rust
|
|
254
|
+
type_alias: "type_alias",
|
|
255
|
+
// Kotlin
|
|
256
|
+
// Namespaces / modules
|
|
257
|
+
namespace_declaration: "namespace",
|
|
258
|
+
// Variables / constants (language-specific, see extractVariableKind)
|
|
259
|
+
lexical_declaration: "variable",
|
|
260
|
+
// TS/JS (const/let/var) — refined below
|
|
261
|
+
variable_declaration: "variable"
|
|
262
|
+
// TS/JS (var)
|
|
263
|
+
// Import statements (all handled via extractImport)
|
|
264
|
+
};
|
|
265
|
+
function extractVariableKind(node) {
|
|
266
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
267
|
+
const child = node.child(i);
|
|
268
|
+
if (child.type === "const") return "constant";
|
|
269
|
+
}
|
|
270
|
+
return "variable";
|
|
271
|
+
}
|
|
272
|
+
const IMPORT_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
273
|
+
"import_statement",
|
|
274
|
+
// TS/JS
|
|
275
|
+
"import_from_statement",
|
|
276
|
+
// Python
|
|
277
|
+
"import_declaration",
|
|
278
|
+
// Go, Java
|
|
279
|
+
"use_declaration",
|
|
280
|
+
// Rust
|
|
281
|
+
"using_directive",
|
|
282
|
+
// C#
|
|
283
|
+
"namespace_use_declaration",
|
|
284
|
+
// PHP
|
|
285
|
+
"import_header",
|
|
286
|
+
// Kotlin
|
|
287
|
+
"import_or_export",
|
|
288
|
+
// Dart
|
|
289
|
+
"include_statement",
|
|
290
|
+
// Pascal
|
|
291
|
+
"preproc_include"
|
|
292
|
+
// C/C++
|
|
293
|
+
]);
|
|
294
|
+
function walkTree(node, source, filePath, language, nodes, edges, unresolvedRefs, now, parentId) {
|
|
295
|
+
if (TRANSPARENT_TYPES.has(node.type)) {
|
|
296
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
297
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, parentId);
|
|
298
|
+
}
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (language === "elixir" && node.type === "call") {
|
|
302
|
+
walkElixirCall(node, source, filePath, language, nodes, edges, unresolvedRefs, now, parentId);
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
if (IMPORT_NODE_TYPES.has(node.type)) {
|
|
306
|
+
const importNode = extractImport(node, source, filePath, language, unresolvedRefs, now, parentId);
|
|
307
|
+
if (importNode) nodes.push(importNode);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
let kind = KIND_MAP[node.type] ?? null;
|
|
311
|
+
if (node.type === "lexical_declaration" || node.type === "variable_declaration") {
|
|
312
|
+
kind = extractVariableKind(node);
|
|
313
|
+
}
|
|
314
|
+
if (!kind) kind = getLanguageSpecificKind(node.type, language);
|
|
315
|
+
if (kind) {
|
|
316
|
+
const name = extractName(node, source, language, kind);
|
|
317
|
+
if (name) {
|
|
318
|
+
const id = makeNodeId(filePath, kind, name, node.startPosition.row + 1);
|
|
319
|
+
const visibility = extractVisibility(node, source, language);
|
|
320
|
+
const graphNode = {
|
|
321
|
+
id,
|
|
322
|
+
kind,
|
|
323
|
+
name,
|
|
324
|
+
qualifiedName: `${filePath}::${name}`,
|
|
325
|
+
filePath,
|
|
326
|
+
language,
|
|
327
|
+
startLine: node.startPosition.row + 1,
|
|
328
|
+
endLine: node.endPosition.row + 1,
|
|
329
|
+
startColumn: node.startPosition.column,
|
|
330
|
+
endColumn: node.endPosition.column,
|
|
331
|
+
docstring: extractDocstring(node, source),
|
|
332
|
+
signature: extractSignature(node, source, kind),
|
|
333
|
+
visibility,
|
|
334
|
+
isExported: isExported(node),
|
|
335
|
+
isAsync: isAsync(node),
|
|
336
|
+
isStatic: isStatic(node),
|
|
337
|
+
updatedAt: now
|
|
338
|
+
};
|
|
339
|
+
nodes.push(graphNode);
|
|
340
|
+
if (parentId) {
|
|
341
|
+
edges.push({ source: parentId, target: id, kind: "contains" });
|
|
342
|
+
}
|
|
343
|
+
collectCallRefs(node, source, id, unresolvedRefs);
|
|
344
|
+
if ((kind === "class" || kind === "interface") && (language === "csharp" || language === "java")) {
|
|
345
|
+
extractInheritance(node, source, language, id, unresolvedRefs);
|
|
346
|
+
}
|
|
347
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
348
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, id);
|
|
349
|
+
}
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
354
|
+
walkTree(node.child(i), source, filePath, language, nodes, edges, unresolvedRefs, now, parentId);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function getLanguageSpecificKind(type, lang) {
|
|
358
|
+
switch (lang) {
|
|
359
|
+
case "python":
|
|
360
|
+
if (type === "assignment") return "variable";
|
|
361
|
+
break;
|
|
362
|
+
case "go":
|
|
363
|
+
if (type === "var_declaration" || type === "short_var_declaration") return "variable";
|
|
364
|
+
if (type === "const_declaration") return "constant";
|
|
365
|
+
if (type === "type_spec") return "type_alias";
|
|
366
|
+
break;
|
|
367
|
+
case "rust":
|
|
368
|
+
if (type === "let_declaration") return "variable";
|
|
369
|
+
if (type === "const_item") return "constant";
|
|
370
|
+
if (type === "static_item") return "variable";
|
|
371
|
+
break;
|
|
372
|
+
case "java":
|
|
373
|
+
if (type === "field_declaration") return "property";
|
|
374
|
+
if (type === "local_variable_declaration") return "variable";
|
|
375
|
+
break;
|
|
376
|
+
case "csharp":
|
|
377
|
+
if (type === "field_declaration") return "property";
|
|
378
|
+
break;
|
|
379
|
+
case "php":
|
|
380
|
+
if (type === "property_declaration") return "property";
|
|
381
|
+
if (type === "const_declaration") return "constant";
|
|
382
|
+
break;
|
|
383
|
+
case "kotlin":
|
|
384
|
+
if (type === "property_declaration") return "variable";
|
|
385
|
+
break;
|
|
386
|
+
case "swift":
|
|
387
|
+
if (type === "property_declaration") return "property";
|
|
388
|
+
if (type === "constant_declaration") return "constant";
|
|
389
|
+
break;
|
|
390
|
+
case "dart":
|
|
391
|
+
if (type === "function_signature") return "function";
|
|
392
|
+
if (type === "method_signature") return "method";
|
|
393
|
+
break;
|
|
394
|
+
case "ruby":
|
|
395
|
+
if (type === "singleton_method") return "method";
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
function extractImport(node, source, filePath, language, unresolvedRefs, now, parentId) {
|
|
401
|
+
const modulePath = extractImportSource(node, source, language);
|
|
402
|
+
if (!modulePath) return null;
|
|
403
|
+
const id = makeNodeId(filePath, "import", modulePath, node.startPosition.row + 1);
|
|
404
|
+
const importNode = {
|
|
405
|
+
id,
|
|
406
|
+
kind: "import",
|
|
407
|
+
name: modulePath,
|
|
408
|
+
qualifiedName: `${filePath}::import:${modulePath}`,
|
|
409
|
+
filePath,
|
|
410
|
+
language,
|
|
411
|
+
startLine: node.startPosition.row + 1,
|
|
412
|
+
endLine: node.endPosition.row + 1,
|
|
413
|
+
startColumn: node.startPosition.column,
|
|
414
|
+
endColumn: node.endPosition.column,
|
|
415
|
+
updatedAt: now
|
|
416
|
+
};
|
|
417
|
+
unresolvedRefs.push({
|
|
418
|
+
sourceId: id,
|
|
419
|
+
refName: modulePath,
|
|
420
|
+
refKind: "import",
|
|
421
|
+
line: node.startPosition.row + 1,
|
|
422
|
+
column: node.startPosition.column
|
|
423
|
+
});
|
|
424
|
+
return importNode;
|
|
425
|
+
}
|
|
426
|
+
function extractImportSource(node, source, language) {
|
|
427
|
+
if (node.type === "import_statement" || language === "svelte" && node.type === "import_statement") {
|
|
428
|
+
for (let i = node.childCount - 1; i >= 0; i--) {
|
|
429
|
+
const child = node.child(i);
|
|
430
|
+
if (child.type === "string") {
|
|
431
|
+
return stripQuotes(source.slice(child.startIndex, child.endIndex));
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (node.type === "import_from_statement") {
|
|
436
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
437
|
+
const child = node.child(i);
|
|
438
|
+
if (child.type === "dotted_name" || child.type === "relative_import") {
|
|
439
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
if (node.type === "import_statement" && language === "python") {
|
|
444
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
445
|
+
const child = node.child(i);
|
|
446
|
+
if (child.type === "dotted_name") {
|
|
447
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (node.type === "import_declaration") {
|
|
452
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
453
|
+
const child = node.child(i);
|
|
454
|
+
if (child.type === "string") {
|
|
455
|
+
return stripQuotes(source.slice(child.startIndex, child.endIndex));
|
|
456
|
+
}
|
|
457
|
+
if (child.type === "import_spec_list") {
|
|
458
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
459
|
+
const spec = child.child(j);
|
|
460
|
+
if (spec.type === "import_spec") {
|
|
461
|
+
for (let k = 0; k < spec.childCount; k++) {
|
|
462
|
+
const s = spec.child(k);
|
|
463
|
+
if (s.type === "string") return stripQuotes(source.slice(s.startIndex, s.endIndex));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (node.type === "use_declaration") {
|
|
471
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
472
|
+
const child = node.child(i);
|
|
473
|
+
if (child.type !== "use" && child.type !== ";") {
|
|
474
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (node.type === "using_directive") {
|
|
479
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
480
|
+
const child = node.child(i);
|
|
481
|
+
if (child.type === "qualified_name" || child.type === "identifier") {
|
|
482
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
if (node.type === "import_declaration" || node.type === "import_header") {
|
|
487
|
+
const text = source.slice(node.startIndex, node.endIndex).trim();
|
|
488
|
+
const m = text.match(/^import\s+(.+?)[;\s*]*$/);
|
|
489
|
+
if (m) return m[1].trim();
|
|
490
|
+
}
|
|
491
|
+
if (node.type === "namespace_use_declaration") {
|
|
492
|
+
const text = source.slice(node.startIndex, node.endIndex).trim();
|
|
493
|
+
const m = text.match(/^use\s+(.+?)[;\s]*$/);
|
|
494
|
+
if (m) return m[1].trim();
|
|
495
|
+
}
|
|
496
|
+
if (node.type === "import_declaration" || node.type === "import_or_export") {
|
|
497
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
498
|
+
const child = node.child(i);
|
|
499
|
+
if (child.type === "identifier" || child.type === "string") {
|
|
500
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
if (node.type === "preproc_include") {
|
|
505
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
506
|
+
const child = node.child(i);
|
|
507
|
+
if (child.type === "string_literal" || child.type === "system_lib_string") {
|
|
508
|
+
return source.slice(child.startIndex, child.endIndex).replace(/[<>"]/g, "");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
function stripQuotes(s) {
|
|
515
|
+
return s.replace(/^['"`]|['"`]$/g, "");
|
|
516
|
+
}
|
|
517
|
+
function extractName(node, source, _lang, kind) {
|
|
518
|
+
if (kind === "variable" || kind === "constant") {
|
|
519
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
520
|
+
const child = node.child(i);
|
|
521
|
+
if (child.type === "variable_declarator") {
|
|
522
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
523
|
+
const gc = child.child(j);
|
|
524
|
+
if (gc.type === "identifier") return source.slice(gc.startIndex, gc.endIndex);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
530
|
+
const child = node.child(i);
|
|
531
|
+
if (child.type === "var_spec" || child.type === "const_spec") {
|
|
532
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
533
|
+
const gc = child.child(j);
|
|
534
|
+
if (gc.type === "identifier") return source.slice(gc.startIndex, gc.endIndex);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
539
|
+
const child = node.child(i);
|
|
540
|
+
if (child.type === "identifier" || child.type === "property_identifier" || child.type === "type_identifier") {
|
|
541
|
+
return source.slice(child.startIndex, child.endIndex);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
if (node.type === "assignment") {
|
|
545
|
+
const left = node.child(0);
|
|
546
|
+
if (left && left.type === "identifier") {
|
|
547
|
+
return source.slice(left.startIndex, left.endIndex);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return null;
|
|
551
|
+
}
|
|
552
|
+
function extractSignature(node, source, kind) {
|
|
553
|
+
if (kind === "function" || kind === "method") {
|
|
554
|
+
const text2 = source.slice(node.startIndex, node.endIndex);
|
|
555
|
+
const bodyStart = text2.search(/\s*[\{:]\s*\n|=>|{/);
|
|
556
|
+
const header = bodyStart > 0 ? text2.slice(0, bodyStart).trim() : text2.split("\n")[0].trim();
|
|
557
|
+
return header.length > 150 ? header.slice(0, 150) + "\u2026" : header || void 0;
|
|
558
|
+
}
|
|
559
|
+
const text = source.slice(node.startIndex, node.endIndex);
|
|
560
|
+
const firstLine = text.split("\n")[0].trim();
|
|
561
|
+
return firstLine.length > 120 ? firstLine.slice(0, 120) + "\u2026" : firstLine || void 0;
|
|
562
|
+
}
|
|
563
|
+
function extractVisibility(node, source, language) {
|
|
564
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
565
|
+
const child = node.child(i);
|
|
566
|
+
if (child.type === "accessibility_modifier") {
|
|
567
|
+
const mod = source.slice(child.startIndex, child.endIndex);
|
|
568
|
+
if (mod === "public") return "public";
|
|
569
|
+
if (mod === "private") return "private";
|
|
570
|
+
if (mod === "protected") return "protected";
|
|
571
|
+
}
|
|
572
|
+
if (child.type === "public") return "public";
|
|
573
|
+
if (child.type === "private") return "private";
|
|
574
|
+
if (child.type === "protected") return "protected";
|
|
575
|
+
if (child.type === "internal") return "internal";
|
|
576
|
+
}
|
|
577
|
+
if (language === "rust") {
|
|
578
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
579
|
+
const child = node.child(i);
|
|
580
|
+
if (child.type === "visibility_modifier") {
|
|
581
|
+
const v = source.slice(child.startIndex, child.endIndex);
|
|
582
|
+
return v.startsWith("pub") ? "public" : "private";
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return "private";
|
|
586
|
+
}
|
|
587
|
+
if (language === "csharp") return "private";
|
|
588
|
+
if (language === "php") return "public";
|
|
589
|
+
if (language === "swift") {
|
|
590
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
591
|
+
const child = node.child(i);
|
|
592
|
+
const t = child.type;
|
|
593
|
+
if (t === "fileprivate") return "private";
|
|
594
|
+
}
|
|
595
|
+
return "internal";
|
|
596
|
+
}
|
|
597
|
+
if (language === "python") {
|
|
598
|
+
const name = extractName(node, source, language, "function");
|
|
599
|
+
if (name?.startsWith("_") && !name.startsWith("__")) return "protected";
|
|
600
|
+
if (name?.startsWith("__")) return "private";
|
|
601
|
+
return "public";
|
|
602
|
+
}
|
|
603
|
+
return void 0;
|
|
604
|
+
}
|
|
605
|
+
function extractDocstring(node, source) {
|
|
606
|
+
const commentTypes = /* @__PURE__ */ new Set(["comment", "block_comment", "line_comment", "documentation_comment"]);
|
|
607
|
+
const commentLines = [];
|
|
608
|
+
let sibling = node.previousNamedSibling;
|
|
609
|
+
while (sibling && commentTypes.has(sibling.type)) {
|
|
610
|
+
commentLines.unshift(source.slice(sibling.startIndex, sibling.endIndex));
|
|
611
|
+
sibling = sibling.previousNamedSibling;
|
|
612
|
+
}
|
|
613
|
+
if (commentLines.length === 0) return void 0;
|
|
614
|
+
const cleaned = commentLines.join("\n").replace(/^\/\*+\s*/gm, "").replace(/\s*\*+\/\s*$/gm, "").replace(/^\s*\*\s?/gm, "").replace(/^\/\/\s?/gm, "").trim();
|
|
615
|
+
return cleaned.length > 0 ? cleaned : void 0;
|
|
616
|
+
}
|
|
617
|
+
function isExported(node) {
|
|
618
|
+
let current = node.parent;
|
|
619
|
+
while (current) {
|
|
620
|
+
if (current.type === "export_statement") return true;
|
|
621
|
+
if (current.type === "function_body" || current.type === "class_body" || current.type === "statement_block") break;
|
|
622
|
+
current = current.parent;
|
|
623
|
+
}
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
function isAsync(node) {
|
|
627
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
628
|
+
if (node.child(i).type === "async") return true;
|
|
629
|
+
}
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
632
|
+
function isStatic(node) {
|
|
633
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
634
|
+
if (node.child(i).type === "static") return true;
|
|
635
|
+
}
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
const CALL_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
639
|
+
"call_expression",
|
|
640
|
+
// JS/TS/Go/Rust/Swift/Kotlin/Dart/C/C++
|
|
641
|
+
"invocation_expression",
|
|
642
|
+
// C#
|
|
643
|
+
"method_invocation",
|
|
644
|
+
// Java
|
|
645
|
+
"call",
|
|
646
|
+
// Python/Ruby/Elixir (function calls in bodies)
|
|
647
|
+
"function_call_expression"
|
|
648
|
+
// PHP
|
|
649
|
+
]);
|
|
650
|
+
function extractCallName(node, source) {
|
|
651
|
+
for (const field of ["name", "method", "function", "target"]) {
|
|
652
|
+
const f = node.childForFieldName?.(field);
|
|
653
|
+
if (f) {
|
|
654
|
+
const t = f.type;
|
|
655
|
+
if (t === "identifier" || t === "name" || t === "property_identifier" || t === "type_identifier") {
|
|
656
|
+
const text = source.slice(f.startIndex, f.endIndex).trim();
|
|
657
|
+
if (text && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(text)) return text;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
const funcNode = node.child(0);
|
|
662
|
+
if (funcNode) {
|
|
663
|
+
const rawName = source.slice(funcNode.startIndex, funcNode.endIndex).split("(")[0].trim();
|
|
664
|
+
if (rawName && rawName.length < 100) {
|
|
665
|
+
const calleeName = rawName.split(".").pop().trim();
|
|
666
|
+
if (calleeName && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(calleeName)) return calleeName;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return null;
|
|
670
|
+
}
|
|
671
|
+
function collectCallRefs(node, source, sourceId, unresolvedRefs) {
|
|
672
|
+
walkForCalls(node, source, sourceId, unresolvedRefs);
|
|
673
|
+
}
|
|
674
|
+
function walkForCalls(node, source, sourceId, unresolvedRefs) {
|
|
675
|
+
if (CALL_NODE_TYPES.has(node.type)) {
|
|
676
|
+
const calleeName = extractCallName(node, source);
|
|
677
|
+
if (calleeName) {
|
|
678
|
+
unresolvedRefs.push({
|
|
679
|
+
sourceId,
|
|
680
|
+
refName: calleeName,
|
|
681
|
+
refKind: "function",
|
|
682
|
+
line: node.startPosition.row + 1,
|
|
683
|
+
column: node.startPosition.column
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
688
|
+
walkForCalls(node.child(i), source, sourceId, unresolvedRefs);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function extractTypeName(node, source) {
|
|
692
|
+
const t = node.type;
|
|
693
|
+
if (t === "identifier" || t === "type_identifier" || t === "name") {
|
|
694
|
+
return source.slice(node.startIndex, node.endIndex).trim() || null;
|
|
695
|
+
}
|
|
696
|
+
if (t === "qualified_name" || t === "generic_name" || t === "scoped_type_identifier") {
|
|
697
|
+
for (let i = node.childCount - 1; i >= 0; i--) {
|
|
698
|
+
const child = node.child(i);
|
|
699
|
+
if (child.type === "identifier" || child.type === "type_identifier" || child.type === "name") {
|
|
700
|
+
return source.slice(child.startIndex, child.endIndex).trim() || null;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
function extractInheritance(node, source, language, classNodeId, unresolvedRefs) {
|
|
707
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
708
|
+
const child = node.child(i);
|
|
709
|
+
if (language === "csharp" && child.type === "base_list") {
|
|
710
|
+
for (let j = 0; j < child.childCount; j++) {
|
|
711
|
+
const item = child.child(j);
|
|
712
|
+
const name = extractTypeName(item, source);
|
|
713
|
+
if (name) {
|
|
714
|
+
unresolvedRefs.push({
|
|
715
|
+
sourceId: classNodeId,
|
|
716
|
+
refName: name,
|
|
717
|
+
// In C# both classes and interfaces appear in the same base_list;
|
|
718
|
+
// we emit 'extends' for all — the resolver maps it to the extends edge
|
|
719
|
+
// which covers both parent classes and parent interfaces structurally.
|
|
720
|
+
refKind: "extends",
|
|
721
|
+
line: item.startPosition.row + 1,
|
|
722
|
+
column: item.startPosition.column
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (language === "java") {
|
|
728
|
+
if (child.type === "superclass") {
|
|
729
|
+
const typeNode = child.namedChild?.(0);
|
|
730
|
+
if (typeNode) {
|
|
731
|
+
const name = extractTypeName(typeNode, source);
|
|
732
|
+
if (name) unresolvedRefs.push({ sourceId: classNodeId, refName: name, refKind: "extends", line: child.startPosition.row + 1, column: child.startPosition.column });
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
if (child.type === "super_interfaces" || child.type === "extends_interfaces") {
|
|
736
|
+
const typeList = child.namedChild?.(0);
|
|
737
|
+
if (typeList) {
|
|
738
|
+
const count = typeList.namedChildCount ?? 0;
|
|
739
|
+
for (let j = 0; j < count; j++) {
|
|
740
|
+
const typeNode = typeList.namedChild(j);
|
|
741
|
+
if (typeNode) {
|
|
742
|
+
const name = extractTypeName(typeNode, source);
|
|
743
|
+
if (name) {
|
|
744
|
+
unresolvedRefs.push({
|
|
745
|
+
sourceId: classNodeId,
|
|
746
|
+
refName: name,
|
|
747
|
+
refKind: child.type === "extends_interfaces" ? "extends" : "implements",
|
|
748
|
+
line: typeNode.startPosition.row + 1,
|
|
749
|
+
column: typeNode.startPosition.column
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
760
|
+
0 && (module.exports = {
|
|
761
|
+
extractFile,
|
|
762
|
+
makeNodeId
|
|
763
|
+
});
|
|
764
|
+
//# sourceMappingURL=extractor.js.map
|