@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
|
@@ -3,32 +3,36 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DATA_ACTION_MIN_CONFIDENCE = void 0;
|
|
6
7
|
exports.mergeAiProposals = mergeAiProposals;
|
|
7
8
|
const third_party_subtype_1 = require("./third-party-subtype");
|
|
8
|
-
const
|
|
9
|
+
const scanner_1 = require("@dataparade/scanner");
|
|
9
10
|
const path_1 = __importDefault(require("path"));
|
|
10
11
|
const util_1 = require("util");
|
|
12
|
+
const provider_contract_1 = require("./providers/provider-contract");
|
|
13
|
+
/** PRD §4.4 / task 2.2 — AI data-action assignments gated at ≥ 0.72. */
|
|
14
|
+
exports.DATA_ACTION_MIN_CONFIDENCE = 0.72;
|
|
11
15
|
const DEFAULT_THRESHOLDS = {
|
|
12
|
-
minComponentPatchConfidence:
|
|
16
|
+
minComponentPatchConfidence: exports.DATA_ACTION_MIN_CONFIDENCE,
|
|
13
17
|
minFlowPatchConfidence: 0.75,
|
|
14
18
|
minInsertFlowConfidence: 0.85,
|
|
15
19
|
};
|
|
16
20
|
function normalizeAlias(raw) {
|
|
17
21
|
return raw
|
|
18
22
|
.trim()
|
|
19
|
-
.replace(/\\/g,
|
|
20
|
-
.replace(/^\.\//,
|
|
21
|
-
.replace(/\/+$/,
|
|
23
|
+
.replace(/\\/g, '/')
|
|
24
|
+
.replace(/^\.\//, '')
|
|
25
|
+
.replace(/\/+$/, '')
|
|
22
26
|
.toLowerCase();
|
|
23
27
|
}
|
|
24
28
|
function stripIndexSuffix(p) {
|
|
25
29
|
const normalized = normalizeAlias(p);
|
|
26
30
|
const base = path_1.default.posix.basename(normalized);
|
|
27
|
-
const stem = base.replace(/\.[^.]+$/,
|
|
28
|
-
if (stem !==
|
|
31
|
+
const stem = base.replace(/\.[^.]+$/, '');
|
|
32
|
+
if (stem !== 'index')
|
|
29
33
|
return normalized;
|
|
30
34
|
const dir = path_1.default.posix.dirname(normalized);
|
|
31
|
-
return dir ===
|
|
35
|
+
return dir === '.' ? normalized : normalizeAlias(dir);
|
|
32
36
|
}
|
|
33
37
|
function addAlias(aliasMap, alias, componentId) {
|
|
34
38
|
const key = normalizeAlias(alias);
|
|
@@ -79,10 +83,12 @@ function remapComponentPatchTarget(patch, componentIds, aliasMap) {
|
|
|
79
83
|
};
|
|
80
84
|
}
|
|
81
85
|
function proposalTargetKey(proposal) {
|
|
82
|
-
if (proposal.kind ===
|
|
83
|
-
const propKeys = Object.keys(proposal.setProperties ?? {})
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
if (proposal.kind === 'component_patch') {
|
|
87
|
+
const propKeys = Object.keys(proposal.setProperties ?? {})
|
|
88
|
+
.sort()
|
|
89
|
+
.join('|');
|
|
90
|
+
const sub = proposal.setSubType ? `sub:${proposal.setSubType}` : '';
|
|
91
|
+
const desc = proposal.setDescription ? 'desc' : '';
|
|
86
92
|
return `component:${proposal.targetComponentId}:${propKeys}:${sub}:${desc}`;
|
|
87
93
|
}
|
|
88
94
|
if (proposal.targetFlowId) {
|
|
@@ -93,8 +99,8 @@ function proposalTargetKey(proposal) {
|
|
|
93
99
|
function proposalRank(proposal) {
|
|
94
100
|
const confidenceScore = proposal.confidence.score;
|
|
95
101
|
const evidenceWeight = proposal.evidence.length / 100;
|
|
96
|
-
const insertPenalty = proposal.kind ===
|
|
97
|
-
const llmBonus = proposal.provider !==
|
|
102
|
+
const insertPenalty = proposal.kind === 'flow_patch' && proposal.insertIfMissing ? -0.02 : 0;
|
|
103
|
+
const llmBonus = proposal.provider !== 'mock' ? 0.25 : 0;
|
|
98
104
|
return confidenceScore + evidenceWeight + insertPenalty + llmBonus;
|
|
99
105
|
}
|
|
100
106
|
function sortedProposals(proposals) {
|
|
@@ -111,7 +117,7 @@ function sortedProposals(proposals) {
|
|
|
111
117
|
}
|
|
112
118
|
function toProvenance(proposal, confidence) {
|
|
113
119
|
return {
|
|
114
|
-
source:
|
|
120
|
+
source: 'ai_agent',
|
|
115
121
|
provider: proposal.provider,
|
|
116
122
|
model: proposal.model,
|
|
117
123
|
agent: proposal.agent,
|
|
@@ -121,11 +127,164 @@ function toProvenance(proposal, confidence) {
|
|
|
121
127
|
evidence: proposal.evidence,
|
|
122
128
|
};
|
|
123
129
|
}
|
|
130
|
+
function evidenceRefsForDataAction(patch) {
|
|
131
|
+
const fromProperty = patch.propertyEvidence?.[provider_contract_1.UI_DATA_ACTION_PROPERTY_KEY];
|
|
132
|
+
if (Array.isArray(fromProperty) && fromProperty.length > 0)
|
|
133
|
+
return fromProperty;
|
|
134
|
+
return patch.evidence;
|
|
135
|
+
}
|
|
136
|
+
function isEvidenceRef(value) {
|
|
137
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
138
|
+
return false;
|
|
139
|
+
const ref = value;
|
|
140
|
+
return (typeof ref.filePath === 'string' &&
|
|
141
|
+
typeof ref.startLine === 'number' &&
|
|
142
|
+
typeof ref.endLine === 'number' &&
|
|
143
|
+
typeof ref.reason === 'string');
|
|
144
|
+
}
|
|
145
|
+
function readExistingPropertyEvidence(raw) {
|
|
146
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
147
|
+
return {};
|
|
148
|
+
const out = {};
|
|
149
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
150
|
+
if (!Array.isArray(value))
|
|
151
|
+
continue;
|
|
152
|
+
const refs = value.filter(isEvidenceRef);
|
|
153
|
+
if (refs.length > 0)
|
|
154
|
+
out[key] = refs;
|
|
155
|
+
}
|
|
156
|
+
return out;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Persist AI per-property evidence onto the component so graph-mapping can
|
|
160
|
+
* flatten it to node.data.propertyEvidence (not dropped after merge).
|
|
161
|
+
*/
|
|
162
|
+
function mergePropertyEvidenceMap(existingRaw, incoming) {
|
|
163
|
+
if (!incoming || Object.keys(incoming).length === 0) {
|
|
164
|
+
const existing = readExistingPropertyEvidence(existingRaw);
|
|
165
|
+
return {
|
|
166
|
+
next: Object.keys(existing).length > 0 ? existing : undefined,
|
|
167
|
+
changed: false,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const next = readExistingPropertyEvidence(existingRaw);
|
|
171
|
+
let changed = false;
|
|
172
|
+
for (const [key, refs] of Object.entries(incoming)) {
|
|
173
|
+
if (!Array.isArray(refs) || refs.length === 0)
|
|
174
|
+
continue;
|
|
175
|
+
const validRefs = refs.filter(isEvidenceRef);
|
|
176
|
+
if (validRefs.length === 0)
|
|
177
|
+
continue;
|
|
178
|
+
const current = next[key] ?? [];
|
|
179
|
+
if ((0, util_1.isDeepStrictEqual)(current, validRefs))
|
|
180
|
+
continue;
|
|
181
|
+
// Prefer incoming refs for this key; keep unrelated keys intact.
|
|
182
|
+
next[key] = validRefs;
|
|
183
|
+
changed = true;
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
next: Object.keys(next).length > 0 ? next : undefined,
|
|
187
|
+
changed,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function toSourceLocations(refs) {
|
|
191
|
+
return refs.map((ref) => ({
|
|
192
|
+
filePath: ref.filePath,
|
|
193
|
+
startLine: ref.startLine,
|
|
194
|
+
endLine: ref.endLine,
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Build an AI-sourced assignment for one verb.
|
|
199
|
+
* Relay uses topology corroboration so mergeOneAssignment may assert it (conservative-absence rule).
|
|
200
|
+
*/
|
|
201
|
+
function buildAiDataActionAssignment(action, patch) {
|
|
202
|
+
const refs = evidenceRefsForDataAction(patch);
|
|
203
|
+
const reason = refs
|
|
204
|
+
.map((r) => r.reason.trim())
|
|
205
|
+
.filter(Boolean)
|
|
206
|
+
.join('; ') || 'ai enrichment evidence';
|
|
207
|
+
if (action === 'relay') {
|
|
208
|
+
return {
|
|
209
|
+
action: 'relay',
|
|
210
|
+
source: 'ai',
|
|
211
|
+
confidence: patch.confidence.score,
|
|
212
|
+
status: 'asserted',
|
|
213
|
+
evidence: {
|
|
214
|
+
kind: 'pattern_rule',
|
|
215
|
+
description: reason,
|
|
216
|
+
corroboration: reason,
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
action,
|
|
222
|
+
source: 'ai',
|
|
223
|
+
confidence: patch.confidence.score,
|
|
224
|
+
status: 'asserted',
|
|
225
|
+
evidence: toSourceLocations(refs),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function parseProposedDataActions(raw) {
|
|
229
|
+
if (raw == null)
|
|
230
|
+
return [];
|
|
231
|
+
const values = Array.isArray(raw) ? raw : [raw];
|
|
232
|
+
const out = [];
|
|
233
|
+
const seen = new Set();
|
|
234
|
+
for (const value of values) {
|
|
235
|
+
const action = (0, scanner_1.normalizeDataAction)(String(value));
|
|
236
|
+
if (!action || seen.has(action))
|
|
237
|
+
continue;
|
|
238
|
+
seen.add(action);
|
|
239
|
+
out.push(action);
|
|
240
|
+
}
|
|
241
|
+
return out;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Merge AI-proposed `data_action` verbs into set-valued `properties.dataActions`.
|
|
245
|
+
* Adds / promotes only; never removes deterministic or user assignments.
|
|
246
|
+
*/
|
|
247
|
+
function mergeDataActionProperties(component, patch, proposedRaw) {
|
|
248
|
+
if (!(0, scanner_1.componentMayCarryDataActions)(component.type)) {
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
if (patch.confidence.score < exports.DATA_ACTION_MIN_CONFIDENCE) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const proposed = parseProposedDataActions(proposedRaw);
|
|
255
|
+
if (proposed.length === 0)
|
|
256
|
+
return false;
|
|
257
|
+
const refs = evidenceRefsForDataAction(patch);
|
|
258
|
+
if (refs.length === 0)
|
|
259
|
+
return false;
|
|
260
|
+
let merged = [...(0, scanner_1.readDataActions)(component)];
|
|
261
|
+
const before = JSON.stringify(merged);
|
|
262
|
+
for (const action of proposed) {
|
|
263
|
+
merged = (0, scanner_1.mergeOneAssignment)(merged, buildAiDataActionAssignment(action, patch));
|
|
264
|
+
}
|
|
265
|
+
merged.sort((a, b) => a.action.localeCompare(b.action));
|
|
266
|
+
if (JSON.stringify(merged) === before) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
component.properties = {
|
|
270
|
+
...component.properties,
|
|
271
|
+
dataActions: merged,
|
|
272
|
+
};
|
|
273
|
+
const primary = (0, scanner_1.selectPrimaryDataAction)(merged);
|
|
274
|
+
if (primary) {
|
|
275
|
+
component.properties.primaryDataAction = primary;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
delete component.properties.primaryDataAction;
|
|
279
|
+
}
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
124
282
|
function mergeComponentPatch(components, patch) {
|
|
125
283
|
const component = components.find((item) => item.id === patch.targetComponentId);
|
|
126
284
|
if (!component)
|
|
127
285
|
return false;
|
|
128
286
|
let changed = false;
|
|
287
|
+
const acceptedEvidenceKeys = new Set();
|
|
129
288
|
const normalizedSubType = (0, third_party_subtype_1.normalizeThirdPartySubType)(patch.setSubType);
|
|
130
289
|
if (normalizedSubType && normalizedSubType !== component.subType) {
|
|
131
290
|
component.subType = normalizedSubType;
|
|
@@ -135,19 +294,50 @@ function mergeComponentPatch(components, patch) {
|
|
|
135
294
|
component.description = patch.setDescription;
|
|
136
295
|
changed = true;
|
|
137
296
|
}
|
|
297
|
+
const setProperties = patch.setProperties ?? {};
|
|
298
|
+
const dataActionRaw = setProperties[provider_contract_1.UI_DATA_ACTION_PROPERTY_KEY] ?? setProperties.dataActions;
|
|
299
|
+
if (dataActionRaw !== undefined) {
|
|
300
|
+
if (mergeDataActionProperties(component, patch, dataActionRaw)) {
|
|
301
|
+
changed = true;
|
|
302
|
+
acceptedEvidenceKeys.add(provider_contract_1.UI_DATA_ACTION_PROPERTY_KEY);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
138
305
|
const currentProperties = component.properties ?? {};
|
|
139
306
|
const nextProperties = { ...currentProperties };
|
|
140
|
-
for (const [key, value] of Object.entries(
|
|
307
|
+
for (const [key, value] of Object.entries(setProperties)) {
|
|
308
|
+
if (key === provider_contract_1.UI_DATA_ACTION_PROPERTY_KEY || key === 'dataActions') {
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
141
311
|
const currentValue = currentProperties[key];
|
|
142
|
-
if (key ===
|
|
312
|
+
if (key === 'inference_status' && value === 'needs_review') {
|
|
143
313
|
continue;
|
|
144
314
|
}
|
|
145
315
|
const normalizedCurrent = normalizeEmptyLikeValue(currentValue);
|
|
146
316
|
const normalizedNext = normalizeEmptyLikeValue(value);
|
|
317
|
+
if (normalizedCurrent !== '__empty__') {
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (normalizedNext === '__empty__') {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
147
323
|
if ((0, util_1.isDeepStrictEqual)(normalizedCurrent, normalizedNext)) {
|
|
148
324
|
continue;
|
|
149
325
|
}
|
|
150
326
|
nextProperties[key] = value;
|
|
327
|
+
acceptedEvidenceKeys.add(key);
|
|
328
|
+
changed = true;
|
|
329
|
+
}
|
|
330
|
+
const acceptedEvidence = patch.propertyEvidence
|
|
331
|
+
? Object.fromEntries(Object.entries(patch.propertyEvidence).filter(([key]) => acceptedEvidenceKeys.has(key)))
|
|
332
|
+
: undefined;
|
|
333
|
+
const evidenceMerge = mergePropertyEvidenceMap(currentProperties.propertyEvidence, acceptedEvidence);
|
|
334
|
+
if (evidenceMerge.next) {
|
|
335
|
+
nextProperties.propertyEvidence = evidenceMerge.next;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
delete nextProperties.propertyEvidence;
|
|
339
|
+
}
|
|
340
|
+
if (evidenceMerge.changed) {
|
|
151
341
|
changed = true;
|
|
152
342
|
}
|
|
153
343
|
component.properties = nextProperties;
|
|
@@ -155,12 +345,12 @@ function mergeComponentPatch(components, patch) {
|
|
|
155
345
|
}
|
|
156
346
|
function normalizeEmptyLikeValue(value) {
|
|
157
347
|
if (value == null)
|
|
158
|
-
return
|
|
159
|
-
if (typeof value ===
|
|
160
|
-
return
|
|
348
|
+
return '__empty__';
|
|
349
|
+
if (typeof value === 'string' && value.trim().toLowerCase() === 'none') {
|
|
350
|
+
return '__empty__';
|
|
161
351
|
}
|
|
162
352
|
if (Array.isArray(value) && value.length === 0)
|
|
163
|
-
return
|
|
353
|
+
return '__empty__';
|
|
164
354
|
return value;
|
|
165
355
|
}
|
|
166
356
|
function normalizeSectionId(raw) {
|
|
@@ -213,7 +403,7 @@ function mergeFlowPatch(flows, patch) {
|
|
|
213
403
|
id: `flow_ai_${patch.sourceComponentId}_${patch.targetComponentId}_${flows.length + 1}`,
|
|
214
404
|
sourceComponentId: patch.sourceComponentId,
|
|
215
405
|
targetComponentId: patch.targetComponentId,
|
|
216
|
-
type: patch.setType ??
|
|
406
|
+
type: patch.setType ?? 'api_call',
|
|
217
407
|
description: patch.setDescription,
|
|
218
408
|
confidence: patch.confidence.score,
|
|
219
409
|
method: patch.setMethod,
|
|
@@ -252,26 +442,26 @@ function mergeAiProposals(components, dataFlows, proposals, thresholds = {}, opt
|
|
|
252
442
|
const aliasMap = buildComponentAliasMap(nextComponents);
|
|
253
443
|
const componentsById = new Map(nextComponents.map((c) => [c.id, c]));
|
|
254
444
|
for (const { id, proposal } of sortedProposals(proposals)) {
|
|
255
|
-
const resolvedProposal = proposal.kind ===
|
|
445
|
+
const resolvedProposal = proposal.kind === 'component_patch'
|
|
256
446
|
? remapComponentPatchTarget(proposal, componentIds, aliasMap)
|
|
257
447
|
: proposal;
|
|
258
|
-
if (options.preserveDataFlowTopology && proposal.kind ===
|
|
448
|
+
if (options.preserveDataFlowTopology && proposal.kind === 'flow_patch') {
|
|
259
449
|
rejectedProposalIds.push({
|
|
260
450
|
proposalId: id,
|
|
261
|
-
reason:
|
|
451
|
+
reason: 'data_flow_topology_preserved',
|
|
262
452
|
});
|
|
263
453
|
continue;
|
|
264
454
|
}
|
|
265
455
|
if (options.enforceIntraSectionFlowChangesOnly &&
|
|
266
|
-
resolvedProposal.kind ===
|
|
456
|
+
resolvedProposal.kind === 'flow_patch' &&
|
|
267
457
|
!isIntraSectionFlowPatch(resolvedProposal, componentsById, nextFlows)) {
|
|
268
458
|
rejectedProposalIds.push({
|
|
269
459
|
proposalId: id,
|
|
270
|
-
reason:
|
|
460
|
+
reason: 'cross_section_flow_change_blocked',
|
|
271
461
|
});
|
|
272
462
|
continue;
|
|
273
463
|
}
|
|
274
|
-
const minConfidence = resolvedProposal.kind ===
|
|
464
|
+
const minConfidence = resolvedProposal.kind === 'component_patch'
|
|
275
465
|
? mergedThresholds.minComponentPatchConfidence
|
|
276
466
|
: resolvedProposal.insertIfMissing
|
|
277
467
|
? mergedThresholds.minInsertFlowConfidence
|
|
@@ -284,33 +474,33 @@ function mergeAiProposals(components, dataFlows, proposals, thresholds = {}, opt
|
|
|
284
474
|
continue;
|
|
285
475
|
}
|
|
286
476
|
if (resolvedProposal.evidence.length === 0) {
|
|
287
|
-
rejectedProposalIds.push({ proposalId: id, reason:
|
|
477
|
+
rejectedProposalIds.push({ proposalId: id, reason: 'missing_evidence' });
|
|
288
478
|
continue;
|
|
289
479
|
}
|
|
290
480
|
const targetKey = proposalTargetKey(resolvedProposal);
|
|
291
481
|
if (provenanceByTarget[targetKey]) {
|
|
292
482
|
rejectedProposalIds.push({
|
|
293
483
|
proposalId: id,
|
|
294
|
-
reason:
|
|
484
|
+
reason: 'target_already_modified_by_higher_ranked_proposal',
|
|
295
485
|
});
|
|
296
486
|
continue;
|
|
297
487
|
}
|
|
298
|
-
const merged = resolvedProposal.kind ===
|
|
488
|
+
const merged = resolvedProposal.kind === 'component_patch'
|
|
299
489
|
? mergeComponentPatch(nextComponents, resolvedProposal)
|
|
300
490
|
: mergeFlowPatch(nextFlows, resolvedProposal);
|
|
301
491
|
if (!merged) {
|
|
302
492
|
rejectedProposalIds.push({
|
|
303
493
|
proposalId: id,
|
|
304
|
-
reason: resolvedProposal.kind ===
|
|
305
|
-
?
|
|
306
|
-
:
|
|
494
|
+
reason: resolvedProposal.kind === 'component_patch'
|
|
495
|
+
? 'no_meaningful_changes'
|
|
496
|
+
: 'target_not_found',
|
|
307
497
|
});
|
|
308
498
|
continue;
|
|
309
499
|
}
|
|
310
500
|
appliedProposalIds.push(id);
|
|
311
501
|
provenanceByTarget[targetKey] = toProvenance(resolvedProposal, resolvedProposal.confidence.score);
|
|
312
502
|
}
|
|
313
|
-
(0,
|
|
503
|
+
(0, scanner_1.sortDataFlowsDeterministically)(nextFlows);
|
|
314
504
|
return {
|
|
315
505
|
components: nextComponents,
|
|
316
506
|
dataFlows: nextFlows,
|
|
@@ -9,6 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const yaml_1 = __importDefault(require("yaml"));
|
|
11
11
|
const zod_1 = require("zod");
|
|
12
|
+
const scanner_package_root_1 = require("../scanner-package-root");
|
|
12
13
|
const nonPiiSignalRuleSchema = zod_1.z.object({
|
|
13
14
|
id: zod_1.z.string().min(1),
|
|
14
15
|
category: zod_1.z.enum(["auth_artifacts", "usage_metadata", "telemetry", "content_files", "identifiers"]),
|
|
@@ -25,12 +26,7 @@ function clearNonPiiSignalRulesCacheForTest() {
|
|
|
25
26
|
cachedRules = undefined;
|
|
26
27
|
}
|
|
27
28
|
function getNonPiiSignalRulesPath() {
|
|
28
|
-
|
|
29
|
-
const distIndex = parts.lastIndexOf("dist");
|
|
30
|
-
const cliRoot = distIndex !== -1
|
|
31
|
-
? parts.slice(0, distIndex).join(path_1.default.sep)
|
|
32
|
-
: path_1.default.resolve(__dirname, "..", "..");
|
|
33
|
-
return path_1.default.join(cliRoot, "patterns", "non-pii-signals.rules.yaml");
|
|
29
|
+
return path_1.default.join((0, scanner_package_root_1.getScannerPackageRoot)(), "patterns", "non-pii-signals.rules.yaml");
|
|
34
30
|
}
|
|
35
31
|
function loadNonPiiSignalRules() {
|
|
36
32
|
if (cachedRules)
|
|
@@ -57,8 +57,8 @@ export declare const openAiProposalsResponseSchema: z.ZodObject<{
|
|
|
57
57
|
rpc: "rpc";
|
|
58
58
|
}>>;
|
|
59
59
|
setDirection: z.ZodOptional<z.ZodEnum<{
|
|
60
|
-
reverse: "reverse";
|
|
61
60
|
forward: "forward";
|
|
61
|
+
reverse: "reverse";
|
|
62
62
|
}>>;
|
|
63
63
|
setMethod: z.ZodOptional<z.ZodString>;
|
|
64
64
|
setEndpoint: z.ZodOptional<z.ZodString>;
|
|
@@ -9,6 +9,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const yaml_1 = __importDefault(require("yaml"));
|
|
11
11
|
const zod_1 = require("zod");
|
|
12
|
+
const scanner_package_root_1 = require("../scanner-package-root");
|
|
12
13
|
const piiSignalRuleSchema = zod_1.z.object({
|
|
13
14
|
id: zod_1.z.string().min(1),
|
|
14
15
|
category: zod_1.z.enum(["identifiers", "profile_data", "credentials"]),
|
|
@@ -23,12 +24,7 @@ function clearPiiSignalRulesCacheForTest() {
|
|
|
23
24
|
cachedRules = undefined;
|
|
24
25
|
}
|
|
25
26
|
function getPiiSignalRulesPath() {
|
|
26
|
-
|
|
27
|
-
const distIndex = parts.lastIndexOf("dist");
|
|
28
|
-
const cliRoot = distIndex !== -1
|
|
29
|
-
? parts.slice(0, distIndex).join(path_1.default.sep)
|
|
30
|
-
: path_1.default.resolve(__dirname, "..", "..");
|
|
31
|
-
return path_1.default.join(cliRoot, "patterns", "pii-signals.rules.yaml");
|
|
27
|
+
return path_1.default.join((0, scanner_package_root_1.getScannerPackageRoot)(), "patterns", "pii-signals.rules.yaml");
|
|
32
28
|
}
|
|
33
29
|
function loadPiiSignalRules() {
|
|
34
30
|
if (cachedRules)
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* so each provider can compose instructions without duplicating the full contract text.
|
|
4
4
|
*/
|
|
5
5
|
/** Shared system instructions for OpenAI, Anthropic, Gemini, and local/Ollama providers. */
|
|
6
|
-
export declare const AI_PROVIDER_SYSTEM_PROMPT = "You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key \"proposals\" (array). No markdown fences.\n\nPrimary goal: **only** populate node properties when each value is **directly supported** by code or config text in `relevantFileContents` (when present) or by explicit paths in `detectedFrom` / `sourceLocations` for that component. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals
|
|
6
|
+
export declare const AI_PROVIDER_SYSTEM_PROMPT = "You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key \"proposals\" (array). No markdown fences.\n\nPrimary goal: **only** populate node properties when each value is **directly supported** by code or config text in `relevantFileContents` (when present) or by explicit paths in `detectedFrom` / `sourceLocations` for that component. Walk every key in `sparsePropertyKeys` and emit every key you can directly cite. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals when no sparse key is grounded.\n\nUse **ComponentPatch only** in the proposals array (schema may list a flow variant for compatibility; omit it).\n\nComponentPatch (property filling):\n- kind: \"component_patch\"\n- targetComponentId: string (**must exactly equal one of the componentContext object keys / canonical component IDs**)\n- candidateType: match the user payload agent/candidates (usually \"third_party\" or \"node_property\")\n- setSubType: string \u2014 **required** when componentContext.subType is empty/null; use one taxonomy token: b2b_customer, saas_service, payment_processor, cloud_provider, api_provider, ai_provider, data_provider, government_regulator, partner, ad_network, professional_services, data_processor, other (snake_case). Omit setSubType only when componentContext already has subType.\n- setDescription?: string when helpful\n- setProperties: object with snake_case keys; **only** keys you can tie to cited evidence (see propertyEvidence)\n- propertyEvidence: **required**. Object whose keys are exactly the keys you put in setProperties; each value is a **non-empty** array of evidence rows: { \"filePath\", \"startLine\", \"endLine\", \"reason\" }. Every property must cite where in the repo that value comes from; different properties may cite different files or line ranges.\n- confidence: { \"score\": number 0.72\u20130.95 when patch is well supported, \"band\": \"high\" | \"medium\" | \"low\" }\n- evidence: optional legacy field; prefer propertyEvidence only.\n\nEmit every grounded sparse key. You may split one target component across multiple ComponentPatch proposals when each patch has a different, disjoint set of property keys.\n\n**Do not emit FlowPatch proposals.** Connectivity comes from deterministic scan rules.\n\nRules:\n- Do not contradict propertiesSet unless fixing a clear error with cited proof.\n- `targetComponentId` must be a canonical component ID from componentContext keys only. Never emit file paths or folder names as targetComponentId.\n- **Anti-fabrication:** same as above \u2014 if the fact is not in the cited lines / excerpt text, omit the property.\n- Do not emit placeholder `setProperties` values (null, \"none\", empty arrays, empty strings), and do not set `inference_status`.\n\nsetProperties value shapes: use snake_case keys from sparsePropertyKeys. integration_method must be a string array (e.g. [\"api\"]), never a single string. authentication_method must be one string token (e.g. api_key, oauth_2_0), never an array. processing_purpose must be a string array of taxonomy tokens (authentication, security, analytics, service_provision, payment_processing, marketing, compliance, other, etc.)\u2014snake_case. data_action must be a string array of canonical privacy verbs (collect, generate, store, transform, use, combine, disclose, relay, display, log, delete); a node may have multiple verbs; never emit data_action for actors; propose relay only with cited corroboration. Other multi-value fields must be string arrays, not comma-joined strings.";
|
|
7
7
|
/**
|
|
8
8
|
* Anthropic has no server-side JSON schema for this path; truncated output yields invalid JSON.
|
|
9
9
|
* Reinforce brevity so the model completes a single well-formed object.
|
|
10
10
|
*/
|
|
11
|
-
export declare const ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = "Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence \"reason\" to one short clause. If many properties
|
|
11
|
+
export declare const ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = "Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence \"reason\" to one short clause. If one component has many grounded properties, chunk them into multiple ComponentPatch proposals with different key sets so the JSON always completes; do not skip grounded keys and never stop mid-string or mid-object.";
|
|
12
12
|
export declare function buildAnthropicEnrichmentSystemPrompt(): string;
|
|
@@ -9,7 +9,7 @@ exports.buildAnthropicEnrichmentSystemPrompt = buildAnthropicEnrichmentSystemPro
|
|
|
9
9
|
/** Shared system instructions for OpenAI, Anthropic, Gemini, and local/Ollama providers. */
|
|
10
10
|
exports.AI_PROVIDER_SYSTEM_PROMPT = `You are enriching a DataParade data-flow scan. Respond with a JSON object matching the response schema: top-level key "proposals" (array). No markdown fences.
|
|
11
11
|
|
|
12
|
-
Primary goal: **only** populate node properties when each value is **directly supported** by code or config text in \`relevantFileContents\` (when present) or by explicit paths in \`detectedFrom\` / \`sourceLocations\` for that component. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals
|
|
12
|
+
Primary goal: **only** populate node properties when each value is **directly supported** by code or config text in \`relevantFileContents\` (when present) or by explicit paths in \`detectedFrom\` / \`sourceLocations\` for that component. Walk every key in \`sparsePropertyKeys\` and emit every key you can directly cite. If support is weak, indirect, or guessed, **omit** the property. It is always valid to return **zero** proposals when no sparse key is grounded.
|
|
13
13
|
|
|
14
14
|
Use **ComponentPatch only** in the proposals array (schema may list a flow variant for compatibility; omit it).
|
|
15
15
|
|
|
@@ -24,7 +24,7 @@ ComponentPatch (property filling):
|
|
|
24
24
|
- confidence: { "score": number 0.72–0.95 when patch is well supported, "band": "high" | "medium" | "low" }
|
|
25
25
|
- evidence: optional legacy field; prefer propertyEvidence only.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Emit every grounded sparse key. You may split one target component across multiple ComponentPatch proposals when each patch has a different, disjoint set of property keys.
|
|
28
28
|
|
|
29
29
|
**Do not emit FlowPatch proposals.** Connectivity comes from deterministic scan rules.
|
|
30
30
|
|
|
@@ -34,12 +34,12 @@ Rules:
|
|
|
34
34
|
- **Anti-fabrication:** same as above — if the fact is not in the cited lines / excerpt text, omit the property.
|
|
35
35
|
- Do not emit placeholder \`setProperties\` values (null, "none", empty arrays, empty strings), and do not set \`inference_status\`.
|
|
36
36
|
|
|
37
|
-
setProperties value shapes: use snake_case keys from sparsePropertyKeys. integration_method must be a string array (e.g. ["api"]), never a single string. authentication_method must be one string token (e.g. api_key, oauth_2_0), never an array. processing_purpose must be a string array of taxonomy tokens (authentication, security, analytics, service_provision, payment_processing, marketing, compliance, other, etc.)—snake_case. Other multi-value fields must be string arrays, not comma-joined strings.`;
|
|
37
|
+
setProperties value shapes: use snake_case keys from sparsePropertyKeys. integration_method must be a string array (e.g. ["api"]), never a single string. authentication_method must be one string token (e.g. api_key, oauth_2_0), never an array. processing_purpose must be a string array of taxonomy tokens (authentication, security, analytics, service_provision, payment_processing, marketing, compliance, other, etc.)—snake_case. data_action must be a string array of canonical privacy verbs (collect, generate, store, transform, use, combine, disclose, relay, display, log, delete); a node may have multiple verbs; never emit data_action for actors; propose relay only with cited corroboration. Other multi-value fields must be string arrays, not comma-joined strings.`;
|
|
38
38
|
/**
|
|
39
39
|
* Anthropic has no server-side JSON schema for this path; truncated output yields invalid JSON.
|
|
40
40
|
* Reinforce brevity so the model completes a single well-formed object.
|
|
41
41
|
*/
|
|
42
|
-
exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = `Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence "reason" to one short clause. If many properties
|
|
42
|
+
exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT = `Output discipline: Your entire reply must be one parseable JSON object (no markdown). Keep each propertyEvidence "reason" to one short clause. If one component has many grounded properties, chunk them into multiple ComponentPatch proposals with different key sets so the JSON always completes; do not skip grounded keys and never stop mid-string or mid-object.`;
|
|
43
43
|
function buildAnthropicEnrichmentSystemPrompt() {
|
|
44
44
|
return `${exports.AI_PROVIDER_SYSTEM_PROMPT}\n\n${exports.ANTHROPIC_ENRICHMENT_SYSTEM_PROMPT_SUPPLEMENT}`;
|
|
45
45
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortPropertyKeysByPriority = sortPropertyKeysByPriority;
|
|
4
|
+
const TIER_1_PROPERTY_KEYS = new Set([
|
|
5
|
+
'data_action',
|
|
6
|
+
'encrypt_at_rest',
|
|
7
|
+
'encryption_at_rest',
|
|
8
|
+
'authentication_method',
|
|
9
|
+
'authentication_methods',
|
|
10
|
+
'gdpr_role',
|
|
11
|
+
]);
|
|
12
|
+
/**
|
|
13
|
+
* Keep high-value privacy and security fields at the front of bounded prompts.
|
|
14
|
+
* Remaining keys retain deterministic alphabetical order.
|
|
15
|
+
*/
|
|
16
|
+
function sortPropertyKeysByPriority(keys) {
|
|
17
|
+
return [...keys].sort((a, b) => {
|
|
18
|
+
const tierDelta = Number(TIER_1_PROPERTY_KEYS.has(b)) - Number(TIER_1_PROPERTY_KEYS.has(a));
|
|
19
|
+
if (tierDelta !== 0)
|
|
20
|
+
return tierDelta;
|
|
21
|
+
return a.localeCompare(b);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ServiceSection } from
|
|
2
|
-
import type { DetectedComponent } from
|
|
3
|
-
import type { DetectedDataFlow } from
|
|
4
|
-
import type { FileInfo } from
|
|
5
|
-
import type { AiAgentName, AiInferenceCandidate } from
|
|
1
|
+
import type { ServiceSection } from '@dataparade/scanner';
|
|
2
|
+
import type { DetectedComponent } from '../core/types/component';
|
|
3
|
+
import type { DetectedDataFlow } from '../core/types/data-flow';
|
|
4
|
+
import type { FileInfo } from '../core/types/file';
|
|
5
|
+
import type { AiAgentName, AiInferenceCandidate } from './types';
|
|
6
6
|
/**
|
|
7
7
|
* Collect repo-relative paths tied to queued candidates (components and flow endpoints).
|
|
8
8
|
*/
|