@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,39 @@
|
|
|
1
|
+
import type { RawFinding } from "../../core/types/detection";
|
|
2
|
+
import type { FileInfo } from "../../core/types/file";
|
|
3
|
+
import type { ServiceSection } from "../../core/sectioning/discover-service-sections";
|
|
4
|
+
import type { DetectedComponent } from "../../core/types/component";
|
|
5
|
+
import type { DetectedDataFlow } from "../../core/types/data-flow";
|
|
6
|
+
import type { AiInferenceCandidate, AiProposal } from "../types";
|
|
7
|
+
export interface AiScanContext {
|
|
8
|
+
components: DetectedComponent[];
|
|
9
|
+
dataFlows: DetectedDataFlow[];
|
|
10
|
+
findings: RawFinding[];
|
|
11
|
+
files: FileInfo[];
|
|
12
|
+
sections: ServiceSection[];
|
|
13
|
+
}
|
|
14
|
+
export interface AgentTooling {
|
|
15
|
+
getScanContext(): AiScanContext;
|
|
16
|
+
listCandidates(filter?: {
|
|
17
|
+
candidateType?: AiInferenceCandidate["candidateType"];
|
|
18
|
+
minPriority?: number;
|
|
19
|
+
}): AiInferenceCandidate[];
|
|
20
|
+
getGraphNeighborhood(nodeOrFlowId: string, depth: number): {
|
|
21
|
+
components: DetectedComponent[];
|
|
22
|
+
dataFlows: DetectedDataFlow[];
|
|
23
|
+
};
|
|
24
|
+
readSnippet(filePath: string, startLine: number, endLine: number): string | undefined;
|
|
25
|
+
searchInFiles(query: string, scope?: string[]): Array<{
|
|
26
|
+
filePath: string;
|
|
27
|
+
line: number;
|
|
28
|
+
snippet: string;
|
|
29
|
+
}>;
|
|
30
|
+
getSymbolContext(symbol: string, filePath: string): string | undefined;
|
|
31
|
+
validateProposal(proposal: AiProposal): {
|
|
32
|
+
ok: true;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
reason: string;
|
|
36
|
+
};
|
|
37
|
+
emitProposal(proposal: AiProposal): void;
|
|
38
|
+
}
|
|
39
|
+
export declare function createAgentTooling(scanContext: AiScanContext, candidates: AiInferenceCandidate[], proposalSink: AiProposal[]): AgentTooling;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAgentTooling = createAgentTooling;
|
|
4
|
+
const scan_paths_1 = require("../scan-paths");
|
|
5
|
+
function fileLines(content) {
|
|
6
|
+
return content.split(/\r?\n/);
|
|
7
|
+
}
|
|
8
|
+
function createAgentTooling(scanContext, candidates, proposalSink) {
|
|
9
|
+
const byFilePath = new Map(scanContext.files.map((file) => [file.path, file]));
|
|
10
|
+
return {
|
|
11
|
+
getScanContext: () => scanContext,
|
|
12
|
+
listCandidates: (filter) => candidates.filter((candidate) => {
|
|
13
|
+
if (filter?.candidateType && candidate.candidateType !== filter.candidateType) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (typeof filter?.minPriority === "number" &&
|
|
17
|
+
candidate.priority < filter.minPriority) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
}),
|
|
22
|
+
getGraphNeighborhood: (nodeOrFlowId, depth) => {
|
|
23
|
+
const targetFlow = scanContext.dataFlows.find((flow) => flow.id === nodeOrFlowId);
|
|
24
|
+
const startNodes = new Set();
|
|
25
|
+
if (targetFlow) {
|
|
26
|
+
startNodes.add(targetFlow.sourceComponentId);
|
|
27
|
+
startNodes.add(targetFlow.targetComponentId);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
startNodes.add(nodeOrFlowId);
|
|
31
|
+
}
|
|
32
|
+
const frontier = new Set(startNodes);
|
|
33
|
+
const visited = new Set(startNodes);
|
|
34
|
+
for (let i = 0; i < Math.max(1, depth); i += 1) {
|
|
35
|
+
const next = new Set();
|
|
36
|
+
for (const flow of scanContext.dataFlows) {
|
|
37
|
+
if (frontier.has(flow.sourceComponentId)) {
|
|
38
|
+
next.add(flow.targetComponentId);
|
|
39
|
+
}
|
|
40
|
+
if (frontier.has(flow.targetComponentId)) {
|
|
41
|
+
next.add(flow.sourceComponentId);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
for (const nodeId of next) {
|
|
45
|
+
visited.add(nodeId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
components: scanContext.components.filter((component) => visited.has(component.id)),
|
|
50
|
+
dataFlows: scanContext.dataFlows.filter((flow) => visited.has(flow.sourceComponentId) || visited.has(flow.targetComponentId)),
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
readSnippet: (filePath, startLine, endLine) => {
|
|
54
|
+
const file = byFilePath.get(filePath);
|
|
55
|
+
if (!file)
|
|
56
|
+
return undefined;
|
|
57
|
+
const lines = fileLines(file.content);
|
|
58
|
+
const start = Math.max(1, startLine);
|
|
59
|
+
const end = Math.max(start, endLine);
|
|
60
|
+
return lines.slice(start - 1, end).join("\n");
|
|
61
|
+
},
|
|
62
|
+
searchInFiles: (query, scope) => {
|
|
63
|
+
const q = query.toLowerCase();
|
|
64
|
+
return scanContext.files
|
|
65
|
+
.filter((file) => !scope || scope.length === 0
|
|
66
|
+
? true
|
|
67
|
+
: scope.some((prefix) => file.path.startsWith(prefix)))
|
|
68
|
+
.flatMap((file) => {
|
|
69
|
+
const lines = fileLines(file.content);
|
|
70
|
+
const matches = [];
|
|
71
|
+
lines.forEach((line, idx) => {
|
|
72
|
+
if (line.toLowerCase().includes(q)) {
|
|
73
|
+
matches.push({
|
|
74
|
+
filePath: file.path,
|
|
75
|
+
line: idx + 1,
|
|
76
|
+
snippet: line.trim().slice(0, 240),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return matches;
|
|
81
|
+
})
|
|
82
|
+
.slice(0, 50);
|
|
83
|
+
},
|
|
84
|
+
getSymbolContext: (symbol, filePath) => {
|
|
85
|
+
const file = byFilePath.get(filePath);
|
|
86
|
+
if (!file)
|
|
87
|
+
return undefined;
|
|
88
|
+
const lines = fileLines(file.content);
|
|
89
|
+
const idx = lines.findIndex((line) => line.includes(symbol));
|
|
90
|
+
if (idx < 0)
|
|
91
|
+
return undefined;
|
|
92
|
+
const start = Math.max(0, idx - 4);
|
|
93
|
+
const end = Math.min(lines.length, idx + 5);
|
|
94
|
+
return lines.slice(start, end).join("\n");
|
|
95
|
+
},
|
|
96
|
+
validateProposal: (proposal) => {
|
|
97
|
+
if (proposal.evidence.length === 0) {
|
|
98
|
+
return { ok: false, reason: "missing_evidence" };
|
|
99
|
+
}
|
|
100
|
+
if (proposal.confidence.score < 0 || proposal.confidence.score > 1) {
|
|
101
|
+
return { ok: false, reason: "invalid_confidence_range" };
|
|
102
|
+
}
|
|
103
|
+
const files = scanContext.files;
|
|
104
|
+
if (proposal.provider !== "mock" && files.length > 0) {
|
|
105
|
+
for (const ev of proposal.evidence) {
|
|
106
|
+
const fp = ev.filePath.trim().toLowerCase();
|
|
107
|
+
if (!fp || fp === "unknown") {
|
|
108
|
+
return { ok: false, reason: "evidence_path_invalid" };
|
|
109
|
+
}
|
|
110
|
+
if (!(0, scan_paths_1.resolveScannedFileExact)(files, ev.filePath)) {
|
|
111
|
+
return { ok: false, reason: "evidence_path_not_in_scan" };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return { ok: true };
|
|
116
|
+
},
|
|
117
|
+
emitProposal: (proposal) => {
|
|
118
|
+
proposalSink.push(proposal);
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { ServiceSection } from "../core/sectioning/discover-service-sections";
|
|
2
|
+
import type { DetectedComponent } from "../core/types/component";
|
|
3
|
+
import type { RawFinding } from "../core/types/detection";
|
|
4
|
+
import type { DataFlowType, DetectedDataFlow } from "../core/types/data-flow";
|
|
5
|
+
import type { FileInfo } from "../core/types/file";
|
|
6
|
+
export type AiCandidateType = "third_party" | "node_property" | "flow_direction" | "missing_interaction";
|
|
7
|
+
export type AiAgentName = "tpAgent" | "propertyAgent" | "directionAgent" | "interactionAgent";
|
|
8
|
+
/** User-facing inference presets (see `providers/presets.ts`). */
|
|
9
|
+
export declare const AI_PROVIDER_IDS: readonly ["openai", "anthropic", "gemini", "openrouter", "local", "mock"];
|
|
10
|
+
export type AiProviderId = (typeof AI_PROVIDER_IDS)[number];
|
|
11
|
+
/** `third_party_only`: after rules, only run AI enrichment for third-party nodes (every one). */
|
|
12
|
+
export type AiInferenceScope = "default" | "third_party_only";
|
|
13
|
+
export interface AiInferenceCandidate {
|
|
14
|
+
id: string;
|
|
15
|
+
candidateType: AiCandidateType;
|
|
16
|
+
priority: number;
|
|
17
|
+
componentId?: string;
|
|
18
|
+
flowId?: string;
|
|
19
|
+
missingFields: string[];
|
|
20
|
+
rationale: string;
|
|
21
|
+
hints: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface AiConfidence {
|
|
24
|
+
score: number;
|
|
25
|
+
band: "high" | "medium" | "low";
|
|
26
|
+
}
|
|
27
|
+
export interface EvidenceRef {
|
|
28
|
+
filePath: string;
|
|
29
|
+
startLine: number;
|
|
30
|
+
endLine: number;
|
|
31
|
+
reason: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ComponentPatch {
|
|
34
|
+
kind: "component_patch";
|
|
35
|
+
targetComponentId: string;
|
|
36
|
+
candidateType: AiCandidateType;
|
|
37
|
+
setSubType?: string;
|
|
38
|
+
setDescription?: string;
|
|
39
|
+
setProperties: Record<string, unknown>;
|
|
40
|
+
propertyEvidence?: Record<string, EvidenceRef[]>;
|
|
41
|
+
confidence: AiConfidence;
|
|
42
|
+
evidence: EvidenceRef[];
|
|
43
|
+
provider: AiProviderId;
|
|
44
|
+
model: string;
|
|
45
|
+
agent: AiAgentName;
|
|
46
|
+
}
|
|
47
|
+
export interface FlowPatch {
|
|
48
|
+
kind: "flow_patch";
|
|
49
|
+
candidateType: AiCandidateType;
|
|
50
|
+
targetFlowId?: string;
|
|
51
|
+
insertIfMissing?: boolean;
|
|
52
|
+
sourceComponentId?: string;
|
|
53
|
+
targetComponentId?: string;
|
|
54
|
+
setType?: DataFlowType;
|
|
55
|
+
setDirection?: "forward" | "reverse";
|
|
56
|
+
setMethod?: string;
|
|
57
|
+
setEndpoint?: string;
|
|
58
|
+
setDescription?: string;
|
|
59
|
+
setProperties?: Partial<DetectedDataFlow>;
|
|
60
|
+
confidence: AiConfidence;
|
|
61
|
+
evidence: EvidenceRef[];
|
|
62
|
+
provider: AiProviderId;
|
|
63
|
+
model: string;
|
|
64
|
+
agent: AiAgentName;
|
|
65
|
+
}
|
|
66
|
+
export type AiProposal = ComponentPatch | FlowPatch;
|
|
67
|
+
export interface MergeProvenance {
|
|
68
|
+
source: "rule" | "ai_agent";
|
|
69
|
+
provider?: string;
|
|
70
|
+
model?: string;
|
|
71
|
+
agent?: AiAgentName;
|
|
72
|
+
candidateType?: AiCandidateType;
|
|
73
|
+
confidence: number;
|
|
74
|
+
confidenceBand?: "high" | "medium" | "low";
|
|
75
|
+
evidence: EvidenceRef[];
|
|
76
|
+
}
|
|
77
|
+
export interface AiMergeResult {
|
|
78
|
+
components: DetectedComponent[];
|
|
79
|
+
dataFlows: DetectedDataFlow[];
|
|
80
|
+
appliedProposalIds: string[];
|
|
81
|
+
rejectedProposalIds: Array<{
|
|
82
|
+
proposalId: string;
|
|
83
|
+
reason: string;
|
|
84
|
+
}>;
|
|
85
|
+
provenanceByTarget: Record<string, MergeProvenance>;
|
|
86
|
+
}
|
|
87
|
+
export interface AiMergeThresholds {
|
|
88
|
+
minComponentPatchConfidence: number;
|
|
89
|
+
minFlowPatchConfidence: number;
|
|
90
|
+
minInsertFlowConfidence: number;
|
|
91
|
+
}
|
|
92
|
+
export interface InferencePlannerOptions {
|
|
93
|
+
maxCandidatesPerAgent?: number;
|
|
94
|
+
totalBudgetTokens: number;
|
|
95
|
+
maxModelCalls: number;
|
|
96
|
+
}
|
|
97
|
+
export interface AiQueuePlan {
|
|
98
|
+
agent: AiAgentName;
|
|
99
|
+
queue: AiInferenceCandidate[];
|
|
100
|
+
budgetTokens: number;
|
|
101
|
+
maxModelCalls: number;
|
|
102
|
+
}
|
|
103
|
+
export interface InferencePlannerResult {
|
|
104
|
+
queues: AiQueuePlan[];
|
|
105
|
+
droppedCandidates: Array<{
|
|
106
|
+
candidateId: string;
|
|
107
|
+
reason: string;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
export interface RunInferencePipelineInput {
|
|
111
|
+
components: DetectedComponent[];
|
|
112
|
+
dataFlows: DetectedDataFlow[];
|
|
113
|
+
sections?: ServiceSection[];
|
|
114
|
+
/** Structural scan file bodies; used for prompt excerpts and agent tooling. */
|
|
115
|
+
files?: FileInfo[];
|
|
116
|
+
findings?: RawFinding[];
|
|
117
|
+
inferenceScope?: AiInferenceScope;
|
|
118
|
+
plannerOptions?: Partial<InferencePlannerOptions>;
|
|
119
|
+
}
|
|
120
|
+
export interface GenerateProposalsContext {
|
|
121
|
+
candidates: AiInferenceCandidate[];
|
|
122
|
+
plan: InferencePlannerResult;
|
|
123
|
+
components: DetectedComponent[];
|
|
124
|
+
dataFlows: DetectedDataFlow[];
|
|
125
|
+
sections?: ServiceSection[];
|
|
126
|
+
files?: FileInfo[];
|
|
127
|
+
findings?: RawFinding[];
|
|
128
|
+
}
|
|
129
|
+
export interface RunInferencePipelineOptions {
|
|
130
|
+
generateProposals?: (context: GenerateProposalsContext) => Promise<{
|
|
131
|
+
proposals: Array<{
|
|
132
|
+
id: string;
|
|
133
|
+
proposal: AiProposal;
|
|
134
|
+
}>;
|
|
135
|
+
usageSummary?: AiInferenceUsageSummary;
|
|
136
|
+
}>;
|
|
137
|
+
}
|
|
138
|
+
export interface InferencePipelineResult {
|
|
139
|
+
candidates: AiInferenceCandidate[];
|
|
140
|
+
plan: InferencePlannerResult;
|
|
141
|
+
proposals: Array<{
|
|
142
|
+
id: string;
|
|
143
|
+
proposal: AiProposal;
|
|
144
|
+
}>;
|
|
145
|
+
usageSummary?: AiInferenceUsageSummary;
|
|
146
|
+
mergeResult: AiMergeResult;
|
|
147
|
+
}
|
|
148
|
+
export interface AiInferenceUsageSummary {
|
|
149
|
+
providerCalls: number;
|
|
150
|
+
inputTokens: number;
|
|
151
|
+
outputTokens: number;
|
|
152
|
+
totalTokens: number;
|
|
153
|
+
estimatedCostUsd?: number;
|
|
154
|
+
agenticTrace?: AiCandidateAgentTrace[];
|
|
155
|
+
}
|
|
156
|
+
export interface AiToolCallTrace {
|
|
157
|
+
round: number;
|
|
158
|
+
action: "seed_files" | "search_text" | "expand_imports" | "provider_infer" | "finalize";
|
|
159
|
+
detail: string;
|
|
160
|
+
filesTouched?: string[];
|
|
161
|
+
stats?: Record<string, number>;
|
|
162
|
+
}
|
|
163
|
+
export interface AiCandidateAgentTrace {
|
|
164
|
+
candidateId: string;
|
|
165
|
+
componentId?: string;
|
|
166
|
+
filesReviewed: string[];
|
|
167
|
+
rounds: number;
|
|
168
|
+
toolCalls: AiToolCallTrace[];
|
|
169
|
+
finalProposalCount: number;
|
|
170
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AI_PROVIDER_IDS = void 0;
|
|
4
|
+
/** User-facing inference presets (see `providers/presets.ts`). */
|
|
5
|
+
exports.AI_PROVIDER_IDS = [
|
|
6
|
+
"openai",
|
|
7
|
+
"anthropic",
|
|
8
|
+
"gemini",
|
|
9
|
+
"openrouter",
|
|
10
|
+
"local",
|
|
11
|
+
"mock",
|
|
12
|
+
];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RawFinding } from "../../core/types/detection";
|
|
2
|
+
import { type ManifestScanBudgetOptions } from "../shared/manifest-budgets";
|
|
3
|
+
export interface PythonManifestPackages {
|
|
4
|
+
manifestRelativePath: string;
|
|
5
|
+
packages: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function parsePythonDependencyManifests(rootPath: string, opts?: ManifestScanBudgetOptions): Promise<PythonManifestPackages[]>;
|
|
8
|
+
export declare function detectPythonPatternsFromDependencyManifests(rootPath: string, opts?: ManifestScanBudgetOptions): Promise<RawFinding[]>;
|
|
@@ -0,0 +1,131 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.parsePythonDependencyManifests = parsePythonDependencyManifests;
|
|
40
|
+
exports.detectPythonPatternsFromDependencyManifests = detectPythonPatternsFromDependencyManifests;
|
|
41
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const engine_1 = require("../../patterns/engine");
|
|
44
|
+
const manifest_budgets_1 = require("../shared/manifest-budgets");
|
|
45
|
+
const manifest_fs_1 = require("../shared/manifest-fs");
|
|
46
|
+
const manifest_parsers_1 = require("./manifest-parsers");
|
|
47
|
+
function toPosixPath(p) {
|
|
48
|
+
return p.split(path.sep).join("/");
|
|
49
|
+
}
|
|
50
|
+
function createManifestFileInfo(manifestRelativePath) {
|
|
51
|
+
return {
|
|
52
|
+
path: manifestRelativePath,
|
|
53
|
+
name: path.basename(manifestRelativePath),
|
|
54
|
+
content: "",
|
|
55
|
+
language: "python",
|
|
56
|
+
size: 0,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async function parsePythonDependencyManifests(rootPath, opts) {
|
|
60
|
+
const rootDir = path.resolve(rootPath);
|
|
61
|
+
const manifests = [];
|
|
62
|
+
const state = (0, manifest_budgets_1.budgetStateFromOptions)(opts);
|
|
63
|
+
await (0, manifest_fs_1.walkForManifests)(rootDir, manifests, {
|
|
64
|
+
rootDir,
|
|
65
|
+
state,
|
|
66
|
+
excludePaths: opts?.excludePaths,
|
|
67
|
+
isManifestFile: (_entry, entryPath) => {
|
|
68
|
+
const name = path.basename(entryPath);
|
|
69
|
+
const lower = name.toLowerCase();
|
|
70
|
+
const isRequirements = lower.startsWith("requirements") && lower.endsWith(".txt");
|
|
71
|
+
const isPyproject = lower === "pyproject.toml";
|
|
72
|
+
const isPipfile = name === "Pipfile";
|
|
73
|
+
return isRequirements || isPyproject || isPipfile;
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const byManifest = [];
|
|
77
|
+
let bytesRead = 0;
|
|
78
|
+
const maxBytes = state.maxTotalManifestReadBytes;
|
|
79
|
+
for (const manifestAbsPath of manifests) {
|
|
80
|
+
if (bytesRead >= maxBytes)
|
|
81
|
+
break;
|
|
82
|
+
const lower = path.basename(manifestAbsPath).toLowerCase();
|
|
83
|
+
const manifestRelativePath = toPosixPath(path.relative(rootDir, manifestAbsPath));
|
|
84
|
+
let raw;
|
|
85
|
+
try {
|
|
86
|
+
raw = await promises_1.default.readFile(manifestAbsPath, "utf8");
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
bytesRead += raw.length;
|
|
92
|
+
let packages = [];
|
|
93
|
+
if (lower.startsWith("requirements") && lower.endsWith(".txt")) {
|
|
94
|
+
packages = (0, manifest_parsers_1.extractPackagesFromRequirementsTxt)(raw);
|
|
95
|
+
}
|
|
96
|
+
else if (lower === "pyproject.toml") {
|
|
97
|
+
packages = (0, manifest_parsers_1.extractPackagesFromPyprojectToml)(raw);
|
|
98
|
+
}
|
|
99
|
+
else if (path.basename(manifestAbsPath).toLowerCase() === "pipfile") {
|
|
100
|
+
packages = (0, manifest_parsers_1.extractPackagesFromPipfile)(raw);
|
|
101
|
+
}
|
|
102
|
+
// Skip empty manifests to avoid generating empty matchPatterns runs.
|
|
103
|
+
if (packages.length === 0)
|
|
104
|
+
continue;
|
|
105
|
+
byManifest.push({
|
|
106
|
+
manifestRelativePath,
|
|
107
|
+
packages: Array.from(new Set(packages)),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return byManifest;
|
|
111
|
+
}
|
|
112
|
+
async function detectPythonPatternsFromDependencyManifests(rootPath, opts) {
|
|
113
|
+
const manifestPackages = await parsePythonDependencyManifests(rootPath, opts);
|
|
114
|
+
if (manifestPackages.length === 0)
|
|
115
|
+
return [];
|
|
116
|
+
const findings = [];
|
|
117
|
+
for (const manifest of manifestPackages) {
|
|
118
|
+
const manifestFile = createManifestFileInfo(manifest.manifestRelativePath);
|
|
119
|
+
const imports = manifest.packages.map((p) => ({
|
|
120
|
+
module: p,
|
|
121
|
+
names: [p],
|
|
122
|
+
}));
|
|
123
|
+
findings.push(...(0, engine_1.matchPatterns)({
|
|
124
|
+
language: "python",
|
|
125
|
+
file: manifestFile,
|
|
126
|
+
normalizedPath: manifestFile.path,
|
|
127
|
+
imports,
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
return findings;
|
|
131
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectPythonPatterns = detectPythonPatterns;
|
|
4
|
+
const parser_1 = require("./parser");
|
|
5
|
+
const property_inference_1 = require("../shared/property-inference");
|
|
6
|
+
const patterns_1 = require("./patterns");
|
|
7
|
+
function detectPythonPatterns(file) {
|
|
8
|
+
const moduleModel = (0, parser_1.parsePythonModule)(file);
|
|
9
|
+
if (moduleModel.file.language !== "python") {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const findings = [];
|
|
13
|
+
findings.push(...(0, patterns_1.detectPythonRoutePatterns)(moduleModel), ...(0, patterns_1.detectPythonDatabaseConnections)(moduleModel), ...(0, patterns_1.detectPythonExternalApiCalls)(moduleModel), ...(0, patterns_1.detectPythonAuthPatterns)(moduleModel), ...(0, patterns_1.detectPythonConfigAndEnvUsage)(moduleModel));
|
|
14
|
+
// Merge pattern-matched component properties (from YAML) into each finding.
|
|
15
|
+
for (const finding of findings) {
|
|
16
|
+
const detected = (0, property_inference_1.getPropertiesFromFinding)(finding, file.content);
|
|
17
|
+
if (Object.keys(detected).length > 0) {
|
|
18
|
+
finding.properties = { ...(finding.properties ?? {}), ...detected };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return findings;
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPythonAnalyzer = createPythonAnalyzer;
|
|
4
|
+
const detector_1 = require("./detector");
|
|
5
|
+
function createPythonAnalyzer() {
|
|
6
|
+
return {
|
|
7
|
+
detect(file) {
|
|
8
|
+
return (0, detector_1.detectPythonPatterns)(file);
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPackagesFromRequirementsTxt = extractPackagesFromRequirementsTxt;
|
|
4
|
+
exports.extractPackagesFromPyprojectToml = extractPackagesFromPyprojectToml;
|
|
5
|
+
exports.extractPackagesFromPipfile = extractPackagesFromPipfile;
|
|
6
|
+
function normalizePackageNameToken(raw) {
|
|
7
|
+
const s = raw.trim();
|
|
8
|
+
if (!s)
|
|
9
|
+
return null;
|
|
10
|
+
const beforeMarker = s.split(";")[0].trim();
|
|
11
|
+
const beforeAt = beforeMarker.includes(" @ ")
|
|
12
|
+
? beforeMarker.split(" @ ")[0].trim()
|
|
13
|
+
: beforeMarker;
|
|
14
|
+
const beforeExtras = beforeAt.split("[")[0].trim();
|
|
15
|
+
const nameMatch = beforeExtras.match(/^([A-Za-z0-9][A-Za-z0-9_.-]*)\b/);
|
|
16
|
+
if (!nameMatch)
|
|
17
|
+
return null;
|
|
18
|
+
const token = nameMatch[1].toLowerCase();
|
|
19
|
+
if (!token || token === "python")
|
|
20
|
+
return null;
|
|
21
|
+
return token;
|
|
22
|
+
}
|
|
23
|
+
function stripInlineComment(line) {
|
|
24
|
+
const idx = line.indexOf("#");
|
|
25
|
+
if (idx === -1)
|
|
26
|
+
return line;
|
|
27
|
+
return line.slice(0, idx).trim();
|
|
28
|
+
}
|
|
29
|
+
function parseRequirementLineToPackageToken(line) {
|
|
30
|
+
const trimmed = stripInlineComment(line).trim();
|
|
31
|
+
if (!trimmed)
|
|
32
|
+
return null;
|
|
33
|
+
if (trimmed.startsWith("-") || trimmed.startsWith("--")) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return normalizePackageNameToken(trimmed);
|
|
37
|
+
}
|
|
38
|
+
function extractPackagesFromRequirementsTxt(content) {
|
|
39
|
+
const pkgs = new Set();
|
|
40
|
+
const lines = content.split(/\r?\n/);
|
|
41
|
+
for (const rawLine of lines) {
|
|
42
|
+
const token = parseRequirementLineToPackageToken(rawLine);
|
|
43
|
+
if (token)
|
|
44
|
+
pkgs.add(token);
|
|
45
|
+
}
|
|
46
|
+
return Array.from(pkgs.values());
|
|
47
|
+
}
|
|
48
|
+
function parseTomlArrayOfStrings(raw) {
|
|
49
|
+
const matches = raw.match(/["']([^"']+)["']/g);
|
|
50
|
+
if (!matches)
|
|
51
|
+
return [];
|
|
52
|
+
return matches
|
|
53
|
+
.map((m) => m.trim())
|
|
54
|
+
.map((m) => m.replace(/^["']/, "").replace(/["']$/, ""));
|
|
55
|
+
}
|
|
56
|
+
function extractPackagesFromPyprojectToml(content) {
|
|
57
|
+
const pkgs = new Set();
|
|
58
|
+
const lines = content.split(/\r?\n/);
|
|
59
|
+
let currentSection = "";
|
|
60
|
+
const pushTokenFromSpec = (spec) => {
|
|
61
|
+
const token = normalizePackageNameToken(spec);
|
|
62
|
+
if (token)
|
|
63
|
+
pkgs.add(token);
|
|
64
|
+
};
|
|
65
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
66
|
+
const line = lines[i].trim();
|
|
67
|
+
if (!line || line.startsWith("#"))
|
|
68
|
+
continue;
|
|
69
|
+
const sectionMatch = line.match(/^\[([^\]]+)\]$/);
|
|
70
|
+
if (sectionMatch) {
|
|
71
|
+
currentSection = sectionMatch[1].trim();
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (currentSection === "project" && line.startsWith("dependencies")) {
|
|
75
|
+
const arrayMatch = line.match(/^dependencies\s*=\s*\[(.*)$/);
|
|
76
|
+
if (!arrayMatch)
|
|
77
|
+
continue;
|
|
78
|
+
const firstPart = arrayMatch[1] ?? "";
|
|
79
|
+
let arrayBody = firstPart;
|
|
80
|
+
while (!arrayBody.includes("]") && i + 1 < lines.length) {
|
|
81
|
+
i += 1;
|
|
82
|
+
arrayBody += `\n${lines[i]}`;
|
|
83
|
+
}
|
|
84
|
+
const strings = parseTomlArrayOfStrings(arrayBody);
|
|
85
|
+
for (const spec of strings)
|
|
86
|
+
pushTokenFromSpec(spec);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const poetryDepsSections = [
|
|
90
|
+
"tool.poetry.dependencies",
|
|
91
|
+
"tool.poetry.dev-dependencies",
|
|
92
|
+
];
|
|
93
|
+
const isGroupDeps = currentSection.startsWith("tool.poetry.group.") &&
|
|
94
|
+
currentSection.endsWith(".dependencies");
|
|
95
|
+
if (poetryDepsSections.includes(currentSection) || isGroupDeps) {
|
|
96
|
+
const kv = line.match(/^([A-Za-z0-9][A-Za-z0-9_.-]*)\s*=\s*(.+)$/);
|
|
97
|
+
if (!kv)
|
|
98
|
+
continue;
|
|
99
|
+
const key = kv[1].trim();
|
|
100
|
+
pushTokenFromSpec(key);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return Array.from(pkgs.values());
|
|
104
|
+
}
|
|
105
|
+
function extractPackagesFromPipfile(content) {
|
|
106
|
+
const pkgs = new Set();
|
|
107
|
+
const lines = content.split(/\r?\n/);
|
|
108
|
+
let currentSection = null;
|
|
109
|
+
const pushKey = (key) => {
|
|
110
|
+
const token = normalizePackageNameToken(key);
|
|
111
|
+
if (token)
|
|
112
|
+
pkgs.add(token);
|
|
113
|
+
};
|
|
114
|
+
for (const rawLine of lines) {
|
|
115
|
+
const line = rawLine.trim();
|
|
116
|
+
if (!line || line.startsWith("#"))
|
|
117
|
+
continue;
|
|
118
|
+
const sectionMatch = line.match(/^\[([^\]]+)\]$/);
|
|
119
|
+
if (sectionMatch) {
|
|
120
|
+
currentSection = sectionMatch[1] ?? null;
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (!currentSection)
|
|
124
|
+
continue;
|
|
125
|
+
const isPkgSection = currentSection === "packages" || currentSection === "dev-packages";
|
|
126
|
+
if (!isPkgSection)
|
|
127
|
+
continue;
|
|
128
|
+
const kv = line.match(/^([A-Za-z0-9][A-Za-z0-9_.-]*)\s*=/);
|
|
129
|
+
if (!kv)
|
|
130
|
+
continue;
|
|
131
|
+
pushKey(kv[1].trim());
|
|
132
|
+
}
|
|
133
|
+
return Array.from(pkgs.values());
|
|
134
|
+
}
|