@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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `chant workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--json]`
2
+ * `chant workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--forge-issues] [--json]`
3
3
  * (#2651, #3034): the intent graph over one region (`intent.ts`), printed as JSON
4
4
  * with `--json` or as a walk, one line per node, in the order of #2650
5
5
  * section B: the region, its decisions, their artifacts, the commits, and the
@@ -9,18 +9,33 @@
9
9
  * to the person about it (#2656). Without `--kind`, the walk reads every
10
10
  * record kind the declaration names (#2680). Last comes the why chain (#4023):
11
11
  * each commit's work item, ci tag and release, and each release's gates and
12
- * deploys.
12
+ * deploys. With `--forge-issues` (#4649), each commit with a pull request
13
+ * also carries the issues the forge says it closes (`./forge-work.ts`).
13
14
  */
14
15
 
15
16
  import { resolve } from "node:path";
16
17
  import { formatError } from "../cli/format";
17
18
  import type { CommandContext } from "../cli/registry";
19
+ import type { PullRequestCloses } from "./forge-work";
18
20
  import { intentRecord, type IntentRecordDocument } from "./intent-record";
19
21
  import type { IntentTrace, TraceGate } from "./intent-trace";
20
22
  import { intentGraph, type ArtifactNode, type CommitNode, type DecisionNode, type IntentDocument, type IntentEdge, type IntentNode, type RunNode, type WhyAnswer, type WorkNode } from "./intent";
21
23
 
22
- const USAGE = "chant workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--json]";
23
- const RECORD_USAGE = "chant workspace graph --intent --record <id> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--json]";
24
+ const USAGE = "chant workspace graph --intent <path[:start-end]|path#symbol|member/node|sha> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--forge-issues] [--json]";
25
+ const RECORD_USAGE = "chant workspace graph --intent --record <id> [--at <rev>] [--kind <kind file>...] [--follow-squash] [--forge-issues] [--json]";
26
+
27
+ /** With `--forge-issues` (#4649): set each commit's `closes` from the forge. */
28
+ async function withCloses(cwd: string, commits: { pullRequest: number | null; closes?: PullRequestCloses | null }[]): Promise<void> {
29
+ const { forgeWorkReader, setCommitCloses } = await import("./forge-work");
30
+ await setCommitCloses(commits, forgeWorkReader(cwd));
31
+ }
32
+
33
+ /** ` closes #1, #2`, ` (issues not read: why)`, or nothing, after a pull request in the text. */
34
+ function closesText(closes: PullRequestCloses | null | undefined): string {
35
+ if (!closes) return "";
36
+ if (!closes.resolved) return ` (issues not read: ${closes.reason})`;
37
+ return closes.issues.length > 0 ? ` closes ${closes.issues.map((n) => `#${n}`).join(", ")}` : "";
38
+ }
24
39
 
25
40
  type Result = Exclude<IntentDocument, { error: unknown }>;
26
41
  type RecordResult = Exclude<IntentRecordDocument, { error: unknown }>;
@@ -113,6 +128,7 @@ function commitLine(doc: Result, c: CommitNode): string[] {
113
128
  for (const s of edgesFrom(doc, e.to, "cites-evidence")) out.push(` evidence ${s.to.slice("evidence:".length)}`);
114
129
  }
115
130
  out.push(...joinLines(c.joins));
131
+ if (c.closes && c.pullRequest !== null) out.push(` pr #${c.pullRequest}${closesText(c.closes)}`);
116
132
  if (c.squash) {
117
133
  const s = c.squash;
118
134
  out.push(` squash #${s.pullRequest}${s.followed ? `: ${s.commits.length} original ${s.commits.length === 1 ? "commit" : "commits"} from ${s.ref}${s.fetched ? ", fetched" : ""}` : ", not followed"}`);
@@ -254,7 +270,8 @@ export function formatIntentRecord(doc: RecordResult): string {
254
270
  : "nothing else accounts for it";
255
271
  const runs = (c.runs ?? []).map((r) => `run ${r.id}${r.model ? ` (${r.model})` : ""}${r.joinedBy?.includes("squash") && !r.joinedBy.some((j) => j !== "squash") ? " through the squash" : ""}`).join(", ");
256
272
  const squash = c.squash ? `; squash of #${c.squash.pullRequest}${c.squash.followed ? `, ${c.squash.commits.length} original ${c.squash.commits.length === 1 ? "commit" : "commits"}` : ", not followed"}` : "";
257
- out.push(`${c.bucket.padEnd(12)} ${short(c.sha)} ${c.date.slice(0, 10)} ${c.subject}; ${why}${runs ? `; ${runs}` : ""}${squash}; ${c.files.join(", ") || c.entries.join(", ")}`);
273
+ const pr = c.closes && c.pullRequest !== null ? `; #${c.pullRequest}${closesText(c.closes)}` : "";
274
+ out.push(`${c.bucket.padEnd(12)} ${short(c.sha)} ${c.date.slice(0, 10)} ${c.subject}; ${why}${runs ? `; ${runs}` : ""}${squash}${pr}; ${c.files.join(", ") || c.entries.join(", ")}`);
258
275
  }
259
276
  for (const x of doc.reasons) out.push(`reason ${x.code}: ${x.message}`);
260
277
  const n = doc.counts;
@@ -265,6 +282,7 @@ export function formatIntentRecord(doc: RecordResult): string {
265
282
  async function runRecord(ctx: CommandContext, cwd: string, kinds: string[] | undefined): Promise<number> {
266
283
  const { args } = ctx;
267
284
  const { doc, failed } = await intentRecord({ cwd, record: args.record!, at: args.at, kinds: kinds?.map((k) => resolve(k)), followSquash: args.followSquash });
285
+ if (args.forgeIssues && !("error" in doc)) await withCloses(cwd, doc.commits);
268
286
  if (args.json) console.log(JSON.stringify(doc, null, 2));
269
287
  if ("error" in doc) {
270
288
  console.error(formatError({ message: `${doc.error.code}: ${doc.error.message}`, hint: RECORD_USAGE }));
@@ -290,6 +308,7 @@ export async function runWorkspaceIntent(ctx: CommandContext, cwd: string): Prom
290
308
  // No --kind: undefined, so the walk reads the kinds the declaration names (#2680).
291
309
  const kinds = args.kinds ?? (args.kind !== undefined ? [args.kind] : undefined);
292
310
  const { doc, failed } = await intentGraph({ cwd, region: args.intent, at: args.at, kinds: kinds?.map((k) => resolve(k)), followSquash: args.followSquash });
311
+ if (args.forgeIssues && !("error" in doc)) await withCloses(cwd, ofKind(doc, "commit"));
293
312
  if (args.json) console.log(JSON.stringify(doc, null, 2));
294
313
  if ("error" in doc) {
295
314
  console.error(formatError({ message: `${doc.error.code}: ${doc.error.message}`, hint: USAGE }));
@@ -359,6 +359,38 @@
359
359
  ],
360
360
  "description": "The number in a (#n) that ends the subject, as a squash merge writes it, or null."
361
361
  },
362
+ "closes": {
363
+ "type": [
364
+ "object",
365
+ "null"
366
+ ],
367
+ "required": [
368
+ "resolved",
369
+ "issues",
370
+ "reason"
371
+ ],
372
+ "properties": {
373
+ "resolved": {
374
+ "type": "boolean",
375
+ "description": "Whether the forge answered. False without a forge chant reads, without a token, offline, or when the forge answered an error."
376
+ },
377
+ "issues": {
378
+ "type": "array",
379
+ "items": {
380
+ "type": "integer"
381
+ },
382
+ "description": "The issues of the repository the pull request closes, ascending. Empty when not resolved."
383
+ },
384
+ "reason": {
385
+ "type": [
386
+ "string",
387
+ "null"
388
+ ],
389
+ "description": "Why the forge was not read, or null when it was."
390
+ }
391
+ },
392
+ "description": "Only with --forge-issues (#4649): what the forge says pullRequest closes, or null for a commit with no pull request. Added within version 1 by chant 0.124.63."
393
+ },
362
394
  "unit": {
363
395
  "type": [
364
396
  "string",
@@ -60,6 +60,7 @@ import type { RecordView } from "./records-cli";
60
60
  import { addSquashRuns, runsForCommits, type RunRef } from "./runs";
61
61
  import { followSquashes, type Forge, type SquashFollow } from "./squash";
62
62
  import { readTrailerJoins, type CommitTrailerJoins } from "./trailer-joins";
63
+ import type { PullRequestCloses } from "./forge-work";
63
64
  import { joinPath } from "./tree";
64
65
  import { locateWorkspace } from "./which-chant";
65
66
  import { idList } from "./work";
@@ -97,6 +98,8 @@ export interface RecordCommit {
97
98
  date: string;
98
99
  trailers: Record<string, string[]>;
99
100
  pullRequest: number | null;
101
+ /** What the forge says `pullRequest` closes (#4649), only with `--forge-issues`: null for a commit with no pull request. */
102
+ closes?: PullRequestCloses | null;
100
103
  /** The unit a plugin joined the commit to, or null. */
101
104
  unit: string | null;
102
105
  /** What chant's own trailers join the commit to (#3149), as a commit node in `graph --intent` reports it. */
@@ -484,6 +484,38 @@
484
484
  ],
485
485
  "description": "The number in a (#n) that ends the subject, as a squash merge writes it, or null."
486
486
  },
487
+ "closes": {
488
+ "type": [
489
+ "object",
490
+ "null"
491
+ ],
492
+ "required": [
493
+ "resolved",
494
+ "issues",
495
+ "reason"
496
+ ],
497
+ "properties": {
498
+ "resolved": {
499
+ "type": "boolean",
500
+ "description": "Whether the forge answered. False without a forge chant reads, without a token, offline, or when the forge answered an error."
501
+ },
502
+ "issues": {
503
+ "type": "array",
504
+ "items": {
505
+ "type": "integer"
506
+ },
507
+ "description": "The issues of the repository the pull request closes, ascending. Empty when not resolved."
508
+ },
509
+ "reason": {
510
+ "type": [
511
+ "string",
512
+ "null"
513
+ ],
514
+ "description": "Why the forge was not read, or null when it was."
515
+ }
516
+ },
517
+ "description": "Only with --forge-issues (#4649): what the forge says pullRequest closes, or null for a commit with no pull request. Added within version 1 by chant 0.124.63."
518
+ },
487
519
  "signature": {
488
520
  "type": "object",
489
521
  "required": [
@@ -60,6 +60,8 @@
60
60
  import { execFileSync } from "node:child_process";
61
61
  import { realpathSync } from "node:fs";
62
62
  import { basename, dirname, relative, resolve, sep } from "node:path";
63
+ import { NEXT_RELEASE } from "../release-floors";
64
+ import type { PullRequestCloses } from "./forge-work";
63
65
  import { declaredRecordKinds, readDeclaration, readerVersion, resolveGroups, WORKSPACE_ERROR_CODES, WorkspaceReadError, type Declaration } from "./declaration";
64
66
  import { declaredKindFile } from "./declared-kinds";
65
67
  import { isGeneratedPath } from "./generated-files";
@@ -88,6 +90,8 @@ import { idList, isDecided, WORK_WARNING_CODES, type WorkLink, type WorkWarningC
88
90
 
89
91
  /** The version of the `intent` document this chant writes. */
90
92
  export const INTENT_CONTRACT_VERSION = 1;
93
+ /** The first chant whose intent graph and record walk carry a commit's `closes`, with `--forge-issues` (#4649). */
94
+ export const INTENT_CLOSES_FLOOR = NEXT_RELEASE;
91
95
 
92
96
  /** `$id` of the JSON Schema for the document, shipped beside this file. */
93
97
  export const INTENT_OUTPUT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/intent/v1/intent.schema.json";
@@ -245,6 +249,12 @@ export interface CommitNode {
245
249
  trailers: Record<string, string[]>;
246
250
  /** The pull request number the subject ends with, as a squash merge writes it, or null. */
247
251
  pullRequest: number | null;
252
+ /**
253
+ * What the forge says `pullRequest` closes (#4649), only with
254
+ * `--forge-issues`: null for a commit with no pull request. Added within
255
+ * contract 1 by chant {@link INTENT_CLOSES_FLOOR}.
256
+ */
257
+ closes?: PullRequestCloses | null;
248
258
  signature: { level: ProvenanceLevel; reason: string; principal?: string };
249
259
  /** The line ranges the commit changed in the region, in the commit's own version of the file; null for a file or directory region. */
250
260
  lines: LineRange[] | null;
@@ -35,6 +35,7 @@
35
35
  import { mkdirSync, mkdtempSync, realpathSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
36
36
  import { tmpdir } from "node:os";
37
37
  import { join } from "node:path";
38
+ import { CHANT_INSTALL } from "./class-data";
38
39
  import { findInstalledPackage, lexiconPackageName, substituteGraphConfig } from "./kinds";
39
40
  import type { MemberPlan, RunUnit, SkippedEntry } from "./member-commands";
40
41
 
@@ -65,7 +66,7 @@ function lexiconModules(unit: RunUnit, root: string): { modules: string } | { me
65
66
  const reader = unit.reader!;
66
67
  if (!reader.lexicon) return { message: `kind ${unit.kind} names no lexicon` };
67
68
  const name = lexiconPackageName(reader.lexicon);
68
- const installed = findInstalledPackage(name, root);
69
+ const installed = findInstalledPackage(name, root) ?? findInstalledPackage(name, CHANT_INSTALL);
69
70
  if (!installed) {
70
71
  return {
71
72
  message: `kind ${unit.kind} is read by the ${reader.lexicon} lexicon, and ${name} is not installed in a node_modules at or above ${root}; install it there to read this member`,
@@ -14,6 +14,7 @@ import {
14
14
  kindsFileShips,
15
15
  loadKindRegistry,
16
16
  parseKindData,
17
+ pinnedPackageDir,
17
18
  probeKind,
18
19
  readPackageKinds,
19
20
  resolveKind,
@@ -259,6 +260,18 @@ describe("loadKindRegistry: kinds from the pins", () => {
259
260
  expect(existsSync(join(root, "node_modules/plain/IMPORTED"))).toBe(false);
260
261
  });
261
262
 
263
+ test("a pin the checkout does not hold is found beside chant's own install, at the pinned version", () => {
264
+ const checkout = dir({});
265
+ const install = dir(pkg("tf-kinds", "1.0.0", [tf]));
266
+ expect(pinnedPackageDir({ package: "tf-kinds", version: "1.0.0", path: null }, checkout, install)).toEqual({
267
+ dir: join(install, "node_modules/tf-kinds"),
268
+ source: "tf-kinds",
269
+ });
270
+ expect(pinnedPackageDir({ package: "tf-kinds", version: "2.0.0", path: null }, checkout, install)).toEqual({
271
+ problem: expect.stringContaining("tf-kinds is pinned at 2.0.0"),
272
+ });
273
+ });
274
+
262
275
  test("reads a local plugin by path, and leaves out a kind two sources both supply", () => {
263
276
  const root = dir({
264
277
  "plugins/tf/package.json": JSON.stringify({ name: "tf", exports: { "./workspace-kinds": "./k.json" } }),
@@ -23,7 +23,7 @@ import schema from "./workspace-kinds.schema.json" with { type: "json" };
23
23
  import type { WorkspaceTree } from "./tree";
24
24
  import { joinPath, skippedDir } from "./tree";
25
25
  import { checkPinIntegrity } from "./pin-integrity";
26
- import { dataExportTarget, findInstalledPackage } from "./class-data";
26
+ import { CHANT_INSTALL, dataExportTarget, findInstalledPackage } from "./class-data";
27
27
  import { loadAjv2020 } from "./ajv2020";
28
28
  import yaml from "js-yaml";
29
29
 
@@ -747,10 +747,19 @@ export interface LoadedKinds {
747
747
  * directory, checked against its integrity digest when it has one. Null for
748
748
  * a pin that names neither. Shared by the kinds and the principal classes
749
749
  * (#3080), so both read a pin the same way.
750
+ *
751
+ * A package the checkout does not hold is looked up from `beside`, this chant's
752
+ * own install (plywood#54): a product's image carries chant and the pinned
753
+ * package together, and a checkout needs no copy of its own. The version check
754
+ * below still applies.
750
755
  */
751
- export function pinnedPackageDir(pin: PinLike, workspaceRoot: string): { dir: string; source: string } | { problem: string } | null {
756
+ export function pinnedPackageDir(
757
+ pin: PinLike,
758
+ workspaceRoot: string,
759
+ beside: string = CHANT_INSTALL,
760
+ ): { dir: string; source: string } | { problem: string } | null {
752
761
  if (pin.package) {
753
- const dir = findInstalledPackage(pin.package, workspaceRoot);
762
+ const dir = findInstalledPackage(pin.package, workspaceRoot) ?? findInstalledPackage(pin.package, beside);
754
763
  if (!dir) return { problem: `pinned package ${pin.package} is not installed; install it to read the kinds it supplies` };
755
764
  let installed: unknown;
756
765
  try {
@@ -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
+ }
@@ -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
  }