@staff0rd/assist 0.305.4 → 0.306.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.305.4",
9
+ version: "0.306.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -4972,7 +4972,7 @@ async function loadVisibleItems(req) {
4972
4972
  return loaded.filter((item) => !completedStatuses.has(item.status));
4973
4973
  }
4974
4974
 
4975
- // src/commands/backlog/web/parseItemBody.ts
4975
+ // src/commands/backlog/web/parseStatusBody.ts
4976
4976
  function readBody(req) {
4977
4977
  return new Promise((resolve16, reject) => {
4978
4978
  let body = "";
@@ -4983,9 +4983,6 @@ function readBody(req) {
4983
4983
  req.on("error", reject);
4984
4984
  });
4985
4985
  }
4986
- async function parseItemBody(req) {
4987
- return JSON.parse(await readBody(req));
4988
- }
4989
4986
  async function parseStatusBody(req) {
4990
4987
  return JSON.parse(await readBody(req));
4991
4988
  }
@@ -5099,22 +5096,6 @@ function validateRewind(item, plan2, phase) {
5099
5096
  return void 0;
5100
5097
  }
5101
5098
 
5102
- // src/commands/backlog/web/updateItem.ts
5103
- import { eq as eq15 } from "drizzle-orm";
5104
- async function updateItem(req, res, id2) {
5105
- const body = await parseItemBody(req);
5106
- const result = await findItemOr404(res, id2);
5107
- if (!result) return;
5108
- const { orm } = result;
5109
- await orm.update(items).set({
5110
- type: body.type ?? result.item.type,
5111
- name: body.name,
5112
- description: body.description ?? null,
5113
- acceptanceCriteria: JSON.stringify(body.acceptanceCriteria ?? [])
5114
- }).where(eq15(items.id, id2));
5115
- respondJson(res, 200, await loadItem(orm, id2));
5116
- }
5117
-
5118
5099
  // src/commands/backlog/web/handleItemRoute.ts
5119
5100
  var id = (match, group = 1) => Number.parseInt(match[group], 10);
5120
5101
  var routes = [
@@ -5138,11 +5119,6 @@ var routes = [
5138
5119
  method: "GET",
5139
5120
  run: (_req, res, m) => getItemById(res, id(m))
5140
5121
  },
5141
- {
5142
- pattern: /^\/api\/items\/(\d+)$/,
5143
- method: "PUT",
5144
- run: (req, res, m) => updateItem(req, res, id(m))
5145
- },
5146
5122
  {
5147
5123
  pattern: /^\/api\/items\/(\d+)$/,
5148
5124
  method: "PATCH",
@@ -6486,22 +6462,22 @@ async function add(options2) {
6486
6462
  import chalk58 from "chalk";
6487
6463
 
6488
6464
  // src/commands/backlog/insertPhaseAt.ts
6489
- import { count, eq as eq17 } from "drizzle-orm";
6465
+ import { count, eq as eq16 } from "drizzle-orm";
6490
6466
 
6491
6467
  // src/commands/backlog/shiftPhasesUp.ts
6492
- import { and as and3, desc as desc2, eq as eq16, gte } from "drizzle-orm";
6468
+ import { and as and3, desc as desc2, eq as eq15, gte } from "drizzle-orm";
6493
6469
  async function shiftPhasesUp(db, itemId, fromIdx) {
6494
- const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and3(eq16(planPhases.itemId, itemId), gte(planPhases.idx, fromIdx))).orderBy(desc2(planPhases.idx));
6470
+ const toShift = await db.select({ idx: planPhases.idx }).from(planPhases).where(and3(eq15(planPhases.itemId, itemId), gte(planPhases.idx, fromIdx))).orderBy(desc2(planPhases.idx));
6495
6471
  for (const p of toShift) {
6496
- await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and3(eq16(planTasks.itemId, itemId), eq16(planTasks.phaseIdx, p.idx)));
6497
- await db.update(planPhases).set({ idx: p.idx + 1 }).where(and3(eq16(planPhases.itemId, itemId), eq16(planPhases.idx, p.idx)));
6472
+ await db.update(planTasks).set({ phaseIdx: p.idx + 1 }).where(and3(eq15(planTasks.itemId, itemId), eq15(planTasks.phaseIdx, p.idx)));
6473
+ await db.update(planPhases).set({ idx: p.idx + 1 }).where(and3(eq15(planPhases.itemId, itemId), eq15(planPhases.idx, p.idx)));
6498
6474
  }
6499
6475
  }
6500
6476
 
6501
6477
  // src/commands/backlog/insertPhaseAt.ts
6502
6478
  async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, currentPhase) {
6503
6479
  await orm.transaction(async (tx) => {
6504
- const [row] = await tx.select({ cnt: count() }).from(planPhases).where(eq17(planPhases.itemId, itemId));
6480
+ const [row] = await tx.select({ cnt: count() }).from(planPhases).where(eq16(planPhases.itemId, itemId));
6505
6481
  const phaseCount = row?.cnt ?? 0;
6506
6482
  await shiftPhasesUp(tx, itemId, phaseIdx);
6507
6483
  await tx.insert(planPhases).values({ itemId, idx: phaseIdx, name, manualChecks });
@@ -6510,16 +6486,16 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
6510
6486
  }
6511
6487
  if (currentPhase !== void 0 && currentPhase - 1 >= phaseIdx) {
6512
6488
  const atReviewSlot = currentPhase - 1 >= phaseCount;
6513
- await tx.update(items).set({ currentPhase: atReviewSlot ? phaseIdx + 1 : currentPhase + 1 }).where(eq17(items.id, itemId));
6489
+ await tx.update(items).set({ currentPhase: atReviewSlot ? phaseIdx + 1 : currentPhase + 1 }).where(eq16(items.id, itemId));
6514
6490
  }
6515
6491
  });
6516
6492
  }
6517
6493
 
6518
6494
  // src/commands/backlog/resolveInsertPosition.ts
6519
6495
  import chalk57 from "chalk";
6520
- import { count as count2, eq as eq18 } from "drizzle-orm";
6496
+ import { count as count2, eq as eq17 } from "drizzle-orm";
6521
6497
  async function resolveInsertPosition(orm, itemId, position) {
6522
- const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq18(planPhases.itemId, itemId));
6498
+ const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq17(planPhases.itemId, itemId));
6523
6499
  const phaseCount = row?.cnt ?? 0;
6524
6500
  if (position === void 0) return phaseCount;
6525
6501
  const pos = Number.parseInt(position, 10);
@@ -6680,9 +6656,9 @@ function hasCycle(adjacency, fromId, toId) {
6680
6656
  }
6681
6657
 
6682
6658
  // src/commands/backlog/loadDependencyGraph.ts
6683
- import { eq as eq19 } from "drizzle-orm";
6659
+ import { eq as eq18 } from "drizzle-orm";
6684
6660
  async function loadDependencyGraph(orm) {
6685
- const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq19(links.type, "depends-on"));
6661
+ const rows = await orm.select({ itemId: links.itemId, targetId: links.targetId }).from(links).where(eq18(links.type, "depends-on"));
6686
6662
  const graph = /* @__PURE__ */ new Map();
6687
6663
  for (const { itemId, targetId } of rows) {
6688
6664
  const bucket = graph.get(itemId);
@@ -6745,7 +6721,7 @@ async function link(fromId, toId, opts) {
6745
6721
 
6746
6722
  // src/commands/backlog/unlink.ts
6747
6723
  import chalk62 from "chalk";
6748
- import { and as and4, eq as eq20 } from "drizzle-orm";
6724
+ import { and as and4, eq as eq19 } from "drizzle-orm";
6749
6725
  async function unlink(fromId, toId) {
6750
6726
  const fromNum = Number.parseInt(fromId, 10);
6751
6727
  const toNum = Number.parseInt(toId, 10);
@@ -6763,7 +6739,7 @@ async function unlink(fromId, toId) {
6763
6739
  console.log(chalk62.yellow(`No link from #${fromId} to #${toId} found.`));
6764
6740
  return;
6765
6741
  }
6766
- await orm.delete(links).where(and4(eq20(links.itemId, fromNum), eq20(links.targetId, toNum)));
6742
+ await orm.delete(links).where(and4(eq19(links.itemId, fromNum), eq19(links.targetId, toNum)));
6767
6743
  console.log(chalk62.green(`Removed link from #${fromId} to #${toId}.`));
6768
6744
  }
6769
6745
 
@@ -6779,7 +6755,7 @@ function registerLinkCommands(cmd) {
6779
6755
 
6780
6756
  // src/commands/backlog/move-repo/index.ts
6781
6757
  import chalk64 from "chalk";
6782
- import { eq as eq22 } from "drizzle-orm";
6758
+ import { eq as eq21 } from "drizzle-orm";
6783
6759
 
6784
6760
  // src/commands/backlog/move-repo/confirmMove.ts
6785
6761
  import chalk63 from "chalk";
@@ -6794,9 +6770,9 @@ async function confirmMove(cnt, oldOrigin, newOrigin) {
6794
6770
  }
6795
6771
 
6796
6772
  // src/commands/backlog/move-repo/countByOrigin.ts
6797
- import { count as count3, eq as eq21 } from "drizzle-orm";
6773
+ import { count as count3, eq as eq20 } from "drizzle-orm";
6798
6774
  async function countByOrigin(orm, origin) {
6799
- const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq21(items.origin, origin));
6775
+ const [{ cnt }] = await orm.select({ cnt: count3() }).from(items).where(eq20(items.origin, origin));
6800
6776
  return cnt;
6801
6777
  }
6802
6778
 
@@ -6839,7 +6815,7 @@ async function moveRepo(oldOriginRaw, newOriginRaw, options2 = {}) {
6839
6815
  console.log(chalk64.yellow("Move cancelled; no changes made."));
6840
6816
  return;
6841
6817
  }
6842
- await orm.update(items).set({ origin: newOrigin }).where(eq22(items.origin, oldOrigin));
6818
+ await orm.update(items).set({ origin: newOrigin }).where(eq21(items.origin, oldOrigin));
6843
6819
  console.log(
6844
6820
  chalk64.green(
6845
6821
  `Moved ${pluralItems(cnt)} from "${oldOrigin}" to "${newOrigin}".`
@@ -7173,10 +7149,10 @@ async function start(id2) {
7173
7149
 
7174
7150
  // src/commands/backlog/stop/index.ts
7175
7151
  import chalk75 from "chalk";
7176
- import { and as and5, eq as eq23 } from "drizzle-orm";
7152
+ import { and as and5, eq as eq22 } from "drizzle-orm";
7177
7153
  async function stop() {
7178
7154
  const { orm } = await getReady();
7179
- const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and5(eq23(items.status, "in-progress"), eq23(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
7155
+ const stopped = await orm.update(items).set({ status: "todo", currentPhase: 1 }).where(and5(eq22(items.status, "in-progress"), eq22(items.origin, getOrigin()))).returning({ id: items.id, name: items.name });
7180
7156
  if (stopped.length === 0) {
7181
7157
  console.log(chalk75.yellow("No in-progress items to stop."));
7182
7158
  return;
@@ -7222,18 +7198,18 @@ function registerStatusCommands(cmd) {
7222
7198
 
7223
7199
  // src/commands/backlog/removePhase.ts
7224
7200
  import chalk79 from "chalk";
7225
- import { and as and8, eq as eq26 } from "drizzle-orm";
7201
+ import { and as and8, eq as eq25 } from "drizzle-orm";
7226
7202
 
7227
7203
  // src/commands/backlog/findPhase.ts
7228
7204
  import chalk78 from "chalk";
7229
- import { and as and6, count as count4, eq as eq24 } from "drizzle-orm";
7205
+ import { and as and6, count as count4, eq as eq23 } from "drizzle-orm";
7230
7206
  async function findPhase(id2, phase) {
7231
7207
  const found = await findOneItem(id2);
7232
7208
  if (!found) return void 0;
7233
7209
  const { orm, item } = found;
7234
7210
  const itemId = item.id;
7235
7211
  const phaseIdx = Number.parseInt(phase, 10) - 1;
7236
- const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and6(eq24(planPhases.itemId, itemId), eq24(planPhases.idx, phaseIdx)));
7212
+ const [row] = await orm.select({ cnt: count4() }).from(planPhases).where(and6(eq23(planPhases.itemId, itemId), eq23(planPhases.idx, phaseIdx)));
7237
7213
  if (!row || row.cnt === 0) {
7238
7214
  console.log(
7239
7215
  chalk78.red(`Phase ${phaseIdx + 1} not found on item #${itemId}.`)
@@ -7245,14 +7221,14 @@ async function findPhase(id2, phase) {
7245
7221
  }
7246
7222
 
7247
7223
  // src/commands/backlog/reindexPhases.ts
7248
- import { and as and7, asc as asc6, count as count5, eq as eq25 } from "drizzle-orm";
7224
+ import { and as and7, asc as asc6, count as count5, eq as eq24 } from "drizzle-orm";
7249
7225
  async function reindexPhases(db, itemId) {
7250
- const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq25(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
7226
+ const remaining = await db.select({ idx: planPhases.idx }).from(planPhases).where(eq24(planPhases.itemId, itemId)).orderBy(asc6(planPhases.idx));
7251
7227
  for (let i = 0; i < remaining.length; i++) {
7252
7228
  const oldIdx = remaining[i].idx;
7253
7229
  if (oldIdx === i) continue;
7254
- await db.update(planTasks).set({ phaseIdx: i }).where(and7(eq25(planTasks.itemId, itemId), eq25(planTasks.phaseIdx, oldIdx)));
7255
- await db.update(planPhases).set({ idx: i }).where(and7(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, oldIdx)));
7230
+ await db.update(planTasks).set({ phaseIdx: i }).where(and7(eq24(planTasks.itemId, itemId), eq24(planTasks.phaseIdx, oldIdx)));
7231
+ await db.update(planPhases).set({ idx: i }).where(and7(eq24(planPhases.itemId, itemId), eq24(planPhases.idx, oldIdx)));
7256
7232
  }
7257
7233
  }
7258
7234
  async function adjustCurrentPhase(db, item, removedIdx) {
@@ -7260,13 +7236,13 @@ async function adjustCurrentPhase(db, item, removedIdx) {
7260
7236
  if (currentPhase === void 0) return;
7261
7237
  const currentIdx = currentPhase - 1;
7262
7238
  if (removedIdx < currentIdx) {
7263
- await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq25(items.id, item.id));
7239
+ await db.update(items).set({ currentPhase: currentPhase - 1 }).where(eq24(items.id, item.id));
7264
7240
  return;
7265
7241
  }
7266
7242
  if (removedIdx !== currentIdx) return;
7267
- const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq25(planPhases.itemId, item.id));
7243
+ const [row] = await db.select({ cnt: count5() }).from(planPhases).where(eq24(planPhases.itemId, item.id));
7268
7244
  const cnt = row?.cnt ?? 0;
7269
- await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq25(items.id, item.id));
7245
+ await db.update(items).set({ currentPhase: cnt === 0 ? null : Math.min(currentPhase, cnt) }).where(eq24(items.id, item.id));
7270
7246
  }
7271
7247
 
7272
7248
  // src/commands/backlog/removePhase.ts
@@ -7276,9 +7252,9 @@ async function removePhase(id2, phase) {
7276
7252
  const { item, orm, itemId, phaseIdx } = found;
7277
7253
  await orm.transaction(async (tx) => {
7278
7254
  await tx.delete(planTasks).where(
7279
- and8(eq26(planTasks.itemId, itemId), eq26(planTasks.phaseIdx, phaseIdx))
7255
+ and8(eq25(planTasks.itemId, itemId), eq25(planTasks.phaseIdx, phaseIdx))
7280
7256
  );
7281
- await tx.delete(planPhases).where(and8(eq26(planPhases.itemId, itemId), eq26(planPhases.idx, phaseIdx)));
7257
+ await tx.delete(planPhases).where(and8(eq25(planPhases.itemId, itemId), eq25(planPhases.idx, phaseIdx)));
7282
7258
  await reindexPhases(tx, itemId);
7283
7259
  await adjustCurrentPhase(tx, item, phaseIdx);
7284
7260
  });
@@ -7289,7 +7265,7 @@ async function removePhase(id2, phase) {
7289
7265
 
7290
7266
  // src/commands/backlog/update/index.ts
7291
7267
  import chalk81 from "chalk";
7292
- import { eq as eq27 } from "drizzle-orm";
7268
+ import { eq as eq26 } from "drizzle-orm";
7293
7269
 
7294
7270
  // src/commands/backlog/update/parseListIndex.ts
7295
7271
  function parseListIndex(raw, length, label2) {
@@ -7423,7 +7399,7 @@ async function update(id2, options2) {
7423
7399
  if (!built) return;
7424
7400
  const { orm } = found;
7425
7401
  const itemId = found.item.id;
7426
- await orm.update(items).set(built.set).where(eq27(items.id, itemId));
7402
+ await orm.update(items).set(built.set).where(eq26(items.id, itemId));
7427
7403
  console.log(chalk81.green(`Updated ${built.fields} on item #${itemId}.`));
7428
7404
  }
7429
7405
 
@@ -7431,22 +7407,22 @@ async function update(id2, options2) {
7431
7407
  import chalk82 from "chalk";
7432
7408
 
7433
7409
  // src/commands/backlog/applyPhaseUpdate.ts
7434
- import { and as and9, eq as eq28 } from "drizzle-orm";
7410
+ import { and as and9, eq as eq27 } from "drizzle-orm";
7435
7411
  async function applyPhaseUpdate(orm, itemId, phaseIdx, fields) {
7436
7412
  await orm.transaction(async (tx) => {
7437
7413
  if (fields.name) {
7438
7414
  await tx.update(planPhases).set({ name: fields.name }).where(
7439
- and9(eq28(planPhases.itemId, itemId), eq28(planPhases.idx, phaseIdx))
7415
+ and9(eq27(planPhases.itemId, itemId), eq27(planPhases.idx, phaseIdx))
7440
7416
  );
7441
7417
  }
7442
7418
  if (fields.manualCheck) {
7443
7419
  await tx.update(planPhases).set({ manualChecks: JSON.stringify(fields.manualCheck) }).where(
7444
- and9(eq28(planPhases.itemId, itemId), eq28(planPhases.idx, phaseIdx))
7420
+ and9(eq27(planPhases.itemId, itemId), eq27(planPhases.idx, phaseIdx))
7445
7421
  );
7446
7422
  }
7447
7423
  if (fields.task) {
7448
7424
  await tx.delete(planTasks).where(
7449
- and9(eq28(planTasks.itemId, itemId), eq28(planTasks.phaseIdx, phaseIdx))
7425
+ and9(eq27(planTasks.itemId, itemId), eq27(planTasks.phaseIdx, phaseIdx))
7450
7426
  );
7451
7427
  if (fields.task.length) {
7452
7428
  await tx.insert(planTasks).values(
@@ -10755,9 +10731,9 @@ function registerGithub(program2) {
10755
10731
  }
10756
10732
 
10757
10733
  // src/commands/handover/countPendingHandovers.ts
10758
- import { and as and10, eq as eq29, isNull, sql as sql3 } from "drizzle-orm";
10734
+ import { and as and10, eq as eq28, isNull, sql as sql3 } from "drizzle-orm";
10759
10735
  async function countPendingHandovers(orm, origin) {
10760
- const [row] = await orm.select({ count: sql3`count(*)::int` }).from(handovers).where(and10(eq29(handovers.origin, origin), isNull(handovers.recalledAt)));
10736
+ const [row] = await orm.select({ count: sql3`count(*)::int` }).from(handovers).where(and10(eq28(handovers.origin, origin), isNull(handovers.recalledAt)));
10761
10737
  return row?.count ?? 0;
10762
10738
  }
10763
10739
 
@@ -10897,13 +10873,13 @@ async function load(options2 = {}) {
10897
10873
  }
10898
10874
 
10899
10875
  // src/commands/handover/listPendingHandovers.ts
10900
- import { and as and11, desc as desc3, eq as eq30, isNull as isNull2 } from "drizzle-orm";
10876
+ import { and as and11, desc as desc3, eq as eq29, isNull as isNull2 } from "drizzle-orm";
10901
10877
  async function listPendingHandovers(orm, origin) {
10902
10878
  return orm.select({
10903
10879
  id: handovers.id,
10904
10880
  summary: handovers.summary,
10905
10881
  createdAt: handovers.createdAt
10906
- }).from(handovers).where(and11(eq30(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc3(handovers.createdAt), desc3(handovers.id));
10882
+ }).from(handovers).where(and11(eq29(handovers.origin, origin), isNull2(handovers.recalledAt))).orderBy(desc3(handovers.createdAt), desc3(handovers.id));
10907
10883
  }
10908
10884
 
10909
10885
  // src/commands/handover/printPendingHandovers.ts
@@ -10916,17 +10892,17 @@ async function printPendingHandovers() {
10916
10892
  }
10917
10893
 
10918
10894
  // src/commands/handover/recallHandover.ts
10919
- import { and as and12, desc as desc4, eq as eq31, isNull as isNull3 } from "drizzle-orm";
10895
+ import { and as and12, desc as desc4, eq as eq30, isNull as isNull3 } from "drizzle-orm";
10920
10896
  async function recallHandover(orm, origin, id2) {
10921
10897
  const [row] = await orm.select().from(handovers).where(
10922
10898
  and12(
10923
- eq31(handovers.origin, origin),
10899
+ eq30(handovers.origin, origin),
10924
10900
  isNull3(handovers.recalledAt),
10925
- ...id2 === void 0 ? [] : [eq31(handovers.id, id2)]
10901
+ ...id2 === void 0 ? [] : [eq30(handovers.id, id2)]
10926
10902
  )
10927
10903
  ).orderBy(desc4(handovers.createdAt), desc4(handovers.id)).limit(1);
10928
10904
  if (!row) return void 0;
10929
- await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq31(handovers.id, row.id));
10905
+ await orm.update(handovers).set({ recalledAt: /* @__PURE__ */ new Date() }).where(eq30(handovers.id, row.id));
10930
10906
  return row.content;
10931
10907
  }
10932
10908
 
@@ -11356,8 +11332,196 @@ function registerMermaid(program2) {
11356
11332
  );
11357
11333
  }
11358
11334
 
11359
- // src/commands/news/add/index.ts
11335
+ // src/commands/netcap/netcap.ts
11336
+ import { mkdir } from "fs/promises";
11337
+ import { createServer as createServer2 } from "http";
11338
+ import { dirname as dirname20 } from "path";
11339
+ import chalk124 from "chalk";
11340
+
11341
+ // src/commands/netcap/corsHeaders.ts
11342
+ var corsHeaders = {
11343
+ "Access-Control-Allow-Origin": "*",
11344
+ "Access-Control-Allow-Methods": "POST, GET, OPTIONS",
11345
+ "Access-Control-Allow-Headers": "Content-Type",
11346
+ "Access-Control-Max-Age": "86400"
11347
+ };
11348
+
11349
+ // src/commands/netcap/handleNetcapPost.ts
11350
+ import { appendFile } from "fs/promises";
11351
+
11352
+ // src/commands/netcap/parseNetcapEntry.ts
11353
+ function parseNetcapEntry(body) {
11354
+ try {
11355
+ const parsed = JSON.parse(body);
11356
+ if (typeof parsed !== "object" || parsed === null) return null;
11357
+ return parsed;
11358
+ } catch {
11359
+ return null;
11360
+ }
11361
+ }
11362
+
11363
+ // src/commands/netcap/handleNetcapPost.ts
11364
+ function handleNetcapPost(req, res, options2) {
11365
+ let body = "";
11366
+ req.on("data", (chunk) => {
11367
+ body += chunk;
11368
+ });
11369
+ req.on("end", () => {
11370
+ const entry = parseNetcapEntry(body);
11371
+ if (!entry) {
11372
+ res.writeHead(400, corsHeaders);
11373
+ res.end();
11374
+ return;
11375
+ }
11376
+ void appendFile(options2.outPath, `${JSON.stringify(entry)}
11377
+ `).then(() => {
11378
+ options2.onCapture?.(entry);
11379
+ res.writeHead(200, {
11380
+ ...corsHeaders,
11381
+ "Content-Type": "application/json"
11382
+ });
11383
+ res.end(JSON.stringify({ ok: true }));
11384
+ }).catch((error) => {
11385
+ res.writeHead(500, corsHeaders);
11386
+ res.end(String(error));
11387
+ });
11388
+ });
11389
+ }
11390
+
11391
+ // src/commands/netcap/createNetcapHandler.ts
11392
+ function createNetcapHandler(options2) {
11393
+ return (req, res) => {
11394
+ if (req.method === "OPTIONS") {
11395
+ res.writeHead(204, corsHeaders);
11396
+ res.end();
11397
+ return;
11398
+ }
11399
+ if (req.method === "GET") {
11400
+ options2.onPing?.(req);
11401
+ res.writeHead(200, { ...corsHeaders, "Content-Type": "text/plain" });
11402
+ res.end("netcap receiver");
11403
+ return;
11404
+ }
11405
+ if (req.method !== "POST") {
11406
+ res.writeHead(405, corsHeaders);
11407
+ res.end();
11408
+ return;
11409
+ }
11410
+ handleNetcapPost(req, res, options2);
11411
+ };
11412
+ }
11413
+
11414
+ // src/commands/netcap/defaultCapturePath.ts
11415
+ import { homedir as homedir12 } from "os";
11416
+ import { join as join34 } from "path";
11417
+ function defaultCapturePath() {
11418
+ return join34(homedir12(), ".assist", "netcap", "capture.jsonl");
11419
+ }
11420
+
11421
+ // src/commands/netcap/prepareExtensionForLoad.ts
11422
+ import { cp, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
11423
+ import { networkInterfaces } from "os";
11424
+ import { join as join36 } from "path";
11360
11425
  import chalk123 from "chalk";
11426
+
11427
+ // src/commands/netcap/netcapExtensionDir.ts
11428
+ import { dirname as dirname19, join as join35 } from "path";
11429
+ import { fileURLToPath as fileURLToPath5 } from "url";
11430
+ var moduleDir = dirname19(fileURLToPath5(import.meta.url));
11431
+ function netcapExtensionDir() {
11432
+ return join35(moduleDir, "commands", "netcap", "netcap-extension");
11433
+ }
11434
+
11435
+ // src/commands/netcap/prepareExtensionForLoad.ts
11436
+ var WSL_WINDOWS_DIR = "/mnt/c/tools/netcap-extension";
11437
+ var WSL_WINDOWS_PATH = String.raw`C:\tools\netcap-extension`;
11438
+ function lanIPv4() {
11439
+ for (const addrs of Object.values(networkInterfaces())) {
11440
+ for (const addr of addrs ?? []) {
11441
+ if (addr.family === "IPv4" && !addr.internal) return addr.address;
11442
+ }
11443
+ }
11444
+ return void 0;
11445
+ }
11446
+ async function setReceiverHost(dir, host, port) {
11447
+ const file = join36(dir, "background.js");
11448
+ const source = await readFile2(file, "utf8");
11449
+ await writeFile2(
11450
+ file,
11451
+ source.replace(
11452
+ /const RECEIVER = "[^"]*";/,
11453
+ `const RECEIVER = "http://${host}:${port}/";`
11454
+ )
11455
+ );
11456
+ }
11457
+ async function prepareExtensionForLoad(port) {
11458
+ const source = netcapExtensionDir();
11459
+ if (detectPlatform() !== "wsl") {
11460
+ await setReceiverHost(source, "127.0.0.1", port);
11461
+ return source;
11462
+ }
11463
+ const host = lanIPv4();
11464
+ if (!host) {
11465
+ console.log(
11466
+ chalk123.yellow("could not determine the WSL IP for the extension")
11467
+ );
11468
+ await setReceiverHost(source, "127.0.0.1", port);
11469
+ return source;
11470
+ }
11471
+ try {
11472
+ await cp(source, WSL_WINDOWS_DIR, { recursive: true });
11473
+ await setReceiverHost(WSL_WINDOWS_DIR, host, port);
11474
+ return WSL_WINDOWS_PATH;
11475
+ } catch {
11476
+ console.log(
11477
+ chalk123.yellow(`could not copy extension to ${WSL_WINDOWS_PATH}`)
11478
+ );
11479
+ return source;
11480
+ }
11481
+ }
11482
+
11483
+ // src/commands/netcap/netcap.ts
11484
+ async function netcap(options2) {
11485
+ const port = Number(options2.port);
11486
+ const outPath = defaultCapturePath();
11487
+ await mkdir(dirname20(outPath), { recursive: true });
11488
+ const extensionPath = await prepareExtensionForLoad(port);
11489
+ let count6 = 0;
11490
+ const handler = createNetcapHandler({
11491
+ outPath,
11492
+ onPing: () => console.log(chalk124.dim("ping from extension")),
11493
+ onCapture: (entry) => {
11494
+ count6 += 1;
11495
+ console.log(
11496
+ chalk124.green(`captured #${count6}`),
11497
+ chalk124.dim(`${entry.method ?? "?"} ${entry.url ?? "?"}`)
11498
+ );
11499
+ }
11500
+ });
11501
+ const server = createServer2(handler);
11502
+ server.listen(port, () => {
11503
+ console.log(
11504
+ chalk124.bold(`netcap receiver listening on http://127.0.0.1:${port}`)
11505
+ );
11506
+ console.log(chalk124.dim(`appending captures to ${outPath}`));
11507
+ console.log(chalk124.dim(`load the unpacked extension from ${extensionPath}`));
11508
+ console.log(chalk124.dim("press Ctrl-C to stop"));
11509
+ });
11510
+ process.on("SIGINT", () => {
11511
+ server.close();
11512
+ process.exit(0);
11513
+ });
11514
+ }
11515
+
11516
+ // src/commands/registerNetcap.ts
11517
+ function registerNetcap(program2) {
11518
+ program2.command("netcap").description(
11519
+ "Start a local receiver that captures browser network traffic (fetch/XHR) to a JSONL file via the netcap browser extension"
11520
+ ).option("-p, --port <port>", "Port to listen on", "8723").action((options2) => netcap(options2));
11521
+ }
11522
+
11523
+ // src/commands/news/add/index.ts
11524
+ import chalk125 from "chalk";
11361
11525
  import enquirer8 from "enquirer";
11362
11526
  async function add2(url) {
11363
11527
  if (!url) {
@@ -11379,10 +11543,10 @@ async function add2(url) {
11379
11543
  const { orm } = await getReady();
11380
11544
  const added = await addFeed(orm, url);
11381
11545
  if (!added) {
11382
- console.log(chalk123.yellow("Feed already exists"));
11546
+ console.log(chalk125.yellow("Feed already exists"));
11383
11547
  return;
11384
11548
  }
11385
- console.log(chalk123.green(`Added feed: ${url}`));
11549
+ console.log(chalk125.green(`Added feed: ${url}`));
11386
11550
  }
11387
11551
 
11388
11552
  // src/commands/registerNews.ts
@@ -11392,7 +11556,7 @@ function registerNews(program2) {
11392
11556
  }
11393
11557
 
11394
11558
  // src/commands/prompts/printPromptsTable.ts
11395
- import chalk124 from "chalk";
11559
+ import chalk126 from "chalk";
11396
11560
  function truncate(str, max) {
11397
11561
  if (str.length <= max) return str;
11398
11562
  return `${str.slice(0, max - 1)}\u2026`;
@@ -11410,14 +11574,14 @@ function printPromptsTable(rows) {
11410
11574
  "Command".padEnd(commandWidth),
11411
11575
  "Repos"
11412
11576
  ].join(" ");
11413
- console.log(chalk124.dim(header));
11414
- console.log(chalk124.dim("-".repeat(header.length)));
11577
+ console.log(chalk126.dim(header));
11578
+ console.log(chalk126.dim("-".repeat(header.length)));
11415
11579
  for (const row of rows) {
11416
11580
  const count6 = String(row.count).padStart(countWidth);
11417
11581
  const tool = row.tool.padEnd(toolWidth);
11418
11582
  const command = truncate(row.command, 60).padEnd(commandWidth);
11419
11583
  console.log(
11420
- `${chalk124.yellow(count6)} ${tool} ${command} ${chalk124.dim(row.repos)}`
11584
+ `${chalk126.yellow(count6)} ${tool} ${command} ${chalk126.dim(row.repos)}`
11421
11585
  );
11422
11586
  }
11423
11587
  }
@@ -11767,14 +11931,14 @@ import { execSync as execSync33 } from "child_process";
11767
11931
  import { execSync as execSync32 } from "child_process";
11768
11932
  import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync26 } from "fs";
11769
11933
  import { tmpdir as tmpdir5 } from "os";
11770
- import { join as join35 } from "path";
11934
+ import { join as join38 } from "path";
11771
11935
 
11772
11936
  // src/commands/prs/loadCommentsCache.ts
11773
11937
  import { existsSync as existsSync33, readFileSync as readFileSync30, unlinkSync as unlinkSync9 } from "fs";
11774
- import { join as join34 } from "path";
11938
+ import { join as join37 } from "path";
11775
11939
  import { parse as parse2 } from "yaml";
11776
11940
  function getCachePath(prNumber) {
11777
- return join34(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
11941
+ return join37(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`);
11778
11942
  }
11779
11943
  function loadCommentsCache(prNumber) {
11780
11944
  const cachePath = getCachePath(prNumber);
@@ -11801,7 +11965,7 @@ function replyToComment(org, repo, prNumber, commentId, message) {
11801
11965
  }
11802
11966
  function resolveThread(threadId) {
11803
11967
  const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
11804
- const queryFile = join35(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
11968
+ const queryFile = join38(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
11805
11969
  writeFileSync26(queryFile, mutation);
11806
11970
  try {
11807
11971
  execSync32(
@@ -11884,17 +12048,17 @@ function fixed(commentId, sha) {
11884
12048
 
11885
12049
  // src/commands/prs/listComments/index.ts
11886
12050
  import { existsSync as existsSync34, mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
11887
- import { join as join37 } from "path";
12051
+ import { join as join40 } from "path";
11888
12052
  import { stringify } from "yaml";
11889
12053
 
11890
12054
  // src/commands/prs/fetchThreadIds.ts
11891
12055
  import { execSync as execSync34 } from "child_process";
11892
12056
  import { unlinkSync as unlinkSync11, writeFileSync as writeFileSync27 } from "fs";
11893
12057
  import { tmpdir as tmpdir6 } from "os";
11894
- import { join as join36 } from "path";
12058
+ import { join as join39 } from "path";
11895
12059
  var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
11896
12060
  function fetchThreadIds(org, repo, prNumber) {
11897
- const queryFile = join36(tmpdir6(), `gh-query-${Date.now()}.graphql`);
12061
+ const queryFile = join39(tmpdir6(), `gh-query-${Date.now()}.graphql`);
11898
12062
  writeFileSync27(queryFile, THREAD_QUERY);
11899
12063
  try {
11900
12064
  const result = execSync34(
@@ -11963,20 +12127,20 @@ function fetchLineComments(org, repo, prNumber, threadInfo) {
11963
12127
  }
11964
12128
 
11965
12129
  // src/commands/prs/listComments/printComments.ts
11966
- import chalk125 from "chalk";
12130
+ import chalk127 from "chalk";
11967
12131
  function formatForHuman(comment3) {
11968
12132
  if (comment3.type === "review") {
11969
- const stateColor = comment3.state === "APPROVED" ? chalk125.green : comment3.state === "CHANGES_REQUESTED" ? chalk125.red : chalk125.yellow;
12133
+ const stateColor = comment3.state === "APPROVED" ? chalk127.green : comment3.state === "CHANGES_REQUESTED" ? chalk127.red : chalk127.yellow;
11970
12134
  return [
11971
- `${chalk125.cyan("Review")} by ${chalk125.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
12135
+ `${chalk127.cyan("Review")} by ${chalk127.bold(comment3.user)} ${stateColor(`[${comment3.state}]`)}`,
11972
12136
  comment3.body,
11973
12137
  ""
11974
12138
  ].join("\n");
11975
12139
  }
11976
12140
  const location = comment3.line ? `:${comment3.line}` : "";
11977
12141
  return [
11978
- `${chalk125.cyan("Line comment")} by ${chalk125.bold(comment3.user)} on ${chalk125.dim(`${comment3.path}${location}`)}`,
11979
- chalk125.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
12142
+ `${chalk127.cyan("Line comment")} by ${chalk127.bold(comment3.user)} on ${chalk127.dim(`${comment3.path}${location}`)}`,
12143
+ chalk127.dim(comment3.diff_hunk.split("\n").slice(-3).join("\n")),
11980
12144
  comment3.body,
11981
12145
  ""
11982
12146
  ].join("\n");
@@ -12008,7 +12172,7 @@ function printComments2(result) {
12008
12172
 
12009
12173
  // src/commands/prs/listComments/index.ts
12010
12174
  function writeCommentsCache(prNumber, comments3) {
12011
- const assistDir = join37(process.cwd(), ".assist");
12175
+ const assistDir = join40(process.cwd(), ".assist");
12012
12176
  if (!existsSync34(assistDir)) {
12013
12177
  mkdirSync13(assistDir, { recursive: true });
12014
12178
  }
@@ -12017,7 +12181,7 @@ function writeCommentsCache(prNumber, comments3) {
12017
12181
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
12018
12182
  comments: comments3
12019
12183
  };
12020
- const cachePath = join37(assistDir, `pr-${prNumber}-comments.yaml`);
12184
+ const cachePath = join40(assistDir, `pr-${prNumber}-comments.yaml`);
12021
12185
  writeFileSync28(cachePath, stringify(cacheData));
12022
12186
  }
12023
12187
  function handleKnownErrors(error) {
@@ -12050,7 +12214,7 @@ async function listComments() {
12050
12214
  ];
12051
12215
  updateCache(prNumber, allComments);
12052
12216
  const hasLineComments = allComments.some((c) => c.type === "line");
12053
- const cachePath = hasLineComments ? join37(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
12217
+ const cachePath = hasLineComments ? join40(process.cwd(), ".assist", `pr-${prNumber}-comments.yaml`) : null;
12054
12218
  return { comments: allComments, cachePath };
12055
12219
  } catch (error) {
12056
12220
  const handled = handleKnownErrors(error);
@@ -12066,13 +12230,13 @@ import { execSync as execSync36 } from "child_process";
12066
12230
  import enquirer9 from "enquirer";
12067
12231
 
12068
12232
  // src/commands/prs/prs/displayPaginated/printPr.ts
12069
- import chalk126 from "chalk";
12233
+ import chalk128 from "chalk";
12070
12234
  var STATUS_MAP = {
12071
- MERGED: (pr) => pr.mergedAt ? { label: chalk126.magenta("merged"), date: pr.mergedAt } : null,
12072
- CLOSED: (pr) => pr.closedAt ? { label: chalk126.red("closed"), date: pr.closedAt } : null
12235
+ MERGED: (pr) => pr.mergedAt ? { label: chalk128.magenta("merged"), date: pr.mergedAt } : null,
12236
+ CLOSED: (pr) => pr.closedAt ? { label: chalk128.red("closed"), date: pr.closedAt } : null
12073
12237
  };
12074
12238
  function defaultStatus(pr) {
12075
- return { label: chalk126.green("opened"), date: pr.createdAt };
12239
+ return { label: chalk128.green("opened"), date: pr.createdAt };
12076
12240
  }
12077
12241
  function getStatus2(pr) {
12078
12242
  return STATUS_MAP[pr.state]?.(pr) ?? defaultStatus(pr);
@@ -12081,11 +12245,11 @@ function formatDate(dateStr) {
12081
12245
  return new Date(dateStr).toISOString().split("T")[0];
12082
12246
  }
12083
12247
  function formatPrHeader(pr, status2) {
12084
- return `${chalk126.cyan(`#${pr.number}`)} ${pr.title} ${chalk126.dim(`(${pr.author.login},`)} ${status2.label} ${chalk126.dim(`${formatDate(status2.date)})`)}`;
12248
+ return `${chalk128.cyan(`#${pr.number}`)} ${pr.title} ${chalk128.dim(`(${pr.author.login},`)} ${status2.label} ${chalk128.dim(`${formatDate(status2.date)})`)}`;
12085
12249
  }
12086
12250
  function logPrDetails(pr) {
12087
12251
  console.log(
12088
- chalk126.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
12252
+ chalk128.dim(` ${pr.changedFiles.toLocaleString()} files | ${pr.url}`)
12089
12253
  );
12090
12254
  console.log();
12091
12255
  }
@@ -12364,10 +12528,10 @@ function registerPrs(program2) {
12364
12528
  }
12365
12529
 
12366
12530
  // src/commands/ravendb/ravendbAuth.ts
12367
- import chalk132 from "chalk";
12531
+ import chalk134 from "chalk";
12368
12532
 
12369
12533
  // src/shared/createConnectionAuth.ts
12370
- import chalk127 from "chalk";
12534
+ import chalk129 from "chalk";
12371
12535
  function listConnections(connections, format2) {
12372
12536
  if (connections.length === 0) {
12373
12537
  console.log("No connections configured.");
@@ -12380,7 +12544,7 @@ function listConnections(connections, format2) {
12380
12544
  function removeConnection(connections, name, save) {
12381
12545
  const filtered = connections.filter((c) => c.name !== name);
12382
12546
  if (filtered.length === connections.length) {
12383
- console.error(chalk127.red(`Connection "${name}" not found.`));
12547
+ console.error(chalk129.red(`Connection "${name}" not found.`));
12384
12548
  process.exit(1);
12385
12549
  }
12386
12550
  save(filtered);
@@ -12426,15 +12590,15 @@ function saveConnections(connections) {
12426
12590
  }
12427
12591
 
12428
12592
  // src/commands/ravendb/promptConnection.ts
12429
- import chalk130 from "chalk";
12593
+ import chalk132 from "chalk";
12430
12594
 
12431
12595
  // src/commands/ravendb/selectOpSecret.ts
12432
- import chalk129 from "chalk";
12596
+ import chalk131 from "chalk";
12433
12597
  import Enquirer2 from "enquirer";
12434
12598
 
12435
12599
  // src/commands/ravendb/searchItems.ts
12436
12600
  import { execSync as execSync39 } from "child_process";
12437
- import chalk128 from "chalk";
12601
+ import chalk130 from "chalk";
12438
12602
  function opExec(args) {
12439
12603
  return execSync39(`op ${args}`, {
12440
12604
  encoding: "utf8",
@@ -12447,7 +12611,7 @@ function searchItems(search2) {
12447
12611
  items2 = JSON.parse(opExec("item list --format=json"));
12448
12612
  } catch {
12449
12613
  console.error(
12450
- chalk128.red(
12614
+ chalk130.red(
12451
12615
  "Failed to search 1Password. Ensure the CLI is installed and you are signed in."
12452
12616
  )
12453
12617
  );
@@ -12461,7 +12625,7 @@ function getItemFields(itemId) {
12461
12625
  const item = JSON.parse(opExec(`item get "${itemId}" --format=json`));
12462
12626
  return item.fields.filter((f) => f.reference && f.label);
12463
12627
  } catch {
12464
- console.error(chalk128.red("Failed to get item details from 1Password."));
12628
+ console.error(chalk130.red("Failed to get item details from 1Password."));
12465
12629
  process.exit(1);
12466
12630
  }
12467
12631
  }
@@ -12480,7 +12644,7 @@ async function selectOpSecret(searchTerm) {
12480
12644
  }).run();
12481
12645
  const items2 = searchItems(search2);
12482
12646
  if (items2.length === 0) {
12483
- console.error(chalk129.red(`No items found matching "${search2}".`));
12647
+ console.error(chalk131.red(`No items found matching "${search2}".`));
12484
12648
  process.exit(1);
12485
12649
  }
12486
12650
  const itemId = await selectOne(
@@ -12489,7 +12653,7 @@ async function selectOpSecret(searchTerm) {
12489
12653
  );
12490
12654
  const fields = getItemFields(itemId);
12491
12655
  if (fields.length === 0) {
12492
- console.error(chalk129.red("No fields with references found on this item."));
12656
+ console.error(chalk131.red("No fields with references found on this item."));
12493
12657
  process.exit(1);
12494
12658
  }
12495
12659
  const ref = await selectOne(
@@ -12503,7 +12667,7 @@ async function selectOpSecret(searchTerm) {
12503
12667
  async function promptConnection(existingNames) {
12504
12668
  const name = await promptInput("name", "Connection name:");
12505
12669
  if (existingNames.includes(name)) {
12506
- console.error(chalk130.red(`Connection "${name}" already exists.`));
12670
+ console.error(chalk132.red(`Connection "${name}" already exists.`));
12507
12671
  process.exit(1);
12508
12672
  }
12509
12673
  const url = await promptInput(
@@ -12512,22 +12676,22 @@ async function promptConnection(existingNames) {
12512
12676
  );
12513
12677
  const database = await promptInput("database", "Database name:");
12514
12678
  if (!name || !url || !database) {
12515
- console.error(chalk130.red("All fields are required."));
12679
+ console.error(chalk132.red("All fields are required."));
12516
12680
  process.exit(1);
12517
12681
  }
12518
12682
  const apiKeyRef = await selectOpSecret();
12519
- console.log(chalk130.dim(`Using: ${apiKeyRef}`));
12683
+ console.log(chalk132.dim(`Using: ${apiKeyRef}`));
12520
12684
  return { name, url, database, apiKeyRef };
12521
12685
  }
12522
12686
 
12523
12687
  // src/commands/ravendb/ravendbSetConnection.ts
12524
- import chalk131 from "chalk";
12688
+ import chalk133 from "chalk";
12525
12689
  function ravendbSetConnection(name) {
12526
12690
  const raw = loadGlobalConfigRaw();
12527
12691
  const ravendb = raw.ravendb ?? {};
12528
12692
  const connections = ravendb.connections ?? [];
12529
12693
  if (!connections.some((c) => c.name === name)) {
12530
- console.error(chalk131.red(`Connection "${name}" not found.`));
12694
+ console.error(chalk133.red(`Connection "${name}" not found.`));
12531
12695
  console.error(
12532
12696
  `Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
12533
12697
  );
@@ -12543,16 +12707,16 @@ function ravendbSetConnection(name) {
12543
12707
  var ravendbAuth = createConnectionAuth({
12544
12708
  load: loadConnections,
12545
12709
  save: saveConnections,
12546
- format: (c) => `${chalk132.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
12710
+ format: (c) => `${chalk134.bold(c.name)} ${c.url} db=${c.database} key=${c.apiKeyRef}`,
12547
12711
  promptNew: promptConnection,
12548
12712
  onFirst: (c) => ravendbSetConnection(c.name)
12549
12713
  });
12550
12714
 
12551
12715
  // src/commands/ravendb/ravendbCollections.ts
12552
- import chalk136 from "chalk";
12716
+ import chalk138 from "chalk";
12553
12717
 
12554
12718
  // src/commands/ravendb/ravenFetch.ts
12555
- import chalk134 from "chalk";
12719
+ import chalk136 from "chalk";
12556
12720
 
12557
12721
  // src/commands/ravendb/getAccessToken.ts
12558
12722
  var OAUTH_URL = "https://amazon-useast-1-oauth.ravenhq.com/ApiKeys/OAuth/AccessToken";
@@ -12589,10 +12753,10 @@ ${errorText}`
12589
12753
 
12590
12754
  // src/commands/ravendb/resolveOpSecret.ts
12591
12755
  import { execSync as execSync40 } from "child_process";
12592
- import chalk133 from "chalk";
12756
+ import chalk135 from "chalk";
12593
12757
  function resolveOpSecret(reference) {
12594
12758
  if (!reference.startsWith("op://")) {
12595
- console.error(chalk133.red(`Invalid secret reference: must start with op://`));
12759
+ console.error(chalk135.red(`Invalid secret reference: must start with op://`));
12596
12760
  process.exit(1);
12597
12761
  }
12598
12762
  try {
@@ -12602,7 +12766,7 @@ function resolveOpSecret(reference) {
12602
12766
  }).trim();
12603
12767
  } catch {
12604
12768
  console.error(
12605
- chalk133.red(
12769
+ chalk135.red(
12606
12770
  "Failed to resolve secret reference. Ensure 1Password CLI is installed and you are signed in."
12607
12771
  )
12608
12772
  );
@@ -12629,7 +12793,7 @@ async function ravenFetch(connection, path58) {
12629
12793
  if (!response.ok) {
12630
12794
  const body = await response.text();
12631
12795
  console.error(
12632
- chalk134.red(`RavenDB error: ${response.status} ${response.statusText}`)
12796
+ chalk136.red(`RavenDB error: ${response.status} ${response.statusText}`)
12633
12797
  );
12634
12798
  console.error(body.substring(0, 500));
12635
12799
  process.exit(1);
@@ -12638,7 +12802,7 @@ async function ravenFetch(connection, path58) {
12638
12802
  }
12639
12803
 
12640
12804
  // src/commands/ravendb/resolveConnection.ts
12641
- import chalk135 from "chalk";
12805
+ import chalk137 from "chalk";
12642
12806
  function loadRavendb() {
12643
12807
  const raw = loadGlobalConfigRaw();
12644
12808
  const ravendb = raw.ravendb;
@@ -12652,7 +12816,7 @@ function resolveConnection(name) {
12652
12816
  const connectionName = name ?? defaultConnection;
12653
12817
  if (!connectionName) {
12654
12818
  console.error(
12655
- chalk135.red(
12819
+ chalk137.red(
12656
12820
  "No connection specified and no default set. Use assist ravendb set-connection <name> or pass a connection name."
12657
12821
  )
12658
12822
  );
@@ -12660,7 +12824,7 @@ function resolveConnection(name) {
12660
12824
  }
12661
12825
  const connection = connections.find((c) => c.name === connectionName);
12662
12826
  if (!connection) {
12663
- console.error(chalk135.red(`Connection "${connectionName}" not found.`));
12827
+ console.error(chalk137.red(`Connection "${connectionName}" not found.`));
12664
12828
  console.error(
12665
12829
  `Available: ${connections.map((c) => c.name).join(", ") || "(none)"}`
12666
12830
  );
@@ -12691,15 +12855,15 @@ async function ravendbCollections(connectionName) {
12691
12855
  return;
12692
12856
  }
12693
12857
  for (const c of collections) {
12694
- console.log(`${chalk136.bold(c.Name)} ${c.CountOfDocuments} docs`);
12858
+ console.log(`${chalk138.bold(c.Name)} ${c.CountOfDocuments} docs`);
12695
12859
  }
12696
12860
  }
12697
12861
 
12698
12862
  // src/commands/ravendb/ravendbQuery.ts
12699
- import chalk138 from "chalk";
12863
+ import chalk140 from "chalk";
12700
12864
 
12701
12865
  // src/commands/ravendb/fetchAllPages.ts
12702
- import chalk137 from "chalk";
12866
+ import chalk139 from "chalk";
12703
12867
 
12704
12868
  // src/commands/ravendb/buildQueryPath.ts
12705
12869
  function buildQueryPath(opts) {
@@ -12737,7 +12901,7 @@ async function fetchAllPages(connection, opts) {
12737
12901
  allResults.push(...results);
12738
12902
  start3 += results.length;
12739
12903
  process.stderr.write(
12740
- `\r${chalk137.dim(`Fetched ${allResults.length}/${totalResults}`)}`
12904
+ `\r${chalk139.dim(`Fetched ${allResults.length}/${totalResults}`)}`
12741
12905
  );
12742
12906
  if (start3 >= totalResults) break;
12743
12907
  if (opts.limit !== void 0 && allResults.length >= opts.limit) break;
@@ -12752,7 +12916,7 @@ async function fetchAllPages(connection, opts) {
12752
12916
  async function ravendbQuery(connectionName, collection, options2) {
12753
12917
  const resolved = resolveArgs(connectionName, collection);
12754
12918
  if (!resolved.collection && !options2.query) {
12755
- console.error(chalk138.red("Provide a collection name or --query filter."));
12919
+ console.error(chalk140.red("Provide a collection name or --query filter."));
12756
12920
  process.exit(1);
12757
12921
  }
12758
12922
  const { collection: col } = resolved;
@@ -12790,7 +12954,7 @@ import { spawn as spawn5 } from "child_process";
12790
12954
  import * as path28 from "path";
12791
12955
 
12792
12956
  // src/commands/refactor/logViolations.ts
12793
- import chalk139 from "chalk";
12957
+ import chalk141 from "chalk";
12794
12958
  var DEFAULT_MAX_LINES = 100;
12795
12959
  function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
12796
12960
  if (violations.length === 0) {
@@ -12799,43 +12963,43 @@ function logViolations(violations, maxLines = DEFAULT_MAX_LINES) {
12799
12963
  }
12800
12964
  return;
12801
12965
  }
12802
- console.error(chalk139.red(`
12966
+ console.error(chalk141.red(`
12803
12967
  Refactor check failed:
12804
12968
  `));
12805
- console.error(chalk139.red(` The following files exceed ${maxLines} lines:
12969
+ console.error(chalk141.red(` The following files exceed ${maxLines} lines:
12806
12970
  `));
12807
12971
  for (const violation of violations) {
12808
- console.error(chalk139.red(` ${violation.file} (${violation.lines} lines)`));
12972
+ console.error(chalk141.red(` ${violation.file} (${violation.lines} lines)`));
12809
12973
  }
12810
12974
  console.error(
12811
- chalk139.yellow(
12975
+ chalk141.yellow(
12812
12976
  `
12813
12977
  Each file needs to be sensibly refactored, or if there is no sensible
12814
12978
  way to refactor it, ignore it with:
12815
12979
  `
12816
12980
  )
12817
12981
  );
12818
- console.error(chalk139.gray(` assist refactor ignore <file>
12982
+ console.error(chalk141.gray(` assist refactor ignore <file>
12819
12983
  `));
12820
12984
  if (process.env.CLAUDECODE) {
12821
- console.error(chalk139.cyan(`
12985
+ console.error(chalk141.cyan(`
12822
12986
  ## Extracting Code to New Files
12823
12987
  `));
12824
12988
  console.error(
12825
- chalk139.cyan(
12989
+ chalk141.cyan(
12826
12990
  ` When extracting logic from one file to another, consider where the extracted code belongs:
12827
12991
  `
12828
12992
  )
12829
12993
  );
12830
12994
  console.error(
12831
- chalk139.cyan(
12995
+ chalk141.cyan(
12832
12996
  ` 1. Keep related logic together: If the extracted code is tightly coupled to the
12833
12997
  original file's domain, create a new folder containing both the original and extracted files.
12834
12998
  `
12835
12999
  )
12836
13000
  );
12837
13001
  console.error(
12838
- chalk139.cyan(
13002
+ chalk141.cyan(
12839
13003
  ` 2. Share common utilities: If the extracted code can be reused across multiple
12840
13004
  domains, move it to a common/shared folder.
12841
13005
  `
@@ -12991,7 +13155,7 @@ async function check(pattern2, options2) {
12991
13155
 
12992
13156
  // src/commands/refactor/extract/index.ts
12993
13157
  import path35 from "path";
12994
- import chalk142 from "chalk";
13158
+ import chalk144 from "chalk";
12995
13159
 
12996
13160
  // src/commands/refactor/extract/applyExtraction.ts
12997
13161
  import { SyntaxKind as SyntaxKind4 } from "ts-morph";
@@ -13566,23 +13730,23 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
13566
13730
 
13567
13731
  // src/commands/refactor/extract/displayPlan.ts
13568
13732
  import path32 from "path";
13569
- import chalk140 from "chalk";
13733
+ import chalk142 from "chalk";
13570
13734
  function section(title) {
13571
13735
  return `
13572
- ${chalk140.cyan(title)}`;
13736
+ ${chalk142.cyan(title)}`;
13573
13737
  }
13574
13738
  function displayImporters(plan2, cwd) {
13575
13739
  if (plan2.importersToUpdate.length === 0) return;
13576
13740
  console.log(section("Update importers:"));
13577
13741
  for (const imp of plan2.importersToUpdate) {
13578
13742
  const rel = path32.relative(cwd, imp.file.getFilePath());
13579
- console.log(` ${chalk140.dim(rel)}: \u2192 import from "${imp.relPath}"`);
13743
+ console.log(` ${chalk142.dim(rel)}: \u2192 import from "${imp.relPath}"`);
13580
13744
  }
13581
13745
  }
13582
13746
  function displayPlan(functionName, relDest, plan2, cwd) {
13583
- console.log(chalk140.bold(`Extract: ${functionName} \u2192 ${relDest}
13747
+ console.log(chalk142.bold(`Extract: ${functionName} \u2192 ${relDest}
13584
13748
  `));
13585
- console.log(` ${chalk140.cyan("Functions to move:")}`);
13749
+ console.log(` ${chalk142.cyan("Functions to move:")}`);
13586
13750
  for (const name of plan2.extractedNames) {
13587
13751
  console.log(` ${name}`);
13588
13752
  }
@@ -13616,7 +13780,7 @@ function displayPlan(functionName, relDest, plan2, cwd) {
13616
13780
 
13617
13781
  // src/commands/refactor/extract/loadProjectFile.ts
13618
13782
  import path34 from "path";
13619
- import chalk141 from "chalk";
13783
+ import chalk143 from "chalk";
13620
13784
  import { Project as Project4 } from "ts-morph";
13621
13785
 
13622
13786
  // src/commands/refactor/extract/findTsConfig.ts
@@ -13676,7 +13840,7 @@ function loadProjectFile(file) {
13676
13840
  });
13677
13841
  const sourceFile = project.getSourceFile(sourcePath);
13678
13842
  if (!sourceFile) {
13679
- console.log(chalk141.red(`File not found in project: ${file}`));
13843
+ console.log(chalk143.red(`File not found in project: ${file}`));
13680
13844
  process.exit(1);
13681
13845
  }
13682
13846
  return { project, sourceFile };
@@ -13699,19 +13863,19 @@ async function extract(file, functionName, destination, options2 = {}) {
13699
13863
  displayPlan(functionName, relDest, plan2, cwd);
13700
13864
  if (options2.apply) {
13701
13865
  await applyExtraction(functionName, sourceFile, destPath, plan2, project);
13702
- console.log(chalk142.green("\nExtraction complete"));
13866
+ console.log(chalk144.green("\nExtraction complete"));
13703
13867
  } else {
13704
- console.log(chalk142.dim("\nDry run. Use --apply to execute."));
13868
+ console.log(chalk144.dim("\nDry run. Use --apply to execute."));
13705
13869
  }
13706
13870
  }
13707
13871
 
13708
13872
  // src/commands/refactor/ignore.ts
13709
13873
  import fs22 from "fs";
13710
- import chalk143 from "chalk";
13874
+ import chalk145 from "chalk";
13711
13875
  var REFACTOR_YML_PATH2 = "refactor.yml";
13712
13876
  function ignore(file) {
13713
13877
  if (!fs22.existsSync(file)) {
13714
- console.error(chalk143.red(`Error: File does not exist: ${file}`));
13878
+ console.error(chalk145.red(`Error: File does not exist: ${file}`));
13715
13879
  process.exit(1);
13716
13880
  }
13717
13881
  const content = fs22.readFileSync(file, "utf8");
@@ -13727,7 +13891,7 @@ function ignore(file) {
13727
13891
  fs22.writeFileSync(REFACTOR_YML_PATH2, entry);
13728
13892
  }
13729
13893
  console.log(
13730
- chalk143.green(
13894
+ chalk145.green(
13731
13895
  `Added ${file} to refactor ignore list (max ${maxLines} lines)`
13732
13896
  )
13733
13897
  );
@@ -13736,12 +13900,12 @@ function ignore(file) {
13736
13900
  // src/commands/refactor/rename/index.ts
13737
13901
  import fs25 from "fs";
13738
13902
  import path40 from "path";
13739
- import chalk146 from "chalk";
13903
+ import chalk148 from "chalk";
13740
13904
 
13741
13905
  // src/commands/refactor/rename/applyRename.ts
13742
13906
  import fs24 from "fs";
13743
13907
  import path37 from "path";
13744
- import chalk144 from "chalk";
13908
+ import chalk146 from "chalk";
13745
13909
 
13746
13910
  // src/commands/refactor/restructure/computeRewrites/index.ts
13747
13911
  import path36 from "path";
@@ -13846,13 +14010,13 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
13846
14010
  const updatedContents = applyRewrites(rewrites);
13847
14011
  for (const [file, content] of updatedContents) {
13848
14012
  fs24.writeFileSync(file, content, "utf8");
13849
- console.log(chalk144.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
14013
+ console.log(chalk146.cyan(` Updated imports in ${path37.relative(cwd, file)}`));
13850
14014
  }
13851
14015
  const destDir = path37.dirname(destPath);
13852
14016
  if (!fs24.existsSync(destDir)) fs24.mkdirSync(destDir, { recursive: true });
13853
14017
  fs24.renameSync(sourcePath, destPath);
13854
14018
  console.log(
13855
- chalk144.white(
14019
+ chalk146.white(
13856
14020
  ` Moved ${path37.relative(cwd, sourcePath)} \u2192 ${path37.relative(cwd, destPath)}`
13857
14021
  )
13858
14022
  );
@@ -13939,16 +14103,16 @@ function computeRenameRewrites(sourcePath, destPath) {
13939
14103
 
13940
14104
  // src/commands/refactor/rename/printRenamePreview.ts
13941
14105
  import path39 from "path";
13942
- import chalk145 from "chalk";
14106
+ import chalk147 from "chalk";
13943
14107
  function printRenamePreview(rewrites, cwd) {
13944
14108
  for (const rewrite of rewrites) {
13945
14109
  console.log(
13946
- chalk145.dim(
14110
+ chalk147.dim(
13947
14111
  ` ${path39.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
13948
14112
  )
13949
14113
  );
13950
14114
  }
13951
- console.log(chalk145.dim("Dry run. Use --apply to execute."));
14115
+ console.log(chalk147.dim("Dry run. Use --apply to execute."));
13952
14116
  }
13953
14117
 
13954
14118
  // src/commands/refactor/rename/index.ts
@@ -13959,20 +14123,20 @@ async function rename(source, destination, options2 = {}) {
13959
14123
  const relSource = path40.relative(cwd, sourcePath);
13960
14124
  const relDest = path40.relative(cwd, destPath);
13961
14125
  if (!fs25.existsSync(sourcePath)) {
13962
- console.log(chalk146.red(`File not found: ${source}`));
14126
+ console.log(chalk148.red(`File not found: ${source}`));
13963
14127
  process.exit(1);
13964
14128
  }
13965
14129
  if (destPath !== sourcePath && fs25.existsSync(destPath)) {
13966
- console.log(chalk146.red(`Destination already exists: ${destination}`));
14130
+ console.log(chalk148.red(`Destination already exists: ${destination}`));
13967
14131
  process.exit(1);
13968
14132
  }
13969
- console.log(chalk146.bold(`Rename: ${relSource} \u2192 ${relDest}`));
13970
- console.log(chalk146.dim("Loading project..."));
13971
- console.log(chalk146.dim("Scanning imports across the project..."));
14133
+ console.log(chalk148.bold(`Rename: ${relSource} \u2192 ${relDest}`));
14134
+ console.log(chalk148.dim("Loading project..."));
14135
+ console.log(chalk148.dim("Scanning imports across the project..."));
13972
14136
  const rewrites = computeRenameRewrites(sourcePath, destPath);
13973
14137
  const affectedFiles = new Set(rewrites.map((r) => r.file)).size;
13974
14138
  console.log(
13975
- chalk146.dim(
14139
+ chalk148.dim(
13976
14140
  `${rewrites.length} import path(s) to update across ${affectedFiles} file(s)`
13977
14141
  )
13978
14142
  );
@@ -13981,11 +14145,11 @@ async function rename(source, destination, options2 = {}) {
13981
14145
  return;
13982
14146
  }
13983
14147
  applyRename(rewrites, sourcePath, destPath, cwd);
13984
- console.log(chalk146.green("Done"));
14148
+ console.log(chalk148.green("Done"));
13985
14149
  }
13986
14150
 
13987
14151
  // src/commands/refactor/renameSymbol/index.ts
13988
- import chalk147 from "chalk";
14152
+ import chalk149 from "chalk";
13989
14153
 
13990
14154
  // src/commands/refactor/renameSymbol/findSymbol.ts
13991
14155
  import { SyntaxKind as SyntaxKind14 } from "ts-morph";
@@ -14031,33 +14195,33 @@ async function renameSymbol(file, oldName, newName, options2 = {}) {
14031
14195
  const { project, sourceFile } = loadProjectFile(file);
14032
14196
  const symbol = findSymbol(sourceFile, oldName);
14033
14197
  if (!symbol) {
14034
- console.log(chalk147.red(`Symbol "${oldName}" not found in ${file}`));
14198
+ console.log(chalk149.red(`Symbol "${oldName}" not found in ${file}`));
14035
14199
  process.exit(1);
14036
14200
  }
14037
14201
  const grouped = groupReferences(symbol, cwd);
14038
14202
  const totalRefs = [...grouped.values()].reduce((s, l) => s + l.length, 0);
14039
14203
  console.log(
14040
- chalk147.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
14204
+ chalk149.bold(`Rename: ${oldName} \u2192 ${newName} (${totalRefs} references)
14041
14205
  `)
14042
14206
  );
14043
14207
  for (const [refFile, lines] of grouped) {
14044
14208
  console.log(
14045
- ` ${chalk147.dim(refFile)}: lines ${chalk147.cyan(lines.join(", "))}`
14209
+ ` ${chalk149.dim(refFile)}: lines ${chalk149.cyan(lines.join(", "))}`
14046
14210
  );
14047
14211
  }
14048
14212
  if (options2.apply) {
14049
14213
  symbol.rename(newName);
14050
14214
  await project.save();
14051
- console.log(chalk147.green(`
14215
+ console.log(chalk149.green(`
14052
14216
  Renamed ${oldName} \u2192 ${newName}`));
14053
14217
  } else {
14054
- console.log(chalk147.dim("\nDry run. Use --apply to execute."));
14218
+ console.log(chalk149.dim("\nDry run. Use --apply to execute."));
14055
14219
  }
14056
14220
  }
14057
14221
 
14058
14222
  // src/commands/refactor/restructure/index.ts
14059
14223
  import path48 from "path";
14060
- import chalk150 from "chalk";
14224
+ import chalk152 from "chalk";
14061
14225
 
14062
14226
  // src/commands/refactor/restructure/clusterDirectories.ts
14063
14227
  import path42 from "path";
@@ -14136,50 +14300,50 @@ function clusterFiles(graph) {
14136
14300
 
14137
14301
  // src/commands/refactor/restructure/displayPlan.ts
14138
14302
  import path44 from "path";
14139
- import chalk148 from "chalk";
14303
+ import chalk150 from "chalk";
14140
14304
  function relPath(filePath) {
14141
14305
  return path44.relative(process.cwd(), filePath);
14142
14306
  }
14143
14307
  function displayMoves(plan2) {
14144
14308
  if (plan2.moves.length === 0) return;
14145
- console.log(chalk148.bold("\nFile moves:"));
14309
+ console.log(chalk150.bold("\nFile moves:"));
14146
14310
  for (const move of plan2.moves) {
14147
14311
  console.log(
14148
- ` ${chalk148.red(relPath(move.from))} \u2192 ${chalk148.green(relPath(move.to))}`
14312
+ ` ${chalk150.red(relPath(move.from))} \u2192 ${chalk150.green(relPath(move.to))}`
14149
14313
  );
14150
- console.log(chalk148.dim(` ${move.reason}`));
14314
+ console.log(chalk150.dim(` ${move.reason}`));
14151
14315
  }
14152
14316
  }
14153
14317
  function displayRewrites(rewrites) {
14154
14318
  if (rewrites.length === 0) return;
14155
14319
  const affectedFiles = new Set(rewrites.map((r) => r.file));
14156
- console.log(chalk148.bold(`
14320
+ console.log(chalk150.bold(`
14157
14321
  Import rewrites (${affectedFiles.size} files):`));
14158
14322
  for (const file of affectedFiles) {
14159
- console.log(` ${chalk148.cyan(relPath(file))}:`);
14323
+ console.log(` ${chalk150.cyan(relPath(file))}:`);
14160
14324
  for (const { oldSpecifier, newSpecifier } of rewrites.filter(
14161
14325
  (r) => r.file === file
14162
14326
  )) {
14163
14327
  console.log(
14164
- ` ${chalk148.red(`"${oldSpecifier}"`)} \u2192 ${chalk148.green(`"${newSpecifier}"`)}`
14328
+ ` ${chalk150.red(`"${oldSpecifier}"`)} \u2192 ${chalk150.green(`"${newSpecifier}"`)}`
14165
14329
  );
14166
14330
  }
14167
14331
  }
14168
14332
  }
14169
14333
  function displayPlan2(plan2) {
14170
14334
  if (plan2.warnings.length > 0) {
14171
- console.log(chalk148.yellow("\nWarnings:"));
14172
- for (const w of plan2.warnings) console.log(chalk148.yellow(` ${w}`));
14335
+ console.log(chalk150.yellow("\nWarnings:"));
14336
+ for (const w of plan2.warnings) console.log(chalk150.yellow(` ${w}`));
14173
14337
  }
14174
14338
  if (plan2.newDirectories.length > 0) {
14175
- console.log(chalk148.bold("\nNew directories:"));
14339
+ console.log(chalk150.bold("\nNew directories:"));
14176
14340
  for (const dir of plan2.newDirectories)
14177
- console.log(chalk148.green(` ${dir}/`));
14341
+ console.log(chalk150.green(` ${dir}/`));
14178
14342
  }
14179
14343
  displayMoves(plan2);
14180
14344
  displayRewrites(plan2.rewrites);
14181
14345
  console.log(
14182
- chalk148.dim(
14346
+ chalk150.dim(
14183
14347
  `
14184
14348
  Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
14185
14349
  )
@@ -14189,18 +14353,18 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
14189
14353
  // src/commands/refactor/restructure/executePlan.ts
14190
14354
  import fs26 from "fs";
14191
14355
  import path45 from "path";
14192
- import chalk149 from "chalk";
14356
+ import chalk151 from "chalk";
14193
14357
  function executePlan(plan2) {
14194
14358
  const updatedContents = applyRewrites(plan2.rewrites);
14195
14359
  for (const [file, content] of updatedContents) {
14196
14360
  fs26.writeFileSync(file, content, "utf8");
14197
14361
  console.log(
14198
- chalk149.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
14362
+ chalk151.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
14199
14363
  );
14200
14364
  }
14201
14365
  for (const dir of plan2.newDirectories) {
14202
14366
  fs26.mkdirSync(dir, { recursive: true });
14203
- console.log(chalk149.green(` Created ${path45.relative(process.cwd(), dir)}/`));
14367
+ console.log(chalk151.green(` Created ${path45.relative(process.cwd(), dir)}/`));
14204
14368
  }
14205
14369
  for (const move of plan2.moves) {
14206
14370
  const targetDir = path45.dirname(move.to);
@@ -14209,7 +14373,7 @@ function executePlan(plan2) {
14209
14373
  }
14210
14374
  fs26.renameSync(move.from, move.to);
14211
14375
  console.log(
14212
- chalk149.white(
14376
+ chalk151.white(
14213
14377
  ` Moved ${path45.relative(process.cwd(), move.from)} \u2192 ${path45.relative(process.cwd(), move.to)}`
14214
14378
  )
14215
14379
  );
@@ -14224,7 +14388,7 @@ function removeEmptyDirectories(dirs) {
14224
14388
  if (entries.length === 0) {
14225
14389
  fs26.rmdirSync(dir);
14226
14390
  console.log(
14227
- chalk149.dim(
14391
+ chalk151.dim(
14228
14392
  ` Removed empty directory ${path45.relative(process.cwd(), dir)}`
14229
14393
  )
14230
14394
  );
@@ -14357,22 +14521,22 @@ async function restructure(pattern2, options2 = {}) {
14357
14521
  const targetPattern = pattern2 ?? "src";
14358
14522
  const files = findSourceFiles2(targetPattern);
14359
14523
  if (files.length === 0) {
14360
- console.log(chalk150.yellow("No files found matching pattern"));
14524
+ console.log(chalk152.yellow("No files found matching pattern"));
14361
14525
  return;
14362
14526
  }
14363
14527
  const tsConfigPath = path48.resolve("tsconfig.json");
14364
14528
  const plan2 = buildPlan3(files, tsConfigPath);
14365
14529
  if (plan2.moves.length === 0) {
14366
- console.log(chalk150.green("No restructuring needed"));
14530
+ console.log(chalk152.green("No restructuring needed"));
14367
14531
  return;
14368
14532
  }
14369
14533
  displayPlan2(plan2);
14370
14534
  if (options2.apply) {
14371
- console.log(chalk150.bold("\nApplying changes..."));
14535
+ console.log(chalk152.bold("\nApplying changes..."));
14372
14536
  executePlan(plan2);
14373
- console.log(chalk150.green("\nRestructuring complete"));
14537
+ console.log(chalk152.green("\nRestructuring complete"));
14374
14538
  } else {
14375
- console.log(chalk150.dim("\nDry run. Use --apply to execute."));
14539
+ console.log(chalk152.dim("\nDry run. Use --apply to execute."));
14376
14540
  }
14377
14541
  }
14378
14542
 
@@ -14527,11 +14691,11 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
14527
14691
  }
14528
14692
 
14529
14693
  // src/commands/review/buildReviewPaths.ts
14530
- import { homedir as homedir12 } from "os";
14531
- import { basename as basename7, join as join38 } from "path";
14694
+ import { homedir as homedir13 } from "os";
14695
+ import { basename as basename7, join as join41 } from "path";
14532
14696
  function buildReviewPaths(repoRoot, key) {
14533
- const reviewDir = join38(
14534
- homedir12(),
14697
+ const reviewDir = join41(
14698
+ homedir13(),
14535
14699
  ".assist",
14536
14700
  "reviews",
14537
14701
  basename7(repoRoot),
@@ -14539,10 +14703,10 @@ function buildReviewPaths(repoRoot, key) {
14539
14703
  );
14540
14704
  return {
14541
14705
  reviewDir,
14542
- requestPath: join38(reviewDir, "request.md"),
14543
- claudePath: join38(reviewDir, "claude.md"),
14544
- codexPath: join38(reviewDir, "codex.md"),
14545
- synthesisPath: join38(reviewDir, "synthesis.md")
14706
+ requestPath: join41(reviewDir, "request.md"),
14707
+ claudePath: join41(reviewDir, "claude.md"),
14708
+ codexPath: join41(reviewDir, "codex.md"),
14709
+ synthesisPath: join41(reviewDir, "synthesis.md")
14546
14710
  };
14547
14711
  }
14548
14712
 
@@ -14941,18 +15105,18 @@ function partitionFindingsByDiff(findings, index3) {
14941
15105
  }
14942
15106
 
14943
15107
  // src/commands/review/warnOutOfDiff.ts
14944
- import chalk151 from "chalk";
15108
+ import chalk153 from "chalk";
14945
15109
  function warnOutOfDiff(outOfDiff) {
14946
15110
  if (outOfDiff.length === 0) return;
14947
15111
  console.warn(
14948
- chalk151.yellow(
15112
+ chalk153.yellow(
14949
15113
  `Skipped ${outOfDiff.length} finding(s) whose lines fall outside the PR diff (GitHub would silently drop these):`
14950
15114
  )
14951
15115
  );
14952
15116
  for (const finding of outOfDiff) {
14953
15117
  const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
14954
15118
  console.warn(
14955
- ` ${chalk151.yellow("\xB7")} ${finding.title} ${chalk151.dim(
15119
+ ` ${chalk153.yellow("\xB7")} ${finding.title} ${chalk153.dim(
14956
15120
  `(${finding.file}:${range})`
14957
15121
  )}`
14958
15122
  );
@@ -14971,18 +15135,18 @@ function selectInDiffFindings(lineBound, prDiff) {
14971
15135
  }
14972
15136
 
14973
15137
  // src/commands/review/warnUnlocated.ts
14974
- import chalk152 from "chalk";
15138
+ import chalk154 from "chalk";
14975
15139
  function warnUnlocated(unlocated) {
14976
15140
  if (unlocated.length === 0) return;
14977
15141
  console.warn(
14978
- chalk152.yellow(
15142
+ chalk154.yellow(
14979
15143
  `Skipped ${unlocated.length} finding(s) without a parseable file:line:`
14980
15144
  )
14981
15145
  );
14982
15146
  for (const finding of unlocated) {
14983
- const where = finding.location || chalk152.dim("missing");
15147
+ const where = finding.location || chalk154.dim("missing");
14984
15148
  console.warn(
14985
- ` ${chalk152.yellow("\xB7")} ${finding.title} ${chalk152.dim(`(${where})`)}`
15149
+ ` ${chalk154.yellow("\xB7")} ${finding.title} ${chalk154.dim(`(${where})`)}`
14986
15150
  );
14987
15151
  }
14988
15152
  }
@@ -16153,7 +16317,7 @@ function registerReview(program2) {
16153
16317
  }
16154
16318
 
16155
16319
  // src/commands/seq/seqAuth.ts
16156
- import chalk154 from "chalk";
16320
+ import chalk156 from "chalk";
16157
16321
 
16158
16322
  // src/commands/seq/loadConnections.ts
16159
16323
  function loadConnections2() {
@@ -16182,10 +16346,10 @@ function setDefaultConnection(name) {
16182
16346
  }
16183
16347
 
16184
16348
  // src/shared/assertUniqueName.ts
16185
- import chalk153 from "chalk";
16349
+ import chalk155 from "chalk";
16186
16350
  function assertUniqueName(existingNames, name) {
16187
16351
  if (existingNames.includes(name)) {
16188
- console.error(chalk153.red(`Connection "${name}" already exists.`));
16352
+ console.error(chalk155.red(`Connection "${name}" already exists.`));
16189
16353
  process.exit(1);
16190
16354
  }
16191
16355
  }
@@ -16203,16 +16367,16 @@ async function promptConnection2(existingNames) {
16203
16367
  var seqAuth = createConnectionAuth({
16204
16368
  load: loadConnections2,
16205
16369
  save: saveConnections2,
16206
- format: (c) => `${chalk154.bold(c.name)} ${c.url}`,
16370
+ format: (c) => `${chalk156.bold(c.name)} ${c.url}`,
16207
16371
  promptNew: promptConnection2,
16208
16372
  onFirst: (c) => setDefaultConnection(c.name)
16209
16373
  });
16210
16374
 
16211
16375
  // src/commands/seq/seqQuery.ts
16212
- import chalk158 from "chalk";
16376
+ import chalk160 from "chalk";
16213
16377
 
16214
16378
  // src/commands/seq/fetchSeq.ts
16215
- import chalk155 from "chalk";
16379
+ import chalk157 from "chalk";
16216
16380
  async function fetchSeq(conn, path58, params) {
16217
16381
  const url = `${conn.url}${path58}?${params}`;
16218
16382
  const response = await fetch(url, {
@@ -16223,7 +16387,7 @@ async function fetchSeq(conn, path58, params) {
16223
16387
  });
16224
16388
  if (!response.ok) {
16225
16389
  const body = await response.text();
16226
- console.error(chalk155.red(`Seq returned ${response.status}: ${body}`));
16390
+ console.error(chalk157.red(`Seq returned ${response.status}: ${body}`));
16227
16391
  process.exit(1);
16228
16392
  }
16229
16393
  return response;
@@ -16282,23 +16446,23 @@ async function fetchSeqEvents(conn, params) {
16282
16446
  }
16283
16447
 
16284
16448
  // src/commands/seq/formatEvent.ts
16285
- import chalk156 from "chalk";
16449
+ import chalk158 from "chalk";
16286
16450
  function levelColor(level) {
16287
16451
  switch (level) {
16288
16452
  case "Fatal":
16289
- return chalk156.bgRed.white;
16453
+ return chalk158.bgRed.white;
16290
16454
  case "Error":
16291
- return chalk156.red;
16455
+ return chalk158.red;
16292
16456
  case "Warning":
16293
- return chalk156.yellow;
16457
+ return chalk158.yellow;
16294
16458
  case "Information":
16295
- return chalk156.cyan;
16459
+ return chalk158.cyan;
16296
16460
  case "Debug":
16297
- return chalk156.gray;
16461
+ return chalk158.gray;
16298
16462
  case "Verbose":
16299
- return chalk156.dim;
16463
+ return chalk158.dim;
16300
16464
  default:
16301
- return chalk156.white;
16465
+ return chalk158.white;
16302
16466
  }
16303
16467
  }
16304
16468
  function levelAbbrev(level) {
@@ -16339,12 +16503,12 @@ function formatTimestamp(iso) {
16339
16503
  function formatEvent(event) {
16340
16504
  const color = levelColor(event.Level);
16341
16505
  const abbrev = levelAbbrev(event.Level);
16342
- const ts8 = chalk156.dim(formatTimestamp(event.Timestamp));
16506
+ const ts8 = chalk158.dim(formatTimestamp(event.Timestamp));
16343
16507
  const msg = renderMessage(event);
16344
16508
  const lines = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
16345
16509
  if (event.Exception) {
16346
16510
  for (const line of event.Exception.split("\n")) {
16347
- lines.push(chalk156.red(` ${line}`));
16511
+ lines.push(chalk158.red(` ${line}`));
16348
16512
  }
16349
16513
  }
16350
16514
  return lines.join("\n");
@@ -16377,11 +16541,11 @@ function rejectTimestampFilter(filter) {
16377
16541
  }
16378
16542
 
16379
16543
  // src/shared/resolveNamedConnection.ts
16380
- import chalk157 from "chalk";
16544
+ import chalk159 from "chalk";
16381
16545
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
16382
16546
  if (connections.length === 0) {
16383
16547
  console.error(
16384
- chalk157.red(
16548
+ chalk159.red(
16385
16549
  `No ${kind} connections configured. Run '${authCommand}' first.`
16386
16550
  )
16387
16551
  );
@@ -16390,7 +16554,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
16390
16554
  const target = requested ?? defaultName ?? connections[0].name;
16391
16555
  const connection = connections.find((c) => c.name === target);
16392
16556
  if (!connection) {
16393
- console.error(chalk157.red(`${kind} connection "${target}" not found.`));
16557
+ console.error(chalk159.red(`${kind} connection "${target}" not found.`));
16394
16558
  process.exit(1);
16395
16559
  }
16396
16560
  return connection;
@@ -16419,7 +16583,7 @@ async function seqQuery(filter, options2) {
16419
16583
  new URLSearchParams({ filter, count: String(count6) })
16420
16584
  );
16421
16585
  if (events.length === 0) {
16422
- console.log(chalk158.yellow("No events found."));
16586
+ console.log(chalk160.yellow("No events found."));
16423
16587
  return;
16424
16588
  }
16425
16589
  if (options2.json) {
@@ -16430,11 +16594,11 @@ async function seqQuery(filter, options2) {
16430
16594
  for (const event of chronological) {
16431
16595
  console.log(formatEvent(event));
16432
16596
  }
16433
- console.log(chalk158.dim(`
16597
+ console.log(chalk160.dim(`
16434
16598
  ${events.length} events`));
16435
16599
  if (events.length >= count6) {
16436
16600
  console.log(
16437
- chalk158.yellow(
16601
+ chalk160.yellow(
16438
16602
  `Results limited to ${count6}. Use --count to retrieve more.`
16439
16603
  )
16440
16604
  );
@@ -16442,10 +16606,10 @@ ${events.length} events`));
16442
16606
  }
16443
16607
 
16444
16608
  // src/shared/setNamedDefaultConnection.ts
16445
- import chalk159 from "chalk";
16609
+ import chalk161 from "chalk";
16446
16610
  function setNamedDefaultConnection(connections, name, setDefault, kind) {
16447
16611
  if (!connections.find((c) => c.name === name)) {
16448
- console.error(chalk159.red(`Connection "${name}" not found.`));
16612
+ console.error(chalk161.red(`Connection "${name}" not found.`));
16449
16613
  process.exit(1);
16450
16614
  }
16451
16615
  setDefault(name);
@@ -16493,7 +16657,7 @@ function registerSignal(program2) {
16493
16657
  }
16494
16658
 
16495
16659
  // src/commands/sql/sqlAuth.ts
16496
- import chalk161 from "chalk";
16660
+ import chalk163 from "chalk";
16497
16661
 
16498
16662
  // src/commands/sql/loadConnections.ts
16499
16663
  function loadConnections3() {
@@ -16522,7 +16686,7 @@ function setDefaultConnection2(name) {
16522
16686
  }
16523
16687
 
16524
16688
  // src/commands/sql/promptConnection.ts
16525
- import chalk160 from "chalk";
16689
+ import chalk162 from "chalk";
16526
16690
  async function promptConnection3(existingNames) {
16527
16691
  const name = await promptInput("name", "Connection name:", "default");
16528
16692
  assertUniqueName(existingNames, name);
@@ -16530,7 +16694,7 @@ async function promptConnection3(existingNames) {
16530
16694
  const portStr = await promptInput("port", "Port:", "1433");
16531
16695
  const port = Number.parseInt(portStr, 10);
16532
16696
  if (!Number.isFinite(port)) {
16533
- console.error(chalk160.red(`Invalid port "${portStr}".`));
16697
+ console.error(chalk162.red(`Invalid port "${portStr}".`));
16534
16698
  process.exit(1);
16535
16699
  }
16536
16700
  const user = await promptInput("user", "User:");
@@ -16543,13 +16707,13 @@ async function promptConnection3(existingNames) {
16543
16707
  var sqlAuth = createConnectionAuth({
16544
16708
  load: loadConnections3,
16545
16709
  save: saveConnections3,
16546
- format: (c) => `${chalk161.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
16710
+ format: (c) => `${chalk163.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
16547
16711
  promptNew: promptConnection3,
16548
16712
  onFirst: (c) => setDefaultConnection2(c.name)
16549
16713
  });
16550
16714
 
16551
16715
  // src/commands/sql/printTable.ts
16552
- import chalk162 from "chalk";
16716
+ import chalk164 from "chalk";
16553
16717
  function formatCell(value) {
16554
16718
  if (value === null || value === void 0) return "";
16555
16719
  if (value instanceof Date) return value.toISOString();
@@ -16558,7 +16722,7 @@ function formatCell(value) {
16558
16722
  }
16559
16723
  function printTable(rows) {
16560
16724
  if (rows.length === 0) {
16561
- console.log(chalk162.yellow("(no rows)"));
16725
+ console.log(chalk164.yellow("(no rows)"));
16562
16726
  return;
16563
16727
  }
16564
16728
  const columns = Object.keys(rows[0]);
@@ -16566,13 +16730,13 @@ function printTable(rows) {
16566
16730
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
16567
16731
  );
16568
16732
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
16569
- console.log(chalk162.dim(header));
16570
- console.log(chalk162.dim("-".repeat(header.length)));
16733
+ console.log(chalk164.dim(header));
16734
+ console.log(chalk164.dim("-".repeat(header.length)));
16571
16735
  for (const row of rows) {
16572
16736
  const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
16573
16737
  console.log(line);
16574
16738
  }
16575
- console.log(chalk162.dim(`
16739
+ console.log(chalk164.dim(`
16576
16740
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
16577
16741
  }
16578
16742
 
@@ -16632,7 +16796,7 @@ async function sqlColumns(table, connectionName) {
16632
16796
  }
16633
16797
 
16634
16798
  // src/commands/sql/sqlMutate.ts
16635
- import chalk163 from "chalk";
16799
+ import chalk165 from "chalk";
16636
16800
 
16637
16801
  // src/commands/sql/isMutation.ts
16638
16802
  var MUTATION_KEYWORDS = [
@@ -16666,7 +16830,7 @@ function isMutation(sql6) {
16666
16830
  async function sqlMutate(query, connectionName) {
16667
16831
  if (!isMutation(query)) {
16668
16832
  console.error(
16669
- chalk163.red(
16833
+ chalk165.red(
16670
16834
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
16671
16835
  )
16672
16836
  );
@@ -16676,18 +16840,18 @@ async function sqlMutate(query, connectionName) {
16676
16840
  const pool = await sqlConnect(conn);
16677
16841
  try {
16678
16842
  const result = await pool.request().query(query);
16679
- console.log(chalk163.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
16843
+ console.log(chalk165.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
16680
16844
  } finally {
16681
16845
  await pool.close();
16682
16846
  }
16683
16847
  }
16684
16848
 
16685
16849
  // src/commands/sql/sqlQuery.ts
16686
- import chalk164 from "chalk";
16850
+ import chalk166 from "chalk";
16687
16851
  async function sqlQuery(query, connectionName) {
16688
16852
  if (isMutation(query)) {
16689
16853
  console.error(
16690
- chalk164.red(
16854
+ chalk166.red(
16691
16855
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
16692
16856
  )
16693
16857
  );
@@ -16702,7 +16866,7 @@ async function sqlQuery(query, connectionName) {
16702
16866
  printTable(rows);
16703
16867
  } else {
16704
16868
  console.log(
16705
- chalk164.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
16869
+ chalk166.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
16706
16870
  );
16707
16871
  }
16708
16872
  } finally {
@@ -16763,7 +16927,7 @@ function registerSql(program2) {
16763
16927
 
16764
16928
  // src/commands/transcript/shared.ts
16765
16929
  import { existsSync as existsSync38, readdirSync as readdirSync7, statSync as statSync5 } from "fs";
16766
- import { basename as basename8, join as join39, relative as relative2 } from "path";
16930
+ import { basename as basename8, join as join42, relative as relative2 } from "path";
16767
16931
  import * as readline2 from "readline";
16768
16932
  var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
16769
16933
  function getDatePrefix(daysOffset = 0) {
@@ -16781,7 +16945,7 @@ function collectFiles(dir, extension) {
16781
16945
  if (!existsSync38(dir)) return [];
16782
16946
  const results = [];
16783
16947
  for (const entry of readdirSync7(dir)) {
16784
- const fullPath = join39(dir, entry);
16948
+ const fullPath = join42(dir, entry);
16785
16949
  if (statSync5(fullPath).isDirectory()) {
16786
16950
  results.push(...collectFiles(fullPath, extension));
16787
16951
  } else if (entry.endsWith(extension)) {
@@ -16878,11 +17042,11 @@ async function configure() {
16878
17042
  import { existsSync as existsSync40 } from "fs";
16879
17043
 
16880
17044
  // src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
16881
- import { dirname as dirname20, join as join41 } from "path";
17045
+ import { dirname as dirname22, join as join44 } from "path";
16882
17046
 
16883
17047
  // src/commands/transcript/format/fixInvalidDatePrefixes/promptForDateFix.ts
16884
17048
  import { renameSync as renameSync2 } from "fs";
16885
- import { join as join40 } from "path";
17049
+ import { join as join43 } from "path";
16886
17050
  async function resolveDate(rl, choice) {
16887
17051
  if (choice === "1") return getDatePrefix(0);
16888
17052
  if (choice === "2") return getDatePrefix(-1);
@@ -16897,7 +17061,7 @@ async function resolveDate(rl, choice) {
16897
17061
  }
16898
17062
  function renameWithPrefix(vttDir, vttFile, prefix2) {
16899
17063
  const newFilename = `${prefix2}.${vttFile}`;
16900
- renameSync2(join40(vttDir, vttFile), join40(vttDir, newFilename));
17064
+ renameSync2(join43(vttDir, vttFile), join43(vttDir, newFilename));
16901
17065
  console.log(`Renamed to: ${newFilename}`);
16902
17066
  return newFilename;
16903
17067
  }
@@ -16928,15 +17092,15 @@ async function fixInvalidDatePrefixes(vttFiles) {
16928
17092
  for (let i = 0; i < vttFiles.length; i++) {
16929
17093
  const vttFile = vttFiles[i];
16930
17094
  if (!isValidDatePrefix(vttFile.filename)) {
16931
- const vttFileDir = dirname20(vttFile.absolutePath);
17095
+ const vttFileDir = dirname22(vttFile.absolutePath);
16932
17096
  const newFilename = await promptForDateFix(vttFile.filename, vttFileDir);
16933
17097
  if (newFilename) {
16934
- const newRelativePath = join41(
16935
- dirname20(vttFile.relativePath),
17098
+ const newRelativePath = join44(
17099
+ dirname22(vttFile.relativePath),
16936
17100
  newFilename
16937
17101
  );
16938
17102
  vttFiles[i] = {
16939
- absolutePath: join41(vttFileDir, newFilename),
17103
+ absolutePath: join44(vttFileDir, newFilename),
16940
17104
  relativePath: newRelativePath,
16941
17105
  filename: newFilename
16942
17106
  };
@@ -16950,7 +17114,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
16950
17114
 
16951
17115
  // src/commands/transcript/format/processVttFile/index.ts
16952
17116
  import { existsSync as existsSync39, mkdirSync as mkdirSync15, readFileSync as readFileSync33, writeFileSync as writeFileSync31 } from "fs";
16953
- import { basename as basename9, dirname as dirname21, join as join42 } from "path";
17117
+ import { basename as basename9, dirname as dirname23, join as join45 } from "path";
16954
17118
 
16955
17119
  // src/commands/transcript/cleanText.ts
16956
17120
  function cleanText(text5) {
@@ -17160,17 +17324,17 @@ function toMdFilename(vttFilename) {
17160
17324
  return `${basename9(vttFilename, ".vtt").replace(/\s*Transcription\s*/g, " ").trim()}.md`;
17161
17325
  }
17162
17326
  function resolveOutputDir(relativeDir, transcriptsDir) {
17163
- return relativeDir === "." ? transcriptsDir : join42(transcriptsDir, relativeDir);
17327
+ return relativeDir === "." ? transcriptsDir : join45(transcriptsDir, relativeDir);
17164
17328
  }
17165
17329
  function buildOutputPaths(vttFile, transcriptsDir) {
17166
17330
  const mdFile = toMdFilename(vttFile.filename);
17167
- const relativeDir = dirname21(vttFile.relativePath);
17331
+ const relativeDir = dirname23(vttFile.relativePath);
17168
17332
  const outputDir = resolveOutputDir(relativeDir, transcriptsDir);
17169
- const outputPath = join42(outputDir, mdFile);
17333
+ const outputPath = join45(outputDir, mdFile);
17170
17334
  return { outputDir, outputPath, mdFile, relativeDir };
17171
17335
  }
17172
17336
  function logSkipped(relativeDir, mdFile) {
17173
- console.log(`Skipping (already exists): ${join42(relativeDir, mdFile)}`);
17337
+ console.log(`Skipping (already exists): ${join45(relativeDir, mdFile)}`);
17174
17338
  return "skipped";
17175
17339
  }
17176
17340
  function ensureDirectory(dir, label2) {
@@ -17269,7 +17433,7 @@ async function format() {
17269
17433
 
17270
17434
  // src/commands/transcript/summarise/index.ts
17271
17435
  import { existsSync as existsSync42 } from "fs";
17272
- import { basename as basename10, dirname as dirname23, join as join44, relative as relative3 } from "path";
17436
+ import { basename as basename10, dirname as dirname25, join as join47, relative as relative3 } from "path";
17273
17437
 
17274
17438
  // src/commands/transcript/summarise/processStagedFile/index.ts
17275
17439
  import {
@@ -17279,17 +17443,17 @@ import {
17279
17443
  renameSync as renameSync3,
17280
17444
  rmSync as rmSync4
17281
17445
  } from "fs";
17282
- import { dirname as dirname22, join as join43 } from "path";
17446
+ import { dirname as dirname24, join as join46 } from "path";
17283
17447
 
17284
17448
  // src/commands/transcript/summarise/processStagedFile/validateStagedContent.ts
17285
- import chalk165 from "chalk";
17449
+ import chalk167 from "chalk";
17286
17450
  var FULL_TRANSCRIPT_REGEX = /^\[Full Transcript\]\(([^)]+)\)/;
17287
17451
  function validateStagedContent(filename, content) {
17288
17452
  const firstLine = content.split("\n")[0];
17289
17453
  const match = firstLine.match(FULL_TRANSCRIPT_REGEX);
17290
17454
  if (!match) {
17291
17455
  console.error(
17292
- chalk165.red(
17456
+ chalk167.red(
17293
17457
  `Staged file ${filename} missing [Full Transcript](<path>) link on first line.`
17294
17458
  )
17295
17459
  );
@@ -17298,7 +17462,7 @@ function validateStagedContent(filename, content) {
17298
17462
  const contentAfterLink = content.slice(firstLine.length).trim();
17299
17463
  if (!contentAfterLink) {
17300
17464
  console.error(
17301
- chalk165.red(
17465
+ chalk167.red(
17302
17466
  `Staged file ${filename} has no summary content after the transcript link.`
17303
17467
  )
17304
17468
  );
@@ -17308,7 +17472,7 @@ function validateStagedContent(filename, content) {
17308
17472
  }
17309
17473
 
17310
17474
  // src/commands/transcript/summarise/processStagedFile/index.ts
17311
- var STAGING_DIR = join43(process.cwd(), ".assist", "transcript");
17475
+ var STAGING_DIR = join46(process.cwd(), ".assist", "transcript");
17312
17476
  function processStagedFile() {
17313
17477
  if (!existsSync41(STAGING_DIR)) {
17314
17478
  return false;
@@ -17332,8 +17496,8 @@ function processStagedFile() {
17332
17496
  );
17333
17497
  process.exit(1);
17334
17498
  }
17335
- const destPath = join43(summaryDir, matchingTranscript.relativePath);
17336
- const destDir = dirname22(destPath);
17499
+ const destPath = join46(summaryDir, matchingTranscript.relativePath);
17500
+ const destDir = dirname24(destPath);
17337
17501
  if (!existsSync41(destDir)) {
17338
17502
  mkdirSync16(destDir, { recursive: true });
17339
17503
  }
@@ -17347,8 +17511,8 @@ function processStagedFile() {
17347
17511
 
17348
17512
  // src/commands/transcript/summarise/index.ts
17349
17513
  function buildRelativeKey(relativePath, baseName) {
17350
- const relDir = dirname23(relativePath);
17351
- return relDir === "." ? baseName : join44(relDir, baseName);
17514
+ const relDir = dirname25(relativePath);
17515
+ return relDir === "." ? baseName : join47(relDir, baseName);
17352
17516
  }
17353
17517
  function buildSummaryIndex(summaryDir) {
17354
17518
  const summaryFiles = findMdFilesRecursive(summaryDir);
@@ -17382,8 +17546,8 @@ function summarise2() {
17382
17546
  }
17383
17547
  const next3 = missing[0];
17384
17548
  const outputFilename = `${getTranscriptBaseName(next3.filename)}.md`;
17385
- const outputPath = join44(STAGING_DIR, outputFilename);
17386
- const summaryFileDir = join44(summaryDir, dirname23(next3.relativePath));
17549
+ const outputPath = join47(STAGING_DIR, outputFilename);
17550
+ const summaryFileDir = join47(summaryDir, dirname25(next3.relativePath));
17387
17551
  const relativeTranscriptPath = encodeURI(
17388
17552
  relative3(summaryFileDir, next3.absolutePath).replace(/\\/g, "/")
17389
17553
  );
@@ -17433,38 +17597,38 @@ function registerVerify(program2) {
17433
17597
 
17434
17598
  // src/commands/voice/devices.ts
17435
17599
  import { spawnSync as spawnSync5 } from "child_process";
17436
- import { join as join46 } from "path";
17600
+ import { join as join49 } from "path";
17437
17601
 
17438
17602
  // src/commands/voice/shared.ts
17439
- import { homedir as homedir13 } from "os";
17440
- import { dirname as dirname24, join as join45 } from "path";
17441
- import { fileURLToPath as fileURLToPath5 } from "url";
17442
- var __dirname5 = dirname24(fileURLToPath5(import.meta.url));
17443
- var VOICE_DIR = join45(homedir13(), ".assist", "voice");
17603
+ import { homedir as homedir14 } from "os";
17604
+ import { dirname as dirname26, join as join48 } from "path";
17605
+ import { fileURLToPath as fileURLToPath6 } from "url";
17606
+ var __dirname5 = dirname26(fileURLToPath6(import.meta.url));
17607
+ var VOICE_DIR = join48(homedir14(), ".assist", "voice");
17444
17608
  var voicePaths = {
17445
17609
  dir: VOICE_DIR,
17446
- pid: join45(VOICE_DIR, "voice.pid"),
17447
- log: join45(VOICE_DIR, "voice.log"),
17448
- venv: join45(VOICE_DIR, ".venv"),
17449
- lock: join45(VOICE_DIR, "voice.lock")
17610
+ pid: join48(VOICE_DIR, "voice.pid"),
17611
+ log: join48(VOICE_DIR, "voice.log"),
17612
+ venv: join48(VOICE_DIR, ".venv"),
17613
+ lock: join48(VOICE_DIR, "voice.lock")
17450
17614
  };
17451
17615
  function getPythonDir() {
17452
- return join45(__dirname5, "commands", "voice", "python");
17616
+ return join48(__dirname5, "commands", "voice", "python");
17453
17617
  }
17454
17618
  function getVenvPython() {
17455
- return process.platform === "win32" ? join45(voicePaths.venv, "Scripts", "python.exe") : join45(voicePaths.venv, "bin", "python");
17619
+ return process.platform === "win32" ? join48(voicePaths.venv, "Scripts", "python.exe") : join48(voicePaths.venv, "bin", "python");
17456
17620
  }
17457
17621
  function getLockDir() {
17458
17622
  const config = loadConfig();
17459
17623
  return config.voice?.lockDir ?? VOICE_DIR;
17460
17624
  }
17461
17625
  function getLockFile() {
17462
- return join45(getLockDir(), "voice.lock");
17626
+ return join48(getLockDir(), "voice.lock");
17463
17627
  }
17464
17628
 
17465
17629
  // src/commands/voice/devices.ts
17466
17630
  function devices() {
17467
- const script = join46(getPythonDir(), "list_devices.py");
17631
+ const script = join49(getPythonDir(), "list_devices.py");
17468
17632
  spawnSync5(getVenvPython(), [script], { stdio: "inherit" });
17469
17633
  }
17470
17634
 
@@ -17499,12 +17663,12 @@ function logs(options2) {
17499
17663
  // src/commands/voice/setup.ts
17500
17664
  import { spawnSync as spawnSync6 } from "child_process";
17501
17665
  import { mkdirSync as mkdirSync18 } from "fs";
17502
- import { join as join48 } from "path";
17666
+ import { join as join51 } from "path";
17503
17667
 
17504
17668
  // src/commands/voice/checkLockFile.ts
17505
17669
  import { execSync as execSync46 } from "child_process";
17506
17670
  import { existsSync as existsSync44, mkdirSync as mkdirSync17, readFileSync as readFileSync36, writeFileSync as writeFileSync32 } from "fs";
17507
- import { join as join47 } from "path";
17671
+ import { join as join50 } from "path";
17508
17672
  function isProcessAlive2(pid) {
17509
17673
  try {
17510
17674
  process.kill(pid, 0);
@@ -17541,7 +17705,7 @@ function bootstrapVenv() {
17541
17705
  }
17542
17706
  function writeLockFile(pid) {
17543
17707
  const lockFile = getLockFile();
17544
- mkdirSync17(join47(lockFile, ".."), { recursive: true });
17708
+ mkdirSync17(join50(lockFile, ".."), { recursive: true });
17545
17709
  writeFileSync32(
17546
17710
  lockFile,
17547
17711
  JSON.stringify({
@@ -17557,7 +17721,7 @@ function setup() {
17557
17721
  mkdirSync18(voicePaths.dir, { recursive: true });
17558
17722
  bootstrapVenv();
17559
17723
  console.log("\nDownloading models...\n");
17560
- const script = join48(getPythonDir(), "setup_models.py");
17724
+ const script = join51(getPythonDir(), "setup_models.py");
17561
17725
  const result = spawnSync6(getVenvPython(), [script], {
17562
17726
  stdio: "inherit",
17563
17727
  env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
@@ -17571,7 +17735,7 @@ function setup() {
17571
17735
  // src/commands/voice/start.ts
17572
17736
  import { spawn as spawn7 } from "child_process";
17573
17737
  import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync33 } from "fs";
17574
- import { join as join49 } from "path";
17738
+ import { join as join52 } from "path";
17575
17739
 
17576
17740
  // src/commands/voice/buildDaemonEnv.ts
17577
17741
  function buildDaemonEnv(options2) {
@@ -17609,7 +17773,7 @@ function start2(options2) {
17609
17773
  bootstrapVenv();
17610
17774
  const debug = options2.debug || options2.foreground || process.platform === "win32";
17611
17775
  const env = buildDaemonEnv({ debug });
17612
- const script = join49(getPythonDir(), "voice_daemon.py");
17776
+ const script = join52(getPythonDir(), "voice_daemon.py");
17613
17777
  const python = getVenvPython();
17614
17778
  if (options2.foreground) {
17615
17779
  spawnForeground(python, script, env);
@@ -17695,10 +17859,10 @@ function registerVoice(program2) {
17695
17859
 
17696
17860
  // src/commands/roam/auth.ts
17697
17861
  import { randomBytes } from "crypto";
17698
- import chalk166 from "chalk";
17862
+ import chalk168 from "chalk";
17699
17863
 
17700
17864
  // src/commands/roam/waitForCallback.ts
17701
- import { createServer as createServer2 } from "http";
17865
+ import { createServer as createServer3 } from "http";
17702
17866
  function respondHtml(res, status2, title) {
17703
17867
  res.writeHead(status2, { "Content-Type": "text/html" });
17704
17868
  res.end(
@@ -17721,7 +17885,7 @@ function waitForCallback(port, expectedState) {
17721
17885
  server.close();
17722
17886
  reject(new Error("Authorization timed out after 120 seconds"));
17723
17887
  }, 12e4);
17724
- const server = createServer2((req, res) => {
17888
+ const server = createServer3((req, res) => {
17725
17889
  const url = new URL(req.url ?? "/", `http://localhost:${port}`);
17726
17890
  if (url.pathname !== "/callback") {
17727
17891
  res.writeHead(404);
@@ -17826,13 +17990,13 @@ async function auth() {
17826
17990
  saveGlobalConfig(config);
17827
17991
  const state = randomBytes(16).toString("hex");
17828
17992
  console.log(
17829
- chalk166.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
17993
+ chalk168.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
17830
17994
  );
17831
- console.log(chalk166.white("http://localhost:14523/callback\n"));
17832
- console.log(chalk166.blue("Opening browser for authorization..."));
17833
- console.log(chalk166.dim("Waiting for authorization callback..."));
17995
+ console.log(chalk168.white("http://localhost:14523/callback\n"));
17996
+ console.log(chalk168.blue("Opening browser for authorization..."));
17997
+ console.log(chalk168.dim("Waiting for authorization callback..."));
17834
17998
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
17835
- console.log(chalk166.dim("Exchanging code for tokens..."));
17999
+ console.log(chalk168.dim("Exchanging code for tokens..."));
17836
18000
  const tokens = await exchangeToken({
17837
18001
  code,
17838
18002
  clientId,
@@ -17848,14 +18012,14 @@ async function auth() {
17848
18012
  };
17849
18013
  saveGlobalConfig(config);
17850
18014
  console.log(
17851
- chalk166.green("Roam credentials and tokens saved to ~/.assist.yml")
18015
+ chalk168.green("Roam credentials and tokens saved to ~/.assist.yml")
17852
18016
  );
17853
18017
  }
17854
18018
 
17855
18019
  // src/commands/roam/postRoamActivity.ts
17856
18020
  import { execFileSync as execFileSync7 } from "child_process";
17857
18021
  import { readdirSync as readdirSync8, readFileSync as readFileSync39, statSync as statSync6 } from "fs";
17858
- import { join as join50 } from "path";
18022
+ import { join as join53 } from "path";
17859
18023
  function findPortFile(roamDir) {
17860
18024
  let entries;
17861
18025
  try {
@@ -17864,7 +18028,7 @@ function findPortFile(roamDir) {
17864
18028
  return void 0;
17865
18029
  }
17866
18030
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
17867
- const path58 = join50(roamDir, name);
18031
+ const path58 = join53(roamDir, name);
17868
18032
  try {
17869
18033
  return { path: path58, mtimeMs: statSync6(path58).mtimeMs };
17870
18034
  } catch {
@@ -17876,7 +18040,7 @@ function findPortFile(roamDir) {
17876
18040
  function postRoamActivity(app, event) {
17877
18041
  const appData = process.env.APPDATA;
17878
18042
  if (!appData) return;
17879
- const portFile = findPortFile(join50(appData, "Roam"));
18043
+ const portFile = findPortFile(join53(appData, "Roam"));
17880
18044
  if (!portFile) return;
17881
18045
  let port;
17882
18046
  try {
@@ -18023,13 +18187,13 @@ function runPreCommands(pre, cwd) {
18023
18187
  // src/commands/run/spawnRunCommand.ts
18024
18188
  import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
18025
18189
  import { existsSync as existsSync47 } from "fs";
18026
- import { dirname as dirname25, join as join51, resolve as resolve11 } from "path";
18190
+ import { dirname as dirname27, join as join54, resolve as resolve11 } from "path";
18027
18191
  function resolveCommand2(command) {
18028
18192
  if (process.platform !== "win32" || command !== "bash") return command;
18029
18193
  try {
18030
18194
  const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
18031
- const gitRoot = resolve11(dirname25(gitPath), "..");
18032
- const gitBash = join51(gitRoot, "bin", "bash.exe");
18195
+ const gitRoot = resolve11(dirname27(gitPath), "..");
18196
+ const gitBash = join54(gitRoot, "bin", "bash.exe");
18033
18197
  if (existsSync47(gitBash)) return gitBash;
18034
18198
  } catch {
18035
18199
  }
@@ -18116,7 +18280,7 @@ async function run3(name, args) {
18116
18280
 
18117
18281
  // src/commands/run/add.ts
18118
18282
  import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync34 } from "fs";
18119
- import { join as join52 } from "path";
18283
+ import { join as join55 } from "path";
18120
18284
 
18121
18285
  // src/commands/run/extractOption.ts
18122
18286
  function extractOption(args, flag) {
@@ -18177,7 +18341,7 @@ function saveNewRunConfig(name, command, args, cwd) {
18177
18341
  saveConfig(config);
18178
18342
  }
18179
18343
  function createCommandFile(name) {
18180
- const dir = join52(".claude", "commands");
18344
+ const dir = join55(".claude", "commands");
18181
18345
  mkdirSync20(dir, { recursive: true });
18182
18346
  const content = `---
18183
18347
  description: Run ${name}
@@ -18185,7 +18349,7 @@ description: Run ${name}
18185
18349
 
18186
18350
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
18187
18351
  `;
18188
- const filePath = join52(dir, `${name}.md`);
18352
+ const filePath = join55(dir, `${name}.md`);
18189
18353
  writeFileSync34(filePath, content);
18190
18354
  console.log(`Created command file: ${filePath}`);
18191
18355
  }
@@ -18242,7 +18406,7 @@ function link2() {
18242
18406
 
18243
18407
  // src/commands/run/remove.ts
18244
18408
  import { existsSync as existsSync48, unlinkSync as unlinkSync16 } from "fs";
18245
- import { join as join53 } from "path";
18409
+ import { join as join56 } from "path";
18246
18410
  function findRemoveIndex() {
18247
18411
  const idx = process.argv.indexOf("remove");
18248
18412
  if (idx === -1 || idx + 1 >= process.argv.length) return -1;
@@ -18257,7 +18421,7 @@ function parseRemoveName() {
18257
18421
  return process.argv[idx + 1];
18258
18422
  }
18259
18423
  function deleteCommandFile(name) {
18260
- const filePath = join53(".claude", "commands", `${name}.md`);
18424
+ const filePath = join56(".claude", "commands", `${name}.md`);
18261
18425
  if (existsSync48(filePath)) {
18262
18426
  unlinkSync16(filePath);
18263
18427
  console.log(`Deleted command file: ${filePath}`);
@@ -18299,8 +18463,8 @@ function registerRun(program2) {
18299
18463
  import { execSync as execSync48 } from "child_process";
18300
18464
  import { existsSync as existsSync49, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync35 } from "fs";
18301
18465
  import { tmpdir as tmpdir7 } from "os";
18302
- import { join as join54, resolve as resolve13 } from "path";
18303
- import chalk167 from "chalk";
18466
+ import { join as join57, resolve as resolve13 } from "path";
18467
+ import chalk169 from "chalk";
18304
18468
 
18305
18469
  // src/commands/screenshot/captureWindowPs1.ts
18306
18470
  var captureWindowPs1 = `
@@ -18436,7 +18600,7 @@ function buildOutputPath(outputDir, processName) {
18436
18600
  return resolve13(outputDir, `${processName}-${timestamp2}.png`);
18437
18601
  }
18438
18602
  function runPowerShellScript(processName, outputPath) {
18439
- const scriptPath = join54(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
18603
+ const scriptPath = join57(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
18440
18604
  writeFileSync35(scriptPath, captureWindowPs1, "utf8");
18441
18605
  try {
18442
18606
  execSync48(
@@ -18451,13 +18615,13 @@ function screenshot(processName) {
18451
18615
  const config = loadConfig();
18452
18616
  const outputDir = resolve13(config.screenshot.outputDir);
18453
18617
  const outputPath = buildOutputPath(outputDir, processName);
18454
- console.log(chalk167.gray(`Capturing window for process "${processName}" ...`));
18618
+ console.log(chalk169.gray(`Capturing window for process "${processName}" ...`));
18455
18619
  try {
18456
18620
  runPowerShellScript(processName, outputPath);
18457
- console.log(chalk167.green(`Screenshot saved: ${outputPath}`));
18621
+ console.log(chalk169.green(`Screenshot saved: ${outputPath}`));
18458
18622
  } catch (error) {
18459
18623
  const msg = error instanceof Error ? error.message : String(error);
18460
- console.error(chalk167.red(`Failed to capture screenshot: ${msg}`));
18624
+ console.error(chalk169.red(`Failed to capture screenshot: ${msg}`));
18461
18625
  process.exit(1);
18462
18626
  }
18463
18627
  }
@@ -18644,6 +18808,7 @@ var persistedSessionSchema = z6.object({
18644
18808
  commandType: z6.enum(["claude", "run", "assist"]),
18645
18809
  cwd: z6.string(),
18646
18810
  startedAt: z6.number(),
18811
+ runningMs: z6.number().optional(),
18647
18812
  claudeSessionId: z6.string().optional(),
18648
18813
  runName: z6.string().optional(),
18649
18814
  runArgs: z6.array(z6.string()).optional(),
@@ -18672,6 +18837,7 @@ function toPersistedSession(session) {
18672
18837
  commandType: session.commandType,
18673
18838
  cwd: session.cwd ?? process.cwd(),
18674
18839
  startedAt: session.startedAt,
18840
+ runningMs: accumulatedRunningMs(session),
18675
18841
  claudeSessionId: session.claudeSessionId,
18676
18842
  runName: session.runName,
18677
18843
  runArgs: session.runArgs,
@@ -18679,6 +18845,9 @@ function toPersistedSession(session) {
18679
18845
  activity: session.activity
18680
18846
  };
18681
18847
  }
18848
+ function accumulatedRunningMs(session) {
18849
+ return session.runningSince != null ? session.runningMs + Date.now() - session.runningSince : session.runningMs;
18850
+ }
18682
18851
 
18683
18852
  // src/commands/sessions/daemon/toSessionInfo.ts
18684
18853
  function toSessionInfo({
@@ -18687,6 +18856,8 @@ function toSessionInfo({
18687
18856
  commandType,
18688
18857
  status: status2,
18689
18858
  startedAt,
18859
+ runningMs,
18860
+ runningSince,
18690
18861
  runName,
18691
18862
  runArgs,
18692
18863
  assistArgs,
@@ -18703,6 +18874,8 @@ function toSessionInfo({
18703
18874
  commandType,
18704
18875
  status: status2,
18705
18876
  startedAt,
18877
+ runningMs,
18878
+ runningSince,
18706
18879
  runName,
18707
18880
  runArgs,
18708
18881
  assistArgs,
@@ -18828,12 +19001,15 @@ function shellEscape(s) {
18828
19001
 
18829
19002
  // src/commands/sessions/daemon/createAssistSession.ts
18830
19003
  function createAssistSession(id2, assistArgs, cwd) {
19004
+ const startedAt = Date.now();
18831
19005
  return {
18832
19006
  id: id2,
18833
19007
  name: `assist ${assistArgs.join(" ")}`,
18834
19008
  commandType: "assist",
18835
19009
  status: "running",
18836
- startedAt: Date.now(),
19010
+ startedAt,
19011
+ runningMs: 0,
19012
+ runningSince: startedAt,
18837
19013
  pty: spawnPty(["assist", ...assistArgs], cwd, id2),
18838
19014
  scrollback: "",
18839
19015
  assistArgs,
@@ -18861,24 +19037,30 @@ function spawnRun(opts) {
18861
19037
 
18862
19038
  // src/commands/sessions/daemon/createSession.ts
18863
19039
  function createSession(id2, prompt, cwd) {
19040
+ const startedAt = Date.now();
18864
19041
  return {
18865
19042
  id: id2,
18866
19043
  name: prompt?.slice(0, 40) || `Session ${id2}`,
18867
19044
  commandType: "claude",
18868
19045
  status: "running",
18869
- startedAt: Date.now(),
19046
+ startedAt,
19047
+ runningMs: 0,
19048
+ runningSince: startedAt,
18870
19049
  pty: spawnClaude2({ prompt, cwd, sessionId: id2 }),
18871
19050
  scrollback: "",
18872
19051
  cwd
18873
19052
  };
18874
19053
  }
18875
19054
  function createRunSession(id2, runName, runArgs, cwd) {
19055
+ const startedAt = Date.now();
18876
19056
  return {
18877
19057
  id: id2,
18878
19058
  name: `run: ${runName}`,
18879
19059
  commandType: "run",
18880
19060
  status: "running",
18881
- startedAt: Date.now(),
19061
+ startedAt,
19062
+ runningMs: 0,
19063
+ runningSince: startedAt,
18882
19064
  pty: spawnRun({ name: runName, args: runArgs, cwd }),
18883
19065
  scrollback: "",
18884
19066
  runName,
@@ -18902,6 +19084,16 @@ function greetClient(client, sessions, windowsProxy) {
18902
19084
  void windowsProxy.discover();
18903
19085
  }
18904
19086
 
19087
+ // src/commands/sessions/daemon/setStatus.ts
19088
+ function setStatus2(session, newStatus) {
19089
+ const now = Date.now();
19090
+ if (session.status === "running" && session.runningSince != null) {
19091
+ session.runningMs += now - session.runningSince;
19092
+ }
19093
+ session.runningSince = newStatus === "running" ? now : null;
19094
+ session.status = newStatus;
19095
+ }
19096
+
18905
19097
  // src/commands/sessions/daemon/watchEscInterrupt.ts
18906
19098
  var ESC2 = "\x1B";
18907
19099
  var SETTLE_MS = 1e3;
@@ -18957,7 +19149,7 @@ function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseFo
18957
19149
  disarmEscInterrupt(session);
18958
19150
  if (session.status === status2) return;
18959
19151
  daemonLog(`session ${session.id} status: ${session.status} -> ${status2}`);
18960
- session.status = status2;
19152
+ setStatus2(session, status2);
18961
19153
  if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null) {
18962
19154
  reuseForRun(session, session.activity.itemId);
18963
19155
  notify2();
@@ -18990,6 +19182,8 @@ function errorSession(id2, persisted, error) {
18990
19182
  ...restoreBase(id2, persisted),
18991
19183
  status: "error",
18992
19184
  startedAt: persisted.startedAt,
19185
+ runningMs: persisted.runningMs ?? 0,
19186
+ runningSince: null,
18993
19187
  pty: null,
18994
19188
  runName: persisted.runName,
18995
19189
  runArgs: persisted.runArgs,
@@ -19006,10 +19200,13 @@ function backlogRunArgs(persisted) {
19006
19200
 
19007
19201
  // src/commands/sessions/daemon/runningSession.ts
19008
19202
  function runningSession(base, persisted, pty2) {
19203
+ const startedAt = Date.now();
19009
19204
  return {
19010
19205
  ...base,
19011
19206
  status: "running",
19012
- startedAt: Date.now(),
19207
+ startedAt,
19208
+ runningMs: persisted.runningMs ?? 0,
19209
+ runningSince: startedAt,
19013
19210
  pty: pty2,
19014
19211
  claudeSessionId: persisted.claudeSessionId,
19015
19212
  restored: true,
@@ -19044,6 +19241,8 @@ function restoreSession(id2, persisted) {
19044
19241
  ...base,
19045
19242
  status: "done",
19046
19243
  startedAt: persisted.startedAt,
19244
+ runningMs: persisted.runningMs ?? 0,
19245
+ runningSince: null,
19047
19246
  pty: null,
19048
19247
  runName: persisted.runName,
19049
19248
  runArgs: persisted.runArgs,
@@ -19086,12 +19285,15 @@ function restoreAll(spawn12, sessions) {
19086
19285
 
19087
19286
  // src/commands/sessions/daemon/resumeSession.ts
19088
19287
  function resumeSession(id2, sessionId, cwd, name) {
19288
+ const startedAt = Date.now();
19089
19289
  return {
19090
19290
  id: id2,
19091
19291
  name: name ? `${name.slice(0, 36)} (R)` : `Resume ${sessionId.slice(0, 8)}`,
19092
19292
  commandType: "claude",
19093
19293
  status: "running",
19094
- startedAt: Date.now(),
19294
+ startedAt,
19295
+ runningMs: 0,
19296
+ runningSince: startedAt,
19095
19297
  pty: spawnClaude2({ resumeSessionId: sessionId, cwd, sessionId: id2 }),
19096
19298
  scrollback: "",
19097
19299
  cwd
@@ -19100,12 +19302,12 @@ function resumeSession(id2, sessionId, cwd, name) {
19100
19302
 
19101
19303
  // src/commands/sessions/daemon/watchActivity.ts
19102
19304
  import { existsSync as existsSync51, mkdirSync as mkdirSync22, watch } from "fs";
19103
- import { dirname as dirname26 } from "path";
19305
+ import { dirname as dirname28 } from "path";
19104
19306
  var DEBOUNCE_MS = 50;
19105
19307
  function watchActivity(session, notify2) {
19106
19308
  if (session.commandType !== "assist" || !session.cwd) return;
19107
19309
  const path58 = activityPath(session.id);
19108
- const dir = dirname26(path58);
19310
+ const dir = dirname28(path58);
19109
19311
  try {
19110
19312
  mkdirSync22(dir, { recursive: true });
19111
19313
  } catch {
@@ -19172,8 +19374,10 @@ function retrySession(session, clients, onStatusChange) {
19172
19374
  if (!respawn) return false;
19173
19375
  if (session.status !== "done") session.pty?.kill();
19174
19376
  session.scrollback = "";
19175
- session.status = "running";
19176
19377
  session.startedAt = Date.now();
19378
+ session.runningMs = 0;
19379
+ session.runningSince = null;
19380
+ setStatus2(session, "running");
19177
19381
  session.restored = void 0;
19178
19382
  session.pty = respawn();
19179
19383
  broadcast(clients, { type: "clear", sessionId: session.id });
@@ -19196,8 +19400,10 @@ function reuseSessionForRun(session, itemId, clients, onStatusChange) {
19196
19400
  session.assistArgs = assistArgs;
19197
19401
  session.name = `assist ${assistArgs.join(" ")}`;
19198
19402
  session.commandType = "assist";
19199
- session.status = "running";
19200
19403
  session.startedAt = Date.now();
19404
+ session.runningMs = 0;
19405
+ session.runningSince = null;
19406
+ setStatus2(session, "running");
19201
19407
  session.restored = void 0;
19202
19408
  session.pty = spawnPty(["assist", ...assistArgs], session.cwd, session.id);
19203
19409
  wirePtyEvents(session, clients, onStatusChange);
@@ -20502,7 +20708,7 @@ async function setSessionStatus(status2) {
20502
20708
 
20503
20709
  // src/commands/sessions/summarise/index.ts
20504
20710
  import * as fs35 from "fs";
20505
- import chalk168 from "chalk";
20711
+ import chalk170 from "chalk";
20506
20712
 
20507
20713
  // src/commands/sessions/summarise/shared.ts
20508
20714
  import * as fs33 from "fs";
@@ -20656,22 +20862,22 @@ ${firstMessage}`);
20656
20862
  async function summarise3(options2) {
20657
20863
  const files = await discoverSessionFiles();
20658
20864
  if (files.length === 0) {
20659
- console.log(chalk168.yellow("No sessions found."));
20865
+ console.log(chalk170.yellow("No sessions found."));
20660
20866
  return;
20661
20867
  }
20662
20868
  const toProcess = selectCandidates(files, options2);
20663
20869
  if (toProcess.length === 0) {
20664
- console.log(chalk168.green("All sessions already summarised."));
20870
+ console.log(chalk170.green("All sessions already summarised."));
20665
20871
  return;
20666
20872
  }
20667
20873
  console.log(
20668
- chalk168.cyan(
20874
+ chalk170.cyan(
20669
20875
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
20670
20876
  )
20671
20877
  );
20672
20878
  const { succeeded, failed: failed2 } = processSessions(toProcess);
20673
20879
  console.log(
20674
- chalk168.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk168.yellow(`, ${failed2} skipped`) : "")
20880
+ chalk170.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk170.yellow(`, ${failed2} skipped`) : "")
20675
20881
  );
20676
20882
  }
20677
20883
  function selectCandidates(files, options2) {
@@ -20691,16 +20897,16 @@ function processSessions(files) {
20691
20897
  let failed2 = 0;
20692
20898
  for (let i = 0; i < files.length; i++) {
20693
20899
  const file = files[i];
20694
- process.stdout.write(chalk168.dim(` [${i + 1}/${files.length}] `));
20900
+ process.stdout.write(chalk170.dim(` [${i + 1}/${files.length}] `));
20695
20901
  const summary = summariseSession(file);
20696
20902
  if (summary) {
20697
20903
  writeSummary(file, summary);
20698
20904
  succeeded++;
20699
- process.stdout.write(`${chalk168.green("\u2713")} ${summary}
20905
+ process.stdout.write(`${chalk170.green("\u2713")} ${summary}
20700
20906
  `);
20701
20907
  } else {
20702
20908
  failed2++;
20703
- process.stdout.write(` ${chalk168.yellow("skip")}
20909
+ process.stdout.write(` ${chalk170.yellow("skip")}
20704
20910
  `);
20705
20911
  }
20706
20912
  }
@@ -20718,10 +20924,10 @@ function registerSessions(program2) {
20718
20924
  }
20719
20925
 
20720
20926
  // src/commands/statusLine.ts
20721
- import chalk170 from "chalk";
20927
+ import chalk172 from "chalk";
20722
20928
 
20723
20929
  // src/commands/buildLimitsSegment.ts
20724
- import chalk169 from "chalk";
20930
+ import chalk171 from "chalk";
20725
20931
 
20726
20932
  // src/shared/rateLimitLevel.ts
20727
20933
  var FIVE_HOUR_SECONDS = 5 * 3600;
@@ -20752,9 +20958,9 @@ function rateLimitLevel(pct, resetsAt, windowSeconds, now) {
20752
20958
 
20753
20959
  // src/commands/buildLimitsSegment.ts
20754
20960
  var LEVEL_COLOR = {
20755
- ok: chalk169.green,
20756
- warn: chalk169.yellow,
20757
- over: chalk169.red
20961
+ ok: chalk171.green,
20962
+ warn: chalk171.yellow,
20963
+ over: chalk171.red
20758
20964
  };
20759
20965
  function formatLimit(pct, resetsAt, windowSeconds, fallbackLabel, now) {
20760
20966
  const level = rateLimitLevel(pct, resetsAt, windowSeconds, now);
@@ -20794,14 +21000,14 @@ async function relayRateLimits(rateLimits) {
20794
21000
  }
20795
21001
 
20796
21002
  // src/commands/statusLine.ts
20797
- chalk170.level = 3;
21003
+ chalk172.level = 3;
20798
21004
  function formatNumber(num) {
20799
21005
  return num.toLocaleString("en-US");
20800
21006
  }
20801
21007
  function colorizePercent(pct) {
20802
21008
  const label2 = `${Math.round(pct)}%`;
20803
- if (pct > 80) return chalk170.red(label2);
20804
- if (pct > 40) return chalk170.yellow(label2);
21009
+ if (pct > 80) return chalk172.red(label2);
21010
+ if (pct > 40) return chalk172.yellow(label2);
20805
21011
  return label2;
20806
21012
  }
20807
21013
  async function statusLine() {
@@ -20820,12 +21026,12 @@ async function statusLine() {
20820
21026
  import * as fs38 from "fs";
20821
21027
  import * as os2 from "os";
20822
21028
  import * as path56 from "path";
20823
- import { fileURLToPath as fileURLToPath6 } from "url";
21029
+ import { fileURLToPath as fileURLToPath7 } from "url";
20824
21030
 
20825
21031
  // src/commands/sync/syncClaudeMd.ts
20826
21032
  import * as fs36 from "fs";
20827
21033
  import * as path54 from "path";
20828
- import chalk171 from "chalk";
21034
+ import chalk173 from "chalk";
20829
21035
  async function syncClaudeMd(claudeDir, targetBase, options2) {
20830
21036
  const source = path54.join(claudeDir, "CLAUDE.md");
20831
21037
  const target = path54.join(targetBase, "CLAUDE.md");
@@ -20834,12 +21040,12 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
20834
21040
  const targetContent = fs36.readFileSync(target, "utf8");
20835
21041
  if (sourceContent !== targetContent) {
20836
21042
  console.log(
20837
- chalk171.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
21043
+ chalk173.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
20838
21044
  );
20839
21045
  console.log();
20840
21046
  printDiff(targetContent, sourceContent);
20841
21047
  const confirm = options2?.yes || await promptConfirm(
20842
- chalk171.red("Overwrite existing CLAUDE.md?"),
21048
+ chalk173.red("Overwrite existing CLAUDE.md?"),
20843
21049
  false
20844
21050
  );
20845
21051
  if (!confirm) {
@@ -20855,7 +21061,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
20855
21061
  // src/commands/sync/syncSettings.ts
20856
21062
  import * as fs37 from "fs";
20857
21063
  import * as path55 from "path";
20858
- import chalk172 from "chalk";
21064
+ import chalk174 from "chalk";
20859
21065
  async function syncSettings(claudeDir, targetBase, options2) {
20860
21066
  const source = path55.join(claudeDir, "settings.json");
20861
21067
  const target = path55.join(targetBase, "settings.json");
@@ -20871,14 +21077,14 @@ async function syncSettings(claudeDir, targetBase, options2) {
20871
21077
  if (mergedContent !== normalizedTarget) {
20872
21078
  if (!options2?.yes) {
20873
21079
  console.log(
20874
- chalk172.yellow(
21080
+ chalk174.yellow(
20875
21081
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
20876
21082
  )
20877
21083
  );
20878
21084
  console.log();
20879
21085
  printDiff(targetContent, mergedContent);
20880
21086
  const confirm = await promptConfirm(
20881
- chalk172.red("Overwrite existing settings.json?"),
21087
+ chalk174.red("Overwrite existing settings.json?"),
20882
21088
  false
20883
21089
  );
20884
21090
  if (!confirm) {
@@ -20893,7 +21099,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
20893
21099
  }
20894
21100
 
20895
21101
  // src/commands/sync.ts
20896
- var __filename4 = fileURLToPath6(import.meta.url);
21102
+ var __filename4 = fileURLToPath7(import.meta.url);
20897
21103
  var __dirname6 = path56.dirname(__filename4);
20898
21104
  async function sync(options2) {
20899
21105
  const config = loadConfig();
@@ -21011,6 +21217,7 @@ registerDeploy(program);
21011
21217
  registerComplexity(program);
21012
21218
  registerDotnet(program);
21013
21219
  registerNews(program);
21220
+ registerNetcap(program);
21014
21221
  registerRavendb(program);
21015
21222
  registerSeq(program);
21016
21223
  registerSql(program);