codesift-mcp 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/cli/commands-admin.d.ts +18 -0
- package/dist/cli/commands-admin.d.ts.map +1 -0
- package/dist/cli/commands-admin.js +187 -0
- package/dist/cli/commands-admin.js.map +1 -0
- package/dist/cli/commands-daemon.d.ts +42 -0
- package/dist/cli/commands-daemon.d.ts.map +1 -0
- package/dist/cli/commands-daemon.js +163 -0
- package/dist/cli/commands-daemon.js.map +1 -0
- package/dist/cli/commands-index.d.ts +12 -0
- package/dist/cli/commands-index.d.ts.map +1 -0
- package/dist/cli/commands-index.js +133 -0
- package/dist/cli/commands-index.js.map +1 -0
- package/dist/cli/commands-maintenance.d.ts +12 -0
- package/dist/cli/commands-maintenance.d.ts.map +1 -0
- package/dist/cli/commands-maintenance.js +409 -0
- package/dist/cli/commands-maintenance.js.map +1 -0
- package/dist/cli/commands-query.d.ts +21 -0
- package/dist/cli/commands-query.d.ts.map +1 -0
- package/dist/cli/commands-query.js +270 -0
- package/dist/cli/commands-query.js.map +1 -0
- package/dist/cli/commands.d.ts +2 -36
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +8 -867
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/embed-child.js +13 -2
- package/dist/cli/embed-child.js.map +1 -1
- package/dist/instructions.d.ts +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +5 -2
- package/dist/instructions.js.map +1 -1
- package/dist/parser/extractors/php-class-metadata.d.ts +10 -0
- package/dist/parser/extractors/php-class-metadata.d.ts.map +1 -0
- package/dist/parser/extractors/php-class-metadata.js +65 -0
- package/dist/parser/extractors/php-class-metadata.js.map +1 -0
- package/dist/parser/extractors/php-doc.d.ts +13 -0
- package/dist/parser/extractors/php-doc.d.ts.map +1 -0
- package/dist/parser/extractors/php-doc.js +39 -0
- package/dist/parser/extractors/php-doc.js.map +1 -0
- package/dist/parser/extractors/php-node-metadata.d.ts +26 -0
- package/dist/parser/extractors/php-node-metadata.d.ts.map +1 -0
- package/dist/parser/extractors/php-node-metadata.js +132 -0
- package/dist/parser/extractors/php-node-metadata.js.map +1 -0
- package/dist/parser/extractors/php-symbol-builders.d.ts +13 -0
- package/dist/parser/extractors/php-symbol-builders.d.ts.map +1 -0
- package/dist/parser/extractors/php-symbol-builders.js +58 -0
- package/dist/parser/extractors/php-symbol-builders.js.map +1 -0
- package/dist/parser/extractors/php-walker.d.ts +4 -0
- package/dist/parser/extractors/php-walker.d.ts.map +1 -0
- package/dist/parser/extractors/php-walker.js +238 -0
- package/dist/parser/extractors/php-walker.js.map +1 -0
- package/dist/parser/extractors/php.d.ts +2 -33
- package/dist/parser/extractors/php.d.ts.map +1 -1
- package/dist/parser/extractors/php.js +2 -747
- package/dist/parser/extractors/php.js.map +1 -1
- package/dist/register-tool-loaders.d.ts +11 -11
- package/dist/register-tool-loaders.d.ts.map +1 -1
- package/dist/register-tools/runtime.d.ts +11 -0
- package/dist/register-tools/runtime.d.ts.map +1 -1
- package/dist/register-tools/runtime.js +40 -0
- package/dist/register-tools/runtime.js.map +1 -1
- package/dist/register-tools.d.ts.map +1 -1
- package/dist/register-tools.js +5 -1
- package/dist/register-tools.js.map +1 -1
- package/dist/retrieval/semantic-handlers.d.ts.map +1 -1
- package/dist/retrieval/semantic-handlers.js +10 -3
- package/dist/retrieval/semantic-handlers.js.map +1 -1
- package/dist/search/semantic.d.ts +2 -0
- package/dist/search/semantic.d.ts.map +1 -1
- package/dist/search/semantic.js +41 -9
- package/dist/search/semantic.js.map +1 -1
- package/dist/storage/chunk-store.d.ts +14 -2
- package/dist/storage/chunk-store.d.ts.map +1 -1
- package/dist/storage/chunk-store.js +214 -34
- package/dist/storage/chunk-store.js.map +1 -1
- package/dist/storage/embedding-store.d.ts +0 -12
- package/dist/storage/embedding-store.d.ts.map +1 -1
- package/dist/storage/embedding-store.js +69 -9
- package/dist/storage/embedding-store.js.map +1 -1
- package/dist/storage/index-cache.d.ts +12 -0
- package/dist/storage/index-cache.d.ts.map +1 -0
- package/dist/storage/index-cache.js +89 -0
- package/dist/storage/index-cache.js.map +1 -0
- package/dist/storage/index-json-mutations.d.ts +11 -0
- package/dist/storage/index-json-mutations.d.ts.map +1 -0
- package/dist/storage/index-json-mutations.js +93 -0
- package/dist/storage/index-json-mutations.js.map +1 -0
- package/dist/storage/index-migration.d.ts +22 -0
- package/dist/storage/index-migration.d.ts.map +1 -0
- package/dist/storage/index-migration.js +80 -0
- package/dist/storage/index-migration.js.map +1 -0
- package/dist/storage/index-store.d.ts +5 -61
- package/dist/storage/index-store.d.ts.map +1 -1
- package/dist/storage/index-store.js +33 -414
- package/dist/storage/index-store.js.map +1 -1
- package/dist/storage/index-version.d.ts +39 -0
- package/dist/storage/index-version.d.ts.map +1 -0
- package/dist/storage/index-version.js +87 -0
- package/dist/storage/index-version.js.map +1 -0
- package/dist/storage/registry.d.ts +9 -1
- package/dist/storage/registry.d.ts.map +1 -1
- package/dist/storage/registry.js +169 -8
- package/dist/storage/registry.js.map +1 -1
- package/dist/storage/shared-embedding-cache.d.ts +23 -3
- package/dist/storage/shared-embedding-cache.d.ts.map +1 -1
- package/dist/storage/shared-embedding-cache.js +300 -45
- package/dist/storage/shared-embedding-cache.js.map +1 -1
- package/dist/storage/telemetry/config.d.ts.map +1 -1
- package/dist/storage/telemetry/config.js +3 -2
- package/dist/storage/telemetry/config.js.map +1 -1
- package/dist/storage/telemetry/retro-aggregator.d.ts +21 -0
- package/dist/storage/telemetry/retro-aggregator.d.ts.map +1 -1
- package/dist/storage/telemetry/retro-aggregator.js +58 -16
- package/dist/storage/telemetry/retro-aggregator.js.map +1 -1
- package/dist/storage/telemetry/sanitizer.d.ts +16 -0
- package/dist/storage/telemetry/sanitizer.d.ts.map +1 -1
- package/dist/storage/telemetry/sanitizer.js +2 -0
- package/dist/storage/telemetry/sanitizer.js.map +1 -1
- package/dist/storage/telemetry/uploader.d.ts +3 -1
- package/dist/storage/telemetry/uploader.d.ts.map +1 -1
- package/dist/storage/telemetry/uploader.js +158 -21
- package/dist/storage/telemetry/uploader.js.map +1 -1
- package/dist/tools/cross-repo-contract-adapters.d.ts +39 -0
- package/dist/tools/cross-repo-contract-adapters.d.ts.map +1 -0
- package/dist/tools/cross-repo-contract-adapters.js +70 -0
- package/dist/tools/cross-repo-contract-adapters.js.map +1 -0
- package/dist/tools/cross-repo-contract-group.d.ts +17 -0
- package/dist/tools/cross-repo-contract-group.d.ts.map +1 -0
- package/dist/tools/cross-repo-contract-group.js +89 -0
- package/dist/tools/cross-repo-contract-group.js.map +1 -0
- package/dist/tools/cross-repo-contract-matcher.d.ts +24 -0
- package/dist/tools/cross-repo-contract-matcher.d.ts.map +1 -0
- package/dist/tools/cross-repo-contract-matcher.js +134 -0
- package/dist/tools/cross-repo-contract-matcher.js.map +1 -0
- package/dist/tools/cross-repo-contract-resolver.d.ts +9 -0
- package/dist/tools/cross-repo-contract-resolver.d.ts.map +1 -0
- package/dist/tools/cross-repo-contract-resolver.js +86 -0
- package/dist/tools/cross-repo-contract-resolver.js.map +1 -0
- package/dist/tools/cross-repo-contract-tools.d.ts +12 -135
- package/dist/tools/cross-repo-contract-tools.d.ts.map +1 -1
- package/dist/tools/cross-repo-contract-tools.js +8 -589
- package/dist/tools/cross-repo-contract-tools.js.map +1 -1
- package/dist/tools/cross-repo-contract-types.d.ts +30 -0
- package/dist/tools/cross-repo-contract-types.d.ts.map +1 -0
- package/dist/tools/cross-repo-contract-types.js +3 -0
- package/dist/tools/cross-repo-contract-types.js.map +1 -0
- package/dist/tools/cross-repo-outbound-calls.d.ts +28 -0
- package/dist/tools/cross-repo-outbound-calls.d.ts.map +1 -0
- package/dist/tools/cross-repo-outbound-calls.js +347 -0
- package/dist/tools/cross-repo-outbound-calls.js.map +1 -0
- package/dist/tools/cross-repo-outbound-lexer/call-detectors.d.ts.map +1 -1
- package/dist/tools/cross-repo-outbound-lexer/call-detectors.js +2 -0
- package/dist/tools/cross-repo-outbound-lexer/call-detectors.js.map +1 -1
- package/dist/tools/cross-repo-outbound-lexer/types.d.ts +2 -0
- package/dist/tools/cross-repo-outbound-lexer/types.d.ts.map +1 -1
- package/dist/tools/index-tools/file-indexer.js +3 -3
- package/dist/tools/index-tools/file-indexer.js.map +1 -1
- package/dist/tools/index-tools/folder-indexer.d.ts.map +1 -1
- package/dist/tools/index-tools/folder-indexer.js +47 -2
- package/dist/tools/index-tools/folder-indexer.js.map +1 -1
- package/dist/tools/index-tools/parse.d.ts +12 -3
- package/dist/tools/index-tools/parse.d.ts.map +1 -1
- package/dist/tools/index-tools/parse.js +33 -8
- package/dist/tools/index-tools/parse.js.map +1 -1
- package/dist/tools/index-tools/registry.d.ts +19 -0
- package/dist/tools/index-tools/registry.d.ts.map +1 -1
- package/dist/tools/index-tools/registry.js +88 -2
- package/dist/tools/index-tools/registry.js.map +1 -1
- package/dist/tools/index-tools/state.d.ts +31 -0
- package/dist/tools/index-tools/state.d.ts.map +1 -1
- package/dist/tools/index-tools/state.js +53 -0
- package/dist/tools/index-tools/state.js.map +1 -1
- package/dist/tools/index-tools/types.d.ts +9 -0
- package/dist/tools/index-tools/types.d.ts.map +1 -1
- package/dist/tools/index-tools/watcher.js +3 -3
- package/dist/tools/index-tools/watcher.js.map +1 -1
- package/dist/tools/index-tools/worktree-seed.d.ts +44 -0
- package/dist/tools/index-tools/worktree-seed.d.ts.map +1 -0
- package/dist/tools/index-tools/worktree-seed.js +302 -0
- package/dist/tools/index-tools/worktree-seed.js.map +1 -0
- package/dist/tools/index-tools.d.ts.map +1 -1
- package/dist/tools/index-tools.js +3 -1
- package/dist/tools/index-tools.js.map +1 -1
- package/dist/tools/nest-ext-tools/graphql.d.ts +17 -0
- package/dist/tools/nest-ext-tools/graphql.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/graphql.js +54 -0
- package/dist/tools/nest-ext-tools/graphql.js.map +1 -0
- package/dist/tools/nest-ext-tools/microservice.d.ts +17 -0
- package/dist/tools/nest-ext-tools/microservice.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/microservice.js +51 -0
- package/dist/tools/nest-ext-tools/microservice.js.map +1 -0
- package/dist/tools/nest-ext-tools/openapi.d.ts +81 -0
- package/dist/tools/nest-ext-tools/openapi.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/openapi.js +254 -0
- package/dist/tools/nest-ext-tools/openapi.js.map +1 -0
- package/dist/tools/nest-ext-tools/queue.d.ts +27 -0
- package/dist/tools/nest-ext-tools/queue.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/queue.js +95 -0
- package/dist/tools/nest-ext-tools/queue.js.map +1 -0
- package/dist/tools/nest-ext-tools/schedule.d.ts +19 -0
- package/dist/tools/nest-ext-tools/schedule.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/schedule.js +89 -0
- package/dist/tools/nest-ext-tools/schedule.js.map +1 -0
- package/dist/tools/nest-ext-tools/scope.d.ts +19 -0
- package/dist/tools/nest-ext-tools/scope.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/scope.js +151 -0
- package/dist/tools/nest-ext-tools/scope.js.map +1 -0
- package/dist/tools/nest-ext-tools/shared.d.ts +33 -0
- package/dist/tools/nest-ext-tools/shared.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/shared.js +279 -0
- package/dist/tools/nest-ext-tools/shared.js.map +1 -0
- package/dist/tools/nest-ext-tools/typeorm.d.ts +22 -0
- package/dist/tools/nest-ext-tools/typeorm.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/typeorm.js +59 -0
- package/dist/tools/nest-ext-tools/typeorm.js.map +1 -0
- package/dist/tools/nest-ext-tools/websocket.d.ts +21 -0
- package/dist/tools/nest-ext-tools/websocket.d.ts.map +1 -0
- package/dist/tools/nest-ext-tools/websocket.js +70 -0
- package/dist/tools/nest-ext-tools/websocket.js.map +1 -0
- package/dist/tools/nest-ext-tools.d.ts +10 -204
- package/dist/tools/nest-ext-tools.d.ts.map +1 -1
- package/dist/tools/nest-ext-tools.js +10 -749
- package/dist/tools/nest-ext-tools.js.map +1 -1
- package/dist/tools/perf-tools.js +2 -2
- package/dist/tools/python-audit/checks/dead-code.d.ts +1 -1
- package/dist/tools/python-audit/checks/dead-code.d.ts.map +1 -1
- package/dist/tools/python-constants/constant-match.d.ts +5 -0
- package/dist/tools/python-constants/constant-match.d.ts.map +1 -0
- package/dist/tools/python-constants/constant-match.js +24 -0
- package/dist/tools/python-constants/constant-match.js.map +1 -0
- package/dist/tools/python-constants/file-context.d.ts +5 -0
- package/dist/tools/python-constants/file-context.d.ts.map +1 -0
- package/dist/tools/python-constants/file-context.js +91 -0
- package/dist/tools/python-constants/file-context.js.map +1 -0
- package/dist/tools/python-constants/function-defaults.d.ts +5 -0
- package/dist/tools/python-constants/function-defaults.d.ts.map +1 -0
- package/dist/tools/python-constants/function-defaults.js +98 -0
- package/dist/tools/python-constants/function-defaults.js.map +1 -0
- package/dist/tools/python-constants/model.d.ts +78 -0
- package/dist/tools/python-constants/model.d.ts.map +1 -0
- package/dist/tools/python-constants/model.js +2 -0
- package/dist/tools/python-constants/model.js.map +1 -0
- package/dist/tools/python-constants/syntax.d.ts +22 -0
- package/dist/tools/python-constants/syntax.d.ts.map +1 -0
- package/dist/tools/python-constants/syntax.js +93 -0
- package/dist/tools/python-constants/syntax.js.map +1 -0
- package/dist/tools/python-constants/value-resolver.d.ts +6 -0
- package/dist/tools/python-constants/value-resolver.d.ts.map +1 -0
- package/dist/tools/python-constants/value-resolver.js +320 -0
- package/dist/tools/python-constants/value-resolver.js.map +1 -0
- package/dist/tools/python-constants-tools.d.ts +3 -45
- package/dist/tools/python-constants-tools.d.ts.map +1 -1
- package/dist/tools/python-constants-tools.js +2 -505
- package/dist/tools/python-constants-tools.js.map +1 -1
- package/dist/tools/route-tools/django.d.ts +8 -0
- package/dist/tools/route-tools/django.d.ts.map +1 -0
- package/dist/tools/route-tools/django.js +52 -0
- package/dist/tools/route-tools/django.js.map +1 -0
- package/dist/tools/route-tools/express.d.ts +5 -0
- package/dist/tools/route-tools/express.d.ts.map +1 -0
- package/dist/tools/route-tools/express.js +33 -0
- package/dist/tools/route-tools/express.js.map +1 -0
- package/dist/tools/route-tools/file-sources.d.ts +7 -0
- package/dist/tools/route-tools/file-sources.d.ts.map +1 -0
- package/dist/tools/route-tools/file-sources.js +15 -0
- package/dist/tools/route-tools/file-sources.js.map +1 -0
- package/dist/tools/route-tools/handler-discovery.d.ts +4 -0
- package/dist/tools/route-tools/handler-discovery.d.ts.map +1 -0
- package/dist/tools/route-tools/handler-discovery.js +38 -0
- package/dist/tools/route-tools/handler-discovery.js.map +1 -0
- package/dist/tools/route-tools/hono.d.ts +5 -0
- package/dist/tools/route-tools/hono.d.ts.map +1 -0
- package/dist/tools/route-tools/hono.js +61 -0
- package/dist/tools/route-tools/hono.js.map +1 -0
- package/dist/tools/route-tools/ktor.d.ts +5 -0
- package/dist/tools/route-tools/ktor.d.ts.map +1 -0
- package/dist/tools/route-tools/ktor.js +76 -0
- package/dist/tools/route-tools/ktor.js.map +1 -0
- package/dist/tools/route-tools/laravel.d.ts +5 -0
- package/dist/tools/route-tools/laravel.d.ts.map +1 -0
- package/dist/tools/route-tools/laravel.js +45 -0
- package/dist/tools/route-tools/laravel.js.map +1 -0
- package/dist/tools/route-tools/mermaid-call-chain.d.ts +3 -0
- package/dist/tools/route-tools/mermaid-call-chain.d.ts.map +1 -0
- package/dist/tools/route-tools/mermaid-call-chain.js +50 -0
- package/dist/tools/route-tools/mermaid-call-chain.js.map +1 -0
- package/dist/tools/route-tools/nest.d.ts +5 -0
- package/dist/tools/route-tools/nest.d.ts.map +1 -0
- package/dist/tools/route-tools/nest.js +75 -0
- package/dist/tools/route-tools/nest.js.map +1 -0
- package/dist/tools/route-tools/next-trace.d.ts +4 -0
- package/dist/tools/route-tools/next-trace.d.ts.map +1 -0
- package/dist/tools/route-tools/next-trace.js +48 -0
- package/dist/tools/route-tools/next-trace.js.map +1 -0
- package/dist/tools/route-tools/next.d.ts +7 -0
- package/dist/tools/route-tools/next.d.ts.map +1 -0
- package/dist/tools/route-tools/next.js +77 -0
- package/dist/tools/route-tools/next.js.map +1 -0
- package/dist/tools/route-tools/python-decorators.d.ts +7 -0
- package/dist/tools/route-tools/python-decorators.d.ts.map +1 -0
- package/dist/tools/route-tools/python-decorators.js +53 -0
- package/dist/tools/route-tools/python-decorators.js.map +1 -0
- package/dist/tools/route-tools/route-mermaid.d.ts +4 -0
- package/dist/tools/route-tools/route-mermaid.d.ts.map +1 -0
- package/dist/tools/route-tools/route-mermaid.js +53 -0
- package/dist/tools/route-tools/route-mermaid.js.map +1 -0
- package/dist/tools/route-tools/spring-kotlin.d.ts +5 -0
- package/dist/tools/route-tools/spring-kotlin.d.ts.map +1 -0
- package/dist/tools/route-tools/spring-kotlin.js +52 -0
- package/dist/tools/route-tools/spring-kotlin.js.map +1 -0
- package/dist/tools/route-tools/trace-analysis.d.ts +4 -0
- package/dist/tools/route-tools/trace-analysis.d.ts.map +1 -0
- package/dist/tools/route-tools/trace-analysis.js +37 -0
- package/dist/tools/route-tools/trace-analysis.js.map +1 -0
- package/dist/tools/route-tools/trace-route.d.ts +6 -0
- package/dist/tools/route-tools/trace-route.d.ts.map +1 -0
- package/dist/tools/route-tools/trace-route.js +53 -0
- package/dist/tools/route-tools/trace-route.js.map +1 -0
- package/dist/tools/route-tools/types.d.ts +35 -0
- package/dist/tools/route-tools/types.d.ts.map +1 -0
- package/dist/tools/route-tools/types.js +2 -0
- package/dist/tools/route-tools/types.js.map +1 -0
- package/dist/tools/route-tools/yii2.d.ts +5 -0
- package/dist/tools/route-tools/yii2.d.ts.map +1 -0
- package/dist/tools/route-tools/yii2.js +73 -0
- package/dist/tools/route-tools/yii2.js.map +1 -0
- package/dist/tools/route-tools.d.ts +7 -49
- package/dist/tools/route-tools.d.ts.map +1 -1
- package/dist/tools/route-tools.js +5 -978
- package/dist/tools/route-tools.js.map +1 -1
- package/dist/tools/symbol-analysis-tools.d.ts +81 -0
- package/dist/tools/symbol-analysis-tools.d.ts.map +1 -0
- package/dist/tools/symbol-analysis-tools.js +327 -0
- package/dist/tools/symbol-analysis-tools.js.map +1 -0
- package/dist/tools/symbol-context-tools.d.ts +68 -0
- package/dist/tools/symbol-context-tools.d.ts.map +1 -0
- package/dist/tools/symbol-context-tools.js +232 -0
- package/dist/tools/symbol-context-tools.js.map +1 -0
- package/dist/tools/symbol-lookup-tools.d.ts +77 -0
- package/dist/tools/symbol-lookup-tools.d.ts.map +1 -0
- package/dist/tools/symbol-lookup-tools.js +305 -0
- package/dist/tools/symbol-lookup-tools.js.map +1 -0
- package/dist/tools/symbol-reference-tools.d.ts +38 -0
- package/dist/tools/symbol-reference-tools.d.ts.map +1 -0
- package/dist/tools/symbol-reference-tools.js +253 -0
- package/dist/tools/symbol-reference-tools.js.map +1 -0
- package/dist/tools/symbol-tool-internals.d.ts +9 -0
- package/dist/tools/symbol-tool-internals.d.ts.map +1 -0
- package/dist/tools/symbol-tool-internals.js +47 -0
- package/dist/tools/symbol-tool-internals.js.map +1 -0
- package/dist/tools/symbol-tools.d.ts +11 -270
- package/dist/tools/symbol-tools.d.ts.map +1 -1
- package/dist/tools/symbol-tools.js +7 -1131
- package/dist/tools/symbol-tools.js.map +1 -1
- package/dist/tools/taint/python-context.d.ts +10 -0
- package/dist/tools/taint/python-context.d.ts.map +1 -0
- package/dist/tools/taint/python-context.js +150 -0
- package/dist/tools/taint/python-context.js.map +1 -0
- package/dist/tools/taint/taint-analyzer.d.ts +2 -0
- package/dist/tools/taint/taint-analyzer.d.ts.map +1 -0
- package/dist/tools/taint/taint-analyzer.js +2 -0
- package/dist/tools/taint/taint-analyzer.js.map +1 -0
- package/dist/tools/taint/taint-expression.d.ts +18 -0
- package/dist/tools/taint/taint-expression.d.ts.map +1 -0
- package/dist/tools/taint/taint-expression.js +265 -0
- package/dist/tools/taint/taint-expression.js.map +1 -0
- package/dist/tools/taint/taint-flow.d.ts +10 -0
- package/dist/tools/taint/taint-flow.d.ts.map +1 -0
- package/dist/tools/taint/taint-flow.js +178 -0
- package/dist/tools/taint/taint-flow.js.map +1 -0
- package/dist/tools/taint/taint-model.d.ts +113 -0
- package/dist/tools/taint/taint-model.d.ts.map +1 -0
- package/dist/tools/taint/taint-model.js +277 -0
- package/dist/tools/taint/taint-model.js.map +1 -0
- package/dist/tools/taint-tools.d.ts +2 -34
- package/dist/tools/taint-tools.d.ts.map +1 -1
- package/dist/tools/taint-tools.js +2 -852
- package/dist/tools/taint-tools.js.map +1 -1
- package/dist/tools/typescript-constants/file-context.d.ts +7 -0
- package/dist/tools/typescript-constants/file-context.d.ts.map +1 -0
- package/dist/tools/typescript-constants/file-context.js +219 -0
- package/dist/tools/typescript-constants/file-context.js.map +1 -0
- package/dist/tools/typescript-constants/symbol-resolver.d.ts +7 -0
- package/dist/tools/typescript-constants/symbol-resolver.d.ts.map +1 -0
- package/dist/tools/typescript-constants/symbol-resolver.js +165 -0
- package/dist/tools/typescript-constants/symbol-resolver.js.map +1 -0
- package/dist/tools/typescript-constants/types.d.ts +44 -0
- package/dist/tools/typescript-constants/types.d.ts.map +1 -0
- package/dist/tools/typescript-constants/types.js +2 -0
- package/dist/tools/typescript-constants/types.js.map +1 -0
- package/dist/tools/typescript-constants/value-evaluator.d.ts +8 -0
- package/dist/tools/typescript-constants/value-evaluator.d.ts.map +1 -0
- package/dist/tools/typescript-constants/value-evaluator.js +404 -0
- package/dist/tools/typescript-constants/value-evaluator.js.map +1 -0
- package/dist/tools/typescript-constants-tools.d.ts.map +1 -1
- package/dist/tools/typescript-constants-tools.js +19 -709
- package/dist/tools/typescript-constants-tools.js.map +1 -1
- package/dist/utils/import-graph/collect.d.ts +5 -0
- package/dist/utils/import-graph/collect.d.ts.map +1 -0
- package/dist/utils/import-graph/collect.js +47 -0
- package/dist/utils/import-graph/collect.js.map +1 -0
- package/dist/utils/import-graph/edge-accumulator.d.ts +7 -0
- package/dist/utils/import-graph/edge-accumulator.d.ts.map +1 -0
- package/dist/utils/import-graph/edge-accumulator.js +47 -0
- package/dist/utils/import-graph/edge-accumulator.js.map +1 -0
- package/dist/utils/import-graph/language-imports.d.ts +6 -0
- package/dist/utils/import-graph/language-imports.d.ts.map +1 -0
- package/dist/utils/import-graph/language-imports.js +84 -0
- package/dist/utils/import-graph/language-imports.js.map +1 -0
- package/dist/utils/import-graph/metrics.d.ts +6 -0
- package/dist/utils/import-graph/metrics.d.ts.map +1 -0
- package/dist/utils/import-graph/metrics.js +51 -0
- package/dist/utils/import-graph/metrics.js.map +1 -0
- package/dist/utils/import-graph/path-map.d.ts +7 -0
- package/dist/utils/import-graph/path-map.d.ts.map +1 -0
- package/dist/utils/import-graph/path-map.js +56 -0
- package/dist/utils/import-graph/path-map.js.map +1 -0
- package/dist/utils/import-graph/python-php-edge-collectors.d.ts +5 -0
- package/dist/utils/import-graph/python-php-edge-collectors.d.ts.map +1 -0
- package/dist/utils/import-graph/python-php-edge-collectors.js +56 -0
- package/dist/utils/import-graph/python-php-edge-collectors.js.map +1 -0
- package/dist/utils/import-graph/source-edge-collector.d.ts +13 -0
- package/dist/utils/import-graph/source-edge-collector.d.ts.map +1 -0
- package/dist/utils/import-graph/source-edge-collector.js +42 -0
- package/dist/utils/import-graph/source-edge-collector.js.map +1 -0
- package/dist/utils/import-graph/source-imports.d.ts +5 -0
- package/dist/utils/import-graph/source-imports.d.ts.map +1 -0
- package/dist/utils/import-graph/source-imports.js +33 -0
- package/dist/utils/import-graph/source-imports.js.map +1 -0
- package/dist/utils/import-graph/types.d.ts +15 -0
- package/dist/utils/import-graph/types.d.ts.map +1 -0
- package/dist/utils/import-graph/types.js +2 -0
- package/dist/utils/import-graph/types.js.map +1 -0
- package/dist/utils/import-graph/typescript-edge-collector.d.ts +7 -0
- package/dist/utils/import-graph/typescript-edge-collector.d.ts.map +1 -0
- package/dist/utils/import-graph/typescript-edge-collector.js +58 -0
- package/dist/utils/import-graph/typescript-edge-collector.js.map +1 -0
- package/dist/utils/import-graph/workspace-alias.d.ts +7 -0
- package/dist/utils/import-graph/workspace-alias.d.ts.map +1 -0
- package/dist/utils/import-graph/workspace-alias.js +95 -0
- package/dist/utils/import-graph/workspace-alias.js.map +1 -0
- package/dist/utils/import-graph/workspace-entry.d.ts +3 -0
- package/dist/utils/import-graph/workspace-entry.d.ts.map +1 -0
- package/dist/utils/import-graph/workspace-entry.js +81 -0
- package/dist/utils/import-graph/workspace-entry.js.map +1 -0
- package/dist/utils/import-graph.d.ts +10 -94
- package/dist/utils/import-graph.d.ts.map +1 -1
- package/dist/utils/import-graph.js +6 -702
- package/dist/utils/import-graph.js.map +1 -1
- package/package.json +1 -1
- package/rules/codesift.md +11 -2
- package/rules/codesift.mdc +11 -2
- package/rules/codex.md +11 -2
- package/rules/gemini.md +11 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Reference } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* What a reference scan actually looked at.
|
|
4
|
+
*
|
|
5
|
+
* `find_references` returning `[]` is the input to "nobody uses this, safe to rename or delete".
|
|
6
|
+
* That inference is only valid if the scan saw everywhere a reference could be. It routinely does
|
|
7
|
+
* not: generated and vendored paths are skipped by default, files can be unreadable, and per
|
|
8
|
+
* symbol the collection stops at MAX_REFERENCES. None of that was visible in the result.
|
|
9
|
+
*
|
|
10
|
+
* Filled through a caller-supplied sink so the `Record<string, Reference[]>` return shape — which
|
|
11
|
+
* several call sites slice and re-key — stays untouched.
|
|
12
|
+
*/
|
|
13
|
+
export interface ReferenceScanCoverage {
|
|
14
|
+
/** `unknown` is the honest default when the scan did not report — never assume `complete`. */
|
|
15
|
+
status: "complete" | "partial" | "unknown";
|
|
16
|
+
files_indexed: number;
|
|
17
|
+
files_scanned: number;
|
|
18
|
+
/** Generated/vendored paths skipped because no file_pattern was given. */
|
|
19
|
+
files_skipped_noise?: number;
|
|
20
|
+
files_unreadable?: number;
|
|
21
|
+
/** Symbols whose reference list hit MAX_REFERENCES — their counts are floors, not totals. */
|
|
22
|
+
capped_symbols?: string[];
|
|
23
|
+
detail?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ReferenceScanSink {
|
|
26
|
+
coverage?: ReferenceScanCoverage;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Batch find references for multiple symbols in one pass.
|
|
30
|
+
* Reads each file once instead of N times — critical for large repos.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findReferencesBatch(repo: string, symbolNames: string[], filePattern?: string, sink?: ReferenceScanSink): Promise<Record<string, Reference[]>>;
|
|
33
|
+
/**
|
|
34
|
+
* Find references to a symbol name across indexed files.
|
|
35
|
+
* Matches whole words only using word-boundary regex.
|
|
36
|
+
*/
|
|
37
|
+
export declare function findReferences(repo: string, symbolName: string, filePattern?: string): Promise<Reference[]>;
|
|
38
|
+
//# sourceMappingURL=symbol-reference-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-reference-tools.d.ts","sourceRoot":"","sources":["../../src/tools/symbol-reference-tools.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAU7C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EAAE,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE,iBAAiB,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CA6FtC;AAiGD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,SAAS,EAAE,CAAC,CAyDtB"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { execFile, execFileSync } from "node:child_process";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { findReferencesLsp } from "../lsp/lsp-tools.js";
|
|
6
|
+
import { matchFilePattern } from "../utils/glob.js";
|
|
7
|
+
import { isNoisePath, MAX_CONTEXT_LENGTH, MAX_REFERENCES, requireCodeIndex, wordBoundaryPattern, } from "./symbol-tool-internals.js";
|
|
8
|
+
/**
|
|
9
|
+
* Batch find references for multiple symbols in one pass.
|
|
10
|
+
* Reads each file once instead of N times — critical for large repos.
|
|
11
|
+
*/
|
|
12
|
+
export async function findReferencesBatch(repo, symbolNames, filePattern, sink) {
|
|
13
|
+
const index = await requireCodeIndex(repo);
|
|
14
|
+
const uniqueNames = [...new Set(symbolNames)];
|
|
15
|
+
const patterns = uniqueNames.map((name) => ({
|
|
16
|
+
name,
|
|
17
|
+
regex: wordBoundaryPattern(name),
|
|
18
|
+
}));
|
|
19
|
+
const result = {};
|
|
20
|
+
for (const name of uniqueNames)
|
|
21
|
+
result[name] = [];
|
|
22
|
+
let filesScanned = 0;
|
|
23
|
+
let filesSkippedNoise = 0;
|
|
24
|
+
let filesUnreadable = 0;
|
|
25
|
+
let timedOut = false;
|
|
26
|
+
const searchStart = Date.now();
|
|
27
|
+
for (const fileEntry of index.files) {
|
|
28
|
+
if (Date.now() - searchStart > SEARCH_TIMEOUT_MS) {
|
|
29
|
+
timedOut = true;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (filePattern && !matchFilePattern(fileEntry.path, filePattern))
|
|
33
|
+
continue;
|
|
34
|
+
if (!filePattern && isNoisePath(fileEntry.path)) {
|
|
35
|
+
// Sensible default — but it means "no references" really means "none outside generated
|
|
36
|
+
// and vendored code", and the caller could not tell that scoping had happened.
|
|
37
|
+
filesSkippedNoise++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
let content;
|
|
41
|
+
try {
|
|
42
|
+
content = await readFile(join(index.root, fileEntry.path), "utf-8");
|
|
43
|
+
filesScanned++;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// A reference living only in a file we could not read is invisible here, and the symbol
|
|
47
|
+
// then looks unused.
|
|
48
|
+
filesUnreadable++;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const lines = content.split("\n");
|
|
52
|
+
for (let i = 0; i < lines.length; i++) {
|
|
53
|
+
const line = lines[i];
|
|
54
|
+
if (line === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
for (const { name, regex } of patterns) {
|
|
57
|
+
const refs = result[name];
|
|
58
|
+
if (refs.length >= MAX_REFERENCES)
|
|
59
|
+
continue;
|
|
60
|
+
const match = regex.exec(line);
|
|
61
|
+
if (match) {
|
|
62
|
+
const rawContext = line.trimEnd();
|
|
63
|
+
refs.push({
|
|
64
|
+
file: fileEntry.path,
|
|
65
|
+
line: i + 1,
|
|
66
|
+
col: match.index + 1,
|
|
67
|
+
context: rawContext.length > MAX_CONTEXT_LENGTH
|
|
68
|
+
? rawContext.slice(0, MAX_CONTEXT_LENGTH) + "..."
|
|
69
|
+
: rawContext,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (sink) {
|
|
76
|
+
const capped = uniqueNames.filter((n) => (result[n]?.length ?? 0) >= MAX_REFERENCES);
|
|
77
|
+
const complete = !timedOut && filesSkippedNoise === 0 && filesUnreadable === 0 && capped.length === 0;
|
|
78
|
+
const reasons = [];
|
|
79
|
+
if (filesSkippedNoise > 0) {
|
|
80
|
+
reasons.push(`${filesSkippedNoise} generated/vendored files skipped (pass file_pattern to include them)`);
|
|
81
|
+
}
|
|
82
|
+
if (filesUnreadable > 0)
|
|
83
|
+
reasons.push(`${filesUnreadable} files could not be read`);
|
|
84
|
+
if (timedOut)
|
|
85
|
+
reasons.push(`scan exceeded ${SEARCH_TIMEOUT_MS}ms`);
|
|
86
|
+
if (capped.length > 0)
|
|
87
|
+
reasons.push(`${capped.length} symbol(s) hit the ${MAX_REFERENCES}-reference cap`);
|
|
88
|
+
sink.coverage = {
|
|
89
|
+
status: complete ? "complete" : "partial",
|
|
90
|
+
files_indexed: index.files.length,
|
|
91
|
+
files_scanned: filesScanned,
|
|
92
|
+
...(filesSkippedNoise > 0 ? { files_skipped_noise: filesSkippedNoise } : {}),
|
|
93
|
+
...(filesUnreadable > 0 ? { files_unreadable: filesUnreadable } : {}),
|
|
94
|
+
...(capped.length > 0 ? { capped_symbols: capped } : {}),
|
|
95
|
+
...(complete
|
|
96
|
+
? {}
|
|
97
|
+
: {
|
|
98
|
+
detail: `${reasons.join("; ")} — an empty or short result is about what was scanned, ` +
|
|
99
|
+
`not proof the symbol is unused`,
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
const SEARCH_TIMEOUT_MS = 30_000;
|
|
106
|
+
/** Directories to exclude from ripgrep reference search */
|
|
107
|
+
const RG_EXCLUDE_DIRS = [
|
|
108
|
+
"node_modules", ".git", ".next", "dist", ".codesift", "coverage",
|
|
109
|
+
".playwright-mcp", "__pycache__", "__snapshots__",
|
|
110
|
+
];
|
|
111
|
+
/** Detect whether `rg` (ripgrep) is available. Cached at module level. */
|
|
112
|
+
let rgAvailable = null;
|
|
113
|
+
function hasRipgrep() {
|
|
114
|
+
if (rgAvailable !== null)
|
|
115
|
+
return rgAvailable;
|
|
116
|
+
try {
|
|
117
|
+
execFileSync("rg", ["--version"], { stdio: "pipe", timeout: 2000 });
|
|
118
|
+
rgAvailable = true;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
rgAvailable = false;
|
|
122
|
+
}
|
|
123
|
+
return rgAvailable;
|
|
124
|
+
}
|
|
125
|
+
const execFileAsync = promisify(execFile);
|
|
126
|
+
/**
|
|
127
|
+
* Find references using ripgrep with word-boundary matching.
|
|
128
|
+
* Returns compact `file:line: context` string when results ≤ threshold.
|
|
129
|
+
*/
|
|
130
|
+
async function findReferencesWithRipgrep(root, symbolName, maxResults, filePattern) {
|
|
131
|
+
const args = [
|
|
132
|
+
"-n", "--no-heading", "-F",
|
|
133
|
+
"--max-columns", String(MAX_CONTEXT_LENGTH),
|
|
134
|
+
"--max-columns-preview",
|
|
135
|
+
"--max-count", String(Math.min(maxResults * 2, 5000)),
|
|
136
|
+
];
|
|
137
|
+
if (filePattern) {
|
|
138
|
+
args.push("--glob", filePattern);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
for (const dir of RG_EXCLUDE_DIRS)
|
|
142
|
+
args.push("--glob", `!${dir}`);
|
|
143
|
+
for (const ext of [".snap", ".lock", ".map", ".svg", ".png", ".jpg", ".ico", ".woff", ".woff2", ".md", ".json", ".yaml", ".yml", ".toml", ".css", ".scss", ".html"]) {
|
|
144
|
+
args.push("--glob", `!*${ext}`);
|
|
145
|
+
}
|
|
146
|
+
// Default to code files only (matches what agent would grep for)
|
|
147
|
+
args.push("--type-add", "code:*.{ts,tsx,js,jsx,py,go,rs,java,kt,kts,rb,php,vue,svelte}");
|
|
148
|
+
args.push("--type", "code");
|
|
149
|
+
}
|
|
150
|
+
args.push("--", symbolName, root);
|
|
151
|
+
let stdout;
|
|
152
|
+
try {
|
|
153
|
+
const result = await execFileAsync("rg", args, {
|
|
154
|
+
encoding: "utf-8",
|
|
155
|
+
maxBuffer: 20 * 1024 * 1024,
|
|
156
|
+
timeout: SEARCH_TIMEOUT_MS,
|
|
157
|
+
});
|
|
158
|
+
stdout = result.stdout;
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
if (err && typeof err === "object" && "code" in err && err.code === 1)
|
|
162
|
+
return [];
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const rootPrefix = root.endsWith("/") ? root : root + "/";
|
|
166
|
+
const lines = stdout.split("\n").filter(Boolean);
|
|
167
|
+
const refs = [];
|
|
168
|
+
const identifierPattern = wordBoundaryPattern(symbolName);
|
|
169
|
+
for (const rawLine of lines) {
|
|
170
|
+
if (refs.length >= maxResults)
|
|
171
|
+
break;
|
|
172
|
+
const match = rawLine.match(/^(.+?):(\d+):(.*)/);
|
|
173
|
+
if (!match || !match[1] || !match[2] || match[3] === undefined)
|
|
174
|
+
continue;
|
|
175
|
+
const absPath = match[1];
|
|
176
|
+
const relPath = absPath.startsWith(rootPrefix) ? absPath.slice(rootPrefix.length) : absPath;
|
|
177
|
+
if (!filePattern && isNoisePath(relPath))
|
|
178
|
+
continue;
|
|
179
|
+
// `rg -w` is incorrect for valid identifiers such as `$store` and `#handler`. The literal
|
|
180
|
+
// search keeps metacharacters safe; this Unicode-aware filter supplies language boundaries.
|
|
181
|
+
if (!identifierPattern.test(match[3]))
|
|
182
|
+
continue;
|
|
183
|
+
refs.push({
|
|
184
|
+
file: relPath,
|
|
185
|
+
line: parseInt(match[2], 10),
|
|
186
|
+
context: match[3].length > MAX_CONTEXT_LENGTH ? match[3].slice(0, MAX_CONTEXT_LENGTH) + "..." : match[3],
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
return refs;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Find references to a symbol name across indexed files.
|
|
193
|
+
* Matches whole words only using word-boundary regex.
|
|
194
|
+
*/
|
|
195
|
+
export async function findReferences(repo, symbolName, filePattern) {
|
|
196
|
+
// Try LSP first (type-safe, no false positives)
|
|
197
|
+
if (!filePattern) {
|
|
198
|
+
const lspRefs = await findReferencesLsp(repo, symbolName);
|
|
199
|
+
if (lspRefs !== null)
|
|
200
|
+
return lspRefs;
|
|
201
|
+
}
|
|
202
|
+
// Use ripgrep when available (10x+ faster than Node.js file walk)
|
|
203
|
+
if (!filePattern && hasRipgrep()) {
|
|
204
|
+
const index = await requireCodeIndex(repo);
|
|
205
|
+
const result = await findReferencesWithRipgrep(index.root, symbolName, MAX_REFERENCES, filePattern);
|
|
206
|
+
if (result !== null)
|
|
207
|
+
return result;
|
|
208
|
+
// Any rg failure other than its explicit no-match exit falls through to the index-backed scan.
|
|
209
|
+
}
|
|
210
|
+
// Node.js fallback
|
|
211
|
+
const index = await requireCodeIndex(repo);
|
|
212
|
+
const pattern = wordBoundaryPattern(symbolName);
|
|
213
|
+
const searchStart = Date.now();
|
|
214
|
+
const refs = [];
|
|
215
|
+
for (const fileEntry of index.files) {
|
|
216
|
+
if (refs.length >= MAX_REFERENCES)
|
|
217
|
+
break;
|
|
218
|
+
if (Date.now() - searchStart > SEARCH_TIMEOUT_MS)
|
|
219
|
+
break;
|
|
220
|
+
if (filePattern && !matchFilePattern(fileEntry.path, filePattern))
|
|
221
|
+
continue;
|
|
222
|
+
if (!filePattern && isNoisePath(fileEntry.path))
|
|
223
|
+
continue;
|
|
224
|
+
let content;
|
|
225
|
+
try {
|
|
226
|
+
content = await readFile(join(index.root, fileEntry.path), "utf-8");
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
const lines = content.split("\n");
|
|
232
|
+
for (let i = 0; i < lines.length; i++) {
|
|
233
|
+
if (refs.length >= MAX_REFERENCES)
|
|
234
|
+
break;
|
|
235
|
+
const line = lines[i];
|
|
236
|
+
if (line === undefined)
|
|
237
|
+
continue;
|
|
238
|
+
const match = pattern.exec(line);
|
|
239
|
+
if (match) {
|
|
240
|
+
const rawContext = line.trimEnd();
|
|
241
|
+
refs.push({
|
|
242
|
+
file: fileEntry.path,
|
|
243
|
+
line: i + 1,
|
|
244
|
+
context: rawContext.length > MAX_CONTEXT_LENGTH
|
|
245
|
+
? rawContext.slice(0, MAX_CONTEXT_LENGTH) + "..."
|
|
246
|
+
: rawContext,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return refs;
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=symbol-reference-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-reference-tools.js","sourceRoot":"","sources":["../../src/tools/symbol-reference-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AA8BpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,WAAqB,EACrB,WAAoB,EACpB,IAAwB;IAExB,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1C,I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AC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;QACtE,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,IAAI,IAAI,CAAC,MAAM,IAAI,cAAc;gBAAE,MAAM;YAEzC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACtB,IAAI,IAAI,KAAK,SAAS;gBAAE,SAAS;YACjC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClC,IAAI,CAAC,IAAI,CAAC;oBACR,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,IAAI,EAAE,CAAC,GAAG,CAAC;oBACX,OAAO,EAAE,UAAU,CAAC,MAAM,GAAG,kBAAkB;wBAC7C,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,GAAG,KAAK;wBACjD,CAAC,CAAC,UAAU;iBACf,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BM25Index } from "../search/bm25.js";
|
|
2
|
+
import type { CodeIndex } from "../types.js";
|
|
3
|
+
export declare const MAX_REFERENCES = 100;
|
|
4
|
+
export declare const MAX_CONTEXT_LENGTH = 200;
|
|
5
|
+
export declare function isNoisePath(filePath: string): boolean;
|
|
6
|
+
export declare function requireCodeIndex(repo: string): Promise<CodeIndex>;
|
|
7
|
+
export declare function requireBM25Index(repo: string): Promise<BM25Index>;
|
|
8
|
+
export declare function wordBoundaryPattern(name: string): RegExp;
|
|
9
|
+
//# sourceMappingURL=symbol-tool-internals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-tool-internals.d.ts","sourceRoot":"","sources":["../../src/tools/symbol-tool-internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAsBtC,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAIrD;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAMvE;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAMvE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getBM25Index, getCodeIndex } from "./index-tools.js";
|
|
2
|
+
export const MAX_REFERENCES = 100;
|
|
3
|
+
export const MAX_CONTEXT_LENGTH = 200;
|
|
4
|
+
const NOISE_PATH_PREFIXES = [
|
|
5
|
+
".next/",
|
|
6
|
+
"dist/",
|
|
7
|
+
"build/",
|
|
8
|
+
"coverage/",
|
|
9
|
+
"node_modules/",
|
|
10
|
+
"__snapshots__/",
|
|
11
|
+
];
|
|
12
|
+
const NOISE_EXTENSIONS = new Set([
|
|
13
|
+
".snap",
|
|
14
|
+
".lock",
|
|
15
|
+
".map",
|
|
16
|
+
".svg",
|
|
17
|
+
".png",
|
|
18
|
+
".jpg",
|
|
19
|
+
".ico",
|
|
20
|
+
".woff",
|
|
21
|
+
".woff2",
|
|
22
|
+
]);
|
|
23
|
+
export function isNoisePath(filePath) {
|
|
24
|
+
if (NOISE_PATH_PREFIXES.some((prefix) => filePath.startsWith(prefix)))
|
|
25
|
+
return true;
|
|
26
|
+
const dot = filePath.lastIndexOf(".");
|
|
27
|
+
return dot >= 0 && NOISE_EXTENSIONS.has(filePath.slice(dot));
|
|
28
|
+
}
|
|
29
|
+
export async function requireCodeIndex(repo) {
|
|
30
|
+
const index = await getCodeIndex(repo);
|
|
31
|
+
if (!index) {
|
|
32
|
+
throw new Error(`Repository "${repo}" not found. Index it first with index_folder.`);
|
|
33
|
+
}
|
|
34
|
+
return index;
|
|
35
|
+
}
|
|
36
|
+
export async function requireBM25Index(repo) {
|
|
37
|
+
const index = await getBM25Index(repo);
|
|
38
|
+
if (!index) {
|
|
39
|
+
throw new Error(`Repository "${repo}" not found. Index it first with index_folder.`);
|
|
40
|
+
}
|
|
41
|
+
return index;
|
|
42
|
+
}
|
|
43
|
+
export function wordBoundaryPattern(name) {
|
|
44
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
45
|
+
return new RegExp(`(?<![$_\\p{ID_Continue}])${escaped}(?![$_\\u200C\\u200D\\p{ID_Continue}])`, "u");
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=symbol-tool-internals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-tool-internals.js","sourceRoot":"","sources":["../../src/tools/symbol-tool-internals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,MAAM,mBAAmB,GAAG;IAC1B,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,eAAe;IACf,gBAAgB;CACjB,CAAC;AACF,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CAAC"}
|
|
@@ -1,274 +1,15 @@
|
|
|
1
|
-
import type { CodeSymbol, Reference, SymbolKind } from "../types.js";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
* hallucinated symbol IDs (telemetry shows 24-26% of get_symbol/get_symbols
|
|
5
|
-
* calls return zero results). Extracts a name candidate from the requested
|
|
6
|
-
* ID and returns up to `limit` symbols whose name matches case-insensitively.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Resolve a non-canonical symbol reference to a real symbol ID when it is
|
|
10
|
-
* UNAMBIGUOUS.
|
|
11
|
-
*
|
|
12
|
-
* Symbol IDs are `repo:file:name:line` — they embed the declaration line, so no
|
|
13
|
-
* caller can construct one by hand. Agents therefore pass a bare name
|
|
14
|
-
* ("getOptions") or a half-remembered path, and the lookup returns null; the
|
|
15
|
-
* measured miss rate was 24% of get_symbol calls and 26% of get_symbols. The old
|
|
16
|
-
* behaviour answered with a suggestion list, which is a second round trip for a
|
|
17
|
-
* question we can already answer.
|
|
2
|
+
* Stable public facade for symbol-oriented tools.
|
|
18
3
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* signal, which is worse than the miss it replaces.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Best-effort symbol NAME out of whatever the caller passed.
|
|
25
|
-
*
|
|
26
|
-
* Symbol IDs end in the declaration line (`repo:file:name:LINE`), so naively
|
|
27
|
-
* taking the last segment yields "42" and matches nothing — every suggestion for
|
|
28
|
-
* a well-formed-but-stale id was silently useless. Skip trailing numeric
|
|
29
|
-
* segments, then fall back to the last non-empty one.
|
|
30
|
-
*/
|
|
31
|
-
export declare function extractSymbolNameGuess(requestedId: string): string;
|
|
32
|
-
export declare function resolveSymbolIdExact(repo: string, requestedId: string): Promise<string | null>;
|
|
33
|
-
export declare function findSimilarSymbols(repo: string, requestedId: string, limit?: number): Promise<Array<{
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
kind: string;
|
|
37
|
-
file: string;
|
|
38
|
-
start_line: number;
|
|
39
|
-
}>>;
|
|
40
|
-
/**
|
|
41
|
-
* Retrieve a single symbol by ID with fresh source from disk.
|
|
42
|
-
* When include_related is true (default), auto-prefetches:
|
|
43
|
-
* - children (for classes/interfaces) — saves follow-up get_symbols call
|
|
44
|
-
* - symbols in the same file that reference this symbol — saves find_references call
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* Raised when one id maps to several distinct symbols.
|
|
48
|
-
*
|
|
49
|
-
* A named type rather than a bare `Error` because two callers must tell this apart from a real
|
|
50
|
-
* failure, and matching on message text would break the moment the wording changes. Structural
|
|
51
|
-
* check, not `instanceof`: a duplicated module instance across a worker or bundler boundary makes
|
|
52
|
-
* `instanceof` false for an object that is in every observable way the right error — the same
|
|
53
|
-
* trap `isIndexStorageError` documents in the storage layer.
|
|
54
|
-
*/
|
|
55
|
-
export declare class AmbiguousSymbolIdError extends Error {
|
|
56
|
-
constructor(message: string);
|
|
57
|
-
}
|
|
58
|
-
export declare function isAmbiguousSymbolIdError(err: unknown): err is AmbiguousSymbolIdError;
|
|
59
|
-
/**
|
|
60
|
-
* Resolve a search hit to its full symbol, tolerating an ambiguous id.
|
|
61
|
-
*
|
|
62
|
-
* `getSymbol` throwing on a colliding id is right when a caller supplies one: it named a specific
|
|
63
|
-
* symbol and must not silently receive a different one. Here nobody supplied it — the id was read
|
|
64
|
-
* back off a BM25 hit whose symbol this function already holds. Failing an entire search because
|
|
65
|
-
* its top hit happens to sit in a minified bundle would make the collision a worse answer than the
|
|
66
|
-
* silent substitution it replaced, and it would hit `find_and_show` and `get_context_bundle`, the
|
|
67
|
-
* two tools the H7/H8 hints steer agents toward. Falling back to the hit is not a guess: it is the
|
|
68
|
-
* result the search actually returned.
|
|
69
|
-
*/
|
|
70
|
-
export interface SymbolIdAmbiguity {
|
|
71
|
-
/** Always present. `ambiguous` means the answer is the search's top hit, not a unique resolution. */
|
|
72
|
-
status: "unique" | "ambiguous";
|
|
73
|
-
/** Set only when ambiguous: how many distinct symbols share the id. */
|
|
74
|
-
shared_by?: number;
|
|
75
|
-
/** Set only when ambiguous: the other candidates, so the caller can pick deliberately. */
|
|
76
|
-
candidates?: Array<{
|
|
77
|
-
name: string;
|
|
78
|
-
kind: SymbolKind;
|
|
79
|
-
file: string;
|
|
80
|
-
start_line: number;
|
|
81
|
-
}>;
|
|
82
|
-
}
|
|
83
|
-
export declare function getSymbol(repo: string, symbolId: string, options?: {
|
|
84
|
-
include_related?: boolean;
|
|
85
|
-
}): Promise<{
|
|
86
|
-
symbol: CodeSymbol;
|
|
87
|
-
related?: CodeSymbol[];
|
|
88
|
-
} | null>;
|
|
89
|
-
/**
|
|
90
|
-
* Retrieve multiple symbols by ID with fresh source from disk.
|
|
91
|
-
* Groups reads by file to minimize disk I/O.
|
|
92
|
-
*/
|
|
93
|
-
export declare function getSymbols(repo: string, symbolIds: string[]): Promise<CodeSymbol[]>;
|
|
94
|
-
/**
|
|
95
|
-
* Find references to a symbol name across indexed files.
|
|
96
|
-
* Matches whole words only using word-boundary regex.
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* Batch find references for multiple symbols in one pass.
|
|
100
|
-
* Reads each file once instead of N times — critical for large repos.
|
|
101
|
-
*/
|
|
102
|
-
/**
|
|
103
|
-
* What a reference scan actually looked at.
|
|
104
|
-
*
|
|
105
|
-
* `find_references` returning `[]` is the input to "nobody uses this, safe to rename or delete".
|
|
106
|
-
* That inference is only valid if the scan saw everywhere a reference could be. It routinely does
|
|
107
|
-
* not: generated and vendored paths are skipped by default, files can be unreadable, and per
|
|
108
|
-
* symbol the collection stops at MAX_REFERENCES. None of that was visible in the result.
|
|
109
|
-
*
|
|
110
|
-
* Filled through a caller-supplied sink so the `Record<string, Reference[]>` return shape — which
|
|
111
|
-
* several call sites slice and re-key — stays untouched.
|
|
112
|
-
*/
|
|
113
|
-
export interface ReferenceScanCoverage {
|
|
114
|
-
/** `unknown` is the honest default when the scan did not report — never assume `complete`. */
|
|
115
|
-
status: "complete" | "partial" | "unknown";
|
|
116
|
-
files_indexed: number;
|
|
117
|
-
files_scanned: number;
|
|
118
|
-
/** Generated/vendored paths skipped because no file_pattern was given. */
|
|
119
|
-
files_skipped_noise?: number;
|
|
120
|
-
files_unreadable?: number;
|
|
121
|
-
/** Symbols whose reference list hit MAX_REFERENCES — their counts are floors, not totals. */
|
|
122
|
-
capped_symbols?: string[];
|
|
123
|
-
detail?: string;
|
|
124
|
-
}
|
|
125
|
-
export interface ReferenceScanSink {
|
|
126
|
-
coverage?: ReferenceScanCoverage;
|
|
127
|
-
}
|
|
128
|
-
export declare function findReferencesBatch(repo: string, symbolNames: string[], filePattern?: string, sink?: ReferenceScanSink): Promise<Record<string, Reference[]>>;
|
|
129
|
-
export declare function findReferences(repo: string, symbolName: string, filePattern?: string): Promise<Reference[]>;
|
|
130
|
-
/** Format references as compact string for MCP output. Groups by file to avoid repeating paths. */
|
|
131
|
-
export declare function formatRefsCompact(refs: Reference[]): string;
|
|
132
|
-
/** Format a CodeSymbol as compact text: header line + source. ~70% less tokens than JSON. */
|
|
133
|
-
export declare function formatSymbolCompact(sym: CodeSymbol): string;
|
|
134
|
-
/** Format multiple CodeSymbols as compact text, separated by blank lines. */
|
|
135
|
-
export declare function formatSymbolsCompact(syms: CodeSymbol[]): string;
|
|
136
|
-
/** Format ContextBundle as compact text. */
|
|
137
|
-
export declare function formatBundleCompact(bundle: {
|
|
138
|
-
symbol: CodeSymbol;
|
|
139
|
-
imports: string[];
|
|
140
|
-
siblings: Array<{
|
|
141
|
-
name: string;
|
|
142
|
-
kind: string;
|
|
143
|
-
start_line: number;
|
|
144
|
-
end_line: number;
|
|
145
|
-
}>;
|
|
146
|
-
types_used: string[];
|
|
147
|
-
}): string;
|
|
148
|
-
/**
|
|
149
|
-
* Search for a symbol by query and return it with full source.
|
|
150
|
-
* Optionally includes references across the codebase.
|
|
151
|
-
*/
|
|
152
|
-
export declare function findAndShow(repo: string, query: string, includeRefs?: boolean): Promise<{
|
|
153
|
-
symbol: CodeSymbol;
|
|
154
|
-
references?: Reference[];
|
|
155
|
-
id_ambiguity: SymbolIdAmbiguity;
|
|
156
|
-
} | null>;
|
|
157
|
-
export interface ReactContext {
|
|
158
|
-
/** Props type name extracted from the component's parameter type annotation */
|
|
159
|
-
props_type: string | null;
|
|
160
|
-
/** Source of the props interface/type declaration when found in the index (Tier 4 — Item 16) */
|
|
161
|
-
props_interface_source: string | null;
|
|
162
|
-
/** React hooks called inside this component (use*() patterns) */
|
|
163
|
-
hooks_used: Array<{
|
|
164
|
-
name: string;
|
|
165
|
-
is_stdlib: boolean;
|
|
166
|
-
}>;
|
|
167
|
-
/** Child components rendered via JSX (<PascalCase>) */
|
|
168
|
-
child_components: string[];
|
|
169
|
-
/** Parent components that render this one via JSX */
|
|
170
|
-
parent_components: string[];
|
|
171
|
-
/** Detected wrapper pattern (memo, forwardRef, lazy) or null */
|
|
172
|
-
wrapper: "memo" | "forwardRef" | "lazy" | null;
|
|
173
|
-
}
|
|
174
|
-
export interface ContextBundle {
|
|
175
|
-
symbol: CodeSymbol;
|
|
176
|
-
imports: string[];
|
|
177
|
-
siblings: Array<{
|
|
178
|
-
name: string;
|
|
179
|
-
kind: SymbolKind;
|
|
180
|
-
start_line: number;
|
|
181
|
-
end_line: number;
|
|
182
|
-
}>;
|
|
183
|
-
types_used: string[];
|
|
184
|
-
/** Only populated when symbol.kind === "component" */
|
|
185
|
-
react_context?: ReactContext;
|
|
186
|
-
/** Always present. Says whether `symbol` is a unique resolution or the search's top hit among
|
|
187
|
-
* several sharing one id — a distinction the caller cannot otherwise make from the result. */
|
|
188
|
-
id_ambiguity: SymbolIdAmbiguity;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get a symbol with its file's imports and sibling symbols in one call.
|
|
192
|
-
* Saves 2-3 round-trips vs get_symbol + search_text(imports) + get_file_outline.
|
|
193
|
-
*/
|
|
194
|
-
export declare function getContextBundle(repo: string, symbolName: string): Promise<ContextBundle | null>;
|
|
195
|
-
export interface DeadCodeCandidate {
|
|
196
|
-
name: string;
|
|
197
|
-
kind: SymbolKind;
|
|
198
|
-
file: string;
|
|
199
|
-
start_line: number;
|
|
200
|
-
end_line: number;
|
|
201
|
-
reason: string;
|
|
202
|
-
}
|
|
203
|
-
export interface DeadCodeResult {
|
|
204
|
-
candidates: DeadCodeCandidate[];
|
|
205
|
-
scanned_symbols: number;
|
|
206
|
-
scanned_files: number;
|
|
207
|
-
/**
|
|
208
|
-
* The RESULT LIST was cut short — there are more dead-looking symbols than are shown.
|
|
209
|
-
* The listed candidates are still as trustworthy as `coverage` says; there are just more.
|
|
210
|
-
*/
|
|
211
|
-
truncated?: boolean;
|
|
212
|
-
/**
|
|
213
|
-
* Whether the reference scan actually saw the whole repository.
|
|
214
|
-
*
|
|
215
|
-
* This is the field that decides whether a candidate may be deleted. "Dead" here means
|
|
216
|
-
* "no reference found in the files I read" — if some files were never read, a symbol used
|
|
217
|
-
* only from those files looks exactly like a genuinely unused one. `truncated` used to carry
|
|
218
|
-
* this meaning as well as the list-length one; an agent reading a single boolean naturally
|
|
219
|
-
* takes the harmless reading ("the list is cut off") and acts on the candidates, which is
|
|
220
|
-
* the wrong call precisely when the scan was short.
|
|
221
|
-
*
|
|
222
|
-
* `complete` is the only status under which an empty or short candidate list is evidence
|
|
223
|
-
* about the code rather than about the scan.
|
|
224
|
-
*/
|
|
225
|
-
coverage: {
|
|
226
|
-
status: "complete" | "partial";
|
|
227
|
-
files_indexed: number;
|
|
228
|
-
files_read: number;
|
|
229
|
-
/** Files the scan stopped before reaching (MAX_SCAN_FILES cap). */
|
|
230
|
-
files_skipped_by_cap?: number;
|
|
231
|
-
/** Files that were indexed but could not be read now (deleted, permissions, races). */
|
|
232
|
-
files_unreadable?: number;
|
|
233
|
-
detail?: string;
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Find potentially dead code: exported symbols with 0 references outside their own file.
|
|
238
|
-
* Scans all indexed files for word-boundary matches of each exported symbol name.
|
|
239
|
-
*
|
|
240
|
-
* F14 fixes (2026-05-05):
|
|
241
|
-
* - Test files are now ALWAYS scanned for references regardless of
|
|
242
|
-
* `include_tests`. The flag now gates only candidate selection (whether
|
|
243
|
-
* test-internal exports can themselves be flagged dead). Symbols used
|
|
244
|
-
* only in tests are no longer false-positive dead.
|
|
245
|
-
* - Re-exports via `export * from './x'` and `export { Y } from './x'`
|
|
246
|
-
* now mark `./x` as live; previously the lack of textual mention in the
|
|
247
|
-
* barrel made every barrel-forwarded symbol look dead.
|
|
248
|
-
* - MAX_SCAN_FILES raised 2000 → 5000; truncation now surfaces in the
|
|
249
|
-
* `truncated` field so callers can react.
|
|
250
|
-
*/
|
|
251
|
-
export declare function findDeadCode(repo: string, options?: {
|
|
252
|
-
file_pattern?: string | undefined;
|
|
253
|
-
include_tests?: boolean | undefined;
|
|
254
|
-
}): Promise<DeadCodeResult>;
|
|
255
|
-
export interface UnusedImport {
|
|
256
|
-
file: string;
|
|
257
|
-
line: number;
|
|
258
|
-
import_text: string;
|
|
259
|
-
imported_name: string;
|
|
260
|
-
}
|
|
261
|
-
export interface UnusedImportsResult {
|
|
262
|
-
unused: UnusedImport[];
|
|
263
|
-
scanned_files: number;
|
|
264
|
-
truncated?: boolean;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Find imports whose imported names are never referenced in the file body.
|
|
268
|
-
* Supports ES module named imports: import { A, B } from '...'
|
|
4
|
+
* Deferred tool loaders and external consumers import this exact module path.
|
|
5
|
+
* Keep exports explicit so internal split helpers cannot accidentally become public.
|
|
269
6
|
*/
|
|
270
|
-
export
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
7
|
+
export { AmbiguousSymbolIdError, extractSymbolNameGuess, findSimilarSymbols, getSymbol, getSymbols, isAmbiguousSymbolIdError, resolveSymbolIdExact, } from "./symbol-lookup-tools.js";
|
|
8
|
+
export type { SymbolIdAmbiguity } from "./symbol-lookup-tools.js";
|
|
9
|
+
export { findReferences, findReferencesBatch, } from "./symbol-reference-tools.js";
|
|
10
|
+
export type { ReferenceScanCoverage, ReferenceScanSink, } from "./symbol-reference-tools.js";
|
|
11
|
+
export { findAndShow, formatBundleCompact, formatRefsCompact, formatSymbolCompact, formatSymbolsCompact, getContextBundle, } from "./symbol-context-tools.js";
|
|
12
|
+
export type { ContextBundle, ReactContext, } from "./symbol-context-tools.js";
|
|
13
|
+
export { findDeadCode, findUnusedImports, } from "./symbol-analysis-tools.js";
|
|
14
|
+
export type { DeadCodeCandidate, DeadCodeResult, UnusedImport, UnusedImportsResult, } from "./symbol-analysis-tools.js";
|
|
274
15
|
//# sourceMappingURL=symbol-tools.d.ts.map
|