spectra-cli 4.1.1 → 4.3.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 +12 -5
- package/dist/.spectra-build-meta.json +9 -0
- package/dist/adapters/go-adapter.d.ts.map +1 -1
- package/dist/adapters/go-adapter.js +2 -0
- package/dist/adapters/go-adapter.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/java-adapter.d.ts.map +1 -1
- package/dist/adapters/java-adapter.js +2 -0
- package/dist/adapters/java-adapter.js.map +1 -1
- package/dist/adapters/language-adapter.d.ts +42 -9
- package/dist/adapters/language-adapter.d.ts.map +1 -1
- package/dist/adapters/python-adapter.d.ts +34 -6
- package/dist/adapters/python-adapter.d.ts.map +1 -1
- package/dist/adapters/python-adapter.js +168 -61
- package/dist/adapters/python-adapter.js.map +1 -1
- package/dist/adapters/ts-js-adapter.d.ts +13 -5
- package/dist/adapters/ts-js-adapter.d.ts.map +1 -1
- package/dist/adapters/ts-js-adapter.js +55 -14
- package/dist/adapters/ts-js-adapter.js.map +1 -1
- package/dist/batch/batch-orchestrator.d.ts +74 -5
- package/dist/batch/batch-orchestrator.d.ts.map +1 -1
- package/dist/batch/batch-orchestrator.js +583 -70
- package/dist/batch/batch-orchestrator.js.map +1 -1
- package/dist/batch/delta-regenerator.d.ts +2 -2
- package/dist/batch/delta-regenerator.d.ts.map +1 -1
- package/dist/batch/delta-regenerator.js +21 -28
- package/dist/batch/delta-regenerator.js.map +1 -1
- package/dist/batch/module-grouper.d.ts +9 -2
- package/dist/batch/module-grouper.d.ts.map +1 -1
- package/dist/batch/module-grouper.js +3 -1
- package/dist/batch/module-grouper.js.map +1 -1
- package/dist/batch/regen-plan.d.ts +78 -0
- package/dist/batch/regen-plan.d.ts.map +1 -0
- package/dist/batch/regen-plan.js +93 -0
- package/dist/batch/regen-plan.js.map +1 -0
- package/dist/cli/commands/batch.d.ts.map +1 -1
- package/dist/cli/commands/batch.js +36 -8
- package/dist/cli/commands/batch.js.map +1 -1
- package/dist/cli/commands/graph.js +1 -1
- package/dist/cli/commands/graph.js.map +1 -1
- package/dist/cli/commands/index.d.ts +8 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +274 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +3 -1
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/scaffold-kb.d.ts +9 -0
- package/dist/cli/commands/scaffold-kb.d.ts.map +1 -0
- package/dist/cli/commands/scaffold-kb.js +179 -0
- package/dist/cli/commands/scaffold-kb.js.map +1 -0
- package/dist/cli/index.js +33 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/error-handler.d.ts +0 -6
- package/dist/cli/utils/error-handler.d.ts.map +1 -1
- package/dist/cli/utils/error-handler.js +0 -13
- package/dist/cli/utils/error-handler.js.map +1 -1
- package/dist/cli/utils/parse-args.d.ts +55 -3
- package/dist/cli/utils/parse-args.d.ts.map +1 -1
- package/dist/cli/utils/parse-args.js +176 -13
- package/dist/cli/utils/parse-args.js.map +1 -1
- package/dist/cli/version-meta.d.ts +16 -0
- package/dist/cli/version-meta.d.ts.map +1 -0
- package/dist/cli/version-meta.js +28 -0
- package/dist/cli/version-meta.js.map +1 -0
- package/dist/core/ast-analyzer.d.ts.map +1 -1
- package/dist/core/ast-analyzer.js +75 -5
- package/dist/core/ast-analyzer.js.map +1 -1
- package/dist/core/import-resolver.d.ts +93 -0
- package/dist/core/import-resolver.d.ts.map +1 -0
- package/dist/core/import-resolver.js +414 -0
- package/dist/core/import-resolver.js.map +1 -0
- package/dist/core/query-mappers/base-mapper.d.ts +13 -0
- package/dist/core/query-mappers/base-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/go-mapper.d.ts +68 -0
- package/dist/core/query-mappers/go-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/go-mapper.js +421 -0
- package/dist/core/query-mappers/go-mapper.js.map +1 -1
- package/dist/core/query-mappers/java-mapper.d.ts +196 -0
- package/dist/core/query-mappers/java-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/java-mapper.js +600 -0
- package/dist/core/query-mappers/java-mapper.js.map +1 -1
- package/dist/core/query-mappers/python-mapper.d.ts +55 -0
- package/dist/core/query-mappers/python-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/python-mapper.js +273 -0
- package/dist/core/query-mappers/python-mapper.js.map +1 -1
- package/dist/core/query-mappers/typescript-mapper.d.ts +102 -0
- package/dist/core/query-mappers/typescript-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/typescript-mapper.js +470 -0
- package/dist/core/query-mappers/typescript-mapper.js.map +1 -1
- package/dist/core/single-spec-orchestrator.d.ts +21 -0
- package/dist/core/single-spec-orchestrator.d.ts.map +1 -1
- package/dist/core/single-spec-orchestrator.js +187 -23
- package/dist/core/single-spec-orchestrator.js.map +1 -1
- package/dist/core/skeleton-hash.d.ts +33 -0
- package/dist/core/skeleton-hash.d.ts.map +1 -0
- package/dist/core/skeleton-hash.js +76 -0
- package/dist/core/skeleton-hash.js.map +1 -0
- package/dist/core/tree-sitter-analyzer.d.ts +7 -0
- package/dist/core/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/core/tree-sitter-analyzer.js +32 -1
- package/dist/core/tree-sitter-analyzer.js.map +1 -1
- package/dist/core/tree-sitter-fallback.d.ts +12 -4
- package/dist/core/tree-sitter-fallback.d.ts.map +1 -1
- package/dist/core/tree-sitter-fallback.js +160 -12
- package/dist/core/tree-sitter-fallback.js.map +1 -1
- package/dist/extraction/extraction-types.d.ts +25 -25
- package/dist/extraction/image-extractor.d.ts.map +1 -1
- package/dist/extraction/image-extractor.js +3 -1
- package/dist/extraction/image-extractor.js.map +1 -1
- package/dist/extraction/markdown-extractor.d.ts.map +1 -1
- package/dist/extraction/markdown-extractor.js +3 -1
- package/dist/extraction/markdown-extractor.js.map +1 -1
- package/dist/generator/frontmatter.d.ts +5 -0
- package/dist/generator/frontmatter.d.ts.map +1 -1
- package/dist/generator/frontmatter.js +4 -0
- package/dist/generator/frontmatter.js.map +1 -1
- package/dist/generator/index-generator.d.ts +3 -3
- package/dist/generator/index-generator.d.ts.map +1 -1
- package/dist/generator/index-generator.js +1 -1
- package/dist/generator/index-generator.js.map +1 -1
- package/dist/graph/directory-graph.d.ts +14 -4
- package/dist/graph/directory-graph.d.ts.map +1 -1
- package/dist/graph/directory-graph.js +71 -128
- package/dist/graph/directory-graph.js.map +1 -1
- package/dist/graph/mermaid-renderer.d.ts +8 -5
- package/dist/graph/mermaid-renderer.d.ts.map +1 -1
- package/dist/graph/mermaid-renderer.js +3 -3
- package/dist/graph/mermaid-renderer.js.map +1 -1
- package/dist/graph/topological-sort.d.ts +13 -6
- package/dist/graph/topological-sort.d.ts.map +1 -1
- package/dist/graph/topological-sort.js +2 -2
- package/dist/graph/topological-sort.js.map +1 -1
- package/dist/kb-mcp/index.d.ts +14 -0
- package/dist/kb-mcp/index.d.ts.map +1 -0
- package/dist/kb-mcp/index.js +24 -0
- package/dist/kb-mcp/index.js.map +1 -0
- package/dist/kb-mcp/lib/kb-error.d.ts +21 -0
- package/dist/kb-mcp/lib/kb-error.d.ts.map +1 -0
- package/dist/kb-mcp/lib/kb-error.js +28 -0
- package/dist/kb-mcp/lib/kb-error.js.map +1 -0
- package/dist/kb-mcp/lib/kb-locator.d.ts +58 -0
- package/dist/kb-mcp/lib/kb-locator.d.ts.map +1 -0
- package/dist/kb-mcp/lib/kb-locator.js +85 -0
- package/dist/kb-mcp/lib/kb-locator.js.map +1 -0
- package/dist/kb-mcp/lib/result-merger.d.ts +35 -0
- package/dist/kb-mcp/lib/result-merger.d.ts.map +1 -0
- package/dist/kb-mcp/lib/result-merger.js +64 -0
- package/dist/kb-mcp/lib/result-merger.js.map +1 -0
- package/dist/kb-mcp/server.d.ts +12 -0
- package/dist/kb-mcp/server.d.ts.map +1 -0
- package/dist/kb-mcp/server.js +29 -0
- package/dist/kb-mcp/server.js.map +1 -0
- package/dist/kb-mcp/tools/kb-api-lookup.d.ts +28 -0
- package/dist/kb-mcp/tools/kb-api-lookup.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-api-lookup.js +237 -0
- package/dist/kb-mcp/tools/kb-api-lookup.js.map +1 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.d.ts +20 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.js +92 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.js.map +1 -0
- package/dist/kb-mcp/tools/kb-search.d.ts +23 -0
- package/dist/kb-mcp/tools/kb-search.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-search.js +126 -0
- package/dist/kb-mcp/tools/kb-search.js.map +1 -0
- package/dist/knowledge-graph/call-resolver.d.ts +64 -0
- package/dist/knowledge-graph/call-resolver.d.ts.map +1 -0
- package/dist/knowledge-graph/call-resolver.js +323 -0
- package/dist/knowledge-graph/call-resolver.js.map +1 -0
- package/dist/knowledge-graph/import-resolver.d.ts +39 -0
- package/dist/knowledge-graph/import-resolver.d.ts.map +1 -0
- package/dist/knowledge-graph/import-resolver.js +214 -0
- package/dist/knowledge-graph/import-resolver.js.map +1 -0
- package/dist/knowledge-graph/incremental.d.ts +131 -0
- package/dist/knowledge-graph/incremental.d.ts.map +1 -0
- package/dist/knowledge-graph/incremental.js +432 -0
- package/dist/knowledge-graph/incremental.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +85 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +198 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/module-derivation.d.ts +252 -0
- package/dist/knowledge-graph/module-derivation.d.ts.map +1 -0
- package/dist/knowledge-graph/module-derivation.js +418 -0
- package/dist/knowledge-graph/module-derivation.js.map +1 -0
- package/dist/knowledge-graph/persistence.d.ts +310 -0
- package/dist/knowledge-graph/persistence.d.ts.map +1 -0
- package/dist/knowledge-graph/persistence.js +280 -0
- package/dist/knowledge-graph/persistence.js.map +1 -0
- package/dist/knowledge-graph/query-helpers.d.ts +191 -0
- package/dist/knowledge-graph/query-helpers.d.ts.map +1 -0
- package/dist/knowledge-graph/query-helpers.js +559 -0
- package/dist/knowledge-graph/query-helpers.js.map +1 -0
- package/dist/knowledge-graph/relativize.d.ts +51 -0
- package/dist/knowledge-graph/relativize.d.ts.map +1 -0
- package/dist/knowledge-graph/relativize.js +104 -0
- package/dist/knowledge-graph/relativize.js.map +1 -0
- package/dist/knowledge-graph/unified-graph.d.ts +310 -0
- package/dist/knowledge-graph/unified-graph.d.ts.map +1 -0
- package/dist/knowledge-graph/unified-graph.js +182 -0
- package/dist/knowledge-graph/unified-graph.js.map +1 -0
- package/dist/mcp/agent-context-tools.d.ts +53 -0
- package/dist/mcp/agent-context-tools.d.ts.map +1 -0
- package/dist/mcp/agent-context-tools.js +806 -0
- package/dist/mcp/agent-context-tools.js.map +1 -0
- package/dist/mcp/file-nav-tools.d.ts +42 -0
- package/dist/mcp/file-nav-tools.d.ts.map +1 -0
- package/dist/mcp/file-nav-tools.js +318 -0
- package/dist/mcp/file-nav-tools.js.map +1 -0
- package/dist/mcp/graph-tools.d.ts +22 -0
- package/dist/mcp/graph-tools.d.ts.map +1 -1
- package/dist/mcp/graph-tools.js +204 -133
- package/dist/mcp/graph-tools.js.map +1 -1
- package/dist/mcp/lib/file-nav-helpers.d.ts +128 -0
- package/dist/mcp/lib/file-nav-helpers.d.ts.map +1 -0
- package/dist/mcp/lib/file-nav-helpers.js +305 -0
- package/dist/mcp/lib/file-nav-helpers.js.map +1 -0
- package/dist/mcp/lib/response-helpers.d.ts +67 -0
- package/dist/mcp/lib/response-helpers.d.ts.map +1 -0
- package/dist/mcp/lib/response-helpers.js +103 -0
- package/dist/mcp/lib/response-helpers.js.map +1 -0
- package/dist/mcp/lib/telemetry.d.ts +69 -0
- package/dist/mcp/lib/telemetry.d.ts.map +1 -0
- package/dist/mcp/lib/telemetry.js +113 -0
- package/dist/mcp/lib/telemetry.js.map +1 -0
- package/dist/mcp/lib/tool-response.d.ts +46 -0
- package/dist/mcp/lib/tool-response.d.ts.map +1 -0
- package/dist/mcp/lib/tool-response.js +83 -0
- package/dist/mcp/lib/tool-response.js.map +1 -0
- package/dist/mcp/server.d.ts +14 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +216 -158
- package/dist/mcp/server.js.map +1 -1
- package/dist/models/call-site.d.ts +68 -0
- package/dist/models/call-site.d.ts.map +1 -0
- package/dist/models/call-site.js +60 -0
- package/dist/models/call-site.js.map +1 -0
- package/dist/models/code-skeleton.d.ts +80 -6
- package/dist/models/code-skeleton.d.ts.map +1 -1
- package/dist/models/code-skeleton.js +30 -0
- package/dist/models/code-skeleton.js.map +1 -1
- package/dist/models/drift-item.d.ts +4 -4
- package/dist/models/module-spec.d.ts +173 -94
- package/dist/models/module-spec.d.ts.map +1 -1
- package/dist/models/module-spec.js +6 -0
- package/dist/models/module-spec.js.map +1 -1
- package/dist/panoramic/adr-decision-pipeline.d.ts +53 -0
- package/dist/panoramic/adr-decision-pipeline.d.ts.map +1 -0
- package/dist/panoramic/adr-decision-pipeline.js +685 -0
- package/dist/panoramic/adr-decision-pipeline.js.map +1 -0
- package/dist/panoramic/api-surface-generator.d.ts +56 -0
- package/dist/panoramic/api-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/api-surface-generator.js +1671 -0
- package/dist/panoramic/api-surface-generator.js.map +1 -0
- package/dist/panoramic/architecture-ir-builder.d.ts +19 -0
- package/dist/panoramic/architecture-ir-builder.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-builder.js +561 -0
- package/dist/panoramic/architecture-ir-builder.js.map +1 -0
- package/dist/panoramic/architecture-ir-exporters.d.ts +7 -0
- package/dist/panoramic/architecture-ir-exporters.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-exporters.js +183 -0
- package/dist/panoramic/architecture-ir-exporters.js.map +1 -0
- package/dist/panoramic/architecture-ir-generator.d.ts +36 -0
- package/dist/panoramic/architecture-ir-generator.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-generator.js +51 -0
- package/dist/panoramic/architecture-ir-generator.js.map +1 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.d.ts +6 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.js +98 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.js.map +1 -0
- package/dist/panoramic/architecture-ir-model.d.ts +87 -0
- package/dist/panoramic/architecture-ir-model.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-model.js +20 -0
- package/dist/panoramic/architecture-ir-model.js.map +1 -0
- package/dist/panoramic/architecture-narrative.d.ts +68 -0
- package/dist/panoramic/architecture-narrative.d.ts.map +1 -0
- package/dist/panoramic/architecture-narrative.js +401 -0
- package/dist/panoramic/architecture-narrative.js.map +1 -0
- package/dist/panoramic/architecture-overview-generator.d.ts +31 -0
- package/dist/panoramic/architecture-overview-generator.d.ts.map +1 -0
- package/dist/panoramic/architecture-overview-generator.js +454 -0
- package/dist/panoramic/architecture-overview-generator.js.map +1 -0
- package/dist/panoramic/architecture-overview-model.d.ts +77 -0
- package/dist/panoramic/architecture-overview-model.d.ts.map +1 -0
- package/dist/panoramic/architecture-overview-model.js +31 -0
- package/dist/panoramic/architecture-overview-model.js.map +1 -0
- package/dist/panoramic/batch-project-docs.d.ts.map +1 -1
- package/dist/panoramic/batch-project-docs.js +4 -2
- package/dist/panoramic/batch-project-docs.js.map +1 -1
- package/dist/panoramic/builders/component-view-builder.d.ts +25 -1
- package/dist/panoramic/builders/component-view-builder.d.ts.map +1 -1
- package/dist/panoramic/builders/component-view-builder.js +83 -3
- package/dist/panoramic/builders/component-view-builder.js.map +1 -1
- package/dist/panoramic/builders/doc-graph-builder.d.ts +15 -2
- package/dist/panoramic/builders/doc-graph-builder.d.ts.map +1 -1
- package/dist/panoramic/builders/doc-graph-builder.js +20 -0
- package/dist/panoramic/builders/doc-graph-builder.js.map +1 -1
- package/dist/panoramic/component-view-builder.d.ts +17 -0
- package/dist/panoramic/component-view-builder.d.ts.map +1 -0
- package/dist/panoramic/component-view-builder.js +652 -0
- package/dist/panoramic/component-view-builder.js.map +1 -0
- package/dist/panoramic/component-view-model.d.ts +127 -0
- package/dist/panoramic/component-view-model.d.ts.map +1 -0
- package/dist/panoramic/component-view-model.js +65 -0
- package/dist/panoramic/component-view-model.js.map +1 -0
- package/dist/panoramic/config-reference-generator.d.ts +78 -0
- package/dist/panoramic/config-reference-generator.d.ts.map +1 -0
- package/dist/panoramic/config-reference-generator.js +199 -0
- package/dist/panoramic/config-reference-generator.js.map +1 -0
- package/dist/panoramic/coverage-auditor.d.ts +95 -0
- package/dist/panoramic/coverage-auditor.d.ts.map +1 -0
- package/dist/panoramic/coverage-auditor.js +290 -0
- package/dist/panoramic/coverage-auditor.js.map +1 -0
- package/dist/panoramic/cross-package-analyzer.d.ts +112 -0
- package/dist/panoramic/cross-package-analyzer.d.ts.map +1 -0
- package/dist/panoramic/cross-package-analyzer.js +258 -0
- package/dist/panoramic/cross-package-analyzer.js.map +1 -0
- package/dist/panoramic/data-model-generator.d.ts +528 -0
- package/dist/panoramic/data-model-generator.d.ts.map +1 -0
- package/dist/panoramic/data-model-generator.js +647 -0
- package/dist/panoramic/data-model-generator.js.map +1 -0
- package/dist/panoramic/doc-graph-builder.d.ts +80 -0
- package/dist/panoramic/doc-graph-builder.d.ts.map +1 -0
- package/dist/panoramic/doc-graph-builder.js +352 -0
- package/dist/panoramic/doc-graph-builder.js.map +1 -0
- package/dist/panoramic/docs-bundle-manifest-reader.d.ts +26 -0
- package/dist/panoramic/docs-bundle-manifest-reader.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-manifest-reader.js +106 -0
- package/dist/panoramic/docs-bundle-manifest-reader.js.map +1 -0
- package/dist/panoramic/docs-bundle-orchestrator.d.ts +14 -0
- package/dist/panoramic/docs-bundle-orchestrator.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-orchestrator.js +538 -0
- package/dist/panoramic/docs-bundle-orchestrator.js.map +1 -0
- package/dist/panoramic/docs-bundle-profiles.d.ts +4 -0
- package/dist/panoramic/docs-bundle-profiles.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-profiles.js +82 -0
- package/dist/panoramic/docs-bundle-profiles.js.map +1 -0
- package/dist/panoramic/docs-bundle-types.d.ts +94 -0
- package/dist/panoramic/docs-bundle-types.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-types.js +10 -0
- package/dist/panoramic/docs-bundle-types.js.map +1 -0
- package/dist/panoramic/docs-quality-evaluator.d.ts +31 -0
- package/dist/panoramic/docs-quality-evaluator.d.ts.map +1 -0
- package/dist/panoramic/docs-quality-evaluator.js +941 -0
- package/dist/panoramic/docs-quality-evaluator.js.map +1 -0
- package/dist/panoramic/docs-quality-model.d.ts +125 -0
- package/dist/panoramic/docs-quality-model.d.ts.map +1 -0
- package/dist/panoramic/docs-quality-model.js +166 -0
- package/dist/panoramic/docs-quality-model.js.map +1 -0
- package/dist/panoramic/dynamic-scenarios-builder.d.ts +18 -0
- package/dist/panoramic/dynamic-scenarios-builder.d.ts.map +1 -0
- package/dist/panoramic/dynamic-scenarios-builder.js +316 -0
- package/dist/panoramic/dynamic-scenarios-builder.js.map +1 -0
- package/dist/panoramic/event-surface-generator.d.ts +52 -0
- package/dist/panoramic/event-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/event-surface-generator.js +507 -0
- package/dist/panoramic/event-surface-generator.js.map +1 -0
- package/dist/panoramic/generator-registry.d.ts +1 -1
- package/dist/panoramic/generator-registry.d.ts.map +1 -1
- package/dist/panoramic/generator-registry.js +5 -2
- package/dist/panoramic/generator-registry.js.map +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.d.ts +5 -5
- package/dist/panoramic/generators/cross-package-analyzer.d.ts.map +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.js +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.js.map +1 -1
- package/dist/panoramic/generators/data-model-generator.d.ts +27 -27
- package/dist/panoramic/graph/confidence-mapper.d.ts +18 -0
- package/dist/panoramic/graph/confidence-mapper.d.ts.map +1 -1
- package/dist/panoramic/graph/confidence-mapper.js +26 -0
- package/dist/panoramic/graph/confidence-mapper.js.map +1 -1
- package/dist/panoramic/graph/graph-builder.d.ts +72 -2
- package/dist/panoramic/graph/graph-builder.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-builder.js +330 -46
- package/dist/panoramic/graph/graph-builder.js.map +1 -1
- package/dist/panoramic/graph/graph-paths.d.ts +8 -0
- package/dist/panoramic/graph/graph-paths.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-paths.js +10 -0
- package/dist/panoramic/graph/graph-paths.js.map +1 -1
- package/dist/panoramic/graph/graph-query.d.ts +49 -2
- package/dist/panoramic/graph/graph-query.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-query.js +117 -19
- package/dist/panoramic/graph/graph-query.js.map +1 -1
- package/dist/panoramic/graph/graph-types.d.ts +32 -3
- package/dist/panoramic/graph/graph-types.d.ts.map +1 -1
- package/dist/panoramic/graph/index.d.ts +2 -1
- package/dist/panoramic/graph/index.d.ts.map +1 -1
- package/dist/panoramic/graph/index.js +1 -1
- package/dist/panoramic/graph/index.js.map +1 -1
- package/dist/panoramic/hyperedges/schema.d.ts +6 -6
- package/dist/panoramic/interface-surface-generator.d.ts +50 -0
- package/dist/panoramic/interface-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/interface-surface-generator.js +388 -0
- package/dist/panoramic/interface-surface-generator.js.map +1 -0
- package/dist/panoramic/interfaces.d.ts +2 -2
- package/dist/panoramic/mock-readme-generator.d.ts +90 -0
- package/dist/panoramic/mock-readme-generator.d.ts.map +1 -0
- package/dist/panoramic/mock-readme-generator.js +111 -0
- package/dist/panoramic/mock-readme-generator.js.map +1 -0
- package/dist/panoramic/models/component-view-model.d.ts +1 -1
- package/dist/panoramic/models/component-view-model.d.ts.map +1 -1
- package/dist/panoramic/models/component-view-model.js.map +1 -1
- package/dist/panoramic/narrative-provenance-adapter.d.ts +8 -0
- package/dist/panoramic/narrative-provenance-adapter.d.ts.map +1 -0
- package/dist/panoramic/narrative-provenance-adapter.js +99 -0
- package/dist/panoramic/narrative-provenance-adapter.js.map +1 -0
- package/dist/panoramic/parser-registry.d.ts +1 -1
- package/dist/panoramic/parser-registry.js +1 -1
- package/dist/panoramic/parsers/types.d.ts +6 -6
- package/dist/panoramic/pattern-hints-generator.d.ts +28 -0
- package/dist/panoramic/pattern-hints-generator.d.ts.map +1 -0
- package/dist/panoramic/pattern-hints-generator.js +218 -0
- package/dist/panoramic/pattern-hints-generator.js.map +1 -0
- package/dist/panoramic/pattern-hints-model.d.ts +89 -0
- package/dist/panoramic/pattern-hints-model.d.ts.map +1 -0
- package/dist/panoramic/pattern-hints-model.js +61 -0
- package/dist/panoramic/pattern-hints-model.js.map +1 -0
- package/dist/panoramic/pattern-knowledge-base.d.ts +31 -0
- package/dist/panoramic/pattern-knowledge-base.d.ts.map +1 -0
- package/dist/panoramic/pattern-knowledge-base.js +407 -0
- package/dist/panoramic/pattern-knowledge-base.js.map +1 -0
- package/dist/panoramic/pipelines/adr-evidence-verifier.d.ts.map +1 -1
- package/dist/panoramic/pipelines/adr-evidence-verifier.js +1 -29
- package/dist/panoramic/pipelines/adr-evidence-verifier.js.map +1 -1
- package/dist/panoramic/pipelines/coverage-auditor.d.ts.map +1 -1
- package/dist/panoramic/pipelines/coverage-auditor.js +4 -2
- package/dist/panoramic/pipelines/coverage-auditor.js.map +1 -1
- package/dist/panoramic/pipelines/docs-bundle-orchestrator.js +13 -6
- package/dist/panoramic/pipelines/docs-bundle-orchestrator.js.map +1 -1
- package/dist/panoramic/pipelines/product-ux-docs.d.ts +5 -0
- package/dist/panoramic/pipelines/product-ux-docs.d.ts.map +1 -1
- package/dist/panoramic/pipelines/product-ux-docs.js +34 -6
- package/dist/panoramic/pipelines/product-ux-docs.js.map +1 -1
- package/dist/panoramic/product-ux-docs.d.ts +104 -0
- package/dist/panoramic/product-ux-docs.d.ts.map +1 -0
- package/dist/panoramic/product-ux-docs.js +817 -0
- package/dist/panoramic/product-ux-docs.js.map +1 -0
- package/dist/panoramic/qa/__tests__/citation.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/citation.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/citation.test.js +193 -0
- package/dist/panoramic/qa/__tests__/citation.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.js +154 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.js +148 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/index.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/index.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/index.test.js +246 -0
- package/dist/panoramic/qa/__tests__/index.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.js +168 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.js +150 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.js +296 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.js +136 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.js.map +1 -0
- package/dist/panoramic/qa/index.d.ts.map +1 -1
- package/dist/panoramic/qa/index.js +10 -3
- package/dist/panoramic/qa/index.js.map +1 -1
- package/dist/panoramic/query.d.ts +1 -0
- package/dist/panoramic/query.d.ts.map +1 -1
- package/dist/panoramic/query.js +5 -0
- package/dist/panoramic/query.js.map +1 -1
- package/dist/panoramic/runtime-topology-generator.d.ts +77 -0
- package/dist/panoramic/runtime-topology-generator.d.ts.map +1 -0
- package/dist/panoramic/runtime-topology-generator.js +676 -0
- package/dist/panoramic/runtime-topology-generator.js.map +1 -0
- package/dist/panoramic/runtime-topology-model.d.ts +145 -0
- package/dist/panoramic/runtime-topology-model.d.ts.map +1 -0
- package/dist/panoramic/runtime-topology-model.js +300 -0
- package/dist/panoramic/runtime-topology-model.js.map +1 -0
- package/dist/panoramic/troubleshooting-generator.d.ts +51 -0
- package/dist/panoramic/troubleshooting-generator.d.ts.map +1 -0
- package/dist/panoramic/troubleshooting-generator.js +451 -0
- package/dist/panoramic/troubleshooting-generator.js.map +1 -0
- package/dist/panoramic/utils/text-segmenter.d.ts +15 -0
- package/dist/panoramic/utils/text-segmenter.d.ts.map +1 -1
- package/dist/panoramic/utils/text-segmenter.js +38 -0
- package/dist/panoramic/utils/text-segmenter.js.map +1 -1
- package/dist/panoramic/workspace-index-generator.d.ts +148 -0
- package/dist/panoramic/workspace-index-generator.d.ts.map +1 -0
- package/dist/panoramic/workspace-index-generator.js +497 -0
- package/dist/panoramic/workspace-index-generator.js.map +1 -0
- package/dist/runtime-bootstrap.d.ts +9 -0
- package/dist/runtime-bootstrap.d.ts.map +1 -0
- package/dist/runtime-bootstrap.js +33 -0
- package/dist/runtime-bootstrap.js.map +1 -0
- package/dist/scaffold-kb/api-entities-serializer.d.ts +12 -0
- package/dist/scaffold-kb/api-entities-serializer.d.ts.map +1 -0
- package/dist/scaffold-kb/api-entities-serializer.js +144 -0
- package/dist/scaffold-kb/api-entities-serializer.js.map +1 -0
- package/dist/scaffold-kb/arbitration.d.ts +44 -0
- package/dist/scaffold-kb/arbitration.d.ts.map +1 -0
- package/dist/scaffold-kb/arbitration.js +144 -0
- package/dist/scaffold-kb/arbitration.js.map +1 -0
- package/dist/scaffold-kb/chunk-splitter.d.ts +20 -0
- package/dist/scaffold-kb/chunk-splitter.d.ts.map +1 -0
- package/dist/scaffold-kb/chunk-splitter.js +309 -0
- package/dist/scaffold-kb/chunk-splitter.js.map +1 -0
- package/dist/scaffold-kb/doc-graph-builder.d.ts +26 -0
- package/dist/scaffold-kb/doc-graph-builder.d.ts.map +1 -0
- package/dist/scaffold-kb/doc-graph-builder.js +72 -0
- package/dist/scaffold-kb/doc-graph-builder.js.map +1 -0
- package/dist/scaffold-kb/entity-extractor.d.ts +40 -0
- package/dist/scaffold-kb/entity-extractor.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-extractor.js +0 -0
- package/dist/scaffold-kb/entity-extractor.js.map +1 -0
- package/dist/scaffold-kb/entity-heuristic.d.ts +14 -0
- package/dist/scaffold-kb/entity-heuristic.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-heuristic.js +107 -0
- package/dist/scaffold-kb/entity-heuristic.js.map +1 -0
- package/dist/scaffold-kb/entity-matcher.d.ts +20 -0
- package/dist/scaffold-kb/entity-matcher.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-matcher.js +53 -0
- package/dist/scaffold-kb/entity-matcher.js.map +1 -0
- package/dist/scaffold-kb/entity-util.d.ts +11 -0
- package/dist/scaffold-kb/entity-util.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-util.js +23 -0
- package/dist/scaffold-kb/entity-util.js.map +1 -0
- package/dist/scaffold-kb/evidence-envelope.d.ts +17 -0
- package/dist/scaffold-kb/evidence-envelope.d.ts.map +1 -0
- package/dist/scaffold-kb/evidence-envelope.js +32 -0
- package/dist/scaffold-kb/evidence-envelope.js.map +1 -0
- package/dist/scaffold-kb/index.d.ts +20 -0
- package/dist/scaffold-kb/index.d.ts.map +1 -0
- package/dist/scaffold-kb/index.js +102 -0
- package/dist/scaffold-kb/index.js.map +1 -0
- package/dist/scaffold-kb/ingest/ingest-core.d.ts +47 -0
- package/dist/scaffold-kb/ingest/ingest-core.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/ingest-core.js +231 -0
- package/dist/scaffold-kb/ingest/ingest-core.js.map +1 -0
- package/dist/scaffold-kb/ingest/office-parser.d.ts +33 -0
- package/dist/scaffold-kb/ingest/office-parser.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/office-parser.js +187 -0
- package/dist/scaffold-kb/ingest/office-parser.js.map +1 -0
- package/dist/scaffold-kb/ingest/url-fetcher.d.ts +43 -0
- package/dist/scaffold-kb/ingest/url-fetcher.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/url-fetcher.js +245 -0
- package/dist/scaffold-kb/ingest/url-fetcher.js.map +1 -0
- package/dist/scaffold-kb/ingester.d.ts +38 -0
- package/dist/scaffold-kb/ingester.d.ts.map +1 -0
- package/dist/scaffold-kb/ingester.js +261 -0
- package/dist/scaffold-kb/ingester.js.map +1 -0
- package/dist/scaffold-kb/injection-format.d.ts +25 -0
- package/dist/scaffold-kb/injection-format.d.ts.map +1 -0
- package/dist/scaffold-kb/injection-format.js +55 -0
- package/dist/scaffold-kb/injection-format.js.map +1 -0
- package/dist/scaffold-kb/kb-writer.d.ts +13 -0
- package/dist/scaffold-kb/kb-writer.d.ts.map +1 -0
- package/dist/scaffold-kb/kb-writer.js +69 -0
- package/dist/scaffold-kb/kb-writer.js.map +1 -0
- package/dist/scaffold-kb/keyword-extract.d.ts +16 -0
- package/dist/scaffold-kb/keyword-extract.d.ts.map +1 -0
- package/dist/scaffold-kb/keyword-extract.js +49 -0
- package/dist/scaffold-kb/keyword-extract.js.map +1 -0
- package/dist/scaffold-kb/query-sanitizer.d.ts +28 -0
- package/dist/scaffold-kb/query-sanitizer.d.ts.map +1 -0
- package/dist/scaffold-kb/query-sanitizer.js +38 -0
- package/dist/scaffold-kb/query-sanitizer.js.map +1 -0
- package/dist/scaffold-kb/recall-eval.d.ts +48 -0
- package/dist/scaffold-kb/recall-eval.d.ts.map +1 -0
- package/dist/scaffold-kb/recall-eval.js +55 -0
- package/dist/scaffold-kb/recall-eval.js.map +1 -0
- package/dist/scaffold-kb/schema-compat.d.ts +22 -0
- package/dist/scaffold-kb/schema-compat.d.ts.map +1 -0
- package/dist/scaffold-kb/schema-compat.js +32 -0
- package/dist/scaffold-kb/schema-compat.js.map +1 -0
- package/dist/scaffold-kb/search-core.d.ts +42 -0
- package/dist/scaffold-kb/search-core.d.ts.map +1 -0
- package/dist/scaffold-kb/search-core.js +89 -0
- package/dist/scaffold-kb/search-core.js.map +1 -0
- package/dist/scaffold-kb/sqlite-engine.d.ts +58 -0
- package/dist/scaffold-kb/sqlite-engine.d.ts.map +1 -0
- package/dist/scaffold-kb/sqlite-engine.js +61 -0
- package/dist/scaffold-kb/sqlite-engine.js.map +1 -0
- package/dist/scaffold-kb/sqlite-writer.d.ts +18 -0
- package/dist/scaffold-kb/sqlite-writer.d.ts.map +1 -0
- package/dist/scaffold-kb/sqlite-writer.js +76 -0
- package/dist/scaffold-kb/sqlite-writer.js.map +1 -0
- package/dist/scaffold-kb/tokenizer.d.ts +26 -0
- package/dist/scaffold-kb/tokenizer.d.ts.map +1 -0
- package/dist/scaffold-kb/tokenizer.js +97 -0
- package/dist/scaffold-kb/tokenizer.js.map +1 -0
- package/dist/scaffold-kb/types.d.ts +157 -0
- package/dist/scaffold-kb/types.d.ts.map +1 -0
- package/dist/scaffold-kb/types.js +5 -0
- package/dist/scaffold-kb/types.js.map +1 -0
- package/dist/utils/file-scanner.d.ts +15 -0
- package/dist/utils/file-scanner.d.ts.map +1 -1
- package/dist/utils/file-scanner.js +18 -1
- package/dist/utils/file-scanner.js.map +1 -1
- package/dist/utils/string-distance.d.ts +20 -0
- package/dist/utils/string-distance.d.ts.map +1 -0
- package/dist/utils/string-distance.js +38 -0
- package/dist/utils/string-distance.js.map +1 -0
- package/package.json +22 -3
- package/plugins/demo-kb-en/.claude-plugin/plugin.json +11 -0
- package/plugins/demo-kb-en/.mcp.json +8 -0
- package/plugins/demo-kb-en/FIXTURE.json +23 -0
- package/plugins/demo-kb-en/FIXTURE.md +53 -0
- package/plugins/demo-kb-en/ingest-samples/meeting-notes.md +13 -0
- package/plugins/demo-kb-en/kb/api-entities.json +3445 -0
- package/plugins/demo-kb-en/kb/chunks.sqlite +0 -0
- package/plugins/demo-kb-en/kb/doc-graph.json +113 -0
- package/plugins/demo-kb-zh/.claude-plugin/plugin.json +11 -0
- package/plugins/demo-kb-zh/.mcp.json +8 -0
- package/plugins/demo-kb-zh/FIXTURE.json +23 -0
- package/plugins/demo-kb-zh/FIXTURE.md +63 -0
- package/plugins/demo-kb-zh/ingest-samples/meeting-notes.md +13 -0
- package/plugins/demo-kb-zh/kb/api-entities.json +990 -0
- package/plugins/demo-kb-zh/kb/chunks.sqlite +0 -0
- package/plugins/demo-kb-zh/kb/doc-graph.json +113 -0
- package/plugins/spec-driver/.claude-plugin/plugin.json +1 -1
- package/plugins/spec-driver/README.md +50 -1
- package/plugins/spec-driver/agents/implement.md +20 -1
- package/plugins/spec-driver/agents/plan.md +20 -1
- package/plugins/spec-driver/agents/quality-review.md +20 -1
- package/plugins/spec-driver/agents/spec-review.md +20 -1
- package/plugins/spec-driver/agents/verify.md +108 -1
- package/plugins/spec-driver/config/orchestration.yaml +39 -31
- package/plugins/spec-driver/contracts/orchestration-overrides-contract.yaml +27 -0
- package/plugins/spec-driver/contracts/orchestration-schema.mjs +272 -227
- package/plugins/spec-driver/contracts/wrapper-source-of-truth.yaml +3 -0
- package/plugins/spec-driver/docs/customization.md +134 -0
- package/plugins/spec-driver/docs/spectra-mcp-integration.md +165 -0
- package/plugins/spec-driver/hooks/hooks.json +9 -0
- package/plugins/spec-driver/hooks/stop-fix-compliance-check.sh +36 -0
- package/plugins/spec-driver/lib/delegation-contract.mjs +84 -0
- package/plugins/spec-driver/lib/orchestration-resolver.mjs +49 -0
- package/plugins/spec-driver/lib/orchestrator.mjs +29 -1
- package/plugins/spec-driver/lib/preference-rules.mjs +96 -0
- package/plugins/spec-driver/scripts/codex-skills.sh +28 -28
- package/plugins/spec-driver/scripts/dev/spike-fix-compliance-e2e.mjs +130 -0
- package/plugins/spec-driver/scripts/fix-compliance-judge.mjs +415 -0
- package/plugins/spec-driver/scripts/generate-adoption-insights.mjs +48 -1
- package/plugins/spec-driver/scripts/goal-loop-cli.mjs +307 -0
- package/plugins/spec-driver/scripts/init-project.sh +56 -0
- package/plugins/spec-driver/scripts/kb-prequery.mjs +125 -0
- package/plugins/spec-driver/scripts/lib/config-schema.mjs +200 -94
- package/plugins/spec-driver/scripts/lib/ensure-gitignore.sh +277 -0
- package/plugins/spec-driver/scripts/lib/extract-wrapper-body.mjs +136 -0
- package/plugins/spec-driver/scripts/lib/fix-compliance-core.mjs +434 -0
- package/plugins/spec-driver/scripts/lib/fix-compliance-io.mjs +335 -0
- package/plugins/spec-driver/scripts/lib/goal-loop-core.mjs +783 -0
- package/plugins/spec-driver/scripts/lib/init-project-output.sh +28 -0
- package/plugins/spec-driver/scripts/lib/load-zod.mjs +62 -0
- package/plugins/spec-driver/scripts/lib/project-profile-resolver.mjs +141 -49
- package/plugins/spec-driver/scripts/lib/project-profile-schema.mjs +88 -54
- package/plugins/spec-driver/scripts/postinstall.sh +13 -1
- package/plugins/spec-driver/scripts/record-workflow-run.mjs +75 -0
- package/plugins/spec-driver/scripts/sync-delegation-contract.mjs +187 -0
- package/plugins/spec-driver/scripts/sync-preference-rules.mjs +148 -0
- package/plugins/spec-driver/scripts/validate-orchestrator-models.mjs +156 -0
- package/plugins/spec-driver/scripts/validate-wrapper-sources.mjs +46 -1
- package/plugins/spec-driver/skills/spec-driver-feature/SKILL.md +302 -0
- package/plugins/spec-driver/skills/spec-driver-fix/SKILL.md +97 -8
- package/plugins/spec-driver/skills/spec-driver-implement/SKILL.md +18 -0
- package/plugins/spec-driver/skills/spec-driver-refactor/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-resume/SKILL.md +12 -1
- package/plugins/spec-driver/skills/spec-driver-story/SKILL.md +30 -0
- package/plugins/spec-driver/templates/delegation-contract.md +27 -0
- package/plugins/spec-driver/templates/goal-loop-override-template.yaml +284 -0
- package/plugins/spec-driver/templates/preference-rules.md +39 -0
- package/plugins/spec-driver/templates/specify-base/project-context-template.yaml +10 -0
- package/plugins/spectra/.claude-plugin/plugin.json +1 -1
- package/plugins/spectra/README.md +48 -1
- package/plugins/spectra/hooks/post-commit.sh +40 -0
- package/templates/module-spec.hbs +1 -0
- package/templates/product-overview.hbs +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type Parser from 'web-tree-sitter';
|
|
6
6
|
import type { ExportSymbol, ImportReference, ParseError, Language } from '../../models/code-skeleton.js';
|
|
7
|
+
import type { CallSite } from '../../models/call-site.js';
|
|
7
8
|
import type { QueryMapper, MapperOptions } from './base-mapper.js';
|
|
8
9
|
export declare class TypeScriptMapper implements QueryMapper {
|
|
9
10
|
readonly language: Language;
|
|
@@ -14,8 +15,31 @@ export declare class TypeScriptMapper implements QueryMapper {
|
|
|
14
15
|
extractExports(tree: Parser.Tree, _source: string, _options?: MapperOptions): ExportSymbol[];
|
|
15
16
|
/**
|
|
16
17
|
* 从 AST tree 提取导入引用
|
|
18
|
+
*
|
|
19
|
+
* Feature 156 W1.0 v2 / CRIT-3:除 `import_statement` 外,还要遍历 AST 找
|
|
20
|
+
* - `call_expression` callee = `import` keyword → dynamic import
|
|
21
|
+
* - `call_expression` callee = `require` Identifier → commonjs-require
|
|
22
|
+
*
|
|
23
|
+
* 这样 tree-sitter 降级路径下 AC-11 的 dynamic / commonjs-require 边也能产出
|
|
24
|
+
* (ts-morph 主路径已在 ast-analyzer.ts 覆盖)。
|
|
17
25
|
*/
|
|
18
26
|
extractImports(tree: Parser.Tree, _source: string): ImportReference[];
|
|
27
|
+
/**
|
|
28
|
+
* 递归遍历 AST,识别 dynamic import / commonjs-require 调用并产出对应 ImportReference。
|
|
29
|
+
*
|
|
30
|
+
* 仅识别 AST 结构上的 call_expression 节点 — 不是文本正则,因此能避免 WARN-2 类
|
|
31
|
+
* 字符串 / 注释中的 "require('./x')" 误命中(tree-sitter parser 会把它们标识为
|
|
32
|
+
* string / comment 节点,不会形成 call_expression 子树)。
|
|
33
|
+
*/
|
|
34
|
+
private _collectCallExpressionImports;
|
|
35
|
+
/**
|
|
36
|
+
* 从 call_expression 节点派生 ImportReference(仅当 callee 为 `import` keyword 或
|
|
37
|
+
* `require` Identifier 时)。
|
|
38
|
+
*
|
|
39
|
+
* tree-sitter-typescript grammar 把动态 import callee 标识为 `import` 节点(type==='import'),
|
|
40
|
+
* require 调用则是 type==='identifier' && text==='require'。
|
|
41
|
+
*/
|
|
42
|
+
private _extractCallExpressionImport;
|
|
19
43
|
/**
|
|
20
44
|
* 从 AST tree 提取解析错误
|
|
21
45
|
*/
|
|
@@ -50,5 +74,83 @@ export declare class TypeScriptMapper implements QueryMapper {
|
|
|
50
74
|
private _extractImportStatement;
|
|
51
75
|
/** 递归收集 AST 中的 ERROR 节点 */
|
|
52
76
|
private _collectErrors;
|
|
77
|
+
/**
|
|
78
|
+
* 从 AST tree 提取函数调用点(Feature 152 P1)。
|
|
79
|
+
*
|
|
80
|
+
* 覆盖 6 种 calleeKind:free / member / cross-module / super / decorator / unresolved。
|
|
81
|
+
* TS extractor 不产出 dunder kind(CL-08)。
|
|
82
|
+
* 大文件 size guard(EC-14):source.length > 1MB 直接返回空数组。
|
|
83
|
+
*/
|
|
84
|
+
extractCallSites(tree: Parser.Tree, source: string): CallSite[];
|
|
85
|
+
/**
|
|
86
|
+
* 递归遍历 AST 抽取 call sites。
|
|
87
|
+
* callerContextStack 维护当前 function/class 嵌套作用域,进入 SCOPE_DEFINING_TYPES 时压栈。
|
|
88
|
+
* W-3 修复:handleDecorator 返回需跳过的子树节点,walker 在递归前跳过该节点。
|
|
89
|
+
*/
|
|
90
|
+
private _walkCallSites;
|
|
91
|
+
/**
|
|
92
|
+
* 推导当前节点的 callerContext 字符串。
|
|
93
|
+
*
|
|
94
|
+
* C-4 修复:匿名 arrow_function / function 也产生 `<arrow:line:col>` / `<fn:line:col>`,
|
|
95
|
+
* 确保内层 callback 不会错误归属外层 class method。
|
|
96
|
+
*/
|
|
97
|
+
private _deriveCallerContext;
|
|
98
|
+
/**
|
|
99
|
+
* 向上遍历 AST 找到最近的 class_declaration 节点,返回类名。
|
|
100
|
+
* 用于 method_definition 推导 callerContext(如 "Foo.bar")。
|
|
101
|
+
*/
|
|
102
|
+
private _findAncestorClassName;
|
|
103
|
+
/**
|
|
104
|
+
* 处理 call_expression 节点,分流 7 种形态(T-008):
|
|
105
|
+
* 1. dynamic import(`import('./x')`) → unresolved,calleeName='import'
|
|
106
|
+
* 2. super() 自调用 → super
|
|
107
|
+
* 3. eval/Function identifier → unresolved
|
|
108
|
+
* 4. 普通 identifier 调用 → free
|
|
109
|
+
* 5. C-3 修复:import().then() 链式 — 检测并跳过外层 .then 防双计数
|
|
110
|
+
* 6. member_expression → handleMemberCall
|
|
111
|
+
* 7. optional chain 等复杂形式 → 尽力提取 member_expression
|
|
112
|
+
*
|
|
113
|
+
* C-8 修复:mkCallSite 不接受 dynamicReason 参数(CallSite schema 仅 6 字段)。
|
|
114
|
+
*/
|
|
115
|
+
private _handleCallExpression;
|
|
116
|
+
/**
|
|
117
|
+
* 处理 member_expression / optional_member_expression 中的调用(严格与 PythonMapper L943-953 对齐):
|
|
118
|
+
* - this.method() → member(无 qualifier)
|
|
119
|
+
* - super.method() → super
|
|
120
|
+
* - 首字母大写 qualifier(Class.method)→ member + qualifier
|
|
121
|
+
* - 首字母小写 qualifier(mod.fn)→ cross-module + qualifier(关键:不是 member)
|
|
122
|
+
*/
|
|
123
|
+
private _handleMemberCall;
|
|
124
|
+
/**
|
|
125
|
+
* 处理 new_expression 节点(T-009)。
|
|
126
|
+
* - new Foo() → free,calleeName='Foo'(FR-1.3)
|
|
127
|
+
* - new Function('code') → unresolved(W-2 修复,避免误判为本地构造)
|
|
128
|
+
* - new Foo.Sub() → 委派 handleMemberCall
|
|
129
|
+
* C-8 修复:不向 CallSite schema 添加 viaNew 元数据字段。
|
|
130
|
+
*/
|
|
131
|
+
private _handleNewExpression;
|
|
132
|
+
/**
|
|
133
|
+
* 处理 decorator 节点(T-010)。
|
|
134
|
+
* - 带参 decorator `@Foo()` → decorator kind
|
|
135
|
+
* - bare decorator `@Foo`(无括号)→ 不产出(与 Python CL-04 对齐)
|
|
136
|
+
*
|
|
137
|
+
* W-3 修复:找到带参 decorator 的 call_expression 后产出 callSite,
|
|
138
|
+
* 返回该 call_expression 节点作为跳过标记,walker 不再递归进入,
|
|
139
|
+
* 避免 call_expression 子节点被 walker 再次产出 free/member callSite(双计数)。
|
|
140
|
+
*
|
|
141
|
+
* @returns 需要跳过的子树节点(call_expression),或 null(bare decorator 不产出)
|
|
142
|
+
*/
|
|
143
|
+
private _handleDecorator;
|
|
144
|
+
/**
|
|
145
|
+
* 处理 tagged_template_expression 节点(T-010)。
|
|
146
|
+
* - tag 为 identifier → free
|
|
147
|
+
* - tag 为 member_expression → 委派 handleMemberCall
|
|
148
|
+
*/
|
|
149
|
+
private _handleTaggedTemplate;
|
|
150
|
+
/**
|
|
151
|
+
* 构造单个 CallSite 记录(6 字段,C-8 修复:不接受 dynamicReason / viaNew 参数)。
|
|
152
|
+
* 字段:calleeName / calleeKind / line / column / callerContext / calleeQualifier
|
|
153
|
+
*/
|
|
154
|
+
private _mkCallSite;
|
|
53
155
|
}
|
|
54
156
|
//# sourceMappingURL=typescript-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-mapper.d.ts","sourceRoot":"","sources":["../../../src/core/query-mappers/typescript-mapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EACf,UAAU,EAGV,QAAQ,EAET,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript-mapper.d.ts","sourceRoot":"","sources":["../../../src/core/query-mappers/typescript-mapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EACV,YAAY,EAEZ,eAAe,EACf,UAAU,EAGV,QAAQ,EAET,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAoMnE,qBAAa,gBAAiB,YAAW,WAAW;IAClD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAgB;IAE3C;;;OAGG;IACH,cAAc,CACZ,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,aAAkB,GAC3B,YAAY,EAAE;IAmBjB;;;;;;;;;OASG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE;IAoBrE;;;;;;OAMG;IACH,OAAO,CAAC,6BAA6B;IAcrC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B;IAiDpC;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,UAAU,EAAE;IAUnD,0BAA0B;IAC1B,OAAO,CAAC,uBAAuB;IAsD/B,8BAA8B;IAC9B,OAAO,CAAC,2BAA2B;IAqBnC,2BAA2B;IAC3B,OAAO,CAAC,wBAAwB;IA6BhC,+BAA+B;IAC/B,OAAO,CAAC,4BAA4B;IA2CpC,gCAAgC;IAChC,OAAO,CAAC,4BAA4B;IA0BpC,0BAA0B;IAC1B,OAAO,CAAC,uBAAuB;IAoB/B,4CAA4C;IAC5C,OAAO,CAAC,0BAA0B;IAuClC,mCAAmC;IACnC,OAAO,CAAC,oBAAoB;IAqC5B,kBAAkB;IAClB,OAAO,CAAC,oBAAoB;IAgB5B,oBAAoB;IACpB,OAAO,CAAC,mBAAmB;IAiB3B,aAAa;IACb,OAAO,CAAC,wBAAwB;IA6ChC,aAAa;IACb,OAAO,CAAC,uBAAuB;IAwB/B,sBAAsB;IACtB,OAAO,CAAC,wBAAwB;IAkDhC,0BAA0B;IAC1B,OAAO,CAAC,uBAAuB;IAkG/B,2BAA2B;IAC3B,OAAO,CAAC,cAAc;IAuBtB;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE;IAa/D;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAuDtB;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAsD5B;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAqB9B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,qBAAqB;IA0D7B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAyCzB;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IA4B5B;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;IAgCxB;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IAmB7B;;;OAGG;IACH,OAAO,CAAC,WAAW;CAmBpB"}
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
// ============================================================
|
|
2
|
+
// Feature 152 — call site 抽取常量(与 PythonMapper 对齐)
|
|
3
|
+
// ============================================================
|
|
4
|
+
/** 文件大小上限:超过 1MB 跳过 callSites 抽取(与 PythonMapper 对齐) */
|
|
5
|
+
const CALLSITES_MAX_FILE_BYTES = 1_000_000;
|
|
6
|
+
/** 动态调用名集合:这些 identifier 调用产出 unresolved(C-8 修复,无 dynamicReason 元数据) */
|
|
7
|
+
const DYNAMIC_CALL_NAMES = new Set(['eval', 'Function']);
|
|
8
|
+
/**
|
|
9
|
+
* 作用域定义节点类型集合。
|
|
10
|
+
* 进入这些节点时将 callerContext 压栈,离开时弹栈。
|
|
11
|
+
* C-4 修复:匿名 arrow/function 也必须入栈,避免内层 callback 归属错外层 class method。
|
|
12
|
+
*/
|
|
13
|
+
const SCOPE_DEFINING_TYPES = new Set([
|
|
14
|
+
'function_declaration', // function foo() {}
|
|
15
|
+
'function', // const f = function() {}
|
|
16
|
+
'arrow_function', // const f = () => {}
|
|
17
|
+
'method_definition', // class Foo { bar() {} }
|
|
18
|
+
// Codex final W-3 修复:generator function 也定义独立 callerContext
|
|
19
|
+
'generator_function_declaration', // function* gen() {}
|
|
20
|
+
'generator_function', // const gen = function*() {}
|
|
21
|
+
]);
|
|
22
|
+
// ============================================================
|
|
2
23
|
// 辅助工具
|
|
3
24
|
// ============================================================
|
|
4
25
|
/** 获取节点的命名字段文本 */
|
|
@@ -188,6 +209,13 @@ export class TypeScriptMapper {
|
|
|
188
209
|
}
|
|
189
210
|
/**
|
|
190
211
|
* 从 AST tree 提取导入引用
|
|
212
|
+
*
|
|
213
|
+
* Feature 156 W1.0 v2 / CRIT-3:除 `import_statement` 外,还要遍历 AST 找
|
|
214
|
+
* - `call_expression` callee = `import` keyword → dynamic import
|
|
215
|
+
* - `call_expression` callee = `require` Identifier → commonjs-require
|
|
216
|
+
*
|
|
217
|
+
* 这样 tree-sitter 降级路径下 AC-11 的 dynamic / commonjs-require 边也能产出
|
|
218
|
+
* (ts-morph 主路径已在 ast-analyzer.ts 覆盖)。
|
|
191
219
|
*/
|
|
192
220
|
extractImports(tree, _source) {
|
|
193
221
|
const rootNode = tree.rootNode;
|
|
@@ -202,8 +230,86 @@ export class TypeScriptMapper {
|
|
|
202
230
|
if (ref)
|
|
203
231
|
imports.push(ref);
|
|
204
232
|
}
|
|
233
|
+
// CRIT-3:遍历整棵 AST 找 dynamic import / commonjs-require
|
|
234
|
+
this._collectCallExpressionImports(rootNode, imports);
|
|
205
235
|
return imports;
|
|
206
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* 递归遍历 AST,识别 dynamic import / commonjs-require 调用并产出对应 ImportReference。
|
|
239
|
+
*
|
|
240
|
+
* 仅识别 AST 结构上的 call_expression 节点 — 不是文本正则,因此能避免 WARN-2 类
|
|
241
|
+
* 字符串 / 注释中的 "require('./x')" 误命中(tree-sitter parser 会把它们标识为
|
|
242
|
+
* string / comment 节点,不会形成 call_expression 子树)。
|
|
243
|
+
*/
|
|
244
|
+
_collectCallExpressionImports(node, imports) {
|
|
245
|
+
if (node.type === 'call_expression') {
|
|
246
|
+
const ref = this._extractCallExpressionImport(node);
|
|
247
|
+
if (ref)
|
|
248
|
+
imports.push(ref);
|
|
249
|
+
}
|
|
250
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
251
|
+
const child = node.child(i);
|
|
252
|
+
if (child)
|
|
253
|
+
this._collectCallExpressionImports(child, imports);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 从 call_expression 节点派生 ImportReference(仅当 callee 为 `import` keyword 或
|
|
258
|
+
* `require` Identifier 时)。
|
|
259
|
+
*
|
|
260
|
+
* tree-sitter-typescript grammar 把动态 import callee 标识为 `import` 节点(type==='import'),
|
|
261
|
+
* require 调用则是 type==='identifier' && text==='require'。
|
|
262
|
+
*/
|
|
263
|
+
_extractCallExpressionImport(call) {
|
|
264
|
+
const fn = call.childForFieldName('function');
|
|
265
|
+
if (!fn)
|
|
266
|
+
return null;
|
|
267
|
+
let kind = null;
|
|
268
|
+
if (fn.type === 'import') {
|
|
269
|
+
kind = 'dynamic';
|
|
270
|
+
}
|
|
271
|
+
else if (fn.type === 'identifier' && fn.text === 'require') {
|
|
272
|
+
kind = 'commonjs-require';
|
|
273
|
+
}
|
|
274
|
+
if (!kind)
|
|
275
|
+
return null;
|
|
276
|
+
// 取第一个参数(必须是字符串字面量)
|
|
277
|
+
const args = call.childForFieldName('arguments');
|
|
278
|
+
if (!args)
|
|
279
|
+
return null;
|
|
280
|
+
let firstStringArg = null;
|
|
281
|
+
for (let i = 0; i < args.childCount; i++) {
|
|
282
|
+
const arg = args.child(i);
|
|
283
|
+
if (!arg)
|
|
284
|
+
continue;
|
|
285
|
+
if (arg.type === 'string') {
|
|
286
|
+
firstStringArg = arg;
|
|
287
|
+
break;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (!firstStringArg)
|
|
291
|
+
return null;
|
|
292
|
+
// 提取 string 字面量的文本内容(剥首尾引号 / 取 string_fragment 子节点)
|
|
293
|
+
let moduleSpecifier = firstStringArg.text.replace(/^['"`]|['"`]$/g, '');
|
|
294
|
+
// tree-sitter 把 string 节点细分为 ' / string_fragment / ';优先用 fragment 子节点更稳
|
|
295
|
+
for (let i = 0; i < firstStringArg.childCount; i++) {
|
|
296
|
+
const child = firstStringArg.child(i);
|
|
297
|
+
if (child?.type === 'string_fragment') {
|
|
298
|
+
moduleSpecifier = child.text;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (!moduleSpecifier)
|
|
303
|
+
return null;
|
|
304
|
+
const isRelative = moduleSpecifier.startsWith('.') || moduleSpecifier.startsWith('/');
|
|
305
|
+
return {
|
|
306
|
+
moduleSpecifier,
|
|
307
|
+
isRelative,
|
|
308
|
+
resolvedPath: null,
|
|
309
|
+
isTypeOnly: false,
|
|
310
|
+
importType: kind,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
207
313
|
/**
|
|
208
314
|
* 从 AST tree 提取解析错误
|
|
209
315
|
*/
|
|
@@ -702,5 +808,369 @@ export class TypeScriptMapper {
|
|
|
702
808
|
}
|
|
703
809
|
}
|
|
704
810
|
}
|
|
811
|
+
// ============================================================
|
|
812
|
+
// Feature 152 — call site 抽取(FR-1.1 ~ FR-1.5)
|
|
813
|
+
// ============================================================
|
|
814
|
+
/**
|
|
815
|
+
* 从 AST tree 提取函数调用点(Feature 152 P1)。
|
|
816
|
+
*
|
|
817
|
+
* 覆盖 6 种 calleeKind:free / member / cross-module / super / decorator / unresolved。
|
|
818
|
+
* TS extractor 不产出 dunder kind(CL-08)。
|
|
819
|
+
* 大文件 size guard(EC-14):source.length > 1MB 直接返回空数组。
|
|
820
|
+
*/
|
|
821
|
+
extractCallSites(tree, source) {
|
|
822
|
+
// size guard:文件超过 1MB 跳过,避免内存/性能问题
|
|
823
|
+
if (source.length > CALLSITES_MAX_FILE_BYTES) {
|
|
824
|
+
return [];
|
|
825
|
+
}
|
|
826
|
+
const out = [];
|
|
827
|
+
const callerContextStack = [];
|
|
828
|
+
this._walkCallSites(tree.rootNode, callerContextStack, out);
|
|
829
|
+
return out;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* 递归遍历 AST 抽取 call sites。
|
|
833
|
+
* callerContextStack 维护当前 function/class 嵌套作用域,进入 SCOPE_DEFINING_TYPES 时压栈。
|
|
834
|
+
* W-3 修复:handleDecorator 返回需跳过的子树节点,walker 在递归前跳过该节点。
|
|
835
|
+
*/
|
|
836
|
+
_walkCallSites(node, callerContextStack, out) {
|
|
837
|
+
// 进入作用域定义节点时推入 callerContext(C-4 修复:匿名 arrow/function 也入栈)
|
|
838
|
+
let pushedCtx = false;
|
|
839
|
+
if (SCOPE_DEFINING_TYPES.has(node.type)) {
|
|
840
|
+
const ctx = this._deriveCallerContext(node);
|
|
841
|
+
if (ctx != null) {
|
|
842
|
+
callerContextStack.push(ctx);
|
|
843
|
+
pushedCtx = true;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
// 获取当前 callerContext(栈顶)
|
|
847
|
+
const callerCtx = callerContextStack.length > 0
|
|
848
|
+
? callerContextStack[callerContextStack.length - 1]
|
|
849
|
+
: undefined;
|
|
850
|
+
// 核心分发:产出 callSite
|
|
851
|
+
let skipSubtree = null;
|
|
852
|
+
switch (node.type) {
|
|
853
|
+
case 'call_expression':
|
|
854
|
+
this._handleCallExpression(node, callerCtx, out);
|
|
855
|
+
break;
|
|
856
|
+
case 'new_expression':
|
|
857
|
+
this._handleNewExpression(node, callerCtx, out);
|
|
858
|
+
break;
|
|
859
|
+
case 'decorator':
|
|
860
|
+
skipSubtree = this._handleDecorator(node, callerCtx, out);
|
|
861
|
+
break;
|
|
862
|
+
case 'tagged_template_expression':
|
|
863
|
+
this._handleTaggedTemplate(node, callerCtx, out);
|
|
864
|
+
break;
|
|
865
|
+
default:
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
// 递归子节点(W-3 修复:跳过 decorator 内 call_expression 子树,避免双计数)
|
|
869
|
+
for (let i = 0; i < node.childCount; i++) {
|
|
870
|
+
const child = node.child(i);
|
|
871
|
+
if (!child)
|
|
872
|
+
continue;
|
|
873
|
+
// 如果当前节点的 handleDecorator 标记了要跳过的子树,则跳过该子树
|
|
874
|
+
if (skipSubtree != null && child.id === skipSubtree.id)
|
|
875
|
+
continue;
|
|
876
|
+
this._walkCallSites(child, callerContextStack, out);
|
|
877
|
+
}
|
|
878
|
+
// 出栈
|
|
879
|
+
if (pushedCtx) {
|
|
880
|
+
callerContextStack.pop();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* 推导当前节点的 callerContext 字符串。
|
|
885
|
+
*
|
|
886
|
+
* C-4 修复:匿名 arrow_function / function 也产生 `<arrow:line:col>` / `<fn:line:col>`,
|
|
887
|
+
* 确保内层 callback 不会错误归属外层 class method。
|
|
888
|
+
*/
|
|
889
|
+
_deriveCallerContext(node) {
|
|
890
|
+
switch (node.type) {
|
|
891
|
+
case 'function_declaration': {
|
|
892
|
+
const name = fieldText(node, 'name');
|
|
893
|
+
if (name)
|
|
894
|
+
return name;
|
|
895
|
+
// 匿名函数声明(理论上少见)
|
|
896
|
+
return `<fn:${node.startPosition.row + 1}:${node.startPosition.column}>`;
|
|
897
|
+
}
|
|
898
|
+
case 'method_definition': {
|
|
899
|
+
const name = fieldText(node, 'name');
|
|
900
|
+
const className = this._findAncestorClassName(node);
|
|
901
|
+
if (className && name)
|
|
902
|
+
return `${className}.${name}`;
|
|
903
|
+
return name ?? null;
|
|
904
|
+
}
|
|
905
|
+
case 'arrow_function': {
|
|
906
|
+
// 尝试从 variable_declarator 父节点获取变量名
|
|
907
|
+
const parent = node.parent;
|
|
908
|
+
if (parent?.type === 'variable_declarator') {
|
|
909
|
+
const varName = fieldText(parent, 'name');
|
|
910
|
+
if (varName)
|
|
911
|
+
return varName;
|
|
912
|
+
}
|
|
913
|
+
// C-4 修复:匿名 arrow function 用位置唯一化
|
|
914
|
+
return `<arrow:${node.startPosition.row + 1}:${node.startPosition.column}>`;
|
|
915
|
+
}
|
|
916
|
+
case 'function': {
|
|
917
|
+
// 函数表达式(const f = function() {})
|
|
918
|
+
const parent = node.parent;
|
|
919
|
+
if (parent?.type === 'variable_declarator') {
|
|
920
|
+
const varName = fieldText(parent, 'name');
|
|
921
|
+
if (varName)
|
|
922
|
+
return varName;
|
|
923
|
+
}
|
|
924
|
+
// C-4 修复:匿名 function 表达式用位置唯一化
|
|
925
|
+
return `<fn:${node.startPosition.row + 1}:${node.startPosition.column}>`;
|
|
926
|
+
}
|
|
927
|
+
case 'generator_function_declaration': {
|
|
928
|
+
// Codex final W-3 修复:generator function 声明 function* gen() {}
|
|
929
|
+
const name = fieldText(node, 'name');
|
|
930
|
+
if (name)
|
|
931
|
+
return name;
|
|
932
|
+
return `<gen:${node.startPosition.row + 1}:${node.startPosition.column}>`;
|
|
933
|
+
}
|
|
934
|
+
case 'generator_function': {
|
|
935
|
+
// generator function 表达式:const gen = function*() {}
|
|
936
|
+
const parent = node.parent;
|
|
937
|
+
if (parent?.type === 'variable_declarator') {
|
|
938
|
+
const varName = fieldText(parent, 'name');
|
|
939
|
+
if (varName)
|
|
940
|
+
return varName;
|
|
941
|
+
}
|
|
942
|
+
return `<gen:${node.startPosition.row + 1}:${node.startPosition.column}>`;
|
|
943
|
+
}
|
|
944
|
+
default:
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* 向上遍历 AST 找到最近的 class_declaration 节点,返回类名。
|
|
950
|
+
* 用于 method_definition 推导 callerContext(如 "Foo.bar")。
|
|
951
|
+
*/
|
|
952
|
+
_findAncestorClassName(node) {
|
|
953
|
+
let current = node.parent;
|
|
954
|
+
while (current != null) {
|
|
955
|
+
if (current.type === 'class_body' || current.type === 'class_declaration' || current.type === 'class') {
|
|
956
|
+
// class_body 的父节点才是 class_declaration
|
|
957
|
+
if (current.type === 'class_body') {
|
|
958
|
+
const classDecl = current.parent;
|
|
959
|
+
if (classDecl) {
|
|
960
|
+
const name = fieldText(classDecl, 'name');
|
|
961
|
+
if (name)
|
|
962
|
+
return name;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
const name = fieldText(current, 'name');
|
|
967
|
+
if (name)
|
|
968
|
+
return name;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
current = current.parent;
|
|
972
|
+
}
|
|
973
|
+
return null;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* 处理 call_expression 节点,分流 7 种形态(T-008):
|
|
977
|
+
* 1. dynamic import(`import('./x')`) → unresolved,calleeName='import'
|
|
978
|
+
* 2. super() 自调用 → super
|
|
979
|
+
* 3. eval/Function identifier → unresolved
|
|
980
|
+
* 4. 普通 identifier 调用 → free
|
|
981
|
+
* 5. C-3 修复:import().then() 链式 — 检测并跳过外层 .then 防双计数
|
|
982
|
+
* 6. member_expression → handleMemberCall
|
|
983
|
+
* 7. optional chain 等复杂形式 → 尽力提取 member_expression
|
|
984
|
+
*
|
|
985
|
+
* C-8 修复:mkCallSite 不接受 dynamicReason 参数(CallSite schema 仅 6 字段)。
|
|
986
|
+
*/
|
|
987
|
+
_handleCallExpression(node, callerCtx, out) {
|
|
988
|
+
const funcNode = node.childForFieldName('function');
|
|
989
|
+
if (!funcNode)
|
|
990
|
+
return;
|
|
991
|
+
// dynamic import:`import('./x')` — funcNode.type 为 'import'
|
|
992
|
+
if (funcNode.type === 'import') {
|
|
993
|
+
out.push(this._mkCallSite('import', 'unresolved', node, callerCtx));
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
// super() 构造器自调用(call_expression 中 func 为 super)
|
|
997
|
+
if (funcNode.type === 'super') {
|
|
998
|
+
out.push(this._mkCallSite('super', 'super', node, callerCtx));
|
|
999
|
+
return;
|
|
1000
|
+
}
|
|
1001
|
+
// identifier 形式:foo() / eval() / Function()
|
|
1002
|
+
if (funcNode.type === 'identifier') {
|
|
1003
|
+
const name = funcNode.text;
|
|
1004
|
+
// eval / Function → unresolved(C-8 修复:无 dynamicReason 元数据)
|
|
1005
|
+
if (DYNAMIC_CALL_NAMES.has(name)) {
|
|
1006
|
+
out.push(this._mkCallSite(name, 'unresolved', node, callerCtx));
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
// 普通 free 调用
|
|
1010
|
+
out.push(this._mkCallSite(name, 'free', node, callerCtx));
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
// member_expression 形式:obj.method() / Class.method()
|
|
1014
|
+
if (funcNode.type === 'member_expression') {
|
|
1015
|
+
// C-3 修复:检测链式 `import('./x').then(cb)` 模式,避免 .then 被双计数
|
|
1016
|
+
// 模式:call_expression(function=member_expression(object=call_expression(function=import)))
|
|
1017
|
+
const objectNode = funcNode.childForFieldName('object');
|
|
1018
|
+
if (objectNode?.type === 'call_expression') {
|
|
1019
|
+
const innerFunc = objectNode.childForFieldName('function');
|
|
1020
|
+
if (innerFunc?.type === 'import') {
|
|
1021
|
+
// 外层 .then(cb) 跳过——内层 import() 由递归子节点产出
|
|
1022
|
+
return;
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
this._handleMemberCall(funcNode, node, callerCtx, out);
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
// optional_member_expression:obj?.method()(tree-sitter 对应节点类型)
|
|
1029
|
+
if (funcNode.type === 'optional_member_expression') {
|
|
1030
|
+
this._handleMemberCall(funcNode, node, callerCtx, out);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
// 其他复杂形式(括号包裹的表达式等)→ 跳过
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* 处理 member_expression / optional_member_expression 中的调用(严格与 PythonMapper L943-953 对齐):
|
|
1037
|
+
* - this.method() → member(无 qualifier)
|
|
1038
|
+
* - super.method() → super
|
|
1039
|
+
* - 首字母大写 qualifier(Class.method)→ member + qualifier
|
|
1040
|
+
* - 首字母小写 qualifier(mod.fn)→ cross-module + qualifier(关键:不是 member)
|
|
1041
|
+
*/
|
|
1042
|
+
_handleMemberCall(memberNode, callNode, callerCtx, out) {
|
|
1043
|
+
const objectNode = memberNode.childForFieldName('object');
|
|
1044
|
+
const propertyNode = memberNode.childForFieldName('property');
|
|
1045
|
+
if (!propertyNode)
|
|
1046
|
+
return;
|
|
1047
|
+
const calleeName = propertyNode.text;
|
|
1048
|
+
const qualifier = objectNode?.text ?? '';
|
|
1049
|
+
// this.method() → member(无 qualifier,resolver 通过 callerContext 定位类)
|
|
1050
|
+
if (qualifier === 'this') {
|
|
1051
|
+
out.push(this._mkCallSite(calleeName, 'member', callNode, callerCtx));
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
// super.method() → super
|
|
1055
|
+
if (qualifier === 'super') {
|
|
1056
|
+
out.push(this._mkCallSite(calleeName, 'super', callNode, callerCtx));
|
|
1057
|
+
return;
|
|
1058
|
+
}
|
|
1059
|
+
// 首字母大写(Class.method)→ member + qualifier
|
|
1060
|
+
if (qualifier && /^[A-Z]/.test(qualifier)) {
|
|
1061
|
+
out.push(this._mkCallSite(calleeName, 'member', callNode, callerCtx, qualifier));
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
// 首字母小写(mod.fn)→ cross-module + qualifier(与 PythonMapper 对齐)
|
|
1065
|
+
if (qualifier) {
|
|
1066
|
+
out.push(this._mkCallSite(calleeName, 'cross-module', callNode, callerCtx, qualifier));
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
// 无 qualifier 兜底 → cross-module
|
|
1070
|
+
out.push(this._mkCallSite(calleeName, 'cross-module', callNode, callerCtx));
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* 处理 new_expression 节点(T-009)。
|
|
1074
|
+
* - new Foo() → free,calleeName='Foo'(FR-1.3)
|
|
1075
|
+
* - new Function('code') → unresolved(W-2 修复,避免误判为本地构造)
|
|
1076
|
+
* - new Foo.Sub() → 委派 handleMemberCall
|
|
1077
|
+
* C-8 修复:不向 CallSite schema 添加 viaNew 元数据字段。
|
|
1078
|
+
*/
|
|
1079
|
+
_handleNewExpression(node, callerCtx, out) {
|
|
1080
|
+
const constructorNode = node.childForFieldName('constructor');
|
|
1081
|
+
if (!constructorNode)
|
|
1082
|
+
return;
|
|
1083
|
+
// identifier 形式:new Foo()
|
|
1084
|
+
if (constructorNode.type === 'identifier') {
|
|
1085
|
+
const name = constructorNode.text;
|
|
1086
|
+
// W-2 修复:new Function('code') → unresolved(动态构造,避免误判为本地构造)
|
|
1087
|
+
if (name === 'Function') {
|
|
1088
|
+
out.push(this._mkCallSite('Function', 'unresolved', node, callerCtx));
|
|
1089
|
+
return;
|
|
1090
|
+
}
|
|
1091
|
+
// 普通构造:new Foo() → free,calleeName='Foo'
|
|
1092
|
+
out.push(this._mkCallSite(name, 'free', node, callerCtx));
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
// member_expression 形式:new Foo.Sub()(如 new express.Router())
|
|
1096
|
+
if (constructorNode.type === 'member_expression') {
|
|
1097
|
+
this._handleMemberCall(constructorNode, node, callerCtx, out);
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* 处理 decorator 节点(T-010)。
|
|
1103
|
+
* - 带参 decorator `@Foo()` → decorator kind
|
|
1104
|
+
* - bare decorator `@Foo`(无括号)→ 不产出(与 Python CL-04 对齐)
|
|
1105
|
+
*
|
|
1106
|
+
* W-3 修复:找到带参 decorator 的 call_expression 后产出 callSite,
|
|
1107
|
+
* 返回该 call_expression 节点作为跳过标记,walker 不再递归进入,
|
|
1108
|
+
* 避免 call_expression 子节点被 walker 再次产出 free/member callSite(双计数)。
|
|
1109
|
+
*
|
|
1110
|
+
* @returns 需要跳过的子树节点(call_expression),或 null(bare decorator 不产出)
|
|
1111
|
+
*/
|
|
1112
|
+
_handleDecorator(node, callerCtx, out) {
|
|
1113
|
+
// 找 decorator 节点的 call_expression 子节点(带参 decorator 才有)
|
|
1114
|
+
const callExpr = findChild(node, 'call_expression');
|
|
1115
|
+
if (!callExpr) {
|
|
1116
|
+
// bare decorator(@Foo 无括号)→ 不产出,无需跳过子树
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
// 从 call_expression 中取 callee 名称
|
|
1120
|
+
const funcNode = callExpr.childForFieldName('function');
|
|
1121
|
+
if (!funcNode)
|
|
1122
|
+
return callExpr;
|
|
1123
|
+
let calleeName;
|
|
1124
|
+
if (funcNode.type === 'identifier') {
|
|
1125
|
+
calleeName = funcNode.text;
|
|
1126
|
+
}
|
|
1127
|
+
else if (funcNode.type === 'member_expression') {
|
|
1128
|
+
const propNode = funcNode.childForFieldName('property');
|
|
1129
|
+
calleeName = propNode?.text ?? 'unknown';
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
calleeName = 'unknown';
|
|
1133
|
+
}
|
|
1134
|
+
out.push(this._mkCallSite(calleeName, 'decorator', callExpr, callerCtx));
|
|
1135
|
+
// 返回 callExpr,让 walker 跳过该子树,避免双计数(W-3 修复)
|
|
1136
|
+
return callExpr;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* 处理 tagged_template_expression 节点(T-010)。
|
|
1140
|
+
* - tag 为 identifier → free
|
|
1141
|
+
* - tag 为 member_expression → 委派 handleMemberCall
|
|
1142
|
+
*/
|
|
1143
|
+
_handleTaggedTemplate(node, callerCtx, out) {
|
|
1144
|
+
const tagNode = node.childForFieldName('tag');
|
|
1145
|
+
if (!tagNode)
|
|
1146
|
+
return;
|
|
1147
|
+
if (tagNode.type === 'identifier') {
|
|
1148
|
+
out.push(this._mkCallSite(tagNode.text, 'free', node, callerCtx));
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
if (tagNode.type === 'member_expression') {
|
|
1152
|
+
this._handleMemberCall(tagNode, node, callerCtx, out);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* 构造单个 CallSite 记录(6 字段,C-8 修复:不接受 dynamicReason / viaNew 参数)。
|
|
1158
|
+
* 字段:calleeName / calleeKind / line / column / callerContext / calleeQualifier
|
|
1159
|
+
*/
|
|
1160
|
+
_mkCallSite(calleeName, calleeKind, callNode, callerContext, calleeQualifier) {
|
|
1161
|
+
const cs = {
|
|
1162
|
+
calleeName,
|
|
1163
|
+
calleeKind,
|
|
1164
|
+
line: callNode.startPosition.row + 1,
|
|
1165
|
+
};
|
|
1166
|
+
if (callNode.startPosition.column !== undefined) {
|
|
1167
|
+
cs.column = callNode.startPosition.column;
|
|
1168
|
+
}
|
|
1169
|
+
if (callerContext !== undefined)
|
|
1170
|
+
cs.callerContext = callerContext;
|
|
1171
|
+
if (calleeQualifier !== undefined)
|
|
1172
|
+
cs.calleeQualifier = calleeQualifier;
|
|
1173
|
+
return cs;
|
|
1174
|
+
}
|
|
705
1175
|
}
|
|
706
1176
|
//# sourceMappingURL=typescript-mapper.js.map
|