@intentius/chant-lexicon-terraform 0.102.0 → 0.104.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 (270) hide show
  1. package/dist/__fixtures__/terragrunt/affected-cases.d.ts +23 -0
  2. package/dist/__fixtures__/terragrunt/affected-cases.d.ts.map +1 -0
  3. package/dist/__fixtures__/terragrunt/record.d.ts +17 -0
  4. package/dist/__fixtures__/terragrunt/record.d.ts.map +1 -0
  5. package/dist/change-set.d.ts +67 -0
  6. package/dist/change-set.d.ts.map +1 -0
  7. package/dist/changed-roots.d.ts +30 -0
  8. package/dist/changed-roots.d.ts.map +1 -0
  9. package/dist/commands.d.ts +26 -0
  10. package/dist/commands.d.ts.map +1 -0
  11. package/dist/components/capability-plugin.d.ts +54 -0
  12. package/dist/components/capability-plugin.d.ts.map +1 -0
  13. package/dist/composites/terraform-pin-rollout-op.d.ts +44 -0
  14. package/dist/composites/terraform-pin-rollout-op.d.ts.map +1 -0
  15. package/dist/hcl/descend.d.ts +1 -1
  16. package/dist/hcl/descend.d.ts.map +1 -1
  17. package/dist/hcl/edges.d.ts +2 -2
  18. package/dist/hcl/edges.d.ts.map +1 -1
  19. package/dist/hcl/parse.d.ts +29 -1
  20. package/dist/hcl/parse.d.ts.map +1 -1
  21. package/dist/hcl/roots.d.ts +1 -1
  22. package/dist/hcl/roots.d.ts.map +1 -1
  23. package/dist/hcl/suppressions.d.ts.map +1 -1
  24. package/dist/index.d.ts +4 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/integrity.json +13 -4
  27. package/dist/lint/audit-catalog.d.ts.map +1 -1
  28. package/dist/lint/post-synth/index.d.ts.map +1 -1
  29. package/dist/lint/post-synth/module-source.d.ts +27 -1
  30. package/dist/lint/post-synth/module-source.d.ts.map +1 -1
  31. package/dist/lint/post-synth/terragrunt.d.ts +37 -0
  32. package/dist/lint/post-synth/terragrunt.d.ts.map +1 -0
  33. package/dist/lint/post-synth/tf002.d.ts +3 -1
  34. package/dist/lint/post-synth/tf002.d.ts.map +1 -1
  35. package/dist/lint/post-synth/tf038.d.ts +22 -0
  36. package/dist/lint/post-synth/tf038.d.ts.map +1 -0
  37. package/dist/lint/post-synth/tf039.d.ts +23 -0
  38. package/dist/lint/post-synth/tf039.d.ts.map +1 -0
  39. package/dist/lint/post-synth/tf040.d.ts +30 -0
  40. package/dist/lint/post-synth/tf040.d.ts.map +1 -0
  41. package/dist/lint/post-synth/tf041.d.ts +20 -0
  42. package/dist/lint/post-synth/tf041.d.ts.map +1 -0
  43. package/dist/lint/post-synth/tf042.d.ts +18 -0
  44. package/dist/lint/post-synth/tf042.d.ts.map +1 -0
  45. package/dist/lint/post-synth/tf043.d.ts +17 -0
  46. package/dist/lint/post-synth/tf043.d.ts.map +1 -0
  47. package/dist/lint/post-synth/tf044.d.ts +17 -0
  48. package/dist/lint/post-synth/tf044.d.ts.map +1 -0
  49. package/dist/lint/post-synth/tf045.d.ts +22 -0
  50. package/dist/lint/post-synth/tf045.d.ts.map +1 -0
  51. package/dist/manifest.json +1 -1
  52. package/dist/okf/index.md +8 -0
  53. package/dist/okf/rules/TF038.md +11 -0
  54. package/dist/okf/rules/TF039.md +11 -0
  55. package/dist/okf/rules/TF040.md +11 -0
  56. package/dist/okf/rules/TF041.md +11 -0
  57. package/dist/okf/rules/TF042.md +11 -0
  58. package/dist/okf/rules/TF043.md +11 -0
  59. package/dist/okf/rules/TF044.md +11 -0
  60. package/dist/okf/rules/TF045.md +11 -0
  61. package/dist/op/activities/index.d.ts +4 -0
  62. package/dist/op/activities/index.d.ts.map +1 -1
  63. package/dist/op/activities/pin-rollout.d.ts +46 -0
  64. package/dist/op/activities/pin-rollout.d.ts.map +1 -0
  65. package/dist/op/activities/terraform.d.ts +24 -50
  66. package/dist/op/activities/terraform.d.ts.map +1 -1
  67. package/dist/op/activity-contracts.d.ts +48 -0
  68. package/dist/op/activity-contracts.d.ts.map +1 -1
  69. package/dist/op/builders.d.ts +9 -0
  70. package/dist/op/builders.d.ts.map +1 -1
  71. package/dist/pin/edit-ts.d.ts +21 -0
  72. package/dist/pin/edit-ts.d.ts.map +1 -0
  73. package/dist/pin/edit.d.ts +52 -0
  74. package/dist/pin/edit.d.ts.map +1 -0
  75. package/dist/pin/forge.d.ts +39 -0
  76. package/dist/pin/forge.d.ts.map +1 -0
  77. package/dist/pin/index.d.ts +22 -0
  78. package/dist/pin/index.d.ts.map +1 -0
  79. package/dist/pin/rollout.d.ts +116 -0
  80. package/dist/pin/rollout.d.ts.map +1 -0
  81. package/dist/pin/scan.d.ts +54 -0
  82. package/dist/pin/scan.d.ts.map +1 -0
  83. package/dist/pin/source.d.ts +93 -0
  84. package/dist/pin/source.d.ts.map +1 -0
  85. package/dist/pin/waves.d.ts +66 -0
  86. package/dist/pin/waves.d.ts.map +1 -0
  87. package/dist/plan-digest.d.ts +59 -0
  88. package/dist/plan-digest.d.ts.map +1 -0
  89. package/dist/plugin.d.ts.map +1 -1
  90. package/dist/rules/module-source.ts +56 -1
  91. package/dist/rules/terragrunt.ts +76 -0
  92. package/dist/rules/tf002.ts +1 -1
  93. package/dist/rules/tf038.ts +71 -0
  94. package/dist/rules/tf039.ts +64 -0
  95. package/dist/rules/tf040.ts +76 -0
  96. package/dist/rules/tf041.ts +56 -0
  97. package/dist/rules/tf042.ts +42 -0
  98. package/dist/rules/tf043.ts +49 -0
  99. package/dist/rules/tf044.ts +51 -0
  100. package/dist/rules/tf045.ts +47 -0
  101. package/dist/terragrunt/affected.d.ts +119 -0
  102. package/dist/terragrunt/affected.d.ts.map +1 -0
  103. package/dist/terragrunt/index.d.ts +11 -0
  104. package/dist/terragrunt/index.d.ts.map +1 -0
  105. package/dist/terragrunt/mocks.d.ts +147 -0
  106. package/dist/terragrunt/mocks.d.ts.map +1 -0
  107. package/dist/terragrunt/run.d.ts +130 -0
  108. package/dist/terragrunt/run.d.ts.map +1 -0
  109. package/dist/terragrunt/units.d.ts +103 -0
  110. package/dist/terragrunt/units.d.ts.map +1 -0
  111. package/dist/terragrunt/wave.d.ts +89 -0
  112. package/dist/terragrunt/wave.d.ts.map +1 -0
  113. package/package.json +12 -2
  114. package/src/__fixtures__/change-set/choudoufu-set-plan.change-set.golden.json +95 -0
  115. package/src/__fixtures__/change-set/choudoufu-set-plan.json +76 -0
  116. package/src/__fixtures__/change-set/choudoufu.part.golden.json +173 -0
  117. package/src/__fixtures__/change-set/choudoufu.plan.json +610 -0
  118. package/src/__fixtures__/change-set/terraform.import-forget.plan.json +81 -0
  119. package/src/__fixtures__/change-set/terraform.part.golden.json +173 -0
  120. package/src/__fixtures__/change-set/terraform.plan.json +589 -0
  121. package/src/__fixtures__/change-set/tofu.part.golden.json +173 -0
  122. package/src/__fixtures__/change-set/tofu.plan.json +588 -0
  123. package/src/__fixtures__/change-set/v1.tf.txt +21 -0
  124. package/src/__fixtures__/change-set/v2-module-app.tf.txt +4 -0
  125. package/src/__fixtures__/change-set/v2.tf.txt +21 -0
  126. package/src/__fixtures__/pin/choudoufu-live-waves-n5.json +83 -0
  127. package/src/__fixtures__/pin/largeset-oci-n5/apply-order.txt +5 -0
  128. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/estate.chdf.hcl +6 -0
  129. package/src/__fixtures__/pin/largeset-oci-n5/estates/e01/main.tf +33 -0
  130. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/estate.chdf.hcl +6 -0
  131. package/src/__fixtures__/pin/largeset-oci-n5/estates/e02/main.tf +45 -0
  132. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/estate.chdf.hcl +6 -0
  133. package/src/__fixtures__/pin/largeset-oci-n5/estates/e03/main.tf +47 -0
  134. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/estate.chdf.hcl +6 -0
  135. package/src/__fixtures__/pin/largeset-oci-n5/estates/e04/main.tf +31 -0
  136. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/estate.chdf.hcl +6 -0
  137. package/src/__fixtures__/pin/largeset-oci-n5/estates/e05/main.tf +27 -0
  138. package/src/__fixtures__/pin/largeset-oci-n5/fixture.json +77 -0
  139. package/src/__fixtures__/plan-summary/largeset-n5-bump.json +2071 -0
  140. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.json +95 -0
  141. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.md +22 -0
  142. package/src/__fixtures__/plan-summary/largeset-n5.summary.golden.txt +12 -0
  143. package/src/__fixtures__/terragrunt/affected/catalog/units/web/terragrunt.hcl +3 -0
  144. package/src/__fixtures__/terragrunt/affected/gitignore +3 -0
  145. package/src/__fixtures__/terragrunt/affected/live/dev/app/terragrunt.hcl +3 -0
  146. package/src/__fixtures__/terragrunt/affected/live/dev/vpc/terragrunt.hcl +3 -0
  147. package/src/__fixtures__/terragrunt/affected/live/prod/app/terragrunt.hcl +3 -0
  148. package/src/__fixtures__/terragrunt/affected/live/stg/terragrunt.stack.hcl +5 -0
  149. package/src/__fixtures__/terragrunt/affected/modules/app/main.tf +6 -0
  150. package/src/__fixtures__/terragrunt/affected/modules/app/policy.json +1 -0
  151. package/src/__fixtures__/terragrunt/affected/modules/net/main.tf +2 -0
  152. package/src/__fixtures__/terragrunt/affected/modules/thing/main.tf +3 -0
  153. package/src/__fixtures__/terragrunt/affected/root.hcl +5 -0
  154. package/src/__fixtures__/terragrunt/affected-cases.ts +126 -0
  155. package/src/__fixtures__/terragrunt/five-units/catalog/units/thing/terragrunt.hcl +3 -0
  156. package/src/__fixtures__/terragrunt/five-units/live/dev/app/terragrunt.hcl +13 -0
  157. package/src/__fixtures__/terragrunt/five-units/live/dev/db/terragrunt.hcl +8 -0
  158. package/src/__fixtures__/terragrunt/five-units/live/dev/vpc/terragrunt.hcl +3 -0
  159. package/src/__fixtures__/terragrunt/five-units/live/prod/app/terragrunt.hcl +8 -0
  160. package/src/__fixtures__/terragrunt/five-units/live/prod/vpc/terragrunt.hcl +3 -0
  161. package/src/__fixtures__/terragrunt/five-units/modules/thing/main.tf +7 -0
  162. package/src/__fixtures__/terragrunt/five-units/root.hcl +5 -0
  163. package/src/__fixtures__/terragrunt/record.ts +56 -0
  164. package/src/__fixtures__/terragrunt/recorded/affected-find.json +50 -0
  165. package/src/__fixtures__/terragrunt/recorded/failed-plan-report.json +36 -0
  166. package/src/__fixtures__/terragrunt/recorded/find.json +67 -0
  167. package/src/__fixtures__/terragrunt/recorded/version.txt +1 -0
  168. package/src/__fixtures__/terragrunt/recorded/wave-1/apply-report.json +22 -0
  169. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/dev/vpc/tfplan.json +1 -0
  170. package/src/__fixtures__/terragrunt/recorded/wave-1/json/live/prod/vpc/tfplan.json +1 -0
  171. package/src/__fixtures__/terragrunt/recorded/wave-1/plan-report.json +22 -0
  172. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/dev/db/tfplan.json +1 -0
  173. package/src/__fixtures__/terragrunt/recorded/wave-2/json/live/prod/app/tfplan.json +1 -0
  174. package/src/__fixtures__/terragrunt/recorded/wave-2/plan-report.json +22 -0
  175. package/src/change-set-combined-run.test.ts +156 -0
  176. package/src/change-set.test.ts +151 -0
  177. package/src/change-set.ts +273 -0
  178. package/src/changed-roots.test.ts +58 -0
  179. package/src/changed-roots.ts +102 -0
  180. package/src/commands.ts +112 -0
  181. package/src/components/capability-plugin.test.ts +91 -0
  182. package/src/components/capability-plugin.ts +131 -0
  183. package/src/components/pr-loop.tofu.test.ts +244 -0
  184. package/src/composites/terraform-pin-rollout-op.test.ts +69 -0
  185. package/src/composites/terraform-pin-rollout-op.ts +60 -0
  186. package/src/hcl/descend.ts +1 -1
  187. package/src/hcl/edges.ts +2 -2
  188. package/src/hcl/parse.test.ts +25 -0
  189. package/src/hcl/parse.ts +91 -6
  190. package/src/hcl/roots.ts +1 -1
  191. package/src/hcl/suppressions.ts +8 -2
  192. package/src/index.ts +18 -0
  193. package/src/lint/audit-catalog.ts +82 -0
  194. package/src/lint/audit.test.ts +3 -1
  195. package/src/lint/post-synth/fixtures/TF038/positive.tf +3 -0
  196. package/src/lint/post-synth/fixtures/TF039/positive.tf +4 -0
  197. package/src/lint/post-synth/fixtures/TF041/negative/terragrunt.hcl +12 -0
  198. package/src/lint/post-synth/fixtures/TF041/positive/terragrunt.hcl +7 -0
  199. package/src/lint/post-synth/fixtures/TF041/positive-apply/terragrunt.hcl +8 -0
  200. package/src/lint/post-synth/fixtures/TF042/negative/terragrunt.hcl +13 -0
  201. package/src/lint/post-synth/fixtures/TF042/positive/terragrunt.hcl +9 -0
  202. package/src/lint/post-synth/fixtures/TF043/negative/terragrunt.hcl +3 -0
  203. package/src/lint/post-synth/fixtures/TF043/negative-other/terragrunt.hcl +3 -0
  204. package/src/lint/post-synth/fixtures/TF043/positive-git/terragrunt.hcl +3 -0
  205. package/src/lint/post-synth/fixtures/TF043/positive-oci/terragrunt.hcl +3 -0
  206. package/src/lint/post-synth/fixtures/TF043/positive-tfr/terragrunt.hcl +3 -0
  207. package/src/lint/post-synth/fixtures/TF044/negative/terragrunt.hcl +9 -0
  208. package/src/lint/post-synth/fixtures/TF044/positive/terragrunt.hcl +7 -0
  209. package/src/lint/post-synth/fixtures/TF044/positive-generate/terragrunt.hcl +9 -0
  210. package/src/lint/post-synth/fixtures/TF045/negative/root.hcl +1 -0
  211. package/src/lint/post-synth/fixtures/TF045/negative/terragrunt.hcl +3 -0
  212. package/src/lint/post-synth/fixtures/TF045/positive/root.hcl +9 -0
  213. package/src/lint/post-synth/fixtures/TF045/positive/terragrunt.hcl +3 -0
  214. package/src/lint/post-synth/fixtures/TF045/unit-only/terragrunt.hcl +3 -0
  215. package/src/lint/post-synth/index.ts +16 -0
  216. package/src/lint/post-synth/module-source.test.ts +42 -1
  217. package/src/lint/post-synth/module-source.ts +56 -1
  218. package/src/lint/post-synth/terragrunt.ts +76 -0
  219. package/src/lint/post-synth/tf002.ts +1 -1
  220. package/src/lint/post-synth/tf038.test.ts +51 -0
  221. package/src/lint/post-synth/tf038.ts +71 -0
  222. package/src/lint/post-synth/tf039.test.ts +40 -0
  223. package/src/lint/post-synth/tf039.ts +64 -0
  224. package/src/lint/post-synth/tf040.test.ts +55 -0
  225. package/src/lint/post-synth/tf040.ts +76 -0
  226. package/src/lint/post-synth/tf041.test.ts +50 -0
  227. package/src/lint/post-synth/tf041.ts +56 -0
  228. package/src/lint/post-synth/tf042.test.ts +19 -0
  229. package/src/lint/post-synth/tf042.ts +42 -0
  230. package/src/lint/post-synth/tf043.test.ts +65 -0
  231. package/src/lint/post-synth/tf043.ts +49 -0
  232. package/src/lint/post-synth/tf044.test.ts +27 -0
  233. package/src/lint/post-synth/tf044.ts +51 -0
  234. package/src/lint/post-synth/tf045.test.ts +30 -0
  235. package/src/lint/post-synth/tf045.ts +47 -0
  236. package/src/op/activities/index.ts +4 -0
  237. package/src/op/activities/pin-rollout.ts +77 -0
  238. package/src/op/activities/terraform.test.ts +13 -0
  239. package/src/op/activities/terraform.ts +46 -86
  240. package/src/op/activity-contracts.test.ts +4 -1
  241. package/src/op/activity-contracts.ts +42 -0
  242. package/src/op/builders.ts +13 -0
  243. package/src/pin/bundle.test.ts +53 -0
  244. package/src/pin/edit-ts.test.ts +39 -0
  245. package/src/pin/edit-ts.ts +77 -0
  246. package/src/pin/edit.test.ts +199 -0
  247. package/src/pin/edit.ts +157 -0
  248. package/src/pin/forge.ts +85 -0
  249. package/src/pin/index.ts +22 -0
  250. package/src/pin/rollout.test.ts +232 -0
  251. package/src/pin/rollout.ts +451 -0
  252. package/src/pin/scan.ts +309 -0
  253. package/src/pin/source.ts +206 -0
  254. package/src/pin/waves.test.ts +101 -0
  255. package/src/pin/waves.ts +125 -0
  256. package/src/plan-digest.ts +99 -0
  257. package/src/plan-summary.test.ts +154 -0
  258. package/src/plugin.ts +25 -2
  259. package/src/terragrunt/affected.acceptance.test.ts +83 -0
  260. package/src/terragrunt/affected.test.ts +177 -0
  261. package/src/terragrunt/affected.ts +348 -0
  262. package/src/terragrunt/index.ts +11 -0
  263. package/src/terragrunt/mocks.acceptance.test.ts +105 -0
  264. package/src/terragrunt/mocks.test.ts +309 -0
  265. package/src/terragrunt/mocks.ts +324 -0
  266. package/src/terragrunt/run.ts +369 -0
  267. package/src/terragrunt/terragrunt.acceptance.test.ts +122 -0
  268. package/src/terragrunt/terragrunt.test.ts +332 -0
  269. package/src/terragrunt/units.ts +235 -0
  270. package/src/terragrunt/wave.ts +181 -0
@@ -43,6 +43,7 @@ export declare const terraformPlanContract: import("@intentius/chant/op").Activi
43
43
  cwd?: string | undefined;
44
44
  planFile?: string | undefined;
45
45
  destroy?: boolean | undefined;
46
+ vars?: Record<string, unknown> | undefined;
46
47
  }, {
47
48
  adds: number;
48
49
  changes: number;
@@ -53,6 +54,14 @@ export declare const terraformPlanContract: import("@intentius/chant/op").Activi
53
54
  json: unknown;
54
55
  text: string;
55
56
  planDigest: string;
57
+ changeSet: {
58
+ member: {
59
+ [x: string]: unknown;
60
+ member: string;
61
+ planDigest: string | null;
62
+ };
63
+ entries: unknown[];
64
+ };
56
65
  }>;
57
66
  export declare const terraformApplyContract: import("@intentius/chant/op").ActivityContract<{
58
67
  root: string;
@@ -146,4 +155,43 @@ export declare const choudoufuAdoptContract: import("@intentius/chant/op").Activ
146
155
  ambiguous: number;
147
156
  dir: string;
148
157
  }>;
158
+ /**
159
+ * `terraformPinRollout` (#3189). It names no `terraform.roots` key: a rollout
160
+ * moves a module's pin across many roots, found by directory, so it carries no
161
+ * `rootEntity`. `status` and `summary` are the fields an Op reads: the run's
162
+ * outcome and a body for a report step.
163
+ */
164
+ export declare const terraformPinRolloutContract: import("@intentius/chant/op").ActivityContract<{
165
+ module: string;
166
+ from: string;
167
+ to: string;
168
+ roots?: {
169
+ root: string;
170
+ dependsOn?: string[] | undefined;
171
+ tsSource?: string | undefined;
172
+ }[] | undefined;
173
+ canaries?: string[] | undefined;
174
+ wavesFrom?: string | undefined;
175
+ wavesPrefix?: string | undefined;
176
+ mode?: "pull-request" | "report" | undefined;
177
+ base?: string | undefined;
178
+ remote?: string | undefined;
179
+ appliedCheck?: string | undefined;
180
+ cwd?: string | undefined;
181
+ }, {
182
+ module: string;
183
+ from: string;
184
+ to: string;
185
+ mode: "pull-request" | "report";
186
+ base: string;
187
+ status: "complete" | "opened" | "stopped" | "waiting" | "would-open";
188
+ roots: {
189
+ [x: string]: unknown;
190
+ }[];
191
+ waves: {
192
+ [x: string]: unknown;
193
+ }[];
194
+ stop?: string | undefined;
195
+ summary: string;
196
+ }>;
149
197
  //# sourceMappingURL=activity-contracts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA+BH,eAAO,MAAM,qBAAqB;;;;;;;;EASjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAiBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;EAWlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAYjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBrC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;EASnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;EAKtC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;EAgBlC,CAAC"}
1
+ {"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AA+BH,eAAO,MAAM,qBAAqB;;;;;;;;EASjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;EAoBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;EAWlC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAYjC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBrC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;EASnC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;EAKtC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;EAgBlC,CAAC;AAKF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BvC,CAAC"}
@@ -16,6 +16,7 @@
16
16
  */
17
17
  import { type ActivityStep, type NamedActivityStep, type WithStepRefs } from "@intentius/chant/op";
18
18
  import type { TerraformInitArgs, TerraformPlanArgs, TerraformApplyArgs, TerraformShowArgs, ChoudoufuLivePlanArgs, ChoudoufuLiveLsArgs, ChoudoufuLiveCheckArgs, ChoudoufuAdoptArgs } from "./activities/terraform.js";
19
+ import type { TerraformPinRolloutArgs } from "./activities/pin-rollout.js";
19
20
  /** Extra opts every wrapper below accepts alongside its activity's own fields. */
20
21
  type StepOpts = {
21
22
  profile?: ActivityStep["profile"];
@@ -94,5 +95,13 @@ export declare const choudoufuAdopt: (root: string, opts: WithStepRefs<Omit<Chou
94
95
  * provider.
95
96
  */
96
97
  export declare const terraformShow: (root: string, opts?: WithStepRefs<Omit<TerraformShowArgs, "root">> & StepOpts) => NamedActivityStep;
98
+ /**
99
+ * One run of a pin-bump rollout (#3189). `opts` is
100
+ * {@link TerraformPinRolloutArgs} itself. It names no root: the rollout finds
101
+ * the roots that call the module. Defaults to the `fastIdempotent` profile: a
102
+ * repeated run reads the forge again and finds the PR an earlier attempt
103
+ * opened.
104
+ */
105
+ export declare const terraformPinRollout: (opts: WithStepRefs<TerraformPinRolloutArgs> & StepOpts) => NamedActivityStep;
97
106
  export {};
98
107
  //# sourceMappingURL=builders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAEhC,kFAAkF;AAClF,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAGF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAGF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC/D,iBAGF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,SACtB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAClE,iBAOF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAChE,iBAOF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,SACvB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACnE,iBAOF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,QACN,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAOF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAOF,CAAC"}
1
+ {"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../src/op/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,kFAAkF;AAClF,KAAK,QAAQ,GAAG;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAGF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAGF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC/D,iBAGF,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,SACtB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAClE,iBAOF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAChE,iBAOF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,SACvB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KACnE,iBAOF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,QACN,YAAY,CAAC,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAOF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,SACL,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,GAAG,QAAQ,KAC9D,iBAOF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,SAAU,YAAY,CAAC,uBAAuB,CAAC,GAAG,QAAQ,KAAG,iBAG5F,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The pin edit for a root chant generates (#3189): move the pin in the
3
+ * module declaration of its TypeScript source, not in the `.tf` a build
4
+ * writes from it.
5
+ *
6
+ * A module declaration in TypeScript is an object literal with the same
7
+ * arguments the HCL block has: a `source` string, and a `version` string
8
+ * beside a registry source. Any object literal whose `source` is a plain
9
+ * string naming the module counts, whatever function or constructor receives
10
+ * it. The TypeScript compiler parses the file, so a `source:` inside a
11
+ * comment, a template with substitutions, or another string is never a
12
+ * match, and the edit replaces the string literal's content only. Every other
13
+ * byte of the file stays as it was.
14
+ *
15
+ * It needs the TypeScript compiler, so `./index.ts` (the bundled subpath,
16
+ * #3421) does not import it. The rollout takes it as `editTs`.
17
+ */
18
+ import type { PinEditResult, PinRequest } from "./edit.js";
19
+ /** Move `request.module`'s pin in one TypeScript file. */
20
+ export declare function editPinsInTs(text: string, file: string, request: PinRequest): PinEditResult;
21
+ //# sourceMappingURL=edit-ts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-ts.d.ts","sourceRoot":"","sources":["../../src/pin/edit-ts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAiB,aAAa,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAwBvE,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,aAAa,CAgC3F"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The pin edit for hand-written HCL (#3189): move one module's pin from an old
3
+ * version to a new one in a `.tf` file or a `terragrunt.hcl`, and leave every
4
+ * other byte of the file as it was.
5
+ *
6
+ * Three steps, each one a check on the last:
7
+ *
8
+ * 1. The HCL reader (`@cdktn/hcl2json`, the parser the rest of this lexicon
9
+ * reads `.tf` with) parses the file. Its tree says which calls exist and
10
+ * what each one's `source` and `version` are: `module "<name>"` blocks in a
11
+ * `.tf`, and the `terraform` block's `source` in a `terragrunt.hcl`.
12
+ * 2. `./source.ts` decides, per call, whether it names the module and how its
13
+ * pin moves. `./scan.ts` finds the byte offsets of the literal to rewrite,
14
+ * and its unescaped content has to equal the value the reader returned, or
15
+ * the call is refused rather than guessed at.
16
+ * 3. The edited text is parsed again. Its tree has to equal the first tree
17
+ * with only the moved values changed. Anything else throws, and nothing is
18
+ * written.
19
+ *
20
+ * The parser is passed in rather than imported. It is a 1.8 MB wasm package
21
+ * that core loads lazily (`loadHcl2json`), and a caller that bundles this
22
+ * module (terragucci's `tf-rollout` stage, #3421) decides how it is loaded.
23
+ */
24
+ import type { Hcl2Json } from "@intentius/chant/terraform/hcl2json";
25
+ import { type PinMove } from "./source.js";
26
+ /** What to move: a module, named by its source without the pin, from one pin to another. */
27
+ export interface PinRequest {
28
+ module: string;
29
+ from: string;
30
+ to: string;
31
+ }
32
+ /** One module call the edit looked at, and what happened to it. */
33
+ export type PinCallResult = PinMove & {
34
+ /** The file, as the caller named it. */
35
+ file: string;
36
+ /** `module.<name>` in a `.tf`, `terraform` in a `terragrunt.hcl`, or `line <n>` in TypeScript source. */
37
+ call: string;
38
+ };
39
+ /** The edited text and every call that names the module. */
40
+ export interface PinEditResult {
41
+ content: string;
42
+ calls: PinCallResult[];
43
+ }
44
+ /** Whether a file is read as a Terragrunt configuration rather than a `.tf` file. */
45
+ export declare function isTerragruntFile(file: string): boolean;
46
+ /**
47
+ * Move `request.module`'s pin in one file. Calls that name another module are
48
+ * left alone and not reported. A call that names the module and cannot move
49
+ * is reported with its reason and left as it was.
50
+ */
51
+ export declare function editPins(text: string, file: string, request: PinRequest, parser: Hcl2Json): Promise<PinEditResult>;
52
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../src/pin/edit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAGjD,4FAA4F;AAC5F,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,yGAAyG;IACzG,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AA2CD;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,CAAC,CAgDxH"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * What a pin-bump rollout asks the forge (#3189): find a wave's pull request
3
+ * by its branch, open one, and read the checks on the commit a merge made.
4
+ *
5
+ * The default answers through `gh`, the way core's `proposeWorkspaceUpgrade`
6
+ * (#2550) opens its pull request: `gh pr list --head`, `gh pr create`, and
7
+ * `gh api` for the commit's check runs and statuses. A test, or a caller with
8
+ * its own forge client, passes a {@link PinForge} instead.
9
+ */
10
+ import type { CommandRunner } from "@intentius/chant/op/activities/propose-upgrade";
11
+ /** A wave's pull request, as the forge reports it. */
12
+ export interface PinPullRequest {
13
+ url: string;
14
+ state: "open" | "merged" | "closed";
15
+ body: string;
16
+ /** The commit the merge made on the base branch, once merged. */
17
+ mergeCommit?: string;
18
+ }
19
+ /** One check or status on a commit. */
20
+ export interface PinCommitCheck {
21
+ name: string;
22
+ state: "success" | "pending" | "failure";
23
+ }
24
+ export interface PinForge {
25
+ /** The newest pull request whose head is `branch`, in any state, or null. */
26
+ findPullRequest(branch: string): Promise<PinPullRequest | null>;
27
+ /** Open a pull request and return its URL. */
28
+ createPullRequest(input: {
29
+ base: string;
30
+ head: string;
31
+ title: string;
32
+ body: string;
33
+ }): Promise<string>;
34
+ /** The checks and statuses on a commit. */
35
+ commitChecks(sha: string): Promise<PinCommitCheck[]>;
36
+ }
37
+ /** A {@link PinForge} over `gh`, run in `repo`. */
38
+ export declare function ghPinForge(run: CommandRunner, repo: string): PinForge;
39
+ //# sourceMappingURL=forge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forge.d.ts","sourceRoot":"","sources":["../../src/pin/forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AAEpF,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;CAC1C;AAED,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAChE,8CAA8C;IAC9C,iBAAiB,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACvG,2CAA2C;IAC3C,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CACtD;AAgBD,mDAAmD;AACnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAiCrE"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Pin-bump rollouts (#3189): the pin edit, the wave plan, and the run that
3
+ * opens one pull request per wave.
4
+ *
5
+ * This subpath, `@intentius/chant-lexicon-terraform/pin`, bundles without the
6
+ * TypeScript toolchain, zod, or chant's fold, lint and codegen modules, so
7
+ * terragucci's `tf-rollout` stage can run it from one bundled file (#3421).
8
+ * `./bundle.test.ts` holds it to that. The HCL parser is passed in, and the
9
+ * TypeScript editor for generated roots lives in `./edit-ts.ts`, which this
10
+ * index does not import.
11
+ */
12
+ export { readModulePin, movePin, moduleOf, exactVersion, isPinValue, checkPinRequest } from "./source.js";
13
+ export type { ModuleCallPin, PinMove, PinParam } from "./source.js";
14
+ export { editPins, isTerragruntFile } from "./edit.js";
15
+ export type { PinRequest, PinCallResult, PinEditResult } from "./edit.js";
16
+ export { planPinWaves, wavesFromChoudoufu, restrictWaves, terragruntDependencies, PinWavePlanError } from "./waves.js";
17
+ export type { PinRoot, PinWave } from "./waves.js";
18
+ export { ghPinForge } from "./forge.js";
19
+ export type { PinForge, PinPullRequest, PinCommitCheck } from "./forge.js";
20
+ export { runPinRollout, renderPinRollout, pinWaveBranch } from "./rollout.js";
21
+ export type { PinRolloutOptions, PinRolloutResult, PinRolloutMode, PinRootState, PinWaveState, PinWaveStatus, TsPinEditor } from "./rollout.js";
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACvG,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpH,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3E,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Roll a module version out as pin-bump pull requests, one wave at a time
3
+ * (#3189, choudoufu#1749).
4
+ *
5
+ * Each run reads where the rollout stands and does at most one thing:
6
+ *
7
+ * 1. It checks out the base branch in a temporary worktree and reads every
8
+ * root's pin there: at the old version, at the new one, refused (a
9
+ * floating constraint, no pin, an expression), or pinned at something
10
+ * else. Only roots at the old or the new version are in the rollout, so
11
+ * the wave plan is the same on every run.
12
+ * 2. It splits those roots into waves (`./waves.ts`).
13
+ * 3. It walks the waves in order, reading each wave's pull request by its
14
+ * branch. A wave whose PR merged, and whose every moved root reports its
15
+ * apply check as passed on the merge commit, is done. The first wave that
16
+ * is not done decides the run:
17
+ * - no PR yet: open it (one branch, one PR, the pin moved for that wave's
18
+ * roots only), or in `report` mode say it would;
19
+ * - PR open, or merged with an apply still pending: report where it
20
+ * stands and open nothing;
21
+ * - PR closed without merging, or a root whose apply check failed: stop,
22
+ * naming it. The waves after it do not open.
23
+ *
24
+ * That is #2119's gate as a fact: nothing waits. The next run reads the
25
+ * forge again and either moves on or reports the same place.
26
+ *
27
+ * The PR's branch is built from the base branch in a worktree and pushed.
28
+ * The default branch, and whatever the caller has checked out, are never
29
+ * written, as with core's `proposeWorkspaceUpgrade` (#2550). Each PR changes
30
+ * only the files of its wave's roots, so a path-diff selection (GitLab's
31
+ * `rules: changes:`, #3183's affected members) plans exactly those roots.
32
+ *
33
+ * An "applied" root is one whose apply check, named by `appliedCheck`
34
+ * (default `apply/{root}`), passed on the merge commit. That is how a
35
+ * per-root apply job on the merged commit reports today; when the per-PR
36
+ * loop (#3183) lands, its per-member check name is the one to pass.
37
+ */
38
+ import type { Hcl2Json } from "@intentius/chant/terraform/hcl2json";
39
+ import type { CommandRunner } from "@intentius/chant/op/activities/propose-upgrade";
40
+ import { type PinCallResult, type PinEditResult, type PinRequest } from "./edit.js";
41
+ import { type PinRoot, type PinWave } from "./waves.js";
42
+ import { type PinForge } from "./forge.js";
43
+ /** Edits the module declaration in a generated root's TypeScript source (`./edit-ts.ts`). */
44
+ export type TsPinEditor = (text: string, file: string, request: PinRequest) => PinEditResult;
45
+ export type PinRolloutMode = "report" | "pull-request";
46
+ export interface PinRolloutOptions extends PinRequest {
47
+ /** A directory inside the repository. Default: the working directory. */
48
+ cwd?: string;
49
+ /** The roots to roll out. Default: every directory under the repository with a `.tf` file or a `terragrunt.hcl` that calls the module. */
50
+ roots?: PinRoot[];
51
+ /** Roots that form wave 1. */
52
+ canaries?: string[];
53
+ /** A wave plan to use instead of canaries and dependency order, such as {@link wavesFromChoudoufu}'s. */
54
+ waves?: PinWave[];
55
+ /** `report` (default) opens nothing; `pull-request` opens the next wave's PR when it is due. */
56
+ mode?: PinRolloutMode;
57
+ /** The branch PRs target. Default: the remote's default branch. */
58
+ base?: string;
59
+ /** Default `origin`. */
60
+ remote?: string;
61
+ /** The check each moved root's apply reports on the merge commit. `{root}` is the root's directory. Default `apply/{root}`. */
62
+ appliedCheck?: string;
63
+ /** The HCL reader, `loadHcl2json()` from `@intentius/chant/terraform/hcl2json`. */
64
+ parser: Hcl2Json;
65
+ /** The forge. Default: `gh`, through `run`. */
66
+ forge?: PinForge;
67
+ /** Runs `git` (and `gh`, for the default forge). For tests. */
68
+ run?: CommandRunner;
69
+ /** The TypeScript editor for generated roots. Without it, a root with `tsSource` is refused. */
70
+ editTs?: TsPinEditor;
71
+ /** Markdown appended to a wave's PR body, such as the grouped plan summary of #3188 once a caller has the wave's plans. */
72
+ planSummary?: (wave: PinWave) => Promise<string | undefined>;
73
+ }
74
+ /** Where one root's pin stood on the base branch. */
75
+ export interface PinRootState {
76
+ root: string;
77
+ /** `from`: at least one call moves; `to`: every call is already moved; the rest are not in the rollout. */
78
+ state: "from" | "to" | "refused" | "elsewhere" | "absent";
79
+ files: string[];
80
+ calls: PinCallResult[];
81
+ reason?: string;
82
+ }
83
+ export type PinWaveState = "applied" | "nothing-to-move" | "opened" | "would-open" | "open" | "waiting-apply" | "failed" | "closed" | "not-reached";
84
+ export interface PinWaveStatus extends PinWave {
85
+ branch: string;
86
+ state: PinWaveState;
87
+ pr?: string;
88
+ /** Roots whose apply check has not reported yet. */
89
+ pending?: string[];
90
+ /** Roots whose apply check failed. */
91
+ failed?: string[];
92
+ /** Files the wave's PR changes (`opened` and `would-open`). */
93
+ files?: string[];
94
+ }
95
+ export interface PinRolloutResult extends PinRequest {
96
+ mode: PinRolloutMode;
97
+ base: string;
98
+ /**
99
+ * `complete`: every wave applied. `opened`/`would-open`: the next wave's PR
100
+ * was opened, or would be. `waiting`: a PR is open or an apply has not
101
+ * reported. `stopped`: a root failed or a PR closed unmerged, and `stop` says
102
+ * which.
103
+ */
104
+ status: "complete" | "opened" | "would-open" | "waiting" | "stopped";
105
+ roots: PinRootState[];
106
+ waves: PinWaveStatus[];
107
+ stop?: string;
108
+ summary: string;
109
+ }
110
+ /** The branch a wave's PR is opened from. */
111
+ export declare function pinWaveBranch(request: PinRequest, wave: number): string;
112
+ /** Read where a rollout stands, and open the next wave's PR when it is due and `mode` is `pull-request`. */
113
+ export declare function runPinRollout(options: PinRolloutOptions): Promise<PinRolloutResult>;
114
+ /** The rollout for a terminal or a run log. */
115
+ export declare function renderPinRollout(result: Omit<PinRolloutResult, "summary">): string;
116
+ //# sourceMappingURL=rollout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollout.d.ts","sourceRoot":"","sources":["../../src/pin/rollout.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Byte offsets for the attribute values the pin edit rewrites (#3189).
3
+ *
4
+ * `@cdktn/hcl2json` is the reader that says what a file means, and the pin
5
+ * edit asks it first (`./edit.ts`). It gives back values and no positions
6
+ * (`../hcl/value.ts` says why), so it cannot say WHERE in the file a
7
+ * `source` or `version` literal sits. This lexer answers only that: it walks
8
+ * the raw text token by token, skipping comments, quoted strings, template
9
+ * interpolations and heredocs, counts braces, and records each top-level
10
+ * block and the plain string literal of each of its own attributes, with the
11
+ * literal's offsets.
12
+ *
13
+ * It is an HCL tokenizer, not a pattern match over lines: a `source =` inside
14
+ * a comment, a heredoc or another string is never a match, and a block opened
15
+ * on the same line as its attributes reads the same as one split over lines.
16
+ * What it finds is checked against the reader before anything is written:
17
+ * the literal's unescaped value has to equal what hcl2json read for that
18
+ * attribute, and the edited file has to parse to the same tree with only the
19
+ * pinned values changed.
20
+ */
21
+ /** One plain string literal: the offsets of its content, quotes excluded. */
22
+ export interface ScannedLiteral {
23
+ start: number;
24
+ end: number;
25
+ /** The content as written, escapes included. */
26
+ raw: string;
27
+ }
28
+ /** One attribute of a block body. `literal` is set when the value is a single string with no interpolation. */
29
+ export interface ScannedAttribute {
30
+ name: string;
31
+ literal?: ScannedLiteral;
32
+ }
33
+ /** One top-level block: `module "vpc" { ... }`, `terraform { ... }`. */
34
+ export interface ScannedBlock {
35
+ type: string;
36
+ labels: string[];
37
+ /** Offset of the block's type keyword. */
38
+ start: number;
39
+ /** Offset just past the closing brace. */
40
+ end: number;
41
+ /** The block body's own attributes, in file order. Nested blocks' attributes are not included. */
42
+ attributes: ScannedAttribute[];
43
+ }
44
+ /** Thrown when the text is not well-formed enough to place an edit in. */
45
+ export declare class HclScanError extends Error {
46
+ constructor(file: string, message: string);
47
+ }
48
+ /** Every top-level block in `text`, with its own attributes' literals. */
49
+ export declare function scanBlocks(text: string, file: string): ScannedBlock[];
50
+ /** Undo HCL's string escapes, so a literal's raw text compares to the value the reader returned. */
51
+ export declare function unescapeHcl(raw: string): string;
52
+ /** Write a value as the content of an HCL string literal. */
53
+ export declare function escapeHcl(value: string): string;
54
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../src/pin/scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,+GAA+G;AAC/G,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,kGAAkG;IAClG,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAYD,0EAA0E;AAC1E,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAGxC;CACF;AAmID,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAgCrE;AAkDD,oGAAoG;AACpG,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAyB/C;AAED,6DAA6D;AAC7D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Where a module call keeps its pin, and how the pin moves (#3189).
3
+ *
4
+ * A module call names a module and, if it is pinned, one exact version of it.
5
+ * The version sits in one of two places:
6
+ *
7
+ * - the `version` argument, beside a registry `source`
8
+ * (`source = "app.terraform.io/acme/vpc/aws"`, `version = "1.3.0"`);
9
+ * - a query argument of the `source` itself: OpenTofu's `oci://` sources take
10
+ * `?tag=` or `?digest=`, a git source takes `?ref=`, and Terragrunt's
11
+ * `tfr://` source takes `?version=`.
12
+ *
13
+ * The module's identity is the source with the pin taken out, so
14
+ * `oci://r.example.com/m/vpc?tag=1.3.0` and `oci://r.example.com/m/vpc?tag=1.4.0`
15
+ * call the same module.
16
+ *
17
+ * A `version` constraint (`~> 1.4`, `>= 1.4, < 2`) is not a pin. An upstream
18
+ * release changes what such a root runs with no diff to review, and there is
19
+ * no single version to move, so the call is refused with that reason. The
20
+ * same holds for a call with no pin at all.
21
+ *
22
+ * OpenTofu writes an OCI pin as a query argument
23
+ * (https://opentofu.org/docs/language/modules/sources/#oci-distribution-registries),
24
+ * not as a `:tag` or `@sha256:` suffix on the repository, so the query form is
25
+ * the one read here.
26
+ *
27
+ * This module is pure string work over values the HCL reader has already
28
+ * parsed. Finding those values in a file, and writing the new ones back, is
29
+ * `./edit.ts`. #3190 adds an `oci` kind to the lint classifier
30
+ * (`../lint/post-synth/module-source.ts`) with the same parse; the two can
31
+ * share one once both have landed.
32
+ */
33
+ /** The query arguments that carry a pin. */
34
+ export type PinParam = "tag" | "digest" | "ref" | "version";
35
+ /** What a module call pins, read from its `source` and `version`. */
36
+ export interface ModuleCallPin {
37
+ /** The module the call names: its `source` with the pin argument taken out. */
38
+ module: string;
39
+ /** Where the pin is: the `version` argument, or a query argument of `source`. */
40
+ at: "version" | "source";
41
+ /** The query argument holding the pin, when `at` is `source`. */
42
+ param?: PinParam;
43
+ /** The pinned version, tag, digest or ref. Null when there is no pin to move. */
44
+ pin: string | null;
45
+ /** Why the call has no pin to move, when `pin` is null. */
46
+ unpinned?: string;
47
+ }
48
+ /** The outcome of moving one call's pin. */
49
+ export type PinMove = {
50
+ outcome: "moved";
51
+ from: string;
52
+ to: string;
53
+ source: string;
54
+ version?: string;
55
+ } | {
56
+ outcome: "already";
57
+ pin: string;
58
+ } | {
59
+ outcome: "elsewhere";
60
+ pin: string;
61
+ } | {
62
+ outcome: "refused";
63
+ reason: string;
64
+ };
65
+ /**
66
+ * The exact version a `version` argument pins, or null when it is a
67
+ * constraint. `1.4.0` and `= 1.4.0` are exact; `~> 1.4`, `>= 1.4` and
68
+ * `1.4.0, < 2` are not.
69
+ */
70
+ export declare function exactVersion(constraint: string): string | null;
71
+ /** Whether a value can be a pin's new value: an exact version, a tag, a ref or a digest, never a constraint. */
72
+ export declare function isPinValue(value: string): boolean;
73
+ /** Read the pin a module call carries. `version` is the call's `version` argument, when it has one. */
74
+ export declare function readModulePin(source: string, version?: string): ModuleCallPin;
75
+ /**
76
+ * Move a call's pin from `from` to `to`, when the call names `module`.
77
+ * Returns null when it names another module. `version` keeps any `=` it was
78
+ * written with, so `= 1.3.0` becomes `= 1.4.0`.
79
+ */
80
+ export declare function movePin(source: string, version: string | undefined, request: {
81
+ module: string;
82
+ from: string;
83
+ to: string;
84
+ }): PinMove | null;
85
+ /** The module a source names, with any pin taken out, so a caller may name the module by a pinned source. */
86
+ export declare function moduleOf(source: string): string;
87
+ /** Refuse a request whose `to` is not something a pin can hold. */
88
+ export declare function checkPinRequest(request: {
89
+ module: string;
90
+ from: string;
91
+ to: string;
92
+ }): void;
93
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/pin/source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,4CAA4C;AAC5C,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAE5D,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,EAAE,EAAE,SAAS,GAAG,QAAQ,CAAC;IACzB,iEAAiE;IACjE,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,iFAAiF;IACjF,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,4CAA4C;AAC5C,MAAM,MAAM,OAAO,GACf;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAChF;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ3C;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D;AAED,gHAAgH;AAChH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD;AA6CD,uGAAuG;AACvG,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAO7E;AA4CD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,GAAG,IAAI,CAa1I;AAED,6GAA6G;AAC7G,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAM3F"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The wave plan for a pin-bump rollout (#3189): which roots move in which PR.
3
+ *
4
+ * Two sources give the same shape, an ordered list of root lists:
5
+ *
6
+ * - **Declared canaries, then dependency order.** The canaries form wave 1.
7
+ * Every other root lands in the earliest wave after every root it depends
8
+ * on. That is the Kahn layering `chant components fan-out` uses
9
+ * (`resolveComponentGraph`, `@intentius/chant/components/layers`), and the
10
+ * order #3049 gives its gated waves. A canary that depends on a root outside
11
+ * the canaries is refused, since wave 1 would apply before what it reads.
12
+ * - **choudoufu's wave planner** (`choudoufu live-waves -json`, choudoufu#1754).
13
+ * It reads cross-estate references from the estates' own configuration, puts
14
+ * `-canary` roots in wave 1, and emits each wave's roots on their own, so
15
+ * {@link wavesFromChoudoufu} takes its document as it is.
16
+ *
17
+ * A root's dependencies come from the caller (`dependsOn`) and, for a
18
+ * Terragrunt unit, from its `dependency` and `dependencies` blocks
19
+ * ({@link terragruntDependencies}). A dependency on a root outside the
20
+ * rollout orders nothing: it is not moving.
21
+ */
22
+ import type { Hcl2Json } from "@intentius/chant/terraform/hcl2json";
23
+ /** One root in a rollout. `root` is its directory, relative to the repository, with `/` separators. */
24
+ export interface PinRoot {
25
+ root: string;
26
+ /** Roots this one reads, by directory. They land in an earlier wave. */
27
+ dependsOn?: string[];
28
+ /**
29
+ * The TypeScript file a generated root is built from. The pin edit then
30
+ * goes to the module declaration there rather than to the `.tf` chant
31
+ * writes (`./edit-ts.ts`).
32
+ */
33
+ tsSource?: string;
34
+ }
35
+ /** One wave: its number from 1, whether the declared canaries form it, and its roots, sorted. */
36
+ export interface PinWave {
37
+ wave: number;
38
+ canary: boolean;
39
+ roots: string[];
40
+ }
41
+ /** Thrown when the roots cannot be split into waves. The message names the roots. */
42
+ export declare class PinWavePlanError extends Error {
43
+ constructor(message: string);
44
+ }
45
+ /** Canaries first, then dependency order. */
46
+ export declare function planPinWaves(roots: readonly PinRoot[], canaries?: readonly string[]): PinWave[];
47
+ /**
48
+ * The waves of a `choudoufu live-waves -json` document (format version 1).
49
+ * `prefix` is the directory choudoufu ran in, relative to the repository,
50
+ * when its roots are named relative to that rather than to the repository.
51
+ */
52
+ export declare function wavesFromChoudoufu(doc: unknown, prefix?: string): PinWave[];
53
+ /**
54
+ * Keep only the roots in `keep`, renumbering the waves and dropping any left
55
+ * empty. A wave plan from choudoufu covers every root it was given; the
56
+ * rollout moves only the roots that call the module at the old or new pin.
57
+ */
58
+ export declare function restrictWaves(waves: readonly PinWave[], keep: ReadonlySet<string>): PinWave[];
59
+ /**
60
+ * The roots a Terragrunt unit depends on: each `dependency` block's
61
+ * `config_path` and the `dependencies` block's `paths`, resolved against the
62
+ * unit's directory. A path that is an expression is skipped, since it names
63
+ * no directory until Terragrunt evaluates it.
64
+ */
65
+ export declare function terragruntDependencies(root: string, text: string, parser: Hcl2Json): Promise<string[]>;
66
+ //# sourceMappingURL=waves.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"waves.d.ts","sourceRoot":"","sources":["../../src/pin/waves.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAGpE,uGAAuG;AACvG,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iGAAiG;AACjG,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,qFAAqF;AACrF,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED,6CAA6C;AAC7C,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,GAAG,OAAO,EAAE,CAqBnG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,SAAK,GAAG,OAAO,EAAE,CAUvE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,CAO7F;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS5G"}