merge-steward 0.8.4 → 0.8.6

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.
package/dist/cli.js CHANGED
@@ -15,6 +15,11 @@ export async function runCli(argv, options) {
15
15
  const runCommand = options?.runCommand ?? defaultRunCommand;
16
16
  try {
17
17
  const parsed = parseArgs(argv);
18
+ if (parsed.flags.get("version") === true || parsed.positionals[0] === "version") {
19
+ const { version } = await import("../package.json", { with: { type: "json" } }).then((m) => m.default);
20
+ writeOutput(stdout, `merge-steward ${version}\n`);
21
+ return 0;
22
+ }
18
23
  validateFlags(parsed);
19
24
  const command = parsed.positionals[0] ?? "help";
20
25
  if (hasHelpFlag(parsed) || command === "help") {
@@ -159,7 +159,6 @@ async function prepareEntry(ctx, entry, isHead, prevEntry) {
159
159
  }
160
160
  // Gate: non-spinning — skip if base hasn't changed since last conflict.
161
161
  if (isRetryGated(entry, baseSha)) {
162
- emit(ctx, entry, "retry_gated", { baseSha, detail: "base unchanged since last conflict" });
163
162
  try {
164
163
  const prStatus = await ctx.github.getStatus(entry.prNumber);
165
164
  if (prStatus.mergeStateStatus === "DIRTY") {
@@ -168,10 +167,18 @@ async function prepareEntry(ctx, entry, isHead, prevEntry) {
168
167
  detail: "retry gated and GitHub still reports merge conflict",
169
168
  });
170
169
  await evictEntry(ctx, entry, "integration_conflict");
170
+ return;
171
171
  }
172
+ // GitHub says CLEAN but local clone conflicted — the conflict was
173
+ // likely transient (stale clone state). Clear the gate and retry.
174
+ emit(ctx, entry, "retry_gated", { baseSha, detail: "local conflict but GitHub reports CLEAN, retrying" });
175
+ ctx.store.transition(entry.id, "preparing_head", {
176
+ lastFailedBaseSha: null, ...CLEAN_CI, ...CLEAN_SPEC,
177
+ }, "GitHub reports CLEAN, clearing retry gate");
172
178
  }
173
179
  catch {
174
- // Best-effort check.
180
+ // GitHub probe failed — hold the gate.
181
+ emit(ctx, entry, "retry_gated", { baseSha, detail: "base unchanged since last conflict" });
175
182
  }
176
183
  return;
177
184
  }
@@ -128,17 +128,23 @@ const STATUS_DISPLAY = {
128
128
  function displayStatus(status) {
129
129
  return STATUS_DISPLAY[status] ?? status;
130
130
  }
131
+ /** Truncate hex strings longer than 12 chars (SHAs, run IDs) to 8 chars. */
132
+ function shortenHashes(text) {
133
+ return text.replace(/\b[0-9a-f]{13,}\b/g, (match) => match.slice(0, 8));
134
+ }
131
135
  export function formatEventSummary(event) {
132
136
  const from = event.fromStatus ? displayStatus(event.fromStatus) : null;
133
137
  const to = displayStatus(event.toStatus);
134
138
  const transition = from ? `${from} \u2192 ${to}` : to;
135
- return `#${event.prNumber} ${transition}${event.detail ? ` (${event.detail})` : ""}`;
139
+ const detail = event.detail ? ` (${shortenHashes(event.detail)})` : "";
140
+ return `#${event.prNumber} ${transition}${detail}`;
136
141
  }
137
142
  export function formatEntryEvent(event) {
138
143
  const from = event.fromStatus ? displayStatus(event.fromStatus) : null;
139
144
  const to = displayStatus(event.toStatus);
140
145
  const transition = from ? `${from} \u2192 ${to}` : to;
141
- return `${transition}${event.detail ? ` (${event.detail})` : ""}`;
146
+ const detail = event.detail ? ` (${shortenHashes(event.detail)})` : "";
147
+ return `${transition}${detail}`;
142
148
  }
143
149
  export function formatDuration(ms) {
144
150
  const seconds = Math.floor(ms / 1000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "merge-steward",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "Serial merge queue for GitHub — rebase, CI-gate, and merge PRs one at a time",
5
5
  "type": "module",
6
6
  "repository": {