@staff0rd/assist 0.417.0 → 0.419.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/commands/sessions/web/bundle.js +395 -395
- package/dist/index.js +86 -50
- package/package.json +1 -1
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.419.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -18241,7 +18241,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
18241
18241
|
// src/commands/prs/previewAndPlace.ts
|
|
18242
18242
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
18243
18243
|
|
|
18244
|
-
// src/commands/prs/
|
|
18244
|
+
// src/commands/prs/parseIncoming.ts
|
|
18245
18245
|
function parseIncoming(line, requestId) {
|
|
18246
18246
|
try {
|
|
18247
18247
|
const msg = JSON.parse(line);
|
|
@@ -18251,12 +18251,18 @@ function parseIncoming(line, requestId) {
|
|
|
18251
18251
|
if (msg.decision !== "approve" && msg.decision !== "reject") return null;
|
|
18252
18252
|
return {
|
|
18253
18253
|
kind: "decision",
|
|
18254
|
-
decision: {
|
|
18254
|
+
decision: {
|
|
18255
|
+
decision: msg.decision,
|
|
18256
|
+
reason: msg.reason,
|
|
18257
|
+
comments: Array.isArray(msg.comments) ? msg.comments : void 0
|
|
18258
|
+
}
|
|
18255
18259
|
};
|
|
18256
18260
|
} catch {
|
|
18257
18261
|
return null;
|
|
18258
18262
|
}
|
|
18259
18263
|
}
|
|
18264
|
+
|
|
18265
|
+
// src/commands/prs/requestPrDecision.ts
|
|
18260
18266
|
function requestPrDecision(request) {
|
|
18261
18267
|
return new Promise((resolve19, reject) => {
|
|
18262
18268
|
connectToDaemon().then((socket) => {
|
|
@@ -18307,6 +18313,21 @@ async function previewAndPlace(args) {
|
|
|
18307
18313
|
console.error(
|
|
18308
18314
|
`PR preview rejected${decision.reason ? `: ${decision.reason}` : "."}`
|
|
18309
18315
|
);
|
|
18316
|
+
const comments3 = decision.comments ?? [];
|
|
18317
|
+
if (comments3.length > 0) {
|
|
18318
|
+
console.error(
|
|
18319
|
+
`
|
|
18320
|
+
The reviewer left ${comments3.length} comment${comments3.length === 1 ? "" : "s"} on the preview. Address each one, then re-run this command:
|
|
18321
|
+
`
|
|
18322
|
+
);
|
|
18323
|
+
for (const [i, c] of comments3.entries()) {
|
|
18324
|
+
const quoted = c.quote.split("\n").map((line) => ` > ${line}`).join("\n");
|
|
18325
|
+
console.error(`${i + 1}. On:
|
|
18326
|
+
${quoted}
|
|
18327
|
+
Comment: ${c.note}
|
|
18328
|
+
`);
|
|
18329
|
+
}
|
|
18330
|
+
}
|
|
18310
18331
|
process.exit(1);
|
|
18311
18332
|
}
|
|
18312
18333
|
await placePr(args.prNumber, args.title, args.body, args.options);
|
|
@@ -18505,8 +18526,11 @@ drafted title and body are shown automatically in a preview pane beside the
|
|
|
18505
18526
|
terminal in the web UI, for the user to approve or reject there \u2014 do NOT display
|
|
18506
18527
|
the title and body or ask for confirmation in the terminal. The command blocks
|
|
18507
18528
|
until the user decides: on approval it creates or updates the PR and reports it;
|
|
18508
|
-
on rejection it exits non-zero with the reason
|
|
18509
|
-
|
|
18529
|
+
on rejection it exits non-zero with the reason. The reviewer may also attach
|
|
18530
|
+
inline comments to specific spans of the preview; on rejection these are printed
|
|
18531
|
+
as numbered quoted-span + note pairs on stderr. Address every comment (and the
|
|
18532
|
+
reason), then run the command again to re-preview the revised PR. Repeat until it
|
|
18533
|
+
is approved. Just compose the sections and run the command.`;
|
|
18510
18534
|
function raiseHelpText() {
|
|
18511
18535
|
const confirm = process.env.ASSIST_SESSION === "1" ? WEB_CONFIRM : TERMINAL_CONFIRM;
|
|
18512
18536
|
return `
|
|
@@ -25460,6 +25484,61 @@ function logSpawnedSession(session) {
|
|
|
25460
25484
|
);
|
|
25461
25485
|
}
|
|
25462
25486
|
|
|
25487
|
+
// src/commands/sessions/daemon/decidePrPreview.ts
|
|
25488
|
+
function decidePrPreview(sessions, waiters, notify2, d) {
|
|
25489
|
+
const id = d.sessionId;
|
|
25490
|
+
const requestId = d.requestId;
|
|
25491
|
+
const session = sessions.get(id);
|
|
25492
|
+
if (!session || session.pendingPrPreview?.requestId !== requestId) {
|
|
25493
|
+
daemonLog(
|
|
25494
|
+
`pr-decision for stale/unknown preview id=${id} requestId=${requestId} (ignoring)`
|
|
25495
|
+
);
|
|
25496
|
+
return;
|
|
25497
|
+
}
|
|
25498
|
+
const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
|
|
25499
|
+
daemonLog(
|
|
25500
|
+
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount}`
|
|
25501
|
+
);
|
|
25502
|
+
const waiter = waiters.get(id);
|
|
25503
|
+
if (waiter)
|
|
25504
|
+
sendTo(waiter, {
|
|
25505
|
+
type: "pr-decision",
|
|
25506
|
+
requestId,
|
|
25507
|
+
decision: d.decision,
|
|
25508
|
+
reason: d.reason,
|
|
25509
|
+
comments: d.comments
|
|
25510
|
+
});
|
|
25511
|
+
waiters.delete(id);
|
|
25512
|
+
session.pendingPrPreview = void 0;
|
|
25513
|
+
notify2();
|
|
25514
|
+
}
|
|
25515
|
+
|
|
25516
|
+
// src/commands/sessions/daemon/setPrPreview.ts
|
|
25517
|
+
function setPrPreview(sessions, waiters, notify2, client, d) {
|
|
25518
|
+
const id = d.sessionId;
|
|
25519
|
+
const session = sessions.get(id);
|
|
25520
|
+
if (!session) {
|
|
25521
|
+
daemonLog(`pr-preview for unknown session id=${id} (ignoring)`);
|
|
25522
|
+
sendTo(client, {
|
|
25523
|
+
type: "error",
|
|
25524
|
+
message: `No live session ${id} for pr-preview`
|
|
25525
|
+
});
|
|
25526
|
+
return;
|
|
25527
|
+
}
|
|
25528
|
+
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
25529
|
+
session.pendingPrPreview = {
|
|
25530
|
+
requestId: d.requestId,
|
|
25531
|
+
title: d.title,
|
|
25532
|
+
body: d.body,
|
|
25533
|
+
prNumber
|
|
25534
|
+
};
|
|
25535
|
+
waiters.set(id, client);
|
|
25536
|
+
daemonLog(
|
|
25537
|
+
`pr-preview set: id=${id} requestId=${d.requestId} target=${prNumber === null ? "create" : `edit #${prNumber}`}`
|
|
25538
|
+
);
|
|
25539
|
+
notify2();
|
|
25540
|
+
}
|
|
25541
|
+
|
|
25463
25542
|
// src/commands/sessions/daemon/PrPreviewCoordinator.ts
|
|
25464
25543
|
var PrPreviewCoordinator = class {
|
|
25465
25544
|
constructor(sessions, notify2) {
|
|
@@ -25468,53 +25547,10 @@ var PrPreviewCoordinator = class {
|
|
|
25468
25547
|
}
|
|
25469
25548
|
waiters = /* @__PURE__ */ new Map();
|
|
25470
25549
|
set(client, d) {
|
|
25471
|
-
|
|
25472
|
-
const session = this.sessions.get(id);
|
|
25473
|
-
if (!session) {
|
|
25474
|
-
daemonLog(`pr-preview for unknown session id=${id} (ignoring)`);
|
|
25475
|
-
sendTo(client, {
|
|
25476
|
-
type: "error",
|
|
25477
|
-
message: `No live session ${id} for pr-preview`
|
|
25478
|
-
});
|
|
25479
|
-
return;
|
|
25480
|
-
}
|
|
25481
|
-
const prNumber = typeof d.prNumber === "number" ? d.prNumber : null;
|
|
25482
|
-
session.pendingPrPreview = {
|
|
25483
|
-
requestId: d.requestId,
|
|
25484
|
-
title: d.title,
|
|
25485
|
-
body: d.body,
|
|
25486
|
-
prNumber
|
|
25487
|
-
};
|
|
25488
|
-
this.waiters.set(id, client);
|
|
25489
|
-
daemonLog(
|
|
25490
|
-
`pr-preview set: id=${id} requestId=${d.requestId} target=${prNumber === null ? "create" : `edit #${prNumber}`}`
|
|
25491
|
-
);
|
|
25492
|
-
this.notify();
|
|
25550
|
+
setPrPreview(this.sessions, this.waiters, this.notify, client, d);
|
|
25493
25551
|
}
|
|
25494
25552
|
decide(d) {
|
|
25495
|
-
|
|
25496
|
-
const requestId = d.requestId;
|
|
25497
|
-
const session = this.sessions.get(id);
|
|
25498
|
-
if (!session || session.pendingPrPreview?.requestId !== requestId) {
|
|
25499
|
-
daemonLog(
|
|
25500
|
-
`pr-decision for stale/unknown preview id=${id} requestId=${requestId} (ignoring)`
|
|
25501
|
-
);
|
|
25502
|
-
return;
|
|
25503
|
-
}
|
|
25504
|
-
daemonLog(
|
|
25505
|
-
`pr-decision received: id=${id} requestId=${requestId} decision=${d.decision}`
|
|
25506
|
-
);
|
|
25507
|
-
const waiter = this.waiters.get(id);
|
|
25508
|
-
if (waiter)
|
|
25509
|
-
sendTo(waiter, {
|
|
25510
|
-
type: "pr-decision",
|
|
25511
|
-
requestId,
|
|
25512
|
-
decision: d.decision,
|
|
25513
|
-
reason: d.reason
|
|
25514
|
-
});
|
|
25515
|
-
this.waiters.delete(id);
|
|
25516
|
-
session.pendingPrPreview = void 0;
|
|
25517
|
-
this.notify();
|
|
25553
|
+
decidePrPreview(this.sessions, this.waiters, this.notify, d);
|
|
25518
25554
|
}
|
|
25519
25555
|
clearWaiter(client) {
|
|
25520
25556
|
for (const [id, waiter] of this.waiters) {
|