@intentius/chant 0.124.45 → 0.124.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__golden__/wave-loop/op-by-apply-after-fails.json +10 -0
- package/dist/__golden__/wave-loop/op-by-apply-hold.json +10 -0
- package/dist/__golden__/wave-loop/op-by-apply-ignored.json +10 -0
- package/dist/__golden__/wave-loop/op-by-apply-pass.json +10 -0
- package/dist/__golden__/wave-loop/op-by-apply-skip.json +10 -0
- package/dist/__golden__/wave-loop/op-cost-member-clash.json +6 -0
- package/dist/__golden__/wave-loop/op-cost-member.json +13 -0
- package/dist/__golden__/wave-loop/op-denied-source.json +16 -0
- package/dist/__golden__/wave-loop/op-denied.json +16 -0
- package/dist/__golden__/wave-loop/op-discover-rest-short.json +6 -0
- package/dist/__golden__/wave-loop/op-discover-rest-stops.json +13 -0
- package/dist/__golden__/wave-loop/op-discover-rest.json +26 -0
- package/dist/__golden__/wave-loop/op-discover-wide.json +26 -0
- package/dist/__golden__/wave-loop/op-held-on-again.json +16 -0
- package/dist/__golden__/wave-loop/op-held-on-before-apply.json +16 -0
- package/dist/__golden__/wave-loop/op-held-on.json +16 -0
- package/dist/__golden__/wave-loop/op-hooks-apply-fails.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-fail-after-apply.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-fail-before-apply.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-fail-before-plan.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-held.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-hold-before-apply.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-pass.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-refused-at-base.json +13 -0
- package/dist/__golden__/wave-loop/op-hooks-share.json +33 -0
- package/dist/__golden__/wave-loop/op-outcome-held.json +10 -0
- package/dist/__golden__/wave-loop/op-outcome-replan-approved.json +10 -0
- package/dist/__golden__/wave-loop/op-outcome-replan-forever.json +10 -0
- package/dist/__golden__/wave-loop/op-outcome-replan.json +10 -0
- package/dist/__golden__/wave-loop/op-outcome-stood-down.json +10 -0
- package/dist/__golden__/wave-loop/op-outcome-unreadable.json +10 -0
- package/dist/__golden__/wave-loop/op-overridden.json +16 -0
- package/dist/__golden__/wave-loop/op-per-run.json +20 -0
- package/dist/__golden__/wave-loop/op-point.json +13 -0
- package/dist/__golden__/wave-loop/op-pr-review.json +10 -0
- package/dist/__golden__/wave-loop/op-sealed.json +10 -0
- package/dist/__golden__/wave-loop/op-spend-change-only.json +10 -0
- package/dist/__golden__/wave-loop/op-spend.json +10 -0
- package/dist/__golden__/wave-loop/op-wave-commands.json +55 -0
- package/dist/__golden__/wave-loop/op-wide-refused.json +26 -0
- package/dist/__golden__/wave-loop/op-wide-waiting.json +29 -0
- package/dist/__golden__/wave-loop/op-wide.json +39 -0
- package/dist/action-pins.d.ts +61 -0
- package/dist/action-pins.d.ts.map +1 -0
- package/dist/action-pins.js +77 -0
- package/dist/capabilities/aws.paths +148 -0
- package/dist/capabilities/base-mappings.json +122 -0
- package/dist/capabilities/catalog.d.ts +89 -0
- package/dist/capabilities/catalog.d.ts.map +1 -0
- package/dist/capabilities/catalog.js +204 -0
- package/dist/capabilities/language.d.ts +103 -0
- package/dist/capabilities/language.d.ts.map +1 -0
- package/dist/capabilities/language.js +335 -0
- package/dist/capabilities/matcher.d.ts +65 -0
- package/dist/capabilities/matcher.d.ts.map +1 -0
- package/dist/capabilities/matcher.js +299 -0
- package/dist/capabilities/view.d.ts +207 -0
- package/dist/capabilities/view.d.ts.map +1 -0
- package/dist/capabilities/view.js +484 -0
- package/dist/cli/commands/carve.d.ts +3 -0
- package/dist/cli/commands/carve.d.ts.map +1 -1
- package/dist/cli/commands/carve.js +36 -7
- package/dist/cli/commands/import-report.d.ts +26 -0
- package/dist/cli/commands/import-report.d.ts.map +1 -0
- package/dist/cli/commands/import-report.js +65 -0
- package/dist/cli/commands/import.d.ts +11 -1
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +22 -3
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +1 -0
- package/dist/cli/commands/migrate.d.ts +13 -1
- package/dist/cli/commands/migrate.d.ts.map +1 -1
- package/dist/cli/commands/migrate.js +134 -10
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +21 -2
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +6 -1
- package/dist/cli/handlers/declared-graph.d.ts +44 -0
- package/dist/cli/handlers/declared-graph.d.ts.map +1 -0
- package/dist/cli/handlers/declared-graph.js +87 -0
- package/dist/cli/handlers/graph.d.ts +25 -0
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +93 -87
- package/dist/cli/handlers/ledger.d.ts +3 -0
- package/dist/cli/handlers/ledger.d.ts.map +1 -0
- package/dist/cli/handlers/ledger.js +55 -0
- package/dist/cli/handlers/migrate.d.ts.map +1 -1
- package/dist/cli/handlers/migrate.js +18 -11
- package/dist/cli/handlers/misc.d.ts.map +1 -1
- package/dist/cli/handlers/misc.js +12 -1
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +4 -3
- package/dist/cli/handlers/pr.d.ts +15 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +143 -39
- package/dist/cli/handlers/query.d.ts +7 -2
- package/dist/cli/handlers/query.d.ts.map +1 -1
- package/dist/cli/handlers/query.js +16 -4
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +6 -3
- package/dist/cli/handlers/search-count.d.ts +89 -0
- package/dist/cli/handlers/search-count.d.ts.map +1 -0
- package/dist/cli/handlers/search-count.js +132 -0
- package/dist/cli/handlers/search.d.ts +356 -6
- package/dist/cli/handlers/search.d.ts.map +1 -1
- package/dist/cli/handlers/search.js +1039 -155
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +88 -17
- package/dist/cli/mcp/server.d.ts.map +1 -1
- package/dist/cli/mcp/server.js +3 -0
- package/dist/cli/mcp/tools/capabilities.d.ts +7 -0
- package/dist/cli/mcp/tools/capabilities.d.ts.map +1 -0
- package/dist/cli/mcp/tools/capabilities.js +27 -0
- package/dist/cli/mcp/workspace-tools.d.ts +3 -1
- package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
- package/dist/cli/mcp/workspace-tools.js +47 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +100 -19
- package/dist/cli/registry.d.ts +36 -4
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/builders.d.ts +5 -1
- package/dist/components/builders.d.ts.map +1 -1
- package/dist/components/builders.js +5 -0
- package/dist/components/capability-plugin-loader.d.ts.map +1 -1
- package/dist/components/capability-plugin-loader.js +16 -1
- package/dist/components/capability-plugin.d.ts +14 -0
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/pr-env-ports.d.ts +29 -0
- package/dist/components/pr-env-ports.d.ts.map +1 -0
- package/dist/components/pr-env-ports.js +77 -0
- package/dist/components/pr-env-run.d.ts +5 -21
- package/dist/components/pr-env-run.d.ts.map +1 -1
- package/dist/components/pr-env-run.js +6 -70
- package/dist/components/pr-environment.d.ts +2 -1
- package/dist/components/pr-environment.d.ts.map +1 -1
- package/dist/components/pr-environment.js +1 -1
- package/dist/components/pr-hooks.d.ts +21 -1
- package/dist/components/pr-hooks.d.ts.map +1 -1
- package/dist/components/pr-hooks.js +72 -4
- package/dist/components/pr-pipeline.d.ts +45 -10
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +47 -14
- package/dist/components/pr-policy.d.ts +36 -0
- package/dist/components/pr-policy.d.ts.map +1 -1
- package/dist/components/pr-policy.js +36 -0
- package/dist/components/starter-plugin.d.ts +1 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/starter-plugin.js +5 -1
- package/dist/components/verbs/index.d.ts +2 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +2 -0
- package/dist/components/verbs/publish-artifact.d.ts +65 -0
- package/dist/components/verbs/publish-artifact.d.ts.map +1 -0
- package/dist/components/verbs/publish-artifact.js +74 -0
- package/dist/components/verbs/publish-image.d.ts +129 -0
- package/dist/components/verbs/publish-image.d.ts.map +1 -0
- package/dist/components/verbs/publish-image.js +145 -0
- package/dist/config-environments.d.ts +112 -0
- package/dist/config-environments.d.ts.map +1 -0
- package/dist/config-environments.js +114 -0
- package/dist/config.d.ts +32 -84
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +13 -96
- package/dist/gate-decision.d.ts +11 -2
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +15 -3
- package/dist/graph-detail.d.ts.map +1 -1
- package/dist/graph-detail.js +15 -3
- package/dist/graph-effective.d.ts +33 -2
- package/dist/graph-effective.d.ts.map +1 -1
- package/dist/graph-effective.js +215 -68
- package/dist/graph-ir.d.ts +48 -0
- package/dist/graph-ir.d.ts.map +1 -1
- package/dist/graph-ir.js +130 -0
- package/dist/graph-sub-template.d.ts +11 -0
- package/dist/graph-sub-template.d.ts.map +1 -0
- package/dist/graph-sub-template.js +19 -0
- package/dist/graph-walk.d.ts +66 -0
- package/dist/graph-walk.d.ts.map +1 -0
- package/dist/graph-walk.js +70 -0
- package/dist/import/parser.d.ts +19 -0
- package/dist/import/parser.d.ts.map +1 -1
- package/dist/lexicon.d.ts +80 -6
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +11 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +2 -5
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/ledger-read.d.ts +65 -0
- package/dist/lifecycle/ledger-read.d.ts.map +1 -0
- package/dist/lifecycle/ledger-read.js +160 -0
- package/dist/lifecycle/observe.d.ts +28 -0
- package/dist/lifecycle/observe.d.ts.map +1 -1
- package/dist/lifecycle/observe.js +23 -1
- package/dist/lifecycle/release-workstation.d.ts +7 -0
- package/dist/lifecycle/release-workstation.d.ts.map +1 -1
- package/dist/lifecycle/release-workstation.js +25 -0
- package/dist/lifecycle/run-ledger.d.ts +4 -3
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +1 -0
- package/dist/lint/discover.js +3 -1
- package/dist/lint/post-synth.d.ts +127 -1
- package/dist/lint/post-synth.d.ts.map +1 -1
- package/dist/lint/post-synth.js +84 -2
- package/dist/lint/rule.d.ts +6 -0
- package/dist/lint/rule.d.ts.map +1 -1
- package/dist/lint/rules/op/index.d.ts +1 -0
- package/dist/lint/rules/op/index.d.ts.map +1 -1
- package/dist/lint/rules/op/index.js +2 -0
- package/dist/lint/rules/op/ops019-workspace-op-target.d.ts +32 -0
- package/dist/lint/rules/op/ops019-workspace-op-target.d.ts.map +1 -0
- package/dist/lint/rules/op/ops019-workspace-op-target.js +63 -0
- package/dist/live-endpoint.d.ts +1 -1
- package/dist/live-endpoint.d.ts.map +1 -1
- package/dist/live-endpoint.js +1 -1
- package/dist/observation.d.ts +48 -1
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +21 -5
- package/dist/op/activities/activity-contracts.d.ts +9 -6
- package/dist/op/activities/activity-contracts.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.js +5 -2
- package/dist/op/activities/index.d.ts +2 -2
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +1 -1
- package/dist/op/activities/review-agent.d.ts +90 -4
- package/dist/op/activities/review-agent.d.ts.map +1 -1
- package/dist/op/activities/review-agent.js +217 -19
- package/dist/op/activities/work-evidence.d.ts +8 -1
- package/dist/op/activities/work-evidence.d.ts.map +1 -1
- package/dist/op/activities/work-evidence.js +1 -0
- package/dist/op/builders.d.ts +9 -5
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/builders.js +9 -5
- package/dist/op/composites/apply-op.d.ts +29 -2
- package/dist/op/composites/apply-op.d.ts.map +1 -1
- package/dist/op/composites/apply-op.js +20 -1
- package/dist/op/gate-approval.d.ts +11 -5
- package/dist/op/gate-approval.d.ts.map +1 -1
- package/dist/op/gate-approval.js +11 -6
- package/dist/op/gate-quorum.d.ts +100 -3
- package/dist/op/gate-quorum.d.ts.map +1 -1
- package/dist/op/gate-quorum.js +108 -6
- package/dist/op/gate-review.d.ts +9 -0
- package/dist/op/gate-review.d.ts.map +1 -1
- package/dist/op/gate-review.js +13 -0
- package/dist/op/gate.d.ts +44 -3
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +25 -4
- package/dist/op/index.d.ts +3 -3
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/local-executor.d.ts +38 -3
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +48 -6
- package/dist/op/op-waves-run.d.ts +26 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +259 -13
- package/dist/op/op-waves.d.ts +72 -5
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +110 -15
- package/dist/op/runtime.d.ts +11 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/schedule-overdue.d.ts +16 -0
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +36 -0
- package/dist/op/stage-hooks.d.ts +9 -2
- package/dist/op/stage-hooks.d.ts.map +1 -1
- package/dist/op/stage-hooks.js +7 -5
- package/dist/op/workspace-run-env.d.ts +22 -0
- package/dist/op/workspace-run-env.d.ts.map +1 -0
- package/dist/op/workspace-run-env.js +21 -0
- package/dist/pr-forge.d.ts +24 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +47 -0
- package/dist/pr-post.d.ts +42 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +67 -1
- package/dist/read-filter.d.ts +65 -0
- package/dist/read-filter.d.ts.map +1 -0
- package/dist/read-filter.js +179 -0
- package/dist/run-event.d.ts +1 -1
- package/dist/run-event.d.ts.map +1 -1
- package/dist/terraform/carve.d.ts +24 -3
- package/dist/terraform/carve.d.ts.map +1 -1
- package/dist/terraform/carve.js +32 -14
- package/dist/terraform/cuts.d.ts +97 -0
- package/dist/terraform/cuts.d.ts.map +1 -0
- package/dist/terraform/cuts.js +138 -0
- package/dist/terraform/folds.d.ts +26 -0
- package/dist/terraform/folds.d.ts.map +1 -0
- package/dist/terraform/folds.js +38 -0
- package/dist/terraform/graph.d.ts.map +1 -1
- package/dist/terraform/graph.js +10 -0
- package/dist/terraform/reach.d.ts +140 -0
- package/dist/terraform/reach.d.ts.map +1 -0
- package/dist/terraform/reach.js +170 -0
- package/dist/terraform/score.d.ts +14 -0
- package/dist/terraform/score.d.ts.map +1 -1
- package/dist/terraform/score.js +14 -31
- package/dist/terraform/state.d.ts.map +1 -1
- package/dist/terraform/state.js +4 -2
- package/dist/terraform/types.d.ts +8 -0
- package/dist/terraform/types.d.ts.map +1 -1
- package/dist/wave-blocked.d.ts +10 -1
- package/dist/wave-blocked.d.ts.map +1 -1
- package/dist/wave-blocked.js +31 -3
- package/dist/wave-runtime.mjs +266 -256
- package/dist/workspace/capabilities-contract.d.ts +66 -0
- package/dist/workspace/capabilities-contract.d.ts.map +1 -0
- package/dist/workspace/capabilities-contract.js +107 -0
- package/dist/workspace/capabilities.schema.json +229 -0
- package/dist/workspace/check.schema.json +11 -2
- package/dist/workspace/checks/ci-branch.d.ts +44 -0
- package/dist/workspace/checks/ci-branch.d.ts.map +1 -0
- package/dist/workspace/checks/ci-branch.js +133 -0
- package/dist/workspace/checks/links.d.ts +3 -0
- package/dist/workspace/checks/links.d.ts.map +1 -1
- package/dist/workspace/checks/links.js +12 -1
- package/dist/workspace/checks/org.d.ts +48 -0
- package/dist/workspace/checks/org.d.ts.map +1 -0
- package/dist/workspace/checks/org.js +156 -0
- package/dist/workspace/checks.d.ts +11 -1
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/checks.js +59 -7
- package/dist/workspace/ci-branches.d.ts +16 -0
- package/dist/workspace/ci-branches.d.ts.map +1 -1
- package/dist/workspace/ci-branches.js +27 -0
- package/dist/workspace/ci-green-cli.js +7 -7
- package/dist/workspace/ci-green-workflow.d.ts +1 -1
- package/dist/workspace/ci-green-workflow.d.ts.map +1 -1
- package/dist/workspace/ci-green-workflow.js +13 -8
- package/dist/workspace/ci-green.d.ts +14 -0
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +44 -11
- package/dist/workspace/ci-run.d.ts +9 -1
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +67 -6
- package/dist/workspace/ci-serve.d.ts +9 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -1
- package/dist/workspace/ci-serve.js +114 -76
- package/dist/workspace/compose-graph.d.ts +23 -0
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/compose-graph.js +3 -1
- package/dist/workspace/composites.d.ts +4 -1
- package/dist/workspace/composites.d.ts.map +1 -1
- package/dist/workspace/composites.js +5 -2
- package/dist/workspace/composites.schema.json +22 -0
- package/dist/workspace/conformance/__writer_fixture__/work/work.schema.json +105 -1
- package/dist/workspace/conformance/index.d.ts +1 -1
- package/dist/workspace/conformance/index.d.ts.map +1 -1
- package/dist/workspace/conformance/index.js +39 -2
- package/dist/workspace/cross-root-lint.d.ts +56 -0
- package/dist/workspace/cross-root-lint.d.ts.map +1 -0
- package/dist/workspace/cross-root-lint.js +111 -0
- package/dist/workspace/dbt-models-reader.d.ts +44 -0
- package/dist/workspace/dbt-models-reader.d.ts.map +1 -0
- package/dist/workspace/dbt-models-reader.js +356 -0
- package/dist/workspace/dbt-project-common.d.ts +40 -0
- package/dist/workspace/dbt-project-common.d.ts.map +1 -0
- package/dist/workspace/dbt-project-common.js +106 -0
- package/dist/workspace/dbt-project-reader.d.ts +4 -3
- package/dist/workspace/dbt-project-reader.d.ts.map +1 -1
- package/dist/workspace/dbt-project-reader.js +14 -108
- package/dist/workspace/decision-rank.d.ts +26 -0
- package/dist/workspace/decision-rank.d.ts.map +1 -0
- package/dist/workspace/decision-rank.js +16 -0
- package/dist/workspace/declaration.d.ts +43 -2
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +45 -11
- package/dist/workspace/declaration.schema.json +133 -24
- package/dist/workspace/environments.d.ts +26 -2
- package/dist/workspace/environments.d.ts.map +1 -1
- package/dist/workspace/environments.js +26 -2
- package/dist/workspace/flyway-dir.d.ts +39 -0
- package/dist/workspace/flyway-dir.d.ts.map +1 -0
- package/dist/workspace/flyway-dir.js +104 -0
- package/dist/workspace/flyway-layout.d.ts +96 -0
- package/dist/workspace/flyway-layout.d.ts.map +1 -0
- package/dist/workspace/flyway-layout.js +308 -0
- package/dist/workspace/graph-cache.d.ts +8 -0
- package/dist/workspace/graph-cache.d.ts.map +1 -1
- package/dist/workspace/graph-cache.js +27 -3
- package/dist/workspace/graph-cli.d.ts +39 -2
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/graph-cli.js +92 -32
- package/dist/workspace/graph.schema.json +182 -0
- package/dist/workspace/intent.d.ts +2 -3
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +5 -9
- package/dist/workspace/kind-link-readers.d.ts +59 -2
- package/dist/workspace/kind-link-readers.d.ts.map +1 -1
- package/dist/workspace/kind-link-readers.js +17 -1
- package/dist/workspace/kind-readers.d.ts +3 -0
- package/dist/workspace/kind-readers.d.ts.map +1 -1
- package/dist/workspace/kind-readers.js +7 -1
- package/dist/workspace/kinds.d.ts +66 -2
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +98 -4
- package/dist/workspace/ledger.schema.json +158 -0
- package/dist/workspace/lexicon-outputs.d.ts +20 -1
- package/dist/workspace/lexicon-outputs.d.ts.map +1 -1
- package/dist/workspace/lexicon-outputs.js +102 -10
- package/dist/workspace/lineage-check.d.ts +3 -0
- package/dist/workspace/lineage-check.d.ts.map +1 -1
- package/dist/workspace/lineage-check.js +23 -4
- package/dist/workspace/links.d.ts +8 -1
- package/dist/workspace/links.d.ts.map +1 -1
- package/dist/workspace/links.js +25 -1
- package/dist/workspace/ls.d.ts +8 -0
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/ls.js +7 -1
- package/dist/workspace/ls.schema.json +7 -0
- package/dist/workspace/member-commands.d.ts +10 -1
- package/dist/workspace/member-commands.d.ts.map +1 -1
- package/dist/workspace/member-commands.js +71 -6
- package/dist/workspace/migrate-links.d.ts +45 -0
- package/dist/workspace/migrate-links.d.ts.map +1 -0
- package/dist/workspace/migrate-links.js +100 -0
- package/dist/workspace/migration-dirs.d.ts +74 -0
- package/dist/workspace/migration-dirs.d.ts.map +1 -0
- package/dist/workspace/migration-dirs.js +254 -0
- package/dist/workspace/nested-graph.d.ts +2 -0
- package/dist/workspace/nested-graph.d.ts.map +1 -1
- package/dist/workspace/nested-graph.js +32 -1
- package/dist/workspace/reason-codes.d.ts +18 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +23 -0
- package/dist/workspace/records-cli.d.ts +11 -0
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.js +57 -5
- package/dist/workspace/records.schema.json +5 -0
- package/dist/workspace/release-candidates.d.ts +2 -0
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +5 -2
- package/dist/workspace/release-train.d.ts +53 -0
- package/dist/workspace/release-train.d.ts.map +1 -0
- package/dist/workspace/release-train.js +134 -0
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +4 -3
- package/dist/workspace/repo-ref.d.ts +45 -0
- package/dist/workspace/repo-ref.d.ts.map +1 -0
- package/dist/workspace/repo-ref.js +114 -0
- package/dist/workspace/run-event.schema.json +2 -2
- package/dist/workspace/runs-cli.d.ts +9 -0
- package/dist/workspace/runs-cli.d.ts.map +1 -1
- package/dist/workspace/runs-cli.js +48 -3
- package/dist/workspace/runs.schema.json +7 -0
- package/dist/workspace/search-cli.d.ts +204 -0
- package/dist/workspace/search-cli.d.ts.map +1 -0
- package/dist/workspace/search-cli.js +466 -0
- package/dist/workspace/search-contract.d.ts +56 -0
- package/dist/workspace/search-contract.d.ts.map +1 -0
- package/dist/workspace/search-contract.js +70 -0
- package/dist/workspace/search.schema.json +822 -0
- package/dist/workspace/status-decisions.d.ts +37 -0
- package/dist/workspace/status-decisions.d.ts.map +1 -0
- package/dist/workspace/status-decisions.js +147 -0
- package/dist/workspace/status-gates.d.ts +9 -0
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/dist/workspace/status.d.ts +4 -0
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/status.js +14 -2
- package/dist/workspace/status.schema.json +6 -0
- package/dist/workspace/work-cli.d.ts.map +1 -1
- package/dist/workspace/work-cli.js +5 -3
- package/dist/workspace/work-evidence-ops.d.ts +83 -0
- package/dist/workspace/work-evidence-ops.d.ts.map +1 -0
- package/dist/workspace/work-evidence-ops.js +169 -0
- package/dist/workspace/work-evidence.d.ts +12 -2
- package/dist/workspace/work-evidence.d.ts.map +1 -1
- package/dist/workspace/work-evidence.js +21 -3
- package/dist/workspace/work-evidence.schema.json +49 -2
- package/dist/workspace/workspace-gates.d.ts +110 -0
- package/dist/workspace/workspace-gates.d.ts.map +1 -0
- package/dist/workspace/workspace-gates.js +140 -0
- package/dist/workspace/workspace-kinds.schema.json +58 -3
- package/dist/workspace/workspace-ledger.d.ts +76 -0
- package/dist/workspace/workspace-ledger.d.ts.map +1 -0
- package/dist/workspace/workspace-ledger.js +91 -0
- package/dist/workspace/workspace-run.d.ts +112 -0
- package/dist/workspace/workspace-run.d.ts.map +1 -0
- package/dist/workspace/workspace-run.js +432 -0
- package/package.json +1 -1
- package/src/__golden__/wave-loop/op-by-apply-after-fails.json +10 -0
- package/src/__golden__/wave-loop/op-by-apply-hold.json +10 -0
- package/src/__golden__/wave-loop/op-by-apply-ignored.json +10 -0
- package/src/__golden__/wave-loop/op-by-apply-pass.json +10 -0
- package/src/__golden__/wave-loop/op-by-apply-skip.json +10 -0
- package/src/__golden__/wave-loop/op-cost-member-clash.json +6 -0
- package/src/__golden__/wave-loop/op-cost-member.json +13 -0
- package/src/__golden__/wave-loop/op-denied-source.json +16 -0
- package/src/__golden__/wave-loop/op-denied.json +16 -0
- package/src/__golden__/wave-loop/op-discover-rest-short.json +6 -0
- package/src/__golden__/wave-loop/op-discover-rest-stops.json +13 -0
- package/src/__golden__/wave-loop/op-discover-rest.json +26 -0
- package/src/__golden__/wave-loop/op-discover-wide.json +26 -0
- package/src/__golden__/wave-loop/op-held-on-again.json +16 -0
- package/src/__golden__/wave-loop/op-held-on-before-apply.json +16 -0
- package/src/__golden__/wave-loop/op-held-on.json +16 -0
- package/src/__golden__/wave-loop/op-hooks-apply-fails.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-fail-after-apply.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-fail-before-apply.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-fail-before-plan.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-held.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-hold-before-apply.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-pass.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-refused-at-base.json +13 -0
- package/src/__golden__/wave-loop/op-hooks-share.json +33 -0
- package/src/__golden__/wave-loop/op-outcome-held.json +10 -0
- package/src/__golden__/wave-loop/op-outcome-replan-approved.json +10 -0
- package/src/__golden__/wave-loop/op-outcome-replan-forever.json +10 -0
- package/src/__golden__/wave-loop/op-outcome-replan.json +10 -0
- package/src/__golden__/wave-loop/op-outcome-stood-down.json +10 -0
- package/src/__golden__/wave-loop/op-outcome-unreadable.json +10 -0
- package/src/__golden__/wave-loop/op-overridden.json +16 -0
- package/src/__golden__/wave-loop/op-per-run.json +20 -0
- package/src/__golden__/wave-loop/op-point.json +13 -0
- package/src/__golden__/wave-loop/op-pr-review.json +10 -0
- package/src/__golden__/wave-loop/op-sealed.json +10 -0
- package/src/__golden__/wave-loop/op-spend-change-only.json +10 -0
- package/src/__golden__/wave-loop/op-spend.json +10 -0
- package/src/__golden__/wave-loop/op-wave-commands.json +55 -0
- package/src/__golden__/wave-loop/op-wide-refused.json +26 -0
- package/src/__golden__/wave-loop/op-wide-waiting.json +29 -0
- package/src/__golden__/wave-loop/op-wide.json +39 -0
- package/src/__snapshots__/okf.test.ts.snap +10 -0
- package/src/action-pins.test.ts +78 -0
- package/src/action-pins.ts +92 -0
- package/src/capabilities/aws.paths +148 -0
- package/src/capabilities/base-mappings.json +122 -0
- package/src/capabilities/catalog.ts +230 -0
- package/src/capabilities/language.test.ts +191 -0
- package/src/capabilities/language.ts +373 -0
- package/src/capabilities/matcher.ts +315 -0
- package/src/capabilities/view-compose.test.ts +76 -0
- package/src/capabilities/view.ts +631 -0
- package/src/cli/commands/carve-score-once.test.ts +99 -0
- package/src/cli/commands/carve.ts +37 -6
- package/src/cli/commands/check-lexicon.test.ts +2 -2
- package/src/cli/commands/import-report.ts +71 -0
- package/src/cli/commands/import.ts +33 -3
- package/src/cli/commands/lint.ts +1 -0
- package/src/cli/commands/migrate-dialect.test.ts +145 -0
- package/src/cli/commands/migrate.ts +132 -11
- package/src/cli/handlers/__snapshots__/build-member.test.ts.snap +4 -4
- package/src/cli/handlers/approve.ts +23 -2
- package/src/cli/handlers/build.ts +7 -1
- package/src/cli/handlers/declared-graph.ts +99 -0
- package/src/cli/handlers/graph.test.ts +94 -3
- package/src/cli/handlers/graph.ts +123 -96
- package/src/cli/handlers/ledger.ts +54 -0
- package/src/cli/handlers/migrate.ts +21 -12
- package/src/cli/handlers/misc.ts +10 -1
- package/src/cli/handlers/pr-env.ts +3 -4
- package/src/cli/handlers/pr.ts +138 -36
- package/src/cli/handlers/query.ts +16 -4
- package/src/cli/handlers/release.ts +6 -3
- package/src/cli/handlers/search-build-roots.test.ts +144 -0
- package/src/cli/handlers/search-count.test.ts +191 -0
- package/src/cli/handlers/search-count.ts +165 -0
- package/src/cli/handlers/search-json.test.ts +333 -0
- package/src/cli/handlers/search-live.test.ts +387 -0
- package/src/cli/handlers/search-paths.test.ts +235 -0
- package/src/cli/handlers/search.ts +1291 -166
- package/src/cli/main.test.ts +43 -3
- package/src/cli/main.ts +88 -17
- package/src/cli/mcp/server.test.ts +3 -3
- package/src/cli/mcp/server.ts +3 -0
- package/src/cli/mcp/tools/capabilities.ts +32 -0
- package/src/cli/mcp/workspace-tools.e2e.test.ts +21 -1
- package/src/cli/mcp/workspace-tools.ts +47 -2
- package/src/cli/parse-args.ts +79 -15
- package/src/cli/registry.ts +36 -4
- package/src/components/builders.ts +8 -0
- package/src/components/capability-plugin-loader.ts +13 -1
- package/src/components/capability-plugin.ts +16 -0
- package/src/components/pr-env-ports.ts +89 -0
- package/src/components/pr-env-run-bundle.test.ts +54 -0
- package/src/components/pr-env-run.ts +5 -76
- package/src/components/pr-environment.ts +2 -1
- package/src/components/pr-hooks.test.ts +73 -5
- package/src/components/pr-hooks.ts +95 -5
- package/src/components/pr-pipeline.ts +64 -16
- package/src/components/pr-policy.test.ts +64 -1
- package/src/components/pr-policy.ts +53 -0
- package/src/components/registry.test.ts +1 -1
- package/src/components/starter-plugin.ts +6 -0
- package/src/components/verbs/index.ts +2 -0
- package/src/components/verbs/publish-artifact.test.ts +60 -0
- package/src/components/verbs/publish-artifact.ts +122 -0
- package/src/components/verbs/publish-image.test.ts +101 -0
- package/src/components/verbs/publish-image.ts +265 -0
- package/src/config-environments.ts +160 -0
- package/src/config.ts +44 -124
- package/src/gate-decision-bundle.test.ts +1 -0
- package/src/gate-decision-identity.test.ts +9 -0
- package/src/gate-decision.ts +26 -3
- package/src/graph-detail.ts +15 -3
- package/src/graph-effective.ts +226 -75
- package/src/graph-ir.test.ts +163 -0
- package/src/graph-ir.ts +174 -0
- package/src/graph-sub-template.ts +22 -0
- package/src/graph-walk.test.ts +44 -0
- package/src/graph-walk.ts +102 -0
- package/src/import/parser.ts +20 -0
- package/src/lexicon.ts +84 -6
- package/src/lifecycle/gate-ledger.ts +8 -0
- package/src/lifecycle/git.ts +2 -2
- package/src/lifecycle/ledger-read.test.ts +107 -0
- package/src/lifecycle/ledger-read.ts +195 -0
- package/src/lifecycle/observe.test.ts +27 -1
- package/src/lifecycle/observe.ts +43 -1
- package/src/lifecycle/release-workstation.ts +24 -0
- package/src/lifecycle/run-ledger.ts +5 -2
- package/src/lint/cross-root.test.ts +122 -0
- package/src/lint/discover.ts +3 -1
- package/src/lint/post-synth.ts +212 -2
- package/src/lint/rule.ts +6 -0
- package/src/lint/rules/op/index.ts +2 -0
- package/src/lint/rules/op/ops019-workspace-op-target.ts +89 -0
- package/src/live-endpoint.ts +1 -1
- package/src/observation.test.ts +25 -0
- package/src/observation.ts +69 -5
- package/src/op/activities/activity-contracts.ts +5 -2
- package/src/op/activities/index.ts +2 -2
- package/src/op/activities/review-agent.test.ts +221 -4
- package/src/op/activities/review-agent.ts +265 -22
- package/src/op/activities/work-evidence.ts +9 -1
- package/src/op/builders.ts +9 -5
- package/src/op/composites/apply-op.test.ts +108 -0
- package/src/op/composites/apply-op.ts +37 -2
- package/src/op/gate-approval.test.ts +6 -1
- package/src/op/gate-approval.ts +12 -6
- package/src/op/gate-quorum-at-base.test.ts +211 -0
- package/src/op/gate-quorum.ts +156 -8
- package/src/op/gate-review.ts +14 -0
- package/src/op/gate.ts +67 -8
- package/src/op/index.ts +3 -2
- package/src/op/local-executor.ts +69 -9
- package/src/op/op-waves-depends-on.test.ts +81 -0
- package/src/op/op-waves-hook-targets.test.ts +4 -2
- package/src/op/op-waves-quorum-product.test.ts +158 -0
- package/src/op/op-waves-run.ts +288 -14
- package/src/op/op-waves.ts +143 -14
- package/src/op/runtime.ts +8 -0
- package/src/op/schedule-overdue.ts +33 -0
- package/src/op/stage-hooks.ts +13 -5
- package/src/op/workspace-run-env.ts +29 -0
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +47 -0
- package/src/pr-forge.ts +68 -0
- package/src/pr-post-open.e2e.test.ts +36 -0
- package/src/pr-post.test.ts +102 -3
- package/src/pr-post.ts +89 -1
- package/src/read-filter.test.ts +54 -0
- package/src/read-filter.ts +193 -0
- package/src/run-event.ts +1 -1
- package/src/stage-hooks-bundle.test.ts +1 -0
- package/src/terraform/carve.ts +52 -15
- package/src/terraform/cuts.test.ts +173 -0
- package/src/terraform/cuts.ts +188 -0
- package/src/terraform/folds.ts +44 -0
- package/src/terraform/graph.ts +9 -0
- package/src/terraform/radius.test.ts +90 -0
- package/src/terraform/reach.test.ts +146 -0
- package/src/terraform/reach.ts +247 -0
- package/src/terraform/score.ts +27 -29
- package/src/terraform/state.ts +3 -1
- package/src/terraform/types.ts +8 -0
- package/src/wave-blocked.ts +28 -3
- package/src/wave-loop-golden.test.ts +4 -3
- package/src/workspace/behold-kinds.test.ts +1 -1
- package/src/workspace/capabilities-contract.test.ts +88 -0
- package/src/workspace/capabilities-contract.ts +132 -0
- package/src/workspace/capabilities.schema.json +229 -0
- package/src/workspace/check-contract.test.ts +7 -6
- package/src/workspace/check.schema.json +11 -2
- package/src/workspace/checks/ci-branch.test.ts +128 -0
- package/src/workspace/checks/ci-branch.ts +141 -0
- package/src/workspace/checks/links.ts +12 -1
- package/src/workspace/checks/org.ts +169 -0
- package/src/workspace/checks.ts +64 -7
- package/src/workspace/ci-branches.ts +31 -0
- package/src/workspace/ci-green-branches.test.ts +153 -0
- package/src/workspace/ci-green-cli.ts +7 -7
- package/src/workspace/ci-green-workflow.test.ts +4 -3
- package/src/workspace/ci-green-workflow.ts +13 -9
- package/src/workspace/ci-green.ts +49 -12
- package/src/workspace/ci-run.test.ts +72 -1
- package/src/workspace/ci-run.ts +68 -8
- package/src/workspace/ci-serve.test.ts +95 -0
- package/src/workspace/ci-serve.ts +106 -65
- package/src/workspace/component-environments.test.ts +25 -2
- package/src/workspace/compose-graph.ts +19 -3
- package/src/workspace/composites.schema.json +22 -0
- package/src/workspace/composites.test.ts +39 -8
- package/src/workspace/composites.ts +6 -2
- package/src/workspace/conformance/__writer_fixture__/work/work.schema.json +105 -1
- package/src/workspace/conformance/conformance.e2e.test.ts +14 -1
- package/src/workspace/conformance/index.ts +31 -2
- package/src/workspace/cross-root-lint.test.ts +90 -0
- package/src/workspace/cross-root-lint.ts +126 -0
- package/src/workspace/dbt-kind.test.ts +3 -2
- package/src/workspace/dbt-models-reader.ts +362 -0
- package/src/workspace/dbt-models.test.ts +248 -0
- package/src/workspace/dbt-project-common.ts +113 -0
- package/src/workspace/dbt-project-reader.ts +29 -112
- package/src/workspace/decision-rank.ts +40 -0
- package/src/workspace/declaration.schema.json +133 -24
- package/src/workspace/declaration.ts +84 -15
- package/src/workspace/environments.ts +40 -4
- package/src/workspace/flyway-dir.ts +113 -0
- package/src/workspace/flyway-layout.ts +337 -0
- package/src/workspace/graph-cache.ts +27 -3
- package/src/workspace/graph-cli.ts +119 -32
- package/src/workspace/graph-contract.test.ts +4 -2
- package/src/workspace/graph.schema.json +182 -0
- package/src/workspace/identity.test.ts +14 -2
- package/src/workspace/intent.ts +6 -14
- package/src/workspace/kind-link-readers.ts +68 -3
- package/src/workspace/kind-readers.e2e.test.ts +28 -0
- package/src/workspace/kind-readers.test.ts +1 -1
- package/src/workspace/kind-readers.ts +7 -1
- package/src/workspace/kinds.test.ts +12 -7
- package/src/workspace/kinds.ts +132 -7
- package/src/workspace/ledger.schema.json +158 -0
- package/src/workspace/lexicon-outputs.ts +132 -13
- package/src/workspace/lineage-check.ts +30 -7
- package/src/workspace/links.ts +24 -1
- package/src/workspace/ls-contract.test.ts +1 -1
- package/src/workspace/ls.schema.json +7 -0
- package/src/workspace/ls.ts +10 -1
- package/src/workspace/member-commands.ts +82 -3
- package/src/workspace/member-file-schema.test.ts +124 -0
- package/src/workspace/migrate-links.test.ts +99 -0
- package/src/workspace/migrate-links.ts +108 -0
- package/src/workspace/migration-dirs.test.ts +272 -0
- package/src/workspace/migration-dirs.ts +267 -0
- package/src/workspace/nested-graph.ts +32 -1
- package/src/workspace/org-scope.test.ts +238 -0
- package/src/workspace/reason-codes.test.ts +13 -1
- package/src/workspace/reason-codes.ts +23 -0
- package/src/workspace/records-cli.ts +58 -5
- package/src/workspace/records.schema.json +5 -0
- package/src/workspace/release-candidates.ts +7 -2
- package/src/workspace/release-train.ts +157 -0
- package/src/workspace/release-workflow.ts +4 -3
- package/src/workspace/repo-ref.ts +113 -0
- package/src/workspace/run-event.schema.json +2 -2
- package/src/workspace/runs-cli.ts +48 -4
- package/src/workspace/runs.schema.json +7 -0
- package/src/workspace/search-cli.e2e.test.ts +305 -0
- package/src/workspace/search-cli.ts +591 -0
- package/src/workspace/search-contract.ts +95 -0
- package/src/workspace/search.schema.json +822 -0
- package/src/workspace/status-contract.test.ts +46 -1
- package/src/workspace/status-decisions.test.ts +100 -0
- package/src/workspace/status-decisions.ts +151 -0
- package/src/workspace/status-gates.ts +9 -0
- package/src/workspace/status.schema.json +6 -0
- package/src/workspace/status.ts +17 -3
- package/src/workspace/where-filters.test.ts +39 -0
- package/src/workspace/work-cli.ts +5 -3
- package/src/workspace/work-evidence-ops.test.ts +176 -0
- package/src/workspace/work-evidence-ops.ts +189 -0
- package/src/workspace/work-evidence.schema.json +49 -2
- package/src/workspace/work-evidence.ts +22 -3
- package/src/workspace/workspace-gates.ts +200 -0
- package/src/workspace/workspace-kinds.schema.json +58 -3
- package/src/workspace/workspace-ledger.ts +130 -0
- package/src/workspace/workspace-run.test.ts +322 -0
- package/src/workspace/workspace-run.ts +461 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { terraformType } from "../graph-effective.js";
|
|
2
|
+
/**
|
|
3
|
+
* Merge mappings for the same lexicon: objects merge key by key at every
|
|
4
|
+
* depth, lists concatenate, and anything else in a later mapping wins.
|
|
5
|
+
*/
|
|
6
|
+
export function mergeMappings(...ms) {
|
|
7
|
+
const merge = (a, b) => {
|
|
8
|
+
if (b === undefined)
|
|
9
|
+
return a;
|
|
10
|
+
if (Array.isArray(a) && Array.isArray(b))
|
|
11
|
+
return [...a, ...b.filter((x) => typeof x === "object" || !a.includes(x))];
|
|
12
|
+
const isObj = (x) => !!x && typeof x === "object" && !Array.isArray(x);
|
|
13
|
+
if (isObj(a) && isObj(b)) {
|
|
14
|
+
const out = { ...a };
|
|
15
|
+
for (const [k, v] of Object.entries(b))
|
|
16
|
+
out[k] = merge(a[k], v);
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
return b;
|
|
20
|
+
};
|
|
21
|
+
return ms.reduce((acc, m) => merge(acc, m), { lexicon: ms[0]?.lexicon ?? "" });
|
|
22
|
+
}
|
|
23
|
+
const arr = (v) => (v == null ? [] : Array.isArray(v) ? v : [v]);
|
|
24
|
+
/** Every value at `path` (`A.B`, `A[].B`), flattened. */
|
|
25
|
+
function readPath(obj, path) {
|
|
26
|
+
let cur = [obj];
|
|
27
|
+
for (const seg of path.split(".")) {
|
|
28
|
+
const spread = seg.endsWith("[]");
|
|
29
|
+
const key = spread ? seg.slice(0, -2) : seg;
|
|
30
|
+
const next = [];
|
|
31
|
+
for (const c of cur) {
|
|
32
|
+
if (!c || typeof c !== "object")
|
|
33
|
+
continue;
|
|
34
|
+
const v = c[key];
|
|
35
|
+
if (v === undefined)
|
|
36
|
+
continue;
|
|
37
|
+
if (spread)
|
|
38
|
+
next.push(...arr(v));
|
|
39
|
+
else
|
|
40
|
+
next.push(v);
|
|
41
|
+
}
|
|
42
|
+
cur = next;
|
|
43
|
+
}
|
|
44
|
+
return cur;
|
|
45
|
+
}
|
|
46
|
+
function readSource(obj, src) {
|
|
47
|
+
if (typeof src === "string")
|
|
48
|
+
return readPath(obj, src)[0];
|
|
49
|
+
if (Array.isArray(src)) {
|
|
50
|
+
for (const p of src) {
|
|
51
|
+
const v = readPath(obj, p)[0];
|
|
52
|
+
if (v !== undefined && v !== null)
|
|
53
|
+
return v;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
if ("const" in src)
|
|
58
|
+
return src.const;
|
|
59
|
+
return src.all.flatMap((p) => readPath(obj, p).flatMap(arr));
|
|
60
|
+
}
|
|
61
|
+
function matchesWhen(obj, when) {
|
|
62
|
+
if (!when)
|
|
63
|
+
return true;
|
|
64
|
+
return Object.entries(when).every(([k, v]) => readPath(obj, k)[0] === v);
|
|
65
|
+
}
|
|
66
|
+
/** The bare name a row prints: no stack qualification, no root directory. */
|
|
67
|
+
export function displayName(id) {
|
|
68
|
+
const s = id.includes("::") ? id.slice(id.lastIndexOf("::") + 2) : id;
|
|
69
|
+
return s.slice(s.lastIndexOf("/") + 1);
|
|
70
|
+
}
|
|
71
|
+
const ARN_NAMES = [
|
|
72
|
+
{ label: "Role", re: /^arn:aws[\w-]*:iam::[^:]*:role\/(?:[^*]*\/)?([^/*]+)$/ },
|
|
73
|
+
{ label: "Bucket", re: /^arn:aws[\w-]*:s3:::([^/*]+)(?:\/.*)?$/ },
|
|
74
|
+
{ label: "Table", re: /^arn:aws[\w-]*:dynamodb:[^:]*:[^:]*:table\/([^/*]+)$/ },
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* Normalize what each lexicon spells its own way, for labels whose meaning is
|
|
78
|
+
* core vocabulary: an ingress rule's protocol and port range.
|
|
79
|
+
*/
|
|
80
|
+
function normalize(label, attrs) {
|
|
81
|
+
if (label === "IngressRule") {
|
|
82
|
+
const raw = attrs.proto == null ? "-1" : String(attrs.proto).toLowerCase();
|
|
83
|
+
const proto = raw === "all" || raw === "-1" ? "-1" : raw;
|
|
84
|
+
attrs.proto = proto;
|
|
85
|
+
if (proto === "-1" || attrs.from == null) {
|
|
86
|
+
attrs.from = 0;
|
|
87
|
+
attrs.to = 65535;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
attrs.from = Number(attrs.from);
|
|
91
|
+
attrs.to = attrs.to == null ? attrs.from : Number(attrs.to);
|
|
92
|
+
}
|
|
93
|
+
attrs.cidrs = arr(attrs.cidrs).map(String);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Build the view of an IR through the packs given. Nodes of a kind no
|
|
98
|
+
* mapping labels are left out, as are edges no mapping names.
|
|
99
|
+
*/
|
|
100
|
+
export function buildView(ir, packs) {
|
|
101
|
+
const byLexicon = new Map();
|
|
102
|
+
for (const p of packs) {
|
|
103
|
+
const prev = byLexicon.get(p.mapping.lexicon);
|
|
104
|
+
byLexicon.set(p.mapping.lexicon, prev ? { mapping: mergeMappings(prev.mapping, p.mapping), adapter: { ...prev.adapter, ...p.adapter } } : p);
|
|
105
|
+
}
|
|
106
|
+
const terraformPack = [...byLexicon.values()].find((p) => p.mapping.types === "terraform");
|
|
107
|
+
const kindPacks = [...byLexicon.values()].filter((p) => p.mapping.types !== "terraform");
|
|
108
|
+
const nodes = new Map();
|
|
109
|
+
const edges = [];
|
|
110
|
+
const lexicons = new Set();
|
|
111
|
+
const irById = new Map(ir.nodes.map((n) => [n.id, n]));
|
|
112
|
+
const packOf = new Map();
|
|
113
|
+
const typeAndPack = (n) => {
|
|
114
|
+
const tf = terraformType(n);
|
|
115
|
+
if (tf !== undefined)
|
|
116
|
+
return terraformPack ? { type: tf, pack: terraformPack } : undefined;
|
|
117
|
+
const kind = n.kind ?? "";
|
|
118
|
+
const pack = kindPacks.find((p) => p.mapping.labels?.[kind] !== undefined);
|
|
119
|
+
return pack ? { type: kind, pack } : undefined;
|
|
120
|
+
};
|
|
121
|
+
const bodyOf = (n, pack) => {
|
|
122
|
+
const attrs = (n.attrs ?? {});
|
|
123
|
+
if (!pack.mapping.body)
|
|
124
|
+
return attrs;
|
|
125
|
+
const b = attrs[pack.mapping.body];
|
|
126
|
+
return b && typeof b === "object" && !Array.isArray(b) ? b : {};
|
|
127
|
+
};
|
|
128
|
+
// Terraform locals, per scope, so `tags = local.restricted` reads as a map.
|
|
129
|
+
const locals = new Map();
|
|
130
|
+
const scopeOf = (id) => id.slice(0, id.lastIndexOf("/") + 1);
|
|
131
|
+
for (const n of ir.nodes) {
|
|
132
|
+
if (n.kind !== "Terraform::Locals")
|
|
133
|
+
continue;
|
|
134
|
+
const body = (n.attrs?.body ?? {});
|
|
135
|
+
locals.set(scopeOf(n.id), { ...locals.get(scopeOf(n.id)), ...body });
|
|
136
|
+
}
|
|
137
|
+
const resolveLocal = (from, v) => {
|
|
138
|
+
const m = typeof v === "string" ? /^\$\{local\.([\w-]+)\}$/.exec(v) : null;
|
|
139
|
+
return m ? locals.get(scopeOf(from))?.[m[1]] : v;
|
|
140
|
+
};
|
|
141
|
+
// ---- nodes
|
|
142
|
+
for (const n of ir.nodes) {
|
|
143
|
+
const tp = typeAndPack(n);
|
|
144
|
+
if (!tp)
|
|
145
|
+
continue;
|
|
146
|
+
const { type, pack } = tp;
|
|
147
|
+
const m = pack.mapping;
|
|
148
|
+
const spec = m.labels?.[type];
|
|
149
|
+
if (spec === undefined)
|
|
150
|
+
continue;
|
|
151
|
+
const label = typeof spec === "string" ? spec : spec.label;
|
|
152
|
+
const body = bodyOf(n, pack);
|
|
153
|
+
if (typeof spec !== "string" && !matchesWhen(body, spec.when))
|
|
154
|
+
continue;
|
|
155
|
+
const attrs = { type };
|
|
156
|
+
if (typeof spec !== "string" && spec.style)
|
|
157
|
+
attrs.style = spec.style;
|
|
158
|
+
if (typeof spec !== "string" && spec.set)
|
|
159
|
+
Object.assign(attrs, spec.set);
|
|
160
|
+
for (const [neutral, src] of Object.entries(m.attrs?.[label] ?? {})) {
|
|
161
|
+
const v = readSource(body, src);
|
|
162
|
+
if (v !== undefined)
|
|
163
|
+
attrs[neutral] = resolveLocal(n.id, v);
|
|
164
|
+
}
|
|
165
|
+
// Carry the IR's own derived attributes (a live read's `internetFacing`).
|
|
166
|
+
for (const [k, v] of Object.entries((n.attrs ?? {}))) {
|
|
167
|
+
if (k === "internetFacing" && attrs[k] === undefined)
|
|
168
|
+
attrs[k] = v;
|
|
169
|
+
}
|
|
170
|
+
if (m.classificationTags?.length) {
|
|
171
|
+
for (const path of m.tags ?? []) {
|
|
172
|
+
const tags = resolveLocal(n.id, readPath(body, path)[0]);
|
|
173
|
+
const map = Array.isArray(tags)
|
|
174
|
+
? Object.fromEntries(tags.map((t) => [t.Key, t.Value]))
|
|
175
|
+
: tags && typeof tags === "object"
|
|
176
|
+
? tags
|
|
177
|
+
: {};
|
|
178
|
+
for (const key of m.classificationTags) {
|
|
179
|
+
if (map[key] !== undefined && attrs.classification === undefined)
|
|
180
|
+
attrs.classification = map[key];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
normalize(label, attrs);
|
|
185
|
+
nodes.set(n.id, { id: n.id, label, irId: n.id, lexicon: m.lexicon, attrs, body });
|
|
186
|
+
packOf.set(n.id, pack);
|
|
187
|
+
lexicons.add(m.lexicon);
|
|
188
|
+
}
|
|
189
|
+
// ---- references inside attribute values
|
|
190
|
+
const byName = new Map();
|
|
191
|
+
for (const v of nodes.values()) {
|
|
192
|
+
const name = v.attrs.name;
|
|
193
|
+
if (typeof name !== "string" || !name)
|
|
194
|
+
continue;
|
|
195
|
+
if (!byName.has(v.label))
|
|
196
|
+
byName.set(v.label, new Map());
|
|
197
|
+
byName.get(v.label).set(name, v.id);
|
|
198
|
+
}
|
|
199
|
+
const refTarget = (from, value) => {
|
|
200
|
+
const pack = packOf.get(from);
|
|
201
|
+
if (value && typeof value === "object") {
|
|
202
|
+
const ref = value.$ref;
|
|
203
|
+
if (typeof ref === "string") {
|
|
204
|
+
if (nodes.has(ref))
|
|
205
|
+
return { id: ref };
|
|
206
|
+
const dot = ref.lastIndexOf(".");
|
|
207
|
+
if (dot > 0 && nodes.has(ref.slice(0, dot)))
|
|
208
|
+
return { id: ref.slice(0, dot), attr: ref.slice(dot + 1) };
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
const sub = value.$sub;
|
|
212
|
+
if (typeof sub === "string") {
|
|
213
|
+
const m = /\$\{([^.}]+)(?:\.([^}]+))?\}/.exec(sub);
|
|
214
|
+
if (m && nodes.has(m[1]))
|
|
215
|
+
return { id: m[1], attr: m[2] };
|
|
216
|
+
}
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
if (typeof value !== "string")
|
|
220
|
+
return undefined;
|
|
221
|
+
if (pack?.mapping.refs === "terraform") {
|
|
222
|
+
const m = /(?:^|[^\w.])((?:data\.)?[a-z][a-z0-9]*_[a-z0-9_]+\.[A-Za-z0-9_-]+)(?:\[[^\]]*\])?\.([A-Za-z_]+)/.exec(value);
|
|
223
|
+
if (m) {
|
|
224
|
+
const id = scopeOf(from) + m[1];
|
|
225
|
+
if (nodes.has(id))
|
|
226
|
+
return { id, attr: m[2] };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
for (const { label, re } of ARN_NAMES) {
|
|
230
|
+
const m = re.exec(value);
|
|
231
|
+
const id = m ? byName.get(label)?.get(m[1]) : undefined;
|
|
232
|
+
if (id)
|
|
233
|
+
return { id };
|
|
234
|
+
}
|
|
235
|
+
return undefined;
|
|
236
|
+
};
|
|
237
|
+
const unresolved = [];
|
|
238
|
+
// An ARN that names nothing declared here is kept for a workspace's composer (#4378).
|
|
239
|
+
const keepArn = (from, fromAttr, edge, value) => {
|
|
240
|
+
if (typeof value === "string" && ARN_NAMES.some(({ re }) => re.test(value)))
|
|
241
|
+
unresolved.push({ from, fromAttr, edge, value });
|
|
242
|
+
};
|
|
243
|
+
const blockEdges = [];
|
|
244
|
+
// ---- inline blocks: ingress rules, inline routes
|
|
245
|
+
for (const v of [...nodes.values()]) {
|
|
246
|
+
const pack = packOf.get(v.id);
|
|
247
|
+
const specs = pack.mapping.blocks?.[v.label];
|
|
248
|
+
if (!specs)
|
|
249
|
+
continue;
|
|
250
|
+
const body = bodyOf(irById.get(v.id), pack);
|
|
251
|
+
for (const spec of specs) {
|
|
252
|
+
readPath(body, spec.attr)
|
|
253
|
+
.flatMap(arr)
|
|
254
|
+
.forEach((raw, i) => {
|
|
255
|
+
if (!raw || typeof raw !== "object" || !matchesWhen(raw, spec.when))
|
|
256
|
+
return;
|
|
257
|
+
const id = `${v.id}#${spec.attr.replace(/\[\]/g, "")}[${i}]`;
|
|
258
|
+
const attrs = { block: true };
|
|
259
|
+
if (spec.style)
|
|
260
|
+
attrs.style = spec.style;
|
|
261
|
+
for (const [neutral, src] of Object.entries(spec.attrs ?? {})) {
|
|
262
|
+
const val = readSource(raw, src);
|
|
263
|
+
if (val !== undefined)
|
|
264
|
+
attrs[neutral] = val;
|
|
265
|
+
}
|
|
266
|
+
normalize(spec.label, attrs);
|
|
267
|
+
nodes.set(id, { id, label: spec.label, irId: v.id, lexicon: v.lexicon, attrs, body: raw });
|
|
268
|
+
packOf.set(id, pack);
|
|
269
|
+
const back = spec.edge.startsWith("-");
|
|
270
|
+
const name = back ? spec.edge.slice(1) : spec.edge;
|
|
271
|
+
const hop = { from: v.id, fromAttr: spec.attr.replace(/\[\]/g, ""), to: id, edge: name };
|
|
272
|
+
blockEdges.push(back ? { from: id, to: v.id, name, hops: [hop] } : { from: v.id, to: id, name, hops: [hop] });
|
|
273
|
+
for (const [attr, edge] of Object.entries(spec.refs ?? {})) {
|
|
274
|
+
for (const val of arr(raw[attr])) {
|
|
275
|
+
const t = refTarget(v.id, val);
|
|
276
|
+
if (!t)
|
|
277
|
+
keepArn(id, attr, edge, val);
|
|
278
|
+
if (t)
|
|
279
|
+
blockEdges.push({ from: id, to: t.id, name: edge, hops: [{ from: id, fromAttr: attr, to: t.id, ...(t.attr ? { toAttr: t.attr } : {}), edge }] });
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Blocks first: an inline route is read before a separate route resource,
|
|
286
|
+
// the order the folds always used.
|
|
287
|
+
edges.push(...blockEdges);
|
|
288
|
+
// ---- IR edges, named per label
|
|
289
|
+
for (const e of ir.edges ?? []) {
|
|
290
|
+
const from = nodes.get(e.from);
|
|
291
|
+
const to = nodes.get(e.to);
|
|
292
|
+
if (!from || !to)
|
|
293
|
+
continue;
|
|
294
|
+
const pack = packOf.get(e.from);
|
|
295
|
+
const via = e.viaAttr ?? e.kind ?? "";
|
|
296
|
+
const spec = pack.mapping.edges?.[from.label]?.[via];
|
|
297
|
+
const name = typeof spec === "string" ? spec : spec?.[to.label];
|
|
298
|
+
if (!name)
|
|
299
|
+
continue;
|
|
300
|
+
const back = name.startsWith("-");
|
|
301
|
+
const n = back ? name.slice(1) : name;
|
|
302
|
+
const hop = irHop(e, n);
|
|
303
|
+
edges.push(back ? { from: e.to, to: e.from, name: n, hops: [hop] } : { from: e.from, to: e.to, name: n, hops: [hop] });
|
|
304
|
+
}
|
|
305
|
+
// ---- link resources -> one edge
|
|
306
|
+
for (const v of [...nodes.values()]) {
|
|
307
|
+
const link = packOf.get(v.id)?.mapping.links?.[v.label];
|
|
308
|
+
if (!link)
|
|
309
|
+
continue;
|
|
310
|
+
const a = edges.find((e) => e.from === v.id && e.name === link.from);
|
|
311
|
+
const b = edges.find((e) => e.from === v.id && e.name === link.to);
|
|
312
|
+
if (a && b)
|
|
313
|
+
edges.push({ from: a.to, to: b.to, name: link.edge, hops: [...a.hops, ...b.hops] });
|
|
314
|
+
}
|
|
315
|
+
// ---- policy documents -> statements
|
|
316
|
+
for (const holder of [...nodes.values()]) {
|
|
317
|
+
if (holder.attrs.block)
|
|
318
|
+
continue;
|
|
319
|
+
const pack = packOf.get(holder.id);
|
|
320
|
+
const docs = pack.mapping.documents?.[holder.label];
|
|
321
|
+
if (!docs)
|
|
322
|
+
continue;
|
|
323
|
+
const body = bodyOf(irById.get(holder.id), pack);
|
|
324
|
+
for (const [path, docKind] of Object.entries(docs)) {
|
|
325
|
+
readPath(body, path).forEach((raw, di) => {
|
|
326
|
+
const doc = readDocument(raw, pack);
|
|
327
|
+
if (!doc)
|
|
328
|
+
return;
|
|
329
|
+
const base = path.replace(/\[\]/g, "");
|
|
330
|
+
arr(doc.Statement).forEach((s0, si) => {
|
|
331
|
+
if (!s0 || typeof s0 !== "object")
|
|
332
|
+
return;
|
|
333
|
+
const s = s0;
|
|
334
|
+
const id = `${holder.id}#${base}[${di}].Statement[${si}]`;
|
|
335
|
+
const principal = s.Principal;
|
|
336
|
+
const principals = principal === "*"
|
|
337
|
+
? ["*"]
|
|
338
|
+
: principal && typeof principal === "object"
|
|
339
|
+
? Object.values(principal).flatMap(arr).map((p) => (typeof p === "string" ? p : "ref"))
|
|
340
|
+
: [];
|
|
341
|
+
const resources = arr(s.Resource);
|
|
342
|
+
const attrs = {
|
|
343
|
+
doc: docKind,
|
|
344
|
+
effect: s.Effect,
|
|
345
|
+
actions: arr(s.Action).map(String),
|
|
346
|
+
...(s.NotAction !== undefined ? { notActions: arr(s.NotAction).map(String) } : {}),
|
|
347
|
+
...(s.NotResource !== undefined ? { notResource: true } : {}),
|
|
348
|
+
...(s.Condition !== undefined ? { condition: true } : {}),
|
|
349
|
+
...(resources.some((r) => r === "*") ? { anyResource: true } : {}),
|
|
350
|
+
principals,
|
|
351
|
+
};
|
|
352
|
+
nodes.set(id, { id, label: "Statement", irId: holder.id, lexicon: holder.lexicon, attrs });
|
|
353
|
+
packOf.set(id, pack);
|
|
354
|
+
edges.push({ from: holder.id, to: id, name: "statement", hops: [{ from: holder.id, fromAttr: base, to: id, edge: "statement" }] });
|
|
355
|
+
let unresolved = 0;
|
|
356
|
+
resources.forEach((r, ri) => {
|
|
357
|
+
const t = refTarget(holder.id, r);
|
|
358
|
+
// A reference the graph holds but can't name (an intrinsic with
|
|
359
|
+
// no target, a Terraform expression to an undeclared resource) is
|
|
360
|
+
// counted, so an answer can say what it skipped. A `Sub` is read
|
|
361
|
+
// through its `$sub` template (chant#4373).
|
|
362
|
+
if (!t && ((r && typeof r === "object") || (typeof r === "string" && r.includes("${"))))
|
|
363
|
+
unresolved++;
|
|
364
|
+
if (!t)
|
|
365
|
+
keepArn(id, `Resource[${ri}]`, "resource", r);
|
|
366
|
+
if (t)
|
|
367
|
+
edges.push({ from: id, to: t.id, name: "resource", hops: [{ from: id, fromAttr: `Resource[${ri}]`, to: t.id, ...(t.attr ? { toAttr: t.attr } : {}), edge: "resource" }] });
|
|
368
|
+
});
|
|
369
|
+
if (unresolved > 0)
|
|
370
|
+
attrs.unresolved = unresolved;
|
|
371
|
+
if (principal && typeof principal === "object") {
|
|
372
|
+
for (const p of arr(principal.AWS)) {
|
|
373
|
+
const t = refTarget(holder.id, p);
|
|
374
|
+
if (!t)
|
|
375
|
+
keepArn(id, "Principal.AWS", "principal", p);
|
|
376
|
+
if (t)
|
|
377
|
+
edges.push({ from: id, to: t.id, name: "principal", hops: [{ from: id, fromAttr: "Principal.AWS", to: t.id, ...(t.attr ? { toAttr: t.attr } : {}), edge: "principal" }] });
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return { nodes, edges, lexicons, unresolved };
|
|
385
|
+
}
|
|
386
|
+
/** The version of the serialized view a member's `chant graph --capability-view` prints (#4378). */
|
|
387
|
+
export const VIEW_DOCUMENT_VERSION = 1;
|
|
388
|
+
export function serializeView(view) {
|
|
389
|
+
return {
|
|
390
|
+
version: VIEW_DOCUMENT_VERSION,
|
|
391
|
+
lexicons: [...view.lexicons].sort(),
|
|
392
|
+
nodes: [...view.nodes.values()].map((n) => ({ id: n.id, label: n.label, irId: n.irId, lexicon: n.lexicon, attrs: n.attrs })),
|
|
393
|
+
edges: view.edges,
|
|
394
|
+
unresolved: view.unresolved ?? [],
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
/** Whether a member printed a view this chant reads; anything else is treated as no view. */
|
|
398
|
+
export function isViewDocument(v) {
|
|
399
|
+
if (!v || typeof v !== "object")
|
|
400
|
+
return false;
|
|
401
|
+
const d = v;
|
|
402
|
+
return d.version === VIEW_DOCUMENT_VERSION && Array.isArray(d.nodes) && Array.isArray(d.edges) && Array.isArray(d.lexicons);
|
|
403
|
+
}
|
|
404
|
+
/** A view document with every id it holds given `prefix` (`<member>/`), as `workspace graph` composes ids. */
|
|
405
|
+
export function prefixView(doc, prefix) {
|
|
406
|
+
const p = (id) => `${prefix}${id}`;
|
|
407
|
+
const hop = (h) => ({ ...h, from: p(h.from), to: p(h.to) });
|
|
408
|
+
return {
|
|
409
|
+
version: doc.version,
|
|
410
|
+
lexicons: doc.lexicons,
|
|
411
|
+
nodes: doc.nodes.map((n) => ({ ...n, id: p(n.id), irId: p(n.irId) })),
|
|
412
|
+
edges: doc.edges.map((e) => ({ ...e, from: p(e.from), to: p(e.to), hops: e.hops.map(hop) })),
|
|
413
|
+
unresolved: (doc.unresolved ?? []).map((u) => ({ ...u, from: p(u.from) })),
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Compose member views into one (#4378), the matcher's input over a
|
|
418
|
+
* workspace. Each member's view was mapped by its own chant; the one thing
|
|
419
|
+
* left to do here is resolve the ARNs a member couldn't, by name over every
|
|
420
|
+
* member's nodes. Where several members declare the name, the last one in
|
|
421
|
+
* member order wins, as within one view.
|
|
422
|
+
*/
|
|
423
|
+
export function composeViews(docs) {
|
|
424
|
+
const nodes = new Map();
|
|
425
|
+
const edges = [];
|
|
426
|
+
const lexicons = new Set();
|
|
427
|
+
for (const d of docs) {
|
|
428
|
+
for (const n of d.nodes)
|
|
429
|
+
nodes.set(n.id, { ...n });
|
|
430
|
+
edges.push(...d.edges);
|
|
431
|
+
for (const l of d.lexicons)
|
|
432
|
+
lexicons.add(l);
|
|
433
|
+
}
|
|
434
|
+
const byName = new Map();
|
|
435
|
+
for (const v of nodes.values()) {
|
|
436
|
+
const name = v.attrs.name;
|
|
437
|
+
if (typeof name !== "string" || !name)
|
|
438
|
+
continue;
|
|
439
|
+
if (!byName.has(v.label))
|
|
440
|
+
byName.set(v.label, new Map());
|
|
441
|
+
byName.get(v.label).set(name, v.id);
|
|
442
|
+
}
|
|
443
|
+
const unresolved = [];
|
|
444
|
+
for (const u of docs.flatMap((d) => d.unresolved ?? [])) {
|
|
445
|
+
let to;
|
|
446
|
+
for (const { label, re } of ARN_NAMES) {
|
|
447
|
+
const m = re.exec(u.value);
|
|
448
|
+
to = m ? byName.get(label)?.get(m[1]) : undefined;
|
|
449
|
+
if (to)
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
if (to)
|
|
453
|
+
edges.push({ from: u.from, to, name: u.edge, hops: [{ from: u.from, fromAttr: u.fromAttr, to, edge: u.edge }] });
|
|
454
|
+
else
|
|
455
|
+
unresolved.push(u);
|
|
456
|
+
}
|
|
457
|
+
return { nodes, edges, lexicons, unresolved };
|
|
458
|
+
}
|
|
459
|
+
function irHop(e, name) {
|
|
460
|
+
return {
|
|
461
|
+
from: e.from,
|
|
462
|
+
...(e.viaAttr ? { fromAttr: e.viaAttr } : {}),
|
|
463
|
+
to: e.to,
|
|
464
|
+
...(e.toAttr ? { toAttr: e.toAttr } : {}),
|
|
465
|
+
edge: name,
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function readDocument(raw, pack) {
|
|
469
|
+
if (pack.adapter?.readDocument)
|
|
470
|
+
return pack.adapter.readDocument(raw);
|
|
471
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
472
|
+
const inner = raw.PolicyDocument;
|
|
473
|
+
return inner && typeof inner === "object" ? inner : raw;
|
|
474
|
+
}
|
|
475
|
+
if (typeof raw === "string") {
|
|
476
|
+
try {
|
|
477
|
+
return JSON.parse(raw);
|
|
478
|
+
}
|
|
479
|
+
catch {
|
|
480
|
+
return undefined;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return undefined;
|
|
484
|
+
}
|
|
@@ -74,6 +74,9 @@ export declare function carveAdvise(opts: CarveAdviseOptions): Promise<CarveAdvi
|
|
|
74
74
|
* additive and ignorable: the top-level `source` discriminator, per-resource
|
|
75
75
|
* `notes` and `members`, and two more `bridge` values in a list that was
|
|
76
76
|
* already declared open-ended.
|
|
77
|
+
*
|
|
78
|
+
* Per-resource `radius` (#2326) is additive the same way: a new field beside
|
|
79
|
+
* `score`, not a term inside it, so the score and its penalties are unchanged.
|
|
77
80
|
*/
|
|
78
81
|
export declare const CARVE_REPORT_VERSION = 1;
|
|
79
82
|
/** One ranked resource in the JSON report: its score, plus the boundary its carve would cut. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAe,KAAK,WAAW,EAAwB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,
|
|
1
|
+
{"version":3,"file":"carve.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/carve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAe,KAAK,WAAW,EAAwB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC/G,OAAO,EAAqD,KAAK,YAAY,EAAqB,MAAM,uBAAuB,CAAC;AAChI,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAID,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAatF;AA4CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,gGAAgG;AAChG,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE;QAAE,OAAO,EAAE,YAAY,EAAE,CAAC;QAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC;CAClE;AAED,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,+CAA+C;AAC/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAkBpE;AAiBD,6CAA6C;AAC7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA+CnE"}
|
|
@@ -18,7 +18,7 @@ import { adviseCloudAssembly, CDK_DIALECT } from "../../cdk/advise.js";
|
|
|
18
18
|
import { isCloudAssembly } from "../../cdk/assembly.js";
|
|
19
19
|
import { parseTerraformDir, Hcl2JsonNotInstalled } from "../../terraform/parse.js";
|
|
20
20
|
import { scoreEstate } from "../../terraform/score.js";
|
|
21
|
-
import { boundaryReport } from "../../terraform/carve.js";
|
|
21
|
+
import { boundaryIndex, boundaryReport } from "../../terraform/carve.js";
|
|
22
22
|
const BAND_ORDER = ["clean leaf", "carvable w/ edits", "leave in Terraform"];
|
|
23
23
|
export async function carveAdvise(opts) {
|
|
24
24
|
if (!opts.from) {
|
|
@@ -100,6 +100,9 @@ async function adviseTerraform(opts) {
|
|
|
100
100
|
* additive and ignorable: the top-level `source` discriminator, per-resource
|
|
101
101
|
* `notes` and `members`, and two more `bridge` values in a list that was
|
|
102
102
|
* already declared open-ended.
|
|
103
|
+
*
|
|
104
|
+
* Per-resource `radius` (#2326) is additive the same way: a new field beside
|
|
105
|
+
* `score`, not a term inside it, so the score and its penalties are unchanged.
|
|
103
106
|
*/
|
|
104
107
|
export const CARVE_REPORT_VERSION = 1;
|
|
105
108
|
/** Build the `--json` / `--report` payload. */
|
|
@@ -108,6 +111,7 @@ export function carveJson(result) {
|
|
|
108
111
|
const counts = Object.fromEntries(BAND_ORDER.map((b) => [b, results.filter((r) => r.band === b).length]));
|
|
109
112
|
const source = result.source ?? "terraform";
|
|
110
113
|
const dialect = source === "cdk" ? CDK_DIALECT : "terraform";
|
|
114
|
+
const index = result.graph ? boundaryIndex(result.graph) : undefined;
|
|
111
115
|
return {
|
|
112
116
|
version: CARVE_REPORT_VERSION,
|
|
113
117
|
from: result.from,
|
|
@@ -116,14 +120,15 @@ export function carveJson(result) {
|
|
|
116
120
|
count: results.length,
|
|
117
121
|
bands: counts,
|
|
118
122
|
...(result.diagnostics?.length ? { diagnostics: result.diagnostics } : {}),
|
|
119
|
-
resources: results.map((r) => withBoundary(r, result.graph, dialect, result.scoreOptions)),
|
|
123
|
+
resources: results.map((r) => withBoundary(r, result.graph, dialect, result.scoreOptions, index)),
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
/** A scored resource plus its carve boundary, when the graph is at hand (#1636). */
|
|
123
|
-
function withBoundary(r, graph, dialect, score) {
|
|
127
|
+
function withBoundary(r, graph, dialect, score, index) {
|
|
124
128
|
if (!graph)
|
|
125
129
|
return r;
|
|
126
|
-
|
|
130
|
+
// The ranking already scored this resource; the report reads it back rather than rescoring the estate (#4391).
|
|
131
|
+
const report = boundaryReport(graph, r.address, { dialect, score, peelability: r, index });
|
|
127
132
|
if (!report)
|
|
128
133
|
return r;
|
|
129
134
|
return { ...r, boundary: { inbound: report.inbound, outbound: report.outbound } };
|
|
@@ -145,6 +150,8 @@ export function formatCarveReport(result) {
|
|
|
145
150
|
for (const note of result.diagnostics ?? [])
|
|
146
151
|
lines.push(` ! ${note}`);
|
|
147
152
|
lines.push("");
|
|
153
|
+
const cells = new Map(results.map((r) => [r.address, radiusCell(r)]));
|
|
154
|
+
const cellWidth = Math.max(...[...cells.values()].map((c) => c.length));
|
|
148
155
|
for (const band of BAND_ORDER) {
|
|
149
156
|
const inBand = results.filter((r) => r.band === band);
|
|
150
157
|
if (inBand.length === 0)
|
|
@@ -152,16 +159,38 @@ export function formatCarveReport(result) {
|
|
|
152
159
|
lines.push(`${bandLabel(band, cdk)} (${inBand.length})`);
|
|
153
160
|
for (const r of inBand) {
|
|
154
161
|
const target = r.mapsTo ? ` -> ${r.mapsTo}` : "";
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
const cell = cellWidth > 0 ? `${cells.get(r.address).padEnd(cellWidth)} ` : "";
|
|
163
|
+
const indent = " ".repeat(7 + (cellWidth > 0 ? cellWidth + 2 : 0));
|
|
164
|
+
lines.push(` ${String(r.score).padStart(3)} ${cell}${r.address}${target}`);
|
|
165
|
+
lines.push(`${indent}${reasons(r, cdk)}`);
|
|
157
166
|
for (const note of r.notes ?? [])
|
|
158
|
-
lines.push(
|
|
167
|
+
lines.push(`${indent}${note}`);
|
|
159
168
|
}
|
|
160
169
|
lines.push("");
|
|
161
170
|
}
|
|
162
171
|
lines.push(`Bands: 80-100 carve now | 50-79 carve with boundary edits | 0-49 leave in ${cdk ? "CDK" : "Terraform"}`);
|
|
172
|
+
if (cellWidth > 0) {
|
|
173
|
+
lines.push("Radius: resources+outputs that depend on it at any depth, dN the farthest hop; - none; " +
|
|
174
|
+
(cdk ? "xN across a stack boundary." : "? a module or unresolved count/for_each hides how many."));
|
|
175
|
+
}
|
|
163
176
|
return lines.join("\n").trimEnd();
|
|
164
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* The radius column (#2326): `3+1 d2` is three resources and one output that
|
|
180
|
+
* depend on the node, the farthest two hops away; `-` is nothing; `?` stands in
|
|
181
|
+
* for a count a module or unresolved `count` hides; ` x2` is how many sit
|
|
182
|
+
* across a stack boundary. Empty when the result carries no radius.
|
|
183
|
+
*/
|
|
184
|
+
function radiusCell(r) {
|
|
185
|
+
const radius = r.radius;
|
|
186
|
+
if (!radius)
|
|
187
|
+
return "";
|
|
188
|
+
if (radius.depth === 0)
|
|
189
|
+
return "-";
|
|
190
|
+
const n = (v) => (v === "unknown" ? "?" : String(v));
|
|
191
|
+
const cross = radius.crossStack !== undefined && radius.crossStack !== 0 ? ` x${n(radius.crossStack)}` : "";
|
|
192
|
+
return `${n(radius.resources)}+${radius.outputs} d${radius.depth}${cross}`;
|
|
193
|
+
}
|
|
165
194
|
function bandLabel(band, cdk) {
|
|
166
195
|
switch (band) {
|
|
167
196
|
case "clean leaf":
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The review report of `chant import` (#4398): the parser's diagnostics as
|
|
3
|
+
* SARIF (`--report <path>`), a summary on stderr, and the exit code under
|
|
4
|
+
* `--strict`. The shape follows `chant migrate`: a needs-review diagnostic is
|
|
5
|
+
* a `warning`, and `--strict` makes any open `warning` or `error` fail the
|
|
6
|
+
* run. An `info` diagnostic names something not carried that needs no
|
|
7
|
+
* decision, and never fails a run.
|
|
8
|
+
*/
|
|
9
|
+
import type { ImportDiagnostic } from "../../import/parser.js";
|
|
10
|
+
import type { LintDiagnostic } from "../../lint/rule.js";
|
|
11
|
+
/** Import diagnostics as lint diagnostics against `file`, the template that was imported. */
|
|
12
|
+
export declare function importDiagnosticsToLint(file: string, diagnostics: readonly ImportDiagnostic[]): LintDiagnostic[];
|
|
13
|
+
/** The SARIF document for a run. */
|
|
14
|
+
export declare function importSarif(file: string, diagnostics: readonly ImportDiagnostic[], version?: string): string;
|
|
15
|
+
/** Write the SARIF report; an unwritable path is returned as a message, not thrown. */
|
|
16
|
+
export declare function writeImportReport(path: string, file: string, diagnostics: readonly ImportDiagnostic[], version?: string): string | undefined;
|
|
17
|
+
/** Diagnostics that are open: everything but `info`. */
|
|
18
|
+
export declare function openDiagnostics(diagnostics: readonly ImportDiagnostic[]): ImportDiagnostic[];
|
|
19
|
+
/**
|
|
20
|
+
* The exit code for a finished import. An `error` always fails (a failed
|
|
21
|
+
* `--validate`); a `warning` fails under `--strict`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function importExitCode(diagnostics: readonly ImportDiagnostic[] | undefined, strict: boolean): number;
|
|
24
|
+
/** Counts by severity and rule, as the lines printed after an import. */
|
|
25
|
+
export declare function summarizeImportDiagnostics(diagnostics: readonly ImportDiagnostic[]): string;
|
|
26
|
+
//# sourceMappingURL=import-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import-report.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/import-report.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,6FAA6F;AAC7F,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,cAAc,EAAE,CAUhH;AAED,oCAAoC;AACpC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,gBAAgB,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5G;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,gBAAgB,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5I;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAE5F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAI5G;AAED,yEAAyE;AACzE,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,CAY3F"}
|