spectra-cli 4.1.1 → 4.2.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 +1 -1
- 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 +47 -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 +157 -59
- 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 +30 -4
- package/dist/batch/batch-orchestrator.d.ts.map +1 -1
- package/dist/batch/batch-orchestrator.js +284 -7
- 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.map +1 -1
- package/dist/batch/module-grouper.d.ts +2 -2
- package/dist/batch/module-grouper.d.ts.map +1 -1
- package/dist/batch/module-grouper.js +1 -1
- package/dist/batch/module-grouper.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/index.js +9 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/parse-args.d.ts +13 -1
- package/dist/cli/utils/parse-args.d.ts.map +1 -1
- package/dist/cli/utils/parse-args.js +79 -2
- package/dist/cli/utils/parse-args.js.map +1 -1
- package/dist/core/ast-analyzer.d.ts.map +1 -1
- package/dist/core/ast-analyzer.js +79 -5
- package/dist/core/ast-analyzer.js.map +1 -1
- package/dist/core/import-resolver.d.ts +90 -0
- package/dist/core/import-resolver.d.ts.map +1 -0
- package/dist/core/import-resolver.js +273 -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.map +1 -1
- package/dist/core/single-spec-orchestrator.js +146 -9
- package/dist/core/single-spec-orchestrator.js.map +1 -1
- package/dist/core/tree-sitter-analyzer.d.ts +6 -0
- package/dist/core/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/core/tree-sitter-analyzer.js +33 -1
- package/dist/core/tree-sitter-analyzer.js.map +1 -1
- package/dist/core/tree-sitter-fallback.d.ts +7 -4
- package/dist/core/tree-sitter-fallback.d.ts.map +1 -1
- package/dist/core/tree-sitter-fallback.js +157 -12
- package/dist/core/tree-sitter-fallback.js.map +1 -1
- package/dist/extraction/extraction-types.d.ts +25 -25
- 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/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 +114 -0
- package/dist/knowledge-graph/import-resolver.d.ts.map +1 -0
- package/dist/knowledge-graph/import-resolver.js +537 -0
- package/dist/knowledge-graph/import-resolver.js.map +1 -0
- package/dist/knowledge-graph/incremental.d.ts +110 -0
- package/dist/knowledge-graph/incremental.d.ts.map +1 -0
- package/dist/knowledge-graph/incremental.js +410 -0
- package/dist/knowledge-graph/incremental.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +74 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +156 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/module-derivation.d.ts +238 -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 +270 -0
- package/dist/knowledge-graph/persistence.d.ts.map +1 -0
- package/dist/knowledge-graph/persistence.js +226 -0
- package/dist/knowledge-graph/persistence.js.map +1 -0
- package/dist/knowledge-graph/query-helpers.d.ts +164 -0
- package/dist/knowledge-graph/query-helpers.d.ts.map +1 -0
- package/dist/knowledge-graph/query-helpers.js +394 -0
- package/dist/knowledge-graph/query-helpers.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 +104 -0
- package/dist/mcp/agent-context-tools.d.ts.map +1 -0
- package/dist/mcp/agent-context-tools.js +854 -0
- package/dist/mcp/agent-context-tools.js.map +1 -0
- package/dist/mcp/graph-tools.d.ts +20 -0
- package/dist/mcp/graph-tools.d.ts.map +1 -1
- package/dist/mcp/graph-tools.js +71 -11
- package/dist/mcp/graph-tools.js.map +1 -1
- 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/server.d.ts +3 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +9 -10
- 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 +78 -6
- package/dist/models/code-skeleton.d.ts.map +1 -1
- package/dist/models/code-skeleton.js +29 -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 +155 -94
- package/dist/models/module-spec.d.ts.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 +2 -2
- package/dist/panoramic/builders/doc-graph-builder.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/panoramic/graph/graph-builder.js +78 -0
- 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 +33 -2
- package/dist/panoramic/graph/graph-query.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-query.js +69 -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/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/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/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/utils/file-scanner.js +1 -1
- package/dist/utils/file-scanner.js.map +1 -1
- package/package.json +12 -2
- package/plugins/spec-driver/.claude-plugin/plugin.json +1 -1
- package/plugins/spec-driver/README.md +18 -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 +20 -1
- package/plugins/spec-driver/docs/customization.md +134 -0
- package/plugins/spec-driver/docs/spectra-mcp-integration.md +165 -0
- package/plugins/spec-driver/lib/preference-rules.mjs +96 -0
- package/plugins/spec-driver/scripts/postinstall.sh +1 -1
- package/plugins/spec-driver/scripts/sync-preference-rules.mjs +148 -0
- package/plugins/spec-driver/skills/spec-driver-feature/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-fix/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-implement/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-refactor/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-story/SKILL.md +10 -0
- package/plugins/spec-driver/templates/preference-rules.md +39 -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/product-overview.hbs +1 -1
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeScript / JavaScript 语言适配器
|
|
3
3
|
*
|
|
4
|
-
* 将当前分散在 ast-analyzer.ts、tree-sitter-fallback.ts、
|
|
4
|
+
* 将当前分散在 ast-analyzer.ts、tree-sitter-fallback.ts、module-derivation.ts
|
|
5
5
|
* 中的 TS/JS 专用逻辑聚合为一个内聚的适配器实例。
|
|
6
6
|
*
|
|
7
7
|
* 实现策略:委托(delegation)——调用现有函数,不复制代码。
|
|
8
|
+
*
|
|
9
|
+
* Feature 152 T-013/T-014 — 双路径 callSites merge(方案 B):
|
|
10
|
+
* - extractCallSites=false(默认)→ 现有 ts-morph 单路径不变(FR-5.2 性能不回归)
|
|
11
|
+
* - extractCallSites=true → ts-morph 主路径(exports/imports)+ tree-sitter callSites merge
|
|
12
|
+
* EC-11 隔离:tree-sitter 的 exports/imports 被丢弃,仅取 callSites 字段
|
|
13
|
+
* EC-1 降级:tree-sitter 调用失败时安全降级为空 callSites
|
|
8
14
|
*/
|
|
9
15
|
import * as fs from 'node:fs';
|
|
16
|
+
import * as path from 'node:path';
|
|
10
17
|
import { analyzeFileInternal } from '../core/ast-analyzer.js';
|
|
11
18
|
import { analyzeFallback as treeSitterFallback } from '../core/tree-sitter-fallback.js';
|
|
12
|
-
import {
|
|
19
|
+
import { buildModuleGraphForProject } from '../knowledge-graph/module-derivation.js';
|
|
13
20
|
import { Project, ScriptTarget, ScriptKind } from 'ts-morph';
|
|
21
|
+
import { TreeSitterAnalyzer } from '../core/tree-sitter-analyzer.js';
|
|
14
22
|
export class TsJsLanguageAdapter {
|
|
15
23
|
id = 'ts-js';
|
|
16
24
|
languages = ['typescript', 'javascript'];
|
|
25
|
+
// 扫描扩展名扩充 `.mjs/.cjs/.mts/.cts`:
|
|
26
|
+
// - `.mjs/.cjs`:Node.js ESM/CJS 模块文件
|
|
27
|
+
// - `.mts/.cts`:TypeScript ESM/CJS 显式扩展
|
|
17
28
|
extensions = new Set([
|
|
18
|
-
'.ts', '.tsx', '.js', '.jsx',
|
|
29
|
+
'.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.mts', '.cts',
|
|
19
30
|
]);
|
|
20
31
|
defaultIgnoreDirs = new Set([
|
|
21
32
|
'node_modules',
|
|
@@ -26,9 +37,42 @@ export class TsJsLanguageAdapter {
|
|
|
26
37
|
]);
|
|
27
38
|
/**
|
|
28
39
|
* AST 分析(委托 ast-analyzer.ts 的 analyzeFile)
|
|
40
|
+
*
|
|
41
|
+
* Feature 152 T-013/T-014 — 双路径 merge 逻辑:
|
|
42
|
+
* - 默认路径(extractCallSites=false):单路径 ts-morph,行为与原版完全一致
|
|
43
|
+
* - callSites 路径(extractCallSites=true):ts-morph 主路径 + tree-sitter callSites 覆盖
|
|
44
|
+
* EC-11:tree-sitter 仅贡献 callSites,不替换 exports/imports
|
|
45
|
+
* EC-1:tree-sitter 调用异常时降级为空 callSites,不抛异常
|
|
29
46
|
*/
|
|
30
47
|
async analyzeFile(filePath, options) {
|
|
31
|
-
|
|
48
|
+
// 默认路径:直接走 ts-morph 单路径(性能不回归)
|
|
49
|
+
if (options?.extractCallSites !== true) {
|
|
50
|
+
return analyzeFileInternal(filePath, options);
|
|
51
|
+
}
|
|
52
|
+
// 双路径 merge:ts-morph 主结果 + tree-sitter callSites
|
|
53
|
+
const tsMorphResult = await analyzeFileInternal(filePath, options);
|
|
54
|
+
// 检测 .tsx / .jsx 文件:根据扩展名决定 tree-sitter 使用的语言
|
|
55
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
56
|
+
const tsLanguage = ext === '.js' || ext === '.jsx' ? 'javascript' : 'typescript';
|
|
57
|
+
let callSites = tsMorphResult.callSites ?? [];
|
|
58
|
+
try {
|
|
59
|
+
// 调用 tree-sitter 路径,仅取 callSites(EC-11:忽略 exports/imports)
|
|
60
|
+
const tsResult = await TreeSitterAnalyzer.getInstance().analyze(filePath, tsLanguage, { extractCallSites: true });
|
|
61
|
+
// EC-11 隔离:只取 callSites,丢弃 tree-sitter 的 exports/imports
|
|
62
|
+
callSites = tsResult.callSites ?? [];
|
|
63
|
+
// Codex P2 W-1 修复:parse-error 路径同样降级为空 callSites
|
|
64
|
+
// tree-sitter 在遇到 .tsx JSX dialect 等语法不识别时,可能返回 parseErrors 数组
|
|
65
|
+
// 而不抛异常;这种情况下 callSites 可能不可靠,强制降级
|
|
66
|
+
if (tsResult.parseErrors && tsResult.parseErrors.length > 0) {
|
|
67
|
+
callSites = [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// EC-1 降级:tree-sitter 调用失败(如 dialect 不可用、grammar 初始化失败)时
|
|
72
|
+
// 安全降级为空 callSites,不阻塞主路径结果
|
|
73
|
+
callSites = [];
|
|
74
|
+
}
|
|
75
|
+
return { ...tsMorphResult, callSites };
|
|
32
76
|
}
|
|
33
77
|
/**
|
|
34
78
|
* 正则降级分析(委托 tree-sitter-fallback.ts 的 analyzeFallback)
|
|
@@ -37,11 +81,13 @@ export class TsJsLanguageAdapter {
|
|
|
37
81
|
return treeSitterFallback(filePath);
|
|
38
82
|
}
|
|
39
83
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
84
|
+
* 模块图构建(W1.4:委托 module-derivation.ts 的 buildModuleGraphForProject,
|
|
85
|
+
* 内部走 UnifiedGraph + deriveModuleGraph 派生路径,不再调用 dependency-cruiser)。
|
|
86
|
+
*
|
|
87
|
+
* options 字段名映射:configPath → tsConfigPath
|
|
42
88
|
*/
|
|
43
|
-
async
|
|
44
|
-
return
|
|
89
|
+
async buildModuleGraph(projectRoot, options) {
|
|
90
|
+
return buildModuleGraphForProject(projectRoot, {
|
|
45
91
|
includeOnly: options?.includeOnly,
|
|
46
92
|
excludePatterns: options?.excludePatterns,
|
|
47
93
|
tsConfigPath: options?.configPath,
|
|
@@ -120,16 +166,13 @@ export class TsJsLanguageAdapter {
|
|
|
120
166
|
});
|
|
121
167
|
}
|
|
122
168
|
});
|
|
123
|
-
// 根节点的 leading comments 需要单独处理(forEachDescendant 不会把第一个 token 前的 trivia 交给任何 descendant 吗?
|
|
124
|
-
// 保险起见:扫描 SourceFile 的第一个 child 的 leading comments 已覆盖顶部 trivia,
|
|
125
|
-
// 因此此处无需额外处理。
|
|
126
169
|
// 稳定排序:按 startLine → kind
|
|
127
170
|
regions.sort((a, b) => a.startLine - b.startLine || a.endLine - b.endLine);
|
|
128
171
|
return regions;
|
|
129
172
|
}
|
|
130
173
|
}
|
|
131
174
|
/**
|
|
132
|
-
* 去除注释起始/结束标记(// 或
|
|
175
|
+
* 去除注释起始/结束标记(// 或 block 注释)以及每行前导的 * 装饰。
|
|
133
176
|
* 保留内部换行,供 debt-classifier 逐行正则匹配。
|
|
134
177
|
*/
|
|
135
178
|
function stripCommentMarkers(raw) {
|
|
@@ -137,11 +180,9 @@ function stripCommentMarkers(raw) {
|
|
|
137
180
|
return raw.slice(2).replace(/^[ \t]/, '');
|
|
138
181
|
}
|
|
139
182
|
if (raw.startsWith('/*')) {
|
|
140
|
-
// 去除 /* 和结尾 */
|
|
141
183
|
let inner = raw.slice(2);
|
|
142
184
|
if (inner.endsWith('*/'))
|
|
143
185
|
inner = inner.slice(0, -2);
|
|
144
|
-
// 去除每行开头的前导空白 + 可选 *
|
|
145
186
|
return inner
|
|
146
187
|
.split('\n')
|
|
147
188
|
.map((line) => line.replace(/^\s*\*[ \t]?/, ''))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-js-adapter.js","sourceRoot":"","sources":["../../src/adapters/ts-js-adapter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ts-js-adapter.js","sourceRoot":"","sources":["../../src/adapters/ts-js-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OA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11 +4,12 @@ import { type BudgetPolicy, type BudgetGateAttempt } from './budget-gate.js';
|
|
|
4
4
|
import { type GroupingOptions } from './module-grouper.js';
|
|
5
5
|
import { type LanguageGroup } from './language-grouper.js';
|
|
6
6
|
import { type LanguageFileStat } from '../utils/file-scanner.js';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ModuleGraph } from '../knowledge-graph/module-derivation.js';
|
|
8
8
|
import type { FailedModule } from '../models/module-spec.js';
|
|
9
9
|
import { type DebtPipelineResult } from '../panoramic/pipelines/debt-intelligence-pipeline.js';
|
|
10
10
|
import type { SimpleLLMClient as DebtSimpleLLMClient } from '../debt-scanner/design-docs/llm-topic-inferrer.js';
|
|
11
11
|
import type { DocsBundleProfileSummary } from '../panoramic/models/docs-bundle-types.js';
|
|
12
|
+
import type { CodeSkeleton } from '../models/code-skeleton.js';
|
|
12
13
|
import type { BatchMode } from '../panoramic/qa/types.js';
|
|
13
14
|
export interface BatchOptions {
|
|
14
15
|
/** 即使 spec 已存在也重新生成 */
|
|
@@ -134,15 +135,15 @@ export interface BatchResult {
|
|
|
134
135
|
graphHtmlPath?: string;
|
|
135
136
|
}
|
|
136
137
|
/**
|
|
137
|
-
* 合并多个语言的
|
|
138
|
+
* 合并多个语言的 ModuleGraph 用于全局拓扑排序
|
|
138
139
|
* 仅合并 modules 和 edges,SCC/Mermaid 按语言独立保留(TD-002 选项 C)
|
|
139
140
|
*/
|
|
140
|
-
export declare function mergeGraphsForTopologicalSort(graphs:
|
|
141
|
+
export declare function mergeGraphsForTopologicalSort(graphs: ModuleGraph[], projectRoot: string): ModuleGraph;
|
|
141
142
|
/**
|
|
142
143
|
* 检测跨语言引用
|
|
143
144
|
* 扫描模块 imports 是否引用了其他语言组的路径
|
|
144
145
|
*/
|
|
145
|
-
export declare function detectCrossLanguageRefs(moduleFiles: string[], languageGroups: LanguageGroup[], graph:
|
|
146
|
+
export declare function detectCrossLanguageRefs(moduleFiles: string[], languageGroups: LanguageGroup[], graph: ModuleGraph): string[];
|
|
146
147
|
/**
|
|
147
148
|
* Feature 146 FR-002 — 并发数边界规范化
|
|
148
149
|
*
|
|
@@ -211,4 +212,29 @@ export declare function buildDesignDocAbsPaths(projectDocs: string[], resolvedRo
|
|
|
211
212
|
fromProjectContextCount: number;
|
|
212
213
|
nestedDirsDetected: string[];
|
|
213
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* Feature 151 T-008c — 收集 .py 文件 CodeSkeleton(含 callSites + 本地 import 解析)。
|
|
217
|
+
*
|
|
218
|
+
* 与 PythonLanguageAdapter.extractSymbolNodes / buildModuleGraph 不同:
|
|
219
|
+
* - 显式传 extractCallSites=true,让 graph.json 含 callSites 字段
|
|
220
|
+
* - 在 PythonMapper 输出基础上补充 import 的 resolvedPath(基于项目内 .py 模块 basename map)
|
|
221
|
+
* — Codex P1 C-1 修订:mapper 当前只输出 moduleSpecifier,resolvedPath 始终 null,
|
|
222
|
+
* 导致 deriveImportEdges / call-resolver Stage 3 cross-module 全部失效
|
|
223
|
+
*
|
|
224
|
+
* 单文件解析失败 / 大文件 / 非 UTF-8 都按 EC-14 兜底(mapper 已处理),不影响整体 collection。
|
|
225
|
+
*/
|
|
226
|
+
export declare function collectPythonCodeSkeletons(projectRoot: string): Promise<Map<string, CodeSkeleton>>;
|
|
227
|
+
/**
|
|
228
|
+
* Feature 152 T-020 — 收集 .ts/.tsx/.js/.jsx 文件 CodeSkeleton(含 callSites + import 路径解析)。
|
|
229
|
+
*
|
|
230
|
+
* 与 collectPythonCodeSkeletons 设计对齐:
|
|
231
|
+
* - 可选 extractCallSites,走 TsJsLanguageAdapter 双路径 merge(Feature 152 T-013/T-014)
|
|
232
|
+
* - 解析 imports[].resolvedPath:findNearestTsConfig + buildTsConfigContext + resolveTsJsImport
|
|
233
|
+
* - EC-10:resolvedPath 转绝对路径与 Map key 格式对齐
|
|
234
|
+
* - T-021a:tsconfig context 按 configDir 缓存,避免每文件重复读
|
|
235
|
+
* - 单文件失败不阻塞整体(catch 吞掉,同 Python 版本 EC-14 兜底)
|
|
236
|
+
*/
|
|
237
|
+
export declare function collectTsJsCodeSkeletons(projectRoot: string, options?: {
|
|
238
|
+
extractCallSites?: boolean;
|
|
239
|
+
}): Promise<Map<string, CodeSkeleton>>;
|
|
214
240
|
//# sourceMappingURL=batch-orchestrator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batch-orchestrator.d.ts","sourceRoot":"","sources":["../../src/batch/batch-orchestrator.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAmC,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"batch-orchestrator.d.ts","sourceRoot":"","sources":["../../src/batch/batch-orchestrator.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAmC,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC5F,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,yCA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AAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,GACA;IACD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B,CAuGA;AAuDD;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CA2FpC;AA+BD;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,GACvC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAuEpC"}
|
|
@@ -8,7 +8,7 @@ import * as fs from 'node:fs';
|
|
|
8
8
|
import * as path from 'node:path';
|
|
9
9
|
import pLimit from 'p-limit';
|
|
10
10
|
import { findReadmePath } from '../extraction/index.js';
|
|
11
|
-
import {
|
|
11
|
+
import { buildModuleGraphForProject } from '../knowledge-graph/module-derivation.js';
|
|
12
12
|
import { generateSpec } from '../core/single-spec-orchestrator.js';
|
|
13
13
|
import { generateIndex } from '../generator/index-generator.js';
|
|
14
14
|
import { renderIndex, initRenderer } from '../generator/spec-renderer.js';
|
|
@@ -38,9 +38,11 @@ import { orchestrateDocsBundle } from '../panoramic/pipelines/docs-bundle-orches
|
|
|
38
38
|
import { generateDebtIntelligence, } from '../panoramic/pipelines/debt-intelligence-pipeline.js';
|
|
39
39
|
import { BATCH_OUTPUT_SUBDIRS } from '../panoramic/output-filenames.js';
|
|
40
40
|
import { buildKnowledgeGraph, writeKnowledgeGraph } from '../panoramic/graph/index.js';
|
|
41
|
+
import { buildUnifiedGraph, setCurrentUnifiedGraph, getCurrentUnifiedGraph, } from '../knowledge-graph/index.js';
|
|
41
42
|
import { buildHtmlTemplate } from '../panoramic/exporters/html-template.js';
|
|
42
43
|
import { SpecStore } from '../spec-store/index.js';
|
|
43
44
|
import { createRequire } from 'node:module';
|
|
45
|
+
import { resolvePythonImport, resolveTsJsImport, findNearestTsConfig, buildTsConfigContext, } from '../knowledge-graph/import-resolver.js';
|
|
44
46
|
// 从 package.json 读取版本号(避免硬编码)
|
|
45
47
|
const _require = createRequire(import.meta.url);
|
|
46
48
|
const SPECTRA_VERSION = _require('../../package.json').version;
|
|
@@ -63,7 +65,7 @@ const logger = createLogger('batch-orchestrator');
|
|
|
63
65
|
// 内部辅助函数
|
|
64
66
|
// ============================================================
|
|
65
67
|
/**
|
|
66
|
-
* 合并多个语言的
|
|
68
|
+
* 合并多个语言的 ModuleGraph 用于全局拓扑排序
|
|
67
69
|
* 仅合并 modules 和 edges,SCC/Mermaid 按语言独立保留(TD-002 选项 C)
|
|
68
70
|
*/
|
|
69
71
|
export function mergeGraphsForTopologicalSort(graphs, projectRoot) {
|
|
@@ -214,14 +216,14 @@ export async function runBatch(projectRoot, options = {}) {
|
|
|
214
216
|
// 步骤 1.7:合并拓扑排序
|
|
215
217
|
mergedGraph = perLangGraphs.length > 0
|
|
216
218
|
? mergeGraphsForTopologicalSort(perLangGraphs, resolvedRoot)
|
|
217
|
-
: await
|
|
219
|
+
: await buildModuleGraphForProject(resolvedRoot);
|
|
218
220
|
}
|
|
219
221
|
else if (isSingleNonTsJs && languageGroupsList[0]) {
|
|
220
222
|
mergedGraph = await buildGraphForLanguageGroup(languageGroupsList[0], resolvedRoot);
|
|
221
223
|
}
|
|
222
224
|
else {
|
|
223
|
-
// 纯 TS/JS
|
|
224
|
-
mergedGraph = await
|
|
225
|
+
// 纯 TS/JS 或未识别受支持语言:走 UnifiedGraph 派生路径(Feature 156 删除 dependency-cruiser)
|
|
226
|
+
mergedGraph = await buildModuleGraphForProject(resolvedRoot);
|
|
225
227
|
}
|
|
226
228
|
// 步骤 2:文件→模块聚合 + 模块级拓扑排序
|
|
227
229
|
const groupingOptions = {
|
|
@@ -824,6 +826,34 @@ export async function runBatch(projectRoot, options = {}) {
|
|
|
824
826
|
logger.warn(`README 早期读取失败(不阻断 narrative 主流程): ${String(readmeErr)}`);
|
|
825
827
|
}
|
|
826
828
|
}
|
|
829
|
+
// Feature 151 Codex Final C-1 修订 — 在 generateBatchProjectDocs 之前构建 UnifiedGraph
|
|
830
|
+
// 让 component-view-builder 能在生成时获取 graph(DI provider getCurrentUnifiedGraph)
|
|
831
|
+
//
|
|
832
|
+
// Feature 152 Codex final C-1 修复 — 同时合并 Python + TS/JS codeSkeletons,
|
|
833
|
+
// 否则用户跑 spectra batch 后 TS 项目 graph.json 中没有 calls 边(US-001 失败)
|
|
834
|
+
setCurrentUnifiedGraph(null);
|
|
835
|
+
try {
|
|
836
|
+
const pythonSkeletons = await collectPythonCodeSkeletons(resolvedRoot);
|
|
837
|
+
const tsJsSkeletons = await collectTsJsCodeSkeletons(resolvedRoot, {
|
|
838
|
+
extractCallSites: true,
|
|
839
|
+
});
|
|
840
|
+
// 合并两个 Map(projectRoot 都已 normalize 为绝对路径,key 形态一致)
|
|
841
|
+
const earlyCodeSkeletons = new Map([...pythonSkeletons, ...tsJsSkeletons]);
|
|
842
|
+
if (earlyCodeSkeletons.size > 0) {
|
|
843
|
+
const earlyUg = buildUnifiedGraph({
|
|
844
|
+
projectRoot: resolvedRoot,
|
|
845
|
+
codeSkeletons: earlyCodeSkeletons,
|
|
846
|
+
});
|
|
847
|
+
setCurrentUnifiedGraph(earlyUg);
|
|
848
|
+
const callEdges = earlyUg.edges.filter((e) => e.relation === 'calls').length;
|
|
849
|
+
logger.info(`[Feature 151+152] 早期 UnifiedGraph 构建:${earlyUg.nodes.length} 节点 / ${callEdges} calls 边 ` +
|
|
850
|
+
`(${pythonSkeletons.size} .py + ${tsJsSkeletons.size} .ts/.tsx/.js/.jsx 文件)`);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
catch (ugErr) {
|
|
854
|
+
setCurrentUnifiedGraph(null);
|
|
855
|
+
logger.warn(`[Feature 151+152] 早期 UnifiedGraph 构建失败(不阻塞): ${String(ugErr)}`);
|
|
856
|
+
}
|
|
827
857
|
try {
|
|
828
858
|
projectDocsResult = await generateBatchProjectDocs({
|
|
829
859
|
projectRoot: resolvedRoot,
|
|
@@ -913,11 +943,22 @@ export async function runBatch(projectRoot, options = {}) {
|
|
|
913
943
|
...pythonSymbolResults,
|
|
914
944
|
...(extractionResults ?? []),
|
|
915
945
|
];
|
|
946
|
+
// Feature 151 — UnifiedGraph 接入 graph-builder 第五路(早期已在 generateBatchProjectDocs 之前构建,此处复用 cache)
|
|
947
|
+
// 复用早期构建结果(Codex Final C-1 修订):cache 在 generateBatchProjectDocs 之前已 set
|
|
948
|
+
const unifiedGraph = getCurrentUnifiedGraph();
|
|
949
|
+
if (unifiedGraph) {
|
|
950
|
+
const callEdgeCount = unifiedGraph.edges.filter((e) => e.relation === 'calls').length;
|
|
951
|
+
const dependEdgeCount = unifiedGraph.edges.filter((e) => e.relation === 'depends-on').length;
|
|
952
|
+
logger.info(`[Feature 151] graph-builder 注入 UnifiedGraph:${unifiedGraph.nodes.length} 节点,` +
|
|
953
|
+
`${callEdgeCount} calls 边,${dependEdgeCount} depends-on 边`);
|
|
954
|
+
}
|
|
916
955
|
const graphJson = buildKnowledgeGraph({
|
|
917
956
|
architectureIR: projectDocsResult?.architectureIR,
|
|
918
957
|
docGraph,
|
|
919
958
|
crossReferenceLinks,
|
|
920
959
|
extractionResults: mergedResults.length > 0 ? mergedResults : undefined, // Feature 107 + 143 第四路数据源
|
|
960
|
+
// Feature 151 T-012a:UnifiedGraph 第五路(calls + depends-on 边 + per-file callSitesCount metadata)
|
|
961
|
+
...(unifiedGraph ? { unifiedGraph } : {}),
|
|
921
962
|
});
|
|
922
963
|
// Feature 133 P1-1(adversarial-review post-fix):anchor + hyperedge 集成
|
|
923
964
|
// F4 提供了 runAnchorIntegration / runHyperedgeIntegration 集成函数,
|
|
@@ -1345,9 +1386,9 @@ export async function runBatch(projectRoot, options = {}) {
|
|
|
1345
1386
|
async function buildGraphForLanguageGroup(langGroup, projectRoot) {
|
|
1346
1387
|
const registry = LanguageAdapterRegistry.getInstance();
|
|
1347
1388
|
const adapter = registry.getAllAdapters().find((item) => item.id === langGroup.adapterId);
|
|
1348
|
-
if (adapter?.
|
|
1389
|
+
if (adapter?.buildModuleGraph) {
|
|
1349
1390
|
try {
|
|
1350
|
-
const langGraph = await adapter.
|
|
1391
|
+
const langGraph = await adapter.buildModuleGraph(projectRoot);
|
|
1351
1392
|
for (const node of langGraph.modules) {
|
|
1352
1393
|
node.language = langGroup.adapterId;
|
|
1353
1394
|
}
|
|
@@ -1549,4 +1590,240 @@ function collectMdRecursive(dir, out) {
|
|
|
1549
1590
|
}
|
|
1550
1591
|
}
|
|
1551
1592
|
}
|
|
1593
|
+
// ============================================================
|
|
1594
|
+
// Feature 151 — Python CodeSkeleton 收集(含 callSites 抽取)
|
|
1595
|
+
// ============================================================
|
|
1596
|
+
const PY_SKELETON_IGNORE_DIRS = new Set([
|
|
1597
|
+
'node_modules', '.git', '__pycache__', '.venv', 'venv',
|
|
1598
|
+
'build', 'dist', 'coverage', 'out', 'target', '.tox',
|
|
1599
|
+
]);
|
|
1600
|
+
/**
|
|
1601
|
+
* Feature 151 T-008c — 收集 .py 文件 CodeSkeleton(含 callSites + 本地 import 解析)。
|
|
1602
|
+
*
|
|
1603
|
+
* 与 PythonLanguageAdapter.extractSymbolNodes / buildModuleGraph 不同:
|
|
1604
|
+
* - 显式传 extractCallSites=true,让 graph.json 含 callSites 字段
|
|
1605
|
+
* - 在 PythonMapper 输出基础上补充 import 的 resolvedPath(基于项目内 .py 模块 basename map)
|
|
1606
|
+
* — Codex P1 C-1 修订:mapper 当前只输出 moduleSpecifier,resolvedPath 始终 null,
|
|
1607
|
+
* 导致 deriveImportEdges / call-resolver Stage 3 cross-module 全部失效
|
|
1608
|
+
*
|
|
1609
|
+
* 单文件解析失败 / 大文件 / 非 UTF-8 都按 EC-14 兜底(mapper 已处理),不影响整体 collection。
|
|
1610
|
+
*/
|
|
1611
|
+
export async function collectPythonCodeSkeletons(projectRoot) {
|
|
1612
|
+
const out = new Map();
|
|
1613
|
+
const { PythonLanguageAdapter } = await import('../adapters/python-adapter.js');
|
|
1614
|
+
const adapter = new PythonLanguageAdapter();
|
|
1615
|
+
// Codex P3+P4 复审 C-2 修复:projectRoot 显式 normalize 为绝对路径
|
|
1616
|
+
// 避免调用方传相对路径 → Map key 与 imports[].resolvedPath 形态不一致
|
|
1617
|
+
// → call-resolver buildImportIndex lookup miss
|
|
1618
|
+
const resolvedProjectRoot = path.resolve(projectRoot);
|
|
1619
|
+
const pyFiles = [];
|
|
1620
|
+
walkPyFiles(resolvedProjectRoot, pyFiles);
|
|
1621
|
+
// Feature 152 P3 T-017:大文件 size guard 提前到 parse 之前(避免 tree-sitter 解析阻塞)
|
|
1622
|
+
// 1MB 阈值与 PythonMapper.CALLSITES_MAX_FILE_BYTES 对齐(EC-14)
|
|
1623
|
+
const MAX_FILE_BYTES = 1_000_000;
|
|
1624
|
+
for (const filePath of pyFiles) {
|
|
1625
|
+
try {
|
|
1626
|
+
let stat;
|
|
1627
|
+
try {
|
|
1628
|
+
stat = fs.statSync(filePath);
|
|
1629
|
+
}
|
|
1630
|
+
catch {
|
|
1631
|
+
continue; // 文件读不到 stat → 跳过
|
|
1632
|
+
}
|
|
1633
|
+
if (stat.size > MAX_FILE_BYTES) {
|
|
1634
|
+
// 大文件 skip — 不调 analyzeFile(避免 tree-sitter parse 巨型文件)
|
|
1635
|
+
continue;
|
|
1636
|
+
}
|
|
1637
|
+
const skeleton = await adapter.analyzeFile(filePath, { extractCallSites: true });
|
|
1638
|
+
// Feature 152 P3 T-017:使用 resolvePythonImport 替换 basename map(plan §5.1)
|
|
1639
|
+
// C-1 修复:from . import X1, X2 形态(moduleSpecifier='.'/'..') 需对每个 namedImport 单独调用
|
|
1640
|
+
// EC-10 修复:resolvedPath 转为绝对路径,与 Map key 格式对齐
|
|
1641
|
+
const resolvedSkeleton = {
|
|
1642
|
+
...skeleton,
|
|
1643
|
+
imports: skeleton.imports.flatMap((imp) => {
|
|
1644
|
+
if (imp.resolvedPath)
|
|
1645
|
+
return [imp];
|
|
1646
|
+
const spec = imp.moduleSpecifier;
|
|
1647
|
+
// C-1:裸相对 import —— moduleSpecifier 仅为纯点('.' / '..' / '...' / 更深)
|
|
1648
|
+
// "from . import nn, Value" → imp.namedImports=['nn','Value'],逐个拆解
|
|
1649
|
+
// quality-review W-2 修复:扩展到任意点深度(PEP 328 不限层数),
|
|
1650
|
+
// 避免 'from ... import a, b' 时 a/b 都映射到同一 resolvedPath(namedImports 污染)
|
|
1651
|
+
if (/^\.+$/.test(spec)) {
|
|
1652
|
+
const namedImports = Array.isArray(imp.namedImports)
|
|
1653
|
+
? imp.namedImports
|
|
1654
|
+
: [];
|
|
1655
|
+
if (namedImports.length === 0) {
|
|
1656
|
+
// 没有 namedImports(罕见),仅尝试解析包 __init__
|
|
1657
|
+
const result = resolvePythonImport(spec, filePath, resolvedProjectRoot);
|
|
1658
|
+
const resolvedPath = result.resolvedPath
|
|
1659
|
+
? path.resolve(resolvedProjectRoot, result.resolvedPath)
|
|
1660
|
+
: null;
|
|
1661
|
+
return [{ ...imp, resolvedPath }];
|
|
1662
|
+
}
|
|
1663
|
+
// 每个 namedImport 单独解析为独立 import 记录
|
|
1664
|
+
// Codex P3+P4 复审 C-1 修复:每条拆出记录的 namedImports 必须**只**含
|
|
1665
|
+
// 当前拆出的 name,否则 buildImportIndex 会把所有 namedImports 都映射到
|
|
1666
|
+
// 同一 resolvedPath(最后一条胜出),导致 alias 污染
|
|
1667
|
+
return namedImports.map((name) => {
|
|
1668
|
+
const combinedSpec = `${spec}${name}`; // '.' + 'nn' → '.nn'
|
|
1669
|
+
const result = resolvePythonImport(combinedSpec, filePath, resolvedProjectRoot);
|
|
1670
|
+
const resolvedPath = result.resolvedPath
|
|
1671
|
+
? path.resolve(resolvedProjectRoot, result.resolvedPath)
|
|
1672
|
+
: null;
|
|
1673
|
+
return {
|
|
1674
|
+
...imp,
|
|
1675
|
+
moduleSpecifier: combinedSpec,
|
|
1676
|
+
namedImports: [name], // 关键:仅含本次拆出的 name,避免 alias 污染
|
|
1677
|
+
resolvedPath,
|
|
1678
|
+
};
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
// 常规形态:直接调用 resolver(from pkg.engine import Value / import os)
|
|
1682
|
+
const result = resolvePythonImport(spec, filePath, resolvedProjectRoot);
|
|
1683
|
+
// EC-10:resolver 返回相对 projectRoot 的 POSIX 路径,需转绝对路径与 Map key 对齐
|
|
1684
|
+
const resolvedPath = result.resolvedPath
|
|
1685
|
+
? path.resolve(resolvedProjectRoot, result.resolvedPath)
|
|
1686
|
+
: null;
|
|
1687
|
+
return [{ ...imp, resolvedPath }];
|
|
1688
|
+
}),
|
|
1689
|
+
};
|
|
1690
|
+
out.set(filePath, resolvedSkeleton);
|
|
1691
|
+
}
|
|
1692
|
+
catch {
|
|
1693
|
+
// 单文件失败不影响整体
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
return out;
|
|
1697
|
+
}
|
|
1698
|
+
function walkPyFiles(dir, out) {
|
|
1699
|
+
let entries;
|
|
1700
|
+
try {
|
|
1701
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1702
|
+
}
|
|
1703
|
+
catch {
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
for (const entry of entries) {
|
|
1707
|
+
if (entry.isDirectory()) {
|
|
1708
|
+
if (entry.name.startsWith('.'))
|
|
1709
|
+
continue;
|
|
1710
|
+
if (PY_SKELETON_IGNORE_DIRS.has(entry.name))
|
|
1711
|
+
continue;
|
|
1712
|
+
walkPyFiles(path.join(dir, entry.name), out);
|
|
1713
|
+
}
|
|
1714
|
+
else if (entry.isFile() && (entry.name.endsWith('.py') || entry.name.endsWith('.pyi'))) {
|
|
1715
|
+
out.push(path.join(dir, entry.name));
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
// ============================================================
|
|
1720
|
+
// Feature 152 — TypeScript/JavaScript CodeSkeleton 收集
|
|
1721
|
+
// ============================================================
|
|
1722
|
+
/** T-020:TS/JS 文件扫描时忽略的目录集合(与 Python 对齐,增加 .next / .nuxt 等前端产物目录) */
|
|
1723
|
+
const TSJS_SKELETON_IGNORE_DIRS = new Set([
|
|
1724
|
+
'node_modules', '.git', 'dist', 'build', 'coverage', 'out', 'target',
|
|
1725
|
+
'.next', '.nuxt', '.turbo', '.cache', 'tmp', '.tmp',
|
|
1726
|
+
'__pycache__', '.pytest_cache', '.tox',
|
|
1727
|
+
]);
|
|
1728
|
+
/**
|
|
1729
|
+
* Feature 152 T-020 — 收集 .ts/.tsx/.js/.jsx 文件 CodeSkeleton(含 callSites + import 路径解析)。
|
|
1730
|
+
*
|
|
1731
|
+
* 与 collectPythonCodeSkeletons 设计对齐:
|
|
1732
|
+
* - 可选 extractCallSites,走 TsJsLanguageAdapter 双路径 merge(Feature 152 T-013/T-014)
|
|
1733
|
+
* - 解析 imports[].resolvedPath:findNearestTsConfig + buildTsConfigContext + resolveTsJsImport
|
|
1734
|
+
* - EC-10:resolvedPath 转绝对路径与 Map key 格式对齐
|
|
1735
|
+
* - T-021a:tsconfig context 按 configDir 缓存,避免每文件重复读
|
|
1736
|
+
* - 单文件失败不阻塞整体(catch 吞掉,同 Python 版本 EC-14 兜底)
|
|
1737
|
+
*/
|
|
1738
|
+
export async function collectTsJsCodeSkeletons(projectRoot, options) {
|
|
1739
|
+
const out = new Map();
|
|
1740
|
+
const { TsJsLanguageAdapter } = await import('../adapters/ts-js-adapter.js');
|
|
1741
|
+
const adapter = new TsJsLanguageAdapter();
|
|
1742
|
+
// Codex P3+P4 复审 C-2 修复:projectRoot 显式 normalize 为绝对路径
|
|
1743
|
+
// 避免调用方传相对路径 → Map key 与 imports[].resolvedPath 形态不一致
|
|
1744
|
+
const resolvedProjectRoot = path.resolve(projectRoot);
|
|
1745
|
+
const tsJsFiles = [];
|
|
1746
|
+
walkTsJsFiles(resolvedProjectRoot, tsJsFiles);
|
|
1747
|
+
// T-021a:tsconfig context 缓存(by configDir),避免每个文件重复读
|
|
1748
|
+
const tsConfigCache = new Map();
|
|
1749
|
+
// 大文件 size guard 与 Python 版本对齐(EC-14:1MB 阈值)
|
|
1750
|
+
const MAX_FILE_BYTES = 1_000_000;
|
|
1751
|
+
for (const filePath of tsJsFiles) {
|
|
1752
|
+
try {
|
|
1753
|
+
let stat;
|
|
1754
|
+
try {
|
|
1755
|
+
stat = fs.statSync(filePath);
|
|
1756
|
+
}
|
|
1757
|
+
catch {
|
|
1758
|
+
continue; // 文件读不到 stat → 跳过
|
|
1759
|
+
}
|
|
1760
|
+
if (stat.size > MAX_FILE_BYTES) {
|
|
1761
|
+
continue; // 大文件 skip
|
|
1762
|
+
}
|
|
1763
|
+
// 主分析(含 callSites if options.extractCallSites)
|
|
1764
|
+
const skeleton = await adapter.analyzeFile(filePath, {
|
|
1765
|
+
extractCallSites: options?.extractCallSites,
|
|
1766
|
+
});
|
|
1767
|
+
// T-021a:查找最近的 tsconfig.json 并缓存 context
|
|
1768
|
+
const nearest = findNearestTsConfig(filePath, resolvedProjectRoot);
|
|
1769
|
+
let tsConfigContext = null;
|
|
1770
|
+
if (nearest) {
|
|
1771
|
+
if (!tsConfigCache.has(nearest.configDir)) {
|
|
1772
|
+
tsConfigCache.set(nearest.configDir, buildTsConfigContext(nearest.rawConfig, nearest.configDir));
|
|
1773
|
+
}
|
|
1774
|
+
tsConfigContext = tsConfigCache.get(nearest.configDir) ?? null;
|
|
1775
|
+
}
|
|
1776
|
+
// 解析 imports[].resolvedPath(EC-10:转绝对路径)
|
|
1777
|
+
const resolvedSkeleton = {
|
|
1778
|
+
...skeleton,
|
|
1779
|
+
imports: skeleton.imports.map((imp) => {
|
|
1780
|
+
if (imp.resolvedPath)
|
|
1781
|
+
return imp;
|
|
1782
|
+
const result = resolveTsJsImport(imp.moduleSpecifier, filePath, resolvedProjectRoot, tsConfigContext);
|
|
1783
|
+
// EC-10:resolver 返回相对 projectRoot 的 POSIX 路径,需转绝对路径与 Map key 对齐
|
|
1784
|
+
const resolvedPath = result.resolvedPath
|
|
1785
|
+
? path.resolve(resolvedProjectRoot, result.resolvedPath)
|
|
1786
|
+
: null;
|
|
1787
|
+
return { ...imp, resolvedPath };
|
|
1788
|
+
}),
|
|
1789
|
+
};
|
|
1790
|
+
out.set(filePath, resolvedSkeleton);
|
|
1791
|
+
}
|
|
1792
|
+
catch {
|
|
1793
|
+
// 单文件失败不影响整体(与 collectPythonCodeSkeletons EC-14 一致)
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return out;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* 递归扫描 .ts/.tsx/.js/.jsx 文件(排除产物目录)。
|
|
1800
|
+
* 复用 walkPyFiles 的扫描模式,扩展 TS/JS 扩展名集合。
|
|
1801
|
+
*/
|
|
1802
|
+
function walkTsJsFiles(dir, out) {
|
|
1803
|
+
let entries;
|
|
1804
|
+
try {
|
|
1805
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1806
|
+
}
|
|
1807
|
+
catch {
|
|
1808
|
+
return;
|
|
1809
|
+
}
|
|
1810
|
+
for (const entry of entries) {
|
|
1811
|
+
if (entry.isDirectory()) {
|
|
1812
|
+
if (entry.name.startsWith('.'))
|
|
1813
|
+
continue;
|
|
1814
|
+
if (TSJS_SKELETON_IGNORE_DIRS.has(entry.name))
|
|
1815
|
+
continue;
|
|
1816
|
+
walkTsJsFiles(path.join(dir, entry.name), out);
|
|
1817
|
+
}
|
|
1818
|
+
else if (entry.isFile()) {
|
|
1819
|
+
const name = entry.name;
|
|
1820
|
+
if (name.endsWith('.ts') ||
|
|
1821
|
+
name.endsWith('.tsx') ||
|
|
1822
|
+
name.endsWith('.js') ||
|
|
1823
|
+
name.endsWith('.jsx')) {
|
|
1824
|
+
out.push(path.join(dir, entry.name));
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1552
1829
|
//# sourceMappingURL=batch-orchestrator.js.map
|