@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,898 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wiki Generator
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates the full wiki generation pipeline:
|
|
5
|
+
* Phase 0: Validate prerequisites + gather graph structure
|
|
6
|
+
* Phase 1: Build module tree (one LLM call)
|
|
7
|
+
* Phase 2: Generate module pages (one LLM call per module, bottom-up)
|
|
8
|
+
* Phase 3: Generate overview page
|
|
9
|
+
*
|
|
10
|
+
* Supports incremental updates via git diff + module-file mapping.
|
|
11
|
+
*/
|
|
12
|
+
import fs from 'fs/promises';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { execSync, execFileSync } from 'child_process';
|
|
15
|
+
import { initWikiDb, closeWikiDb, touchWikiDb, getFilesWithExports, getAllFiles, getIntraModuleCallEdges, getInterModuleCallEdges, getProcessesForFiles, getAllProcesses, getInterModuleEdgesForOverview, } from './graph-queries.js';
|
|
16
|
+
import { generateHTMLViewer } from './html-viewer.js';
|
|
17
|
+
import { callLLM, estimateTokens, } from './llm-client.js';
|
|
18
|
+
import { callCursorLLM, resolveCursorConfig } from './cursor-client.js';
|
|
19
|
+
import { GROUPING_SYSTEM_PROMPT, GROUPING_USER_PROMPT, MODULE_SYSTEM_PROMPT, MODULE_USER_PROMPT, PARENT_SYSTEM_PROMPT, PARENT_USER_PROMPT, OVERVIEW_SYSTEM_PROMPT, OVERVIEW_USER_PROMPT, fillTemplate, formatFileListForGrouping, formatDirectoryTree, formatCallEdges, formatProcesses, } from './prompts.js';
|
|
20
|
+
import { shouldIgnorePath } from '../../config/ignore-service.js';
|
|
21
|
+
// ─── Constants ────────────────────────────────────────────────────────
|
|
22
|
+
const DEFAULT_MAX_TOKENS_PER_MODULE = 30_000;
|
|
23
|
+
const WIKI_DIR = 'wiki';
|
|
24
|
+
// ─── Generator Class ──────────────────────────────────────────────────
|
|
25
|
+
export class WikiGenerator {
|
|
26
|
+
repoPath;
|
|
27
|
+
storagePath;
|
|
28
|
+
wikiDir;
|
|
29
|
+
lbugPath;
|
|
30
|
+
llmConfig;
|
|
31
|
+
maxTokensPerModule;
|
|
32
|
+
concurrency;
|
|
33
|
+
options;
|
|
34
|
+
onProgress;
|
|
35
|
+
failedModules = [];
|
|
36
|
+
constructor(repoPath, storagePath, lbugPath, llmConfig, options = {}, onProgress) {
|
|
37
|
+
this.repoPath = repoPath;
|
|
38
|
+
this.storagePath = storagePath;
|
|
39
|
+
this.wikiDir = path.join(storagePath, WIKI_DIR);
|
|
40
|
+
this.lbugPath = lbugPath;
|
|
41
|
+
this.options = options;
|
|
42
|
+
this.llmConfig = llmConfig;
|
|
43
|
+
this.maxTokensPerModule = options.maxTokensPerModule ?? DEFAULT_MAX_TOKENS_PER_MODULE;
|
|
44
|
+
this.concurrency = options.concurrency ?? 3;
|
|
45
|
+
const progressFn = onProgress || (() => { });
|
|
46
|
+
this.onProgress = (phase, percent, detail) => {
|
|
47
|
+
if (percent > 0)
|
|
48
|
+
this.lastPercent = percent;
|
|
49
|
+
progressFn(phase, percent, detail);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
lastPercent = 0;
|
|
53
|
+
/**
|
|
54
|
+
* Create streaming options that report LLM progress to the progress bar.
|
|
55
|
+
*
|
|
56
|
+
* Progress calculation:
|
|
57
|
+
* - If fixedPercent is provided, we show incremental progress within that phase
|
|
58
|
+
* based on token generation (e.g., grouping at 15% → 15-28%)
|
|
59
|
+
* - If fixedPercent is NOT provided, we only update the label with token count
|
|
60
|
+
* but keep the current percentage (avoids fluctuation during module generation)
|
|
61
|
+
*
|
|
62
|
+
* Also touches the DB connection periodically to prevent idle timeout.
|
|
63
|
+
*/
|
|
64
|
+
streamOpts(label, fixedPercent, percentRange = 10) {
|
|
65
|
+
const hasFixedStart = fixedPercent !== undefined;
|
|
66
|
+
const startPercent = fixedPercent ?? this.lastPercent;
|
|
67
|
+
const expectedTokens = 2000;
|
|
68
|
+
let lastTouch = Date.now();
|
|
69
|
+
return {
|
|
70
|
+
onChunk: (chars) => {
|
|
71
|
+
const tokens = Math.round(chars / 4);
|
|
72
|
+
if (hasFixedStart) {
|
|
73
|
+
// For fixed phases (like grouping), show incremental progress
|
|
74
|
+
const progress = Math.min(1, tokens / expectedTokens);
|
|
75
|
+
const pct = Math.round(startPercent + progress * percentRange);
|
|
76
|
+
this.onProgress('stream', pct, `${label} (${tokens} tok)`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// For module generation, only update the label, keep current percent
|
|
80
|
+
this.onProgress('stream', this.lastPercent, `${label} (${tokens} tok)`);
|
|
81
|
+
}
|
|
82
|
+
// Touch DB every 60s to prevent idle timeout during long LLM calls
|
|
83
|
+
const now = Date.now();
|
|
84
|
+
if (now - lastTouch > 60_000) {
|
|
85
|
+
touchWikiDb();
|
|
86
|
+
lastTouch = now;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Route LLM call to the appropriate provider (OpenAI-compatible or Cursor CLI).
|
|
93
|
+
*/
|
|
94
|
+
async invokeLLM(prompt, systemPrompt, options) {
|
|
95
|
+
if (this.llmConfig.provider === 'cursor') {
|
|
96
|
+
const cursorConfig = resolveCursorConfig({
|
|
97
|
+
model: this.llmConfig.model,
|
|
98
|
+
workingDirectory: this.repoPath,
|
|
99
|
+
});
|
|
100
|
+
return callCursorLLM(prompt, cursorConfig, systemPrompt, options);
|
|
101
|
+
}
|
|
102
|
+
return callLLM(prompt, this.llmConfig, systemPrompt, options);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Main entry point. Runs the full pipeline or incremental update.
|
|
106
|
+
*/
|
|
107
|
+
async run() {
|
|
108
|
+
await fs.mkdir(this.wikiDir, { recursive: true });
|
|
109
|
+
const existingMeta = await this.loadWikiMeta();
|
|
110
|
+
const currentCommit = this.getCurrentCommit();
|
|
111
|
+
const forceMode = this.options.force;
|
|
112
|
+
// Up-to-date check (skip if --force)
|
|
113
|
+
if (!forceMode && existingMeta && existingMeta.fromCommit === currentCommit) {
|
|
114
|
+
// Still regenerate the HTML viewer in case it's missing
|
|
115
|
+
await this.ensureHTMLViewer();
|
|
116
|
+
return { pagesGenerated: 0, mode: 'up-to-date', failedModules: [] };
|
|
117
|
+
}
|
|
118
|
+
// Force mode: delete snapshot to force full re-grouping
|
|
119
|
+
if (forceMode) {
|
|
120
|
+
try {
|
|
121
|
+
await fs.unlink(path.join(this.wikiDir, 'first_module_tree.json'));
|
|
122
|
+
}
|
|
123
|
+
catch { }
|
|
124
|
+
// Delete existing module pages so they get regenerated
|
|
125
|
+
const existingFiles = await fs.readdir(this.wikiDir).catch(() => []);
|
|
126
|
+
for (const f of existingFiles) {
|
|
127
|
+
if (f.endsWith('.md')) {
|
|
128
|
+
try {
|
|
129
|
+
await fs.unlink(path.join(this.wikiDir, f));
|
|
130
|
+
}
|
|
131
|
+
catch { }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Init graph
|
|
136
|
+
this.onProgress('init', 2, 'Connecting to knowledge graph...');
|
|
137
|
+
await initWikiDb(this.lbugPath);
|
|
138
|
+
let result;
|
|
139
|
+
try {
|
|
140
|
+
if (!forceMode && existingMeta && existingMeta.fromCommit) {
|
|
141
|
+
result = await this.incrementalUpdate(existingMeta, currentCommit);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
result = await this.fullGeneration(currentCommit);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
await closeWikiDb();
|
|
149
|
+
}
|
|
150
|
+
// Always generate the HTML viewer after wiki content changes
|
|
151
|
+
await this.ensureHTMLViewer();
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
// ─── HTML Viewer ─────────────────────────────────────────────────────
|
|
155
|
+
async ensureHTMLViewer() {
|
|
156
|
+
// Only generate if there are markdown pages to bundle
|
|
157
|
+
const dirEntries = await fs.readdir(this.wikiDir).catch(() => []);
|
|
158
|
+
const hasMd = dirEntries.some((f) => f.endsWith('.md'));
|
|
159
|
+
if (!hasMd)
|
|
160
|
+
return;
|
|
161
|
+
this.onProgress('html', 98, 'Building HTML viewer...');
|
|
162
|
+
const repoName = path.basename(this.repoPath);
|
|
163
|
+
await generateHTMLViewer(this.wikiDir, repoName);
|
|
164
|
+
}
|
|
165
|
+
// ─── Full Generation ────────────────────────────────────────────────
|
|
166
|
+
async fullGeneration(currentCommit) {
|
|
167
|
+
let pagesGenerated = 0;
|
|
168
|
+
// Phase 0: Gather structure
|
|
169
|
+
this.onProgress('gather', 5, 'Querying graph for file structure...');
|
|
170
|
+
const filesWithExports = await getFilesWithExports();
|
|
171
|
+
const allFiles = await getAllFiles();
|
|
172
|
+
// Filter to source files only
|
|
173
|
+
const sourceFiles = allFiles.filter((f) => !shouldIgnorePath(f));
|
|
174
|
+
if (sourceFiles.length === 0) {
|
|
175
|
+
throw new Error('No source files found in the knowledge graph. Nothing to document.');
|
|
176
|
+
}
|
|
177
|
+
// Build enriched file list (merge exports into all source files)
|
|
178
|
+
const exportMap = new Map(filesWithExports.map((f) => [f.filePath, f]));
|
|
179
|
+
const enrichedFiles = sourceFiles.map((fp) => {
|
|
180
|
+
return exportMap.get(fp) || { filePath: fp, symbols: [] };
|
|
181
|
+
});
|
|
182
|
+
this.onProgress('gather', 10, `Found ${sourceFiles.length} source files`);
|
|
183
|
+
// Phase 1: Build module tree
|
|
184
|
+
const moduleTree = await this.buildModuleTree(enrichedFiles);
|
|
185
|
+
pagesGenerated = 0;
|
|
186
|
+
// If reviewOnly mode, save tree and stop for user to review/edit
|
|
187
|
+
if (this.options.reviewOnly) {
|
|
188
|
+
await this.saveModuleTree(moduleTree);
|
|
189
|
+
this.onProgress('review', 30, 'Module tree ready for review');
|
|
190
|
+
const reviewResult = {
|
|
191
|
+
pagesGenerated: 0,
|
|
192
|
+
mode: 'full',
|
|
193
|
+
failedModules: [],
|
|
194
|
+
moduleTree,
|
|
195
|
+
};
|
|
196
|
+
return reviewResult;
|
|
197
|
+
}
|
|
198
|
+
// Phase 2: Generate module pages (parallel with concurrency limit)
|
|
199
|
+
const totalModules = this.countModules(moduleTree);
|
|
200
|
+
let modulesProcessed = 0;
|
|
201
|
+
const reportProgress = (moduleName) => {
|
|
202
|
+
modulesProcessed++;
|
|
203
|
+
const percent = 30 + Math.round((modulesProcessed / totalModules) * 55);
|
|
204
|
+
const detail = moduleName
|
|
205
|
+
? `${modulesProcessed}/${totalModules} — ${moduleName}`
|
|
206
|
+
: `${modulesProcessed}/${totalModules} modules`;
|
|
207
|
+
this.onProgress('modules', percent, detail);
|
|
208
|
+
};
|
|
209
|
+
// Flatten tree into layers: leaves first, then parents
|
|
210
|
+
// Leaves can run in parallel; parents must wait for their children
|
|
211
|
+
const { leaves, parents } = this.flattenModuleTree(moduleTree);
|
|
212
|
+
// Process all leaf modules in parallel
|
|
213
|
+
pagesGenerated += await this.runParallel(leaves, async (node) => {
|
|
214
|
+
const pagePath = path.join(this.wikiDir, `${node.slug}.md`);
|
|
215
|
+
if (await this.fileExists(pagePath)) {
|
|
216
|
+
reportProgress(node.name);
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
try {
|
|
220
|
+
await this.generateLeafPage(node);
|
|
221
|
+
reportProgress(node.name);
|
|
222
|
+
return 1;
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
this.failedModules.push(node.name);
|
|
226
|
+
reportProgress(`Failed: ${node.name}`);
|
|
227
|
+
return 0;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
// Process parent modules sequentially (they depend on child docs)
|
|
231
|
+
for (const node of parents) {
|
|
232
|
+
const pagePath = path.join(this.wikiDir, `${node.slug}.md`);
|
|
233
|
+
if (await this.fileExists(pagePath)) {
|
|
234
|
+
reportProgress(node.name);
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
await this.generateParentPage(node);
|
|
239
|
+
pagesGenerated++;
|
|
240
|
+
reportProgress(node.name);
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
this.failedModules.push(node.name);
|
|
244
|
+
reportProgress(`Failed: ${node.name}`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Phase 3: Generate overview
|
|
248
|
+
this.onProgress('overview', 88, 'Generating overview page...');
|
|
249
|
+
await this.generateOverview(moduleTree);
|
|
250
|
+
pagesGenerated++;
|
|
251
|
+
// Save metadata
|
|
252
|
+
this.onProgress('finalize', 95, 'Saving metadata...');
|
|
253
|
+
const moduleFiles = this.extractModuleFiles(moduleTree);
|
|
254
|
+
await this.saveModuleTree(moduleTree);
|
|
255
|
+
await this.saveWikiMeta({
|
|
256
|
+
fromCommit: currentCommit,
|
|
257
|
+
generatedAt: new Date().toISOString(),
|
|
258
|
+
model: this.llmConfig.model,
|
|
259
|
+
moduleFiles,
|
|
260
|
+
moduleTree,
|
|
261
|
+
});
|
|
262
|
+
this.onProgress('done', 100, 'Wiki generation complete');
|
|
263
|
+
return { pagesGenerated, mode: 'full', failedModules: [...this.failedModules] };
|
|
264
|
+
}
|
|
265
|
+
// ─── Phase 1: Build Module Tree ────────────────────────────────────
|
|
266
|
+
async buildModuleTree(files) {
|
|
267
|
+
// First, check for user-edited module_tree.json (from --review workflow)
|
|
268
|
+
const editablePath = path.join(this.wikiDir, 'module_tree.json');
|
|
269
|
+
try {
|
|
270
|
+
const edited = await fs.readFile(editablePath, 'utf-8');
|
|
271
|
+
const parsed = JSON.parse(edited);
|
|
272
|
+
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
273
|
+
this.onProgress('grouping', 25, 'Using edited module tree');
|
|
274
|
+
return parsed;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
// No edited tree, check for original snapshot
|
|
279
|
+
}
|
|
280
|
+
// Check for existing immutable snapshot (resumability)
|
|
281
|
+
const snapshotPath = path.join(this.wikiDir, 'first_module_tree.json');
|
|
282
|
+
try {
|
|
283
|
+
const existing = await fs.readFile(snapshotPath, 'utf-8');
|
|
284
|
+
const parsed = JSON.parse(existing);
|
|
285
|
+
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
286
|
+
this.onProgress('grouping', 25, 'Using existing module tree (resuming)');
|
|
287
|
+
return parsed;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
// No snapshot, generate new
|
|
292
|
+
}
|
|
293
|
+
this.onProgress('grouping', 15, 'Grouping files into modules (LLM)...');
|
|
294
|
+
const fileList = formatFileListForGrouping(files);
|
|
295
|
+
const dirTree = formatDirectoryTree(files.map((f) => f.filePath));
|
|
296
|
+
const prompt = fillTemplate(GROUPING_USER_PROMPT, {
|
|
297
|
+
FILE_LIST: fileList,
|
|
298
|
+
DIRECTORY_TREE: dirTree,
|
|
299
|
+
});
|
|
300
|
+
const response = await this.invokeLLM(prompt, GROUPING_SYSTEM_PROMPT, this.streamOpts('Grouping files', 15, 13));
|
|
301
|
+
const grouping = this.parseGroupingResponse(response.content, files);
|
|
302
|
+
// Convert to tree nodes
|
|
303
|
+
const tree = [];
|
|
304
|
+
for (const [moduleName, modulePaths] of Object.entries(grouping)) {
|
|
305
|
+
const slug = this.slugify(moduleName);
|
|
306
|
+
const node = { name: moduleName, slug, files: modulePaths };
|
|
307
|
+
// Token budget check — split if too large
|
|
308
|
+
const totalTokens = await this.estimateModuleTokens(modulePaths);
|
|
309
|
+
if (totalTokens > this.maxTokensPerModule && modulePaths.length > 3) {
|
|
310
|
+
const children = this.splitBySubdirectory(moduleName, modulePaths);
|
|
311
|
+
// Only create hierarchy if we actually got multiple children
|
|
312
|
+
// If splitting results in 1 child, keep files flat (avoid redundant nesting)
|
|
313
|
+
if (children.length > 1) {
|
|
314
|
+
node.children = children;
|
|
315
|
+
node.files = []; // Parent doesn't own files directly when split
|
|
316
|
+
}
|
|
317
|
+
// If only 1 child, keep original flat structure (files stay in node.files)
|
|
318
|
+
}
|
|
319
|
+
tree.push(node);
|
|
320
|
+
}
|
|
321
|
+
// Save immutable snapshot for resumability
|
|
322
|
+
await fs.writeFile(snapshotPath, JSON.stringify(tree, null, 2), 'utf-8');
|
|
323
|
+
this.onProgress('grouping', 28, `Created ${tree.length} modules`);
|
|
324
|
+
return tree;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Parse LLM grouping response. Validates all files are assigned.
|
|
328
|
+
*/
|
|
329
|
+
parseGroupingResponse(content, files) {
|
|
330
|
+
// Extract JSON from response (handle markdown fences)
|
|
331
|
+
let jsonStr = content.trim();
|
|
332
|
+
const fenceMatch = jsonStr.match(/```(?:json)?\s*\n?([\s\S]*?)\n?```/);
|
|
333
|
+
if (fenceMatch) {
|
|
334
|
+
jsonStr = fenceMatch[1].trim();
|
|
335
|
+
}
|
|
336
|
+
let parsed;
|
|
337
|
+
try {
|
|
338
|
+
parsed = JSON.parse(jsonStr);
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
// Fallback: group by top-level directory
|
|
342
|
+
return this.fallbackGrouping(files);
|
|
343
|
+
}
|
|
344
|
+
if (typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
345
|
+
return this.fallbackGrouping(files);
|
|
346
|
+
}
|
|
347
|
+
// Validate — ensure all files are assigned
|
|
348
|
+
const allFilePaths = new Set(files.map((f) => f.filePath));
|
|
349
|
+
const assignedFiles = new Set();
|
|
350
|
+
const validGrouping = {};
|
|
351
|
+
for (const [mod, paths] of Object.entries(parsed)) {
|
|
352
|
+
if (!Array.isArray(paths))
|
|
353
|
+
continue;
|
|
354
|
+
const validPaths = paths.filter((p) => {
|
|
355
|
+
if (allFilePaths.has(p) && !assignedFiles.has(p)) {
|
|
356
|
+
assignedFiles.add(p);
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
return false;
|
|
360
|
+
});
|
|
361
|
+
if (validPaths.length > 0) {
|
|
362
|
+
validGrouping[mod] = validPaths;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
// Assign unassigned files to a "Miscellaneous" module
|
|
366
|
+
const unassigned = files.map((f) => f.filePath).filter((fp) => !assignedFiles.has(fp));
|
|
367
|
+
if (unassigned.length > 0) {
|
|
368
|
+
validGrouping['Other'] = unassigned;
|
|
369
|
+
}
|
|
370
|
+
return Object.keys(validGrouping).length > 0 ? validGrouping : this.fallbackGrouping(files);
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Fallback grouping by top-level directory when LLM parsing fails.
|
|
374
|
+
*/
|
|
375
|
+
fallbackGrouping(files) {
|
|
376
|
+
const groups = new Map();
|
|
377
|
+
for (const f of files) {
|
|
378
|
+
const parts = f.filePath.replace(/\\/g, '/').split('/');
|
|
379
|
+
const topDir = parts.length > 1 ? parts[0] : 'Root';
|
|
380
|
+
let group = groups.get(topDir);
|
|
381
|
+
if (!group) {
|
|
382
|
+
group = [];
|
|
383
|
+
groups.set(topDir, group);
|
|
384
|
+
}
|
|
385
|
+
group.push(f.filePath);
|
|
386
|
+
}
|
|
387
|
+
return Object.fromEntries(groups);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Split a large module into sub-modules by subdirectory.
|
|
391
|
+
* Uses the full subDir path for naming to avoid slug collisions
|
|
392
|
+
* (e.g., "synapse-screen/src" vs "synapse-core/src").
|
|
393
|
+
*/
|
|
394
|
+
splitBySubdirectory(moduleName, files) {
|
|
395
|
+
const subGroups = new Map();
|
|
396
|
+
for (const fp of files) {
|
|
397
|
+
const parts = fp.replace(/\\/g, '/').split('/');
|
|
398
|
+
const subDir = parts.length > 2 ? parts.slice(0, 2).join('/') : parts[0];
|
|
399
|
+
let group = subGroups.get(subDir);
|
|
400
|
+
if (!group) {
|
|
401
|
+
group = [];
|
|
402
|
+
subGroups.set(subDir, group);
|
|
403
|
+
}
|
|
404
|
+
group.push(fp);
|
|
405
|
+
}
|
|
406
|
+
// Check if basenames are unique; if not, use the full subDir path
|
|
407
|
+
const basenames = Array.from(subGroups.keys()).map((s) => path.basename(s));
|
|
408
|
+
const hasCollisions = new Set(basenames).size < basenames.length;
|
|
409
|
+
return Array.from(subGroups.entries()).map(([subDir, subFiles]) => {
|
|
410
|
+
const label = hasCollisions ? subDir.replace(/\//g, '-') : path.basename(subDir);
|
|
411
|
+
return {
|
|
412
|
+
name: `${moduleName} — ${label}`,
|
|
413
|
+
slug: this.slugify(`${moduleName}-${label}`),
|
|
414
|
+
files: subFiles,
|
|
415
|
+
};
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
// ─── Phase 2: Generate Module Pages ─────────────────────────────────
|
|
419
|
+
/**
|
|
420
|
+
* Generate a leaf module page from source code + graph data.
|
|
421
|
+
*/
|
|
422
|
+
async generateLeafPage(node) {
|
|
423
|
+
const filePaths = node.files;
|
|
424
|
+
// Read source files from disk
|
|
425
|
+
const sourceCode = await this.readSourceFiles(filePaths);
|
|
426
|
+
// Token budget check — if too large, summarize in batches
|
|
427
|
+
const totalTokens = estimateTokens(sourceCode);
|
|
428
|
+
let finalSourceCode = sourceCode;
|
|
429
|
+
if (totalTokens > this.maxTokensPerModule) {
|
|
430
|
+
finalSourceCode = this.truncateSource(sourceCode, this.maxTokensPerModule);
|
|
431
|
+
}
|
|
432
|
+
// Get graph data
|
|
433
|
+
const [intraCalls, interCalls, processes] = await Promise.all([
|
|
434
|
+
getIntraModuleCallEdges(filePaths),
|
|
435
|
+
getInterModuleCallEdges(filePaths),
|
|
436
|
+
getProcessesForFiles(filePaths, 5),
|
|
437
|
+
]);
|
|
438
|
+
const prompt = fillTemplate(MODULE_USER_PROMPT, {
|
|
439
|
+
MODULE_NAME: node.name,
|
|
440
|
+
SOURCE_CODE: finalSourceCode,
|
|
441
|
+
INTRA_CALLS: formatCallEdges(intraCalls),
|
|
442
|
+
OUTGOING_CALLS: formatCallEdges(interCalls.outgoing),
|
|
443
|
+
INCOMING_CALLS: formatCallEdges(interCalls.incoming),
|
|
444
|
+
PROCESSES: formatProcesses(processes),
|
|
445
|
+
});
|
|
446
|
+
const response = await this.invokeLLM(prompt, MODULE_SYSTEM_PROMPT, this.streamOpts(node.name));
|
|
447
|
+
// Write page with front matter
|
|
448
|
+
const pageContent = `# ${node.name}\n\n${response.content}`;
|
|
449
|
+
await fs.writeFile(path.join(this.wikiDir, `${node.slug}.md`), pageContent, 'utf-8');
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Generate a parent module page from children's documentation.
|
|
453
|
+
*/
|
|
454
|
+
async generateParentPage(node) {
|
|
455
|
+
if (!node.children || node.children.length === 0)
|
|
456
|
+
return;
|
|
457
|
+
// Read children's overview sections
|
|
458
|
+
const childDocs = [];
|
|
459
|
+
for (const child of node.children) {
|
|
460
|
+
const childPage = path.join(this.wikiDir, `${child.slug}.md`);
|
|
461
|
+
try {
|
|
462
|
+
const content = await fs.readFile(childPage, 'utf-8');
|
|
463
|
+
// Extract overview section (first ~500 chars or up to "### Architecture")
|
|
464
|
+
const overviewEnd = content.indexOf('### Architecture');
|
|
465
|
+
const overview = overviewEnd > 0 ? content.slice(0, overviewEnd).trim() : content.slice(0, 800).trim();
|
|
466
|
+
childDocs.push(`#### ${child.name}\n${overview}`);
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
childDocs.push(`#### ${child.name}\n(Documentation not yet generated)`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// Get cross-child call edges
|
|
473
|
+
const allChildFiles = node.children.flatMap((c) => c.files);
|
|
474
|
+
const crossCalls = await getIntraModuleCallEdges(allChildFiles);
|
|
475
|
+
const processes = await getProcessesForFiles(allChildFiles, 3);
|
|
476
|
+
const prompt = fillTemplate(PARENT_USER_PROMPT, {
|
|
477
|
+
MODULE_NAME: node.name,
|
|
478
|
+
CHILDREN_DOCS: childDocs.join('\n\n'),
|
|
479
|
+
CROSS_MODULE_CALLS: formatCallEdges(crossCalls),
|
|
480
|
+
CROSS_PROCESSES: formatProcesses(processes),
|
|
481
|
+
});
|
|
482
|
+
const response = await this.invokeLLM(prompt, PARENT_SYSTEM_PROMPT, this.streamOpts(node.name));
|
|
483
|
+
const pageContent = `# ${node.name}\n\n${response.content}`;
|
|
484
|
+
await fs.writeFile(path.join(this.wikiDir, `${node.slug}.md`), pageContent, 'utf-8');
|
|
485
|
+
}
|
|
486
|
+
// ─── Phase 3: Generate Overview ─────────────────────────────────────
|
|
487
|
+
async generateOverview(moduleTree) {
|
|
488
|
+
// Read module overview sections
|
|
489
|
+
const moduleSummaries = [];
|
|
490
|
+
for (const node of moduleTree) {
|
|
491
|
+
const pagePath = path.join(this.wikiDir, `${node.slug}.md`);
|
|
492
|
+
try {
|
|
493
|
+
const content = await fs.readFile(pagePath, 'utf-8');
|
|
494
|
+
const overviewEnd = content.indexOf('### Architecture');
|
|
495
|
+
const overview = overviewEnd > 0 ? content.slice(0, overviewEnd).trim() : content.slice(0, 600).trim();
|
|
496
|
+
moduleSummaries.push(`#### ${node.name}\n${overview}`);
|
|
497
|
+
}
|
|
498
|
+
catch {
|
|
499
|
+
moduleSummaries.push(`#### ${node.name}\n(Documentation pending)`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// Get inter-module edges for architecture diagram
|
|
503
|
+
const moduleFiles = this.extractModuleFiles(moduleTree);
|
|
504
|
+
const moduleEdges = await getInterModuleEdgesForOverview(moduleFiles);
|
|
505
|
+
// Get top processes for key workflows
|
|
506
|
+
const topProcesses = await getAllProcesses(5);
|
|
507
|
+
// Read project config
|
|
508
|
+
const projectInfo = await this.readProjectInfo();
|
|
509
|
+
const edgesText = moduleEdges.length > 0
|
|
510
|
+
? moduleEdges.map((e) => `${e.from} → ${e.to} (${e.count} calls)`).join('\n')
|
|
511
|
+
: 'No inter-module call edges detected';
|
|
512
|
+
const prompt = fillTemplate(OVERVIEW_USER_PROMPT, {
|
|
513
|
+
PROJECT_INFO: projectInfo,
|
|
514
|
+
MODULE_SUMMARIES: moduleSummaries.join('\n\n'),
|
|
515
|
+
MODULE_EDGES: edgesText,
|
|
516
|
+
TOP_PROCESSES: formatProcesses(topProcesses),
|
|
517
|
+
});
|
|
518
|
+
const response = await this.invokeLLM(prompt, OVERVIEW_SYSTEM_PROMPT, this.streamOpts('Generating overview', 88));
|
|
519
|
+
const pageContent = `# ${path.basename(this.repoPath)} — Wiki\n\n${response.content}`;
|
|
520
|
+
await fs.writeFile(path.join(this.wikiDir, 'overview.md'), pageContent, 'utf-8');
|
|
521
|
+
}
|
|
522
|
+
// ─── Incremental Updates ────────────────────────────────────────────
|
|
523
|
+
async incrementalUpdate(existingMeta, currentCommit) {
|
|
524
|
+
this.onProgress('incremental', 5, 'Detecting changes...');
|
|
525
|
+
// Get changed files since last generation
|
|
526
|
+
const changedFiles = this.getChangedFiles(existingMeta.fromCommit, currentCommit);
|
|
527
|
+
// If null, commits are on divergent branches (e.g., wiki generated on feature branch,
|
|
528
|
+
// now running on main). Fall back to full generation.
|
|
529
|
+
if (changedFiles === null) {
|
|
530
|
+
this.onProgress('incremental', 10, 'Branch diverged, running full generation...');
|
|
531
|
+
const fullResult = await this.fullGeneration(currentCommit);
|
|
532
|
+
return { ...fullResult, mode: 'incremental' };
|
|
533
|
+
}
|
|
534
|
+
if (changedFiles.length === 0) {
|
|
535
|
+
// No file changes but commit differs (e.g. merge commit)
|
|
536
|
+
await this.saveWikiMeta({
|
|
537
|
+
...existingMeta,
|
|
538
|
+
fromCommit: currentCommit,
|
|
539
|
+
generatedAt: new Date().toISOString(),
|
|
540
|
+
});
|
|
541
|
+
return { pagesGenerated: 0, mode: 'incremental', failedModules: [] };
|
|
542
|
+
}
|
|
543
|
+
this.onProgress('incremental', 10, `${changedFiles.length} files changed`);
|
|
544
|
+
// Determine affected modules
|
|
545
|
+
const affectedModules = new Set();
|
|
546
|
+
const newFiles = [];
|
|
547
|
+
for (const fp of changedFiles) {
|
|
548
|
+
let found = false;
|
|
549
|
+
for (const [mod, files] of Object.entries(existingMeta.moduleFiles)) {
|
|
550
|
+
if (files.includes(fp)) {
|
|
551
|
+
affectedModules.add(mod);
|
|
552
|
+
found = true;
|
|
553
|
+
break;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (!found && !shouldIgnorePath(fp)) {
|
|
557
|
+
newFiles.push(fp);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
// If significant new files exist, re-run full grouping
|
|
561
|
+
if (newFiles.length > 5) {
|
|
562
|
+
this.onProgress('incremental', 15, 'Significant new files detected, running full generation...');
|
|
563
|
+
// Delete old snapshot to force re-grouping
|
|
564
|
+
try {
|
|
565
|
+
await fs.unlink(path.join(this.wikiDir, 'first_module_tree.json'));
|
|
566
|
+
}
|
|
567
|
+
catch { }
|
|
568
|
+
const fullResult = await this.fullGeneration(currentCommit);
|
|
569
|
+
return { ...fullResult, mode: 'incremental' };
|
|
570
|
+
}
|
|
571
|
+
// Add new files to nearest module or "Other"
|
|
572
|
+
if (newFiles.length > 0) {
|
|
573
|
+
if (!existingMeta.moduleFiles['Other']) {
|
|
574
|
+
existingMeta.moduleFiles['Other'] = [];
|
|
575
|
+
}
|
|
576
|
+
existingMeta.moduleFiles['Other'].push(...newFiles);
|
|
577
|
+
affectedModules.add('Other');
|
|
578
|
+
}
|
|
579
|
+
// Regenerate affected module pages (parallel)
|
|
580
|
+
let pagesGenerated = 0;
|
|
581
|
+
const moduleTree = existingMeta.moduleTree;
|
|
582
|
+
const affectedArray = Array.from(affectedModules);
|
|
583
|
+
this.onProgress('incremental', 20, `Regenerating ${affectedArray.length} module(s)...`);
|
|
584
|
+
const affectedNodes = [];
|
|
585
|
+
for (const mod of affectedArray) {
|
|
586
|
+
const modSlug = this.slugify(mod);
|
|
587
|
+
const node = this.findNodeBySlug(moduleTree, modSlug);
|
|
588
|
+
if (node) {
|
|
589
|
+
try {
|
|
590
|
+
await fs.unlink(path.join(this.wikiDir, `${node.slug}.md`));
|
|
591
|
+
}
|
|
592
|
+
catch { }
|
|
593
|
+
affectedNodes.push(node);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
let incProcessed = 0;
|
|
597
|
+
pagesGenerated += await this.runParallel(affectedNodes, async (node) => {
|
|
598
|
+
try {
|
|
599
|
+
if (node.children && node.children.length > 0) {
|
|
600
|
+
await this.generateParentPage(node);
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
await this.generateLeafPage(node);
|
|
604
|
+
}
|
|
605
|
+
incProcessed++;
|
|
606
|
+
const percent = 20 + Math.round((incProcessed / affectedNodes.length) * 60);
|
|
607
|
+
this.onProgress('incremental', percent, `${incProcessed}/${affectedNodes.length} — ${node.name}`);
|
|
608
|
+
return 1;
|
|
609
|
+
}
|
|
610
|
+
catch (err) {
|
|
611
|
+
this.failedModules.push(node.name);
|
|
612
|
+
incProcessed++;
|
|
613
|
+
return 0;
|
|
614
|
+
}
|
|
615
|
+
});
|
|
616
|
+
// Regenerate overview if any pages changed
|
|
617
|
+
if (pagesGenerated > 0) {
|
|
618
|
+
this.onProgress('incremental', 85, 'Updating overview...');
|
|
619
|
+
await this.generateOverview(moduleTree);
|
|
620
|
+
pagesGenerated++;
|
|
621
|
+
}
|
|
622
|
+
// Save updated metadata
|
|
623
|
+
this.onProgress('incremental', 95, 'Saving metadata...');
|
|
624
|
+
await this.saveWikiMeta({
|
|
625
|
+
...existingMeta,
|
|
626
|
+
fromCommit: currentCommit,
|
|
627
|
+
generatedAt: new Date().toISOString(),
|
|
628
|
+
model: this.llmConfig.model,
|
|
629
|
+
});
|
|
630
|
+
this.onProgress('done', 100, 'Incremental update complete');
|
|
631
|
+
return { pagesGenerated, mode: 'incremental', failedModules: [...this.failedModules] };
|
|
632
|
+
}
|
|
633
|
+
// ─── Helpers ────────────────────────────────────────────────────────
|
|
634
|
+
getCurrentCommit() {
|
|
635
|
+
try {
|
|
636
|
+
return execSync('git rev-parse HEAD', { cwd: this.repoPath }).toString().trim();
|
|
637
|
+
}
|
|
638
|
+
catch {
|
|
639
|
+
return '';
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Check if fromCommit is an ancestor of toCommit (reachable in git history).
|
|
644
|
+
* Returns false if commits are on divergent branches or fromCommit doesn't exist.
|
|
645
|
+
*/
|
|
646
|
+
isCommitReachable(fromCommit, toCommit) {
|
|
647
|
+
try {
|
|
648
|
+
execFileSync('git', ['merge-base', '--is-ancestor', fromCommit, toCommit], {
|
|
649
|
+
cwd: this.repoPath,
|
|
650
|
+
stdio: 'ignore',
|
|
651
|
+
});
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
catch {
|
|
655
|
+
return false;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
getChangedFiles(fromCommit, toCommit) {
|
|
659
|
+
// First check if fromCommit is reachable from toCommit
|
|
660
|
+
// This handles the case where wiki was generated on a different branch
|
|
661
|
+
if (!this.isCommitReachable(fromCommit, toCommit)) {
|
|
662
|
+
return null; // Signal that we can't compute diff (divergent branches)
|
|
663
|
+
}
|
|
664
|
+
try {
|
|
665
|
+
const output = execFileSync('git', ['diff', `${fromCommit}..${toCommit}`, '--name-only'], {
|
|
666
|
+
cwd: this.repoPath,
|
|
667
|
+
})
|
|
668
|
+
.toString()
|
|
669
|
+
.trim();
|
|
670
|
+
return output ? output.split('\n').filter(Boolean) : [];
|
|
671
|
+
}
|
|
672
|
+
catch {
|
|
673
|
+
return null; // Treat git errors as needing full regen
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
async readSourceFiles(filePaths) {
|
|
677
|
+
const parts = [];
|
|
678
|
+
for (const fp of filePaths) {
|
|
679
|
+
const fullPath = path.join(this.repoPath, fp);
|
|
680
|
+
try {
|
|
681
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
682
|
+
parts.push(`\n--- ${fp} ---\n${content}`);
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
parts.push(`\n--- ${fp} ---\n(file not readable)`);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
return parts.join('\n');
|
|
689
|
+
}
|
|
690
|
+
truncateSource(source, maxTokens) {
|
|
691
|
+
// Rough truncation: keep first maxTokens*4 chars and add notice
|
|
692
|
+
const maxChars = maxTokens * 4;
|
|
693
|
+
if (source.length <= maxChars)
|
|
694
|
+
return source;
|
|
695
|
+
return source.slice(0, maxChars) + '\n\n... (source truncated for context window limits)';
|
|
696
|
+
}
|
|
697
|
+
async estimateModuleTokens(filePaths) {
|
|
698
|
+
let total = 0;
|
|
699
|
+
for (const fp of filePaths) {
|
|
700
|
+
try {
|
|
701
|
+
const content = await fs.readFile(path.join(this.repoPath, fp), 'utf-8');
|
|
702
|
+
total += estimateTokens(content);
|
|
703
|
+
}
|
|
704
|
+
catch {
|
|
705
|
+
// File not readable, skip
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return total;
|
|
709
|
+
}
|
|
710
|
+
async readProjectInfo() {
|
|
711
|
+
const candidates = [
|
|
712
|
+
'package.json',
|
|
713
|
+
'Cargo.toml',
|
|
714
|
+
'pyproject.toml',
|
|
715
|
+
'go.mod',
|
|
716
|
+
'pom.xml',
|
|
717
|
+
'build.gradle',
|
|
718
|
+
];
|
|
719
|
+
const lines = [`Project: ${path.basename(this.repoPath)}`];
|
|
720
|
+
for (const file of candidates) {
|
|
721
|
+
const fullPath = path.join(this.repoPath, file);
|
|
722
|
+
try {
|
|
723
|
+
const content = await fs.readFile(fullPath, 'utf-8');
|
|
724
|
+
if (file === 'package.json') {
|
|
725
|
+
const pkg = JSON.parse(content);
|
|
726
|
+
if (pkg.name)
|
|
727
|
+
lines.push(`Name: ${pkg.name}`);
|
|
728
|
+
if (pkg.description)
|
|
729
|
+
lines.push(`Description: ${pkg.description}`);
|
|
730
|
+
if (pkg.scripts)
|
|
731
|
+
lines.push(`Scripts: ${Object.keys(pkg.scripts).join(', ')}`);
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
// Include first 500 chars of other config files
|
|
735
|
+
lines.push(`\n${file}:\n${content.slice(0, 500)}`);
|
|
736
|
+
}
|
|
737
|
+
break; // Use first config found
|
|
738
|
+
}
|
|
739
|
+
catch {
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
// Read README excerpt
|
|
744
|
+
for (const readme of ['README.md', 'readme.md', 'README.txt']) {
|
|
745
|
+
try {
|
|
746
|
+
const content = await fs.readFile(path.join(this.repoPath, readme), 'utf-8');
|
|
747
|
+
lines.push(`\nREADME excerpt:\n${content.slice(0, 1000)}`);
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
catch {
|
|
751
|
+
continue;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return lines.join('\n');
|
|
755
|
+
}
|
|
756
|
+
extractModuleFiles(tree) {
|
|
757
|
+
const result = {};
|
|
758
|
+
for (const node of tree) {
|
|
759
|
+
if (node.children && node.children.length > 0) {
|
|
760
|
+
result[node.name] = node.children.flatMap((c) => c.files);
|
|
761
|
+
for (const child of node.children) {
|
|
762
|
+
result[child.name] = child.files;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
result[node.name] = node.files;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return result;
|
|
770
|
+
}
|
|
771
|
+
countModules(tree) {
|
|
772
|
+
let count = 0;
|
|
773
|
+
for (const node of tree) {
|
|
774
|
+
count++;
|
|
775
|
+
if (node.children) {
|
|
776
|
+
count += node.children.length;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
return count;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* Flatten the module tree into leaf nodes and parent nodes.
|
|
783
|
+
* Leaves can be processed in parallel; parents must wait for children.
|
|
784
|
+
*/
|
|
785
|
+
flattenModuleTree(tree) {
|
|
786
|
+
const leaves = [];
|
|
787
|
+
const parents = [];
|
|
788
|
+
for (const node of tree) {
|
|
789
|
+
if (node.children && node.children.length > 0) {
|
|
790
|
+
for (const child of node.children) {
|
|
791
|
+
leaves.push(child);
|
|
792
|
+
}
|
|
793
|
+
parents.push(node);
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
leaves.push(node);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return { leaves, parents };
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Run async tasks in parallel with a concurrency limit and adaptive rate limiting.
|
|
803
|
+
* If a 429 rate limit is hit, concurrency is temporarily reduced.
|
|
804
|
+
*/
|
|
805
|
+
async runParallel(items, fn) {
|
|
806
|
+
let total = 0;
|
|
807
|
+
let activeConcurrency = this.concurrency;
|
|
808
|
+
let running = 0;
|
|
809
|
+
let idx = 0;
|
|
810
|
+
return new Promise((resolve, reject) => {
|
|
811
|
+
const next = () => {
|
|
812
|
+
while (running < activeConcurrency && idx < items.length) {
|
|
813
|
+
const item = items[idx++];
|
|
814
|
+
running++;
|
|
815
|
+
fn(item)
|
|
816
|
+
.then((count) => {
|
|
817
|
+
total += count;
|
|
818
|
+
running--;
|
|
819
|
+
if (idx >= items.length && running === 0) {
|
|
820
|
+
resolve(total);
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
next();
|
|
824
|
+
}
|
|
825
|
+
})
|
|
826
|
+
.catch((err) => {
|
|
827
|
+
running--;
|
|
828
|
+
// On rate limit, reduce concurrency temporarily
|
|
829
|
+
if (err.message?.includes('429')) {
|
|
830
|
+
activeConcurrency = Math.max(1, activeConcurrency - 1);
|
|
831
|
+
this.onProgress('modules', this.lastPercent, `Rate limited — concurrency → ${activeConcurrency}`);
|
|
832
|
+
// Re-queue the item
|
|
833
|
+
idx--;
|
|
834
|
+
setTimeout(next, 5000);
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
if (idx >= items.length && running === 0) {
|
|
838
|
+
resolve(total);
|
|
839
|
+
}
|
|
840
|
+
else {
|
|
841
|
+
next();
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
if (items.length === 0) {
|
|
848
|
+
resolve(0);
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
next();
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
findNodeBySlug(tree, slug) {
|
|
856
|
+
for (const node of tree) {
|
|
857
|
+
if (node.slug === slug)
|
|
858
|
+
return node;
|
|
859
|
+
if (node.children) {
|
|
860
|
+
const found = this.findNodeBySlug(node.children, slug);
|
|
861
|
+
if (found)
|
|
862
|
+
return found;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
slugify(name) {
|
|
868
|
+
return name
|
|
869
|
+
.toLowerCase()
|
|
870
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
871
|
+
.replace(/^-+|-+$/g, '')
|
|
872
|
+
.slice(0, 60);
|
|
873
|
+
}
|
|
874
|
+
async fileExists(fp) {
|
|
875
|
+
try {
|
|
876
|
+
await fs.access(fp);
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
catch {
|
|
880
|
+
return false;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
async loadWikiMeta() {
|
|
884
|
+
try {
|
|
885
|
+
const raw = await fs.readFile(path.join(this.wikiDir, 'meta.json'), 'utf-8');
|
|
886
|
+
return JSON.parse(raw);
|
|
887
|
+
}
|
|
888
|
+
catch {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
async saveWikiMeta(meta) {
|
|
893
|
+
await fs.writeFile(path.join(this.wikiDir, 'meta.json'), JSON.stringify(meta, null, 2), 'utf-8');
|
|
894
|
+
}
|
|
895
|
+
async saveModuleTree(tree) {
|
|
896
|
+
await fs.writeFile(path.join(this.wikiDir, 'module_tree.json'), JSON.stringify(tree, null, 2), 'utf-8');
|
|
897
|
+
}
|
|
898
|
+
}
|