@intentius/chant 0.102.0 → 0.104.1

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 (471) hide show
  1. package/dist/audit/core.d.ts +2 -0
  2. package/dist/audit/core.d.ts.map +1 -1
  3. package/dist/audit/discover.d.ts.map +1 -1
  4. package/dist/change-set.d.ts +232 -0
  5. package/dist/change-set.d.ts.map +1 -0
  6. package/dist/cli/commands/audit.d.ts +7 -0
  7. package/dist/cli/commands/audit.d.ts.map +1 -1
  8. package/dist/cli/commands/build.d.ts.map +1 -1
  9. package/dist/cli/handlers/build.d.ts.map +1 -1
  10. package/dist/cli/handlers/change-set.d.ts +11 -0
  11. package/dist/cli/handlers/change-set.d.ts.map +1 -0
  12. package/dist/cli/handlers/fan-out.d.ts +33 -0
  13. package/dist/cli/handlers/fan-out.d.ts.map +1 -1
  14. package/dist/cli/handlers/operator.d.ts +7 -0
  15. package/dist/cli/handlers/operator.d.ts.map +1 -1
  16. package/dist/cli/handlers/pr.d.ts +31 -0
  17. package/dist/cli/handlers/pr.d.ts.map +1 -0
  18. package/dist/cli/handlers/run.d.ts.map +1 -1
  19. package/dist/cli/main.d.ts.map +1 -1
  20. package/dist/cli/mcp/op-tools.d.ts.map +1 -1
  21. package/dist/cli/mcp/workspace-tools.d.ts +3 -2
  22. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  23. package/dist/cli/registry.d.ts +63 -1
  24. package/dist/cli/registry.d.ts.map +1 -1
  25. package/dist/components/auto-release.d.ts +16 -0
  26. package/dist/components/auto-release.d.ts.map +1 -1
  27. package/dist/components/capability.d.ts +53 -0
  28. package/dist/components/capability.d.ts.map +1 -1
  29. package/dist/components/changed-files.d.ts +31 -0
  30. package/dist/components/changed-files.d.ts.map +1 -0
  31. package/dist/components/cli-support.d.ts +9 -1
  32. package/dist/components/cli-support.d.ts.map +1 -1
  33. package/dist/components/component.d.ts +24 -0
  34. package/dist/components/component.d.ts.map +1 -1
  35. package/dist/components/deploy-units.d.ts.map +1 -1
  36. package/dist/components/driver.d.ts +13 -0
  37. package/dist/components/driver.d.ts.map +1 -1
  38. package/dist/components/fan-out-output.d.ts +6 -0
  39. package/dist/components/fan-out-output.d.ts.map +1 -1
  40. package/dist/components/fan-out-record.d.ts +41 -0
  41. package/dist/components/fan-out-record.d.ts.map +1 -0
  42. package/dist/components/fan-out-run.d.ts +65 -0
  43. package/dist/components/fan-out-run.d.ts.map +1 -1
  44. package/dist/components/fan-out-support.d.ts +2 -0
  45. package/dist/components/fan-out-support.d.ts.map +1 -1
  46. package/dist/components/fan-out.d.ts +6 -0
  47. package/dist/components/fan-out.d.ts.map +1 -1
  48. package/dist/components/gated-wave-pipeline.d.ts +50 -0
  49. package/dist/components/gated-wave-pipeline.d.ts.map +1 -0
  50. package/dist/components/index.d.ts +1 -1
  51. package/dist/components/index.d.ts.map +1 -1
  52. package/dist/components/layers.d.ts +25 -0
  53. package/dist/components/layers.d.ts.map +1 -0
  54. package/dist/components/pr-pipeline.d.ts +61 -0
  55. package/dist/components/pr-pipeline.d.ts.map +1 -0
  56. package/dist/components/pr-run.d.ts +119 -0
  57. package/dist/components/pr-run.d.ts.map +1 -0
  58. package/dist/components/promote.d.ts.map +1 -1
  59. package/dist/components/verbs/shell.d.ts.map +1 -1
  60. package/dist/components/wave-plan.d.ts +49 -0
  61. package/dist/components/wave-plan.d.ts.map +1 -0
  62. package/dist/gated-waves.d.ts +147 -0
  63. package/dist/gated-waves.d.ts.map +1 -0
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/lexicon.d.ts +48 -0
  67. package/dist/lexicon.d.ts.map +1 -1
  68. package/dist/lifecycle/gate-ledger.d.ts +7 -0
  69. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  70. package/dist/lifecycle/git.d.ts +46 -1
  71. package/dist/lifecycle/git.d.ts.map +1 -1
  72. package/dist/lint/post-synth.d.ts +18 -0
  73. package/dist/lint/post-synth.d.ts.map +1 -1
  74. package/dist/op/activities/activity-contracts.d.ts +126 -0
  75. package/dist/op/activities/activity-contracts.d.ts.map +1 -1
  76. package/dist/op/activities/change-set.d.ts +62 -0
  77. package/dist/op/activities/change-set.d.ts.map +1 -0
  78. package/dist/op/activities/decide.d.ts +2 -0
  79. package/dist/op/activities/decide.d.ts.map +1 -1
  80. package/dist/op/activities/factory.d.ts +137 -0
  81. package/dist/op/activities/factory.d.ts.map +1 -0
  82. package/dist/op/activities/index.d.ts +4 -0
  83. package/dist/op/activities/index.d.ts.map +1 -1
  84. package/dist/op/activity-contract.d.ts.map +1 -1
  85. package/dist/op/builders.d.ts +11 -0
  86. package/dist/op/builders.d.ts.map +1 -1
  87. package/dist/op/decide-backend.d.ts +5 -1
  88. package/dist/op/decide-backend.d.ts.map +1 -1
  89. package/dist/op/decide-read-inputs.d.ts +4 -2
  90. package/dist/op/decide-read-inputs.d.ts.map +1 -1
  91. package/dist/op/factory.d.ts +83 -0
  92. package/dist/op/factory.d.ts.map +1 -0
  93. package/dist/op/index.d.ts +4 -1
  94. package/dist/op/index.d.ts.map +1 -1
  95. package/dist/op/op-ir.d.ts +2 -0
  96. package/dist/op/op-ir.d.ts.map +1 -1
  97. package/dist/op/op-verb-class.d.ts.map +1 -1
  98. package/dist/op/types.d.ts +8 -0
  99. package/dist/op/types.d.ts.map +1 -1
  100. package/dist/op/work-lease-run.d.ts.map +1 -1
  101. package/dist/plan-summary.d.ts +207 -0
  102. package/dist/plan-summary.d.ts.map +1 -0
  103. package/dist/pr-forge.d.ts +105 -0
  104. package/dist/pr-forge.d.ts.map +1 -0
  105. package/dist/pr-loop.d.ts +178 -0
  106. package/dist/pr-loop.d.ts.map +1 -0
  107. package/dist/telemetry-attribution.d.ts +31 -0
  108. package/dist/telemetry-attribution.d.ts.map +1 -1
  109. package/dist/terraform/hcl2json.d.ts +45 -0
  110. package/dist/terraform/hcl2json.d.ts.map +1 -0
  111. package/dist/terraform/parse.d.ts +4 -40
  112. package/dist/terraform/parse.d.ts.map +1 -1
  113. package/dist/vendor/js-yaml-load.d.ts +56 -0
  114. package/dist/vendor/js-yaml-load.d.ts.map +1 -0
  115. package/dist/workspace/box-cli.d.ts +12 -0
  116. package/dist/workspace/box-cli.d.ts.map +1 -0
  117. package/dist/workspace/box-factory.d.ts +27 -3
  118. package/dist/workspace/box-factory.d.ts.map +1 -1
  119. package/dist/workspace/box-listing.d.ts +85 -0
  120. package/dist/workspace/box-listing.d.ts.map +1 -0
  121. package/dist/workspace/box-publish.d.ts +147 -0
  122. package/dist/workspace/box-publish.d.ts.map +1 -0
  123. package/dist/workspace/broker-protocol.d.ts +190 -0
  124. package/dist/workspace/broker-protocol.d.ts.map +1 -0
  125. package/dist/workspace/checks.d.ts.map +1 -1
  126. package/dist/workspace/composites.d.ts +2 -2
  127. package/dist/workspace/composites.d.ts.map +1 -1
  128. package/dist/workspace/conformance/__fixtures__/reference-broker.d.ts +17 -0
  129. package/dist/workspace/conformance/__fixtures__/reference-broker.d.ts.map +1 -0
  130. package/dist/workspace/conformance/broker.d.ts +202 -0
  131. package/dist/workspace/conformance/broker.d.ts.map +1 -0
  132. package/dist/workspace/conformance/index.d.ts +2 -1
  133. package/dist/workspace/conformance/index.d.ts.map +1 -1
  134. package/dist/workspace/conformance/vitest.d.ts +9 -2
  135. package/dist/workspace/conformance/vitest.d.ts.map +1 -1
  136. package/dist/workspace/conformance/writer.d.ts +108 -14
  137. package/dist/workspace/conformance/writer.d.ts.map +1 -1
  138. package/dist/workspace/decide.d.ts +126 -12
  139. package/dist/workspace/decide.d.ts.map +1 -1
  140. package/dist/workspace/decision-points.schema.json +11 -4
  141. package/dist/workspace/declaration.d.ts +65 -0
  142. package/dist/workspace/declaration.d.ts.map +1 -1
  143. package/dist/workspace/declaration.schema.json +153 -4
  144. package/dist/workspace/environments.d.ts +36 -10
  145. package/dist/workspace/environments.d.ts.map +1 -1
  146. package/dist/workspace/factory-rules.d.ts +180 -0
  147. package/dist/workspace/factory-rules.d.ts.map +1 -0
  148. package/dist/workspace/init.d.ts +21 -0
  149. package/dist/workspace/init.d.ts.map +1 -1
  150. package/dist/workspace/intent-cli.d.ts +1 -1
  151. package/dist/workspace/intent-cli.d.ts.map +1 -1
  152. package/dist/workspace/intent-record.d.ts +28 -1
  153. package/dist/workspace/intent-record.d.ts.map +1 -1
  154. package/dist/workspace/intent.d.ts +102 -5
  155. package/dist/workspace/intent.d.ts.map +1 -1
  156. package/dist/workspace/json-edit.d.ts +24 -0
  157. package/dist/workspace/json-edit.d.ts.map +1 -0
  158. package/dist/workspace/jsonc.d.ts +11 -0
  159. package/dist/workspace/jsonc.d.ts.map +1 -1
  160. package/dist/workspace/kinds.d.ts +48 -0
  161. package/dist/workspace/kinds.d.ts.map +1 -1
  162. package/dist/workspace/lexicon-symbols.d.ts +29 -0
  163. package/dist/workspace/lexicon-symbols.d.ts.map +1 -0
  164. package/dist/workspace/lineage-upgrade.d.ts +31 -2
  165. package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
  166. package/dist/workspace/point-answer.schema.json +42 -2
  167. package/dist/workspace/points-cli.d.ts +10 -3
  168. package/dist/workspace/points-cli.d.ts.map +1 -1
  169. package/dist/workspace/points.d.ts +66 -5
  170. package/dist/workspace/points.d.ts.map +1 -1
  171. package/dist/workspace/reason-codes.d.ts +33 -4
  172. package/dist/workspace/reason-codes.d.ts.map +1 -1
  173. package/dist/workspace/record-sessions.d.ts +5 -7
  174. package/dist/workspace/record-sessions.d.ts.map +1 -1
  175. package/dist/workspace/records-cli.d.ts +7 -0
  176. package/dist/workspace/records-cli.d.ts.map +1 -1
  177. package/dist/workspace/records-close.d.ts +7 -3
  178. package/dist/workspace/records-close.d.ts.map +1 -1
  179. package/dist/workspace/records-write.d.ts +66 -6
  180. package/dist/workspace/records-write.d.ts.map +1 -1
  181. package/dist/workspace/records.d.ts +28 -9
  182. package/dist/workspace/records.d.ts.map +1 -1
  183. package/dist/workspace/runs-cli.d.ts +138 -6
  184. package/dist/workspace/runs-cli.d.ts.map +1 -1
  185. package/dist/workspace/runs.d.ts +132 -11
  186. package/dist/workspace/runs.d.ts.map +1 -1
  187. package/dist/workspace/session-kinds.d.ts +1 -1
  188. package/dist/workspace/session-kinds.d.ts.map +1 -1
  189. package/dist/workspace/squash.d.ts +80 -0
  190. package/dist/workspace/squash.d.ts.map +1 -0
  191. package/dist/workspace/status-gates.d.ts +2 -0
  192. package/dist/workspace/status-gates.d.ts.map +1 -1
  193. package/dist/workspace/status.d.ts +54 -0
  194. package/dist/workspace/status.d.ts.map +1 -1
  195. package/dist/workspace/symbols.d.ts +16 -5
  196. package/dist/workspace/symbols.d.ts.map +1 -1
  197. package/dist/workspace/trust/run-commits.d.ts +46 -0
  198. package/dist/workspace/trust/run-commits.d.ts.map +1 -0
  199. package/dist/workspace/trust/run-statement.d.ts +128 -0
  200. package/dist/workspace/trust/run-statement.d.ts.map +1 -0
  201. package/dist/workspace/trust/seal.d.ts +6 -1
  202. package/dist/workspace/trust/seal.d.ts.map +1 -1
  203. package/dist/workspace/trust/verify-cli.d.ts +1 -1
  204. package/dist/workspace/trust/verify.d.ts +16 -2
  205. package/dist/workspace/trust/verify.d.ts.map +1 -1
  206. package/dist/workspace/wip-cli.d.ts +21 -0
  207. package/dist/workspace/wip-cli.d.ts.map +1 -0
  208. package/dist/workspace/wip.d.ts +268 -0
  209. package/dist/workspace/wip.d.ts.map +1 -0
  210. package/dist/workspace/work-cli.d.ts.map +1 -1
  211. package/dist/workspace/work-evidence.d.ts +1 -1
  212. package/dist/workspace/work-evidence.d.ts.map +1 -1
  213. package/dist/workspace/work-size.d.ts +55 -0
  214. package/dist/workspace/work-size.d.ts.map +1 -0
  215. package/dist/workspace/workspace-kinds.schema.json +122 -0
  216. package/dist/workspace/write-lock-cli.d.ts +60 -0
  217. package/dist/workspace/write-lock-cli.d.ts.map +1 -0
  218. package/dist/workspace/write-lock.d.ts +152 -0
  219. package/dist/workspace/write-lock.d.ts.map +1 -0
  220. package/dist/workspace/write-scope.d.ts +6 -2
  221. package/dist/workspace/write-scope.d.ts.map +1 -1
  222. package/dist/yaml.d.ts +1 -1
  223. package/dist/yaml.d.ts.map +1 -1
  224. package/package.json +6 -1
  225. package/src/__fixtures__/change-set/lifecycle-plan.floci.json +59 -0
  226. package/src/__fixtures__/change-set/lifecycle-v1.ts.txt +4 -0
  227. package/src/__fixtures__/change-set/lifecycle-v2.ts.txt +4 -0
  228. package/src/__fixtures__/change-set/lifecycle.change-set.golden.json +95 -0
  229. package/src/__fixtures__/change-set/warden.change-set.golden.json +106 -0
  230. package/src/__fixtures__/change-set/warden.plan.json +44 -0
  231. package/src/__fixtures__/plan-summary/normalization-vectors.json +1593 -0
  232. package/src/__fixtures__/pr-loop/pr-apply-applied.note.golden.md +31 -0
  233. package/src/__fixtures__/pr-loop/pr-apply-refused.note.golden.md +31 -0
  234. package/src/__fixtures__/pr-loop/pr-plan.golden.json +127 -0
  235. package/src/__fixtures__/pr-loop/pr-plan.note.golden.md +37 -0
  236. package/src/audit/core.test.ts +15 -0
  237. package/src/audit/core.ts +8 -2
  238. package/src/audit/discover.test.ts +11 -0
  239. package/src/audit/discover.ts +7 -2
  240. package/src/change-set-bundle.test.ts +57 -0
  241. package/src/change-set.test.ts +215 -0
  242. package/src/change-set.ts +445 -0
  243. package/src/cli/commands/audit-opt-in.test.ts +54 -0
  244. package/src/cli/commands/audit.ts +29 -2
  245. package/src/cli/commands/build.test.ts +19 -0
  246. package/src/cli/commands/build.ts +3 -2
  247. package/src/cli/handlers/build.ts +13 -1
  248. package/src/cli/handlers/change-set.test.ts +56 -0
  249. package/src/cli/handlers/change-set.ts +44 -0
  250. package/src/cli/handlers/fan-out.test.ts +221 -2
  251. package/src/cli/handlers/fan-out.ts +165 -75
  252. package/src/cli/handlers/graph.ts +3 -0
  253. package/src/cli/handlers/operator.test.ts +21 -0
  254. package/src/cli/handlers/operator.ts +34 -3
  255. package/src/cli/handlers/pr.ts +373 -0
  256. package/src/cli/handlers/run.ts +1 -0
  257. package/src/cli/main.test.ts +20 -0
  258. package/src/cli/main.ts +185 -23
  259. package/src/cli/mcp/never-over-mcp.test.ts +101 -0
  260. package/src/cli/mcp/op-tools.ts +24 -2
  261. package/src/cli/mcp/workspace-tools.test.ts +1 -1
  262. package/src/cli/mcp/workspace-tools.ts +34 -6
  263. package/src/cli/registry.ts +63 -1
  264. package/src/components/auto-release.ts +1 -1
  265. package/src/components/capability.ts +55 -0
  266. package/src/components/changed-files.ts +66 -0
  267. package/src/components/cli-support.ts +28 -5
  268. package/src/components/component.schema.json +17 -0
  269. package/src/components/component.ts +25 -0
  270. package/src/components/deploy-units.ts +3 -0
  271. package/src/components/driver.test.ts +52 -0
  272. package/src/components/driver.ts +31 -13
  273. package/src/components/fan-out-output.ts +42 -1
  274. package/src/components/fan-out-record.ts +69 -0
  275. package/src/components/fan-out-run.test.ts +17 -0
  276. package/src/components/fan-out-run.ts +304 -1
  277. package/src/components/fan-out-support.ts +3 -0
  278. package/src/components/fan-out-waves.test.ts +375 -0
  279. package/src/components/fan-out.ts +18 -17
  280. package/src/components/gated-wave-pipeline.ts +82 -0
  281. package/src/components/index.ts +1 -0
  282. package/src/components/layers.ts +30 -0
  283. package/src/components/pr-pipeline.ts +91 -0
  284. package/src/components/pr-run.test.ts +205 -0
  285. package/src/components/pr-run.ts +280 -0
  286. package/src/components/promote.ts +5 -0
  287. package/src/components/verbs/shell.test.ts +11 -0
  288. package/src/components/verbs/shell.ts +7 -3
  289. package/src/components/wave-plan.ts +124 -0
  290. package/src/discovery/sandbox/bundle.ts +1 -1
  291. package/src/gated-waves-bundle.test.ts +62 -0
  292. package/src/gated-waves.test.ts +118 -0
  293. package/src/gated-waves.ts +240 -0
  294. package/src/index.ts +1 -0
  295. package/src/lexicon.ts +51 -0
  296. package/src/lifecycle/gate-ledger.ts +7 -0
  297. package/src/lifecycle/git.ts +102 -16
  298. package/src/lint/post-synth.test.ts +19 -0
  299. package/src/lint/post-synth.ts +19 -1
  300. package/src/meta/declared-imports.test.ts +1 -1
  301. package/src/op/activities/activity-contracts.ts +84 -0
  302. package/src/op/activities/change-set.ts +114 -0
  303. package/src/op/activities/decide.ts +3 -0
  304. package/src/op/activities/factory.ts +675 -0
  305. package/src/op/activities/index.ts +6 -0
  306. package/src/op/activity-contract.test.ts +21 -1
  307. package/src/op/activity-contract.ts +19 -9
  308. package/src/op/builders.ts +23 -0
  309. package/src/op/decide-backend.ts +5 -1
  310. package/src/op/decide-read-inputs.ts +33 -5
  311. package/src/op/factory.e2e.test.ts +232 -0
  312. package/src/op/factory.ts +118 -0
  313. package/src/op/index.ts +9 -1
  314. package/src/op/op-ir.test.ts +9 -0
  315. package/src/op/op-ir.ts +4 -0
  316. package/src/op/op-verb-class.ts +3 -0
  317. package/src/op/types.ts +8 -0
  318. package/src/op/work-lease-run.ts +3 -0
  319. package/src/plan-summary.test.ts +263 -0
  320. package/src/plan-summary.ts +845 -0
  321. package/src/pr-forge.test.ts +237 -0
  322. package/src/pr-forge.ts +332 -0
  323. package/src/pr-loop-bundle.test.ts +46 -0
  324. package/src/pr-loop.test.ts +171 -0
  325. package/src/pr-loop.ts +324 -0
  326. package/src/telemetry-attribution.test.ts +23 -1
  327. package/src/telemetry-attribution.ts +51 -0
  328. package/src/terraform/hcl2json.test.ts +21 -0
  329. package/src/terraform/hcl2json.ts +81 -0
  330. package/src/terraform/parse.ts +11 -74
  331. package/src/vendor/js-yaml-load.test.ts +115 -0
  332. package/src/vendor/js-yaml-load.ts +1939 -0
  333. package/src/workspace/__fixtures__/studio-template-84c8b21.json +1 -1
  334. package/src/workspace/app-kind.test.ts +196 -0
  335. package/src/workspace/box-cli.ts +113 -0
  336. package/src/workspace/box-factory.test.ts +4 -1
  337. package/src/workspace/box-factory.ts +37 -4
  338. package/src/workspace/box-listing-write.schema.json +204 -0
  339. package/src/workspace/box-listing.test.ts +234 -0
  340. package/src/workspace/box-listing.ts +324 -0
  341. package/src/workspace/box-publish.schema.json +498 -0
  342. package/src/workspace/box-publish.test.ts +204 -0
  343. package/src/workspace/box-publish.ts +420 -0
  344. package/src/workspace/box-ship.test.ts +96 -0
  345. package/src/workspace/broker-protocol.schema.json +186 -0
  346. package/src/workspace/broker-protocol.test.ts +122 -0
  347. package/src/workspace/broker-protocol.ts +317 -0
  348. package/src/workspace/builder-tiers.test.ts +146 -0
  349. package/src/workspace/change-set.schema.json +460 -0
  350. package/src/workspace/chant-migrations.e2e.test.ts +17 -5
  351. package/src/workspace/checks/boxes.test.ts +3 -0
  352. package/src/workspace/checks.ts +10 -3
  353. package/src/workspace/component-environments.test.ts +105 -0
  354. package/src/workspace/composites.schema.json +23 -4
  355. package/src/workspace/composites.test.ts +8 -8
  356. package/src/workspace/composites.ts +13 -2
  357. package/src/workspace/conformance/__fixture__/decisions/decision.schema.json +2 -2
  358. package/src/workspace/conformance/__fixtures__/reference-broker.ts +207 -0
  359. package/src/workspace/conformance/__writer_fixture__/answers/answer.kind.mjs +7 -2
  360. package/src/workspace/conformance/__writer_fixture__/answers/answer.schema.json +42 -2
  361. package/src/workspace/conformance/__writer_fixture__/contracts/contract.kind.mjs +37 -0
  362. package/src/workspace/conformance/__writer_fixture__/contracts/contract.schema.json +213 -0
  363. package/src/workspace/conformance/__writer_fixture__/decisions/points.json +96 -0
  364. package/src/workspace/conformance/__writer_fixture__/drivers/driver.kind.mjs +15 -0
  365. package/src/workspace/conformance/__writer_fixture__/drivers/driver.schema.json +38 -0
  366. package/src/workspace/conformance/__writer_fixture__/sessions/session.kind.mjs +14 -8
  367. package/src/workspace/conformance/__writer_fixture__/sessions/session.schema.json +187 -6
  368. package/src/workspace/conformance/__writer_fixture__/work/work.schema.json +25 -0
  369. package/src/workspace/conformance/broker.test.ts +122 -0
  370. package/src/workspace/conformance/broker.ts +792 -0
  371. package/src/workspace/conformance/conformance.e2e.test.ts +2 -1
  372. package/src/workspace/conformance/index.mjs +22 -1
  373. package/src/workspace/conformance/index.ts +5 -1
  374. package/src/workspace/conformance/vitest.ts +33 -1
  375. package/src/workspace/conformance/writer-conformance.e2e.test.ts +49 -3
  376. package/src/workspace/conformance/writer.test.ts +32 -2
  377. package/src/workspace/conformance/writer.ts +339 -28
  378. package/src/workspace/decide.test.ts +208 -4
  379. package/src/workspace/decide.ts +427 -73
  380. package/src/workspace/decision-points.schema.json +11 -4
  381. package/src/workspace/declaration.schema.json +153 -4
  382. package/src/workspace/declaration.ts +141 -0
  383. package/src/workspace/environments.ts +66 -14
  384. package/src/workspace/factory-rules.test.ts +62 -0
  385. package/src/workspace/factory-rules.ts +218 -0
  386. package/src/workspace/graph-cli.ts +2 -2
  387. package/src/workspace/graph.schema.json +67 -0
  388. package/src/workspace/identity.test.ts +23 -0
  389. package/src/workspace/init.ts +82 -2
  390. package/src/workspace/intent-cli.ts +26 -9
  391. package/src/workspace/intent-patch-id.test.ts +162 -0
  392. package/src/workspace/intent-record.schema.json +130 -3
  393. package/src/workspace/intent-record.ts +74 -28
  394. package/src/workspace/intent-reviews.test.ts +76 -0
  395. package/src/workspace/intent-squash.test.ts +213 -0
  396. package/src/workspace/intent-why.test.ts +5 -5
  397. package/src/workspace/intent.schema.json +234 -4
  398. package/src/workspace/intent.ts +260 -66
  399. package/src/workspace/json-edit.test.ts +121 -0
  400. package/src/workspace/json-edit.ts +142 -0
  401. package/src/workspace/jsonc.ts +20 -0
  402. package/src/workspace/kinds.ts +157 -2
  403. package/src/workspace/lexicon-symbols.test.ts +148 -0
  404. package/src/workspace/lexicon-symbols.ts +125 -0
  405. package/src/workspace/lineage-upgrade.test.ts +63 -0
  406. package/src/workspace/lineage-upgrade.ts +146 -5
  407. package/src/workspace/plan-summary.schema.json +155 -0
  408. package/src/workspace/point-answer.schema.json +42 -2
  409. package/src/workspace/points-cli.ts +42 -16
  410. package/src/workspace/points-write.schema.json +162 -4
  411. package/src/workspace/points.schema.json +157 -2
  412. package/src/workspace/points.test.ts +13 -1
  413. package/src/workspace/points.ts +118 -12
  414. package/src/workspace/pr-report.schema.json +95 -0
  415. package/src/workspace/profiles.test.ts +159 -0
  416. package/src/workspace/read-contract.test.ts +2 -2
  417. package/src/workspace/reason-codes.test.ts +13 -1
  418. package/src/workspace/reason-codes.ts +38 -4
  419. package/src/workspace/record-sessions.ts +9 -8
  420. package/src/workspace/records-amend.schema.json +78 -0
  421. package/src/workspace/records-cli.ts +20 -6
  422. package/src/workspace/records-close.schema.json +78 -0
  423. package/src/workspace/records-close.ts +31 -7
  424. package/src/workspace/records-concurrent.e2e.test.ts +135 -0
  425. package/src/workspace/records-concurrent.test.ts +145 -0
  426. package/src/workspace/records-formats.test.ts +46 -10
  427. package/src/workspace/records-new.schema.json +7 -0
  428. package/src/workspace/records-review.schema.json +78 -0
  429. package/src/workspace/records-sessions-write.test.ts +69 -0
  430. package/src/workspace/records-sessions.test.ts +22 -0
  431. package/src/workspace/records-write.ts +192 -25
  432. package/src/workspace/records.schema.json +16 -0
  433. package/src/workspace/records.ts +50 -9
  434. package/src/workspace/reference-kinds/app/package.json +10 -0
  435. package/src/workspace/reference-kinds/app/workspace-kinds.json +45 -0
  436. package/src/workspace/run-statement.schema.json +622 -0
  437. package/src/workspace/runs-cli.ts +343 -14
  438. package/src/workspace/runs-statement.test.ts +239 -0
  439. package/src/workspace/runs-write.schema.json +416 -5
  440. package/src/workspace/runs.schema.json +451 -4
  441. package/src/workspace/runs.test.ts +39 -0
  442. package/src/workspace/runs.ts +296 -35
  443. package/src/workspace/session-kinds.ts +3 -3
  444. package/src/workspace/squash.ts +198 -0
  445. package/src/workspace/status-contract.test.ts +5 -2
  446. package/src/workspace/status-gates.ts +3 -1
  447. package/src/workspace/status.schema.json +126 -3
  448. package/src/workspace/status.ts +90 -1
  449. package/src/workspace/symbols.ts +20 -9
  450. package/src/workspace/trust/run-commits.ts +115 -0
  451. package/src/workspace/trust/run-statement.ts +226 -0
  452. package/src/workspace/trust/seal.ts +8 -2
  453. package/src/workspace/trust/verify-cli.ts +6 -5
  454. package/src/workspace/trust/verify.ts +39 -6
  455. package/src/workspace/wip-cli.ts +97 -0
  456. package/src/workspace/wip-write.schema.json +504 -0
  457. package/src/workspace/wip.schema.json +334 -0
  458. package/src/workspace/wip.test.ts +294 -0
  459. package/src/workspace/wip.ts +753 -0
  460. package/src/workspace/work-cli.ts +3 -0
  461. package/src/workspace/work-evidence.schema.json +3 -0
  462. package/src/workspace/work-size.test.ts +77 -0
  463. package/src/workspace/work-size.ts +93 -0
  464. package/src/workspace/workspace-kinds.schema.json +122 -0
  465. package/src/workspace/write-lock-cli.ts +131 -0
  466. package/src/workspace/write-lock.schema.json +172 -0
  467. package/src/workspace/write-lock.test.ts +189 -0
  468. package/src/workspace/write-lock.ts +474 -0
  469. package/src/workspace/write-scope.test.ts +16 -1
  470. package/src/workspace/write-scope.ts +33 -11
  471. package/src/yaml.ts +31 -21
@@ -0,0 +1,207 @@
1
+ /**
2
+ * The grouped plan summary (#3188): a view over a change-set document
3
+ * (`./change-set.ts`) that says how many members take the same change, which
4
+ * take something more, and every destroy, replacement, failure and hole by
5
+ * name. It is what reviewers read in an MR or PR note. Gates never bind it;
6
+ * they bind the document's digest.
7
+ *
8
+ * ## What "the same change" means
9
+ *
10
+ * A unit is a member of the document, or, when the document has one member,
11
+ * one resource instance of it; instances group only with instances of the
12
+ * same expansion (the address with its instance keys removed). Two units
13
+ * take the same change when their normalized changes are equal as
14
+ * multisets. A normalized change is:
15
+ *
16
+ * - the action. `no-op` entries are dropped.
17
+ * - the address, with every instance key removed and the unit's tokens
18
+ * stripped from module call names and the resource name. The type is
19
+ * never touched.
20
+ * - each attribute the entry carries (the change-set adapters carry only
21
+ * the attributes a change writes), with the unit's tokens stripped from
22
+ * every string value. A sensitive attribute compares by its path alone,
23
+ * since the document carries no value for it.
24
+ *
25
+ * A unit's tokens are what names it: for a member, its scope (the estate or
26
+ * environment) and the last path segment of its name; for an instance, its
27
+ * own instance keys. Each is also tried with `-` and `_` swapped. A token
28
+ * is stripped only where it stands as a whole word, and one under three
29
+ * characters must also touch a `-` or `_`, so the key `1` leaves
30
+ * `10.1.0.0/16` alone. choudoufu's `tofu-estate` and `tofu-address` markers
31
+ * normalize away only when they hold the unit's own estate or address.
32
+ * Nothing else is stripped.
33
+ *
34
+ * An `import` block, a forget (a `removed` block or `destroy = false`, the
35
+ * plan action `forget`) and a triggered Terraform action (`action_invocations`)
36
+ * each get a named list of their own. A forget is not a destroy and is never
37
+ * in `destroys`; an import is part of its entry's change, so an entry that
38
+ * imports never groups with the same change without the import, and a triggered
39
+ * action is part of its unit's change the same way.
40
+ *
41
+ * A provisional member (one planned before what it reads applied, #3416)
42
+ * groups only with other provisional members, and its group says so: the
43
+ * flag is part of the group's id, so the same change planned for real and
44
+ * planned on stand-in values never share a group.
45
+ *
46
+ * These are choudoufu's rules for `live-summary` (choudoufu#1753). The two
47
+ * implementations are kept together by one table of test vectors both run
48
+ * (`__fixtures__/plan-summary/normalization-vectors.json`), per the ruling
49
+ * recorded on #3188.
50
+ *
51
+ * ## The import graph
52
+ *
53
+ * terragucci runs this in customer CI from one bundled file (#3421). It
54
+ * imports `./lifecycle/plan-digest` and types only, as `./change-set` does,
55
+ * and `change-set-bundle.test.ts` holds that.
56
+ */
57
+ import type { ChangeSetAction, ChangeSetDocument, ChangeSetSideEffect } from "./change-set.js";
58
+ /** The schema a plan summary names in `$schema`. */
59
+ export declare const PLAN_SUMMARY_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/plan-summary/v1/plan-summary.schema.json";
60
+ /** The read-contract version the summary follows. */
61
+ export declare const PLAN_SUMMARY_CONTRACT = 1;
62
+ /**
63
+ * The most characters a GitHub issue or pull request comment body may hold.
64
+ * The REST API refuses a longer one with "Body is too long (maximum is 65536
65
+ * characters)". GitHub documents no figure; this is the refusal's own.
66
+ */
67
+ export declare const GITHUB_COMMENT_LIMIT = 65536;
68
+ /**
69
+ * The most characters a GitLab note may hold, merge-request notes included:
70
+ * "Limited to 1,000,000 characters" (https://docs.gitlab.com/api/notes/).
71
+ */
72
+ export declare const GITLAB_NOTE_LIMIT = 1000000;
73
+ /** What a group's units are: whole members, or the instances of one member. */
74
+ export type PlanSummaryUnit = "member" | "instance";
75
+ /** One distinct normalized change of a group. */
76
+ export interface PlanSummaryChange {
77
+ /** What a reader sees: the action's symbol, the normalized address and the attributes written. */
78
+ line: string;
79
+ action: ChangeSetAction;
80
+ /** How many times one unit makes this change. */
81
+ count: number;
82
+ /** The baseline group whose change at the same address and action this one differs from. */
83
+ differsFrom?: string;
84
+ /** The attributes it differs in. Values are never printed. */
85
+ differsIn?: string[];
86
+ }
87
+ /** One destroy or replacement, by its real address. */
88
+ export interface PlanSummaryDestroy {
89
+ member: string;
90
+ address: string;
91
+ type: string;
92
+ action: "delete" | "replace";
93
+ deposed?: string;
94
+ }
95
+ /** One resource an `import` block brings into state. */
96
+ export interface PlanSummaryImport {
97
+ member: string;
98
+ address: string;
99
+ type: string;
100
+ /** What else the plan does to it: `no-op` when the import changes nothing, else `update`, `create` and so on. */
101
+ action: ChangeSetAction;
102
+ }
103
+ /** One resource a plan stops tracking and leaves running (`removed` with `destroy = false`). It is not a destroy. */
104
+ export interface PlanSummaryForget {
105
+ member: string;
106
+ address: string;
107
+ type: string;
108
+ deposed?: string;
109
+ }
110
+ /** A provider-defined side effect an apply runs: a triggered Terraform action. */
111
+ export type PlanSummarySideEffect = ChangeSetSideEffect;
112
+ export interface PlanSummaryGroup {
113
+ /** Twelve hex characters over the group's normalized changes: the same change gets the same id in every run. */
114
+ id: string;
115
+ /** For instance groups, the expansion the instances belong to. */
116
+ resource?: string;
117
+ /** Member names, or instance addresses. */
118
+ units: string[];
119
+ /** A group of one beside other groups of the same expansion. */
120
+ outlier: boolean;
121
+ /** Units whose plans change nothing. */
122
+ noChanges: boolean;
123
+ changes: PlanSummaryChange[];
124
+ /** The group whose whole change this one contains; `plus` is what it adds. */
125
+ extends?: string;
126
+ plus?: PlanSummaryChange[];
127
+ /** Every destroy and replacement any unit of the group makes. */
128
+ destroys: PlanSummaryDestroy[];
129
+ /** Every triggered action any unit of the group runs. */
130
+ sideEffects: PlanSummarySideEffect[];
131
+ /** Its units are provisional plans: previews no approval covers. Absent on a group of real plans. */
132
+ provisional?: true;
133
+ }
134
+ /** A member that failed to plan. It is never in a group. */
135
+ export interface PlanSummaryFailure {
136
+ member: string;
137
+ scope?: string;
138
+ reason: string;
139
+ }
140
+ /** An address a member's planner could not read. */
141
+ export interface PlanSummaryHole {
142
+ member: string;
143
+ address: string;
144
+ type?: string;
145
+ reason: string;
146
+ }
147
+ export interface PlanSummary {
148
+ $schema: typeof PLAN_SUMMARY_SCHEMA_ID;
149
+ contract: typeof PLAN_SUMMARY_CONTRACT;
150
+ /** The digest of the change-set document summarized. */
151
+ changeSet: string;
152
+ unit: PlanSummaryUnit;
153
+ /** Members, failed ones included, or the changing instances of the one member. */
154
+ units: number;
155
+ groups: PlanSummaryGroup[];
156
+ failed: PlanSummaryFailure[];
157
+ /** Every destroy and replacement in the document, failed members' included, sorted by member and address. */
158
+ destroys: PlanSummaryDestroy[];
159
+ /** Every import, in the document, sorted by member and address. Imports are never destroys. */
160
+ imports: PlanSummaryImport[];
161
+ /** Every forget in the document, sorted by member and address. A forget is never in `destroys`. */
162
+ forgets: PlanSummaryForget[];
163
+ /** Every triggered action in the document, sorted by member and address. */
164
+ sideEffects: PlanSummarySideEffect[];
165
+ holes: PlanSummaryHole[];
166
+ }
167
+ export interface GroupChangeSetOptions {
168
+ /** `member` groups whole members; `instance` groups one member's instances. Default: `instance` for a one-member document, else `member`. */
169
+ unit?: PlanSummaryUnit;
170
+ }
171
+ /** An address without its instance keys, and the keys, decoded: `module.a["x"].b.c[0]` is `module.a.b.c` with `["x", "0"]`. */
172
+ export declare function splitInstanceKeys(address: string): {
173
+ bare: string;
174
+ keys: string[];
175
+ };
176
+ /** The value a `tofu-address` marker holds for `address`. */
177
+ export declare function escapeMarkerAddress(address: string): string;
178
+ /**
179
+ * Group a change-set document's units by their normalized changes. Failed
180
+ * members are listed with their reasons and never grouped. Every delete and
181
+ * replace the document holds is in `destroys`, and each also in its unit's
182
+ * group; every hole is in `holes`.
183
+ */
184
+ export declare function groupChangeSet(doc: ChangeSetDocument, options?: GroupChangeSetOptions): PlanSummary;
185
+ /** The first line: units, groups, failures, destroys and holes. */
186
+ export declare function planSummaryHeadline(s: PlanSummary): string;
187
+ /** The summary for a terminal. Destroys, failures and holes come first, then every group. */
188
+ export declare function renderPlanSummaryText(s: PlanSummary): string;
189
+ export interface RenderMarkdownOptions {
190
+ /** The most characters (code points) the note may hold. Default {@link GITHUB_COMMENT_LIMIT}. */
191
+ limit?: number;
192
+ /** The command that prints the whole summary, named when the note is cut. */
193
+ command?: string;
194
+ }
195
+ /**
196
+ * The summary as an MR or PR note of at most `limit` characters.
197
+ *
198
+ * Blocks come in a fixed order: the headline, every destroy and
199
+ * replacement, every forget, import and triggered action, every failed member, every hole, then the groups largest
200
+ * first. When the whole does not fit, groups are dropped from the end, never
201
+ * cut in the middle, and a closing line names how many groups, units and
202
+ * destroys it left out. The destroy, failure and hole lines are cut only
203
+ * when they alone exceed the limit, from the end, and the closing line
204
+ * counts those too.
205
+ */
206
+ export declare function renderPlanSummaryMarkdown(s: PlanSummary, options?: RenderMarkdownOptions): string;
207
+ //# sourceMappingURL=plan-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-summary.d.ts","sourceRoot":"","sources":["../src/plan-summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAsB,iBAAiB,EAAmC,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEjJ,oDAAoD;AACpD,eAAO,MAAM,sBAAsB,0FAA0F,CAAC;AAE9H,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,iBAA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C7I,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB;AA6ED,+HAA+H;AAC/H,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CA6BnF;AA2BD,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB3D;AAoSD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,GAAE,qBAA0B,GAAG,WAAW,CA2BvG;AAUD,mEAAmE;AACnE,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAW1D;AAqCD,6FAA6F;AAC7F,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAmC5D;AAED,MAAM,WAAW,qBAAqB;IACpC,iGAAiG;IACjG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,CA2DrG"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * What the pull-request loop (#3183) asks of a forge: keep one note on the
3
+ * pull request up to date, set a commit status per stage, list who approved
4
+ * the pull request, and find the pull request that merged a commit.
5
+ *
6
+ * GitHub and Forgejo speak the same REST shapes for the first three, at
7
+ * different base URLs (`$GITHUB_API_URL` is right on both, #2305); they part
8
+ * on the commit-to-pull-request lookup and on review states. GitLab has its
9
+ * own API for all four. Each client takes a `fetch`, so the tests drive them
10
+ * with a recording fake and no network.
11
+ *
12
+ * A reviewer is named the way #3163 names a person: `github:<login>`,
13
+ * `gitlab:<login>`, or `<forge>@<host>:<login>` off the forge's default host.
14
+ * The apply compares that string with the approval's `resolvedBy`.
15
+ *
16
+ * Like `./pr-loop.ts`, this bundles without the TypeScript toolchain (#3421):
17
+ * it imports nothing.
18
+ */
19
+ export type ForgeKind = "github" | "gitlab" | "forgejo";
20
+ export declare const FORGE_KINDS: readonly ForgeKind[];
21
+ /** The subset of the WHATWG `fetch` the clients use. */
22
+ export type ForgeFetch = (url: string, init: {
23
+ method: string;
24
+ headers: Record<string, string>;
25
+ body?: string;
26
+ }) => Promise<{
27
+ ok: boolean;
28
+ status: number;
29
+ text(): Promise<string>;
30
+ }>;
31
+ export interface ForgeStatus {
32
+ /** `chant/plan` or `chant/apply`. */
33
+ context: string;
34
+ state: "pending" | "success" | "failure";
35
+ description: string;
36
+ /** The pipeline run, linked from the status. */
37
+ url?: string;
38
+ }
39
+ export interface PrForge {
40
+ kind: ForgeKind;
41
+ /** Lower-cased, such as `github.com`. */
42
+ host: string;
43
+ /** The URL of the run this process is part of, when the environment says. */
44
+ runUrl?: string;
45
+ /** How #3163 names `login` on this forge. */
46
+ principalOf(login: string): string;
47
+ /** Update the note on `pr` whose body starts with `marker`, or add one. */
48
+ upsertNote(pr: number, marker: string, body: string): Promise<void>;
49
+ setStatus(sha: string, status: ForgeStatus): Promise<void>;
50
+ /** Logins whose standing review approves `pr`. */
51
+ approvers(pr: number): Promise<string[]>;
52
+ /** The merged pull request that produced `sha`, or null. */
53
+ pullRequestFor(sha: string): Promise<number | null>;
54
+ }
55
+ /** Thrown when a forge answers a call with an error status. */
56
+ export declare class ForgeApiError extends Error {
57
+ readonly method: string;
58
+ readonly url: string;
59
+ readonly status: number;
60
+ constructor(method: string, url: string, status: number, detail: string);
61
+ }
62
+ /** `<forge>:<login>` on the forge's default host, `<forge>@<host>:<login>` elsewhere, lower-cased (#3163's form). */
63
+ export declare function forgePrincipalOf(kind: ForgeKind, host: string, login: string): string;
64
+ export interface GithubForgeOptions {
65
+ /** `$GITHUB_API_URL`: `https://api.github.com`, `<host>/api/v3`, or Forgejo's `<host>/api/v1`. */
66
+ apiBase: string;
67
+ /** `owner/name`. */
68
+ repo: string;
69
+ token: string;
70
+ /** The forge's host, for naming reviewers. Default github.com. */
71
+ host?: string;
72
+ runUrl?: string;
73
+ fetch?: ForgeFetch;
74
+ }
75
+ /** A GitHub client (github.com or GitHub Enterprise Server). */
76
+ export declare function githubForge(opts: GithubForgeOptions): PrForge;
77
+ /** A Forgejo (or Gitea) client. `host` is required: Forgejo has no default host. */
78
+ export declare function forgejoForge(opts: GithubForgeOptions & {
79
+ host: string;
80
+ }): PrForge;
81
+ export interface GitlabForgeOptions {
82
+ /** `$CI_API_V4_URL`. */
83
+ apiBase: string;
84
+ /** `$CI_PROJECT_ID`, or the URL-encoded path. */
85
+ project: string;
86
+ token: string;
87
+ /** Default gitlab.com. */
88
+ host?: string;
89
+ runUrl?: string;
90
+ fetch?: ForgeFetch;
91
+ }
92
+ /** A GitLab client. The token needs the `api` scope: a job token cannot write merge-request notes. */
93
+ export declare function gitlabForge(opts: GitlabForgeOptions): PrForge;
94
+ /** Thrown when the environment lacks what a forge client needs. */
95
+ export declare class ForgeEnvironmentError extends Error {
96
+ constructor(kind: ForgeKind, missing: string[]);
97
+ }
98
+ /**
99
+ * A client for `kind` from the CI job's environment. The token is
100
+ * `CHANT_FORGE_TOKEN` when set, else the forge's own: `GITHUB_TOKEN` (also
101
+ * set on Forgejo Actions) or `GITLAB_TOKEN`. GitLab's `CI_JOB_TOKEN` cannot
102
+ * write notes, so a GitLab pipeline names a project access token.
103
+ */
104
+ export declare function forgeFromEnv(kind: ForgeKind, env?: Record<string, string | undefined>, fetchImpl?: ForgeFetch): PrForge;
105
+ //# sourceMappingURL=pr-forge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-forge.d.ts","sourceRoot":"","sources":["../src/pr-forge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExD,eAAO,MAAM,W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GAAG,OAAO,CA2C7D;AAED,mEAAmE;AACnE,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAG7C;CACF;AAWD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,EAAE,SAAS,CAAC,EAAE,UAAU,GAAG,OAAO,CAwCpI"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The pull-request loop (#3183): plan the members a change reaches, show the
3
+ * plan on the pull request, and apply it on merge only when the plan is the
4
+ * one a reviewer approved.
5
+ *
6
+ * `chant components pr-plan` and `chant components pr-apply` run it, and the
7
+ * generated CI for GitHub, GitLab and Forgejo calls them
8
+ * (`components/pr-pipeline.ts`). This module holds the parts that need no
9
+ * runner: the gate's names, the report both commands write, the pull-request
10
+ * note rendered from it and the status line. terragucci reads the report and
11
+ * renders the note from one bundled file with no TypeScript toolchain
12
+ * (#3421), so this imports `./change-set` and `./plan-summary` and nothing
13
+ * else; `pr-loop-bundle.test.ts` holds that.
14
+ *
15
+ * ## What the gate binds
16
+ *
17
+ * One gate per pull request: op `pr-<number>`, gate `pr-apply` unless the
18
+ * pipeline names another. It binds the digest of the change-set document over
19
+ * every planned member (`changeSetDigest`, #3181), the same digest a gated
20
+ * wave binds over its members (#3049). A reviewer approves it with `chant
21
+ * approve pr-<number> pr-apply --plan <digest>`. The op carries the number so
22
+ * that one pull request's approval never answers another's, and the gate name
23
+ * stays fixed so a workspace can require signed approvals for it under
24
+ * `identity.gates` (#3163).
25
+ *
26
+ * On merge the apply plans the same members again, before anything applies,
27
+ * and decides the gate against the new digest. The same plan applies; a moved
28
+ * plan stops with both digests named and nothing applied.
29
+ */
30
+ import type { ChangeSetDocument } from "./change-set.js";
31
+ /** The schema a pull-request report names in `$schema`. */
32
+ export declare const PR_REPORT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/pr-report/v1/pr-report.schema.json";
33
+ /** The read-contract version the report follows. */
34
+ export declare const PR_REPORT_CONTRACT = 1;
35
+ /** The gate a pull request's apply waits on, unless the pipeline names another. */
36
+ export declare const PR_APPLY_GATE = "pr-apply";
37
+ /** The op a pull request's gate is recorded under: `pr-<number>`. */
38
+ export declare function prOp(pr: number): string;
39
+ /** The hidden line that marks the pull request's note, one per environment. */
40
+ export declare function prNoteMarker(env: string): string;
41
+ /** The status contexts the two stages set on the commit. */
42
+ export declare const PR_STATUS_CONTEXTS: {
43
+ readonly plan: "chant/plan";
44
+ readonly apply: "chant/apply";
45
+ };
46
+ /** Changes a member's plan proposes, by the actions a reviewer reads. */
47
+ export interface PrMemberCounts {
48
+ create: number;
49
+ update: number;
50
+ replace: number;
51
+ delete: number;
52
+ }
53
+ /** Where one member got to. */
54
+ export type PrMemberStatus =
55
+ /** Planned, nothing applied (the plan stage, or an apply that stopped). */
56
+ "planned"
57
+ /** The plan failed. */
58
+ | "plan-failed"
59
+ /** Applied the approved plan. */
60
+ | "applied"
61
+ /** The apply failed. */
62
+ | "failed"
63
+ /** Not applied because a member it depends on failed. */
64
+ | "blocked";
65
+ export interface PrMember {
66
+ /** The member's name in the change set: a root, for a terraform-family step. */
67
+ member: string;
68
+ /** The component whose step planned it. */
69
+ component: string;
70
+ /** What a gate on this member alone binds. `null` when it failed to plan. */
71
+ planDigest: string | null;
72
+ status: PrMemberStatus;
73
+ counts: PrMemberCounts;
74
+ error?: string;
75
+ /**
76
+ * Components this one depends on whose outputs changed when they applied
77
+ * (apply stage). Its applied plan read the values from before, so the next
78
+ * run plans it again.
79
+ */
80
+ inputsMoved?: string[];
81
+ }
82
+ /** Where the approval stands for the planned digest. */
83
+ export interface PrApproval {
84
+ /**
85
+ * `approved`: an approval stands for this digest. `changed`: one stands for
86
+ * another digest, so the plan moved since someone approved it. `pending`:
87
+ * none stands.
88
+ */
89
+ status: "approved" | "changed" | "pending";
90
+ /** Who approved this digest. */
91
+ approvedBy?: string[];
92
+ /** With `changed`: the digest that was approved. */
93
+ approved?: string;
94
+ }
95
+ /** How a stage ended. */
96
+ export type PrStatus =
97
+ /** Plan stage: every member planned. */
98
+ "planned"
99
+ /** Plan stage: a member failed to plan. Apply stage: the same, so nothing applied. */
100
+ | "plan-failed"
101
+ /** Nothing the change touches is deployed by a component. */
102
+ | "nothing"
103
+ /** Apply stage: every member applied. */
104
+ | "applied"
105
+ /** Apply stage: a member failed to apply. Its dependents did not run. */
106
+ | "failed"
107
+ /** Apply stage: nothing applied, see `refusal`. */
108
+ | "refused";
109
+ /** Why an apply refused. */
110
+ export type PrRefusal =
111
+ /** No approval stands for any plan of this pull request. */
112
+ "not-approved"
113
+ /** The approval stands for another digest: the plan changed after review. */
114
+ | "plan-changed"
115
+ /** The approval names someone who has not approved the pull request on the forge. */
116
+ | "not-a-reviewer"
117
+ /** No pull request merged this commit, so there is no approval to read. */
118
+ | "no-pull-request";
119
+ /**
120
+ * The document `pr-plan` and `pr-apply` write (`pr-report.schema.json`).
121
+ * The terragucci plan report (#3349) reads it; fields are only ever added.
122
+ */
123
+ export interface PrReport {
124
+ $schema: typeof PR_REPORT_SCHEMA_ID;
125
+ contract: typeof PR_REPORT_CONTRACT;
126
+ stage: "plan" | "apply";
127
+ /** The pull or merge request number, when known. */
128
+ pr: number | null;
129
+ env: string;
130
+ /** The commit the change is measured from: the merge base of the given base and `head`. */
131
+ base: string;
132
+ head: string;
133
+ /** The gate's ledger entry: `_gates/<op>.jsonl` on `chant/lifecycle`. */
134
+ op: string;
135
+ gate: string;
136
+ /** The change-set digest of what this stage planned. What the gate binds. */
137
+ digest: string;
138
+ status: PrStatus;
139
+ refusal?: PrRefusal;
140
+ /** The refusal or failure, as printed. */
141
+ message?: string;
142
+ approval: PrApproval;
143
+ /** Component names: which changed, which run because they depend on one, and what the change touched that no component deploys. */
144
+ selection: {
145
+ changed: string[];
146
+ dependents: string[];
147
+ unclaimed: string[];
148
+ indeterminate: string[];
149
+ /** The components in dependency order, a wave per entry. */
150
+ waves: string[][];
151
+ };
152
+ members: PrMember[];
153
+ changeSet: ChangeSetDocument;
154
+ }
155
+ /** The counts a member's entries add up to. */
156
+ export declare function memberCounts(doc: Pick<ChangeSetDocument, "summary">, member: string): PrMemberCounts;
157
+ /** The approve command a reviewer runs for this report's digest. */
158
+ export declare function prApproveCommand(report: Pick<PrReport, "op" | "gate" | "digest">, approver?: string): string;
159
+ /**
160
+ * The refusal when the approved digest is not the planned one: both digests,
161
+ * that nothing applied, and how to close it.
162
+ */
163
+ export declare function describePlanChanged(report: Pick<PrReport, "op" | "gate" | "digest" | "approval">): string;
164
+ /**
165
+ * The pull-request note: the stage's headline, a row per member, the digest
166
+ * and the approval, then the grouped plan summary (#3188) in whatever room
167
+ * `limit` leaves. The note starts with {@link prNoteMarker}, so the same
168
+ * comment is updated by every push and by the apply.
169
+ */
170
+ export declare function renderPrNote(report: PrReport, options?: {
171
+ limit?: number;
172
+ approver?: string;
173
+ }): string;
174
+ /** A commit status's description, at most 140 characters (GitHub's limit). */
175
+ export declare function prStatusDescription(report: PrReport): string;
176
+ /** The commit status state for a report: success, failure, or pending while it waits on approval. */
177
+ export declare function prStatusState(report: PrReport): "success" | "failure" | "pending";
178
+ //# sourceMappingURL=pr-loop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-loop.d.ts","sourceRoot":"","sources":["../src/pr-loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGvE,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB,oFAAoF,CAAC;AAErH,oDAAoD;AACpD,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC,mFAAmF;AACnF,eAAO,MAAM,aAAa,aAAa,CAAC;AAExC,qEAAqE;AACrE,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,GA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AAM,GAAG,cAAc,CAIpG;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC,EAAE,QAAQ,SAAU,GAAG,MAAM,CAE7G;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,GAAG,MAAM,CAMzG;AAuDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CA8B1G;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CA6B5D;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAIjF"}
@@ -74,4 +74,35 @@ export declare function telemetryEnvironment(attribution: TelemetryAttribution,
74
74
  * overwritten; a key it didn't set is appended.
75
75
  */
76
76
  export declare function mergeResourceAttributes(existing: string, extra: string): string;
77
+ /**
78
+ * The environment variable a deploy sets to the release attributes, as a
79
+ * suffix for `OTEL_RESOURCE_ATTRIBUTES`. A stamped workload's generated
80
+ * output appends it where the platform expands variables (Compose
81
+ * interpolation, a Kubernetes `$(VAR)` reference), so the committed files are
82
+ * the same bytes whatever is released.
83
+ */
84
+ export declare const RELEASE_ATTRIBUTES_VARIABLE = "CHANT_RELEASE_ATTRIBUTES";
85
+ /**
86
+ * The pod-template annotation a Kubernetes release writes the suffix to. A
87
+ * stamped container reads it into {@link RELEASE_ATTRIBUTES_VARIABLE} through
88
+ * the downward API; an absent annotation reads as empty.
89
+ */
90
+ export declare const RELEASE_ATTRIBUTES_ANNOTATION = "chant.intentius.io/release-attributes";
91
+ /** What the step that deploys a release knows: the artifact it promoted and the commit it came from. */
92
+ export interface ReleaseIdentity {
93
+ /** `service.version`: the digest of the artifact the run promoted, the release record's `digest`. */
94
+ version?: string;
95
+ /** `vcs.ref.head.revision`: the commit, the release record's `gitSha`. */
96
+ revision?: string;
97
+ }
98
+ /**
99
+ * The release attributes as a suffix for `OTEL_RESOURCE_ATTRIBUTES`: each
100
+ * pair preceded by a comma and percent-encoded the way
101
+ * {@link telemetryEnvironment} encodes, or `""` when the release knows
102
+ * neither. The build-time list always has `chant.decl`, so the suffix never
103
+ * starts the list.
104
+ */
105
+ export declare function releaseAttributesSuffix(release: ReleaseIdentity | undefined): string;
106
+ /** The variables a deploy step exports for a release: {@link RELEASE_ATTRIBUTES_VARIABLE}, or nothing. */
107
+ export declare function releaseEnvironment(release: ReleaseIdentity | undefined): Record<string, string>;
77
108
  //# sourceMappingURL=telemetry-attribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-attribution.d.ts","sourceRoot":"","sources":["../src/telemetry-attribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,+EAA+E;AAC/E,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,oBAAoB,EAAE,SAAS,sBAAsB,EAQjE,CAAC;AAUF;;;;;;;;;;;GAWG;AAC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ser, loaded lazily. Kept apart from `parse.ts` so a
3
+ * caller that only needs the loader (the terraform lexicon's HCL reader) does
4
+ * not pull in the dependency graph, the state reader and the carve tables.
5
+ *
6
+ * `@cdktn/hcl2json` is NOT a chant dependency: it carries a ~1.8 MB wasm blob
7
+ * and only HCL users need it. If it is absent the loader fails with a
8
+ * one-line install hint.
9
+ */
10
+ import type { Hcl2JsonTree } from "./types.js";
11
+ /** Minimal shape of the parser exports we depend on. */
12
+ export interface Hcl2Json {
13
+ parse: (filename: string, hcl: string) => Promise<Hcl2JsonTree>;
14
+ /** Expression-AST reference extraction (#998) — one traversal accessor per reference. */
15
+ getReferencesInExpression: (filename: string, expression: string) => Promise<Array<{
16
+ value: string;
17
+ }>>;
18
+ }
19
+ export declare class Hcl2JsonNotInstalled extends Error {
20
+ constructor(cause: unknown);
21
+ }
22
+ /**
23
+ * The environment variable that turns on parser-input recording (chant #2483).
24
+ *
25
+ * When set to a file path, every `parse(filename, source)` and every
26
+ * `getReferencesInExpression(filename, expression)` this process makes is
27
+ * appended to that file as one JSON line before the real call runs. That is
28
+ * how `scripts/check-hcl-parser-parity.ts` gets hold of the inline HCL the
29
+ * test suite parses, which no corpus walk on disk would find: run the suite
30
+ * with this set, then replay the file through two parsers and compare. Off
31
+ * unless set, and never changes a result.
32
+ */
33
+ export declare const HCL2JSON_RECORD_ENV = "CHANT_HCL2JSON_RECORD";
34
+ /** One recorded parser input, as {@link HCL2JSON_RECORD_ENV} writes it. */
35
+ export interface Hcl2JsonRecordLine {
36
+ kind: "parse" | "refs";
37
+ filename: string;
38
+ text: string;
39
+ }
40
+ /**
41
+ * Lazy-load the optional HCL parser. Throws `Hcl2JsonNotInstalled` with an
42
+ * install hint when the package is missing, rather than a raw MODULE_NOT_FOUND.
43
+ */
44
+ export declare function loadHcl2json(): Promise<Hcl2Json>;
45
+ //# sourceMappingURL=hcl2json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hcl2json.d.ts","sourceRoot":"","sources":["../../src/terraform/hcl2json.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,wDAAwD;AACxD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAChE,yFAAyF;IACzF,yBAAyB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CACxG;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,KAAK,EAAE,OAAO,EAOzB;CACF;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAkBD;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,QAAQ,CAAC,CAStD"}