@staff0rd/assist 0.718.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.718.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(path103) {
300
- return path103.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(path103) {
350
+ function isFile(path105) {
351
351
  try {
352
- return statSync(path103).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(path103) {
371
+ function readTrimmed(path105) {
372
372
  try {
373
- const content = readFileSync2(path103, "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(path103) {
387
- if (!existsSync3(path103)) return {};
386
+ function loadRawYaml(path105) {
387
+ if (!existsSync3(path105)) return {};
388
388
  try {
389
- const content = readFileSync3(path103, "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 path103 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path103.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 path103 = kind === "branch" ? "tree" : "commit";
4323
- return `https://github.com/${repo.org}/${repo.repo}/${path103}/${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 path103 = join19(dir, ".assist", name);
4485
- if (existsSync20(path103)) {
4486
- renameSync(path103, `${path103}.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(path103) {
4971
- const content = readFileSync13(path103, "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 path103 = origin.slice(firstSlash + 1);
5518
- if (!path103) return null;
5519
- return `git@${host}:${path103}.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 path103 = daemonPaths.hooksSettings;
7158
- mkdirSync5(dirname15(path103), { recursive: true });
7159
- writeFileSync16(path103, JSON.stringify(hooksSettings, null, 2));
7160
- return path103;
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 path103 = getOwnerPath(itemId2);
7917
- mkdirSync7(dirname16(path103), { recursive: true });
7918
- writeFileSync18(path103, 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 path103 = getOwnerPath(itemId2);
7922
- if (!existsSync26(path103)) return void 0;
7922
+ const path105 = getOwnerPath(itemId2);
7923
+ if (!existsSync26(path105)) return void 0;
7923
7924
  try {
7924
- const parsed = JSON.parse(readFileSync17(path103, "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 path103 = getOwnerPath(itemId2);
7932
+ const path105 = getOwnerPath(itemId2);
7932
7933
  try {
7933
- rmSync(path103);
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 path103 = getSignalPath(target);
7971
- if (!path103) return;
7971
+ const path105 = getSignalPath(target);
7972
+ if (!path105) return;
7972
7973
  const signal = { event, sessionId: target, ...data };
7973
- mkdirSync8(dirname17(path103), { recursive: true });
7974
- writeFileSync19(path103, 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 path103 = getSignalPath();
7980
- if (!path103 || !existsSync27(path103)) return void 0;
7980
+ const path105 = getSignalPath();
7981
+ if (!path105 || !existsSync27(path105)) return void 0;
7981
7982
  try {
7982
- return JSON.parse(readFileSync18(path103, "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 path103 = activityPath(sessionId);
8181
- mkdirSync9(dirname18(path103), { recursive: true });
8182
- writeFileSync20(path103, 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(path103) {
8185
+ function readActivity(path105) {
8185
8186
  try {
8186
- return JSON.parse(readFileSync19(path103, "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 path103 = activityPath(sessionId);
8197
- mkdirSync9(dirname18(path103), { recursive: true });
8198
- writeFileSync20(path103, 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 path103 = getStorePath(filename);
10824
- if (existsSync32(path103)) {
10824
+ const path105 = getStorePath(filename);
10825
+ if (existsSync32(path105)) {
10825
10826
  try {
10826
- return JSON.parse(readFileSync20(path103, "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(([path103, record]) => ({ path: path103, ...record }));
10846
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path105, record]) => ({ path: path105, ...record }));
10846
10847
  }
10847
- function worktreeAttributionIncludingReaped(path103) {
10848
- const record = loadJson(REGISTRY_FILE)[path103];
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(path103, clone, origin) {
10852
+ function recordWorktree(path105, clone, origin) {
10852
10853
  const data = loadJson(REGISTRY_FILE);
10853
- data[path103] = { clone, origin };
10854
+ data[path105] = { clone, origin };
10854
10855
  saveJson(REGISTRY_FILE, data);
10855
10856
  }
10856
- function forgetWorktree(path103) {
10857
+ function forgetWorktree(path105) {
10857
10858
  const data = loadJson(REGISTRY_FILE);
10858
- const record = data[path103];
10859
+ const record = data[path105];
10859
10860
  if (!record || record.reaped) return;
10860
- data[path103] = { ...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(path103, lines2) {
11471
+ function readLogTail(path105, lines2) {
11471
11472
  let fd;
11472
11473
  try {
11473
- fd = openSync4(path103, "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 path103 of resolved.paths) {
11739
- if (!bases.has(path103)) bases.set(path103, 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 [path103, base] of bases) {
11758
+ for (const [path105, base] of bases) {
11758
11759
  const paths = groups.get(base);
11759
- if (paths) paths.push(path103);
11760
- else groups.set(base, [path103]);
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((path103) => path103 && !bases.has(path103)).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, path103) {
11776
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path103], {
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((path103) => untrackedFileDiff(cwd, path103))
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, path103) {
11883
+ function resolveWithinCwd(cwd, path105) {
11883
11884
  const root2 = repoRoot(cwd);
11884
- const target = resolve10(root2, path103);
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, path103) {
11891
11892
  function getFileTarget(req, res) {
11892
11893
  const cwd = getCwdParam(req, res);
11893
11894
  if (!cwd) return null;
11894
- const path103 = 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 (!path103) {
11898
+ if (!path105) {
11898
11899
  respondJson(res, 400, { error: "Missing path" });
11899
11900
  return null;
11900
11901
  }
11901
- const target = resolveWithinCwd(cwd, path103);
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(path103) {
11961
+ function formatConfigPath(path105) {
11961
11962
  let text18 = "";
11962
- for (const segment of path103) {
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, path103) {
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: path103,
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(path103) {
12184
- if (path103 === getGlobalConfigPath()) return "~/.assist.yml";
12185
- if (path103.startsWith(WINDOWS_MOUNT_PREFIX))
12186
- return `${path103} on the Windows host`;
12187
- return path103;
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, path103, 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, [...path103, name], childNode(name), map)
12250
+ walk(child, [...path105, name], childNode(name), map)
12250
12251
  ])
12251
12252
  );
12252
12253
  }
12253
- function mapItems(value, path103, 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, [...path103, index3], item, map));
12256
+ return value.map((entry, index3) => walk(entry, [...path105, index3], item, map));
12256
12257
  }
12257
- function walk(value, path103, 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, path103);
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
- path103,
12266
+ path105,
12266
12267
  (name) => configNodeField(node, name),
12267
12268
  map
12268
12269
  );
12269
12270
  case "objectList":
12270
- return mapItems(value, path103, node.item, map);
12271
+ return mapItems(value, path105, node.item, map);
12271
12272
  case "record":
12272
- return mapChildren(value, path103, () => 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, path103) {
12298
+ function getNestedValue(obj, path105) {
12298
12299
  let current = obj;
12299
- for (const key of path103.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, path103) {
12350
+ function findConfigNode(root2, path105) {
12350
12351
  let current = root2;
12351
- for (const segment of path103) {
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 path103 = [];
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
- path103.push(segment);
12376
+ path105.push(segment);
12376
12377
  at2 = close + 1;
12377
12378
  continue;
12378
12379
  }
12379
12380
  if (text18[at2] === ".") {
12380
- if (path103.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
- path103.push(nameSegment(name));
12388
+ path105.push(nameSegment(name));
12388
12389
  }
12389
- return path103;
12390
+ return path105;
12390
12391
  }
12391
12392
 
12392
12393
  // src/commands/config/configEntryNode.ts
12393
12394
  function configEntryNode(root2, key) {
12394
- const path103 = parseConfigPath(key);
12395
- return path103 ? findConfigNode(root2, path103) : 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((path103) => existsSync34(path103)).map((path103) => ({ path: path103, mtime: statSync5(path103).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 path103 = await resolveSynthesisPath(cwd);
13165
- if (!path103) {
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(path103, "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 path103 = fields[fields.length - 1];
13253
- if (path103) result[category].push(path103);
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(path103, query) {
13469
+ function scoreFilePath(path105, query) {
13464
13470
  const needle = query.trim().toLowerCase();
13465
13471
  if (!needle) return 0;
13466
- const basename30 = path103.slice(path103.lastIndexOf("/") + 1);
13467
- const inBasename = subsequenceScore(basename30, needle);
13472
+ const basename31 = path105.slice(path105.lastIndexOf("/") + 1);
13473
+ const inBasename = subsequenceScore(basename31, needle);
13468
13474
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13469
- return subsequenceScore(path103, 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 path103 of paths) {
13476
- const score = scoreFilePath(path103, query);
13477
- if (score !== null) scored.push({ path: path103, 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 path103 = 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(path103, res.statusCode)) return;
14195
+ if (isQuietPoll(path105, res.statusCode)) return;
14190
14196
  console.log(
14191
- `link-from ${from} http: ${req.method} ${path103} 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 path103 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14580
- const response = await ghJson(cwd, ["api", path103]);
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, path103) {
14867
+ async function isTracked(cwd, path105) {
14862
14868
  try {
14863
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path103]);
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, path103) {
14870
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path103]);
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, path103) {
14874
- if (!await isTracked(cwd, path103)) {
14875
- await execGit(cwd, ["clean", "-f", "--", path103]);
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, path103)) {
14879
- await execGit(cwd, ["checkout", "HEAD", "--", path103]);
14884
+ if (await isInHead(cwd, path105)) {
14885
+ await execGit(cwd, ["checkout", "HEAD", "--", path105]);
14880
14886
  return;
14881
14887
  }
14882
- await execGit(cwd, ["rm", "-f", "--", path103]);
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 path103 = relative3(repoRoot(resolved.cwd), resolved.target);
14895
+ const path105 = relative3(repoRoot(resolved.cwd), resolved.target);
14890
14896
  try {
14891
- await revertPathChanges(resolved.cwd, path103);
14892
- respondJson(res, 200, { reverted: path103 });
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((path103) => typeof path103 !== "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 path103 of paths) {
15018
- const target = resolveWithinCwd(cwd, path103);
15023
+ for (const path105 of paths) {
15024
+ const target = resolveWithinCwd(cwd, path105);
15019
15025
  if (!target) {
15020
- failed3.push({ path: path103, 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 path103 = formatConfigPath([
15125
+ const path105 = formatConfigPath([
15120
15126
  { kind: "key", name: key },
15121
15127
  ...issue.path.map(toSegment)
15122
15128
  ]);
15123
- return `${path103}: ${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, path103) {
15224
+ function valueAtConfigPath(value, path105) {
15219
15225
  let current = value;
15220
- for (const key of path103) {
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, path103) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path103) : 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, path103, value) {
15287
- const keys = path103.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 path103 = issue.path.length > 0 ? issue.path.join(".") : key;
15315
- return [`${path103}: ${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, path103) {
15558
- const { container, removed } = removeAt(obj, path103.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(path103) {
17048
- const pattern2 = path103.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((path103) => ({
17052
- path: path103,
17053
- regex: restrictedPathRegex(path103)
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(path103) {
17231
- if (!existsSync40(path103)) return [];
17232
- return readFileSync25(path103, "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, path103, description, depth, p) {
17765
- showProgress(p, path103.join(" "));
17766
- const subHelp = await runHelp([cli, ...path103]);
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: path103, description }];
17774
+ return [{ path: path105, description }];
17769
17775
  }
17770
- const children = await discoverAt(cli, path103, depth + 1, p);
17771
- return children.length > 0 ? children : [{ path: path103, 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 path103 = logPath(cli);
17920
- if (!existsSync42(path103)) return void 0;
17921
- return readFileSync27(path103, "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 path103 = join45(dir, entry);
18116
+ const path105 = join45(dir, entry);
18111
18117
  try {
18112
- if (statSync7(path103).mtimeMs < cutoff) unlinkSync7(path103);
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 path103 = getPinStatePath(pin2);
18123
- if (!existsSync43(path103)) return void 0;
18128
+ const path105 = getPinStatePath(pin2);
18129
+ if (!existsSync43(path105)) return void 0;
18124
18130
  try {
18125
- const state = JSON.parse(readFileSync28(path103, "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 path103 = line.split(" ")[1];
18547
- if (path103) found.add(path103.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 path103 = 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 ${path103}`));
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 path103 = 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 ${path103}`));
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 path103 = getMigrationPinPath(pin2);
20025
- if (!existsSync48(path103)) return void 0;
20030
+ const path105 = getMigrationPinPath(pin2);
20031
+ if (!existsSync48(path105)) return void 0;
20026
20032
  try {
20027
- const state = JSON.parse(readFileSync30(path103, "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 path103 = getMigrationApprovalPath(migrationId);
21938
- if (!existsSync54(path103)) return false;
21943
+ const path105 = getMigrationApprovalPath(migrationId);
21944
+ if (!existsSync54(path105)) return false;
21939
21945
  try {
21940
- unlinkSync11(path103);
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(path103) {
24350
+ function canonicalTreePath(path105) {
24345
24351
  try {
24346
- return realpathSync2(path103);
24352
+ return realpathSync2(path105);
24347
24353
  } catch {
24348
- return resolve15(path103);
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 path103 = 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(path103),
24409
- path103,
24414
+ basename17(path105),
24415
+ path105,
24410
24416
  start3.ref
24411
24417
  ]);
24412
- recordWorktree(path103, clone, getCurrentOrigin(clone));
24418
+ recordWorktree(path105, clone, getCurrentOrigin(clone));
24413
24419
  daemonLog(
24414
- start3.track ? `worktree allocated ${path103} (branch ${basename17(path103)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path103} (branch ${basename17(path103)} 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 path103;
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 path103 = 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: path103, 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 path103 = 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
- path103 = trimmed.slice("worktree ".length).trim();
24923
+ path105 = trimmed.slice("worktree ".length).trim();
24918
24924
  else if (trimmed === `branch refs/heads/${branch2}`)
24919
- return path103 && path103 !== here ? path103 : 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, ...path103] = 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 path103) {
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(path103, 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 ${path103}:${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: path103, line, startLine });
26787
- console.log(`Added review comment on ${path103}:${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 (path103, line, body) => {
27362
+ ).action(async (path105, line, body) => {
27357
27363
  await comment2(
27358
- path103,
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(path103) {
28585
+ function readDraftFile(path105) {
28580
28586
  try {
28581
- return readFileSync44(path103, "utf8");
28587
+ return readFileSync44(path105, "utf8");
28582
28588
  } catch {
28583
- console.error(`Error: Could not read \`${path103}\`.`);
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, path103) {
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}${path103}`;
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 path103;
28962
+ let path105;
28957
28963
  if (opts.collection) {
28958
- path103 = `/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
- path103 = `/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
- path103 += `&query=${encodeURIComponent(opts.query)}`;
28969
+ path105 += `&query=${encodeURIComponent(opts.query)}`;
28964
28970
  }
28965
- return path103;
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 path103 = 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, path103);
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(path103) {
32410
- return path103.slice(path103.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 path103 = 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
- path103 = `${path103}/${childName}`;
32523
+ path105 = `${path105}/${childName}`;
32439
32524
  node = child;
32440
32525
  }
32441
- const children = nodesOf(node, path103);
32526
+ const children = nodesOf(node, path105);
32442
32527
  return {
32443
32528
  kind: "dir",
32444
32529
  name: label2,
32445
- path: path103,
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, path103) {
32704
- const anchor = createHash3("sha256").update(path103).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 path103 = highLevelReviewPath(repo, headRef, headSha);
32761
- if (!existsSync64(path103)) 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(path103, "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: path103, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32775
- path: path103,
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 path103 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32891
- mkdirSync22(dirname36(path103), { recursive: true });
32892
- writeFileSync39(path103, `${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 path103;
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 path103 = saveHighLevelReview(record);
32998
+ const path105 = saveHighLevelReview(record);
32914
32999
  console.log(`Verdict: ${record.verdict}`);
32915
- console.log(`Saved ${path103}`);
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 path103 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33931
- if (existsSync65(path103)) unlinkSync18(path103);
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, path103, params) {
35462
- const url = `${conn.url}${path103}?${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, path103, 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
- (path103, index3) => console.log(`${index3 + 1}/${paths.length} ${path103}`)
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 {
@@ -36181,17 +36266,16 @@ function registerSql(program2) {
36181
36266
  }
36182
36267
 
36183
36268
  // src/commands/sync.ts
36184
- import * as fs47 from "fs";
36185
36269
  import * as os5 from "os";
36186
- import * as path96 from "path";
36270
+ import * as path98 from "path";
36187
36271
  import { fileURLToPath as fileURLToPath8 } from "url";
36188
36272
 
36189
36273
  // src/commands/sync/pruneCommands.ts
36190
- import * as path87 from "path";
36274
+ import * as path88 from "path";
36191
36275
 
36192
36276
  // src/commands/sync/pruneTarget.ts
36193
36277
  import * as fs39 from "fs";
36194
- import * as path86 from "path";
36278
+ import * as path87 from "path";
36195
36279
  function pruneTarget(targetDir, keepNames, shape, options2) {
36196
36280
  const result = {
36197
36281
  orphans: [],
@@ -36209,7 +36293,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
36209
36293
  }
36210
36294
  if (keep.has(name)) continue;
36211
36295
  result.orphans.push(entry.name);
36212
- const entryPath = path86.join(targetDir, entry.name);
36296
+ const entryPath = path87.join(targetDir, entry.name);
36213
36297
  const reason4 = shape.blockedBy?.(entryPath);
36214
36298
  if (reason4) {
36215
36299
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -36229,7 +36313,7 @@ function pruneCommands(targetDir, commandNames, options2) {
36229
36313
  targetDir,
36230
36314
  commandNames,
36231
36315
  {
36232
- 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
36233
36317
  },
36234
36318
  options2
36235
36319
  );
@@ -36262,52 +36346,36 @@ function reportPrune(label2, result, force) {
36262
36346
  }
36263
36347
  }
36264
36348
 
36265
- // src/commands/sync/reportRetiredAgentsFiles.ts
36266
- import * as fs40 from "fs";
36267
- import * as path88 from "path";
36268
- var retired = [
36269
- path88.join(harnesses.claude.homeDir, "CLAUDE.md"),
36270
- path88.join(harnesses.codex.homeDir, "AGENTS.md"),
36271
- path88.join(harnesses.pi.homeDir, "AGENTS.md")
36272
- ];
36273
- function reportRetiredAgentsFiles() {
36274
- const leftovers = retired.filter((file) => fs40.existsSync(file));
36275
- if (leftovers.length === 0) return;
36276
- console.log(
36277
- "No longer written by sync \u2014 each harness now composes its own advice at session start:"
36278
- );
36279
- for (const file of leftovers) console.log(` ${file}`);
36280
- console.log(
36281
- " Delete them, or they keep injecting the retired global instructions."
36282
- );
36283
- }
36349
+ // src/commands/sync/syncClaudeCommands.ts
36350
+ import * as fs43 from "fs";
36351
+ import * as path92 from "path";
36284
36352
 
36285
36353
  // src/commands/sync/syncCodex.ts
36286
36354
  import * as path91 from "path";
36287
36355
 
36288
36356
  // src/commands/sync/installHarnessCommands.ts
36289
- import * as fs41 from "fs";
36357
+ import * as fs40 from "fs";
36290
36358
  import * as path89 from "path";
36291
36359
  function installHarnessCommands(claudeDir, harness, transform) {
36292
36360
  const commandsSource = path89.join(claudeDir, "commands");
36293
- const files = fs41.readdirSync(commandsSource);
36361
+ const files = fs40.readdirSync(commandsSource);
36294
36362
  const names = [];
36295
36363
  let synced = 0;
36296
36364
  for (const file of files) {
36297
36365
  if (!file.endsWith(".md")) continue;
36298
36366
  const name = file.replace(/\.md$/, "");
36299
36367
  names.push(name);
36300
- const content = fs41.readFileSync(path89.join(commandsSource, file), "utf8");
36368
+ const content = fs40.readFileSync(path89.join(commandsSource, file), "utf8");
36301
36369
  const target = path89.join(harness.homeDir, harness.sync.commandDest(name));
36302
- fs41.mkdirSync(path89.dirname(target), { recursive: true });
36303
- fs41.writeFileSync(target, transform(name, content));
36370
+ fs40.mkdirSync(path89.dirname(target), { recursive: true });
36371
+ fs40.writeFileSync(target, transform(name, content));
36304
36372
  synced++;
36305
36373
  }
36306
36374
  return { total: files.length, synced, names };
36307
36375
  }
36308
36376
 
36309
36377
  // src/commands/sync/pruneSkills.ts
36310
- import * as fs42 from "fs";
36378
+ import * as fs41 from "fs";
36311
36379
  function pruneSkills(targetDir, skillNames, options2) {
36312
36380
  return pruneTarget(
36313
36381
  targetDir,
@@ -36320,14 +36388,14 @@ function pruneSkills(targetDir, skillNames, options2) {
36320
36388
  );
36321
36389
  }
36322
36390
  function unexpectedContent(skillDir) {
36323
- const entries = fs42.readdirSync(skillDir);
36391
+ const entries = fs41.readdirSync(skillDir);
36324
36392
  const others = entries.filter((entry) => entry !== "SKILL.md");
36325
36393
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
36326
36394
  return entries.length === 0 ? "no SKILL.md" : void 0;
36327
36395
  }
36328
36396
 
36329
36397
  // src/commands/sync/syncCodexHooks.ts
36330
- import * as fs43 from "fs";
36398
+ import * as fs42 from "fs";
36331
36399
  import * as path90 from "path";
36332
36400
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36333
36401
  var END = "# <<< assist codex hooks (managed) <<<";
@@ -36358,11 +36426,11 @@ ${rest}
36358
36426
  `;
36359
36427
  }
36360
36428
  function syncCodexHooks(sourcePath) {
36361
- const body = fs43.readFileSync(sourcePath, "utf8");
36429
+ const body = fs42.readFileSync(sourcePath, "utf8");
36362
36430
  const configPath = path90.join(harnesses.codex.homeDir, "config.toml");
36363
- const existing = fs43.existsSync(configPath) ? fs43.readFileSync(configPath, "utf8") : "";
36364
- fs43.mkdirSync(path90.dirname(configPath), { recursive: true });
36365
- fs43.writeFileSync(configPath, upsertManagedBlock(existing, body));
36431
+ const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
36432
+ fs42.mkdirSync(path90.dirname(configPath), { recursive: true });
36433
+ fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
36366
36434
  console.log(
36367
36435
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
36368
36436
  );
@@ -36404,46 +36472,106 @@ function syncCodex(claudeDir, options2) {
36404
36472
  );
36405
36473
  }
36406
36474
 
36407
- // src/commands/sync/syncDesign.ts
36475
+ // src/commands/sync/syncClaudeCommands.ts
36476
+ function isSkillFlagged(content) {
36477
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
36478
+ return match ? /^skill:\s*true\s*$/m.test(match[1]) : false;
36479
+ }
36480
+ function replaceFileWithoutFollowingSymlink(file, content) {
36481
+ fs43.rmSync(file, { force: true });
36482
+ fs43.writeFileSync(file, content);
36483
+ }
36484
+ function writeSkill(targetBase, name, content) {
36485
+ const skillDir = path92.join(targetBase, "skills", name);
36486
+ fs43.mkdirSync(skillDir, { recursive: true });
36487
+ replaceFileWithoutFollowingSymlink(
36488
+ path92.join(skillDir, "SKILL.md"),
36489
+ commandToSkill(name, content)
36490
+ );
36491
+ fs43.rmSync(path92.join(targetBase, "commands", `${name}.md`), { force: true });
36492
+ console.log(`Wrote ${name} as a skill to ${skillDir}`);
36493
+ }
36494
+ function syncClaudeCommands(claudeDir, targetBase) {
36495
+ const sourceDir = path92.join(claudeDir, "commands");
36496
+ const targetDir = path92.join(targetBase, "commands");
36497
+ fs43.mkdirSync(targetDir, { recursive: true });
36498
+ const files = fs43.readdirSync(sourceDir);
36499
+ for (const file of files) {
36500
+ const source = path92.join(sourceDir, file);
36501
+ if (file.endsWith(".md")) {
36502
+ const content = fs43.readFileSync(source, "utf8");
36503
+ if (isSkillFlagged(content)) {
36504
+ writeSkill(targetBase, path92.basename(file, ".md"), content);
36505
+ continue;
36506
+ }
36507
+ }
36508
+ fs43.copyFileSync(source, path92.join(targetDir, file));
36509
+ console.log(`Copied ${file} to ${targetDir}`);
36510
+ }
36511
+ console.log(`Synced ${files.length} command(s) to ~/.claude`);
36512
+ return files;
36513
+ }
36514
+
36515
+ // src/commands/sync/reportRetiredAgentsFiles.ts
36408
36516
  import * as fs44 from "fs";
36409
- import * as path92 from "path";
36517
+ import * as path93 from "path";
36518
+ var retired = [
36519
+ path93.join(harnesses.claude.homeDir, "CLAUDE.md"),
36520
+ path93.join(harnesses.codex.homeDir, "AGENTS.md"),
36521
+ path93.join(harnesses.pi.homeDir, "AGENTS.md")
36522
+ ];
36523
+ function reportRetiredAgentsFiles() {
36524
+ const leftovers = retired.filter((file) => fs44.existsSync(file));
36525
+ if (leftovers.length === 0) return;
36526
+ console.log(
36527
+ "No longer written by sync \u2014 each harness now composes its own advice at session start:"
36528
+ );
36529
+ for (const file of leftovers) console.log(` ${file}`);
36530
+ console.log(
36531
+ " Delete them, or they keep injecting the retired global instructions."
36532
+ );
36533
+ }
36534
+
36535
+ // src/commands/sync/syncDesign.ts
36536
+ import * as fs45 from "fs";
36537
+ import * as path94 from "path";
36410
36538
  function syncDesign(claudeDir, targetBase) {
36411
- const systemPromptSource = path92.join(claudeDir, "design-system-prompt.md");
36412
- const systemPromptTarget = path92.join(targetBase, "design-system-prompt.md");
36413
- fs44.copyFileSync(systemPromptSource, systemPromptTarget);
36539
+ const systemPromptSource = path94.join(claudeDir, "design-system-prompt.md");
36540
+ const systemPromptTarget = path94.join(targetBase, "design-system-prompt.md");
36541
+ fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36414
36542
  console.log(
36415
36543
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36416
36544
  );
36417
- const skillsSource = path92.join(claudeDir, "skills");
36418
- const skillsTarget = path92.join(targetBase, "skills");
36419
- fs44.mkdirSync(skillsTarget, { recursive: true });
36420
- const files = fs44.readdirSync(skillsSource);
36545
+ const skillsSource = path94.join(claudeDir, "skills");
36546
+ const skillsTarget = path94.join(targetBase, "skills");
36547
+ fs45.mkdirSync(skillsTarget, { recursive: true });
36548
+ const files = fs45.readdirSync(skillsSource);
36421
36549
  for (const file of files) {
36422
- fs44.copyFileSync(
36423
- path92.join(skillsSource, file),
36424
- path92.join(skillsTarget, file)
36550
+ fs45.copyFileSync(
36551
+ path94.join(skillsSource, file),
36552
+ path94.join(skillsTarget, file)
36425
36553
  );
36426
36554
  }
36427
36555
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36428
36556
  }
36429
36557
 
36430
36558
  // src/commands/sync/syncPi.ts
36431
- import * as path94 from "path";
36559
+ import * as path96 from "path";
36432
36560
 
36433
36561
  // src/commands/sync/syncPiHooks.ts
36434
- import * as fs45 from "fs";
36435
- import * as path93 from "path";
36562
+ import * as fs46 from "fs";
36563
+ import * as path95 from "path";
36436
36564
  function piExtensionsDir() {
36437
- return path93.join(harnesses.pi.homeDir, "extensions");
36565
+ return path95.join(harnesses.pi.homeDir, "extensions");
36438
36566
  }
36439
36567
  function syncPiHooks(sourceDir) {
36440
36568
  const target = piExtensionsDir();
36441
- fs45.mkdirSync(target, { recursive: true });
36442
- const files = fs45.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36569
+ fs46.mkdirSync(target, { recursive: true });
36570
+ const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36443
36571
  for (const file of files) {
36444
- fs45.copyFileSync(
36445
- path93.join(sourceDir, file),
36446
- path93.join(target, `assist-${file}`)
36572
+ fs46.copyFileSync(
36573
+ path95.join(sourceDir, file),
36574
+ path95.join(target, `assist-${file}`)
36447
36575
  );
36448
36576
  }
36449
36577
  console.log(
@@ -36480,28 +36608,28 @@ function syncPi(claudeDir, options2) {
36480
36608
  harnesses.pi,
36481
36609
  commandToPrompt
36482
36610
  );
36483
- syncPiHooks(path94.join(claudeDir, "..", "pi"));
36611
+ syncPiHooks(path96.join(claudeDir, "..", "pi"));
36484
36612
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36485
36613
  if (!options2?.prune) return;
36486
36614
  const force = options2.force ?? false;
36487
36615
  reportPrune(
36488
36616
  "~/.pi/agent/prompts",
36489
- pruneCommands(path94.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36617
+ pruneCommands(path96.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36490
36618
  force
36491
36619
  );
36492
36620
  }
36493
36621
 
36494
36622
  // src/commands/sync/syncSettings.ts
36495
- import * as fs46 from "fs";
36496
- import * as path95 from "path";
36497
- import chalk247 from "chalk";
36623
+ import * as fs47 from "fs";
36624
+ import * as path97 from "path";
36625
+ import chalk248 from "chalk";
36498
36626
  async function syncSettings(claudeDir, targetBase, options2) {
36499
- const source = path95.join(claudeDir, "settings.json");
36500
- const target = path95.join(targetBase, "settings.json");
36501
- const sourceContent = fs46.readFileSync(source, "utf8");
36627
+ const source = path97.join(claudeDir, "settings.json");
36628
+ const target = path97.join(targetBase, "settings.json");
36629
+ const sourceContent = fs47.readFileSync(source, "utf8");
36502
36630
  const sourceSettings = JSON.parse(sourceContent);
36503
- const targetExists = fs46.existsSync(target);
36504
- const targetContent = targetExists ? fs46.readFileSync(target, "utf8") : "";
36631
+ const targetExists = fs47.existsSync(target);
36632
+ const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
36505
36633
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
36506
36634
  const mergedContent = JSON.stringify(
36507
36635
  { ...preservedUserSettings, ...sourceSettings },
@@ -36513,7 +36641,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36513
36641
  if (mergedContent !== normalizedTarget) {
36514
36642
  if (!options2?.yes) {
36515
36643
  console.log(
36516
- chalk247.yellow(
36644
+ chalk248.yellow(
36517
36645
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
36518
36646
  )
36519
36647
  );
@@ -36521,7 +36649,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
36521
36649
  printDiff(targetContent, mergedContent);
36522
36650
  printAutoConfirmHint();
36523
36651
  const confirm = await promptConfirm(
36524
- chalk247.red("Overwrite existing settings.json?"),
36652
+ chalk248.red("Overwrite existing settings.json?"),
36525
36653
  false
36526
36654
  );
36527
36655
  if (!confirm) {
@@ -36531,46 +36659,34 @@ async function syncSettings(claudeDir, targetBase, options2) {
36531
36659
  }
36532
36660
  }
36533
36661
  }
36534
- fs46.writeFileSync(target, mergedContent);
36662
+ fs47.writeFileSync(target, mergedContent);
36535
36663
  console.log("Copied settings.json to ~/.claude/settings.json");
36536
36664
  }
36537
36665
 
36538
36666
  // src/commands/sync.ts
36539
36667
  var __filename4 = fileURLToPath8(import.meta.url);
36540
- var __dirname5 = path96.dirname(__filename4);
36668
+ var __dirname5 = path98.dirname(__filename4);
36541
36669
  async function sync(options2) {
36542
36670
  const config = loadConfig();
36543
36671
  const yes = options2?.yes ?? config.sync.autoConfirm;
36544
36672
  const prune = { prune: options2?.prune, force: options2?.force };
36545
- const claudeDir = path96.join(__dirname5, "..", "claude");
36546
- const targetBase = path96.join(os5.homedir(), ".claude");
36547
- const commandFiles = syncCommands(claudeDir, targetBase);
36673
+ const claudeDir = path98.join(__dirname5, "..", "claude");
36674
+ const targetBase = path98.join(os5.homedir(), ".claude");
36675
+ const commandFiles = syncClaudeCommands(claudeDir, targetBase);
36548
36676
  syncDesign(claudeDir, targetBase);
36549
36677
  await syncSettings(claudeDir, targetBase, { yes });
36550
36678
  syncCodex(claudeDir, prune);
36551
36679
  syncPi(claudeDir, prune);
36552
36680
  reportRetiredAgentsFiles();
36553
36681
  if (!options2?.prune) return;
36554
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path96.basename(file, ".md"));
36682
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path98.basename(file, ".md"));
36555
36683
  const force = options2.force ?? false;
36556
36684
  reportPrune(
36557
36685
  "~/.claude/commands",
36558
- pruneCommands(path96.join(targetBase, "commands"), commandNames, { force }),
36686
+ pruneCommands(path98.join(targetBase, "commands"), commandNames, { force }),
36559
36687
  force
36560
36688
  );
36561
36689
  }
36562
- function syncCommands(claudeDir, targetBase) {
36563
- const sourceDir = path96.join(claudeDir, "commands");
36564
- const targetDir = path96.join(targetBase, "commands");
36565
- fs47.mkdirSync(targetDir, { recursive: true });
36566
- const files = fs47.readdirSync(sourceDir);
36567
- for (const file of files) {
36568
- fs47.copyFileSync(path96.join(sourceDir, file), path96.join(targetDir, file));
36569
- console.log(`Copied ${file} to ${targetDir}`);
36570
- }
36571
- console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
36572
- return files;
36573
- }
36574
36690
 
36575
36691
  // src/commands/registerSync.ts
36576
36692
  function registerSync(program2) {
@@ -36843,9 +36959,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
36843
36959
  }
36844
36960
 
36845
36961
  // src/commands/transcript/convert/readCleanedCues.ts
36846
- import { readFileSync as readFileSync58 } from "fs";
36962
+ import { readFileSync as readFileSync59 } from "fs";
36847
36963
  function readCleanedCues(inputPath) {
36848
- return deduplicateCues(parseVtt(readFileSync58(inputPath, "utf8")));
36964
+ return deduplicateCues(parseVtt(readFileSync59(inputPath, "utf8")));
36849
36965
  }
36850
36966
 
36851
36967
  // src/commands/transcript/clean.ts
@@ -36955,20 +37071,20 @@ async function configure() {
36955
37071
 
36956
37072
  // src/commands/transcript/list.ts
36957
37073
  import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
36958
- import { join as join92 } from "path";
37074
+ import { join as join93 } from "path";
36959
37075
  function list3() {
36960
37076
  const { vttDir } = getTranscriptConfig();
36961
37077
  if (!existsSync76(vttDir)) return;
36962
37078
  for (const entry of readdirSync20(vttDir)) {
36963
37079
  if (!entry.endsWith(".vtt")) continue;
36964
- if (statSync12(join92(vttDir, entry)).isDirectory()) continue;
37080
+ if (statSync12(join93(vttDir, entry)).isDirectory()) continue;
36965
37081
  console.log(entry);
36966
37082
  }
36967
37083
  }
36968
37084
 
36969
37085
  // src/commands/transcript/move.ts
36970
- import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync49 } from "fs";
36971
- import { basename as basename23, join as join93 } from "path";
37086
+ import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
37087
+ import { basename as basename24, join as join94 } from "path";
36972
37088
 
36973
37089
  // src/commands/transcript/convertVttToMarkdown.ts
36974
37090
  function convertVttToMarkdown(inputPath) {
@@ -36978,9 +37094,9 @@ function convertVttToMarkdown(inputPath) {
36978
37094
  // src/commands/transcript/move.ts
36979
37095
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
36980
37096
  function archiveRawVtt(vttDir, sourcePath, filename) {
36981
- const processedDir = join93(vttDir, "processed");
37097
+ const processedDir = join94(vttDir, "processed");
36982
37098
  mkdirSync32(processedDir, { recursive: true });
36983
- renameSync2(sourcePath, join93(processedDir, filename));
37099
+ renameSync2(sourcePath, join94(processedDir, filename));
36984
37100
  }
36985
37101
  function move(file, options2) {
36986
37102
  const { date, client } = options2;
@@ -36989,27 +37105,27 @@ function move(file, options2) {
36989
37105
  process.exit(1);
36990
37106
  }
36991
37107
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
36992
- const filename = basename23(file);
36993
- const sourcePath = join93(vttDir, filename);
37108
+ const filename = basename24(file);
37109
+ const sourcePath = join94(vttDir, filename);
36994
37110
  if (!existsSync77(sourcePath)) {
36995
37111
  console.error(`Error: VTT file not found: ${sourcePath}`);
36996
37112
  process.exit(1);
36997
37113
  }
36998
- const base = basename23(filename, ".vtt").replace(/ Transcription$/, "");
37114
+ const base = basename24(filename, ".vtt").replace(/ Transcription$/, "");
36999
37115
  const outputName = `${date} ${base}.md`;
37000
- const formattedDir = join93(transcriptsDir, client);
37116
+ const formattedDir = join94(transcriptsDir, client);
37001
37117
  mkdirSync32(formattedDir, { recursive: true });
37002
- const formattedPath = join93(formattedDir, outputName);
37003
- writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
37118
+ const formattedPath = join94(formattedDir, outputName);
37119
+ writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
37004
37120
  archiveRawVtt(vttDir, sourcePath, filename);
37005
- const summaryPath = join93(summaryDir, client, outputName);
37121
+ const summaryPath = join94(summaryDir, client, outputName);
37006
37122
  console.log(`Formatted transcript: ${formattedPath}`);
37007
37123
  console.log(`Summary target: ${summaryPath}`);
37008
37124
  }
37009
37125
 
37010
37126
  // src/commands/transcript/merge.ts
37011
- import { existsSync as existsSync78, writeFileSync as writeFileSync50 } from "fs";
37012
- import { basename as basename24 } from "path";
37127
+ import { existsSync as existsSync78, writeFileSync as writeFileSync51 } from "fs";
37128
+ import { basename as basename25 } from "path";
37013
37129
 
37014
37130
  // src/commands/transcript/failTranscript.ts
37015
37131
  function failTranscript(message3) {
@@ -37155,7 +37271,7 @@ function readSource3(file) {
37155
37271
  if (!existsSync78(file)) failTranscript(`VTT file not found: ${file}`);
37156
37272
  const cues = readCleanedCues(file);
37157
37273
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
37158
- return { path: file, name: basename24(file), cues };
37274
+ return { path: file, name: basename25(file), cues };
37159
37275
  }
37160
37276
  function wholePassages(sources) {
37161
37277
  return sources.map((source) => ({
@@ -37185,7 +37301,7 @@ async function merge(files, options2 = {}) {
37185
37301
  console.log(document);
37186
37302
  return;
37187
37303
  }
37188
- writeFileSync50(options2.out, `${document}
37304
+ writeFileSync51(options2.out, `${document}
37189
37305
  `, "utf8");
37190
37306
  console.log(`Merged transcript: ${options2.out}`);
37191
37307
  }
@@ -37619,13 +37735,13 @@ function configKeys2() {
37619
37735
  }
37620
37736
 
37621
37737
  // src/commands/verify/forbiddenStrings.ts
37622
- import { existsSync as existsSync79, readFileSync as readFileSync59 } from "fs";
37738
+ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
37623
37739
 
37624
37740
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37625
37741
  import { minimatch as minimatch9 } from "minimatch";
37626
- function resolveStringsAtPath(data, path103) {
37742
+ function resolveStringsAtPath(data, path105) {
37627
37743
  let current = data;
37628
- for (const segment of path103.split(".")) {
37744
+ for (const segment of path105.split(".")) {
37629
37745
  if (current === null || typeof current !== "object") return [];
37630
37746
  current = current[segment];
37631
37747
  }
@@ -37638,10 +37754,10 @@ function resolveStringsAtPath(data, path103) {
37638
37754
  }
37639
37755
  function findRuleViolations(data, rule) {
37640
37756
  const violations = [];
37641
- for (const path103 of rule.paths) {
37642
- for (const value of resolveStringsAtPath(data, path103)) {
37757
+ for (const path105 of rule.paths) {
37758
+ for (const value of resolveStringsAtPath(data, path105)) {
37643
37759
  if (minimatch9(value, rule.disallowed))
37644
- violations.push({ file: rule.file, path: path103, value });
37760
+ violations.push({ file: rule.file, path: path105, value });
37645
37761
  }
37646
37762
  }
37647
37763
  return violations;
@@ -37666,7 +37782,7 @@ function forbiddenStrings() {
37666
37782
  }
37667
37783
  let parsed;
37668
37784
  try {
37669
- parsed = JSON.parse(readFileSync59(file, "utf8"));
37785
+ parsed = JSON.parse(readFileSync60(file, "utf8"));
37670
37786
  } catch (error) {
37671
37787
  console.log(`Could not parse ${file}: ${error.message}`);
37672
37788
  process.exit(1);
@@ -37680,8 +37796,8 @@ function forbiddenStrings() {
37680
37796
  process.exit(0);
37681
37797
  }
37682
37798
  console.log("Forbidden strings found:\n");
37683
- for (const { file, path: path103, value } of violations) {
37684
- console.log(` ${file} ${path103}: ${value}`);
37799
+ for (const { file, path: path105, value } of violations) {
37800
+ console.log(` ${file} ${path105}: ${value}`);
37685
37801
  }
37686
37802
  console.log(`
37687
37803
  Total: ${violations.length} forbidden string(s).`);
@@ -37736,8 +37852,8 @@ Total: ${lines2.length} hardcoded color(s)`);
37736
37852
  }
37737
37853
 
37738
37854
  // src/commands/verify/migrations.ts
37739
- import { readFileSync as readFileSync60 } from "fs";
37740
- import path98 from "path";
37855
+ import { readFileSync as readFileSync61 } from "fs";
37856
+ import path100 from "path";
37741
37857
 
37742
37858
  // src/commands/verify/migrations/checkAppendOnly.ts
37743
37859
  function checkAppendOnly(baseline, current) {
@@ -37816,7 +37932,7 @@ function listMigrationFiles(dir) {
37816
37932
 
37817
37933
  // src/commands/verify/migrations/readBaselineMigrations.ts
37818
37934
  import { execSync as execSync63 } from "child_process";
37819
- import { basename as basename25 } from "path";
37935
+ import { basename as basename26 } from "path";
37820
37936
  var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
37821
37937
  function readBaselineMigrations(repoRelativeDir, ref) {
37822
37938
  const baseline = /* @__PURE__ */ new Map();
@@ -37829,15 +37945,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37829
37945
  } catch {
37830
37946
  return baseline;
37831
37947
  }
37832
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path103) => MIGRATION_FILE3.test(basename25(path103)));
37833
- for (const path103 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) {
37834
37950
  try {
37835
- const content = execSync63(`git show "${ref}:${path103}"`, {
37951
+ const content = execSync63(`git show "${ref}:${path105}"`, {
37836
37952
  encoding: "utf8",
37837
37953
  maxBuffer: 16 * 1024 * 1024,
37838
37954
  stdio: ["pipe", "pipe", "pipe"]
37839
37955
  });
37840
- baseline.set(basename25(path103), content);
37956
+ baseline.set(basename26(path105), content);
37841
37957
  } catch {
37842
37958
  }
37843
37959
  }
@@ -37876,11 +37992,11 @@ function resolveBaselineRef() {
37876
37992
  }
37877
37993
 
37878
37994
  // src/commands/verify/migrations/migrationsDir.ts
37879
- import path97 from "path";
37995
+ import path99 from "path";
37880
37996
  import { fileURLToPath as fileURLToPath9 } from "url";
37881
37997
  function migrationsDir() {
37882
- return path97.resolve(
37883
- path97.dirname(fileURLToPath9(import.meta.url)),
37998
+ return path99.resolve(
37999
+ path99.dirname(fileURLToPath9(import.meta.url)),
37884
38000
  "../../../shared/db/migrations"
37885
38001
  );
37886
38002
  }
@@ -37901,7 +38017,7 @@ function migrations2() {
37901
38017
  if (ref) {
37902
38018
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
37903
38019
  const current = new Map(
37904
- files.map((file) => [file, readFileSync60(path98.join(dir, file), "utf8")])
38020
+ files.map((file) => [file, readFileSync61(path100.join(dir, file), "utf8")])
37905
38021
  );
37906
38022
  for (const finding of checkAppendOnly(baseline, current)) {
37907
38023
  problems.push(
@@ -38038,50 +38154,50 @@ function registerVerify(program2) {
38038
38154
 
38039
38155
  // src/commands/voice/devices.ts
38040
38156
  import { spawnSync as spawnSync9 } from "child_process";
38041
- import { join as join95 } from "path";
38157
+ import { join as join96 } from "path";
38042
38158
 
38043
38159
  // src/commands/voice/shared.ts
38044
38160
  import { homedir as homedir25 } from "os";
38045
- import { dirname as dirname40, join as join94 } from "path";
38161
+ import { dirname as dirname40, join as join95 } from "path";
38046
38162
  import { fileURLToPath as fileURLToPath10 } from "url";
38047
38163
  var __dirname6 = dirname40(fileURLToPath10(import.meta.url));
38048
- var VOICE_DIR = join94(homedir25(), ".assist", "voice");
38164
+ var VOICE_DIR = join95(homedir25(), ".assist", "voice");
38049
38165
  var voicePaths = {
38050
38166
  dir: VOICE_DIR,
38051
- pid: join94(VOICE_DIR, "voice.pid"),
38052
- log: join94(VOICE_DIR, "voice.log"),
38053
- venv: join94(VOICE_DIR, ".venv"),
38054
- lock: join94(VOICE_DIR, "voice.lock")
38167
+ pid: join95(VOICE_DIR, "voice.pid"),
38168
+ log: join95(VOICE_DIR, "voice.log"),
38169
+ venv: join95(VOICE_DIR, ".venv"),
38170
+ lock: join95(VOICE_DIR, "voice.lock")
38055
38171
  };
38056
38172
  function getPythonDir() {
38057
- return join94(__dirname6, "commands", "voice", "python");
38173
+ return join95(__dirname6, "commands", "voice", "python");
38058
38174
  }
38059
38175
  function getVenvPython() {
38060
- return process.platform === "win32" ? join94(voicePaths.venv, "Scripts", "python.exe") : join94(voicePaths.venv, "bin", "python");
38176
+ return process.platform === "win32" ? join95(voicePaths.venv, "Scripts", "python.exe") : join95(voicePaths.venv, "bin", "python");
38061
38177
  }
38062
38178
  function getLockDir() {
38063
38179
  const config = loadConfig();
38064
38180
  return config.voice?.lockDir ?? VOICE_DIR;
38065
38181
  }
38066
38182
  function getLockFile() {
38067
- return join94(getLockDir(), "voice.lock");
38183
+ return join95(getLockDir(), "voice.lock");
38068
38184
  }
38069
38185
 
38070
38186
  // src/commands/voice/devices.ts
38071
38187
  function devices() {
38072
- const script = join95(getPythonDir(), "list_devices.py");
38188
+ const script = join96(getPythonDir(), "list_devices.py");
38073
38189
  spawnSync9(getVenvPython(), [script], { stdio: "inherit" });
38074
38190
  }
38075
38191
 
38076
38192
  // src/commands/voice/logs.ts
38077
- import { existsSync as existsSync80, readFileSync as readFileSync61 } from "fs";
38193
+ import { existsSync as existsSync80, readFileSync as readFileSync62 } from "fs";
38078
38194
  function logs(options2) {
38079
38195
  if (!existsSync80(voicePaths.log)) {
38080
38196
  console.log("No voice log file found");
38081
38197
  return;
38082
38198
  }
38083
38199
  const count8 = Number.parseInt(options2.lines ?? "150", 10);
38084
- const content = readFileSync61(voicePaths.log, "utf8").trim();
38200
+ const content = readFileSync62(voicePaths.log, "utf8").trim();
38085
38201
  if (!content) {
38086
38202
  console.log("Voice log is empty");
38087
38203
  return;
@@ -38104,12 +38220,12 @@ function logs(options2) {
38104
38220
  // src/commands/voice/setup.ts
38105
38221
  import { spawnSync as spawnSync10 } from "child_process";
38106
38222
  import { mkdirSync as mkdirSync34 } from "fs";
38107
- import { join as join97 } from "path";
38223
+ import { join as join98 } from "path";
38108
38224
 
38109
38225
  // src/commands/voice/checkLockFile.ts
38110
38226
  import { execSync as execSync66 } from "child_process";
38111
- import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync62, writeFileSync as writeFileSync51 } from "fs";
38112
- import { join as join96 } from "path";
38227
+ import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync63, writeFileSync as writeFileSync52 } from "fs";
38228
+ import { join as join97 } from "path";
38113
38229
  function isProcessAlive2(pid) {
38114
38230
  try {
38115
38231
  process.kill(pid, 0);
@@ -38122,7 +38238,7 @@ function checkLockFile() {
38122
38238
  const lockFile = getLockFile();
38123
38239
  if (!existsSync81(lockFile)) return;
38124
38240
  try {
38125
- const lock2 = JSON.parse(readFileSync62(lockFile, "utf8"));
38241
+ const lock2 = JSON.parse(readFileSync63(lockFile, "utf8"));
38126
38242
  if (lock2.pid && isProcessAlive2(lock2.pid)) {
38127
38243
  console.error(
38128
38244
  `Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
@@ -38146,8 +38262,8 @@ function bootstrapVenv() {
38146
38262
  }
38147
38263
  function writeLockFile(pid) {
38148
38264
  const lockFile = getLockFile();
38149
- mkdirSync33(join96(lockFile, ".."), { recursive: true });
38150
- writeFileSync51(
38265
+ mkdirSync33(join97(lockFile, ".."), { recursive: true });
38266
+ writeFileSync52(
38151
38267
  lockFile,
38152
38268
  JSON.stringify({
38153
38269
  pid,
@@ -38162,7 +38278,7 @@ function setup() {
38162
38278
  mkdirSync34(voicePaths.dir, { recursive: true });
38163
38279
  bootstrapVenv();
38164
38280
  console.log("\nDownloading models...\n");
38165
- const script = join97(getPythonDir(), "setup_models.py");
38281
+ const script = join98(getPythonDir(), "setup_models.py");
38166
38282
  const result = spawnSync10(getVenvPython(), [script], {
38167
38283
  stdio: "inherit",
38168
38284
  env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
@@ -38175,8 +38291,8 @@ function setup() {
38175
38291
 
38176
38292
  // src/commands/voice/start.ts
38177
38293
  import { spawn as spawn9 } from "child_process";
38178
- import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
38179
- import { join as join98 } from "path";
38294
+ import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync53 } from "fs";
38295
+ import { join as join99 } from "path";
38180
38296
 
38181
38297
  // src/commands/voice/buildDaemonEnv.ts
38182
38298
  function buildDaemonEnv(options2) {
@@ -38204,7 +38320,7 @@ function spawnBackground(python, script, env) {
38204
38320
  console.error("Failed to start voice daemon");
38205
38321
  process.exit(1);
38206
38322
  }
38207
- writeFileSync52(voicePaths.pid, String(pid));
38323
+ writeFileSync53(voicePaths.pid, String(pid));
38208
38324
  writeLockFile(pid);
38209
38325
  console.log(`Voice daemon started (PID ${pid})`);
38210
38326
  }
@@ -38214,7 +38330,7 @@ function start2(options2) {
38214
38330
  bootstrapVenv();
38215
38331
  const debug = options2.debug || options2.foreground || process.platform === "win32";
38216
38332
  const env = buildDaemonEnv({ debug });
38217
- const script = join98(getPythonDir(), "voice_daemon.py");
38333
+ const script = join99(getPythonDir(), "voice_daemon.py");
38218
38334
  const python = getVenvPython();
38219
38335
  if (options2.foreground) {
38220
38336
  spawnForeground(python, script, env);
@@ -38224,7 +38340,7 @@ function start2(options2) {
38224
38340
  }
38225
38341
 
38226
38342
  // src/commands/voice/status.ts
38227
- import { existsSync as existsSync82, readFileSync as readFileSync63 } from "fs";
38343
+ import { existsSync as existsSync82, readFileSync as readFileSync64 } from "fs";
38228
38344
  function isProcessAlive3(pid) {
38229
38345
  try {
38230
38346
  process.kill(pid, 0);
@@ -38235,7 +38351,7 @@ function isProcessAlive3(pid) {
38235
38351
  }
38236
38352
  function readRecentLogs(count8) {
38237
38353
  if (!existsSync82(voicePaths.log)) return [];
38238
- const lines2 = readFileSync63(voicePaths.log, "utf8").trim().split("\n");
38354
+ const lines2 = readFileSync64(voicePaths.log, "utf8").trim().split("\n");
38239
38355
  return lines2.slice(-count8);
38240
38356
  }
38241
38357
  function status2() {
@@ -38243,7 +38359,7 @@ function status2() {
38243
38359
  console.log("Voice daemon: not running (no PID file)");
38244
38360
  return;
38245
38361
  }
38246
- const pid = Number.parseInt(readFileSync63(voicePaths.pid, "utf8").trim(), 10);
38362
+ const pid = Number.parseInt(readFileSync64(voicePaths.pid, "utf8").trim(), 10);
38247
38363
  const alive = isProcessAlive3(pid);
38248
38364
  console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
38249
38365
  const recent = readRecentLogs(5);
@@ -38262,13 +38378,13 @@ function status2() {
38262
38378
  }
38263
38379
 
38264
38380
  // src/commands/voice/stop.ts
38265
- import { existsSync as existsSync83, readFileSync as readFileSync64, unlinkSync as unlinkSync21 } from "fs";
38381
+ import { existsSync as existsSync83, readFileSync as readFileSync65, unlinkSync as unlinkSync21 } from "fs";
38266
38382
  function stop2() {
38267
38383
  if (!existsSync83(voicePaths.pid)) {
38268
38384
  console.log("Voice daemon is not running (no PID file)");
38269
38385
  return;
38270
38386
  }
38271
- const pid = Number.parseInt(readFileSync64(voicePaths.pid, "utf8").trim(), 10);
38387
+ const pid = Number.parseInt(readFileSync65(voicePaths.pid, "utf8").trim(), 10);
38272
38388
  try {
38273
38389
  process.kill(pid, "SIGTERM");
38274
38390
  console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
@@ -38345,11 +38461,11 @@ function changedPaths(from, cwd) {
38345
38461
  }
38346
38462
 
38347
38463
  // src/commands/watch/readBuiltVersion.ts
38348
- import { join as join99 } from "path";
38464
+ import { join as join100 } from "path";
38349
38465
  function readBuiltVersion(cwd) {
38350
38466
  try {
38351
38467
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
38352
- return readPackageJson(join99(root2, "package.json")).version ?? "unknown";
38468
+ return readPackageJson(join100(root2, "package.json")).version ?? "unknown";
38353
38469
  } catch {
38354
38470
  return "unknown";
38355
38471
  }
@@ -38406,11 +38522,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
38406
38522
  var sessionsPrefix = "src/commands/sessions/";
38407
38523
  var rules = [
38408
38524
  {
38409
- matches: (path103) => path103.startsWith(webUiPrefix),
38525
+ matches: (path105) => path105.startsWith(webUiPrefix),
38410
38526
  advice: "restart the web server, then hard-reload the browser tab"
38411
38527
  },
38412
38528
  {
38413
- matches: (path103) => path103.startsWith(sessionsPrefix) && !path103.startsWith(webUiPrefix),
38529
+ matches: (path105) => path105.startsWith(sessionsPrefix) && !path105.startsWith(webUiPrefix),
38414
38530
  advice: "restart the daemon"
38415
38531
  }
38416
38532
  ];
@@ -38421,27 +38537,27 @@ function restartAdvice(paths) {
38421
38537
  // src/commands/watch/syncAdvice.ts
38422
38538
  var rules2 = [
38423
38539
  {
38424
- matches: (path103) => path103.startsWith("claude/commands/"),
38540
+ matches: (path105) => path105.startsWith("claude/commands/"),
38425
38541
  reason: "claude/commands changed"
38426
38542
  },
38427
38543
  {
38428
- matches: (path103) => path103.startsWith("claude/skills/"),
38544
+ matches: (path105) => path105.startsWith("claude/skills/"),
38429
38545
  reason: "claude/skills changed"
38430
38546
  },
38431
38547
  {
38432
- matches: (path103) => path103 === "claude/settings.json",
38548
+ matches: (path105) => path105 === "claude/settings.json",
38433
38549
  reason: "claude/settings.json changed"
38434
38550
  },
38435
38551
  {
38436
- matches: (path103) => path103 === "claude/design-system-prompt.md",
38552
+ matches: (path105) => path105 === "claude/design-system-prompt.md",
38437
38553
  reason: "claude/design-system-prompt.md changed"
38438
38554
  },
38439
38555
  {
38440
- matches: (path103) => path103.startsWith("codex/"),
38556
+ matches: (path105) => path105.startsWith("codex/"),
38441
38557
  reason: "codex sources changed"
38442
38558
  },
38443
38559
  {
38444
- matches: (path103) => path103.startsWith("pi/"),
38560
+ matches: (path105) => path105.startsWith("pi/"),
38445
38561
  reason: "pi sources changed"
38446
38562
  }
38447
38563
  ];
@@ -38923,7 +39039,7 @@ function registerWatch(program2) {
38923
39039
 
38924
39040
  // src/commands/roam/auth.ts
38925
39041
  import { randomBytes } from "crypto";
38926
- import chalk248 from "chalk";
39042
+ import chalk249 from "chalk";
38927
39043
 
38928
39044
  // src/commands/roam/waitForCallback.ts
38929
39045
  import { createServer as createServer3 } from "http";
@@ -39054,13 +39170,13 @@ async function auth() {
39054
39170
  saveGlobalConfig(config);
39055
39171
  const state = randomBytes(16).toString("hex");
39056
39172
  console.log(
39057
- 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:")
39058
39174
  );
39059
- console.log(chalk248.white("http://localhost:14523/callback\n"));
39060
- console.log(chalk248.blue("Opening browser for authorization..."));
39061
- 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..."));
39062
39178
  const { code, redirectUri } = await authorizeInBrowser(clientId, state);
39063
- console.log(chalk248.dim("Exchanging code for tokens..."));
39179
+ console.log(chalk249.dim("Exchanging code for tokens..."));
39064
39180
  const tokens = await exchangeToken({
39065
39181
  code,
39066
39182
  clientId,
@@ -39076,14 +39192,14 @@ async function auth() {
39076
39192
  };
39077
39193
  saveGlobalConfig(config);
39078
39194
  console.log(
39079
- chalk248.green("Roam credentials and tokens saved to ~/.assist.yml")
39195
+ chalk249.green("Roam credentials and tokens saved to ~/.assist.yml")
39080
39196
  );
39081
39197
  }
39082
39198
 
39083
39199
  // src/commands/roam/postRoamActivity.ts
39084
39200
  import { execFileSync as execFileSync23 } from "child_process";
39085
- import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
39086
- import { join as join100 } from "path";
39201
+ import { readdirSync as readdirSync22, readFileSync as readFileSync66, statSync as statSync13 } from "fs";
39202
+ import { join as join101 } from "path";
39087
39203
  function findPortFile(roamDir) {
39088
39204
  let entries;
39089
39205
  try {
@@ -39092,9 +39208,9 @@ function findPortFile(roamDir) {
39092
39208
  return void 0;
39093
39209
  }
39094
39210
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
39095
- const path103 = join100(roamDir, name);
39211
+ const path105 = join101(roamDir, name);
39096
39212
  try {
39097
- return { path: path103, mtimeMs: statSync13(path103).mtimeMs };
39213
+ return { path: path105, mtimeMs: statSync13(path105).mtimeMs };
39098
39214
  } catch {
39099
39215
  return void 0;
39100
39216
  }
@@ -39109,11 +39225,11 @@ var PID_BY_APP = {
39109
39225
  function postRoamActivity(app, event) {
39110
39226
  const appData = process.env.APPDATA;
39111
39227
  if (!appData) return;
39112
- const portFile = findPortFile(join100(appData, "Roam"));
39228
+ const portFile = findPortFile(join101(appData, "Roam"));
39113
39229
  if (!portFile) return;
39114
39230
  let port;
39115
39231
  try {
39116
- port = readFileSync65(portFile, "utf8").trim();
39232
+ port = readFileSync66(portFile, "utf8").trim();
39117
39233
  } catch {
39118
39234
  return;
39119
39235
  }
@@ -39244,8 +39360,8 @@ async function run3(name, args) {
39244
39360
  }
39245
39361
 
39246
39362
  // src/commands/run/add.ts
39247
- import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync53 } from "fs";
39248
- import { join as join101 } from "path";
39363
+ import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync54 } from "fs";
39364
+ import { join as join102 } from "path";
39249
39365
 
39250
39366
  // src/commands/run/extractOption.ts
39251
39367
  function extractOption(args, flag) {
@@ -39306,7 +39422,7 @@ function saveNewRunConfig(name, command, args, cwd) {
39306
39422
  saveConfig(config);
39307
39423
  }
39308
39424
  function createCommandFile(name) {
39309
- const dir = join101(".claude", "commands");
39425
+ const dir = join102(".claude", "commands");
39310
39426
  mkdirSync36(dir, { recursive: true });
39311
39427
  const content = `---
39312
39428
  description: Run ${name}
@@ -39314,8 +39430,8 @@ description: Run ${name}
39314
39430
 
39315
39431
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
39316
39432
  `;
39317
- const filePath = join101(dir, `${name}.md`);
39318
- writeFileSync53(filePath, content);
39433
+ const filePath = join102(dir, `${name}.md`);
39434
+ writeFileSync54(filePath, content);
39319
39435
  console.log(`Created command file: ${filePath}`);
39320
39436
  }
39321
39437
  function add4() {
@@ -39338,11 +39454,11 @@ function findLinkIndex() {
39338
39454
  function parseLinkArgs() {
39339
39455
  const idx = findLinkIndex();
39340
39456
  if (idx === -1) return null;
39341
- const path103 = process.argv[idx + 1];
39457
+ const path105 = process.argv[idx + 1];
39342
39458
  const rest = process.argv.slice(idx + 2);
39343
39459
  const { value: prefix2 } = extractOption(rest, "--prefix");
39344
39460
  if (!prefix2) return null;
39345
- return { path: path103, prefix: prefix2 };
39461
+ return { path: path105, prefix: prefix2 };
39346
39462
  }
39347
39463
  function hasDuplicateLink(runList, linkPath) {
39348
39464
  return runList.some(
@@ -39371,7 +39487,7 @@ function link2() {
39371
39487
 
39372
39488
  // src/commands/run/remove.ts
39373
39489
  import { existsSync as existsSync85, unlinkSync as unlinkSync22 } from "fs";
39374
- import { join as join102 } from "path";
39490
+ import { join as join103 } from "path";
39375
39491
  function findRemoveIndex() {
39376
39492
  const idx = process.argv.indexOf("remove");
39377
39493
  if (idx === -1 || idx + 1 >= process.argv.length) return -1;
@@ -39386,7 +39502,7 @@ function parseRemoveName() {
39386
39502
  return process.argv[idx + 1];
39387
39503
  }
39388
39504
  function deleteCommandFile(name) {
39389
- const filePath = join102(".claude", "commands", `${name}.md`);
39505
+ const filePath = join103(".claude", "commands", `${name}.md`);
39390
39506
  if (existsSync85(filePath)) {
39391
39507
  unlinkSync22(filePath);
39392
39508
  console.log(`Deleted command file: ${filePath}`);
@@ -39431,7 +39547,7 @@ function registerRun(program2) {
39431
39547
  }
39432
39548
 
39433
39549
  // src/commands/sessions/nodes/formatLink.ts
39434
- import chalk249 from "chalk";
39550
+ import chalk250 from "chalk";
39435
39551
 
39436
39552
  // src/commands/sessions/daemon/links/describeTarget.ts
39437
39553
  function describeTarget({ url, ssh }) {
@@ -39441,16 +39557,16 @@ function describeTarget({ url, ssh }) {
39441
39557
 
39442
39558
  // src/commands/sessions/nodes/formatLink.ts
39443
39559
  var STATE_COLOURS = {
39444
- connected: chalk249.green,
39445
- connecting: chalk249.yellow,
39446
- disconnected: chalk249.red,
39447
- "version-blocked": chalk249.red
39560
+ connected: chalk250.green,
39561
+ connecting: chalk250.yellow,
39562
+ disconnected: chalk250.red,
39563
+ "version-blocked": chalk250.red
39448
39564
  };
39449
39565
  function formatLink(link3) {
39450
- const colour = STATE_COLOURS[link3.state] ?? chalk249.white;
39566
+ const colour = STATE_COLOURS[link3.state] ?? chalk250.white;
39451
39567
  const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
39452
39568
  const error = link3.error ? `
39453
- ${chalk249.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39569
+ ${chalk250.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
39454
39570
  return ` ${link3.name} ${colour(link3.state)} ${describeTarget(link3)}${peer}${error}`;
39455
39571
  }
39456
39572
 
@@ -39505,11 +39621,11 @@ function applyLine(result, pending, line) {
39505
39621
  }
39506
39622
 
39507
39623
  // src/commands/sessions/daemon/readDaemonPidFile.ts
39508
- import { readFileSync as readFileSync66 } from "fs";
39624
+ import { readFileSync as readFileSync67 } from "fs";
39509
39625
  function readDaemonPidFile() {
39510
39626
  try {
39511
39627
  const pid = Number.parseInt(
39512
- readFileSync66(daemonPaths.pid, "utf8").trim(),
39628
+ readFileSync67(daemonPaths.pid, "utf8").trim(),
39513
39629
  10
39514
39630
  );
39515
39631
  return Number.isInteger(pid) ? pid : void 0;
@@ -39987,14 +40103,14 @@ import * as pty from "node-pty";
39987
40103
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
39988
40104
  import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
39989
40105
  import { createRequire as createRequire3 } from "module";
39990
- import path99 from "path";
40106
+ import path101 from "path";
39991
40107
  var require4 = createRequire3(import.meta.url);
39992
40108
  var ensured = false;
39993
40109
  function ensureSpawnHelperExecutable() {
39994
40110
  if (ensured || process.platform !== "darwin") return;
39995
40111
  ensured = true;
39996
- const ptyRoot = path99.join(path99.dirname(require4.resolve("node-pty")), "..");
39997
- const helper = path99.join(
40112
+ const ptyRoot = path101.join(path101.dirname(require4.resolve("node-pty")), "..");
40113
+ const helper = path101.join(
39998
40114
  ptyRoot,
39999
40115
  "prebuilds",
40000
40116
  `${process.platform}-${process.arch}`,
@@ -40125,12 +40241,12 @@ function serverRunMeta(runName, cwd) {
40125
40241
 
40126
40242
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
40127
40243
  import * as fs50 from "fs";
40128
- import * as path100 from "path";
40244
+ import * as path102 from "path";
40129
40245
  import { fileURLToPath as fileURLToPath11 } from "url";
40130
40246
  var __filename5 = fileURLToPath11(import.meta.url);
40131
- var __dirname7 = path100.dirname(__filename5);
40247
+ var __dirname7 = path102.dirname(__filename5);
40132
40248
  function readDesignSystemPrompt() {
40133
- const promptPath = path100.join(
40249
+ const promptPath = path102.join(
40134
40250
  __dirname7,
40135
40251
  "..",
40136
40252
  "claude",
@@ -40230,16 +40346,16 @@ function setStatus2(session, newStatus) {
40230
40346
 
40231
40347
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
40232
40348
  import { existsSync as existsSync90 } from "fs";
40233
- import { basename as basename26 } from "path";
40349
+ import { basename as basename27 } from "path";
40234
40350
 
40235
40351
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
40236
40352
  import { existsSync as existsSync89 } from "fs";
40237
- import { join as join105 } from "path";
40353
+ import { join as join106 } from "path";
40238
40354
 
40239
40355
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
40240
40356
  import { statSync as statSync15 } from "fs";
40241
40357
  import { rm as rm4 } from "fs/promises";
40242
- import { join as join104 } from "path";
40358
+ import { join as join105 } from "path";
40243
40359
  async function deleteTreeDirectly(clone, worktreePath, why) {
40244
40360
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
40245
40361
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -40267,7 +40383,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
40267
40383
  return { removed: true };
40268
40384
  }
40269
40385
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
40270
- return statSync15(join104(worktreePath, ".git"), {
40386
+ return statSync15(join105(worktreePath, ".git"), {
40271
40387
  throwIfNoEntry: false
40272
40388
  })?.isDirectory() === true;
40273
40389
  }
@@ -40303,7 +40419,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
40303
40419
  );
40304
40420
  }
40305
40421
  function strandedReason(worktreePath, cause) {
40306
- if (!existsSync89(join105(worktreePath, ".git")))
40422
+ if (!existsSync89(join106(worktreePath, ".git")))
40307
40423
  return "its .git link is already gone";
40308
40424
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
40309
40425
  return "git no longer recognises it as a working tree";
@@ -40373,7 +40489,7 @@ async function reapWorktree(worktreePath, force = false) {
40373
40489
  const clone = owningClone(worktreePath);
40374
40490
  const removal = await removeTree(clone, worktreePath, force);
40375
40491
  if (!removal.removed) return removal;
40376
- await deleteWorktreeBranch(clone, basename26(worktreePath));
40492
+ await deleteWorktreeBranch(clone, basename27(worktreePath));
40377
40493
  forgetWorktree(worktreePath);
40378
40494
  daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
40379
40495
  return removal;
@@ -41164,8 +41280,8 @@ async function seedRunningMsFromUsage(session, notify2) {
41164
41280
  var DEBOUNCE_MS2 = 50;
41165
41281
  function watchActivity(session, notify2, onClaudeSessionId) {
41166
41282
  if (session.commandType !== "assist" || !session.cwd) return;
41167
- const path103 = activityPath(session.id);
41168
- const dir = dirname42(path103);
41283
+ const path105 = activityPath(session.id);
41284
+ const dir = dirname42(path105);
41169
41285
  try {
41170
41286
  mkdirSync37(dir, { recursive: true });
41171
41287
  } catch {
@@ -41175,7 +41291,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41175
41291
  let timer = null;
41176
41292
  const read3 = () => {
41177
41293
  timer = null;
41178
- const activity2 = readActivity(path103);
41294
+ const activity2 = readActivity(path105);
41179
41295
  if (!activity2) return;
41180
41296
  applyActivityToSession(session, activity2);
41181
41297
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -41184,11 +41300,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41184
41300
  notify2();
41185
41301
  };
41186
41302
  session.activityWatcher = watch2(dir, (_event, filename) => {
41187
- if (filename && !path103.endsWith(filename)) return;
41303
+ if (filename && !path105.endsWith(filename)) return;
41188
41304
  if (timer) clearTimeout(timer);
41189
41305
  timer = setTimeout(read3, DEBOUNCE_MS2);
41190
41306
  });
41191
- if (existsSync93(path103)) read3();
41307
+ if (existsSync93(path105)) read3();
41192
41308
  }
41193
41309
  function refreshActivity(session) {
41194
41310
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -41331,12 +41447,12 @@ import { watch as watch3 } from "fs";
41331
41447
 
41332
41448
  // src/commands/sessions/shared/findTranscriptPathSync.ts
41333
41449
  import * as fs52 from "fs";
41334
- import * as path101 from "path";
41450
+ import * as path103 from "path";
41335
41451
  function projectDirForCwd(cwd) {
41336
- return path101.join(claudeProjectsRoot(), projectSlug(cwd));
41452
+ return path103.join(claudeProjectsRoot(), projectSlug(cwd));
41337
41453
  }
41338
41454
  function transcriptPathFor(cwd, claudeSessionId) {
41339
- return path101.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41455
+ return path103.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41340
41456
  }
41341
41457
  function findTranscriptPathSync(cwd, claudeSessionId) {
41342
41458
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -41350,8 +41466,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
41350
41466
  }
41351
41467
  for (const file of files) {
41352
41468
  if (!file.endsWith(".jsonl")) continue;
41353
- if (headContainsSessionId(path101.join(dir, file), claudeSessionId))
41354
- return path101.join(dir, file);
41469
+ if (headContainsSessionId(path103.join(dir, file), claudeSessionId))
41470
+ return path103.join(dir, file);
41355
41471
  }
41356
41472
  return null;
41357
41473
  }
@@ -42551,9 +42667,9 @@ function tempRoots() {
42551
42667
  }
42552
42668
  return [...roots];
42553
42669
  }
42554
- function underTempRoot(path103) {
42670
+ function underTempRoot(path105) {
42555
42671
  return tempRoots().some(
42556
- (root2) => path103.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42672
+ (root2) => path105.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42557
42673
  );
42558
42674
  }
42559
42675
 
@@ -42982,7 +43098,7 @@ function rearmStoppedSessions(sessions, notify2) {
42982
43098
 
42983
43099
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
42984
43100
  import { existsSync as existsSync96 } from "fs";
42985
- import { basename as basename28 } from "path";
43101
+ import { basename as basename29 } from "path";
42986
43102
 
42987
43103
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
42988
43104
  function accountedTrees(sessions) {
@@ -43039,15 +43155,15 @@ function bindResumedWorktree(session, cwd, notify2) {
43039
43155
  import { existsSync as existsSync95 } from "fs";
43040
43156
  async function reclaimVanishedWorktrees(clone, paths) {
43041
43157
  if (!existsSync95(clone)) {
43042
- for (const { path: path103 } of paths) forgetWorktree(path103);
43158
+ for (const { path: path105 } of paths) forgetWorktree(path105);
43043
43159
  daemonLog(
43044
43160
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
43045
43161
  );
43046
43162
  return;
43047
43163
  }
43048
43164
  await pruneBookkeeping2(clone);
43049
- for (const { path: path103, branch: branch2 } of paths)
43050
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path103);
43165
+ for (const { path: path105, branch: branch2 } of paths)
43166
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path105);
43051
43167
  }
43052
43168
  async function pruneBookkeeping2(clone) {
43053
43169
  try {
@@ -43074,37 +43190,37 @@ async function reclaimBranch(clone, branch2) {
43074
43190
  }
43075
43191
 
43076
43192
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
43077
- function logVanishedTree(sessions, path103) {
43193
+ function logVanishedTree(sessions, path105) {
43078
43194
  const claimants = [...sessions.values()].filter(
43079
- (s) => s.cwd === path103 || s.worktree?.path === path103
43195
+ (s) => s.cwd === path105 || s.worktree?.path === path105
43080
43196
  );
43081
43197
  if (claimants.length === 0) {
43082
- daemonLog(`worktree ${path103} gone from disk and unclaimed; reclaiming it`);
43198
+ daemonLog(`worktree ${path105} gone from disk and unclaimed; reclaiming it`);
43083
43199
  return;
43084
43200
  }
43085
43201
  for (const s of claimants)
43086
43202
  daemonLog(
43087
- `session ${s.id} ("${s.name}") claims worktree ${path103}, which is gone from disk; reclaiming it`
43203
+ `session ${s.id} ("${s.name}") claims worktree ${path105}, which is gone from disk; reclaiming it`
43088
43204
  );
43089
43205
  }
43090
43206
 
43091
43207
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
43092
43208
  var MAX_ITEMS = 20;
43093
- async function describeHeldWork(path103, reason4) {
43094
- if (reason4.startsWith("uncommitted")) return await changedFiles(path103);
43095
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path103, 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);
43096
43212
  return { summary: reason4, items: [] };
43097
43213
  }
43098
- async function changedFiles(path103) {
43099
- const status3 = await gitResult(path103, ["status", "--porcelain"]);
43214
+ async function changedFiles(path105) {
43215
+ const status3 = await gitResult(path105, ["status", "--porcelain"]);
43100
43216
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
43101
43217
  return {
43102
43218
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
43103
43219
  items: capped2(lines2)
43104
43220
  };
43105
43221
  }
43106
- async function unpushedCommits(path103, reason4) {
43107
- const log2 = await gitResult(path103, ["log", "--oneline", "@{upstream}..HEAD"]);
43222
+ async function unpushedCommits(path105, reason4) {
43223
+ const log2 = await gitResult(path105, ["log", "--oneline", "@{upstream}..HEAD"]);
43108
43224
  if (!log2.ok) return { summary: reason4, items: [] };
43109
43225
  const lines2 = nonEmptyLines(log2.out);
43110
43226
  return {
@@ -43124,7 +43240,7 @@ function capped2(lines2) {
43124
43240
  }
43125
43241
 
43126
43242
  // src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
43127
- import { basename as basename27 } from "path";
43243
+ import { basename as basename28 } from "path";
43128
43244
  function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
43129
43245
  const { orphan, reason: reason4, held } = recovered;
43130
43246
  let id;
@@ -43147,7 +43263,7 @@ function orphanedSession(id, recovered) {
43147
43263
  const { orphan, reason: reason4, held } = recovered;
43148
43264
  return {
43149
43265
  ...sessionBase(id, "stopped"),
43150
- name: `recovered ${basename27(orphan.path)}`,
43266
+ name: `recovered ${basename28(orphan.path)}`,
43151
43267
  subtitle: `${held.summary} in ${orphan.path}`,
43152
43268
  commandType: "claude",
43153
43269
  pty: null,
@@ -43196,24 +43312,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
43196
43312
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
43197
43313
  const accounted = accountedTrees(sessions);
43198
43314
  const vanished = /* @__PURE__ */ new Map();
43199
- for (const { path: path103, clone } of readWorktreeRegistry()) {
43200
- if (underTempRoot(path103)) {
43201
- forgetWorktree(path103);
43315
+ for (const { path: path105, clone } of readWorktreeRegistry()) {
43316
+ if (underTempRoot(path105)) {
43317
+ forgetWorktree(path105);
43202
43318
  daemonLog(
43203
- `worktree ${path103} 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`
43204
43320
  );
43205
43321
  continue;
43206
43322
  }
43207
- if (!existsSync96(path103)) {
43208
- logVanishedTree(sessions, path103);
43323
+ if (!existsSync96(path105)) {
43324
+ logVanishedTree(sessions, path105);
43209
43325
  vanished.set(clone, [
43210
43326
  ...vanished.get(clone) ?? [],
43211
- { path: path103, branch: basename28(path103) }
43327
+ { path: path105, branch: basename29(path105) }
43212
43328
  ]);
43213
43329
  continue;
43214
43330
  }
43215
- if (accounted.has(path103)) continue;
43216
- await recoverOrphan(sessions, spawnWith, { path: path103, clone }, notify2);
43331
+ if (accounted.has(path105)) continue;
43332
+ await recoverOrphan(sessions, spawnWith, { path: path105, clone }, notify2);
43217
43333
  }
43218
43334
  for (const [clone, paths] of vanished)
43219
43335
  await reclaimVanishedWorktrees(clone, paths);
@@ -44792,7 +44908,7 @@ import { existsSync as existsSync98 } from "fs";
44792
44908
 
44793
44909
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
44794
44910
  import { copyFileSync as copyFileSync5, existsSync as existsSync97, mkdirSync as mkdirSync39 } from "fs";
44795
- import { join as join107 } from "path";
44911
+ import { join as join108 } from "path";
44796
44912
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
44797
44913
  const dir = projectDirForCwd(toCwd);
44798
44914
  if (dir === projectDirForCwd(fromCwd)) {
@@ -44801,7 +44917,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
44801
44917
  );
44802
44918
  return;
44803
44919
  }
44804
- const dest = join107(dir, `${claudeSessionId}.jsonl`);
44920
+ const dest = join108(dir, `${claudeSessionId}.jsonl`);
44805
44921
  if (existsSync97(dest)) {
44806
44922
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
44807
44923
  return;
@@ -45291,12 +45407,12 @@ function handleSetStatus(client, m, d) {
45291
45407
  import * as fs56 from "fs";
45292
45408
 
45293
45409
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
45294
- import * as path102 from "path";
45410
+ import * as path104 from "path";
45295
45411
  async function findCodexRolloutPath(sessionId) {
45296
45412
  if (!sessionId) return null;
45297
45413
  const paths = await discoverCodexRolloutPaths();
45298
45414
  const suffix = `-${sessionId}.jsonl`;
45299
- return paths.find((file) => path102.basename(file).endsWith(suffix)) ?? null;
45415
+ return paths.find((file) => path104.basename(file).endsWith(suffix)) ?? null;
45300
45416
  }
45301
45417
 
45302
45418
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -45662,10 +45778,10 @@ function handleConnection(socket, manager) {
45662
45778
  }
45663
45779
 
45664
45780
  // src/commands/sessions/daemon/onListening.ts
45665
- import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync54 } from "fs";
45781
+ import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync55 } from "fs";
45666
45782
 
45667
45783
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
45668
- import { readFileSync as readFileSync68 } from "fs";
45784
+ import { readFileSync as readFileSync69 } from "fs";
45669
45785
  var WATCHDOG_INTERVAL_MS = 5e3;
45670
45786
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
45671
45787
  const timer = setInterval(() => {
@@ -45676,7 +45792,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
45676
45792
  }
45677
45793
  function ownsPidFile() {
45678
45794
  try {
45679
- return readFileSync68(daemonPaths.pid, "utf8").trim() === String(process.pid);
45795
+ return readFileSync69(daemonPaths.pid, "utf8").trim() === String(process.pid);
45680
45796
  } catch {
45681
45797
  return false;
45682
45798
  }
@@ -45684,7 +45800,7 @@ function ownsPidFile() {
45684
45800
 
45685
45801
  // src/commands/sessions/daemon/onListening.ts
45686
45802
  function onListening(manager, checkAutoExit) {
45687
- writeFileSync54(daemonPaths.pid, String(process.pid));
45803
+ writeFileSync55(daemonPaths.pid, String(process.pid));
45688
45804
  startPidFileWatchdog(() => {
45689
45805
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
45690
45806
  void manager.flushActiveMs().finally(() => {
@@ -45879,13 +45995,13 @@ function describePeerError(error) {
45879
45995
  const cause = error.cause;
45880
45996
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
45881
45997
  }
45882
- async function fetchPeerJson(baseUrl, path103, timeoutMs = PEER_TIMEOUT_MS) {
45883
- const res = await fetch(new URL(path103, baseUrl), {
45998
+ async function fetchPeerJson(baseUrl, path105, timeoutMs = PEER_TIMEOUT_MS) {
45999
+ const res = await fetch(new URL(path105, baseUrl), {
45884
46000
  signal: AbortSignal.timeout(timeoutMs)
45885
46001
  });
45886
46002
  if (!res.ok)
45887
46003
  throw Object.assign(
45888
- new Error(`GET ${path103} returned ${res.status} ${res.statusText}`),
46004
+ new Error(`GET ${path105} returned ${res.status} ${res.statusText}`),
45889
46005
  { status: res.status }
45890
46006
  );
45891
46007
  return await res.json();
@@ -46198,7 +46314,7 @@ async function probeSshAgent(alias) {
46198
46314
  }
46199
46315
 
46200
46316
  // src/commands/sessions/nodes/printReport.ts
46201
- import chalk250 from "chalk";
46317
+ import chalk251 from "chalk";
46202
46318
  function printReport(report2) {
46203
46319
  if (report2.links.length === 0) {
46204
46320
  console.log(`${report2.local} has no links`);
@@ -46212,11 +46328,11 @@ function printReport(report2) {
46212
46328
  for (const diagnosis of report2.links) printDiagnosis(diagnosis);
46213
46329
  }
46214
46330
  function printDiagnosis(diagnosis) {
46215
- console.log(`${chalk250.bold(diagnosis.name)} ${chalk250.dim(diagnosis.url)}`);
46331
+ console.log(`${chalk251.bold(diagnosis.name)} ${chalk251.dim(diagnosis.url)}`);
46216
46332
  for (const hop of diagnosis.hops) {
46217
- const mark = hop.ok ? chalk250.green("\u2713") : chalk250.red("\u2717");
46333
+ const mark = hop.ok ? chalk251.green("\u2713") : chalk251.red("\u2717");
46218
46334
  console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
46219
- if (hop.remediation) console.log(` ${chalk250.yellow(hop.remediation)}`);
46335
+ if (hop.remediation) console.log(` ${chalk251.yellow(hop.remediation)}`);
46220
46336
  }
46221
46337
  }
46222
46338
 
@@ -46249,14 +46365,14 @@ async function doctorNodes(name, options2) {
46249
46365
  }
46250
46366
 
46251
46367
  // src/commands/sessions/nodes/linkNode.ts
46252
- import chalk252 from "chalk";
46368
+ import chalk253 from "chalk";
46253
46369
 
46254
46370
  // src/commands/sessions/nodes/notifyDaemonLinks.ts
46255
- import chalk251 from "chalk";
46371
+ import chalk252 from "chalk";
46256
46372
  async function notifyDaemonLinks() {
46257
46373
  if (!await isDaemonRunning()) {
46258
46374
  console.log(
46259
- chalk251.yellow(
46375
+ chalk252.yellow(
46260
46376
  "The sessions daemon is not running; it loads the links when it starts."
46261
46377
  )
46262
46378
  );
@@ -46264,11 +46380,11 @@ async function notifyDaemonLinks() {
46264
46380
  }
46265
46381
  try {
46266
46382
  await sendToDaemonAwaitAck({ type: "reload-links" });
46267
- console.log(chalk251.dim("The sessions daemon reloaded its links."));
46383
+ console.log(chalk252.dim("The sessions daemon reloaded its links."));
46268
46384
  } catch (error) {
46269
46385
  const message3 = error instanceof Error ? error.message : String(error);
46270
46386
  console.log(
46271
- chalk251.yellow(
46387
+ chalk252.yellow(
46272
46388
  `Could not notify the sessions daemon (${message3}); run \`assist daemon restart\` to apply the change.`
46273
46389
  )
46274
46390
  );
@@ -46328,13 +46444,13 @@ async function linkNode(name, url, options2) {
46328
46444
  const link3 = buildLink(name, url, options2, others);
46329
46445
  await writeLinks([...others, link3]);
46330
46446
  console.log(
46331
- chalk252.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46447
+ chalk253.green(`Linked ${name} (${describeTarget(toLinkSpec(link3))})`)
46332
46448
  );
46333
46449
  await notifyDaemonLinks();
46334
46450
  }
46335
46451
 
46336
46452
  // src/commands/sessions/nodes/listNodes.ts
46337
- import chalk253 from "chalk";
46453
+ import chalk254 from "chalk";
46338
46454
  async function nodesReport() {
46339
46455
  const live = await queryNodes();
46340
46456
  if (live)
@@ -46351,10 +46467,10 @@ async function listNodes(options2) {
46351
46467
  console.log(JSON.stringify(report2, null, 2));
46352
46468
  return;
46353
46469
  }
46354
- console.log(`${report2.local} ${chalk253.dim("(this node)")}`);
46470
+ console.log(`${report2.local} ${chalk254.dim("(this node)")}`);
46355
46471
  if (!report2.daemonRunning)
46356
- console.log(chalk253.dim(" daemon not running; showing configured links"));
46357
- 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"));
46358
46474
  for (const link3 of report2.links) console.log(formatLink(link3));
46359
46475
  }
46360
46476
 
@@ -46393,16 +46509,16 @@ async function nodeLogs(name, options2) {
46393
46509
  }
46394
46510
 
46395
46511
  // src/commands/sessions/nodes/unlinkNode.ts
46396
- import chalk254 from "chalk";
46512
+ import chalk255 from "chalk";
46397
46513
  async function unlinkNode(name) {
46398
46514
  const links2 = readLinks();
46399
46515
  const remaining = links2.filter((link3) => link3.name !== name);
46400
46516
  if (remaining.length === links2.length) {
46401
- console.log(chalk254.yellow(`No link named ${name}`));
46517
+ console.log(chalk255.yellow(`No link named ${name}`));
46402
46518
  return;
46403
46519
  }
46404
46520
  await writeLinks(remaining);
46405
- console.log(chalk254.green(`Unlinked ${name}`));
46521
+ console.log(chalk255.green(`Unlinked ${name}`));
46406
46522
  await notifyDaemonLinks();
46407
46523
  }
46408
46524
 
@@ -46541,7 +46657,7 @@ async function renameSession(title) {
46541
46657
 
46542
46658
  // src/commands/sessions/summarise.ts
46543
46659
  import * as fs58 from "fs";
46544
- import chalk255 from "chalk";
46660
+ import chalk256 from "chalk";
46545
46661
 
46546
46662
  // src/commands/sessions/summarise/shared.ts
46547
46663
  import * as fs57 from "fs";
@@ -46600,22 +46716,22 @@ ${firstMessage}`);
46600
46716
  async function summarise2(options2) {
46601
46717
  const files = await discoverSessionFiles();
46602
46718
  if (files.length === 0) {
46603
- console.log(chalk255.yellow("No sessions found."));
46719
+ console.log(chalk256.yellow("No sessions found."));
46604
46720
  return;
46605
46721
  }
46606
46722
  const toProcess = selectCandidates(files, options2);
46607
46723
  if (toProcess.length === 0) {
46608
- console.log(chalk255.green("All sessions already summarised."));
46724
+ console.log(chalk256.green("All sessions already summarised."));
46609
46725
  return;
46610
46726
  }
46611
46727
  console.log(
46612
- chalk255.cyan(
46728
+ chalk256.cyan(
46613
46729
  `Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
46614
46730
  )
46615
46731
  );
46616
46732
  const { succeeded, failed: failed3 } = processSessions(toProcess);
46617
46733
  console.log(
46618
- chalk255.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk255.yellow(`, ${failed3} skipped`) : "")
46734
+ chalk256.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk256.yellow(`, ${failed3} skipped`) : "")
46619
46735
  );
46620
46736
  }
46621
46737
  function selectCandidates(files, options2) {
@@ -46635,16 +46751,16 @@ function processSessions(files) {
46635
46751
  let failed3 = 0;
46636
46752
  for (let i = 0; i < files.length; i++) {
46637
46753
  const file = files[i];
46638
- process.stdout.write(chalk255.dim(` [${i + 1}/${files.length}] `));
46754
+ process.stdout.write(chalk256.dim(` [${i + 1}/${files.length}] `));
46639
46755
  const summary = summariseSession(file);
46640
46756
  if (summary) {
46641
46757
  writeSummary(file, summary);
46642
46758
  succeeded++;
46643
- process.stdout.write(`${chalk255.green("\u2713")} ${summary}
46759
+ process.stdout.write(`${chalk256.green("\u2713")} ${summary}
46644
46760
  `);
46645
46761
  } else {
46646
46762
  failed3++;
46647
- process.stdout.write(` ${chalk255.yellow("skip")}
46763
+ process.stdout.write(` ${chalk256.yellow("skip")}
46648
46764
  `);
46649
46765
  }
46650
46766
  }
@@ -46673,10 +46789,10 @@ function registerSessions(program2) {
46673
46789
  }
46674
46790
 
46675
46791
  // src/reportCliError.ts
46676
- import chalk256 from "chalk";
46792
+ import chalk257 from "chalk";
46677
46793
  function reportCliError(error) {
46678
46794
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
46679
- console.error(chalk256.red(error.message));
46795
+ console.error(chalk257.red(error.message));
46680
46796
  } else {
46681
46797
  console.error(error);
46682
46798
  }