@staff0rd/assist 0.721.2 → 0.722.0

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