@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
package/dist/src/cli.js
CHANGED
|
@@ -53,20 +53,22 @@ const validate_scan_ai_1 = require("./config/validate-scan-ai");
|
|
|
53
53
|
const scan_sentry_1 = require("./observability/scan-sentry");
|
|
54
54
|
const telemetry_client_1 = require("./platform-api/telemetry-client");
|
|
55
55
|
const scan_config_schema_1 = require("./core/schema/scan-config.schema");
|
|
56
|
-
const
|
|
56
|
+
const scanner_1 = require("@dataparade/scanner");
|
|
57
57
|
function formatEvidence(detail) {
|
|
58
58
|
const evidence = detail.evidence;
|
|
59
59
|
if (!evidence || evidence.length === 0) {
|
|
60
|
-
return
|
|
60
|
+
return 'none';
|
|
61
61
|
}
|
|
62
62
|
const head = evidence[0];
|
|
63
63
|
const first = head != null
|
|
64
64
|
? `${head.filePath}:${head.startLine}-${head.endLine} (${head.reason})`
|
|
65
|
-
:
|
|
66
|
-
return evidence.length === 1
|
|
65
|
+
: 'none';
|
|
66
|
+
return evidence.length === 1
|
|
67
|
+
? first
|
|
68
|
+
: `${first}; +${evidence.length - 1} more`;
|
|
67
69
|
}
|
|
68
70
|
function formatProposalTarget(detail) {
|
|
69
|
-
if (detail.kind ===
|
|
71
|
+
if (detail.kind === 'component_patch' && detail.targetComponentId) {
|
|
70
72
|
return `component:${detail.targetComponentId}`;
|
|
71
73
|
}
|
|
72
74
|
if (detail.targetFlowId)
|
|
@@ -74,18 +76,20 @@ function formatProposalTarget(detail) {
|
|
|
74
76
|
if (detail.sourceComponentId && detail.targetFlowComponentId) {
|
|
75
77
|
return `flow:${detail.sourceComponentId}->${detail.targetFlowComponentId}`;
|
|
76
78
|
}
|
|
77
|
-
return
|
|
79
|
+
return 'unknown';
|
|
78
80
|
}
|
|
79
81
|
function printAiInferenceVerbose(details) {
|
|
80
82
|
if (details.length === 0) {
|
|
81
83
|
// eslint-disable-next-line no-console
|
|
82
|
-
console.log(
|
|
84
|
+
console.log('[scan] ai-inference details: no proposals generated');
|
|
83
85
|
return;
|
|
84
86
|
}
|
|
85
87
|
// eslint-disable-next-line no-console
|
|
86
|
-
console.log(
|
|
88
|
+
console.log('[scan] ai-inference details:');
|
|
87
89
|
for (const detail of details) {
|
|
88
|
-
const status = detail.status ===
|
|
90
|
+
const status = detail.status === 'applied'
|
|
91
|
+
? 'applied'
|
|
92
|
+
: `rejected (${detail.rejectionReason})`;
|
|
89
93
|
const confidence = detail.confidence.toFixed(2);
|
|
90
94
|
// eslint-disable-next-line no-console
|
|
91
95
|
console.log(`[scan] - ${detail.id}: ${status} | ${detail.source} | ${detail.kind} | target=${formatProposalTarget(detail)} | confidence=${confidence} (${detail.confidenceBand})`);
|
|
@@ -93,7 +97,9 @@ function printAiInferenceVerbose(details) {
|
|
|
93
97
|
console.log(`[scan] candidate=${detail.candidateType} agent=${detail.agent} provider=${detail.provider}/${detail.model}`);
|
|
94
98
|
// eslint-disable-next-line no-console
|
|
95
99
|
console.log(`[scan] evidence=${formatEvidence(detail)}`);
|
|
96
|
-
if (detail.status ===
|
|
100
|
+
if (detail.status === 'applied' &&
|
|
101
|
+
detail.propertyChanges &&
|
|
102
|
+
detail.propertyChanges.length) {
|
|
97
103
|
const formatted = detail.propertyChanges.map((change) => {
|
|
98
104
|
const from = JSON.stringify(change.from);
|
|
99
105
|
const to = JSON.stringify(change.to);
|
|
@@ -107,53 +113,53 @@ function printAiInferenceVerbose(details) {
|
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
function formatUsd(value) {
|
|
110
|
-
if (typeof value !==
|
|
111
|
-
return
|
|
116
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
117
|
+
return 'n/a';
|
|
112
118
|
return `$${value.toFixed(6)}`;
|
|
113
119
|
}
|
|
114
120
|
function createProgram() {
|
|
115
121
|
const program = new commander_1.Command();
|
|
116
122
|
program
|
|
117
|
-
.name(
|
|
118
|
-
.description(
|
|
123
|
+
.name('dataparade')
|
|
124
|
+
.description('DataParade CLI - scan codebases for data flow components')
|
|
119
125
|
.version(package_json_1.default.version);
|
|
120
126
|
program
|
|
121
|
-
.command(
|
|
122
|
-
.description(
|
|
123
|
-
.option(
|
|
124
|
-
.option(
|
|
125
|
-
.option(
|
|
126
|
-
.option(
|
|
127
|
-
.option(
|
|
128
|
-
.option(
|
|
129
|
-
.option(
|
|
130
|
-
.option(
|
|
131
|
-
.option(
|
|
132
|
-
.option(
|
|
133
|
-
.option(
|
|
134
|
-
.option(
|
|
135
|
-
.option(
|
|
136
|
-
.option(
|
|
137
|
-
.option(
|
|
138
|
-
.option(
|
|
139
|
-
.option(
|
|
140
|
-
.option(
|
|
141
|
-
.option(
|
|
142
|
-
.option(
|
|
143
|
-
.option(
|
|
144
|
-
.option(
|
|
145
|
-
.option(
|
|
146
|
-
.option(
|
|
147
|
-
.option(
|
|
148
|
-
.option(
|
|
149
|
-
.option(
|
|
150
|
-
.option(
|
|
151
|
-
.option(
|
|
127
|
+
.command('scan <path>')
|
|
128
|
+
.description('Scan a directory (or a single supported source file) for data flow components')
|
|
129
|
+
.option('-o, --output <file>', 'Write dataflow.json wrapper to the given file (default: ./dataflow.json)')
|
|
130
|
+
.option('--exclude <pattern...>', 'One or more glob patterns to exclude from scanning')
|
|
131
|
+
.option('--minimum-confidence <number>', 'Minimum confidence (0-1) for including detections')
|
|
132
|
+
.option('--language <language...>', 'Limit scanning to specific languages (e.g. typescript, javascript, python, go, java, kotlin, cpp, csharp, terraform)')
|
|
133
|
+
.option('--project-name <name>', 'Override the inferred project name used for the application asset')
|
|
134
|
+
.option('--deep-analysis', 'Enable deeper, potentially slower structural analysis where supported')
|
|
135
|
+
.option('--terraform-json <path>', 'Merge resource addresses from a saved `terraform show -json` file (absolute or relative to scan root)')
|
|
136
|
+
.option('--terraform-plan <path>', 'Merge addresses by running `terraform show -json <path>` from the scan root (path relative to scan root; requires terraform on PATH)')
|
|
137
|
+
.option('--terraform-stack-section-path-depth <n>', 'Register Terraform stack directories as service sections when their path has exactly N segments (e.g. 4 for packages/foo/k8s/terraform)')
|
|
138
|
+
.option('--no-terraform-stack-section-auto', 'Do not infer terraformStackSectionPathDepth from .tf layout when depth is unset')
|
|
139
|
+
.option('--monorepo-package-section-path-depth <n>', 'Workspace package section depth (max 3): primary packages and rollup use N POSIX path segments (e.g. 3 for packages/twenty-apps/hello)')
|
|
140
|
+
.option('--no-monorepo-package-section-auto', 'Do not infer monorepoPackageSectionPathDepth from package.json layout when depth is unset')
|
|
141
|
+
.option('--ai-inference', 'Enable post-scan AI inference (default: on; SCAN_AI_INFERENCE=false also disables)')
|
|
142
|
+
.option('--no-ai-inference', 'Disable post-scan AI inference')
|
|
143
|
+
.option('--ai-provider <provider>', `AI provider: ${types_1.AI_PROVIDER_IDS.join('|')}`)
|
|
144
|
+
.option('--ai-model <model>', 'Model name for AI inference')
|
|
145
|
+
.option('--ai-endpoint <url>', 'Override provider endpoint URL')
|
|
146
|
+
.option('--ai-temperature <number>', 'Sampling temperature for model calls')
|
|
147
|
+
.option('--ai-max-tokens <number>', 'Max tokens per inference call')
|
|
148
|
+
.option('--ai-max-calls <number>', 'Max model calls for a scan')
|
|
149
|
+
.option('--ai-budget-tokens <number>', 'Total token budget for inference')
|
|
150
|
+
.option('--ai-max-candidates-per-agent <number>', 'Max inference queue items per agent (0 = no cap; default from config: 25)')
|
|
151
|
+
.option('--ai-inference-scope <scope>', 'default | third_party_only — third_party_only runs AI enrichment only on every third-party node')
|
|
152
|
+
.option('--ai-verbose', 'Print per-proposal AI inference details (applied/rejected + evidence)')
|
|
153
|
+
.option('--workspace-api-key <key>', 'DataParade workspace API key (platform AI + quota; env: DATAPARADE_WORKSPACE_API_KEY)')
|
|
154
|
+
.option('--api-key <key>', '(deprecated) alias for --workspace-api-key')
|
|
155
|
+
.option('--byok-provider <provider>', `BYOK LLM provider when using your own API key: ${types_1.AI_PROVIDER_IDS.join('|')}`)
|
|
156
|
+
.option('--byok-model <model>', 'BYOK model name (env: SCAN_BYOK_MODEL)')
|
|
157
|
+
.option('--skip-auto-upload', 'Do not upload dataflow.json to the dashboard after scan (env: DATAPARADE_SKIP_AUTO_UPLOAD)')
|
|
152
158
|
.action(async (path, options) => {
|
|
153
159
|
let cliQuotaJobId;
|
|
154
160
|
let platformQuotaApiKey;
|
|
155
161
|
let quotaCompletionReported = false;
|
|
156
|
-
let fallbackFailureMessage =
|
|
162
|
+
let fallbackFailureMessage = 'CLI scan did not complete successfully';
|
|
157
163
|
let sentryScanRoot;
|
|
158
164
|
let sentryAiMode;
|
|
159
165
|
let sentryAiProvider;
|
|
@@ -164,39 +170,40 @@ function createProgram() {
|
|
|
164
170
|
const usageSessionId = (0, crypto_1.randomUUID)();
|
|
165
171
|
await (0, telemetry_client_1.reportCliUsageEvent)({
|
|
166
172
|
sessionId: usageSessionId,
|
|
167
|
-
event:
|
|
168
|
-
command:
|
|
173
|
+
event: 'scan_started',
|
|
174
|
+
command: 'scan',
|
|
169
175
|
hasApiKey: Boolean(workspaceApiKey),
|
|
170
176
|
apiKey: workspaceApiKey,
|
|
171
177
|
cliVersion: package_json_1.default.version,
|
|
172
178
|
});
|
|
173
179
|
try {
|
|
174
|
-
const rootPathArg = path ||
|
|
180
|
+
const rootPathArg = path || '.';
|
|
175
181
|
// Load dataparade.config.json from the directory being scanned, not
|
|
176
182
|
// process.cwd(). Locally these often match; in Lambda the worker cwd
|
|
177
183
|
// is the image root (/var/task) while the scan path is /tmp/.../project.
|
|
178
184
|
const resolvedScanRoot = path_1.default.resolve(process.cwd(), rootPathArg);
|
|
179
185
|
let scanEntry;
|
|
180
186
|
try {
|
|
181
|
-
scanEntry = await (0,
|
|
187
|
+
scanEntry = await (0, scanner_1.resolveScanFilesystemEntry)(resolvedScanRoot);
|
|
182
188
|
}
|
|
183
189
|
catch (err) {
|
|
184
|
-
const message = err instanceof Error ? err.message :
|
|
190
|
+
const message = err instanceof Error ? err.message : 'Path does not exist.';
|
|
185
191
|
sentryScanRoot = resolvedScanRoot;
|
|
186
192
|
await (0, scan_sentry_1.reportScanCliError)({
|
|
187
193
|
error: err,
|
|
188
194
|
scanRoot: sentryScanRoot,
|
|
189
|
-
failurePhase:
|
|
190
|
-
failureCode:
|
|
195
|
+
failurePhase: 'resolve_path',
|
|
196
|
+
failureCode: 'path_not_found',
|
|
191
197
|
});
|
|
192
198
|
// eslint-disable-next-line no-console
|
|
193
199
|
console.error(`[scan] error: ${message}`);
|
|
194
200
|
process.exitCode = 2;
|
|
195
201
|
return;
|
|
196
202
|
}
|
|
197
|
-
const [{
|
|
198
|
-
Promise.resolve().then(() => __importStar(require(
|
|
199
|
-
Promise.resolve().then(() => __importStar(require(
|
|
203
|
+
const [{ createDefaultScanConfiguration }, { runScanPipeline }, { buildDiagramGraphFromScanResult },] = await Promise.all([
|
|
204
|
+
Promise.resolve().then(() => __importStar(require('./core/pipeline/orchestrator'))),
|
|
205
|
+
Promise.resolve().then(() => __importStar(require('./core/pipeline/scan-pipeline'))),
|
|
206
|
+
Promise.resolve().then(() => __importStar(require('./core/pipeline/graph-mapping'))),
|
|
200
207
|
]);
|
|
201
208
|
if (isInteractive) {
|
|
202
209
|
// eslint-disable-next-line no-console
|
|
@@ -204,7 +211,7 @@ function createProgram() {
|
|
|
204
211
|
}
|
|
205
212
|
const flags = {
|
|
206
213
|
exclude: options.exclude,
|
|
207
|
-
minimumConfidence: typeof options.minimumConfidence ===
|
|
214
|
+
minimumConfidence: typeof options.minimumConfidence === 'string'
|
|
208
215
|
? Number(options.minimumConfidence)
|
|
209
216
|
: undefined,
|
|
210
217
|
language: options.language,
|
|
@@ -212,11 +219,11 @@ function createProgram() {
|
|
|
212
219
|
projectName: options.projectName,
|
|
213
220
|
terraformJson: options.terraformJson,
|
|
214
221
|
terraformPlan: options.terraformPlan,
|
|
215
|
-
terraformStackSectionPathDepth: typeof options.terraformStackSectionPathDepth ===
|
|
222
|
+
terraformStackSectionPathDepth: typeof options.terraformStackSectionPathDepth === 'string'
|
|
216
223
|
? Number(options.terraformStackSectionPathDepth)
|
|
217
224
|
: undefined,
|
|
218
225
|
noTerraformStackSectionAuto: options.noTerraformStackSectionAuto,
|
|
219
|
-
monorepoPackageSectionPathDepth: typeof options.monorepoPackageSectionPathDepth ===
|
|
226
|
+
monorepoPackageSectionPathDepth: typeof options.monorepoPackageSectionPathDepth === 'string'
|
|
220
227
|
? Number(options.monorepoPackageSectionPathDepth)
|
|
221
228
|
: undefined,
|
|
222
229
|
noMonorepoPackageSectionAuto: options.noMonorepoPackageSectionAuto,
|
|
@@ -224,19 +231,19 @@ function createProgram() {
|
|
|
224
231
|
aiProvider: options.aiProvider,
|
|
225
232
|
aiModel: options.aiModel,
|
|
226
233
|
aiEndpoint: options.aiEndpoint,
|
|
227
|
-
aiTemperature: typeof options.aiTemperature ===
|
|
234
|
+
aiTemperature: typeof options.aiTemperature === 'string'
|
|
228
235
|
? Number(options.aiTemperature)
|
|
229
236
|
: undefined,
|
|
230
|
-
aiMaxTokens: typeof options.aiMaxTokens ===
|
|
237
|
+
aiMaxTokens: typeof options.aiMaxTokens === 'string'
|
|
231
238
|
? Number(options.aiMaxTokens)
|
|
232
239
|
: undefined,
|
|
233
|
-
aiMaxModelCalls: typeof options.aiMaxCalls ===
|
|
240
|
+
aiMaxModelCalls: typeof options.aiMaxCalls === 'string'
|
|
234
241
|
? Number(options.aiMaxCalls)
|
|
235
242
|
: undefined,
|
|
236
|
-
aiBudgetTokens: typeof options.aiBudgetTokens ===
|
|
243
|
+
aiBudgetTokens: typeof options.aiBudgetTokens === 'string'
|
|
237
244
|
? Number(options.aiBudgetTokens)
|
|
238
245
|
: undefined,
|
|
239
|
-
aiMaxCandidatesPerAgent: typeof options.aiMaxCandidatesPerAgent ===
|
|
246
|
+
aiMaxCandidatesPerAgent: typeof options.aiMaxCandidatesPerAgent === 'string'
|
|
240
247
|
? Number(options.aiMaxCandidatesPerAgent)
|
|
241
248
|
: undefined,
|
|
242
249
|
aiInferenceScope: (0, inference_scope_1.parseAiInferenceScope)(options.aiInferenceScope),
|
|
@@ -254,15 +261,15 @@ function createProgram() {
|
|
|
254
261
|
config.workspaceApiKey = workspaceApiKey;
|
|
255
262
|
}
|
|
256
263
|
const aiMode = (0, validate_scan_ai_1.resolveAiMode)(config);
|
|
257
|
-
const usesByok = aiMode ===
|
|
264
|
+
const usesByok = aiMode === 'byok';
|
|
258
265
|
sentryScanRoot = scanEntry.scanRootDir;
|
|
259
266
|
sentryAiMode = aiMode;
|
|
260
267
|
sentryAiProvider = config.aiProvider;
|
|
261
268
|
// Quota preflight for platform billing. Structural-only scans (AI off) do not use quota API.
|
|
262
269
|
if (workspaceApiKey && !usesByok && config.enableAiInference) {
|
|
263
270
|
const [{ cliScanPreflight }, { estimateScanFootprint }] = await Promise.all([
|
|
264
|
-
Promise.resolve().then(() => __importStar(require(
|
|
265
|
-
Promise.resolve().then(() => __importStar(require(
|
|
271
|
+
Promise.resolve().then(() => __importStar(require('./platform-api/scan-quota-client'))),
|
|
272
|
+
Promise.resolve().then(() => __importStar(require('./platform-api/estimate-scan-footprint'))),
|
|
266
273
|
]);
|
|
267
274
|
const footprint = await estimateScanFootprint(scanEntry.scanRootDir, config.excludePaths ?? []);
|
|
268
275
|
const preflight = await cliScanPreflight({
|
|
@@ -282,8 +289,8 @@ function createProgram() {
|
|
|
282
289
|
// budget above the configured default (or user override).
|
|
283
290
|
config.aiBudgetTokens = Math.min(config.aiBudgetTokens ?? 12_000, preflight.suggestedAiBudgetTokens);
|
|
284
291
|
}
|
|
285
|
-
if (preflight.aiDelivery ===
|
|
286
|
-
config.aiMode =
|
|
292
|
+
if (preflight.aiDelivery === 'platform_proxy') {
|
|
293
|
+
config.aiMode = 'platform';
|
|
287
294
|
}
|
|
288
295
|
if (isInteractive) {
|
|
289
296
|
// eslint-disable-next-line no-console
|
|
@@ -292,9 +299,10 @@ function createProgram() {
|
|
|
292
299
|
}
|
|
293
300
|
else if (!workspaceApiKey &&
|
|
294
301
|
!usesByok &&
|
|
302
|
+
aiMode !== "hosted_worker" &&
|
|
295
303
|
config.enableAiInference) {
|
|
296
304
|
try {
|
|
297
|
-
const { cliAnonymousAiSession } = await Promise.resolve().then(() => __importStar(require(
|
|
305
|
+
const { cliAnonymousAiSession } = await Promise.resolve().then(() => __importStar(require('./platform-api/anonymous-ai-session-client')));
|
|
298
306
|
const session = await cliAnonymousAiSession({
|
|
299
307
|
projectName: config.projectName,
|
|
300
308
|
});
|
|
@@ -306,8 +314,8 @@ function createProgram() {
|
|
|
306
314
|
// Applying it as the working budget caused scans to burn ~100k tokens.
|
|
307
315
|
config.aiBudgetTokens = Math.min(config.aiBudgetTokens ?? 12_000, session.suggestedAiBudgetTokens);
|
|
308
316
|
}
|
|
309
|
-
if (session.aiDelivery ===
|
|
310
|
-
config.aiMode =
|
|
317
|
+
if (session.aiDelivery === 'platform_proxy') {
|
|
318
|
+
config.aiMode = 'platform';
|
|
311
319
|
}
|
|
312
320
|
if (isInteractive) {
|
|
313
321
|
// eslint-disable-next-line no-console
|
|
@@ -315,10 +323,10 @@ function createProgram() {
|
|
|
315
323
|
}
|
|
316
324
|
}
|
|
317
325
|
catch (anonSessionError) {
|
|
318
|
-
const { CliAnonymousIpLimitError } = await Promise.resolve().then(() => __importStar(require(
|
|
326
|
+
const { CliAnonymousIpLimitError } = await Promise.resolve().then(() => __importStar(require('./platform-api/anonymous-ai-session-client')));
|
|
319
327
|
const message = anonSessionError instanceof Error
|
|
320
328
|
? anonSessionError.message
|
|
321
|
-
:
|
|
329
|
+
: 'Anonymous AI session failed.';
|
|
322
330
|
// eslint-disable-next-line no-console
|
|
323
331
|
console.error(`[scan] ${message}`);
|
|
324
332
|
process.exitCode =
|
|
@@ -329,28 +337,28 @@ function createProgram() {
|
|
|
329
337
|
const configValidation = (0, scan_config_schema_1.validateScanConfiguration)(config);
|
|
330
338
|
if (!configValidation.ok) {
|
|
331
339
|
await (0, scan_sentry_1.reportScanCliError)({
|
|
332
|
-
error: configValidation.errors.join(
|
|
340
|
+
error: configValidation.errors.join('\n'),
|
|
333
341
|
scanRoot: sentryScanRoot,
|
|
334
342
|
jobId: cliQuotaJobId,
|
|
335
343
|
aiMode: sentryAiMode,
|
|
336
344
|
aiProvider: sentryAiProvider,
|
|
337
|
-
failurePhase:
|
|
338
|
-
failureCode:
|
|
345
|
+
failurePhase: 'config_validation',
|
|
346
|
+
failureCode: 'invalid_configuration',
|
|
339
347
|
});
|
|
340
348
|
// eslint-disable-next-line no-console
|
|
341
|
-
console.error(`[scan] invalid configuration:\n${configValidation.errors.map((e) => ` - ${e}`).join(
|
|
349
|
+
console.error(`[scan] invalid configuration:\n${configValidation.errors.map((e) => ` - ${e}`).join('\n')}`);
|
|
342
350
|
process.exitCode = 2;
|
|
343
351
|
return;
|
|
344
352
|
}
|
|
345
353
|
if (isInteractive && warnings.length > 0) {
|
|
346
354
|
// eslint-disable-next-line no-console
|
|
347
|
-
console.warn(`[scan] warnings:\n${warnings.map((w) => ` - ${w}`).join(
|
|
355
|
+
console.warn(`[scan] warnings:\n${warnings.map((w) => ` - ${w}`).join('\n')}`);
|
|
348
356
|
}
|
|
349
|
-
const { scanResult } = await
|
|
357
|
+
const { scanResult, redFlags } = await runScanPipeline(resolvedScanRoot, config, (progress) => {
|
|
350
358
|
if (!isInteractive)
|
|
351
359
|
return;
|
|
352
360
|
// eslint-disable-next-line no-console
|
|
353
|
-
console.log(`[scan] ${progress.phase}: ${progress.message ??
|
|
361
|
+
console.log(`[scan] ${progress.phase}: ${progress.message ?? ''}`.trim());
|
|
354
362
|
});
|
|
355
363
|
if (scanResult.structuralEnrichmentSummary) {
|
|
356
364
|
const st = scanResult.structuralEnrichmentSummary;
|
|
@@ -364,37 +372,41 @@ function createProgram() {
|
|
|
364
372
|
// Always show real provider token usage (budget_cap is only a ceiling, not cost).
|
|
365
373
|
// eslint-disable-next-line no-console
|
|
366
374
|
console.log(`[scan] ai-usage: provider_calls=${s.providerCalls} tokens_in=${s.inputTokens} tokens_out=${s.outputTokens} tokens_total=${s.totalTokens}` +
|
|
367
|
-
(typeof s.estimatedCostUsd ===
|
|
375
|
+
(typeof s.estimatedCostUsd === 'number'
|
|
368
376
|
? ` estimated_cost_usd=${formatUsd(s.estimatedCostUsd)}`
|
|
369
|
-
:
|
|
377
|
+
: ''));
|
|
370
378
|
if (options.aiVerbose && scanResult.aiInferenceProposalDetails) {
|
|
371
379
|
printAiInferenceVerbose(scanResult.aiInferenceProposalDetails);
|
|
372
380
|
}
|
|
373
381
|
}
|
|
374
382
|
for (const w of scanResult.warnings ?? []) {
|
|
375
|
-
if (w.startsWith(
|
|
383
|
+
if (w.startsWith('ai-provider:')) {
|
|
376
384
|
await (0, scan_sentry_1.reportScanCliError)({
|
|
377
385
|
error: w,
|
|
378
386
|
scanRoot: sentryScanRoot,
|
|
379
387
|
jobId: cliQuotaJobId,
|
|
380
388
|
aiMode: sentryAiMode,
|
|
381
389
|
aiProvider: sentryAiProvider,
|
|
382
|
-
failurePhase:
|
|
383
|
-
failureCode:
|
|
390
|
+
failurePhase: 'ai_provider',
|
|
391
|
+
failureCode: 'ai_provider_warning',
|
|
384
392
|
});
|
|
385
393
|
// eslint-disable-next-line no-console
|
|
386
394
|
console.warn(`[scan] ${w}`);
|
|
387
395
|
}
|
|
396
|
+
else if (w.startsWith('red-flag:')) {
|
|
397
|
+
// eslint-disable-next-line no-console
|
|
398
|
+
console.warn(`[scan] ${w}`);
|
|
399
|
+
}
|
|
388
400
|
}
|
|
389
401
|
if (scanResult.errors?.length) {
|
|
390
402
|
await (0, scan_sentry_1.reportScanCliError)({
|
|
391
|
-
error: scanResult.errors.join(
|
|
403
|
+
error: scanResult.errors.join('\n'),
|
|
392
404
|
scanRoot: sentryScanRoot,
|
|
393
405
|
jobId: cliQuotaJobId,
|
|
394
406
|
aiMode: sentryAiMode,
|
|
395
407
|
aiProvider: sentryAiProvider,
|
|
396
|
-
failurePhase:
|
|
397
|
-
failureCode:
|
|
408
|
+
failurePhase: 'scan_pipeline',
|
|
409
|
+
failureCode: 'scan_errors',
|
|
398
410
|
extra: { errorCount: scanResult.errors.length },
|
|
399
411
|
});
|
|
400
412
|
process.exitCode = 1;
|
|
@@ -410,20 +422,20 @@ function createProgram() {
|
|
|
410
422
|
jobId: cliQuotaJobId,
|
|
411
423
|
aiMode: sentryAiMode,
|
|
412
424
|
aiProvider: sentryAiProvider,
|
|
413
|
-
failurePhase:
|
|
414
|
-
failureCode:
|
|
425
|
+
failurePhase: 'diagram_graph',
|
|
426
|
+
failureCode: 'graph_build_failed',
|
|
415
427
|
});
|
|
416
428
|
if (isInteractive) {
|
|
417
429
|
const message = graphError instanceof Error
|
|
418
430
|
? graphError.message
|
|
419
|
-
:
|
|
431
|
+
: 'Unknown error while building diagram graph.';
|
|
420
432
|
// eslint-disable-next-line no-console
|
|
421
433
|
console.error(`[scan] warning: unable to build diagram graph: ${message}`);
|
|
422
434
|
}
|
|
423
435
|
process.exitCode = 1;
|
|
424
436
|
}
|
|
425
437
|
if (diagramGraph) {
|
|
426
|
-
const dataflowOutputPath = path_1.default.resolve(process.cwd(), options.output ??
|
|
438
|
+
const dataflowOutputPath = path_1.default.resolve(process.cwd(), options.output ?? 'dataflow.json');
|
|
427
439
|
const resolvedProjectName = config.projectName?.trim() ||
|
|
428
440
|
path_1.default.basename(scanEntry.scanRootDir);
|
|
429
441
|
try {
|
|
@@ -432,6 +444,7 @@ function createProgram() {
|
|
|
432
444
|
graph: diagramGraph,
|
|
433
445
|
outputPath: dataflowOutputPath,
|
|
434
446
|
projectName: resolvedProjectName,
|
|
447
|
+
redFlags,
|
|
435
448
|
});
|
|
436
449
|
// Always print a short message so non-interactive callers and
|
|
437
450
|
// tests can rely on it.
|
|
@@ -441,22 +454,22 @@ function createProgram() {
|
|
|
441
454
|
(0, upload_env_1.resolveSkipAutoUpload)(process.env);
|
|
442
455
|
if (!skipAutoUpload) {
|
|
443
456
|
try {
|
|
444
|
-
const { runDataflowUpload } = await Promise.resolve().then(() => __importStar(require(
|
|
445
|
-
const dataflowWrapper = (0, json_1.buildDataflowWrapper)(scanResult, diagramGraph, { projectName: resolvedProjectName });
|
|
457
|
+
const { runDataflowUpload } = await Promise.resolve().then(() => __importStar(require('./upload/run-upload')));
|
|
458
|
+
const dataflowWrapper = (0, json_1.buildDataflowWrapper)(scanResult, diagramGraph, { projectName: resolvedProjectName, redFlags });
|
|
446
459
|
await runDataflowUpload({
|
|
447
460
|
apiKey: workspaceApiKey,
|
|
448
461
|
dataflow: dataflowWrapper,
|
|
449
462
|
projectName: resolvedProjectName,
|
|
450
463
|
scanJobId: cliQuotaJobId,
|
|
451
|
-
logPrefix:
|
|
464
|
+
logPrefix: '[scan]',
|
|
452
465
|
cliUsageSessionId: usageSessionId,
|
|
453
|
-
command:
|
|
466
|
+
command: 'scan',
|
|
454
467
|
});
|
|
455
468
|
}
|
|
456
469
|
catch (uploadError) {
|
|
457
470
|
const uploadMessage = uploadError instanceof Error
|
|
458
471
|
? uploadError.message
|
|
459
|
-
:
|
|
472
|
+
: 'Unknown upload error.';
|
|
460
473
|
// eslint-disable-next-line no-console
|
|
461
474
|
console.error(`[scan] Auto-upload failed: ${uploadMessage}`);
|
|
462
475
|
}
|
|
@@ -469,42 +482,44 @@ function createProgram() {
|
|
|
469
482
|
jobId: cliQuotaJobId,
|
|
470
483
|
aiMode: sentryAiMode,
|
|
471
484
|
aiProvider: sentryAiProvider,
|
|
472
|
-
failurePhase:
|
|
473
|
-
failureCode:
|
|
485
|
+
failurePhase: 'dataflow_output',
|
|
486
|
+
failureCode: 'dataflow_write_failed',
|
|
474
487
|
});
|
|
475
488
|
const message = dataflowError instanceof Error
|
|
476
489
|
? dataflowError.message
|
|
477
|
-
:
|
|
490
|
+
: 'Unknown error while writing dataflow.json.';
|
|
478
491
|
// eslint-disable-next-line no-console
|
|
479
492
|
console.error(`[scan] error: failed to write dataflow.json: ${message}`);
|
|
480
493
|
process.exitCode = 1;
|
|
481
494
|
}
|
|
482
495
|
}
|
|
483
496
|
if (platformQuotaApiKey && cliQuotaJobId) {
|
|
484
|
-
const { cliScanComplete } = await Promise.resolve().then(() => __importStar(require(
|
|
497
|
+
const { cliScanComplete } = await Promise.resolve().then(() => __importStar(require('./platform-api/scan-quota-client')));
|
|
485
498
|
const exitFailed = (process.exitCode ?? 0) !== 0;
|
|
486
|
-
const platformAiMode = (0, validate_scan_ai_1.resolveAiMode)(config) ===
|
|
499
|
+
const platformAiMode = (0, validate_scan_ai_1.resolveAiMode)(config) === 'platform';
|
|
487
500
|
await cliScanComplete({
|
|
488
501
|
apiKey: platformQuotaApiKey,
|
|
489
502
|
jobId: cliQuotaJobId,
|
|
490
|
-
status: exitFailed ?
|
|
503
|
+
status: exitFailed ? 'failed' : 'completed',
|
|
491
504
|
aiTokensUsed: platformAiMode
|
|
492
505
|
? 0
|
|
493
506
|
: (scanResult.aiInferenceSummary?.totalTokens ?? 0),
|
|
494
|
-
failureCode: exitFailed ?
|
|
495
|
-
failureMessage: exitFailed
|
|
507
|
+
failureCode: exitFailed ? 'scan_failed' : undefined,
|
|
508
|
+
failureMessage: exitFailed
|
|
509
|
+
? 'CLI scan did not complete successfully'
|
|
510
|
+
: undefined,
|
|
496
511
|
});
|
|
497
512
|
quotaCompletionReported = true;
|
|
498
513
|
if (isInteractive) {
|
|
499
514
|
// eslint-disable-next-line no-console
|
|
500
|
-
console.log(
|
|
515
|
+
console.log('[scan] Scan finished — you can start a new scan now.');
|
|
501
516
|
}
|
|
502
517
|
}
|
|
503
518
|
}
|
|
504
519
|
catch (err) {
|
|
505
|
-
const message = err instanceof Error ? err.message :
|
|
520
|
+
const message = err instanceof Error ? err.message : 'Unknown error during scan.';
|
|
506
521
|
fallbackFailureMessage = message;
|
|
507
|
-
const { CliScanQuotaExceededError, CliScanAlreadyRunningError } = await Promise.resolve().then(() => __importStar(require(
|
|
522
|
+
const { CliScanQuotaExceededError, CliScanAlreadyRunningError } = await Promise.resolve().then(() => __importStar(require('./platform-api/scan-quota-client')));
|
|
508
523
|
const quotaBlocked = err instanceof CliScanQuotaExceededError;
|
|
509
524
|
const scanInProgress = err instanceof CliScanAlreadyRunningError;
|
|
510
525
|
await (0, scan_sentry_1.reportScanCliError)({
|
|
@@ -513,12 +528,12 @@ function createProgram() {
|
|
|
513
528
|
jobId: cliQuotaJobId,
|
|
514
529
|
aiMode: sentryAiMode,
|
|
515
530
|
aiProvider: sentryAiProvider,
|
|
516
|
-
failurePhase: quotaBlocked || scanInProgress ?
|
|
531
|
+
failurePhase: quotaBlocked || scanInProgress ? 'preflight' : 'scan_command',
|
|
517
532
|
failureCode: quotaBlocked
|
|
518
|
-
?
|
|
533
|
+
? 'scan_quota_exceeded'
|
|
519
534
|
: scanInProgress
|
|
520
|
-
?
|
|
521
|
-
:
|
|
535
|
+
? 'scan_already_running'
|
|
536
|
+
: 'scan_exception',
|
|
522
537
|
});
|
|
523
538
|
// eslint-disable-next-line no-console
|
|
524
539
|
console.error(quotaBlocked
|
|
@@ -532,28 +547,30 @@ function createProgram() {
|
|
|
532
547
|
const scanFailed = (process.exitCode ?? 0) !== 0;
|
|
533
548
|
await (0, telemetry_client_1.reportCliUsageEvent)({
|
|
534
549
|
sessionId: usageSessionId,
|
|
535
|
-
event: scanFailed ?
|
|
536
|
-
command:
|
|
550
|
+
event: scanFailed ? 'scan_failed' : 'scan_succeeded',
|
|
551
|
+
command: 'scan',
|
|
537
552
|
hasApiKey: Boolean(workspaceApiKey),
|
|
538
553
|
apiKey: workspaceApiKey,
|
|
539
554
|
cliVersion: package_json_1.default.version,
|
|
540
|
-
errorCode: scanFailed ?
|
|
555
|
+
errorCode: scanFailed ? 'scan_failed' : undefined,
|
|
541
556
|
errorMessage: scanFailed ? fallbackFailureMessage : undefined,
|
|
542
557
|
});
|
|
543
|
-
if (platformQuotaApiKey &&
|
|
558
|
+
if (platformQuotaApiKey &&
|
|
559
|
+
cliQuotaJobId &&
|
|
560
|
+
!quotaCompletionReported) {
|
|
544
561
|
try {
|
|
545
|
-
const { cliScanComplete } = await Promise.resolve().then(() => __importStar(require(
|
|
562
|
+
const { cliScanComplete } = await Promise.resolve().then(() => __importStar(require('./platform-api/scan-quota-client')));
|
|
546
563
|
await cliScanComplete({
|
|
547
564
|
apiKey: platformQuotaApiKey,
|
|
548
565
|
jobId: cliQuotaJobId,
|
|
549
|
-
status:
|
|
550
|
-
failureCode:
|
|
566
|
+
status: 'failed',
|
|
567
|
+
failureCode: 'scan_failed',
|
|
551
568
|
failureMessage: fallbackFailureMessage,
|
|
552
569
|
});
|
|
553
570
|
quotaCompletionReported = true;
|
|
554
571
|
if (isInteractive) {
|
|
555
572
|
// eslint-disable-next-line no-console
|
|
556
|
-
console.log(
|
|
573
|
+
console.log('[scan] Scan finished — you can start a new scan now.');
|
|
557
574
|
}
|
|
558
575
|
}
|
|
559
576
|
catch {
|
|
@@ -563,68 +580,69 @@ function createProgram() {
|
|
|
563
580
|
}
|
|
564
581
|
});
|
|
565
582
|
program
|
|
566
|
-
.command(
|
|
567
|
-
.description(
|
|
568
|
-
.option(
|
|
569
|
-
.option(
|
|
570
|
-
.option(
|
|
583
|
+
.command('upload <file>')
|
|
584
|
+
.description('Upload a dataflow.json file to the dashboard as an import preview')
|
|
585
|
+
.option('--project-name <name>', 'Assessment name shown in the preview (default: from file metadata if present)')
|
|
586
|
+
.option('--workspace-api-key <key>', 'DataParade workspace API key (env: DATAPARADE_WORKSPACE_API_KEY)')
|
|
587
|
+
.option('--api-key <key>', '(deprecated) alias for --workspace-api-key')
|
|
571
588
|
.action(async (file, options) => {
|
|
572
589
|
const apiKey = options.workspaceApiKey?.trim() ||
|
|
573
590
|
options.apiKey?.trim() ||
|
|
574
591
|
(0, scan_env_1.resolveWorkspaceApiKey)(process.env);
|
|
575
592
|
const usageSessionId = (0, crypto_1.randomUUID)();
|
|
576
|
-
const filePath = path_1.default.resolve(process.cwd(), file ||
|
|
593
|
+
const filePath = path_1.default.resolve(process.cwd(), file || 'dataflow.json');
|
|
577
594
|
let dataflow;
|
|
578
595
|
try {
|
|
579
|
-
const { readFileSync } = await Promise.resolve().then(() => __importStar(require(
|
|
580
|
-
dataflow = JSON.parse(readFileSync(filePath,
|
|
596
|
+
const { readFileSync } = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
597
|
+
dataflow = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
581
598
|
}
|
|
582
599
|
catch (err) {
|
|
583
|
-
const message = err instanceof Error ? err.message :
|
|
600
|
+
const message = err instanceof Error ? err.message : 'Failed to read dataflow.json';
|
|
584
601
|
// eslint-disable-next-line no-console
|
|
585
602
|
console.error(`[upload] error: ${message}`);
|
|
586
603
|
process.exitCode = 1;
|
|
587
604
|
return;
|
|
588
605
|
}
|
|
589
606
|
let projectName = options.projectName?.trim();
|
|
590
|
-
if (!projectName && dataflow && typeof dataflow ===
|
|
607
|
+
if (!projectName && dataflow && typeof dataflow === 'object') {
|
|
591
608
|
const meta = dataflow
|
|
592
609
|
.metadata;
|
|
593
|
-
if (typeof meta?.projectName ===
|
|
610
|
+
if (typeof meta?.projectName === 'string' &&
|
|
611
|
+
meta.projectName.trim()) {
|
|
594
612
|
projectName = meta.projectName.trim();
|
|
595
613
|
}
|
|
596
614
|
}
|
|
597
615
|
try {
|
|
598
|
-
const { runDataflowUpload } = await Promise.resolve().then(() => __importStar(require(
|
|
616
|
+
const { runDataflowUpload } = await Promise.resolve().then(() => __importStar(require('./upload/run-upload')));
|
|
599
617
|
await runDataflowUpload({
|
|
600
618
|
apiKey,
|
|
601
619
|
dataflow,
|
|
602
620
|
projectName,
|
|
603
621
|
cliUsageSessionId: usageSessionId,
|
|
604
|
-
command:
|
|
622
|
+
command: 'upload',
|
|
605
623
|
});
|
|
606
624
|
}
|
|
607
625
|
catch (err) {
|
|
608
|
-
const message = err instanceof Error ? err.message :
|
|
626
|
+
const message = err instanceof Error ? err.message : 'Upload failed.';
|
|
609
627
|
// eslint-disable-next-line no-console
|
|
610
628
|
console.error(`[upload] error: ${message}`);
|
|
611
629
|
process.exitCode = 1;
|
|
612
630
|
}
|
|
613
631
|
});
|
|
614
632
|
program
|
|
615
|
-
.command(
|
|
616
|
-
.description(
|
|
617
|
-
.argument(
|
|
633
|
+
.command('config')
|
|
634
|
+
.description('View the effective configuration for the current project')
|
|
635
|
+
.argument('[path]', 'Project directory (default: current working directory)')
|
|
618
636
|
.action(async (pathArg) => {
|
|
619
637
|
try {
|
|
620
638
|
const [{ createDefaultScanConfiguration }] = await Promise.all([
|
|
621
|
-
Promise.resolve().then(() => __importStar(require(
|
|
639
|
+
Promise.resolve().then(() => __importStar(require('./core/pipeline/orchestrator'))),
|
|
622
640
|
]);
|
|
623
|
-
const rootPathArg = pathArg?.trim() ||
|
|
641
|
+
const rootPathArg = pathArg?.trim() || '.';
|
|
624
642
|
const resolvedRoot = path_1.default.resolve(process.cwd(), rootPathArg);
|
|
625
643
|
let configCwd = resolvedRoot;
|
|
626
644
|
try {
|
|
627
|
-
const scanEntry = await (0,
|
|
645
|
+
const scanEntry = await (0, scanner_1.resolveScanFilesystemEntry)(resolvedRoot);
|
|
628
646
|
configCwd = scanEntry.scanRootDir;
|
|
629
647
|
}
|
|
630
648
|
catch {
|
|
@@ -642,9 +660,9 @@ function createProgram() {
|
|
|
642
660
|
catch (err) {
|
|
643
661
|
const message = err instanceof Error
|
|
644
662
|
? err.message
|
|
645
|
-
:
|
|
663
|
+
: 'Unknown error while loading configuration.';
|
|
646
664
|
// eslint-disable-next-line no-console
|
|
647
|
-
console.error(
|
|
665
|
+
console.error('Failed to read configuration:', message);
|
|
648
666
|
process.exitCode = 1;
|
|
649
667
|
}
|
|
650
668
|
});
|