@staff0rd/assist 0.843.0 → 0.845.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.843.0",
9
+ version: "0.845.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -2153,19 +2153,19 @@ function printMeasureTable(records, totalMs) {
2153
2153
  const nameWidth = Math.max(
2154
2154
  "Command".length,
2155
2155
  "TOTAL".length,
2156
- ...rows.map((row2) => row2.name.length)
2156
+ ...rows.map((row3) => row3.name.length)
2157
2157
  );
2158
2158
  const durationWidth = Math.max(
2159
2159
  "Duration".length,
2160
2160
  formatDuration(totalMs).length,
2161
- ...rows.map((row2) => row2.duration.length)
2161
+ ...rows.map((row3) => row3.duration.length)
2162
2162
  );
2163
2163
  const line = (status2, name, duration) => ` ${status2.padEnd(6)} ${name.padEnd(nameWidth)} ${duration.padStart(durationWidth)}`;
2164
2164
  const separator = ` ${" ".repeat(6)} ${"\u2500".repeat(nameWidth)} ${"\u2500".repeat(durationWidth)}`;
2165
2165
  console.log();
2166
2166
  console.log(line("Status", "Command", "Duration"));
2167
- for (const row2 of rows) {
2168
- console.log(line(row2.status, row2.name, row2.duration));
2167
+ for (const row3 of rows) {
2168
+ console.log(line(row3.status, row3.name, row3.duration));
2169
2169
  }
2170
2170
  console.log(separator);
2171
2171
  console.log(line("", "TOTAL", formatDuration(totalMs)));
@@ -2864,17 +2864,17 @@ async function activity(options2) {
2864
2864
  console.log("Not enough data points to chart.");
2865
2865
  return;
2866
2866
  }
2867
- const total = data.reduce((sum3, d) => sum3 + d.count, 0);
2867
+ const total2 = data.reduce((sum3, d) => sum3 + d.count, 0);
2868
2868
  const activeDays = data.filter((d) => d.count > 0).length;
2869
- console.log(`${total} commits across ${activeDays} active days.`);
2869
+ console.log(`${total2} commits across ${activeDays} active days.`);
2870
2870
  const weekly = /* @__PURE__ */ new Map();
2871
- for (const { date, count: count8 } of data) {
2871
+ for (const { date, count: count9 } of data) {
2872
2872
  const d = new Date(date);
2873
2873
  d.setDate(d.getDate() - d.getDay());
2874
2874
  const weekStart = d.toISOString().slice(0, 10);
2875
- weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count8);
2875
+ weekly.set(weekStart, (weekly.get(weekStart) ?? 0) + count9);
2876
2876
  }
2877
- const weeklyData = [...weekly.entries()].map(([date, count8]) => ({ date, count: count8 })).sort((a, b) => a.date.localeCompare(b.date));
2877
+ const weeklyData = [...weekly.entries()].map(([date, count9]) => ({ date, count: count9 })).sort((a, b) => a.date.localeCompare(b.date));
2878
2878
  const until = data[data.length - 1].date;
2879
2879
  renderLineChart({
2880
2880
  title: "Commit Activity",
@@ -4171,7 +4171,7 @@ async function readAppliedIds(exec3) {
4171
4171
  const rows = await exec3.query(
4172
4172
  `SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
4173
4173
  );
4174
- return new Set(rows.map((row2) => Number(row2.id)));
4174
+ return new Set(rows.map((row3) => Number(row3.id)));
4175
4175
  }
4176
4176
  async function applyMigrations(exec3) {
4177
4177
  await exec3.exec(CREATE_APPLIED_MIGRATIONS);
@@ -4212,7 +4212,7 @@ async function readAppliedIds2(exec3) {
4212
4212
  const rows = await exec3.query(
4213
4213
  `SELECT id FROM ${APPLIED_MIGRATIONS_TABLE} ORDER BY id`
4214
4214
  );
4215
- return rows.map((row2) => Number(row2.id));
4215
+ return rows.map((row3) => Number(row3.id));
4216
4216
  }
4217
4217
  async function getMigrationStatus(exec3) {
4218
4218
  return compareMigrations(await readAppliedIds2(exec3));
@@ -5116,9 +5116,9 @@ function itemColumns(item, origin) {
5116
5116
 
5117
5117
  // src/commands/backlog/insertItem.ts
5118
5118
  async function insertItem(db, item, origin) {
5119
- const [row2] = await db.insert(items).values(itemColumns(item, origin)).returning({ id: items.id });
5120
- if (!row2) throw new Error("Failed to insert backlog item");
5121
- return row2.id;
5119
+ const [row3] = await db.insert(items).values(itemColumns(item, origin)).returning({ id: items.id });
5120
+ if (!row3) throw new Error("Failed to insert backlog item");
5121
+ return row3.id;
5122
5122
  }
5123
5123
 
5124
5124
  // src/commands/backlog/insertPlan.ts
@@ -5223,10 +5223,10 @@ import { asc as asc3, eq as eq3 } from "drizzle-orm";
5223
5223
  // src/commands/backlog/groupByItem.ts
5224
5224
  function groupByItem(rows) {
5225
5225
  const map = /* @__PURE__ */ new Map();
5226
- for (const row2 of rows) {
5227
- const bucket = map.get(row2.itemId);
5228
- if (bucket) bucket.push(row2);
5229
- else map.set(row2.itemId, [row2]);
5226
+ for (const row3 of rows) {
5227
+ const bucket = map.get(row3.itemId);
5228
+ if (bucket) bucket.push(row3);
5229
+ else map.set(row3.itemId, [row3]);
5230
5230
  }
5231
5231
  return map;
5232
5232
  }
@@ -5342,11 +5342,11 @@ function attachSubtasks(item, rel, id) {
5342
5342
  // src/commands/backlog/sumPhaseUsage.ts
5343
5343
  function sumPhaseUsage(usage) {
5344
5344
  return usage.reduce(
5345
- (total, u) => ({
5346
- tokensUp: total.tokensUp + u.tokensUp,
5347
- tokensDown: total.tokensDown + u.tokensDown,
5348
- activeMs: total.activeMs + u.activeMs,
5349
- peakContextPct: Math.max(total.peakContextPct, u.peakContextPct)
5345
+ (total2, u) => ({
5346
+ tokensUp: total2.tokensUp + u.tokensUp,
5347
+ tokensDown: total2.tokensDown + u.tokensDown,
5348
+ activeMs: total2.activeMs + u.activeMs,
5349
+ peakContextPct: Math.max(total2.peakContextPct, u.peakContextPct)
5350
5350
  }),
5351
5351
  { tokensUp: 0, tokensDown: 0, activeMs: 0, peakContextPct: 0 }
5352
5352
  );
@@ -5407,23 +5407,23 @@ function rowToComment(c) {
5407
5407
  function rowToLink(l) {
5408
5408
  return { type: l.type, targetId: l.targetId };
5409
5409
  }
5410
- function assignOptionalColumns(item, row2) {
5411
- if (row2.description != null) item.description = row2.description;
5412
- if (row2.currentPhase != null) item.currentPhase = row2.currentPhase;
5413
- if (row2.jiraKey != null) item.jiraKey = row2.jiraKey;
5414
- if (row2.githubIssue != null) item.githubIssue = row2.githubIssue;
5410
+ function assignOptionalColumns(item, row3) {
5411
+ if (row3.description != null) item.description = row3.description;
5412
+ if (row3.currentPhase != null) item.currentPhase = row3.currentPhase;
5413
+ if (row3.jiraKey != null) item.jiraKey = row3.jiraKey;
5414
+ if (row3.githubIssue != null) item.githubIssue = row3.githubIssue;
5415
5415
  }
5416
- function baseItem(row2) {
5416
+ function baseItem(row3) {
5417
5417
  const item = {
5418
- id: row2.id,
5419
- type: row2.type,
5420
- name: row2.name,
5421
- acceptanceCriteria: JSON.parse(row2.acceptanceCriteria),
5422
- status: row2.status,
5423
- starred: row2.starred,
5424
- origin: row2.origin
5425
- };
5426
- assignOptionalColumns(item, row2);
5418
+ id: row3.id,
5419
+ type: row3.type,
5420
+ name: row3.name,
5421
+ acceptanceCriteria: JSON.parse(row3.acceptanceCriteria),
5422
+ status: row3.status,
5423
+ starred: row3.starred,
5424
+ origin: row3.origin
5425
+ };
5426
+ assignOptionalColumns(item, row3);
5427
5427
  return item;
5428
5428
  }
5429
5429
  function attachComments(item, rel, id) {
@@ -5438,15 +5438,15 @@ function attachPlan(item, rel, id) {
5438
5438
  const phases = rel.phases.get(id) ?? [];
5439
5439
  if (phases.length > 0) item.plan = buildPlan(phases, rel.tasks.get(id) ?? []);
5440
5440
  }
5441
- function rowToItem(row2, rel) {
5442
- const item = baseItem(row2);
5443
- attachComments(item, rel, row2.id);
5444
- attachSubtasks(item, rel, row2.id);
5445
- attachLinks(item, rel, row2.id);
5446
- attachPlan(item, rel, row2.id);
5447
- attachUsage(item, rel, row2.id);
5448
- attachSessions(item, rel, row2.id);
5449
- attachGitRefs(item, rel, row2.id);
5441
+ function rowToItem(row3, rel) {
5442
+ const item = baseItem(row3);
5443
+ attachComments(item, rel, row3.id);
5444
+ attachSubtasks(item, rel, row3.id);
5445
+ attachLinks(item, rel, row3.id);
5446
+ attachPlan(item, rel, row3.id);
5447
+ attachUsage(item, rel, row3.id);
5448
+ attachSessions(item, rel, row3.id);
5449
+ attachGitRefs(item, rel, row3.id);
5450
5450
  return item;
5451
5451
  }
5452
5452
 
@@ -5459,7 +5459,7 @@ async function loadAllItems(orm, origin) {
5459
5459
  rows.map((r) => r.id),
5460
5460
  { includeComments: false, includeTasks: false, includeSubtasks: false }
5461
5461
  );
5462
- return rows.map((row2) => rowToItem(row2, rel));
5462
+ return rows.map((row3) => rowToItem(row3, rel));
5463
5463
  }
5464
5464
 
5465
5465
  // src/commands/backlog/parseBacklogJsonl.ts
@@ -5614,8 +5614,8 @@ async function ensureMigrated(orm, dir, origin) {
5614
5614
  // src/commands/backlog/deleteItem.ts
5615
5615
  import { eq as eq4 } from "drizzle-orm";
5616
5616
  async function deleteItem(orm, id) {
5617
- const [row2] = await orm.delete(items).where(eq4(items.id, id)).returning({ name: items.name });
5618
- return row2?.name;
5617
+ const [row3] = await orm.delete(items).where(eq4(items.id, id)).returning({ name: items.name });
5618
+ return row3?.name;
5619
5619
  }
5620
5620
 
5621
5621
  // src/commands/backlog/findBacklogUp.ts
@@ -5640,13 +5640,13 @@ function findBacklogUp(startDir) {
5640
5640
  // src/commands/backlog/loadItem.ts
5641
5641
  import { eq as eq5 } from "drizzle-orm";
5642
5642
  async function loadItem(orm, id) {
5643
- const [row2] = await orm.select().from(items).where(eq5(items.id, id));
5644
- if (!row2) return void 0;
5643
+ const [row3] = await orm.select().from(items).where(eq5(items.id, id));
5644
+ if (!row3) return void 0;
5645
5645
  const rel = await loadRelations(orm, [id], {
5646
5646
  includeUsage: true,
5647
5647
  includeGitRefs: true
5648
5648
  });
5649
- return rowToItem(row2, rel);
5649
+ return rowToItem(row3, rel);
5650
5650
  }
5651
5651
 
5652
5652
  // src/commands/backlog/saveAllItems.ts
@@ -5706,8 +5706,8 @@ async function updateCurrentPhase(orm, id, phase) {
5706
5706
  // src/commands/backlog/updateStatus.ts
5707
5707
  import { eq as eq10 } from "drizzle-orm";
5708
5708
  async function updateStatus(orm, id, status2) {
5709
- const [row2] = await orm.update(items).set({ status: status2 }).where(eq10(items.id, id)).returning({ name: items.name });
5710
- return row2?.name;
5709
+ const [row3] = await orm.update(items).set({ status: status2 }).where(eq10(items.id, id)).returning({ name: items.name });
5710
+ return row3?.name;
5711
5711
  }
5712
5712
 
5713
5713
  // src/commands/backlog/shared.ts
@@ -6238,9 +6238,9 @@ import chalk43 from "chalk";
6238
6238
  // src/commands/backlog/deleteComment.ts
6239
6239
  import { and as and4, eq as eq14 } from "drizzle-orm";
6240
6240
  async function deleteComment(orm, itemId2, commentId) {
6241
- const [row2] = await orm.select({ type: comments.type }).from(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
6242
- if (!row2) return "not-found";
6243
- if (row2.type === "summary") return "is-summary";
6241
+ const [row3] = await orm.select({ type: comments.type }).from(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
6242
+ if (!row3) return "not-found";
6243
+ if (row3.type === "summary") return "is-summary";
6244
6244
  await orm.delete(comments).where(and4(eq14(comments.id, commentId), eq14(comments.itemId, itemId2)));
6245
6245
  return "deleted";
6246
6246
  }
@@ -6421,10 +6421,10 @@ var IDENTITY_SQL = `
6421
6421
  `;
6422
6422
  async function introspectIdentityColumns(client) {
6423
6423
  const { rows } = await client.query(IDENTITY_SQL);
6424
- return rows.map((row2) => ({
6425
- table: row2.table,
6426
- column: row2.column,
6427
- rawColumn: row2.raw_column
6424
+ return rows.map((row3) => ({
6425
+ table: row3.table,
6426
+ column: row3.column,
6427
+ rawColumn: row3.raw_column
6428
6428
  }));
6429
6429
  }
6430
6430
  function resyncIdentitySql(col) {
@@ -6478,10 +6478,10 @@ async function importBacklog(file, options2 = {}) {
6478
6478
  return;
6479
6479
  }
6480
6480
  await restore(client, parsed);
6481
- const total = incoming.reduce((sum3, n) => sum3 + n, 0);
6481
+ const total2 = incoming.reduce((sum3, n) => sum3 + n, 0);
6482
6482
  console.error(
6483
6483
  chalk45.green(
6484
- `Imported backlog: ${total} rows restored across ${tables.length} tables.`
6484
+ `Imported backlog: ${total2} rows restored across ${tables.length} tables.`
6485
6485
  )
6486
6486
  );
6487
6487
  });
@@ -6700,8 +6700,8 @@ import chalk49 from "chalk";
6700
6700
  import chalk48 from "chalk";
6701
6701
  import { count, eq as eq17 } from "drizzle-orm";
6702
6702
  async function resolveInsertPosition(orm, itemId2, position) {
6703
- const [row2] = await orm.select({ cnt: count() }).from(planPhases).where(eq17(planPhases.itemId, itemId2));
6704
- const phaseCount = row2?.cnt ?? 0;
6703
+ const [row3] = await orm.select({ cnt: count() }).from(planPhases).where(eq17(planPhases.itemId, itemId2));
6704
+ const phaseCount = row3?.cnt ?? 0;
6705
6705
  if (position === void 0) return phaseCount;
6706
6706
  const pos = Number.parseInt(position, 10);
6707
6707
  if (pos < 1 || pos > phaseCount + 1) {
@@ -9743,24 +9743,24 @@ function phaseUsageTotals(orm) {
9743
9743
  }
9744
9744
 
9745
9745
  // src/commands/backlog/rowToItemSummary.ts
9746
- function rowToItemSummary(row2) {
9746
+ function rowToItemSummary(row3) {
9747
9747
  return {
9748
- id: row2.id,
9749
- origin: row2.origin,
9750
- type: row2.type,
9751
- name: row2.name,
9752
- status: row2.status,
9753
- starred: row2.starred,
9754
- jiraKey: row2.jiraKey ?? void 0,
9755
- githubIssue: row2.githubIssue ?? void 0,
9756
- currentPhase: row2.currentPhase ?? void 0,
9757
- totalPhases: (row2.planPhaseCount || 1) + 1,
9758
- incompleteSubtasks: row2.incompleteSubtasks ?? 0,
9759
- usageTotal: row2.tokensUp == null ? void 0 : {
9760
- tokensUp: Number(row2.tokensUp),
9761
- tokensDown: Number(row2.tokensDown),
9762
- activeMs: Number(row2.activeMs),
9763
- peakContextPct: Number(row2.peakContextPct ?? 0)
9748
+ id: row3.id,
9749
+ origin: row3.origin,
9750
+ type: row3.type,
9751
+ name: row3.name,
9752
+ status: row3.status,
9753
+ starred: row3.starred,
9754
+ jiraKey: row3.jiraKey ?? void 0,
9755
+ githubIssue: row3.githubIssue ?? void 0,
9756
+ currentPhase: row3.currentPhase ?? void 0,
9757
+ totalPhases: (row3.planPhaseCount || 1) + 1,
9758
+ incompleteSubtasks: row3.incompleteSubtasks ?? 0,
9759
+ usageTotal: row3.tokensUp == null ? void 0 : {
9760
+ tokensUp: Number(row3.tokensUp),
9761
+ tokensDown: Number(row3.tokensDown),
9762
+ activeMs: Number(row3.activeMs),
9763
+ peakContextPct: Number(row3.peakContextPct ?? 0)
9764
9764
  }
9765
9765
  };
9766
9766
  }
@@ -10150,8 +10150,8 @@ import chalk84 from "chalk";
10150
10150
  // src/commands/backlog/updateStarred.ts
10151
10151
  import { eq as eq24 } from "drizzle-orm";
10152
10152
  async function updateStarred(orm, id, starred) {
10153
- const [row2] = await orm.update(items).set({ starred }).where(eq24(items.id, id)).returning({ name: items.name });
10154
- return row2?.name;
10153
+ const [row3] = await orm.update(items).set({ starred }).where(eq24(items.id, id)).returning({ name: items.name });
10154
+ return row3?.name;
10155
10155
  }
10156
10156
 
10157
10157
  // src/commands/backlog/setStarred.ts
@@ -10313,8 +10313,8 @@ async function updateSubtask(orm, itemId2, idx, fields) {
10313
10313
  if (fields.title !== void 0) set.title = fields.title;
10314
10314
  if (fields.description !== void 0) set.description = fields.description;
10315
10315
  if (fields.status !== void 0) set.status = fields.status;
10316
- const [row2] = await orm.update(itemSubtasks).set(set).where(and9(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10317
- return row2?.title;
10316
+ const [row3] = await orm.update(itemSubtasks).set(set).where(and9(eq26(itemSubtasks.itemId, itemId2), eq26(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10317
+ return row3?.title;
10318
10318
  }
10319
10319
 
10320
10320
  // src/commands/backlog/validSubtaskStatuses.ts
@@ -10370,8 +10370,8 @@ import chalk93 from "chalk";
10370
10370
  // src/commands/backlog/deleteSubtask.ts
10371
10371
  import { and as and10, asc as asc6, eq as eq27 } from "drizzle-orm";
10372
10372
  async function deleteSubtask(orm, itemId2, idx) {
10373
- const [row2] = await orm.delete(itemSubtasks).where(and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10374
- if (!row2) return void 0;
10373
+ const [row3] = await orm.delete(itemSubtasks).where(and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10374
+ if (!row3) return void 0;
10375
10375
  const remaining = await orm.select({ idx: itemSubtasks.idx }).from(itemSubtasks).where(eq27(itemSubtasks.itemId, itemId2)).orderBy(asc6(itemSubtasks.idx));
10376
10376
  for (let i = 0; i < remaining.length; i++) {
10377
10377
  const oldIdx = remaining[i].idx;
@@ -10380,7 +10380,7 @@ async function deleteSubtask(orm, itemId2, idx) {
10380
10380
  and10(eq27(itemSubtasks.itemId, itemId2), eq27(itemSubtasks.idx, oldIdx))
10381
10381
  );
10382
10382
  }
10383
- return row2.title;
10383
+ return row3.title;
10384
10384
  }
10385
10385
 
10386
10386
  // src/commands/backlog/removeSubtask.ts
@@ -10402,8 +10402,8 @@ import chalk94 from "chalk";
10402
10402
  // src/commands/backlog/updateSubtaskStatus.ts
10403
10403
  import { and as and11, eq as eq28 } from "drizzle-orm";
10404
10404
  async function updateSubtaskStatus(orm, itemId2, idx, status2) {
10405
- const [row2] = await orm.update(itemSubtasks).set({ status: status2 }).where(and11(eq28(itemSubtasks.itemId, itemId2), eq28(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10406
- return row2?.title;
10405
+ const [row3] = await orm.update(itemSubtasks).set({ status: status2 }).where(and11(eq28(itemSubtasks.itemId, itemId2), eq28(itemSubtasks.idx, idx))).returning({ title: itemSubtasks.title });
10406
+ return row3?.title;
10407
10407
  }
10408
10408
 
10409
10409
  // src/commands/backlog/subtaskStatus.ts
@@ -10480,8 +10480,8 @@ async function adjustCurrentPhase(db, item, removedIdx) {
10480
10480
  return;
10481
10481
  }
10482
10482
  if (removedIdx !== currentIdx) return;
10483
- const [row2] = await db.select({ cnt: count3() }).from(planPhases).where(eq29(planPhases.itemId, item.id));
10484
- const cnt = row2?.cnt ?? 0;
10483
+ const [row3] = await db.select({ cnt: count3() }).from(planPhases).where(eq29(planPhases.itemId, item.id));
10484
+ const cnt = row3?.cnt ?? 0;
10485
10485
  await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq29(items.id, item.id));
10486
10486
  }
10487
10487
 
@@ -10534,8 +10534,8 @@ async function movePhase(id, from, to) {
10534
10534
  if (!found) return;
10535
10535
  const { orm, item } = found;
10536
10536
  const itemId2 = item.id;
10537
- const [row2] = await orm.select({ cnt: count4() }).from(planPhases).where(eq31(planPhases.itemId, itemId2));
10538
- const phaseCount = row2?.cnt ?? 0;
10537
+ const [row3] = await orm.select({ cnt: count4() }).from(planPhases).where(eq31(planPhases.itemId, itemId2));
10538
+ const phaseCount = row3?.cnt ?? 0;
10539
10539
  const fromIdx = toIndex(from, phaseCount);
10540
10540
  if (fromIdx === void 0) return;
10541
10541
  const toIdx = toIndex(to, phaseCount);
@@ -10590,8 +10590,8 @@ async function findPhase(id, phase) {
10590
10590
  const { orm, item } = found;
10591
10591
  const itemId2 = item.id;
10592
10592
  const phaseIdx = Number.parseInt(phase, 10) - 1;
10593
- const [row2] = await orm.select({ cnt: count5() }).from(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
10594
- if (!row2 || row2.cnt === 0) {
10593
+ const [row3] = await orm.select({ cnt: count5() }).from(planPhases).where(and15(eq33(planPhases.itemId, itemId2), eq33(planPhases.idx, phaseIdx)));
10594
+ if (!row3 || row3.cnt === 0) {
10595
10595
  console.log(
10596
10596
  chalk96.red(
10597
10597
  `Phase ${phaseIdx + 1} not found on item ${formatItemId(itemId2)}.`
@@ -12302,10 +12302,10 @@ async function listCommitRefs(db, itemId2) {
12302
12302
  title: itemGitRefs.title,
12303
12303
  url: itemGitRefs.url
12304
12304
  }).from(itemGitRefs).where(and17(eq38(itemGitRefs.itemId, itemId2), eq38(itemGitRefs.kind, "commit"))).orderBy(asc10(itemGitRefs.createdAt), asc10(itemGitRefs.ref));
12305
- return rows.map((row2) => ({
12306
- sha: row2.ref,
12307
- ...row2.title ? { title: row2.title } : {},
12308
- ...row2.url ? { url: row2.url } : {}
12305
+ return rows.map((row3) => ({
12306
+ sha: row3.ref,
12307
+ ...row3.title ? { title: row3.title } : {},
12308
+ ...row3.url ? { url: row3.url } : {}
12309
12309
  }));
12310
12310
  }
12311
12311
 
@@ -15507,8 +15507,8 @@ function listScopedRules(req, res) {
15507
15507
  // src/shared/db/countUsagePeaks.ts
15508
15508
  import { count as count6, eq as eq39 } from "drizzle-orm";
15509
15509
  async function countUsagePeaks(db, window) {
15510
- const [row2] = await db.select({ value: count6() }).from(usagePeaks).where(window ? eq39(usagePeaks.window, window) : void 0);
15511
- return row2?.value ?? 0;
15510
+ const [row3] = await db.select({ value: count6() }).from(usagePeaks).where(window ? eq39(usagePeaks.window, window) : void 0);
15511
+ return row3?.value ?? 0;
15512
15512
  }
15513
15513
 
15514
15514
  // src/shared/db/listUsagePeaks.ts
@@ -15587,20 +15587,20 @@ function listUsageHistory(req, res) {
15587
15587
  return respondPagedRows(req, res, async (range, params) => {
15588
15588
  const window = parseWindow(params.get("window"));
15589
15589
  const db = await getDb();
15590
- const [rows, total] = await Promise.all([
15590
+ const [rows, total2] = await Promise.all([
15591
15591
  listUsagePeaks(db, { ...range, window }),
15592
15592
  countUsagePeaks(db, window)
15593
15593
  ]);
15594
- return { rows, total };
15594
+ return { rows, total: total2 };
15595
15595
  });
15596
15596
  }
15597
15597
 
15598
15598
  // src/shared/db/countItemUsageByOrigin.ts
15599
15599
  import { asc as asc11, desc as desc4, eq as eq41, sql as sql19 } from "drizzle-orm";
15600
15600
  async function countItemUsageByOrigin(db) {
15601
- const count8 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15602
- const rows = await db.select({ origin: items.origin, count: count8 }).from(items).innerJoin(phaseUsage, eq41(phaseUsage.itemId, items.id)).groupBy(items.origin).orderBy(desc4(count8), asc11(items.origin));
15603
- return rows.map((row2) => ({ origin: row2.origin, count: Number(row2.count) }));
15601
+ const count9 = sql19`count(distinct ${phaseUsage.itemId})::int`;
15602
+ 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));
15603
+ return rows.map((row3) => ({ origin: row3.origin, count: Number(row3.count) }));
15604
15604
  }
15605
15605
 
15606
15606
  // src/shared/db/itemUsageWhere.ts
@@ -15647,7 +15647,7 @@ function median(value) {
15647
15647
  async function itemUsageStats(db, options2) {
15648
15648
  const totals = phaseUsageTotals(db);
15649
15649
  const planned = planPhaseCounts(db);
15650
- const [row2] = await db.select({
15650
+ const [row3] = await db.select({
15651
15651
  itemCount: sql20`count(*)::int`,
15652
15652
  doneCount: sql20`count(*) filter (where ${items.status} = 'done')::int`,
15653
15653
  repoCount: sql20`count(distinct ${items.origin})::int`,
@@ -15658,12 +15658,12 @@ async function itemUsageStats(db, options2) {
15658
15658
  medianTokens: median(sql20`${totals.tokensUp} + ${totals.tokensDown}`)
15659
15659
  }).from(items).innerJoin(totals, eq43(totals.itemId, items.id)).leftJoin(planned, eq43(planned.itemId, items.id)).where(itemUsageWhere(options2));
15660
15660
  return {
15661
- itemCount: Number(row2?.itemCount ?? 0),
15662
- doneCount: Number(row2?.doneCount ?? 0),
15663
- repoCount: Number(row2?.repoCount ?? 0),
15664
- medianPhases: Number(row2?.medianPhases ?? 0),
15665
- medianActiveMs: Number(row2?.medianActiveMs ?? 0),
15666
- medianTokens: Number(row2?.medianTokens ?? 0)
15661
+ itemCount: Number(row3?.itemCount ?? 0),
15662
+ doneCount: Number(row3?.doneCount ?? 0),
15663
+ repoCount: Number(row3?.repoCount ?? 0),
15664
+ medianPhases: Number(row3?.medianPhases ?? 0),
15665
+ medianActiveMs: Number(row3?.medianActiveMs ?? 0),
15666
+ medianTokens: Number(row3?.medianTokens ?? 0)
15667
15667
  };
15668
15668
  }
15669
15669
 
@@ -15698,16 +15698,16 @@ function lastPhaseActivity(db) {
15698
15698
  }
15699
15699
 
15700
15700
  // src/shared/db/toItemUsageSummary.ts
15701
- function toItemUsageSummary(row2) {
15701
+ function toItemUsageSummary(row3) {
15702
15702
  return {
15703
- ...row2,
15704
- phaseCount: row2.phaseCount ?? 0,
15705
- recordedPhases: Number(row2.recordedPhases),
15706
- tokensUp: Number(row2.tokensUp),
15707
- tokensDown: Number(row2.tokensDown),
15708
- activeMs: Number(row2.activeMs),
15709
- peakContextPct: Number(row2.peakContextPct),
15710
- lastPhaseAt: row2.lastPhaseAt ?? null
15703
+ ...row3,
15704
+ phaseCount: row3.phaseCount ?? 0,
15705
+ recordedPhases: Number(row3.recordedPhases),
15706
+ tokensUp: Number(row3.tokensUp),
15707
+ tokensDown: Number(row3.tokensDown),
15708
+ activeMs: Number(row3.activeMs),
15709
+ peakContextPct: Number(row3.peakContextPct),
15710
+ lastPhaseAt: row3.lastPhaseAt ?? null
15711
15711
  };
15712
15712
  }
15713
15713
 
@@ -16312,8 +16312,8 @@ async function commitsBehind(cwd, repo, base, shas) {
16312
16312
  ]);
16313
16313
  const ref = response.data?.repository?.ref;
16314
16314
  for (const [index2, sha] of shas.entries()) {
16315
- const count8 = ref?.[`c${index2}`]?.behindBy;
16316
- behind.set(sha, typeof count8 === "number" ? count8 : null);
16315
+ const count9 = ref?.[`c${index2}`]?.behindBy;
16316
+ behind.set(sha, typeof count9 === "number" ? count9 : null);
16317
16317
  }
16318
16318
  } catch {
16319
16319
  return behind;
@@ -16430,9 +16430,9 @@ function deploymentsQuery(environments) {
16430
16430
  function headCommit2(node) {
16431
16431
  return node?.oid ? releaseCommit(node.oid, node) : null;
16432
16432
  }
16433
- function environmentNodes(repository, count8) {
16433
+ function environmentNodes(repository, count9) {
16434
16434
  return Array.from(
16435
- { length: count8 },
16435
+ { length: count9 },
16436
16436
  (_, index2) => repository[deploymentsAlias(index2)]?.nodes ?? []
16437
16437
  ).flat();
16438
16438
  }
@@ -17621,7 +17621,7 @@ function globalOnlyRepoKeyError(key, verb) {
17621
17621
  // src/shared/db/listRepoConfigs.ts
17622
17622
  async function listRepoConfigs(orm) {
17623
17623
  const rows = await orm.select().from(repoConfigs);
17624
- return Object.fromEntries(rows.map((row2) => [row2.repoKey, row2.config]));
17624
+ return Object.fromEntries(rows.map((row3) => [row3.repoKey, row3.config]));
17625
17625
  }
17626
17626
 
17627
17627
  // src/shared/resolveNamedRepoWriteLabel.ts
@@ -21763,7 +21763,7 @@ function calculateHalstead(node) {
21763
21763
  // src/commands/complexity/shared/countSloc.ts
21764
21764
  function countSloc(content) {
21765
21765
  let inMultiLineComment = false;
21766
- let count8 = 0;
21766
+ let count9 = 0;
21767
21767
  for (const line of content.split("\n")) {
21768
21768
  const trimmed = line.trim();
21769
21769
  if (inMultiLineComment) {
@@ -21771,7 +21771,7 @@ function countSloc(content) {
21771
21771
  inMultiLineComment = false;
21772
21772
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21773
21773
  if (afterComment.trim().length > 0) {
21774
- count8++;
21774
+ count9++;
21775
21775
  }
21776
21776
  }
21777
21777
  continue;
@@ -21783,7 +21783,7 @@ function countSloc(content) {
21783
21783
  if (trimmed.includes("*/")) {
21784
21784
  const afterComment = trimmed.substring(trimmed.indexOf("*/") + 2);
21785
21785
  if (afterComment.trim().length > 0) {
21786
- count8++;
21786
+ count9++;
21787
21787
  }
21788
21788
  } else {
21789
21789
  inMultiLineComment = true;
@@ -21791,10 +21791,10 @@ function countSloc(content) {
21791
21791
  continue;
21792
21792
  }
21793
21793
  if (trimmed.length > 0) {
21794
- count8++;
21794
+ count9++;
21795
21795
  }
21796
21796
  }
21797
- return count8;
21797
+ return count9;
21798
21798
  }
21799
21799
 
21800
21800
  // src/commands/complexity/shared.ts
@@ -22124,10 +22124,10 @@ async function sloc(pattern2 = "**/*.ts", options2 = {}) {
22124
22124
  const color = exceedsThreshold ? chalk131.red : chalk131.white;
22125
22125
  console.log(`${color(file)} \u2192 ${chalk131.cyan(lines2)} lines`);
22126
22126
  }
22127
- const total = results.reduce((sum3, r) => sum3 + r.lines, 0);
22127
+ const total2 = results.reduce((sum3, r) => sum3 + r.lines, 0);
22128
22128
  console.log(
22129
22129
  chalk131.dim(`
22130
- Total: ${total} lines across ${files.length} files`)
22130
+ Total: ${total2} lines across ${files.length} files`)
22131
22131
  );
22132
22132
  if (hasViolation) {
22133
22133
  process.exit(1);
@@ -22405,8 +22405,8 @@ function matching(filter) {
22405
22405
  const needle = filter.toLowerCase();
22406
22406
  return (leaf) => leaf.key.toLowerCase().includes(needle);
22407
22407
  }
22408
- function headline(shown, total, filter) {
22409
- return filter ? chalk138.bold(`${shown} of ${total} config keys matching "${filter}"`) : chalk138.bold(`${total} config keys`);
22408
+ function headline(shown, total2, filter) {
22409
+ return filter ? chalk138.bold(`${shown} of ${total2} config keys matching "${filter}"`) : chalk138.bold(`${total2} config keys`);
22410
22410
  }
22411
22411
  function formatLeaf(leaf, help) {
22412
22412
  const meta = [typeText(leaf), `default: ${formatConfigDefault(leaf)}`];
@@ -22820,12 +22820,12 @@ async function findRetiredTables(exec3) {
22820
22820
  [RETIRED_TABLES]
22821
22821
  );
22822
22822
  const found = [];
22823
- for (const row2 of present) {
22824
- const name = String(row2.table_name);
22825
- const [count8] = await exec3.query(
22823
+ for (const row3 of present) {
22824
+ const name = String(row3.table_name);
22825
+ const [count9] = await exec3.query(
22826
22826
  `SELECT count(*)::int AS rows FROM "${name}"`
22827
22827
  );
22828
- found.push({ name, rows: Number(count8.rows) });
22828
+ found.push({ name, rows: Number(count9.rows) });
22829
22829
  }
22830
22830
  return found;
22831
22831
  }
@@ -23469,9 +23469,9 @@ function colorStatus(status2) {
23469
23469
  if (status2 === "outdated") return chalk154.yellow(status2);
23470
23470
  return chalk154.green(status2);
23471
23471
  }
23472
- function formatRow(row2, nameWidth) {
23473
- const devlog = (row2.lastDevlog ?? "-").padEnd(11);
23474
- return `${row2.name.padEnd(nameWidth)} ${row2.lastPush} ${devlog} ${colorStatus(row2.status)}`;
23472
+ function formatRow(row3, nameWidth) {
23473
+ const devlog = (row3.lastDevlog ?? "-").padEnd(11);
23474
+ return `${row3.name.padEnd(nameWidth)} ${row3.lastPush} ${devlog} ${colorStatus(row3.status)}`;
23475
23475
  }
23476
23476
  function printReposTable(rows) {
23477
23477
  const nameWidth = Math.max(4, ...rows.map((r) => r.name.length));
@@ -23483,8 +23483,8 @@ function printReposTable(rows) {
23483
23483
  ].join(" ");
23484
23484
  console.log(chalk154.dim(header));
23485
23485
  console.log(chalk154.dim("-".repeat(header.length)));
23486
- for (const row2 of rows) {
23487
- console.log(formatRow(row2, nameWidth));
23486
+ for (const row3 of rows) {
23487
+ console.log(formatRow(row3, nameWidth));
23488
23488
  }
23489
23489
  }
23490
23490
 
@@ -25066,13 +25066,13 @@ import chalk167 from "chalk";
25066
25066
  function printCountTable(labelHeader, rows) {
25067
25067
  const labelWidth = Math.max(
25068
25068
  labelHeader.length,
25069
- ...rows.map((row2) => row2.label.length)
25069
+ ...rows.map((row3) => row3.label.length)
25070
25070
  );
25071
25071
  const header = `${labelHeader.padEnd(labelWidth)} Commits`;
25072
25072
  console.log(chalk167.dim(header));
25073
25073
  console.log(chalk167.dim("-".repeat(header.length)));
25074
- for (const row2 of rows) {
25075
- console.log(`${row2.label.padEnd(labelWidth)} ${row2.count}`);
25074
+ for (const row3 of rows) {
25075
+ console.log(`${row3.label.padEnd(labelWidth)} ${row3.count}`);
25076
25076
  }
25077
25077
  }
25078
25078
 
@@ -25411,7 +25411,7 @@ function buildFixStructurePlan(issues, options2) {
25411
25411
  tooDeep,
25412
25412
  typeChangeCount: entries.filter((entry) => entry.typeChange).length,
25413
25413
  labelRemovalCount: entries.reduce(
25414
- (total, entry) => total + entry.labelRemovals.length,
25414
+ (total2, entry) => total2 + entry.labelRemovals.length,
25415
25415
  0
25416
25416
  )
25417
25417
  };
@@ -25533,8 +25533,8 @@ function annotate(entry) {
25533
25533
  }
25534
25534
  return notes;
25535
25535
  }
25536
- function formatCount(count8, noun) {
25537
- return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
25536
+ function formatCount(count9, noun) {
25537
+ return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
25538
25538
  }
25539
25539
  function printFixStructurePlan(plan2, chain2, apply) {
25540
25540
  writeLineNow(chalk171.dim(`chain: ${chain2.join(" > ")}`));
@@ -25819,8 +25819,8 @@ var VIDEO_EXTENSIONS = /* @__PURE__ */ new Set([".mp4", ".webm", ".mov"]);
25819
25819
  function cell(text18) {
25820
25820
  return text18.replaceAll("|", String.raw`\|`);
25821
25821
  }
25822
- function row(cells) {
25823
- return `| ${cells.join(" | ")} |`;
25822
+ function row(cells2) {
25823
+ return `| ${cells2.join(" | ")} |`;
25824
25824
  }
25825
25825
  function imageTable(images) {
25826
25826
  if (images.length === 0) return [];
@@ -28777,14 +28777,14 @@ async function netcap(options2) {
28777
28777
  const filter = options2.filter ?? "";
28778
28778
  await mkdir6(dirname34(outPath), { recursive: true });
28779
28779
  const extensionPath = await prepareExtensionForLoad(port, filter);
28780
- let count8 = 0;
28780
+ let count9 = 0;
28781
28781
  const handler = createNetcapHandler({
28782
28782
  outPath,
28783
28783
  onPing: () => console.log(chalk183.dim("ping from extension")),
28784
28784
  onCapture: (entry) => {
28785
- count8 += 1;
28785
+ count9 += 1;
28786
28786
  console.log(
28787
- chalk183.green(`captured #${count8}`),
28787
+ chalk183.green(`captured #${count9}`),
28788
28788
  chalk183.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
28789
28789
  );
28790
28790
  }
@@ -28805,7 +28805,7 @@ async function netcap(options2) {
28805
28805
  console.log(
28806
28806
  chalk183.bold(
28807
28807
  `
28808
- netcap stopped \u2014 captured ${count8} ${count8 === 1 ? "entry" : "entries"} to ${outPath}`
28808
+ netcap stopped \u2014 captured ${count9} ${count9 === 1 ? "entry" : "entries"} to ${outPath}`
28809
28809
  )
28810
28810
  );
28811
28811
  process.exit(0);
@@ -29378,12 +29378,12 @@ function printPromptsTable(rows) {
29378
29378
  ].join(" ");
29379
29379
  console.log(chalk186.dim(header));
29380
29380
  console.log(chalk186.dim("-".repeat(header.length)));
29381
- for (const row2 of rows) {
29382
- const count8 = String(row2.count).padStart(countWidth);
29383
- const tool = row2.tool.padEnd(toolWidth);
29384
- const command = truncate(row2.command, 60).padEnd(commandWidth);
29381
+ for (const row3 of rows) {
29382
+ const count9 = String(row3.count).padStart(countWidth);
29383
+ const tool = row3.tool.padEnd(toolWidth);
29384
+ const command = truncate(row3.command, 60).padEnd(commandWidth);
29385
29385
  console.log(
29386
- `${chalk186.yellow(count8)} ${tool} ${command} ${chalk186.dim(row2.repos)}`
29386
+ `${chalk186.yellow(count9)} ${tool} ${command} ${chalk186.dim(row3.repos)}`
29387
29387
  );
29388
29388
  }
29389
29389
  }
@@ -29452,17 +29452,17 @@ function getPageSlice(pullRequests, page) {
29452
29452
  const start2 = page * PAGE_SIZE2;
29453
29453
  return pullRequests.slice(start2, start2 + PAGE_SIZE2);
29454
29454
  }
29455
- function pageHeader(page, totalPages, total) {
29455
+ function pageHeader(page, totalPages, total2) {
29456
29456
  return `
29457
- Page ${page + 1} of ${totalPages} (${total} total)
29457
+ Page ${page + 1} of ${totalPages} (${total2} total)
29458
29458
  `;
29459
29459
  }
29460
29460
  function displayPage(pullRequests, totalPages, page) {
29461
29461
  console.log(pageHeader(page, totalPages, pullRequests.length));
29462
29462
  for (const pr of getPageSlice(pullRequests, page)) printPr(pr);
29463
29463
  }
29464
- function hasNextPage(page, total) {
29465
- return page < total - 1;
29464
+ function hasNextPage(page, total2) {
29465
+ return page < total2 - 1;
29466
29466
  }
29467
29467
  var NEXT_CHOICE = { name: "Next page", value: "next" };
29468
29468
  var PREV_CHOICE = { name: "Previous page", value: "prev" };
@@ -29493,8 +29493,8 @@ async function promptNavigation(currentPage, totalPages) {
29493
29493
  });
29494
29494
  return parseAction(action);
29495
29495
  }
29496
- function computeTotalPages(count8) {
29497
- return Math.ceil(count8 / PAGE_SIZE2);
29496
+ function computeTotalPages(count9) {
29497
+ return Math.ceil(count9 / PAGE_SIZE2);
29498
29498
  }
29499
29499
  async function navigateAndDisplay(pullRequests, totalPages, currentPage) {
29500
29500
  const delta = await promptNavigation(currentPage, totalPages);
@@ -29985,9 +29985,9 @@ function renderResolvedIndex(threads, style) {
29985
29985
  for (const thread of threads) {
29986
29986
  const first = thread.comments[0];
29987
29987
  if (!first) continue;
29988
- const count8 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
29988
+ const count9 = thread.comments.length > 1 ? ` (${thread.comments.length} comments)` : "";
29989
29989
  lines2.push(
29990
- ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count8}`
29990
+ ` ${style.bold(threadLocation(first))} ${first.user}: ${firstLine(first.body)}${count9}`
29991
29991
  );
29992
29992
  }
29993
29993
  lines2.push("");
@@ -31261,12 +31261,12 @@ function printPrStatus(pr) {
31261
31261
  // src/commands/prs/status/printPrsStatus.ts
31262
31262
  function printPrsStatus(report) {
31263
31263
  for (const repo of report.repos) {
31264
- const count8 = repo.pullRequests.length;
31265
- console.log(`${chalk190.bold(repo.repo)} ${chalk190.dim(`(${count8} open)`)}`);
31264
+ const count9 = repo.pullRequests.length;
31265
+ console.log(`${chalk190.bold(repo.repo)} ${chalk190.dim(`(${count9} open)`)}`);
31266
31266
  for (const pr of repo.pullRequests) {
31267
31267
  printPrStatus(pr);
31268
31268
  }
31269
- if (count8 === 0) console.log(chalk190.dim(" no open pull requests"));
31269
+ if (count9 === 0) console.log(chalk190.dim(" no open pull requests"));
31270
31270
  console.log();
31271
31271
  }
31272
31272
  if (report.errors.length === 0) return;
@@ -31359,11 +31359,11 @@ function parseReadBudget(value) {
31359
31359
  `Invalid budget "${value}". Use a duration like 45s, 1m30s or 2m.`
31360
31360
  );
31361
31361
  }
31362
- const total = Number(minutes ?? 0) * 60 + Number(seconds ?? 0);
31363
- if (total === 0) {
31362
+ const total2 = Number(minutes ?? 0) * 60 + Number(seconds ?? 0);
31363
+ if (total2 === 0) {
31364
31364
  throw new Error(`Invalid budget "${value}". Value must be at least 1s.`);
31365
31365
  }
31366
- return total;
31366
+ return total2;
31367
31367
  }
31368
31368
 
31369
31369
  // src/commands/readTime/resolveReadTimeTarget.ts
@@ -31495,12 +31495,12 @@ import chalk196 from "chalk";
31495
31495
 
31496
31496
  // src/shared/createConnectionAuth.ts
31497
31497
  import chalk191 from "chalk";
31498
- function listConnections(connections, format2) {
31498
+ function listConnections(connections, format3) {
31499
31499
  if (connections.length === 0) {
31500
31500
  console.log("No connections configured.");
31501
31501
  } else {
31502
31502
  for (const c of connections) {
31503
- console.log(format2(c));
31503
+ console.log(format3(c));
31504
31504
  }
31505
31505
  }
31506
31506
  }
@@ -33183,16 +33183,16 @@ import {
33183
33183
  } from "ts-morph";
33184
33184
  var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
33185
33185
  function countLeadingSuppressions(sourceFile) {
33186
- let count8 = 0;
33186
+ let count9 = 0;
33187
33187
  for (const stmt of sourceFile.getStatementsWithComments()) {
33188
33188
  const kind = stmt.getKind();
33189
33189
  if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
33190
- count8++;
33190
+ count9++;
33191
33191
  } else {
33192
33192
  break;
33193
33193
  }
33194
33194
  }
33195
- return count8;
33195
+ return count9;
33196
33196
  }
33197
33197
  function addImportPreservingSuppressions(sourceFile, structure) {
33198
33198
  if (sourceFile.getImportDeclarations().length > 0) {
@@ -35329,7 +35329,7 @@ function summariseRepoTree(cwd = process.cwd()) {
35329
35329
  return [...directories.entries()].map(([directory, extensions]) => ({
35330
35330
  directory,
35331
35331
  extensions: [...extensions.entries()].sort((a, b) => b[1] - a[1]),
35332
- total: [...extensions.values()].reduce((sum3, count8) => sum3 + count8, 0)
35332
+ total: [...extensions.values()].reduce((sum3, count9) => sum3 + count9, 0)
35333
35333
  })).sort((a, b) => b.total - a.total || a.directory.localeCompare(b.directory)).slice(0, MAX_DIRECTORIES).map(
35334
35334
  (entry) => `${entry.directory} \u2014 ${entry.total} files: ${formatExtensions(entry.extensions)}`
35335
35335
  ).join("\n");
@@ -35357,7 +35357,7 @@ function countByDirectory(files) {
35357
35357
  return directories;
35358
35358
  }
35359
35359
  function formatExtensions(extensions) {
35360
- return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count8]) => `${extension2}(${count8})`).join(", ");
35360
+ return extensions.slice(0, MAX_EXTENSIONS_PER_DIRECTORY).map(([extension2, count9]) => `${extension2}(${count9})`).join(", ");
35361
35361
  }
35362
35362
 
35363
35363
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
@@ -35482,7 +35482,7 @@ function basename24(path109) {
35482
35482
  return path109.slice(path109.lastIndexOf("/") + 1);
35483
35483
  }
35484
35484
  function sum(nodes, key) {
35485
- return nodes.reduce((total, node) => total + node[key], 0);
35485
+ return nodes.reduce((total2, node) => total2 + node[key], 0);
35486
35486
  }
35487
35487
  function byName(a, b) {
35488
35488
  return a.name.localeCompare(b.name);
@@ -35526,7 +35526,7 @@ function buildHighLevelTree(files) {
35526
35526
 
35527
35527
  // src/commands/review/highLevel/buildHighLevelStructure.ts
35528
35528
  function sum2(files, key) {
35529
- return files.reduce((total, file) => total + file[key], 0);
35529
+ return files.reduce((total2, file) => total2 + file[key], 0);
35530
35530
  }
35531
35531
  function countOf(files, status2) {
35532
35532
  return files.filter((file) => file.status === status2).length;
@@ -35674,10 +35674,10 @@ function dedentedSource(call) {
35674
35674
  // src/commands/review/highLevel/visitCase.ts
35675
35675
  function visitCase(call, context) {
35676
35676
  if (!context.changed) return [toCase(call, context, void 0)];
35677
- const count8 = changedLines(call, context.changed);
35678
- if (count8 === 0) return [];
35677
+ const count9 = changedLines(call, context.changed);
35678
+ if (count9 === 0) return [];
35679
35679
  const lines2 = call.getEndLineNumber() - call.getStartLineNumber() + 1;
35680
- return [toCase(call, context, count8 === lines2 ? "added" : "modified")];
35680
+ return [toCase(call, context, count9 === lines2 ? "added" : "modified")];
35681
35681
  }
35682
35682
  function toCase(call, context, change) {
35683
35683
  const line = call.getStartLineNumber();
@@ -35691,10 +35691,10 @@ function toCase(call, context, change) {
35691
35691
  };
35692
35692
  }
35693
35693
  function changedLines(call, changed) {
35694
- let count8 = 0;
35694
+ let count9 = 0;
35695
35695
  for (let line = call.getStartLineNumber(); line <= call.getEndLineNumber(); line++)
35696
- if (changed.has(line)) count8++;
35697
- return count8;
35696
+ if (changed.has(line)) count9++;
35697
+ return count9;
35698
35698
  }
35699
35699
 
35700
35700
  // src/commands/review/highLevel/extractTestHierarchy.ts
@@ -35835,12 +35835,12 @@ var EVIDENCE_PATTERNS = [
35835
35835
  ];
35836
35836
  function countEvidence(body) {
35837
35837
  return EVIDENCE_PATTERNS.reduce(
35838
- (total, pattern2) => total + (body.match(pattern2)?.length ?? 0),
35838
+ (total2, pattern2) => total2 + (body.match(pattern2)?.length ?? 0),
35839
35839
  0
35840
35840
  );
35841
35841
  }
35842
- function plural(count8, noun) {
35843
- return `${count8} ${noun}${count8 === 1 ? "" : "s"}`;
35842
+ function plural(count9, noun) {
35843
+ return `${count9} ${noun}${count9 === 1 ? "" : "s"}`;
35844
35844
  }
35845
35845
  function checkUiEvidence(body, changedFiles2, uiPaths) {
35846
35846
  if (uiPaths.length === 0)
@@ -36739,13 +36739,63 @@ function selectPostableFindings(markdown, prInfo) {
36739
36739
  return { inDiff, unanchored: [...carriedUnlocated, ...unanchored] };
36740
36740
  }
36741
36741
 
36742
+ // src/commands/review/ci/buildTokenUsageTable.ts
36743
+ var SLOT_LABELS = ["Reviewer 1", "Reviewer 2", "Synthesis"];
36744
+ var DASH = "\u2014";
36745
+ function format(value) {
36746
+ return value === void 0 ? DASH : value.toLocaleString("en-US");
36747
+ }
36748
+ function cells(usage) {
36749
+ if (!usage) return [DASH, DASH, DASH, DASH];
36750
+ return [
36751
+ format(usage.input),
36752
+ format(usage.output),
36753
+ format(usage.cacheRead),
36754
+ format(usage.cacheWrite)
36755
+ ];
36756
+ }
36757
+ function sumOf(reported, pick) {
36758
+ const values = reported.map(pick).filter((v) => v !== void 0);
36759
+ return values.length === 0 ? void 0 : values.reduce((a, b) => a + b, 0);
36760
+ }
36761
+ function total(usages) {
36762
+ const reported = usages.filter((u) => u !== void 0);
36763
+ return [
36764
+ format(sumOf(reported, (u) => u.input)),
36765
+ format(sumOf(reported, (u) => u.output)),
36766
+ format(sumOf(reported, (u) => u.cacheRead)),
36767
+ format(sumOf(reported, (u) => u.cacheWrite))
36768
+ ];
36769
+ }
36770
+ function row2(label2, values) {
36771
+ return `| ${label2} | ${values.join(" | ")} |`;
36772
+ }
36773
+ function buildTokenUsageTable(usages) {
36774
+ return [
36775
+ "## Token usage",
36776
+ "",
36777
+ "| Slot | Input | Output | Cache read | Cache write |",
36778
+ "| --- | ---: | ---: | ---: | ---: |",
36779
+ ...usages.map(
36780
+ (usage, i) => row2(SLOT_LABELS[i] ?? `Slot ${i + 1}`, cells(usage))
36781
+ ),
36782
+ row2("**Total**", total(usages))
36783
+ ].join("\n");
36784
+ }
36785
+
36742
36786
  // src/commands/review/ci/writeJobSummary.ts
36743
- function writeJobSummary(synthesisPath, prInfo, summaryPath) {
36787
+ function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
36744
36788
  if (!summaryPath) return;
36745
36789
  const markdown = readFileSync51(synthesisPath, "utf8");
36746
36790
  const { unanchored } = selectPostableFindings(markdown, prInfo);
36747
- appendFileSync2(summaryPath, `${buildReviewSummary(markdown, unanchored)}
36748
- `);
36791
+ const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
36792
+ appendFileSync2(
36793
+ summaryPath,
36794
+ `${buildReviewSummary(markdown, unanchored)}
36795
+
36796
+ ${usageTable}
36797
+ `
36798
+ );
36749
36799
  }
36750
36800
 
36751
36801
  // src/commands/review/appendCiFooter.ts
@@ -36849,7 +36899,7 @@ function renderEntry(entry, frame) {
36849
36899
  }
36850
36900
 
36851
36901
  // src/commands/review/startReviewLog.ts
36852
- import { format } from "util";
36902
+ import { format as format2 } from "util";
36853
36903
 
36854
36904
  // src/commands/review/createReviewLogSink.ts
36855
36905
  import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync24 } from "fs";
@@ -36897,7 +36947,7 @@ function patch(method) {
36897
36947
  const original = console[method].bind(console);
36898
36948
  console[method] = (...args) => {
36899
36949
  original(...args);
36900
- appendReviewLog(format(...args));
36950
+ appendReviewLog(format2(...args));
36901
36951
  };
36902
36952
  }
36903
36953
  function startReviewLog() {
@@ -37024,9 +37074,6 @@ function skippedCodexResult(outputPath) {
37024
37074
  return { name: "codex", outputPath, exitCode: 0, stderr: "" };
37025
37075
  }
37026
37076
 
37027
- // src/commands/review/runAndSynthesise.ts
37028
- import { existsSync as existsSync68, unlinkSync as unlinkSync19 } from "fs";
37029
-
37030
37077
  // src/commands/review/buildReviewerStdin.ts
37031
37078
  var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
37032
37079
 
@@ -37125,50 +37172,6 @@ function buildCodexModelArgs() {
37125
37172
  // src/commands/review/runClaudeReviewer.ts
37126
37173
  import { writeFileSync as writeFileSync41 } from "fs";
37127
37174
 
37128
- // src/commands/review/finaliseReviewerSpinner.ts
37129
- var SUMMARY_MAX_LEN = 80;
37130
- function summariseStderr(stderr) {
37131
- const firstLine3 = stderr.split(/\r?\n/).find((l) => l.trim().length > 0);
37132
- if (!firstLine3) return "";
37133
- const trimmed = firstLine3.trim();
37134
- return trimmed.length > SUMMARY_MAX_LEN ? `${trimmed.slice(0, SUMMARY_MAX_LEN - 1)}\u2026` : trimmed;
37135
- }
37136
- function finaliseReviewerSpinner(spinner, outcome) {
37137
- const label2 = reviewerLabel(outcome.name, outcome.model);
37138
- const elapsed = Math.round(outcome.elapsedMs / 1e3);
37139
- if (outcome.exitCode === 0) {
37140
- spinner.succeed(`${label2} \u2014 done in ${elapsed}s`);
37141
- return;
37142
- }
37143
- const summary = summariseStderr(outcome.stderr ?? "");
37144
- const suffix = summary ? `: ${summary}` : "";
37145
- spinner.fail(
37146
- `${label2} \u2014 failed in ${elapsed}s (exit ${outcome.exitCode})${suffix}`
37147
- );
37148
- }
37149
-
37150
- // src/commands/review/finaliseReviewerRun.ts
37151
- function finaliseReviewerRun(spec, spinner, result) {
37152
- if (spinner)
37153
- finaliseReviewerSpinner(spinner, {
37154
- name: spec.name,
37155
- model: spec.model,
37156
- exitCode: result.exitCode,
37157
- elapsedMs: result.elapsedMs,
37158
- stderr: result.stderr
37159
- });
37160
- return {
37161
- name: spec.name,
37162
- command: spec.command,
37163
- model: spec.model,
37164
- outputPath: spec.outputPath,
37165
- exitCode: result.exitCode,
37166
- stderr: result.stderr,
37167
- stdout: result.stdout,
37168
- elapsedMs: result.elapsedMs
37169
- };
37170
- }
37171
-
37172
37175
  // src/commands/review/formatToolSummary.ts
37173
37176
  function truncate2(value, max = 80) {
37174
37177
  const collapsed = value.replace(/\s+/g, " ").trim();
@@ -37205,6 +37208,30 @@ function simplifyShellCommand(command) {
37205
37208
  return truncate2(inner);
37206
37209
  }
37207
37210
 
37211
+ // src/commands/review/parseTokenUsage.ts
37212
+ function count8(value) {
37213
+ return typeof value === "number" ? value : 0;
37214
+ }
37215
+ function parseTokenUsage(usage, keys) {
37216
+ if (typeof usage !== "object" || usage === null) return void 0;
37217
+ const raw = usage;
37218
+ const parsed = {
37219
+ input: count8(raw.input_tokens),
37220
+ output: count8(raw.output_tokens),
37221
+ cacheRead: count8(raw[keys.cacheRead])
37222
+ };
37223
+ if (keys.cacheWrite) parsed.cacheWrite = count8(raw[keys.cacheWrite]);
37224
+ return parsed;
37225
+ }
37226
+
37227
+ // src/commands/review/parseClaudeUsage.ts
37228
+ function parseClaudeUsage(usage) {
37229
+ return parseTokenUsage(usage, {
37230
+ cacheRead: "cache_read_input_tokens",
37231
+ cacheWrite: "cache_creation_input_tokens"
37232
+ });
37233
+ }
37234
+
37208
37235
  // src/commands/review/parseClaudeEvent.ts
37209
37236
  function isAssistantEvent(value) {
37210
37237
  return typeof value === "object" && value !== null && value.type === "assistant";
@@ -37235,7 +37262,8 @@ function parseClaudeEvent(line) {
37235
37262
  if (toolUses.length > 0) return { kind: "tool_uses", toolUses };
37236
37263
  }
37237
37264
  if (isResultEvent(event) && typeof event.result === "string") {
37238
- return { kind: "final", text: event.result };
37265
+ const usage = parseClaudeUsage(event.usage);
37266
+ return usage ? { kind: "final", text: event.result, usage } : { kind: "final", text: event.result };
37239
37267
  }
37240
37268
  return { kind: "ignore" };
37241
37269
  }
@@ -37257,6 +37285,68 @@ function reportReviewerToolUse(name, use, spinner, model) {
37257
37285
  console.log(`[${label2}] ${use.tool}${suffix}`);
37258
37286
  }
37259
37287
 
37288
+ // src/commands/review/createClaudeLineHandler.ts
37289
+ function createClaudeLineHandler(name, spinner, model) {
37290
+ const state = { finalText: "" };
37291
+ const onLine = (line) => {
37292
+ const event = parseClaudeEvent(line);
37293
+ if (event.kind === "tool_uses") {
37294
+ for (const use of event.toolUses)
37295
+ reportReviewerToolUse(name, use, spinner, model);
37296
+ return;
37297
+ }
37298
+ if (event.kind === "final") {
37299
+ state.finalText = event.text;
37300
+ state.usage = event.usage;
37301
+ }
37302
+ };
37303
+ return { state, onLine };
37304
+ }
37305
+
37306
+ // src/commands/review/finaliseReviewerSpinner.ts
37307
+ var SUMMARY_MAX_LEN = 80;
37308
+ function summariseStderr(stderr) {
37309
+ const firstLine3 = stderr.split(/\r?\n/).find((l) => l.trim().length > 0);
37310
+ if (!firstLine3) return "";
37311
+ const trimmed = firstLine3.trim();
37312
+ return trimmed.length > SUMMARY_MAX_LEN ? `${trimmed.slice(0, SUMMARY_MAX_LEN - 1)}\u2026` : trimmed;
37313
+ }
37314
+ function finaliseReviewerSpinner(spinner, outcome) {
37315
+ const label2 = reviewerLabel(outcome.name, outcome.model);
37316
+ const elapsed = Math.round(outcome.elapsedMs / 1e3);
37317
+ if (outcome.exitCode === 0) {
37318
+ spinner.succeed(`${label2} \u2014 done in ${elapsed}s`);
37319
+ return;
37320
+ }
37321
+ const summary = summariseStderr(outcome.stderr ?? "");
37322
+ const suffix = summary ? `: ${summary}` : "";
37323
+ spinner.fail(
37324
+ `${label2} \u2014 failed in ${elapsed}s (exit ${outcome.exitCode})${suffix}`
37325
+ );
37326
+ }
37327
+
37328
+ // src/commands/review/finaliseReviewerRun.ts
37329
+ function finaliseReviewerRun(spec, spinner, result) {
37330
+ if (spinner)
37331
+ finaliseReviewerSpinner(spinner, {
37332
+ name: spec.name,
37333
+ model: spec.model,
37334
+ exitCode: result.exitCode,
37335
+ elapsedMs: result.elapsedMs,
37336
+ stderr: result.stderr
37337
+ });
37338
+ return {
37339
+ name: spec.name,
37340
+ command: spec.command,
37341
+ model: spec.model,
37342
+ outputPath: spec.outputPath,
37343
+ exitCode: result.exitCode,
37344
+ stderr: result.stderr,
37345
+ stdout: result.stdout,
37346
+ elapsedMs: result.elapsedMs
37347
+ };
37348
+ }
37349
+
37260
37350
  // src/commands/review/runStreamingChild.ts
37261
37351
  import { spawn as spawn8 } from "child_process";
37262
37352
 
@@ -37493,9 +37583,13 @@ function runStreamingChild(spec) {
37493
37583
 
37494
37584
  // src/commands/review/runClaudeReviewer.ts
37495
37585
  async function runClaudeReviewer(spec) {
37496
- let finalText = "";
37497
37586
  const { spinner, override } = spec;
37498
37587
  const command = "claude";
37588
+ const { state, onLine } = createClaudeLineHandler(
37589
+ spec.name,
37590
+ spinner,
37591
+ override?.model
37592
+ );
37499
37593
  const result = await runStreamingChild({
37500
37594
  name: spec.name,
37501
37595
  command,
@@ -37512,32 +37606,33 @@ async function runClaudeReviewer(spec) {
37512
37606
  stdin: spec.stdin,
37513
37607
  quiet: Boolean(spinner),
37514
37608
  ...override ? { env: override.env } : {},
37515
- onLine: (line) => {
37516
- const event = parseClaudeEvent(line);
37517
- if (event.kind === "tool_uses") {
37518
- for (const use of event.toolUses)
37519
- reportReviewerToolUse(spec.name, use, spinner, override?.model);
37520
- return;
37521
- }
37522
- if (event.kind === "final") finalText = event.text;
37523
- }
37609
+ onLine
37524
37610
  });
37525
- if (result.exitCode === 0 && finalText)
37526
- writeFileSync41(spec.outputPath, finalText);
37527
- return finaliseReviewerRun(
37611
+ if (result.exitCode === 0 && state.finalText)
37612
+ writeFileSync41(spec.outputPath, state.finalText);
37613
+ const finalised = finaliseReviewerRun(
37528
37614
  { ...spec, command, model: override?.model },
37529
37615
  spinner,
37530
37616
  result
37531
37617
  );
37618
+ return state.usage ? { ...finalised, usage: state.usage } : finalised;
37532
37619
  }
37533
37620
 
37534
37621
  // src/commands/review/runCodexReviewer.ts
37535
37622
  import { existsSync as existsSync67, unlinkSync as unlinkSync18 } from "fs";
37536
37623
 
37624
+ // src/commands/review/parseCodexUsage.ts
37625
+ function parseCodexUsage(usage) {
37626
+ return parseTokenUsage(usage, { cacheRead: "cached_input_tokens" });
37627
+ }
37628
+
37537
37629
  // src/commands/review/parseCodexEvent.ts
37538
37630
  function isItemStarted(value) {
37539
37631
  return typeof value === "object" && value !== null && value.type === "item.started";
37540
37632
  }
37633
+ function isTurnCompleted(value) {
37634
+ return typeof value === "object" && value !== null && value.type === "turn.completed";
37635
+ }
37541
37636
  function parseCodexEvent(line) {
37542
37637
  let event;
37543
37638
  try {
@@ -37545,6 +37640,10 @@ function parseCodexEvent(line) {
37545
37640
  } catch {
37546
37641
  return { kind: "ignore" };
37547
37642
  }
37643
+ if (isTurnCompleted(event)) {
37644
+ const usage = parseCodexUsage(event.usage);
37645
+ return usage ? { kind: "usage", usage } : { kind: "ignore" };
37646
+ }
37548
37647
  if (!isItemStarted(event)) return { kind: "ignore" };
37549
37648
  const item = event.item;
37550
37649
  if (!item) return { kind: "ignore" };
@@ -37558,6 +37657,27 @@ function parseCodexEvent(line) {
37558
37657
  return { kind: "ignore" };
37559
37658
  }
37560
37659
 
37660
+ // src/commands/review/createCodexLineHandler.ts
37661
+ function addUsage(total2, turn) {
37662
+ if (!total2) return turn;
37663
+ return {
37664
+ input: total2.input + turn.input,
37665
+ output: total2.output + turn.output,
37666
+ cacheRead: total2.cacheRead + turn.cacheRead
37667
+ };
37668
+ }
37669
+ function createCodexLineHandler(name, spinner, model) {
37670
+ const state = {};
37671
+ const onLine = (line) => {
37672
+ const event = parseCodexEvent(line);
37673
+ if (event.kind === "tool_use")
37674
+ reportReviewerToolUse(name, event, spinner, model);
37675
+ else if (event.kind === "usage")
37676
+ state.usage = addUsage(state.usage, event.usage);
37677
+ };
37678
+ return { state, onLine };
37679
+ }
37680
+
37561
37681
  // src/commands/review/runCodexReviewer.ts
37562
37682
  function codexArgs(outputPath, modelArgs) {
37563
37683
  return [
@@ -37573,6 +37693,11 @@ function codexArgs(outputPath, modelArgs) {
37573
37693
  async function runCodexReviewer(spec) {
37574
37694
  const { spinner, override } = spec;
37575
37695
  const command = "codex";
37696
+ const { state, onLine } = createCodexLineHandler(
37697
+ spec.name,
37698
+ spinner,
37699
+ override.model
37700
+ );
37576
37701
  const result = await runStreamingChild({
37577
37702
  name: spec.name,
37578
37703
  command,
@@ -37581,16 +37706,12 @@ async function runCodexReviewer(spec) {
37581
37706
  stdin: spec.stdin,
37582
37707
  quiet: Boolean(spinner),
37583
37708
  ...override.args.length > 0 ? { env: override.env } : {},
37584
- onLine: (line) => {
37585
- const event = parseCodexEvent(line);
37586
- if (event.kind !== "tool_use") return;
37587
- reportReviewerToolUse(spec.name, event, spinner, override.model);
37588
- }
37709
+ onLine
37589
37710
  });
37590
37711
  if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
37591
37712
  unlinkSync18(spec.outputPath);
37592
37713
  }
37593
- return finaliseReviewerRun(
37714
+ const finalised = finaliseReviewerRun(
37594
37715
  {
37595
37716
  name: spec.name,
37596
37717
  command,
@@ -37600,6 +37721,7 @@ async function runCodexReviewer(spec) {
37600
37721
  spinner,
37601
37722
  result
37602
37723
  );
37724
+ return state.usage ? { ...finalised, usage: state.usage } : finalised;
37603
37725
  }
37604
37726
 
37605
37727
  // src/commands/review/runSlot.ts
@@ -37676,6 +37798,9 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
37676
37798
  return { results, anyFresh };
37677
37799
  }
37678
37800
 
37801
+ // src/commands/review/synthesiseAfterReviewers.ts
37802
+ import { existsSync as existsSync68, unlinkSync as unlinkSync19 } from "fs";
37803
+
37679
37804
  // src/commands/review/synthesise.ts
37680
37805
  import { readFileSync as readFileSync52 } from "fs";
37681
37806
 
@@ -37778,6 +37903,24 @@ async function synthesise(paths, options2) {
37778
37903
  return result;
37779
37904
  }
37780
37905
 
37906
+ // src/commands/review/synthesiseAfterReviewers.ts
37907
+ async function synthesiseAfterReviewers(input) {
37908
+ const { paths, failures } = input;
37909
+ if (input.anyFresh && existsSync68(paths.synthesisPath)) {
37910
+ unlinkSync19(paths.synthesisPath);
37911
+ }
37912
+ const synthesisResult = await synthesise(paths, {
37913
+ multi: input.multi,
37914
+ slot: input.slot
37915
+ });
37916
+ if (synthesisResult.exitCode !== 0) failures.push(synthesisResult);
37917
+ return {
37918
+ ok: synthesisResult.exitCode === 0,
37919
+ failures,
37920
+ slots: [...input.results, synthesisResult]
37921
+ };
37922
+ }
37923
+
37781
37924
  // src/commands/review/skipReason.ts
37782
37925
  function skipReason(results, failures, strict) {
37783
37926
  if (failures.length === results.length)
@@ -37809,17 +37952,16 @@ async function runAndSynthesise(args) {
37809
37952
  const reason4 = skipReason(results, failures, args.strict);
37810
37953
  if (reason4) {
37811
37954
  console.error(reason4);
37812
- return { ok: false, failures };
37955
+ return { ok: false, failures, slots: results };
37813
37956
  }
37814
- if (anyFresh && existsSync68(paths.synthesisPath)) {
37815
- unlinkSync19(paths.synthesisPath);
37816
- }
37817
- const synthesisResult = await synthesise(paths, {
37957
+ return synthesiseAfterReviewers({
37958
+ paths,
37959
+ results,
37960
+ failures,
37961
+ anyFresh,
37818
37962
  multi,
37819
37963
  slot: args.models.synthesis
37820
37964
  });
37821
- if (synthesisResult.exitCode !== 0) failures.push(synthesisResult);
37822
- return { ok: synthesisResult.exitCode === 0, failures };
37823
37965
  }
37824
37966
 
37825
37967
  // src/commands/review/useSpinnerUi.ts
@@ -38069,9 +38211,9 @@ function setupReviewDir(repoRoot2, context, force) {
38069
38211
  console.log(`Review folder: ${paths.reviewDir}`);
38070
38212
  return paths;
38071
38213
  }
38072
- function logPriorComments(count8) {
38073
- if (count8 === 0) return;
38074
- console.log(`Including ${count8} prior review comment(s) in request.md.`);
38214
+ function logPriorComments(count9) {
38215
+ if (count9 === 0) return;
38216
+ console.log(`Including ${count9} prior review comment(s) in request.md.`);
38075
38217
  }
38076
38218
 
38077
38219
  // src/commands/review/gatherContext.ts
@@ -38491,7 +38633,12 @@ async function reviewPr(repoRoot2, options2) {
38491
38633
  if (!synthesisOk && options2.ci)
38492
38634
  exitFailedCiReview(outcome.failures, options2.ci);
38493
38635
  if (synthesisOk && options2.ci)
38494
- writeJobSummary(paths.synthesisPath, context, options2.ci.summaryPath);
38636
+ writeJobSummary(
38637
+ paths.synthesisPath,
38638
+ context,
38639
+ options2.ci.summaryPath,
38640
+ outcome.slots
38641
+ );
38495
38642
  if (synthesisOk)
38496
38643
  await runPostSynthesis(paths.synthesisPath, context, options2);
38497
38644
  console.log(`Done. Review folder: ${paths.reviewDir}`);
@@ -38983,16 +39130,16 @@ function filterToSql(filter) {
38983
39130
  }
38984
39131
 
38985
39132
  // src/commands/seq/fetchSeqData.ts
38986
- function buildDataParams(filter, count8, from, to) {
39133
+ function buildDataParams(filter, count9, from, to) {
38987
39134
  const sqlFilter = filterToSql(filter);
38988
- const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count8}`;
39135
+ const sql29 = `select @Timestamp, @Level, @Exception, @Message from stream where ${sqlFilter} order by @Timestamp desc limit ${count9}`;
38989
39136
  const params = new URLSearchParams({ q: sql29 });
38990
39137
  if (from) params.set("rangeStartUtc", from);
38991
39138
  if (to) params.set("rangeEndUtc", to);
38992
39139
  return params;
38993
39140
  }
38994
- async function fetchSeqData(conn, filter, count8, from, to) {
38995
- const params = buildDataParams(filter, count8, from, to);
39141
+ async function fetchSeqData(conn, filter, count9, from, to) {
39142
+ const params = buildDataParams(filter, count9, from, to);
38996
39143
  const response = await fetchSeq(conn, "/api/data", params);
38997
39144
  const data = await response.json();
38998
39145
  return mapDataToEvents(data);
@@ -39014,12 +39161,12 @@ function mapDataToEvents(data) {
39014
39161
  const levelIdx = col("Level");
39015
39162
  const exIdx = col("Exception");
39016
39163
  const msgIdx = col("Message");
39017
- return data.Rows.map((row2) => ({
39018
- Timestamp: ticksToIso(row2[tsIdx]),
39019
- Level: String(row2[levelIdx] ?? ""),
39020
- Exception: row2[exIdx] != null ? String(row2[exIdx]) : void 0,
39164
+ return data.Rows.map((row3) => ({
39165
+ Timestamp: ticksToIso(row3[tsIdx]),
39166
+ Level: String(row3[levelIdx] ?? ""),
39167
+ Exception: row3[exIdx] != null ? String(row3[exIdx]) : void 0,
39021
39168
  Properties: [],
39022
- MessageTemplateTokens: [{ Text: String(row2[msgIdx] ?? "") }]
39169
+ MessageTemplateTokens: [{ Text: String(row3[msgIdx] ?? "") }]
39023
39170
  }));
39024
39171
  }
39025
39172
 
@@ -39159,12 +39306,12 @@ function resolveConnection2(name) {
39159
39306
  async function seqQuery(filter, options2) {
39160
39307
  rejectTimestampFilter(filter);
39161
39308
  const conn = resolveConnection2(options2.connection);
39162
- const count8 = Number.parseInt(options2.count ?? "1000", 10);
39309
+ const count9 = Number.parseInt(options2.count ?? "1000", 10);
39163
39310
  const from = options2.from ? parseRelativeTime(options2.from) : void 0;
39164
39311
  const to = options2.to ? parseRelativeTime(options2.to) : void 0;
39165
- const events = from || to ? await fetchSeqData(conn, filter, count8, from, to) : await fetchSeqEvents(
39312
+ const events = from || to ? await fetchSeqData(conn, filter, count9, from, to) : await fetchSeqEvents(
39166
39313
  conn,
39167
- new URLSearchParams({ filter, count: String(count8) })
39314
+ new URLSearchParams({ filter, count: String(count9) })
39168
39315
  );
39169
39316
  if (events.length === 0) {
39170
39317
  console.log(chalk251.yellow("No events found."));
@@ -39180,10 +39327,10 @@ async function seqQuery(filter, options2) {
39180
39327
  }
39181
39328
  console.log(chalk251.dim(`
39182
39329
  ${events.length} events`));
39183
- if (events.length >= count8) {
39330
+ if (events.length >= count9) {
39184
39331
  console.log(
39185
39332
  chalk251.yellow(
39186
- `Results limited to ${count8}. Use --count to retrieve more.`
39333
+ `Results limited to ${count9}. Use --count to retrieve more.`
39187
39334
  )
39188
39335
  );
39189
39336
  }
@@ -39560,8 +39707,8 @@ function printTable(rows) {
39560
39707
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
39561
39708
  console.log(chalk255.dim(header));
39562
39709
  console.log(chalk255.dim("-".repeat(header.length)));
39563
- for (const row2 of rows) {
39564
- const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
39710
+ for (const row3 of rows) {
39711
+ const line = columns.map((c, i) => formatCell(row3[c]).padEnd(widths[i])).join(" ");
39565
39712
  console.log(line);
39566
39713
  }
39567
39714
  console.log(chalk255.dim(`
@@ -39945,13 +40092,13 @@ description: ${quoteYaml(description)}
39945
40092
  }
39946
40093
  function syncCodex(claudeDir, options2) {
39947
40094
  if (!isHarnessAvailable("codex")) return;
39948
- const { total, names } = installHarnessCommands(
40095
+ const { total: total2, names } = installHarnessCommands(
39949
40096
  claudeDir,
39950
40097
  harnesses.codex,
39951
40098
  commandToSkill
39952
40099
  );
39953
40100
  syncCodexHooks(path95.join(claudeDir, "..", "codex", "config.toml"));
39954
- console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
40101
+ console.log(`Synced ${total2} skill(s) to ~/.codex/skills`);
39955
40102
  if (!options2?.prune) return;
39956
40103
  const force = options2.force ?? false;
39957
40104
  reportPrune(
@@ -40462,21 +40609,21 @@ var FORMATS = ["md", "vtt"];
40462
40609
  function isCleanFormat(value) {
40463
40610
  return FORMATS.includes(value);
40464
40611
  }
40465
- function serialise(cues, format2, timestamps) {
40466
- return format2 === "vtt" ? formatVtt(cues) : formatChatLog(cuesToChatMessages(cues), { timestamps });
40612
+ function serialise(cues, format3, timestamps) {
40613
+ return format3 === "vtt" ? formatVtt(cues) : formatChatLog(cuesToChatMessages(cues), { timestamps });
40467
40614
  }
40468
40615
  function clean(file, options2 = {}) {
40469
- const format2 = options2.format ?? "md";
40470
- if (!isCleanFormat(format2)) {
40616
+ const format3 = options2.format ?? "md";
40617
+ if (!isCleanFormat(format3)) {
40471
40618
  console.error(
40472
- `Error: --format must be one of: ${FORMATS.join(", ")} (got: ${format2})`
40619
+ `Error: --format must be one of: ${FORMATS.join(", ")} (got: ${format3})`
40473
40620
  );
40474
40621
  process.exit(1);
40475
40622
  }
40476
40623
  const timestamps = options2.timestamps ?? false;
40477
- if (timestamps && format2 !== "md") {
40624
+ if (timestamps && format3 !== "md") {
40478
40625
  console.error(
40479
- `Error: --timestamps applies only to --format md (got: ${format2})`
40626
+ `Error: --timestamps applies only to --format md (got: ${format3})`
40480
40627
  );
40481
40628
  process.exit(1);
40482
40629
  }
@@ -40489,7 +40636,7 @@ function clean(file, options2 = {}) {
40489
40636
  console.error(`Error: no cues found in: ${file}`);
40490
40637
  process.exit(1);
40491
40638
  }
40492
- console.log(serialise(cues, format2, timestamps));
40639
+ console.log(serialise(cues, format3, timestamps));
40493
40640
  }
40494
40641
 
40495
40642
  // src/commands/transcript/shared.ts
@@ -40950,10 +41097,10 @@ function closesBlock(trimmed, from) {
40950
41097
  }
40951
41098
  function csharpHeaderLineCount(content) {
40952
41099
  const lines2 = content.split("\n");
40953
- let count8 = 0;
41100
+ let count9 = 0;
40954
41101
  let inBlock = false;
40955
- while (count8 < lines2.length) {
40956
- const trimmed = lines2[count8].trim();
41102
+ while (count9 < lines2.length) {
41103
+ const trimmed = lines2[count9].trim();
40957
41104
  if (inBlock) {
40958
41105
  inBlock = !closesBlock(trimmed, 0);
40959
41106
  } else if (trimmed.startsWith("/*")) {
@@ -40961,9 +41108,9 @@ function csharpHeaderLineCount(content) {
40961
41108
  } else if (trimmed !== "" && !trimmed.startsWith("//")) {
40962
41109
  break;
40963
41110
  }
40964
- count8++;
41111
+ count9++;
40965
41112
  }
40966
- return count8;
41113
+ return count9;
40967
41114
  }
40968
41115
 
40969
41116
  // src/commands/verify/blockCodeComments/collectCsharpComments.ts
@@ -41736,9 +41883,9 @@ async function watchLoop() {
41736
41883
  }
41737
41884
 
41738
41885
  // src/commands/watch/readRecentCommits.ts
41739
- function readRecentCommits(count8 = 10, cwd) {
41886
+ function readRecentCommits(count9 = 10, cwd) {
41740
41887
  const output = runGit3(
41741
- ["log", `-${count8}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
41888
+ ["log", `-${count9}`, "--pretty=format:%H%x09%h%x09%ar%x09%s"],
41742
41889
  cwd
41743
41890
  );
41744
41891
  if (!output) return [];
@@ -42206,10 +42353,10 @@ function consumeSimulatedDivergence(cwd) {
42206
42353
  }
42207
42354
 
42208
42355
  // src/commands/watch/detectMovement.ts
42209
- function detectMovement(from, to, count8) {
42356
+ function detectMovement(from, to, count9) {
42210
42357
  if (from === to) return void 0;
42211
- if (!Number.isFinite(count8) || count8 <= 0) return void 0;
42212
- return { from, to, count: count8 };
42358
+ if (!Number.isFinite(count9) || count9 <= 0) return void 0;
42359
+ return { from, to, count: count9 };
42213
42360
  }
42214
42361
 
42215
42362
  // src/commands/watch/readMovement.ts
@@ -42217,8 +42364,8 @@ function readMovement(cwd) {
42217
42364
  try {
42218
42365
  const from = runGit3(["rev-parse", "@"], cwd);
42219
42366
  const to = runGit3(["rev-parse", "@{u}"], cwd);
42220
- const count8 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42221
- return detectMovement(from, to, count8);
42367
+ const count9 = Number(runGit3(["rev-list", "--count", "@..@{u}"], cwd));
42368
+ return detectMovement(from, to, count9);
42222
42369
  } catch {
42223
42370
  return void 0;
42224
42371
  }
@@ -43142,9 +43289,9 @@ async function drainDaemon(options2 = {}) {
43142
43289
  return;
43143
43290
  }
43144
43291
  }
43145
- const count8 = await requestDrain(socket, lines2);
43292
+ const count9 = await requestDrain(socket, lines2);
43146
43293
  socket.destroy();
43147
- console.log(`Drained ${count8} session(s)`);
43294
+ console.log(`Drained ${count9} session(s)`);
43148
43295
  }
43149
43296
  function reportLive(live) {
43150
43297
  console.log(`${live.length} live session(s) would be closed:`);
@@ -43209,11 +43356,11 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43209
43356
  inFlight2 = true;
43210
43357
  try {
43211
43358
  const before = JSON.stringify(readRepoConfigCache());
43212
- const count8 = await refreshRepoConfigCache();
43359
+ const count9 = await refreshRepoConfigCache();
43213
43360
  if (failing) daemonLog("repo config cache poll recovered");
43214
43361
  failing = false;
43215
43362
  if (JSON.stringify(readRepoConfigCache()) !== before)
43216
- daemonLog(`repo config cache updated (${count8} repos)`);
43363
+ daemonLog(`repo config cache updated (${count9} repos)`);
43217
43364
  } catch (error) {
43218
43365
  if (!failing)
43219
43366
  daemonLog(
@@ -43232,8 +43379,8 @@ function pollRepoConfigCache(intervalMs = POLL_MS) {
43232
43379
  // src/commands/sessions/daemon/refreshRepoConfigCacheOnStart.ts
43233
43380
  async function refreshRepoConfigCacheOnStart() {
43234
43381
  try {
43235
- const count8 = await refreshRepoConfigCache();
43236
- daemonLog(`repo config cache refreshed (${count8} repos)`);
43382
+ const count9 = await refreshRepoConfigCache();
43383
+ daemonLog(`repo config cache refreshed (${count9} repos)`);
43237
43384
  } catch (error) {
43238
43385
  daemonLog(
43239
43386
  `repo config cache refresh failed; keeping the last snapshot: ${String(error)}`
@@ -45525,10 +45672,10 @@ function applyReviewPause(session, activity2) {
45525
45672
  // src/shared/db/getPhaseActiveMs.ts
45526
45673
  import { and as and20, eq as eq46 } from "drizzle-orm";
45527
45674
  async function getPhaseActiveMs(db, itemId2, phaseIdx) {
45528
- const [row2] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
45675
+ const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
45529
45676
  and20(eq46(phaseUsage.itemId, itemId2), eq46(phaseUsage.phaseIdx, phaseIdx))
45530
45677
  );
45531
- return row2?.activeMs ?? 0;
45678
+ return row3?.activeMs ?? 0;
45532
45679
  }
45533
45680
 
45534
45681
  // src/commands/sessions/daemon/loadPhaseActiveMs.ts
@@ -50386,10 +50533,10 @@ async function requestSessionOutput(target) {
50386
50533
  }
50387
50534
 
50388
50535
  // src/commands/sessions/lastLines.ts
50389
- function lastLines(scrollback, count8) {
50536
+ function lastLines(scrollback, count9) {
50390
50537
  const lines2 = stripAnsi(scrollback).split(/\r?\n/);
50391
50538
  if (lines2.at(-1) === "") lines2.pop();
50392
- return lines2.slice(-count8);
50539
+ return lines2.slice(-count9);
50393
50540
  }
50394
50541
 
50395
50542
  // src/commands/sessions/sessionOutput.ts
@@ -50409,14 +50556,14 @@ function resolveTarget3(sessionId, server) {
50409
50556
  return { sessionId };
50410
50557
  }
50411
50558
  async function sessionOutput(sessionId, options2) {
50412
- const count8 = Number.parseInt(options2.lines, 10);
50413
- if (!Number.isInteger(count8) || count8 < 1)
50559
+ const count9 = Number.parseInt(options2.lines, 10);
50560
+ if (!Number.isInteger(count9) || count9 < 1)
50414
50561
  return fail7(`-n must be a positive integer, got ${options2.lines}`);
50415
50562
  const target = resolveTarget3(sessionId, options2.server);
50416
50563
  if (typeof target === "string") return fail7(target);
50417
50564
  try {
50418
50565
  const scrollback = await requestSessionOutput(target);
50419
- for (const line of lastLines(scrollback, count8)) console.log(line);
50566
+ for (const line of lastLines(scrollback, count9)) console.log(line);
50420
50567
  } catch (error) {
50421
50568
  fail7(error instanceof Error ? error.message : String(error));
50422
50569
  }