@dataparade/cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +592 -0
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.js +7 -0
- package/dist/bin/load-env.d.ts +2 -0
- package/dist/bin/load-env.js +4 -0
- package/dist/src/ai-enrichment/agent-orchestrator.d.ts +28 -0
- package/dist/src/ai-enrichment/agent-orchestrator.js +476 -0
- package/dist/src/ai-enrichment/agents/index.d.ts +4 -0
- package/dist/src/ai-enrichment/agents/index.js +50 -0
- package/dist/src/ai-enrichment/candidate-selector.d.ts +10 -0
- package/dist/src/ai-enrichment/candidate-selector.js +158 -0
- package/dist/src/ai-enrichment/fallbacks.d.ts +6 -0
- package/dist/src/ai-enrichment/fallbacks.js +762 -0
- package/dist/src/ai-enrichment/index.d.ts +15 -0
- package/dist/src/ai-enrichment/index.js +31 -0
- package/dist/src/ai-enrichment/merge-rules.d.ts +12 -0
- package/dist/src/ai-enrichment/merge-rules.js +321 -0
- package/dist/src/ai-enrichment/non-pii-signal-rules.d.ts +10 -0
- package/dist/src/ai-enrichment/non-pii-signal-rules.js +72 -0
- package/dist/src/ai-enrichment/openai-proposals-response.schema.d.ts +94 -0
- package/dist/src/ai-enrichment/openai-proposals-response.schema.js +82 -0
- package/dist/src/ai-enrichment/pii-signal-rules.d.ts +8 -0
- package/dist/src/ai-enrichment/pii-signal-rules.js +68 -0
- package/dist/src/ai-enrichment/pipeline.d.ts +2 -0
- package/dist/src/ai-enrichment/pipeline.js +48 -0
- package/dist/src/ai-enrichment/planner.d.ts +2 -0
- package/dist/src/ai-enrichment/planner.js +60 -0
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.d.ts +12 -0
- package/dist/src/ai-enrichment/prompts/provider-enrichment-prompts.js +45 -0
- package/dist/src/ai-enrichment/provider-prompt.d.ts +32 -0
- package/dist/src/ai-enrichment/provider-prompt.js +222 -0
- package/dist/src/ai-enrichment/provider-topology-rules.d.ts +52 -0
- package/dist/src/ai-enrichment/provider-topology-rules.js +190 -0
- package/dist/src/ai-enrichment/provider-topology-shared.d.ts +48 -0
- package/dist/src/ai-enrichment/provider-topology-shared.js +329 -0
- package/dist/src/ai-enrichment/providers/endpoint-resolution.d.ts +13 -0
- package/dist/src/ai-enrichment/providers/endpoint-resolution.js +41 -0
- package/dist/src/ai-enrichment/providers/families/chat-completions-family.d.ts +13 -0
- package/dist/src/ai-enrichment/providers/families/chat-completions-family.js +181 -0
- package/dist/src/ai-enrichment/providers/families/generate-content-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/generate-content-family.js +93 -0
- package/dist/src/ai-enrichment/providers/families/messages-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/messages-family.js +86 -0
- package/dist/src/ai-enrichment/providers/families/ollama-generate-family.d.ts +10 -0
- package/dist/src/ai-enrichment/providers/families/ollama-generate-family.js +69 -0
- package/dist/src/ai-enrichment/providers/fetch-with-timeout.d.ts +2 -0
- package/dist/src/ai-enrichment/providers/fetch-with-timeout.js +22 -0
- package/dist/src/ai-enrichment/providers/index.d.ts +16 -0
- package/dist/src/ai-enrichment/providers/index.js +40 -0
- package/dist/src/ai-enrichment/providers/mock.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/mock.js +12 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.d.ts +20 -0
- package/dist/src/ai-enrichment/providers/platform-proxy-provider.js +116 -0
- package/dist/src/ai-enrichment/providers/presets.d.ts +14 -0
- package/dist/src/ai-enrichment/providers/presets.js +50 -0
- package/dist/src/ai-enrichment/providers/provider-contract.d.ts +20 -0
- package/dist/src/ai-enrichment/providers/provider-contract.js +703 -0
- package/dist/src/ai-enrichment/providers/provider-json-parse.d.ts +23 -0
- package/dist/src/ai-enrichment/providers/provider-json-parse.js +96 -0
- package/dist/src/ai-enrichment/providers/provider-output-token-budget.d.ts +5 -0
- package/dist/src/ai-enrichment/providers/provider-output-token-budget.js +11 -0
- package/dist/src/ai-enrichment/providers/provider-pricing.d.ts +7 -0
- package/dist/src/ai-enrichment/providers/provider-pricing.js +32 -0
- package/dist/src/ai-enrichment/providers/provider-runtime.d.ts +9 -0
- package/dist/src/ai-enrichment/providers/provider-runtime.js +54 -0
- package/dist/src/ai-enrichment/providers/resolve-provider.d.ts +27 -0
- package/dist/src/ai-enrichment/providers/resolve-provider.js +41 -0
- package/dist/src/ai-enrichment/providers/types.d.ts +24 -0
- package/dist/src/ai-enrichment/providers/types.js +2 -0
- package/dist/src/ai-enrichment/scan-paths.d.ts +9 -0
- package/dist/src/ai-enrichment/scan-paths.js +28 -0
- package/dist/src/ai-enrichment/sensitive-paths.d.ts +5 -0
- package/dist/src/ai-enrichment/sensitive-paths.js +10 -0
- package/dist/src/ai-enrichment/third-party-data-flow.d.ts +27 -0
- package/dist/src/ai-enrichment/third-party-data-flow.js +518 -0
- package/dist/src/ai-enrichment/third-party-evidence.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-evidence.js +426 -0
- package/dist/src/ai-enrichment/third-party-property-matrix.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-property-matrix.js +52 -0
- package/dist/src/ai-enrichment/third-party-subtype.d.ts +14 -0
- package/dist/src/ai-enrichment/third-party-subtype.js +166 -0
- package/dist/src/ai-enrichment/tools/index.d.ts +39 -0
- package/dist/src/ai-enrichment/tools/index.js +121 -0
- package/dist/src/ai-enrichment/types.d.ts +170 -0
- package/dist/src/ai-enrichment/types.js +12 -0
- package/dist/src/analyzers/python/dependency-manifests.d.ts +8 -0
- package/dist/src/analyzers/python/dependency-manifests.js +131 -0
- package/dist/src/analyzers/python/detector.d.ts +3 -0
- package/dist/src/analyzers/python/detector.js +22 -0
- package/dist/src/analyzers/python/index.d.ts +2 -0
- package/dist/src/analyzers/python/index.js +11 -0
- package/dist/src/analyzers/python/manifest-parsers.d.ts +3 -0
- package/dist/src/analyzers/python/manifest-parsers.js +134 -0
- package/dist/src/analyzers/python/parser.d.ts +26 -0
- package/dist/src/analyzers/python/parser.js +187 -0
- package/dist/src/analyzers/python/patterns.d.ts +7 -0
- package/dist/src/analyzers/python/patterns.js +106 -0
- package/dist/src/analyzers/python/python-detection-config.d.ts +75 -0
- package/dist/src/analyzers/python/python-detection-config.js +148 -0
- package/dist/src/analyzers/registry.d.ts +13 -0
- package/dist/src/analyzers/registry.js +60 -0
- package/dist/src/analyzers/shared/manifest-budgets.d.ts +19 -0
- package/dist/src/analyzers/shared/manifest-budgets.js +21 -0
- package/dist/src/analyzers/shared/manifest-fs.d.ts +13 -0
- package/dist/src/analyzers/shared/manifest-fs.js +138 -0
- package/dist/src/analyzers/shared/property-inference.d.ts +8 -0
- package/dist/src/analyzers/shared/property-inference.js +165 -0
- package/dist/src/analyzers/terraform/detector.d.ts +10 -0
- package/dist/src/analyzers/terraform/detector.js +198 -0
- package/dist/src/analyzers/terraform/index.d.ts +2 -0
- package/dist/src/analyzers/terraform/index.js +13 -0
- package/dist/src/analyzers/terraform/parser.d.ts +29 -0
- package/dist/src/analyzers/terraform/parser.js +202 -0
- package/dist/src/analyzers/terraform/terraform-detection-config.d.ts +48 -0
- package/dist/src/analyzers/terraform/terraform-detection-config.js +218 -0
- package/dist/src/analyzers/terraform/terraform-exec.d.ts +11 -0
- package/dist/src/analyzers/terraform/terraform-exec.js +35 -0
- package/dist/src/analyzers/terraform/terraform-module-manifest.d.ts +19 -0
- package/dist/src/analyzers/terraform/terraform-module-manifest.js +75 -0
- package/dist/src/analyzers/terraform/terraform-show-json.d.ts +15 -0
- package/dist/src/analyzers/terraform/terraform-show-json.js +188 -0
- package/dist/src/analyzers/terraform/terraform-utility-resource.d.ts +12 -0
- package/dist/src/analyzers/terraform/terraform-utility-resource.js +30 -0
- package/dist/src/analyzers/types.d.ts +5 -0
- package/dist/src/analyzers/types.js +2 -0
- package/dist/src/analyzers/typescript/actor-detection.d.ts +4 -0
- package/dist/src/analyzers/typescript/actor-detection.js +15 -0
- package/dist/src/analyzers/typescript/dependency-manifests.d.ts +9 -0
- package/dist/src/analyzers/typescript/dependency-manifests.js +131 -0
- package/dist/src/analyzers/typescript/detector.d.ts +3 -0
- package/dist/src/analyzers/typescript/detector.js +23 -0
- package/dist/src/analyzers/typescript/index.d.ts +2 -0
- package/dist/src/analyzers/typescript/index.js +11 -0
- package/dist/src/analyzers/typescript/manifest-parsers.d.ts +1 -0
- package/dist/src/analyzers/typescript/manifest-parsers.js +30 -0
- package/dist/src/analyzers/typescript/parser.d.ts +44 -0
- package/dist/src/analyzers/typescript/parser.js +287 -0
- package/dist/src/analyzers/typescript/third-party-detection.d.ts +4 -0
- package/dist/src/analyzers/typescript/third-party-detection.js +16 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.d.ts +68 -0
- package/dist/src/analyzers/typescript/typescript-detection-config.js +171 -0
- package/dist/src/analyzers/typescript/typescript-detection.d.ts +10 -0
- package/dist/src/analyzers/typescript/typescript-detection.js +57 -0
- package/dist/src/classifier/application-injection.d.ts +12 -0
- package/dist/src/classifier/application-injection.js +335 -0
- package/dist/src/classifier/classify.d.ts +3 -0
- package/dist/src/classifier/classify.js +15 -0
- package/dist/src/classifier/component-factory.d.ts +3 -0
- package/dist/src/classifier/component-factory.js +488 -0
- package/dist/src/classifier/config.d.ts +38 -0
- package/dist/src/classifier/config.js +260 -0
- package/dist/src/classifier/enhance-defaults.d.ts +28 -0
- package/dist/src/classifier/enhance-defaults.js +369 -0
- package/dist/src/classifier/enhance.d.ts +13 -0
- package/dist/src/classifier/enhance.js +295 -0
- package/dist/src/classifier/external-url-third-party.d.ts +26 -0
- package/dist/src/classifier/external-url-third-party.js +195 -0
- package/dist/src/classifier/grouping.d.ts +1 -0
- package/dist/src/classifier/grouping.js +2 -0
- package/dist/src/classifier/main-application-selection.d.ts +41 -0
- package/dist/src/classifier/main-application-selection.js +222 -0
- package/dist/src/classifier/naming.d.ts +4 -0
- package/dist/src/classifier/naming.js +78 -0
- package/dist/src/classifier/postprocessing.d.ts +12 -0
- package/dist/src/classifier/postprocessing.js +510 -0
- package/dist/src/classifier/sectioning.d.ts +5 -0
- package/dist/src/classifier/sectioning.js +60 -0
- package/dist/src/classifier/terraform-provider-hub.d.ts +6 -0
- package/dist/src/classifier/terraform-provider-hub.js +38 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +498 -0
- package/dist/src/config/actor-detection-config.d.ts +21 -0
- package/dist/src/config/actor-detection-config.js +97 -0
- package/dist/src/config/env.d.ts +2 -0
- package/dist/src/config/env.js +75 -0
- package/dist/src/config/file.d.ts +6 -0
- package/dist/src/config/file.js +74 -0
- package/dist/src/config/inference-scope.d.ts +2 -0
- package/dist/src/config/inference-scope.js +15 -0
- package/dist/src/config/load-cli-env.d.ts +1 -0
- package/dist/src/config/load-cli-env.js +54 -0
- package/dist/src/config/normalize-ai-provider.d.ts +5 -0
- package/dist/src/config/normalize-ai-provider.js +18 -0
- package/dist/src/config/property-detection-config.d.ts +27 -0
- package/dist/src/config/property-detection-config.js +355 -0
- package/dist/src/config/redact.d.ts +3 -0
- package/dist/src/config/redact.js +14 -0
- package/dist/src/config/resolve.d.ts +15 -0
- package/dist/src/config/resolve.js +361 -0
- package/dist/src/config/scan-env.d.ts +7 -0
- package/dist/src/config/scan-env.js +38 -0
- package/dist/src/config/third-party-detection-config.d.ts +25 -0
- package/dist/src/config/third-party-detection-config.js +97 -0
- package/dist/src/config/types.d.ts +106 -0
- package/dist/src/config/types.js +2 -0
- package/dist/src/config/validate-scan-ai.d.ts +3 -0
- package/dist/src/config/validate-scan-ai.js +33 -0
- package/dist/src/core/pipeline/ai-orchestrator-options.d.ts +6 -0
- package/dist/src/core/pipeline/ai-orchestrator-options.js +46 -0
- package/dist/src/core/pipeline/classifier-phase.d.ts +7 -0
- package/dist/src/core/pipeline/classifier-phase.js +78 -0
- package/dist/src/core/pipeline/dataflow-phase.d.ts +7 -0
- package/dist/src/core/pipeline/dataflow-phase.js +10 -0
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.d.ts +7 -0
- package/dist/src/core/pipeline/diagram-layout/app-section-layout.js +74 -0
- package/dist/src/core/pipeline/diagram-layout/constants.d.ts +11 -0
- package/dist/src/core/pipeline/diagram-layout/constants.js +14 -0
- package/dist/src/core/pipeline/diagram-layout/edge-handles.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/edge-handles.js +26 -0
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/managed-provider-layout.js +40 -0
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.d.ts +6 -0
- package/dist/src/core/pipeline/diagram-layout/minimal-terraform-layout.js +53 -0
- package/dist/src/core/pipeline/diagram-layout/section-helpers.d.ts +30 -0
- package/dist/src/core/pipeline/diagram-layout/section-helpers.js +62 -0
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.d.ts +3 -0
- package/dist/src/core/pipeline/diagram-layout/terraform-lane-layout.js +109 -0
- package/dist/src/core/pipeline/diagram-layout/types.d.ts +2 -0
- package/dist/src/core/pipeline/diagram-layout/types.js +2 -0
- package/dist/src/core/pipeline/graph-mapping.d.ts +6 -0
- package/dist/src/core/pipeline/graph-mapping.js +308 -0
- package/dist/src/core/pipeline/mixed-app-terraform-scan.d.ts +13 -0
- package/dist/src/core/pipeline/mixed-app-terraform-scan.js +81 -0
- package/dist/src/core/pipeline/orchestrator-result.d.ts +6 -0
- package/dist/src/core/pipeline/orchestrator-result.js +2 -0
- package/dist/src/core/pipeline/orchestrator.d.ts +26 -0
- package/dist/src/core/pipeline/orchestrator.js +79 -0
- package/dist/src/core/pipeline/resolve-path-under-scan-root.d.ts +7 -0
- package/dist/src/core/pipeline/resolve-path-under-scan-root.js +55 -0
- package/dist/src/core/pipeline/scan-pipeline.d.ts +6 -0
- package/dist/src/core/pipeline/scan-pipeline.js +364 -0
- package/dist/src/core/pipeline/sorting.d.ts +3 -0
- package/dist/src/core/pipeline/sorting.js +48 -0
- package/dist/src/core/pipeline/stable-component-ids.d.ts +15 -0
- package/dist/src/core/pipeline/stable-component-ids.js +68 -0
- package/dist/src/core/pipeline/structural-scan.d.ts +19 -0
- package/dist/src/core/pipeline/structural-scan.js +304 -0
- package/dist/src/core/pipeline/terraform-flow-utils.d.ts +6 -0
- package/dist/src/core/pipeline/terraform-flow-utils.js +32 -0
- package/dist/src/core/pipeline/terraform-minimal-services.d.ts +31 -0
- package/dist/src/core/pipeline/terraform-minimal-services.js +225 -0
- package/dist/src/core/schema/dataflow-wrapper.schema.d.ts +83 -0
- package/dist/src/core/schema/dataflow-wrapper.schema.js +40 -0
- package/dist/src/core/schema/diagram-graph.schema.d.ts +93 -0
- package/dist/src/core/schema/diagram-graph.schema.js +55 -0
- package/dist/src/core/schema/index.d.ts +4 -0
- package/dist/src/core/schema/index.js +20 -0
- package/dist/src/core/schema/scan-config.schema.d.ts +66 -0
- package/dist/src/core/schema/scan-config.schema.js +67 -0
- package/dist/src/core/schema/scan-result.schema.d.ts +450 -0
- package/dist/src/core/schema/scan-result.schema.js +236 -0
- package/dist/src/core/sectioning/discover-service-sections.d.ts +80 -0
- package/dist/src/core/sectioning/discover-service-sections.js +468 -0
- package/dist/src/core/sectioning/section-runtime.d.ts +21 -0
- package/dist/src/core/sectioning/section-runtime.js +148 -0
- package/dist/src/core/terraform/component-predicates.d.ts +13 -0
- package/dist/src/core/terraform/component-predicates.js +71 -0
- package/dist/src/core/types/component.d.ts +18 -0
- package/dist/src/core/types/component.js +2 -0
- package/dist/src/core/types/config.d.ts +57 -0
- package/dist/src/core/types/config.js +2 -0
- package/dist/src/core/types/data-flow.d.ts +24 -0
- package/dist/src/core/types/data-flow.js +2 -0
- package/dist/src/core/types/detection.d.ts +12 -0
- package/dist/src/core/types/detection.js +19 -0
- package/dist/src/core/types/file.d.ts +14 -0
- package/dist/src/core/types/file.js +2 -0
- package/dist/src/core/types/index.d.ts +7 -0
- package/dist/src/core/types/index.js +23 -0
- package/dist/src/core/types/progress.d.ts +9 -0
- package/dist/src/core/types/progress.js +2 -0
- package/dist/src/core/types/result.d.ts +140 -0
- package/dist/src/core/types/result.js +2 -0
- package/dist/src/data-flow/application-hub.d.ts +7 -0
- package/dist/src/data-flow/application-hub.js +88 -0
- package/dist/src/data-flow/dedupe.d.ts +7 -0
- package/dist/src/data-flow/dedupe.js +92 -0
- package/dist/src/data-flow/detect.d.ts +16 -0
- package/dist/src/data-flow/detect.js +203 -0
- package/dist/src/data-flow/detector.d.ts +15 -0
- package/dist/src/data-flow/detector.js +18 -0
- package/dist/src/data-flow/drop-cross-section-flows.d.ts +8 -0
- package/dist/src/data-flow/drop-cross-section-flows.js +32 -0
- package/dist/src/data-flow/ensure-actor-flow.d.ts +16 -0
- package/dist/src/data-flow/ensure-actor-flow.js +101 -0
- package/dist/src/data-flow/ensure-manifest-declared-flows.d.ts +14 -0
- package/dist/src/data-flow/ensure-manifest-declared-flows.js +76 -0
- package/dist/src/data-flow/ensure-section-api-flows.d.ts +6 -0
- package/dist/src/data-flow/ensure-section-api-flows.js +57 -0
- package/dist/src/data-flow/flow-builder.d.ts +5 -0
- package/dist/src/data-flow/flow-builder.js +80 -0
- package/dist/src/data-flow/import-graph.d.ts +10 -0
- package/dist/src/data-flow/import-graph.js +147 -0
- package/dist/src/data-flow/index.d.ts +8 -0
- package/dist/src/data-flow/index.js +20 -0
- package/dist/src/data-flow/internal-fetch.d.ts +8 -0
- package/dist/src/data-flow/internal-fetch.js +209 -0
- package/dist/src/data-flow/postprocess.d.ts +9 -0
- package/dist/src/data-flow/postprocess.js +63 -0
- package/dist/src/data-flow/rewire.d.ts +10 -0
- package/dist/src/data-flow/rewire.js +93 -0
- package/dist/src/data-flow/source-attribution.d.ts +8 -0
- package/dist/src/data-flow/source-attribution.js +131 -0
- package/dist/src/data-flow/source-resolution.d.ts +13 -0
- package/dist/src/data-flow/source-resolution.js +61 -0
- package/dist/src/data-flow/target-matching.d.ts +21 -0
- package/dist/src/data-flow/target-matching.js +253 -0
- package/dist/src/data-flow/terraform-flows.d.ts +32 -0
- package/dist/src/data-flow/terraform-flows.js +170 -0
- package/dist/src/evals/metrics.d.ts +18 -0
- package/dist/src/evals/metrics.js +58 -0
- package/dist/src/evals/run-model-matrix.d.ts +1 -0
- package/dist/src/evals/run-model-matrix.js +68 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +20 -0
- package/dist/src/ingest/file-system.d.ts +17 -0
- package/dist/src/ingest/file-system.js +239 -0
- package/dist/src/ingest/gitignore.d.ts +12 -0
- package/dist/src/ingest/gitignore.js +127 -0
- package/dist/src/ingest/sensitive-paths.d.ts +2 -0
- package/dist/src/ingest/sensitive-paths.js +8 -0
- package/dist/src/observability/scan-sentry.d.ts +20 -0
- package/dist/src/observability/scan-sentry.js +133 -0
- package/dist/src/output/json.d.ts +51 -0
- package/dist/src/output/json.js +59 -0
- package/dist/src/patterns/config.d.ts +22 -0
- package/dist/src/patterns/config.js +119 -0
- package/dist/src/patterns/detectors/helpers.d.ts +19 -0
- package/dist/src/patterns/detectors/helpers.js +68 -0
- package/dist/src/patterns/detectors/python.d.ts +8 -0
- package/dist/src/patterns/detectors/python.js +412 -0
- package/dist/src/patterns/detectors/typescript.d.ts +8 -0
- package/dist/src/patterns/detectors/typescript.js +328 -0
- package/dist/src/patterns/engine.d.ts +40 -0
- package/dist/src/patterns/engine.js +111 -0
- package/dist/src/patterns/flow-source-patterns.d.ts +6 -0
- package/dist/src/patterns/flow-source-patterns.js +39 -0
- package/dist/src/patterns/frontend-frameworks.d.ts +4 -0
- package/dist/src/patterns/frontend-frameworks.js +25 -0
- package/dist/src/patterns/scan-exclusions.d.ts +14 -0
- package/dist/src/patterns/scan-exclusions.js +76 -0
- package/dist/src/platform-api/dataparade-api-base-url.d.ts +8 -0
- package/dist/src/platform-api/dataparade-api-base-url.js +17 -0
- package/dist/src/platform-api/estimate-scan-footprint.d.ts +8 -0
- package/dist/src/platform-api/estimate-scan-footprint.js +120 -0
- package/dist/src/platform-api/scan-quota-client.d.ts +28 -0
- package/dist/src/platform-api/scan-quota-client.js +79 -0
- package/dist/src/tracing/langsmith-tracing.d.ts +37 -0
- package/dist/src/tracing/langsmith-tracing.js +171 -0
- package/dist/tests/cli/cli.spec.d.ts +1 -0
- package/dist/tests/cli/cli.spec.js +87 -0
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.d.ts +2 -0
- package/dist/tests/fixtures/e2e-ts-sample/db-client-import.js +8 -0
- package/dist/tests/fixtures/e2e-ts-sample/db.d.ts +3 -0
- package/dist/tests/fixtures/e2e-ts-sample/db.js +7 -0
- package/dist/tests/fixtures/e2e-ts-sample/external-api.d.ts +1 -0
- package/dist/tests/fixtures/e2e-ts-sample/external-api.js +18 -0
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.d.ts +3 -0
- package/dist/tests/fixtures/e2e-ts-sample/pg-client.js +7 -0
- package/dist/tests/fixtures/e2e-ts-sample/server.d.ts +14 -0
- package/dist/tests/fixtures/e2e-ts-sample/server.js +4 -0
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.d.ts +1 -0
- package/dist/tests/fixtures/e2e-ts-sentry-route-env/server.js +24 -0
- package/dist/tests/fixtures/ingest-basic/src/index.d.ts +1 -0
- package/dist/tests/fixtures/ingest-basic/src/index.js +6 -0
- package/dist/tests/fixtures/mixed-language-basic/api.d.ts +2 -0
- package/dist/tests/fixtures/mixed-language-basic/api.js +12 -0
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-app-plus-terraform/packages/app/app/route.js +6 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/backend/app/route.js +6 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.d.ts +1 -0
- package/dist/tests/fixtures/monorepo-front-back-sections/frontend/app/route.js +7 -0
- package/dist/tests/fixtures/typescript-basic/app/route.d.ts +1 -0
- package/dist/tests/fixtures/typescript-basic/app/route.js +7 -0
- package/dist/tests/fixtures/typescript-basic/db-client-import.d.ts +2 -0
- package/dist/tests/fixtures/typescript-basic/db-client-import.js +8 -0
- package/dist/tests/fixtures/typescript-basic/db.d.ts +3 -0
- package/dist/tests/fixtures/typescript-basic/db.js +7 -0
- package/dist/tests/fixtures/typescript-basic/external-api.d.ts +1 -0
- package/dist/tests/fixtures/typescript-basic/external-api.js +18 -0
- package/dist/tests/fixtures/typescript-basic/pg-client.d.ts +3 -0
- package/dist/tests/fixtures/typescript-basic/pg-client.js +7 -0
- package/dist/tests/fixtures/typescript-basic/server.d.ts +14 -0
- package/dist/tests/fixtures/typescript-basic/server.js +4 -0
- 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 +2 -0
- package/dist/tests/helpers/scan-result-builders.d.ts +2 -0
- package/dist/tests/helpers/scan-result-builders.js +15 -0
- package/dist/tests/schema/dataflow-wrapper.schema.spec.d.ts +1 -0
- package/dist/tests/schema/dataflow-wrapper.schema.spec.js +89 -0
- package/dist/tests/schema/diagram-graph.schema.spec.d.ts +1 -0
- package/dist/tests/schema/diagram-graph.schema.spec.js +48 -0
- package/dist/tests/schema/scan-config.schema.spec.d.ts +1 -0
- package/dist/tests/schema/scan-config.schema.spec.js +135 -0
- package/dist/tests/schema/scan-result.schema.spec.d.ts +1 -0
- package/dist/tests/schema/scan-result.schema.spec.js +177 -0
- package/dist/tests/unit/ai-enrichment/agent-orchestrator.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/agent-orchestrator.spec.js +483 -0
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/candidate-selector.spec.js +106 -0
- package/dist/tests/unit/ai-enrichment/create-ai-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/create-ai-provider.spec.js +32 -0
- package/dist/tests/unit/ai-enrichment/endpoint-resolution.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/endpoint-resolution.spec.js +47 -0
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/fallbacks.spec.js +1304 -0
- package/dist/tests/unit/ai-enrichment/families/chat-completions-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/chat-completions-family.spec.js +219 -0
- package/dist/tests/unit/ai-enrichment/families/generate-content-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/generate-content-family.spec.js +119 -0
- package/dist/tests/unit/ai-enrichment/families/messages-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/messages-family.spec.js +129 -0
- package/dist/tests/unit/ai-enrichment/families/ollama-generate-family.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/families/ollama-generate-family.spec.js +69 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/merge-rules.spec.js +422 -0
- package/dist/tests/unit/ai-enrichment/openai-proposals-response.schema.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/openai-proposals-response.schema.spec.js +30 -0
- package/dist/tests/unit/ai-enrichment/pipeline.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/pipeline.spec.js +120 -0
- package/dist/tests/unit/ai-enrichment/planner.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/planner.spec.js +106 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/platform-proxy-provider.spec.js +51 -0
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-contract.spec.js +244 -0
- package/dist/tests/unit/ai-enrichment/provider-json-parse.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-json-parse.spec.js +24 -0
- package/dist/tests/unit/ai-enrichment/provider-output-token-budget.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-output-token-budget.spec.js +15 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt-env.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt-env.spec.js +54 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-prompt.spec.js +206 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-aws.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-aws.spec.js +43 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-kubernetes.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/provider-topology-terraform-kubernetes.spec.js +40 -0
- package/dist/tests/unit/ai-enrichment/providers/fetch-with-timeout.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/providers/fetch-with-timeout.spec.js +22 -0
- package/dist/tests/unit/ai-enrichment/resolve-provider.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/resolve-provider.spec.js +67 -0
- package/dist/tests/unit/ai-enrichment/scan-paths-exact.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/scan-paths-exact.spec.js +35 -0
- package/dist/tests/unit/ai-enrichment/scan-paths.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/scan-paths.spec.js +21 -0
- package/dist/tests/unit/ai-enrichment/sensitive-paths.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/sensitive-paths.spec.js +20 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-data-flow.spec.js +963 -0
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-evidence.spec.js +117 -0
- package/dist/tests/unit/ai-enrichment/third-party-subtype.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/third-party-subtype.spec.js +45 -0
- package/dist/tests/unit/ai-enrichment/tools-validation.spec.d.ts +1 -0
- package/dist/tests/unit/ai-enrichment/tools-validation.spec.js +66 -0
- package/dist/tests/unit/analyzers/python/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/python/parser.spec.js +104 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/python/patterns.spec.js +289 -0
- package/dist/tests/unit/analyzers/registry.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/registry.spec.js +234 -0
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/classifier-subtype-parity.spec.js +87 -0
- package/dist/tests/unit/analyzers/terraform/detector.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/detector.spec.js +110 -0
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/generated-provider-hints.spec.js +53 -0
- package/dist/tests/unit/analyzers/terraform/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/parser.spec.js +56 -0
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/terraform-module-manifest.spec.js +63 -0
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform/terraform-utility-resource.spec.js +19 -0
- package/dist/tests/unit/analyzers/terraform-exec.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform-exec.spec.js +27 -0
- package/dist/tests/unit/analyzers/terraform-show-json.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/terraform-show-json.spec.js +77 -0
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/dependency-manifests.spec.js +61 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/detector.spec.js +225 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-auth0.spec.js +49 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/external-apis-sentry.spec.js +27 -0
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/fixture-integration.spec.js +64 -0
- package/dist/tests/unit/analyzers/typescript/parser.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/parser.spec.js +99 -0
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/pattern-config.spec.js +24 -0
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.d.ts +1 -0
- package/dist/tests/unit/analyzers/typescript/property-detection.spec.js +138 -0
- package/dist/tests/unit/classifier/classify.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/classify.spec.js +1453 -0
- package/dist/tests/unit/classifier/enhance.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/enhance.spec.js +400 -0
- package/dist/tests/unit/classifier/external-url-third-party.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/external-url-third-party.spec.js +83 -0
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/frontend-framework-grouping.spec.js +44 -0
- package/dist/tests/unit/classifier/terraform-grouping.spec.d.ts +1 -0
- package/dist/tests/unit/classifier/terraform-grouping.spec.js +96 -0
- package/dist/tests/unit/cli/config-command.spec.d.ts +1 -0
- package/dist/tests/unit/cli/config-command.spec.js +51 -0
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.d.ts +0 -0
- package/dist/tests/unit/cli/scan-command-ai-flags.spec.js +149 -0
- package/dist/tests/unit/cli/scan-command-diagram-graph.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-diagram-graph.spec.js +26 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-app-plus-terraform.spec.js +107 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-front-back-sections.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-monorepo-front-back-sections.spec.js +74 -0
- package/dist/tests/unit/cli/scan-command-e2e-python-basic.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-python-basic.spec.js +43 -0
- package/dist/tests/unit/cli/scan-command-e2e-terraform-basic.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-terraform-basic.spec.js +62 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sample.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sample.spec.js +41 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-e2e-ts-sentry-route-env.spec.js +85 -0
- package/dist/tests/unit/cli/scan-command-exit-code.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-command-exit-code.spec.js +131 -0
- package/dist/tests/unit/cli/scan-quota-flow.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-quota-flow.spec.js +76 -0
- package/dist/tests/unit/config/property-detection-config.spec.d.ts +1 -0
- package/dist/tests/unit/config/property-detection-config.spec.js +38 -0
- package/dist/tests/unit/config/redact.spec.d.ts +1 -0
- package/dist/tests/unit/config/redact.spec.js +19 -0
- package/dist/tests/unit/config/resolve-config.spec.d.ts +1 -0
- package/dist/tests/unit/config/resolve-config.spec.js +172 -0
- package/dist/tests/unit/config/scan-env-debug.spec.d.ts +1 -0
- package/dist/tests/unit/config/scan-env-debug.spec.js +17 -0
- package/dist/tests/unit/config/validate-scan-ai.spec.d.ts +1 -0
- package/dist/tests/unit/config/validate-scan-ai.spec.js +53 -0
- package/dist/tests/unit/core/classifier-phase-regressions.spec.d.ts +1 -0
- package/dist/tests/unit/core/classifier-phase-regressions.spec.js +68 -0
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.d.ts +1 -0
- package/dist/tests/unit/core/dependency-manifest-performance-budgets.spec.js +66 -0
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.d.ts +1 -0
- package/dist/tests/unit/core/dependency-manifest-toggles-confidence.spec.js +132 -0
- package/dist/tests/unit/core/discover-service-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/discover-service-sections.spec.js +204 -0
- package/dist/tests/unit/core/graph-mapping.spec.d.ts +1 -0
- package/dist/tests/unit/core/graph-mapping.spec.js +779 -0
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.d.ts +1 -0
- package/dist/tests/unit/core/invariant-tests-dedupe-determinism.spec.js +64 -0
- package/dist/tests/unit/core/manifest-package-hub.spec.d.ts +1 -0
- package/dist/tests/unit/core/manifest-package-hub.spec.js +53 -0
- package/dist/tests/unit/core/monorepo-package-sections.spec.d.ts +1 -0
- package/dist/tests/unit/core/monorepo-package-sections.spec.js +121 -0
- package/dist/tests/unit/core/no-source-code-leakage.spec.d.ts +1 -0
- package/dist/tests/unit/core/no-source-code-leakage.spec.js +48 -0
- package/dist/tests/unit/core/orchestrator.spec.d.ts +1 -0
- package/dist/tests/unit/core/orchestrator.spec.js +252 -0
- package/dist/tests/unit/core/output-json.spec.d.ts +1 -0
- package/dist/tests/unit/core/output-json.spec.js +65 -0
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.d.ts +1 -0
- package/dist/tests/unit/core/parsing-error-handling-nonfatal.spec.js +42 -0
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.d.ts +1 -0
- package/dist/tests/unit/core/resolve-path-under-scan-root.spec.js +54 -0
- package/dist/tests/unit/core/scan-result-language-stats.spec.d.ts +1 -0
- package/dist/tests/unit/core/scan-result-language-stats.spec.js +15 -0
- package/dist/tests/unit/core/section-discovery-excludes.spec.d.ts +1 -0
- package/dist/tests/unit/core/section-discovery-excludes.spec.js +49 -0
- package/dist/tests/unit/core/section-runtime.spec.d.ts +1 -0
- package/dist/tests/unit/core/section-runtime.spec.js +166 -0
- package/dist/tests/unit/core/stable-component-ids.spec.d.ts +1 -0
- package/dist/tests/unit/core/stable-component-ids.spec.js +112 -0
- package/dist/tests/unit/core/structural-scan.spec.d.ts +1 -0
- package/dist/tests/unit/core/structural-scan.spec.js +83 -0
- package/dist/tests/unit/core/terraform-json-overlay.spec.d.ts +1 -0
- package/dist/tests/unit/core/terraform-json-overlay.spec.js +36 -0
- package/dist/tests/unit/core/terraform-minimal-services.spec.d.ts +1 -0
- package/dist/tests/unit/core/terraform-minimal-services.spec.js +378 -0
- package/dist/tests/unit/data-flow/application-hub.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/application-hub.spec.js +48 -0
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/cross-section-terraform-bridge.spec.js +95 -0
- package/dist/tests/unit/data-flow/dedupe.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/dedupe.spec.js +134 -0
- package/dist/tests/unit/data-flow/detector.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/detector.spec.js +1254 -0
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/drop-cross-section-flows.spec.js +132 -0
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-actor-flow.spec.js +233 -0
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-manifest-declared-flows.spec.js +125 -0
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/ensure-section-api-flows.spec.js +40 -0
- package/dist/tests/unit/data-flow/postprocess.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/postprocess.spec.js +78 -0
- package/dist/tests/unit/data-flow/rewire.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/rewire.spec.js +194 -0
- package/dist/tests/unit/data-flow/terraform-flows.spec.d.ts +1 -0
- package/dist/tests/unit/data-flow/terraform-flows.spec.js +199 -0
- package/dist/tests/unit/evals/metrics.spec.d.ts +1 -0
- package/dist/tests/unit/evals/metrics.spec.js +54 -0
- package/dist/tests/unit/ingest/env-exclusion.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/env-exclusion.spec.js +43 -0
- package/dist/tests/unit/ingest/file-system.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/file-system.spec.js +180 -0
- package/dist/tests/unit/ingest/gitignore.spec.d.ts +1 -0
- package/dist/tests/unit/ingest/gitignore.spec.js +30 -0
- package/dist/tests/unit/observability/scan-sentry.spec.d.ts +1 -0
- package/dist/tests/unit/observability/scan-sentry.spec.js +60 -0
- package/dist/tests/unit/patterns/scan-exclusions.spec.d.ts +1 -0
- package/dist/tests/unit/patterns/scan-exclusions.spec.js +58 -0
- package/dist/tests/unit/pipeline/ai-orchestrator-options.spec.d.ts +1 -0
- package/dist/tests/unit/pipeline/ai-orchestrator-options.spec.js +19 -0
- package/dist/tests/unit/platform-api/dataparade-api-base-url.spec.d.ts +1 -0
- package/dist/tests/unit/platform-api/dataparade-api-base-url.spec.js +19 -0
- package/dist/tests/unit/platform-api/estimate-scan-footprint.spec.d.ts +1 -0
- package/dist/tests/unit/platform-api/estimate-scan-footprint.spec.js +50 -0
- package/dist/tests/unit/tracing/langsmith-tracing.spec.d.ts +1 -0
- package/dist/tests/unit/tracing/langsmith-tracing.spec.js +118 -0
- package/package.json +84 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runScanPipeline = runScanPipeline;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const ai_orchestrator_options_1 = require("./ai-orchestrator-options");
|
|
9
|
+
const scan_result_schema_1 = require("../schema/scan-result.schema");
|
|
10
|
+
const structural_scan_1 = require("./structural-scan");
|
|
11
|
+
const classifier_phase_1 = require("./classifier-phase");
|
|
12
|
+
const dataflow_phase_1 = require("./dataflow-phase");
|
|
13
|
+
const sorting_1 = require("./sorting");
|
|
14
|
+
const pipeline_1 = require("../../ai-enrichment/pipeline");
|
|
15
|
+
const fallbacks_1 = require("../../ai-enrichment/fallbacks");
|
|
16
|
+
const drop_cross_section_flows_1 = require("../../data-flow/drop-cross-section-flows");
|
|
17
|
+
const agent_orchestrator_1 = require("../../ai-enrichment/agent-orchestrator");
|
|
18
|
+
const third_party_data_flow_1 = require("../../ai-enrichment/third-party-data-flow");
|
|
19
|
+
const third_party_subtype_1 = require("../../ai-enrichment/third-party-subtype");
|
|
20
|
+
const langsmith_tracing_1 = require("../../tracing/langsmith-tracing");
|
|
21
|
+
const stable_component_ids_1 = require("./stable-component-ids");
|
|
22
|
+
const terraform_minimal_services_1 = require("./terraform-minimal-services");
|
|
23
|
+
function emitProgress(onProgress, phase, progress, totalFiles, message) {
|
|
24
|
+
if (!onProgress)
|
|
25
|
+
return;
|
|
26
|
+
const clamped = Math.max(0, Math.min(progress, 1));
|
|
27
|
+
onProgress({
|
|
28
|
+
phase,
|
|
29
|
+
filesProcessed: totalFiles,
|
|
30
|
+
totalFiles,
|
|
31
|
+
progress: clamped,
|
|
32
|
+
message,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function buildAiProposalDetails(input) {
|
|
36
|
+
const appliedSet = new Set(input.appliedProposalIds);
|
|
37
|
+
const rejectedById = new Map(input.rejectedProposalIds.map((item) => [item.proposalId, item.reason]));
|
|
38
|
+
const beforeById = new Map(input.componentsBeforeAi.map((component) => [component.id, component]));
|
|
39
|
+
return input.proposals.map(({ id, proposal }) => {
|
|
40
|
+
const rejectionReason = rejectedById.get(id);
|
|
41
|
+
const status = appliedSet.has(id) ? "applied" : "rejected";
|
|
42
|
+
const propertyChanges = proposal.kind === "component_patch" && status === "applied"
|
|
43
|
+
? Object.entries(proposal.setProperties).map(([key, to]) => ({
|
|
44
|
+
key,
|
|
45
|
+
from: beforeById.get(proposal.targetComponentId)?.properties?.[key],
|
|
46
|
+
to,
|
|
47
|
+
}))
|
|
48
|
+
: undefined;
|
|
49
|
+
return {
|
|
50
|
+
id,
|
|
51
|
+
source: id.startsWith("heuristic_") ? "heuristic" : "provider",
|
|
52
|
+
status,
|
|
53
|
+
rejectionReason: status === "rejected" ? rejectionReason : undefined,
|
|
54
|
+
kind: proposal.kind,
|
|
55
|
+
candidateType: proposal.candidateType,
|
|
56
|
+
agent: proposal.agent,
|
|
57
|
+
provider: proposal.provider,
|
|
58
|
+
model: proposal.model,
|
|
59
|
+
confidence: proposal.confidence.score,
|
|
60
|
+
confidenceBand: proposal.confidence.band,
|
|
61
|
+
targetComponentId: proposal.kind === "component_patch" ? proposal.targetComponentId : undefined,
|
|
62
|
+
targetFlowId: proposal.kind === "flow_patch" ? proposal.targetFlowId : undefined,
|
|
63
|
+
sourceComponentId: proposal.kind === "flow_patch" ? proposal.sourceComponentId : undefined,
|
|
64
|
+
targetFlowComponentId: proposal.kind === "flow_patch" ? proposal.targetComponentId : undefined,
|
|
65
|
+
evidence: proposal.evidence,
|
|
66
|
+
propertyChanges,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function countRejectionsByReason(rejected, proposalById) {
|
|
71
|
+
const counts = new Map();
|
|
72
|
+
for (const item of rejected) {
|
|
73
|
+
const source = proposalById.get(item.proposalId)?.id.startsWith("provider_")
|
|
74
|
+
? "provider"
|
|
75
|
+
: "heuristic";
|
|
76
|
+
const key = `${source}:${item.reason}`;
|
|
77
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
78
|
+
}
|
|
79
|
+
return counts;
|
|
80
|
+
}
|
|
81
|
+
function isSparse(value) {
|
|
82
|
+
if (value === null || value === undefined)
|
|
83
|
+
return true;
|
|
84
|
+
if (typeof value === "string")
|
|
85
|
+
return value.trim().length === 0;
|
|
86
|
+
if (Array.isArray(value))
|
|
87
|
+
return value.length === 0;
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
function incrementCounter(map, key) {
|
|
91
|
+
map[key] = (map[key] ?? 0) + 1;
|
|
92
|
+
}
|
|
93
|
+
function buildThirdPartyCoverage(input) {
|
|
94
|
+
const autofilled = {};
|
|
95
|
+
const suggested = {};
|
|
96
|
+
const unknown = {};
|
|
97
|
+
const applied = new Set(input.appliedProposalIds);
|
|
98
|
+
const rejectedReasonById = new Map(input.rejectedProposalIds.map((entry) => [entry.proposalId, entry.reason]));
|
|
99
|
+
for (const proposalEntry of input.proposals) {
|
|
100
|
+
const proposal = proposalEntry.proposal;
|
|
101
|
+
if (proposal.kind !== "component_patch")
|
|
102
|
+
continue;
|
|
103
|
+
if (proposal.candidateType !== "third_party")
|
|
104
|
+
continue;
|
|
105
|
+
const keys = Object.keys(proposal.setProperties ?? {});
|
|
106
|
+
if (keys.length === 0)
|
|
107
|
+
continue;
|
|
108
|
+
if (applied.has(proposalEntry.id)) {
|
|
109
|
+
for (const key of keys)
|
|
110
|
+
incrementCounter(autofilled, key);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const reason = rejectedReasonById.get(proposalEntry.id) ?? "";
|
|
114
|
+
if (reason.startsWith("confidence_below_threshold")) {
|
|
115
|
+
for (const key of keys)
|
|
116
|
+
incrementCounter(suggested, key);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (const component of input.componentsAfterAi) {
|
|
120
|
+
if (component.type !== "third_party")
|
|
121
|
+
continue;
|
|
122
|
+
for (const [key, value] of Object.entries(component.properties ?? {})) {
|
|
123
|
+
if (isSparse(value))
|
|
124
|
+
incrementCounter(unknown, key);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return { autofilled, suggested, unknown };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Internal scan implementation (ingest → classify → flows → optional AI → validate).
|
|
131
|
+
*/
|
|
132
|
+
async function runScanPipeline(rootPath, config, onProgress) {
|
|
133
|
+
const start = Date.now();
|
|
134
|
+
const warnings = [];
|
|
135
|
+
const errors = [];
|
|
136
|
+
const projectNameFromPath = path_1.default.basename(rootPath.toString());
|
|
137
|
+
emitProgress(onProgress, "ingest", 0.05, 0, `Ingesting files from ${rootPath}...`);
|
|
138
|
+
emitProgress(onProgress, "analyze", 0.25, 0, "Running structural scan...");
|
|
139
|
+
const structural = await (0, structural_scan_1.runStructuralScanPhase)(rootPath, config, (warning) => warnings.push(warning));
|
|
140
|
+
const { files, findings, sections, monorepoPackageSectionPathDepth, filesScanned, totalLines, languageStats, terraformScanSummary, } = structural;
|
|
141
|
+
emitProgress(onProgress, "classify", 0.5, filesScanned, "Classifying detected components...");
|
|
142
|
+
const components = (0, classifier_phase_1.runClassifierPhase)(findings, sections, {
|
|
143
|
+
projectName: config.projectName ?? projectNameFromPath,
|
|
144
|
+
minimumConfidence: config.minimumConfidence,
|
|
145
|
+
});
|
|
146
|
+
const subTypesFilledEarly = (0, third_party_subtype_1.ensureThirdPartySubTypes)(components);
|
|
147
|
+
if (subTypesFilledEarly > 0) {
|
|
148
|
+
warnings.push(`third-party-subtype: inferred subType for ${subTypesFilledEarly} third-party component(s) from vendor/name heuristics.`);
|
|
149
|
+
}
|
|
150
|
+
let dataFlows = [];
|
|
151
|
+
if (config.enableDataFlowDetection) {
|
|
152
|
+
emitProgress(onProgress, "data_flow", 0.7, filesScanned, "Detecting data flows...");
|
|
153
|
+
try {
|
|
154
|
+
dataFlows = (0, dataflow_phase_1.runDataFlowPhase)(files, components, findings, sections, {
|
|
155
|
+
enableDataFlowDetection: config.enableDataFlowDetection,
|
|
156
|
+
minimumConfidence: config.minimumConfidence,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
const message = err instanceof Error
|
|
161
|
+
? err.message
|
|
162
|
+
: "Unknown error during data-flow detection.";
|
|
163
|
+
errors.push(`data-flow: ${message}`);
|
|
164
|
+
dataFlows = [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
(0, sorting_1.sortComponentsDeterministically)(components);
|
|
168
|
+
(0, sorting_1.sortDataFlowsDeterministically)(dataFlows);
|
|
169
|
+
let aiInferenceSummary;
|
|
170
|
+
let structuralEnrichmentSummary;
|
|
171
|
+
let aiInferenceProposalDetails;
|
|
172
|
+
let inference;
|
|
173
|
+
let postAiComponents;
|
|
174
|
+
const plannerInputBase = {
|
|
175
|
+
components,
|
|
176
|
+
dataFlows,
|
|
177
|
+
sections,
|
|
178
|
+
files,
|
|
179
|
+
findings,
|
|
180
|
+
inferenceScope: config.aiInferenceScope ?? "default",
|
|
181
|
+
plannerOptions: {
|
|
182
|
+
maxModelCalls: config.aiMaxModelCalls,
|
|
183
|
+
totalBudgetTokens: config.aiBudgetTokens,
|
|
184
|
+
maxCandidatesPerAgent: (config.aiInferenceScope ?? "default") === "third_party_only"
|
|
185
|
+
? (config.aiMaxCandidatesPerAgent ?? 0)
|
|
186
|
+
: config.aiMaxCandidatesPerAgent,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
emitProgress(onProgress, "data_flow", 0.82, filesScanned, "Running structural enrichment...");
|
|
190
|
+
const structuralInference = await (0, pipeline_1.runInferencePipeline)(plannerInputBase, {
|
|
191
|
+
generateProposals: async (ctx) => (0, agent_orchestrator_1.generateAgenticProposals)({
|
|
192
|
+
components: ctx.components,
|
|
193
|
+
dataFlows: ctx.dataFlows,
|
|
194
|
+
sections: ctx.sections,
|
|
195
|
+
files: ctx.files,
|
|
196
|
+
findings: ctx.findings,
|
|
197
|
+
}, ctx.plan, ctx.candidates, (0, ai_orchestrator_options_1.buildAgentOrchestratorOptions)(config, {
|
|
198
|
+
llmEnabled: false,
|
|
199
|
+
skipStructuralHeuristics: false,
|
|
200
|
+
})),
|
|
201
|
+
});
|
|
202
|
+
components.splice(0, components.length, ...structuralInference.mergeResult.components);
|
|
203
|
+
dataFlows.splice(0, dataFlows.length, ...structuralInference.mergeResult.dataFlows);
|
|
204
|
+
structuralEnrichmentSummary = {
|
|
205
|
+
ran: true,
|
|
206
|
+
proposalsGenerated: structuralInference.proposals.length,
|
|
207
|
+
proposalsApplied: structuralInference.mergeResult.appliedProposalIds.length,
|
|
208
|
+
proposalsRejected: structuralInference.mergeResult.rejectedProposalIds.length,
|
|
209
|
+
};
|
|
210
|
+
if (config.enableAiInference) {
|
|
211
|
+
warnings.push("ai-inference: .env files are excluded from scans and provider prompts for security.");
|
|
212
|
+
const componentsBeforeAi = components.map((component) => ({
|
|
213
|
+
...component,
|
|
214
|
+
properties: { ...component.properties },
|
|
215
|
+
}));
|
|
216
|
+
emitProgress(onProgress, "data_flow", 0.85, filesScanned, "Running LLM inference...");
|
|
217
|
+
const orchOptions = (0, ai_orchestrator_options_1.buildAgentOrchestratorOptions)(config, {
|
|
218
|
+
llmEnabled: true,
|
|
219
|
+
skipStructuralHeuristics: true,
|
|
220
|
+
});
|
|
221
|
+
inference = await (0, langsmith_tracing_1.traceDataparadeAiInference)({
|
|
222
|
+
provider: orchOptions.provider,
|
|
223
|
+
model: orchOptions.model,
|
|
224
|
+
run: () => (0, pipeline_1.runInferencePipeline)(plannerInputBase, {
|
|
225
|
+
generateProposals: async (ctx) => (0, agent_orchestrator_1.generateAgenticProposals)({
|
|
226
|
+
components: ctx.components,
|
|
227
|
+
dataFlows: ctx.dataFlows,
|
|
228
|
+
sections: ctx.sections,
|
|
229
|
+
files: ctx.files,
|
|
230
|
+
findings: ctx.findings,
|
|
231
|
+
}, ctx.plan, ctx.candidates, orchOptions),
|
|
232
|
+
}),
|
|
233
|
+
});
|
|
234
|
+
components.splice(0, components.length, ...inference.mergeResult.components);
|
|
235
|
+
dataFlows.splice(0, dataFlows.length, ...inference.mergeResult.dataFlows);
|
|
236
|
+
postAiComponents = inference.mergeResult.components.map((component) => ({
|
|
237
|
+
...component,
|
|
238
|
+
properties: { ...component.properties },
|
|
239
|
+
}));
|
|
240
|
+
const appliedIds = inference.mergeResult.appliedProposalIds;
|
|
241
|
+
const genP = inference.proposals.filter((p) => p.id.startsWith("provider_"));
|
|
242
|
+
const appliedP = appliedIds.filter((id) => id.startsWith("provider_")).length;
|
|
243
|
+
warnings.push(`ai-inference: applied=${appliedIds.length} (provider=${appliedP}), rejected=${inference.mergeResult.rejectedProposalIds.length}`);
|
|
244
|
+
const proposalById = new Map(inference.proposals.map((p) => [p.id, p]));
|
|
245
|
+
const rejectionCounts = countRejectionsByReason(inference.mergeResult.rejectedProposalIds, proposalById);
|
|
246
|
+
const providerTargetNotFound = rejectionCounts.get("provider:target_not_found") ?? 0;
|
|
247
|
+
if (providerTargetNotFound > 0) {
|
|
248
|
+
warnings.push(`ai-provider: ${providerTargetNotFound} provider proposal(s) rejected as target_not_found (likely non-canonical targetComponentId; expected component IDs like cmp_*).`);
|
|
249
|
+
}
|
|
250
|
+
const providerEvidencePathMissing = rejectionCounts.get("provider:evidence_path_not_in_scan") ?? 0;
|
|
251
|
+
if (providerEvidencePathMissing > 0) {
|
|
252
|
+
warnings.push(`ai-provider: ${providerEvidencePathMissing} provider proposal(s) rejected due to evidence_path_not_in_scan.`);
|
|
253
|
+
}
|
|
254
|
+
const providerConfidenceRejected = [...rejectionCounts.entries()]
|
|
255
|
+
.filter(([k]) => k.startsWith("provider:confidence_below_threshold:"))
|
|
256
|
+
.reduce((acc, [, n]) => acc + n, 0);
|
|
257
|
+
if (providerConfidenceRejected > 0) {
|
|
258
|
+
warnings.push(`ai-provider: ${providerConfidenceRejected} provider proposal(s) rejected by confidence thresholds.`);
|
|
259
|
+
}
|
|
260
|
+
if (genP.length === 0) {
|
|
261
|
+
warnings.push([
|
|
262
|
+
"ai-provider: zero LLM proposals were accepted after inference.",
|
|
263
|
+
"Check workspace API key, BYOK credentials, network, and SCAN_AI_MAX_TOKENS for large prompts.",
|
|
264
|
+
"Set SCAN_AI_DEBUG=true to log provider HTTP status and parse/normalization details.",
|
|
265
|
+
].join(" "));
|
|
266
|
+
}
|
|
267
|
+
else if (genP.length > 0 && appliedP === 0) {
|
|
268
|
+
warnings.push("ai-provider: proposals were returned but none passed validation/merge (evidence paths, confidence, or thresholds).");
|
|
269
|
+
}
|
|
270
|
+
aiInferenceSummary = {
|
|
271
|
+
ran: true,
|
|
272
|
+
candidatesConsidered: inference.candidates.length,
|
|
273
|
+
proposalsGenerated: inference.proposals.length,
|
|
274
|
+
proposalsApplied: appliedIds.length,
|
|
275
|
+
proposalsRejected: inference.mergeResult.rejectedProposalIds.length,
|
|
276
|
+
proposalsGeneratedHeuristic: 0,
|
|
277
|
+
proposalsAppliedHeuristic: 0,
|
|
278
|
+
proposalsGeneratedProvider: genP.length,
|
|
279
|
+
proposalsAppliedProvider: appliedP,
|
|
280
|
+
aiProvider: orchOptions.platformProxy ? "dataparade" : orchOptions.provider,
|
|
281
|
+
aiModel: orchOptions.model,
|
|
282
|
+
providerCalls: inference.usageSummary?.providerCalls ?? 0,
|
|
283
|
+
inputTokens: inference.usageSummary?.inputTokens ?? 0,
|
|
284
|
+
outputTokens: inference.usageSummary?.outputTokens ?? 0,
|
|
285
|
+
totalTokens: inference.usageSummary?.totalTokens ?? 0,
|
|
286
|
+
estimatedCostUsd: inference.usageSummary?.estimatedCostUsd,
|
|
287
|
+
thirdPartyPropertyCoverage: buildThirdPartyCoverage({
|
|
288
|
+
proposals: inference.proposals,
|
|
289
|
+
appliedProposalIds: inference.mergeResult.appliedProposalIds,
|
|
290
|
+
rejectedProposalIds: inference.mergeResult.rejectedProposalIds,
|
|
291
|
+
componentsAfterAi: inference.mergeResult.components,
|
|
292
|
+
}),
|
|
293
|
+
agenticTrace: inference.usageSummary?.agenticTrace,
|
|
294
|
+
};
|
|
295
|
+
if (config.aiVerbose) {
|
|
296
|
+
aiInferenceProposalDetails = buildAiProposalDetails({
|
|
297
|
+
proposals: inference.proposals,
|
|
298
|
+
appliedProposalIds: inference.mergeResult.appliedProposalIds,
|
|
299
|
+
rejectedProposalIds: inference.mergeResult.rejectedProposalIds,
|
|
300
|
+
componentsBeforeAi,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const fallbackResult = (0, fallbacks_1.applyDeterministicInferenceFallbacks)(components, dataFlows);
|
|
305
|
+
components.splice(0, components.length, ...fallbackResult.components);
|
|
306
|
+
dataFlows = fallbackResult.dataFlows;
|
|
307
|
+
const subTypesFilledLate = (0, third_party_subtype_1.ensureThirdPartySubTypes)(components);
|
|
308
|
+
if (subTypesFilledLate > 0) {
|
|
309
|
+
warnings.push(`third-party-subtype: filled subType for ${subTypesFilledLate} third-party component(s) after inference.`);
|
|
310
|
+
}
|
|
311
|
+
dataFlows = (0, drop_cross_section_flows_1.dropCrossSectionServiceFlows)(components, dataFlows);
|
|
312
|
+
const scanDurationMs = Date.now() - start;
|
|
313
|
+
emitProgress(onProgress, "output", 0.95, filesScanned, "Assembling scan result...");
|
|
314
|
+
const reduced = (0, terraform_minimal_services_1.applyTerraformMinimalServiceScanResult)({
|
|
315
|
+
components,
|
|
316
|
+
dataFlows,
|
|
317
|
+
filesScanned,
|
|
318
|
+
filesSkipped: 0,
|
|
319
|
+
totalLines,
|
|
320
|
+
scanDurationMs,
|
|
321
|
+
warnings,
|
|
322
|
+
errors,
|
|
323
|
+
languageStats: languageStats.length > 0 ? languageStats : undefined,
|
|
324
|
+
aiInferenceSummary,
|
|
325
|
+
structuralEnrichmentSummary,
|
|
326
|
+
aiInferenceProposalDetails,
|
|
327
|
+
terraformScanSummary,
|
|
328
|
+
});
|
|
329
|
+
const stableIds = (0, stable_component_ids_1.assignStableComponentIds)(reduced.components, reduced.dataFlows);
|
|
330
|
+
if (aiInferenceSummary &&
|
|
331
|
+
inference &&
|
|
332
|
+
postAiComponents &&
|
|
333
|
+
config.aiThirdPartyDataFlowEnabled !== false) {
|
|
334
|
+
aiInferenceSummary = {
|
|
335
|
+
...aiInferenceSummary,
|
|
336
|
+
thirdPartyDataFlow: (0, third_party_data_flow_1.buildThirdPartyDataFlowSummary)({
|
|
337
|
+
proposals: inference.proposals,
|
|
338
|
+
appliedProposalIds: inference.mergeResult.appliedProposalIds,
|
|
339
|
+
componentsAfterAi: stableIds.components,
|
|
340
|
+
files,
|
|
341
|
+
agenticTrace: inference.usageSummary?.agenticTrace,
|
|
342
|
+
proposalTargetComponentIdRemap: (0, third_party_data_flow_1.buildProposalTargetComponentIdRemap)(postAiComponents, stableIds.components),
|
|
343
|
+
}),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
const scanResult = {
|
|
347
|
+
...reduced,
|
|
348
|
+
components: stableIds.components,
|
|
349
|
+
dataFlows: stableIds.dataFlows,
|
|
350
|
+
aiInferenceSummary,
|
|
351
|
+
structuralEnrichmentSummary,
|
|
352
|
+
};
|
|
353
|
+
const validation = (0, scan_result_schema_1.validateScanResult)(scanResult);
|
|
354
|
+
if (!validation.ok) {
|
|
355
|
+
errors.push(...validation.errors);
|
|
356
|
+
scanResult.errors = errors;
|
|
357
|
+
}
|
|
358
|
+
emitProgress(onProgress, "output", 1, filesScanned, "Scan complete.");
|
|
359
|
+
return {
|
|
360
|
+
scanResult,
|
|
361
|
+
files,
|
|
362
|
+
findings,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sortComponentsDeterministically = sortComponentsDeterministically;
|
|
4
|
+
exports.sortDataFlowsDeterministically = sortDataFlowsDeterministically;
|
|
5
|
+
function getSectionId(component) {
|
|
6
|
+
return typeof component.properties?.section_id === "string" &&
|
|
7
|
+
component.properties.section_id.trim()
|
|
8
|
+
? component.properties.section_id.trim()
|
|
9
|
+
: "<unsectioned>";
|
|
10
|
+
}
|
|
11
|
+
function sortComponentsDeterministically(components) {
|
|
12
|
+
components.sort((a, b) => {
|
|
13
|
+
const sa = getSectionId(a);
|
|
14
|
+
const sb = getSectionId(b);
|
|
15
|
+
const sectionCmp = sa.localeCompare(sb);
|
|
16
|
+
if (sectionCmp !== 0)
|
|
17
|
+
return sectionCmp;
|
|
18
|
+
const nameCmp = a.name.localeCompare(b.name);
|
|
19
|
+
if (nameCmp !== 0)
|
|
20
|
+
return nameCmp;
|
|
21
|
+
const typeCmp = a.type.localeCompare(b.type);
|
|
22
|
+
if (typeCmp !== 0)
|
|
23
|
+
return typeCmp;
|
|
24
|
+
const subTypeA = a.subType ?? "";
|
|
25
|
+
const subTypeB = b.subType ?? "";
|
|
26
|
+
const subCmp = subTypeA.localeCompare(subTypeB);
|
|
27
|
+
if (subCmp !== 0)
|
|
28
|
+
return subCmp;
|
|
29
|
+
return a.id.localeCompare(b.id);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function sortDataFlowsDeterministically(flows) {
|
|
33
|
+
flows.sort((a, b) => {
|
|
34
|
+
const typeCmp = a.type.localeCompare(b.type);
|
|
35
|
+
if (typeCmp !== 0)
|
|
36
|
+
return typeCmp;
|
|
37
|
+
const scCmp = a.sourceComponentId.localeCompare(b.sourceComponentId);
|
|
38
|
+
if (scCmp !== 0)
|
|
39
|
+
return scCmp;
|
|
40
|
+
const tcCmp = a.targetComponentId.localeCompare(b.targetComponentId);
|
|
41
|
+
if (tcCmp !== 0)
|
|
42
|
+
return tcCmp;
|
|
43
|
+
const idCmp = a.id.localeCompare(b.id);
|
|
44
|
+
if (idCmp !== 0)
|
|
45
|
+
return idCmp;
|
|
46
|
+
return a.confidence - b.confidence;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DetectedComponent } from "../types/component";
|
|
2
|
+
import type { DetectedDataFlow } from "../types/data-flow";
|
|
3
|
+
/**
|
|
4
|
+
* Deterministic identity for remapping component ids after Terraform reduction.
|
|
5
|
+
* Priority: terraform_address → managed service tuple → app surface tuple.
|
|
6
|
+
*/
|
|
7
|
+
export declare function stableComponentKey(component: DetectedComponent): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reassign `cmp_1` … `cmp_n` from {@link stableComponentKey} ordering and rewrite
|
|
10
|
+
* flow endpoints plus `managed_by_provider` references.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assignStableComponentIds(components: DetectedComponent[], dataFlows: DetectedDataFlow[]): {
|
|
13
|
+
components: DetectedComponent[];
|
|
14
|
+
dataFlows: DetectedDataFlow[];
|
|
15
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stableComponentKey = stableComponentKey;
|
|
4
|
+
exports.assignStableComponentIds = assignStableComponentIds;
|
|
5
|
+
const sectioning_1 = require("../../classifier/sectioning");
|
|
6
|
+
function normalizeName(name) {
|
|
7
|
+
return name.trim().toLowerCase().replace(/\s+/g, " ");
|
|
8
|
+
}
|
|
9
|
+
function firstSourceFilePath(component) {
|
|
10
|
+
const paths = (component.sourceLocations ?? []).map((loc) => loc.filePath.replace(/\\/g, "/"));
|
|
11
|
+
paths.sort((a, b) => a.localeCompare(b));
|
|
12
|
+
return paths[0] ?? "";
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Deterministic identity for remapping component ids after Terraform reduction.
|
|
16
|
+
* Priority: terraform_address → managed service tuple → app surface tuple.
|
|
17
|
+
*/
|
|
18
|
+
function stableComponentKey(component) {
|
|
19
|
+
const addr = component.properties?.terraform_address;
|
|
20
|
+
if (typeof addr === "string" && addr.trim()) {
|
|
21
|
+
return `tf:${addr.trim()}`;
|
|
22
|
+
}
|
|
23
|
+
const managedBy = component.properties?.managed_by_provider;
|
|
24
|
+
const managedKey = component.properties?.managed_service_key;
|
|
25
|
+
if (typeof managedBy === "string" &&
|
|
26
|
+
managedBy.trim() &&
|
|
27
|
+
typeof managedKey === "string" &&
|
|
28
|
+
managedKey.trim()) {
|
|
29
|
+
const sid = (0, sectioning_1.getSectionIdFromProperties)(component.properties);
|
|
30
|
+
return `managed:${managedBy.trim()}|${String(managedKey).trim()}|${sid}`;
|
|
31
|
+
}
|
|
32
|
+
const sid = (0, sectioning_1.getSectionIdFromProperties)(component.properties);
|
|
33
|
+
const subType = component.subType ?? "";
|
|
34
|
+
const filePath = firstSourceFilePath(component);
|
|
35
|
+
return `app:${sid}|${component.type}|${subType}|${filePath}|${normalizeName(component.name)}`;
|
|
36
|
+
}
|
|
37
|
+
function compareComponentsForStableIds(a, b) {
|
|
38
|
+
const keyCmp = stableComponentKey(a).localeCompare(stableComponentKey(b));
|
|
39
|
+
if (keyCmp !== 0)
|
|
40
|
+
return keyCmp;
|
|
41
|
+
return a.id.localeCompare(b.id);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reassign `cmp_1` … `cmp_n` from {@link stableComponentKey} ordering and rewrite
|
|
45
|
+
* flow endpoints plus `managed_by_provider` references.
|
|
46
|
+
*/
|
|
47
|
+
function assignStableComponentIds(components, dataFlows) {
|
|
48
|
+
const sorted = [...components].sort(compareComponentsForStableIds);
|
|
49
|
+
const idRemap = new Map();
|
|
50
|
+
sorted.forEach((component, index) => {
|
|
51
|
+
idRemap.set(component.id, `cmp_${index + 1}`);
|
|
52
|
+
});
|
|
53
|
+
const remappedComponents = components.map((component) => {
|
|
54
|
+
const newId = idRemap.get(component.id) ?? component.id;
|
|
55
|
+
const properties = { ...component.properties };
|
|
56
|
+
const managedBy = properties.managed_by_provider;
|
|
57
|
+
if (typeof managedBy === "string" && idRemap.has(managedBy)) {
|
|
58
|
+
properties.managed_by_provider = idRemap.get(managedBy);
|
|
59
|
+
}
|
|
60
|
+
return { ...component, id: newId, properties };
|
|
61
|
+
});
|
|
62
|
+
const remappedFlows = dataFlows.map((flow) => ({
|
|
63
|
+
...flow,
|
|
64
|
+
sourceComponentId: idRemap.get(flow.sourceComponentId) ?? flow.sourceComponentId,
|
|
65
|
+
targetComponentId: idRemap.get(flow.targetComponentId) ?? flow.targetComponentId,
|
|
66
|
+
}));
|
|
67
|
+
return { components: remappedComponents, dataFlows: remappedFlows };
|
|
68
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FileInfo, LanguageParserStats, RawFinding, ScanConfiguration, ScanResult, TerraformScanSummary } from "../types";
|
|
2
|
+
import type { ServiceSection } from "../sectioning/discover-service-sections";
|
|
3
|
+
export interface StructuralScanPhaseResult {
|
|
4
|
+
files: FileInfo[];
|
|
5
|
+
findings: RawFinding[];
|
|
6
|
+
sections: ServiceSection[];
|
|
7
|
+
monorepoPackageSectionPathDepth?: number;
|
|
8
|
+
filesScanned: number;
|
|
9
|
+
totalLines: number;
|
|
10
|
+
languageStats: LanguageParserStats[];
|
|
11
|
+
terraformScanSummary?: TerraformScanSummary;
|
|
12
|
+
}
|
|
13
|
+
export interface StructuralScanResult {
|
|
14
|
+
scanResult: ScanResult;
|
|
15
|
+
files: FileInfo[];
|
|
16
|
+
findings: RawFinding[];
|
|
17
|
+
}
|
|
18
|
+
export declare function runStructuralScanPhase(rootPath: string, config: ScanConfiguration, onWarning?: (warning: string) => void): Promise<StructuralScanPhaseResult>;
|
|
19
|
+
export declare function runStructuralScan(rootPath: string): Promise<StructuralScanResult>;
|