@codragraph/cli 1.6.2
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 +341 -0
- package/dist/_shared/graph/types.d.ts +81 -0
- package/dist/_shared/graph/types.d.ts.map +1 -0
- package/dist/_shared/graph/types.js +8 -0
- package/dist/_shared/graph/types.js.map +1 -0
- package/dist/_shared/index.d.ts +55 -0
- package/dist/_shared/index.d.ts.map +1 -0
- package/dist/_shared/index.js +39 -0
- package/dist/_shared/index.js.map +1 -0
- package/dist/_shared/language-detection.d.ts +23 -0
- package/dist/_shared/language-detection.d.ts.map +1 -0
- package/dist/_shared/language-detection.js +139 -0
- package/dist/_shared/language-detection.js.map +1 -0
- package/dist/_shared/languages.d.ts +26 -0
- package/dist/_shared/languages.d.ts.map +1 -0
- package/dist/_shared/languages.js +27 -0
- package/dist/_shared/languages.js.map +1 -0
- package/dist/_shared/lbug/schema-constants.d.ts +16 -0
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -0
- package/dist/_shared/lbug/schema-constants.js +67 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -0
- package/dist/_shared/mro-strategy.d.ts +41 -0
- package/dist/_shared/mro-strategy.d.ts.map +1 -0
- package/dist/_shared/mro-strategy.js +2 -0
- package/dist/_shared/mro-strategy.js.map +1 -0
- package/dist/_shared/pipeline.d.ts +16 -0
- package/dist/_shared/pipeline.d.ts.map +1 -0
- package/dist/_shared/pipeline.js +5 -0
- package/dist/_shared/pipeline.js.map +1 -0
- package/dist/_shared/scope-resolution/def-index.d.ts +36 -0
- package/dist/_shared/scope-resolution/def-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/def-index.js +51 -0
- package/dist/_shared/scope-resolution/def-index.js.map +1 -0
- package/dist/_shared/scope-resolution/evidence-weights.d.ts +69 -0
- package/dist/_shared/scope-resolution/evidence-weights.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/evidence-weights.js +84 -0
- package/dist/_shared/scope-resolution/evidence-weights.js.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts +139 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js +479 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts +26 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/language-classification.js +44 -0
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts +80 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js +79 -0
- package/dist/_shared/scope-resolution/method-dispatch-index.js.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +46 -0
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/module-scope-index.js +58 -0
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -0
- package/dist/_shared/scope-resolution/origin-priority.d.ts +14 -0
- package/dist/_shared/scope-resolution/origin-priority.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/origin-priority.js +21 -0
- package/dist/_shared/scope-resolution/origin-priority.js.map +1 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts +76 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/parsed-file.js +54 -0
- package/dist/_shared/scope-resolution/parsed-file.js.map +1 -0
- package/dist/_shared/scope-resolution/position-index.d.ts +62 -0
- package/dist/_shared/scope-resolution/position-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/position-index.js +134 -0
- package/dist/_shared/scope-resolution/position-index.js.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts +44 -0
- package/dist/_shared/scope-resolution/qualified-name-index.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js +75 -0
- package/dist/_shared/scope-resolution/qualified-name-index.js.map +1 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts +75 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/reference-site.js +24 -0
- package/dist/_shared/scope-resolution/reference-site.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts +27 -0
- package/dist/_shared/scope-resolution/registries/class-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js +30 -0
- package/dist/_shared/scope-resolution/registries/class-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts +69 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/context.js +44 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +56 -0
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/evidence.js +150 -0
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts +26 -0
- package/dist/_shared/scope-resolution/registries/field-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js +31 -0
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts +81 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js +332 -0
- package/dist/_shared/scope-resolution/registries/lookup-core.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts +33 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js +56 -0
- package/dist/_shared/scope-resolution/registries/lookup-qualified.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts +36 -0
- package/dist/_shared/scope-resolution/registries/method-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts +43 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js +60 -0
- package/dist/_shared/scope-resolution/registries/tie-breaks.js.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts +53 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js +126 -0
- package/dist/_shared/scope-resolution/resolve-type-ref.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts +43 -0
- package/dist/_shared/scope-resolution/scope-id.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-id.js +46 -0
- package/dist/_shared/scope-resolution/scope-id.js.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts +61 -0
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/scope-tree.js +186 -0
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +63 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js +122 -0
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +59 -0
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/shadow/diff.js +79 -0
- package/dist/_shared/scope-resolution/shadow/diff.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +34 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.js +12 -0
- package/dist/_shared/scope-resolution/symbol-definition.js.map +1 -0
- package/dist/_shared/scope-resolution/types.d.ts +356 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/types.js +17 -0
- package/dist/_shared/scope-resolution/types.js.map +1 -0
- package/dist/cli/ai-context.d.ts +27 -0
- package/dist/cli/ai-context.js +270 -0
- package/dist/cli/analyze.d.ts +43 -0
- package/dist/cli/analyze.js +312 -0
- package/dist/cli/augment.d.ts +13 -0
- package/dist/cli/augment.js +33 -0
- package/dist/cli/clean.d.ts +10 -0
- package/dist/cli/clean.js +78 -0
- package/dist/cli/config.d.ts +27 -0
- package/dist/cli/config.js +106 -0
- package/dist/cli/eval-server.d.ts +37 -0
- package/dist/cli/eval-server.js +398 -0
- package/dist/cli/graphstore.d.ts +40 -0
- package/dist/cli/graphstore.js +639 -0
- package/dist/cli/group.d.ts +2 -0
- package/dist/cli/group.js +306 -0
- package/dist/cli/index-repo.d.ts +15 -0
- package/dist/cli/index-repo.js +120 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +236 -0
- package/dist/cli/lazy-action.d.ts +6 -0
- package/dist/cli/lazy-action.js +18 -0
- package/dist/cli/list.d.ts +6 -0
- package/dist/cli/list.js +40 -0
- package/dist/cli/mcp.d.ts +8 -0
- package/dist/cli/mcp.js +36 -0
- package/dist/cli/remove.d.ts +30 -0
- package/dist/cli/remove.js +99 -0
- package/dist/cli/serve.d.ts +4 -0
- package/dist/cli/serve.js +37 -0
- package/dist/cli/setup.d.ts +8 -0
- package/dist/cli/setup.js +543 -0
- package/dist/cli/skill-gen.d.ts +26 -0
- package/dist/cli/skill-gen.js +555 -0
- package/dist/cli/status.d.ts +6 -0
- package/dist/cli/status.js +36 -0
- package/dist/cli/tool.d.ts +43 -0
- package/dist/cli/tool.js +168 -0
- package/dist/cli/wiki.d.ts +21 -0
- package/dist/cli/wiki.js +579 -0
- package/dist/config/ignore-service.d.ts +35 -0
- package/dist/config/ignore-service.js +436 -0
- package/dist/config/supported-languages.d.ts +13 -0
- package/dist/config/supported-languages.js +13 -0
- package/dist/core/augmentation/engine.d.ts +26 -0
- package/dist/core/augmentation/engine.js +252 -0
- package/dist/core/embeddings/ast-utils.d.ts +22 -0
- package/dist/core/embeddings/ast-utils.js +105 -0
- package/dist/core/embeddings/character-chunk.d.ts +12 -0
- package/dist/core/embeddings/character-chunk.js +43 -0
- package/dist/core/embeddings/chunker.d.ts +14 -0
- package/dist/core/embeddings/chunker.js +239 -0
- package/dist/core/embeddings/embedder.d.ts +65 -0
- package/dist/core/embeddings/embedder.js +320 -0
- package/dist/core/embeddings/embedding-pipeline.d.ts +62 -0
- package/dist/core/embeddings/embedding-pipeline.js +486 -0
- package/dist/core/embeddings/http-client.d.ts +31 -0
- package/dist/core/embeddings/http-client.js +179 -0
- package/dist/core/embeddings/index.d.ts +10 -0
- package/dist/core/embeddings/index.js +10 -0
- package/dist/core/embeddings/line-index.d.ts +7 -0
- package/dist/core/embeddings/line-index.js +42 -0
- package/dist/core/embeddings/server-mapping.d.ts +15 -0
- package/dist/core/embeddings/server-mapping.js +33 -0
- package/dist/core/embeddings/structural-extractor.d.ts +15 -0
- package/dist/core/embeddings/structural-extractor.js +58 -0
- package/dist/core/embeddings/text-generator.d.ts +31 -0
- package/dist/core/embeddings/text-generator.js +208 -0
- package/dist/core/embeddings/types.d.ts +207 -0
- package/dist/core/embeddings/types.js +200 -0
- package/dist/core/git-staleness.d.ts +31 -0
- package/dist/core/git-staleness.js +137 -0
- package/dist/core/graph/graph.d.ts +2 -0
- package/dist/core/graph/graph.js +173 -0
- package/dist/core/graph/types.d.ts +36 -0
- package/dist/core/graph/types.js +1 -0
- package/dist/core/graphstore/index.d.ts +46 -0
- package/dist/core/graphstore/index.js +80 -0
- package/dist/core/graphstore/lbug-row-source.d.ts +19 -0
- package/dist/core/graphstore/lbug-row-source.js +141 -0
- package/dist/core/group/bridge-db.d.ts +82 -0
- package/dist/core/group/bridge-db.js +460 -0
- package/dist/core/group/bridge-schema.d.ts +27 -0
- package/dist/core/group/bridge-schema.js +55 -0
- package/dist/core/group/config-parser.d.ts +7 -0
- package/dist/core/group/config-parser.js +100 -0
- package/dist/core/group/contract-extractor.d.ts +7 -0
- package/dist/core/group/contract-extractor.js +1 -0
- package/dist/core/group/cross-impact.d.ts +41 -0
- package/dist/core/group/cross-impact.js +441 -0
- package/dist/core/group/extractors/fs-utils.d.ts +10 -0
- package/dist/core/group/extractors/fs-utils.js +24 -0
- package/dist/core/group/extractors/grpc-extractor.d.ts +25 -0
- package/dist/core/group/extractors/grpc-extractor.js +401 -0
- package/dist/core/group/extractors/grpc-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/go.js +97 -0
- package/dist/core/group/extractors/grpc-patterns/index.d.ts +19 -0
- package/dist/core/group/extractors/grpc-patterns/index.js +46 -0
- package/dist/core/group/extractors/grpc-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/java.js +173 -0
- package/dist/core/group/extractors/grpc-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/grpc-patterns/node.js +290 -0
- package/dist/core/group/extractors/grpc-patterns/proto.d.ts +9 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +134 -0
- package/dist/core/group/extractors/grpc-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/grpc-patterns/python.js +67 -0
- package/dist/core/group/extractors/grpc-patterns/types.d.ts +50 -0
- package/dist/core/group/extractors/grpc-patterns/types.js +1 -0
- package/dist/core/group/extractors/http-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/go.js +215 -0
- package/dist/core/group/extractors/http-patterns/index.d.ts +17 -0
- package/dist/core/group/extractors/http-patterns/index.js +44 -0
- package/dist/core/group/extractors/http-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/java.js +253 -0
- package/dist/core/group/extractors/http-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/http-patterns/node.js +484 -0
- package/dist/core/group/extractors/http-patterns/php.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/php.js +178 -0
- package/dist/core/group/extractors/http-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/http-patterns/python.js +133 -0
- package/dist/core/group/extractors/http-patterns/types.d.ts +61 -0
- package/dist/core/group/extractors/http-patterns/types.js +1 -0
- package/dist/core/group/extractors/http-route-extractor.d.ts +21 -0
- package/dist/core/group/extractors/http-route-extractor.js +421 -0
- package/dist/core/group/extractors/manifest-extractor.d.ts +54 -0
- package/dist/core/group/extractors/manifest-extractor.js +292 -0
- package/dist/core/group/extractors/topic-extractor.d.ts +8 -0
- package/dist/core/group/extractors/topic-extractor.js +97 -0
- package/dist/core/group/extractors/topic-patterns/go.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/go.js +120 -0
- package/dist/core/group/extractors/topic-patterns/index.d.ts +14 -0
- package/dist/core/group/extractors/topic-patterns/index.js +38 -0
- package/dist/core/group/extractors/topic-patterns/java.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/java.js +80 -0
- package/dist/core/group/extractors/topic-patterns/node.d.ts +4 -0
- package/dist/core/group/extractors/topic-patterns/node.js +155 -0
- package/dist/core/group/extractors/topic-patterns/python.d.ts +2 -0
- package/dist/core/group/extractors/topic-patterns/python.js +116 -0
- package/dist/core/group/extractors/topic-patterns/types.d.ts +25 -0
- package/dist/core/group/extractors/topic-patterns/types.js +10 -0
- package/dist/core/group/extractors/tree-sitter-scanner.d.ts +113 -0
- package/dist/core/group/extractors/tree-sitter-scanner.js +94 -0
- package/dist/core/group/group-path-utils.d.ts +17 -0
- package/dist/core/group/group-path-utils.js +40 -0
- package/dist/core/group/matching.d.ts +13 -0
- package/dist/core/group/matching.js +198 -0
- package/dist/core/group/normalization.d.ts +3 -0
- package/dist/core/group/normalization.js +115 -0
- package/dist/core/group/resolve-at-member.d.ts +10 -0
- package/dist/core/group/resolve-at-member.js +31 -0
- package/dist/core/group/service-boundary-detector.d.ts +8 -0
- package/dist/core/group/service-boundary-detector.js +155 -0
- package/dist/core/group/service.d.ts +55 -0
- package/dist/core/group/service.js +394 -0
- package/dist/core/group/storage.d.ts +9 -0
- package/dist/core/group/storage.js +91 -0
- package/dist/core/group/sync.d.ts +21 -0
- package/dist/core/group/sync.js +196 -0
- package/dist/core/group/types.d.ts +160 -0
- package/dist/core/group/types.js +1 -0
- package/dist/core/ingestion/ast-cache.d.ts +26 -0
- package/dist/core/ingestion/ast-cache.js +47 -0
- package/dist/core/ingestion/binding-accumulator.d.ts +212 -0
- package/dist/core/ingestion/binding-accumulator.js +336 -0
- package/dist/core/ingestion/call-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/c-cpp.js +8 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/csharp.js +6 -0
- package/dist/core/ingestion/call-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/dart.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/go.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/jvm.js +51 -0
- package/dist/core/ingestion/call-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/php.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/python.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/ruby.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/rust.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/swift.js +5 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/call-extractors/configs/typescript-javascript.js +8 -0
- package/dist/core/ingestion/call-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/call-extractors/generic.js +59 -0
- package/dist/core/ingestion/call-processor.d.ts +235 -0
- package/dist/core/ingestion/call-processor.js +2639 -0
- package/dist/core/ingestion/call-routing.d.ts +55 -0
- package/dist/core/ingestion/call-routing.js +95 -0
- package/dist/core/ingestion/call-types.d.ts +135 -0
- package/dist/core/ingestion/call-types.js +2 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +11 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/csharp.js +21 -0
- package/dist/core/ingestion/class-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/dart.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/go.js +20 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/class-extractors/configs/jvm.js +35 -0
- package/dist/core/ingestion/class-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/php.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/python.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/ruby.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/rust.js +7 -0
- package/dist/core/ingestion/class-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/swift.js +18 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.d.ts +4 -0
- package/dist/core/ingestion/class-extractors/configs/typescript-javascript.js +28 -0
- package/dist/core/ingestion/class-extractors/generic.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/generic.js +135 -0
- package/dist/core/ingestion/class-types.d.ts +34 -0
- package/dist/core/ingestion/class-types.js +1 -0
- package/dist/core/ingestion/cluster-enricher.d.ts +38 -0
- package/dist/core/ingestion/cluster-enricher.js +168 -0
- package/dist/core/ingestion/cobol/cobol-copy-expander.d.ts +57 -0
- package/dist/core/ingestion/cobol/cobol-copy-expander.js +392 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +210 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +1715 -0
- package/dist/core/ingestion/cobol/jcl-parser.d.ts +68 -0
- package/dist/core/ingestion/cobol/jcl-parser.js +217 -0
- package/dist/core/ingestion/cobol/jcl-processor.d.ts +33 -0
- package/dist/core/ingestion/cobol/jcl-processor.js +229 -0
- package/dist/core/ingestion/cobol-processor.d.ts +54 -0
- package/dist/core/ingestion/cobol-processor.js +1232 -0
- package/dist/core/ingestion/community-processor.d.ts +39 -0
- package/dist/core/ingestion/community-processor.js +318 -0
- package/dist/core/ingestion/constants.d.ts +16 -0
- package/dist/core/ingestion/constants.js +16 -0
- package/dist/core/ingestion/emit-references.d.ts +88 -0
- package/dist/core/ingestion/emit-references.js +229 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +58 -0
- package/dist/core/ingestion/entry-point-scoring.js +380 -0
- package/dist/core/ingestion/export-detection.d.ts +57 -0
- package/dist/core/ingestion/export-detection.js +233 -0
- package/dist/core/ingestion/field-extractor.d.ts +29 -0
- package/dist/core/ingestion/field-extractor.js +25 -0
- package/dist/core/ingestion/field-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/c-cpp.js +104 -0
- package/dist/core/ingestion/field-extractors/configs/csharp.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/csharp.js +116 -0
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/dart.js +78 -0
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +11 -0
- package/dist/core/ingestion/field-extractors/configs/go.js +60 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.d.ts +53 -0
- package/dist/core/ingestion/field-extractors/configs/helpers.js +158 -0
- package/dist/core/ingestion/field-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/jvm.js +118 -0
- package/dist/core/ingestion/field-extractors/configs/php.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/php.js +65 -0
- package/dist/core/ingestion/field-extractors/configs/python.d.ts +12 -0
- package/dist/core/ingestion/field-extractors/configs/python.js +91 -0
- package/dist/core/ingestion/field-extractors/configs/ruby.d.ts +16 -0
- package/dist/core/ingestion/field-extractors/configs/ruby.js +76 -0
- package/dist/core/ingestion/field-extractors/configs/rust.d.ts +9 -0
- package/dist/core/ingestion/field-extractors/configs/rust.js +52 -0
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/swift.js +65 -0
- package/dist/core/ingestion/field-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/field-extractors/configs/typescript-javascript.js +56 -0
- package/dist/core/ingestion/field-extractors/generic.d.ts +49 -0
- package/dist/core/ingestion/field-extractors/generic.js +117 -0
- package/dist/core/ingestion/field-extractors/typescript.d.ts +77 -0
- package/dist/core/ingestion/field-extractors/typescript.js +291 -0
- package/dist/core/ingestion/field-types.d.ts +61 -0
- package/dist/core/ingestion/field-types.js +2 -0
- package/dist/core/ingestion/filesystem-walker.d.ts +28 -0
- package/dist/core/ingestion/filesystem-walker.js +91 -0
- package/dist/core/ingestion/finalize-orchestrator.d.ts +63 -0
- package/dist/core/ingestion/finalize-orchestrator.js +139 -0
- package/dist/core/ingestion/framework-detection.d.ts +150 -0
- package/dist/core/ingestion/framework-detection.js +786 -0
- package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +13 -0
- package/dist/core/ingestion/heritage-extractors/configs/go.js +20 -0
- package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +18 -0
- package/dist/core/ingestion/heritage-extractors/configs/ruby.js +65 -0
- package/dist/core/ingestion/heritage-extractors/generic.d.ts +23 -0
- package/dist/core/ingestion/heritage-extractors/generic.js +47 -0
- package/dist/core/ingestion/heritage-processor.d.ts +54 -0
- package/dist/core/ingestion/heritage-processor.js +360 -0
- package/dist/core/ingestion/heritage-types.d.ts +73 -0
- package/dist/core/ingestion/heritage-types.js +2 -0
- package/dist/core/ingestion/import-processor.d.ts +23 -0
- package/dist/core/ingestion/import-processor.js +373 -0
- package/dist/core/ingestion/import-resolvers/configs/c-cpp.d.ts +7 -0
- package/dist/core/ingestion/import-resolvers/configs/c-cpp.js +14 -0
- package/dist/core/ingestion/import-resolvers/configs/csharp.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/csharp.js +27 -0
- package/dist/core/ingestion/import-resolvers/configs/dart.d.ts +17 -0
- package/dist/core/ingestion/import-resolvers/configs/dart.js +54 -0
- package/dist/core/ingestion/import-resolvers/configs/go.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/go.js +26 -0
- package/dist/core/ingestion/import-resolvers/configs/jvm.d.ts +13 -0
- package/dist/core/ingestion/import-resolvers/configs/jvm.js +68 -0
- package/dist/core/ingestion/import-resolvers/configs/php.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/php.js +15 -0
- package/dist/core/ingestion/import-resolvers/configs/python.d.ts +12 -0
- package/dist/core/ingestion/import-resolvers/configs/python.js +41 -0
- package/dist/core/ingestion/import-resolvers/configs/ruby.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/ruby.js +16 -0
- package/dist/core/ingestion/import-resolvers/configs/rust.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/rust.js +54 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +8 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.js +29 -0
- package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.d.ts +9 -0
- package/dist/core/ingestion/import-resolvers/configs/typescript-javascript.js +23 -0
- package/dist/core/ingestion/import-resolvers/csharp.d.ts +18 -0
- package/dist/core/ingestion/import-resolvers/csharp.js +115 -0
- package/dist/core/ingestion/import-resolvers/go.d.ts +17 -0
- package/dist/core/ingestion/import-resolvers/go.js +46 -0
- package/dist/core/ingestion/import-resolvers/jvm.d.ts +27 -0
- package/dist/core/ingestion/import-resolvers/jvm.js +106 -0
- package/dist/core/ingestion/import-resolvers/php.d.ts +24 -0
- package/dist/core/ingestion/import-resolvers/php.js +77 -0
- package/dist/core/ingestion/import-resolvers/python.d.ts +22 -0
- package/dist/core/ingestion/import-resolvers/python.js +72 -0
- package/dist/core/ingestion/import-resolvers/resolver-factory.d.ts +24 -0
- package/dist/core/ingestion/import-resolvers/resolver-factory.js +33 -0
- package/dist/core/ingestion/import-resolvers/ruby.d.ts +14 -0
- package/dist/core/ingestion/import-resolvers/ruby.js +17 -0
- package/dist/core/ingestion/import-resolvers/rust.d.ts +17 -0
- package/dist/core/ingestion/import-resolvers/rust.js +75 -0
- package/dist/core/ingestion/import-resolvers/standard.d.ts +30 -0
- package/dist/core/ingestion/import-resolvers/standard.js +142 -0
- package/dist/core/ingestion/import-resolvers/types.d.ts +68 -0
- package/dist/core/ingestion/import-resolvers/types.js +6 -0
- package/dist/core/ingestion/import-resolvers/utils.d.ts +35 -0
- package/dist/core/ingestion/import-resolvers/utils.js +149 -0
- package/dist/core/ingestion/import-target-adapter.d.ts +73 -0
- package/dist/core/ingestion/import-target-adapter.js +95 -0
- package/dist/core/ingestion/language-config.d.ts +52 -0
- package/dist/core/ingestion/language-config.js +181 -0
- package/dist/core/ingestion/language-provider.d.ts +410 -0
- package/dist/core/ingestion/language-provider.js +24 -0
- package/dist/core/ingestion/languages/c-cpp.d.ts +12 -0
- package/dist/core/ingestion/languages/c-cpp.js +329 -0
- package/dist/core/ingestion/languages/cobol.d.ts +1 -0
- package/dist/core/ingestion/languages/cobol.js +26 -0
- package/dist/core/ingestion/languages/csharp/accessor-unwrap.d.ts +21 -0
- package/dist/core/ingestion/languages/csharp/accessor-unwrap.js +56 -0
- package/dist/core/ingestion/languages/csharp/arity-metadata.d.ts +26 -0
- package/dist/core/ingestion/languages/csharp/arity-metadata.js +46 -0
- package/dist/core/ingestion/languages/csharp/arity.d.ts +23 -0
- package/dist/core/ingestion/languages/csharp/arity.js +37 -0
- package/dist/core/ingestion/languages/csharp/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/csharp/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/csharp/captures.d.ts +19 -0
- package/dist/core/ingestion/languages/csharp/captures.js +249 -0
- package/dist/core/ingestion/languages/csharp/import-decomposer.d.ts +19 -0
- package/dist/core/ingestion/languages/csharp/import-decomposer.js +93 -0
- package/dist/core/ingestion/languages/csharp/import-target.d.ts +25 -0
- package/dist/core/ingestion/languages/csharp/import-target.js +123 -0
- package/dist/core/ingestion/languages/csharp/index.d.ts +82 -0
- package/dist/core/ingestion/languages/csharp/index.js +82 -0
- package/dist/core/ingestion/languages/csharp/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/csharp/interpret.js +132 -0
- package/dist/core/ingestion/languages/csharp/merge-bindings.d.ts +27 -0
- package/dist/core/ingestion/languages/csharp/merge-bindings.js +55 -0
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +50 -0
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +374 -0
- package/dist/core/ingestion/languages/csharp/query.d.ts +35 -0
- package/dist/core/ingestion/languages/csharp/query.js +515 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.d.ts +31 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.js +135 -0
- package/dist/core/ingestion/languages/csharp/scope-resolver.d.ts +10 -0
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +63 -0
- package/dist/core/ingestion/languages/csharp/simple-hooks.d.ts +53 -0
- package/dist/core/ingestion/languages/csharp/simple-hooks.js +76 -0
- package/dist/core/ingestion/languages/csharp.d.ts +8 -0
- package/dist/core/ingestion/languages/csharp.js +152 -0
- package/dist/core/ingestion/languages/dart.d.ts +12 -0
- package/dist/core/ingestion/languages/dart.js +102 -0
- package/dist/core/ingestion/languages/go.d.ts +11 -0
- package/dist/core/ingestion/languages/go.js +44 -0
- package/dist/core/ingestion/languages/index.d.ts +39 -0
- package/dist/core/ingestion/languages/index.js +64 -0
- package/dist/core/ingestion/languages/java.d.ts +9 -0
- package/dist/core/ingestion/languages/java.js +44 -0
- package/dist/core/ingestion/languages/kotlin.d.ts +9 -0
- package/dist/core/ingestion/languages/kotlin.js +123 -0
- package/dist/core/ingestion/languages/php.d.ts +8 -0
- package/dist/core/ingestion/languages/php.js +240 -0
- package/dist/core/ingestion/languages/python/arity-metadata.d.ts +24 -0
- package/dist/core/ingestion/languages/python/arity-metadata.js +45 -0
- package/dist/core/ingestion/languages/python/arity.d.ts +22 -0
- package/dist/core/ingestion/languages/python/arity.js +38 -0
- package/dist/core/ingestion/languages/python/cache-stats.d.ts +17 -0
- package/dist/core/ingestion/languages/python/cache-stats.js +28 -0
- package/dist/core/ingestion/languages/python/captures.d.ts +19 -0
- package/dist/core/ingestion/languages/python/captures.js +106 -0
- package/dist/core/ingestion/languages/python/import-decomposer.d.ts +15 -0
- package/dist/core/ingestion/languages/python/import-decomposer.js +112 -0
- package/dist/core/ingestion/languages/python/import-target.d.ts +21 -0
- package/dist/core/ingestion/languages/python/import-target.js +99 -0
- package/dist/core/ingestion/languages/python/index.d.ts +80 -0
- package/dist/core/ingestion/languages/python/index.js +80 -0
- package/dist/core/ingestion/languages/python/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/python/interpret.js +191 -0
- package/dist/core/ingestion/languages/python/merge-bindings.d.ts +16 -0
- package/dist/core/ingestion/languages/python/merge-bindings.js +44 -0
- package/dist/core/ingestion/languages/python/query.d.ts +9 -0
- package/dist/core/ingestion/languages/python/query.js +267 -0
- package/dist/core/ingestion/languages/python/receiver-binding.d.ts +21 -0
- package/dist/core/ingestion/languages/python/receiver-binding.js +116 -0
- package/dist/core/ingestion/languages/python/scope-resolver.d.ts +16 -0
- package/dist/core/ingestion/languages/python/scope-resolver.js +53 -0
- package/dist/core/ingestion/languages/python/simple-hooks.d.ts +23 -0
- package/dist/core/ingestion/languages/python/simple-hooks.js +35 -0
- package/dist/core/ingestion/languages/python.d.ts +12 -0
- package/dist/core/ingestion/languages/python.js +91 -0
- package/dist/core/ingestion/languages/ruby.d.ts +9 -0
- package/dist/core/ingestion/languages/ruby.js +210 -0
- package/dist/core/ingestion/languages/rust.d.ts +12 -0
- package/dist/core/ingestion/languages/rust.js +132 -0
- package/dist/core/ingestion/languages/swift.d.ts +12 -0
- package/dist/core/ingestion/languages/swift.js +244 -0
- package/dist/core/ingestion/languages/typescript.d.ts +11 -0
- package/dist/core/ingestion/languages/typescript.js +184 -0
- package/dist/core/ingestion/languages/vue.d.ts +13 -0
- package/dist/core/ingestion/languages/vue.js +77 -0
- package/dist/core/ingestion/markdown-processor.d.ts +17 -0
- package/dist/core/ingestion/markdown-processor.js +124 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/c-cpp.js +387 -0
- package/dist/core/ingestion/method-extractors/configs/csharp.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/csharp.js +287 -0
- package/dist/core/ingestion/method-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +376 -0
- package/dist/core/ingestion/method-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/go.js +176 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/jvm.js +336 -0
- package/dist/core/ingestion/method-extractors/configs/php.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/php.js +304 -0
- package/dist/core/ingestion/method-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/python.js +309 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/ruby.js +286 -0
- package/dist/core/ingestion/method-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/rust.js +195 -0
- package/dist/core/ingestion/method-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/swift.js +277 -0
- package/dist/core/ingestion/method-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/method-extractors/configs/typescript-javascript.js +338 -0
- package/dist/core/ingestion/method-extractors/generic.d.ts +11 -0
- package/dist/core/ingestion/method-extractors/generic.js +204 -0
- package/dist/core/ingestion/method-types.d.ts +90 -0
- package/dist/core/ingestion/method-types.js +2 -0
- package/dist/core/ingestion/model/field-registry.d.ts +18 -0
- package/dist/core/ingestion/model/field-registry.js +22 -0
- package/dist/core/ingestion/model/heritage-map.d.ts +105 -0
- package/dist/core/ingestion/model/heritage-map.js +260 -0
- package/dist/core/ingestion/model/index.d.ts +20 -0
- package/dist/core/ingestion/model/index.js +43 -0
- package/dist/core/ingestion/model/method-registry.d.ts +71 -0
- package/dist/core/ingestion/model/method-registry.js +134 -0
- package/dist/core/ingestion/model/registration-table.d.ts +138 -0
- package/dist/core/ingestion/model/registration-table.js +224 -0
- package/dist/core/ingestion/model/resolution-context.d.ts +93 -0
- package/dist/core/ingestion/model/resolution-context.js +337 -0
- package/dist/core/ingestion/model/resolve.d.ts +61 -0
- package/dist/core/ingestion/model/resolve.js +381 -0
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +59 -0
- package/dist/core/ingestion/model/scope-resolution-indexes.js +42 -0
- package/dist/core/ingestion/model/semantic-model.d.ts +150 -0
- package/dist/core/ingestion/model/semantic-model.js +175 -0
- package/dist/core/ingestion/model/symbol-table.d.ts +200 -0
- package/dist/core/ingestion/model/symbol-table.js +206 -0
- package/dist/core/ingestion/model/type-registry.d.ts +39 -0
- package/dist/core/ingestion/model/type-registry.js +62 -0
- package/dist/core/ingestion/mro-processor.d.ts +46 -0
- package/dist/core/ingestion/mro-processor.js +597 -0
- package/dist/core/ingestion/named-bindings/csharp.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/csharp.js +37 -0
- package/dist/core/ingestion/named-bindings/java.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/java.js +29 -0
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/kotlin.js +36 -0
- package/dist/core/ingestion/named-bindings/php.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/php.js +61 -0
- package/dist/core/ingestion/named-bindings/python.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/python.js +49 -0
- package/dist/core/ingestion/named-bindings/rust.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/rust.js +66 -0
- package/dist/core/ingestion/named-bindings/types.d.ts +16 -0
- package/dist/core/ingestion/named-bindings/types.js +6 -0
- package/dist/core/ingestion/named-bindings/typescript.d.ts +3 -0
- package/dist/core/ingestion/named-bindings/typescript.js +58 -0
- package/dist/core/ingestion/parsing-processor.d.ts +40 -0
- package/dist/core/ingestion/parsing-processor.js +576 -0
- package/dist/core/ingestion/pipeline-phases/cobol.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/cobol.js +45 -0
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/communities.js +62 -0
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +156 -0
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +37 -0
- package/dist/core/ingestion/pipeline-phases/cross-file.js +63 -0
- package/dist/core/ingestion/pipeline-phases/index.d.ts +22 -0
- package/dist/core/ingestion/pipeline-phases/index.js +23 -0
- package/dist/core/ingestion/pipeline-phases/markdown.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/markdown.js +33 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +18 -0
- package/dist/core/ingestion/pipeline-phases/mro.js +36 -0
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +22 -0
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +92 -0
- package/dist/core/ingestion/pipeline-phases/orm.d.ts +15 -0
- package/dist/core/ingestion/pipeline-phases/orm.js +74 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +58 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +458 -0
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +74 -0
- package/dist/core/ingestion/pipeline-phases/parse.js +33 -0
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +16 -0
- package/dist/core/ingestion/pipeline-phases/processes.js +143 -0
- package/dist/core/ingestion/pipeline-phases/routes.d.ts +21 -0
- package/dist/core/ingestion/pipeline-phases/routes.js +243 -0
- package/dist/core/ingestion/pipeline-phases/runner.d.ts +22 -0
- package/dist/core/ingestion/pipeline-phases/runner.js +203 -0
- package/dist/core/ingestion/pipeline-phases/scan.d.ts +21 -0
- package/dist/core/ingestion/pipeline-phases/scan.js +46 -0
- package/dist/core/ingestion/pipeline-phases/structure.d.ts +27 -0
- package/dist/core/ingestion/pipeline-phases/structure.js +35 -0
- package/dist/core/ingestion/pipeline-phases/tools.d.ts +20 -0
- package/dist/core/ingestion/pipeline-phases/tools.js +79 -0
- package/dist/core/ingestion/pipeline-phases/types.d.ts +79 -0
- package/dist/core/ingestion/pipeline-phases/types.js +37 -0
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +70 -0
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +312 -0
- package/dist/core/ingestion/pipeline.d.ts +36 -0
- package/dist/core/ingestion/pipeline.js +89 -0
- package/dist/core/ingestion/process-processor.d.ts +51 -0
- package/dist/core/ingestion/process-processor.js +317 -0
- package/dist/core/ingestion/registry-primary-flag.d.ts +86 -0
- package/dist/core/ingestion/registry-primary-flag.js +111 -0
- package/dist/core/ingestion/resolve-references.d.ts +63 -0
- package/dist/core/ingestion/resolve-references.js +175 -0
- package/dist/core/ingestion/route-extractors/expo.d.ts +1 -0
- package/dist/core/ingestion/route-extractors/expo.js +36 -0
- package/dist/core/ingestion/route-extractors/middleware.d.ts +47 -0
- package/dist/core/ingestion/route-extractors/middleware.js +167 -0
- package/dist/core/ingestion/route-extractors/nextjs.d.ts +3 -0
- package/dist/core/ingestion/route-extractors/nextjs.js +76 -0
- package/dist/core/ingestion/route-extractors/php.d.ts +7 -0
- package/dist/core/ingestion/route-extractors/php.js +22 -0
- package/dist/core/ingestion/route-extractors/response-shapes.d.ts +20 -0
- package/dist/core/ingestion/route-extractors/response-shapes.js +294 -0
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +32 -0
- package/dist/core/ingestion/scope-extractor-bridge.js +44 -0
- package/dist/core/ingestion/scope-extractor.d.ts +86 -0
- package/dist/core/ingestion/scope-extractor.js +758 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +372 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +212 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +43 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +79 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +57 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +112 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.d.ts +17 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/imports-to-edges.js +46 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.d.ts +19 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/method-dispatch.js +30 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.d.ts +37 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +113 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +38 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +73 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +42 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +198 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +27 -0
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +131 -0
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.d.ts +48 -0
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +130 -0
- package/dist/core/ingestion/scope-resolution/passes/mro.d.ts +42 -0
- package/dist/core/ingestion/scope-resolution/passes/mro.js +99 -0
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.d.ts +26 -0
- package/dist/core/ingestion/scope-resolution/passes/overload-narrowing.js +61 -0
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +46 -0
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +327 -0
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +47 -0
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +130 -0
- package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.d.ts +68 -0
- package/dist/core/ingestion/scope-resolution/pipeline/reconcile-ownership.js +125 -0
- package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +17 -0
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +21 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +66 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +157 -0
- package/dist/core/ingestion/scope-resolution/scope/namespace-targets.d.ts +36 -0
- package/dist/core/ingestion/scope-resolution/scope/namespace-targets.js +52 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +127 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +349 -0
- package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +52 -0
- package/dist/core/ingestion/scope-resolution/workspace-index.js +61 -0
- package/dist/core/ingestion/shadow-harness.d.ts +113 -0
- package/dist/core/ingestion/shadow-harness.js +148 -0
- package/dist/core/ingestion/structure-processor.d.ts +2 -0
- package/dist/core/ingestion/structure-processor.js +36 -0
- package/dist/core/ingestion/tree-sitter-queries.d.ts +16 -0
- package/dist/core/ingestion/tree-sitter-queries.js +1338 -0
- package/dist/core/ingestion/type-env.d.ts +86 -0
- package/dist/core/ingestion/type-env.js +1128 -0
- package/dist/core/ingestion/type-extractors/c-cpp.d.ts +7 -0
- package/dist/core/ingestion/type-extractors/c-cpp.js +532 -0
- package/dist/core/ingestion/type-extractors/csharp.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/csharp.js +583 -0
- package/dist/core/ingestion/type-extractors/dart.d.ts +15 -0
- package/dist/core/ingestion/type-extractors/dart.js +369 -0
- package/dist/core/ingestion/type-extractors/go.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/go.js +513 -0
- package/dist/core/ingestion/type-extractors/jvm.d.ts +3 -0
- package/dist/core/ingestion/type-extractors/jvm.js +856 -0
- package/dist/core/ingestion/type-extractors/php.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/php.js +534 -0
- package/dist/core/ingestion/type-extractors/python.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/python.js +474 -0
- package/dist/core/ingestion/type-extractors/ruby.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/ruby.js +377 -0
- package/dist/core/ingestion/type-extractors/rust.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/rust.js +515 -0
- package/dist/core/ingestion/type-extractors/shared.d.ts +131 -0
- package/dist/core/ingestion/type-extractors/shared.js +796 -0
- package/dist/core/ingestion/type-extractors/swift.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/swift.js +484 -0
- package/dist/core/ingestion/type-extractors/types.d.ts +172 -0
- package/dist/core/ingestion/type-extractors/types.js +1 -0
- package/dist/core/ingestion/type-extractors/typescript.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/typescript.js +661 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +89 -0
- package/dist/core/ingestion/utils/ast-helpers.js +535 -0
- package/dist/core/ingestion/utils/call-analysis.d.ts +75 -0
- package/dist/core/ingestion/utils/call-analysis.js +574 -0
- package/dist/core/ingestion/utils/env.d.ts +10 -0
- package/dist/core/ingestion/utils/env.js +10 -0
- package/dist/core/ingestion/utils/event-loop.d.ts +5 -0
- package/dist/core/ingestion/utils/event-loop.js +5 -0
- package/dist/core/ingestion/utils/graph-sort.d.ts +58 -0
- package/dist/core/ingestion/utils/graph-sort.js +100 -0
- package/dist/core/ingestion/utils/max-file-size.d.ts +20 -0
- package/dist/core/ingestion/utils/max-file-size.js +52 -0
- package/dist/core/ingestion/utils/method-props.d.ts +32 -0
- package/dist/core/ingestion/utils/method-props.js +147 -0
- package/dist/core/ingestion/utils/ruby-self-call.d.ts +52 -0
- package/dist/core/ingestion/utils/ruby-self-call.js +59 -0
- package/dist/core/ingestion/utils/verbose.d.ts +1 -0
- package/dist/core/ingestion/utils/verbose.js +7 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.d.ts +3 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +81 -0
- package/dist/core/ingestion/variable-extractors/configs/csharp.d.ts +9 -0
- package/dist/core/ingestion/variable-extractors/configs/csharp.js +63 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +94 -0
- package/dist/core/ingestion/variable-extractors/configs/go.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/go.js +83 -0
- package/dist/core/ingestion/variable-extractors/configs/jvm.d.ts +18 -0
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +115 -0
- package/dist/core/ingestion/variable-extractors/configs/php.d.ts +14 -0
- package/dist/core/ingestion/variable-extractors/configs/php.js +58 -0
- package/dist/core/ingestion/variable-extractors/configs/python.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/python.js +101 -0
- package/dist/core/ingestion/variable-extractors/configs/ruby.d.ts +11 -0
- package/dist/core/ingestion/variable-extractors/configs/ruby.js +52 -0
- package/dist/core/ingestion/variable-extractors/configs/rust.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/rust.js +76 -0
- package/dist/core/ingestion/variable-extractors/configs/swift.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/swift.js +88 -0
- package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.d.ts +3 -0
- package/dist/core/ingestion/variable-extractors/configs/typescript-javascript.js +83 -0
- package/dist/core/ingestion/variable-extractors/generic.d.ts +5 -0
- package/dist/core/ingestion/variable-extractors/generic.js +80 -0
- package/dist/core/ingestion/variable-types.d.ts +82 -0
- package/dist/core/ingestion/variable-types.js +2 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +44 -0
- package/dist/core/ingestion/vue-sfc-extractor.js +94 -0
- package/dist/core/ingestion/workers/parse-worker.d.ts +198 -0
- package/dist/core/ingestion/workers/parse-worker.js +1928 -0
- package/dist/core/ingestion/workers/worker-pool.d.ts +16 -0
- package/dist/core/ingestion/workers/worker-pool.js +126 -0
- package/dist/core/lbug/csv-generator.d.ts +33 -0
- package/dist/core/lbug/csv-generator.js +459 -0
- package/dist/core/lbug/lbug-adapter.d.ts +173 -0
- package/dist/core/lbug/lbug-adapter.js +1188 -0
- package/dist/core/lbug/pool-adapter.d.ts +93 -0
- package/dist/core/lbug/pool-adapter.js +543 -0
- package/dist/core/lbug/schema.d.ts +62 -0
- package/dist/core/lbug/schema.js +484 -0
- package/dist/core/run-analyze.d.ts +72 -0
- package/dist/core/run-analyze.js +315 -0
- package/dist/core/search/bm25-index.d.ts +41 -0
- package/dist/core/search/bm25-index.js +209 -0
- package/dist/core/search/hybrid-search.d.ts +49 -0
- package/dist/core/search/hybrid-search.js +118 -0
- package/dist/core/search/phase-timer.d.ts +72 -0
- package/dist/core/search/phase-timer.js +106 -0
- package/dist/core/tree-sitter/parser-loader.d.ts +8 -0
- package/dist/core/tree-sitter/parser-loader.js +84 -0
- package/dist/core/wiki/cursor-client.d.ts +31 -0
- package/dist/core/wiki/cursor-client.js +122 -0
- package/dist/core/wiki/generator.d.ts +129 -0
- package/dist/core/wiki/generator.js +898 -0
- package/dist/core/wiki/graph-queries.d.ts +84 -0
- package/dist/core/wiki/graph-queries.js +244 -0
- package/dist/core/wiki/html-viewer.d.ts +10 -0
- package/dist/core/wiki/html-viewer.js +303 -0
- package/dist/core/wiki/llm-client.d.ts +63 -0
- package/dist/core/wiki/llm-client.js +234 -0
- package/dist/core/wiki/prompts.d.ts +53 -0
- package/dist/core/wiki/prompts.js +181 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.js +3 -0
- package/dist/mcp/compatible-stdio-transport.d.ts +25 -0
- package/dist/mcp/compatible-stdio-transport.js +200 -0
- package/dist/mcp/core/embedder.d.ts +27 -0
- package/dist/mcp/core/embedder.js +122 -0
- package/dist/mcp/core/lbug-adapter.d.ts +5 -0
- package/dist/mcp/core/lbug-adapter.js +5 -0
- package/dist/mcp/local/graphstore-handler.d.ts +214 -0
- package/dist/mcp/local/graphstore-handler.js +272 -0
- package/dist/mcp/local/local-backend.d.ts +347 -0
- package/dist/mcp/local/local-backend.js +3218 -0
- package/dist/mcp/resources.d.ts +62 -0
- package/dist/mcp/resources.js +696 -0
- package/dist/mcp/server.d.ts +23 -0
- package/dist/mcp/server.js +533 -0
- package/dist/mcp/staleness.d.ts +5 -0
- package/dist/mcp/staleness.js +4 -0
- package/dist/mcp/tools.d.ts +27 -0
- package/dist/mcp/tools.js +823 -0
- package/dist/server/analyze-job.d.ts +55 -0
- package/dist/server/analyze-job.js +150 -0
- package/dist/server/analyze-worker.d.ts +13 -0
- package/dist/server/analyze-worker.js +59 -0
- package/dist/server/api.d.ts +47 -0
- package/dist/server/api.js +1727 -0
- package/dist/server/git-clone.d.ts +26 -0
- package/dist/server/git-clone.js +184 -0
- package/dist/server/mcp-http.d.ts +13 -0
- package/dist/server/mcp-http.js +100 -0
- package/dist/storage/git.d.ts +80 -0
- package/dist/storage/git.js +190 -0
- package/dist/storage/repo-manager.d.ts +458 -0
- package/dist/storage/repo-manager.js +766 -0
- package/dist/types/pipeline.d.ts +18 -0
- package/dist/types/pipeline.js +1 -0
- package/hooks/claude/codragraph-hook.cjs +268 -0
- package/hooks/claude/pre-tool-use.sh +79 -0
- package/hooks/claude/session-start.sh +42 -0
- package/package.json +127 -0
- package/scripts/bench-scope-resolution.ts +134 -0
- package/scripts/build-tree-sitter-proto.cjs +82 -0
- package/scripts/build.js +90 -0
- package/scripts/ci-list-migrated-languages.ts +24 -0
- package/scripts/patch-tree-sitter-swift.cjs +78 -0
- package/skills/codragraph-cli.md +82 -0
- package/skills/codragraph-debugging.md +89 -0
- package/skills/codragraph-exploring.md +78 -0
- package/skills/codragraph-guide.md +64 -0
- package/skills/codragraph-impact-analysis.md +97 -0
- package/skills/codragraph-pr-review.md +163 -0
- package/skills/codragraph-refactoring.md +121 -0
- package/vendor/leiden/index.cjs +355 -0
- package/vendor/leiden/utils.cjs +392 -0
- package/vendor/tree-sitter-proto/binding.gyp +30 -0
- package/vendor/tree-sitter-proto/bindings/node/binding.cc +20 -0
- package/vendor/tree-sitter-proto/bindings/node/index.d.ts +28 -0
- package/vendor/tree-sitter-proto/bindings/node/index.js +7 -0
- package/vendor/tree-sitter-proto/package.json +12 -0
- package/vendor/tree-sitter-proto/src/node-types.json +1145 -0
- package/vendor/tree-sitter-proto/src/parser.c +10149 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/alloc.h +54 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/array.h +291 -0
- package/vendor/tree-sitter-proto/src/tree_sitter/parser.h +266 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Clone Utility
|
|
3
|
+
*
|
|
4
|
+
* Shallow-clones repositories into ~/.codragraph/repos/{name}/.
|
|
5
|
+
* If already cloned, does git pull instead.
|
|
6
|
+
*/
|
|
7
|
+
/** Extract the repository name from a git URL (HTTPS or SSH). */
|
|
8
|
+
export declare function extractRepoName(url: string): string;
|
|
9
|
+
/** Get the clone target directory for a repo name. */
|
|
10
|
+
export declare function getCloneDir(repoName: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Validate a git URL to prevent SSRF attacks.
|
|
13
|
+
* Only allows https:// and http:// schemes. Blocks private/internal addresses,
|
|
14
|
+
* IPv6 private ranges, cloud metadata hostnames, and numeric IP encodings.
|
|
15
|
+
*/
|
|
16
|
+
export declare function validateGitUrl(url: string): void;
|
|
17
|
+
export interface CloneProgress {
|
|
18
|
+
phase: 'cloning' | 'pulling';
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Clone or pull a git repository.
|
|
23
|
+
* If targetDir doesn't exist: git clone --depth 1
|
|
24
|
+
* If targetDir exists with .git: git pull --ff-only
|
|
25
|
+
*/
|
|
26
|
+
export declare function cloneOrPull(url: string, targetDir: string, onProgress?: (progress: CloneProgress) => void): Promise<string>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Clone Utility
|
|
3
|
+
*
|
|
4
|
+
* Shallow-clones repositories into ~/.codragraph/repos/{name}/.
|
|
5
|
+
* If already cloned, does git pull instead.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from 'child_process';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import os from 'os';
|
|
10
|
+
import fs from 'fs/promises';
|
|
11
|
+
import { isIP } from 'net';
|
|
12
|
+
/** Extract the repository name from a git URL (HTTPS or SSH). */
|
|
13
|
+
export function extractRepoName(url) {
|
|
14
|
+
const cleaned = url.replace(/\/+$/, '');
|
|
15
|
+
const lastSegment = cleaned.split(/[/:]/).pop() || 'unknown';
|
|
16
|
+
return lastSegment.replace(/\.git$/, '');
|
|
17
|
+
}
|
|
18
|
+
/** Get the clone target directory for a repo name. */
|
|
19
|
+
export function getCloneDir(repoName) {
|
|
20
|
+
return path.join(os.homedir(), '.codragraph', 'repos', repoName);
|
|
21
|
+
}
|
|
22
|
+
// Cloud metadata hostnames that must never be reachable via user-supplied URLs
|
|
23
|
+
const BLOCKED_HOSTNAMES = new Set([
|
|
24
|
+
'localhost',
|
|
25
|
+
'metadata.google.internal',
|
|
26
|
+
'metadata.azure.com',
|
|
27
|
+
'metadata.internal',
|
|
28
|
+
]);
|
|
29
|
+
/**
|
|
30
|
+
* Validate a git URL to prevent SSRF attacks.
|
|
31
|
+
* Only allows https:// and http:// schemes. Blocks private/internal addresses,
|
|
32
|
+
* IPv6 private ranges, cloud metadata hostnames, and numeric IP encodings.
|
|
33
|
+
*/
|
|
34
|
+
export function validateGitUrl(url) {
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = new URL(url);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new Error('Invalid URL');
|
|
41
|
+
}
|
|
42
|
+
if (!['https:', 'http:'].includes(parsed.protocol)) {
|
|
43
|
+
throw new Error('Only https:// and http:// git URLs are allowed');
|
|
44
|
+
}
|
|
45
|
+
const host = parsed.hostname.toLowerCase();
|
|
46
|
+
// Block known dangerous hostnames (cloud metadata services)
|
|
47
|
+
if (BLOCKED_HOSTNAMES.has(host)) {
|
|
48
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
49
|
+
}
|
|
50
|
+
// Strip IPv6 brackets if present (URL parser behavior varies across Node versions)
|
|
51
|
+
let normalizedHost = host;
|
|
52
|
+
if (host.startsWith('[') && host.endsWith(']')) {
|
|
53
|
+
normalizedHost = host.slice(1, -1);
|
|
54
|
+
}
|
|
55
|
+
// Check if this is an IPv6 address
|
|
56
|
+
// Use manual colon detection as fallback since isIP may return 0 for some
|
|
57
|
+
// normalized IPv6 forms (e.g. ::ffff:7f00:1)
|
|
58
|
+
const isIPv6 = isIP(normalizedHost) === 6 || normalizedHost.includes(':');
|
|
59
|
+
if (isIPv6) {
|
|
60
|
+
assertNotPrivateIPv6(normalizedHost);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Check if this is an IPv4 address (including numeric encodings)
|
|
64
|
+
if (isIP(normalizedHost) === 4) {
|
|
65
|
+
assertNotPrivateIPv4(normalizedHost);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// For non-IP hostnames, check for numeric IP tricks
|
|
69
|
+
// Decimal encoding: 2130706433 = 127.0.0.1
|
|
70
|
+
// Hex encoding: 0x7f000001 = 127.0.0.1
|
|
71
|
+
if (/^\d+$/.test(host) || /^0x[0-9a-f]+$/i.test(host)) {
|
|
72
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
73
|
+
}
|
|
74
|
+
// Standard IPv4 regex checks for dotted notation
|
|
75
|
+
if (/^127\./.test(host) ||
|
|
76
|
+
/^10\./.test(host) ||
|
|
77
|
+
/^172\.(1[6-9]|2\d|3[01])\./.test(host) ||
|
|
78
|
+
/^192\.168\./.test(host) ||
|
|
79
|
+
/^169\.254\./.test(host) ||
|
|
80
|
+
/^0\./.test(host) ||
|
|
81
|
+
host === '0.0.0.0' ||
|
|
82
|
+
/^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\./.test(host) ||
|
|
83
|
+
/^198\.1[89]\./.test(host)) {
|
|
84
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function assertNotPrivateIPv6(ip) {
|
|
88
|
+
// Expand common compressed forms for comparison
|
|
89
|
+
const lower = ip.toLowerCase();
|
|
90
|
+
// IPv6 loopback
|
|
91
|
+
if (lower === '::1' || lower === '0:0:0:0:0:0:0:1') {
|
|
92
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
93
|
+
}
|
|
94
|
+
// Unspecified address
|
|
95
|
+
if (lower === '::' || lower === '0:0:0:0:0:0:0:0') {
|
|
96
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
97
|
+
}
|
|
98
|
+
// IPv6 Unique Local Address (fc00::/7 = fc and fd prefixes)
|
|
99
|
+
if (lower.startsWith('fc') || lower.startsWith('fd')) {
|
|
100
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
101
|
+
}
|
|
102
|
+
// IPv6 link-local (fe80::/10)
|
|
103
|
+
if (lower.startsWith('fe80') ||
|
|
104
|
+
lower.startsWith('fe8') ||
|
|
105
|
+
lower.startsWith('fe9') ||
|
|
106
|
+
lower.startsWith('fea') ||
|
|
107
|
+
lower.startsWith('feb')) {
|
|
108
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
109
|
+
}
|
|
110
|
+
// IPv4-mapped IPv6 (::ffff:x.x.x.x or ::ffff:hex:hex)
|
|
111
|
+
// Node may normalize ::ffff:127.0.0.1 to ::ffff:7f00:1
|
|
112
|
+
if (lower.startsWith('::ffff:')) {
|
|
113
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
114
|
+
}
|
|
115
|
+
// Also catch the expanded form: 0:0:0:0:0:ffff:
|
|
116
|
+
if (lower.includes(':ffff:')) {
|
|
117
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function assertNotPrivateIPv4(ip) {
|
|
121
|
+
const parts = ip.split('.').map(Number);
|
|
122
|
+
const [a, b] = parts;
|
|
123
|
+
if (a === 127 ||
|
|
124
|
+
a === 10 ||
|
|
125
|
+
(a === 172 && b >= 16 && b <= 31) ||
|
|
126
|
+
(a === 192 && b === 168) ||
|
|
127
|
+
(a === 169 && b === 254) ||
|
|
128
|
+
a === 0 ||
|
|
129
|
+
(a === 100 && b >= 64 && b <= 127) ||
|
|
130
|
+
(a === 198 && (b === 18 || b === 19))) {
|
|
131
|
+
throw new Error('Cloning from private/internal addresses is not allowed');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Clone or pull a git repository.
|
|
136
|
+
* If targetDir doesn't exist: git clone --depth 1
|
|
137
|
+
* If targetDir exists with .git: git pull --ff-only
|
|
138
|
+
*/
|
|
139
|
+
export async function cloneOrPull(url, targetDir, onProgress) {
|
|
140
|
+
const exists = await fs.access(path.join(targetDir, '.git')).then(() => true, () => false);
|
|
141
|
+
if (exists) {
|
|
142
|
+
onProgress?.({ phase: 'pulling', message: 'Pulling latest changes...' });
|
|
143
|
+
await runGit(['pull', '--ff-only'], targetDir);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
validateGitUrl(url);
|
|
147
|
+
await fs.mkdir(path.dirname(targetDir), { recursive: true });
|
|
148
|
+
onProgress?.({ phase: 'cloning', message: `Cloning ${url}...` });
|
|
149
|
+
await runGit(['clone', '--depth', '1', url, targetDir]);
|
|
150
|
+
}
|
|
151
|
+
return targetDir;
|
|
152
|
+
}
|
|
153
|
+
function runGit(args, cwd) {
|
|
154
|
+
return new Promise((resolve, reject) => {
|
|
155
|
+
const proc = spawn('git', args, {
|
|
156
|
+
cwd,
|
|
157
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
158
|
+
env: {
|
|
159
|
+
...process.env,
|
|
160
|
+
// Prevent git from prompting for credentials (hangs the process)
|
|
161
|
+
GIT_TERMINAL_PROMPT: '0',
|
|
162
|
+
// Ensure no credential helper tries to open a GUI prompt
|
|
163
|
+
GIT_ASKPASS: process.platform === 'win32' ? 'echo' : '/bin/true',
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
let stderr = '';
|
|
167
|
+
proc.stderr.on('data', (chunk) => {
|
|
168
|
+
stderr += chunk;
|
|
169
|
+
});
|
|
170
|
+
proc.on('close', (code) => {
|
|
171
|
+
if (code === 0)
|
|
172
|
+
resolve();
|
|
173
|
+
else {
|
|
174
|
+
// Log full stderr internally but don't expose it to API callers (SSRF mitigation)
|
|
175
|
+
if (stderr.trim())
|
|
176
|
+
console.error(`git ${args[0]} stderr: ${stderr.trim()}`);
|
|
177
|
+
reject(new Error(`git ${args[0]} failed (exit code ${code})`));
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
proc.on('error', (err) => {
|
|
181
|
+
reject(new Error(`Failed to spawn git: ${err.message}`));
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP over HTTP
|
|
3
|
+
*
|
|
4
|
+
* Mounts the CodraGraph MCP server on Express using StreamableHTTP transport.
|
|
5
|
+
* Each connecting client gets its own stateful session; the LocalBackend
|
|
6
|
+
* is shared across all sessions (thread-safe — lazy LadybugDB per repo).
|
|
7
|
+
*
|
|
8
|
+
* Sessions are cleaned up on explicit close or after SESSION_TTL_MS of inactivity
|
|
9
|
+
* (guards against network drops that never trigger onclose).
|
|
10
|
+
*/
|
|
11
|
+
import type { Express } from 'express';
|
|
12
|
+
import type { LocalBackend } from '../mcp/local/local-backend.js';
|
|
13
|
+
export declare function mountMCPEndpoints(app: Express, backend: LocalBackend): () => Promise<void>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP over HTTP
|
|
3
|
+
*
|
|
4
|
+
* Mounts the CodraGraph MCP server on Express using StreamableHTTP transport.
|
|
5
|
+
* Each connecting client gets its own stateful session; the LocalBackend
|
|
6
|
+
* is shared across all sessions (thread-safe — lazy LadybugDB per repo).
|
|
7
|
+
*
|
|
8
|
+
* Sessions are cleaned up on explicit close or after SESSION_TTL_MS of inactivity
|
|
9
|
+
* (guards against network drops that never trigger onclose).
|
|
10
|
+
*/
|
|
11
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
12
|
+
import { createMCPServer } from '../mcp/server.js';
|
|
13
|
+
import { randomUUID } from 'crypto';
|
|
14
|
+
/** Idle sessions are evicted after 30 minutes */
|
|
15
|
+
const SESSION_TTL_MS = 30 * 60 * 1000;
|
|
16
|
+
/** Cleanup sweep runs every 5 minutes */
|
|
17
|
+
const CLEANUP_INTERVAL_MS = 5 * 60 * 1000;
|
|
18
|
+
export function mountMCPEndpoints(app, backend) {
|
|
19
|
+
const sessions = new Map();
|
|
20
|
+
// Periodic cleanup of idle sessions (guards against network drops)
|
|
21
|
+
const cleanupTimer = setInterval(() => {
|
|
22
|
+
const now = Date.now();
|
|
23
|
+
for (const [id, session] of sessions) {
|
|
24
|
+
if (now - session.lastActivity > SESSION_TTL_MS) {
|
|
25
|
+
try {
|
|
26
|
+
session.server.close();
|
|
27
|
+
}
|
|
28
|
+
catch { }
|
|
29
|
+
sessions.delete(id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, CLEANUP_INTERVAL_MS);
|
|
33
|
+
if (cleanupTimer && typeof cleanupTimer === 'object' && 'unref' in cleanupTimer) {
|
|
34
|
+
cleanupTimer.unref();
|
|
35
|
+
}
|
|
36
|
+
const handleMcpRequest = async (req, res) => {
|
|
37
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
38
|
+
if (sessionId && sessions.has(sessionId)) {
|
|
39
|
+
// Existing session — delegate to its transport
|
|
40
|
+
const session = sessions.get(sessionId);
|
|
41
|
+
session.lastActivity = Date.now();
|
|
42
|
+
await session.transport.handleRequest(req, res, req.body);
|
|
43
|
+
}
|
|
44
|
+
else if (sessionId) {
|
|
45
|
+
// Unknown/expired session ID — tell client to re-initialize (per MCP spec)
|
|
46
|
+
res.status(404).json({
|
|
47
|
+
jsonrpc: '2.0',
|
|
48
|
+
error: { code: -32001, message: 'Session not found. Re-initialize.' },
|
|
49
|
+
id: null,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else if (req.method === 'POST') {
|
|
53
|
+
// No session ID — new client initializing
|
|
54
|
+
const transport = new StreamableHTTPServerTransport({
|
|
55
|
+
sessionIdGenerator: () => randomUUID(),
|
|
56
|
+
});
|
|
57
|
+
const server = createMCPServer(backend);
|
|
58
|
+
await server.connect(transport);
|
|
59
|
+
await transport.handleRequest(req, res, req.body);
|
|
60
|
+
if (transport.sessionId) {
|
|
61
|
+
sessions.set(transport.sessionId, { server, transport, lastActivity: Date.now() });
|
|
62
|
+
transport.onclose = () => {
|
|
63
|
+
sessions.delete(transport.sessionId);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
res.status(400).json({
|
|
69
|
+
jsonrpc: '2.0',
|
|
70
|
+
error: { code: -32000, message: 'No valid session. Send a POST to initialize.' },
|
|
71
|
+
id: null,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
app.all('/api/mcp', (req, res) => {
|
|
76
|
+
void handleMcpRequest(req, res).catch((err) => {
|
|
77
|
+
console.error('MCP HTTP request failed:', err);
|
|
78
|
+
if (res.headersSent)
|
|
79
|
+
return;
|
|
80
|
+
res.status(500).json({
|
|
81
|
+
jsonrpc: '2.0',
|
|
82
|
+
error: { code: -32000, message: 'Internal MCP server error' },
|
|
83
|
+
id: null,
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
const cleanup = async () => {
|
|
88
|
+
clearInterval(cleanupTimer);
|
|
89
|
+
const closers = [...sessions.values()].map(async (session) => {
|
|
90
|
+
try {
|
|
91
|
+
await Promise.resolve(session.server.close());
|
|
92
|
+
}
|
|
93
|
+
catch { }
|
|
94
|
+
});
|
|
95
|
+
sessions.clear();
|
|
96
|
+
await Promise.allSettled(closers);
|
|
97
|
+
};
|
|
98
|
+
console.log('MCP HTTP endpoints mounted at /api/mcp');
|
|
99
|
+
return cleanup;
|
|
100
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const isGitRepo: (repoPath: string) => boolean;
|
|
2
|
+
export declare const getCurrentCommit: (repoPath: string) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Get a stable canonical identifier for the repo's `origin` remote, if any.
|
|
5
|
+
*
|
|
6
|
+
* Used to fingerprint two on-disk clones as the same logical repository
|
|
7
|
+
* (issue #XXX — silent graph drift across sibling clones). `path` alone
|
|
8
|
+
* is unreliable: worktrees, "clean clone for indexing" hygiene, and
|
|
9
|
+
* multi-agent workspaces routinely have the same repo at multiple
|
|
10
|
+
* absolute paths. The remote URL is the only on-disk signal that
|
|
11
|
+
* survives those conventions.
|
|
12
|
+
*
|
|
13
|
+
* Normalisation strategy:
|
|
14
|
+
* - Strip a trailing `.git` so `https://x/y` and `https://x/y.git` collapse.
|
|
15
|
+
* - Strip a trailing `/` for the same reason.
|
|
16
|
+
* - `git@github.com:foo/bar` and `https://github.com/foo/bar` are
|
|
17
|
+
* intentionally NOT collapsed — they are different remotes from
|
|
18
|
+
* git's perspective and we don't want to assert equivalence.
|
|
19
|
+
* - Lower-case the host portion so `GitHub.com` and `github.com`
|
|
20
|
+
* don't desync; preserves case in path because some hosts
|
|
21
|
+
* (Bitbucket Server) treat repo paths case-sensitively.
|
|
22
|
+
*
|
|
23
|
+
* Returns `undefined` when there is no origin remote, the directory
|
|
24
|
+
* isn't a git repo, or git itself isn't available.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getRemoteUrl: (repoPath: string) => string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Find the git repository root from any path inside the repo
|
|
29
|
+
*/
|
|
30
|
+
export declare const getGitRoot: (fromPath: string) => string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Check whether a directory contains a .git entry (file or folder).
|
|
33
|
+
*
|
|
34
|
+
* This is intentionally a simple filesystem check rather than running
|
|
35
|
+
* `git rev-parse`, so it works even when git is not installed or when
|
|
36
|
+
* the directory is a git-worktree root (which has a .git file, not a
|
|
37
|
+
* directory). Use `isGitRepo` for a definitive git answer.
|
|
38
|
+
*
|
|
39
|
+
* @param dirPath - Absolute path to the directory to inspect.
|
|
40
|
+
* @returns `true` when `.git` is present, `false` otherwise.
|
|
41
|
+
*/
|
|
42
|
+
export declare const hasGitDir: (dirPath: string) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Read `remote.origin.url` from a git repository, or `null` if not a
|
|
45
|
+
* git repo, has no `origin` remote, or git is unavailable.
|
|
46
|
+
*
|
|
47
|
+
* Used by the registry-name inference path (#979) to recover a
|
|
48
|
+
* meaningful repo name when `path.basename(repoPath)` is generic
|
|
49
|
+
* (e.g. monorepo subprojects, git worktrees, Gas-Town-style
|
|
50
|
+
* `<rig>/refinery/rig/` layouts).
|
|
51
|
+
*/
|
|
52
|
+
export declare const getRemoteOriginUrl: (repoPath: string) => string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Parse a repository name out of a git remote URL. Handles the common
|
|
55
|
+
* SSH (`git@host:owner/repo.git`), HTTPS (`https://host/owner/repo.git`),
|
|
56
|
+
* `git://`, `ssh://`, and `file://` shapes. Returns `null` for empty /
|
|
57
|
+
* unparseable input.
|
|
58
|
+
*
|
|
59
|
+
* The heuristic: strip a trailing `.git` and trailing slashes, then
|
|
60
|
+
* take the segment after the last `/` or `:`.
|
|
61
|
+
*/
|
|
62
|
+
export declare const parseRepoNameFromUrl: (url: string | null | undefined) => string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Convenience wrapper: derive a registry-friendly name from the repo's
|
|
65
|
+
* `origin` remote, or `null` when it cannot be inferred.
|
|
66
|
+
*/
|
|
67
|
+
export declare const getInferredRepoName: (repoPath: string) => string | null;
|
|
68
|
+
export interface DiffHunk {
|
|
69
|
+
startLine: number;
|
|
70
|
+
endLine: number;
|
|
71
|
+
}
|
|
72
|
+
export interface FileDiff {
|
|
73
|
+
filePath: string;
|
|
74
|
+
hunks: DiffHunk[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse unified diff output (with -U0) into per-file hunk ranges.
|
|
78
|
+
* Extracts the new-file line ranges from @@ hunk headers.
|
|
79
|
+
*/
|
|
80
|
+
export declare function parseDiffHunks(diffOutput: string): FileDiff[];
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { statSync } from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
// Git utilities for repository detection, commit tracking, and diff analysis
|
|
5
|
+
export const isGitRepo = (repoPath) => {
|
|
6
|
+
try {
|
|
7
|
+
execSync('git rev-parse --is-inside-work-tree', { cwd: repoPath, stdio: 'ignore' });
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export const getCurrentCommit = (repoPath) => {
|
|
15
|
+
try {
|
|
16
|
+
return execSync('git rev-parse HEAD', { cwd: repoPath }).toString().trim();
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Get a stable canonical identifier for the repo's `origin` remote, if any.
|
|
24
|
+
*
|
|
25
|
+
* Used to fingerprint two on-disk clones as the same logical repository
|
|
26
|
+
* (issue #XXX — silent graph drift across sibling clones). `path` alone
|
|
27
|
+
* is unreliable: worktrees, "clean clone for indexing" hygiene, and
|
|
28
|
+
* multi-agent workspaces routinely have the same repo at multiple
|
|
29
|
+
* absolute paths. The remote URL is the only on-disk signal that
|
|
30
|
+
* survives those conventions.
|
|
31
|
+
*
|
|
32
|
+
* Normalisation strategy:
|
|
33
|
+
* - Strip a trailing `.git` so `https://x/y` and `https://x/y.git` collapse.
|
|
34
|
+
* - Strip a trailing `/` for the same reason.
|
|
35
|
+
* - `git@github.com:foo/bar` and `https://github.com/foo/bar` are
|
|
36
|
+
* intentionally NOT collapsed — they are different remotes from
|
|
37
|
+
* git's perspective and we don't want to assert equivalence.
|
|
38
|
+
* - Lower-case the host portion so `GitHub.com` and `github.com`
|
|
39
|
+
* don't desync; preserves case in path because some hosts
|
|
40
|
+
* (Bitbucket Server) treat repo paths case-sensitively.
|
|
41
|
+
*
|
|
42
|
+
* Returns `undefined` when there is no origin remote, the directory
|
|
43
|
+
* isn't a git repo, or git itself isn't available.
|
|
44
|
+
*/
|
|
45
|
+
export const getRemoteUrl = (repoPath) => {
|
|
46
|
+
let raw;
|
|
47
|
+
try {
|
|
48
|
+
raw = execSync('git config --get remote.origin.url', {
|
|
49
|
+
cwd: repoPath,
|
|
50
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
51
|
+
})
|
|
52
|
+
.toString()
|
|
53
|
+
.trim();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
if (!raw)
|
|
59
|
+
return undefined;
|
|
60
|
+
let normalised = raw.replace(/\/$/, '').replace(/\.git$/, '');
|
|
61
|
+
// Lower-case the host segment of `scheme://[user@]host[:port]/...`
|
|
62
|
+
// and the host segment of `git@host:owner/repo` SCP form.
|
|
63
|
+
// SSH user-segment regex deliberately accepts the common
|
|
64
|
+
// `git@`/`<alnum>-_@` cases. Less common usernames (e.g. with
|
|
65
|
+
// dots) fall through to the URL-form branch — they will simply
|
|
66
|
+
// not get host-case normalisation, which is acceptable: the raw
|
|
67
|
+
// `git config` output is still a valid fingerprint, just slightly
|
|
68
|
+
// less collapsible across host casings.
|
|
69
|
+
const sshMatch = normalised.match(/^(git@|[a-zA-Z0-9_-]+@)([^:/]+)(:.+)$/);
|
|
70
|
+
if (sshMatch) {
|
|
71
|
+
normalised = `${sshMatch[1]}${sshMatch[2].toLowerCase()}${sshMatch[3]}`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
const urlMatch = normalised.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)([^/]+)(\/.*)?$/);
|
|
75
|
+
if (urlMatch) {
|
|
76
|
+
normalised = `${urlMatch[1]}${urlMatch[2].toLowerCase()}${urlMatch[3] ?? ''}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return normalised;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Find the git repository root from any path inside the repo
|
|
83
|
+
*/
|
|
84
|
+
export const getGitRoot = (fromPath) => {
|
|
85
|
+
try {
|
|
86
|
+
const raw = execSync('git rev-parse --show-toplevel', { cwd: fromPath }).toString().trim();
|
|
87
|
+
// On Windows, git returns /d/Projects/Foo — path.resolve normalizes to D:\Projects\Foo
|
|
88
|
+
return path.resolve(raw);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Check whether a directory contains a .git entry (file or folder).
|
|
96
|
+
*
|
|
97
|
+
* This is intentionally a simple filesystem check rather than running
|
|
98
|
+
* `git rev-parse`, so it works even when git is not installed or when
|
|
99
|
+
* the directory is a git-worktree root (which has a .git file, not a
|
|
100
|
+
* directory). Use `isGitRepo` for a definitive git answer.
|
|
101
|
+
*
|
|
102
|
+
* @param dirPath - Absolute path to the directory to inspect.
|
|
103
|
+
* @returns `true` when `.git` is present, `false` otherwise.
|
|
104
|
+
*/
|
|
105
|
+
export const hasGitDir = (dirPath) => {
|
|
106
|
+
try {
|
|
107
|
+
statSync(path.join(dirPath, '.git'));
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Read `remote.origin.url` from a git repository, or `null` if not a
|
|
116
|
+
* git repo, has no `origin` remote, or git is unavailable.
|
|
117
|
+
*
|
|
118
|
+
* Used by the registry-name inference path (#979) to recover a
|
|
119
|
+
* meaningful repo name when `path.basename(repoPath)` is generic
|
|
120
|
+
* (e.g. monorepo subprojects, git worktrees, Gas-Town-style
|
|
121
|
+
* `<rig>/refinery/rig/` layouts).
|
|
122
|
+
*/
|
|
123
|
+
export const getRemoteOriginUrl = (repoPath) => {
|
|
124
|
+
try {
|
|
125
|
+
const url = execSync('git config --get remote.origin.url', {
|
|
126
|
+
cwd: repoPath,
|
|
127
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
128
|
+
})
|
|
129
|
+
.toString()
|
|
130
|
+
.trim();
|
|
131
|
+
return url || null;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Parse a repository name out of a git remote URL. Handles the common
|
|
139
|
+
* SSH (`git@host:owner/repo.git`), HTTPS (`https://host/owner/repo.git`),
|
|
140
|
+
* `git://`, `ssh://`, and `file://` shapes. Returns `null` for empty /
|
|
141
|
+
* unparseable input.
|
|
142
|
+
*
|
|
143
|
+
* The heuristic: strip a trailing `.git` and trailing slashes, then
|
|
144
|
+
* take the segment after the last `/` or `:`.
|
|
145
|
+
*/
|
|
146
|
+
export const parseRepoNameFromUrl = (url) => {
|
|
147
|
+
if (!url)
|
|
148
|
+
return null;
|
|
149
|
+
const trimmed = url.trim();
|
|
150
|
+
if (!trimmed)
|
|
151
|
+
return null;
|
|
152
|
+
// Strip `.git` suffix (case-insensitive) and any trailing slashes.
|
|
153
|
+
const withoutSuffix = trimmed.replace(/\.git\/*$/i, '').replace(/\/+$/, '');
|
|
154
|
+
// Last path segment, splitting on either `/` or `:` (covers SSH form).
|
|
155
|
+
const m = withoutSuffix.match(/[/:]([^/:]+)$/);
|
|
156
|
+
const candidate = m ? m[1] : withoutSuffix;
|
|
157
|
+
return candidate || null;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Convenience wrapper: derive a registry-friendly name from the repo's
|
|
161
|
+
* `origin` remote, or `null` when it cannot be inferred.
|
|
162
|
+
*/
|
|
163
|
+
export const getInferredRepoName = (repoPath) => {
|
|
164
|
+
return parseRepoNameFromUrl(getRemoteOriginUrl(repoPath));
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Parse unified diff output (with -U0) into per-file hunk ranges.
|
|
168
|
+
* Extracts the new-file line ranges from @@ hunk headers.
|
|
169
|
+
*/
|
|
170
|
+
export function parseDiffHunks(diffOutput) {
|
|
171
|
+
const files = [];
|
|
172
|
+
let current = null;
|
|
173
|
+
for (const line of diffOutput.split('\n')) {
|
|
174
|
+
if (line.startsWith('+++ b/')) {
|
|
175
|
+
current = { filePath: line.slice(6), hunks: [] };
|
|
176
|
+
files.push(current);
|
|
177
|
+
}
|
|
178
|
+
else if (line.startsWith('@@') && current) {
|
|
179
|
+
const match = line.match(/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/);
|
|
180
|
+
if (match) {
|
|
181
|
+
const start = parseInt(match[1], 10);
|
|
182
|
+
const count = match[2] !== undefined ? parseInt(match[2], 10) : 1;
|
|
183
|
+
if (count > 0) {
|
|
184
|
+
current.hunks.push({ startLine: start, endLine: start + count - 1 });
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return files;
|
|
190
|
+
}
|