@dataparade/cli 0.0.12 → 0.0.14
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/dist/package.json +5 -8
- package/dist/src/ai-enrichment/candidate-selector.d.ts +4 -4
- package/dist/src/ai-enrichment/candidate-selector.js +37 -32
- package/dist/src/ai-enrichment/fallbacks.d.ts +2 -2
- package/dist/src/ai-enrichment/fallbacks.js +227 -83
- package/dist/src/ai-enrichment/merge-rules.d.ts +5 -3
- package/dist/src/ai-enrichment/merge-rules.js +225 -35
- package/dist/src/ai-enrichment/non-pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/openai-proposals-response.schema.d.ts +1 -1
- package/dist/src/ai-enrichment/pii-signal-rules.js +2 -6
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +2 -2
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +4 -4
- package/dist/src/ai-enrichment/property-priority.d.ts +5 -0
- package/dist/src/ai-enrichment/property-priority.js +23 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +5 -5
- package/dist/src/ai-enrichment/provider-prompt.js +24 -15
- package/dist/src/ai-enrichment/provider-topology-rules.js +2 -6
- package/dist/src/ai-enrichment/providers/provider-contract.d.ts +6 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +62 -2
- package/dist/src/ai-enrichment/red-flags.d.ts +46 -0
- package/dist/src/ai-enrichment/red-flags.js +365 -0
- package/dist/src/ai-enrichment/sensitive-paths.d.ts +1 -1
- package/dist/src/ai-enrichment/sensitive-paths.js +3 -3
- package/dist/src/ai-enrichment/third-party-data-flow.js +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +3 -3
- package/dist/src/ai-enrichment/third-party-evidence.js +96 -93
- package/dist/src/ai-enrichment/third-party-subtype.js +2 -2
- package/dist/src/ai-enrichment/tools/index.d.ts +1 -1
- package/dist/src/ai-enrichment/types.d.ts +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +161 -143
- package/dist/src/config/file.d.ts +1 -1
- package/dist/src/config/file.js +21 -20
- package/dist/src/config/resolve.d.ts +1 -1
- package/dist/src/config/resolve.js +75 -69
- package/dist/src/core/pipeline/graph-mapping.d.ts +1 -6
- package/dist/src/core/pipeline/graph-mapping.js +3 -314
- package/dist/src/core/pipeline/orchestrator-result.d.ts +9 -6
- package/dist/src/core/pipeline/orchestrator.d.ts +2 -26
- package/dist/src/core/pipeline/orchestrator.js +4 -77
- package/dist/src/core/pipeline/scan-pipeline.d.ts +4 -3
- package/dist/src/core/pipeline/scan-pipeline.js +82 -128
- package/dist/src/core/schema/index.d.ts +2 -2
- package/dist/src/core/schema/index.js +4 -2
- package/dist/src/core/schema/scan-config.schema.d.ts +4 -3
- package/dist/src/core/schema/scan-config.schema.js +18 -17
- package/dist/src/core/schema/scan-result.schema.d.ts +2 -456
- package/dist/src/core/schema/scan-result.schema.js +12 -240
- package/dist/src/core/types/component.d.ts +1 -18
- package/dist/src/core/types/component.js +15 -0
- package/dist/src/core/types/config.d.ts +1 -64
- package/dist/src/core/types/config.js +15 -0
- package/dist/src/core/types/data-flow.d.ts +1 -24
- package/dist/src/core/types/data-flow.js +15 -0
- package/dist/src/core/types/detection.d.ts +1 -12
- package/dist/src/core/types/detection.js +15 -17
- package/dist/src/core/types/file.d.ts +1 -14
- package/dist/src/core/types/file.js +15 -0
- package/dist/src/core/types/index.d.ts +1 -7
- package/dist/src/core/types/index.js +1 -7
- package/dist/src/core/types/progress.d.ts +1 -9
- package/dist/src/core/types/progress.js +15 -0
- package/dist/src/core/types/result.d.ts +1 -140
- package/dist/src/core/types/result.js +15 -0
- package/dist/src/evals/run-model-matrix.js +2 -1
- package/dist/src/output/json.d.ts +11 -3
- package/dist/src/output/json.js +10 -5
- package/dist/src/platform-api/estimate-scan-footprint.js +9 -10
- package/dist/src/scanner-package-root.d.ts +2 -0
- package/dist/src/scanner-package-root.js +12 -0
- package/dist/tests/cli/cli.spec.js +18 -15
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +80 -49
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +658 -166
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +78 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +80 -75
- package/dist/tests/unit/ai-enrichment/red-flags.spec.js +227 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +2 -2
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +38 -34
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +5 -3
- package/dist/tests/unit/cli/scan-command-e2e-backend-lambda-orphan.spec.js +60 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +2 -2
- package/dist/tests/unit/cli/scan-command-e2e-occupied-section-hubs.spec.js +58 -0
- package/dist/tests/unit/cli/scan-command-e2e-ruby-basic.spec.js +46 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.js +2 -1
- package/dist/tests/unit/cli/scan-command-exit-code.spec.js +7 -5
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +8 -0
- package/dist/tests/unit/core/cpp-dotnet-scan.spec.js +4 -3
- package/dist/tests/unit/core/go-scan.spec.js +7 -6
- package/dist/tests/unit/core/graph-mapping.spec.js +2 -1
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.js +7 -6
- package/dist/tests/unit/core/jvm-scan.spec.js +6 -5
- package/dist/tests/unit/core/no-source-code-leakage.spec.js +2 -1
- package/dist/tests/unit/core/orchestrator.spec.js +21 -20
- package/dist/tests/unit/core/output-json.spec.js +3 -2
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.js +2 -1
- package/dist/tests/unit/core/scan-result-language-stats.spec.js +2 -1
- package/dist/tests/unit/core/terraform-json-overlay.spec.js +2 -1
- package/dist/tests/unit/publish-manifest.spec.js +3 -2
- package/package.json +5 -8
- package/dist/src/analyzers/cpp/cpp-detection-config.d.ts +0 -73
- package/dist/src/analyzers/cpp/cpp-detection-config.js +0 -137
- package/dist/src/analyzers/cpp/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/cpp/dependency-manifests.js +0 -130
- package/dist/src/analyzers/cpp/detector.d.ts +0 -3
- package/dist/src/analyzers/cpp/detector.js +0 -21
- package/dist/src/analyzers/cpp/index.d.ts +0 -2
- package/dist/src/analyzers/cpp/index.js +0 -11
- package/dist/src/analyzers/cpp/manifest-parsers.d.ts +0 -13
- package/dist/src/analyzers/cpp/manifest-parsers.js +0 -104
- package/dist/src/analyzers/cpp/parser.d.ts +0 -35
- package/dist/src/analyzers/cpp/parser.js +0 -206
- package/dist/src/analyzers/cpp/patterns.d.ts +0 -3
- package/dist/src/analyzers/cpp/patterns.js +0 -37
- package/dist/src/analyzers/csharp/csharp-detection-config.d.ts +0 -100
- package/dist/src/analyzers/csharp/csharp-detection-config.js +0 -160
- package/dist/src/analyzers/csharp/dependency-manifests.d.ts +0 -13
- package/dist/src/analyzers/csharp/dependency-manifests.js +0 -184
- package/dist/src/analyzers/csharp/detector.d.ts +0 -3
- package/dist/src/analyzers/csharp/detector.js +0 -21
- package/dist/src/analyzers/csharp/index.d.ts +0 -2
- package/dist/src/analyzers/csharp/index.js +0 -11
- package/dist/src/analyzers/csharp/manifest-parsers.d.ts +0 -34
- package/dist/src/analyzers/csharp/manifest-parsers.js +0 -130
- package/dist/src/analyzers/csharp/parser.d.ts +0 -48
- package/dist/src/analyzers/csharp/parser.js +0 -277
- package/dist/src/analyzers/csharp/patterns.d.ts +0 -3
- package/dist/src/analyzers/csharp/patterns.js +0 -57
- package/dist/src/analyzers/go/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/go/dependency-manifests.js +0 -117
- package/dist/src/analyzers/go/detector.d.ts +0 -3
- package/dist/src/analyzers/go/detector.js +0 -21
- package/dist/src/analyzers/go/go-detection-config.d.ts +0 -97
- package/dist/src/analyzers/go/go-detection-config.js +0 -164
- package/dist/src/analyzers/go/index.d.ts +0 -2
- package/dist/src/analyzers/go/index.js +0 -11
- package/dist/src/analyzers/go/manifest-parsers.d.ts +0 -20
- package/dist/src/analyzers/go/manifest-parsers.js +0 -104
- package/dist/src/analyzers/go/parser.d.ts +0 -40
- package/dist/src/analyzers/go/parser.js +0 -186
- package/dist/src/analyzers/go/patterns.d.ts +0 -3
- package/dist/src/analyzers/go/patterns.js +0 -50
- package/dist/src/analyzers/jvm/dependency-manifests.d.ts +0 -16
- package/dist/src/analyzers/jvm/dependency-manifests.js +0 -205
- package/dist/src/analyzers/jvm/detector.d.ts +0 -3
- package/dist/src/analyzers/jvm/detector.js +0 -21
- package/dist/src/analyzers/jvm/index.d.ts +0 -9
- package/dist/src/analyzers/jvm/index.js +0 -18
- package/dist/src/analyzers/jvm/jvm-detection-config.d.ts +0 -136
- package/dist/src/analyzers/jvm/jvm-detection-config.js +0 -195
- package/dist/src/analyzers/jvm/manifest-parsers.d.ts +0 -61
- package/dist/src/analyzers/jvm/manifest-parsers.js +0 -246
- package/dist/src/analyzers/jvm/parser.d.ts +0 -54
- package/dist/src/analyzers/jvm/parser.js +0 -419
- package/dist/src/analyzers/jvm/patterns.d.ts +0 -3
- package/dist/src/analyzers/jvm/patterns.js +0 -64
- package/dist/src/analyzers/php/dependency-manifests.d.ts +0 -10
- package/dist/src/analyzers/php/dependency-manifests.js +0 -117
- package/dist/src/analyzers/php/detector.d.ts +0 -3
- package/dist/src/analyzers/php/detector.js +0 -20
- package/dist/src/analyzers/php/index.d.ts +0 -2
- package/dist/src/analyzers/php/index.js +0 -11
- package/dist/src/analyzers/php/manifest-parsers.d.ts +0 -14
- package/dist/src/analyzers/php/manifest-parsers.js +0 -40
- package/dist/src/analyzers/php/parser.d.ts +0 -42
- package/dist/src/analyzers/php/parser.js +0 -297
- package/dist/src/analyzers/php/patterns.d.ts +0 -3
- package/dist/src/analyzers/php/patterns.js +0 -49
- package/dist/src/analyzers/php/php-detection-config.d.ts +0 -104
- package/dist/src/analyzers/php/php-detection-config.js +0 -192
- package/dist/src/analyzers/python/dependency-manifests.d.ts +0 -8
- package/dist/src/analyzers/python/dependency-manifests.js +0 -131
- package/dist/src/analyzers/python/detector.d.ts +0 -3
- package/dist/src/analyzers/python/detector.js +0 -22
- package/dist/src/analyzers/python/index.d.ts +0 -2
- package/dist/src/analyzers/python/index.js +0 -11
- package/dist/src/analyzers/python/manifest-parsers.d.ts +0 -3
- package/dist/src/analyzers/python/manifest-parsers.js +0 -134
- package/dist/src/analyzers/python/parser.d.ts +0 -27
- package/dist/src/analyzers/python/parser.js +0 -194
- package/dist/src/analyzers/python/patterns.d.ts +0 -8
- package/dist/src/analyzers/python/patterns.js +0 -51
- package/dist/src/analyzers/python/python-detection-config.d.ts +0 -93
- package/dist/src/analyzers/python/python-detection-config.js +0 -168
- package/dist/src/analyzers/registry.d.ts +0 -13
- package/dist/src/analyzers/registry.js +0 -78
- package/dist/src/analyzers/shared/c-family-calls.d.ts +0 -26
- package/dist/src/analyzers/shared/c-family-calls.js +0 -118
- package/dist/src/analyzers/shared/manifest-budgets.d.ts +0 -19
- package/dist/src/analyzers/shared/manifest-budgets.js +0 -21
- package/dist/src/analyzers/shared/manifest-fs.d.ts +0 -13
- package/dist/src/analyzers/shared/manifest-fs.js +0 -138
- package/dist/src/analyzers/shared/property-inference.d.ts +0 -8
- package/dist/src/analyzers/shared/property-inference.js +0 -165
- package/dist/src/analyzers/shared/strip-comments.d.ts +0 -32
- package/dist/src/analyzers/shared/strip-comments.js +0 -168
- package/dist/src/analyzers/terraform/detector.d.ts +0 -10
- package/dist/src/analyzers/terraform/detector.js +0 -198
- package/dist/src/analyzers/terraform/index.d.ts +0 -2
- package/dist/src/analyzers/terraform/index.js +0 -13
- package/dist/src/analyzers/terraform/parser.d.ts +0 -29
- package/dist/src/analyzers/terraform/parser.js +0 -202
- package/dist/src/analyzers/terraform/terraform-detection-config.d.ts +0 -48
- package/dist/src/analyzers/terraform/terraform-detection-config.js +0 -218
- package/dist/src/analyzers/terraform/terraform-exec.d.ts +0 -11
- package/dist/src/analyzers/terraform/terraform-exec.js +0 -35
- package/dist/src/analyzers/terraform/terraform-module-manifest.d.ts +0 -19
- package/dist/src/analyzers/terraform/terraform-module-manifest.js +0 -75
- package/dist/src/analyzers/terraform/terraform-show-json.d.ts +0 -15
- package/dist/src/analyzers/terraform/terraform-show-json.js +0 -188
- package/dist/src/analyzers/terraform/terraform-utility-resource.d.ts +0 -12
- package/dist/src/analyzers/terraform/terraform-utility-resource.js +0 -30
- package/dist/src/analyzers/types.d.ts +0 -5
- package/dist/src/analyzers/types.js +0 -2
- package/dist/src/analyzers/typescript/actor-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/actor-detection.js +0 -15
- package/dist/src/analyzers/typescript/dependency-manifests.d.ts +0 -9
- package/dist/src/analyzers/typescript/dependency-manifests.js +0 -131
- package/dist/src/analyzers/typescript/detector.d.ts +0 -3
- package/dist/src/analyzers/typescript/detector.js +0 -23
- package/dist/src/analyzers/typescript/index.d.ts +0 -2
- package/dist/src/analyzers/typescript/index.js +0 -11
- package/dist/src/analyzers/typescript/manifest-parsers.d.ts +0 -1
- package/dist/src/analyzers/typescript/manifest-parsers.js +0 -30
- package/dist/src/analyzers/typescript/parser.d.ts +0 -44
- package/dist/src/analyzers/typescript/parser.js +0 -287
- package/dist/src/analyzers/typescript/third-party-detection.d.ts +0 -4
- package/dist/src/analyzers/typescript/third-party-detection.js +0 -16
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +0 -105
- package/dist/src/analyzers/typescript/typescript-detection-config.js +0 -219
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +0 -11
- package/dist/src/analyzers/typescript/typescript-detection.js +0 -55
- package/dist/src/classifier/application-injection.d.ts +0 -12
- package/dist/src/classifier/application-injection.js +0 -335
- package/dist/src/classifier/classify.d.ts +0 -3
- package/dist/src/classifier/classify.js +0 -15
- package/dist/src/classifier/component-factory.d.ts +0 -3
- package/dist/src/classifier/component-factory.js +0 -488
- package/dist/src/classifier/config.d.ts +0 -38
- package/dist/src/classifier/config.js +0 -260
- package/dist/src/classifier/enhance-defaults.d.ts +0 -28
- package/dist/src/classifier/enhance-defaults.js +0 -369
- package/dist/src/classifier/enhance.d.ts +0 -13
- package/dist/src/classifier/enhance.js +0 -295
- package/dist/src/classifier/external-url-third-party.d.ts +0 -26
- package/dist/src/classifier/external-url-third-party.js +0 -195
- package/dist/src/classifier/grouping.js +0 -2
- package/dist/src/classifier/main-application-selection.d.ts +0 -41
- package/dist/src/classifier/main-application-selection.js +0 -222
- package/dist/src/classifier/naming.d.ts +0 -4
- package/dist/src/classifier/naming.js +0 -78
- package/dist/src/classifier/postprocessing.d.ts +0 -18
- package/dist/src/classifier/postprocessing.js +0 -565
- package/dist/src/classifier/sectioning.d.ts +0 -5
- package/dist/src/classifier/sectioning.js +0 -60
- package/dist/src/classifier/terraform-provider-hub.d.ts +0 -6
- package/dist/src/classifier/terraform-provider-hub.js +0 -38
- package/dist/src/config/actor-detection-config.d.ts +0 -21
- package/dist/src/config/actor-detection-config.js +0 -97
- package/dist/src/config/property-detection-config.d.ts +0 -27
- package/dist/src/config/property-detection-config.js +0 -355
- package/dist/src/config/third-party-detection-config.d.ts +0 -25
- package/dist/src/config/third-party-detection-config.js +0 -97
- package/dist/src/core/pipeline/classifier-phase.d.ts +0 -7
- package/dist/src/core/pipeline/classifier-phase.js +0 -78
- package/dist/src/core/pipeline/dataflow-phase.d.ts +0 -7
- package/dist/src/core/pipeline/dataflow-phase.js +0 -10
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.d.ts +0 -7
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.js +0 -74
- package/dist/src/core/pipeline/diagram-layout/constants.d.ts +0 -11
- package/dist/src/core/pipeline/diagram-layout/constants.js +0 -14
- package/dist/src/core/pipeline/diagram-layout/edge-handles.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/edge-handles.js +0 -26
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.js +0 -40
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.d.ts +0 -6
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.js +0 -53
- package/dist/src/core/pipeline/diagram-layout/section-helpers.d.ts +0 -30
- package/dist/src/core/pipeline/diagram-layout/section-helpers.js +0 -62
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.d.ts +0 -3
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.js +0 -109
- package/dist/src/core/pipeline/diagram-layout/types.d.ts +0 -2
- package/dist/src/core/pipeline/diagram-layout/types.js +0 -2
- package/dist/src/core/pipeline/infer-data-flow-protocol.d.ts +0 -7
- package/dist/src/core/pipeline/infer-data-flow-protocol.js +0 -39
- package/dist/src/core/pipeline/mixed-app-terraform-scan.d.ts +0 -13
- package/dist/src/core/pipeline/mixed-app-terraform-scan.js +0 -81
- package/dist/src/core/pipeline/resolve-path-under-scan-root.d.ts +0 -7
- package/dist/src/core/pipeline/resolve-path-under-scan-root.js +0 -55
- package/dist/src/core/pipeline/sorting.d.ts +0 -3
- package/dist/src/core/pipeline/sorting.js +0 -48
- package/dist/src/core/pipeline/stable-component-ids.d.ts +0 -15
- package/dist/src/core/pipeline/stable-component-ids.js +0 -68
- package/dist/src/core/pipeline/structural-scan.d.ts +0 -19
- package/dist/src/core/pipeline/structural-scan.js +0 -452
- package/dist/src/core/pipeline/terraform-flow-utils.d.ts +0 -6
- package/dist/src/core/pipeline/terraform-flow-utils.js +0 -32
- package/dist/src/core/pipeline/terraform-minimal-services.d.ts +0 -31
- package/dist/src/core/pipeline/terraform-minimal-services.js +0 -225
- package/dist/src/core/sectioning/discover-service-sections.d.ts +0 -80
- package/dist/src/core/sectioning/discover-service-sections.js +0 -497
- package/dist/src/core/sectioning/section-runtime.d.ts +0 -21
- package/dist/src/core/sectioning/section-runtime.js +0 -148
- package/dist/src/core/terraform/component-predicates.d.ts +0 -13
- package/dist/src/core/terraform/component-predicates.js +0 -71
- package/dist/src/data-flow/application-hub.d.ts +0 -7
- package/dist/src/data-flow/application-hub.js +0 -88
- package/dist/src/data-flow/dedupe.d.ts +0 -7
- package/dist/src/data-flow/dedupe.js +0 -92
- package/dist/src/data-flow/detect.d.ts +0 -16
- package/dist/src/data-flow/detect.js +0 -203
- package/dist/src/data-flow/detector.d.ts +0 -15
- package/dist/src/data-flow/detector.js +0 -18
- package/dist/src/data-flow/drop-cross-section-flows.d.ts +0 -8
- package/dist/src/data-flow/drop-cross-section-flows.js +0 -32
- package/dist/src/data-flow/ensure-actor-flow.d.ts +0 -16
- package/dist/src/data-flow/ensure-actor-flow.js +0 -101
- package/dist/src/data-flow/ensure-manifest-declared-flows.d.ts +0 -14
- package/dist/src/data-flow/ensure-manifest-declared-flows.js +0 -76
- package/dist/src/data-flow/ensure-section-api-flows.d.ts +0 -6
- package/dist/src/data-flow/ensure-section-api-flows.js +0 -57
- package/dist/src/data-flow/flow-builder.d.ts +0 -5
- package/dist/src/data-flow/flow-builder.js +0 -80
- package/dist/src/data-flow/import-graph.d.ts +0 -10
- package/dist/src/data-flow/import-graph.js +0 -147
- package/dist/src/data-flow/index.d.ts +0 -8
- package/dist/src/data-flow/index.js +0 -20
- package/dist/src/data-flow/internal-fetch.d.ts +0 -8
- package/dist/src/data-flow/internal-fetch.js +0 -209
- package/dist/src/data-flow/postprocess.d.ts +0 -9
- package/dist/src/data-flow/postprocess.js +0 -63
- package/dist/src/data-flow/rewire.d.ts +0 -10
- package/dist/src/data-flow/rewire.js +0 -93
- package/dist/src/data-flow/source-attribution.d.ts +0 -8
- package/dist/src/data-flow/source-attribution.js +0 -131
- package/dist/src/data-flow/source-resolution.d.ts +0 -13
- package/dist/src/data-flow/source-resolution.js +0 -61
- package/dist/src/data-flow/target-matching.d.ts +0 -21
- package/dist/src/data-flow/target-matching.js +0 -253
- package/dist/src/data-flow/terraform-flows.d.ts +0 -32
- package/dist/src/data-flow/terraform-flows.js +0 -170
- package/dist/src/ingest/file-system.d.ts +0 -17
- package/dist/src/ingest/file-system.js +0 -269
- package/dist/src/ingest/gitignore.d.ts +0 -12
- package/dist/src/ingest/gitignore.js +0 -127
- package/dist/src/ingest/sensitive-paths.d.ts +0 -2
- package/dist/src/ingest/sensitive-paths.js +0 -8
- package/dist/src/patterns/config.d.ts +0 -32
- package/dist/src/patterns/config.js +0 -286
- package/dist/src/patterns/detectors/cpp.d.ts +0 -8
- package/dist/src/patterns/detectors/cpp.js +0 -243
- package/dist/src/patterns/detectors/csharp.d.ts +0 -9
- package/dist/src/patterns/detectors/csharp.js +0 -385
- package/dist/src/patterns/detectors/go.d.ts +0 -9
- package/dist/src/patterns/detectors/go.js +0 -298
- package/dist/src/patterns/detectors/helpers.d.ts +0 -22
- package/dist/src/patterns/detectors/helpers.js +0 -73
- package/dist/src/patterns/detectors/jvm.d.ts +0 -15
- package/dist/src/patterns/detectors/jvm.js +0 -537
- package/dist/src/patterns/detectors/php.d.ts +0 -9
- package/dist/src/patterns/detectors/php.js +0 -466
- package/dist/src/patterns/detectors/python.d.ts +0 -9
- package/dist/src/patterns/detectors/python.js +0 -499
- package/dist/src/patterns/detectors/typescript.d.ts +0 -10
- package/dist/src/patterns/detectors/typescript.js +0 -480
- package/dist/src/patterns/engine.d.ts +0 -58
- package/dist/src/patterns/engine.js +0 -148
- package/dist/src/patterns/flow-source-patterns.d.ts +0 -6
- package/dist/src/patterns/flow-source-patterns.js +0 -39
- package/dist/src/patterns/frontend-frameworks.d.ts +0 -4
- package/dist/src/patterns/frontend-frameworks.js +0 -25
- package/dist/src/patterns/scan-exclusions.d.ts +0 -14
- package/dist/src/patterns/scan-exclusions.js +0 -96
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +0 -8
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/db.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +0 -1
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +0 -18
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +0 -7
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +0 -14
- package/dist/tests/fixtures/e2e-ts-sample/server.js +0 -4
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +0 -24
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +0 -1
- package/dist/tests/fixtures/ingest-basic/src/index.js +0 -6
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +0 -2
- package/dist/tests/fixtures/mixed-language-basic/api.js +0 -12
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +0 -6
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +0 -1
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/app/route.js +0 -7
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +0 -2
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +0 -8
- package/dist/tests/fixtures/typescript-basic/db.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/db.js +0 -7
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +0 -1
- package/dist/tests/fixtures/typescript-basic/external-api.js +0 -18
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +0 -3
- package/dist/tests/fixtures/typescript-basic/pg-client.js +0 -7
- package/dist/tests/fixtures/typescript-basic/server.d.ts +0 -14
- package/dist/tests/fixtures/typescript-basic/server.js +0 -4
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.d.ts +0 -0
- package/dist/tests/fixtures/typescript-dependency-manifests-basic/src/index.js +0 -2
- package/dist/tests/unit/analyzers/cpp/dependency-manifests.spec.js +0 -66
- package/dist/tests/unit/analyzers/cpp/parser.spec.js +0 -80
- package/dist/tests/unit/analyzers/cpp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/cpp/patterns.spec.js +0 -141
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/dependency-manifests.spec.js +0 -75
- package/dist/tests/unit/analyzers/csharp/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/parser.spec.js +0 -118
- package/dist/tests/unit/analyzers/csharp/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/csharp/patterns.spec.js +0 -210
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/dependency-manifests.spec.js +0 -96
- package/dist/tests/unit/analyzers/go/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/parser.spec.js +0 -110
- package/dist/tests/unit/analyzers/go/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/go/patterns.spec.js +0 -239
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/dependency-manifests.spec.js +0 -179
- package/dist/tests/unit/analyzers/jvm/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/parser.spec.js +0 -195
- package/dist/tests/unit/analyzers/jvm/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/jvm/patterns.spec.js +0 -284
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/dependency-manifests.spec.js +0 -54
- package/dist/tests/unit/analyzers/php/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/parser.spec.js +0 -128
- package/dist/tests/unit/analyzers/php/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/php/patterns.spec.js +0 -334
- package/dist/tests/unit/analyzers/python/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/parser.spec.js +0 -104
- package/dist/tests/unit/analyzers/python/patterns.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/python/patterns.spec.js +0 -458
- package/dist/tests/unit/analyzers/registry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/registry.spec.js +0 -234
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.js +0 -87
- package/dist/tests/unit/analyzers/terraform/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/detector.spec.js +0 -110
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.js +0 -53
- package/dist/tests/unit/analyzers/terraform/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/parser.spec.js +0 -56
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.js +0 -63
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.js +0 -19
- package/dist/tests/unit/analyzers/terraform-exec.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-exec.spec.js +0 -27
- package/dist/tests/unit/analyzers/terraform-show-json.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/terraform-show-json.spec.js +0 -77
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.js +0 -61
- package/dist/tests/unit/analyzers/typescript/detector.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +0 -413
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.js +0 -49
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.js +0 -27
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.js +0 -64
- package/dist/tests/unit/analyzers/typescript/parser.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/parser.spec.js +0 -99
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.js +0 -24
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.d.ts +0 -1
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.js +0 -160
- package/dist/tests/unit/classifier/classify.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/classify.spec.js +0 -1521
- package/dist/tests/unit/classifier/enhance.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/enhance.spec.js +0 -400
- package/dist/tests/unit/classifier/external-url-third-party.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/external-url-third-party.spec.js +0 -83
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.js +0 -44
- package/dist/tests/unit/classifier/terraform-grouping.spec.d.ts +0 -1
- package/dist/tests/unit/classifier/terraform-grouping.spec.js +0 -96
- package/dist/tests/unit/config/property-detection-config.spec.d.ts +0 -1
- package/dist/tests/unit/config/property-detection-config.spec.js +0 -38
- package/dist/tests/unit/core/classifier-phase-regressions.spec.d.ts +0 -1
- package/dist/tests/unit/core/classifier-phase-regressions.spec.js +0 -68
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/cpp-dotnet-sections.spec.js +0 -46
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.js +0 -66
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.d.ts +0 -1
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.js +0 -132
- package/dist/tests/unit/core/discover-service-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/discover-service-sections.spec.js +0 -204
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.d.ts +0 -1
- package/dist/tests/unit/core/infer-data-flow-protocol.spec.js +0 -37
- package/dist/tests/unit/core/manifest-package-hub.spec.d.ts +0 -1
- package/dist/tests/unit/core/manifest-package-hub.spec.js +0 -53
- package/dist/tests/unit/core/monorepo-package-sections.spec.d.ts +0 -1
- package/dist/tests/unit/core/monorepo-package-sections.spec.js +0 -121
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.d.ts +0 -1
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.js +0 -54
- package/dist/tests/unit/core/section-discovery-excludes.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-discovery-excludes.spec.js +0 -49
- package/dist/tests/unit/core/section-runtime.spec.d.ts +0 -1
- package/dist/tests/unit/core/section-runtime.spec.js +0 -166
- package/dist/tests/unit/core/stable-component-ids.spec.d.ts +0 -1
- package/dist/tests/unit/core/stable-component-ids.spec.js +0 -112
- package/dist/tests/unit/core/structural-scan.spec.d.ts +0 -1
- package/dist/tests/unit/core/structural-scan.spec.js +0 -83
- package/dist/tests/unit/core/terraform-minimal-services.spec.d.ts +0 -1
- package/dist/tests/unit/core/terraform-minimal-services.spec.js +0 -378
- package/dist/tests/unit/data-flow/application-hub.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/application-hub.spec.js +0 -48
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.js +0 -95
- package/dist/tests/unit/data-flow/dedupe.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/dedupe.spec.js +0 -134
- package/dist/tests/unit/data-flow/detector.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/detector.spec.js +0 -1254
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.js +0 -132
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.js +0 -233
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.js +0 -125
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.js +0 -40
- package/dist/tests/unit/data-flow/postprocess.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/postprocess.spec.js +0 -78
- package/dist/tests/unit/data-flow/rewire.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/rewire.spec.js +0 -194
- package/dist/tests/unit/data-flow/terraform-flows.spec.d.ts +0 -1
- package/dist/tests/unit/data-flow/terraform-flows.spec.js +0 -199
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/cpp-dotnet-languages.spec.js +0 -56
- package/dist/tests/unit/ingest/env-exclusion.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/env-exclusion.spec.js +0 -43
- package/dist/tests/unit/ingest/file-system.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/file-system.spec.js +0 -180
- package/dist/tests/unit/ingest/gitignore.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/gitignore.spec.js +0 -30
- package/dist/tests/unit/ingest/jvm-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/jvm-languages.spec.js +0 -47
- package/dist/tests/unit/ingest/php-languages.spec.d.ts +0 -1
- package/dist/tests/unit/ingest/php-languages.spec.js +0 -40
- package/dist/tests/unit/patterns/scan-exclusions.spec.d.ts +0 -1
- package/dist/tests/unit/patterns/scan-exclusions.spec.js +0 -58
- package/patterns/README.md +0 -322
- package/patterns/actor.patterns.yaml +0 -51
- package/patterns/aws-terraform-catalog.snapshot.json +0 -1760
- package/patterns/aws-terraform-service-hints.generated.json +0 -1446
- package/patterns/azure-terraform-catalog.snapshot.json +0 -1195
- package/patterns/azure-terraform-service-hints.generated.json +0 -864
- package/patterns/classifier/actors.classifier.yaml +0 -17
- package/patterns/classifier/components.classifier.yaml +0 -110
- package/patterns/classifier/third-party.classifier.yaml +0 -169
- package/patterns/cpp.md +0 -176
- package/patterns/cpp.patterns.yaml +0 -314
- package/patterns/csharp.md +0 -211
- package/patterns/csharp.patterns.yaml +0 -375
- package/patterns/go.md +0 -211
- package/patterns/go.patterns.yaml +0 -429
- package/patterns/jvm.md +0 -160
- package/patterns/jvm.patterns.yaml +0 -884
- package/patterns/kubernetes-terraform-catalog.snapshot.json +0 -94
- package/patterns/kubernetes-terraform-service-hints.generated.json +0 -258
- package/patterns/non-pii-signals.rules.yaml +0 -84
- package/patterns/php.md +0 -74
- package/patterns/php.patterns.yaml +0 -311
- package/patterns/pii-signals.rules.yaml +0 -115
- package/patterns/property.patterns.yaml +0 -431
- package/patterns/provider-topology.rules.yaml +0 -765
- package/patterns/python.md +0 -211
- package/patterns/python.patterns.yaml +0 -337
- package/patterns/terraform.md +0 -37
- package/patterns/terraform.patterns.yaml +0 -495
- package/patterns/third-party.patterns.yaml +0 -182
- package/patterns/typescript.patterns.yaml +0 -361
- /package/dist/{src/classifier/grouping.d.ts → tests/unit/ai-enrichment/red-flags.spec.d.ts} +0 -0
- /package/dist/tests/{fixtures/e2e-ts-sentry-route-env/server.d.ts → unit/cli/scan-command-e2e-backend-lambda-orphan.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/dependency-manifests.spec.d.ts → cli/scan-command-e2e-occupied-section-hubs.spec.d.ts} +0 -0
- /package/dist/tests/unit/{analyzers/cpp/parser.spec.d.ts → cli/scan-command-e2e-ruby-basic.spec.d.ts} +0 -0
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.inferTerraformStackSectionPathDepth = inferTerraformStackSectionPathDepth;
|
|
7
|
-
exports.inferMonorepoPackageSectionPathDepth = inferMonorepoPackageSectionPathDepth;
|
|
8
|
-
exports.rollupSectionIdToMonorepoDepth = rollupSectionIdToMonorepoDepth;
|
|
9
|
-
exports.discoverServiceSections = discoverServiceSections;
|
|
10
|
-
exports.tagFindingsWithServiceSections = tagFindingsWithServiceSections;
|
|
11
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const gitignore_1 = require("../../ingest/gitignore");
|
|
14
|
-
const scan_exclusions_1 = require("../../patterns/scan-exclusions");
|
|
15
|
-
function patternToRegex(pattern) {
|
|
16
|
-
let escaped = pattern.replace(/[-\\^$+?.()|[\]{}*?]/g, "\\$&");
|
|
17
|
-
escaped = escaped.replace(/\\\*\\\*/g, ".*");
|
|
18
|
-
escaped = escaped.replace(/\\\*/g, "[^/]*");
|
|
19
|
-
escaped = escaped.replace(/\\\?/g, "[^/]");
|
|
20
|
-
return new RegExp(`^${escaped}$`);
|
|
21
|
-
}
|
|
22
|
-
function normalizeUserPattern(pattern) {
|
|
23
|
-
return (0, gitignore_1.toPosixPath)(pattern.replace(/^\.\/+/, "").trim());
|
|
24
|
-
}
|
|
25
|
-
function isExcludedByUserPatterns(relativePath, excludePaths) {
|
|
26
|
-
const rel = (0, gitignore_1.toPosixPath)(relativePath);
|
|
27
|
-
for (const rawPattern of excludePaths) {
|
|
28
|
-
const pattern = normalizeUserPattern(rawPattern);
|
|
29
|
-
if (!pattern)
|
|
30
|
-
continue;
|
|
31
|
-
if (pattern.endsWith("/**")) {
|
|
32
|
-
const prefix = pattern.slice(0, -3).replace(/\/$/, "");
|
|
33
|
-
if (rel === prefix || rel.startsWith(`${prefix}/`))
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
if (patternToRegex(pattern).test(rel))
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
async function walkForManifests(currentDirAbs, rootDirAbs, excludePaths, accumulatedGitignoreRules, onManifestRelPath) {
|
|
42
|
-
const gitignoreRules = await (0, gitignore_1.gitignoreRulesForDir)(currentDirAbs, accumulatedGitignoreRules);
|
|
43
|
-
let entries;
|
|
44
|
-
try {
|
|
45
|
-
entries = await promises_1.default.readdir(currentDirAbs, { withFileTypes: true });
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
for (const entry of entries) {
|
|
51
|
-
const entryPathAbs = path_1.default.join(currentDirAbs, entry.name);
|
|
52
|
-
const entryRelPosix = (0, gitignore_1.toPosixPath)(path_1.default.relative(rootDirAbs, entryPathAbs));
|
|
53
|
-
if (entry.isDirectory()) {
|
|
54
|
-
if ((0, scan_exclusions_1.shouldSkipDirectoryName)(entry.name))
|
|
55
|
-
continue;
|
|
56
|
-
if (entryRelPosix &&
|
|
57
|
-
isExcludedByUserPatterns(entryRelPosix, excludePaths)) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if ((0, gitignore_1.isPathIgnored)(entryPathAbs, true, gitignoreRules)) {
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
await walkForManifests(entryPathAbs, rootDirAbs, excludePaths, gitignoreRules, onManifestRelPath);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
if (!entry.isFile())
|
|
67
|
-
continue;
|
|
68
|
-
if ((0, gitignore_1.isPathIgnored)(entryPathAbs, false, gitignoreRules)) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
const name = entry.name;
|
|
72
|
-
const lower = name.toLowerCase();
|
|
73
|
-
const isTsManifest = lower === "package.json";
|
|
74
|
-
const isRequirements = lower.startsWith("requirements") && lower.endsWith(".txt");
|
|
75
|
-
const isPyproject = lower === "pyproject.toml";
|
|
76
|
-
const isPipfile = lower === "pipfile";
|
|
77
|
-
const isDotnetProject = lower.endsWith(".csproj") ||
|
|
78
|
-
lower.endsWith(".fsproj") ||
|
|
79
|
-
lower.endsWith(".vbproj");
|
|
80
|
-
// `CMakeLists.txt` is deliberately excluded: C++ projects place one in
|
|
81
|
-
// nearly every subdirectory, which would shatter the graph into sections.
|
|
82
|
-
// go.mod is the canonical Go module root, so it maps exactly onto a
|
|
83
|
-
// service boundary in a multi-module repository.
|
|
84
|
-
const isGoModule = lower === "go.mod";
|
|
85
|
-
// composer.json is the Composer package root for PHP services.
|
|
86
|
-
const isComposerManifest = lower === "composer.json";
|
|
87
|
-
// Maven and Gradle both place a build file at each module root, and on the
|
|
88
|
-
// JVM a module is the deployable unit — unlike `CMakeLists.txt`, one build
|
|
89
|
-
// file per directory *is* the service boundary. `settings.gradle` marks the
|
|
90
|
-
// root of a multi-project build rather than a module, so it is not a
|
|
91
|
-
// marker; the root's own `build.gradle` already covers that directory.
|
|
92
|
-
const isJvmManifest = lower === "pom.xml" ||
|
|
93
|
-
lower === "build.gradle" ||
|
|
94
|
-
lower === "build.gradle.kts";
|
|
95
|
-
const isCppManifest = lower === "vcpkg.json" ||
|
|
96
|
-
lower === "conanfile.txt" ||
|
|
97
|
-
lower === "conanfile.py";
|
|
98
|
-
if (!isTsManifest &&
|
|
99
|
-
!isRequirements &&
|
|
100
|
-
!isPyproject &&
|
|
101
|
-
!isPipfile &&
|
|
102
|
-
!isDotnetProject &&
|
|
103
|
-
!isGoModule &&
|
|
104
|
-
!isComposerManifest &&
|
|
105
|
-
!isJvmManifest &&
|
|
106
|
-
!isCppManifest) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
const manifestRel = path_1.default.relative(rootDirAbs, entryPathAbs);
|
|
110
|
-
if (manifestRel.startsWith("..") || path_1.default.isAbsolute(manifestRel))
|
|
111
|
-
continue;
|
|
112
|
-
if (isExcludedByUserPatterns((0, gitignore_1.toPosixPath)(manifestRel), excludePaths)) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
onManifestRelPath((0, gitignore_1.toPosixPath)(manifestRel));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* True for Terraform HCL module files in a directory (any `*.tf`).
|
|
120
|
-
* Excludes `.tf.json` (Terraform JSON syntax). Does not treat `.tfvars` as a
|
|
121
|
-
* module root marker — those files use a different suffix.
|
|
122
|
-
*/
|
|
123
|
-
function isTerraformConfigFileName(fileName) {
|
|
124
|
-
const lower = fileName.toLowerCase();
|
|
125
|
-
if (!lower.endsWith(".tf"))
|
|
126
|
-
return false;
|
|
127
|
-
if (lower.endsWith(".tf.json"))
|
|
128
|
-
return false;
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
async function walkForTerraformConfigFiles(currentDirAbs, rootDirAbs, excludePaths, accumulatedGitignoreRules, onTerraformConfigRelPosix) {
|
|
132
|
-
const gitignoreRules = await (0, gitignore_1.gitignoreRulesForDir)(currentDirAbs, accumulatedGitignoreRules);
|
|
133
|
-
let entries;
|
|
134
|
-
try {
|
|
135
|
-
entries = await promises_1.default.readdir(currentDirAbs, { withFileTypes: true });
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
for (const entry of entries) {
|
|
141
|
-
const entryPathAbs = path_1.default.join(currentDirAbs, entry.name);
|
|
142
|
-
const entryRelPosix = (0, gitignore_1.toPosixPath)(path_1.default.relative(rootDirAbs, entryPathAbs));
|
|
143
|
-
if (entry.isDirectory()) {
|
|
144
|
-
if ((0, scan_exclusions_1.shouldSkipDirectoryName)(entry.name))
|
|
145
|
-
continue;
|
|
146
|
-
if (entryRelPosix &&
|
|
147
|
-
isExcludedByUserPatterns(entryRelPosix, excludePaths)) {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
if ((0, gitignore_1.isPathIgnored)(entryPathAbs, true, gitignoreRules)) {
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
await walkForTerraformConfigFiles(entryPathAbs, rootDirAbs, excludePaths, gitignoreRules, onTerraformConfigRelPosix);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (!entry.isFile())
|
|
157
|
-
continue;
|
|
158
|
-
if ((0, gitignore_1.isPathIgnored)(entryPathAbs, false, gitignoreRules)) {
|
|
159
|
-
continue;
|
|
160
|
-
}
|
|
161
|
-
if (!isTerraformConfigFileName(entry.name))
|
|
162
|
-
continue;
|
|
163
|
-
const manifestRel = path_1.default.relative(rootDirAbs, entryPathAbs);
|
|
164
|
-
if (manifestRel.startsWith("..") || path_1.default.isAbsolute(manifestRel))
|
|
165
|
-
continue;
|
|
166
|
-
const relPosix = (0, gitignore_1.toPosixPath)(manifestRel);
|
|
167
|
-
if (isExcludedByUserPatterns(relPosix, excludePaths))
|
|
168
|
-
continue;
|
|
169
|
-
onTerraformConfigRelPosix(relPosix);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
function sectionKeyFromDir(sectionDirPosix) {
|
|
173
|
-
// dirname('package.json') === '.' in POSIX; treat it as scan-root.
|
|
174
|
-
if (!sectionDirPosix || sectionDirPosix === ".")
|
|
175
|
-
return "root";
|
|
176
|
-
return sectionDirPosix;
|
|
177
|
-
}
|
|
178
|
-
function labelFromPackageName(packageName, fallbackBasename) {
|
|
179
|
-
const trimmed = packageName.trim();
|
|
180
|
-
if (!trimmed)
|
|
181
|
-
return fallbackBasename;
|
|
182
|
-
const slash = trimmed.lastIndexOf("/");
|
|
183
|
-
const base = slash >= 0 ? trimmed.slice(slash + 1) : trimmed;
|
|
184
|
-
const withoutScope = base.replace(/^@/, "").trim();
|
|
185
|
-
return withoutScope || fallbackBasename;
|
|
186
|
-
}
|
|
187
|
-
function labelFromSectionDir(sectionDirPosix, packageName) {
|
|
188
|
-
const key = sectionKeyFromDir(sectionDirPosix);
|
|
189
|
-
if (key === "root")
|
|
190
|
-
return "root";
|
|
191
|
-
const basename = path_1.default.posix.basename(sectionDirPosix);
|
|
192
|
-
if (packageName)
|
|
193
|
-
return labelFromPackageName(packageName, basename);
|
|
194
|
-
return basename;
|
|
195
|
-
}
|
|
196
|
-
async function readPackageJsonName(manifestAbsPath) {
|
|
197
|
-
try {
|
|
198
|
-
const raw = await promises_1.default.readFile(manifestAbsPath, "utf8");
|
|
199
|
-
const parsed = JSON.parse(raw);
|
|
200
|
-
if (typeof parsed.name === "string" && parsed.name.trim()) {
|
|
201
|
-
return parsed.name.trim();
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
catch {
|
|
205
|
-
// ignore unreadable or invalid package.json
|
|
206
|
-
}
|
|
207
|
-
return undefined;
|
|
208
|
-
}
|
|
209
|
-
function sectionHasPackageManifest(manifestPaths) {
|
|
210
|
-
return manifestPaths.some((p) => path_1.default.posix.basename(p) === "package.json");
|
|
211
|
-
}
|
|
212
|
-
function manifestPathIsTerraformConfig(manifestRelPosix) {
|
|
213
|
-
return isTerraformConfigFileName(path_1.default.posix.basename(manifestRelPosix));
|
|
214
|
-
}
|
|
215
|
-
/** True when `manifestPaths` are exclusively `*.tf` files (no app manifests). */
|
|
216
|
-
function sectionIsTerraformOnlyStack(manifestPaths) {
|
|
217
|
-
if (manifestPaths.length === 0)
|
|
218
|
-
return false;
|
|
219
|
-
if (sectionHasPackageManifest(manifestPaths))
|
|
220
|
-
return false;
|
|
221
|
-
return manifestPaths.every(manifestPathIsTerraformConfig);
|
|
222
|
-
}
|
|
223
|
-
function roleFromSectionDir(sectionDirPosix) {
|
|
224
|
-
const key = sectionKeyFromDir(sectionDirPosix);
|
|
225
|
-
return key === "root" ? "root" : "service";
|
|
226
|
-
}
|
|
227
|
-
function registerTerraformStackSections(bySectionDir, tfConfigRelPaths, tfDepth, excludePaths) {
|
|
228
|
-
for (const tfConfigRelPosix of tfConfigRelPaths) {
|
|
229
|
-
const dir = path_1.default.posix.dirname(tfConfigRelPosix);
|
|
230
|
-
const sectionDir = dir === "." ? "" : dir;
|
|
231
|
-
if (!sectionDir)
|
|
232
|
-
continue;
|
|
233
|
-
const segmentCount = sectionDir.split("/").length;
|
|
234
|
-
if (segmentCount !== tfDepth)
|
|
235
|
-
continue;
|
|
236
|
-
if (isExcludedByUserPatterns(sectionDir, excludePaths))
|
|
237
|
-
continue;
|
|
238
|
-
const existing = bySectionDir.get(sectionDir);
|
|
239
|
-
if (existing) {
|
|
240
|
-
if (!existing.manifestPaths.includes(tfConfigRelPosix)) {
|
|
241
|
-
existing.manifestPaths.push(tfConfigRelPosix);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
bySectionDir.set(sectionDir, { manifestPaths: [tfConfigRelPosix] });
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Pick path depth `N` where the most Terraform stack directories live.
|
|
251
|
-
* Prefers directories that contain `main.tf`; falls back to any `*.tf` directory.
|
|
252
|
-
* Tie-break: deeper `N` (more specific stack roots).
|
|
253
|
-
*/
|
|
254
|
-
function inferTerraformStackSectionPathDepth(tfConfigRelPaths) {
|
|
255
|
-
const mainTfDirs = new Set();
|
|
256
|
-
const anyTfDirs = new Set();
|
|
257
|
-
for (const rel of tfConfigRelPaths) {
|
|
258
|
-
const dir = path_1.default.posix.dirname(rel);
|
|
259
|
-
if (!dir || dir === ".")
|
|
260
|
-
continue;
|
|
261
|
-
anyTfDirs.add(dir);
|
|
262
|
-
if (path_1.default.posix.basename(rel).toLowerCase() === "main.tf") {
|
|
263
|
-
mainTfDirs.add(dir);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
const stackDirs = mainTfDirs.size > 0 ? mainTfDirs : anyTfDirs;
|
|
267
|
-
if (stackDirs.size === 0)
|
|
268
|
-
return undefined;
|
|
269
|
-
const depthCounts = new Map();
|
|
270
|
-
for (const dir of stackDirs) {
|
|
271
|
-
const depth = dir.split("/").length;
|
|
272
|
-
depthCounts.set(depth, (depthCounts.get(depth) ?? 0) + 1);
|
|
273
|
-
}
|
|
274
|
-
let bestDepth;
|
|
275
|
-
let bestCount = 0;
|
|
276
|
-
for (const [depth, count] of depthCounts) {
|
|
277
|
-
if (count > bestCount ||
|
|
278
|
-
(count === bestCount &&
|
|
279
|
-
bestDepth != null &&
|
|
280
|
-
depth > bestDepth)) {
|
|
281
|
-
bestCount = count;
|
|
282
|
-
bestDepth = depth;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return bestDepth;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Pick workspace package depth: shallowest path depth with at least two
|
|
289
|
-
* `package.json` directories (typical `packages/*` monorepo layout).
|
|
290
|
-
*/
|
|
291
|
-
function inferMonorepoPackageSectionPathDepth(packageJsonRelPaths) {
|
|
292
|
-
const dirs = new Set();
|
|
293
|
-
for (const rel of packageJsonRelPaths) {
|
|
294
|
-
const dir = path_1.default.posix.dirname(rel);
|
|
295
|
-
if (!dir || dir === ".")
|
|
296
|
-
continue;
|
|
297
|
-
dirs.add(dir);
|
|
298
|
-
}
|
|
299
|
-
if (dirs.size < 2)
|
|
300
|
-
return undefined;
|
|
301
|
-
const depthCounts = new Map();
|
|
302
|
-
for (const dir of dirs) {
|
|
303
|
-
const depth = dir.split("/").length;
|
|
304
|
-
depthCounts.set(depth, (depthCounts.get(depth) ?? 0) + 1);
|
|
305
|
-
}
|
|
306
|
-
let bestDepth;
|
|
307
|
-
let bestCount = 0;
|
|
308
|
-
for (const [depth, count] of depthCounts) {
|
|
309
|
-
if (count < 2)
|
|
310
|
-
continue;
|
|
311
|
-
if (count > bestCount ||
|
|
312
|
-
(count === bestCount && bestDepth != null && depth < bestDepth)) {
|
|
313
|
-
bestCount = count;
|
|
314
|
-
bestDepth = depth;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return bestDepth;
|
|
318
|
-
}
|
|
319
|
-
function rollupSectionIdToMonorepoDepth(sectionId, depth) {
|
|
320
|
-
if (sectionId === "root" || !sectionId.includes("/"))
|
|
321
|
-
return sectionId;
|
|
322
|
-
const segments = sectionId.split("/");
|
|
323
|
-
if (segments.length <= depth)
|
|
324
|
-
return sectionId;
|
|
325
|
-
return segments.slice(0, depth).join("/");
|
|
326
|
-
}
|
|
327
|
-
function ensureMonorepoParentPackageSections(bySectionDir, monorepoDepth) {
|
|
328
|
-
for (const sectionDir of [...bySectionDir.keys()]) {
|
|
329
|
-
if (!sectionDir)
|
|
330
|
-
continue;
|
|
331
|
-
const segments = sectionDir.split("/");
|
|
332
|
-
if (segments.length <= monorepoDepth)
|
|
333
|
-
continue;
|
|
334
|
-
const parentDir = segments.slice(0, monorepoDepth).join("/");
|
|
335
|
-
if (!bySectionDir.has(parentDir)) {
|
|
336
|
-
bySectionDir.set(parentDir, { manifestPaths: [] });
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
function markPrimaryMonorepoPackageSections(sections, monorepoDepth) {
|
|
341
|
-
if (monorepoDepth == null)
|
|
342
|
-
return;
|
|
343
|
-
for (const section of sections) {
|
|
344
|
-
if (section.role !== "service" || !section.sectionDir)
|
|
345
|
-
continue;
|
|
346
|
-
section.isPrimaryMonorepoPackage =
|
|
347
|
-
section.sectionDir.split("/").length === monorepoDepth;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
async function discoverServiceSections(rootPath, opts = {}) {
|
|
351
|
-
const rootDirAbs = path_1.default.resolve(rootPath);
|
|
352
|
-
const excludePaths = opts.excludePaths ?? [];
|
|
353
|
-
// Keyed by directory (relative to root). Root uses ''.
|
|
354
|
-
const bySectionDir = new Map();
|
|
355
|
-
const packageJsonRelPaths = [];
|
|
356
|
-
await walkForManifests(rootDirAbs, rootDirAbs, excludePaths, [], (manifestRelPosix) => {
|
|
357
|
-
const dir = path_1.default.posix.dirname(manifestRelPosix);
|
|
358
|
-
const sectionDir = dir === "." ? "" : dir;
|
|
359
|
-
const isPackageJson = path_1.default.posix.basename(manifestRelPosix) === "package.json";
|
|
360
|
-
if (isPackageJson)
|
|
361
|
-
packageJsonRelPaths.push(manifestRelPosix);
|
|
362
|
-
const entry = bySectionDir.get(sectionDir);
|
|
363
|
-
if (entry) {
|
|
364
|
-
entry.manifestPaths.push(manifestRelPosix);
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
bySectionDir.set(sectionDir, { manifestPaths: [manifestRelPosix] });
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
for (const manifestRelPosix of packageJsonRelPaths) {
|
|
371
|
-
const dir = path_1.default.posix.dirname(manifestRelPosix);
|
|
372
|
-
const sectionDir = dir === "." ? "" : dir;
|
|
373
|
-
const entry = bySectionDir.get(sectionDir);
|
|
374
|
-
if (!entry)
|
|
375
|
-
continue;
|
|
376
|
-
const packageName = await readPackageJsonName(path_1.default.join(rootDirAbs, manifestRelPosix));
|
|
377
|
-
if (packageName)
|
|
378
|
-
entry.packageName = packageName;
|
|
379
|
-
}
|
|
380
|
-
let monorepoDepth = opts.monorepoPackageSectionPathDepth;
|
|
381
|
-
let inferredMonorepoPackageSectionPathDepth;
|
|
382
|
-
const autoInferMonorepo = opts.autoInferMonorepoPackageSectionPathDepth !== false;
|
|
383
|
-
if (monorepoDepth == null &&
|
|
384
|
-
autoInferMonorepo &&
|
|
385
|
-
packageJsonRelPaths.length >= 2) {
|
|
386
|
-
const inferred = inferMonorepoPackageSectionPathDepth(packageJsonRelPaths);
|
|
387
|
-
if (inferred != null && inferred > 0) {
|
|
388
|
-
monorepoDepth = inferred;
|
|
389
|
-
inferredMonorepoPackageSectionPathDepth = inferred;
|
|
390
|
-
ensureMonorepoParentPackageSections(bySectionDir, monorepoDepth);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
else if (typeof monorepoDepth === "number" &&
|
|
394
|
-
Number.isInteger(monorepoDepth) &&
|
|
395
|
-
monorepoDepth > 0) {
|
|
396
|
-
ensureMonorepoParentPackageSections(bySectionDir, monorepoDepth);
|
|
397
|
-
}
|
|
398
|
-
const tfConfigRelPaths = [];
|
|
399
|
-
await walkForTerraformConfigFiles(rootDirAbs, rootDirAbs, excludePaths, [], (rel) => tfConfigRelPaths.push(rel));
|
|
400
|
-
let tfDepth = opts.terraformStackSectionPathDepth;
|
|
401
|
-
let inferredTerraformStackSectionPathDepth;
|
|
402
|
-
const autoInfer = opts.autoInferTerraformStackSectionPathDepth !== false;
|
|
403
|
-
if (tfDepth == null &&
|
|
404
|
-
autoInfer &&
|
|
405
|
-
tfConfigRelPaths.length > 0) {
|
|
406
|
-
const inferred = inferTerraformStackSectionPathDepth(tfConfigRelPaths);
|
|
407
|
-
if (inferred != null && inferred > 0) {
|
|
408
|
-
tfDepth = inferred;
|
|
409
|
-
inferredTerraformStackSectionPathDepth = inferred;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
if (typeof tfDepth === "number" &&
|
|
413
|
-
Number.isInteger(tfDepth) &&
|
|
414
|
-
tfDepth > 0) {
|
|
415
|
-
registerTerraformStackSections(bySectionDir, tfConfigRelPaths, tfDepth, excludePaths);
|
|
416
|
-
}
|
|
417
|
-
// Always include a fallback section to avoid "no section_id" surprises.
|
|
418
|
-
if (!bySectionDir.has(""))
|
|
419
|
-
bySectionDir.set("", { manifestPaths: [] });
|
|
420
|
-
const sections = Array.from(bySectionDir.entries())
|
|
421
|
-
.map(([sectionDir, v]) => {
|
|
422
|
-
const id = sectionKeyFromDir(sectionDir);
|
|
423
|
-
const isTerraformStack = sectionIsTerraformOnlyStack(v.manifestPaths);
|
|
424
|
-
return {
|
|
425
|
-
id,
|
|
426
|
-
label: labelFromSectionDir(sectionDir, v.packageName),
|
|
427
|
-
role: roleFromSectionDir(sectionDir),
|
|
428
|
-
sectionDir,
|
|
429
|
-
manifestPaths: v.manifestPaths.sort((a, b) => a.localeCompare(b)),
|
|
430
|
-
packageName: v.packageName,
|
|
431
|
-
...(isTerraformStack ? { isTerraformStack: true } : {}),
|
|
432
|
-
};
|
|
433
|
-
})
|
|
434
|
-
.sort((a, b) => a.id.localeCompare(b.id));
|
|
435
|
-
markPrimaryMonorepoPackageSections(sections, monorepoDepth);
|
|
436
|
-
return {
|
|
437
|
-
sections,
|
|
438
|
-
inferredTerraformStackSectionPathDepth,
|
|
439
|
-
inferredMonorepoPackageSectionPathDepth,
|
|
440
|
-
monorepoPackageSectionPathDepth: monorepoDepth,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
function findNearestSectionForFile(filePathRelPosix, sections) {
|
|
444
|
-
// Longest prefix match on section directory.
|
|
445
|
-
let best;
|
|
446
|
-
let bestLen = -1;
|
|
447
|
-
for (const s of sections) {
|
|
448
|
-
if (!s.sectionDir)
|
|
449
|
-
continue; // root handled as fallback
|
|
450
|
-
if (filePathRelPosix === s.sectionDir ||
|
|
451
|
-
filePathRelPosix.startsWith(`${s.sectionDir}/`)) {
|
|
452
|
-
if (s.sectionDir.length > bestLen) {
|
|
453
|
-
best = s;
|
|
454
|
-
bestLen = s.sectionDir.length;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return best ?? sections.find((s) => s.id === "root") ?? sections[0];
|
|
459
|
-
}
|
|
460
|
-
function resolveSectionForFinding(filePathRelPosix, sections, monorepoRollupDepth) {
|
|
461
|
-
const section = findNearestSectionForFile(filePathRelPosix, sections);
|
|
462
|
-
if (monorepoRollupDepth == null ||
|
|
463
|
-
!section.sectionDir ||
|
|
464
|
-
!sectionHasPackageManifest(section.manifestPaths)) {
|
|
465
|
-
return section;
|
|
466
|
-
}
|
|
467
|
-
const segmentCount = section.sectionDir.split("/").length;
|
|
468
|
-
if (segmentCount <= monorepoRollupDepth)
|
|
469
|
-
return section;
|
|
470
|
-
const rolledId = rollupSectionIdToMonorepoDepth(section.id, monorepoRollupDepth);
|
|
471
|
-
const rolled = sections.find((s) => s.id === rolledId);
|
|
472
|
-
if (rolled)
|
|
473
|
-
return rolled;
|
|
474
|
-
return {
|
|
475
|
-
...section,
|
|
476
|
-
id: rolledId,
|
|
477
|
-
label: path_1.default.posix.basename(rolledId),
|
|
478
|
-
sectionDir: rolledId,
|
|
479
|
-
isPrimaryMonorepoPackage: true,
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
|
-
function tagFindingsWithServiceSections(findings, sections, opts) {
|
|
483
|
-
if (!findings.length)
|
|
484
|
-
return;
|
|
485
|
-
const monorepoRollupDepth = opts?.monorepoPackageSectionPathDepth;
|
|
486
|
-
for (const finding of findings) {
|
|
487
|
-
const filePathRelPosix = (0, gitignore_1.toPosixPath)(finding.location.filePath);
|
|
488
|
-
const section = resolveSectionForFinding(filePathRelPosix, sections, monorepoRollupDepth);
|
|
489
|
-
// Thread through classification via component.properties.
|
|
490
|
-
finding.properties.section_id = section.id;
|
|
491
|
-
finding.properties.section_label = section.label;
|
|
492
|
-
finding.properties.section_role = section.role;
|
|
493
|
-
if (section.packageName) {
|
|
494
|
-
finding.properties.package_name = section.packageName;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { DetectedComponent } from "../types/component";
|
|
2
|
-
import type { ServiceSection } from "./discover-service-sections";
|
|
3
|
-
/** True when this section discovered a `package.json` under `sectionDir`. */
|
|
4
|
-
export declare function sectionHasPackageJsonManifest(section: Pick<ServiceSection, "manifestPaths">): boolean;
|
|
5
|
-
/** Generator templates / placeholder manifests (not deployable workspace apps). */
|
|
6
|
-
export declare function isScaffoldOrTemplatePackageSection(section: Pick<ServiceSection, "id" | "packageName" | "sectionDir">): boolean;
|
|
7
|
-
/** At least one classified component is scoped to this section. */
|
|
8
|
-
export declare function sectionHasClassifiedComponents(components: DetectedComponent[], sectionId: string): boolean;
|
|
9
|
-
export declare function isConcreteServiceSectionId(sectionId: string | undefined): boolean;
|
|
10
|
-
export { TERRAFORM_DETECTED_FROM_PATTERNS, } from "../terraform/component-predicates";
|
|
11
|
-
/** Classified from Terraform analysis (HCL or show-json), not application source code. */
|
|
12
|
-
export declare function isTerraformDerivedComponent(component: DetectedComponent): boolean;
|
|
13
|
-
/** Section created for a Terraform stack root or module directory. */
|
|
14
|
-
export declare function isTerraformStackSection(section: Pick<ServiceSection, "id" | "sectionDir" | "isTerraformStack">): boolean;
|
|
15
|
-
export declare function sectionHasRuntimeCodeComponents(components: DetectedComponent[], sectionId: string): boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Whether a workspace section should receive a synthetic application hub and
|
|
18
|
-
* default User actor (tooling-only packages like cli/docs/utils are skipped).
|
|
19
|
-
*/
|
|
20
|
-
export declare function sectionQualifiesForSyntheticApplication(section: ServiceSection, components: DetectedComponent[]): boolean;
|
|
21
|
-
export declare function shouldInjectUserActorForMainApp(mainApp: DetectedComponent, components: DetectedComponent[]): boolean;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TERRAFORM_DETECTED_FROM_PATTERNS = void 0;
|
|
4
|
-
exports.sectionHasPackageJsonManifest = sectionHasPackageJsonManifest;
|
|
5
|
-
exports.isScaffoldOrTemplatePackageSection = isScaffoldOrTemplatePackageSection;
|
|
6
|
-
exports.sectionHasClassifiedComponents = sectionHasClassifiedComponents;
|
|
7
|
-
exports.isConcreteServiceSectionId = isConcreteServiceSectionId;
|
|
8
|
-
exports.isTerraformDerivedComponent = isTerraformDerivedComponent;
|
|
9
|
-
exports.isTerraformStackSection = isTerraformStackSection;
|
|
10
|
-
exports.sectionHasRuntimeCodeComponents = sectionHasRuntimeCodeComponents;
|
|
11
|
-
exports.sectionQualifiesForSyntheticApplication = sectionQualifiesForSyntheticApplication;
|
|
12
|
-
exports.shouldInjectUserActorForMainApp = shouldInjectUserActorForMainApp;
|
|
13
|
-
const sectioning_1 = require("../../classifier/sectioning");
|
|
14
|
-
const MANIFEST_ONLY_PATH_SUFFIXES = [
|
|
15
|
-
"package.json",
|
|
16
|
-
"pyproject.toml",
|
|
17
|
-
"pipfile",
|
|
18
|
-
"requirements.txt",
|
|
19
|
-
];
|
|
20
|
-
/** True when this section discovered a `package.json` under `sectionDir`. */
|
|
21
|
-
function sectionHasPackageJsonManifest(section) {
|
|
22
|
-
return section.manifestPaths.some((p) => p.replace(/\\/g, "/").split("/").pop()?.toLowerCase() === "package.json");
|
|
23
|
-
}
|
|
24
|
-
const GENERATOR_TEMPLATE_DIR_SEGMENTS = new Set([
|
|
25
|
-
"template",
|
|
26
|
-
"templates",
|
|
27
|
-
"scaffold",
|
|
28
|
-
"boilerplate",
|
|
29
|
-
]);
|
|
30
|
-
function sectionPathHasGeneratorTemplateLayout(sectionDir) {
|
|
31
|
-
const parts = sectionDir.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
32
|
-
return parts.some((p) => GENERATOR_TEMPLATE_DIR_SEGMENTS.has(p.toLowerCase()));
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Placeholder `package.json` names are often SHOUTING_CASE with multiple segments
|
|
36
|
-
*/
|
|
37
|
-
function packageNameLooksLikePlaceholderToken(packageName) {
|
|
38
|
-
const raw = packageName.trim();
|
|
39
|
-
if (!raw)
|
|
40
|
-
return false;
|
|
41
|
-
const base = raw.includes("/") ? (raw.split("/").pop() ?? raw) : raw;
|
|
42
|
-
const unscoped = base.replace(/^@[^/]+\//, "").replace(/^@/, "");
|
|
43
|
-
if (/[a-z]/.test(unscoped))
|
|
44
|
-
return false;
|
|
45
|
-
if (!/^[A-Z0-9][A-Z0-9_-]*$/.test(unscoped))
|
|
46
|
-
return false;
|
|
47
|
-
return unscoped.split(/[-_]/).filter((p) => p.length > 0).length >= 2;
|
|
48
|
-
}
|
|
49
|
-
/** Generator templates / placeholder manifests (not deployable workspace apps). */
|
|
50
|
-
function isScaffoldOrTemplatePackageSection(section) {
|
|
51
|
-
const dir = section.sectionDir || section.id;
|
|
52
|
-
if (sectionPathHasGeneratorTemplateLayout(dir))
|
|
53
|
-
return true;
|
|
54
|
-
const pkg = section.packageName?.trim() ?? "";
|
|
55
|
-
return pkg.length > 0 && packageNameLooksLikePlaceholderToken(pkg);
|
|
56
|
-
}
|
|
57
|
-
/** At least one classified component is scoped to this section. */
|
|
58
|
-
function sectionHasClassifiedComponents(components, sectionId) {
|
|
59
|
-
for (const component of components) {
|
|
60
|
-
if ((0, sectioning_1.getSectionIdFromProperties)(component.properties) === sectionId) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
function isConcreteServiceSectionId(sectionId) {
|
|
67
|
-
if (!sectionId?.trim())
|
|
68
|
-
return false;
|
|
69
|
-
const id = sectionId.trim();
|
|
70
|
-
return id !== "root" && id !== "global" && id !== "<unsectioned>";
|
|
71
|
-
}
|
|
72
|
-
var component_predicates_1 = require("../terraform/component-predicates");
|
|
73
|
-
Object.defineProperty(exports, "TERRAFORM_DETECTED_FROM_PATTERNS", { enumerable: true, get: function () { return component_predicates_1.TERRAFORM_DETECTED_FROM_PATTERNS; } });
|
|
74
|
-
const component_predicates_2 = require("../terraform/component-predicates");
|
|
75
|
-
/** Classified from Terraform analysis (HCL or show-json), not application source code. */
|
|
76
|
-
function isTerraformDerivedComponent(component) {
|
|
77
|
-
if ((0, component_predicates_2.hasTerraformAddress)(component))
|
|
78
|
-
return true;
|
|
79
|
-
return (0, component_predicates_2.isTerraformDerivedFromPatterns)(component);
|
|
80
|
-
}
|
|
81
|
-
/** Section created for a Terraform stack root or module directory. */
|
|
82
|
-
function isTerraformStackSection(section) {
|
|
83
|
-
if (section.isTerraformStack === true)
|
|
84
|
-
return true;
|
|
85
|
-
const dir = (section.sectionDir || section.id).replace(/\\/g, "/").toLowerCase();
|
|
86
|
-
if (!dir || dir === "root")
|
|
87
|
-
return false;
|
|
88
|
-
return (dir === "terraform" ||
|
|
89
|
-
dir.startsWith("terraform/") ||
|
|
90
|
-
dir.includes("/terraform/") ||
|
|
91
|
-
dir.endsWith("/terraform"));
|
|
92
|
-
}
|
|
93
|
-
function sectionHasRuntimeCodeComponents(components, sectionId) {
|
|
94
|
-
for (const component of components) {
|
|
95
|
-
if ((0, sectioning_1.getSectionIdFromProperties)(component.properties) !== sectionId)
|
|
96
|
-
continue;
|
|
97
|
-
if (isTerraformDerivedComponent(component))
|
|
98
|
-
continue;
|
|
99
|
-
if (component.subType === "database")
|
|
100
|
-
return true;
|
|
101
|
-
if (component.detectedFrom?.some((ref) => ref.pattern === "express_route")) {
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
const locations = component.sourceLocations ?? [];
|
|
105
|
-
if (locations.some((loc) => {
|
|
106
|
-
const fp = loc.filePath.replace(/\\/g, "/").toLowerCase();
|
|
107
|
-
return !MANIFEST_ONLY_PATH_SUFFIXES.some((suffix) => fp.endsWith(suffix));
|
|
108
|
-
})) {
|
|
109
|
-
if (component.type === "asset" || component.type === "actor") {
|
|
110
|
-
return true;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return false;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Whether a workspace section should receive a synthetic application hub and
|
|
118
|
-
* default User actor (tooling-only packages like cli/docs/utils are skipped).
|
|
119
|
-
*/
|
|
120
|
-
function sectionQualifiesForSyntheticApplication(section, components) {
|
|
121
|
-
if (section.role !== "service")
|
|
122
|
-
return false;
|
|
123
|
-
if (isTerraformStackSection(section))
|
|
124
|
-
return false;
|
|
125
|
-
if (isScaffoldOrTemplatePackageSection(section))
|
|
126
|
-
return false;
|
|
127
|
-
if (sectionHasRuntimeCodeComponents(components, section.id))
|
|
128
|
-
return true;
|
|
129
|
-
if (sectionHasPackageJsonManifest(section) &&
|
|
130
|
-
sectionHasClassifiedComponents(components, section.id)) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
function shouldInjectUserActorForMainApp(mainApp, components) {
|
|
136
|
-
const sectionId = (0, sectioning_1.getSectionIdFromProperties)(mainApp.properties);
|
|
137
|
-
if (mainApp.properties?.sourceContext !== "injected_project_placeholder") {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
if (!isConcreteServiceSectionId(sectionId))
|
|
141
|
-
return true;
|
|
142
|
-
if (isTerraformStackSection({ id: sectionId, sectionDir: sectionId })) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
if (sectionHasRuntimeCodeComponents(components, sectionId))
|
|
146
|
-
return true;
|
|
147
|
-
return mainApp.properties?.is_primary_monorepo_package === true;
|
|
148
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DetectedComponent } from "../types/component";
|
|
2
|
-
export declare const TERRAFORM_DETECTED_FROM_PATTERNS: Set<string>;
|
|
3
|
-
export declare const ROOT_LIKE_SECTION_IDS: Set<string>;
|
|
4
|
-
export declare function trimTerraformAddress(component: DetectedComponent): string;
|
|
5
|
-
export declare function hasTerraformAddress(component: DetectedComponent): boolean;
|
|
6
|
-
export declare function scanHasTerraformAddress(components: DetectedComponent[]): boolean;
|
|
7
|
-
export declare function isTerraformProviderComponent(component: DetectedComponent | undefined): boolean;
|
|
8
|
-
export declare function isRootLikeSectionId(sectionId: string | undefined): boolean;
|
|
9
|
-
/** Non-Terraform detectedFrom patterns or non-`.tf` source paths. */
|
|
10
|
-
export declare function hasNonTerraformAppSource(component: DetectedComponent): boolean;
|
|
11
|
-
/** App surface signals for root-scoped assets (single-package repos). */
|
|
12
|
-
export declare function hasNonTerraformAppSignals(component: DetectedComponent): boolean;
|
|
13
|
-
export declare function isTerraformDerivedFromPatterns(component: DetectedComponent): boolean;
|