@staff0rd/assist 0.719.0 → 0.720.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.719.0",
9
+ version: "0.720.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(path104) {
300
- return path104.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path105) {
300
+ return path105.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(path104) {
350
+ function isFile(path105) {
351
351
  try {
352
- return statSync(path104).isFile();
352
+ return statSync(path105).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(path104) {
371
+ function readTrimmed(path105) {
372
372
  try {
373
- const content = readFileSync2(path104, "utf8").trim();
373
+ const content = readFileSync2(path105, "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(path104) {
387
- if (!existsSync3(path104)) return {};
386
+ function loadRawYaml(path105) {
387
+ if (!existsSync3(path105)) return {};
388
388
  try {
389
- const content = readFileSync3(path104, "utf8");
389
+ const content = readFileSync3(path105, "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 path104 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path104.split("/").filter(Boolean);
461
+ const path105 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path105.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -697,7 +697,8 @@ var assistConfigShape = {
697
697
  }).optional(),
698
698
  restructure: z3.strictObject({
699
699
  ignore: z3.array(z3.string()).default([]),
700
- pin: z3.array(z3.string()).default([])
700
+ pin: z3.array(z3.string()).default([]),
701
+ maxDepth: z3.number().int().positive().default(10)
701
702
  }).optional(),
702
703
  jira: z3.strictObject({
703
704
  acField: z3.string().default("customfield_11937")
@@ -4319,8 +4320,8 @@ function getPreferredRemoteRepo(cwd) {
4319
4320
  function gitRefUrl(kind, ref, cwd) {
4320
4321
  const repo = getPreferredRemoteRepo(cwd);
4321
4322
  if (!repo) return void 0;
4322
- const path104 = kind === "branch" ? "tree" : "commit";
4323
- return `https://github.com/${repo.org}/${repo.repo}/${path104}/${ref}`;
4323
+ const path105 = kind === "branch" ? "tree" : "commit";
4324
+ return `https://github.com/${repo.org}/${repo.repo}/${path105}/${ref}`;
4324
4325
  }
4325
4326
 
4326
4327
  // src/commands/sessions/shared/resolveSessionTranscript.ts
@@ -4481,9 +4482,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
4481
4482
  function backupLocalBacklogFiles(dir) {
4482
4483
  const moved = [];
4483
4484
  for (const name of LOCAL_FILES) {
4484
- const path104 = join19(dir, ".assist", name);
4485
- if (existsSync20(path104)) {
4486
- renameSync(path104, `${path104}.bak`);
4485
+ const path105 = join19(dir, ".assist", name);
4486
+ if (existsSync20(path105)) {
4487
+ renameSync(path105, `${path105}.bak`);
4487
4488
  moved.push(`${name} \u2192 ${name}.bak`);
4488
4489
  }
4489
4490
  }
@@ -4967,8 +4968,8 @@ var backlogItemSchema = z4.strictObject({
4967
4968
  var backlogFileSchema = z4.array(backlogItemSchema);
4968
4969
 
4969
4970
  // src/commands/backlog/parseBacklogJsonl.ts
4970
- function parseBacklogJsonl(path104) {
4971
- const content = readFileSync13(path104, "utf8").trim();
4971
+ function parseBacklogJsonl(path105) {
4972
+ const content = readFileSync13(path105, "utf8").trim();
4972
4973
  if (content.length === 0) return [];
4973
4974
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
4974
4975
  }
@@ -5514,9 +5515,9 @@ function originToSshUrl(origin) {
5514
5515
  const firstSlash = origin.indexOf("/");
5515
5516
  if (firstSlash <= 0) return null;
5516
5517
  const host = origin.slice(0, firstSlash);
5517
- const path104 = origin.slice(firstSlash + 1);
5518
- if (!path104) return null;
5519
- return `git@${host}:${path104}.git`;
5518
+ const path105 = origin.slice(firstSlash + 1);
5519
+ if (!path105) return null;
5520
+ return `git@${host}:${path105}.git`;
5520
5521
  }
5521
5522
 
5522
5523
  // src/commands/backlog/cloneRepo.ts
@@ -7154,10 +7155,10 @@ var hooksSettings = {
7154
7155
  }
7155
7156
  };
7156
7157
  function ensureHooksSettings() {
7157
- const path104 = daemonPaths.hooksSettings;
7158
- mkdirSync5(dirname15(path104), { recursive: true });
7159
- writeFileSync16(path104, JSON.stringify(hooksSettings, null, 2));
7160
- return path104;
7158
+ const path105 = daemonPaths.hooksSettings;
7159
+ mkdirSync5(dirname15(path105), { recursive: true });
7160
+ writeFileSync16(path105, JSON.stringify(hooksSettings, null, 2));
7161
+ return path105;
7161
7162
  }
7162
7163
 
7163
7164
  // src/shared/spawnInherit.ts
@@ -7913,24 +7914,24 @@ function getOwnerPath(itemId2) {
7913
7914
  function recordSignalOwner(itemId2) {
7914
7915
  const sessionId = process.env.ASSIST_SESSION_ID;
7915
7916
  if (!sessionId) return;
7916
- const path104 = getOwnerPath(itemId2);
7917
- mkdirSync7(dirname16(path104), { recursive: true });
7918
- writeFileSync18(path104, JSON.stringify({ sessionId }));
7917
+ const path105 = getOwnerPath(itemId2);
7918
+ mkdirSync7(dirname16(path105), { recursive: true });
7919
+ writeFileSync18(path105, JSON.stringify({ sessionId }));
7919
7920
  }
7920
7921
  function readSignalOwner(itemId2) {
7921
- const path104 = getOwnerPath(itemId2);
7922
- if (!existsSync26(path104)) return void 0;
7922
+ const path105 = getOwnerPath(itemId2);
7923
+ if (!existsSync26(path105)) return void 0;
7923
7924
  try {
7924
- const parsed = JSON.parse(readFileSync17(path104, "utf8"));
7925
+ const parsed = JSON.parse(readFileSync17(path105, "utf8"));
7925
7926
  return parsed.sessionId;
7926
7927
  } catch {
7927
7928
  return void 0;
7928
7929
  }
7929
7930
  }
7930
7931
  function clearSignalOwner(itemId2) {
7931
- const path104 = getOwnerPath(itemId2);
7932
+ const path105 = getOwnerPath(itemId2);
7932
7933
  try {
7933
- rmSync(path104);
7934
+ rmSync(path105);
7934
7935
  } catch {
7935
7936
  }
7936
7937
  }
@@ -7967,19 +7968,19 @@ function resolveSignalTarget(event, data) {
7967
7968
  function writeSignal(event, data) {
7968
7969
  const target = resolveSignalTarget(event, data);
7969
7970
  if (!target) return;
7970
- const path104 = getSignalPath(target);
7971
- if (!path104) return;
7971
+ const path105 = getSignalPath(target);
7972
+ if (!path105) return;
7972
7973
  const signal = { event, sessionId: target, ...data };
7973
- mkdirSync8(dirname17(path104), { recursive: true });
7974
- writeFileSync19(path104, JSON.stringify(signal));
7974
+ mkdirSync8(dirname17(path105), { recursive: true });
7975
+ writeFileSync19(path105, JSON.stringify(signal));
7975
7976
  }
7976
7977
 
7977
7978
  // src/commands/backlog/readSignal.ts
7978
7979
  function readSignal() {
7979
- const path104 = getSignalPath();
7980
- if (!path104 || !existsSync27(path104)) return void 0;
7980
+ const path105 = getSignalPath();
7981
+ if (!path105 || !existsSync27(path105)) return void 0;
7981
7982
  try {
7982
- return JSON.parse(readFileSync18(path104, "utf8"));
7983
+ return JSON.parse(readFileSync18(path105, "utf8"));
7983
7984
  } catch {
7984
7985
  return void 0;
7985
7986
  }
@@ -8177,13 +8178,13 @@ function activityPath(sessionId) {
8177
8178
  function emitActivity(activity2) {
8178
8179
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8179
8180
  if (!sessionId) return;
8180
- const path104 = activityPath(sessionId);
8181
- mkdirSync9(dirname18(path104), { recursive: true });
8182
- writeFileSync20(path104, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8181
+ const path105 = activityPath(sessionId);
8182
+ mkdirSync9(dirname18(path105), { recursive: true });
8183
+ writeFileSync20(path105, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8183
8184
  }
8184
- function readActivity(path104) {
8185
+ function readActivity(path105) {
8185
8186
  try {
8186
- return JSON.parse(readFileSync19(path104, "utf8"));
8187
+ return JSON.parse(readFileSync19(path105, "utf8"));
8187
8188
  } catch {
8188
8189
  return void 0;
8189
8190
  }
@@ -8193,9 +8194,9 @@ function reconcileActivity(sessionId, activity2) {
8193
8194
  removeActivity(sessionId);
8194
8195
  return;
8195
8196
  }
8196
- const path104 = activityPath(sessionId);
8197
- mkdirSync9(dirname18(path104), { recursive: true });
8198
- writeFileSync20(path104, JSON.stringify(activity2));
8197
+ const path105 = activityPath(sessionId);
8198
+ mkdirSync9(dirname18(path105), { recursive: true });
8199
+ writeFileSync20(path105, JSON.stringify(activity2));
8199
8200
  }
8200
8201
  function removeActivity(sessionId) {
8201
8202
  try {
@@ -10820,10 +10821,10 @@ function getStorePath(filename) {
10820
10821
  return join34(getStoreDir(), filename);
10821
10822
  }
10822
10823
  function loadJson(filename) {
10823
- const path104 = getStorePath(filename);
10824
- if (existsSync32(path104)) {
10824
+ const path105 = getStorePath(filename);
10825
+ if (existsSync32(path105)) {
10825
10826
  try {
10826
- return JSON.parse(readFileSync20(path104, "utf8"));
10827
+ return JSON.parse(readFileSync20(path105, "utf8"));
10827
10828
  } catch {
10828
10829
  return {};
10829
10830
  }
@@ -10842,22 +10843,22 @@ function saveJson(filename, data) {
10842
10843
  var REGISTRY_FILE = "worktrees.json";
10843
10844
  function readWorktreeRegistry() {
10844
10845
  const data = loadJson(REGISTRY_FILE);
10845
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path104, record]) => ({ path: path104, ...record }));
10846
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path105, record]) => ({ path: path105, ...record }));
10846
10847
  }
10847
- function worktreeAttributionIncludingReaped(path104) {
10848
- const record = loadJson(REGISTRY_FILE)[path104];
10848
+ function worktreeAttributionIncludingReaped(path105) {
10849
+ const record = loadJson(REGISTRY_FILE)[path105];
10849
10850
  return record ? { clone: record.clone, origin: record.origin } : void 0;
10850
10851
  }
10851
- function recordWorktree(path104, clone, origin) {
10852
+ function recordWorktree(path105, clone, origin) {
10852
10853
  const data = loadJson(REGISTRY_FILE);
10853
- data[path104] = { clone, origin };
10854
+ data[path105] = { clone, origin };
10854
10855
  saveJson(REGISTRY_FILE, data);
10855
10856
  }
10856
- function forgetWorktree(path104) {
10857
+ function forgetWorktree(path105) {
10857
10858
  const data = loadJson(REGISTRY_FILE);
10858
- const record = data[path104];
10859
+ const record = data[path105];
10859
10860
  if (!record || record.reaped) return;
10860
- data[path104] = { ...record, reaped: true };
10861
+ data[path105] = { ...record, reaped: true };
10861
10862
  saveJson(REGISTRY_FILE, data);
10862
10863
  }
10863
10864
 
@@ -11467,10 +11468,10 @@ function completeLines(text18, windowIsPartial) {
11467
11468
  if (windowIsPartial) all.shift();
11468
11469
  return all;
11469
11470
  }
11470
- function readLogTail(path104, lines2) {
11471
+ function readLogTail(path105, lines2) {
11471
11472
  let fd;
11472
11473
  try {
11473
- fd = openSync4(path104, "r");
11474
+ fd = openSync4(path105, "r");
11474
11475
  } catch {
11475
11476
  return [];
11476
11477
  }
@@ -11735,8 +11736,8 @@ async function loadCommittedPaths(cwd, sessionId) {
11735
11736
  for (const commit2 of commits2) {
11736
11737
  const resolved = await resolveCommit(cwd, commit2.sha);
11737
11738
  if (!resolved) continue;
11738
- for (const path104 of resolved.paths) {
11739
- if (!bases.has(path104)) bases.set(path104, resolved.base);
11739
+ for (const path105 of resolved.paths) {
11740
+ if (!bases.has(path105)) bases.set(path105, resolved.base);
11740
11741
  }
11741
11742
  }
11742
11743
  return { commits: commits2, bases };
@@ -11754,16 +11755,16 @@ async function itemChangeSet(cwd, sessionId) {
11754
11755
  }
11755
11756
  function groupByBase(bases) {
11756
11757
  const groups = /* @__PURE__ */ new Map();
11757
- for (const [path104, base] of bases) {
11758
+ for (const [path105, base] of bases) {
11758
11759
  const paths = groups.get(base);
11759
- if (paths) paths.push(path104);
11760
- else groups.set(base, [path104]);
11760
+ if (paths) paths.push(path105);
11761
+ else groups.set(base, [path105]);
11761
11762
  }
11762
11763
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
11763
11764
  }
11764
11765
  async function dirtyPaths(cwd, bases) {
11765
11766
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
11766
- return output.split("\n").filter((path104) => path104 && !bases.has(path104)).sort();
11767
+ return output.split("\n").filter((path105) => path105 && !bases.has(path105)).sort();
11767
11768
  }
11768
11769
 
11769
11770
  // src/commands/sessions/web/scopedDiff.ts
@@ -11772,8 +11773,8 @@ async function scopedDiff(cwd, session, scope) {
11772
11773
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
11773
11774
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
11774
11775
  }
11775
- async function untrackedFileDiff(cwd, path104) {
11776
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path104], {
11776
+ async function untrackedFileDiff(cwd, path105) {
11777
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path105], {
11777
11778
  maxBuffer: MAX_DIFF_BYTES,
11778
11779
  allowFailure: true
11779
11780
  });
@@ -11786,7 +11787,7 @@ async function untrackedDiff(cwd) {
11786
11787
  ]);
11787
11788
  const paths = list5.split("\n").filter(Boolean);
11788
11789
  const diffs = await Promise.all(
11789
- paths.map((path104) => untrackedFileDiff(cwd, path104))
11790
+ paths.map((path105) => untrackedFileDiff(cwd, path105))
11790
11791
  );
11791
11792
  return diffs.join("");
11792
11793
  }
@@ -11879,9 +11880,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
11879
11880
  function repoRoot(cwd) {
11880
11881
  return resolve10(cwd);
11881
11882
  }
11882
- function resolveWithinCwd(cwd, path104) {
11883
+ function resolveWithinCwd(cwd, path105) {
11883
11884
  const root2 = repoRoot(cwd);
11884
- const target = resolve10(root2, path104);
11885
+ const target = resolve10(root2, path105);
11885
11886
  const rel = relative2(root2, target);
11886
11887
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
11887
11888
  return target;
@@ -11891,14 +11892,14 @@ function resolveWithinCwd(cwd, path104) {
11891
11892
  function getFileTarget(req, res) {
11892
11893
  const cwd = getCwdParam(req, res);
11893
11894
  if (!cwd) return null;
11894
- const path104 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11895
+ const path105 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11895
11896
  "path"
11896
11897
  );
11897
- if (!path104) {
11898
+ if (!path105) {
11898
11899
  respondJson(res, 400, { error: "Missing path" });
11899
11900
  return null;
11900
11901
  }
11901
- const target = resolveWithinCwd(cwd, path104);
11902
+ const target = resolveWithinCwd(cwd, path105);
11902
11903
  if (!target) {
11903
11904
  respondJson(res, 400, { error: "Path outside cwd" });
11904
11905
  return null;
@@ -11957,9 +11958,9 @@ function segmentText(segment) {
11957
11958
  if (segment.kind === "index") return `[${segment.index}]`;
11958
11959
  return "[]";
11959
11960
  }
11960
- function formatConfigPath(path104) {
11961
+ function formatConfigPath(path105) {
11961
11962
  let text18 = "";
11962
- for (const segment of path104) {
11963
+ for (const segment of path105) {
11963
11964
  const dotted = segment.kind === "key" || segment.kind === "entry";
11964
11965
  const rendered = segmentText(segment);
11965
11966
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -12120,11 +12121,11 @@ function enumValues(node) {
12120
12121
  function opaqueConfigNode(inner, base) {
12121
12122
  return { ...base, kind: "other", type: leafTypeOf(inner) };
12122
12123
  }
12123
- function build(node, path104) {
12124
+ function build(node, path105) {
12124
12125
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
12125
12126
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
12126
12127
  const base = {
12127
- path: path104,
12128
+ path: path105,
12128
12129
  ...optional ? { optional: true } : {},
12129
12130
  ...defaultValue === void 0 ? {} : { defaultValue },
12130
12131
  ...secret ? { secret: true } : {}
@@ -12180,11 +12181,11 @@ function describeConfigLeaves(schema2) {
12180
12181
 
12181
12182
  // src/commands/config/globalConfigFileLabel.ts
12182
12183
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
12183
- function globalConfigFileLabel(path104) {
12184
- if (path104 === getGlobalConfigPath()) return "~/.assist.yml";
12185
- if (path104.startsWith(WINDOWS_MOUNT_PREFIX))
12186
- return `${path104} on the Windows host`;
12187
- return path104;
12184
+ function globalConfigFileLabel(path105) {
12185
+ if (path105 === getGlobalConfigPath()) return "~/.assist.yml";
12186
+ if (path105.startsWith(WINDOWS_MOUNT_PREFIX))
12187
+ return `${path105} on the Windows host`;
12188
+ return path105;
12188
12189
  }
12189
12190
 
12190
12191
  // src/commands/config/readRawConfigLayers.ts
@@ -12241,35 +12242,35 @@ function isPlainRecord(value) {
12241
12242
  }
12242
12243
 
12243
12244
  // src/shared/mapConfigSecrets.ts
12244
- function mapChildren(value, path104, childNode, map) {
12245
+ function mapChildren(value, path105, childNode, map) {
12245
12246
  if (!isPlainRecord(value)) return value;
12246
12247
  return Object.fromEntries(
12247
12248
  Object.entries(value).map(([name, child]) => [
12248
12249
  name,
12249
- walk(child, [...path104, name], childNode(name), map)
12250
+ walk(child, [...path105, name], childNode(name), map)
12250
12251
  ])
12251
12252
  );
12252
12253
  }
12253
- function mapItems(value, path104, item, map) {
12254
+ function mapItems(value, path105, item, map) {
12254
12255
  if (!Array.isArray(value)) return value;
12255
- return value.map((entry, index3) => walk(entry, [...path104, index3], item, map));
12256
+ return value.map((entry, index3) => walk(entry, [...path105, index3], item, map));
12256
12257
  }
12257
- function walk(value, path104, node, map) {
12258
+ function walk(value, path105, node, map) {
12258
12259
  if (!node || value === void 0 || value === null) return value;
12259
- if (node.secret) return map(value, path104);
12260
+ if (node.secret) return map(value, path105);
12260
12261
  switch (node.kind) {
12261
12262
  case "object":
12262
12263
  case "unionOfObjects":
12263
12264
  return mapChildren(
12264
12265
  value,
12265
- path104,
12266
+ path105,
12266
12267
  (name) => configNodeField(node, name),
12267
12268
  map
12268
12269
  );
12269
12270
  case "objectList":
12270
- return mapItems(value, path104, node.item, map);
12271
+ return mapItems(value, path105, node.item, map);
12271
12272
  case "record":
12272
- return mapChildren(value, path104, () => node.value, map);
12273
+ return mapChildren(value, path105, () => node.value, map);
12273
12274
  default:
12274
12275
  return value;
12275
12276
  }
@@ -12294,9 +12295,9 @@ function isTraversable(value) {
12294
12295
  function stepInto(current, key) {
12295
12296
  return isTraversable(current) ? current[key] : void 0;
12296
12297
  }
12297
- function getNestedValue(obj, path104) {
12298
+ function getNestedValue(obj, path105) {
12298
12299
  let current = obj;
12299
- for (const key of path104.split(".")) current = stepInto(current, key);
12300
+ for (const key of path105.split(".")) current = stepInto(current, key);
12300
12301
  return current;
12301
12302
  }
12302
12303
 
@@ -12346,9 +12347,9 @@ function step(node, segment) {
12346
12347
  return void 0;
12347
12348
  }
12348
12349
  }
12349
- function findConfigNode(root2, path104) {
12350
+ function findConfigNode(root2, path105) {
12350
12351
  let current = root2;
12351
- for (const segment of path104) {
12352
+ for (const segment of path105) {
12352
12353
  if (!current) return void 0;
12353
12354
  current = step(current, segment);
12354
12355
  }
@@ -12365,34 +12366,34 @@ function nameSegment(name) {
12365
12366
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
12366
12367
  }
12367
12368
  function parseConfigPath(text18) {
12368
- const path104 = [];
12369
+ const path105 = [];
12369
12370
  let at2 = 0;
12370
12371
  while (at2 < text18.length) {
12371
12372
  if (text18[at2] === "[") {
12372
12373
  const close = text18.indexOf("]", at2);
12373
12374
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
12374
12375
  if (!segment) return void 0;
12375
- path104.push(segment);
12376
+ path105.push(segment);
12376
12377
  at2 = close + 1;
12377
12378
  continue;
12378
12379
  }
12379
12380
  if (text18[at2] === ".") {
12380
- if (path104.length === 0) return void 0;
12381
+ if (path105.length === 0) return void 0;
12381
12382
  at2 += 1;
12382
12383
  }
12383
12384
  const start3 = at2;
12384
12385
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
12385
12386
  const name = text18.slice(start3, at2);
12386
12387
  if (!name) return void 0;
12387
- path104.push(nameSegment(name));
12388
+ path105.push(nameSegment(name));
12388
12389
  }
12389
- return path104;
12390
+ return path105;
12390
12391
  }
12391
12392
 
12392
12393
  // src/commands/config/configEntryNode.ts
12393
12394
  function configEntryNode(root2, key) {
12394
- const path104 = parseConfigPath(key);
12395
- return path104 ? findConfigNode(root2, path104) : void 0;
12395
+ const path105 = parseConfigPath(key);
12396
+ return path105 ? findConfigNode(root2, path105) : void 0;
12396
12397
  }
12397
12398
 
12398
12399
  // src/commands/backlog/harnessConfigHelp.ts
@@ -12623,6 +12624,11 @@ var refactorConfigHelp = [
12623
12624
  key: "restructure.pin",
12624
12625
  setter: 'assist config set restructure.pin "SessionCard"',
12625
12626
  note: "module names (basename without extension) restructure lifts out of deep import chains into the folder of the nearest root or pinned module above them, together with their subtrees"
12627
+ },
12628
+ {
12629
+ key: "restructure.maxDepth",
12630
+ setter: "assist config set restructure.maxDepth 10",
12631
+ 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"
12626
12632
  }
12627
12633
  ];
12628
12634
 
@@ -13131,7 +13137,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
13131
13137
  const parent = dirname22(branchKeyPath);
13132
13138
  const branchPrefix = basename10(branchKeyPath);
13133
13139
  if (!existsSync34(parent)) return null;
13134
- const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path104) => existsSync34(path104)).map((path104) => ({ path: path104, mtime: statSync5(path104).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13140
+ const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path105) => existsSync34(path105)).map((path105) => ({ path: path105, mtime: statSync5(path105).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13135
13141
  return synthesisFiles[0]?.path ?? null;
13136
13142
  }
13137
13143
 
@@ -13161,12 +13167,12 @@ async function getReviewSynthesis(req, res) {
13161
13167
  const cwd = getCwdParam(req, res);
13162
13168
  if (!cwd) return;
13163
13169
  try {
13164
- const path104 = await resolveSynthesisPath(cwd);
13165
- if (!path104) {
13170
+ const path105 = await resolveSynthesisPath(cwd);
13171
+ if (!path105) {
13166
13172
  respondJson(res, 404, { error: "No synthesis found" });
13167
13173
  return;
13168
13174
  }
13169
- respondJson(res, 200, { synthesis: readFileSync22(path104, "utf8") });
13175
+ respondJson(res, 200, { synthesis: readFileSync22(path105, "utf8") });
13170
13176
  } catch {
13171
13177
  respondJson(res, 404, { error: "No synthesis found" });
13172
13178
  }
@@ -13249,8 +13255,8 @@ function parseDiffNameStatus(output) {
13249
13255
  if (!status3 || fields.length < 2) continue;
13250
13256
  const category = categorize(status3[0]);
13251
13257
  if (!category) continue;
13252
- const path104 = fields[fields.length - 1];
13253
- if (path104) result[category].push(path104);
13258
+ const path105 = fields[fields.length - 1];
13259
+ if (path105) result[category].push(path105);
13254
13260
  }
13255
13261
  return result;
13256
13262
  }
@@ -13460,21 +13466,21 @@ function subsequenceScore(text18, query) {
13460
13466
  }
13461
13467
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13462
13468
  }
13463
- function scoreFilePath(path104, query) {
13469
+ function scoreFilePath(path105, query) {
13464
13470
  const needle = query.trim().toLowerCase();
13465
13471
  if (!needle) return 0;
13466
- const basename31 = path104.slice(path104.lastIndexOf("/") + 1);
13472
+ const basename31 = path105.slice(path105.lastIndexOf("/") + 1);
13467
13473
  const inBasename = subsequenceScore(basename31, needle);
13468
13474
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13469
- return subsequenceScore(path104, needle);
13475
+ return subsequenceScore(path105, needle);
13470
13476
  }
13471
13477
 
13472
13478
  // src/commands/sessions/web/rankFilePaths.ts
13473
13479
  function rankFilePaths(paths, query, limit) {
13474
13480
  const scored = [];
13475
- for (const path104 of paths) {
13476
- const score = scoreFilePath(path104, query);
13477
- if (score !== null) scored.push({ path: path104, score });
13481
+ for (const path105 of paths) {
13482
+ const score = scoreFilePath(path105, query);
13483
+ if (score !== null) scored.push({ path: path105, score });
13478
13484
  }
13479
13485
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
13480
13486
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -14184,11 +14190,11 @@ function logLinkedRequest(req, res) {
14184
14190
  const started = Date.now();
14185
14191
  const from = req.headers[LINKED_FROM_HEADER2];
14186
14192
  const trace = req.headers[TRACE_HEADER] ?? "none";
14187
- const path104 = new URL(req.url ?? "/", "http://localhost").pathname;
14193
+ const path105 = new URL(req.url ?? "/", "http://localhost").pathname;
14188
14194
  res.once("finish", () => {
14189
- if (isQuietPoll(path104, res.statusCode)) return;
14195
+ if (isQuietPoll(path105, res.statusCode)) return;
14190
14196
  console.log(
14191
- `link-from ${from} http: ${req.method} ${path104} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14197
+ `link-from ${from} http: ${req.method} ${path105} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14192
14198
  );
14193
14199
  });
14194
14200
  }
@@ -14576,8 +14582,8 @@ async function liveDeployments(cwd, repo, environments) {
14576
14582
 
14577
14583
  // src/commands/sessions/web/releases/latestRun.ts
14578
14584
  async function latestRun(cwd, repo, workflow) {
14579
- const path104 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14580
- const response = await ghJson(cwd, ["api", path104]);
14585
+ const path105 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14586
+ const response = await ghJson(cwd, ["api", path105]);
14581
14587
  const run4 = response.workflow_runs?.[0];
14582
14588
  if (!run4) return null;
14583
14589
  return {
@@ -14858,38 +14864,38 @@ async function performRestart(target, deps2 = {}) {
14858
14864
  import { relative as relative3 } from "path";
14859
14865
 
14860
14866
  // src/commands/sessions/web/revertPathChanges.ts
14861
- async function isTracked(cwd, path104) {
14867
+ async function isTracked(cwd, path105) {
14862
14868
  try {
14863
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path104]);
14869
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path105]);
14864
14870
  return true;
14865
14871
  } catch {
14866
14872
  return false;
14867
14873
  }
14868
14874
  }
14869
- async function isInHead(cwd, path104) {
14870
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path104]);
14875
+ async function isInHead(cwd, path105) {
14876
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path105]);
14871
14877
  return listing.trim().length > 0;
14872
14878
  }
14873
- async function revertPathChanges(cwd, path104) {
14874
- if (!await isTracked(cwd, path104)) {
14875
- await execGit(cwd, ["clean", "-f", "--", path104]);
14879
+ async function revertPathChanges(cwd, path105) {
14880
+ if (!await isTracked(cwd, path105)) {
14881
+ await execGit(cwd, ["clean", "-f", "--", path105]);
14876
14882
  return;
14877
14883
  }
14878
- if (await isInHead(cwd, path104)) {
14879
- await execGit(cwd, ["checkout", "HEAD", "--", path104]);
14884
+ if (await isInHead(cwd, path105)) {
14885
+ await execGit(cwd, ["checkout", "HEAD", "--", path105]);
14880
14886
  return;
14881
14887
  }
14882
- await execGit(cwd, ["rm", "-f", "--", path104]);
14888
+ await execGit(cwd, ["rm", "-f", "--", path105]);
14883
14889
  }
14884
14890
 
14885
14891
  // src/commands/sessions/web/revertDiffFile.ts
14886
14892
  async function revertDiffFile(req, res) {
14887
14893
  const resolved = getFileTarget(req, res);
14888
14894
  if (!resolved) return;
14889
- const path104 = relative3(repoRoot(resolved.cwd), resolved.target);
14895
+ const path105 = relative3(repoRoot(resolved.cwd), resolved.target);
14890
14896
  try {
14891
- await revertPathChanges(resolved.cwd, path104);
14892
- respondJson(res, 200, { reverted: path104 });
14897
+ await revertPathChanges(resolved.cwd, path105);
14898
+ respondJson(res, 200, { reverted: path105 });
14893
14899
  } catch (error) {
14894
14900
  respondJson(res, 500, {
14895
14901
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -14994,7 +15000,7 @@ async function readJsonBody(req) {
14994
15000
  function requestedPaths(body) {
14995
15001
  const paths = body.paths;
14996
15002
  if (!Array.isArray(paths)) return null;
14997
- if (paths.some((path104) => typeof path104 !== "string")) return null;
15003
+ if (paths.some((path105) => typeof path105 !== "string")) return null;
14998
15004
  return paths;
14999
15005
  }
15000
15006
  async function revertDiffPaths(req, res) {
@@ -15014,10 +15020,10 @@ async function revertDiffPaths(req, res) {
15014
15020
  const root2 = repoRoot(cwd);
15015
15021
  const reverted = [];
15016
15022
  const failed3 = [];
15017
- for (const path104 of paths) {
15018
- const target = resolveWithinCwd(cwd, path104);
15023
+ for (const path105 of paths) {
15024
+ const target = resolveWithinCwd(cwd, path105);
15019
15025
  if (!target) {
15020
- failed3.push({ path: path104, error: "Path outside cwd" });
15026
+ failed3.push({ path: path105, error: "Path outside cwd" });
15021
15027
  continue;
15022
15028
  }
15023
15029
  const relativePath = relative4(root2, target);
@@ -15116,11 +15122,11 @@ function coerceStructuredConfigValue(key, raw) {
15116
15122
  };
15117
15123
  }
15118
15124
  function formatIssue(key, issue) {
15119
- const path104 = formatConfigPath([
15125
+ const path105 = formatConfigPath([
15120
15126
  { kind: "key", name: key },
15121
15127
  ...issue.path.map(toSegment)
15122
15128
  ]);
15123
- return `${path104}: ${issue.message}`;
15129
+ return `${path105}: ${issue.message}`;
15124
15130
  }
15125
15131
  function toSegment(part) {
15126
15132
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -15215,9 +15221,9 @@ function coerceUnion(key, raw, types) {
15215
15221
  }
15216
15222
 
15217
15223
  // src/shared/valueAtConfigPath.ts
15218
- function valueAtConfigPath(value, path104) {
15224
+ function valueAtConfigPath(value, path105) {
15219
15225
  let current = value;
15220
- for (const key of path104) {
15226
+ for (const key of path105) {
15221
15227
  if (typeof key === "number") {
15222
15228
  if (!Array.isArray(current)) return void 0;
15223
15229
  current = current[key];
@@ -15234,7 +15240,7 @@ function restoreConfigSecrets(value, stored, node) {
15234
15240
  return mapConfigSecrets(
15235
15241
  value,
15236
15242
  node,
15237
- (secret, path104) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path104) : secret
15243
+ (secret, path105) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path105) : secret
15238
15244
  );
15239
15245
  }
15240
15246
 
@@ -15283,8 +15289,8 @@ function stepIntoNested(container, key, nextKey) {
15283
15289
  }
15284
15290
  return ensureObject(container, resolved);
15285
15291
  }
15286
- function setNestedValue(obj, path104, value) {
15287
- const keys = path104.split(".");
15292
+ function setNestedValue(obj, path105, value) {
15293
+ const keys = path105.split(".");
15288
15294
  const result = { ...obj };
15289
15295
  let current = result;
15290
15296
  for (let i = 0; i < keys.length - 1; i++) {
@@ -15311,8 +15317,8 @@ function formatIssue2(issue, key) {
15311
15317
  return issue.keys.map(
15312
15318
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
15313
15319
  );
15314
- const path104 = issue.path.length > 0 ? issue.path.join(".") : key;
15315
- return [`${path104}: ${issue.message}`];
15320
+ const path105 = issue.path.length > 0 ? issue.path.join(".") : key;
15321
+ return [`${path105}: ${issue.message}`];
15316
15322
  }
15317
15323
 
15318
15324
  // src/commands/config/applyConfigSet.ts
@@ -15554,8 +15560,8 @@ function removeAt(container, keys) {
15554
15560
  }
15555
15561
  return removeFromChild(container, key, rest);
15556
15562
  }
15557
- function unsetNestedValue(obj, path104) {
15558
- const { container, removed } = removeAt(obj, path104.split("."));
15563
+ function unsetNestedValue(obj, path105) {
15564
+ const { container, removed } = removeAt(obj, path105.split("."));
15559
15565
  return { config: container, removed };
15560
15566
  }
15561
15567
 
@@ -17044,13 +17050,13 @@ function findBuiltinDenyRaw(rawCommand) {
17044
17050
 
17045
17051
  // src/commands/cliHook/findRestrictedPathDeny.ts
17046
17052
  var RESTRICTED_PATHS = [".assist/restricted"];
17047
- function restrictedPathRegex(path104) {
17048
- const pattern2 = path104.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17053
+ function restrictedPathRegex(path105) {
17054
+ const pattern2 = path105.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17049
17055
  return new RegExp(pattern2);
17050
17056
  }
17051
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path104) => ({
17052
- path: path104,
17053
- regex: restrictedPathRegex(path104)
17057
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path105) => ({
17058
+ path: path105,
17059
+ regex: restrictedPathRegex(path105)
17054
17060
  }));
17055
17061
  function findRestrictedPathDenyRaw(rawCommand) {
17056
17062
  const rule = RESTRICTED_PATH_RULES.find(
@@ -17227,9 +17233,9 @@ var __dirname4 = dirname25(__filename3);
17227
17233
  function packageRoot() {
17228
17234
  return __dirname4;
17229
17235
  }
17230
- function readLines(path104) {
17231
- if (!existsSync40(path104)) return [];
17232
- return readFileSync25(path104, "utf8").split("\n").filter((line) => line.trim() !== "");
17236
+ function readLines(path105) {
17237
+ if (!existsSync40(path105)) return [];
17238
+ return readFileSync25(path105, "utf8").split("\n").filter((line) => line.trim() !== "");
17233
17239
  }
17234
17240
  var cachedReads;
17235
17241
  var cachedWrites;
@@ -17761,14 +17767,14 @@ function showProgress(p, label2) {
17761
17767
  const pct = Math.round(p.done / p.total * 100);
17762
17768
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
17763
17769
  }
17764
- async function resolveCommand2(cli, path104, description, depth, p) {
17765
- showProgress(p, path104.join(" "));
17766
- const subHelp = await runHelp([cli, ...path104]);
17770
+ async function resolveCommand2(cli, path105, description, depth, p) {
17771
+ showProgress(p, path105.join(" "));
17772
+ const subHelp = await runHelp([cli, ...path105]);
17767
17773
  if (!subHelp || !hasSubcommands(subHelp)) {
17768
- return [{ path: path104, description }];
17774
+ return [{ path: path105, description }];
17769
17775
  }
17770
- const children = await discoverAt(cli, path104, depth + 1, p);
17771
- return children.length > 0 ? children : [{ path: path104, description }];
17776
+ const children = await discoverAt(cli, path105, depth + 1, p);
17777
+ return children.length > 0 ? children : [{ path: path105, description }];
17772
17778
  }
17773
17779
  async function discoverAt(cli, parentPath, depth, p) {
17774
17780
  if (depth > SAFETY_DEPTH) return [];
@@ -17916,9 +17922,9 @@ function logPath(cli) {
17916
17922
  return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
17917
17923
  }
17918
17924
  function readCache(cli) {
17919
- const path104 = logPath(cli);
17920
- if (!existsSync42(path104)) return void 0;
17921
- return readFileSync27(path104, "utf8");
17925
+ const path105 = logPath(cli);
17926
+ if (!existsSync42(path105)) return void 0;
17927
+ return readFileSync27(path105, "utf8");
17922
17928
  }
17923
17929
  function writeCache(cli, output) {
17924
17930
  const dir = join43(homedir17(), ".assist");
@@ -18107,9 +18113,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18107
18113
  }
18108
18114
  const cutoff = Date.now() - STALE_AFTER_MS;
18109
18115
  for (const entry of entries) {
18110
- const path104 = join45(dir, entry);
18116
+ const path105 = join45(dir, entry);
18111
18117
  try {
18112
- if (statSync7(path104).mtimeMs < cutoff) unlinkSync7(path104);
18118
+ if (statSync7(path105).mtimeMs < cutoff) unlinkSync7(path105);
18113
18119
  } catch {
18114
18120
  continue;
18115
18121
  }
@@ -18119,10 +18125,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18119
18125
  // src/commands/codeComment/readPinState.ts
18120
18126
  import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
18121
18127
  function readPinState(pin2) {
18122
- const path104 = getPinStatePath(pin2);
18123
- if (!existsSync43(path104)) return void 0;
18128
+ const path105 = getPinStatePath(pin2);
18129
+ if (!existsSync43(path105)) return void 0;
18124
18130
  try {
18125
- const state = JSON.parse(readFileSync28(path104, "utf8"));
18131
+ const state = JSON.parse(readFileSync28(path105, "utf8"));
18126
18132
  if (state.pin !== pin2) return void 0;
18127
18133
  return state;
18128
18134
  } catch {
@@ -18543,8 +18549,8 @@ function findUnmergedPaths() {
18543
18549
  }
18544
18550
  const found = /* @__PURE__ */ new Set();
18545
18551
  for (const line of output.split("\n")) {
18546
- const path104 = line.split(" ")[1];
18547
- if (path104) found.add(path104.trim());
18552
+ const path105 = line.split(" ")[1];
18553
+ if (path105) found.add(path105.trim());
18548
18554
  }
18549
18555
  return [...found];
18550
18556
  }
@@ -19791,11 +19797,11 @@ async function loadPath(source) {
19791
19797
  }
19792
19798
  }
19793
19799
  async function criteriaExtension() {
19794
- const path104 = await loadPath(criteriaExtensionDir());
19800
+ const path105 = await loadPath(criteriaExtensionDir());
19795
19801
  console.log(
19796
19802
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
19797
19803
  );
19798
- console.log(chalk137.dim(`load the unpacked extension from ${path104}`));
19804
+ console.log(chalk137.dim(`load the unpacked extension from ${path105}`));
19799
19805
  }
19800
19806
 
19801
19807
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -19920,10 +19926,10 @@ async function signCriteriaExtension() {
19920
19926
  process.exitCode = 1;
19921
19927
  return;
19922
19928
  }
19923
- const path104 = await signedAddonInstallPath(
19929
+ const path105 = await signedAddonInstallPath(
19924
19930
  await copySignedXpi(xpi, ARTIFACTS_DIR)
19925
19931
  );
19926
- console.log(chalk139.dim(`install the signed add-on from ${path104}`));
19932
+ console.log(chalk139.dim(`install the signed add-on from ${path105}`));
19927
19933
  }
19928
19934
 
19929
19935
  // src/commands/registerCriteriaExtension.ts
@@ -20021,10 +20027,10 @@ function getMigrationApprovalPath(migrationId) {
20021
20027
  // src/commands/dbMigration/readMigrationPinState.ts
20022
20028
  import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
20023
20029
  function readMigrationPinState(pin2) {
20024
- const path104 = getMigrationPinPath(pin2);
20025
- if (!existsSync48(path104)) return void 0;
20030
+ const path105 = getMigrationPinPath(pin2);
20031
+ if (!existsSync48(path105)) return void 0;
20026
20032
  try {
20027
- const state = JSON.parse(readFileSync30(path104, "utf8"));
20033
+ const state = JSON.parse(readFileSync30(path105, "utf8"));
20028
20034
  if (state.pin !== pin2) return void 0;
20029
20035
  if (!Number.isInteger(state.migrationId)) return void 0;
20030
20036
  return state;
@@ -21934,10 +21940,10 @@ function decideCommentGuard(input, existingContent) {
21934
21940
  import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
21935
21941
  function consumeMigrationApproval(migrationId) {
21936
21942
  sweepRestrictedDir();
21937
- const path104 = getMigrationApprovalPath(migrationId);
21938
- if (!existsSync54(path104)) return false;
21943
+ const path105 = getMigrationApprovalPath(migrationId);
21944
+ if (!existsSync54(path105)) return false;
21939
21945
  try {
21940
- unlinkSync11(path104);
21946
+ unlinkSync11(path105);
21941
21947
  return true;
21942
21948
  } catch {
21943
21949
  return false;
@@ -24341,11 +24347,11 @@ function recentDaemonLogLines(includeRelayed = true) {
24341
24347
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
24342
24348
  import { realpathSync as realpathSync2 } from "fs";
24343
24349
  import { resolve as resolve15 } from "path";
24344
- function canonicalTreePath(path104) {
24350
+ function canonicalTreePath(path105) {
24345
24351
  try {
24346
- return realpathSync2(path104);
24352
+ return realpathSync2(path105);
24347
24353
  } catch {
24348
- return resolve15(path104);
24354
+ return resolve15(path105);
24349
24355
  }
24350
24356
  }
24351
24357
 
@@ -24398,22 +24404,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
24398
24404
  const registered = new Set(listWorktreePaths(clone));
24399
24405
  const branches = new Set(listLocalBranches(clone));
24400
24406
  const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
24401
- const path104 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24407
+ const path105 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24402
24408
  const start3 = worktreeStartPoint(clone, strategy.trunk);
24403
24409
  gitSync(clone, [
24404
24410
  "worktree",
24405
24411
  "add",
24406
24412
  start3.track ? "--track" : "--no-track",
24407
24413
  "-b",
24408
- basename17(path104),
24409
- path104,
24414
+ basename17(path105),
24415
+ path105,
24410
24416
  start3.ref
24411
24417
  ]);
24412
- recordWorktree(path104, clone, getCurrentOrigin(clone));
24418
+ recordWorktree(path105, clone, getCurrentOrigin(clone));
24413
24419
  daemonLog(
24414
- start3.track ? `worktree allocated ${path104} (branch ${basename17(path104)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path104} (branch ${basename17(path104)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24420
+ start3.track ? `worktree allocated ${path105} (branch ${basename17(path105)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path105} (branch ${basename17(path105)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24415
24421
  );
24416
- return path104;
24422
+ return path105;
24417
24423
  }
24418
24424
 
24419
24425
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24554,13 +24560,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24554
24560
  if (forcedSpill) daemonLog(forcedSpill);
24555
24561
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24556
24562
  return { cwd: clone, kind: "primary", created: false, clone };
24557
- const path104 = createWorktree(
24563
+ const path105 = createWorktree(
24558
24564
  clone,
24559
24565
  { root: cfg.root, trunk: cfg.trunk },
24560
24566
  boundTreeRoots2,
24561
24567
  options2.replacesTree
24562
24568
  );
24563
- return { cwd: path104, kind: "worktree", created: true, clone };
24569
+ return { cwd: path105, kind: "worktree", created: true, clone };
24564
24570
  }
24565
24571
 
24566
24572
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -24910,13 +24916,13 @@ function worktreeHoldingBranch(cwd, branch2) {
24910
24916
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
24911
24917
  if (!listing) return null;
24912
24918
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
24913
- let path104 = null;
24919
+ let path105 = null;
24914
24920
  for (const line of listing.split("\n")) {
24915
24921
  const trimmed = line.trim();
24916
24922
  if (trimmed.startsWith("worktree "))
24917
- path104 = trimmed.slice("worktree ".length).trim();
24923
+ path105 = trimmed.slice("worktree ".length).trim();
24918
24924
  else if (trimmed === `branch refs/heads/${branch2}`)
24919
- return path104 && path104 !== here ? path104 : null;
24925
+ return path105 && path105 !== here ? path105 : null;
24920
24926
  }
24921
24927
  return null;
24922
24928
  }
@@ -26020,9 +26026,9 @@ function parseRscRows(flight) {
26020
26026
  }
26021
26027
  function makeRscResolver(rows) {
26022
26028
  return (ref) => {
26023
- const [id, ...path104] = ref.slice(1).replace(/^[L@]/, "").split(":");
26029
+ const [id, ...path105] = ref.slice(1).replace(/^[L@]/, "").split(":");
26024
26030
  let v = rows[id];
26025
- for (const key of path104) {
26031
+ for (const key of path105) {
26026
26032
  if (v == null || typeof v !== "object") return void 0;
26027
26033
  v = v[key];
26028
26034
  }
@@ -26773,18 +26779,18 @@ function validateLine(line) {
26773
26779
  process.exit(1);
26774
26780
  }
26775
26781
  }
26776
- async function comment2(path104, line, body, options2 = {}) {
26782
+ async function comment2(path105, line, body, options2 = {}) {
26777
26783
  const { startLine, skipPreview } = options2;
26778
26784
  validateBody(body);
26779
26785
  validateLine(line);
26780
26786
  if (startLine !== void 0) validateLine(startLine);
26781
26787
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26782
26788
  if (!skipPreview)
26783
- await reviewProposedPrComment(`Comment on ${path104}:${range}`, body, null);
26789
+ await reviewProposedPrComment(`Comment on ${path105}:${range}`, body, null);
26784
26790
  try {
26785
26791
  const prId = getCurrentPrNodeId();
26786
- postReviewComment({ prId, body, path: path104, line, startLine });
26787
- console.log(`Added review comment on ${path104}:${range}`);
26792
+ postReviewComment({ prId, body, path: path105, line, startLine });
26793
+ console.log(`Added review comment on ${path105}:${range}`);
26788
26794
  } catch (error) {
26789
26795
  if (isGhNotInstalled(error)) {
26790
26796
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -27353,9 +27359,9 @@ function registerPrsComments(prsCommand) {
27353
27359
  });
27354
27360
  prsCommand.command("comment <path> <line> <body>").description(
27355
27361
  "Add a line comment to the pending review (body of - reads it from stdin)"
27356
- ).action(async (path104, line, body) => {
27362
+ ).action(async (path105, line, body) => {
27357
27363
  await comment2(
27358
- path104,
27364
+ path105,
27359
27365
  Number.parseInt(line, 10),
27360
27366
  await readBodyArgument(body)
27361
27367
  );
@@ -28576,11 +28582,11 @@ async function loadBody(target) {
28576
28582
  if (target.kind === "file") return readDraftFile(target.path);
28577
28583
  return fetchPrBody(target.number, target.repo);
28578
28584
  }
28579
- function readDraftFile(path104) {
28585
+ function readDraftFile(path105) {
28580
28586
  try {
28581
- return readFileSync44(path104, "utf8");
28587
+ return readFileSync44(path105, "utf8");
28582
28588
  } catch {
28583
- console.error(`Error: Could not read \`${path104}\`.`);
28589
+ console.error(`Error: Could not read \`${path105}\`.`);
28584
28590
  console.error(
28585
28591
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28586
28592
  );
@@ -28860,10 +28866,10 @@ function resolveOpSecret(reference) {
28860
28866
  }
28861
28867
 
28862
28868
  // src/commands/ravendb/ravenFetch.ts
28863
- async function ravenFetch(connection, path104) {
28869
+ async function ravenFetch(connection, path105) {
28864
28870
  const apiKey = resolveOpSecret(connection.apiKeyRef);
28865
28871
  let accessToken = await getAccessToken(apiKey);
28866
- const url = `${connection.url}${path104}`;
28872
+ const url = `${connection.url}${path105}`;
28867
28873
  const headers = {
28868
28874
  Authorization: `Bearer ${accessToken}`,
28869
28875
  "Content-Type": "application/json"
@@ -28953,16 +28959,16 @@ import chalk195 from "chalk";
28953
28959
  // src/commands/ravendb/buildQueryPath.ts
28954
28960
  function buildQueryPath(opts) {
28955
28961
  const db = encodeURIComponent(opts.db);
28956
- let path104;
28962
+ let path105;
28957
28963
  if (opts.collection) {
28958
- path104 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28964
+ path105 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28959
28965
  } else {
28960
- path104 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28966
+ path105 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28961
28967
  }
28962
28968
  if (opts.query) {
28963
- path104 += `&query=${encodeURIComponent(opts.query)}`;
28969
+ path105 += `&query=${encodeURIComponent(opts.query)}`;
28964
28970
  }
28965
- return path104;
28971
+ return path105;
28966
28972
  }
28967
28973
 
28968
28974
  // src/commands/ravendb/fetchAllPages.ts
@@ -28971,7 +28977,7 @@ async function fetchAllPages(connection, opts) {
28971
28977
  let start3 = 0;
28972
28978
  while (true) {
28973
28979
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
28974
- const path104 = buildQueryPath({
28980
+ const path105 = buildQueryPath({
28975
28981
  db: connection.database,
28976
28982
  collection: opts.collection,
28977
28983
  start: start3,
@@ -28979,7 +28985,7 @@ async function fetchAllPages(connection, opts) {
28979
28985
  sort: opts.sort,
28980
28986
  query: opts.query
28981
28987
  });
28982
- const data = await ravenFetch(connection, path104);
28988
+ const data = await ravenFetch(connection, path105);
28983
28989
  const results = data.Results ?? [];
28984
28990
  const totalResults = data.TotalResults ?? 0;
28985
28991
  if (results.length === 0) break;
@@ -31493,8 +31499,8 @@ Renamed ${oldName} \u2192 ${newName}`));
31493
31499
 
31494
31500
  // src/commands/refactor/restructure.ts
31495
31501
  import fs38 from "fs";
31496
- import path78 from "path";
31497
- import chalk220 from "chalk";
31502
+ import path79 from "path";
31503
+ import chalk221 from "chalk";
31498
31504
 
31499
31505
  // src/commands/refactor/restructure/applyPlan.ts
31500
31506
  import chalk216 from "chalk";
@@ -31873,31 +31879,70 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
31873
31879
  }
31874
31880
 
31875
31881
  // src/commands/refactor/restructure/checkPlan.ts
31876
- import chalk218 from "chalk";
31882
+ import chalk219 from "chalk";
31883
+
31884
+ // src/commands/refactor/restructure/displayDeepChains.ts
31885
+ import chalk217 from "chalk";
31886
+ var shownChains = 10;
31887
+ var pinGuidance = [
31888
+ "To bring the plan within the limit, add modules to restructure.pin in assist.yml (basename without extension). A pinned module moves up beside the nearest root or pinned module above it, taking its subtree with it.",
31889
+ "- On each chain, pin the highest module that is a feature boundary: a route, view, page, panel, dialog or card a user would recognise as one thing.",
31890
+ "- Never pin hooks, utilities, style files or helpers just because they head a big subtree; they move up with their feature.",
31891
+ "- Add one pin at a time and re-run the dry-run: one feature pin often fixes several chains.",
31892
+ "- After each pin, check the resulting tree for a folder that has grown large with files shared between pinned features; if one has, pin the feature those files belong to or undo the last pin.",
31893
+ "- If no module on a chain is a sensible feature boundary, leave it and report the chain instead of forcing a pin."
31894
+ ];
31895
+ function formatChain(chain2) {
31896
+ const folders = chain2.folders.map((f) => `${f.name} (${f.files})`).join(" > ");
31897
+ return ` ${folders} > \u2026 [${chain2.tooDeep} file(s) too deep, down to depth ${chain2.deepest}]`;
31898
+ }
31899
+ function displayDeepChains(chains, maxDepth) {
31900
+ if (chains.length === 0) return;
31901
+ const tooDeep = chains.reduce((sum3, c) => sum3 + c.tooDeep, 0);
31902
+ console.log(
31903
+ chalk217.red(
31904
+ `
31905
+ Plan exceeds restructure.maxDepth ${maxDepth}: ${tooDeep} file(s) deeper.`
31906
+ )
31907
+ );
31908
+ console.log(
31909
+ chalk217.bold(
31910
+ "Deep chains, as folder (files beneath), most files too deep first:"
31911
+ )
31912
+ );
31913
+ for (const chain2 of chains.slice(0, shownChains))
31914
+ console.log(formatChain(chain2));
31915
+ if (chains.length > shownChains)
31916
+ console.log(chalk217.dim(` \u2026and ${chains.length - shownChains} more`));
31917
+ console.log("");
31918
+ for (const line of pinGuidance) console.log(chalk217.yellow(line));
31919
+ }
31877
31920
 
31878
31921
  // src/commands/refactor/restructure/displayDrift.ts
31879
31922
  import path73 from "path";
31880
- import chalk217 from "chalk";
31923
+ import chalk218 from "chalk";
31881
31924
  function displayDrift(plan2) {
31882
31925
  const rel = (file) => path73.relative(process.cwd(), file);
31883
31926
  if (plan2.moves.length > 0) {
31884
- console.log(chalk217.red(`${plan2.moves.length} file(s) drift from the plan:`));
31927
+ console.log(chalk218.red(`${plan2.moves.length} file(s) drift from the plan:`));
31885
31928
  for (const move2 of plan2.moves)
31886
31929
  console.log(` ${rel(move2.from)} \u2192 ${rel(move2.to)}`);
31887
31930
  }
31888
- for (const error of plan2.errors) console.log(chalk217.red(error));
31931
+ for (const error of plan2.errors) console.log(chalk218.red(error));
31889
31932
  }
31890
31933
 
31891
31934
  // src/commands/refactor/restructure/checkPlan.ts
31892
- function checkPlan(plan2) {
31935
+ function checkPlan(plan2, chains, maxDepth) {
31893
31936
  displayDrift(plan2);
31894
- if (plan2.moves.length > 0 || plan2.errors.length > 0) process.exit(1);
31895
- console.log(chalk218.green("Layout matches the restructure plan"));
31937
+ displayDeepChains(chains, maxDepth);
31938
+ if (plan2.moves.length > 0 || plan2.errors.length > 0 || chains.length > 0)
31939
+ process.exit(1);
31940
+ console.log(chalk219.green("Layout matches the restructure plan"));
31896
31941
  }
31897
31942
 
31898
31943
  // src/commands/refactor/restructure/displayPlan.ts
31899
31944
  import path76 from "path";
31900
- import chalk219 from "chalk";
31945
+ import chalk220 from "chalk";
31901
31946
 
31902
31947
  // src/commands/refactor/restructure/computeDepthStats.ts
31903
31948
  import path74 from "path";
@@ -31948,17 +31993,17 @@ function relPath2(filePath) {
31948
31993
  }
31949
31994
  function displayMoves(plan2) {
31950
31995
  if (plan2.moves.length === 0) return;
31951
- console.log(chalk219.bold("\nFile moves:"));
31996
+ console.log(chalk220.bold("\nFile moves:"));
31952
31997
  for (const move2 of plan2.moves) {
31953
31998
  console.log(
31954
- ` ${chalk219.red(relPath2(move2.from))} \u2192 ${chalk219.green(relPath2(move2.to))}`
31999
+ ` ${chalk220.red(relPath2(move2.from))} \u2192 ${chalk220.green(relPath2(move2.to))}`
31955
32000
  );
31956
- console.log(chalk219.dim(` ${move2.reason}`));
32001
+ console.log(chalk220.dim(` ${move2.reason}`));
31957
32002
  }
31958
32003
  }
31959
32004
  function displayTree(plan2) {
31960
32005
  console.log(
31961
- chalk219.bold(`
32006
+ chalk220.bold(`
31962
32007
  Resulting tree (${relPath2(plan2.scopeRoot) || "."}/):`)
31963
32008
  );
31964
32009
  for (const line of formatTree(plan2.targets.values(), plan2.scopeRoot))
@@ -31969,15 +32014,15 @@ function displayDepthStats(plan2) {
31969
32014
  plan2.targets.values(),
31970
32015
  plan2.scopeRoot
31971
32016
  );
31972
- console.log(chalk219.bold(`
32017
+ console.log(chalk220.bold(`
31973
32018
  Depth (max ${max}):`));
31974
32019
  for (const depth of [...distribution.keys()].sort((a, b) => a - b))
31975
32020
  console.log(` ${depth}: ${distribution.get(depth)} file(s)`);
31976
32021
  }
31977
32022
  function displayErrors(errors) {
31978
32023
  if (errors.length === 0) return;
31979
- console.log(chalk219.red("\nErrors:"));
31980
- for (const error of errors) console.log(chalk219.red(` ${error}`));
32024
+ console.log(chalk220.red("\nErrors:"));
32025
+ for (const error of errors) console.log(chalk220.red(` ${error}`));
31981
32026
  }
31982
32027
  function displayPlan2(plan2) {
31983
32028
  displayMoves(plan2);
@@ -31986,19 +32031,57 @@ function displayPlan2(plan2) {
31986
32031
  displayErrors(plan2.errors);
31987
32032
  const rewrittenFiles = new Set(plan2.rewrites.map((r) => r.file)).size;
31988
32033
  console.log(
31989
- chalk219.dim(
32034
+ chalk220.dim(
31990
32035
  `
31991
32036
  Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports rewritten across ${rewrittenFiles} file(s), ${plan2.errors.length} error(s)`
31992
32037
  )
31993
32038
  );
31994
32039
  }
31995
32040
 
31996
- // src/commands/refactor/restructure/partitionIgnored.ts
32041
+ // src/commands/refactor/restructure/findDeepChains.ts
31997
32042
  import path77 from "path";
32043
+ function dirSegments(target, scopeRoot) {
32044
+ const dir = path77.relative(scopeRoot, path77.dirname(target));
32045
+ return dir === "" ? [] : dir.split(path77.sep);
32046
+ }
32047
+ function countSubtrees(segmentLists) {
32048
+ const counts2 = /* @__PURE__ */ new Map();
32049
+ for (const segments of segmentLists)
32050
+ for (let i = 1; i <= segments.length; i++) {
32051
+ const key = segments.slice(0, i).join("/");
32052
+ counts2.set(key, (counts2.get(key) ?? 0) + 1);
32053
+ }
32054
+ return counts2;
32055
+ }
32056
+ function findDeepChains(targets, scopeRoot, maxDepth) {
32057
+ const segmentLists = [...targets].map((t) => dirSegments(t, scopeRoot));
32058
+ const subtreeFiles = countSubtrees(segmentLists);
32059
+ const chains = /* @__PURE__ */ new Map();
32060
+ for (const segments of segmentLists) {
32061
+ if (segments.length <= maxDepth) continue;
32062
+ const head = segments.slice(0, maxDepth + 1);
32063
+ const key = head.join("/");
32064
+ const chain2 = chains.get(key) ?? {
32065
+ folders: head.map((name, i) => ({
32066
+ name,
32067
+ files: subtreeFiles.get(head.slice(0, i + 1).join("/")) ?? 0
32068
+ })),
32069
+ tooDeep: 0,
32070
+ deepest: 0
32071
+ };
32072
+ chain2.tooDeep += 1;
32073
+ chain2.deepest = Math.max(chain2.deepest, segments.length);
32074
+ chains.set(key, chain2);
32075
+ }
32076
+ return [...chains.entries()].sort(([ka, a], [kb, b]) => b.tooDeep - a.tooDeep || ka.localeCompare(kb)).map(([, chain2]) => chain2);
32077
+ }
32078
+
32079
+ // src/commands/refactor/restructure/partitionIgnored.ts
32080
+ import path78 from "path";
31998
32081
  import { minimatch as minimatch4 } from "minimatch";
31999
32082
  function partitionIgnored(files) {
32000
32083
  const globs = loadConfig().restructure?.ignore ?? [];
32001
- const isIgnored = (file) => globs.some((glob) => minimatch4(path77.relative(process.cwd(), file), glob));
32084
+ const isIgnored = (file) => globs.some((glob) => minimatch4(path78.relative(process.cwd(), file), glob));
32002
32085
  return {
32003
32086
  scoped: files.filter((f) => !isIgnored(f)),
32004
32087
  ignored: files.filter(isIgnored)
@@ -32007,28 +32090,30 @@ function partitionIgnored(files) {
32007
32090
 
32008
32091
  // src/commands/refactor/restructure.ts
32009
32092
  async function restructure(root2, options2 = {}) {
32010
- const scopeRoot = path78.resolve(root2 ?? "src");
32093
+ const scopeRoot = path79.resolve(root2 ?? "src");
32011
32094
  if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
32012
- console.log(chalk220.red(`Not a directory: ${root2 ?? "src"}`));
32095
+ console.log(chalk221.red(`Not a directory: ${root2 ?? "src"}`));
32013
32096
  process.exit(1);
32014
32097
  }
32015
32098
  const found = [];
32016
32099
  walkSourceFiles(scopeRoot, found);
32017
32100
  const { scoped, ignored } = partitionIgnored(found);
32018
32101
  if (scoped.length === 0) {
32019
- console.log(chalk220.yellow("No files found under root"));
32102
+ console.log(chalk221.yellow("No files found under root"));
32020
32103
  return;
32021
32104
  }
32022
- const pinned = loadConfig().restructure?.pin ?? [];
32023
- const plan2 = buildPlan3(scopeRoot, scoped, ignored, pinned);
32024
- if (options2.check) return checkPlan(plan2);
32105
+ const { pin: pin2 = [], maxDepth = 10 } = loadConfig().restructure ?? {};
32106
+ const plan2 = buildPlan3(scopeRoot, scoped, ignored, pin2);
32107
+ const chains = findDeepChains(plan2.targets.values(), scopeRoot, maxDepth);
32108
+ if (options2.check) return checkPlan(plan2, chains, maxDepth);
32025
32109
  displayPlan2(plan2);
32110
+ displayDeepChains(chains, maxDepth);
32026
32111
  if (plan2.moves.length === 0 && plan2.errors.length === 0) {
32027
- console.log(chalk220.green("No restructuring needed"));
32112
+ console.log(chalk221.green("No restructuring needed"));
32028
32113
  return;
32029
32114
  }
32030
32115
  if (!options2.apply) {
32031
- console.log(chalk220.dim("\nDry run. Use --apply to execute."));
32116
+ console.log(chalk221.dim("\nDry run. Use --apply to execute."));
32032
32117
  return;
32033
32118
  }
32034
32119
  applyPlan(plan2);
@@ -32086,7 +32171,7 @@ async function checkoutOnlySession(number) {
32086
32171
  }
32087
32172
 
32088
32173
  // src/commands/review/highLevel/configureHighLevelReview.ts
32089
- import chalk224 from "chalk";
32174
+ import chalk225 from "chalk";
32090
32175
 
32091
32176
  // src/commands/config/promptConfigScope.ts
32092
32177
  import Enquirer3 from "enquirer";
@@ -32112,7 +32197,7 @@ async function promptConfigScope() {
32112
32197
  }
32113
32198
 
32114
32199
  // src/commands/config/resolveConfigKeyAnswer.ts
32115
- import chalk221 from "chalk";
32200
+ import chalk222 from "chalk";
32116
32201
  async function resolveConfigKeyAnswer(question, supplied) {
32117
32202
  if (supplied !== void 0) return coerceSupplied(question.key, supplied);
32118
32203
  for (; ; ) {
@@ -32120,7 +32205,7 @@ async function resolveConfigKeyAnswer(question, supplied) {
32120
32205
  if (answer === "") return void 0;
32121
32206
  const coercion = coerceCliConfigValue(question.key, answer);
32122
32207
  if (coercion.ok) return coercion.value;
32123
- console.error(chalk221.red(coercion.error));
32208
+ console.error(chalk222.red(coercion.error));
32124
32209
  }
32125
32210
  }
32126
32211
  function coerceSupplied(key, supplied) {
@@ -32181,7 +32266,7 @@ function suggestGlobs(current, proposed) {
32181
32266
  }
32182
32267
 
32183
32268
  // src/commands/review/highLevel/parseConfigureAnswers.ts
32184
- import chalk222 from "chalk";
32269
+ import chalk223 from "chalk";
32185
32270
  function parseConfigureAnswers(answers) {
32186
32271
  const known = Object.values(highLevelConfigKeys);
32187
32272
  const parsed = {};
@@ -32199,13 +32284,13 @@ function answersCoverEveryKey(answers) {
32199
32284
  return Object.values(highLevelConfigKeys).every((key) => key in answers);
32200
32285
  }
32201
32286
  function exitWith(message3) {
32202
- console.error(chalk222.red(`Error: ${message3}.`));
32287
+ console.error(chalk223.red(`Error: ${message3}.`));
32203
32288
  process.exit(1);
32204
32289
  }
32205
32290
 
32206
32291
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
32207
32292
  import { execFileSync as execFileSync20 } from "child_process";
32208
- import chalk223 from "chalk";
32293
+ import chalk224 from "chalk";
32209
32294
 
32210
32295
  // src/commands/review/highLevel/buildGlobProposalPrompt.ts
32211
32296
  function buildGlobProposalPrompt(tree) {
@@ -32298,12 +32383,12 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
32298
32383
  const tree = summariseRepoTree(cwd);
32299
32384
  if (tree === "") return NOTHING_PROPOSED;
32300
32385
  console.log(
32301
- chalk223.dim("Asking Claude to propose globs from the repo's own tree...")
32386
+ chalk224.dim("Asking Claude to propose globs from the repo's own tree...")
32302
32387
  );
32303
32388
  const output = askClaude(buildGlobProposalPrompt(tree), cwd);
32304
32389
  if (output === void 0) {
32305
32390
  console.log(
32306
- chalk223.yellow(
32391
+ chalk224.yellow(
32307
32392
  "Claude proposed nothing; answer each key from its current value."
32308
32393
  )
32309
32394
  );
@@ -32359,25 +32444,25 @@ function asConfigKeyScope(value) {
32359
32444
  function reportConfigured(result) {
32360
32445
  for (const write of result.written)
32361
32446
  console.log(
32362
- chalk224.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32447
+ chalk225.green(`Set ${write.key} = ${JSON.stringify(write.value)}`)
32363
32448
  );
32364
- for (const key of result.skipped) console.log(chalk224.dim(`Left ${key} unset`));
32365
- console.log(chalk224.dim(`Written to ${result.target}`));
32449
+ for (const key of result.skipped) console.log(chalk225.dim(`Left ${key} unset`));
32450
+ console.log(chalk225.dim(`Written to ${result.target}`));
32366
32451
  }
32367
32452
 
32368
32453
  // src/commands/review/highLevel/announceSavedReview.ts
32369
- import chalk225 from "chalk";
32454
+ import chalk226 from "chalk";
32370
32455
  function announceSavedReview(subject, force) {
32371
32456
  const head = subject.headSha.slice(0, 7);
32372
32457
  if (subject.saved)
32373
32458
  console.log(
32374
- chalk225.dim(
32459
+ chalk226.dim(
32375
32460
  `Reopening the review saved for ${head} at ${subject.saved.reviewedAt} (${subject.saved.verdict}); pass --force to start fresh.`
32376
32461
  )
32377
32462
  );
32378
32463
  else if (force)
32379
32464
  console.log(
32380
- chalk225.dim(
32465
+ chalk226.dim(
32381
32466
  `Discarding any review saved for ${head} and starting fresh (--force).`
32382
32467
  )
32383
32468
  );
@@ -32406,8 +32491,8 @@ function groupFilesByDirectory(files) {
32406
32491
  }
32407
32492
 
32408
32493
  // src/commands/review/highLevel/buildHighLevelTree.ts
32409
- function basename19(path104) {
32410
- return path104.slice(path104.lastIndexOf("/") + 1);
32494
+ function basename19(path105) {
32495
+ return path105.slice(path105.lastIndexOf("/") + 1);
32411
32496
  }
32412
32497
  function sum(nodes, key) {
32413
32498
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32430,19 +32515,19 @@ function nodesOf(at2, prefix2) {
32430
32515
  }
32431
32516
  function collapsedDirNode(name, at2, prefix2) {
32432
32517
  let label2 = name;
32433
- let path104 = prefix2 ? `${prefix2}/${name}` : name;
32518
+ let path105 = prefix2 ? `${prefix2}/${name}` : name;
32434
32519
  let node = at2;
32435
32520
  while (node.files.length === 0 && node.dirs.size === 1) {
32436
32521
  const [childName, child] = [...node.dirs][0];
32437
32522
  label2 = `${label2}/${childName}`;
32438
- path104 = `${path104}/${childName}`;
32523
+ path105 = `${path105}/${childName}`;
32439
32524
  node = child;
32440
32525
  }
32441
- const children = nodesOf(node, path104);
32526
+ const children = nodesOf(node, path105);
32442
32527
  return {
32443
32528
  kind: "dir",
32444
32529
  name: label2,
32445
- path: path104,
32530
+ path: path105,
32446
32531
  additions: sum(children, "additions"),
32447
32532
  deletions: sum(children, "deletions"),
32448
32533
  children
@@ -32700,8 +32785,8 @@ function toStatus(status3) {
32700
32785
  if (status3 === "removed") return "removed";
32701
32786
  return "modified";
32702
32787
  }
32703
- function diffUrl(repo, prNumber, path104) {
32704
- const anchor = createHash3("sha256").update(path104).digest("hex");
32788
+ function diffUrl(repo, prNumber, path105) {
32789
+ const anchor = createHash3("sha256").update(path105).digest("hex");
32705
32790
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32706
32791
  }
32707
32792
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32757,10 +32842,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32757
32842
 
32758
32843
  // src/commands/review/highLevel/loadHighLevelReview.ts
32759
32844
  function loadHighLevelReview(repo, headRef, headSha) {
32760
- const path104 = highLevelReviewPath(repo, headRef, headSha);
32761
- if (!existsSync64(path104)) return void 0;
32845
+ const path105 = highLevelReviewPath(repo, headRef, headSha);
32846
+ if (!existsSync64(path105)) return void 0;
32762
32847
  try {
32763
- return JSON.parse(readFileSync47(path104, "utf8"));
32848
+ return JSON.parse(readFileSync47(path105, "utf8"));
32764
32849
  } catch {
32765
32850
  return void 0;
32766
32851
  }
@@ -32771,8 +32856,8 @@ import { minimatch as minimatch7 } from "minimatch";
32771
32856
  function selectCriticalDiffs(files, criticalPaths) {
32772
32857
  if (criticalPaths.length === 0) return [];
32773
32858
  return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
32774
- ({ path: path104, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32775
- path: path104,
32859
+ ({ path: path105, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32860
+ path: path105,
32776
32861
  status: status3,
32777
32862
  additions,
32778
32863
  deletions,
@@ -32887,11 +32972,11 @@ function highLevelPreviewPayload(subject) {
32887
32972
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
32888
32973
  import { dirname as dirname36 } from "path";
32889
32974
  function saveHighLevelReview(record) {
32890
- const path104 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32891
- mkdirSync22(dirname36(path104), { recursive: true });
32892
- writeFileSync39(path104, `${JSON.stringify(record, null, 2)}
32975
+ const path105 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32976
+ mkdirSync22(dirname36(path105), { recursive: true });
32977
+ writeFileSync39(path105, `${JSON.stringify(record, null, 2)}
32893
32978
  `);
32894
- return path104;
32979
+ return path105;
32895
32980
  }
32896
32981
 
32897
32982
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -32910,63 +32995,63 @@ async function openHighLevelOverlay(sessionId, subject) {
32910
32995
  { rejectIsOutcome: true }
32911
32996
  );
32912
32997
  const record = buildHighLevelRecord(subject, decision);
32913
- const path104 = saveHighLevelReview(record);
32998
+ const path105 = saveHighLevelReview(record);
32914
32999
  console.log(`Verdict: ${record.verdict}`);
32915
- console.log(`Saved ${path104}`);
33000
+ console.log(`Saved ${path105}`);
32916
33001
  console.log("Nothing was posted to GitHub.");
32917
33002
  return record;
32918
33003
  }
32919
33004
 
32920
33005
  // src/commands/review/highLevel/printHighLevelChecklist.ts
32921
- import chalk229 from "chalk";
33006
+ import chalk230 from "chalk";
32922
33007
 
32923
33008
  // src/commands/review/highLevel/formatCriticalDiffs.ts
32924
- import chalk226 from "chalk";
33009
+ import chalk227 from "chalk";
32925
33010
  var PATCH_LINE_COLOURS = {
32926
- "+": chalk226.green,
32927
- "-": chalk226.red,
32928
- "@": chalk226.cyan
33011
+ "+": chalk227.green,
33012
+ "-": chalk227.red,
33013
+ "@": chalk227.cyan
32929
33014
  };
32930
33015
  function formatPatch(patch2) {
32931
33016
  return patch2.split("\n").map(
32932
- (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk226.dim)(line)}`
33017
+ (line) => ` ${(PATCH_LINE_COLOURS[line[0] ?? ""] ?? chalk227.dim)(line)}`
32933
33018
  );
32934
33019
  }
32935
33020
  function formatDiff(diff3) {
32936
33021
  return [
32937
33022
  "",
32938
- ` ${chalk226.bold(diff3.path)} ${chalk226.dim(`(${diff3.status})`)} ${chalk226.green(`+${diff3.additions}`)} ${chalk226.red(`-${diff3.deletions}`)}`,
32939
- ...diff3.patch === null ? [` ${chalk226.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
33023
+ ` ${chalk227.bold(diff3.path)} ${chalk227.dim(`(${diff3.status})`)} ${chalk227.green(`+${diff3.additions}`)} ${chalk227.red(`-${diff3.deletions}`)}`,
33024
+ ...diff3.patch === null ? [` ${chalk227.dim(`no diff available; see ${diff3.diffUrl}`)}`] : formatPatch(diff3.patch)
32940
33025
  ];
32941
33026
  }
32942
33027
  function formatCriticalDiffs(diffs, criticalPaths) {
32943
33028
  if (criticalPaths.length === 0)
32944
- return `${chalk226.bold.underline("Critical diffs")}
32945
- ${chalk226.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
33029
+ return `${chalk227.bold.underline("Critical diffs")}
33030
+ ${chalk227.dim("review.highLevel.criticalPaths is unset, so no diffs are shown")}`;
32946
33031
  if (diffs.length === 0)
32947
- return `${chalk226.bold.underline("Critical diffs")}
32948
- ${chalk226.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
33032
+ return `${chalk227.bold.underline("Critical diffs")}
33033
+ ${chalk227.dim(`no changed file matches ${criticalPaths.join(", ")}`)}`;
32949
33034
  return [
32950
- chalk226.bold.underline("Critical diffs"),
33035
+ chalk227.bold.underline("Critical diffs"),
32951
33036
  ...diffs.flatMap(formatDiff)
32952
33037
  ].join("\n");
32953
33038
  }
32954
33039
 
32955
33040
  // src/commands/review/highLevel/formatHighLevelChecklist.ts
32956
- import chalk227 from "chalk";
33041
+ import chalk228 from "chalk";
32957
33042
  var MARKERS = {
32958
- pass: () => chalk227.green("\u2714"),
32959
- fail: () => chalk227.red("\u2718"),
32960
- manual: () => chalk227.yellow("\u25A1")
33043
+ pass: () => chalk228.green("\u2714"),
33044
+ fail: () => chalk228.red("\u2718"),
33045
+ manual: () => chalk228.yellow("\u25A1")
32961
33046
  };
32962
33047
  function formatCheck(check2) {
32963
- const title = check2.status === "fail" ? chalk227.red(check2.title) : chalk227.bold(check2.title);
33048
+ const title = check2.status === "fail" ? chalk228.red(check2.title) : chalk228.bold(check2.title);
32964
33049
  return ` ${MARKERS[check2.status]()} ${title}
32965
- ${chalk227.dim(check2.reason)}`;
33050
+ ${chalk228.dim(check2.reason)}`;
32966
33051
  }
32967
33052
  function formatGroup(heading2, checks2) {
32968
33053
  if (checks2.length === 0) return [];
32969
- return ["", chalk227.bold.underline(heading2), ...checks2.map(formatCheck)];
33054
+ return ["", chalk228.bold.underline(heading2), ...checks2.map(formatCheck)];
32970
33055
  }
32971
33056
  function formatHighLevelChecklist(checks2) {
32972
33057
  const deterministic = checks2.filter(
@@ -32975,7 +33060,7 @@ function formatHighLevelChecklist(checks2) {
32975
33060
  const failed3 = deterministic.filter(
32976
33061
  (check2) => check2.status === "fail"
32977
33062
  ).length;
32978
- const summary = failed3 === 0 ? chalk227.green(`All ${deterministic.length} deterministic checks pass`) : chalk227.red(
33063
+ const summary = failed3 === 0 ? chalk228.green(`All ${deterministic.length} deterministic checks pass`) : chalk228.red(
32979
33064
  `${failed3} of ${deterministic.length} deterministic checks fail`
32980
33065
  );
32981
33066
  return [
@@ -32990,30 +33075,30 @@ function formatHighLevelChecklist(checks2) {
32990
33075
  }
32991
33076
 
32992
33077
  // src/commands/review/highLevel/formatHighLevelStructure.ts
32993
- import chalk228 from "chalk";
33078
+ import chalk229 from "chalk";
32994
33079
  var STATUS_MARKERS = {
32995
- added: () => chalk228.green("A"),
32996
- removed: () => chalk228.red("D"),
32997
- modified: () => chalk228.yellow("M")
33080
+ added: () => chalk229.green("A"),
33081
+ removed: () => chalk229.red("D"),
33082
+ modified: () => chalk229.yellow("M")
32998
33083
  };
32999
33084
  function counts(additions, deletions) {
33000
- return `${chalk228.green(`+${additions}`)} ${chalk228.red(`-${deletions}`)}`;
33085
+ return `${chalk229.green(`+${additions}`)} ${chalk229.red(`-${deletions}`)}`;
33001
33086
  }
33002
33087
  function formatNode(node, indent3) {
33003
33088
  if (node.kind === "file")
33004
33089
  return [
33005
- `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk228.dim(counts(node.additions, node.deletions))}`
33090
+ `${indent3}${STATUS_MARKERS[node.status]()} ${node.name} ${chalk229.dim(counts(node.additions, node.deletions))}`
33006
33091
  ];
33007
33092
  const dir = node;
33008
33093
  return [
33009
- `${indent3}${chalk228.bold(`${dir.name}/`)} ${chalk228.dim(counts(dir.additions, dir.deletions))}`,
33094
+ `${indent3}${chalk229.bold(`${dir.name}/`)} ${chalk229.dim(counts(dir.additions, dir.deletions))}`,
33010
33095
  ...dir.children.flatMap((child) => formatNode(child, `${indent3} `))
33011
33096
  ];
33012
33097
  }
33013
33098
  function formatHighLevelStructure(structure) {
33014
33099
  const summary = `${structure.added} added \xB7 ${structure.removed} deleted \xB7 ${structure.modified} modified \xB7 ${counts(structure.additions, structure.deletions)}`;
33015
33100
  return [
33016
- chalk228.bold.underline("Structure"),
33101
+ chalk229.bold.underline("Structure"),
33017
33102
  ` ${summary}`,
33018
33103
  ...structure.tree.flatMap((node) => formatNode(node, " "))
33019
33104
  ].join("\n");
@@ -33022,10 +33107,10 @@ function formatHighLevelStructure(structure) {
33022
33107
  // src/commands/review/highLevel/printHighLevelChecklist.ts
33023
33108
  function printHighLevelChecklist(subject) {
33024
33109
  console.log(
33025
- chalk229.bold(
33110
+ chalk230.bold(
33026
33111
  `High-level review of ${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`
33027
33112
  ),
33028
- chalk229.dim(
33113
+ chalk230.dim(
33029
33114
  `\xB7 ${highLevelChangedFileCount(subject.structure)} changed files`
33030
33115
  )
33031
33116
  );
@@ -33037,12 +33122,12 @@ function printHighLevelChecklist(subject) {
33037
33122
  formatCriticalDiffs(subject.criticalDiffs, subject.criticalPaths)
33038
33123
  );
33039
33124
  console.log(
33040
- chalk229.dim(
33125
+ chalk230.dim(
33041
33126
  "\nManual items are for the reviewer to judge; see docs/high-level-review.md."
33042
33127
  )
33043
33128
  );
33044
33129
  console.log(
33045
- chalk229.dim(
33130
+ chalk230.dim(
33046
33131
  "Run this inside an assist session to step through the checklist in the web overlay."
33047
33132
  )
33048
33133
  );
@@ -33676,18 +33761,18 @@ function partitionFindingsByDiff(findings, index3) {
33676
33761
  }
33677
33762
 
33678
33763
  // src/commands/review/warnOutOfDiff.ts
33679
- import chalk230 from "chalk";
33764
+ import chalk231 from "chalk";
33680
33765
  function warnOutOfDiff(outOfDiff) {
33681
33766
  if (outOfDiff.length === 0) return;
33682
33767
  console.warn(
33683
- chalk230.yellow(
33768
+ chalk231.yellow(
33684
33769
  `Moved ${outOfDiff.length} finding(s) whose lines fall outside the PR diff into the review body (GitHub cannot anchor a comment on these):`
33685
33770
  )
33686
33771
  );
33687
33772
  for (const finding of outOfDiff) {
33688
33773
  const range = finding.startLine !== void 0 ? `${finding.startLine}-${finding.line}` : `${finding.line}`;
33689
33774
  console.warn(
33690
- ` ${chalk230.yellow("\xB7")} ${finding.title} ${chalk230.dim(
33775
+ ` ${chalk231.yellow("\xB7")} ${finding.title} ${chalk231.dim(
33691
33776
  `(${finding.file}:${range})`
33692
33777
  )}`
33693
33778
  );
@@ -33711,18 +33796,18 @@ function selectInDiffFindings(lineBound, prDiff) {
33711
33796
  }
33712
33797
 
33713
33798
  // src/commands/review/warnUnlocated.ts
33714
- import chalk231 from "chalk";
33799
+ import chalk232 from "chalk";
33715
33800
  function warnUnlocated(unlocated) {
33716
33801
  if (unlocated.length === 0) return;
33717
33802
  console.warn(
33718
- chalk231.yellow(
33803
+ chalk232.yellow(
33719
33804
  `Moved ${unlocated.length} finding(s) without a parseable file:line into the review body:`
33720
33805
  )
33721
33806
  );
33722
33807
  for (const finding of unlocated) {
33723
- const where = finding.location || chalk231.dim("missing");
33808
+ const where = finding.location || chalk232.dim("missing");
33724
33809
  console.warn(
33725
- ` ${chalk231.yellow("\xB7")} ${finding.title} ${chalk231.dim(`(${where})`)}`
33810
+ ` ${chalk232.yellow("\xB7")} ${finding.title} ${chalk232.dim(`(${where})`)}`
33726
33811
  );
33727
33812
  }
33728
33813
  }
@@ -33927,8 +34012,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
33927
34012
  // src/commands/review/prepareReviewDir.ts
33928
34013
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
33929
34014
  function clearReviewFiles(paths) {
33930
- for (const path104 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33931
- if (existsSync65(path104)) unlinkSync18(path104);
34015
+ for (const path105 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
34016
+ if (existsSync65(path105)) unlinkSync18(path105);
33932
34017
  }
33933
34018
  }
33934
34019
  function prepareReviewDir(paths, requestBody, force) {
@@ -35166,8 +35251,8 @@ function registerReview(program2) {
35166
35251
 
35167
35252
  // src/commands/rules/addRule.ts
35168
35253
  import { existsSync as existsSync70, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
35169
- import path83 from "path";
35170
- import chalk232 from "chalk";
35254
+ import path84 from "path";
35255
+ import chalk233 from "chalk";
35171
35256
 
35172
35257
  // src/commands/rules/insertRuleBullet.ts
35173
35258
  function ruleBullet({ code, title, text: text18 }) {
@@ -35194,7 +35279,7 @@ import { readFileSync as readFileSync50 } from "fs";
35194
35279
 
35195
35280
  // src/commands/rules/findClaudeFiles.ts
35196
35281
  import { readdirSync as readdirSync13 } from "fs";
35197
- import path79 from "path";
35282
+ import path80 from "path";
35198
35283
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
35199
35284
  function findClaudeFiles(dir) {
35200
35285
  const results = [];
@@ -35202,9 +35287,9 @@ function findClaudeFiles(dir) {
35202
35287
  if (entry.isDirectory()) {
35203
35288
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
35204
35289
  continue;
35205
- results.push(...findClaudeFiles(path79.join(dir, entry.name)));
35290
+ results.push(...findClaudeFiles(path80.join(dir, entry.name)));
35206
35291
  } else if (entry.name === "CLAUDE.md") {
35207
- results.push(path79.join(dir, entry.name));
35292
+ results.push(path80.join(dir, entry.name));
35208
35293
  }
35209
35294
  }
35210
35295
  return results;
@@ -35223,34 +35308,34 @@ function nextRuleCode(root2) {
35223
35308
 
35224
35309
  // src/commands/rules/resolveRuleScope.ts
35225
35310
  import { existsSync as existsSync68 } from "fs";
35226
- import path80 from "path";
35311
+ import path81 from "path";
35227
35312
  function resolveRuleScope(target) {
35228
- const resolved = path80.resolve(target);
35229
- if (path80.basename(resolved) === "CLAUDE.md") return resolved;
35313
+ const resolved = path81.resolve(target);
35314
+ if (path81.basename(resolved) === "CLAUDE.md") return resolved;
35230
35315
  const startDir = scopeDirectory(resolved);
35231
35316
  const root2 = findRepoRoot(startDir) ?? startDir;
35232
35317
  let current = startDir;
35233
35318
  while (true) {
35234
- const candidate = path80.join(current, "CLAUDE.md");
35319
+ const candidate = path81.join(current, "CLAUDE.md");
35235
35320
  if (existsSync68(candidate)) return candidate;
35236
- if (current === root2 || current === path80.dirname(current)) break;
35237
- current = path80.dirname(current);
35321
+ if (current === root2 || current === path81.dirname(current)) break;
35322
+ current = path81.dirname(current);
35238
35323
  }
35239
- return path80.join(root2, "CLAUDE.md");
35324
+ return path81.join(root2, "CLAUDE.md");
35240
35325
  }
35241
35326
 
35242
35327
  // src/commands/rules/updateScopedRulesIndex.ts
35243
35328
  import { existsSync as existsSync69, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
35244
- import path82 from "path";
35329
+ import path83 from "path";
35245
35330
 
35246
35331
  // src/commands/rules/scopedRuleDirectories.ts
35247
35332
  import { readFileSync as readFileSync51 } from "fs";
35248
- import path81 from "path";
35333
+ import path82 from "path";
35249
35334
  function scopedRuleDirectories(root2) {
35250
35335
  return findClaudeFiles(root2).filter(
35251
- (file) => path81.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35336
+ (file) => path82.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
35252
35337
  ).map(
35253
- (file) => `${path81.relative(root2, path81.dirname(file)).split(path81.sep).join("/")}/`
35338
+ (file) => `${path82.relative(root2, path82.dirname(file)).split(path82.sep).join("/")}/`
35254
35339
  ).sort();
35255
35340
  }
35256
35341
 
@@ -35289,7 +35374,7 @@ function upsertScopedRulesPointer(content, directories) {
35289
35374
  // src/commands/rules/updateScopedRulesIndex.ts
35290
35375
  function updateScopedRulesIndex(root2) {
35291
35376
  const directories = scopedRuleDirectories(root2);
35292
- const rootFile = path82.join(root2, "CLAUDE.md");
35377
+ const rootFile = path83.join(root2, "CLAUDE.md");
35293
35378
  const before = existsSync69(rootFile) ? readFileSync52(rootFile, "utf8") : "";
35294
35379
  const after = upsertScopedRulesPointer(before, directories);
35295
35380
  if (after !== before) writeFileSync42(rootFile, after);
@@ -35303,12 +35388,12 @@ function read2(file) {
35303
35388
  function addRule(text18, options2) {
35304
35389
  const rule = text18.trim();
35305
35390
  if (rule === "") {
35306
- console.error(chalk232.red("Rule text is required"));
35391
+ console.error(chalk233.red("Rule text is required"));
35307
35392
  process.exitCode = 1;
35308
35393
  return;
35309
35394
  }
35310
35395
  const target = resolveRuleScope(options2.scope ?? process.cwd());
35311
- const targetDir = path83.dirname(target);
35396
+ const targetDir = path84.dirname(target);
35312
35397
  const root2 = findRepoRoot(targetDir) ?? targetDir;
35313
35398
  const code = nextRuleCode(root2);
35314
35399
  writeFileSync43(
@@ -35321,38 +35406,38 @@ function addRule(text18, options2) {
35321
35406
  );
35322
35407
  updateScopedRulesIndex(root2);
35323
35408
  console.log(
35324
- `Added ${chalk232.cyan(code)} to ${path83.relative(process.cwd(), target) || target}`
35409
+ `Added ${chalk233.cyan(code)} to ${path84.relative(process.cwd(), target) || target}`
35325
35410
  );
35326
35411
  }
35327
35412
 
35328
35413
  // src/commands/rules/indexRules.ts
35329
- import path84 from "path";
35330
- import chalk233 from "chalk";
35414
+ import path85 from "path";
35415
+ import chalk234 from "chalk";
35331
35416
  function indexRules() {
35332
35417
  const startDir = scopeDirectory(process.cwd());
35333
35418
  const root2 = findRepoRoot(startDir) ?? startDir;
35334
35419
  const directories = updateScopedRulesIndex(root2);
35335
- const rootFile = path84.relative(process.cwd(), path84.join(root2, "CLAUDE.md"));
35420
+ const rootFile = path85.relative(process.cwd(), path85.join(root2, "CLAUDE.md"));
35336
35421
  if (directories.length === 0) {
35337
35422
  console.log(
35338
- chalk233.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35423
+ chalk234.gray(`No directories carry their own \`## Rules\` under ${root2}`)
35339
35424
  );
35340
35425
  return;
35341
35426
  }
35342
35427
  console.log(`Recorded in ${rootFile || "CLAUDE.md"}`);
35343
35428
  for (const directory of directories)
35344
- console.log(` ${chalk233.cyan(directory)}`);
35429
+ console.log(` ${chalk234.cyan(directory)}`);
35345
35430
  }
35346
35431
 
35347
35432
  // src/commands/rules/listRules.ts
35348
- import path85 from "path";
35349
- import chalk234 from "chalk";
35433
+ import path86 from "path";
35434
+ import chalk235 from "chalk";
35350
35435
  function listRules(target, options2 = {}) {
35351
- const resolved = path85.resolve(target ?? process.cwd());
35436
+ const resolved = path86.resolve(target ?? process.cwd());
35352
35437
  const rules3 = readScopedRules(resolved);
35353
35438
  if (rules3.length === 0) {
35354
- const label2 = path85.relative(process.cwd(), resolved) || ".";
35355
- console.log(chalk234.gray(`No rules in scope for ${label2}`));
35439
+ const label2 = path86.relative(process.cwd(), resolved) || ".";
35440
+ console.log(chalk235.gray(`No rules in scope for ${label2}`));
35356
35441
  return;
35357
35442
  }
35358
35443
  const base = findRepoRoot(scopeDirectory(resolved));
@@ -35362,14 +35447,14 @@ function listRules(target, options2 = {}) {
35362
35447
  if (rule.source !== shown) {
35363
35448
  shown = rule.source;
35364
35449
  console.log(
35365
- chalk234.dim(base ? path85.relative(base, rule.source) : rule.source)
35450
+ chalk235.dim(base ? path86.relative(base, rule.source) : rule.source)
35366
35451
  );
35367
35452
  }
35368
35453
  console.log(
35369
- ` ${chalk234.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35454
+ ` ${chalk235.cyan(rule.code.padEnd(width))} ${rule.title ?? rule.text}`
35370
35455
  );
35371
35456
  if (options2.full && rule.title)
35372
- console.log(` ${" ".repeat(width)} ${chalk234.dim(rule.text)}`);
35457
+ console.log(` ${" ".repeat(width)} ${chalk235.dim(rule.text)}`);
35373
35458
  }
35374
35459
  }
35375
35460
 
@@ -35398,7 +35483,7 @@ function registerRules(program2) {
35398
35483
  }
35399
35484
 
35400
35485
  // src/commands/seq/seqAuth.ts
35401
- import chalk236 from "chalk";
35486
+ import chalk237 from "chalk";
35402
35487
 
35403
35488
  // src/commands/seq/loadConnections.ts
35404
35489
  function loadConnections2() {
@@ -35427,10 +35512,10 @@ function setDefaultConnection(name) {
35427
35512
  }
35428
35513
 
35429
35514
  // src/shared/assertUniqueName.ts
35430
- import chalk235 from "chalk";
35515
+ import chalk236 from "chalk";
35431
35516
  function assertUniqueName(existingNames, name) {
35432
35517
  if (existingNames.includes(name)) {
35433
- console.error(chalk235.red(`Connection "${name}" already exists.`));
35518
+ console.error(chalk236.red(`Connection "${name}" already exists.`));
35434
35519
  process.exit(1);
35435
35520
  }
35436
35521
  }
@@ -35448,18 +35533,18 @@ async function promptConnection2(existingNames) {
35448
35533
  var seqAuth = createConnectionAuth({
35449
35534
  load: loadConnections2,
35450
35535
  save: saveConnections2,
35451
- format: (c) => `${chalk236.bold(c.name)} ${c.url}`,
35536
+ format: (c) => `${chalk237.bold(c.name)} ${c.url}`,
35452
35537
  promptNew: promptConnection2,
35453
35538
  onFirst: (c) => setDefaultConnection(c.name)
35454
35539
  });
35455
35540
 
35456
35541
  // src/commands/seq/seqQuery.ts
35457
- import chalk240 from "chalk";
35542
+ import chalk241 from "chalk";
35458
35543
 
35459
35544
  // src/commands/seq/fetchSeq.ts
35460
- import chalk237 from "chalk";
35461
- async function fetchSeq(conn, path104, params) {
35462
- const url = `${conn.url}${path104}?${params}`;
35545
+ import chalk238 from "chalk";
35546
+ async function fetchSeq(conn, path105, params) {
35547
+ const url = `${conn.url}${path105}?${params}`;
35463
35548
  const response = await fetch(url, {
35464
35549
  headers: {
35465
35550
  Accept: "application/json",
@@ -35468,7 +35553,7 @@ async function fetchSeq(conn, path104, params) {
35468
35553
  });
35469
35554
  if (!response.ok) {
35470
35555
  const body = await response.text();
35471
- console.error(chalk237.red(`Seq returned ${response.status}: ${body}`));
35556
+ console.error(chalk238.red(`Seq returned ${response.status}: ${body}`));
35472
35557
  process.exit(1);
35473
35558
  }
35474
35559
  return response;
@@ -35527,23 +35612,23 @@ async function fetchSeqEvents(conn, params) {
35527
35612
  }
35528
35613
 
35529
35614
  // src/commands/seq/formatEvent.ts
35530
- import chalk238 from "chalk";
35615
+ import chalk239 from "chalk";
35531
35616
  function levelColor(level) {
35532
35617
  switch (level) {
35533
35618
  case "Fatal":
35534
- return chalk238.bgRed.white;
35619
+ return chalk239.bgRed.white;
35535
35620
  case "Error":
35536
- return chalk238.red;
35621
+ return chalk239.red;
35537
35622
  case "Warning":
35538
- return chalk238.yellow;
35623
+ return chalk239.yellow;
35539
35624
  case "Information":
35540
- return chalk238.cyan;
35625
+ return chalk239.cyan;
35541
35626
  case "Debug":
35542
- return chalk238.gray;
35627
+ return chalk239.gray;
35543
35628
  case "Verbose":
35544
- return chalk238.dim;
35629
+ return chalk239.dim;
35545
35630
  default:
35546
- return chalk238.white;
35631
+ return chalk239.white;
35547
35632
  }
35548
35633
  }
35549
35634
  function levelAbbrev(level) {
@@ -35584,12 +35669,12 @@ function formatTimestamp(iso) {
35584
35669
  function formatEvent(event) {
35585
35670
  const color = levelColor(event.Level);
35586
35671
  const abbrev = levelAbbrev(event.Level);
35587
- const ts10 = chalk238.dim(formatTimestamp(event.Timestamp));
35672
+ const ts10 = chalk239.dim(formatTimestamp(event.Timestamp));
35588
35673
  const msg = renderMessage(event);
35589
35674
  const lines2 = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
35590
35675
  if (event.Exception) {
35591
35676
  for (const line of event.Exception.split("\n")) {
35592
- lines2.push(chalk238.red(` ${line}`));
35677
+ lines2.push(chalk239.red(` ${line}`));
35593
35678
  }
35594
35679
  }
35595
35680
  return lines2.join("\n");
@@ -35622,11 +35707,11 @@ function rejectTimestampFilter(filter) {
35622
35707
  }
35623
35708
 
35624
35709
  // src/shared/resolveNamedConnection.ts
35625
- import chalk239 from "chalk";
35710
+ import chalk240 from "chalk";
35626
35711
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
35627
35712
  if (connections.length === 0) {
35628
35713
  console.error(
35629
- chalk239.red(
35714
+ chalk240.red(
35630
35715
  `No ${kind} connections configured. Run '${authCommand}' first.`
35631
35716
  )
35632
35717
  );
@@ -35635,7 +35720,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
35635
35720
  const target = requested ?? defaultName ?? connections[0].name;
35636
35721
  const connection = connections.find((c) => c.name === target);
35637
35722
  if (!connection) {
35638
- console.error(chalk239.red(`${kind} connection "${target}" not found.`));
35723
+ console.error(chalk240.red(`${kind} connection "${target}" not found.`));
35639
35724
  process.exit(1);
35640
35725
  }
35641
35726
  return connection;
@@ -35664,7 +35749,7 @@ async function seqQuery(filter, options2) {
35664
35749
  new URLSearchParams({ filter, count: String(count8) })
35665
35750
  );
35666
35751
  if (events.length === 0) {
35667
- console.log(chalk240.yellow("No events found."));
35752
+ console.log(chalk241.yellow("No events found."));
35668
35753
  return;
35669
35754
  }
35670
35755
  if (options2.json) {
@@ -35675,11 +35760,11 @@ async function seqQuery(filter, options2) {
35675
35760
  for (const event of chronological) {
35676
35761
  console.log(formatEvent(event));
35677
35762
  }
35678
- console.log(chalk240.dim(`
35763
+ console.log(chalk241.dim(`
35679
35764
  ${events.length} events`));
35680
35765
  if (events.length >= count8) {
35681
35766
  console.log(
35682
- chalk240.yellow(
35767
+ chalk241.yellow(
35683
35768
  `Results limited to ${count8}. Use --count to retrieve more.`
35684
35769
  )
35685
35770
  );
@@ -35687,10 +35772,10 @@ ${events.length} events`));
35687
35772
  }
35688
35773
 
35689
35774
  // src/shared/setNamedDefaultConnection.ts
35690
- import chalk241 from "chalk";
35775
+ import chalk242 from "chalk";
35691
35776
  function setNamedDefaultConnection(connections, name, setDefault, kind) {
35692
35777
  if (!connections.find((c) => c.name === name)) {
35693
- console.error(chalk241.red(`Connection "${name}" not found.`));
35778
+ console.error(chalk242.red(`Connection "${name}" not found.`));
35694
35779
  process.exit(1);
35695
35780
  }
35696
35781
  setDefault(name);
@@ -35840,7 +35925,7 @@ async function previewSlackThreadParts({
35840
35925
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35841
35926
  );
35842
35927
  paths.forEach(
35843
- (path104, index3) => console.log(`${index3 + 1}/${paths.length} ${path104}`)
35928
+ (path105, index3) => console.log(`${index3 + 1}/${paths.length} ${path105}`)
35844
35929
  );
35845
35930
  console.log(
35846
35931
  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.`
@@ -35911,7 +35996,7 @@ function registerSlack(program2) {
35911
35996
  }
35912
35997
 
35913
35998
  // src/commands/sql/sqlAuth.ts
35914
- import chalk243 from "chalk";
35999
+ import chalk244 from "chalk";
35915
36000
 
35916
36001
  // src/commands/sql/loadConnections.ts
35917
36002
  function loadConnections3() {
@@ -35940,7 +36025,7 @@ function setDefaultConnection2(name) {
35940
36025
  }
35941
36026
 
35942
36027
  // src/commands/sql/promptConnection.ts
35943
- import chalk242 from "chalk";
36028
+ import chalk243 from "chalk";
35944
36029
  async function promptConnection3(existingNames) {
35945
36030
  const name = await promptInput("name", "Connection name:", "default");
35946
36031
  assertUniqueName(existingNames, name);
@@ -35948,7 +36033,7 @@ async function promptConnection3(existingNames) {
35948
36033
  const portStr = await promptInput("port", "Port:", "1433");
35949
36034
  const port = Number.parseInt(portStr, 10);
35950
36035
  if (!Number.isFinite(port)) {
35951
- console.error(chalk242.red(`Invalid port "${portStr}".`));
36036
+ console.error(chalk243.red(`Invalid port "${portStr}".`));
35952
36037
  process.exit(1);
35953
36038
  }
35954
36039
  const user = await promptInput("user", "User:");
@@ -35961,13 +36046,13 @@ async function promptConnection3(existingNames) {
35961
36046
  var sqlAuth = createConnectionAuth({
35962
36047
  load: loadConnections3,
35963
36048
  save: saveConnections3,
35964
- format: (c) => `${chalk243.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
36049
+ format: (c) => `${chalk244.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
35965
36050
  promptNew: promptConnection3,
35966
36051
  onFirst: (c) => setDefaultConnection2(c.name)
35967
36052
  });
35968
36053
 
35969
36054
  // src/commands/sql/printTable.ts
35970
- import chalk244 from "chalk";
36055
+ import chalk245 from "chalk";
35971
36056
  function formatCell(value) {
35972
36057
  if (value === null || value === void 0) return "";
35973
36058
  if (value instanceof Date) return value.toISOString();
@@ -35976,7 +36061,7 @@ function formatCell(value) {
35976
36061
  }
35977
36062
  function printTable(rows) {
35978
36063
  if (rows.length === 0) {
35979
- console.log(chalk244.yellow("(no rows)"));
36064
+ console.log(chalk245.yellow("(no rows)"));
35980
36065
  return;
35981
36066
  }
35982
36067
  const columns = Object.keys(rows[0]);
@@ -35984,13 +36069,13 @@ function printTable(rows) {
35984
36069
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
35985
36070
  );
35986
36071
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
35987
- console.log(chalk244.dim(header));
35988
- console.log(chalk244.dim("-".repeat(header.length)));
36072
+ console.log(chalk245.dim(header));
36073
+ console.log(chalk245.dim("-".repeat(header.length)));
35989
36074
  for (const row of rows) {
35990
36075
  const line = columns.map((c, i) => formatCell(row[c]).padEnd(widths[i])).join(" ");
35991
36076
  console.log(line);
35992
36077
  }
35993
- console.log(chalk244.dim(`
36078
+ console.log(chalk245.dim(`
35994
36079
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
35995
36080
  }
35996
36081
 
@@ -36050,7 +36135,7 @@ async function sqlColumns(table, connectionName) {
36050
36135
  }
36051
36136
 
36052
36137
  // src/commands/sql/sqlMutate.ts
36053
- import chalk245 from "chalk";
36138
+ import chalk246 from "chalk";
36054
36139
 
36055
36140
  // src/commands/sql/isMutation.ts
36056
36141
  var MUTATION_KEYWORDS = [
@@ -36084,7 +36169,7 @@ function isMutation(sql29) {
36084
36169
  async function sqlMutate(query, connectionName) {
36085
36170
  if (!isMutation(query)) {
36086
36171
  console.error(
36087
- chalk245.red(
36172
+ chalk246.red(
36088
36173
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
36089
36174
  )
36090
36175
  );
@@ -36094,18 +36179,18 @@ async function sqlMutate(query, connectionName) {
36094
36179
  const pool = await sqlConnect(conn);
36095
36180
  try {
36096
36181
  const result = await pool.request().query(query);
36097
- console.log(chalk245.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36182
+ console.log(chalk246.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
36098
36183
  } finally {
36099
36184
  await pool.close();
36100
36185
  }
36101
36186
  }
36102
36187
 
36103
36188
  // src/commands/sql/sqlQuery.ts
36104
- import chalk246 from "chalk";
36189
+ import chalk247 from "chalk";
36105
36190
  async function sqlQuery(query, connectionName) {
36106
36191
  if (isMutation(query)) {
36107
36192
  console.error(
36108
- chalk246.red(
36193
+ chalk247.red(
36109
36194
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
36110
36195
  )
36111
36196
  );
@@ -36120,7 +36205,7 @@ async function sqlQuery(query, connectionName) {
36120
36205
  printTable(rows);
36121
36206
  } else {
36122
36207
  console.log(
36123
- chalk246.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36208
+ chalk247.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
36124
36209
  );
36125
36210
  }
36126
36211
  } finally {
@@ -36182,15 +36267,15 @@ function registerSql(program2) {
36182
36267
 
36183
36268
  // src/commands/sync.ts
36184
36269
  import * as os5 from "os";
36185
- import * as path97 from "path";
36270
+ import * as path98 from "path";
36186
36271
  import { fileURLToPath as fileURLToPath8 } from "url";
36187
36272
 
36188
36273
  // src/commands/sync/pruneCommands.ts
36189
- import * as path87 from "path";
36274
+ import * as path88 from "path";
36190
36275
 
36191
36276
  // src/commands/sync/pruneTarget.ts
36192
36277
  import * as fs39 from "fs";
36193
- import * as path86 from "path";
36278
+ import * as path87 from "path";
36194
36279
  function pruneTarget(targetDir, keepNames, shape, options2) {
36195
36280
  const result = {
36196
36281
  orphans: [],
@@ -36208,7 +36293,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36208
36293
  }
36209
36294
  if (keep.has(name)) continue;
36210
36295
  result.orphans.push(entry.name);
36211
- const entryPath = path86.join(targetDir, entry.name);
36296
+ const entryPath = path87.join(targetDir, entry.name);
36212
36297
  const reason4 = shape.blockedBy?.(entryPath);
36213
36298
  if (reason4) {
36214
36299
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -36228,7 +36313,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36228
36313
  targetDir,
36229
36314
  commandNames,
36230
36315
  {
36231
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path87.basename(entry.name, ".md") : void 0
36316
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path88.basename(entry.name, ".md") : void 0
36232
36317
  },
36233
36318
  options2
36234
36319
  );
@@ -36263,16 +36348,16 @@ function reportPrune(label2, result, force) {
36263
36348
 
36264
36349
  // src/commands/sync/syncClaudeCommands.ts
36265
36350
  import * as fs43 from "fs";
36266
- import * as path91 from "path";
36351
+ import * as path92 from "path";
36267
36352
 
36268
36353
  // src/commands/sync/syncCodex.ts
36269
- import * as path90 from "path";
36354
+ import * as path91 from "path";
36270
36355
 
36271
36356
  // src/commands/sync/installHarnessCommands.ts
36272
36357
  import * as fs40 from "fs";
36273
- import * as path88 from "path";
36358
+ import * as path89 from "path";
36274
36359
  function installHarnessCommands(claudeDir, harness, transform) {
36275
- const commandsSource = path88.join(claudeDir, "commands");
36360
+ const commandsSource = path89.join(claudeDir, "commands");
36276
36361
  const files = fs40.readdirSync(commandsSource);
36277
36362
  const names = [];
36278
36363
  let synced = 0;
@@ -36280,9 +36365,9 @@ function installHarnessCommands(claudeDir, harness, transform) {
36280
36365
  if (!file.endsWith(".md")) continue;
36281
36366
  const name = file.replace(/\.md$/, "");
36282
36367
  names.push(name);
36283
- const content = fs40.readFileSync(path88.join(commandsSource, file), "utf8");
36284
- const target = path88.join(harness.homeDir, harness.sync.commandDest(name));
36285
- fs40.mkdirSync(path88.dirname(target), { recursive: true });
36368
+ const content = fs40.readFileSync(path89.join(commandsSource, file), "utf8");
36369
+ const target = path89.join(harness.homeDir, harness.sync.commandDest(name));
36370
+ fs40.mkdirSync(path89.dirname(target), { recursive: true });
36286
36371
  fs40.writeFileSync(target, transform(name, content));
36287
36372
  synced++;
36288
36373
  }
@@ -36311,7 +36396,7 @@ function unexpectedContent(skillDir) {
36311
36396
 
36312
36397
  // src/commands/sync/syncCodexHooks.ts
36313
36398
  import * as fs42 from "fs";
36314
- import * as path89 from "path";
36399
+ import * as path90 from "path";
36315
36400
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36316
36401
  var END = "# <<< assist codex hooks (managed) <<<";
36317
36402
  function upsertManagedBlock(existing, body) {
@@ -36342,9 +36427,9 @@ ${rest}
36342
36427
  }
36343
36428
  function syncCodexHooks(sourcePath) {
36344
36429
  const body = fs42.readFileSync(sourcePath, "utf8");
36345
- const configPath = path89.join(harnesses.codex.homeDir, "config.toml");
36430
+ const configPath = path90.join(harnesses.codex.homeDir, "config.toml");
36346
36431
  const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
36347
- fs42.mkdirSync(path89.dirname(configPath), { recursive: true });
36432
+ fs42.mkdirSync(path90.dirname(configPath), { recursive: true });
36348
36433
  fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
36349
36434
  console.log(
36350
36435
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
@@ -36376,13 +36461,13 @@ function syncCodex(claudeDir, options2) {
36376
36461
  harnesses.codex,
36377
36462
  commandToSkill
36378
36463
  );
36379
- syncCodexHooks(path90.join(claudeDir, "..", "codex", "config.toml"));
36464
+ syncCodexHooks(path91.join(claudeDir, "..", "codex", "config.toml"));
36380
36465
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36381
36466
  if (!options2?.prune) return;
36382
36467
  const force = options2.force ?? false;
36383
36468
  reportPrune(
36384
36469
  "~/.codex/skills",
36385
- pruneSkills(path90.join(harnesses.codex.homeDir, "skills"), names, { force }),
36470
+ pruneSkills(path91.join(harnesses.codex.homeDir, "skills"), names, { force }),
36386
36471
  force
36387
36472
  );
36388
36473
  }
@@ -36397,30 +36482,30 @@ function replaceFileWithoutFollowingSymlink(file, content) {
36397
36482
  fs43.writeFileSync(file, content);
36398
36483
  }
36399
36484
  function writeSkill(targetBase, name, content) {
36400
- const skillDir = path91.join(targetBase, "skills", name);
36485
+ const skillDir = path92.join(targetBase, "skills", name);
36401
36486
  fs43.mkdirSync(skillDir, { recursive: true });
36402
36487
  replaceFileWithoutFollowingSymlink(
36403
- path91.join(skillDir, "SKILL.md"),
36488
+ path92.join(skillDir, "SKILL.md"),
36404
36489
  commandToSkill(name, content)
36405
36490
  );
36406
- fs43.rmSync(path91.join(targetBase, "commands", `${name}.md`), { force: true });
36491
+ fs43.rmSync(path92.join(targetBase, "commands", `${name}.md`), { force: true });
36407
36492
  console.log(`Wrote ${name} as a skill to ${skillDir}`);
36408
36493
  }
36409
36494
  function syncClaudeCommands(claudeDir, targetBase) {
36410
- const sourceDir = path91.join(claudeDir, "commands");
36411
- const targetDir = path91.join(targetBase, "commands");
36495
+ const sourceDir = path92.join(claudeDir, "commands");
36496
+ const targetDir = path92.join(targetBase, "commands");
36412
36497
  fs43.mkdirSync(targetDir, { recursive: true });
36413
36498
  const files = fs43.readdirSync(sourceDir);
36414
36499
  for (const file of files) {
36415
- const source = path91.join(sourceDir, file);
36500
+ const source = path92.join(sourceDir, file);
36416
36501
  if (file.endsWith(".md")) {
36417
36502
  const content = fs43.readFileSync(source, "utf8");
36418
36503
  if (isSkillFlagged(content)) {
36419
- writeSkill(targetBase, path91.basename(file, ".md"), content);
36504
+ writeSkill(targetBase, path92.basename(file, ".md"), content);
36420
36505
  continue;
36421
36506
  }
36422
36507
  }
36423
- fs43.copyFileSync(source, path91.join(targetDir, file));
36508
+ fs43.copyFileSync(source, path92.join(targetDir, file));
36424
36509
  console.log(`Copied ${file} to ${targetDir}`);
36425
36510
  }
36426
36511
  console.log(`Synced ${files.length} command(s) to ~/.claude`);
@@ -36429,11 +36514,11 @@ function syncClaudeCommands(claudeDir, targetBase) {
36429
36514
 
36430
36515
  // src/commands/sync/reportRetiredAgentsFiles.ts
36431
36516
  import * as fs44 from "fs";
36432
- import * as path92 from "path";
36517
+ import * as path93 from "path";
36433
36518
  var retired = [
36434
- path92.join(harnesses.claude.homeDir, "CLAUDE.md"),
36435
- path92.join(harnesses.codex.homeDir, "AGENTS.md"),
36436
- path92.join(harnesses.pi.homeDir, "AGENTS.md")
36519
+ path93.join(harnesses.claude.homeDir, "CLAUDE.md"),
36520
+ path93.join(harnesses.codex.homeDir, "AGENTS.md"),
36521
+ path93.join(harnesses.pi.homeDir, "AGENTS.md")
36437
36522
  ];
36438
36523
  function reportRetiredAgentsFiles() {
36439
36524
  const leftovers = retired.filter((file) => fs44.existsSync(file));
@@ -36449,35 +36534,35 @@ function reportRetiredAgentsFiles() {
36449
36534
 
36450
36535
  // src/commands/sync/syncDesign.ts
36451
36536
  import * as fs45 from "fs";
36452
- import * as path93 from "path";
36537
+ import * as path94 from "path";
36453
36538
  function syncDesign(claudeDir, targetBase) {
36454
- const systemPromptSource = path93.join(claudeDir, "design-system-prompt.md");
36455
- const systemPromptTarget = path93.join(targetBase, "design-system-prompt.md");
36539
+ const systemPromptSource = path94.join(claudeDir, "design-system-prompt.md");
36540
+ const systemPromptTarget = path94.join(targetBase, "design-system-prompt.md");
36456
36541
  fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36457
36542
  console.log(
36458
36543
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36459
36544
  );
36460
- const skillsSource = path93.join(claudeDir, "skills");
36461
- const skillsTarget = path93.join(targetBase, "skills");
36545
+ const skillsSource = path94.join(claudeDir, "skills");
36546
+ const skillsTarget = path94.join(targetBase, "skills");
36462
36547
  fs45.mkdirSync(skillsTarget, { recursive: true });
36463
36548
  const files = fs45.readdirSync(skillsSource);
36464
36549
  for (const file of files) {
36465
36550
  fs45.copyFileSync(
36466
- path93.join(skillsSource, file),
36467
- path93.join(skillsTarget, file)
36551
+ path94.join(skillsSource, file),
36552
+ path94.join(skillsTarget, file)
36468
36553
  );
36469
36554
  }
36470
36555
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36471
36556
  }
36472
36557
 
36473
36558
  // src/commands/sync/syncPi.ts
36474
- import * as path95 from "path";
36559
+ import * as path96 from "path";
36475
36560
 
36476
36561
  // src/commands/sync/syncPiHooks.ts
36477
36562
  import * as fs46 from "fs";
36478
- import * as path94 from "path";
36563
+ import * as path95 from "path";
36479
36564
  function piExtensionsDir() {
36480
- return path94.join(harnesses.pi.homeDir, "extensions");
36565
+ return path95.join(harnesses.pi.homeDir, "extensions");
36481
36566
  }
36482
36567
  function syncPiHooks(sourceDir) {
36483
36568
  const target = piExtensionsDir();
@@ -36485,8 +36570,8 @@ function syncPiHooks(sourceDir) {
36485
36570
  const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36486
36571
  for (const file of files) {
36487
36572
  fs46.copyFileSync(
36488
- path94.join(sourceDir, file),
36489
- path94.join(target, `assist-${file}`)
36573
+ path95.join(sourceDir, file),
36574
+ path95.join(target, `assist-${file}`)
36490
36575
  );
36491
36576
  }
36492
36577
  console.log(
@@ -36523,24 +36608,24 @@ function syncPi(claudeDir, options2) {
36523
36608
  harnesses.pi,
36524
36609
  commandToPrompt
36525
36610
  );
36526
- syncPiHooks(path95.join(claudeDir, "..", "pi"));
36611
+ syncPiHooks(path96.join(claudeDir, "..", "pi"));
36527
36612
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36528
36613
  if (!options2?.prune) return;
36529
36614
  const force = options2.force ?? false;
36530
36615
  reportPrune(
36531
36616
  "~/.pi/agent/prompts",
36532
- pruneCommands(path95.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36617
+ pruneCommands(path96.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36533
36618
  force
36534
36619
  );
36535
36620
  }
36536
36621
 
36537
36622
  // src/commands/sync/syncSettings.ts
36538
36623
  import * as fs47 from "fs";
36539
- import * as path96 from "path";
36540
- import chalk247 from "chalk";
36624
+ import * as path97 from "path";
36625
+ import chalk248 from "chalk";
36541
36626
  async function syncSettings(claudeDir, targetBase, options2) {
36542
- const source = path96.join(claudeDir, "settings.json");
36543
- const target = path96.join(targetBase, "settings.json");
36627
+ const source = path97.join(claudeDir, "settings.json");
36628
+ const target = path97.join(targetBase, "settings.json");
36544
36629
  const sourceContent = fs47.readFileSync(source, "utf8");
36545
36630
  const sourceSettings = JSON.parse(sourceContent);
36546
36631
  const targetExists = fs47.existsSync(target);
@@ -36556,7 +36641,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36556
36641
  if (mergedContent !== normalizedTarget) {
36557
36642
  if (!options2?.yes) {
36558
36643
  console.log(
36559
- chalk247.yellow(
36644
+ chalk248.yellow(
36560
36645
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
36561
36646
  )
36562
36647
  );
@@ -36564,7 +36649,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36564
36649
  printDiff(targetContent, mergedContent);
36565
36650
  printAutoConfirmHint();
36566
36651
  const confirm = await promptConfirm(
36567
- chalk247.red("Overwrite existing settings.json?"),
36652
+ chalk248.red("Overwrite existing settings.json?"),
36568
36653
  false
36569
36654
  );
36570
36655
  if (!confirm) {
@@ -36580,13 +36665,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
36580
36665
 
36581
36666
  // src/commands/sync.ts
36582
36667
  var __filename4 = fileURLToPath8(import.meta.url);
36583
- var __dirname5 = path97.dirname(__filename4);
36668
+ var __dirname5 = path98.dirname(__filename4);
36584
36669
  async function sync(options2) {
36585
36670
  const config = loadConfig();
36586
36671
  const yes = options2?.yes ?? config.sync.autoConfirm;
36587
36672
  const prune = { prune: options2?.prune, force: options2?.force };
36588
- const claudeDir = path97.join(__dirname5, "..", "claude");
36589
- const targetBase = path97.join(os5.homedir(), ".claude");
36673
+ const claudeDir = path98.join(__dirname5, "..", "claude");
36674
+ const targetBase = path98.join(os5.homedir(), ".claude");
36590
36675
  const commandFiles = syncClaudeCommands(claudeDir, targetBase);
36591
36676
  syncDesign(claudeDir, targetBase);
36592
36677
  await syncSettings(claudeDir, targetBase, { yes });
@@ -36594,11 +36679,11 @@ async function sync(options2) {
36594
36679
  syncPi(claudeDir, prune);
36595
36680
  reportRetiredAgentsFiles();
36596
36681
  if (!options2?.prune) return;
36597
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path97.basename(file, ".md"));
36682
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path98.basename(file, ".md"));
36598
36683
  const force = options2.force ?? false;
36599
36684
  reportPrune(
36600
36685
  "~/.claude/commands",
36601
- pruneCommands(path97.join(targetBase, "commands"), commandNames, { force }),
36686
+ pruneCommands(path98.join(targetBase, "commands"), commandNames, { force }),
36602
36687
  force
36603
36688
  );
36604
36689
  }
@@ -37654,9 +37739,9 @@ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
37654
37739
 
37655
37740
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37656
37741
  import { minimatch as minimatch9 } from "minimatch";
37657
- function resolveStringsAtPath(data, path104) {
37742
+ function resolveStringsAtPath(data, path105) {
37658
37743
  let current = data;
37659
- for (const segment of path104.split(".")) {
37744
+ for (const segment of path105.split(".")) {
37660
37745
  if (current === null || typeof current !== "object") return [];
37661
37746
  current = current[segment];
37662
37747
  }
@@ -37669,10 +37754,10 @@ function resolveStringsAtPath(data, path104) {
37669
37754
  }
37670
37755
  function findRuleViolations(data, rule) {
37671
37756
  const violations = [];
37672
- for (const path104 of rule.paths) {
37673
- for (const value of resolveStringsAtPath(data, path104)) {
37757
+ for (const path105 of rule.paths) {
37758
+ for (const value of resolveStringsAtPath(data, path105)) {
37674
37759
  if (minimatch9(value, rule.disallowed))
37675
- violations.push({ file: rule.file, path: path104, value });
37760
+ violations.push({ file: rule.file, path: path105, value });
37676
37761
  }
37677
37762
  }
37678
37763
  return violations;
@@ -37711,8 +37796,8 @@ function forbiddenStrings() {
37711
37796
  process.exit(0);
37712
37797
  }
37713
37798
  console.log("Forbidden strings found:\n");
37714
- for (const { file, path: path104, value } of violations) {
37715
- console.log(` ${file} ${path104}: ${value}`);
37799
+ for (const { file, path: path105, value } of violations) {
37800
+ console.log(` ${file} ${path105}: ${value}`);
37716
37801
  }
37717
37802
  console.log(`
37718
37803
  Total: ${violations.length} forbidden string(s).`);
@@ -37768,7 +37853,7 @@ Total: ${lines2.length} hardcoded color(s)`);
37768
37853
 
37769
37854
  // src/commands/verify/migrations.ts
37770
37855
  import { readFileSync as readFileSync61 } from "fs";
37771
- import path99 from "path";
37856
+ import path100 from "path";
37772
37857
 
37773
37858
  // src/commands/verify/migrations/checkAppendOnly.ts
37774
37859
  function checkAppendOnly(baseline, current) {
@@ -37860,15 +37945,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37860
37945
  } catch {
37861
37946
  return baseline;
37862
37947
  }
37863
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path104) => MIGRATION_FILE3.test(basename26(path104)));
37864
- for (const path104 of paths) {
37948
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path105) => MIGRATION_FILE3.test(basename26(path105)));
37949
+ for (const path105 of paths) {
37865
37950
  try {
37866
- const content = execSync63(`git show "${ref}:${path104}"`, {
37951
+ const content = execSync63(`git show "${ref}:${path105}"`, {
37867
37952
  encoding: "utf8",
37868
37953
  maxBuffer: 16 * 1024 * 1024,
37869
37954
  stdio: ["pipe", "pipe", "pipe"]
37870
37955
  });
37871
- baseline.set(basename26(path104), content);
37956
+ baseline.set(basename26(path105), content);
37872
37957
  } catch {
37873
37958
  }
37874
37959
  }
@@ -37907,11 +37992,11 @@ function resolveBaselineRef() {
37907
37992
  }
37908
37993
 
37909
37994
  // src/commands/verify/migrations/migrationsDir.ts
37910
- import path98 from "path";
37995
+ import path99 from "path";
37911
37996
  import { fileURLToPath as fileURLToPath9 } from "url";
37912
37997
  function migrationsDir() {
37913
- return path98.resolve(
37914
- path98.dirname(fileURLToPath9(import.meta.url)),
37998
+ return path99.resolve(
37999
+ path99.dirname(fileURLToPath9(import.meta.url)),
37915
38000
  "../../../shared/db/migrations"
37916
38001
  );
37917
38002
  }
@@ -37932,7 +38017,7 @@ function migrations2() {
37932
38017
  if (ref) {
37933
38018
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
37934
38019
  const current = new Map(
37935
- files.map((file) => [file, readFileSync61(path99.join(dir, file), "utf8")])
38020
+ files.map((file) => [file, readFileSync61(path100.join(dir, file), "utf8")])
37936
38021
  );
37937
38022
  for (const finding of checkAppendOnly(baseline, current)) {
37938
38023
  problems.push(
@@ -38437,11 +38522,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
38437
38522
  var sessionsPrefix = "src/commands/sessions/";
38438
38523
  var rules = [
38439
38524
  {
38440
- matches: (path104) => path104.startsWith(webUiPrefix),
38525
+ matches: (path105) => path105.startsWith(webUiPrefix),
38441
38526
  advice: "restart the web server, then hard-reload the browser tab"
38442
38527
  },
38443
38528
  {
38444
- matches: (path104) => path104.startsWith(sessionsPrefix) && !path104.startsWith(webUiPrefix),
38529
+ matches: (path105) => path105.startsWith(sessionsPrefix) && !path105.startsWith(webUiPrefix),
38445
38530
  advice: "restart the daemon"
38446
38531
  }
38447
38532
  ];
@@ -38452,27 +38537,27 @@ function restartAdvice(paths) {
38452
38537
  // src/commands/watch/syncAdvice.ts
38453
38538
  var rules2 = [
38454
38539
  {
38455
- matches: (path104) => path104.startsWith("claude/commands/"),
38540
+ matches: (path105) => path105.startsWith("claude/commands/"),
38456
38541
  reason: "claude/commands changed"
38457
38542
  },
38458
38543
  {
38459
- matches: (path104) => path104.startsWith("claude/skills/"),
38544
+ matches: (path105) => path105.startsWith("claude/skills/"),
38460
38545
  reason: "claude/skills changed"
38461
38546
  },
38462
38547
  {
38463
- matches: (path104) => path104 === "claude/settings.json",
38548
+ matches: (path105) => path105 === "claude/settings.json",
38464
38549
  reason: "claude/settings.json changed"
38465
38550
  },
38466
38551
  {
38467
- matches: (path104) => path104 === "claude/design-system-prompt.md",
38552
+ matches: (path105) => path105 === "claude/design-system-prompt.md",
38468
38553
  reason: "claude/design-system-prompt.md changed"
38469
38554
  },
38470
38555
  {
38471
- matches: (path104) => path104.startsWith("codex/"),
38556
+ matches: (path105) => path105.startsWith("codex/"),
38472
38557
  reason: "codex sources changed"
38473
38558
  },
38474
38559
  {
38475
- matches: (path104) => path104.startsWith("pi/"),
38560
+ matches: (path105) => path105.startsWith("pi/"),
38476
38561
  reason: "pi sources changed"
38477
38562
  }
38478
38563
  ];
@@ -38954,7 +39039,7 @@ function registerWatch(program2) {
38954
39039
 
38955
39040
  // src/commands/roam/auth.ts
38956
39041
  import { randomBytes } from "crypto";
38957
- import chalk248 from "chalk";
39042
+ import chalk249 from "chalk";
38958
39043
 
38959
39044
  // src/commands/roam/waitForCallback.ts
38960
39045
  import { createServer as createServer3 } from "http";
@@ -39085,13 +39170,13 @@ async function auth() {
39085
39170
  saveGlobalConfig(config);
39086
39171
  const state = randomBytes(16).toString("hex");
39087
39172
  console.log(
39088
- chalk248.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39173
+ chalk249.yellow("\nEnsure this Redirect URI is set in your Roam OAuth app:")
39089
39174
  );
39090
- console.log(chalk248.white("http://localhost:14523/callback\n"));
39091
- console.log(chalk248.blue("Opening browser for authorization..."));
39092
- console.log(chalk248.dim("Waiting for authorization callback..."));
39175
+ console.log(chalk249.white("http://localhost:14523/callback\n"));
39176
+ console.log(chalk249.blue("Opening browser for authorization..."));
39177
+ console.log(chalk249.dim("Waiting for authorization callback..."));
39093
39178
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
39094
- console.log(chalk248.dim("Exchanging code for tokens..."));
39179
+ console.log(chalk249.dim("Exchanging code for tokens..."));
39095
39180
  const tokens = await exchangeToken({
39096
39181
  code,
39097
39182
  clientId,
@@ -39107,7 +39192,7 @@ async function auth() {
39107
39192
  };
39108
39193
  saveGlobalConfig(config);
39109
39194
  console.log(
39110
- chalk248.green("Roam credentials and tokens saved to ~/.assist.yml")
39195
+ chalk249.green("Roam credentials and tokens saved to ~/.assist.yml")
39111
39196
  );
39112
39197
  }
39113
39198
 
@@ -39123,9 +39208,9 @@ function findPortFile(roamDir) {
39123
39208
  return void 0;
39124
39209
  }
39125
39210
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
39126
- const path104 = join101(roamDir, name);
39211
+ const path105 = join101(roamDir, name);
39127
39212
  try {
39128
- return { path: path104, mtimeMs: statSync13(path104).mtimeMs };
39213
+ return { path: path105, mtimeMs: statSync13(path105).mtimeMs };
39129
39214
  } catch {
39130
39215
  return void 0;
39131
39216
  }
@@ -39369,11 +39454,11 @@ function findLinkIndex() {
39369
39454
  function parseLinkArgs() {
39370
39455
  const idx = findLinkIndex();
39371
39456
  if (idx === -1) return null;
39372
- const path104 = process.argv[idx + 1];
39457
+ const path105 = process.argv[idx + 1];
39373
39458
  const rest = process.argv.slice(idx + 2);
39374
39459
  const { value: prefix2 } = extractOption(rest, "--prefix");
39375
39460
  if (!prefix2) return null;
39376
- return { path: path104, prefix: prefix2 };
39461
+ return { path: path105, prefix: prefix2 };
39377
39462
  }
39378
39463
  function hasDuplicateLink(runList, linkPath) {
39379
39464
  return runList.some(
@@ -39462,7 +39547,7 @@ function registerRun(program2) {
39462
39547
  }
39463
39548
 
39464
39549
  // src/commands/sessions/nodes/formatLink.ts
39465
- import chalk249 from "chalk";
39550
+ import chalk250 from "chalk";
39466
39551
 
39467
39552
  // src/commands/sessions/daemon/links/describeTarget.ts
39468
39553
  function describeTarget({ url, ssh }) {
@@ -39472,16 +39557,16 @@ function describeTarget({ url, ssh }) {
39472
39557
 
39473
39558
  // src/commands/sessions/nodes/formatLink.ts
39474
39559
  var STATE_COLOURS = {
39475
- connected: chalk249.green,
39476
- connecting: chalk249.yellow,
39477
- disconnected: chalk249.red,
39478
- "version-blocked": chalk249.red
39560
+ connected: chalk250.green,
39561
+ connecting: chalk250.yellow,
39562
+ disconnected: chalk250.red,
39563
+ "version-blocked": chalk250.red
39479
39564
  };
39480
39565
  function formatLink(link3) {
39481
- const colour = STATE_COLOURS[link3.state] ?? chalk249.white;
39566
+ const colour = STATE_COLOURS[link3.state] ?? chalk250.white;
39482
39567
  const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
39483
39568
  const error = link3.error ? `
39484
- ${chalk249.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39569
+ ${chalk250.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39485
39570
  return ` ${link3.name} ${colour(link3.state)} ${describeTarget(link3)}${peer}${error}`;
39486
39571
  }
39487
39572
 
@@ -40018,14 +40103,14 @@ import * as pty from "node-pty";
40018
40103
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
40019
40104
  import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
40020
40105
  import { createRequire as createRequire3 } from "module";
40021
- import path100 from "path";
40106
+ import path101 from "path";
40022
40107
  var require4 = createRequire3(import.meta.url);
40023
40108
  var ensured = false;
40024
40109
  function ensureSpawnHelperExecutable() {
40025
40110
  if (ensured || process.platform !== "darwin") return;
40026
40111
  ensured = true;
40027
- const ptyRoot = path100.join(path100.dirname(require4.resolve("node-pty")), "..");
40028
- const helper = path100.join(
40112
+ const ptyRoot = path101.join(path101.dirname(require4.resolve("node-pty")), "..");
40113
+ const helper = path101.join(
40029
40114
  ptyRoot,
40030
40115
  "prebuilds",
40031
40116
  `${process.platform}-${process.arch}`,
@@ -40156,12 +40241,12 @@ function serverRunMeta(runName, cwd) {
40156
40241
 
40157
40242
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
40158
40243
  import * as fs50 from "fs";
40159
- import * as path101 from "path";
40244
+ import * as path102 from "path";
40160
40245
  import { fileURLToPath as fileURLToPath11 } from "url";
40161
40246
  var __filename5 = fileURLToPath11(import.meta.url);
40162
- var __dirname7 = path101.dirname(__filename5);
40247
+ var __dirname7 = path102.dirname(__filename5);
40163
40248
  function readDesignSystemPrompt() {
40164
- const promptPath = path101.join(
40249
+ const promptPath = path102.join(
40165
40250
  __dirname7,
40166
40251
  "..",
40167
40252
  "claude",
@@ -41195,8 +41280,8 @@ async function seedRunningMsFromUsage(session, notify2) {
41195
41280
  var DEBOUNCE_MS2 = 50;
41196
41281
  function watchActivity(session, notify2, onClaudeSessionId) {
41197
41282
  if (session.commandType !== "assist" || !session.cwd) return;
41198
- const path104 = activityPath(session.id);
41199
- const dir = dirname42(path104);
41283
+ const path105 = activityPath(session.id);
41284
+ const dir = dirname42(path105);
41200
41285
  try {
41201
41286
  mkdirSync37(dir, { recursive: true });
41202
41287
  } catch {
@@ -41206,7 +41291,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41206
41291
  let timer = null;
41207
41292
  const read3 = () => {
41208
41293
  timer = null;
41209
- const activity2 = readActivity(path104);
41294
+ const activity2 = readActivity(path105);
41210
41295
  if (!activity2) return;
41211
41296
  applyActivityToSession(session, activity2);
41212
41297
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -41215,11 +41300,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41215
41300
  notify2();
41216
41301
  };
41217
41302
  session.activityWatcher = watch2(dir, (_event, filename) => {
41218
- if (filename && !path104.endsWith(filename)) return;
41303
+ if (filename && !path105.endsWith(filename)) return;
41219
41304
  if (timer) clearTimeout(timer);
41220
41305
  timer = setTimeout(read3, DEBOUNCE_MS2);
41221
41306
  });
41222
- if (existsSync93(path104)) read3();
41307
+ if (existsSync93(path105)) read3();
41223
41308
  }
41224
41309
  function refreshActivity(session) {
41225
41310
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -41362,12 +41447,12 @@ import { watch as watch3 } from "fs";
41362
41447
 
41363
41448
  // src/commands/sessions/shared/findTranscriptPathSync.ts
41364
41449
  import * as fs52 from "fs";
41365
- import * as path102 from "path";
41450
+ import * as path103 from "path";
41366
41451
  function projectDirForCwd(cwd) {
41367
- return path102.join(claudeProjectsRoot(), projectSlug(cwd));
41452
+ return path103.join(claudeProjectsRoot(), projectSlug(cwd));
41368
41453
  }
41369
41454
  function transcriptPathFor(cwd, claudeSessionId) {
41370
- return path102.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41455
+ return path103.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41371
41456
  }
41372
41457
  function findTranscriptPathSync(cwd, claudeSessionId) {
41373
41458
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -41381,8 +41466,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
41381
41466
  }
41382
41467
  for (const file of files) {
41383
41468
  if (!file.endsWith(".jsonl")) continue;
41384
- if (headContainsSessionId(path102.join(dir, file), claudeSessionId))
41385
- return path102.join(dir, file);
41469
+ if (headContainsSessionId(path103.join(dir, file), claudeSessionId))
41470
+ return path103.join(dir, file);
41386
41471
  }
41387
41472
  return null;
41388
41473
  }
@@ -42582,9 +42667,9 @@ function tempRoots() {
42582
42667
  }
42583
42668
  return [...roots];
42584
42669
  }
42585
- function underTempRoot(path104) {
42670
+ function underTempRoot(path105) {
42586
42671
  return tempRoots().some(
42587
- (root2) => path104.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42672
+ (root2) => path105.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42588
42673
  );
42589
42674
  }
42590
42675
 
@@ -43070,15 +43155,15 @@ function bindResumedWorktree(session, cwd, notify2) {
43070
43155
  import { existsSync as existsSync95 } from "fs";
43071
43156
  async function reclaimVanishedWorktrees(clone, paths) {
43072
43157
  if (!existsSync95(clone)) {
43073
- for (const { path: path104 } of paths) forgetWorktree(path104);
43158
+ for (const { path: path105 } of paths) forgetWorktree(path105);
43074
43159
  daemonLog(
43075
43160
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
43076
43161
  );
43077
43162
  return;
43078
43163
  }
43079
43164
  await pruneBookkeeping2(clone);
43080
- for (const { path: path104, branch: branch2 } of paths)
43081
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path104);
43165
+ for (const { path: path105, branch: branch2 } of paths)
43166
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path105);
43082
43167
  }
43083
43168
  async function pruneBookkeeping2(clone) {
43084
43169
  try {
@@ -43105,37 +43190,37 @@ async function reclaimBranch(clone, branch2) {
43105
43190
  }
43106
43191
 
43107
43192
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
43108
- function logVanishedTree(sessions, path104) {
43193
+ function logVanishedTree(sessions, path105) {
43109
43194
  const claimants = [...sessions.values()].filter(
43110
- (s) => s.cwd === path104 || s.worktree?.path === path104
43195
+ (s) => s.cwd === path105 || s.worktree?.path === path105
43111
43196
  );
43112
43197
  if (claimants.length === 0) {
43113
- daemonLog(`worktree ${path104} gone from disk and unclaimed; reclaiming it`);
43198
+ daemonLog(`worktree ${path105} gone from disk and unclaimed; reclaiming it`);
43114
43199
  return;
43115
43200
  }
43116
43201
  for (const s of claimants)
43117
43202
  daemonLog(
43118
- `session ${s.id} ("${s.name}") claims worktree ${path104}, which is gone from disk; reclaiming it`
43203
+ `session ${s.id} ("${s.name}") claims worktree ${path105}, which is gone from disk; reclaiming it`
43119
43204
  );
43120
43205
  }
43121
43206
 
43122
43207
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
43123
43208
  var MAX_ITEMS = 20;
43124
- async function describeHeldWork(path104, reason4) {
43125
- if (reason4.startsWith("uncommitted")) return await changedFiles(path104);
43126
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path104, reason4);
43209
+ async function describeHeldWork(path105, reason4) {
43210
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path105);
43211
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path105, reason4);
43127
43212
  return { summary: reason4, items: [] };
43128
43213
  }
43129
- async function changedFiles(path104) {
43130
- const status3 = await gitResult(path104, ["status", "--porcelain"]);
43214
+ async function changedFiles(path105) {
43215
+ const status3 = await gitResult(path105, ["status", "--porcelain"]);
43131
43216
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
43132
43217
  return {
43133
43218
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
43134
43219
  items: capped2(lines2)
43135
43220
  };
43136
43221
  }
43137
- async function unpushedCommits(path104, reason4) {
43138
- const log2 = await gitResult(path104, ["log", "--oneline", "@{upstream}..HEAD"]);
43222
+ async function unpushedCommits(path105, reason4) {
43223
+ const log2 = await gitResult(path105, ["log", "--oneline", "@{upstream}..HEAD"]);
43139
43224
  if (!log2.ok) return { summary: reason4, items: [] };
43140
43225
  const lines2 = nonEmptyLines(log2.out);
43141
43226
  return {
@@ -43227,24 +43312,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
43227
43312
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
43228
43313
  const accounted = accountedTrees(sessions);
43229
43314
  const vanished = /* @__PURE__ */ new Map();
43230
- for (const { path: path104, clone } of readWorktreeRegistry()) {
43231
- if (underTempRoot(path104)) {
43232
- forgetWorktree(path104);
43315
+ for (const { path: path105, clone } of readWorktreeRegistry()) {
43316
+ if (underTempRoot(path105)) {
43317
+ forgetWorktree(path105);
43233
43318
  daemonLog(
43234
- `worktree ${path104} lies outside any project root; pruned from the registry rather than recovered`
43319
+ `worktree ${path105} lies outside any project root; pruned from the registry rather than recovered`
43235
43320
  );
43236
43321
  continue;
43237
43322
  }
43238
- if (!existsSync96(path104)) {
43239
- logVanishedTree(sessions, path104);
43323
+ if (!existsSync96(path105)) {
43324
+ logVanishedTree(sessions, path105);
43240
43325
  vanished.set(clone, [
43241
43326
  ...vanished.get(clone) ?? [],
43242
- { path: path104, branch: basename29(path104) }
43327
+ { path: path105, branch: basename29(path105) }
43243
43328
  ]);
43244
43329
  continue;
43245
43330
  }
43246
- if (accounted.has(path104)) continue;
43247
- await recoverOrphan(sessions, spawnWith, { path: path104, clone }, notify2);
43331
+ if (accounted.has(path105)) continue;
43332
+ await recoverOrphan(sessions, spawnWith, { path: path105, clone }, notify2);
43248
43333
  }
43249
43334
  for (const [clone, paths] of vanished)
43250
43335
  await reclaimVanishedWorktrees(clone, paths);
@@ -45322,12 +45407,12 @@ function handleSetStatus(client, m, d) {
45322
45407
  import * as fs56 from "fs";
45323
45408
 
45324
45409
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
45325
- import * as path103 from "path";
45410
+ import * as path104 from "path";
45326
45411
  async function findCodexRolloutPath(sessionId) {
45327
45412
  if (!sessionId) return null;
45328
45413
  const paths = await discoverCodexRolloutPaths();
45329
45414
  const suffix = `-${sessionId}.jsonl`;
45330
- return paths.find((file) => path103.basename(file).endsWith(suffix)) ?? null;
45415
+ return paths.find((file) => path104.basename(file).endsWith(suffix)) ?? null;
45331
45416
  }
45332
45417
 
45333
45418
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -45910,13 +45995,13 @@ function describePeerError(error) {
45910
45995
  const cause = error.cause;
45911
45996
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
45912
45997
  }
45913
- async function fetchPeerJson(baseUrl, path104, timeoutMs = PEER_TIMEOUT_MS) {
45914
- const res = await fetch(new URL(path104, baseUrl), {
45998
+ async function fetchPeerJson(baseUrl, path105, timeoutMs = PEER_TIMEOUT_MS) {
45999
+ const res = await fetch(new URL(path105, baseUrl), {
45915
46000
  signal: AbortSignal.timeout(timeoutMs)
45916
46001
  });
45917
46002
  if (!res.ok)
45918
46003
  throw Object.assign(
45919
- new Error(`GET ${path104} returned ${res.status} ${res.statusText}`),
46004
+ new Error(`GET ${path105} returned ${res.status} ${res.statusText}`),
45920
46005
  { status: res.status }
45921
46006
  );
45922
46007
  return await res.json();
@@ -46229,7 +46314,7 @@ async function probeSshAgent(alias) {
46229
46314
  }
46230
46315
 
46231
46316
  // src/commands/sessions/nodes/printReport.ts
46232
- import chalk250 from "chalk";
46317
+ import chalk251 from "chalk";
46233
46318
  function printReport(report2) {
46234
46319
  if (report2.links.length === 0) {
46235
46320
  console.log(`${report2.local} has no links`);
@@ -46243,11 +46328,11 @@ function printReport(report2) {
46243
46328
  for (const diagnosis of report2.links) printDiagnosis(diagnosis);
46244
46329
  }
46245
46330
  function printDiagnosis(diagnosis) {
46246
- console.log(`${chalk250.bold(diagnosis.name)} ${chalk250.dim(diagnosis.url)}`);
46331
+ console.log(`${chalk251.bold(diagnosis.name)} ${chalk251.dim(diagnosis.url)}`);
46247
46332
  for (const hop of diagnosis.hops) {
46248
- const mark = hop.ok ? chalk250.green("\u2713") : chalk250.red("\u2717");
46333
+ const mark = hop.ok ? chalk251.green("\u2713") : chalk251.red("\u2717");
46249
46334
  console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
46250
- if (hop.remediation) console.log(` ${chalk250.yellow(hop.remediation)}`);
46335
+ if (hop.remediation) console.log(` ${chalk251.yellow(hop.remediation)}`);
46251
46336
  }
46252
46337
  }
46253
46338
 
@@ -46280,14 +46365,14 @@ async function doctorNodes(name, options2) {
46280
46365
  }
46281
46366
 
46282
46367
  // src/commands/sessions/nodes/linkNode.ts
46283
- import chalk252 from "chalk";
46368
+ import chalk253 from "chalk";
46284
46369
 
46285
46370
  // src/commands/sessions/nodes/notifyDaemonLinks.ts
46286
- import chalk251 from "chalk";
46371
+ import chalk252 from "chalk";
46287
46372
  async function notifyDaemonLinks() {
46288
46373
  if (!await isDaemonRunning()) {
46289
46374
  console.log(
46290
- chalk251.yellow(
46375
+ chalk252.yellow(
46291
46376
  "The sessions daemon is not running; it loads the links when it starts."
46292
46377
  )
46293
46378
  );
@@ -46295,11 +46380,11 @@ async function notifyDaemonLinks() {
46295
46380
  }
46296
46381
  try {
46297
46382
  await sendToDaemonAwaitAck({ type: "reload-links" });
46298
- console.log(chalk251.dim("The sessions daemon reloaded its links."));
46383
+ console.log(chalk252.dim("The sessions daemon reloaded its links."));
46299
46384
  } catch (error) {
46300
46385
  const message3 = error instanceof Error ? error.message : String(error);
46301
46386
  console.log(
46302
- chalk251.yellow(
46387
+ chalk252.yellow(
46303
46388
  `Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
46304
46389
  )
46305
46390
  );
@@ -46359,13 +46444,13 @@ async function linkNode(name, url, options2) {
46359
46444
  const link3 = buildLink(name, url, options2, others);
46360
46445
  await writeLinks([...others, link3]);
46361
46446
  console.log(
46362
- chalk252.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46447
+ chalk253.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46363
46448
  );
46364
46449
  await notifyDaemonLinks();
46365
46450
  }
46366
46451
 
46367
46452
  // src/commands/sessions/nodes/listNodes.ts
46368
- import chalk253 from "chalk";
46453
+ import chalk254 from "chalk";
46369
46454
  async function nodesReport() {
46370
46455
  const live = await queryNodes();
46371
46456
  if (live)
@@ -46382,10 +46467,10 @@ async function listNodes(options2) {
46382
46467
  console.log(JSON.stringify(report2, null, 2));
46383
46468
  return;
46384
46469
  }
46385
- console.log(`${report2.local} ${chalk253.dim("(this node)")}`);
46470
+ console.log(`${report2.local} ${chalk254.dim("(this node)")}`);
46386
46471
  if (!report2.daemonRunning)
46387
- console.log(chalk253.dim(" daemon not running; showing configured links"));
46388
- if (report2.links.length === 0) console.log(chalk253.dim(" no links"));
46472
+ console.log(chalk254.dim(" daemon not running; showing configured links"));
46473
+ if (report2.links.length === 0) console.log(chalk254.dim(" no links"));
46389
46474
  for (const link3 of report2.links) console.log(formatLink(link3));
46390
46475
  }
46391
46476
 
@@ -46424,16 +46509,16 @@ async function nodeLogs(name, options2) {
46424
46509
  }
46425
46510
 
46426
46511
  // src/commands/sessions/nodes/unlinkNode.ts
46427
- import chalk254 from "chalk";
46512
+ import chalk255 from "chalk";
46428
46513
  async function unlinkNode(name) {
46429
46514
  const links2 = readLinks();
46430
46515
  const remaining = links2.filter((link3) => link3.name !== name);
46431
46516
  if (remaining.length === links2.length) {
46432
- console.log(chalk254.yellow(`No link named ${name}`));
46517
+ console.log(chalk255.yellow(`No link named ${name}`));
46433
46518
  return;
46434
46519
  }
46435
46520
  await writeLinks(remaining);
46436
- console.log(chalk254.green(`Unlinked ${name}`));
46521
+ console.log(chalk255.green(`Unlinked ${name}`));
46437
46522
  await notifyDaemonLinks();
46438
46523
  }
46439
46524
 
@@ -46572,7 +46657,7 @@ async function renameSession(title) {
46572
46657
 
46573
46658
  // src/commands/sessions/summarise.ts
46574
46659
  import * as fs58 from "fs";
46575
- import chalk255 from "chalk";
46660
+ import chalk256 from "chalk";
46576
46661
 
46577
46662
  // src/commands/sessions/summarise/shared.ts
46578
46663
  import * as fs57 from "fs";
@@ -46631,22 +46716,22 @@ ${firstMessage}`);
46631
46716
  async function summarise2(options2) {
46632
46717
  const files = await discoverSessionFiles();
46633
46718
  if (files.length === 0) {
46634
- console.log(chalk255.yellow("No sessions found."));
46719
+ console.log(chalk256.yellow("No sessions found."));
46635
46720
  return;
46636
46721
  }
46637
46722
  const toProcess = selectCandidates(files, options2);
46638
46723
  if (toProcess.length === 0) {
46639
- console.log(chalk255.green("All sessions already summarised."));
46724
+ console.log(chalk256.green("All sessions already summarised."));
46640
46725
  return;
46641
46726
  }
46642
46727
  console.log(
46643
- chalk255.cyan(
46728
+ chalk256.cyan(
46644
46729
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
46645
46730
  )
46646
46731
  );
46647
46732
  const { succeeded, failed: failed3 } = processSessions(toProcess);
46648
46733
  console.log(
46649
- chalk255.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk255.yellow(`, ${failed3} skipped`) : "")
46734
+ chalk256.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk256.yellow(`, ${failed3} skipped`) : "")
46650
46735
  );
46651
46736
  }
46652
46737
  function selectCandidates(files, options2) {
@@ -46666,16 +46751,16 @@ function processSessions(files) {
46666
46751
  let failed3 = 0;
46667
46752
  for (let i = 0; i < files.length; i++) {
46668
46753
  const file = files[i];
46669
- process.stdout.write(chalk255.dim(` [${i + 1}/${files.length}] `));
46754
+ process.stdout.write(chalk256.dim(` [${i + 1}/${files.length}] `));
46670
46755
  const summary = summariseSession(file);
46671
46756
  if (summary) {
46672
46757
  writeSummary(file, summary);
46673
46758
  succeeded++;
46674
- process.stdout.write(`${chalk255.green("\u2713")} ${summary}
46759
+ process.stdout.write(`${chalk256.green("\u2713")} ${summary}
46675
46760
  `);
46676
46761
  } else {
46677
46762
  failed3++;
46678
- process.stdout.write(` ${chalk255.yellow("skip")}
46763
+ process.stdout.write(` ${chalk256.yellow("skip")}
46679
46764
  `);
46680
46765
  }
46681
46766
  }
@@ -46704,10 +46789,10 @@ function registerSessions(program2) {
46704
46789
  }
46705
46790
 
46706
46791
  // src/reportCliError.ts
46707
- import chalk256 from "chalk";
46792
+ import chalk257 from "chalk";
46708
46793
  function reportCliError(error) {
46709
46794
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
46710
- console.error(chalk256.red(error.message));
46795
+ console.error(chalk257.red(error.message));
46711
46796
  } else {
46712
46797
  console.error(error);
46713
46798
  }