@staff0rd/assist 0.595.0 → 0.596.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.595.0",
9
+ version: "0.596.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -187,8 +187,8 @@ function getRemoteOriginUrl(cwd) {
187
187
  }
188
188
 
189
189
  // src/commands/backlog/getCurrentOrigin.ts
190
- function stripLeadingSlashes(path83) {
191
- return path83.replace(/^\/+/, "");
190
+ function stripLeadingSlashes(path84) {
191
+ return path84.replace(/^\/+/, "");
192
192
  }
193
193
  function normalizeOrigin(raw) {
194
194
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -238,9 +238,9 @@ function findGitLink(dir) {
238
238
  }
239
239
  return null;
240
240
  }
241
- function isFile(path83) {
241
+ function isFile(path84) {
242
242
  try {
243
- return statSync(path83).isFile();
243
+ return statSync(path84).isFile();
244
244
  } catch {
245
245
  return false;
246
246
  }
@@ -259,9 +259,9 @@ function linkedGitDirParent(gitDir) {
259
259
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
260
260
  return match ? match[1] : null;
261
261
  }
262
- function readTrimmed(path83) {
262
+ function readTrimmed(path84) {
263
263
  try {
264
- const content = readFileSync(path83, "utf8").trim();
264
+ const content = readFileSync(path84, "utf8").trim();
265
265
  return content === "" ? null : content;
266
266
  } catch {
267
267
  return null;
@@ -274,10 +274,10 @@ function absolute(target, from) {
274
274
  // src/shared/loadRawYaml.ts
275
275
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
276
276
  import { parse as parseYaml } from "yaml";
277
- function loadRawYaml(path83) {
278
- if (!existsSync2(path83)) return {};
277
+ function loadRawYaml(path84) {
278
+ if (!existsSync2(path84)) return {};
279
279
  try {
280
- const content = readFileSync2(path83, "utf8");
280
+ const content = readFileSync2(path84, "utf8");
281
281
  return parseYaml(content) || {};
282
282
  } catch {
283
283
  return {};
@@ -349,8 +349,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
349
349
  // src/commands/backlog/originDisplayName.ts
350
350
  function originDisplayName(origin) {
351
351
  if (origin.startsWith("local:")) {
352
- const path83 = origin.slice("local:".length).replace(/\/+$/, "");
353
- const segments = path83.split("/").filter(Boolean);
352
+ const path84 = origin.slice("local:".length).replace(/\/+$/, "");
353
+ const segments = path84.split("/").filter(Boolean);
354
354
  return segments[segments.length - 1] ?? origin;
355
355
  }
356
356
  const firstSlash = origin.indexOf("/");
@@ -1785,8 +1785,8 @@ function findUnmergedPaths() {
1785
1785
  }
1786
1786
  const found = /* @__PURE__ */ new Set();
1787
1787
  for (const line of output.split("\n")) {
1788
- const path83 = line.split(" ")[1];
1789
- if (path83) found.add(path83.trim());
1788
+ const path84 = line.split(" ")[1];
1789
+ if (path84) found.add(path84.trim());
1790
1790
  }
1791
1791
  return [...found];
1792
1792
  }
@@ -1896,8 +1896,8 @@ function getPreferredRemoteRepo(cwd) {
1896
1896
  function gitRefUrl(kind, ref, cwd) {
1897
1897
  const repo = getPreferredRemoteRepo(cwd);
1898
1898
  if (!repo) return void 0;
1899
- const path83 = kind === "branch" ? "tree" : "commit";
1900
- return `https://github.com/${repo.org}/${repo.repo}/${path83}/${ref}`;
1899
+ const path84 = kind === "branch" ? "tree" : "commit";
1900
+ return `https://github.com/${repo.org}/${repo.repo}/${path84}/${ref}`;
1901
1901
  }
1902
1902
 
1903
1903
  // src/commands/commit/collectCommitRefs.ts
@@ -4273,11 +4273,11 @@ function enumValues(node) {
4273
4273
  function opaqueConfigNode(inner, base) {
4274
4274
  return { ...base, kind: "other", type: leafTypeOf(inner) };
4275
4275
  }
4276
- function build(node, path83) {
4276
+ function build(node, path84) {
4277
4277
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
4278
4278
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
4279
4279
  const base = {
4280
- path: path83,
4280
+ path: path84,
4281
4281
  ...optional ? { optional: true } : {},
4282
4282
  ...defaultValue === void 0 ? {} : { defaultValue },
4283
4283
  ...secret ? { secret: true } : {}
@@ -4296,9 +4296,9 @@ function segmentText(segment) {
4296
4296
  if (segment.kind === "index") return `[${segment.index}]`;
4297
4297
  return "[]";
4298
4298
  }
4299
- function formatConfigPath(path83) {
4299
+ function formatConfigPath(path84) {
4300
4300
  let text18 = "";
4301
- for (const segment of path83) {
4301
+ for (const segment of path84) {
4302
4302
  const dotted = segment.kind === "key" || segment.kind === "entry";
4303
4303
  const rendered = segmentText(segment);
4304
4304
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -4946,9 +4946,9 @@ import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
4946
4946
 
4947
4947
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
4948
4948
  import { minimatch as minimatch2 } from "minimatch";
4949
- function resolveStringsAtPath(data, path83) {
4949
+ function resolveStringsAtPath(data, path84) {
4950
4950
  let current = data;
4951
- for (const segment of path83.split(".")) {
4951
+ for (const segment of path84.split(".")) {
4952
4952
  if (current === null || typeof current !== "object") return [];
4953
4953
  current = current[segment];
4954
4954
  }
@@ -4961,10 +4961,10 @@ function resolveStringsAtPath(data, path83) {
4961
4961
  }
4962
4962
  function findRuleViolations(data, rule) {
4963
4963
  const violations = [];
4964
- for (const path83 of rule.paths) {
4965
- for (const value of resolveStringsAtPath(data, path83)) {
4964
+ for (const path84 of rule.paths) {
4965
+ for (const value of resolveStringsAtPath(data, path84)) {
4966
4966
  if (minimatch2(value, rule.disallowed))
4967
- violations.push({ file: rule.file, path: path83, value });
4967
+ violations.push({ file: rule.file, path: path84, value });
4968
4968
  }
4969
4969
  }
4970
4970
  return violations;
@@ -5003,8 +5003,8 @@ function forbiddenStrings() {
5003
5003
  process.exit(0);
5004
5004
  }
5005
5005
  console.log("Forbidden strings found:\n");
5006
- for (const { file, path: path83, value } of violations) {
5007
- console.log(` ${file} ${path83}: ${value}`);
5006
+ for (const { file, path: path84, value } of violations) {
5007
+ console.log(` ${file} ${path84}: ${value}`);
5008
5008
  }
5009
5009
  console.log(`
5010
5010
  Total: ${violations.length} forbidden string(s).`);
@@ -5319,15 +5319,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
5319
5319
  } catch {
5320
5320
  return baseline;
5321
5321
  }
5322
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path83) => MIGRATION_FILE3.test(basename2(path83)));
5323
- for (const path83 of paths) {
5322
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path84) => MIGRATION_FILE3.test(basename2(path84)));
5323
+ for (const path84 of paths) {
5324
5324
  try {
5325
- const content = execSync14(`git show "${ref}:${path83}"`, {
5325
+ const content = execSync14(`git show "${ref}:${path84}"`, {
5326
5326
  encoding: "utf8",
5327
5327
  maxBuffer: 16 * 1024 * 1024,
5328
5328
  stdio: ["pipe", "pipe", "pipe"]
5329
5329
  });
5330
- baseline.set(basename2(path83), content);
5330
+ baseline.set(basename2(path84), content);
5331
5331
  } catch {
5332
5332
  }
5333
5333
  }
@@ -6761,10 +6761,10 @@ var hooksSettings = {
6761
6761
  }
6762
6762
  };
6763
6763
  function ensureHooksSettings() {
6764
- const path83 = daemonPaths.hooksSettings;
6765
- mkdirSync5(dirname13(path83), { recursive: true });
6766
- writeFileSync15(path83, JSON.stringify(hooksSettings, null, 2));
6767
- return path83;
6764
+ const path84 = daemonPaths.hooksSettings;
6765
+ mkdirSync5(dirname13(path84), { recursive: true });
6766
+ writeFileSync15(path84, JSON.stringify(hooksSettings, null, 2));
6767
+ return path84;
6768
6768
  }
6769
6769
 
6770
6770
  // src/shared/spawnInherit.ts
@@ -7062,9 +7062,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
7062
7062
  function backupLocalBacklogFiles(dir) {
7063
7063
  const moved = [];
7064
7064
  for (const name of LOCAL_FILES) {
7065
- const path83 = join15(dir, ".assist", name);
7066
- if (existsSync19(path83)) {
7067
- renameSync(path83, `${path83}.bak`);
7065
+ const path84 = join15(dir, ".assist", name);
7066
+ if (existsSync19(path84)) {
7067
+ renameSync(path84, `${path84}.bak`);
7068
7068
  moved.push(`${name} \u2192 ${name}.bak`);
7069
7069
  }
7070
7070
  }
@@ -7544,8 +7544,8 @@ var backlogItemSchema = z4.strictObject({
7544
7544
  var backlogFileSchema = z4.array(backlogItemSchema);
7545
7545
 
7546
7546
  // src/commands/backlog/parseBacklogJsonl.ts
7547
- function parseBacklogJsonl(path83) {
7548
- const content = readFileSync15(path83, "utf8").trim();
7547
+ function parseBacklogJsonl(path84) {
7548
+ const content = readFileSync15(path84, "utf8").trim();
7549
7549
  if (content.length === 0) return [];
7550
7550
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
7551
7551
  }
@@ -8356,24 +8356,24 @@ function getOwnerPath(itemId2) {
8356
8356
  function recordSignalOwner(itemId2) {
8357
8357
  const sessionId = process.env.ASSIST_SESSION_ID;
8358
8358
  if (!sessionId) return;
8359
- const path83 = getOwnerPath(itemId2);
8360
- mkdirSync7(dirname15(path83), { recursive: true });
8361
- writeFileSync17(path83, JSON.stringify({ sessionId }));
8359
+ const path84 = getOwnerPath(itemId2);
8360
+ mkdirSync7(dirname15(path84), { recursive: true });
8361
+ writeFileSync17(path84, JSON.stringify({ sessionId }));
8362
8362
  }
8363
8363
  function readSignalOwner(itemId2) {
8364
- const path83 = getOwnerPath(itemId2);
8365
- if (!existsSync23(path83)) return void 0;
8364
+ const path84 = getOwnerPath(itemId2);
8365
+ if (!existsSync23(path84)) return void 0;
8366
8366
  try {
8367
- const parsed = JSON.parse(readFileSync16(path83, "utf8"));
8367
+ const parsed = JSON.parse(readFileSync16(path84, "utf8"));
8368
8368
  return parsed.sessionId;
8369
8369
  } catch {
8370
8370
  return void 0;
8371
8371
  }
8372
8372
  }
8373
8373
  function clearSignalOwner(itemId2) {
8374
- const path83 = getOwnerPath(itemId2);
8374
+ const path84 = getOwnerPath(itemId2);
8375
8375
  try {
8376
- rmSync(path83);
8376
+ rmSync(path84);
8377
8377
  } catch {
8378
8378
  }
8379
8379
  }
@@ -8410,19 +8410,19 @@ function resolveSignalTarget(event, data) {
8410
8410
  function writeSignal(event, data) {
8411
8411
  const target = resolveSignalTarget(event, data);
8412
8412
  if (!target) return;
8413
- const path83 = getSignalPath(target);
8414
- if (!path83) return;
8413
+ const path84 = getSignalPath(target);
8414
+ if (!path84) return;
8415
8415
  const signal = { event, sessionId: target, ...data };
8416
- mkdirSync8(dirname16(path83), { recursive: true });
8417
- writeFileSync18(path83, JSON.stringify(signal));
8416
+ mkdirSync8(dirname16(path84), { recursive: true });
8417
+ writeFileSync18(path84, JSON.stringify(signal));
8418
8418
  }
8419
8419
 
8420
8420
  // src/commands/backlog/readSignal.ts
8421
8421
  function readSignal() {
8422
- const path83 = getSignalPath();
8423
- if (!path83 || !existsSync24(path83)) return void 0;
8422
+ const path84 = getSignalPath();
8423
+ if (!path84 || !existsSync24(path84)) return void 0;
8424
8424
  try {
8425
- return JSON.parse(readFileSync17(path83, "utf8"));
8425
+ return JSON.parse(readFileSync17(path84, "utf8"));
8426
8426
  } catch {
8427
8427
  return void 0;
8428
8428
  }
@@ -8619,13 +8619,13 @@ function activityPath(sessionId) {
8619
8619
  function emitActivity(activity2) {
8620
8620
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8621
8621
  if (!sessionId) return;
8622
- const path83 = activityPath(sessionId);
8623
- mkdirSync9(dirname17(path83), { recursive: true });
8624
- writeFileSync19(path83, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8622
+ const path84 = activityPath(sessionId);
8623
+ mkdirSync9(dirname17(path84), { recursive: true });
8624
+ writeFileSync19(path84, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8625
8625
  }
8626
- function readActivity(path83) {
8626
+ function readActivity(path84) {
8627
8627
  try {
8628
- return JSON.parse(readFileSync18(path83, "utf8"));
8628
+ return JSON.parse(readFileSync18(path84, "utf8"));
8629
8629
  } catch {
8630
8630
  return void 0;
8631
8631
  }
@@ -8635,9 +8635,9 @@ function reconcileActivity(sessionId, activity2) {
8635
8635
  removeActivity(sessionId);
8636
8636
  return;
8637
8637
  }
8638
- const path83 = activityPath(sessionId);
8639
- mkdirSync9(dirname17(path83), { recursive: true });
8640
- writeFileSync19(path83, JSON.stringify(activity2));
8638
+ const path84 = activityPath(sessionId);
8639
+ mkdirSync9(dirname17(path84), { recursive: true });
8640
+ writeFileSync19(path84, JSON.stringify(activity2));
8641
8641
  }
8642
8642
  function removeActivity(sessionId) {
8643
8643
  try {
@@ -10090,10 +10090,10 @@ function getStorePath(filename) {
10090
10090
  return join26(getStoreDir(), filename);
10091
10091
  }
10092
10092
  function loadJson(filename) {
10093
- const path83 = getStorePath(filename);
10094
- if (existsSync29(path83)) {
10093
+ const path84 = getStorePath(filename);
10094
+ if (existsSync29(path84)) {
10095
10095
  try {
10096
- return JSON.parse(readFileSync19(path83, "utf8"));
10096
+ return JSON.parse(readFileSync19(path84, "utf8"));
10097
10097
  } catch {
10098
10098
  return {};
10099
10099
  }
@@ -10112,22 +10112,22 @@ function saveJson(filename, data) {
10112
10112
  var REGISTRY_FILE = "worktrees.json";
10113
10113
  function readWorktreeRegistry() {
10114
10114
  const data = loadJson(REGISTRY_FILE);
10115
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path83, record]) => ({ path: path83, ...record }));
10115
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path84, record]) => ({ path: path84, ...record }));
10116
10116
  }
10117
- function worktreeAttributionIncludingReaped(path83) {
10118
- const record = loadJson(REGISTRY_FILE)[path83];
10117
+ function worktreeAttributionIncludingReaped(path84) {
10118
+ const record = loadJson(REGISTRY_FILE)[path84];
10119
10119
  return record ? { clone: record.clone, origin: record.origin } : void 0;
10120
10120
  }
10121
- function recordWorktree(path83, clone, origin) {
10121
+ function recordWorktree(path84, clone, origin) {
10122
10122
  const data = loadJson(REGISTRY_FILE);
10123
- data[path83] = { clone, origin };
10123
+ data[path84] = { clone, origin };
10124
10124
  saveJson(REGISTRY_FILE, data);
10125
10125
  }
10126
- function forgetWorktree(path83) {
10126
+ function forgetWorktree(path84) {
10127
10127
  const data = loadJson(REGISTRY_FILE);
10128
- const record = data[path83];
10128
+ const record = data[path84];
10129
10129
  if (!record || record.reaped) return;
10130
- data[path83] = { ...record, reaped: true };
10130
+ data[path84] = { ...record, reaped: true };
10131
10131
  saveJson(REGISTRY_FILE, data);
10132
10132
  }
10133
10133
 
@@ -10878,8 +10878,8 @@ async function loadCommittedPaths(cwd, sessionId) {
10878
10878
  for (const commit2 of commits2) {
10879
10879
  const resolved = await resolveCommit(cwd, commit2.sha);
10880
10880
  if (!resolved) continue;
10881
- for (const path83 of resolved.paths) {
10882
- if (!bases.has(path83)) bases.set(path83, resolved.base);
10881
+ for (const path84 of resolved.paths) {
10882
+ if (!bases.has(path84)) bases.set(path84, resolved.base);
10883
10883
  }
10884
10884
  }
10885
10885
  return { commits: commits2, bases };
@@ -10897,16 +10897,16 @@ async function itemChangeSet(cwd, sessionId) {
10897
10897
  }
10898
10898
  function groupByBase(bases) {
10899
10899
  const groups = /* @__PURE__ */ new Map();
10900
- for (const [path83, base] of bases) {
10900
+ for (const [path84, base] of bases) {
10901
10901
  const paths = groups.get(base);
10902
- if (paths) paths.push(path83);
10903
- else groups.set(base, [path83]);
10902
+ if (paths) paths.push(path84);
10903
+ else groups.set(base, [path84]);
10904
10904
  }
10905
10905
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
10906
10906
  }
10907
10907
  async function dirtyPaths(cwd, bases) {
10908
10908
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
10909
- return output.split("\n").filter((path83) => path83 && !bases.has(path83)).sort();
10909
+ return output.split("\n").filter((path84) => path84 && !bases.has(path84)).sort();
10910
10910
  }
10911
10911
 
10912
10912
  // src/commands/sessions/web/scopedDiff.ts
@@ -10915,8 +10915,8 @@ async function scopedDiff(cwd, session, scope) {
10915
10915
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
10916
10916
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
10917
10917
  }
10918
- async function untrackedFileDiff(cwd, path83) {
10919
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path83], {
10918
+ async function untrackedFileDiff(cwd, path84) {
10919
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path84], {
10920
10920
  maxBuffer: MAX_DIFF_BYTES,
10921
10921
  allowFailure: true
10922
10922
  });
@@ -10929,7 +10929,7 @@ async function untrackedDiff(cwd) {
10929
10929
  ]);
10930
10930
  const paths = list5.split("\n").filter(Boolean);
10931
10931
  const diffs = await Promise.all(
10932
- paths.map((path83) => untrackedFileDiff(cwd, path83))
10932
+ paths.map((path84) => untrackedFileDiff(cwd, path84))
10933
10933
  );
10934
10934
  return diffs.join("");
10935
10935
  }
@@ -11022,9 +11022,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
11022
11022
  function repoRoot(cwd) {
11023
11023
  return resolve10(toGitCwd(cwd));
11024
11024
  }
11025
- function resolveWithinCwd(cwd, path83) {
11025
+ function resolveWithinCwd(cwd, path84) {
11026
11026
  const root = repoRoot(cwd);
11027
- const target = resolve10(root, path83);
11027
+ const target = resolve10(root, path84);
11028
11028
  const rel = relative2(root, target);
11029
11029
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
11030
11030
  return target;
@@ -11034,14 +11034,14 @@ function resolveWithinCwd(cwd, path83) {
11034
11034
  function getFileTarget(req, res) {
11035
11035
  const cwd = getCwdParam(req, res);
11036
11036
  if (!cwd) return null;
11037
- const path83 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11037
+ const path84 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11038
11038
  "path"
11039
11039
  );
11040
- if (!path83) {
11040
+ if (!path84) {
11041
11041
  respondJson(res, 400, { error: "Missing path" });
11042
11042
  return null;
11043
11043
  }
11044
- const target = resolveWithinCwd(cwd, path83);
11044
+ const target = resolveWithinCwd(cwd, path84);
11045
11045
  if (!target) {
11046
11046
  respondJson(res, 400, { error: "Path outside cwd" });
11047
11047
  return null;
@@ -11116,11 +11116,11 @@ function globalConfigTargetFor(cwd) {
11116
11116
 
11117
11117
  // src/commands/config/globalConfigFileLabel.ts
11118
11118
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
11119
- function globalConfigFileLabel(path83) {
11120
- if (path83 === getGlobalConfigPath()) return "~/.assist.yml";
11121
- if (path83.startsWith(WINDOWS_MOUNT_PREFIX))
11122
- return `${path83} on the Windows host`;
11123
- return path83;
11119
+ function globalConfigFileLabel(path84) {
11120
+ if (path84 === getGlobalConfigPath()) return "~/.assist.yml";
11121
+ if (path84.startsWith(WINDOWS_MOUNT_PREFIX))
11122
+ return `${path84} on the Windows host`;
11123
+ return path84;
11124
11124
  }
11125
11125
 
11126
11126
  // src/commands/config/readRawConfigLayers.ts
@@ -11177,35 +11177,35 @@ function isPlainRecord(value) {
11177
11177
  }
11178
11178
 
11179
11179
  // src/shared/mapConfigSecrets.ts
11180
- function mapChildren(value, path83, childNode, map) {
11180
+ function mapChildren(value, path84, childNode, map) {
11181
11181
  if (!isPlainRecord(value)) return value;
11182
11182
  return Object.fromEntries(
11183
11183
  Object.entries(value).map(([name, child]) => [
11184
11184
  name,
11185
- walk(child, [...path83, name], childNode(name), map)
11185
+ walk(child, [...path84, name], childNode(name), map)
11186
11186
  ])
11187
11187
  );
11188
11188
  }
11189
- function mapItems(value, path83, item, map) {
11189
+ function mapItems(value, path84, item, map) {
11190
11190
  if (!Array.isArray(value)) return value;
11191
- return value.map((entry, index3) => walk(entry, [...path83, index3], item, map));
11191
+ return value.map((entry, index3) => walk(entry, [...path84, index3], item, map));
11192
11192
  }
11193
- function walk(value, path83, node, map) {
11193
+ function walk(value, path84, node, map) {
11194
11194
  if (!node || value === void 0 || value === null) return value;
11195
- if (node.secret) return map(value, path83);
11195
+ if (node.secret) return map(value, path84);
11196
11196
  switch (node.kind) {
11197
11197
  case "object":
11198
11198
  case "unionOfObjects":
11199
11199
  return mapChildren(
11200
11200
  value,
11201
- path83,
11201
+ path84,
11202
11202
  (name) => configNodeField(node, name),
11203
11203
  map
11204
11204
  );
11205
11205
  case "objectList":
11206
- return mapItems(value, path83, node.item, map);
11206
+ return mapItems(value, path84, node.item, map);
11207
11207
  case "record":
11208
- return mapChildren(value, path83, () => node.value, map);
11208
+ return mapChildren(value, path84, () => node.value, map);
11209
11209
  default:
11210
11210
  return value;
11211
11211
  }
@@ -11230,9 +11230,9 @@ function isTraversable(value) {
11230
11230
  function stepInto(current, key) {
11231
11231
  return isTraversable(current) ? current[key] : void 0;
11232
11232
  }
11233
- function getNestedValue(obj, path83) {
11233
+ function getNestedValue(obj, path84) {
11234
11234
  let current = obj;
11235
- for (const key of path83.split(".")) current = stepInto(current, key);
11235
+ for (const key of path84.split(".")) current = stepInto(current, key);
11236
11236
  return current;
11237
11237
  }
11238
11238
 
@@ -11282,9 +11282,9 @@ function step(node, segment) {
11282
11282
  return void 0;
11283
11283
  }
11284
11284
  }
11285
- function findConfigNode(root, path83) {
11285
+ function findConfigNode(root, path84) {
11286
11286
  let current = root;
11287
- for (const segment of path83) {
11287
+ for (const segment of path84) {
11288
11288
  if (!current) return void 0;
11289
11289
  current = step(current, segment);
11290
11290
  }
@@ -11301,34 +11301,34 @@ function nameSegment(name) {
11301
11301
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
11302
11302
  }
11303
11303
  function parseConfigPath(text18) {
11304
- const path83 = [];
11304
+ const path84 = [];
11305
11305
  let at2 = 0;
11306
11306
  while (at2 < text18.length) {
11307
11307
  if (text18[at2] === "[") {
11308
11308
  const close = text18.indexOf("]", at2);
11309
11309
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
11310
11310
  if (!segment) return void 0;
11311
- path83.push(segment);
11311
+ path84.push(segment);
11312
11312
  at2 = close + 1;
11313
11313
  continue;
11314
11314
  }
11315
11315
  if (text18[at2] === ".") {
11316
- if (path83.length === 0) return void 0;
11316
+ if (path84.length === 0) return void 0;
11317
11317
  at2 += 1;
11318
11318
  }
11319
11319
  const start3 = at2;
11320
11320
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
11321
11321
  const name = text18.slice(start3, at2);
11322
11322
  if (!name) return void 0;
11323
- path83.push(nameSegment(name));
11323
+ path84.push(nameSegment(name));
11324
11324
  }
11325
- return path83;
11325
+ return path84;
11326
11326
  }
11327
11327
 
11328
11328
  // src/commands/config/configEntryNode.ts
11329
11329
  function configEntryNode(root, key) {
11330
- const path83 = parseConfigPath(key);
11331
- return path83 ? findConfigNode(root, path83) : void 0;
11330
+ const path84 = parseConfigPath(key);
11331
+ return path84 ? findConfigNode(root, path84) : void 0;
11332
11332
  }
11333
11333
 
11334
11334
  // src/commands/config/configHelpForKey.ts
@@ -11463,7 +11463,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
11463
11463
  const parent = dirname21(branchKeyPath);
11464
11464
  const branchPrefix = basename8(branchKeyPath);
11465
11465
  if (!existsSync32(parent)) return null;
11466
- const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path83) => existsSync32(path83)).map((path83) => ({ path: path83, mtime: statSync4(path83).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11466
+ const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join29(parent, name, "synthesis.md")).filter((path84) => existsSync32(path84)).map((path84) => ({ path: path84, mtime: statSync4(path84).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11467
11467
  return synthesisFiles[0]?.path ?? null;
11468
11468
  }
11469
11469
 
@@ -11493,12 +11493,12 @@ async function getReviewSynthesis(req, res) {
11493
11493
  const cwd = getCwdParam(req, res);
11494
11494
  if (!cwd) return;
11495
11495
  try {
11496
- const path83 = await resolveSynthesisPath(cwd);
11497
- if (!path83) {
11496
+ const path84 = await resolveSynthesisPath(cwd);
11497
+ if (!path84) {
11498
11498
  respondJson(res, 404, { error: "No synthesis found" });
11499
11499
  return;
11500
11500
  }
11501
- respondJson(res, 200, { synthesis: readFileSync21(path83, "utf8") });
11501
+ respondJson(res, 200, { synthesis: readFileSync21(path84, "utf8") });
11502
11502
  } catch {
11503
11503
  respondJson(res, 404, { error: "No synthesis found" });
11504
11504
  }
@@ -11581,8 +11581,8 @@ function parseDiffNameStatus(output) {
11581
11581
  if (!status3 || fields.length < 2) continue;
11582
11582
  const category = categorize(status3[0]);
11583
11583
  if (!category) continue;
11584
- const path83 = fields[fields.length - 1];
11585
- if (path83) result[category].push(path83);
11584
+ const path84 = fields[fields.length - 1];
11585
+ if (path84) result[category].push(path84);
11586
11586
  }
11587
11587
  return result;
11588
11588
  }
@@ -11718,21 +11718,21 @@ function subsequenceScore(text18, query) {
11718
11718
  }
11719
11719
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
11720
11720
  }
11721
- function scoreFilePath(path83, query) {
11721
+ function scoreFilePath(path84, query) {
11722
11722
  const needle = query.trim().toLowerCase();
11723
11723
  if (!needle) return 0;
11724
- const basename26 = path83.slice(path83.lastIndexOf("/") + 1);
11724
+ const basename26 = path84.slice(path84.lastIndexOf("/") + 1);
11725
11725
  const inBasename = subsequenceScore(basename26, needle);
11726
11726
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
11727
- return subsequenceScore(path83, needle);
11727
+ return subsequenceScore(path84, needle);
11728
11728
  }
11729
11729
 
11730
11730
  // src/commands/sessions/web/rankFilePaths.ts
11731
11731
  function rankFilePaths(paths, query, limit) {
11732
11732
  const scored = [];
11733
- for (const path83 of paths) {
11734
- const score = scoreFilePath(path83, query);
11735
- if (score !== null) scored.push({ path: path83, score });
11733
+ for (const path84 of paths) {
11734
+ const score = scoreFilePath(path84, query);
11735
+ if (score !== null) scored.push({ path: path84, score });
11736
11736
  }
11737
11737
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
11738
11738
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -11890,6 +11890,91 @@ async function listNewsItems(_req, res) {
11890
11890
  respondJson(res, 200, cachedItems);
11891
11891
  }
11892
11892
 
11893
+ // src/commands/sessions/web/listScopedRules.ts
11894
+ import path32 from "path";
11895
+
11896
+ // src/commands/rules/readScopedRules.ts
11897
+ import { existsSync as existsSync34, readFileSync as readFileSync22 } from "fs";
11898
+ import path31 from "path";
11899
+
11900
+ // src/commands/rules/parseRulesSection.ts
11901
+ var RULES_HEADING = /^##\s+rules\s*$/i;
11902
+ var SECTION_END = /^#{1,2}\s/;
11903
+ var RULE_BULLET = /^\s*[-*]\s+\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
11904
+ function parseRulesSection(content) {
11905
+ const lines2 = content.split(/\r?\n/);
11906
+ const start3 = lines2.findIndex((line) => RULES_HEADING.test(line));
11907
+ if (start3 === -1) return [];
11908
+ const rules3 = [];
11909
+ for (const line of lines2.slice(start3 + 1)) {
11910
+ if (SECTION_END.test(line)) break;
11911
+ const match = RULE_BULLET.exec(line);
11912
+ if (!match) continue;
11913
+ const code = match[1].trim();
11914
+ const text18 = match[2].trim();
11915
+ if (code === "" || text18 === "") continue;
11916
+ rules3.push({ code, text: text18 });
11917
+ }
11918
+ return rules3;
11919
+ }
11920
+
11921
+ // src/commands/rules/scopeDirectory.ts
11922
+ import { existsSync as existsSync33, statSync as statSync5 } from "fs";
11923
+ import path30 from "path";
11924
+ function scopeDirectory(target) {
11925
+ const resolved = path30.resolve(target);
11926
+ return existsSync33(resolved) && statSync5(resolved).isDirectory() ? resolved : path30.dirname(resolved);
11927
+ }
11928
+
11929
+ // src/commands/rules/readScopedRules.ts
11930
+ function scopedClaudeFiles(target) {
11931
+ const startDir = scopeDirectory(target);
11932
+ const root = findRepoRoot(startDir) ?? startDir;
11933
+ const files = [];
11934
+ let current = startDir;
11935
+ while (true) {
11936
+ const candidate = path31.join(current, "CLAUDE.md");
11937
+ if (existsSync34(candidate)) files.push(candidate);
11938
+ if (current === root || current === path31.dirname(current)) break;
11939
+ current = path31.dirname(current);
11940
+ }
11941
+ return files;
11942
+ }
11943
+ function readScopedRules(target) {
11944
+ return scopedClaudeFiles(target).flatMap(
11945
+ (source) => parseRulesSection(readFileSync22(source, "utf8")).map((rule) => ({
11946
+ ...rule,
11947
+ source
11948
+ }))
11949
+ );
11950
+ }
11951
+
11952
+ // src/commands/sessions/web/listScopedRules.ts
11953
+ function listScopedRules(req, res) {
11954
+ const cwd = getCwdParam(req, res);
11955
+ if (!cwd) return;
11956
+ const requested = new URL(
11957
+ req.url ?? "/",
11958
+ "http://localhost"
11959
+ ).searchParams.get("path");
11960
+ const root = repoRoot(cwd);
11961
+ const target = requested ? resolveWithinCwd(cwd, requested) : root;
11962
+ if (!target) {
11963
+ respondJson(res, 400, { error: "Path outside cwd" });
11964
+ return;
11965
+ }
11966
+ try {
11967
+ respondJson(res, 200, {
11968
+ rules: readScopedRules(target).map((rule) => ({
11969
+ ...rule,
11970
+ source: path32.relative(root, rule.source) || rule.source
11971
+ }))
11972
+ });
11973
+ } catch {
11974
+ respondJson(res, 500, { error: "Failed to read rules" });
11975
+ }
11976
+ }
11977
+
11893
11978
  // src/shared/db/countUsagePeaks.ts
11894
11979
  import { count, eq as eq18 } from "drizzle-orm";
11895
11980
  async function countUsagePeaks(db, window) {
@@ -12197,38 +12282,38 @@ async function restartWeb(req, res, deps2 = {}) {
12197
12282
  import { relative as relative3 } from "path";
12198
12283
 
12199
12284
  // src/commands/sessions/web/revertPathChanges.ts
12200
- async function isTracked(cwd, path83) {
12285
+ async function isTracked(cwd, path84) {
12201
12286
  try {
12202
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path83]);
12287
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path84]);
12203
12288
  return true;
12204
12289
  } catch {
12205
12290
  return false;
12206
12291
  }
12207
12292
  }
12208
- async function isInHead(cwd, path83) {
12209
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path83]);
12293
+ async function isInHead(cwd, path84) {
12294
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path84]);
12210
12295
  return listing.trim().length > 0;
12211
12296
  }
12212
- async function revertPathChanges(cwd, path83) {
12213
- if (!await isTracked(cwd, path83)) {
12214
- await execGit(cwd, ["clean", "-f", "--", path83]);
12297
+ async function revertPathChanges(cwd, path84) {
12298
+ if (!await isTracked(cwd, path84)) {
12299
+ await execGit(cwd, ["clean", "-f", "--", path84]);
12215
12300
  return;
12216
12301
  }
12217
- if (await isInHead(cwd, path83)) {
12218
- await execGit(cwd, ["checkout", "HEAD", "--", path83]);
12302
+ if (await isInHead(cwd, path84)) {
12303
+ await execGit(cwd, ["checkout", "HEAD", "--", path84]);
12219
12304
  return;
12220
12305
  }
12221
- await execGit(cwd, ["rm", "-f", "--", path83]);
12306
+ await execGit(cwd, ["rm", "-f", "--", path84]);
12222
12307
  }
12223
12308
 
12224
12309
  // src/commands/sessions/web/revertDiffFile.ts
12225
12310
  async function revertDiffFile(req, res) {
12226
12311
  const resolved = getFileTarget(req, res);
12227
12312
  if (!resolved) return;
12228
- const path83 = relative3(repoRoot(resolved.cwd), resolved.target);
12313
+ const path84 = relative3(repoRoot(resolved.cwd), resolved.target);
12229
12314
  try {
12230
- await revertPathChanges(resolved.cwd, path83);
12231
- respondJson(res, 200, { reverted: path83 });
12315
+ await revertPathChanges(resolved.cwd, path84);
12316
+ respondJson(res, 200, { reverted: path84 });
12232
12317
  } catch (error) {
12233
12318
  respondJson(res, 500, {
12234
12319
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -12250,7 +12335,7 @@ async function readJsonBody(req) {
12250
12335
  function requestedPaths(body) {
12251
12336
  const paths = body.paths;
12252
12337
  if (!Array.isArray(paths)) return null;
12253
- if (paths.some((path83) => typeof path83 !== "string")) return null;
12338
+ if (paths.some((path84) => typeof path84 !== "string")) return null;
12254
12339
  return paths;
12255
12340
  }
12256
12341
  async function revertDiffPaths(req, res) {
@@ -12270,10 +12355,10 @@ async function revertDiffPaths(req, res) {
12270
12355
  const root = repoRoot(cwd);
12271
12356
  const reverted = [];
12272
12357
  const failed2 = [];
12273
- for (const path83 of paths) {
12274
- const target = resolveWithinCwd(cwd, path83);
12358
+ for (const path84 of paths) {
12359
+ const target = resolveWithinCwd(cwd, path84);
12275
12360
  if (!target) {
12276
- failed2.push({ path: path83, error: "Path outside cwd" });
12361
+ failed2.push({ path: path84, error: "Path outside cwd" });
12277
12362
  continue;
12278
12363
  }
12279
12364
  const relativePath = relative4(root, target);
@@ -12363,11 +12448,11 @@ function coerceStructuredConfigValue(key, raw) {
12363
12448
  };
12364
12449
  }
12365
12450
  function formatIssue(key, issue) {
12366
- const path83 = formatConfigPath([
12451
+ const path84 = formatConfigPath([
12367
12452
  { kind: "key", name: key },
12368
12453
  ...issue.path.map(toSegment)
12369
12454
  ]);
12370
- return `${path83}: ${issue.message}`;
12455
+ return `${path84}: ${issue.message}`;
12371
12456
  }
12372
12457
  function toSegment(part) {
12373
12458
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -12462,9 +12547,9 @@ function coerceUnion(key, raw, types) {
12462
12547
  }
12463
12548
 
12464
12549
  // src/shared/valueAtConfigPath.ts
12465
- function valueAtConfigPath(value, path83) {
12550
+ function valueAtConfigPath(value, path84) {
12466
12551
  let current = value;
12467
- for (const key of path83) {
12552
+ for (const key of path84) {
12468
12553
  if (typeof key === "number") {
12469
12554
  if (!Array.isArray(current)) return void 0;
12470
12555
  current = current[key];
@@ -12481,7 +12566,7 @@ function restoreConfigSecrets(value, stored, node) {
12481
12566
  return mapConfigSecrets(
12482
12567
  value,
12483
12568
  node,
12484
- (secret, path83) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path83) : secret
12569
+ (secret, path84) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path84) : secret
12485
12570
  );
12486
12571
  }
12487
12572
 
@@ -12530,8 +12615,8 @@ function stepIntoNested(container, key, nextKey) {
12530
12615
  }
12531
12616
  return ensureObject(container, resolved);
12532
12617
  }
12533
- function setNestedValue(obj, path83, value) {
12534
- const keys = path83.split(".");
12618
+ function setNestedValue(obj, path84, value) {
12619
+ const keys = path84.split(".");
12535
12620
  const result = { ...obj };
12536
12621
  let current = result;
12537
12622
  for (let i = 0; i < keys.length - 1; i++) {
@@ -12558,8 +12643,8 @@ function formatIssue2(issue, key) {
12558
12643
  return issue.keys.map(
12559
12644
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
12560
12645
  );
12561
- const path83 = issue.path.length > 0 ? issue.path.join(".") : key;
12562
- return [`${path83}: ${issue.message}`];
12646
+ const path84 = issue.path.length > 0 ? issue.path.join(".") : key;
12647
+ return [`${path84}: ${issue.message}`];
12563
12648
  }
12564
12649
 
12565
12650
  // src/commands/config/applyConfigSet.ts
@@ -12816,8 +12901,8 @@ function removeAt(container, keys) {
12816
12901
  }
12817
12902
  return removeFromChild(container, key, rest);
12818
12903
  }
12819
- function unsetNestedValue(obj, path83) {
12820
- const { container, removed } = removeAt(obj, path83.split("."));
12904
+ function unsetNestedValue(obj, path84) {
12905
+ const { container, removed } = removeAt(obj, path84.split("."));
12821
12906
  return { config: container, removed };
12822
12907
  }
12823
12908
 
@@ -13038,7 +13123,7 @@ import { readFile as readFile2, stat as stat3, writeFile as writeFile3 } from "f
13038
13123
 
13039
13124
  // src/commands/sessions/web/formatWithOxfmt.ts
13040
13125
  import { execFile as execFile8 } from "child_process";
13041
- import { existsSync as existsSync33 } from "fs";
13126
+ import { existsSync as existsSync35 } from "fs";
13042
13127
  import { dirname as dirname22, join as join32 } from "path";
13043
13128
  import { promisify as promisify8 } from "util";
13044
13129
  var execFileAsync7 = promisify8(execFile8);
@@ -13047,7 +13132,7 @@ function findOxfmtScript(root) {
13047
13132
  let dir = root;
13048
13133
  for (; ; ) {
13049
13134
  const candidate = join32(dir, "node_modules", "oxfmt", "bin", "oxfmt");
13050
- if (existsSync33(candidate)) return candidate;
13135
+ if (existsSync35(candidate)) return candidate;
13051
13136
  const parent = dirname22(dir);
13052
13137
  if (parent === dir) return void 0;
13053
13138
  dir = parent;
@@ -13118,7 +13203,7 @@ async function writeFileContent(req, res) {
13118
13203
 
13119
13204
  // src/commands/sessions/web/createCssHandler.ts
13120
13205
  import { createHash as createHash2 } from "crypto";
13121
- import { readFileSync as readFileSync22 } from "fs";
13206
+ import { readFileSync as readFileSync23 } from "fs";
13122
13207
  import { createRequire as createRequire2 } from "module";
13123
13208
  var require3 = createRequire2(import.meta.url);
13124
13209
  function createCssHandler(packageEntry) {
@@ -13126,7 +13211,7 @@ function createCssHandler(packageEntry) {
13126
13211
  return (req, res) => {
13127
13212
  if (!cache5) {
13128
13213
  const resolved = require3.resolve(packageEntry);
13129
- const body = readFileSync22(resolved, "utf8");
13214
+ const body = readFileSync23(resolved, "utf8");
13130
13215
  const etag = `"${createHash2("sha256").update(body).digest("hex").slice(0, 16)}"`;
13131
13216
  cache5 = { body, etag };
13132
13217
  }
@@ -13182,6 +13267,7 @@ var routes2 = {
13182
13267
  "GET /api/file": fileContent,
13183
13268
  "POST /api/file": writeFileContent,
13184
13269
  "GET /api/files": listFiles,
13270
+ "GET /api/rules": listScopedRules,
13185
13271
  "GET /api/jira-site": jiraSite,
13186
13272
  "GET /api/harness": harnessCapabilities,
13187
13273
  "GET /api/session-layout": sessionLayout,
@@ -13588,13 +13674,13 @@ import chalk64 from "chalk";
13588
13674
 
13589
13675
  // src/commands/sessions/shared/resolveSessionTranscript.ts
13590
13676
  import * as fs22 from "fs";
13591
- import * as path31 from "path";
13677
+ import * as path34 from "path";
13592
13678
 
13593
13679
  // src/commands/sessions/shared/claudeProjectsRoot.ts
13594
13680
  import * as os4 from "os";
13595
- import * as path30 from "path";
13681
+ import * as path33 from "path";
13596
13682
  function claudeProjectsRoot() {
13597
- return path30.join(os4.homedir(), ".claude", "projects");
13683
+ return path33.join(os4.homedir(), ".claude", "projects");
13598
13684
  }
13599
13685
  function projectSlug(cwd) {
13600
13686
  return cwd.replace(/[^a-zA-Z0-9]/g, "-");
@@ -13617,7 +13703,7 @@ function findTranscriptFile(sessionId, projectsRoot) {
13617
13703
  return void 0;
13618
13704
  }
13619
13705
  for (const dir of projectDirs) {
13620
- const candidate = path31.join(projectsRoot, dir, `${sessionId}.jsonl`);
13706
+ const candidate = path34.join(projectsRoot, dir, `${sessionId}.jsonl`);
13621
13707
  if (fs22.existsSync(candidate)) return candidate;
13622
13708
  }
13623
13709
  return void 0;
@@ -13669,12 +13755,12 @@ import chalk65 from "chalk";
13669
13755
 
13670
13756
  // src/commands/sessions/shared/resolveCurrentSessionId.ts
13671
13757
  import * as fs23 from "fs";
13672
- import * as path32 from "path";
13758
+ import * as path35 from "path";
13673
13759
  var SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID";
13674
13760
  function resolveCurrentSessionId(options2 = {}) {
13675
13761
  const fromEnv = (options2.env ?? process.env)[SESSION_ID_ENV];
13676
13762
  if (fromEnv) return fromEnv;
13677
- const dir = path32.join(
13763
+ const dir = path35.join(
13678
13764
  options2.projectsRoot ?? claudeProjectsRoot(),
13679
13765
  projectSlug(options2.cwd ?? process.cwd())
13680
13766
  );
@@ -13690,10 +13776,10 @@ function newestTranscriptId(dir) {
13690
13776
  let newest;
13691
13777
  for (const entry of entries) {
13692
13778
  if (!entry.endsWith(".jsonl")) continue;
13693
- const modifiedAt = modifiedAtOf(path32.join(dir, entry));
13779
+ const modifiedAt = modifiedAtOf(path35.join(dir, entry));
13694
13780
  if (modifiedAt === void 0) continue;
13695
13781
  if (!newest || modifiedAt > newest.modifiedAt)
13696
- newest = { id: path32.basename(entry, ".jsonl"), modifiedAt };
13782
+ newest = { id: path35.basename(entry, ".jsonl"), modifiedAt };
13697
13783
  }
13698
13784
  return newest?.id;
13699
13785
  }
@@ -13920,7 +14006,7 @@ function registerAssociateJiraCommand(cmd) {
13920
14006
 
13921
14007
  // src/commands/backlog/cloneRepo.ts
13922
14008
  import { spawnSync as spawnSync2 } from "child_process";
13923
- import { existsSync as existsSync35 } from "fs";
14009
+ import { existsSync as existsSync37 } from "fs";
13924
14010
  import { mkdir as mkdir3 } from "fs/promises";
13925
14011
  import chalk70 from "chalk";
13926
14012
 
@@ -13930,9 +14016,9 @@ function originToSshUrl(origin) {
13930
14016
  const firstSlash = origin.indexOf("/");
13931
14017
  if (firstSlash <= 0) return null;
13932
14018
  const host = origin.slice(0, firstSlash);
13933
- const path83 = origin.slice(firstSlash + 1);
13934
- if (!path83) return null;
13935
- return `git@${host}:${path83}.git`;
14019
+ const path84 = origin.slice(firstSlash + 1);
14020
+ if (!path84) return null;
14021
+ return `git@${host}:${path84}.git`;
13936
14022
  }
13937
14023
 
13938
14024
  // src/commands/backlog/cloneRepo.ts
@@ -13956,7 +14042,7 @@ async function cloneRepo(originRaw) {
13956
14042
  if (!target) {
13957
14043
  return fail2(`Could not derive a repository name from "${origin}".`);
13958
14044
  }
13959
- if (existsSync35(target)) {
14045
+ if (existsSync37(target)) {
13960
14046
  return fail2(`Clone target already exists: ${target}`);
13961
14047
  }
13962
14048
  await mkdir3(baseDir, { recursive: true });
@@ -14507,7 +14593,7 @@ function ensureRemoteOrigin() {
14507
14593
 
14508
14594
  // src/commands/backlog/add/shared.ts
14509
14595
  import { spawnSync as spawnSync3 } from "child_process";
14510
- import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
14596
+ import { mkdtempSync, readFileSync as readFileSync24, unlinkSync as unlinkSync6, writeFileSync as writeFileSync21 } from "fs";
14511
14597
  import { tmpdir as tmpdir2 } from "os";
14512
14598
  import { join as join36 } from "path";
14513
14599
  import enquirer6 from "enquirer";
@@ -14557,7 +14643,7 @@ function openEditor() {
14557
14643
  unlinkSync6(filePath);
14558
14644
  return void 0;
14559
14645
  }
14560
- const content = readFileSync23(filePath, "utf8").trim();
14646
+ const content = readFileSync24(filePath, "utf8").trim();
14561
14647
  unlinkSync6(filePath);
14562
14648
  return content || void 0;
14563
14649
  }
@@ -14733,7 +14819,7 @@ async function list2(options2) {
14733
14819
  import chalk83 from "chalk";
14734
14820
 
14735
14821
  // src/commands/backlog/readJsonPayload.ts
14736
- import { readFileSync as readFileSync24 } from "fs";
14822
+ import { readFileSync as readFileSync25 } from "fs";
14737
14823
  import chalk81 from "chalk";
14738
14824
  function fail3(message3) {
14739
14825
  console.error(chalk81.red(message3));
@@ -14745,7 +14831,7 @@ function describe(error) {
14745
14831
  async function readSource(source) {
14746
14832
  try {
14747
14833
  if (source === "-") return (await readStdinBuffer()).toString("utf8");
14748
- return readFileSync24(source, "utf8");
14834
+ return readFileSync25(source, "utf8");
14749
14835
  } catch (error) {
14750
14836
  return fail3(
14751
14837
  `Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
@@ -16952,7 +17038,7 @@ function extractGraphqlQuery(args) {
16952
17038
  }
16953
17039
 
16954
17040
  // src/shared/loadCliReads.ts
16955
- import { existsSync as existsSync36, readFileSync as readFileSync25, writeFileSync as writeFileSync22 } from "fs";
17041
+ import { existsSync as existsSync38, readFileSync as readFileSync26, writeFileSync as writeFileSync22 } from "fs";
16956
17042
  import { dirname as dirname23, resolve as resolve12 } from "path";
16957
17043
  import { fileURLToPath as fileURLToPath5 } from "url";
16958
17044
  var __filename3 = fileURLToPath5(import.meta.url);
@@ -16960,9 +17046,9 @@ var __dirname4 = dirname23(__filename3);
16960
17046
  function packageRoot() {
16961
17047
  return __dirname4;
16962
17048
  }
16963
- function readLines(path83) {
16964
- if (!existsSync36(path83)) return [];
16965
- return readFileSync25(path83, "utf8").split("\n").filter((line) => line.trim() !== "");
17049
+ function readLines(path84) {
17050
+ if (!existsSync38(path84)) return [];
17051
+ return readFileSync26(path84, "utf8").split("\n").filter((line) => line.trim() !== "");
16966
17052
  }
16967
17053
  var cachedReads;
16968
17054
  var cachedWrites;
@@ -17008,7 +17094,7 @@ function findCliWrite(command) {
17008
17094
  }
17009
17095
 
17010
17096
  // src/shared/readSettingsPerms.ts
17011
- import { existsSync as existsSync37, readFileSync as readFileSync26 } from "fs";
17097
+ import { existsSync as existsSync39, readFileSync as readFileSync27 } from "fs";
17012
17098
  import { homedir as homedir15 } from "os";
17013
17099
  import { join as join37 } from "path";
17014
17100
  function readSettingsPerms(key) {
@@ -17024,9 +17110,9 @@ function readSettingsPerms(key) {
17024
17110
  return entries;
17025
17111
  }
17026
17112
  function readPermissionArray(filePath, key) {
17027
- if (!existsSync37(filePath)) return [];
17113
+ if (!existsSync39(filePath)) return [];
17028
17114
  try {
17029
- const data = JSON.parse(readFileSync26(filePath, "utf8"));
17115
+ const data = JSON.parse(readFileSync27(filePath, "utf8"));
17030
17116
  const arr = data?.permissions?.[key];
17031
17117
  return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
17032
17118
  } catch {
@@ -17370,7 +17456,7 @@ ${reasons.join("\n")}`);
17370
17456
  }
17371
17457
 
17372
17458
  // src/commands/permitCliReads/index.ts
17373
- import { existsSync as existsSync38, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync23 } from "fs";
17459
+ import { existsSync as existsSync40, mkdirSync as mkdirSync13, readFileSync as readFileSync28, writeFileSync as writeFileSync23 } from "fs";
17374
17460
  import { homedir as homedir17 } from "os";
17375
17461
  import { join as join39 } from "path";
17376
17462
 
@@ -17483,14 +17569,14 @@ function showProgress(p, label2) {
17483
17569
  const pct = Math.round(p.done / p.total * 100);
17484
17570
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
17485
17571
  }
17486
- async function resolveCommand(cli, path83, description, depth, p) {
17487
- showProgress(p, path83.join(" "));
17488
- const subHelp = await runHelp([cli, ...path83]);
17572
+ async function resolveCommand(cli, path84, description, depth, p) {
17573
+ showProgress(p, path84.join(" "));
17574
+ const subHelp = await runHelp([cli, ...path84]);
17489
17575
  if (!subHelp || !hasSubcommands(subHelp)) {
17490
- return [{ path: path83, description }];
17576
+ return [{ path: path84, description }];
17491
17577
  }
17492
- const children = await discoverAt(cli, path83, depth + 1, p);
17493
- return children.length > 0 ? children : [{ path: path83, description }];
17578
+ const children = await discoverAt(cli, path84, depth + 1, p);
17579
+ return children.length > 0 ? children : [{ path: path84, description }];
17494
17580
  }
17495
17581
  async function discoverAt(cli, parentPath, depth, p) {
17496
17582
  if (depth > SAFETY_DEPTH) return [];
@@ -17638,9 +17724,9 @@ function logPath(cli) {
17638
17724
  return join39(homedir17(), ".assist", `cli-discover-${safeName}.log`);
17639
17725
  }
17640
17726
  function readCache(cli) {
17641
- const path83 = logPath(cli);
17642
- if (!existsSync38(path83)) return void 0;
17643
- return readFileSync27(path83, "utf8");
17727
+ const path84 = logPath(cli);
17728
+ if (!existsSync40(path84)) return void 0;
17729
+ return readFileSync28(path84, "utf8");
17644
17730
  }
17645
17731
  function writeCache(cli, output) {
17646
17732
  const dir = join39(homedir17(), ".assist");
@@ -17774,7 +17860,7 @@ function registerCliHook(program2) {
17774
17860
  }
17775
17861
 
17776
17862
  // src/commands/codeComment/codeCommentConfirm.ts
17777
- import { existsSync as existsSync40, readFileSync as readFileSync29, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
17863
+ import { existsSync as existsSync42, readFileSync as readFileSync30, unlinkSync as unlinkSync8, writeFileSync as writeFileSync24 } from "fs";
17778
17864
  import chalk122 from "chalk";
17779
17865
 
17780
17866
  // src/commands/codeComment/getRestrictedDir.ts
@@ -17788,7 +17874,7 @@ function getPinStatePath(pin) {
17788
17874
  }
17789
17875
 
17790
17876
  // src/commands/codeComment/sweepRestrictedDir.ts
17791
- import { readdirSync as readdirSync5, statSync as statSync6, unlinkSync as unlinkSync7 } from "fs";
17877
+ import { readdirSync as readdirSync5, statSync as statSync7, unlinkSync as unlinkSync7 } from "fs";
17792
17878
  import { join as join41 } from "path";
17793
17879
  var STALE_AFTER_MS = 30 * 60 * 1e3;
17794
17880
  function sweepRestrictedDir(dir = getRestrictedDir()) {
@@ -17800,9 +17886,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
17800
17886
  }
17801
17887
  const cutoff = Date.now() - STALE_AFTER_MS;
17802
17888
  for (const entry of entries) {
17803
- const path83 = join41(dir, entry);
17889
+ const path84 = join41(dir, entry);
17804
17890
  try {
17805
- if (statSync6(path83).mtimeMs < cutoff) unlinkSync7(path83);
17891
+ if (statSync7(path84).mtimeMs < cutoff) unlinkSync7(path84);
17806
17892
  } catch {
17807
17893
  continue;
17808
17894
  }
@@ -17810,12 +17896,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
17810
17896
  }
17811
17897
 
17812
17898
  // src/commands/codeComment/readPinState.ts
17813
- import { existsSync as existsSync39, readFileSync as readFileSync28 } from "fs";
17899
+ import { existsSync as existsSync41, readFileSync as readFileSync29 } from "fs";
17814
17900
  function readPinState(pin) {
17815
- const path83 = getPinStatePath(pin);
17816
- if (!existsSync39(path83)) return void 0;
17901
+ const path84 = getPinStatePath(pin);
17902
+ if (!existsSync41(path84)) return void 0;
17817
17903
  try {
17818
- const state = JSON.parse(readFileSync28(path83, "utf8"));
17904
+ const state = JSON.parse(readFileSync29(path84, "utf8"));
17819
17905
  if (state.pin !== pin) return void 0;
17820
17906
  return state;
17821
17907
  } catch {
@@ -17832,12 +17918,12 @@ function codeCommentConfirm(pin) {
17832
17918
  process.exitCode = 1;
17833
17919
  return;
17834
17920
  }
17835
- if (!existsSync40(state.file)) {
17921
+ if (!existsSync42(state.file)) {
17836
17922
  console.error(chalk122.red(`Target file no longer exists: ${state.file}`));
17837
17923
  process.exitCode = 1;
17838
17924
  return;
17839
17925
  }
17840
- const original = readFileSync29(state.file, "utf8");
17926
+ const original = readFileSync30(state.file, "utf8");
17841
17927
  const lines2 = original.split("\n");
17842
17928
  const index3 = state.line - 1;
17843
17929
  if (index3 > lines2.length) {
@@ -18051,13 +18137,13 @@ import chalk125 from "chalk";
18051
18137
 
18052
18138
  // src/commands/complexity/shared/index.ts
18053
18139
  import fs25 from "fs";
18054
- import path34 from "path";
18140
+ import path37 from "path";
18055
18141
  import chalk124 from "chalk";
18056
18142
  import ts5 from "typescript";
18057
18143
 
18058
18144
  // src/commands/complexity/findSourceFiles.ts
18059
18145
  import fs24 from "fs";
18060
- import path33 from "path";
18146
+ import path36 from "path";
18061
18147
  import { minimatch as minimatch5 } from "minimatch";
18062
18148
  function applyIgnoreGlobs(files, extraIgnore = []) {
18063
18149
  const { complexity } = loadConfig();
@@ -18071,7 +18157,7 @@ function walk2(dir, results) {
18071
18157
  const extensions = [".ts", ".tsx"];
18072
18158
  const entries = fs24.readdirSync(dir, { withFileTypes: true });
18073
18159
  for (const entry of entries) {
18074
- const fullPath = path33.join(dir, entry.name);
18160
+ const fullPath = path36.join(dir, entry.name);
18075
18161
  if (entry.isDirectory()) {
18076
18162
  if (entry.name !== "node_modules" && entry.name !== ".git") {
18077
18163
  walk2(fullPath, results);
@@ -18293,7 +18379,7 @@ function countSloc(content) {
18293
18379
  function createSourceFromFile(filePath) {
18294
18380
  const content = fs25.readFileSync(filePath, "utf8");
18295
18381
  return ts5.createSourceFile(
18296
- path34.basename(filePath),
18382
+ path37.basename(filePath),
18297
18383
  content,
18298
18384
  ts5.ScriptTarget.Latest,
18299
18385
  true,
@@ -18455,12 +18541,12 @@ function formatResultLine(entry, failing) {
18455
18541
 
18456
18542
  // src/commands/complexity/maintainability/getMaintainabilityGitState.ts
18457
18543
  import { execSync as execSync35 } from "child_process";
18458
- import path35 from "path";
18544
+ import path38 from "path";
18459
18545
  function git3(command) {
18460
18546
  return execSync35(command, { encoding: "utf8" });
18461
18547
  }
18462
18548
  function toAbsolute(root, repoRelative) {
18463
- return path35.resolve(root, repoRelative);
18549
+ return path38.resolve(root, repoRelative);
18464
18550
  }
18465
18551
  function collectShrunkFiles(root) {
18466
18552
  const shrunk = /* @__PURE__ */ new Set();
@@ -18500,7 +18586,7 @@ function getMaintainabilityGitState() {
18500
18586
  }
18501
18587
 
18502
18588
  // src/commands/complexity/maintainability/printMaintainabilityFailure.ts
18503
- import path36 from "path";
18589
+ import path39 from "path";
18504
18590
  import chalk128 from "chalk";
18505
18591
  var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
18506
18592
  function remediationLine(entry) {
@@ -18509,7 +18595,7 @@ function remediationLine(entry) {
18509
18595
  ${chalk128.cyan(extractTemplate)}`;
18510
18596
  }
18511
18597
  function cheatLine(entry, gitState) {
18512
- const shrank = gitState.shrunkFiles.has(path36.resolve(entry.file));
18598
+ const shrank = gitState.shrunkFiles.has(path39.resolve(entry.file));
18513
18599
  if (!shrank || gitState.newFileCreated) return "";
18514
18600
  return `
18515
18601
  ${chalk128.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
@@ -18923,7 +19009,7 @@ import { cp } from "fs/promises";
18923
19009
  import chalk139 from "chalk";
18924
19010
 
18925
19011
  // src/commands/criteriaExtension/criteriaExtensionDir.ts
18926
- import { existsSync as existsSync41 } from "fs";
19012
+ import { existsSync as existsSync43 } from "fs";
18927
19013
  import { dirname as dirname24, join as join42 } from "path";
18928
19014
  import { fileURLToPath as fileURLToPath6 } from "url";
18929
19015
  var moduleDir = dirname24(fileURLToPath6(import.meta.url));
@@ -18934,7 +19020,7 @@ function criteriaExtensionDir() {
18934
19020
  "criteriaExtension",
18935
19021
  "criteria-extension"
18936
19022
  );
18937
- if (existsSync41(bundled)) return bundled;
19023
+ if (existsSync43(bundled)) return bundled;
18938
19024
  return join42(moduleDir, "..", "..", "..", "criteria-extension");
18939
19025
  }
18940
19026
 
@@ -18954,11 +19040,11 @@ async function loadPath(source) {
18954
19040
  }
18955
19041
  }
18956
19042
  async function criteriaExtension() {
18957
- const path83 = await loadPath(criteriaExtensionDir());
19043
+ const path84 = await loadPath(criteriaExtensionDir());
18958
19044
  console.log(
18959
19045
  chalk139.bold("acceptance criteria outliner \u2014 GitHub browser extension")
18960
19046
  );
18961
- console.log(chalk139.dim(`load the unpacked extension from ${path83}`));
19047
+ console.log(chalk139.dim(`load the unpacked extension from ${path84}`));
18962
19048
  }
18963
19049
 
18964
19050
  // src/commands/registerCriteriaExtension.ts
@@ -19049,12 +19135,12 @@ function getMigrationApprovalPath(migrationId) {
19049
19135
  }
19050
19136
 
19051
19137
  // src/commands/dbMigration/readMigrationPinState.ts
19052
- import { existsSync as existsSync42, readFileSync as readFileSync30 } from "fs";
19138
+ import { existsSync as existsSync44, readFileSync as readFileSync31 } from "fs";
19053
19139
  function readMigrationPinState(pin) {
19054
- const path83 = getMigrationPinPath(pin);
19055
- if (!existsSync42(path83)) return void 0;
19140
+ const path84 = getMigrationPinPath(pin);
19141
+ if (!existsSync44(path84)) return void 0;
19056
19142
  try {
19057
- const state = JSON.parse(readFileSync30(path83, "utf8"));
19143
+ const state = JSON.parse(readFileSync31(path84, "utf8"));
19058
19144
  if (state.pin !== pin) return void 0;
19059
19145
  if (!Number.isInteger(state.migrationId)) return void 0;
19060
19146
  return state;
@@ -19141,7 +19227,7 @@ function registerDbMigration(parent) {
19141
19227
  }
19142
19228
 
19143
19229
  // src/commands/deploy/redirect.ts
19144
- import { existsSync as existsSync43, readFileSync as readFileSync31, writeFileSync as writeFileSync28 } from "fs";
19230
+ import { existsSync as existsSync45, readFileSync as readFileSync32, writeFileSync as writeFileSync28 } from "fs";
19145
19231
  import chalk143 from "chalk";
19146
19232
  var TRAILING_SLASH_SCRIPT = ` <script>
19147
19233
  if (!window.location.pathname.endsWith('/')) {
@@ -19150,11 +19236,11 @@ var TRAILING_SLASH_SCRIPT = ` <script>
19150
19236
  </script>`;
19151
19237
  function redirect() {
19152
19238
  const indexPath = "index.html";
19153
- if (!existsSync43(indexPath)) {
19239
+ if (!existsSync45(indexPath)) {
19154
19240
  console.log(chalk143.yellow("No index.html found"));
19155
19241
  return;
19156
19242
  }
19157
- const content = readFileSync31(indexPath, "utf8");
19243
+ const content = readFileSync32(indexPath, "utf8");
19158
19244
  if (content.includes("window.location.pathname.endsWith('/')")) {
19159
19245
  console.log(chalk143.dim("Trailing slash script already present"));
19160
19246
  return;
@@ -19197,7 +19283,7 @@ import { execSync as execSync36 } from "child_process";
19197
19283
  import chalk144 from "chalk";
19198
19284
 
19199
19285
  // src/shared/getRepoName.ts
19200
- import { existsSync as existsSync44, readFileSync as readFileSync32 } from "fs";
19286
+ import { existsSync as existsSync46, readFileSync as readFileSync33 } from "fs";
19201
19287
  import { basename as basename12, join as join45 } from "path";
19202
19288
  function getRepoName() {
19203
19289
  const config = loadConfig();
@@ -19205,9 +19291,9 @@ function getRepoName() {
19205
19291
  return config.devlog.name;
19206
19292
  }
19207
19293
  const packageJsonPath = join45(process.cwd(), "package.json");
19208
- if (existsSync44(packageJsonPath)) {
19294
+ if (existsSync46(packageJsonPath)) {
19209
19295
  try {
19210
- const content = readFileSync32(packageJsonPath, "utf8");
19296
+ const content = readFileSync33(packageJsonPath, "utf8");
19211
19297
  const pkg = JSON.parse(content);
19212
19298
  if (pkg.name) {
19213
19299
  return pkg.name;
@@ -19219,7 +19305,7 @@ function getRepoName() {
19219
19305
  }
19220
19306
 
19221
19307
  // src/commands/devlog/loadDevlogEntries.ts
19222
- import { readdirSync as readdirSync6, readFileSync as readFileSync33 } from "fs";
19308
+ import { readdirSync as readdirSync6, readFileSync as readFileSync34 } from "fs";
19223
19309
  import { join as join46 } from "path";
19224
19310
  var DEVLOG_DIR = join46(BLOG_REPO_ROOT, "src/content/devlog");
19225
19311
  function extractFrontmatter(content) {
@@ -19249,7 +19335,7 @@ function readDevlogFiles(callback) {
19249
19335
  try {
19250
19336
  const files = readdirSync6(DEVLOG_DIR).filter((f) => f.endsWith(".md"));
19251
19337
  for (const file of files) {
19252
- const content = readFileSync33(join46(DEVLOG_DIR, file), "utf8");
19338
+ const content = readFileSync34(join46(DEVLOG_DIR, file), "utf8");
19253
19339
  const parsed = parseFrontmatter(content, file);
19254
19340
  if (parsed) callback(parsed);
19255
19341
  }
@@ -19762,11 +19848,11 @@ async function checkBuildLocksCommand() {
19762
19848
  }
19763
19849
 
19764
19850
  // src/commands/dotnet/buildTree.ts
19765
- import { readFileSync as readFileSync34 } from "fs";
19766
- import path37 from "path";
19851
+ import { readFileSync as readFileSync35 } from "fs";
19852
+ import path40 from "path";
19767
19853
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
19768
19854
  function getProjectRefs(csprojPath) {
19769
- const content = readFileSync34(csprojPath, "utf8");
19855
+ const content = readFileSync35(csprojPath, "utf8");
19770
19856
  const refs = [];
19771
19857
  for (const match of content.matchAll(PROJECT_REF_RE)) {
19772
19858
  refs.push(match[1].replace(/\\/g, "/"));
@@ -19774,16 +19860,16 @@ function getProjectRefs(csprojPath) {
19774
19860
  return refs;
19775
19861
  }
19776
19862
  function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
19777
- const abs = path37.resolve(csprojPath);
19778
- const rel = path37.relative(repoRoot2, abs);
19863
+ const abs = path40.resolve(csprojPath);
19864
+ const rel = path40.relative(repoRoot2, abs);
19779
19865
  const node = { path: abs, relativePath: rel, children: [] };
19780
19866
  if (visited.has(abs)) return node;
19781
19867
  visited.add(abs);
19782
- const dir = path37.dirname(abs);
19868
+ const dir = path40.dirname(abs);
19783
19869
  for (const ref of getProjectRefs(abs)) {
19784
- const childAbs = path37.resolve(dir, ref);
19870
+ const childAbs = path40.resolve(dir, ref);
19785
19871
  try {
19786
- readFileSync34(childAbs);
19872
+ readFileSync35(childAbs);
19787
19873
  node.children.push(buildTree(childAbs, repoRoot2, visited));
19788
19874
  } catch {
19789
19875
  node.children.push({
@@ -19808,8 +19894,8 @@ function collectAllDeps(node) {
19808
19894
  }
19809
19895
 
19810
19896
  // src/commands/dotnet/findContainingSolutions.ts
19811
- import { readdirSync as readdirSync8, readFileSync as readFileSync35, statSync as statSync7 } from "fs";
19812
- import path38 from "path";
19897
+ import { readdirSync as readdirSync8, readFileSync as readFileSync36, statSync as statSync8 } from "fs";
19898
+ import path41 from "path";
19813
19899
  function findSlnFiles(dir, maxDepth, depth = 0) {
19814
19900
  if (depth > maxDepth) return [];
19815
19901
  const results = [];
@@ -19822,9 +19908,9 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
19822
19908
  for (const entry of entries) {
19823
19909
  if (entry.startsWith(".") || entry === "node_modules" || entry === "packages")
19824
19910
  continue;
19825
- const full = path38.join(dir, entry);
19911
+ const full = path41.join(dir, entry);
19826
19912
  try {
19827
- const stat4 = statSync7(full);
19913
+ const stat4 = statSync8(full);
19828
19914
  if (stat4.isFile() && entry.endsWith(".sln")) {
19829
19915
  results.push(full);
19830
19916
  } else if (stat4.isDirectory()) {
@@ -19836,16 +19922,16 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
19836
19922
  return results;
19837
19923
  }
19838
19924
  function findContainingSolutions(csprojPath, repoRoot2) {
19839
- const csprojAbs = path38.resolve(csprojPath);
19840
- const csprojBasename = path38.basename(csprojAbs);
19925
+ const csprojAbs = path41.resolve(csprojPath);
19926
+ const csprojBasename = path41.basename(csprojAbs);
19841
19927
  const slnFiles = findSlnFiles(repoRoot2, 3);
19842
19928
  const matches = [];
19843
19929
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
19844
19930
  for (const sln of slnFiles) {
19845
19931
  try {
19846
- const content = readFileSync35(sln, "utf8");
19932
+ const content = readFileSync36(sln, "utf8");
19847
19933
  if (pattern2.test(content)) {
19848
- matches.push(path38.relative(repoRoot2, sln));
19934
+ matches.push(path41.relative(repoRoot2, sln));
19849
19935
  }
19850
19936
  } catch {
19851
19937
  }
@@ -19907,16 +19993,16 @@ function printJson(tree, totalCount, solutions) {
19907
19993
  }
19908
19994
 
19909
19995
  // src/commands/dotnet/resolveCsproj.ts
19910
- import { existsSync as existsSync45 } from "fs";
19911
- import path39 from "path";
19996
+ import { existsSync as existsSync47 } from "fs";
19997
+ import path42 from "path";
19912
19998
  import chalk153 from "chalk";
19913
19999
  function resolveCsproj(csprojPath) {
19914
- const resolved = path39.resolve(csprojPath);
19915
- if (!existsSync45(resolved)) {
20000
+ const resolved = path42.resolve(csprojPath);
20001
+ if (!existsSync47(resolved)) {
19916
20002
  console.error(chalk153.red(`File not found: ${resolved}`));
19917
20003
  process.exit(1);
19918
20004
  }
19919
- const repoRoot2 = findRepoRoot(path39.dirname(resolved));
20005
+ const repoRoot2 = findRepoRoot(path42.dirname(resolved));
19920
20006
  if (!repoRoot2) {
19921
20007
  console.error(chalk153.red("Could not find git repository root"));
19922
20008
  process.exit(1);
@@ -20080,8 +20166,8 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
20080
20166
  }
20081
20167
 
20082
20168
  // src/commands/dotnet/resolveSolution.ts
20083
- import { existsSync as existsSync46 } from "fs";
20084
- import path40 from "path";
20169
+ import { existsSync as existsSync48 } from "fs";
20170
+ import path43 from "path";
20085
20171
  import chalk157 from "chalk";
20086
20172
 
20087
20173
  // src/commands/dotnet/findSolution.ts
@@ -20120,8 +20206,8 @@ function findSolution() {
20120
20206
  // src/commands/dotnet/resolveSolution.ts
20121
20207
  function resolveSolution(sln) {
20122
20208
  if (sln) {
20123
- const resolved = path40.resolve(sln);
20124
- if (!existsSync46(resolved)) {
20209
+ const resolved = path43.resolve(sln);
20210
+ if (!existsSync48(resolved)) {
20125
20211
  console.error(chalk157.red(`Solution file not found: ${resolved}`));
20126
20212
  process.exit(1);
20127
20213
  }
@@ -20161,9 +20247,9 @@ function parseInspectReport(json) {
20161
20247
 
20162
20248
  // src/commands/dotnet/runInspectCode.ts
20163
20249
  import { execSync as execSync40 } from "child_process";
20164
- import { existsSync as existsSync47, readFileSync as readFileSync36, unlinkSync as unlinkSync10 } from "fs";
20250
+ import { existsSync as existsSync49, readFileSync as readFileSync37, unlinkSync as unlinkSync10 } from "fs";
20165
20251
  import { tmpdir as tmpdir4 } from "os";
20166
- import path41 from "path";
20252
+ import path44 from "path";
20167
20253
  import chalk158 from "chalk";
20168
20254
  function assertJbInstalled() {
20169
20255
  try {
@@ -20177,7 +20263,7 @@ function assertJbInstalled() {
20177
20263
  }
20178
20264
  }
20179
20265
  function runInspectCode(slnPath, include, swea) {
20180
- const reportPath = path41.join(tmpdir4(), `inspect-${Date.now()}.xml`);
20266
+ const reportPath = path44.join(tmpdir4(), `inspect-${Date.now()}.xml`);
20181
20267
  const includeFlag = include ? ` --include="${include}"` : "";
20182
20268
  const sweaFlag = swea ? " --swea" : "";
20183
20269
  try {
@@ -20192,11 +20278,11 @@ function runInspectCode(slnPath, include, swea) {
20192
20278
  console.error(chalk158.red("jb inspectcode failed"));
20193
20279
  process.exit(1);
20194
20280
  }
20195
- if (!existsSync47(reportPath)) {
20281
+ if (!existsSync49(reportPath)) {
20196
20282
  console.error(chalk158.red("Report file not generated"));
20197
20283
  process.exit(1);
20198
20284
  }
20199
- const xml = readFileSync36(reportPath, "utf8");
20285
+ const xml = readFileSync37(reportPath, "utf8");
20200
20286
  unlinkSync10(reportPath);
20201
20287
  return xml;
20202
20288
  }
@@ -20481,13 +20567,13 @@ function decideCommentGuard(input, existingContent) {
20481
20567
  }
20482
20568
 
20483
20569
  // src/commands/dbMigration/consumeMigrationApproval.ts
20484
- import { existsSync as existsSync48, unlinkSync as unlinkSync11 } from "fs";
20570
+ import { existsSync as existsSync50, unlinkSync as unlinkSync11 } from "fs";
20485
20571
  function consumeMigrationApproval(migrationId) {
20486
20572
  sweepRestrictedDir();
20487
- const path83 = getMigrationApprovalPath(migrationId);
20488
- if (!existsSync48(path83)) return false;
20573
+ const path84 = getMigrationApprovalPath(migrationId);
20574
+ if (!existsSync50(path84)) return false;
20489
20575
  try {
20490
- unlinkSync11(path83);
20576
+ unlinkSync11(path84);
20491
20577
  return true;
20492
20578
  } catch {
20493
20579
  return false;
@@ -21541,7 +21627,7 @@ function fetchIssue2(number, repo) {
21541
21627
  }
21542
21628
 
21543
21629
  // src/commands/github/issue/resumeIssueBody.ts
21544
- import { existsSync as existsSync49, readFileSync as readFileSync37 } from "fs";
21630
+ import { existsSync as existsSync51, readFileSync as readFileSync38 } from "fs";
21545
21631
 
21546
21632
  // src/commands/github/issue/issueWorkingFile.ts
21547
21633
  import { join as join51 } from "path";
@@ -21558,11 +21644,11 @@ function issueWorkingFile(slug, number) {
21558
21644
  // src/commands/github/issue/resumeIssueBody.ts
21559
21645
  function resumeIssueBody(slug, number, updatedAt) {
21560
21646
  const { bodyPath, metaPath } = issueWorkingFile(slug, number);
21561
- if (!existsSync49(bodyPath) || !existsSync49(metaPath)) return void 0;
21647
+ if (!existsSync51(bodyPath) || !existsSync51(metaPath)) return void 0;
21562
21648
  try {
21563
- const meta = JSON.parse(readFileSync37(metaPath, "utf8"));
21649
+ const meta = JSON.parse(readFileSync38(metaPath, "utf8"));
21564
21650
  if (meta.updatedAt !== updatedAt) return void 0;
21565
- return readFileSync37(bodyPath, "utf8");
21651
+ return readFileSync38(bodyPath, "utf8");
21566
21652
  } catch {
21567
21653
  return void 0;
21568
21654
  }
@@ -21751,11 +21837,11 @@ async function countPendingHandovers(orm, origin) {
21751
21837
 
21752
21838
  // src/commands/handover/migrateDiskHandovers.ts
21753
21839
  import {
21754
- existsSync as existsSync50,
21840
+ existsSync as existsSync52,
21755
21841
  readdirSync as readdirSync10,
21756
- readFileSync as readFileSync38,
21842
+ readFileSync as readFileSync39,
21757
21843
  rmSync as rmSync3,
21758
- statSync as statSync8
21844
+ statSync as statSync9
21759
21845
  } from "fs";
21760
21846
  import { basename as basename14, join as join54 } from "path";
21761
21847
 
@@ -21806,7 +21892,7 @@ function summariseHandoverContent(content) {
21806
21892
 
21807
21893
  // src/commands/handover/migrateDiskHandovers.ts
21808
21894
  function collectMarkdown(dir) {
21809
- if (!existsSync50(dir)) return [];
21895
+ if (!existsSync52(dir)) return [];
21810
21896
  const out = [];
21811
21897
  for (const entry of readdirSync10(dir, { withFileTypes: true })) {
21812
21898
  const full = join54(dir, entry.name);
@@ -21816,7 +21902,7 @@ function collectMarkdown(dir) {
21816
21902
  return out;
21817
21903
  }
21818
21904
  async function migrateFile(orm, origin, file, createdAt) {
21819
- const content = readFileSync38(file, "utf8");
21905
+ const content = readFileSync39(file, "utf8");
21820
21906
  await saveHandover(orm, {
21821
21907
  origin,
21822
21908
  summary: summariseHandoverContent(content),
@@ -21828,13 +21914,13 @@ async function migrateFile(orm, origin, file, createdAt) {
21828
21914
  async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
21829
21915
  let migrated = 0;
21830
21916
  for (const file of collectMarkdown(getHandoversDir(cwd))) {
21831
- const createdAt = parseArchiveTimestamp(basename14(file)) ?? statSync8(file).mtime;
21917
+ const createdAt = parseArchiveTimestamp(basename14(file)) ?? statSync9(file).mtime;
21832
21918
  await migrateFile(orm, origin, file, createdAt);
21833
21919
  migrated++;
21834
21920
  }
21835
21921
  const handoverPath = getHandoverPath(cwd);
21836
- if (existsSync50(handoverPath)) {
21837
- await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
21922
+ if (existsSync52(handoverPath)) {
21923
+ await migrateFile(orm, origin, handoverPath, statSync9(handoverPath).mtime);
21838
21924
  migrated++;
21839
21925
  }
21840
21926
  return migrated;
@@ -22181,16 +22267,16 @@ function recentDaemonLogLines() {
22181
22267
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
22182
22268
  import { realpathSync as realpathSync2 } from "fs";
22183
22269
  import { resolve as resolve14 } from "path";
22184
- function canonicalTreePath(path83) {
22270
+ function canonicalTreePath(path84) {
22185
22271
  try {
22186
- return realpathSync2(path83);
22272
+ return realpathSync2(path84);
22187
22273
  } catch {
22188
- return resolve14(path83);
22274
+ return resolve14(path84);
22189
22275
  }
22190
22276
  }
22191
22277
 
22192
22278
  // src/commands/sessions/daemon/worktree/createWorktree.ts
22193
- import { existsSync as existsSync51 } from "fs";
22279
+ import { existsSync as existsSync53 } from "fs";
22194
22280
  import { basename as basename16, dirname as dirname26 } from "path";
22195
22281
 
22196
22282
  // src/commands/sessions/daemon/worktree/planAllocation.ts
@@ -22237,23 +22323,23 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
22237
22323
  const base = strategy.root ? expandTilde2(strategy.root) : dirname26(clone);
22238
22324
  const registered = new Set(listWorktreePaths(clone));
22239
22325
  const branches = new Set(listLocalBranches(clone));
22240
- const isTaken = (candidate) => registered.has(candidate) || existsSync51(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
22241
- const path83 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
22326
+ const isTaken = (candidate) => registered.has(candidate) || existsSync53(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename16(candidate));
22327
+ const path84 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
22242
22328
  const start3 = worktreeStartPoint(clone, strategy.trunk);
22243
22329
  gitSync(clone, [
22244
22330
  "worktree",
22245
22331
  "add",
22246
22332
  start3.track ? "--track" : "--no-track",
22247
22333
  "-b",
22248
- basename16(path83),
22249
- path83,
22334
+ basename16(path84),
22335
+ path84,
22250
22336
  start3.ref
22251
22337
  ]);
22252
- recordWorktree(path83, clone, getCurrentOrigin(clone));
22338
+ recordWorktree(path84, clone, getCurrentOrigin(clone));
22253
22339
  daemonLog(
22254
- start3.track ? `worktree allocated ${path83} (branch ${basename16(path83)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path83} (branch ${basename16(path83)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
22340
+ start3.track ? `worktree allocated ${path84} (branch ${basename16(path84)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path84} (branch ${basename16(path84)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
22255
22341
  );
22256
- return path83;
22342
+ return path84;
22257
22343
  }
22258
22344
 
22259
22345
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -22263,7 +22349,7 @@ function keptInTree(cwd, reason4) {
22263
22349
  }
22264
22350
 
22265
22351
  // src/commands/sessions/daemon/worktree/treeDurability.ts
22266
- import { existsSync as existsSync52 } from "fs";
22352
+ import { existsSync as existsSync54 } from "fs";
22267
22353
  var treeIsGone = { durable: true, gone: true };
22268
22354
  function treeDurability(state) {
22269
22355
  if (state.dirty) return { durable: false, reason: "uncommitted changes" };
@@ -22294,14 +22380,14 @@ function* durabilityProbes() {
22294
22380
  });
22295
22381
  }
22296
22382
  async function checkDurability(cwd) {
22297
- if (!existsSync52(cwd)) return treeIsGone;
22383
+ if (!existsSync54(cwd)) return treeIsGone;
22298
22384
  const probes = durabilityProbes();
22299
22385
  let step2 = probes.next();
22300
22386
  while (!step2.done) step2 = probes.next(await gitResult(cwd, step2.value));
22301
22387
  return step2.value;
22302
22388
  }
22303
22389
  function checkDurabilitySync(cwd) {
22304
- if (!existsSync52(cwd)) return treeIsGone;
22390
+ if (!existsSync54(cwd)) return treeIsGone;
22305
22391
  const probes = durabilityProbes();
22306
22392
  let step2 = probes.next();
22307
22393
  while (!step2.done) step2 = probes.next(gitSyncResult(cwd, step2.value));
@@ -22394,13 +22480,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
22394
22480
  if (forcedSpill) daemonLog(forcedSpill);
22395
22481
  else if (reusesClone(clone, boundTreeRoots2, reuse))
22396
22482
  return { cwd: clone, kind: "primary", created: false, clone };
22397
- const path83 = createWorktree(
22483
+ const path84 = createWorktree(
22398
22484
  clone,
22399
22485
  { root: cfg.root, trunk: cfg.trunk },
22400
22486
  boundTreeRoots2,
22401
22487
  options2.replacesTree
22402
22488
  );
22403
- return { cwd: path83, kind: "worktree", created: true, clone };
22489
+ return { cwd: path84, kind: "worktree", created: true, clone };
22404
22490
  }
22405
22491
 
22406
22492
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -22544,20 +22630,20 @@ function persistedTreeRoots() {
22544
22630
  }
22545
22631
 
22546
22632
  // src/commands/sessions/daemon/worktree/seedWorktree.ts
22547
- import { copyFileSync, existsSync as existsSync54, mkdirSync as mkdirSync17 } from "fs";
22633
+ import { copyFileSync, existsSync as existsSync56, mkdirSync as mkdirSync17 } from "fs";
22548
22634
  import { dirname as dirname27, join as join57 } from "path";
22549
22635
 
22550
22636
  // src/commands/sessions/daemon/worktree/runInstall.ts
22551
22637
  import { spawn as spawn5 } from "child_process";
22552
22638
 
22553
22639
  // src/commands/sessions/daemon/worktree/resolveInstallCommand.ts
22554
- import { existsSync as existsSync53 } from "fs";
22640
+ import { existsSync as existsSync55 } from "fs";
22555
22641
  import { join as join56 } from "path";
22556
22642
  function detectInstallCommand(repoRoot2) {
22557
- if (!existsSync53(join56(repoRoot2, "package.json"))) return null;
22558
- if (existsSync53(join56(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
22559
- if (existsSync53(join56(repoRoot2, "yarn.lock"))) return "yarn install";
22560
- if (existsSync53(join56(repoRoot2, "bun.lockb"))) return "bun install";
22643
+ if (!existsSync55(join56(repoRoot2, "package.json"))) return null;
22644
+ if (existsSync55(join56(repoRoot2, "pnpm-lock.yaml"))) return "pnpm install";
22645
+ if (existsSync55(join56(repoRoot2, "yarn.lock"))) return "yarn install";
22646
+ if (existsSync55(join56(repoRoot2, "bun.lockb"))) return "bun install";
22561
22647
  return "npm install";
22562
22648
  }
22563
22649
  function resolveInstallCommand(repoRoot2, install) {
@@ -22670,7 +22756,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
22670
22756
  function copyConfigFiles(worktreePath, clone, copy) {
22671
22757
  for (const rel of copy) {
22672
22758
  const src = join57(clone, rel);
22673
- if (!existsSync54(src)) continue;
22759
+ if (!existsSync56(src)) continue;
22674
22760
  const dest = join57(worktreePath, rel);
22675
22761
  try {
22676
22762
  mkdirSync17(dirname27(dest), { recursive: true });
@@ -22731,13 +22817,13 @@ function worktreeHoldingBranch(cwd, branch2) {
22731
22817
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
22732
22818
  if (!listing) return null;
22733
22819
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
22734
- let path83 = null;
22820
+ let path84 = null;
22735
22821
  for (const line of listing.split("\n")) {
22736
22822
  const trimmed = line.trim();
22737
22823
  if (trimmed.startsWith("worktree "))
22738
- path83 = trimmed.slice("worktree ".length).trim();
22824
+ path84 = trimmed.slice("worktree ".length).trim();
22739
22825
  else if (trimmed === `branch refs/heads/${branch2}`)
22740
- return path83 && path83 !== here ? path83 : null;
22826
+ return path84 && path84 !== here ? path84 : null;
22741
22827
  }
22742
22828
  return null;
22743
22829
  }
@@ -22905,7 +22991,7 @@ import { resolve as resolve16 } from "path";
22905
22991
  import chalk171 from "chalk";
22906
22992
 
22907
22993
  // src/commands/mermaid/exportFile.ts
22908
- import { readFileSync as readFileSync39, writeFileSync as writeFileSync32 } from "fs";
22994
+ import { readFileSync as readFileSync40, writeFileSync as writeFileSync32 } from "fs";
22909
22995
  import { basename as basename17, extname as extname2, resolve as resolve15 } from "path";
22910
22996
  import chalk170 from "chalk";
22911
22997
 
@@ -22931,7 +23017,7 @@ async function renderBlock(krokiUrl, source) {
22931
23017
 
22932
23018
  // src/commands/mermaid/exportFile.ts
22933
23019
  async function exportFile(file, outDir, krokiUrl, onlyIndex) {
22934
- const content = readFileSync39(file, "utf8");
23020
+ const content = readFileSync40(file, "utf8");
22935
23021
  const blocks = extractMermaidBlocks(content);
22936
23022
  const stem = basename17(file, extname2(file));
22937
23023
  if (onlyIndex !== void 0) {
@@ -23143,14 +23229,14 @@ function applyIgnore(texts, ignore3) {
23143
23229
  }
23144
23230
 
23145
23231
  // src/commands/miro/readIgnoreList.ts
23146
- import { existsSync as existsSync55, readFileSync as readFileSync40 } from "fs";
23232
+ import { existsSync as existsSync57, readFileSync as readFileSync41 } from "fs";
23147
23233
  import { parse as parse2 } from "yaml";
23148
23234
  function readIgnoreList(file) {
23149
- if (!existsSync55(file))
23235
+ if (!existsSync57(file))
23150
23236
  throw new MiroExtractError(
23151
23237
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
23152
23238
  );
23153
- const parsed = parse2(readFileSync40(file, "utf8"));
23239
+ const parsed = parse2(readFileSync41(file, "utf8"));
23154
23240
  if (parsed === null || parsed === void 0) return [];
23155
23241
  if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
23156
23242
  throw new MiroExtractError(
@@ -23332,7 +23418,7 @@ async function pickAnchors(sessionId, items2) {
23332
23418
  }
23333
23419
 
23334
23420
  // src/commands/miro/readMiroItems.ts
23335
- import { readFileSync as readFileSync41 } from "fs";
23421
+ import { readFileSync as readFileSync42 } from "fs";
23336
23422
  function tryParse(text18) {
23337
23423
  try {
23338
23424
  return JSON.parse(text18);
@@ -23361,7 +23447,7 @@ function parsePages(raw, file) {
23361
23447
  return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
23362
23448
  }
23363
23449
  function readMiroItems(file) {
23364
- const items2 = parsePages(readFileSync41(file, "utf8"), file).flatMap(
23450
+ const items2 = parsePages(readFileSync42(file, "utf8"), file).flatMap(
23365
23451
  (page) => page.data ?? []
23366
23452
  );
23367
23453
  if (items2.length === 0)
@@ -23757,7 +23843,7 @@ import { join as join62 } from "path";
23757
23843
  import chalk176 from "chalk";
23758
23844
 
23759
23845
  // src/commands/netcap/extractPostsFromCapture.ts
23760
- import { readFileSync as readFileSync42 } from "fs";
23846
+ import { readFileSync as readFileSync43 } from "fs";
23761
23847
 
23762
23848
  // src/commands/netcap/parseRscRows.ts
23763
23849
  var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
@@ -23779,9 +23865,9 @@ function parseRscRows(flight) {
23779
23865
  }
23780
23866
  function makeRscResolver(rows) {
23781
23867
  return (ref) => {
23782
- const [id, ...path83] = ref.slice(1).replace(/^[L@]/, "").split(":");
23868
+ const [id, ...path84] = ref.slice(1).replace(/^[L@]/, "").split(":");
23783
23869
  let v = rows[id];
23784
- for (const key of path83) {
23870
+ for (const key of path84) {
23785
23871
  if (v == null || typeof v !== "object") return void 0;
23786
23872
  v = v[key];
23787
23873
  }
@@ -24153,7 +24239,7 @@ function extractVoyagerPosts(body) {
24153
24239
 
24154
24240
  // src/commands/netcap/extractPostsFromCapture.ts
24155
24241
  function captureEntries(captureFile) {
24156
- const lines2 = readFileSync42(captureFile, "utf8").split("\n").filter(Boolean);
24242
+ const lines2 = readFileSync43(captureFile, "utf8").split("\n").filter(Boolean);
24157
24243
  const entries = [];
24158
24244
  for (const line of lines2) {
24159
24245
  let entry;
@@ -24484,16 +24570,16 @@ function validateLine(line) {
24484
24570
  process.exit(1);
24485
24571
  }
24486
24572
  }
24487
- async function comment2(path83, line, body, startLine) {
24573
+ async function comment2(path84, line, body, startLine) {
24488
24574
  validateBody(body);
24489
24575
  validateLine(line);
24490
24576
  if (startLine !== void 0) validateLine(startLine);
24491
24577
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
24492
- await reviewProposedPrComment(`Comment on ${path83}:${range}`, body, null);
24578
+ await reviewProposedPrComment(`Comment on ${path84}:${range}`, body, null);
24493
24579
  try {
24494
24580
  const prId = getCurrentPrNodeId();
24495
- postReviewComment({ prId, body, path: path83, line, startLine });
24496
- console.log(`Added review comment on ${path83}:${range}`);
24581
+ postReviewComment({ prId, body, path: path84, line, startLine });
24582
+ console.log(`Added review comment on ${path84}:${range}`);
24497
24583
  } catch (error) {
24498
24584
  if (isGhNotInstalled(error)) {
24499
24585
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -24727,7 +24813,7 @@ import { tmpdir as tmpdir6 } from "os";
24727
24813
  import { join as join64 } from "path";
24728
24814
 
24729
24815
  // src/commands/prs/loadCommentsCache.ts
24730
- import { existsSync as existsSync56, readFileSync as readFileSync43, unlinkSync as unlinkSync13 } from "fs";
24816
+ import { existsSync as existsSync58, readFileSync as readFileSync44, unlinkSync as unlinkSync13 } from "fs";
24731
24817
  import { parse as parse3 } from "yaml";
24732
24818
 
24733
24819
  // src/commands/prs/commentsCachePath.ts
@@ -24747,15 +24833,15 @@ function commentsCachePath(org, repo, prNumber) {
24747
24833
  // src/commands/prs/loadCommentsCache.ts
24748
24834
  function loadCommentsCache(org, repo, prNumber) {
24749
24835
  const cachePath = commentsCachePath(org, repo, prNumber);
24750
- if (!existsSync56(cachePath)) {
24836
+ if (!existsSync58(cachePath)) {
24751
24837
  return null;
24752
24838
  }
24753
- const content = readFileSync43(cachePath, "utf8");
24839
+ const content = readFileSync44(cachePath, "utf8");
24754
24840
  return parse3(content);
24755
24841
  }
24756
24842
  function deleteCommentsCache(org, repo, prNumber) {
24757
24843
  const cachePath = commentsCachePath(org, repo, prNumber);
24758
- if (existsSync56(cachePath)) {
24844
+ if (existsSync58(cachePath)) {
24759
24845
  unlinkSync13(cachePath);
24760
24846
  console.log("No more unresolved line comments. Cache dropped.");
24761
24847
  }
@@ -25695,9 +25781,9 @@ function registerPrsComments(prsCommand) {
25695
25781
  });
25696
25782
  prsCommand.command("comment <path> <line> <body>").description(
25697
25783
  "Add a line comment to the pending review (body of - reads it from stdin)"
25698
- ).action(async (path83, line, body) => {
25784
+ ).action(async (path84, line, body) => {
25699
25785
  await comment2(
25700
- path83,
25786
+ path84,
25701
25787
  Number.parseInt(line, 10),
25702
25788
  await readBodyArgument(body)
25703
25789
  );
@@ -26161,10 +26247,10 @@ function resolveOpSecret(reference) {
26161
26247
  }
26162
26248
 
26163
26249
  // src/commands/ravendb/ravenFetch.ts
26164
- async function ravenFetch(connection, path83) {
26250
+ async function ravenFetch(connection, path84) {
26165
26251
  const apiKey = resolveOpSecret(connection.apiKeyRef);
26166
26252
  let accessToken = await getAccessToken(apiKey);
26167
- const url = `${connection.url}${path83}`;
26253
+ const url = `${connection.url}${path84}`;
26168
26254
  const headers = {
26169
26255
  Authorization: `Bearer ${accessToken}`,
26170
26256
  "Content-Type": "application/json"
@@ -26254,16 +26340,16 @@ import chalk191 from "chalk";
26254
26340
  // src/commands/ravendb/buildQueryPath.ts
26255
26341
  function buildQueryPath(opts) {
26256
26342
  const db = encodeURIComponent(opts.db);
26257
- let path83;
26343
+ let path84;
26258
26344
  if (opts.collection) {
26259
- path83 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
26345
+ path84 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
26260
26346
  } else {
26261
- path83 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
26347
+ path84 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
26262
26348
  }
26263
26349
  if (opts.query) {
26264
- path83 += `&query=${encodeURIComponent(opts.query)}`;
26350
+ path84 += `&query=${encodeURIComponent(opts.query)}`;
26265
26351
  }
26266
- return path83;
26352
+ return path84;
26267
26353
  }
26268
26354
 
26269
26355
  // src/commands/ravendb/fetchAllPages.ts
@@ -26272,7 +26358,7 @@ async function fetchAllPages(connection, opts) {
26272
26358
  let start3 = 0;
26273
26359
  while (true) {
26274
26360
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
26275
- const path83 = buildQueryPath({
26361
+ const path84 = buildQueryPath({
26276
26362
  db: connection.database,
26277
26363
  collection: opts.collection,
26278
26364
  start: start3,
@@ -26280,7 +26366,7 @@ async function fetchAllPages(connection, opts) {
26280
26366
  sort: opts.sort,
26281
26367
  query: opts.query
26282
26368
  });
26283
- const data = await ravenFetch(connection, path83);
26369
+ const data = await ravenFetch(connection, path84);
26284
26370
  const results = data.Results ?? [];
26285
26371
  const totalResults = data.TotalResults ?? 0;
26286
26372
  if (results.length === 0) break;
@@ -26338,7 +26424,7 @@ function registerRavendb(program2) {
26338
26424
 
26339
26425
  // src/commands/refactor/check/index.ts
26340
26426
  import { spawn as spawn6 } from "child_process";
26341
- import * as path42 from "path";
26427
+ import * as path45 from "path";
26342
26428
 
26343
26429
  // src/commands/refactor/logViolations.ts
26344
26430
  import chalk193 from "chalk";
@@ -26515,7 +26601,7 @@ ${failed2.length} verify script(s) failed:`);
26515
26601
  async function runVerifyQuietly() {
26516
26602
  const result = findPackageJsonWithVerifyScripts(process.cwd());
26517
26603
  if (!result) return true;
26518
- const packageDir = path42.dirname(result.packageJsonPath);
26604
+ const packageDir = path45.dirname(result.packageJsonPath);
26519
26605
  const results = await Promise.all(
26520
26606
  result.verifyScripts.map((script) => runScript(script, packageDir))
26521
26607
  );
@@ -26541,7 +26627,7 @@ async function check(pattern2, options2) {
26541
26627
  }
26542
26628
 
26543
26629
  // src/commands/refactor/extract/index.ts
26544
- import path50 from "path";
26630
+ import path53 from "path";
26545
26631
  import chalk196 from "chalk";
26546
26632
 
26547
26633
  // src/commands/refactor/extract/applyExtraction.ts
@@ -27018,9 +27104,9 @@ function buildDestinationContent(functionTexts, imports, sourceRelativePath, sou
27018
27104
  }
27019
27105
 
27020
27106
  // src/commands/refactor/extract/getRelativeImportPath.ts
27021
- import path43 from "path";
27107
+ import path46 from "path";
27022
27108
  function getRelativeImportPath(from, to) {
27023
- let rel = path43.relative(path43.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
27109
+ let rel = path46.relative(path46.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
27024
27110
  if (!rel.startsWith(".")) rel = `./${rel}`;
27025
27111
  return rel;
27026
27112
  }
@@ -27044,9 +27130,9 @@ function findImporters(functionName, sourceFile, destPath, project) {
27044
27130
  }
27045
27131
 
27046
27132
  // src/commands/refactor/extract/resolveBarrel.ts
27047
- import path44 from "path";
27133
+ import path47 from "path";
27048
27134
  function resolveBarrel(functionName, sourcePath, destPath, project) {
27049
- const indexPath = path44.join(path44.dirname(destPath), "index.ts");
27135
+ const indexPath = path47.join(path47.dirname(destPath), "index.ts");
27050
27136
  const barrel = project.getSourceFile(indexPath);
27051
27137
  if (!barrel) return { barrel: void 0, barrelRelPath: "" };
27052
27138
  const sourceRelFromBarrel = getRelativeImportPath(indexPath, sourcePath);
@@ -27064,15 +27150,15 @@ function resolveBarrel(functionName, sourcePath, destPath, project) {
27064
27150
  }
27065
27151
 
27066
27152
  // src/commands/refactor/extract/rewriteImportPaths.ts
27067
- import path45 from "path";
27153
+ import path48 from "path";
27068
27154
  function rewriteImportPaths(imports, sourcePath, destPath) {
27069
- const sourceDir = path45.dirname(sourcePath);
27070
- const destDir = path45.dirname(destPath);
27155
+ const sourceDir = path48.dirname(sourcePath);
27156
+ const destDir = path48.dirname(destPath);
27071
27157
  return imports.map((imp) => {
27072
27158
  if (!imp.moduleSpecifier.startsWith(".")) return imp;
27073
- const absolute2 = path45.resolve(sourceDir, imp.moduleSpecifier);
27074
- let rel = path45.relative(destDir, absolute2).replace(/\\/g, "/");
27075
- if (rel === "") rel = `../${path45.basename(absolute2)}`;
27159
+ const absolute2 = path48.resolve(sourceDir, imp.moduleSpecifier);
27160
+ let rel = path48.relative(destDir, absolute2).replace(/\\/g, "/");
27161
+ if (rel === "") rel = `../${path48.basename(absolute2)}`;
27076
27162
  else if (!rel.startsWith(".")) rel = `./${rel}`;
27077
27163
  return { ...imp, moduleSpecifier: rel };
27078
27164
  });
@@ -27140,7 +27226,7 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
27140
27226
  }
27141
27227
 
27142
27228
  // src/commands/refactor/extract/displayPlan.ts
27143
- import path46 from "path";
27229
+ import path49 from "path";
27144
27230
  import chalk194 from "chalk";
27145
27231
  function section2(title) {
27146
27232
  return `
@@ -27150,7 +27236,7 @@ function displayImporters(plan2, cwd) {
27150
27236
  if (plan2.importersToUpdate.length === 0) return;
27151
27237
  console.log(section2("Update importers:"));
27152
27238
  for (const imp of plan2.importersToUpdate) {
27153
- const rel = path46.relative(cwd, imp.file.getFilePath());
27239
+ const rel = path49.relative(cwd, imp.file.getFilePath());
27154
27240
  console.log(` ${chalk194.dim(rel)}: \u2192 import from "${imp.relPath}"`);
27155
27241
  }
27156
27242
  }
@@ -27190,17 +27276,17 @@ function displayPlan(functionName, relDest, plan2, cwd) {
27190
27276
  }
27191
27277
 
27192
27278
  // src/commands/refactor/extract/loadProjectFile.ts
27193
- import path49 from "path";
27279
+ import path52 from "path";
27194
27280
  import chalk195 from "chalk";
27195
27281
  import { Project as Project4 } from "ts-morph";
27196
27282
 
27197
27283
  // src/commands/refactor/extract/findTsConfig.ts
27198
27284
  import fs32 from "fs";
27199
- import path48 from "path";
27285
+ import path51 from "path";
27200
27286
 
27201
27287
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
27202
27288
  import fs31 from "fs";
27203
- import path47 from "path";
27289
+ import path50 from "path";
27204
27290
 
27205
27291
  // src/commands/refactor/extract/projectIncludesFile.ts
27206
27292
  import { Project as Project3 } from "ts-morph";
@@ -27215,16 +27301,16 @@ function projectIncludesFile(configPath, sourcePath) {
27215
27301
 
27216
27302
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
27217
27303
  function findEnclosingTsConfig(sourcePath, rootDir, tried) {
27218
- let dir = path47.dirname(sourcePath);
27219
- while (dir.startsWith(rootDir + path47.sep) && dir !== rootDir) {
27220
- const nested = path47.join(dir, "tsconfig.json");
27304
+ let dir = path50.dirname(sourcePath);
27305
+ while (dir.startsWith(rootDir + path50.sep) && dir !== rootDir) {
27306
+ const nested = path50.join(dir, "tsconfig.json");
27221
27307
  if (!tried.has(nested)) {
27222
27308
  tried.add(nested);
27223
27309
  if (fs31.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
27224
27310
  return nested;
27225
27311
  }
27226
27312
  }
27227
- const parent = path47.dirname(dir);
27313
+ const parent = path50.dirname(dir);
27228
27314
  if (parent === dir) break;
27229
27315
  dir = parent;
27230
27316
  }
@@ -27233,7 +27319,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
27233
27319
 
27234
27320
  // src/commands/refactor/extract/findTsConfig.ts
27235
27321
  function findTsConfig(sourcePath) {
27236
- const rootConfig = path48.resolve("tsconfig.json");
27322
+ const rootConfig = path51.resolve("tsconfig.json");
27237
27323
  if (!fs32.existsSync(rootConfig)) return rootConfig;
27238
27324
  const tried = /* @__PURE__ */ new Set();
27239
27325
  const candidates = [rootConfig, ...readReferences(rootConfig)];
@@ -27242,7 +27328,7 @@ function findTsConfig(sourcePath) {
27242
27328
  tried.add(candidate);
27243
27329
  if (projectIncludesFile(candidate, sourcePath)) return candidate;
27244
27330
  }
27245
- const siblings = fs32.readdirSync(path48.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path48.resolve(path48.dirname(rootConfig), f));
27331
+ const siblings = fs32.readdirSync(path51.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path51.resolve(path51.dirname(rootConfig), f));
27246
27332
  for (const sibling of siblings) {
27247
27333
  if (tried.has(sibling)) continue;
27248
27334
  tried.add(sibling);
@@ -27250,7 +27336,7 @@ function findTsConfig(sourcePath) {
27250
27336
  }
27251
27337
  const nested = findEnclosingTsConfig(
27252
27338
  sourcePath,
27253
- path48.dirname(rootConfig),
27339
+ path51.dirname(rootConfig),
27254
27340
  tried
27255
27341
  );
27256
27342
  if (nested) return nested;
@@ -27267,16 +27353,16 @@ function readReferences(configPath) {
27267
27353
  return [];
27268
27354
  }
27269
27355
  if (!parsed.references?.length) return [];
27270
- const cwd = path48.dirname(configPath);
27356
+ const cwd = path51.dirname(configPath);
27271
27357
  return parsed.references.map((ref) => {
27272
- const refPath = path48.resolve(cwd, ref.path);
27273
- return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path48.join(refPath, "tsconfig.json") : refPath;
27358
+ const refPath = path51.resolve(cwd, ref.path);
27359
+ return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path51.join(refPath, "tsconfig.json") : refPath;
27274
27360
  }).filter((p) => fs32.existsSync(p));
27275
27361
  }
27276
27362
 
27277
27363
  // src/commands/refactor/extract/loadProjectFile.ts
27278
27364
  function loadProjectFile(file) {
27279
- const sourcePath = path49.resolve(file);
27365
+ const sourcePath = path52.resolve(file);
27280
27366
  const tsConfigPath = findTsConfig(sourcePath);
27281
27367
  const project = new Project4({
27282
27368
  tsConfigFilePath: tsConfigPath
@@ -27291,10 +27377,10 @@ function loadProjectFile(file) {
27291
27377
 
27292
27378
  // src/commands/refactor/extract/index.ts
27293
27379
  async function extract(file, functionName, destination, options2 = {}) {
27294
- const sourcePath = path50.resolve(file);
27295
- const destPath = path50.resolve(destination);
27380
+ const sourcePath = path53.resolve(file);
27381
+ const destPath = path53.resolve(destination);
27296
27382
  const cwd = process.cwd();
27297
- const relDest = path50.relative(cwd, destPath);
27383
+ const relDest = path53.relative(cwd, destPath);
27298
27384
  const { project, sourceFile } = loadProjectFile(file);
27299
27385
  const plan2 = buildPlan2(
27300
27386
  functionName,
@@ -27342,16 +27428,16 @@ function ignore2(file) {
27342
27428
 
27343
27429
  // src/commands/refactor/rename/index.ts
27344
27430
  import fs36 from "fs";
27345
- import path55 from "path";
27431
+ import path58 from "path";
27346
27432
  import chalk200 from "chalk";
27347
27433
 
27348
27434
  // src/commands/refactor/rename/applyRename.ts
27349
27435
  import fs35 from "fs";
27350
- import path52 from "path";
27436
+ import path55 from "path";
27351
27437
  import chalk198 from "chalk";
27352
27438
 
27353
27439
  // src/commands/refactor/restructure/computeRewrites/index.ts
27354
- import path51 from "path";
27440
+ import path54 from "path";
27355
27441
 
27356
27442
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
27357
27443
  import fs34 from "fs";
@@ -27405,7 +27491,7 @@ function normalizeSpecifier(rel) {
27405
27491
  );
27406
27492
  }
27407
27493
  function computeSpecifier(fromFile, toFile) {
27408
- return normalizeSpecifier(path51.relative(path51.dirname(fromFile), toFile));
27494
+ return normalizeSpecifier(path54.relative(path54.dirname(fromFile), toFile));
27409
27495
  }
27410
27496
  function isAffected(edge, moveMap) {
27411
27497
  return moveMap.has(edge.target) || moveMap.has(edge.source);
@@ -27453,20 +27539,20 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
27453
27539
  const updatedContents = applyRewrites(rewrites);
27454
27540
  for (const [file, content] of updatedContents) {
27455
27541
  fs35.writeFileSync(file, content, "utf8");
27456
- console.log(chalk198.cyan(` Updated imports in ${path52.relative(cwd, file)}`));
27542
+ console.log(chalk198.cyan(` Updated imports in ${path55.relative(cwd, file)}`));
27457
27543
  }
27458
- const destDir = path52.dirname(destPath);
27544
+ const destDir = path55.dirname(destPath);
27459
27545
  if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
27460
27546
  fs35.renameSync(sourcePath, destPath);
27461
27547
  console.log(
27462
27548
  chalk198.white(
27463
- ` Moved ${path52.relative(cwd, sourcePath)} \u2192 ${path52.relative(cwd, destPath)}`
27549
+ ` Moved ${path55.relative(cwd, sourcePath)} \u2192 ${path55.relative(cwd, destPath)}`
27464
27550
  )
27465
27551
  );
27466
27552
  }
27467
27553
 
27468
27554
  // src/commands/refactor/restructure/buildImportGraph/index.ts
27469
- import path53 from "path";
27555
+ import path56 from "path";
27470
27556
  import ts7 from "typescript";
27471
27557
 
27472
27558
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
@@ -27493,7 +27579,7 @@ function loadParsedConfig(tsConfigPath) {
27493
27579
  return ts7.parseJsonConfigFileContent(
27494
27580
  configFile.config,
27495
27581
  ts7.sys,
27496
- path53.dirname(tsConfigPath)
27582
+ path56.dirname(tsConfigPath)
27497
27583
  );
27498
27584
  }
27499
27585
  function addToSetMap(map, key, value) {
@@ -27509,7 +27595,7 @@ function resolveImport(specifier, filePath, options2) {
27509
27595
  const resolved = ts7.resolveModuleName(specifier, filePath, options2, ts7.sys);
27510
27596
  const resolvedPath = resolved.resolvedModule?.resolvedFileName;
27511
27597
  if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
27512
- return path53.resolve(resolvedPath);
27598
+ return path56.resolve(resolvedPath);
27513
27599
  }
27514
27600
  function buildImportGraph(candidateFiles, tsConfigPath) {
27515
27601
  const parsed = loadParsedConfig(tsConfigPath);
@@ -27518,7 +27604,7 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
27518
27604
  const importedBy = /* @__PURE__ */ new Map();
27519
27605
  const imports = /* @__PURE__ */ new Map();
27520
27606
  for (const sourceFile of program2.getSourceFiles()) {
27521
- const filePath = path53.resolve(sourceFile.fileName);
27607
+ const filePath = path56.resolve(sourceFile.fileName);
27522
27608
  if (filePath.includes("node_modules")) continue;
27523
27609
  for (const specifier of getImportSpecifiers(sourceFile)) {
27524
27610
  const absTarget = resolveImport(specifier, filePath, parsed.options);
@@ -27545,13 +27631,13 @@ function computeRenameRewrites(sourcePath, destPath) {
27545
27631
  }
27546
27632
 
27547
27633
  // src/commands/refactor/rename/printRenamePreview.ts
27548
- import path54 from "path";
27634
+ import path57 from "path";
27549
27635
  import chalk199 from "chalk";
27550
27636
  function printRenamePreview(rewrites, cwd) {
27551
27637
  for (const rewrite of rewrites) {
27552
27638
  console.log(
27553
27639
  chalk199.dim(
27554
- ` ${path54.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
27640
+ ` ${path57.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
27555
27641
  )
27556
27642
  );
27557
27643
  }
@@ -27560,11 +27646,11 @@ function printRenamePreview(rewrites, cwd) {
27560
27646
 
27561
27647
  // src/commands/refactor/rename/index.ts
27562
27648
  async function rename(source, destination, options2 = {}) {
27563
- const sourcePath = path55.resolve(source);
27564
- const destPath = path55.resolve(destination);
27649
+ const sourcePath = path58.resolve(source);
27650
+ const destPath = path58.resolve(destination);
27565
27651
  const cwd = process.cwd();
27566
- const relSource = path55.relative(cwd, sourcePath);
27567
- const relDest = path55.relative(cwd, destPath);
27652
+ const relSource = path58.relative(cwd, sourcePath);
27653
+ const relDest = path58.relative(cwd, destPath);
27568
27654
  if (!fs36.existsSync(sourcePath)) {
27569
27655
  console.log(chalk200.red(`File not found: ${source}`));
27570
27656
  process.exit(1);
@@ -27619,12 +27705,12 @@ function findSymbol(sourceFile, symbolName) {
27619
27705
  }
27620
27706
 
27621
27707
  // src/commands/refactor/renameSymbol/groupReferences.ts
27622
- import path56 from "path";
27708
+ import path59 from "path";
27623
27709
  function groupReferences(symbol, cwd) {
27624
27710
  const refs = symbol.findReferencesAsNodes();
27625
27711
  const grouped = /* @__PURE__ */ new Map();
27626
27712
  for (const ref of refs) {
27627
- const refFile = path56.relative(cwd, ref.getSourceFile().getFilePath());
27713
+ const refFile = path59.relative(cwd, ref.getSourceFile().getFilePath());
27628
27714
  const lines2 = grouped.get(refFile) ?? [];
27629
27715
  if (!grouped.has(refFile)) grouped.set(refFile, lines2);
27630
27716
  lines2.push(ref.getStartLineNumber());
@@ -27663,16 +27749,16 @@ Renamed ${oldName} \u2192 ${newName}`));
27663
27749
  }
27664
27750
 
27665
27751
  // src/commands/refactor/restructure/index.ts
27666
- import path63 from "path";
27752
+ import path66 from "path";
27667
27753
  import chalk204 from "chalk";
27668
27754
 
27669
27755
  // src/commands/refactor/restructure/clusterDirectories.ts
27670
- import path57 from "path";
27756
+ import path60 from "path";
27671
27757
  function clusterDirectories(graph) {
27672
27758
  const dirImportedBy = /* @__PURE__ */ new Map();
27673
27759
  for (const edge of graph.edges) {
27674
- const sourceDir = path57.dirname(edge.source);
27675
- const targetDir = path57.dirname(edge.target);
27760
+ const sourceDir = path60.dirname(edge.source);
27761
+ const targetDir = path60.dirname(edge.target);
27676
27762
  if (sourceDir === targetDir) continue;
27677
27763
  if (!graph.files.has(edge.target)) continue;
27678
27764
  const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
@@ -27700,20 +27786,20 @@ function clusterDirectories(graph) {
27700
27786
  return clusters;
27701
27787
  }
27702
27788
  function isAncestor(ancestor, descendant) {
27703
- const rel = path57.relative(ancestor, descendant);
27789
+ const rel = path60.relative(ancestor, descendant);
27704
27790
  return !rel.startsWith("..") && rel !== "";
27705
27791
  }
27706
27792
 
27707
27793
  // src/commands/refactor/restructure/clusterFiles.ts
27708
- import path58 from "path";
27794
+ import path61 from "path";
27709
27795
  function findRootParent(file, importedBy, visited) {
27710
27796
  const importers = importedBy.get(file);
27711
27797
  if (!importers || importers.size !== 1) return file;
27712
27798
  const parent = [...importers][0];
27713
- const parentDir = path58.dirname(parent);
27714
- const fileDir = path58.dirname(file);
27799
+ const parentDir = path61.dirname(parent);
27800
+ const fileDir = path61.dirname(file);
27715
27801
  if (parentDir !== fileDir) return file;
27716
- if (path58.basename(parent, path58.extname(parent)) === "index") return file;
27802
+ if (path61.basename(parent, path61.extname(parent)) === "index") return file;
27717
27803
  if (visited.has(parent)) return file;
27718
27804
  visited.add(parent);
27719
27805
  return findRootParent(parent, importedBy, visited);
@@ -27721,16 +27807,16 @@ function findRootParent(file, importedBy, visited) {
27721
27807
  function clusterFiles(graph) {
27722
27808
  const clusters = /* @__PURE__ */ new Map();
27723
27809
  for (const file of graph.files) {
27724
- const basename26 = path58.basename(file, path58.extname(file));
27810
+ const basename26 = path61.basename(file, path61.extname(file));
27725
27811
  if (basename26 === "index") continue;
27726
27812
  const importers = graph.importedBy.get(file);
27727
27813
  if (!importers || importers.size !== 1) continue;
27728
27814
  const parent = [...importers][0];
27729
27815
  if (!graph.files.has(parent)) continue;
27730
- const parentDir = path58.dirname(parent);
27731
- const fileDir = path58.dirname(file);
27816
+ const parentDir = path61.dirname(parent);
27817
+ const fileDir = path61.dirname(file);
27732
27818
  if (parentDir !== fileDir) continue;
27733
- const parentBasename = path58.basename(parent, path58.extname(parent));
27819
+ const parentBasename = path61.basename(parent, path61.extname(parent));
27734
27820
  if (parentBasename === "index") continue;
27735
27821
  const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
27736
27822
  if (!root || root === file) continue;
@@ -27742,10 +27828,10 @@ function clusterFiles(graph) {
27742
27828
  }
27743
27829
 
27744
27830
  // src/commands/refactor/restructure/displayPlan.ts
27745
- import path59 from "path";
27831
+ import path62 from "path";
27746
27832
  import chalk202 from "chalk";
27747
27833
  function relPath(filePath) {
27748
- return path59.relative(process.cwd(), filePath);
27834
+ return path62.relative(process.cwd(), filePath);
27749
27835
  }
27750
27836
  function displayMoves(plan2) {
27751
27837
  if (plan2.moves.length === 0) return;
@@ -27795,33 +27881,33 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
27795
27881
 
27796
27882
  // src/commands/refactor/restructure/executePlan.ts
27797
27883
  import fs37 from "fs";
27798
- import path60 from "path";
27884
+ import path63 from "path";
27799
27885
  import chalk203 from "chalk";
27800
27886
  function executePlan(plan2) {
27801
27887
  const updatedContents = applyRewrites(plan2.rewrites);
27802
27888
  for (const [file, content] of updatedContents) {
27803
27889
  fs37.writeFileSync(file, content, "utf8");
27804
27890
  console.log(
27805
- chalk203.cyan(` Rewrote imports in ${path60.relative(process.cwd(), file)}`)
27891
+ chalk203.cyan(` Rewrote imports in ${path63.relative(process.cwd(), file)}`)
27806
27892
  );
27807
27893
  }
27808
27894
  for (const dir of plan2.newDirectories) {
27809
27895
  fs37.mkdirSync(dir, { recursive: true });
27810
- console.log(chalk203.green(` Created ${path60.relative(process.cwd(), dir)}/`));
27896
+ console.log(chalk203.green(` Created ${path63.relative(process.cwd(), dir)}/`));
27811
27897
  }
27812
27898
  for (const move2 of plan2.moves) {
27813
- const targetDir = path60.dirname(move2.to);
27899
+ const targetDir = path63.dirname(move2.to);
27814
27900
  if (!fs37.existsSync(targetDir)) {
27815
27901
  fs37.mkdirSync(targetDir, { recursive: true });
27816
27902
  }
27817
27903
  fs37.renameSync(move2.from, move2.to);
27818
27904
  console.log(
27819
27905
  chalk203.white(
27820
- ` Moved ${path60.relative(process.cwd(), move2.from)} \u2192 ${path60.relative(process.cwd(), move2.to)}`
27906
+ ` Moved ${path63.relative(process.cwd(), move2.from)} \u2192 ${path63.relative(process.cwd(), move2.to)}`
27821
27907
  )
27822
27908
  );
27823
27909
  }
27824
- removeEmptyDirectories(plan2.moves.map((m) => path60.dirname(m.from)));
27910
+ removeEmptyDirectories(plan2.moves.map((m) => path63.dirname(m.from)));
27825
27911
  }
27826
27912
  function removeEmptyDirectories(dirs) {
27827
27913
  const unique = [...new Set(dirs)];
@@ -27832,7 +27918,7 @@ function removeEmptyDirectories(dirs) {
27832
27918
  fs37.rmdirSync(dir);
27833
27919
  console.log(
27834
27920
  chalk203.dim(
27835
- ` Removed empty directory ${path60.relative(process.cwd(), dir)}`
27921
+ ` Removed empty directory ${path63.relative(process.cwd(), dir)}`
27836
27922
  )
27837
27923
  );
27838
27924
  }
@@ -27840,7 +27926,7 @@ function removeEmptyDirectories(dirs) {
27840
27926
  }
27841
27927
 
27842
27928
  // src/commands/refactor/restructure/planFileMoves/index.ts
27843
- import path62 from "path";
27929
+ import path65 from "path";
27844
27930
 
27845
27931
  // src/commands/refactor/restructure/planFileMoves/shared.ts
27846
27932
  import fs38 from "fs";
@@ -27855,9 +27941,9 @@ function checkDirConflict(result, label2, dir) {
27855
27941
 
27856
27942
  // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
27857
27943
  import fs39 from "fs";
27858
- import path61 from "path";
27944
+ import path64 from "path";
27859
27945
  function collectEntry2(results, dir, entry) {
27860
- const full = path61.join(dir, entry.name);
27946
+ const full = path64.join(dir, entry.name);
27861
27947
  const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
27862
27948
  results.push(...items2);
27863
27949
  }
@@ -27871,15 +27957,15 @@ function listFilesRecursive(dir) {
27871
27957
  }
27872
27958
  function addDirectoryFileMoves(moves, childDir, newLocation, reason4) {
27873
27959
  for (const file of listFilesRecursive(childDir)) {
27874
- const rel = path61.relative(childDir, file);
27875
- moves.push({ from: file, to: path61.join(newLocation, rel), reason: reason4 });
27960
+ const rel = path64.relative(childDir, file);
27961
+ moves.push({ from: file, to: path64.join(newLocation, rel), reason: reason4 });
27876
27962
  }
27877
27963
  }
27878
27964
  function resolveChildDest(parentDir, childDir) {
27879
- return path61.join(parentDir, path61.basename(childDir));
27965
+ return path64.join(parentDir, path64.basename(childDir));
27880
27966
  }
27881
27967
  function childMoveReason(parentDir) {
27882
- return `Directory only imported from ${path61.basename(parentDir)}/`;
27968
+ return `Directory only imported from ${path64.basename(parentDir)}/`;
27883
27969
  }
27884
27970
  function registerDirectoryMove(result, childDir, dest, parentDir) {
27885
27971
  result.directories.push(dest);
@@ -27904,7 +27990,7 @@ function planDirectoryMoves(clusters) {
27904
27990
 
27905
27991
  // src/commands/refactor/restructure/planFileMoves/index.ts
27906
27992
  function childMoveData(child, newDir, parentBase) {
27907
- const to = path62.join(newDir, path62.basename(child));
27993
+ const to = path65.join(newDir, path65.basename(child));
27908
27994
  return { from: child, to, reason: `Only imported by ${parentBase}` };
27909
27995
  }
27910
27996
  function addChildMoves(moves, children, newDir, parentBase) {
@@ -27912,15 +27998,15 @@ function addChildMoves(moves, children, newDir, parentBase) {
27912
27998
  moves.push(childMoveData(child, newDir, parentBase));
27913
27999
  }
27914
28000
  function getBaseName(filePath) {
27915
- return path62.basename(filePath, path62.extname(filePath));
28001
+ return path65.basename(filePath, path65.extname(filePath));
27916
28002
  }
27917
28003
  function resolveClusterDir(parent) {
27918
- return path62.join(path62.dirname(parent), getBaseName(parent));
28004
+ return path65.join(path65.dirname(parent), getBaseName(parent));
27919
28005
  }
27920
28006
  function createParentMove(parent, newDir) {
27921
28007
  return {
27922
28008
  from: parent,
27923
- to: path62.join(newDir, `index${path62.extname(parent)}`),
28009
+ to: path65.join(newDir, `index${path65.extname(parent)}`),
27924
28010
  reason: `Main module of new ${getBaseName(parent)}/ directory`
27925
28011
  };
27926
28012
  }
@@ -27944,7 +28030,7 @@ function planFileMoves(clusters) {
27944
28030
 
27945
28031
  // src/commands/refactor/restructure/index.ts
27946
28032
  function buildPlan3(candidateFiles, tsConfigPath) {
27947
- const candidates = new Set(candidateFiles.map((f) => path63.resolve(f)));
28033
+ const candidates = new Set(candidateFiles.map((f) => path66.resolve(f)));
27948
28034
  const graph = buildImportGraph(candidates, tsConfigPath);
27949
28035
  const allProjectFiles = /* @__PURE__ */ new Set([
27950
28036
  ...graph.importedBy.keys(),
@@ -27967,7 +28053,7 @@ async function restructure(pattern2, options2 = {}) {
27967
28053
  console.log(chalk204.yellow("No files found matching pattern"));
27968
28054
  return;
27969
28055
  }
27970
- const tsConfigPath = findTsConfig(path63.resolve(files[0]));
28056
+ const tsConfigPath = findTsConfig(path66.resolve(files[0]));
27971
28057
  const plan2 = buildPlan3(files, tsConfigPath);
27972
28058
  if (plan2.moves.length === 0) {
27973
28059
  console.log(chalk204.green("No restructuring needed"));
@@ -28302,7 +28388,7 @@ function gatherContext() {
28302
28388
  }
28303
28389
 
28304
28390
  // src/commands/review/postReviewToPr.ts
28305
- import { readFileSync as readFileSync44 } from "fs";
28391
+ import { readFileSync as readFileSync45 } from "fs";
28306
28392
 
28307
28393
  // src/commands/review/carriedUnanchoredFindings.ts
28308
28394
  function carriedUnanchoredFindings(unanchored) {
@@ -28750,7 +28836,7 @@ async function confirmPost(prNumber, work, options2) {
28750
28836
  return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
28751
28837
  }
28752
28838
  async function postFindingsToPr(prInfo, synthesisPath, options2) {
28753
- const markdown = readFileSync44(synthesisPath, "utf8");
28839
+ const markdown = readFileSync45(synthesisPath, "utf8");
28754
28840
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
28755
28841
  const carried = carriedUnanchoredFindings(unanchored);
28756
28842
  if (inDiff.length === 0 && carried.length === 0) return NOTHING_POSTED;
@@ -28886,10 +28972,10 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
28886
28972
  }
28887
28973
 
28888
28974
  // src/commands/review/prepareReviewDir.ts
28889
- import { existsSync as existsSync57, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
28975
+ import { existsSync as existsSync59, mkdirSync as mkdirSync21, unlinkSync as unlinkSync17, writeFileSync as writeFileSync38 } from "fs";
28890
28976
  function clearReviewFiles(paths) {
28891
- for (const path83 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
28892
- if (existsSync57(path83)) unlinkSync17(path83);
28977
+ for (const path84 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
28978
+ if (existsSync59(path84)) unlinkSync17(path84);
28893
28979
  }
28894
28980
  }
28895
28981
  function prepareReviewDir(paths, requestBody, force) {
@@ -28899,11 +28985,11 @@ function prepareReviewDir(paths, requestBody, force) {
28899
28985
  }
28900
28986
 
28901
28987
  // src/commands/review/cachedReviewerResult.ts
28902
- import { statSync as statSync9 } from "fs";
28988
+ import { statSync as statSync10 } from "fs";
28903
28989
  function cachedReviewerResult(name, outputPath) {
28904
28990
  let size;
28905
28991
  try {
28906
- size = statSync9(outputPath).size;
28992
+ size = statSync10(outputPath).size;
28907
28993
  } catch {
28908
28994
  return null;
28909
28995
  }
@@ -29116,7 +29202,7 @@ function printReviewerFailures(results) {
29116
29202
  }
29117
29203
 
29118
29204
  // src/commands/review/runAndSynthesise.ts
29119
- import { existsSync as existsSync59, unlinkSync as unlinkSync19 } from "fs";
29205
+ import { existsSync as existsSync61, unlinkSync as unlinkSync19 } from "fs";
29120
29206
 
29121
29207
  // src/commands/review/buildReviewerStdin.ts
29122
29208
  var REVIEW_PROMPT = `You are acting as a reviewer for a proposed code change made by another engineer. The full review request \u2014 branch, base, changed files, and unified diff \u2014 is in the request file whose absolute path is given below.
@@ -29545,7 +29631,7 @@ function resolveClaude(args) {
29545
29631
  }
29546
29632
 
29547
29633
  // src/commands/review/runCodexReviewer.ts
29548
- import { existsSync as existsSync58, unlinkSync as unlinkSync18 } from "fs";
29634
+ import { existsSync as existsSync60, unlinkSync as unlinkSync18 } from "fs";
29549
29635
 
29550
29636
  // src/commands/review/parseCodexEvent.ts
29551
29637
  function isItemStarted(value) {
@@ -29597,7 +29683,7 @@ async function runCodexReviewer(spec) {
29597
29683
  reportReviewerToolUse(spec.name, event, spinner);
29598
29684
  }
29599
29685
  });
29600
- if (result.exitCode !== 0 && existsSync58(spec.outputPath)) {
29686
+ if (result.exitCode !== 0 && existsSync60(spec.outputPath)) {
29601
29687
  unlinkSync18(spec.outputPath);
29602
29688
  }
29603
29689
  return finaliseReviewerRun({ ...spec, command }, spinner, result);
@@ -29639,7 +29725,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
29639
29725
  }
29640
29726
 
29641
29727
  // src/commands/review/synthesise.ts
29642
- import { readFileSync as readFileSync45 } from "fs";
29728
+ import { readFileSync as readFileSync46 } from "fs";
29643
29729
 
29644
29730
  // src/commands/review/buildSynthesisStdin.ts
29645
29731
  var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
@@ -29704,7 +29790,7 @@ Files:
29704
29790
 
29705
29791
  // src/commands/review/synthesise.ts
29706
29792
  function printSummary2(synthesisPath) {
29707
- const markdown = readFileSync45(synthesisPath, "utf8");
29793
+ const markdown = readFileSync46(synthesisPath, "utf8");
29708
29794
  console.log("");
29709
29795
  console.log(buildReviewSummary(markdown));
29710
29796
  console.log("");
@@ -29752,7 +29838,7 @@ async function runAndSynthesise(args) {
29752
29838
  console.error("Both reviewers failed; skipping synthesis.");
29753
29839
  return { ok: false, failures };
29754
29840
  }
29755
- if (anyFresh && existsSync59(paths.synthesisPath)) {
29841
+ if (anyFresh && existsSync61(paths.synthesisPath)) {
29756
29842
  unlinkSync19(paths.synthesisPath);
29757
29843
  }
29758
29844
  const synthesisResult = await synthesise(paths, { multi });
@@ -29938,71 +30024,13 @@ function registerReview(program2) {
29938
30024
  }
29939
30025
 
29940
30026
  // src/commands/rules/listRules.ts
29941
- import path66 from "path";
30027
+ import path67 from "path";
29942
30028
  import chalk207 from "chalk";
29943
-
29944
- // src/commands/rules/readScopedRules.ts
29945
- import { existsSync as existsSync61, readFileSync as readFileSync46 } from "fs";
29946
- import path65 from "path";
29947
-
29948
- // src/commands/rules/parseRulesSection.ts
29949
- var RULES_HEADING = /^##\s+rules\s*$/i;
29950
- var SECTION_END = /^#{1,2}\s/;
29951
- var RULE_BULLET = /^\s*[-*]\s+\*\*\s*([^*]+?)\s*\*\*\s*(?:[—–:-]\s*)?(.*)$/;
29952
- function parseRulesSection(content) {
29953
- const lines2 = content.split(/\r?\n/);
29954
- const start3 = lines2.findIndex((line) => RULES_HEADING.test(line));
29955
- if (start3 === -1) return [];
29956
- const rules3 = [];
29957
- for (const line of lines2.slice(start3 + 1)) {
29958
- if (SECTION_END.test(line)) break;
29959
- const match = RULE_BULLET.exec(line);
29960
- if (!match) continue;
29961
- const code = match[1].trim();
29962
- const text18 = match[2].trim();
29963
- if (code === "" || text18 === "") continue;
29964
- rules3.push({ code, text: text18 });
29965
- }
29966
- return rules3;
29967
- }
29968
-
29969
- // src/commands/rules/scopeDirectory.ts
29970
- import { existsSync as existsSync60, statSync as statSync10 } from "fs";
29971
- import path64 from "path";
29972
- function scopeDirectory(target) {
29973
- const resolved = path64.resolve(target);
29974
- return existsSync60(resolved) && statSync10(resolved).isDirectory() ? resolved : path64.dirname(resolved);
29975
- }
29976
-
29977
- // src/commands/rules/readScopedRules.ts
29978
- function scopedClaudeFiles(target) {
29979
- const startDir = scopeDirectory(target);
29980
- const root = findRepoRoot(startDir) ?? startDir;
29981
- const files = [];
29982
- let current = startDir;
29983
- while (true) {
29984
- const candidate = path65.join(current, "CLAUDE.md");
29985
- if (existsSync61(candidate)) files.push(candidate);
29986
- if (current === root || current === path65.dirname(current)) break;
29987
- current = path65.dirname(current);
29988
- }
29989
- return files;
29990
- }
29991
- function readScopedRules(target) {
29992
- return scopedClaudeFiles(target).flatMap(
29993
- (source) => parseRulesSection(readFileSync46(source, "utf8")).map((rule) => ({
29994
- ...rule,
29995
- source
29996
- }))
29997
- );
29998
- }
29999
-
30000
- // src/commands/rules/listRules.ts
30001
30029
  function listRules(target) {
30002
- const resolved = path66.resolve(target ?? process.cwd());
30030
+ const resolved = path67.resolve(target ?? process.cwd());
30003
30031
  const rules3 = readScopedRules(resolved);
30004
30032
  if (rules3.length === 0) {
30005
- const label2 = path66.relative(process.cwd(), resolved) || ".";
30033
+ const label2 = path67.relative(process.cwd(), resolved) || ".";
30006
30034
  console.log(chalk207.gray(`No rules in scope for ${label2}`));
30007
30035
  return;
30008
30036
  }
@@ -30013,7 +30041,7 @@ function listRules(target) {
30013
30041
  if (rule.source !== shown) {
30014
30042
  shown = rule.source;
30015
30043
  console.log(
30016
- chalk207.dim(base ? path66.relative(base, rule.source) : rule.source)
30044
+ chalk207.dim(base ? path67.relative(base, rule.source) : rule.source)
30017
30045
  );
30018
30046
  }
30019
30047
  console.log(` ${chalk207.cyan(rule.code.padEnd(width))} ${rule.text}`);
@@ -30089,8 +30117,8 @@ import chalk213 from "chalk";
30089
30117
 
30090
30118
  // src/commands/seq/fetchSeq.ts
30091
30119
  import chalk210 from "chalk";
30092
- async function fetchSeq(conn, path83, params) {
30093
- const url = `${conn.url}${path83}?${params}`;
30120
+ async function fetchSeq(conn, path84, params) {
30121
+ const url = `${conn.url}${path84}?${params}`;
30094
30122
  const response = await fetch(url, {
30095
30123
  headers: {
30096
30124
  Accept: "application/json",
@@ -30642,15 +30670,15 @@ function registerSql(program2) {
30642
30670
  // src/commands/sync.ts
30643
30671
  import * as fs48 from "fs";
30644
30672
  import * as os5 from "os";
30645
- import * as path77 from "path";
30673
+ import * as path78 from "path";
30646
30674
  import { fileURLToPath as fileURLToPath8 } from "url";
30647
30675
 
30648
30676
  // src/commands/sync/pruneCommands.ts
30649
- import * as path68 from "path";
30677
+ import * as path69 from "path";
30650
30678
 
30651
30679
  // src/commands/sync/pruneTarget.ts
30652
30680
  import * as fs40 from "fs";
30653
- import * as path67 from "path";
30681
+ import * as path68 from "path";
30654
30682
  function pruneTarget(targetDir, keepNames, shape, options2) {
30655
30683
  const result = {
30656
30684
  orphans: [],
@@ -30668,7 +30696,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
30668
30696
  }
30669
30697
  if (keep.has(name)) continue;
30670
30698
  result.orphans.push(entry.name);
30671
- const entryPath = path67.join(targetDir, entry.name);
30699
+ const entryPath = path68.join(targetDir, entry.name);
30672
30700
  const reason4 = shape.blockedBy?.(entryPath);
30673
30701
  if (reason4) {
30674
30702
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -30688,7 +30716,7 @@ function pruneCommands(targetDir, commandNames, options2) {
30688
30716
  targetDir,
30689
30717
  commandNames,
30690
30718
  {
30691
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path68.basename(entry.name, ".md") : void 0
30719
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path69.basename(entry.name, ".md") : void 0
30692
30720
  },
30693
30721
  options2
30694
30722
  );
@@ -30723,11 +30751,11 @@ function reportPrune(label2, result, force) {
30723
30751
 
30724
30752
  // src/commands/sync/syncClaudeMd.ts
30725
30753
  import * as fs41 from "fs";
30726
- import * as path69 from "path";
30754
+ import * as path70 from "path";
30727
30755
  import chalk220 from "chalk";
30728
30756
  async function syncClaudeMd(claudeDir, targetBase, options2) {
30729
- const source = path69.join(claudeDir, "CLAUDE.md");
30730
- const target = path69.join(targetBase, "CLAUDE.md");
30757
+ const source = path70.join(claudeDir, "CLAUDE.md");
30758
+ const target = path70.join(targetBase, "CLAUDE.md");
30731
30759
  const sourceContent = fs41.readFileSync(source, "utf8");
30732
30760
  if (fs41.existsSync(target)) {
30733
30761
  const targetContent = fs41.readFileSync(target, "utf8");
@@ -30755,13 +30783,13 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
30755
30783
  }
30756
30784
 
30757
30785
  // src/commands/sync/syncCodex.ts
30758
- import * as path72 from "path";
30786
+ import * as path73 from "path";
30759
30787
 
30760
30788
  // src/commands/sync/installHarnessCommands.ts
30761
30789
  import * as fs42 from "fs";
30762
- import * as path70 from "path";
30790
+ import * as path71 from "path";
30763
30791
  function installHarnessCommands(claudeDir, harness, transform) {
30764
- const commandsSource = path70.join(claudeDir, "commands");
30792
+ const commandsSource = path71.join(claudeDir, "commands");
30765
30793
  const files = fs42.readdirSync(commandsSource);
30766
30794
  const names = [];
30767
30795
  let synced = 0;
@@ -30769,15 +30797,15 @@ function installHarnessCommands(claudeDir, harness, transform) {
30769
30797
  if (!file.endsWith(".md")) continue;
30770
30798
  const name = file.replace(/\.md$/, "");
30771
30799
  names.push(name);
30772
- const content = fs42.readFileSync(path70.join(commandsSource, file), "utf8");
30773
- const target = path70.join(harness.homeDir, harness.sync.commandDest(name));
30774
- fs42.mkdirSync(path70.dirname(target), { recursive: true });
30800
+ const content = fs42.readFileSync(path71.join(commandsSource, file), "utf8");
30801
+ const target = path71.join(harness.homeDir, harness.sync.commandDest(name));
30802
+ fs42.mkdirSync(path71.dirname(target), { recursive: true });
30775
30803
  fs42.writeFileSync(target, transform(name, content));
30776
30804
  synced++;
30777
30805
  }
30778
- const agentsTarget = path70.join(harness.homeDir, harness.sync.agentsFile);
30779
- fs42.mkdirSync(path70.dirname(agentsTarget), { recursive: true });
30780
- fs42.copyFileSync(path70.join(claudeDir, "CLAUDE.md"), agentsTarget);
30806
+ const agentsTarget = path71.join(harness.homeDir, harness.sync.agentsFile);
30807
+ fs42.mkdirSync(path71.dirname(agentsTarget), { recursive: true });
30808
+ fs42.copyFileSync(path71.join(claudeDir, "CLAUDE.md"), agentsTarget);
30781
30809
  return { total: files.length, synced, names };
30782
30810
  }
30783
30811
 
@@ -30803,7 +30831,7 @@ function unexpectedContent(skillDir) {
30803
30831
 
30804
30832
  // src/commands/sync/syncCodexHooks.ts
30805
30833
  import * as fs44 from "fs";
30806
- import * as path71 from "path";
30834
+ import * as path72 from "path";
30807
30835
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
30808
30836
  var END = "# <<< assist codex hooks (managed) <<<";
30809
30837
  function upsertManagedBlock(existing, body) {
@@ -30834,9 +30862,9 @@ ${rest}
30834
30862
  }
30835
30863
  function syncCodexHooks(sourcePath) {
30836
30864
  const body = fs44.readFileSync(sourcePath, "utf8");
30837
- const configPath = path71.join(harnesses.codex.homeDir, "config.toml");
30865
+ const configPath = path72.join(harnesses.codex.homeDir, "config.toml");
30838
30866
  const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
30839
- fs44.mkdirSync(path71.dirname(configPath), { recursive: true });
30867
+ fs44.mkdirSync(path72.dirname(configPath), { recursive: true });
30840
30868
  fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
30841
30869
  console.log(
30842
30870
  "Registered assist codex-hook in ~/.codex/config.toml (UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
@@ -30868,7 +30896,7 @@ function syncCodex(claudeDir, options2) {
30868
30896
  harnesses.codex,
30869
30897
  commandToSkill
30870
30898
  );
30871
- syncCodexHooks(path72.join(claudeDir, "..", "codex", "config.toml"));
30899
+ syncCodexHooks(path73.join(claudeDir, "..", "codex", "config.toml"));
30872
30900
  console.log(
30873
30901
  `Synced ${total} skill(s) to ~/.codex/skills and CLAUDE.md to ~/.codex/AGENTS.md`
30874
30902
  );
@@ -30876,42 +30904,42 @@ function syncCodex(claudeDir, options2) {
30876
30904
  const force = options2.force ?? false;
30877
30905
  reportPrune(
30878
30906
  "~/.codex/skills",
30879
- pruneSkills(path72.join(harnesses.codex.homeDir, "skills"), names, { force }),
30907
+ pruneSkills(path73.join(harnesses.codex.homeDir, "skills"), names, { force }),
30880
30908
  force
30881
30909
  );
30882
30910
  }
30883
30911
 
30884
30912
  // src/commands/sync/syncDesign.ts
30885
30913
  import * as fs45 from "fs";
30886
- import * as path73 from "path";
30914
+ import * as path74 from "path";
30887
30915
  function syncDesign(claudeDir, targetBase) {
30888
- const systemPromptSource = path73.join(claudeDir, "design-system-prompt.md");
30889
- const systemPromptTarget = path73.join(targetBase, "design-system-prompt.md");
30916
+ const systemPromptSource = path74.join(claudeDir, "design-system-prompt.md");
30917
+ const systemPromptTarget = path74.join(targetBase, "design-system-prompt.md");
30890
30918
  fs45.copyFileSync(systemPromptSource, systemPromptTarget);
30891
30919
  console.log(
30892
30920
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
30893
30921
  );
30894
- const skillsSource = path73.join(claudeDir, "skills");
30895
- const skillsTarget = path73.join(targetBase, "skills");
30922
+ const skillsSource = path74.join(claudeDir, "skills");
30923
+ const skillsTarget = path74.join(targetBase, "skills");
30896
30924
  fs45.mkdirSync(skillsTarget, { recursive: true });
30897
30925
  const files = fs45.readdirSync(skillsSource);
30898
30926
  for (const file of files) {
30899
30927
  fs45.copyFileSync(
30900
- path73.join(skillsSource, file),
30901
- path73.join(skillsTarget, file)
30928
+ path74.join(skillsSource, file),
30929
+ path74.join(skillsTarget, file)
30902
30930
  );
30903
30931
  }
30904
30932
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
30905
30933
  }
30906
30934
 
30907
30935
  // src/commands/sync/syncPi.ts
30908
- import * as path75 from "path";
30936
+ import * as path76 from "path";
30909
30937
 
30910
30938
  // src/commands/sync/syncPiHooks.ts
30911
30939
  import * as fs46 from "fs";
30912
- import * as path74 from "path";
30940
+ import * as path75 from "path";
30913
30941
  function piExtensionsDir() {
30914
- return path74.join(harnesses.pi.homeDir, "extensions");
30942
+ return path75.join(harnesses.pi.homeDir, "extensions");
30915
30943
  }
30916
30944
  function syncPiHooks(sourceDir) {
30917
30945
  const target = piExtensionsDir();
@@ -30919,8 +30947,8 @@ function syncPiHooks(sourceDir) {
30919
30947
  const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
30920
30948
  for (const file of files) {
30921
30949
  fs46.copyFileSync(
30922
- path74.join(sourceDir, file),
30923
- path74.join(target, `assist-${file}`)
30950
+ path75.join(sourceDir, file),
30951
+ path75.join(target, `assist-${file}`)
30924
30952
  );
30925
30953
  }
30926
30954
  console.log(
@@ -30957,7 +30985,7 @@ function syncPi(claudeDir, options2) {
30957
30985
  harnesses.pi,
30958
30986
  commandToPrompt
30959
30987
  );
30960
- syncPiHooks(path75.join(claudeDir, "..", "pi"));
30988
+ syncPiHooks(path76.join(claudeDir, "..", "pi"));
30961
30989
  console.log(
30962
30990
  `Synced ${synced} prompt(s) to ~/.pi/agent/prompts and CLAUDE.md to ~/.pi/agent/AGENTS.md`
30963
30991
  );
@@ -30965,18 +30993,18 @@ function syncPi(claudeDir, options2) {
30965
30993
  const force = options2.force ?? false;
30966
30994
  reportPrune(
30967
30995
  "~/.pi/agent/prompts",
30968
- pruneCommands(path75.join(harnesses.pi.homeDir, "prompts"), names, { force }),
30996
+ pruneCommands(path76.join(harnesses.pi.homeDir, "prompts"), names, { force }),
30969
30997
  force
30970
30998
  );
30971
30999
  }
30972
31000
 
30973
31001
  // src/commands/sync/syncSettings.ts
30974
31002
  import * as fs47 from "fs";
30975
- import * as path76 from "path";
31003
+ import * as path77 from "path";
30976
31004
  import chalk221 from "chalk";
30977
31005
  async function syncSettings(claudeDir, targetBase, options2) {
30978
- const source = path76.join(claudeDir, "settings.json");
30979
- const target = path76.join(targetBase, "settings.json");
31006
+ const source = path77.join(claudeDir, "settings.json");
31007
+ const target = path77.join(targetBase, "settings.json");
30980
31008
  const sourceContent = fs47.readFileSync(source, "utf8");
30981
31009
  const sourceSettings = JSON.parse(sourceContent);
30982
31010
  const targetExists = fs47.existsSync(target);
@@ -31016,13 +31044,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
31016
31044
 
31017
31045
  // src/commands/sync.ts
31018
31046
  var __filename4 = fileURLToPath8(import.meta.url);
31019
- var __dirname5 = path77.dirname(__filename4);
31047
+ var __dirname5 = path78.dirname(__filename4);
31020
31048
  async function sync(options2) {
31021
31049
  const config = loadConfig();
31022
31050
  const yes = options2?.yes ?? config.sync.autoConfirm;
31023
31051
  const prune = { prune: options2?.prune, force: options2?.force };
31024
- const claudeDir = path77.join(__dirname5, "..", "claude");
31025
- const targetBase = path77.join(os5.homedir(), ".claude");
31052
+ const claudeDir = path78.join(__dirname5, "..", "claude");
31053
+ const targetBase = path78.join(os5.homedir(), ".claude");
31026
31054
  const commandFiles = syncCommands(claudeDir, targetBase);
31027
31055
  syncDesign(claudeDir, targetBase);
31028
31056
  await syncSettings(claudeDir, targetBase, { yes });
@@ -31030,21 +31058,21 @@ async function sync(options2) {
31030
31058
  syncCodex(claudeDir, prune);
31031
31059
  syncPi(claudeDir, prune);
31032
31060
  if (!options2?.prune) return;
31033
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path77.basename(file, ".md"));
31061
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path78.basename(file, ".md"));
31034
31062
  const force = options2.force ?? false;
31035
31063
  reportPrune(
31036
31064
  "~/.claude/commands",
31037
- pruneCommands(path77.join(targetBase, "commands"), commandNames, { force }),
31065
+ pruneCommands(path78.join(targetBase, "commands"), commandNames, { force }),
31038
31066
  force
31039
31067
  );
31040
31068
  }
31041
31069
  function syncCommands(claudeDir, targetBase) {
31042
- const sourceDir = path77.join(claudeDir, "commands");
31043
- const targetDir = path77.join(targetBase, "commands");
31070
+ const sourceDir = path78.join(claudeDir, "commands");
31071
+ const targetDir = path78.join(targetBase, "commands");
31044
31072
  fs48.mkdirSync(targetDir, { recursive: true });
31045
31073
  const files = fs48.readdirSync(sourceDir);
31046
31074
  for (const file of files) {
31047
- fs48.copyFileSync(path77.join(sourceDir, file), path77.join(targetDir, file));
31075
+ fs48.copyFileSync(path78.join(sourceDir, file), path78.join(targetDir, file));
31048
31076
  console.log(`Copied ${file} to ${targetDir}`);
31049
31077
  }
31050
31078
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -31203,11 +31231,8 @@ function parseTimestamp(ts8) {
31203
31231
  }
31204
31232
  function extractSpeaker(fullText) {
31205
31233
  const match = fullText.match(/^<v\s+([^>]+)>/);
31206
- if (!match) return { speaker: null, text: fullText };
31207
- return {
31208
- speaker: match[1],
31209
- text: fullText.replace(/<v\s+[^>]+>/, "").trim()
31210
- };
31234
+ const text18 = fullText.replace(/<v\s+[^>]+>|<\/v>/g, "").trim();
31235
+ return { speaker: match ? match[1] : null, text: text18 };
31211
31236
  }
31212
31237
  function isTextLine(line) {
31213
31238
  return !!line.trim() && !line.includes("-->");
@@ -31902,11 +31927,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
31902
31927
  var sessionsPrefix = "src/commands/sessions/";
31903
31928
  var rules = [
31904
31929
  {
31905
- matches: (path83) => path83.startsWith(webUiPrefix),
31930
+ matches: (path84) => path84.startsWith(webUiPrefix),
31906
31931
  advice: "restart the web server, then hard-reload the browser tab"
31907
31932
  },
31908
31933
  {
31909
- matches: (path83) => path83.startsWith(sessionsPrefix) && !path83.startsWith(webUiPrefix),
31934
+ matches: (path84) => path84.startsWith(sessionsPrefix) && !path84.startsWith(webUiPrefix),
31910
31935
  advice: "restart the daemon"
31911
31936
  }
31912
31937
  ];
@@ -31917,31 +31942,31 @@ function restartAdvice(paths) {
31917
31942
  // src/commands/watch/syncAdvice.ts
31918
31943
  var rules2 = [
31919
31944
  {
31920
- matches: (path83) => path83.startsWith("claude/commands/"),
31945
+ matches: (path84) => path84.startsWith("claude/commands/"),
31921
31946
  reason: "claude/commands changed"
31922
31947
  },
31923
31948
  {
31924
- matches: (path83) => path83.startsWith("claude/skills/"),
31949
+ matches: (path84) => path84.startsWith("claude/skills/"),
31925
31950
  reason: "claude/skills changed"
31926
31951
  },
31927
31952
  {
31928
- matches: (path83) => path83 === "claude/settings.json",
31953
+ matches: (path84) => path84 === "claude/settings.json",
31929
31954
  reason: "claude/settings.json changed"
31930
31955
  },
31931
31956
  {
31932
- matches: (path83) => path83 === "claude/CLAUDE.md",
31957
+ matches: (path84) => path84 === "claude/CLAUDE.md",
31933
31958
  reason: "claude/CLAUDE.md changed"
31934
31959
  },
31935
31960
  {
31936
- matches: (path83) => path83 === "claude/design-system-prompt.md",
31961
+ matches: (path84) => path84 === "claude/design-system-prompt.md",
31937
31962
  reason: "claude/design-system-prompt.md changed"
31938
31963
  },
31939
31964
  {
31940
- matches: (path83) => path83.startsWith("codex/"),
31965
+ matches: (path84) => path84.startsWith("codex/"),
31941
31966
  reason: "codex sources changed"
31942
31967
  },
31943
31968
  {
31944
- matches: (path83) => path83.startsWith("pi/"),
31969
+ matches: (path84) => path84.startsWith("pi/"),
31945
31970
  reason: "pi sources changed"
31946
31971
  }
31947
31972
  ];
@@ -32649,9 +32674,9 @@ function findPortFile(roamDir) {
32649
32674
  return void 0;
32650
32675
  }
32651
32676
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
32652
- const path83 = join87(roamDir, name);
32677
+ const path84 = join87(roamDir, name);
32653
32678
  try {
32654
- return { path: path83, mtimeMs: statSync12(path83).mtimeMs };
32679
+ return { path: path84, mtimeMs: statSync12(path84).mtimeMs };
32655
32680
  } catch {
32656
32681
  return void 0;
32657
32682
  }
@@ -32887,11 +32912,11 @@ function findLinkIndex() {
32887
32912
  function parseLinkArgs() {
32888
32913
  const idx = findLinkIndex();
32889
32914
  if (idx === -1) return null;
32890
- const path83 = process.argv[idx + 1];
32915
+ const path84 = process.argv[idx + 1];
32891
32916
  const rest = process.argv.slice(idx + 2);
32892
32917
  const { value: prefix2 } = extractOption(rest, "--prefix");
32893
32918
  if (!prefix2) return null;
32894
- return { path: path83, prefix: prefix2 };
32919
+ return { path: path84, prefix: prefix2 };
32895
32920
  }
32896
32921
  function hasDuplicateLink(runList, linkPath) {
32897
32922
  return runList.some(
@@ -33633,14 +33658,14 @@ import * as pty from "node-pty";
33633
33658
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
33634
33659
  import { chmodSync, existsSync as existsSync79, statSync as statSync13 } from "fs";
33635
33660
  import { createRequire as createRequire3 } from "module";
33636
- import path78 from "path";
33661
+ import path79 from "path";
33637
33662
  var require4 = createRequire3(import.meta.url);
33638
33663
  var ensured = false;
33639
33664
  function ensureSpawnHelperExecutable() {
33640
33665
  if (ensured || process.platform !== "darwin") return;
33641
33666
  ensured = true;
33642
- const ptyRoot = path78.join(path78.dirname(require4.resolve("node-pty")), "..");
33643
- const helper = path78.join(
33667
+ const ptyRoot = path79.join(path79.dirname(require4.resolve("node-pty")), "..");
33668
+ const helper = path79.join(
33644
33669
  ptyRoot,
33645
33670
  "prebuilds",
33646
33671
  `${process.platform}-${process.arch}`,
@@ -33761,12 +33786,12 @@ function serverRunMeta(runName, cwd) {
33761
33786
 
33762
33787
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
33763
33788
  import * as fs49 from "fs";
33764
- import * as path79 from "path";
33789
+ import * as path80 from "path";
33765
33790
  import { fileURLToPath as fileURLToPath10 } from "url";
33766
33791
  var __filename5 = fileURLToPath10(import.meta.url);
33767
- var __dirname7 = path79.dirname(__filename5);
33792
+ var __dirname7 = path80.dirname(__filename5);
33768
33793
  function readDesignSystemPrompt() {
33769
- const promptPath = path79.join(
33794
+ const promptPath = path80.join(
33770
33795
  __dirname7,
33771
33796
  "..",
33772
33797
  "claude",
@@ -34748,8 +34773,8 @@ async function seedRunningMsFromUsage(session, notify2) {
34748
34773
  var DEBOUNCE_MS2 = 50;
34749
34774
  function watchActivity(session, notify2, onClaudeSessionId) {
34750
34775
  if (session.commandType !== "assist" || !session.cwd) return;
34751
- const path83 = activityPath(session.id);
34752
- const dir = dirname39(path83);
34776
+ const path84 = activityPath(session.id);
34777
+ const dir = dirname39(path84);
34753
34778
  try {
34754
34779
  mkdirSync33(dir, { recursive: true });
34755
34780
  } catch {
@@ -34759,7 +34784,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
34759
34784
  let timer = null;
34760
34785
  const read2 = () => {
34761
34786
  timer = null;
34762
- const activity2 = readActivity(path83);
34787
+ const activity2 = readActivity(path84);
34763
34788
  if (!activity2) return;
34764
34789
  applyActivityToSession(session, activity2);
34765
34790
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -34768,11 +34793,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
34768
34793
  notify2();
34769
34794
  };
34770
34795
  session.activityWatcher = watch2(dir, (_event, filename) => {
34771
- if (filename && !path83.endsWith(filename)) return;
34796
+ if (filename && !path84.endsWith(filename)) return;
34772
34797
  if (timer) clearTimeout(timer);
34773
34798
  timer = setTimeout(read2, DEBOUNCE_MS2);
34774
34799
  });
34775
- if (existsSync85(path83)) read2();
34800
+ if (existsSync85(path84)) read2();
34776
34801
  }
34777
34802
  function refreshActivity(session) {
34778
34803
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -34915,12 +34940,12 @@ import { watch as watch3 } from "fs";
34915
34940
 
34916
34941
  // src/commands/sessions/shared/findTranscriptPathSync.ts
34917
34942
  import * as fs51 from "fs";
34918
- import * as path80 from "path";
34943
+ import * as path81 from "path";
34919
34944
  function projectDirForCwd(cwd) {
34920
- return path80.join(claudeProjectsRoot(), projectSlug(cwd));
34945
+ return path81.join(claudeProjectsRoot(), projectSlug(cwd));
34921
34946
  }
34922
34947
  function transcriptPathFor(cwd, claudeSessionId) {
34923
- return path80.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
34948
+ return path81.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
34924
34949
  }
34925
34950
  function findTranscriptPathSync(cwd, claudeSessionId) {
34926
34951
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -34934,8 +34959,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
34934
34959
  }
34935
34960
  for (const file of files) {
34936
34961
  if (!file.endsWith(".jsonl")) continue;
34937
- if (headContainsSessionId(path80.join(dir, file), claudeSessionId))
34938
- return path80.join(dir, file);
34962
+ if (headContainsSessionId(path81.join(dir, file), claudeSessionId))
34963
+ return path81.join(dir, file);
34939
34964
  }
34940
34965
  return null;
34941
34966
  }
@@ -36109,9 +36134,9 @@ function tempRoots() {
36109
36134
  }
36110
36135
  return [...roots];
36111
36136
  }
36112
- function underTempRoot(path83) {
36137
+ function underTempRoot(path84) {
36113
36138
  return tempRoots().some(
36114
- (root) => path83.startsWith(root.endsWith(sep2) ? root : root + sep2)
36139
+ (root) => path84.startsWith(root.endsWith(sep2) ? root : root + sep2)
36115
36140
  );
36116
36141
  }
36117
36142
 
@@ -36481,15 +36506,15 @@ function bindResumedWorktree(session, cwd, notify2) {
36481
36506
  import { existsSync as existsSync87 } from "fs";
36482
36507
  async function reclaimVanishedWorktrees(clone, paths) {
36483
36508
  if (!existsSync87(clone)) {
36484
- for (const { path: path83 } of paths) forgetWorktree(path83);
36509
+ for (const { path: path84 } of paths) forgetWorktree(path84);
36485
36510
  daemonLog(
36486
36511
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
36487
36512
  );
36488
36513
  return;
36489
36514
  }
36490
36515
  await pruneBookkeeping2(clone);
36491
- for (const { path: path83, branch: branch2 } of paths)
36492
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path83);
36516
+ for (const { path: path84, branch: branch2 } of paths)
36517
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path84);
36493
36518
  }
36494
36519
  async function pruneBookkeeping2(clone) {
36495
36520
  try {
@@ -36516,37 +36541,37 @@ async function reclaimBranch(clone, branch2) {
36516
36541
  }
36517
36542
 
36518
36543
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
36519
- function logVanishedTree(sessions, path83) {
36544
+ function logVanishedTree(sessions, path84) {
36520
36545
  const claimants = [...sessions.values()].filter(
36521
- (s) => s.cwd === path83 || s.worktree?.path === path83
36546
+ (s) => s.cwd === path84 || s.worktree?.path === path84
36522
36547
  );
36523
36548
  if (claimants.length === 0) {
36524
- daemonLog(`worktree ${path83} gone from disk and unclaimed; reclaiming it`);
36549
+ daemonLog(`worktree ${path84} gone from disk and unclaimed; reclaiming it`);
36525
36550
  return;
36526
36551
  }
36527
36552
  for (const s of claimants)
36528
36553
  daemonLog(
36529
- `session ${s.id} ("${s.name}") claims worktree ${path83}, which is gone from disk; reclaiming it`
36554
+ `session ${s.id} ("${s.name}") claims worktree ${path84}, which is gone from disk; reclaiming it`
36530
36555
  );
36531
36556
  }
36532
36557
 
36533
36558
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
36534
36559
  var MAX_ITEMS = 20;
36535
- async function describeHeldWork(path83, reason4) {
36536
- if (reason4.startsWith("uncommitted")) return await changedFiles(path83);
36537
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path83, reason4);
36560
+ async function describeHeldWork(path84, reason4) {
36561
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path84);
36562
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path84, reason4);
36538
36563
  return { summary: reason4, items: [] };
36539
36564
  }
36540
- async function changedFiles(path83) {
36541
- const status3 = await gitResult(path83, ["status", "--porcelain"]);
36565
+ async function changedFiles(path84) {
36566
+ const status3 = await gitResult(path84, ["status", "--porcelain"]);
36542
36567
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
36543
36568
  return {
36544
36569
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
36545
36570
  items: capped(lines2)
36546
36571
  };
36547
36572
  }
36548
- async function unpushedCommits(path83, reason4) {
36549
- const log2 = await gitResult(path83, ["log", "--oneline", "@{upstream}..HEAD"]);
36573
+ async function unpushedCommits(path84, reason4) {
36574
+ const log2 = await gitResult(path84, ["log", "--oneline", "@{upstream}..HEAD"]);
36550
36575
  if (!log2.ok) return { summary: reason4, items: [] };
36551
36576
  const lines2 = nonEmptyLines(log2.out);
36552
36577
  return {
@@ -36638,24 +36663,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
36638
36663
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
36639
36664
  const accounted = accountedTrees(sessions);
36640
36665
  const vanished = /* @__PURE__ */ new Map();
36641
- for (const { path: path83, clone } of readWorktreeRegistry()) {
36642
- if (underTempRoot(path83)) {
36643
- forgetWorktree(path83);
36666
+ for (const { path: path84, clone } of readWorktreeRegistry()) {
36667
+ if (underTempRoot(path84)) {
36668
+ forgetWorktree(path84);
36644
36669
  daemonLog(
36645
- `worktree ${path83} lies outside any project root; pruned from the registry rather than recovered`
36670
+ `worktree ${path84} lies outside any project root; pruned from the registry rather than recovered`
36646
36671
  );
36647
36672
  continue;
36648
36673
  }
36649
- if (!existsSync88(path83)) {
36650
- logVanishedTree(sessions, path83);
36674
+ if (!existsSync88(path84)) {
36675
+ logVanishedTree(sessions, path84);
36651
36676
  vanished.set(clone, [
36652
36677
  ...vanished.get(clone) ?? [],
36653
- { path: path83, branch: basename24(path83) }
36678
+ { path: path84, branch: basename24(path84) }
36654
36679
  ]);
36655
36680
  continue;
36656
36681
  }
36657
- if (accounted.has(path83)) continue;
36658
- await recoverOrphan(sessions, spawnWith, { path: path83, clone }, notify2);
36682
+ if (accounted.has(path84)) continue;
36683
+ await recoverOrphan(sessions, spawnWith, { path: path84, clone }, notify2);
36659
36684
  }
36660
36685
  for (const [clone, paths] of vanished)
36661
36686
  await reclaimVanishedWorktrees(clone, paths);
@@ -38376,12 +38401,12 @@ function handleSetStatus(client, m, d) {
38376
38401
  import * as fs54 from "fs";
38377
38402
 
38378
38403
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
38379
- import * as path81 from "path";
38404
+ import * as path82 from "path";
38380
38405
  async function findCodexRolloutPath(sessionId) {
38381
38406
  if (!sessionId) return null;
38382
38407
  const paths = await discoverCodexRolloutPaths();
38383
38408
  const suffix = `-${sessionId}.jsonl`;
38384
- return paths.find((file) => path81.basename(file).endsWith(suffix)) ?? null;
38409
+ return paths.find((file) => path82.basename(file).endsWith(suffix)) ?? null;
38385
38410
  }
38386
38411
 
38387
38412
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -39257,7 +39282,7 @@ async function statusLine() {
39257
39282
 
39258
39283
  // src/commands/update.ts
39259
39284
  import { execSync as execSync61 } from "child_process";
39260
- import * as path82 from "path";
39285
+ import * as path83 from "path";
39261
39286
 
39262
39287
  // src/commands/restartDaemonAfterUpdate.ts
39263
39288
  async function restartDaemonAfterUpdate() {
@@ -39276,12 +39301,12 @@ async function restartDaemonAfterUpdate() {
39276
39301
  // src/commands/update.ts
39277
39302
  function isGlobalNpmInstall(dir) {
39278
39303
  try {
39279
- const resolved = path82.resolve(dir);
39280
- if (resolved.split(path82.sep).includes("node_modules")) {
39304
+ const resolved = path83.resolve(dir);
39305
+ if (resolved.split(path83.sep).includes("node_modules")) {
39281
39306
  return true;
39282
39307
  }
39283
39308
  const globalPrefix = execSync61("npm prefix -g", { stdio: "pipe" }).toString().trim();
39284
- return resolved.toLowerCase().startsWith(path82.resolve(globalPrefix).toLowerCase());
39309
+ return resolved.toLowerCase().startsWith(path83.resolve(globalPrefix).toLowerCase());
39285
39310
  } catch {
39286
39311
  return false;
39287
39312
  }