@staff0rd/assist 0.1042.3 → 0.1043.0

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.1042.3",
9
+ version: "0.1043.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -5200,10 +5200,6 @@ function parseAzureDevopsPrUrl(url) {
5200
5200
  var prActions = [
5201
5201
  { label: "Checkout", args: ["review", "--checkout-only"] },
5202
5202
  { label: "Address Comments", args: ["review-pr-comments"] },
5203
- {
5204
- label: "Address Comments (batch)",
5205
- args: ["review-pr-comments", "--batch"]
5206
- },
5207
5203
  { label: "Address Comments (auto)", args: ["review-pr-comments", "--auto"] },
5208
5204
  { label: "Fix conflicts (merge)", args: ["fix-conflict"] },
5209
5205
  { label: "Fix conflicts (rebase)", args: ["fix-conflict", "--rebase"] }
@@ -5213,7 +5209,6 @@ var prActions = [
5213
5209
  var SUPPORTED = /* @__PURE__ */ new Set([
5214
5210
  "Checkout",
5215
5211
  "Address Comments",
5216
- "Address Comments (batch)",
5217
5212
  "Address Comments (auto)"
5218
5213
  ]);
5219
5214
  var azureDevopsPrActions = prActions.filter(
@@ -23873,9 +23868,11 @@ function stashRef(sha) {
23873
23868
  return index3 === -1 ? sha : `stash@{${index3}}`;
23874
23869
  }
23875
23870
  function strandedError(sha, reason4) {
23871
+ const unmerged = findUnmergedPaths();
23872
+ const guidance = unmerged.length > 0 ? `They were applied with conflicts in ${unmerged.join(", ")}: resolve those, drop that entry by its SHA, then re-run the commit.` : `Restore them with \`git stash apply ${sha}\`, resolve any conflicts, drop that entry by its SHA, then re-run the commit.`;
23876
23873
  const message3 = [
23877
23874
  `Error: refusing to commit \u2014 git pull --autostash left your local changes in stash entry ${stashRef(sha)} (${sha}): ${reason4}`,
23878
- `Restore them with \`git stash apply ${sha}\`, resolve any conflicts, drop that entry by its SHA, then re-run the commit.`,
23875
+ guidance,
23879
23876
  "Nothing was committed or pushed."
23880
23877
  ].join("\n");
23881
23878
  console.error(message3);
@@ -23888,18 +23885,14 @@ function dropBySha(sha) {
23888
23885
  function recoverAutostash(head, before) {
23889
23886
  const sha = findStrandedAutostash(head, before);
23890
23887
  if (!sha) return;
23891
- const unmerged = findUnmergedPaths();
23892
- if (unmerged.length > 0) {
23893
- throw strandedError(sha, `conflicts in ${unmerged.join(", ")}`);
23888
+ if (findUnmergedPaths().length > 0) {
23889
+ throw strandedError(sha, "applying it hit conflicts");
23894
23890
  }
23895
23891
  try {
23896
23892
  git3(`stash apply -q ${sha}`);
23897
23893
  } catch {
23898
23894
  throw strandedError(sha, "reapplying it failed");
23899
23895
  }
23900
- if (findUnmergedPaths().length > 0) {
23901
- throw strandedError(sha, "reapplying it hit conflicts");
23902
- }
23903
23896
  dropBySha(sha);
23904
23897
  console.log(`Reapplied autostash ${sha} that git pull left in the stash.`);
23905
23898
  }
@@ -31649,7 +31642,6 @@ import { randomUUID as randomUUID18 } from "crypto";
31649
31642
  function buildPrompt3(number, announce, options2) {
31650
31643
  const args = [
31651
31644
  "/review-pr-comments",
31652
- ...options2.batch ? ["--batch"] : [],
31653
31645
  ...options2.auto ? ["--auto"] : [],
31654
31646
  ...announce ? [`--announce ${number}`] : []
31655
31647
  ];
@@ -31660,16 +31652,10 @@ function validateAnnounce(number, announce) {
31660
31652
  console.error("Error: --announce requires a PR number.");
31661
31653
  process.exit(1);
31662
31654
  }
31663
- function validateMode(options2) {
31664
- if (!options2.batch || !options2.auto) return;
31665
- console.error("Error: --batch and --auto cannot be used together.");
31666
- process.exit(1);
31667
- }
31668
31655
  async function reviewPrComments(number, options2 = {}) {
31669
31656
  const announce = options2.announce === true;
31670
31657
  const resumeSessionId = options2.resumeSessionId;
31671
31658
  validateAnnounce(number, announce);
31672
- validateMode(options2);
31673
31659
  if (number && !resumeSessionId) await checkoutPr(number);
31674
31660
  const claudeSessionId = resumeSessionId ?? randomUUID18();
31675
31661
  emitActivity({
@@ -31696,14 +31682,10 @@ function registerReviewPrComments(program, resumeFlag) {
31696
31682
  ).option(
31697
31683
  "--auto",
31698
31684
  "Accept Claude's own recommendation for each thread without asking, falling back to asking only for threads it cannot confidently decide"
31699
- ).option(
31700
- "--batch",
31701
- "Collect a decision for every thread before changing anything, then apply each fix as its own commit, push once and resolve every thread (cannot be combined with --auto)"
31702
31685
  ).option("--resume-session <id>", resumeFlag).action(
31703
31686
  (number, opts) => reviewPrComments(number, {
31704
31687
  announce: opts.announce,
31705
31688
  auto: opts.auto,
31706
- batch: opts.batch,
31707
31689
  resumeSessionId: opts.resumeSession
31708
31690
  })
31709
31691
  );
@@ -56159,14 +56141,33 @@ var handleDismiss = routed((_client, m, d) => {
56159
56141
  m.dismissSession(d.sessionId, closeServerRuns);
56160
56142
  });
56161
56143
 
56144
+ // src/commands/sessions/daemon/latestServerRun.ts
56145
+ function latestServerRun(sessions, origin, group) {
56146
+ const live = liveServerRun(sessions, origin, group);
56147
+ if (live) return live;
56148
+ let latest2;
56149
+ for (const s of sessions.values()) {
56150
+ if (!s.server || s.serverOrigin !== origin || s.serverGroup !== group)
56151
+ continue;
56152
+ if (!latest2 || s.startedAt > latest2.startedAt) latest2 = s;
56153
+ }
56154
+ return latest2;
56155
+ }
56156
+
56162
56157
  // src/commands/sessions/daemon/handleOutputRequest.ts
56163
56158
  function resolveTarget3(m, d) {
56164
56159
  const server = d.server;
56165
56160
  if (!server) return { sessionId: d.sessionId };
56166
- const run4 = m.liveServerRun(server.origin, server.group);
56167
- return run4 ? { sessionId: run4.id } : {
56168
- error: `No live server run for ${server.origin} (${server.group})`
56169
- };
56161
+ let run4;
56162
+ m.update((sessions) => {
56163
+ run4 = latestServerRun(sessions, server.origin, server.group);
56164
+ return false;
56165
+ });
56166
+ if (!run4)
56167
+ return {
56168
+ error: `No live server run for ${server.origin} (${server.group})`
56169
+ };
56170
+ return run4.status === "done" || run4.status === "error" ? { sessionId: run4.id, exited: run4.status } : { sessionId: run4.id };
56170
56171
  }
56171
56172
  var handleOutputRequest = (client, m, d) => {
56172
56173
  const target = resolveTarget3(m, d);
@@ -56175,14 +56176,14 @@ var handleOutputRequest = (client, m, d) => {
56175
56176
  sendTo(client, { type: "session-output", error: target.error });
56176
56177
  return;
56177
56178
  }
56178
- const { sessionId } = target;
56179
+ const { sessionId, exited } = target;
56179
56180
  let scrollback;
56180
56181
  m.update((sessions) => {
56181
56182
  scrollback = sessions.get(sessionId)?.scrollback;
56182
56183
  return false;
56183
56184
  });
56184
56185
  daemonLog(
56185
- `output requested: id=${sessionId} ${scrollback === void 0 ? "unknown session" : `${scrollback.length} chars`}`
56186
+ `output requested: id=${sessionId}${exited ? ` (exited: ${exited})` : ""} ${scrollback === void 0 ? "unknown session" : `${scrollback.length} chars`}`
56186
56187
  );
56187
56188
  sendTo(
56188
56189
  client,
@@ -56190,7 +56191,7 @@ var handleOutputRequest = (client, m, d) => {
56190
56191
  type: "session-output",
56191
56192
  sessionId,
56192
56193
  error: `No session ${sessionId} on this node`
56193
- } : { type: "session-output", sessionId, scrollback }
56194
+ } : { type: "session-output", sessionId, scrollback, exited }
56194
56195
  );
56195
56196
  };
56196
56197
 
@@ -57512,9 +57513,9 @@ async function requestSessionOutput(target) {
57512
57513
  );
57513
57514
  socket.write(`${JSON.stringify({ type: "output", ...target })}
57514
57515
  `);
57515
- const { scrollback, error } = await reply2;
57516
+ const { sessionId, scrollback, exited, error } = await reply2;
57516
57517
  if (scrollback === void 0) throw new Error(error);
57517
- return scrollback;
57518
+ return { sessionId, scrollback, exited };
57518
57519
  } finally {
57519
57520
  socket.destroy();
57520
57521
  }
@@ -57550,7 +57551,15 @@ async function sessionOutput(sessionId, options2) {
57550
57551
  const target = resolveTarget4(sessionId, options2.server);
57551
57552
  if (typeof target === "string") return fail12(target);
57552
57553
  try {
57553
- const scrollback = await requestSessionOutput(target);
57554
+ const {
57555
+ sessionId: id,
57556
+ scrollback,
57557
+ exited
57558
+ } = await requestSessionOutput(target);
57559
+ if (exited)
57560
+ console.log(
57561
+ `Server run ${id} is not live (${exited === "error" ? "crashed" : "exited"}); showing its final output.`
57562
+ );
57554
57563
  for (const line of lastLines(scrollback, count11)) console.log(line);
57555
57564
  } catch (error) {
57556
57565
  fail12(error instanceof Error ? error.message : String(error));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1042.3",
3
+ "version": "0.1043.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {