@staff0rd/assist 0.859.2 → 0.861.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.2",
9
+ version: "0.861.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,45 @@ 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 isSide(value) {
3308
+ return value === "LEFT" || value === "RIGHT";
3309
+ }
3310
+ function isReviewComment(value) {
3311
+ const comment3 = value;
3312
+ return typeof comment3?.path === "string" && Number.isInteger(comment3.startLine) && Number.isInteger(comment3.endLine) && typeof comment3.quote === "string" && typeof comment3.note === "string" && comment3.note.trim() !== "";
3313
+ }
3314
+ function toReviewComments(value) {
3315
+ if (!Array.isArray(value)) return void 0;
3316
+ return value.filter(isReviewComment).map(({ path: path109, startLine, endLine, quote, note, startSide, side }) => ({
3317
+ path: path109,
3318
+ startLine,
3319
+ endLine,
3320
+ quote,
3321
+ note,
3322
+ ...isSide(startSide) ? { startSide } : {},
3323
+ ...isSide(side) ? { side } : {}
3324
+ }));
3315
3325
  }
3316
3326
 
3317
3327
  // src/commands/sessions/shared/toPreviewDecision.ts
3328
+ var REVIEW_EVENTS = [
3329
+ "APPROVE",
3330
+ "COMMENT",
3331
+ "REQUEST_CHANGES"
3332
+ ];
3318
3333
  function toSelection(value) {
3319
3334
  const selection = value;
3320
3335
  if (typeof selection?.topLeft !== "string" || typeof selection.bottomRight !== "string")
@@ -3336,6 +3351,8 @@ function toPreviewDecision(msg) {
3336
3351
  autostart: msg.autostart === true,
3337
3352
  selection: toSelection(msg.selection),
3338
3353
  checklist: toChecklist(msg.checklist),
3354
+ reviewEvent: REVIEW_EVENTS.find((event) => event === msg.reviewEvent),
3355
+ reviewComments: toReviewComments(msg.reviewComments),
3339
3356
  dismissed: msg.dismissed === true
3340
3357
  };
3341
3358
  }
@@ -15213,11 +15230,12 @@ function assertProjectScope() {
15213
15230
 
15214
15231
  // src/shared/runGhOrThrow.ts
15215
15232
  import { execFileSync as execFileSync4 } from "child_process";
15216
- function runGhOrThrow(args, fallbackMessage) {
15233
+ function runGhOrThrow(args, fallbackMessage, input) {
15217
15234
  try {
15218
15235
  execFileSync4("gh", args, {
15219
- stdio: ["ignore", "ignore", "pipe"],
15220
- encoding: "utf8"
15236
+ stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
15237
+ encoding: "utf8",
15238
+ ...input === void 0 ? {} : { input }
15221
15239
  });
15222
15240
  } catch (error) {
15223
15241
  const stderr = error.stderr;
@@ -15592,8 +15610,8 @@ function listUsageHistory(req, res) {
15592
15610
  // src/shared/db/countItemUsageByOrigin.ts
15593
15611
  import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-orm";
15594
15612
  async function countItemUsageByOrigin(db) {
15595
- const count9 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15596
- 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));
15613
+ const count10 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15614
+ 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));
15597
15615
  return rows.map((row3) => ({ origin: row3.origin, count: Number(row3.count) }));
15598
15616
  }
15599
15617
 
@@ -16306,8 +16324,8 @@ async function commitsBehind(cwd, repo, base, shas) {
16306
16324
  ]);
16307
16325
  const ref = response.data?.repository?.ref;
16308
16326
  for (const [index2, sha] of shas.entries()) {
16309
- const count9 = ref?.[`c${index2}`]?.behindBy;
16310
- behind.set(sha, typeof count9 === "number" ? count9 : null);
16327
+ const count10 = ref?.[`c${index2}`]?.behindBy;
16328
+ behind.set(sha, typeof count10 === "number" ? count10 : null);
16311
16329
  }
16312
16330
  } catch {
16313
16331
  return behind;
@@ -16424,9 +16442,9 @@ function deploymentsQuery(environments) {
16424
16442
  function headCommit2(node) {
16425
16443
  return node?.oid ? releaseCommit(node.oid, node) : null;
16426
16444
  }
16427
- function environmentNodes(repository, count9) {
16445
+ function environmentNodes(repository, count10) {
16428
16446
  return Array.from(
16429
- { length: count9 },
16447
+ { length: count10 },
16430
16448
  (_, index2) => repository[deploymentsAlias(index2)]?.nodes ?? []
16431
16449
  ).flat();
16432
16450
  }
@@ -21795,7 +21813,7 @@ function calculateHalstead(node) {
21795
21813
  // src/commands/complexity/shared/countSloc.ts
21796
21814
  function countSloc(content) {
21797
21815
  let inMultiLineComment = false;
21798
- let count9 = 0;
21816
+ let count10 = 0;
21799
21817
  for (const line of content.split("\n")) {
21800
21818
  const trimmed = line.trim();
21801
21819
  if (inMultiLineComment) {
@@ -21803,7 +21821,7 @@ function countSloc(content) {
21803
21821
  inMultiLineComment = false;
21804
21822
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21805
21823
  if (afterComment.trim().length > 0) {
21806
- count9++;
21824
+ count10++;
21807
21825
  }
21808
21826
  }
21809
21827
  continue;
@@ -21815,7 +21833,7 @@ function countSloc(content) {
21815
21833
  if (trimmed.includes("*/")) {
21816
21834
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21817
21835
  if (afterComment.trim().length > 0) {
21818
- count9++;
21836
+ count10++;
21819
21837
  }
21820
21838
  } else {
21821
21839
  inMultiLineComment = true;
@@ -21823,10 +21841,10 @@ function countSloc(content) {
21823
21841
  continue;
21824
21842
  }
21825
21843
  if (trimmed.length > 0) {
21826
- count9++;
21844
+ count10++;
21827
21845
  }
21828
21846
  }
21829
- return count9;
21847
+ return count10;
21830
21848
  }
21831
21849
 
21832
21850
  // src/commands/complexity/shared.ts
@@ -22854,10 +22872,10 @@ async function findRetiredTables(exec3) {
22854
22872
  const found = [];
22855
22873
  for (const row3 of present) {
22856
22874
  const name = String(row3.table_name);
22857
- const [count9] = await exec3.query(
22875
+ const [count10] = await exec3.query(
22858
22876
  `SELECT count(*)::int AS rows FROM "${name}"`
22859
22877
  );
22860
- found.push({ name, rows: Number(count9.rows) });
22878
+ found.push({ name, rows: Number(count10.rows) });
22861
22879
  }
22862
22880
  return found;
22863
22881
  }
@@ -25565,8 +25583,8 @@ function annotate(entry) {
25565
25583
  }
25566
25584
  return notes;
25567
25585
  }
25568
- function formatCount(count9, noun) {
25569
- return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
25586
+ function formatCount(count10, noun) {
25587
+ return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
25570
25588
  }
25571
25589
  function printFixStructurePlan(plan2, chain2, apply) {
25572
25590
  writeLineNow(chalk172.dim(`chain: ${chain2.join(" > ")}`));
@@ -28834,14 +28852,14 @@ async function netcap(options2) {
28834
28852
  const filter = options2.filter ?? "";
28835
28853
  await mkdir6(dirname34(outPath), { recursive: true });
28836
28854
  const extensionPath = await prepareExtensionForLoad(port, filter);
28837
- let count9 = 0;
28855
+ let count10 = 0;
28838
28856
  const handler = createNetcapHandler({
28839
28857
  outPath,
28840
28858
  onPing: () => console.log(chalk184.dim("ping from extension")),
28841
28859
  onCapture: (entry) => {
28842
- count9 += 1;
28860
+ count10 += 1;
28843
28861
  console.log(
28844
- chalk184.green(`captured #${count9}`),
28862
+ chalk184.green(`captured #${count10}`),
28845
28863
  chalk184.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
28846
28864
  );
28847
28865
  }
@@ -28862,7 +28880,7 @@ async function netcap(options2) {
28862
28880
  console.log(
28863
28881
  chalk184.bold(
28864
28882
  `
28865
- netcap stopped \u2014 captured ${count9} ${count9 === 1 ? "entry" : "entries"} to ${outPath}`
28883
+ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"} to ${outPath}`
28866
28884
  )
28867
28885
  );
28868
28886
  process.exit(0);
@@ -29103,8 +29121,8 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
29103
29121
  related: []
29104
29122
  };
29105
29123
  walkPostRow(rows[id], resolve30, raw);
29106
- const post = buildPost(raw, mentionMap, author);
29107
- if (post) posts.push(post);
29124
+ const post2 = buildPost(raw, mentionMap, author);
29125
+ if (post2) posts.push(post2);
29108
29126
  }
29109
29127
  return posts;
29110
29128
  }
@@ -29263,8 +29281,8 @@ function extractVoyagerPosts(body) {
29263
29281
  for (const ref of elementUrns(rootObj)) {
29264
29282
  const update3 = byUrn.get(ref);
29265
29283
  if (!update3) continue;
29266
- const post = buildVoyagerPost(update3, profiles);
29267
- if (post) posts.push(post);
29284
+ const post2 = buildVoyagerPost(update3, profiles);
29285
+ if (post2) posts.push(post2);
29268
29286
  }
29269
29287
  return posts;
29270
29288
  }
@@ -29289,14 +29307,14 @@ function captureEntries(captureFile) {
29289
29307
  function dedupeByActivity(posts) {
29290
29308
  const byUrn = /* @__PURE__ */ new Map();
29291
29309
  const noUrn = [];
29292
- for (const post of posts) {
29293
- if (!post.activityUrn) {
29294
- noUrn.push(post);
29310
+ for (const post2 of posts) {
29311
+ if (!post2.activityUrn) {
29312
+ noUrn.push(post2);
29295
29313
  continue;
29296
29314
  }
29297
- const existing = byUrn.get(post.activityUrn);
29298
- if (!existing || post.text.length > existing.text.length)
29299
- byUrn.set(post.activityUrn, post);
29315
+ const existing = byUrn.get(post2.activityUrn);
29316
+ if (!existing || post2.text.length > existing.text.length)
29317
+ byUrn.set(post2.activityUrn, post2);
29300
29318
  }
29301
29319
  return [...byUrn.values(), ...noUrn];
29302
29320
  }
@@ -29436,11 +29454,11 @@ function printPromptsTable(rows) {
29436
29454
  console.log(chalk187.dim(header));
29437
29455
  console.log(chalk187.dim("-".repeat(header.length)));
29438
29456
  for (const row3 of rows) {
29439
- const count9 = String(row3.count).padStart(countWidth);
29457
+ const count10 = String(row3.count).padStart(countWidth);
29440
29458
  const tool = row3.tool.padEnd(toolWidth);
29441
29459
  const command = truncate(row3.command, 60).padEnd(commandWidth);
29442
29460
  console.log(
29443
- `${chalk187.yellow(count9)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
29461
+ `${chalk187.yellow(count10)} ${tool} ${command} ${chalk187.dim(row3.repos)}`
29444
29462
  );
29445
29463
  }
29446
29464
  }
@@ -29550,8 +29568,8 @@ async function promptNavigation(currentPage, totalPages) {
29550
29568
  });
29551
29569
  return parseAction(action);
29552
29570
  }
29553
- function computeTotalPages(count9) {
29554
- return Math.ceil(count9 / PAGE_SIZE2);
29571
+ function computeTotalPages(count10) {
29572
+ return Math.ceil(count10 / PAGE_SIZE2);
29555
29573
  }
29556
29574
  async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
29557
29575
  const delta = await promptNavigation(currentPage, totalPages);
@@ -30037,9 +30055,9 @@ function renderResolvedIndex(threads, style) {
30037
30055
  for (const thread of threads) {
30038
30056
  const first = thread.comments[0];
30039
30057
  if (!first) continue;
30040
- const count9 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
30058
+ const count10 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
30041
30059
  lines2.push(
30042
- ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count9}`
30060
+ ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count10}`
30043
30061
  );
30044
30062
  }
30045
30063
  lines2.push("");
@@ -31338,12 +31356,12 @@ function printPrStatus(pr) {
31338
31356
  // src/commands/prs/status/printPrsStatus.ts
31339
31357
  function printPrsStatus(report) {
31340
31358
  for (const repo of report.repos) {
31341
- const count9 = repo.pullRequests.length;
31342
- console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count9} open)`)}`);
31359
+ const count10 = repo.pullRequests.length;
31360
+ console.log(`${chalk191.bold(repo.repo)} ${chalk191.dim(`(${count10} open)`)}`);
31343
31361
  for (const pr of repo.pullRequests) {
31344
31362
  printPrStatus(pr);
31345
31363
  }
31346
- if (count9 === 0) console.log(chalk191.dim(" no open pull requests"));
31364
+ if (count10 === 0) console.log(chalk191.dim(" no open pull requests"));
31347
31365
  console.log();
31348
31366
  }
31349
31367
  if (report.errors.length === 0) return;
@@ -33263,16 +33281,16 @@ import {
33263
33281
  } from "ts-morph";
33264
33282
  var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
33265
33283
  function countLeadingSuppressions(sourceFile) {
33266
- let count9 = 0;
33284
+ let count10 = 0;
33267
33285
  for (const stmt of sourceFile.getStatementsWithComments()) {
33268
33286
  const kind = stmt.getKind();
33269
33287
  if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
33270
- count9++;
33288
+ count10++;
33271
33289
  } else {
33272
33290
  break;
33273
33291
  }
33274
33292
  }
33275
- return count9;
33293
+ return count10;
33276
33294
  }
33277
33295
  function addImportPreservingSuppressions(sourceFile, structure) {
33278
33296
  if (sourceFile.getImportDeclarations().length > 0) {
@@ -35409,7 +35427,7 @@ function summariseRepoTree(cwd = process.cwd()) {
35409
35427
  return [...directories.entries()].map(([directory, extensions]) => ({
35410
35428
  directory,
35411
35429
  extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
35412
- total: [...extensions.values()].reduce((sum3, count9) => sum3 + count9, 0)
35430
+ total: [...extensions.values()].reduce((sum3, count10) => sum3 + count10, 0)
35413
35431
  })).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
35414
35432
  (entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
35415
35433
  ).join("\n");
@@ -35437,7 +35455,7 @@ function countByDirectory(files) {
35437
35455
  return directories;
35438
35456
  }
35439
35457
  function formatExtensions(extensions) {
35440
- return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count9]) => `${extension2}(${count9})`).join(", ");
35458
+ return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count10]) => `${extension2}(${count10})`).join(", ");
35441
35459
  }
35442
35460
 
35443
35461
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
@@ -35754,10 +35772,10 @@ function dedentedSource(call) {
35754
35772
  // src/commands/review/highLevel/visitCase.ts
35755
35773
  function visitCase(call, context) {
35756
35774
  if (!context.changed) return [toCase(call, context, void 0)];
35757
- const count9 = changedLines(call, context.changed);
35758
- if (count9 === 0) return [];
35775
+ const count10 = changedLines(call, context.changed);
35776
+ if (count10 === 0) return [];
35759
35777
  const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
35760
- return [toCase(call, context, count9 === lines2 ? "added" : "modified")];
35778
+ return [toCase(call, context, count10 === lines2 ? "added" : "modified")];
35761
35779
  }
35762
35780
  function toCase(call, context, change) {
35763
35781
  const line = call.getStartLineNumber();
@@ -35771,10 +35789,10 @@ function toCase(call, context, change) {
35771
35789
  };
35772
35790
  }
35773
35791
  function changedLines(call, changed) {
35774
- let count9 = 0;
35792
+ let count10 = 0;
35775
35793
  for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
35776
- if (changed.has(line)) count9++;
35777
- return count9;
35794
+ if (changed.has(line)) count10++;
35795
+ return count10;
35778
35796
  }
35779
35797
 
35780
35798
  // src/commands/review/highLevel/extractTestHierarchy.ts
@@ -35934,8 +35952,8 @@ function countEvidence(body) {
35934
35952
  0
35935
35953
  );
35936
35954
  }
35937
- function plural(count9, noun) {
35938
- return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
35955
+ function plural(count10, noun) {
35956
+ return `${count10} ${noun}${count10 === 1 ? "" : "s"}`;
35939
35957
  }
35940
35958
  function checkUiEvidence(body, changedFiles2, uiPaths) {
35941
35959
  if (uiPaths.length === 0)
@@ -36207,34 +36225,23 @@ function gatherHighLevelSubject(prNumber, force) {
36207
36225
  }
36208
36226
 
36209
36227
  // src/commands/review/highLevel/openHighLevelOverlay.ts
36210
- import { randomUUID as randomUUID19 } from "crypto";
36228
+ import { randomUUID as randomUUID20 } from "crypto";
36211
36229
 
36212
- // src/commands/review/highLevel/indexHighLevelTests.ts
36213
- function indexHighLevelTests(files) {
36214
- const index2 = /* @__PURE__ */ new Map();
36215
- const walk2 = (path109, node, parents) => {
36216
- const title = [...parents, node.name];
36217
- if (node.kind === "it")
36218
- index2.set(node.id, { path: path109, line: node.line, title });
36219
- else for (const child of node.children) walk2(path109, child, title);
36220
- };
36221
- for (const file of files)
36222
- for (const node of file.tests) walk2(file.path, node, []);
36223
- return index2;
36230
+ // src/commands/review/highLevel/highLevelReviewEvent.ts
36231
+ function highLevelReviewEvent(decision) {
36232
+ if (decision.reviewEvent) return decision.reviewEvent;
36233
+ return decision.decision === "approve" ? "APPROVE" : "REQUEST_CHANGES";
36224
36234
  }
36225
36235
 
36226
36236
  // src/commands/review/highLevel/buildHighLevelRecord.ts
36227
- function testComments(notes, tests) {
36228
- return notes.flatMap(({ id, comment: comment3 }) => {
36229
- const test = tests.get(id);
36230
- const trimmed = comment3.trim();
36231
- return test && trimmed ? [{ id, ...test, comment: trimmed }] : [];
36232
- });
36233
- }
36234
- function toItem2(check2, decision, tests) {
36237
+ var VERDICTS = {
36238
+ APPROVE: "approve",
36239
+ COMMENT: "comment",
36240
+ REQUEST_CHANGES: "request-changes"
36241
+ };
36242
+ function toItem2(check2, decision) {
36235
36243
  const ticked = decision.checklist?.find((entry) => entry.id === check2.id);
36236
36244
  const comment3 = ticked?.comment?.trim();
36237
- const notes = testComments(ticked?.notes ?? [], tests);
36238
36245
  return {
36239
36246
  id: check2.id,
36240
36247
  kind: check2.kind,
@@ -36242,44 +36249,24 @@ function toItem2(check2, decision, tests) {
36242
36249
  status: check2.status,
36243
36250
  reason: check2.reason,
36244
36251
  ticked: ticked?.ticked ?? check2.status === "pass",
36245
- ...comment3 ? { comment: comment3 } : {},
36246
- ...notes.length > 0 ? { testComments: notes } : {}
36252
+ ...comment3 ? { comment: comment3 } : {}
36247
36253
  };
36248
36254
  }
36249
36255
  function buildHighLevelRecord(subject, decision) {
36250
36256
  const { checks: checks2, repo, prNumber, headRef, headSha } = subject;
36251
- const tests = indexHighLevelTests(subject.tests);
36257
+ const reviewComments = decision.reviewComments ?? [];
36252
36258
  return {
36253
36259
  repo,
36254
36260
  prNumber,
36255
36261
  headRef,
36256
36262
  headSha,
36257
- verdict: decision.decision === "approve" ? "approve" : "request-changes",
36263
+ verdict: VERDICTS[highLevelReviewEvent(decision)],
36258
36264
  reviewedAt: (/* @__PURE__ */ new Date()).toISOString(),
36259
- items: checks2.map((check2) => toItem2(check2, decision, tests))
36265
+ items: checks2.map((check2) => toItem2(check2, decision)),
36266
+ ...reviewComments.length > 0 ? { reviewComments } : {}
36260
36267
  };
36261
36268
  }
36262
36269
 
36263
- // src/commands/review/highLevel/formatHighLevelApprovalBody.ts
36264
- function indentContinuation(text18) {
36265
- return text18.replace(/\n/g, "\n ");
36266
- }
36267
- function formatTestComment(note) {
36268
- const title = note.title.join(" \u203A ");
36269
- return `- \`${note.path}:${note.line}\` ${title}: ${indentContinuation(note.comment)}`;
36270
- }
36271
- function formatItem(item) {
36272
- const notes = item.testComments ?? [];
36273
- if (!item.comment && notes.length === 0) return void 0;
36274
- const sections = [`**${item.title}**`];
36275
- if (item.comment) sections.push(item.comment);
36276
- if (notes.length > 0) sections.push(notes.map(formatTestComment).join("\n"));
36277
- return sections.join("\n\n");
36278
- }
36279
- function formatHighLevelApprovalBody(items2) {
36280
- return items2.map(formatItem).filter((section2) => section2 !== void 0).join("\n\n");
36281
- }
36282
-
36283
36270
  // src/commands/review/highLevel/highLevelChangedFileCount.ts
36284
36271
  function highLevelChangedFileCount(structure) {
36285
36272
  return structure.added + structure.removed + structure.modified;
@@ -36342,13 +36329,6 @@ function highLevelPreviewPayload(subject) {
36342
36329
  };
36343
36330
  }
36344
36331
 
36345
- // src/commands/review/highLevel/postHighLevelApproval.ts
36346
- function postHighLevelApproval(repo, prNumber, body) {
36347
- const args = ["pr", "review", String(prNumber), "--repo", repo, "--approve"];
36348
- if (body) args.push("--body", body);
36349
- runGhOrThrow(args, `Could not approve ${repo}#${prNumber}`);
36350
- }
36351
-
36352
36332
  // src/commands/review/highLevel/saveHighLevelReview.ts
36353
36333
  import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync38 } from "fs";
36354
36334
  import { dirname as dirname38 } from "path";
@@ -36360,13 +36340,205 @@ function saveHighLevelReview(record) {
36360
36340
  return path109;
36361
36341
  }
36362
36342
 
36343
+ // src/commands/review/highLevel/formatReviewComment.ts
36344
+ function formatReviewComment({
36345
+ path: path109,
36346
+ startLine,
36347
+ endLine,
36348
+ quote,
36349
+ note
36350
+ }) {
36351
+ const lines2 = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
36352
+ return `- \`${path109}:${lines2}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
36353
+ }
36354
+
36355
+ // src/commands/review/highLevel/formatHighLevelReviewBody.ts
36356
+ function formatItem(item) {
36357
+ if (!item.comment) return void 0;
36358
+ return `**${item.title}**
36359
+
36360
+ ${item.comment}`;
36361
+ }
36362
+ function formatHighLevelReviewBody(items2, reviewComments = []) {
36363
+ const sections = items2.map(formatItem).filter((section2) => section2 !== void 0);
36364
+ if (reviewComments.length > 0)
36365
+ sections.push(
36366
+ `**Comments**
36367
+
36368
+ ${reviewComments.map(formatReviewComment).join("\n")}`
36369
+ );
36370
+ return sections.join("\n\n");
36371
+ }
36372
+
36373
+ // src/commands/review/highLevel/postHighLevelReview.ts
36374
+ function toLineComment(comment3) {
36375
+ const side = comment3.side ?? "RIGHT";
36376
+ const startSide = comment3.startSide ?? "RIGHT";
36377
+ const single = comment3.startLine === comment3.endLine && startSide === side;
36378
+ return {
36379
+ path: comment3.path,
36380
+ body: comment3.note,
36381
+ line: comment3.endLine,
36382
+ side,
36383
+ ...single ? {} : { start_line: comment3.startLine, start_side: startSide }
36384
+ };
36385
+ }
36386
+ function postHighLevelReview(repo, prNumber, { event, body, comments: comments3 }) {
36387
+ const payload = {
36388
+ event,
36389
+ ...body ? { body } : {},
36390
+ comments: comments3.map(toLineComment)
36391
+ };
36392
+ runGhOrThrow(
36393
+ [
36394
+ "api",
36395
+ `repos/${repo}/pulls/${prNumber}/reviews`,
36396
+ "--method",
36397
+ "POST",
36398
+ "--input",
36399
+ "-"
36400
+ ],
36401
+ `Could not review ${repo}#${prNumber}`,
36402
+ JSON.stringify(payload)
36403
+ );
36404
+ }
36405
+
36406
+ // src/commands/review/highLevel/patchHunkLines.ts
36407
+ var HUNK_HEADER2 = /^@@ -(\d+)(?:,\d+)? \+(\d+)/;
36408
+ function patchHunkLines(patch2) {
36409
+ const hunks = [];
36410
+ let current;
36411
+ let left = 0;
36412
+ let right = 0;
36413
+ for (const line of patch2.split("\n")) {
36414
+ const header = HUNK_HEADER2.exec(line);
36415
+ if (header) {
36416
+ current = { LEFT: /* @__PURE__ */ new Set(), RIGHT: /* @__PURE__ */ new Set() };
36417
+ hunks.push(current);
36418
+ left = Number(header[1]);
36419
+ right = Number(header[2]);
36420
+ } else if (!current || line.startsWith("\\")) continue;
36421
+ else if (line.startsWith("+")) current.RIGHT.add(right++);
36422
+ else if (line.startsWith("-")) current.LEFT.add(left++);
36423
+ else {
36424
+ current.LEFT.add(left++);
36425
+ current.RIGHT.add(right++);
36426
+ }
36427
+ }
36428
+ return hunks;
36429
+ }
36430
+
36431
+ // src/commands/review/highLevel/splitHighLevelReviewComments.ts
36432
+ function inHunk(comment3, hunk) {
36433
+ return hunk[comment3.startSide ?? "RIGHT"].has(comment3.startLine) && hunk[comment3.side ?? "RIGHT"].has(comment3.endLine);
36434
+ }
36435
+ function splitHighLevelReviewComments(comments3, files) {
36436
+ const hunks = new Map(
36437
+ files.map((file) => [file.path, patchHunkLines(file.patch ?? "")])
36438
+ );
36439
+ const split = { lineLevel: [], remainder: [] };
36440
+ for (const comment3 of comments3) {
36441
+ const onDiff = hunks.get(comment3.path)?.some((hunk) => inHunk(comment3, hunk));
36442
+ (onDiff ? split.lineLevel : split.remainder).push(comment3);
36443
+ }
36444
+ return split;
36445
+ }
36446
+
36447
+ // src/commands/review/highLevel/splitQueuedComments.ts
36448
+ function splitQueuedComments(record) {
36449
+ const queued = record.reviewComments ?? [];
36450
+ if (queued.length === 0) return { lineLevel: [], remainder: [] };
36451
+ try {
36452
+ const files = fetchHighLevelFiles(record.prNumber, record.repo);
36453
+ return splitHighLevelReviewComments(queued, files);
36454
+ } catch (error) {
36455
+ console.error(
36456
+ `Could not read the PR diff, so every comment goes in the PR-level body: ${error.message}`
36457
+ );
36458
+ return { lineLevel: [], remainder: queued };
36459
+ }
36460
+ }
36461
+
36462
+ // src/commands/review/highLevel/previewHighLevelReview.ts
36463
+ import { randomUUID as randomUUID19 } from "crypto";
36464
+
36465
+ // src/commands/review/highLevel/formatHighLevelReviewPreview.ts
36466
+ function formatHighLevelReviewPreview(lineLevel, body) {
36467
+ if (lineLevel.length === 0) return body;
36468
+ const sections = [
36469
+ `### Line-level comments
36470
+
36471
+ ${lineLevel.map(formatReviewComment).join("\n")}`
36472
+ ];
36473
+ if (body) sections.push(`### PR-level body
36474
+
36475
+ ${body}`);
36476
+ return sections.join("\n\n");
36477
+ }
36478
+
36479
+ // src/commands/review/highLevel/previewHighLevelReview.ts
36480
+ var LABELS = {
36481
+ APPROVE: "Approve",
36482
+ COMMENT: "Comment on",
36483
+ REQUEST_CHANGES: "Request changes on"
36484
+ };
36485
+ async function previewHighLevelReview(sessionId, record, submission) {
36486
+ const decision = await awaitPreviewApproval(
36487
+ "Review",
36488
+ {
36489
+ sessionId,
36490
+ requestId: randomUUID19(),
36491
+ title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
36492
+ body: formatHighLevelReviewPreview(submission.comments, submission.body),
36493
+ prNumber: record.prNumber,
36494
+ kind: "pr-comment"
36495
+ },
36496
+ { rejectIsOutcome: true }
36497
+ );
36498
+ return decision.decision === "approve" && !decision.dismissed;
36499
+ }
36500
+
36501
+ // src/commands/review/highLevel/submitHighLevelReview.ts
36502
+ var EVENTS = {
36503
+ approve: "APPROVE",
36504
+ comment: "COMMENT",
36505
+ "request-changes": "REQUEST_CHANGES"
36506
+ };
36507
+ function post(record, submission) {
36508
+ const target = `${record.repo}#${record.prNumber}`;
36509
+ try {
36510
+ postHighLevelReview(record.repo, record.prNumber, submission);
36511
+ } catch (error) {
36512
+ console.error(
36513
+ `Could not post the review to ${target}: ${error.message}`
36514
+ );
36515
+ process.exit(1);
36516
+ }
36517
+ console.log(`Review (${submission.event}) posted to ${target}.`);
36518
+ }
36519
+ async function submitHighLevelReview(sessionId, record) {
36520
+ const event = EVENTS[record.verdict];
36521
+ const { lineLevel, remainder } = splitQueuedComments(record);
36522
+ const submission = {
36523
+ event,
36524
+ body: formatHighLevelReviewBody(record.items, remainder),
36525
+ comments: lineLevel
36526
+ };
36527
+ if (event === "APPROVE" && !record.reviewComments?.length)
36528
+ return post(record, submission);
36529
+ const hasContent = submission.body || lineLevel.length > 0;
36530
+ if (hasContent && await previewHighLevelReview(sessionId, record, submission))
36531
+ return post(record, submission);
36532
+ console.log("Nothing was posted to GitHub.");
36533
+ }
36534
+
36363
36535
  // src/commands/review/highLevel/openHighLevelOverlay.ts
36364
36536
  async function openHighLevelOverlay(sessionId, subject) {
36365
36537
  const decision = await awaitPreviewApproval(
36366
36538
  "High-level review",
36367
36539
  {
36368
36540
  sessionId,
36369
- requestId: randomUUID19(),
36541
+ requestId: randomUUID20(),
36370
36542
  title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
36371
36543
  body: JSON.stringify(highLevelPreviewPayload(subject)),
36372
36544
  prNumber: subject.prNumber,
@@ -36382,26 +36554,9 @@ async function openHighLevelOverlay(sessionId, subject) {
36382
36554
  const record = buildHighLevelRecord(subject, decision);
36383
36555
  saveHighLevelReview(record);
36384
36556
  console.log(`Verdict: ${record.verdict}`);
36385
- if (record.verdict === "approve") approveOnGitHub(record);
36386
- else console.log("Nothing was posted to GitHub.");
36557
+ await submitHighLevelReview(sessionId, record);
36387
36558
  return record;
36388
36559
  }
36389
- function approveOnGitHub(record) {
36390
- const target = `${record.repo}#${record.prNumber}`;
36391
- try {
36392
- postHighLevelApproval(
36393
- record.repo,
36394
- record.prNumber,
36395
- formatHighLevelApprovalBody(record.items)
36396
- );
36397
- } catch (error) {
36398
- console.error(
36399
- `Could not post the approval to ${target}: ${error.message}`
36400
- );
36401
- process.exit(1);
36402
- }
36403
- console.log(`Approval posted to ${target}.`);
36404
- }
36405
36560
 
36406
36561
  // src/commands/review/highLevel/printHighLevelChecklist.ts
36407
36562
  import chalk241 from "chalk";
@@ -36755,7 +36910,7 @@ function partitionFindings(findings) {
36755
36910
 
36756
36911
  // src/commands/review/buildDiffLineIndex.ts
36757
36912
  var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
36758
- var HUNK_HEADER2 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
36913
+ var HUNK_HEADER3 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
36759
36914
  function buildDiffLineIndex(diff3) {
36760
36915
  const index2 = /* @__PURE__ */ new Map();
36761
36916
  let currentFile = null;
@@ -36766,7 +36921,7 @@ function buildDiffLineIndex(diff3) {
36766
36921
  currentFile = fileMatch[1] === "/dev/null" ? null : fileMatch[1];
36767
36922
  continue;
36768
36923
  }
36769
- const hunkMatch = line.match(HUNK_HEADER2);
36924
+ const hunkMatch = line.match(HUNK_HEADER3);
36770
36925
  if (hunkMatch) {
36771
36926
  newLine = Number(hunkMatch[1]);
36772
36927
  continue;
@@ -38202,7 +38357,7 @@ async function runReviewPipeline(paths, options2) {
38202
38357
 
38203
38358
  // src/commands/review/annotateDiffWithLineNumbers.ts
38204
38359
  var FILE_HEADER2 = /^\+\+\+ (?:b\/)?(.+)$/;
38205
- var HUNK_HEADER3 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
38360
+ var HUNK_HEADER4 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
38206
38361
  var GUTTER_WIDTH = 6;
38207
38362
  function gutter(lineNumber) {
38208
38363
  const label2 = lineNumber === null ? "" : String(lineNumber);
@@ -38216,7 +38371,7 @@ function annotateDiffWithLineNumbers(diff3) {
38216
38371
  inFile = true;
38217
38372
  return gutter(null) + line;
38218
38373
  }
38219
- const hunkMatch = line.match(HUNK_HEADER3);
38374
+ const hunkMatch = line.match(HUNK_HEADER4);
38220
38375
  if (hunkMatch) {
38221
38376
  newLine = Number(hunkMatch[1]);
38222
38377
  return gutter(null) + line;
@@ -38390,9 +38545,9 @@ function setupReviewDir(repoRoot2, context, force) {
38390
38545
  console.log(`Review folder: ${paths.reviewDir}`);
38391
38546
  return paths;
38392
38547
  }
38393
- function logPriorComments(count9) {
38394
- if (count9 === 0) return;
38395
- console.log(`Including ${count9} prior review comment(s) in request.md.`);
38548
+ function logPriorComments(count10) {
38549
+ if (count10 === 0) return;
38550
+ console.log(`Including ${count10} prior review comment(s) in request.md.`);
38396
38551
  }
38397
38552
 
38398
38553
  // src/commands/review/gatherContext.ts
@@ -38932,7 +39087,7 @@ function addReviewModeOptions(command) {
38932
39087
  "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"
38933
39088
  ).option(
38934
39089
  "--high-level",
38935
- "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"
39090
+ "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"
38936
39091
  ).option(
38937
39092
  "--configure",
38938
39093
  "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"
@@ -39316,16 +39471,16 @@ function filterToSql(filter) {
39316
39471
  }
39317
39472
 
39318
39473
  // src/commands/seq/fetchSeqData.ts
39319
- function buildDataParams(filter, count9, from, to) {
39474
+ function buildDataParams(filter, count10, from, to) {
39320
39475
  const sqlFilter = filterToSql(filter);
39321
- const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count9}`;
39476
+ const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count10}`;
39322
39477
  const params = new URLSearchParams({ q: sql29 });
39323
39478
  if (from) params.set("rangeStartUtc", from);
39324
39479
  if (to) params.set("rangeEndUtc", to);
39325
39480
  return params;
39326
39481
  }
39327
- async function fetchSeqData(conn, filter, count9, from, to) {
39328
- const params = buildDataParams(filter, count9, from, to);
39482
+ async function fetchSeqData(conn, filter, count10, from, to) {
39483
+ const params = buildDataParams(filter, count10, from, to);
39329
39484
  const response = await fetchSeq(conn, "/api/data", params);
39330
39485
  const data = await response.json();
39331
39486
  return mapDataToEvents(data);
@@ -39492,12 +39647,12 @@ function resolveConnection2(name) {
39492
39647
  async function seqQuery(filter, options2) {
39493
39648
  rejectTimestampFilter(filter);
39494
39649
  const conn = resolveConnection2(options2.connection);
39495
- const count9 = Number.parseInt(options2.count ?? "1000", 10);
39650
+ const count10 = Number.parseInt(options2.count ?? "1000", 10);
39496
39651
  const from = options2.from ? parseRelativeTime(options2.from) : void 0;
39497
39652
  const to = options2.to ? parseRelativeTime(options2.to) : void 0;
39498
- const events = from || to ? await fetchSeqData(conn, filter, count9, from, to) : await fetchSeqEvents(
39653
+ const events = from || to ? await fetchSeqData(conn, filter, count10, from, to) : await fetchSeqEvents(
39499
39654
  conn,
39500
- new URLSearchParams({ filter, count: String(count9) })
39655
+ new URLSearchParams({ filter, count: String(count10) })
39501
39656
  );
39502
39657
  if (events.length === 0) {
39503
39658
  console.log(chalk252.yellow("No events found."));
@@ -39513,10 +39668,10 @@ async function seqQuery(filter, options2) {
39513
39668
  }
39514
39669
  console.log(chalk252.dim(`
39515
39670
  ${events.length} events`));
39516
- if (events.length >= count9) {
39671
+ if (events.length >= count10) {
39517
39672
  console.log(
39518
39673
  chalk252.yellow(
39519
- `Results limited to ${count9}. Use --count to retrieve more.`
39674
+ `Results limited to ${count10}. Use --count to retrieve more.`
39520
39675
  )
39521
39676
  );
39522
39677
  }
@@ -39562,7 +39717,7 @@ function registerSeq(program2) {
39562
39717
  }
39563
39718
 
39564
39719
  // src/commands/show.ts
39565
- import { randomUUID as randomUUID20 } from "crypto";
39720
+ import { randomUUID as randomUUID21 } from "crypto";
39566
39721
 
39567
39722
  // src/commands/sessions/shared/sendShowPreview.ts
39568
39723
  async function sendShowPreview(request) {
@@ -39614,7 +39769,7 @@ async function show3(options2) {
39614
39769
  try {
39615
39770
  await sendShowPreview({
39616
39771
  sessionId,
39617
- requestId: randomUUID20(),
39772
+ requestId: randomUUID21(),
39618
39773
  title: options2.title ?? "Show",
39619
39774
  body
39620
39775
  });
@@ -39689,7 +39844,7 @@ function readSlackParts(files) {
39689
39844
  }
39690
39845
 
39691
39846
  // src/commands/slack/reviewProposedSlackMessage.ts
39692
- import { randomUUID as randomUUID21 } from "crypto";
39847
+ import { randomUUID as randomUUID22 } from "crypto";
39693
39848
  async function reviewProposedSlackMessage(target, body, workingPath) {
39694
39849
  const sessionId = process.env.ASSIST_SESSION_ID;
39695
39850
  if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
@@ -39699,7 +39854,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
39699
39854
  part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
39700
39855
  {
39701
39856
  sessionId,
39702
- requestId: randomUUID21(),
39857
+ requestId: randomUUID22(),
39703
39858
  title: part ? `${destination} (${part.index}/${part.total})` : destination,
39704
39859
  body,
39705
39860
  prNumber: null,
@@ -41283,10 +41438,10 @@ function closesBlock(trimmed, from) {
41283
41438
  }
41284
41439
  function csharpHeaderLineCount(content) {
41285
41440
  const lines2 = content.split("\n");
41286
- let count9 = 0;
41441
+ let count10 = 0;
41287
41442
  let inBlock = false;
41288
- while (count9 < lines2.length) {
41289
- const trimmed = lines2[count9].trim();
41443
+ while (count10 < lines2.length) {
41444
+ const trimmed = lines2[count10].trim();
41290
41445
  if (inBlock) {
41291
41446
  inBlock = !closesBlock(trimmed, 0);
41292
41447
  } else if (trimmed.startsWith("/*")) {
@@ -41294,9 +41449,9 @@ function csharpHeaderLineCount(content) {
41294
41449
  } else if (trimmed !== "" && !trimmed.startsWith("//")) {
41295
41450
  break;
41296
41451
  }
41297
- count9++;
41452
+ count10++;
41298
41453
  }
41299
- return count9;
41454
+ return count10;
41300
41455
  }
41301
41456
 
41302
41457
  // src/commands/verify/blockCodeComments/collectCsharpComments.ts
@@ -41420,7 +41575,7 @@ function collectFileComments(file, lines2, project) {
41420
41575
 
41421
41576
  // src/commands/verify/blockCodeComments/parseDiffAddedLines.ts
41422
41577
  var FILE_HEADER3 = /^\+\+\+ (?:b\/)?(.+)$/;
41423
- var HUNK_HEADER4 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
41578
+ var HUNK_HEADER5 = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
41424
41579
  function parseDiffAddedLines(diff3) {
41425
41580
  const added = /* @__PURE__ */ new Map();
41426
41581
  let currentFile = null;
@@ -41432,7 +41587,7 @@ function parseDiffAddedLines(diff3) {
41432
41587
  currentFile = file === "/dev/null" ? null : file;
41433
41588
  continue;
41434
41589
  }
41435
- const hunkMatch = line.match(HUNK_HEADER4);
41590
+ const hunkMatch = line.match(HUNK_HEADER5);
41436
41591
  if (hunkMatch) {
41437
41592
  newLine = Number(hunkMatch[1]);
41438
41593
  continue;
@@ -42071,9 +42226,9 @@ async function watchLoop() {
42071
42226
  }
42072
42227
 
42073
42228
  // src/commands/watch/readRecentCommits.ts
42074
- function readRecentCommits(count9 = 10, cwd) {
42229
+ function readRecentCommits(count10 = 10, cwd) {
42075
42230
  const output = runGit3(
42076
- ["log", `-${count9}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
42231
+ ["log", `-${count10}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
42077
42232
  cwd
42078
42233
  );
42079
42234
  if (!output) return [];
@@ -42541,10 +42696,10 @@ function consumeSimulatedDivergence(cwd) {
42541
42696
  }
42542
42697
 
42543
42698
  // src/commands/watch/detectMovement.ts
42544
- function detectMovement(from, to, count9) {
42699
+ function detectMovement(from, to, count10) {
42545
42700
  if (from === to) return void 0;
42546
- if (!Number.isFinite(count9) || count9 <= 0) return void 0;
42547
- return { from, to, count: count9 };
42701
+ if (!Number.isFinite(count10) || count10 <= 0) return void 0;
42702
+ return { from, to, count: count10 };
42548
42703
  }
42549
42704
 
42550
42705
  // src/commands/watch/readMovement.ts
@@ -42552,8 +42707,8 @@ function readMovement(cwd) {
42552
42707
  try {
42553
42708
  const from = runGit3(["rev-parse", "@"], cwd);
42554
42709
  const to = runGit3(["rev-parse", "@{u}"], cwd);
42555
- const count9 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42556
- return detectMovement(from, to, count9);
42710
+ const count10 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42711
+ return detectMovement(from, to, count10);
42557
42712
  } catch {
42558
42713
  return void 0;
42559
42714
  }
@@ -43477,9 +43632,9 @@ async function drainDaemon(options2 = {}) {
43477
43632
  return;
43478
43633
  }
43479
43634
  }
43480
- const count9 = await requestDrain(socket, lines2);
43635
+ const count10 = await requestDrain(socket, lines2);
43481
43636
  socket.destroy();
43482
- console.log(`Drained ${count9} session(s)`);
43637
+ console.log(`Drained ${count10} session(s)`);
43483
43638
  }
43484
43639
  function reportLive(live) {
43485
43640
  console.log(`${live.length} live session(s) would be closed:`);
@@ -43544,11 +43699,11 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43544
43699
  inFlight2 = true;
43545
43700
  try {
43546
43701
  const before = JSON.stringify(readRepoConfigCache());
43547
- const count9 = await refreshRepoConfigCache();
43702
+ const count10 = await refreshRepoConfigCache();
43548
43703
  if (failing) daemonLog("repo config cache poll recovered");
43549
43704
  failing = false;
43550
43705
  if (JSON.stringify(readRepoConfigCache()) !== before)
43551
- daemonLog(`repo config cache updated (${count9} repos)`);
43706
+ daemonLog(`repo config cache updated (${count10} repos)`);
43552
43707
  } catch (error) {
43553
43708
  if (!failing)
43554
43709
  daemonLog(
@@ -43567,8 +43722,8 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43567
43722
  // src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
43568
43723
  async function refreshRepoConfigCacheOnStart() {
43569
43724
  try {
43570
- const count9 = await refreshRepoConfigCache();
43571
- daemonLog(`repo config cache refreshed (${count9} repos)`);
43725
+ const count10 = await refreshRepoConfigCache();
43726
+ daemonLog(`repo config cache refreshed (${count10} repos)`);
43572
43727
  } catch (error) {
43573
43728
  daemonLog(
43574
43729
  `repo config cache refresh failed; keeping the last snapshot: ${String(error)}`
@@ -44127,7 +44282,7 @@ var ClientHub = class extends Set {
44127
44282
  };
44128
44283
 
44129
44284
  // src/commands/sessions/daemon/createSession.ts
44130
- import { randomUUID as randomUUID22 } from "crypto";
44285
+ import { randomUUID as randomUUID23 } from "crypto";
44131
44286
 
44132
44287
  // src/commands/sessions/daemon/sessionBase.ts
44133
44288
  function sessionBase(id, status2) {
@@ -44350,7 +44505,7 @@ function spawnRun(opts) {
44350
44505
  function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
44351
44506
  if (harness && harness !== "claude")
44352
44507
  return createHarnessSession(id, harness, prompt, cwd, holdPty);
44353
- const claudeSessionId = randomUUID22();
44508
+ const claudeSessionId = randomUUID23();
44354
44509
  return {
44355
44510
  ...sessionBase(id, prompt ? "running" : "waiting"),
44356
44511
  name: `Session ${id}`,
@@ -45401,6 +45556,16 @@ function greetClient(client, sessions, links2) {
45401
45556
  links2.sendNodes(client);
45402
45557
  }
45403
45558
 
45559
+ // src/commands/sessions/daemon/logPrDecision.ts
45560
+ function count9(value) {
45561
+ return Array.isArray(value) ? value.length : 0;
45562
+ }
45563
+ function logPrDecision(id, requestId, d) {
45564
+ daemonLog(
45565
+ `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}`
45566
+ );
45567
+ }
45568
+
45404
45569
  // src/commands/sessions/daemon/decidePrPreview.ts
45405
45570
  function decidePrPreview(sessions, waiters, notify2, d) {
45406
45571
  const id = d.sessionId;
@@ -45412,12 +45577,7 @@ function decidePrPreview(sessions, waiters, notify2, d) {
45412
45577
  );
45413
45578
  return;
45414
45579
  }
45415
- const commentCount = Array.isArray(d.comments) ? d.comments.length : 0;
45416
- const screenshotCount = Array.isArray(d.screenshots) ? d.screenshots.length : 0;
45417
- const checklistCount = Array.isArray(d.checklist) ? d.checklist.length : 0;
45418
- daemonLog(
45419
- `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}`
45420
- );
45580
+ logPrDecision(id, requestId, d);
45421
45581
  const waiter = waiters.get(id);
45422
45582
  if (waiter)
45423
45583
  sendTo(waiter, {
@@ -45434,6 +45594,8 @@ function decidePrPreview(sessions, waiters, notify2, d) {
45434
45594
  autoMerge: d.autoMerge,
45435
45595
  autostart: d.autostart,
45436
45596
  checklist: d.checklist,
45597
+ reviewEvent: d.reviewEvent,
45598
+ reviewComments: d.reviewComments,
45437
45599
  dismissed: d.dismissed
45438
45600
  });
45439
45601
  waiters.delete(id);
@@ -47111,7 +47273,7 @@ function codexRespawnPlan(session) {
47111
47273
  }
47112
47274
 
47113
47275
  // src/commands/sessions/daemon/interactiveRespawnPlan.ts
47114
- import { randomUUID as randomUUID23 } from "crypto";
47276
+ import { randomUUID as randomUUID24 } from "crypto";
47115
47277
 
47116
47278
  // src/commands/sessions/daemon/hasTranscriptOnDisk.ts
47117
47279
  function hasTranscriptOnDisk(session) {
@@ -47138,7 +47300,7 @@ function interactiveRespawnPlan(session, resumes) {
47138
47300
  return null;
47139
47301
  }
47140
47302
  function freshClaudePlan(session, prompt, cwd) {
47141
- const claudeSessionId = randomUUID23();
47303
+ const claudeSessionId = randomUUID24();
47142
47304
  return {
47143
47305
  spawn: () => {
47144
47306
  session.claudeSessionId = claudeSessionId;
@@ -51028,10 +51190,10 @@ async function requestSessionOutput(target) {
51028
51190
  }
51029
51191
 
51030
51192
  // src/commands/sessions/lastLines.ts
51031
- function lastLines(scrollback, count9) {
51193
+ function lastLines(scrollback, count10) {
51032
51194
  const lines2 = stripAnsi(scrollback).split(/\r?\n/);
51033
51195
  if (lines2.at(-1) === "") lines2.pop();
51034
- return lines2.slice(-count9);
51196
+ return lines2.slice(-count10);
51035
51197
  }
51036
51198
 
51037
51199
  // src/commands/sessions/sessionOutput.ts
@@ -51051,14 +51213,14 @@ function resolveTarget3(sessionId, server) {
51051
51213
  return { sessionId };
51052
51214
  }
51053
51215
  async function sessionOutput(sessionId, options2) {
51054
- const count9 = Number.parseInt(options2.lines, 10);
51055
- if (!Number.isInteger(count9) || count9 < 1)
51216
+ const count10 = Number.parseInt(options2.lines, 10);
51217
+ if (!Number.isInteger(count10) || count10 < 1)
51056
51218
  return fail7(`-n must be a positive integer, got ${options2.lines}`);
51057
51219
  const target = resolveTarget3(sessionId, options2.server);
51058
51220
  if (typeof target === "string") return fail7(target);
51059
51221
  try {
51060
51222
  const scrollback = await requestSessionOutput(target);
51061
- for (const line of lastLines(scrollback, count9)) console.log(line);
51223
+ for (const line of lastLines(scrollback, count10)) console.log(line);
51062
51224
  } catch (error) {
51063
51225
  fail7(error instanceof Error ? error.message : String(error));
51064
51226
  }