@staff0rd/assist 0.721.1 → 0.722.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.721.1",
9
+ version: "0.722.0",
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(path106) {
300
- return path106.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path107) {
300
+ return path107.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(path106) {
350
+ function isFile(path107) {
351
351
  try {
352
- return statSync(path106).isFile();
352
+ return statSync(path107).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(path106) {
371
+ function readTrimmed(path107) {
372
372
  try {
373
- const content = readFileSync2(path106, "utf8").trim();
373
+ const content = readFileSync2(path107, "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(path106) {
387
- if (!existsSync3(path106)) return {};
386
+ function loadRawYaml(path107) {
387
+ if (!existsSync3(path107)) return {};
388
388
  try {
389
- const content = readFileSync3(path106, "utf8");
389
+ const content = readFileSync3(path107, "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 path106 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path106.split("/").filter(Boolean);
461
+ const path107 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path107.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -698,7 +698,9 @@ var assistConfigShape = {
698
698
  restructure: z3.strictObject({
699
699
  ignore: z3.array(z3.string()).default([]),
700
700
  pin: z3.array(z3.string()).default([]),
701
- maxDepth: z3.number().int().positive().default(10)
701
+ maxDepth: z3.number().int().positive().default(10),
702
+ maxFolderPercent: z3.number().positive().max(100).default(15),
703
+ maxFolderFiles: z3.number().int().positive().default(150)
702
704
  }).optional(),
703
705
  jira: z3.strictObject({
704
706
  acField: z3.string().default("customfield_11937")
@@ -4320,8 +4322,8 @@ function getPreferredRemoteRepo(cwd) {
4320
4322
  function gitRefUrl(kind, ref, cwd) {
4321
4323
  const repo = getPreferredRemoteRepo(cwd);
4322
4324
  if (!repo) return void 0;
4323
- const path106 = kind === "branch" ? "tree" : "commit";
4324
- return `https://github.com/${repo.org}/${repo.repo}/${path106}/${ref}`;
4325
+ const path107 = kind === "branch" ? "tree" : "commit";
4326
+ return `https://github.com/${repo.org}/${repo.repo}/${path107}/${ref}`;
4325
4327
  }
4326
4328
 
4327
4329
  // src/commands/sessions/shared/resolveSessionTranscript.ts
@@ -4482,9 +4484,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
4482
4484
  function backupLocalBacklogFiles(dir) {
4483
4485
  const moved = [];
4484
4486
  for (const name of LOCAL_FILES) {
4485
- const path106 = join19(dir, ".assist", name);
4486
- if (existsSync20(path106)) {
4487
- renameSync(path106, `${path106}.bak`);
4487
+ const path107 = join19(dir, ".assist", name);
4488
+ if (existsSync20(path107)) {
4489
+ renameSync(path107, `${path107}.bak`);
4488
4490
  moved.push(`${name} \u2192 ${name}.bak`);
4489
4491
  }
4490
4492
  }
@@ -4968,8 +4970,8 @@ var backlogItemSchema = z4.strictObject({
4968
4970
  var backlogFileSchema = z4.array(backlogItemSchema);
4969
4971
 
4970
4972
  // src/commands/backlog/parseBacklogJsonl.ts
4971
- function parseBacklogJsonl(path106) {
4972
- const content = readFileSync13(path106, "utf8").trim();
4973
+ function parseBacklogJsonl(path107) {
4974
+ const content = readFileSync13(path107, "utf8").trim();
4973
4975
  if (content.length === 0) return [];
4974
4976
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
4975
4977
  }
@@ -5515,9 +5517,9 @@ function originToSshUrl(origin) {
5515
5517
  const firstSlash = origin.indexOf("/");
5516
5518
  if (firstSlash <= 0) return null;
5517
5519
  const host = origin.slice(0, firstSlash);
5518
- const path106 = origin.slice(firstSlash + 1);
5519
- if (!path106) return null;
5520
- return `git@${host}:${path106}.git`;
5520
+ const path107 = origin.slice(firstSlash + 1);
5521
+ if (!path107) return null;
5522
+ return `git@${host}:${path107}.git`;
5521
5523
  }
5522
5524
 
5523
5525
  // src/commands/backlog/cloneRepo.ts
@@ -7155,10 +7157,10 @@ var hooksSettings = {
7155
7157
  }
7156
7158
  };
7157
7159
  function ensureHooksSettings() {
7158
- const path106 = daemonPaths.hooksSettings;
7159
- mkdirSync5(dirname15(path106), { recursive: true });
7160
- writeFileSync16(path106, JSON.stringify(hooksSettings, null, 2));
7161
- return path106;
7160
+ const path107 = daemonPaths.hooksSettings;
7161
+ mkdirSync5(dirname15(path107), { recursive: true });
7162
+ writeFileSync16(path107, JSON.stringify(hooksSettings, null, 2));
7163
+ return path107;
7162
7164
  }
7163
7165
 
7164
7166
  // src/shared/spawnInherit.ts
@@ -7914,24 +7916,24 @@ function getOwnerPath(itemId2) {
7914
7916
  function recordSignalOwner(itemId2) {
7915
7917
  const sessionId = process.env.ASSIST_SESSION_ID;
7916
7918
  if (!sessionId) return;
7917
- const path106 = getOwnerPath(itemId2);
7918
- mkdirSync7(dirname16(path106), { recursive: true });
7919
- writeFileSync18(path106, JSON.stringify({ sessionId }));
7919
+ const path107 = getOwnerPath(itemId2);
7920
+ mkdirSync7(dirname16(path107), { recursive: true });
7921
+ writeFileSync18(path107, JSON.stringify({ sessionId }));
7920
7922
  }
7921
7923
  function readSignalOwner(itemId2) {
7922
- const path106 = getOwnerPath(itemId2);
7923
- if (!existsSync26(path106)) return void 0;
7924
+ const path107 = getOwnerPath(itemId2);
7925
+ if (!existsSync26(path107)) return void 0;
7924
7926
  try {
7925
- const parsed = JSON.parse(readFileSync17(path106, "utf8"));
7927
+ const parsed = JSON.parse(readFileSync17(path107, "utf8"));
7926
7928
  return parsed.sessionId;
7927
7929
  } catch {
7928
7930
  return void 0;
7929
7931
  }
7930
7932
  }
7931
7933
  function clearSignalOwner(itemId2) {
7932
- const path106 = getOwnerPath(itemId2);
7934
+ const path107 = getOwnerPath(itemId2);
7933
7935
  try {
7934
- rmSync(path106);
7936
+ rmSync(path107);
7935
7937
  } catch {
7936
7938
  }
7937
7939
  }
@@ -7968,19 +7970,19 @@ function resolveSignalTarget(event, data) {
7968
7970
  function writeSignal(event, data) {
7969
7971
  const target = resolveSignalTarget(event, data);
7970
7972
  if (!target) return;
7971
- const path106 = getSignalPath(target);
7972
- if (!path106) return;
7973
+ const path107 = getSignalPath(target);
7974
+ if (!path107) return;
7973
7975
  const signal = { event, sessionId: target, ...data };
7974
- mkdirSync8(dirname17(path106), { recursive: true });
7975
- writeFileSync19(path106, JSON.stringify(signal));
7976
+ mkdirSync8(dirname17(path107), { recursive: true });
7977
+ writeFileSync19(path107, JSON.stringify(signal));
7976
7978
  }
7977
7979
 
7978
7980
  // src/commands/backlog/readSignal.ts
7979
7981
  function readSignal() {
7980
- const path106 = getSignalPath();
7981
- if (!path106 || !existsSync27(path106)) return void 0;
7982
+ const path107 = getSignalPath();
7983
+ if (!path107 || !existsSync27(path107)) return void 0;
7982
7984
  try {
7983
- return JSON.parse(readFileSync18(path106, "utf8"));
7985
+ return JSON.parse(readFileSync18(path107, "utf8"));
7984
7986
  } catch {
7985
7987
  return void 0;
7986
7988
  }
@@ -8178,13 +8180,13 @@ function activityPath(sessionId) {
8178
8180
  function emitActivity(activity2) {
8179
8181
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8180
8182
  if (!sessionId) return;
8181
- const path106 = activityPath(sessionId);
8182
- mkdirSync9(dirname18(path106), { recursive: true });
8183
- writeFileSync20(path106, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8183
+ const path107 = activityPath(sessionId);
8184
+ mkdirSync9(dirname18(path107), { recursive: true });
8185
+ writeFileSync20(path107, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8184
8186
  }
8185
- function readActivity(path106) {
8187
+ function readActivity(path107) {
8186
8188
  try {
8187
- return JSON.parse(readFileSync19(path106, "utf8"));
8189
+ return JSON.parse(readFileSync19(path107, "utf8"));
8188
8190
  } catch {
8189
8191
  return void 0;
8190
8192
  }
@@ -8194,9 +8196,9 @@ function reconcileActivity(sessionId, activity2) {
8194
8196
  removeActivity(sessionId);
8195
8197
  return;
8196
8198
  }
8197
- const path106 = activityPath(sessionId);
8198
- mkdirSync9(dirname18(path106), { recursive: true });
8199
- writeFileSync20(path106, JSON.stringify(activity2));
8199
+ const path107 = activityPath(sessionId);
8200
+ mkdirSync9(dirname18(path107), { recursive: true });
8201
+ writeFileSync20(path107, JSON.stringify(activity2));
8200
8202
  }
8201
8203
  function removeActivity(sessionId) {
8202
8204
  try {
@@ -10821,10 +10823,10 @@ function getStorePath(filename) {
10821
10823
  return join34(getStoreDir(), filename);
10822
10824
  }
10823
10825
  function loadJson(filename) {
10824
- const path106 = getStorePath(filename);
10825
- if (existsSync32(path106)) {
10826
+ const path107 = getStorePath(filename);
10827
+ if (existsSync32(path107)) {
10826
10828
  try {
10827
- return JSON.parse(readFileSync20(path106, "utf8"));
10829
+ return JSON.parse(readFileSync20(path107, "utf8"));
10828
10830
  } catch {
10829
10831
  return {};
10830
10832
  }
@@ -10843,22 +10845,22 @@ function saveJson(filename, data) {
10843
10845
  var REGISTRY_FILE = "worktrees.json";
10844
10846
  function readWorktreeRegistry() {
10845
10847
  const data = loadJson(REGISTRY_FILE);
10846
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path106, record]) => ({ path: path106, ...record }));
10848
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path107, record]) => ({ path: path107, ...record }));
10847
10849
  }
10848
- function worktreeAttributionIncludingReaped(path106) {
10849
- const record = loadJson(REGISTRY_FILE)[path106];
10850
+ function worktreeAttributionIncludingReaped(path107) {
10851
+ const record = loadJson(REGISTRY_FILE)[path107];
10850
10852
  return record ? { clone: record.clone, origin: record.origin } : void 0;
10851
10853
  }
10852
- function recordWorktree(path106, clone, origin) {
10854
+ function recordWorktree(path107, clone, origin) {
10853
10855
  const data = loadJson(REGISTRY_FILE);
10854
- data[path106] = { clone, origin };
10856
+ data[path107] = { clone, origin };
10855
10857
  saveJson(REGISTRY_FILE, data);
10856
10858
  }
10857
- function forgetWorktree(path106) {
10859
+ function forgetWorktree(path107) {
10858
10860
  const data = loadJson(REGISTRY_FILE);
10859
- const record = data[path106];
10861
+ const record = data[path107];
10860
10862
  if (!record || record.reaped) return;
10861
- data[path106] = { ...record, reaped: true };
10863
+ data[path107] = { ...record, reaped: true };
10862
10864
  saveJson(REGISTRY_FILE, data);
10863
10865
  }
10864
10866
 
@@ -11468,10 +11470,10 @@ function completeLines(text18, windowIsPartial) {
11468
11470
  if (windowIsPartial) all.shift();
11469
11471
  return all;
11470
11472
  }
11471
- function readLogTail(path106, lines2) {
11473
+ function readLogTail(path107, lines2) {
11472
11474
  let fd;
11473
11475
  try {
11474
- fd = openSync4(path106, "r");
11476
+ fd = openSync4(path107, "r");
11475
11477
  } catch {
11476
11478
  return [];
11477
11479
  }
@@ -11736,8 +11738,8 @@ async function loadCommittedPaths(cwd, sessionId) {
11736
11738
  for (const commit2 of commits2) {
11737
11739
  const resolved = await resolveCommit(cwd, commit2.sha);
11738
11740
  if (!resolved) continue;
11739
- for (const path106 of resolved.paths) {
11740
- if (!bases.has(path106)) bases.set(path106, resolved.base);
11741
+ for (const path107 of resolved.paths) {
11742
+ if (!bases.has(path107)) bases.set(path107, resolved.base);
11741
11743
  }
11742
11744
  }
11743
11745
  return { commits: commits2, bases };
@@ -11755,16 +11757,16 @@ async function itemChangeSet(cwd, sessionId) {
11755
11757
  }
11756
11758
  function groupByBase(bases) {
11757
11759
  const groups = /* @__PURE__ */ new Map();
11758
- for (const [path106, base] of bases) {
11760
+ for (const [path107, base] of bases) {
11759
11761
  const paths = groups.get(base);
11760
- if (paths) paths.push(path106);
11761
- else groups.set(base, [path106]);
11762
+ if (paths) paths.push(path107);
11763
+ else groups.set(base, [path107]);
11762
11764
  }
11763
11765
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
11764
11766
  }
11765
11767
  async function dirtyPaths(cwd, bases) {
11766
11768
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
11767
- return output.split("\n").filter((path106) => path106 && !bases.has(path106)).sort();
11769
+ return output.split("\n").filter((path107) => path107 && !bases.has(path107)).sort();
11768
11770
  }
11769
11771
 
11770
11772
  // src/commands/sessions/web/scopedDiff.ts
@@ -11773,8 +11775,8 @@ async function scopedDiff(cwd, session, scope) {
11773
11775
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
11774
11776
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
11775
11777
  }
11776
- async function untrackedFileDiff(cwd, path106) {
11777
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path106], {
11778
+ async function untrackedFileDiff(cwd, path107) {
11779
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path107], {
11778
11780
  maxBuffer: MAX_DIFF_BYTES,
11779
11781
  allowFailure: true
11780
11782
  });
@@ -11787,7 +11789,7 @@ async function untrackedDiff(cwd) {
11787
11789
  ]);
11788
11790
  const paths = list5.split("\n").filter(Boolean);
11789
11791
  const diffs = await Promise.all(
11790
- paths.map((path106) => untrackedFileDiff(cwd, path106))
11792
+ paths.map((path107) => untrackedFileDiff(cwd, path107))
11791
11793
  );
11792
11794
  return diffs.join("");
11793
11795
  }
@@ -11880,9 +11882,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
11880
11882
  function repoRoot(cwd) {
11881
11883
  return resolve10(cwd);
11882
11884
  }
11883
- function resolveWithinCwd(cwd, path106) {
11885
+ function resolveWithinCwd(cwd, path107) {
11884
11886
  const root2 = repoRoot(cwd);
11885
- const target = resolve10(root2, path106);
11887
+ const target = resolve10(root2, path107);
11886
11888
  const rel = relative2(root2, target);
11887
11889
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
11888
11890
  return target;
@@ -11892,14 +11894,14 @@ function resolveWithinCwd(cwd, path106) {
11892
11894
  function getFileTarget(req, res) {
11893
11895
  const cwd = getCwdParam(req, res);
11894
11896
  if (!cwd) return null;
11895
- const path106 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11897
+ const path107 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11896
11898
  "path"
11897
11899
  );
11898
- if (!path106) {
11900
+ if (!path107) {
11899
11901
  respondJson(res, 400, { error: "Missing path" });
11900
11902
  return null;
11901
11903
  }
11902
- const target = resolveWithinCwd(cwd, path106);
11904
+ const target = resolveWithinCwd(cwd, path107);
11903
11905
  if (!target) {
11904
11906
  respondJson(res, 400, { error: "Path outside cwd" });
11905
11907
  return null;
@@ -11958,9 +11960,9 @@ function segmentText(segment) {
11958
11960
  if (segment.kind === "index") return `[${segment.index}]`;
11959
11961
  return "[]";
11960
11962
  }
11961
- function formatConfigPath(path106) {
11963
+ function formatConfigPath(path107) {
11962
11964
  let text18 = "";
11963
- for (const segment of path106) {
11965
+ for (const segment of path107) {
11964
11966
  const dotted = segment.kind === "key" || segment.kind === "entry";
11965
11967
  const rendered = segmentText(segment);
11966
11968
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -12121,11 +12123,11 @@ function enumValues(node) {
12121
12123
  function opaqueConfigNode(inner, base) {
12122
12124
  return { ...base, kind: "other", type: leafTypeOf(inner) };
12123
12125
  }
12124
- function build(node, path106) {
12126
+ function build(node, path107) {
12125
12127
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
12126
12128
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
12127
12129
  const base = {
12128
- path: path106,
12130
+ path: path107,
12129
12131
  ...optional ? { optional: true } : {},
12130
12132
  ...defaultValue === void 0 ? {} : { defaultValue },
12131
12133
  ...secret ? { secret: true } : {}
@@ -12181,11 +12183,11 @@ function describeConfigLeaves(schema2) {
12181
12183
 
12182
12184
  // src/commands/config/globalConfigFileLabel.ts
12183
12185
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
12184
- function globalConfigFileLabel(path106) {
12185
- if (path106 === getGlobalConfigPath()) return "~/.assist.yml";
12186
- if (path106.startsWith(WINDOWS_MOUNT_PREFIX))
12187
- return `${path106} on the Windows host`;
12188
- return path106;
12186
+ function globalConfigFileLabel(path107) {
12187
+ if (path107 === getGlobalConfigPath()) return "~/.assist.yml";
12188
+ if (path107.startsWith(WINDOWS_MOUNT_PREFIX))
12189
+ return `${path107} on the Windows host`;
12190
+ return path107;
12189
12191
  }
12190
12192
 
12191
12193
  // src/commands/config/readRawConfigLayers.ts
@@ -12242,35 +12244,35 @@ function isPlainRecord(value) {
12242
12244
  }
12243
12245
 
12244
12246
  // src/shared/mapConfigSecrets.ts
12245
- function mapChildren(value, path106, childNode, map) {
12247
+ function mapChildren(value, path107, childNode, map) {
12246
12248
  if (!isPlainRecord(value)) return value;
12247
12249
  return Object.fromEntries(
12248
12250
  Object.entries(value).map(([name, child]) => [
12249
12251
  name,
12250
- walk(child, [...path106, name], childNode(name), map)
12252
+ walk(child, [...path107, name], childNode(name), map)
12251
12253
  ])
12252
12254
  );
12253
12255
  }
12254
- function mapItems(value, path106, item, map) {
12256
+ function mapItems(value, path107, item, map) {
12255
12257
  if (!Array.isArray(value)) return value;
12256
- return value.map((entry, index3) => walk(entry, [...path106, index3], item, map));
12258
+ return value.map((entry, index3) => walk(entry, [...path107, index3], item, map));
12257
12259
  }
12258
- function walk(value, path106, node, map) {
12260
+ function walk(value, path107, node, map) {
12259
12261
  if (!node || value === void 0 || value === null) return value;
12260
- if (node.secret) return map(value, path106);
12262
+ if (node.secret) return map(value, path107);
12261
12263
  switch (node.kind) {
12262
12264
  case "object":
12263
12265
  case "unionOfObjects":
12264
12266
  return mapChildren(
12265
12267
  value,
12266
- path106,
12268
+ path107,
12267
12269
  (name) => configNodeField(node, name),
12268
12270
  map
12269
12271
  );
12270
12272
  case "objectList":
12271
- return mapItems(value, path106, node.item, map);
12273
+ return mapItems(value, path107, node.item, map);
12272
12274
  case "record":
12273
- return mapChildren(value, path106, () => node.value, map);
12275
+ return mapChildren(value, path107, () => node.value, map);
12274
12276
  default:
12275
12277
  return value;
12276
12278
  }
@@ -12295,9 +12297,9 @@ function isTraversable(value) {
12295
12297
  function stepInto(current, key) {
12296
12298
  return isTraversable(current) ? current[key] : void 0;
12297
12299
  }
12298
- function getNestedValue(obj, path106) {
12300
+ function getNestedValue(obj, path107) {
12299
12301
  let current = obj;
12300
- for (const key of path106.split(".")) current = stepInto(current, key);
12302
+ for (const key of path107.split(".")) current = stepInto(current, key);
12301
12303
  return current;
12302
12304
  }
12303
12305
 
@@ -12347,9 +12349,9 @@ function step(node, segment) {
12347
12349
  return void 0;
12348
12350
  }
12349
12351
  }
12350
- function findConfigNode(root2, path106) {
12352
+ function findConfigNode(root2, path107) {
12351
12353
  let current = root2;
12352
- for (const segment of path106) {
12354
+ for (const segment of path107) {
12353
12355
  if (!current) return void 0;
12354
12356
  current = step(current, segment);
12355
12357
  }
@@ -12366,34 +12368,34 @@ function nameSegment(name) {
12366
12368
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
12367
12369
  }
12368
12370
  function parseConfigPath(text18) {
12369
- const path106 = [];
12371
+ const path107 = [];
12370
12372
  let at2 = 0;
12371
12373
  while (at2 < text18.length) {
12372
12374
  if (text18[at2] === "[") {
12373
12375
  const close = text18.indexOf("]", at2);
12374
12376
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
12375
12377
  if (!segment) return void 0;
12376
- path106.push(segment);
12378
+ path107.push(segment);
12377
12379
  at2 = close + 1;
12378
12380
  continue;
12379
12381
  }
12380
12382
  if (text18[at2] === ".") {
12381
- if (path106.length === 0) return void 0;
12383
+ if (path107.length === 0) return void 0;
12382
12384
  at2 += 1;
12383
12385
  }
12384
12386
  const start3 = at2;
12385
12387
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
12386
12388
  const name = text18.slice(start3, at2);
12387
12389
  if (!name) return void 0;
12388
- path106.push(nameSegment(name));
12390
+ path107.push(nameSegment(name));
12389
12391
  }
12390
- return path106;
12392
+ return path107;
12391
12393
  }
12392
12394
 
12393
12395
  // src/commands/config/configEntryNode.ts
12394
12396
  function configEntryNode(root2, key) {
12395
- const path106 = parseConfigPath(key);
12396
- return path106 ? findConfigNode(root2, path106) : void 0;
12397
+ const path107 = parseConfigPath(key);
12398
+ return path107 ? findConfigNode(root2, path107) : void 0;
12397
12399
  }
12398
12400
 
12399
12401
  // src/commands/backlog/harnessConfigHelp.ts
@@ -12629,6 +12631,16 @@ var refactorConfigHelp = [
12629
12631
  key: "restructure.maxDepth",
12630
12632
  setter: "assist config set restructure.maxDepth 10",
12631
12633
  note: "deepest folder level the plan may place a file at (default 10); deeper plans list their deep chains with pin guidance, and --check fails"
12634
+ },
12635
+ {
12636
+ key: "restructure.maxFolderPercent",
12637
+ setter: "assist config set restructure.maxFolderPercent 15",
12638
+ note: "most files any folder except the root may hold, as a percentage of all files under the root (default 15, capped by restructure.maxFolderFiles); larger folders are listed with pin guidance, and --check fails"
12639
+ },
12640
+ {
12641
+ key: "restructure.maxFolderFiles",
12642
+ setter: "assist config set restructure.maxFolderFiles 150",
12643
+ note: "cap on the restructure.maxFolderPercent folder limit (default 150)"
12632
12644
  }
12633
12645
  ];
12634
12646
 
@@ -13137,7 +13149,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
13137
13149
  const parent = dirname22(branchKeyPath);
13138
13150
  const branchPrefix = basename10(branchKeyPath);
13139
13151
  if (!existsSync34(parent)) return null;
13140
- const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path106) => existsSync34(path106)).map((path106) => ({ path: path106, mtime: statSync5(path106).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13152
+ const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path107) => existsSync34(path107)).map((path107) => ({ path: path107, mtime: statSync5(path107).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13141
13153
  return synthesisFiles[0]?.path ?? null;
13142
13154
  }
13143
13155
 
@@ -13167,12 +13179,12 @@ async function getReviewSynthesis(req, res) {
13167
13179
  const cwd = getCwdParam(req, res);
13168
13180
  if (!cwd) return;
13169
13181
  try {
13170
- const path106 = await resolveSynthesisPath(cwd);
13171
- if (!path106) {
13182
+ const path107 = await resolveSynthesisPath(cwd);
13183
+ if (!path107) {
13172
13184
  respondJson(res, 404, { error: "No synthesis found" });
13173
13185
  return;
13174
13186
  }
13175
- respondJson(res, 200, { synthesis: readFileSync22(path106, "utf8") });
13187
+ respondJson(res, 200, { synthesis: readFileSync22(path107, "utf8") });
13176
13188
  } catch {
13177
13189
  respondJson(res, 404, { error: "No synthesis found" });
13178
13190
  }
@@ -13255,8 +13267,8 @@ function parseDiffNameStatus(output) {
13255
13267
  if (!status3 || fields.length < 2) continue;
13256
13268
  const category = categorize(status3[0]);
13257
13269
  if (!category) continue;
13258
- const path106 = fields[fields.length - 1];
13259
- if (path106) result[category].push(path106);
13270
+ const path107 = fields[fields.length - 1];
13271
+ if (path107) result[category].push(path107);
13260
13272
  }
13261
13273
  return result;
13262
13274
  }
@@ -13466,21 +13478,21 @@ function subsequenceScore(text18, query) {
13466
13478
  }
13467
13479
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13468
13480
  }
13469
- function scoreFilePath(path106, query) {
13481
+ function scoreFilePath(path107, query) {
13470
13482
  const needle = query.trim().toLowerCase();
13471
13483
  if (!needle) return 0;
13472
- const basename31 = path106.slice(path106.lastIndexOf("/") + 1);
13484
+ const basename31 = path107.slice(path107.lastIndexOf("/") + 1);
13473
13485
  const inBasename = subsequenceScore(basename31, needle);
13474
13486
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13475
- return subsequenceScore(path106, needle);
13487
+ return subsequenceScore(path107, needle);
13476
13488
  }
13477
13489
 
13478
13490
  // src/commands/sessions/web/rankFilePaths.ts
13479
13491
  function rankFilePaths(paths, query, limit) {
13480
13492
  const scored = [];
13481
- for (const path106 of paths) {
13482
- const score = scoreFilePath(path106, query);
13483
- if (score !== null) scored.push({ path: path106, score });
13493
+ for (const path107 of paths) {
13494
+ const score = scoreFilePath(path107, query);
13495
+ if (score !== null) scored.push({ path: path107, score });
13484
13496
  }
13485
13497
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
13486
13498
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -14190,11 +14202,11 @@ function logLinkedRequest(req, res) {
14190
14202
  const started = Date.now();
14191
14203
  const from = req.headers[LINKED_FROM_HEADER2];
14192
14204
  const trace = req.headers[TRACE_HEADER] ?? "none";
14193
- const path106 = new URL(req.url ?? "/", "http://localhost").pathname;
14205
+ const path107 = new URL(req.url ?? "/", "http://localhost").pathname;
14194
14206
  res.once("finish", () => {
14195
- if (isQuietPoll(path106, res.statusCode)) return;
14207
+ if (isQuietPoll(path107, res.statusCode)) return;
14196
14208
  console.log(
14197
- `link-from ${from} http: ${req.method} ${path106} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14209
+ `link-from ${from} http: ${req.method} ${path107} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14198
14210
  );
14199
14211
  });
14200
14212
  }
@@ -14582,8 +14594,8 @@ async function liveDeployments(cwd, repo, environments) {
14582
14594
 
14583
14595
  // src/commands/sessions/web/releases/latestRun.ts
14584
14596
  async function latestRun(cwd, repo, workflow) {
14585
- const path106 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14586
- const response = await ghJson(cwd, ["api", path106]);
14597
+ const path107 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14598
+ const response = await ghJson(cwd, ["api", path107]);
14587
14599
  const run4 = response.workflow_runs?.[0];
14588
14600
  if (!run4) return null;
14589
14601
  return {
@@ -14864,38 +14876,38 @@ async function performRestart(target, deps2 = {}) {
14864
14876
  import { relative as relative3 } from "path";
14865
14877
 
14866
14878
  // src/commands/sessions/web/revertPathChanges.ts
14867
- async function isTracked(cwd, path106) {
14879
+ async function isTracked(cwd, path107) {
14868
14880
  try {
14869
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path106]);
14881
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path107]);
14870
14882
  return true;
14871
14883
  } catch {
14872
14884
  return false;
14873
14885
  }
14874
14886
  }
14875
- async function isInHead(cwd, path106) {
14876
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path106]);
14887
+ async function isInHead(cwd, path107) {
14888
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path107]);
14877
14889
  return listing.trim().length > 0;
14878
14890
  }
14879
- async function revertPathChanges(cwd, path106) {
14880
- if (!await isTracked(cwd, path106)) {
14881
- await execGit(cwd, ["clean", "-f", "--", path106]);
14891
+ async function revertPathChanges(cwd, path107) {
14892
+ if (!await isTracked(cwd, path107)) {
14893
+ await execGit(cwd, ["clean", "-f", "--", path107]);
14882
14894
  return;
14883
14895
  }
14884
- if (await isInHead(cwd, path106)) {
14885
- await execGit(cwd, ["checkout", "HEAD", "--", path106]);
14896
+ if (await isInHead(cwd, path107)) {
14897
+ await execGit(cwd, ["checkout", "HEAD", "--", path107]);
14886
14898
  return;
14887
14899
  }
14888
- await execGit(cwd, ["rm", "-f", "--", path106]);
14900
+ await execGit(cwd, ["rm", "-f", "--", path107]);
14889
14901
  }
14890
14902
 
14891
14903
  // src/commands/sessions/web/revertDiffFile.ts
14892
14904
  async function revertDiffFile(req, res) {
14893
14905
  const resolved = getFileTarget(req, res);
14894
14906
  if (!resolved) return;
14895
- const path106 = relative3(repoRoot(resolved.cwd), resolved.target);
14907
+ const path107 = relative3(repoRoot(resolved.cwd), resolved.target);
14896
14908
  try {
14897
- await revertPathChanges(resolved.cwd, path106);
14898
- respondJson(res, 200, { reverted: path106 });
14909
+ await revertPathChanges(resolved.cwd, path107);
14910
+ respondJson(res, 200, { reverted: path107 });
14899
14911
  } catch (error) {
14900
14912
  respondJson(res, 500, {
14901
14913
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -15000,7 +15012,7 @@ async function readJsonBody(req) {
15000
15012
  function requestedPaths(body) {
15001
15013
  const paths = body.paths;
15002
15014
  if (!Array.isArray(paths)) return null;
15003
- if (paths.some((path106) => typeof path106 !== "string")) return null;
15015
+ if (paths.some((path107) => typeof path107 !== "string")) return null;
15004
15016
  return paths;
15005
15017
  }
15006
15018
  async function revertDiffPaths(req, res) {
@@ -15020,10 +15032,10 @@ async function revertDiffPaths(req, res) {
15020
15032
  const root2 = repoRoot(cwd);
15021
15033
  const reverted = [];
15022
15034
  const failed3 = [];
15023
- for (const path106 of paths) {
15024
- const target = resolveWithinCwd(cwd, path106);
15035
+ for (const path107 of paths) {
15036
+ const target = resolveWithinCwd(cwd, path107);
15025
15037
  if (!target) {
15026
- failed3.push({ path: path106, error: "Path outside cwd" });
15038
+ failed3.push({ path: path107, error: "Path outside cwd" });
15027
15039
  continue;
15028
15040
  }
15029
15041
  const relativePath = relative4(root2, target);
@@ -15122,11 +15134,11 @@ function coerceStructuredConfigValue(key, raw) {
15122
15134
  };
15123
15135
  }
15124
15136
  function formatIssue(key, issue) {
15125
- const path106 = formatConfigPath([
15137
+ const path107 = formatConfigPath([
15126
15138
  { kind: "key", name: key },
15127
15139
  ...issue.path.map(toSegment)
15128
15140
  ]);
15129
- return `${path106}: ${issue.message}`;
15141
+ return `${path107}: ${issue.message}`;
15130
15142
  }
15131
15143
  function toSegment(part) {
15132
15144
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -15221,9 +15233,9 @@ function coerceUnion(key, raw, types) {
15221
15233
  }
15222
15234
 
15223
15235
  // src/shared/valueAtConfigPath.ts
15224
- function valueAtConfigPath(value, path106) {
15236
+ function valueAtConfigPath(value, path107) {
15225
15237
  let current = value;
15226
- for (const key of path106) {
15238
+ for (const key of path107) {
15227
15239
  if (typeof key === "number") {
15228
15240
  if (!Array.isArray(current)) return void 0;
15229
15241
  current = current[key];
@@ -15240,7 +15252,7 @@ function restoreConfigSecrets(value, stored, node) {
15240
15252
  return mapConfigSecrets(
15241
15253
  value,
15242
15254
  node,
15243
- (secret, path106) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path106) : secret
15255
+ (secret, path107) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path107) : secret
15244
15256
  );
15245
15257
  }
15246
15258
 
@@ -15289,8 +15301,8 @@ function stepIntoNested(container, key, nextKey) {
15289
15301
  }
15290
15302
  return ensureObject(container, resolved);
15291
15303
  }
15292
- function setNestedValue(obj, path106, value) {
15293
- const keys = path106.split(".");
15304
+ function setNestedValue(obj, path107, value) {
15305
+ const keys = path107.split(".");
15294
15306
  const result = { ...obj };
15295
15307
  let current = result;
15296
15308
  for (let i = 0; i < keys.length - 1; i++) {
@@ -15317,8 +15329,8 @@ function formatIssue2(issue, key) {
15317
15329
  return issue.keys.map(
15318
15330
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
15319
15331
  );
15320
- const path106 = issue.path.length > 0 ? issue.path.join(".") : key;
15321
- return [`${path106}: ${issue.message}`];
15332
+ const path107 = issue.path.length > 0 ? issue.path.join(".") : key;
15333
+ return [`${path107}: ${issue.message}`];
15322
15334
  }
15323
15335
 
15324
15336
  // src/commands/config/applyConfigSet.ts
@@ -15560,8 +15572,8 @@ function removeAt(container, keys) {
15560
15572
  }
15561
15573
  return removeFromChild(container, key, rest);
15562
15574
  }
15563
- function unsetNestedValue(obj, path106) {
15564
- const { container, removed } = removeAt(obj, path106.split("."));
15575
+ function unsetNestedValue(obj, path107) {
15576
+ const { container, removed } = removeAt(obj, path107.split("."));
15565
15577
  return { config: container, removed };
15566
15578
  }
15567
15579
 
@@ -17050,13 +17062,13 @@ function findBuiltinDenyRaw(rawCommand) {
17050
17062
 
17051
17063
  // src/commands/cliHook/findRestrictedPathDeny.ts
17052
17064
  var RESTRICTED_PATHS = [".assist/restricted"];
17053
- function restrictedPathRegex(path106) {
17054
- const pattern2 = path106.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17065
+ function restrictedPathRegex(path107) {
17066
+ const pattern2 = path107.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17055
17067
  return new RegExp(pattern2);
17056
17068
  }
17057
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path106) => ({
17058
- path: path106,
17059
- regex: restrictedPathRegex(path106)
17069
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path107) => ({
17070
+ path: path107,
17071
+ regex: restrictedPathRegex(path107)
17060
17072
  }));
17061
17073
  function findRestrictedPathDenyRaw(rawCommand) {
17062
17074
  const rule = RESTRICTED_PATH_RULES.find(
@@ -17233,9 +17245,9 @@ var __dirname4 = dirname25(__filename3);
17233
17245
  function packageRoot() {
17234
17246
  return __dirname4;
17235
17247
  }
17236
- function readLines(path106) {
17237
- if (!existsSync40(path106)) return [];
17238
- return readFileSync25(path106, "utf8").split("\n").filter((line) => line.trim() !== "");
17248
+ function readLines(path107) {
17249
+ if (!existsSync40(path107)) return [];
17250
+ return readFileSync25(path107, "utf8").split("\n").filter((line) => line.trim() !== "");
17239
17251
  }
17240
17252
  var cachedReads;
17241
17253
  var cachedWrites;
@@ -17767,14 +17779,14 @@ function showProgress(p, label2) {
17767
17779
  const pct = Math.round(p.done / p.total * 100);
17768
17780
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
17769
17781
  }
17770
- async function resolveCommand2(cli, path106, description, depth, p) {
17771
- showProgress(p, path106.join(" "));
17772
- const subHelp = await runHelp([cli, ...path106]);
17782
+ async function resolveCommand2(cli, path107, description, depth, p) {
17783
+ showProgress(p, path107.join(" "));
17784
+ const subHelp = await runHelp([cli, ...path107]);
17773
17785
  if (!subHelp || !hasSubcommands(subHelp)) {
17774
- return [{ path: path106, description }];
17786
+ return [{ path: path107, description }];
17775
17787
  }
17776
- const children = await discoverAt(cli, path106, depth + 1, p);
17777
- return children.length > 0 ? children : [{ path: path106, description }];
17788
+ const children = await discoverAt(cli, path107, depth + 1, p);
17789
+ return children.length > 0 ? children : [{ path: path107, description }];
17778
17790
  }
17779
17791
  async function discoverAt(cli, parentPath, depth, p) {
17780
17792
  if (depth > SAFETY_DEPTH) return [];
@@ -17922,9 +17934,9 @@ function logPath(cli) {
17922
17934
  return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
17923
17935
  }
17924
17936
  function readCache(cli) {
17925
- const path106 = logPath(cli);
17926
- if (!existsSync42(path106)) return void 0;
17927
- return readFileSync27(path106, "utf8");
17937
+ const path107 = logPath(cli);
17938
+ if (!existsSync42(path107)) return void 0;
17939
+ return readFileSync27(path107, "utf8");
17928
17940
  }
17929
17941
  function writeCache(cli, output) {
17930
17942
  const dir = join43(homedir17(), ".assist");
@@ -18113,9 +18125,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18113
18125
  }
18114
18126
  const cutoff = Date.now() - STALE_AFTER_MS;
18115
18127
  for (const entry of entries) {
18116
- const path106 = join45(dir, entry);
18128
+ const path107 = join45(dir, entry);
18117
18129
  try {
18118
- if (statSync7(path106).mtimeMs < cutoff) unlinkSync7(path106);
18130
+ if (statSync7(path107).mtimeMs < cutoff) unlinkSync7(path107);
18119
18131
  } catch {
18120
18132
  continue;
18121
18133
  }
@@ -18125,10 +18137,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18125
18137
  // src/commands/codeComment/readPinState.ts
18126
18138
  import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
18127
18139
  function readPinState(pin2) {
18128
- const path106 = getPinStatePath(pin2);
18129
- if (!existsSync43(path106)) return void 0;
18140
+ const path107 = getPinStatePath(pin2);
18141
+ if (!existsSync43(path107)) return void 0;
18130
18142
  try {
18131
- const state = JSON.parse(readFileSync28(path106, "utf8"));
18143
+ const state = JSON.parse(readFileSync28(path107, "utf8"));
18132
18144
  if (state.pin !== pin2) return void 0;
18133
18145
  return state;
18134
18146
  } catch {
@@ -18549,8 +18561,8 @@ function findUnmergedPaths() {
18549
18561
  }
18550
18562
  const found = /* @__PURE__ */ new Set();
18551
18563
  for (const line of output.split("\n")) {
18552
- const path106 = line.split(" ")[1];
18553
- if (path106) found.add(path106.trim());
18564
+ const path107 = line.split(" ")[1];
18565
+ if (path107) found.add(path107.trim());
18554
18566
  }
18555
18567
  return [...found];
18556
18568
  }
@@ -19797,11 +19809,11 @@ async function loadPath(source) {
19797
19809
  }
19798
19810
  }
19799
19811
  async function criteriaExtension() {
19800
- const path106 = await loadPath(criteriaExtensionDir());
19812
+ const path107 = await loadPath(criteriaExtensionDir());
19801
19813
  console.log(
19802
19814
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
19803
19815
  );
19804
- console.log(chalk137.dim(`load the unpacked extension from ${path106}`));
19816
+ console.log(chalk137.dim(`load the unpacked extension from ${path107}`));
19805
19817
  }
19806
19818
 
19807
19819
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -19926,10 +19938,10 @@ async function signCriteriaExtension() {
19926
19938
  process.exitCode = 1;
19927
19939
  return;
19928
19940
  }
19929
- const path106 = await signedAddonInstallPath(
19941
+ const path107 = await signedAddonInstallPath(
19930
19942
  await copySignedXpi(xpi, ARTIFACTS_DIR)
19931
19943
  );
19932
- console.log(chalk139.dim(`install the signed add-on from ${path106}`));
19944
+ console.log(chalk139.dim(`install the signed add-on from ${path107}`));
19933
19945
  }
19934
19946
 
19935
19947
  // src/commands/registerCriteriaExtension.ts
@@ -20027,10 +20039,10 @@ function getMigrationApprovalPath(migrationId) {
20027
20039
  // src/commands/dbMigration/readMigrationPinState.ts
20028
20040
  import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
20029
20041
  function readMigrationPinState(pin2) {
20030
- const path106 = getMigrationPinPath(pin2);
20031
- if (!existsSync48(path106)) return void 0;
20042
+ const path107 = getMigrationPinPath(pin2);
20043
+ if (!existsSync48(path107)) return void 0;
20032
20044
  try {
20033
- const state = JSON.parse(readFileSync30(path106, "utf8"));
20045
+ const state = JSON.parse(readFileSync30(path107, "utf8"));
20034
20046
  if (state.pin !== pin2) return void 0;
20035
20047
  if (!Number.isInteger(state.migrationId)) return void 0;
20036
20048
  return state;
@@ -21940,10 +21952,10 @@ function decideCommentGuard(input, existingContent) {
21940
21952
  import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
21941
21953
  function consumeMigrationApproval(migrationId) {
21942
21954
  sweepRestrictedDir();
21943
- const path106 = getMigrationApprovalPath(migrationId);
21944
- if (!existsSync54(path106)) return false;
21955
+ const path107 = getMigrationApprovalPath(migrationId);
21956
+ if (!existsSync54(path107)) return false;
21945
21957
  try {
21946
- unlinkSync11(path106);
21958
+ unlinkSync11(path107);
21947
21959
  return true;
21948
21960
  } catch {
21949
21961
  return false;
@@ -24347,11 +24359,11 @@ function recentDaemonLogLines(includeRelayed = true) {
24347
24359
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
24348
24360
  import { realpathSync as realpathSync2 } from "fs";
24349
24361
  import { resolve as resolve15 } from "path";
24350
- function canonicalTreePath(path106) {
24362
+ function canonicalTreePath(path107) {
24351
24363
  try {
24352
- return realpathSync2(path106);
24364
+ return realpathSync2(path107);
24353
24365
  } catch {
24354
- return resolve15(path106);
24366
+ return resolve15(path107);
24355
24367
  }
24356
24368
  }
24357
24369
 
@@ -24404,22 +24416,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
24404
24416
  const registered = new Set(listWorktreePaths(clone));
24405
24417
  const branches = new Set(listLocalBranches(clone));
24406
24418
  const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
24407
- const path106 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24419
+ const path107 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24408
24420
  const start3 = worktreeStartPoint(clone, strategy.trunk);
24409
24421
  gitSync(clone, [
24410
24422
  "worktree",
24411
24423
  "add",
24412
24424
  start3.track ? "--track" : "--no-track",
24413
24425
  "-b",
24414
- basename17(path106),
24415
- path106,
24426
+ basename17(path107),
24427
+ path107,
24416
24428
  start3.ref
24417
24429
  ]);
24418
- recordWorktree(path106, clone, getCurrentOrigin(clone));
24430
+ recordWorktree(path107, clone, getCurrentOrigin(clone));
24419
24431
  daemonLog(
24420
- start3.track ? `worktree allocated ${path106} (branch ${basename17(path106)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path106} (branch ${basename17(path106)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24432
+ start3.track ? `worktree allocated ${path107} (branch ${basename17(path107)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path107} (branch ${basename17(path107)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24421
24433
  );
24422
- return path106;
24434
+ return path107;
24423
24435
  }
24424
24436
 
24425
24437
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24560,13 +24572,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24560
24572
  if (forcedSpill) daemonLog(forcedSpill);
24561
24573
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24562
24574
  return { cwd: clone, kind: "primary", created: false, clone };
24563
- const path106 = createWorktree(
24575
+ const path107 = createWorktree(
24564
24576
  clone,
24565
24577
  { root: cfg.root, trunk: cfg.trunk },
24566
24578
  boundTreeRoots2,
24567
24579
  options2.replacesTree
24568
24580
  );
24569
- return { cwd: path106, kind: "worktree", created: true, clone };
24581
+ return { cwd: path107, kind: "worktree", created: true, clone };
24570
24582
  }
24571
24583
 
24572
24584
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -24916,13 +24928,13 @@ function worktreeHoldingBranch(cwd, branch2) {
24916
24928
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
24917
24929
  if (!listing) return null;
24918
24930
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
24919
- let path106 = null;
24931
+ let path107 = null;
24920
24932
  for (const line of listing.split("\n")) {
24921
24933
  const trimmed = line.trim();
24922
24934
  if (trimmed.startsWith("worktree "))
24923
- path106 = trimmed.slice("worktree ".length).trim();
24935
+ path107 = trimmed.slice("worktree ".length).trim();
24924
24936
  else if (trimmed === `branch refs/heads/${branch2}`)
24925
- return path106 && path106 !== here ? path106 : null;
24937
+ return path107 && path107 !== here ? path107 : null;
24926
24938
  }
24927
24939
  return null;
24928
24940
  }
@@ -26026,9 +26038,9 @@ function parseRscRows(flight) {
26026
26038
  }
26027
26039
  function makeRscResolver(rows) {
26028
26040
  return (ref) => {
26029
- const [id, ...path106] = ref.slice(1).replace(/^[L@]/, "").split(":");
26041
+ const [id, ...path107] = ref.slice(1).replace(/^[L@]/, "").split(":");
26030
26042
  let v = rows[id];
26031
- for (const key of path106) {
26043
+ for (const key of path107) {
26032
26044
  if (v == null || typeof v !== "object") return void 0;
26033
26045
  v = v[key];
26034
26046
  }
@@ -26779,18 +26791,18 @@ function validateLine(line) {
26779
26791
  process.exit(1);
26780
26792
  }
26781
26793
  }
26782
- async function comment2(path106, line, body, options2 = {}) {
26794
+ async function comment2(path107, line, body, options2 = {}) {
26783
26795
  const { startLine, skipPreview } = options2;
26784
26796
  validateBody(body);
26785
26797
  validateLine(line);
26786
26798
  if (startLine !== void 0) validateLine(startLine);
26787
26799
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26788
26800
  if (!skipPreview)
26789
- await reviewProposedPrComment(`Comment on ${path106}:${range}`, body, null);
26801
+ await reviewProposedPrComment(`Comment on ${path107}:${range}`, body, null);
26790
26802
  try {
26791
26803
  const prId = getCurrentPrNodeId();
26792
- postReviewComment({ prId, body, path: path106, line, startLine });
26793
- console.log(`Added review comment on ${path106}:${range}`);
26804
+ postReviewComment({ prId, body, path: path107, line, startLine });
26805
+ console.log(`Added review comment on ${path107}:${range}`);
26794
26806
  } catch (error) {
26795
26807
  if (isGhNotInstalled(error)) {
26796
26808
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -27359,9 +27371,9 @@ function registerPrsComments(prsCommand) {
27359
27371
  });
27360
27372
  prsCommand.command("comment <path> <line> <body>").description(
27361
27373
  "Add a line comment to the pending review (body of - reads it from stdin)"
27362
- ).action(async (path106, line, body) => {
27374
+ ).action(async (path107, line, body) => {
27363
27375
  await comment2(
27364
- path106,
27376
+ path107,
27365
27377
  Number.parseInt(line, 10),
27366
27378
  await readBodyArgument(body)
27367
27379
  );
@@ -28582,11 +28594,11 @@ async function loadBody(target) {
28582
28594
  if (target.kind === "file") return readDraftFile(target.path);
28583
28595
  return fetchPrBody(target.number, target.repo);
28584
28596
  }
28585
- function readDraftFile(path106) {
28597
+ function readDraftFile(path107) {
28586
28598
  try {
28587
- return readFileSync44(path106, "utf8");
28599
+ return readFileSync44(path107, "utf8");
28588
28600
  } catch {
28589
- console.error(`Error: Could not read \`${path106}\`.`);
28601
+ console.error(`Error: Could not read \`${path107}\`.`);
28590
28602
  console.error(
28591
28603
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28592
28604
  );
@@ -28866,10 +28878,10 @@ function resolveOpSecret(reference) {
28866
28878
  }
28867
28879
 
28868
28880
  // src/commands/ravendb/ravenFetch.ts
28869
- async function ravenFetch(connection, path106) {
28881
+ async function ravenFetch(connection, path107) {
28870
28882
  const apiKey = resolveOpSecret(connection.apiKeyRef);
28871
28883
  let accessToken = await getAccessToken(apiKey);
28872
- const url = `${connection.url}${path106}`;
28884
+ const url = `${connection.url}${path107}`;
28873
28885
  const headers = {
28874
28886
  Authorization: `Bearer ${accessToken}`,
28875
28887
  "Content-Type": "application/json"
@@ -28959,16 +28971,16 @@ import chalk195 from "chalk";
28959
28971
  // src/commands/ravendb/buildQueryPath.ts
28960
28972
  function buildQueryPath(opts) {
28961
28973
  const db = encodeURIComponent(opts.db);
28962
- let path106;
28974
+ let path107;
28963
28975
  if (opts.collection) {
28964
- path106 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28976
+ path107 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28965
28977
  } else {
28966
- path106 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28978
+ path107 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28967
28979
  }
28968
28980
  if (opts.query) {
28969
- path106 += `&query=${encodeURIComponent(opts.query)}`;
28981
+ path107 += `&query=${encodeURIComponent(opts.query)}`;
28970
28982
  }
28971
- return path106;
28983
+ return path107;
28972
28984
  }
28973
28985
 
28974
28986
  // src/commands/ravendb/fetchAllPages.ts
@@ -28977,7 +28989,7 @@ async function fetchAllPages(connection, opts) {
28977
28989
  let start3 = 0;
28978
28990
  while (true) {
28979
28991
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
28980
- const path106 = buildQueryPath({
28992
+ const path107 = buildQueryPath({
28981
28993
  db: connection.database,
28982
28994
  collection: opts.collection,
28983
28995
  start: start3,
@@ -28985,7 +28997,7 @@ async function fetchAllPages(connection, opts) {
28985
28997
  sort: opts.sort,
28986
28998
  query: opts.query
28987
28999
  });
28988
- const data = await ravenFetch(connection, path106);
29000
+ const data = await ravenFetch(connection, path107);
28989
29001
  const results = data.Results ?? [];
28990
29002
  const totalResults = data.TotalResults ?? 0;
28991
29003
  if (results.length === 0) break;
@@ -31499,102 +31511,39 @@ Renamed ${oldName} \u2192 ${newName}`));
31499
31511
 
31500
31512
  // src/commands/refactor/restructure.ts
31501
31513
  import fs38 from "fs";
31502
- import path80 from "path";
31503
- import chalk221 from "chalk";
31504
-
31505
- // src/commands/refactor/restructure/applyPlan.ts
31506
- import chalk216 from "chalk";
31507
-
31508
- // src/commands/refactor/restructure/executePlan.ts
31509
- import fs37 from "fs";
31510
- import path62 from "path";
31511
- import chalk215 from "chalk";
31512
- function relPath(file) {
31513
- return path62.relative(process.cwd(), file);
31514
- }
31515
- function stagingPath(move2, index3) {
31516
- return `${move2.from}.restructure-${process.pid}-${index3}`;
31517
- }
31518
- function moveFiles(moves) {
31519
- const staged = moves.map((move2, i) => {
31520
- const staging = stagingPath(move2, i);
31521
- fs37.renameSync(move2.from, staging);
31522
- return { move: move2, staging };
31523
- });
31524
- for (const { move: move2, staging } of staged) {
31525
- fs37.mkdirSync(path62.dirname(move2.to), { recursive: true });
31526
- fs37.renameSync(staging, move2.to);
31527
- console.log(
31528
- chalk215.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
31529
- );
31530
- }
31531
- }
31532
- function removeIfEmpty(dir) {
31533
- if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
31534
- fs37.rmdirSync(dir);
31535
- console.log(chalk215.dim(` Removed empty directory ${relPath(dir)}`));
31536
- return true;
31537
- }
31538
- function removeEmptyDirectories(dirs, scopeRoot) {
31539
- const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
31540
- for (let dir of deepestFirst) {
31541
- while (dir.startsWith(`${scopeRoot}${path62.sep}`) && removeIfEmpty(dir))
31542
- dir = path62.dirname(dir);
31543
- }
31544
- }
31545
- function executePlan(plan2) {
31546
- for (const [file, content] of applyRewrites(plan2.rewrites)) {
31547
- fs37.writeFileSync(file, content, "utf8");
31548
- console.log(chalk215.cyan(` Rewrote imports in ${relPath(file)}`));
31549
- }
31550
- moveFiles(plan2.moves);
31551
- removeEmptyDirectories(
31552
- plan2.moves.map((m) => path62.dirname(m.from)),
31553
- plan2.scopeRoot
31554
- );
31555
- }
31556
-
31557
- // src/commands/refactor/restructure/applyPlan.ts
31558
- function applyPlan(plan2) {
31559
- if (plan2.errors.length > 0) {
31560
- console.log(chalk216.red("\nResolve the errors above before applying."));
31561
- process.exit(1);
31562
- }
31563
- console.log(chalk216.bold("\nApplying changes..."));
31564
- executePlan(plan2);
31565
- console.log(chalk216.green("\nRestructuring complete"));
31566
- }
31514
+ import path81 from "path";
31515
+ import chalk223 from "chalk";
31567
31516
 
31568
31517
  // src/commands/refactor/restructure/buildPlan.ts
31569
- import path72 from "path";
31518
+ import path71 from "path";
31570
31519
 
31571
31520
  // src/commands/refactor/restructure/planRestructure.ts
31572
- import path71 from "path";
31521
+ import path70 from "path";
31573
31522
 
31574
31523
  // src/commands/refactor/restructure/planRestructure/anchored.ts
31575
- import path63 from "path";
31524
+ import path62 from "path";
31576
31525
  function anchored(files, mode, reasonPrefix) {
31577
31526
  return {
31578
31527
  root: false,
31579
31528
  anchors: files.map((file) => ({ file, mode })),
31580
- reason: `${reasonPrefix} ${files.map((f) => path63.basename(f)).join(", ")}`
31529
+ reason: `${reasonPrefix} ${files.map((f) => path62.basename(f)).join(", ")}`
31581
31530
  };
31582
31531
  }
31583
31532
 
31584
31533
  // src/commands/refactor/restructure/planRestructure/isTestFile.ts
31585
- import path64 from "path";
31534
+ import path63 from "path";
31586
31535
  var TEST_SUFFIX = /\.test\.tsx?$/;
31587
31536
  function isTestFile(file) {
31588
31537
  return TEST_SUFFIX.test(file);
31589
31538
  }
31590
31539
  function testStem(file) {
31591
- return path64.basename(file).replace(TEST_SUFFIX, "");
31540
+ return path63.basename(file).replace(TEST_SUFFIX, "");
31592
31541
  }
31593
31542
 
31594
31543
  // src/commands/refactor/restructure/planRestructure/moduleStem.ts
31595
- import path65 from "path";
31544
+ import path64 from "path";
31596
31545
  function moduleStem(file) {
31597
- return path65.basename(file).replace(/\.tsx?$/, "");
31546
+ return path64.basename(file).replace(/\.tsx?$/, "");
31598
31547
  }
31599
31548
 
31600
31549
  // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
@@ -31644,16 +31593,16 @@ function collectAnchors(files, index3, pinned) {
31644
31593
  }
31645
31594
 
31646
31595
  // src/commands/refactor/restructure/planRestructure/findCollisions.ts
31647
- import path66 from "path";
31596
+ import path65 from "path";
31648
31597
  function findCollisions(targets, scopeRoot) {
31649
31598
  const byModule = /* @__PURE__ */ new Map();
31650
31599
  for (const [file, target] of targets) {
31651
- const key = path66.join(path66.dirname(target), moduleStem(target));
31600
+ const key = path65.join(path65.dirname(target), moduleStem(target));
31652
31601
  byModule.set(key, [...byModule.get(key) ?? [], file]);
31653
31602
  }
31654
31603
  return [...byModule].filter(([, files]) => files.length > 1).map(([key, files]) => {
31655
- const where = path66.relative(scopeRoot, path66.dirname(key)) || ".";
31656
- const sources = files.sort().map((f) => path66.relative(scopeRoot, f));
31604
+ const where = path65.relative(scopeRoot, path65.dirname(key)) || ".";
31605
+ const sources = files.sort().map((f) => path65.relative(scopeRoot, f));
31657
31606
  return `Basename collision in ${where}/: ${sources.join(", ")}`;
31658
31607
  }).sort();
31659
31608
  }
@@ -31685,38 +31634,38 @@ function indexEdges(scope, edges) {
31685
31634
  }
31686
31635
 
31687
31636
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31688
- import path70 from "path";
31637
+ import path69 from "path";
31689
31638
 
31690
31639
  // src/commands/refactor/restructure/planRestructure/componentDir.ts
31691
- import path69 from "path";
31640
+ import path68 from "path";
31692
31641
 
31693
31642
  // src/commands/refactor/restructure/planRestructure/liftToPinFolder.ts
31694
- import path67 from "path";
31643
+ import path66 from "path";
31695
31644
  function liftToPinFolder(dir, pinFolders, scopeRoot) {
31696
31645
  let lifted = scopeRoot;
31697
31646
  for (const folder of pinFolders)
31698
- if ((dir === folder || dir.startsWith(folder + path67.sep)) && folder.length > lifted.length)
31647
+ if ((dir === folder || dir.startsWith(folder + path66.sep)) && folder.length > lifted.length)
31699
31648
  lifted = folder;
31700
31649
  return lifted;
31701
31650
  }
31702
31651
 
31703
31652
  // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
31704
- import path68 from "path";
31653
+ import path67 from "path";
31705
31654
  function lowestCommonAncestor(dirs) {
31706
- const [first, ...rest] = dirs.map((d) => d.split(path68.sep));
31655
+ const [first, ...rest] = dirs.map((d) => d.split(path67.sep));
31707
31656
  let common = first;
31708
31657
  for (const parts of rest) {
31709
31658
  let i = 0;
31710
31659
  while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
31711
31660
  common = common.slice(0, i);
31712
31661
  }
31713
- return common.join(path68.sep) || path68.sep;
31662
+ return common.join(path67.sep) || path67.sep;
31714
31663
  }
31715
31664
 
31716
31665
  // src/commands/refactor/restructure/planRestructure/componentDir.ts
31717
31666
  function anchorFolder(anchor, dirs) {
31718
31667
  const dir = dirs.get(anchor.file);
31719
- return anchor.mode === "child" ? path69.join(dir, moduleStem(anchor.file)) : dir;
31668
+ return anchor.mode === "child" ? path68.join(dir, moduleStem(anchor.file)) : dir;
31720
31669
  }
31721
31670
  function externalAnchors(component, anchorings) {
31722
31671
  const members = new Set(component);
@@ -31798,7 +31747,7 @@ function isPinFolderOwner(anchoring) {
31798
31747
  }
31799
31748
  function componentReason(file, component, base) {
31800
31749
  if (component.length === 1) return base;
31801
- const others = component.filter((f) => f !== file).map((f) => path70.basename(f));
31750
+ const others = component.filter((f) => f !== file).map((f) => path69.basename(f));
31802
31751
  return `${base}; cycle with ${others.join(", ")}`;
31803
31752
  }
31804
31753
  function placeComponents(files, anchorings, scopeRoot) {
@@ -31811,7 +31760,7 @@ function placeComponents(files, anchorings, scopeRoot) {
31811
31760
  const anchoring = anchorings.get(file);
31812
31761
  layout.dirs.set(file, dir);
31813
31762
  if (isPinFolderOwner(anchoring))
31814
- layout.pinFolders.add(path70.join(dir, moduleStem(file)));
31763
+ layout.pinFolders.add(path69.join(dir, moduleStem(file)));
31815
31764
  placements.set(file, {
31816
31765
  dir,
31817
31766
  reason: componentReason(file, component, anchoring.reason)
@@ -31823,7 +31772,7 @@ function placeComponents(files, anchorings, scopeRoot) {
31823
31772
 
31824
31773
  // src/commands/refactor/restructure/planRestructure.ts
31825
31774
  function planRestructure(input) {
31826
- const scopeRoot = path71.resolve(input.scopeRoot);
31775
+ const scopeRoot = path70.resolve(input.scopeRoot);
31827
31776
  const files = [...new Set(input.files)].sort();
31828
31777
  const index3 = indexEdges(new Set(files), input.edges);
31829
31778
  const anchorings = collectAnchors(files, index3, new Set(input.pinnedModules));
@@ -31832,7 +31781,7 @@ function planRestructure(input) {
31832
31781
  const moves = [];
31833
31782
  for (const file of files) {
31834
31783
  const { dir, reason: reason4 } = placements.get(file);
31835
- const to = path71.join(dir, path71.basename(file));
31784
+ const to = path70.join(dir, path70.basename(file));
31836
31785
  targets.set(file, to);
31837
31786
  if (to !== file) moves.push({ from: file, to, reason: reason4 });
31838
31787
  }
@@ -31841,14 +31790,14 @@ function planRestructure(input) {
31841
31790
 
31842
31791
  // src/commands/refactor/restructure/buildPlan.ts
31843
31792
  function moduleKey(file) {
31844
- return path72.join(path72.dirname(file), moduleStem(file));
31793
+ return path71.join(path71.dirname(file), moduleStem(file));
31845
31794
  }
31846
31795
  function findIgnoredOccupants(moves, ignored, scopeRoot) {
31847
31796
  const occupants = new Map(ignored.map((f) => [moduleKey(f), f]));
31848
31797
  return moves.flatMap((move2) => {
31849
31798
  const occupant = occupants.get(moduleKey(move2.to));
31850
31799
  if (!occupant) return [];
31851
- const rel = (f) => path72.relative(scopeRoot, f);
31800
+ const rel = (f) => path71.relative(scopeRoot, f);
31852
31801
  return [
31853
31802
  `Target of ${rel(move2.from)} is occupied by ignored file ${rel(occupant)}`
31854
31803
  ];
@@ -31879,20 +31828,43 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
31879
31828
  }
31880
31829
 
31881
31830
  // src/commands/refactor/restructure/checkPlan.ts
31882
- import path74 from "path";
31883
- import chalk219 from "chalk";
31831
+ import chalk218 from "chalk";
31884
31832
 
31885
- // src/commands/refactor/restructure/displayDeepChains.ts
31833
+ // src/commands/refactor/restructure/applyCommand.ts
31834
+ import path72 from "path";
31835
+ function applyCommand(scopeRoot) {
31836
+ const root2 = path72.relative(process.cwd(), scopeRoot) || ".";
31837
+ return `assist refactor restructure ${root2} --apply`;
31838
+ }
31839
+
31840
+ // src/commands/refactor/restructure/displayDrift.ts
31841
+ import path73 from "path";
31842
+ import chalk215 from "chalk";
31843
+ var shownMoves = 20;
31844
+ function displayDrift(plan2, listMoves) {
31845
+ const rel = (file) => path73.relative(process.cwd(), file);
31846
+ if (plan2.moves.length > 0) {
31847
+ console.log(
31848
+ chalk215.red(
31849
+ `${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
31850
+ )
31851
+ );
31852
+ if (listMoves) {
31853
+ for (const move2 of plan2.moves.slice(0, shownMoves))
31854
+ console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
31855
+ if (plan2.moves.length > shownMoves)
31856
+ console.log(chalk215.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
31857
+ }
31858
+ }
31859
+ for (const error of plan2.errors) console.log(chalk215.red(error));
31860
+ }
31861
+
31862
+ // src/commands/refactor/restructure/displayLayoutLimits.ts
31886
31863
  import chalk217 from "chalk";
31864
+
31865
+ // src/commands/refactor/restructure/displayDeepChains.ts
31866
+ import chalk216 from "chalk";
31887
31867
  var shownChains = 10;
31888
- var pinGuidance = [
31889
- "To bring the plan within the limit, add modules to restructure.pin in assist.yml (basename without extension). A pinned module moves up beside the nearest root or pinned module above it, taking its subtree with it.",
31890
- "- On each chain, pin the highest module that is a feature boundary: a route, view, page, panel, dialog or card a user would recognise as one thing.",
31891
- "- Never pin hooks, utilities, style files or helpers just because they head a big subtree; they move up with their feature.",
31892
- "- Add one pin at a time and re-run the dry-run: one feature pin often fixes several chains.",
31893
- "- After each pin, check the resulting tree for a folder that has grown large with files shared between pinned features; if one has, pin the feature those files belong to or undo the last pin.",
31894
- "- If no module on a chain is a sensible feature boundary, leave it and report the chain instead of forcing a pin."
31895
- ];
31896
31868
  function formatChain(chain2) {
31897
31869
  const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
31898
31870
  return ` ${folders} > \u2026 [${chain2.tooDeep} file(s) too deep, down to depth ${chain2.deepest}]`;
@@ -31901,88 +31873,232 @@ function displayDeepChains(chains, maxDepth) {
31901
31873
  if (chains.length === 0) return;
31902
31874
  const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
31903
31875
  console.log(
31904
- chalk217.red(
31876
+ chalk216.red(
31905
31877
  `
31906
31878
  Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
31907
31879
  )
31908
31880
  );
31909
31881
  console.log(
31910
- chalk217.bold(
31882
+ chalk216.bold(
31911
31883
  "Deep chains, as folder (files beneath), most files too deep first:"
31912
31884
  )
31913
31885
  );
31914
31886
  for (const chain2 of chains.slice(0, shownChains))
31915
31887
  console.log(formatChain(chain2));
31916
31888
  if (chains.length > shownChains)
31917
- console.log(chalk217.dim(` \u2026and ${chains.length - shownChains} more`));
31889
+ console.log(chalk216.dim(` \u2026and ${chains.length - shownChains} more`));
31890
+ }
31891
+
31892
+ // src/commands/refactor/restructure/displayLayoutLimits.ts
31893
+ function pinSteps(apply) {
31894
+ return [
31895
+ "Adjust restructure.pin until this check passes:",
31896
+ "1. For a deep chain, pick the highest module on it that is a feature boundary: a route, view, page, panel, dialog or card. Never a hook, utility, style file or helper.",
31897
+ "2. Add it to restructure.pin in assist.yml yourself (basename without extension). One pin at a time: one feature pin often fixes several chains.",
31898
+ "3. For a folder over the file limit, a pin has lifted features beside each other and pushed the files they share into it. Remove the pin you added most recently, or replace it with a different boundary on the same chain.",
31899
+ "4. Re-run this command. Repeat until there are no deep chains and no folders over the limit.",
31900
+ "5. If a chain has no sensible feature boundary, or every pin that fixes the depth pushes a folder over the limit, stop and report it.",
31901
+ `Then run \`${apply}\`.`
31902
+ ];
31903
+ }
31904
+ function displayLargeFolders(folders, limit) {
31905
+ if (folders.length === 0) return;
31906
+ console.log(
31907
+ chalk217.red(
31908
+ `
31909
+ Plan puts more than ${limit} file(s) in ${folders.length} folder(s) (restructure.maxFolderPercent of all files, capped at restructure.maxFolderFiles):`
31910
+ )
31911
+ );
31912
+ for (const { folder, files } of folders)
31913
+ console.log(` ${folder}/ ${files} file(s)`);
31914
+ }
31915
+ function exceedsLayoutLimits(limits) {
31916
+ return limits.chains.length > 0 || limits.largeFolders.length > 0;
31917
+ }
31918
+ function displayLayoutLimits(limits, apply) {
31919
+ if (!exceedsLayoutLimits(limits)) return;
31920
+ displayDeepChains(limits.chains, limits.maxDepth);
31921
+ displayLargeFolders(limits.largeFolders, limits.folderLimit);
31918
31922
  console.log("");
31919
- for (const line of pinGuidance) console.log(chalk217.yellow(line));
31923
+ for (const line of pinSteps(apply)) console.log(chalk217.yellow(line));
31920
31924
  }
31921
31925
 
31922
- // src/commands/refactor/restructure/displayDrift.ts
31923
- import path73 from "path";
31924
- import chalk218 from "chalk";
31925
- var shownMoves = 20;
31926
- function displayDrift(plan2, listMoves) {
31927
- const rel = (file) => path73.relative(process.cwd(), file);
31926
+ // src/commands/refactor/restructure/checkPlan.ts
31927
+ function checkPlan(plan2, limits) {
31928
+ const apply = applyCommand(plan2.scopeRoot);
31929
+ const exceeds = exceedsLayoutLimits(limits);
31930
+ displayDrift(plan2, !exceeds);
31931
+ displayLayoutLimits(limits, apply);
31932
+ if (exceeds || plan2.errors.length > 0) process.exit(1);
31928
31933
  if (plan2.moves.length > 0) {
31929
31934
  console.log(
31930
- chalk218.red(
31931
- `${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
31935
+ chalk218.yellow(
31936
+ `
31937
+ Run \`${apply}\` to move the files and rewrite their imports.`
31932
31938
  )
31933
31939
  );
31934
- if (listMoves) {
31935
- for (const move2 of plan2.moves.slice(0, shownMoves))
31936
- console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
31937
- if (plan2.moves.length > shownMoves)
31938
- console.log(chalk218.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
31940
+ process.exit(1);
31941
+ }
31942
+ console.log(chalk218.green("Layout matches the restructure plan"));
31943
+ }
31944
+
31945
+ // src/commands/refactor/restructure/findDeepChains.ts
31946
+ import path74 from "path";
31947
+ function dirSegments(target, scopeRoot) {
31948
+ const dir = path74.relative(scopeRoot, path74.dirname(target));
31949
+ return dir === "" ? [] : dir.split(path74.sep);
31950
+ }
31951
+ function countSubtrees(segmentLists) {
31952
+ const counts2 = /* @__PURE__ */ new Map();
31953
+ for (const segments of segmentLists)
31954
+ for (let i = 1; i <= segments.length; i++) {
31955
+ const key = segments.slice(0, i).join("/");
31956
+ counts2.set(key, (counts2.get(key) ?? 0) + 1);
31939
31957
  }
31958
+ return counts2;
31959
+ }
31960
+ function findDeepChains(targets, scopeRoot, maxDepth) {
31961
+ const segmentLists = [...targets].map((t) => dirSegments(t, scopeRoot));
31962
+ const subtreeFiles = countSubtrees(segmentLists);
31963
+ const chains = /* @__PURE__ */ new Map();
31964
+ for (const segments of segmentLists) {
31965
+ if (segments.length <= maxDepth) continue;
31966
+ const head = segments.slice(0, maxDepth + 1);
31967
+ const key = head.join("/");
31968
+ const chain2 = chains.get(key) ?? {
31969
+ folders: head.map((name, i) => ({
31970
+ name,
31971
+ files: subtreeFiles.get(head.slice(0, i + 1).join("/")) ?? 0
31972
+ })),
31973
+ tooDeep: 0,
31974
+ deepest: 0
31975
+ };
31976
+ chain2.tooDeep += 1;
31977
+ chain2.deepest = Math.max(chain2.deepest, segments.length);
31978
+ chains.set(key, chain2);
31940
31979
  }
31941
- for (const error of plan2.errors) console.log(chalk218.red(error));
31980
+ return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
31942
31981
  }
31943
31982
 
31944
- // src/commands/refactor/restructure/checkPlan.ts
31945
- function applyCommand(plan2) {
31946
- const root2 = path74.relative(process.cwd(), plan2.scopeRoot) || ".";
31947
- return `assist refactor restructure ${root2} --apply`;
31983
+ // src/commands/refactor/restructure/findLargeFolders.ts
31984
+ import path75 from "path";
31985
+ function findLargeFolders(targets, scopeRoot, limit) {
31986
+ const counts2 = /* @__PURE__ */ new Map();
31987
+ for (const target of targets) {
31988
+ const folder = path75.relative(scopeRoot, path75.dirname(target));
31989
+ if (folder !== "") counts2.set(folder, (counts2.get(folder) ?? 0) + 1);
31990
+ }
31991
+ return [...counts2].filter(([, files]) => files > limit).sort(([a, fa], [b, fb]) => fb - fa || a.localeCompare(b)).map(([folder, files]) => ({
31992
+ folder: folder.split(path75.sep).join("/"),
31993
+ files
31994
+ }));
31995
+ }
31996
+
31997
+ // src/commands/refactor/restructure/checkLayoutLimits.ts
31998
+ function checkLayoutLimits(plan2, settings) {
31999
+ const targets = [...plan2.targets.values()];
32000
+ const folderLimit = Math.min(
32001
+ Math.ceil(targets.length * settings.maxFolderPercent / 100),
32002
+ settings.maxFolderFiles
32003
+ );
32004
+ return {
32005
+ maxDepth: settings.maxDepth,
32006
+ chains: findDeepChains(targets, plan2.scopeRoot, settings.maxDepth),
32007
+ folderLimit,
32008
+ largeFolders: findLargeFolders(targets, plan2.scopeRoot, folderLimit)
32009
+ };
32010
+ }
32011
+
32012
+ // src/commands/refactor/restructure/partitionIgnored.ts
32013
+ import path76 from "path";
32014
+ import { minimatch as minimatch4 } from "minimatch";
32015
+ function partitionIgnored(files) {
32016
+ const globs = loadConfig().restructure?.ignore ?? [];
32017
+ const isIgnored = (file) => globs.some((glob) => minimatch4(path76.relative(process.cwd(), file), glob));
32018
+ return {
32019
+ scoped: files.filter((f) => !isIgnored(f)),
32020
+ ignored: files.filter(isIgnored)
32021
+ };
31948
32022
  }
31949
- function checkPlan(plan2, chains, maxDepth) {
31950
- displayDrift(plan2, chains.length === 0);
31951
- displayDeepChains(chains, maxDepth);
31952
- if (chains.length > 0) {
32023
+
32024
+ // src/commands/refactor/restructure/runPlan.ts
32025
+ import chalk222 from "chalk";
32026
+
32027
+ // src/commands/refactor/restructure/applyPlan.ts
32028
+ import chalk220 from "chalk";
32029
+
32030
+ // src/commands/refactor/restructure/executePlan.ts
32031
+ import fs37 from "fs";
32032
+ import path77 from "path";
32033
+ import chalk219 from "chalk";
32034
+ function relPath(file) {
32035
+ return path77.relative(process.cwd(), file);
32036
+ }
32037
+ function stagingPath(move2, index3) {
32038
+ return `${move2.from}.restructure-${process.pid}-${index3}`;
32039
+ }
32040
+ function moveFiles(moves) {
32041
+ const staged = moves.map((move2, i) => {
32042
+ const staging = stagingPath(move2, i);
32043
+ fs37.renameSync(move2.from, staging);
32044
+ return { move: move2, staging };
32045
+ });
32046
+ for (const { move: move2, staging } of staged) {
32047
+ fs37.mkdirSync(path77.dirname(move2.to), { recursive: true });
32048
+ fs37.renameSync(staging, move2.to);
31953
32049
  console.log(
31954
- chalk219.yellow(
31955
- `
31956
- Once the plan is within the limit, run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
31957
- )
32050
+ chalk219.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
31958
32051
  );
31959
- process.exit(1);
31960
32052
  }
31961
- if (plan2.errors.length > 0) process.exit(1);
31962
- if (plan2.moves.length > 0) {
31963
- console.log(
31964
- chalk219.yellow(
31965
- `
31966
- Run \`${applyCommand(plan2)}\` to move the files and rewrite their imports.`
31967
- )
31968
- );
32053
+ }
32054
+ function removeIfEmpty(dir) {
32055
+ if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
32056
+ fs37.rmdirSync(dir);
32057
+ console.log(chalk219.dim(` Removed empty directory ${relPath(dir)}`));
32058
+ return true;
32059
+ }
32060
+ function removeEmptyDirectories(dirs, scopeRoot) {
32061
+ const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
32062
+ for (let dir of deepestFirst) {
32063
+ while (dir.startsWith(`${scopeRoot}${path77.sep}`) && removeIfEmpty(dir))
32064
+ dir = path77.dirname(dir);
32065
+ }
32066
+ }
32067
+ function executePlan(plan2) {
32068
+ for (const [file, content] of applyRewrites(plan2.rewrites)) {
32069
+ fs37.writeFileSync(file, content, "utf8");
32070
+ console.log(chalk219.cyan(` Rewrote imports in ${relPath(file)}`));
32071
+ }
32072
+ moveFiles(plan2.moves);
32073
+ removeEmptyDirectories(
32074
+ plan2.moves.map((m) => path77.dirname(m.from)),
32075
+ plan2.scopeRoot
32076
+ );
32077
+ }
32078
+
32079
+ // src/commands/refactor/restructure/applyPlan.ts
32080
+ function applyPlan(plan2) {
32081
+ if (plan2.errors.length > 0) {
32082
+ console.log(chalk220.red("\nResolve the errors above before applying."));
31969
32083
  process.exit(1);
31970
32084
  }
31971
- console.log(chalk219.green("Layout matches the restructure plan"));
32085
+ console.log(chalk220.bold("\nApplying changes..."));
32086
+ executePlan(plan2);
32087
+ console.log(chalk220.green("\nRestructuring complete"));
31972
32088
  }
31973
32089
 
31974
32090
  // src/commands/refactor/restructure/displayPlan.ts
31975
- import path77 from "path";
31976
- import chalk220 from "chalk";
32091
+ import path80 from "path";
32092
+ import chalk221 from "chalk";
31977
32093
 
31978
32094
  // src/commands/refactor/restructure/computeDepthStats.ts
31979
- import path75 from "path";
32095
+ import path78 from "path";
31980
32096
  function computeDepthStats(targets, scopeRoot) {
31981
32097
  const distribution = /* @__PURE__ */ new Map();
31982
32098
  let max = 0;
31983
32099
  for (const target of targets) {
31984
- const dir = path75.relative(scopeRoot, path75.dirname(target));
31985
- const depth = dir === "" ? 0 : dir.split(path75.sep).length;
32100
+ const dir = path78.relative(scopeRoot, path78.dirname(target));
32101
+ const depth = dir === "" ? 0 : dir.split(path78.sep).length;
31986
32102
  distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
31987
32103
  max = Math.max(max, depth);
31988
32104
  }
@@ -31990,7 +32106,7 @@ function computeDepthStats(targets, scopeRoot) {
31990
32106
  }
31991
32107
 
31992
32108
  // src/commands/refactor/restructure/formatTree.ts
31993
- import path76 from "path";
32109
+ import path79 from "path";
31994
32110
  function insert(root2, parts) {
31995
32111
  let node = root2;
31996
32112
  for (const part of parts) {
@@ -32012,7 +32128,7 @@ function render(node, indent3, lines2) {
32012
32128
  function formatTree(files, scopeRoot) {
32013
32129
  const root2 = /* @__PURE__ */ new Map();
32014
32130
  for (const file of files)
32015
- insert(root2, path76.relative(scopeRoot, file).split(path76.sep));
32131
+ insert(root2, path79.relative(scopeRoot, file).split(path79.sep));
32016
32132
  const lines2 = [];
32017
32133
  render(root2, "", lines2);
32018
32134
  return lines2;
@@ -32020,21 +32136,21 @@ function formatTree(files, scopeRoot) {
32020
32136
 
32021
32137
  // src/commands/refactor/restructure/displayPlan.ts
32022
32138
  function relPath2(filePath) {
32023
- return path77.relative(process.cwd(), filePath);
32139
+ return path80.relative(process.cwd(), filePath);
32024
32140
  }
32025
32141
  function displayMoves(plan2) {
32026
32142
  if (plan2.moves.length === 0) return;
32027
- console.log(chalk220.bold("\nFile moves:"));
32143
+ console.log(chalk221.bold("\nFile moves:"));
32028
32144
  for (const move2 of plan2.moves) {
32029
32145
  console.log(
32030
- ` ${chalk220.red(relPath2(move2.from))} \u2192 ${chalk220.green(relPath2(move2.to))}`
32146
+ ` ${chalk221.red(relPath2(move2.from))} \u2192 ${chalk221.green(relPath2(move2.to))}`
32031
32147
  );
32032
- console.log(chalk220.dim(` ${move2.reason}`));
32148
+ console.log(chalk221.dim(` ${move2.reason}`));
32033
32149
  }
32034
32150
  }
32035
32151
  function displayTree(plan2) {
32036
32152
  console.log(
32037
- chalk220.bold(`
32153
+ chalk221.bold(`
32038
32154
  Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
32039
32155
  );
32040
32156
  for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
@@ -32045,15 +32161,15 @@ function displayDepthStats(plan2) {
32045
32161
  plan2.targets.values(),
32046
32162
  plan2.scopeRoot
32047
32163
  );
32048
- console.log(chalk220.bold(`
32164
+ console.log(chalk221.bold(`
32049
32165
  Depth (max ${max}):`));
32050
32166
  for (const depth of [...distribution.keys()].sort((a, b) => a - b))
32051
32167
  console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
32052
32168
  }
32053
32169
  function displayErrors(errors) {
32054
32170
  if (errors.length === 0) return;
32055
- console.log(chalk220.red("\nErrors:"));
32056
- for (const error of errors) console.log(chalk220.red(` ${error}`));
32171
+ console.log(chalk221.red("\nErrors:"));
32172
+ for (const error of errors) console.log(chalk221.red(` ${error}`));
32057
32173
  }
32058
32174
  function displayPlan2(plan2) {
32059
32175
  displayMoves(plan2);
@@ -32062,92 +32178,56 @@ function displayPlan2(plan2) {
32062
32178
  displayErrors(plan2.errors);
32063
32179
  const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
32064
32180
  console.log(
32065
- chalk220.dim(
32181
+ chalk221.dim(
32066
32182
  `
32067
32183
  Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
32068
32184
  )
32069
32185
  );
32070
32186
  }
32071
32187
 
32072
- // src/commands/refactor/restructure/findDeepChains.ts
32073
- import path78 from "path";
32074
- function dirSegments(target, scopeRoot) {
32075
- const dir = path78.relative(scopeRoot, path78.dirname(target));
32076
- return dir === "" ? [] : dir.split(path78.sep);
32077
- }
32078
- function countSubtrees(segmentLists) {
32079
- const counts2 = /* @__PURE__ */ new Map();
32080
- for (const segments of segmentLists)
32081
- for (let i = 1; i <= segments.length; i++) {
32082
- const key = segments.slice(0, i).join("/");
32083
- counts2.set(key, (counts2.get(key) ?? 0) + 1);
32084
- }
32085
- return counts2;
32086
- }
32087
- function findDeepChains(targets, scopeRoot, maxDepth) {
32088
- const segmentLists = [...targets].map((t) => dirSegments(t, scopeRoot));
32089
- const subtreeFiles = countSubtrees(segmentLists);
32090
- const chains = /* @__PURE__ */ new Map();
32091
- for (const segments of segmentLists) {
32092
- if (segments.length <= maxDepth) continue;
32093
- const head = segments.slice(0, maxDepth + 1);
32094
- const key = head.join("/");
32095
- const chain2 = chains.get(key) ?? {
32096
- folders: head.map((name, i) => ({
32097
- name,
32098
- files: subtreeFiles.get(head.slice(0, i + 1).join("/")) ?? 0
32099
- })),
32100
- tooDeep: 0,
32101
- deepest: 0
32102
- };
32103
- chain2.tooDeep += 1;
32104
- chain2.deepest = Math.max(chain2.deepest, segments.length);
32105
- chains.set(key, chain2);
32188
+ // src/commands/refactor/restructure/runPlan.ts
32189
+ function runPlan(plan2, limits, apply) {
32190
+ displayPlan2(plan2);
32191
+ displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
32192
+ if (plan2.moves.length === 0 && plan2.errors.length === 0) {
32193
+ console.log(chalk222.green("No restructuring needed"));
32194
+ return;
32106
32195
  }
32107
- return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
32108
- }
32109
-
32110
- // src/commands/refactor/restructure/partitionIgnored.ts
32111
- import path79 from "path";
32112
- import { minimatch as minimatch4 } from "minimatch";
32113
- function partitionIgnored(files) {
32114
- const globs = loadConfig().restructure?.ignore ?? [];
32115
- const isIgnored = (file) => globs.some((glob) => minimatch4(path79.relative(process.cwd(), file), glob));
32116
- return {
32117
- scoped: files.filter((f) => !isIgnored(f)),
32118
- ignored: files.filter(isIgnored)
32119
- };
32196
+ if (!apply) {
32197
+ console.log(chalk222.dim("\nDry run. Use --apply to execute."));
32198
+ return;
32199
+ }
32200
+ applyPlan(plan2);
32120
32201
  }
32121
32202
 
32122
32203
  // src/commands/refactor/restructure.ts
32123
32204
  async function restructure(root2, options2 = {}) {
32124
- const scopeRoot = path80.resolve(root2 ?? "src");
32205
+ const scopeRoot = path81.resolve(root2 ?? "src");
32125
32206
  if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
32126
- console.log(chalk221.red(`Not a directory: ${root2 ?? "src"}`));
32207
+ console.log(chalk223.red(`Not a directory: ${root2 ?? "src"}`));
32127
32208
  process.exit(1);
32128
32209
  }
32129
32210
  const found = [];
32130
32211
  walkSourceFiles(scopeRoot, found);
32131
32212
  const { scoped, ignored } = partitionIgnored(found);
32132
32213
  if (scoped.length === 0) {
32133
- console.log(chalk221.yellow("No files found under root"));
32214
+ console.log(chalk223.yellow("No files found under root"));
32134
32215
  return;
32135
32216
  }
32136
- const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
32217
+ const {
32218
+ pin: pin2 = [],
32219
+ maxDepth = 10,
32220
+ maxFolderPercent = 15,
32221
+ maxFolderFiles = 150
32222
+ } = loadConfig().restructure ?? {};
32137
32223
  const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
32138
- const chains = findDeepChains(plan2.targets.values(), scopeRoot, maxDepth);
32139
- if (options2.check) return checkPlan(plan2, chains, maxDepth);
32140
- displayPlan2(plan2);
32141
- displayDeepChains(chains, maxDepth);
32142
- if (plan2.moves.length === 0 && plan2.errors.length === 0) {
32143
- console.log(chalk221.green("No restructuring needed"));
32144
- return;
32145
- }
32146
- if (!options2.apply) {
32147
- console.log(chalk221.dim("\nDry run. Use --apply to execute."));
32148
- return;
32149
- }
32150
- applyPlan(plan2);
32224
+ const limits = checkLayoutLimits(plan2, {
32225
+ maxDepth,
32226
+ maxFolderPercent,
32227
+ maxFolderFiles
32228
+ });
32229
+ if (options2.check) return checkPlan(plan2, limits);
32230
+ runPlan(plan2, limits, options2.apply === true);
32151
32231
  }
32152
32232
 
32153
32233
  // src/commands/registerRefactor.ts
@@ -32202,7 +32282,7 @@ async function checkoutOnlySession(number) {
32202
32282
  }
32203
32283
 
32204
32284
  // src/commands/review/highLevel/configureHighLevelReview.ts
32205
- import chalk225 from "chalk";
32285
+ import chalk227 from "chalk";
32206
32286
 
32207
32287
  // src/commands/config/promptConfigScope.ts
32208
32288
  import Enquirer3 from "enquirer";
@@ -32228,7 +32308,7 @@ async function promptConfigScope() {
32228
32308
  }
32229
32309
 
32230
32310
  // src/commands/config/resolveConfigKeyAnswer.ts
32231
- import chalk222 from "chalk";
32311
+ import chalk224 from "chalk";
32232
32312
  async function resolveConfigKeyAnswer(question, supplied) {
32233
32313
  if (supplied !== void 0) return coerceSupplied(question.key, supplied);
32234
32314
  for (; ; ) {
@@ -32236,7 +32316,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
32236
32316
  if (answer === "") return void 0;
32237
32317
  const coercion = coerceCliConfigValue(question.key, answer);
32238
32318
  if (coercion.ok) return coercion.value;
32239
- console.error(chalk222.red(coercion.error));
32319
+ console.error(chalk224.red(coercion.error));
32240
32320
  }
32241
32321
  }
32242
32322
  function coerceSupplied(key, supplied) {
@@ -32297,7 +32377,7 @@ function suggestGlobs(current, proposed) {
32297
32377
  }
32298
32378
 
32299
32379
  // src/commands/review/highLevel/parseConfigureAnswers.ts
32300
- import chalk223 from "chalk";
32380
+ import chalk225 from "chalk";
32301
32381
  function parseConfigureAnswers(answers) {
32302
32382
  const known = Object.values(highLevelConfigKeys);
32303
32383
  const parsed = {};
@@ -32315,13 +32395,13 @@ function answersCoverEveryKey(answers) {
32315
32395
  return Object.values(highLevelConfigKeys).every((key) => key in answers);
32316
32396
  }
32317
32397
  function exitWith(message3) {
32318
- console.error(chalk223.red(`Error: ${message3}.`));
32398
+ console.error(chalk225.red(`Error: ${message3}.`));
32319
32399
  process.exit(1);
32320
32400
  }
32321
32401
 
32322
32402
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
32323
32403
  import { execFileSync as execFileSync20 } from "child_process";
32324
- import chalk224 from "chalk";
32404
+ import chalk226 from "chalk";
32325
32405
 
32326
32406
  // src/commands/review/highLevel/buildGlobProposalPrompt.ts
32327
32407
  function buildGlobProposalPrompt(tree) {
@@ -32414,12 +32494,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
32414
32494
  const tree = summariseRepoTree(cwd);
32415
32495
  if (tree === "") return NOTHING_PROPOSED;
32416
32496
  console.log(
32417
- chalk224.dim("Asking Claude to propose globs from the repo's own tree...")
32497
+ chalk226.dim("Asking Claude to propose globs from the repo's own tree...")
32418
32498
  );
32419
32499
  const output = askClaude(buildGlobProposalPrompt(tree), cwd);
32420
32500
  if (output === void 0) {
32421
32501
  console.log(
32422
- chalk224.yellow(
32502
+ chalk226.yellow(
32423
32503
  "Claude proposed nothing; answer each key from its current value."
32424
32504
  )
32425
32505
  );
@@ -32475,25 +32555,25 @@ function asConfigKeyScope(value) {
32475
32555
  function reportConfigured(result) {
32476
32556
  for (const write of result.written)
32477
32557
  console.log(
32478
- chalk225.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32558
+ chalk227.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32479
32559
  );
32480
- for (const key of result.skipped) console.log(chalk225.dim(`Left ${key} unset`));
32481
- console.log(chalk225.dim(`Written to ${result.target}`));
32560
+ for (const key of result.skipped) console.log(chalk227.dim(`Left ${key} unset`));
32561
+ console.log(chalk227.dim(`Written to ${result.target}`));
32482
32562
  }
32483
32563
 
32484
32564
  // src/commands/review/highLevel/announceSavedReview.ts
32485
- import chalk226 from "chalk";
32565
+ import chalk228 from "chalk";
32486
32566
  function announceSavedReview(subject, force) {
32487
32567
  const head = subject.headSha.slice(0, 7);
32488
32568
  if (subject.saved)
32489
32569
  console.log(
32490
- chalk226.dim(
32570
+ chalk228.dim(
32491
32571
  `Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
32492
32572
  )
32493
32573
  );
32494
32574
  else if (force)
32495
32575
  console.log(
32496
- chalk226.dim(
32576
+ chalk228.dim(
32497
32577
  `Discarding any review saved for ${head} and starting fresh (--force).`
32498
32578
  )
32499
32579
  );
@@ -32522,8 +32602,8 @@ function groupFilesByDirectory(files) {
32522
32602
  }
32523
32603
 
32524
32604
  // src/commands/review/highLevel/buildHighLevelTree.ts
32525
- function basename19(path106) {
32526
- return path106.slice(path106.lastIndexOf("/") + 1);
32605
+ function basename19(path107) {
32606
+ return path107.slice(path107.lastIndexOf("/") + 1);
32527
32607
  }
32528
32608
  function sum(nodes, key) {
32529
32609
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32546,19 +32626,19 @@ function nodesOf(at2, prefix2) {
32546
32626
  }
32547
32627
  function collapsedDirNode(name, at2, prefix2) {
32548
32628
  let label2 = name;
32549
- let path106 = prefix2 ? `${prefix2}/${name}` : name;
32629
+ let path107 = prefix2 ? `${prefix2}/${name}` : name;
32550
32630
  let node = at2;
32551
32631
  while (node.files.length === 0 && node.dirs.size === 1) {
32552
32632
  const [childName, child] = [...node.dirs][0];
32553
32633
  label2 = `${label2}/${childName}`;
32554
- path106 = `${path106}/${childName}`;
32634
+ path107 = `${path107}/${childName}`;
32555
32635
  node = child;
32556
32636
  }
32557
- const children = nodesOf(node, path106);
32637
+ const children = nodesOf(node, path107);
32558
32638
  return {
32559
32639
  kind: "dir",
32560
32640
  name: label2,
32561
- path: path106,
32641
+ path: path107,
32562
32642
  additions: sum(children, "additions"),
32563
32643
  deletions: sum(children, "deletions"),
32564
32644
  children
@@ -32816,8 +32896,8 @@ function toStatus(status3) {
32816
32896
  if (status3 === "removed") return "removed";
32817
32897
  return "modified";
32818
32898
  }
32819
- function diffUrl(repo, prNumber, path106) {
32820
- const anchor = createHash3("sha256").update(path106).digest("hex");
32899
+ function diffUrl(repo, prNumber, path107) {
32900
+ const anchor = createHash3("sha256").update(path107).digest("hex");
32821
32901
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32822
32902
  }
32823
32903
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32873,10 +32953,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32873
32953
 
32874
32954
  // src/commands/review/highLevel/loadHighLevelReview.ts
32875
32955
  function loadHighLevelReview(repo, headRef, headSha) {
32876
- const path106 = highLevelReviewPath(repo, headRef, headSha);
32877
- if (!existsSync64(path106)) return void 0;
32956
+ const path107 = highLevelReviewPath(repo, headRef, headSha);
32957
+ if (!existsSync64(path107)) return void 0;
32878
32958
  try {
32879
- return JSON.parse(readFileSync47(path106, "utf8"));
32959
+ return JSON.parse(readFileSync47(path107, "utf8"));
32880
32960
  } catch {
32881
32961
  return void 0;
32882
32962
  }
@@ -32887,8 +32967,8 @@ import { minimatch as minimatch7 } from "minimatch";
32887
32967
  function selectCriticalDiffs(files, criticalPaths) {
32888
32968
  if (criticalPaths.length === 0) return [];
32889
32969
  return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
32890
- ({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32891
- path: path106,
32970
+ ({ path: path107, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32971
+ path: path107,
32892
32972
  status: status3,
32893
32973
  additions,
32894
32974
  deletions,
@@ -33003,11 +33083,11 @@ function highLevelPreviewPayload(subject) {
33003
33083
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
33004
33084
  import { dirname as dirname36 } from "path";
33005
33085
  function saveHighLevelReview(record) {
33006
- const path106 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
33007
- mkdirSync22(dirname36(path106), { recursive: true });
33008
- writeFileSync39(path106, `${JSON.stringify(record, null, 2)}
33086
+ const path107 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
33087
+ mkdirSync22(dirname36(path107), { recursive: true });
33088
+ writeFileSync39(path107, `${JSON.stringify(record, null, 2)}
33009
33089
  `);
33010
- return path106;
33090
+ return path107;
33011
33091
  }
33012
33092
 
33013
33093
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -33026,63 +33106,63 @@ async function openHighLevelOverlay(sessionId, subject) {
33026
33106
  { rejectIsOutcome: true }
33027
33107
  );
33028
33108
  const record = buildHighLevelRecord(subject, decision);
33029
- const path106 = saveHighLevelReview(record);
33109
+ const path107 = saveHighLevelReview(record);
33030
33110
  console.log(`Verdict: ${record.verdict}`);
33031
- console.log(`Saved ${path106}`);
33111
+ console.log(`Saved ${path107}`);
33032
33112
  console.log("Nothing was posted to GitHub.");
33033
33113
  return record;
33034
33114
  }
33035
33115
 
33036
33116
  // src/commands/review/highLevel/printHighLevelChecklist.ts
33037
- import chalk230 from "chalk";
33117
+ import chalk232 from "chalk";
33038
33118
 
33039
33119
  // src/commands/review/highLevel/formatCriticalDiffs.ts
33040
- import chalk227 from "chalk";
33120
+ import chalk229 from "chalk";
33041
33121
  var PATCH_LINE_COLOURS = {
33042
- "+": chalk227.green,
33043
- "-": chalk227.red,
33044
- "@": chalk227.cyan
33122
+ "+": chalk229.green,
33123
+ "-": chalk229.red,
33124
+ "@": chalk229.cyan
33045
33125
  };
33046
33126
  function formatPatch(patch2) {
33047
33127
  return patch2.split("\n").map(
33048
- (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk227.dim)(line)}`
33128
+ (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk229.dim)(line)}`
33049
33129
  );
33050
33130
  }
33051
33131
  function formatDiff(diff3) {
33052
33132
  return [
33053
33133
  "",
33054
- ` ${chalk227.bold(diff3.path)} ${chalk227.dim(`(${diff3.status})`)} ${chalk227.green(`+${diff3.additions}`)} ${chalk227.red(`-${diff3.deletions}`)}`,
33055
- ...diff3.patch === null ? [` ${chalk227.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33134
+ ` ${chalk229.bold(diff3.path)} ${chalk229.dim(`(${diff3.status})`)} ${chalk229.green(`+${diff3.additions}`)} ${chalk229.red(`-${diff3.deletions}`)}`,
33135
+ ...diff3.patch === null ? [` ${chalk229.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33056
33136
  ];
33057
33137
  }
33058
33138
  function formatCriticalDiffs(diffs, criticalPaths) {
33059
33139
  if (criticalPaths.length === 0)
33060
- return `${chalk227.bold.underline("Critical diffs")}
33061
- ${chalk227.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33140
+ return `${chalk229.bold.underline("Critical diffs")}
33141
+ ${chalk229.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33062
33142
  if (diffs.length === 0)
33063
- return `${chalk227.bold.underline("Critical diffs")}
33064
- ${chalk227.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33143
+ return `${chalk229.bold.underline("Critical diffs")}
33144
+ ${chalk229.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33065
33145
  return [
33066
- chalk227.bold.underline("Critical diffs"),
33146
+ chalk229.bold.underline("Critical diffs"),
33067
33147
  ...diffs.flatMap(formatDiff)
33068
33148
  ].join("\n");
33069
33149
  }
33070
33150
 
33071
33151
  // src/commands/review/highLevel/formatHighLevelChecklist.ts
33072
- import chalk228 from "chalk";
33152
+ import chalk230 from "chalk";
33073
33153
  var MARKERS = {
33074
- pass: () => chalk228.green("\u2714"),
33075
- fail: () => chalk228.red("\u2718"),
33076
- manual: () => chalk228.yellow("\u25A1")
33154
+ pass: () => chalk230.green("\u2714"),
33155
+ fail: () => chalk230.red("\u2718"),
33156
+ manual: () => chalk230.yellow("\u25A1")
33077
33157
  };
33078
33158
  function formatCheck(check2) {
33079
- const title = check2.status === "fail" ? chalk228.red(check2.title) : chalk228.bold(check2.title);
33159
+ const title = check2.status === "fail" ? chalk230.red(check2.title) : chalk230.bold(check2.title);
33080
33160
  return ` ${MARKERS[check2.status]()} ${title}
33081
- ${chalk228.dim(check2.reason)}`;
33161
+ ${chalk230.dim(check2.reason)}`;
33082
33162
  }
33083
33163
  function formatGroup(heading2, checks2) {
33084
33164
  if (checks2.length === 0) return [];
33085
- return ["", chalk228.bold.underline(heading2), ...checks2.map(formatCheck)];
33165
+ return ["", chalk230.bold.underline(heading2), ...checks2.map(formatCheck)];
33086
33166
  }
33087
33167
  function formatHighLevelChecklist(checks2) {
33088
33168
  const deterministic = checks2.filter(
@@ -33091,7 +33171,7 @@ function formatHighLevelChecklist(checks2) {
33091
33171
  const failed3 = deterministic.filter(
33092
33172
  (check2) => check2.status === "fail"
33093
33173
  ).length;
33094
- const summary = failed3 === 0 ? chalk228.green(`All ${deterministic.length} deterministic checks pass`) : chalk228.red(
33174
+ const summary = failed3 === 0 ? chalk230.green(`All ${deterministic.length} deterministic checks pass`) : chalk230.red(
33095
33175
  `${failed3} of ${deterministic.length} deterministic checks fail`
33096
33176
  );
33097
33177
  return [
@@ -33106,30 +33186,30 @@ function formatHighLevelChecklist(checks2) {
33106
33186
  }
33107
33187
 
33108
33188
  // src/commands/review/highLevel/formatHighLevelStructure.ts
33109
- import chalk229 from "chalk";
33189
+ import chalk231 from "chalk";
33110
33190
  var STATUS_MARKERS = {
33111
- added: () => chalk229.green("A"),
33112
- removed: () => chalk229.red("D"),
33113
- modified: () => chalk229.yellow("M")
33191
+ added: () => chalk231.green("A"),
33192
+ removed: () => chalk231.red("D"),
33193
+ modified: () => chalk231.yellow("M")
33114
33194
  };
33115
33195
  function counts(additions, deletions) {
33116
- return `${chalk229.green(`+${additions}`)} ${chalk229.red(`-${deletions}`)}`;
33196
+ return `${chalk231.green(`+${additions}`)} ${chalk231.red(`-${deletions}`)}`;
33117
33197
  }
33118
33198
  function formatNode(node, indent3) {
33119
33199
  if (node.kind === "file")
33120
33200
  return [
33121
- `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk229.dim(counts(node.additions, node.deletions))}`
33201
+ `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk231.dim(counts(node.additions, node.deletions))}`
33122
33202
  ];
33123
33203
  const dir = node;
33124
33204
  return [
33125
- `${indent3}${chalk229.bold(`${dir.name}/`)} ${chalk229.dim(counts(dir.additions, dir.deletions))}`,
33205
+ `${indent3}${chalk231.bold(`${dir.name}/`)} ${chalk231.dim(counts(dir.additions, dir.deletions))}`,
33126
33206
  ...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
33127
33207
  ];
33128
33208
  }
33129
33209
  function formatHighLevelStructure(structure) {
33130
33210
  const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
33131
33211
  return [
33132
- chalk229.bold.underline("Structure"),
33212
+ chalk231.bold.underline("Structure"),
33133
33213
  ` ${summary}`,
33134
33214
  ...structure.tree.flatMap((node) => formatNode(node, " "))
33135
33215
  ].join("\n");
@@ -33138,10 +33218,10 @@ function formatHighLevelStructure(structure) {
33138
33218
  // src/commands/review/highLevel/printHighLevelChecklist.ts
33139
33219
  function printHighLevelChecklist(subject) {
33140
33220
  console.log(
33141
- chalk230.bold(
33221
+ chalk232.bold(
33142
33222
  `High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
33143
33223
  ),
33144
- chalk230.dim(
33224
+ chalk232.dim(
33145
33225
  `\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
33146
33226
  )
33147
33227
  );
@@ -33153,12 +33233,12 @@ function printHighLevelChecklist(subject) {
33153
33233
  formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
33154
33234
  );
33155
33235
  console.log(
33156
- chalk230.dim(
33236
+ chalk232.dim(
33157
33237
  "\nManual items are for the reviewer to judge; see docs/high-level-review.md."
33158
33238
  )
33159
33239
  );
33160
33240
  console.log(
33161
- chalk230.dim(
33241
+ chalk232.dim(
33162
33242
  "Run this inside an assist session to step through the checklist in the web overlay."
33163
33243
  )
33164
33244
  );
@@ -33792,18 +33872,18 @@ function partitionFindingsByDiff(findings, index3) {
33792
33872
  }
33793
33873
 
33794
33874
  // src/commands/review/warnOutOfDiff.ts
33795
- import chalk231 from "chalk";
33875
+ import chalk233 from "chalk";
33796
33876
  function warnOutOfDiff(outOfDiff) {
33797
33877
  if (outOfDiff.length === 0) return;
33798
33878
  console.warn(
33799
- chalk231.yellow(
33879
+ chalk233.yellow(
33800
33880
  `Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
33801
33881
  )
33802
33882
  );
33803
33883
  for (const finding of outOfDiff) {
33804
33884
  const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
33805
33885
  console.warn(
33806
- ` ${chalk231.yellow("\xB7")} ${finding.title} ${chalk231.dim(
33886
+ ` ${chalk233.yellow("\xB7")} ${finding.title} ${chalk233.dim(
33807
33887
  `(${finding.file}:${range})`
33808
33888
  )}`
33809
33889
  );
@@ -33827,18 +33907,18 @@ function selectInDiffFindings(lineBound, prDiff) {
33827
33907
  }
33828
33908
 
33829
33909
  // src/commands/review/warnUnlocated.ts
33830
- import chalk232 from "chalk";
33910
+ import chalk234 from "chalk";
33831
33911
  function warnUnlocated(unlocated) {
33832
33912
  if (unlocated.length === 0) return;
33833
33913
  console.warn(
33834
- chalk232.yellow(
33914
+ chalk234.yellow(
33835
33915
  `Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
33836
33916
  )
33837
33917
  );
33838
33918
  for (const finding of unlocated) {
33839
- const where = finding.location || chalk232.dim("missing");
33919
+ const where = finding.location || chalk234.dim("missing");
33840
33920
  console.warn(
33841
- ` ${chalk232.yellow("\xB7")} ${finding.title} ${chalk232.dim(`(${where})`)}`
33921
+ ` ${chalk234.yellow("\xB7")} ${finding.title} ${chalk234.dim(`(${where})`)}`
33842
33922
  );
33843
33923
  }
33844
33924
  }
@@ -34043,8 +34123,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
34043
34123
  // src/commands/review/prepareReviewDir.ts
34044
34124
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
34045
34125
  function clearReviewFiles(paths) {
34046
- for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34047
- if (existsSync65(path106)) unlinkSync18(path106);
34126
+ for (const path107 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34127
+ if (existsSync65(path107)) unlinkSync18(path107);
34048
34128
  }
34049
34129
  }
34050
34130
  function prepareReviewDir(paths, requestBody, force) {
@@ -35282,8 +35362,8 @@ function registerReview(program2) {
35282
35362
 
35283
35363
  // src/commands/rules/addRule.ts
35284
35364
  import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
35285
- import path85 from "path";
35286
- import chalk233 from "chalk";
35365
+ import path86 from "path";
35366
+ import chalk235 from "chalk";
35287
35367
 
35288
35368
  // src/commands/rules/insertRuleBullet.ts
35289
35369
  function ruleBullet({ code, title, text: text18 }) {
@@ -35310,7 +35390,7 @@ import { readFileSync as readFileSync50 } from "fs";
35310
35390
 
35311
35391
  // src/commands/rules/findClaudeFiles.ts
35312
35392
  import { readdirSync as readdirSync13 } from "fs";
35313
- import path81 from "path";
35393
+ import path82 from "path";
35314
35394
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
35315
35395
  function findClaudeFiles(dir) {
35316
35396
  const results = [];
@@ -35318,9 +35398,9 @@ function findClaudeFiles(dir) {
35318
35398
  if (entry.isDirectory()) {
35319
35399
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
35320
35400
  continue;
35321
- results.push(...findClaudeFiles(path81.join(dir, entry.name)));
35401
+ results.push(...findClaudeFiles(path82.join(dir, entry.name)));
35322
35402
  } else if (entry.name === "CLAUDE.md") {
35323
- results.push(path81.join(dir, entry.name));
35403
+ results.push(path82.join(dir, entry.name));
35324
35404
  }
35325
35405
  }
35326
35406
  return results;
@@ -35339,34 +35419,34 @@ function nextRuleCode(root2) {
35339
35419
 
35340
35420
  // src/commands/rules/resolveRuleScope.ts
35341
35421
  import { existsSync as existsSync68 } from "fs";
35342
- import path82 from "path";
35422
+ import path83 from "path";
35343
35423
  function resolveRuleScope(target) {
35344
- const resolved = path82.resolve(target);
35345
- if (path82.basename(resolved) === "CLAUDE.md") return resolved;
35424
+ const resolved = path83.resolve(target);
35425
+ if (path83.basename(resolved) === "CLAUDE.md") return resolved;
35346
35426
  const startDir = scopeDirectory(resolved);
35347
35427
  const root2 = findRepoRoot(startDir) ?? startDir;
35348
35428
  let current = startDir;
35349
35429
  while (true) {
35350
- const candidate = path82.join(current, "CLAUDE.md");
35430
+ const candidate = path83.join(current, "CLAUDE.md");
35351
35431
  if (existsSync68(candidate)) return candidate;
35352
- if (current === root2 || current === path82.dirname(current)) break;
35353
- current = path82.dirname(current);
35432
+ if (current === root2 || current === path83.dirname(current)) break;
35433
+ current = path83.dirname(current);
35354
35434
  }
35355
- return path82.join(root2, "CLAUDE.md");
35435
+ return path83.join(root2, "CLAUDE.md");
35356
35436
  }
35357
35437
 
35358
35438
  // src/commands/rules/updateScopedRulesIndex.ts
35359
35439
  import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
35360
- import path84 from "path";
35440
+ import path85 from "path";
35361
35441
 
35362
35442
  // src/commands/rules/scopedRuleDirectories.ts
35363
35443
  import { readFileSync as readFileSync51 } from "fs";
35364
- import path83 from "path";
35444
+ import path84 from "path";
35365
35445
  function scopedRuleDirectories(root2) {
35366
35446
  return findClaudeFiles(root2).filter(
35367
- (file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35447
+ (file) => path84.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35368
35448
  ).map(
35369
- (file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
35449
+ (file) => `${path84.relative(root2, path84.dirname(file)).split(path84.sep).join("/")}/`
35370
35450
  ).sort();
35371
35451
  }
35372
35452
 
@@ -35405,7 +35485,7 @@ function upsertScopedRulesPointer(content, directories) {
35405
35485
  // src/commands/rules/updateScopedRulesIndex.ts
35406
35486
  function updateScopedRulesIndex(root2) {
35407
35487
  const directories = scopedRuleDirectories(root2);
35408
- const rootFile = path84.join(root2, "CLAUDE.md");
35488
+ const rootFile = path85.join(root2, "CLAUDE.md");
35409
35489
  const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
35410
35490
  const after = upsertScopedRulesPointer(before, directories);
35411
35491
  if (after !== before) writeFileSync42(rootFile, after);
@@ -35419,12 +35499,12 @@ function read2(file) {
35419
35499
  function addRule(text18, options2) {
35420
35500
  const rule = text18.trim();
35421
35501
  if (rule === "") {
35422
- console.error(chalk233.red("Rule text is required"));
35502
+ console.error(chalk235.red("Rule text is required"));
35423
35503
  process.exitCode = 1;
35424
35504
  return;
35425
35505
  }
35426
35506
  const target = resolveRuleScope(options2.scope ?? process.cwd());
35427
- const targetDir = path85.dirname(target);
35507
+ const targetDir = path86.dirname(target);
35428
35508
  const root2 = findRepoRoot(targetDir) ?? targetDir;
35429
35509
  const code = nextRuleCode(root2);
35430
35510
  writeFileSync43(
@@ -35437,38 +35517,38 @@ function addRule(text18, options2) {
35437
35517
  );
35438
35518
  updateScopedRulesIndex(root2);
35439
35519
  console.log(
35440
- `Added ${chalk233.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
35520
+ `Added ${chalk235.cyan(code)} to ${path86.relative(process.cwd(), target) || target}`
35441
35521
  );
35442
35522
  }
35443
35523
 
35444
35524
  // src/commands/rules/indexRules.ts
35445
- import path86 from "path";
35446
- import chalk234 from "chalk";
35525
+ import path87 from "path";
35526
+ import chalk236 from "chalk";
35447
35527
  function indexRules() {
35448
35528
  const startDir = scopeDirectory(process.cwd());
35449
35529
  const root2 = findRepoRoot(startDir) ?? startDir;
35450
35530
  const directories = updateScopedRulesIndex(root2);
35451
- const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
35531
+ const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
35452
35532
  if (directories.length === 0) {
35453
35533
  console.log(
35454
- chalk234.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35534
+ chalk236.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35455
35535
  );
35456
35536
  return;
35457
35537
  }
35458
35538
  console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
35459
35539
  for (const directory of directories)
35460
- console.log(` ${chalk234.cyan(directory)}`);
35540
+ console.log(` ${chalk236.cyan(directory)}`);
35461
35541
  }
35462
35542
 
35463
35543
  // src/commands/rules/listRules.ts
35464
- import path87 from "path";
35465
- import chalk235 from "chalk";
35544
+ import path88 from "path";
35545
+ import chalk237 from "chalk";
35466
35546
  function listRules(target, options2 = {}) {
35467
- const resolved = path87.resolve(target ?? process.cwd());
35547
+ const resolved = path88.resolve(target ?? process.cwd());
35468
35548
  const rules3 = readScopedRules(resolved);
35469
35549
  if (rules3.length === 0) {
35470
- const label2 = path87.relative(process.cwd(), resolved) || ".";
35471
- console.log(chalk235.gray(`No rules in scope for ${label2}`));
35550
+ const label2 = path88.relative(process.cwd(), resolved) || ".";
35551
+ console.log(chalk237.gray(`No rules in scope for ${label2}`));
35472
35552
  return;
35473
35553
  }
35474
35554
  const base = findRepoRoot(scopeDirectory(resolved));
@@ -35478,14 +35558,14 @@ function listRules(target, options2 = {}) {
35478
35558
  if (rule.source !== shown) {
35479
35559
  shown = rule.source;
35480
35560
  console.log(
35481
- chalk235.dim(base ? path87.relative(base, rule.source) : rule.source)
35561
+ chalk237.dim(base ? path88.relative(base, rule.source) : rule.source)
35482
35562
  );
35483
35563
  }
35484
35564
  console.log(
35485
- ` ${chalk235.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35565
+ ` ${chalk237.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35486
35566
  );
35487
35567
  if (options2.full && rule.title)
35488
- console.log(` ${" ".repeat(width)} ${chalk235.dim(rule.text)}`);
35568
+ console.log(` ${" ".repeat(width)} ${chalk237.dim(rule.text)}`);
35489
35569
  }
35490
35570
  }
35491
35571
 
@@ -35514,7 +35594,7 @@ function registerRules(program2) {
35514
35594
  }
35515
35595
 
35516
35596
  // src/commands/seq/seqAuth.ts
35517
- import chalk237 from "chalk";
35597
+ import chalk239 from "chalk";
35518
35598
 
35519
35599
  // src/commands/seq/loadConnections.ts
35520
35600
  function loadConnections2() {
@@ -35543,10 +35623,10 @@ function setDefaultConnection(name) {
35543
35623
  }
35544
35624
 
35545
35625
  // src/shared/assertUniqueName.ts
35546
- import chalk236 from "chalk";
35626
+ import chalk238 from "chalk";
35547
35627
  function assertUniqueName(existingNames, name) {
35548
35628
  if (existingNames.includes(name)) {
35549
- console.error(chalk236.red(`Connection "${name}" already exists.`));
35629
+ console.error(chalk238.red(`Connection "${name}" already exists.`));
35550
35630
  process.exit(1);
35551
35631
  }
35552
35632
  }
@@ -35564,18 +35644,18 @@ async function promptConnection2(existingNames) {
35564
35644
  var seqAuth = createConnectionAuth({
35565
35645
  load: loadConnections2,
35566
35646
  save: saveConnections2,
35567
- format: (c) => `${chalk237.bold(c.name)} ${c.url}`,
35647
+ format: (c) => `${chalk239.bold(c.name)} ${c.url}`,
35568
35648
  promptNew: promptConnection2,
35569
35649
  onFirst: (c) => setDefaultConnection(c.name)
35570
35650
  });
35571
35651
 
35572
35652
  // src/commands/seq/seqQuery.ts
35573
- import chalk241 from "chalk";
35653
+ import chalk243 from "chalk";
35574
35654
 
35575
35655
  // src/commands/seq/fetchSeq.ts
35576
- import chalk238 from "chalk";
35577
- async function fetchSeq(conn, path106, params) {
35578
- const url = `${conn.url}${path106}?${params}`;
35656
+ import chalk240 from "chalk";
35657
+ async function fetchSeq(conn, path107, params) {
35658
+ const url = `${conn.url}${path107}?${params}`;
35579
35659
  const response = await fetch(url, {
35580
35660
  headers: {
35581
35661
  Accept: "application/json",
@@ -35584,7 +35664,7 @@ async function fetchSeq(conn, path106, params) {
35584
35664
  });
35585
35665
  if (!response.ok) {
35586
35666
  const body = await response.text();
35587
- console.error(chalk238.red(`Seq returned ${response.status}: ${body}`));
35667
+ console.error(chalk240.red(`Seq returned ${response.status}: ${body}`));
35588
35668
  process.exit(1);
35589
35669
  }
35590
35670
  return response;
@@ -35643,23 +35723,23 @@ async function fetchSeqEvents(conn, params) {
35643
35723
  }
35644
35724
 
35645
35725
  // src/commands/seq/formatEvent.ts
35646
- import chalk239 from "chalk";
35726
+ import chalk241 from "chalk";
35647
35727
  function levelColor(level) {
35648
35728
  switch (level) {
35649
35729
  case "Fatal":
35650
- return chalk239.bgRed.white;
35730
+ return chalk241.bgRed.white;
35651
35731
  case "Error":
35652
- return chalk239.red;
35732
+ return chalk241.red;
35653
35733
  case "Warning":
35654
- return chalk239.yellow;
35734
+ return chalk241.yellow;
35655
35735
  case "Information":
35656
- return chalk239.cyan;
35736
+ return chalk241.cyan;
35657
35737
  case "Debug":
35658
- return chalk239.gray;
35738
+ return chalk241.gray;
35659
35739
  case "Verbose":
35660
- return chalk239.dim;
35740
+ return chalk241.dim;
35661
35741
  default:
35662
- return chalk239.white;
35742
+ return chalk241.white;
35663
35743
  }
35664
35744
  }
35665
35745
  function levelAbbrev(level) {
@@ -35700,12 +35780,12 @@ function formatTimestamp(iso) {
35700
35780
  function formatEvent(event) {
35701
35781
  const color = levelColor(event.Level);
35702
35782
  const abbrev = levelAbbrev(event.Level);
35703
- const ts10 = chalk239.dim(formatTimestamp(event.Timestamp));
35783
+ const ts10 = chalk241.dim(formatTimestamp(event.Timestamp));
35704
35784
  const msg = renderMessage(event);
35705
35785
  const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
35706
35786
  if (event.Exception) {
35707
35787
  for (const line of event.Exception.split("\n")) {
35708
- lines2.push(chalk239.red(` ${line}`));
35788
+ lines2.push(chalk241.red(` ${line}`));
35709
35789
  }
35710
35790
  }
35711
35791
  return lines2.join("\n");
@@ -35738,11 +35818,11 @@ function rejectTimestampFilter(filter) {
35738
35818
  }
35739
35819
 
35740
35820
  // src/shared/resolveNamedConnection.ts
35741
- import chalk240 from "chalk";
35821
+ import chalk242 from "chalk";
35742
35822
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
35743
35823
  if (connections.length === 0) {
35744
35824
  console.error(
35745
- chalk240.red(
35825
+ chalk242.red(
35746
35826
  `No ${kind} connections configured. Run '${authCommand}' first.`
35747
35827
  )
35748
35828
  );
@@ -35751,7 +35831,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
35751
35831
  const target = requested ?? defaultName ?? connections[0].name;
35752
35832
  const connection = connections.find((c) => c.name === target);
35753
35833
  if (!connection) {
35754
- console.error(chalk240.red(`${kind} connection "${target}" not found.`));
35834
+ console.error(chalk242.red(`${kind} connection "${target}" not found.`));
35755
35835
  process.exit(1);
35756
35836
  }
35757
35837
  return connection;
@@ -35780,7 +35860,7 @@ async function seqQuery(filter, options2) {
35780
35860
  new URLSearchParams({ filter, count: String(count8) })
35781
35861
  );
35782
35862
  if (events.length === 0) {
35783
- console.log(chalk241.yellow("No events found."));
35863
+ console.log(chalk243.yellow("No events found."));
35784
35864
  return;
35785
35865
  }
35786
35866
  if (options2.json) {
@@ -35791,11 +35871,11 @@ async function seqQuery(filter, options2) {
35791
35871
  for (const event of chronological) {
35792
35872
  console.log(formatEvent(event));
35793
35873
  }
35794
- console.log(chalk241.dim(`
35874
+ console.log(chalk243.dim(`
35795
35875
  ${events.length} events`));
35796
35876
  if (events.length >= count8) {
35797
35877
  console.log(
35798
- chalk241.yellow(
35878
+ chalk243.yellow(
35799
35879
  `Results limited to ${count8}. Use --count to retrieve more.`
35800
35880
  )
35801
35881
  );
@@ -35803,10 +35883,10 @@ ${events.length} events`));
35803
35883
  }
35804
35884
 
35805
35885
  // src/shared/setNamedDefaultConnection.ts
35806
- import chalk242 from "chalk";
35886
+ import chalk244 from "chalk";
35807
35887
  function setNamedDefaultConnection(connections, name, setDefault, kind) {
35808
35888
  if (!connections.find((c) => c.name === name)) {
35809
- console.error(chalk242.red(`Connection "${name}" not found.`));
35889
+ console.error(chalk244.red(`Connection "${name}" not found.`));
35810
35890
  process.exit(1);
35811
35891
  }
35812
35892
  setDefault(name);
@@ -35956,7 +36036,7 @@ async function previewSlackThreadParts({
35956
36036
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35957
36037
  );
35958
36038
  paths.forEach(
35959
- (path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
36039
+ (path107, index3) => console.log(`${index3 + 1}/${paths.length} ${path107}`)
35960
36040
  );
35961
36041
  console.log(
35962
36042
  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.`
@@ -36027,7 +36107,7 @@ function registerSlack(program2) {
36027
36107
  }
36028
36108
 
36029
36109
  // src/commands/sql/sqlAuth.ts
36030
- import chalk244 from "chalk";
36110
+ import chalk246 from "chalk";
36031
36111
 
36032
36112
  // src/commands/sql/loadConnections.ts
36033
36113
  function loadConnections3() {
@@ -36056,7 +36136,7 @@ function setDefaultConnection2(name) {
36056
36136
  }
36057
36137
 
36058
36138
  // src/commands/sql/promptConnection.ts
36059
- import chalk243 from "chalk";
36139
+ import chalk245 from "chalk";
36060
36140
  async function promptConnection3(existingNames) {
36061
36141
  const name = await promptInput("name", "Connection name:", "default");
36062
36142
  assertUniqueName(existingNames, name);
@@ -36064,7 +36144,7 @@ async function promptConnection3(existingNames) {
36064
36144
  const portStr = await promptInput("port", "Port:", "1433");
36065
36145
  const port = Number.parseInt(portStr, 10);
36066
36146
  if (!Number.isFinite(port)) {
36067
- console.error(chalk243.red(`Invalid port "${portStr}".`));
36147
+ console.error(chalk245.red(`Invalid port "${portStr}".`));
36068
36148
  process.exit(1);
36069
36149
  }
36070
36150
  const user = await promptInput("user", "User:");
@@ -36077,13 +36157,13 @@ async function promptConnection3(existingNames) {
36077
36157
  var sqlAuth = createConnectionAuth({
36078
36158
  load: loadConnections3,
36079
36159
  save: saveConnections3,
36080
- format: (c) => `${chalk244.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36160
+ format: (c) => `${chalk246.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36081
36161
  promptNew: promptConnection3,
36082
36162
  onFirst: (c) => setDefaultConnection2(c.name)
36083
36163
  });
36084
36164
 
36085
36165
  // src/commands/sql/printTable.ts
36086
- import chalk245 from "chalk";
36166
+ import chalk247 from "chalk";
36087
36167
  function formatCell(value) {
36088
36168
  if (value === null || value === void 0) return "";
36089
36169
  if (value instanceof Date) return value.toISOString();
@@ -36092,7 +36172,7 @@ function formatCell(value) {
36092
36172
  }
36093
36173
  function printTable(rows) {
36094
36174
  if (rows.length === 0) {
36095
- console.log(chalk245.yellow("(no rows)"));
36175
+ console.log(chalk247.yellow("(no rows)"));
36096
36176
  return;
36097
36177
  }
36098
36178
  const columns = Object.keys(rows[0]);
@@ -36100,13 +36180,13 @@ function printTable(rows) {
36100
36180
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
36101
36181
  );
36102
36182
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
36103
- console.log(chalk245.dim(header));
36104
- console.log(chalk245.dim("-".repeat(header.length)));
36183
+ console.log(chalk247.dim(header));
36184
+ console.log(chalk247.dim("-".repeat(header.length)));
36105
36185
  for (const row of rows) {
36106
36186
  const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
36107
36187
  console.log(line);
36108
36188
  }
36109
- console.log(chalk245.dim(`
36189
+ console.log(chalk247.dim(`
36110
36190
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
36111
36191
  }
36112
36192
 
@@ -36166,7 +36246,7 @@ async function sqlColumns(table, connectionName) {
36166
36246
  }
36167
36247
 
36168
36248
  // src/commands/sql/sqlMutate.ts
36169
- import chalk246 from "chalk";
36249
+ import chalk248 from "chalk";
36170
36250
 
36171
36251
  // src/commands/sql/isMutation.ts
36172
36252
  var MUTATION_KEYWORDS = [
@@ -36200,7 +36280,7 @@ function isMutation(sql29) {
36200
36280
  async function sqlMutate(query, connectionName) {
36201
36281
  if (!isMutation(query)) {
36202
36282
  console.error(
36203
- chalk246.red(
36283
+ chalk248.red(
36204
36284
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
36205
36285
  )
36206
36286
  );
@@ -36210,18 +36290,18 @@ async function sqlMutate(query, connectionName) {
36210
36290
  const pool = await sqlConnect(conn);
36211
36291
  try {
36212
36292
  const result = await pool.request().query(query);
36213
- console.log(chalk246.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36293
+ console.log(chalk248.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36214
36294
  } finally {
36215
36295
  await pool.close();
36216
36296
  }
36217
36297
  }
36218
36298
 
36219
36299
  // src/commands/sql/sqlQuery.ts
36220
- import chalk247 from "chalk";
36300
+ import chalk249 from "chalk";
36221
36301
  async function sqlQuery(query, connectionName) {
36222
36302
  if (isMutation(query)) {
36223
36303
  console.error(
36224
- chalk247.red(
36304
+ chalk249.red(
36225
36305
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
36226
36306
  )
36227
36307
  );
@@ -36236,7 +36316,7 @@ async function sqlQuery(query, connectionName) {
36236
36316
  printTable(rows);
36237
36317
  } else {
36238
36318
  console.log(
36239
- chalk247.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36319
+ chalk249.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36240
36320
  );
36241
36321
  }
36242
36322
  } finally {
@@ -36298,15 +36378,15 @@ function registerSql(program2) {
36298
36378
 
36299
36379
  // src/commands/sync.ts
36300
36380
  import * as os5 from "os";
36301
- import * as path99 from "path";
36381
+ import * as path100 from "path";
36302
36382
  import { fileURLToPath as fileURLToPath8 } from "url";
36303
36383
 
36304
36384
  // src/commands/sync/pruneCommands.ts
36305
- import * as path89 from "path";
36385
+ import * as path90 from "path";
36306
36386
 
36307
36387
  // src/commands/sync/pruneTarget.ts
36308
36388
  import * as fs39 from "fs";
36309
- import * as path88 from "path";
36389
+ import * as path89 from "path";
36310
36390
  function pruneTarget(targetDir, keepNames, shape, options2) {
36311
36391
  const result = {
36312
36392
  orphans: [],
@@ -36324,7 +36404,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36324
36404
  }
36325
36405
  if (keep.has(name)) continue;
36326
36406
  result.orphans.push(entry.name);
36327
- const entryPath = path88.join(targetDir, entry.name);
36407
+ const entryPath = path89.join(targetDir, entry.name);
36328
36408
  const reason4 = shape.blockedBy?.(entryPath);
36329
36409
  if (reason4) {
36330
36410
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -36344,7 +36424,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36344
36424
  targetDir,
36345
36425
  commandNames,
36346
36426
  {
36347
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
36427
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path90.basename(entry.name, ".md") : void 0
36348
36428
  },
36349
36429
  options2
36350
36430
  );
@@ -36379,16 +36459,16 @@ function reportPrune(label2, result, force) {
36379
36459
 
36380
36460
  // src/commands/sync/syncClaudeCommands.ts
36381
36461
  import * as fs43 from "fs";
36382
- import * as path93 from "path";
36462
+ import * as path94 from "path";
36383
36463
 
36384
36464
  // src/commands/sync/syncCodex.ts
36385
- import * as path92 from "path";
36465
+ import * as path93 from "path";
36386
36466
 
36387
36467
  // src/commands/sync/installHarnessCommands.ts
36388
36468
  import * as fs40 from "fs";
36389
- import * as path90 from "path";
36469
+ import * as path91 from "path";
36390
36470
  function installHarnessCommands(claudeDir, harness, transform) {
36391
- const commandsSource = path90.join(claudeDir, "commands");
36471
+ const commandsSource = path91.join(claudeDir, "commands");
36392
36472
  const files = fs40.readdirSync(commandsSource);
36393
36473
  const names = [];
36394
36474
  let synced = 0;
@@ -36396,9 +36476,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
36396
36476
  if (!file.endsWith(".md")) continue;
36397
36477
  const name = file.replace(/\.md$/, "");
36398
36478
  names.push(name);
36399
- const content = fs40.readFileSync(path90.join(commandsSource, file), "utf8");
36400
- const target = path90.join(harness.homeDir, harness.sync.commandDest(name));
36401
- fs40.mkdirSync(path90.dirname(target), { recursive: true });
36479
+ const content = fs40.readFileSync(path91.join(commandsSource, file), "utf8");
36480
+ const target = path91.join(harness.homeDir, harness.sync.commandDest(name));
36481
+ fs40.mkdirSync(path91.dirname(target), { recursive: true });
36402
36482
  fs40.writeFileSync(target, transform(name, content));
36403
36483
  synced++;
36404
36484
  }
@@ -36427,7 +36507,7 @@ function unexpectedContent(skillDir) {
36427
36507
 
36428
36508
  // src/commands/sync/syncCodexHooks.ts
36429
36509
  import * as fs42 from "fs";
36430
- import * as path91 from "path";
36510
+ import * as path92 from "path";
36431
36511
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36432
36512
  var END = "# <<< assist codex hooks (managed) <<<";
36433
36513
  function upsertManagedBlock(existing, body) {
@@ -36458,9 +36538,9 @@ ${rest}
36458
36538
  }
36459
36539
  function syncCodexHooks(sourcePath) {
36460
36540
  const body = fs42.readFileSync(sourcePath, "utf8");
36461
- const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
36541
+ const configPath = path92.join(harnesses.codex.homeDir, "config.toml");
36462
36542
  const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
36463
- fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
36543
+ fs42.mkdirSync(path92.dirname(configPath), { recursive: true });
36464
36544
  fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
36465
36545
  console.log(
36466
36546
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
@@ -36492,13 +36572,13 @@ function syncCodex(claudeDir, options2) {
36492
36572
  harnesses.codex,
36493
36573
  commandToSkill
36494
36574
  );
36495
- syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
36575
+ syncCodexHooks(path93.join(claudeDir, "..", "codex", "config.toml"));
36496
36576
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36497
36577
  if (!options2?.prune) return;
36498
36578
  const force = options2.force ?? false;
36499
36579
  reportPrune(
36500
36580
  "~/.codex/skills",
36501
- pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
36581
+ pruneSkills(path93.join(harnesses.codex.homeDir, "skills"), names, { force }),
36502
36582
  force
36503
36583
  );
36504
36584
  }
@@ -36513,30 +36593,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
36513
36593
  fs43.writeFileSync(file, content);
36514
36594
  }
36515
36595
  function writeSkill(targetBase, name, content) {
36516
- const skillDir = path93.join(targetBase, "skills", name);
36596
+ const skillDir = path94.join(targetBase, "skills", name);
36517
36597
  fs43.mkdirSync(skillDir, { recursive: true });
36518
36598
  replaceFileWithoutFollowingSymlink(
36519
- path93.join(skillDir, "SKILL.md"),
36599
+ path94.join(skillDir, "SKILL.md"),
36520
36600
  commandToSkill(name, content)
36521
36601
  );
36522
- fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
36602
+ fs43.rmSync(path94.join(targetBase, "commands", `${name}.md`), { force: true });
36523
36603
  console.log(`Wrote ${name} as a skill to ${skillDir}`);
36524
36604
  }
36525
36605
  function syncClaudeCommands(claudeDir, targetBase) {
36526
- const sourceDir = path93.join(claudeDir, "commands");
36527
- const targetDir = path93.join(targetBase, "commands");
36606
+ const sourceDir = path94.join(claudeDir, "commands");
36607
+ const targetDir = path94.join(targetBase, "commands");
36528
36608
  fs43.mkdirSync(targetDir, { recursive: true });
36529
36609
  const files = fs43.readdirSync(sourceDir);
36530
36610
  for (const file of files) {
36531
- const source = path93.join(sourceDir, file);
36611
+ const source = path94.join(sourceDir, file);
36532
36612
  if (file.endsWith(".md")) {
36533
36613
  const content = fs43.readFileSync(source, "utf8");
36534
36614
  if (isSkillFlagged(content)) {
36535
- writeSkill(targetBase, path93.basename(file, ".md"), content);
36615
+ writeSkill(targetBase, path94.basename(file, ".md"), content);
36536
36616
  continue;
36537
36617
  }
36538
36618
  }
36539
- fs43.copyFileSync(source, path93.join(targetDir, file));
36619
+ fs43.copyFileSync(source, path94.join(targetDir, file));
36540
36620
  console.log(`Copied ${file} to ${targetDir}`);
36541
36621
  }
36542
36622
  console.log(`Synced ${files.length} command(s) to ~/.claude`);
@@ -36545,11 +36625,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
36545
36625
 
36546
36626
  // src/commands/sync/reportRetiredAgentsFiles.ts
36547
36627
  import * as fs44 from "fs";
36548
- import * as path94 from "path";
36628
+ import * as path95 from "path";
36549
36629
  var retired = [
36550
- path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
36551
- path94.join(harnesses.codex.homeDir, "AGENTS.md"),
36552
- path94.join(harnesses.pi.homeDir, "AGENTS.md")
36630
+ path95.join(harnesses.claude.homeDir, "CLAUDE.md"),
36631
+ path95.join(harnesses.codex.homeDir, "AGENTS.md"),
36632
+ path95.join(harnesses.pi.homeDir, "AGENTS.md")
36553
36633
  ];
36554
36634
  function reportRetiredAgentsFiles() {
36555
36635
  const leftovers = retired.filter((file) => fs44.existsSync(file));
@@ -36565,35 +36645,35 @@ function reportRetiredAgentsFiles() {
36565
36645
 
36566
36646
  // src/commands/sync/syncDesign.ts
36567
36647
  import * as fs45 from "fs";
36568
- import * as path95 from "path";
36648
+ import * as path96 from "path";
36569
36649
  function syncDesign(claudeDir, targetBase) {
36570
- const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
36571
- const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
36650
+ const systemPromptSource = path96.join(claudeDir, "design-system-prompt.md");
36651
+ const systemPromptTarget = path96.join(targetBase, "design-system-prompt.md");
36572
36652
  fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36573
36653
  console.log(
36574
36654
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36575
36655
  );
36576
- const skillsSource = path95.join(claudeDir, "skills");
36577
- const skillsTarget = path95.join(targetBase, "skills");
36656
+ const skillsSource = path96.join(claudeDir, "skills");
36657
+ const skillsTarget = path96.join(targetBase, "skills");
36578
36658
  fs45.mkdirSync(skillsTarget, { recursive: true });
36579
36659
  const files = fs45.readdirSync(skillsSource);
36580
36660
  for (const file of files) {
36581
36661
  fs45.copyFileSync(
36582
- path95.join(skillsSource, file),
36583
- path95.join(skillsTarget, file)
36662
+ path96.join(skillsSource, file),
36663
+ path96.join(skillsTarget, file)
36584
36664
  );
36585
36665
  }
36586
36666
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36587
36667
  }
36588
36668
 
36589
36669
  // src/commands/sync/syncPi.ts
36590
- import * as path97 from "path";
36670
+ import * as path98 from "path";
36591
36671
 
36592
36672
  // src/commands/sync/syncPiHooks.ts
36593
36673
  import * as fs46 from "fs";
36594
- import * as path96 from "path";
36674
+ import * as path97 from "path";
36595
36675
  function piExtensionsDir() {
36596
- return path96.join(harnesses.pi.homeDir, "extensions");
36676
+ return path97.join(harnesses.pi.homeDir, "extensions");
36597
36677
  }
36598
36678
  function syncPiHooks(sourceDir) {
36599
36679
  const target = piExtensionsDir();
@@ -36601,8 +36681,8 @@ function syncPiHooks(sourceDir) {
36601
36681
  const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36602
36682
  for (const file of files) {
36603
36683
  fs46.copyFileSync(
36604
- path96.join(sourceDir, file),
36605
- path96.join(target, `assist-${file}`)
36684
+ path97.join(sourceDir, file),
36685
+ path97.join(target, `assist-${file}`)
36606
36686
  );
36607
36687
  }
36608
36688
  console.log(
@@ -36639,24 +36719,24 @@ function syncPi(claudeDir, options2) {
36639
36719
  harnesses.pi,
36640
36720
  commandToPrompt
36641
36721
  );
36642
- syncPiHooks(path97.join(claudeDir, "..", "pi"));
36722
+ syncPiHooks(path98.join(claudeDir, "..", "pi"));
36643
36723
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36644
36724
  if (!options2?.prune) return;
36645
36725
  const force = options2.force ?? false;
36646
36726
  reportPrune(
36647
36727
  "~/.pi/agent/prompts",
36648
- pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36728
+ pruneCommands(path98.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36649
36729
  force
36650
36730
  );
36651
36731
  }
36652
36732
 
36653
36733
  // src/commands/sync/syncSettings.ts
36654
36734
  import * as fs47 from "fs";
36655
- import * as path98 from "path";
36656
- import chalk248 from "chalk";
36735
+ import * as path99 from "path";
36736
+ import chalk250 from "chalk";
36657
36737
  async function syncSettings(claudeDir, targetBase, options2) {
36658
- const source = path98.join(claudeDir, "settings.json");
36659
- const target = path98.join(targetBase, "settings.json");
36738
+ const source = path99.join(claudeDir, "settings.json");
36739
+ const target = path99.join(targetBase, "settings.json");
36660
36740
  const sourceContent = fs47.readFileSync(source, "utf8");
36661
36741
  const sourceSettings = JSON.parse(sourceContent);
36662
36742
  const targetExists = fs47.existsSync(target);
@@ -36672,7 +36752,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36672
36752
  if (mergedContent !== normalizedTarget) {
36673
36753
  if (!options2?.yes) {
36674
36754
  console.log(
36675
- chalk248.yellow(
36755
+ chalk250.yellow(
36676
36756
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
36677
36757
  )
36678
36758
  );
@@ -36680,7 +36760,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36680
36760
  printDiff(targetContent, mergedContent);
36681
36761
  printAutoConfirmHint();
36682
36762
  const confirm = await promptConfirm(
36683
- chalk248.red("Overwrite existing settings.json?"),
36763
+ chalk250.red("Overwrite existing settings.json?"),
36684
36764
  false
36685
36765
  );
36686
36766
  if (!confirm) {
@@ -36696,13 +36776,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
36696
36776
 
36697
36777
  // src/commands/sync.ts
36698
36778
  var __filename4 = fileURLToPath8(import.meta.url);
36699
- var __dirname5 = path99.dirname(__filename4);
36779
+ var __dirname5 = path100.dirname(__filename4);
36700
36780
  async function sync(options2) {
36701
36781
  const config = loadConfig();
36702
36782
  const yes = options2?.yes ?? config.sync.autoConfirm;
36703
36783
  const prune = { prune: options2?.prune, force: options2?.force };
36704
- const claudeDir = path99.join(__dirname5, "..", "claude");
36705
- const targetBase = path99.join(os5.homedir(), ".claude");
36784
+ const claudeDir = path100.join(__dirname5, "..", "claude");
36785
+ const targetBase = path100.join(os5.homedir(), ".claude");
36706
36786
  const commandFiles = syncClaudeCommands(claudeDir, targetBase);
36707
36787
  syncDesign(claudeDir, targetBase);
36708
36788
  await syncSettings(claudeDir, targetBase, { yes });
@@ -36710,11 +36790,11 @@ async function sync(options2) {
36710
36790
  syncPi(claudeDir, prune);
36711
36791
  reportRetiredAgentsFiles();
36712
36792
  if (!options2?.prune) return;
36713
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path99.basename(file, ".md"));
36793
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path100.basename(file, ".md"));
36714
36794
  const force = options2.force ?? false;
36715
36795
  reportPrune(
36716
36796
  "~/.claude/commands",
36717
- pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
36797
+ pruneCommands(path100.join(targetBase, "commands"), commandNames, { force }),
36718
36798
  force
36719
36799
  );
36720
36800
  }
@@ -37770,9 +37850,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
37770
37850
 
37771
37851
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37772
37852
  import { minimatch as minimatch9 } from "minimatch";
37773
- function resolveStringsAtPath(data, path106) {
37853
+ function resolveStringsAtPath(data, path107) {
37774
37854
  let current = data;
37775
- for (const segment of path106.split(".")) {
37855
+ for (const segment of path107.split(".")) {
37776
37856
  if (current === null || typeof current !== "object") return [];
37777
37857
  current = current[segment];
37778
37858
  }
@@ -37785,10 +37865,10 @@ function resolveStringsAtPath(data, path106) {
37785
37865
  }
37786
37866
  function findRuleViolations(data, rule) {
37787
37867
  const violations = [];
37788
- for (const path106 of rule.paths) {
37789
- for (const value of resolveStringsAtPath(data, path106)) {
37868
+ for (const path107 of rule.paths) {
37869
+ for (const value of resolveStringsAtPath(data, path107)) {
37790
37870
  if (minimatch9(value, rule.disallowed))
37791
- violations.push({ file: rule.file, path: path106, value });
37871
+ violations.push({ file: rule.file, path: path107, value });
37792
37872
  }
37793
37873
  }
37794
37874
  return violations;
@@ -37827,8 +37907,8 @@ function forbiddenStrings() {
37827
37907
  process.exit(0);
37828
37908
  }
37829
37909
  console.log("Forbidden strings found:\n");
37830
- for (const { file, path: path106, value } of violations) {
37831
- console.log(` ${file} ${path106}: ${value}`);
37910
+ for (const { file, path: path107, value } of violations) {
37911
+ console.log(` ${file} ${path107}: ${value}`);
37832
37912
  }
37833
37913
  console.log(`
37834
37914
  Total: ${violations.length} forbidden string(s).`);
@@ -37884,7 +37964,7 @@ Total: ${lines2.length} hardcoded color(s)`);
37884
37964
 
37885
37965
  // src/commands/verify/migrations.ts
37886
37966
  import { readFileSync as readFileSync61 } from "fs";
37887
- import path101 from "path";
37967
+ import path102 from "path";
37888
37968
 
37889
37969
  // src/commands/verify/migrations/checkAppendOnly.ts
37890
37970
  function checkAppendOnly(baseline, current) {
@@ -37976,15 +38056,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37976
38056
  } catch {
37977
38057
  return baseline;
37978
38058
  }
37979
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename26(path106)));
37980
- for (const path106 of paths) {
38059
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path107) => MIGRATION_FILE3.test(basename26(path107)));
38060
+ for (const path107 of paths) {
37981
38061
  try {
37982
- const content = execSync63(`git show "${ref}:${path106}"`, {
38062
+ const content = execSync63(`git show "${ref}:${path107}"`, {
37983
38063
  encoding: "utf8",
37984
38064
  maxBuffer: 16 * 1024 * 1024,
37985
38065
  stdio: ["pipe", "pipe", "pipe"]
37986
38066
  });
37987
- baseline.set(basename26(path106), content);
38067
+ baseline.set(basename26(path107), content);
37988
38068
  } catch {
37989
38069
  }
37990
38070
  }
@@ -38023,11 +38103,11 @@ function resolveBaselineRef() {
38023
38103
  }
38024
38104
 
38025
38105
  // src/commands/verify/migrations/migrationsDir.ts
38026
- import path100 from "path";
38106
+ import path101 from "path";
38027
38107
  import { fileURLToPath as fileURLToPath9 } from "url";
38028
38108
  function migrationsDir() {
38029
- return path100.resolve(
38030
- path100.dirname(fileURLToPath9(import.meta.url)),
38109
+ return path101.resolve(
38110
+ path101.dirname(fileURLToPath9(import.meta.url)),
38031
38111
  "../../../shared/db/migrations"
38032
38112
  );
38033
38113
  }
@@ -38048,7 +38128,7 @@ function migrations2() {
38048
38128
  if (ref) {
38049
38129
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
38050
38130
  const current = new Map(
38051
- files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
38131
+ files.map((file) => [file, readFileSync61(path102.join(dir, file), "utf8")])
38052
38132
  );
38053
38133
  for (const finding of checkAppendOnly(baseline, current)) {
38054
38134
  problems.push(
@@ -38553,11 +38633,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
38553
38633
  var sessionsPrefix = "src/commands/sessions/";
38554
38634
  var rules = [
38555
38635
  {
38556
- matches: (path106) => path106.startsWith(webUiPrefix),
38636
+ matches: (path107) => path107.startsWith(webUiPrefix),
38557
38637
  advice: "restart the web server, then hard-reload the browser tab"
38558
38638
  },
38559
38639
  {
38560
- matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
38640
+ matches: (path107) => path107.startsWith(sessionsPrefix) && !path107.startsWith(webUiPrefix),
38561
38641
  advice: "restart the daemon"
38562
38642
  }
38563
38643
  ];
@@ -38568,27 +38648,27 @@ function restartAdvice(paths) {
38568
38648
  // src/commands/watch/syncAdvice.ts
38569
38649
  var rules2 = [
38570
38650
  {
38571
- matches: (path106) => path106.startsWith("claude/commands/"),
38651
+ matches: (path107) => path107.startsWith("claude/commands/"),
38572
38652
  reason: "claude/commands changed"
38573
38653
  },
38574
38654
  {
38575
- matches: (path106) => path106.startsWith("claude/skills/"),
38655
+ matches: (path107) => path107.startsWith("claude/skills/"),
38576
38656
  reason: "claude/skills changed"
38577
38657
  },
38578
38658
  {
38579
- matches: (path106) => path106 === "claude/settings.json",
38659
+ matches: (path107) => path107 === "claude/settings.json",
38580
38660
  reason: "claude/settings.json changed"
38581
38661
  },
38582
38662
  {
38583
- matches: (path106) => path106 === "claude/design-system-prompt.md",
38663
+ matches: (path107) => path107 === "claude/design-system-prompt.md",
38584
38664
  reason: "claude/design-system-prompt.md changed"
38585
38665
  },
38586
38666
  {
38587
- matches: (path106) => path106.startsWith("codex/"),
38667
+ matches: (path107) => path107.startsWith("codex/"),
38588
38668
  reason: "codex sources changed"
38589
38669
  },
38590
38670
  {
38591
- matches: (path106) => path106.startsWith("pi/"),
38671
+ matches: (path107) => path107.startsWith("pi/"),
38592
38672
  reason: "pi sources changed"
38593
38673
  }
38594
38674
  ];
@@ -39070,7 +39150,7 @@ function registerWatch(program2) {
39070
39150
 
39071
39151
  // src/commands/roam/auth.ts
39072
39152
  import { randomBytes } from "crypto";
39073
- import chalk249 from "chalk";
39153
+ import chalk251 from "chalk";
39074
39154
 
39075
39155
  // src/commands/roam/waitForCallback.ts
39076
39156
  import { createServer as createServer3 } from "http";
@@ -39201,13 +39281,13 @@ async function auth() {
39201
39281
  saveGlobalConfig(config);
39202
39282
  const state = randomBytes(16).toString("hex");
39203
39283
  console.log(
39204
- chalk249.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39284
+ chalk251.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39205
39285
  );
39206
- console.log(chalk249.white("http://localhost:14523/callback\n"));
39207
- console.log(chalk249.blue("Opening browser for authorization..."));
39208
- console.log(chalk249.dim("Waiting for authorization callback..."));
39286
+ console.log(chalk251.white("http://localhost:14523/callback\n"));
39287
+ console.log(chalk251.blue("Opening browser for authorization..."));
39288
+ console.log(chalk251.dim("Waiting for authorization callback..."));
39209
39289
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
39210
- console.log(chalk249.dim("Exchanging code for tokens..."));
39290
+ console.log(chalk251.dim("Exchanging code for tokens..."));
39211
39291
  const tokens = await exchangeToken({
39212
39292
  code,
39213
39293
  clientId,
@@ -39223,7 +39303,7 @@ async function auth() {
39223
39303
  };
39224
39304
  saveGlobalConfig(config);
39225
39305
  console.log(
39226
- chalk249.green("Roam credentials and tokens saved to ~/.assist.yml")
39306
+ chalk251.green("Roam credentials and tokens saved to ~/.assist.yml")
39227
39307
  );
39228
39308
  }
39229
39309
 
@@ -39239,9 +39319,9 @@ function findPortFile(roamDir) {
39239
39319
  return void 0;
39240
39320
  }
39241
39321
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
39242
- const path106 = join101(roamDir, name);
39322
+ const path107 = join101(roamDir, name);
39243
39323
  try {
39244
- return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
39324
+ return { path: path107, mtimeMs: statSync13(path107).mtimeMs };
39245
39325
  } catch {
39246
39326
  return void 0;
39247
39327
  }
@@ -39485,11 +39565,11 @@ function findLinkIndex() {
39485
39565
  function parseLinkArgs() {
39486
39566
  const idx = findLinkIndex();
39487
39567
  if (idx === -1) return null;
39488
- const path106 = process.argv[idx + 1];
39568
+ const path107 = process.argv[idx + 1];
39489
39569
  const rest = process.argv.slice(idx + 2);
39490
39570
  const { value: prefix2 } = extractOption(rest, "--prefix");
39491
39571
  if (!prefix2) return null;
39492
- return { path: path106, prefix: prefix2 };
39572
+ return { path: path107, prefix: prefix2 };
39493
39573
  }
39494
39574
  function hasDuplicateLink(runList, linkPath) {
39495
39575
  return runList.some(
@@ -39578,7 +39658,7 @@ function registerRun(program2) {
39578
39658
  }
39579
39659
 
39580
39660
  // src/commands/sessions/nodes/formatLink.ts
39581
- import chalk250 from "chalk";
39661
+ import chalk252 from "chalk";
39582
39662
 
39583
39663
  // src/commands/sessions/daemon/links/describeTarget.ts
39584
39664
  function describeTarget({ url, ssh }) {
@@ -39588,16 +39668,16 @@ function describeTarget({ url, ssh }) {
39588
39668
 
39589
39669
  // src/commands/sessions/nodes/formatLink.ts
39590
39670
  var STATE_COLOURS = {
39591
- connected: chalk250.green,
39592
- connecting: chalk250.yellow,
39593
- disconnected: chalk250.red,
39594
- "version-blocked": chalk250.red
39671
+ connected: chalk252.green,
39672
+ connecting: chalk252.yellow,
39673
+ disconnected: chalk252.red,
39674
+ "version-blocked": chalk252.red
39595
39675
  };
39596
39676
  function formatLink(link3) {
39597
- const colour = STATE_COLOURS[link3.state] ?? chalk250.white;
39677
+ const colour = STATE_COLOURS[link3.state] ?? chalk252.white;
39598
39678
  const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
39599
39679
  const error = link3.error ? `
39600
- ${chalk250.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39680
+ ${chalk252.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39601
39681
  return ` ${link3.name} ${colour(link3.state)} ${describeTarget(link3)}${peer}${error}`;
39602
39682
  }
39603
39683
 
@@ -40134,14 +40214,14 @@ import * as pty from "node-pty";
40134
40214
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
40135
40215
  import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
40136
40216
  import { createRequire as createRequire3 } from "module";
40137
- import path102 from "path";
40217
+ import path103 from "path";
40138
40218
  var require4 = createRequire3(import.meta.url);
40139
40219
  var ensured = false;
40140
40220
  function ensureSpawnHelperExecutable() {
40141
40221
  if (ensured || process.platform !== "darwin") return;
40142
40222
  ensured = true;
40143
- const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
40144
- const helper = path102.join(
40223
+ const ptyRoot = path103.join(path103.dirname(require4.resolve("node-pty")), "..");
40224
+ const helper = path103.join(
40145
40225
  ptyRoot,
40146
40226
  "prebuilds",
40147
40227
  `${process.platform}-${process.arch}`,
@@ -40272,12 +40352,12 @@ function serverRunMeta(runName, cwd) {
40272
40352
 
40273
40353
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
40274
40354
  import * as fs50 from "fs";
40275
- import * as path103 from "path";
40355
+ import * as path104 from "path";
40276
40356
  import { fileURLToPath as fileURLToPath11 } from "url";
40277
40357
  var __filename5 = fileURLToPath11(import.meta.url);
40278
- var __dirname7 = path103.dirname(__filename5);
40358
+ var __dirname7 = path104.dirname(__filename5);
40279
40359
  function readDesignSystemPrompt() {
40280
- const promptPath = path103.join(
40360
+ const promptPath = path104.join(
40281
40361
  __dirname7,
40282
40362
  "..",
40283
40363
  "claude",
@@ -41311,8 +41391,8 @@ async function seedRunningMsFromUsage(session, notify2) {
41311
41391
  var DEBOUNCE_MS2 = 50;
41312
41392
  function watchActivity(session, notify2, onClaudeSessionId) {
41313
41393
  if (session.commandType !== "assist" || !session.cwd) return;
41314
- const path106 = activityPath(session.id);
41315
- const dir = dirname42(path106);
41394
+ const path107 = activityPath(session.id);
41395
+ const dir = dirname42(path107);
41316
41396
  try {
41317
41397
  mkdirSync37(dir, { recursive: true });
41318
41398
  } catch {
@@ -41322,7 +41402,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41322
41402
  let timer = null;
41323
41403
  const read3 = () => {
41324
41404
  timer = null;
41325
- const activity2 = readActivity(path106);
41405
+ const activity2 = readActivity(path107);
41326
41406
  if (!activity2) return;
41327
41407
  applyActivityToSession(session, activity2);
41328
41408
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -41331,11 +41411,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41331
41411
  notify2();
41332
41412
  };
41333
41413
  session.activityWatcher = watch2(dir, (_event, filename) => {
41334
- if (filename && !path106.endsWith(filename)) return;
41414
+ if (filename && !path107.endsWith(filename)) return;
41335
41415
  if (timer) clearTimeout(timer);
41336
41416
  timer = setTimeout(read3, DEBOUNCE_MS2);
41337
41417
  });
41338
- if (existsSync93(path106)) read3();
41418
+ if (existsSync93(path107)) read3();
41339
41419
  }
41340
41420
  function refreshActivity(session) {
41341
41421
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -41478,12 +41558,12 @@ import { watch as watch3 } from "fs";
41478
41558
 
41479
41559
  // src/commands/sessions/shared/findTranscriptPathSync.ts
41480
41560
  import * as fs52 from "fs";
41481
- import * as path104 from "path";
41561
+ import * as path105 from "path";
41482
41562
  function projectDirForCwd(cwd) {
41483
- return path104.join(claudeProjectsRoot(), projectSlug(cwd));
41563
+ return path105.join(claudeProjectsRoot(), projectSlug(cwd));
41484
41564
  }
41485
41565
  function transcriptPathFor(cwd, claudeSessionId) {
41486
- return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41566
+ return path105.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41487
41567
  }
41488
41568
  function findTranscriptPathSync(cwd, claudeSessionId) {
41489
41569
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -41497,8 +41577,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
41497
41577
  }
41498
41578
  for (const file of files) {
41499
41579
  if (!file.endsWith(".jsonl")) continue;
41500
- if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
41501
- return path104.join(dir, file);
41580
+ if (headContainsSessionId(path105.join(dir, file), claudeSessionId))
41581
+ return path105.join(dir, file);
41502
41582
  }
41503
41583
  return null;
41504
41584
  }
@@ -42698,9 +42778,9 @@ function tempRoots() {
42698
42778
  }
42699
42779
  return [...roots];
42700
42780
  }
42701
- function underTempRoot(path106) {
42781
+ function underTempRoot(path107) {
42702
42782
  return tempRoots().some(
42703
- (root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42783
+ (root2) => path107.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42704
42784
  );
42705
42785
  }
42706
42786
 
@@ -43186,15 +43266,15 @@ function bindResumedWorktree(session, cwd, notify2) {
43186
43266
  import { existsSync as existsSync95 } from "fs";
43187
43267
  async function reclaimVanishedWorktrees(clone, paths) {
43188
43268
  if (!existsSync95(clone)) {
43189
- for (const { path: path106 } of paths) forgetWorktree(path106);
43269
+ for (const { path: path107 } of paths) forgetWorktree(path107);
43190
43270
  daemonLog(
43191
43271
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
43192
43272
  );
43193
43273
  return;
43194
43274
  }
43195
43275
  await pruneBookkeeping2(clone);
43196
- for (const { path: path106, branch: branch2 } of paths)
43197
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
43276
+ for (const { path: path107, branch: branch2 } of paths)
43277
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path107);
43198
43278
  }
43199
43279
  async function pruneBookkeeping2(clone) {
43200
43280
  try {
@@ -43221,37 +43301,37 @@ async function reclaimBranch(clone, branch2) {
43221
43301
  }
43222
43302
 
43223
43303
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
43224
- function logVanishedTree(sessions, path106) {
43304
+ function logVanishedTree(sessions, path107) {
43225
43305
  const claimants = [...sessions.values()].filter(
43226
- (s) => s.cwd === path106 || s.worktree?.path === path106
43306
+ (s) => s.cwd === path107 || s.worktree?.path === path107
43227
43307
  );
43228
43308
  if (claimants.length === 0) {
43229
- daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
43309
+ daemonLog(`worktree ${path107} gone from disk and unclaimed; reclaiming it`);
43230
43310
  return;
43231
43311
  }
43232
43312
  for (const s of claimants)
43233
43313
  daemonLog(
43234
- `session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
43314
+ `session ${s.id} ("${s.name}") claims worktree ${path107}, which is gone from disk; reclaiming it`
43235
43315
  );
43236
43316
  }
43237
43317
 
43238
43318
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
43239
43319
  var MAX_ITEMS = 20;
43240
- async function describeHeldWork(path106, reason4) {
43241
- if (reason4.startsWith("uncommitted")) return await changedFiles(path106);
43242
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path106, reason4);
43320
+ async function describeHeldWork(path107, reason4) {
43321
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path107);
43322
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path107, reason4);
43243
43323
  return { summary: reason4, items: [] };
43244
43324
  }
43245
- async function changedFiles(path106) {
43246
- const status3 = await gitResult(path106, ["status", "--porcelain"]);
43325
+ async function changedFiles(path107) {
43326
+ const status3 = await gitResult(path107, ["status", "--porcelain"]);
43247
43327
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
43248
43328
  return {
43249
43329
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
43250
43330
  items: capped2(lines2)
43251
43331
  };
43252
43332
  }
43253
- async function unpushedCommits(path106, reason4) {
43254
- const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
43333
+ async function unpushedCommits(path107, reason4) {
43334
+ const log2 = await gitResult(path107, ["log", "--oneline", "@{upstream}..HEAD"]);
43255
43335
  if (!log2.ok) return { summary: reason4, items: [] };
43256
43336
  const lines2 = nonEmptyLines(log2.out);
43257
43337
  return {
@@ -43343,24 +43423,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
43343
43423
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
43344
43424
  const accounted = accountedTrees(sessions);
43345
43425
  const vanished = /* @__PURE__ */ new Map();
43346
- for (const { path: path106, clone } of readWorktreeRegistry()) {
43347
- if (underTempRoot(path106)) {
43348
- forgetWorktree(path106);
43426
+ for (const { path: path107, clone } of readWorktreeRegistry()) {
43427
+ if (underTempRoot(path107)) {
43428
+ forgetWorktree(path107);
43349
43429
  daemonLog(
43350
- `worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
43430
+ `worktree ${path107} lies outside any project root; pruned from the registry rather than recovered`
43351
43431
  );
43352
43432
  continue;
43353
43433
  }
43354
- if (!existsSync96(path106)) {
43355
- logVanishedTree(sessions, path106);
43434
+ if (!existsSync96(path107)) {
43435
+ logVanishedTree(sessions, path107);
43356
43436
  vanished.set(clone, [
43357
43437
  ...vanished.get(clone) ?? [],
43358
- { path: path106, branch: basename29(path106) }
43438
+ { path: path107, branch: basename29(path107) }
43359
43439
  ]);
43360
43440
  continue;
43361
43441
  }
43362
- if (accounted.has(path106)) continue;
43363
- await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
43442
+ if (accounted.has(path107)) continue;
43443
+ await recoverOrphan(sessions, spawnWith, { path: path107, clone }, notify2);
43364
43444
  }
43365
43445
  for (const [clone, paths] of vanished)
43366
43446
  await reclaimVanishedWorktrees(clone, paths);
@@ -45438,12 +45518,12 @@ function handleSetStatus(client, m, d) {
45438
45518
  import * as fs56 from "fs";
45439
45519
 
45440
45520
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
45441
- import * as path105 from "path";
45521
+ import * as path106 from "path";
45442
45522
  async function findCodexRolloutPath(sessionId) {
45443
45523
  if (!sessionId) return null;
45444
45524
  const paths = await discoverCodexRolloutPaths();
45445
45525
  const suffix = `-${sessionId}.jsonl`;
45446
- return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
45526
+ return paths.find((file) => path106.basename(file).endsWith(suffix)) ?? null;
45447
45527
  }
45448
45528
 
45449
45529
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -46026,13 +46106,13 @@ function describePeerError(error) {
46026
46106
  const cause = error.cause;
46027
46107
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
46028
46108
  }
46029
- async function fetchPeerJson(baseUrl, path106, timeoutMs = PEER_TIMEOUT_MS) {
46030
- const res = await fetch(new URL(path106, baseUrl), {
46109
+ async function fetchPeerJson(baseUrl, path107, timeoutMs = PEER_TIMEOUT_MS) {
46110
+ const res = await fetch(new URL(path107, baseUrl), {
46031
46111
  signal: AbortSignal.timeout(timeoutMs)
46032
46112
  });
46033
46113
  if (!res.ok)
46034
46114
  throw Object.assign(
46035
- new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
46115
+ new Error(`GET ${path107} returned ${res.status} ${res.statusText}`),
46036
46116
  { status: res.status }
46037
46117
  );
46038
46118
  return await res.json();
@@ -46345,7 +46425,7 @@ async function probeSshAgent(alias) {
46345
46425
  }
46346
46426
 
46347
46427
  // src/commands/sessions/nodes/printReport.ts
46348
- import chalk251 from "chalk";
46428
+ import chalk253 from "chalk";
46349
46429
  function printReport(report2) {
46350
46430
  if (report2.links.length === 0) {
46351
46431
  console.log(`${report2.local} has no links`);
@@ -46359,11 +46439,11 @@ function printReport(report2) {
46359
46439
  for (const diagnosis of report2.links) printDiagnosis(diagnosis);
46360
46440
  }
46361
46441
  function printDiagnosis(diagnosis) {
46362
- console.log(`${chalk251.bold(diagnosis.name)} ${chalk251.dim(diagnosis.url)}`);
46442
+ console.log(`${chalk253.bold(diagnosis.name)} ${chalk253.dim(diagnosis.url)}`);
46363
46443
  for (const hop of diagnosis.hops) {
46364
- const mark = hop.ok ? chalk251.green("\u2713") : chalk251.red("\u2717");
46444
+ const mark = hop.ok ? chalk253.green("\u2713") : chalk253.red("\u2717");
46365
46445
  console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
46366
- if (hop.remediation) console.log(` ${chalk251.yellow(hop.remediation)}`);
46446
+ if (hop.remediation) console.log(` ${chalk253.yellow(hop.remediation)}`);
46367
46447
  }
46368
46448
  }
46369
46449
 
@@ -46396,14 +46476,14 @@ async function doctorNodes(name, options2) {
46396
46476
  }
46397
46477
 
46398
46478
  // src/commands/sessions/nodes/linkNode.ts
46399
- import chalk253 from "chalk";
46479
+ import chalk255 from "chalk";
46400
46480
 
46401
46481
  // src/commands/sessions/nodes/notifyDaemonLinks.ts
46402
- import chalk252 from "chalk";
46482
+ import chalk254 from "chalk";
46403
46483
  async function notifyDaemonLinks() {
46404
46484
  if (!await isDaemonRunning()) {
46405
46485
  console.log(
46406
- chalk252.yellow(
46486
+ chalk254.yellow(
46407
46487
  "The sessions daemon is not running; it loads the links when it starts."
46408
46488
  )
46409
46489
  );
@@ -46411,11 +46491,11 @@ async function notifyDaemonLinks() {
46411
46491
  }
46412
46492
  try {
46413
46493
  await sendToDaemonAwaitAck({ type: "reload-links" });
46414
- console.log(chalk252.dim("The sessions daemon reloaded its links."));
46494
+ console.log(chalk254.dim("The sessions daemon reloaded its links."));
46415
46495
  } catch (error) {
46416
46496
  const message3 = error instanceof Error ? error.message : String(error);
46417
46497
  console.log(
46418
- chalk252.yellow(
46498
+ chalk254.yellow(
46419
46499
  `Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
46420
46500
  )
46421
46501
  );
@@ -46475,13 +46555,13 @@ async function linkNode(name, url, options2) {
46475
46555
  const link3 = buildLink(name, url, options2, others);
46476
46556
  await writeLinks([...others, link3]);
46477
46557
  console.log(
46478
- chalk253.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46558
+ chalk255.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46479
46559
  );
46480
46560
  await notifyDaemonLinks();
46481
46561
  }
46482
46562
 
46483
46563
  // src/commands/sessions/nodes/listNodes.ts
46484
- import chalk254 from "chalk";
46564
+ import chalk256 from "chalk";
46485
46565
  async function nodesReport() {
46486
46566
  const live = await queryNodes();
46487
46567
  if (live)
@@ -46498,10 +46578,10 @@ async function listNodes(options2) {
46498
46578
  console.log(JSON.stringify(report2, null, 2));
46499
46579
  return;
46500
46580
  }
46501
- console.log(`${report2.local} ${chalk254.dim("(this node)")}`);
46581
+ console.log(`${report2.local} ${chalk256.dim("(this node)")}`);
46502
46582
  if (!report2.daemonRunning)
46503
- console.log(chalk254.dim(" daemon not running; showing configured links"));
46504
- if (report2.links.length === 0) console.log(chalk254.dim(" no links"));
46583
+ console.log(chalk256.dim(" daemon not running; showing configured links"));
46584
+ if (report2.links.length === 0) console.log(chalk256.dim(" no links"));
46505
46585
  for (const link3 of report2.links) console.log(formatLink(link3));
46506
46586
  }
46507
46587
 
@@ -46540,16 +46620,16 @@ async function nodeLogs(name, options2) {
46540
46620
  }
46541
46621
 
46542
46622
  // src/commands/sessions/nodes/unlinkNode.ts
46543
- import chalk255 from "chalk";
46623
+ import chalk257 from "chalk";
46544
46624
  async function unlinkNode(name) {
46545
46625
  const links2 = readLinks();
46546
46626
  const remaining = links2.filter((link3) => link3.name !== name);
46547
46627
  if (remaining.length === links2.length) {
46548
- console.log(chalk255.yellow(`No link named ${name}`));
46628
+ console.log(chalk257.yellow(`No link named ${name}`));
46549
46629
  return;
46550
46630
  }
46551
46631
  await writeLinks(remaining);
46552
- console.log(chalk255.green(`Unlinked ${name}`));
46632
+ console.log(chalk257.green(`Unlinked ${name}`));
46553
46633
  await notifyDaemonLinks();
46554
46634
  }
46555
46635
 
@@ -46688,7 +46768,7 @@ async function renameSession(title) {
46688
46768
 
46689
46769
  // src/commands/sessions/summarise.ts
46690
46770
  import * as fs58 from "fs";
46691
- import chalk256 from "chalk";
46771
+ import chalk258 from "chalk";
46692
46772
 
46693
46773
  // src/commands/sessions/summarise/shared.ts
46694
46774
  import * as fs57 from "fs";
@@ -46747,22 +46827,22 @@ ${firstMessage}`);
46747
46827
  async function summarise2(options2) {
46748
46828
  const files = await discoverSessionFiles();
46749
46829
  if (files.length === 0) {
46750
- console.log(chalk256.yellow("No sessions found."));
46830
+ console.log(chalk258.yellow("No sessions found."));
46751
46831
  return;
46752
46832
  }
46753
46833
  const toProcess = selectCandidates(files, options2);
46754
46834
  if (toProcess.length === 0) {
46755
- console.log(chalk256.green("All sessions already summarised."));
46835
+ console.log(chalk258.green("All sessions already summarised."));
46756
46836
  return;
46757
46837
  }
46758
46838
  console.log(
46759
- chalk256.cyan(
46839
+ chalk258.cyan(
46760
46840
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
46761
46841
  )
46762
46842
  );
46763
46843
  const { succeeded, failed: failed3 } = processSessions(toProcess);
46764
46844
  console.log(
46765
- chalk256.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk256.yellow(`, ${failed3} skipped`) : "")
46845
+ chalk258.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk258.yellow(`, ${failed3} skipped`) : "")
46766
46846
  );
46767
46847
  }
46768
46848
  function selectCandidates(files, options2) {
@@ -46782,16 +46862,16 @@ function processSessions(files) {
46782
46862
  let failed3 = 0;
46783
46863
  for (let i = 0; i < files.length; i++) {
46784
46864
  const file = files[i];
46785
- process.stdout.write(chalk256.dim(` [${i + 1}/${files.length}] `));
46865
+ process.stdout.write(chalk258.dim(` [${i + 1}/${files.length}] `));
46786
46866
  const summary = summariseSession(file);
46787
46867
  if (summary) {
46788
46868
  writeSummary(file, summary);
46789
46869
  succeeded++;
46790
- process.stdout.write(`${chalk256.green("\u2713")} ${summary}
46870
+ process.stdout.write(`${chalk258.green("\u2713")} ${summary}
46791
46871
  `);
46792
46872
  } else {
46793
46873
  failed3++;
46794
- process.stdout.write(` ${chalk256.yellow("skip")}
46874
+ process.stdout.write(` ${chalk258.yellow("skip")}
46795
46875
  `);
46796
46876
  }
46797
46877
  }
@@ -46820,10 +46900,10 @@ function registerSessions(program2) {
46820
46900
  }
46821
46901
 
46822
46902
  // src/reportCliError.ts
46823
- import chalk257 from "chalk";
46903
+ import chalk259 from "chalk";
46824
46904
  function reportCliError(error) {
46825
46905
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
46826
- console.error(chalk257.red(error.message));
46906
+ console.error(chalk259.red(error.message));
46827
46907
  } else {
46828
46908
  console.error(error);
46829
46909
  }