@intentius/chant 0.58.0 → 0.60.0
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/core.d.ts +17 -1
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/discover.d.ts +15 -4
- package/dist/audit/discover.d.ts.map +1 -1
- package/dist/build-params.d.ts +2 -2
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
- package/dist/cli/commands/lint.d.ts +13 -0
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/handlers/lint.d.ts.map +1 -1
- package/dist/cli/handlers/operator.d.ts.map +1 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/main.d.ts +0 -16
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/plugins.d.ts +22 -0
- package/dist/cli/plugins.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +14 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +4 -1
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/component.d.ts +19 -4
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/driver.d.ts +8 -2
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/pilots/alb-ecs.pilot.d.ts +2 -2
- package/dist/components/verbs/run-agent.d.ts +1 -7
- package/dist/components/verbs/run-agent.d.ts.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/detectLexicon.d.ts +13 -0
- package/dist/detectLexicon.d.ts.map +1 -1
- package/dist/lexicon.d.ts +213 -3
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +9 -1
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/observe.d.ts +4 -4
- package/dist/lint/rules/comp/comp004-gate-needs-durable-runtime.d.ts.map +1 -1
- package/dist/op/activities/index.d.ts +2 -2
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/reconcile.d.ts +134 -2
- package/dist/op/activities/reconcile.d.ts.map +1 -1
- package/dist/op/builders.d.ts +2 -2
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/change-signal.d.ts +91 -0
- package/dist/op/change-signal.d.ts.map +1 -0
- package/dist/op/composites/apply-op.d.ts +7 -2
- package/dist/op/composites/apply-op.d.ts.map +1 -1
- package/dist/op/composites/reconcile-op.d.ts.map +1 -1
- package/dist/op/gate-name.d.ts +40 -0
- package/dist/op/gate-name.d.ts.map +1 -0
- package/dist/op/gate-summary.d.ts +55 -0
- package/dist/op/gate-summary.d.ts.map +1 -0
- package/dist/op/index.d.ts +6 -2
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/op-ir.d.ts +2 -1
- package/dist/op/op-ir.d.ts.map +1 -1
- package/dist/op/operator.d.ts +63 -0
- package/dist/op/operator.d.ts.map +1 -1
- package/dist/op/types.d.ts +18 -3
- package/dist/op/types.d.ts.map +1 -1
- package/dist/params.d.ts +1 -1
- package/dist/project-root.d.ts +2 -2
- package/dist/terraform/bridge.d.ts +26 -7
- package/dist/terraform/bridge.d.ts.map +1 -1
- package/dist/terraform/carve-provider.d.ts +28 -2
- package/dist/terraform/carve-provider.d.ts.map +1 -1
- package/dist/terraform/data-source-shape.d.ts +77 -0
- package/dist/terraform/data-source-shape.d.ts.map +1 -0
- package/dist/terraform/graph.d.ts.map +1 -1
- package/dist/terraform/providers/kubernetes.d.ts +5 -0
- package/dist/terraform/providers/kubernetes.d.ts.map +1 -1
- package/dist/terraform/tier-map.d.ts +16 -4
- package/dist/terraform/tier-map.d.ts.map +1 -1
- package/dist/terraform/types.d.ts +8 -0
- package/dist/terraform/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/audit/core.ts +25 -3
- package/src/audit/discover.ts +122 -14
- package/src/build-params.ts +2 -2
- package/src/cli/commands/audit.test.ts +5 -3
- package/src/cli/commands/audit.ts +5 -1
- package/src/cli/commands/build.test.ts +39 -1
- package/src/cli/commands/build.ts +22 -8
- package/src/cli/commands/carve-bridge.test.ts +237 -14
- package/src/cli/commands/carve-bridge.ts +21 -17
- package/src/cli/commands/carve-emit-k8s.test.ts +17 -10
- package/src/cli/commands/lint.test.ts +297 -1
- package/src/cli/commands/lint.ts +119 -11
- package/src/cli/handlers/graph.test.ts +4 -4
- package/src/cli/handlers/graph.ts +11 -11
- package/src/cli/handlers/lint.test.ts +107 -0
- package/src/cli/handlers/lint.ts +30 -0
- package/src/cli/handlers/operator.ts +81 -0
- package/src/cli/handlers/run.test.ts +132 -3
- package/src/cli/handlers/run.ts +87 -3
- package/src/cli/main.test.ts +9 -11
- package/src/cli/main.ts +5 -27
- package/src/cli/plugins.test.ts +68 -2
- package/src/cli/plugins.ts +39 -0
- package/src/cli/registry.ts +14 -0
- package/src/components/README.md +2 -2
- package/src/components/SPRAWL-VALIDATION.md +5 -5
- package/src/components/__fixtures__/neo4j-fanout.json +1 -1
- package/src/components/cli-support.test.ts +18 -7
- package/src/components/cli-support.ts +8 -3
- package/src/components/component-schema.test.ts +18 -2
- package/src/components/component.schema.json +17 -4
- package/src/components/component.test.ts +2 -2
- package/src/components/component.ts +25 -5
- package/src/components/config-defaults.test.ts +2 -2
- package/src/components/driver.test.ts +20 -1
- package/src/components/driver.ts +12 -5
- package/src/components/pilots/README.md +1 -1
- package/src/components/pilots/alb-ecs.pilot.ts +2 -2
- package/src/components/pilots/neo4j-fanout.pilot.ts +3 -3
- package/src/components/verbs/run-agent.test.ts +19 -0
- package/src/components/verbs/run-agent.ts +1 -7
- package/src/config.ts +4 -4
- package/src/detectLexicon.ts +18 -1
- package/src/discovery/fold-import.test.ts +2 -2
- package/src/discovery/fold-import.ts +3 -3
- package/src/fold/foldable-helpers.ts +1 -1
- package/src/graph-ops.test.ts +1 -1
- package/src/lexicon.ts +221 -3
- package/src/lifecycle/gate-ledger.ts +12 -1
- package/src/lifecycle/observe.test.ts +2 -2
- package/src/lifecycle/observe.ts +8 -8
- package/src/lifecycle/release-ledger.test.ts +2 -2
- package/src/lint/pipeline-change-gate.test.ts +2 -2
- package/src/lint/rules/comp/comp.test.ts +26 -0
- package/src/lint/rules/comp/comp004-gate-needs-durable-runtime.ts +4 -2
- package/src/lint/rules/op/ops014-converge-rule-refusals.test.ts +1 -1
- package/src/op/activities/index.ts +9 -2
- package/src/op/activities/reconcile.test.ts +320 -2
- package/src/op/activities/reconcile.ts +423 -2
- package/src/op/builders.ts +3 -3
- package/src/op/change-signal.test.ts +117 -0
- package/src/op/change-signal.ts +169 -0
- package/src/op/composites/apply-op.ts +14 -4
- package/src/op/composites/composites.test.ts +17 -4
- package/src/op/composites/reconcile-op.ts +7 -4
- package/src/op/effect-step.test.ts +3 -3
- package/src/op/gate-name.test.ts +65 -0
- package/src/op/gate-name.ts +60 -0
- package/src/op/gate-summary.test.ts +62 -0
- package/src/op/gate-summary.ts +96 -0
- package/src/op/index.ts +9 -2
- package/src/op/local-executor.test.ts +16 -1
- package/src/op/local-executor.ts +4 -3
- package/src/op/op-ir.test.ts +12 -1
- package/src/op/op-ir.ts +5 -3
- package/src/op/op-verb-class.test.ts +2 -2
- package/src/op/op.test.ts +2 -2
- package/src/op/operator.test.ts +368 -0
- package/src/op/operator.ts +141 -5
- package/src/op/runtimes/local.test.ts +1 -1
- package/src/op/types.ts +23 -3
- package/src/params.ts +1 -1
- package/src/project-root.ts +2 -2
- package/src/terraform/aws-resources.test.ts +13 -4
- package/src/terraform/bridge.test.ts +22 -9
- package/src/terraform/bridge.ts +89 -28
- package/src/terraform/carve-provider.ts +38 -2
- package/src/terraform/data-source-shape.ts +95 -0
- package/src/terraform/graph.ts +35 -7
- package/src/terraform/providers/kubernetes.ts +48 -2
- package/src/terraform/tier-map.ts +21 -6
- package/src/terraform/types.ts +8 -0
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* can only name the family, and `adopt` reads the body to learn the rest —
|
|
19
19
|
* which is also why one rule here covers every CRD.
|
|
20
20
|
*
|
|
21
|
+
* It has no `kubernetes_manifest` data source either, so it does not read back
|
|
22
|
+
* as its own type. `MANIFEST_READ_BACK` below is the shape `carve bridge` uses
|
|
23
|
+
* instead: `data "kubernetes_resource"`, built from the manifest's own
|
|
24
|
+
* apiVersion/kind/metadata (#2034).
|
|
25
|
+
*
|
|
21
26
|
* It has no live adoption path. `carve emit --env` filters a live export by a
|
|
22
27
|
* native type, and there is no type to filter by until the body is read; state
|
|
23
28
|
* is where the body is. `liveSelectorType` therefore returns undefined and
|
|
@@ -26,6 +31,7 @@
|
|
|
26
31
|
*/
|
|
27
32
|
|
|
28
33
|
import type { AdoptedSource, CarveProvider, DeferredParam, TierInfo } from "../carve-provider";
|
|
34
|
+
import type { DataSourceShape } from "../data-source-shape";
|
|
29
35
|
import type { StateResource } from "../state";
|
|
30
36
|
|
|
31
37
|
/** The chant lexicon the emitted source imports from. */
|
|
@@ -208,14 +214,54 @@ function adoptManifestFromState(resource: StateResource, params: DeferredParam[]
|
|
|
208
214
|
};
|
|
209
215
|
}
|
|
210
216
|
|
|
217
|
+
/**
|
|
218
|
+
* How `carve bridge` reads a carved `kubernetes_manifest` back (#2034).
|
|
219
|
+
*
|
|
220
|
+
* The provider ships no `kubernetes_manifest` data source — checked against
|
|
221
|
+
* hashicorp/kubernetes v3.2.1, whose 27 data sources include no manifest. The
|
|
222
|
+
* generic read is `data "kubernetes_resource"`, which asks for the GVK and the
|
|
223
|
+
* name rather than taking them from a body: `api_version`, `kind`, and a
|
|
224
|
+
* nested `metadata` block with `name` and an optional `namespace`. All three
|
|
225
|
+
* come out of the manifest the resource declared.
|
|
226
|
+
*
|
|
227
|
+
* Survivors read the object back through `object`, and only through `object`:
|
|
228
|
+
* the resource exposes both `manifest` (the declared body) and `object` (the
|
|
229
|
+
* API server's read-back), the data source exposes just the latter. So both
|
|
230
|
+
* map to `object`, and a reference to `.manifest.data.log_level` lands on
|
|
231
|
+
* `.object.data.log_level` rather than an attribute that does not exist.
|
|
232
|
+
*
|
|
233
|
+
* A namespace-less manifest (a ClusterRole, a CRD) simply omits `namespace`,
|
|
234
|
+
* which the data source allows. A manifest whose name is interpolated resolves
|
|
235
|
+
* no literal and falls back to the bridge's TODO body, as an AWS type with an
|
|
236
|
+
* interpolated bucket name does.
|
|
237
|
+
*/
|
|
238
|
+
const MANIFEST_READ_BACK: DataSourceShape = {
|
|
239
|
+
type: "kubernetes_resource",
|
|
240
|
+
args: [
|
|
241
|
+
{ name: "api_version", from: "manifest.apiVersion", required: true },
|
|
242
|
+
{ name: "kind", from: "manifest.kind", required: true },
|
|
243
|
+
],
|
|
244
|
+
blocks: [
|
|
245
|
+
{
|
|
246
|
+
name: "metadata",
|
|
247
|
+
fields: [
|
|
248
|
+
{ name: "name", from: "manifest.metadata.name", required: true },
|
|
249
|
+
{ name: "namespace", from: "manifest.metadata.namespace" },
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
readAttrs: { manifest: "object", object: "object" },
|
|
254
|
+
};
|
|
255
|
+
|
|
211
256
|
export const kubernetesCarveProvider: CarveProvider = {
|
|
212
257
|
name: "kubernetes",
|
|
213
258
|
tfTypePrefixes: ["kubernetes_"],
|
|
214
259
|
lexicon: "k8s",
|
|
215
260
|
tiers: TIERS,
|
|
216
|
-
// A dotted path into
|
|
217
|
-
//
|
|
261
|
+
// A dotted path into the manifest body: the graph walks it for identity. It
|
|
262
|
+
// cannot be a data-source argument on its own, so the read-back is a shape.
|
|
218
263
|
identityAttrs: { kubernetes_manifest: "manifest.metadata.name" },
|
|
264
|
+
dataSourceShapes: { kubernetes_manifest: MANIFEST_READ_BACK },
|
|
219
265
|
emitTypes: ["kubernetes_manifest"],
|
|
220
266
|
adopt: (resource, params) => adoptManifestFromState(resource, params),
|
|
221
267
|
// State only — the kind is in the body, so a live export has nothing to
|
|
@@ -18,14 +18,17 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
+
carveDataSourceShape,
|
|
21
22
|
carveFoldParent,
|
|
22
23
|
carveIdentityAttr,
|
|
23
24
|
carveTierMap,
|
|
24
25
|
resolveEmitProvider,
|
|
25
26
|
type TierInfo,
|
|
26
27
|
} from "./carve-provider";
|
|
28
|
+
import type { DataSourceShape } from "./data-source-shape";
|
|
27
29
|
|
|
28
30
|
export { carveEmitTypes, type TierInfo } from "./carve-provider";
|
|
31
|
+
export type { DataSourceShape } from "./data-source-shape";
|
|
29
32
|
|
|
30
33
|
/** TF resource type → native tier, over every registered provider. Absent = unsupported (score 0). */
|
|
31
34
|
export function tierMap(): Readonly<Record<string, TierInfo>> {
|
|
@@ -66,12 +69,24 @@ export function canCarveEmit(tfType: string): boolean {
|
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
72
|
+
* How `chant carve bridge` reads this type back as a `data` source: the
|
|
73
|
+
* data-source type, where each argument comes from in the carved body, and how
|
|
74
|
+
* a survivor's attribute path translates (#2034). Undefined when the type
|
|
75
|
+
* cannot be read back at all.
|
|
76
|
+
*/
|
|
77
|
+
export function dataSourceShapeOf(tfType: string): DataSourceShape | undefined {
|
|
78
|
+
return carveDataSourceShape(tfType);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Can `chant carve bridge` render a Terraform `data` source for this type?
|
|
83
|
+
* True whenever its provider contributes a shape — declared, or implied by a
|
|
84
|
+
* plain identity attribute. False for a dotted identity attribute with no
|
|
85
|
+
* declared shape: that is a path into nested values, and a flat `attr = value`
|
|
86
|
+
* body cannot express it (`manifest.metadata.name = "x"` is not valid HCL). A
|
|
87
|
+
* type with no identity attribute at all still bridges; the bridge writes a
|
|
88
|
+
* TODO comment for the body.
|
|
73
89
|
*/
|
|
74
90
|
export function canBridge(tfType: string): boolean {
|
|
75
|
-
|
|
76
|
-
return attr === undefined || !attr.includes(".");
|
|
91
|
+
return carveDataSourceShape(tfType) !== undefined;
|
|
77
92
|
}
|
package/src/terraform/types.ts
CHANGED
|
@@ -34,6 +34,14 @@ export interface TfNode {
|
|
|
34
34
|
* emit. Undefined when the identity attribute is absent or interpolated.
|
|
35
35
|
*/
|
|
36
36
|
identity?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The literals the type's data-source shape reads out of the block (#2034),
|
|
39
|
+
* keyed by the shape field's source path (`manifest.metadata.name`). This is
|
|
40
|
+
* what `carve bridge` renders the `data` body from — a superset of
|
|
41
|
+
* `identity`, since a shape can need more than one value (`api_version`,
|
|
42
|
+
* `kind` and `metadata.name` for a `kubernetes_manifest`).
|
|
43
|
+
*/
|
|
44
|
+
dataSourceValues?: Record<string, string>;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
/**
|