@staff0rd/assist 0.1074.5 → 0.1074.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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1074.5",
9
+ version: "0.1074.6",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -48003,6 +48003,11 @@ function describeOutcome(outcome) {
48003
48003
  exitCode: 3,
48004
48004
  message: `simulated divergence from ${outcome.upstream} (${simulatedDivergenceNote})`
48005
48005
  };
48006
+ case "fetch-failed":
48007
+ return {
48008
+ exitCode: 5,
48009
+ message: `git fetch for ${outcome.upstream} failed: ${outcome.reason}`
48010
+ };
48006
48011
  case "unavailable":
48007
48012
  return { exitCode: 1, message: `cannot wait: ${outcome.reason}` };
48008
48013
  case "interrupted":
@@ -48548,7 +48553,7 @@ function fetchQuietly(cwd, intervalMs) {
48548
48553
  });
48549
48554
  return void 0;
48550
48555
  } catch (error) {
48551
- return error instanceof Error ? error.message : String(error);
48556
+ return gitFailureReason(error).replace(/\s*\n\s*/g, " \xB7 ");
48552
48557
  }
48553
48558
  }
48554
48559
 
@@ -48571,6 +48576,16 @@ function readMovement(cwd) {
48571
48576
  }
48572
48577
  }
48573
48578
 
48579
+ // src/commands/watch/checkUpstream.ts
48580
+ function checkUpstream(upstream, intervalMs, cwd) {
48581
+ if (consumeSimulatedDivergence(cwd))
48582
+ return { kind: "simulated-divergence", upstream };
48583
+ const fetchError = fetchQuietly(cwd, intervalMs);
48584
+ if (fetchError) return { kind: "fetch-failed", upstream, reason: fetchError };
48585
+ const found = readMovement(cwd);
48586
+ return found && { kind: "moved", upstream, ...found };
48587
+ }
48588
+
48574
48589
  // src/commands/watch/pollForMovement.ts
48575
48590
  var CONTROL_POLL_MS = 1e3;
48576
48591
  function pollForMovement(options2) {
@@ -48588,11 +48603,8 @@ function pollForMovement(options2) {
48588
48603
  };
48589
48604
  const onInterrupt = () => finish2({ kind: "interrupted" });
48590
48605
  const check2 = () => {
48591
- if (consumeSimulatedDivergence(cwd))
48592
- return finish2({ kind: "simulated-divergence", upstream });
48593
- fetchQuietly(cwd, intervalMs);
48594
- const found = readMovement(cwd);
48595
- if (found) finish2({ kind: "moved", upstream, ...found });
48606
+ const outcome = checkUpstream(upstream, intervalMs, cwd);
48607
+ if (outcome) finish2(outcome);
48596
48608
  };
48597
48609
  const ticker = setInterval(check2, intervalMs);
48598
48610
  const controller = control && setInterval(() => {
@@ -48635,9 +48647,15 @@ function waitForUpstream(options2) {
48635
48647
  if (consumeSimulatedDivergence(cwd))
48636
48648
  return Promise.resolve({ kind: "simulated-divergence", upstream });
48637
48649
  const control = watchControlPaths(cwd);
48638
- fetchQuietly(cwd, intervalMs);
48650
+ const fetchError = fetchQuietly(cwd, intervalMs);
48639
48651
  if (control && consumeMarker(control.stop))
48640
48652
  return Promise.resolve({ kind: "interrupted" });
48653
+ if (fetchError)
48654
+ return Promise.resolve({
48655
+ kind: "fetch-failed",
48656
+ upstream,
48657
+ reason: fetchError
48658
+ });
48641
48659
  const moved = readMovement(cwd);
48642
48660
  if (moved) return Promise.resolve({ kind: "moved", upstream, ...moved });
48643
48661
  return pollForMovement({
@@ -48678,7 +48696,7 @@ async function watchWait(options2) {
48678
48696
  function registerWatchWait(watchCommand) {
48679
48697
  internalCommand(
48680
48698
  watchCommand.command("wait").description(
48681
- "Block until the current branch's upstream gains commits, then exit 0 (2 on timeout, 3 when --pull hits genuine divergence, 4 when --build or the post-build sync fails, 1 when waiting is impossible, 130 on interrupt)"
48699
+ "Block until the current branch's upstream gains commits, then exit 0 (2 on timeout, 3 when --pull hits genuine divergence, 4 when --build or the post-build sync fails, 5 when git fetch fails, 1 when waiting is impossible, 130 on interrupt)"
48682
48700
  ).option(
48683
48701
  "--interval <duration>",
48684
48702
  "How often to fetch after the fetch at startup (e.g. 30s, 2m)",
@@ -51197,9 +51215,15 @@ async function settleLap(lap, { end, tail }, deps2) {
51197
51215
  if (deps2.paused()) deps2.note(`lap ${lap} ${how}; paused`);
51198
51216
  else if (decideLap(end, false).kind === "relaunch")
51199
51217
  deps2.note(`lap ${lap} ${how}; relaunching`);
51200
- else await backOff(`lap ${lap} ${how}`, deps2);
51218
+ else {
51219
+ const why = lastLine(tail);
51220
+ await backOff(`lap ${lap} ${how}${why ? `: ${why}` : ""}`, deps2);
51221
+ }
51201
51222
  return void 0;
51202
51223
  }
51224
+ function lastLine(text20) {
51225
+ return stripAnsi(text20).split(/\r?\n|\r/).map((line) => line.trim()).filter(Boolean).pop();
51226
+ }
51203
51227
 
51204
51228
  // src/commands/sessions/daemon/autoUpdate/runAutoUpdateLoop.ts
51205
51229
  var PAUSE_POLL_MS = 60 * 1e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1074.5",
3
+ "version": "0.1074.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {