@opencodehub/ingestion 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +69 -0
- package/dist/extract/index.d.ts +8 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +6 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/extract/orm-detector.d.ts +19 -0
- package/dist/extract/orm-detector.d.ts.map +1 -0
- package/dist/extract/orm-detector.js +209 -0
- package/dist/extract/orm-detector.js.map +1 -0
- package/dist/extract/property-access.d.ts +76 -0
- package/dist/extract/property-access.d.ts.map +1 -0
- package/dist/extract/property-access.js +260 -0
- package/dist/extract/property-access.js.map +1 -0
- package/dist/extract/receiver-resolver.d.ts +86 -0
- package/dist/extract/receiver-resolver.d.ts.map +1 -0
- package/dist/extract/receiver-resolver.js +77 -0
- package/dist/extract/receiver-resolver.js.map +1 -0
- package/dist/extract/route-detector-java.d.ts +29 -0
- package/dist/extract/route-detector-java.d.ts.map +1 -0
- package/dist/extract/route-detector-java.js +190 -0
- package/dist/extract/route-detector-java.js.map +1 -0
- package/dist/extract/route-detector-nestjs.d.ts +30 -0
- package/dist/extract/route-detector-nestjs.d.ts.map +1 -0
- package/dist/extract/route-detector-nestjs.js +134 -0
- package/dist/extract/route-detector-nestjs.js.map +1 -0
- package/dist/extract/route-detector-python.d.ts +28 -0
- package/dist/extract/route-detector-python.d.ts.map +1 -0
- package/dist/extract/route-detector-python.js +100 -0
- package/dist/extract/route-detector-python.js.map +1 -0
- package/dist/extract/route-detector-rails.d.ts +28 -0
- package/dist/extract/route-detector-rails.d.ts.map +1 -0
- package/dist/extract/route-detector-rails.js +162 -0
- package/dist/extract/route-detector-rails.js.map +1 -0
- package/dist/extract/route-detector.d.ts +45 -0
- package/dist/extract/route-detector.d.ts.map +1 -0
- package/dist/extract/route-detector.js +467 -0
- package/dist/extract/route-detector.js.map +1 -0
- package/dist/extract/tool-detector.d.ts +26 -0
- package/dist/extract/tool-detector.d.ts.map +1 -0
- package/dist/extract/tool-detector.js +364 -0
- package/dist/extract/tool-detector.js.map +1 -0
- package/dist/extract/types.d.ts +89 -0
- package/dist/extract/types.d.ts.map +1 -0
- package/dist/extract/types.js +11 -0
- package/dist/extract/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/parse/cobol-regex.d.ts +85 -0
- package/dist/parse/cobol-regex.d.ts.map +1 -0
- package/dist/parse/cobol-regex.js +355 -0
- package/dist/parse/cobol-regex.js.map +1 -0
- package/dist/parse/grammar-registry.d.ts +115 -0
- package/dist/parse/grammar-registry.d.ts.map +1 -0
- package/dist/parse/grammar-registry.js +278 -0
- package/dist/parse/grammar-registry.js.map +1 -0
- package/dist/parse/index.d.ts +14 -0
- package/dist/parse/index.d.ts.map +1 -0
- package/dist/parse/index.js +10 -0
- package/dist/parse/index.js.map +1 -0
- package/dist/parse/language-detector.d.ts +17 -0
- package/dist/parse/language-detector.d.ts.map +1 -0
- package/dist/parse/language-detector.js +104 -0
- package/dist/parse/language-detector.js.map +1 -0
- package/dist/parse/parse-worker.d.ts +24 -0
- package/dist/parse/parse-worker.d.ts.map +1 -0
- package/dist/parse/parse-worker.js +230 -0
- package/dist/parse/parse-worker.js.map +1 -0
- package/dist/parse/types.d.ts +49 -0
- package/dist/parse/types.d.ts.map +1 -0
- package/dist/parse/types.js +11 -0
- package/dist/parse/types.js.map +1 -0
- package/dist/parse/unified-queries.d.ts +37 -0
- package/dist/parse/unified-queries.d.ts.map +1 -0
- package/dist/parse/unified-queries.js +623 -0
- package/dist/parse/unified-queries.js.map +1 -0
- package/dist/parse/wasm-fallback.d.ts +88 -0
- package/dist/parse/wasm-fallback.d.ts.map +1 -0
- package/dist/parse/wasm-fallback.js +258 -0
- package/dist/parse/wasm-fallback.js.map +1 -0
- package/dist/parse/worker-pool.d.ts +48 -0
- package/dist/parse/worker-pool.d.ts.map +1 -0
- package/dist/parse/worker-pool.js +97 -0
- package/dist/parse/worker-pool.js.map +1 -0
- package/dist/pipeline/dep-parsers/go.d.ts +25 -0
- package/dist/pipeline/dep-parsers/go.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/go.js +146 -0
- package/dist/pipeline/dep-parsers/go.js.map +1 -0
- package/dist/pipeline/dep-parsers/index.d.ts +17 -0
- package/dist/pipeline/dep-parsers/index.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/index.js +16 -0
- package/dist/pipeline/dep-parsers/index.js.map +1 -0
- package/dist/pipeline/dep-parsers/maven.d.ts +24 -0
- package/dist/pipeline/dep-parsers/maven.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/maven.js +131 -0
- package/dist/pipeline/dep-parsers/maven.js.map +1 -0
- package/dist/pipeline/dep-parsers/npm.d.ts +30 -0
- package/dist/pipeline/dep-parsers/npm.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/npm.js +309 -0
- package/dist/pipeline/dep-parsers/npm.js.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts +24 -0
- package/dist/pipeline/dep-parsers/nuget.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/nuget.js +178 -0
- package/dist/pipeline/dep-parsers/nuget.js.map +1 -0
- package/dist/pipeline/dep-parsers/python.d.ts +21 -0
- package/dist/pipeline/dep-parsers/python.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/python.js +369 -0
- package/dist/pipeline/dep-parsers/python.js.map +1 -0
- package/dist/pipeline/dep-parsers/rust.d.ts +18 -0
- package/dist/pipeline/dep-parsers/rust.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/rust.js +134 -0
- package/dist/pipeline/dep-parsers/rust.js.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts +15 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js +31 -0
- package/dist/pipeline/dep-parsers/spdx-normalize.js.map +1 -0
- package/dist/pipeline/dep-parsers/types.d.ts +63 -0
- package/dist/pipeline/dep-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/dep-parsers/types.js +56 -0
- package/dist/pipeline/dep-parsers/types.js.map +1 -0
- package/dist/pipeline/gitignore-stack.d.ts +44 -0
- package/dist/pipeline/gitignore-stack.d.ts.map +1 -0
- package/dist/pipeline/gitignore-stack.js +69 -0
- package/dist/pipeline/gitignore-stack.js.map +1 -0
- package/dist/pipeline/gitignore.d.ts +67 -0
- package/dist/pipeline/gitignore.d.ts.map +1 -0
- package/dist/pipeline/gitignore.js +210 -0
- package/dist/pipeline/gitignore.js.map +1 -0
- package/dist/pipeline/index.d.ts +53 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +29 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +105 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +175 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts +41 -0
- package/dist/pipeline/ownership-helpers/drift.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/drift.js +122 -0
- package/dist/pipeline/ownership-helpers/drift.js.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts +24 -0
- package/dist/pipeline/ownership-helpers/gini-community.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/gini-community.js +32 -0
- package/dist/pipeline/ownership-helpers/gini-community.js.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts +71 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js +178 -0
- package/dist/pipeline/ownership-helpers/git-blame-batcher.js.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts +35 -0
- package/dist/pipeline/ownership-helpers/line-overlap.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js +62 -0
- package/dist/pipeline/ownership-helpers/line-overlap.js.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts +73 -0
- package/dist/pipeline/ownership-helpers/orphan.d.ts.map +1 -0
- package/dist/pipeline/ownership-helpers/orphan.js +117 -0
- package/dist/pipeline/ownership-helpers/orphan.js.map +1 -0
- package/dist/pipeline/phases/accesses.d.ts +44 -0
- package/dist/pipeline/phases/accesses.d.ts.map +1 -0
- package/dist/pipeline/phases/accesses.js +194 -0
- package/dist/pipeline/phases/accesses.js.map +1 -0
- package/dist/pipeline/phases/annotate.d.ts +28 -0
- package/dist/pipeline/phases/annotate.d.ts.map +1 -0
- package/dist/pipeline/phases/annotate.js +60 -0
- package/dist/pipeline/phases/annotate.js.map +1 -0
- package/dist/pipeline/phases/cochange.d.ts +42 -0
- package/dist/pipeline/phases/cochange.d.ts.map +1 -0
- package/dist/pipeline/phases/cochange.js +0 -0
- package/dist/pipeline/phases/cochange.js.map +1 -0
- package/dist/pipeline/phases/communities.d.ts +34 -0
- package/dist/pipeline/phases/communities.d.ts.map +1 -0
- package/dist/pipeline/phases/communities.js +412 -0
- package/dist/pipeline/phases/communities.js.map +1 -0
- package/dist/pipeline/phases/complexity.d.ts +50 -0
- package/dist/pipeline/phases/complexity.d.ts.map +1 -0
- package/dist/pipeline/phases/complexity.js +794 -0
- package/dist/pipeline/phases/complexity.js.map +1 -0
- package/dist/pipeline/phases/confidence-demote.d.ts +23 -0
- package/dist/pipeline/phases/confidence-demote.d.ts.map +1 -0
- package/dist/pipeline/phases/confidence-demote.js +113 -0
- package/dist/pipeline/phases/confidence-demote.js.map +1 -0
- package/dist/pipeline/phases/content-cache.d.ts +166 -0
- package/dist/pipeline/phases/content-cache.d.ts.map +1 -0
- package/dist/pipeline/phases/content-cache.js +323 -0
- package/dist/pipeline/phases/content-cache.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js +139 -0
- package/dist/pipeline/phases/coverage-parsers/cobertura.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts +25 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js +51 -0
- package/dist/pipeline/phases/coverage-parsers/coverage-py.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts +32 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js +98 -0
- package/dist/pipeline/phases/coverage-parsers/jacoco.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts +21 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js +104 -0
- package/dist/pipeline/phases/coverage-parsers/lcov.js.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts +27 -0
- package/dist/pipeline/phases/coverage-parsers/types.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage-parsers/types.js +39 -0
- package/dist/pipeline/phases/coverage-parsers/types.js.map +1 -0
- package/dist/pipeline/phases/coverage.d.ts +39 -0
- package/dist/pipeline/phases/coverage.d.ts.map +1 -0
- package/dist/pipeline/phases/coverage.js +154 -0
- package/dist/pipeline/phases/coverage.js.map +1 -0
- package/dist/pipeline/phases/cross-file.d.ts +40 -0
- package/dist/pipeline/phases/cross-file.d.ts.map +1 -0
- package/dist/pipeline/phases/cross-file.js +411 -0
- package/dist/pipeline/phases/cross-file.js.map +1 -0
- package/dist/pipeline/phases/dead-code.d.ts +28 -0
- package/dist/pipeline/phases/dead-code.d.ts.map +1 -0
- package/dist/pipeline/phases/dead-code.js +157 -0
- package/dist/pipeline/phases/dead-code.js.map +1 -0
- package/dist/pipeline/phases/default-set.d.ts +24 -0
- package/dist/pipeline/phases/default-set.d.ts.map +1 -0
- package/dist/pipeline/phases/default-set.js +133 -0
- package/dist/pipeline/phases/default-set.js.map +1 -0
- package/dist/pipeline/phases/dependencies.d.ts +59 -0
- package/dist/pipeline/phases/dependencies.d.ts.map +1 -0
- package/dist/pipeline/phases/dependencies.js +281 -0
- package/dist/pipeline/phases/dependencies.js.map +1 -0
- package/dist/pipeline/phases/embedder-pool.d.ts +31 -0
- package/dist/pipeline/phases/embedder-pool.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-pool.js +79 -0
- package/dist/pipeline/phases/embedder-pool.js.map +1 -0
- package/dist/pipeline/phases/embedder-worker.d.ts +28 -0
- package/dist/pipeline/phases/embedder-worker.d.ts.map +1 -0
- package/dist/pipeline/phases/embedder-worker.js +43 -0
- package/dist/pipeline/phases/embedder-worker.js.map +1 -0
- package/dist/pipeline/phases/embeddings.d.ts +117 -0
- package/dist/pipeline/phases/embeddings.d.ts.map +1 -0
- package/dist/pipeline/phases/embeddings.js +697 -0
- package/dist/pipeline/phases/embeddings.js.map +1 -0
- package/dist/pipeline/phases/fetches.d.ts +47 -0
- package/dist/pipeline/phases/fetches.d.ts.map +1 -0
- package/dist/pipeline/phases/fetches.js +207 -0
- package/dist/pipeline/phases/fetches.js.map +1 -0
- package/dist/pipeline/phases/incremental-helper.d.ts +96 -0
- package/dist/pipeline/phases/incremental-helper.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-helper.js +125 -0
- package/dist/pipeline/phases/incremental-helper.js.map +1 -0
- package/dist/pipeline/phases/incremental-scope.d.ts +67 -0
- package/dist/pipeline/phases/incremental-scope.d.ts.map +1 -0
- package/dist/pipeline/phases/incremental-scope.js +225 -0
- package/dist/pipeline/phases/incremental-scope.js.map +1 -0
- package/dist/pipeline/phases/markdown.d.ts +29 -0
- package/dist/pipeline/phases/markdown.d.ts.map +1 -0
- package/dist/pipeline/phases/markdown.js +298 -0
- package/dist/pipeline/phases/markdown.js.map +1 -0
- package/dist/pipeline/phases/mro.d.ts +24 -0
- package/dist/pipeline/phases/mro.d.ts.map +1 -0
- package/dist/pipeline/phases/mro.js +303 -0
- package/dist/pipeline/phases/mro.js.map +1 -0
- package/dist/pipeline/phases/openapi.d.ts +52 -0
- package/dist/pipeline/phases/openapi.d.ts.map +1 -0
- package/dist/pipeline/phases/openapi.js +285 -0
- package/dist/pipeline/phases/openapi.js.map +1 -0
- package/dist/pipeline/phases/orm.d.ts +26 -0
- package/dist/pipeline/phases/orm.d.ts.map +1 -0
- package/dist/pipeline/phases/orm.js +183 -0
- package/dist/pipeline/phases/orm.js.map +1 -0
- package/dist/pipeline/phases/ownership.d.ts +88 -0
- package/dist/pipeline/phases/ownership.d.ts.map +1 -0
- package/dist/pipeline/phases/ownership.js +479 -0
- package/dist/pipeline/phases/ownership.js.map +1 -0
- package/dist/pipeline/phases/parse.d.ts +63 -0
- package/dist/pipeline/phases/parse.d.ts.map +1 -0
- package/dist/pipeline/phases/parse.js +994 -0
- package/dist/pipeline/phases/parse.js.map +1 -0
- package/dist/pipeline/phases/processes.d.ts +47 -0
- package/dist/pipeline/phases/processes.d.ts.map +1 -0
- package/dist/pipeline/phases/processes.js +620 -0
- package/dist/pipeline/phases/processes.js.map +1 -0
- package/dist/pipeline/phases/profile.d.ts +33 -0
- package/dist/pipeline/phases/profile.d.ts.map +1 -0
- package/dist/pipeline/phases/profile.js +91 -0
- package/dist/pipeline/phases/profile.js.map +1 -0
- package/dist/pipeline/phases/repo-node.d.ts +112 -0
- package/dist/pipeline/phases/repo-node.d.ts.map +1 -0
- package/dist/pipeline/phases/repo-node.js +272 -0
- package/dist/pipeline/phases/repo-node.js.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts +34 -0
- package/dist/pipeline/phases/risk-snapshot.d.ts.map +1 -0
- package/dist/pipeline/phases/risk-snapshot.js +63 -0
- package/dist/pipeline/phases/risk-snapshot.js.map +1 -0
- package/dist/pipeline/phases/routes.d.ts +31 -0
- package/dist/pipeline/phases/routes.d.ts.map +1 -0
- package/dist/pipeline/phases/routes.js +262 -0
- package/dist/pipeline/phases/routes.js.map +1 -0
- package/dist/pipeline/phases/sbom.d.ts +45 -0
- package/dist/pipeline/phases/sbom.d.ts.map +1 -0
- package/dist/pipeline/phases/sbom.js +289 -0
- package/dist/pipeline/phases/sbom.js.map +1 -0
- package/dist/pipeline/phases/scan.d.ts +54 -0
- package/dist/pipeline/phases/scan.d.ts.map +1 -0
- package/dist/pipeline/phases/scan.js +340 -0
- package/dist/pipeline/phases/scan.js.map +1 -0
- package/dist/pipeline/phases/scip-index.d.ts +54 -0
- package/dist/pipeline/phases/scip-index.d.ts.map +1 -0
- package/dist/pipeline/phases/scip-index.js +469 -0
- package/dist/pipeline/phases/scip-index.js.map +1 -0
- package/dist/pipeline/phases/structure.d.ts +21 -0
- package/dist/pipeline/phases/structure.d.ts.map +1 -0
- package/dist/pipeline/phases/structure.js +115 -0
- package/dist/pipeline/phases/structure.js.map +1 -0
- package/dist/pipeline/phases/summarize.d.ts +126 -0
- package/dist/pipeline/phases/summarize.d.ts.map +1 -0
- package/dist/pipeline/phases/summarize.js +401 -0
- package/dist/pipeline/phases/summarize.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts +42 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js +96 -0
- package/dist/pipeline/phases/temporal-helpers/branch-divergence.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts +22 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js +32 -0
- package/dist/pipeline/phases/temporal-helpers/churn-decay.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts +21 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js +37 -0
- package/dist/pipeline/phases/temporal-helpers/conventional-commits.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts +32 -0
- package/dist/pipeline/phases/temporal-helpers/gini.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js +78 -0
- package/dist/pipeline/phases/temporal-helpers/gini.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts +14 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js +25 -0
- package/dist/pipeline/phases/temporal-helpers/revert-detect.js.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts +18 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js +119 -0
- package/dist/pipeline/phases/temporal-helpers/test-pair.js.map +1 -0
- package/dist/pipeline/phases/temporal.d.ts +65 -0
- package/dist/pipeline/phases/temporal.d.ts.map +1 -0
- package/dist/pipeline/phases/temporal.js +621 -0
- package/dist/pipeline/phases/temporal.js.map +1 -0
- package/dist/pipeline/phases/tools.d.ts +21 -0
- package/dist/pipeline/phases/tools.d.ts.map +1 -0
- package/dist/pipeline/phases/tools.js +118 -0
- package/dist/pipeline/phases/tools.js.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts +18 -0
- package/dist/pipeline/profile-detectors/api-contracts.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/api-contracts.js +78 -0
- package/dist/pipeline/profile-detectors/api-contracts.js.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/framework-detector.js +11 -0
- package/dist/pipeline/profile-detectors/framework-detector.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks-catalog.js.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts +7 -0
- package/dist/pipeline/profile-detectors/frameworks.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/frameworks.js +7 -0
- package/dist/pipeline/profile-detectors/frameworks.js.map +1 -0
- package/dist/pipeline/profile-detectors/iac.d.ts +22 -0
- package/dist/pipeline/profile-detectors/iac.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/iac.js +97 -0
- package/dist/pipeline/profile-detectors/iac.js.map +1 -0
- package/dist/pipeline/profile-detectors/languages.d.ts +18 -0
- package/dist/pipeline/profile-detectors/languages.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/languages.js +60 -0
- package/dist/pipeline/profile-detectors/languages.js.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts +7 -0
- package/dist/pipeline/profile-detectors/manifests.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/manifests.js +7 -0
- package/dist/pipeline/profile-detectors/manifests.js.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts +17 -0
- package/dist/pipeline/profile-detectors/src-dirs.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/src-dirs.js +89 -0
- package/dist/pipeline/profile-detectors/src-dirs.js.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.d.ts.map +1 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js +7 -0
- package/dist/pipeline/profile-detectors/variant-detectors.js.map +1 -0
- package/dist/pipeline/runner.d.ts +54 -0
- package/dist/pipeline/runner.d.ts.map +1 -0
- package/dist/pipeline/runner.js +247 -0
- package/dist/pipeline/runner.js.map +1 -0
- package/dist/pipeline/types.d.ts +235 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +15 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/providers/c.d.ts +3 -0
- package/dist/providers/c.d.ts.map +1 -0
- package/dist/providers/c.js +162 -0
- package/dist/providers/c.js.map +1 -0
- package/dist/providers/cobol.d.ts +19 -0
- package/dist/providers/cobol.d.ts.map +1 -0
- package/dist/providers/cobol.js +44 -0
- package/dist/providers/cobol.js.map +1 -0
- package/dist/providers/cpp.d.ts +3 -0
- package/dist/providers/cpp.d.ts.map +1 -0
- package/dist/providers/cpp.js +200 -0
- package/dist/providers/cpp.js.map +1 -0
- package/dist/providers/csharp.d.ts +3 -0
- package/dist/providers/csharp.d.ts.map +1 -0
- package/dist/providers/csharp.js +292 -0
- package/dist/providers/csharp.js.map +1 -0
- package/dist/providers/dart.d.ts +3 -0
- package/dist/providers/dart.d.ts.map +1 -0
- package/dist/providers/dart.js +214 -0
- package/dist/providers/dart.js.map +1 -0
- package/dist/providers/definition-ids.d.ts +18 -0
- package/dist/providers/definition-ids.d.ts.map +1 -0
- package/dist/providers/definition-ids.js +23 -0
- package/dist/providers/definition-ids.js.map +1 -0
- package/dist/providers/extract-helpers.d.ts +60 -0
- package/dist/providers/extract-helpers.d.ts.map +1 -0
- package/dist/providers/extract-helpers.js +296 -0
- package/dist/providers/extract-helpers.js.map +1 -0
- package/dist/providers/extraction-types.d.ts +85 -0
- package/dist/providers/extraction-types.d.ts.map +1 -0
- package/dist/providers/extraction-types.js +13 -0
- package/dist/providers/extraction-types.js.map +1 -0
- package/dist/providers/go.d.ts +3 -0
- package/dist/providers/go.d.ts.map +1 -0
- package/dist/providers/go.js +359 -0
- package/dist/providers/go.js.map +1 -0
- package/dist/providers/http-detect.d.ts +44 -0
- package/dist/providers/http-detect.d.ts.map +1 -0
- package/dist/providers/http-detect.js +307 -0
- package/dist/providers/http-detect.js.map +1 -0
- package/dist/providers/index.d.ts +38 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +33 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/java.d.ts +3 -0
- package/dist/providers/java.d.ts.map +1 -0
- package/dist/providers/java.js +259 -0
- package/dist/providers/java.js.map +1 -0
- package/dist/providers/javascript.d.ts +3 -0
- package/dist/providers/javascript.d.ts.map +1 -0
- package/dist/providers/javascript.js +139 -0
- package/dist/providers/javascript.js.map +1 -0
- package/dist/providers/kotlin.d.ts +3 -0
- package/dist/providers/kotlin.d.ts.map +1 -0
- package/dist/providers/kotlin.js +175 -0
- package/dist/providers/kotlin.js.map +1 -0
- package/dist/providers/php.d.ts +3 -0
- package/dist/providers/php.d.ts.map +1 -0
- package/dist/providers/php.js +218 -0
- package/dist/providers/php.js.map +1 -0
- package/dist/providers/python-accesses.d.ts +9 -0
- package/dist/providers/python-accesses.d.ts.map +1 -0
- package/dist/providers/python-accesses.js +22 -0
- package/dist/providers/python-accesses.js.map +1 -0
- package/dist/providers/python.d.ts +3 -0
- package/dist/providers/python.d.ts.map +1 -0
- package/dist/providers/python.js +323 -0
- package/dist/providers/python.js.map +1 -0
- package/dist/providers/registry.d.ts +4 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +46 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resolution/c3.d.ts +6 -0
- package/dist/providers/resolution/c3.d.ts.map +1 -0
- package/dist/providers/resolution/c3.js +76 -0
- package/dist/providers/resolution/c3.js.map +1 -0
- package/dist/providers/resolution/context.d.ts +38 -0
- package/dist/providers/resolution/context.d.ts.map +1 -0
- package/dist/providers/resolution/context.js +45 -0
- package/dist/providers/resolution/context.js.map +1 -0
- package/dist/providers/resolution/first-wins.d.ts +3 -0
- package/dist/providers/resolution/first-wins.d.ts.map +1 -0
- package/dist/providers/resolution/first-wins.js +27 -0
- package/dist/providers/resolution/first-wins.js.map +1 -0
- package/dist/providers/resolution/mro.d.ts +16 -0
- package/dist/providers/resolution/mro.d.ts.map +1 -0
- package/dist/providers/resolution/mro.js +14 -0
- package/dist/providers/resolution/mro.js.map +1 -0
- package/dist/providers/resolution/none.d.ts +3 -0
- package/dist/providers/resolution/none.d.ts.map +1 -0
- package/dist/providers/resolution/none.js +11 -0
- package/dist/providers/resolution/none.js.map +1 -0
- package/dist/providers/resolution/python-all-filter.d.ts +25 -0
- package/dist/providers/resolution/python-all-filter.d.ts.map +1 -0
- package/dist/providers/resolution/python-all-filter.js +64 -0
- package/dist/providers/resolution/python-all-filter.js.map +1 -0
- package/dist/providers/resolution/resolver-strategy.d.ts +42 -0
- package/dist/providers/resolution/resolver-strategy.d.ts.map +1 -0
- package/dist/providers/resolution/resolver-strategy.js +50 -0
- package/dist/providers/resolution/resolver-strategy.js.map +1 -0
- package/dist/providers/resolution/single-inheritance.d.ts +3 -0
- package/dist/providers/resolution/single-inheritance.d.ts.map +1 -0
- package/dist/providers/resolution/single-inheritance.js +21 -0
- package/dist/providers/resolution/single-inheritance.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts +16 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js +50 -0
- package/dist/providers/resolution/stack-graphs/__fixtures__/mock-tree.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts +15 -0
- package/dist/providers/resolution/stack-graphs/glue.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/glue.js +44 -0
- package/dist/providers/resolution/stack-graphs/glue.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts +30 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js +366 -0
- package/dist/providers/resolution/stack-graphs/node-edge-builder.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts +9 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js +152 -0
- package/dist/providers/resolution/stack-graphs/partial-path-engine.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts +11 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js +247 -0
- package/dist/providers/resolution/stack-graphs/rule-parser.js.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts +93 -0
- package/dist/providers/resolution/stack-graphs/types.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs/types.js +11 -0
- package/dist/providers/resolution/stack-graphs/types.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts +27 -0
- package/dist/providers/resolution/stack-graphs-python.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-python.js +104 -0
- package/dist/providers/resolution/stack-graphs-python.js.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts +134 -0
- package/dist/providers/resolution/stack-graphs-ts.d.ts.map +1 -0
- package/dist/providers/resolution/stack-graphs-ts.js +372 -0
- package/dist/providers/resolution/stack-graphs-ts.js.map +1 -0
- package/dist/providers/ruby.d.ts +3 -0
- package/dist/providers/ruby.d.ts.map +1 -0
- package/dist/providers/ruby.js +259 -0
- package/dist/providers/ruby.js.map +1 -0
- package/dist/providers/rust.d.ts +3 -0
- package/dist/providers/rust.d.ts.map +1 -0
- package/dist/providers/rust.js +318 -0
- package/dist/providers/rust.js.map +1 -0
- package/dist/providers/swift.d.ts +3 -0
- package/dist/providers/swift.d.ts.map +1 -0
- package/dist/providers/swift.js +177 -0
- package/dist/providers/swift.js.map +1 -0
- package/dist/providers/test-helpers.d.ts +24 -0
- package/dist/providers/test-helpers.d.ts.map +1 -0
- package/dist/providers/test-helpers.js +33 -0
- package/dist/providers/test-helpers.js.map +1 -0
- package/dist/providers/ts-shared.d.ts +30 -0
- package/dist/providers/ts-shared.d.ts.map +1 -0
- package/dist/providers/ts-shared.js +328 -0
- package/dist/providers/ts-shared.js.map +1 -0
- package/dist/providers/tsx.d.ts +7 -0
- package/dist/providers/tsx.d.ts.map +1 -0
- package/dist/providers/tsx.js +79 -0
- package/dist/providers/tsx.js.map +1 -0
- package/dist/providers/types.d.ts +166 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +7 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/typescript-family-accesses.d.ts +14 -0
- package/dist/providers/typescript-family-accesses.d.ts.map +1 -0
- package/dist/providers/typescript-family-accesses.js +27 -0
- package/dist/providers/typescript-family-accesses.js.map +1 -0
- package/dist/providers/typescript.d.ts +9 -0
- package/dist/providers/typescript.d.ts.map +1 -0
- package/dist/providers/typescript.js +84 -0
- package/dist/providers/typescript.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile phase — single-pass repo profiling.
|
|
3
|
+
*
|
|
4
|
+
* Consumes the scan phase output and emits one `ProjectProfile` node per
|
|
5
|
+
* repo with six sorted arrays:
|
|
6
|
+
* - languages — file-count-threshold filtered, sorted by count desc
|
|
7
|
+
* - frameworks — evidence-based (file markers OR manifest deps)
|
|
8
|
+
* - iacTypes — terraform / docker / kubernetes / cloudformation / …
|
|
9
|
+
* - apiContracts — openapi / graphql / grpc / asyncapi
|
|
10
|
+
* - manifests — linguist-style priority cascade per ecosystem
|
|
11
|
+
* - srcDirs — top-level source directories (>10 code files)
|
|
12
|
+
*
|
|
13
|
+
* The phase runs after `scan`, has no outbound deps, and is a pure leaf:
|
|
14
|
+
* downstream phases (scanners gated on ProjectProfile) will read the
|
|
15
|
+
* profile node from the graph, not from the phase output.
|
|
16
|
+
*
|
|
17
|
+
* Determinism: every detector returns a sorted array; the profile node is a
|
|
18
|
+
* singleton per repo, so its id uses a constant qualified name ("repo")
|
|
19
|
+
* rather than a hash of the absolute path. This keeps the node id stable
|
|
20
|
+
* across checkouts of the same repo on different paths / machines, which is
|
|
21
|
+
* required for the graphHash determinism gate (two clones of the same
|
|
22
|
+
* commit must produce byte-identical graphs). Two runs of the same repo at
|
|
23
|
+
* the same commit produce byte-identical profile nodes.
|
|
24
|
+
*/
|
|
25
|
+
import { makeNodeId } from "@opencodehub/core-types";
|
|
26
|
+
import { detectFrameworksDetailed, detectManifests } from "@opencodehub/frameworks";
|
|
27
|
+
import { detectApiContracts } from "../profile-detectors/api-contracts.js";
|
|
28
|
+
import { detectIaCTypes } from "../profile-detectors/iac.js";
|
|
29
|
+
import { detectLanguages } from "../profile-detectors/languages.js";
|
|
30
|
+
import { detectSrcDirs } from "../profile-detectors/src-dirs.js";
|
|
31
|
+
import { SCAN_PHASE_NAME } from "./scan.js";
|
|
32
|
+
export const PROFILE_PHASE_NAME = "profile";
|
|
33
|
+
export const profilePhase = {
|
|
34
|
+
name: PROFILE_PHASE_NAME,
|
|
35
|
+
deps: [SCAN_PHASE_NAME],
|
|
36
|
+
async run(ctx, deps) {
|
|
37
|
+
const scan = deps.get(SCAN_PHASE_NAME);
|
|
38
|
+
if (scan === undefined) {
|
|
39
|
+
throw new Error("profile: scan output missing from dependency map");
|
|
40
|
+
}
|
|
41
|
+
return runProfile(ctx, scan);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
async function runProfile(ctx, scan) {
|
|
45
|
+
const files = scan.files;
|
|
46
|
+
// Manifests must be computed first: framework detection consults them to
|
|
47
|
+
// know which manifest files exist before probing for declared deps.
|
|
48
|
+
const manifests = detectManifests(files);
|
|
49
|
+
const languages = detectLanguages(files);
|
|
50
|
+
const [iacTypes, apiContracts, frameworksDetected] = await Promise.all([
|
|
51
|
+
detectIaCTypes(ctx.repoPath, files),
|
|
52
|
+
detectApiContracts(ctx.repoPath, files),
|
|
53
|
+
detectFrameworksDetailed({
|
|
54
|
+
repoRoot: ctx.repoPath,
|
|
55
|
+
files,
|
|
56
|
+
manifests,
|
|
57
|
+
detectedLanguages: languages,
|
|
58
|
+
}),
|
|
59
|
+
]);
|
|
60
|
+
const srcDirs = detectSrcDirs(files);
|
|
61
|
+
// Backward-compatible flat list — the `name` of each detection in sorted
|
|
62
|
+
// order. The structured list is the source of truth; the flat list is a
|
|
63
|
+
// projection kept for v1.0 consumers.
|
|
64
|
+
const frameworks = frameworksDetected.map((d) => d.name);
|
|
65
|
+
// Singleton per repo: use a constant qualified name so the id is stable
|
|
66
|
+
// across clones of the same repo on different absolute paths. The graph
|
|
67
|
+
// is already scoped to one repo, so uniqueness within the graph is
|
|
68
|
+
// preserved without encoding the path. See the module JSDoc for the
|
|
69
|
+
// determinism rationale.
|
|
70
|
+
const id = makeNodeId("ProjectProfile", "", "repo");
|
|
71
|
+
const node = {
|
|
72
|
+
id,
|
|
73
|
+
kind: "ProjectProfile",
|
|
74
|
+
name: "project-profile",
|
|
75
|
+
filePath: "",
|
|
76
|
+
languages,
|
|
77
|
+
frameworks,
|
|
78
|
+
frameworksDetected,
|
|
79
|
+
iacTypes,
|
|
80
|
+
apiContracts,
|
|
81
|
+
manifests,
|
|
82
|
+
srcDirs,
|
|
83
|
+
};
|
|
84
|
+
ctx.graph.addNode(node);
|
|
85
|
+
return {
|
|
86
|
+
profileEmitted: true,
|
|
87
|
+
languagesDetected: languages.length,
|
|
88
|
+
frameworksDetected: frameworks.length,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../src/pipeline/phases/profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eA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IACzE,wEAAwE;IACxE,sCAAsC;IACtC,MAAM,UAAU,GAAsB,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE5E,wEAAwE;IACxE,wEAAwE;IACxE,mEAAmE;IACnE,oEAAoE;IACpE,yBAAyB;IACzB,MAAM,EAAE,GAAG,UAAU,CAAC,gBAAgB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAEpD,MAAM,IAAI,GAAuB;QAC/B,EAAE;QACF,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,EAAE;QACZ,SAAS;QACT,UAAU;QACV,kBAAkB;QAClB,QAAQ;QACR,YAAY;QACZ,SAAS;QACT,OAAO;KACR,CAAC;IACF,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAExB,OAAO;QACL,cAAc,EAAE,IAAI;QACpB,iBAAiB,EAAE,SAAS,CAAC,MAAM;QACnC,kBAAkB,EAAE,UAAU,CAAC,MAAM;KACtC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-node phase — emits one first-class `RepoNode` per graph.
|
|
3
|
+
*
|
|
4
|
+
* Runs after the `profile` phase so we can inherit `ProjectProfileNode.languages`
|
|
5
|
+
* when deriving `languageStats`. Probes three git endpoints via
|
|
6
|
+
* `git -C <path> ...` on the repository root:
|
|
7
|
+
* - `config --get remote.origin.url` → `originUrl` + `repoUri`
|
|
8
|
+
* - `symbolic-ref --short refs/remotes/origin/HEAD` → `defaultBranch`
|
|
9
|
+
* - `rev-parse HEAD` → `commitSha`
|
|
10
|
+
*
|
|
11
|
+
* All probes fail-safe: when git is absent, the repo is not a git working
|
|
12
|
+
* tree, or the command exits non-zero, the phase returns a deterministic
|
|
13
|
+
* `local:<sha256(abs-path)[:12]>` handle. The phase never throws on git
|
|
14
|
+
* failures — it downgrades to the local-only shape.
|
|
15
|
+
*
|
|
16
|
+
* `indexTime` is populated inside this phase but is explicitly kept out of
|
|
17
|
+
* graphHash determinism inputs — graphHash hashes the node verbatim, so
|
|
18
|
+
* callers that need fixture-stable hashes must freeze `indexTime` at the
|
|
19
|
+
* fixture level or omit the phase from the determinism gate.
|
|
20
|
+
*/
|
|
21
|
+
import { type RepoNode } from "@opencodehub/core-types";
|
|
22
|
+
import type { PipelinePhase } from "../types.js";
|
|
23
|
+
export declare const REPO_NODE_PHASE_NAME = "repo-node";
|
|
24
|
+
/** Options input to a direct `runRepoNodePhase` call (outside the pipeline DAG). */
|
|
25
|
+
export interface RepoNodePhaseInput {
|
|
26
|
+
readonly repoPath: string;
|
|
27
|
+
/** Federation-group tag. `null` when the repo isn't in a group. */
|
|
28
|
+
readonly group?: string | null;
|
|
29
|
+
/** Visibility for MCP gating. Defaults to `private`. */
|
|
30
|
+
readonly visibility?: "private" | "internal" | "public";
|
|
31
|
+
/** Name+version of the indexer, per SCIP `Metadata.toolInfo`. */
|
|
32
|
+
readonly indexer: string;
|
|
33
|
+
/**
|
|
34
|
+
* Pre-detected language list from the `profile` phase. Used to derive
|
|
35
|
+
* `languageStats` when available. Absent → `languageStats` is `{}`.
|
|
36
|
+
*/
|
|
37
|
+
readonly detectedLanguages?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Injected clock. Defaults to `new Date().toISOString()` but tests and
|
|
40
|
+
* reproducible-build paths override to freeze the timestamp.
|
|
41
|
+
*/
|
|
42
|
+
readonly now?: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Injected git probe. Defaults to spawning `git -C <path> <args>` via
|
|
45
|
+
* execFile. Tests override this to simulate HTTPS / SSH / no-remote repos.
|
|
46
|
+
*/
|
|
47
|
+
readonly gitProbe?: GitProbe;
|
|
48
|
+
}
|
|
49
|
+
export interface RepoNodePhaseOutput {
|
|
50
|
+
readonly repoNode: RepoNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Functional interface for the three git probes the phase issues. Each
|
|
54
|
+
* returns the probe's stdout (trimmed) or `null` when git failed or exited
|
|
55
|
+
* non-zero. `null` is modelled with `undefined` so `exactOptionalPropertyTypes`
|
|
56
|
+
* compile cleanly when the phase input omits `gitProbe` entirely.
|
|
57
|
+
*/
|
|
58
|
+
export interface GitProbe {
|
|
59
|
+
/** `git -C <repoPath> config --get remote.origin.url`. */
|
|
60
|
+
originUrl(repoPath: string): Promise<string | null>;
|
|
61
|
+
/** `git -C <repoPath> symbolic-ref --short refs/remotes/origin/HEAD`. */
|
|
62
|
+
defaultBranch(repoPath: string): Promise<string | null>;
|
|
63
|
+
/** `git -C <repoPath> rev-parse HEAD`. */
|
|
64
|
+
commitSha(repoPath: string): Promise<string | null>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Default git probe — runs `git` as a subprocess and swallows all errors to
|
|
68
|
+
* `null`. We check exit code only implicitly: `execFile` throws on non-zero,
|
|
69
|
+
* and the try/catch demotes that to `null`.
|
|
70
|
+
*/
|
|
71
|
+
export declare const defaultGitProbe: GitProbe;
|
|
72
|
+
/**
|
|
73
|
+
* Normalise an arbitrary git remote URL into a Sourcegraph-style `host/path`
|
|
74
|
+
* handle. Handles HTTPS, SSH, and the "scp-like" SSH form git accepts by
|
|
75
|
+
* default (`git@host:path`). Trailing `.git` is always stripped.
|
|
76
|
+
*
|
|
77
|
+
* Examples:
|
|
78
|
+
* https://github.com/org/repo.git → github.com/org/repo
|
|
79
|
+
* git@github.com:org/repo.git → github.com/org/repo
|
|
80
|
+
* ssh://git@gitlab.example.com/org/repo → gitlab.example.com/org/repo
|
|
81
|
+
* https://user:token@host.com/a/b → host.com/a/b
|
|
82
|
+
*
|
|
83
|
+
* Returns `null` for unparseable inputs so the caller falls back to the
|
|
84
|
+
* `local:<hash>` form instead of inventing a URI.
|
|
85
|
+
*/
|
|
86
|
+
export declare function deriveRepoUri(originUrl: string): string | null;
|
|
87
|
+
/** `local:<sha256(absolute-path)[:12]>` — fallback handle when no git remote exists. */
|
|
88
|
+
export declare function deriveLocalRepoUri(absolutePath: string): string;
|
|
89
|
+
/**
|
|
90
|
+
* Derive a sorted, fraction-summing language distribution from a list of
|
|
91
|
+
* detected languages. The simplest fair distribution (when upstream phases
|
|
92
|
+
* only surface a set, not counts) is uniform — `1 / N` per language.
|
|
93
|
+
*
|
|
94
|
+
* Keys are NOT sorted here; canonical JSON is applied at serialisation time
|
|
95
|
+
* (graphHash + storage adapters), so callers cannot accidentally poison byte
|
|
96
|
+
* stability by preserving insertion order.
|
|
97
|
+
*/
|
|
98
|
+
export declare function deriveLanguageStats(languages: readonly string[]): Readonly<Record<string, number>>;
|
|
99
|
+
/**
|
|
100
|
+
* Core entry point — usable both inside the pipeline DAG (via `repoNodePhase`)
|
|
101
|
+
* and as a standalone function for callers that already hold a repo path and
|
|
102
|
+
* an indexer tag.
|
|
103
|
+
*/
|
|
104
|
+
export declare function runRepoNodePhase(input: RepoNodePhaseInput): Promise<RepoNodePhaseOutput>;
|
|
105
|
+
/**
|
|
106
|
+
* Pipeline wrapper. Consumes the profile phase's detected languages (when
|
|
107
|
+
* present), emits one RepoNode, and pushes it into `ctx.graph`. The output
|
|
108
|
+
* map is a no-op hook — downstream phases that want the node should read it
|
|
109
|
+
* from the graph, mirroring the profile-phase contract.
|
|
110
|
+
*/
|
|
111
|
+
export declare const repoNodePhase: PipelinePhase<RepoNodePhaseOutput>;
|
|
112
|
+
//# sourceMappingURL=repo-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-node.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/repo-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,oBAAoB,c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,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAMlC;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA2C9F;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAwB5D,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo-node phase — emits one first-class `RepoNode` per graph.
|
|
3
|
+
*
|
|
4
|
+
* Runs after the `profile` phase so we can inherit `ProjectProfileNode.languages`
|
|
5
|
+
* when deriving `languageStats`. Probes three git endpoints via
|
|
6
|
+
* `git -C <path> ...` on the repository root:
|
|
7
|
+
* - `config --get remote.origin.url` → `originUrl` + `repoUri`
|
|
8
|
+
* - `symbolic-ref --short refs/remotes/origin/HEAD` → `defaultBranch`
|
|
9
|
+
* - `rev-parse HEAD` → `commitSha`
|
|
10
|
+
*
|
|
11
|
+
* All probes fail-safe: when git is absent, the repo is not a git working
|
|
12
|
+
* tree, or the command exits non-zero, the phase returns a deterministic
|
|
13
|
+
* `local:<sha256(abs-path)[:12]>` handle. The phase never throws on git
|
|
14
|
+
* failures — it downgrades to the local-only shape.
|
|
15
|
+
*
|
|
16
|
+
* `indexTime` is populated inside this phase but is explicitly kept out of
|
|
17
|
+
* graphHash determinism inputs — graphHash hashes the node verbatim, so
|
|
18
|
+
* callers that need fixture-stable hashes must freeze `indexTime` at the
|
|
19
|
+
* fixture level or omit the phase from the determinism gate.
|
|
20
|
+
*/
|
|
21
|
+
import { execFile } from "node:child_process";
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
|
+
import { resolve } from "node:path";
|
|
24
|
+
import { promisify } from "node:util";
|
|
25
|
+
import { makeNodeId } from "@opencodehub/core-types";
|
|
26
|
+
import { PROFILE_PHASE_NAME } from "./profile.js";
|
|
27
|
+
export const REPO_NODE_PHASE_NAME = "repo-node";
|
|
28
|
+
const execFileAsync = promisify(execFile);
|
|
29
|
+
/**
|
|
30
|
+
* Default git probe — runs `git` as a subprocess and swallows all errors to
|
|
31
|
+
* `null`. We check exit code only implicitly: `execFile` throws on non-zero,
|
|
32
|
+
* and the try/catch demotes that to `null`.
|
|
33
|
+
*/
|
|
34
|
+
export const defaultGitProbe = {
|
|
35
|
+
async originUrl(repoPath) {
|
|
36
|
+
return tryGit(repoPath, ["config", "--get", "remote.origin.url"]);
|
|
37
|
+
},
|
|
38
|
+
async defaultBranch(repoPath) {
|
|
39
|
+
const ref = await tryGit(repoPath, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"]);
|
|
40
|
+
if (ref === null)
|
|
41
|
+
return null;
|
|
42
|
+
// refs/remotes/origin/HEAD dereferences to "origin/main" etc. Strip the
|
|
43
|
+
// leading remote prefix so callers get "main", "master", "trunk".
|
|
44
|
+
const slash = ref.indexOf("/");
|
|
45
|
+
return slash === -1 ? ref : ref.slice(slash + 1);
|
|
46
|
+
},
|
|
47
|
+
async commitSha(repoPath) {
|
|
48
|
+
return tryGit(repoPath, ["rev-parse", "HEAD"]);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Fixed sentinel used when we can't resolve a deterministic per-commit
|
|
53
|
+
* timestamp. Anchored to the Unix epoch so it clearly signals "unknown" and
|
|
54
|
+
* carries NO run-to-run variance — this preserves graphHash determinism when
|
|
55
|
+
* the phase runs outside a git working tree.
|
|
56
|
+
*/
|
|
57
|
+
const UNKNOWN_INDEX_TIME = "1970-01-01T00:00:00Z";
|
|
58
|
+
/**
|
|
59
|
+
* Resolve `indexTime` deterministically from the repo's HEAD commit
|
|
60
|
+
* timestamp via `git show -s --format=%cI HEAD`. The %cI formatter emits
|
|
61
|
+
* ISO 8601 strict UTC. Falls back to the unknown sentinel when git is
|
|
62
|
+
* unavailable or the repo is not a git working tree.
|
|
63
|
+
*
|
|
64
|
+
* graphHash determinism requires this: `new Date().toISOString()` would
|
|
65
|
+
* inject wall-clock noise into every node, breaking determinism on any
|
|
66
|
+
* pipeline run where the repo-node phase is active. Pinning to the HEAD
|
|
67
|
+
* commit time gives us "stable per commit" without excluding the field
|
|
68
|
+
* from graphHash.
|
|
69
|
+
*/
|
|
70
|
+
async function probeCommitTime(repoPath) {
|
|
71
|
+
const out = await tryGit(repoPath, ["show", "-s", "--format=%cI", "HEAD"]);
|
|
72
|
+
if (out === null)
|
|
73
|
+
return UNKNOWN_INDEX_TIME;
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
async function tryGit(repoPath, args) {
|
|
77
|
+
try {
|
|
78
|
+
const { stdout } = await execFileAsync("git", ["-C", repoPath, ...args], {
|
|
79
|
+
// Prevent a stuck git from wedging the pipeline — 5s is generous for
|
|
80
|
+
// the three metadata probes we issue.
|
|
81
|
+
timeout: 5000,
|
|
82
|
+
windowsHide: true,
|
|
83
|
+
});
|
|
84
|
+
const trimmed = stdout.trim();
|
|
85
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Normalise an arbitrary git remote URL into a Sourcegraph-style `host/path`
|
|
93
|
+
* handle. Handles HTTPS, SSH, and the "scp-like" SSH form git accepts by
|
|
94
|
+
* default (`git@host:path`). Trailing `.git` is always stripped.
|
|
95
|
+
*
|
|
96
|
+
* Examples:
|
|
97
|
+
* https://github.com/org/repo.git → github.com/org/repo
|
|
98
|
+
* git@github.com:org/repo.git → github.com/org/repo
|
|
99
|
+
* ssh://git@gitlab.example.com/org/repo → gitlab.example.com/org/repo
|
|
100
|
+
* https://user:token@host.com/a/b → host.com/a/b
|
|
101
|
+
*
|
|
102
|
+
* Returns `null` for unparseable inputs so the caller falls back to the
|
|
103
|
+
* `local:<hash>` form instead of inventing a URI.
|
|
104
|
+
*/
|
|
105
|
+
export function deriveRepoUri(originUrl) {
|
|
106
|
+
const remaining = originUrl.trim();
|
|
107
|
+
if (remaining.length === 0)
|
|
108
|
+
return null;
|
|
109
|
+
// scp-like SSH: `[user@]host:path`. The `:` must not be preceded by a
|
|
110
|
+
// scheme separator (`://`) and the path must not start with `/`.
|
|
111
|
+
const schemeMatch = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.exec(remaining);
|
|
112
|
+
if (schemeMatch === null) {
|
|
113
|
+
const colonIdx = remaining.indexOf(":");
|
|
114
|
+
const slashIdx = remaining.indexOf("/");
|
|
115
|
+
if (colonIdx !== -1 && (slashIdx === -1 || colonIdx < slashIdx)) {
|
|
116
|
+
const userHost = remaining.slice(0, colonIdx);
|
|
117
|
+
const path = remaining.slice(colonIdx + 1);
|
|
118
|
+
const atIdx = userHost.lastIndexOf("@");
|
|
119
|
+
const host = atIdx === -1 ? userHost : userHost.slice(atIdx + 1);
|
|
120
|
+
return finalizeRepoUri(host, path);
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
// URL-parseable form. Node's URL supports ssh://, https://, git://, etc.
|
|
125
|
+
try {
|
|
126
|
+
const u = new URL(remaining);
|
|
127
|
+
// u.pathname starts with "/", strip it.
|
|
128
|
+
return finalizeRepoUri(u.host, u.pathname.replace(/^\/+/, ""));
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function finalizeRepoUri(host, path) {
|
|
135
|
+
const cleanHost = host.trim().toLowerCase();
|
|
136
|
+
if (cleanHost.length === 0)
|
|
137
|
+
return null;
|
|
138
|
+
let cleanPath = path.trim().replace(/^\/+/, "");
|
|
139
|
+
if (cleanPath.endsWith(".git"))
|
|
140
|
+
cleanPath = cleanPath.slice(0, -4);
|
|
141
|
+
cleanPath = cleanPath.replace(/\/+$/, "");
|
|
142
|
+
if (cleanPath.length === 0)
|
|
143
|
+
return null;
|
|
144
|
+
return `${cleanHost}/${cleanPath}`;
|
|
145
|
+
}
|
|
146
|
+
/** `local:<sha256(absolute-path)[:12]>` — fallback handle when no git remote exists. */
|
|
147
|
+
export function deriveLocalRepoUri(absolutePath) {
|
|
148
|
+
const digest = createHash("sha256").update(absolutePath, "utf8").digest("hex");
|
|
149
|
+
return `local:${digest.slice(0, 12)}`;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Derive a sorted, fraction-summing language distribution from a list of
|
|
153
|
+
* detected languages. The simplest fair distribution (when upstream phases
|
|
154
|
+
* only surface a set, not counts) is uniform — `1 / N` per language.
|
|
155
|
+
*
|
|
156
|
+
* Keys are NOT sorted here; canonical JSON is applied at serialisation time
|
|
157
|
+
* (graphHash + storage adapters), so callers cannot accidentally poison byte
|
|
158
|
+
* stability by preserving insertion order.
|
|
159
|
+
*/
|
|
160
|
+
export function deriveLanguageStats(languages) {
|
|
161
|
+
if (languages.length === 0)
|
|
162
|
+
return {};
|
|
163
|
+
const share = 1 / languages.length;
|
|
164
|
+
const out = {};
|
|
165
|
+
for (const lang of languages)
|
|
166
|
+
out[lang] = share;
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Core entry point — usable both inside the pipeline DAG (via `repoNodePhase`)
|
|
171
|
+
* and as a standalone function for callers that already hold a repo path and
|
|
172
|
+
* an indexer tag.
|
|
173
|
+
*/
|
|
174
|
+
export async function runRepoNodePhase(input) {
|
|
175
|
+
const probe = input.gitProbe ?? defaultGitProbe;
|
|
176
|
+
const absolutePath = resolve(input.repoPath);
|
|
177
|
+
const [originUrl, defaultBranch, commitSha] = await Promise.all([
|
|
178
|
+
probe.originUrl(absolutePath),
|
|
179
|
+
probe.defaultBranch(absolutePath),
|
|
180
|
+
probe.commitSha(absolutePath),
|
|
181
|
+
]);
|
|
182
|
+
const derivedUri = originUrl !== null ? deriveRepoUri(originUrl) : null;
|
|
183
|
+
const repoUri = derivedUri ?? deriveLocalRepoUri(absolutePath);
|
|
184
|
+
const name = repoUri;
|
|
185
|
+
const id = makeNodeId("Repo", "", "repo");
|
|
186
|
+
// `indexTime` must be deterministic per commit — `new Date().toISOString()`
|
|
187
|
+
// would poison graphHash with wall-clock noise, breaking determinism. The
|
|
188
|
+
// injected `now` override wins when the caller wants a fixture-stable
|
|
189
|
+
// value (tests); otherwise we read the HEAD commit timestamp so two runs
|
|
190
|
+
// at the same commit produce byte-identical RepoNodes.
|
|
191
|
+
const indexTime = input.now !== undefined ? input.now() : await probeCommitTime(absolutePath);
|
|
192
|
+
const repoNode = {
|
|
193
|
+
id,
|
|
194
|
+
kind: "Repo",
|
|
195
|
+
name,
|
|
196
|
+
filePath: "",
|
|
197
|
+
originUrl,
|
|
198
|
+
repoUri,
|
|
199
|
+
defaultBranch,
|
|
200
|
+
// When HEAD can't be resolved the repo is effectively un-indexed; emit
|
|
201
|
+
// the null-commit sentinel as an empty SHA string so downstream tooling
|
|
202
|
+
// can detect the degenerate case without a branch. This is still a
|
|
203
|
+
// valid RepoNode — the interface declares `commitSha: string`, so we
|
|
204
|
+
// satisfy the type with an explicit empty string rather than `null`.
|
|
205
|
+
commitSha: commitSha ?? "",
|
|
206
|
+
indexTime,
|
|
207
|
+
group: input.group ?? null,
|
|
208
|
+
visibility: input.visibility ?? "private",
|
|
209
|
+
indexer: input.indexer,
|
|
210
|
+
languageStats: deriveLanguageStats(input.detectedLanguages ?? []),
|
|
211
|
+
};
|
|
212
|
+
return { repoNode };
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Pipeline wrapper. Consumes the profile phase's detected languages (when
|
|
216
|
+
* present), emits one RepoNode, and pushes it into `ctx.graph`. The output
|
|
217
|
+
* map is a no-op hook — downstream phases that want the node should read it
|
|
218
|
+
* from the graph, mirroring the profile-phase contract.
|
|
219
|
+
*/
|
|
220
|
+
export const repoNodePhase = {
|
|
221
|
+
name: REPO_NODE_PHASE_NAME,
|
|
222
|
+
// Declaring `profile` as a dep (not `scan`) makes the phase run AFTER
|
|
223
|
+
// ProjectProfileNode is on the graph, which guarantees `languageStats`
|
|
224
|
+
// is populated from the same source-of-truth detector.
|
|
225
|
+
deps: [PROFILE_PHASE_NAME],
|
|
226
|
+
async run(ctx, deps) {
|
|
227
|
+
const profile = deps.get(PROFILE_PHASE_NAME);
|
|
228
|
+
if (profile === undefined) {
|
|
229
|
+
throw new Error("repo-node: profile output missing from dependency map");
|
|
230
|
+
}
|
|
231
|
+
const detectedLanguages = readDetectedLanguages(ctx);
|
|
232
|
+
const out = await runRepoNodePhase({
|
|
233
|
+
repoPath: ctx.repoPath,
|
|
234
|
+
// The pipeline does not yet thread group / visibility / indexer through
|
|
235
|
+
// PipelineOptions — that wiring lands in a later iteration. For now we
|
|
236
|
+
// surface deterministic defaults that match the RepoNode interface
|
|
237
|
+
// contract.
|
|
238
|
+
indexer: `opencodehub@${resolveIndexerVersion()}`,
|
|
239
|
+
detectedLanguages,
|
|
240
|
+
});
|
|
241
|
+
ctx.graph.addNode(out.repoNode);
|
|
242
|
+
return out;
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
function readDetectedLanguages(ctx) {
|
|
246
|
+
for (const n of ctx.graph.nodes()) {
|
|
247
|
+
if (n.kind === "ProjectProfile") {
|
|
248
|
+
return n.languages;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Best-effort read of the ingestion package version so `indexer` carries a
|
|
255
|
+
* concrete `opencodehub@<version>` tag. Resolves via `package.json` import
|
|
256
|
+
* only when available; falls back to `"unknown"` so the phase never throws
|
|
257
|
+
* on a missing / unreadable manifest.
|
|
258
|
+
*/
|
|
259
|
+
function resolveIndexerVersion() {
|
|
260
|
+
try {
|
|
261
|
+
// dist layout: phases/ -> pipeline/ -> src/ -> package root / package.json
|
|
262
|
+
// (under packages/ingestion/). We do NOT import the file directly — an
|
|
263
|
+
// ESM import of package.json requires an import assertion that most
|
|
264
|
+
// Node versions gate behind a flag. Instead, fall back to the static
|
|
265
|
+
// package name when the version isn't trivially discoverable.
|
|
266
|
+
return "0.1.0";
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return "unknown";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=repo-node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-node.js","sourceRoot":"","sources":["../../../src/pipeline/phases/repo-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAiB,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,cAAc,CAAC;AAEtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAEhD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AA+C1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAa;IACvC,KAAK,CAAC,SAAS,CAAC,QAAQ;QACtB,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,KAAK,CAAC,aAAa,CAAC,QAAQ;QAC1B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,0BAA0B,CAAC,CAAC,CAAC;QAC5F,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,wEAAwE;QACxE,kEA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C,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAChC,OAAQ,CAA+C,CAAC,SAAS,CAAC;QACpE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB;IAC5B,IAAI,CAAC;QACH,2EAA2E;QAC3E,uEAAuE;QACvE,oEAAoE;QACpE,qEAAqE;QACrE,8DAA8D;QAC9D,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Risk-snapshot phase.
|
|
3
|
+
*
|
|
4
|
+
* Persists a per-community risk snapshot to
|
|
5
|
+
* `.codehub/history/risk_<ISOTS>.json` after `annotate` has finalised the
|
|
6
|
+
* community + finding counts. The snapshot captures the state of the graph
|
|
7
|
+
* for trend analysis across successive analyze runs.
|
|
8
|
+
*
|
|
9
|
+
* Dependencies: `[annotate]` — we want the finished community + finding
|
|
10
|
+
* node set.
|
|
11
|
+
*
|
|
12
|
+
* Determinism: snapshot filenames are derived from the run's wall-clock
|
|
13
|
+
* timestamp; callers that want byte-stable output should inject a clock via
|
|
14
|
+
* `options.riskSnapshotNow`. The snapshot itself is deterministic given a
|
|
15
|
+
* pinned timestamp because both `perCommunityRisk` and the histogram keys
|
|
16
|
+
* are sorted before serialisation.
|
|
17
|
+
*/
|
|
18
|
+
import type { PipelinePhase } from "../types.js";
|
|
19
|
+
export declare const RISK_SNAPSHOT_PHASE_NAME: "risk-snapshot";
|
|
20
|
+
export interface RiskSnapshotOptions {
|
|
21
|
+
/** When true, do not persist the snapshot. Default false (persist). */
|
|
22
|
+
readonly riskSnapshotSkipPersist?: boolean;
|
|
23
|
+
/** Override the timestamp used for the filename + snapshot field. */
|
|
24
|
+
readonly riskSnapshotNow?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RiskSnapshotOutput {
|
|
27
|
+
readonly filePath: string | null;
|
|
28
|
+
readonly communityCount: number;
|
|
29
|
+
readonly totalNodeCount: number;
|
|
30
|
+
readonly totalEdgeCount: number;
|
|
31
|
+
readonly persisted: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const riskSnapshotPhase: PipelinePhase<RiskSnapshotOutput>;
|
|
34
|
+
//# sourceMappingURL=risk-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-snapshot.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/risk-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,wBAAwB,EAAG,eAAwB,CAAC;AAEjE,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,qEAAqE;IACrE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,kBAAkB,CAM/D,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Risk-snapshot phase.
|
|
3
|
+
*
|
|
4
|
+
* Persists a per-community risk snapshot to
|
|
5
|
+
* `.codehub/history/risk_<ISOTS>.json` after `annotate` has finalised the
|
|
6
|
+
* community + finding counts. The snapshot captures the state of the graph
|
|
7
|
+
* for trend analysis across successive analyze runs.
|
|
8
|
+
*
|
|
9
|
+
* Dependencies: `[annotate]` — we want the finished community + finding
|
|
10
|
+
* node set.
|
|
11
|
+
*
|
|
12
|
+
* Determinism: snapshot filenames are derived from the run's wall-clock
|
|
13
|
+
* timestamp; callers that want byte-stable output should inject a clock via
|
|
14
|
+
* `options.riskSnapshotNow`. The snapshot itself is deterministic given a
|
|
15
|
+
* pinned timestamp because both `perCommunityRisk` and the histogram keys
|
|
16
|
+
* are sorted before serialisation.
|
|
17
|
+
*/
|
|
18
|
+
import { buildRiskSnapshotFromGraph, persistRiskSnapshot } from "@opencodehub/analysis";
|
|
19
|
+
import { ANNOTATE_PHASE_NAME } from "./annotate.js";
|
|
20
|
+
export const RISK_SNAPSHOT_PHASE_NAME = "risk-snapshot";
|
|
21
|
+
export const riskSnapshotPhase = {
|
|
22
|
+
name: RISK_SNAPSHOT_PHASE_NAME,
|
|
23
|
+
deps: [ANNOTATE_PHASE_NAME],
|
|
24
|
+
async run(ctx, deps) {
|
|
25
|
+
return runRiskSnapshot(ctx, deps);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
async function runRiskSnapshot(ctx, deps) {
|
|
29
|
+
const annotate = deps.get(ANNOTATE_PHASE_NAME);
|
|
30
|
+
const options = ctx.options;
|
|
31
|
+
const nowIso = options.riskSnapshotNow ?? new Date().toISOString();
|
|
32
|
+
const commit = annotate?.currentCommit ?? "unknown";
|
|
33
|
+
const snapshot = buildRiskSnapshotFromGraph(ctx.graph, commit, nowIso);
|
|
34
|
+
const communityCount = Object.keys(snapshot.perCommunityRisk).length;
|
|
35
|
+
if (options.riskSnapshotSkipPersist === true) {
|
|
36
|
+
return {
|
|
37
|
+
filePath: null,
|
|
38
|
+
communityCount,
|
|
39
|
+
totalNodeCount: snapshot.totalNodeCount,
|
|
40
|
+
totalEdgeCount: snapshot.totalEdgeCount,
|
|
41
|
+
persisted: false,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
let filePath = null;
|
|
45
|
+
try {
|
|
46
|
+
filePath = await persistRiskSnapshot(ctx.repoPath, snapshot);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
ctx.onProgress?.({
|
|
50
|
+
phase: RISK_SNAPSHOT_PHASE_NAME,
|
|
51
|
+
kind: "warn",
|
|
52
|
+
message: `risk-snapshot: persist failed (${err.message})`,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
filePath,
|
|
57
|
+
communityCount,
|
|
58
|
+
totalNodeCount: snapshot.totalNodeCount,
|
|
59
|
+
totalEdgeCount: snapshot.totalEdgeCount,
|
|
60
|
+
persisted: filePath !== null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=risk-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-snapshot.js","sourceRoot":"","sources":["../../../src/pipeline/phases/risk-snapshot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAExF,OAAO,EAAE,mBAAmB,EAAuB,MAAM,eAAe,CAAC;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAwB,CAAC;AAiBjE,MAAM,CAAC,MAAM,iBAAiB,GAAsC;IAClE,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,CAAC,mBAAmB,CAAC;IAC3B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI;QACjB,OAAO,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;CACF,CAAC;AAEF,KAAK,UAAU,eAAe,CAC5B,GAAoB,EACpB,IAAkC;IAElC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAA+B,CAAC;IAC7E,MAAM,OAAO,GAAG,GAAG,CAAC,OAAwD,CAAC;IAC7E,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACnE,MAAM,MAAM,GAAG,QAAQ,EAAE,aAAa,IAAI,SAAS,CAAC;IACpD,MAAM,QAAQ,GAAG,0BAA0B,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvE,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;IACrE,IAAI,OAAO,CAAC,uBAAuB,KAAK,IAAI,EAAE,CAAC;QAC7C,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,cAAc;YACd,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,SAAS,EAAE,KAAK;SACjB,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,GAAkB,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,mBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,UAAU,EAAE,CAAC;YACf,KAAK,EAAE,wBAAwB;YAC/B,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,kCAAmC,GAAa,CAAC,OAAO,GAAG;SACrE,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,cAAc;QACd,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,SAAS,EAAE,QAAQ,KAAK,IAAI;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routes phase — materialises HTTP route metadata emitted by the static
|
|
3
|
+
* detectors (Next.js, Express, FastAPI, NestJS, Spring MVC, Rails) as
|
|
4
|
+
* graph nodes and edges.
|
|
5
|
+
*
|
|
6
|
+
* The phase:
|
|
7
|
+
* 1. Feeds the scanned files through every detector that matches the
|
|
8
|
+
* active {@link ProjectProfileNode.frameworks} list. Next.js +
|
|
9
|
+
* Express always run when TS/JS files are present. FastAPI runs on
|
|
10
|
+
* `fastapi`, NestJS on `nestjs`, Spring on any `spring-*` variant,
|
|
11
|
+
* Rails on `rails`.
|
|
12
|
+
* 2. Creates one `Route` node per unique `(url, method)` pair, keyed
|
|
13
|
+
* by the handler file so two frameworks declaring the same URL on
|
|
14
|
+
* the same file reuse the node.
|
|
15
|
+
* 3. Emits `HANDLES_ROUTE` edges from the declaring File node to the
|
|
16
|
+
* Route node with a fixed confidence of 0.9.
|
|
17
|
+
* 4. Detects cross-file duplicates for the same `(url, method)` and
|
|
18
|
+
* surfaces them as warnings via the progress callback — but keeps
|
|
19
|
+
* one edge per handler file (the route *is* re-declared).
|
|
20
|
+
*
|
|
21
|
+
* Depends on `parse` to order the DAG; the profile node is read from
|
|
22
|
+
* the in-memory graph.
|
|
23
|
+
*/
|
|
24
|
+
import type { PipelinePhase } from "../types.js";
|
|
25
|
+
export interface RoutesOutput {
|
|
26
|
+
readonly routeCount: number;
|
|
27
|
+
readonly duplicateCount: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const ROUTES_PHASE_NAME = "routes";
|
|
30
|
+
export declare const routesPhase: PipelinePhase<RoutesOutput>;
|
|
31
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/pipeline/phases/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAgBH,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAsBlE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,YAAY,CAgBnD,CAAC"}
|