@staff0rd/assist 0.721.2 → 0.722.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.721.2",
9
+ version: "0.722.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
296
296
  }
297
297
 
298
298
  // src/commands/backlog/getCurrentOrigin.ts
299
- function stripLeadingSlashes(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, never below 20, 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,8 +31511,8 @@ 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 chalk222 from "chalk";
31514
+ import path81 from "path";
31515
+ import chalk223 from "chalk";
31504
31516
 
31505
31517
  // src/commands/refactor/restructure/buildPlan.ts
31506
31518
  import path71 from "path";
@@ -31816,7 +31828,7 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
31816
31828
  }
31817
31829
 
31818
31830
  // src/commands/refactor/restructure/checkPlan.ts
31819
- import chalk217 from "chalk";
31831
+ import chalk218 from "chalk";
31820
31832
 
31821
31833
  // src/commands/refactor/restructure/applyCommand.ts
31822
31834
  import path72 from "path";
@@ -31825,83 +31837,109 @@ function applyCommand(scopeRoot) {
31825
31837
  return `assist refactor restructure ${root2} --apply`;
31826
31838
  }
31827
31839
 
31828
- // src/commands/refactor/restructure/displayDeepChains.ts
31840
+ // src/commands/refactor/restructure/displayDrift.ts
31841
+ import path73 from "path";
31829
31842
  import chalk215 from "chalk";
31830
- var shownChains = 10;
31831
- function pinSteps(apply) {
31832
- return [
31833
- "Pin feature modules until this check passes:",
31834
- "1. On each chain, pick the highest module that is a feature boundary: a route, view, page, panel, dialog or card. Never a hook, utility, style file or helper.",
31835
- "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.",
31836
- "3. Re-run this command. Repeat until the plan is within the limit.",
31837
- "4. If a chain has no sensible feature boundary, or a pin leaves one folder holding far more files than the rest, stop and report it.",
31838
- `Then run \`${apply}\`.`
31839
- ];
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));
31840
31860
  }
31861
+
31862
+ // src/commands/refactor/restructure/displayLayoutLimits.ts
31863
+ import chalk217 from "chalk";
31864
+
31865
+ // src/commands/refactor/restructure/displayDeepChains.ts
31866
+ import chalk216 from "chalk";
31867
+ var shownChains = 10;
31841
31868
  function formatChain(chain2) {
31842
31869
  const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
31843
31870
  return ` ${folders} > \u2026 [${chain2.tooDeep} file(s) too deep, down to depth ${chain2.deepest}]`;
31844
31871
  }
31845
- function displayDeepChains(chains, maxDepth, apply) {
31872
+ function displayDeepChains(chains, maxDepth) {
31846
31873
  if (chains.length === 0) return;
31847
31874
  const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
31848
31875
  console.log(
31849
- chalk215.red(
31876
+ chalk216.red(
31850
31877
  `
31851
31878
  Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
31852
31879
  )
31853
31880
  );
31854
31881
  console.log(
31855
- chalk215.bold(
31882
+ chalk216.bold(
31856
31883
  "Deep chains, as folder (files beneath), most files too deep first:"
31857
31884
  )
31858
31885
  );
31859
31886
  for (const chain2 of chains.slice(0, shownChains))
31860
31887
  console.log(formatChain(chain2));
31861
31888
  if (chains.length > shownChains)
31862
- console.log(chalk215.dim(` \u2026and ${chains.length - shownChains} more`));
31863
- console.log("");
31864
- for (const line of pinSteps(apply)) console.log(chalk215.yellow(line));
31889
+ console.log(chalk216.dim(` \u2026and ${chains.length - shownChains} more`));
31865
31890
  }
31866
31891
 
31867
- // src/commands/refactor/restructure/displayDrift.ts
31868
- import path73 from "path";
31869
- import chalk216 from "chalk";
31870
- var shownMoves = 20;
31871
- function displayDrift(plan2, listMoves) {
31872
- const rel = (file) => path73.relative(process.cwd(), file);
31873
- if (plan2.moves.length > 0) {
31874
- console.log(
31875
- chalk216.red(
31876
- `${plan2.moves.length} file(s) drift from the plan${listMoves ? ":" : "."}`
31877
- )
31878
- );
31879
- if (listMoves) {
31880
- for (const move2 of plan2.moves.slice(0, shownMoves))
31881
- console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
31882
- if (plan2.moves.length > shownMoves)
31883
- console.log(chalk216.dim(` \u2026and ${plan2.moves.length - shownMoves} more`));
31884
- }
31885
- }
31886
- for (const error of plan2.errors) console.log(chalk216.red(error));
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);
31922
+ console.log("");
31923
+ for (const line of pinSteps(apply)) console.log(chalk217.yellow(line));
31887
31924
  }
31888
31925
 
31889
31926
  // src/commands/refactor/restructure/checkPlan.ts
31890
- function checkPlan(plan2, chains, maxDepth) {
31927
+ function checkPlan(plan2, limits) {
31891
31928
  const apply = applyCommand(plan2.scopeRoot);
31892
- displayDrift(plan2, chains.length === 0);
31893
- displayDeepChains(chains, maxDepth, apply);
31894
- if (chains.length > 0 || plan2.errors.length > 0) process.exit(1);
31929
+ const exceeds = exceedsLayoutLimits(limits);
31930
+ displayDrift(plan2, !exceeds);
31931
+ displayLayoutLimits(limits, apply);
31932
+ if (exceeds || plan2.errors.length > 0) process.exit(1);
31895
31933
  if (plan2.moves.length > 0) {
31896
31934
  console.log(
31897
- chalk217.yellow(
31935
+ chalk218.yellow(
31898
31936
  `
31899
31937
  Run \`${apply}\` to move the files and rewrite their imports.`
31900
31938
  )
31901
31939
  );
31902
31940
  process.exit(1);
31903
31941
  }
31904
- console.log(chalk217.green("Layout matches the restructure plan"));
31942
+ console.log(chalk218.green("Layout matches the restructure plan"));
31905
31943
  }
31906
31944
 
31907
31945
  // src/commands/refactor/restructure/findDeepChains.ts
@@ -31942,12 +31980,43 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
31942
31980
  return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
31943
31981
  }
31944
31982
 
31945
- // src/commands/refactor/restructure/partitionIgnored.ts
31983
+ // src/commands/refactor/restructure/findLargeFolders.ts
31946
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
+ var minFolderLimit = 20;
31999
+ function checkLayoutLimits(plan2, settings) {
32000
+ const targets = [...plan2.targets.values()];
32001
+ const share = Math.ceil(targets.length * settings.maxFolderPercent / 100);
32002
+ const folderLimit = Math.min(
32003
+ Math.max(share, minFolderLimit),
32004
+ settings.maxFolderFiles
32005
+ );
32006
+ return {
32007
+ maxDepth: settings.maxDepth,
32008
+ chains: findDeepChains(targets, plan2.scopeRoot, settings.maxDepth),
32009
+ folderLimit,
32010
+ largeFolders: findLargeFolders(targets, plan2.scopeRoot, folderLimit)
32011
+ };
32012
+ }
32013
+
32014
+ // src/commands/refactor/restructure/partitionIgnored.ts
32015
+ import path76 from "path";
31947
32016
  import { minimatch as minimatch4 } from "minimatch";
31948
32017
  function partitionIgnored(files) {
31949
32018
  const globs = loadConfig().restructure?.ignore ?? [];
31950
- const isIgnored = (file) => globs.some((glob) => minimatch4(path75.relative(process.cwd(), file), glob));
32019
+ const isIgnored = (file) => globs.some((glob) => minimatch4(path76.relative(process.cwd(), file), glob));
31951
32020
  return {
31952
32021
  scoped: files.filter((f) => !isIgnored(f)),
31953
32022
  ignored: files.filter(isIgnored)
@@ -31955,17 +32024,17 @@ function partitionIgnored(files) {
31955
32024
  }
31956
32025
 
31957
32026
  // src/commands/refactor/restructure/runPlan.ts
31958
- import chalk221 from "chalk";
32027
+ import chalk222 from "chalk";
31959
32028
 
31960
32029
  // src/commands/refactor/restructure/applyPlan.ts
31961
- import chalk219 from "chalk";
32030
+ import chalk220 from "chalk";
31962
32031
 
31963
32032
  // src/commands/refactor/restructure/executePlan.ts
31964
32033
  import fs37 from "fs";
31965
- import path76 from "path";
31966
- import chalk218 from "chalk";
32034
+ import path77 from "path";
32035
+ import chalk219 from "chalk";
31967
32036
  function relPath(file) {
31968
- return path76.relative(process.cwd(), file);
32037
+ return path77.relative(process.cwd(), file);
31969
32038
  }
31970
32039
  function stagingPath(move2, index3) {
31971
32040
  return `${move2.from}.restructure-${process.pid}-${index3}`;
@@ -31977,34 +32046,34 @@ function moveFiles(moves) {
31977
32046
  return { move: move2, staging };
31978
32047
  });
31979
32048
  for (const { move: move2, staging } of staged) {
31980
- fs37.mkdirSync(path76.dirname(move2.to), { recursive: true });
32049
+ fs37.mkdirSync(path77.dirname(move2.to), { recursive: true });
31981
32050
  fs37.renameSync(staging, move2.to);
31982
32051
  console.log(
31983
- chalk218.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
32052
+ chalk219.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
31984
32053
  );
31985
32054
  }
31986
32055
  }
31987
32056
  function removeIfEmpty(dir) {
31988
32057
  if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
31989
32058
  fs37.rmdirSync(dir);
31990
- console.log(chalk218.dim(` Removed empty directory ${relPath(dir)}`));
32059
+ console.log(chalk219.dim(` Removed empty directory ${relPath(dir)}`));
31991
32060
  return true;
31992
32061
  }
31993
32062
  function removeEmptyDirectories(dirs, scopeRoot) {
31994
32063
  const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
31995
32064
  for (let dir of deepestFirst) {
31996
- while (dir.startsWith(`${scopeRoot}${path76.sep}`) && removeIfEmpty(dir))
31997
- dir = path76.dirname(dir);
32065
+ while (dir.startsWith(`${scopeRoot}${path77.sep}`) && removeIfEmpty(dir))
32066
+ dir = path77.dirname(dir);
31998
32067
  }
31999
32068
  }
32000
32069
  function executePlan(plan2) {
32001
32070
  for (const [file, content] of applyRewrites(plan2.rewrites)) {
32002
32071
  fs37.writeFileSync(file, content, "utf8");
32003
- console.log(chalk218.cyan(` Rewrote imports in ${relPath(file)}`));
32072
+ console.log(chalk219.cyan(` Rewrote imports in ${relPath(file)}`));
32004
32073
  }
32005
32074
  moveFiles(plan2.moves);
32006
32075
  removeEmptyDirectories(
32007
- plan2.moves.map((m) => path76.dirname(m.from)),
32076
+ plan2.moves.map((m) => path77.dirname(m.from)),
32008
32077
  plan2.scopeRoot
32009
32078
  );
32010
32079
  }
@@ -32012,26 +32081,26 @@ function executePlan(plan2) {
32012
32081
  // src/commands/refactor/restructure/applyPlan.ts
32013
32082
  function applyPlan(plan2) {
32014
32083
  if (plan2.errors.length > 0) {
32015
- console.log(chalk219.red("\nResolve the errors above before applying."));
32084
+ console.log(chalk220.red("\nResolve the errors above before applying."));
32016
32085
  process.exit(1);
32017
32086
  }
32018
- console.log(chalk219.bold("\nApplying changes..."));
32087
+ console.log(chalk220.bold("\nApplying changes..."));
32019
32088
  executePlan(plan2);
32020
- console.log(chalk219.green("\nRestructuring complete"));
32089
+ console.log(chalk220.green("\nRestructuring complete"));
32021
32090
  }
32022
32091
 
32023
32092
  // src/commands/refactor/restructure/displayPlan.ts
32024
- import path79 from "path";
32025
- import chalk220 from "chalk";
32093
+ import path80 from "path";
32094
+ import chalk221 from "chalk";
32026
32095
 
32027
32096
  // src/commands/refactor/restructure/computeDepthStats.ts
32028
- import path77 from "path";
32097
+ import path78 from "path";
32029
32098
  function computeDepthStats(targets, scopeRoot) {
32030
32099
  const distribution = /* @__PURE__ */ new Map();
32031
32100
  let max = 0;
32032
32101
  for (const target of targets) {
32033
- const dir = path77.relative(scopeRoot, path77.dirname(target));
32034
- const depth = dir === "" ? 0 : dir.split(path77.sep).length;
32102
+ const dir = path78.relative(scopeRoot, path78.dirname(target));
32103
+ const depth = dir === "" ? 0 : dir.split(path78.sep).length;
32035
32104
  distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
32036
32105
  max = Math.max(max, depth);
32037
32106
  }
@@ -32039,7 +32108,7 @@ function computeDepthStats(targets, scopeRoot) {
32039
32108
  }
32040
32109
 
32041
32110
  // src/commands/refactor/restructure/formatTree.ts
32042
- import path78 from "path";
32111
+ import path79 from "path";
32043
32112
  function insert(root2, parts) {
32044
32113
  let node = root2;
32045
32114
  for (const part of parts) {
@@ -32061,7 +32130,7 @@ function render(node, indent3, lines2) {
32061
32130
  function formatTree(files, scopeRoot) {
32062
32131
  const root2 = /* @__PURE__ */ new Map();
32063
32132
  for (const file of files)
32064
- insert(root2, path78.relative(scopeRoot, file).split(path78.sep));
32133
+ insert(root2, path79.relative(scopeRoot, file).split(path79.sep));
32065
32134
  const lines2 = [];
32066
32135
  render(root2, "", lines2);
32067
32136
  return lines2;
@@ -32069,21 +32138,21 @@ function formatTree(files, scopeRoot) {
32069
32138
 
32070
32139
  // src/commands/refactor/restructure/displayPlan.ts
32071
32140
  function relPath2(filePath) {
32072
- return path79.relative(process.cwd(), filePath);
32141
+ return path80.relative(process.cwd(), filePath);
32073
32142
  }
32074
32143
  function displayMoves(plan2) {
32075
32144
  if (plan2.moves.length === 0) return;
32076
- console.log(chalk220.bold("\nFile moves:"));
32145
+ console.log(chalk221.bold("\nFile moves:"));
32077
32146
  for (const move2 of plan2.moves) {
32078
32147
  console.log(
32079
- ` ${chalk220.red(relPath2(move2.from))} \u2192 ${chalk220.green(relPath2(move2.to))}`
32148
+ ` ${chalk221.red(relPath2(move2.from))} \u2192 ${chalk221.green(relPath2(move2.to))}`
32080
32149
  );
32081
- console.log(chalk220.dim(` ${move2.reason}`));
32150
+ console.log(chalk221.dim(` ${move2.reason}`));
32082
32151
  }
32083
32152
  }
32084
32153
  function displayTree(plan2) {
32085
32154
  console.log(
32086
- chalk220.bold(`
32155
+ chalk221.bold(`
32087
32156
  Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
32088
32157
  );
32089
32158
  for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
@@ -32094,15 +32163,15 @@ function displayDepthStats(plan2) {
32094
32163
  plan2.targets.values(),
32095
32164
  plan2.scopeRoot
32096
32165
  );
32097
- console.log(chalk220.bold(`
32166
+ console.log(chalk221.bold(`
32098
32167
  Depth (max ${max}):`));
32099
32168
  for (const depth of [...distribution.keys()].sort((a, b) => a - b))
32100
32169
  console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
32101
32170
  }
32102
32171
  function displayErrors(errors) {
32103
32172
  if (errors.length === 0) return;
32104
- console.log(chalk220.red("\nErrors:"));
32105
- for (const error of errors) console.log(chalk220.red(` ${error}`));
32173
+ console.log(chalk221.red("\nErrors:"));
32174
+ for (const error of errors) console.log(chalk221.red(` ${error}`));
32106
32175
  }
32107
32176
  function displayPlan2(plan2) {
32108
32177
  displayMoves(plan2);
@@ -32111,7 +32180,7 @@ function displayPlan2(plan2) {
32111
32180
  displayErrors(plan2.errors);
32112
32181
  const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
32113
32182
  console.log(
32114
- chalk220.dim(
32183
+ chalk221.dim(
32115
32184
  `
32116
32185
  Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
32117
32186
  )
@@ -32119,15 +32188,15 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
32119
32188
  }
32120
32189
 
32121
32190
  // src/commands/refactor/restructure/runPlan.ts
32122
- function runPlan(plan2, chains, maxDepth, apply) {
32191
+ function runPlan(plan2, limits, apply) {
32123
32192
  displayPlan2(plan2);
32124
- displayDeepChains(chains, maxDepth, applyCommand(plan2.scopeRoot));
32193
+ displayLayoutLimits(limits, applyCommand(plan2.scopeRoot));
32125
32194
  if (plan2.moves.length === 0 && plan2.errors.length === 0) {
32126
- console.log(chalk221.green("No restructuring needed"));
32195
+ console.log(chalk222.green("No restructuring needed"));
32127
32196
  return;
32128
32197
  }
32129
32198
  if (!apply) {
32130
- console.log(chalk221.dim("\nDry run. Use --apply to execute."));
32199
+ console.log(chalk222.dim("\nDry run. Use --apply to execute."));
32131
32200
  return;
32132
32201
  }
32133
32202
  applyPlan(plan2);
@@ -32135,23 +32204,32 @@ function runPlan(plan2, chains, maxDepth, apply) {
32135
32204
 
32136
32205
  // src/commands/refactor/restructure.ts
32137
32206
  async function restructure(root2, options2 = {}) {
32138
- const scopeRoot = path80.resolve(root2 ?? "src");
32207
+ const scopeRoot = path81.resolve(root2 ?? "src");
32139
32208
  if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
32140
- console.log(chalk222.red(`Not a directory: ${root2 ?? "src"}`));
32209
+ console.log(chalk223.red(`Not a directory: ${root2 ?? "src"}`));
32141
32210
  process.exit(1);
32142
32211
  }
32143
32212
  const found = [];
32144
32213
  walkSourceFiles(scopeRoot, found);
32145
32214
  const { scoped, ignored } = partitionIgnored(found);
32146
32215
  if (scoped.length === 0) {
32147
- console.log(chalk222.yellow("No files found under root"));
32216
+ console.log(chalk223.yellow("No files found under root"));
32148
32217
  return;
32149
32218
  }
32150
- const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
32219
+ const {
32220
+ pin: pin2 = [],
32221
+ maxDepth = 10,
32222
+ maxFolderPercent = 15,
32223
+ maxFolderFiles = 150
32224
+ } = loadConfig().restructure ?? {};
32151
32225
  const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
32152
- const chains = findDeepChains(plan2.targets.values(), scopeRoot, maxDepth);
32153
- if (options2.check) return checkPlan(plan2, chains, maxDepth);
32154
- runPlan(plan2, chains, maxDepth, options2.apply === true);
32226
+ const limits = checkLayoutLimits(plan2, {
32227
+ maxDepth,
32228
+ maxFolderPercent,
32229
+ maxFolderFiles
32230
+ });
32231
+ if (options2.check) return checkPlan(plan2, limits);
32232
+ runPlan(plan2, limits, options2.apply === true);
32155
32233
  }
32156
32234
 
32157
32235
  // src/commands/registerRefactor.ts
@@ -32206,7 +32284,7 @@ async function checkoutOnlySession(number) {
32206
32284
  }
32207
32285
 
32208
32286
  // src/commands/review/highLevel/configureHighLevelReview.ts
32209
- import chalk226 from "chalk";
32287
+ import chalk227 from "chalk";
32210
32288
 
32211
32289
  // src/commands/config/promptConfigScope.ts
32212
32290
  import Enquirer3 from "enquirer";
@@ -32232,7 +32310,7 @@ async function promptConfigScope() {
32232
32310
  }
32233
32311
 
32234
32312
  // src/commands/config/resolveConfigKeyAnswer.ts
32235
- import chalk223 from "chalk";
32313
+ import chalk224 from "chalk";
32236
32314
  async function resolveConfigKeyAnswer(question, supplied) {
32237
32315
  if (supplied !== void 0) return coerceSupplied(question.key, supplied);
32238
32316
  for (; ; ) {
@@ -32240,7 +32318,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
32240
32318
  if (answer === "") return void 0;
32241
32319
  const coercion = coerceCliConfigValue(question.key, answer);
32242
32320
  if (coercion.ok) return coercion.value;
32243
- console.error(chalk223.red(coercion.error));
32321
+ console.error(chalk224.red(coercion.error));
32244
32322
  }
32245
32323
  }
32246
32324
  function coerceSupplied(key, supplied) {
@@ -32301,7 +32379,7 @@ function suggestGlobs(current, proposed) {
32301
32379
  }
32302
32380
 
32303
32381
  // src/commands/review/highLevel/parseConfigureAnswers.ts
32304
- import chalk224 from "chalk";
32382
+ import chalk225 from "chalk";
32305
32383
  function parseConfigureAnswers(answers) {
32306
32384
  const known = Object.values(highLevelConfigKeys);
32307
32385
  const parsed = {};
@@ -32319,13 +32397,13 @@ function answersCoverEveryKey(answers) {
32319
32397
  return Object.values(highLevelConfigKeys).every((key) => key in answers);
32320
32398
  }
32321
32399
  function exitWith(message3) {
32322
- console.error(chalk224.red(`Error: ${message3}.`));
32400
+ console.error(chalk225.red(`Error: ${message3}.`));
32323
32401
  process.exit(1);
32324
32402
  }
32325
32403
 
32326
32404
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
32327
32405
  import { execFileSync as execFileSync20 } from "child_process";
32328
- import chalk225 from "chalk";
32406
+ import chalk226 from "chalk";
32329
32407
 
32330
32408
  // src/commands/review/highLevel/buildGlobProposalPrompt.ts
32331
32409
  function buildGlobProposalPrompt(tree) {
@@ -32418,12 +32496,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
32418
32496
  const tree = summariseRepoTree(cwd);
32419
32497
  if (tree === "") return NOTHING_PROPOSED;
32420
32498
  console.log(
32421
- chalk225.dim("Asking Claude to propose globs from the repo's own tree...")
32499
+ chalk226.dim("Asking Claude to propose globs from the repo's own tree...")
32422
32500
  );
32423
32501
  const output = askClaude(buildGlobProposalPrompt(tree), cwd);
32424
32502
  if (output === void 0) {
32425
32503
  console.log(
32426
- chalk225.yellow(
32504
+ chalk226.yellow(
32427
32505
  "Claude proposed nothing; answer each key from its current value."
32428
32506
  )
32429
32507
  );
@@ -32479,25 +32557,25 @@ function asConfigKeyScope(value) {
32479
32557
  function reportConfigured(result) {
32480
32558
  for (const write of result.written)
32481
32559
  console.log(
32482
- chalk226.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32560
+ chalk227.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32483
32561
  );
32484
- for (const key of result.skipped) console.log(chalk226.dim(`Left ${key} unset`));
32485
- console.log(chalk226.dim(`Written to ${result.target}`));
32562
+ for (const key of result.skipped) console.log(chalk227.dim(`Left ${key} unset`));
32563
+ console.log(chalk227.dim(`Written to ${result.target}`));
32486
32564
  }
32487
32565
 
32488
32566
  // src/commands/review/highLevel/announceSavedReview.ts
32489
- import chalk227 from "chalk";
32567
+ import chalk228 from "chalk";
32490
32568
  function announceSavedReview(subject, force) {
32491
32569
  const head = subject.headSha.slice(0, 7);
32492
32570
  if (subject.saved)
32493
32571
  console.log(
32494
- chalk227.dim(
32572
+ chalk228.dim(
32495
32573
  `Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
32496
32574
  )
32497
32575
  );
32498
32576
  else if (force)
32499
32577
  console.log(
32500
- chalk227.dim(
32578
+ chalk228.dim(
32501
32579
  `Discarding any review saved for ${head} and starting fresh (--force).`
32502
32580
  )
32503
32581
  );
@@ -32526,8 +32604,8 @@ function groupFilesByDirectory(files) {
32526
32604
  }
32527
32605
 
32528
32606
  // src/commands/review/highLevel/buildHighLevelTree.ts
32529
- function basename19(path106) {
32530
- return path106.slice(path106.lastIndexOf("/") + 1);
32607
+ function basename19(path107) {
32608
+ return path107.slice(path107.lastIndexOf("/") + 1);
32531
32609
  }
32532
32610
  function sum(nodes, key) {
32533
32611
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32550,19 +32628,19 @@ function nodesOf(at2, prefix2) {
32550
32628
  }
32551
32629
  function collapsedDirNode(name, at2, prefix2) {
32552
32630
  let label2 = name;
32553
- let path106 = prefix2 ? `${prefix2}/${name}` : name;
32631
+ let path107 = prefix2 ? `${prefix2}/${name}` : name;
32554
32632
  let node = at2;
32555
32633
  while (node.files.length === 0 && node.dirs.size === 1) {
32556
32634
  const [childName, child] = [...node.dirs][0];
32557
32635
  label2 = `${label2}/${childName}`;
32558
- path106 = `${path106}/${childName}`;
32636
+ path107 = `${path107}/${childName}`;
32559
32637
  node = child;
32560
32638
  }
32561
- const children = nodesOf(node, path106);
32639
+ const children = nodesOf(node, path107);
32562
32640
  return {
32563
32641
  kind: "dir",
32564
32642
  name: label2,
32565
- path: path106,
32643
+ path: path107,
32566
32644
  additions: sum(children, "additions"),
32567
32645
  deletions: sum(children, "deletions"),
32568
32646
  children
@@ -32820,8 +32898,8 @@ function toStatus(status3) {
32820
32898
  if (status3 === "removed") return "removed";
32821
32899
  return "modified";
32822
32900
  }
32823
- function diffUrl(repo, prNumber, path106) {
32824
- const anchor = createHash3("sha256").update(path106).digest("hex");
32901
+ function diffUrl(repo, prNumber, path107) {
32902
+ const anchor = createHash3("sha256").update(path107).digest("hex");
32825
32903
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32826
32904
  }
32827
32905
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32877,10 +32955,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32877
32955
 
32878
32956
  // src/commands/review/highLevel/loadHighLevelReview.ts
32879
32957
  function loadHighLevelReview(repo, headRef, headSha) {
32880
- const path106 = highLevelReviewPath(repo, headRef, headSha);
32881
- if (!existsSync64(path106)) return void 0;
32958
+ const path107 = highLevelReviewPath(repo, headRef, headSha);
32959
+ if (!existsSync64(path107)) return void 0;
32882
32960
  try {
32883
- return JSON.parse(readFileSync47(path106, "utf8"));
32961
+ return JSON.parse(readFileSync47(path107, "utf8"));
32884
32962
  } catch {
32885
32963
  return void 0;
32886
32964
  }
@@ -32891,8 +32969,8 @@ import { minimatch as minimatch7 } from "minimatch";
32891
32969
  function selectCriticalDiffs(files, criticalPaths) {
32892
32970
  if (criticalPaths.length === 0) return [];
32893
32971
  return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
32894
- ({ path: path106, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32895
- path: path106,
32972
+ ({ path: path107, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32973
+ path: path107,
32896
32974
  status: status3,
32897
32975
  additions,
32898
32976
  deletions,
@@ -33007,11 +33085,11 @@ function highLevelPreviewPayload(subject) {
33007
33085
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
33008
33086
  import { dirname as dirname36 } from "path";
33009
33087
  function saveHighLevelReview(record) {
33010
- const path106 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
33011
- mkdirSync22(dirname36(path106), { recursive: true });
33012
- writeFileSync39(path106, `${JSON.stringify(record, null, 2)}
33088
+ const path107 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
33089
+ mkdirSync22(dirname36(path107), { recursive: true });
33090
+ writeFileSync39(path107, `${JSON.stringify(record, null, 2)}
33013
33091
  `);
33014
- return path106;
33092
+ return path107;
33015
33093
  }
33016
33094
 
33017
33095
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -33030,63 +33108,63 @@ async function openHighLevelOverlay(sessionId, subject) {
33030
33108
  { rejectIsOutcome: true }
33031
33109
  );
33032
33110
  const record = buildHighLevelRecord(subject, decision);
33033
- const path106 = saveHighLevelReview(record);
33111
+ const path107 = saveHighLevelReview(record);
33034
33112
  console.log(`Verdict: ${record.verdict}`);
33035
- console.log(`Saved ${path106}`);
33113
+ console.log(`Saved ${path107}`);
33036
33114
  console.log("Nothing was posted to GitHub.");
33037
33115
  return record;
33038
33116
  }
33039
33117
 
33040
33118
  // src/commands/review/highLevel/printHighLevelChecklist.ts
33041
- import chalk231 from "chalk";
33119
+ import chalk232 from "chalk";
33042
33120
 
33043
33121
  // src/commands/review/highLevel/formatCriticalDiffs.ts
33044
- import chalk228 from "chalk";
33122
+ import chalk229 from "chalk";
33045
33123
  var PATCH_LINE_COLOURS = {
33046
- "+": chalk228.green,
33047
- "-": chalk228.red,
33048
- "@": chalk228.cyan
33124
+ "+": chalk229.green,
33125
+ "-": chalk229.red,
33126
+ "@": chalk229.cyan
33049
33127
  };
33050
33128
  function formatPatch(patch2) {
33051
33129
  return patch2.split("\n").map(
33052
- (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk228.dim)(line)}`
33130
+ (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk229.dim)(line)}`
33053
33131
  );
33054
33132
  }
33055
33133
  function formatDiff(diff3) {
33056
33134
  return [
33057
33135
  "",
33058
- ` ${chalk228.bold(diff3.path)} ${chalk228.dim(`(${diff3.status})`)} ${chalk228.green(`+${diff3.additions}`)} ${chalk228.red(`-${diff3.deletions}`)}`,
33059
- ...diff3.patch === null ? [` ${chalk228.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33136
+ ` ${chalk229.bold(diff3.path)} ${chalk229.dim(`(${diff3.status})`)} ${chalk229.green(`+${diff3.additions}`)} ${chalk229.red(`-${diff3.deletions}`)}`,
33137
+ ...diff3.patch === null ? [` ${chalk229.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33060
33138
  ];
33061
33139
  }
33062
33140
  function formatCriticalDiffs(diffs, criticalPaths) {
33063
33141
  if (criticalPaths.length === 0)
33064
- return `${chalk228.bold.underline("Critical diffs")}
33065
- ${chalk228.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33142
+ return `${chalk229.bold.underline("Critical diffs")}
33143
+ ${chalk229.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33066
33144
  if (diffs.length === 0)
33067
- return `${chalk228.bold.underline("Critical diffs")}
33068
- ${chalk228.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33145
+ return `${chalk229.bold.underline("Critical diffs")}
33146
+ ${chalk229.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33069
33147
  return [
33070
- chalk228.bold.underline("Critical diffs"),
33148
+ chalk229.bold.underline("Critical diffs"),
33071
33149
  ...diffs.flatMap(formatDiff)
33072
33150
  ].join("\n");
33073
33151
  }
33074
33152
 
33075
33153
  // src/commands/review/highLevel/formatHighLevelChecklist.ts
33076
- import chalk229 from "chalk";
33154
+ import chalk230 from "chalk";
33077
33155
  var MARKERS = {
33078
- pass: () => chalk229.green("\u2714"),
33079
- fail: () => chalk229.red("\u2718"),
33080
- manual: () => chalk229.yellow("\u25A1")
33156
+ pass: () => chalk230.green("\u2714"),
33157
+ fail: () => chalk230.red("\u2718"),
33158
+ manual: () => chalk230.yellow("\u25A1")
33081
33159
  };
33082
33160
  function formatCheck(check2) {
33083
- const title = check2.status === "fail" ? chalk229.red(check2.title) : chalk229.bold(check2.title);
33161
+ const title = check2.status === "fail" ? chalk230.red(check2.title) : chalk230.bold(check2.title);
33084
33162
  return ` ${MARKERS[check2.status]()} ${title}
33085
- ${chalk229.dim(check2.reason)}`;
33163
+ ${chalk230.dim(check2.reason)}`;
33086
33164
  }
33087
33165
  function formatGroup(heading2, checks2) {
33088
33166
  if (checks2.length === 0) return [];
33089
- return ["", chalk229.bold.underline(heading2), ...checks2.map(formatCheck)];
33167
+ return ["", chalk230.bold.underline(heading2), ...checks2.map(formatCheck)];
33090
33168
  }
33091
33169
  function formatHighLevelChecklist(checks2) {
33092
33170
  const deterministic = checks2.filter(
@@ -33095,7 +33173,7 @@ function formatHighLevelChecklist(checks2) {
33095
33173
  const failed3 = deterministic.filter(
33096
33174
  (check2) => check2.status === "fail"
33097
33175
  ).length;
33098
- const summary = failed3 === 0 ? chalk229.green(`All ${deterministic.length} deterministic checks pass`) : chalk229.red(
33176
+ const summary = failed3 === 0 ? chalk230.green(`All ${deterministic.length} deterministic checks pass`) : chalk230.red(
33099
33177
  `${failed3} of ${deterministic.length} deterministic checks fail`
33100
33178
  );
33101
33179
  return [
@@ -33110,30 +33188,30 @@ function formatHighLevelChecklist(checks2) {
33110
33188
  }
33111
33189
 
33112
33190
  // src/commands/review/highLevel/formatHighLevelStructure.ts
33113
- import chalk230 from "chalk";
33191
+ import chalk231 from "chalk";
33114
33192
  var STATUS_MARKERS = {
33115
- added: () => chalk230.green("A"),
33116
- removed: () => chalk230.red("D"),
33117
- modified: () => chalk230.yellow("M")
33193
+ added: () => chalk231.green("A"),
33194
+ removed: () => chalk231.red("D"),
33195
+ modified: () => chalk231.yellow("M")
33118
33196
  };
33119
33197
  function counts(additions, deletions) {
33120
- return `${chalk230.green(`+${additions}`)} ${chalk230.red(`-${deletions}`)}`;
33198
+ return `${chalk231.green(`+${additions}`)} ${chalk231.red(`-${deletions}`)}`;
33121
33199
  }
33122
33200
  function formatNode(node, indent3) {
33123
33201
  if (node.kind === "file")
33124
33202
  return [
33125
- `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk230.dim(counts(node.additions, node.deletions))}`
33203
+ `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk231.dim(counts(node.additions, node.deletions))}`
33126
33204
  ];
33127
33205
  const dir = node;
33128
33206
  return [
33129
- `${indent3}${chalk230.bold(`${dir.name}/`)} ${chalk230.dim(counts(dir.additions, dir.deletions))}`,
33207
+ `${indent3}${chalk231.bold(`${dir.name}/`)} ${chalk231.dim(counts(dir.additions, dir.deletions))}`,
33130
33208
  ...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
33131
33209
  ];
33132
33210
  }
33133
33211
  function formatHighLevelStructure(structure) {
33134
33212
  const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
33135
33213
  return [
33136
- chalk230.bold.underline("Structure"),
33214
+ chalk231.bold.underline("Structure"),
33137
33215
  ` ${summary}`,
33138
33216
  ...structure.tree.flatMap((node) => formatNode(node, " "))
33139
33217
  ].join("\n");
@@ -33142,10 +33220,10 @@ function formatHighLevelStructure(structure) {
33142
33220
  // src/commands/review/highLevel/printHighLevelChecklist.ts
33143
33221
  function printHighLevelChecklist(subject) {
33144
33222
  console.log(
33145
- chalk231.bold(
33223
+ chalk232.bold(
33146
33224
  `High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
33147
33225
  ),
33148
- chalk231.dim(
33226
+ chalk232.dim(
33149
33227
  `\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
33150
33228
  )
33151
33229
  );
@@ -33157,12 +33235,12 @@ function printHighLevelChecklist(subject) {
33157
33235
  formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
33158
33236
  );
33159
33237
  console.log(
33160
- chalk231.dim(
33238
+ chalk232.dim(
33161
33239
  "\nManual items are for the reviewer to judge; see docs/high-level-review.md."
33162
33240
  )
33163
33241
  );
33164
33242
  console.log(
33165
- chalk231.dim(
33243
+ chalk232.dim(
33166
33244
  "Run this inside an assist session to step through the checklist in the web overlay."
33167
33245
  )
33168
33246
  );
@@ -33796,18 +33874,18 @@ function partitionFindingsByDiff(findings, index3) {
33796
33874
  }
33797
33875
 
33798
33876
  // src/commands/review/warnOutOfDiff.ts
33799
- import chalk232 from "chalk";
33877
+ import chalk233 from "chalk";
33800
33878
  function warnOutOfDiff(outOfDiff) {
33801
33879
  if (outOfDiff.length === 0) return;
33802
33880
  console.warn(
33803
- chalk232.yellow(
33881
+ chalk233.yellow(
33804
33882
  `Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
33805
33883
  )
33806
33884
  );
33807
33885
  for (const finding of outOfDiff) {
33808
33886
  const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
33809
33887
  console.warn(
33810
- ` ${chalk232.yellow("\xB7")} ${finding.title} ${chalk232.dim(
33888
+ ` ${chalk233.yellow("\xB7")} ${finding.title} ${chalk233.dim(
33811
33889
  `(${finding.file}:${range})`
33812
33890
  )}`
33813
33891
  );
@@ -33831,18 +33909,18 @@ function selectInDiffFindings(lineBound, prDiff) {
33831
33909
  }
33832
33910
 
33833
33911
  // src/commands/review/warnUnlocated.ts
33834
- import chalk233 from "chalk";
33912
+ import chalk234 from "chalk";
33835
33913
  function warnUnlocated(unlocated) {
33836
33914
  if (unlocated.length === 0) return;
33837
33915
  console.warn(
33838
- chalk233.yellow(
33916
+ chalk234.yellow(
33839
33917
  `Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
33840
33918
  )
33841
33919
  );
33842
33920
  for (const finding of unlocated) {
33843
- const where = finding.location || chalk233.dim("missing");
33921
+ const where = finding.location || chalk234.dim("missing");
33844
33922
  console.warn(
33845
- ` ${chalk233.yellow("\xB7")} ${finding.title} ${chalk233.dim(`(${where})`)}`
33923
+ ` ${chalk234.yellow("\xB7")} ${finding.title} ${chalk234.dim(`(${where})`)}`
33846
33924
  );
33847
33925
  }
33848
33926
  }
@@ -34047,8 +34125,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
34047
34125
  // src/commands/review/prepareReviewDir.ts
34048
34126
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
34049
34127
  function clearReviewFiles(paths) {
34050
- for (const path106 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34051
- if (existsSync65(path106)) unlinkSync18(path106);
34128
+ for (const path107 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34129
+ if (existsSync65(path107)) unlinkSync18(path107);
34052
34130
  }
34053
34131
  }
34054
34132
  function prepareReviewDir(paths, requestBody, force) {
@@ -35286,8 +35364,8 @@ function registerReview(program2) {
35286
35364
 
35287
35365
  // src/commands/rules/addRule.ts
35288
35366
  import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
35289
- import path85 from "path";
35290
- import chalk234 from "chalk";
35367
+ import path86 from "path";
35368
+ import chalk235 from "chalk";
35291
35369
 
35292
35370
  // src/commands/rules/insertRuleBullet.ts
35293
35371
  function ruleBullet({ code, title, text: text18 }) {
@@ -35314,7 +35392,7 @@ import { readFileSync as readFileSync50 } from "fs";
35314
35392
 
35315
35393
  // src/commands/rules/findClaudeFiles.ts
35316
35394
  import { readdirSync as readdirSync13 } from "fs";
35317
- import path81 from "path";
35395
+ import path82 from "path";
35318
35396
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
35319
35397
  function findClaudeFiles(dir) {
35320
35398
  const results = [];
@@ -35322,9 +35400,9 @@ function findClaudeFiles(dir) {
35322
35400
  if (entry.isDirectory()) {
35323
35401
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
35324
35402
  continue;
35325
- results.push(...findClaudeFiles(path81.join(dir, entry.name)));
35403
+ results.push(...findClaudeFiles(path82.join(dir, entry.name)));
35326
35404
  } else if (entry.name === "CLAUDE.md") {
35327
- results.push(path81.join(dir, entry.name));
35405
+ results.push(path82.join(dir, entry.name));
35328
35406
  }
35329
35407
  }
35330
35408
  return results;
@@ -35343,34 +35421,34 @@ function nextRuleCode(root2) {
35343
35421
 
35344
35422
  // src/commands/rules/resolveRuleScope.ts
35345
35423
  import { existsSync as existsSync68 } from "fs";
35346
- import path82 from "path";
35424
+ import path83 from "path";
35347
35425
  function resolveRuleScope(target) {
35348
- const resolved = path82.resolve(target);
35349
- if (path82.basename(resolved) === "CLAUDE.md") return resolved;
35426
+ const resolved = path83.resolve(target);
35427
+ if (path83.basename(resolved) === "CLAUDE.md") return resolved;
35350
35428
  const startDir = scopeDirectory(resolved);
35351
35429
  const root2 = findRepoRoot(startDir) ?? startDir;
35352
35430
  let current = startDir;
35353
35431
  while (true) {
35354
- const candidate = path82.join(current, "CLAUDE.md");
35432
+ const candidate = path83.join(current, "CLAUDE.md");
35355
35433
  if (existsSync68(candidate)) return candidate;
35356
- if (current === root2 || current === path82.dirname(current)) break;
35357
- current = path82.dirname(current);
35434
+ if (current === root2 || current === path83.dirname(current)) break;
35435
+ current = path83.dirname(current);
35358
35436
  }
35359
- return path82.join(root2, "CLAUDE.md");
35437
+ return path83.join(root2, "CLAUDE.md");
35360
35438
  }
35361
35439
 
35362
35440
  // src/commands/rules/updateScopedRulesIndex.ts
35363
35441
  import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
35364
- import path84 from "path";
35442
+ import path85 from "path";
35365
35443
 
35366
35444
  // src/commands/rules/scopedRuleDirectories.ts
35367
35445
  import { readFileSync as readFileSync51 } from "fs";
35368
- import path83 from "path";
35446
+ import path84 from "path";
35369
35447
  function scopedRuleDirectories(root2) {
35370
35448
  return findClaudeFiles(root2).filter(
35371
- (file) => path83.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35449
+ (file) => path84.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35372
35450
  ).map(
35373
- (file) => `${path83.relative(root2, path83.dirname(file)).split(path83.sep).join("/")}/`
35451
+ (file) => `${path84.relative(root2, path84.dirname(file)).split(path84.sep).join("/")}/`
35374
35452
  ).sort();
35375
35453
  }
35376
35454
 
@@ -35409,7 +35487,7 @@ function upsertScopedRulesPointer(content, directories) {
35409
35487
  // src/commands/rules/updateScopedRulesIndex.ts
35410
35488
  function updateScopedRulesIndex(root2) {
35411
35489
  const directories = scopedRuleDirectories(root2);
35412
- const rootFile = path84.join(root2, "CLAUDE.md");
35490
+ const rootFile = path85.join(root2, "CLAUDE.md");
35413
35491
  const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
35414
35492
  const after = upsertScopedRulesPointer(before, directories);
35415
35493
  if (after !== before) writeFileSync42(rootFile, after);
@@ -35423,12 +35501,12 @@ function read2(file) {
35423
35501
  function addRule(text18, options2) {
35424
35502
  const rule = text18.trim();
35425
35503
  if (rule === "") {
35426
- console.error(chalk234.red("Rule text is required"));
35504
+ console.error(chalk235.red("Rule text is required"));
35427
35505
  process.exitCode = 1;
35428
35506
  return;
35429
35507
  }
35430
35508
  const target = resolveRuleScope(options2.scope ?? process.cwd());
35431
- const targetDir = path85.dirname(target);
35509
+ const targetDir = path86.dirname(target);
35432
35510
  const root2 = findRepoRoot(targetDir) ?? targetDir;
35433
35511
  const code = nextRuleCode(root2);
35434
35512
  writeFileSync43(
@@ -35441,38 +35519,38 @@ function addRule(text18, options2) {
35441
35519
  );
35442
35520
  updateScopedRulesIndex(root2);
35443
35521
  console.log(
35444
- `Added ${chalk234.cyan(code)} to ${path85.relative(process.cwd(), target) || target}`
35522
+ `Added ${chalk235.cyan(code)} to ${path86.relative(process.cwd(), target) || target}`
35445
35523
  );
35446
35524
  }
35447
35525
 
35448
35526
  // src/commands/rules/indexRules.ts
35449
- import path86 from "path";
35450
- import chalk235 from "chalk";
35527
+ import path87 from "path";
35528
+ import chalk236 from "chalk";
35451
35529
  function indexRules() {
35452
35530
  const startDir = scopeDirectory(process.cwd());
35453
35531
  const root2 = findRepoRoot(startDir) ?? startDir;
35454
35532
  const directories = updateScopedRulesIndex(root2);
35455
- const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
35533
+ const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
35456
35534
  if (directories.length === 0) {
35457
35535
  console.log(
35458
- chalk235.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35536
+ chalk236.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35459
35537
  );
35460
35538
  return;
35461
35539
  }
35462
35540
  console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
35463
35541
  for (const directory of directories)
35464
- console.log(` ${chalk235.cyan(directory)}`);
35542
+ console.log(` ${chalk236.cyan(directory)}`);
35465
35543
  }
35466
35544
 
35467
35545
  // src/commands/rules/listRules.ts
35468
- import path87 from "path";
35469
- import chalk236 from "chalk";
35546
+ import path88 from "path";
35547
+ import chalk237 from "chalk";
35470
35548
  function listRules(target, options2 = {}) {
35471
- const resolved = path87.resolve(target ?? process.cwd());
35549
+ const resolved = path88.resolve(target ?? process.cwd());
35472
35550
  const rules3 = readScopedRules(resolved);
35473
35551
  if (rules3.length === 0) {
35474
- const label2 = path87.relative(process.cwd(), resolved) || ".";
35475
- console.log(chalk236.gray(`No rules in scope for ${label2}`));
35552
+ const label2 = path88.relative(process.cwd(), resolved) || ".";
35553
+ console.log(chalk237.gray(`No rules in scope for ${label2}`));
35476
35554
  return;
35477
35555
  }
35478
35556
  const base = findRepoRoot(scopeDirectory(resolved));
@@ -35482,14 +35560,14 @@ function listRules(target, options2 = {}) {
35482
35560
  if (rule.source !== shown) {
35483
35561
  shown = rule.source;
35484
35562
  console.log(
35485
- chalk236.dim(base ? path87.relative(base, rule.source) : rule.source)
35563
+ chalk237.dim(base ? path88.relative(base, rule.source) : rule.source)
35486
35564
  );
35487
35565
  }
35488
35566
  console.log(
35489
- ` ${chalk236.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35567
+ ` ${chalk237.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35490
35568
  );
35491
35569
  if (options2.full && rule.title)
35492
- console.log(` ${" ".repeat(width)} ${chalk236.dim(rule.text)}`);
35570
+ console.log(` ${" ".repeat(width)} ${chalk237.dim(rule.text)}`);
35493
35571
  }
35494
35572
  }
35495
35573
 
@@ -35518,7 +35596,7 @@ function registerRules(program2) {
35518
35596
  }
35519
35597
 
35520
35598
  // src/commands/seq/seqAuth.ts
35521
- import chalk238 from "chalk";
35599
+ import chalk239 from "chalk";
35522
35600
 
35523
35601
  // src/commands/seq/loadConnections.ts
35524
35602
  function loadConnections2() {
@@ -35547,10 +35625,10 @@ function setDefaultConnection(name) {
35547
35625
  }
35548
35626
 
35549
35627
  // src/shared/assertUniqueName.ts
35550
- import chalk237 from "chalk";
35628
+ import chalk238 from "chalk";
35551
35629
  function assertUniqueName(existingNames, name) {
35552
35630
  if (existingNames.includes(name)) {
35553
- console.error(chalk237.red(`Connection "${name}" already exists.`));
35631
+ console.error(chalk238.red(`Connection "${name}" already exists.`));
35554
35632
  process.exit(1);
35555
35633
  }
35556
35634
  }
@@ -35568,18 +35646,18 @@ async function promptConnection2(existingNames) {
35568
35646
  var seqAuth = createConnectionAuth({
35569
35647
  load: loadConnections2,
35570
35648
  save: saveConnections2,
35571
- format: (c) => `${chalk238.bold(c.name)} ${c.url}`,
35649
+ format: (c) => `${chalk239.bold(c.name)} ${c.url}`,
35572
35650
  promptNew: promptConnection2,
35573
35651
  onFirst: (c) => setDefaultConnection(c.name)
35574
35652
  });
35575
35653
 
35576
35654
  // src/commands/seq/seqQuery.ts
35577
- import chalk242 from "chalk";
35655
+ import chalk243 from "chalk";
35578
35656
 
35579
35657
  // src/commands/seq/fetchSeq.ts
35580
- import chalk239 from "chalk";
35581
- async function fetchSeq(conn, path106, params) {
35582
- const url = `${conn.url}${path106}?${params}`;
35658
+ import chalk240 from "chalk";
35659
+ async function fetchSeq(conn, path107, params) {
35660
+ const url = `${conn.url}${path107}?${params}`;
35583
35661
  const response = await fetch(url, {
35584
35662
  headers: {
35585
35663
  Accept: "application/json",
@@ -35588,7 +35666,7 @@ async function fetchSeq(conn, path106, params) {
35588
35666
  });
35589
35667
  if (!response.ok) {
35590
35668
  const body = await response.text();
35591
- console.error(chalk239.red(`Seq returned ${response.status}: ${body}`));
35669
+ console.error(chalk240.red(`Seq returned ${response.status}: ${body}`));
35592
35670
  process.exit(1);
35593
35671
  }
35594
35672
  return response;
@@ -35647,23 +35725,23 @@ async function fetchSeqEvents(conn, params) {
35647
35725
  }
35648
35726
 
35649
35727
  // src/commands/seq/formatEvent.ts
35650
- import chalk240 from "chalk";
35728
+ import chalk241 from "chalk";
35651
35729
  function levelColor(level) {
35652
35730
  switch (level) {
35653
35731
  case "Fatal":
35654
- return chalk240.bgRed.white;
35732
+ return chalk241.bgRed.white;
35655
35733
  case "Error":
35656
- return chalk240.red;
35734
+ return chalk241.red;
35657
35735
  case "Warning":
35658
- return chalk240.yellow;
35736
+ return chalk241.yellow;
35659
35737
  case "Information":
35660
- return chalk240.cyan;
35738
+ return chalk241.cyan;
35661
35739
  case "Debug":
35662
- return chalk240.gray;
35740
+ return chalk241.gray;
35663
35741
  case "Verbose":
35664
- return chalk240.dim;
35742
+ return chalk241.dim;
35665
35743
  default:
35666
- return chalk240.white;
35744
+ return chalk241.white;
35667
35745
  }
35668
35746
  }
35669
35747
  function levelAbbrev(level) {
@@ -35704,12 +35782,12 @@ function formatTimestamp(iso) {
35704
35782
  function formatEvent(event) {
35705
35783
  const color = levelColor(event.Level);
35706
35784
  const abbrev = levelAbbrev(event.Level);
35707
- const ts10 = chalk240.dim(formatTimestamp(event.Timestamp));
35785
+ const ts10 = chalk241.dim(formatTimestamp(event.Timestamp));
35708
35786
  const msg = renderMessage(event);
35709
35787
  const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
35710
35788
  if (event.Exception) {
35711
35789
  for (const line of event.Exception.split("\n")) {
35712
- lines2.push(chalk240.red(` ${line}`));
35790
+ lines2.push(chalk241.red(` ${line}`));
35713
35791
  }
35714
35792
  }
35715
35793
  return lines2.join("\n");
@@ -35742,11 +35820,11 @@ function rejectTimestampFilter(filter) {
35742
35820
  }
35743
35821
 
35744
35822
  // src/shared/resolveNamedConnection.ts
35745
- import chalk241 from "chalk";
35823
+ import chalk242 from "chalk";
35746
35824
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
35747
35825
  if (connections.length === 0) {
35748
35826
  console.error(
35749
- chalk241.red(
35827
+ chalk242.red(
35750
35828
  `No ${kind} connections configured. Run '${authCommand}' first.`
35751
35829
  )
35752
35830
  );
@@ -35755,7 +35833,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
35755
35833
  const target = requested ?? defaultName ?? connections[0].name;
35756
35834
  const connection = connections.find((c) => c.name === target);
35757
35835
  if (!connection) {
35758
- console.error(chalk241.red(`${kind} connection "${target}" not found.`));
35836
+ console.error(chalk242.red(`${kind} connection "${target}" not found.`));
35759
35837
  process.exit(1);
35760
35838
  }
35761
35839
  return connection;
@@ -35784,7 +35862,7 @@ async function seqQuery(filter, options2) {
35784
35862
  new URLSearchParams({ filter, count: String(count8) })
35785
35863
  );
35786
35864
  if (events.length === 0) {
35787
- console.log(chalk242.yellow("No events found."));
35865
+ console.log(chalk243.yellow("No events found."));
35788
35866
  return;
35789
35867
  }
35790
35868
  if (options2.json) {
@@ -35795,11 +35873,11 @@ async function seqQuery(filter, options2) {
35795
35873
  for (const event of chronological) {
35796
35874
  console.log(formatEvent(event));
35797
35875
  }
35798
- console.log(chalk242.dim(`
35876
+ console.log(chalk243.dim(`
35799
35877
  ${events.length} events`));
35800
35878
  if (events.length >= count8) {
35801
35879
  console.log(
35802
- chalk242.yellow(
35880
+ chalk243.yellow(
35803
35881
  `Results limited to ${count8}. Use --count to retrieve more.`
35804
35882
  )
35805
35883
  );
@@ -35807,10 +35885,10 @@ ${events.length} events`));
35807
35885
  }
35808
35886
 
35809
35887
  // src/shared/setNamedDefaultConnection.ts
35810
- import chalk243 from "chalk";
35888
+ import chalk244 from "chalk";
35811
35889
  function setNamedDefaultConnection(connections, name, setDefault, kind) {
35812
35890
  if (!connections.find((c) => c.name === name)) {
35813
- console.error(chalk243.red(`Connection "${name}" not found.`));
35891
+ console.error(chalk244.red(`Connection "${name}" not found.`));
35814
35892
  process.exit(1);
35815
35893
  }
35816
35894
  setDefault(name);
@@ -35960,7 +36038,7 @@ async function previewSlackThreadParts({
35960
36038
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35961
36039
  );
35962
36040
  paths.forEach(
35963
- (path106, index3) => console.log(`${index3 + 1}/${paths.length} ${path106}`)
36041
+ (path107, index3) => console.log(`${index3 + 1}/${paths.length} ${path107}`)
35964
36042
  );
35965
36043
  console.log(
35966
36044
  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.`
@@ -36031,7 +36109,7 @@ function registerSlack(program2) {
36031
36109
  }
36032
36110
 
36033
36111
  // src/commands/sql/sqlAuth.ts
36034
- import chalk245 from "chalk";
36112
+ import chalk246 from "chalk";
36035
36113
 
36036
36114
  // src/commands/sql/loadConnections.ts
36037
36115
  function loadConnections3() {
@@ -36060,7 +36138,7 @@ function setDefaultConnection2(name) {
36060
36138
  }
36061
36139
 
36062
36140
  // src/commands/sql/promptConnection.ts
36063
- import chalk244 from "chalk";
36141
+ import chalk245 from "chalk";
36064
36142
  async function promptConnection3(existingNames) {
36065
36143
  const name = await promptInput("name", "Connection name:", "default");
36066
36144
  assertUniqueName(existingNames, name);
@@ -36068,7 +36146,7 @@ async function promptConnection3(existingNames) {
36068
36146
  const portStr = await promptInput("port", "Port:", "1433");
36069
36147
  const port = Number.parseInt(portStr, 10);
36070
36148
  if (!Number.isFinite(port)) {
36071
- console.error(chalk244.red(`Invalid port "${portStr}".`));
36149
+ console.error(chalk245.red(`Invalid port "${portStr}".`));
36072
36150
  process.exit(1);
36073
36151
  }
36074
36152
  const user = await promptInput("user", "User:");
@@ -36081,13 +36159,13 @@ async function promptConnection3(existingNames) {
36081
36159
  var sqlAuth = createConnectionAuth({
36082
36160
  load: loadConnections3,
36083
36161
  save: saveConnections3,
36084
- format: (c) => `${chalk245.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36162
+ format: (c) => `${chalk246.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36085
36163
  promptNew: promptConnection3,
36086
36164
  onFirst: (c) => setDefaultConnection2(c.name)
36087
36165
  });
36088
36166
 
36089
36167
  // src/commands/sql/printTable.ts
36090
- import chalk246 from "chalk";
36168
+ import chalk247 from "chalk";
36091
36169
  function formatCell(value) {
36092
36170
  if (value === null || value === void 0) return "";
36093
36171
  if (value instanceof Date) return value.toISOString();
@@ -36096,7 +36174,7 @@ function formatCell(value) {
36096
36174
  }
36097
36175
  function printTable(rows) {
36098
36176
  if (rows.length === 0) {
36099
- console.log(chalk246.yellow("(no rows)"));
36177
+ console.log(chalk247.yellow("(no rows)"));
36100
36178
  return;
36101
36179
  }
36102
36180
  const columns = Object.keys(rows[0]);
@@ -36104,13 +36182,13 @@ function printTable(rows) {
36104
36182
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
36105
36183
  );
36106
36184
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
36107
- console.log(chalk246.dim(header));
36108
- console.log(chalk246.dim("-".repeat(header.length)));
36185
+ console.log(chalk247.dim(header));
36186
+ console.log(chalk247.dim("-".repeat(header.length)));
36109
36187
  for (const row of rows) {
36110
36188
  const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
36111
36189
  console.log(line);
36112
36190
  }
36113
- console.log(chalk246.dim(`
36191
+ console.log(chalk247.dim(`
36114
36192
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
36115
36193
  }
36116
36194
 
@@ -36170,7 +36248,7 @@ async function sqlColumns(table, connectionName) {
36170
36248
  }
36171
36249
 
36172
36250
  // src/commands/sql/sqlMutate.ts
36173
- import chalk247 from "chalk";
36251
+ import chalk248 from "chalk";
36174
36252
 
36175
36253
  // src/commands/sql/isMutation.ts
36176
36254
  var MUTATION_KEYWORDS = [
@@ -36204,7 +36282,7 @@ function isMutation(sql29) {
36204
36282
  async function sqlMutate(query, connectionName) {
36205
36283
  if (!isMutation(query)) {
36206
36284
  console.error(
36207
- chalk247.red(
36285
+ chalk248.red(
36208
36286
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
36209
36287
  )
36210
36288
  );
@@ -36214,18 +36292,18 @@ async function sqlMutate(query, connectionName) {
36214
36292
  const pool = await sqlConnect(conn);
36215
36293
  try {
36216
36294
  const result = await pool.request().query(query);
36217
- console.log(chalk247.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36295
+ console.log(chalk248.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36218
36296
  } finally {
36219
36297
  await pool.close();
36220
36298
  }
36221
36299
  }
36222
36300
 
36223
36301
  // src/commands/sql/sqlQuery.ts
36224
- import chalk248 from "chalk";
36302
+ import chalk249 from "chalk";
36225
36303
  async function sqlQuery(query, connectionName) {
36226
36304
  if (isMutation(query)) {
36227
36305
  console.error(
36228
- chalk248.red(
36306
+ chalk249.red(
36229
36307
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
36230
36308
  )
36231
36309
  );
@@ -36240,7 +36318,7 @@ async function sqlQuery(query, connectionName) {
36240
36318
  printTable(rows);
36241
36319
  } else {
36242
36320
  console.log(
36243
- chalk248.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36321
+ chalk249.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36244
36322
  );
36245
36323
  }
36246
36324
  } finally {
@@ -36302,15 +36380,15 @@ function registerSql(program2) {
36302
36380
 
36303
36381
  // src/commands/sync.ts
36304
36382
  import * as os5 from "os";
36305
- import * as path99 from "path";
36383
+ import * as path100 from "path";
36306
36384
  import { fileURLToPath as fileURLToPath8 } from "url";
36307
36385
 
36308
36386
  // src/commands/sync/pruneCommands.ts
36309
- import * as path89 from "path";
36387
+ import * as path90 from "path";
36310
36388
 
36311
36389
  // src/commands/sync/pruneTarget.ts
36312
36390
  import * as fs39 from "fs";
36313
- import * as path88 from "path";
36391
+ import * as path89 from "path";
36314
36392
  function pruneTarget(targetDir, keepNames, shape, options2) {
36315
36393
  const result = {
36316
36394
  orphans: [],
@@ -36328,7 +36406,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36328
36406
  }
36329
36407
  if (keep.has(name)) continue;
36330
36408
  result.orphans.push(entry.name);
36331
- const entryPath = path88.join(targetDir, entry.name);
36409
+ const entryPath = path89.join(targetDir, entry.name);
36332
36410
  const reason4 = shape.blockedBy?.(entryPath);
36333
36411
  if (reason4) {
36334
36412
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -36348,7 +36426,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36348
36426
  targetDir,
36349
36427
  commandNames,
36350
36428
  {
36351
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path89.basename(entry.name, ".md") : void 0
36429
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path90.basename(entry.name, ".md") : void 0
36352
36430
  },
36353
36431
  options2
36354
36432
  );
@@ -36383,16 +36461,16 @@ function reportPrune(label2, result, force) {
36383
36461
 
36384
36462
  // src/commands/sync/syncClaudeCommands.ts
36385
36463
  import * as fs43 from "fs";
36386
- import * as path93 from "path";
36464
+ import * as path94 from "path";
36387
36465
 
36388
36466
  // src/commands/sync/syncCodex.ts
36389
- import * as path92 from "path";
36467
+ import * as path93 from "path";
36390
36468
 
36391
36469
  // src/commands/sync/installHarnessCommands.ts
36392
36470
  import * as fs40 from "fs";
36393
- import * as path90 from "path";
36471
+ import * as path91 from "path";
36394
36472
  function installHarnessCommands(claudeDir, harness, transform) {
36395
- const commandsSource = path90.join(claudeDir, "commands");
36473
+ const commandsSource = path91.join(claudeDir, "commands");
36396
36474
  const files = fs40.readdirSync(commandsSource);
36397
36475
  const names = [];
36398
36476
  let synced = 0;
@@ -36400,9 +36478,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
36400
36478
  if (!file.endsWith(".md")) continue;
36401
36479
  const name = file.replace(/\.md$/, "");
36402
36480
  names.push(name);
36403
- const content = fs40.readFileSync(path90.join(commandsSource, file), "utf8");
36404
- const target = path90.join(harness.homeDir, harness.sync.commandDest(name));
36405
- fs40.mkdirSync(path90.dirname(target), { recursive: true });
36481
+ const content = fs40.readFileSync(path91.join(commandsSource, file), "utf8");
36482
+ const target = path91.join(harness.homeDir, harness.sync.commandDest(name));
36483
+ fs40.mkdirSync(path91.dirname(target), { recursive: true });
36406
36484
  fs40.writeFileSync(target, transform(name, content));
36407
36485
  synced++;
36408
36486
  }
@@ -36431,7 +36509,7 @@ function unexpectedContent(skillDir) {
36431
36509
 
36432
36510
  // src/commands/sync/syncCodexHooks.ts
36433
36511
  import * as fs42 from "fs";
36434
- import * as path91 from "path";
36512
+ import * as path92 from "path";
36435
36513
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36436
36514
  var END = "# <<< assist codex hooks (managed) <<<";
36437
36515
  function upsertManagedBlock(existing, body) {
@@ -36462,9 +36540,9 @@ ${rest}
36462
36540
  }
36463
36541
  function syncCodexHooks(sourcePath) {
36464
36542
  const body = fs42.readFileSync(sourcePath, "utf8");
36465
- const configPath = path91.join(harnesses.codex.homeDir, "config.toml");
36543
+ const configPath = path92.join(harnesses.codex.homeDir, "config.toml");
36466
36544
  const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
36467
- fs42.mkdirSync(path91.dirname(configPath), { recursive: true });
36545
+ fs42.mkdirSync(path92.dirname(configPath), { recursive: true });
36468
36546
  fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
36469
36547
  console.log(
36470
36548
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
@@ -36496,13 +36574,13 @@ function syncCodex(claudeDir, options2) {
36496
36574
  harnesses.codex,
36497
36575
  commandToSkill
36498
36576
  );
36499
- syncCodexHooks(path92.join(claudeDir, "..", "codex", "config.toml"));
36577
+ syncCodexHooks(path93.join(claudeDir, "..", "codex", "config.toml"));
36500
36578
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36501
36579
  if (!options2?.prune) return;
36502
36580
  const force = options2.force ?? false;
36503
36581
  reportPrune(
36504
36582
  "~/.codex/skills",
36505
- pruneSkills(path92.join(harnesses.codex.homeDir, "skills"), names, { force }),
36583
+ pruneSkills(path93.join(harnesses.codex.homeDir, "skills"), names, { force }),
36506
36584
  force
36507
36585
  );
36508
36586
  }
@@ -36517,30 +36595,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
36517
36595
  fs43.writeFileSync(file, content);
36518
36596
  }
36519
36597
  function writeSkill(targetBase, name, content) {
36520
- const skillDir = path93.join(targetBase, "skills", name);
36598
+ const skillDir = path94.join(targetBase, "skills", name);
36521
36599
  fs43.mkdirSync(skillDir, { recursive: true });
36522
36600
  replaceFileWithoutFollowingSymlink(
36523
- path93.join(skillDir, "SKILL.md"),
36601
+ path94.join(skillDir, "SKILL.md"),
36524
36602
  commandToSkill(name, content)
36525
36603
  );
36526
- fs43.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
36604
+ fs43.rmSync(path94.join(targetBase, "commands", `${name}.md`), { force: true });
36527
36605
  console.log(`Wrote ${name} as a skill to ${skillDir}`);
36528
36606
  }
36529
36607
  function syncClaudeCommands(claudeDir, targetBase) {
36530
- const sourceDir = path93.join(claudeDir, "commands");
36531
- const targetDir = path93.join(targetBase, "commands");
36608
+ const sourceDir = path94.join(claudeDir, "commands");
36609
+ const targetDir = path94.join(targetBase, "commands");
36532
36610
  fs43.mkdirSync(targetDir, { recursive: true });
36533
36611
  const files = fs43.readdirSync(sourceDir);
36534
36612
  for (const file of files) {
36535
- const source = path93.join(sourceDir, file);
36613
+ const source = path94.join(sourceDir, file);
36536
36614
  if (file.endsWith(".md")) {
36537
36615
  const content = fs43.readFileSync(source, "utf8");
36538
36616
  if (isSkillFlagged(content)) {
36539
- writeSkill(targetBase, path93.basename(file, ".md"), content);
36617
+ writeSkill(targetBase, path94.basename(file, ".md"), content);
36540
36618
  continue;
36541
36619
  }
36542
36620
  }
36543
- fs43.copyFileSync(source, path93.join(targetDir, file));
36621
+ fs43.copyFileSync(source, path94.join(targetDir, file));
36544
36622
  console.log(`Copied ${file} to ${targetDir}`);
36545
36623
  }
36546
36624
  console.log(`Synced ${files.length} command(s) to ~/.claude`);
@@ -36549,11 +36627,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
36549
36627
 
36550
36628
  // src/commands/sync/reportRetiredAgentsFiles.ts
36551
36629
  import * as fs44 from "fs";
36552
- import * as path94 from "path";
36630
+ import * as path95 from "path";
36553
36631
  var retired = [
36554
- path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
36555
- path94.join(harnesses.codex.homeDir, "AGENTS.md"),
36556
- path94.join(harnesses.pi.homeDir, "AGENTS.md")
36632
+ path95.join(harnesses.claude.homeDir, "CLAUDE.md"),
36633
+ path95.join(harnesses.codex.homeDir, "AGENTS.md"),
36634
+ path95.join(harnesses.pi.homeDir, "AGENTS.md")
36557
36635
  ];
36558
36636
  function reportRetiredAgentsFiles() {
36559
36637
  const leftovers = retired.filter((file) => fs44.existsSync(file));
@@ -36569,35 +36647,35 @@ function reportRetiredAgentsFiles() {
36569
36647
 
36570
36648
  // src/commands/sync/syncDesign.ts
36571
36649
  import * as fs45 from "fs";
36572
- import * as path95 from "path";
36650
+ import * as path96 from "path";
36573
36651
  function syncDesign(claudeDir, targetBase) {
36574
- const systemPromptSource = path95.join(claudeDir, "design-system-prompt.md");
36575
- const systemPromptTarget = path95.join(targetBase, "design-system-prompt.md");
36652
+ const systemPromptSource = path96.join(claudeDir, "design-system-prompt.md");
36653
+ const systemPromptTarget = path96.join(targetBase, "design-system-prompt.md");
36576
36654
  fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36577
36655
  console.log(
36578
36656
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36579
36657
  );
36580
- const skillsSource = path95.join(claudeDir, "skills");
36581
- const skillsTarget = path95.join(targetBase, "skills");
36658
+ const skillsSource = path96.join(claudeDir, "skills");
36659
+ const skillsTarget = path96.join(targetBase, "skills");
36582
36660
  fs45.mkdirSync(skillsTarget, { recursive: true });
36583
36661
  const files = fs45.readdirSync(skillsSource);
36584
36662
  for (const file of files) {
36585
36663
  fs45.copyFileSync(
36586
- path95.join(skillsSource, file),
36587
- path95.join(skillsTarget, file)
36664
+ path96.join(skillsSource, file),
36665
+ path96.join(skillsTarget, file)
36588
36666
  );
36589
36667
  }
36590
36668
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36591
36669
  }
36592
36670
 
36593
36671
  // src/commands/sync/syncPi.ts
36594
- import * as path97 from "path";
36672
+ import * as path98 from "path";
36595
36673
 
36596
36674
  // src/commands/sync/syncPiHooks.ts
36597
36675
  import * as fs46 from "fs";
36598
- import * as path96 from "path";
36676
+ import * as path97 from "path";
36599
36677
  function piExtensionsDir() {
36600
- return path96.join(harnesses.pi.homeDir, "extensions");
36678
+ return path97.join(harnesses.pi.homeDir, "extensions");
36601
36679
  }
36602
36680
  function syncPiHooks(sourceDir) {
36603
36681
  const target = piExtensionsDir();
@@ -36605,8 +36683,8 @@ function syncPiHooks(sourceDir) {
36605
36683
  const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36606
36684
  for (const file of files) {
36607
36685
  fs46.copyFileSync(
36608
- path96.join(sourceDir, file),
36609
- path96.join(target, `assist-${file}`)
36686
+ path97.join(sourceDir, file),
36687
+ path97.join(target, `assist-${file}`)
36610
36688
  );
36611
36689
  }
36612
36690
  console.log(
@@ -36643,24 +36721,24 @@ function syncPi(claudeDir, options2) {
36643
36721
  harnesses.pi,
36644
36722
  commandToPrompt
36645
36723
  );
36646
- syncPiHooks(path97.join(claudeDir, "..", "pi"));
36724
+ syncPiHooks(path98.join(claudeDir, "..", "pi"));
36647
36725
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36648
36726
  if (!options2?.prune) return;
36649
36727
  const force = options2.force ?? false;
36650
36728
  reportPrune(
36651
36729
  "~/.pi/agent/prompts",
36652
- pruneCommands(path97.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36730
+ pruneCommands(path98.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36653
36731
  force
36654
36732
  );
36655
36733
  }
36656
36734
 
36657
36735
  // src/commands/sync/syncSettings.ts
36658
36736
  import * as fs47 from "fs";
36659
- import * as path98 from "path";
36660
- import chalk249 from "chalk";
36737
+ import * as path99 from "path";
36738
+ import chalk250 from "chalk";
36661
36739
  async function syncSettings(claudeDir, targetBase, options2) {
36662
- const source = path98.join(claudeDir, "settings.json");
36663
- const target = path98.join(targetBase, "settings.json");
36740
+ const source = path99.join(claudeDir, "settings.json");
36741
+ const target = path99.join(targetBase, "settings.json");
36664
36742
  const sourceContent = fs47.readFileSync(source, "utf8");
36665
36743
  const sourceSettings = JSON.parse(sourceContent);
36666
36744
  const targetExists = fs47.existsSync(target);
@@ -36676,7 +36754,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36676
36754
  if (mergedContent !== normalizedTarget) {
36677
36755
  if (!options2?.yes) {
36678
36756
  console.log(
36679
- chalk249.yellow(
36757
+ chalk250.yellow(
36680
36758
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
36681
36759
  )
36682
36760
  );
@@ -36684,7 +36762,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36684
36762
  printDiff(targetContent, mergedContent);
36685
36763
  printAutoConfirmHint();
36686
36764
  const confirm = await promptConfirm(
36687
- chalk249.red("Overwrite existing settings.json?"),
36765
+ chalk250.red("Overwrite existing settings.json?"),
36688
36766
  false
36689
36767
  );
36690
36768
  if (!confirm) {
@@ -36700,13 +36778,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
36700
36778
 
36701
36779
  // src/commands/sync.ts
36702
36780
  var __filename4 = fileURLToPath8(import.meta.url);
36703
- var __dirname5 = path99.dirname(__filename4);
36781
+ var __dirname5 = path100.dirname(__filename4);
36704
36782
  async function sync(options2) {
36705
36783
  const config = loadConfig();
36706
36784
  const yes = options2?.yes ?? config.sync.autoConfirm;
36707
36785
  const prune = { prune: options2?.prune, force: options2?.force };
36708
- const claudeDir = path99.join(__dirname5, "..", "claude");
36709
- const targetBase = path99.join(os5.homedir(), ".claude");
36786
+ const claudeDir = path100.join(__dirname5, "..", "claude");
36787
+ const targetBase = path100.join(os5.homedir(), ".claude");
36710
36788
  const commandFiles = syncClaudeCommands(claudeDir, targetBase);
36711
36789
  syncDesign(claudeDir, targetBase);
36712
36790
  await syncSettings(claudeDir, targetBase, { yes });
@@ -36714,11 +36792,11 @@ async function sync(options2) {
36714
36792
  syncPi(claudeDir, prune);
36715
36793
  reportRetiredAgentsFiles();
36716
36794
  if (!options2?.prune) return;
36717
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path99.basename(file, ".md"));
36795
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path100.basename(file, ".md"));
36718
36796
  const force = options2.force ?? false;
36719
36797
  reportPrune(
36720
36798
  "~/.claude/commands",
36721
- pruneCommands(path99.join(targetBase, "commands"), commandNames, { force }),
36799
+ pruneCommands(path100.join(targetBase, "commands"), commandNames, { force }),
36722
36800
  force
36723
36801
  );
36724
36802
  }
@@ -37774,9 +37852,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
37774
37852
 
37775
37853
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37776
37854
  import { minimatch as minimatch9 } from "minimatch";
37777
- function resolveStringsAtPath(data, path106) {
37855
+ function resolveStringsAtPath(data, path107) {
37778
37856
  let current = data;
37779
- for (const segment of path106.split(".")) {
37857
+ for (const segment of path107.split(".")) {
37780
37858
  if (current === null || typeof current !== "object") return [];
37781
37859
  current = current[segment];
37782
37860
  }
@@ -37789,10 +37867,10 @@ function resolveStringsAtPath(data, path106) {
37789
37867
  }
37790
37868
  function findRuleViolations(data, rule) {
37791
37869
  const violations = [];
37792
- for (const path106 of rule.paths) {
37793
- for (const value of resolveStringsAtPath(data, path106)) {
37870
+ for (const path107 of rule.paths) {
37871
+ for (const value of resolveStringsAtPath(data, path107)) {
37794
37872
  if (minimatch9(value, rule.disallowed))
37795
- violations.push({ file: rule.file, path: path106, value });
37873
+ violations.push({ file: rule.file, path: path107, value });
37796
37874
  }
37797
37875
  }
37798
37876
  return violations;
@@ -37831,8 +37909,8 @@ function forbiddenStrings() {
37831
37909
  process.exit(0);
37832
37910
  }
37833
37911
  console.log("Forbidden strings found:\n");
37834
- for (const { file, path: path106, value } of violations) {
37835
- console.log(` ${file} ${path106}: ${value}`);
37912
+ for (const { file, path: path107, value } of violations) {
37913
+ console.log(` ${file} ${path107}: ${value}`);
37836
37914
  }
37837
37915
  console.log(`
37838
37916
  Total: ${violations.length} forbidden string(s).`);
@@ -37888,7 +37966,7 @@ Total: ${lines2.length} hardcoded color(s)`);
37888
37966
 
37889
37967
  // src/commands/verify/migrations.ts
37890
37968
  import { readFileSync as readFileSync61 } from "fs";
37891
- import path101 from "path";
37969
+ import path102 from "path";
37892
37970
 
37893
37971
  // src/commands/verify/migrations/checkAppendOnly.ts
37894
37972
  function checkAppendOnly(baseline, current) {
@@ -37980,15 +38058,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37980
38058
  } catch {
37981
38059
  return baseline;
37982
38060
  }
37983
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path106) => MIGRATION_FILE3.test(basename26(path106)));
37984
- for (const path106 of paths) {
38061
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path107) => MIGRATION_FILE3.test(basename26(path107)));
38062
+ for (const path107 of paths) {
37985
38063
  try {
37986
- const content = execSync63(`git show "${ref}:${path106}"`, {
38064
+ const content = execSync63(`git show "${ref}:${path107}"`, {
37987
38065
  encoding: "utf8",
37988
38066
  maxBuffer: 16 * 1024 * 1024,
37989
38067
  stdio: ["pipe", "pipe", "pipe"]
37990
38068
  });
37991
- baseline.set(basename26(path106), content);
38069
+ baseline.set(basename26(path107), content);
37992
38070
  } catch {
37993
38071
  }
37994
38072
  }
@@ -38027,11 +38105,11 @@ function resolveBaselineRef() {
38027
38105
  }
38028
38106
 
38029
38107
  // src/commands/verify/migrations/migrationsDir.ts
38030
- import path100 from "path";
38108
+ import path101 from "path";
38031
38109
  import { fileURLToPath as fileURLToPath9 } from "url";
38032
38110
  function migrationsDir() {
38033
- return path100.resolve(
38034
- path100.dirname(fileURLToPath9(import.meta.url)),
38111
+ return path101.resolve(
38112
+ path101.dirname(fileURLToPath9(import.meta.url)),
38035
38113
  "../../../shared/db/migrations"
38036
38114
  );
38037
38115
  }
@@ -38052,7 +38130,7 @@ function migrations2() {
38052
38130
  if (ref) {
38053
38131
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
38054
38132
  const current = new Map(
38055
- files.map((file) => [file, readFileSync61(path101.join(dir, file), "utf8")])
38133
+ files.map((file) => [file, readFileSync61(path102.join(dir, file), "utf8")])
38056
38134
  );
38057
38135
  for (const finding of checkAppendOnly(baseline, current)) {
38058
38136
  problems.push(
@@ -38557,11 +38635,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
38557
38635
  var sessionsPrefix = "src/commands/sessions/";
38558
38636
  var rules = [
38559
38637
  {
38560
- matches: (path106) => path106.startsWith(webUiPrefix),
38638
+ matches: (path107) => path107.startsWith(webUiPrefix),
38561
38639
  advice: "restart the web server, then hard-reload the browser tab"
38562
38640
  },
38563
38641
  {
38564
- matches: (path106) => path106.startsWith(sessionsPrefix) && !path106.startsWith(webUiPrefix),
38642
+ matches: (path107) => path107.startsWith(sessionsPrefix) && !path107.startsWith(webUiPrefix),
38565
38643
  advice: "restart the daemon"
38566
38644
  }
38567
38645
  ];
@@ -38572,27 +38650,27 @@ function restartAdvice(paths) {
38572
38650
  // src/commands/watch/syncAdvice.ts
38573
38651
  var rules2 = [
38574
38652
  {
38575
- matches: (path106) => path106.startsWith("claude/commands/"),
38653
+ matches: (path107) => path107.startsWith("claude/commands/"),
38576
38654
  reason: "claude/commands changed"
38577
38655
  },
38578
38656
  {
38579
- matches: (path106) => path106.startsWith("claude/skills/"),
38657
+ matches: (path107) => path107.startsWith("claude/skills/"),
38580
38658
  reason: "claude/skills changed"
38581
38659
  },
38582
38660
  {
38583
- matches: (path106) => path106 === "claude/settings.json",
38661
+ matches: (path107) => path107 === "claude/settings.json",
38584
38662
  reason: "claude/settings.json changed"
38585
38663
  },
38586
38664
  {
38587
- matches: (path106) => path106 === "claude/design-system-prompt.md",
38665
+ matches: (path107) => path107 === "claude/design-system-prompt.md",
38588
38666
  reason: "claude/design-system-prompt.md changed"
38589
38667
  },
38590
38668
  {
38591
- matches: (path106) => path106.startsWith("codex/"),
38669
+ matches: (path107) => path107.startsWith("codex/"),
38592
38670
  reason: "codex sources changed"
38593
38671
  },
38594
38672
  {
38595
- matches: (path106) => path106.startsWith("pi/"),
38673
+ matches: (path107) => path107.startsWith("pi/"),
38596
38674
  reason: "pi sources changed"
38597
38675
  }
38598
38676
  ];
@@ -39074,7 +39152,7 @@ function registerWatch(program2) {
39074
39152
 
39075
39153
  // src/commands/roam/auth.ts
39076
39154
  import { randomBytes } from "crypto";
39077
- import chalk250 from "chalk";
39155
+ import chalk251 from "chalk";
39078
39156
 
39079
39157
  // src/commands/roam/waitForCallback.ts
39080
39158
  import { createServer as createServer3 } from "http";
@@ -39205,13 +39283,13 @@ async function auth() {
39205
39283
  saveGlobalConfig(config);
39206
39284
  const state = randomBytes(16).toString("hex");
39207
39285
  console.log(
39208
- chalk250.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39286
+ chalk251.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39209
39287
  );
39210
- console.log(chalk250.white("http://localhost:14523/callback\n"));
39211
- console.log(chalk250.blue("Opening browser for authorization..."));
39212
- console.log(chalk250.dim("Waiting for authorization callback..."));
39288
+ console.log(chalk251.white("http://localhost:14523/callback\n"));
39289
+ console.log(chalk251.blue("Opening browser for authorization..."));
39290
+ console.log(chalk251.dim("Waiting for authorization callback..."));
39213
39291
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
39214
- console.log(chalk250.dim("Exchanging code for tokens..."));
39292
+ console.log(chalk251.dim("Exchanging code for tokens..."));
39215
39293
  const tokens = await exchangeToken({
39216
39294
  code,
39217
39295
  clientId,
@@ -39227,7 +39305,7 @@ async function auth() {
39227
39305
  };
39228
39306
  saveGlobalConfig(config);
39229
39307
  console.log(
39230
- chalk250.green("Roam credentials and tokens saved to ~/.assist.yml")
39308
+ chalk251.green("Roam credentials and tokens saved to ~/.assist.yml")
39231
39309
  );
39232
39310
  }
39233
39311
 
@@ -39243,9 +39321,9 @@ function findPortFile(roamDir) {
39243
39321
  return void 0;
39244
39322
  }
39245
39323
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
39246
- const path106 = join101(roamDir, name);
39324
+ const path107 = join101(roamDir, name);
39247
39325
  try {
39248
- return { path: path106, mtimeMs: statSync13(path106).mtimeMs };
39326
+ return { path: path107, mtimeMs: statSync13(path107).mtimeMs };
39249
39327
  } catch {
39250
39328
  return void 0;
39251
39329
  }
@@ -39489,11 +39567,11 @@ function findLinkIndex() {
39489
39567
  function parseLinkArgs() {
39490
39568
  const idx = findLinkIndex();
39491
39569
  if (idx === -1) return null;
39492
- const path106 = process.argv[idx + 1];
39570
+ const path107 = process.argv[idx + 1];
39493
39571
  const rest = process.argv.slice(idx + 2);
39494
39572
  const { value: prefix2 } = extractOption(rest, "--prefix");
39495
39573
  if (!prefix2) return null;
39496
- return { path: path106, prefix: prefix2 };
39574
+ return { path: path107, prefix: prefix2 };
39497
39575
  }
39498
39576
  function hasDuplicateLink(runList, linkPath) {
39499
39577
  return runList.some(
@@ -39582,7 +39660,7 @@ function registerRun(program2) {
39582
39660
  }
39583
39661
 
39584
39662
  // src/commands/sessions/nodes/formatLink.ts
39585
- import chalk251 from "chalk";
39663
+ import chalk252 from "chalk";
39586
39664
 
39587
39665
  // src/commands/sessions/daemon/links/describeTarget.ts
39588
39666
  function describeTarget({ url, ssh }) {
@@ -39592,16 +39670,16 @@ function describeTarget({ url, ssh }) {
39592
39670
 
39593
39671
  // src/commands/sessions/nodes/formatLink.ts
39594
39672
  var STATE_COLOURS = {
39595
- connected: chalk251.green,
39596
- connecting: chalk251.yellow,
39597
- disconnected: chalk251.red,
39598
- "version-blocked": chalk251.red
39673
+ connected: chalk252.green,
39674
+ connecting: chalk252.yellow,
39675
+ disconnected: chalk252.red,
39676
+ "version-blocked": chalk252.red
39599
39677
  };
39600
39678
  function formatLink(link3) {
39601
- const colour = STATE_COLOURS[link3.state] ?? chalk251.white;
39679
+ const colour = STATE_COLOURS[link3.state] ?? chalk252.white;
39602
39680
  const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
39603
39681
  const error = link3.error ? `
39604
- ${chalk251.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39682
+ ${chalk252.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39605
39683
  return ` ${link3.name} ${colour(link3.state)} ${describeTarget(link3)}${peer}${error}`;
39606
39684
  }
39607
39685
 
@@ -40138,14 +40216,14 @@ import * as pty from "node-pty";
40138
40216
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
40139
40217
  import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
40140
40218
  import { createRequire as createRequire3 } from "module";
40141
- import path102 from "path";
40219
+ import path103 from "path";
40142
40220
  var require4 = createRequire3(import.meta.url);
40143
40221
  var ensured = false;
40144
40222
  function ensureSpawnHelperExecutable() {
40145
40223
  if (ensured || process.platform !== "darwin") return;
40146
40224
  ensured = true;
40147
- const ptyRoot = path102.join(path102.dirname(require4.resolve("node-pty")), "..");
40148
- const helper = path102.join(
40225
+ const ptyRoot = path103.join(path103.dirname(require4.resolve("node-pty")), "..");
40226
+ const helper = path103.join(
40149
40227
  ptyRoot,
40150
40228
  "prebuilds",
40151
40229
  `${process.platform}-${process.arch}`,
@@ -40276,12 +40354,12 @@ function serverRunMeta(runName, cwd) {
40276
40354
 
40277
40355
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
40278
40356
  import * as fs50 from "fs";
40279
- import * as path103 from "path";
40357
+ import * as path104 from "path";
40280
40358
  import { fileURLToPath as fileURLToPath11 } from "url";
40281
40359
  var __filename5 = fileURLToPath11(import.meta.url);
40282
- var __dirname7 = path103.dirname(__filename5);
40360
+ var __dirname7 = path104.dirname(__filename5);
40283
40361
  function readDesignSystemPrompt() {
40284
- const promptPath = path103.join(
40362
+ const promptPath = path104.join(
40285
40363
  __dirname7,
40286
40364
  "..",
40287
40365
  "claude",
@@ -41315,8 +41393,8 @@ async function seedRunningMsFromUsage(session, notify2) {
41315
41393
  var DEBOUNCE_MS2 = 50;
41316
41394
  function watchActivity(session, notify2, onClaudeSessionId) {
41317
41395
  if (session.commandType !== "assist" || !session.cwd) return;
41318
- const path106 = activityPath(session.id);
41319
- const dir = dirname42(path106);
41396
+ const path107 = activityPath(session.id);
41397
+ const dir = dirname42(path107);
41320
41398
  try {
41321
41399
  mkdirSync37(dir, { recursive: true });
41322
41400
  } catch {
@@ -41326,7 +41404,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41326
41404
  let timer = null;
41327
41405
  const read3 = () => {
41328
41406
  timer = null;
41329
- const activity2 = readActivity(path106);
41407
+ const activity2 = readActivity(path107);
41330
41408
  if (!activity2) return;
41331
41409
  applyActivityToSession(session, activity2);
41332
41410
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -41335,11 +41413,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41335
41413
  notify2();
41336
41414
  };
41337
41415
  session.activityWatcher = watch2(dir, (_event, filename) => {
41338
- if (filename && !path106.endsWith(filename)) return;
41416
+ if (filename && !path107.endsWith(filename)) return;
41339
41417
  if (timer) clearTimeout(timer);
41340
41418
  timer = setTimeout(read3, DEBOUNCE_MS2);
41341
41419
  });
41342
- if (existsSync93(path106)) read3();
41420
+ if (existsSync93(path107)) read3();
41343
41421
  }
41344
41422
  function refreshActivity(session) {
41345
41423
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -41482,12 +41560,12 @@ import { watch as watch3 } from "fs";
41482
41560
 
41483
41561
  // src/commands/sessions/shared/findTranscriptPathSync.ts
41484
41562
  import * as fs52 from "fs";
41485
- import * as path104 from "path";
41563
+ import * as path105 from "path";
41486
41564
  function projectDirForCwd(cwd) {
41487
- return path104.join(claudeProjectsRoot(), projectSlug(cwd));
41565
+ return path105.join(claudeProjectsRoot(), projectSlug(cwd));
41488
41566
  }
41489
41567
  function transcriptPathFor(cwd, claudeSessionId) {
41490
- return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41568
+ return path105.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41491
41569
  }
41492
41570
  function findTranscriptPathSync(cwd, claudeSessionId) {
41493
41571
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -41501,8 +41579,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
41501
41579
  }
41502
41580
  for (const file of files) {
41503
41581
  if (!file.endsWith(".jsonl")) continue;
41504
- if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
41505
- return path104.join(dir, file);
41582
+ if (headContainsSessionId(path105.join(dir, file), claudeSessionId))
41583
+ return path105.join(dir, file);
41506
41584
  }
41507
41585
  return null;
41508
41586
  }
@@ -42702,9 +42780,9 @@ function tempRoots() {
42702
42780
  }
42703
42781
  return [...roots];
42704
42782
  }
42705
- function underTempRoot(path106) {
42783
+ function underTempRoot(path107) {
42706
42784
  return tempRoots().some(
42707
- (root2) => path106.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42785
+ (root2) => path107.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42708
42786
  );
42709
42787
  }
42710
42788
 
@@ -43190,15 +43268,15 @@ function bindResumedWorktree(session, cwd, notify2) {
43190
43268
  import { existsSync as existsSync95 } from "fs";
43191
43269
  async function reclaimVanishedWorktrees(clone, paths) {
43192
43270
  if (!existsSync95(clone)) {
43193
- for (const { path: path106 } of paths) forgetWorktree(path106);
43271
+ for (const { path: path107 } of paths) forgetWorktree(path107);
43194
43272
  daemonLog(
43195
43273
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
43196
43274
  );
43197
43275
  return;
43198
43276
  }
43199
43277
  await pruneBookkeeping2(clone);
43200
- for (const { path: path106, branch: branch2 } of paths)
43201
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path106);
43278
+ for (const { path: path107, branch: branch2 } of paths)
43279
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path107);
43202
43280
  }
43203
43281
  async function pruneBookkeeping2(clone) {
43204
43282
  try {
@@ -43225,37 +43303,37 @@ async function reclaimBranch(clone, branch2) {
43225
43303
  }
43226
43304
 
43227
43305
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
43228
- function logVanishedTree(sessions, path106) {
43306
+ function logVanishedTree(sessions, path107) {
43229
43307
  const claimants = [...sessions.values()].filter(
43230
- (s) => s.cwd === path106 || s.worktree?.path === path106
43308
+ (s) => s.cwd === path107 || s.worktree?.path === path107
43231
43309
  );
43232
43310
  if (claimants.length === 0) {
43233
- daemonLog(`worktree ${path106} gone from disk and unclaimed; reclaiming it`);
43311
+ daemonLog(`worktree ${path107} gone from disk and unclaimed; reclaiming it`);
43234
43312
  return;
43235
43313
  }
43236
43314
  for (const s of claimants)
43237
43315
  daemonLog(
43238
- `session ${s.id} ("${s.name}") claims worktree ${path106}, which is gone from disk; reclaiming it`
43316
+ `session ${s.id} ("${s.name}") claims worktree ${path107}, which is gone from disk; reclaiming it`
43239
43317
  );
43240
43318
  }
43241
43319
 
43242
43320
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
43243
43321
  var MAX_ITEMS = 20;
43244
- async function describeHeldWork(path106, reason4) {
43245
- if (reason4.startsWith("uncommitted")) return await changedFiles(path106);
43246
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path106, reason4);
43322
+ async function describeHeldWork(path107, reason4) {
43323
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path107);
43324
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path107, reason4);
43247
43325
  return { summary: reason4, items: [] };
43248
43326
  }
43249
- async function changedFiles(path106) {
43250
- const status3 = await gitResult(path106, ["status", "--porcelain"]);
43327
+ async function changedFiles(path107) {
43328
+ const status3 = await gitResult(path107, ["status", "--porcelain"]);
43251
43329
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
43252
43330
  return {
43253
43331
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
43254
43332
  items: capped2(lines2)
43255
43333
  };
43256
43334
  }
43257
- async function unpushedCommits(path106, reason4) {
43258
- const log2 = await gitResult(path106, ["log", "--oneline", "@{upstream}..HEAD"]);
43335
+ async function unpushedCommits(path107, reason4) {
43336
+ const log2 = await gitResult(path107, ["log", "--oneline", "@{upstream}..HEAD"]);
43259
43337
  if (!log2.ok) return { summary: reason4, items: [] };
43260
43338
  const lines2 = nonEmptyLines(log2.out);
43261
43339
  return {
@@ -43347,24 +43425,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
43347
43425
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
43348
43426
  const accounted = accountedTrees(sessions);
43349
43427
  const vanished = /* @__PURE__ */ new Map();
43350
- for (const { path: path106, clone } of readWorktreeRegistry()) {
43351
- if (underTempRoot(path106)) {
43352
- forgetWorktree(path106);
43428
+ for (const { path: path107, clone } of readWorktreeRegistry()) {
43429
+ if (underTempRoot(path107)) {
43430
+ forgetWorktree(path107);
43353
43431
  daemonLog(
43354
- `worktree ${path106} lies outside any project root; pruned from the registry rather than recovered`
43432
+ `worktree ${path107} lies outside any project root; pruned from the registry rather than recovered`
43355
43433
  );
43356
43434
  continue;
43357
43435
  }
43358
- if (!existsSync96(path106)) {
43359
- logVanishedTree(sessions, path106);
43436
+ if (!existsSync96(path107)) {
43437
+ logVanishedTree(sessions, path107);
43360
43438
  vanished.set(clone, [
43361
43439
  ...vanished.get(clone) ?? [],
43362
- { path: path106, branch: basename29(path106) }
43440
+ { path: path107, branch: basename29(path107) }
43363
43441
  ]);
43364
43442
  continue;
43365
43443
  }
43366
- if (accounted.has(path106)) continue;
43367
- await recoverOrphan(sessions, spawnWith, { path: path106, clone }, notify2);
43444
+ if (accounted.has(path107)) continue;
43445
+ await recoverOrphan(sessions, spawnWith, { path: path107, clone }, notify2);
43368
43446
  }
43369
43447
  for (const [clone, paths] of vanished)
43370
43448
  await reclaimVanishedWorktrees(clone, paths);
@@ -45442,12 +45520,12 @@ function handleSetStatus(client, m, d) {
45442
45520
  import * as fs56 from "fs";
45443
45521
 
45444
45522
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
45445
- import * as path105 from "path";
45523
+ import * as path106 from "path";
45446
45524
  async function findCodexRolloutPath(sessionId) {
45447
45525
  if (!sessionId) return null;
45448
45526
  const paths = await discoverCodexRolloutPaths();
45449
45527
  const suffix = `-${sessionId}.jsonl`;
45450
- return paths.find((file) => path105.basename(file).endsWith(suffix)) ?? null;
45528
+ return paths.find((file) => path106.basename(file).endsWith(suffix)) ?? null;
45451
45529
  }
45452
45530
 
45453
45531
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -46030,13 +46108,13 @@ function describePeerError(error) {
46030
46108
  const cause = error.cause;
46031
46109
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
46032
46110
  }
46033
- async function fetchPeerJson(baseUrl, path106, timeoutMs = PEER_TIMEOUT_MS) {
46034
- const res = await fetch(new URL(path106, baseUrl), {
46111
+ async function fetchPeerJson(baseUrl, path107, timeoutMs = PEER_TIMEOUT_MS) {
46112
+ const res = await fetch(new URL(path107, baseUrl), {
46035
46113
  signal: AbortSignal.timeout(timeoutMs)
46036
46114
  });
46037
46115
  if (!res.ok)
46038
46116
  throw Object.assign(
46039
- new Error(`GET ${path106} returned ${res.status} ${res.statusText}`),
46117
+ new Error(`GET ${path107} returned ${res.status} ${res.statusText}`),
46040
46118
  { status: res.status }
46041
46119
  );
46042
46120
  return await res.json();
@@ -46349,7 +46427,7 @@ async function probeSshAgent(alias) {
46349
46427
  }
46350
46428
 
46351
46429
  // src/commands/sessions/nodes/printReport.ts
46352
- import chalk252 from "chalk";
46430
+ import chalk253 from "chalk";
46353
46431
  function printReport(report2) {
46354
46432
  if (report2.links.length === 0) {
46355
46433
  console.log(`${report2.local} has no links`);
@@ -46363,11 +46441,11 @@ function printReport(report2) {
46363
46441
  for (const diagnosis of report2.links) printDiagnosis(diagnosis);
46364
46442
  }
46365
46443
  function printDiagnosis(diagnosis) {
46366
- console.log(`${chalk252.bold(diagnosis.name)} ${chalk252.dim(diagnosis.url)}`);
46444
+ console.log(`${chalk253.bold(diagnosis.name)} ${chalk253.dim(diagnosis.url)}`);
46367
46445
  for (const hop of diagnosis.hops) {
46368
- const mark = hop.ok ? chalk252.green("\u2713") : chalk252.red("\u2717");
46446
+ const mark = hop.ok ? chalk253.green("\u2713") : chalk253.red("\u2717");
46369
46447
  console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
46370
- if (hop.remediation) console.log(` ${chalk252.yellow(hop.remediation)}`);
46448
+ if (hop.remediation) console.log(` ${chalk253.yellow(hop.remediation)}`);
46371
46449
  }
46372
46450
  }
46373
46451
 
@@ -46400,14 +46478,14 @@ async function doctorNodes(name, options2) {
46400
46478
  }
46401
46479
 
46402
46480
  // src/commands/sessions/nodes/linkNode.ts
46403
- import chalk254 from "chalk";
46481
+ import chalk255 from "chalk";
46404
46482
 
46405
46483
  // src/commands/sessions/nodes/notifyDaemonLinks.ts
46406
- import chalk253 from "chalk";
46484
+ import chalk254 from "chalk";
46407
46485
  async function notifyDaemonLinks() {
46408
46486
  if (!await isDaemonRunning()) {
46409
46487
  console.log(
46410
- chalk253.yellow(
46488
+ chalk254.yellow(
46411
46489
  "The sessions daemon is not running; it loads the links when it starts."
46412
46490
  )
46413
46491
  );
@@ -46415,11 +46493,11 @@ async function notifyDaemonLinks() {
46415
46493
  }
46416
46494
  try {
46417
46495
  await sendToDaemonAwaitAck({ type: "reload-links" });
46418
- console.log(chalk253.dim("The sessions daemon reloaded its links."));
46496
+ console.log(chalk254.dim("The sessions daemon reloaded its links."));
46419
46497
  } catch (error) {
46420
46498
  const message3 = error instanceof Error ? error.message : String(error);
46421
46499
  console.log(
46422
- chalk253.yellow(
46500
+ chalk254.yellow(
46423
46501
  `Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
46424
46502
  )
46425
46503
  );
@@ -46479,13 +46557,13 @@ async function linkNode(name, url, options2) {
46479
46557
  const link3 = buildLink(name, url, options2, others);
46480
46558
  await writeLinks([...others, link3]);
46481
46559
  console.log(
46482
- chalk254.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46560
+ chalk255.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46483
46561
  );
46484
46562
  await notifyDaemonLinks();
46485
46563
  }
46486
46564
 
46487
46565
  // src/commands/sessions/nodes/listNodes.ts
46488
- import chalk255 from "chalk";
46566
+ import chalk256 from "chalk";
46489
46567
  async function nodesReport() {
46490
46568
  const live = await queryNodes();
46491
46569
  if (live)
@@ -46502,10 +46580,10 @@ async function listNodes(options2) {
46502
46580
  console.log(JSON.stringify(report2, null, 2));
46503
46581
  return;
46504
46582
  }
46505
- console.log(`${report2.local} ${chalk255.dim("(this node)")}`);
46583
+ console.log(`${report2.local} ${chalk256.dim("(this node)")}`);
46506
46584
  if (!report2.daemonRunning)
46507
- console.log(chalk255.dim(" daemon not running; showing configured links"));
46508
- if (report2.links.length === 0) console.log(chalk255.dim(" no links"));
46585
+ console.log(chalk256.dim(" daemon not running; showing configured links"));
46586
+ if (report2.links.length === 0) console.log(chalk256.dim(" no links"));
46509
46587
  for (const link3 of report2.links) console.log(formatLink(link3));
46510
46588
  }
46511
46589
 
@@ -46544,16 +46622,16 @@ async function nodeLogs(name, options2) {
46544
46622
  }
46545
46623
 
46546
46624
  // src/commands/sessions/nodes/unlinkNode.ts
46547
- import chalk256 from "chalk";
46625
+ import chalk257 from "chalk";
46548
46626
  async function unlinkNode(name) {
46549
46627
  const links2 = readLinks();
46550
46628
  const remaining = links2.filter((link3) => link3.name !== name);
46551
46629
  if (remaining.length === links2.length) {
46552
- console.log(chalk256.yellow(`No link named ${name}`));
46630
+ console.log(chalk257.yellow(`No link named ${name}`));
46553
46631
  return;
46554
46632
  }
46555
46633
  await writeLinks(remaining);
46556
- console.log(chalk256.green(`Unlinked ${name}`));
46634
+ console.log(chalk257.green(`Unlinked ${name}`));
46557
46635
  await notifyDaemonLinks();
46558
46636
  }
46559
46637
 
@@ -46692,7 +46770,7 @@ async function renameSession(title) {
46692
46770
 
46693
46771
  // src/commands/sessions/summarise.ts
46694
46772
  import * as fs58 from "fs";
46695
- import chalk257 from "chalk";
46773
+ import chalk258 from "chalk";
46696
46774
 
46697
46775
  // src/commands/sessions/summarise/shared.ts
46698
46776
  import * as fs57 from "fs";
@@ -46751,22 +46829,22 @@ ${firstMessage}`);
46751
46829
  async function summarise2(options2) {
46752
46830
  const files = await discoverSessionFiles();
46753
46831
  if (files.length === 0) {
46754
- console.log(chalk257.yellow("No sessions found."));
46832
+ console.log(chalk258.yellow("No sessions found."));
46755
46833
  return;
46756
46834
  }
46757
46835
  const toProcess = selectCandidates(files, options2);
46758
46836
  if (toProcess.length === 0) {
46759
- console.log(chalk257.green("All sessions already summarised."));
46837
+ console.log(chalk258.green("All sessions already summarised."));
46760
46838
  return;
46761
46839
  }
46762
46840
  console.log(
46763
- chalk257.cyan(
46841
+ chalk258.cyan(
46764
46842
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
46765
46843
  )
46766
46844
  );
46767
46845
  const { succeeded, failed: failed3 } = processSessions(toProcess);
46768
46846
  console.log(
46769
- chalk257.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk257.yellow(`, ${failed3} skipped`) : "")
46847
+ chalk258.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk258.yellow(`, ${failed3} skipped`) : "")
46770
46848
  );
46771
46849
  }
46772
46850
  function selectCandidates(files, options2) {
@@ -46786,16 +46864,16 @@ function processSessions(files) {
46786
46864
  let failed3 = 0;
46787
46865
  for (let i = 0; i < files.length; i++) {
46788
46866
  const file = files[i];
46789
- process.stdout.write(chalk257.dim(` [${i + 1}/${files.length}] `));
46867
+ process.stdout.write(chalk258.dim(` [${i + 1}/${files.length}] `));
46790
46868
  const summary = summariseSession(file);
46791
46869
  if (summary) {
46792
46870
  writeSummary(file, summary);
46793
46871
  succeeded++;
46794
- process.stdout.write(`${chalk257.green("\u2713")} ${summary}
46872
+ process.stdout.write(`${chalk258.green("\u2713")} ${summary}
46795
46873
  `);
46796
46874
  } else {
46797
46875
  failed3++;
46798
- process.stdout.write(` ${chalk257.yellow("skip")}
46876
+ process.stdout.write(` ${chalk258.yellow("skip")}
46799
46877
  `);
46800
46878
  }
46801
46879
  }
@@ -46824,10 +46902,10 @@ function registerSessions(program2) {
46824
46902
  }
46825
46903
 
46826
46904
  // src/reportCliError.ts
46827
- import chalk258 from "chalk";
46905
+ import chalk259 from "chalk";
46828
46906
  function reportCliError(error) {
46829
46907
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
46830
- console.error(chalk258.red(error.message));
46908
+ console.error(chalk259.red(error.message));
46831
46909
  } else {
46832
46910
  console.error(error);
46833
46911
  }