@intentius/chant 0.124.62 → 0.124.63

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 (229) hide show
  1. package/dist/cli/handlers/approve.d.ts +18 -0
  2. package/dist/cli/handlers/approve.d.ts.map +1 -1
  3. package/dist/cli/handlers/approve.js +142 -16
  4. package/dist/cli/handlers/plan.d.ts +10 -0
  5. package/dist/cli/handlers/plan.d.ts.map +1 -0
  6. package/dist/cli/handlers/plan.js +71 -0
  7. package/dist/cli/handlers/release.d.ts +6 -4
  8. package/dist/cli/handlers/release.d.ts.map +1 -1
  9. package/dist/cli/handlers/release.js +13 -7
  10. package/dist/cli/main.d.ts.map +1 -1
  11. package/dist/cli/main.js +34 -5
  12. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  13. package/dist/cli/mcp/workspace-tools.js +2 -1
  14. package/dist/cli/parse-args.d.ts.map +1 -1
  15. package/dist/cli/parse-args.js +31 -0
  16. package/dist/cli/registry.d.ts +13 -1
  17. package/dist/cli/registry.d.ts.map +1 -1
  18. package/dist/config.d.ts +32 -0
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/gate-decision.d.ts +1 -1
  21. package/dist/gate-decision.d.ts.map +1 -1
  22. package/dist/gate-decision.js +4 -2
  23. package/dist/gate-statement.schema.json +44 -0
  24. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +20 -0
  25. package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
  26. package/dist/lifecycle/__fixtures__/publish-fakes.js +119 -3
  27. package/dist/lifecycle/gate-ledger.d.ts +17 -3
  28. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  29. package/dist/lifecycle/gate-seal.d.ts +39 -3
  30. package/dist/lifecycle/gate-seal.d.ts.map +1 -1
  31. package/dist/lifecycle/gate-seal.js +50 -10
  32. package/dist/lifecycle/gate-statement.d.ts +70 -0
  33. package/dist/lifecycle/gate-statement.d.ts.map +1 -0
  34. package/dist/lifecycle/gate-statement.js +74 -0
  35. package/dist/lifecycle/gate-webauthn.d.ts +79 -0
  36. package/dist/lifecycle/gate-webauthn.d.ts.map +1 -0
  37. package/dist/lifecycle/gate-webauthn.js +105 -0
  38. package/dist/lifecycle/git.d.ts +1 -1
  39. package/dist/lifecycle/git.d.ts.map +1 -1
  40. package/dist/lifecycle/git.js +24 -19
  41. package/dist/lifecycle/ledger-remote.d.ts +37 -0
  42. package/dist/lifecycle/ledger-remote.d.ts.map +1 -0
  43. package/dist/lifecycle/ledger-remote.js +42 -0
  44. package/dist/lifecycle/plan-stale.d.ts +76 -0
  45. package/dist/lifecycle/plan-stale.d.ts.map +1 -0
  46. package/dist/lifecycle/plan-stale.js +121 -0
  47. package/dist/lifecycle/publish-credentials.d.ts +1 -1
  48. package/dist/lifecycle/publish-credentials.d.ts.map +1 -1
  49. package/dist/lifecycle/publish-credentials.js +2 -0
  50. package/dist/lifecycle/publish-declaration.d.ts +87 -0
  51. package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
  52. package/dist/lifecycle/publish-declaration.js +87 -1
  53. package/dist/lifecycle/publish-forge.d.ts +5 -1
  54. package/dist/lifecycle/publish-forge.d.ts.map +1 -1
  55. package/dist/lifecycle/publish-forge.js +14 -4
  56. package/dist/lifecycle/publish-github.d.ts +69 -0
  57. package/dist/lifecycle/publish-github.d.ts.map +1 -0
  58. package/dist/lifecycle/publish-github.js +153 -0
  59. package/dist/lifecycle/publish-homebrew.d.ts +66 -0
  60. package/dist/lifecycle/publish-homebrew.d.ts.map +1 -0
  61. package/dist/lifecycle/publish-homebrew.js +173 -0
  62. package/dist/lifecycle/publish-marketplace.d.ts +51 -0
  63. package/dist/lifecycle/publish-marketplace.d.ts.map +1 -0
  64. package/dist/lifecycle/publish-marketplace.js +254 -0
  65. package/dist/lifecycle/publish-targets.d.ts +6 -0
  66. package/dist/lifecycle/publish-targets.d.ts.map +1 -1
  67. package/dist/lifecycle/publish-targets.js +15 -0
  68. package/dist/lifecycle/publish-tauri.d.ts +61 -0
  69. package/dist/lifecycle/publish-tauri.d.ts.map +1 -0
  70. package/dist/lifecycle/publish-tauri.js +182 -0
  71. package/dist/lifecycle/release-publish.d.ts +5 -2
  72. package/dist/lifecycle/release-publish.d.ts.map +1 -1
  73. package/dist/lifecycle/snapshot-store.d.ts.map +1 -1
  74. package/dist/lifecycle/snapshot-store.js +17 -9
  75. package/dist/lifecycle/test-passkey.d.ts +25 -0
  76. package/dist/lifecycle/test-passkey.d.ts.map +1 -0
  77. package/dist/lifecycle/test-passkey.js +39 -0
  78. package/dist/notify.d.ts +23 -3
  79. package/dist/notify.d.ts.map +1 -1
  80. package/dist/notify.js +8 -2
  81. package/dist/notify.schema.json +12 -3
  82. package/dist/op/activities/activity-contracts.d.ts +4 -4
  83. package/dist/pr-forge.d.ts +20 -0
  84. package/dist/pr-forge.d.ts.map +1 -1
  85. package/dist/pr-forge.js +61 -2
  86. package/dist/release-floors.d.ts +1 -1
  87. package/dist/release-floors.js +1 -1
  88. package/dist/wave-runtime.mjs +331 -330
  89. package/dist/workspace/ci-builds.d.ts +21 -0
  90. package/dist/workspace/ci-builds.d.ts.map +1 -1
  91. package/dist/workspace/ci-builds.js +14 -0
  92. package/dist/workspace/ci-green.d.ts +45 -2
  93. package/dist/workspace/ci-green.d.ts.map +1 -1
  94. package/dist/workspace/ci-green.js +124 -5
  95. package/dist/workspace/ci-quarantine-report.d.ts +80 -0
  96. package/dist/workspace/ci-quarantine-report.d.ts.map +1 -0
  97. package/dist/workspace/ci-quarantine-report.js +205 -0
  98. package/dist/workspace/ci-quarantine.d.ts +73 -0
  99. package/dist/workspace/ci-quarantine.d.ts.map +1 -0
  100. package/dist/workspace/ci-quarantine.js +171 -0
  101. package/dist/workspace/ci-serve.d.ts.map +1 -1
  102. package/dist/workspace/ci-serve.js +7 -4
  103. package/dist/workspace/class-data.d.ts +3 -1
  104. package/dist/workspace/class-data.d.ts.map +1 -1
  105. package/dist/workspace/class-data.js +4 -1
  106. package/dist/workspace/declaration.d.ts +45 -2
  107. package/dist/workspace/declaration.d.ts.map +1 -1
  108. package/dist/workspace/declaration.js +45 -2
  109. package/dist/workspace/declaration.schema.json +51 -3
  110. package/dist/workspace/forge-work.d.ts +76 -0
  111. package/dist/workspace/forge-work.d.ts.map +1 -0
  112. package/dist/workspace/forge-work.js +160 -0
  113. package/dist/workspace/identity-gate-rule.d.ts +3 -2
  114. package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
  115. package/dist/workspace/identity-gate-rule.js +5 -7
  116. package/dist/workspace/identity.d.ts +3 -2
  117. package/dist/workspace/identity.d.ts.map +1 -1
  118. package/dist/workspace/identity.js +6 -3
  119. package/dist/workspace/intent-cli.d.ts +3 -2
  120. package/dist/workspace/intent-cli.d.ts.map +1 -1
  121. package/dist/workspace/intent-cli.js +26 -5
  122. package/dist/workspace/intent-record.d.ts +3 -0
  123. package/dist/workspace/intent-record.d.ts.map +1 -1
  124. package/dist/workspace/intent-record.schema.json +32 -0
  125. package/dist/workspace/intent.d.ts +9 -0
  126. package/dist/workspace/intent.d.ts.map +1 -1
  127. package/dist/workspace/intent.js +3 -0
  128. package/dist/workspace/intent.schema.json +32 -0
  129. package/dist/workspace/kind-readers.d.ts.map +1 -1
  130. package/dist/workspace/kind-readers.js +2 -1
  131. package/dist/workspace/kinds.d.ts +6 -1
  132. package/dist/workspace/kinds.d.ts.map +1 -1
  133. package/dist/workspace/kinds.js +8 -3
  134. package/dist/workspace/plan-stale.schema.json +286 -0
  135. package/dist/workspace/release-candidates.d.ts +33 -6
  136. package/dist/workspace/release-candidates.d.ts.map +1 -1
  137. package/dist/workspace/release-candidates.js +49 -20
  138. package/dist/workspace/release-candidates.schema.json +48 -2
  139. package/dist/workspace/trust/policy.d.ts +10 -0
  140. package/dist/workspace/trust/policy.d.ts.map +1 -1
  141. package/dist/workspace/trust/policy.js +19 -1
  142. package/dist/workspace/trust/run-commits.d.ts.map +1 -1
  143. package/dist/workspace/trust/run-commits.js +2 -1
  144. package/dist/workspace/trust/seal.d.ts.map +1 -1
  145. package/dist/workspace/trust/seal.js +34 -3
  146. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  147. package/dist/workspace/trust/trust-files.js +6 -1
  148. package/package.json +2 -1
  149. package/src/cli/handlers/approve-external-signature.test.ts +226 -0
  150. package/src/cli/handlers/approve.ts +174 -16
  151. package/src/cli/handlers/plan.ts +74 -0
  152. package/src/cli/handlers/release.ts +12 -7
  153. package/src/cli/main.ts +34 -5
  154. package/src/cli/mcp/workspace-tools.ts +2 -1
  155. package/src/cli/parse-args.ts +24 -0
  156. package/src/cli/registry.ts +13 -1
  157. package/src/gate-decision-bundle.test.ts +4 -2
  158. package/src/gate-decision.ts +11 -2
  159. package/src/gate-statement.schema.json +44 -0
  160. package/src/lifecycle/__fixtures__/publish-fakes.ts +125 -5
  161. package/src/lifecycle/gate-ledger.ts +17 -3
  162. package/src/lifecycle/gate-seal.ts +62 -9
  163. package/src/lifecycle/gate-statement.ts +107 -0
  164. package/src/lifecycle/gate-webauthn.test.ts +77 -0
  165. package/src/lifecycle/gate-webauthn.ts +133 -0
  166. package/src/lifecycle/git.ts +23 -19
  167. package/src/lifecycle/ledger-remote.test.ts +183 -0
  168. package/src/lifecycle/ledger-remote.ts +46 -0
  169. package/src/lifecycle/plan-stale.test.ts +150 -0
  170. package/src/lifecycle/plan-stale.ts +173 -0
  171. package/src/lifecycle/publish-credentials.ts +2 -0
  172. package/src/lifecycle/publish-declaration.ts +93 -1
  173. package/src/lifecycle/publish-forge.ts +15 -4
  174. package/src/lifecycle/publish-github.ts +174 -0
  175. package/src/lifecycle/publish-homebrew.test.ts +179 -0
  176. package/src/lifecycle/publish-homebrew.ts +187 -0
  177. package/src/lifecycle/publish-marketplace.test.ts +254 -0
  178. package/src/lifecycle/publish-marketplace.ts +259 -0
  179. package/src/lifecycle/publish-target-context.test.ts +2 -2
  180. package/src/lifecycle/publish-targets.test.ts +23 -0
  181. package/src/lifecycle/publish-targets.ts +15 -0
  182. package/src/lifecycle/publish-tauri.test.ts +163 -0
  183. package/src/lifecycle/publish-tauri.ts +199 -0
  184. package/src/lifecycle/release-publish.ts +5 -3
  185. package/src/lifecycle/snapshot-store.ts +16 -9
  186. package/src/lifecycle/test-passkey.ts +55 -0
  187. package/src/notify-bundle.test.ts +3 -1
  188. package/src/notify.schema.json +12 -3
  189. package/src/notify.ts +20 -3
  190. package/src/override-gate-bundle.test.ts +2 -0
  191. package/src/pr-forge-bundle.test.ts +2 -2
  192. package/src/pr-forge.test.ts +38 -0
  193. package/src/pr-forge.ts +68 -5
  194. package/src/release-floors.ts +1 -1
  195. package/src/stage-hooks-bundle.test.ts +2 -0
  196. package/src/wave-runtime-bundle.test.ts +3 -2
  197. package/src/workspace/ci-builds.ts +27 -0
  198. package/src/workspace/ci-green-stale.test.ts +193 -0
  199. package/src/workspace/ci-green.ts +138 -6
  200. package/src/workspace/ci-quarantine-report.test.ts +146 -0
  201. package/src/workspace/ci-quarantine-report.ts +235 -0
  202. package/src/workspace/ci-quarantine.test.ts +161 -0
  203. package/src/workspace/ci-quarantine.ts +189 -0
  204. package/src/workspace/ci-serve.ts +7 -4
  205. package/src/workspace/class-data.ts +5 -1
  206. package/src/workspace/declaration.schema.json +51 -3
  207. package/src/workspace/declaration.test.ts +1 -0
  208. package/src/workspace/declaration.ts +88 -5
  209. package/src/workspace/forge-work.test.ts +143 -0
  210. package/src/workspace/forge-work.ts +195 -0
  211. package/src/workspace/identity-gate-rule.ts +6 -8
  212. package/src/workspace/identity.ts +6 -3
  213. package/src/workspace/intent-cli.ts +24 -5
  214. package/src/workspace/intent-record.schema.json +32 -0
  215. package/src/workspace/intent-record.ts +3 -0
  216. package/src/workspace/intent.schema.json +32 -0
  217. package/src/workspace/intent.ts +10 -0
  218. package/src/workspace/kind-readers.ts +2 -1
  219. package/src/workspace/kinds.test.ts +13 -0
  220. package/src/workspace/kinds.ts +12 -3
  221. package/src/workspace/plan-stale.schema.json +286 -0
  222. package/src/workspace/release-candidates.schema.json +48 -2
  223. package/src/workspace/release-candidates.test.ts +77 -4
  224. package/src/workspace/release-candidates.ts +62 -20
  225. package/src/workspace/trust/policy.ts +24 -1
  226. package/src/workspace/trust/run-commits.ts +2 -1
  227. package/src/workspace/trust/seal.ts +35 -3
  228. package/src/workspace/trust/trust-files.test.ts +5 -0
  229. package/src/workspace/trust/trust-files.ts +15 -1
@@ -0,0 +1,286 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json",
4
+ "title": "chant plan stale output",
5
+ "description": "What `chant plan stale <digest> --json` prints (#4648): whether anything applied to a plan's targets after the plan was recorded, and those applies. The plan is the pending gate facts that record the digest; it was recorded at the earliest. Its targets are each fact's member, op and environment (the fact's own, else the environment of the run that reached the gate). An apply under an approval of the same member and op for another plan, and a deploy record of the same member and environment, recorded after the plan, make it stale. It reads the local chant/lifecycle branch, never fetches and writes nothing. Version 1 of the read contract. Readers ignore fields they do not know; a field is only ever added within a version. The codes are a closed list, each in the one closed list of `reason-codes.ts`. Contract version 1 of this document is written by chant 0.124.63 and newer.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "#/$defs/result"
9
+ },
10
+ {
11
+ "$ref": "#/$defs/failure"
12
+ }
13
+ ],
14
+ "$defs": {
15
+ "result": {
16
+ "type": "object",
17
+ "description": "The ledger was read. Exit code 0 when the plan is current, 2 when it is stale, 1 when plan is null.",
18
+ "required": [
19
+ "$schema",
20
+ "contract",
21
+ "chant",
22
+ "digest",
23
+ "plan",
24
+ "stale",
25
+ "applies"
26
+ ],
27
+ "properties": {
28
+ "$schema": {
29
+ "const": "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json"
30
+ },
31
+ "contract": {
32
+ "const": 1
33
+ },
34
+ "chant": {
35
+ "type": "string"
36
+ },
37
+ "error": false,
38
+ "digest": {
39
+ "type": "string",
40
+ "description": "The digest asked for: a pending gate fact's planDigest."
41
+ },
42
+ "plan": {
43
+ "description": "The plan, or null when no pending gate fact on the local ledger records the digest.",
44
+ "oneOf": [
45
+ {
46
+ "type": "null"
47
+ },
48
+ {
49
+ "type": "object",
50
+ "required": [
51
+ "recordedAt",
52
+ "runId",
53
+ "gitSha",
54
+ "targets"
55
+ ],
56
+ "properties": {
57
+ "recordedAt": {
58
+ "type": "string",
59
+ "format": "date-time",
60
+ "description": "The timestamp of the earliest pending fact that records the digest."
61
+ },
62
+ "runId": {
63
+ "type": [
64
+ "string",
65
+ "null"
66
+ ],
67
+ "description": "The run that recorded that fact."
68
+ },
69
+ "gitSha": {
70
+ "type": [
71
+ "string",
72
+ "null"
73
+ ],
74
+ "description": "The commit that run reached the gate at."
75
+ },
76
+ "targets": {
77
+ "type": "array",
78
+ "minItems": 1,
79
+ "description": "Each gate the plan waits at, once.",
80
+ "items": {
81
+ "type": "object",
82
+ "required": [
83
+ "member",
84
+ "op",
85
+ "gate",
86
+ "environment"
87
+ ],
88
+ "properties": {
89
+ "member": {
90
+ "type": [
91
+ "string",
92
+ "null"
93
+ ],
94
+ "description": "The workspace member whose gate ledger holds the fact, or null outside a workspace."
95
+ },
96
+ "op": {
97
+ "type": "string"
98
+ },
99
+ "gate": {
100
+ "type": "string"
101
+ },
102
+ "environment": {
103
+ "type": [
104
+ "string",
105
+ "null"
106
+ ],
107
+ "description": "The fact's environment, else the env of the run that reached the gate, else null. A null environment matches no deploy record."
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ]
115
+ },
116
+ "stale": {
117
+ "type": [
118
+ "boolean",
119
+ "null"
120
+ ],
121
+ "description": "True when applies is not empty. Null when plan is null."
122
+ },
123
+ "applies": {
124
+ "type": "array",
125
+ "description": "The applies that touched a target after the plan was recorded, oldest first. Empty when stale is false or null.",
126
+ "items": {
127
+ "type": "object",
128
+ "required": [
129
+ "source",
130
+ "member",
131
+ "op",
132
+ "gate",
133
+ "environment",
134
+ "component",
135
+ "planDigest",
136
+ "at",
137
+ "actor",
138
+ "approvedBy",
139
+ "runId",
140
+ "runUrl",
141
+ "gitSha",
142
+ "result"
143
+ ],
144
+ "properties": {
145
+ "source": {
146
+ "enum": [
147
+ "applies",
148
+ "deploys"
149
+ ],
150
+ "description": "applies: an apply under an approval, a line of _gates/<op>/applied.jsonl (chant ledger applies). deploys: a deploy record, a line of <env>/releases.jsonl (chant ledger deploys)."
151
+ },
152
+ "member": {
153
+ "type": [
154
+ "string",
155
+ "null"
156
+ ],
157
+ "description": "The workspace member whose ledger holds it, or null outside a workspace."
158
+ },
159
+ "op": {
160
+ "type": [
161
+ "string",
162
+ "null"
163
+ ],
164
+ "description": "The op it applied under. Null for a deploy record."
165
+ },
166
+ "gate": {
167
+ "type": [
168
+ "string",
169
+ "null"
170
+ ],
171
+ "description": "The gate whose approval it spent. Null for a deploy record."
172
+ },
173
+ "environment": {
174
+ "type": [
175
+ "string",
176
+ "null"
177
+ ],
178
+ "description": "The environment it deployed to. Null for an apply under an approval, whose line names none."
179
+ },
180
+ "component": {
181
+ "type": [
182
+ "string",
183
+ "null"
184
+ ],
185
+ "description": "The component a deploy record deployed. Null for an apply under an approval."
186
+ },
187
+ "planDigest": {
188
+ "type": [
189
+ "string",
190
+ "null"
191
+ ],
192
+ "description": "The plan it applied, always another plan than digest. Null for a deploy record."
193
+ },
194
+ "at": {
195
+ "type": "string",
196
+ "format": "date-time",
197
+ "description": "When it was recorded, after plan.recordedAt."
198
+ },
199
+ "actor": {
200
+ "type": [
201
+ "string",
202
+ "null"
203
+ ],
204
+ "description": "Who ran it: a deploy record's actor. Null for an apply under an approval, which names only its approver."
205
+ },
206
+ "approvedBy": {
207
+ "type": [
208
+ "string",
209
+ "null"
210
+ ],
211
+ "description": "Who approved it: an apply's approvedBy, a deploy record's approver."
212
+ },
213
+ "runId": {
214
+ "type": [
215
+ "string",
216
+ "null"
217
+ ],
218
+ "description": "The run that applied it."
219
+ },
220
+ "runUrl": {
221
+ "type": [
222
+ "string",
223
+ "null"
224
+ ],
225
+ "description": "A deploy record's link to its run. Null for an apply under an approval."
226
+ },
227
+ "gitSha": {
228
+ "type": [
229
+ "string",
230
+ "null"
231
+ ],
232
+ "description": "The commit it applied."
233
+ },
234
+ "result": {
235
+ "type": [
236
+ "string",
237
+ "null"
238
+ ],
239
+ "description": "How an apply under an approval ended: applied or failed, or null while it has no finished line. Null for a deploy record."
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ },
246
+ "failure": {
247
+ "type": "object",
248
+ "description": "Nothing was read. Exit code 1.",
249
+ "required": [
250
+ "$schema",
251
+ "contract",
252
+ "chant",
253
+ "error"
254
+ ],
255
+ "properties": {
256
+ "$schema": {
257
+ "const": "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json"
258
+ },
259
+ "contract": {
260
+ "const": 1
261
+ },
262
+ "chant": {
263
+ "type": "string"
264
+ },
265
+ "error": {
266
+ "type": "object",
267
+ "required": [
268
+ "code",
269
+ "message"
270
+ ],
271
+ "properties": {
272
+ "code": {
273
+ "enum": [
274
+ "not-a-git-repository",
275
+ "ledger-unreadable"
276
+ ]
277
+ },
278
+ "message": {
279
+ "type": "string"
280
+ }
281
+ }
282
+ }
283
+ }
284
+ }
285
+ }
286
+ }
@@ -29,10 +29,20 @@
29
29
  * trailers name, or under no work item, and within that under its pull
30
30
  * request, or under none for a commit that landed without one.
31
31
  *
32
- * It reads local refs and tags only and never fetches. Git is read through a
33
- * local `git` subprocess.
32
+ * Asked to (`forgeIssues`, `--forge-issues`, #4649), it also asks the forge
33
+ * which issues each change's pull request closes (./forge-work.ts), once per
34
+ * pull request, and puts the answer in the change's `closes`. A change no
35
+ * `Chant-Record` trailer gives a work item then lands under each issue its
36
+ * pull request closes. Without a forge or a token the pull request number
37
+ * stands alone, `resolved: false`.
38
+ *
39
+ * Otherwise it reads local refs and tags only and never fetches. Git is read
40
+ * through a local `git` subprocess.
34
41
  */
42
+ import type { ForgeWorkOptions, PullRequestCloses } from "./forge-work.js";
35
43
  export declare const RELEASE_CANDIDATES_CONTRACT_VERSION = 1;
44
+ /** The first chant whose candidates carry `changes[].closes` and `groups[].issue` (#4649). */
45
+ export declare const RELEASE_CANDIDATES_CLOSES_FLOOR = "0.124.63";
36
46
  export declare const RELEASE_CANDIDATES_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json";
37
47
  /** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
38
48
  export declare const RELEASE_CANDIDATES_ERROR_CODES: readonly ["not-a-git-repository", "ledger-unreadable"];
@@ -65,6 +75,12 @@ export interface CandidateChange {
65
75
  pr: number | null;
66
76
  /** The merge record `_merges/<sha>.json` (#4168 4.1), as stored, or null when there is none. */
67
77
  merge: Record<string, unknown> | null;
78
+ /**
79
+ * The issues the forge says `pr` closes (#4649), or null when the read was
80
+ * not asked to (`--forge-issues`) or the change has no pull request. Added
81
+ * within contract 1 by chant {@link RELEASE_CANDIDATES_CLOSES_FLOOR}.
82
+ */
83
+ closes: PullRequestCloses | null;
68
84
  }
69
85
  /** A candidate's changes under one pull request, or under none (`pr: null`) for commits that landed without one. */
70
86
  export interface CandidatePullRequestGroup {
@@ -72,9 +88,16 @@ export interface CandidatePullRequestGroup {
72
88
  /** Newest first. */
73
89
  commits: string[];
74
90
  }
75
- /** A candidate's changes under one work item, or under none (`work: null`). Work items come first, in the order the oldest change names them. */
91
+ /**
92
+ * A candidate's changes under one work item: a `Chant-Record` work id
93
+ * (`work`), or an issue the change's pull request closes (`issue`, #4649), or
94
+ * under none (both null). Work ids come first, then issues, each in the order
95
+ * the oldest change names them.
96
+ */
76
97
  export interface CandidateGroup {
77
98
  work: string | null;
99
+ /** The issue the forge says the changes' pull request closes, for changes with no work id; null otherwise. */
100
+ issue: number | null;
78
101
  /** Pull requests in the order their oldest commit landed, then `pr: null`. */
79
102
  pullRequests: CandidatePullRequestGroup[];
80
103
  }
@@ -137,6 +160,8 @@ export interface ReleaseCandidatesQuery {
137
160
  limit?: number;
138
161
  /** Walk this branch of `ci.green.branch` (#4325) instead of the first. */
139
162
  branch?: string;
163
+ /** Ask the forge which issues each pull request closes (#4649), with these options. Left out, the forge is not read. */
164
+ forgeIssues?: ForgeWorkOptions;
140
165
  }
141
166
  /** The work ids and `<kind>:<id>` records a commit's `Chant-Record` trailers name. */
142
167
  export declare function recordTrailers(trailers: Record<string, string[]>): {
@@ -149,9 +174,11 @@ export declare function prFromSubject(subject: string): number | null;
149
174
  export declare function mergeRecordPr(merge: Record<string, unknown> | null): number | null;
150
175
  /**
151
176
  * Group changes, given newest first, by work item, then pull request, then
152
- * commit. A change with work items lands in each one's group; the rest land
153
- * in the `work: null` group, last. Within a group, pull requests come in the
154
- * order their oldest commit landed, and commits without one last.
177
+ * commit. A change with work ids lands in each one's group; one without
178
+ * lands in the group of each issue its pull request closes (#4649); the rest
179
+ * land in the group of neither, last. Work ids come before issues. Within a
180
+ * group, pull requests come in the order their oldest commit landed, and
181
+ * commits without one last.
155
182
  */
156
183
  export declare function groupChanges(changes: readonly CandidateChange[]): CandidateGroup[];
157
184
  /** Read the release candidates of the member at `query.cwd`. */
@@ -1 +1 @@
1
- {"version":3,"file":"release-candidates.d.ts","sourceRoot":"","sources":["../../src/workspace/release-candidates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAUH,eAAO,MAAM,mCAAmC,IAAI,CAAC;AACrD,eAAO,MAAM,4BAA4B,sGAAsG,CAAC;AAEhJ,uEAAuE;AACvE,eAAO,MAAM,8BAA8B,YAAI,sBAAsB,EAAE,mBAAmB,CAAU,CAAC;AAErG,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,qFAAqF;AACrF,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,+FAA+F;IAC/F,MAAM,EAAE,MAAM,GAA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AW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wHAAwH;IACxH,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAgBD,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAOxG;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG5D;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAGlF;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,EAAE,CAsBlF;AAED,gEAAgE;AAChE,wBAAsB,yBAAyB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA6IjH"}
@@ -29,17 +29,27 @@
29
29
  * trailers name, or under no work item, and within that under its pull
30
30
  * request, or under none for a commit that landed without one.
31
31
  *
32
- * It reads local refs and tags only and never fetches. Git is read through a
33
- * local `git` subprocess.
32
+ * Asked to (`forgeIssues`, `--forge-issues`, #4649), it also asks the forge
33
+ * which issues each change's pull request closes (./forge-work.ts), once per
34
+ * pull request, and puts the answer in the change's `closes`. A change no
35
+ * `Chant-Record` trailer gives a work item then lands under each issue its
36
+ * pull request closes. Without a forge or a token the pull request number
37
+ * stands alone, `resolved: false`.
38
+ *
39
+ * Otherwise it reads local refs and tags only and never fetches. Git is read
40
+ * through a local `git` subprocess.
34
41
  */
35
42
  import { execFileSync } from "node:child_process";
36
43
  import { relative, resolve, sep } from "node:path";
44
+ import { NEXT_RELEASE } from "../release-floors.js";
37
45
  import { latestPerComponent, readReleaseLedger } from "../lifecycle/release-ledger.js";
38
46
  import { readAllReleases, readCuts } from "../lifecycle/release-store.js";
39
47
  import { resolveMemberLedger } from "../lifecycle/member-ledger.js";
40
48
  import { readBlobFromPath } from "../lifecycle/git.js";
41
49
  import { greenBranches, readerVersion } from "./declaration.js";
42
50
  export const RELEASE_CANDIDATES_CONTRACT_VERSION = 1;
51
+ /** The first chant whose candidates carry `changes[].closes` and `groups[].issue` (#4649). */
52
+ export const RELEASE_CANDIDATES_CLOSES_FLOOR = NEXT_RELEASE;
43
53
  export const RELEASE_CANDIDATES_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json";
44
54
  /** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
45
55
  export const RELEASE_CANDIDATES_ERROR_CODES = ["not-a-git-repository", "ledger-unreadable"];
@@ -78,26 +88,39 @@ export function mergeRecordPr(merge) {
78
88
  }
79
89
  /**
80
90
  * Group changes, given newest first, by work item, then pull request, then
81
- * commit. A change with work items lands in each one's group; the rest land
82
- * in the `work: null` group, last. Within a group, pull requests come in the
83
- * order their oldest commit landed, and commits without one last.
91
+ * commit. A change with work ids lands in each one's group; one without
92
+ * lands in the group of each issue its pull request closes (#4649); the rest
93
+ * land in the group of neither, last. Work ids come before issues. Within a
94
+ * group, pull requests come in the order their oldest commit landed, and
95
+ * commits without one last.
84
96
  */
85
97
  export function groupChanges(changes) {
86
98
  const oldestFirst = [...changes].reverse();
87
99
  const groups = new Map();
88
- const add = (work, pr, commit) => {
89
- const byPr = groups.get(work) ?? new Map();
90
- groups.set(work, byPr);
91
- byPr.set(pr, [commit, ...(byPr.get(pr) ?? [])]);
100
+ const add = (work, issue, pr, commit) => {
101
+ const key = work !== null ? `work:${work}` : issue !== null ? `issue:${issue}` : "";
102
+ const g = groups.get(key) ?? { work, issue, byPr: new Map() };
103
+ groups.set(key, g);
104
+ g.byPr.set(pr, [commit, ...(g.byPr.get(pr) ?? [])]);
92
105
  };
93
- for (const c of oldestFirst)
94
- for (const work of c.work.length > 0 ? c.work : [null])
95
- add(work, c.pr, c.commit);
106
+ for (const c of oldestFirst) {
107
+ const issues = c.closes?.issues ?? [];
108
+ if (c.work.length > 0)
109
+ for (const work of c.work)
110
+ add(work, null, c.pr, c.commit);
111
+ else if (issues.length > 0)
112
+ for (const issue of issues)
113
+ add(null, issue, c.pr, c.commit);
114
+ else
115
+ add(null, null, c.pr, c.commit);
116
+ }
96
117
  const nullLast = (keys) => [...keys.filter((k) => k !== null), ...keys.filter((k) => k === null)];
97
- return nullLast([...groups.keys()]).map((work) => {
98
- const byPr = groups.get(work);
99
- return { work, pullRequests: nullLast([...byPr.keys()]).map((pr) => ({ pr, commits: byPr.get(pr) })) };
100
- });
118
+ const all = [...groups.values()];
119
+ return [...all.filter((g) => g.work !== null), ...all.filter((g) => g.issue !== null), ...all.filter((g) => g.work === null && g.issue === null)].map((g) => ({
120
+ work: g.work,
121
+ issue: g.issue,
122
+ pullRequests: nullLast([...g.byPr.keys()]).map((pr) => ({ pr, commits: g.byPr.get(pr) })),
123
+ }));
101
124
  }
102
125
  /** Read the release candidates of the member at `query.cwd`. */
103
126
  export async function releaseCandidatesDocument(query) {
@@ -185,14 +208,20 @@ export async function releaseCandidatesDocument(query) {
185
208
  // A merge record that is not JSON is left out.
186
209
  }
187
210
  }
211
+ // The merge record names its pull request in `source` (../lifecycle/merge-record.ts).
212
+ const prOf = (sha) => mergeRecordPr(merges.get(sha) ?? null) ?? prFromSubject(details.get(sha)?.subject ?? "");
213
+ // What each pull request closes, asked of the forge once each, when asked to (#4649).
214
+ let closed = new Map();
215
+ if (query.forgeIssues) {
216
+ const { forgeWorkReader } = await import("./forge-work.js");
217
+ closed = await forgeWorkReader(top, query.forgeIssues).closesAll(walk.map(prOf).filter((n) => n !== null));
218
+ }
188
219
  const change = (sha) => {
189
220
  const d = details.get(sha);
190
221
  const { work, records } = recordTrailers(d?.trailers ?? {});
191
222
  const merge = merges.get(sha) ?? null;
192
- // The merge record names its pull request in `source` (../lifecycle/merge-record.ts).
193
- const mergePr = mergeRecordPr(merge);
194
- const subject = d?.subject ?? "";
195
- return { commit: sha, subject, date: d?.date ?? "", work, records, pr: mergePr ?? prFromSubject(subject), merge };
223
+ const pr = prOf(sha);
224
+ return { commit: sha, subject: d?.subject ?? "", date: d?.date ?? "", work, records, pr, merge, closes: pr !== null ? (closed.get(pr) ?? null) : null };
196
225
  };
197
226
  const flagReader = await flagsReader(top, source.rootOnDisk);
198
227
  const cutLabels = new Map();
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json",
4
4
  "title": "chant release candidates output",
5
- "description": "What `chant release candidates --json` prints (#4168 4.2): the green commits of trunk a release can be cut from, newest first, each with the commits, work items, pull requests, merge records and flags it would ship since the previous candidate, and what each environment of the member runs. It reads local refs and tags and never fetches. Version 1 of the read contract. Readers ignore fields they do not know; a field is only ever added within a version. The codes are a closed list, each in the one closed list of `reason-codes.ts`. Contract version 1 of this document is written by chant 0.124.33 and newer.",
5
+ "description": "What `chant release candidates --json` prints (#4168 4.2): the green commits of trunk a release can be cut from, newest first, each with the commits, work items, pull requests, merge records and flags it would ship since the previous candidate, and what each environment of the member runs. It reads local refs and tags and never fetches; with `--forge-issues` it also asks the forge, once per pull request, which issues each pull request closes (#4649). Version 1 of the read contract. Readers ignore fields they do not know; a field is only ever added within a version. The codes are a closed list, each in the one closed list of `reason-codes.ts`. Contract version 1 of this document is written by chant 0.124.33 and newer.",
6
6
  "oneOf": [
7
7
  {
8
8
  "$ref": "#/$defs/result"
@@ -251,7 +251,7 @@
251
251
  "items": {
252
252
  "$ref": "#/$defs/group"
253
253
  },
254
- "description": "The same changes by work item, then pull request, then commit (#4168 4.4). Work items come first, in the order the oldest change names them, then `work: null` for changes that name none. A change with two work items is under both."
254
+ "description": "The same changes by work item, then pull request, then commit (#4168 4.4). Work ids come first, in the order the oldest change names them, then the issues that changes with no work id close (`issue`, with `--forge-issues`), then `work: null` and `issue: null` for changes under neither. A change with two work items is under both."
255
255
  },
256
256
  "flags": {
257
257
  "type": "array",
@@ -276,6 +276,13 @@
276
276
  ],
277
277
  "description": "The work item id a `Chant-Record: work:<id>` trailer names, or null."
278
278
  },
279
+ "issue": {
280
+ "type": [
281
+ "integer",
282
+ "null"
283
+ ],
284
+ "description": "For changes with no work id: an issue their pull request closes, as `closes` says (#4649); null otherwise. Written by chant 0.124.63 and newer."
285
+ },
279
286
  "pullRequests": {
280
287
  "type": "array",
281
288
  "items": {
@@ -354,6 +361,17 @@
354
361
  "null"
355
362
  ],
356
363
  "description": "The merge record `_merges/<sha>.json` on chant/lifecycle (#4168 4.1), as stored, or null when there is none."
364
+ },
365
+ "closes": {
366
+ "anyOf": [
367
+ {
368
+ "$ref": "#/$defs/closes"
369
+ },
370
+ {
371
+ "type": "null"
372
+ }
373
+ ],
374
+ "description": "What the forge says `pr` closes (#4649), when the read was asked to (`--forge-issues`) and the change has a pull request; null otherwise. Written by chant 0.124.63 and newer."
357
375
  }
358
376
  },
359
377
  "description": "One first-parent commit."
@@ -399,6 +417,34 @@
399
417
  "description": "The value per environment, as the working tree's record writes it."
400
418
  }
401
419
  }
420
+ },
421
+ "closes": {
422
+ "type": "object",
423
+ "required": [
424
+ "resolved",
425
+ "issues",
426
+ "reason"
427
+ ],
428
+ "properties": {
429
+ "resolved": {
430
+ "type": "boolean",
431
+ "description": "Whether the forge answered. False without a forge chant reads, without a token, offline, or when the forge answered an error."
432
+ },
433
+ "issues": {
434
+ "type": "array",
435
+ "items": {
436
+ "type": "integer"
437
+ },
438
+ "description": "The issues of the repository the pull request closes, ascending. Empty when not resolved."
439
+ },
440
+ "reason": {
441
+ "type": [
442
+ "string",
443
+ "null"
444
+ ],
445
+ "description": "Why the forge was not read, or null when it was."
446
+ }
447
+ }
402
448
  }
403
449
  }
404
450
  }
@@ -23,6 +23,7 @@
23
23
  import { z } from "zod";
24
24
  import type { RecordSource } from "../record-source.js";
25
25
  import { type ExcludedSigner, type Signer } from "./trust-files.js";
26
+ import type { PasskeySigner } from "../../lifecycle/gate-webauthn.js";
26
27
  export { DEFAULT_SIGNERS_PATH, TRUST_CONFIG_PATH, parseAllowedSigners, renderAllowedSigners, type ExcludedSigner, type Signer, type SignerSet, } from "./trust-files.js";
27
28
  export declare const trustConfigSchema: z.ZodObject<{
28
29
  schema: z.ZodLiteral<1>;
@@ -41,6 +42,13 @@ export declare const trustConfigSchema: z.ZodObject<{
41
42
  }>;
42
43
  key: z.ZodString;
43
44
  }, z.core.$strict>>>;
45
+ passkeys: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ principal: z.ZodString;
47
+ id: z.ZodString;
48
+ publicKey: z.ZodString;
49
+ rpId: z.ZodString;
50
+ origins: z.ZodArray<z.ZodString>;
51
+ }, z.core.$strict>>>;
44
52
  admitted: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
53
  return: z.ZodString;
46
54
  signers: z.ZodArray<z.ZodObject<{
@@ -82,6 +90,8 @@ export interface TrustPolicy {
82
90
  principal: string;
83
91
  reason: string;
84
92
  }>;
93
+ /** Passkeys that sign people's gate approvals (#4646). Absent on a policy built by hand: none. */
94
+ passkeys?: PasskeySigner[];
85
95
  /** Signers admitted per return (#2552), keyed by return id. They verify that return's commits and seals only. */
86
96
  admitted: Record<string, Signer[]>;
87
97
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/workspace/trust/policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,E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C,CAAC;IAC9D,kGAAkG;IAClG,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;IAC3B,iHAAiH;IACjH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/E;AAED,0HAA0H;AAC1H,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAG5D;AAED,wGAAwG;AACxG,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,CAI9D;AAED,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,WAAW,CAErF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAkDtF;AAWD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAE3E;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKnF"}
@@ -63,6 +63,23 @@ export const trustConfigSchema = z
63
63
  })
64
64
  .strict())
65
65
  .optional(),
66
+ /**
67
+ * Passkeys that sign gate approvals for people (#4646): a WebAuthn
68
+ * credential's id, its public key as base64url DER SubjectPublicKeyInfo,
69
+ * the relying party id and the origins an assertion may come from. A
70
+ * passkey signs only a gate approval (`chant approve --signature`).
71
+ */
72
+ passkeys: z
73
+ .array(z
74
+ .object({
75
+ principal: z.string().min(1),
76
+ id: z.string().regex(/^[A-Za-z0-9_-]+$/, "a credential id, base64url with no padding"),
77
+ publicKey: z.string().regex(/^[A-Za-z0-9_-]+$/, "a DER SubjectPublicKeyInfo, base64url with no padding"),
78
+ rpId: z.string().min(1),
79
+ origins: z.array(z.string().min(1)).min(1),
80
+ })
81
+ .strict())
82
+ .optional(),
66
83
  /**
67
84
  * Signers admitted for the work one return brought back (#2552, D10,
68
85
  * ws-004). Each entry names the return by its id (the file
@@ -104,7 +121,7 @@ export function policyWriters(policy) {
104
121
  }
105
122
  /** A policy with nothing in it: attestation off. */
106
123
  export function emptyPolicy(base, problems = []) {
107
- return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], admitted: {}, problems };
124
+ return { base, signersPath: DEFAULT_SIGNERS_PATH, active: false, signers: [], excluded: [], roles: {}, adopted: [], runners: [], excludedRunners: [], passkeys: [], admitted: {}, problems };
108
125
  }
109
126
  /**
110
127
  * Read the policy through `source`, which must read the base revision.
@@ -160,6 +177,7 @@ export function readTrustPolicy(source, base) {
160
177
  adopted: config.adopted ?? [],
161
178
  runners,
162
179
  excludedRunners,
180
+ passkeys: config.passkeys ?? [],
163
181
  admitted: admittedOf(config),
164
182
  problems: [],
165
183
  };