@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
@@ -10,6 +10,7 @@ import { getRuntime } from "../runtime-adapter.js";
10
10
  import { memberLedgerPrefix, resolveMemberLedger } from "./member-ledger.js";
11
11
  import { LIFECYCLE_LOCAL_NOTE } from "./local-note.js";
12
12
  import { ledgerRecordingOff, NO_RECORD_PUSH_NOTE, overlayTip, setOverlayTip } from "./no-record.js";
13
+ import { chooseLedgerRemote, lifecycleRemoteOverride } from "./ledger-remote.js";
13
14
  const STATE_BRANCH = "chant/lifecycle";
14
15
  /**
15
16
  * The branch path of `dir` for the project at `cwd` (#2538): `dir` itself at
@@ -655,7 +656,7 @@ export async function pushLifecycleStatus(opts) {
655
656
  if (found === null)
656
657
  return { status: "no-remote" };
657
658
  if ("failed" in found)
658
- return { status: "failed", remote: "(unknown)", stderr: found.stderr };
659
+ return { status: "failed", remote: found.named ?? "(unknown)", stderr: found.stderr };
659
660
  const { remote } = found;
660
661
  // Capture the lease SHA — if null, the remote ref doesn't exist yet
661
662
  // (first-time push) and we send `--force-with-lease=ref:` (empty SHA),
@@ -687,7 +688,7 @@ export async function pushLifecycleStatus(opts) {
687
688
  * Returns false (without throwing) when no remote is configured, or when git
688
689
  * refused the push for a reason other than a stale lease.
689
690
  *
690
- * The remote is the ledger's ({@link ledgerRemote}: `origin` when there is one),
691
+ * The remote is the ledger's ({@link ledgerRemote}: the one `CHANT_LIFECYCLE_REMOTE` names, else `origin`),
691
692
  * the same one {@link fetchLifecycleStatus} reads, and a push that lands
692
693
  * records the tip it pushed as the remote-tracking ref, so the next push's
693
694
  * lease is right in a single-branch clone too (#3391).
@@ -965,23 +966,22 @@ const NON_FAST_FORWARD_RE = /non-fast-forward|rejected/i;
965
966
  */
966
967
  const C_LOCALE_ENV = { LC_ALL: "C", LANGUAGE: "" };
967
968
  /**
968
- * The remote the ledger lives on.
969
+ * The remote the ledger lives on ({@link chooseLedgerRemote}).
969
970
  *
970
- * `origin` when it exists, rather than whichever name sorts first — a repo
971
- * with a `backup` remote alongside `origin` would otherwise fetch the ledger
972
- * from `backup`. A non-zero exit is *not* read as "no remote": a git that
973
- * failed to answer is not evidence that a project is single-machine, and
974
- * treating it as one is what lets an unreadable ledger look empty.
971
+ * The one `CHANT_LIFECYCLE_REMOTE` names (#4647), else `origin` when it
972
+ * exists, rather than whichever name sorts first — a repo with a `backup`
973
+ * remote alongside `origin` would otherwise fetch the ledger from `backup`.
974
+ * A non-zero exit is *not* read as "no remote": a git that failed to answer
975
+ * is not evidence that a project is single-machine, and treating it as one is
976
+ * what lets an unreadable ledger look empty. Nor is a named remote the
977
+ * repository lacks.
975
978
  */
976
979
  async function ledgerRemote(cwd) {
977
980
  const rt = getRuntime();
978
981
  const result = await rt.spawn(["git", "remote"], { cwd, env: C_LOCALE_ENV });
979
982
  if (result.exitCode !== 0)
980
983
  return { failed: true, stderr: (result.stderr ?? "").trim() };
981
- const names = result.stdout.trim().split("\n").map((n) => n.trim()).filter(Boolean);
982
- if (names.length === 0)
983
- return null;
984
- return { remote: names.includes("origin") ? "origin" : names[0] };
984
+ return chooseLedgerRemote(result.stdout.trim().split("\n").map((n) => n.trim()).filter(Boolean));
985
985
  }
986
986
  /** A scratch ref this module owns, used to resolve the remote tip without touching the ledger branch. */
987
987
  const PROBE_REF = "refs/chant/lifecycle-probe";
@@ -1009,7 +1009,7 @@ export async function fetchLifecycleStatus(opts) {
1009
1009
  if (found === null)
1010
1010
  return { status: "no-remote" };
1011
1011
  if ("failed" in found) {
1012
- return { status: "unreachable", remote: "(unknown)", stderr: found.stderr };
1012
+ return { status: "unreachable", remote: found.named ?? "(unknown)", stderr: found.stderr };
1013
1013
  }
1014
1014
  const { remote } = found;
1015
1015
  const fetchResult = await rt.spawn(["git", "fetch", remote, `${STATE_BRANCH}:${STATE_BRANCH}`], { cwd, env: C_LOCALE_ENV });
@@ -1308,10 +1308,13 @@ export async function pushRefStatus(ref, opts) {
1308
1308
  if (ledgerRecordingOff())
1309
1309
  return "no-remote";
1310
1310
  const rt = getRuntime();
1311
- const remoteResult = await rt.spawn(["git", "remote"], { cwd: opts?.cwd });
1312
- if (remoteResult.exitCode !== 0 || !remoteResult.stdout.trim())
1311
+ // #4647: the ledger's remote, so a lease ref goes where the branch does.
1312
+ const found = await ledgerRemote(opts?.cwd);
1313
+ if (found === null)
1313
1314
  return "no-remote";
1314
- const remote = remoteResult.stdout.trim().split("\n")[0];
1315
+ if ("failed" in found)
1316
+ return lifecycleRemoteOverride() === undefined ? "no-remote" : "rejected";
1317
+ const { remote } = found;
1315
1318
  let expected;
1316
1319
  if (opts?.expect !== undefined) {
1317
1320
  expected = opts.expect;
@@ -1351,10 +1354,12 @@ export async function fetchRefInto(remoteRef, localRef, opts) {
1351
1354
  */
1352
1355
  export async function fetchRefIntoStatus(remoteRef, localRef, opts) {
1353
1356
  const rt = getRuntime();
1354
- const remoteResult = await rt.spawn(["git", "remote"], { cwd: opts?.cwd });
1355
- if (remoteResult.exitCode !== 0 || !remoteResult.stdout.trim())
1357
+ const found = await ledgerRemote(opts?.cwd);
1358
+ if (found === null)
1356
1359
  return "no-remote";
1357
- const remote = remoteResult.stdout.trim().split("\n")[0];
1360
+ if ("failed" in found)
1361
+ return lifecycleRemoteOverride() === undefined ? "no-remote" : "failed";
1362
+ const { remote } = found;
1358
1363
  const fetchResult = await rt.spawn(["git", "fetch", remote, `+${remoteRef}:${localRef}`], { cwd: opts?.cwd, env: C_LOCALE_ENV });
1359
1364
  if (fetchResult.exitCode === 0)
1360
1365
  return "fetched";
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Which remote `chant/lifecycle` is fetched from and pushed to (#4647).
3
+ *
4
+ * By default the ledger lives on `origin`, or on the first remote when there
5
+ * is no `origin`. `CHANT_LIFECYCLE_REMOTE=<name>` names another one, for a
6
+ * checkout whose `origin` is not where the ledger belongs (a deploy box that
7
+ * clones from a mirror, say). Every read and write of the ledger goes through
8
+ * here: the fetch, the push and its lease, the remote-tracking ref
9
+ * `refs/remotes/<remote>/chant/lifecycle`, and the lease and lock refs pushed
10
+ * beside the branch.
11
+ *
12
+ * A name the repository has no remote by is an error, never a fallback to
13
+ * `origin`: a ledger pushed to the wrong remote is what the setting exists to
14
+ * prevent.
15
+ *
16
+ * Kept free of git and the runtime adapter, so the synchronous readers (the
17
+ * trust checks, `ci base`, ci-serve) can use it too.
18
+ */
19
+ /** The environment variable that names the ledger's remote. */
20
+ export declare const LIFECYCLE_REMOTE_ENV = "CHANT_LIFECYCLE_REMOTE";
21
+ /** The remote `CHANT_LIFECYCLE_REMOTE` names, or undefined when it is unset or empty. */
22
+ export declare function lifecycleRemoteOverride(env?: NodeJS.ProcessEnv): string | undefined;
23
+ /** What {@link chooseLedgerRemote} found: a remote, no remote at all, or a setting that names none of them. */
24
+ export type LedgerRemoteChoice = {
25
+ remote: string;
26
+ } | {
27
+ failed: true;
28
+ stderr: string;
29
+ named?: string;
30
+ } | null;
31
+ /**
32
+ * The ledger's remote among `names`, the output of `git remote`: the one
33
+ * `CHANT_LIFECYCLE_REMOTE` names, else `origin`, else the first. Null when
34
+ * there is no remote and nothing is named.
35
+ */
36
+ export declare function chooseLedgerRemote(names: readonly string[], env?: NodeJS.ProcessEnv): LedgerRemoteChoice;
37
+ //# sourceMappingURL=ledger-remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ledger-remote.d.ts","sourceRoot":"","sources":["../../src/lifecycle/ledger-remote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,yFAAyF;AACzF,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAGhG;AAED,+GAA+G;AAC/G,MAAM,MAAM,kBAAkB,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC;AAE9G;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,CASrH"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Which remote `chant/lifecycle` is fetched from and pushed to (#4647).
3
+ *
4
+ * By default the ledger lives on `origin`, or on the first remote when there
5
+ * is no `origin`. `CHANT_LIFECYCLE_REMOTE=<name>` names another one, for a
6
+ * checkout whose `origin` is not where the ledger belongs (a deploy box that
7
+ * clones from a mirror, say). Every read and write of the ledger goes through
8
+ * here: the fetch, the push and its lease, the remote-tracking ref
9
+ * `refs/remotes/<remote>/chant/lifecycle`, and the lease and lock refs pushed
10
+ * beside the branch.
11
+ *
12
+ * A name the repository has no remote by is an error, never a fallback to
13
+ * `origin`: a ledger pushed to the wrong remote is what the setting exists to
14
+ * prevent.
15
+ *
16
+ * Kept free of git and the runtime adapter, so the synchronous readers (the
17
+ * trust checks, `ci base`, ci-serve) can use it too.
18
+ */
19
+ /** The environment variable that names the ledger's remote. */
20
+ export const LIFECYCLE_REMOTE_ENV = "CHANT_LIFECYCLE_REMOTE";
21
+ /** The remote `CHANT_LIFECYCLE_REMOTE` names, or undefined when it is unset or empty. */
22
+ export function lifecycleRemoteOverride(env = process.env) {
23
+ const value = env[LIFECYCLE_REMOTE_ENV]?.trim();
24
+ return value ? value : undefined;
25
+ }
26
+ /**
27
+ * The ledger's remote among `names`, the output of `git remote`: the one
28
+ * `CHANT_LIFECYCLE_REMOTE` names, else `origin`, else the first. Null when
29
+ * there is no remote and nothing is named.
30
+ */
31
+ export function chooseLedgerRemote(names, env = process.env) {
32
+ const named = lifecycleRemoteOverride(env);
33
+ if (named !== undefined) {
34
+ if (names.includes(named))
35
+ return { remote: named };
36
+ const have = names.length === 0 ? "this repository has no remotes" : `this repository's remotes are ${names.join(", ")}`;
37
+ return { failed: true, stderr: `${LIFECYCLE_REMOTE_ENV} names the remote "${named}", and ${have}`, named };
38
+ }
39
+ if (names.length === 0)
40
+ return null;
41
+ return { remote: names.includes("origin") ? "origin" : names[0] };
42
+ }
@@ -0,0 +1,76 @@
1
+ import type { QueryData } from "./query.js";
2
+ /** The version of the `plan-stale` document this chant writes. */
3
+ export declare const PLAN_STALE_CONTRACT_VERSION = 1;
4
+ /** `$id` of the JSON Schema for `chant plan stale --json`. */
5
+ export declare const PLAN_STALE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json";
6
+ /** The first chant that answers `chant plan stale` (#4648). */
7
+ export declare const PLAN_STALE_FLOOR = "0.124.63";
8
+ /** Why the read stopped. Closed; each code is in `../workspace/reason-codes.ts`. */
9
+ export declare const PLAN_STALE_ERROR_CODES: readonly ["not-a-git-repository", "ledger-unreadable"];
10
+ /** One gate the plan waits at, and what it covers. */
11
+ export interface PlanStaleTarget {
12
+ member: string | null;
13
+ op: string;
14
+ gate: string;
15
+ /** The environment the plan is for, or null when neither the fact nor its run names one. */
16
+ environment: string | null;
17
+ }
18
+ /** One apply that touched a target after the plan was recorded. */
19
+ export interface PlanStaleApply {
20
+ /** Where it was read: `applies` for an apply under an approval, `deploys` for a deploy record. */
21
+ source: "applies" | "deploys";
22
+ member: string | null;
23
+ /** The op it applied under; null for a deploy record. */
24
+ op: string | null;
25
+ gate: string | null;
26
+ /** The environment; null for an apply under an approval, whose line names none. */
27
+ environment: string | null;
28
+ /** The component a deploy record deployed; null for an apply under an approval. */
29
+ component: string | null;
30
+ /** The plan it applied; null for a deploy record. */
31
+ planDigest: string | null;
32
+ /** When it was recorded. */
33
+ at: string;
34
+ /** Who ran it: a deploy record's `actor`; null for an apply under an approval, which names only its approver. */
35
+ actor: string | null;
36
+ approvedBy: string | null;
37
+ runId: string | null;
38
+ runUrl: string | null;
39
+ gitSha: string | null;
40
+ /** How an apply under an approval ended: `applied`, `failed`, or null while it has no finished line. Null for a deploy record. */
41
+ result: string | null;
42
+ }
43
+ export type PlanStaleDocument = {
44
+ $schema: string;
45
+ contract: number;
46
+ chant: string;
47
+ digest: string;
48
+ /** The plan, or null when no pending gate fact records the digest. */
49
+ plan: {
50
+ recordedAt: string;
51
+ runId: string | null;
52
+ gitSha: string | null;
53
+ targets: PlanStaleTarget[];
54
+ } | null;
55
+ /** Whether any apply touched a target after the plan was recorded; null when there is no plan. */
56
+ stale: boolean | null;
57
+ /** Those applies, oldest first. */
58
+ applies: PlanStaleApply[];
59
+ } | {
60
+ $schema: string;
61
+ contract: number;
62
+ chant: string;
63
+ error: {
64
+ code: (typeof PLAN_STALE_ERROR_CODES)[number];
65
+ message: string;
66
+ };
67
+ };
68
+ /** The document's head: `$schema`, `contract` and `chant`. */
69
+ export declare function planStaleHead(chant: string): {
70
+ $schema: string;
71
+ contract: number;
72
+ chant: string;
73
+ };
74
+ /** Whether `digest`'s plan is stale, read from the rows of the `gates`, `runs`, `applies` and `deploys` tables. */
75
+ export declare function planStaleness(data: Pick<QueryData, "gates" | "runs" | "applies" | "deploys">, digest: string, chant: string): PlanStaleDocument;
76
+ //# sourceMappingURL=plan-stale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-stale.d.ts","sourceRoot":"","sources":["../../src/lifecycle/plan-stale.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAGnD,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB,sFAAsF,CAAC;AAExH,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,aAAe,CAAC;AAE7C,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,YAAI,sBAAsB,EAAE,mBAAmB,CAAU,CAAC;AAE7F,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,kGAAkG;IAClG,MAAM,EAAE,SAAS,GAAG,SAAS,CAAC;IAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yDAAyD;IACzD,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,mFAAmF;IACnF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mFAAmF;IACnF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,qDAAqD;IACrD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iHAAiH;IACjH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kIAAkI;IAClI,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,OAAO,EAAE,eAAe,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;IAC7G,kGAAkG;IAClG,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACtB,mCAAmC;IACnC,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B,GACD;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE;QAAE,IAAI,EAAE,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AAKpI,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAEjG;AAED,mHAAmH;AACnH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAwE/I"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * `chant plan stale <digest> --json` (#4648): whether anything applied to a
3
+ * plan's targets after the plan was recorded, so a platform can ask before it
4
+ * puts the plan in front of a person to approve. chant checks the digest
5
+ * again when the approved run applies; this read answers the same question
6
+ * earlier, and names the applies.
7
+ *
8
+ * The plan is the pending gate facts that record `digest` (`_gates/<op>.jsonl`).
9
+ * It was recorded at the earliest of them. Its targets are each fact's
10
+ * member, op and environment: the fact's own `environment` (a component
11
+ * gate's), else the `env` of the run that reached the gate.
12
+ *
13
+ * An apply touches a target when it was recorded after the plan and:
14
+ *
15
+ * - it is an apply under an approval (`_gates/<op>/applied.jsonl`, the
16
+ * `applies` table) of the same member and op, for another plan; or
17
+ * - it is a deploy record (`<env>/releases.jsonl`, the `deploys` table) of
18
+ * the same member and environment, of any component.
19
+ *
20
+ * An apply of this same plan doesn't make it stale. Neither does anything in
21
+ * another member or environment.
22
+ *
23
+ * Pure over the rows `chant query` loads (`./query.ts` {@link loadQueryData}):
24
+ * the caller reads the ledgers, and this reads no git and writes nothing.
25
+ */
26
+ import { samePlanDigest } from "./plan-digest.js";
27
+ import { NEXT_RELEASE } from "../release-floors.js";
28
+ /** The version of the `plan-stale` document this chant writes. */
29
+ export const PLAN_STALE_CONTRACT_VERSION = 1;
30
+ /** `$id` of the JSON Schema for `chant plan stale --json`. */
31
+ export const PLAN_STALE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/plan-stale/v1/plan-stale.schema.json";
32
+ /** The first chant that answers `chant plan stale` (#4648). */
33
+ export const PLAN_STALE_FLOOR = NEXT_RELEASE;
34
+ /** Why the read stopped. Closed; each code is in `../workspace/reason-codes.ts`. */
35
+ export const PLAN_STALE_ERROR_CODES = ["not-a-git-repository", "ledger-unreadable"];
36
+ const text = (v) => (typeof v === "string" ? v : null);
37
+ const time = (iso) => new Date(iso).getTime();
38
+ /** The document's head: `$schema`, `contract` and `chant`. */
39
+ export function planStaleHead(chant) {
40
+ return { $schema: PLAN_STALE_SCHEMA_ID, contract: PLAN_STALE_CONTRACT_VERSION, chant };
41
+ }
42
+ /** Whether `digest`'s plan is stale, read from the rows of the `gates`, `runs`, `applies` and `deploys` tables. */
43
+ export function planStaleness(data, digest, chant) {
44
+ const head = planStaleHead(chant);
45
+ const facts = data.gates.filter((g) => g.kind === "pending" && samePlanDigest(text(g.plan_digest) ?? undefined, digest) && typeof g.timestamp === "string");
46
+ if (facts.length === 0)
47
+ return { ...head, digest, plan: null, stale: null, applies: [] };
48
+ const first = facts.reduce((a, b) => (time(String(b.timestamp)) < time(String(a.timestamp)) ? b : a));
49
+ const recordedAt = String(first.timestamp);
50
+ const since = time(recordedAt);
51
+ const runEnv = (member, runId) => {
52
+ if (runId === null)
53
+ return null;
54
+ const run = data.runs.find((r) => r.member === member && r.id === runId);
55
+ return run ? text(run.env) : null;
56
+ };
57
+ const targets = [];
58
+ for (const f of facts) {
59
+ const member = text(f.member);
60
+ const target = { member, op: String(f.op), gate: String(f.gate), environment: text(f.environment) ?? runEnv(member, text(f.run_id)) };
61
+ if (!targets.some((t) => t.member === target.member && t.op === target.op && t.gate === target.gate && t.environment === target.environment))
62
+ targets.push(target);
63
+ }
64
+ const applies = [];
65
+ for (const a of data.applies) {
66
+ const at = text(a.timestamp);
67
+ if (at === null || !(time(at) > since))
68
+ continue;
69
+ if (samePlanDigest(text(a.plan_digest) ?? undefined, digest))
70
+ continue;
71
+ if (!targets.some((t) => t.member === text(a.member) && t.op === a.op))
72
+ continue;
73
+ applies.push({
74
+ source: "applies",
75
+ member: text(a.member),
76
+ op: text(a.op),
77
+ gate: text(a.gate),
78
+ environment: null,
79
+ component: null,
80
+ planDigest: text(a.plan_digest),
81
+ at,
82
+ actor: null,
83
+ approvedBy: text(a.approved_by),
84
+ runId: text(a.run_id),
85
+ runUrl: null,
86
+ gitSha: text(a.git_sha),
87
+ result: text(a.result),
88
+ });
89
+ }
90
+ for (const d of data.deploys) {
91
+ const at = text(d.timestamp);
92
+ if (at === null || !(time(at) > since))
93
+ continue;
94
+ if (!targets.some((t) => t.environment !== null && t.member === text(d.member) && t.environment === d.env))
95
+ continue;
96
+ applies.push({
97
+ source: "deploys",
98
+ member: text(d.member),
99
+ op: null,
100
+ gate: null,
101
+ environment: text(d.env),
102
+ component: text(d.component),
103
+ planDigest: null,
104
+ at,
105
+ actor: text(d.actor),
106
+ approvedBy: text(d.approver),
107
+ runId: text(d.run_id),
108
+ runUrl: text(d.run_url),
109
+ gitSha: text(d.git_sha),
110
+ result: null,
111
+ });
112
+ }
113
+ applies.sort((x, y) => time(x.at) - time(y.at));
114
+ return {
115
+ ...head,
116
+ digest,
117
+ plan: { recordedAt, runId: text(first.run_id), gitSha: text(first.git_sha), targets },
118
+ stale: applies.length > 0,
119
+ applies,
120
+ };
121
+ }
@@ -15,7 +15,7 @@
15
15
  * (`_authToken=...`, `Authorization: Bearer ...`).
16
16
  */
17
17
  /** Environment variables that hold a token in CI or for a registry. Their values are masked in all publish output. */
18
- export declare const TOKEN_ENV_VARS: readonly ["NODE_AUTH_TOKEN", "NPM_TOKEN", "NPM_ID_TOKEN", "SIGSTORE_ID_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_TOKEN", "ACTIONS_RUNTIME_TOKEN", "GITHUB_TOKEN", "GH_TOKEN", "GITLAB_TOKEN", "CI_JOB_TOKEN", "FORGEJO_TOKEN", "GITEA_TOKEN", "OCI_PASSWORD", "DOCKER_PASSWORD"];
18
+ export declare const TOKEN_ENV_VARS: readonly ["NODE_AUTH_TOKEN", "NPM_TOKEN", "NPM_ID_TOKEN", "SIGSTORE_ID_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_TOKEN", "ACTIONS_RUNTIME_TOKEN", "GITHUB_TOKEN", "GH_TOKEN", "GITLAB_TOKEN", "CI_JOB_TOKEN", "FORGEJO_TOKEN", "GITEA_TOKEN", "OCI_PASSWORD", "DOCKER_PASSWORD", "VSCE_PAT", "OVSX_PAT"];
19
19
  /** What a masked value is replaced with. */
20
20
  export declare const REDACTED = "[redacted]";
21
21
  /** Masks credentials in text a publish prints. */
@@ -1 +1 @@
1
- {"version":3,"file":"publish-credentials.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sHAAsH;AACtH,eAAO,MAAM,cAAc,YACzB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,CACT,CAAC;AAEX,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,iHAAiH;IACjH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAe,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,QAAQ,CAkBnG;AAED,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI,CAStH"}
1
+ {"version":3,"file":"publish-credentials.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sHAAsH;AACtH,eAAO,MAAM,cAAc,YACzB,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,gCAAgC,EAChC,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,UAAU,CACF,CAAC;AAEX,4CAA4C;AAC5C,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,kDAAkD;AAClD,MAAM,WAAW,QAAQ;IACvB,iHAAiH;IACjH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAe,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,QAAQ,CAkBnG;AAED,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,6FAA6F;IAC7F,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI,CAStH"}
@@ -30,6 +30,8 @@ export const TOKEN_ENV_VARS = [
30
30
  "GITEA_TOKEN",
31
31
  "OCI_PASSWORD",
32
32
  "DOCKER_PASSWORD",
33
+ "VSCE_PAT",
34
+ "OVSX_PAT",
33
35
  ];
34
36
  /** What a masked value is replaced with. */
35
37
  export const REDACTED = "[redacted]";
@@ -10,6 +10,9 @@
10
10
  * { type: "npm", packages: ["packages/core", "packages/cli"] },
11
11
  * { type: "oci", image: "dist/api.oci.tar", repository: "ghcr.io/acme/api", tags: ["{label}"], usernameEnv: "GITHUB_ACTOR", passwordEnv: "GITHUB_TOKEN" },
12
12
  * { type: "forge", forge: "github", repo: "acme/api", assets: ["dist/api-linux-amd64.tar.gz"] },
13
+ * { type: "marketplace", marketplace: "openvsx", vsix: "dist/acme.vsix" },
14
+ * { type: "tauri-updater", repo: "acme/app", tag: "app-latest", platforms: { "darwin-aarch64": "dist/Acme_aarch64.app.tar.gz" } },
15
+ * { type: "homebrew", tap: "acme/homebrew-tap", formula: "Formula/api.rb", template: "packaging/api.rb", assets: ["dist/api-linux-amd64.tar.gz"], url: "https://github.com/acme/api/releases/download/{tag}/{name}" },
13
16
  * ],
14
17
  * },
15
18
  * };
@@ -61,6 +64,55 @@ export declare const ForgePublishSchema: z.ZodObject<{
61
64
  tag: z.ZodOptional<z.ZodString>;
62
65
  tokenEnv: z.ZodOptional<z.ZodString>;
63
66
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
67
+ latest: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"legacy">]>>;
68
+ }, z.core.$strict>;
69
+ /**
70
+ * A Homebrew formula in a tap repository on GitHub (#4676), rendered from a
71
+ * template in the member with the release's version and each asset's URL and
72
+ * SHA-256 (./publish-homebrew.ts).
73
+ */
74
+ export declare const HomebrewPublishSchema: z.ZodObject<{
75
+ type: z.ZodLiteral<"homebrew">;
76
+ tap: z.ZodString;
77
+ formula: z.ZodString;
78
+ template: z.ZodString;
79
+ assets: z.ZodArray<z.ZodString>;
80
+ url: z.ZodString;
81
+ branch: z.ZodOptional<z.ZodString>;
82
+ api: z.ZodOptional<z.ZodString>;
83
+ tokenEnv: z.ZodOptional<z.ZodString>;
84
+ }, z.core.$strict>;
85
+ /**
86
+ * A packaged `.vsix` on the VS Code Marketplace or Open VSX (#4676), uploaded
87
+ * at the reveal, since a marketplace has no draft (./publish-marketplace.ts).
88
+ */
89
+ export declare const MarketplacePublishSchema: z.ZodObject<{
90
+ type: z.ZodLiteral<"marketplace">;
91
+ marketplace: z.ZodEnum<{
92
+ openvsx: "openvsx";
93
+ vscode: "vscode";
94
+ }>;
95
+ vsix: z.ZodString;
96
+ registry: z.ZodOptional<z.ZodString>;
97
+ tokenEnv: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strict>;
99
+ /**
100
+ * A Tauri v2 updater manifest and the rolling GitHub release that holds it
101
+ * with the app's bundles (#4676), replaced on each publish
102
+ * (./publish-tauri.ts).
103
+ */
104
+ export declare const TauriUpdaterPublishSchema: z.ZodObject<{
105
+ type: z.ZodLiteral<"tauri-updater">;
106
+ repo: z.ZodString;
107
+ tag: z.ZodString;
108
+ platforms: z.ZodRecord<z.ZodString, z.ZodString>;
109
+ assets: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ notes: z.ZodOptional<z.ZodString>;
111
+ url: z.ZodOptional<z.ZodString>;
112
+ manifest: z.ZodOptional<z.ZodString>;
113
+ latest: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"legacy">]>>;
114
+ api: z.ZodOptional<z.ZodString>;
115
+ tokenEnv: z.ZodOptional<z.ZodString>;
64
116
  }, z.core.$strict>;
65
117
  export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
66
118
  type: z.ZodLiteral<"npm">;
@@ -95,9 +147,44 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
95
147
  tag: z.ZodOptional<z.ZodString>;
96
148
  tokenEnv: z.ZodOptional<z.ZodString>;
97
149
  sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
150
+ latest: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"legacy">]>>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ type: z.ZodLiteral<"homebrew">;
153
+ tap: z.ZodString;
154
+ formula: z.ZodString;
155
+ template: z.ZodString;
156
+ assets: z.ZodArray<z.ZodString>;
157
+ url: z.ZodString;
158
+ branch: z.ZodOptional<z.ZodString>;
159
+ api: z.ZodOptional<z.ZodString>;
160
+ tokenEnv: z.ZodOptional<z.ZodString>;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ type: z.ZodLiteral<"marketplace">;
163
+ marketplace: z.ZodEnum<{
164
+ openvsx: "openvsx";
165
+ vscode: "vscode";
166
+ }>;
167
+ vsix: z.ZodString;
168
+ registry: z.ZodOptional<z.ZodString>;
169
+ tokenEnv: z.ZodOptional<z.ZodString>;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ type: z.ZodLiteral<"tauri-updater">;
172
+ repo: z.ZodString;
173
+ tag: z.ZodString;
174
+ platforms: z.ZodRecord<z.ZodString, z.ZodString>;
175
+ assets: z.ZodOptional<z.ZodArray<z.ZodString>>;
176
+ notes: z.ZodOptional<z.ZodString>;
177
+ url: z.ZodOptional<z.ZodString>;
178
+ manifest: z.ZodOptional<z.ZodString>;
179
+ latest: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<"legacy">]>>;
180
+ api: z.ZodOptional<z.ZodString>;
181
+ tokenEnv: z.ZodOptional<z.ZodString>;
98
182
  }, z.core.$strict>], "type">;
99
183
  export type NpmPublishDeclaration = z.infer<typeof NpmPublishSchema>;
100
184
  export type OciPublishDeclaration = z.infer<typeof OciPublishSchema>;
101
185
  export type ForgePublishDeclaration = z.infer<typeof ForgePublishSchema>;
186
+ export type HomebrewPublishDeclaration = z.infer<typeof HomebrewPublishSchema>;
187
+ export type MarketplacePublishDeclaration = z.infer<typeof MarketplacePublishSchema>;
188
+ export type TauriUpdaterPublishDeclaration = z.infer<typeof TauriUpdaterPublishSchema>;
102
189
  export type PublishDeclaration = z.infer<typeof PublishDeclarationSchema>;
103
190
  //# sourceMappingURL=publish-declaration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"publish-declaration.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;kBAqClB,CAAC;AAEZ,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB;;;;;;;;kBAgBlB,CAAC;AAEZ,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;kBAiBpB,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAyF,CAAC;AAE/H,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"publish-declaration.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;kBAqClB,CAAC;AAEZ,8FAA8F;AAC9F,eAAO,MAAM,gBAAgB;;;;;;;;kBAgBlB,CAAC;AAEZ,wFAAwF;AACxF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;kBAwBpB,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;kBAoBvB,CAAC;AAEZ;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;kBAW1B,CAAC;AAEZ;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;kBA4B3B,CAAC;AAEZ,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAqK,CAAC;AAE3M,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC/E,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACrF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -10,6 +10,9 @@
10
10
  * { type: "npm", packages: ["packages/core", "packages/cli"] },
11
11
  * { type: "oci", image: "dist/api.oci.tar", repository: "ghcr.io/acme/api", tags: ["{label}"], usernameEnv: "GITHUB_ACTOR", passwordEnv: "GITHUB_TOKEN" },
12
12
  * { type: "forge", forge: "github", repo: "acme/api", assets: ["dist/api-linux-amd64.tar.gz"] },
13
+ * { type: "marketplace", marketplace: "openvsx", vsix: "dist/acme.vsix" },
14
+ * { type: "tauri-updater", repo: "acme/app", tag: "app-latest", platforms: { "darwin-aarch64": "dist/Acme_aarch64.app.tar.gz" } },
15
+ * { type: "homebrew", tap: "acme/homebrew-tap", formula: "Formula/api.rb", template: "packaging/api.rb", assets: ["dist/api-linux-amd64.tar.gz"], url: "https://github.com/acme/api/releases/download/{tag}/{name}" },
13
16
  * ],
14
17
  * },
15
18
  * };
@@ -100,6 +103,89 @@ export const ForgePublishSchema = z
100
103
  tokenEnv: envName.optional(),
101
104
  /** The SBOM attached to the release (#4049), relative to the member. Default: one written from the member's lockfile. `false` publishes without one. */
102
105
  sbom: sbomField.optional(),
106
+ /**
107
+ * GitHub only (#4676): whether the release becomes the repository's
108
+ * latest when the reveal publishes it, sent as GitHub's `make_latest`.
109
+ * `"legacy"` lets GitHub pick by creation date and semantic version.
110
+ * Unset, nothing is sent and GitHub makes it latest.
111
+ */
112
+ latest: z.union([z.boolean(), z.literal("legacy")]).optional(),
113
+ })
114
+ .strict();
115
+ /**
116
+ * A Homebrew formula in a tap repository on GitHub (#4676), rendered from a
117
+ * template in the member with the release's version and each asset's URL and
118
+ * SHA-256 (./publish-homebrew.ts).
119
+ */
120
+ export const HomebrewPublishSchema = z
121
+ .object({
122
+ type: z.literal("homebrew"),
123
+ /** The tap's repository, `owner/name`, such as `acme/homebrew-tap`. */
124
+ tap: z.string().regex(/^[^/\s]+\/[^/\s]+$/, "owner/name"),
125
+ /** The formula's path in the tap, such as `Formula/api.rb`. */
126
+ formula: z.string().min(1),
127
+ /** The formula with placeholders, relative to the member: `{{version}}`, `{{label}}`, `{{tag}}`, `{{url:<asset name>}}`, `{{sha256:<asset name>}}`. */
128
+ template: z.string().min(1),
129
+ /** The files the formula downloads, relative to the member. Each is named in the template by its file name. */
130
+ assets: z.array(z.string().min(1)).min(1),
131
+ /** Where each asset is downloaded from: `{tag}`, `{label}`, `{version}` and `{name}` (its file name) are filled in. */
132
+ url: z.string().min(1),
133
+ /** The tap's branch that brew installs from. Default: the repository's default branch. */
134
+ branch: z.string().min(1).optional(),
135
+ /** The GitHub API root. Default `$GITHUB_API_URL`, else `https://api.github.com`. */
136
+ api: z.string().url().optional(),
137
+ /** The variable holding a token that may push to the tap. Default `HOMEBREW_TAP_TOKEN`. */
138
+ tokenEnv: envName.optional(),
139
+ })
140
+ .strict();
141
+ /**
142
+ * A packaged `.vsix` on the VS Code Marketplace or Open VSX (#4676), uploaded
143
+ * at the reveal, since a marketplace has no draft (./publish-marketplace.ts).
144
+ */
145
+ export const MarketplacePublishSchema = z
146
+ .object({
147
+ type: z.literal("marketplace"),
148
+ marketplace: z.enum(["vscode", "openvsx"]),
149
+ /** The `.vsix` that `vsce package` wrote, relative to the member. Its publisher, name and version are read from it. */
150
+ vsix: z.string().min(1),
151
+ /** Open VSX's root, default `https://open-vsx.org`; the VS Code Marketplace's gallery, default `https://marketplace.visualstudio.com`. */
152
+ registry: z.string().url().optional(),
153
+ /** The variable holding the token. Default `VSCE_PAT` for the VS Code Marketplace, `OVSX_PAT` for Open VSX. */
154
+ tokenEnv: envName.optional(),
155
+ })
156
+ .strict();
157
+ /**
158
+ * A Tauri v2 updater manifest and the rolling GitHub release that holds it
159
+ * with the app's bundles (#4676), replaced on each publish
160
+ * (./publish-tauri.ts).
161
+ */
162
+ export const TauriUpdaterPublishSchema = z
163
+ .object({
164
+ type: z.literal("tauri-updater"),
165
+ /** The GitHub repository, `owner/name`. */
166
+ repo: z.string().regex(/^[^/\s]+\/[^/\s]+$/, "owner/name"),
167
+ /** The rolling release's tag, such as `app-latest`. */
168
+ tag: z.string().min(1),
169
+ /**
170
+ * Each updater platform, such as `darwin-aarch64`, `linux-x86_64` or
171
+ * `windows-x86_64-nsis`, and its updater bundle, relative to the member.
172
+ * Its signature is the `.sig` file beside it that the Tauri build wrote.
173
+ */
174
+ platforms: z.record(z.string().regex(/^(darwin|linux|windows)-[a-z0-9_]+(-[a-z0-9]+)?$/, "<os>-<arch> or <os>-<arch>-<installer>"), z.string().min(1)).refine((p) => Object.keys(p).length > 0, "at least one platform"),
175
+ /** More files the rolling release holds, such as installers for the site's download links, relative to the member. */
176
+ assets: z.array(z.string().min(1)).optional(),
177
+ /** A file whose text is the manifest's `notes`, relative to the member. */
178
+ notes: z.string().min(1).optional(),
179
+ /** Each platform's URL in the manifest: `{tag}` (the rolling tag), `{label}`, `{version}` and `{name}` are filled in. Default: the bundle's download URL on the rolling release on github.com. */
180
+ url: z.string().min(1).optional(),
181
+ /** The manifest's asset name. Default `latest.json`. */
182
+ manifest: z.string().regex(/^[^/\\]+$/, "a file name").optional(),
183
+ /** GitHub's `make_latest` for the rolling release. Default `false`. */
184
+ latest: z.union([z.boolean(), z.literal("legacy")]).optional(),
185
+ /** The GitHub API root. Default `$GITHUB_API_URL`, else `https://api.github.com`. */
186
+ api: z.string().url().optional(),
187
+ /** The variable holding the token. Default `GITHUB_TOKEN`. */
188
+ tokenEnv: envName.optional(),
103
189
  })
104
190
  .strict();
105
- export const PublishDeclarationSchema = z.discriminatedUnion("type", [NpmPublishSchema, OciPublishSchema, ForgePublishSchema]);
191
+ export const PublishDeclarationSchema = z.discriminatedUnion("type", [NpmPublishSchema, OciPublishSchema, ForgePublishSchema, HomebrewPublishSchema, MarketplacePublishSchema, TauriUpdaterPublishSchema]);