@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.
Files changed (169) hide show
  1. package/dist/audit/core.d.ts +17 -1
  2. package/dist/audit/core.d.ts.map +1 -1
  3. package/dist/audit/discover.d.ts +15 -4
  4. package/dist/audit/discover.d.ts.map +1 -1
  5. package/dist/build-params.d.ts +2 -2
  6. package/dist/cli/commands/audit.d.ts.map +1 -1
  7. package/dist/cli/commands/build.d.ts.map +1 -1
  8. package/dist/cli/commands/carve-bridge.d.ts.map +1 -1
  9. package/dist/cli/commands/lint.d.ts +13 -0
  10. package/dist/cli/commands/lint.d.ts.map +1 -1
  11. package/dist/cli/handlers/lint.d.ts.map +1 -1
  12. package/dist/cli/handlers/operator.d.ts.map +1 -1
  13. package/dist/cli/handlers/run.d.ts.map +1 -1
  14. package/dist/cli/main.d.ts +0 -16
  15. package/dist/cli/main.d.ts.map +1 -1
  16. package/dist/cli/plugins.d.ts +22 -0
  17. package/dist/cli/plugins.d.ts.map +1 -1
  18. package/dist/cli/registry.d.ts +14 -0
  19. package/dist/cli/registry.d.ts.map +1 -1
  20. package/dist/components/cli-support.d.ts +4 -1
  21. package/dist/components/cli-support.d.ts.map +1 -1
  22. package/dist/components/component.d.ts +19 -4
  23. package/dist/components/component.d.ts.map +1 -1
  24. package/dist/components/driver.d.ts +8 -2
  25. package/dist/components/driver.d.ts.map +1 -1
  26. package/dist/components/pilots/alb-ecs.pilot.d.ts +2 -2
  27. package/dist/components/verbs/run-agent.d.ts +1 -7
  28. package/dist/components/verbs/run-agent.d.ts.map +1 -1
  29. package/dist/config.d.ts +4 -4
  30. package/dist/detectLexicon.d.ts +13 -0
  31. package/dist/detectLexicon.d.ts.map +1 -1
  32. package/dist/lexicon.d.ts +213 -3
  33. package/dist/lexicon.d.ts.map +1 -1
  34. package/dist/lifecycle/gate-ledger.d.ts +9 -1
  35. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  36. package/dist/lifecycle/observe.d.ts +4 -4
  37. package/dist/lint/rules/comp/comp004-gate-needs-durable-runtime.d.ts.map +1 -1
  38. package/dist/op/activities/index.d.ts +2 -2
  39. package/dist/op/activities/index.d.ts.map +1 -1
  40. package/dist/op/activities/reconcile.d.ts +134 -2
  41. package/dist/op/activities/reconcile.d.ts.map +1 -1
  42. package/dist/op/builders.d.ts +2 -2
  43. package/dist/op/builders.d.ts.map +1 -1
  44. package/dist/op/change-signal.d.ts +91 -0
  45. package/dist/op/change-signal.d.ts.map +1 -0
  46. package/dist/op/composites/apply-op.d.ts +7 -2
  47. package/dist/op/composites/apply-op.d.ts.map +1 -1
  48. package/dist/op/composites/reconcile-op.d.ts.map +1 -1
  49. package/dist/op/gate-name.d.ts +40 -0
  50. package/dist/op/gate-name.d.ts.map +1 -0
  51. package/dist/op/gate-summary.d.ts +55 -0
  52. package/dist/op/gate-summary.d.ts.map +1 -0
  53. package/dist/op/index.d.ts +6 -2
  54. package/dist/op/index.d.ts.map +1 -1
  55. package/dist/op/local-executor.d.ts.map +1 -1
  56. package/dist/op/op-ir.d.ts +2 -1
  57. package/dist/op/op-ir.d.ts.map +1 -1
  58. package/dist/op/operator.d.ts +63 -0
  59. package/dist/op/operator.d.ts.map +1 -1
  60. package/dist/op/types.d.ts +18 -3
  61. package/dist/op/types.d.ts.map +1 -1
  62. package/dist/params.d.ts +1 -1
  63. package/dist/project-root.d.ts +2 -2
  64. package/dist/terraform/bridge.d.ts +26 -7
  65. package/dist/terraform/bridge.d.ts.map +1 -1
  66. package/dist/terraform/carve-provider.d.ts +28 -2
  67. package/dist/terraform/carve-provider.d.ts.map +1 -1
  68. package/dist/terraform/data-source-shape.d.ts +77 -0
  69. package/dist/terraform/data-source-shape.d.ts.map +1 -0
  70. package/dist/terraform/graph.d.ts.map +1 -1
  71. package/dist/terraform/providers/kubernetes.d.ts +5 -0
  72. package/dist/terraform/providers/kubernetes.d.ts.map +1 -1
  73. package/dist/terraform/tier-map.d.ts +16 -4
  74. package/dist/terraform/tier-map.d.ts.map +1 -1
  75. package/dist/terraform/types.d.ts +8 -0
  76. package/dist/terraform/types.d.ts.map +1 -1
  77. package/package.json +1 -1
  78. package/src/audit/core.ts +25 -3
  79. package/src/audit/discover.ts +122 -14
  80. package/src/build-params.ts +2 -2
  81. package/src/cli/commands/audit.test.ts +5 -3
  82. package/src/cli/commands/audit.ts +5 -1
  83. package/src/cli/commands/build.test.ts +39 -1
  84. package/src/cli/commands/build.ts +22 -8
  85. package/src/cli/commands/carve-bridge.test.ts +237 -14
  86. package/src/cli/commands/carve-bridge.ts +21 -17
  87. package/src/cli/commands/carve-emit-k8s.test.ts +17 -10
  88. package/src/cli/commands/lint.test.ts +297 -1
  89. package/src/cli/commands/lint.ts +119 -11
  90. package/src/cli/handlers/graph.test.ts +4 -4
  91. package/src/cli/handlers/graph.ts +11 -11
  92. package/src/cli/handlers/lint.test.ts +107 -0
  93. package/src/cli/handlers/lint.ts +30 -0
  94. package/src/cli/handlers/operator.ts +81 -0
  95. package/src/cli/handlers/run.test.ts +132 -3
  96. package/src/cli/handlers/run.ts +87 -3
  97. package/src/cli/main.test.ts +9 -11
  98. package/src/cli/main.ts +5 -27
  99. package/src/cli/plugins.test.ts +68 -2
  100. package/src/cli/plugins.ts +39 -0
  101. package/src/cli/registry.ts +14 -0
  102. package/src/components/README.md +2 -2
  103. package/src/components/SPRAWL-VALIDATION.md +5 -5
  104. package/src/components/__fixtures__/neo4j-fanout.json +1 -1
  105. package/src/components/cli-support.test.ts +18 -7
  106. package/src/components/cli-support.ts +8 -3
  107. package/src/components/component-schema.test.ts +18 -2
  108. package/src/components/component.schema.json +17 -4
  109. package/src/components/component.test.ts +2 -2
  110. package/src/components/component.ts +25 -5
  111. package/src/components/config-defaults.test.ts +2 -2
  112. package/src/components/driver.test.ts +20 -1
  113. package/src/components/driver.ts +12 -5
  114. package/src/components/pilots/README.md +1 -1
  115. package/src/components/pilots/alb-ecs.pilot.ts +2 -2
  116. package/src/components/pilots/neo4j-fanout.pilot.ts +3 -3
  117. package/src/components/verbs/run-agent.test.ts +19 -0
  118. package/src/components/verbs/run-agent.ts +1 -7
  119. package/src/config.ts +4 -4
  120. package/src/detectLexicon.ts +18 -1
  121. package/src/discovery/fold-import.test.ts +2 -2
  122. package/src/discovery/fold-import.ts +3 -3
  123. package/src/fold/foldable-helpers.ts +1 -1
  124. package/src/graph-ops.test.ts +1 -1
  125. package/src/lexicon.ts +221 -3
  126. package/src/lifecycle/gate-ledger.ts +12 -1
  127. package/src/lifecycle/observe.test.ts +2 -2
  128. package/src/lifecycle/observe.ts +8 -8
  129. package/src/lifecycle/release-ledger.test.ts +2 -2
  130. package/src/lint/pipeline-change-gate.test.ts +2 -2
  131. package/src/lint/rules/comp/comp.test.ts +26 -0
  132. package/src/lint/rules/comp/comp004-gate-needs-durable-runtime.ts +4 -2
  133. package/src/lint/rules/op/ops014-converge-rule-refusals.test.ts +1 -1
  134. package/src/op/activities/index.ts +9 -2
  135. package/src/op/activities/reconcile.test.ts +320 -2
  136. package/src/op/activities/reconcile.ts +423 -2
  137. package/src/op/builders.ts +3 -3
  138. package/src/op/change-signal.test.ts +117 -0
  139. package/src/op/change-signal.ts +169 -0
  140. package/src/op/composites/apply-op.ts +14 -4
  141. package/src/op/composites/composites.test.ts +17 -4
  142. package/src/op/composites/reconcile-op.ts +7 -4
  143. package/src/op/effect-step.test.ts +3 -3
  144. package/src/op/gate-name.test.ts +65 -0
  145. package/src/op/gate-name.ts +60 -0
  146. package/src/op/gate-summary.test.ts +62 -0
  147. package/src/op/gate-summary.ts +96 -0
  148. package/src/op/index.ts +9 -2
  149. package/src/op/local-executor.test.ts +16 -1
  150. package/src/op/local-executor.ts +4 -3
  151. package/src/op/op-ir.test.ts +12 -1
  152. package/src/op/op-ir.ts +5 -3
  153. package/src/op/op-verb-class.test.ts +2 -2
  154. package/src/op/op.test.ts +2 -2
  155. package/src/op/operator.test.ts +368 -0
  156. package/src/op/operator.ts +141 -5
  157. package/src/op/runtimes/local.test.ts +1 -1
  158. package/src/op/types.ts +23 -3
  159. package/src/params.ts +1 -1
  160. package/src/project-root.ts +2 -2
  161. package/src/terraform/aws-resources.test.ts +13 -4
  162. package/src/terraform/bridge.test.ts +22 -9
  163. package/src/terraform/bridge.ts +89 -28
  164. package/src/terraform/carve-provider.ts +38 -2
  165. package/src/terraform/data-source-shape.ts +95 -0
  166. package/src/terraform/graph.ts +35 -7
  167. package/src/terraform/providers/kubernetes.ts +48 -2
  168. package/src/terraform/tier-map.ts +21 -6
  169. 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 nested blocks: the graph walks it for identity, and
217
- // `carve bridge` refuses the type because a data-source body cannot express it.
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
- * Can `chant carve bridge` render a Terraform `data` source for this type? A
70
- * dotted identity attribute is a path into nested blocks, and a data source
71
- * body is flat `attr = value` — `manifest.metadata.name = "x"` is not valid
72
- * HCL. An absent entry is fine: the bridge writes a TODO comment instead.
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
- const attr = carveIdentityAttr(tfType);
76
- return attr === undefined || !attr.includes(".");
91
+ return carveDataSourceShape(tfType) !== undefined;
77
92
  }
@@ -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
  /**