@staff0rd/assist 0.979.1 → 0.981.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.979.1",
9
+ version: "0.981.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -183,10 +183,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
183
183
  }
184
184
  for (const name of entries) {
185
185
  if (!name.startsWith("upload-")) continue;
186
- const path108 = join2(dir, name);
186
+ const path109 = join2(dir, name);
187
187
  try {
188
- if (now - statSync(path108).mtimeMs > PANE_PERSIST_TTL_MS)
189
- rmSync(path108, { recursive: true, force: true });
188
+ if (now - statSync(path109).mtimeMs > PANE_PERSIST_TTL_MS)
189
+ rmSync(path109, { recursive: true, force: true });
190
190
  } catch {
191
191
  }
192
192
  }
@@ -487,9 +487,9 @@ function findGitLink(dir) {
487
487
  }
488
488
  return null;
489
489
  }
490
- function isFile(path108) {
490
+ function isFile(path109) {
491
491
  try {
492
- return statSync3(path108).isFile();
492
+ return statSync3(path109).isFile();
493
493
  } catch {
494
494
  return false;
495
495
  }
@@ -508,9 +508,9 @@ function linkedGitDirParent(gitDir) {
508
508
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
509
509
  return match ? match[1] : null;
510
510
  }
511
- function readTrimmed(path108) {
511
+ function readTrimmed(path109) {
512
512
  try {
513
- const content = readFileSync(path108, "utf8").trim();
513
+ const content = readFileSync(path109, "utf8").trim();
514
514
  return content === "" ? null : content;
515
515
  } catch {
516
516
  return null;
@@ -523,10 +523,10 @@ function absolute(target, from) {
523
523
  // src/shared/loadRawYaml.ts
524
524
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
525
525
  import { parse as parseYaml } from "yaml";
526
- function loadRawYaml(path108) {
527
- if (!existsSync2(path108)) return {};
526
+ function loadRawYaml(path109) {
527
+ if (!existsSync2(path109)) return {};
528
528
  try {
529
- const content = readFileSync2(path108, "utf8");
529
+ const content = readFileSync2(path109, "utf8");
530
530
  return parseYaml(content) || {};
531
531
  } catch {
532
532
  return {};
@@ -628,10 +628,10 @@ function getStorePath(filename) {
628
628
  return join5(getStoreDir(), filename);
629
629
  }
630
630
  function loadJson(filename) {
631
- const path108 = getStorePath(filename);
632
- if (existsSync3(path108)) {
631
+ const path109 = getStorePath(filename);
632
+ if (existsSync3(path109)) {
633
633
  try {
634
- return JSON.parse(readFileSync3(path108, "utf8"));
634
+ return JSON.parse(readFileSync3(path109, "utf8"));
635
635
  } catch {
636
636
  return {};
637
637
  }
@@ -643,11 +643,11 @@ function saveJson(filename, data) {
643
643
  if (!existsSync3(dir)) {
644
644
  mkdirSync2(dir, { recursive: true });
645
645
  }
646
- const path108 = getStorePath(filename);
647
- const tmp = `${path108}.${process.pid}.tmp`;
646
+ const path109 = getStorePath(filename);
647
+ const tmp = `${path109}.${process.pid}.tmp`;
648
648
  try {
649
649
  writeFileSync(tmp, JSON.stringify(data, null, 2));
650
- renameSync(tmp, path108);
650
+ renameSync(tmp, path109);
651
651
  } catch (error) {
652
652
  rmSync2(tmp, { force: true });
653
653
  throw error;
@@ -659,10 +659,10 @@ function repoConfigCachePath() {
659
659
  return join6(getStoreDir(), "repo-config-cache.json");
660
660
  }
661
661
  function readConfigCacheFile() {
662
- const path108 = repoConfigCachePath();
663
- if (!existsSync4(path108)) return {};
662
+ const path109 = repoConfigCachePath();
663
+ if (!existsSync4(path109)) return {};
664
664
  try {
665
- const parsed = JSON.parse(readFileSync4(path108, "utf8"));
665
+ const parsed = JSON.parse(readFileSync4(path109, "utf8"));
666
666
  return parsed ?? {};
667
667
  } catch {
668
668
  return {};
@@ -729,8 +729,8 @@ function getRemoteOriginUrl(cwd) {
729
729
 
730
730
  // src/commands/backlog/getCurrentOrigin.ts
731
731
  var WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
732
- function stripLeadingSlashes(path108) {
733
- return path108.replace(/^\/+/, "");
732
+ function stripLeadingSlashes(path109) {
733
+ return path109.replace(/^\/+/, "");
734
734
  }
735
735
  function normalizeOrigin(raw) {
736
736
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -773,8 +773,8 @@ function getCachedOrigin(cwd) {
773
773
  // src/commands/backlog/originDisplayName.ts
774
774
  function originDisplayName(origin) {
775
775
  if (origin.startsWith("local:")) {
776
- const path108 = origin.slice("local:".length).replace(/\/+$/, "");
777
- const segments = path108.split("/").filter(Boolean);
776
+ const path109 = origin.slice("local:".length).replace(/\/+$/, "");
777
+ const segments = path109.split("/").filter(Boolean);
778
778
  return segments[segments.length - 1] ?? origin;
779
779
  }
780
780
  const firstSlash = origin.indexOf("/");
@@ -2467,9 +2467,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
2467
2467
  function backupLocalBacklogFiles(dir) {
2468
2468
  const moved = [];
2469
2469
  for (const name of LOCAL_FILES) {
2470
- const path108 = join9(dir, ".assist", name);
2471
- if (existsSync9(path108)) {
2472
- renameSync2(path108, `${path108}.bak`);
2470
+ const path109 = join9(dir, ".assist", name);
2471
+ if (existsSync9(path109)) {
2472
+ renameSync2(path109, `${path109}.bak`);
2473
2473
  moved.push(`${name} \u2192 ${name}.bak`);
2474
2474
  }
2475
2475
  }
@@ -2917,8 +2917,8 @@ var backlogItemSchema = z7.strictObject({
2917
2917
  var backlogFileSchema = z7.array(backlogItemSchema);
2918
2918
 
2919
2919
  // src/commands/backlog/parseBacklogJsonl.ts
2920
- function parseBacklogJsonl(path108) {
2921
- const content = readFileSync5(path108, "utf8").trim();
2920
+ function parseBacklogJsonl(path109) {
2921
+ const content = readFileSync5(path109, "utf8").trim();
2922
2922
  if (content.length === 0) return [];
2923
2923
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
2924
2924
  }
@@ -4244,7 +4244,7 @@ async function browserRelay(req, res) {
4244
4244
  import { z as z8 } from "zod";
4245
4245
  var clientFailureSchema = z8.object({
4246
4246
  at: z8.string(),
4247
- kind: z8.enum(["error", "rejection"]).optional(),
4247
+ kind: z8.enum(["error", "rejection", "caught"]).optional(),
4248
4248
  method: z8.string(),
4249
4249
  path: z8.string(),
4250
4250
  base: z8.string(),
@@ -4258,9 +4258,14 @@ var clientErrorsSchema = z8.object({
4258
4258
  });
4259
4259
 
4260
4260
  // src/commands/sessions/web/clientErrors/clientErrors.ts
4261
+ var KIND_LABELS = {
4262
+ error: "uncaught error",
4263
+ rejection: "unhandled rejection",
4264
+ caught: "caught error"
4265
+ };
4261
4266
  function formatClientFailure(failure) {
4262
4267
  if (failure.kind)
4263
- return `client: ${failure.kind === "error" ? "uncaught error" : "unhandled rejection"} on ${failure.path}: ${failure.error ?? "unknown error"} at ${failure.at}`;
4268
+ return `client: ${KIND_LABELS[failure.kind]} on ${failure.path}: ${failure.error ?? "unknown error"} at ${failure.at}`;
4264
4269
  const target = failure.node ? `node=${failure.node} via ${failure.base}` : failure.base;
4265
4270
  const outcome = [
4266
4271
  failure.status === void 0 ? void 0 : `HTTP ${failure.status}`,
@@ -4290,10 +4295,10 @@ function completeLines(text18, windowIsPartial) {
4290
4295
  if (windowIsPartial) all.shift();
4291
4296
  return all;
4292
4297
  }
4293
- function readLogTail(path108, lines2) {
4298
+ function readLogTail(path109, lines2) {
4294
4299
  let fd;
4295
4300
  try {
4296
- fd = openSync2(path108, "r");
4301
+ fd = openSync2(path109, "r");
4297
4302
  } catch {
4298
4303
  return [];
4299
4304
  }
@@ -4559,8 +4564,8 @@ async function loadCommittedPaths(cwd, sessionId) {
4559
4564
  for (const commit2 of commits2) {
4560
4565
  const resolved = await resolveCommit(cwd, commit2.sha);
4561
4566
  if (!resolved) continue;
4562
- for (const path108 of resolved.paths) {
4563
- if (!bases.has(path108)) bases.set(path108, resolved.base);
4567
+ for (const path109 of resolved.paths) {
4568
+ if (!bases.has(path109)) bases.set(path109, resolved.base);
4564
4569
  }
4565
4570
  }
4566
4571
  return { commits: commits2, bases };
@@ -4578,16 +4583,16 @@ async function itemChangeSet(cwd, sessionId) {
4578
4583
  }
4579
4584
  function groupByBase(bases) {
4580
4585
  const groups = /* @__PURE__ */ new Map();
4581
- for (const [path108, base] of bases) {
4586
+ for (const [path109, base] of bases) {
4582
4587
  const paths = groups.get(base);
4583
- if (paths) paths.push(path108);
4584
- else groups.set(base, [path108]);
4588
+ if (paths) paths.push(path109);
4589
+ else groups.set(base, [path109]);
4585
4590
  }
4586
4591
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
4587
4592
  }
4588
4593
  async function dirtyPaths(cwd, bases) {
4589
4594
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
4590
- return output.split("\n").filter((path108) => path108 && !bases.has(path108)).sort();
4595
+ return output.split("\n").filter((path109) => path109 && !bases.has(path109)).sort();
4591
4596
  }
4592
4597
 
4593
4598
  // src/commands/sessions/web/scopedDiff.ts
@@ -4596,8 +4601,8 @@ async function scopedDiff(cwd, session, scope) {
4596
4601
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
4597
4602
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
4598
4603
  }
4599
- async function untrackedFileDiff(cwd, path108) {
4600
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path108], {
4604
+ async function untrackedFileDiff(cwd, path109) {
4605
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path109], {
4601
4606
  maxBuffer: MAX_DIFF_BYTES,
4602
4607
  allowFailure: true
4603
4608
  });
@@ -4610,7 +4615,7 @@ async function untrackedDiff(cwd) {
4610
4615
  ]);
4611
4616
  const paths = list7.split("\n").filter(Boolean);
4612
4617
  const diffs = await Promise.all(
4613
- paths.map((path108) => untrackedFileDiff(cwd, path108))
4618
+ paths.map((path109) => untrackedFileDiff(cwd, path109))
4614
4619
  );
4615
4620
  return diffs.join("");
4616
4621
  }
@@ -4819,9 +4824,9 @@ import { isAbsolute as isAbsolute2, relative, resolve as resolve4 } from "path";
4819
4824
  function repoRoot(cwd) {
4820
4825
  return resolve4(cwd);
4821
4826
  }
4822
- function resolveWithinCwd(cwd, path108) {
4827
+ function resolveWithinCwd(cwd, path109) {
4823
4828
  const root2 = repoRoot(cwd);
4824
- const target = resolve4(root2, path108);
4829
+ const target = resolve4(root2, path109);
4825
4830
  const rel = relative(root2, target);
4826
4831
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
4827
4832
  return target;
@@ -4831,14 +4836,14 @@ function resolveWithinCwd(cwd, path108) {
4831
4836
  function getFileTarget(req, res) {
4832
4837
  const cwd = getCwdParam(req, res);
4833
4838
  if (!cwd) return null;
4834
- const path108 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
4839
+ const path109 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
4835
4840
  "path"
4836
4841
  );
4837
- if (!path108) {
4842
+ if (!path109) {
4838
4843
  respondJson(res, 400, { error: "Missing path" });
4839
4844
  return null;
4840
4845
  }
4841
- const target = resolveWithinCwd(cwd, path108);
4846
+ const target = resolveWithinCwd(cwd, path109);
4842
4847
  if (!target) {
4843
4848
  respondJson(res, 400, { error: "Path outside cwd" });
4844
4849
  return null;
@@ -5375,9 +5380,9 @@ function segmentText(segment) {
5375
5380
  if (segment.kind === "index") return `[${segment.index}]`;
5376
5381
  return "[]";
5377
5382
  }
5378
- function formatConfigPath(path108) {
5383
+ function formatConfigPath(path109) {
5379
5384
  let text18 = "";
5380
- for (const segment of path108) {
5385
+ for (const segment of path109) {
5381
5386
  const dotted = segment.kind === "key" || segment.kind === "entry";
5382
5387
  const rendered = segmentText(segment);
5383
5388
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -5538,11 +5543,11 @@ function enumValues(node) {
5538
5543
  function opaqueConfigNode(inner, base) {
5539
5544
  return { ...base, kind: "other", type: leafTypeOf(inner) };
5540
5545
  }
5541
- function build(node, path108) {
5546
+ function build(node, path109) {
5542
5547
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
5543
5548
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
5544
5549
  const base = {
5545
- path: path108,
5550
+ path: path109,
5546
5551
  ...optional ? { optional: true } : {},
5547
5552
  ...defaultValue === void 0 ? {} : { defaultValue },
5548
5553
  ...secret ? { secret: true } : {}
@@ -5598,11 +5603,11 @@ function describeConfigLeaves(schema2) {
5598
5603
 
5599
5604
  // src/commands/config/globalConfigFileLabel.ts
5600
5605
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
5601
- function globalConfigFileLabel(path108) {
5602
- if (path108 === getGlobalConfigPath()) return "~/.assist.yml";
5603
- if (path108.startsWith(WINDOWS_MOUNT_PREFIX))
5604
- return `${path108} on the Windows host`;
5605
- return path108;
5606
+ function globalConfigFileLabel(path109) {
5607
+ if (path109 === getGlobalConfigPath()) return "~/.assist.yml";
5608
+ if (path109.startsWith(WINDOWS_MOUNT_PREFIX))
5609
+ return `${path109} on the Windows host`;
5610
+ return path109;
5606
5611
  }
5607
5612
 
5608
5613
  // src/shared/readUserConfigCache.ts
@@ -5660,35 +5665,35 @@ function isPlainRecord(value) {
5660
5665
  }
5661
5666
 
5662
5667
  // src/shared/mapConfigSecrets.ts
5663
- function mapChildren(value, path108, childNode, map) {
5668
+ function mapChildren(value, path109, childNode, map) {
5664
5669
  if (!isPlainRecord(value)) return value;
5665
5670
  return Object.fromEntries(
5666
5671
  Object.entries(value).map(([name, child]) => [
5667
5672
  name,
5668
- walk(child, [...path108, name], childNode(name), map)
5673
+ walk(child, [...path109, name], childNode(name), map)
5669
5674
  ])
5670
5675
  );
5671
5676
  }
5672
- function mapItems(value, path108, item, map) {
5677
+ function mapItems(value, path109, item, map) {
5673
5678
  if (!Array.isArray(value)) return value;
5674
- return value.map((entry, index2) => walk(entry, [...path108, index2], item, map));
5679
+ return value.map((entry, index2) => walk(entry, [...path109, index2], item, map));
5675
5680
  }
5676
- function walk(value, path108, node, map) {
5681
+ function walk(value, path109, node, map) {
5677
5682
  if (!node || value === void 0 || value === null) return value;
5678
- if (node.secret) return map(value, path108);
5683
+ if (node.secret) return map(value, path109);
5679
5684
  switch (node.kind) {
5680
5685
  case "object":
5681
5686
  case "unionOfObjects":
5682
5687
  return mapChildren(
5683
5688
  value,
5684
- path108,
5689
+ path109,
5685
5690
  (name) => configNodeField(node, name),
5686
5691
  map
5687
5692
  );
5688
5693
  case "objectList":
5689
- return mapItems(value, path108, node.item, map);
5694
+ return mapItems(value, path109, node.item, map);
5690
5695
  case "record":
5691
- return mapChildren(value, path108, () => node.value, map);
5696
+ return mapChildren(value, path109, () => node.value, map);
5692
5697
  default:
5693
5698
  return value;
5694
5699
  }
@@ -5713,9 +5718,9 @@ function isTraversable(value) {
5713
5718
  function stepInto(current, key) {
5714
5719
  return isTraversable(current) ? current[key] : void 0;
5715
5720
  }
5716
- function getNestedValue(obj, path108) {
5721
+ function getNestedValue(obj, path109) {
5717
5722
  let current = obj;
5718
- for (const key of path108.split(".")) current = stepInto(current, key);
5723
+ for (const key of path109.split(".")) current = stepInto(current, key);
5719
5724
  return current;
5720
5725
  }
5721
5726
 
@@ -5766,9 +5771,9 @@ function step(node, segment) {
5766
5771
  return void 0;
5767
5772
  }
5768
5773
  }
5769
- function findConfigNode(root2, path108) {
5774
+ function findConfigNode(root2, path109) {
5770
5775
  let current = root2;
5771
- for (const segment of path108) {
5776
+ for (const segment of path109) {
5772
5777
  if (!current) return void 0;
5773
5778
  current = step(current, segment);
5774
5779
  }
@@ -5785,34 +5790,34 @@ function nameSegment(name) {
5785
5790
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
5786
5791
  }
5787
5792
  function parseConfigPath(text18) {
5788
- const path108 = [];
5793
+ const path109 = [];
5789
5794
  let at2 = 0;
5790
5795
  while (at2 < text18.length) {
5791
5796
  if (text18[at2] === "[") {
5792
5797
  const close = text18.indexOf("]", at2);
5793
5798
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
5794
5799
  if (!segment) return void 0;
5795
- path108.push(segment);
5800
+ path109.push(segment);
5796
5801
  at2 = close + 1;
5797
5802
  continue;
5798
5803
  }
5799
5804
  if (text18[at2] === ".") {
5800
- if (path108.length === 0) return void 0;
5805
+ if (path109.length === 0) return void 0;
5801
5806
  at2 += 1;
5802
5807
  }
5803
5808
  const start2 = at2;
5804
5809
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
5805
5810
  const name = text18.slice(start2, at2);
5806
5811
  if (!name) return void 0;
5807
- path108.push(nameSegment(name));
5812
+ path109.push(nameSegment(name));
5808
5813
  }
5809
- return path108;
5814
+ return path109;
5810
5815
  }
5811
5816
 
5812
5817
  // src/commands/config/configEntryNode.ts
5813
5818
  function configEntryNode(root2, key) {
5814
- const path108 = parseConfigPath(key);
5815
- return path108 ? findConfigNode(root2, path108) : void 0;
5819
+ const path109 = parseConfigPath(key);
5820
+ return path109 ? findConfigNode(root2, path109) : void 0;
5816
5821
  }
5817
5822
 
5818
5823
  // src/commands/advise/adviceConfigHelp.ts
@@ -6675,8 +6680,8 @@ function stepIntoNested(container, key, nextKey) {
6675
6680
  }
6676
6681
  return ensureObject(container, resolved);
6677
6682
  }
6678
- function setNestedValue(obj, path108, value) {
6679
- const keys = path108.split(".");
6683
+ function setNestedValue(obj, path109, value) {
6684
+ const keys = path109.split(".");
6680
6685
  const result = { ...obj };
6681
6686
  let current = result;
6682
6687
  for (let i = 0; i < keys.length - 1; i++) {
@@ -6911,7 +6916,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
6911
6916
  const parent = dirname7(branchKeyPath);
6912
6917
  const branchPrefix = basename5(branchKeyPath);
6913
6918
  if (!existsSync15(parent)) return null;
6914
- const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join15(parent, name, "synthesis.md")).filter((path108) => existsSync15(path108)).map((path108) => ({ path: path108, mtime: statSync4(path108).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
6919
+ const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join15(parent, name, "synthesis.md")).filter((path109) => existsSync15(path109)).map((path109) => ({ path: path109, mtime: statSync4(path109).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
6915
6920
  return synthesisFiles[0]?.path ?? null;
6916
6921
  }
6917
6922
 
@@ -6941,12 +6946,12 @@ async function getReviewSynthesis(req, res) {
6941
6946
  const cwd = getCwdParam(req, res);
6942
6947
  if (!cwd) return;
6943
6948
  try {
6944
- const path108 = await resolveSynthesisPath(cwd);
6945
- if (!path108) {
6949
+ const path109 = await resolveSynthesisPath(cwd);
6950
+ if (!path109) {
6946
6951
  respondJson(res, 404, { error: "No synthesis found" });
6947
6952
  return;
6948
6953
  }
6949
- respondJson(res, 200, { synthesis: readFileSync6(path108, "utf8") });
6954
+ respondJson(res, 200, { synthesis: readFileSync6(path109, "utf8") });
6950
6955
  } catch {
6951
6956
  respondJson(res, 404, { error: "No synthesis found" });
6952
6957
  }
@@ -6968,19 +6973,19 @@ var execFileAsync5 = promisify5(execFile5);
6968
6973
  var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
6969
6974
  var REPO = /^[\w.-]+\/[\w.-]+$/;
6970
6975
  var SHA = /^[0-9a-f]{7,40}$/i;
6971
- function validPath(path108) {
6972
- return path108.length > 0 && !path108.startsWith("/") && path108.split("/").every((part) => part !== "" && part !== "..");
6976
+ function validPath(path109) {
6977
+ return path109.length > 0 && !path109.startsWith("/") && path109.split("/").every((part) => part !== "" && part !== "..");
6973
6978
  }
6974
6979
  async function githubFileContent(req, res) {
6975
6980
  const params = new URL(req.url ?? "/", "http://localhost").searchParams;
6976
6981
  const repo = params.get("repo") ?? "";
6977
6982
  const sha = params.get("sha") ?? "";
6978
- const path108 = params.get("path") ?? "";
6979
- if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path108)) {
6983
+ const path109 = params.get("path") ?? "";
6984
+ if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path109)) {
6980
6985
  respondJson(res, 400, { error: "Invalid repo, sha or path" });
6981
6986
  return;
6982
6987
  }
6983
- const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
6988
+ const encodedPath = path109.split("/").map(encodeURIComponent).join("/");
6984
6989
  try {
6985
6990
  const { stdout } = await execFileAsync5(
6986
6991
  "gh",
@@ -7147,8 +7152,8 @@ function parseDiffNameStatus(output) {
7147
7152
  if (!status2 || fields.length < 2) continue;
7148
7153
  const category = categorize(status2[0]);
7149
7154
  if (!category) continue;
7150
- const path108 = fields[fields.length - 1];
7151
- if (path108) result[category].push(path108);
7155
+ const path109 = fields[fields.length - 1];
7156
+ if (path109) result[category].push(path109);
7152
7157
  }
7153
7158
  return result;
7154
7159
  }
@@ -7486,24 +7491,24 @@ function getOwnerPath(itemId2) {
7486
7491
  function recordSignalOwner(itemId2) {
7487
7492
  const sessionId = process.env.ASSIST_SESSION_ID;
7488
7493
  if (!sessionId) return;
7489
- const path108 = getOwnerPath(itemId2);
7490
- mkdirSync4(dirname8(path108), { recursive: true });
7491
- writeFileSync3(path108, JSON.stringify({ sessionId }));
7494
+ const path109 = getOwnerPath(itemId2);
7495
+ mkdirSync4(dirname8(path109), { recursive: true });
7496
+ writeFileSync3(path109, JSON.stringify({ sessionId }));
7492
7497
  }
7493
7498
  function readSignalOwner(itemId2) {
7494
- const path108 = getOwnerPath(itemId2);
7495
- if (!existsSync16(path108)) return void 0;
7499
+ const path109 = getOwnerPath(itemId2);
7500
+ if (!existsSync16(path109)) return void 0;
7496
7501
  try {
7497
- const parsed = JSON.parse(readFileSync7(path108, "utf8"));
7502
+ const parsed = JSON.parse(readFileSync7(path109, "utf8"));
7498
7503
  return parsed.sessionId;
7499
7504
  } catch {
7500
7505
  return void 0;
7501
7506
  }
7502
7507
  }
7503
7508
  function clearSignalOwner(itemId2) {
7504
- const path108 = getOwnerPath(itemId2);
7509
+ const path109 = getOwnerPath(itemId2);
7505
7510
  try {
7506
- rmSync3(path108);
7511
+ rmSync3(path109);
7507
7512
  } catch {
7508
7513
  }
7509
7514
  }
@@ -7540,11 +7545,11 @@ function resolveSignalTarget(event, data) {
7540
7545
  function writeSignal(event, data) {
7541
7546
  const target = resolveSignalTarget(event, data);
7542
7547
  if (!target) return;
7543
- const path108 = getSignalPath(target);
7544
- if (!path108) return;
7548
+ const path109 = getSignalPath(target);
7549
+ if (!path109) return;
7545
7550
  const signal = { event, sessionId: target, ...data };
7546
- mkdirSync5(dirname9(path108), { recursive: true });
7547
- writeFileSync4(path108, JSON.stringify(signal));
7551
+ mkdirSync5(dirname9(path109), { recursive: true });
7552
+ writeFileSync4(path109, JSON.stringify(signal));
7548
7553
  }
7549
7554
 
7550
7555
  // src/commands/backlog/rewindItemToPhase.ts
@@ -8304,11 +8309,11 @@ function logLinkedRequest(req, res) {
8304
8309
  const started = Date.now();
8305
8310
  const from = req.headers[LINKED_FROM_HEADER2];
8306
8311
  const trace = req.headers[TRACE_HEADER] ?? "none";
8307
- const path108 = new URL(req.url ?? "/", "http://localhost").pathname;
8312
+ const path109 = new URL(req.url ?? "/", "http://localhost").pathname;
8308
8313
  res.once("finish", () => {
8309
- if (isQuietPoll(path108, res.statusCode)) return;
8314
+ if (isQuietPoll(path109, res.statusCode)) return;
8310
8315
  console.log(
8311
- `link-from ${from} http: ${req.method} ${path108} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
8316
+ `link-from ${from} http: ${req.method} ${path109} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
8312
8317
  );
8313
8318
  });
8314
8319
  }
@@ -8553,21 +8558,21 @@ function subsequenceScore(text18, query) {
8553
8558
  }
8554
8559
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
8555
8560
  }
8556
- function scoreFilePath(path108, query) {
8561
+ function scoreFilePath(path109, query) {
8557
8562
  const needle = query.trim().toLowerCase();
8558
8563
  if (!needle) return 0;
8559
- const basename36 = path108.slice(path108.lastIndexOf("/") + 1);
8564
+ const basename36 = path109.slice(path109.lastIndexOf("/") + 1);
8560
8565
  const inBasename = subsequenceScore(basename36, needle);
8561
8566
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
8562
- return subsequenceScore(path108, needle);
8567
+ return subsequenceScore(path109, needle);
8563
8568
  }
8564
8569
 
8565
8570
  // src/commands/sessions/web/rankFilePaths.ts
8566
8571
  function rankFilePaths(paths, query, limit) {
8567
8572
  const scored = [];
8568
- for (const path108 of paths) {
8569
- const score = scoreFilePath(path108, query);
8570
- if (score !== null) scored.push({ path: path108, score });
8573
+ for (const path109 of paths) {
8574
+ const score = scoreFilePath(path109, query);
8575
+ if (score !== null) scored.push({ path: path109, score });
8571
8576
  }
8572
8577
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
8573
8578
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -9963,8 +9968,8 @@ import { stat as stat2 } from "fs/promises";
9963
9968
 
9964
9969
  // src/shared/isStagedAttachmentPath.ts
9965
9970
  import { isAbsolute as isAbsolute3, relative as relative3, resolve as resolve9, sep } from "path";
9966
- function isStagedAttachmentPath(path108) {
9967
- const rel = relative3(stagedAttachmentsDir, resolve9(path108));
9971
+ function isStagedAttachmentPath(path109) {
9972
+ const rel = relative3(stagedAttachmentsDir, resolve9(path109));
9968
9973
  return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep}`) && !isAbsolute3(rel);
9969
9974
  }
9970
9975
 
@@ -9984,8 +9989,8 @@ var attachmentMimeTypes = {
9984
9989
  };
9985
9990
 
9986
9991
  // src/commands/sessions/web/attachmentContentType.ts
9987
- function attachmentContentType(path108) {
9988
- const ext = extname(path108).replace(/^\./, "").toLowerCase();
9992
+ function attachmentContentType(path109) {
9993
+ const ext = extname(path109).replace(/^\./, "").toLowerCase();
9989
9994
  const match = Object.entries(attachmentMimeTypes).find(([, e]) => e === ext);
9990
9995
  return match?.[0] ?? "application/octet-stream";
9991
9996
  }
@@ -9993,22 +9998,22 @@ function attachmentContentType(path108) {
9993
9998
  // src/commands/sessions/web/previewImage.ts
9994
9999
  async function previewImage(req, res) {
9995
10000
  const url = new URL(req.url ?? "/", "http://localhost");
9996
- const path108 = url.searchParams.get("path") ?? "";
9997
- if (!isStagedAttachmentPath(path108)) {
10001
+ const path109 = url.searchParams.get("path") ?? "";
10002
+ if (!isStagedAttachmentPath(path109)) {
9998
10003
  respondJson(res, 400, { error: "Not a staged attachment." });
9999
10004
  return;
10000
10005
  }
10001
- const info = await stat2(path108).catch(() => null);
10006
+ const info = await stat2(path109).catch(() => null);
10002
10007
  if (!info?.isFile()) {
10003
10008
  respondJson(res, 404, { error: "Attachment is no longer staged." });
10004
10009
  return;
10005
10010
  }
10006
10011
  res.writeHead(200, {
10007
- "Content-Type": attachmentContentType(path108),
10012
+ "Content-Type": attachmentContentType(path109),
10008
10013
  "Content-Length": info.size,
10009
10014
  "Cache-Control": "no-store"
10010
10015
  });
10011
- createReadStream2(path108).pipe(res);
10016
+ createReadStream2(path109).pipe(res);
10012
10017
  }
10013
10018
 
10014
10019
  // src/commands/sessions/web/getCurrentBranch.ts
@@ -10445,8 +10450,8 @@ async function liveDeployments(cwd, repo, environments) {
10445
10450
 
10446
10451
  // src/commands/sessions/web/releases/latestRun.ts
10447
10452
  async function latestRun(cwd, repo, workflow) {
10448
- const path108 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
10449
- const response = await ghJson(cwd, ["api", path108]);
10453
+ const path109 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
10454
+ const response = await ghJson(cwd, ["api", path109]);
10450
10455
  const run4 = response.workflow_runs?.[0];
10451
10456
  if (!run4) return null;
10452
10457
  return {
@@ -10741,36 +10746,36 @@ import { relative as relative4 } from "path";
10741
10746
  function git(cwd, args) {
10742
10747
  return execGit(cwd, ["--literal-pathspecs", ...args]);
10743
10748
  }
10744
- async function isTracked(cwd, path108) {
10749
+ async function isTracked(cwd, path109) {
10745
10750
  try {
10746
- await git(cwd, ["ls-files", "--error-unmatch", "--", path108]);
10751
+ await git(cwd, ["ls-files", "--error-unmatch", "--", path109]);
10747
10752
  return true;
10748
10753
  } catch {
10749
10754
  return false;
10750
10755
  }
10751
10756
  }
10752
- async function isInHead(cwd, path108) {
10753
- const listing = await git(cwd, ["ls-tree", "HEAD", "--", path108]);
10757
+ async function isInHead(cwd, path109) {
10758
+ const listing = await git(cwd, ["ls-tree", "HEAD", "--", path109]);
10754
10759
  return listing.trim().length > 0;
10755
10760
  }
10756
- async function hasChanges(cwd, path108) {
10761
+ async function hasChanges(cwd, path109) {
10757
10762
  const status2 = await git(cwd, [
10758
10763
  "status",
10759
10764
  "--porcelain",
10760
10765
  "-z",
10761
10766
  "--untracked-files=all",
10762
10767
  "--",
10763
- path108
10768
+ path109
10764
10769
  ]);
10765
10770
  return status2.length > 0;
10766
10771
  }
10767
- async function renameSources(cwd, path108) {
10772
+ async function renameSources(cwd, path109) {
10768
10773
  const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
10769
10774
  const sources = [];
10770
10775
  for (let i = 0; i < fields.length; ) {
10771
10776
  const status2 = fields[i];
10772
10777
  if (status2.startsWith("R")) {
10773
- if (fields[i + 2] === path108) sources.push(fields[i + 1]);
10778
+ if (fields[i + 2] === path109) sources.push(fields[i + 1]);
10774
10779
  i += 3;
10775
10780
  } else {
10776
10781
  i += status2.startsWith("C") ? 3 : 2;
@@ -10778,34 +10783,34 @@ async function renameSources(cwd, path108) {
10778
10783
  }
10779
10784
  return sources;
10780
10785
  }
10781
- async function restorePath(cwd, path108) {
10782
- if (await isInHead(cwd, path108)) {
10783
- await git(cwd, ["checkout", "HEAD", "--", path108]);
10786
+ async function restorePath(cwd, path109) {
10787
+ if (await isInHead(cwd, path109)) {
10788
+ await git(cwd, ["checkout", "HEAD", "--", path109]);
10784
10789
  return;
10785
10790
  }
10786
- if (await isTracked(cwd, path108)) {
10787
- await git(cwd, ["rm", "-f", "--", path108]);
10791
+ if (await isTracked(cwd, path109)) {
10792
+ await git(cwd, ["rm", "-f", "--", path109]);
10788
10793
  return;
10789
10794
  }
10790
- await git(cwd, ["clean", "-f", "--", path108]);
10795
+ await git(cwd, ["clean", "-f", "--", path109]);
10791
10796
  }
10792
- async function revertPathChanges(cwd, path108) {
10793
- if (!await hasChanges(cwd, path108))
10794
- throw new Error(`No uncommitted changes found for ${path108}`);
10795
- for (const target of [...await renameSources(cwd, path108), path108])
10797
+ async function revertPathChanges(cwd, path109) {
10798
+ if (!await hasChanges(cwd, path109))
10799
+ throw new Error(`No uncommitted changes found for ${path109}`);
10800
+ for (const target of [...await renameSources(cwd, path109), path109])
10796
10801
  await restorePath(cwd, target);
10797
- if (await hasChanges(cwd, path108))
10798
- throw new Error(`${path108} still has uncommitted changes`);
10802
+ if (await hasChanges(cwd, path109))
10803
+ throw new Error(`${path109} still has uncommitted changes`);
10799
10804
  }
10800
10805
 
10801
10806
  // src/commands/sessions/web/revertDiffFile.ts
10802
10807
  async function revertDiffFile(req, res) {
10803
10808
  const resolved = getFileTarget(req, res);
10804
10809
  if (!resolved) return;
10805
- const path108 = relative4(repoRoot(resolved.cwd), resolved.target);
10810
+ const path109 = relative4(repoRoot(resolved.cwd), resolved.target);
10806
10811
  try {
10807
- await revertPathChanges(resolved.cwd, path108);
10808
- respondJson(res, 200, { reverted: path108 });
10812
+ await revertPathChanges(resolved.cwd, path109);
10813
+ respondJson(res, 200, { reverted: path109 });
10809
10814
  } catch (error) {
10810
10815
  respondJson(res, 500, {
10811
10816
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -10917,7 +10922,7 @@ import { relative as relative5 } from "path";
10917
10922
  function requestedPaths(body) {
10918
10923
  const paths = body.paths;
10919
10924
  if (!Array.isArray(paths)) return null;
10920
- if (paths.some((path108) => typeof path108 !== "string")) return null;
10925
+ if (paths.some((path109) => typeof path109 !== "string")) return null;
10921
10926
  return paths;
10922
10927
  }
10923
10928
  async function revertDiffPaths(req, res) {
@@ -10937,10 +10942,10 @@ async function revertDiffPaths(req, res) {
10937
10942
  const root2 = repoRoot(cwd);
10938
10943
  const reverted = [];
10939
10944
  const failed3 = [];
10940
- for (const path108 of paths) {
10941
- const target = resolveWithinCwd(cwd, path108);
10945
+ for (const path109 of paths) {
10946
+ const target = resolveWithinCwd(cwd, path109);
10942
10947
  if (!target) {
10943
- failed3.push({ path: path108, error: "Path outside cwd" });
10948
+ failed3.push({ path: path109, error: "Path outside cwd" });
10944
10949
  continue;
10945
10950
  }
10946
10951
  const relativePath = relative5(root2, target);
@@ -10980,13 +10985,13 @@ function describePeerError(error) {
10980
10985
  const cause = error.cause;
10981
10986
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
10982
10987
  }
10983
- async function fetchPeerJson(baseUrl, path108, timeoutMs = PEER_TIMEOUT_MS) {
10984
- const res = await fetch(new URL(path108, baseUrl), {
10988
+ async function fetchPeerJson(baseUrl, path109, timeoutMs = PEER_TIMEOUT_MS) {
10989
+ const res = await fetch(new URL(path109, baseUrl), {
10985
10990
  signal: AbortSignal.timeout(timeoutMs)
10986
10991
  });
10987
10992
  if (!res.ok)
10988
10993
  throw Object.assign(
10989
- new Error(`GET ${path108} returned ${res.status} ${res.statusText}`),
10994
+ new Error(`GET ${path109} returned ${res.status} ${res.statusText}`),
10990
10995
  { status: res.status }
10991
10996
  );
10992
10997
  return await res.json();
@@ -11418,11 +11423,11 @@ function parseJson(raw) {
11418
11423
  }
11419
11424
  }
11420
11425
  function formatIssue(key, issue) {
11421
- const path108 = formatConfigPath([
11426
+ const path109 = formatConfigPath([
11422
11427
  { kind: "key", name: key },
11423
11428
  ...issue.path.map(toSegment)
11424
11429
  ]);
11425
- return `${path108}: ${issue.message}`;
11430
+ return `${path109}: ${issue.message}`;
11426
11431
  }
11427
11432
  function toSegment(part) {
11428
11433
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -11517,9 +11522,9 @@ function coerceUnion(key, raw, types) {
11517
11522
  }
11518
11523
 
11519
11524
  // src/shared/valueAtConfigPath.ts
11520
- function valueAtConfigPath(value, path108) {
11525
+ function valueAtConfigPath(value, path109) {
11521
11526
  let current = value;
11522
- for (const key of path108) {
11527
+ for (const key of path109) {
11523
11528
  if (typeof key === "number") {
11524
11529
  if (!Array.isArray(current)) return void 0;
11525
11530
  current = current[key];
@@ -11536,7 +11541,7 @@ function restoreConfigSecrets(value, stored, node) {
11536
11541
  return mapConfigSecrets(
11537
11542
  value,
11538
11543
  node,
11539
- (secret, path108) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path108) : secret
11544
+ (secret, path109) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path109) : secret
11540
11545
  );
11541
11546
  }
11542
11547
 
@@ -11565,8 +11570,8 @@ function formatIssue2(issue, key) {
11565
11570
  return issue.keys.map(
11566
11571
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
11567
11572
  );
11568
- const path108 = issue.path.length > 0 ? issue.path.join(".") : key;
11569
- return [`${path108}: ${issue.message}`];
11573
+ const path109 = issue.path.length > 0 ? issue.path.join(".") : key;
11574
+ return [`${path109}: ${issue.message}`];
11570
11575
  }
11571
11576
 
11572
11577
  // src/commands/config/applyConfigSet.ts
@@ -11663,16 +11668,16 @@ async function readUserConfig(orm) {
11663
11668
  import { mkdirSync as mkdirSync6, renameSync as renameSync3, writeFileSync as writeFileSync5 } from "fs";
11664
11669
  import { dirname as dirname12 } from "path";
11665
11670
  function writeRepoConfigCache(repos2, user = {}) {
11666
- const path108 = repoConfigCachePath();
11667
- mkdirSync6(dirname12(path108), { recursive: true });
11671
+ const path109 = repoConfigCachePath();
11672
+ mkdirSync6(dirname12(path109), { recursive: true });
11668
11673
  const cache7 = {
11669
11674
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
11670
11675
  repos: repos2,
11671
11676
  user
11672
11677
  };
11673
- const tmp = `${path108}.${process.pid}.tmp`;
11678
+ const tmp = `${path109}.${process.pid}.tmp`;
11674
11679
  writeFileSync5(tmp, JSON.stringify(cache7, null, 2));
11675
- renameSync3(tmp, path108);
11680
+ renameSync3(tmp, path109);
11676
11681
  }
11677
11682
 
11678
11683
  // src/shared/refreshRepoConfigCache.ts
@@ -11913,8 +11918,8 @@ function removeAt(container, keys) {
11913
11918
  }
11914
11919
  return removeFromChild(container, key, rest);
11915
11920
  }
11916
- function unsetNestedValue(obj, path108) {
11917
- const { container, removed } = removeAt(obj, path108.split("."));
11921
+ function unsetNestedValue(obj, path109) {
11922
+ const { container, removed } = removeAt(obj, path109.split("."));
11918
11923
  return { config: container, removed };
11919
11924
  }
11920
11925
 
@@ -12127,12 +12132,12 @@ var sessionsPrefix = "src/commands/sessions/";
12127
12132
  var restartRules = [
12128
12133
  {
12129
12134
  target: "webserver",
12130
- matches: (path108) => path108.startsWith(webUiPrefix),
12135
+ matches: (path109) => path109.startsWith(webUiPrefix),
12131
12136
  advice: "restart the web server, then hard-reload the browser tab"
12132
12137
  },
12133
12138
  {
12134
12139
  target: "daemon",
12135
- matches: (path108) => path108.startsWith(sessionsPrefix) && !path108.startsWith(webUiPrefix),
12140
+ matches: (path109) => path109.startsWith(sessionsPrefix) && !path109.startsWith(webUiPrefix),
12136
12141
  advice: "restart the daemon"
12137
12142
  }
12138
12143
  ];
@@ -12173,11 +12178,11 @@ import { basename as basename10, join as join26 } from "path";
12173
12178
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
12174
12179
  import { realpathSync } from "fs";
12175
12180
  import { resolve as resolve11 } from "path";
12176
- function canonicalTreePath(path108) {
12181
+ function canonicalTreePath(path109) {
12177
12182
  try {
12178
- return realpathSync(path108);
12183
+ return realpathSync(path109);
12179
12184
  } catch {
12180
- return resolve11(path108);
12185
+ return resolve11(path109);
12181
12186
  }
12182
12187
  }
12183
12188
 
@@ -13007,22 +13012,22 @@ function gitCommonDir(cwd) {
13007
13012
  var REGISTRY_FILE = "worktrees.json";
13008
13013
  function readWorktreeRegistry() {
13009
13014
  const data = loadJson(REGISTRY_FILE);
13010
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path108, record]) => ({ path: path108, ...record }));
13015
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path109, record]) => ({ path: path109, ...record }));
13011
13016
  }
13012
- function worktreeAttributionIncludingReaped(path108) {
13013
- const record = loadJson(REGISTRY_FILE)[path108];
13017
+ function worktreeAttributionIncludingReaped(path109) {
13018
+ const record = loadJson(REGISTRY_FILE)[path109];
13014
13019
  return record ? { clone: record.clone, origin: record.origin } : void 0;
13015
13020
  }
13016
- function recordWorktree(path108, clone, origin) {
13021
+ function recordWorktree(path109, clone, origin) {
13017
13022
  const data = loadJson(REGISTRY_FILE);
13018
- data[path108] = { clone, origin };
13023
+ data[path109] = { clone, origin };
13019
13024
  saveJson(REGISTRY_FILE, data);
13020
13025
  }
13021
- function forgetWorktree(path108) {
13026
+ function forgetWorktree(path109) {
13022
13027
  const data = loadJson(REGISTRY_FILE);
13023
- const record = data[path108];
13028
+ const record = data[path109];
13024
13029
  if (!record || record.reaped) return;
13025
- data[path108] = { ...record, reaped: true };
13030
+ data[path109] = { ...record, reaped: true };
13026
13031
  saveJson(REGISTRY_FILE, data);
13027
13032
  }
13028
13033
 
@@ -15092,9 +15097,9 @@ function toAnswers(value) {
15092
15097
  function toAttachments(value) {
15093
15098
  if (!Array.isArray(value)) return void 0;
15094
15099
  return value.flatMap((entry) => {
15095
- const { path: path108, alt, group } = entry ?? {};
15096
- if (typeof path108 !== "string" || path108 === "") return [];
15097
- const attachment = { path: path108, alt: typeof alt === "string" ? alt : "" };
15100
+ const { path: path109, alt, group } = entry ?? {};
15101
+ if (typeof path109 !== "string" || path109 === "") return [];
15102
+ const attachment = { path: path109, alt: typeof alt === "string" ? alt : "" };
15098
15103
  return [
15099
15104
  typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
15100
15105
  ];
@@ -15127,8 +15132,8 @@ function isReviewComment(value) {
15127
15132
  }
15128
15133
  function toReviewComments(value) {
15129
15134
  if (!Array.isArray(value)) return void 0;
15130
- return value.filter(isReviewComment).map(({ path: path108, startLine, endLine, quote, note, startSide, side }) => ({
15131
- path: path108,
15135
+ return value.filter(isReviewComment).map(({ path: path109, startLine, endLine, quote, note, startSide, side }) => ({
15136
+ path: path109,
15132
15137
  startLine,
15133
15138
  endLine,
15134
15139
  quote,
@@ -15934,8 +15939,8 @@ async function recordGitRef(db, itemId2, ref) {
15934
15939
  function gitRefUrl(kind, ref, cwd) {
15935
15940
  const repo = getPreferredRemoteRepo(cwd);
15936
15941
  if (!repo) return void 0;
15937
- const path108 = kind === "branch" ? "tree" : "commit";
15938
- return `https://github.com/${repo.org}/${repo.repo}/${path108}/${ref}`;
15942
+ const path109 = kind === "branch" ? "tree" : "commit";
15943
+ return `https://github.com/${repo.org}/${repo.repo}/${path109}/${ref}`;
15939
15944
  }
15940
15945
 
15941
15946
  // src/commands/sessions/shared/resolveSessionTranscript.ts
@@ -16304,9 +16309,9 @@ function originToSshUrl(origin) {
16304
16309
  const firstSlash = origin.indexOf("/");
16305
16310
  if (firstSlash <= 0) return null;
16306
16311
  const host = origin.slice(0, firstSlash);
16307
- const path108 = origin.slice(firstSlash + 1);
16308
- if (!path108) return null;
16309
- return `git@${host}:${path108}.git`;
16312
+ const path109 = origin.slice(firstSlash + 1);
16313
+ if (!path109) return null;
16314
+ return `git@${host}:${path109}.git`;
16310
16315
  }
16311
16316
 
16312
16317
  // src/commands/backlog/cloneRepo.ts
@@ -17977,10 +17982,10 @@ var hooksSettings = {
17977
17982
  }
17978
17983
  };
17979
17984
  function ensureHooksSettings() {
17980
- const path108 = daemonPaths.hooksSettings;
17981
- mkdirSync11(dirname25(path108), { recursive: true });
17982
- writeFileSync20(path108, JSON.stringify(hooksSettings, null, 2));
17983
- return path108;
17985
+ const path109 = daemonPaths.hooksSettings;
17986
+ mkdirSync11(dirname25(path109), { recursive: true });
17987
+ writeFileSync20(path109, JSON.stringify(hooksSettings, null, 2));
17988
+ return path109;
17984
17989
  }
17985
17990
 
17986
17991
  // src/shared/spawnInherit.ts
@@ -18328,10 +18333,10 @@ import { existsSync as existsSync42, unwatchFile, watchFile } from "fs";
18328
18333
  // src/commands/backlog/readSignal.ts
18329
18334
  import { existsSync as existsSync41, readFileSync as readFileSync25 } from "fs";
18330
18335
  function readSignal() {
18331
- const path108 = getSignalPath();
18332
- if (!path108 || !existsSync41(path108)) return void 0;
18336
+ const path109 = getSignalPath();
18337
+ if (!path109 || !existsSync41(path109)) return void 0;
18333
18338
  try {
18334
- return JSON.parse(readFileSync25(path108, "utf8"));
18339
+ return JSON.parse(readFileSync25(path109, "utf8"));
18335
18340
  } catch {
18336
18341
  return void 0;
18337
18342
  }
@@ -18530,13 +18535,13 @@ function activityPath(sessionId) {
18530
18535
  function emitActivity(activity2) {
18531
18536
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
18532
18537
  if (!sessionId) return;
18533
- const path108 = activityPath(sessionId);
18534
- mkdirSync13(dirname26(path108), { recursive: true });
18535
- writeFileSync22(path108, JSON.stringify({ ...activity2, startedAt: Date.now() }));
18538
+ const path109 = activityPath(sessionId);
18539
+ mkdirSync13(dirname26(path109), { recursive: true });
18540
+ writeFileSync22(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
18536
18541
  }
18537
- function readActivity(path108) {
18542
+ function readActivity(path109) {
18538
18543
  try {
18539
- return JSON.parse(readFileSync26(path108, "utf8"));
18544
+ return JSON.parse(readFileSync26(path109, "utf8"));
18540
18545
  } catch {
18541
18546
  return void 0;
18542
18547
  }
@@ -18546,9 +18551,9 @@ function reconcileActivity(sessionId, activity2) {
18546
18551
  removeActivity(sessionId);
18547
18552
  return;
18548
18553
  }
18549
- const path108 = activityPath(sessionId);
18550
- mkdirSync13(dirname26(path108), { recursive: true });
18551
- writeFileSync22(path108, JSON.stringify(activity2));
18554
+ const path109 = activityPath(sessionId);
18555
+ mkdirSync13(dirname26(path109), { recursive: true });
18556
+ writeFileSync22(path109, JSON.stringify(activity2));
18552
18557
  }
18553
18558
  function removeActivity(sessionId) {
18554
18559
  try {
@@ -20763,9 +20768,9 @@ function isGhGraphqlIssueMutation(command) {
20763
20768
  (m) => ISSUE_MUTATION.test(readOrEmpty(m[1]))
20764
20769
  );
20765
20770
  }
20766
- function readOrEmpty(path108) {
20771
+ function readOrEmpty(path109) {
20767
20772
  try {
20768
- return readFileSync27(path108, "utf8");
20773
+ return readFileSync27(path109, "utf8");
20769
20774
  } catch {
20770
20775
  return "";
20771
20776
  }
@@ -20878,13 +20883,13 @@ function findBuiltinDenyRaw(rawCommand) {
20878
20883
 
20879
20884
  // src/commands/cliHook/findRestrictedPathDeny.ts
20880
20885
  var RESTRICTED_PATHS = [".assist/restricted"];
20881
- function restrictedPathRegex(path108) {
20882
- const pattern2 = path108.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
20886
+ function restrictedPathRegex(path109) {
20887
+ const pattern2 = path109.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
20883
20888
  return new RegExp(pattern2);
20884
20889
  }
20885
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path108) => ({
20886
- path: path108,
20887
- regex: restrictedPathRegex(path108)
20890
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path109) => ({
20891
+ path: path109,
20892
+ regex: restrictedPathRegex(path109)
20888
20893
  }));
20889
20894
  function findRestrictedPathDenyRaw(rawCommand) {
20890
20895
  const rule = RESTRICTED_PATH_RULES.find(
@@ -21104,9 +21109,9 @@ var __dirname4 = dirname27(__filename3);
21104
21109
  function packageRoot() {
21105
21110
  return __dirname4;
21106
21111
  }
21107
- function readLines(path108) {
21108
- if (!existsSync44(path108)) return [];
21109
- return readFileSync28(path108, "utf8").split("\n").filter((line) => line.trim() !== "");
21112
+ function readLines(path109) {
21113
+ if (!existsSync44(path109)) return [];
21114
+ return readFileSync28(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
21110
21115
  }
21111
21116
  var cachedReads;
21112
21117
  var cachedWrites;
@@ -21704,14 +21709,14 @@ function showProgress(p, label) {
21704
21709
  const pct = Math.round(p.done / p.total * 100);
21705
21710
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label}...`);
21706
21711
  }
21707
- async function resolveCommand2(cli, path108, description, depth, p) {
21708
- showProgress(p, path108.join(" "));
21709
- const subHelp = await runHelp([cli, ...path108]);
21712
+ async function resolveCommand2(cli, path109, description, depth, p) {
21713
+ showProgress(p, path109.join(" "));
21714
+ const subHelp = await runHelp([cli, ...path109]);
21710
21715
  if (!subHelp || !hasSubcommands(subHelp)) {
21711
- return [{ path: path108, description }];
21716
+ return [{ path: path109, description }];
21712
21717
  }
21713
- const children = await discoverAt(cli, path108, depth + 1, p);
21714
- return children.length > 0 ? children : [{ path: path108, description }];
21718
+ const children = await discoverAt(cli, path109, depth + 1, p);
21719
+ return children.length > 0 ? children : [{ path: path109, description }];
21715
21720
  }
21716
21721
  async function discoverAt(cli, parentPath, depth, p) {
21717
21722
  if (depth > SAFETY_DEPTH) return [];
@@ -21859,9 +21864,9 @@ function logPath(cli) {
21859
21864
  return join51(homedir19(), ".assist", `cli-discover-${safeName}.log`);
21860
21865
  }
21861
21866
  function readCache(cli) {
21862
- const path108 = logPath(cli);
21863
- if (!existsSync46(path108)) return void 0;
21864
- return readFileSync30(path108, "utf8");
21867
+ const path109 = logPath(cli);
21868
+ if (!existsSync46(path109)) return void 0;
21869
+ return readFileSync30(path109, "utf8");
21865
21870
  }
21866
21871
  function writeCache(cli, output) {
21867
21872
  const dir = join51(homedir19(), ".assist");
@@ -22051,9 +22056,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
22051
22056
  }
22052
22057
  const cutoff = Date.now() - STALE_AFTER_MS;
22053
22058
  for (const entry of entries) {
22054
- const path108 = join53(dir, entry);
22059
+ const path109 = join53(dir, entry);
22055
22060
  try {
22056
- if (statSync7(path108).mtimeMs < cutoff) unlinkSync7(path108);
22061
+ if (statSync7(path109).mtimeMs < cutoff) unlinkSync7(path109);
22057
22062
  } catch {
22058
22063
  continue;
22059
22064
  }
@@ -22063,10 +22068,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
22063
22068
  // src/commands/codeComment/readPinState.ts
22064
22069
  import { existsSync as existsSync47, readFileSync as readFileSync31 } from "fs";
22065
22070
  function readPinState(pin2) {
22066
- const path108 = getPinStatePath(pin2);
22067
- if (!existsSync47(path108)) return void 0;
22071
+ const path109 = getPinStatePath(pin2);
22072
+ if (!existsSync47(path109)) return void 0;
22068
22073
  try {
22069
- const state = JSON.parse(readFileSync31(path108, "utf8"));
22074
+ const state = JSON.parse(readFileSync31(path109, "utf8"));
22070
22075
  if (state.pin !== pin2) return void 0;
22071
22076
  return state;
22072
22077
  } catch {
@@ -22496,8 +22501,8 @@ function findUnmergedPaths() {
22496
22501
  }
22497
22502
  const found = /* @__PURE__ */ new Set();
22498
22503
  for (const line of output.split("\n")) {
22499
- const path108 = line.split(" ")[1];
22500
- if (path108) found.add(path108.trim());
22504
+ const path109 = line.split(" ")[1];
22505
+ if (path109) found.add(path109.trim());
22501
22506
  }
22502
22507
  return [...found];
22503
22508
  }
@@ -22635,7 +22640,7 @@ function findStagedDocs() {
22635
22640
  return execSync28("git diff --cached --name-only --relative", {
22636
22641
  cwd: getProjectRoot(),
22637
22642
  encoding: "utf8"
22638
- }).split("\n").filter((path108) => path108.startsWith("docs/"));
22643
+ }).split("\n").filter((path109) => path109.startsWith("docs/"));
22639
22644
  }
22640
22645
  async function refuseLockedDocs() {
22641
22646
  const staged = findStagedDocs();
@@ -23585,8 +23590,8 @@ function diffRepoConfigLeaves(current, incoming) {
23585
23590
  }
23586
23591
  function leaves(node, prefix2 = "") {
23587
23592
  return Object.entries(node).flatMap(([key, value]) => {
23588
- const path108 = prefix2 ? `${prefix2}.${key}` : key;
23589
- return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path108) : [[path108, value]];
23593
+ const path109 = prefix2 ? `${prefix2}.${key}` : key;
23594
+ return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path109) : [[path109, value]];
23590
23595
  });
23591
23596
  }
23592
23597
  function isPlainObject4(value) {
@@ -24211,10 +24216,10 @@ async function browserSnapshot(options2) {
24211
24216
  op: "snapshot",
24212
24217
  url: options2.url
24213
24218
  });
24214
- const path108 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
24215
- mkdirSync17(dirname28(path108), { recursive: true });
24216
- writeFileSync27(path108, result.html);
24217
- console.log(`snapshot: ${path108}`);
24219
+ const path109 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
24220
+ mkdirSync17(dirname28(path109), { recursive: true });
24221
+ writeFileSync27(path109, result.html);
24222
+ console.log(`snapshot: ${path109}`);
24218
24223
  }
24219
24224
 
24220
24225
  // src/commands/browser/browserStatus.ts
@@ -24300,9 +24305,9 @@ async function loadPath(source) {
24300
24305
  }
24301
24306
  }
24302
24307
  async function extension() {
24303
- const path108 = await loadPath(extensionDir());
24308
+ const path109 = await loadPath(extensionDir());
24304
24309
  console.log(chalk147.bold("assist \u2014 GitHub browser extension"));
24305
- console.log(chalk147.dim(`load the unpacked extension from ${path108}`));
24310
+ console.log(chalk147.dim(`load the unpacked extension from ${path109}`));
24306
24311
  }
24307
24312
 
24308
24313
  // src/commands/extension/printExtensionUrl.ts
@@ -24418,7 +24423,7 @@ async function stageExtension(source, staging, version2) {
24418
24423
  await mkdir5(staging, { recursive: true });
24419
24424
  await cp3(source, staging, {
24420
24425
  recursive: true,
24421
- filter: (path108) => basename16(path108) !== "updates.json"
24426
+ filter: (path109) => basename16(path109) !== "updates.json"
24422
24427
  });
24423
24428
  const manifest = join60(staging, "manifest.json");
24424
24429
  const stamped = stampManifestVersion(
@@ -24499,10 +24504,10 @@ async function signExtension() {
24499
24504
  return;
24500
24505
  }
24501
24506
  await writeUpdateManifest(source, ARTIFACTS_DIR, version2);
24502
- const path108 = await signedAddonInstallPath(
24507
+ const path109 = await signedAddonInstallPath(
24503
24508
  await copySignedXpi(xpi, ARTIFACTS_DIR)
24504
24509
  );
24505
- console.log(chalk150.dim(`install the signed add-on from ${path108}`));
24510
+ console.log(chalk150.dim(`install the signed add-on from ${path109}`));
24506
24511
  }
24507
24512
 
24508
24513
  // src/commands/registerExtension.ts
@@ -24664,10 +24669,10 @@ function getMigrationApprovalPath(migrationId) {
24664
24669
  // src/commands/dbMigration/readMigrationPinState.ts
24665
24670
  import { existsSync as existsSync52, readFileSync as readFileSync34 } from "fs";
24666
24671
  function readMigrationPinState(pin2) {
24667
- const path108 = getMigrationPinPath(pin2);
24668
- if (!existsSync52(path108)) return void 0;
24672
+ const path109 = getMigrationPinPath(pin2);
24673
+ if (!existsSync52(path109)) return void 0;
24669
24674
  try {
24670
- const state = JSON.parse(readFileSync34(path108, "utf8"));
24675
+ const state = JSON.parse(readFileSync34(path109, "utf8"));
24671
24676
  if (state.pin !== pin2) return void 0;
24672
24677
  if (!Number.isInteger(state.migrationId)) return void 0;
24673
24678
  return state;
@@ -26593,10 +26598,10 @@ async function decideDocsGuard(input) {
26593
26598
  import { existsSync as existsSync58, unlinkSync as unlinkSync11 } from "fs";
26594
26599
  function consumeMigrationApproval(migrationId) {
26595
26600
  sweepRestrictedDir();
26596
- const path108 = getMigrationApprovalPath(migrationId);
26597
- if (!existsSync58(path108)) return false;
26601
+ const path109 = getMigrationApprovalPath(migrationId);
26602
+ if (!existsSync58(path109)) return false;
26598
26603
  try {
26599
- unlinkSync11(path108);
26604
+ unlinkSync11(path109);
26600
26605
  return true;
26601
26606
  } catch {
26602
26607
  return false;
@@ -27541,8 +27546,8 @@ function collectLabels(value, previous) {
27541
27546
  import { extname as extname3 } from "path";
27542
27547
 
27543
27548
  // src/commands/prs/screenshotReference.ts
27544
- function screenshotReference({ path: path108, alt }) {
27545
- const target = /\s/.test(path108) ? `<${path108}>` : path108;
27549
+ function screenshotReference({ path: path109, alt }) {
27550
+ const target = /\s/.test(path109) ? `<${path109}>` : path109;
27546
27551
  return `![${alt}](${target})`;
27547
27552
  }
27548
27553
 
@@ -28010,7 +28015,7 @@ async function reviewProposedIssue(title, body, metadata2 = []) {
28010
28015
 
28011
28016
  // src/commands/prs/attachArgs.ts
28012
28017
  function attachArgs(attachments) {
28013
- return attachments.flatMap(({ path: path108 }) => ["--attach", path108]);
28018
+ return attachments.flatMap(({ path: path109 }) => ["--attach", path109]);
28014
28019
  }
28015
28020
 
28016
28021
  // src/commands/prs/runGhWithAttachments.ts
@@ -28021,8 +28026,8 @@ import { basename as basename19 } from "path";
28021
28026
  import { rmSync as rmSync5 } from "fs";
28022
28027
  import { dirname as dirname31 } from "path";
28023
28028
  function removeStagedAttachments(attachments) {
28024
- for (const { path: path108 } of attachments) {
28025
- const dir = dirname31(path108);
28029
+ for (const { path: path109 } of attachments) {
28030
+ const dir = dirname31(path109);
28026
28031
  if (!isStagedAttachmentPath(dir)) continue;
28027
28032
  rmSync5(dir, { recursive: true, force: true });
28028
28033
  }
@@ -28032,7 +28037,7 @@ function removeStagedAttachments(attachments) {
28032
28037
  var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
28033
28038
  function reportPartialFailure(attachments, stderr) {
28034
28039
  const failed3 = attachments.filter(
28035
- ({ path: path108 }) => stderr.includes(path108) || stderr.includes(basename19(path108))
28040
+ ({ path: path109 }) => stderr.includes(path109) || stderr.includes(basename19(path109))
28036
28041
  );
28037
28042
  const named = failed3.length > 0 ? failed3 : attachments;
28038
28043
  console.error(
@@ -29190,13 +29195,13 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
29190
29195
  const registered = new Set(listWorktreePaths(clone));
29191
29196
  const branches = new Set(listLocalBranches(clone));
29192
29197
  const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename21(candidate));
29193
- const path108 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
29194
- const ready = addWorktree(clone, path108, strategy.trunk);
29198
+ const path109 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
29199
+ const ready = addWorktree(clone, path109, strategy.trunk);
29195
29200
  ready.catch(() => {
29196
29201
  });
29197
- return { path: path108, ready };
29202
+ return { path: path109, ready };
29198
29203
  }
29199
- async function addWorktree(clone, path108, trunk) {
29204
+ async function addWorktree(clone, path109, trunk) {
29200
29205
  const fetched = await gitResult(
29201
29206
  clone,
29202
29207
  ["fetch", "--quiet"],
@@ -29212,13 +29217,13 @@ async function addWorktree(clone, path108, trunk) {
29212
29217
  "add",
29213
29218
  start2.track ? "--track" : "--no-track",
29214
29219
  "-b",
29215
- basename21(path108),
29216
- path108,
29220
+ basename21(path109),
29221
+ path109,
29217
29222
  start2.ref
29218
29223
  ]);
29219
- recordWorktree(path108, clone, getCachedOrigin(clone));
29224
+ recordWorktree(path109, clone, getCachedOrigin(clone));
29220
29225
  daemonLog(
29221
- start2.track ? `worktree allocated ${path108} (branch ${basename21(path108)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path108} (branch ${basename21(path108)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
29226
+ start2.track ? `worktree allocated ${path109} (branch ${basename21(path109)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path109} (branch ${basename21(path109)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
29222
29227
  );
29223
29228
  }
29224
29229
 
@@ -29263,16 +29268,16 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
29263
29268
  `worktree.enabled is off for ${repoRoot2}, so every session shares this tree`
29264
29269
  );
29265
29270
  const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
29266
- const { path: path108, ready } = createWorktree(
29271
+ const { path: path109, ready } = createWorktree(
29267
29272
  clone,
29268
29273
  { root: cfg.root, trunk: cfg.trunk },
29269
29274
  boundTreeRoots2,
29270
29275
  options2.replacesTree
29271
29276
  );
29272
29277
  daemonLog(
29273
- `session spilled out of the clone ${clone} into ${path108}: worktree.enabled is on, so every session gets its own worktree`
29278
+ `session spilled out of the clone ${clone} into ${path109}: worktree.enabled is on, so every session gets its own worktree`
29274
29279
  );
29275
- return { cwd: path108, kind: "worktree", created: true, clone, ready };
29280
+ return { cwd: path109, kind: "worktree", created: true, clone, ready };
29276
29281
  }
29277
29282
 
29278
29283
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -29754,12 +29759,12 @@ async function reportCwdToDaemon(cwd) {
29754
29759
 
29755
29760
  // src/commands/sessions/daemon/worktree/worktreeWithBranch.ts
29756
29761
  function worktreeWithBranch(listing, branch2) {
29757
- let path108 = null;
29762
+ let path109 = null;
29758
29763
  for (const line of listing.split("\n")) {
29759
29764
  const trimmed = line.trim();
29760
29765
  if (trimmed.startsWith("worktree "))
29761
- path108 = trimmed.slice("worktree ".length).trim();
29762
- else if (trimmed === `branch refs/heads/${branch2}`) return path108;
29766
+ path109 = trimmed.slice("worktree ".length).trim();
29767
+ else if (trimmed === `branch refs/heads/${branch2}`) return path109;
29763
29768
  }
29764
29769
  return null;
29765
29770
  }
@@ -29769,8 +29774,8 @@ function worktreeHoldingBranch(cwd, branch2) {
29769
29774
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
29770
29775
  if (!listing) return null;
29771
29776
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
29772
- const path108 = worktreeWithBranch(listing, branch2);
29773
- return path108 && path108 !== here ? path108 : null;
29777
+ const path109 = worktreeWithBranch(listing, branch2);
29778
+ return path109 && path109 !== here ? path109 : null;
29774
29779
  }
29775
29780
 
29776
29781
  // src/commands/review/failCheckout.ts
@@ -30968,9 +30973,9 @@ function parseRscRows(flight) {
30968
30973
  }
30969
30974
  function makeRscResolver(rows) {
30970
30975
  return (ref) => {
30971
- const [id, ...path108] = ref.slice(1).replace(/^[L@]/, "").split(":");
30976
+ const [id, ...path109] = ref.slice(1).replace(/^[L@]/, "").split(":");
30972
30977
  let v = rows[id];
30973
- for (const key of path108) {
30978
+ for (const key of path109) {
30974
30979
  if (v == null || typeof v !== "object") return void 0;
30975
30980
  v = v[key];
30976
30981
  }
@@ -31759,18 +31764,18 @@ function validateLine(line) {
31759
31764
  process.exit(1);
31760
31765
  }
31761
31766
  }
31762
- async function comment2(path108, line, body, options2 = {}) {
31767
+ async function comment2(path109, line, body, options2 = {}) {
31763
31768
  const { startLine, skipPreview } = options2;
31764
31769
  validateBody(body);
31765
31770
  validateLine(line);
31766
31771
  if (startLine !== void 0) validateLine(startLine);
31767
31772
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
31768
31773
  if (!skipPreview)
31769
- await reviewProposedPrComment(`Comment on ${path108}:${range}`, body, null);
31774
+ await reviewProposedPrComment(`Comment on ${path109}:${range}`, body, null);
31770
31775
  try {
31771
31776
  const prId = getCurrentPrNodeId();
31772
- postReviewComment({ prId, body, path: path108, line, startLine });
31773
- console.log(`Added review comment on ${path108}:${range}`);
31777
+ postReviewComment({ prId, body, path: path109, line, startLine });
31778
+ console.log(`Added review comment on ${path109}:${range}`);
31774
31779
  } catch (error) {
31775
31780
  if (isGhNotInstalled(error)) {
31776
31781
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -32609,9 +32614,9 @@ function registerPrsComments(prsCommand) {
32609
32614
  internalCommand(
32610
32615
  prsCommand.command("comment <path> <line> <body>").description(
32611
32616
  "Add a line comment to the pending review (body of - reads it from stdin)"
32612
- ).action(async (path108, line, body) => {
32617
+ ).action(async (path109, line, body) => {
32613
32618
  await comment2(
32614
- path108,
32619
+ path109,
32615
32620
  Number.parseInt(line, 10),
32616
32621
  await readBodyArgument(body)
32617
32622
  );
@@ -32739,9 +32744,9 @@ function splitOnce(value, separator) {
32739
32744
  if (index2 === -1) return null;
32740
32745
  return [value.slice(0, index2), value.slice(index2 + separator.length)];
32741
32746
  }
32742
- function isFile2(path108) {
32747
+ function isFile2(path109) {
32743
32748
  try {
32744
- return statSync9(path108).isFile();
32749
+ return statSync9(path109).isFile();
32745
32750
  } catch {
32746
32751
  return false;
32747
32752
  }
@@ -32749,16 +32754,16 @@ function isFile2(path108) {
32749
32754
  function parseScreenshotSpec(spec) {
32750
32755
  const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
32751
32756
  const [group, caption] = splitOnce(label, "/") ?? ["", label];
32752
- const path108 = resolve24(rawPath.trim());
32753
- const ext = extname5(path108).replace(/^\./, "").toLowerCase();
32754
- if (!isFile2(path108))
32755
- throw new Error(`--screenshot '${spec}': file not found: ${path108}`);
32757
+ const path109 = resolve24(rawPath.trim());
32758
+ const ext = extname5(path109).replace(/^\./, "").toLowerCase();
32759
+ if (!isFile2(path109))
32760
+ throw new Error(`--screenshot '${spec}': file not found: ${path109}`);
32756
32761
  if (!ghAttachableExtensions.has(ext))
32757
32762
  throw new Error(
32758
32763
  `--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
32759
32764
  );
32760
- const alt = caption.trim() || basename23(path108, extname5(path108));
32761
- return group.trim() ? { path: path108, alt, group: group.trim() } : { path: path108, alt };
32765
+ const alt = caption.trim() || basename23(path109, extname5(path109));
32766
+ return group.trim() ? { path: path109, alt, group: group.trim() } : { path: path109, alt };
32762
32767
  }
32763
32768
 
32764
32769
  // src/commands/prs/parseScreenshotSpecs.ts
@@ -33931,11 +33936,11 @@ async function loadBody(target) {
33931
33936
  if (target.kind === "file") return readDraftFile(target.path);
33932
33937
  return fetchPrBody(target.number, target.repo);
33933
33938
  }
33934
- function readDraftFile(path108) {
33939
+ function readDraftFile(path109) {
33935
33940
  try {
33936
- return readFileSync47(path108, "utf8");
33941
+ return readFileSync47(path109, "utf8");
33937
33942
  } catch {
33938
- console.error(`Error: Could not read \`${path108}\`.`);
33943
+ console.error(`Error: Could not read \`${path109}\`.`);
33939
33944
  console.error(
33940
33945
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
33941
33946
  );
@@ -34215,10 +34220,10 @@ function resolveOpSecret(reference) {
34215
34220
  }
34216
34221
 
34217
34222
  // src/commands/ravendb/ravenFetch.ts
34218
- async function ravenFetch(connection, path108) {
34223
+ async function ravenFetch(connection, path109) {
34219
34224
  const apiKey = resolveOpSecret(connection.apiKeyRef);
34220
34225
  let accessToken = await getAccessToken(apiKey);
34221
- const url = `${connection.url}${path108}`;
34226
+ const url = `${connection.url}${path109}`;
34222
34227
  const headers = {
34223
34228
  Authorization: `Bearer ${accessToken}`,
34224
34229
  "Content-Type": "application/json"
@@ -34308,16 +34313,16 @@ import chalk211 from "chalk";
34308
34313
  // src/commands/ravendb/buildQueryPath.ts
34309
34314
  function buildQueryPath(opts) {
34310
34315
  const db = encodeURIComponent(opts.db);
34311
- let path108;
34316
+ let path109;
34312
34317
  if (opts.collection) {
34313
- path108 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
34318
+ path109 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
34314
34319
  } else {
34315
- path108 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
34320
+ path109 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
34316
34321
  }
34317
34322
  if (opts.query) {
34318
- path108 += `&query=${encodeURIComponent(opts.query)}`;
34323
+ path109 += `&query=${encodeURIComponent(opts.query)}`;
34319
34324
  }
34320
- return path108;
34325
+ return path109;
34321
34326
  }
34322
34327
 
34323
34328
  // src/commands/ravendb/fetchAllPages.ts
@@ -34326,7 +34331,7 @@ async function fetchAllPages(connection, opts) {
34326
34331
  let start2 = 0;
34327
34332
  while (true) {
34328
34333
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
34329
- const path108 = buildQueryPath({
34334
+ const path109 = buildQueryPath({
34330
34335
  db: connection.database,
34331
34336
  collection: opts.collection,
34332
34337
  start: start2,
@@ -34334,7 +34339,7 @@ async function fetchAllPages(connection, opts) {
34334
34339
  sort: opts.sort,
34335
34340
  query: opts.query
34336
34341
  });
34337
- const data = await ravenFetch(connection, path108);
34342
+ const data = await ravenFetch(connection, path109);
34338
34343
  const results = data.Results ?? [];
34339
34344
  const totalResults = data.TotalResults ?? 0;
34340
34345
  if (results.length === 0) break;
@@ -34938,10 +34943,103 @@ function runImportExtensionCheck() {
34938
34943
  );
34939
34944
  }
34940
34945
 
34941
- // src/commands/lint/lint/runStaticImportCheck.ts
34946
+ // src/commands/lint/lint/runSilentCatchCheck.ts
34942
34947
  import fs27 from "fs";
34948
+ import path46 from "path";
34949
+ import { Project as Project2 } from "ts-morph";
34950
+
34951
+ // src/commands/lint/lint/findSilentCatches.ts
34952
+ import {
34953
+ SyntaxKind as SyntaxKind5
34954
+ } from "ts-morph";
34955
+
34956
+ // src/commands/lint/lint/findSilentCatches/handlesCaughtError.ts
34957
+ import { SyntaxKind as SyntaxKind2 } from "ts-morph";
34958
+ var REPORTER = "reportCaughtError";
34959
+ function callsReporter(body) {
34960
+ return body.getDescendantsOfKind(SyntaxKind2.CallExpression).some((call) => call.getExpression().getText() === REPORTER);
34961
+ }
34962
+ function usesBinding(name, body) {
34963
+ if (!name) return false;
34964
+ return body.getDescendantsOfKind(SyntaxKind2.Identifier).some((id) => id.getText() === name);
34965
+ }
34966
+ function handlesCaughtError(name, body) {
34967
+ return callsReporter(body) || usesBinding(name, body);
34968
+ }
34969
+
34970
+ // src/commands/lint/lint/findSilentCatches/readsResponseBody.ts
34971
+ import { SyntaxKind as SyntaxKind3 } from "ts-morph";
34972
+ var BODY_READERS = /* @__PURE__ */ new Set(["json", "text"]);
34973
+ function readsResponseBody(receiver) {
34974
+ const method = receiver.asKind(SyntaxKind3.CallExpression)?.getExpression().asKind(SyntaxKind3.PropertyAccessExpression)?.getName();
34975
+ return method !== void 0 && BODY_READERS.has(method);
34976
+ }
34977
+
34978
+ // src/commands/lint/lint/findSilentCatches/silentCatchCallbacks.ts
34979
+ import { SyntaxKind as SyntaxKind4 } from "ts-morph";
34980
+ function silentCatchCallbacks(file) {
34981
+ return file.getDescendantsOfKind(SyntaxKind4.CallExpression).filter((call) => {
34982
+ const access = call.getExpression().asKind(SyntaxKind4.PropertyAccessExpression);
34983
+ if (access?.getName() !== "catch") return false;
34984
+ if (readsResponseBody(access.getExpression())) return false;
34985
+ const handler = call.getArguments()[0]?.asKind(SyntaxKind4.ArrowFunction) ?? call.getArguments()[0]?.asKind(SyntaxKind4.FunctionExpression);
34986
+ if (!handler) return false;
34987
+ const name = handler.getParameters()[0]?.getName();
34988
+ return !handlesCaughtError(name, handler.getBody());
34989
+ }).map(
34990
+ (call) => call.getExpressionIfKindOrThrow(SyntaxKind4.PropertyAccessExpression).getNameNode()
34991
+ );
34992
+ }
34993
+
34994
+ // src/commands/lint/lint/findSilentCatches.ts
34995
+ var CAPTURE_OPT_OUT = "capture: false";
34996
+ function awaitsRequest(clause) {
34997
+ const tryBlock = clause.getParentIfKindOrThrow(SyntaxKind5.TryStatement).getTryBlock();
34998
+ if (tryBlock.getText().includes(CAPTURE_OPT_OUT)) return false;
34999
+ return tryBlock.getDescendantsOfKind(SyntaxKind5.AwaitExpression).some((awaited) => !readsResponseBody(awaited.getExpression()));
35000
+ }
35001
+ function silentCatchClauses(file) {
35002
+ return file.getDescendantsOfKind(SyntaxKind5.CatchClause).filter((clause) => {
35003
+ const name = clause.getVariableDeclaration()?.getName();
35004
+ return awaitsRequest(clause) && !handlesCaughtError(name, clause.getBlock());
35005
+ });
35006
+ }
35007
+ function findSilentCatches(file) {
35008
+ const lines2 = file.getFullText().split("\n");
35009
+ return [...silentCatchClauses(file), ...silentCatchCallbacks(file)].map(
35010
+ (node) => ({
35011
+ filePath: file.getFilePath(),
35012
+ line: node.getStartLineNumber(),
35013
+ content: lines2[node.getStartLineNumber() - 1].trim()
35014
+ })
35015
+ );
35016
+ }
35017
+
35018
+ // src/commands/lint/lint/runSilentCatchCheck.ts
35019
+ var WEB_UI_DIR = "src/commands/sessions/web/ui";
35020
+ var REPORTER_DIR = path46.join(WEB_UI_DIR, "clientFailures");
35021
+ function runSilentCatchCheck() {
35022
+ const project = new Project2({ useInMemoryFileSystem: true });
35023
+ const violations = findSourceFiles2(WEB_UI_DIR, { includeTests: false }).filter((filePath) => !filePath.startsWith(REPORTER_DIR)).flatMap(
35024
+ (filePath) => findSilentCatches(
35025
+ project.createSourceFile(filePath, fs27.readFileSync(filePath, "utf8"))
35026
+ )
35027
+ ).map((violation) => ({
35028
+ ...violation,
35029
+ filePath: path46.relative("/", violation.filePath)
35030
+ }));
35031
+ return reportViolations2(
35032
+ violations,
35033
+ "Silent catch check",
35034
+ "Catch blocks in the web UI that drop an async error must call reportCaughtError(error, context) or surface the error.",
35035
+ "Silent catch check passed. No dropped async errors in the web UI."
35036
+ );
35037
+ }
35038
+
35039
+ // src/commands/lint/lint/runStaticImportCheck.ts
35040
+ import fs28 from "fs";
34943
35041
  function checkForDynamicImports(filePath) {
34944
- const content = fs27.readFileSync(filePath, "utf8");
35042
+ const content = fs28.readFileSync(filePath, "utf8");
34945
35043
  const lines2 = content.split("\n");
34946
35044
  const violations = [];
34947
35045
  const requirePattern = /\brequire\s*\(/;
@@ -34980,7 +35078,8 @@ function lint(options2 = {}) {
34980
35078
  const fileNamePassed = runFileNameCheck(options2.fix);
34981
35079
  const staticImportPassed = runStaticImportCheck();
34982
35080
  const importExtensionPassed = runImportExtensionCheck();
34983
- if (!fileNamePassed || !staticImportPassed || !importExtensionPassed) {
35081
+ const silentCatchPassed = runSilentCatchCheck();
35082
+ if (!fileNamePassed || !staticImportPassed || !importExtensionPassed || !silentCatchPassed) {
34984
35083
  process.exit(1);
34985
35084
  }
34986
35085
  }
@@ -35375,7 +35474,7 @@ async function statusLine() {
35375
35474
 
35376
35475
  // src/commands/update.ts
35377
35476
  import { execSync as execSync52 } from "child_process";
35378
- import * as path46 from "path";
35477
+ import * as path47 from "path";
35379
35478
 
35380
35479
  // src/commands/restartDaemonAfterUpdate.ts
35381
35480
  async function restartDaemonAfterUpdate() {
@@ -35394,12 +35493,12 @@ async function restartDaemonAfterUpdate() {
35394
35493
  // src/commands/update.ts
35395
35494
  function isGlobalNpmInstall(dir) {
35396
35495
  try {
35397
- const resolved = path46.resolve(dir);
35398
- if (resolved.split(path46.sep).includes("node_modules")) {
35496
+ const resolved = path47.resolve(dir);
35497
+ if (resolved.split(path47.sep).includes("node_modules")) {
35399
35498
  return true;
35400
35499
  }
35401
35500
  const globalPrefix = execSync52("npm prefix -g", { stdio: "pipe" }).toString().trim();
35402
- return resolved.toLowerCase().startsWith(path46.resolve(globalPrefix).toLowerCase());
35501
+ return resolved.toLowerCase().startsWith(path47.resolve(globalPrefix).toLowerCase());
35403
35502
  } catch {
35404
35503
  return false;
35405
35504
  }
@@ -35465,7 +35564,7 @@ function registerRootCommands(program) {
35465
35564
 
35466
35565
  // src/commands/refactor/check.ts
35467
35566
  import { spawn as spawn7 } from "child_process";
35468
- import * as path47 from "path";
35567
+ import * as path48 from "path";
35469
35568
 
35470
35569
  // src/commands/refactor/logViolations.ts
35471
35570
  import chalk222 from "chalk";
@@ -35524,17 +35623,17 @@ Refactor check failed:
35524
35623
 
35525
35624
  // src/commands/refactor/check/getViolations.ts
35526
35625
  import { execSync as execSync53 } from "child_process";
35527
- import fs29 from "fs";
35626
+ import fs30 from "fs";
35528
35627
  import { minimatch as minimatch3 } from "minimatch";
35529
35628
 
35530
35629
  // src/commands/refactor/check/getViolations/getIgnoredFiles.ts
35531
- import fs28 from "fs";
35630
+ import fs29 from "fs";
35532
35631
  var REFACTOR_YML_PATH = "refactor.yml";
35533
35632
  function parseRefactorYml() {
35534
- if (!fs28.existsSync(REFACTOR_YML_PATH)) {
35633
+ if (!fs29.existsSync(REFACTOR_YML_PATH)) {
35535
35634
  return [];
35536
35635
  }
35537
- const content = fs28.readFileSync(REFACTOR_YML_PATH, "utf8");
35636
+ const content = fs29.readFileSync(REFACTOR_YML_PATH, "utf8");
35538
35637
  const entries = [];
35539
35638
  const lines2 = content.split("\n");
35540
35639
  let currentEntry = {};
@@ -35564,7 +35663,7 @@ function getIgnoredFiles() {
35564
35663
 
35565
35664
  // src/commands/refactor/check/getViolations.ts
35566
35665
  function countLines(filePath) {
35567
- const content = fs29.readFileSync(filePath, "utf8");
35666
+ const content = fs30.readFileSync(filePath, "utf8");
35568
35667
  return content.split("\n").length;
35569
35668
  }
35570
35669
  function getGitFiles(options2) {
@@ -35642,7 +35741,7 @@ ${failed3.length} verify script(s) failed:`);
35642
35741
  async function runVerifyQuietly() {
35643
35742
  const result = findPackageJsonWithVerifyScripts(process.cwd());
35644
35743
  if (!result) return true;
35645
- const packageDir = path47.dirname(result.packageJsonPath);
35744
+ const packageDir = path48.dirname(result.packageJsonPath);
35646
35745
  const results = await Promise.all(
35647
35746
  result.verifyScripts.map((script) => runScript(script, packageDir))
35648
35747
  );
@@ -35668,22 +35767,22 @@ async function check(pattern2, options2) {
35668
35767
  }
35669
35768
 
35670
35769
  // src/commands/refactor/extract.ts
35671
- import path55 from "path";
35770
+ import path56 from "path";
35672
35771
  import chalk225 from "chalk";
35673
35772
 
35674
35773
  // src/commands/refactor/extract/applyExtraction.ts
35675
- import { SyntaxKind as SyntaxKind4 } from "ts-morph";
35774
+ import { SyntaxKind as SyntaxKind8 } from "ts-morph";
35676
35775
 
35677
35776
  // src/commands/refactor/extract/addImportPreservingSuppressions.ts
35678
35777
  import {
35679
- SyntaxKind as SyntaxKind2
35778
+ SyntaxKind as SyntaxKind6
35680
35779
  } from "ts-morph";
35681
35780
  var suppressionPattern = /^\s*(\/\/|\/\*)\s*oxlint-disable\b/;
35682
35781
  function countLeadingSuppressions(sourceFile) {
35683
35782
  let count10 = 0;
35684
35783
  for (const stmt of sourceFile.getStatementsWithComments()) {
35685
35784
  const kind = stmt.getKind();
35686
- if ((kind === SyntaxKind2.SingleLineCommentTrivia || kind === SyntaxKind2.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
35785
+ if ((kind === SyntaxKind6.SingleLineCommentTrivia || kind === SyntaxKind6.MultiLineCommentTrivia) && suppressionPattern.test(stmt.getText())) {
35687
35786
  count10++;
35688
35787
  } else {
35689
35788
  break;
@@ -35703,11 +35802,11 @@ function addImportPreservingSuppressions(sourceFile, structure) {
35703
35802
  }
35704
35803
 
35705
35804
  // src/commands/refactor/extract/removeStaleImports.ts
35706
- import { SyntaxKind as SyntaxKind3 } from "ts-morph";
35805
+ import { SyntaxKind as SyntaxKind7 } from "ts-morph";
35707
35806
  function collectReferencedNames(sourceFile) {
35708
35807
  const names = /* @__PURE__ */ new Set();
35709
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier)) {
35710
- if (id.getFirstAncestorByKind(SyntaxKind3.ImportDeclaration)) continue;
35808
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind7.Identifier)) {
35809
+ if (id.getFirstAncestorByKind(SyntaxKind7.ImportDeclaration)) continue;
35711
35810
  names.add(id.getText());
35712
35811
  }
35713
35812
  return names;
@@ -35759,7 +35858,7 @@ function updateImporters(functionName, sourceFile, importers) {
35759
35858
 
35760
35859
  // src/commands/refactor/extract/applyExtraction.ts
35761
35860
  function isNameReferencedInSource(sourceFile, name) {
35762
- return sourceFile.getDescendantsOfKind(SyntaxKind4.Identifier).some((id) => id.getText() === name);
35861
+ return sourceFile.getDescendantsOfKind(SyntaxKind8.Identifier).some((id) => id.getText() === name);
35763
35862
  }
35764
35863
  async function applyExtraction(functionName, sourceFile, destPath, plan2, project) {
35765
35864
  project.createSourceFile(destPath, plan2.destContent, { overwrite: false });
@@ -35800,19 +35899,19 @@ async function applyExtraction(functionName, sourceFile, destPath, plan2, projec
35800
35899
 
35801
35900
  // src/commands/refactor/extract/collectDependencies.ts
35802
35901
  import {
35803
- SyntaxKind as SyntaxKind8
35902
+ SyntaxKind as SyntaxKind12
35804
35903
  } from "ts-morph";
35805
35904
 
35806
35905
  // src/commands/refactor/extract/collectPrivateFunctions.ts
35807
- import { SyntaxKind as SyntaxKind5 } from "ts-morph";
35906
+ import { SyntaxKind as SyntaxKind9 } from "ts-morph";
35808
35907
  function isPrivate(fn) {
35809
35908
  return !fn.isExported() && !fn.isDefaultExport();
35810
35909
  }
35811
35910
  function getCalledFunctionNames(fn) {
35812
35911
  const names = /* @__PURE__ */ new Set();
35813
- for (const call of fn.getDescendantsOfKind(SyntaxKind5.CallExpression)) {
35912
+ for (const call of fn.getDescendantsOfKind(SyntaxKind9.CallExpression)) {
35814
35913
  const expr = call.getExpression();
35815
- if (expr.getKind() === SyntaxKind5.Identifier) {
35914
+ if (expr.getKind() === SyntaxKind9.Identifier) {
35816
35915
  names.add(expr.getText());
35817
35916
  }
35818
35917
  }
@@ -35840,10 +35939,10 @@ function collectPrivateFunctions(target, fnMap) {
35840
35939
  }
35841
35940
 
35842
35941
  // src/commands/refactor/extract/collectPrivateStatements.ts
35843
- import { SyntaxKind as SyntaxKind6 } from "ts-morph";
35942
+ import { SyntaxKind as SyntaxKind10 } from "ts-morph";
35844
35943
  function getReferencedIdentifiers(fn) {
35845
35944
  const names = /* @__PURE__ */ new Set();
35846
- for (const id of fn.getDescendantsOfKind(SyntaxKind6.Identifier)) {
35945
+ for (const id of fn.getDescendantsOfKind(SyntaxKind10.Identifier)) {
35847
35946
  names.add(id.getText());
35848
35947
  }
35849
35948
  return names;
@@ -35861,12 +35960,12 @@ function collectPrivateStatements(functions, stmtMap) {
35861
35960
 
35862
35961
  // src/commands/refactor/extract/getFunctionMap.ts
35863
35962
  import {
35864
- SyntaxKind as SyntaxKind7
35963
+ SyntaxKind as SyntaxKind11
35865
35964
  } from "ts-morph";
35866
35965
  function getFunctionMap(sourceFile) {
35867
35966
  const map = /* @__PURE__ */ new Map();
35868
35967
  for (const fn of sourceFile.getDescendantsOfKind(
35869
- SyntaxKind7.FunctionDeclaration
35968
+ SyntaxKind11.FunctionDeclaration
35870
35969
  )) {
35871
35970
  const name = fn.getName();
35872
35971
  if (name) map.set(name, fn);
@@ -35892,7 +35991,7 @@ function getPrivateStatementMap(sourceFile) {
35892
35991
 
35893
35992
  // src/commands/refactor/extract/collectDependencies.ts
35894
35993
  function getRemainingFunctions(sourceFile, extracted) {
35895
- return sourceFile.getDescendantsOfKind(SyntaxKind8.FunctionDeclaration).filter((fn) => !extracted.has(fn));
35994
+ return sourceFile.getDescendantsOfKind(SyntaxKind12.FunctionDeclaration).filter((fn) => !extracted.has(fn));
35896
35995
  }
35897
35996
  function collectFnsUsedByRemaining(remaining, fnMap) {
35898
35997
  const used = /* @__PURE__ */ new Set();
@@ -35926,14 +36025,14 @@ function collectDependencies(target, sourceFile) {
35926
36025
  }
35927
36026
 
35928
36027
  // src/commands/refactor/extract/findTarget.ts
35929
- import { SyntaxKind as SyntaxKind10 } from "ts-morph";
36028
+ import { SyntaxKind as SyntaxKind14 } from "ts-morph";
35930
36029
 
35931
36030
  // src/commands/refactor/extract/findFunction.ts
35932
36031
  import {
35933
- SyntaxKind as SyntaxKind9
36032
+ SyntaxKind as SyntaxKind13
35934
36033
  } from "ts-morph";
35935
36034
  function findFunction(sourceFile, functionName) {
35936
- return sourceFile.getDescendantsOfKind(SyntaxKind9.FunctionDeclaration).find((fn) => fn.getName() === functionName);
36035
+ return sourceFile.getDescendantsOfKind(SyntaxKind13.FunctionDeclaration).find((fn) => fn.getName() === functionName);
35937
36036
  }
35938
36037
 
35939
36038
  // src/commands/refactor/extract/findTarget.ts
@@ -35945,7 +36044,7 @@ function findTarget(sourceFile, name) {
35945
36044
  if (decl.getName() !== name) continue;
35946
36045
  const init7 = decl.getInitializer();
35947
36046
  const kind = init7?.getKind();
35948
- if (kind === SyntaxKind10.ArrowFunction || kind === SyntaxKind10.FunctionExpression) {
36047
+ if (kind === SyntaxKind14.ArrowFunction || kind === SyntaxKind14.FunctionExpression) {
35949
36048
  return stmt;
35950
36049
  }
35951
36050
  }
@@ -35954,18 +36053,18 @@ function findTarget(sourceFile, name) {
35954
36053
  }
35955
36054
 
35956
36055
  // src/commands/refactor/extract/getExportedDependencyNames.ts
35957
- import { SyntaxKind as SyntaxKind11 } from "ts-morph";
36056
+ import { SyntaxKind as SyntaxKind15 } from "ts-morph";
35958
36057
  function getExportedDependencyNames(target, sourceFile) {
35959
36058
  const calledNames = /* @__PURE__ */ new Set();
35960
- for (const call of target.getDescendantsOfKind(SyntaxKind11.CallExpression)) {
36059
+ for (const call of target.getDescendantsOfKind(SyntaxKind15.CallExpression)) {
35961
36060
  const expr = call.getExpression();
35962
- if (expr.getKind() === SyntaxKind11.Identifier) {
36061
+ if (expr.getKind() === SyntaxKind15.Identifier) {
35963
36062
  calledNames.add(expr.getText());
35964
36063
  }
35965
36064
  }
35966
36065
  const exported = [];
35967
36066
  for (const fn of sourceFile.getDescendantsOfKind(
35968
- SyntaxKind11.FunctionDeclaration
36067
+ SyntaxKind15.FunctionDeclaration
35969
36068
  )) {
35970
36069
  const name = fn.getName();
35971
36070
  if (name && calledNames.has(name) && fn.isExported()) {
@@ -35976,9 +36075,9 @@ function getExportedDependencyNames(target, sourceFile) {
35976
36075
  }
35977
36076
 
35978
36077
  // src/commands/refactor/extract/getStatementNames.ts
35979
- import { SyntaxKind as SyntaxKind12 } from "ts-morph";
36078
+ import { SyntaxKind as SyntaxKind16 } from "ts-morph";
35980
36079
  function getStatementNames(node) {
35981
- if (node.getKind() === SyntaxKind12.VariableStatement) {
36080
+ if (node.getKind() === SyntaxKind16.VariableStatement) {
35982
36081
  const stmt = node;
35983
36082
  return stmt.getDeclarations().map((d) => d.getName());
35984
36083
  }
@@ -35989,7 +36088,7 @@ function getStatementNames(node) {
35989
36088
  // src/commands/refactor/extract/resolveImports.ts
35990
36089
  import {
35991
36090
  Node,
35992
- SyntaxKind as SyntaxKind13
36091
+ SyntaxKind as SyntaxKind17
35993
36092
  } from "ts-morph";
35994
36093
 
35995
36094
  // src/commands/refactor/extract/matchImport.ts
@@ -36042,7 +36141,7 @@ function matchImport(importDecl, neededNames) {
36042
36141
  function getReferencedNames(nodes) {
36043
36142
  const names = /* @__PURE__ */ new Set();
36044
36143
  for (const node of nodes) {
36045
- for (const id of node.getDescendantsOfKind(SyntaxKind13.Identifier)) {
36144
+ for (const id of node.getDescendantsOfKind(SyntaxKind17.Identifier)) {
36046
36145
  names.add(id.getText());
36047
36146
  }
36048
36147
  }
@@ -36055,11 +36154,11 @@ function getLocallyDeclaredNames(nodes) {
36055
36154
  const name = node.getName();
36056
36155
  if (name) names.add(name);
36057
36156
  }
36058
- for (const param of node.getDescendantsOfKind(SyntaxKind13.Parameter)) {
36157
+ for (const param of node.getDescendantsOfKind(SyntaxKind17.Parameter)) {
36059
36158
  names.add(param.getName());
36060
36159
  }
36061
36160
  for (const varDecl of node.getDescendantsOfKind(
36062
- SyntaxKind13.VariableDeclaration
36161
+ SyntaxKind17.VariableDeclaration
36063
36162
  )) {
36064
36163
  names.add(varDecl.getName());
36065
36164
  }
@@ -36154,9 +36253,9 @@ function buildDestinationContent(functionTexts, imports, sourceRelativePath, sou
36154
36253
  }
36155
36254
 
36156
36255
  // src/commands/refactor/extract/getRelativeImportPath.ts
36157
- import path48 from "path";
36256
+ import path49 from "path";
36158
36257
  function getRelativeImportPath(from, to) {
36159
- let rel = path48.relative(path48.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
36258
+ let rel = path49.relative(path49.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
36160
36259
  if (!rel.startsWith(".")) rel = `./${rel}`;
36161
36260
  return rel;
36162
36261
  }
@@ -36180,9 +36279,9 @@ function findImporters(functionName, sourceFile, destPath, project) {
36180
36279
  }
36181
36280
 
36182
36281
  // src/commands/refactor/extract/resolveBarrel.ts
36183
- import path49 from "path";
36282
+ import path50 from "path";
36184
36283
  function resolveBarrel(functionName, sourcePath, destPath, project) {
36185
- const indexPath = path49.join(path49.dirname(destPath), "index.ts");
36284
+ const indexPath = path50.join(path50.dirname(destPath), "index.ts");
36186
36285
  const barrel = project.getSourceFile(indexPath);
36187
36286
  if (!barrel) return { barrel: void 0, barrelRelPath: "" };
36188
36287
  const sourceRelFromBarrel = getRelativeImportPath(indexPath, sourcePath);
@@ -36200,31 +36299,31 @@ function resolveBarrel(functionName, sourcePath, destPath, project) {
36200
36299
  }
36201
36300
 
36202
36301
  // src/commands/refactor/extract/rewriteImportPaths.ts
36203
- import path50 from "path";
36302
+ import path51 from "path";
36204
36303
  function rewriteImportPaths(imports, sourcePath, destPath) {
36205
- const sourceDir = path50.dirname(sourcePath);
36206
- const destDir = path50.dirname(destPath);
36304
+ const sourceDir = path51.dirname(sourcePath);
36305
+ const destDir = path51.dirname(destPath);
36207
36306
  return imports.map((imp) => {
36208
36307
  if (!imp.moduleSpecifier.startsWith(".")) return imp;
36209
- const absolute2 = path50.resolve(sourceDir, imp.moduleSpecifier);
36210
- let rel = path50.relative(destDir, absolute2).replace(/\\/g, "/");
36211
- if (rel === "") rel = `../${path50.basename(absolute2)}`;
36308
+ const absolute2 = path51.resolve(sourceDir, imp.moduleSpecifier);
36309
+ let rel = path51.relative(destDir, absolute2).replace(/\\/g, "/");
36310
+ if (rel === "") rel = `../${path51.basename(absolute2)}`;
36212
36311
  else if (!rel.startsWith(".")) rel = `./${rel}`;
36213
36312
  return { ...imp, moduleSpecifier: rel };
36214
36313
  });
36215
36314
  }
36216
36315
 
36217
36316
  // src/commands/refactor/extract/sourceReferencesName.ts
36218
- import { SyntaxKind as SyntaxKind14 } from "ts-morph";
36317
+ import { SyntaxKind as SyntaxKind18 } from "ts-morph";
36219
36318
  var DECLARATION_KINDS = /* @__PURE__ */ new Set([
36220
- SyntaxKind14.FunctionDeclaration,
36221
- SyntaxKind14.ImportSpecifier,
36222
- SyntaxKind14.ExportSpecifier
36319
+ SyntaxKind18.FunctionDeclaration,
36320
+ SyntaxKind18.ImportSpecifier,
36321
+ SyntaxKind18.ExportSpecifier
36223
36322
  ]);
36224
36323
  function isInsideExtractedFunction(node, extracted) {
36225
36324
  let current = node;
36226
36325
  while (current) {
36227
- if (current.getKind() !== SyntaxKind14.FunctionDeclaration) {
36326
+ if (current.getKind() !== SyntaxKind18.FunctionDeclaration) {
36228
36327
  current = current.getParent();
36229
36328
  continue;
36230
36329
  }
@@ -36236,7 +36335,7 @@ function isInsideExtractedFunction(node, extracted) {
36236
36335
  }
36237
36336
  function sourceReferencesName(sourceFile, functionName, extractedNames) {
36238
36337
  const extracted = new Set(extractedNames);
36239
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind14.Identifier)) {
36338
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind18.Identifier)) {
36240
36339
  if (id.getText() !== functionName) continue;
36241
36340
  const parent = id.getParent();
36242
36341
  if (!parent || DECLARATION_KINDS.has(parent.getKind())) continue;
@@ -36276,7 +36375,7 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
36276
36375
  }
36277
36376
 
36278
36377
  // src/commands/refactor/extract/displayPlan.ts
36279
- import path51 from "path";
36378
+ import path52 from "path";
36280
36379
  import chalk223 from "chalk";
36281
36380
  function section(title) {
36282
36381
  return `
@@ -36286,7 +36385,7 @@ function displayImporters(plan2, cwd) {
36286
36385
  if (plan2.importersToUpdate.length === 0) return;
36287
36386
  console.log(section("Update importers:"));
36288
36387
  for (const imp of plan2.importersToUpdate) {
36289
- const rel = path51.relative(cwd, imp.file.getFilePath());
36388
+ const rel = path52.relative(cwd, imp.file.getFilePath());
36290
36389
  console.log(` ${chalk223.dim(rel)}: \u2192 import from "${imp.relPath}"`);
36291
36390
  }
36292
36391
  }
@@ -36326,23 +36425,23 @@ function displayPlan(functionName, relDest, plan2, cwd) {
36326
36425
  }
36327
36426
 
36328
36427
  // src/commands/refactor/extract/loadProjectFile.ts
36329
- import path54 from "path";
36428
+ import path55 from "path";
36330
36429
  import chalk224 from "chalk";
36331
- import { Project as Project3 } from "ts-morph";
36430
+ import { Project as Project4 } from "ts-morph";
36332
36431
 
36333
36432
  // src/commands/refactor/extract/findTsConfig.ts
36334
- import fs31 from "fs";
36335
- import path53 from "path";
36433
+ import fs32 from "fs";
36434
+ import path54 from "path";
36336
36435
 
36337
36436
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
36338
- import fs30 from "fs";
36339
- import path52 from "path";
36437
+ import fs31 from "fs";
36438
+ import path53 from "path";
36340
36439
 
36341
36440
  // src/commands/refactor/extract/projectIncludesFile.ts
36342
- import { Project as Project2 } from "ts-morph";
36441
+ import { Project as Project3 } from "ts-morph";
36343
36442
  function projectIncludesFile(configPath, sourcePath) {
36344
36443
  try {
36345
- const project = new Project2({ tsConfigFilePath: configPath });
36444
+ const project = new Project3({ tsConfigFilePath: configPath });
36346
36445
  return !!project.getSourceFile(sourcePath);
36347
36446
  } catch {
36348
36447
  return false;
@@ -36351,16 +36450,16 @@ function projectIncludesFile(configPath, sourcePath) {
36351
36450
 
36352
36451
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
36353
36452
  function findEnclosingTsConfig(sourcePath, rootDir, tried) {
36354
- let dir = path52.dirname(sourcePath);
36355
- while (dir.startsWith(rootDir + path52.sep) && dir !== rootDir) {
36356
- const nested = path52.join(dir, "tsconfig.json");
36453
+ let dir = path53.dirname(sourcePath);
36454
+ while (dir.startsWith(rootDir + path53.sep) && dir !== rootDir) {
36455
+ const nested = path53.join(dir, "tsconfig.json");
36357
36456
  if (!tried.has(nested)) {
36358
36457
  tried.add(nested);
36359
- if (fs30.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
36458
+ if (fs31.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
36360
36459
  return nested;
36361
36460
  }
36362
36461
  }
36363
- const parent = path52.dirname(dir);
36462
+ const parent = path53.dirname(dir);
36364
36463
  if (parent === dir) break;
36365
36464
  dir = parent;
36366
36465
  }
@@ -36369,8 +36468,8 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
36369
36468
 
36370
36469
  // src/commands/refactor/extract/findTsConfig.ts
36371
36470
  function findTsConfig(sourcePath) {
36372
- const rootConfig = path53.resolve("tsconfig.json");
36373
- if (!fs31.existsSync(rootConfig)) return rootConfig;
36471
+ const rootConfig = path54.resolve("tsconfig.json");
36472
+ if (!fs32.existsSync(rootConfig)) return rootConfig;
36374
36473
  const tried = /* @__PURE__ */ new Set();
36375
36474
  const candidates = [rootConfig, ...readReferences(rootConfig)];
36376
36475
  for (const candidate of candidates) {
@@ -36378,7 +36477,7 @@ function findTsConfig(sourcePath) {
36378
36477
  tried.add(candidate);
36379
36478
  if (projectIncludesFile(candidate, sourcePath)) return candidate;
36380
36479
  }
36381
- const siblings = fs31.readdirSync(path53.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path53.resolve(path53.dirname(rootConfig), f));
36480
+ const siblings = fs32.readdirSync(path54.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path54.resolve(path54.dirname(rootConfig), f));
36382
36481
  for (const sibling of siblings) {
36383
36482
  if (tried.has(sibling)) continue;
36384
36483
  tried.add(sibling);
@@ -36386,15 +36485,15 @@ function findTsConfig(sourcePath) {
36386
36485
  }
36387
36486
  const nested = findEnclosingTsConfig(
36388
36487
  sourcePath,
36389
- path53.dirname(rootConfig),
36488
+ path54.dirname(rootConfig),
36390
36489
  tried
36391
36490
  );
36392
36491
  if (nested) return nested;
36393
36492
  return rootConfig;
36394
36493
  }
36395
36494
  function readReferences(configPath) {
36396
- if (!fs31.existsSync(configPath)) return [];
36397
- const raw = fs31.readFileSync(configPath, "utf8");
36495
+ if (!fs32.existsSync(configPath)) return [];
36496
+ const raw = fs32.readFileSync(configPath, "utf8");
36398
36497
  const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
36399
36498
  let parsed;
36400
36499
  try {
@@ -36403,18 +36502,18 @@ function readReferences(configPath) {
36403
36502
  return [];
36404
36503
  }
36405
36504
  if (!parsed.references?.length) return [];
36406
- const cwd = path53.dirname(configPath);
36505
+ const cwd = path54.dirname(configPath);
36407
36506
  return parsed.references.map((ref) => {
36408
- const refPath = path53.resolve(cwd, ref.path);
36409
- return fs31.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path53.join(refPath, "tsconfig.json") : refPath;
36410
- }).filter((p) => fs31.existsSync(p));
36507
+ const refPath = path54.resolve(cwd, ref.path);
36508
+ return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path54.join(refPath, "tsconfig.json") : refPath;
36509
+ }).filter((p) => fs32.existsSync(p));
36411
36510
  }
36412
36511
 
36413
36512
  // src/commands/refactor/extract/loadProjectFile.ts
36414
36513
  function loadProjectFile(file) {
36415
- const sourcePath = path54.resolve(file);
36514
+ const sourcePath = path55.resolve(file);
36416
36515
  const tsConfigPath = findTsConfig(sourcePath);
36417
- const project = new Project3({
36516
+ const project = new Project4({
36418
36517
  tsConfigFilePath: tsConfigPath
36419
36518
  });
36420
36519
  const sourceFile = project.getSourceFile(sourcePath);
@@ -36427,10 +36526,10 @@ function loadProjectFile(file) {
36427
36526
 
36428
36527
  // src/commands/refactor/extract.ts
36429
36528
  async function extract(file, functionName, destination, options2 = {}) {
36430
- const sourcePath = path55.resolve(file);
36431
- const destPath = path55.resolve(destination);
36529
+ const sourcePath = path56.resolve(file);
36530
+ const destPath = path56.resolve(destination);
36432
36531
  const cwd = process.cwd();
36433
- const relDest = path55.relative(cwd, destPath);
36532
+ const relDest = path56.relative(cwd, destPath);
36434
36533
  const { project, sourceFile } = loadProjectFile(file);
36435
36534
  const plan2 = buildPlan2(
36436
36535
  functionName,
@@ -36449,25 +36548,25 @@ async function extract(file, functionName, destination, options2 = {}) {
36449
36548
  }
36450
36549
 
36451
36550
  // src/commands/refactor/ignore.ts
36452
- import fs32 from "fs";
36551
+ import fs33 from "fs";
36453
36552
  import chalk226 from "chalk";
36454
36553
  var REFACTOR_YML_PATH2 = "refactor.yml";
36455
36554
  function ignore2(file) {
36456
- if (!fs32.existsSync(file)) {
36555
+ if (!fs33.existsSync(file)) {
36457
36556
  console.error(chalk226.red(`Error: File does not exist: ${file}`));
36458
36557
  process.exit(1);
36459
36558
  }
36460
- const content = fs32.readFileSync(file, "utf8");
36559
+ const content = fs33.readFileSync(file, "utf8");
36461
36560
  const lineCount2 = content.split("\n").length;
36462
36561
  const maxLines = lineCount2 + 10;
36463
36562
  const entry = `- file: ${file}
36464
36563
  maxLines: ${maxLines}
36465
36564
  `;
36466
- if (fs32.existsSync(REFACTOR_YML_PATH2)) {
36467
- const existing = fs32.readFileSync(REFACTOR_YML_PATH2, "utf8");
36468
- fs32.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
36565
+ if (fs33.existsSync(REFACTOR_YML_PATH2)) {
36566
+ const existing = fs33.readFileSync(REFACTOR_YML_PATH2, "utf8");
36567
+ fs33.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
36469
36568
  } else {
36470
- fs32.writeFileSync(REFACTOR_YML_PATH2, entry);
36569
+ fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
36471
36570
  }
36472
36571
  console.log(
36473
36572
  chalk226.green(
@@ -36477,20 +36576,20 @@ function ignore2(file) {
36477
36576
  }
36478
36577
 
36479
36578
  // src/commands/refactor/rename.ts
36480
- import fs35 from "fs";
36481
- import path61 from "path";
36579
+ import fs36 from "fs";
36580
+ import path62 from "path";
36482
36581
  import chalk229 from "chalk";
36483
36582
 
36484
36583
  // src/commands/refactor/rename/applyRename.ts
36485
- import fs34 from "fs";
36486
- import path57 from "path";
36584
+ import fs35 from "fs";
36585
+ import path58 from "path";
36487
36586
  import chalk227 from "chalk";
36488
36587
 
36489
36588
  // src/commands/refactor/restructure/computeRewrites.ts
36490
- import path56 from "path";
36589
+ import path57 from "path";
36491
36590
 
36492
36591
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
36493
- import fs33 from "fs";
36592
+ import fs34 from "fs";
36494
36593
  function getOrCreateList(map, key) {
36495
36594
  const list7 = map.get(key) ?? [];
36496
36595
  if (!map.has(key)) map.set(key, list7);
@@ -36508,7 +36607,7 @@ function applyFileRewrites(file, fileRewrites) {
36508
36607
  const replacements = new Map(
36509
36608
  fileRewrites.map((r) => [r.oldSpecifier, r.newSpecifier])
36510
36609
  );
36511
- return fs33.readFileSync(file, "utf8").replace(
36610
+ return fs34.readFileSync(file, "utf8").replace(
36512
36611
  MODULE_REFERENCE,
36513
36612
  (match, prefix2, quote, specifier) => {
36514
36613
  const replacement = replacements.get(specifier);
@@ -36542,7 +36641,7 @@ function normalizeSpecifier(rel) {
36542
36641
  );
36543
36642
  }
36544
36643
  function computeSpecifier(fromFile, toFile) {
36545
- return normalizeSpecifier(path56.relative(path56.dirname(fromFile), toFile));
36644
+ return normalizeSpecifier(path57.relative(path57.dirname(fromFile), toFile));
36546
36645
  }
36547
36646
  function isAffected(edge, moveMap) {
36548
36647
  return moveMap.has(edge.target) || moveMap.has(edge.source);
@@ -36589,25 +36688,25 @@ function computeRewrites(moves, edges, allProjectFiles) {
36589
36688
  function applyRename(rewrites, sourcePath, destPath, cwd) {
36590
36689
  const updatedContents = applyRewrites(rewrites);
36591
36690
  for (const [file, content] of updatedContents) {
36592
- fs34.writeFileSync(file, content, "utf8");
36593
- console.log(chalk227.cyan(` Updated imports in ${path57.relative(cwd, file)}`));
36691
+ fs35.writeFileSync(file, content, "utf8");
36692
+ console.log(chalk227.cyan(` Updated imports in ${path58.relative(cwd, file)}`));
36594
36693
  }
36595
- const destDir = path57.dirname(destPath);
36596
- if (!fs34.existsSync(destDir)) fs34.mkdirSync(destDir, { recursive: true });
36597
- fs34.renameSync(sourcePath, destPath);
36694
+ const destDir = path58.dirname(destPath);
36695
+ if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
36696
+ fs35.renameSync(sourcePath, destPath);
36598
36697
  console.log(
36599
36698
  chalk227.white(
36600
- ` Moved ${path57.relative(cwd, sourcePath)} \u2192 ${path57.relative(cwd, destPath)}`
36699
+ ` Moved ${path58.relative(cwd, sourcePath)} \u2192 ${path58.relative(cwd, destPath)}`
36601
36700
  )
36602
36701
  );
36603
36702
  }
36604
36703
 
36605
36704
  // src/commands/refactor/restructure/buildImportGraph.ts
36606
- import path59 from "path";
36705
+ import path60 from "path";
36607
36706
  import ts9 from "typescript";
36608
36707
 
36609
36708
  // src/commands/refactor/restructure/buildImportGraph/collectSourceFileEdges.ts
36610
- import path58 from "path";
36709
+ import path59 from "path";
36611
36710
  import ts8 from "typescript";
36612
36711
 
36613
36712
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
@@ -36680,10 +36779,10 @@ function resolveImport(specifier, filePath, options2) {
36680
36779
  const resolved = ts8.resolveModuleName(specifier, filePath, options2, ts8.sys);
36681
36780
  const resolvedPath = resolved.resolvedModule?.resolvedFileName;
36682
36781
  if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
36683
- return path58.resolve(resolvedPath);
36782
+ return path59.resolve(resolvedPath);
36684
36783
  }
36685
36784
  function collectSourceFileEdges(sourceFile, options2, includeMocks) {
36686
- const source = path58.resolve(sourceFile.fileName);
36785
+ const source = path59.resolve(sourceFile.fileName);
36687
36786
  return specifiersOf(sourceFile, includeMocks).flatMap(
36688
36787
  ({ specifier, mock }) => {
36689
36788
  const target = resolveImport(specifier, source, options2);
@@ -36699,7 +36798,7 @@ function loadParsedConfig(tsConfigPath) {
36699
36798
  return ts9.parseJsonConfigFileContent(
36700
36799
  configFile.config,
36701
36800
  ts9.sys,
36702
- path59.dirname(tsConfigPath)
36801
+ path60.dirname(tsConfigPath)
36703
36802
  );
36704
36803
  }
36705
36804
  function addToSetMap(map, key, value) {
@@ -36745,13 +36844,13 @@ function computeRenameRewrites(sourcePath, destPath) {
36745
36844
  }
36746
36845
 
36747
36846
  // src/commands/refactor/rename/printRenamePreview.ts
36748
- import path60 from "path";
36847
+ import path61 from "path";
36749
36848
  import chalk228 from "chalk";
36750
36849
  function printRenamePreview(rewrites, cwd) {
36751
36850
  for (const rewrite of rewrites) {
36752
36851
  console.log(
36753
36852
  chalk228.dim(
36754
- ` ${path60.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
36853
+ ` ${path61.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
36755
36854
  )
36756
36855
  );
36757
36856
  }
@@ -36760,16 +36859,16 @@ function printRenamePreview(rewrites, cwd) {
36760
36859
 
36761
36860
  // src/commands/refactor/rename.ts
36762
36861
  async function rename(source, destination, options2 = {}) {
36763
- const sourcePath = path61.resolve(source);
36764
- const destPath = path61.resolve(destination);
36862
+ const sourcePath = path62.resolve(source);
36863
+ const destPath = path62.resolve(destination);
36765
36864
  const cwd = process.cwd();
36766
- const relSource = path61.relative(cwd, sourcePath);
36767
- const relDest = path61.relative(cwd, destPath);
36768
- if (!fs35.existsSync(sourcePath)) {
36865
+ const relSource = path62.relative(cwd, sourcePath);
36866
+ const relDest = path62.relative(cwd, destPath);
36867
+ if (!fs36.existsSync(sourcePath)) {
36769
36868
  console.log(chalk229.red(`File not found: ${source}`));
36770
36869
  process.exit(1);
36771
36870
  }
36772
- if (destPath !== sourcePath && fs35.existsSync(destPath)) {
36871
+ if (destPath !== sourcePath && fs36.existsSync(destPath)) {
36773
36872
  console.log(chalk229.red(`Destination already exists: ${destination}`));
36774
36873
  process.exit(1);
36775
36874
  }
@@ -36795,36 +36894,36 @@ async function rename(source, destination, options2 = {}) {
36795
36894
  import chalk230 from "chalk";
36796
36895
 
36797
36896
  // src/commands/refactor/renameSymbol/findSymbol.ts
36798
- import { SyntaxKind as SyntaxKind15 } from "ts-morph";
36897
+ import { SyntaxKind as SyntaxKind19 } from "ts-morph";
36799
36898
  var declarationKinds = [
36800
- SyntaxKind15.VariableDeclaration,
36801
- SyntaxKind15.FunctionDeclaration,
36802
- SyntaxKind15.ClassDeclaration,
36803
- SyntaxKind15.InterfaceDeclaration,
36804
- SyntaxKind15.TypeAliasDeclaration,
36805
- SyntaxKind15.EnumDeclaration,
36806
- SyntaxKind15.PropertyDeclaration,
36807
- SyntaxKind15.MethodDeclaration,
36808
- SyntaxKind15.Parameter
36899
+ SyntaxKind19.VariableDeclaration,
36900
+ SyntaxKind19.FunctionDeclaration,
36901
+ SyntaxKind19.ClassDeclaration,
36902
+ SyntaxKind19.InterfaceDeclaration,
36903
+ SyntaxKind19.TypeAliasDeclaration,
36904
+ SyntaxKind19.EnumDeclaration,
36905
+ SyntaxKind19.PropertyDeclaration,
36906
+ SyntaxKind19.MethodDeclaration,
36907
+ SyntaxKind19.Parameter
36809
36908
  ];
36810
36909
  function isDeclaration(identifier) {
36811
36910
  const parent = identifier.getParent();
36812
36911
  return parent !== void 0 && declarationKinds.includes(parent.getKind());
36813
36912
  }
36814
36913
  function findSymbol(sourceFile, symbolName) {
36815
- for (const id of sourceFile.getDescendantsOfKind(SyntaxKind15.Identifier)) {
36914
+ for (const id of sourceFile.getDescendantsOfKind(SyntaxKind19.Identifier)) {
36816
36915
  if (id.getText() === symbolName && isDeclaration(id)) return id;
36817
36916
  }
36818
36917
  return void 0;
36819
36918
  }
36820
36919
 
36821
36920
  // src/commands/refactor/renameSymbol/groupReferences.ts
36822
- import path62 from "path";
36921
+ import path63 from "path";
36823
36922
  function groupReferences(symbol, cwd) {
36824
36923
  const refs = symbol.findReferencesAsNodes();
36825
36924
  const grouped = /* @__PURE__ */ new Map();
36826
36925
  for (const ref of refs) {
36827
- const refFile = path62.relative(cwd, ref.getSourceFile().getFilePath());
36926
+ const refFile = path63.relative(cwd, ref.getSourceFile().getFilePath());
36828
36927
  const lines2 = grouped.get(refFile) ?? [];
36829
36928
  if (!grouped.has(refFile)) grouped.set(refFile, lines2);
36830
36929
  lines2.push(ref.getStartLineNumber());
@@ -36863,40 +36962,40 @@ Renamed ${oldName} \u2192 ${newName}`));
36863
36962
  }
36864
36963
 
36865
36964
  // src/commands/refactor/restructure.ts
36866
- import fs37 from "fs";
36867
- import path82 from "path";
36965
+ import fs38 from "fs";
36966
+ import path83 from "path";
36868
36967
  import chalk240 from "chalk";
36869
36968
 
36870
36969
  // src/commands/refactor/restructure/buildPlan.ts
36871
- import path72 from "path";
36970
+ import path73 from "path";
36872
36971
 
36873
36972
  // src/commands/refactor/restructure/planRestructure.ts
36874
- import path71 from "path";
36973
+ import path72 from "path";
36875
36974
 
36876
36975
  // src/commands/refactor/restructure/planRestructure/anchored.ts
36877
- import path63 from "path";
36976
+ import path64 from "path";
36878
36977
  function anchored(files, mode, reasonPrefix) {
36879
36978
  return {
36880
36979
  root: false,
36881
36980
  anchors: files.map((file) => ({ file, mode })),
36882
- reason: `${reasonPrefix} ${files.map((f) => path63.basename(f)).join(", ")}`
36981
+ reason: `${reasonPrefix} ${files.map((f) => path64.basename(f)).join(", ")}`
36883
36982
  };
36884
36983
  }
36885
36984
 
36886
36985
  // src/commands/refactor/restructure/planRestructure/isTestFile.ts
36887
- import path64 from "path";
36986
+ import path65 from "path";
36888
36987
  var TEST_SUFFIX = /\.test\.tsx?$/;
36889
36988
  function isTestFile(file) {
36890
36989
  return TEST_SUFFIX.test(file);
36891
36990
  }
36892
36991
  function testStem(file) {
36893
- return path64.basename(file).replace(TEST_SUFFIX, "");
36992
+ return path65.basename(file).replace(TEST_SUFFIX, "");
36894
36993
  }
36895
36994
 
36896
36995
  // src/commands/refactor/restructure/planRestructure/moduleStem.ts
36897
- import path65 from "path";
36996
+ import path66 from "path";
36898
36997
  function moduleStem(file) {
36899
- return path65.basename(file).replace(/\.tsx?$/, "");
36998
+ return path66.basename(file).replace(/\.tsx?$/, "");
36900
36999
  }
36901
37000
 
36902
37001
  // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
@@ -36955,16 +37054,16 @@ function collectAnchors(files, index2, pinned) {
36955
37054
  }
36956
37055
 
36957
37056
  // src/commands/refactor/restructure/planRestructure/findCollisions.ts
36958
- import path66 from "path";
37057
+ import path67 from "path";
36959
37058
  function findCollisions(targets, scopeRoot) {
36960
37059
  const byModule = /* @__PURE__ */ new Map();
36961
37060
  for (const [file, target] of targets) {
36962
- const key = path66.join(path66.dirname(target), moduleStem(target));
37061
+ const key = path67.join(path67.dirname(target), moduleStem(target));
36963
37062
  byModule.set(key, [...byModule.get(key) ?? [], file]);
36964
37063
  }
36965
37064
  return [...byModule].filter(([, files]) => files.length > 1).map(([key, files]) => {
36966
- const where = path66.relative(scopeRoot, path66.dirname(key)) || ".";
36967
- const sources = files.sort().map((f) => path66.relative(scopeRoot, f));
37065
+ const where = path67.relative(scopeRoot, path67.dirname(key)) || ".";
37066
+ const sources = files.sort().map((f) => path67.relative(scopeRoot, f));
36968
37067
  return `Basename collision in ${where}/: ${sources.join(", ")}`;
36969
37068
  }).sort();
36970
37069
  }
@@ -37001,39 +37100,39 @@ function indexEdges(scope, edges, fixed2) {
37001
37100
  }
37002
37101
 
37003
37102
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
37004
- import path70 from "path";
37103
+ import path71 from "path";
37005
37104
 
37006
37105
  // src/commands/refactor/restructure/planRestructure/componentDir.ts
37007
- import path69 from "path";
37106
+ import path70 from "path";
37008
37107
 
37009
37108
  // src/commands/refactor/restructure/planRestructure/liftToPinFolder.ts
37010
- import path67 from "path";
37109
+ import path68 from "path";
37011
37110
  function liftToPinFolder(dir, pinFolders, scopeRoot) {
37012
37111
  let lifted = scopeRoot;
37013
37112
  for (const folder of pinFolders)
37014
- if ((dir === folder || dir.startsWith(folder + path67.sep)) && folder.length > lifted.length)
37113
+ if ((dir === folder || dir.startsWith(folder + path68.sep)) && folder.length > lifted.length)
37015
37114
  lifted = folder;
37016
37115
  return lifted;
37017
37116
  }
37018
37117
 
37019
37118
  // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
37020
- import path68 from "path";
37119
+ import path69 from "path";
37021
37120
  function lowestCommonAncestor(dirs) {
37022
- const [first, ...rest] = dirs.map((d) => d.split(path68.sep));
37121
+ const [first, ...rest] = dirs.map((d) => d.split(path69.sep));
37023
37122
  let common = first;
37024
37123
  for (const parts of rest) {
37025
37124
  let i = 0;
37026
37125
  while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
37027
37126
  common = common.slice(0, i);
37028
37127
  }
37029
- return common.join(path68.sep) || path68.sep;
37128
+ return common.join(path69.sep) || path69.sep;
37030
37129
  }
37031
37130
 
37032
37131
  // src/commands/refactor/restructure/planRestructure/componentDir.ts
37033
37132
  function anchorFolder(anchor, dirs) {
37034
- if (anchor.mode === "fixed") return path69.dirname(anchor.file);
37133
+ if (anchor.mode === "fixed") return path70.dirname(anchor.file);
37035
37134
  const dir = dirs.get(anchor.file);
37036
- return anchor.mode === "child" ? path69.join(dir, moduleStem(anchor.file)) : dir;
37135
+ return anchor.mode === "child" ? path70.join(dir, moduleStem(anchor.file)) : dir;
37037
37136
  }
37038
37137
  function externalAnchors(component, anchorings) {
37039
37138
  const members = new Set(component);
@@ -37116,7 +37215,7 @@ function isPinFolderOwner(anchoring) {
37116
37215
  }
37117
37216
  function componentReason(file, component, base) {
37118
37217
  if (component.length === 1) return base;
37119
- const others = component.filter((f) => f !== file).map((f) => path70.basename(f));
37218
+ const others = component.filter((f) => f !== file).map((f) => path71.basename(f));
37120
37219
  return `${base}; cycle with ${others.join(", ")}`;
37121
37220
  }
37122
37221
  function placeComponents(files, anchorings, scopeRoot) {
@@ -37129,7 +37228,7 @@ function placeComponents(files, anchorings, scopeRoot) {
37129
37228
  const anchoring = anchorings.get(file);
37130
37229
  layout.dirs.set(file, dir);
37131
37230
  if (isPinFolderOwner(anchoring))
37132
- layout.pinFolders.add(path70.join(dir, moduleStem(file)));
37231
+ layout.pinFolders.add(path71.join(dir, moduleStem(file)));
37133
37232
  placements.set(file, {
37134
37233
  dir,
37135
37234
  reason: componentReason(file, component, anchoring.reason)
@@ -37141,7 +37240,7 @@ function placeComponents(files, anchorings, scopeRoot) {
37141
37240
 
37142
37241
  // src/commands/refactor/restructure/planRestructure.ts
37143
37242
  function planRestructure(input) {
37144
- const scopeRoot = path71.resolve(input.scopeRoot);
37243
+ const scopeRoot = path72.resolve(input.scopeRoot);
37145
37244
  const files = [...new Set(input.files)].sort();
37146
37245
  const index2 = indexEdges(
37147
37246
  new Set(files),
@@ -37154,7 +37253,7 @@ function planRestructure(input) {
37154
37253
  const moves = [];
37155
37254
  for (const file of files) {
37156
37255
  const { dir, reason: reason4 } = placements.get(file);
37157
- const to = path71.join(dir, path71.basename(file));
37256
+ const to = path72.join(dir, path72.basename(file));
37158
37257
  targets.set(file, to);
37159
37258
  if (to !== file) moves.push({ from: file, to, reason: reason4 });
37160
37259
  }
@@ -37163,14 +37262,14 @@ function planRestructure(input) {
37163
37262
 
37164
37263
  // src/commands/refactor/restructure/buildPlan.ts
37165
37264
  function moduleKey(file) {
37166
- return path72.join(path72.dirname(file), moduleStem(file));
37265
+ return path73.join(path73.dirname(file), moduleStem(file));
37167
37266
  }
37168
37267
  function findIgnoredOccupants(moves, ignored, scopeRoot) {
37169
37268
  const occupants = new Map(ignored.map((f) => [moduleKey(f), f]));
37170
37269
  return moves.flatMap((move2) => {
37171
37270
  const occupant = occupants.get(moduleKey(move2.to));
37172
37271
  if (!occupant) return [];
37173
- const rel = (f) => path72.relative(scopeRoot, f);
37272
+ const rel = (f) => path73.relative(scopeRoot, f);
37174
37273
  return [
37175
37274
  `Target of ${rel(move2.from)} is occupied by ignored file ${rel(occupant)}`
37176
37275
  ];
@@ -37205,18 +37304,18 @@ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
37205
37304
  import chalk235 from "chalk";
37206
37305
 
37207
37306
  // src/commands/refactor/restructure/applyCommand.ts
37208
- import path73 from "path";
37307
+ import path74 from "path";
37209
37308
  function applyCommand(scopeRoot) {
37210
- const root2 = path73.relative(process.cwd(), scopeRoot) || ".";
37309
+ const root2 = path74.relative(process.cwd(), scopeRoot) || ".";
37211
37310
  return `assist refactor restructure ${root2} --apply`;
37212
37311
  }
37213
37312
 
37214
37313
  // src/commands/refactor/restructure/displayDrift.ts
37215
- import path74 from "path";
37314
+ import path75 from "path";
37216
37315
  import chalk231 from "chalk";
37217
37316
  var shownMoves = 20;
37218
37317
  function displayDrift(plan2, listMoves) {
37219
- const rel = (file) => path74.relative(process.cwd(), file);
37318
+ const rel = (file) => path75.relative(process.cwd(), file);
37220
37319
  if (plan2.moves.length > 0) {
37221
37320
  console.log(
37222
37321
  chalk231.red(
@@ -37273,8 +37372,8 @@ function displayLongPaths(longPaths, maxPathLength) {
37273
37372
  Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
37274
37373
  )
37275
37374
  );
37276
- for (const { path: path108, length } of longPaths)
37277
- console.log(` ${path108} [${length}]`);
37375
+ for (const { path: path109, length } of longPaths)
37376
+ console.log(` ${path109} [${length}]`);
37278
37377
  }
37279
37378
 
37280
37379
  // src/commands/refactor/restructure/displayLayoutLimits.ts
@@ -37319,10 +37418,10 @@ Run \`${apply}\` to move the files and rewrite their imports.`
37319
37418
  }
37320
37419
 
37321
37420
  // src/commands/refactor/restructure/findDeepChains.ts
37322
- import path75 from "path";
37421
+ import path76 from "path";
37323
37422
  function dirSegments(target, scopeRoot) {
37324
- const dir = path75.relative(scopeRoot, path75.dirname(target));
37325
- return dir === "" ? [] : dir.split(path75.sep);
37423
+ const dir = path76.relative(scopeRoot, path76.dirname(target));
37424
+ return dir === "" ? [] : dir.split(path76.sep);
37326
37425
  }
37327
37426
  function countSubtrees(segmentLists) {
37328
37427
  const counts2 = /* @__PURE__ */ new Map();
@@ -37357,9 +37456,9 @@ function findDeepChains(targets, scopeRoot, maxDepth) {
37357
37456
  }
37358
37457
 
37359
37458
  // src/commands/refactor/restructure/findLongPaths.ts
37360
- import path76 from "path";
37459
+ import path77 from "path";
37361
37460
  function findLongPaths(targets, repoRoot2, maxPathLength) {
37362
- return [...targets].map((t) => path76.relative(repoRoot2, t).split(path76.sep).join("/")).filter((p) => p.length > maxPathLength).map((p) => ({ path: p, length: p.length })).sort((a, b) => b.length - a.length || a.path.localeCompare(b.path));
37461
+ return [...targets].map((t) => path77.relative(repoRoot2, t).split(path77.sep).join("/")).filter((p) => p.length > maxPathLength).map((p) => ({ path: p, length: p.length })).sort((a, b) => b.length - a.length || a.path.localeCompare(b.path));
37363
37462
  }
37364
37463
 
37365
37464
  // src/commands/refactor/restructure/checkLayoutLimits.ts
@@ -37373,11 +37472,11 @@ function checkLayoutLimits(plan2, { maxDepth, maxPathLength, repoRoot: repoRoot2
37373
37472
  }
37374
37473
 
37375
37474
  // src/commands/refactor/restructure/partitionIgnored.ts
37376
- import path77 from "path";
37475
+ import path78 from "path";
37377
37476
  import { minimatch as minimatch4 } from "minimatch";
37378
37477
  function partitionIgnored(files) {
37379
37478
  const globs = loadConfig().restructure?.ignore ?? [];
37380
- const isIgnored = (file) => globs.some((glob) => minimatch4(path77.relative(process.cwd(), file), glob));
37479
+ const isIgnored = (file) => globs.some((glob) => minimatch4(path78.relative(process.cwd(), file), glob));
37381
37480
  return {
37382
37481
  scoped: files.filter((f) => !isIgnored(f)),
37383
37482
  ignored: files.filter(isIgnored)
@@ -37391,11 +37490,11 @@ import chalk239 from "chalk";
37391
37490
  import chalk237 from "chalk";
37392
37491
 
37393
37492
  // src/commands/refactor/restructure/executePlan.ts
37394
- import fs36 from "fs";
37395
- import path78 from "path";
37493
+ import fs37 from "fs";
37494
+ import path79 from "path";
37396
37495
  import chalk236 from "chalk";
37397
37496
  function relPath(file) {
37398
- return path78.relative(process.cwd(), file);
37497
+ return path79.relative(process.cwd(), file);
37399
37498
  }
37400
37499
  function stagingPath(move2, index2) {
37401
37500
  return `${move2.from}.restructure-${process.pid}-${index2}`;
@@ -37403,38 +37502,38 @@ function stagingPath(move2, index2) {
37403
37502
  function moveFiles(moves) {
37404
37503
  const staged = moves.map((move2, i) => {
37405
37504
  const staging = stagingPath(move2, i);
37406
- fs36.renameSync(move2.from, staging);
37505
+ fs37.renameSync(move2.from, staging);
37407
37506
  return { move: move2, staging };
37408
37507
  });
37409
37508
  for (const { move: move2, staging } of staged) {
37410
- fs36.mkdirSync(path78.dirname(move2.to), { recursive: true });
37411
- fs36.renameSync(staging, move2.to);
37509
+ fs37.mkdirSync(path79.dirname(move2.to), { recursive: true });
37510
+ fs37.renameSync(staging, move2.to);
37412
37511
  console.log(
37413
37512
  chalk236.white(` Moved ${relPath(move2.from)} \u2192 ${relPath(move2.to)}`)
37414
37513
  );
37415
37514
  }
37416
37515
  }
37417
37516
  function removeIfEmpty(dir) {
37418
- if (!fs36.existsSync(dir) || fs36.readdirSync(dir).length > 0) return false;
37419
- fs36.rmdirSync(dir);
37517
+ if (!fs37.existsSync(dir) || fs37.readdirSync(dir).length > 0) return false;
37518
+ fs37.rmdirSync(dir);
37420
37519
  console.log(chalk236.dim(` Removed empty directory ${relPath(dir)}`));
37421
37520
  return true;
37422
37521
  }
37423
37522
  function removeEmptyDirectories(dirs, scopeRoot) {
37424
37523
  const deepestFirst = [...new Set(dirs)].sort((a, b) => b.length - a.length);
37425
37524
  for (let dir of deepestFirst) {
37426
- while (dir.startsWith(`${scopeRoot}${path78.sep}`) && removeIfEmpty(dir))
37427
- dir = path78.dirname(dir);
37525
+ while (dir.startsWith(`${scopeRoot}${path79.sep}`) && removeIfEmpty(dir))
37526
+ dir = path79.dirname(dir);
37428
37527
  }
37429
37528
  }
37430
37529
  function executePlan(plan2) {
37431
37530
  for (const [file, content] of applyRewrites(plan2.rewrites)) {
37432
- fs36.writeFileSync(file, content, "utf8");
37531
+ fs37.writeFileSync(file, content, "utf8");
37433
37532
  console.log(chalk236.cyan(` Rewrote imports in ${relPath(file)}`));
37434
37533
  }
37435
37534
  moveFiles(plan2.moves);
37436
37535
  removeEmptyDirectories(
37437
- plan2.moves.map((m) => path78.dirname(m.from)),
37536
+ plan2.moves.map((m) => path79.dirname(m.from)),
37438
37537
  plan2.scopeRoot
37439
37538
  );
37440
37539
  }
@@ -37451,17 +37550,17 @@ function applyPlan(plan2) {
37451
37550
  }
37452
37551
 
37453
37552
  // src/commands/refactor/restructure/displayPlan.ts
37454
- import path81 from "path";
37553
+ import path82 from "path";
37455
37554
  import chalk238 from "chalk";
37456
37555
 
37457
37556
  // src/commands/refactor/restructure/computeDepthStats.ts
37458
- import path79 from "path";
37557
+ import path80 from "path";
37459
37558
  function computeDepthStats(targets, scopeRoot) {
37460
37559
  const distribution = /* @__PURE__ */ new Map();
37461
37560
  let max = 0;
37462
37561
  for (const target of targets) {
37463
- const dir = path79.relative(scopeRoot, path79.dirname(target));
37464
- const depth = dir === "" ? 0 : dir.split(path79.sep).length;
37562
+ const dir = path80.relative(scopeRoot, path80.dirname(target));
37563
+ const depth = dir === "" ? 0 : dir.split(path80.sep).length;
37465
37564
  distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
37466
37565
  max = Math.max(max, depth);
37467
37566
  }
@@ -37469,7 +37568,7 @@ function computeDepthStats(targets, scopeRoot) {
37469
37568
  }
37470
37569
 
37471
37570
  // src/commands/refactor/restructure/formatTree.ts
37472
- import path80 from "path";
37571
+ import path81 from "path";
37473
37572
  function insert(root2, parts) {
37474
37573
  let node = root2;
37475
37574
  for (const part of parts) {
@@ -37491,7 +37590,7 @@ function render(node, indent3, lines2) {
37491
37590
  function formatTree(files, scopeRoot) {
37492
37591
  const root2 = /* @__PURE__ */ new Map();
37493
37592
  for (const file of files)
37494
- insert(root2, path80.relative(scopeRoot, file).split(path80.sep));
37593
+ insert(root2, path81.relative(scopeRoot, file).split(path81.sep));
37495
37594
  const lines2 = [];
37496
37595
  render(root2, "", lines2);
37497
37596
  return lines2;
@@ -37499,7 +37598,7 @@ function formatTree(files, scopeRoot) {
37499
37598
 
37500
37599
  // src/commands/refactor/restructure/displayPlan.ts
37501
37600
  function relPath2(filePath) {
37502
- return path81.relative(process.cwd(), filePath);
37601
+ return path82.relative(process.cwd(), filePath);
37503
37602
  }
37504
37603
  function displayMoves(plan2) {
37505
37604
  if (plan2.moves.length === 0) return;
@@ -37565,8 +37664,8 @@ function runPlan(plan2, limits, apply) {
37565
37664
 
37566
37665
  // src/commands/refactor/restructure.ts
37567
37666
  async function restructure(root2, options2 = {}) {
37568
- const scopeRoot = path82.resolve(root2 ?? "src");
37569
- if (!fs37.existsSync(scopeRoot) || !fs37.statSync(scopeRoot).isDirectory()) {
37667
+ const scopeRoot = path83.resolve(root2 ?? "src");
37668
+ if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
37570
37669
  console.log(chalk240.red(`Not a directory: ${root2 ?? "src"}`));
37571
37670
  process.exit(1);
37572
37671
  }
@@ -37992,8 +38091,8 @@ function groupFilesByDirectory(files) {
37992
38091
  }
37993
38092
 
37994
38093
  // src/commands/review/highLevel/buildHighLevelTree.ts
37995
- function basename25(path108) {
37996
- return path108.slice(path108.lastIndexOf("/") + 1);
38094
+ function basename25(path109) {
38095
+ return path109.slice(path109.lastIndexOf("/") + 1);
37997
38096
  }
37998
38097
  function sum(nodes, key) {
37999
38098
  return nodes.reduce((total2, node) => total2 + node[key], 0);
@@ -38016,19 +38115,19 @@ function nodesOf(at2, prefix2) {
38016
38115
  }
38017
38116
  function collapsedDirNode(name, at2, prefix2) {
38018
38117
  let label = name;
38019
- let path108 = prefix2 ? `${prefix2}/${name}` : name;
38118
+ let path109 = prefix2 ? `${prefix2}/${name}` : name;
38020
38119
  let node = at2;
38021
38120
  while (node.files.length === 0 && node.dirs.size === 1) {
38022
38121
  const [childName, child] = [...node.dirs][0];
38023
38122
  label = `${label}/${childName}`;
38024
- path108 = `${path108}/${childName}`;
38123
+ path109 = `${path109}/${childName}`;
38025
38124
  node = child;
38026
38125
  }
38027
- const children = nodesOf(node, path108);
38126
+ const children = nodesOf(node, path109);
38028
38127
  return {
38029
38128
  kind: "dir",
38030
38129
  name: label,
38031
- path: path108,
38130
+ path: path109,
38032
38131
  additions: sum(children, "additions"),
38033
38132
  deletions: sum(children, "deletions"),
38034
38133
  children
@@ -38192,7 +38291,7 @@ function capHighLevelTestSources(files) {
38192
38291
  import { minimatch as minimatch6 } from "minimatch";
38193
38292
 
38194
38293
  // src/commands/review/highLevel/extractTestHierarchy.ts
38195
- import { Node as Node4, Project as Project4 } from "ts-morph";
38294
+ import { Node as Node4, Project as Project5 } from "ts-morph";
38196
38295
 
38197
38296
  // src/commands/review/highLevel/classifyTestCall.ts
38198
38297
  import { Node as Node2 } from "ts-morph";
@@ -38292,13 +38391,13 @@ function visit(node, context) {
38292
38391
  }
38293
38392
  ];
38294
38393
  }
38295
- function extractTestHierarchy(path108, text18, changed) {
38296
- const project = new Project4({
38394
+ function extractTestHierarchy(path109, text18, changed) {
38395
+ const project = new Project5({
38297
38396
  useInMemoryFileSystem: true,
38298
38397
  compilerOptions: { allowJs: true }
38299
38398
  });
38300
- const source = project.createSourceFile(`/${path108}`, text18);
38301
- return collect7(source, { path: path108, ...changed ? { changed } : {} });
38399
+ const source = project.createSourceFile(`/${path109}`, text18);
38400
+ return collect7(source, { path: path109, ...changed ? { changed } : {} });
38302
38401
  }
38303
38402
 
38304
38403
  // src/commands/review/highLevel/patchAddedLines.ts
@@ -38320,8 +38419,8 @@ function testFile(file, readSource4) {
38320
38419
  const changed = file.patch === void 0 ? void 0 : patchAddedLines(file.patch);
38321
38420
  const tests = extractTestHierarchy(file.path, readSource4(file.path), changed);
38322
38421
  if (tests.length === 0) return [];
38323
- const { path: path108, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
38324
- return [{ path: path108, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
38422
+ const { path: path109, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
38423
+ return [{ path: path109, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
38325
38424
  }
38326
38425
  function collectHighLevelTests(files, testPaths, readSource4) {
38327
38426
  return files.filter(
@@ -38529,8 +38628,8 @@ function evaluateHighLevelChecks(subject) {
38529
38628
 
38530
38629
  // src/commands/review/highLevel/fetchFileAtSha.ts
38531
38630
  import { execFileSync as execFileSync28 } from "child_process";
38532
- function fetchFileAtSha(repo, sha, path108) {
38533
- const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
38631
+ function fetchFileAtSha(repo, sha, path109) {
38632
+ const encodedPath = path109.split("/").map(encodeURIComponent).join("/");
38534
38633
  try {
38535
38634
  return execFileSync28(
38536
38635
  "gh",
@@ -38548,7 +38647,7 @@ function fetchFileAtSha(repo, sha, path108) {
38548
38647
  );
38549
38648
  } catch (error) {
38550
38649
  throw new Error(
38551
- `Could not read ${path108} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
38650
+ `Could not read ${path109} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
38552
38651
  );
38553
38652
  }
38554
38653
  }
@@ -38562,8 +38661,8 @@ function toStatus(status2) {
38562
38661
  if (status2 === "removed") return "removed";
38563
38662
  return "modified";
38564
38663
  }
38565
- function diffUrl(repo, prNumber, path108) {
38566
- const anchor = createHash4("sha256").update(path108).digest("hex");
38664
+ function diffUrl(repo, prNumber, path109) {
38665
+ const anchor = createHash4("sha256").update(path109).digest("hex");
38567
38666
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
38568
38667
  }
38569
38668
  function fetchHighLevelFiles(prNumber, repo) {
@@ -38657,10 +38756,10 @@ function highLevelDraftPath(repo, headRef, headSha) {
38657
38756
 
38658
38757
  // src/commands/review/highLevel/readJsonFile.ts
38659
38758
  import { existsSync as existsSync66, readFileSync as readFileSync50 } from "fs";
38660
- function readJsonFile(path108) {
38661
- if (!existsSync66(path108)) return void 0;
38759
+ function readJsonFile(path109) {
38760
+ if (!existsSync66(path109)) return void 0;
38662
38761
  try {
38663
- return JSON.parse(readFileSync50(path108, "utf8"));
38762
+ return JSON.parse(readFileSync50(path109, "utf8"));
38664
38763
  } catch {
38665
38764
  return void 0;
38666
38765
  }
@@ -38691,8 +38790,8 @@ import { minimatch as minimatch8 } from "minimatch";
38691
38790
  function selectCriticalDiffs(files, criticalPaths) {
38692
38791
  if (criticalPaths.length === 0) return [];
38693
38792
  return files.filter((file) => criticalPaths.some((glob) => minimatch8(file.path, glob))).map(
38694
- ({ path: path108, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
38695
- path: path108,
38793
+ ({ path: path109, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
38794
+ path: path109,
38696
38795
  status: status2,
38697
38796
  additions,
38698
38797
  deletions,
@@ -38732,7 +38831,7 @@ function gatherHighLevelSubject(prNumber, force) {
38732
38831
  collectHighLevelTests(
38733
38832
  fetched,
38734
38833
  config.testPaths,
38735
- (path108) => fetchFileAtSha(slug2, pr.headSha, path108)
38834
+ (path109) => fetchFileAtSha(slug2, pr.headSha, path109)
38736
38835
  )
38737
38836
  ),
38738
38837
  testPaths: config.testPaths,
@@ -38813,11 +38912,11 @@ function clearHighLevelDraft(repo, headRef, headSha) {
38813
38912
  // src/commands/review/highLevel/writeJsonFile.ts
38814
38913
  import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync40 } from "fs";
38815
38914
  import { dirname as dirname40 } from "path";
38816
- function writeJsonFile(path108, data) {
38817
- mkdirSync25(dirname40(path108), { recursive: true });
38818
- writeFileSync40(path108, `${JSON.stringify(data, null, 2)}
38915
+ function writeJsonFile(path109, data) {
38916
+ mkdirSync25(dirname40(path109), { recursive: true });
38917
+ writeFileSync40(path109, `${JSON.stringify(data, null, 2)}
38819
38918
  `);
38820
- return path108;
38919
+ return path109;
38821
38920
  }
38822
38921
 
38823
38922
  // src/commands/review/highLevel/saveHighLevelDraft.ts
@@ -38883,14 +38982,14 @@ function saveHighLevelReview(record) {
38883
38982
 
38884
38983
  // src/commands/review/highLevel/formatReviewComment.ts
38885
38984
  function formatReviewComment({
38886
- path: path108,
38985
+ path: path109,
38887
38986
  startLine,
38888
38987
  endLine,
38889
38988
  quote,
38890
38989
  note
38891
38990
  }) {
38892
38991
  const lines2 = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
38893
- return `- \`${path108}:${lines2}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
38992
+ return `- \`${path109}:${lines2}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
38894
38993
  }
38895
38994
 
38896
38995
  // src/commands/review/highLevel/formatHighLevelReviewBody.ts
@@ -41090,8 +41189,8 @@ function fetchExistingComments() {
41090
41189
  // src/commands/review/prepareReviewDir.ts
41091
41190
  import { existsSync as existsSync69, mkdirSync as mkdirSync27, unlinkSync as unlinkSync18, writeFileSync as writeFileSync42 } from "fs";
41092
41191
  function clearReviewFiles(paths) {
41093
- for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
41094
- if (existsSync69(path108)) unlinkSync18(path108);
41192
+ for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
41193
+ if (existsSync69(path109)) unlinkSync18(path109);
41095
41194
  }
41096
41195
  }
41097
41196
  function prepareReviewDir(paths, requestBody, force) {
@@ -41745,20 +41844,20 @@ function registerReview(program) {
41745
41844
  }
41746
41845
 
41747
41846
  // src/commands/rules/indexRules.ts
41748
- import path86 from "path";
41847
+ import path87 from "path";
41749
41848
  import chalk253 from "chalk";
41750
41849
 
41751
41850
  // src/commands/rules/updateScopedRulesIndex.ts
41752
41851
  import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync43 } from "fs";
41753
- import path85 from "path";
41852
+ import path86 from "path";
41754
41853
 
41755
41854
  // src/commands/rules/scopedRuleDirectories.ts
41756
41855
  import { readFileSync as readFileSync54 } from "fs";
41757
- import path84 from "path";
41856
+ import path85 from "path";
41758
41857
 
41759
41858
  // src/commands/rules/findClaudeFiles.ts
41760
41859
  import { readdirSync as readdirSync14 } from "fs";
41761
- import path83 from "path";
41860
+ import path84 from "path";
41762
41861
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
41763
41862
  function findClaudeFiles(dir) {
41764
41863
  const results = [];
@@ -41766,9 +41865,9 @@ function findClaudeFiles(dir) {
41766
41865
  if (entry.isDirectory()) {
41767
41866
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
41768
41867
  continue;
41769
- results.push(...findClaudeFiles(path83.join(dir, entry.name)));
41868
+ results.push(...findClaudeFiles(path84.join(dir, entry.name)));
41770
41869
  } else if (entry.name === "CLAUDE.md") {
41771
- results.push(path83.join(dir, entry.name));
41870
+ results.push(path84.join(dir, entry.name));
41772
41871
  }
41773
41872
  }
41774
41873
  return results;
@@ -41777,9 +41876,9 @@ function findClaudeFiles(dir) {
41777
41876
  // src/commands/rules/scopedRuleDirectories.ts
41778
41877
  function scopedRuleDirectories(root2) {
41779
41878
  return findClaudeFiles(root2).filter(
41780
- (file) => path84.dirname(file) !== root2 && parseRulesSection(readFileSync54(file, "utf8")).length > 0
41879
+ (file) => path85.dirname(file) !== root2 && parseRulesSection(readFileSync54(file, "utf8")).length > 0
41781
41880
  ).map(
41782
- (file) => `${path84.relative(root2, path84.dirname(file)).split(path84.sep).join("/")}/`
41881
+ (file) => `${path85.relative(root2, path85.dirname(file)).split(path85.sep).join("/")}/`
41783
41882
  ).sort();
41784
41883
  }
41785
41884
 
@@ -41818,7 +41917,7 @@ function upsertScopedRulesPointer(content, directories) {
41818
41917
  // src/commands/rules/updateScopedRulesIndex.ts
41819
41918
  function updateScopedRulesIndex(root2) {
41820
41919
  const directories = scopedRuleDirectories(root2);
41821
- const rootFile = path85.join(root2, "CLAUDE.md");
41920
+ const rootFile = path86.join(root2, "CLAUDE.md");
41822
41921
  const before = existsSync70(rootFile) ? readFileSync55(rootFile, "utf8") : "";
41823
41922
  const after = upsertScopedRulesPointer(before, directories);
41824
41923
  if (after !== before) writeFileSync43(rootFile, after);
@@ -41830,7 +41929,7 @@ function indexRules() {
41830
41929
  const startDir = scopeDirectory(process.cwd());
41831
41930
  const root2 = findRepoRoot(startDir) ?? startDir;
41832
41931
  const directories = updateScopedRulesIndex(root2);
41833
- const rootFile = path86.relative(process.cwd(), path86.join(root2, "CLAUDE.md"));
41932
+ const rootFile = path87.relative(process.cwd(), path87.join(root2, "CLAUDE.md"));
41834
41933
  if (directories.length === 0) {
41835
41934
  console.log(
41836
41935
  chalk253.gray(`No directories carry their own \`## Rules\` under ${root2}`)
@@ -41843,13 +41942,13 @@ function indexRules() {
41843
41942
  }
41844
41943
 
41845
41944
  // src/commands/rules/listRules.ts
41846
- import path87 from "path";
41945
+ import path88 from "path";
41847
41946
  import chalk254 from "chalk";
41848
41947
  function listRules(target, options2 = {}) {
41849
- const resolved = path87.resolve(target ?? process.cwd());
41948
+ const resolved = path88.resolve(target ?? process.cwd());
41850
41949
  const rules2 = readScopedRules(resolved);
41851
41950
  if (rules2.length === 0) {
41852
- const label = path87.relative(process.cwd(), resolved) || ".";
41951
+ const label = path88.relative(process.cwd(), resolved) || ".";
41853
41952
  console.log(chalk254.gray(`No rules in scope for ${label}`));
41854
41953
  return;
41855
41954
  }
@@ -41860,7 +41959,7 @@ function listRules(target, options2 = {}) {
41860
41959
  if (rule.source !== shown) {
41861
41960
  shown = rule.source;
41862
41961
  console.log(
41863
- chalk254.dim(base ? path87.relative(base, rule.source) : rule.source)
41962
+ chalk254.dim(base ? path88.relative(base, rule.source) : rule.source)
41864
41963
  );
41865
41964
  }
41866
41965
  console.log(
@@ -41873,7 +41972,7 @@ function listRules(target, options2 = {}) {
41873
41972
 
41874
41973
  // src/commands/rules/addRule.ts
41875
41974
  import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync44 } from "fs";
41876
- import path89 from "path";
41975
+ import path90 from "path";
41877
41976
  import chalk255 from "chalk";
41878
41977
 
41879
41978
  // src/commands/rules/insertRuleBullet.ts
@@ -41910,20 +42009,20 @@ function nextRuleCode(root2) {
41910
42009
 
41911
42010
  // src/commands/rules/resolveRuleScope.ts
41912
42011
  import { existsSync as existsSync71 } from "fs";
41913
- import path88 from "path";
42012
+ import path89 from "path";
41914
42013
  function resolveRuleScope(target) {
41915
- const resolved = path88.resolve(target);
41916
- if (path88.basename(resolved) === "CLAUDE.md") return resolved;
42014
+ const resolved = path89.resolve(target);
42015
+ if (path89.basename(resolved) === "CLAUDE.md") return resolved;
41917
42016
  const startDir = scopeDirectory(resolved);
41918
42017
  const root2 = findRepoRoot(startDir) ?? startDir;
41919
42018
  let current = startDir;
41920
42019
  while (true) {
41921
- const candidate = path88.join(current, "CLAUDE.md");
42020
+ const candidate = path89.join(current, "CLAUDE.md");
41922
42021
  if (existsSync71(candidate)) return candidate;
41923
- if (current === root2 || current === path88.dirname(current)) break;
41924
- current = path88.dirname(current);
42022
+ if (current === root2 || current === path89.dirname(current)) break;
42023
+ current = path89.dirname(current);
41925
42024
  }
41926
- return path88.join(root2, "CLAUDE.md");
42025
+ return path89.join(root2, "CLAUDE.md");
41927
42026
  }
41928
42027
 
41929
42028
  // src/commands/rules/addRule.ts
@@ -41938,7 +42037,7 @@ function addRule(text18, options2) {
41938
42037
  return;
41939
42038
  }
41940
42039
  const target = resolveRuleScope(options2.scope ?? process.cwd());
41941
- const targetDir = path89.dirname(target);
42040
+ const targetDir = path90.dirname(target);
41942
42041
  const root2 = findRepoRoot(targetDir) ?? targetDir;
41943
42042
  const code = nextRuleCode(root2);
41944
42043
  writeFileSync44(
@@ -41951,7 +42050,7 @@ function addRule(text18, options2) {
41951
42050
  );
41952
42051
  updateScopedRulesIndex(root2);
41953
42052
  console.log(
41954
- `Added ${chalk255.cyan(code)} to ${path89.relative(process.cwd(), target) || target}`
42053
+ `Added ${chalk255.cyan(code)} to ${path90.relative(process.cwd(), target) || target}`
41955
42054
  );
41956
42055
  }
41957
42056
 
@@ -42105,8 +42204,8 @@ import chalk262 from "chalk";
42105
42204
 
42106
42205
  // src/commands/seq/fetchSeq.ts
42107
42206
  import chalk259 from "chalk";
42108
- async function fetchSeq(conn, path108, params) {
42109
- const url = `${conn.url}${path108}?${params}`;
42207
+ async function fetchSeq(conn, path109, params) {
42208
+ const url = `${conn.url}${path109}?${params}`;
42110
42209
  const response = await fetch(url, {
42111
42210
  headers: {
42112
42211
  Accept: "application/json",
@@ -42567,7 +42666,7 @@ async function previewSlackThreadParts({
42567
42666
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
42568
42667
  );
42569
42668
  paths.forEach(
42570
- (path108, index2) => console.log(`${index2 + 1}/${paths.length} ${path108}`)
42669
+ (path109, index2) => console.log(`${index2 + 1}/${paths.length} ${path109}`)
42571
42670
  );
42572
42671
  console.log(
42573
42672
  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.`
@@ -42910,15 +43009,15 @@ function registerSql(program) {
42910
43009
 
42911
43010
  // src/commands/sync.ts
42912
43011
  import * as os5 from "os";
42913
- import * as path101 from "path";
43012
+ import * as path102 from "path";
42914
43013
  import { fileURLToPath as fileURLToPath8 } from "url";
42915
43014
 
42916
43015
  // src/commands/sync/pruneCommands.ts
42917
- import * as path91 from "path";
43016
+ import * as path92 from "path";
42918
43017
 
42919
43018
  // src/commands/sync/pruneTarget.ts
42920
- import * as fs38 from "fs";
42921
- import * as path90 from "path";
43019
+ import * as fs39 from "fs";
43020
+ import * as path91 from "path";
42922
43021
  function pruneTarget(targetDir, keepNames, shape, options2) {
42923
43022
  const result = {
42924
43023
  orphans: [],
@@ -42926,9 +43025,9 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
42926
43025
  skipped: [],
42927
43026
  unmanaged: []
42928
43027
  };
42929
- if (!fs38.existsSync(targetDir)) return result;
43028
+ if (!fs39.existsSync(targetDir)) return result;
42930
43029
  const keep = new Set(keepNames);
42931
- for (const entry of fs38.readdirSync(targetDir, { withFileTypes: true })) {
43030
+ for (const entry of fs39.readdirSync(targetDir, { withFileTypes: true })) {
42932
43031
  const name = shape.nameOf(entry);
42933
43032
  if (name === void 0) {
42934
43033
  result.unmanaged.push(entry.name);
@@ -42936,14 +43035,14 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
42936
43035
  }
42937
43036
  if (keep.has(name)) continue;
42938
43037
  result.orphans.push(entry.name);
42939
- const entryPath = path90.join(targetDir, entry.name);
43038
+ const entryPath = path91.join(targetDir, entry.name);
42940
43039
  const reason4 = shape.blockedBy?.(entryPath);
42941
43040
  if (reason4) {
42942
43041
  result.skipped.push({ name: entry.name, reason: reason4 });
42943
43042
  continue;
42944
43043
  }
42945
43044
  if (options2.force) {
42946
- fs38.rmSync(entryPath, { recursive: true });
43045
+ fs39.rmSync(entryPath, { recursive: true });
42947
43046
  result.removed.push(entry.name);
42948
43047
  }
42949
43048
  }
@@ -42956,14 +43055,14 @@ function pruneCommands(targetDir, commandNames, options2) {
42956
43055
  targetDir,
42957
43056
  commandNames,
42958
43057
  {
42959
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path91.basename(entry.name, ".md") : void 0
43058
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path92.basename(entry.name, ".md") : void 0
42960
43059
  },
42961
43060
  options2
42962
43061
  );
42963
43062
  }
42964
43063
 
42965
43064
  // src/commands/sync/pruneSkills.ts
42966
- import * as fs39 from "fs";
43065
+ import * as fs40 from "fs";
42967
43066
  function pruneSkills(targetDir, skillNames, options2) {
42968
43067
  return pruneTarget(
42969
43068
  targetDir,
@@ -42976,7 +43075,7 @@ function pruneSkills(targetDir, skillNames, options2) {
42976
43075
  );
42977
43076
  }
42978
43077
  function unexpectedContent(skillDir) {
42979
- const entries = fs39.readdirSync(skillDir);
43078
+ const entries = fs40.readdirSync(skillDir);
42980
43079
  const others = entries.filter((entry) => entry !== "SKILL.md");
42981
43080
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
42982
43081
  return entries.length === 0 ? "no SKILL.md" : void 0;
@@ -43010,8 +43109,8 @@ function reportPrune(label, result, force) {
43010
43109
  }
43011
43110
 
43012
43111
  // src/commands/sync/syncClaudeCommands.ts
43013
- import * as fs40 from "fs";
43014
- import * as path92 from "path";
43112
+ import * as fs41 from "fs";
43113
+ import * as path93 from "path";
43015
43114
 
43016
43115
  // src/commands/sync/splitFrontmatter.ts
43017
43116
  function splitFrontmatter(content) {
@@ -43040,41 +43139,41 @@ function quoteYaml(value) {
43040
43139
 
43041
43140
  // src/commands/sync/syncClaudeCommands.ts
43042
43141
  function replaceFileWithoutFollowingSymlink(file, content) {
43043
- fs40.rmSync(file, { force: true });
43044
- fs40.writeFileSync(file, content);
43142
+ fs41.rmSync(file, { force: true });
43143
+ fs41.writeFileSync(file, content);
43045
43144
  }
43046
43145
  function writeSkill(targetBase, name, content) {
43047
- const skillDir = path92.join(targetBase, "skills", name);
43048
- fs40.mkdirSync(skillDir, { recursive: true });
43146
+ const skillDir = path93.join(targetBase, "skills", name);
43147
+ fs41.mkdirSync(skillDir, { recursive: true });
43049
43148
  replaceFileWithoutFollowingSymlink(
43050
- path92.join(skillDir, "SKILL.md"),
43149
+ path93.join(skillDir, "SKILL.md"),
43051
43150
  commandToSkill(name, content)
43052
43151
  );
43053
- fs40.rmSync(path92.join(targetBase, "commands", `${name}.md`), { force: true });
43152
+ fs41.rmSync(path93.join(targetBase, "commands", `${name}.md`), { force: true });
43054
43153
  }
43055
43154
  function syncClaudeCommands(claudeDir, targetBase) {
43056
- const sourceDir = path92.join(claudeDir, "commands");
43057
- const names = fs40.readdirSync(sourceDir).filter((file) => file.endsWith(".md")).map((file) => path92.basename(file, ".md"));
43155
+ const sourceDir = path93.join(claudeDir, "commands");
43156
+ const names = fs41.readdirSync(sourceDir).filter((file) => file.endsWith(".md")).map((file) => path93.basename(file, ".md"));
43058
43157
  for (const name of names) {
43059
- const content = fs40.readFileSync(path92.join(sourceDir, `${name}.md`), "utf8");
43158
+ const content = fs41.readFileSync(path93.join(sourceDir, `${name}.md`), "utf8");
43060
43159
  writeSkill(targetBase, name, content);
43061
43160
  }
43062
43161
  console.log(
43063
- `Synced ${names.length} skill(s) to ${path92.join(targetBase, "skills")}`
43162
+ `Synced ${names.length} skill(s) to ${path93.join(targetBase, "skills")}`
43064
43163
  );
43065
43164
  return names;
43066
43165
  }
43067
43166
 
43068
43167
  // src/commands/sync/reportRetiredAgentsFiles.ts
43069
- import * as fs41 from "fs";
43070
- import * as path93 from "path";
43168
+ import * as fs42 from "fs";
43169
+ import * as path94 from "path";
43071
43170
  var retired = [
43072
- path93.join(harnesses.claude.homeDir, "CLAUDE.md"),
43073
- path93.join(harnesses.codex.homeDir, "AGENTS.md"),
43074
- path93.join(harnesses.pi.homeDir, "AGENTS.md")
43171
+ path94.join(harnesses.claude.homeDir, "CLAUDE.md"),
43172
+ path94.join(harnesses.codex.homeDir, "AGENTS.md"),
43173
+ path94.join(harnesses.pi.homeDir, "AGENTS.md")
43075
43174
  ];
43076
43175
  function reportRetiredAgentsFiles() {
43077
- const leftovers = retired.filter((file) => fs41.existsSync(file));
43176
+ const leftovers = retired.filter((file) => fs42.existsSync(file));
43078
43177
  if (leftovers.length === 0) return;
43079
43178
  console.log(
43080
43179
  "No longer written by sync \u2014 each harness now composes its own advice at session start:"
@@ -43086,32 +43185,32 @@ function reportRetiredAgentsFiles() {
43086
43185
  }
43087
43186
 
43088
43187
  // src/commands/sync/syncCodex.ts
43089
- import * as path96 from "path";
43188
+ import * as path97 from "path";
43090
43189
 
43091
43190
  // src/commands/sync/installHarnessCommands.ts
43092
- import * as fs42 from "fs";
43093
- import * as path94 from "path";
43191
+ import * as fs43 from "fs";
43192
+ import * as path95 from "path";
43094
43193
  function installHarnessCommands(claudeDir, harness, transform) {
43095
- const commandsSource = path94.join(claudeDir, "commands");
43096
- const files = fs42.readdirSync(commandsSource);
43194
+ const commandsSource = path95.join(claudeDir, "commands");
43195
+ const files = fs43.readdirSync(commandsSource);
43097
43196
  const names = [];
43098
43197
  let synced = 0;
43099
43198
  for (const file of files) {
43100
43199
  if (!file.endsWith(".md")) continue;
43101
43200
  const name = file.replace(/\.md$/, "");
43102
43201
  names.push(name);
43103
- const content = fs42.readFileSync(path94.join(commandsSource, file), "utf8");
43104
- const target = path94.join(harness.homeDir, harness.sync.commandDest(name));
43105
- fs42.mkdirSync(path94.dirname(target), { recursive: true });
43106
- fs42.writeFileSync(target, transform(name, content));
43202
+ const content = fs43.readFileSync(path95.join(commandsSource, file), "utf8");
43203
+ const target = path95.join(harness.homeDir, harness.sync.commandDest(name));
43204
+ fs43.mkdirSync(path95.dirname(target), { recursive: true });
43205
+ fs43.writeFileSync(target, transform(name, content));
43107
43206
  synced++;
43108
43207
  }
43109
43208
  return { total: files.length, synced, names };
43110
43209
  }
43111
43210
 
43112
43211
  // src/commands/sync/syncCodexHooks.ts
43113
- import * as fs43 from "fs";
43114
- import * as path95 from "path";
43212
+ import * as fs44 from "fs";
43213
+ import * as path96 from "path";
43115
43214
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
43116
43215
  var END = "# <<< assist codex hooks (managed) <<<";
43117
43216
  function upsertManagedBlock(existing, body) {
@@ -43141,11 +43240,11 @@ ${rest}
43141
43240
  `;
43142
43241
  }
43143
43242
  function syncCodexHooks(sourcePath) {
43144
- const body = fs43.readFileSync(sourcePath, "utf8");
43145
- const configPath = path95.join(harnesses.codex.homeDir, "config.toml");
43146
- const existing = fs43.existsSync(configPath) ? fs43.readFileSync(configPath, "utf8") : "";
43147
- fs43.mkdirSync(path95.dirname(configPath), { recursive: true });
43148
- fs43.writeFileSync(configPath, upsertManagedBlock(existing, body));
43243
+ const body = fs44.readFileSync(sourcePath, "utf8");
43244
+ const configPath = path96.join(harnesses.codex.homeDir, "config.toml");
43245
+ const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
43246
+ fs44.mkdirSync(path96.dirname(configPath), { recursive: true });
43247
+ fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
43149
43248
  console.log(
43150
43249
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
43151
43250
  );
@@ -43159,39 +43258,39 @@ function syncCodex(claudeDir, options2) {
43159
43258
  harnesses.codex,
43160
43259
  commandToSkill
43161
43260
  );
43162
- syncCodexHooks(path96.join(claudeDir, "..", "codex", "config.toml"));
43261
+ syncCodexHooks(path97.join(claudeDir, "..", "codex", "config.toml"));
43163
43262
  console.log(`Synced ${total2} skill(s) to ~/.codex/skills`);
43164
43263
  if (!options2?.prune) return;
43165
43264
  const force = options2.force ?? false;
43166
43265
  reportPrune(
43167
43266
  "~/.codex/skills",
43168
- pruneSkills(path96.join(harnesses.codex.homeDir, "skills"), names, { force }),
43267
+ pruneSkills(path97.join(harnesses.codex.homeDir, "skills"), names, { force }),
43169
43268
  force
43170
43269
  );
43171
43270
  }
43172
43271
 
43173
43272
  // src/commands/sync/syncDesign.ts
43174
- import * as fs44 from "fs";
43175
- import * as path97 from "path";
43273
+ import * as fs45 from "fs";
43274
+ import * as path98 from "path";
43176
43275
  function syncDesign(claudeDir, targetBase) {
43177
- const systemPromptSource = path97.join(claudeDir, "design-system-prompt.md");
43178
- const systemPromptTarget = path97.join(targetBase, "design-system-prompt.md");
43179
- fs44.copyFileSync(systemPromptSource, systemPromptTarget);
43276
+ const systemPromptSource = path98.join(claudeDir, "design-system-prompt.md");
43277
+ const systemPromptTarget = path98.join(targetBase, "design-system-prompt.md");
43278
+ fs45.copyFileSync(systemPromptSource, systemPromptTarget);
43180
43279
  console.log(
43181
43280
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
43182
43281
  );
43183
- const skillsSource = path97.join(claudeDir, "skills");
43184
- const skillsTarget = path97.join(targetBase, "skills");
43185
- fs44.mkdirSync(skillsTarget, { recursive: true });
43186
- const entries = fs44.readdirSync(skillsSource, { withFileTypes: true });
43282
+ const skillsSource = path98.join(claudeDir, "skills");
43283
+ const skillsTarget = path98.join(targetBase, "skills");
43284
+ fs45.mkdirSync(skillsTarget, { recursive: true });
43285
+ const entries = fs45.readdirSync(skillsSource, { withFileTypes: true });
43187
43286
  for (const entry of entries) {
43188
- const source = path97.join(skillsSource, entry.name);
43189
- const target = path97.join(skillsTarget, entry.name);
43287
+ const source = path98.join(skillsSource, entry.name);
43288
+ const target = path98.join(skillsTarget, entry.name);
43190
43289
  if (entry.isDirectory()) {
43191
- fs44.rmSync(target, { recursive: true, force: true });
43192
- fs44.cpSync(source, target, { recursive: true });
43290
+ fs45.rmSync(target, { recursive: true, force: true });
43291
+ fs45.cpSync(source, target, { recursive: true });
43193
43292
  } else {
43194
- fs44.copyFileSync(source, target);
43293
+ fs45.copyFileSync(source, target);
43195
43294
  }
43196
43295
  }
43197
43296
  console.log(`Synced ${entries.length} skill(s) to ~/.claude/skills`);
@@ -43199,22 +43298,22 @@ function syncDesign(claudeDir, targetBase) {
43199
43298
  }
43200
43299
 
43201
43300
  // src/commands/sync/syncPi.ts
43202
- import * as path99 from "path";
43301
+ import * as path100 from "path";
43203
43302
 
43204
43303
  // src/commands/sync/syncPiHooks.ts
43205
- import * as fs45 from "fs";
43206
- import * as path98 from "path";
43304
+ import * as fs46 from "fs";
43305
+ import * as path99 from "path";
43207
43306
  function piExtensionsDir() {
43208
- return path98.join(harnesses.pi.homeDir, "extensions");
43307
+ return path99.join(harnesses.pi.homeDir, "extensions");
43209
43308
  }
43210
43309
  function syncPiHooks(sourceDir) {
43211
43310
  const target = piExtensionsDir();
43212
- fs45.mkdirSync(target, { recursive: true });
43213
- const files = fs45.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
43311
+ fs46.mkdirSync(target, { recursive: true });
43312
+ const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
43214
43313
  for (const file of files) {
43215
- fs45.copyFileSync(
43216
- path98.join(sourceDir, file),
43217
- path98.join(target, `assist-${file}`)
43314
+ fs46.copyFileSync(
43315
+ path99.join(sourceDir, file),
43316
+ path99.join(target, `assist-${file}`)
43218
43317
  );
43219
43318
  }
43220
43319
  console.log(
@@ -43249,28 +43348,28 @@ function syncPi(claudeDir, options2) {
43249
43348
  harnesses.pi,
43250
43349
  commandToPrompt
43251
43350
  );
43252
- syncPiHooks(path99.join(claudeDir, "..", "pi"));
43351
+ syncPiHooks(path100.join(claudeDir, "..", "pi"));
43253
43352
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
43254
43353
  if (!options2?.prune) return;
43255
43354
  const force = options2.force ?? false;
43256
43355
  reportPrune(
43257
43356
  "~/.pi/agent/prompts",
43258
- pruneCommands(path99.join(harnesses.pi.homeDir, "prompts"), names, { force }),
43357
+ pruneCommands(path100.join(harnesses.pi.homeDir, "prompts"), names, { force }),
43259
43358
  force
43260
43359
  );
43261
43360
  }
43262
43361
 
43263
43362
  // src/commands/sync/syncSettings.ts
43264
- import * as fs46 from "fs";
43265
- import * as path100 from "path";
43363
+ import * as fs47 from "fs";
43364
+ import * as path101 from "path";
43266
43365
  import chalk269 from "chalk";
43267
43366
  async function syncSettings(claudeDir, targetBase, options2) {
43268
- const source = path100.join(claudeDir, "settings.json");
43269
- const target = path100.join(targetBase, "settings.json");
43270
- const sourceContent = fs46.readFileSync(source, "utf8");
43367
+ const source = path101.join(claudeDir, "settings.json");
43368
+ const target = path101.join(targetBase, "settings.json");
43369
+ const sourceContent = fs47.readFileSync(source, "utf8");
43271
43370
  const sourceSettings = JSON.parse(sourceContent);
43272
- const targetExists = fs46.existsSync(target);
43273
- const targetContent = targetExists ? fs46.readFileSync(target, "utf8") : "";
43371
+ const targetExists = fs47.existsSync(target);
43372
+ const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
43274
43373
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
43275
43374
  const mergedContent = JSON.stringify(
43276
43375
  { ...preservedUserSettings, ...sourceSettings },
@@ -43300,19 +43399,19 @@ async function syncSettings(claudeDir, targetBase, options2) {
43300
43399
  }
43301
43400
  }
43302
43401
  }
43303
- fs46.writeFileSync(target, mergedContent);
43402
+ fs47.writeFileSync(target, mergedContent);
43304
43403
  console.log("Copied settings.json to ~/.claude/settings.json");
43305
43404
  }
43306
43405
 
43307
43406
  // src/commands/sync.ts
43308
43407
  var __filename4 = fileURLToPath8(import.meta.url);
43309
- var __dirname5 = path101.dirname(__filename4);
43408
+ var __dirname5 = path102.dirname(__filename4);
43310
43409
  async function sync(options2) {
43311
43410
  const config = loadConfig();
43312
43411
  const yes = options2?.yes ?? config.sync.autoConfirm;
43313
43412
  const prune = { prune: options2?.prune, force: options2?.force };
43314
- const claudeDir = path101.join(__dirname5, "..", "claude");
43315
- const targetBase = path101.join(os5.homedir(), ".claude");
43413
+ const claudeDir = path102.join(__dirname5, "..", "claude");
43414
+ const targetBase = path102.join(os5.homedir(), ".claude");
43316
43415
  const commandNames = syncClaudeCommands(claudeDir, targetBase);
43317
43416
  const skillDirNames = syncDesign(claudeDir, targetBase);
43318
43417
  await syncSettings(claudeDir, targetBase, { yes });
@@ -43324,7 +43423,7 @@ async function sync(options2) {
43324
43423
  reportPrune(
43325
43424
  "~/.claude/skills",
43326
43425
  pruneSkills(
43327
- path101.join(targetBase, "skills"),
43426
+ path102.join(targetBase, "skills"),
43328
43427
  [...commandNames, ...skillDirNames],
43329
43428
  { force }
43330
43429
  ),
@@ -43332,7 +43431,7 @@ async function sync(options2) {
43332
43431
  );
43333
43432
  reportPrune(
43334
43433
  "~/.claude/commands",
43335
- pruneCommands(path101.join(targetBase, "commands"), [], { force }),
43434
+ pruneCommands(path102.join(targetBase, "commands"), [], { force }),
43336
43435
  force
43337
43436
  );
43338
43437
  }
@@ -44069,12 +44168,12 @@ function adviceFragments() {
44069
44168
 
44070
44169
  // src/commands/verify/blockCodeComments/findComments.ts
44071
44170
  import { execSync as execSync59 } from "child_process";
44072
- import fs48 from "fs";
44171
+ import fs49 from "fs";
44073
44172
  import { minimatch as minimatch9 } from "minimatch";
44074
- import { Project as Project5 } from "ts-morph";
44173
+ import { Project as Project6 } from "ts-morph";
44075
44174
 
44076
44175
  // src/commands/verify/blockCodeComments/collectFileComments.ts
44077
- import fs47 from "fs";
44176
+ import fs48 from "fs";
44078
44177
 
44079
44178
  // src/shared/isBicepFile.ts
44080
44179
  var BICEP_EXTENSIONS = [".bicep", ".bicepparam"];
@@ -44223,7 +44322,7 @@ function toFindings(file, lines2, raw, exempt) {
44223
44322
 
44224
44323
  // src/commands/verify/blockCodeComments/collectFileComments.ts
44225
44324
  function collectFileComments(file, lines2, project) {
44226
- const read3 = () => fs47.readFileSync(file, "utf8");
44325
+ const read3 = () => fs48.readFileSync(file, "utf8");
44227
44326
  if (isYamlFile(file))
44228
44327
  return toFindings(file, lines2, collectYamlComments(read3()), false);
44229
44328
  if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
@@ -44304,7 +44403,7 @@ function shouldScan(file, ignoreGlobs) {
44304
44403
  if (!SCANNED_EXTENSIONS.some((ext) => file.endsWith(ext)) && !isHashCommentFile(file))
44305
44404
  return false;
44306
44405
  if (ignoreGlobs.some((glob) => minimatch9(file, glob))) return false;
44307
- return fs48.existsSync(file);
44406
+ return fs49.existsSync(file);
44308
44407
  }
44309
44408
  function findComments(options2) {
44310
44409
  const diff3 = execSync59("git diff HEAD", {
@@ -44312,7 +44411,7 @@ function findComments(options2) {
44312
44411
  maxBuffer: 64 * 1024 * 1024
44313
44412
  });
44314
44413
  const addedLines = parseDiffAddedLines(diff3);
44315
- const project = new Project5({
44414
+ const project = new Project6({
44316
44415
  skipAddingFilesFromTsConfig: true,
44317
44416
  compilerOptions: { allowJs: true }
44318
44417
  });
@@ -44394,9 +44493,9 @@ import { existsSync as existsSync81, readFileSync as readFileSync64 } from "fs";
44394
44493
 
44395
44494
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
44396
44495
  import { minimatch as minimatch10 } from "minimatch";
44397
- function resolveStringsAtPath(data, path108) {
44496
+ function resolveStringsAtPath(data, path109) {
44398
44497
  let current = data;
44399
- for (const segment of path108.split(".")) {
44498
+ for (const segment of path109.split(".")) {
44400
44499
  if (current === null || typeof current !== "object") return [];
44401
44500
  current = current[segment];
44402
44501
  }
@@ -44409,10 +44508,10 @@ function resolveStringsAtPath(data, path108) {
44409
44508
  }
44410
44509
  function findRuleViolations(data, rule) {
44411
44510
  const violations = [];
44412
- for (const path108 of rule.paths) {
44413
- for (const value of resolveStringsAtPath(data, path108)) {
44511
+ for (const path109 of rule.paths) {
44512
+ for (const value of resolveStringsAtPath(data, path109)) {
44414
44513
  if (minimatch10(value, rule.disallowed))
44415
- violations.push({ file: rule.file, path: path108, value });
44514
+ violations.push({ file: rule.file, path: path109, value });
44416
44515
  }
44417
44516
  }
44418
44517
  return violations;
@@ -44451,8 +44550,8 @@ function forbiddenStrings() {
44451
44550
  process.exit(0);
44452
44551
  }
44453
44552
  console.log("Forbidden strings found:\n");
44454
- for (const { file, path: path108, value } of violations) {
44455
- console.log(` ${file} ${path108}: ${value}`);
44553
+ for (const { file, path: path109, value } of violations) {
44554
+ console.log(` ${file} ${path109}: ${value}`);
44456
44555
  }
44457
44556
  console.log(`
44458
44557
  Total: ${violations.length} forbidden string(s).`);
@@ -44510,7 +44609,7 @@ Total: ${lines2.length} hardcoded color(s)`);
44510
44609
 
44511
44610
  // src/commands/verify/migrations.ts
44512
44611
  import { readFileSync as readFileSync65 } from "fs";
44513
- import path103 from "path";
44612
+ import path104 from "path";
44514
44613
 
44515
44614
  // src/commands/verify/migrations/checkAppendOnly.ts
44516
44615
  function checkAppendOnly(baseline, current) {
@@ -44602,15 +44701,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
44602
44701
  } catch {
44603
44702
  return baseline;
44604
44703
  }
44605
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path108) => MIGRATION_FILE3.test(basename31(path108)));
44606
- for (const path108 of paths) {
44704
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path109) => MIGRATION_FILE3.test(basename31(path109)));
44705
+ for (const path109 of paths) {
44607
44706
  try {
44608
- const content = execSync60(`git show "${ref}:${path108}"`, {
44707
+ const content = execSync60(`git show "${ref}:${path109}"`, {
44609
44708
  encoding: "utf8",
44610
44709
  maxBuffer: 16 * 1024 * 1024,
44611
44710
  stdio: ["pipe", "pipe", "pipe"]
44612
44711
  });
44613
- baseline.set(basename31(path108), content);
44712
+ baseline.set(basename31(path109), content);
44614
44713
  } catch {
44615
44714
  }
44616
44715
  }
@@ -44649,11 +44748,11 @@ function resolveBaselineRef() {
44649
44748
  }
44650
44749
 
44651
44750
  // src/commands/verify/migrations/migrationsDir.ts
44652
- import path102 from "path";
44751
+ import path103 from "path";
44653
44752
  import { fileURLToPath as fileURLToPath9 } from "url";
44654
44753
  function migrationsDir() {
44655
- return path102.resolve(
44656
- path102.dirname(fileURLToPath9(import.meta.url)),
44754
+ return path103.resolve(
44755
+ path103.dirname(fileURLToPath9(import.meta.url)),
44657
44756
  "../../../shared/db/migrations"
44658
44757
  );
44659
44758
  }
@@ -44674,7 +44773,7 @@ function migrations2() {
44674
44773
  if (ref) {
44675
44774
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
44676
44775
  const current = new Map(
44677
- files.map((file) => [file, readFileSync65(path103.join(dir, file), "utf8")])
44776
+ files.map((file) => [file, readFileSync65(path104.join(dir, file), "utf8")])
44678
44777
  );
44679
44778
  for (const finding of checkAppendOnly(baseline, current)) {
44680
44779
  problems.push(
@@ -44917,31 +45016,31 @@ function restartAdvice(paths) {
44917
45016
  // src/commands/watch/syncAdvice.ts
44918
45017
  var rules = [
44919
45018
  {
44920
- matches: (path108) => path108.startsWith("claude/commands/"),
45019
+ matches: (path109) => path109.startsWith("claude/commands/"),
44921
45020
  reason: "claude/commands changed"
44922
45021
  },
44923
45022
  {
44924
- matches: (path108) => path108.startsWith("claude/skills/"),
45023
+ matches: (path109) => path109.startsWith("claude/skills/"),
44925
45024
  reason: "claude/skills changed"
44926
45025
  },
44927
45026
  {
44928
- matches: (path108) => path108.startsWith("src/commands/review/"),
45027
+ matches: (path109) => path109.startsWith("src/commands/review/"),
44929
45028
  reason: "review-ci bundle sources changed"
44930
45029
  },
44931
45030
  {
44932
- matches: (path108) => path108 === "claude/settings.json",
45031
+ matches: (path109) => path109 === "claude/settings.json",
44933
45032
  reason: "claude/settings.json changed"
44934
45033
  },
44935
45034
  {
44936
- matches: (path108) => path108 === "claude/design-system-prompt.md",
45035
+ matches: (path109) => path109 === "claude/design-system-prompt.md",
44937
45036
  reason: "claude/design-system-prompt.md changed"
44938
45037
  },
44939
45038
  {
44940
- matches: (path108) => path108.startsWith("codex/"),
45039
+ matches: (path109) => path109.startsWith("codex/"),
44941
45040
  reason: "codex sources changed"
44942
45041
  },
44943
45042
  {
44944
- matches: (path108) => path108.startsWith("pi/"),
45043
+ matches: (path109) => path109.startsWith("pi/"),
44945
45044
  reason: "pi sources changed"
44946
45045
  }
44947
45046
  ];
@@ -45253,10 +45352,10 @@ ${buildWatchReport(from)}`);
45253
45352
 
45254
45353
  // src/commands/watch/consumeMarker.ts
45255
45354
  import { existsSync as existsSync83, rmSync as rmSync11 } from "fs";
45256
- function consumeMarker(path108) {
45355
+ function consumeMarker(path109) {
45257
45356
  try {
45258
- if (!existsSync83(path108)) return false;
45259
- rmSync11(path108);
45357
+ if (!existsSync83(path109)) return false;
45358
+ rmSync11(path109);
45260
45359
  return true;
45261
45360
  } catch {
45262
45361
  return false;
@@ -45556,9 +45655,9 @@ function findPortFile(roamDir) {
45556
45655
  return void 0;
45557
45656
  }
45558
45657
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
45559
- const path108 = join102(roamDir, name);
45658
+ const path109 = join102(roamDir, name);
45560
45659
  try {
45561
- return { path: path108, mtimeMs: statSync13(path108).mtimeMs };
45660
+ return { path: path109, mtimeMs: statSync13(path109).mtimeMs };
45562
45661
  } catch {
45563
45662
  return void 0;
45564
45663
  }
@@ -45724,11 +45823,11 @@ function findLinkIndex() {
45724
45823
  function parseLinkArgs() {
45725
45824
  const idx = findLinkIndex();
45726
45825
  if (idx === -1) return null;
45727
- const path108 = process.argv[idx + 1];
45826
+ const path109 = process.argv[idx + 1];
45728
45827
  const rest = process.argv.slice(idx + 2);
45729
45828
  const { value: prefix2 } = extractOption(rest, "--prefix");
45730
45829
  if (!prefix2) return null;
45731
- return { path: path108, prefix: prefix2 };
45830
+ return { path: path109, prefix: prefix2 };
45732
45831
  }
45733
45832
  function hasDuplicateLink(runList, linkPath) {
45734
45833
  return runList.some(
@@ -46076,10 +46175,10 @@ function removeEmptyNamespaceDirs(filePath) {
46076
46175
  function deleteCommandFile(name) {
46077
46176
  const filePath = runCommandFilePath(name);
46078
46177
  const legacyPath = join104(".claude", "commands", `${name}.md`);
46079
- for (const path108 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
46080
- if (existsSync84(path108)) {
46081
- unlinkSync19(path108);
46082
- console.log(`Deleted command file: ${path108}`);
46178
+ for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
46179
+ if (existsSync84(path109)) {
46180
+ unlinkSync19(path109);
46181
+ console.log(`Deleted command file: ${path109}`);
46083
46182
  }
46084
46183
  }
46085
46184
  removeEmptyNamespaceDirs(filePath);
@@ -46766,15 +46865,15 @@ function writtenFilePaths(entry) {
46766
46865
  const b = asRecord(block);
46767
46866
  if (b?.type !== "tool_use" || !WRITE_TOOLS2.has(String(b.name))) continue;
46768
46867
  const input = asRecord(b.input);
46769
- const path108 = input?.file_path ?? input?.notebook_path;
46770
- if (typeof path108 === "string") paths.push(path108);
46868
+ const path109 = input?.file_path ?? input?.notebook_path;
46869
+ if (typeof path109 === "string") paths.push(path109);
46771
46870
  }
46772
46871
  return paths;
46773
46872
  }
46774
46873
 
46775
46874
  // src/commands/sessions/daemon/lastWriteTimes.ts
46776
- function normalise(path108) {
46777
- return path108.replaceAll("\\", "/");
46875
+ function normalise(path109) {
46876
+ return path109.replaceAll("\\", "/");
46778
46877
  }
46779
46878
  function latest(current, at2) {
46780
46879
  return current === void 0 || at2 > current ? at2 : current;
@@ -46792,10 +46891,10 @@ async function lastWriteTimes(transcriptPath2, target) {
46792
46891
  }
46793
46892
  const at2 = Date.parse(String(entry.timestamp));
46794
46893
  if (Number.isNaN(at2)) continue;
46795
- for (const path108 of writtenFilePaths(entry).map(normalise)) {
46796
- if (path108.endsWith(`/${target.file}`))
46894
+ for (const path109 of writtenFilePaths(entry).map(normalise)) {
46895
+ if (path109.endsWith(`/${target.file}`))
46797
46896
  result.file = latest(result.file, at2);
46798
- if (path108.includes(`/${target.within}`))
46897
+ if (path109.includes(`/${target.within}`))
46799
46898
  result.within = latest(result.within, at2);
46800
46899
  }
46801
46900
  }
@@ -46803,42 +46902,42 @@ async function lastWriteTimes(transcriptPath2, target) {
46803
46902
  }
46804
46903
 
46805
46904
  // src/commands/sessions/shared/findTranscriptPathSync.ts
46806
- import * as fs49 from "fs";
46807
- import * as path104 from "path";
46905
+ import * as fs50 from "fs";
46906
+ import * as path105 from "path";
46808
46907
  function projectDirForCwd(cwd) {
46809
- return path104.join(claudeProjectsRoot(), projectSlug(cwd));
46908
+ return path105.join(claudeProjectsRoot(), projectSlug(cwd));
46810
46909
  }
46811
46910
  function transcriptPathFor(cwd, claudeSessionId) {
46812
- return path104.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
46911
+ return path105.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
46813
46912
  }
46814
46913
  function findTranscriptPathSync(cwd, claudeSessionId) {
46815
46914
  const direct = transcriptPathFor(cwd, claudeSessionId);
46816
- if (fs49.existsSync(direct)) return direct;
46915
+ if (fs50.existsSync(direct)) return direct;
46817
46916
  const dir = projectDirForCwd(cwd);
46818
46917
  let files;
46819
46918
  try {
46820
- files = fs49.readdirSync(dir);
46919
+ files = fs50.readdirSync(dir);
46821
46920
  } catch {
46822
46921
  return null;
46823
46922
  }
46824
46923
  for (const file of files) {
46825
46924
  if (!file.endsWith(".jsonl")) continue;
46826
- if (headContainsSessionId(path104.join(dir, file), claudeSessionId))
46827
- return path104.join(dir, file);
46925
+ if (headContainsSessionId(path105.join(dir, file), claudeSessionId))
46926
+ return path105.join(dir, file);
46828
46927
  }
46829
46928
  return null;
46830
46929
  }
46831
46930
  function headContainsSessionId(filePath, claudeSessionId) {
46832
46931
  let fd;
46833
46932
  try {
46834
- fd = fs49.openSync(filePath, "r");
46933
+ fd = fs50.openSync(filePath, "r");
46835
46934
  const buf = Buffer.alloc(16384);
46836
- const bytesRead = fs49.readSync(fd, buf, 0, buf.length, 0);
46935
+ const bytesRead = fs50.readSync(fd, buf, 0, buf.length, 0);
46837
46936
  return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
46838
46937
  } catch {
46839
46938
  return false;
46840
46939
  } finally {
46841
- if (fd !== void 0) fs49.closeSync(fd);
46940
+ if (fd !== void 0) fs50.closeSync(fd);
46842
46941
  }
46843
46942
  }
46844
46943
 
@@ -47363,14 +47462,14 @@ import * as pty from "node-pty";
47363
47462
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
47364
47463
  import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
47365
47464
  import { createRequire as createRequire3 } from "module";
47366
- import path105 from "path";
47465
+ import path106 from "path";
47367
47466
  var require4 = createRequire3(import.meta.url);
47368
47467
  var ensured = false;
47369
47468
  function ensureSpawnHelperExecutable() {
47370
47469
  if (ensured || process.platform !== "darwin") return;
47371
47470
  ensured = true;
47372
- const ptyRoot = path105.join(path105.dirname(require4.resolve("node-pty")), "..");
47373
- const helper = path105.join(
47471
+ const ptyRoot = path106.join(path106.dirname(require4.resolve("node-pty")), "..");
47472
+ const helper = path106.join(
47374
47473
  ptyRoot,
47375
47474
  "prebuilds",
47376
47475
  `${process.platform}-${process.arch}`,
@@ -47517,19 +47616,19 @@ function serverRunMeta(runName, cwd) {
47517
47616
  }
47518
47617
 
47519
47618
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
47520
- import * as fs50 from "fs";
47521
- import * as path106 from "path";
47619
+ import * as fs51 from "fs";
47620
+ import * as path107 from "path";
47522
47621
  import { fileURLToPath as fileURLToPath10 } from "url";
47523
47622
  var __filename5 = fileURLToPath10(import.meta.url);
47524
- var __dirname6 = path106.dirname(__filename5);
47623
+ var __dirname6 = path107.dirname(__filename5);
47525
47624
  function readDesignSystemPrompt() {
47526
- const promptPath = path106.join(
47625
+ const promptPath = path107.join(
47527
47626
  __dirname6,
47528
47627
  "..",
47529
47628
  "claude",
47530
47629
  "design-system-prompt.md"
47531
47630
  );
47532
- return fs50.readFileSync(promptPath, "utf8");
47631
+ return fs51.readFileSync(promptPath, "utf8");
47533
47632
  }
47534
47633
 
47535
47634
  // src/commands/sessions/daemon/spawnClaude.ts
@@ -47753,16 +47852,16 @@ import { readFileSync as readFileSync70, writeFileSync as writeFileSync57 } from
47753
47852
  var KEEP_TAIL = 256 * 1024;
47754
47853
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
47755
47854
  function trimWatcherLog(cwd) {
47756
- const path108 = watcherLogPath(cwd);
47855
+ const path109 = watcherLogPath(cwd);
47757
47856
  let log2;
47758
47857
  try {
47759
- log2 = readFileSync70(path108, "utf8");
47858
+ log2 = readFileSync70(path109, "utf8");
47760
47859
  } catch {
47761
47860
  return;
47762
47861
  }
47763
47862
  if (log2.length <= MAX_LOG_SIZE) return;
47764
- writeFileSync57(path108, log2.slice(-KEEP_TAIL));
47765
- daemonLog(`auto-update: log ${path108} trimmed to its last ${KEEP_TAIL} chars`);
47863
+ writeFileSync57(path109, log2.slice(-KEEP_TAIL));
47864
+ daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
47766
47865
  }
47767
47866
 
47768
47867
  // src/commands/sessions/daemon/worktree/appendWatcherLog.ts
@@ -47770,9 +47869,9 @@ import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync37 } from "fs"
47770
47869
  import { dirname as dirname47 } from "path";
47771
47870
  function appendWatcherLog(cwd, data) {
47772
47871
  try {
47773
- const path108 = watcherLogPath(cwd);
47774
- mkdirSync37(dirname47(path108), { recursive: true });
47775
- appendFileSync5(path108, data);
47872
+ const path109 = watcherLogPath(cwd);
47873
+ mkdirSync37(dirname47(path109), { recursive: true });
47874
+ appendFileSync5(path109, data);
47776
47875
  } catch {
47777
47876
  }
47778
47877
  }
@@ -47787,13 +47886,13 @@ function detectExistingWorktree(cwd) {
47787
47886
  }
47788
47887
 
47789
47888
  // src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
47790
- function refuseUnallocatedStart(session, path108, error, startHeld) {
47889
+ function refuseUnallocatedStart(session, path109, error, startHeld) {
47791
47890
  const reason4 = error instanceof Error ? error.message : String(error);
47792
47891
  daemonLog(
47793
- `session ${session.id} worktree ${path108} could not be created: ${reason4}`
47892
+ `session ${session.id} worktree ${path109} could not be created: ${reason4}`
47794
47893
  );
47795
47894
  session.pendingStart = () => {
47796
- throw new Error(`worktree ${path108} could not be created: ${reason4}`);
47895
+ throw new Error(`worktree ${path109} could not be created: ${reason4}`);
47797
47896
  };
47798
47897
  startHeld(session);
47799
47898
  }
@@ -47814,9 +47913,9 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
47814
47913
  }
47815
47914
  notify2();
47816
47915
  }
47817
- function seedHeldSession(session, path108, clone, notify2, startHeld) {
47916
+ function seedHeldSession(session, path109, clone, notify2, startHeld) {
47818
47917
  seedWorktree(
47819
- path108,
47918
+ path109,
47820
47919
  clone,
47821
47920
  () => {
47822
47921
  session.seeding = void 0;
@@ -48035,8 +48134,8 @@ import { rmSync as rmSync13 } from "fs";
48035
48134
  function clearLapSignals(cwd) {
48036
48135
  const control = watchControlPaths(cwd);
48037
48136
  if (!control) return;
48038
- for (const path108 of [control.check, control.stop])
48039
- rmSync13(path108, { force: true });
48137
+ for (const path109 of [control.check, control.stop])
48138
+ rmSync13(path109, { force: true });
48040
48139
  }
48041
48140
  function runUpdateLap(cwd, onOutput) {
48042
48141
  clearLapSignals(cwd);
@@ -49308,8 +49407,8 @@ async function seedRunningMsFromUsage(session, notify2) {
49308
49407
  var DEBOUNCE_MS2 = 50;
49309
49408
  function watchActivity(session, notify2, onClaudeSessionId) {
49310
49409
  if (session.commandType !== "assist" || !session.cwd) return;
49311
- const path108 = activityPath(session.id);
49312
- const dir = dirname48(path108);
49410
+ const path109 = activityPath(session.id);
49411
+ const dir = dirname48(path109);
49313
49412
  try {
49314
49413
  mkdirSync38(dir, { recursive: true });
49315
49414
  } catch {
@@ -49319,7 +49418,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
49319
49418
  let timer = null;
49320
49419
  const read3 = () => {
49321
49420
  timer = null;
49322
- const activity2 = readActivity(path108);
49421
+ const activity2 = readActivity(path109);
49323
49422
  if (!activity2) return;
49324
49423
  applyActivityToSession(session, activity2);
49325
49424
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -49328,11 +49427,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
49328
49427
  notify2();
49329
49428
  };
49330
49429
  session.activityWatcher = watch2(dir, (_event, filename) => {
49331
- if (filename && !path108.endsWith(filename)) return;
49430
+ if (filename && !path109.endsWith(filename)) return;
49332
49431
  if (timer) clearTimeout(timer);
49333
49432
  timer = setTimeout(read3, DEBOUNCE_MS2);
49334
49433
  });
49335
- if (existsSync96(path108)) read3();
49434
+ if (existsSync96(path109)) read3();
49336
49435
  }
49337
49436
  function refreshActivity(session) {
49338
49437
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -49412,7 +49511,7 @@ function reportSilentFailure(session, clients) {
49412
49511
  }
49413
49512
 
49414
49513
  // src/commands/sessions/shared/codex/resolveCodexSessionId.ts
49415
- import * as fs51 from "fs";
49514
+ import * as fs52 from "fs";
49416
49515
  var META_LINES = 5;
49417
49516
  async function resolveCodexSessionId(cwd, sinceMs) {
49418
49517
  if (!cwd) return null;
@@ -49441,7 +49540,7 @@ async function startedIn(file, cwd, sinceMs) {
49441
49540
  }
49442
49541
  async function touchedSince(file, sinceMs) {
49443
49542
  try {
49444
- return (await fs51.promises.stat(file)).mtimeMs >= sinceMs;
49543
+ return (await fs52.promises.stat(file)).mtimeMs >= sinceMs;
49445
49544
  } catch {
49446
49545
  return false;
49447
49546
  }
@@ -49607,7 +49706,7 @@ function deriveTranscriptStatus(entries, opts = {}) {
49607
49706
  }
49608
49707
 
49609
49708
  // src/commands/sessions/shared/readTranscriptTail.ts
49610
- import * as fs52 from "fs";
49709
+ import * as fs53 from "fs";
49611
49710
  var DEFAULT_MAX_BYTES = 256 * 1024;
49612
49711
  function parseTailEntries(raw) {
49613
49712
  const entries = [];
@@ -49631,7 +49730,7 @@ function dropPartialFirstLine(raw, sliced) {
49631
49730
  async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
49632
49731
  let handle;
49633
49732
  try {
49634
- handle = await fs52.promises.open(filePath, "r");
49733
+ handle = await fs53.promises.open(filePath, "r");
49635
49734
  const { size } = await handle.stat();
49636
49735
  const start2 = Math.max(0, size - maxBytes);
49637
49736
  const length = size - start2;
@@ -49650,20 +49749,20 @@ async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
49650
49749
  function readTranscriptTailSync(filePath, maxBytes = DEFAULT_MAX_BYTES) {
49651
49750
  let fd;
49652
49751
  try {
49653
- fd = fs52.openSync(filePath, "r");
49654
- const { size } = fs52.fstatSync(fd);
49752
+ fd = fs53.openSync(filePath, "r");
49753
+ const { size } = fs53.fstatSync(fd);
49655
49754
  const start2 = Math.max(0, size - maxBytes);
49656
49755
  const length = size - start2;
49657
49756
  if (length === 0) return [];
49658
49757
  const buf = Buffer.alloc(length);
49659
- fs52.readSync(fd, buf, 0, length, start2);
49758
+ fs53.readSync(fd, buf, 0, length, start2);
49660
49759
  return parseTailEntries(
49661
49760
  dropPartialFirstLine(buf.toString("utf8"), start2 > 0)
49662
49761
  );
49663
49762
  } catch {
49664
49763
  return [];
49665
49764
  } finally {
49666
- if (fd !== void 0) fs52.closeSync(fd);
49765
+ if (fd !== void 0) fs53.closeSync(fd);
49667
49766
  }
49668
49767
  }
49669
49768
 
@@ -50073,7 +50172,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
50073
50172
  }
50074
50173
 
50075
50174
  // src/commands/sessions/shared/transcriptUsage.ts
50076
- import * as fs53 from "fs";
50175
+ import * as fs54 from "fs";
50077
50176
  function transcriptUsage(lines2) {
50078
50177
  const byId = /* @__PURE__ */ new Map();
50079
50178
  for (const line of lines2) {
@@ -50097,7 +50196,7 @@ function transcriptUsage(lines2) {
50097
50196
  return [...byId.values()];
50098
50197
  }
50099
50198
  async function readTranscriptUsage(transcriptPath2) {
50100
- const content = await fs53.promises.readFile(transcriptPath2, "utf8");
50199
+ const content = await fs54.promises.readFile(transcriptPath2, "utf8");
50101
50200
  return transcriptUsage(content.split("\n"));
50102
50201
  }
50103
50202
 
@@ -50838,9 +50937,9 @@ function tempRoots() {
50838
50937
  }
50839
50938
  return [...roots];
50840
50939
  }
50841
- function underTempRoot(path108) {
50940
+ function underTempRoot(path109) {
50842
50941
  return tempRoots().some(
50843
- (root2) => path108.startsWith(root2.endsWith(sep5) ? root2 : root2 + sep5)
50942
+ (root2) => path109.startsWith(root2.endsWith(sep5) ? root2 : root2 + sep5)
50844
50943
  );
50845
50944
  }
50846
50945
 
@@ -51437,15 +51536,15 @@ function accountedTrees(sessions) {
51437
51536
  import { existsSync as existsSync97 } from "fs";
51438
51537
  async function reclaimVanishedWorktrees(clone, paths) {
51439
51538
  if (!existsSync97(clone)) {
51440
- for (const { path: path108 } of paths) forgetWorktree(path108);
51539
+ for (const { path: path109 } of paths) forgetWorktree(path109);
51441
51540
  daemonLog(
51442
51541
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
51443
51542
  );
51444
51543
  return;
51445
51544
  }
51446
51545
  await pruneBookkeeping2(clone);
51447
- for (const { path: path108, branch: branch2 } of paths)
51448
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path108);
51546
+ for (const { path: path109, branch: branch2 } of paths)
51547
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path109);
51449
51548
  }
51450
51549
  async function pruneBookkeeping2(clone) {
51451
51550
  try {
@@ -51472,37 +51571,37 @@ async function reclaimBranch(clone, branch2) {
51472
51571
  }
51473
51572
 
51474
51573
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
51475
- function logVanishedTree(sessions, path108) {
51574
+ function logVanishedTree(sessions, path109) {
51476
51575
  const claimants = [...sessions.values()].filter(
51477
- (s) => s.cwd === path108 || s.worktree?.path === path108
51576
+ (s) => s.cwd === path109 || s.worktree?.path === path109
51478
51577
  );
51479
51578
  if (claimants.length === 0) {
51480
- daemonLog(`worktree ${path108} gone from disk and unclaimed; reclaiming it`);
51579
+ daemonLog(`worktree ${path109} gone from disk and unclaimed; reclaiming it`);
51481
51580
  return;
51482
51581
  }
51483
51582
  for (const s of claimants)
51484
51583
  daemonLog(
51485
- `session ${s.id} ("${s.name}") claims worktree ${path108}, which is gone from disk; reclaiming it`
51584
+ `session ${s.id} ("${s.name}") claims worktree ${path109}, which is gone from disk; reclaiming it`
51486
51585
  );
51487
51586
  }
51488
51587
 
51489
51588
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
51490
51589
  var MAX_ITEMS = 20;
51491
- async function describeHeldWork(path108, reason4) {
51492
- if (reason4.startsWith("uncommitted")) return await changedFiles(path108);
51493
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path108, reason4);
51590
+ async function describeHeldWork(path109, reason4) {
51591
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path109);
51592
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path109, reason4);
51494
51593
  return { summary: reason4, items: [] };
51495
51594
  }
51496
- async function changedFiles(path108) {
51497
- const status2 = await gitResult(path108, ["status", "--porcelain"]);
51595
+ async function changedFiles(path109) {
51596
+ const status2 = await gitResult(path109, ["status", "--porcelain"]);
51498
51597
  const lines2 = status2.ok ? nonEmptyLines(status2.out) : [];
51499
51598
  return {
51500
51599
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
51501
51600
  items: capped2(lines2)
51502
51601
  };
51503
51602
  }
51504
- async function unpushedCommits(path108, reason4) {
51505
- const log2 = await gitResult(path108, ["log", "--oneline", "@{upstream}..HEAD"]);
51603
+ async function unpushedCommits(path109, reason4) {
51604
+ const log2 = await gitResult(path109, ["log", "--oneline", "@{upstream}..HEAD"]);
51506
51605
  if (!log2.ok) return { summary: reason4, items: [] };
51507
51606
  const lines2 = nonEmptyLines(log2.out);
51508
51607
  return {
@@ -51594,24 +51693,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
51594
51693
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
51595
51694
  const accounted = accountedTrees(sessions);
51596
51695
  const vanished = /* @__PURE__ */ new Map();
51597
- for (const { path: path108, clone } of readWorktreeRegistry()) {
51598
- if (underTempRoot(path108)) {
51599
- forgetWorktree(path108);
51696
+ for (const { path: path109, clone } of readWorktreeRegistry()) {
51697
+ if (underTempRoot(path109)) {
51698
+ forgetWorktree(path109);
51600
51699
  daemonLog(
51601
- `worktree ${path108} lies outside any project root; pruned from the registry rather than recovered`
51700
+ `worktree ${path109} lies outside any project root; pruned from the registry rather than recovered`
51602
51701
  );
51603
51702
  continue;
51604
51703
  }
51605
- if (!existsSync98(path108)) {
51606
- logVanishedTree(sessions, path108);
51704
+ if (!existsSync98(path109)) {
51705
+ logVanishedTree(sessions, path109);
51607
51706
  vanished.set(clone, [
51608
51707
  ...vanished.get(clone) ?? [],
51609
- { path: path108, branch: basename34(path108) }
51708
+ { path: path109, branch: basename34(path109) }
51610
51709
  ]);
51611
51710
  continue;
51612
51711
  }
51613
- if (accounted.has(path108)) continue;
51614
- await recoverOrphan(sessions, spawnWith, { path: path108, clone }, notify2);
51712
+ if (accounted.has(path109)) continue;
51713
+ await recoverOrphan(sessions, spawnWith, { path: path109, clone }, notify2);
51615
51714
  }
51616
51715
  for (const [clone, paths] of vanished)
51617
51716
  await reclaimVanishedWorktrees(clone, paths);
@@ -51629,13 +51728,13 @@ function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
51629
51728
  // src/commands/sessions/daemon/worktree/reseedRestoredWorktrees.ts
51630
51729
  function reseedRestoredWorktrees(deps2) {
51631
51730
  const { sessions, clients, onStatusChange, notify: notify2 } = deps2;
51632
- for (const [path108, { session, clone }] of heldTrees(sessions)) {
51731
+ for (const [path109, { session, clone }] of heldTrees(sessions)) {
51633
51732
  daemonLog(
51634
- `session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path108} before starting it`
51733
+ `session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path109} before starting it`
51635
51734
  );
51636
51735
  seedHeldSession(
51637
51736
  session,
51638
- path108,
51737
+ path109,
51639
51738
  clone,
51640
51739
  notify2,
51641
51740
  (seeded) => startHeldInTree(seeded, sessions, clients, onStatusChange, notify2)
@@ -52936,13 +53035,13 @@ import {
52936
53035
  } from "fs";
52937
53036
  var MB = 1024 * 1024;
52938
53037
  function trimDaemonLog({
52939
- path: path108 = daemonPaths.log,
53038
+ path: path109 = daemonPaths.log,
52940
53039
  maxBytes = 50 * MB,
52941
53040
  keepBytes = 25 * MB
52942
53041
  } = {}) {
52943
53042
  let fd;
52944
53043
  try {
52945
- fd = openSync8(path108, "r+");
53044
+ fd = openSync8(path109, "r+");
52946
53045
  } catch {
52947
53046
  return void 0;
52948
53047
  }
@@ -53085,7 +53184,7 @@ var handleHelloRequest = (client, m, d) => {
53085
53184
  };
53086
53185
 
53087
53186
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
53088
- import * as fs54 from "fs";
53187
+ import * as fs55 from "fs";
53089
53188
  import * as readline5 from "readline";
53090
53189
 
53091
53190
  // src/commands/sessions/daemon/historySearch/historySnippet.ts
@@ -53206,7 +53305,7 @@ function queryPattern(query) {
53206
53305
  async function findTranscriptMatch(filePath, harness, query) {
53207
53306
  const pattern2 = queryPattern(query);
53208
53307
  const mayMatch = rawLinePrefilter(query);
53209
- const stream = fs54.createReadStream(filePath, { encoding: "utf8" });
53308
+ const stream = fs55.createReadStream(filePath, { encoding: "utf8" });
53210
53309
  const reader = readline5.createInterface({
53211
53310
  input: stream,
53212
53311
  crlfDelay: Infinity
@@ -53303,7 +53402,7 @@ function creator(isNew, spawn12) {
53303
53402
  }
53304
53403
 
53305
53404
  // src/commands/sessions/shared/codex/codexRolloutUsage.ts
53306
- import * as fs55 from "fs";
53405
+ import * as fs56 from "fs";
53307
53406
 
53308
53407
  // src/commands/sessions/shared/codex/applyTokenInfo.ts
53309
53408
  function applyTokenInfo(usage, byId, conversationId, rawInfo) {
@@ -53366,7 +53465,7 @@ function codexRolloutUsage(lines2) {
53366
53465
  return usage;
53367
53466
  }
53368
53467
  async function readCodexRolloutUsage(rolloutPath) {
53369
- const content = await fs55.promises.readFile(rolloutPath, "utf8");
53468
+ const content = await fs56.promises.readFile(rolloutPath, "utf8");
53370
53469
  return codexRolloutUsage(content.split("\n"));
53371
53470
  }
53372
53471
  function sessionMetaId(entry) {
@@ -53541,15 +53640,15 @@ var inboxHandlers = {
53541
53640
  };
53542
53641
 
53543
53642
  // src/commands/sessions/shared/parseTranscript.ts
53544
- import * as fs56 from "fs";
53643
+ import * as fs57 from "fs";
53545
53644
 
53546
53645
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
53547
- import * as path107 from "path";
53646
+ import * as path108 from "path";
53548
53647
  async function findCodexRolloutPath(sessionId) {
53549
53648
  if (!sessionId) return null;
53550
53649
  const paths = await discoverCodexRolloutPaths();
53551
53650
  const suffix = `-${sessionId}.jsonl`;
53552
- return paths.find((file) => path107.basename(file).endsWith(suffix)) ?? null;
53651
+ return paths.find((file) => path108.basename(file).endsWith(suffix)) ?? null;
53553
53652
  }
53554
53653
 
53555
53654
  // src/commands/sessions/shared/parseTranscript.ts
@@ -53562,7 +53661,7 @@ async function parseTranscript(sessionId) {
53562
53661
  }
53563
53662
  async function readMessages(filePath, parse5) {
53564
53663
  try {
53565
- const raw = await fs56.promises.readFile(filePath, "utf8");
53664
+ const raw = await fs57.promises.readFile(filePath, "utf8");
53566
53665
  return parse5(raw.split("\n"));
53567
53666
  } catch {
53568
53667
  return [];
@@ -54417,8 +54516,8 @@ async function awaitLinkReturn(name, options2, deps2 = {}) {
54417
54516
  }
54418
54517
 
54419
54518
  // src/commands/sessions/nodes/postToPeer.ts
54420
- async function postToPeer(baseUrl, path108, traceId, timeoutMs) {
54421
- const res = await fetch(new URL(path108, baseUrl), {
54519
+ async function postToPeer(baseUrl, path109, traceId, timeoutMs) {
54520
+ const res = await fetch(new URL(path109, baseUrl), {
54422
54521
  method: "POST",
54423
54522
  headers: {
54424
54523
  "x-assist-linked-from": resolveNodeName(),
@@ -54428,7 +54527,7 @@ async function postToPeer(baseUrl, path108, traceId, timeoutMs) {
54428
54527
  });
54429
54528
  if (res.ok) return;
54430
54529
  const body = await res.json().catch(() => ({}));
54431
- throw new Error(body.error ?? `POST ${path108} returned ${res.status}`);
54530
+ throw new Error(body.error ?? `POST ${path109} returned ${res.status}`);
54432
54531
  }
54433
54532
 
54434
54533
  // src/commands/sessions/nodes/startPeerAction.ts