@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,32 @@
|
|
|
1
|
+
import type { DetectedComponent } from "../core/types/component";
|
|
2
|
+
import type { DetectedDataFlow } from "../core/types/data-flow";
|
|
3
|
+
/**
|
|
4
|
+
* Infer edges between Terraform-managed assets from `terraform_references`
|
|
5
|
+
* merged onto components (see Terraform detector).
|
|
6
|
+
*/
|
|
7
|
+
export declare function appendTerraformDataFlows(components: DetectedComponent[], startIndex: number): {
|
|
8
|
+
flows: DetectedDataFlow[];
|
|
9
|
+
nextIndex: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function terraformProviderLocalNameFromResourceType(resourceType: string): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves the `provider.<local>` third_party for a Terraform-managed asset
|
|
14
|
+
* (e.g. `aws_s3_bucket.*` → `provider.aws`).
|
|
15
|
+
*/
|
|
16
|
+
export declare function findTerraformProviderForResourceAsset(components: DetectedComponent[], asset: DetectedComponent): DetectedComponent | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Same role as the former `appendTerraformProviderAttachmentFlows`, but runs
|
|
19
|
+
* from {@link applyDeterministicInferenceFallbacks} **after** provider-topology
|
|
20
|
+
* managed nodes (so flow types / dedupe match the TypeScript path). Skips
|
|
21
|
+
* assets already tagged with `managed_by_provider` and skips pairs already in
|
|
22
|
+
* `pairKeys` (e.g. provider → resource edges emitted as `file_transfer`).
|
|
23
|
+
*
|
|
24
|
+
* Skips resources declared under a `module.*` address so the provider node does
|
|
25
|
+
* not fan out to every nested resource (references / topology already link the
|
|
26
|
+
* graph).
|
|
27
|
+
*/
|
|
28
|
+
export declare function appendTerraformBareProviderAttachmentFlows(input: {
|
|
29
|
+
components: DetectedComponent[];
|
|
30
|
+
flows: DetectedDataFlow[];
|
|
31
|
+
pairKeys: Set<string>;
|
|
32
|
+
}): void;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appendTerraformDataFlows = appendTerraformDataFlows;
|
|
4
|
+
exports.terraformProviderLocalNameFromResourceType = terraformProviderLocalNameFromResourceType;
|
|
5
|
+
exports.findTerraformProviderForResourceAsset = findTerraformProviderForResourceAsset;
|
|
6
|
+
exports.appendTerraformBareProviderAttachmentFlows = appendTerraformBareProviderAttachmentFlows;
|
|
7
|
+
const flow_builder_1 = require("./flow-builder");
|
|
8
|
+
function flowTypeForTerraformTarget(target) {
|
|
9
|
+
const st = target?.subType?.toLowerCase();
|
|
10
|
+
if (st === "database")
|
|
11
|
+
return "database_query";
|
|
12
|
+
if (st === "queue")
|
|
13
|
+
return "message_queue";
|
|
14
|
+
return "api_call";
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Terraform HCL references point from the dependent block to dependencies.
|
|
18
|
+
* For most edges we want **provision / data-supply direction**: referenced
|
|
19
|
+
* resource → block that consumes it (matches apply order and typical
|
|
20
|
+
* "infrastructure feeds this resource" reading).
|
|
21
|
+
*
|
|
22
|
+
* **Exception:** `database_query` keeps **caller → database** (the
|
|
23
|
+
* referencing workload initiates queries toward the DB).
|
|
24
|
+
*/
|
|
25
|
+
function terraformReferenceFlowEndpoints(referrer, refd, flowType) {
|
|
26
|
+
if (flowType === "database_query") {
|
|
27
|
+
return { source: referrer, target: refd };
|
|
28
|
+
}
|
|
29
|
+
return { source: refd, target: referrer };
|
|
30
|
+
}
|
|
31
|
+
function syntheticTerraformFinding(source) {
|
|
32
|
+
const loc = source.sourceLocations?.[0] ?? {
|
|
33
|
+
filePath: "terraform",
|
|
34
|
+
startLine: 1,
|
|
35
|
+
endLine: 1,
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
pattern: "terraform_resource",
|
|
39
|
+
name: "terraform_reference",
|
|
40
|
+
confidence: 0.85,
|
|
41
|
+
location: loc,
|
|
42
|
+
properties: {},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Infer edges between Terraform-managed assets from `terraform_references`
|
|
47
|
+
* merged onto components (see Terraform detector).
|
|
48
|
+
*/
|
|
49
|
+
function appendTerraformDataFlows(components, startIndex) {
|
|
50
|
+
const flows = [];
|
|
51
|
+
let flowIndex = startIndex;
|
|
52
|
+
const addressToComponent = new Map();
|
|
53
|
+
for (const c of components) {
|
|
54
|
+
const addr = c.properties?.terraform_address;
|
|
55
|
+
if (typeof addr === "string" && addr.trim()) {
|
|
56
|
+
addressToComponent.set(addr.trim(), c);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const seen = new Set();
|
|
60
|
+
for (const component of components) {
|
|
61
|
+
const sourceAddr = component.properties?.terraform_address;
|
|
62
|
+
if (typeof sourceAddr !== "string" || !sourceAddr.trim())
|
|
63
|
+
continue;
|
|
64
|
+
const rawRefs = component.properties?.terraform_references;
|
|
65
|
+
if (!Array.isArray(rawRefs) || rawRefs.length === 0)
|
|
66
|
+
continue;
|
|
67
|
+
const refs = rawRefs.filter((r) => typeof r === "string");
|
|
68
|
+
for (const ref of refs) {
|
|
69
|
+
const target = addressToComponent.get(ref);
|
|
70
|
+
if (!target || target.id === component.id)
|
|
71
|
+
continue;
|
|
72
|
+
const flowType = flowTypeForTerraformTarget(target);
|
|
73
|
+
const { source, target: dest } = terraformReferenceFlowEndpoints(component, target, flowType);
|
|
74
|
+
const key = `${source.id}::${dest.id}::${flowType}`;
|
|
75
|
+
if (seen.has(key))
|
|
76
|
+
continue;
|
|
77
|
+
seen.add(key);
|
|
78
|
+
flowIndex += 1;
|
|
79
|
+
const finding = syntheticTerraformFinding(source);
|
|
80
|
+
flows.push((0, flow_builder_1.buildFlow)(source.id, dest.id, flowType, finding, flowIndex, source, dest));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return { flows, nextIndex: flowIndex };
|
|
84
|
+
}
|
|
85
|
+
function terraformProviderLocalNameFromResourceType(resourceType) {
|
|
86
|
+
const rt = resourceType.trim().toLowerCase();
|
|
87
|
+
const idx = rt.indexOf("_");
|
|
88
|
+
if (idx <= 0)
|
|
89
|
+
return undefined;
|
|
90
|
+
return rt.slice(0, idx);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolves the `provider.<local>` third_party for a Terraform-managed asset
|
|
94
|
+
* (e.g. `aws_s3_bucket.*` → `provider.aws`).
|
|
95
|
+
*/
|
|
96
|
+
function findTerraformProviderForResourceAsset(components, asset) {
|
|
97
|
+
if (asset.type !== "asset")
|
|
98
|
+
return undefined;
|
|
99
|
+
const rt = asset.properties?.resource_type;
|
|
100
|
+
if (typeof rt !== "string" || !rt.includes("_"))
|
|
101
|
+
return undefined;
|
|
102
|
+
const localName = terraformProviderLocalNameFromResourceType(rt);
|
|
103
|
+
if (!localName)
|
|
104
|
+
return undefined;
|
|
105
|
+
const wantAddr = `provider.${localName}`;
|
|
106
|
+
return components.find((c) => c.type === "third_party" &&
|
|
107
|
+
typeof c.properties?.terraform_address === "string" &&
|
|
108
|
+
c.properties.terraform_address.trim() === wantAddr);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Same role as the former `appendTerraformProviderAttachmentFlows`, but runs
|
|
112
|
+
* from {@link applyDeterministicInferenceFallbacks} **after** provider-topology
|
|
113
|
+
* managed nodes (so flow types / dedupe match the TypeScript path). Skips
|
|
114
|
+
* assets already tagged with `managed_by_provider` and skips pairs already in
|
|
115
|
+
* `pairKeys` (e.g. provider → resource edges emitted as `file_transfer`).
|
|
116
|
+
*
|
|
117
|
+
* Skips resources declared under a `module.*` address so the provider node does
|
|
118
|
+
* not fan out to every nested resource (references / topology already link the
|
|
119
|
+
* graph).
|
|
120
|
+
*/
|
|
121
|
+
function appendTerraformBareProviderAttachmentFlows(input) {
|
|
122
|
+
const byAddr = new Map();
|
|
123
|
+
for (const c of input.components) {
|
|
124
|
+
const a = c.properties?.terraform_address;
|
|
125
|
+
if (typeof a === "string" && a.trim()) {
|
|
126
|
+
byAddr.set(a.trim(), c);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
for (const c of input.components) {
|
|
130
|
+
if (c.type !== "asset")
|
|
131
|
+
continue;
|
|
132
|
+
if (typeof c.properties?.managed_by_provider === "string")
|
|
133
|
+
continue;
|
|
134
|
+
const rt = c.properties?.resource_type;
|
|
135
|
+
if (typeof rt !== "string" || !rt.includes("_"))
|
|
136
|
+
continue;
|
|
137
|
+
const addrRaw = c.properties?.terraform_address;
|
|
138
|
+
if (typeof addrRaw === "string" &&
|
|
139
|
+
addrRaw.startsWith("module.") &&
|
|
140
|
+
addrRaw.split(".").length > 2) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const localName = terraformProviderLocalNameFromResourceType(rt);
|
|
144
|
+
if (!localName)
|
|
145
|
+
continue;
|
|
146
|
+
const prov = byAddr.get(`provider.${localName}`);
|
|
147
|
+
if (!prov || prov.type !== "third_party")
|
|
148
|
+
continue;
|
|
149
|
+
if (prov.id === c.id)
|
|
150
|
+
continue;
|
|
151
|
+
const pairKey = `${prov.id}::${c.id}`;
|
|
152
|
+
if (input.pairKeys.has(pairKey))
|
|
153
|
+
continue;
|
|
154
|
+
input.pairKeys.add(pairKey);
|
|
155
|
+
const loc = c.sourceLocations?.[0] ?? {
|
|
156
|
+
filePath: "terraform",
|
|
157
|
+
startLine: 1,
|
|
158
|
+
endLine: 1,
|
|
159
|
+
};
|
|
160
|
+
input.flows.push({
|
|
161
|
+
id: `flow_fallback_${input.flows.length + 1}`,
|
|
162
|
+
sourceComponentId: prov.id,
|
|
163
|
+
targetComponentId: c.id,
|
|
164
|
+
type: "api_call",
|
|
165
|
+
confidence: 0.72,
|
|
166
|
+
sourceLocation: loc,
|
|
167
|
+
description: `${prov.name} terraform provider attachment (${String(c.properties?.terraform_address ?? "")})`,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DetectedComponent } from "../core/types/component";
|
|
2
|
+
import type { DetectedDataFlow } from "../core/types/data-flow";
|
|
3
|
+
export interface EvalScores {
|
|
4
|
+
nodePropertyFillRate: number;
|
|
5
|
+
tieredPropertyCompleteness: number;
|
|
6
|
+
thirdPartyCompleteness: number;
|
|
7
|
+
directionAccuracy: number;
|
|
8
|
+
interactionRecall: number;
|
|
9
|
+
precisionGuardrail: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function computeEvalScores(input: {
|
|
12
|
+
components: DetectedComponent[];
|
|
13
|
+
dataFlows: DetectedDataFlow[];
|
|
14
|
+
expectedCrossSectionLinks?: Array<{
|
|
15
|
+
sourceSection: string;
|
|
16
|
+
targetSection: string;
|
|
17
|
+
}>;
|
|
18
|
+
}): EvalScores;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeEvalScores = computeEvalScores;
|
|
4
|
+
function isFilled(value) {
|
|
5
|
+
if (value == null)
|
|
6
|
+
return false;
|
|
7
|
+
if (Array.isArray(value))
|
|
8
|
+
return value.length > 0;
|
|
9
|
+
return value !== false && value !== "";
|
|
10
|
+
}
|
|
11
|
+
function computeEvalScores(input) {
|
|
12
|
+
const { components, dataFlows, expectedCrossSectionLinks = [] } = input;
|
|
13
|
+
const componentValues = components.flatMap((component) => Object.values(component.properties));
|
|
14
|
+
const filled = componentValues.filter(isFilled).length;
|
|
15
|
+
const nodePropertyFillRate = componentValues.length === 0 ? 0 : filled / componentValues.length;
|
|
16
|
+
const tier1Fields = ["encryption_at_rest", "authentication_methods", "gdpr_role"];
|
|
17
|
+
const weighted = components.map((component) => {
|
|
18
|
+
const values = tier1Fields.map((field) => component.properties[field]);
|
|
19
|
+
const localFilled = values.filter(isFilled).length;
|
|
20
|
+
return values.length === 0 ? 0 : localFilled / values.length;
|
|
21
|
+
});
|
|
22
|
+
const tieredPropertyCompleteness = weighted.length === 0
|
|
23
|
+
? 0
|
|
24
|
+
: weighted.reduce((sum, value) => sum + value, 0) / weighted.length;
|
|
25
|
+
const thirdParties = components.filter((component) => component.type === "third_party");
|
|
26
|
+
const tpComplete = thirdParties.filter((component) => Boolean(component.subType) &&
|
|
27
|
+
isFilled(component.properties.vendor ?? component.properties.client)).length;
|
|
28
|
+
const thirdPartyCompleteness = thirdParties.length === 0 ? 1 : tpComplete / thirdParties.length;
|
|
29
|
+
const actorFlows = dataFlows.filter((flow) => {
|
|
30
|
+
const source = components.find((component) => component.id === flow.sourceComponentId);
|
|
31
|
+
const target = components.find((component) => component.id === flow.targetComponentId);
|
|
32
|
+
return source?.type === "actor" && target?.type === "asset";
|
|
33
|
+
});
|
|
34
|
+
const directionAccuracy = actorFlows.length === 0 ? 1 : actorFlows.length / Math.max(1, actorFlows.length);
|
|
35
|
+
let matchedCross = 0;
|
|
36
|
+
for (const expected of expectedCrossSectionLinks) {
|
|
37
|
+
const hit = dataFlows.some((flow) => {
|
|
38
|
+
const source = components.find((component) => component.id === flow.sourceComponentId);
|
|
39
|
+
const target = components.find((component) => component.id === flow.targetComponentId);
|
|
40
|
+
return (String(source?.properties.section_id ?? "") === expected.sourceSection &&
|
|
41
|
+
String(target?.properties.section_id ?? "") === expected.targetSection);
|
|
42
|
+
});
|
|
43
|
+
if (hit)
|
|
44
|
+
matchedCross += 1;
|
|
45
|
+
}
|
|
46
|
+
const interactionRecall = expectedCrossSectionLinks.length === 0
|
|
47
|
+
? 1
|
|
48
|
+
: matchedCross / expectedCrossSectionLinks.length;
|
|
49
|
+
const precisionGuardrail = Math.max(0, 1 - dataFlows.filter((flow) => flow.confidence < 0.5).length / Math.max(1, dataFlows.length));
|
|
50
|
+
return {
|
|
51
|
+
nodePropertyFillRate,
|
|
52
|
+
tieredPropertyCompleteness,
|
|
53
|
+
thirdPartyCompleteness,
|
|
54
|
+
directionAccuracy,
|
|
55
|
+
interactionRecall,
|
|
56
|
+
precisionGuardrail,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../config/load-cli-env";
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
require("../config/load-cli-env");
|
|
9
|
+
const orchestrator_1 = require("../core/pipeline/orchestrator");
|
|
10
|
+
const metrics_1 = require("./metrics");
|
|
11
|
+
function parseArg(flag) {
|
|
12
|
+
const idx = process.argv.indexOf(flag);
|
|
13
|
+
if (idx < 0)
|
|
14
|
+
return undefined;
|
|
15
|
+
return process.argv[idx + 1];
|
|
16
|
+
}
|
|
17
|
+
async function run() {
|
|
18
|
+
const fixturePath = parseArg("--fixture");
|
|
19
|
+
const modelsArg = parseArg("--models") ?? "mock:heuristic";
|
|
20
|
+
if (!fixturePath) {
|
|
21
|
+
throw new Error("Missing --fixture <path>");
|
|
22
|
+
}
|
|
23
|
+
const models = modelsArg.split(",").map((entry) => entry.trim()).filter(Boolean);
|
|
24
|
+
const report = [];
|
|
25
|
+
for (const modelEntry of models) {
|
|
26
|
+
const [provider, model] = modelEntry.includes(":")
|
|
27
|
+
? modelEntry.split(":")
|
|
28
|
+
: ["mock", modelEntry];
|
|
29
|
+
const config = (0, orchestrator_1.createDefaultScanConfiguration)({
|
|
30
|
+
enableAiInference: provider !== "none",
|
|
31
|
+
aiProvider: provider,
|
|
32
|
+
aiModel: model,
|
|
33
|
+
});
|
|
34
|
+
const result = await (0, orchestrator_1.scan)(node_path_1.default.resolve(process.cwd(), fixturePath), config);
|
|
35
|
+
report.push({
|
|
36
|
+
model,
|
|
37
|
+
provider,
|
|
38
|
+
scores: (0, metrics_1.computeEvalScores)({
|
|
39
|
+
components: result.scanResult.components,
|
|
40
|
+
dataFlows: result.scanResult.dataFlows,
|
|
41
|
+
}),
|
|
42
|
+
warnings: result.scanResult.warnings,
|
|
43
|
+
errors: result.scanResult.errors,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const outputDir = node_path_1.default.resolve(process.cwd(), "outputs");
|
|
47
|
+
node_fs_1.default.mkdirSync(outputDir, { recursive: true });
|
|
48
|
+
const jsonPath = node_path_1.default.join(outputDir, "model-eval-report.json");
|
|
49
|
+
const markdownPath = node_path_1.default.join(outputDir, "model-eval-report.md");
|
|
50
|
+
node_fs_1.default.writeFileSync(jsonPath, JSON.stringify(report, null, 2), "utf8");
|
|
51
|
+
const markdown = [
|
|
52
|
+
"# Model Eval Report",
|
|
53
|
+
"",
|
|
54
|
+
...report.map((entry) => [
|
|
55
|
+
`## ${entry.provider}:${entry.model}`,
|
|
56
|
+
`- nodePropertyFillRate: ${entry.scores.nodePropertyFillRate.toFixed(3)}`,
|
|
57
|
+
`- tieredPropertyCompleteness: ${entry.scores.tieredPropertyCompleteness.toFixed(3)}`,
|
|
58
|
+
`- thirdPartyCompleteness: ${entry.scores.thirdPartyCompleteness.toFixed(3)}`,
|
|
59
|
+
`- directionAccuracy: ${entry.scores.directionAccuracy.toFixed(3)}`,
|
|
60
|
+
`- interactionRecall: ${entry.scores.interactionRecall.toFixed(3)}`,
|
|
61
|
+
`- precisionGuardrail: ${entry.scores.precisionGuardrail.toFixed(3)}`,
|
|
62
|
+
].join("\n")),
|
|
63
|
+
].join("\n");
|
|
64
|
+
node_fs_1.default.writeFileSync(markdownPath, markdown, "utf8");
|
|
65
|
+
// eslint-disable-next-line no-console
|
|
66
|
+
console.log(`Model eval reports written:\n- ${jsonPath}\n- ${markdownPath}`);
|
|
67
|
+
}
|
|
68
|
+
void run();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.run = void 0;
|
|
18
|
+
var cli_1 = require("./cli");
|
|
19
|
+
Object.defineProperty(exports, "run", { enumerable: true, get: function () { return cli_1.run; } });
|
|
20
|
+
__exportStar(require("./ai-enrichment"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FileInfo } from "../core/types/file";
|
|
2
|
+
export interface IngestOptions {
|
|
3
|
+
maxFileSizeBytes?: number;
|
|
4
|
+
maxFileCount?: number;
|
|
5
|
+
maxTotalBytes?: number;
|
|
6
|
+
excludePaths?: string[];
|
|
7
|
+
onWarning?: (warning: string) => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a user-supplied scan path to a directory (for config, Terraform cwd,
|
|
11
|
+
* section discovery) and an ingest target (directory walk or a single file).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveScanFilesystemEntry(rootPath: string): Promise<{
|
|
14
|
+
scanRootDir: string;
|
|
15
|
+
ingestTarget: string;
|
|
16
|
+
}>;
|
|
17
|
+
export declare function ingestFileSystem(rootPath: string, options?: IngestOptions): Promise<FileInfo[]>;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resolveScanFilesystemEntry = resolveScanFilesystemEntry;
|
|
37
|
+
exports.ingestFileSystem = ingestFileSystem;
|
|
38
|
+
const fs_1 = require("fs");
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
const scan_exclusions_1 = require("../patterns/scan-exclusions");
|
|
41
|
+
const gitignore_1 = require("./gitignore");
|
|
42
|
+
const sensitive_paths_1 = require("./sensitive-paths");
|
|
43
|
+
const DEFAULT_MAX_FILE_SIZE_BYTES = 2 * 1024 * 1024; // 2MB
|
|
44
|
+
const DEFAULT_MAX_FILE_COUNT = 20_000;
|
|
45
|
+
const DEFAULT_MAX_TOTAL_BYTES = 200 * 1024 * 1024; // 200MB
|
|
46
|
+
function normalizeUserPattern(pattern) {
|
|
47
|
+
return (0, gitignore_1.toPosixPath)(pattern.replace(/^\.\/+/, "").trim());
|
|
48
|
+
}
|
|
49
|
+
function isExcludedByUserPatterns(relativePath, isDirectory, excludePaths) {
|
|
50
|
+
const rel = (0, gitignore_1.toPosixPath)(relativePath);
|
|
51
|
+
for (const rawPattern of excludePaths) {
|
|
52
|
+
const pattern = normalizeUserPattern(rawPattern);
|
|
53
|
+
if (!pattern)
|
|
54
|
+
continue;
|
|
55
|
+
// Treat "dir/**" as excluding the directory itself and all descendants.
|
|
56
|
+
if (pattern.endsWith("/**")) {
|
|
57
|
+
const prefix = pattern.slice(0, -3).replace(/\/$/, "");
|
|
58
|
+
if (rel === prefix || rel.startsWith(`${prefix}/`))
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
const regex = (0, gitignore_1.gitignorePatternToRegex)(pattern, isDirectory);
|
|
62
|
+
if (regex.test(rel))
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function getFileLanguage(filePath) {
|
|
68
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
69
|
+
const base = path.basename(filePath).toLowerCase();
|
|
70
|
+
if (ext === ".ts" || ext === ".tsx") {
|
|
71
|
+
return "typescript";
|
|
72
|
+
}
|
|
73
|
+
if (ext === ".js" || ext === ".jsx" || ext === ".mjs" || ext === ".cjs") {
|
|
74
|
+
return "javascript";
|
|
75
|
+
}
|
|
76
|
+
if (ext === ".py") {
|
|
77
|
+
return "python";
|
|
78
|
+
}
|
|
79
|
+
if (ext === ".json") {
|
|
80
|
+
return "json";
|
|
81
|
+
}
|
|
82
|
+
if (ext === ".yaml" || ext === ".yml") {
|
|
83
|
+
return "yaml";
|
|
84
|
+
}
|
|
85
|
+
if (ext === ".tf" || ext === ".tfvars") {
|
|
86
|
+
return "terraform";
|
|
87
|
+
}
|
|
88
|
+
// Handle .env, .env.local, etc. (basename starts with .env)
|
|
89
|
+
if (base === ".env" || base.startsWith(".env.")) {
|
|
90
|
+
return "env";
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve a user-supplied scan path to a directory (for config, Terraform cwd,
|
|
96
|
+
* section discovery) and an ingest target (directory walk or a single file).
|
|
97
|
+
*/
|
|
98
|
+
async function resolveScanFilesystemEntry(rootPath) {
|
|
99
|
+
const abs = path.resolve(rootPath);
|
|
100
|
+
const st = await fs_1.promises.stat(abs);
|
|
101
|
+
if (st.isDirectory()) {
|
|
102
|
+
return { scanRootDir: abs, ingestTarget: abs };
|
|
103
|
+
}
|
|
104
|
+
if (st.isFile()) {
|
|
105
|
+
return { scanRootDir: path.dirname(abs), ingestTarget: abs };
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`Scan path is not a file or directory: ${abs}`);
|
|
108
|
+
}
|
|
109
|
+
async function ingestSingleFile(fileAbs, options) {
|
|
110
|
+
const scanRootDir = path.dirname(fileAbs);
|
|
111
|
+
const relativePath = (0, gitignore_1.toPosixPath)(path.relative(scanRootDir, fileAbs));
|
|
112
|
+
const basename = path.basename(fileAbs);
|
|
113
|
+
const excludePaths = options.excludePaths ?? [];
|
|
114
|
+
if ((0, sensitive_paths_1.isSensitiveEnvPath)(relativePath) || (0, sensitive_paths_1.isSensitiveEnvPath)(basename)) {
|
|
115
|
+
options.onWarning?.(`Skipped "${basename}" (excluded for security).`);
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
if (relativePath &&
|
|
119
|
+
isExcludedByUserPatterns(relativePath, false, excludePaths)) {
|
|
120
|
+
options.onWarning?.(`Skipped "${relativePath}" (matched exclude pattern).`);
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
const language = getFileLanguage(fileAbs);
|
|
124
|
+
if (!language) {
|
|
125
|
+
options.onWarning?.(`Skipping unsupported file type: ${basename}`);
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const stat = await fs_1.promises.stat(fileAbs);
|
|
129
|
+
if (stat.size > options.maxFileSizeBytes) {
|
|
130
|
+
options.onWarning?.(`Skipped "${path.basename(fileAbs)}" (${stat.size} bytes) because it exceeds max file size (${options.maxFileSizeBytes} bytes).`);
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
if (stat.size > options.maxTotalBytes) {
|
|
134
|
+
options.onWarning?.(`Skipped "${path.basename(fileAbs)}" because ingest byte budget (${options.maxTotalBytes} bytes) would be exceeded.`);
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
const content = await fs_1.promises.readFile(fileAbs, "utf8");
|
|
138
|
+
return [
|
|
139
|
+
{
|
|
140
|
+
path: relativePath,
|
|
141
|
+
name: basename,
|
|
142
|
+
content,
|
|
143
|
+
language,
|
|
144
|
+
size: stat.size,
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
}
|
|
148
|
+
async function walkDirectory(currentDir, rootDir, accumulatedRules, files, options, state) {
|
|
149
|
+
if (state.fileCountLimitReached)
|
|
150
|
+
return;
|
|
151
|
+
const excludePaths = options.excludePaths ?? [];
|
|
152
|
+
const rules = await (0, gitignore_1.gitignoreRulesForDir)(currentDir, accumulatedRules);
|
|
153
|
+
const entries = await fs_1.promises.readdir(currentDir, { withFileTypes: true });
|
|
154
|
+
for (const entry of entries) {
|
|
155
|
+
if (state.fileCountLimitReached)
|
|
156
|
+
return;
|
|
157
|
+
const entryPath = path.join(currentDir, entry.name);
|
|
158
|
+
const relativePath = (0, gitignore_1.toPosixPath)(path.relative(rootDir, entryPath));
|
|
159
|
+
if (entry.isDirectory()) {
|
|
160
|
+
if ((0, scan_exclusions_1.shouldSkipDirectoryName)(entry.name)) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
if (relativePath &&
|
|
164
|
+
isExcludedByUserPatterns(relativePath, true, excludePaths)) {
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
if ((0, gitignore_1.isPathIgnored)(entryPath, true, rules)) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
await walkDirectory(entryPath, rootDir, rules, files, options, state);
|
|
171
|
+
}
|
|
172
|
+
else if (entry.isFile()) {
|
|
173
|
+
if (relativePath &&
|
|
174
|
+
isExcludedByUserPatterns(relativePath, false, excludePaths)) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if ((0, gitignore_1.isPathIgnored)(entryPath, false, rules)) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const language = getFileLanguage(entryPath);
|
|
181
|
+
if (!language)
|
|
182
|
+
continue;
|
|
183
|
+
const stat = await fs_1.promises.stat(entryPath);
|
|
184
|
+
if (stat.size > options.maxFileSizeBytes) {
|
|
185
|
+
options.onWarning?.(`Skipped "${relativePath}" (${stat.size} bytes) because it exceeds max file size (${options.maxFileSizeBytes} bytes).`);
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
if (state.totalBytesIncluded + stat.size >
|
|
189
|
+
options.maxTotalBytes) {
|
|
190
|
+
options.onWarning?.(`Skipped "${relativePath}" because ingest byte budget (${options.maxTotalBytes} bytes) would be exceeded.`);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (state.filesIncluded >= options.maxFileCount) {
|
|
194
|
+
state.fileCountLimitReached = true;
|
|
195
|
+
options.onWarning?.(`Stopped ingest after ${state.filesIncluded} files because max file count (${options.maxFileCount}) was reached.`);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const content = await fs_1.promises.readFile(entryPath, "utf8");
|
|
199
|
+
files.push({
|
|
200
|
+
path: relativePath,
|
|
201
|
+
name: entry.name,
|
|
202
|
+
content,
|
|
203
|
+
language,
|
|
204
|
+
size: stat.size,
|
|
205
|
+
});
|
|
206
|
+
state.filesIncluded += 1;
|
|
207
|
+
state.totalBytesIncluded += stat.size;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function ingestFileSystem(rootPath, options = {}) {
|
|
212
|
+
const abs = path.resolve(rootPath);
|
|
213
|
+
const st = await fs_1.promises.stat(abs);
|
|
214
|
+
const resolvedOptions = {
|
|
215
|
+
maxFileSizeBytes: options.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES,
|
|
216
|
+
maxFileCount: options.maxFileCount ?? DEFAULT_MAX_FILE_COUNT,
|
|
217
|
+
maxTotalBytes: options.maxTotalBytes ?? DEFAULT_MAX_TOTAL_BYTES,
|
|
218
|
+
excludePaths: [
|
|
219
|
+
...scan_exclusions_1.DEFAULT_EXCLUDED_FILE_GLOBS,
|
|
220
|
+
...(options.excludePaths ?? []),
|
|
221
|
+
],
|
|
222
|
+
onWarning: options.onWarning,
|
|
223
|
+
};
|
|
224
|
+
if (st.isFile()) {
|
|
225
|
+
return ingestSingleFile(abs, resolvedOptions);
|
|
226
|
+
}
|
|
227
|
+
if (!st.isDirectory()) {
|
|
228
|
+
throw new Error(`Scan path is not a file or directory: ${abs}`);
|
|
229
|
+
}
|
|
230
|
+
const rootDir = abs;
|
|
231
|
+
const files = [];
|
|
232
|
+
const state = {
|
|
233
|
+
filesIncluded: 0,
|
|
234
|
+
totalBytesIncluded: 0,
|
|
235
|
+
fileCountLimitReached: false,
|
|
236
|
+
};
|
|
237
|
+
await walkDirectory(rootDir, rootDir, [], files, resolvedOptions, state);
|
|
238
|
+
return files;
|
|
239
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type IgnoreRule = {
|
|
2
|
+
baseDir: string;
|
|
3
|
+
pattern: string;
|
|
4
|
+
negate: boolean;
|
|
5
|
+
dirOnly: boolean;
|
|
6
|
+
regex: RegExp;
|
|
7
|
+
};
|
|
8
|
+
export declare function toPosixPath(p: string): string;
|
|
9
|
+
export declare function gitignorePatternToRegex(pattern: string, dirOnly: boolean): RegExp;
|
|
10
|
+
export declare function readGitignore(dir: string): Promise<IgnoreRule[]>;
|
|
11
|
+
export declare function gitignoreRulesForDir(currentDir: string, accumulatedRules: IgnoreRule[]): Promise<IgnoreRule[]>;
|
|
12
|
+
export declare function isPathIgnored(absolutePath: string, isDirectory: boolean, rules: IgnoreRule[]): boolean;
|