@staff0rd/assist 0.693.1 → 0.694.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.1",
9
+ version: "0.694.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(path96) {
300
- return path96.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path100) {
300
+ return path100.replace(/^\/+/, "");
301
301
  }
302
302
  function normalizeOrigin(raw) {
303
303
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -347,9 +347,9 @@ function findGitLink(dir) {
347
347
  }
348
348
  return null;
349
349
  }
350
- function isFile(path96) {
350
+ function isFile(path100) {
351
351
  try {
352
- return statSync(path96).isFile();
352
+ return statSync(path100).isFile();
353
353
  } catch {
354
354
  return false;
355
355
  }
@@ -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(path96) {
371
+ function readTrimmed(path100) {
372
372
  try {
373
- const content = readFileSync2(path96, "utf8").trim();
373
+ const content = readFileSync2(path100, "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(path96) {
387
- if (!existsSync3(path96)) return {};
386
+ function loadRawYaml(path100) {
387
+ if (!existsSync3(path100)) return {};
388
388
  try {
389
- const content = readFileSync3(path96, "utf8");
389
+ const content = readFileSync3(path100, "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 path96 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path96.split("/").filter(Boolean);
461
+ const path100 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path100.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -2573,9 +2573,9 @@ function segmentText(segment) {
2573
2573
  if (segment.kind === "index") return `[${segment.index}]`;
2574
2574
  return "[]";
2575
2575
  }
2576
- function formatConfigPath(path96) {
2576
+ function formatConfigPath(path100) {
2577
2577
  let text18 = "";
2578
- for (const segment of path96) {
2578
+ for (const segment of path100) {
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, path96) {
2739
+ function build(node, path100) {
2740
2740
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
2741
2741
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
2742
2742
  const base = {
2743
- path: path96,
2743
+ path: path100,
2744
2744
  ...optional ? { optional: true } : {},
2745
2745
  ...defaultValue === void 0 ? {} : { defaultValue },
2746
2746
  ...secret ? { secret: true } : {}
@@ -3064,7 +3064,7 @@ var refactorConfigHelp = [
3064
3064
  {
3065
3065
  key: "restructure.ignore",
3066
3066
  setter: 'assist config set restructure.ignore "src/generated/**"',
3067
- note: "globs excluded from restructure coupling analysis"
3067
+ note: "globs (relative to cwd) of files restructure never moves; they are treated as outside the root"
3068
3068
  }
3069
3069
  ];
3070
3070
 
@@ -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, path96) {
3493
+ function resolveStringsAtPath(data, path100) {
3494
3494
  let current = data;
3495
- for (const segment of path96.split(".")) {
3495
+ for (const segment of path100.split(".")) {
3496
3496
  if (current === null || typeof current !== "object") return [];
3497
3497
  current = current[segment];
3498
3498
  }
@@ -3505,10 +3505,10 @@ function resolveStringsAtPath(data, path96) {
3505
3505
  }
3506
3506
  function findRuleViolations(data, rule) {
3507
3507
  const violations = [];
3508
- for (const path96 of rule.paths) {
3509
- for (const value of resolveStringsAtPath(data, path96)) {
3508
+ for (const path100 of rule.paths) {
3509
+ for (const value of resolveStringsAtPath(data, path100)) {
3510
3510
  if (minimatch2(value, rule.disallowed))
3511
- violations.push({ file: rule.file, path: path96, value });
3511
+ violations.push({ file: rule.file, path: path100, 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: path96, value } of violations) {
3551
- console.log(` ${file} ${path96}: ${value}`);
3550
+ for (const { file, path: path100, value } of violations) {
3551
+ console.log(` ${file} ${path100}: ${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((path96) => MIGRATION_FILE3.test(basename3(path96)));
4155
- for (const path96 of paths) {
4154
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path100) => MIGRATION_FILE3.test(basename3(path100)));
4155
+ for (const path100 of paths) {
4156
4156
  try {
4157
- const content = execSync5(`git show "${ref}:${path96}"`, {
4157
+ const content = execSync5(`git show "${ref}:${path100}"`, {
4158
4158
  encoding: "utf8",
4159
4159
  maxBuffer: 16 * 1024 * 1024,
4160
4160
  stdio: ["pipe", "pipe", "pipe"]
4161
4161
  });
4162
- baseline.set(basename3(path96), content);
4162
+ baseline.set(basename3(path100), content);
4163
4163
  } catch {
4164
4164
  }
4165
4165
  }
@@ -6406,10 +6406,10 @@ var hooksSettings = {
6406
6406
  }
6407
6407
  };
6408
6408
  function ensureHooksSettings() {
6409
- const path96 = daemonPaths.hooksSettings;
6410
- mkdirSync5(dirname14(path96), { recursive: true });
6411
- writeFileSync15(path96, JSON.stringify(hooksSettings, null, 2));
6412
- return path96;
6409
+ const path100 = daemonPaths.hooksSettings;
6410
+ mkdirSync5(dirname14(path100), { recursive: true });
6411
+ writeFileSync15(path100, JSON.stringify(hooksSettings, null, 2));
6412
+ return path100;
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 path96 = kind === "branch" ? "tree" : "commit";
6591
- return `https://github.com/${repo.org}/${repo.repo}/${path96}/${ref}`;
6590
+ const path100 = kind === "branch" ? "tree" : "commit";
6591
+ return `https://github.com/${repo.org}/${repo.repo}/${path100}/${ref}`;
6592
6592
  }
6593
6593
 
6594
6594
  // src/commands/branch/buildBranchName.ts
@@ -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 path96 = join18(dir, ".assist", name);
6835
- if (existsSync21(path96)) {
6836
- renameSync(path96, `${path96}.bak`);
6834
+ const path100 = join18(dir, ".assist", name);
6835
+ if (existsSync21(path100)) {
6836
+ renameSync(path100, `${path100}.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(path96) {
7321
- const content = readFileSync16(path96, "utf8").trim();
7320
+ function parseBacklogJsonl(path100) {
7321
+ const content = readFileSync16(path100, "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
  }
@@ -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 path96 = getOwnerPath(itemId2);
8181
- mkdirSync7(dirname16(path96), { recursive: true });
8182
- writeFileSync17(path96, JSON.stringify({ sessionId }));
8180
+ const path100 = getOwnerPath(itemId2);
8181
+ mkdirSync7(dirname16(path100), { recursive: true });
8182
+ writeFileSync17(path100, JSON.stringify({ sessionId }));
8183
8183
  }
8184
8184
  function readSignalOwner(itemId2) {
8185
- const path96 = getOwnerPath(itemId2);
8186
- if (!existsSync25(path96)) return void 0;
8185
+ const path100 = getOwnerPath(itemId2);
8186
+ if (!existsSync25(path100)) return void 0;
8187
8187
  try {
8188
- const parsed = JSON.parse(readFileSync17(path96, "utf8"));
8188
+ const parsed = JSON.parse(readFileSync17(path100, "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 path96 = getOwnerPath(itemId2);
8195
+ const path100 = getOwnerPath(itemId2);
8196
8196
  try {
8197
- rmSync(path96);
8197
+ rmSync(path100);
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 path96 = getSignalPath(target);
8235
- if (!path96) return;
8234
+ const path100 = getSignalPath(target);
8235
+ if (!path100) return;
8236
8236
  const signal = { event, sessionId: target, ...data };
8237
- mkdirSync8(dirname17(path96), { recursive: true });
8238
- writeFileSync18(path96, JSON.stringify(signal));
8237
+ mkdirSync8(dirname17(path100), { recursive: true });
8238
+ writeFileSync18(path100, JSON.stringify(signal));
8239
8239
  }
8240
8240
 
8241
8241
  // src/commands/backlog/readSignal.ts
8242
8242
  function readSignal() {
8243
- const path96 = getSignalPath();
8244
- if (!path96 || !existsSync26(path96)) return void 0;
8243
+ const path100 = getSignalPath();
8244
+ if (!path100 || !existsSync26(path100)) return void 0;
8245
8245
  try {
8246
- return JSON.parse(readFileSync18(path96, "utf8"));
8246
+ return JSON.parse(readFileSync18(path100, "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 path96 = activityPath(sessionId);
8445
- mkdirSync9(dirname18(path96), { recursive: true });
8446
- writeFileSync19(path96, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8444
+ const path100 = activityPath(sessionId);
8445
+ mkdirSync9(dirname18(path100), { recursive: true });
8446
+ writeFileSync19(path100, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8447
8447
  }
8448
- function readActivity(path96) {
8448
+ function readActivity(path100) {
8449
8449
  try {
8450
- return JSON.parse(readFileSync19(path96, "utf8"));
8450
+ return JSON.parse(readFileSync19(path100, "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 path96 = activityPath(sessionId);
8461
- mkdirSync9(dirname18(path96), { recursive: true });
8462
- writeFileSync19(path96, JSON.stringify(activity2));
8460
+ const path100 = activityPath(sessionId);
8461
+ mkdirSync9(dirname18(path100), { recursive: true });
8462
+ writeFileSync19(path100, 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 path96 = getStorePath(filename);
9946
- if (existsSync31(path96)) {
9945
+ const path100 = getStorePath(filename);
9946
+ if (existsSync31(path100)) {
9947
9947
  try {
9948
- return JSON.parse(readFileSync20(path96, "utf8"));
9948
+ return JSON.parse(readFileSync20(path100, "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(([path96, record]) => ({ path: path96, ...record }));
9967
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path100, record]) => ({ path: path100, ...record }));
9968
9968
  }
9969
- function worktreeAttributionIncludingReaped(path96) {
9970
- const record = loadJson(REGISTRY_FILE)[path96];
9969
+ function worktreeAttributionIncludingReaped(path100) {
9970
+ const record = loadJson(REGISTRY_FILE)[path100];
9971
9971
  return record ? { clone: record.clone, origin: record.origin } : void 0;
9972
9972
  }
9973
- function recordWorktree(path96, clone, origin) {
9973
+ function recordWorktree(path100, clone, origin) {
9974
9974
  const data = loadJson(REGISTRY_FILE);
9975
- data[path96] = { clone, origin };
9975
+ data[path100] = { clone, origin };
9976
9976
  saveJson(REGISTRY_FILE, data);
9977
9977
  }
9978
- function forgetWorktree(path96) {
9978
+ function forgetWorktree(path100) {
9979
9979
  const data = loadJson(REGISTRY_FILE);
9980
- const record = data[path96];
9980
+ const record = data[path100];
9981
9981
  if (!record || record.reaped) return;
9982
- data[path96] = { ...record, reaped: true };
9982
+ data[path100] = { ...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 path96 of resolved.paths) {
10811
- if (!bases.has(path96)) bases.set(path96, resolved.base);
10810
+ for (const path100 of resolved.paths) {
10811
+ if (!bases.has(path100)) bases.set(path100, 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 [path96, base] of bases) {
10829
+ for (const [path100, base] of bases) {
10830
10830
  const paths = groups.get(base);
10831
- if (paths) paths.push(path96);
10832
- else groups.set(base, [path96]);
10831
+ if (paths) paths.push(path100);
10832
+ else groups.set(base, [path100]);
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((path96) => path96 && !bases.has(path96)).sort();
10838
+ return output.split("\n").filter((path100) => path100 && !bases.has(path100)).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, path96) {
10848
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path96], {
10847
+ async function untrackedFileDiff(cwd, path100) {
10848
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path100], {
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((path96) => untrackedFileDiff(cwd, path96))
10861
+ paths.map((path100) => untrackedFileDiff(cwd, path100))
10862
10862
  );
10863
10863
  return diffs.join("");
10864
10864
  }
@@ -10951,9 +10951,9 @@ 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, path96) {
10954
+ function resolveWithinCwd(cwd, path100) {
10955
10955
  const root2 = repoRoot(cwd);
10956
- const target = resolve10(root2, path96);
10956
+ const target = resolve10(root2, path100);
10957
10957
  const rel = relative2(root2, target);
10958
10958
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
10959
10959
  return target;
@@ -10963,14 +10963,14 @@ function resolveWithinCwd(cwd, path96) {
10963
10963
  function getFileTarget(req, res) {
10964
10964
  const cwd = getCwdParam(req, res);
10965
10965
  if (!cwd) return null;
10966
- const path96 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
10966
+ const path100 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
10967
10967
  "path"
10968
10968
  );
10969
- if (!path96) {
10969
+ if (!path100) {
10970
10970
  respondJson(res, 400, { error: "Missing path" });
10971
10971
  return null;
10972
10972
  }
10973
- const target = resolveWithinCwd(cwd, path96);
10973
+ const target = resolveWithinCwd(cwd, path100);
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(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;
11048
+ function globalConfigFileLabel(path100) {
11049
+ if (path100 === getGlobalConfigPath()) return "~/.assist.yml";
11050
+ if (path100.startsWith(WINDOWS_MOUNT_PREFIX))
11051
+ return `${path100} on the Windows host`;
11052
+ return path100;
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, path96, childNode, map) {
11109
+ function mapChildren(value, path100, 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, [...path96, name], childNode(name), map)
11114
+ walk(child, [...path100, name], childNode(name), map)
11115
11115
  ])
11116
11116
  );
11117
11117
  }
11118
- function mapItems(value, path96, item, map) {
11118
+ function mapItems(value, path100, item, map) {
11119
11119
  if (!Array.isArray(value)) return value;
11120
- return value.map((entry, index3) => walk(entry, [...path96, index3], item, map));
11120
+ return value.map((entry, index3) => walk(entry, [...path100, index3], item, map));
11121
11121
  }
11122
- function walk(value, path96, node, map) {
11122
+ function walk(value, path100, node, map) {
11123
11123
  if (!node || value === void 0 || value === null) return value;
11124
- if (node.secret) return map(value, path96);
11124
+ if (node.secret) return map(value, path100);
11125
11125
  switch (node.kind) {
11126
11126
  case "object":
11127
11127
  case "unionOfObjects":
11128
11128
  return mapChildren(
11129
11129
  value,
11130
- path96,
11130
+ path100,
11131
11131
  (name) => configNodeField(node, name),
11132
11132
  map
11133
11133
  );
11134
11134
  case "objectList":
11135
- return mapItems(value, path96, node.item, map);
11135
+ return mapItems(value, path100, node.item, map);
11136
11136
  case "record":
11137
- return mapChildren(value, path96, () => node.value, map);
11137
+ return mapChildren(value, path100, () => 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, path96) {
11162
+ function getNestedValue(obj, path100) {
11163
11163
  let current = obj;
11164
- for (const key of path96.split(".")) current = stepInto(current, key);
11164
+ for (const key of path100.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(root2, path96) {
11214
+ function findConfigNode(root2, path100) {
11215
11215
  let current = root2;
11216
- for (const segment of path96) {
11216
+ for (const segment of path100) {
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 path96 = [];
11233
+ const path100 = [];
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
- path96.push(segment);
11240
+ path100.push(segment);
11241
11241
  at2 = close + 1;
11242
11242
  continue;
11243
11243
  }
11244
11244
  if (text18[at2] === ".") {
11245
- if (path96.length === 0) return void 0;
11245
+ if (path100.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
- path96.push(nameSegment(name));
11252
+ path100.push(nameSegment(name));
11253
11253
  }
11254
- return path96;
11254
+ return path100;
11255
11255
  }
11256
11256
 
11257
11257
  // src/commands/config/configEntryNode.ts
11258
11258
  function configEntryNode(root2, key) {
11259
- const path96 = parseConfigPath(key);
11260
- return path96 ? findConfigNode(root2, path96) : void 0;
11259
+ const path100 = parseConfigPath(key);
11260
+ return path100 ? findConfigNode(root2, path100) : 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((path96) => existsSync34(path96)).map((path96) => ({ path: path96, mtime: statSync4(path96).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((path100) => existsSync34(path100)).map((path100) => ({ path: path100, mtime: statSync4(path100).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 path96 = await resolveSynthesisPath(cwd);
11426
- if (!path96) {
11425
+ const path100 = await resolveSynthesisPath(cwd);
11426
+ if (!path100) {
11427
11427
  respondJson(res, 404, { error: "No synthesis found" });
11428
11428
  return;
11429
11429
  }
11430
- respondJson(res, 200, { synthesis: readFileSync22(path96, "utf8") });
11430
+ respondJson(res, 200, { synthesis: readFileSync22(path100, "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 path96 = fields[fields.length - 1];
11514
- if (path96) result[category].push(path96);
11513
+ const path100 = fields[fields.length - 1];
11514
+ if (path100) result[category].push(path100);
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(path96, query) {
11650
+ function scoreFilePath(path100, query) {
11651
11651
  const needle = query.trim().toLowerCase();
11652
11652
  if (!needle) return 0;
11653
- const basename30 = path96.slice(path96.lastIndexOf("/") + 1);
11653
+ const basename30 = path100.slice(path100.lastIndexOf("/") + 1);
11654
11654
  const inBasename = subsequenceScore(basename30, needle);
11655
11655
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
11656
- return subsequenceScore(path96, needle);
11656
+ return subsequenceScore(path100, 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 path96 of paths) {
11663
- const score = scoreFilePath(path96, query);
11664
- if (score !== null) scored.push({ path: path96, score });
11662
+ for (const path100 of paths) {
11663
+ const score = scoreFilePath(path100, query);
11664
+ if (score !== null) scored.push({ path: path100, 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);
@@ -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 path96 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
12615
- const response = await ghJson(cwd, ["api", path96]);
12614
+ const path100 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
12615
+ const response = await ghJson(cwd, ["api", path100]);
12616
12616
  const run4 = response.workflow_runs?.[0];
12617
12617
  if (!run4) return null;
12618
12618
  return {
@@ -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, path96) {
12891
+ async function isTracked(cwd, path100) {
12892
12892
  try {
12893
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path96]);
12893
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path100]);
12894
12894
  return true;
12895
12895
  } catch {
12896
12896
  return false;
12897
12897
  }
12898
12898
  }
12899
- async function isInHead(cwd, path96) {
12900
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path96]);
12899
+ async function isInHead(cwd, path100) {
12900
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path100]);
12901
12901
  return listing.trim().length > 0;
12902
12902
  }
12903
- async function revertPathChanges(cwd, path96) {
12904
- if (!await isTracked(cwd, path96)) {
12905
- await execGit(cwd, ["clean", "-f", "--", path96]);
12903
+ async function revertPathChanges(cwd, path100) {
12904
+ if (!await isTracked(cwd, path100)) {
12905
+ await execGit(cwd, ["clean", "-f", "--", path100]);
12906
12906
  return;
12907
12907
  }
12908
- if (await isInHead(cwd, path96)) {
12909
- await execGit(cwd, ["checkout", "HEAD", "--", path96]);
12908
+ if (await isInHead(cwd, path100)) {
12909
+ await execGit(cwd, ["checkout", "HEAD", "--", path100]);
12910
12910
  return;
12911
12911
  }
12912
- await execGit(cwd, ["rm", "-f", "--", path96]);
12912
+ await execGit(cwd, ["rm", "-f", "--", path100]);
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 path96 = relative3(repoRoot(resolved.cwd), resolved.target);
12919
+ const path100 = relative3(repoRoot(resolved.cwd), resolved.target);
12920
12920
  try {
12921
- await revertPathChanges(resolved.cwd, path96);
12922
- respondJson(res, 200, { reverted: path96 });
12921
+ await revertPathChanges(resolved.cwd, path100);
12922
+ respondJson(res, 200, { reverted: path100 });
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((path96) => typeof path96 !== "string")) return null;
12944
+ if (paths.some((path100) => typeof path100 !== "string")) return null;
12945
12945
  return paths;
12946
12946
  }
12947
12947
  async function revertDiffPaths(req, res) {
@@ -12961,10 +12961,10 @@ async function revertDiffPaths(req, res) {
12961
12961
  const root2 = repoRoot(cwd);
12962
12962
  const reverted = [];
12963
12963
  const failed2 = [];
12964
- for (const path96 of paths) {
12965
- const target = resolveWithinCwd(cwd, path96);
12964
+ for (const path100 of paths) {
12965
+ const target = resolveWithinCwd(cwd, path100);
12966
12966
  if (!target) {
12967
- failed2.push({ path: path96, error: "Path outside cwd" });
12967
+ failed2.push({ path: path100, error: "Path outside cwd" });
12968
12968
  continue;
12969
12969
  }
12970
12970
  const relativePath = relative4(root2, target);
@@ -13054,11 +13054,11 @@ function coerceStructuredConfigValue(key, raw) {
13054
13054
  };
13055
13055
  }
13056
13056
  function formatIssue(key, issue) {
13057
- const path96 = formatConfigPath([
13057
+ const path100 = formatConfigPath([
13058
13058
  { kind: "key", name: key },
13059
13059
  ...issue.path.map(toSegment)
13060
13060
  ]);
13061
- return `${path96}: ${issue.message}`;
13061
+ return `${path100}: ${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, path96) {
13156
+ function valueAtConfigPath(value, path100) {
13157
13157
  let current = value;
13158
- for (const key of path96) {
13158
+ for (const key of path100) {
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, path96) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path96) : secret
13175
+ (secret, path100) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path100) : 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, path96, value) {
13225
- const keys = path96.split(".");
13224
+ function setNestedValue(obj, path100, value) {
13225
+ const keys = path100.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 path96 = issue.path.length > 0 ? issue.path.join(".") : key;
13253
- return [`${path96}: ${issue.message}`];
13252
+ const path100 = issue.path.length > 0 ? issue.path.join(".") : key;
13253
+ return [`${path100}: ${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, path96) {
13511
- const { container, removed } = removeAt(obj, path96.split("."));
13510
+ function unsetNestedValue(obj, path100) {
13511
+ const { container, removed } = removeAt(obj, path100.split("."));
13512
13512
  return { config: container, removed };
13513
13513
  }
13514
13514
 
@@ -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 path96 = origin.slice(firstSlash + 1);
14674
- if (!path96) return null;
14675
- return `git@${host}:${path96}.git`;
14673
+ const path100 = origin.slice(firstSlash + 1);
14674
+ if (!path100) return null;
14675
+ return `git@${host}:${path100}.git`;
14676
14676
  }
14677
14677
 
14678
14678
  // src/commands/backlog/cloneRepo.ts
@@ -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(path96) {
17739
- const pattern2 = path96.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17738
+ function restrictedPathRegex(path100) {
17739
+ const pattern2 = path100.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((path96) => ({
17743
- path: path96,
17744
- regex: restrictedPathRegex(path96)
17742
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path100) => ({
17743
+ path: path100,
17744
+ regex: restrictedPathRegex(path100)
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(path96) {
17922
- if (!existsSync40(path96)) return [];
17923
- return readFileSync27(path96, "utf8").split("\n").filter((line) => line.trim() !== "");
17921
+ function readLines(path100) {
17922
+ if (!existsSync40(path100)) return [];
17923
+ return readFileSync27(path100, "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, path96, description, depth, p) {
18449
- showProgress(p, path96.join(" "));
18450
- const subHelp = await runHelp([cli, ...path96]);
18448
+ async function resolveCommand(cli, path100, description, depth, p) {
18449
+ showProgress(p, path100.join(" "));
18450
+ const subHelp = await runHelp([cli, ...path100]);
18451
18451
  if (!subHelp || !hasSubcommands(subHelp)) {
18452
- return [{ path: path96, description }];
18452
+ return [{ path: path100, description }];
18453
18453
  }
18454
- const children = await discoverAt(cli, path96, depth + 1, p);
18455
- return children.length > 0 ? children : [{ path: path96, description }];
18454
+ const children = await discoverAt(cli, path100, depth + 1, p);
18455
+ return children.length > 0 ? children : [{ path: path100, description }];
18456
18456
  }
18457
18457
  async function discoverAt(cli, parentPath, depth, p) {
18458
18458
  if (depth > SAFETY_DEPTH) return [];
@@ -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 path96 = logPath(cli);
18604
- if (!existsSync42(path96)) return void 0;
18605
- return readFileSync29(path96, "utf8");
18603
+ const path100 = logPath(cli);
18604
+ if (!existsSync42(path100)) return void 0;
18605
+ return readFileSync29(path100, "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 path96 = join44(dir, entry);
18765
+ const path100 = join44(dir, entry);
18766
18766
  try {
18767
- if (statSync7(path96).mtimeMs < cutoff) unlinkSync7(path96);
18767
+ if (statSync7(path100).mtimeMs < cutoff) unlinkSync7(path100);
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 path96 = getPinStatePath(pin);
18778
- if (!existsSync43(path96)) return void 0;
18777
+ const path100 = getPinStatePath(pin);
18778
+ if (!existsSync43(path100)) return void 0;
18779
18779
  try {
18780
- const state = JSON.parse(readFileSync30(path96, "utf8"));
18780
+ const state = JSON.parse(readFileSync30(path100, "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 path96 = line.split(" ")[1];
19202
- if (path96) found.add(path96.trim());
19201
+ const path100 = line.split(" ")[1];
19202
+ if (path100) found.add(path100.trim());
19203
19203
  }
19204
19204
  return [...found];
19205
19205
  }
@@ -19520,21 +19520,19 @@ import chalk130 from "chalk";
19520
19520
  import chalk123 from "chalk";
19521
19521
 
19522
19522
  // src/commands/complexity/shared/index.ts
19523
- import fs20 from "fs";
19523
+ import fs21 from "fs";
19524
19524
  import path32 from "path";
19525
19525
  import chalk122 from "chalk";
19526
19526
  import ts5 from "typescript";
19527
19527
 
19528
19528
  // src/commands/complexity/findSourceFiles.ts
19529
+ import fs20 from "fs";
19530
+ import { minimatch as minimatch5 } from "minimatch";
19531
+
19532
+ // src/commands/complexity/walkSourceFiles.ts
19529
19533
  import fs19 from "fs";
19530
19534
  import path31 from "path";
19531
- import { minimatch as minimatch5 } from "minimatch";
19532
- function applyIgnoreGlobs(files, extraIgnore = []) {
19533
- const { complexity } = loadConfig();
19534
- const ignore3 = [...complexity.ignore, ...extraIgnore];
19535
- return files.filter((f) => !ignore3.some((glob) => minimatch5(f, glob)));
19536
- }
19537
- function walk2(dir, results) {
19535
+ function walkSourceFiles(dir, results) {
19538
19536
  if (!fs19.existsSync(dir)) {
19539
19537
  return;
19540
19538
  }
@@ -19544,30 +19542,37 @@ function walk2(dir, results) {
19544
19542
  const fullPath = path31.join(dir, entry.name);
19545
19543
  if (entry.isDirectory()) {
19546
19544
  if (entry.name !== "node_modules" && entry.name !== ".git") {
19547
- walk2(fullPath, results);
19545
+ walkSourceFiles(fullPath, results);
19548
19546
  }
19549
19547
  } else if (entry.isFile() && extensions.some((ext) => entry.name.endsWith(ext))) {
19550
19548
  results.push(fullPath);
19551
19549
  }
19552
19550
  }
19553
19551
  }
19552
+
19553
+ // src/commands/complexity/findSourceFiles.ts
19554
+ function applyIgnoreGlobs(files, extraIgnore = []) {
19555
+ const { complexity } = loadConfig();
19556
+ const ignore3 = [...complexity.ignore, ...extraIgnore];
19557
+ return files.filter((f) => !ignore3.some((glob) => minimatch5(f, glob)));
19558
+ }
19554
19559
  function findSourceFiles(pattern2, baseDir = ".", extraIgnore = []) {
19555
19560
  const results = [];
19556
19561
  if (pattern2.includes("*")) {
19557
- walk2(baseDir, results);
19562
+ walkSourceFiles(baseDir, results);
19558
19563
  return applyIgnoreGlobs(
19559
19564
  results.filter((f) => minimatch5(f, pattern2)),
19560
19565
  extraIgnore
19561
19566
  );
19562
19567
  }
19563
- if (fs19.existsSync(pattern2) && fs19.statSync(pattern2).isFile()) {
19568
+ if (fs20.existsSync(pattern2) && fs20.statSync(pattern2).isFile()) {
19564
19569
  return [pattern2];
19565
19570
  }
19566
- if (fs19.existsSync(pattern2) && fs19.statSync(pattern2).isDirectory()) {
19567
- walk2(pattern2, results);
19571
+ if (fs20.existsSync(pattern2) && fs20.statSync(pattern2).isDirectory()) {
19572
+ walkSourceFiles(pattern2, results);
19568
19573
  return applyIgnoreGlobs(results, extraIgnore);
19569
19574
  }
19570
- walk2(baseDir, results);
19575
+ walkSourceFiles(baseDir, results);
19571
19576
  return applyIgnoreGlobs(
19572
19577
  results.filter((f) => minimatch5(f, pattern2)),
19573
19578
  extraIgnore
@@ -19761,7 +19766,7 @@ function countSloc(content) {
19761
19766
 
19762
19767
  // src/commands/complexity/shared/index.ts
19763
19768
  function createSourceFromFile(filePath) {
19764
- const content = fs20.readFileSync(filePath, "utf8");
19769
+ const content = fs21.readFileSync(filePath, "utf8");
19765
19770
  return ts5.createSourceFile(
19766
19771
  path32.basename(filePath),
19767
19772
  content,
@@ -19873,7 +19878,7 @@ function aggregateResults(fileMetrics) {
19873
19878
  }
19874
19879
 
19875
19880
  // src/commands/complexity/maintainability/collectFileMetrics.ts
19876
- import fs21 from "fs";
19881
+ import fs22 from "fs";
19877
19882
 
19878
19883
  // src/commands/complexity/maintainability/calculateMaintainabilityIndex.ts
19879
19884
  function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, sloc2) {
@@ -19888,7 +19893,7 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
19888
19893
  function collectFileMetrics(files) {
19889
19894
  const fileMetrics = /* @__PURE__ */ new Map();
19890
19895
  for (const file of files) {
19891
- const content = fs21.readFileSync(file, "utf8");
19896
+ const content = fs22.readFileSync(file, "utf8");
19892
19897
  fileMetrics.set(file, {
19893
19898
  sloc: countSloc(content),
19894
19899
  functions: [],
@@ -20049,14 +20054,14 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
20049
20054
  }
20050
20055
 
20051
20056
  // src/commands/complexity/sloc.ts
20052
- import fs22 from "fs";
20057
+ import fs23 from "fs";
20053
20058
  import chalk129 from "chalk";
20054
20059
  async function sloc(pattern2 = "**/*.ts", options2 = {}) {
20055
20060
  withSourceFiles(pattern2, (files) => {
20056
20061
  const results = [];
20057
20062
  let hasViolation = false;
20058
20063
  for (const file of files) {
20059
- const content = fs22.readFileSync(file, "utf8");
20064
+ const content = fs23.readFileSync(file, "utf8");
20060
20065
  const lines2 = countSloc(content);
20061
20066
  results.push({ file, lines: lines2 });
20062
20067
  if (options2.threshold !== void 0 && lines2 > options2.threshold) {
@@ -20424,11 +20429,11 @@ async function loadPath(source) {
20424
20429
  }
20425
20430
  }
20426
20431
  async function criteriaExtension() {
20427
- const path96 = await loadPath(criteriaExtensionDir());
20432
+ const path100 = await loadPath(criteriaExtensionDir());
20428
20433
  console.log(
20429
20434
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
20430
20435
  );
20431
- console.log(chalk137.dim(`load the unpacked extension from ${path96}`));
20436
+ console.log(chalk137.dim(`load the unpacked extension from ${path100}`));
20432
20437
  }
20433
20438
 
20434
20439
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -20553,10 +20558,10 @@ async function signCriteriaExtension() {
20553
20558
  process.exitCode = 1;
20554
20559
  return;
20555
20560
  }
20556
- const path96 = await signedAddonInstallPath(
20561
+ const path100 = await signedAddonInstallPath(
20557
20562
  await copySignedXpi(xpi, ARTIFACTS_DIR)
20558
20563
  );
20559
- console.log(chalk139.dim(`install the signed add-on from ${path96}`));
20564
+ console.log(chalk139.dim(`install the signed add-on from ${path100}`));
20560
20565
  }
20561
20566
 
20562
20567
  // src/commands/registerCriteriaExtension.ts
@@ -20654,10 +20659,10 @@ function getMigrationApprovalPath(migrationId) {
20654
20659
  // src/commands/dbMigration/readMigrationPinState.ts
20655
20660
  import { existsSync as existsSync48, readFileSync as readFileSync32 } from "fs";
20656
20661
  function readMigrationPinState(pin) {
20657
- const path96 = getMigrationPinPath(pin);
20658
- if (!existsSync48(path96)) return void 0;
20662
+ const path100 = getMigrationPinPath(pin);
20663
+ if (!existsSync48(path100)) return void 0;
20659
20664
  try {
20660
- const state = JSON.parse(readFileSync32(path96, "utf8"));
20665
+ const state = JSON.parse(readFileSync32(path100, "utf8"));
20661
20666
  if (state.pin !== pin) return void 0;
20662
20667
  if (!Number.isInteger(state.migrationId)) return void 0;
20663
20668
  return state;
@@ -21400,13 +21405,13 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
21400
21405
  }
21401
21406
  function collectAllDeps(node) {
21402
21407
  const result = /* @__PURE__ */ new Set();
21403
- function walk3(n) {
21408
+ function walk2(n) {
21404
21409
  for (const child of n.children) {
21405
21410
  result.add(child.path);
21406
- walk3(child);
21411
+ walk2(child);
21407
21412
  }
21408
21413
  }
21409
- walk3(node);
21414
+ walk2(node);
21410
21415
  return result;
21411
21416
  }
21412
21417
 
@@ -21915,7 +21920,7 @@ function registerDotnet(program2) {
21915
21920
  }
21916
21921
 
21917
21922
  // src/commands/editHook/index.ts
21918
- import fs23 from "fs";
21923
+ import fs24 from "fs";
21919
21924
 
21920
21925
  // src/commands/editHook/introducedComments.ts
21921
21926
  function introducedComments(added, removed) {
@@ -22087,10 +22092,10 @@ function decideCommentGuard(input, existingContent) {
22087
22092
  import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
22088
22093
  function consumeMigrationApproval(migrationId) {
22089
22094
  sweepRestrictedDir();
22090
- const path96 = getMigrationApprovalPath(migrationId);
22091
- if (!existsSync54(path96)) return false;
22095
+ const path100 = getMigrationApprovalPath(migrationId);
22096
+ if (!existsSync54(path100)) return false;
22092
22097
  try {
22093
- unlinkSync11(path96);
22098
+ unlinkSync11(path100);
22094
22099
  return true;
22095
22100
  } catch {
22096
22101
  return false;
@@ -22162,7 +22167,7 @@ function tryParseInput2(raw) {
22162
22167
  function readExisting(filePath) {
22163
22168
  if (!filePath) return void 0;
22164
22169
  try {
22165
- return fs23.readFileSync(filePath, "utf8");
22170
+ return fs24.readFileSync(filePath, "utf8");
22166
22171
  } catch {
22167
22172
  return void 0;
22168
22173
  }
@@ -24494,11 +24499,11 @@ function recentDaemonLogLines() {
24494
24499
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
24495
24500
  import { realpathSync as realpathSync2 } from "fs";
24496
24501
  import { resolve as resolve14 } from "path";
24497
- function canonicalTreePath(path96) {
24502
+ function canonicalTreePath(path100) {
24498
24503
  try {
24499
- return realpathSync2(path96);
24504
+ return realpathSync2(path100);
24500
24505
  } catch {
24501
- return resolve14(path96);
24506
+ return resolve14(path100);
24502
24507
  }
24503
24508
  }
24504
24509
 
@@ -24551,22 +24556,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
24551
24556
  const registered = new Set(listWorktreePaths(clone));
24552
24557
  const branches = new Set(listLocalBranches(clone));
24553
24558
  const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename18(candidate));
24554
- const path96 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24559
+ const path100 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24555
24560
  const start3 = worktreeStartPoint(clone, strategy.trunk);
24556
24561
  gitSync(clone, [
24557
24562
  "worktree",
24558
24563
  "add",
24559
24564
  start3.track ? "--track" : "--no-track",
24560
24565
  "-b",
24561
- basename18(path96),
24562
- path96,
24566
+ basename18(path100),
24567
+ path100,
24563
24568
  start3.ref
24564
24569
  ]);
24565
- recordWorktree(path96, clone, getCurrentOrigin(clone));
24570
+ recordWorktree(path100, clone, getCurrentOrigin(clone));
24566
24571
  daemonLog(
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}`
24572
+ start3.track ? `worktree allocated ${path100} (branch ${basename18(path100)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path100} (branch ${basename18(path100)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24568
24573
  );
24569
- return path96;
24574
+ return path100;
24570
24575
  }
24571
24576
 
24572
24577
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24707,13 +24712,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24707
24712
  if (forcedSpill) daemonLog(forcedSpill);
24708
24713
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24709
24714
  return { cwd: clone, kind: "primary", created: false, clone };
24710
- const path96 = createWorktree(
24715
+ const path100 = createWorktree(
24711
24716
  clone,
24712
24717
  { root: cfg.root, trunk: cfg.trunk },
24713
24718
  boundTreeRoots2,
24714
24719
  options2.replacesTree
24715
24720
  );
24716
- return { cwd: path96, kind: "worktree", created: true, clone };
24721
+ return { cwd: path100, kind: "worktree", created: true, clone };
24717
24722
  }
24718
24723
 
24719
24724
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -25059,13 +25064,13 @@ function worktreeHoldingBranch(cwd, branch2) {
25059
25064
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
25060
25065
  if (!listing) return null;
25061
25066
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
25062
- let path96 = null;
25067
+ let path100 = null;
25063
25068
  for (const line of listing.split("\n")) {
25064
25069
  const trimmed = line.trim();
25065
25070
  if (trimmed.startsWith("worktree "))
25066
- path96 = trimmed.slice("worktree ".length).trim();
25071
+ path100 = trimmed.slice("worktree ".length).trim();
25067
25072
  else if (trimmed === `branch refs/heads/${branch2}`)
25068
- return path96 && path96 !== here ? path96 : null;
25073
+ return path100 && path100 !== here ? path100 : null;
25069
25074
  }
25070
25075
  return null;
25071
25076
  }
@@ -26169,9 +26174,9 @@ function parseRscRows(flight) {
26169
26174
  }
26170
26175
  function makeRscResolver(rows) {
26171
26176
  return (ref) => {
26172
- const [id, ...path96] = ref.slice(1).replace(/^[L@]/, "").split(":");
26177
+ const [id, ...path100] = ref.slice(1).replace(/^[L@]/, "").split(":");
26173
26178
  let v = rows[id];
26174
- for (const key of path96) {
26179
+ for (const key of path100) {
26175
26180
  if (v == null || typeof v !== "object") return void 0;
26176
26181
  v = v[key];
26177
26182
  }
@@ -26791,18 +26796,18 @@ function validateLine(line) {
26791
26796
  process.exit(1);
26792
26797
  }
26793
26798
  }
26794
- async function comment2(path96, line, body, options2 = {}) {
26799
+ async function comment2(path100, line, body, options2 = {}) {
26795
26800
  const { startLine, skipPreview } = options2;
26796
26801
  validateBody(body);
26797
26802
  validateLine(line);
26798
26803
  if (startLine !== void 0) validateLine(startLine);
26799
26804
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26800
26805
  if (!skipPreview)
26801
- await reviewProposedPrComment(`Comment on ${path96}:${range}`, body, null);
26806
+ await reviewProposedPrComment(`Comment on ${path100}:${range}`, body, null);
26802
26807
  try {
26803
26808
  const prId = getCurrentPrNodeId();
26804
- postReviewComment({ prId, body, path: path96, line, startLine });
26805
- console.log(`Added review comment on ${path96}:${range}`);
26809
+ postReviewComment({ prId, body, path: path100, line, startLine });
26810
+ console.log(`Added review comment on ${path100}:${range}`);
26806
26811
  } catch (error) {
26807
26812
  if (isGhNotInstalled(error)) {
26808
26813
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -28322,9 +28327,9 @@ function registerPrsComments(prsCommand) {
28322
28327
  });
28323
28328
  prsCommand.command("comment <path> <line> <body>").description(
28324
28329
  "Add a line comment to the pending review (body of - reads it from stdin)"
28325
- ).action(async (path96, line, body) => {
28330
+ ).action(async (path100, line, body) => {
28326
28331
  await comment2(
28327
- path96,
28332
+ path100,
28328
28333
  Number.parseInt(line, 10),
28329
28334
  await readBodyArgument(body)
28330
28335
  );
@@ -28724,11 +28729,11 @@ async function loadBody(target) {
28724
28729
  if (target.kind === "file") return readDraftFile(target.path);
28725
28730
  return fetchPrBody(target.number, target.repo);
28726
28731
  }
28727
- function readDraftFile(path96) {
28732
+ function readDraftFile(path100) {
28728
28733
  try {
28729
- return readFileSync46(path96, "utf8");
28734
+ return readFileSync46(path100, "utf8");
28730
28735
  } catch {
28731
- console.error(`Error: Could not read \`${path96}\`.`);
28736
+ console.error(`Error: Could not read \`${path100}\`.`);
28732
28737
  console.error(
28733
28738
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28734
28739
  );
@@ -29008,10 +29013,10 @@ function resolveOpSecret(reference) {
29008
29013
  }
29009
29014
 
29010
29015
  // src/commands/ravendb/ravenFetch.ts
29011
- async function ravenFetch(connection, path96) {
29016
+ async function ravenFetch(connection, path100) {
29012
29017
  const apiKey = resolveOpSecret(connection.apiKeyRef);
29013
29018
  let accessToken = await getAccessToken(apiKey);
29014
- const url = `${connection.url}${path96}`;
29019
+ const url = `${connection.url}${path100}`;
29015
29020
  const headers = {
29016
29021
  Authorization: `Bearer ${accessToken}`,
29017
29022
  "Content-Type": "application/json"
@@ -29101,16 +29106,16 @@ import chalk195 from "chalk";
29101
29106
  // src/commands/ravendb/buildQueryPath.ts
29102
29107
  function buildQueryPath(opts) {
29103
29108
  const db = encodeURIComponent(opts.db);
29104
- let path96;
29109
+ let path100;
29105
29110
  if (opts.collection) {
29106
- path96 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
29111
+ path100 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
29107
29112
  } else {
29108
- path96 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
29113
+ path100 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
29109
29114
  }
29110
29115
  if (opts.query) {
29111
- path96 += `&query=${encodeURIComponent(opts.query)}`;
29116
+ path100 += `&query=${encodeURIComponent(opts.query)}`;
29112
29117
  }
29113
- return path96;
29118
+ return path100;
29114
29119
  }
29115
29120
 
29116
29121
  // src/commands/ravendb/fetchAllPages.ts
@@ -29119,7 +29124,7 @@ async function fetchAllPages(connection, opts) {
29119
29124
  let start3 = 0;
29120
29125
  while (true) {
29121
29126
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
29122
- const path96 = buildQueryPath({
29127
+ const path100 = buildQueryPath({
29123
29128
  db: connection.database,
29124
29129
  collection: opts.collection,
29125
29130
  start: start3,
@@ -29127,7 +29132,7 @@ async function fetchAllPages(connection, opts) {
29127
29132
  sort: opts.sort,
29128
29133
  query: opts.query
29129
29134
  });
29130
- const data = await ravenFetch(connection, path96);
29135
+ const data = await ravenFetch(connection, path100);
29131
29136
  const results = data.Results ?? [];
29132
29137
  const totalResults = data.TotalResults ?? 0;
29133
29138
  if (results.length === 0) break;
@@ -29454,20 +29459,20 @@ import path45 from "path";
29454
29459
  import chalk201 from "chalk";
29455
29460
 
29456
29461
  // src/commands/lint/lint/checkFileNames.ts
29457
- import fs25 from "fs";
29462
+ import fs26 from "fs";
29458
29463
  import path41 from "path";
29459
29464
 
29460
29465
  // src/shared/findSourceFiles.ts
29461
- import fs24 from "fs";
29466
+ import fs25 from "fs";
29462
29467
  import path40 from "path";
29463
29468
  var EXTENSIONS = [".ts", ".tsx"];
29464
29469
  function findSourceFiles2(dir, options2 = {}) {
29465
29470
  const { includeTests = true } = options2;
29466
29471
  const results = [];
29467
- if (!fs24.existsSync(dir)) {
29472
+ if (!fs25.existsSync(dir)) {
29468
29473
  return results;
29469
29474
  }
29470
- const entries = fs24.readdirSync(dir, { withFileTypes: true });
29475
+ const entries = fs25.readdirSync(dir, { withFileTypes: true });
29471
29476
  for (const entry of entries) {
29472
29477
  const fullPath = path40.join(dir, entry.name);
29473
29478
  if (entry.isDirectory() && entry.name !== "node_modules") {
@@ -29517,7 +29522,7 @@ function checkFileNames() {
29517
29522
  const nameWithoutExt = fileName.replace(/\.(ts|tsx)$/, "");
29518
29523
  if (/\.(stories|test)\.(ts|tsx)$/.test(fileName)) continue;
29519
29524
  if (/^[A-Z]/.test(nameWithoutExt)) {
29520
- const content = fs25.readFileSync(filePath, "utf8");
29525
+ const content = fs26.readFileSync(filePath, "utf8");
29521
29526
  if (!hasClassOrComponent(content) && !hasMatchingTypeExport(content, nameWithoutExt)) {
29522
29527
  violations.push({
29523
29528
  filePath,
@@ -29534,7 +29539,7 @@ function checkFileNames() {
29534
29539
  import chalk200 from "chalk";
29535
29540
 
29536
29541
  // src/commands/lint/lint/applyMoves.ts
29537
- import fs26 from "fs";
29542
+ import fs27 from "fs";
29538
29543
  import path43 from "path";
29539
29544
 
29540
29545
  // src/commands/lint/lint/renameExports.ts
@@ -29570,8 +29575,8 @@ function isCaseOnly(a, b) {
29570
29575
  }
29571
29576
  function moveCaseInsensitive(absSource, absDest) {
29572
29577
  const tmp = `${absSource}.tmp`;
29573
- fs26.renameSync(absSource, tmp);
29574
- fs26.renameSync(tmp, absDest);
29578
+ fs27.renameSync(absSource, tmp);
29579
+ fs27.renameSync(tmp, absDest);
29575
29580
  }
29576
29581
  function applyMoves(project, moves, cwd, emit4) {
29577
29582
  for (const { sourcePath, destPath } of moves) {
@@ -29591,19 +29596,19 @@ function applyMoves(project, moves, cwd, emit4) {
29591
29596
  for (const { sourcePath, destPath } of moves) {
29592
29597
  const absSource = path43.resolve(sourcePath);
29593
29598
  const absDest = path43.resolve(destPath);
29594
- if (isCaseOnly(absSource, absDest) && fs26.existsSync(absSource)) {
29599
+ if (isCaseOnly(absSource, absDest) && fs27.existsSync(absSource)) {
29595
29600
  moveCaseInsensitive(absSource, absDest);
29596
29601
  }
29597
29602
  }
29598
29603
  }
29599
29604
 
29600
29605
  // src/commands/lint/lint/createLintProject.ts
29601
- import fs27 from "fs";
29606
+ import fs28 from "fs";
29602
29607
  import path44 from "path";
29603
29608
  import { Project as Project2 } from "ts-morph";
29604
29609
  function createLintProject() {
29605
29610
  const tsConfigPath = path44.resolve("tsconfig.json");
29606
- const project = fs27.existsSync(tsConfigPath) ? new Project2({
29611
+ const project = fs28.existsSync(tsConfigPath) ? new Project2({
29607
29612
  tsConfigFilePath: tsConfigPath,
29608
29613
  skipAddingFilesFromTsConfig: true
29609
29614
  }) : new Project2();
@@ -29660,7 +29665,7 @@ function runFileNameCheck(fix = false) {
29660
29665
  }
29661
29666
 
29662
29667
  // src/commands/lint/lint/runImportExtensionCheck.ts
29663
- import fs28 from "fs";
29668
+ import fs29 from "fs";
29664
29669
 
29665
29670
  // src/commands/lint/shared.ts
29666
29671
  import chalk202 from "chalk";
@@ -29686,7 +29691,7 @@ ${checkName2} failed:
29686
29691
 
29687
29692
  // src/commands/lint/lint/runImportExtensionCheck.ts
29688
29693
  function checkForImportExtensions(filePath) {
29689
- const content = fs28.readFileSync(filePath, "utf8");
29694
+ const content = fs29.readFileSync(filePath, "utf8");
29690
29695
  const lines2 = content.split("\n");
29691
29696
  const violations = [];
29692
29697
  const importExtensionPattern = /from\s+["']\..*\.(js|ts)["']/;
@@ -29720,9 +29725,9 @@ function runImportExtensionCheck() {
29720
29725
  }
29721
29726
 
29722
29727
  // src/commands/lint/lint/runStaticImportCheck.ts
29723
- import fs29 from "fs";
29728
+ import fs30 from "fs";
29724
29729
  function checkForDynamicImports(filePath) {
29725
- const content = fs29.readFileSync(filePath, "utf8");
29730
+ const content = fs30.readFileSync(filePath, "utf8");
29726
29731
  const lines2 = content.split("\n");
29727
29732
  const violations = [];
29728
29733
  const requirePattern = /\brequire\s*\(/;
@@ -30301,17 +30306,17 @@ Refactor check failed:
30301
30306
 
30302
30307
  // src/commands/refactor/check/getViolations/index.ts
30303
30308
  import { execSync as execSync59 } from "child_process";
30304
- import fs31 from "fs";
30309
+ import fs32 from "fs";
30305
30310
  import { minimatch as minimatch6 } from "minimatch";
30306
30311
 
30307
30312
  // src/commands/refactor/check/getViolations/getIgnoredFiles.ts
30308
- import fs30 from "fs";
30313
+ import fs31 from "fs";
30309
30314
  var REFACTOR_YML_PATH = "refactor.yml";
30310
30315
  function parseRefactorYml() {
30311
- if (!fs30.existsSync(REFACTOR_YML_PATH)) {
30316
+ if (!fs31.existsSync(REFACTOR_YML_PATH)) {
30312
30317
  return [];
30313
30318
  }
30314
- const content = fs30.readFileSync(REFACTOR_YML_PATH, "utf8");
30319
+ const content = fs31.readFileSync(REFACTOR_YML_PATH, "utf8");
30315
30320
  const entries = [];
30316
30321
  const lines2 = content.split("\n");
30317
30322
  let currentEntry = {};
@@ -30341,7 +30346,7 @@ function getIgnoredFiles() {
30341
30346
 
30342
30347
  // src/commands/refactor/check/getViolations/index.ts
30343
30348
  function countLines(filePath) {
30344
- const content = fs31.readFileSync(filePath, "utf8");
30349
+ const content = fs32.readFileSync(filePath, "utf8");
30345
30350
  return content.split("\n").length;
30346
30351
  }
30347
30352
  function getGitFiles(options2) {
@@ -30512,7 +30517,7 @@ function removeStaleImports(sourceFile) {
30512
30517
 
30513
30518
  // src/commands/refactor/extract/updateImporters.ts
30514
30519
  function updateImporters(functionName, sourceFile, importers) {
30515
- for (const { file: importerFile, relPath: relPath2 } of importers) {
30520
+ for (const { file: importerFile, relPath: relPath3 } of importers) {
30516
30521
  let alias;
30517
30522
  for (const importDecl of importerFile.getImportDeclarations()) {
30518
30523
  if (importDecl.getModuleSpecifierSourceFile() !== sourceFile) continue;
@@ -30528,7 +30533,7 @@ function updateImporters(functionName, sourceFile, importers) {
30528
30533
  }
30529
30534
  }
30530
30535
  addImportPreservingSuppressions(importerFile, {
30531
- moduleSpecifier: relPath2,
30536
+ moduleSpecifier: relPath3,
30532
30537
  namedImports: [alias ? { name: functionName, alias } : functionName]
30533
30538
  });
30534
30539
  }
@@ -31099,11 +31104,11 @@ import chalk208 from "chalk";
31099
31104
  import { Project as Project4 } from "ts-morph";
31100
31105
 
31101
31106
  // src/commands/refactor/extract/findTsConfig.ts
31102
- import fs33 from "fs";
31107
+ import fs34 from "fs";
31103
31108
  import path53 from "path";
31104
31109
 
31105
31110
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
31106
- import fs32 from "fs";
31111
+ import fs33 from "fs";
31107
31112
  import path52 from "path";
31108
31113
 
31109
31114
  // src/commands/refactor/extract/projectIncludesFile.ts
@@ -31124,7 +31129,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
31124
31129
  const nested = path52.join(dir, "tsconfig.json");
31125
31130
  if (!tried.has(nested)) {
31126
31131
  tried.add(nested);
31127
- if (fs32.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
31132
+ if (fs33.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
31128
31133
  return nested;
31129
31134
  }
31130
31135
  }
@@ -31138,7 +31143,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
31138
31143
  // src/commands/refactor/extract/findTsConfig.ts
31139
31144
  function findTsConfig(sourcePath) {
31140
31145
  const rootConfig = path53.resolve("tsconfig.json");
31141
- if (!fs33.existsSync(rootConfig)) return rootConfig;
31146
+ if (!fs34.existsSync(rootConfig)) return rootConfig;
31142
31147
  const tried = /* @__PURE__ */ new Set();
31143
31148
  const candidates = [rootConfig, ...readReferences(rootConfig)];
31144
31149
  for (const candidate of candidates) {
@@ -31146,7 +31151,7 @@ function findTsConfig(sourcePath) {
31146
31151
  tried.add(candidate);
31147
31152
  if (projectIncludesFile(candidate, sourcePath)) return candidate;
31148
31153
  }
31149
- const siblings = fs33.readdirSync(path53.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path53.resolve(path53.dirname(rootConfig), f));
31154
+ const siblings = fs34.readdirSync(path53.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path53.resolve(path53.dirname(rootConfig), f));
31150
31155
  for (const sibling of siblings) {
31151
31156
  if (tried.has(sibling)) continue;
31152
31157
  tried.add(sibling);
@@ -31161,8 +31166,8 @@ function findTsConfig(sourcePath) {
31161
31166
  return rootConfig;
31162
31167
  }
31163
31168
  function readReferences(configPath) {
31164
- if (!fs33.existsSync(configPath)) return [];
31165
- const raw = fs33.readFileSync(configPath, "utf8");
31169
+ if (!fs34.existsSync(configPath)) return [];
31170
+ const raw = fs34.readFileSync(configPath, "utf8");
31166
31171
  const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
31167
31172
  let parsed;
31168
31173
  try {
@@ -31174,8 +31179,8 @@ function readReferences(configPath) {
31174
31179
  const cwd = path53.dirname(configPath);
31175
31180
  return parsed.references.map((ref) => {
31176
31181
  const refPath = path53.resolve(cwd, ref.path);
31177
- return fs33.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path53.join(refPath, "tsconfig.json") : refPath;
31178
- }).filter((p) => fs33.existsSync(p));
31182
+ return fs34.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path53.join(refPath, "tsconfig.json") : refPath;
31183
+ }).filter((p) => fs34.existsSync(p));
31179
31184
  }
31180
31185
 
31181
31186
  // src/commands/refactor/extract/loadProjectFile.ts
@@ -31217,25 +31222,25 @@ async function extract(file, functionName, destination, options2 = {}) {
31217
31222
  }
31218
31223
 
31219
31224
  // src/commands/refactor/ignore.ts
31220
- import fs34 from "fs";
31225
+ import fs35 from "fs";
31221
31226
  import chalk210 from "chalk";
31222
31227
  var REFACTOR_YML_PATH2 = "refactor.yml";
31223
31228
  function ignore2(file) {
31224
- if (!fs34.existsSync(file)) {
31229
+ if (!fs35.existsSync(file)) {
31225
31230
  console.error(chalk210.red(`Error: File does not exist: ${file}`));
31226
31231
  process.exit(1);
31227
31232
  }
31228
- const content = fs34.readFileSync(file, "utf8");
31233
+ const content = fs35.readFileSync(file, "utf8");
31229
31234
  const lineCount = content.split("\n").length;
31230
31235
  const maxLines = lineCount + 10;
31231
31236
  const entry = `- file: ${file}
31232
31237
  maxLines: ${maxLines}
31233
31238
  `;
31234
- if (fs34.existsSync(REFACTOR_YML_PATH2)) {
31235
- const existing = fs34.readFileSync(REFACTOR_YML_PATH2, "utf8");
31236
- fs34.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
31239
+ if (fs35.existsSync(REFACTOR_YML_PATH2)) {
31240
+ const existing = fs35.readFileSync(REFACTOR_YML_PATH2, "utf8");
31241
+ fs35.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
31237
31242
  } else {
31238
- fs34.writeFileSync(REFACTOR_YML_PATH2, entry);
31243
+ fs35.writeFileSync(REFACTOR_YML_PATH2, entry);
31239
31244
  }
31240
31245
  console.log(
31241
31246
  chalk210.green(
@@ -31245,12 +31250,12 @@ function ignore2(file) {
31245
31250
  }
31246
31251
 
31247
31252
  // src/commands/refactor/rename/index.ts
31248
- import fs37 from "fs";
31249
- import path60 from "path";
31253
+ import fs38 from "fs";
31254
+ import path61 from "path";
31250
31255
  import chalk213 from "chalk";
31251
31256
 
31252
31257
  // src/commands/refactor/rename/applyRename.ts
31253
- import fs36 from "fs";
31258
+ import fs37 from "fs";
31254
31259
  import path57 from "path";
31255
31260
  import chalk211 from "chalk";
31256
31261
 
@@ -31258,7 +31263,7 @@ import chalk211 from "chalk";
31258
31263
  import path56 from "path";
31259
31264
 
31260
31265
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
31261
- import fs35 from "fs";
31266
+ import fs36 from "fs";
31262
31267
  function getOrCreateList(map, key) {
31263
31268
  const list5 = map.get(key) ?? [];
31264
31269
  if (!map.has(key)) map.set(key, list5);
@@ -31271,17 +31276,18 @@ function groupByFile2(rewrites) {
31271
31276
  }
31272
31277
  return grouped;
31273
31278
  }
31274
- function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
31275
- const escaped = oldSpecifier.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
31276
- const pattern2 = new RegExp(`(from\\s+["'])${escaped}(["'])`, "g");
31277
- return content.replace(pattern2, `$1${newSpecifier}$2`);
31278
- }
31279
+ var MODULE_REFERENCE = /(\bfrom\s+|\bimport\s+|\bimport\s*\(\s*|\bvi\.\w+(?:<[^>]*>)?\(\s*)(["'])([^"'\n]+)\2/g;
31279
31280
  function applyFileRewrites(file, fileRewrites) {
31280
- let content = fs35.readFileSync(file, "utf8");
31281
- for (const { oldSpecifier, newSpecifier } of fileRewrites) {
31282
- content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
31283
- }
31284
- return content;
31281
+ const replacements = new Map(
31282
+ fileRewrites.map((r) => [r.oldSpecifier, r.newSpecifier])
31283
+ );
31284
+ return fs36.readFileSync(file, "utf8").replace(
31285
+ MODULE_REFERENCE,
31286
+ (match, prefix2, quote, specifier) => {
31287
+ const replacement = replacements.get(specifier);
31288
+ return replacement === void 0 ? match : `${prefix2}${quote}${replacement}${quote}`;
31289
+ }
31290
+ );
31285
31291
  }
31286
31292
  function applyRewrites(rewrites) {
31287
31293
  const updatedContents = /* @__PURE__ */ new Map();
@@ -31356,12 +31362,12 @@ function computeRewrites(moves, edges, allProjectFiles) {
31356
31362
  function applyRename(rewrites, sourcePath, destPath, cwd) {
31357
31363
  const updatedContents = applyRewrites(rewrites);
31358
31364
  for (const [file, content] of updatedContents) {
31359
- fs36.writeFileSync(file, content, "utf8");
31365
+ fs37.writeFileSync(file, content, "utf8");
31360
31366
  console.log(chalk211.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
31361
31367
  }
31362
31368
  const destDir = path57.dirname(destPath);
31363
- if (!fs36.existsSync(destDir)) fs36.mkdirSync(destDir, { recursive: true });
31364
- fs36.renameSync(sourcePath, destPath);
31369
+ if (!fs37.existsSync(destDir)) fs37.mkdirSync(destDir, { recursive: true });
31370
+ fs37.renameSync(sourcePath, destPath);
31365
31371
  console.log(
31366
31372
  chalk211.white(
31367
31373
  ` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
@@ -31370,8 +31376,12 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
31370
31376
  }
31371
31377
 
31372
31378
  // src/commands/refactor/restructure/buildImportGraph/index.ts
31379
+ import path59 from "path";
31380
+ import ts9 from "typescript";
31381
+
31382
+ // src/commands/refactor/restructure/buildImportGraph/collectSourceFileEdges.ts
31373
31383
  import path58 from "path";
31374
- import ts7 from "typescript";
31384
+ import ts8 from "typescript";
31375
31385
 
31376
31386
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
31377
31387
  import ts6 from "typescript";
@@ -31396,13 +31406,73 @@ function getImportSpecifiers(sourceFile) {
31396
31406
  return specifiers;
31397
31407
  }
31398
31408
 
31409
+ // src/commands/refactor/restructure/buildImportGraph/getMockSpecifiers.ts
31410
+ import ts7 from "typescript";
31411
+ var MOCK_METHODS = /* @__PURE__ */ new Set([
31412
+ "mock",
31413
+ "doMock",
31414
+ "unmock",
31415
+ "doUnmock",
31416
+ "importActual",
31417
+ "importMock"
31418
+ ]);
31419
+ function isViMockCall(node) {
31420
+ const callee = node.expression;
31421
+ return ts7.isPropertyAccessExpression(callee) && ts7.isIdentifier(callee.expression) && callee.expression.text === "vi" && MOCK_METHODS.has(callee.name.text);
31422
+ }
31423
+ function getMockSpecifiers(sourceFile) {
31424
+ const specifiers = [];
31425
+ const visit = (node) => {
31426
+ if (ts7.isCallExpression(node) && isViMockCall(node)) {
31427
+ const [first] = node.arguments;
31428
+ if (first && ts7.isStringLiteral(first)) specifiers.push(first.text);
31429
+ }
31430
+ ts7.forEachChild(node, visit);
31431
+ };
31432
+ visit(sourceFile);
31433
+ return specifiers;
31434
+ }
31435
+
31436
+ // src/commands/refactor/restructure/buildImportGraph/specifiersOf.ts
31437
+ function specifiersOf(sourceFile, includeMocks) {
31438
+ const imports = getImportSpecifiers(sourceFile).map((specifier) => ({
31439
+ specifier,
31440
+ mock: false
31441
+ }));
31442
+ if (!includeMocks) return imports;
31443
+ const mocks = getMockSpecifiers(sourceFile).map((specifier) => ({
31444
+ specifier,
31445
+ mock: true
31446
+ }));
31447
+ return [...imports, ...mocks];
31448
+ }
31449
+
31450
+ // src/commands/refactor/restructure/buildImportGraph/collectSourceFileEdges.ts
31451
+ function resolveImport(specifier, filePath, options2) {
31452
+ if (!specifier.startsWith(".")) return null;
31453
+ const resolved = ts8.resolveModuleName(specifier, filePath, options2, ts8.sys);
31454
+ const resolvedPath = resolved.resolvedModule?.resolvedFileName;
31455
+ if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
31456
+ return path58.resolve(resolvedPath);
31457
+ }
31458
+ function collectSourceFileEdges(sourceFile, options2, includeMocks) {
31459
+ const source = path58.resolve(sourceFile.fileName);
31460
+ return specifiersOf(sourceFile, includeMocks).flatMap(
31461
+ ({ specifier, mock }) => {
31462
+ const target = resolveImport(specifier, source, options2);
31463
+ if (!target) return [];
31464
+ return [{ source, target, specifier, ...mock && { mock } }];
31465
+ }
31466
+ );
31467
+ }
31468
+
31399
31469
  // src/commands/refactor/restructure/buildImportGraph/index.ts
31400
31470
  function loadParsedConfig(tsConfigPath) {
31401
- const configFile = ts7.readConfigFile(tsConfigPath, ts7.sys.readFile);
31402
- return ts7.parseJsonConfigFileContent(
31471
+ const configFile = ts9.readConfigFile(tsConfigPath, ts9.sys.readFile);
31472
+ return ts9.parseJsonConfigFileContent(
31403
31473
  configFile.config,
31404
- ts7.sys,
31405
- path58.dirname(tsConfigPath)
31474
+ ts9.sys,
31475
+ path59.dirname(tsConfigPath)
31406
31476
  );
31407
31477
  }
31408
31478
  function addToSetMap(map, key, value) {
@@ -31413,28 +31483,22 @@ function addToSetMap(map, key, value) {
31413
31483
  }
31414
31484
  set.add(value);
31415
31485
  }
31416
- function resolveImport(specifier, filePath, options2) {
31417
- if (!specifier.startsWith(".")) return null;
31418
- const resolved = ts7.resolveModuleName(specifier, filePath, options2, ts7.sys);
31419
- const resolvedPath = resolved.resolvedModule?.resolvedFileName;
31420
- if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
31421
- return path58.resolve(resolvedPath);
31422
- }
31423
- function buildImportGraph(candidateFiles, tsConfigPath) {
31486
+ function buildImportGraph(candidateFiles, tsConfigPath, options2 = {}) {
31424
31487
  const parsed = loadParsedConfig(tsConfigPath);
31425
- const program2 = ts7.createProgram(parsed.fileNames, parsed.options);
31488
+ const program2 = ts9.createProgram(parsed.fileNames, parsed.options);
31426
31489
  const edges = [];
31427
31490
  const importedBy = /* @__PURE__ */ new Map();
31428
31491
  const imports = /* @__PURE__ */ new Map();
31429
31492
  for (const sourceFile of program2.getSourceFiles()) {
31430
- const filePath = path58.resolve(sourceFile.fileName);
31431
- if (filePath.includes("node_modules")) continue;
31432
- for (const specifier of getImportSpecifiers(sourceFile)) {
31433
- const absTarget = resolveImport(specifier, filePath, parsed.options);
31434
- if (!absTarget) continue;
31435
- edges.push({ source: filePath, target: absTarget, specifier });
31436
- addToSetMap(importedBy, absTarget, filePath);
31437
- addToSetMap(imports, filePath, absTarget);
31493
+ if (sourceFile.fileName.includes("node_modules")) continue;
31494
+ for (const edge of collectSourceFileEdges(
31495
+ sourceFile,
31496
+ parsed.options,
31497
+ options2.includeMocks ?? false
31498
+ )) {
31499
+ edges.push(edge);
31500
+ addToSetMap(importedBy, edge.target, edge.source);
31501
+ addToSetMap(imports, edge.source, edge.target);
31438
31502
  }
31439
31503
  }
31440
31504
  return { files: candidateFiles, edges, importedBy, imports };
@@ -31454,13 +31518,13 @@ function computeRenameRewrites(sourcePath, destPath) {
31454
31518
  }
31455
31519
 
31456
31520
  // src/commands/refactor/rename/printRenamePreview.ts
31457
- import path59 from "path";
31521
+ import path60 from "path";
31458
31522
  import chalk212 from "chalk";
31459
31523
  function printRenamePreview(rewrites, cwd) {
31460
31524
  for (const rewrite of rewrites) {
31461
31525
  console.log(
31462
31526
  chalk212.dim(
31463
- ` ${path59.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
31527
+ ` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
31464
31528
  )
31465
31529
  );
31466
31530
  }
@@ -31469,16 +31533,16 @@ function printRenamePreview(rewrites, cwd) {
31469
31533
 
31470
31534
  // src/commands/refactor/rename/index.ts
31471
31535
  async function rename(source, destination, options2 = {}) {
31472
- const sourcePath = path60.resolve(source);
31473
- const destPath = path60.resolve(destination);
31536
+ const sourcePath = path61.resolve(source);
31537
+ const destPath = path61.resolve(destination);
31474
31538
  const cwd = process.cwd();
31475
- const relSource = path60.relative(cwd, sourcePath);
31476
- const relDest = path60.relative(cwd, destPath);
31477
- if (!fs37.existsSync(sourcePath)) {
31539
+ const relSource = path61.relative(cwd, sourcePath);
31540
+ const relDest = path61.relative(cwd, destPath);
31541
+ if (!fs38.existsSync(sourcePath)) {
31478
31542
  console.log(chalk213.red(`File not found: ${source}`));
31479
31543
  process.exit(1);
31480
31544
  }
31481
- if (destPath !== sourcePath && fs37.existsSync(destPath)) {
31545
+ if (destPath !== sourcePath && fs38.existsSync(destPath)) {
31482
31546
  console.log(chalk213.red(`Destination already exists: ${destination}`));
31483
31547
  process.exit(1);
31484
31548
  }
@@ -31528,12 +31592,12 @@ function findSymbol(sourceFile, symbolName) {
31528
31592
  }
31529
31593
 
31530
31594
  // src/commands/refactor/renameSymbol/groupReferences.ts
31531
- import path61 from "path";
31595
+ import path62 from "path";
31532
31596
  function groupReferences(symbol, cwd) {
31533
31597
  const refs = symbol.findReferencesAsNodes();
31534
31598
  const grouped = /* @__PURE__ */ new Map();
31535
31599
  for (const ref of refs) {
31536
- const refFile = path61.relative(cwd, ref.getSourceFile().getFilePath());
31600
+ const refFile = path62.relative(cwd, ref.getSourceFile().getFilePath());
31537
31601
  const lines2 = grouped.get(refFile) ?? [];
31538
31602
  if (!grouped.has(refFile)) grouped.set(refFile, lines2);
31539
31603
  lines2.push(ref.getStartLineNumber());
@@ -31572,170 +31636,96 @@ Renamed ${oldName} \u2192 ${newName}`));
31572
31636
  }
31573
31637
 
31574
31638
  // src/commands/refactor/restructure/index.ts
31575
- import fs39 from "fs";
31576
- import path73 from "path";
31577
- import chalk217 from "chalk";
31578
-
31579
- // src/commands/refactor/restructure/displayPlan.ts
31580
- import path64 from "path";
31581
- import chalk215 from "chalk";
31639
+ import fs40 from "fs";
31640
+ import path77 from "path";
31641
+ import chalk220 from "chalk";
31582
31642
 
31583
- // src/commands/refactor/restructure/computeDepthStats.ts
31584
- import path62 from "path";
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);
31593
- }
31594
- return { max, distribution };
31595
- }
31643
+ // src/commands/refactor/restructure/applyPlan.ts
31644
+ import chalk216 from "chalk";
31596
31645
 
31597
- // src/commands/refactor/restructure/formatTree.ts
31646
+ // src/commands/refactor/restructure/executePlan.ts
31647
+ import fs39 from "fs";
31598
31648
  import path63 from "path";
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;
31649
+ import chalk215 from "chalk";
31650
+ function relPath(file) {
31651
+ return path63.relative(process.cwd(), file);
31624
31652
  }
31625
-
31626
- // src/commands/refactor/restructure/displayPlan.ts
31627
- function relPath(filePath) {
31628
- return path64.relative(process.cwd(), filePath);
31653
+ function stagingPath(move2, index3) {
31654
+ return `${move2.from}.restructure-${process.pid}-${index3}`;
31629
31655
  }
31630
- function displayMoves(plan2) {
31631
- if (plan2.moves.length === 0) return;
31632
- console.log(chalk215.bold("\nFile moves:"));
31633
- for (const move2 of plan2.moves) {
31656
+ function moveFiles(moves) {
31657
+ const staged = moves.map((move2, i) => {
31658
+ const staging = stagingPath(move2, i);
31659
+ fs39.renameSync(move2.from, staging);
31660
+ return { move: move2, staging };
31661
+ });
31662
+ for (const { move: move2, staging } of staged) {
31663
+ fs39.mkdirSync(path63.dirname(move2.to), { recursive: true });
31664
+ fs39.renameSync(staging, move2.to);
31634
31665
  console.log(
31635
- ` ${chalk215.red(relPath(move2.from))} \u2192 ${chalk215.green(relPath(move2.to))}`
31666
+ chalk215.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
31636
31667
  );
31637
- console.log(chalk215.dim(` ${move2.reason}`));
31638
31668
  }
31639
31669
  }
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
- );
31653
- console.log(chalk215.bold(`
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}`));
31670
+ function removeIfEmpty(dir) {
31671
+ if (!fs39.existsSync(dir) || fs39.readdirSync(dir).length > 0) return false;
31672
+ fs39.rmdirSync(dir);
31673
+ console.log(chalk215.dim(` Removed empty directory ${relPath(dir)}`));
31674
+ return true;
31662
31675
  }
31663
- function displayPlan2(plan2) {
31664
- displayMoves(plan2);
31665
- displayTree(plan2);
31666
- displayDepthStats(plan2);
31667
- displayErrors(plan2.errors);
31668
- const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
31669
- console.log(
31670
- chalk215.dim(
31671
- `
31672
- Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
31673
- )
31674
- );
31676
+ function removeEmptyDirectories(dirs, scopeRoot) {
31677
+ const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
31678
+ for (let dir of deepestFirst) {
31679
+ while (dir.startsWith(`${scopeRoot}${path63.sep}`) && removeIfEmpty(dir))
31680
+ dir = path63.dirname(dir);
31681
+ }
31675
31682
  }
31676
-
31677
- // src/commands/refactor/restructure/executePlan.ts
31678
- import fs38 from "fs";
31679
- import path65 from "path";
31680
- import chalk216 from "chalk";
31681
31683
  function executePlan(plan2) {
31682
- const updatedContents = applyRewrites(plan2.rewrites);
31683
- for (const [file, content] of updatedContents) {
31684
- fs38.writeFileSync(file, content, "utf8");
31685
- console.log(
31686
- chalk216.cyan(` Rewrote imports in ${path65.relative(process.cwd(), file)}`)
31687
- );
31684
+ for (const [file, content] of applyRewrites(plan2.rewrites)) {
31685
+ fs39.writeFileSync(file, content, "utf8");
31686
+ console.log(chalk215.cyan(` Rewrote imports in ${relPath(file)}`));
31688
31687
  }
31689
- for (const move2 of plan2.moves) {
31690
- const targetDir = path65.dirname(move2.to);
31691
- if (!fs38.existsSync(targetDir)) {
31692
- fs38.mkdirSync(targetDir, { recursive: true });
31693
- }
31694
- fs38.renameSync(move2.from, move2.to);
31695
- console.log(
31696
- chalk216.white(
31697
- ` Moved ${path65.relative(process.cwd(), move2.from)} \u2192 ${path65.relative(process.cwd(), move2.to)}`
31698
- )
31699
- );
31700
- }
31701
- removeEmptyDirectories(plan2.moves.map((m) => path65.dirname(m.from)));
31688
+ moveFiles(plan2.moves);
31689
+ removeEmptyDirectories(
31690
+ plan2.moves.map((m) => path63.dirname(m.from)),
31691
+ plan2.scopeRoot
31692
+ );
31702
31693
  }
31703
- function removeEmptyDirectories(dirs) {
31704
- const unique = [...new Set(dirs)];
31705
- for (const dir of unique) {
31706
- if (!fs38.existsSync(dir)) continue;
31707
- const entries = fs38.readdirSync(dir);
31708
- if (entries.length === 0) {
31709
- fs38.rmdirSync(dir);
31710
- console.log(
31711
- chalk216.dim(
31712
- ` Removed empty directory ${path65.relative(process.cwd(), dir)}`
31713
- )
31714
- );
31715
- }
31694
+
31695
+ // src/commands/refactor/restructure/applyPlan.ts
31696
+ function applyPlan(plan2) {
31697
+ if (plan2.errors.length > 0) {
31698
+ console.log(chalk216.red("\nResolve the errors above before applying."));
31699
+ process.exit(1);
31716
31700
  }
31701
+ console.log(chalk216.bold("\nApplying changes..."));
31702
+ executePlan(plan2);
31703
+ console.log(chalk216.green("\nRestructuring complete"));
31717
31704
  }
31718
31705
 
31706
+ // src/commands/refactor/restructure/buildPlan.ts
31707
+ import path71 from "path";
31708
+
31719
31709
  // src/commands/refactor/restructure/planRestructure/index.ts
31720
- import path72 from "path";
31710
+ import path70 from "path";
31721
31711
 
31722
31712
  // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
31723
- import path68 from "path";
31713
+ import path66 from "path";
31724
31714
 
31725
31715
  // src/commands/refactor/restructure/planRestructure/isTestFile.ts
31726
- import path66 from "path";
31716
+ import path64 from "path";
31727
31717
  var TEST_SUFFIX = /\.test\.tsx?$/;
31728
31718
  function isTestFile(file) {
31729
31719
  return TEST_SUFFIX.test(file);
31730
31720
  }
31731
31721
  function testStem(file) {
31732
- return path66.basename(file).replace(TEST_SUFFIX, "");
31722
+ return path64.basename(file).replace(TEST_SUFFIX, "");
31733
31723
  }
31734
31724
 
31735
31725
  // src/commands/refactor/restructure/planRestructure/moduleStem.ts
31736
- import path67 from "path";
31726
+ import path65 from "path";
31737
31727
  function moduleStem(file) {
31738
- return path67.basename(file).replace(/\.tsx?$/, "");
31728
+ return path65.basename(file).replace(/\.tsx?$/, "");
31739
31729
  }
31740
31730
 
31741
31731
  // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
@@ -31743,7 +31733,7 @@ function sorted(set) {
31743
31733
  return [...set ?? []].sort();
31744
31734
  }
31745
31735
  function names(files) {
31746
- return files.map((f) => path68.basename(f)).join(", ");
31736
+ return files.map((f) => path66.basename(f)).join(", ");
31747
31737
  }
31748
31738
  function anchorsOf(files, mode) {
31749
31739
  return files.map((file) => ({ file, mode }));
@@ -31794,16 +31784,16 @@ function collectAnchors(files, index3) {
31794
31784
  }
31795
31785
 
31796
31786
  // src/commands/refactor/restructure/planRestructure/findCollisions.ts
31797
- import path69 from "path";
31787
+ import path67 from "path";
31798
31788
  function findCollisions(targets, scopeRoot) {
31799
31789
  const byModule = /* @__PURE__ */ new Map();
31800
31790
  for (const [file, target] of targets) {
31801
- const key = path69.join(path69.dirname(target), moduleStem(target));
31791
+ const key = path67.join(path67.dirname(target), moduleStem(target));
31802
31792
  byModule.set(key, [...byModule.get(key) ?? [], file]);
31803
31793
  }
31804
31794
  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));
31795
+ const where = path67.relative(scopeRoot, path67.dirname(key)) || ".";
31796
+ const sources = files.sort().map((f) => path67.relative(scopeRoot, f));
31807
31797
  return `Basename collision in ${where}/: ${sources.join(", ")}`;
31808
31798
  }).sort();
31809
31799
  }
@@ -31835,7 +31825,7 @@ function indexEdges(scope, edges) {
31835
31825
  }
31836
31826
 
31837
31827
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31838
- import path71 from "path";
31828
+ import path69 from "path";
31839
31829
 
31840
31830
  // src/commands/refactor/restructure/planRestructure/findStronglyConnectedComponents.ts
31841
31831
  function push(state, frames, node) {
@@ -31891,22 +31881,22 @@ function findStronglyConnectedComponents(nodes, successors) {
31891
31881
  }
31892
31882
 
31893
31883
  // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
31894
- import path70 from "path";
31884
+ import path68 from "path";
31895
31885
  function lowestCommonAncestor(dirs) {
31896
- const [first, ...rest] = dirs.map((d) => d.split(path70.sep));
31886
+ const [first, ...rest] = dirs.map((d) => d.split(path68.sep));
31897
31887
  let common = first;
31898
31888
  for (const parts of rest) {
31899
31889
  let i = 0;
31900
31890
  while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
31901
31891
  common = common.slice(0, i);
31902
31892
  }
31903
- return common.join(path70.sep) || path70.sep;
31893
+ return common.join(path68.sep) || path68.sep;
31904
31894
  }
31905
31895
 
31906
31896
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31907
31897
  function anchorFolder(anchor, dirs) {
31908
31898
  const dir = dirs.get(anchor.file);
31909
- return anchor.mode === "child" ? path71.join(dir, moduleStem(anchor.file)) : dir;
31899
+ return anchor.mode === "child" ? path69.join(dir, moduleStem(anchor.file)) : dir;
31910
31900
  }
31911
31901
  function externalAnchors(component, anchorings) {
31912
31902
  const members = new Set(component);
@@ -31925,7 +31915,7 @@ function componentDir(component, anchorings, dirs, scopeRoot) {
31925
31915
  }
31926
31916
  function componentReason(file, component, base) {
31927
31917
  if (component.length === 1) return base;
31928
- const others = component.filter((f) => f !== file).map((f) => path71.basename(f));
31918
+ const others = component.filter((f) => f !== file).map((f) => path69.basename(f));
31929
31919
  return `${base}; cycle with ${others.join(", ")}`;
31930
31920
  }
31931
31921
  function placeComponents(files, anchorings, scopeRoot) {
@@ -31948,7 +31938,7 @@ function placeComponents(files, anchorings, scopeRoot) {
31948
31938
 
31949
31939
  // src/commands/refactor/restructure/planRestructure/index.ts
31950
31940
  function planRestructure(input) {
31951
- const scopeRoot = path72.resolve(input.scopeRoot);
31941
+ const scopeRoot = path70.resolve(input.scopeRoot);
31952
31942
  const files = [...new Set(input.files)].sort();
31953
31943
  const index3 = indexEdges(new Set(files), input.edges);
31954
31944
  const anchorings = collectAnchors(files, index3);
@@ -31957,7 +31947,7 @@ function planRestructure(input) {
31957
31947
  const moves = [];
31958
31948
  for (const file of files) {
31959
31949
  const { dir, reason: reason4 } = placements.get(file);
31960
- const to = path72.join(dir, path72.basename(file));
31950
+ const to = path70.join(dir, path70.basename(file));
31961
31951
  targets.set(file, to);
31962
31952
  if (to !== file) moves.push({ from: file, to, reason: reason4 });
31963
31953
  }
@@ -31965,50 +31955,202 @@ function planRestructure(input) {
31965
31955
  }
31966
31956
 
31967
31957
  // src/commands/refactor/restructure/buildPlan.ts
31968
- function buildPlan3(scopeRoot, files) {
31969
- const graph = buildImportGraph(new Set(files), findTsConfig(files[0]));
31958
+ function moduleKey(file) {
31959
+ return path71.join(path71.dirname(file), moduleStem(file));
31960
+ }
31961
+ function findIgnoredOccupants(moves, ignored, scopeRoot) {
31962
+ const occupants = new Map(ignored.map((f) => [moduleKey(f), f]));
31963
+ return moves.flatMap((move2) => {
31964
+ const occupant = occupants.get(moduleKey(move2.to));
31965
+ if (!occupant) return [];
31966
+ const rel = (f) => path71.relative(scopeRoot, f);
31967
+ return [
31968
+ `Target of ${rel(move2.from)} is occupied by ignored file ${rel(occupant)}`
31969
+ ];
31970
+ });
31971
+ }
31972
+ function buildPlan3(scopeRoot, files, ignored = []) {
31973
+ const graph = buildImportGraph(new Set(files), findTsConfig(files[0]), {
31974
+ includeMocks: true
31975
+ });
31970
31976
  const { targets, moves, errors } = planRestructure({
31971
31977
  scopeRoot,
31972
31978
  files,
31973
- edges: graph.edges
31979
+ edges: graph.edges.filter((e) => !e.mock)
31974
31980
  });
31975
31981
  const allProjectFiles = /* @__PURE__ */ new Set([
31976
31982
  ...graph.importedBy.keys(),
31977
31983
  ...graph.imports.keys()
31978
31984
  ]);
31979
31985
  const rewrites = computeRewrites(moves, graph.edges, allProjectFiles);
31980
- return { scopeRoot, targets, moves, rewrites, errors };
31986
+ return {
31987
+ scopeRoot,
31988
+ targets,
31989
+ moves,
31990
+ rewrites,
31991
+ errors: [...errors, ...findIgnoredOccupants(moves, ignored, scopeRoot)]
31992
+ };
31993
+ }
31994
+
31995
+ // src/commands/refactor/restructure/checkPlan.ts
31996
+ import chalk218 from "chalk";
31997
+
31998
+ // src/commands/refactor/restructure/displayDrift.ts
31999
+ import path72 from "path";
32000
+ import chalk217 from "chalk";
32001
+ function displayDrift(plan2) {
32002
+ const rel = (file) => path72.relative(process.cwd(), file);
32003
+ if (plan2.moves.length > 0) {
32004
+ console.log(chalk217.red(`${plan2.moves.length} file(s) drift from the plan:`));
32005
+ for (const move2 of plan2.moves)
32006
+ console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
32007
+ }
32008
+ for (const error of plan2.errors) console.log(chalk217.red(error));
32009
+ }
32010
+
32011
+ // src/commands/refactor/restructure/checkPlan.ts
32012
+ function checkPlan(plan2) {
32013
+ displayDrift(plan2);
32014
+ if (plan2.moves.length > 0 || plan2.errors.length > 0) process.exit(1);
32015
+ console.log(chalk218.green("Layout matches the restructure plan"));
32016
+ }
32017
+
32018
+ // src/commands/refactor/restructure/displayPlan.ts
32019
+ import path75 from "path";
32020
+ import chalk219 from "chalk";
32021
+
32022
+ // src/commands/refactor/restructure/computeDepthStats.ts
32023
+ import path73 from "path";
32024
+ function computeDepthStats(targets, scopeRoot) {
32025
+ const distribution = /* @__PURE__ */ new Map();
32026
+ let max = 0;
32027
+ for (const target of targets) {
32028
+ const dir = path73.relative(scopeRoot, path73.dirname(target));
32029
+ const depth = dir === "" ? 0 : dir.split(path73.sep).length;
32030
+ distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
32031
+ max = Math.max(max, depth);
32032
+ }
32033
+ return { max, distribution };
32034
+ }
32035
+
32036
+ // src/commands/refactor/restructure/formatTree.ts
32037
+ import path74 from "path";
32038
+ function insert(root2, parts) {
32039
+ let node = root2;
32040
+ for (const part of parts) {
32041
+ const child = node.get(part) ?? /* @__PURE__ */ new Map();
32042
+ node.set(part, child);
32043
+ node = child;
32044
+ }
32045
+ }
32046
+ function render(node, indent3, lines2) {
32047
+ const entries = [...node].sort(([a, ca], [b, cb]) => {
32048
+ const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
32049
+ return dirFirst || a.localeCompare(b);
32050
+ });
32051
+ for (const [name, child] of entries) {
32052
+ lines2.push(`${indent3}${name}${child.size > 0 ? "/" : ""}`);
32053
+ render(child, `${indent3} `, lines2);
32054
+ }
32055
+ }
32056
+ function formatTree(files, scopeRoot) {
32057
+ const root2 = /* @__PURE__ */ new Map();
32058
+ for (const file of files)
32059
+ insert(root2, path74.relative(scopeRoot, file).split(path74.sep));
32060
+ const lines2 = [];
32061
+ render(root2, "", lines2);
32062
+ return lines2;
32063
+ }
32064
+
32065
+ // src/commands/refactor/restructure/displayPlan.ts
32066
+ function relPath2(filePath) {
32067
+ return path75.relative(process.cwd(), filePath);
32068
+ }
32069
+ function displayMoves(plan2) {
32070
+ if (plan2.moves.length === 0) return;
32071
+ console.log(chalk219.bold("\nFile moves:"));
32072
+ for (const move2 of plan2.moves) {
32073
+ console.log(
32074
+ ` ${chalk219.red(relPath2(move2.from))} \u2192 ${chalk219.green(relPath2(move2.to))}`
32075
+ );
32076
+ console.log(chalk219.dim(` ${move2.reason}`));
32077
+ }
32078
+ }
32079
+ function displayTree(plan2) {
32080
+ console.log(
32081
+ chalk219.bold(`
32082
+ Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
32083
+ );
32084
+ for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
32085
+ console.log(` ${line}`);
32086
+ }
32087
+ function displayDepthStats(plan2) {
32088
+ const { max, distribution } = computeDepthStats(
32089
+ plan2.targets.values(),
32090
+ plan2.scopeRoot
32091
+ );
32092
+ console.log(chalk219.bold(`
32093
+ Depth (max ${max}):`));
32094
+ for (const depth of [...distribution.keys()].sort((a, b) => a - b))
32095
+ console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
32096
+ }
32097
+ function displayErrors(errors) {
32098
+ if (errors.length === 0) return;
32099
+ console.log(chalk219.red("\nErrors:"));
32100
+ for (const error of errors) console.log(chalk219.red(` ${error}`));
32101
+ }
32102
+ function displayPlan2(plan2) {
32103
+ displayMoves(plan2);
32104
+ displayTree(plan2);
32105
+ displayDepthStats(plan2);
32106
+ displayErrors(plan2.errors);
32107
+ const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
32108
+ console.log(
32109
+ chalk219.dim(
32110
+ `
32111
+ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
32112
+ )
32113
+ );
32114
+ }
32115
+
32116
+ // src/commands/refactor/restructure/partitionIgnored.ts
32117
+ import path76 from "path";
32118
+ import { minimatch as minimatch7 } from "minimatch";
32119
+ function partitionIgnored(files) {
32120
+ const globs = loadConfig().restructure?.ignore ?? [];
32121
+ const isIgnored = (file) => globs.some((glob) => minimatch7(path76.relative(process.cwd(), file), glob));
32122
+ return {
32123
+ scoped: files.filter((f) => !isIgnored(f)),
32124
+ ignored: files.filter(isIgnored)
32125
+ };
31981
32126
  }
31982
32127
 
31983
32128
  // src/commands/refactor/restructure/index.ts
31984
32129
  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"}`));
32130
+ const scopeRoot = path77.resolve(root2 ?? "src");
32131
+ if (!fs40.existsSync(scopeRoot) || !fs40.statSync(scopeRoot).isDirectory()) {
32132
+ console.log(chalk220.red(`Not a directory: ${root2 ?? "src"}`));
31988
32133
  process.exit(1);
31989
32134
  }
31990
- const files = findSourceFiles(root2 ?? "src").map((f) => path73.resolve(f));
31991
- if (files.length === 0) {
31992
- console.log(chalk217.yellow("No files found under root"));
32135
+ const found = [];
32136
+ walkSourceFiles(scopeRoot, found);
32137
+ const { scoped, ignored } = partitionIgnored(found);
32138
+ if (scoped.length === 0) {
32139
+ console.log(chalk220.yellow("No files found under root"));
31993
32140
  return;
31994
32141
  }
31995
- const plan2 = buildPlan3(scopeRoot, files);
32142
+ const plan2 = buildPlan3(scopeRoot, scoped, ignored);
32143
+ if (options2.check) return checkPlan(plan2);
31996
32144
  displayPlan2(plan2);
31997
- if (plan2.moves.length === 0) {
31998
- console.log(chalk217.green("No restructuring needed"));
32145
+ if (plan2.moves.length === 0 && plan2.errors.length === 0) {
32146
+ console.log(chalk220.green("No restructuring needed"));
31999
32147
  return;
32000
32148
  }
32001
32149
  if (!options2.apply) {
32002
- console.log(chalk217.dim("\nDry run. Use --apply to execute."));
32150
+ console.log(chalk220.dim("\nDry run. Use --apply to execute."));
32003
32151
  return;
32004
32152
  }
32005
- if (plan2.errors.length > 0) {
32006
- console.log(chalk217.red("\nResolve the errors above before applying."));
32007
- process.exit(1);
32008
- }
32009
- console.log(chalk217.bold("\nApplying changes..."));
32010
- executePlan(plan2);
32011
- console.log(chalk217.green("\nRestructuring complete"));
32153
+ applyPlan(plan2);
32012
32154
  }
32013
32155
 
32014
32156
  // src/commands/registerRefactor.ts
@@ -32029,7 +32171,13 @@ function registerRename(parent) {
32029
32171
  function registerRestructure(parent) {
32030
32172
  const restructureCommand = parent.command("restructure [root]").description(
32031
32173
  "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);
32174
+ ).option(
32175
+ "--apply",
32176
+ "Move files, rewrite their imports and vi.mock paths, and remove emptied folders (default: dry-run)"
32177
+ ).option(
32178
+ "--check",
32179
+ "List files that drift from the plan and exit non-zero if any do"
32180
+ ).action(restructure);
32033
32181
  configHelp(restructureCommand, refactorConfigHelp);
32034
32182
  }
32035
32183
  function registerRefactor(program2) {
@@ -32057,7 +32205,7 @@ async function checkoutOnlySession(number) {
32057
32205
  }
32058
32206
 
32059
32207
  // src/commands/review/highLevel/configureHighLevelReview.ts
32060
- import chalk221 from "chalk";
32208
+ import chalk224 from "chalk";
32061
32209
 
32062
32210
  // src/commands/config/promptConfigScope.ts
32063
32211
  import Enquirer3 from "enquirer";
@@ -32083,7 +32231,7 @@ async function promptConfigScope() {
32083
32231
  }
32084
32232
 
32085
32233
  // src/commands/config/resolveConfigKeyAnswer.ts
32086
- import chalk218 from "chalk";
32234
+ import chalk221 from "chalk";
32087
32235
  async function resolveConfigKeyAnswer(question, supplied) {
32088
32236
  if (supplied !== void 0) return coerceSupplied(question.key, supplied);
32089
32237
  for (; ; ) {
@@ -32091,7 +32239,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
32091
32239
  if (answer === "") return void 0;
32092
32240
  const coercion = coerceCliConfigValue(question.key, answer);
32093
32241
  if (coercion.ok) return coercion.value;
32094
- console.error(chalk218.red(coercion.error));
32242
+ console.error(chalk221.red(coercion.error));
32095
32243
  }
32096
32244
  }
32097
32245
  function coerceSupplied(key, supplied) {
@@ -32152,7 +32300,7 @@ function suggestGlobs(current, proposed) {
32152
32300
  }
32153
32301
 
32154
32302
  // src/commands/review/highLevel/parseConfigureAnswers.ts
32155
- import chalk219 from "chalk";
32303
+ import chalk222 from "chalk";
32156
32304
  function parseConfigureAnswers(answers) {
32157
32305
  const known = Object.values(highLevelConfigKeys);
32158
32306
  const parsed = {};
@@ -32170,13 +32318,13 @@ function answersCoverEveryKey(answers) {
32170
32318
  return Object.values(highLevelConfigKeys).every((key) => key in answers);
32171
32319
  }
32172
32320
  function exitWith(message3) {
32173
- console.error(chalk219.red(`Error: ${message3}.`));
32321
+ console.error(chalk222.red(`Error: ${message3}.`));
32174
32322
  process.exit(1);
32175
32323
  }
32176
32324
 
32177
32325
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
32178
32326
  import { execFileSync as execFileSync19 } from "child_process";
32179
- import chalk220 from "chalk";
32327
+ import chalk223 from "chalk";
32180
32328
 
32181
32329
  // src/commands/review/highLevel/buildGlobProposalPrompt.ts
32182
32330
  function buildGlobProposalPrompt(tree) {
@@ -32269,12 +32417,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
32269
32417
  const tree = summariseRepoTree(cwd);
32270
32418
  if (tree === "") return NOTHING_PROPOSED;
32271
32419
  console.log(
32272
- chalk220.dim("Asking Claude to propose globs from the repo's own tree...")
32420
+ chalk223.dim("Asking Claude to propose globs from the repo's own tree...")
32273
32421
  );
32274
32422
  const output = askClaude(buildGlobProposalPrompt(tree), cwd);
32275
32423
  if (output === void 0) {
32276
32424
  console.log(
32277
- chalk220.yellow(
32425
+ chalk223.yellow(
32278
32426
  "Claude proposed nothing; answer each key from its current value."
32279
32427
  )
32280
32428
  );
@@ -32330,25 +32478,25 @@ function asConfigKeyScope(value) {
32330
32478
  function reportConfigured(result) {
32331
32479
  for (const write of result.written)
32332
32480
  console.log(
32333
- chalk221.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32481
+ chalk224.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32334
32482
  );
32335
- for (const key of result.skipped) console.log(chalk221.dim(`Left ${key} unset`));
32336
- console.log(chalk221.dim(`Written to ${result.target}`));
32483
+ for (const key of result.skipped) console.log(chalk224.dim(`Left ${key} unset`));
32484
+ console.log(chalk224.dim(`Written to ${result.target}`));
32337
32485
  }
32338
32486
 
32339
32487
  // src/commands/review/highLevel/announceSavedReview.ts
32340
- import chalk222 from "chalk";
32488
+ import chalk225 from "chalk";
32341
32489
  function announceSavedReview(subject, force) {
32342
32490
  const head = subject.headSha.slice(0, 7);
32343
32491
  if (subject.saved)
32344
32492
  console.log(
32345
- chalk222.dim(
32493
+ chalk225.dim(
32346
32494
  `Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
32347
32495
  )
32348
32496
  );
32349
32497
  else if (force)
32350
32498
  console.log(
32351
- chalk222.dim(
32499
+ chalk225.dim(
32352
32500
  `Discarding any review saved for ${head} and starting fresh (--force).`
32353
32501
  )
32354
32502
  );
@@ -32377,8 +32525,8 @@ function groupFilesByDirectory(files) {
32377
32525
  }
32378
32526
 
32379
32527
  // src/commands/review/highLevel/buildHighLevelTree.ts
32380
- function basename20(path96) {
32381
- return path96.slice(path96.lastIndexOf("/") + 1);
32528
+ function basename20(path100) {
32529
+ return path100.slice(path100.lastIndexOf("/") + 1);
32382
32530
  }
32383
32531
  function sum(nodes, key) {
32384
32532
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32401,19 +32549,19 @@ function nodesOf(at2, prefix2) {
32401
32549
  }
32402
32550
  function collapsedDirNode(name, at2, prefix2) {
32403
32551
  let label2 = name;
32404
- let path96 = prefix2 ? `${prefix2}/${name}` : name;
32552
+ let path100 = prefix2 ? `${prefix2}/${name}` : name;
32405
32553
  let node = at2;
32406
32554
  while (node.files.length === 0 && node.dirs.size === 1) {
32407
32555
  const [childName, child] = [...node.dirs][0];
32408
32556
  label2 = `${label2}/${childName}`;
32409
- path96 = `${path96}/${childName}`;
32557
+ path100 = `${path100}/${childName}`;
32410
32558
  node = child;
32411
32559
  }
32412
- const children = nodesOf(node, path96);
32560
+ const children = nodesOf(node, path100);
32413
32561
  return {
32414
32562
  kind: "dir",
32415
32563
  name: label2,
32416
- path: path96,
32564
+ path: path100,
32417
32565
  additions: sum(children, "additions"),
32418
32566
  deletions: sum(children, "deletions"),
32419
32567
  children
@@ -32442,7 +32590,7 @@ function buildHighLevelStructure(files) {
32442
32590
  }
32443
32591
 
32444
32592
  // src/commands/review/highLevel/capHighLevelPatches.ts
32445
- import { minimatch as minimatch7 } from "minimatch";
32593
+ import { minimatch as minimatch8 } from "minimatch";
32446
32594
 
32447
32595
  // src/commands/review/highLevel/capPatchToBudget.ts
32448
32596
  function hunksOf(patch2) {
@@ -32475,7 +32623,7 @@ function capPatchToBudget(patch2, budget) {
32475
32623
  var MAX_FILE_PATCH_LINES = 1500;
32476
32624
  var MAX_TOTAL_PATCH_LINES = 2e4;
32477
32625
  function criticalFirst(files, criticalPaths) {
32478
- const isCritical = (file) => criticalPaths.some((glob) => minimatch7(file.path, glob));
32626
+ const isCritical = (file) => criticalPaths.some((glob) => minimatch8(file.path, glob));
32479
32627
  return [...files].sort(
32480
32628
  (a, b) => Number(isCritical(b)) - Number(isCritical(a))
32481
32629
  );
@@ -32558,7 +32706,7 @@ function checkDescriptionWordCap(body, cap2) {
32558
32706
  }
32559
32707
 
32560
32708
  // src/commands/review/highLevel/checkUiEvidence.ts
32561
- import { minimatch as minimatch8 } from "minimatch";
32709
+ import { minimatch as minimatch9 } from "minimatch";
32562
32710
  var EVIDENCE_PATTERNS = [
32563
32711
  /!\[[^\]]*\]\([^)]+\)/g,
32564
32712
  /<(?:img|video)\b[^>]*>/gi,
@@ -32581,7 +32729,7 @@ function checkUiEvidence(body, changedFiles2, uiPaths) {
32581
32729
  reason: "review.highLevel.uiPaths is unset, so no UI evidence is required"
32582
32730
  };
32583
32731
  const touched = changedFiles2.filter(
32584
- (file) => uiPaths.some((glob) => minimatch8(file, glob))
32732
+ (file) => uiPaths.some((glob) => minimatch9(file, glob))
32585
32733
  );
32586
32734
  if (touched.length === 0)
32587
32735
  return {
@@ -32671,8 +32819,8 @@ function toStatus(status3) {
32671
32819
  if (status3 === "removed") return "removed";
32672
32820
  return "modified";
32673
32821
  }
32674
- function diffUrl(repo, prNumber, path96) {
32675
- const anchor = createHash3("sha256").update(path96).digest("hex");
32822
+ function diffUrl(repo, prNumber, path100) {
32823
+ const anchor = createHash3("sha256").update(path100).digest("hex");
32676
32824
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32677
32825
  }
32678
32826
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32728,22 +32876,22 @@ function highLevelReviewPath(repo, headRef, headSha) {
32728
32876
 
32729
32877
  // src/commands/review/highLevel/loadHighLevelReview.ts
32730
32878
  function loadHighLevelReview(repo, headRef, headSha) {
32731
- const path96 = highLevelReviewPath(repo, headRef, headSha);
32732
- if (!existsSync64(path96)) return void 0;
32879
+ const path100 = highLevelReviewPath(repo, headRef, headSha);
32880
+ if (!existsSync64(path100)) return void 0;
32733
32881
  try {
32734
- return JSON.parse(readFileSync49(path96, "utf8"));
32882
+ return JSON.parse(readFileSync49(path100, "utf8"));
32735
32883
  } catch {
32736
32884
  return void 0;
32737
32885
  }
32738
32886
  }
32739
32887
 
32740
32888
  // src/commands/review/highLevel/selectCriticalDiffs.ts
32741
- import { minimatch as minimatch9 } from "minimatch";
32889
+ import { minimatch as minimatch10 } from "minimatch";
32742
32890
  function selectCriticalDiffs(files, criticalPaths) {
32743
32891
  if (criticalPaths.length === 0) return [];
32744
- return files.filter((file) => criticalPaths.some((glob) => minimatch9(file.path, glob))).map(
32745
- ({ path: path96, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32746
- path: path96,
32892
+ return files.filter((file) => criticalPaths.some((glob) => minimatch10(file.path, glob))).map(
32893
+ ({ path: path100, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32894
+ path: path100,
32747
32895
  status: status3,
32748
32896
  additions,
32749
32897
  deletions,
@@ -32858,11 +33006,11 @@ function highLevelPreviewPayload(subject) {
32858
33006
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
32859
33007
  import { dirname as dirname35 } from "path";
32860
33008
  function saveHighLevelReview(record) {
32861
- const path96 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32862
- mkdirSync22(dirname35(path96), { recursive: true });
32863
- writeFileSync39(path96, `${JSON.stringify(record, null, 2)}
33009
+ const path100 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
33010
+ mkdirSync22(dirname35(path100), { recursive: true });
33011
+ writeFileSync39(path100, `${JSON.stringify(record, null, 2)}
32864
33012
  `);
32865
- return path96;
33013
+ return path100;
32866
33014
  }
32867
33015
 
32868
33016
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -32881,63 +33029,63 @@ async function openHighLevelOverlay(sessionId, subject) {
32881
33029
  { rejectIsOutcome: true }
32882
33030
  );
32883
33031
  const record = buildHighLevelRecord(subject, decision);
32884
- const path96 = saveHighLevelReview(record);
33032
+ const path100 = saveHighLevelReview(record);
32885
33033
  console.log(`Verdict: ${record.verdict}`);
32886
- console.log(`Saved ${path96}`);
33034
+ console.log(`Saved ${path100}`);
32887
33035
  console.log("Nothing was posted to GitHub.");
32888
33036
  return record;
32889
33037
  }
32890
33038
 
32891
33039
  // src/commands/review/highLevel/printHighLevelChecklist.ts
32892
- import chalk226 from "chalk";
33040
+ import chalk229 from "chalk";
32893
33041
 
32894
33042
  // src/commands/review/highLevel/formatCriticalDiffs.ts
32895
- import chalk223 from "chalk";
33043
+ import chalk226 from "chalk";
32896
33044
  var PATCH_LINE_COLOURS = {
32897
- "+": chalk223.green,
32898
- "-": chalk223.red,
32899
- "@": chalk223.cyan
33045
+ "+": chalk226.green,
33046
+ "-": chalk226.red,
33047
+ "@": chalk226.cyan
32900
33048
  };
32901
33049
  function formatPatch(patch2) {
32902
33050
  return patch2.split("\n").map(
32903
- (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk223.dim)(line)}`
33051
+ (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk226.dim)(line)}`
32904
33052
  );
32905
33053
  }
32906
33054
  function formatDiff(diff3) {
32907
33055
  return [
32908
33056
  "",
32909
- ` ${chalk223.bold(diff3.path)} ${chalk223.dim(`(${diff3.status})`)} ${chalk223.green(`+${diff3.additions}`)} ${chalk223.red(`-${diff3.deletions}`)}`,
32910
- ...diff3.patch === null ? [` ${chalk223.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33057
+ ` ${chalk226.bold(diff3.path)} ${chalk226.dim(`(${diff3.status})`)} ${chalk226.green(`+${diff3.additions}`)} ${chalk226.red(`-${diff3.deletions}`)}`,
33058
+ ...diff3.patch === null ? [` ${chalk226.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
32911
33059
  ];
32912
33060
  }
32913
33061
  function formatCriticalDiffs(diffs, criticalPaths) {
32914
33062
  if (criticalPaths.length === 0)
32915
- return `${chalk223.bold.underline("Critical diffs")}
32916
- ${chalk223.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33063
+ return `${chalk226.bold.underline("Critical diffs")}
33064
+ ${chalk226.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
32917
33065
  if (diffs.length === 0)
32918
- return `${chalk223.bold.underline("Critical diffs")}
32919
- ${chalk223.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33066
+ return `${chalk226.bold.underline("Critical diffs")}
33067
+ ${chalk226.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
32920
33068
  return [
32921
- chalk223.bold.underline("Critical diffs"),
33069
+ chalk226.bold.underline("Critical diffs"),
32922
33070
  ...diffs.flatMap(formatDiff)
32923
33071
  ].join("\n");
32924
33072
  }
32925
33073
 
32926
33074
  // src/commands/review/highLevel/formatHighLevelChecklist.ts
32927
- import chalk224 from "chalk";
33075
+ import chalk227 from "chalk";
32928
33076
  var MARKERS = {
32929
- pass: () => chalk224.green("\u2714"),
32930
- fail: () => chalk224.red("\u2718"),
32931
- manual: () => chalk224.yellow("\u25A1")
33077
+ pass: () => chalk227.green("\u2714"),
33078
+ fail: () => chalk227.red("\u2718"),
33079
+ manual: () => chalk227.yellow("\u25A1")
32932
33080
  };
32933
33081
  function formatCheck(check2) {
32934
- const title = check2.status === "fail" ? chalk224.red(check2.title) : chalk224.bold(check2.title);
33082
+ const title = check2.status === "fail" ? chalk227.red(check2.title) : chalk227.bold(check2.title);
32935
33083
  return ` ${MARKERS[check2.status]()} ${title}
32936
- ${chalk224.dim(check2.reason)}`;
33084
+ ${chalk227.dim(check2.reason)}`;
32937
33085
  }
32938
33086
  function formatGroup(heading2, checks2) {
32939
33087
  if (checks2.length === 0) return [];
32940
- return ["", chalk224.bold.underline(heading2), ...checks2.map(formatCheck)];
33088
+ return ["", chalk227.bold.underline(heading2), ...checks2.map(formatCheck)];
32941
33089
  }
32942
33090
  function formatHighLevelChecklist(checks2) {
32943
33091
  const deterministic = checks2.filter(
@@ -32946,7 +33094,7 @@ function formatHighLevelChecklist(checks2) {
32946
33094
  const failed2 = deterministic.filter(
32947
33095
  (check2) => check2.status === "fail"
32948
33096
  ).length;
32949
- const summary = failed2 === 0 ? chalk224.green(`All ${deterministic.length} deterministic checks pass`) : chalk224.red(
33097
+ const summary = failed2 === 0 ? chalk227.green(`All ${deterministic.length} deterministic checks pass`) : chalk227.red(
32950
33098
  `${failed2} of ${deterministic.length} deterministic checks fail`
32951
33099
  );
32952
33100
  return [
@@ -32961,30 +33109,30 @@ function formatHighLevelChecklist(checks2) {
32961
33109
  }
32962
33110
 
32963
33111
  // src/commands/review/highLevel/formatHighLevelStructure.ts
32964
- import chalk225 from "chalk";
33112
+ import chalk228 from "chalk";
32965
33113
  var STATUS_MARKERS = {
32966
- added: () => chalk225.green("A"),
32967
- removed: () => chalk225.red("D"),
32968
- modified: () => chalk225.yellow("M")
33114
+ added: () => chalk228.green("A"),
33115
+ removed: () => chalk228.red("D"),
33116
+ modified: () => chalk228.yellow("M")
32969
33117
  };
32970
33118
  function counts(additions, deletions) {
32971
- return `${chalk225.green(`+${additions}`)} ${chalk225.red(`-${deletions}`)}`;
33119
+ return `${chalk228.green(`+${additions}`)} ${chalk228.red(`-${deletions}`)}`;
32972
33120
  }
32973
33121
  function formatNode(node, indent3) {
32974
33122
  if (node.kind === "file")
32975
33123
  return [
32976
- `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk225.dim(counts(node.additions, node.deletions))}`
33124
+ `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk228.dim(counts(node.additions, node.deletions))}`
32977
33125
  ];
32978
33126
  const dir = node;
32979
33127
  return [
32980
- `${indent3}${chalk225.bold(`${dir.name}/`)} ${chalk225.dim(counts(dir.additions, dir.deletions))}`,
33128
+ `${indent3}${chalk228.bold(`${dir.name}/`)} ${chalk228.dim(counts(dir.additions, dir.deletions))}`,
32981
33129
  ...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
32982
33130
  ];
32983
33131
  }
32984
33132
  function formatHighLevelStructure(structure) {
32985
33133
  const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
32986
33134
  return [
32987
- chalk225.bold.underline("Structure"),
33135
+ chalk228.bold.underline("Structure"),
32988
33136
  ` ${summary}`,
32989
33137
  ...structure.tree.flatMap((node) => formatNode(node, " "))
32990
33138
  ].join("\n");
@@ -32993,10 +33141,10 @@ function formatHighLevelStructure(structure) {
32993
33141
  // src/commands/review/highLevel/printHighLevelChecklist.ts
32994
33142
  function printHighLevelChecklist(subject) {
32995
33143
  console.log(
32996
- chalk226.bold(
33144
+ chalk229.bold(
32997
33145
  `High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
32998
33146
  ),
32999
- chalk226.dim(
33147
+ chalk229.dim(
33000
33148
  `\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
33001
33149
  )
33002
33150
  );
@@ -33008,12 +33156,12 @@ function printHighLevelChecklist(subject) {
33008
33156
  formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
33009
33157
  );
33010
33158
  console.log(
33011
- chalk226.dim(
33159
+ chalk229.dim(
33012
33160
  "\nManual items are for the reviewer to judge; see docs/high-level-review.md."
33013
33161
  )
33014
33162
  );
33015
33163
  console.log(
33016
- chalk226.dim(
33164
+ chalk229.dim(
33017
33165
  "Run this inside an assist session to step through the checklist in the web overlay."
33018
33166
  )
33019
33167
  );
@@ -33647,18 +33795,18 @@ function partitionFindingsByDiff(findings, index3) {
33647
33795
  }
33648
33796
 
33649
33797
  // src/commands/review/warnOutOfDiff.ts
33650
- import chalk227 from "chalk";
33798
+ import chalk230 from "chalk";
33651
33799
  function warnOutOfDiff(outOfDiff) {
33652
33800
  if (outOfDiff.length === 0) return;
33653
33801
  console.warn(
33654
- chalk227.yellow(
33802
+ chalk230.yellow(
33655
33803
  `Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
33656
33804
  )
33657
33805
  );
33658
33806
  for (const finding of outOfDiff) {
33659
33807
  const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
33660
33808
  console.warn(
33661
- ` ${chalk227.yellow("\xB7")} ${finding.title} ${chalk227.dim(
33809
+ ` ${chalk230.yellow("\xB7")} ${finding.title} ${chalk230.dim(
33662
33810
  `(${finding.file}:${range})`
33663
33811
  )}`
33664
33812
  );
@@ -33682,18 +33830,18 @@ function selectInDiffFindings(lineBound, prDiff) {
33682
33830
  }
33683
33831
 
33684
33832
  // src/commands/review/warnUnlocated.ts
33685
- import chalk228 from "chalk";
33833
+ import chalk231 from "chalk";
33686
33834
  function warnUnlocated(unlocated) {
33687
33835
  if (unlocated.length === 0) return;
33688
33836
  console.warn(
33689
- chalk228.yellow(
33837
+ chalk231.yellow(
33690
33838
  `Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
33691
33839
  )
33692
33840
  );
33693
33841
  for (const finding of unlocated) {
33694
- const where = finding.location || chalk228.dim("missing");
33842
+ const where = finding.location || chalk231.dim("missing");
33695
33843
  console.warn(
33696
- ` ${chalk228.yellow("\xB7")} ${finding.title} ${chalk228.dim(`(${where})`)}`
33844
+ ` ${chalk231.yellow("\xB7")} ${finding.title} ${chalk231.dim(`(${where})`)}`
33697
33845
  );
33698
33846
  }
33699
33847
  }
@@ -33898,8 +34046,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
33898
34046
  // src/commands/review/prepareReviewDir.ts
33899
34047
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
33900
34048
  function clearReviewFiles(paths) {
33901
- for (const path96 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33902
- if (existsSync65(path96)) unlinkSync18(path96);
34049
+ for (const path100 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34050
+ if (existsSync65(path100)) unlinkSync18(path100);
33903
34051
  }
33904
34052
  }
33905
34053
  function prepareReviewDir(paths, requestBody, force) {
@@ -35137,8 +35285,8 @@ function registerReview(program2) {
35137
35285
 
35138
35286
  // src/commands/rules/addRule.ts
35139
35287
  import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
35140
- import path78 from "path";
35141
- import chalk229 from "chalk";
35288
+ import path82 from "path";
35289
+ import chalk232 from "chalk";
35142
35290
 
35143
35291
  // src/commands/rules/insertRuleBullet.ts
35144
35292
  function ruleBullet({ code, title, text: text18 }) {
@@ -35165,7 +35313,7 @@ import { readFileSync as readFileSync52 } from "fs";
35165
35313
 
35166
35314
  // src/commands/rules/findClaudeFiles.ts
35167
35315
  import { readdirSync as readdirSync14 } from "fs";
35168
- import path74 from "path";
35316
+ import path78 from "path";
35169
35317
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
35170
35318
  function findClaudeFiles(dir) {
35171
35319
  const results = [];
@@ -35173,9 +35321,9 @@ function findClaudeFiles(dir) {
35173
35321
  if (entry.isDirectory()) {
35174
35322
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
35175
35323
  continue;
35176
- results.push(...findClaudeFiles(path74.join(dir, entry.name)));
35324
+ results.push(...findClaudeFiles(path78.join(dir, entry.name)));
35177
35325
  } else if (entry.name === "CLAUDE.md") {
35178
- results.push(path74.join(dir, entry.name));
35326
+ results.push(path78.join(dir, entry.name));
35179
35327
  }
35180
35328
  }
35181
35329
  return results;
@@ -35194,34 +35342,34 @@ function nextRuleCode(root2) {
35194
35342
 
35195
35343
  // src/commands/rules/resolveRuleScope.ts
35196
35344
  import { existsSync as existsSync68 } from "fs";
35197
- import path75 from "path";
35345
+ import path79 from "path";
35198
35346
  function resolveRuleScope(target) {
35199
- const resolved = path75.resolve(target);
35200
- if (path75.basename(resolved) === "CLAUDE.md") return resolved;
35347
+ const resolved = path79.resolve(target);
35348
+ if (path79.basename(resolved) === "CLAUDE.md") return resolved;
35201
35349
  const startDir = scopeDirectory(resolved);
35202
35350
  const root2 = findRepoRoot(startDir) ?? startDir;
35203
35351
  let current = startDir;
35204
35352
  while (true) {
35205
- const candidate = path75.join(current, "CLAUDE.md");
35353
+ const candidate = path79.join(current, "CLAUDE.md");
35206
35354
  if (existsSync68(candidate)) return candidate;
35207
- if (current === root2 || current === path75.dirname(current)) break;
35208
- current = path75.dirname(current);
35355
+ if (current === root2 || current === path79.dirname(current)) break;
35356
+ current = path79.dirname(current);
35209
35357
  }
35210
- return path75.join(root2, "CLAUDE.md");
35358
+ return path79.join(root2, "CLAUDE.md");
35211
35359
  }
35212
35360
 
35213
35361
  // src/commands/rules/updateScopedRulesIndex.ts
35214
35362
  import { existsSync as existsSync69, readFileSync as readFileSync54, writeFileSync as writeFileSync42 } from "fs";
35215
- import path77 from "path";
35363
+ import path81 from "path";
35216
35364
 
35217
35365
  // src/commands/rules/scopedRuleDirectories.ts
35218
35366
  import { readFileSync as readFileSync53 } from "fs";
35219
- import path76 from "path";
35367
+ import path80 from "path";
35220
35368
  function scopedRuleDirectories(root2) {
35221
35369
  return findClaudeFiles(root2).filter(
35222
- (file) => path76.dirname(file) !== root2 && parseRulesSection(readFileSync53(file, "utf8")).length > 0
35370
+ (file) => path80.dirname(file) !== root2 && parseRulesSection(readFileSync53(file, "utf8")).length > 0
35223
35371
  ).map(
35224
- (file) => `${path76.relative(root2, path76.dirname(file)).split(path76.sep).join("/")}/`
35372
+ (file) => `${path80.relative(root2, path80.dirname(file)).split(path80.sep).join("/")}/`
35225
35373
  ).sort();
35226
35374
  }
35227
35375
 
@@ -35260,7 +35408,7 @@ function upsertScopedRulesPointer(content, directories) {
35260
35408
  // src/commands/rules/updateScopedRulesIndex.ts
35261
35409
  function updateScopedRulesIndex(root2) {
35262
35410
  const directories = scopedRuleDirectories(root2);
35263
- const rootFile = path77.join(root2, "CLAUDE.md");
35411
+ const rootFile = path81.join(root2, "CLAUDE.md");
35264
35412
  const before = existsSync69(rootFile) ? readFileSync54(rootFile, "utf8") : "";
35265
35413
  const after = upsertScopedRulesPointer(before, directories);
35266
35414
  if (after !== before) writeFileSync42(rootFile, after);
@@ -35274,12 +35422,12 @@ function read2(file) {
35274
35422
  function addRule(text18, options2) {
35275
35423
  const rule = text18.trim();
35276
35424
  if (rule === "") {
35277
- console.error(chalk229.red("Rule text is required"));
35425
+ console.error(chalk232.red("Rule text is required"));
35278
35426
  process.exitCode = 1;
35279
35427
  return;
35280
35428
  }
35281
35429
  const target = resolveRuleScope(options2.scope ?? process.cwd());
35282
- const targetDir = path78.dirname(target);
35430
+ const targetDir = path82.dirname(target);
35283
35431
  const root2 = findRepoRoot(targetDir) ?? targetDir;
35284
35432
  const code = nextRuleCode(root2);
35285
35433
  writeFileSync43(
@@ -35292,38 +35440,38 @@ function addRule(text18, options2) {
35292
35440
  );
35293
35441
  updateScopedRulesIndex(root2);
35294
35442
  console.log(
35295
- `Added ${chalk229.cyan(code)} to ${path78.relative(process.cwd(), target) || target}`
35443
+ `Added ${chalk232.cyan(code)} to ${path82.relative(process.cwd(), target) || target}`
35296
35444
  );
35297
35445
  }
35298
35446
 
35299
35447
  // src/commands/rules/indexRules.ts
35300
- import path79 from "path";
35301
- import chalk230 from "chalk";
35448
+ import path83 from "path";
35449
+ import chalk233 from "chalk";
35302
35450
  function indexRules() {
35303
35451
  const startDir = scopeDirectory(process.cwd());
35304
35452
  const root2 = findRepoRoot(startDir) ?? startDir;
35305
35453
  const directories = updateScopedRulesIndex(root2);
35306
- const rootFile = path79.relative(process.cwd(), path79.join(root2, "CLAUDE.md"));
35454
+ const rootFile = path83.relative(process.cwd(), path83.join(root2, "CLAUDE.md"));
35307
35455
  if (directories.length === 0) {
35308
35456
  console.log(
35309
- chalk230.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35457
+ chalk233.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35310
35458
  );
35311
35459
  return;
35312
35460
  }
35313
35461
  console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
35314
35462
  for (const directory of directories)
35315
- console.log(` ${chalk230.cyan(directory)}`);
35463
+ console.log(` ${chalk233.cyan(directory)}`);
35316
35464
  }
35317
35465
 
35318
35466
  // src/commands/rules/listRules.ts
35319
- import path80 from "path";
35320
- import chalk231 from "chalk";
35467
+ import path84 from "path";
35468
+ import chalk234 from "chalk";
35321
35469
  function listRules(target, options2 = {}) {
35322
- const resolved = path80.resolve(target ?? process.cwd());
35470
+ const resolved = path84.resolve(target ?? process.cwd());
35323
35471
  const rules3 = readScopedRules(resolved);
35324
35472
  if (rules3.length === 0) {
35325
- const label2 = path80.relative(process.cwd(), resolved) || ".";
35326
- console.log(chalk231.gray(`No rules in scope for ${label2}`));
35473
+ const label2 = path84.relative(process.cwd(), resolved) || ".";
35474
+ console.log(chalk234.gray(`No rules in scope for ${label2}`));
35327
35475
  return;
35328
35476
  }
35329
35477
  const base = findRepoRoot(scopeDirectory(resolved));
@@ -35333,14 +35481,14 @@ function listRules(target, options2 = {}) {
35333
35481
  if (rule.source !== shown) {
35334
35482
  shown = rule.source;
35335
35483
  console.log(
35336
- chalk231.dim(base ? path80.relative(base, rule.source) : rule.source)
35484
+ chalk234.dim(base ? path84.relative(base, rule.source) : rule.source)
35337
35485
  );
35338
35486
  }
35339
35487
  console.log(
35340
- ` ${chalk231.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35488
+ ` ${chalk234.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35341
35489
  );
35342
35490
  if (options2.full && rule.title)
35343
- console.log(` ${" ".repeat(width)} ${chalk231.dim(rule.text)}`);
35491
+ console.log(` ${" ".repeat(width)} ${chalk234.dim(rule.text)}`);
35344
35492
  }
35345
35493
  }
35346
35494
 
@@ -35369,7 +35517,7 @@ function registerRules(program2) {
35369
35517
  }
35370
35518
 
35371
35519
  // src/commands/seq/seqAuth.ts
35372
- import chalk233 from "chalk";
35520
+ import chalk236 from "chalk";
35373
35521
 
35374
35522
  // src/commands/seq/loadConnections.ts
35375
35523
  function loadConnections2() {
@@ -35398,10 +35546,10 @@ function setDefaultConnection(name) {
35398
35546
  }
35399
35547
 
35400
35548
  // src/shared/assertUniqueName.ts
35401
- import chalk232 from "chalk";
35549
+ import chalk235 from "chalk";
35402
35550
  function assertUniqueName(existingNames, name) {
35403
35551
  if (existingNames.includes(name)) {
35404
- console.error(chalk232.red(`Connection "${name}" already exists.`));
35552
+ console.error(chalk235.red(`Connection "${name}" already exists.`));
35405
35553
  process.exit(1);
35406
35554
  }
35407
35555
  }
@@ -35419,18 +35567,18 @@ async function promptConnection2(existingNames) {
35419
35567
  var seqAuth = createConnectionAuth({
35420
35568
  load: loadConnections2,
35421
35569
  save: saveConnections2,
35422
- format: (c) => `${chalk233.bold(c.name)} ${c.url}`,
35570
+ format: (c) => `${chalk236.bold(c.name)} ${c.url}`,
35423
35571
  promptNew: promptConnection2,
35424
35572
  onFirst: (c) => setDefaultConnection(c.name)
35425
35573
  });
35426
35574
 
35427
35575
  // src/commands/seq/seqQuery.ts
35428
- import chalk237 from "chalk";
35576
+ import chalk240 from "chalk";
35429
35577
 
35430
35578
  // src/commands/seq/fetchSeq.ts
35431
- import chalk234 from "chalk";
35432
- async function fetchSeq(conn, path96, params) {
35433
- const url = `${conn.url}${path96}?${params}`;
35579
+ import chalk237 from "chalk";
35580
+ async function fetchSeq(conn, path100, params) {
35581
+ const url = `${conn.url}${path100}?${params}`;
35434
35582
  const response = await fetch(url, {
35435
35583
  headers: {
35436
35584
  Accept: "application/json",
@@ -35439,7 +35587,7 @@ async function fetchSeq(conn, path96, params) {
35439
35587
  });
35440
35588
  if (!response.ok) {
35441
35589
  const body = await response.text();
35442
- console.error(chalk234.red(`Seq returned ${response.status}: ${body}`));
35590
+ console.error(chalk237.red(`Seq returned ${response.status}: ${body}`));
35443
35591
  process.exit(1);
35444
35592
  }
35445
35593
  return response;
@@ -35498,23 +35646,23 @@ async function fetchSeqEvents(conn, params) {
35498
35646
  }
35499
35647
 
35500
35648
  // src/commands/seq/formatEvent.ts
35501
- import chalk235 from "chalk";
35649
+ import chalk238 from "chalk";
35502
35650
  function levelColor(level) {
35503
35651
  switch (level) {
35504
35652
  case "Fatal":
35505
- return chalk235.bgRed.white;
35653
+ return chalk238.bgRed.white;
35506
35654
  case "Error":
35507
- return chalk235.red;
35655
+ return chalk238.red;
35508
35656
  case "Warning":
35509
- return chalk235.yellow;
35657
+ return chalk238.yellow;
35510
35658
  case "Information":
35511
- return chalk235.cyan;
35659
+ return chalk238.cyan;
35512
35660
  case "Debug":
35513
- return chalk235.gray;
35661
+ return chalk238.gray;
35514
35662
  case "Verbose":
35515
- return chalk235.dim;
35663
+ return chalk238.dim;
35516
35664
  default:
35517
- return chalk235.white;
35665
+ return chalk238.white;
35518
35666
  }
35519
35667
  }
35520
35668
  function levelAbbrev(level) {
@@ -35555,12 +35703,12 @@ function formatTimestamp(iso) {
35555
35703
  function formatEvent(event) {
35556
35704
  const color = levelColor(event.Level);
35557
35705
  const abbrev = levelAbbrev(event.Level);
35558
- const ts8 = chalk235.dim(formatTimestamp(event.Timestamp));
35706
+ const ts10 = chalk238.dim(formatTimestamp(event.Timestamp));
35559
35707
  const msg = renderMessage(event);
35560
- const lines2 = [`${ts8} ${color(`[${abbrev}]`)} ${msg}`];
35708
+ const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
35561
35709
  if (event.Exception) {
35562
35710
  for (const line of event.Exception.split("\n")) {
35563
- lines2.push(chalk235.red(` ${line}`));
35711
+ lines2.push(chalk238.red(` ${line}`));
35564
35712
  }
35565
35713
  }
35566
35714
  return lines2.join("\n");
@@ -35593,11 +35741,11 @@ function rejectTimestampFilter(filter) {
35593
35741
  }
35594
35742
 
35595
35743
  // src/shared/resolveNamedConnection.ts
35596
- import chalk236 from "chalk";
35744
+ import chalk239 from "chalk";
35597
35745
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
35598
35746
  if (connections.length === 0) {
35599
35747
  console.error(
35600
- chalk236.red(
35748
+ chalk239.red(
35601
35749
  `No ${kind} connections configured. Run '${authCommand}' first.`
35602
35750
  )
35603
35751
  );
@@ -35606,7 +35754,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
35606
35754
  const target = requested ?? defaultName ?? connections[0].name;
35607
35755
  const connection = connections.find((c) => c.name === target);
35608
35756
  if (!connection) {
35609
- console.error(chalk236.red(`${kind} connection "${target}" not found.`));
35757
+ console.error(chalk239.red(`${kind} connection "${target}" not found.`));
35610
35758
  process.exit(1);
35611
35759
  }
35612
35760
  return connection;
@@ -35635,7 +35783,7 @@ async function seqQuery(filter, options2) {
35635
35783
  new URLSearchParams({ filter, count: String(count8) })
35636
35784
  );
35637
35785
  if (events.length === 0) {
35638
- console.log(chalk237.yellow("No events found."));
35786
+ console.log(chalk240.yellow("No events found."));
35639
35787
  return;
35640
35788
  }
35641
35789
  if (options2.json) {
@@ -35646,11 +35794,11 @@ async function seqQuery(filter, options2) {
35646
35794
  for (const event of chronological) {
35647
35795
  console.log(formatEvent(event));
35648
35796
  }
35649
- console.log(chalk237.dim(`
35797
+ console.log(chalk240.dim(`
35650
35798
  ${events.length} events`));
35651
35799
  if (events.length >= count8) {
35652
35800
  console.log(
35653
- chalk237.yellow(
35801
+ chalk240.yellow(
35654
35802
  `Results limited to ${count8}. Use --count to retrieve more.`
35655
35803
  )
35656
35804
  );
@@ -35658,10 +35806,10 @@ ${events.length} events`));
35658
35806
  }
35659
35807
 
35660
35808
  // src/shared/setNamedDefaultConnection.ts
35661
- import chalk238 from "chalk";
35809
+ import chalk241 from "chalk";
35662
35810
  function setNamedDefaultConnection(connections, name, setDefault, kind) {
35663
35811
  if (!connections.find((c) => c.name === name)) {
35664
- console.error(chalk238.red(`Connection "${name}" not found.`));
35812
+ console.error(chalk241.red(`Connection "${name}" not found.`));
35665
35813
  process.exit(1);
35666
35814
  }
35667
35815
  setDefault(name);
@@ -35811,7 +35959,7 @@ async function previewSlackThreadParts({
35811
35959
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35812
35960
  );
35813
35961
  paths.forEach(
35814
- (path96, index3) => console.log(`${index3 + 1}/${paths.length} ${path96}`)
35962
+ (path100, index3) => console.log(`${index3 + 1}/${paths.length} ${path100}`)
35815
35963
  );
35816
35964
  console.log(
35817
35965
  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.`
@@ -35882,7 +36030,7 @@ function registerSlack(program2) {
35882
36030
  }
35883
36031
 
35884
36032
  // src/commands/sql/sqlAuth.ts
35885
- import chalk240 from "chalk";
36033
+ import chalk243 from "chalk";
35886
36034
 
35887
36035
  // src/commands/sql/loadConnections.ts
35888
36036
  function loadConnections3() {
@@ -35911,7 +36059,7 @@ function setDefaultConnection2(name) {
35911
36059
  }
35912
36060
 
35913
36061
  // src/commands/sql/promptConnection.ts
35914
- import chalk239 from "chalk";
36062
+ import chalk242 from "chalk";
35915
36063
  async function promptConnection3(existingNames) {
35916
36064
  const name = await promptInput("name", "Connection name:", "default");
35917
36065
  assertUniqueName(existingNames, name);
@@ -35919,7 +36067,7 @@ async function promptConnection3(existingNames) {
35919
36067
  const portStr = await promptInput("port", "Port:", "1433");
35920
36068
  const port = Number.parseInt(portStr, 10);
35921
36069
  if (!Number.isFinite(port)) {
35922
- console.error(chalk239.red(`Invalid port "${portStr}".`));
36070
+ console.error(chalk242.red(`Invalid port "${portStr}".`));
35923
36071
  process.exit(1);
35924
36072
  }
35925
36073
  const user = await promptInput("user", "User:");
@@ -35932,13 +36080,13 @@ async function promptConnection3(existingNames) {
35932
36080
  var sqlAuth = createConnectionAuth({
35933
36081
  load: loadConnections3,
35934
36082
  save: saveConnections3,
35935
- format: (c) => `${chalk240.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36083
+ format: (c) => `${chalk243.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
35936
36084
  promptNew: promptConnection3,
35937
36085
  onFirst: (c) => setDefaultConnection2(c.name)
35938
36086
  });
35939
36087
 
35940
36088
  // src/commands/sql/printTable.ts
35941
- import chalk241 from "chalk";
36089
+ import chalk244 from "chalk";
35942
36090
  function formatCell(value) {
35943
36091
  if (value === null || value === void 0) return "";
35944
36092
  if (value instanceof Date) return value.toISOString();
@@ -35947,7 +36095,7 @@ function formatCell(value) {
35947
36095
  }
35948
36096
  function printTable(rows) {
35949
36097
  if (rows.length === 0) {
35950
- console.log(chalk241.yellow("(no rows)"));
36098
+ console.log(chalk244.yellow("(no rows)"));
35951
36099
  return;
35952
36100
  }
35953
36101
  const columns = Object.keys(rows[0]);
@@ -35955,13 +36103,13 @@ function printTable(rows) {
35955
36103
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
35956
36104
  );
35957
36105
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
35958
- console.log(chalk241.dim(header));
35959
- console.log(chalk241.dim("-".repeat(header.length)));
36106
+ console.log(chalk244.dim(header));
36107
+ console.log(chalk244.dim("-".repeat(header.length)));
35960
36108
  for (const row of rows) {
35961
36109
  const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
35962
36110
  console.log(line);
35963
36111
  }
35964
- console.log(chalk241.dim(`
36112
+ console.log(chalk244.dim(`
35965
36113
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
35966
36114
  }
35967
36115
 
@@ -36021,7 +36169,7 @@ async function sqlColumns(table, connectionName) {
36021
36169
  }
36022
36170
 
36023
36171
  // src/commands/sql/sqlMutate.ts
36024
- import chalk242 from "chalk";
36172
+ import chalk245 from "chalk";
36025
36173
 
36026
36174
  // src/commands/sql/isMutation.ts
36027
36175
  var MUTATION_KEYWORDS = [
@@ -36055,7 +36203,7 @@ function isMutation(sql29) {
36055
36203
  async function sqlMutate(query, connectionName) {
36056
36204
  if (!isMutation(query)) {
36057
36205
  console.error(
36058
- chalk242.red(
36206
+ chalk245.red(
36059
36207
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
36060
36208
  )
36061
36209
  );
@@ -36065,18 +36213,18 @@ async function sqlMutate(query, connectionName) {
36065
36213
  const pool = await sqlConnect(conn);
36066
36214
  try {
36067
36215
  const result = await pool.request().query(query);
36068
- console.log(chalk242.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36216
+ console.log(chalk245.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36069
36217
  } finally {
36070
36218
  await pool.close();
36071
36219
  }
36072
36220
  }
36073
36221
 
36074
36222
  // src/commands/sql/sqlQuery.ts
36075
- import chalk243 from "chalk";
36223
+ import chalk246 from "chalk";
36076
36224
  async function sqlQuery(query, connectionName) {
36077
36225
  if (isMutation(query)) {
36078
36226
  console.error(
36079
- chalk243.red(
36227
+ chalk246.red(
36080
36228
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
36081
36229
  )
36082
36230
  );
@@ -36091,7 +36239,7 @@ async function sqlQuery(query, connectionName) {
36091
36239
  printTable(rows);
36092
36240
  } else {
36093
36241
  console.log(
36094
- chalk243.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36242
+ chalk246.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36095
36243
  );
36096
36244
  }
36097
36245
  } finally {
@@ -36152,17 +36300,17 @@ function registerSql(program2) {
36152
36300
  }
36153
36301
 
36154
36302
  // src/commands/sync.ts
36155
- import * as fs48 from "fs";
36303
+ import * as fs49 from "fs";
36156
36304
  import * as os5 from "os";
36157
- import * as path91 from "path";
36305
+ import * as path95 from "path";
36158
36306
  import { fileURLToPath as fileURLToPath9 } from "url";
36159
36307
 
36160
36308
  // src/commands/sync/pruneCommands.ts
36161
- import * as path82 from "path";
36309
+ import * as path86 from "path";
36162
36310
 
36163
36311
  // src/commands/sync/pruneTarget.ts
36164
- import * as fs40 from "fs";
36165
- import * as path81 from "path";
36312
+ import * as fs41 from "fs";
36313
+ import * as path85 from "path";
36166
36314
  function pruneTarget(targetDir, keepNames, shape, options2) {
36167
36315
  const result = {
36168
36316
  orphans: [],
@@ -36170,9 +36318,9 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36170
36318
  skipped: [],
36171
36319
  unmanaged: []
36172
36320
  };
36173
- if (!fs40.existsSync(targetDir)) return result;
36321
+ if (!fs41.existsSync(targetDir)) return result;
36174
36322
  const keep = new Set(keepNames);
36175
- for (const entry of fs40.readdirSync(targetDir, { withFileTypes: true })) {
36323
+ for (const entry of fs41.readdirSync(targetDir, { withFileTypes: true })) {
36176
36324
  const name = shape.nameOf(entry);
36177
36325
  if (name === void 0) {
36178
36326
  result.unmanaged.push(entry.name);
@@ -36180,14 +36328,14 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36180
36328
  }
36181
36329
  if (keep.has(name)) continue;
36182
36330
  result.orphans.push(entry.name);
36183
- const entryPath = path81.join(targetDir, entry.name);
36331
+ const entryPath = path85.join(targetDir, entry.name);
36184
36332
  const reason4 = shape.blockedBy?.(entryPath);
36185
36333
  if (reason4) {
36186
36334
  result.skipped.push({ name: entry.name, reason: reason4 });
36187
36335
  continue;
36188
36336
  }
36189
36337
  if (options2.force) {
36190
- fs40.rmSync(entryPath, { recursive: true });
36338
+ fs41.rmSync(entryPath, { recursive: true });
36191
36339
  result.removed.push(entry.name);
36192
36340
  }
36193
36341
  }
@@ -36200,7 +36348,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36200
36348
  targetDir,
36201
36349
  commandNames,
36202
36350
  {
36203
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path82.basename(entry.name, ".md") : void 0
36351
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path86.basename(entry.name, ".md") : void 0
36204
36352
  },
36205
36353
  options2
36206
36354
  );
@@ -36234,15 +36382,15 @@ function reportPrune(label2, result, force) {
36234
36382
  }
36235
36383
 
36236
36384
  // src/commands/sync/reportRetiredAgentsFiles.ts
36237
- import * as fs41 from "fs";
36238
- import * as path83 from "path";
36385
+ import * as fs42 from "fs";
36386
+ import * as path87 from "path";
36239
36387
  var retired = [
36240
- path83.join(harnesses.claude.homeDir, "CLAUDE.md"),
36241
- path83.join(harnesses.codex.homeDir, "AGENTS.md"),
36242
- path83.join(harnesses.pi.homeDir, "AGENTS.md")
36388
+ path87.join(harnesses.claude.homeDir, "CLAUDE.md"),
36389
+ path87.join(harnesses.codex.homeDir, "AGENTS.md"),
36390
+ path87.join(harnesses.pi.homeDir, "AGENTS.md")
36243
36391
  ];
36244
36392
  function reportRetiredAgentsFiles() {
36245
- const leftovers = retired.filter((file) => fs41.existsSync(file));
36393
+ const leftovers = retired.filter((file) => fs42.existsSync(file));
36246
36394
  if (leftovers.length === 0) return;
36247
36395
  console.log(
36248
36396
  "No longer written by sync \u2014 each harness now composes its own advice at session start:"
@@ -36254,31 +36402,31 @@ function reportRetiredAgentsFiles() {
36254
36402
  }
36255
36403
 
36256
36404
  // src/commands/sync/syncCodex.ts
36257
- import * as path86 from "path";
36405
+ import * as path90 from "path";
36258
36406
 
36259
36407
  // src/commands/sync/installHarnessCommands.ts
36260
- import * as fs42 from "fs";
36261
- import * as path84 from "path";
36408
+ import * as fs43 from "fs";
36409
+ import * as path88 from "path";
36262
36410
  function installHarnessCommands(claudeDir, harness, transform) {
36263
- const commandsSource = path84.join(claudeDir, "commands");
36264
- const files = fs42.readdirSync(commandsSource);
36411
+ const commandsSource = path88.join(claudeDir, "commands");
36412
+ const files = fs43.readdirSync(commandsSource);
36265
36413
  const names2 = [];
36266
36414
  let synced = 0;
36267
36415
  for (const file of files) {
36268
36416
  if (!file.endsWith(".md")) continue;
36269
36417
  const name = file.replace(/\.md$/, "");
36270
36418
  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));
36419
+ const content = fs43.readFileSync(path88.join(commandsSource, file), "utf8");
36420
+ const target = path88.join(harness.homeDir, harness.sync.commandDest(name));
36421
+ fs43.mkdirSync(path88.dirname(target), { recursive: true });
36422
+ fs43.writeFileSync(target, transform(name, content));
36275
36423
  synced++;
36276
36424
  }
36277
36425
  return { total: files.length, synced, names: names2 };
36278
36426
  }
36279
36427
 
36280
36428
  // src/commands/sync/pruneSkills.ts
36281
- import * as fs43 from "fs";
36429
+ import * as fs44 from "fs";
36282
36430
  function pruneSkills(targetDir, skillNames, options2) {
36283
36431
  return pruneTarget(
36284
36432
  targetDir,
@@ -36291,15 +36439,15 @@ function pruneSkills(targetDir, skillNames, options2) {
36291
36439
  );
36292
36440
  }
36293
36441
  function unexpectedContent(skillDir) {
36294
- const entries = fs43.readdirSync(skillDir);
36442
+ const entries = fs44.readdirSync(skillDir);
36295
36443
  const others = entries.filter((entry) => entry !== "SKILL.md");
36296
36444
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
36297
36445
  return entries.length === 0 ? "no SKILL.md" : void 0;
36298
36446
  }
36299
36447
 
36300
36448
  // src/commands/sync/syncCodexHooks.ts
36301
- import * as fs44 from "fs";
36302
- import * as path85 from "path";
36449
+ import * as fs45 from "fs";
36450
+ import * as path89 from "path";
36303
36451
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36304
36452
  var END = "# <<< assist codex hooks (managed) <<<";
36305
36453
  function upsertManagedBlock(existing, body) {
@@ -36329,11 +36477,11 @@ ${rest}
36329
36477
  `;
36330
36478
  }
36331
36479
  function syncCodexHooks(sourcePath) {
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));
36480
+ const body = fs45.readFileSync(sourcePath, "utf8");
36481
+ const configPath = path89.join(harnesses.codex.homeDir, "config.toml");
36482
+ const existing = fs45.existsSync(configPath) ? fs45.readFileSync(configPath, "utf8") : "";
36483
+ fs45.mkdirSync(path89.dirname(configPath), { recursive: true });
36484
+ fs45.writeFileSync(configPath, upsertManagedBlock(existing, body));
36337
36485
  console.log(
36338
36486
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
36339
36487
  );
@@ -36364,57 +36512,57 @@ function syncCodex(claudeDir, options2) {
36364
36512
  harnesses.codex,
36365
36513
  commandToSkill
36366
36514
  );
36367
- syncCodexHooks(path86.join(claudeDir, "..", "codex", "config.toml"));
36515
+ syncCodexHooks(path90.join(claudeDir, "..", "codex", "config.toml"));
36368
36516
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36369
36517
  if (!options2?.prune) return;
36370
36518
  const force = options2.force ?? false;
36371
36519
  reportPrune(
36372
36520
  "~/.codex/skills",
36373
- pruneSkills(path86.join(harnesses.codex.homeDir, "skills"), names2, { force }),
36521
+ pruneSkills(path90.join(harnesses.codex.homeDir, "skills"), names2, { force }),
36374
36522
  force
36375
36523
  );
36376
36524
  }
36377
36525
 
36378
36526
  // src/commands/sync/syncDesign.ts
36379
- import * as fs45 from "fs";
36380
- import * as path87 from "path";
36527
+ import * as fs46 from "fs";
36528
+ import * as path91 from "path";
36381
36529
  function syncDesign(claudeDir, targetBase) {
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);
36530
+ const systemPromptSource = path91.join(claudeDir, "design-system-prompt.md");
36531
+ const systemPromptTarget = path91.join(targetBase, "design-system-prompt.md");
36532
+ fs46.copyFileSync(systemPromptSource, systemPromptTarget);
36385
36533
  console.log(
36386
36534
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36387
36535
  );
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);
36536
+ const skillsSource = path91.join(claudeDir, "skills");
36537
+ const skillsTarget = path91.join(targetBase, "skills");
36538
+ fs46.mkdirSync(skillsTarget, { recursive: true });
36539
+ const files = fs46.readdirSync(skillsSource);
36392
36540
  for (const file of files) {
36393
- fs45.copyFileSync(
36394
- path87.join(skillsSource, file),
36395
- path87.join(skillsTarget, file)
36541
+ fs46.copyFileSync(
36542
+ path91.join(skillsSource, file),
36543
+ path91.join(skillsTarget, file)
36396
36544
  );
36397
36545
  }
36398
36546
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36399
36547
  }
36400
36548
 
36401
36549
  // src/commands/sync/syncPi.ts
36402
- import * as path89 from "path";
36550
+ import * as path93 from "path";
36403
36551
 
36404
36552
  // src/commands/sync/syncPiHooks.ts
36405
- import * as fs46 from "fs";
36406
- import * as path88 from "path";
36553
+ import * as fs47 from "fs";
36554
+ import * as path92 from "path";
36407
36555
  function piExtensionsDir() {
36408
- return path88.join(harnesses.pi.homeDir, "extensions");
36556
+ return path92.join(harnesses.pi.homeDir, "extensions");
36409
36557
  }
36410
36558
  function syncPiHooks(sourceDir) {
36411
36559
  const target = piExtensionsDir();
36412
- fs46.mkdirSync(target, { recursive: true });
36413
- const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36560
+ fs47.mkdirSync(target, { recursive: true });
36561
+ const files = fs47.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36414
36562
  for (const file of files) {
36415
- fs46.copyFileSync(
36416
- path88.join(sourceDir, file),
36417
- path88.join(target, `assist-${file}`)
36563
+ fs47.copyFileSync(
36564
+ path92.join(sourceDir, file),
36565
+ path92.join(target, `assist-${file}`)
36418
36566
  );
36419
36567
  }
36420
36568
  console.log(
@@ -36451,28 +36599,28 @@ function syncPi(claudeDir, options2) {
36451
36599
  harnesses.pi,
36452
36600
  commandToPrompt
36453
36601
  );
36454
- syncPiHooks(path89.join(claudeDir, "..", "pi"));
36602
+ syncPiHooks(path93.join(claudeDir, "..", "pi"));
36455
36603
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36456
36604
  if (!options2?.prune) return;
36457
36605
  const force = options2.force ?? false;
36458
36606
  reportPrune(
36459
36607
  "~/.pi/agent/prompts",
36460
- pruneCommands(path89.join(harnesses.pi.homeDir, "prompts"), names2, { force }),
36608
+ pruneCommands(path93.join(harnesses.pi.homeDir, "prompts"), names2, { force }),
36461
36609
  force
36462
36610
  );
36463
36611
  }
36464
36612
 
36465
36613
  // src/commands/sync/syncSettings.ts
36466
- import * as fs47 from "fs";
36467
- import * as path90 from "path";
36468
- import chalk244 from "chalk";
36614
+ import * as fs48 from "fs";
36615
+ import * as path94 from "path";
36616
+ import chalk247 from "chalk";
36469
36617
  async function syncSettings(claudeDir, targetBase, options2) {
36470
- const source = path90.join(claudeDir, "settings.json");
36471
- const target = path90.join(targetBase, "settings.json");
36472
- const sourceContent = fs47.readFileSync(source, "utf8");
36618
+ const source = path94.join(claudeDir, "settings.json");
36619
+ const target = path94.join(targetBase, "settings.json");
36620
+ const sourceContent = fs48.readFileSync(source, "utf8");
36473
36621
  const sourceSettings = JSON.parse(sourceContent);
36474
- const targetExists = fs47.existsSync(target);
36475
- const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
36622
+ const targetExists = fs48.existsSync(target);
36623
+ const targetContent = targetExists ? fs48.readFileSync(target, "utf8") : "";
36476
36624
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
36477
36625
  const mergedContent = JSON.stringify(
36478
36626
  { ...preservedUserSettings, ...sourceSettings },
@@ -36484,7 +36632,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36484
36632
  if (mergedContent !== normalizedTarget) {
36485
36633
  if (!options2?.yes) {
36486
36634
  console.log(
36487
- chalk244.yellow(
36635
+ chalk247.yellow(
36488
36636
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
36489
36637
  )
36490
36638
  );
@@ -36492,7 +36640,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36492
36640
  printDiff(targetContent, mergedContent);
36493
36641
  printAutoConfirmHint();
36494
36642
  const confirm = await promptConfirm(
36495
- chalk244.red("Overwrite existing settings.json?"),
36643
+ chalk247.red("Overwrite existing settings.json?"),
36496
36644
  false
36497
36645
  );
36498
36646
  if (!confirm) {
@@ -36502,19 +36650,19 @@ async function syncSettings(claudeDir, targetBase, options2) {
36502
36650
  }
36503
36651
  }
36504
36652
  }
36505
- fs47.writeFileSync(target, mergedContent);
36653
+ fs48.writeFileSync(target, mergedContent);
36506
36654
  console.log("Copied settings.json to ~/.claude/settings.json");
36507
36655
  }
36508
36656
 
36509
36657
  // src/commands/sync.ts
36510
36658
  var __filename4 = fileURLToPath9(import.meta.url);
36511
- var __dirname5 = path91.dirname(__filename4);
36659
+ var __dirname5 = path95.dirname(__filename4);
36512
36660
  async function sync(options2) {
36513
36661
  const config = loadConfig();
36514
36662
  const yes = options2?.yes ?? config.sync.autoConfirm;
36515
36663
  const prune = { prune: options2?.prune, force: options2?.force };
36516
- const claudeDir = path91.join(__dirname5, "..", "claude");
36517
- const targetBase = path91.join(os5.homedir(), ".claude");
36664
+ const claudeDir = path95.join(__dirname5, "..", "claude");
36665
+ const targetBase = path95.join(os5.homedir(), ".claude");
36518
36666
  const commandFiles = syncCommands(claudeDir, targetBase);
36519
36667
  syncDesign(claudeDir, targetBase);
36520
36668
  await syncSettings(claudeDir, targetBase, { yes });
@@ -36522,21 +36670,21 @@ async function sync(options2) {
36522
36670
  syncPi(claudeDir, prune);
36523
36671
  reportRetiredAgentsFiles();
36524
36672
  if (!options2?.prune) return;
36525
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path91.basename(file, ".md"));
36673
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path95.basename(file, ".md"));
36526
36674
  const force = options2.force ?? false;
36527
36675
  reportPrune(
36528
36676
  "~/.claude/commands",
36529
- pruneCommands(path91.join(targetBase, "commands"), commandNames, { force }),
36677
+ pruneCommands(path95.join(targetBase, "commands"), commandNames, { force }),
36530
36678
  force
36531
36679
  );
36532
36680
  }
36533
36681
  function syncCommands(claudeDir, targetBase) {
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);
36682
+ const sourceDir = path95.join(claudeDir, "commands");
36683
+ const targetDir = path95.join(targetBase, "commands");
36684
+ fs49.mkdirSync(targetDir, { recursive: true });
36685
+ const files = fs49.readdirSync(sourceDir);
36538
36686
  for (const file of files) {
36539
- fs48.copyFileSync(path91.join(sourceDir, file), path91.join(targetDir, file));
36687
+ fs49.copyFileSync(path95.join(sourceDir, file), path95.join(targetDir, file));
36540
36688
  console.log(`Copied ${file} to ${targetDir}`);
36541
36689
  }
36542
36690
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -36705,8 +36853,8 @@ function toSeconds(parts) {
36705
36853
  if (parts.length === 2) return parseMS(parts[0], parts[1]);
36706
36854
  return 0;
36707
36855
  }
36708
- function parseTimestamp(ts8) {
36709
- return Math.round(toSeconds(ts8.split(":")) * 1e3);
36856
+ function parseTimestamp(ts10) {
36857
+ return Math.round(toSeconds(ts10.split(":")) * 1e3);
36710
36858
  }
36711
36859
  function extractSpeaker(fullText) {
36712
36860
  const match = fullText.match(/^<v\s+([^>]+)>/);
@@ -37660,11 +37808,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
37660
37808
  var sessionsPrefix = "src/commands/sessions/";
37661
37809
  var rules = [
37662
37810
  {
37663
- matches: (path96) => path96.startsWith(webUiPrefix),
37811
+ matches: (path100) => path100.startsWith(webUiPrefix),
37664
37812
  advice: "restart the web server, then hard-reload the browser tab"
37665
37813
  },
37666
37814
  {
37667
- matches: (path96) => path96.startsWith(sessionsPrefix) && !path96.startsWith(webUiPrefix),
37815
+ matches: (path100) => path100.startsWith(sessionsPrefix) && !path100.startsWith(webUiPrefix),
37668
37816
  advice: "restart the daemon"
37669
37817
  }
37670
37818
  ];
@@ -37675,27 +37823,27 @@ function restartAdvice(paths) {
37675
37823
  // src/commands/watch/syncAdvice.ts
37676
37824
  var rules2 = [
37677
37825
  {
37678
- matches: (path96) => path96.startsWith("claude/commands/"),
37826
+ matches: (path100) => path100.startsWith("claude/commands/"),
37679
37827
  reason: "claude/commands changed"
37680
37828
  },
37681
37829
  {
37682
- matches: (path96) => path96.startsWith("claude/skills/"),
37830
+ matches: (path100) => path100.startsWith("claude/skills/"),
37683
37831
  reason: "claude/skills changed"
37684
37832
  },
37685
37833
  {
37686
- matches: (path96) => path96 === "claude/settings.json",
37834
+ matches: (path100) => path100 === "claude/settings.json",
37687
37835
  reason: "claude/settings.json changed"
37688
37836
  },
37689
37837
  {
37690
- matches: (path96) => path96 === "claude/design-system-prompt.md",
37838
+ matches: (path100) => path100 === "claude/design-system-prompt.md",
37691
37839
  reason: "claude/design-system-prompt.md changed"
37692
37840
  },
37693
37841
  {
37694
- matches: (path96) => path96.startsWith("codex/"),
37842
+ matches: (path100) => path100.startsWith("codex/"),
37695
37843
  reason: "codex sources changed"
37696
37844
  },
37697
37845
  {
37698
- matches: (path96) => path96.startsWith("pi/"),
37846
+ matches: (path100) => path100.startsWith("pi/"),
37699
37847
  reason: "pi sources changed"
37700
37848
  }
37701
37849
  ];
@@ -38234,7 +38382,7 @@ function registerWatch(program2) {
38234
38382
 
38235
38383
  // src/commands/roam/auth.ts
38236
38384
  import { randomBytes } from "crypto";
38237
- import chalk245 from "chalk";
38385
+ import chalk248 from "chalk";
38238
38386
 
38239
38387
  // src/commands/roam/waitForCallback.ts
38240
38388
  import { createServer as createServer3 } from "http";
@@ -38365,13 +38513,13 @@ async function auth() {
38365
38513
  saveGlobalConfig(config);
38366
38514
  const state = randomBytes(16).toString("hex");
38367
38515
  console.log(
38368
- chalk245.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
38516
+ chalk248.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
38369
38517
  );
38370
- console.log(chalk245.white("http://localhost:14523/callback\n"));
38371
- console.log(chalk245.blue("Opening browser for authorization..."));
38372
- console.log(chalk245.dim("Waiting for authorization callback..."));
38518
+ console.log(chalk248.white("http://localhost:14523/callback\n"));
38519
+ console.log(chalk248.blue("Opening browser for authorization..."));
38520
+ console.log(chalk248.dim("Waiting for authorization callback..."));
38373
38521
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
38374
- console.log(chalk245.dim("Exchanging code for tokens..."));
38522
+ console.log(chalk248.dim("Exchanging code for tokens..."));
38375
38523
  const tokens = await exchangeToken({
38376
38524
  code,
38377
38525
  clientId,
@@ -38387,7 +38535,7 @@ async function auth() {
38387
38535
  };
38388
38536
  saveGlobalConfig(config);
38389
38537
  console.log(
38390
- chalk245.green("Roam credentials and tokens saved to ~/.assist.yml")
38538
+ chalk248.green("Roam credentials and tokens saved to ~/.assist.yml")
38391
38539
  );
38392
38540
  }
38393
38541
 
@@ -38403,9 +38551,9 @@ function findPortFile(roamDir) {
38403
38551
  return void 0;
38404
38552
  }
38405
38553
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
38406
- const path96 = join100(roamDir, name);
38554
+ const path100 = join100(roamDir, name);
38407
38555
  try {
38408
- return { path: path96, mtimeMs: statSync13(path96).mtimeMs };
38556
+ return { path: path100, mtimeMs: statSync13(path100).mtimeMs };
38409
38557
  } catch {
38410
38558
  return void 0;
38411
38559
  }
@@ -38649,11 +38797,11 @@ function findLinkIndex() {
38649
38797
  function parseLinkArgs() {
38650
38798
  const idx = findLinkIndex();
38651
38799
  if (idx === -1) return null;
38652
- const path96 = process.argv[idx + 1];
38800
+ const path100 = process.argv[idx + 1];
38653
38801
  const rest = process.argv.slice(idx + 2);
38654
38802
  const { value: prefix2 } = extractOption(rest, "--prefix");
38655
38803
  if (!prefix2) return null;
38656
- return { path: path96, prefix: prefix2 };
38804
+ return { path: path100, prefix: prefix2 };
38657
38805
  }
38658
38806
  function hasDuplicateLink(runList, linkPath) {
38659
38807
  return runList.some(
@@ -39255,14 +39403,14 @@ import * as pty from "node-pty";
39255
39403
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
39256
39404
  import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
39257
39405
  import { createRequire as createRequire3 } from "module";
39258
- import path92 from "path";
39406
+ import path96 from "path";
39259
39407
  var require4 = createRequire3(import.meta.url);
39260
39408
  var ensured = false;
39261
39409
  function ensureSpawnHelperExecutable() {
39262
39410
  if (ensured || process.platform !== "darwin") return;
39263
39411
  ensured = true;
39264
- const ptyRoot = path92.join(path92.dirname(require4.resolve("node-pty")), "..");
39265
- const helper = path92.join(
39412
+ const ptyRoot = path96.join(path96.dirname(require4.resolve("node-pty")), "..");
39413
+ const helper = path96.join(
39266
39414
  ptyRoot,
39267
39415
  "prebuilds",
39268
39416
  `${process.platform}-${process.arch}`,
@@ -39392,19 +39540,19 @@ function serverRunMeta(runName, cwd) {
39392
39540
  }
39393
39541
 
39394
39542
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
39395
- import * as fs49 from "fs";
39396
- import * as path93 from "path";
39543
+ import * as fs50 from "fs";
39544
+ import * as path97 from "path";
39397
39545
  import { fileURLToPath as fileURLToPath11 } from "url";
39398
39546
  var __filename5 = fileURLToPath11(import.meta.url);
39399
- var __dirname7 = path93.dirname(__filename5);
39547
+ var __dirname7 = path97.dirname(__filename5);
39400
39548
  function readDesignSystemPrompt() {
39401
- const promptPath = path93.join(
39549
+ const promptPath = path97.join(
39402
39550
  __dirname7,
39403
39551
  "..",
39404
39552
  "claude",
39405
39553
  "design-system-prompt.md"
39406
39554
  );
39407
- return fs49.readFileSync(promptPath, "utf8");
39555
+ return fs50.readFileSync(promptPath, "utf8");
39408
39556
  }
39409
39557
 
39410
39558
  // src/commands/sessions/daemon/spawnClaude.ts
@@ -40429,8 +40577,8 @@ async function seedRunningMsFromUsage(session, notify2) {
40429
40577
  var DEBOUNCE_MS2 = 50;
40430
40578
  function watchActivity(session, notify2, onClaudeSessionId) {
40431
40579
  if (session.commandType !== "assist" || !session.cwd) return;
40432
- const path96 = activityPath(session.id);
40433
- const dir = dirname42(path96);
40580
+ const path100 = activityPath(session.id);
40581
+ const dir = dirname42(path100);
40434
40582
  try {
40435
40583
  mkdirSync37(dir, { recursive: true });
40436
40584
  } catch {
@@ -40440,7 +40588,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40440
40588
  let timer = null;
40441
40589
  const read3 = () => {
40442
40590
  timer = null;
40443
- const activity2 = readActivity(path96);
40591
+ const activity2 = readActivity(path100);
40444
40592
  if (!activity2) return;
40445
40593
  applyActivityToSession(session, activity2);
40446
40594
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -40449,11 +40597,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40449
40597
  notify2();
40450
40598
  };
40451
40599
  session.activityWatcher = watch2(dir, (_event, filename) => {
40452
- if (filename && !path96.endsWith(filename)) return;
40600
+ if (filename && !path100.endsWith(filename)) return;
40453
40601
  if (timer) clearTimeout(timer);
40454
40602
  timer = setTimeout(read3, DEBOUNCE_MS2);
40455
40603
  });
40456
- if (existsSync94(path96)) read3();
40604
+ if (existsSync94(path100)) read3();
40457
40605
  }
40458
40606
  function refreshActivity(session) {
40459
40607
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -40532,7 +40680,7 @@ function reportSilentFailure(session, clients) {
40532
40680
  }
40533
40681
 
40534
40682
  // src/commands/sessions/shared/codex/resolveCodexSessionId.ts
40535
- import * as fs50 from "fs";
40683
+ import * as fs51 from "fs";
40536
40684
  var META_LINES = 5;
40537
40685
  async function resolveCodexSessionId(cwd, sinceMs) {
40538
40686
  if (!cwd) return null;
@@ -40561,7 +40709,7 @@ async function startedIn(file, cwd, sinceMs) {
40561
40709
  }
40562
40710
  async function touchedSince(file, sinceMs) {
40563
40711
  try {
40564
- return (await fs50.promises.stat(file)).mtimeMs >= sinceMs;
40712
+ return (await fs51.promises.stat(file)).mtimeMs >= sinceMs;
40565
40713
  } catch {
40566
40714
  return false;
40567
40715
  }
@@ -40595,42 +40743,42 @@ function bindCodexSession(session, notify2) {
40595
40743
  import { watch as watch3 } from "fs";
40596
40744
 
40597
40745
  // src/commands/sessions/shared/findTranscriptPathSync.ts
40598
- import * as fs51 from "fs";
40599
- import * as path94 from "path";
40746
+ import * as fs52 from "fs";
40747
+ import * as path98 from "path";
40600
40748
  function projectDirForCwd(cwd) {
40601
- return path94.join(claudeProjectsRoot(), projectSlug(cwd));
40749
+ return path98.join(claudeProjectsRoot(), projectSlug(cwd));
40602
40750
  }
40603
40751
  function transcriptPathFor(cwd, claudeSessionId) {
40604
- return path94.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40752
+ return path98.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40605
40753
  }
40606
40754
  function findTranscriptPathSync(cwd, claudeSessionId) {
40607
40755
  const direct = transcriptPathFor(cwd, claudeSessionId);
40608
- if (fs51.existsSync(direct)) return direct;
40756
+ if (fs52.existsSync(direct)) return direct;
40609
40757
  const dir = projectDirForCwd(cwd);
40610
40758
  let files;
40611
40759
  try {
40612
- files = fs51.readdirSync(dir);
40760
+ files = fs52.readdirSync(dir);
40613
40761
  } catch {
40614
40762
  return null;
40615
40763
  }
40616
40764
  for (const file of files) {
40617
40765
  if (!file.endsWith(".jsonl")) continue;
40618
- if (headContainsSessionId(path94.join(dir, file), claudeSessionId))
40619
- return path94.join(dir, file);
40766
+ if (headContainsSessionId(path98.join(dir, file), claudeSessionId))
40767
+ return path98.join(dir, file);
40620
40768
  }
40621
40769
  return null;
40622
40770
  }
40623
40771
  function headContainsSessionId(filePath, claudeSessionId) {
40624
40772
  let fd;
40625
40773
  try {
40626
- fd = fs51.openSync(filePath, "r");
40774
+ fd = fs52.openSync(filePath, "r");
40627
40775
  const buf = Buffer.alloc(16384);
40628
- const bytesRead = fs51.readSync(fd, buf, 0, buf.length, 0);
40776
+ const bytesRead = fs52.readSync(fd, buf, 0, buf.length, 0);
40629
40777
  return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
40630
40778
  } catch {
40631
40779
  return false;
40632
40780
  } finally {
40633
- if (fd !== void 0) fs51.closeSync(fd);
40781
+ if (fd !== void 0) fs52.closeSync(fd);
40634
40782
  }
40635
40783
  }
40636
40784
 
@@ -40800,7 +40948,7 @@ function asRecord3(value) {
40800
40948
  }
40801
40949
 
40802
40950
  // src/commands/sessions/shared/readTranscriptTail.ts
40803
- import * as fs52 from "fs";
40951
+ import * as fs53 from "fs";
40804
40952
  var DEFAULT_MAX_BYTES = 256 * 1024;
40805
40953
  function parseTailEntries(raw) {
40806
40954
  const entries = [];
@@ -40824,7 +40972,7 @@ function dropPartialFirstLine(raw, sliced) {
40824
40972
  async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40825
40973
  let handle;
40826
40974
  try {
40827
- handle = await fs52.promises.open(filePath, "r");
40975
+ handle = await fs53.promises.open(filePath, "r");
40828
40976
  const { size } = await handle.stat();
40829
40977
  const start3 = Math.max(0, size - maxBytes);
40830
40978
  const length = size - start3;
@@ -40843,20 +40991,20 @@ async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40843
40991
  function readTranscriptTailSync(filePath, maxBytes = DEFAULT_MAX_BYTES) {
40844
40992
  let fd;
40845
40993
  try {
40846
- fd = fs52.openSync(filePath, "r");
40847
- const { size } = fs52.fstatSync(fd);
40994
+ fd = fs53.openSync(filePath, "r");
40995
+ const { size } = fs53.fstatSync(fd);
40848
40996
  const start3 = Math.max(0, size - maxBytes);
40849
40997
  const length = size - start3;
40850
40998
  if (length === 0) return [];
40851
40999
  const buf = Buffer.alloc(length);
40852
- fs52.readSync(fd, buf, 0, length, start3);
41000
+ fs53.readSync(fd, buf, 0, length, start3);
40853
41001
  return parseTailEntries(
40854
41002
  dropPartialFirstLine(buf.toString("utf8"), start3 > 0)
40855
41003
  );
40856
41004
  } catch {
40857
41005
  return [];
40858
41006
  } finally {
40859
- if (fd !== void 0) fs52.closeSync(fd);
41007
+ if (fd !== void 0) fs53.closeSync(fd);
40860
41008
  }
40861
41009
  }
40862
41010
 
@@ -41162,7 +41310,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
41162
41310
  }
41163
41311
 
41164
41312
  // src/commands/sessions/shared/transcriptUsage.ts
41165
- import * as fs53 from "fs";
41313
+ import * as fs54 from "fs";
41166
41314
  function transcriptUsage(lines2) {
41167
41315
  const byId = /* @__PURE__ */ new Map();
41168
41316
  for (const line of lines2) {
@@ -41186,7 +41334,7 @@ function transcriptUsage(lines2) {
41186
41334
  return [...byId.values()];
41187
41335
  }
41188
41336
  async function readTranscriptUsage(transcriptPath2) {
41189
- const content = await fs53.promises.readFile(transcriptPath2, "utf8");
41337
+ const content = await fs54.promises.readFile(transcriptPath2, "utf8");
41190
41338
  return transcriptUsage(content.split("\n"));
41191
41339
  }
41192
41340
 
@@ -41790,9 +41938,9 @@ function tempRoots() {
41790
41938
  }
41791
41939
  return [...roots];
41792
41940
  }
41793
- function underTempRoot(path96) {
41941
+ function underTempRoot(path100) {
41794
41942
  return tempRoots().some(
41795
- (root2) => path96.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
41943
+ (root2) => path100.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
41796
41944
  );
41797
41945
  }
41798
41946
 
@@ -42234,15 +42382,15 @@ function bindResumedWorktree(session, cwd, notify2) {
42234
42382
  import { existsSync as existsSync96 } from "fs";
42235
42383
  async function reclaimVanishedWorktrees(clone, paths) {
42236
42384
  if (!existsSync96(clone)) {
42237
- for (const { path: path96 } of paths) forgetWorktree(path96);
42385
+ for (const { path: path100 } of paths) forgetWorktree(path100);
42238
42386
  daemonLog(
42239
42387
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
42240
42388
  );
42241
42389
  return;
42242
42390
  }
42243
42391
  await pruneBookkeeping2(clone);
42244
- for (const { path: path96, branch: branch2 } of paths)
42245
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path96);
42392
+ for (const { path: path100, branch: branch2 } of paths)
42393
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path100);
42246
42394
  }
42247
42395
  async function pruneBookkeeping2(clone) {
42248
42396
  try {
@@ -42269,37 +42417,37 @@ async function reclaimBranch(clone, branch2) {
42269
42417
  }
42270
42418
 
42271
42419
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
42272
- function logVanishedTree(sessions, path96) {
42420
+ function logVanishedTree(sessions, path100) {
42273
42421
  const claimants = [...sessions.values()].filter(
42274
- (s) => s.cwd === path96 || s.worktree?.path === path96
42422
+ (s) => s.cwd === path100 || s.worktree?.path === path100
42275
42423
  );
42276
42424
  if (claimants.length === 0) {
42277
- daemonLog(`worktree ${path96} gone from disk and unclaimed; reclaiming it`);
42425
+ daemonLog(`worktree ${path100} gone from disk and unclaimed; reclaiming it`);
42278
42426
  return;
42279
42427
  }
42280
42428
  for (const s of claimants)
42281
42429
  daemonLog(
42282
- `session ${s.id} ("${s.name}") claims worktree ${path96}, which is gone from disk; reclaiming it`
42430
+ `session ${s.id} ("${s.name}") claims worktree ${path100}, which is gone from disk; reclaiming it`
42283
42431
  );
42284
42432
  }
42285
42433
 
42286
42434
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
42287
42435
  var MAX_ITEMS = 20;
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);
42436
+ async function describeHeldWork(path100, reason4) {
42437
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path100);
42438
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path100, reason4);
42291
42439
  return { summary: reason4, items: [] };
42292
42440
  }
42293
- async function changedFiles(path96) {
42294
- const status3 = await gitResult(path96, ["status", "--porcelain"]);
42441
+ async function changedFiles(path100) {
42442
+ const status3 = await gitResult(path100, ["status", "--porcelain"]);
42295
42443
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
42296
42444
  return {
42297
42445
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
42298
42446
  items: capped2(lines2)
42299
42447
  };
42300
42448
  }
42301
- async function unpushedCommits(path96, reason4) {
42302
- const log2 = await gitResult(path96, ["log", "--oneline", "@{upstream}..HEAD"]);
42449
+ async function unpushedCommits(path100, reason4) {
42450
+ const log2 = await gitResult(path100, ["log", "--oneline", "@{upstream}..HEAD"]);
42303
42451
  if (!log2.ok) return { summary: reason4, items: [] };
42304
42452
  const lines2 = nonEmptyLines(log2.out);
42305
42453
  return {
@@ -42391,24 +42539,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
42391
42539
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
42392
42540
  const accounted = accountedTrees(sessions);
42393
42541
  const vanished = /* @__PURE__ */ new Map();
42394
- for (const { path: path96, clone } of readWorktreeRegistry()) {
42395
- if (underTempRoot(path96)) {
42396
- forgetWorktree(path96);
42542
+ for (const { path: path100, clone } of readWorktreeRegistry()) {
42543
+ if (underTempRoot(path100)) {
42544
+ forgetWorktree(path100);
42397
42545
  daemonLog(
42398
- `worktree ${path96} lies outside any project root; pruned from the registry rather than recovered`
42546
+ `worktree ${path100} lies outside any project root; pruned from the registry rather than recovered`
42399
42547
  );
42400
42548
  continue;
42401
42549
  }
42402
- if (!existsSync97(path96)) {
42403
- logVanishedTree(sessions, path96);
42550
+ if (!existsSync97(path100)) {
42551
+ logVanishedTree(sessions, path100);
42404
42552
  vanished.set(clone, [
42405
42553
  ...vanished.get(clone) ?? [],
42406
- { path: path96, branch: basename28(path96) }
42554
+ { path: path100, branch: basename28(path100) }
42407
42555
  ]);
42408
42556
  continue;
42409
42557
  }
42410
- if (accounted.has(path96)) continue;
42411
- await recoverOrphan(sessions, spawnWith, { path: path96, clone }, notify2);
42558
+ if (accounted.has(path100)) continue;
42559
+ await recoverOrphan(sessions, spawnWith, { path: path100, clone }, notify2);
42412
42560
  }
42413
42561
  for (const [clone, paths] of vanished)
42414
42562
  await reclaimVanishedWorktrees(clone, paths);
@@ -44108,7 +44256,7 @@ function creator(isNew, spawn13) {
44108
44256
  }
44109
44257
 
44110
44258
  // src/commands/sessions/shared/codex/codexRolloutUsage.ts
44111
- import * as fs54 from "fs";
44259
+ import * as fs55 from "fs";
44112
44260
 
44113
44261
  // src/commands/sessions/shared/codex/applyTokenInfo.ts
44114
44262
  function applyTokenInfo(usage, byId, conversationId, rawInfo) {
@@ -44171,7 +44319,7 @@ function codexRolloutUsage(lines2) {
44171
44319
  return usage;
44172
44320
  }
44173
44321
  async function readCodexRolloutUsage(rolloutPath) {
44174
- const content = await fs54.promises.readFile(rolloutPath, "utf8");
44322
+ const content = await fs55.promises.readFile(rolloutPath, "utf8");
44175
44323
  return codexRolloutUsage(content.split("\n"));
44176
44324
  }
44177
44325
  function sessionMetaId(entry) {
@@ -44206,12 +44354,16 @@ function applyCodexUsage(sessions, sessionId, usage, windows) {
44206
44354
  var handleCodexUsage = (client, m, d) => {
44207
44355
  if (m.windowsProxy.route(client, d)) return;
44208
44356
  const sessionId = d.sessionId;
44357
+ daemonLog(`codex-usage received: id=${sessionId}`);
44209
44358
  if (d.ack) sendTo(client, { type: "ack", sessionId });
44210
44359
  void readCodexRolloutUsage(d.transcriptPath).then(
44211
44360
  (usage) => {
44212
44361
  if (usage.rateLimits)
44213
44362
  m.clients.updateHarnessLimits("codex", usage.rateLimits);
44214
- const windows = m.clients.currentWindows("codex");
44363
+ const windows = usage.rateLimits ? m.clients.currentWindows("codex") : [];
44364
+ daemonLog(
44365
+ `codex-usage applied: id=${sessionId} responses=${usage.responses.length} usedPct=${usage.usedPct ?? "none"} windows=${windows.length}`
44366
+ );
44215
44367
  m.update(
44216
44368
  (sessions) => applyCodexUsage(sessions, sessionId, usage, windows)
44217
44369
  );
@@ -44280,15 +44432,15 @@ function handleSetStatus(client, m, d) {
44280
44432
  }
44281
44433
 
44282
44434
  // src/commands/sessions/shared/parseTranscript.ts
44283
- import * as fs55 from "fs";
44435
+ import * as fs56 from "fs";
44284
44436
 
44285
44437
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
44286
- import * as path95 from "path";
44438
+ import * as path99 from "path";
44287
44439
  async function findCodexRolloutPath(sessionId) {
44288
44440
  if (!sessionId) return null;
44289
44441
  const paths = await discoverCodexRolloutPaths();
44290
44442
  const suffix = `-${sessionId}.jsonl`;
44291
- return paths.find((file) => path95.basename(file).endsWith(suffix)) ?? null;
44443
+ return paths.find((file) => path99.basename(file).endsWith(suffix)) ?? null;
44292
44444
  }
44293
44445
 
44294
44446
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -44363,7 +44515,7 @@ async function parseTranscript(sessionId) {
44363
44515
  }
44364
44516
  async function readMessages(filePath, parse5) {
44365
44517
  try {
44366
- const raw = await fs55.promises.readFile(filePath, "utf8");
44518
+ const raw = await fs56.promises.readFile(filePath, "utf8");
44367
44519
  return parse5(raw.split("\n"));
44368
44520
  } catch {
44369
44521
  return [];
@@ -44929,17 +45081,17 @@ async function renameSession(title) {
44929
45081
  }
44930
45082
 
44931
45083
  // src/commands/sessions/summarise/index.ts
44932
- import * as fs57 from "fs";
44933
- import chalk246 from "chalk";
45084
+ import * as fs58 from "fs";
45085
+ import chalk249 from "chalk";
44934
45086
 
44935
45087
  // src/commands/sessions/summarise/shared.ts
44936
- import * as fs56 from "fs";
45088
+ import * as fs57 from "fs";
44937
45089
  function writeSummary(jsonlPath2, summary) {
44938
- fs56.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
45090
+ fs57.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
44939
45091
  `, "utf8");
44940
45092
  }
44941
45093
  function hasSummary(jsonlPath2) {
44942
- return fs56.existsSync(summaryPathFor(jsonlPath2));
45094
+ return fs57.existsSync(summaryPathFor(jsonlPath2));
44943
45095
  }
44944
45096
  function summaryPathFor(jsonlPath2) {
44945
45097
  return jsonlPath2.replace(/\.jsonl$/, ".summary");
@@ -44989,29 +45141,29 @@ ${firstMessage}`);
44989
45141
  async function summarise2(options2) {
44990
45142
  const files = await discoverSessionFiles();
44991
45143
  if (files.length === 0) {
44992
- console.log(chalk246.yellow("No sessions found."));
45144
+ console.log(chalk249.yellow("No sessions found."));
44993
45145
  return;
44994
45146
  }
44995
45147
  const toProcess = selectCandidates(files, options2);
44996
45148
  if (toProcess.length === 0) {
44997
- console.log(chalk246.green("All sessions already summarised."));
45149
+ console.log(chalk249.green("All sessions already summarised."));
44998
45150
  return;
44999
45151
  }
45000
45152
  console.log(
45001
- chalk246.cyan(
45153
+ chalk249.cyan(
45002
45154
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
45003
45155
  )
45004
45156
  );
45005
45157
  const { succeeded, failed: failed2 } = processSessions(toProcess);
45006
45158
  console.log(
45007
- chalk246.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk246.yellow(`, ${failed2} skipped`) : "")
45159
+ chalk249.green(`Done: ${succeeded} summarised`) + (failed2 > 0 ? chalk249.yellow(`, ${failed2} skipped`) : "")
45008
45160
  );
45009
45161
  }
45010
45162
  function selectCandidates(files, options2) {
45011
45163
  const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
45012
45164
  candidates.sort((a, b) => {
45013
45165
  try {
45014
- return fs57.statSync(b).mtimeMs - fs57.statSync(a).mtimeMs;
45166
+ return fs58.statSync(b).mtimeMs - fs58.statSync(a).mtimeMs;
45015
45167
  } catch {
45016
45168
  return 0;
45017
45169
  }
@@ -45024,16 +45176,16 @@ function processSessions(files) {
45024
45176
  let failed2 = 0;
45025
45177
  for (let i = 0; i < files.length; i++) {
45026
45178
  const file = files[i];
45027
- process.stdout.write(chalk246.dim(` [${i + 1}/${files.length}] `));
45179
+ process.stdout.write(chalk249.dim(` [${i + 1}/${files.length}] `));
45028
45180
  const summary = summariseSession(file);
45029
45181
  if (summary) {
45030
45182
  writeSummary(file, summary);
45031
45183
  succeeded++;
45032
- process.stdout.write(`${chalk246.green("\u2713")} ${summary}
45184
+ process.stdout.write(`${chalk249.green("\u2713")} ${summary}
45033
45185
  `);
45034
45186
  } else {
45035
45187
  failed2++;
45036
- process.stdout.write(` ${chalk246.yellow("skip")}
45188
+ process.stdout.write(` ${chalk249.yellow("skip")}
45037
45189
  `);
45038
45190
  }
45039
45191
  }
@@ -45060,10 +45212,10 @@ function registerSessions(program2) {
45060
45212
  }
45061
45213
 
45062
45214
  // src/reportCliError.ts
45063
- import chalk247 from "chalk";
45215
+ import chalk250 from "chalk";
45064
45216
  function reportCliError(error) {
45065
45217
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
45066
- console.error(chalk247.red(error.message));
45218
+ console.error(chalk250.red(error.message));
45067
45219
  } else {
45068
45220
  console.error(error);
45069
45221
  }