@staff0rd/assist 0.1042.4 → 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.
|
|
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(
|
|
@@ -31647,7 +31642,6 @@ import { randomUUID as randomUUID18 } from "crypto";
|
|
|
31647
31642
|
function buildPrompt3(number, announce, options2) {
|
|
31648
31643
|
const args = [
|
|
31649
31644
|
"/review-pr-comments",
|
|
31650
|
-
...options2.batch ? ["--batch"] : [],
|
|
31651
31645
|
...options2.auto ? ["--auto"] : [],
|
|
31652
31646
|
...announce ? [`--announce ${number}`] : []
|
|
31653
31647
|
];
|
|
@@ -31658,16 +31652,10 @@ function validateAnnounce(number, announce) {
|
|
|
31658
31652
|
console.error("Error: --announce requires a PR number.");
|
|
31659
31653
|
process.exit(1);
|
|
31660
31654
|
}
|
|
31661
|
-
function validateMode(options2) {
|
|
31662
|
-
if (!options2.batch || !options2.auto) return;
|
|
31663
|
-
console.error("Error: --batch and --auto cannot be used together.");
|
|
31664
|
-
process.exit(1);
|
|
31665
|
-
}
|
|
31666
31655
|
async function reviewPrComments(number, options2 = {}) {
|
|
31667
31656
|
const announce = options2.announce === true;
|
|
31668
31657
|
const resumeSessionId = options2.resumeSessionId;
|
|
31669
31658
|
validateAnnounce(number, announce);
|
|
31670
|
-
validateMode(options2);
|
|
31671
31659
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
31672
31660
|
const claudeSessionId = resumeSessionId ?? randomUUID18();
|
|
31673
31661
|
emitActivity({
|
|
@@ -31694,14 +31682,10 @@ function registerReviewPrComments(program, resumeFlag) {
|
|
|
31694
31682
|
).option(
|
|
31695
31683
|
"--auto",
|
|
31696
31684
|
"Accept Claude's own recommendation for each thread without asking, falling back to asking only for threads it cannot confidently decide"
|
|
31697
|
-
).option(
|
|
31698
|
-
"--batch",
|
|
31699
|
-
"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)"
|
|
31700
31685
|
).option("--resume-session <id>", resumeFlag).action(
|
|
31701
31686
|
(number, opts) => reviewPrComments(number, {
|
|
31702
31687
|
announce: opts.announce,
|
|
31703
31688
|
auto: opts.auto,
|
|
31704
|
-
batch: opts.batch,
|
|
31705
31689
|
resumeSessionId: opts.resumeSession
|
|
31706
31690
|
})
|
|
31707
31691
|
);
|
|
@@ -56157,14 +56141,33 @@ var handleDismiss = routed((_client, m, d) => {
|
|
|
56157
56141
|
m.dismissSession(d.sessionId, closeServerRuns);
|
|
56158
56142
|
});
|
|
56159
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
|
+
|
|
56160
56157
|
// src/commands/sessions/daemon/handleOutputRequest.ts
|
|
56161
56158
|
function resolveTarget3(m, d) {
|
|
56162
56159
|
const server = d.server;
|
|
56163
56160
|
if (!server) return { sessionId: d.sessionId };
|
|
56164
|
-
|
|
56165
|
-
|
|
56166
|
-
|
|
56167
|
-
|
|
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 };
|
|
56168
56171
|
}
|
|
56169
56172
|
var handleOutputRequest = (client, m, d) => {
|
|
56170
56173
|
const target = resolveTarget3(m, d);
|
|
@@ -56173,14 +56176,14 @@ var handleOutputRequest = (client, m, d) => {
|
|
|
56173
56176
|
sendTo(client, { type: "session-output", error: target.error });
|
|
56174
56177
|
return;
|
|
56175
56178
|
}
|
|
56176
|
-
const { sessionId } = target;
|
|
56179
|
+
const { sessionId, exited } = target;
|
|
56177
56180
|
let scrollback;
|
|
56178
56181
|
m.update((sessions) => {
|
|
56179
56182
|
scrollback = sessions.get(sessionId)?.scrollback;
|
|
56180
56183
|
return false;
|
|
56181
56184
|
});
|
|
56182
56185
|
daemonLog(
|
|
56183
|
-
`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`}`
|
|
56184
56187
|
);
|
|
56185
56188
|
sendTo(
|
|
56186
56189
|
client,
|
|
@@ -56188,7 +56191,7 @@ var handleOutputRequest = (client, m, d) => {
|
|
|
56188
56191
|
type: "session-output",
|
|
56189
56192
|
sessionId,
|
|
56190
56193
|
error: `No session ${sessionId} on this node`
|
|
56191
|
-
} : { type: "session-output", sessionId, scrollback }
|
|
56194
|
+
} : { type: "session-output", sessionId, scrollback, exited }
|
|
56192
56195
|
);
|
|
56193
56196
|
};
|
|
56194
56197
|
|
|
@@ -57510,9 +57513,9 @@ async function requestSessionOutput(target) {
|
|
|
57510
57513
|
);
|
|
57511
57514
|
socket.write(`${JSON.stringify({ type: "output", ...target })}
|
|
57512
57515
|
`);
|
|
57513
|
-
const { scrollback, error } = await reply2;
|
|
57516
|
+
const { sessionId, scrollback, exited, error } = await reply2;
|
|
57514
57517
|
if (scrollback === void 0) throw new Error(error);
|
|
57515
|
-
return scrollback;
|
|
57518
|
+
return { sessionId, scrollback, exited };
|
|
57516
57519
|
} finally {
|
|
57517
57520
|
socket.destroy();
|
|
57518
57521
|
}
|
|
@@ -57548,7 +57551,15 @@ async function sessionOutput(sessionId, options2) {
|
|
|
57548
57551
|
const target = resolveTarget4(sessionId, options2.server);
|
|
57549
57552
|
if (typeof target === "string") return fail12(target);
|
|
57550
57553
|
try {
|
|
57551
|
-
const
|
|
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
|
+
);
|
|
57552
57563
|
for (const line of lastLines(scrollback, count11)) console.log(line);
|
|
57553
57564
|
} catch (error) {
|
|
57554
57565
|
fail12(error instanceof Error ? error.message : String(error));
|