@staff0rd/assist 0.693.0 → 0.693.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.693.0",
9
+ version: "0.693.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
296
296
  }
297
297
 
298
298
  // src/commands/backlog/getCurrentOrigin.ts
299
- function stripLeadingSlashes(path91) {
300
- return path91.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path96) {
300
+ return path96.replace(/^\/+/, "");
301
301
  }
302
302
  function normalizeOrigin(raw) {
303
303
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -318,8 +318,8 @@ function normalizeOrigin(raw) {
318
318
  function resolveCurrentOrigin(cwd) {
319
319
  const remote = remoteUrl(cwd);
320
320
  if (remote.url) return { origin: normalizeOrigin(remote.url), stable: true };
321
- const root = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
322
- return { origin: `local:${root ?? cwd}`, stable: remote.ok };
321
+ const root2 = tryGit(cwd, ["rev-parse", "--show-toplevel"]);
322
+ return { origin: `local:${root2 ?? cwd}`, stable: remote.ok };
323
323
  }
324
324
  function getCurrentOrigin(cwd) {
325
325
  return resolveCurrentOrigin(cwd).origin;
@@ -329,14 +329,14 @@ function getCurrentOrigin(cwd) {
329
329
  import { existsSync as existsSync2, readFileSync as readFileSync2, statSync } from "fs";
330
330
  import { basename, dirname as dirname2, isAbsolute, join as join2, resolve } from "path";
331
331
  function linkedWorktree(dir) {
332
- const root = findGitLink(dir);
333
- if (!root) return null;
334
- const gitDir = readGitDirPointer(root);
332
+ const root2 = findGitLink(dir);
333
+ if (!root2) return null;
334
+ const gitDir = readGitDirPointer(root2);
335
335
  if (!gitDir) return null;
336
336
  const commonDir = resolveCommonDir(gitDir);
337
337
  if (!commonDir || basename(commonDir) !== ".git") return null;
338
338
  const clone = dirname2(commonDir);
339
- return existsSync2(clone) ? { root, clone } : null;
339
+ return existsSync2(clone) ? { root: root2, clone } : null;
340
340
  }
341
341
  function findGitLink(dir) {
342
342
  let current = resolve(dir);
@@ -347,17 +347,17 @@ function findGitLink(dir) {
347
347
  }
348
348
  return null;
349
349
  }
350
- function isFile(path91) {
350
+ function isFile(path96) {
351
351
  try {
352
- return statSync(path91).isFile();
352
+ return statSync(path96).isFile();
353
353
  } catch {
354
354
  return false;
355
355
  }
356
356
  }
357
- function readGitDirPointer(root) {
358
- const target = readTrimmed(join2(root, ".git"));
357
+ function readGitDirPointer(root2) {
358
+ const target = readTrimmed(join2(root2, ".git"));
359
359
  if (!target?.startsWith("gitdir:")) return null;
360
- return absolute(target.slice("gitdir:".length).trim(), root);
360
+ return absolute(target.slice("gitdir:".length).trim(), root2);
361
361
  }
362
362
  function resolveCommonDir(gitDir) {
363
363
  const recorded = readTrimmed(join2(gitDir, "commondir"));
@@ -368,9 +368,9 @@ function linkedGitDirParent(gitDir) {
368
368
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
369
369
  return match ? match[1] : null;
370
370
  }
371
- function readTrimmed(path91) {
371
+ function readTrimmed(path96) {
372
372
  try {
373
- const content = readFileSync2(path91, "utf8").trim();
373
+ const content = readFileSync2(path96, "utf8").trim();
374
374
  return content === "" ? null : content;
375
375
  } catch {
376
376
  return null;
@@ -383,10 +383,10 @@ function absolute(target, from) {
383
383
  // src/shared/loadRawYaml.ts
384
384
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
385
385
  import { parse as parseYaml } from "yaml";
386
- function loadRawYaml(path91) {
387
- if (!existsSync3(path91)) return {};
386
+ function loadRawYaml(path96) {
387
+ if (!existsSync3(path96)) return {};
388
388
  try {
389
- const content = readFileSync3(path91, "utf8");
389
+ const content = readFileSync3(path96, "utf8");
390
390
  return parseYaml(content) || {};
391
391
  } catch {
392
392
  return {};
@@ -458,8 +458,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
458
458
  // src/commands/backlog/originDisplayName.ts
459
459
  function originDisplayName(origin) {
460
460
  if (origin.startsWith("local:")) {
461
- const path91 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path91.split("/").filter(Boolean);
461
+ const path96 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path96.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -2175,14 +2175,14 @@ function extractRazorComments(content) {
2175
2175
  continue;
2176
2176
  }
2177
2177
  if (codeDepth > 0) {
2178
- const step3 = stepRazorCode(content, index3);
2179
- codeDepth += step3.depthChange;
2180
- index3 = step3.next;
2178
+ const step4 = stepRazorCode(content, index3);
2179
+ codeDepth += step4.depthChange;
2180
+ index3 = step4.next;
2181
2181
  continue;
2182
2182
  }
2183
- const step2 = stepRazorMarkup(content, index3);
2184
- if (step2.enteredCode) codeDepth = 1;
2185
- index3 = step2.next;
2183
+ const step3 = stepRazorMarkup(content, index3);
2184
+ if (step3.enteredCode) codeDepth = 1;
2185
+ index3 = step3.next;
2186
2186
  }
2187
2187
  return comments3;
2188
2188
  }
@@ -2573,9 +2573,9 @@ function segmentText(segment) {
2573
2573
  if (segment.kind === "index") return `[${segment.index}]`;
2574
2574
  return "[]";
2575
2575
  }
2576
- function formatConfigPath(path91) {
2576
+ function formatConfigPath(path96) {
2577
2577
  let text18 = "";
2578
- for (const segment of path91) {
2578
+ for (const segment of path96) {
2579
2579
  const dotted = segment.kind === "key" || segment.kind === "entry";
2580
2580
  const rendered = segmentText(segment);
2581
2581
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -2736,11 +2736,11 @@ function enumValues(node) {
2736
2736
  function opaqueConfigNode(inner, base) {
2737
2737
  return { ...base, kind: "other", type: leafTypeOf(inner) };
2738
2738
  }
2739
- function build(node, path91) {
2739
+ function build(node, path96) {
2740
2740
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
2741
2741
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
2742
2742
  const base = {
2743
- path: path91,
2743
+ path: path96,
2744
2744
  ...optional ? { optional: true } : {},
2745
2745
  ...defaultValue === void 0 ? {} : { defaultValue },
2746
2746
  ...secret ? { secret: true } : {}
@@ -3490,9 +3490,9 @@ import { existsSync as existsSync14, readFileSync as readFileSync11 } from "fs";
3490
3490
 
3491
3491
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
3492
3492
  import { minimatch as minimatch2 } from "minimatch";
3493
- function resolveStringsAtPath(data, path91) {
3493
+ function resolveStringsAtPath(data, path96) {
3494
3494
  let current = data;
3495
- for (const segment of path91.split(".")) {
3495
+ for (const segment of path96.split(".")) {
3496
3496
  if (current === null || typeof current !== "object") return [];
3497
3497
  current = current[segment];
3498
3498
  }
@@ -3505,10 +3505,10 @@ function resolveStringsAtPath(data, path91) {
3505
3505
  }
3506
3506
  function findRuleViolations(data, rule) {
3507
3507
  const violations = [];
3508
- for (const path91 of rule.paths) {
3509
- for (const value of resolveStringsAtPath(data, path91)) {
3508
+ for (const path96 of rule.paths) {
3509
+ for (const value of resolveStringsAtPath(data, path96)) {
3510
3510
  if (minimatch2(value, rule.disallowed))
3511
- violations.push({ file: rule.file, path: path91, value });
3511
+ violations.push({ file: rule.file, path: path96, value });
3512
3512
  }
3513
3513
  }
3514
3514
  return violations;
@@ -3547,8 +3547,8 @@ function forbiddenStrings() {
3547
3547
  process.exit(0);
3548
3548
  }
3549
3549
  console.log("Forbidden strings found:\n");
3550
- for (const { file, path: path91, value } of violations) {
3551
- console.log(` ${file} ${path91}: ${value}`);
3550
+ for (const { file, path: path96, value } of violations) {
3551
+ console.log(` ${file} ${path96}: ${value}`);
3552
3552
  }
3553
3553
  console.log(`
3554
3554
  Total: ${violations.length} forbidden string(s).`);
@@ -4151,15 +4151,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
4151
4151
  } catch {
4152
4152
  return baseline;
4153
4153
  }
4154
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path91) => MIGRATION_FILE3.test(basename3(path91)));
4155
- for (const path91 of paths) {
4154
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path96) => MIGRATION_FILE3.test(basename3(path96)));
4155
+ for (const path96 of paths) {
4156
4156
  try {
4157
- const content = execSync5(`git show "${ref}:${path91}"`, {
4157
+ const content = execSync5(`git show "${ref}:${path96}"`, {
4158
4158
  encoding: "utf8",
4159
4159
  maxBuffer: 16 * 1024 * 1024,
4160
4160
  stdio: ["pipe", "pipe", "pipe"]
4161
4161
  });
4162
- baseline.set(basename3(path91), content);
4162
+ baseline.set(basename3(path96), content);
4163
4163
  } catch {
4164
4164
  }
4165
4165
  }
@@ -5966,9 +5966,9 @@ function groupColumns(rows) {
5966
5966
  }
5967
5967
 
5968
5968
  // src/commands/backlog/dump/orderDumpTables.ts
5969
- function buildGraph(names, edges) {
5970
- const present = new Set(names);
5971
- const indegree = new Map(names.map((n) => [n, 0]));
5969
+ function buildGraph(names2, edges) {
5970
+ const present = new Set(names2);
5971
+ const indegree = new Map(names2.map((n) => [n, 0]));
5972
5972
  const children = /* @__PURE__ */ new Map();
5973
5973
  for (const { child, parent } of edges) {
5974
5974
  if (!present.has(child) || !present.has(parent)) continue;
@@ -5977,17 +5977,17 @@ function buildGraph(names, edges) {
5977
5977
  }
5978
5978
  return { indegree, children };
5979
5979
  }
5980
- function nextReady(names, emitted, indegree) {
5981
- return names.find((n) => !emitted.has(n) && (indegree.get(n) ?? 0) === 0);
5980
+ function nextReady(names2, emitted, indegree) {
5981
+ return names2.find((n) => !emitted.has(n) && (indegree.get(n) ?? 0) === 0);
5982
5982
  }
5983
5983
  function topoSort(entries, edges) {
5984
- const names = entries.map((e) => e.raw);
5985
- const { indegree, children } = buildGraph(names, edges);
5984
+ const names2 = entries.map((e) => e.raw);
5985
+ const { indegree, children } = buildGraph(names2, edges);
5986
5986
  const byRaw = new Map(entries.map((e) => [e.raw, e.table]));
5987
5987
  const ordered = [];
5988
5988
  const emitted = /* @__PURE__ */ new Set();
5989
5989
  while (ordered.length < entries.length) {
5990
- const next3 = nextReady(names, emitted, indegree);
5990
+ const next3 = nextReady(names2, emitted, indegree);
5991
5991
  if (!next3)
5992
5992
  throw new Error("Cannot dump: foreign-key cycle between tables.");
5993
5993
  emitted.add(next3);
@@ -6406,10 +6406,10 @@ var hooksSettings = {
6406
6406
  }
6407
6407
  };
6408
6408
  function ensureHooksSettings() {
6409
- const path91 = daemonPaths.hooksSettings;
6410
- mkdirSync5(dirname14(path91), { recursive: true });
6411
- writeFileSync15(path91, JSON.stringify(hooksSettings, null, 2));
6412
- return path91;
6409
+ const path96 = daemonPaths.hooksSettings;
6410
+ mkdirSync5(dirname14(path96), { recursive: true });
6411
+ writeFileSync15(path96, JSON.stringify(hooksSettings, null, 2));
6412
+ return path96;
6413
6413
  }
6414
6414
 
6415
6415
  // src/shared/spawnInherit.ts
@@ -6587,8 +6587,8 @@ function getPreferredRemoteRepo(cwd) {
6587
6587
  function gitRefUrl(kind, ref, cwd) {
6588
6588
  const repo = getPreferredRemoteRepo(cwd);
6589
6589
  if (!repo) return void 0;
6590
- const path91 = kind === "branch" ? "tree" : "commit";
6591
- return `https://github.com/${repo.org}/${repo.repo}/${path91}/${ref}`;
6590
+ const path96 = kind === "branch" ? "tree" : "commit";
6591
+ return `https://github.com/${repo.org}/${repo.repo}/${path96}/${ref}`;
6592
6592
  }
6593
6593
 
6594
6594
  // src/commands/branch/buildBranchName.ts
@@ -6671,13 +6671,13 @@ var TICK_MS = 80;
6671
6671
  async function withSpinner(text18, task) {
6672
6672
  if (!process.stderr.isTTY) return task();
6673
6673
  let frame = 0;
6674
- const render = () => {
6674
+ const render2 = () => {
6675
6675
  process.stderr.write(`\r${SPINNER_FRAMES[frame]} ${text18}`);
6676
6676
  };
6677
- render();
6677
+ render2();
6678
6678
  const timer = setInterval(() => {
6679
6679
  frame = (frame + 1) % SPINNER_FRAMES.length;
6680
- render();
6680
+ render2();
6681
6681
  }, TICK_MS);
6682
6682
  try {
6683
6683
  return await task();
@@ -6831,9 +6831,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
6831
6831
  function backupLocalBacklogFiles(dir) {
6832
6832
  const moved = [];
6833
6833
  for (const name of LOCAL_FILES) {
6834
- const path91 = join18(dir, ".assist", name);
6835
- if (existsSync21(path91)) {
6836
- renameSync(path91, `${path91}.bak`);
6834
+ const path96 = join18(dir, ".assist", name);
6835
+ if (existsSync21(path96)) {
6836
+ renameSync(path96, `${path96}.bak`);
6837
6837
  moved.push(`${name} \u2192 ${name}.bak`);
6838
6838
  }
6839
6839
  }
@@ -7317,8 +7317,8 @@ var backlogItemSchema = z4.strictObject({
7317
7317
  var backlogFileSchema = z4.array(backlogItemSchema);
7318
7318
 
7319
7319
  // src/commands/backlog/parseBacklogJsonl.ts
7320
- function parseBacklogJsonl(path91) {
7321
- const content = readFileSync16(path91, "utf8").trim();
7320
+ function parseBacklogJsonl(path96) {
7321
+ const content = readFileSync16(path96, "utf8").trim();
7322
7322
  if (content.length === 0) return [];
7323
7323
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
7324
7324
  }
@@ -7741,7 +7741,7 @@ function sendToDaemonAwaitAck(message3) {
7741
7741
  return new Promise((resolve25, reject) => {
7742
7742
  connectToDaemon().then((socket) => {
7743
7743
  let settled = false;
7744
- const finish = (error) => {
7744
+ const finish2 = (error) => {
7745
7745
  if (settled) return;
7746
7746
  settled = true;
7747
7747
  clearTimeout(timer);
@@ -7750,16 +7750,16 @@ function sendToDaemonAwaitAck(message3) {
7750
7750
  else resolve25();
7751
7751
  };
7752
7752
  const timer = setTimeout(
7753
- () => finish(new Error("timed out awaiting daemon ack")),
7753
+ () => finish2(new Error("timed out awaiting daemon ack")),
7754
7754
  ACK_TIMEOUT_MS
7755
7755
  );
7756
7756
  readSocketLines(socket, (line) => {
7757
- if (isAck(line)) finish();
7757
+ if (isAck(line)) finish2();
7758
7758
  });
7759
- socket.on("error", (error) => finish(error));
7759
+ socket.on("error", (error) => finish2(error));
7760
7760
  socket.on(
7761
7761
  "close",
7762
- () => finish(new Error("daemon closed before acknowledging"))
7762
+ () => finish2(new Error("daemon closed before acknowledging"))
7763
7763
  );
7764
7764
  socket.write(`${JSON.stringify(message3)}
7765
7765
  `);
@@ -8177,24 +8177,24 @@ function getOwnerPath(itemId2) {
8177
8177
  function recordSignalOwner(itemId2) {
8178
8178
  const sessionId = process.env.ASSIST_SESSION_ID;
8179
8179
  if (!sessionId) return;
8180
- const path91 = getOwnerPath(itemId2);
8181
- mkdirSync7(dirname16(path91), { recursive: true });
8182
- writeFileSync17(path91, JSON.stringify({ sessionId }));
8180
+ const path96 = getOwnerPath(itemId2);
8181
+ mkdirSync7(dirname16(path96), { recursive: true });
8182
+ writeFileSync17(path96, JSON.stringify({ sessionId }));
8183
8183
  }
8184
8184
  function readSignalOwner(itemId2) {
8185
- const path91 = getOwnerPath(itemId2);
8186
- if (!existsSync25(path91)) return void 0;
8185
+ const path96 = getOwnerPath(itemId2);
8186
+ if (!existsSync25(path96)) return void 0;
8187
8187
  try {
8188
- const parsed = JSON.parse(readFileSync17(path91, "utf8"));
8188
+ const parsed = JSON.parse(readFileSync17(path96, "utf8"));
8189
8189
  return parsed.sessionId;
8190
8190
  } catch {
8191
8191
  return void 0;
8192
8192
  }
8193
8193
  }
8194
8194
  function clearSignalOwner(itemId2) {
8195
- const path91 = getOwnerPath(itemId2);
8195
+ const path96 = getOwnerPath(itemId2);
8196
8196
  try {
8197
- rmSync(path91);
8197
+ rmSync(path96);
8198
8198
  } catch {
8199
8199
  }
8200
8200
  }
@@ -8231,19 +8231,19 @@ function resolveSignalTarget(event, data) {
8231
8231
  function writeSignal(event, data) {
8232
8232
  const target = resolveSignalTarget(event, data);
8233
8233
  if (!target) return;
8234
- const path91 = getSignalPath(target);
8235
- if (!path91) return;
8234
+ const path96 = getSignalPath(target);
8235
+ if (!path96) return;
8236
8236
  const signal = { event, sessionId: target, ...data };
8237
- mkdirSync8(dirname17(path91), { recursive: true });
8238
- writeFileSync18(path91, JSON.stringify(signal));
8237
+ mkdirSync8(dirname17(path96), { recursive: true });
8238
+ writeFileSync18(path96, JSON.stringify(signal));
8239
8239
  }
8240
8240
 
8241
8241
  // src/commands/backlog/readSignal.ts
8242
8242
  function readSignal() {
8243
- const path91 = getSignalPath();
8244
- if (!path91 || !existsSync26(path91)) return void 0;
8243
+ const path96 = getSignalPath();
8244
+ if (!path96 || !existsSync26(path96)) return void 0;
8245
8245
  try {
8246
- return JSON.parse(readFileSync18(path91, "utf8"));
8246
+ return JSON.parse(readFileSync18(path96, "utf8"));
8247
8247
  } catch {
8248
8248
  return void 0;
8249
8249
  }
@@ -8441,13 +8441,13 @@ function activityPath(sessionId) {
8441
8441
  function emitActivity(activity2) {
8442
8442
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8443
8443
  if (!sessionId) return;
8444
- const path91 = activityPath(sessionId);
8445
- mkdirSync9(dirname18(path91), { recursive: true });
8446
- writeFileSync19(path91, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8444
+ const path96 = activityPath(sessionId);
8445
+ mkdirSync9(dirname18(path96), { recursive: true });
8446
+ writeFileSync19(path96, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8447
8447
  }
8448
- function readActivity(path91) {
8448
+ function readActivity(path96) {
8449
8449
  try {
8450
- return JSON.parse(readFileSync19(path91, "utf8"));
8450
+ return JSON.parse(readFileSync19(path96, "utf8"));
8451
8451
  } catch {
8452
8452
  return void 0;
8453
8453
  }
@@ -8457,9 +8457,9 @@ function reconcileActivity(sessionId, activity2) {
8457
8457
  removeActivity(sessionId);
8458
8458
  return;
8459
8459
  }
8460
- const path91 = activityPath(sessionId);
8461
- mkdirSync9(dirname18(path91), { recursive: true });
8462
- writeFileSync19(path91, JSON.stringify(activity2));
8460
+ const path96 = activityPath(sessionId);
8461
+ mkdirSync9(dirname18(path96), { recursive: true });
8462
+ writeFileSync19(path96, JSON.stringify(activity2));
8463
8463
  }
8464
8464
  function removeActivity(sessionId) {
8465
8465
  try {
@@ -9942,10 +9942,10 @@ function getStorePath(filename) {
9942
9942
  return join29(getStoreDir(), filename);
9943
9943
  }
9944
9944
  function loadJson(filename) {
9945
- const path91 = getStorePath(filename);
9946
- if (existsSync31(path91)) {
9945
+ const path96 = getStorePath(filename);
9946
+ if (existsSync31(path96)) {
9947
9947
  try {
9948
- return JSON.parse(readFileSync20(path91, "utf8"));
9948
+ return JSON.parse(readFileSync20(path96, "utf8"));
9949
9949
  } catch {
9950
9950
  return {};
9951
9951
  }
@@ -9964,22 +9964,22 @@ function saveJson(filename, data) {
9964
9964
  var REGISTRY_FILE = "worktrees.json";
9965
9965
  function readWorktreeRegistry() {
9966
9966
  const data = loadJson(REGISTRY_FILE);
9967
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path91, record]) => ({ path: path91, ...record }));
9967
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path96, record]) => ({ path: path96, ...record }));
9968
9968
  }
9969
- function worktreeAttributionIncludingReaped(path91) {
9970
- const record = loadJson(REGISTRY_FILE)[path91];
9969
+ function worktreeAttributionIncludingReaped(path96) {
9970
+ const record = loadJson(REGISTRY_FILE)[path96];
9971
9971
  return record ? { clone: record.clone, origin: record.origin } : void 0;
9972
9972
  }
9973
- function recordWorktree(path91, clone, origin) {
9973
+ function recordWorktree(path96, clone, origin) {
9974
9974
  const data = loadJson(REGISTRY_FILE);
9975
- data[path91] = { clone, origin };
9975
+ data[path96] = { clone, origin };
9976
9976
  saveJson(REGISTRY_FILE, data);
9977
9977
  }
9978
- function forgetWorktree(path91) {
9978
+ function forgetWorktree(path96) {
9979
9979
  const data = loadJson(REGISTRY_FILE);
9980
- const record = data[path91];
9980
+ const record = data[path96];
9981
9981
  if (!record || record.reaped) return;
9982
- data[path91] = { ...record, reaped: true };
9982
+ data[path96] = { ...record, reaped: true };
9983
9983
  saveJson(REGISTRY_FILE, data);
9984
9984
  }
9985
9985
 
@@ -10807,8 +10807,8 @@ async function loadCommittedPaths(cwd, sessionId) {
10807
10807
  for (const commit2 of commits2) {
10808
10808
  const resolved = await resolveCommit(cwd, commit2.sha);
10809
10809
  if (!resolved) continue;
10810
- for (const path91 of resolved.paths) {
10811
- if (!bases.has(path91)) bases.set(path91, resolved.base);
10810
+ for (const path96 of resolved.paths) {
10811
+ if (!bases.has(path96)) bases.set(path96, resolved.base);
10812
10812
  }
10813
10813
  }
10814
10814
  return { commits: commits2, bases };
@@ -10826,16 +10826,16 @@ async function itemChangeSet(cwd, sessionId) {
10826
10826
  }
10827
10827
  function groupByBase(bases) {
10828
10828
  const groups = /* @__PURE__ */ new Map();
10829
- for (const [path91, base] of bases) {
10829
+ for (const [path96, base] of bases) {
10830
10830
  const paths = groups.get(base);
10831
- if (paths) paths.push(path91);
10832
- else groups.set(base, [path91]);
10831
+ if (paths) paths.push(path96);
10832
+ else groups.set(base, [path96]);
10833
10833
  }
10834
10834
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
10835
10835
  }
10836
10836
  async function dirtyPaths(cwd, bases) {
10837
10837
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
10838
- return output.split("\n").filter((path91) => path91 && !bases.has(path91)).sort();
10838
+ return output.split("\n").filter((path96) => path96 && !bases.has(path96)).sort();
10839
10839
  }
10840
10840
 
10841
10841
  // src/commands/sessions/web/scopedDiff.ts
@@ -10844,8 +10844,8 @@ async function scopedDiff(cwd, session, scope) {
10844
10844
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
10845
10845
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
10846
10846
  }
10847
- async function untrackedFileDiff(cwd, path91) {
10848
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path91], {
10847
+ async function untrackedFileDiff(cwd, path96) {
10848
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path96], {
10849
10849
  maxBuffer: MAX_DIFF_BYTES,
10850
10850
  allowFailure: true
10851
10851
  });
@@ -10858,7 +10858,7 @@ async function untrackedDiff(cwd) {
10858
10858
  ]);
10859
10859
  const paths = list5.split("\n").filter(Boolean);
10860
10860
  const diffs = await Promise.all(
10861
- paths.map((path91) => untrackedFileDiff(cwd, path91))
10861
+ paths.map((path96) => untrackedFileDiff(cwd, path96))
10862
10862
  );
10863
10863
  return diffs.join("");
10864
10864
  }
@@ -10951,10 +10951,10 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
10951
10951
  function repoRoot(cwd) {
10952
10952
  return resolve10(toGitCwd(cwd));
10953
10953
  }
10954
- function resolveWithinCwd(cwd, path91) {
10955
- const root = repoRoot(cwd);
10956
- const target = resolve10(root, path91);
10957
- const rel = relative2(root, target);
10954
+ function resolveWithinCwd(cwd, path96) {
10955
+ const root2 = repoRoot(cwd);
10956
+ const target = resolve10(root2, path96);
10957
+ const rel = relative2(root2, target);
10958
10958
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
10959
10959
  return target;
10960
10960
  }
@@ -10963,14 +10963,14 @@ function resolveWithinCwd(cwd, path91) {
10963
10963
  function getFileTarget(req, res) {
10964
10964
  const cwd = getCwdParam(req, res);
10965
10965
  if (!cwd) return null;
10966
- const path91 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
10966
+ const path96 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
10967
10967
  "path"
10968
10968
  );
10969
- if (!path91) {
10969
+ if (!path96) {
10970
10970
  respondJson(res, 400, { error: "Missing path" });
10971
10971
  return null;
10972
10972
  }
10973
- const target = resolveWithinCwd(cwd, path91);
10973
+ const target = resolveWithinCwd(cwd, path96);
10974
10974
  if (!target) {
10975
10975
  respondJson(res, 400, { error: "Path outside cwd" });
10976
10976
  return null;
@@ -11045,11 +11045,11 @@ function globalConfigTargetFor(cwd) {
11045
11045
 
11046
11046
  // src/commands/config/globalConfigFileLabel.ts
11047
11047
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
11048
- function globalConfigFileLabel(path91) {
11049
- if (path91 === getGlobalConfigPath()) return "~/.assist.yml";
11050
- if (path91.startsWith(WINDOWS_MOUNT_PREFIX))
11051
- return `${path91} on the Windows host`;
11052
- return path91;
11048
+ function globalConfigFileLabel(path96) {
11049
+ if (path96 === getGlobalConfigPath()) return "~/.assist.yml";
11050
+ if (path96.startsWith(WINDOWS_MOUNT_PREFIX))
11051
+ return `${path96} on the Windows host`;
11052
+ return path96;
11053
11053
  }
11054
11054
 
11055
11055
  // src/commands/config/readRawConfigLayers.ts
@@ -11106,35 +11106,35 @@ function isPlainRecord(value) {
11106
11106
  }
11107
11107
 
11108
11108
  // src/shared/mapConfigSecrets.ts
11109
- function mapChildren(value, path91, childNode, map) {
11109
+ function mapChildren(value, path96, childNode, map) {
11110
11110
  if (!isPlainRecord(value)) return value;
11111
11111
  return Object.fromEntries(
11112
11112
  Object.entries(value).map(([name, child]) => [
11113
11113
  name,
11114
- walk(child, [...path91, name], childNode(name), map)
11114
+ walk(child, [...path96, name], childNode(name), map)
11115
11115
  ])
11116
11116
  );
11117
11117
  }
11118
- function mapItems(value, path91, item, map) {
11118
+ function mapItems(value, path96, item, map) {
11119
11119
  if (!Array.isArray(value)) return value;
11120
- return value.map((entry, index3) => walk(entry, [...path91, index3], item, map));
11120
+ return value.map((entry, index3) => walk(entry, [...path96, index3], item, map));
11121
11121
  }
11122
- function walk(value, path91, node, map) {
11122
+ function walk(value, path96, node, map) {
11123
11123
  if (!node || value === void 0 || value === null) return value;
11124
- if (node.secret) return map(value, path91);
11124
+ if (node.secret) return map(value, path96);
11125
11125
  switch (node.kind) {
11126
11126
  case "object":
11127
11127
  case "unionOfObjects":
11128
11128
  return mapChildren(
11129
11129
  value,
11130
- path91,
11130
+ path96,
11131
11131
  (name) => configNodeField(node, name),
11132
11132
  map
11133
11133
  );
11134
11134
  case "objectList":
11135
- return mapItems(value, path91, node.item, map);
11135
+ return mapItems(value, path96, node.item, map);
11136
11136
  case "record":
11137
- return mapChildren(value, path91, () => node.value, map);
11137
+ return mapChildren(value, path96, () => node.value, map);
11138
11138
  default:
11139
11139
  return value;
11140
11140
  }
@@ -11159,9 +11159,9 @@ function isTraversable(value) {
11159
11159
  function stepInto(current, key) {
11160
11160
  return isTraversable(current) ? current[key] : void 0;
11161
11161
  }
11162
- function getNestedValue(obj, path91) {
11162
+ function getNestedValue(obj, path96) {
11163
11163
  let current = obj;
11164
- for (const key of path91.split(".")) current = stepInto(current, key);
11164
+ for (const key of path96.split(".")) current = stepInto(current, key);
11165
11165
  return current;
11166
11166
  }
11167
11167
 
@@ -11211,9 +11211,9 @@ function step(node, segment) {
11211
11211
  return void 0;
11212
11212
  }
11213
11213
  }
11214
- function findConfigNode(root, path91) {
11215
- let current = root;
11216
- for (const segment of path91) {
11214
+ function findConfigNode(root2, path96) {
11215
+ let current = root2;
11216
+ for (const segment of path96) {
11217
11217
  if (!current) return void 0;
11218
11218
  current = step(current, segment);
11219
11219
  }
@@ -11230,34 +11230,34 @@ function nameSegment(name) {
11230
11230
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
11231
11231
  }
11232
11232
  function parseConfigPath(text18) {
11233
- const path91 = [];
11233
+ const path96 = [];
11234
11234
  let at2 = 0;
11235
11235
  while (at2 < text18.length) {
11236
11236
  if (text18[at2] === "[") {
11237
11237
  const close = text18.indexOf("]", at2);
11238
11238
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
11239
11239
  if (!segment) return void 0;
11240
- path91.push(segment);
11240
+ path96.push(segment);
11241
11241
  at2 = close + 1;
11242
11242
  continue;
11243
11243
  }
11244
11244
  if (text18[at2] === ".") {
11245
- if (path91.length === 0) return void 0;
11245
+ if (path96.length === 0) return void 0;
11246
11246
  at2 += 1;
11247
11247
  }
11248
11248
  const start3 = at2;
11249
11249
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
11250
11250
  const name = text18.slice(start3, at2);
11251
11251
  if (!name) return void 0;
11252
- path91.push(nameSegment(name));
11252
+ path96.push(nameSegment(name));
11253
11253
  }
11254
- return path91;
11254
+ return path96;
11255
11255
  }
11256
11256
 
11257
11257
  // src/commands/config/configEntryNode.ts
11258
- function configEntryNode(root, key) {
11259
- const path91 = parseConfigPath(key);
11260
- return path91 ? findConfigNode(root, path91) : void 0;
11258
+ function configEntryNode(root2, key) {
11259
+ const path96 = parseConfigPath(key);
11260
+ return path96 ? findConfigNode(root2, path96) : void 0;
11261
11261
  }
11262
11262
 
11263
11263
  // src/commands/config/configHelpForKey.ts
@@ -11392,7 +11392,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
11392
11392
  const parent = dirname22(branchKeyPath);
11393
11393
  const branchPrefix = basename10(branchKeyPath);
11394
11394
  if (!existsSync34(parent)) return null;
11395
- const synthesisFiles = readdirSync3(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join32(parent, name, "synthesis.md")).filter((path91) => existsSync34(path91)).map((path91) => ({ path: path91, mtime: statSync4(path91).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11395
+ const synthesisFiles = readdirSync3(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join32(parent, name, "synthesis.md")).filter((path96) => existsSync34(path96)).map((path96) => ({ path: path96, mtime: statSync4(path96).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11396
11396
  return synthesisFiles[0]?.path ?? null;
11397
11397
  }
11398
11398
 
@@ -11422,12 +11422,12 @@ async function getReviewSynthesis(req, res) {
11422
11422
  const cwd = getCwdParam(req, res);
11423
11423
  if (!cwd) return;
11424
11424
  try {
11425
- const path91 = await resolveSynthesisPath(cwd);
11426
- if (!path91) {
11425
+ const path96 = await resolveSynthesisPath(cwd);
11426
+ if (!path96) {
11427
11427
  respondJson(res, 404, { error: "No synthesis found" });
11428
11428
  return;
11429
11429
  }
11430
- respondJson(res, 200, { synthesis: readFileSync22(path91, "utf8") });
11430
+ respondJson(res, 200, { synthesis: readFileSync22(path96, "utf8") });
11431
11431
  } catch {
11432
11432
  respondJson(res, 404, { error: "No synthesis found" });
11433
11433
  }
@@ -11510,8 +11510,8 @@ function parseDiffNameStatus(output) {
11510
11510
  if (!status3 || fields.length < 2) continue;
11511
11511
  const category = categorize(status3[0]);
11512
11512
  if (!category) continue;
11513
- const path91 = fields[fields.length - 1];
11514
- if (path91) result[category].push(path91);
11513
+ const path96 = fields[fields.length - 1];
11514
+ if (path96) result[category].push(path96);
11515
11515
  }
11516
11516
  return result;
11517
11517
  }
@@ -11647,21 +11647,21 @@ function subsequenceScore(text18, query) {
11647
11647
  }
11648
11648
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
11649
11649
  }
11650
- function scoreFilePath(path91, query) {
11650
+ function scoreFilePath(path96, query) {
11651
11651
  const needle = query.trim().toLowerCase();
11652
11652
  if (!needle) return 0;
11653
- const basename30 = path91.slice(path91.lastIndexOf("/") + 1);
11653
+ const basename30 = path96.slice(path96.lastIndexOf("/") + 1);
11654
11654
  const inBasename = subsequenceScore(basename30, needle);
11655
11655
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
11656
- return subsequenceScore(path91, needle);
11656
+ return subsequenceScore(path96, needle);
11657
11657
  }
11658
11658
 
11659
11659
  // src/commands/sessions/web/rankFilePaths.ts
11660
11660
  function rankFilePaths(paths, query, limit) {
11661
11661
  const scored = [];
11662
- for (const path91 of paths) {
11663
- const score = scoreFilePath(path91, query);
11664
- if (score !== null) scored.push({ path: path91, score });
11662
+ for (const path96 of paths) {
11663
+ const score = scoreFilePath(path96, query);
11664
+ if (score !== null) scored.push({ path: path96, score });
11665
11665
  }
11666
11666
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
11667
11667
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -11882,13 +11882,13 @@ function scopeDirectory(target) {
11882
11882
  // src/commands/rules/readScopedRules.ts
11883
11883
  function scopedClaudeFiles(target) {
11884
11884
  const startDir = scopeDirectory(target);
11885
- const root = findRepoRoot(startDir) ?? startDir;
11885
+ const root2 = findRepoRoot(startDir) ?? startDir;
11886
11886
  const files = [];
11887
11887
  let current = startDir;
11888
11888
  while (true) {
11889
11889
  const candidate = path25.join(current, "CLAUDE.md");
11890
11890
  if (existsSync36(candidate)) files.push(candidate);
11891
- if (current === root || current === path25.dirname(current)) break;
11891
+ if (current === root2 || current === path25.dirname(current)) break;
11892
11892
  current = path25.dirname(current);
11893
11893
  }
11894
11894
  return files;
@@ -11910,8 +11910,8 @@ function listScopedRules(req, res) {
11910
11910
  req.url ?? "/",
11911
11911
  "http://localhost"
11912
11912
  ).searchParams.get("path");
11913
- const root = repoRoot(cwd);
11914
- const target = requested ? resolveWithinCwd(cwd, requested) : root;
11913
+ const root2 = repoRoot(cwd);
11914
+ const target = requested ? resolveWithinCwd(cwd, requested) : root2;
11915
11915
  if (!target) {
11916
11916
  respondJson(res, 400, { error: "Path outside cwd" });
11917
11917
  return;
@@ -11920,7 +11920,7 @@ function listScopedRules(req, res) {
11920
11920
  respondJson(res, 200, {
11921
11921
  rules: readScopedRules(target).map((rule) => ({
11922
11922
  ...rule,
11923
- source: path26.relative(root, rule.source) || rule.source
11923
+ source: path26.relative(root2, rule.source) || rule.source
11924
11924
  }))
11925
11925
  });
11926
11926
  } catch {
@@ -12611,8 +12611,8 @@ async function liveDeployments(cwd, repo, environments) {
12611
12611
 
12612
12612
  // src/commands/sessions/web/releases/latestRun.ts
12613
12613
  async function latestRun(cwd, repo, workflow) {
12614
- const path91 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
12615
- const response = await ghJson(cwd, ["api", path91]);
12614
+ const path96 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
12615
+ const response = await ghJson(cwd, ["api", path96]);
12616
12616
  const run4 = response.workflow_runs?.[0];
12617
12617
  if (!run4) return null;
12618
12618
  return {
@@ -12675,18 +12675,18 @@ function mostSpecificFirst(nodes) {
12675
12675
  (a, b) => (b.tokens[0]?.length ?? 0) - (a.tokens[0]?.length ?? 0) || a.index - b.index
12676
12676
  );
12677
12677
  }
12678
- function firstUnclaimed(names, claimed, tokens) {
12678
+ function firstUnclaimed(names2, claimed, tokens) {
12679
12679
  for (const token of tokens)
12680
- for (const [index3, name] of names.entries())
12680
+ for (const [index3, name] of names2.entries())
12681
12681
  if (!claimed.has(index3) && name.includes(token)) return index3;
12682
12682
  return void 0;
12683
12683
  }
12684
12684
  function matchRunJobs(nodes, jobs) {
12685
- const names = jobs.map((job) => normaliseJobName(job.name));
12685
+ const names2 = jobs.map((job) => normaliseJobName(job.name));
12686
12686
  const claimed = /* @__PURE__ */ new Set();
12687
12687
  const matched = /* @__PURE__ */ new Map();
12688
12688
  for (const { node, tokens } of mostSpecificFirst(nodes)) {
12689
- const hit = firstUnclaimed(names, claimed, tokens);
12689
+ const hit = firstUnclaimed(names2, claimed, tokens);
12690
12690
  const job = hit === void 0 ? void 0 : jobs[hit];
12691
12691
  if (hit !== void 0) claimed.add(hit);
12692
12692
  matched.set(node.id, job ? runJobState(job) : UNREACHED_BY_RUN);
@@ -12888,38 +12888,38 @@ async function restartWeb(req, res, deps2 = {}) {
12888
12888
  import { relative as relative3 } from "path";
12889
12889
 
12890
12890
  // src/commands/sessions/web/revertPathChanges.ts
12891
- async function isTracked(cwd, path91) {
12891
+ async function isTracked(cwd, path96) {
12892
12892
  try {
12893
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path91]);
12893
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path96]);
12894
12894
  return true;
12895
12895
  } catch {
12896
12896
  return false;
12897
12897
  }
12898
12898
  }
12899
- async function isInHead(cwd, path91) {
12900
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path91]);
12899
+ async function isInHead(cwd, path96) {
12900
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path96]);
12901
12901
  return listing.trim().length > 0;
12902
12902
  }
12903
- async function revertPathChanges(cwd, path91) {
12904
- if (!await isTracked(cwd, path91)) {
12905
- await execGit(cwd, ["clean", "-f", "--", path91]);
12903
+ async function revertPathChanges(cwd, path96) {
12904
+ if (!await isTracked(cwd, path96)) {
12905
+ await execGit(cwd, ["clean", "-f", "--", path96]);
12906
12906
  return;
12907
12907
  }
12908
- if (await isInHead(cwd, path91)) {
12909
- await execGit(cwd, ["checkout", "HEAD", "--", path91]);
12908
+ if (await isInHead(cwd, path96)) {
12909
+ await execGit(cwd, ["checkout", "HEAD", "--", path96]);
12910
12910
  return;
12911
12911
  }
12912
- await execGit(cwd, ["rm", "-f", "--", path91]);
12912
+ await execGit(cwd, ["rm", "-f", "--", path96]);
12913
12913
  }
12914
12914
 
12915
12915
  // src/commands/sessions/web/revertDiffFile.ts
12916
12916
  async function revertDiffFile(req, res) {
12917
12917
  const resolved = getFileTarget(req, res);
12918
12918
  if (!resolved) return;
12919
- const path91 = relative3(repoRoot(resolved.cwd), resolved.target);
12919
+ const path96 = relative3(repoRoot(resolved.cwd), resolved.target);
12920
12920
  try {
12921
- await revertPathChanges(resolved.cwd, path91);
12922
- respondJson(res, 200, { reverted: path91 });
12921
+ await revertPathChanges(resolved.cwd, path96);
12922
+ respondJson(res, 200, { reverted: path96 });
12923
12923
  } catch (error) {
12924
12924
  respondJson(res, 500, {
12925
12925
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -12941,7 +12941,7 @@ async function readJsonBody(req) {
12941
12941
  function requestedPaths(body) {
12942
12942
  const paths = body.paths;
12943
12943
  if (!Array.isArray(paths)) return null;
12944
- if (paths.some((path91) => typeof path91 !== "string")) return null;
12944
+ if (paths.some((path96) => typeof path96 !== "string")) return null;
12945
12945
  return paths;
12946
12946
  }
12947
12947
  async function revertDiffPaths(req, res) {
@@ -12958,16 +12958,16 @@ async function revertDiffPaths(req, res) {
12958
12958
  respondJson(res, 400, { error: "Missing paths" });
12959
12959
  return;
12960
12960
  }
12961
- const root = repoRoot(cwd);
12961
+ const root2 = repoRoot(cwd);
12962
12962
  const reverted = [];
12963
12963
  const failed2 = [];
12964
- for (const path91 of paths) {
12965
- const target = resolveWithinCwd(cwd, path91);
12964
+ for (const path96 of paths) {
12965
+ const target = resolveWithinCwd(cwd, path96);
12966
12966
  if (!target) {
12967
- failed2.push({ path: path91, error: "Path outside cwd" });
12967
+ failed2.push({ path: path96, error: "Path outside cwd" });
12968
12968
  continue;
12969
12969
  }
12970
- const relativePath = relative4(root, target);
12970
+ const relativePath = relative4(root2, target);
12971
12971
  try {
12972
12972
  await revertPathChanges(cwd, relativePath);
12973
12973
  reverted.push(relativePath);
@@ -13054,11 +13054,11 @@ function coerceStructuredConfigValue(key, raw) {
13054
13054
  };
13055
13055
  }
13056
13056
  function formatIssue(key, issue) {
13057
- const path91 = formatConfigPath([
13057
+ const path96 = formatConfigPath([
13058
13058
  { kind: "key", name: key },
13059
13059
  ...issue.path.map(toSegment)
13060
13060
  ]);
13061
- return `${path91}: ${issue.message}`;
13061
+ return `${path96}: ${issue.message}`;
13062
13062
  }
13063
13063
  function toSegment(part) {
13064
13064
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -13153,9 +13153,9 @@ function coerceUnion(key, raw, types) {
13153
13153
  }
13154
13154
 
13155
13155
  // src/shared/valueAtConfigPath.ts
13156
- function valueAtConfigPath(value, path91) {
13156
+ function valueAtConfigPath(value, path96) {
13157
13157
  let current = value;
13158
- for (const key of path91) {
13158
+ for (const key of path96) {
13159
13159
  if (typeof key === "number") {
13160
13160
  if (!Array.isArray(current)) return void 0;
13161
13161
  current = current[key];
@@ -13172,7 +13172,7 @@ function restoreConfigSecrets(value, stored, node) {
13172
13172
  return mapConfigSecrets(
13173
13173
  value,
13174
13174
  node,
13175
- (secret, path91) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path91) : secret
13175
+ (secret, path96) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path96) : secret
13176
13176
  );
13177
13177
  }
13178
13178
 
@@ -13221,8 +13221,8 @@ function stepIntoNested(container, key, nextKey) {
13221
13221
  }
13222
13222
  return ensureObject(container, resolved);
13223
13223
  }
13224
- function setNestedValue(obj, path91, value) {
13225
- const keys = path91.split(".");
13224
+ function setNestedValue(obj, path96, value) {
13225
+ const keys = path96.split(".");
13226
13226
  const result = { ...obj };
13227
13227
  let current = result;
13228
13228
  for (let i = 0; i < keys.length - 1; i++) {
@@ -13249,8 +13249,8 @@ function formatIssue2(issue, key) {
13249
13249
  return issue.keys.map(
13250
13250
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
13251
13251
  );
13252
- const path91 = issue.path.length > 0 ? issue.path.join(".") : key;
13253
- return [`${path91}: ${issue.message}`];
13252
+ const path96 = issue.path.length > 0 ? issue.path.join(".") : key;
13253
+ return [`${path96}: ${issue.message}`];
13254
13254
  }
13255
13255
 
13256
13256
  // src/commands/config/applyConfigSet.ts
@@ -13507,8 +13507,8 @@ function removeAt(container, keys) {
13507
13507
  }
13508
13508
  return removeFromChild(container, key, rest);
13509
13509
  }
13510
- function unsetNestedValue(obj, path91) {
13511
- const { container, removed } = removeAt(obj, path91.split("."));
13510
+ function unsetNestedValue(obj, path96) {
13511
+ const { container, removed } = removeAt(obj, path96.split("."));
13512
13512
  return { config: container, removed };
13513
13513
  }
13514
13514
 
@@ -13762,8 +13762,8 @@ import { dirname as dirname23, join as join35 } from "path";
13762
13762
  import { promisify as promisify10 } from "util";
13763
13763
  var execFileAsync9 = promisify10(execFile10);
13764
13764
  var TIMEOUT_MS = 15e3;
13765
- function findOxfmtScript(root) {
13766
- let dir = root;
13765
+ function findOxfmtScript(root2) {
13766
+ let dir = root2;
13767
13767
  for (; ; ) {
13768
13768
  const candidate = join35(dir, "node_modules", "oxfmt", "bin", "oxfmt");
13769
13769
  if (existsSync37(candidate)) return candidate;
@@ -13772,11 +13772,11 @@ function findOxfmtScript(root) {
13772
13772
  dir = parent;
13773
13773
  }
13774
13774
  }
13775
- async function formatWithOxfmt(target, root) {
13776
- const script = findOxfmtScript(root);
13775
+ async function formatWithOxfmt(target, root2) {
13776
+ const script = findOxfmtScript(root2);
13777
13777
  if (!script) return;
13778
13778
  await execFileAsync9(process.execPath, [script, target], {
13779
- cwd: root,
13779
+ cwd: root2,
13780
13780
  windowsHide: true,
13781
13781
  timeout: TIMEOUT_MS
13782
13782
  }).catch(() => {
@@ -14119,13 +14119,13 @@ function renderRestartMenu(items2, selected) {
14119
14119
  function createMenuState(items2, log2) {
14120
14120
  let open = false;
14121
14121
  let selected = firstEnabledIndex(items2);
14122
- const render = () => log2(renderRestartMenu(items2, selected));
14122
+ const render2 = () => log2(renderRestartMenu(items2, selected));
14123
14123
  return {
14124
14124
  isOpen: () => open,
14125
14125
  open() {
14126
14126
  open = true;
14127
14127
  selected = firstEnabledIndex(items2);
14128
- render();
14128
+ render2();
14129
14129
  },
14130
14130
  close() {
14131
14131
  if (!open) return;
@@ -14134,14 +14134,14 @@ function createMenuState(items2, log2) {
14134
14134
  },
14135
14135
  move(direction) {
14136
14136
  selected = nextIndex(items2, selected, direction);
14137
- render();
14137
+ render2();
14138
14138
  },
14139
14139
  selectedItem: () => items2[selected],
14140
14140
  jumpTo(index3) {
14141
14141
  const item = items2[index3];
14142
14142
  if (!item) return false;
14143
14143
  selected = index3;
14144
- render();
14144
+ render2();
14145
14145
  return !item.disabled;
14146
14146
  }
14147
14147
  };
@@ -14670,9 +14670,9 @@ function originToSshUrl(origin) {
14670
14670
  const firstSlash = origin.indexOf("/");
14671
14671
  if (firstSlash <= 0) return null;
14672
14672
  const host = origin.slice(0, firstSlash);
14673
- const path91 = origin.slice(firstSlash + 1);
14674
- if (!path91) return null;
14675
- return `git@${host}:${path91}.git`;
14673
+ const path96 = origin.slice(firstSlash + 1);
14674
+ if (!path96) return null;
14675
+ return `git@${host}:${path96}.git`;
14676
14676
  }
14677
14677
 
14678
14678
  // src/commands/backlog/cloneRepo.ts
@@ -14809,7 +14809,7 @@ function requestPreviewDecision(request) {
14809
14809
  return new Promise((resolve25, reject) => {
14810
14810
  connectToDaemon().then((socket) => {
14811
14811
  let settled = false;
14812
- const finish = (error, decision) => {
14812
+ const finish2 = (error, decision) => {
14813
14813
  if (settled) return;
14814
14814
  settled = true;
14815
14815
  socket.destroy();
@@ -14819,13 +14819,13 @@ function requestPreviewDecision(request) {
14819
14819
  readSocketLines(socket, (line) => {
14820
14820
  const incoming = parsePreviewDecision(line, request.requestId);
14821
14821
  if (!incoming) return;
14822
- if (incoming.kind === "error") finish(new Error(incoming.message));
14823
- else finish(void 0, incoming.decision);
14822
+ if (incoming.kind === "error") finish2(new Error(incoming.message));
14823
+ else finish2(void 0, incoming.decision);
14824
14824
  });
14825
- socket.on("error", (error) => finish(error));
14825
+ socket.on("error", (error) => finish2(error));
14826
14826
  socket.on(
14827
14827
  "close",
14828
- () => finish(new Error("daemon closed before a decision was made"))
14828
+ () => finish2(new Error("daemon closed before a decision was made"))
14829
14829
  );
14830
14830
  socket.write(`${JSON.stringify({ type: "pr-preview", ...request })}
14831
14831
  `);
@@ -17405,9 +17405,9 @@ var UNPARSEABLE = { ok: false, error: "unable to parse" };
17405
17405
  function groupByOperator(tokens) {
17406
17406
  const groups = [[]];
17407
17407
  for (let i = 0; i < tokens.length; i++) {
17408
- const step2 = handleToken(tokens, i, groups);
17409
- if (!step2.ok) return step2;
17410
- i = step2.nextIndex;
17408
+ const step3 = handleToken(tokens, i, groups);
17409
+ if (!step3.ok) return step3;
17410
+ i = step3.nextIndex;
17411
17411
  }
17412
17412
  return { ok: true, groups };
17413
17413
  }
@@ -17735,13 +17735,13 @@ function findBuiltinDenyRaw(rawCommand) {
17735
17735
 
17736
17736
  // src/commands/cliHook/findRestrictedPathDeny.ts
17737
17737
  var RESTRICTED_PATHS = [".assist/restricted"];
17738
- function restrictedPathRegex(path91) {
17739
- const pattern2 = path91.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17738
+ function restrictedPathRegex(path96) {
17739
+ const pattern2 = path96.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17740
17740
  return new RegExp(pattern2);
17741
17741
  }
17742
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path91) => ({
17743
- path: path91,
17744
- regex: restrictedPathRegex(path91)
17742
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path96) => ({
17743
+ path: path96,
17744
+ regex: restrictedPathRegex(path96)
17745
17745
  }));
17746
17746
  function findRestrictedPathDenyRaw(rawCommand) {
17747
17747
  const rule = RESTRICTED_PATH_RULES.find(
@@ -17918,9 +17918,9 @@ var __dirname4 = dirname24(__filename3);
17918
17918
  function packageRoot() {
17919
17919
  return __dirname4;
17920
17920
  }
17921
- function readLines(path91) {
17922
- if (!existsSync40(path91)) return [];
17923
- return readFileSync27(path91, "utf8").split("\n").filter((line) => line.trim() !== "");
17921
+ function readLines(path96) {
17922
+ if (!existsSync40(path96)) return [];
17923
+ return readFileSync27(path96, "utf8").split("\n").filter((line) => line.trim() !== "");
17924
17924
  }
17925
17925
  var cachedReads;
17926
17926
  var cachedWrites;
@@ -18445,14 +18445,14 @@ function showProgress(p, label2) {
18445
18445
  const pct = Math.round(p.done / p.total * 100);
18446
18446
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
18447
18447
  }
18448
- async function resolveCommand(cli, path91, description, depth, p) {
18449
- showProgress(p, path91.join(" "));
18450
- const subHelp = await runHelp([cli, ...path91]);
18448
+ async function resolveCommand(cli, path96, description, depth, p) {
18449
+ showProgress(p, path96.join(" "));
18450
+ const subHelp = await runHelp([cli, ...path96]);
18451
18451
  if (!subHelp || !hasSubcommands(subHelp)) {
18452
- return [{ path: path91, description }];
18452
+ return [{ path: path96, description }];
18453
18453
  }
18454
- const children = await discoverAt(cli, path91, depth + 1, p);
18455
- return children.length > 0 ? children : [{ path: path91, description }];
18454
+ const children = await discoverAt(cli, path96, depth + 1, p);
18455
+ return children.length > 0 ? children : [{ path: path96, description }];
18456
18456
  }
18457
18457
  async function discoverAt(cli, parentPath, depth, p) {
18458
18458
  if (depth > SAFETY_DEPTH) return [];
@@ -18555,12 +18555,12 @@ function prefix(kind) {
18555
18555
  return " ? ";
18556
18556
  }
18557
18557
  function formatHuman(cli, commands) {
18558
- const sorted = [...commands].sort(
18558
+ const sorted2 = [...commands].sort(
18559
18559
  (a, b) => a.path.join(" ").localeCompare(b.path.join(" "))
18560
18560
  );
18561
18561
  const lines2 = [`Discovered ${commands.length} commands for "${cli}":
18562
18562
  `];
18563
- for (const cmd of sorted) {
18563
+ for (const cmd of sorted2) {
18564
18564
  const full = `${cli} ${cmd.path.join(" ")}`;
18565
18565
  const text18 = cmd.description ? `${full} \u2014 ${cmd.description}` : full;
18566
18566
  lines2.push(`${prefix(classifyVerb(cmd.path))}${text18}`);
@@ -18600,9 +18600,9 @@ function logPath(cli) {
18600
18600
  return join42(homedir17(), ".assist", `cli-discover-${safeName}.log`);
18601
18601
  }
18602
18602
  function readCache(cli) {
18603
- const path91 = logPath(cli);
18604
- if (!existsSync42(path91)) return void 0;
18605
- return readFileSync29(path91, "utf8");
18603
+ const path96 = logPath(cli);
18604
+ if (!existsSync42(path96)) return void 0;
18605
+ return readFileSync29(path96, "utf8");
18606
18606
  }
18607
18607
  function writeCache(cli, output) {
18608
18608
  const dir = join42(homedir17(), ".assist");
@@ -18762,9 +18762,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18762
18762
  }
18763
18763
  const cutoff = Date.now() - STALE_AFTER_MS;
18764
18764
  for (const entry of entries) {
18765
- const path91 = join44(dir, entry);
18765
+ const path96 = join44(dir, entry);
18766
18766
  try {
18767
- if (statSync7(path91).mtimeMs < cutoff) unlinkSync7(path91);
18767
+ if (statSync7(path96).mtimeMs < cutoff) unlinkSync7(path96);
18768
18768
  } catch {
18769
18769
  continue;
18770
18770
  }
@@ -18774,10 +18774,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18774
18774
  // src/commands/codeComment/readPinState.ts
18775
18775
  import { existsSync as existsSync43, readFileSync as readFileSync30 } from "fs";
18776
18776
  function readPinState(pin) {
18777
- const path91 = getPinStatePath(pin);
18778
- if (!existsSync43(path91)) return void 0;
18777
+ const path96 = getPinStatePath(pin);
18778
+ if (!existsSync43(path96)) return void 0;
18779
18779
  try {
18780
- const state = JSON.parse(readFileSync30(path91, "utf8"));
18780
+ const state = JSON.parse(readFileSync30(path96, "utf8"));
18781
18781
  if (state.pin !== pin) return void 0;
18782
18782
  return state;
18783
18783
  } catch {
@@ -19198,8 +19198,8 @@ function findUnmergedPaths() {
19198
19198
  }
19199
19199
  const found = /* @__PURE__ */ new Set();
19200
19200
  for (const line of output.split("\n")) {
19201
- const path91 = line.split(" ")[1];
19202
- if (path91) found.add(path91.trim());
19201
+ const path96 = line.split(" ")[1];
19202
+ if (path96) found.add(path96.trim());
19203
19203
  }
19204
19204
  return [...found];
19205
19205
  }
@@ -19929,10 +19929,10 @@ import path33 from "path";
19929
19929
  function git3(command) {
19930
19930
  return execSync35(command, { encoding: "utf8" });
19931
19931
  }
19932
- function toAbsolute(root, repoRelative) {
19933
- return path33.resolve(root, repoRelative);
19932
+ function toAbsolute(root2, repoRelative) {
19933
+ return path33.resolve(root2, repoRelative);
19934
19934
  }
19935
- function collectShrunkFiles(root) {
19935
+ function collectShrunkFiles(root2) {
19936
19936
  const shrunk = /* @__PURE__ */ new Set();
19937
19937
  const numstat = git3("git diff --numstat HEAD").trim();
19938
19938
  if (numstat === "") return shrunk;
@@ -19942,7 +19942,7 @@ function collectShrunkFiles(root) {
19942
19942
  const added = Number.parseInt(addedRaw, 10);
19943
19943
  const removed = Number.parseInt(removedRaw, 10);
19944
19944
  if (Number.isNaN(added) || Number.isNaN(removed)) continue;
19945
- if (removed > added) shrunk.add(toAbsolute(root, file));
19945
+ if (removed > added) shrunk.add(toAbsolute(root2, file));
19946
19946
  }
19947
19947
  return shrunk;
19948
19948
  }
@@ -19959,9 +19959,9 @@ function hasNewSourceFile() {
19959
19959
  }
19960
19960
  function getMaintainabilityGitState() {
19961
19961
  try {
19962
- const root = git3("git rev-parse --show-toplevel").trim();
19962
+ const root2 = git3("git rev-parse --show-toplevel").trim();
19963
19963
  return {
19964
- shrunkFiles: collectShrunkFiles(root),
19964
+ shrunkFiles: collectShrunkFiles(root2),
19965
19965
  newFileCreated: hasNewSourceFile()
19966
19966
  };
19967
19967
  } catch {
@@ -20424,11 +20424,11 @@ async function loadPath(source) {
20424
20424
  }
20425
20425
  }
20426
20426
  async function criteriaExtension() {
20427
- const path91 = await loadPath(criteriaExtensionDir());
20427
+ const path96 = await loadPath(criteriaExtensionDir());
20428
20428
  console.log(
20429
20429
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
20430
20430
  );
20431
- console.log(chalk137.dim(`load the unpacked extension from ${path91}`));
20431
+ console.log(chalk137.dim(`load the unpacked extension from ${path96}`));
20432
20432
  }
20433
20433
 
20434
20434
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -20553,10 +20553,10 @@ async function signCriteriaExtension() {
20553
20553
  process.exitCode = 1;
20554
20554
  return;
20555
20555
  }
20556
- const path91 = await signedAddonInstallPath(
20556
+ const path96 = await signedAddonInstallPath(
20557
20557
  await copySignedXpi(xpi, ARTIFACTS_DIR)
20558
20558
  );
20559
- console.log(chalk139.dim(`install the signed add-on from ${path91}`));
20559
+ console.log(chalk139.dim(`install the signed add-on from ${path96}`));
20560
20560
  }
20561
20561
 
20562
20562
  // src/commands/registerCriteriaExtension.ts
@@ -20654,10 +20654,10 @@ function getMigrationApprovalPath(migrationId) {
20654
20654
  // src/commands/dbMigration/readMigrationPinState.ts
20655
20655
  import { existsSync as existsSync48, readFileSync as readFileSync32 } from "fs";
20656
20656
  function readMigrationPinState(pin) {
20657
- const path91 = getMigrationPinPath(pin);
20658
- if (!existsSync48(path91)) return void 0;
20657
+ const path96 = getMigrationPinPath(pin);
20658
+ if (!existsSync48(path96)) return void 0;
20659
20659
  try {
20660
- const state = JSON.parse(readFileSync32(path91, "utf8"));
20660
+ const state = JSON.parse(readFileSync32(path96, "utf8"));
20661
20661
  if (state.pin !== pin) return void 0;
20662
20662
  if (!Number.isInteger(state.migrationId)) return void 0;
20663
20663
  return state;
@@ -22087,10 +22087,10 @@ function decideCommentGuard(input, existingContent) {
22087
22087
  import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
22088
22088
  function consumeMigrationApproval(migrationId) {
22089
22089
  sweepRestrictedDir();
22090
- const path91 = getMigrationApprovalPath(migrationId);
22091
- if (!existsSync54(path91)) return false;
22090
+ const path96 = getMigrationApprovalPath(migrationId);
22091
+ if (!existsSync54(path96)) return false;
22092
22092
  try {
22093
- unlinkSync11(path91);
22093
+ unlinkSync11(path96);
22094
22094
  return true;
22095
22095
  } catch {
22096
22096
  return false;
@@ -22640,7 +22640,7 @@ function orderDepthFirst(issues) {
22640
22640
  ordered.push(issue);
22641
22641
  for (const child of byParent.get(issue.id) ?? []) visit(child);
22642
22642
  };
22643
- for (const root of byParent.get(null) ?? []) visit(root);
22643
+ for (const root2 of byParent.get(null) ?? []) visit(root2);
22644
22644
  return ordered;
22645
22645
  }
22646
22646
 
@@ -22692,9 +22692,9 @@ function fetchSubtreeIssues(ids) {
22692
22692
  }
22693
22693
 
22694
22694
  // src/commands/github/issue/fixStructure/walkSubtree.ts
22695
- function walkSubtree(root, maxDepth, fetchIssues = fetchSubtreeIssues) {
22696
- const placed = [{ ...root, depth: 0, parentId: null }];
22697
- const seen = /* @__PURE__ */ new Set([root.id]);
22695
+ function walkSubtree(root2, maxDepth, fetchIssues = fetchSubtreeIssues) {
22696
+ const placed = [{ ...root2, depth: 0, parentId: null }];
22697
+ const seen = /* @__PURE__ */ new Set([root2.id]);
22698
22698
  let frontier = placed;
22699
22699
  for (let depth = 1; depth <= maxDepth && frontier.length > 0; depth += 1) {
22700
22700
  const parentOf2 = /* @__PURE__ */ new Map();
@@ -22718,9 +22718,9 @@ function walkSubtree(root, maxDepth, fetchIssues = fetchSubtreeIssues) {
22718
22718
  }
22719
22719
 
22720
22720
  // src/commands/github/issue/fixStructure/planSubtree.ts
22721
- function planSubtree(root, context) {
22721
+ function planSubtree(root2, context) {
22722
22722
  const depth = context.chain.length - context.rootLevelIndex;
22723
- return buildFixStructurePlan(walkSubtree(root, depth), context);
22723
+ return buildFixStructurePlan(walkSubtree(root2, depth), context);
22724
22724
  }
22725
22725
 
22726
22726
  // src/commands/github/issue/fixStructure/applyAndVerifySubtree.ts
@@ -22906,10 +22906,10 @@ function fixStructure(target, options2) {
22906
22906
  const resolved = resolveFixStructureTarget(target, options2.repo);
22907
22907
  const issueTypes = resolveOrgIssueTypes(resolved.owner);
22908
22908
  assertChainTypesExist(chain2, issueTypes);
22909
- const root = fetchRootIssue(resolved);
22909
+ const root2 = fetchRootIssue(resolved);
22910
22910
  const { index: index3, asserted } = resolveRootLevelIndex(
22911
22911
  chain2,
22912
- root.typeName,
22912
+ root2.typeName,
22913
22913
  options2.level
22914
22914
  );
22915
22915
  const context = {
@@ -22919,7 +22919,7 @@ function fixStructure(target, options2) {
22919
22919
  issueTypes,
22920
22920
  stripLabels: options2.stripLabel ?? []
22921
22921
  };
22922
- const plan2 = planSubtree(root, context);
22922
+ const plan2 = planSubtree(root2, context);
22923
22923
  printFixStructurePlan(plan2, chain2, options2.apply === true);
22924
22924
  assertNothingTooDeep(plan2.tooDeep, chain2);
22925
22925
  if (options2.apply) applyAndVerifySubtree(resolved, plan2, context);
@@ -23151,23 +23151,23 @@ function setProjectItemStatus(input) {
23151
23151
 
23152
23152
  // src/commands/github/issue/applyCreatedIssueMetadata.ts
23153
23153
  function applyCreatedIssueMetadata(createOutput, metadata2) {
23154
- let step2 = "identifying the created issue";
23154
+ let step3 = "identifying the created issue";
23155
23155
  try {
23156
23156
  const issueId = fetchIssueNodeId(parseCreatedIssueUrl(createOutput));
23157
23157
  const { issueType, parent, project } = metadata2;
23158
23158
  if (issueType) {
23159
- step2 = `setting its issue type to ${issueType.name}`;
23159
+ step3 = `setting its issue type to ${issueType.name}`;
23160
23160
  updateIssueType(issueId, issueType.id);
23161
23161
  }
23162
23162
  if (parent) {
23163
- step2 = `adding it as a sub-issue of ${parent.owner}/${parent.repo}#${parent.number}`;
23163
+ step3 = `adding it as a sub-issue of ${parent.owner}/${parent.repo}#${parent.number}`;
23164
23164
  addSubIssue(parent.id, issueId);
23165
23165
  }
23166
23166
  if (project) {
23167
- step2 = `adding it to project ${project.number} (${project.title})`;
23167
+ step3 = `adding it to project ${project.number} (${project.title})`;
23168
23168
  const itemId2 = addIssueToProject(project.id, issueId);
23169
23169
  if (project.status) {
23170
- step2 = `setting its status to ${project.status.optionName}`;
23170
+ step3 = `setting its status to ${project.status.optionName}`;
23171
23171
  setProjectItemStatus({
23172
23172
  projectId: project.id,
23173
23173
  itemId: itemId2,
@@ -23179,7 +23179,7 @@ function applyCreatedIssueMetadata(createOutput, metadata2) {
23179
23179
  } catch (error) {
23180
23180
  const message3 = error instanceof Error ? error.message : String(error);
23181
23181
  console.error(
23182
- `The issue was created at ${createOutput.trim()}, but ${step2} failed: ${message3}`
23182
+ `The issue was created at ${createOutput.trim()}, but ${step3} failed: ${message3}`
23183
23183
  );
23184
23184
  process.exit(1);
23185
23185
  }
@@ -23231,7 +23231,7 @@ var QUERY5 = `query($owner: String!, $repo: String!, $after: String) {
23231
23231
  }
23232
23232
  }`;
23233
23233
  function readRepoLabels(target) {
23234
- const names = [];
23234
+ const names2 = [];
23235
23235
  let after;
23236
23236
  do {
23237
23237
  const page = JSON.parse(
@@ -23242,22 +23242,22 @@ function readRepoLabels(target) {
23242
23242
  `No labels could be read for ${target.owner}/${target.repo}`
23243
23243
  );
23244
23244
  }
23245
- for (const node of page.nodes ?? []) if (node?.name) names.push(node.name);
23245
+ for (const node of page.nodes ?? []) if (node?.name) names2.push(node.name);
23246
23246
  after = page.pageInfo?.hasNextPage ? page.pageInfo.endCursor ?? void 0 : void 0;
23247
23247
  } while (after);
23248
- return names;
23248
+ return names2;
23249
23249
  }
23250
- function matchLabel(names, wanted) {
23250
+ function matchLabel(names2, wanted) {
23251
23251
  const normalised = normaliseTypeName(wanted);
23252
- return names.find((name) => name === wanted) ?? names.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names.find((name) => normaliseTypeName(name) === normalised);
23252
+ return names2.find((name) => name === wanted) ?? names2.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names2.find((name) => normaliseTypeName(name) === normalised);
23253
23253
  }
23254
23254
  function resolveIssueLabels(target, wanted) {
23255
- const names = readRepoLabels(target);
23255
+ const names2 = readRepoLabels(target);
23256
23256
  return wanted.map((label2) => {
23257
- const match = matchLabel(names, label2);
23257
+ const match = matchLabel(names2, label2);
23258
23258
  if (!match) {
23259
23259
  throw new Error(
23260
- `${target.owner}/${target.repo} has no ${label2} label. It has ${names.join(", ")}`
23260
+ `${target.owner}/${target.repo} has no ${label2} label. It has ${names2.join(", ")}`
23261
23261
  );
23262
23262
  }
23263
23263
  return match;
@@ -23391,9 +23391,9 @@ function assertProjectScope() {
23391
23391
  }
23392
23392
 
23393
23393
  // src/commands/github/issue/projectV2Query.ts
23394
- function projectV2Query(root) {
23394
+ function projectV2Query(root2) {
23395
23395
  return `query($owner: String!, $number: Int!) {
23396
- ${root}(login: $owner) {
23396
+ ${root2}(login: $owner) {
23397
23397
  projectV2(number: $number) {
23398
23398
  id
23399
23399
  title
@@ -23406,18 +23406,18 @@ function projectV2Query(root) {
23406
23406
  }
23407
23407
 
23408
23408
  // src/commands/github/issue/readProject.ts
23409
- function readProject(owner, number, root) {
23409
+ function readProject(owner, number, root2) {
23410
23410
  let raw;
23411
23411
  try {
23412
- raw = runGhGraphqlJson(projectV2Query(root), { owner, number });
23412
+ raw = runGhGraphqlJson(projectV2Query(root2), { owner, number });
23413
23413
  } catch (error) {
23414
23414
  const message3 = error instanceof Error ? error.message : String(error);
23415
- if (root === "organization" && message3.includes("Could not resolve to an")) {
23415
+ if (root2 === "organization" && message3.includes("Could not resolve to an")) {
23416
23416
  return void 0;
23417
23417
  }
23418
23418
  throw error;
23419
23419
  }
23420
- const project = JSON.parse(raw).data?.[root]?.projectV2;
23420
+ const project = JSON.parse(raw).data?.[root2]?.projectV2;
23421
23421
  if (!project?.id) return void 0;
23422
23422
  const field = project.field;
23423
23423
  return {
@@ -23970,9 +23970,9 @@ function moveItem(item) {
23970
23970
  (candidate) => candidate.name.toLowerCase() === IN_PROGRESS
23971
23971
  );
23972
23972
  if (!option) {
23973
- const names = statusField.options.map((candidate) => candidate.name);
23973
+ const names2 = statusField.options.map((candidate) => candidate.name);
23974
23974
  console.log(
23975
- `The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names.join(", ") || "no options"}`
23975
+ `The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names2.join(", ") || "no options"}`
23976
23976
  );
23977
23977
  return;
23978
23978
  }
@@ -24494,11 +24494,11 @@ function recentDaemonLogLines() {
24494
24494
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
24495
24495
  import { realpathSync as realpathSync2 } from "fs";
24496
24496
  import { resolve as resolve14 } from "path";
24497
- function canonicalTreePath(path91) {
24497
+ function canonicalTreePath(path96) {
24498
24498
  try {
24499
- return realpathSync2(path91);
24499
+ return realpathSync2(path96);
24500
24500
  } catch {
24501
- return resolve14(path91);
24501
+ return resolve14(path96);
24502
24502
  }
24503
24503
  }
24504
24504
 
@@ -24551,22 +24551,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
24551
24551
  const registered = new Set(listWorktreePaths(clone));
24552
24552
  const branches = new Set(listLocalBranches(clone));
24553
24553
  const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename18(candidate));
24554
- const path91 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24554
+ const path96 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24555
24555
  const start3 = worktreeStartPoint(clone, strategy.trunk);
24556
24556
  gitSync(clone, [
24557
24557
  "worktree",
24558
24558
  "add",
24559
24559
  start3.track ? "--track" : "--no-track",
24560
24560
  "-b",
24561
- basename18(path91),
24562
- path91,
24561
+ basename18(path96),
24562
+ path96,
24563
24563
  start3.ref
24564
24564
  ]);
24565
- recordWorktree(path91, clone, getCurrentOrigin(clone));
24565
+ recordWorktree(path96, clone, getCurrentOrigin(clone));
24566
24566
  daemonLog(
24567
- start3.track ? `worktree allocated ${path91} (branch ${basename18(path91)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path91} (branch ${basename18(path91)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24567
+ start3.track ? `worktree allocated ${path96} (branch ${basename18(path96)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path96} (branch ${basename18(path96)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24568
24568
  );
24569
- return path91;
24569
+ return path96;
24570
24570
  }
24571
24571
 
24572
24572
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24609,16 +24609,16 @@ function* durabilityProbes() {
24609
24609
  async function checkDurability(cwd) {
24610
24610
  if (!existsSync58(cwd)) return treeIsGone;
24611
24611
  const probes = durabilityProbes();
24612
- let step2 = probes.next();
24613
- while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
24614
- return step2.value;
24612
+ let step3 = probes.next();
24613
+ while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
24614
+ return step3.value;
24615
24615
  }
24616
24616
  function checkDurabilitySync(cwd) {
24617
24617
  if (!existsSync58(cwd)) return treeIsGone;
24618
24618
  const probes = durabilityProbes();
24619
- let step2 = probes.next();
24620
- while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
24621
- return step2.value;
24619
+ let step3 = probes.next();
24620
+ while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
24621
+ return step3.value;
24622
24622
  }
24623
24623
 
24624
24624
  // src/commands/sessions/daemon/worktree/reusesClone.ts
@@ -24707,13 +24707,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24707
24707
  if (forcedSpill) daemonLog(forcedSpill);
24708
24708
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24709
24709
  return { cwd: clone, kind: "primary", created: false, clone };
24710
- const path91 = createWorktree(
24710
+ const path96 = createWorktree(
24711
24711
  clone,
24712
24712
  { root: cfg.root, trunk: cfg.trunk },
24713
24713
  boundTreeRoots2,
24714
24714
  options2.replacesTree
24715
24715
  );
24716
- return { cwd: path91, kind: "worktree", created: true, clone };
24716
+ return { cwd: path96, kind: "worktree", created: true, clone };
24717
24717
  }
24718
24718
 
24719
24719
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -25059,13 +25059,13 @@ function worktreeHoldingBranch(cwd, branch2) {
25059
25059
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
25060
25060
  if (!listing) return null;
25061
25061
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
25062
- let path91 = null;
25062
+ let path96 = null;
25063
25063
  for (const line of listing.split("\n")) {
25064
25064
  const trimmed = line.trim();
25065
25065
  if (trimmed.startsWith("worktree "))
25066
- path91 = trimmed.slice("worktree ".length).trim();
25066
+ path96 = trimmed.slice("worktree ".length).trim();
25067
25067
  else if (trimmed === `branch refs/heads/${branch2}`)
25068
- return path91 && path91 !== here ? path91 : null;
25068
+ return path96 && path96 !== here ? path96 : null;
25069
25069
  }
25070
25070
  return null;
25071
25071
  }
@@ -25781,12 +25781,12 @@ function extractLayers(layers, cwd, globalConfigPath) {
25781
25781
  ];
25782
25782
  }
25783
25783
  function unknownExtract(name, layers) {
25784
- const names = [
25784
+ const names2 = [
25785
25785
  ...new Set(layers.flatMap((layer) => Object.keys(layer.extracts)))
25786
25786
  ].sort();
25787
- if (names.length === 0)
25787
+ if (names2.length === 0)
25788
25788
  return `No extract named "${name}" is configured. Pick a rectangle with no anchor flags, then save it as "${name}".`;
25789
- return `No extract named "${name}" is configured. Configured extracts: ${names.join(", ")}.`;
25789
+ return `No extract named "${name}" is configured. Configured extracts: ${names2.join(", ")}.`;
25790
25790
  }
25791
25791
 
25792
25792
  // src/commands/miro/mergeExtractOptions.ts
@@ -26169,9 +26169,9 @@ function parseRscRows(flight) {
26169
26169
  }
26170
26170
  function makeRscResolver(rows) {
26171
26171
  return (ref) => {
26172
- const [id, ...path91] = ref.slice(1).replace(/^[L@]/, "").split(":");
26172
+ const [id, ...path96] = ref.slice(1).replace(/^[L@]/, "").split(":");
26173
26173
  let v = rows[id];
26174
- for (const key of path91) {
26174
+ for (const key of path96) {
26175
26175
  if (v == null || typeof v !== "object") return void 0;
26176
26176
  v = v[key];
26177
26177
  }
@@ -26224,8 +26224,8 @@ function profileActionUrl(o) {
26224
26224
  return void 0;
26225
26225
  }
26226
26226
  var slugFromProfileUrl = (url) => url.match(/\/in\/([^/?]+)/)?.[1];
26227
- function visitObjects(root, fn) {
26228
- const stack = [root];
26227
+ function visitObjects(root2, fn) {
26228
+ const stack = [root2];
26229
26229
  while (stack.length) {
26230
26230
  const v = stack.pop();
26231
26231
  if (v == null || typeof v !== "object") continue;
@@ -26501,13 +26501,13 @@ function voyagerProfileMentions(included) {
26501
26501
  }
26502
26502
 
26503
26503
  // src/commands/netcap/extractVoyagerPosts.ts
26504
- function includedObjects(root) {
26505
- const included = root.included;
26504
+ function includedObjects(root2) {
26505
+ const included = root2.included;
26506
26506
  if (!Array.isArray(included)) return [];
26507
26507
  return included.map((item) => asObject(item)).filter((o) => o !== void 0);
26508
26508
  }
26509
- function elementUrns(root) {
26510
- const data = asObject(asObject(root.data)?.data);
26509
+ function elementUrns(root2) {
26510
+ const data = asObject(asObject(root2.data)?.data);
26511
26511
  if (!data) return [];
26512
26512
  for (const value of Object.values(data)) {
26513
26513
  const elements = asObject(value)?.["*elements"];
@@ -26517,13 +26517,13 @@ function elementUrns(root) {
26517
26517
  return [];
26518
26518
  }
26519
26519
  function extractVoyagerPosts(body) {
26520
- let root;
26520
+ let root2;
26521
26521
  try {
26522
- root = JSON.parse(body);
26522
+ root2 = JSON.parse(body);
26523
26523
  } catch {
26524
26524
  return [];
26525
26525
  }
26526
- const rootObj = asObject(root);
26526
+ const rootObj = asObject(root2);
26527
26527
  if (!rootObj) return [];
26528
26528
  const included = includedObjects(rootObj);
26529
26529
  const byUrn = /* @__PURE__ */ new Map();
@@ -26791,18 +26791,18 @@ function validateLine(line) {
26791
26791
  process.exit(1);
26792
26792
  }
26793
26793
  }
26794
- async function comment2(path91, line, body, options2 = {}) {
26794
+ async function comment2(path96, line, body, options2 = {}) {
26795
26795
  const { startLine, skipPreview } = options2;
26796
26796
  validateBody(body);
26797
26797
  validateLine(line);
26798
26798
  if (startLine !== void 0) validateLine(startLine);
26799
26799
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26800
26800
  if (!skipPreview)
26801
- await reviewProposedPrComment(`Comment on ${path91}:${range}`, body, null);
26801
+ await reviewProposedPrComment(`Comment on ${path96}:${range}`, body, null);
26802
26802
  try {
26803
26803
  const prId = getCurrentPrNodeId();
26804
- postReviewComment({ prId, body, path: path91, line, startLine });
26805
- console.log(`Added review comment on ${path91}:${range}`);
26804
+ postReviewComment({ prId, body, path: path96, line, startLine });
26805
+ console.log(`Added review comment on ${path96}:${range}`);
26806
26806
  } catch (error) {
26807
26807
  if (isGhNotInstalled(error)) {
26808
26808
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -27738,7 +27738,7 @@ function requestSession(message3) {
27738
27738
  return new Promise((resolve25, reject) => {
27739
27739
  connectToDaemon().then((socket) => {
27740
27740
  let settled = false;
27741
- const finish = (error, sessionId) => {
27741
+ const finish2 = (error, sessionId) => {
27742
27742
  if (settled) return;
27743
27743
  settled = true;
27744
27744
  socket.destroy();
@@ -27748,13 +27748,13 @@ function requestSession(message3) {
27748
27748
  readSocketLines(socket, (line) => {
27749
27749
  const incoming = parseIncoming(line, message3.type);
27750
27750
  if (!incoming) return;
27751
- if (incoming.kind === "error") finish(new Error(incoming.message));
27752
- else finish(void 0, incoming.sessionId);
27751
+ if (incoming.kind === "error") finish2(new Error(incoming.message));
27752
+ else finish2(void 0, incoming.sessionId);
27753
27753
  });
27754
- socket.on("error", (error) => finish(error));
27754
+ socket.on("error", (error) => finish2(error));
27755
27755
  socket.on(
27756
27756
  "close",
27757
- () => finish(new Error("daemon closed before the session was created"))
27757
+ () => finish2(new Error("daemon closed before the session was created"))
27758
27758
  );
27759
27759
  socket.write(`${JSON.stringify(message3)}
27760
27760
  `);
@@ -28322,9 +28322,9 @@ function registerPrsComments(prsCommand) {
28322
28322
  });
28323
28323
  prsCommand.command("comment <path> <line> <body>").description(
28324
28324
  "Add a line comment to the pending review (body of - reads it from stdin)"
28325
- ).action(async (path91, line, body) => {
28325
+ ).action(async (path96, line, body) => {
28326
28326
  await comment2(
28327
- path91,
28327
+ path96,
28328
28328
  Number.parseInt(line, 10),
28329
28329
  await readBodyArgument(body)
28330
28330
  );
@@ -28724,11 +28724,11 @@ async function loadBody(target) {
28724
28724
  if (target.kind === "file") return readDraftFile(target.path);
28725
28725
  return fetchPrBody(target.number, target.repo);
28726
28726
  }
28727
- function readDraftFile(path91) {
28727
+ function readDraftFile(path96) {
28728
28728
  try {
28729
- return readFileSync46(path91, "utf8");
28729
+ return readFileSync46(path96, "utf8");
28730
28730
  } catch {
28731
- console.error(`Error: Could not read \`${path91}\`.`);
28731
+ console.error(`Error: Could not read \`${path96}\`.`);
28732
28732
  console.error(
28733
28733
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28734
28734
  );
@@ -29008,10 +29008,10 @@ function resolveOpSecret(reference) {
29008
29008
  }
29009
29009
 
29010
29010
  // src/commands/ravendb/ravenFetch.ts
29011
- async function ravenFetch(connection, path91) {
29011
+ async function ravenFetch(connection, path96) {
29012
29012
  const apiKey = resolveOpSecret(connection.apiKeyRef);
29013
29013
  let accessToken = await getAccessToken(apiKey);
29014
- const url = `${connection.url}${path91}`;
29014
+ const url = `${connection.url}${path96}`;
29015
29015
  const headers = {
29016
29016
  Authorization: `Bearer ${accessToken}`,
29017
29017
  "Content-Type": "application/json"
@@ -29101,16 +29101,16 @@ import chalk195 from "chalk";
29101
29101
  // src/commands/ravendb/buildQueryPath.ts
29102
29102
  function buildQueryPath(opts) {
29103
29103
  const db = encodeURIComponent(opts.db);
29104
- let path91;
29104
+ let path96;
29105
29105
  if (opts.collection) {
29106
- path91 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
29106
+ path96 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
29107
29107
  } else {
29108
- path91 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
29108
+ path96 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
29109
29109
  }
29110
29110
  if (opts.query) {
29111
- path91 += `&query=${encodeURIComponent(opts.query)}`;
29111
+ path96 += `&query=${encodeURIComponent(opts.query)}`;
29112
29112
  }
29113
- return path91;
29113
+ return path96;
29114
29114
  }
29115
29115
 
29116
29116
  // src/commands/ravendb/fetchAllPages.ts
@@ -29119,7 +29119,7 @@ async function fetchAllPages(connection, opts) {
29119
29119
  let start3 = 0;
29120
29120
  while (true) {
29121
29121
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
29122
- const path91 = buildQueryPath({
29122
+ const path96 = buildQueryPath({
29123
29123
  db: connection.database,
29124
29124
  collection: opts.collection,
29125
29125
  start: start3,
@@ -29127,7 +29127,7 @@ async function fetchAllPages(connection, opts) {
29127
29127
  sort: opts.sort,
29128
29128
  query: opts.query
29129
29129
  });
29130
- const data = await ravenFetch(connection, path91);
29130
+ const data = await ravenFetch(connection, path96);
29131
29131
  const results = data.Results ?? [];
29132
29132
  const totalResults = data.TotalResults ?? 0;
29133
29133
  if (results.length === 0) break;
@@ -30482,12 +30482,12 @@ function addImportPreservingSuppressions(sourceFile, structure) {
30482
30482
  // src/commands/refactor/extract/removeStaleImports.ts
30483
30483
  import { SyntaxKind as SyntaxKind3 } from "ts-morph";
30484
30484
  function collectReferencedNames(sourceFile) {
30485
- const names = /* @__PURE__ */ new Set();
30485
+ const names2 = /* @__PURE__ */ new Set();
30486
30486
  for (const id of sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier)) {
30487
30487
  if (id.getFirstAncestorByKind(SyntaxKind3.ImportDeclaration)) continue;
30488
- names.add(id.getText());
30488
+ names2.add(id.getText());
30489
30489
  }
30490
- return names;
30490
+ return names2;
30491
30491
  }
30492
30492
  function isImportEmpty(importDecl, usedNames) {
30493
30493
  if (importDecl.getNamedImports().length > 0) return false;
@@ -30586,14 +30586,14 @@ function isPrivate(fn) {
30586
30586
  return !fn.isExported() && !fn.isDefaultExport();
30587
30587
  }
30588
30588
  function getCalledFunctionNames(fn) {
30589
- const names = /* @__PURE__ */ new Set();
30589
+ const names2 = /* @__PURE__ */ new Set();
30590
30590
  for (const call of fn.getDescendantsOfKind(SyntaxKind5.CallExpression)) {
30591
30591
  const expr = call.getExpression();
30592
30592
  if (expr.getKind() === SyntaxKind5.Identifier) {
30593
- names.add(expr.getText());
30593
+ names2.add(expr.getText());
30594
30594
  }
30595
30595
  }
30596
- return names;
30596
+ return names2;
30597
30597
  }
30598
30598
  function collectPrivateFunctions(target, fnMap) {
30599
30599
  const collected = /* @__PURE__ */ new Set();
@@ -30619,11 +30619,11 @@ function collectPrivateFunctions(target, fnMap) {
30619
30619
  // src/commands/refactor/extract/collectPrivateStatements.ts
30620
30620
  import { SyntaxKind as SyntaxKind6 } from "ts-morph";
30621
30621
  function getReferencedIdentifiers(fn) {
30622
- const names = /* @__PURE__ */ new Set();
30622
+ const names2 = /* @__PURE__ */ new Set();
30623
30623
  for (const id of fn.getDescendantsOfKind(SyntaxKind6.Identifier)) {
30624
- names.add(id.getText());
30624
+ names2.add(id.getText());
30625
30625
  }
30626
- return names;
30626
+ return names2;
30627
30627
  }
30628
30628
  function collectPrivateStatements(functions, stmtMap) {
30629
30629
  const seen = /* @__PURE__ */ new Set();
@@ -30808,31 +30808,31 @@ function matchImport(importDecl, neededNames) {
30808
30808
 
30809
30809
  // src/commands/refactor/extract/resolveImports.ts
30810
30810
  function getReferencedNames(nodes) {
30811
- const names = /* @__PURE__ */ new Set();
30811
+ const names2 = /* @__PURE__ */ new Set();
30812
30812
  for (const node of nodes) {
30813
30813
  for (const id of node.getDescendantsOfKind(SyntaxKind13.Identifier)) {
30814
- names.add(id.getText());
30814
+ names2.add(id.getText());
30815
30815
  }
30816
30816
  }
30817
- return names;
30817
+ return names2;
30818
30818
  }
30819
30819
  function getLocallyDeclaredNames(nodes) {
30820
- const names = /* @__PURE__ */ new Set();
30820
+ const names2 = /* @__PURE__ */ new Set();
30821
30821
  for (const node of nodes) {
30822
30822
  if (Node.isFunctionDeclaration(node)) {
30823
30823
  const name = node.getName();
30824
- if (name) names.add(name);
30824
+ if (name) names2.add(name);
30825
30825
  }
30826
30826
  for (const param of node.getDescendantsOfKind(SyntaxKind13.Parameter)) {
30827
- names.add(param.getName());
30827
+ names2.add(param.getName());
30828
30828
  }
30829
30829
  for (const varDecl of node.getDescendantsOfKind(
30830
30830
  SyntaxKind13.VariableDeclaration
30831
30831
  )) {
30832
- names.add(varDecl.getName());
30832
+ names2.add(varDecl.getName());
30833
30833
  }
30834
30834
  }
30835
- return names;
30835
+ return names2;
30836
30836
  }
30837
30837
  function resolveImports(target, dependencies, sourceFile, statements = []) {
30838
30838
  const allFunctions = [target, ...dependencies];
@@ -31375,16 +31375,21 @@ import ts7 from "typescript";
31375
31375
 
31376
31376
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
31377
31377
  import ts6 from "typescript";
31378
+ function moduleSpecifierOf(node) {
31379
+ if (ts6.isImportDeclaration(node) || ts6.isExportDeclaration(node))
31380
+ return node.moduleSpecifier;
31381
+ if (ts6.isCallExpression(node) && node.expression.kind === ts6.SyntaxKind.ImportKeyword && node.arguments.length === 1)
31382
+ return node.arguments[0];
31383
+ if (ts6.isImportTypeNode(node) && ts6.isLiteralTypeNode(node.argument))
31384
+ return node.argument.literal;
31385
+ return void 0;
31386
+ }
31378
31387
  function getImportSpecifiers(sourceFile) {
31379
31388
  const specifiers = [];
31380
31389
  const visit = (node) => {
31381
- if (ts6.isImportDeclaration(node) && ts6.isStringLiteral(node.moduleSpecifier)) {
31382
- specifiers.push(node.moduleSpecifier.text);
31383
- } else if (ts6.isExportDeclaration(node) && node.moduleSpecifier && ts6.isStringLiteral(node.moduleSpecifier)) {
31384
- specifiers.push(node.moduleSpecifier.text);
31385
- } else if (ts6.isCallExpression(node) && node.expression.kind === ts6.SyntaxKind.ImportKeyword && node.arguments.length === 1 && ts6.isStringLiteral(node.arguments[0])) {
31386
- specifiers.push(node.arguments[0].text);
31387
- }
31390
+ const specifier = moduleSpecifierOf(node);
31391
+ if (specifier && ts6.isStringLiteral(specifier))
31392
+ specifiers.push(specifier.text);
31388
31393
  ts6.forEachChild(node, visit);
31389
31394
  };
31390
31395
  visit(sourceFile);
@@ -31567,87 +31572,58 @@ Renamed ${oldName} \u2192 ${newName}`));
31567
31572
  }
31568
31573
 
31569
31574
  // src/commands/refactor/restructure/index.ts
31570
- import path68 from "path";
31575
+ import fs39 from "fs";
31576
+ import path73 from "path";
31571
31577
  import chalk217 from "chalk";
31572
31578
 
31573
- // src/commands/refactor/restructure/clusterDirectories.ts
31579
+ // src/commands/refactor/restructure/displayPlan.ts
31580
+ import path64 from "path";
31581
+ import chalk215 from "chalk";
31582
+
31583
+ // src/commands/refactor/restructure/computeDepthStats.ts
31574
31584
  import path62 from "path";
31575
- function clusterDirectories(graph) {
31576
- const dirImportedBy = /* @__PURE__ */ new Map();
31577
- for (const edge of graph.edges) {
31578
- const sourceDir = path62.dirname(edge.source);
31579
- const targetDir = path62.dirname(edge.target);
31580
- if (sourceDir === targetDir) continue;
31581
- if (!graph.files.has(edge.target)) continue;
31582
- const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
31583
- if (!dirImportedBy.has(targetDir)) dirImportedBy.set(targetDir, existing);
31584
- existing.add(sourceDir);
31585
- }
31586
- const clusters = /* @__PURE__ */ new Map();
31587
- for (const [dir, importers] of dirImportedBy) {
31588
- if (importers.size !== 1) continue;
31589
- const parentDir = [...importers][0];
31590
- if (isAncestor(dir, parentDir)) continue;
31591
- if (isAncestor(parentDir, dir)) continue;
31592
- const cluster = clusters.get(parentDir) ?? [];
31593
- if (!clusters.has(parentDir)) clusters.set(parentDir, cluster);
31594
- cluster.push(dir);
31595
- }
31596
- for (const [parentDir, children] of clusters) {
31597
- const filtered = children.filter((child) => !clusters.has(child));
31598
- if (filtered.length === 0) {
31599
- clusters.delete(parentDir);
31600
- } else {
31601
- clusters.set(parentDir, filtered);
31602
- }
31585
+ function computeDepthStats(targets, scopeRoot) {
31586
+ const distribution = /* @__PURE__ */ new Map();
31587
+ let max = 0;
31588
+ for (const target of targets) {
31589
+ const dir = path62.relative(scopeRoot, path62.dirname(target));
31590
+ const depth = dir === "" ? 0 : dir.split(path62.sep).length;
31591
+ distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
31592
+ max = Math.max(max, depth);
31603
31593
  }
31604
- return clusters;
31605
- }
31606
- function isAncestor(ancestor, descendant) {
31607
- const rel = path62.relative(ancestor, descendant);
31608
- return !rel.startsWith("..") && rel !== "";
31594
+ return { max, distribution };
31609
31595
  }
31610
31596
 
31611
- // src/commands/refactor/restructure/clusterFiles.ts
31597
+ // src/commands/refactor/restructure/formatTree.ts
31612
31598
  import path63 from "path";
31613
- function findRootParent(file, importedBy, visited) {
31614
- const importers = importedBy.get(file);
31615
- if (!importers || importers.size !== 1) return file;
31616
- const parent = [...importers][0];
31617
- const parentDir = path63.dirname(parent);
31618
- const fileDir = path63.dirname(file);
31619
- if (parentDir !== fileDir) return file;
31620
- if (path63.basename(parent, path63.extname(parent)) === "index") return file;
31621
- if (visited.has(parent)) return file;
31622
- visited.add(parent);
31623
- return findRootParent(parent, importedBy, visited);
31624
- }
31625
- function clusterFiles(graph) {
31626
- const clusters = /* @__PURE__ */ new Map();
31627
- for (const file of graph.files) {
31628
- const basename30 = path63.basename(file, path63.extname(file));
31629
- if (basename30 === "index") continue;
31630
- const importers = graph.importedBy.get(file);
31631
- if (!importers || importers.size !== 1) continue;
31632
- const parent = [...importers][0];
31633
- if (!graph.files.has(parent)) continue;
31634
- const parentDir = path63.dirname(parent);
31635
- const fileDir = path63.dirname(file);
31636
- if (parentDir !== fileDir) continue;
31637
- const parentBasename = path63.basename(parent, path63.extname(parent));
31638
- if (parentBasename === "index") continue;
31639
- const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
31640
- if (!root || root === file) continue;
31641
- const cluster = clusters.get(root) ?? [];
31642
- if (!clusters.has(root)) clusters.set(root, cluster);
31643
- cluster.push(file);
31644
- }
31645
- return clusters;
31599
+ function insert(root2, parts) {
31600
+ let node = root2;
31601
+ for (const part of parts) {
31602
+ const child = node.get(part) ?? /* @__PURE__ */ new Map();
31603
+ node.set(part, child);
31604
+ node = child;
31605
+ }
31606
+ }
31607
+ function render(node, indent3, lines2) {
31608
+ const entries = [...node].sort(([a, ca], [b, cb]) => {
31609
+ const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
31610
+ return dirFirst || a.localeCompare(b);
31611
+ });
31612
+ for (const [name, child] of entries) {
31613
+ lines2.push(`${indent3}${name}${child.size > 0 ? "/" : ""}`);
31614
+ render(child, `${indent3} `, lines2);
31615
+ }
31616
+ }
31617
+ function formatTree(files, scopeRoot) {
31618
+ const root2 = /* @__PURE__ */ new Map();
31619
+ for (const file of files)
31620
+ insert(root2, path63.relative(scopeRoot, file).split(path63.sep));
31621
+ const lines2 = [];
31622
+ render(root2, "", lines2);
31623
+ return lines2;
31646
31624
  }
31647
31625
 
31648
31626
  // src/commands/refactor/restructure/displayPlan.ts
31649
- import path64 from "path";
31650
- import chalk215 from "chalk";
31651
31627
  function relPath(filePath) {
31652
31628
  return path64.relative(process.cwd(), filePath);
31653
31629
  }
@@ -31661,38 +31637,39 @@ function displayMoves(plan2) {
31661
31637
  console.log(chalk215.dim(` ${move2.reason}`));
31662
31638
  }
31663
31639
  }
31664
- function displayRewrites(rewrites) {
31665
- if (rewrites.length === 0) return;
31666
- const affectedFiles = new Set(rewrites.map((r) => r.file));
31640
+ function displayTree(plan2) {
31641
+ console.log(
31642
+ chalk215.bold(`
31643
+ Resulting tree (${relPath(plan2.scopeRoot) || "."}/):`)
31644
+ );
31645
+ for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
31646
+ console.log(` ${line}`);
31647
+ }
31648
+ function displayDepthStats(plan2) {
31649
+ const { max, distribution } = computeDepthStats(
31650
+ plan2.targets.values(),
31651
+ plan2.scopeRoot
31652
+ );
31667
31653
  console.log(chalk215.bold(`
31668
- Import rewrites (${affectedFiles.size} files):`));
31669
- for (const file of affectedFiles) {
31670
- console.log(` ${chalk215.cyan(relPath(file))}:`);
31671
- for (const { oldSpecifier, newSpecifier } of rewrites.filter(
31672
- (r) => r.file === file
31673
- )) {
31674
- console.log(
31675
- ` ${chalk215.red(`"${oldSpecifier}"`)} \u2192 ${chalk215.green(`"${newSpecifier}"`)}`
31676
- );
31677
- }
31678
- }
31654
+ Depth (max ${max}):`));
31655
+ for (const depth of [...distribution.keys()].sort((a, b) => a - b))
31656
+ console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
31657
+ }
31658
+ function displayErrors(errors) {
31659
+ if (errors.length === 0) return;
31660
+ console.log(chalk215.red("\nErrors:"));
31661
+ for (const error of errors) console.log(chalk215.red(` ${error}`));
31679
31662
  }
31680
31663
  function displayPlan2(plan2) {
31681
- if (plan2.warnings.length > 0) {
31682
- console.log(chalk215.yellow("\nWarnings:"));
31683
- for (const w of plan2.warnings) console.log(chalk215.yellow(` ${w}`));
31684
- }
31685
- if (plan2.newDirectories.length > 0) {
31686
- console.log(chalk215.bold("\nNew directories:"));
31687
- for (const dir of plan2.newDirectories)
31688
- console.log(chalk215.green(` ${dir}/`));
31689
- }
31690
31664
  displayMoves(plan2);
31691
- displayRewrites(plan2.rewrites);
31665
+ displayTree(plan2);
31666
+ displayDepthStats(plan2);
31667
+ displayErrors(plan2.errors);
31668
+ const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
31692
31669
  console.log(
31693
31670
  chalk215.dim(
31694
31671
  `
31695
- Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten`
31672
+ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
31696
31673
  )
31697
31674
  );
31698
31675
  }
@@ -31709,10 +31686,6 @@ function executePlan(plan2) {
31709
31686
  chalk216.cyan(` Rewrote imports in ${path65.relative(process.cwd(), file)}`)
31710
31687
  );
31711
31688
  }
31712
- for (const dir of plan2.newDirectories) {
31713
- fs38.mkdirSync(dir, { recursive: true });
31714
- console.log(chalk216.green(` Created ${path65.relative(process.cwd(), dir)}/`));
31715
- }
31716
31689
  for (const move2 of plan2.moves) {
31717
31690
  const targetDir = path65.dirname(move2.to);
31718
31691
  if (!fs38.existsSync(targetDir)) {
@@ -31743,148 +31716,299 @@ function removeEmptyDirectories(dirs) {
31743
31716
  }
31744
31717
  }
31745
31718
 
31746
- // src/commands/refactor/restructure/planFileMoves/index.ts
31747
- import path67 from "path";
31719
+ // src/commands/refactor/restructure/planRestructure/index.ts
31720
+ import path72 from "path";
31748
31721
 
31749
- // src/commands/refactor/restructure/planFileMoves/shared.ts
31750
- import fs39 from "fs";
31751
- function emptyResult() {
31752
- return { moves: [], directories: [], warnings: [] };
31753
- }
31754
- function checkDirConflict(result, label2, dir) {
31755
- if (!fs39.existsSync(dir)) return false;
31756
- result.warnings.push(`Skipping ${label2}: directory ${dir} already exists`);
31757
- return true;
31758
- }
31722
+ // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
31723
+ import path68 from "path";
31759
31724
 
31760
- // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
31761
- import fs40 from "fs";
31725
+ // src/commands/refactor/restructure/planRestructure/isTestFile.ts
31762
31726
  import path66 from "path";
31763
- function collectEntry2(results, dir, entry) {
31764
- const full = path66.join(dir, entry.name);
31765
- const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
31766
- results.push(...items2);
31767
- }
31768
- function listFilesRecursive(dir) {
31769
- if (!fs40.existsSync(dir)) return [];
31770
- const results = [];
31771
- for (const entry of fs40.readdirSync(dir, { withFileTypes: true })) {
31772
- collectEntry2(results, dir, entry);
31773
- }
31774
- return results;
31727
+ var TEST_SUFFIX = /\.test\.tsx?$/;
31728
+ function isTestFile(file) {
31729
+ return TEST_SUFFIX.test(file);
31775
31730
  }
31776
- function addDirectoryFileMoves(moves, childDir, newLocation, reason4) {
31777
- for (const file of listFilesRecursive(childDir)) {
31778
- const rel = path66.relative(childDir, file);
31779
- moves.push({ from: file, to: path66.join(newLocation, rel), reason: reason4 });
31780
- }
31731
+ function testStem(file) {
31732
+ return path66.basename(file).replace(TEST_SUFFIX, "");
31781
31733
  }
31782
- function resolveChildDest(parentDir, childDir) {
31783
- return path66.join(parentDir, path66.basename(childDir));
31784
- }
31785
- function childMoveReason(parentDir) {
31786
- return `Directory only imported from ${path66.basename(parentDir)}/`;
31734
+
31735
+ // src/commands/refactor/restructure/planRestructure/moduleStem.ts
31736
+ import path67 from "path";
31737
+ function moduleStem(file) {
31738
+ return path67.basename(file).replace(/\.tsx?$/, "");
31787
31739
  }
31788
- function registerDirectoryMove(result, childDir, dest, parentDir) {
31789
- result.directories.push(dest);
31790
- const reason4 = childMoveReason(parentDir);
31791
- addDirectoryFileMoves(result.moves, childDir, dest, reason4);
31740
+
31741
+ // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
31742
+ function sorted(set) {
31743
+ return [...set ?? []].sort();
31792
31744
  }
31793
- function planChildDirectoryMove(result, parentDir, childDir) {
31794
- const dest = resolveChildDest(parentDir, childDir);
31795
- if (checkDirConflict(result, childDir, dest)) return;
31796
- registerDirectoryMove(result, childDir, dest, parentDir);
31745
+ function names(files) {
31746
+ return files.map((f) => path68.basename(f)).join(", ");
31797
31747
  }
31798
- function processDirectoryCluster(result, parentDir, childDirs) {
31799
- for (const childDir of childDirs)
31800
- planChildDirectoryMove(result, parentDir, childDir);
31748
+ function anchorsOf(files, mode) {
31749
+ return files.map((file) => ({ file, mode }));
31801
31750
  }
31802
- function planDirectoryMoves(clusters) {
31803
- const result = emptyResult();
31804
- for (const [parentDir, childDirs] of clusters)
31805
- processDirectoryCluster(result, parentDir, childDirs);
31806
- return result;
31751
+ function root(reason4) {
31752
+ return { root: true, anchors: [], reason: reason4 };
31807
31753
  }
31808
-
31809
- // src/commands/refactor/restructure/planFileMoves/index.ts
31810
- function childMoveData(child, newDir, parentBase) {
31811
- const to = path67.join(newDir, path67.basename(child));
31812
- return { from: child, to, reason: `Only imported by ${parentBase}` };
31754
+ function anchorTest(file, index3) {
31755
+ const imported = sorted(index3.imports.get(file));
31756
+ if (imported.length === 0) return root("test with no subject in scope");
31757
+ const stem = testStem(file);
31758
+ const subjects = imported.filter(
31759
+ (f) => !isTestFile(f) && moduleStem(f) === stem
31760
+ );
31761
+ const anchors = subjects.length > 0 ? subjects : imported;
31762
+ return {
31763
+ root: false,
31764
+ anchors: anchorsOf(anchors, "sibling"),
31765
+ reason: `test of ${names(anchors)}`
31766
+ };
31813
31767
  }
31814
- function addChildMoves(moves, children, newDir, parentBase) {
31815
- for (const child of children)
31816
- moves.push(childMoveData(child, newDir, parentBase));
31768
+ function anchorModule(file, index3) {
31769
+ if (index3.external.has(file)) return root("imported from outside scope");
31770
+ const importers = sorted(index3.importers.get(file));
31771
+ if (importers.length > 0)
31772
+ return {
31773
+ root: false,
31774
+ anchors: anchorsOf(importers, "child"),
31775
+ reason: importers.length === 1 ? `imported only by ${names(importers)}` : `shared by ${names(importers)}`
31776
+ };
31777
+ const tests = sorted(index3.testImporters.get(file));
31778
+ if (tests.length > 0)
31779
+ return {
31780
+ root: false,
31781
+ anchors: anchorsOf(tests, "sibling"),
31782
+ reason: `used only by tests ${names(tests)}`
31783
+ };
31784
+ return root("no importers in scope");
31817
31785
  }
31818
- function getBaseName(filePath) {
31819
- return path67.basename(filePath, path67.extname(filePath));
31786
+ function collectAnchors(files, index3) {
31787
+ const anchorings = /* @__PURE__ */ new Map();
31788
+ for (const file of files)
31789
+ anchorings.set(
31790
+ file,
31791
+ isTestFile(file) ? anchorTest(file, index3) : anchorModule(file, index3)
31792
+ );
31793
+ return anchorings;
31820
31794
  }
31821
- function resolveClusterDir(parent) {
31822
- return path67.join(path67.dirname(parent), getBaseName(parent));
31795
+
31796
+ // src/commands/refactor/restructure/planRestructure/findCollisions.ts
31797
+ import path69 from "path";
31798
+ function findCollisions(targets, scopeRoot) {
31799
+ const byModule = /* @__PURE__ */ new Map();
31800
+ for (const [file, target] of targets) {
31801
+ const key = path69.join(path69.dirname(target), moduleStem(target));
31802
+ byModule.set(key, [...byModule.get(key) ?? [], file]);
31803
+ }
31804
+ return [...byModule].filter(([, files]) => files.length > 1).map(([key, files]) => {
31805
+ const where = path69.relative(scopeRoot, path69.dirname(key)) || ".";
31806
+ const sources = files.sort().map((f) => path69.relative(scopeRoot, f));
31807
+ return `Basename collision in ${where}/: ${sources.join(", ")}`;
31808
+ }).sort();
31809
+ }
31810
+
31811
+ // src/commands/refactor/restructure/planRestructure/indexEdges.ts
31812
+ function add3(map, key, value) {
31813
+ const set = map.get(key) ?? /* @__PURE__ */ new Set();
31814
+ set.add(value);
31815
+ map.set(key, set);
31816
+ }
31817
+ function indexEdges(scope, edges) {
31818
+ const index3 = {
31819
+ importers: /* @__PURE__ */ new Map(),
31820
+ testImporters: /* @__PURE__ */ new Map(),
31821
+ imports: /* @__PURE__ */ new Map(),
31822
+ external: /* @__PURE__ */ new Set()
31823
+ };
31824
+ for (const { source, target } of edges) {
31825
+ if (!scope.has(target) || source === target) continue;
31826
+ const test = isTestFile(source);
31827
+ if (!scope.has(source)) {
31828
+ if (!test) index3.external.add(target);
31829
+ continue;
31830
+ }
31831
+ add3(index3.imports, source, target);
31832
+ add3(test ? index3.testImporters : index3.importers, target, source);
31833
+ }
31834
+ return index3;
31823
31835
  }
31824
- function createParentMove(parent, newDir) {
31825
- return {
31826
- from: parent,
31827
- to: path67.join(newDir, `index${path67.extname(parent)}`),
31828
- reason: `Main module of new ${getBaseName(parent)}/ directory`
31836
+
31837
+ // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31838
+ import path71 from "path";
31839
+
31840
+ // src/commands/refactor/restructure/planRestructure/findStronglyConnectedComponents.ts
31841
+ function push(state, frames, node) {
31842
+ const i = state.index.size;
31843
+ state.index.set(node, i);
31844
+ state.low.set(node, i);
31845
+ state.stack.push(node);
31846
+ state.onStack.add(node);
31847
+ frames.push({ node, next: 0 });
31848
+ }
31849
+ function popComponent(state, node) {
31850
+ const component = [];
31851
+ let member;
31852
+ do {
31853
+ member = state.stack.pop();
31854
+ state.onStack.delete(member);
31855
+ component.push(member);
31856
+ } while (member !== node);
31857
+ state.components.push(component.sort());
31858
+ }
31859
+ function lowerTo(state, node, value) {
31860
+ state.low.set(node, Math.min(state.low.get(node), value));
31861
+ }
31862
+ function finish(state, frames, node) {
31863
+ frames.pop();
31864
+ const parent = frames.at(-1);
31865
+ if (parent) lowerTo(state, parent.node, state.low.get(node));
31866
+ if (state.low.get(node) === state.index.get(node)) popComponent(state, node);
31867
+ }
31868
+ function step2(state, frames, successors) {
31869
+ const frame = frames.at(-1);
31870
+ const next3 = successors(frame.node)[frame.next++];
31871
+ if (next3 === void 0) finish(state, frames, frame.node);
31872
+ else if (!state.index.has(next3)) push(state, frames, next3);
31873
+ else if (state.onStack.has(next3))
31874
+ lowerTo(state, frame.node, state.index.get(next3));
31875
+ }
31876
+ function findStronglyConnectedComponents(nodes, successors) {
31877
+ const state = {
31878
+ index: /* @__PURE__ */ new Map(),
31879
+ low: /* @__PURE__ */ new Map(),
31880
+ stack: [],
31881
+ onStack: /* @__PURE__ */ new Set(),
31882
+ components: []
31829
31883
  };
31884
+ for (const start3 of nodes) {
31885
+ if (state.index.has(start3)) continue;
31886
+ const frames = [];
31887
+ push(state, frames, start3);
31888
+ while (frames.length > 0) step2(state, frames, successors);
31889
+ }
31890
+ return state.components;
31830
31891
  }
31831
- function registerClusterMoves(result, parent, newDir, children) {
31832
- result.directories.push(newDir);
31833
- result.moves.push(createParentMove(parent, newDir));
31834
- addChildMoves(result.moves, children, newDir, getBaseName(parent));
31892
+
31893
+ // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
31894
+ import path70 from "path";
31895
+ function lowestCommonAncestor(dirs) {
31896
+ const [first, ...rest] = dirs.map((d) => d.split(path70.sep));
31897
+ let common = first;
31898
+ for (const parts of rest) {
31899
+ let i = 0;
31900
+ while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
31901
+ common = common.slice(0, i);
31902
+ }
31903
+ return common.join(path70.sep) || path70.sep;
31904
+ }
31905
+
31906
+ // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31907
+ function anchorFolder(anchor, dirs) {
31908
+ const dir = dirs.get(anchor.file);
31909
+ return anchor.mode === "child" ? path71.join(dir, moduleStem(anchor.file)) : dir;
31910
+ }
31911
+ function externalAnchors(component, anchorings) {
31912
+ const members = new Set(component);
31913
+ return component.flatMap(
31914
+ (file) => anchorings.get(file).anchors.filter(
31915
+ (a) => !members.has(a.file)
31916
+ )
31917
+ );
31835
31918
  }
31836
- function planClusterMoves(result, parent, children) {
31837
- const newDir = resolveClusterDir(parent);
31838
- if (checkDirConflict(result, parent, newDir)) return;
31839
- registerClusterMoves(result, parent, newDir, children);
31919
+ function componentDir(component, anchorings, dirs, scopeRoot) {
31920
+ if (component.some((f) => anchorings.get(f).root))
31921
+ return scopeRoot;
31922
+ const anchors = externalAnchors(component, anchorings);
31923
+ if (anchors.length === 0) return scopeRoot;
31924
+ return lowestCommonAncestor(anchors.map((a) => anchorFolder(a, dirs)));
31925
+ }
31926
+ function componentReason(file, component, base) {
31927
+ if (component.length === 1) return base;
31928
+ const others = component.filter((f) => f !== file).map((f) => path71.basename(f));
31929
+ return `${base}; cycle with ${others.join(", ")}`;
31930
+ }
31931
+ function placeComponents(files, anchorings, scopeRoot) {
31932
+ const successors = (file) => anchorings.get(file).anchors.map((a) => a.file);
31933
+ const dirs = /* @__PURE__ */ new Map();
31934
+ const placements = /* @__PURE__ */ new Map();
31935
+ for (const component of findStronglyConnectedComponents(files, successors)) {
31936
+ const dir = componentDir(component, anchorings, dirs, scopeRoot);
31937
+ for (const file of component) {
31938
+ dirs.set(file, dir);
31939
+ const base = anchorings.get(file).reason;
31940
+ placements.set(file, {
31941
+ dir,
31942
+ reason: componentReason(file, component, base)
31943
+ });
31944
+ }
31945
+ }
31946
+ return placements;
31840
31947
  }
31841
- function planFileMoves(clusters) {
31842
- const result = emptyResult();
31843
- for (const [parent, children] of clusters) {
31844
- planClusterMoves(result, parent, children);
31948
+
31949
+ // src/commands/refactor/restructure/planRestructure/index.ts
31950
+ function planRestructure(input) {
31951
+ const scopeRoot = path72.resolve(input.scopeRoot);
31952
+ const files = [...new Set(input.files)].sort();
31953
+ const index3 = indexEdges(new Set(files), input.edges);
31954
+ const anchorings = collectAnchors(files, index3);
31955
+ const placements = placeComponents(files, anchorings, scopeRoot);
31956
+ const targets = /* @__PURE__ */ new Map();
31957
+ const moves = [];
31958
+ for (const file of files) {
31959
+ const { dir, reason: reason4 } = placements.get(file);
31960
+ const to = path72.join(dir, path72.basename(file));
31961
+ targets.set(file, to);
31962
+ if (to !== file) moves.push({ from: file, to, reason: reason4 });
31845
31963
  }
31846
- return result;
31964
+ return { targets, moves, errors: findCollisions(targets, scopeRoot) };
31847
31965
  }
31848
31966
 
31849
- // src/commands/refactor/restructure/index.ts
31850
- function buildPlan3(candidateFiles, tsConfigPath) {
31851
- const candidates = new Set(candidateFiles.map((f) => path68.resolve(f)));
31852
- const graph = buildImportGraph(candidates, tsConfigPath);
31967
+ // src/commands/refactor/restructure/buildPlan.ts
31968
+ function buildPlan3(scopeRoot, files) {
31969
+ const graph = buildImportGraph(new Set(files), findTsConfig(files[0]));
31970
+ const { targets, moves, errors } = planRestructure({
31971
+ scopeRoot,
31972
+ files,
31973
+ edges: graph.edges
31974
+ });
31853
31975
  const allProjectFiles = /* @__PURE__ */ new Set([
31854
31976
  ...graph.importedBy.keys(),
31855
31977
  ...graph.imports.keys()
31856
31978
  ]);
31857
- const fileClusters = clusterFiles(graph);
31858
- const dirClusters = clusterDirectories(graph);
31859
- const fileResult = planFileMoves(fileClusters);
31860
- const dirResult = planDirectoryMoves(dirClusters);
31861
- const moves = [...fileResult.moves, ...dirResult.moves];
31862
- const directories = [...fileResult.directories, ...dirResult.directories];
31863
- const warnings = [...fileResult.warnings, ...dirResult.warnings];
31864
31979
  const rewrites = computeRewrites(moves, graph.edges, allProjectFiles);
31865
- return { moves, rewrites, newDirectories: directories, warnings };
31980
+ return { scopeRoot, targets, moves, rewrites, errors };
31866
31981
  }
31867
- async function restructure(pattern2, options2 = {}) {
31868
- const targetPattern = pattern2 ?? "src";
31869
- const files = findSourceFiles(targetPattern);
31982
+
31983
+ // src/commands/refactor/restructure/index.ts
31984
+ async function restructure(root2, options2 = {}) {
31985
+ const scopeRoot = path73.resolve(root2 ?? "src");
31986
+ if (!fs39.existsSync(scopeRoot) || !fs39.statSync(scopeRoot).isDirectory()) {
31987
+ console.log(chalk217.red(`Not a directory: ${root2 ?? "src"}`));
31988
+ process.exit(1);
31989
+ }
31990
+ const files = findSourceFiles(root2 ?? "src").map((f) => path73.resolve(f));
31870
31991
  if (files.length === 0) {
31871
- console.log(chalk217.yellow("No files found matching pattern"));
31992
+ console.log(chalk217.yellow("No files found under root"));
31872
31993
  return;
31873
31994
  }
31874
- const tsConfigPath = findTsConfig(path68.resolve(files[0]));
31875
- const plan2 = buildPlan3(files, tsConfigPath);
31995
+ const plan2 = buildPlan3(scopeRoot, files);
31996
+ displayPlan2(plan2);
31876
31997
  if (plan2.moves.length === 0) {
31877
31998
  console.log(chalk217.green("No restructuring needed"));
31878
31999
  return;
31879
32000
  }
31880
- displayPlan2(plan2);
31881
- if (options2.apply) {
31882
- console.log(chalk217.bold("\nApplying changes..."));
31883
- executePlan(plan2);
31884
- console.log(chalk217.green("\nRestructuring complete"));
31885
- } else {
32001
+ if (!options2.apply) {
31886
32002
  console.log(chalk217.dim("\nDry run. Use --apply to execute."));
32003
+ return;
32004
+ }
32005
+ if (plan2.errors.length > 0) {
32006
+ console.log(chalk217.red("\nResolve the errors above before applying."));
32007
+ process.exit(1);
31887
32008
  }
32009
+ console.log(chalk217.bold("\nApplying changes..."));
32010
+ executePlan(plan2);
32011
+ console.log(chalk217.green("\nRestructuring complete"));
31888
32012
  }
31889
32013
 
31890
32014
  // src/commands/registerRefactor.ts
@@ -31903,13 +32027,9 @@ function registerRename(parent) {
31903
32027
  ).option("--apply", "Execute the rename (default: dry-run)").action(renameSymbol);
31904
32028
  }
31905
32029
  function registerRestructure(parent) {
31906
- const restructureCommand = parent.command("restructure [pattern]").description(
31907
- "Analyze import graph and restructure tightly-coupled files into nested directories"
31908
- ).option("--apply", "Execute the restructuring (default: dry-run)").option(
31909
- "--max-depth <number>",
31910
- "Maximum nesting iterations (default: 3)",
31911
- Number.parseInt
31912
- ).action(restructure);
32030
+ const restructureCommand = parent.command("restructure [root]").description(
32031
+ "Place every file under root by its import graph: single-importer files nest under their importer, shared files sit at their importers' lowest common folder"
32032
+ ).option("--apply", "Execute the restructuring (default: dry-run)").action(restructure);
31913
32033
  configHelp(restructureCommand, refactorConfigHelp);
31914
32034
  }
31915
32035
  function registerRefactor(program2) {
@@ -32239,10 +32359,10 @@ var emptyDirectoryGroup = () => ({
32239
32359
  dirs: /* @__PURE__ */ new Map(),
32240
32360
  files: []
32241
32361
  });
32242
- function place(root, file) {
32362
+ function place(root2, file) {
32243
32363
  const segments = file.path.split("/").filter(Boolean);
32244
32364
  segments.pop();
32245
- let at2 = root;
32365
+ let at2 = root2;
32246
32366
  for (const segment of segments) {
32247
32367
  const next3 = at2.dirs.get(segment) ?? emptyDirectoryGroup();
32248
32368
  at2.dirs.set(segment, next3);
@@ -32251,14 +32371,14 @@ function place(root, file) {
32251
32371
  at2.files.push(file);
32252
32372
  }
32253
32373
  function groupFilesByDirectory(files) {
32254
- const root = emptyDirectoryGroup();
32255
- for (const file of files) place(root, file);
32256
- return root;
32374
+ const root2 = emptyDirectoryGroup();
32375
+ for (const file of files) place(root2, file);
32376
+ return root2;
32257
32377
  }
32258
32378
 
32259
32379
  // src/commands/review/highLevel/buildHighLevelTree.ts
32260
- function basename20(path91) {
32261
- return path91.slice(path91.lastIndexOf("/") + 1);
32380
+ function basename20(path96) {
32381
+ return path96.slice(path96.lastIndexOf("/") + 1);
32262
32382
  }
32263
32383
  function sum(nodes, key) {
32264
32384
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32281,19 +32401,19 @@ function nodesOf(at2, prefix2) {
32281
32401
  }
32282
32402
  function collapsedDirNode(name, at2, prefix2) {
32283
32403
  let label2 = name;
32284
- let path91 = prefix2 ? `${prefix2}/${name}` : name;
32404
+ let path96 = prefix2 ? `${prefix2}/${name}` : name;
32285
32405
  let node = at2;
32286
32406
  while (node.files.length === 0 && node.dirs.size === 1) {
32287
32407
  const [childName, child] = [...node.dirs][0];
32288
32408
  label2 = `${label2}/${childName}`;
32289
- path91 = `${path91}/${childName}`;
32409
+ path96 = `${path96}/${childName}`;
32290
32410
  node = child;
32291
32411
  }
32292
- const children = nodesOf(node, path91);
32412
+ const children = nodesOf(node, path96);
32293
32413
  return {
32294
32414
  kind: "dir",
32295
32415
  name: label2,
32296
- path: path91,
32416
+ path: path96,
32297
32417
  additions: sum(children, "additions"),
32298
32418
  deletions: sum(children, "deletions"),
32299
32419
  children
@@ -32551,8 +32671,8 @@ function toStatus(status3) {
32551
32671
  if (status3 === "removed") return "removed";
32552
32672
  return "modified";
32553
32673
  }
32554
- function diffUrl(repo, prNumber, path91) {
32555
- const anchor = createHash3("sha256").update(path91).digest("hex");
32674
+ function diffUrl(repo, prNumber, path96) {
32675
+ const anchor = createHash3("sha256").update(path96).digest("hex");
32556
32676
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32557
32677
  }
32558
32678
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32608,10 +32728,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32608
32728
 
32609
32729
  // src/commands/review/highLevel/loadHighLevelReview.ts
32610
32730
  function loadHighLevelReview(repo, headRef, headSha) {
32611
- const path91 = highLevelReviewPath(repo, headRef, headSha);
32612
- if (!existsSync64(path91)) return void 0;
32731
+ const path96 = highLevelReviewPath(repo, headRef, headSha);
32732
+ if (!existsSync64(path96)) return void 0;
32613
32733
  try {
32614
- return JSON.parse(readFileSync49(path91, "utf8"));
32734
+ return JSON.parse(readFileSync49(path96, "utf8"));
32615
32735
  } catch {
32616
32736
  return void 0;
32617
32737
  }
@@ -32622,8 +32742,8 @@ import { minimatch as minimatch9 } from "minimatch";
32622
32742
  function selectCriticalDiffs(files, criticalPaths) {
32623
32743
  if (criticalPaths.length === 0) return [];
32624
32744
  return files.filter((file) => criticalPaths.some((glob) => minimatch9(file.path, glob))).map(
32625
- ({ path: path91, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32626
- path: path91,
32745
+ ({ path: path96, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32746
+ path: path96,
32627
32747
  status: status3,
32628
32748
  additions,
32629
32749
  deletions,
@@ -32738,11 +32858,11 @@ function highLevelPreviewPayload(subject) {
32738
32858
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
32739
32859
  import { dirname as dirname35 } from "path";
32740
32860
  function saveHighLevelReview(record) {
32741
- const path91 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32742
- mkdirSync22(dirname35(path91), { recursive: true });
32743
- writeFileSync39(path91, `${JSON.stringify(record, null, 2)}
32861
+ const path96 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32862
+ mkdirSync22(dirname35(path96), { recursive: true });
32863
+ writeFileSync39(path96, `${JSON.stringify(record, null, 2)}
32744
32864
  `);
32745
- return path91;
32865
+ return path96;
32746
32866
  }
32747
32867
 
32748
32868
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -32761,9 +32881,9 @@ async function openHighLevelOverlay(sessionId, subject) {
32761
32881
  { rejectIsOutcome: true }
32762
32882
  );
32763
32883
  const record = buildHighLevelRecord(subject, decision);
32764
- const path91 = saveHighLevelReview(record);
32884
+ const path96 = saveHighLevelReview(record);
32765
32885
  console.log(`Verdict: ${record.verdict}`);
32766
- console.log(`Saved ${path91}`);
32886
+ console.log(`Saved ${path96}`);
32767
32887
  console.log("Nothing was posted to GitHub.");
32768
32888
  return record;
32769
32889
  }
@@ -33778,8 +33898,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
33778
33898
  // src/commands/review/prepareReviewDir.ts
33779
33899
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
33780
33900
  function clearReviewFiles(paths) {
33781
- for (const path91 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33782
- if (existsSync65(path91)) unlinkSync18(path91);
33901
+ for (const path96 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33902
+ if (existsSync65(path96)) unlinkSync18(path96);
33783
33903
  }
33784
33904
  }
33785
33905
  function prepareReviewDir(paths, requestBody, force) {
@@ -33824,11 +33944,11 @@ function refreshElapsedText(entry) {
33824
33944
  entry.text = `${entry.elapsedPrefix ?? "elapsed"}: ${seconds}s`;
33825
33945
  }
33826
33946
  function renderEntries(entries, frame) {
33827
- const sorted = [...entries].sort(
33947
+ const sorted2 = [...entries].sort(
33828
33948
  (a, b) => Number(Boolean(a.footer)) - Number(Boolean(b.footer))
33829
33949
  );
33830
- for (const entry of sorted) refreshElapsedText(entry);
33831
- return sorted.map((e) => renderEntry(e, frame)).join("\n");
33950
+ for (const entry of sorted2) refreshElapsedText(entry);
33951
+ return sorted2.map((e) => renderEntry(e, frame)).join("\n");
33832
33952
  }
33833
33953
  function renderEntry(entry, frame) {
33834
33954
  if (entry.state === "succeeded") return `\u2714 ${entry.text}`;
@@ -35017,7 +35137,7 @@ function registerReview(program2) {
35017
35137
 
35018
35138
  // src/commands/rules/addRule.ts
35019
35139
  import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
35020
- import path73 from "path";
35140
+ import path78 from "path";
35021
35141
  import chalk229 from "chalk";
35022
35142
 
35023
35143
  // src/commands/rules/insertRuleBullet.ts
@@ -35045,7 +35165,7 @@ import { readFileSync as readFileSync52 } from "fs";
35045
35165
 
35046
35166
  // src/commands/rules/findClaudeFiles.ts
35047
35167
  import { readdirSync as readdirSync14 } from "fs";
35048
- import path69 from "path";
35168
+ import path74 from "path";
35049
35169
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
35050
35170
  function findClaudeFiles(dir) {
35051
35171
  const results = [];
@@ -35053,9 +35173,9 @@ function findClaudeFiles(dir) {
35053
35173
  if (entry.isDirectory()) {
35054
35174
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
35055
35175
  continue;
35056
- results.push(...findClaudeFiles(path69.join(dir, entry.name)));
35176
+ results.push(...findClaudeFiles(path74.join(dir, entry.name)));
35057
35177
  } else if (entry.name === "CLAUDE.md") {
35058
- results.push(path69.join(dir, entry.name));
35178
+ results.push(path74.join(dir, entry.name));
35059
35179
  }
35060
35180
  }
35061
35181
  return results;
@@ -35063,8 +35183,8 @@ function findClaudeFiles(dir) {
35063
35183
 
35064
35184
  // src/commands/rules/nextRuleCode.ts
35065
35185
  var CODE_PREFIX = "R";
35066
- function nextRuleCode(root) {
35067
- const numbers = findClaudeFiles(root).flatMap(
35186
+ function nextRuleCode(root2) {
35187
+ const numbers = findClaudeFiles(root2).flatMap(
35068
35188
  (file) => parseRulesSection(readFileSync52(file, "utf8")).map(
35069
35189
  (rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
35070
35190
  )
@@ -35074,34 +35194,34 @@ function nextRuleCode(root) {
35074
35194
 
35075
35195
  // src/commands/rules/resolveRuleScope.ts
35076
35196
  import { existsSync as existsSync68 } from "fs";
35077
- import path70 from "path";
35197
+ import path75 from "path";
35078
35198
  function resolveRuleScope(target) {
35079
- const resolved = path70.resolve(target);
35080
- if (path70.basename(resolved) === "CLAUDE.md") return resolved;
35199
+ const resolved = path75.resolve(target);
35200
+ if (path75.basename(resolved) === "CLAUDE.md") return resolved;
35081
35201
  const startDir = scopeDirectory(resolved);
35082
- const root = findRepoRoot(startDir) ?? startDir;
35202
+ const root2 = findRepoRoot(startDir) ?? startDir;
35083
35203
  let current = startDir;
35084
35204
  while (true) {
35085
- const candidate = path70.join(current, "CLAUDE.md");
35205
+ const candidate = path75.join(current, "CLAUDE.md");
35086
35206
  if (existsSync68(candidate)) return candidate;
35087
- if (current === root || current === path70.dirname(current)) break;
35088
- current = path70.dirname(current);
35207
+ if (current === root2 || current === path75.dirname(current)) break;
35208
+ current = path75.dirname(current);
35089
35209
  }
35090
- return path70.join(root, "CLAUDE.md");
35210
+ return path75.join(root2, "CLAUDE.md");
35091
35211
  }
35092
35212
 
35093
35213
  // src/commands/rules/updateScopedRulesIndex.ts
35094
35214
  import { existsSync as existsSync69, readFileSync as readFileSync54, writeFileSync as writeFileSync42 } from "fs";
35095
- import path72 from "path";
35215
+ import path77 from "path";
35096
35216
 
35097
35217
  // src/commands/rules/scopedRuleDirectories.ts
35098
35218
  import { readFileSync as readFileSync53 } from "fs";
35099
- import path71 from "path";
35100
- function scopedRuleDirectories(root) {
35101
- return findClaudeFiles(root).filter(
35102
- (file) => path71.dirname(file) !== root && parseRulesSection(readFileSync53(file, "utf8")).length > 0
35219
+ import path76 from "path";
35220
+ function scopedRuleDirectories(root2) {
35221
+ return findClaudeFiles(root2).filter(
35222
+ (file) => path76.dirname(file) !== root2 && parseRulesSection(readFileSync53(file, "utf8")).length > 0
35103
35223
  ).map(
35104
- (file) => `${path71.relative(root, path71.dirname(file)).split(path71.sep).join("/")}/`
35224
+ (file) => `${path76.relative(root2, path76.dirname(file)).split(path76.sep).join("/")}/`
35105
35225
  ).sort();
35106
35226
  }
35107
35227
 
@@ -35138,9 +35258,9 @@ function upsertScopedRulesPointer(content, directories) {
35138
35258
  }
35139
35259
 
35140
35260
  // src/commands/rules/updateScopedRulesIndex.ts
35141
- function updateScopedRulesIndex(root) {
35142
- const directories = scopedRuleDirectories(root);
35143
- const rootFile = path72.join(root, "CLAUDE.md");
35261
+ function updateScopedRulesIndex(root2) {
35262
+ const directories = scopedRuleDirectories(root2);
35263
+ const rootFile = path77.join(root2, "CLAUDE.md");
35144
35264
  const before = existsSync69(rootFile) ? readFileSync54(rootFile, "utf8") : "";
35145
35265
  const after = upsertScopedRulesPointer(before, directories);
35146
35266
  if (after !== before) writeFileSync42(rootFile, after);
@@ -35159,9 +35279,9 @@ function addRule(text18, options2) {
35159
35279
  return;
35160
35280
  }
35161
35281
  const target = resolveRuleScope(options2.scope ?? process.cwd());
35162
- const targetDir = path73.dirname(target);
35163
- const root = findRepoRoot(targetDir) ?? targetDir;
35164
- const code = nextRuleCode(root);
35282
+ const targetDir = path78.dirname(target);
35283
+ const root2 = findRepoRoot(targetDir) ?? targetDir;
35284
+ const code = nextRuleCode(root2);
35165
35285
  writeFileSync43(
35166
35286
  target,
35167
35287
  insertRuleBullet(read2(target), {
@@ -35170,23 +35290,23 @@ function addRule(text18, options2) {
35170
35290
  text: rule
35171
35291
  })
35172
35292
  );
35173
- updateScopedRulesIndex(root);
35293
+ updateScopedRulesIndex(root2);
35174
35294
  console.log(
35175
- `Added ${chalk229.cyan(code)} to ${path73.relative(process.cwd(), target) || target}`
35295
+ `Added ${chalk229.cyan(code)} to ${path78.relative(process.cwd(), target) || target}`
35176
35296
  );
35177
35297
  }
35178
35298
 
35179
35299
  // src/commands/rules/indexRules.ts
35180
- import path74 from "path";
35300
+ import path79 from "path";
35181
35301
  import chalk230 from "chalk";
35182
35302
  function indexRules() {
35183
35303
  const startDir = scopeDirectory(process.cwd());
35184
- const root = findRepoRoot(startDir) ?? startDir;
35185
- const directories = updateScopedRulesIndex(root);
35186
- const rootFile = path74.relative(process.cwd(), path74.join(root, "CLAUDE.md"));
35304
+ const root2 = findRepoRoot(startDir) ?? startDir;
35305
+ const directories = updateScopedRulesIndex(root2);
35306
+ const rootFile = path79.relative(process.cwd(), path79.join(root2, "CLAUDE.md"));
35187
35307
  if (directories.length === 0) {
35188
35308
  console.log(
35189
- chalk230.gray(`No directories carry their own \`## Rules\` under ${root}`)
35309
+ chalk230.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35190
35310
  );
35191
35311
  return;
35192
35312
  }
@@ -35196,13 +35316,13 @@ function indexRules() {
35196
35316
  }
35197
35317
 
35198
35318
  // src/commands/rules/listRules.ts
35199
- import path75 from "path";
35319
+ import path80 from "path";
35200
35320
  import chalk231 from "chalk";
35201
35321
  function listRules(target, options2 = {}) {
35202
- const resolved = path75.resolve(target ?? process.cwd());
35322
+ const resolved = path80.resolve(target ?? process.cwd());
35203
35323
  const rules3 = readScopedRules(resolved);
35204
35324
  if (rules3.length === 0) {
35205
- const label2 = path75.relative(process.cwd(), resolved) || ".";
35325
+ const label2 = path80.relative(process.cwd(), resolved) || ".";
35206
35326
  console.log(chalk231.gray(`No rules in scope for ${label2}`));
35207
35327
  return;
35208
35328
  }
@@ -35213,7 +35333,7 @@ function listRules(target, options2 = {}) {
35213
35333
  if (rule.source !== shown) {
35214
35334
  shown = rule.source;
35215
35335
  console.log(
35216
- chalk231.dim(base ? path75.relative(base, rule.source) : rule.source)
35336
+ chalk231.dim(base ? path80.relative(base, rule.source) : rule.source)
35217
35337
  );
35218
35338
  }
35219
35339
  console.log(
@@ -35309,8 +35429,8 @@ import chalk237 from "chalk";
35309
35429
 
35310
35430
  // src/commands/seq/fetchSeq.ts
35311
35431
  import chalk234 from "chalk";
35312
- async function fetchSeq(conn, path91, params) {
35313
- const url = `${conn.url}${path91}?${params}`;
35432
+ async function fetchSeq(conn, path96, params) {
35433
+ const url = `${conn.url}${path96}?${params}`;
35314
35434
  const response = await fetch(url, {
35315
35435
  headers: {
35316
35436
  Accept: "application/json",
@@ -35691,7 +35811,7 @@ async function previewSlackThreadParts({
35691
35811
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35692
35812
  );
35693
35813
  paths.forEach(
35694
- (path91, index3) => console.log(`${index3 + 1}/${paths.length} ${path91}`)
35814
+ (path96, index3) => console.log(`${index3 + 1}/${paths.length} ${path96}`)
35695
35815
  );
35696
35816
  console.log(
35697
35817
  threadTs ? `Post every part as a reply with thread_ts ${threadTs}.` : `Post 1/${paths.length} to ${channel}, then the rest with the thread_ts it returns.`
@@ -36032,17 +36152,17 @@ function registerSql(program2) {
36032
36152
  }
36033
36153
 
36034
36154
  // src/commands/sync.ts
36035
- import * as fs49 from "fs";
36155
+ import * as fs48 from "fs";
36036
36156
  import * as os5 from "os";
36037
- import * as path86 from "path";
36157
+ import * as path91 from "path";
36038
36158
  import { fileURLToPath as fileURLToPath9 } from "url";
36039
36159
 
36040
36160
  // src/commands/sync/pruneCommands.ts
36041
- import * as path77 from "path";
36161
+ import * as path82 from "path";
36042
36162
 
36043
36163
  // src/commands/sync/pruneTarget.ts
36044
- import * as fs41 from "fs";
36045
- import * as path76 from "path";
36164
+ import * as fs40 from "fs";
36165
+ import * as path81 from "path";
36046
36166
  function pruneTarget(targetDir, keepNames, shape, options2) {
36047
36167
  const result = {
36048
36168
  orphans: [],
@@ -36050,9 +36170,9 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36050
36170
  skipped: [],
36051
36171
  unmanaged: []
36052
36172
  };
36053
- if (!fs41.existsSync(targetDir)) return result;
36173
+ if (!fs40.existsSync(targetDir)) return result;
36054
36174
  const keep = new Set(keepNames);
36055
- for (const entry of fs41.readdirSync(targetDir, { withFileTypes: true })) {
36175
+ for (const entry of fs40.readdirSync(targetDir, { withFileTypes: true })) {
36056
36176
  const name = shape.nameOf(entry);
36057
36177
  if (name === void 0) {
36058
36178
  result.unmanaged.push(entry.name);
@@ -36060,14 +36180,14 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36060
36180
  }
36061
36181
  if (keep.has(name)) continue;
36062
36182
  result.orphans.push(entry.name);
36063
- const entryPath = path76.join(targetDir, entry.name);
36183
+ const entryPath = path81.join(targetDir, entry.name);
36064
36184
  const reason4 = shape.blockedBy?.(entryPath);
36065
36185
  if (reason4) {
36066
36186
  result.skipped.push({ name: entry.name, reason: reason4 });
36067
36187
  continue;
36068
36188
  }
36069
36189
  if (options2.force) {
36070
- fs41.rmSync(entryPath, { recursive: true });
36190
+ fs40.rmSync(entryPath, { recursive: true });
36071
36191
  result.removed.push(entry.name);
36072
36192
  }
36073
36193
  }
@@ -36080,7 +36200,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36080
36200
  targetDir,
36081
36201
  commandNames,
36082
36202
  {
36083
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path77.basename(entry.name, ".md") : void 0
36203
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path82.basename(entry.name, ".md") : void 0
36084
36204
  },
36085
36205
  options2
36086
36206
  );
@@ -36114,15 +36234,15 @@ function reportPrune(label2, result, force) {
36114
36234
  }
36115
36235
 
36116
36236
  // src/commands/sync/reportRetiredAgentsFiles.ts
36117
- import * as fs42 from "fs";
36118
- import * as path78 from "path";
36237
+ import * as fs41 from "fs";
36238
+ import * as path83 from "path";
36119
36239
  var retired = [
36120
- path78.join(harnesses.claude.homeDir, "CLAUDE.md"),
36121
- path78.join(harnesses.codex.homeDir, "AGENTS.md"),
36122
- path78.join(harnesses.pi.homeDir, "AGENTS.md")
36240
+ path83.join(harnesses.claude.homeDir, "CLAUDE.md"),
36241
+ path83.join(harnesses.codex.homeDir, "AGENTS.md"),
36242
+ path83.join(harnesses.pi.homeDir, "AGENTS.md")
36123
36243
  ];
36124
36244
  function reportRetiredAgentsFiles() {
36125
- const leftovers = retired.filter((file) => fs42.existsSync(file));
36245
+ const leftovers = retired.filter((file) => fs41.existsSync(file));
36126
36246
  if (leftovers.length === 0) return;
36127
36247
  console.log(
36128
36248
  "No longer written by sync \u2014 each harness now composes its own advice at session start:"
@@ -36134,31 +36254,31 @@ function reportRetiredAgentsFiles() {
36134
36254
  }
36135
36255
 
36136
36256
  // src/commands/sync/syncCodex.ts
36137
- import * as path81 from "path";
36257
+ import * as path86 from "path";
36138
36258
 
36139
36259
  // src/commands/sync/installHarnessCommands.ts
36140
- import * as fs43 from "fs";
36141
- import * as path79 from "path";
36260
+ import * as fs42 from "fs";
36261
+ import * as path84 from "path";
36142
36262
  function installHarnessCommands(claudeDir, harness, transform) {
36143
- const commandsSource = path79.join(claudeDir, "commands");
36144
- const files = fs43.readdirSync(commandsSource);
36145
- const names = [];
36263
+ const commandsSource = path84.join(claudeDir, "commands");
36264
+ const files = fs42.readdirSync(commandsSource);
36265
+ const names2 = [];
36146
36266
  let synced = 0;
36147
36267
  for (const file of files) {
36148
36268
  if (!file.endsWith(".md")) continue;
36149
36269
  const name = file.replace(/\.md$/, "");
36150
- names.push(name);
36151
- const content = fs43.readFileSync(path79.join(commandsSource, file), "utf8");
36152
- const target = path79.join(harness.homeDir, harness.sync.commandDest(name));
36153
- fs43.mkdirSync(path79.dirname(target), { recursive: true });
36154
- fs43.writeFileSync(target, transform(name, content));
36270
+ names2.push(name);
36271
+ const content = fs42.readFileSync(path84.join(commandsSource, file), "utf8");
36272
+ const target = path84.join(harness.homeDir, harness.sync.commandDest(name));
36273
+ fs42.mkdirSync(path84.dirname(target), { recursive: true });
36274
+ fs42.writeFileSync(target, transform(name, content));
36155
36275
  synced++;
36156
36276
  }
36157
- return { total: files.length, synced, names };
36277
+ return { total: files.length, synced, names: names2 };
36158
36278
  }
36159
36279
 
36160
36280
  // src/commands/sync/pruneSkills.ts
36161
- import * as fs44 from "fs";
36281
+ import * as fs43 from "fs";
36162
36282
  function pruneSkills(targetDir, skillNames, options2) {
36163
36283
  return pruneTarget(
36164
36284
  targetDir,
@@ -36171,15 +36291,15 @@ function pruneSkills(targetDir, skillNames, options2) {
36171
36291
  );
36172
36292
  }
36173
36293
  function unexpectedContent(skillDir) {
36174
- const entries = fs44.readdirSync(skillDir);
36294
+ const entries = fs43.readdirSync(skillDir);
36175
36295
  const others = entries.filter((entry) => entry !== "SKILL.md");
36176
36296
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
36177
36297
  return entries.length === 0 ? "no SKILL.md" : void 0;
36178
36298
  }
36179
36299
 
36180
36300
  // src/commands/sync/syncCodexHooks.ts
36181
- import * as fs45 from "fs";
36182
- import * as path80 from "path";
36301
+ import * as fs44 from "fs";
36302
+ import * as path85 from "path";
36183
36303
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36184
36304
  var END = "# <<< assist codex hooks (managed) <<<";
36185
36305
  function upsertManagedBlock(existing, body) {
@@ -36209,11 +36329,11 @@ ${rest}
36209
36329
  `;
36210
36330
  }
36211
36331
  function syncCodexHooks(sourcePath) {
36212
- const body = fs45.readFileSync(sourcePath, "utf8");
36213
- const configPath = path80.join(harnesses.codex.homeDir, "config.toml");
36214
- const existing = fs45.existsSync(configPath) ? fs45.readFileSync(configPath, "utf8") : "";
36215
- fs45.mkdirSync(path80.dirname(configPath), { recursive: true });
36216
- fs45.writeFileSync(configPath, upsertManagedBlock(existing, body));
36332
+ const body = fs44.readFileSync(sourcePath, "utf8");
36333
+ const configPath = path85.join(harnesses.codex.homeDir, "config.toml");
36334
+ const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
36335
+ fs44.mkdirSync(path85.dirname(configPath), { recursive: true });
36336
+ fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
36217
36337
  console.log(
36218
36338
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
36219
36339
  );
@@ -36239,62 +36359,62 @@ description: ${quoteYaml(description)}
36239
36359
  }
36240
36360
  function syncCodex(claudeDir, options2) {
36241
36361
  if (!isHarnessAvailable("codex")) return;
36242
- const { total, names } = installHarnessCommands(
36362
+ const { total, names: names2 } = installHarnessCommands(
36243
36363
  claudeDir,
36244
36364
  harnesses.codex,
36245
36365
  commandToSkill
36246
36366
  );
36247
- syncCodexHooks(path81.join(claudeDir, "..", "codex", "config.toml"));
36367
+ syncCodexHooks(path86.join(claudeDir, "..", "codex", "config.toml"));
36248
36368
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36249
36369
  if (!options2?.prune) return;
36250
36370
  const force = options2.force ?? false;
36251
36371
  reportPrune(
36252
36372
  "~/.codex/skills",
36253
- pruneSkills(path81.join(harnesses.codex.homeDir, "skills"), names, { force }),
36373
+ pruneSkills(path86.join(harnesses.codex.homeDir, "skills"), names2, { force }),
36254
36374
  force
36255
36375
  );
36256
36376
  }
36257
36377
 
36258
36378
  // src/commands/sync/syncDesign.ts
36259
- import * as fs46 from "fs";
36260
- import * as path82 from "path";
36379
+ import * as fs45 from "fs";
36380
+ import * as path87 from "path";
36261
36381
  function syncDesign(claudeDir, targetBase) {
36262
- const systemPromptSource = path82.join(claudeDir, "design-system-prompt.md");
36263
- const systemPromptTarget = path82.join(targetBase, "design-system-prompt.md");
36264
- fs46.copyFileSync(systemPromptSource, systemPromptTarget);
36382
+ const systemPromptSource = path87.join(claudeDir, "design-system-prompt.md");
36383
+ const systemPromptTarget = path87.join(targetBase, "design-system-prompt.md");
36384
+ fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36265
36385
  console.log(
36266
36386
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36267
36387
  );
36268
- const skillsSource = path82.join(claudeDir, "skills");
36269
- const skillsTarget = path82.join(targetBase, "skills");
36270
- fs46.mkdirSync(skillsTarget, { recursive: true });
36271
- const files = fs46.readdirSync(skillsSource);
36388
+ const skillsSource = path87.join(claudeDir, "skills");
36389
+ const skillsTarget = path87.join(targetBase, "skills");
36390
+ fs45.mkdirSync(skillsTarget, { recursive: true });
36391
+ const files = fs45.readdirSync(skillsSource);
36272
36392
  for (const file of files) {
36273
- fs46.copyFileSync(
36274
- path82.join(skillsSource, file),
36275
- path82.join(skillsTarget, file)
36393
+ fs45.copyFileSync(
36394
+ path87.join(skillsSource, file),
36395
+ path87.join(skillsTarget, file)
36276
36396
  );
36277
36397
  }
36278
36398
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36279
36399
  }
36280
36400
 
36281
36401
  // src/commands/sync/syncPi.ts
36282
- import * as path84 from "path";
36402
+ import * as path89 from "path";
36283
36403
 
36284
36404
  // src/commands/sync/syncPiHooks.ts
36285
- import * as fs47 from "fs";
36286
- import * as path83 from "path";
36405
+ import * as fs46 from "fs";
36406
+ import * as path88 from "path";
36287
36407
  function piExtensionsDir() {
36288
- return path83.join(harnesses.pi.homeDir, "extensions");
36408
+ return path88.join(harnesses.pi.homeDir, "extensions");
36289
36409
  }
36290
36410
  function syncPiHooks(sourceDir) {
36291
36411
  const target = piExtensionsDir();
36292
- fs47.mkdirSync(target, { recursive: true });
36293
- const files = fs47.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36412
+ fs46.mkdirSync(target, { recursive: true });
36413
+ const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36294
36414
  for (const file of files) {
36295
- fs47.copyFileSync(
36296
- path83.join(sourceDir, file),
36297
- path83.join(target, `assist-${file}`)
36415
+ fs46.copyFileSync(
36416
+ path88.join(sourceDir, file),
36417
+ path88.join(target, `assist-${file}`)
36298
36418
  );
36299
36419
  }
36300
36420
  console.log(
@@ -36326,33 +36446,33 @@ function commandToPrompt(name, content) {
36326
36446
  }
36327
36447
  function syncPi(claudeDir, options2) {
36328
36448
  if (!isHarnessAvailable("pi")) return;
36329
- const { synced, names } = installHarnessCommands(
36449
+ const { synced, names: names2 } = installHarnessCommands(
36330
36450
  claudeDir,
36331
36451
  harnesses.pi,
36332
36452
  commandToPrompt
36333
36453
  );
36334
- syncPiHooks(path84.join(claudeDir, "..", "pi"));
36454
+ syncPiHooks(path89.join(claudeDir, "..", "pi"));
36335
36455
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36336
36456
  if (!options2?.prune) return;
36337
36457
  const force = options2.force ?? false;
36338
36458
  reportPrune(
36339
36459
  "~/.pi/agent/prompts",
36340
- pruneCommands(path84.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36460
+ pruneCommands(path89.join(harnesses.pi.homeDir, "prompts"), names2, { force }),
36341
36461
  force
36342
36462
  );
36343
36463
  }
36344
36464
 
36345
36465
  // src/commands/sync/syncSettings.ts
36346
- import * as fs48 from "fs";
36347
- import * as path85 from "path";
36466
+ import * as fs47 from "fs";
36467
+ import * as path90 from "path";
36348
36468
  import chalk244 from "chalk";
36349
36469
  async function syncSettings(claudeDir, targetBase, options2) {
36350
- const source = path85.join(claudeDir, "settings.json");
36351
- const target = path85.join(targetBase, "settings.json");
36352
- const sourceContent = fs48.readFileSync(source, "utf8");
36470
+ const source = path90.join(claudeDir, "settings.json");
36471
+ const target = path90.join(targetBase, "settings.json");
36472
+ const sourceContent = fs47.readFileSync(source, "utf8");
36353
36473
  const sourceSettings = JSON.parse(sourceContent);
36354
- const targetExists = fs48.existsSync(target);
36355
- const targetContent = targetExists ? fs48.readFileSync(target, "utf8") : "";
36474
+ const targetExists = fs47.existsSync(target);
36475
+ const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
36356
36476
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
36357
36477
  const mergedContent = JSON.stringify(
36358
36478
  { ...preservedUserSettings, ...sourceSettings },
@@ -36382,19 +36502,19 @@ async function syncSettings(claudeDir, targetBase, options2) {
36382
36502
  }
36383
36503
  }
36384
36504
  }
36385
- fs48.writeFileSync(target, mergedContent);
36505
+ fs47.writeFileSync(target, mergedContent);
36386
36506
  console.log("Copied settings.json to ~/.claude/settings.json");
36387
36507
  }
36388
36508
 
36389
36509
  // src/commands/sync.ts
36390
36510
  var __filename4 = fileURLToPath9(import.meta.url);
36391
- var __dirname5 = path86.dirname(__filename4);
36511
+ var __dirname5 = path91.dirname(__filename4);
36392
36512
  async function sync(options2) {
36393
36513
  const config = loadConfig();
36394
36514
  const yes = options2?.yes ?? config.sync.autoConfirm;
36395
36515
  const prune = { prune: options2?.prune, force: options2?.force };
36396
- const claudeDir = path86.join(__dirname5, "..", "claude");
36397
- const targetBase = path86.join(os5.homedir(), ".claude");
36516
+ const claudeDir = path91.join(__dirname5, "..", "claude");
36517
+ const targetBase = path91.join(os5.homedir(), ".claude");
36398
36518
  const commandFiles = syncCommands(claudeDir, targetBase);
36399
36519
  syncDesign(claudeDir, targetBase);
36400
36520
  await syncSettings(claudeDir, targetBase, { yes });
@@ -36402,21 +36522,21 @@ async function sync(options2) {
36402
36522
  syncPi(claudeDir, prune);
36403
36523
  reportRetiredAgentsFiles();
36404
36524
  if (!options2?.prune) return;
36405
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path86.basename(file, ".md"));
36525
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path91.basename(file, ".md"));
36406
36526
  const force = options2.force ?? false;
36407
36527
  reportPrune(
36408
36528
  "~/.claude/commands",
36409
- pruneCommands(path86.join(targetBase, "commands"), commandNames, { force }),
36529
+ pruneCommands(path91.join(targetBase, "commands"), commandNames, { force }),
36410
36530
  force
36411
36531
  );
36412
36532
  }
36413
36533
  function syncCommands(claudeDir, targetBase) {
36414
- const sourceDir = path86.join(claudeDir, "commands");
36415
- const targetDir = path86.join(targetBase, "commands");
36416
- fs49.mkdirSync(targetDir, { recursive: true });
36417
- const files = fs49.readdirSync(sourceDir);
36534
+ const sourceDir = path91.join(claudeDir, "commands");
36535
+ const targetDir = path91.join(targetBase, "commands");
36536
+ fs48.mkdirSync(targetDir, { recursive: true });
36537
+ const files = fs48.readdirSync(sourceDir);
36418
36538
  for (const file of files) {
36419
- fs49.copyFileSync(path86.join(sourceDir, file), path86.join(targetDir, file));
36539
+ fs48.copyFileSync(path91.join(sourceDir, file), path91.join(targetDir, file));
36420
36540
  console.log(`Copied ${file} to ${targetDir}`);
36421
36541
  }
36422
36542
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -36564,8 +36684,8 @@ function mergeOverlappingCues(cues) {
36564
36684
  }
36565
36685
  function deduplicateCues(cues) {
36566
36686
  if (cues.length === 0) return [];
36567
- const sorted = [...cues].sort((a, b) => a.startMs - b.startMs);
36568
- const withoutSubstrings = removeSubstringDuplicates(sorted);
36687
+ const sorted2 = [...cues].sort((a, b) => a.startMs - b.startMs);
36688
+ const withoutSubstrings = removeSubstringDuplicates(sorted2);
36569
36689
  const merged = mergeOverlappingCues(withoutSubstrings);
36570
36690
  return merged.map((cue) => ({
36571
36691
  ...cue,
@@ -37482,8 +37602,8 @@ function changedPaths(from, cwd) {
37482
37602
  import { join as join98 } from "path";
37483
37603
  function readBuiltVersion(cwd) {
37484
37604
  try {
37485
- const root = runGit3(["rev-parse", "--show-toplevel"], cwd);
37486
- return readPackageJson(join98(root, "package.json")).version ?? "unknown";
37605
+ const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
37606
+ return readPackageJson(join98(root2, "package.json")).version ?? "unknown";
37487
37607
  } catch {
37488
37608
  return "unknown";
37489
37609
  }
@@ -37540,11 +37660,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
37540
37660
  var sessionsPrefix = "src/commands/sessions/";
37541
37661
  var rules = [
37542
37662
  {
37543
- matches: (path91) => path91.startsWith(webUiPrefix),
37663
+ matches: (path96) => path96.startsWith(webUiPrefix),
37544
37664
  advice: "restart the web server, then hard-reload the browser tab"
37545
37665
  },
37546
37666
  {
37547
- matches: (path91) => path91.startsWith(sessionsPrefix) && !path91.startsWith(webUiPrefix),
37667
+ matches: (path96) => path96.startsWith(sessionsPrefix) && !path96.startsWith(webUiPrefix),
37548
37668
  advice: "restart the daemon"
37549
37669
  }
37550
37670
  ];
@@ -37555,27 +37675,27 @@ function restartAdvice(paths) {
37555
37675
  // src/commands/watch/syncAdvice.ts
37556
37676
  var rules2 = [
37557
37677
  {
37558
- matches: (path91) => path91.startsWith("claude/commands/"),
37678
+ matches: (path96) => path96.startsWith("claude/commands/"),
37559
37679
  reason: "claude/commands changed"
37560
37680
  },
37561
37681
  {
37562
- matches: (path91) => path91.startsWith("claude/skills/"),
37682
+ matches: (path96) => path96.startsWith("claude/skills/"),
37563
37683
  reason: "claude/skills changed"
37564
37684
  },
37565
37685
  {
37566
- matches: (path91) => path91 === "claude/settings.json",
37686
+ matches: (path96) => path96 === "claude/settings.json",
37567
37687
  reason: "claude/settings.json changed"
37568
37688
  },
37569
37689
  {
37570
- matches: (path91) => path91 === "claude/design-system-prompt.md",
37690
+ matches: (path96) => path96 === "claude/design-system-prompt.md",
37571
37691
  reason: "claude/design-system-prompt.md changed"
37572
37692
  },
37573
37693
  {
37574
- matches: (path91) => path91.startsWith("codex/"),
37694
+ matches: (path96) => path96.startsWith("codex/"),
37575
37695
  reason: "codex sources changed"
37576
37696
  },
37577
37697
  {
37578
- matches: (path91) => path91.startsWith("pi/"),
37698
+ matches: (path96) => path96.startsWith("pi/"),
37579
37699
  reason: "pi sources changed"
37580
37700
  }
37581
37701
  ];
@@ -37721,11 +37841,11 @@ function stashDirtyTree(cwd) {
37721
37841
  return { ok: false, reason: gitFailureReason(error) };
37722
37842
  }
37723
37843
  if (!dirty) return { ok: true, stashed: false };
37724
- const push = attemptGit(
37844
+ const push2 = attemptGit(
37725
37845
  ["stash", "push", "--include-untracked", "--message", STASH_MESSAGE],
37726
37846
  cwd
37727
37847
  );
37728
- return push.ok ? { ok: true, stashed: true } : push;
37848
+ return push2.ok ? { ok: true, stashed: true } : push2;
37729
37849
  }
37730
37850
  function mergeBehindBranch(cwd) {
37731
37851
  const stash = stashDirtyTree(cwd);
@@ -37807,8 +37927,8 @@ function resolveParams(params, cliArgs) {
37807
37927
  }
37808
37928
  if (missing.length > 0) {
37809
37929
  const s = missing.length > 1 ? "s" : "";
37810
- const names = missing.map((n) => `"${n}"`).join(", ");
37811
- console.error(`Missing required param${s}: ${names}`);
37930
+ const names2 = missing.map((n) => `"${n}"`).join(", ");
37931
+ console.error(`Missing required param${s}: ${names2}`);
37812
37932
  process.exit(1);
37813
37933
  }
37814
37934
  resolved.push(...cliArgs.slice(params.length));
@@ -38003,7 +38123,7 @@ function pollForMovement(options2) {
38003
38123
  const { upstream, intervalMs, timeoutMs, timeout, cwd } = options2;
38004
38124
  return new Promise((resolve25) => {
38005
38125
  let settled = false;
38006
- const finish = (outcome) => {
38126
+ const finish2 = (outcome) => {
38007
38127
  if (settled) return;
38008
38128
  settled = true;
38009
38129
  clearInterval(ticker);
@@ -38011,14 +38131,14 @@ function pollForMovement(options2) {
38011
38131
  process.off("SIGINT", onInterrupt);
38012
38132
  resolve25(outcome);
38013
38133
  };
38014
- const onInterrupt = () => finish({ kind: "interrupted" });
38134
+ const onInterrupt = () => finish2({ kind: "interrupted" });
38015
38135
  const ticker = setInterval(() => {
38016
38136
  fetchQuietly(cwd, intervalMs);
38017
38137
  const found = readMovement(cwd);
38018
- if (found) finish({ kind: "moved", upstream, ...found });
38138
+ if (found) finish2({ kind: "moved", upstream, ...found });
38019
38139
  }, intervalMs);
38020
38140
  const deadline = timeoutMs === void 0 ? void 0 : setTimeout(
38021
- () => finish({ kind: "timeout", upstream, timeout }),
38141
+ () => finish2({ kind: "timeout", upstream, timeout }),
38022
38142
  timeoutMs
38023
38143
  );
38024
38144
  process.on("SIGINT", onInterrupt);
@@ -38283,9 +38403,9 @@ function findPortFile(roamDir) {
38283
38403
  return void 0;
38284
38404
  }
38285
38405
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
38286
- const path91 = join100(roamDir, name);
38406
+ const path96 = join100(roamDir, name);
38287
38407
  try {
38288
- return { path: path91, mtimeMs: statSync13(path91).mtimeMs };
38408
+ return { path: path96, mtimeMs: statSync13(path96).mtimeMs };
38289
38409
  } catch {
38290
38410
  return void 0;
38291
38411
  }
@@ -38356,10 +38476,10 @@ function formatConfiguredCommands() {
38356
38476
  const { run: entries } = loadConfig();
38357
38477
  const configs = resolveRunConfigs(entries, runConfigBaseDir());
38358
38478
  if (configs.length === 0) return "\nNo configured commands";
38359
- const names = configs.map((r) => ` ${r.name}`).join("\n");
38479
+ const names2 = configs.map((r) => ` ${r.name}`).join("\n");
38360
38480
  return `
38361
38481
  Configured commands:
38362
- ${names}`;
38482
+ ${names2}`;
38363
38483
  }
38364
38484
 
38365
38485
  // src/commands/run/spawnRunCommand.ts
@@ -38509,7 +38629,7 @@ Run \`assist run ${name} $ARGUMENTS 2>&1\`.
38509
38629
  writeFileSync53(filePath, content);
38510
38630
  console.log(`Created command file: ${filePath}`);
38511
38631
  }
38512
- function add3() {
38632
+ function add4() {
38513
38633
  const { name, command, args, cwd } = requireParsedArgs();
38514
38634
  saveNewRunConfig(name, command, args, cwd);
38515
38635
  if (!name.startsWith("verify:")) {
@@ -38529,11 +38649,11 @@ function findLinkIndex() {
38529
38649
  function parseLinkArgs() {
38530
38650
  const idx = findLinkIndex();
38531
38651
  if (idx === -1) return null;
38532
- const path91 = process.argv[idx + 1];
38652
+ const path96 = process.argv[idx + 1];
38533
38653
  const rest = process.argv.slice(idx + 2);
38534
38654
  const { value: prefix2 } = extractOption(rest, "--prefix");
38535
38655
  if (!prefix2) return null;
38536
- return { path: path91, prefix: prefix2 };
38656
+ return { path: path96, prefix: prefix2 };
38537
38657
  }
38538
38658
  function hasDuplicateLink(runList, linkPath) {
38539
38659
  return runList.some(
@@ -38606,7 +38726,7 @@ function registerRunSubcommands(runCommand) {
38606
38726
  ).addHelpText(
38607
38727
  "after",
38608
38728
  '\nPositional params can be added to the config manually:\n params:\n - name: env # assist run deploy prod \u2192 appends "prod"\n required: true\n - name: tag\n default: latest'
38609
- ).allowUnknownOption().allowExcessArguments().action(() => add3());
38729
+ ).allowUnknownOption().allowExcessArguments().action(() => add4());
38610
38730
  runCommand.command("link").description("Link run configurations from another project's assist.yml").argument("<path>", "Relative path to the linked project").requiredOption("--prefix <prefix>", "Namespace prefix for linked commands").allowUnknownOption().action(() => link2());
38611
38731
  runCommand.command("remove").description("Remove a run configuration from assist.yml").argument("<name>", "Name of the run configuration to remove").action(() => remove());
38612
38732
  }
@@ -38749,16 +38869,16 @@ function clearPersistedSessionsOnDrain() {
38749
38869
  // src/commands/sessions/daemon/readDaemonMessage.ts
38750
38870
  function readDaemonMessage(lines2, timeoutMs, fallback, match) {
38751
38871
  return new Promise((resolve25) => {
38752
- const finish = (value) => {
38872
+ const finish2 = (value) => {
38753
38873
  clearTimeout(timer);
38754
38874
  lines2.off("line", onLine);
38755
38875
  resolve25(value);
38756
38876
  };
38757
- const timer = setTimeout(() => finish(fallback), timeoutMs);
38877
+ const timer = setTimeout(() => finish2(fallback), timeoutMs);
38758
38878
  const onLine = (line) => {
38759
38879
  try {
38760
38880
  const matched = match(JSON.parse(line));
38761
- if (matched !== void 0) finish(matched);
38881
+ if (matched !== void 0) finish2(matched);
38762
38882
  } catch {
38763
38883
  }
38764
38884
  };
@@ -39135,14 +39255,14 @@ import * as pty from "node-pty";
39135
39255
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
39136
39256
  import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
39137
39257
  import { createRequire as createRequire3 } from "module";
39138
- import path87 from "path";
39258
+ import path92 from "path";
39139
39259
  var require4 = createRequire3(import.meta.url);
39140
39260
  var ensured = false;
39141
39261
  function ensureSpawnHelperExecutable() {
39142
39262
  if (ensured || process.platform !== "darwin") return;
39143
39263
  ensured = true;
39144
- const ptyRoot = path87.join(path87.dirname(require4.resolve("node-pty")), "..");
39145
- const helper = path87.join(
39264
+ const ptyRoot = path92.join(path92.dirname(require4.resolve("node-pty")), "..");
39265
+ const helper = path92.join(
39146
39266
  ptyRoot,
39147
39267
  "prebuilds",
39148
39268
  `${process.platform}-${process.arch}`,
@@ -39272,19 +39392,19 @@ function serverRunMeta(runName, cwd) {
39272
39392
  }
39273
39393
 
39274
39394
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
39275
- import * as fs50 from "fs";
39276
- import * as path88 from "path";
39395
+ import * as fs49 from "fs";
39396
+ import * as path93 from "path";
39277
39397
  import { fileURLToPath as fileURLToPath11 } from "url";
39278
39398
  var __filename5 = fileURLToPath11(import.meta.url);
39279
- var __dirname7 = path88.dirname(__filename5);
39399
+ var __dirname7 = path93.dirname(__filename5);
39280
39400
  function readDesignSystemPrompt() {
39281
- const promptPath = path88.join(
39401
+ const promptPath = path93.join(
39282
39402
  __dirname7,
39283
39403
  "..",
39284
39404
  "claude",
39285
39405
  "design-system-prompt.md"
39286
39406
  );
39287
- return fs50.readFileSync(promptPath, "utf8");
39407
+ return fs49.readFileSync(promptPath, "utf8");
39288
39408
  }
39289
39409
 
39290
39410
  // src/commands/sessions/daemon/spawnClaude.ts
@@ -40309,8 +40429,8 @@ async function seedRunningMsFromUsage(session, notify2) {
40309
40429
  var DEBOUNCE_MS2 = 50;
40310
40430
  function watchActivity(session, notify2, onClaudeSessionId) {
40311
40431
  if (session.commandType !== "assist" || !session.cwd) return;
40312
- const path91 = activityPath(session.id);
40313
- const dir = dirname42(path91);
40432
+ const path96 = activityPath(session.id);
40433
+ const dir = dirname42(path96);
40314
40434
  try {
40315
40435
  mkdirSync37(dir, { recursive: true });
40316
40436
  } catch {
@@ -40320,7 +40440,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40320
40440
  let timer = null;
40321
40441
  const read3 = () => {
40322
40442
  timer = null;
40323
- const activity2 = readActivity(path91);
40443
+ const activity2 = readActivity(path96);
40324
40444
  if (!activity2) return;
40325
40445
  applyActivityToSession(session, activity2);
40326
40446
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -40329,11 +40449,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40329
40449
  notify2();
40330
40450
  };
40331
40451
  session.activityWatcher = watch2(dir, (_event, filename) => {
40332
- if (filename && !path91.endsWith(filename)) return;
40452
+ if (filename && !path96.endsWith(filename)) return;
40333
40453
  if (timer) clearTimeout(timer);
40334
40454
  timer = setTimeout(read3, DEBOUNCE_MS2);
40335
40455
  });
40336
- if (existsSync94(path91)) read3();
40456
+ if (existsSync94(path96)) read3();
40337
40457
  }
40338
40458
  function refreshActivity(session) {
40339
40459
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -40412,7 +40532,7 @@ function reportSilentFailure(session, clients) {
40412
40532
  }
40413
40533
 
40414
40534
  // src/commands/sessions/shared/codex/resolveCodexSessionId.ts
40415
- import * as fs51 from "fs";
40535
+ import * as fs50 from "fs";
40416
40536
  var META_LINES = 5;
40417
40537
  async function resolveCodexSessionId(cwd, sinceMs) {
40418
40538
  if (!cwd) return null;
@@ -40441,7 +40561,7 @@ async function startedIn(file, cwd, sinceMs) {
40441
40561
  }
40442
40562
  async function touchedSince(file, sinceMs) {
40443
40563
  try {
40444
- return (await fs51.promises.stat(file)).mtimeMs >= sinceMs;
40564
+ return (await fs50.promises.stat(file)).mtimeMs >= sinceMs;
40445
40565
  } catch {
40446
40566
  return false;
40447
40567
  }
@@ -40475,42 +40595,42 @@ function bindCodexSession(session, notify2) {
40475
40595
  import { watch as watch3 } from "fs";
40476
40596
 
40477
40597
  // src/commands/sessions/shared/findTranscriptPathSync.ts
40478
- import * as fs52 from "fs";
40479
- import * as path89 from "path";
40598
+ import * as fs51 from "fs";
40599
+ import * as path94 from "path";
40480
40600
  function projectDirForCwd(cwd) {
40481
- return path89.join(claudeProjectsRoot(), projectSlug(cwd));
40601
+ return path94.join(claudeProjectsRoot(), projectSlug(cwd));
40482
40602
  }
40483
40603
  function transcriptPathFor(cwd, claudeSessionId) {
40484
- return path89.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40604
+ return path94.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40485
40605
  }
40486
40606
  function findTranscriptPathSync(cwd, claudeSessionId) {
40487
40607
  const direct = transcriptPathFor(cwd, claudeSessionId);
40488
- if (fs52.existsSync(direct)) return direct;
40608
+ if (fs51.existsSync(direct)) return direct;
40489
40609
  const dir = projectDirForCwd(cwd);
40490
40610
  let files;
40491
40611
  try {
40492
- files = fs52.readdirSync(dir);
40612
+ files = fs51.readdirSync(dir);
40493
40613
  } catch {
40494
40614
  return null;
40495
40615
  }
40496
40616
  for (const file of files) {
40497
40617
  if (!file.endsWith(".jsonl")) continue;
40498
- if (headContainsSessionId(path89.join(dir, file), claudeSessionId))
40499
- return path89.join(dir, file);
40618
+ if (headContainsSessionId(path94.join(dir, file), claudeSessionId))
40619
+ return path94.join(dir, file);
40500
40620
  }
40501
40621
  return null;
40502
40622
  }
40503
40623
  function headContainsSessionId(filePath, claudeSessionId) {
40504
40624
  let fd;
40505
40625
  try {
40506
- fd = fs52.openSync(filePath, "r");
40626
+ fd = fs51.openSync(filePath, "r");
40507
40627
  const buf = Buffer.alloc(16384);
40508
- const bytesRead = fs52.readSync(fd, buf, 0, buf.length, 0);
40628
+ const bytesRead = fs51.readSync(fd, buf, 0, buf.length, 0);
40509
40629
  return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
40510
40630
  } catch {
40511
40631
  return false;
40512
40632
  } finally {
40513
- if (fd !== void 0) fs52.closeSync(fd);
40633
+ if (fd !== void 0) fs51.closeSync(fd);
40514
40634
  }
40515
40635
  }
40516
40636
 
@@ -40680,7 +40800,7 @@ function asRecord3(value) {
40680
40800
  }
40681
40801
 
40682
40802
  // src/commands/sessions/shared/readTranscriptTail.ts
40683
- import * as fs53 from "fs";
40803
+ import * as fs52 from "fs";
40684
40804
  var DEFAULT_MAX_BYTES = 256 * 1024;
40685
40805
  function parseTailEntries(raw) {
40686
40806
  const entries = [];
@@ -40704,7 +40824,7 @@ function dropPartialFirstLine(raw, sliced) {
40704
40824
  async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40705
40825
  let handle;
40706
40826
  try {
40707
- handle = await fs53.promises.open(filePath, "r");
40827
+ handle = await fs52.promises.open(filePath, "r");
40708
40828
  const { size } = await handle.stat();
40709
40829
  const start3 = Math.max(0, size - maxBytes);
40710
40830
  const length = size - start3;
@@ -40723,20 +40843,20 @@ async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40723
40843
  function readTranscriptTailSync(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40724
40844
  let fd;
40725
40845
  try {
40726
- fd = fs53.openSync(filePath, "r");
40727
- const { size } = fs53.fstatSync(fd);
40846
+ fd = fs52.openSync(filePath, "r");
40847
+ const { size } = fs52.fstatSync(fd);
40728
40848
  const start3 = Math.max(0, size - maxBytes);
40729
40849
  const length = size - start3;
40730
40850
  if (length === 0) return [];
40731
40851
  const buf = Buffer.alloc(length);
40732
- fs53.readSync(fd, buf, 0, length, start3);
40852
+ fs52.readSync(fd, buf, 0, length, start3);
40733
40853
  return parseTailEntries(
40734
40854
  dropPartialFirstLine(buf.toString("utf8"), start3 > 0)
40735
40855
  );
40736
40856
  } catch {
40737
40857
  return [];
40738
40858
  } finally {
40739
- if (fd !== void 0) fs53.closeSync(fd);
40859
+ if (fd !== void 0) fs52.closeSync(fd);
40740
40860
  }
40741
40861
  }
40742
40862
 
@@ -41042,7 +41162,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
41042
41162
  }
41043
41163
 
41044
41164
  // src/commands/sessions/shared/transcriptUsage.ts
41045
- import * as fs54 from "fs";
41165
+ import * as fs53 from "fs";
41046
41166
  function transcriptUsage(lines2) {
41047
41167
  const byId = /* @__PURE__ */ new Map();
41048
41168
  for (const line of lines2) {
@@ -41066,7 +41186,7 @@ function transcriptUsage(lines2) {
41066
41186
  return [...byId.values()];
41067
41187
  }
41068
41188
  async function readTranscriptUsage(transcriptPath2) {
41069
- const content = await fs54.promises.readFile(transcriptPath2, "utf8");
41189
+ const content = await fs53.promises.readFile(transcriptPath2, "utf8");
41070
41190
  return transcriptUsage(content.split("\n"));
41071
41191
  }
41072
41192
 
@@ -41670,9 +41790,9 @@ function tempRoots() {
41670
41790
  }
41671
41791
  return [...roots];
41672
41792
  }
41673
- function underTempRoot(path91) {
41793
+ function underTempRoot(path96) {
41674
41794
  return tempRoots().some(
41675
- (root) => path91.startsWith(root.endsWith(sep3) ? root : root + sep3)
41795
+ (root2) => path96.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
41676
41796
  );
41677
41797
  }
41678
41798
 
@@ -42017,7 +42137,7 @@ function restoreAll(spawner, sessions) {
42017
42137
  const persisted = dropTempRootedSessions(loadPersistedSessions());
42018
42138
  const cap2 = sessionLimits.maxRestore();
42019
42139
  const restoredIds = /* @__PURE__ */ new Map();
42020
- const names = persisted.slice(0, cap2).map((entry) => {
42140
+ const names2 = persisted.slice(0, cap2).map((entry) => {
42021
42141
  const id = restoreOne(entry, spawner, sessions);
42022
42142
  if (entry.id != null && id != null) restoredIds.set(entry.id, id);
42023
42143
  return entry.name;
@@ -42025,7 +42145,7 @@ function restoreAll(spawner, sessions) {
42025
42145
  for (const over of persisted.slice(cap2))
42026
42146
  deferOne(over, spawner.recoveryCard, cap2);
42027
42147
  remapLaunchedFrom(sessions, restoredIds);
42028
- return names;
42148
+ return names2;
42029
42149
  }
42030
42150
  function deferOne(persisted, spawnRecoveryCard, cap2) {
42031
42151
  try {
@@ -42065,8 +42185,8 @@ function accountedTrees(sessions) {
42065
42185
  const account = (cwd) => {
42066
42186
  if (!cwd) return;
42067
42187
  accounted.add(cwd);
42068
- const root = findRepoRoot(cwd);
42069
- if (root) accounted.add(root);
42188
+ const root2 = findRepoRoot(cwd);
42189
+ if (root2) accounted.add(root2);
42070
42190
  };
42071
42191
  for (const s of sessions.values()) {
42072
42192
  account(s.cwd);
@@ -42114,15 +42234,15 @@ function bindResumedWorktree(session, cwd, notify2) {
42114
42234
  import { existsSync as existsSync96 } from "fs";
42115
42235
  async function reclaimVanishedWorktrees(clone, paths) {
42116
42236
  if (!existsSync96(clone)) {
42117
- for (const { path: path91 } of paths) forgetWorktree(path91);
42237
+ for (const { path: path96 } of paths) forgetWorktree(path96);
42118
42238
  daemonLog(
42119
42239
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
42120
42240
  );
42121
42241
  return;
42122
42242
  }
42123
42243
  await pruneBookkeeping2(clone);
42124
- for (const { path: path91, branch: branch2 } of paths)
42125
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path91);
42244
+ for (const { path: path96, branch: branch2 } of paths)
42245
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path96);
42126
42246
  }
42127
42247
  async function pruneBookkeeping2(clone) {
42128
42248
  try {
@@ -42149,37 +42269,37 @@ async function reclaimBranch(clone, branch2) {
42149
42269
  }
42150
42270
 
42151
42271
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
42152
- function logVanishedTree(sessions, path91) {
42272
+ function logVanishedTree(sessions, path96) {
42153
42273
  const claimants = [...sessions.values()].filter(
42154
- (s) => s.cwd === path91 || s.worktree?.path === path91
42274
+ (s) => s.cwd === path96 || s.worktree?.path === path96
42155
42275
  );
42156
42276
  if (claimants.length === 0) {
42157
- daemonLog(`worktree ${path91} gone from disk and unclaimed; reclaiming it`);
42277
+ daemonLog(`worktree ${path96} gone from disk and unclaimed; reclaiming it`);
42158
42278
  return;
42159
42279
  }
42160
42280
  for (const s of claimants)
42161
42281
  daemonLog(
42162
- `session ${s.id} ("${s.name}") claims worktree ${path91}, which is gone from disk; reclaiming it`
42282
+ `session ${s.id} ("${s.name}") claims worktree ${path96}, which is gone from disk; reclaiming it`
42163
42283
  );
42164
42284
  }
42165
42285
 
42166
42286
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
42167
42287
  var MAX_ITEMS = 20;
42168
- async function describeHeldWork(path91, reason4) {
42169
- if (reason4.startsWith("uncommitted")) return await changedFiles(path91);
42170
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path91, reason4);
42288
+ async function describeHeldWork(path96, reason4) {
42289
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path96);
42290
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path96, reason4);
42171
42291
  return { summary: reason4, items: [] };
42172
42292
  }
42173
- async function changedFiles(path91) {
42174
- const status3 = await gitResult(path91, ["status", "--porcelain"]);
42293
+ async function changedFiles(path96) {
42294
+ const status3 = await gitResult(path96, ["status", "--porcelain"]);
42175
42295
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
42176
42296
  return {
42177
42297
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
42178
42298
  items: capped2(lines2)
42179
42299
  };
42180
42300
  }
42181
- async function unpushedCommits(path91, reason4) {
42182
- const log2 = await gitResult(path91, ["log", "--oneline", "@{upstream}..HEAD"]);
42301
+ async function unpushedCommits(path96, reason4) {
42302
+ const log2 = await gitResult(path96, ["log", "--oneline", "@{upstream}..HEAD"]);
42183
42303
  if (!log2.ok) return { summary: reason4, items: [] };
42184
42304
  const lines2 = nonEmptyLines(log2.out);
42185
42305
  return {
@@ -42271,24 +42391,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
42271
42391
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
42272
42392
  const accounted = accountedTrees(sessions);
42273
42393
  const vanished = /* @__PURE__ */ new Map();
42274
- for (const { path: path91, clone } of readWorktreeRegistry()) {
42275
- if (underTempRoot(path91)) {
42276
- forgetWorktree(path91);
42394
+ for (const { path: path96, clone } of readWorktreeRegistry()) {
42395
+ if (underTempRoot(path96)) {
42396
+ forgetWorktree(path96);
42277
42397
  daemonLog(
42278
- `worktree ${path91} lies outside any project root; pruned from the registry rather than recovered`
42398
+ `worktree ${path96} lies outside any project root; pruned from the registry rather than recovered`
42279
42399
  );
42280
42400
  continue;
42281
42401
  }
42282
- if (!existsSync97(path91)) {
42283
- logVanishedTree(sessions, path91);
42402
+ if (!existsSync97(path96)) {
42403
+ logVanishedTree(sessions, path96);
42284
42404
  vanished.set(clone, [
42285
42405
  ...vanished.get(clone) ?? [],
42286
- { path: path91, branch: basename28(path91) }
42406
+ { path: path96, branch: basename28(path96) }
42287
42407
  ]);
42288
42408
  continue;
42289
42409
  }
42290
- if (accounted.has(path91)) continue;
42291
- await recoverOrphan(sessions, spawnWith, { path: path91, clone }, notify2);
42410
+ if (accounted.has(path96)) continue;
42411
+ await recoverOrphan(sessions, spawnWith, { path: path96, clone }, notify2);
42292
42412
  }
42293
42413
  for (const [clone, paths] of vanished)
42294
42414
  await reclaimVanishedWorktrees(clone, paths);
@@ -42296,10 +42416,10 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
42296
42416
 
42297
42417
  // src/commands/sessions/daemon/restoreAllSessions.ts
42298
42418
  function restoreAllSessions(spawner, sessions, notify2) {
42299
- const names = restoreAll(spawner, sessions);
42419
+ const names2 = restoreAll(spawner, sessions);
42300
42420
  reconcileWorktreesOnRestore(sessions, spawner.recoveryCard, notify2);
42301
42421
  rearmStoppedSessions(sessions, notify2);
42302
- return names;
42422
+ return names2;
42303
42423
  }
42304
42424
 
42305
42425
  // src/commands/sessions/daemon/retrySession.ts
@@ -42480,8 +42600,8 @@ function boundTreeRoots(sessions, exclude) {
42480
42600
  const roots = /* @__PURE__ */ new Set();
42481
42601
  for (const session of sessions.values()) {
42482
42602
  if (session === exclude) continue;
42483
- const root = treeRootOf(session);
42484
- if (root && !roots.has(root) && holdsTree(session, root)) roots.add(root);
42603
+ const root2 = treeRootOf(session);
42604
+ if (root2 && !roots.has(root2) && holdsTree(session, root2)) roots.add(root2);
42485
42605
  }
42486
42606
  return roots;
42487
42607
  }
@@ -42489,12 +42609,12 @@ function treeRootOf(session) {
42489
42609
  if (!session.cwd) return void 0;
42490
42610
  return canonicalTreePath(findRepoRoot(session.cwd) ?? session.cwd);
42491
42611
  }
42492
- function holdsTree(session, root) {
42612
+ function holdsTree(session, root2) {
42493
42613
  if (session.closing) return true;
42494
42614
  if (session.status !== "done" && session.status !== "error") return true;
42495
- if (!worktreeConfigFor(root).enabled) return true;
42496
- const durability = checkDurabilitySync(root);
42497
- daemonLog(`tree ${root} ${releaseReason(durability, session)}`);
42615
+ if (!worktreeConfigFor(root2).enabled) return true;
42616
+ const durability = checkDurabilitySync(root2);
42617
+ daemonLog(`tree ${root2} ${releaseReason(durability, session)}`);
42498
42618
  return !durability.durable;
42499
42619
  }
42500
42620
  function releaseReason(durability, session) {
@@ -43988,7 +44108,7 @@ function creator(isNew, spawn13) {
43988
44108
  }
43989
44109
 
43990
44110
  // src/commands/sessions/shared/codex/codexRolloutUsage.ts
43991
- import * as fs55 from "fs";
44111
+ import * as fs54 from "fs";
43992
44112
 
43993
44113
  // src/commands/sessions/shared/codex/applyTokenInfo.ts
43994
44114
  function applyTokenInfo(usage, byId, conversationId, rawInfo) {
@@ -44051,7 +44171,7 @@ function codexRolloutUsage(lines2) {
44051
44171
  return usage;
44052
44172
  }
44053
44173
  async function readCodexRolloutUsage(rolloutPath) {
44054
- const content = await fs55.promises.readFile(rolloutPath, "utf8");
44174
+ const content = await fs54.promises.readFile(rolloutPath, "utf8");
44055
44175
  return codexRolloutUsage(content.split("\n"));
44056
44176
  }
44057
44177
  function sessionMetaId(entry) {
@@ -44160,15 +44280,15 @@ function handleSetStatus(client, m, d) {
44160
44280
  }
44161
44281
 
44162
44282
  // src/commands/sessions/shared/parseTranscript.ts
44163
- import * as fs56 from "fs";
44283
+ import * as fs55 from "fs";
44164
44284
 
44165
44285
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
44166
- import * as path90 from "path";
44286
+ import * as path95 from "path";
44167
44287
  async function findCodexRolloutPath(sessionId) {
44168
44288
  if (!sessionId) return null;
44169
44289
  const paths = await discoverCodexRolloutPaths();
44170
44290
  const suffix = `-${sessionId}.jsonl`;
44171
- return paths.find((file) => path90.basename(file).endsWith(suffix)) ?? null;
44291
+ return paths.find((file) => path95.basename(file).endsWith(suffix)) ?? null;
44172
44292
  }
44173
44293
 
44174
44294
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -44243,7 +44363,7 @@ async function parseTranscript(sessionId) {
44243
44363
  }
44244
44364
  async function readMessages(filePath, parse5) {
44245
44365
  try {
44246
- const raw = await fs56.promises.readFile(filePath, "utf8");
44366
+ const raw = await fs55.promises.readFile(filePath, "utf8");
44247
44367
  return parse5(raw.split("\n"));
44248
44368
  } catch {
44249
44369
  return [];
@@ -44809,17 +44929,17 @@ async function renameSession(title) {
44809
44929
  }
44810
44930
 
44811
44931
  // src/commands/sessions/summarise/index.ts
44812
- import * as fs58 from "fs";
44932
+ import * as fs57 from "fs";
44813
44933
  import chalk246 from "chalk";
44814
44934
 
44815
44935
  // src/commands/sessions/summarise/shared.ts
44816
- import * as fs57 from "fs";
44936
+ import * as fs56 from "fs";
44817
44937
  function writeSummary(jsonlPath2, summary) {
44818
- fs57.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
44938
+ fs56.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
44819
44939
  `, "utf8");
44820
44940
  }
44821
44941
  function hasSummary(jsonlPath2) {
44822
- return fs57.existsSync(summaryPathFor(jsonlPath2));
44942
+ return fs56.existsSync(summaryPathFor(jsonlPath2));
44823
44943
  }
44824
44944
  function summaryPathFor(jsonlPath2) {
44825
44945
  return jsonlPath2.replace(/\.jsonl$/, ".summary");
@@ -44891,7 +45011,7 @@ function selectCandidates(files, options2) {
44891
45011
  const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
44892
45012
  candidates.sort((a, b) => {
44893
45013
  try {
44894
- return fs58.statSync(b).mtimeMs - fs58.statSync(a).mtimeMs;
45014
+ return fs57.statSync(b).mtimeMs - fs57.statSync(a).mtimeMs;
44895
45015
  } catch {
44896
45016
  return 0;
44897
45017
  }