@mutmutco/cli 3.19.0 → 3.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.cjs +33 -1
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -9222,6 +9222,25 @@ async function mergeAutoWithTransientRetry(prNumber, repo, deps) {
9222
9222
  if (retried.mergeStatus !== "failed") return retried;
9223
9223
  return { mergeStatus: "failed", error: `merge retry after transient failure also failed: ${retried.error ?? first.error ?? "unknown error"}` };
9224
9224
  }
9225
+ var AUTO_MERGE_CONFIRM_RETRIES = 3;
9226
+ var AUTO_MERGE_CONFIRM_DELAY_MS = 3e3;
9227
+ async function confirmAutoMergeEnqueued(deps, options) {
9228
+ const retries = options?.retries ?? AUTO_MERGE_CONFIRM_RETRIES;
9229
+ const delayMs = options?.delayMs ?? AUTO_MERGE_CONFIRM_DELAY_MS;
9230
+ const sleep2 = deps.sleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
9231
+ for (let attempt = 0; attempt < retries; attempt++) {
9232
+ if (await deps.readMerged().catch(() => false)) return "merged";
9233
+ const stuck = await deps.readAutoMergeRequest().then((s) => s.trim()).catch(() => "");
9234
+ if (stuck) return "enqueued";
9235
+ if (attempt < retries - 1) {
9236
+ await sleep2(delayMs);
9237
+ await deps.reEnqueue().catch(() => {
9238
+ });
9239
+ }
9240
+ }
9241
+ if (await deps.readMerged().catch(() => false)) return "merged";
9242
+ return "not-stuck";
9243
+ }
9225
9244
  async function readGhPrStateWithRetry(fetchState, options) {
9226
9245
  const retries = options?.retries ?? PR_LAND_STATE_READ_RETRIES;
9227
9246
  const delayMs = options?.delayMs ?? PR_LAND_STATE_READ_DELAY_MS;
@@ -21441,7 +21460,20 @@ async function ghMergeAutoEnqueue(prNumber, repo, method) {
21441
21460
  if (!stateRead.ok) {
21442
21461
  return { mergeStatus: "failed", error: `could not read PR state after merge: ${stateRead.error}` };
21443
21462
  }
21444
- return { mergeStatus: stateRead.state === "MERGED" ? "merged" : "auto-merge-enqueued" };
21463
+ if (stateRead.state === "MERGED") return { mergeStatus: "merged" };
21464
+ const confirmation = await confirmAutoMergeEnqueued({
21465
+ readAutoMergeRequest: async () => (await execFileP2("gh", ["pr", "view", prNumber, ...args, "--json", "autoMergeRequest", "--jq", '.autoMergeRequest // ""'], { timeout: GC_GH_TIMEOUT_MS5 })).stdout,
21466
+ readMerged: async () => {
21467
+ const s = await readMergeState();
21468
+ return s.ok && s.state === "MERGED";
21469
+ },
21470
+ reEnqueue: async () => {
21471
+ await execFileP2("gh", buildPrMergeArgs({ number: prNumber, repoArgs: args, method, auto: true, deleteBranch }), { timeout: GH_MUTATION_TIMEOUT_MS });
21472
+ }
21473
+ });
21474
+ if (confirmation === "merged") return { mergeStatus: "merged" };
21475
+ if (confirmation === "enqueued") return { mergeStatus: "auto-merge-enqueued" };
21476
+ return { mergeStatus: "failed", error: "auto-merge did not stick \u2014 GitHub reported no autoMergeRequest after enqueue; retry once the PR has a pending check" };
21445
21477
  }
21446
21478
  pr.command("land <number>").description("agent merge path (#1440): train probe \u2192 checks-wait \u2192 merge --auto \u2192 poll enqueued \u2014 development PRs only").option("--json", "machine-readable output").option("--repo <owner/repo>", "target repo (defaults to the PR repo)").option("--no-require-train", "skip train-authority preflight (not recommended for autonomous agents)").option("--preserve-worktree", "after merge, keep the local PR worktree/stage/branch for an active batch (#1888)").action(async (number, o) => {
21447
21479
  const repoArgs = o.repo ? ["--repo", o.repo] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "3.19.0",
3
+ "version": "3.19.1",
4
4
  "description": "MMI Future CLI — the org dev toolbox (board, registry, keyless secrets, release train, bootstrap, doctor) and the cross-IDE engine the plugin's session-start hook drives.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",