@intentius/chant 0.124.51 → 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 +17 -3
- 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 +224 -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/covered-round.d.ts +173 -0
- package/dist/components/covered-round.d.ts.map +1 -0
- package/dist/components/covered-round.js +200 -0
- 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 +42 -1
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +74 -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 +7 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -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 +62 -7
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +354 -53
- 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/components/wave-plan.d.ts +2 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +4 -1
- 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 +92 -3
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +62 -3
- 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 +76 -3
- 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 +16 -3
- 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 +238 -0
- package/src/components/cli-support.ts +70 -14
- package/src/components/covered-round.test.ts +166 -0
- package/src/components/covered-round.ts +293 -0
- 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 +101 -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 +59 -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 +728 -4
- package/src/components/pr-run.ts +395 -55
- 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/components/wave-plan.ts +5 -2
- 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 +57 -1
- package/src/pr-loop.ts +154 -6
- 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 +76 -3
- 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,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant workspace drift [dir] --member <name> [--read <read>] [--resource
|
|
3
|
+
* <addr>] [--env <env>] [--stream] [-o <file>]` (behold#995): one member's
|
|
4
|
+
* drift, read by the engine that owns it, as chant's drift record
|
|
5
|
+
* (`../drift-record.ts`, #4451).
|
|
6
|
+
*
|
|
7
|
+
* The read is the member kind's:
|
|
8
|
+
*
|
|
9
|
+
* | kind | default read | how |
|
|
10
|
+
* |---|---|---|
|
|
11
|
+
* | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, through `liveDiffDriftRecords` and, when a lexicon has a deep reader, `mergeDeepDrift`. `--components` adds `chant components status <env> --live --json` through `componentStatusDriftRecords`. Needs `--env` |
|
|
12
|
+
* | `terraform` | `state` | `chant lifecycle drift` in the member's reader project: the terraform lexicon's `readDrift`, `terraform show -json` over state, or `--read plan` for a saved plan's `show -json` |
|
|
13
|
+
* | `choudoufu` | `ownership` | the same, through `choudoufu live-plan -json` (and `live-ls`), or `--read plan` for live-plan with a plan beside it; `--resource <addr>` passes `choudoufu live-plan -resource=<addr>`'s stream through |
|
|
14
|
+
* | `pulumi` | `refresh` | `chant lifecycle drift` in the member's reader project: the pulumi lexicon's `readDrift`, `pulumi refresh --preview-only --json --target <urn>` per resource in the checked-in export, or `plunge drift --resource <urn> --stream` for a member on plunge; `--resource <urn>` reads that URN alone (#4455) |
|
|
15
|
+
*
|
|
16
|
+
* Any other kind has no drift read and answers `no-drift-read`. A member of
|
|
17
|
+
* a package's kind runs in the reader project `workspace graph` writes for it
|
|
18
|
+
* (`./kind-readers.ts`), under the member's own toolchain, so chant core
|
|
19
|
+
* never imports the lexicon.
|
|
20
|
+
*
|
|
21
|
+
* Every record's `node` is placed on the member's source graph with the
|
|
22
|
+
* change set's rule (`mapDriftToGraph`, `graphNodeFor`), the graph read the
|
|
23
|
+
* way `workspace graph --member <name>` reads it, from the per-member cache
|
|
24
|
+
* when the source has not moved. A graph that can't be read leaves `node`
|
|
25
|
+
* null; the drift still prints.
|
|
26
|
+
*
|
|
27
|
+
* Without `--stream` it prints one drift document with the read contract's
|
|
28
|
+
* head beside it (`contract`, `chant`), and with `error: {code, message}`
|
|
29
|
+
* and no records when the read could not run. With `--stream` it prints the
|
|
30
|
+
* NDJSON stream, decoded and re-encoded with C1's codec: a `drift-start`,
|
|
31
|
+
* the records and a `drift-settle` per read (for a chant member chant writes
|
|
32
|
+
* the start and settle itself around the diff's records). A failed read
|
|
33
|
+
* prints nothing on stdout in stream mode and says why on stderr.
|
|
34
|
+
*/
|
|
35
|
+
import type { CommandContext } from "../cli/registry.js";
|
|
36
|
+
import { type DriftDocument, type DriftLine, type DriftRead } from "../drift-record.js";
|
|
37
|
+
/** The version of the read contract the document is written under. */
|
|
38
|
+
export declare const DRIFT_CONTRACT_VERSION = 1;
|
|
39
|
+
/** Why a drift read could not run: the declaration's codes, and the read's own. */
|
|
40
|
+
export declare const DRIFT_ERROR_CODES: readonly ["declaration-missing", "declaration-ambiguous", "declaration-unparseable", "declaration-invalid", "placement-invalid", "reader-too-old", "root-chant-required", "not-a-git-repository", "revision-unknown", "member-required", "no-drift-read", "read-unsupported", "resource-unsupported", "env-required", "command-failed"];
|
|
41
|
+
export type DriftErrorCode = (typeof DRIFT_ERROR_CODES)[number];
|
|
42
|
+
/** The reads each member kind answers, the first its default. A kind not here has no drift read. */
|
|
43
|
+
export declare const DRIFT_READS_BY_KIND: Record<string, readonly DriftRead[]>;
|
|
44
|
+
/** The kinds whose engine reads one resource on its own, for `--resource`. */
|
|
45
|
+
export declare const DRIFT_RESOURCE_KINDS: readonly string[];
|
|
46
|
+
/** The document `workspace drift` prints: a drift document with the read contract's head. */
|
|
47
|
+
export type WorkspaceDriftDocument = DriftDocument & {
|
|
48
|
+
contract: number;
|
|
49
|
+
chant: string;
|
|
50
|
+
/** The member read. */
|
|
51
|
+
member?: string;
|
|
52
|
+
error?: {
|
|
53
|
+
code: DriftErrorCode;
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export interface DriftQuery {
|
|
58
|
+
cwd: string;
|
|
59
|
+
member: string;
|
|
60
|
+
read?: string;
|
|
61
|
+
resource?: string;
|
|
62
|
+
env?: string;
|
|
63
|
+
components?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export type DriftReadResult = {
|
|
66
|
+
lines: DriftLine[];
|
|
67
|
+
} | {
|
|
68
|
+
error: {
|
|
69
|
+
code: DriftErrorCode;
|
|
70
|
+
message: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Read one member's drift and return the stream lines, placed on its graph.
|
|
75
|
+
* Never throws a {@link WorkspaceReadError}: a failure is `error`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function readWorkspaceDrift(query: DriftQuery): Promise<DriftReadResult>;
|
|
78
|
+
/** The document for a read: the folded stream, or an empty one carrying the error. */
|
|
79
|
+
export declare function driftReadDocument(member: string, result: DriftReadResult): WorkspaceDriftDocument;
|
|
80
|
+
export declare function runWorkspaceDrift(ctx: CommandContext): Promise<number>;
|
|
81
|
+
//# sourceMappingURL=drift-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drift-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/drift-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAiBL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EAEf,MAAM,iBAAiB,CAAC;AAWzB,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,yUAcY,CAAC;AAC3C,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAKpE,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAA4B,CAAC;AAQ/E,6FAA6F;AAC7F,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,SAAS,EAAE,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAqG5G;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAgFpF;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,sBAAsB,CAQjG;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC5E"}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant workspace drift [dir] --member <name> [--read <read>] [--resource
|
|
3
|
+
* <addr>] [--env <env>] [--stream] [-o <file>]` (behold#995): one member's
|
|
4
|
+
* drift, read by the engine that owns it, as chant's drift record
|
|
5
|
+
* (`../drift-record.ts`, #4451).
|
|
6
|
+
*
|
|
7
|
+
* The read is the member kind's:
|
|
8
|
+
*
|
|
9
|
+
* | kind | default read | how |
|
|
10
|
+
* |---|---|---|
|
|
11
|
+
* | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, through `liveDiffDriftRecords` and, when a lexicon has a deep reader, `mergeDeepDrift`. `--components` adds `chant components status <env> --live --json` through `componentStatusDriftRecords`. Needs `--env` |
|
|
12
|
+
* | `terraform` | `state` | `chant lifecycle drift` in the member's reader project: the terraform lexicon's `readDrift`, `terraform show -json` over state, or `--read plan` for a saved plan's `show -json` |
|
|
13
|
+
* | `choudoufu` | `ownership` | the same, through `choudoufu live-plan -json` (and `live-ls`), or `--read plan` for live-plan with a plan beside it; `--resource <addr>` passes `choudoufu live-plan -resource=<addr>`'s stream through |
|
|
14
|
+
* | `pulumi` | `refresh` | `chant lifecycle drift` in the member's reader project: the pulumi lexicon's `readDrift`, `pulumi refresh --preview-only --json --target <urn>` per resource in the checked-in export, or `plunge drift --resource <urn> --stream` for a member on plunge; `--resource <urn>` reads that URN alone (#4455) |
|
|
15
|
+
*
|
|
16
|
+
* Any other kind has no drift read and answers `no-drift-read`. A member of
|
|
17
|
+
* a package's kind runs in the reader project `workspace graph` writes for it
|
|
18
|
+
* (`./kind-readers.ts`), under the member's own toolchain, so chant core
|
|
19
|
+
* never imports the lexicon.
|
|
20
|
+
*
|
|
21
|
+
* Every record's `node` is placed on the member's source graph with the
|
|
22
|
+
* change set's rule (`mapDriftToGraph`, `graphNodeFor`), the graph read the
|
|
23
|
+
* way `workspace graph --member <name>` reads it, from the per-member cache
|
|
24
|
+
* when the source has not moved. A graph that can't be read leaves `node`
|
|
25
|
+
* null; the drift still prints.
|
|
26
|
+
*
|
|
27
|
+
* Without `--stream` it prints one drift document with the read contract's
|
|
28
|
+
* head beside it (`contract`, `chant`), and with `error: {code, message}`
|
|
29
|
+
* and no records when the read could not run. With `--stream` it prints the
|
|
30
|
+
* NDJSON stream, decoded and re-encoded with C1's codec: a `drift-start`,
|
|
31
|
+
* the records and a `drift-settle` per read (for a chant member chant writes
|
|
32
|
+
* the start and settle itself around the diff's records). A failed read
|
|
33
|
+
* prints nothing on stdout in stream mode and says why on stderr.
|
|
34
|
+
*/
|
|
35
|
+
import { existsSync } from "node:fs";
|
|
36
|
+
import { resolve } from "node:path";
|
|
37
|
+
import { formatError } from "../cli/format.js";
|
|
38
|
+
import { graphNodeFor } from "../change-set-graph.js";
|
|
39
|
+
import { componentStatusDriftRecords, countDriftStatuses, decodeDriftLines, deepDiffDriftRecords, DRIFT_READS, DRIFT_SCHEMA_ID, DRIFT_VERSION, driftExpected, driftPlanner, driftRecordLine, driftSettle, driftStart, encodeDriftLines, foldDriftLines, liveDiffDriftRecords, mergeDeepDrift, } from "../drift-record.js";
|
|
40
|
+
import { readDeclaration, readerVersion, WORKSPACE_ERROR_CODES, WorkspaceReadError } from "./declaration.js";
|
|
41
|
+
import { prepareKindReaders } from "./kind-readers.js";
|
|
42
|
+
import { loadKindRegistry } from "./kinds.js";
|
|
43
|
+
import { emitDocument, executePlan, planMembers } from "./member-commands.js";
|
|
44
|
+
import { handToRootChant, locateWorkspace } from "./which-chant.js";
|
|
45
|
+
/** The version of the read contract the document is written under. */
|
|
46
|
+
export const DRIFT_CONTRACT_VERSION = 1;
|
|
47
|
+
/** Why a drift read could not run: the declaration's codes, and the read's own. */
|
|
48
|
+
export const DRIFT_ERROR_CODES = [
|
|
49
|
+
...WORKSPACE_ERROR_CODES,
|
|
50
|
+
/** No `--member`, or more than one. */
|
|
51
|
+
"member-required",
|
|
52
|
+
/** The member's kind has no drift read (`other`, `app`, a nested workspace, ...). */
|
|
53
|
+
"no-drift-read",
|
|
54
|
+
/** The read is not one the member's engine has, such as `state` on a chant member. */
|
|
55
|
+
"read-unsupported",
|
|
56
|
+
/** `--resource` on an engine that cannot read one resource on its own. */
|
|
57
|
+
"resource-unsupported",
|
|
58
|
+
/** A chant member's live read needs an environment. */
|
|
59
|
+
"env-required",
|
|
60
|
+
/** The member's command failed, or printed something that is not drift. */
|
|
61
|
+
"command-failed",
|
|
62
|
+
];
|
|
63
|
+
/** The reads each member kind answers, the first its default. A kind not here has no drift read. */
|
|
64
|
+
export const DRIFT_READS_BY_KIND = {
|
|
65
|
+
chant: ["live-read"],
|
|
66
|
+
terraform: ["state", "plan"],
|
|
67
|
+
choudoufu: ["ownership", "plan"],
|
|
68
|
+
pulumi: ["refresh"],
|
|
69
|
+
};
|
|
70
|
+
/** The kinds whose engine reads one resource on its own, for `--resource`. */
|
|
71
|
+
export const DRIFT_RESOURCE_KINDS = ["choudoufu", "pulumi"];
|
|
72
|
+
/** The exit status `chant lifecycle drift` gives a refused read (`../cli/handlers/lifecycle-drift.ts`). */
|
|
73
|
+
const MEMBER_REFUSED_EXIT = 3;
|
|
74
|
+
const USAGE = "chant workspace drift [dir] --member <name> [--read <state|plan|refresh|live-read|ownership>] [--resource <addr>] [--env <env>] [--components] [--stream] [-o <file>]";
|
|
75
|
+
class DriftReadFailure extends Error {
|
|
76
|
+
constructor(code, message) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.code = code;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function tail(text) {
|
|
82
|
+
return text.trim().split("\n").slice(-5).join("\n");
|
|
83
|
+
}
|
|
84
|
+
/** The member's node ids, without the member in front, from its source graph; null when it can't be read. */
|
|
85
|
+
async function memberGraph(cwd, member) {
|
|
86
|
+
try {
|
|
87
|
+
const { workspaceGraph } = await import("./graph-cli.js");
|
|
88
|
+
const { doc } = await workspaceGraph({ cwd, members: [member] });
|
|
89
|
+
if ("error" in doc)
|
|
90
|
+
return null;
|
|
91
|
+
const entry = doc.members.find((m) => m.name === member);
|
|
92
|
+
if (!entry || entry.status !== "composed")
|
|
93
|
+
return null;
|
|
94
|
+
const prefix = `${member}/`;
|
|
95
|
+
const ids = doc.nodes.filter((n) => n.member === member && n.id.startsWith(prefix)).map((n) => n.id.slice(prefix.length));
|
|
96
|
+
return { member, at: doc.at, ids };
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/** A record placed on the member's graph by the change set's rule; a URN by the pulumi planner's (`driftPlanner`, plunge included). */
|
|
103
|
+
function place(record, graph) {
|
|
104
|
+
if (graph === null)
|
|
105
|
+
return record;
|
|
106
|
+
const { instanceOf: _i, ...r } = record;
|
|
107
|
+
const placed = graphNodeFor({ member: r.member, planner: driftPlanner(record.engine), address: r.address }, graph);
|
|
108
|
+
return { ...r, node: placed.node, ...(placed.instanceOf !== undefined ? { instanceOf: placed.instanceOf } : {}) };
|
|
109
|
+
}
|
|
110
|
+
/** Every line with the workspace's member name and its node placed. An engine that names its own estate (choudoufu) is renamed. */
|
|
111
|
+
function placeLines(lines, member, graph) {
|
|
112
|
+
return lines.map((line) => {
|
|
113
|
+
if (line.type === "drift-record") {
|
|
114
|
+
const { type: _t, ...record } = line;
|
|
115
|
+
return driftRecordLine(place({ ...record, member }, graph));
|
|
116
|
+
}
|
|
117
|
+
if (line.type === "drift-start") {
|
|
118
|
+
const engine = line.engine;
|
|
119
|
+
const expected = driftExpected(line).map((e) => {
|
|
120
|
+
if (graph === null)
|
|
121
|
+
return e;
|
|
122
|
+
const placed = graphNodeFor({ member, planner: driftPlanner(engine), address: e.address }, graph);
|
|
123
|
+
return { ...e, node: placed.node, ...(placed.instanceOf !== undefined ? { instanceOf: placed.instanceOf } : {}) };
|
|
124
|
+
});
|
|
125
|
+
return { ...line, member, expected };
|
|
126
|
+
}
|
|
127
|
+
return { ...line, member };
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
/** A chant member's records, from `lifecycle diff --live --json` (and `components status --live --json`). */
|
|
131
|
+
function chantRecords(member, diffOut, componentsOut, observedAt, version) {
|
|
132
|
+
let doc;
|
|
133
|
+
try {
|
|
134
|
+
doc = JSON.parse(diffOut);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
throw new DriftReadFailure("command-failed", `chant lifecycle diff --live --json printed something that is not JSON: ${err.message}`);
|
|
138
|
+
}
|
|
139
|
+
const lexicons = [...Object.values(doc.lexicons ?? {}), ...Object.values(doc.stacks ?? {}).flatMap((s) => Object.values(s))];
|
|
140
|
+
const base = { member, observedAt, ...(version ? { version } : {}) };
|
|
141
|
+
const out = [];
|
|
142
|
+
for (const lex of lexicons) {
|
|
143
|
+
if (!lex.resources)
|
|
144
|
+
continue;
|
|
145
|
+
const types = {};
|
|
146
|
+
for (const [name, meta] of Object.entries(lex.observed ?? {}))
|
|
147
|
+
if (typeof meta?.type === "string")
|
|
148
|
+
types[name] = meta.type;
|
|
149
|
+
const thin = liveDiffDriftRecords({ ...base, diff: lex.resources, types });
|
|
150
|
+
out.push(...(lex.deep ? mergeDeepDrift(thin, deepDiffDriftRecords({ ...base, diff: lex.deep })) : thin));
|
|
151
|
+
}
|
|
152
|
+
if (componentsOut !== undefined) {
|
|
153
|
+
let rows;
|
|
154
|
+
try {
|
|
155
|
+
rows = JSON.parse(componentsOut);
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
throw new DriftReadFailure("command-failed", `chant components status --live --json printed something that is not JSON: ${err.message}`);
|
|
159
|
+
}
|
|
160
|
+
if (Array.isArray(rows))
|
|
161
|
+
out.push(...componentStatusDriftRecords({ ...base, rows }));
|
|
162
|
+
}
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/** The command line the member runs. */
|
|
166
|
+
function memberArgv(kind, query, read) {
|
|
167
|
+
if (kind === "chant")
|
|
168
|
+
return ["lifecycle", "diff", query.env, "--live", "--json"];
|
|
169
|
+
return ["lifecycle", "drift", ".", "--member", query.member, "--read", read, ...(query.resource !== undefined ? ["--resource", query.resource] : [])];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Read one member's drift and return the stream lines, placed on its graph.
|
|
173
|
+
* Never throws a {@link WorkspaceReadError}: a failure is `error`.
|
|
174
|
+
*/
|
|
175
|
+
export async function readWorkspaceDrift(query) {
|
|
176
|
+
let cleanup;
|
|
177
|
+
try {
|
|
178
|
+
const located = locateWorkspace(query.cwd);
|
|
179
|
+
const declaration = readDeclaration(located.tree, "", { rootChant: true });
|
|
180
|
+
const entry = declaration.members.find((m) => m.name === query.member);
|
|
181
|
+
if (!entry) {
|
|
182
|
+
throw new DriftReadFailure("member-required", `--member ${query.member} is not a member of ${declaration.name}; it declares ${declaration.members.map((m) => m.name).join(", ")}`);
|
|
183
|
+
}
|
|
184
|
+
const reads = DRIFT_READS_BY_KIND[entry.kind];
|
|
185
|
+
if (!reads)
|
|
186
|
+
throw new DriftReadFailure("no-drift-read", `${query.member} is kind ${entry.kind}, and chant workspace drift reads members of kind ${Object.keys(DRIFT_READS_BY_KIND).join(", ")}`);
|
|
187
|
+
if (query.read !== undefined && !DRIFT_READS.includes(query.read)) {
|
|
188
|
+
throw new DriftReadFailure("read-unsupported", `--read ${query.read} is not a drift read; the reads are ${DRIFT_READS.join(", ")}`);
|
|
189
|
+
}
|
|
190
|
+
const read = (query.read ?? reads[0]);
|
|
191
|
+
if (!reads.includes(read))
|
|
192
|
+
throw new DriftReadFailure("read-unsupported", `a ${entry.kind} member answers ${reads.join(" or ")}, not --read ${read}`);
|
|
193
|
+
if (query.resource !== undefined && !DRIFT_RESOURCE_KINDS.includes(entry.kind)) {
|
|
194
|
+
throw new DriftReadFailure("resource-unsupported", `--resource reads one resource through choudoufu live-plan -resource, pulumi refresh --target or plunge drift --resource; ${query.member} is kind ${entry.kind}`);
|
|
195
|
+
}
|
|
196
|
+
if (entry.kind === "chant" && !query.env)
|
|
197
|
+
throw new DriftReadFailure("env-required", `${query.member} is a chant member, read live through chant lifecycle diff <env> --live: add --env <env>`);
|
|
198
|
+
const { registry: kinds, problems } = loadKindRegistry(declaration.pins, located.rootOnDisk);
|
|
199
|
+
const plan = planMembers("graph", located.rootOnDisk, { only: [query.member], tree: located.tree, kinds, kindProblems: problems.map((p) => p.message) });
|
|
200
|
+
const notRun = [...plan.unreadable, ...plan.skipped].find((s) => s.name === query.member);
|
|
201
|
+
if (notRun)
|
|
202
|
+
throw new DriftReadFailure(plan.unreadable.includes(notRun) ? "command-failed" : "no-drift-read", `${query.member}: ${notRun.reason.code}: ${notRun.reason.message}`);
|
|
203
|
+
const readers = prepareKindReaders(plan, located.rootOnDisk);
|
|
204
|
+
cleanup = readers.cleanup;
|
|
205
|
+
const failedReader = readers.failed.find((f) => f.name === query.member);
|
|
206
|
+
if (failedReader)
|
|
207
|
+
throw new DriftReadFailure("command-failed", `${query.member}: ${failedReader.reason.message}`);
|
|
208
|
+
const args = {};
|
|
209
|
+
const [graph, results, components] = await Promise.all([
|
|
210
|
+
memberGraph(query.cwd, query.member),
|
|
211
|
+
executePlan(plan, args, () => memberArgv(entry.kind, query, read)),
|
|
212
|
+
entry.kind === "chant" && query.components ? executePlan(plan, args, () => ["components", "status", query.env, "--live", "--json"]) : Promise.resolve(undefined),
|
|
213
|
+
]);
|
|
214
|
+
const result = results.find((r) => r.member === query.member);
|
|
215
|
+
if (!result)
|
|
216
|
+
throw new DriftReadFailure("command-failed", `${query.member} did not run`);
|
|
217
|
+
if (result.stderr.trim())
|
|
218
|
+
process.stderr.write(result.stderr.endsWith("\n") ? result.stderr : `${result.stderr}\n`);
|
|
219
|
+
const observedAt = result.finishedAt ?? new Date().toISOString();
|
|
220
|
+
if (entry.kind === "chant") {
|
|
221
|
+
if (result.exitCode !== 0)
|
|
222
|
+
throw new DriftReadFailure("command-failed", `chant lifecycle diff ${query.env} --live exited ${result.exitCode}${tail(result.stderr) ? `: ${tail(result.stderr)}` : ""}`);
|
|
223
|
+
const comp = components?.find((r) => r.member === query.member);
|
|
224
|
+
if (comp && comp.exitCode !== 0)
|
|
225
|
+
throw new DriftReadFailure("command-failed", `chant components status ${query.env} --live exited ${comp.exitCode}${tail(comp.stderr) ? `: ${tail(comp.stderr)}` : ""}`);
|
|
226
|
+
const records = chantRecords(query.member, result.stdout, comp?.stdout, observedAt, result.chant ?? undefined).map((r) => place(r, graph));
|
|
227
|
+
const start = driftStart({ member: query.member, engine: "chant", read, at: observedAt, expected: records.map((r) => ({ address: r.address, node: r.node, ...(r.instanceOf ? { instanceOf: r.instanceOf } : {}) })), evidence: { tool: "chant", command: "chant lifecycle diff --live" } });
|
|
228
|
+
const settled = driftSettle(start, records, observedAt);
|
|
229
|
+
return { lines: [start, ...settled.records.map(driftRecordLine), settled.line] };
|
|
230
|
+
}
|
|
231
|
+
if (result.exitCode === MEMBER_REFUSED_EXIT) {
|
|
232
|
+
let refused;
|
|
233
|
+
try {
|
|
234
|
+
refused = JSON.parse(result.stdout.trim().split("\n").pop() ?? "").refused;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
refused = undefined;
|
|
238
|
+
}
|
|
239
|
+
if (refused) {
|
|
240
|
+
const code = DRIFT_ERROR_CODES.includes(refused.code ?? "") ? refused.code : "command-failed";
|
|
241
|
+
throw new DriftReadFailure(code, `${query.member}: ${refused.message ?? refused.code}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (result.exitCode !== 0) {
|
|
245
|
+
throw new DriftReadFailure("command-failed", `chant lifecycle drift in ${query.member}'s reader project exited ${result.exitCode}${tail(result.stderr) ? `: ${tail(result.stderr)}` : ""}`);
|
|
246
|
+
}
|
|
247
|
+
let lines;
|
|
248
|
+
try {
|
|
249
|
+
lines = decodeDriftLines(result.stdout);
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
throw new DriftReadFailure("command-failed", `chant lifecycle drift in ${query.member}'s reader project printed a line that is not drift: ${err.message}`);
|
|
253
|
+
}
|
|
254
|
+
return { lines: placeLines(lines, query.member, graph) };
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
if (err instanceof DriftReadFailure)
|
|
258
|
+
return { error: { code: err.code, message: err.message } };
|
|
259
|
+
if (err instanceof WorkspaceReadError)
|
|
260
|
+
return { error: { code: err.code, message: err.message } };
|
|
261
|
+
throw err;
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
cleanup?.();
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/** The document for a read: the folded stream, or an empty one carrying the error. */
|
|
268
|
+
export function driftReadDocument(member, result) {
|
|
269
|
+
const chant = readerVersion();
|
|
270
|
+
const head = { contract: DRIFT_CONTRACT_VERSION, chant, ...(member ? { member } : {}) };
|
|
271
|
+
if ("error" in result) {
|
|
272
|
+
return { $schema: DRIFT_SCHEMA_ID, drift: DRIFT_VERSION, ...head, records: [], counts: countDriftStatuses([]), error: result.error };
|
|
273
|
+
}
|
|
274
|
+
const { document } = foldDriftLines(result.lines, { chant });
|
|
275
|
+
return { ...document, ...head };
|
|
276
|
+
}
|
|
277
|
+
export async function runWorkspaceDrift(ctx) {
|
|
278
|
+
const { args } = ctx;
|
|
279
|
+
const cwd = resolve(args.extraPositional ?? ".");
|
|
280
|
+
if (!existsSync(cwd)) {
|
|
281
|
+
console.error(formatError({ message: `${cwd} does not exist`, hint: USAGE }));
|
|
282
|
+
return 1;
|
|
283
|
+
}
|
|
284
|
+
// The root's chant reads the declaration (ws-021).
|
|
285
|
+
const handed = await handToRootChant(cwd, undefined);
|
|
286
|
+
if (handed !== undefined)
|
|
287
|
+
return handed;
|
|
288
|
+
const members = args.members ?? [];
|
|
289
|
+
const result = members.length !== 1
|
|
290
|
+
? { error: { code: "member-required", message: `chant workspace drift reads one member: --member <name>${members.length > 1 ? `, and it was given ${members.join(", ")}` : ""}` } }
|
|
291
|
+
: await readWorkspaceDrift({
|
|
292
|
+
cwd,
|
|
293
|
+
member: members[0],
|
|
294
|
+
...(args.driftRead !== undefined ? { read: args.driftRead } : {}),
|
|
295
|
+
...(args.resource !== undefined ? { resource: args.resource } : {}),
|
|
296
|
+
...(args.env !== undefined ? { env: args.env } : {}),
|
|
297
|
+
...(args.components ? { components: true } : {}),
|
|
298
|
+
});
|
|
299
|
+
if ("error" in result)
|
|
300
|
+
console.error(formatError({ message: `${result.error.code}: ${result.error.message}`, hint: USAGE }));
|
|
301
|
+
if (args.stream) {
|
|
302
|
+
if ("error" in result)
|
|
303
|
+
return 1;
|
|
304
|
+
const text = encodeDriftLines(result.lines);
|
|
305
|
+
if (args.output) {
|
|
306
|
+
const { mkdirSync, writeFileSync } = await import("node:fs");
|
|
307
|
+
const { dirname } = await import("node:path");
|
|
308
|
+
mkdirSync(dirname(resolve(args.output)), { recursive: true });
|
|
309
|
+
writeFileSync(resolve(args.output), text);
|
|
310
|
+
}
|
|
311
|
+
else
|
|
312
|
+
process.stdout.write(text);
|
|
313
|
+
return 0;
|
|
314
|
+
}
|
|
315
|
+
emitDocument(driftReadDocument(members[0] ?? "", result), args.output);
|
|
316
|
+
return "error" in result ? 1 : 0;
|
|
317
|
+
}
|