@staff0rd/assist 0.241.0 → 0.242.1

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.241.0",
9
+ version: "0.242.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -115,10 +115,10 @@ import { stringify as stringifyYaml } from "yaml";
115
115
  // src/shared/loadRawYaml.ts
116
116
  import { existsSync, readFileSync } from "fs";
117
117
  import { parse as parseYaml } from "yaml";
118
- function loadRawYaml(path52) {
119
- if (!existsSync(path52)) return {};
118
+ function loadRawYaml(path53) {
119
+ if (!existsSync(path53)) return {};
120
120
  try {
121
- const content = readFileSync(path52, "utf-8");
121
+ const content = readFileSync(path53, "utf-8");
122
122
  return parseYaml(content) || {};
123
123
  } catch {
124
124
  return {};
@@ -2754,9 +2754,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
2754
2754
  function backupLocalBacklogFiles(dir) {
2755
2755
  const moved = [];
2756
2756
  for (const name of LOCAL_FILES) {
2757
- const path52 = join10(dir, ".assist", name);
2758
- if (existsSync14(path52)) {
2759
- renameSync(path52, `${path52}.bak`);
2757
+ const path53 = join10(dir, ".assist", name);
2758
+ if (existsSync14(path53)) {
2759
+ renameSync(path53, `${path53}.bak`);
2760
2760
  moved.push(`${name} \u2192 ${name}.bak`);
2761
2761
  }
2762
2762
  }
@@ -3045,8 +3045,8 @@ var backlogItemSchema = z3.strictObject({
3045
3045
  var backlogFileSchema = z3.array(backlogItemSchema);
3046
3046
 
3047
3047
  // src/commands/backlog/parseBacklogJsonl.ts
3048
- function parseBacklogJsonl(path52) {
3049
- const content = readFileSync9(path52, "utf-8").trim();
3048
+ function parseBacklogJsonl(path53) {
3049
+ const content = readFileSync9(path53, "utf-8").trim();
3050
3050
  if (content.length === 0) return [];
3051
3051
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
3052
3052
  }
@@ -3121,8 +3121,8 @@ function findBacklogUp(startDir) {
3121
3121
 
3122
3122
  // src/commands/backlog/getCurrentOrigin.ts
3123
3123
  import { execSync as execSync17 } from "child_process";
3124
- function stripLeadingSlashes(path52) {
3125
- return path52.replace(/^\/+/, "");
3124
+ function stripLeadingSlashes(path53) {
3125
+ return path53.replace(/^\/+/, "");
3126
3126
  }
3127
3127
  function normalizeOrigin(raw) {
3128
3128
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -3587,10 +3587,10 @@ function writeSignal(event, data) {
3587
3587
 
3588
3588
  // src/commands/backlog/readSignal.ts
3589
3589
  function readSignal() {
3590
- const path52 = getSignalPath();
3591
- if (!existsSync18(path52)) return void 0;
3590
+ const path53 = getSignalPath();
3591
+ if (!existsSync18(path53)) return void 0;
3592
3592
  try {
3593
- return JSON.parse(readFileSync11(path52, "utf-8"));
3593
+ return JSON.parse(readFileSync11(path53, "utf-8"));
3594
3594
  } catch {
3595
3595
  return void 0;
3596
3596
  }
@@ -4113,6 +4113,12 @@ function createFallbackHandler(routes3, htmlHandler2, extra) {
4113
4113
  };
4114
4114
  }
4115
4115
 
4116
+ // src/commands/backlog/web/applyCwdFromReq.ts
4117
+ function applyCwdFromReq(req) {
4118
+ const url = new URL(req.url ?? "/", "http://localhost");
4119
+ setBacklogDir(url.searchParams.get("cwd") ?? void 0);
4120
+ }
4121
+
4116
4122
  // src/commands/backlog/web/parseItemBody.ts
4117
4123
  function readBody(req) {
4118
4124
  return new Promise((resolve15, reject) => {
@@ -4137,6 +4143,7 @@ async function parseRewindBody(req) {
4137
4143
  // src/commands/backlog/web/createItem.ts
4138
4144
  async function createItem(req, res) {
4139
4145
  const body = await parseItemBody(req);
4146
+ applyCwdFromReq(req);
4140
4147
  const orm = await getBacklogOrm();
4141
4148
  const newItem = {
4142
4149
  type: body.type ?? "story",
@@ -4149,11 +4156,29 @@ async function createItem(req, res) {
4149
4156
  respondJson(res, 201, { id, ...newItem });
4150
4157
  }
4151
4158
 
4159
+ // src/commands/backlog/web/getBacklogExists.ts
4160
+ async function getBacklogExists(req, res) {
4161
+ applyCwdFromReq(req);
4162
+ const items2 = await loadBacklog();
4163
+ respondJson(res, 200, { exists: items2.length > 0 });
4164
+ }
4165
+
4152
4166
  // src/commands/backlog/web/rewindItemPhase.ts
4153
- import { eq as eq10 } from "drizzle-orm";
4167
+ import { eq as eq11 } from "drizzle-orm";
4168
+
4169
+ // src/commands/backlog/deleteComment.ts
4170
+ import { and as and2, eq as eq10 } from "drizzle-orm";
4171
+ async function deleteComment(orm, itemId, commentId) {
4172
+ const [row] = await orm.select({ type: comments.type }).from(comments).where(and2(eq10(comments.id, commentId), eq10(comments.itemId, itemId)));
4173
+ if (!row) return "not-found";
4174
+ if (row.type === "summary") return "is-summary";
4175
+ await orm.delete(comments).where(and2(eq10(comments.id, commentId), eq10(comments.itemId, itemId)));
4176
+ return "deleted";
4177
+ }
4154
4178
 
4155
4179
  // src/commands/backlog/web/shared.ts
4156
4180
  async function listItems(req, res) {
4181
+ applyCwdFromReq(req);
4157
4182
  const url = new URL(req.url ?? "/", "http://localhost");
4158
4183
  const q = url.searchParams.get("q");
4159
4184
  respondJson(res, 200, q ? await searchBacklog(q) : await loadBacklog());
@@ -4177,6 +4202,24 @@ async function deleteItem2(res, id) {
4177
4202
  await deleteItem(result.orm, id);
4178
4203
  respondJson(res, 200, result.item);
4179
4204
  }
4205
+ async function deleteItemComment(res, itemId, commentId) {
4206
+ const result = await findItemOr404(res, itemId);
4207
+ if (!result) return;
4208
+ const outcome = await deleteComment(result.orm, itemId, commentId);
4209
+ if (outcome === "not-found") {
4210
+ respondJson(res, 404, {
4211
+ error: `Comment #${commentId} not found on item #${itemId}.`
4212
+ });
4213
+ return;
4214
+ }
4215
+ if (outcome === "is-summary") {
4216
+ respondJson(res, 400, {
4217
+ error: `Comment #${commentId} is a phase summary and cannot be deleted.`
4218
+ });
4219
+ return;
4220
+ }
4221
+ respondJson(res, 200, await loadItem(result.orm, itemId));
4222
+ }
4180
4223
  async function patchItemStatus(req, res, id) {
4181
4224
  const { status: status2 } = await parseStatusBody(req);
4182
4225
  const result = await findItemOr404(res, id);
@@ -4204,7 +4247,7 @@ async function rewindItemPhase(req, res, id) {
4204
4247
  `Rewound to phase ${phase} (${phaseName}): ${reason}`,
4205
4248
  { phase }
4206
4249
  );
4207
- await orm.update(items).set({ currentPhase: phase, status: "in-progress" }).where(eq10(items.id, id));
4250
+ await orm.update(items).set({ currentPhase: phase, status: "in-progress" }).where(eq11(items.id, id));
4208
4251
  respondJson(res, 200, await loadItem(orm, id));
4209
4252
  }
4210
4253
  function validateRewind(item, phase) {
@@ -4222,7 +4265,7 @@ function validateRewind(item, phase) {
4222
4265
  }
4223
4266
 
4224
4267
  // src/commands/backlog/web/updateItem.ts
4225
- import { eq as eq11 } from "drizzle-orm";
4268
+ import { eq as eq12 } from "drizzle-orm";
4226
4269
  async function updateItem(req, res, id) {
4227
4270
  const body = await parseItemBody(req);
4228
4271
  const result = await findItemOr404(res, id);
@@ -4233,7 +4276,7 @@ async function updateItem(req, res, id) {
4233
4276
  name: body.name,
4234
4277
  description: body.description ?? null,
4235
4278
  acceptanceCriteria: JSON.stringify(body.acceptanceCriteria ?? [])
4236
- }).where(eq11(items.id, id));
4279
+ }).where(eq12(items.id, id));
4237
4280
  respondJson(res, 200, await loadItem(orm, id));
4238
4281
  }
4239
4282
 
@@ -4247,17 +4290,47 @@ var itemRoutes = {
4247
4290
  async function handleItemRoute(req, res, pathname) {
4248
4291
  const rewindMatch = pathname.match(/^\/api\/items\/(\d+)\/rewind$/);
4249
4292
  if (rewindMatch && req.method === "POST") {
4293
+ applyCwdFromReq(req);
4250
4294
  await rewindItemPhase(req, res, Number.parseInt(rewindMatch[1], 10));
4251
4295
  return true;
4252
4296
  }
4297
+ const commentMatch = pathname.match(/^\/api\/items\/(\d+)\/comments\/(\d+)$/);
4298
+ if (commentMatch && req.method === "DELETE") {
4299
+ applyCwdFromReq(req);
4300
+ await deleteItemComment(
4301
+ res,
4302
+ Number.parseInt(commentMatch[1], 10),
4303
+ Number.parseInt(commentMatch[2], 10)
4304
+ );
4305
+ return true;
4306
+ }
4253
4307
  const match = pathname.match(/^\/api\/items\/(\d+)$/);
4254
4308
  if (!match) return false;
4255
4309
  const handler = itemRoutes[req.method ?? "GET"];
4256
4310
  if (!handler) return false;
4311
+ applyCwdFromReq(req);
4257
4312
  await handler(req, res, Number.parseInt(match[1], 10));
4258
4313
  return true;
4259
4314
  }
4260
4315
 
4316
+ // src/commands/backlog/init/index.ts
4317
+ import chalk44 from "chalk";
4318
+ async function init6() {
4319
+ await getBacklogOrm();
4320
+ console.log(
4321
+ chalk44.green(
4322
+ `Backlog database ready. This repository maps to origin: ${getOrigin()}`
4323
+ )
4324
+ );
4325
+ }
4326
+
4327
+ // src/commands/backlog/web/initBacklog.ts
4328
+ async function initBacklog(req, res) {
4329
+ applyCwdFromReq(req);
4330
+ await init6();
4331
+ respondJson(res, 200, { ok: true });
4332
+ }
4333
+
4261
4334
  // src/commands/sessions/web/getHtml.ts
4262
4335
  function getHtml() {
4263
4336
  return `<!DOCTYPE html>
@@ -4309,7 +4382,9 @@ var routes = {
4309
4382
  ),
4310
4383
  "GET /xterm.css": createCssHandler("@xterm/xterm/css/xterm.css"),
4311
4384
  "GET /api/items": listItems,
4312
- "POST /api/items": createItem
4385
+ "POST /api/items": createItem,
4386
+ "GET /api/backlog/exists": getBacklogExists,
4387
+ "POST /api/backlog/init": initBacklog
4313
4388
  };
4314
4389
  var handleRequest = createFallbackHandler(
4315
4390
  routes,
@@ -4399,6 +4474,17 @@ function dispatchMessage(ws, manager, data) {
4399
4474
  handlers[data.type]?.(ws, manager, data);
4400
4475
  }
4401
4476
 
4477
+ // src/commands/sessions/web/wsBroadcast.ts
4478
+ function wsSend(ws, msg) {
4479
+ if (ws.readyState === ws.OPEN) ws.send(JSON.stringify(msg));
4480
+ }
4481
+ function wsBroadcast(clients, msg) {
4482
+ const json = JSON.stringify(msg);
4483
+ for (const ws of clients) {
4484
+ if (ws.readyState === ws.OPEN) ws.send(json);
4485
+ }
4486
+ }
4487
+
4402
4488
  // src/commands/sessions/web/handleSocket.ts
4403
4489
  function handleSocket(ws, manager) {
4404
4490
  manager.addClient(ws);
@@ -4409,7 +4495,14 @@ function handleSocket(ws, manager) {
4409
4495
  } catch {
4410
4496
  return;
4411
4497
  }
4412
- dispatchMessage(ws, manager, data);
4498
+ try {
4499
+ dispatchMessage(ws, manager, data);
4500
+ } catch (e) {
4501
+ wsSend(ws, {
4502
+ type: "error",
4503
+ message: `${data.type} failed: ${e instanceof Error ? e.message : String(e)}`
4504
+ });
4505
+ }
4413
4506
  });
4414
4507
  ws.on("close", () => {
4415
4508
  manager.removeClient(ws);
@@ -4446,7 +4539,31 @@ function repoPrefix(cwd) {
4446
4539
 
4447
4540
  // src/commands/sessions/web/spawnPty.ts
4448
4541
  import * as pty from "node-pty";
4542
+
4543
+ // src/commands/sessions/web/ensureSpawnHelperExecutable.ts
4544
+ import { chmodSync, existsSync as existsSync21, statSync } from "fs";
4545
+ import { createRequire as createRequire3 } from "module";
4546
+ import path19 from "path";
4547
+ var require4 = createRequire3(import.meta.url);
4548
+ var ensured = false;
4549
+ function ensureSpawnHelperExecutable() {
4550
+ if (ensured || process.platform !== "darwin") return;
4551
+ ensured = true;
4552
+ const ptyRoot = path19.join(path19.dirname(require4.resolve("node-pty")), "..");
4553
+ const helper = path19.join(
4554
+ ptyRoot,
4555
+ "prebuilds",
4556
+ `${process.platform}-${process.arch}`,
4557
+ "spawn-helper"
4558
+ );
4559
+ if (!existsSync21(helper)) return;
4560
+ const mode = statSync(helper).mode;
4561
+ if ((mode & 73) === 0) chmodSync(helper, mode | 493);
4562
+ }
4563
+
4564
+ // src/commands/sessions/web/spawnPty.ts
4449
4565
  function spawnPty(args, cwd) {
4566
+ ensureSpawnHelperExecutable();
4450
4567
  const shell = process.platform === "win32" ? "cmd.exe" : process.env.SHELL ?? "bash";
4451
4568
  const shellArgs = process.platform === "win32" ? ["/c", ...args] : ["-c", `exec ${args.map(shellEscape).join(" ")}`];
4452
4569
  return pty.spawn(shell, shellArgs, {
@@ -4539,11 +4656,11 @@ function resumeSession(id, sessionId, cwd, name) {
4539
4656
  // src/commands/sessions/web/discoverSessions.ts
4540
4657
  import * as fs12 from "fs";
4541
4658
  import * as os from "os";
4542
- import * as path20 from "path";
4659
+ import * as path21 from "path";
4543
4660
 
4544
4661
  // src/commands/sessions/web/parseSessionFile.ts
4545
4662
  import * as fs11 from "fs";
4546
- import * as path19 from "path";
4663
+ import * as path20 from "path";
4547
4664
 
4548
4665
  // src/commands/sessions/web/extractSessionMeta.ts
4549
4666
  function extractSessionMeta(lines) {
@@ -4589,7 +4706,7 @@ async function parseSessionFile(filePath) {
4589
4706
  const meta = extractSessionMeta(lines);
4590
4707
  if (!meta.sessionId) return null;
4591
4708
  const timestamp = meta.timestamp || (await fs11.promises.stat(filePath)).mtime.toISOString();
4592
- const project = meta.cwd ? path19.basename(meta.cwd) : dirNameToProject(filePath);
4709
+ const project = meta.cwd ? path20.basename(meta.cwd) : dirNameToProject(filePath);
4593
4710
  return {
4594
4711
  sessionId: meta.sessionId,
4595
4712
  name: meta.name || `Session ${meta.sessionId.slice(0, 8)}`,
@@ -4604,14 +4721,14 @@ async function parseSessionFile(filePath) {
4604
4721
  }
4605
4722
  }
4606
4723
  function dirNameToProject(filePath) {
4607
- const dirName = path19.basename(path19.dirname(filePath));
4724
+ const dirName = path20.basename(path20.dirname(filePath));
4608
4725
  const parts = dirName.split("--");
4609
4726
  return parts[parts.length - 1].replace(/-/g, "/");
4610
4727
  }
4611
4728
 
4612
4729
  // src/commands/sessions/web/discoverSessions.ts
4613
4730
  async function discoverSessionJsonlPaths() {
4614
- const projectsDir = path20.join(os.homedir(), ".claude", "projects");
4731
+ const projectsDir = path21.join(os.homedir(), ".claude", "projects");
4615
4732
  let projectDirs;
4616
4733
  try {
4617
4734
  projectDirs = await fs12.promises.readdir(projectsDir);
@@ -4621,7 +4738,7 @@ async function discoverSessionJsonlPaths() {
4621
4738
  const paths = [];
4622
4739
  await Promise.all(
4623
4740
  projectDirs.map(async (dirName) => {
4624
- const dirPath = path20.join(projectsDir, dirName);
4741
+ const dirPath = path21.join(projectsDir, dirName);
4625
4742
  let entries;
4626
4743
  try {
4627
4744
  entries = await fs12.promises.readdir(dirPath);
@@ -4630,7 +4747,7 @@ async function discoverSessionJsonlPaths() {
4630
4747
  }
4631
4748
  const jsonlFiles = entries.filter((e) => e.endsWith(".jsonl"));
4632
4749
  for (const file of jsonlFiles) {
4633
- paths.push(path20.join(dirPath, file));
4750
+ paths.push(path21.join(dirPath, file));
4634
4751
  }
4635
4752
  })
4636
4753
  );
@@ -4651,17 +4768,6 @@ async function discoverSessions() {
4651
4768
  return sessions;
4652
4769
  }
4653
4770
 
4654
- // src/commands/sessions/web/wsBroadcast.ts
4655
- function wsSend(ws, msg) {
4656
- if (ws.readyState === ws.OPEN) ws.send(JSON.stringify(msg));
4657
- }
4658
- function wsBroadcast(clients, msg) {
4659
- const json = JSON.stringify(msg);
4660
- for (const ws of clients) {
4661
- if (ws.readyState === ws.OPEN) ws.send(json);
4662
- }
4663
- }
4664
-
4665
4771
  // src/commands/sessions/web/replayScrollback.ts
4666
4772
  function replayScrollback(sessions, ws) {
4667
4773
  for (const s of sessions.values()) {
@@ -4869,37 +4975,37 @@ async function web2(options2) {
4869
4975
  }
4870
4976
 
4871
4977
  // src/commands/backlog/refine.ts
4872
- import chalk46 from "chalk";
4978
+ import chalk47 from "chalk";
4873
4979
  import enquirer6 from "enquirer";
4874
4980
 
4875
4981
  // src/commands/backlog/launchMode.ts
4876
- import chalk45 from "chalk";
4982
+ import chalk46 from "chalk";
4877
4983
 
4878
4984
  // src/commands/backlog/tryRunById.ts
4879
- import chalk44 from "chalk";
4985
+ import chalk45 from "chalk";
4880
4986
  async function tryRunById(id, options2) {
4881
4987
  const items2 = await loadBacklog();
4882
4988
  const numericId = Number.parseInt(id, 10);
4883
4989
  const item = Number.isNaN(numericId) ? void 0 : items2.find((i) => i.id === numericId);
4884
4990
  if (!item) {
4885
- console.log(chalk44.red(`Item #${id} not found.`));
4991
+ console.log(chalk45.red(`Item #${id} not found.`));
4886
4992
  return false;
4887
4993
  }
4888
4994
  if (item.status === "done") {
4889
- console.log(chalk44.red(`Item #${id} is already done.`));
4995
+ console.log(chalk45.red(`Item #${id} is already done.`));
4890
4996
  return false;
4891
4997
  }
4892
4998
  if (item.status === "wontdo") {
4893
- console.log(chalk44.red(`Item #${id} is marked won't do.`));
4999
+ console.log(chalk45.red(`Item #${id} is marked won't do.`));
4894
5000
  return false;
4895
5001
  }
4896
5002
  if (isBlocked(item, items2)) {
4897
5003
  console.log(
4898
- chalk44.red(`Item #${id} is blocked by unresolved dependencies.`)
5004
+ chalk45.red(`Item #${id} is blocked by unresolved dependencies.`)
4899
5005
  );
4900
5006
  return false;
4901
5007
  }
4902
- console.log(chalk44.bold(`
5008
+ console.log(chalk45.bold(`
4903
5009
  Running backlog item #${id}...
4904
5010
  `));
4905
5011
  await run2(id, options2);
@@ -4920,7 +5026,7 @@ async function launchMode(slashCommand) {
4920
5026
  if (typeof signal.id === "string" && signal.id) {
4921
5027
  if (await tryRunById(signal.id, { allowEdits: true })) return;
4922
5028
  }
4923
- console.log(chalk45.bold("\nChaining into assist next...\n"));
5029
+ console.log(chalk46.bold("\nChaining into assist next...\n"));
4924
5030
  await next({ allowEdits: true });
4925
5031
  }
4926
5032
  }
@@ -4932,12 +5038,12 @@ async function pickItemForRefine() {
4932
5038
  (i) => i.status === "todo" || i.status === "in-progress"
4933
5039
  );
4934
5040
  if (active.length === 0) {
4935
- console.log(chalk46.yellow("No active backlog items to refine."));
5041
+ console.log(chalk47.yellow("No active backlog items to refine."));
4936
5042
  return void 0;
4937
5043
  }
4938
5044
  if (active.length === 1) {
4939
5045
  const item = active[0];
4940
- console.log(chalk46.bold(`Auto-selecting item #${item.id}: ${item.name}`));
5046
+ console.log(chalk47.bold(`Auto-selecting item #${item.id}: ${item.name}`));
4941
5047
  return String(item.id);
4942
5048
  }
4943
5049
  const { selected } = await exitOnCancel(
@@ -4959,26 +5065,26 @@ async function refine(id) {
4959
5065
  }
4960
5066
 
4961
5067
  // src/commands/backlog/comment/index.ts
4962
- import chalk47 from "chalk";
5068
+ import chalk48 from "chalk";
4963
5069
  async function comment(id, text2) {
4964
5070
  const found = await findOneItem(id);
4965
5071
  if (!found) process.exit(1);
4966
5072
  await appendComment(found.orm, found.item.id, text2);
4967
- console.log(chalk47.green(`Comment added to item #${id}.`));
5073
+ console.log(chalk48.green(`Comment added to item #${id}.`));
4968
5074
  }
4969
5075
 
4970
5076
  // src/commands/backlog/comments/index.ts
4971
- import chalk48 from "chalk";
5077
+ import chalk49 from "chalk";
4972
5078
  async function comments2(id) {
4973
5079
  const found = await findOneItem(id);
4974
5080
  if (!found) process.exit(1);
4975
5081
  const { item } = found;
4976
5082
  const entries = item.comments ?? [];
4977
5083
  if (entries.length === 0) {
4978
- console.log(chalk48.dim(`No comments on item #${id}.`));
5084
+ console.log(chalk49.dim(`No comments on item #${id}.`));
4979
5085
  return;
4980
5086
  }
4981
- console.log(chalk48.bold(`Comments for #${id}: ${item.name}
5087
+ console.log(chalk49.bold(`Comments for #${id}: ${item.name}
4982
5088
  `));
4983
5089
  for (const entry of entries) {
4984
5090
  console.log(`${formatComment(entry)}
@@ -4987,19 +5093,7 @@ async function comments2(id) {
4987
5093
  }
4988
5094
 
4989
5095
  // src/commands/backlog/delete-comment/index.ts
4990
- import chalk49 from "chalk";
4991
-
4992
- // src/commands/backlog/deleteComment.ts
4993
- import { and as and2, eq as eq12 } from "drizzle-orm";
4994
- async function deleteComment(orm, itemId, commentId) {
4995
- const [row] = await orm.select({ type: comments.type }).from(comments).where(and2(eq12(comments.id, commentId), eq12(comments.itemId, itemId)));
4996
- if (!row) return "not-found";
4997
- if (row.type === "summary") return "is-summary";
4998
- await orm.delete(comments).where(and2(eq12(comments.id, commentId), eq12(comments.itemId, itemId)));
4999
- return "deleted";
5000
- }
5001
-
5002
- // src/commands/backlog/delete-comment/index.ts
5096
+ import chalk50 from "chalk";
5003
5097
  async function deleteCommentCmd(id, commentId) {
5004
5098
  const found = await findOneItem(id);
5005
5099
  if (!found) process.exit(1);
@@ -5011,16 +5105,16 @@ async function deleteCommentCmd(id, commentId) {
5011
5105
  switch (outcome) {
5012
5106
  case "deleted":
5013
5107
  console.log(
5014
- chalk49.green(`Comment #${commentId} deleted from item #${id}.`)
5108
+ chalk50.green(`Comment #${commentId} deleted from item #${id}.`)
5015
5109
  );
5016
5110
  break;
5017
5111
  case "not-found":
5018
- console.log(chalk49.red(`Comment #${commentId} not found on item #${id}.`));
5112
+ console.log(chalk50.red(`Comment #${commentId} not found on item #${id}.`));
5019
5113
  process.exit(1);
5020
5114
  break;
5021
5115
  case "is-summary":
5022
5116
  console.log(
5023
- chalk49.red(
5117
+ chalk50.red(
5024
5118
  `Comment #${commentId} is a phase summary and cannot be deleted.`
5025
5119
  )
5026
5120
  );
@@ -5038,7 +5132,7 @@ function registerCommentCommands(cmd) {
5038
5132
 
5039
5133
  // src/commands/backlog/export/index.ts
5040
5134
  import { writeFile } from "fs/promises";
5041
- import chalk50 from "chalk";
5135
+ import chalk51 from "chalk";
5042
5136
 
5043
5137
  // src/commands/backlog/dump/DumpTable.ts
5044
5138
  var DUMP_FORMAT = "assist-backlog-dump";
@@ -5105,7 +5199,7 @@ async function exportBacklog(file) {
5105
5199
  if (file) {
5106
5200
  await writeFile(file, dump);
5107
5201
  console.error(
5108
- chalk50.green(`Exported backlog to ${file} (${dump.length} bytes).`)
5202
+ chalk51.green(`Exported backlog to ${file} (${dump.length} bytes).`)
5109
5203
  );
5110
5204
  return;
5111
5205
  }
@@ -5121,7 +5215,7 @@ function registerExportCommand(cmd) {
5121
5215
 
5122
5216
  // src/commands/backlog/import/index.ts
5123
5217
  import { readFile } from "fs/promises";
5124
- import chalk52 from "chalk";
5218
+ import chalk53 from "chalk";
5125
5219
 
5126
5220
  // src/commands/backlog/dump/countCopyRows.ts
5127
5221
  function countCopyRows(data) {
@@ -5198,7 +5292,7 @@ function validateDump({ header, sections }) {
5198
5292
  }
5199
5293
 
5200
5294
  // src/commands/backlog/import/confirmReplace.ts
5201
- import chalk51 from "chalk";
5295
+ import chalk52 from "chalk";
5202
5296
  async function countRows(client, table) {
5203
5297
  const { rows } = await client.query(
5204
5298
  `SELECT count(*)::int AS n FROM ${table}`
@@ -5209,7 +5303,7 @@ function printSummary(current, incoming) {
5209
5303
  const lines = DUMP_TABLES.map(
5210
5304
  (t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
5211
5305
  );
5212
- console.error(chalk51.bold("\nThis will REPLACE all backlog data:"));
5306
+ console.error(chalk52.bold("\nThis will REPLACE all backlog data:"));
5213
5307
  console.error(`${lines.join("\n")}
5214
5308
  `);
5215
5309
  }
@@ -5285,13 +5379,13 @@ async function importBacklog(file, options2 = {}) {
5285
5379
  );
5286
5380
  await withBacklogClient(async (client) => {
5287
5381
  if (!options2.yes && !await confirmReplace(client, incoming, !file)) {
5288
- console.error(chalk52.yellow("Import cancelled; no changes made."));
5382
+ console.error(chalk53.yellow("Import cancelled; no changes made."));
5289
5383
  return;
5290
5384
  }
5291
5385
  await restore(client, parsed);
5292
5386
  const total = incoming.reduce((sum, n) => sum + n, 0);
5293
5387
  console.error(
5294
- chalk52.green(
5388
+ chalk53.green(
5295
5389
  `Imported backlog: ${total} rows restored across ${DUMP_TABLES.length} tables.`
5296
5390
  )
5297
5391
  );
@@ -5308,7 +5402,7 @@ function registerImportCommand(cmd) {
5308
5402
  }
5309
5403
 
5310
5404
  // src/commands/backlog/add/index.ts
5311
- import chalk53 from "chalk";
5405
+ import chalk54 from "chalk";
5312
5406
 
5313
5407
  // src/commands/backlog/add/shared.ts
5314
5408
  import { spawnSync } from "child_process";
@@ -5398,11 +5492,11 @@ async function add(options2) {
5398
5492
  },
5399
5493
  getOrigin()
5400
5494
  );
5401
- console.log(chalk53.green(`Added item #${id}: ${name}`));
5495
+ console.log(chalk54.green(`Added item #${id}: ${name}`));
5402
5496
  }
5403
5497
 
5404
5498
  // src/commands/backlog/addPhase.ts
5405
- import chalk55 from "chalk";
5499
+ import chalk56 from "chalk";
5406
5500
 
5407
5501
  // src/commands/backlog/insertPhaseAt.ts
5408
5502
  import { count, eq as eq14 } from "drizzle-orm";
@@ -5435,7 +5529,7 @@ async function insertPhaseAt(orm, itemId, phaseIdx, name, tasks, manualChecks, c
5435
5529
  }
5436
5530
 
5437
5531
  // src/commands/backlog/resolveInsertPosition.ts
5438
- import chalk54 from "chalk";
5532
+ import chalk55 from "chalk";
5439
5533
  import { count as count2, eq as eq15 } from "drizzle-orm";
5440
5534
  async function resolveInsertPosition(orm, itemId, position) {
5441
5535
  const [row] = await orm.select({ cnt: count2() }).from(planPhases).where(eq15(planPhases.itemId, itemId));
@@ -5444,7 +5538,7 @@ async function resolveInsertPosition(orm, itemId, position) {
5444
5538
  const pos = Number.parseInt(position, 10);
5445
5539
  if (pos < 1 || pos > phaseCount + 1) {
5446
5540
  console.log(
5447
- chalk54.red(
5541
+ chalk55.red(
5448
5542
  `Position ${pos} is out of range. Must be between 1 and ${phaseCount + 1}.`
5449
5543
  )
5450
5544
  );
@@ -5465,7 +5559,7 @@ async function addPhase(id, name, options2) {
5465
5559
  if (!found) return;
5466
5560
  const tasks = options2.task ?? [];
5467
5561
  if (tasks.length === 0) {
5468
- console.log(chalk55.red("At least one --task is required."));
5562
+ console.log(chalk56.red("At least one --task is required."));
5469
5563
  process.exitCode = 1;
5470
5564
  return;
5471
5565
  }
@@ -5483,20 +5577,9 @@ async function addPhase(id, name, options2) {
5483
5577
  found.item.currentPhase
5484
5578
  );
5485
5579
  const verb = options2.position !== void 0 ? "Inserted" : "Added";
5486
- console.log(
5487
- chalk55.green(
5488
- `${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
5489
- )
5490
- );
5491
- }
5492
-
5493
- // src/commands/backlog/init/index.ts
5494
- import chalk56 from "chalk";
5495
- async function init6() {
5496
- await getBacklogOrm();
5497
5580
  console.log(
5498
5581
  chalk56.green(
5499
- `Backlog database ready. This repository maps to origin: ${getOrigin()}`
5582
+ `${verb} phase ${phaseIdx + 1} "${name}" to item #${itemId} with ${tasks.length} task(s).`
5500
5583
  )
5501
5584
  );
5502
5585
  }
@@ -5507,8 +5590,8 @@ import chalk57 from "chalk";
5507
5590
  // src/commands/backlog/originDisplayName.ts
5508
5591
  function originDisplayName(origin) {
5509
5592
  if (origin.startsWith("local:")) {
5510
- const path52 = origin.slice("local:".length).replace(/\/+$/, "");
5511
- const segments = path52.split("/").filter(Boolean);
5593
+ const path53 = origin.slice("local:".length).replace(/\/+$/, "");
5594
+ const segments = path53.split("/").filter(Boolean);
5512
5595
  return segments[segments.length - 1] ?? origin;
5513
5596
  }
5514
5597
  const firstSlash = origin.indexOf("/");
@@ -6616,7 +6699,7 @@ function extractGraphqlQuery(args) {
6616
6699
  }
6617
6700
 
6618
6701
  // src/shared/loadCliReads.ts
6619
- import { existsSync as existsSync21, readFileSync as readFileSync15, writeFileSync as writeFileSync14 } from "fs";
6702
+ import { existsSync as existsSync22, readFileSync as readFileSync15, writeFileSync as writeFileSync14 } from "fs";
6620
6703
  import { dirname as dirname17, resolve as resolve7 } from "path";
6621
6704
  import { fileURLToPath as fileURLToPath5 } from "url";
6622
6705
  var __filename3 = fileURLToPath5(import.meta.url);
@@ -6624,9 +6707,9 @@ var __dirname5 = dirname17(__filename3);
6624
6707
  function packageRoot() {
6625
6708
  return __dirname5;
6626
6709
  }
6627
- function readLines(path52) {
6628
- if (!existsSync21(path52)) return [];
6629
- return readFileSync15(path52, "utf-8").split("\n").filter((line) => line.trim() !== "");
6710
+ function readLines(path53) {
6711
+ if (!existsSync22(path53)) return [];
6712
+ return readFileSync15(path53, "utf-8").split("\n").filter((line) => line.trim() !== "");
6630
6713
  }
6631
6714
  var cachedReads;
6632
6715
  var cachedWrites;
@@ -6672,7 +6755,7 @@ function findCliWrite(command) {
6672
6755
  }
6673
6756
 
6674
6757
  // src/shared/readSettingsPerms.ts
6675
- import { existsSync as existsSync22, readFileSync as readFileSync16 } from "fs";
6758
+ import { existsSync as existsSync23, readFileSync as readFileSync16 } from "fs";
6676
6759
  import { homedir as homedir5 } from "os";
6677
6760
  import { join as join19 } from "path";
6678
6761
  function readSettingsPerms(key) {
@@ -6688,7 +6771,7 @@ function readSettingsPerms(key) {
6688
6771
  return entries;
6689
6772
  }
6690
6773
  function readPermissionArray(filePath, key) {
6691
- if (!existsSync22(filePath)) return [];
6774
+ if (!existsSync23(filePath)) return [];
6692
6775
  try {
6693
6776
  const data = JSON.parse(readFileSync16(filePath, "utf-8"));
6694
6777
  const arr = data?.permissions?.[key];
@@ -6970,7 +7053,7 @@ ${reasons.join("\n")}`);
6970
7053
  }
6971
7054
 
6972
7055
  // src/commands/permitCliReads/index.ts
6973
- import { existsSync as existsSync23, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync15 } from "fs";
7056
+ import { existsSync as existsSync24, mkdirSync as mkdirSync5, readFileSync as readFileSync17, writeFileSync as writeFileSync15 } from "fs";
6974
7057
  import { homedir as homedir6 } from "os";
6975
7058
  import { join as join20 } from "path";
6976
7059
 
@@ -7109,14 +7192,14 @@ function showProgress(p, label2) {
7109
7192
  const pct = Math.round(p.done / p.total * 100);
7110
7193
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
7111
7194
  }
7112
- async function resolveCommand(cli, path52, description, depth, p) {
7113
- showProgress(p, path52.join(" "));
7114
- const subHelp = await runHelp([cli, ...path52]);
7195
+ async function resolveCommand(cli, path53, description, depth, p) {
7196
+ showProgress(p, path53.join(" "));
7197
+ const subHelp = await runHelp([cli, ...path53]);
7115
7198
  if (!subHelp || !hasSubcommands(subHelp)) {
7116
- return [{ path: path52, description }];
7199
+ return [{ path: path53, description }];
7117
7200
  }
7118
- const children = await discoverAt(cli, path52, depth + 1, p);
7119
- return children.length > 0 ? children : [{ path: path52, description }];
7201
+ const children = await discoverAt(cli, path53, depth + 1, p);
7202
+ return children.length > 0 ? children : [{ path: path53, description }];
7120
7203
  }
7121
7204
  async function discoverAt(cli, parentPath, depth, p) {
7122
7205
  if (depth > SAFETY_DEPTH) return [];
@@ -7264,9 +7347,9 @@ function logPath(cli) {
7264
7347
  return join20(homedir6(), ".assist", `cli-discover-${safeName}.log`);
7265
7348
  }
7266
7349
  function readCache(cli) {
7267
- const path52 = logPath(cli);
7268
- if (!existsSync23(path52)) return void 0;
7269
- return readFileSync17(path52, "utf-8");
7350
+ const path53 = logPath(cli);
7351
+ if (!existsSync24(path53)) return void 0;
7352
+ return readFileSync17(path53, "utf-8");
7270
7353
  }
7271
7354
  function writeCache(cli, output) {
7272
7355
  const dir = join20(homedir6(), ".assist");
@@ -7405,13 +7488,13 @@ import chalk80 from "chalk";
7405
7488
 
7406
7489
  // src/commands/complexity/shared/index.ts
7407
7490
  import fs14 from "fs";
7408
- import path22 from "path";
7491
+ import path23 from "path";
7409
7492
  import chalk79 from "chalk";
7410
7493
  import ts5 from "typescript";
7411
7494
 
7412
7495
  // src/commands/complexity/findSourceFiles.ts
7413
7496
  import fs13 from "fs";
7414
- import path21 from "path";
7497
+ import path22 from "path";
7415
7498
  import { minimatch as minimatch3 } from "minimatch";
7416
7499
  function applyIgnoreGlobs(files) {
7417
7500
  const { complexity } = loadConfig();
@@ -7426,7 +7509,7 @@ function walk(dir, results) {
7426
7509
  const extensions = [".ts", ".tsx"];
7427
7510
  const entries = fs13.readdirSync(dir, { withFileTypes: true });
7428
7511
  for (const entry of entries) {
7429
- const fullPath = path21.join(dir, entry.name);
7512
+ const fullPath = path22.join(dir, entry.name);
7430
7513
  if (entry.isDirectory()) {
7431
7514
  if (entry.name !== "node_modules" && entry.name !== ".git") {
7432
7515
  walk(fullPath, results);
@@ -7642,7 +7725,7 @@ function countSloc(content) {
7642
7725
  function createSourceFromFile(filePath) {
7643
7726
  const content = fs14.readFileSync(filePath, "utf-8");
7644
7727
  return ts5.createSourceFile(
7645
- path22.basename(filePath),
7728
+ path23.basename(filePath),
7646
7729
  content,
7647
7730
  ts5.ScriptTarget.Latest,
7648
7731
  true,
@@ -7931,8 +8014,8 @@ function stepIntoNested(container, key, nextKey) {
7931
8014
  }
7932
8015
  return ensureObject(container, resolved);
7933
8016
  }
7934
- function setNestedValue(obj, path52, value) {
7935
- const keys = path52.split(".");
8017
+ function setNestedValue(obj, path53, value) {
8018
+ const keys = path53.split(".");
7936
8019
  const result = { ...obj };
7937
8020
  let current = result;
7938
8021
  for (let i = 0; i < keys.length - 1; i++) {
@@ -8012,9 +8095,9 @@ function isTraversable(value) {
8012
8095
  function stepInto(current, key) {
8013
8096
  return isTraversable(current) ? current[key] : void 0;
8014
8097
  }
8015
- function getNestedValue(obj, path52) {
8098
+ function getNestedValue(obj, path53) {
8016
8099
  let current = obj;
8017
- for (const key of path52.split(".")) current = stepInto(current, key);
8100
+ for (const key of path53.split(".")) current = stepInto(current, key);
8018
8101
  return current;
8019
8102
  }
8020
8103
 
@@ -8048,7 +8131,7 @@ function registerConfig(program2) {
8048
8131
  }
8049
8132
 
8050
8133
  // src/commands/deploy/redirect.ts
8051
- import { existsSync as existsSync24, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
8134
+ import { existsSync as existsSync25, readFileSync as readFileSync18, writeFileSync as writeFileSync16 } from "fs";
8052
8135
  import chalk87 from "chalk";
8053
8136
  var TRAILING_SLASH_SCRIPT = ` <script>
8054
8137
  if (!window.location.pathname.endsWith('/')) {
@@ -8057,7 +8140,7 @@ var TRAILING_SLASH_SCRIPT = ` <script>
8057
8140
  </script>`;
8058
8141
  function redirect() {
8059
8142
  const indexPath = "index.html";
8060
- if (!existsSync24(indexPath)) {
8143
+ if (!existsSync25(indexPath)) {
8061
8144
  console.log(chalk87.yellow("No index.html found"));
8062
8145
  return;
8063
8146
  }
@@ -8103,7 +8186,7 @@ import { execSync as execSync20 } from "child_process";
8103
8186
  import chalk88 from "chalk";
8104
8187
 
8105
8188
  // src/shared/getRepoName.ts
8106
- import { existsSync as existsSync25, readFileSync as readFileSync19 } from "fs";
8189
+ import { existsSync as existsSync26, readFileSync as readFileSync19 } from "fs";
8107
8190
  import { basename as basename5, join as join22 } from "path";
8108
8191
  function getRepoName() {
8109
8192
  const config = loadConfig();
@@ -8111,7 +8194,7 @@ function getRepoName() {
8111
8194
  return config.devlog.name;
8112
8195
  }
8113
8196
  const packageJsonPath = join22(process.cwd(), "package.json");
8114
- if (existsSync25(packageJsonPath)) {
8197
+ if (existsSync26(packageJsonPath)) {
8115
8198
  try {
8116
8199
  const content = readFileSync19(packageJsonPath, "utf-8");
8117
8200
  const pkg = JSON.parse(content);
@@ -8612,15 +8695,15 @@ import { join as join25 } from "path";
8612
8695
  import chalk95 from "chalk";
8613
8696
 
8614
8697
  // src/shared/findRepoRoot.ts
8615
- import { existsSync as existsSync26 } from "fs";
8616
- import path23 from "path";
8698
+ import { existsSync as existsSync27 } from "fs";
8699
+ import path24 from "path";
8617
8700
  function findRepoRoot(dir) {
8618
8701
  let current = dir;
8619
- while (current !== path23.dirname(current)) {
8620
- if (existsSync26(path23.join(current, ".git"))) {
8702
+ while (current !== path24.dirname(current)) {
8703
+ if (existsSync27(path24.join(current, ".git"))) {
8621
8704
  return current;
8622
8705
  }
8623
- current = path23.dirname(current);
8706
+ current = path24.dirname(current);
8624
8707
  }
8625
8708
  return null;
8626
8709
  }
@@ -8684,7 +8767,7 @@ async function checkBuildLocksCommand() {
8684
8767
 
8685
8768
  // src/commands/dotnet/buildTree.ts
8686
8769
  import { readFileSync as readFileSync21 } from "fs";
8687
- import path24 from "path";
8770
+ import path25 from "path";
8688
8771
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
8689
8772
  function getProjectRefs(csprojPath) {
8690
8773
  const content = readFileSync21(csprojPath, "utf-8");
@@ -8695,14 +8778,14 @@ function getProjectRefs(csprojPath) {
8695
8778
  return refs;
8696
8779
  }
8697
8780
  function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
8698
- const abs = path24.resolve(csprojPath);
8699
- const rel = path24.relative(repoRoot, abs);
8781
+ const abs = path25.resolve(csprojPath);
8782
+ const rel = path25.relative(repoRoot, abs);
8700
8783
  const node = { path: abs, relativePath: rel, children: [] };
8701
8784
  if (visited.has(abs)) return node;
8702
8785
  visited.add(abs);
8703
- const dir = path24.dirname(abs);
8786
+ const dir = path25.dirname(abs);
8704
8787
  for (const ref of getProjectRefs(abs)) {
8705
- const childAbs = path24.resolve(dir, ref);
8788
+ const childAbs = path25.resolve(dir, ref);
8706
8789
  try {
8707
8790
  readFileSync21(childAbs);
8708
8791
  node.children.push(buildTree(childAbs, repoRoot, visited));
@@ -8729,8 +8812,8 @@ function collectAllDeps(node) {
8729
8812
  }
8730
8813
 
8731
8814
  // src/commands/dotnet/findContainingSolutions.ts
8732
- import { readdirSync as readdirSync3, readFileSync as readFileSync22, statSync } from "fs";
8733
- import path25 from "path";
8815
+ import { readdirSync as readdirSync3, readFileSync as readFileSync22, statSync as statSync2 } from "fs";
8816
+ import path26 from "path";
8734
8817
  function findSlnFiles(dir, maxDepth, depth = 0) {
8735
8818
  if (depth > maxDepth) return [];
8736
8819
  const results = [];
@@ -8743,9 +8826,9 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
8743
8826
  for (const entry of entries) {
8744
8827
  if (entry.startsWith(".") || entry === "node_modules" || entry === "packages")
8745
8828
  continue;
8746
- const full = path25.join(dir, entry);
8829
+ const full = path26.join(dir, entry);
8747
8830
  try {
8748
- const stat = statSync(full);
8831
+ const stat = statSync2(full);
8749
8832
  if (stat.isFile() && entry.endsWith(".sln")) {
8750
8833
  results.push(full);
8751
8834
  } else if (stat.isDirectory()) {
@@ -8757,8 +8840,8 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
8757
8840
  return results;
8758
8841
  }
8759
8842
  function findContainingSolutions(csprojPath, repoRoot) {
8760
- const csprojAbs = path25.resolve(csprojPath);
8761
- const csprojBasename = path25.basename(csprojAbs);
8843
+ const csprojAbs = path26.resolve(csprojPath);
8844
+ const csprojBasename = path26.basename(csprojAbs);
8762
8845
  const slnFiles = findSlnFiles(repoRoot, 3);
8763
8846
  const matches = [];
8764
8847
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
@@ -8766,7 +8849,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
8766
8849
  try {
8767
8850
  const content = readFileSync22(sln, "utf-8");
8768
8851
  if (pattern2.test(content)) {
8769
- matches.push(path25.relative(repoRoot, sln));
8852
+ matches.push(path26.relative(repoRoot, sln));
8770
8853
  }
8771
8854
  } catch {
8772
8855
  }
@@ -8828,16 +8911,16 @@ function printJson(tree, totalCount, solutions) {
8828
8911
  }
8829
8912
 
8830
8913
  // src/commands/dotnet/resolveCsproj.ts
8831
- import { existsSync as existsSync27 } from "fs";
8832
- import path26 from "path";
8914
+ import { existsSync as existsSync28 } from "fs";
8915
+ import path27 from "path";
8833
8916
  import chalk97 from "chalk";
8834
8917
  function resolveCsproj(csprojPath) {
8835
- const resolved = path26.resolve(csprojPath);
8836
- if (!existsSync27(resolved)) {
8918
+ const resolved = path27.resolve(csprojPath);
8919
+ if (!existsSync28(resolved)) {
8837
8920
  console.error(chalk97.red(`File not found: ${resolved}`));
8838
8921
  process.exit(1);
8839
8922
  }
8840
- const repoRoot = findRepoRoot(path26.dirname(resolved));
8923
+ const repoRoot = findRepoRoot(path27.dirname(resolved));
8841
8924
  if (!repoRoot) {
8842
8925
  console.error(chalk97.red("Could not find git repository root"));
8843
8926
  process.exit(1);
@@ -9001,8 +9084,8 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
9001
9084
  }
9002
9085
 
9003
9086
  // src/commands/dotnet/resolveSolution.ts
9004
- import { existsSync as existsSync28 } from "fs";
9005
- import path27 from "path";
9087
+ import { existsSync as existsSync29 } from "fs";
9088
+ import path28 from "path";
9006
9089
  import chalk101 from "chalk";
9007
9090
 
9008
9091
  // src/commands/dotnet/findSolution.ts
@@ -9041,8 +9124,8 @@ function findSolution() {
9041
9124
  // src/commands/dotnet/resolveSolution.ts
9042
9125
  function resolveSolution(sln) {
9043
9126
  if (sln) {
9044
- const resolved = path27.resolve(sln);
9045
- if (!existsSync28(resolved)) {
9127
+ const resolved = path28.resolve(sln);
9128
+ if (!existsSync29(resolved)) {
9046
9129
  console.error(chalk101.red(`Solution file not found: ${resolved}`));
9047
9130
  process.exit(1);
9048
9131
  }
@@ -9082,9 +9165,9 @@ function parseInspectReport(json) {
9082
9165
 
9083
9166
  // src/commands/dotnet/runInspectCode.ts
9084
9167
  import { execSync as execSync24 } from "child_process";
9085
- import { existsSync as existsSync29, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
9168
+ import { existsSync as existsSync30, readFileSync as readFileSync23, unlinkSync as unlinkSync5 } from "fs";
9086
9169
  import { tmpdir as tmpdir3 } from "os";
9087
- import path28 from "path";
9170
+ import path29 from "path";
9088
9171
  import chalk102 from "chalk";
9089
9172
  function assertJbInstalled() {
9090
9173
  try {
@@ -9098,7 +9181,7 @@ function assertJbInstalled() {
9098
9181
  }
9099
9182
  }
9100
9183
  function runInspectCode(slnPath, include, swea) {
9101
- const reportPath = path28.join(tmpdir3(), `inspect-${Date.now()}.xml`);
9184
+ const reportPath = path29.join(tmpdir3(), `inspect-${Date.now()}.xml`);
9102
9185
  const includeFlag = include ? ` --include="${include}"` : "";
9103
9186
  const sweaFlag = swea ? " --swea" : "";
9104
9187
  try {
@@ -9113,7 +9196,7 @@ function runInspectCode(slnPath, include, swea) {
9113
9196
  console.error(chalk102.red("jb inspectcode failed"));
9114
9197
  process.exit(1);
9115
9198
  }
9116
- if (!existsSync29(reportPath)) {
9199
+ if (!existsSync30(reportPath)) {
9117
9200
  console.error(chalk102.red("Report file not generated"));
9118
9201
  process.exit(1);
9119
9202
  }
@@ -9434,7 +9517,7 @@ function registerGithub(program2) {
9434
9517
  }
9435
9518
 
9436
9519
  // src/commands/handover/archive.ts
9437
- import { existsSync as existsSync30, mkdirSync as mkdirSync6, renameSync as renameSync2 } from "fs";
9520
+ import { existsSync as existsSync31, mkdirSync as mkdirSync6, renameSync as renameSync2 } from "fs";
9438
9521
  import { join as join29 } from "path";
9439
9522
 
9440
9523
  // src/commands/handover/formatArchiveTimestamp.ts
@@ -9463,14 +9546,14 @@ function buildArchiveFilename(timestamp, suffix) {
9463
9546
  }
9464
9547
  function resolveCollisionPath(archiveDir, timestamp, suffix) {
9465
9548
  const initial = join29(archiveDir, buildArchiveFilename(timestamp, suffix));
9466
- if (!existsSync30(initial)) return initial;
9549
+ if (!existsSync31(initial)) return initial;
9467
9550
  for (let i = 1; i <= MAX_COLLISION_SUFFIX; i++) {
9468
9551
  const collisionSuffix = suffix ? `${suffix}-${i}` : `${i}`;
9469
9552
  const candidate = join29(
9470
9553
  archiveDir,
9471
9554
  buildArchiveFilename(timestamp, collisionSuffix)
9472
9555
  );
9473
- if (!existsSync30(candidate)) return candidate;
9556
+ if (!existsSync31(candidate)) return candidate;
9474
9557
  }
9475
9558
  throw new Error(
9476
9559
  `Exhausted collision suffixes (1-${MAX_COLLISION_SUFFIX}) for ${timestamp}`
@@ -9479,7 +9562,7 @@ function resolveCollisionPath(archiveDir, timestamp, suffix) {
9479
9562
  function archive(options2 = {}) {
9480
9563
  const cwd = options2.cwd ?? process.cwd();
9481
9564
  const handoverPath = getHandoverPath(cwd);
9482
- if (!existsSync30(handoverPath)) return void 0;
9565
+ if (!existsSync31(handoverPath)) return void 0;
9483
9566
  const archiveDir = getHandoverArchiveDir(cwd);
9484
9567
  mkdirSync6(archiveDir, { recursive: true });
9485
9568
  const timestamp = formatArchiveTimestamp(options2.now);
@@ -9493,7 +9576,7 @@ function archive(options2 = {}) {
9493
9576
  }
9494
9577
 
9495
9578
  // src/commands/handover/load.ts
9496
- import { existsSync as existsSync31, readFileSync as readFileSync25 } from "fs";
9579
+ import { existsSync as existsSync32, readFileSync as readFileSync25 } from "fs";
9497
9580
 
9498
9581
  // src/commands/handover/parseLoadInput.ts
9499
9582
  async function parseLoadInput(stdin) {
@@ -9608,7 +9691,7 @@ function normaliseOutput(raw) {
9608
9691
  // src/commands/handover/load.ts
9609
9692
  function loadFromHandover(cwd) {
9610
9693
  const handoverPath = getHandoverPath(cwd);
9611
- if (!existsSync31(handoverPath)) return void 0;
9694
+ if (!existsSync32(handoverPath)) return void 0;
9612
9695
  const content = readFileSync25(handoverPath, "utf-8");
9613
9696
  archive({ cwd });
9614
9697
  return {
@@ -9776,7 +9859,7 @@ function acceptanceCriteria(issueKey) {
9776
9859
  import { execSync as execSync27 } from "child_process";
9777
9860
 
9778
9861
  // src/shared/loadJson.ts
9779
- import { existsSync as existsSync32, mkdirSync as mkdirSync7, readFileSync as readFileSync26, writeFileSync as writeFileSync19 } from "fs";
9862
+ import { existsSync as existsSync33, mkdirSync as mkdirSync7, readFileSync as readFileSync26, writeFileSync as writeFileSync19 } from "fs";
9780
9863
  import { homedir as homedir8 } from "os";
9781
9864
  import { join as join30 } from "path";
9782
9865
  function getStoreDir() {
@@ -9786,10 +9869,10 @@ function getStorePath(filename) {
9786
9869
  return join30(getStoreDir(), filename);
9787
9870
  }
9788
9871
  function loadJson(filename) {
9789
- const path52 = getStorePath(filename);
9790
- if (existsSync32(path52)) {
9872
+ const path53 = getStorePath(filename);
9873
+ if (existsSync33(path53)) {
9791
9874
  try {
9792
- return JSON.parse(readFileSync26(path52, "utf-8"));
9875
+ return JSON.parse(readFileSync26(path53, "utf-8"));
9793
9876
  } catch {
9794
9877
  return {};
9795
9878
  }
@@ -9798,7 +9881,7 @@ function loadJson(filename) {
9798
9881
  }
9799
9882
  function saveJson(filename, data) {
9800
9883
  const dir = getStoreDir();
9801
- if (!existsSync32(dir)) {
9884
+ if (!existsSync33(dir)) {
9802
9885
  mkdirSync7(dir, { recursive: true });
9803
9886
  }
9804
9887
  writeFileSync19(getStorePath(filename), JSON.stringify(data, null, 2));
@@ -10465,15 +10548,15 @@ function postComment(vars) {
10465
10548
  }
10466
10549
  runGhGraphql(MUTATION_MULTI, { ...base, startLine });
10467
10550
  }
10468
- function comment2(path52, line, body, startLine) {
10551
+ function comment2(path53, line, body, startLine) {
10469
10552
  validateBody(body);
10470
10553
  validateLine(line);
10471
10554
  if (startLine !== void 0) validateLine(startLine);
10472
10555
  try {
10473
10556
  const prId = getCurrentPrNodeId();
10474
- postComment({ prId, body, path: path52, line, startLine });
10557
+ postComment({ prId, body, path: path53, line, startLine });
10475
10558
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
10476
- console.log(`Added review comment on ${path52}:${range}`);
10559
+ console.log(`Added review comment on ${path53}:${range}`);
10477
10560
  } catch (error) {
10478
10561
  if (isGhNotInstalled(error)) {
10479
10562
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -10556,7 +10639,7 @@ import { tmpdir as tmpdir5 } from "os";
10556
10639
  import { join as join32 } from "path";
10557
10640
 
10558
10641
  // src/commands/prs/loadCommentsCache.ts
10559
- import { existsSync as existsSync33, readFileSync as readFileSync28, unlinkSync as unlinkSync7 } from "fs";
10642
+ import { existsSync as existsSync34, readFileSync as readFileSync28, unlinkSync as unlinkSync7 } from "fs";
10560
10643
  import { join as join31 } from "path";
10561
10644
  import { parse as parse2 } from "yaml";
10562
10645
  function getCachePath(prNumber) {
@@ -10564,7 +10647,7 @@ function getCachePath(prNumber) {
10564
10647
  }
10565
10648
  function loadCommentsCache(prNumber) {
10566
10649
  const cachePath = getCachePath(prNumber);
10567
- if (!existsSync33(cachePath)) {
10650
+ if (!existsSync34(cachePath)) {
10568
10651
  return null;
10569
10652
  }
10570
10653
  const content = readFileSync28(cachePath, "utf-8");
@@ -10572,7 +10655,7 @@ function loadCommentsCache(prNumber) {
10572
10655
  }
10573
10656
  function deleteCommentsCache(prNumber) {
10574
10657
  const cachePath = getCachePath(prNumber);
10575
- if (existsSync33(cachePath)) {
10658
+ if (existsSync34(cachePath)) {
10576
10659
  unlinkSync7(cachePath);
10577
10660
  console.log("No more unresolved line comments. Cache dropped.");
10578
10661
  }
@@ -10669,7 +10752,7 @@ function fixed(commentId, sha) {
10669
10752
  }
10670
10753
 
10671
10754
  // src/commands/prs/listComments/index.ts
10672
- import { existsSync as existsSync34, mkdirSync as mkdirSync9, writeFileSync as writeFileSync23 } from "fs";
10755
+ import { existsSync as existsSync35, mkdirSync as mkdirSync9, writeFileSync as writeFileSync23 } from "fs";
10673
10756
  import { join as join34 } from "path";
10674
10757
  import { stringify } from "yaml";
10675
10758
 
@@ -10795,7 +10878,7 @@ function printComments2(result) {
10795
10878
  // src/commands/prs/listComments/index.ts
10796
10879
  function writeCommentsCache(prNumber, comments3) {
10797
10880
  const assistDir = join34(process.cwd(), ".assist");
10798
- if (!existsSync34(assistDir)) {
10881
+ if (!existsSync35(assistDir)) {
10799
10882
  mkdirSync9(assistDir, { recursive: true });
10800
10883
  }
10801
10884
  const cacheData = {
@@ -11053,8 +11136,8 @@ function registerPrs(program2) {
11053
11136
  prsCommand.command("wontfix <comment-id> <reason>").description("Reply with reason and resolve thread").action((commentId, reason) => {
11054
11137
  wontfix(Number.parseInt(commentId, 10), reason);
11055
11138
  });
11056
- prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path52, line, body) => {
11057
- comment2(path52, Number.parseInt(line, 10), body);
11139
+ prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path53, line, body) => {
11140
+ comment2(path53, Number.parseInt(line, 10), body);
11058
11141
  });
11059
11142
  }
11060
11143
 
@@ -11306,10 +11389,10 @@ function resolveOpSecret(reference) {
11306
11389
  }
11307
11390
 
11308
11391
  // src/commands/ravendb/ravenFetch.ts
11309
- async function ravenFetch(connection, path52) {
11392
+ async function ravenFetch(connection, path53) {
11310
11393
  const apiKey = resolveOpSecret(connection.apiKeyRef);
11311
11394
  let accessToken = await getAccessToken(apiKey);
11312
- const url = `${connection.url}${path52}`;
11395
+ const url = `${connection.url}${path53}`;
11313
11396
  const headers = {
11314
11397
  Authorization: `Bearer ${accessToken}`,
11315
11398
  "Content-Type": "application/json"
@@ -11399,16 +11482,16 @@ import chalk129 from "chalk";
11399
11482
  // src/commands/ravendb/buildQueryPath.ts
11400
11483
  function buildQueryPath(opts) {
11401
11484
  const db = encodeURIComponent(opts.db);
11402
- let path52;
11485
+ let path53;
11403
11486
  if (opts.collection) {
11404
- path52 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
11487
+ path53 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
11405
11488
  } else {
11406
- path52 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
11489
+ path53 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
11407
11490
  }
11408
11491
  if (opts.query) {
11409
- path52 += `&query=${encodeURIComponent(opts.query)}`;
11492
+ path53 += `&query=${encodeURIComponent(opts.query)}`;
11410
11493
  }
11411
- return path52;
11494
+ return path53;
11412
11495
  }
11413
11496
 
11414
11497
  // src/commands/ravendb/fetchAllPages.ts
@@ -11417,7 +11500,7 @@ async function fetchAllPages(connection, opts) {
11417
11500
  let start3 = 0;
11418
11501
  while (true) {
11419
11502
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
11420
- const path52 = buildQueryPath({
11503
+ const path53 = buildQueryPath({
11421
11504
  db: connection.database,
11422
11505
  collection: opts.collection,
11423
11506
  start: start3,
@@ -11425,7 +11508,7 @@ async function fetchAllPages(connection, opts) {
11425
11508
  sort: opts.sort,
11426
11509
  query: opts.query
11427
11510
  });
11428
- const data = await ravenFetch(connection, path52);
11511
+ const data = await ravenFetch(connection, path53);
11429
11512
  const results = data.Results ?? [];
11430
11513
  const totalResults = data.TotalResults ?? 0;
11431
11514
  if (results.length === 0) break;
@@ -11482,7 +11565,7 @@ function registerRavendb(program2) {
11482
11565
 
11483
11566
  // src/commands/refactor/check/index.ts
11484
11567
  import { spawn as spawn5 } from "child_process";
11485
- import * as path29 from "path";
11568
+ import * as path30 from "path";
11486
11569
 
11487
11570
  // src/commands/refactor/logViolations.ts
11488
11571
  import chalk131 from "chalk";
@@ -11659,7 +11742,7 @@ ${failed2.length} verify script(s) failed:`);
11659
11742
  async function runVerifyQuietly() {
11660
11743
  const result = findPackageJsonWithVerifyScripts(process.cwd());
11661
11744
  if (!result) return true;
11662
- const packageDir = path29.dirname(result.packageJsonPath);
11745
+ const packageDir = path30.dirname(result.packageJsonPath);
11663
11746
  const results = await Promise.all(
11664
11747
  result.verifyScripts.map((script) => runScript(script, packageDir))
11665
11748
  );
@@ -11685,7 +11768,7 @@ async function check(pattern2, options2) {
11685
11768
  }
11686
11769
 
11687
11770
  // src/commands/refactor/extract/index.ts
11688
- import path36 from "path";
11771
+ import path37 from "path";
11689
11772
  import chalk134 from "chalk";
11690
11773
 
11691
11774
  // src/commands/refactor/extract/applyExtraction.ts
@@ -12138,9 +12221,9 @@ function buildDestinationContent(functionTexts, imports, sourceRelativePath, sou
12138
12221
  }
12139
12222
 
12140
12223
  // src/commands/refactor/extract/getRelativeImportPath.ts
12141
- import path30 from "path";
12224
+ import path31 from "path";
12142
12225
  function getRelativeImportPath(from, to) {
12143
- let rel = path30.relative(path30.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
12226
+ let rel = path31.relative(path31.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
12144
12227
  if (!rel.startsWith(".")) rel = `./${rel}`;
12145
12228
  return rel;
12146
12229
  }
@@ -12164,9 +12247,9 @@ function findImporters(functionName, sourceFile, destPath, project) {
12164
12247
  }
12165
12248
 
12166
12249
  // src/commands/refactor/extract/resolveBarrel.ts
12167
- import path31 from "path";
12250
+ import path32 from "path";
12168
12251
  function resolveBarrel(functionName, sourcePath, destPath, project) {
12169
- const indexPath = path31.join(path31.dirname(destPath), "index.ts");
12252
+ const indexPath = path32.join(path32.dirname(destPath), "index.ts");
12170
12253
  const barrel = project.getSourceFile(indexPath);
12171
12254
  if (!barrel) return { barrel: void 0, barrelRelPath: "" };
12172
12255
  const sourceRelFromBarrel = getRelativeImportPath(indexPath, sourcePath);
@@ -12184,15 +12267,15 @@ function resolveBarrel(functionName, sourcePath, destPath, project) {
12184
12267
  }
12185
12268
 
12186
12269
  // src/commands/refactor/extract/rewriteImportPaths.ts
12187
- import path32 from "path";
12270
+ import path33 from "path";
12188
12271
  function rewriteImportPaths(imports, sourcePath, destPath) {
12189
- const sourceDir = path32.dirname(sourcePath);
12190
- const destDir = path32.dirname(destPath);
12272
+ const sourceDir = path33.dirname(sourcePath);
12273
+ const destDir = path33.dirname(destPath);
12191
12274
  return imports.map((imp) => {
12192
12275
  if (!imp.moduleSpecifier.startsWith(".")) return imp;
12193
- const absolute = path32.resolve(sourceDir, imp.moduleSpecifier);
12194
- let rel = path32.relative(destDir, absolute).replace(/\\/g, "/");
12195
- if (rel === "") rel = `../${path32.basename(absolute)}`;
12276
+ const absolute = path33.resolve(sourceDir, imp.moduleSpecifier);
12277
+ let rel = path33.relative(destDir, absolute).replace(/\\/g, "/");
12278
+ if (rel === "") rel = `../${path33.basename(absolute)}`;
12196
12279
  else if (!rel.startsWith(".")) rel = `./${rel}`;
12197
12280
  return { ...imp, moduleSpecifier: rel };
12198
12281
  });
@@ -12260,7 +12343,7 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
12260
12343
  }
12261
12344
 
12262
12345
  // src/commands/refactor/extract/displayPlan.ts
12263
- import path33 from "path";
12346
+ import path34 from "path";
12264
12347
  import chalk132 from "chalk";
12265
12348
  function section(title) {
12266
12349
  return `
@@ -12270,7 +12353,7 @@ function displayImporters(plan2, cwd) {
12270
12353
  if (plan2.importersToUpdate.length === 0) return;
12271
12354
  console.log(section("Update importers:"));
12272
12355
  for (const imp of plan2.importersToUpdate) {
12273
- const rel = path33.relative(cwd, imp.file.getFilePath());
12356
+ const rel = path34.relative(cwd, imp.file.getFilePath());
12274
12357
  console.log(` ${chalk132.dim(rel)}: \u2192 import from "${imp.relPath}"`);
12275
12358
  }
12276
12359
  }
@@ -12310,16 +12393,16 @@ function displayPlan(functionName, relDest, plan2, cwd) {
12310
12393
  }
12311
12394
 
12312
12395
  // src/commands/refactor/extract/loadProjectFile.ts
12313
- import path35 from "path";
12396
+ import path36 from "path";
12314
12397
  import chalk133 from "chalk";
12315
12398
  import { Project as Project3 } from "ts-morph";
12316
12399
 
12317
12400
  // src/commands/refactor/extract/findTsConfig.ts
12318
12401
  import fs20 from "fs";
12319
- import path34 from "path";
12402
+ import path35 from "path";
12320
12403
  import { Project as Project2 } from "ts-morph";
12321
12404
  function findTsConfig(sourcePath) {
12322
- const rootConfig = path34.resolve("tsconfig.json");
12405
+ const rootConfig = path35.resolve("tsconfig.json");
12323
12406
  if (!fs20.existsSync(rootConfig)) return rootConfig;
12324
12407
  const tried = /* @__PURE__ */ new Set();
12325
12408
  const candidates = [rootConfig, ...readReferences(rootConfig)];
@@ -12328,7 +12411,7 @@ function findTsConfig(sourcePath) {
12328
12411
  tried.add(candidate);
12329
12412
  if (projectIncludes(candidate, sourcePath)) return candidate;
12330
12413
  }
12331
- const siblings = fs20.readdirSync(path34.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path34.resolve(path34.dirname(rootConfig), f));
12414
+ const siblings = fs20.readdirSync(path35.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path35.resolve(path35.dirname(rootConfig), f));
12332
12415
  for (const sibling of siblings) {
12333
12416
  if (tried.has(sibling)) continue;
12334
12417
  tried.add(sibling);
@@ -12347,10 +12430,10 @@ function readReferences(configPath) {
12347
12430
  return [];
12348
12431
  }
12349
12432
  if (!parsed.references?.length) return [];
12350
- const cwd = path34.dirname(configPath);
12433
+ const cwd = path35.dirname(configPath);
12351
12434
  return parsed.references.map((ref) => {
12352
- const refPath = path34.resolve(cwd, ref.path);
12353
- return fs20.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path34.join(refPath, "tsconfig.json") : refPath;
12435
+ const refPath = path35.resolve(cwd, ref.path);
12436
+ return fs20.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path35.join(refPath, "tsconfig.json") : refPath;
12354
12437
  }).filter((p) => fs20.existsSync(p));
12355
12438
  }
12356
12439
  function projectIncludes(configPath, sourcePath) {
@@ -12364,7 +12447,7 @@ function projectIncludes(configPath, sourcePath) {
12364
12447
 
12365
12448
  // src/commands/refactor/extract/loadProjectFile.ts
12366
12449
  function loadProjectFile(file) {
12367
- const sourcePath = path35.resolve(file);
12450
+ const sourcePath = path36.resolve(file);
12368
12451
  const tsConfigPath = findTsConfig(sourcePath);
12369
12452
  const project = new Project3({
12370
12453
  tsConfigFilePath: tsConfigPath
@@ -12379,10 +12462,10 @@ function loadProjectFile(file) {
12379
12462
 
12380
12463
  // src/commands/refactor/extract/index.ts
12381
12464
  async function extract(file, functionName, destination, options2 = {}) {
12382
- const sourcePath = path36.resolve(file);
12383
- const destPath = path36.resolve(destination);
12465
+ const sourcePath = path37.resolve(file);
12466
+ const destPath = path37.resolve(destination);
12384
12467
  const cwd = process.cwd();
12385
- const relDest = path36.relative(cwd, destPath);
12468
+ const relDest = path37.relative(cwd, destPath);
12386
12469
  const { project, sourceFile } = loadProjectFile(file);
12387
12470
  const plan2 = buildPlan2(
12388
12471
  functionName,
@@ -12429,13 +12512,13 @@ function ignore(file) {
12429
12512
  }
12430
12513
 
12431
12514
  // src/commands/refactor/rename/index.ts
12432
- import path37 from "path";
12515
+ import path38 from "path";
12433
12516
  import chalk136 from "chalk";
12434
12517
  async function rename(source, destination, options2 = {}) {
12435
- const destPath = path37.resolve(destination);
12518
+ const destPath = path38.resolve(destination);
12436
12519
  const cwd = process.cwd();
12437
- const relSource = path37.relative(cwd, path37.resolve(source));
12438
- const relDest = path37.relative(cwd, destPath);
12520
+ const relSource = path38.relative(cwd, path38.resolve(source));
12521
+ const relDest = path38.relative(cwd, destPath);
12439
12522
  const { project, sourceFile } = loadProjectFile(source);
12440
12523
  console.log(chalk136.bold(`Rename: ${relSource} \u2192 ${relDest}`));
12441
12524
  if (options2.apply) {
@@ -12475,12 +12558,12 @@ function findSymbol(sourceFile, symbolName) {
12475
12558
  }
12476
12559
 
12477
12560
  // src/commands/refactor/renameSymbol/groupReferences.ts
12478
- import path38 from "path";
12561
+ import path39 from "path";
12479
12562
  function groupReferences(symbol, cwd) {
12480
12563
  const refs = symbol.findReferencesAsNodes();
12481
12564
  const grouped = /* @__PURE__ */ new Map();
12482
12565
  for (const ref of refs) {
12483
- const refFile = path38.relative(cwd, ref.getSourceFile().getFilePath());
12566
+ const refFile = path39.relative(cwd, ref.getSourceFile().getFilePath());
12484
12567
  const lines = grouped.get(refFile) ?? [];
12485
12568
  if (!grouped.has(refFile)) grouped.set(refFile, lines);
12486
12569
  lines.push(ref.getStartLineNumber());
@@ -12519,11 +12602,11 @@ Renamed ${oldName} \u2192 ${newName}`));
12519
12602
  }
12520
12603
 
12521
12604
  // src/commands/refactor/restructure/index.ts
12522
- import path47 from "path";
12605
+ import path48 from "path";
12523
12606
  import chalk140 from "chalk";
12524
12607
 
12525
12608
  // src/commands/refactor/restructure/buildImportGraph/index.ts
12526
- import path39 from "path";
12609
+ import path40 from "path";
12527
12610
  import ts7 from "typescript";
12528
12611
 
12529
12612
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
@@ -12550,7 +12633,7 @@ function loadParsedConfig(tsConfigPath) {
12550
12633
  return ts7.parseJsonConfigFileContent(
12551
12634
  configFile.config,
12552
12635
  ts7.sys,
12553
- path39.dirname(tsConfigPath)
12636
+ path40.dirname(tsConfigPath)
12554
12637
  );
12555
12638
  }
12556
12639
  function addToSetMap(map, key, value) {
@@ -12566,7 +12649,7 @@ function resolveImport(specifier, filePath, options2) {
12566
12649
  const resolved = ts7.resolveModuleName(specifier, filePath, options2, ts7.sys);
12567
12650
  const resolvedPath = resolved.resolvedModule?.resolvedFileName;
12568
12651
  if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
12569
- return path39.resolve(resolvedPath);
12652
+ return path40.resolve(resolvedPath);
12570
12653
  }
12571
12654
  function buildImportGraph(candidateFiles, tsConfigPath) {
12572
12655
  const parsed = loadParsedConfig(tsConfigPath);
@@ -12575,7 +12658,7 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
12575
12658
  const importedBy = /* @__PURE__ */ new Map();
12576
12659
  const imports = /* @__PURE__ */ new Map();
12577
12660
  for (const sourceFile of program2.getSourceFiles()) {
12578
- const filePath = path39.resolve(sourceFile.fileName);
12661
+ const filePath = path40.resolve(sourceFile.fileName);
12579
12662
  if (filePath.includes("node_modules")) continue;
12580
12663
  for (const specifier of getImportSpecifiers(sourceFile)) {
12581
12664
  const absTarget = resolveImport(specifier, filePath, parsed.options);
@@ -12589,12 +12672,12 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
12589
12672
  }
12590
12673
 
12591
12674
  // src/commands/refactor/restructure/clusterDirectories.ts
12592
- import path40 from "path";
12675
+ import path41 from "path";
12593
12676
  function clusterDirectories(graph) {
12594
12677
  const dirImportedBy = /* @__PURE__ */ new Map();
12595
12678
  for (const edge of graph.edges) {
12596
- const sourceDir = path40.dirname(edge.source);
12597
- const targetDir = path40.dirname(edge.target);
12679
+ const sourceDir = path41.dirname(edge.source);
12680
+ const targetDir = path41.dirname(edge.target);
12598
12681
  if (sourceDir === targetDir) continue;
12599
12682
  if (!graph.files.has(edge.target)) continue;
12600
12683
  const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
@@ -12622,20 +12705,20 @@ function clusterDirectories(graph) {
12622
12705
  return clusters;
12623
12706
  }
12624
12707
  function isAncestor(ancestor, descendant) {
12625
- const rel = path40.relative(ancestor, descendant);
12708
+ const rel = path41.relative(ancestor, descendant);
12626
12709
  return !rel.startsWith("..") && rel !== "";
12627
12710
  }
12628
12711
 
12629
12712
  // src/commands/refactor/restructure/clusterFiles.ts
12630
- import path41 from "path";
12713
+ import path42 from "path";
12631
12714
  function findRootParent(file, importedBy, visited) {
12632
12715
  const importers = importedBy.get(file);
12633
12716
  if (!importers || importers.size !== 1) return file;
12634
12717
  const parent = [...importers][0];
12635
- const parentDir = path41.dirname(parent);
12636
- const fileDir = path41.dirname(file);
12718
+ const parentDir = path42.dirname(parent);
12719
+ const fileDir = path42.dirname(file);
12637
12720
  if (parentDir !== fileDir) return file;
12638
- if (path41.basename(parent, path41.extname(parent)) === "index") return file;
12721
+ if (path42.basename(parent, path42.extname(parent)) === "index") return file;
12639
12722
  if (visited.has(parent)) return file;
12640
12723
  visited.add(parent);
12641
12724
  return findRootParent(parent, importedBy, visited);
@@ -12643,16 +12726,16 @@ function findRootParent(file, importedBy, visited) {
12643
12726
  function clusterFiles(graph) {
12644
12727
  const clusters = /* @__PURE__ */ new Map();
12645
12728
  for (const file of graph.files) {
12646
- const basename11 = path41.basename(file, path41.extname(file));
12729
+ const basename11 = path42.basename(file, path42.extname(file));
12647
12730
  if (basename11 === "index") continue;
12648
12731
  const importers = graph.importedBy.get(file);
12649
12732
  if (!importers || importers.size !== 1) continue;
12650
12733
  const parent = [...importers][0];
12651
12734
  if (!graph.files.has(parent)) continue;
12652
- const parentDir = path41.dirname(parent);
12653
- const fileDir = path41.dirname(file);
12735
+ const parentDir = path42.dirname(parent);
12736
+ const fileDir = path42.dirname(file);
12654
12737
  if (parentDir !== fileDir) continue;
12655
- const parentBasename = path41.basename(parent, path41.extname(parent));
12738
+ const parentBasename = path42.basename(parent, path42.extname(parent));
12656
12739
  if (parentBasename === "index") continue;
12657
12740
  const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
12658
12741
  if (!root || root === file) continue;
@@ -12664,7 +12747,7 @@ function clusterFiles(graph) {
12664
12747
  }
12665
12748
 
12666
12749
  // src/commands/refactor/restructure/computeRewrites/index.ts
12667
- import path42 from "path";
12750
+ import path43 from "path";
12668
12751
 
12669
12752
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
12670
12753
  import fs22 from "fs";
@@ -12718,7 +12801,7 @@ function normalizeSpecifier(rel) {
12718
12801
  );
12719
12802
  }
12720
12803
  function computeSpecifier(fromFile, toFile) {
12721
- return normalizeSpecifier(path42.relative(path42.dirname(fromFile), toFile));
12804
+ return normalizeSpecifier(path43.relative(path43.dirname(fromFile), toFile));
12722
12805
  }
12723
12806
  function isAffected(edge, moveMap) {
12724
12807
  return moveMap.has(edge.target) || moveMap.has(edge.source);
@@ -12762,10 +12845,10 @@ function computeRewrites(moves, edges, allProjectFiles) {
12762
12845
  }
12763
12846
 
12764
12847
  // src/commands/refactor/restructure/displayPlan.ts
12765
- import path43 from "path";
12848
+ import path44 from "path";
12766
12849
  import chalk138 from "chalk";
12767
12850
  function relPath(filePath) {
12768
- return path43.relative(process.cwd(), filePath);
12851
+ return path44.relative(process.cwd(), filePath);
12769
12852
  }
12770
12853
  function displayMoves(plan2) {
12771
12854
  if (plan2.moves.length === 0) return;
@@ -12815,33 +12898,33 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
12815
12898
 
12816
12899
  // src/commands/refactor/restructure/executePlan.ts
12817
12900
  import fs23 from "fs";
12818
- import path44 from "path";
12901
+ import path45 from "path";
12819
12902
  import chalk139 from "chalk";
12820
12903
  function executePlan(plan2) {
12821
12904
  const updatedContents = applyRewrites(plan2.rewrites);
12822
12905
  for (const [file, content] of updatedContents) {
12823
12906
  fs23.writeFileSync(file, content, "utf-8");
12824
12907
  console.log(
12825
- chalk139.cyan(` Rewrote imports in ${path44.relative(process.cwd(), file)}`)
12908
+ chalk139.cyan(` Rewrote imports in ${path45.relative(process.cwd(), file)}`)
12826
12909
  );
12827
12910
  }
12828
12911
  for (const dir of plan2.newDirectories) {
12829
12912
  fs23.mkdirSync(dir, { recursive: true });
12830
- console.log(chalk139.green(` Created ${path44.relative(process.cwd(), dir)}/`));
12913
+ console.log(chalk139.green(` Created ${path45.relative(process.cwd(), dir)}/`));
12831
12914
  }
12832
12915
  for (const move of plan2.moves) {
12833
- const targetDir = path44.dirname(move.to);
12916
+ const targetDir = path45.dirname(move.to);
12834
12917
  if (!fs23.existsSync(targetDir)) {
12835
12918
  fs23.mkdirSync(targetDir, { recursive: true });
12836
12919
  }
12837
12920
  fs23.renameSync(move.from, move.to);
12838
12921
  console.log(
12839
12922
  chalk139.white(
12840
- ` Moved ${path44.relative(process.cwd(), move.from)} \u2192 ${path44.relative(process.cwd(), move.to)}`
12923
+ ` Moved ${path45.relative(process.cwd(), move.from)} \u2192 ${path45.relative(process.cwd(), move.to)}`
12841
12924
  )
12842
12925
  );
12843
12926
  }
12844
- removeEmptyDirectories(plan2.moves.map((m) => path44.dirname(m.from)));
12927
+ removeEmptyDirectories(plan2.moves.map((m) => path45.dirname(m.from)));
12845
12928
  }
12846
12929
  function removeEmptyDirectories(dirs) {
12847
12930
  const unique = [...new Set(dirs)];
@@ -12852,7 +12935,7 @@ function removeEmptyDirectories(dirs) {
12852
12935
  fs23.rmdirSync(dir);
12853
12936
  console.log(
12854
12937
  chalk139.dim(
12855
- ` Removed empty directory ${path44.relative(process.cwd(), dir)}`
12938
+ ` Removed empty directory ${path45.relative(process.cwd(), dir)}`
12856
12939
  )
12857
12940
  );
12858
12941
  }
@@ -12860,7 +12943,7 @@ function removeEmptyDirectories(dirs) {
12860
12943
  }
12861
12944
 
12862
12945
  // src/commands/refactor/restructure/planFileMoves/index.ts
12863
- import path46 from "path";
12946
+ import path47 from "path";
12864
12947
 
12865
12948
  // src/commands/refactor/restructure/planFileMoves/shared.ts
12866
12949
  import fs24 from "fs";
@@ -12875,9 +12958,9 @@ function checkDirConflict(result, label2, dir) {
12875
12958
 
12876
12959
  // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
12877
12960
  import fs25 from "fs";
12878
- import path45 from "path";
12961
+ import path46 from "path";
12879
12962
  function collectEntry(results, dir, entry) {
12880
- const full = path45.join(dir, entry.name);
12963
+ const full = path46.join(dir, entry.name);
12881
12964
  const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
12882
12965
  results.push(...items2);
12883
12966
  }
@@ -12891,15 +12974,15 @@ function listFilesRecursive(dir) {
12891
12974
  }
12892
12975
  function addDirectoryFileMoves(moves, childDir, newLocation, reason) {
12893
12976
  for (const file of listFilesRecursive(childDir)) {
12894
- const rel = path45.relative(childDir, file);
12895
- moves.push({ from: file, to: path45.join(newLocation, rel), reason });
12977
+ const rel = path46.relative(childDir, file);
12978
+ moves.push({ from: file, to: path46.join(newLocation, rel), reason });
12896
12979
  }
12897
12980
  }
12898
12981
  function resolveChildDest(parentDir, childDir) {
12899
- return path45.join(parentDir, path45.basename(childDir));
12982
+ return path46.join(parentDir, path46.basename(childDir));
12900
12983
  }
12901
12984
  function childMoveReason(parentDir) {
12902
- return `Directory only imported from ${path45.basename(parentDir)}/`;
12985
+ return `Directory only imported from ${path46.basename(parentDir)}/`;
12903
12986
  }
12904
12987
  function registerDirectoryMove(result, childDir, dest, parentDir) {
12905
12988
  result.directories.push(dest);
@@ -12924,7 +13007,7 @@ function planDirectoryMoves(clusters) {
12924
13007
 
12925
13008
  // src/commands/refactor/restructure/planFileMoves/index.ts
12926
13009
  function childMoveData(child, newDir, parentBase) {
12927
- const to = path46.join(newDir, path46.basename(child));
13010
+ const to = path47.join(newDir, path47.basename(child));
12928
13011
  return { from: child, to, reason: `Only imported by ${parentBase}` };
12929
13012
  }
12930
13013
  function addChildMoves(moves, children, newDir, parentBase) {
@@ -12932,15 +13015,15 @@ function addChildMoves(moves, children, newDir, parentBase) {
12932
13015
  moves.push(childMoveData(child, newDir, parentBase));
12933
13016
  }
12934
13017
  function getBaseName(filePath) {
12935
- return path46.basename(filePath, path46.extname(filePath));
13018
+ return path47.basename(filePath, path47.extname(filePath));
12936
13019
  }
12937
13020
  function resolveClusterDir(parent) {
12938
- return path46.join(path46.dirname(parent), getBaseName(parent));
13021
+ return path47.join(path47.dirname(parent), getBaseName(parent));
12939
13022
  }
12940
13023
  function createParentMove(parent, newDir) {
12941
13024
  return {
12942
13025
  from: parent,
12943
- to: path46.join(newDir, `index${path46.extname(parent)}`),
13026
+ to: path47.join(newDir, `index${path47.extname(parent)}`),
12944
13027
  reason: `Main module of new ${getBaseName(parent)}/ directory`
12945
13028
  };
12946
13029
  }
@@ -12964,7 +13047,7 @@ function planFileMoves(clusters) {
12964
13047
 
12965
13048
  // src/commands/refactor/restructure/index.ts
12966
13049
  function buildPlan3(candidateFiles, tsConfigPath) {
12967
- const candidates = new Set(candidateFiles.map((f) => path47.resolve(f)));
13050
+ const candidates = new Set(candidateFiles.map((f) => path48.resolve(f)));
12968
13051
  const graph = buildImportGraph(candidates, tsConfigPath);
12969
13052
  const allProjectFiles = /* @__PURE__ */ new Set([
12970
13053
  ...graph.importedBy.keys(),
@@ -12987,7 +13070,7 @@ async function restructure(pattern2, options2 = {}) {
12987
13070
  console.log(chalk140.yellow("No files found matching pattern"));
12988
13071
  return;
12989
13072
  }
12990
- const tsConfigPath = path47.resolve("tsconfig.json");
13073
+ const tsConfigPath = path48.resolve("tsconfig.json");
12991
13074
  const plan2 = buildPlan3(files, tsConfigPath);
12992
13075
  if (plan2.moves.length === 0) {
12993
13076
  console.log(chalk140.green("No restructuring needed"));
@@ -13579,10 +13662,10 @@ async function handlePostSynthesis(synthesisPath, options2) {
13579
13662
  }
13580
13663
 
13581
13664
  // src/commands/review/prepareReviewDir.ts
13582
- import { existsSync as existsSync35, mkdirSync as mkdirSync10, unlinkSync as unlinkSync10, writeFileSync as writeFileSync24 } from "fs";
13665
+ import { existsSync as existsSync36, mkdirSync as mkdirSync10, unlinkSync as unlinkSync10, writeFileSync as writeFileSync24 } from "fs";
13583
13666
  function clearReviewFiles(paths) {
13584
- for (const path52 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
13585
- if (existsSync35(path52)) unlinkSync10(path52);
13667
+ for (const path53 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
13668
+ if (existsSync36(path53)) unlinkSync10(path53);
13586
13669
  }
13587
13670
  }
13588
13671
  function prepareReviewDir(paths, requestBody, force) {
@@ -13650,11 +13733,11 @@ async function runBacklogSession(synthesisPath) {
13650
13733
  }
13651
13734
 
13652
13735
  // src/commands/review/cachedReviewerResult.ts
13653
- import { statSync as statSync2 } from "fs";
13736
+ import { statSync as statSync3 } from "fs";
13654
13737
  function cachedReviewerResult(name, outputPath) {
13655
13738
  let size;
13656
13739
  try {
13657
- size = statSync2(outputPath).size;
13740
+ size = statSync3(outputPath).size;
13658
13741
  } catch {
13659
13742
  return null;
13660
13743
  }
@@ -13867,7 +13950,7 @@ function printReviewerFailures(results) {
13867
13950
  }
13868
13951
 
13869
13952
  // src/commands/review/runAndSynthesise.ts
13870
- import { existsSync as existsSync37, unlinkSync as unlinkSync12 } from "fs";
13953
+ import { existsSync as existsSync38, unlinkSync as unlinkSync12 } from "fs";
13871
13954
 
13872
13955
  // src/commands/review/buildReviewerStdin.ts
13873
13956
  var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in request.md in the current working directory.
@@ -14285,7 +14368,7 @@ function resolveClaude(args) {
14285
14368
  }
14286
14369
 
14287
14370
  // src/commands/review/runCodexReviewer.ts
14288
- import { existsSync as existsSync36, unlinkSync as unlinkSync11 } from "fs";
14371
+ import { existsSync as existsSync37, unlinkSync as unlinkSync11 } from "fs";
14289
14372
 
14290
14373
  // src/commands/review/parseCodexEvent.ts
14291
14374
  function isItemStarted(value) {
@@ -14339,7 +14422,7 @@ async function runCodexReviewer(spec) {
14339
14422
  reportReviewerToolUse(spec.name, event, spinner);
14340
14423
  }
14341
14424
  });
14342
- if (result.exitCode !== 0 && existsSync36(spec.outputPath)) {
14425
+ if (result.exitCode !== 0 && existsSync37(spec.outputPath)) {
14343
14426
  unlinkSync11(spec.outputPath);
14344
14427
  }
14345
14428
  return finaliseReviewerRun({ ...spec, command }, spinner, result);
@@ -14487,7 +14570,7 @@ async function runAndSynthesise(args) {
14487
14570
  console.error("Both reviewers failed; skipping synthesis.");
14488
14571
  return { ok: false, failures };
14489
14572
  }
14490
- if (anyFresh && existsSync37(paths.synthesisPath)) {
14573
+ if (anyFresh && existsSync38(paths.synthesisPath)) {
14491
14574
  unlinkSync12(paths.synthesisPath);
14492
14575
  }
14493
14576
  const synthesisResult = await synthesise(paths, { multi });
@@ -14717,8 +14800,8 @@ import chalk147 from "chalk";
14717
14800
 
14718
14801
  // src/commands/seq/fetchSeq.ts
14719
14802
  import chalk144 from "chalk";
14720
- async function fetchSeq(conn, path52, params) {
14721
- const url = `${conn.url}${path52}?${params}`;
14803
+ async function fetchSeq(conn, path53, params) {
14804
+ const url = `${conn.url}${path53}?${params}`;
14722
14805
  const response = await fetch(url, {
14723
14806
  headers: {
14724
14807
  Accept: "application/json",
@@ -15258,7 +15341,7 @@ function registerSql(program2) {
15258
15341
  }
15259
15342
 
15260
15343
  // src/commands/transcript/shared.ts
15261
- import { existsSync as existsSync38, readdirSync as readdirSync6, statSync as statSync3 } from "fs";
15344
+ import { existsSync as existsSync39, readdirSync as readdirSync6, statSync as statSync4 } from "fs";
15262
15345
  import { basename as basename8, join as join36, relative as relative2 } from "path";
15263
15346
  import * as readline2 from "readline";
15264
15347
  var DATE_PREFIX_REGEX = /^\d{4}-\d{2}-\d{2}/;
@@ -15274,11 +15357,11 @@ function isValidDatePrefix(filename) {
15274
15357
  return DATE_PREFIX_REGEX.test(filename);
15275
15358
  }
15276
15359
  function collectFiles(dir, extension) {
15277
- if (!existsSync38(dir)) return [];
15360
+ if (!existsSync39(dir)) return [];
15278
15361
  const results = [];
15279
15362
  for (const entry of readdirSync6(dir)) {
15280
15363
  const fullPath = join36(dir, entry);
15281
- if (statSync3(fullPath).isDirectory()) {
15364
+ if (statSync4(fullPath).isDirectory()) {
15282
15365
  results.push(...collectFiles(fullPath, extension));
15283
15366
  } else if (entry.endsWith(extension)) {
15284
15367
  results.push(fullPath);
@@ -15371,7 +15454,7 @@ async function configure() {
15371
15454
  }
15372
15455
 
15373
15456
  // src/commands/transcript/format/index.ts
15374
- import { existsSync as existsSync40 } from "fs";
15457
+ import { existsSync as existsSync41 } from "fs";
15375
15458
 
15376
15459
  // src/commands/transcript/format/fixInvalidDatePrefixes/index.ts
15377
15460
  import { dirname as dirname20, join as join38 } from "path";
@@ -15445,7 +15528,7 @@ async function fixInvalidDatePrefixes(vttFiles) {
15445
15528
  }
15446
15529
 
15447
15530
  // src/commands/transcript/format/processVttFile/index.ts
15448
- import { existsSync as existsSync39, mkdirSync as mkdirSync11, readFileSync as readFileSync31, writeFileSync as writeFileSync26 } from "fs";
15531
+ import { existsSync as existsSync40, mkdirSync as mkdirSync11, readFileSync as readFileSync31, writeFileSync as writeFileSync26 } from "fs";
15449
15532
  import { basename as basename9, dirname as dirname21, join as join39 } from "path";
15450
15533
 
15451
15534
  // src/commands/transcript/cleanText.ts
@@ -15670,7 +15753,7 @@ function logSkipped(relativeDir, mdFile) {
15670
15753
  return "skipped";
15671
15754
  }
15672
15755
  function ensureDirectory(dir, label2) {
15673
- if (!existsSync39(dir)) {
15756
+ if (!existsSync40(dir)) {
15674
15757
  mkdirSync11(dir, { recursive: true });
15675
15758
  console.log(`Created ${label2}: ${dir}`);
15676
15759
  }
@@ -15706,7 +15789,7 @@ function convertVttToMarkdown(inputPath, outputPath) {
15706
15789
  logReduction(cues.length, chatMessages.length);
15707
15790
  }
15708
15791
  function tryProcessVtt(vttFile, paths) {
15709
- if (existsSync39(paths.outputPath))
15792
+ if (existsSync40(paths.outputPath))
15710
15793
  return logSkipped(paths.relativeDir, paths.mdFile);
15711
15794
  convertVttToMarkdown(vttFile.absolutePath, paths.outputPath);
15712
15795
  return "processed";
@@ -15732,7 +15815,7 @@ function processAllFiles(vttFiles, transcriptsDir) {
15732
15815
  logSummary(counts);
15733
15816
  }
15734
15817
  function requireVttDir(vttDir) {
15735
- if (!existsSync40(vttDir)) {
15818
+ if (!existsSync41(vttDir)) {
15736
15819
  console.error(`VTT directory not found: ${vttDir}`);
15737
15820
  process.exit(1);
15738
15821
  }
@@ -15764,12 +15847,12 @@ async function format() {
15764
15847
  }
15765
15848
 
15766
15849
  // src/commands/transcript/summarise/index.ts
15767
- import { existsSync as existsSync42 } from "fs";
15850
+ import { existsSync as existsSync43 } from "fs";
15768
15851
  import { basename as basename10, dirname as dirname23, join as join41, relative as relative3 } from "path";
15769
15852
 
15770
15853
  // src/commands/transcript/summarise/processStagedFile/index.ts
15771
15854
  import {
15772
- existsSync as existsSync41,
15855
+ existsSync as existsSync42,
15773
15856
  mkdirSync as mkdirSync12,
15774
15857
  readFileSync as readFileSync32,
15775
15858
  renameSync as renameSync4,
@@ -15806,7 +15889,7 @@ function validateStagedContent(filename, content) {
15806
15889
  // src/commands/transcript/summarise/processStagedFile/index.ts
15807
15890
  var STAGING_DIR = join40(process.cwd(), ".assist", "transcript");
15808
15891
  function processStagedFile() {
15809
- if (!existsSync41(STAGING_DIR)) {
15892
+ if (!existsSync42(STAGING_DIR)) {
15810
15893
  return false;
15811
15894
  }
15812
15895
  const stagedFiles = findMdFilesRecursive(STAGING_DIR);
@@ -15830,7 +15913,7 @@ function processStagedFile() {
15830
15913
  }
15831
15914
  const destPath = join40(summaryDir, matchingTranscript.relativePath);
15832
15915
  const destDir = dirname22(destPath);
15833
- if (!existsSync41(destDir)) {
15916
+ if (!existsSync42(destDir)) {
15834
15917
  mkdirSync12(destDir, { recursive: true });
15835
15918
  }
15836
15919
  renameSync4(stagedFile.absolutePath, destPath);
@@ -15857,7 +15940,7 @@ function buildSummaryIndex(summaryDir) {
15857
15940
  function summarise3() {
15858
15941
  processStagedFile();
15859
15942
  const { transcriptsDir, summaryDir } = getTranscriptConfig();
15860
- if (!existsSync42(transcriptsDir)) {
15943
+ if (!existsSync43(transcriptsDir)) {
15861
15944
  console.log("No transcripts directory found.");
15862
15945
  return;
15863
15946
  }
@@ -15964,9 +16047,9 @@ function devices() {
15964
16047
  }
15965
16048
 
15966
16049
  // src/commands/voice/logs.ts
15967
- import { existsSync as existsSync43, readFileSync as readFileSync33 } from "fs";
16050
+ import { existsSync as existsSync44, readFileSync as readFileSync33 } from "fs";
15968
16051
  function logs(options2) {
15969
- if (!existsSync43(voicePaths.log)) {
16052
+ if (!existsSync44(voicePaths.log)) {
15970
16053
  console.log("No voice log file found");
15971
16054
  return;
15972
16055
  }
@@ -15998,7 +16081,7 @@ import { join as join45 } from "path";
15998
16081
 
15999
16082
  // src/commands/voice/checkLockFile.ts
16000
16083
  import { execSync as execSync44 } from "child_process";
16001
- import { existsSync as existsSync44, mkdirSync as mkdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync27 } from "fs";
16084
+ import { existsSync as existsSync45, mkdirSync as mkdirSync13, readFileSync as readFileSync34, writeFileSync as writeFileSync27 } from "fs";
16002
16085
  import { join as join44 } from "path";
16003
16086
  function isProcessAlive2(pid) {
16004
16087
  try {
@@ -16010,7 +16093,7 @@ function isProcessAlive2(pid) {
16010
16093
  }
16011
16094
  function checkLockFile() {
16012
16095
  const lockFile = getLockFile();
16013
- if (!existsSync44(lockFile)) return;
16096
+ if (!existsSync45(lockFile)) return;
16014
16097
  try {
16015
16098
  const lock = JSON.parse(readFileSync34(lockFile, "utf-8"));
16016
16099
  if (lock.pid && isProcessAlive2(lock.pid)) {
@@ -16023,7 +16106,7 @@ function checkLockFile() {
16023
16106
  }
16024
16107
  }
16025
16108
  function bootstrapVenv() {
16026
- if (existsSync44(getVenvPython())) return;
16109
+ if (existsSync45(getVenvPython())) return;
16027
16110
  console.log("Setting up Python environment...");
16028
16111
  const pythonDir = getPythonDir();
16029
16112
  execSync44(
@@ -16114,7 +16197,7 @@ function start2(options2) {
16114
16197
  }
16115
16198
 
16116
16199
  // src/commands/voice/status.ts
16117
- import { existsSync as existsSync45, readFileSync as readFileSync35 } from "fs";
16200
+ import { existsSync as existsSync46, readFileSync as readFileSync35 } from "fs";
16118
16201
  function isProcessAlive3(pid) {
16119
16202
  try {
16120
16203
  process.kill(pid, 0);
@@ -16124,12 +16207,12 @@ function isProcessAlive3(pid) {
16124
16207
  }
16125
16208
  }
16126
16209
  function readRecentLogs(count6) {
16127
- if (!existsSync45(voicePaths.log)) return [];
16210
+ if (!existsSync46(voicePaths.log)) return [];
16128
16211
  const lines = readFileSync35(voicePaths.log, "utf-8").trim().split("\n");
16129
16212
  return lines.slice(-count6);
16130
16213
  }
16131
16214
  function status() {
16132
- if (!existsSync45(voicePaths.pid)) {
16215
+ if (!existsSync46(voicePaths.pid)) {
16133
16216
  console.log("Voice daemon: not running (no PID file)");
16134
16217
  return;
16135
16218
  }
@@ -16152,9 +16235,9 @@ function status() {
16152
16235
  }
16153
16236
 
16154
16237
  // src/commands/voice/stop.ts
16155
- import { existsSync as existsSync46, readFileSync as readFileSync36, unlinkSync as unlinkSync13 } from "fs";
16238
+ import { existsSync as existsSync47, readFileSync as readFileSync36, unlinkSync as unlinkSync13 } from "fs";
16156
16239
  function stop2() {
16157
- if (!existsSync46(voicePaths.pid)) {
16240
+ if (!existsSync47(voicePaths.pid)) {
16158
16241
  console.log("Voice daemon is not running (no PID file)");
16159
16242
  return;
16160
16243
  }
@@ -16171,7 +16254,7 @@ function stop2() {
16171
16254
  }
16172
16255
  try {
16173
16256
  const lockFile = getLockFile();
16174
- if (existsSync46(lockFile)) unlinkSync13(lockFile);
16257
+ if (existsSync47(lockFile)) unlinkSync13(lockFile);
16175
16258
  } catch {
16176
16259
  }
16177
16260
  console.log("Voice daemon stopped");
@@ -16393,7 +16476,7 @@ async function auth() {
16393
16476
 
16394
16477
  // src/commands/roam/postRoamActivity.ts
16395
16478
  import { execFileSync as execFileSync7 } from "child_process";
16396
- import { readdirSync as readdirSync7, readFileSync as readFileSync37, statSync as statSync4 } from "fs";
16479
+ import { readdirSync as readdirSync7, readFileSync as readFileSync37, statSync as statSync5 } from "fs";
16397
16480
  import { join as join47 } from "path";
16398
16481
  function findPortFile(roamDir) {
16399
16482
  let entries;
@@ -16403,9 +16486,9 @@ function findPortFile(roamDir) {
16403
16486
  return void 0;
16404
16487
  }
16405
16488
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
16406
- const path52 = join47(roamDir, name);
16489
+ const path53 = join47(roamDir, name);
16407
16490
  try {
16408
- return { path: path52, mtimeMs: statSync4(path52).mtimeMs };
16491
+ return { path: path53, mtimeMs: statSync5(path53).mtimeMs };
16409
16492
  } catch {
16410
16493
  return void 0;
16411
16494
  }
@@ -16553,7 +16636,7 @@ function runPreCommands(pre, cwd) {
16553
16636
 
16554
16637
  // src/commands/run/spawnRunCommand.ts
16555
16638
  import { execFileSync as execFileSync8, spawn as spawn8 } from "child_process";
16556
- import { existsSync as existsSync47 } from "fs";
16639
+ import { existsSync as existsSync48 } from "fs";
16557
16640
  import { dirname as dirname25, join as join48, resolve as resolve11 } from "path";
16558
16641
  function resolveCommand2(command) {
16559
16642
  if (process.platform !== "win32" || command !== "bash") return command;
@@ -16561,7 +16644,7 @@ function resolveCommand2(command) {
16561
16644
  const gitPath = execFileSync8("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
16562
16645
  const gitRoot = resolve11(dirname25(gitPath), "..");
16563
16646
  const gitBash = join48(gitRoot, "bin", "bash.exe");
16564
- if (existsSync47(gitBash)) return gitBash;
16647
+ if (existsSync48(gitBash)) return gitBash;
16565
16648
  } catch {
16566
16649
  }
16567
16650
  return command;
@@ -16722,11 +16805,11 @@ function findLinkIndex() {
16722
16805
  function parseLinkArgs() {
16723
16806
  const idx = findLinkIndex();
16724
16807
  if (idx === -1) return null;
16725
- const path52 = process.argv[idx + 1];
16808
+ const path53 = process.argv[idx + 1];
16726
16809
  const rest = process.argv.slice(idx + 2);
16727
16810
  const { value: prefix2 } = extractOption(rest, "--prefix");
16728
16811
  if (!prefix2) return null;
16729
- return { path: path52, prefix: prefix2 };
16812
+ return { path: path53, prefix: prefix2 };
16730
16813
  }
16731
16814
  function hasDuplicateLink(runList, linkPath) {
16732
16815
  return runList.some(
@@ -16754,7 +16837,7 @@ function link2() {
16754
16837
  }
16755
16838
 
16756
16839
  // src/commands/run/remove.ts
16757
- import { existsSync as existsSync48, unlinkSync as unlinkSync14 } from "fs";
16840
+ import { existsSync as existsSync49, unlinkSync as unlinkSync14 } from "fs";
16758
16841
  import { join as join50 } from "path";
16759
16842
  function findRemoveIndex() {
16760
16843
  const idx = process.argv.indexOf("remove");
@@ -16771,7 +16854,7 @@ function parseRemoveName() {
16771
16854
  }
16772
16855
  function deleteCommandFile(name) {
16773
16856
  const filePath = join50(".claude", "commands", `${name}.md`);
16774
- if (existsSync48(filePath)) {
16857
+ if (existsSync49(filePath)) {
16775
16858
  unlinkSync14(filePath);
16776
16859
  console.log(`Deleted command file: ${filePath}`);
16777
16860
  }
@@ -16807,7 +16890,7 @@ function registerRun(program2) {
16807
16890
 
16808
16891
  // src/commands/screenshot/index.ts
16809
16892
  import { execSync as execSync47 } from "child_process";
16810
- import { existsSync as existsSync49, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
16893
+ import { existsSync as existsSync50, mkdirSync as mkdirSync17, unlinkSync as unlinkSync15, writeFileSync as writeFileSync30 } from "fs";
16811
16894
  import { tmpdir as tmpdir7 } from "os";
16812
16895
  import { join as join51, resolve as resolve13 } from "path";
16813
16896
  import chalk156 from "chalk";
@@ -16939,7 +17022,7 @@ Write-Output $OutputPath
16939
17022
 
16940
17023
  // src/commands/screenshot/index.ts
16941
17024
  function buildOutputPath(outputDir, processName) {
16942
- if (!existsSync49(outputDir)) {
17025
+ if (!existsSync50(outputDir)) {
16943
17026
  mkdirSync17(outputDir, { recursive: true });
16944
17027
  }
16945
17028
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
@@ -17239,16 +17322,16 @@ async function statusLine() {
17239
17322
  // src/commands/sync.ts
17240
17323
  import * as fs31 from "fs";
17241
17324
  import * as os2 from "os";
17242
- import * as path50 from "path";
17325
+ import * as path51 from "path";
17243
17326
  import { fileURLToPath as fileURLToPath7 } from "url";
17244
17327
 
17245
17328
  // src/commands/sync/syncClaudeMd.ts
17246
17329
  import * as fs29 from "fs";
17247
- import * as path48 from "path";
17330
+ import * as path49 from "path";
17248
17331
  import chalk160 from "chalk";
17249
17332
  async function syncClaudeMd(claudeDir, targetBase, options2) {
17250
- const source = path48.join(claudeDir, "CLAUDE.md");
17251
- const target = path48.join(targetBase, "CLAUDE.md");
17333
+ const source = path49.join(claudeDir, "CLAUDE.md");
17334
+ const target = path49.join(targetBase, "CLAUDE.md");
17252
17335
  const sourceContent = fs29.readFileSync(source, "utf-8");
17253
17336
  if (fs29.existsSync(target)) {
17254
17337
  const targetContent = fs29.readFileSync(target, "utf-8");
@@ -17274,11 +17357,11 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
17274
17357
 
17275
17358
  // src/commands/sync/syncSettings.ts
17276
17359
  import * as fs30 from "fs";
17277
- import * as path49 from "path";
17360
+ import * as path50 from "path";
17278
17361
  import chalk161 from "chalk";
17279
17362
  async function syncSettings(claudeDir, targetBase, options2) {
17280
- const source = path49.join(claudeDir, "settings.json");
17281
- const target = path49.join(targetBase, "settings.json");
17363
+ const source = path50.join(claudeDir, "settings.json");
17364
+ const target = path50.join(targetBase, "settings.json");
17282
17365
  const sourceContent = fs30.readFileSync(source, "utf-8");
17283
17366
  const mergedContent = JSON.stringify(JSON.parse(sourceContent), null, " ");
17284
17367
  if (fs30.existsSync(target)) {
@@ -17314,23 +17397,23 @@ async function syncSettings(claudeDir, targetBase, options2) {
17314
17397
 
17315
17398
  // src/commands/sync.ts
17316
17399
  var __filename4 = fileURLToPath7(import.meta.url);
17317
- var __dirname7 = path50.dirname(__filename4);
17400
+ var __dirname7 = path51.dirname(__filename4);
17318
17401
  async function sync(options2) {
17319
17402
  const config = loadConfig();
17320
17403
  const yes = options2?.yes ?? config.sync.autoConfirm;
17321
- const claudeDir = path50.join(__dirname7, "..", "claude");
17322
- const targetBase = path50.join(os2.homedir(), ".claude");
17404
+ const claudeDir = path51.join(__dirname7, "..", "claude");
17405
+ const targetBase = path51.join(os2.homedir(), ".claude");
17323
17406
  syncCommands(claudeDir, targetBase);
17324
17407
  await syncSettings(claudeDir, targetBase, { yes });
17325
17408
  await syncClaudeMd(claudeDir, targetBase, { yes });
17326
17409
  }
17327
17410
  function syncCommands(claudeDir, targetBase) {
17328
- const sourceDir = path50.join(claudeDir, "commands");
17329
- const targetDir = path50.join(targetBase, "commands");
17411
+ const sourceDir = path51.join(claudeDir, "commands");
17412
+ const targetDir = path51.join(targetBase, "commands");
17330
17413
  fs31.mkdirSync(targetDir, { recursive: true });
17331
17414
  const files = fs31.readdirSync(sourceDir);
17332
17415
  for (const file of files) {
17333
- fs31.copyFileSync(path50.join(sourceDir, file), path50.join(targetDir, file));
17416
+ fs31.copyFileSync(path51.join(sourceDir, file), path51.join(targetDir, file));
17334
17417
  console.log(`Copied ${file} to ${targetDir}`);
17335
17418
  }
17336
17419
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -17338,15 +17421,15 @@ function syncCommands(claudeDir, targetBase) {
17338
17421
 
17339
17422
  // src/commands/update.ts
17340
17423
  import { execSync as execSync48 } from "child_process";
17341
- import * as path51 from "path";
17424
+ import * as path52 from "path";
17342
17425
  function isGlobalNpmInstall(dir) {
17343
17426
  try {
17344
- const resolved = path51.resolve(dir);
17345
- if (resolved.split(path51.sep).includes("node_modules")) {
17427
+ const resolved = path52.resolve(dir);
17428
+ if (resolved.split(path52.sep).includes("node_modules")) {
17346
17429
  return true;
17347
17430
  }
17348
17431
  const globalPrefix = execSync48("npm prefix -g", { stdio: "pipe" }).toString().trim();
17349
- return resolved.toLowerCase().startsWith(path51.resolve(globalPrefix).toLowerCase());
17432
+ return resolved.toLowerCase().startsWith(path52.resolve(globalPrefix).toLowerCase());
17350
17433
  } catch {
17351
17434
  return false;
17352
17435
  }