@staff0rd/assist 0.859.1 → 0.860.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.859.1",
9
+ version: "0.860.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -2885,13 +2885,13 @@ async function activity(options2) {
2885
2885
  const activeDays = data.filter((d) => d.count > 0).length;
2886
2886
  console.log(`${total2} commits across ${activeDays} active days.`);
2887
2887
  const weekly = /* @__PURE__ */ new Map();
2888
- for (const { date, count: count9 } of data) {
2888
+ for (const { date, count: count10 } of data) {
2889
2889
  const d = new Date(date);
2890
2890
  d.setDate(d.getDate() - d.getDay());
2891
2891
  const weekStart = d.toISOString().slice(0, 10);
2892
- weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count9);
2892
+ weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count10);
2893
2893
  }
2894
- const weeklyData = [...weekly.entries()].map(([date, count9]) => ({ date, count: count9 })).sort((a, b) => a.date.localeCompare(b.date));
2894
+ const weeklyData = [...weekly.entries()].map(([date, count10]) => ({ date, count: count10 })).sort((a, b) => a.date.localeCompare(b.date));
2895
2895
  const until = data[data.length - 1].date;
2896
2896
  renderLineChart({
2897
2897
  title: "Commit Activity",
@@ -3291,30 +3291,40 @@ function toAttachments(value) {
3291
3291
  function toChecklist(value) {
3292
3292
  if (!Array.isArray(value)) return void 0;
3293
3293
  return value.flatMap((entry) => {
3294
- const { id, ticked, comment: comment3, notes } = entry ?? {};
3294
+ const { id, ticked, comment: comment3 } = entry ?? {};
3295
3295
  if (typeof id !== "string") return [];
3296
- const parsedNotes = toNotes(notes);
3297
3296
  return [
3298
3297
  {
3299
3298
  id,
3300
3299
  ticked: ticked === true,
3301
- ...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {},
3302
- ...parsedNotes.length > 0 ? { notes: parsedNotes } : {}
3300
+ ...typeof comment3 === "string" && comment3 !== "" ? { comment: comment3 } : {}
3303
3301
  }
3304
3302
  ];
3305
3303
  });
3306
3304
  }
3307
- function toNotes(value) {
3308
- if (!Array.isArray(value)) return [];
3309
- return value.flatMap((entry) => {
3310
- const { id, comment: comment3 } = entry ?? {};
3311
- if (typeof id !== "string" || typeof comment3 !== "string" || !comment3)
3312
- return [];
3313
- return [{ id, comment: comment3 }];
3314
- });
3305
+
3306
+ // src/commands/sessions/shared/toReviewComments.ts
3307
+ function isReviewComment(value) {
3308
+ const comment3 = value;
3309
+ return typeof comment3?.path === "string" && Number.isInteger(comment3.startLine) && Number.isInteger(comment3.endLine) && typeof comment3.quote === "string" && typeof comment3.note === "string" && comment3.note.trim() !== "";
3310
+ }
3311
+ function toReviewComments(value) {
3312
+ if (!Array.isArray(value)) return void 0;
3313
+ return value.filter(isReviewComment).map(({ path: path109, startLine, endLine, quote, note }) => ({
3314
+ path: path109,
3315
+ startLine,
3316
+ endLine,
3317
+ quote,
3318
+ note
3319
+ }));
3315
3320
  }
3316
3321
 
3317
3322
  // src/commands/sessions/shared/toPreviewDecision.ts
3323
+ var REVIEW_EVENTS = [
3324
+ "APPROVE",
3325
+ "COMMENT",
3326
+ "REQUEST_CHANGES"
3327
+ ];
3318
3328
  function toSelection(value) {
3319
3329
  const selection = value;
3320
3330
  if (typeof selection?.topLeft !== "string" || typeof selection.bottomRight !== "string")
@@ -3336,6 +3346,8 @@ function toPreviewDecision(msg) {
3336
3346
  autostart: msg.autostart === true,
3337
3347
  selection: toSelection(msg.selection),
3338
3348
  checklist: toChecklist(msg.checklist),
3349
+ reviewEvent: REVIEW_EVENTS.find((event) => event === msg.reviewEvent),
3350
+ reviewComments: toReviewComments(msg.reviewComments),
3339
3351
  dismissed: msg.dismissed === true
3340
3352
  };
3341
3353
  }
@@ -8364,29 +8376,6 @@ Failed to launch Claude for ${context}: ${message3}`)
8364
8376
  }
8365
8377
  }
8366
8378
 
8367
- // src/commands/sessions/daemon/sendToDaemon.ts
8368
- var WRITE_TIMEOUT_MS = 500;
8369
- function sendToDaemon(message3) {
8370
- return new Promise((resolve30, reject) => {
8371
- connectToDaemon().then((socket) => {
8372
- const timer = setTimeout(() => {
8373
- socket.destroy();
8374
- reject(new Error("timed out writing to daemon socket"));
8375
- }, WRITE_TIMEOUT_MS);
8376
- socket.on("error", (error) => {
8377
- clearTimeout(timer);
8378
- reject(error);
8379
- });
8380
- socket.write(`${JSON.stringify(message3)}
8381
- `, () => {
8382
- clearTimeout(timer);
8383
- socket.end();
8384
- resolve30();
8385
- });
8386
- }, reject);
8387
- });
8388
- }
8389
-
8390
8379
  // src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
8391
8380
  var ACK_TIMEOUT_MS = 1e3;
8392
8381
  function sendToDaemonAwaitAck(message3) {
@@ -8438,7 +8427,7 @@ async function readHookClaudeSessionId() {
8438
8427
  }
8439
8428
 
8440
8429
  // src/commands/sessions/setSessionStatus.ts
8441
- var DELIVERY_ATTEMPTS = 3;
8430
+ var RELIABLE_ATTEMPTS = 3;
8442
8431
  var RETRY_DELAY_MS = 100;
8443
8432
  async function setSessionStatus(status2, opts = {}) {
8444
8433
  const sessionId = process.env.ASSIST_SESSION_ID;
@@ -8447,44 +8436,34 @@ async function setSessionStatus(status2, opts = {}) {
8447
8436
  const payload = buildPayload(
8448
8437
  sessionId,
8449
8438
  status2,
8450
- opts,
8439
+ opts.source,
8451
8440
  await readHookClaudeSessionId()
8452
8441
  );
8453
- if (opts.ack) await deliverReliably(sessionId, status2, payload);
8454
- else await deliverBestEffort(sessionId, status2, payload);
8442
+ await deliver(sessionId, status2, payload, opts.ack ? RELIABLE_ATTEMPTS : 1);
8455
8443
  }
8456
- function buildPayload(sessionId, status2, opts, claudeSessionId) {
8444
+ function buildPayload(sessionId, status2, source, claudeSessionId) {
8457
8445
  const payload = {
8458
8446
  type: "set-status",
8459
8447
  sessionId,
8460
8448
  status: status2
8461
8449
  };
8462
8450
  if (claudeSessionId) payload.claudeSessionId = claudeSessionId;
8463
- if (opts.source) payload.source = opts.source;
8464
- if (opts.ack) payload.ack = true;
8451
+ if (source) payload.source = source;
8452
+ payload.ack = true;
8465
8453
  return payload;
8466
8454
  }
8467
- async function deliverBestEffort(sessionId, status2, payload) {
8468
- try {
8469
- await sendToDaemon(payload);
8470
- } catch (error) {
8471
- appendDaemonLog(
8472
- `set-status best-effort send failed: id=${sessionId} status=${status2}: ${describeError(error)}`
8473
- );
8474
- }
8475
- }
8476
- async function deliverReliably(sessionId, status2, payload) {
8477
- for (let attempt = 1; attempt <= DELIVERY_ATTEMPTS; attempt++) {
8455
+ async function deliver(sessionId, status2, payload, attempts) {
8456
+ for (let attempt = 1; attempt <= attempts; attempt++) {
8478
8457
  try {
8479
8458
  await sendToDaemonAwaitAck(payload);
8480
8459
  return;
8481
8460
  } catch (error) {
8482
- if (attempt < DELIVERY_ATTEMPTS) {
8461
+ if (attempt < attempts) {
8483
8462
  await sleep(RETRY_DELAY_MS);
8484
8463
  continue;
8485
8464
  }
8486
8465
  appendDaemonLog(
8487
- `set-status ack'd delivery failed after ${DELIVERY_ATTEMPTS} attempts: id=${sessionId} status=${status2}: ${describeError(error)}`
8466
+ `set-status delivery failed after ${attempts} attempt${attempts === 1 ? "" : "s"}: id=${sessionId} status=${status2}${payload.source ? ` source=${payload.source}` : ""}: ${describeError(error)}`
8488
8467
  );
8489
8468
  }
8490
8469
  }
@@ -15625,8 +15604,8 @@ function listUsageHistory(req, res) {
15625
15604
  // src/shared/db/countItemUsageByOrigin.ts
15626
15605
  import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-orm";
15627
15606
  async function countItemUsageByOrigin(db) {
15628
- const count9 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15629
- const rows = await db.select({ origin: items.origin, count: count9 }).from(items).innerJoin(phaseUsage, eq41(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc4(count9), asc11(items.origin));
15607
+ const count10 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15608
+ const rows = await db.select({ origin: items.origin, count: count10 }).from(items).innerJoin(phaseUsage, eq41(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc4(count10), asc11(items.origin));
15630
15609
  return rows.map((row3) => ({ origin: row3.origin, count: Number(row3.count) }));
15631
15610
  }
15632
15611
 
@@ -16339,8 +16318,8 @@ async function commitsBehind(cwd, repo, base, shas) {
16339
16318
  ]);
16340
16319
  const ref = response.data?.repository?.ref;
16341
16320
  for (const [index2, sha] of shas.entries()) {
16342
- const count9 = ref?.[`c${index2}`]?.behindBy;
16343
- behind.set(sha, typeof count9 === "number" ? count9 : null);
16321
+ const count10 = ref?.[`c${index2}`]?.behindBy;
16322
+ behind.set(sha, typeof count10 === "number" ? count10 : null);
16344
16323
  }
16345
16324
  } catch {
16346
16325
  return behind;
@@ -16457,9 +16436,9 @@ function deploymentsQuery(environments) {
16457
16436
  function headCommit2(node) {
16458
16437
  return node?.oid ? releaseCommit(node.oid, node) : null;
16459
16438
  }
16460
- function environmentNodes(repository, count9) {
16439
+ function environmentNodes(repository, count10) {
16461
16440
  return Array.from(
16462
- { length: count9 },
16441
+ { length: count10 },
16463
16442
  (_, index2) => repository[deploymentsAlias(index2)]?.nodes ?? []
16464
16443
  ).flat();
16465
16444
  }
@@ -21828,7 +21807,7 @@ function calculateHalstead(node) {
21828
21807
  // src/commands/complexity/shared/countSloc.ts
21829
21808
  function countSloc(content) {
21830
21809
  let inMultiLineComment = false;
21831
- let count9 = 0;
21810
+ let count10 = 0;
21832
21811
  for (const line of content.split("\n")) {
21833
21812
  const trimmed = line.trim();
21834
21813
  if (inMultiLineComment) {
@@ -21836,7 +21815,7 @@ function countSloc(content) {
21836
21815
  inMultiLineComment = false;
21837
21816
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21838
21817
  if (afterComment.trim().length > 0) {
21839
- count9++;
21818
+ count10++;
21840
21819
  }
21841
21820
  }
21842
21821
  continue;
@@ -21848,7 +21827,7 @@ function countSloc(content) {
21848
21827
  if (trimmed.includes("*/")) {
21849
21828
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21850
21829
  if (afterComment.trim().length > 0) {
21851
- count9++;
21830
+ count10++;
21852
21831
  }
21853
21832
  } else {
21854
21833
  inMultiLineComment = true;
@@ -21856,10 +21835,10 @@ function countSloc(content) {
21856
21835
  continue;
21857
21836
  }
21858
21837
  if (trimmed.length > 0) {
21859
- count9++;
21838
+ count10++;
21860
21839
  }
21861
21840
  }
21862
- return count9;
21841
+ return count10;
21863
21842
  }
21864
21843
 
21865
21844
  // src/commands/complexity/shared.ts
@@ -22887,10 +22866,10 @@ async function findRetiredTables(exec3) {
22887
22866
  const found = [];
22888
22867
  for (const row3 of present) {
22889
22868
  const name = String(row3.table_name);
22890
- const [count9] = await exec3.query(
22869
+ const [count10] = await exec3.query(
22891
22870
  `SELECT count(*)::int AS rows FROM "${name}"`
22892
22871
  );
22893
- found.push({ name, rows: Number(count9.rows) });
22872
+ found.push({ name, rows: Number(count10.rows) });
22894
22873
  }
22895
22874
  return found;
22896
22875
  }
@@ -25598,8 +25577,8 @@ function annotate(entry) {
25598
25577
  }
25599
25578
  return notes;
25600
25579
  }
25601
- function formatCount(count9, noun) {
25602
- return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
25580
+ function formatCount(count10, noun) {
25581
+ return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
25603
25582
  }
25604
25583
  function printFixStructurePlan(plan2, chain2, apply) {
25605
25584
  writeLineNow(chalk172.dim(`chain: ${chain2.join(" > ")}`));
@@ -27767,6 +27746,29 @@ function prHeadBranch(number) {
27767
27746
  }
27768
27747
  }
27769
27748
 
27749
+ // src/commands/sessions/daemon/sendToDaemon.ts
27750
+ var WRITE_TIMEOUT_MS = 500;
27751
+ function sendToDaemon(message3) {
27752
+ return new Promise((resolve30, reject) => {
27753
+ connectToDaemon().then((socket) => {
27754
+ const timer = setTimeout(() => {
27755
+ socket.destroy();
27756
+ reject(new Error("timed out writing to daemon socket"));
27757
+ }, WRITE_TIMEOUT_MS);
27758
+ socket.on("error", (error) => {
27759
+ clearTimeout(timer);
27760
+ reject(error);
27761
+ });
27762
+ socket.write(`${JSON.stringify(message3)}
27763
+ `, () => {
27764
+ clearTimeout(timer);
27765
+ socket.end();
27766
+ resolve30();
27767
+ });
27768
+ }, reject);
27769
+ });
27770
+ }
27771
+
27770
27772
  // src/commands/review/reportCwdToDaemon.ts
27771
27773
  async function reportCwdToDaemon(cwd) {
27772
27774
  if (!inWebSession()) return;
@@ -28844,14 +28846,14 @@ async function netcap(options2) {
28844
28846
  const filter = options2.filter ?? "";
28845
28847
  await mkdir6(dirname34(outPath), { recursive: true });
28846
28848
  const extensionPath = await prepareExtensionForLoad(port, filter);
28847
- let count9 = 0;
28849
+ let count10 = 0;
28848
28850
  const handler = createNetcapHandler({
28849
28851
  outPath,
28850
28852
  onPing: () => console.log(chalk184.dim("ping from extension")),
28851
28853
  onCapture: (entry) => {
28852
- count9 += 1;
28854
+ count10 += 1;
28853
28855
  console.log(
28854
- chalk184.green(`captured #${count9}`),
28856
+ chalk184.green(`captured #${count10}`),
28855
28857
  chalk184.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
28856
28858
  );
28857
28859
  }
@@ -28872,7 +28874,7 @@ async function netcap(options2) {
28872
28874
  console.log(
28873
28875
  chalk184.bold(
28874
28876
  `
28875
- netcap stopped \u2014 captured ${count9} ${count9 === 1 ? "entry" : "entries"} to ${outPath}`
28877
+ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
28876
28878
  )
28877
28879
  );
28878
28880
  process.exit(0);
@@ -29113,8 +29115,8 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
29113
29115
  related: []
29114
29116
  };
29115
29117
  walkPostRow(rows[id], resolve30, raw);
29116
- const post = buildPost(raw, mentionMap, author);
29117
- if (post) posts.push(post);
29118
+ const post2 = buildPost(raw, mentionMap, author);
29119
+ if (post2) posts.push(post2);
29118
29120
  }
29119
29121
  return posts;
29120
29122
  }
@@ -29273,8 +29275,8 @@ function extractVoyagerPosts(body) {
29273
29275
  for (const ref of elementUrns(rootObj)) {
29274
29276
  const update3 = byUrn.get(ref);
29275
29277
  if (!update3) continue;
29276
- const post = buildVoyagerPost(update3, profiles);
29277
- if (post) posts.push(post);
29278
+ const post2 = buildVoyagerPost(update3, profiles);
29279
+ if (post2) posts.push(post2);
29278
29280
  }
29279
29281
  return posts;
29280
29282
  }
@@ -29299,14 +29301,14 @@ function captureEntries(captureFile) {
29299
29301
  function dedupeByActivity(posts) {
29300
29302
  const byUrn = /* @__PURE__ */ new Map();
29301
29303
  const noUrn = [];
29302
- for (const post of posts) {
29303
- if (!post.activityUrn) {
29304
- noUrn.push(post);
29304
+ for (const post2 of posts) {
29305
+ if (!post2.activityUrn) {
29306
+ noUrn.push(post2);
29305
29307
  continue;
29306
29308
  }
29307
- const existing = byUrn.get(post.activityUrn);
29308
- if (!existing || post.text.length > existing.text.length)
29309
- byUrn.set(post.activityUrn, post);
29309
+ const existing = byUrn.get(post2.activityUrn);
29310
+ if (!existing || post2.text.length > existing.text.length)
29311
+ byUrn.set(post2.activityUrn, post2);
29310
29312
  }
29311
29313
  return [...byUrn.values(), ...noUrn];
29312
29314
  }
@@ -29446,11 +29448,11 @@ function printPromptsTable(rows) {
29446
29448
  console.log(chalk187.dim(header));
29447
29449
  console.log(chalk187.dim("-".repeat(header.length)));
29448
29450
  for (const row3 of rows) {
29449
- const count9 = String(row3.count).padStart(countWidth);
29451
+ const count10 = String(row3.count).padStart(countWidth);
29450
29452
  const tool = row3.tool.padEnd(toolWidth);
29451
29453
  const command = truncate(row3.command, 60).padEnd(commandWidth);
29452
29454
  console.log(
29453
- `${chalk187.yellow(count9)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
29455
+ `${chalk187.yellow(count10)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
29454
29456
  );
29455
29457
  }
29456
29458
  }
@@ -29560,8 +29562,8 @@ async function promptNavigation(currentPage, totalPages) {
29560
29562
  });
29561
29563
  return parseAction(action);
29562
29564
  }
29563
- function computeTotalPages(count9) {
29564
- return Math.ceil(count9 / PAGE_SIZE2);
29565
+ function computeTotalPages(count10) {
29566
+ return Math.ceil(count10 / PAGE_SIZE2);
29565
29567
  }
29566
29568
  async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
29567
29569
  const delta = await promptNavigation(currentPage, totalPages);
@@ -30047,9 +30049,9 @@ function renderResolvedIndex(threads, style) {
30047
30049
  for (const thread of threads) {
30048
30050
  const first = thread.comments[0];
30049
30051
  if (!first) continue;
30050
- const count9 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
30052
+ const count10 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
30051
30053
  lines2.push(
30052
- ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count9}`
30054
+ ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count10}`
30053
30055
  );
30054
30056
  }
30055
30057
  lines2.push("");
@@ -31348,12 +31350,12 @@ function printPrStatus(pr) {
31348
31350
  // src/commands/prs/status/printPrsStatus.ts
31349
31351
  function printPrsStatus(report) {
31350
31352
  for (const repo of report.repos) {
31351
- const count9 = repo.pullRequests.length;
31352
- console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count9} open)`)}`);
31353
+ const count10 = repo.pullRequests.length;
31354
+ console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count10} open)`)}`);
31353
31355
  for (const pr of repo.pullRequests) {
31354
31356
  printPrStatus(pr);
31355
31357
  }
31356
- if (count9 === 0) console.log(chalk191.dim(" no open pull requests"));
31358
+ if (count10 === 0) console.log(chalk191.dim(" no open pull requests"));
31357
31359
  console.log();
31358
31360
  }
31359
31361
  if (report.errors.length === 0) return;
@@ -33273,16 +33275,16 @@ import {
33273
33275
  } from "ts-morph";
33274
33276
  var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
33275
33277
  function countLeadingSuppressions(sourceFile) {
33276
- let count9 = 0;
33278
+ let count10 = 0;
33277
33279
  for (const stmt of sourceFile.getStatementsWithComments()) {
33278
33280
  const kind = stmt.getKind();
33279
33281
  if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
33280
- count9++;
33282
+ count10++;
33281
33283
  } else {
33282
33284
  break;
33283
33285
  }
33284
33286
  }
33285
- return count9;
33287
+ return count10;
33286
33288
  }
33287
33289
  function addImportPreservingSuppressions(sourceFile, structure) {
33288
33290
  if (sourceFile.getImportDeclarations().length > 0) {
@@ -35419,7 +35421,7 @@ function summariseRepoTree(cwd = process.cwd()) {
35419
35421
  return [...directories.entries()].map(([directory, extensions]) => ({
35420
35422
  directory,
35421
35423
  extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
35422
- total: [...extensions.values()].reduce((sum3, count9) => sum3 + count9, 0)
35424
+ total: [...extensions.values()].reduce((sum3, count10) => sum3 + count10, 0)
35423
35425
  })).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
35424
35426
  (entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
35425
35427
  ).join("\n");
@@ -35447,7 +35449,7 @@ function countByDirectory(files) {
35447
35449
  return directories;
35448
35450
  }
35449
35451
  function formatExtensions(extensions) {
35450
- return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count9]) => `${extension2}(${count9})`).join(", ");
35452
+ return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count10]) => `${extension2}(${count10})`).join(", ");
35451
35453
  }
35452
35454
 
35453
35455
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
@@ -35764,10 +35766,10 @@ function dedentedSource(call) {
35764
35766
  // src/commands/review/highLevel/visitCase.ts
35765
35767
  function visitCase(call, context) {
35766
35768
  if (!context.changed) return [toCase(call, context, void 0)];
35767
- const count9 = changedLines(call, context.changed);
35768
- if (count9 === 0) return [];
35769
+ const count10 = changedLines(call, context.changed);
35770
+ if (count10 === 0) return [];
35769
35771
  const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
35770
- return [toCase(call, context, count9 === lines2 ? "added" : "modified")];
35772
+ return [toCase(call, context, count10 === lines2 ? "added" : "modified")];
35771
35773
  }
35772
35774
  function toCase(call, context, change) {
35773
35775
  const line = call.getStartLineNumber();
@@ -35781,10 +35783,10 @@ function toCase(call, context, change) {
35781
35783
  };
35782
35784
  }
35783
35785
  function changedLines(call, changed) {
35784
- let count9 = 0;
35786
+ let count10 = 0;
35785
35787
  for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
35786
- if (changed.has(line)) count9++;
35787
- return count9;
35788
+ if (changed.has(line)) count10++;
35789
+ return count10;
35788
35790
  }
35789
35791
 
35790
35792
  // src/commands/review/highLevel/extractTestHierarchy.ts
@@ -35944,8 +35946,8 @@ function countEvidence(body) {
35944
35946
  0
35945
35947
  );
35946
35948
  }
35947
- function plural(count9, noun) {
35948
- return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
35949
+ function plural(count10, noun) {
35950
+ return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
35949
35951
  }
35950
35952
  function checkUiEvidence(body, changedFiles2, uiPaths) {
35951
35953
  if (uiPaths.length === 0)
@@ -36217,34 +36219,23 @@ function gatherHighLevelSubject(prNumber, force) {
36217
36219
  }
36218
36220
 
36219
36221
  // src/commands/review/highLevel/openHighLevelOverlay.ts
36220
- import { randomUUID as randomUUID19 } from "crypto";
36222
+ import { randomUUID as randomUUID20 } from "crypto";
36221
36223
 
36222
- // src/commands/review/highLevel/indexHighLevelTests.ts
36223
- function indexHighLevelTests(files) {
36224
- const index2 = /* @__PURE__ */ new Map();
36225
- const walk2 = (path109, node, parents) => {
36226
- const title = [...parents, node.name];
36227
- if (node.kind === "it")
36228
- index2.set(node.id, { path: path109, line: node.line, title });
36229
- else for (const child of node.children) walk2(path109, child, title);
36230
- };
36231
- for (const file of files)
36232
- for (const node of file.tests) walk2(file.path, node, []);
36233
- return index2;
36224
+ // src/commands/review/highLevel/highLevelReviewEvent.ts
36225
+ function highLevelReviewEvent(decision) {
36226
+ if (decision.reviewEvent) return decision.reviewEvent;
36227
+ return decision.decision === "approve" ? "APPROVE" : "REQUEST_CHANGES";
36234
36228
  }
36235
36229
 
36236
36230
  // src/commands/review/highLevel/buildHighLevelRecord.ts
36237
- function testComments(notes, tests) {
36238
- return notes.flatMap(({ id, comment: comment3 }) => {
36239
- const test = tests.get(id);
36240
- const trimmed = comment3.trim();
36241
- return test && trimmed ? [{ id, ...test, comment: trimmed }] : [];
36242
- });
36243
- }
36244
- function toItem2(check2, decision, tests) {
36231
+ var VERDICTS = {
36232
+ APPROVE: "approve",
36233
+ COMMENT: "comment",
36234
+ REQUEST_CHANGES: "request-changes"
36235
+ };
36236
+ function toItem2(check2, decision) {
36245
36237
  const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
36246
36238
  const comment3 = ticked?.comment?.trim();
36247
- const notes = testComments(ticked?.notes ?? [], tests);
36248
36239
  return {
36249
36240
  id: check2.id,
36250
36241
  kind: check2.kind,
@@ -36252,44 +36243,24 @@ function toItem2(check2, decision, tests) {
36252
36243
  status: check2.status,
36253
36244
  reason: check2.reason,
36254
36245
  ticked: ticked?.ticked ?? check2.status === "pass",
36255
- ...comment3 ? { comment: comment3 } : {},
36256
- ...notes.length > 0 ? { testComments: notes } : {}
36246
+ ...comment3 ? { comment: comment3 } : {}
36257
36247
  };
36258
36248
  }
36259
36249
  function buildHighLevelRecord(subject, decision) {
36260
36250
  const { checks: checks2, repo, prNumber, headRef, headSha } = subject;
36261
- const tests = indexHighLevelTests(subject.tests);
36251
+ const reviewComments = decision.reviewComments ?? [];
36262
36252
  return {
36263
36253
  repo,
36264
36254
  prNumber,
36265
36255
  headRef,
36266
36256
  headSha,
36267
- verdict: decision.decision === "approve" ? "approve" : "request-changes",
36257
+ verdict: VERDICTS[highLevelReviewEvent(decision)],
36268
36258
  reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
36269
- items: checks2.map((check2) => toItem2(check2, decision, tests))
36259
+ items: checks2.map((check2) => toItem2(check2, decision)),
36260
+ ...reviewComments.length > 0 ? { reviewComments } : {}
36270
36261
  };
36271
36262
  }
36272
36263
 
36273
- // src/commands/review/highLevel/formatHighLevelApprovalBody.ts
36274
- function indentContinuation(text18) {
36275
- return text18.replace(/\n/g, "\n ");
36276
- }
36277
- function formatTestComment(note) {
36278
- const title = note.title.join(" \u203A ");
36279
- return `- \`${note.path}:${note.line}\` ${title}: ${indentContinuation(note.comment)}`;
36280
- }
36281
- function formatItem(item) {
36282
- const notes = item.testComments ?? [];
36283
- if (!item.comment && notes.length === 0) return void 0;
36284
- const sections = [`**${item.title}**`];
36285
- if (item.comment) sections.push(item.comment);
36286
- if (notes.length > 0) sections.push(notes.map(formatTestComment).join("\n"));
36287
- return sections.join("\n\n");
36288
- }
36289
- function formatHighLevelApprovalBody(items2) {
36290
- return items2.map(formatItem).filter((section2) => section2 !== void 0).join("\n\n");
36291
- }
36292
-
36293
36264
  // src/commands/review/highLevel/highLevelChangedFileCount.ts
36294
36265
  function highLevelChangedFileCount(structure) {
36295
36266
  return structure.added + structure.removed + structure.modified;
@@ -36352,13 +36323,6 @@ function highLevelPreviewPayload(subject) {
36352
36323
  };
36353
36324
  }
36354
36325
 
36355
- // src/commands/review/highLevel/postHighLevelApproval.ts
36356
- function postHighLevelApproval(repo, prNumber, body) {
36357
- const args = ["pr", "review", String(prNumber), "--repo", repo, "--approve"];
36358
- if (body) args.push("--body", body);
36359
- runGhOrThrow(args, `Could not approve ${repo}#${prNumber}`);
36360
- }
36361
-
36362
36326
  // src/commands/review/highLevel/saveHighLevelReview.ts
36363
36327
  import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync38 } from "fs";
36364
36328
  import { dirname as dirname38 } from "path";
@@ -36370,13 +36334,107 @@ function saveHighLevelReview(record) {
36370
36334
  return path109;
36371
36335
  }
36372
36336
 
36337
+ // src/commands/review/highLevel/submitHighLevelReview.ts
36338
+ import { randomUUID as randomUUID19 } from "crypto";
36339
+
36340
+ // src/commands/review/highLevel/formatHighLevelReviewBody.ts
36341
+ function indentContinuation(text18) {
36342
+ return text18.replace(/\n/g, "\n ");
36343
+ }
36344
+ function formatItem(item) {
36345
+ if (!item.comment) return void 0;
36346
+ return `**${item.title}**
36347
+
36348
+ ${item.comment}`;
36349
+ }
36350
+ function formatReviewComment({
36351
+ path: path109,
36352
+ startLine,
36353
+ endLine,
36354
+ quote,
36355
+ note
36356
+ }) {
36357
+ const lines2 = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
36358
+ return `- \`${path109}:${lines2}\` ${quote}: ${indentContinuation(note)}`;
36359
+ }
36360
+ function formatHighLevelReviewBody(items2, reviewComments = []) {
36361
+ const sections = items2.map(formatItem).filter((section2) => section2 !== void 0);
36362
+ if (reviewComments.length > 0)
36363
+ sections.push(
36364
+ `**Comments**
36365
+
36366
+ ${reviewComments.map(formatReviewComment).join("\n")}`
36367
+ );
36368
+ return sections.join("\n\n");
36369
+ }
36370
+
36371
+ // src/commands/review/highLevel/postHighLevelReview.ts
36372
+ var FLAGS = {
36373
+ APPROVE: "--approve",
36374
+ COMMENT: "--comment",
36375
+ REQUEST_CHANGES: "--request-changes"
36376
+ };
36377
+ function postHighLevelReview(repo, prNumber, event, body) {
36378
+ const args = ["pr", "review", String(prNumber), "--repo", repo, FLAGS[event]];
36379
+ if (body) args.push("--body", body);
36380
+ runGhOrThrow(args, `Could not review ${repo}#${prNumber}`);
36381
+ }
36382
+
36383
+ // src/commands/review/highLevel/submitHighLevelReview.ts
36384
+ var EVENTS = {
36385
+ approve: "APPROVE",
36386
+ comment: "COMMENT",
36387
+ "request-changes": "REQUEST_CHANGES"
36388
+ };
36389
+ var LABELS = {
36390
+ APPROVE: "Approve",
36391
+ COMMENT: "Comment on",
36392
+ REQUEST_CHANGES: "Request changes on"
36393
+ };
36394
+ function post(record, event, body) {
36395
+ const target = `${record.repo}#${record.prNumber}`;
36396
+ try {
36397
+ postHighLevelReview(record.repo, record.prNumber, event, body);
36398
+ } catch (error) {
36399
+ console.error(
36400
+ `Could not post the review to ${target}: ${error.message}`
36401
+ );
36402
+ process.exit(1);
36403
+ }
36404
+ console.log(`Review (${event}) posted to ${target}.`);
36405
+ }
36406
+ async function previewApproved(sessionId, record, event, body) {
36407
+ const decision = await awaitPreviewApproval(
36408
+ "Review",
36409
+ {
36410
+ sessionId,
36411
+ requestId: randomUUID19(),
36412
+ title: `${LABELS[event]} ${record.repo}#${record.prNumber}`,
36413
+ body,
36414
+ prNumber: record.prNumber,
36415
+ kind: "pr-comment"
36416
+ },
36417
+ { rejectIsOutcome: true }
36418
+ );
36419
+ return decision.decision === "approve" && !decision.dismissed;
36420
+ }
36421
+ async function submitHighLevelReview(sessionId, record) {
36422
+ const event = EVENTS[record.verdict];
36423
+ const body = formatHighLevelReviewBody(record.items, record.reviewComments);
36424
+ if (event === "APPROVE" && !record.reviewComments?.length)
36425
+ return post(record, event, body);
36426
+ if (body && await previewApproved(sessionId, record, event, body))
36427
+ return post(record, event, body);
36428
+ console.log("Nothing was posted to GitHub.");
36429
+ }
36430
+
36373
36431
  // src/commands/review/highLevel/openHighLevelOverlay.ts
36374
36432
  async function openHighLevelOverlay(sessionId, subject) {
36375
36433
  const decision = await awaitPreviewApproval(
36376
36434
  "High-level review",
36377
36435
  {
36378
36436
  sessionId,
36379
- requestId: randomUUID19(),
36437
+ requestId: randomUUID20(),
36380
36438
  title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
36381
36439
  body: JSON.stringify(highLevelPreviewPayload(subject)),
36382
36440
  prNumber: subject.prNumber,
@@ -36392,26 +36450,9 @@ async function openHighLevelOverlay(sessionId, subject) {
36392
36450
  const record = buildHighLevelRecord(subject, decision);
36393
36451
  saveHighLevelReview(record);
36394
36452
  console.log(`Verdict: ${record.verdict}`);
36395
- if (record.verdict === "approve") approveOnGitHub(record);
36396
- else console.log("Nothing was posted to GitHub.");
36453
+ await submitHighLevelReview(sessionId, record);
36397
36454
  return record;
36398
36455
  }
36399
- function approveOnGitHub(record) {
36400
- const target = `${record.repo}#${record.prNumber}`;
36401
- try {
36402
- postHighLevelApproval(
36403
- record.repo,
36404
- record.prNumber,
36405
- formatHighLevelApprovalBody(record.items)
36406
- );
36407
- } catch (error) {
36408
- console.error(
36409
- `Could not post the approval to ${target}: ${error.message}`
36410
- );
36411
- process.exit(1);
36412
- }
36413
- console.log(`Approval posted to ${target}.`);
36414
- }
36415
36456
 
36416
36457
  // src/commands/review/highLevel/printHighLevelChecklist.ts
36417
36458
  import chalk241 from "chalk";
@@ -38400,9 +38441,9 @@ function setupReviewDir(repoRoot2, context, force) {
38400
38441
  console.log(`Review folder: ${paths.reviewDir}`);
38401
38442
  return paths;
38402
38443
  }
38403
- function logPriorComments(count9) {
38404
- if (count9 === 0) return;
38405
- console.log(`Including ${count9} prior review comment(s) in request.md.`);
38444
+ function logPriorComments(count10) {
38445
+ if (count10 === 0) return;
38446
+ console.log(`Including ${count10} prior review comment(s) in request.md.`);
38406
38447
  }
38407
38448
 
38408
38449
  // src/commands/review/gatherContext.ts
@@ -38942,7 +38983,7 @@ function addReviewModeOptions(command) {
38942
38983
  "Check the PR out and start an idle interactive Claude session in the checkout tree instead of reviewing; requires a PR number and cannot be combined with --refine, --apply, --backlog or --submit"
38943
38984
  ).option(
38944
38985
  "--high-level",
38945
- "Skip the LLM review; check the PR branch out and step through the high-level review checklist in the web UI preview pane. Given a PR number outside a Claude session, it checks the PR out and starts an auto-mode Claude session running /review-high-level <number>, which opens the checklist as a background task so the agent can answer questions while it is open; inside a Claude session it opens the checklist directly. The checklist is backed by the changed-file tree and the diffs of review.highLevel.criticalPaths, writing the verdict, per-item state and comments to ~/.assist/high-level-reviews/. A review already saved for the same head SHA is reopened unless --force is passed. Approve also submits a GitHub approval whose body lists the checklist and test comments; request changes posts nothing. Cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
38986
+ "Check the PR out and open the high-level review checklist in the web UI preview pane, then post it to the PR as an Approve, Comment or Request changes review. Outside a Claude session it starts one running /review-high-level <number>. A review saved for the same head SHA is reopened unless --force is passed. Cannot be combined with --refine, --apply, --backlog, --submit or --checkout-only"
38946
38987
  ).option(
38947
38988
  "--configure",
38948
38989
  "With --high-level: review nothing and instead ask for review.highLevel.criticalPaths, uiPaths and descriptionWordCap one at a time, each prefilled with its current value or, when unset, globs Claude proposes from this repo's own tree, then write the answers in one pass to either this repo's override in the shared assist database or the project assist.yml. A blank answer leaves that key unset"
@@ -39326,16 +39367,16 @@ function filterToSql(filter) {
39326
39367
  }
39327
39368
 
39328
39369
  // src/commands/seq/fetchSeqData.ts
39329
- function buildDataParams(filter, count9, from, to) {
39370
+ function buildDataParams(filter, count10, from, to) {
39330
39371
  const sqlFilter = filterToSql(filter);
39331
- const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count9}`;
39372
+ const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count10}`;
39332
39373
  const params = new URLSearchParams({ q: sql29 });
39333
39374
  if (from) params.set("rangeStartUtc", from);
39334
39375
  if (to) params.set("rangeEndUtc", to);
39335
39376
  return params;
39336
39377
  }
39337
- async function fetchSeqData(conn, filter, count9, from, to) {
39338
- const params = buildDataParams(filter, count9, from, to);
39378
+ async function fetchSeqData(conn, filter, count10, from, to) {
39379
+ const params = buildDataParams(filter, count10, from, to);
39339
39380
  const response = await fetchSeq(conn, "/api/data", params);
39340
39381
  const data = await response.json();
39341
39382
  return mapDataToEvents(data);
@@ -39502,12 +39543,12 @@ function resolveConnection2(name) {
39502
39543
  async function seqQuery(filter, options2) {
39503
39544
  rejectTimestampFilter(filter);
39504
39545
  const conn = resolveConnection2(options2.connection);
39505
- const count9 = Number.parseInt(options2.count ?? "1000", 10);
39546
+ const count10 = Number.parseInt(options2.count ?? "1000", 10);
39506
39547
  const from = options2.from ? parseRelativeTime(options2.from) : void 0;
39507
39548
  const to = options2.to ? parseRelativeTime(options2.to) : void 0;
39508
- const events = from || to ? await fetchSeqData(conn, filter, count9, from, to) : await fetchSeqEvents(
39549
+ const events = from || to ? await fetchSeqData(conn, filter, count10, from, to) : await fetchSeqEvents(
39509
39550
  conn,
39510
- new URLSearchParams({ filter, count: String(count9) })
39551
+ new URLSearchParams({ filter, count: String(count10) })
39511
39552
  );
39512
39553
  if (events.length === 0) {
39513
39554
  console.log(chalk252.yellow("No events found."));
@@ -39523,10 +39564,10 @@ async function seqQuery(filter, options2) {
39523
39564
  }
39524
39565
  console.log(chalk252.dim(`
39525
39566
  ${events.length} events`));
39526
- if (events.length >= count9) {
39567
+ if (events.length >= count10) {
39527
39568
  console.log(
39528
39569
  chalk252.yellow(
39529
- `Results limited to ${count9}. Use --count to retrieve more.`
39570
+ `Results limited to ${count10}. Use --count to retrieve more.`
39530
39571
  )
39531
39572
  );
39532
39573
  }
@@ -39572,7 +39613,7 @@ function registerSeq(program2) {
39572
39613
  }
39573
39614
 
39574
39615
  // src/commands/show.ts
39575
- import { randomUUID as randomUUID20 } from "crypto";
39616
+ import { randomUUID as randomUUID21 } from "crypto";
39576
39617
 
39577
39618
  // src/commands/sessions/shared/sendShowPreview.ts
39578
39619
  async function sendShowPreview(request) {
@@ -39624,7 +39665,7 @@ async function show3(options2) {
39624
39665
  try {
39625
39666
  await sendShowPreview({
39626
39667
  sessionId,
39627
- requestId: randomUUID20(),
39668
+ requestId: randomUUID21(),
39628
39669
  title: options2.title ?? "Show",
39629
39670
  body
39630
39671
  });
@@ -39699,7 +39740,7 @@ function readSlackParts(files) {
39699
39740
  }
39700
39741
 
39701
39742
  // src/commands/slack/reviewProposedSlackMessage.ts
39702
- import { randomUUID as randomUUID21 } from "crypto";
39743
+ import { randomUUID as randomUUID22 } from "crypto";
39703
39744
  async function reviewProposedSlackMessage(target, body, workingPath) {
39704
39745
  const sessionId = process.env.ASSIST_SESSION_ID;
39705
39746
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
@@ -39709,7 +39750,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
39709
39750
  part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
39710
39751
  {
39711
39752
  sessionId,
39712
- requestId: randomUUID21(),
39753
+ requestId: randomUUID22(),
39713
39754
  title: part ? `${destination} (${part.index}/${part.total})` : destination,
39714
39755
  body,
39715
39756
  prNumber: null,
@@ -41293,10 +41334,10 @@ function closesBlock(trimmed, from) {
41293
41334
  }
41294
41335
  function csharpHeaderLineCount(content) {
41295
41336
  const lines2 = content.split("\n");
41296
- let count9 = 0;
41337
+ let count10 = 0;
41297
41338
  let inBlock = false;
41298
- while (count9 < lines2.length) {
41299
- const trimmed = lines2[count9].trim();
41339
+ while (count10 < lines2.length) {
41340
+ const trimmed = lines2[count10].trim();
41300
41341
  if (inBlock) {
41301
41342
  inBlock = !closesBlock(trimmed, 0);
41302
41343
  } else if (trimmed.startsWith("/*")) {
@@ -41304,9 +41345,9 @@ function csharpHeaderLineCount(content) {
41304
41345
  } else if (trimmed !== "" && !trimmed.startsWith("//")) {
41305
41346
  break;
41306
41347
  }
41307
- count9++;
41348
+ count10++;
41308
41349
  }
41309
- return count9;
41350
+ return count10;
41310
41351
  }
41311
41352
 
41312
41353
  // src/commands/verify/blockCodeComments/collectCsharpComments.ts
@@ -42081,9 +42122,9 @@ async function watchLoop() {
42081
42122
  }
42082
42123
 
42083
42124
  // src/commands/watch/readRecentCommits.ts
42084
- function readRecentCommits(count9 = 10, cwd) {
42125
+ function readRecentCommits(count10 = 10, cwd) {
42085
42126
  const output = runGit3(
42086
- ["log", `-${count9}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
42127
+ ["log", `-${count10}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
42087
42128
  cwd
42088
42129
  );
42089
42130
  if (!output) return [];
@@ -42551,10 +42592,10 @@ function consumeSimulatedDivergence(cwd) {
42551
42592
  }
42552
42593
 
42553
42594
  // src/commands/watch/detectMovement.ts
42554
- function detectMovement(from, to, count9) {
42595
+ function detectMovement(from, to, count10) {
42555
42596
  if (from === to) return void 0;
42556
- if (!Number.isFinite(count9) || count9 <= 0) return void 0;
42557
- return { from, to, count: count9 };
42597
+ if (!Number.isFinite(count10) || count10 <= 0) return void 0;
42598
+ return { from, to, count: count10 };
42558
42599
  }
42559
42600
 
42560
42601
  // src/commands/watch/readMovement.ts
@@ -42562,8 +42603,8 @@ function readMovement(cwd) {
42562
42603
  try {
42563
42604
  const from = runGit3(["rev-parse", "@"], cwd);
42564
42605
  const to = runGit3(["rev-parse", "@{u}"], cwd);
42565
- const count9 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42566
- return detectMovement(from, to, count9);
42606
+ const count10 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42607
+ return detectMovement(from, to, count10);
42567
42608
  } catch {
42568
42609
  return void 0;
42569
42610
  }
@@ -43487,9 +43528,9 @@ async function drainDaemon(options2 = {}) {
43487
43528
  return;
43488
43529
  }
43489
43530
  }
43490
- const count9 = await requestDrain(socket, lines2);
43531
+ const count10 = await requestDrain(socket, lines2);
43491
43532
  socket.destroy();
43492
- console.log(`Drained ${count9} session(s)`);
43533
+ console.log(`Drained ${count10} session(s)`);
43493
43534
  }
43494
43535
  function reportLive(live) {
43495
43536
  console.log(`${live.length} live session(s) would be closed:`);
@@ -43554,11 +43595,11 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43554
43595
  inFlight2 = true;
43555
43596
  try {
43556
43597
  const before = JSON.stringify(readRepoConfigCache());
43557
- const count9 = await refreshRepoConfigCache();
43598
+ const count10 = await refreshRepoConfigCache();
43558
43599
  if (failing) daemonLog("repo config cache poll recovered");
43559
43600
  failing = false;
43560
43601
  if (JSON.stringify(readRepoConfigCache()) !== before)
43561
- daemonLog(`repo config cache updated (${count9} repos)`);
43602
+ daemonLog(`repo config cache updated (${count10} repos)`);
43562
43603
  } catch (error) {
43563
43604
  if (!failing)
43564
43605
  daemonLog(
@@ -43577,8 +43618,8 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43577
43618
  // src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
43578
43619
  async function refreshRepoConfigCacheOnStart() {
43579
43620
  try {
43580
- const count9 = await refreshRepoConfigCache();
43581
- daemonLog(`repo config cache refreshed (${count9} repos)`);
43621
+ const count10 = await refreshRepoConfigCache();
43622
+ daemonLog(`repo config cache refreshed (${count10} repos)`);
43582
43623
  } catch (error) {
43583
43624
  daemonLog(
43584
43625
  `repo config cache refresh failed; keeping the last snapshot: ${String(error)}`
@@ -44137,7 +44178,7 @@ var ClientHub = class extends Set {
44137
44178
  };
44138
44179
 
44139
44180
  // src/commands/sessions/daemon/createSession.ts
44140
- import { randomUUID as randomUUID22 } from "crypto";
44181
+ import { randomUUID as randomUUID23 } from "crypto";
44141
44182
 
44142
44183
  // src/commands/sessions/daemon/sessionBase.ts
44143
44184
  function sessionBase(id, status2) {
@@ -44360,7 +44401,7 @@ function spawnRun(opts) {
44360
44401
  function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
44361
44402
  if (harness && harness !== "claude")
44362
44403
  return createHarnessSession(id, harness, prompt, cwd, holdPty);
44363
- const claudeSessionId = randomUUID22();
44404
+ const claudeSessionId = randomUUID23();
44364
44405
  return {
44365
44406
  ...sessionBase(id, prompt ? "running" : "waiting"),
44366
44407
  name: `Session ${id}`,
@@ -45411,6 +45452,16 @@ function greetClient(client, sessions, links2) {
45411
45452
  links2.sendNodes(client);
45412
45453
  }
45413
45454
 
45455
+ // src/commands/sessions/daemon/logPrDecision.ts
45456
+ function count9(value) {
45457
+ return Array.isArray(value) ? value.length : 0;
45458
+ }
45459
+ function logPrDecision(id, requestId, d) {
45460
+ daemonLog(
45461
+ `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${count9(d.comments)} screenshots=${count9(d.screenshots)} checklist=${count9(d.checklist)} reviewEvent=${d.reviewEvent} reviewComments=${count9(d.reviewComments)} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true}`
45462
+ );
45463
+ }
45464
+
45414
45465
  // src/commands/sessions/daemon/decidePrPreview.ts
45415
45466
  function decidePrPreview(sessions, waiters, notify2, d) {
45416
45467
  const id = d.sessionId;
@@ -45422,12 +45473,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
45422
45473
  );
45423
45474
  return;
45424
45475
  }
45425
- const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
45426
- const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
45427
- const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
45428
- daemonLog(
45429
- `pr-decision received: id=${id} requestId=${requestId} decision=${d.decision} comments=${commentCount} screenshots=${screenshotCount} checklist=${checklistCount} reviewAfter=${d.reviewAfter === true} announceAfter=${d.announceAfter === true} draft=${d.draft} autoMerge=${d.autoMerge === true} autostart=${d.autostart === true}`
45430
- );
45476
+ logPrDecision(id, requestId, d);
45431
45477
  const waiter = waiters.get(id);
45432
45478
  if (waiter)
45433
45479
  sendTo(waiter, {
@@ -45444,6 +45490,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
45444
45490
  autoMerge: d.autoMerge,
45445
45491
  autostart: d.autostart,
45446
45492
  checklist: d.checklist,
45493
+ reviewEvent: d.reviewEvent,
45494
+ reviewComments: d.reviewComments,
45447
45495
  dismissed: d.dismissed
45448
45496
  });
45449
45497
  waiters.delete(id);
@@ -47121,7 +47169,7 @@ function codexRespawnPlan(session) {
47121
47169
  }
47122
47170
 
47123
47171
  // src/commands/sessions/daemon/interactiveRespawnPlan.ts
47124
- import { randomUUID as randomUUID23 } from "crypto";
47172
+ import { randomUUID as randomUUID24 } from "crypto";
47125
47173
 
47126
47174
  // src/commands/sessions/daemon/hasTranscriptOnDisk.ts
47127
47175
  function hasTranscriptOnDisk(session) {
@@ -47148,7 +47196,7 @@ function interactiveRespawnPlan(session, resumes) {
47148
47196
  return null;
47149
47197
  }
47150
47198
  function freshClaudePlan(session, prompt, cwd) {
47151
- const claudeSessionId = randomUUID23();
47199
+ const claudeSessionId = randomUUID24();
47152
47200
  return {
47153
47201
  spawn: () => {
47154
47202
  session.claudeSessionId = claudeSessionId;
@@ -51038,10 +51086,10 @@ async function requestSessionOutput(target) {
51038
51086
  }
51039
51087
 
51040
51088
  // src/commands/sessions/lastLines.ts
51041
- function lastLines(scrollback, count9) {
51089
+ function lastLines(scrollback, count10) {
51042
51090
  const lines2 = stripAnsi(scrollback).split(/\r?\n/);
51043
51091
  if (lines2.at(-1) === "") lines2.pop();
51044
- return lines2.slice(-count9);
51092
+ return lines2.slice(-count10);
51045
51093
  }
51046
51094
 
51047
51095
  // src/commands/sessions/sessionOutput.ts
@@ -51061,14 +51109,14 @@ function resolveTarget3(sessionId, server) {
51061
51109
  return { sessionId };
51062
51110
  }
51063
51111
  async function sessionOutput(sessionId, options2) {
51064
- const count9 = Number.parseInt(options2.lines, 10);
51065
- if (!Number.isInteger(count9) || count9 < 1)
51112
+ const count10 = Number.parseInt(options2.lines, 10);
51113
+ if (!Number.isInteger(count10) || count10 < 1)
51066
51114
  return fail7(`-n must be a positive integer, got ${options2.lines}`);
51067
51115
  const target = resolveTarget3(sessionId, options2.server);
51068
51116
  if (typeof target === "string") return fail7(target);
51069
51117
  try {
51070
51118
  const scrollback = await requestSessionOutput(target);
51071
- for (const line of lastLines(scrollback, count9)) console.log(line);
51119
+ for (const line of lastLines(scrollback, count10)) console.log(line);
51072
51120
  } catch (error) {
51073
51121
  fail7(error instanceof Error ? error.message : String(error));
51074
51122
  }
@@ -51097,7 +51145,7 @@ function registerSetStatusCommand(cmd) {
51097
51145
  "Originating hook (permission, stop, notification, prompt, pretool, posttool)"
51098
51146
  ).option(
51099
51147
  "--ack",
51100
- "Wait for the daemon to acknowledge delivery, retrying on failure"
51148
+ "Retry delivery until the daemon acknowledges it (without it, a single attempt)"
51101
51149
  ).action(
51102
51150
  (status2, options2) => setSessionStatus(status2, { source: options2.source, ack: options2.ack })
51103
51151
  );