@intentius/chant 0.124.52 → 0.124.54
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/audit/discover.d.ts.map +1 -1
- package/dist/audit/discover.js +3 -1
- package/dist/behaviour.d.ts +1 -1
- package/dist/behaviour.d.ts.map +1 -1
- package/dist/capabilities/templates.d.ts +65 -0
- package/dist/capabilities/templates.d.ts.map +1 -0
- package/dist/capabilities/templates.js +193 -0
- package/dist/capabilities/templates.json +145 -0
- package/dist/change-set-graph.d.ts +35 -3
- package/dist/change-set-graph.d.ts.map +1 -1
- package/dist/change-set-graph.js +60 -9
- package/dist/change-set.d.ts +65 -7
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +23 -12
- package/dist/ci-identity.d.ts +7 -2
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +4 -1
- package/dist/cli/commands/import-index.d.ts +52 -0
- package/dist/cli/commands/import-index.d.ts.map +1 -0
- package/dist/cli/commands/import-index.js +226 -0
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +4 -2
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +11 -2
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +16 -3
- package/dist/cli/handlers/graph.d.ts.map +1 -1
- package/dist/cli/handlers/graph.js +22 -4
- package/dist/cli/handlers/index-cloud.d.ts +14 -0
- package/dist/cli/handlers/index-cloud.d.ts.map +1 -0
- package/dist/cli/handlers/index-cloud.js +22 -0
- package/dist/cli/handlers/index-diff.d.ts +18 -0
- package/dist/cli/handlers/index-diff.d.ts.map +1 -0
- package/dist/cli/handlers/index-diff.js +142 -0
- package/dist/cli/handlers/lifecycle-drift.d.ts +25 -0
- package/dist/cli/handlers/lifecycle-drift.d.ts.map +1 -0
- package/dist/cli/handlers/lifecycle-drift.js +64 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +188 -28
- package/dist/cli/handlers/misc.d.ts +9 -0
- package/dist/cli/handlers/misc.d.ts.map +1 -1
- package/dist/cli/handlers/misc.js +77 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +15 -2
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +89 -15
- package/dist/cli/handlers/query.d.ts.map +1 -1
- package/dist/cli/handlers/query.js +28 -4
- package/dist/cli/handlers/scenario.d.ts.map +1 -1
- package/dist/cli/handlers/scenario.js +8 -7
- package/dist/cli/handlers/search.d.ts +34 -4
- package/dist/cli/handlers/search.d.ts.map +1 -1
- package/dist/cli/handlers/search.js +216 -36
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +55 -1
- package/dist/cli/mcp/lifecycle-tools.d.ts.map +1 -1
- package/dist/cli/mcp/lifecycle-tools.js +3 -2
- package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
- package/dist/cli/mcp/resource-handlers.js +4 -3
- package/dist/cli/mcp/workspace-tools.js +1 -1
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +55 -2
- package/dist/cli/registry.d.ts +19 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/aws.d.ts +35 -0
- package/dist/cloud-lister/aws.d.ts.map +1 -0
- package/dist/cloud-lister/aws.js +203 -0
- package/dist/cloud-lister/azure.d.ts +34 -0
- package/dist/cloud-lister/azure.d.ts.map +1 -0
- package/dist/cloud-lister/azure.js +129 -0
- package/dist/cloud-lister/common.d.ts +40 -0
- package/dist/cloud-lister/common.d.ts.map +1 -0
- package/dist/cloud-lister/common.js +83 -0
- package/dist/cloud-lister/credentials.d.ts +50 -0
- package/dist/cloud-lister/credentials.d.ts.map +1 -0
- package/dist/cloud-lister/credentials.js +86 -0
- package/dist/cloud-lister/fakes.d.ts +27 -0
- package/dist/cloud-lister/fakes.d.ts.map +1 -0
- package/dist/cloud-lister/fakes.js +50 -0
- package/dist/cloud-lister/gcp.d.ts +42 -0
- package/dist/cloud-lister/gcp.d.ts.map +1 -0
- package/dist/cloud-lister/gcp.js +143 -0
- package/dist/cloud-lister/guard.d.ts +49 -0
- package/dist/cloud-lister/guard.d.ts.map +1 -0
- package/dist/cloud-lister/guard.js +103 -0
- package/dist/cloud-lister/ids.d.ts +23 -0
- package/dist/cloud-lister/ids.d.ts.map +1 -0
- package/dist/cloud-lister/ids.js +42 -0
- package/dist/cloud-lister/index.d.ts +67 -0
- package/dist/cloud-lister/index.d.ts.map +1 -0
- package/dist/cloud-lister/index.js +102 -0
- package/dist/cloud-lister/kubernetes.d.ts +64 -0
- package/dist/cloud-lister/kubernetes.d.ts.map +1 -0
- package/dist/cloud-lister/kubernetes.js +276 -0
- package/dist/cloud-lister/markers.d.ts +31 -0
- package/dist/cloud-lister/markers.d.ts.map +1 -0
- package/dist/cloud-lister/markers.js +73 -0
- package/dist/cloud-lister/mask.d.ts +31 -0
- package/dist/cloud-lister/mask.d.ts.map +1 -0
- package/dist/cloud-lister/mask.js +74 -0
- package/dist/cloud-lister/sigv4.d.ts +29 -0
- package/dist/cloud-lister/sigv4.d.ts.map +1 -0
- package/dist/cloud-lister/sigv4.js +54 -0
- package/dist/cloud-lister/transport.d.ts +55 -0
- package/dist/cloud-lister/transport.d.ts.map +1 -0
- package/dist/cloud-lister/transport.js +86 -0
- package/dist/cloud-lister/types.d.ts +121 -0
- package/dist/cloud-lister/types.d.ts.map +1 -0
- package/dist/cloud-lister/types.js +24 -0
- package/dist/components/capability-plugin-loader.d.ts.map +1 -1
- package/dist/components/capability-plugin-loader.js +6 -0
- package/dist/components/capability-plugin.d.ts +9 -0
- package/dist/components/capability-plugin.d.ts.map +1 -1
- package/dist/components/capability.d.ts +215 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +21 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +58 -14
- package/dist/components/declared-reads.d.ts +38 -0
- package/dist/components/declared-reads.d.ts.map +1 -0
- package/dist/components/declared-reads.js +131 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +4 -0
- package/dist/components/driver.d.ts +34 -1
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +66 -3
- package/dist/components/fan-out-run.d.ts +23 -1
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +82 -14
- package/dist/components/fan-out-support.d.ts +6 -0
- package/dist/components/fan-out-support.d.ts.map +1 -1
- package/dist/components/fan-out-support.js +4 -1
- package/dist/components/fan-out.d.ts +28 -0
- package/dist/components/fan-out.d.ts.map +1 -1
- package/dist/components/groups.d.ts +229 -0
- package/dist/components/groups.d.ts.map +1 -0
- package/dist/components/groups.js +760 -0
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +4 -0
- package/dist/components/plan-shape-conformance.d.ts +48 -0
- package/dist/components/plan-shape-conformance.d.ts.map +1 -0
- package/dist/components/plan-shape-conformance.js +122 -0
- package/dist/components/pr-run.d.ts +41 -4
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +209 -39
- package/dist/components/promote-rounds.d.ts +9 -0
- package/dist/components/promote-rounds.d.ts.map +1 -1
- package/dist/components/promote-rounds.js +23 -2
- package/dist/components/promote.d.ts +17 -0
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +36 -6
- package/dist/components/release-gate.d.ts +23 -1
- package/dist/components/release-gate.d.ts.map +1 -1
- package/dist/components/release-gate.js +97 -33
- package/dist/components/run-groups.d.ts +58 -0
- package/dist/components/run-groups.d.ts.map +1 -0
- package/dist/components/run-groups.js +78 -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 +6 -1
- package/dist/components/verbs/index.d.ts +1 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +1 -0
- package/dist/components/verbs/member-outputs.d.ts +187 -0
- package/dist/components/verbs/member-outputs.d.ts.map +1 -0
- package/dist/components/verbs/member-outputs.js +218 -0
- package/dist/config.d.ts +60 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -0
- package/dist/deep-observation.d.ts +1 -13
- package/dist/deep-observation.d.ts.map +1 -1
- package/dist/deep-observation.js +5 -22
- package/dist/drift-record.d.ts +542 -0
- package/dist/drift-record.d.ts.map +1 -0
- package/dist/drift-record.js +886 -0
- package/dist/engine-facts.d.ts +144 -0
- package/dist/engine-facts.d.ts.map +1 -0
- package/dist/engine-facts.js +14 -0
- package/dist/graph-ir.d.ts +153 -2
- package/dist/graph-ir.d.ts.map +1 -1
- package/dist/graph-ir.js +224 -6
- package/dist/graph-refs.d.ts +145 -0
- package/dist/graph-refs.d.ts.map +1 -1
- package/dist/graph-refs.js +305 -0
- package/dist/graph-schema/fixtures/adopt.json +15 -0
- package/dist/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
- package/dist/graph-schema/fixtures/index.json +68 -0
- package/dist/graph-schema/fixtures/plunge.engine-graph.json +158 -0
- package/dist/graph-schema/fixtures.d.ts +23 -0
- package/dist/graph-schema/fixtures.d.ts.map +1 -0
- package/dist/graph-schema/fixtures.js +246 -0
- package/dist/graph-schema/generate.d.ts +15 -0
- package/dist/graph-schema/generate.d.ts.map +1 -0
- package/dist/graph-schema/generate.js +267 -0
- package/dist/graph-schema/graph.schema.json +1387 -0
- package/dist/health.schema.json +2 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/instance-nodes.d.ts +159 -0
- package/dist/instance-nodes.d.ts.map +1 -0
- package/dist/instance-nodes.js +231 -0
- package/dist/lexicon.d.ts +72 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/adoption-file.d.ts +56 -0
- package/dist/lifecycle/adoption-file.d.ts.map +1 -0
- package/dist/lifecycle/adoption-file.js +123 -0
- package/dist/lifecycle/cloud-index.d.ts +186 -0
- package/dist/lifecycle/cloud-index.d.ts.map +1 -0
- package/dist/lifecycle/cloud-index.js +618 -0
- package/dist/lifecycle/derive-edges.d.ts +59 -0
- package/dist/lifecycle/derive-edges.d.ts.map +1 -0
- package/dist/lifecycle/derive-edges.js +126 -0
- package/dist/lifecycle/git.d.ts +10 -9
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +7 -1
- package/dist/lifecycle/identity-match.d.ts +133 -0
- package/dist/lifecycle/identity-match.d.ts.map +1 -0
- package/dist/lifecycle/identity-match.js +147 -0
- package/dist/lifecycle/index-diff.d.ts +224 -0
- package/dist/lifecycle/index-diff.d.ts.map +1 -0
- package/dist/lifecycle/index-diff.js +327 -0
- package/dist/lifecycle/index-document.d.ts +130 -0
- package/dist/lifecycle/index-document.d.ts.map +1 -0
- package/dist/lifecycle/index-document.js +189 -0
- package/dist/lifecycle/index-drift.d.ts +121 -0
- package/dist/lifecycle/index-drift.d.ts.map +1 -0
- package/dist/lifecycle/index-drift.js +178 -0
- package/dist/lifecycle/index-import.d.ts +168 -0
- package/dist/lifecycle/index-import.d.ts.map +1 -0
- package/dist/lifecycle/index-import.js +515 -0
- package/dist/lifecycle/index-join.d.ts +129 -0
- package/dist/lifecycle/index-join.d.ts.map +1 -0
- package/dist/lifecycle/index-join.js +248 -0
- package/dist/lifecycle/index.d.ts +4 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/index.js +4 -0
- package/dist/lifecycle/observation-baseline.d.ts +61 -21
- package/dist/lifecycle/observation-baseline.d.ts.map +1 -1
- package/dist/lifecycle/observation-baseline.js +144 -19
- package/dist/lifecycle/observe.d.ts.map +1 -1
- package/dist/lifecycle/observe.js +6 -1
- package/dist/lifecycle/query.d.ts +45 -4
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +89 -7
- package/dist/lifecycle/replay.d.ts +10 -3
- package/dist/lifecycle/replay.d.ts.map +1 -1
- package/dist/lifecycle/replay.js +10 -6
- package/dist/lifecycle/scenario.d.ts +4 -3
- package/dist/lifecycle/scenario.d.ts.map +1 -1
- package/dist/lifecycle/snapshot-store-fake.d.ts +9 -0
- package/dist/lifecycle/snapshot-store-fake.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store-fake.js +21 -0
- package/dist/lifecycle/snapshot-store-s3.d.ts +102 -0
- package/dist/lifecycle/snapshot-store-s3.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store-s3.js +254 -0
- package/dist/lifecycle/snapshot-store.d.ts +170 -0
- package/dist/lifecycle/snapshot-store.d.ts.map +1 -0
- package/dist/lifecycle/snapshot-store.js +832 -0
- package/dist/lifecycle/snapshot.d.ts +11 -0
- package/dist/lifecycle/snapshot.d.ts.map +1 -1
- package/dist/lifecycle/snapshot.js +18 -5
- package/dist/lifecycle/type-listing.d.ts +148 -0
- package/dist/lifecycle/type-listing.d.ts.map +1 -0
- package/dist/lifecycle/type-listing.js +166 -0
- package/dist/lint/component-checks.d.ts +15 -1
- package/dist/lint/component-checks.d.ts.map +1 -1
- package/dist/lint/component-checks.js +1 -0
- package/dist/lint/presets/relaxed.json +2 -1
- package/dist/lint/presets/strict.json +2 -1
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts +4 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.d.ts.map +1 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/fail/dns.component.js +13 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts +4 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.d.ts.map +1 -0
- package/dist/lint/rules/__fixtures__/comp/comp008/pass/dns.component.js +8 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts +33 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.d.ts.map +1 -0
- package/dist/lint/rules/comp/comp008-applies-signal-only-root.js +123 -0
- package/dist/lint/rules/comp/index.d.ts +2 -1
- package/dist/lint/rules/comp/index.d.ts.map +1 -1
- package/dist/lint/rules/comp/index.js +4 -1
- package/dist/observation.d.ts +19 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +18 -1
- package/dist/op/activities/activity-contracts.d.ts +1 -1
- package/dist/op/activities/activity-contracts.js +1 -1
- package/dist/op/activities/change-set.d.ts +6 -4
- package/dist/op/activities/change-set.d.ts.map +1 -1
- package/dist/op/activities/change-set.js +4 -2
- package/dist/op/activity-failure.d.ts +27 -0
- package/dist/op/activity-failure.d.ts.map +1 -1
- package/dist/op/activity-failure.js +31 -0
- package/dist/op/index.d.ts +2 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/local-executor.d.ts +5 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +22 -8
- package/dist/pr-loop.d.ts +56 -1
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +51 -1
- package/dist/pulumi-urn.d.ts +101 -0
- package/dist/pulumi-urn.d.ts.map +1 -0
- package/dist/pulumi-urn.js +131 -0
- package/dist/release-floors.d.ts +23 -0
- package/dist/release-floors.d.ts.map +1 -0
- package/dist/release-floors.js +22 -0
- package/dist/sensitive-key.d.ts +23 -0
- package/dist/sensitive-key.d.ts.map +1 -0
- package/dist/sensitive-key.js +31 -0
- package/dist/wave-runtime.mjs +234 -234
- package/dist/workspace/adoption-report.d.ts +53 -0
- package/dist/workspace/adoption-report.d.ts.map +1 -0
- package/dist/workspace/adoption-report.js +76 -0
- package/dist/workspace/capabilities-contract.d.ts +7 -0
- package/dist/workspace/capabilities-contract.d.ts.map +1 -1
- package/dist/workspace/capabilities-contract.js +2 -1
- package/dist/workspace/capabilities.schema.json +98 -0
- package/dist/workspace/change-set.schema.json +42 -3
- package/dist/workspace/ci-cloud-identity.d.ts +13 -1
- package/dist/workspace/ci-cloud-identity.d.ts.map +1 -1
- package/dist/workspace/ci-cloud-identity.js +30 -1
- package/dist/workspace/compose-graph.d.ts +10 -1
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/compose-graph.js +6 -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 +6 -1
- package/dist/workspace/drift-cli.d.ts +81 -0
- package/dist/workspace/drift-cli.d.ts.map +1 -0
- package/dist/workspace/drift-cli.js +317 -0
- package/dist/workspace/drift.schema.json +672 -0
- package/dist/workspace/graph-cli.d.ts +2 -0
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/graph-cli.js +3 -0
- package/dist/workspace/graph.schema.json +72 -0
- package/dist/workspace/init.d.ts +5 -1
- package/dist/workspace/init.d.ts.map +1 -1
- package/dist/workspace/init.js +55 -9
- package/dist/workspace/ledger.schema.json +1 -1
- package/dist/workspace/nested-graph.d.ts.map +1 -1
- package/dist/workspace/nested-graph.js +2 -0
- package/dist/workspace/pr-report.schema.json +51 -2
- package/dist/workspace/promote-waves.d.ts +112 -0
- package/dist/workspace/promote-waves.d.ts.map +1 -0
- package/dist/workspace/promote-waves.js +290 -0
- package/dist/workspace/promote.d.ts +84 -2
- package/dist/workspace/promote.d.ts.map +1 -1
- package/dist/workspace/promote.js +347 -61
- package/dist/workspace/reason-codes.d.ts +12 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +14 -0
- package/dist/workspace/search-contract.d.ts +3 -3
- package/dist/workspace/search-contract.d.ts.map +1 -1
- package/dist/workspace/search-contract.js +2 -0
- package/dist/workspace/search.schema.json +103 -5
- package/package.json +14 -1
- package/src/__fixtures__/drift-record/README.md +58 -0
- package/src/__fixtures__/drift-record/choudoufu-cone.ndjson +4 -0
- package/src/__fixtures__/drift-record/choudoufu-resource.ndjson +3 -0
- package/src/__fixtures__/drift-record/component-status-ledger.json +65 -0
- package/src/__fixtures__/drift-record/component-status.json +91 -0
- package/src/__fixtures__/drift-record/deep-diff.json +259 -0
- package/src/__fixtures__/drift-record/lifecycle-diff-live.json +825 -0
- package/src/__fixtures__/drift-record/live-diff.json +125 -0
- package/src/audit/discover.e2e.test.ts +14 -0
- package/src/audit/discover.ts +3 -1
- package/src/behaviour.ts +1 -1
- package/src/capabilities/templates.json +145 -0
- package/src/capabilities/templates.test.ts +212 -0
- package/src/capabilities/templates.ts +204 -0
- package/src/change-set-bundle.test.ts +83 -0
- package/src/change-set-graph.ts +80 -9
- package/src/change-set.test.ts +24 -0
- package/src/change-set.ts +77 -14
- package/src/ci-identity-targets.test.ts +23 -0
- package/src/ci-identity.ts +10 -4
- package/src/cli/commands/import-index.test.ts +117 -0
- package/src/cli/commands/import-index.ts +265 -0
- package/src/cli/commands/lint.ts +4 -2
- package/src/cli/handlers/components.test.ts +9 -0
- package/src/cli/handlers/components.ts +12 -2
- package/src/cli/handlers/fan-out.ts +17 -3
- package/src/cli/handlers/graph.test.ts +42 -0
- package/src/cli/handlers/graph.ts +26 -4
- package/src/cli/handlers/index-cloud.ts +32 -0
- package/src/cli/handlers/index-diff.test.ts +68 -0
- package/src/cli/handlers/index-diff.ts +146 -0
- package/src/cli/handlers/ledger-root-member.test.ts +161 -0
- package/src/cli/handlers/lifecycle-drift.ts +68 -0
- package/src/cli/handlers/lifecycle.test.ts +33 -11
- package/src/cli/handlers/lifecycle.ts +205 -30
- package/src/cli/handlers/misc.ts +73 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +37 -2
- package/src/cli/handlers/pr.ts +14 -2
- package/src/cli/handlers/promote.test.ts +64 -0
- package/src/cli/handlers/promote.ts +81 -6
- package/src/cli/handlers/query.ts +27 -4
- package/src/cli/handlers/run-declared-reads-cli.test.ts +187 -0
- package/src/cli/handlers/run-groups-cli.test.ts +229 -0
- package/src/cli/handlers/scenario.test.ts +13 -0
- package/src/cli/handlers/scenario.ts +8 -7
- package/src/cli/handlers/search-index.test.ts +255 -0
- package/src/cli/handlers/search-json.test.ts +1 -1
- package/src/cli/handlers/search-ownership.test.ts +194 -0
- package/src/cli/handlers/search.ts +271 -38
- package/src/cli/main.test.ts +7 -0
- package/src/cli/main.ts +56 -1
- package/src/cli/mcp/lifecycle-tools.ts +3 -2
- package/src/cli/mcp/resource-handlers.ts +4 -3
- package/src/cli/mcp/workspace-tools.ts +1 -1
- package/src/cli/parse-args.ts +40 -2
- package/src/cli/registry.ts +19 -1
- package/src/cloud-lister/aws.test.ts +202 -0
- package/src/cloud-lister/aws.ts +226 -0
- package/src/cloud-lister/azure.test.ts +132 -0
- package/src/cloud-lister/azure.ts +142 -0
- package/src/cloud-lister/common.ts +115 -0
- package/src/cloud-lister/credentials.ts +110 -0
- package/src/cloud-lister/fakes.ts +66 -0
- package/src/cloud-lister/gcp.test.ts +121 -0
- package/src/cloud-lister/gcp.ts +159 -0
- package/src/cloud-lister/guard.test.ts +198 -0
- package/src/cloud-lister/guard.ts +111 -0
- package/src/cloud-lister/ids.ts +54 -0
- package/src/cloud-lister/index.ts +134 -0
- package/src/cloud-lister/kubernetes.test.ts +160 -0
- package/src/cloud-lister/kubernetes.ts +284 -0
- package/src/cloud-lister/markers.ts +74 -0
- package/src/cloud-lister/mask.ts +77 -0
- package/src/cloud-lister/shape.test.ts +81 -0
- package/src/cloud-lister/sigv4.ts +70 -0
- package/src/cloud-lister/transport.ts +118 -0
- package/src/cloud-lister/types.ts +135 -0
- package/src/components/capability-plugin-loader.ts +4 -0
- package/src/components/capability-plugin.ts +10 -0
- package/src/components/capability.ts +229 -0
- package/src/components/cli-support.ts +70 -14
- package/src/components/declared-reads.test.ts +103 -0
- package/src/components/declared-reads.ts +134 -0
- package/src/components/deploy-units.ts +4 -0
- package/src/components/driver.ts +89 -4
- package/src/components/fan-out-run.ts +95 -15
- package/src/components/fan-out-support.ts +10 -1
- package/src/components/fan-out.ts +30 -0
- package/src/components/groups.test.ts +320 -0
- package/src/components/groups.ts +880 -0
- package/src/components/index.ts +42 -0
- package/src/components/plan-shape-conformance.ts +130 -0
- package/src/components/pr-env-run-bundle.test.ts +2 -0
- package/src/components/pr-run.test.ts +516 -3
- package/src/components/pr-run.ts +231 -41
- package/src/components/promote-rounds.ts +25 -2
- package/src/components/promote.ts +55 -5
- package/src/components/registry.test.ts +1 -1
- package/src/components/release-gate.ts +115 -30
- package/src/components/release-groups.test.ts +362 -0
- package/src/components/run-groups.ts +113 -0
- package/src/components/starter-plugin.ts +6 -0
- package/src/components/verbs/index.ts +1 -0
- package/src/components/verbs/member-outputs.test.ts +205 -0
- package/src/components/verbs/member-outputs.ts +308 -0
- package/src/config.ts +44 -0
- package/src/deep-observation.ts +5 -23
- package/src/drift-record.test.ts +596 -0
- package/src/drift-record.ts +1206 -0
- package/src/engine-facts.guard.test.ts +111 -0
- package/src/engine-facts.test.ts +178 -0
- package/src/engine-facts.ts +154 -0
- package/src/gated-waves-bundle.test.ts +2 -0
- package/src/graph-ir-live.test.ts +92 -0
- package/src/graph-ir.ts +317 -7
- package/src/graph-refs.ts +416 -0
- package/src/graph-schema/fixtures/adopt.json +15 -0
- package/src/graph-schema/fixtures/choudoufu.engine-graph.json +169 -0
- package/src/graph-schema/fixtures/index.json +68 -0
- package/src/graph-schema/fixtures/plunge.engine-graph.json +158 -0
- package/src/graph-schema/fixtures.ts +267 -0
- package/src/graph-schema/generate.ts +263 -0
- package/src/graph-schema/graph-schema.test.ts +153 -0
- package/src/graph-schema/graph.schema.json +1387 -0
- package/src/health.schema.json +2 -1
- package/src/identity.ts +2 -0
- package/src/index.ts +2 -0
- package/src/instance-nodes.ts +288 -0
- package/src/lexicon.ts +76 -0
- package/src/lifecycle/__fixtures__/index-diff/20261026T120000Z-aaaaaaaaaaaa.json +149 -0
- package/src/lifecycle/__fixtures__/index-diff/20261026T130000Z-bbbbbbbbbbbb.json +127 -0
- package/src/lifecycle/adoption-file.test.ts +100 -0
- package/src/lifecycle/adoption-file.ts +154 -0
- package/src/lifecycle/cloud-index.test.ts +517 -0
- package/src/lifecycle/cloud-index.ts +736 -0
- package/src/lifecycle/derive-edges.test.ts +193 -0
- package/src/lifecycle/derive-edges.ts +182 -0
- package/src/lifecycle/git.ts +10 -4
- package/src/lifecycle/identity-match.test.ts +308 -0
- package/src/lifecycle/identity-match.ts +257 -0
- package/src/lifecycle/index-diff.test.ts +198 -0
- package/src/lifecycle/index-diff.ts +476 -0
- package/src/lifecycle/index-document.test.ts +64 -0
- package/src/lifecycle/index-document.ts +299 -0
- package/src/lifecycle/index-drift.test.ts +191 -0
- package/src/lifecycle/index-drift.ts +304 -0
- package/src/lifecycle/index-import.test.ts +255 -0
- package/src/lifecycle/index-import.ts +634 -0
- package/src/lifecycle/index-join.test.ts +250 -0
- package/src/lifecycle/index-join.ts +304 -0
- package/src/lifecycle/index-store-load-bearing.test.ts +187 -0
- package/src/lifecycle/index.ts +4 -0
- package/src/lifecycle/member-ledger.test.ts +25 -7
- package/src/lifecycle/observation-baseline.test.ts +72 -1
- package/src/lifecycle/observation-baseline.ts +190 -27
- package/src/lifecycle/observe.ts +6 -1
- package/src/lifecycle/query.test.ts +69 -1
- package/src/lifecycle/query.ts +103 -10
- package/src/lifecycle/replay.test.ts +9 -5
- package/src/lifecycle/replay.ts +9 -5
- package/src/lifecycle/scenario.ts +4 -3
- package/src/lifecycle/snapshot-store-fake.ts +29 -0
- package/src/lifecycle/snapshot-store-s3.ts +316 -0
- package/src/lifecycle/snapshot-store.test.ts +385 -0
- package/src/lifecycle/snapshot-store.ts +981 -0
- package/src/lifecycle/snapshot.test.ts +13 -0
- package/src/lifecycle/snapshot.ts +23 -6
- package/src/lifecycle/type-listing.test.ts +166 -0
- package/src/lifecycle/type-listing.ts +309 -0
- package/src/lint/component-checks.ts +17 -1
- package/src/lint/config.test.ts +3 -0
- package/src/lint/presets/relaxed.json +2 -1
- package/src/lint/presets/strict.json +2 -1
- package/src/lint/rules/__fixtures__/comp/comp008/fail/dns.component.ts +15 -0
- package/src/lint/rules/__fixtures__/comp/comp008/pass/dns.component.ts +10 -0
- package/src/lint/rules/comp/comp.test.ts +2 -1
- package/src/lint/rules/comp/comp008-applies-signal-only-root.ts +121 -0
- package/src/lint/rules/comp/comp008.test.ts +77 -0
- package/src/lint/rules/comp/index.ts +4 -1
- package/src/observation-edges.test.ts +33 -0
- package/src/observation.ts +36 -1
- package/src/op/activities/activity-contracts.ts +1 -1
- package/src/op/activities/change-set.ts +8 -5
- package/src/op/activity-failure.ts +36 -0
- package/src/op/index.ts +2 -1
- package/src/op/local-executor.test.ts +80 -0
- package/src/op/local-executor.ts +27 -9
- package/src/pr-loop-bundle.test.ts +5 -2
- package/src/pr-loop.test.ts +43 -0
- package/src/pr-loop.ts +111 -2
- package/src/pulumi-urn.ts +151 -0
- package/src/release-floors.ts +22 -0
- package/src/sensitive-key.ts +34 -0
- package/src/workspace/adoption-report.test.ts +61 -0
- package/src/workspace/adoption-report.ts +103 -0
- package/src/workspace/capabilities-contract.test.ts +4 -0
- package/src/workspace/capabilities-contract.ts +9 -1
- package/src/workspace/capabilities.schema.json +98 -0
- package/src/workspace/change-set.schema.json +42 -3
- package/src/workspace/ci-cloud-identity.ts +31 -1
- package/src/workspace/compose-graph.test.ts +12 -0
- package/src/workspace/compose-graph.ts +12 -1
- package/src/workspace/conformance/conformance.e2e.test.ts +2 -1
- package/src/workspace/conformance/index.ts +6 -1
- package/src/workspace/drift-cli.test.ts +65 -0
- package/src/workspace/drift-cli.ts +365 -0
- package/src/workspace/drift.schema.json +672 -0
- package/src/workspace/graph-cli.ts +5 -0
- package/src/workspace/graph.schema.json +72 -0
- package/src/workspace/init.test.ts +38 -1
- package/src/workspace/init.ts +50 -8
- package/src/workspace/intent-gaps.test.ts +18 -2
- package/src/workspace/ledger.schema.json +1 -1
- package/src/workspace/nested-graph.ts +1 -0
- package/src/workspace/pr-report.schema.json +51 -2
- package/src/workspace/promote-waves.test.ts +296 -0
- package/src/workspace/promote-waves.ts +340 -0
- package/src/workspace/promote.test.ts +158 -4
- package/src/workspace/promote.ts +398 -57
- package/src/workspace/reason-codes.test.ts +4 -1
- package/src/workspace/reason-codes.ts +14 -0
- package/src/workspace/search-contract.ts +2 -0
- package/src/workspace/search.schema.json +103 -5
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* behold#1029: read-only by construction.
|
|
3
|
+
*
|
|
4
|
+
* Every request the lister makes is a {@link WireCall}, and every WireCall
|
|
5
|
+
* goes through {@link assertReadCall} before anything reaches the network
|
|
6
|
+
* (packages/core/src/cloud-lister/transport.ts is the only sender). The check classifies the
|
|
7
|
+
* call from what would go on the wire (method, path, `X-Amz-Target`), never
|
|
8
|
+
* from a label the caller attaches, and admits only the operations in
|
|
9
|
+
* {@link READ_OPERATIONS}:
|
|
10
|
+
*
|
|
11
|
+
* - aws: Cloud Control `ListResources` (a POST, but the JSON protocol's only
|
|
12
|
+
* verb; the target header names the operation);
|
|
13
|
+
* - azure: Resource Graph's query, `POST /providers/Microsoft.ResourceGraph/resources`
|
|
14
|
+
* (a read that takes its KQL in the body);
|
|
15
|
+
* - gcp: Cloud Asset `searchAllResources`, a GET. Nothing under
|
|
16
|
+
* `serviceusage` is admitted, so the lister cannot enable the Cloud Asset
|
|
17
|
+
* API on a project (#1029: "nothing is enabled for the person");
|
|
18
|
+
* - kubernetes: GET discovery (`/api`, `/apis`, `/api/v1`, `/apis/<g>/<v>`)
|
|
19
|
+
* and GET collection lists, never `watch`.
|
|
20
|
+
*
|
|
21
|
+
* packages/core/src/cloud-lister/guard.test.ts holds the allowlist to exactly this set and
|
|
22
|
+
* shows a mutating call of each substrate refused.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { Substrate } from "./types";
|
|
26
|
+
|
|
27
|
+
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
28
|
+
|
|
29
|
+
/** One HTTP request as it would be sent. */
|
|
30
|
+
export interface WireCall {
|
|
31
|
+
substrate: Substrate;
|
|
32
|
+
method: HttpMethod;
|
|
33
|
+
url: string;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
body?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The only operations the lister may send, by substrate. */
|
|
39
|
+
export const READ_OPERATIONS: Readonly<Record<Substrate, readonly string[]>> = {
|
|
40
|
+
aws: ["cloudcontrol:ListResources"],
|
|
41
|
+
azure: ["resourcegraph:resources"],
|
|
42
|
+
gcp: ["cloudasset:searchAllResources"],
|
|
43
|
+
kubernetes: ["k8s:discovery", "k8s:list"],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export class MutatingCallRefused extends Error {
|
|
47
|
+
constructor(
|
|
48
|
+
readonly call: Pick<WireCall, "substrate" | "method" | "url">,
|
|
49
|
+
readonly operation: string,
|
|
50
|
+
) {
|
|
51
|
+
super(`chant's cloud lister refused ${call.method} ${call.url} (${operation}): only ${READ_OPERATIONS[call.substrate].join(", ")} may be sent`);
|
|
52
|
+
this.name = "MutatingCallRefused";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function header(headers: Record<string, string>, name: string): string | undefined {
|
|
57
|
+
const lower = name.toLowerCase();
|
|
58
|
+
for (const [k, v] of Object.entries(headers)) if (k.toLowerCase() === lower) return v;
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The operation a call performs, read off the wire. Anything this cannot
|
|
64
|
+
* name precisely comes back as `<substrate>:unknown:<detail>`, which no
|
|
65
|
+
* allowlist entry matches.
|
|
66
|
+
*/
|
|
67
|
+
export function classifyCall(call: WireCall): string {
|
|
68
|
+
const url = new URL(call.url);
|
|
69
|
+
const path = url.pathname;
|
|
70
|
+
switch (call.substrate) {
|
|
71
|
+
case "aws": {
|
|
72
|
+
const target = header(call.headers, "x-amz-target") ?? "";
|
|
73
|
+
const m = /^CloudApiService\.([A-Za-z]+)$/.exec(target);
|
|
74
|
+
if (call.method === "POST" && m) return `cloudcontrol:${m[1]}`;
|
|
75
|
+
return `aws:unknown:${call.method} ${target || path}`;
|
|
76
|
+
}
|
|
77
|
+
case "azure": {
|
|
78
|
+
if (call.method === "POST" && /\/providers\/microsoft\.resourcegraph\/resources$/i.test(path)) {
|
|
79
|
+
return "resourcegraph:resources";
|
|
80
|
+
}
|
|
81
|
+
return `azure:unknown:${call.method} ${path}`;
|
|
82
|
+
}
|
|
83
|
+
case "gcp": {
|
|
84
|
+
const m = /\/v1\/(projects|folders|organizations)\/[^/:]+:([A-Za-z]+)$/.exec(path);
|
|
85
|
+
if (call.method === "GET" && m && m[2] === "searchAllResources" && !/serviceusage/i.test(url.hostname + path)) {
|
|
86
|
+
return "cloudasset:searchAllResources";
|
|
87
|
+
}
|
|
88
|
+
return `gcp:unknown:${call.method} ${path}`;
|
|
89
|
+
}
|
|
90
|
+
case "kubernetes": {
|
|
91
|
+
if (call.method !== "GET") return `k8s:unknown:${call.method} ${path}`;
|
|
92
|
+
const watch = url.searchParams.get("watch");
|
|
93
|
+
if (watch !== null && watch !== "false" && watch !== "0") return `k8s:watch:${path}`;
|
|
94
|
+
if (/^\/(api|apis)\/?$/.test(path)) return "k8s:discovery";
|
|
95
|
+
if (/^\/api\/v1\/?$/.test(path)) return "k8s:discovery";
|
|
96
|
+
if (/^\/apis\/[^/]+\/[^/]+\/?$/.test(path)) return "k8s:discovery";
|
|
97
|
+
// A collection: /api/v1/<plural> or /apis/<g>/<v>/<plural>. A named
|
|
98
|
+
// object, a subresource (logs, exec, proxy) or a namespaced path is not.
|
|
99
|
+
if (/^\/api\/v1\/[a-z0-9.-]+$/.test(path)) return "k8s:list";
|
|
100
|
+
if (/^\/apis\/[^/]+\/[^/]+\/[a-z0-9.-]+$/.test(path)) return "k8s:list";
|
|
101
|
+
return `k8s:unknown:${call.method} ${path}`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Throws {@link MutatingCallRefused} unless the call is one of {@link READ_OPERATIONS}. */
|
|
107
|
+
export function assertReadCall(call: WireCall): string {
|
|
108
|
+
const operation = classifyCall(call);
|
|
109
|
+
if (!READ_OPERATIONS[call.substrate].includes(operation)) throw new MutatingCallRefused(call, operation);
|
|
110
|
+
return operation;
|
|
111
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* behold#1029: a listed node's id, ruled on behold#1025 (Q2):
|
|
3
|
+
* `<substrate>/<scopeId>/<location>/<listedType>/<nativeId>`.
|
|
4
|
+
*
|
|
5
|
+
* Several of those parts carry `/` of their own: a Kubernetes type
|
|
6
|
+
* (`apps/v1/Deployment`), an ARM type (`microsoft.storage/storageaccounts`),
|
|
7
|
+
* and most native ids (an ARM id, `namespace/name`). The id stays readable and
|
|
8
|
+
* parses back by escaping `%` and `/` in the first four parts only. The native
|
|
9
|
+
* id is last, so everything after the fourth separator is it, unescaped: the
|
|
10
|
+
* exact string the aws matcher (chant#4523) compares with `declaredIdentifier`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { Substrate } from "./types";
|
|
14
|
+
|
|
15
|
+
function escapeSegment(s: string): string {
|
|
16
|
+
return s.replace(/%/g, "%25").replace(/\//g, "%2F");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function unescapeSegment(s: string): string {
|
|
20
|
+
return s.replace(/%2F/gi, "/").replace(/%25/g, "%");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ListedNodeIdParts {
|
|
24
|
+
substrate: Substrate;
|
|
25
|
+
scopeId: string;
|
|
26
|
+
location: string;
|
|
27
|
+
listedType: string;
|
|
28
|
+
nativeId: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function listedNodeId(parts: ListedNodeIdParts): string {
|
|
32
|
+
return [
|
|
33
|
+
escapeSegment(parts.substrate),
|
|
34
|
+
escapeSegment(parts.scopeId),
|
|
35
|
+
escapeSegment(parts.location),
|
|
36
|
+
escapeSegment(parts.listedType),
|
|
37
|
+
parts.nativeId,
|
|
38
|
+
].join("/");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** The parts back from an id {@link listedNodeId} wrote; `undefined` for anything else. */
|
|
42
|
+
export function parseListedNodeId(id: string): ListedNodeIdParts | undefined {
|
|
43
|
+
const parts: string[] = [];
|
|
44
|
+
let rest = id;
|
|
45
|
+
for (let i = 0; i < 4; i++) {
|
|
46
|
+
const at = rest.indexOf("/");
|
|
47
|
+
if (at < 0) return undefined;
|
|
48
|
+
parts.push(unescapeSegment(rest.slice(0, at)));
|
|
49
|
+
rest = rest.slice(at + 1);
|
|
50
|
+
}
|
|
51
|
+
const [substrate, scopeId, location, listedType] = parts;
|
|
52
|
+
if (substrate !== "aws" && substrate !== "azure" && substrate !== "gcp" && substrate !== "kubernetes") return undefined;
|
|
53
|
+
return { substrate, scopeId, location, listedType, nativeId: rest };
|
|
54
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read-only cloud lister `chant index` runs (chant#4532; built as
|
|
3
|
+
* behold#1029 and moved here on the ruling that every model lives in chant,
|
|
4
|
+
* https://github.com/INTENTIUS/behold/issues/1024#issuecomment-6433236820).
|
|
5
|
+
*
|
|
6
|
+
* One call lists one substrate and one account, subscription, project or
|
|
7
|
+
* cluster (behold#1025 ruling Q6) and returns a {@link ListingResult}: the
|
|
8
|
+
* design's listing-result source shape, which chant's `typeListing`
|
|
9
|
+
* (chant#4521) types into an `IndexDocument`. It has no command of its own
|
|
10
|
+
* (`chant index` and `behold index` both reach it through
|
|
11
|
+
* ../lifecycle/cloud-index.ts), reads no project or configuration, and works
|
|
12
|
+
* in an empty directory.
|
|
13
|
+
*
|
|
14
|
+
* Read-only by construction: no cloud SDK client is built. Every request is
|
|
15
|
+
* a plain HTTP call through one {@link Transport}, which refuses anything
|
|
16
|
+
* outside the read allowlist (packages/core/src/cloud-lister/guard.ts) and, when the run
|
|
17
|
+
* names an endpoint, anything not sent to that endpoint's origin. There is
|
|
18
|
+
* no estate, no record store and no write call.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { sortResult, type ListerContext } from "./common";
|
|
22
|
+
import { listAws, type AwsTarget } from "./aws";
|
|
23
|
+
import { listAzure, type AzureTarget } from "./azure";
|
|
24
|
+
import { listGcp, type GcpTarget } from "./gcp";
|
|
25
|
+
import { listKubernetes, type KubernetesTarget } from "./kubernetes";
|
|
26
|
+
import { sdkCredentialChains, type CredentialChains } from "./credentials";
|
|
27
|
+
import { Transport, type Fetcher, type TlsOptions, type TransportOptions } from "./transport";
|
|
28
|
+
import type { CloudScope, ListingResult } from "./types";
|
|
29
|
+
|
|
30
|
+
export type { CloudScope, ListingResult, ListedResource, CoverageEntry, IndexNote, CloudId, ListedFacts, MarkerFact, Substrate, TagFilter } from "./types";
|
|
31
|
+
export type { AwsTarget } from "./aws";
|
|
32
|
+
export type { AzureTarget } from "./azure";
|
|
33
|
+
export type { GcpTarget } from "./gcp";
|
|
34
|
+
export type { KubernetesTarget } from "./kubernetes";
|
|
35
|
+
export { kubeTargetFromKubeconfig } from "./kubernetes";
|
|
36
|
+
export { ListerConfigError } from "./credentials";
|
|
37
|
+
export { MutatingCallRefused, READ_OPERATIONS } from "./guard";
|
|
38
|
+
export { OriginRefused } from "./transport";
|
|
39
|
+
export { listedNodeId, parseListedNodeId } from "./ids";
|
|
40
|
+
|
|
41
|
+
/** Where and how to reach the scope's substrate. The variant must match `scope.substrate`. */
|
|
42
|
+
export type SubstrateTarget =
|
|
43
|
+
| { substrate: "aws"; aws: AwsTarget }
|
|
44
|
+
| { substrate: "azure"; azure: AzureTarget }
|
|
45
|
+
| { substrate: "gcp"; gcp: GcpTarget }
|
|
46
|
+
| { substrate: "kubernetes"; kubernetes: KubernetesTarget };
|
|
47
|
+
|
|
48
|
+
export interface ListOptions {
|
|
49
|
+
/** Replaces the network (tests). */
|
|
50
|
+
fetcher?: Fetcher;
|
|
51
|
+
/** Replaces the real-cloud SDK credential chains (tests prove none is touched with an endpoint). */
|
|
52
|
+
chains?: CredentialChains;
|
|
53
|
+
now?: () => Date;
|
|
54
|
+
/** Throttle backoff, in ms; tests pass `[]`. */
|
|
55
|
+
retryDelays?: readonly number[];
|
|
56
|
+
/** The caller's version (chant's, or behold's when behold calls in), for `source.version`. */
|
|
57
|
+
version?: string;
|
|
58
|
+
/** Sees every call that passed the guard (tests record with it). */
|
|
59
|
+
onSend?: TransportOptions["onSend"];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function sortedUnique(values: readonly string[] | "*"): readonly string[] | "*" {
|
|
63
|
+
if (values === "*") return "*";
|
|
64
|
+
return [...new Set(values)].sort();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** The scope as the stamp records it: lists sorted and deduplicated (#1025 "Stamp"). */
|
|
68
|
+
export function canonicalScope(scope: CloudScope): CloudScope {
|
|
69
|
+
return {
|
|
70
|
+
substrate: scope.substrate,
|
|
71
|
+
scopeId: scope.scopeId,
|
|
72
|
+
locations: sortedUnique(scope.locations),
|
|
73
|
+
types: sortedUnique(scope.types),
|
|
74
|
+
...(scope.tagFilter && Object.keys(scope.tagFilter).length > 0
|
|
75
|
+
? { tagFilter: Object.fromEntries(Object.entries(scope.tagFilter).sort(([a], [b]) => (a < b ? -1 : 1))) }
|
|
76
|
+
: {}),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function endpointAndTls(target: SubstrateTarget): { endpoint?: string; tls?: TlsOptions } {
|
|
81
|
+
switch (target.substrate) {
|
|
82
|
+
case "aws":
|
|
83
|
+
return { endpoint: target.aws.endpoint, tls: target.aws.tls };
|
|
84
|
+
case "azure":
|
|
85
|
+
return { endpoint: target.azure.endpoint, tls: target.azure.tls };
|
|
86
|
+
case "gcp":
|
|
87
|
+
return { endpoint: target.gcp.endpoint, tls: target.gcp.tls };
|
|
88
|
+
case "kubernetes":
|
|
89
|
+
return { endpoint: target.kubernetes.server, tls: target.kubernetes.tls };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function listCloud(scope: CloudScope, target: SubstrateTarget, options: ListOptions = {}): Promise<ListingResult> {
|
|
94
|
+
if (scope.substrate !== target.substrate) {
|
|
95
|
+
throw new Error(`scope is ${scope.substrate} but the target is ${target.substrate}`);
|
|
96
|
+
}
|
|
97
|
+
const canonical = canonicalScope(scope);
|
|
98
|
+
const now = options.now ?? (() => new Date());
|
|
99
|
+
const { endpoint, tls } = endpointAndTls(target);
|
|
100
|
+
const transport = new Transport({
|
|
101
|
+
fetcher: options.fetcher,
|
|
102
|
+
tls,
|
|
103
|
+
...(endpoint !== undefined ? { pinnedOrigin: endpoint } : {}),
|
|
104
|
+
...(options.onSend ? { onSend: options.onSend } : {}),
|
|
105
|
+
});
|
|
106
|
+
const chains = options.chains ?? sdkCredentialChains;
|
|
107
|
+
const ctx: ListerContext = { scope: canonical, transport, now, resources: [], coverage: [], notes: [] };
|
|
108
|
+
const startedAt = now().toISOString();
|
|
109
|
+
switch (target.substrate) {
|
|
110
|
+
case "aws":
|
|
111
|
+
await listAws(ctx, target.aws, chains, options.retryDelays);
|
|
112
|
+
break;
|
|
113
|
+
case "azure":
|
|
114
|
+
await listAzure(ctx, target.azure, chains, options.retryDelays);
|
|
115
|
+
break;
|
|
116
|
+
case "gcp":
|
|
117
|
+
await listGcp(ctx, target.gcp, chains, options.retryDelays);
|
|
118
|
+
break;
|
|
119
|
+
case "kubernetes":
|
|
120
|
+
await listKubernetes(ctx, target.kubernetes, options.retryDelays);
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
sortResult(ctx);
|
|
124
|
+
return {
|
|
125
|
+
listing: "v1",
|
|
126
|
+
source: { name: "chant-lister", version: options.version ?? "unknown" },
|
|
127
|
+
scope: canonical,
|
|
128
|
+
startedAt,
|
|
129
|
+
completedAt: now().toISOString(),
|
|
130
|
+
resources: ctx.resources,
|
|
131
|
+
coverage: ctx.coverage,
|
|
132
|
+
notes: ctx.notes,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* behold#1029: the Kubernetes lister against a fake API server: discovery
|
|
3
|
+
* (`/api/v1`, `/apis`, `/apis/<g>/<v>`), then LIST per served kind.
|
|
4
|
+
*/
|
|
5
|
+
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { listCloud } from "./index";
|
|
7
|
+
import { kubeTargetFromKubeconfig } from "./kubernetes";
|
|
8
|
+
import { ListerConfigError } from "./credentials";
|
|
9
|
+
import { MASKED } from "./mask";
|
|
10
|
+
import { fakeFetcher, json, refusingChains, steppingClock } from "./fakes";
|
|
11
|
+
import type { WireCall } from "./guard";
|
|
12
|
+
|
|
13
|
+
const SERVER = "https://127.0.0.1:6443";
|
|
14
|
+
|
|
15
|
+
function cluster(call: WireCall) {
|
|
16
|
+
const url = new URL(call.url);
|
|
17
|
+
switch (url.pathname) {
|
|
18
|
+
case "/api/v1":
|
|
19
|
+
return json(200, {
|
|
20
|
+
resources: [
|
|
21
|
+
{ name: "secrets", kind: "Secret", namespaced: true, verbs: ["get", "list", "create", "delete"] },
|
|
22
|
+
{ name: "namespaces", kind: "Namespace", namespaced: false, verbs: ["get", "list"] },
|
|
23
|
+
{ name: "pods", kind: "Pod", namespaced: true, verbs: ["get", "list"] },
|
|
24
|
+
{ name: "pods/log", kind: "Pod", namespaced: true, verbs: ["get"] },
|
|
25
|
+
{ name: "events", kind: "Event", namespaced: true, verbs: ["list"] },
|
|
26
|
+
{ name: "bindings", kind: "Binding", namespaced: true, verbs: ["create"] },
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
case "/apis":
|
|
30
|
+
return json(200, { groups: [{ name: "apps", preferredVersion: { groupVersion: "apps/v1", version: "v1" }, versions: [{ groupVersion: "apps/v1", version: "v1" }] }] });
|
|
31
|
+
case "/apis/apps/v1":
|
|
32
|
+
return json(200, { resources: [{ name: "deployments", kind: "Deployment", namespaced: true, verbs: ["get", "list", "patch"] }] });
|
|
33
|
+
case "/api/v1/secrets":
|
|
34
|
+
return json(200, {
|
|
35
|
+
items: [
|
|
36
|
+
{
|
|
37
|
+
metadata: {
|
|
38
|
+
name: "db",
|
|
39
|
+
namespace: "app",
|
|
40
|
+
uid: "uid-secret",
|
|
41
|
+
labels: { "app.kubernetes.io/managed-by": "chant", "chant.intentius.io/stack": "app" },
|
|
42
|
+
annotations: { "kubectl.kubernetes.io/last-applied-configuration": '{"data":{"password":"aHVudGVyMg=="}}' },
|
|
43
|
+
managedFields: [{ manager: "kubectl" }],
|
|
44
|
+
},
|
|
45
|
+
type: "Opaque",
|
|
46
|
+
data: { password: "aHVudGVyMg==", user: "YWRtaW4=" },
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
case "/api/v1/namespaces":
|
|
51
|
+
return json(200, { items: [{ metadata: { name: "app", uid: "uid-ns" } }] });
|
|
52
|
+
case "/api/v1/pods":
|
|
53
|
+
if (!url.searchParams.get("continue")) {
|
|
54
|
+
return json(200, { items: [{ metadata: { name: "web-1", namespace: "app", uid: "uid-p1" } }], metadata: { continue: "c2" } });
|
|
55
|
+
}
|
|
56
|
+
return json(200, { items: [{ metadata: { name: "other", namespace: "kube-system", uid: "uid-p2" } }] });
|
|
57
|
+
case "/apis/apps/v1/deployments":
|
|
58
|
+
return json(403, { kind: "Status", reason: "Forbidden", message: 'deployments.apps is forbidden: User "reader" cannot list resource "deployments"' });
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe("listing kubernetes", () => {
|
|
64
|
+
it("discovers, lists, pages and masks", async () => {
|
|
65
|
+
const fake = fakeFetcher(cluster);
|
|
66
|
+
const result = await listCloud(
|
|
67
|
+
{ substrate: "kubernetes", scopeId: "kind-floci", types: "*", locations: "*" },
|
|
68
|
+
{ substrate: "kubernetes", kubernetes: { server: SERVER, token: "static" } },
|
|
69
|
+
{ fetcher: fake.fetcher, chains: refusingChains(), now: steppingClock(), retryDelays: [] },
|
|
70
|
+
);
|
|
71
|
+
const paths = fake.calls.map((c) => new URL(c.url).pathname);
|
|
72
|
+
expect(paths).not.toContain("/api/v1/events");
|
|
73
|
+
expect(paths).not.toContain("/api/v1/bindings");
|
|
74
|
+
expect(paths.filter((p) => p === "/api/v1/pods")).toHaveLength(2);
|
|
75
|
+
expect(fake.calls.every((c) => c.method === "GET" && c.headers.authorization === "Bearer static")).toBe(true);
|
|
76
|
+
|
|
77
|
+
const secret = result.resources.find((r) => r.listedType === "v1/Secret")!;
|
|
78
|
+
expect(secret.id).toBe("kubernetes/kind-floci/app/v1%2FSecret/app/db");
|
|
79
|
+
expect(secret.nativeId).toBe("app/db");
|
|
80
|
+
expect(secret.cloudIds).toEqual([{ kind: "k8s-uid", value: "uid-secret" }]);
|
|
81
|
+
expect(secret.properties.data).toEqual({ password: MASKED, user: MASKED });
|
|
82
|
+
expect(JSON.stringify(secret)).not.toContain("aHVudGVyMg==");
|
|
83
|
+
expect(JSON.stringify(secret)).not.toContain("YWRtaW4=");
|
|
84
|
+
expect((secret.properties.metadata as Record<string, unknown>).managedFields).toBeUndefined();
|
|
85
|
+
expect(secret.facts.markers).toEqual({ owner: "app", encoding: "plain", source: "live" });
|
|
86
|
+
|
|
87
|
+
const ns = result.resources.find((r) => r.listedType === "v1/Namespace")!;
|
|
88
|
+
expect(ns.location).toBe("cluster");
|
|
89
|
+
expect(ns.nativeId).toBe("app");
|
|
90
|
+
|
|
91
|
+
expect(result.resources.filter((r) => r.listedType === "v1/Pod").map((r) => r.nativeId)).toEqual(["app/web-1", "kube-system/other"]);
|
|
92
|
+
|
|
93
|
+
expect(result.coverage).toEqual([
|
|
94
|
+
{ listedType: "apps/v1/Deployment", location: "*", verdict: "no-credentials", detail: expect.stringContaining("Forbidden") },
|
|
95
|
+
{ listedType: "v1/Namespace", location: "cluster", verdict: "listed" },
|
|
96
|
+
{ listedType: "v1/Pod", location: "*", verdict: "listed" },
|
|
97
|
+
{ listedType: "v1/Secret", location: "*", verdict: "listed" },
|
|
98
|
+
]);
|
|
99
|
+
expect(result.notes.map((n) => n.code).sort()).toEqual(["default-types", "no-credentials"]);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("keeps to the named namespaces and types, and notes a type the cluster cannot list", async () => {
|
|
103
|
+
const fake = fakeFetcher(cluster);
|
|
104
|
+
const result = await listCloud(
|
|
105
|
+
{ substrate: "kubernetes", scopeId: "kind-floci", types: ["v1/Pod", "example.com/v1/Widget"], locations: ["app"], tagFilter: { tier: "web" } },
|
|
106
|
+
{ substrate: "kubernetes", kubernetes: { server: SERVER, token: "static" } },
|
|
107
|
+
{ fetcher: fake.fetcher, chains: refusingChains(), now: steppingClock(), retryDelays: [] },
|
|
108
|
+
);
|
|
109
|
+
const podList = fake.calls.find((c) => new URL(c.url).pathname === "/api/v1/pods")!;
|
|
110
|
+
expect(new URL(podList.url).searchParams.get("labelSelector")).toBe("tier=web");
|
|
111
|
+
expect(result.resources.map((r) => r.nativeId)).toEqual(["app/web-1"]);
|
|
112
|
+
expect(result.coverage).toEqual([
|
|
113
|
+
{ listedType: "example.com/v1/Widget", location: "*", verdict: "unsupported-kind", detail: expect.any(String) },
|
|
114
|
+
{ listedType: "v1/Pod", location: "app", verdict: "filtered", detail: 'tag filter {"tier":"web"}' },
|
|
115
|
+
]);
|
|
116
|
+
expect(result.notes.find((n) => n.code === "no-lister")?.listedType).toBe("example.com/v1/Widget");
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
describe("kubeTargetFromKubeconfig", () => {
|
|
121
|
+
const base = (user: string) => `apiVersion: v1
|
|
122
|
+
kind: Config
|
|
123
|
+
current-context: kind-floci
|
|
124
|
+
clusters:
|
|
125
|
+
- name: kind-floci
|
|
126
|
+
cluster:
|
|
127
|
+
server: https://127.0.0.1:6443
|
|
128
|
+
certificate-authority-data: ${Buffer.from("CA PEM").toString("base64")}
|
|
129
|
+
contexts:
|
|
130
|
+
- name: kind-floci
|
|
131
|
+
context:
|
|
132
|
+
cluster: kind-floci
|
|
133
|
+
user: reader
|
|
134
|
+
users:
|
|
135
|
+
- name: reader
|
|
136
|
+
user:
|
|
137
|
+
${user}
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
it("reads a static token and the cluster CA", () => {
|
|
141
|
+
const t = kubeTargetFromKubeconfig(base(" token: abc"));
|
|
142
|
+
expect(t.server).toBe("https://127.0.0.1:6443");
|
|
143
|
+
expect(t.token).toBe("abc");
|
|
144
|
+
expect(t.tls?.ca).toBe("CA PEM");
|
|
145
|
+
expect(t.clusterName).toBe("kind-floci");
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("reads a client certificate and key", () => {
|
|
149
|
+
const t = kubeTargetFromKubeconfig(
|
|
150
|
+
base(` client-certificate-data: ${Buffer.from("CERT").toString("base64")}\n client-key-data: ${Buffer.from("KEY").toString("base64")}`),
|
|
151
|
+
);
|
|
152
|
+
expect(t.tls?.cert).toBe("CERT");
|
|
153
|
+
expect(t.tls?.key).toBe("KEY");
|
|
154
|
+
expect(t.token).toBeUndefined();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("refuses an exec plugin", () => {
|
|
158
|
+
expect(() => kubeTargetFromKubeconfig(base(" exec:\n apiVersion: client.authentication.k8s.io/v1\n command: aws"))).toThrow(ListerConfigError);
|
|
159
|
+
});
|
|
160
|
+
});
|