@staff0rd/assist 0.694.4 → 0.696.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.694.4",
9
+ version: "0.696.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
296
296
  }
297
297
 
298
298
  // src/commands/backlog/getCurrentOrigin.ts
299
- function stripLeadingSlashes(path101) {
300
- return path101.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path103) {
300
+ return path103.replace(/^\/+/, "");
301
301
  }
302
302
  function normalizeOrigin(raw) {
303
303
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -347,9 +347,9 @@ function findGitLink(dir) {
347
347
  }
348
348
  return null;
349
349
  }
350
- function isFile(path101) {
350
+ function isFile(path103) {
351
351
  try {
352
- return statSync(path101).isFile();
352
+ return statSync(path103).isFile();
353
353
  } catch {
354
354
  return false;
355
355
  }
@@ -368,9 +368,9 @@ function linkedGitDirParent(gitDir) {
368
368
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
369
369
  return match ? match[1] : null;
370
370
  }
371
- function readTrimmed(path101) {
371
+ function readTrimmed(path103) {
372
372
  try {
373
- const content = readFileSync2(path101, "utf8").trim();
373
+ const content = readFileSync2(path103, "utf8").trim();
374
374
  return content === "" ? null : content;
375
375
  } catch {
376
376
  return null;
@@ -383,10 +383,10 @@ function absolute(target, from) {
383
383
  // src/shared/loadRawYaml.ts
384
384
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
385
385
  import { parse as parseYaml } from "yaml";
386
- function loadRawYaml(path101) {
387
- if (!existsSync3(path101)) return {};
386
+ function loadRawYaml(path103) {
387
+ if (!existsSync3(path103)) return {};
388
388
  try {
389
- const content = readFileSync3(path101, "utf8");
389
+ const content = readFileSync3(path103, "utf8");
390
390
  return parseYaml(content) || {};
391
391
  } catch {
392
392
  return {};
@@ -458,8 +458,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
458
458
  // src/commands/backlog/originDisplayName.ts
459
459
  function originDisplayName(origin) {
460
460
  if (origin.startsWith("local:")) {
461
- const path101 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path101.split("/").filter(Boolean);
461
+ const path103 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path103.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -681,7 +681,8 @@ var assistConfigShape = {
681
681
  ignore: z3.array(z3.string()).default([])
682
682
  }).optional(),
683
683
  restructure: z3.strictObject({
684
- ignore: z3.array(z3.string()).default([])
684
+ ignore: z3.array(z3.string()).default([]),
685
+ pin: z3.array(z3.string()).default([])
685
686
  }).optional(),
686
687
  jira: z3.strictObject({
687
688
  acField: z3.string().default("customfield_11937")
@@ -3965,9 +3966,9 @@ function groupColumns(rows) {
3965
3966
  }
3966
3967
 
3967
3968
  // src/commands/backlog/dump/orderDumpTables.ts
3968
- function buildGraph(names2, edges) {
3969
- const present = new Set(names2);
3970
- const indegree = new Map(names2.map((n) => [n, 0]));
3969
+ function buildGraph(names, edges) {
3970
+ const present = new Set(names);
3971
+ const indegree = new Map(names.map((n) => [n, 0]));
3971
3972
  const children = /* @__PURE__ */ new Map();
3972
3973
  for (const { child, parent } of edges) {
3973
3974
  if (!present.has(child) || !present.has(parent)) continue;
@@ -3976,17 +3977,17 @@ function buildGraph(names2, edges) {
3976
3977
  }
3977
3978
  return { indegree, children };
3978
3979
  }
3979
- function nextReady(names2, emitted, indegree) {
3980
- return names2.find((n) => !emitted.has(n) && (indegree.get(n) ?? 0) === 0);
3980
+ function nextReady(names, emitted, indegree) {
3981
+ return names.find((n) => !emitted.has(n) && (indegree.get(n) ?? 0) === 0);
3981
3982
  }
3982
3983
  function topoSort(entries, edges) {
3983
- const names2 = entries.map((e) => e.raw);
3984
- const { indegree, children } = buildGraph(names2, edges);
3984
+ const names = entries.map((e) => e.raw);
3985
+ const { indegree, children } = buildGraph(names, edges);
3985
3986
  const byRaw = new Map(entries.map((e) => [e.raw, e.table]));
3986
3987
  const ordered = [];
3987
3988
  const emitted = /* @__PURE__ */ new Set();
3988
3989
  while (ordered.length < entries.length) {
3989
- const next3 = nextReady(names2, emitted, indegree);
3990
+ const next3 = nextReady(names, emitted, indegree);
3990
3991
  if (!next3)
3991
3992
  throw new Error("Cannot dump: foreign-key cycle between tables.");
3992
3993
  emitted.add(next3);
@@ -4293,8 +4294,8 @@ function getPreferredRemoteRepo(cwd) {
4293
4294
  function gitRefUrl(kind, ref, cwd) {
4294
4295
  const repo = getPreferredRemoteRepo(cwd);
4295
4296
  if (!repo) return void 0;
4296
- const path101 = kind === "branch" ? "tree" : "commit";
4297
- return `https://github.com/${repo.org}/${repo.repo}/${path101}/${ref}`;
4297
+ const path103 = kind === "branch" ? "tree" : "commit";
4298
+ return `https://github.com/${repo.org}/${repo.repo}/${path103}/${ref}`;
4298
4299
  }
4299
4300
 
4300
4301
  // src/commands/sessions/shared/resolveSessionTranscript.ts
@@ -4455,9 +4456,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
4455
4456
  function backupLocalBacklogFiles(dir) {
4456
4457
  const moved = [];
4457
4458
  for (const name of LOCAL_FILES) {
4458
- const path101 = join19(dir, ".assist", name);
4459
- if (existsSync20(path101)) {
4460
- renameSync(path101, `${path101}.bak`);
4459
+ const path103 = join19(dir, ".assist", name);
4460
+ if (existsSync20(path103)) {
4461
+ renameSync(path103, `${path103}.bak`);
4461
4462
  moved.push(`${name} \u2192 ${name}.bak`);
4462
4463
  }
4463
4464
  }
@@ -4941,8 +4942,8 @@ var backlogItemSchema = z4.strictObject({
4941
4942
  var backlogFileSchema = z4.array(backlogItemSchema);
4942
4943
 
4943
4944
  // src/commands/backlog/parseBacklogJsonl.ts
4944
- function parseBacklogJsonl(path101) {
4945
- const content = readFileSync13(path101, "utf8").trim();
4945
+ function parseBacklogJsonl(path103) {
4946
+ const content = readFileSync13(path103, "utf8").trim();
4946
4947
  if (content.length === 0) return [];
4947
4948
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
4948
4949
  }
@@ -5488,9 +5489,9 @@ function originToSshUrl(origin) {
5488
5489
  const firstSlash = origin.indexOf("/");
5489
5490
  if (firstSlash <= 0) return null;
5490
5491
  const host = origin.slice(0, firstSlash);
5491
- const path101 = origin.slice(firstSlash + 1);
5492
- if (!path101) return null;
5493
- return `git@${host}:${path101}.git`;
5492
+ const path103 = origin.slice(firstSlash + 1);
5493
+ if (!path103) return null;
5494
+ return `git@${host}:${path103}.git`;
5494
5495
  }
5495
5496
 
5496
5497
  // src/commands/backlog/cloneRepo.ts
@@ -7128,10 +7129,10 @@ var hooksSettings = {
7128
7129
  }
7129
7130
  };
7130
7131
  function ensureHooksSettings() {
7131
- const path101 = daemonPaths.hooksSettings;
7132
- mkdirSync5(dirname15(path101), { recursive: true });
7133
- writeFileSync16(path101, JSON.stringify(hooksSettings, null, 2));
7134
- return path101;
7132
+ const path103 = daemonPaths.hooksSettings;
7133
+ mkdirSync5(dirname15(path103), { recursive: true });
7134
+ writeFileSync16(path103, JSON.stringify(hooksSettings, null, 2));
7135
+ return path103;
7135
7136
  }
7136
7137
 
7137
7138
  // src/shared/spawnInherit.ts
@@ -7887,24 +7888,24 @@ function getOwnerPath(itemId2) {
7887
7888
  function recordSignalOwner(itemId2) {
7888
7889
  const sessionId = process.env.ASSIST_SESSION_ID;
7889
7890
  if (!sessionId) return;
7890
- const path101 = getOwnerPath(itemId2);
7891
- mkdirSync7(dirname16(path101), { recursive: true });
7892
- writeFileSync18(path101, JSON.stringify({ sessionId }));
7891
+ const path103 = getOwnerPath(itemId2);
7892
+ mkdirSync7(dirname16(path103), { recursive: true });
7893
+ writeFileSync18(path103, JSON.stringify({ sessionId }));
7893
7894
  }
7894
7895
  function readSignalOwner(itemId2) {
7895
- const path101 = getOwnerPath(itemId2);
7896
- if (!existsSync26(path101)) return void 0;
7896
+ const path103 = getOwnerPath(itemId2);
7897
+ if (!existsSync26(path103)) return void 0;
7897
7898
  try {
7898
- const parsed = JSON.parse(readFileSync17(path101, "utf8"));
7899
+ const parsed = JSON.parse(readFileSync17(path103, "utf8"));
7899
7900
  return parsed.sessionId;
7900
7901
  } catch {
7901
7902
  return void 0;
7902
7903
  }
7903
7904
  }
7904
7905
  function clearSignalOwner(itemId2) {
7905
- const path101 = getOwnerPath(itemId2);
7906
+ const path103 = getOwnerPath(itemId2);
7906
7907
  try {
7907
- rmSync(path101);
7908
+ rmSync(path103);
7908
7909
  } catch {
7909
7910
  }
7910
7911
  }
@@ -7941,19 +7942,19 @@ function resolveSignalTarget(event, data) {
7941
7942
  function writeSignal(event, data) {
7942
7943
  const target = resolveSignalTarget(event, data);
7943
7944
  if (!target) return;
7944
- const path101 = getSignalPath(target);
7945
- if (!path101) return;
7945
+ const path103 = getSignalPath(target);
7946
+ if (!path103) return;
7946
7947
  const signal = { event, sessionId: target, ...data };
7947
- mkdirSync8(dirname17(path101), { recursive: true });
7948
- writeFileSync19(path101, JSON.stringify(signal));
7948
+ mkdirSync8(dirname17(path103), { recursive: true });
7949
+ writeFileSync19(path103, JSON.stringify(signal));
7949
7950
  }
7950
7951
 
7951
7952
  // src/commands/backlog/readSignal.ts
7952
7953
  function readSignal() {
7953
- const path101 = getSignalPath();
7954
- if (!path101 || !existsSync27(path101)) return void 0;
7954
+ const path103 = getSignalPath();
7955
+ if (!path103 || !existsSync27(path103)) return void 0;
7955
7956
  try {
7956
- return JSON.parse(readFileSync18(path101, "utf8"));
7957
+ return JSON.parse(readFileSync18(path103, "utf8"));
7957
7958
  } catch {
7958
7959
  return void 0;
7959
7960
  }
@@ -8151,13 +8152,13 @@ function activityPath(sessionId) {
8151
8152
  function emitActivity(activity2) {
8152
8153
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8153
8154
  if (!sessionId) return;
8154
- const path101 = activityPath(sessionId);
8155
- mkdirSync9(dirname18(path101), { recursive: true });
8156
- writeFileSync20(path101, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8155
+ const path103 = activityPath(sessionId);
8156
+ mkdirSync9(dirname18(path103), { recursive: true });
8157
+ writeFileSync20(path103, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8157
8158
  }
8158
- function readActivity(path101) {
8159
+ function readActivity(path103) {
8159
8160
  try {
8160
- return JSON.parse(readFileSync19(path101, "utf8"));
8161
+ return JSON.parse(readFileSync19(path103, "utf8"));
8161
8162
  } catch {
8162
8163
  return void 0;
8163
8164
  }
@@ -8167,9 +8168,9 @@ function reconcileActivity(sessionId, activity2) {
8167
8168
  removeActivity(sessionId);
8168
8169
  return;
8169
8170
  }
8170
- const path101 = activityPath(sessionId);
8171
- mkdirSync9(dirname18(path101), { recursive: true });
8172
- writeFileSync20(path101, JSON.stringify(activity2));
8171
+ const path103 = activityPath(sessionId);
8172
+ mkdirSync9(dirname18(path103), { recursive: true });
8173
+ writeFileSync20(path103, JSON.stringify(activity2));
8173
8174
  }
8174
8175
  function removeActivity(sessionId) {
8175
8176
  try {
@@ -10822,10 +10823,10 @@ function getStorePath(filename) {
10822
10823
  return join34(getStoreDir(), filename);
10823
10824
  }
10824
10825
  function loadJson(filename) {
10825
- const path101 = getStorePath(filename);
10826
- if (existsSync32(path101)) {
10826
+ const path103 = getStorePath(filename);
10827
+ if (existsSync32(path103)) {
10827
10828
  try {
10828
- return JSON.parse(readFileSync20(path101, "utf8"));
10829
+ return JSON.parse(readFileSync20(path103, "utf8"));
10829
10830
  } catch {
10830
10831
  return {};
10831
10832
  }
@@ -10844,22 +10845,22 @@ function saveJson(filename, data) {
10844
10845
  var REGISTRY_FILE = "worktrees.json";
10845
10846
  function readWorktreeRegistry() {
10846
10847
  const data = loadJson(REGISTRY_FILE);
10847
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path101, record]) => ({ path: path101, ...record }));
10848
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path103, record]) => ({ path: path103, ...record }));
10848
10849
  }
10849
- function worktreeAttributionIncludingReaped(path101) {
10850
- const record = loadJson(REGISTRY_FILE)[path101];
10850
+ function worktreeAttributionIncludingReaped(path103) {
10851
+ const record = loadJson(REGISTRY_FILE)[path103];
10851
10852
  return record ? { clone: record.clone, origin: record.origin } : void 0;
10852
10853
  }
10853
- function recordWorktree(path101, clone, origin) {
10854
+ function recordWorktree(path103, clone, origin) {
10854
10855
  const data = loadJson(REGISTRY_FILE);
10855
- data[path101] = { clone, origin };
10856
+ data[path103] = { clone, origin };
10856
10857
  saveJson(REGISTRY_FILE, data);
10857
10858
  }
10858
- function forgetWorktree(path101) {
10859
+ function forgetWorktree(path103) {
10859
10860
  const data = loadJson(REGISTRY_FILE);
10860
- const record = data[path101];
10861
+ const record = data[path103];
10861
10862
  if (!record || record.reaped) return;
10862
- data[path101] = { ...record, reaped: true };
10863
+ data[path103] = { ...record, reaped: true };
10863
10864
  saveJson(REGISTRY_FILE, data);
10864
10865
  }
10865
10866
 
@@ -11515,8 +11516,8 @@ async function loadCommittedPaths(cwd, sessionId) {
11515
11516
  for (const commit2 of commits2) {
11516
11517
  const resolved = await resolveCommit(cwd, commit2.sha);
11517
11518
  if (!resolved) continue;
11518
- for (const path101 of resolved.paths) {
11519
- if (!bases.has(path101)) bases.set(path101, resolved.base);
11519
+ for (const path103 of resolved.paths) {
11520
+ if (!bases.has(path103)) bases.set(path103, resolved.base);
11520
11521
  }
11521
11522
  }
11522
11523
  return { commits: commits2, bases };
@@ -11534,16 +11535,16 @@ async function itemChangeSet(cwd, sessionId) {
11534
11535
  }
11535
11536
  function groupByBase(bases) {
11536
11537
  const groups = /* @__PURE__ */ new Map();
11537
- for (const [path101, base] of bases) {
11538
+ for (const [path103, base] of bases) {
11538
11539
  const paths = groups.get(base);
11539
- if (paths) paths.push(path101);
11540
- else groups.set(base, [path101]);
11540
+ if (paths) paths.push(path103);
11541
+ else groups.set(base, [path103]);
11541
11542
  }
11542
11543
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
11543
11544
  }
11544
11545
  async function dirtyPaths(cwd, bases) {
11545
11546
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
11546
- return output.split("\n").filter((path101) => path101 && !bases.has(path101)).sort();
11547
+ return output.split("\n").filter((path103) => path103 && !bases.has(path103)).sort();
11547
11548
  }
11548
11549
 
11549
11550
  // src/commands/sessions/web/scopedDiff.ts
@@ -11552,8 +11553,8 @@ async function scopedDiff(cwd, session, scope) {
11552
11553
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
11553
11554
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
11554
11555
  }
11555
- async function untrackedFileDiff(cwd, path101) {
11556
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path101], {
11556
+ async function untrackedFileDiff(cwd, path103) {
11557
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path103], {
11557
11558
  maxBuffer: MAX_DIFF_BYTES,
11558
11559
  allowFailure: true
11559
11560
  });
@@ -11566,7 +11567,7 @@ async function untrackedDiff(cwd) {
11566
11567
  ]);
11567
11568
  const paths = list5.split("\n").filter(Boolean);
11568
11569
  const diffs = await Promise.all(
11569
- paths.map((path101) => untrackedFileDiff(cwd, path101))
11570
+ paths.map((path103) => untrackedFileDiff(cwd, path103))
11570
11571
  );
11571
11572
  return diffs.join("");
11572
11573
  }
@@ -11659,9 +11660,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
11659
11660
  function repoRoot(cwd) {
11660
11661
  return resolve10(toGitCwd(cwd));
11661
11662
  }
11662
- function resolveWithinCwd(cwd, path101) {
11663
+ function resolveWithinCwd(cwd, path103) {
11663
11664
  const root2 = repoRoot(cwd);
11664
- const target = resolve10(root2, path101);
11665
+ const target = resolve10(root2, path103);
11665
11666
  const rel = relative2(root2, target);
11666
11667
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
11667
11668
  return target;
@@ -11671,14 +11672,14 @@ function resolveWithinCwd(cwd, path101) {
11671
11672
  function getFileTarget(req, res) {
11672
11673
  const cwd = getCwdParam(req, res);
11673
11674
  if (!cwd) return null;
11674
- const path101 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11675
+ const path103 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11675
11676
  "path"
11676
11677
  );
11677
- if (!path101) {
11678
+ if (!path103) {
11678
11679
  respondJson(res, 400, { error: "Missing path" });
11679
11680
  return null;
11680
11681
  }
11681
- const target = resolveWithinCwd(cwd, path101);
11682
+ const target = resolveWithinCwd(cwd, path103);
11682
11683
  if (!target) {
11683
11684
  respondJson(res, 400, { error: "Path outside cwd" });
11684
11685
  return null;
@@ -11767,9 +11768,9 @@ function segmentText(segment) {
11767
11768
  if (segment.kind === "index") return `[${segment.index}]`;
11768
11769
  return "[]";
11769
11770
  }
11770
- function formatConfigPath(path101) {
11771
+ function formatConfigPath(path103) {
11771
11772
  let text18 = "";
11772
- for (const segment of path101) {
11773
+ for (const segment of path103) {
11773
11774
  const dotted = segment.kind === "key" || segment.kind === "entry";
11774
11775
  const rendered = segmentText(segment);
11775
11776
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -11930,11 +11931,11 @@ function enumValues(node) {
11930
11931
  function opaqueConfigNode(inner, base) {
11931
11932
  return { ...base, kind: "other", type: leafTypeOf(inner) };
11932
11933
  }
11933
- function build(node, path101) {
11934
+ function build(node, path103) {
11934
11935
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
11935
11936
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
11936
11937
  const base = {
11937
- path: path101,
11938
+ path: path103,
11938
11939
  ...optional ? { optional: true } : {},
11939
11940
  ...defaultValue === void 0 ? {} : { defaultValue },
11940
11941
  ...secret ? { secret: true } : {}
@@ -11990,11 +11991,11 @@ function describeConfigLeaves(schema2) {
11990
11991
 
11991
11992
  // src/commands/config/globalConfigFileLabel.ts
11992
11993
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
11993
- function globalConfigFileLabel(path101) {
11994
- if (path101 === getGlobalConfigPath()) return "~/.assist.yml";
11995
- if (path101.startsWith(WINDOWS_MOUNT_PREFIX))
11996
- return `${path101} on the Windows host`;
11997
- return path101;
11994
+ function globalConfigFileLabel(path103) {
11995
+ if (path103 === getGlobalConfigPath()) return "~/.assist.yml";
11996
+ if (path103.startsWith(WINDOWS_MOUNT_PREFIX))
11997
+ return `${path103} on the Windows host`;
11998
+ return path103;
11998
11999
  }
11999
12000
 
12000
12001
  // src/commands/config/readRawConfigLayers.ts
@@ -12051,35 +12052,35 @@ function isPlainRecord(value) {
12051
12052
  }
12052
12053
 
12053
12054
  // src/shared/mapConfigSecrets.ts
12054
- function mapChildren(value, path101, childNode, map) {
12055
+ function mapChildren(value, path103, childNode, map) {
12055
12056
  if (!isPlainRecord(value)) return value;
12056
12057
  return Object.fromEntries(
12057
12058
  Object.entries(value).map(([name, child]) => [
12058
12059
  name,
12059
- walk(child, [...path101, name], childNode(name), map)
12060
+ walk(child, [...path103, name], childNode(name), map)
12060
12061
  ])
12061
12062
  );
12062
12063
  }
12063
- function mapItems(value, path101, item, map) {
12064
+ function mapItems(value, path103, item, map) {
12064
12065
  if (!Array.isArray(value)) return value;
12065
- return value.map((entry, index3) => walk(entry, [...path101, index3], item, map));
12066
+ return value.map((entry, index3) => walk(entry, [...path103, index3], item, map));
12066
12067
  }
12067
- function walk(value, path101, node, map) {
12068
+ function walk(value, path103, node, map) {
12068
12069
  if (!node || value === void 0 || value === null) return value;
12069
- if (node.secret) return map(value, path101);
12070
+ if (node.secret) return map(value, path103);
12070
12071
  switch (node.kind) {
12071
12072
  case "object":
12072
12073
  case "unionOfObjects":
12073
12074
  return mapChildren(
12074
12075
  value,
12075
- path101,
12076
+ path103,
12076
12077
  (name) => configNodeField(node, name),
12077
12078
  map
12078
12079
  );
12079
12080
  case "objectList":
12080
- return mapItems(value, path101, node.item, map);
12081
+ return mapItems(value, path103, node.item, map);
12081
12082
  case "record":
12082
- return mapChildren(value, path101, () => node.value, map);
12083
+ return mapChildren(value, path103, () => node.value, map);
12083
12084
  default:
12084
12085
  return value;
12085
12086
  }
@@ -12104,9 +12105,9 @@ function isTraversable(value) {
12104
12105
  function stepInto(current, key) {
12105
12106
  return isTraversable(current) ? current[key] : void 0;
12106
12107
  }
12107
- function getNestedValue(obj, path101) {
12108
+ function getNestedValue(obj, path103) {
12108
12109
  let current = obj;
12109
- for (const key of path101.split(".")) current = stepInto(current, key);
12110
+ for (const key of path103.split(".")) current = stepInto(current, key);
12110
12111
  return current;
12111
12112
  }
12112
12113
 
@@ -12156,9 +12157,9 @@ function step(node, segment) {
12156
12157
  return void 0;
12157
12158
  }
12158
12159
  }
12159
- function findConfigNode(root2, path101) {
12160
+ function findConfigNode(root2, path103) {
12160
12161
  let current = root2;
12161
- for (const segment of path101) {
12162
+ for (const segment of path103) {
12162
12163
  if (!current) return void 0;
12163
12164
  current = step(current, segment);
12164
12165
  }
@@ -12175,34 +12176,34 @@ function nameSegment(name) {
12175
12176
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
12176
12177
  }
12177
12178
  function parseConfigPath(text18) {
12178
- const path101 = [];
12179
+ const path103 = [];
12179
12180
  let at2 = 0;
12180
12181
  while (at2 < text18.length) {
12181
12182
  if (text18[at2] === "[") {
12182
12183
  const close = text18.indexOf("]", at2);
12183
12184
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
12184
12185
  if (!segment) return void 0;
12185
- path101.push(segment);
12186
+ path103.push(segment);
12186
12187
  at2 = close + 1;
12187
12188
  continue;
12188
12189
  }
12189
12190
  if (text18[at2] === ".") {
12190
- if (path101.length === 0) return void 0;
12191
+ if (path103.length === 0) return void 0;
12191
12192
  at2 += 1;
12192
12193
  }
12193
12194
  const start3 = at2;
12194
12195
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
12195
12196
  const name = text18.slice(start3, at2);
12196
12197
  if (!name) return void 0;
12197
- path101.push(nameSegment(name));
12198
+ path103.push(nameSegment(name));
12198
12199
  }
12199
- return path101;
12200
+ return path103;
12200
12201
  }
12201
12202
 
12202
12203
  // src/commands/config/configEntryNode.ts
12203
12204
  function configEntryNode(root2, key) {
12204
- const path101 = parseConfigPath(key);
12205
- return path101 ? findConfigNode(root2, path101) : void 0;
12205
+ const path103 = parseConfigPath(key);
12206
+ return path103 ? findConfigNode(root2, path103) : void 0;
12206
12207
  }
12207
12208
 
12208
12209
  // src/commands/backlog/harnessConfigHelp.ts
@@ -12419,6 +12420,11 @@ var refactorConfigHelp = [
12419
12420
  key: "restructure.ignore",
12420
12421
  setter: 'assist config set restructure.ignore "src/generated/**"',
12421
12422
  note: "globs (relative to cwd) of files restructure never moves; they are treated as outside the root"
12423
+ },
12424
+ {
12425
+ key: "restructure.pin",
12426
+ setter: 'assist config set restructure.pin "SessionCard"',
12427
+ note: "module names (basename without extension) restructure lifts out of deep import chains into the folder of the nearest root or pinned module above them, together with their subtrees"
12422
12428
  }
12423
12429
  ];
12424
12430
 
@@ -12927,7 +12933,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
12927
12933
  const parent = dirname22(branchKeyPath);
12928
12934
  const branchPrefix = basename10(branchKeyPath);
12929
12935
  if (!existsSync35(parent)) return null;
12930
- const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path101) => existsSync35(path101)).map((path101) => ({ path: path101, mtime: statSync5(path101).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
12936
+ const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path103) => existsSync35(path103)).map((path103) => ({ path: path103, mtime: statSync5(path103).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
12931
12937
  return synthesisFiles[0]?.path ?? null;
12932
12938
  }
12933
12939
 
@@ -12957,12 +12963,12 @@ async function getReviewSynthesis(req, res) {
12957
12963
  const cwd = getCwdParam(req, res);
12958
12964
  if (!cwd) return;
12959
12965
  try {
12960
- const path101 = await resolveSynthesisPath(cwd);
12961
- if (!path101) {
12966
+ const path103 = await resolveSynthesisPath(cwd);
12967
+ if (!path103) {
12962
12968
  respondJson(res, 404, { error: "No synthesis found" });
12963
12969
  return;
12964
12970
  }
12965
- respondJson(res, 200, { synthesis: readFileSync22(path101, "utf8") });
12971
+ respondJson(res, 200, { synthesis: readFileSync22(path103, "utf8") });
12966
12972
  } catch {
12967
12973
  respondJson(res, 404, { error: "No synthesis found" });
12968
12974
  }
@@ -13045,8 +13051,8 @@ function parseDiffNameStatus(output) {
13045
13051
  if (!status3 || fields.length < 2) continue;
13046
13052
  const category = categorize(status3[0]);
13047
13053
  if (!category) continue;
13048
- const path101 = fields[fields.length - 1];
13049
- if (path101) result[category].push(path101);
13054
+ const path103 = fields[fields.length - 1];
13055
+ if (path103) result[category].push(path103);
13050
13056
  }
13051
13057
  return result;
13052
13058
  }
@@ -13182,21 +13188,21 @@ function subsequenceScore(text18, query) {
13182
13188
  }
13183
13189
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13184
13190
  }
13185
- function scoreFilePath(path101, query) {
13191
+ function scoreFilePath(path103, query) {
13186
13192
  const needle = query.trim().toLowerCase();
13187
13193
  if (!needle) return 0;
13188
- const basename30 = path101.slice(path101.lastIndexOf("/") + 1);
13194
+ const basename30 = path103.slice(path103.lastIndexOf("/") + 1);
13189
13195
  const inBasename = subsequenceScore(basename30, needle);
13190
13196
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13191
- return subsequenceScore(path101, needle);
13197
+ return subsequenceScore(path103, needle);
13192
13198
  }
13193
13199
 
13194
13200
  // src/commands/sessions/web/rankFilePaths.ts
13195
13201
  function rankFilePaths(paths, query, limit) {
13196
13202
  const scored = [];
13197
- for (const path101 of paths) {
13198
- const score = scoreFilePath(path101, query);
13199
- if (score !== null) scored.push({ path: path101, score });
13203
+ for (const path103 of paths) {
13204
+ const score = scoreFilePath(path103, query);
13205
+ if (score !== null) scored.push({ path: path103, score });
13200
13206
  }
13201
13207
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
13202
13208
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -13910,6 +13916,20 @@ async function prStatus(req, res) {
13910
13916
  respondJson(res, 200, { pr });
13911
13917
  }
13912
13918
 
13919
+ // src/commands/sessions/web/releases/releasesConfigured.ts
13920
+ function releasesConfigured(req, res) {
13921
+ const cwd = getCwdParam(req, res);
13922
+ if (!cwd) return;
13923
+ try {
13924
+ const streams = loadConfigFrom(toGitCwd(cwd)).releases?.streams ?? [];
13925
+ respondJson(res, 200, { configured: streams.length > 0 });
13926
+ } catch (error) {
13927
+ respondJson(res, 500, {
13928
+ error: error instanceof Error ? error.message : "Failed to read config"
13929
+ });
13930
+ }
13931
+ }
13932
+
13913
13933
  // src/commands/sessions/web/releases/streamEnvironments.ts
13914
13934
  function streamEnvironments(stream) {
13915
13935
  return stream.nodes.flatMap(
@@ -14146,8 +14166,8 @@ async function liveDeployments(cwd, repo, environments) {
14146
14166
 
14147
14167
  // src/commands/sessions/web/releases/latestRun.ts
14148
14168
  async function latestRun(cwd, repo, workflow) {
14149
- const path101 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14150
- const response = await ghJson(cwd, ["api", path101]);
14169
+ const path103 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14170
+ const response = await ghJson(cwd, ["api", path103]);
14151
14171
  const run4 = response.workflow_runs?.[0];
14152
14172
  if (!run4) return null;
14153
14173
  return {
@@ -14210,18 +14230,18 @@ function mostSpecificFirst(nodes) {
14210
14230
  (a, b) => (b.tokens[0]?.length ?? 0) - (a.tokens[0]?.length ?? 0) || a.index - b.index
14211
14231
  );
14212
14232
  }
14213
- function firstUnclaimed(names2, claimed, tokens) {
14233
+ function firstUnclaimed(names, claimed, tokens) {
14214
14234
  for (const token of tokens)
14215
- for (const [index3, name] of names2.entries())
14235
+ for (const [index3, name] of names.entries())
14216
14236
  if (!claimed.has(index3) && name.includes(token)) return index3;
14217
14237
  return void 0;
14218
14238
  }
14219
14239
  function matchRunJobs(nodes, jobs) {
14220
- const names2 = jobs.map((job) => normaliseJobName(job.name));
14240
+ const names = jobs.map((job) => normaliseJobName(job.name));
14221
14241
  const claimed = /* @__PURE__ */ new Set();
14222
14242
  const matched = /* @__PURE__ */ new Map();
14223
14243
  for (const { node, tokens } of mostSpecificFirst(nodes)) {
14224
- const hit = firstUnclaimed(names2, claimed, tokens);
14244
+ const hit = firstUnclaimed(names, claimed, tokens);
14225
14245
  const job = hit === void 0 ? void 0 : jobs[hit];
14226
14246
  if (hit !== void 0) claimed.add(hit);
14227
14247
  matched.set(node.id, job ? runJobState(job) : UNREACHED_BY_RUN);
@@ -14423,38 +14443,38 @@ async function restartWeb(req, res, deps2 = {}) {
14423
14443
  import { relative as relative3 } from "path";
14424
14444
 
14425
14445
  // src/commands/sessions/web/revertPathChanges.ts
14426
- async function isTracked(cwd, path101) {
14446
+ async function isTracked(cwd, path103) {
14427
14447
  try {
14428
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path101]);
14448
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path103]);
14429
14449
  return true;
14430
14450
  } catch {
14431
14451
  return false;
14432
14452
  }
14433
14453
  }
14434
- async function isInHead(cwd, path101) {
14435
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path101]);
14454
+ async function isInHead(cwd, path103) {
14455
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path103]);
14436
14456
  return listing.trim().length > 0;
14437
14457
  }
14438
- async function revertPathChanges(cwd, path101) {
14439
- if (!await isTracked(cwd, path101)) {
14440
- await execGit(cwd, ["clean", "-f", "--", path101]);
14458
+ async function revertPathChanges(cwd, path103) {
14459
+ if (!await isTracked(cwd, path103)) {
14460
+ await execGit(cwd, ["clean", "-f", "--", path103]);
14441
14461
  return;
14442
14462
  }
14443
- if (await isInHead(cwd, path101)) {
14444
- await execGit(cwd, ["checkout", "HEAD", "--", path101]);
14463
+ if (await isInHead(cwd, path103)) {
14464
+ await execGit(cwd, ["checkout", "HEAD", "--", path103]);
14445
14465
  return;
14446
14466
  }
14447
- await execGit(cwd, ["rm", "-f", "--", path101]);
14467
+ await execGit(cwd, ["rm", "-f", "--", path103]);
14448
14468
  }
14449
14469
 
14450
14470
  // src/commands/sessions/web/revertDiffFile.ts
14451
14471
  async function revertDiffFile(req, res) {
14452
14472
  const resolved = getFileTarget(req, res);
14453
14473
  if (!resolved) return;
14454
- const path101 = relative3(repoRoot(resolved.cwd), resolved.target);
14474
+ const path103 = relative3(repoRoot(resolved.cwd), resolved.target);
14455
14475
  try {
14456
- await revertPathChanges(resolved.cwd, path101);
14457
- respondJson(res, 200, { reverted: path101 });
14476
+ await revertPathChanges(resolved.cwd, path103);
14477
+ respondJson(res, 200, { reverted: path103 });
14458
14478
  } catch (error) {
14459
14479
  respondJson(res, 500, {
14460
14480
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -14476,7 +14496,7 @@ async function readJsonBody(req) {
14476
14496
  function requestedPaths(body) {
14477
14497
  const paths = body.paths;
14478
14498
  if (!Array.isArray(paths)) return null;
14479
- if (paths.some((path101) => typeof path101 !== "string")) return null;
14499
+ if (paths.some((path103) => typeof path103 !== "string")) return null;
14480
14500
  return paths;
14481
14501
  }
14482
14502
  async function revertDiffPaths(req, res) {
@@ -14496,10 +14516,10 @@ async function revertDiffPaths(req, res) {
14496
14516
  const root2 = repoRoot(cwd);
14497
14517
  const reverted = [];
14498
14518
  const failed2 = [];
14499
- for (const path101 of paths) {
14500
- const target = resolveWithinCwd(cwd, path101);
14519
+ for (const path103 of paths) {
14520
+ const target = resolveWithinCwd(cwd, path103);
14501
14521
  if (!target) {
14502
- failed2.push({ path: path101, error: "Path outside cwd" });
14522
+ failed2.push({ path: path103, error: "Path outside cwd" });
14503
14523
  continue;
14504
14524
  }
14505
14525
  const relativePath = relative4(root2, target);
@@ -14589,11 +14609,11 @@ function coerceStructuredConfigValue(key, raw) {
14589
14609
  };
14590
14610
  }
14591
14611
  function formatIssue(key, issue) {
14592
- const path101 = formatConfigPath([
14612
+ const path103 = formatConfigPath([
14593
14613
  { kind: "key", name: key },
14594
14614
  ...issue.path.map(toSegment)
14595
14615
  ]);
14596
- return `${path101}: ${issue.message}`;
14616
+ return `${path103}: ${issue.message}`;
14597
14617
  }
14598
14618
  function toSegment(part) {
14599
14619
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -14688,9 +14708,9 @@ function coerceUnion(key, raw, types) {
14688
14708
  }
14689
14709
 
14690
14710
  // src/shared/valueAtConfigPath.ts
14691
- function valueAtConfigPath(value, path101) {
14711
+ function valueAtConfigPath(value, path103) {
14692
14712
  let current = value;
14693
- for (const key of path101) {
14713
+ for (const key of path103) {
14694
14714
  if (typeof key === "number") {
14695
14715
  if (!Array.isArray(current)) return void 0;
14696
14716
  current = current[key];
@@ -14707,7 +14727,7 @@ function restoreConfigSecrets(value, stored, node) {
14707
14727
  return mapConfigSecrets(
14708
14728
  value,
14709
14729
  node,
14710
- (secret, path101) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path101) : secret
14730
+ (secret, path103) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path103) : secret
14711
14731
  );
14712
14732
  }
14713
14733
 
@@ -14756,8 +14776,8 @@ function stepIntoNested(container, key, nextKey) {
14756
14776
  }
14757
14777
  return ensureObject(container, resolved);
14758
14778
  }
14759
- function setNestedValue(obj, path101, value) {
14760
- const keys = path101.split(".");
14779
+ function setNestedValue(obj, path103, value) {
14780
+ const keys = path103.split(".");
14761
14781
  const result = { ...obj };
14762
14782
  let current = result;
14763
14783
  for (let i = 0; i < keys.length - 1; i++) {
@@ -14784,8 +14804,8 @@ function formatIssue2(issue, key) {
14784
14804
  return issue.keys.map(
14785
14805
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
14786
14806
  );
14787
- const path101 = issue.path.length > 0 ? issue.path.join(".") : key;
14788
- return [`${path101}: ${issue.message}`];
14807
+ const path103 = issue.path.length > 0 ? issue.path.join(".") : key;
14808
+ return [`${path103}: ${issue.message}`];
14789
14809
  }
14790
14810
 
14791
14811
  // src/commands/config/applyConfigSet.ts
@@ -15047,8 +15067,8 @@ function removeAt(container, keys) {
15047
15067
  }
15048
15068
  return removeFromChild(container, key, rest);
15049
15069
  }
15050
- function unsetNestedValue(obj, path101) {
15051
- const { container, removed } = removeAt(obj, path101.split("."));
15070
+ function unsetNestedValue(obj, path103) {
15071
+ const { container, removed } = removeAt(obj, path103.split("."));
15052
15072
  return { config: container, removed };
15053
15073
  }
15054
15074
 
@@ -15452,6 +15472,7 @@ var routes2 = {
15452
15472
  "GET /api/pr-list": prList,
15453
15473
  "GET /api/news/items": listNewsItems,
15454
15474
  "GET /api/releases/state": releasesState,
15475
+ "GET /api/releases/configured": releasesConfigured,
15455
15476
  "GET /api/usage/history": listUsageHistory,
15456
15477
  "GET /api/usage/items": listUsageItems,
15457
15478
  "GET /api/backups/list": getBackups,
@@ -16615,13 +16636,13 @@ function findBuiltinDenyRaw(rawCommand) {
16615
16636
 
16616
16637
  // src/commands/cliHook/findRestrictedPathDeny.ts
16617
16638
  var RESTRICTED_PATHS = [".assist/restricted"];
16618
- function restrictedPathRegex(path101) {
16619
- const pattern2 = path101.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
16639
+ function restrictedPathRegex(path103) {
16640
+ const pattern2 = path103.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
16620
16641
  return new RegExp(pattern2);
16621
16642
  }
16622
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path101) => ({
16623
- path: path101,
16624
- regex: restrictedPathRegex(path101)
16643
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path103) => ({
16644
+ path: path103,
16645
+ regex: restrictedPathRegex(path103)
16625
16646
  }));
16626
16647
  function findRestrictedPathDenyRaw(rawCommand) {
16627
16648
  const rule = RESTRICTED_PATH_RULES.find(
@@ -16798,9 +16819,9 @@ var __dirname4 = dirname24(__filename3);
16798
16819
  function packageRoot() {
16799
16820
  return __dirname4;
16800
16821
  }
16801
- function readLines(path101) {
16802
- if (!existsSync39(path101)) return [];
16803
- return readFileSync25(path101, "utf8").split("\n").filter((line) => line.trim() !== "");
16822
+ function readLines(path103) {
16823
+ if (!existsSync39(path103)) return [];
16824
+ return readFileSync25(path103, "utf8").split("\n").filter((line) => line.trim() !== "");
16804
16825
  }
16805
16826
  var cachedReads;
16806
16827
  var cachedWrites;
@@ -17325,14 +17346,14 @@ function showProgress(p, label2) {
17325
17346
  const pct = Math.round(p.done / p.total * 100);
17326
17347
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
17327
17348
  }
17328
- async function resolveCommand(cli, path101, description, depth, p) {
17329
- showProgress(p, path101.join(" "));
17330
- const subHelp = await runHelp([cli, ...path101]);
17349
+ async function resolveCommand(cli, path103, description, depth, p) {
17350
+ showProgress(p, path103.join(" "));
17351
+ const subHelp = await runHelp([cli, ...path103]);
17331
17352
  if (!subHelp || !hasSubcommands(subHelp)) {
17332
- return [{ path: path101, description }];
17353
+ return [{ path: path103, description }];
17333
17354
  }
17334
- const children = await discoverAt(cli, path101, depth + 1, p);
17335
- return children.length > 0 ? children : [{ path: path101, description }];
17355
+ const children = await discoverAt(cli, path103, depth + 1, p);
17356
+ return children.length > 0 ? children : [{ path: path103, description }];
17336
17357
  }
17337
17358
  async function discoverAt(cli, parentPath, depth, p) {
17338
17359
  if (depth > SAFETY_DEPTH) return [];
@@ -17480,9 +17501,9 @@ function logPath(cli) {
17480
17501
  return join42(homedir17(), ".assist", `cli-discover-${safeName}.log`);
17481
17502
  }
17482
17503
  function readCache(cli) {
17483
- const path101 = logPath(cli);
17484
- if (!existsSync41(path101)) return void 0;
17485
- return readFileSync27(path101, "utf8");
17504
+ const path103 = logPath(cli);
17505
+ if (!existsSync41(path103)) return void 0;
17506
+ return readFileSync27(path103, "utf8");
17486
17507
  }
17487
17508
  function writeCache(cli, output) {
17488
17509
  const dir = join42(homedir17(), ".assist");
@@ -17654,8 +17675,8 @@ import { join as join43 } from "path";
17654
17675
  function getRestrictedDir() {
17655
17676
  return join43(homedir18(), ".assist", "restricted");
17656
17677
  }
17657
- function getPinStatePath(pin) {
17658
- return join43(getRestrictedDir(), `code-comment-${pin}.json`);
17678
+ function getPinStatePath(pin2) {
17679
+ return join43(getRestrictedDir(), `code-comment-${pin2}.json`);
17659
17680
  }
17660
17681
 
17661
17682
  // src/commands/codeComment/sweepRestrictedDir.ts
@@ -17671,9 +17692,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
17671
17692
  }
17672
17693
  const cutoff = Date.now() - STALE_AFTER_MS;
17673
17694
  for (const entry of entries) {
17674
- const path101 = join44(dir, entry);
17695
+ const path103 = join44(dir, entry);
17675
17696
  try {
17676
- if (statSync7(path101).mtimeMs < cutoff) unlinkSync7(path101);
17697
+ if (statSync7(path103).mtimeMs < cutoff) unlinkSync7(path103);
17677
17698
  } catch {
17678
17699
  continue;
17679
17700
  }
@@ -17682,12 +17703,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
17682
17703
 
17683
17704
  // src/commands/codeComment/readPinState.ts
17684
17705
  import { existsSync as existsSync42, readFileSync as readFileSync28 } from "fs";
17685
- function readPinState(pin) {
17686
- const path101 = getPinStatePath(pin);
17687
- if (!existsSync42(path101)) return void 0;
17706
+ function readPinState(pin2) {
17707
+ const path103 = getPinStatePath(pin2);
17708
+ if (!existsSync42(path103)) return void 0;
17688
17709
  try {
17689
- const state = JSON.parse(readFileSync28(path101, "utf8"));
17690
- if (state.pin !== pin) return void 0;
17710
+ const state = JSON.parse(readFileSync28(path103, "utf8"));
17711
+ if (state.pin !== pin2) return void 0;
17691
17712
  return state;
17692
17713
  } catch {
17693
17714
  return void 0;
@@ -17695,11 +17716,11 @@ function readPinState(pin) {
17695
17716
  }
17696
17717
 
17697
17718
  // src/commands/codeComment/codeCommentConfirm.ts
17698
- function codeCommentConfirm(pin) {
17719
+ function codeCommentConfirm(pin2) {
17699
17720
  sweepRestrictedDir();
17700
- const state = readPinState(pin);
17721
+ const state = readPinState(pin2);
17701
17722
  if (!state) {
17702
- console.error(chalk119.red(`No pending comment for pin: ${pin}`));
17723
+ console.error(chalk119.red(`No pending comment for pin: ${pin2}`));
17703
17724
  process.exitCode = 1;
17704
17725
  return;
17705
17726
  }
@@ -17725,7 +17746,7 @@ function codeCommentConfirm(pin) {
17725
17746
  const indent3 = indentSource.match(/^\s*/)?.[0] ?? "";
17726
17747
  lines2.splice(index3, 0, `${indent3}${marker2} ${state.text}`);
17727
17748
  writeFileSync24(state.file, lines2.join("\n"));
17728
- unlinkSync8(getPinStatePath(pin));
17749
+ unlinkSync8(getPinStatePath(pin2));
17729
17750
  console.log(
17730
17751
  chalk119.green(
17731
17752
  `Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
@@ -17822,16 +17843,16 @@ function showNotification(options2) {
17822
17843
 
17823
17844
  // src/commands/codeComment/issuePin.ts
17824
17845
  function issuePin(file, lineNumber, text18) {
17825
- const pin = generatePin();
17846
+ const pin2 = generatePin();
17826
17847
  mkdirSync14(getRestrictedDir(), { recursive: true });
17827
17848
  sweepRestrictedDir();
17828
17849
  writeFileSync25(
17829
- getPinStatePath(pin),
17830
- JSON.stringify({ pin, file, line: lineNumber, text: text18 })
17850
+ getPinStatePath(pin2),
17851
+ JSON.stringify({ pin: pin2, file, line: lineNumber, text: text18 })
17831
17852
  );
17832
17853
  return showNotification({
17833
17854
  title: "assist code-comment pin",
17834
- message: `Pin ${pin} \u2014 run: assist code-comment confirm ${pin}`
17855
+ message: `Pin ${pin2} \u2014 run: assist code-comment confirm ${pin2}`
17835
17856
  });
17836
17857
  }
17837
17858
  function generatePin() {
@@ -18107,8 +18128,8 @@ function findUnmergedPaths() {
18107
18128
  }
18108
18129
  const found = /* @__PURE__ */ new Set();
18109
18130
  for (const line of output.split("\n")) {
18110
- const path101 = line.split(" ")[1];
18111
- if (path101) found.add(path101.trim());
18131
+ const path103 = line.split(" ")[1];
18132
+ if (path103) found.add(path103.trim());
18112
18133
  }
18113
18134
  return [...found];
18114
18135
  }
@@ -19355,11 +19376,11 @@ async function loadPath(source) {
19355
19376
  }
19356
19377
  }
19357
19378
  async function criteriaExtension() {
19358
- const path101 = await loadPath(criteriaExtensionDir());
19379
+ const path103 = await loadPath(criteriaExtensionDir());
19359
19380
  console.log(
19360
19381
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
19361
19382
  );
19362
- console.log(chalk137.dim(`load the unpacked extension from ${path101}`));
19383
+ console.log(chalk137.dim(`load the unpacked extension from ${path103}`));
19363
19384
  }
19364
19385
 
19365
19386
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -19484,10 +19505,10 @@ async function signCriteriaExtension() {
19484
19505
  process.exitCode = 1;
19485
19506
  return;
19486
19507
  }
19487
- const path101 = await signedAddonInstallPath(
19508
+ const path103 = await signedAddonInstallPath(
19488
19509
  await copySignedXpi(xpi, ARTIFACTS_DIR)
19489
19510
  );
19490
- console.log(chalk139.dim(`install the signed add-on from ${path101}`));
19511
+ console.log(chalk139.dim(`install the signed add-on from ${path103}`));
19491
19512
  }
19492
19513
 
19493
19514
  // src/commands/registerCriteriaExtension.ts
@@ -19575,8 +19596,8 @@ import chalk141 from "chalk";
19575
19596
 
19576
19597
  // src/commands/dbMigration/getMigrationPinPath.ts
19577
19598
  import { join as join51 } from "path";
19578
- function getMigrationPinPath(pin) {
19579
- return join51(getRestrictedDir(), `db-migration-pin-${pin}.json`);
19599
+ function getMigrationPinPath(pin2) {
19600
+ return join51(getRestrictedDir(), `db-migration-pin-${pin2}.json`);
19580
19601
  }
19581
19602
  function getMigrationApprovalPath(migrationId) {
19582
19603
  return join51(getRestrictedDir(), `db-migration-approval-${migrationId}.json`);
@@ -19584,12 +19605,12 @@ function getMigrationApprovalPath(migrationId) {
19584
19605
 
19585
19606
  // src/commands/dbMigration/readMigrationPinState.ts
19586
19607
  import { existsSync as existsSync47, readFileSync as readFileSync30 } from "fs";
19587
- function readMigrationPinState(pin) {
19588
- const path101 = getMigrationPinPath(pin);
19589
- if (!existsSync47(path101)) return void 0;
19608
+ function readMigrationPinState(pin2) {
19609
+ const path103 = getMigrationPinPath(pin2);
19610
+ if (!existsSync47(path103)) return void 0;
19590
19611
  try {
19591
- const state = JSON.parse(readFileSync30(path101, "utf8"));
19592
- if (state.pin !== pin) return void 0;
19612
+ const state = JSON.parse(readFileSync30(path103, "utf8"));
19613
+ if (state.pin !== pin2) return void 0;
19593
19614
  if (!Number.isInteger(state.migrationId)) return void 0;
19594
19615
  return state;
19595
19616
  } catch {
@@ -19598,11 +19619,11 @@ function readMigrationPinState(pin) {
19598
19619
  }
19599
19620
 
19600
19621
  // src/commands/dbMigration/dbMigrationConfirm.ts
19601
- function dbMigrationConfirm(pin) {
19622
+ function dbMigrationConfirm(pin2) {
19602
19623
  sweepRestrictedDir();
19603
- const state = readMigrationPinState(pin);
19624
+ const state = readMigrationPinState(pin2);
19604
19625
  if (!state) {
19605
- console.error(chalk141.red(`No pending migration unlock for pin: ${pin}`));
19626
+ console.error(chalk141.red(`No pending migration unlock for pin: ${pin2}`));
19606
19627
  process.exitCode = 1;
19607
19628
  return;
19608
19629
  }
@@ -19610,7 +19631,7 @@ function dbMigrationConfirm(pin) {
19610
19631
  getMigrationApprovalPath(state.migrationId),
19611
19632
  JSON.stringify({ migrationId: state.migrationId })
19612
19633
  );
19613
- unlinkSync9(getMigrationPinPath(pin));
19634
+ unlinkSync9(getMigrationPinPath(pin2));
19614
19635
  console.log(
19615
19636
  chalk141.green(
19616
19637
  `Approved creation of migration ${state.migrationId}. The next write of that migration module will be allowed once.`
@@ -19631,10 +19652,10 @@ function nextMigrationId() {
19631
19652
  // src/commands/dbMigration/dbMigrationUnlock.ts
19632
19653
  function dbMigrationUnlock() {
19633
19654
  const migrationId = nextMigrationId();
19634
- const pin = randomInt2(0, 1e3).toString().padStart(3, "0");
19655
+ const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
19635
19656
  mkdirSync15(getRestrictedDir(), { recursive: true });
19636
19657
  sweepRestrictedDir();
19637
- writeFileSync27(getMigrationPinPath(pin), JSON.stringify({ pin, migrationId }));
19658
+ writeFileSync27(getMigrationPinPath(pin2), JSON.stringify({ pin: pin2, migrationId }));
19638
19659
  console.error(
19639
19660
  chalk142.yellow.bold(
19640
19661
  "THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
@@ -19642,7 +19663,7 @@ function dbMigrationUnlock() {
19642
19663
  );
19643
19664
  const delivered = showNotification({
19644
19665
  title: "assist db-migration pin",
19645
- message: `Pin ${pin} \u2014 run: assist db-migration confirm ${pin}`
19666
+ message: `Pin ${pin2} \u2014 run: assist db-migration confirm ${pin2}`
19646
19667
  });
19647
19668
  if (!delivered) {
19648
19669
  console.error(
@@ -21397,10 +21418,10 @@ function decideCommentGuard(input, existingContent) {
21397
21418
  import { existsSync as existsSync53, unlinkSync as unlinkSync11 } from "fs";
21398
21419
  function consumeMigrationApproval(migrationId) {
21399
21420
  sweepRestrictedDir();
21400
- const path101 = getMigrationApprovalPath(migrationId);
21401
- if (!existsSync53(path101)) return false;
21421
+ const path103 = getMigrationApprovalPath(migrationId);
21422
+ if (!existsSync53(path103)) return false;
21402
21423
  try {
21403
- unlinkSync11(path101);
21424
+ unlinkSync11(path103);
21404
21425
  return true;
21405
21426
  } catch {
21406
21427
  return false;
@@ -22541,7 +22562,7 @@ var QUERY5 = `query($owner: String!, $repo: String!, $after: String) {
22541
22562
  }
22542
22563
  }`;
22543
22564
  function readRepoLabels(target) {
22544
- const names2 = [];
22565
+ const names = [];
22545
22566
  let after;
22546
22567
  do {
22547
22568
  const page = JSON.parse(
@@ -22552,22 +22573,22 @@ function readRepoLabels(target) {
22552
22573
  `No labels could be read for ${target.owner}/${target.repo}`
22553
22574
  );
22554
22575
  }
22555
- for (const node of page.nodes ?? []) if (node?.name) names2.push(node.name);
22576
+ for (const node of page.nodes ?? []) if (node?.name) names.push(node.name);
22556
22577
  after = page.pageInfo?.hasNextPage ? page.pageInfo.endCursor ?? void 0 : void 0;
22557
22578
  } while (after);
22558
- return names2;
22579
+ return names;
22559
22580
  }
22560
- function matchLabel(names2, wanted) {
22581
+ function matchLabel(names, wanted) {
22561
22582
  const normalised = normaliseTypeName(wanted);
22562
- return names2.find((name) => name === wanted) ?? names2.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names2.find((name) => normaliseTypeName(name) === normalised);
22583
+ return names.find((name) => name === wanted) ?? names.find((name) => name.toLowerCase() === wanted.toLowerCase()) ?? names.find((name) => normaliseTypeName(name) === normalised);
22563
22584
  }
22564
22585
  function resolveIssueLabels(target, wanted) {
22565
- const names2 = readRepoLabels(target);
22586
+ const names = readRepoLabels(target);
22566
22587
  return wanted.map((label2) => {
22567
- const match = matchLabel(names2, label2);
22588
+ const match = matchLabel(names, label2);
22568
22589
  if (!match) {
22569
22590
  throw new Error(
22570
- `${target.owner}/${target.repo} has no ${label2} label. It has ${names2.join(", ")}`
22591
+ `${target.owner}/${target.repo} has no ${label2} label. It has ${names.join(", ")}`
22571
22592
  );
22572
22593
  }
22573
22594
  return match;
@@ -23280,9 +23301,9 @@ function moveItem(item) {
23280
23301
  (candidate) => candidate.name.toLowerCase() === IN_PROGRESS
23281
23302
  );
23282
23303
  if (!option) {
23283
- const names2 = statusField.options.map((candidate) => candidate.name);
23304
+ const names = statusField.options.map((candidate) => candidate.name);
23284
23305
  console.log(
23285
- `The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names2.join(", ") || "no options"}`
23306
+ `The Status field on ${boardName(item)} has no In Progress option, so it was not moved. It offers ${names.join(", ") || "no options"}`
23286
23307
  );
23287
23308
  return;
23288
23309
  }
@@ -23804,11 +23825,11 @@ function recentDaemonLogLines() {
23804
23825
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
23805
23826
  import { realpathSync as realpathSync2 } from "fs";
23806
23827
  import { resolve as resolve14 } from "path";
23807
- function canonicalTreePath(path101) {
23828
+ function canonicalTreePath(path103) {
23808
23829
  try {
23809
- return realpathSync2(path101);
23830
+ return realpathSync2(path103);
23810
23831
  } catch {
23811
- return resolve14(path101);
23832
+ return resolve14(path103);
23812
23833
  }
23813
23834
  }
23814
23835
 
@@ -23861,22 +23882,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
23861
23882
  const registered = new Set(listWorktreePaths(clone));
23862
23883
  const branches = new Set(listLocalBranches(clone));
23863
23884
  const isTaken = (candidate) => registered.has(candidate) || existsSync56(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
23864
- const path101 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
23885
+ const path103 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
23865
23886
  const start3 = worktreeStartPoint(clone, strategy.trunk);
23866
23887
  gitSync(clone, [
23867
23888
  "worktree",
23868
23889
  "add",
23869
23890
  start3.track ? "--track" : "--no-track",
23870
23891
  "-b",
23871
- basename17(path101),
23872
- path101,
23892
+ basename17(path103),
23893
+ path103,
23873
23894
  start3.ref
23874
23895
  ]);
23875
- recordWorktree(path101, clone, getCurrentOrigin(clone));
23896
+ recordWorktree(path103, clone, getCurrentOrigin(clone));
23876
23897
  daemonLog(
23877
- start3.track ? `worktree allocated ${path101} (branch ${basename17(path101)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path101} (branch ${basename17(path101)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
23898
+ start3.track ? `worktree allocated ${path103} (branch ${basename17(path103)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path103} (branch ${basename17(path103)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
23878
23899
  );
23879
- return path101;
23900
+ return path103;
23880
23901
  }
23881
23902
 
23882
23903
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24017,13 +24038,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24017
24038
  if (forcedSpill) daemonLog(forcedSpill);
24018
24039
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24019
24040
  return { cwd: clone, kind: "primary", created: false, clone };
24020
- const path101 = createWorktree(
24041
+ const path103 = createWorktree(
24021
24042
  clone,
24022
24043
  { root: cfg.root, trunk: cfg.trunk },
24023
24044
  boundTreeRoots2,
24024
24045
  options2.replacesTree
24025
24046
  );
24026
- return { cwd: path101, kind: "worktree", created: true, clone };
24047
+ return { cwd: path103, kind: "worktree", created: true, clone };
24027
24048
  }
24028
24049
 
24029
24050
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -24369,13 +24390,13 @@ function worktreeHoldingBranch(cwd, branch2) {
24369
24390
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
24370
24391
  if (!listing) return null;
24371
24392
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
24372
- let path101 = null;
24393
+ let path103 = null;
24373
24394
  for (const line of listing.split("\n")) {
24374
24395
  const trimmed = line.trim();
24375
24396
  if (trimmed.startsWith("worktree "))
24376
- path101 = trimmed.slice("worktree ".length).trim();
24397
+ path103 = trimmed.slice("worktree ".length).trim();
24377
24398
  else if (trimmed === `branch refs/heads/${branch2}`)
24378
- return path101 && path101 !== here ? path101 : null;
24399
+ return path103 && path103 !== here ? path103 : null;
24379
24400
  }
24380
24401
  return null;
24381
24402
  }
@@ -25091,12 +25112,12 @@ function extractLayers(layers, cwd, globalConfigPath) {
25091
25112
  ];
25092
25113
  }
25093
25114
  function unknownExtract(name, layers) {
25094
- const names2 = [
25115
+ const names = [
25095
25116
  ...new Set(layers.flatMap((layer) => Object.keys(layer.extracts)))
25096
25117
  ].sort();
25097
- if (names2.length === 0)
25118
+ if (names.length === 0)
25098
25119
  return `No extract named "${name}" is configured. Pick a rectangle with no anchor flags, then save it as "${name}".`;
25099
- return `No extract named "${name}" is configured. Configured extracts: ${names2.join(", ")}.`;
25120
+ return `No extract named "${name}" is configured. Configured extracts: ${names.join(", ")}.`;
25100
25121
  }
25101
25122
 
25102
25123
  // src/commands/miro/mergeExtractOptions.ts
@@ -25479,9 +25500,9 @@ function parseRscRows(flight) {
25479
25500
  }
25480
25501
  function makeRscResolver(rows) {
25481
25502
  return (ref) => {
25482
- const [id, ...path101] = ref.slice(1).replace(/^[L@]/, "").split(":");
25503
+ const [id, ...path103] = ref.slice(1).replace(/^[L@]/, "").split(":");
25483
25504
  let v = rows[id];
25484
- for (const key of path101) {
25505
+ for (const key of path103) {
25485
25506
  if (v == null || typeof v !== "object") return void 0;
25486
25507
  v = v[key];
25487
25508
  }
@@ -26231,18 +26252,18 @@ function validateLine(line) {
26231
26252
  process.exit(1);
26232
26253
  }
26233
26254
  }
26234
- async function comment2(path101, line, body, options2 = {}) {
26255
+ async function comment2(path103, line, body, options2 = {}) {
26235
26256
  const { startLine, skipPreview } = options2;
26236
26257
  validateBody(body);
26237
26258
  validateLine(line);
26238
26259
  if (startLine !== void 0) validateLine(startLine);
26239
26260
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26240
26261
  if (!skipPreview)
26241
- await reviewProposedPrComment(`Comment on ${path101}:${range}`, body, null);
26262
+ await reviewProposedPrComment(`Comment on ${path103}:${range}`, body, null);
26242
26263
  try {
26243
26264
  const prId = getCurrentPrNodeId();
26244
- postReviewComment({ prId, body, path: path101, line, startLine });
26245
- console.log(`Added review comment on ${path101}:${range}`);
26265
+ postReviewComment({ prId, body, path: path103, line, startLine });
26266
+ console.log(`Added review comment on ${path103}:${range}`);
26246
26267
  } catch (error) {
26247
26268
  if (isGhNotInstalled(error)) {
26248
26269
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -26811,9 +26832,9 @@ function registerPrsComments(prsCommand) {
26811
26832
  });
26812
26833
  prsCommand.command("comment <path> <line> <body>").description(
26813
26834
  "Add a line comment to the pending review (body of - reads it from stdin)"
26814
- ).action(async (path101, line, body) => {
26835
+ ).action(async (path103, line, body) => {
26815
26836
  await comment2(
26816
- path101,
26837
+ path103,
26817
26838
  Number.parseInt(line, 10),
26818
26839
  await readBodyArgument(body)
26819
26840
  );
@@ -28034,11 +28055,11 @@ async function loadBody(target) {
28034
28055
  if (target.kind === "file") return readDraftFile(target.path);
28035
28056
  return fetchPrBody(target.number, target.repo);
28036
28057
  }
28037
- function readDraftFile(path101) {
28058
+ function readDraftFile(path103) {
28038
28059
  try {
28039
- return readFileSync44(path101, "utf8");
28060
+ return readFileSync44(path103, "utf8");
28040
28061
  } catch {
28041
- console.error(`Error: Could not read \`${path101}\`.`);
28062
+ console.error(`Error: Could not read \`${path103}\`.`);
28042
28063
  console.error(
28043
28064
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28044
28065
  );
@@ -28318,10 +28339,10 @@ function resolveOpSecret(reference) {
28318
28339
  }
28319
28340
 
28320
28341
  // src/commands/ravendb/ravenFetch.ts
28321
- async function ravenFetch(connection, path101) {
28342
+ async function ravenFetch(connection, path103) {
28322
28343
  const apiKey = resolveOpSecret(connection.apiKeyRef);
28323
28344
  let accessToken = await getAccessToken(apiKey);
28324
- const url = `${connection.url}${path101}`;
28345
+ const url = `${connection.url}${path103}`;
28325
28346
  const headers = {
28326
28347
  Authorization: `Bearer ${accessToken}`,
28327
28348
  "Content-Type": "application/json"
@@ -28411,16 +28432,16 @@ import chalk195 from "chalk";
28411
28432
  // src/commands/ravendb/buildQueryPath.ts
28412
28433
  function buildQueryPath(opts) {
28413
28434
  const db = encodeURIComponent(opts.db);
28414
- let path101;
28435
+ let path103;
28415
28436
  if (opts.collection) {
28416
- path101 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28437
+ path103 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28417
28438
  } else {
28418
- path101 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28439
+ path103 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28419
28440
  }
28420
28441
  if (opts.query) {
28421
- path101 += `&query=${encodeURIComponent(opts.query)}`;
28442
+ path103 += `&query=${encodeURIComponent(opts.query)}`;
28422
28443
  }
28423
- return path101;
28444
+ return path103;
28424
28445
  }
28425
28446
 
28426
28447
  // src/commands/ravendb/fetchAllPages.ts
@@ -28429,7 +28450,7 @@ async function fetchAllPages(connection, opts) {
28429
28450
  let start3 = 0;
28430
28451
  while (true) {
28431
28452
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
28432
- const path101 = buildQueryPath({
28453
+ const path103 = buildQueryPath({
28433
28454
  db: connection.database,
28434
28455
  collection: opts.collection,
28435
28456
  start: start3,
@@ -28437,7 +28458,7 @@ async function fetchAllPages(connection, opts) {
28437
28458
  sort: opts.sort,
28438
28459
  query: opts.query
28439
28460
  });
28440
- const data = await ravenFetch(connection, path101);
28461
+ const data = await ravenFetch(connection, path103);
28441
28462
  const results = data.Results ?? [];
28442
28463
  const totalResults = data.TotalResults ?? 0;
28443
28464
  if (results.length === 0) break;
@@ -29792,12 +29813,12 @@ function addImportPreservingSuppressions(sourceFile, structure) {
29792
29813
  // src/commands/refactor/extract/removeStaleImports.ts
29793
29814
  import { SyntaxKind as SyntaxKind3 } from "ts-morph";
29794
29815
  function collectReferencedNames(sourceFile) {
29795
- const names2 = /* @__PURE__ */ new Set();
29816
+ const names = /* @__PURE__ */ new Set();
29796
29817
  for (const id of sourceFile.getDescendantsOfKind(SyntaxKind3.Identifier)) {
29797
29818
  if (id.getFirstAncestorByKind(SyntaxKind3.ImportDeclaration)) continue;
29798
- names2.add(id.getText());
29819
+ names.add(id.getText());
29799
29820
  }
29800
- return names2;
29821
+ return names;
29801
29822
  }
29802
29823
  function isImportEmpty(importDecl, usedNames) {
29803
29824
  if (importDecl.getNamedImports().length > 0) return false;
@@ -29896,14 +29917,14 @@ function isPrivate(fn) {
29896
29917
  return !fn.isExported() && !fn.isDefaultExport();
29897
29918
  }
29898
29919
  function getCalledFunctionNames(fn) {
29899
- const names2 = /* @__PURE__ */ new Set();
29920
+ const names = /* @__PURE__ */ new Set();
29900
29921
  for (const call of fn.getDescendantsOfKind(SyntaxKind5.CallExpression)) {
29901
29922
  const expr = call.getExpression();
29902
29923
  if (expr.getKind() === SyntaxKind5.Identifier) {
29903
- names2.add(expr.getText());
29924
+ names.add(expr.getText());
29904
29925
  }
29905
29926
  }
29906
- return names2;
29927
+ return names;
29907
29928
  }
29908
29929
  function collectPrivateFunctions(target, fnMap) {
29909
29930
  const collected = /* @__PURE__ */ new Set();
@@ -29929,11 +29950,11 @@ function collectPrivateFunctions(target, fnMap) {
29929
29950
  // src/commands/refactor/extract/collectPrivateStatements.ts
29930
29951
  import { SyntaxKind as SyntaxKind6 } from "ts-morph";
29931
29952
  function getReferencedIdentifiers(fn) {
29932
- const names2 = /* @__PURE__ */ new Set();
29953
+ const names = /* @__PURE__ */ new Set();
29933
29954
  for (const id of fn.getDescendantsOfKind(SyntaxKind6.Identifier)) {
29934
- names2.add(id.getText());
29955
+ names.add(id.getText());
29935
29956
  }
29936
- return names2;
29957
+ return names;
29937
29958
  }
29938
29959
  function collectPrivateStatements(functions, stmtMap) {
29939
29960
  const seen = /* @__PURE__ */ new Set();
@@ -30127,31 +30148,31 @@ function matchImport(importDecl, neededNames) {
30127
30148
 
30128
30149
  // src/commands/refactor/extract/resolveImports.ts
30129
30150
  function getReferencedNames(nodes) {
30130
- const names2 = /* @__PURE__ */ new Set();
30151
+ const names = /* @__PURE__ */ new Set();
30131
30152
  for (const node of nodes) {
30132
30153
  for (const id of node.getDescendantsOfKind(SyntaxKind13.Identifier)) {
30133
- names2.add(id.getText());
30154
+ names.add(id.getText());
30134
30155
  }
30135
30156
  }
30136
- return names2;
30157
+ return names;
30137
30158
  }
30138
30159
  function getLocallyDeclaredNames(nodes) {
30139
- const names2 = /* @__PURE__ */ new Set();
30160
+ const names = /* @__PURE__ */ new Set();
30140
30161
  for (const node of nodes) {
30141
30162
  if (Node.isFunctionDeclaration(node)) {
30142
30163
  const name = node.getName();
30143
- if (name) names2.add(name);
30164
+ if (name) names.add(name);
30144
30165
  }
30145
30166
  for (const param of node.getDescendantsOfKind(SyntaxKind13.Parameter)) {
30146
- names2.add(param.getName());
30167
+ names.add(param.getName());
30147
30168
  }
30148
30169
  for (const varDecl of node.getDescendantsOfKind(
30149
30170
  SyntaxKind13.VariableDeclaration
30150
30171
  )) {
30151
- names2.add(varDecl.getName());
30172
+ names.add(varDecl.getName());
30152
30173
  }
30153
30174
  }
30154
- return names2;
30175
+ return names;
30155
30176
  }
30156
30177
  function resolveImports(target, dependencies, sourceFile, statements = []) {
30157
30178
  const allFunctions = [target, ...dependencies];
@@ -30951,7 +30972,7 @@ Renamed ${oldName} \u2192 ${newName}`));
30951
30972
 
30952
30973
  // src/commands/refactor/restructure.ts
30953
30974
  import fs38 from "fs";
30954
- import path76 from "path";
30975
+ import path78 from "path";
30955
30976
  import chalk220 from "chalk";
30956
30977
 
30957
30978
  // src/commands/refactor/restructure/applyPlan.ts
@@ -31018,43 +31039,48 @@ function applyPlan(plan2) {
31018
31039
  }
31019
31040
 
31020
31041
  // src/commands/refactor/restructure/buildPlan.ts
31021
- import path70 from "path";
31042
+ import path72 from "path";
31022
31043
 
31023
31044
  // src/commands/refactor/restructure/planRestructure.ts
31024
- import path69 from "path";
31045
+ import path71 from "path";
31025
31046
 
31026
- // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
31027
- import path65 from "path";
31047
+ // src/commands/refactor/restructure/planRestructure/anchored.ts
31048
+ import path63 from "path";
31049
+ function anchored(files, mode, reasonPrefix) {
31050
+ return {
31051
+ root: false,
31052
+ anchors: files.map((file) => ({ file, mode })),
31053
+ reason: `${reasonPrefix} ${files.map((f) => path63.basename(f)).join(", ")}`
31054
+ };
31055
+ }
31028
31056
 
31029
31057
  // src/commands/refactor/restructure/planRestructure/isTestFile.ts
31030
- import path63 from "path";
31058
+ import path64 from "path";
31031
31059
  var TEST_SUFFIX = /\.test\.tsx?$/;
31032
31060
  function isTestFile(file) {
31033
31061
  return TEST_SUFFIX.test(file);
31034
31062
  }
31035
31063
  function testStem(file) {
31036
- return path63.basename(file).replace(TEST_SUFFIX, "");
31064
+ return path64.basename(file).replace(TEST_SUFFIX, "");
31037
31065
  }
31038
31066
 
31039
31067
  // src/commands/refactor/restructure/planRestructure/moduleStem.ts
31040
- import path64 from "path";
31068
+ import path65 from "path";
31041
31069
  function moduleStem(file) {
31042
- return path64.basename(file).replace(/\.tsx?$/, "");
31070
+ return path65.basename(file).replace(/\.tsx?$/, "");
31043
31071
  }
31044
31072
 
31045
31073
  // src/commands/refactor/restructure/planRestructure/collectAnchors.ts
31046
31074
  function sorted(set) {
31047
31075
  return [...set ?? []].sort();
31048
31076
  }
31049
- function names(files) {
31050
- return files.map((f) => path65.basename(f)).join(", ");
31051
- }
31052
- function anchorsOf(files, mode) {
31053
- return files.map((file) => ({ file, mode }));
31054
- }
31055
31077
  function root(reason4) {
31056
31078
  return { root: true, anchors: [], reason: reason4 };
31057
31079
  }
31080
+ function pin(anchoring) {
31081
+ if (anchoring.root) return anchoring;
31082
+ return { ...anchoring, pinned: true, reason: `pinned; ${anchoring.reason}` };
31083
+ }
31058
31084
  function anchorTest(file, index3) {
31059
31085
  const imported = sorted(index3.imports.get(file));
31060
31086
  if (imported.length === 0) return root("test with no subject in scope");
@@ -31062,39 +31088,32 @@ function anchorTest(file, index3) {
31062
31088
  const subjects = imported.filter(
31063
31089
  (f) => !isTestFile(f) && moduleStem(f) === stem
31064
31090
  );
31065
- const anchors = subjects.length > 0 ? subjects : imported;
31066
- return {
31067
- root: false,
31068
- anchors: anchorsOf(anchors, "sibling"),
31069
- reason: `test of ${names(anchors)}`
31070
- };
31091
+ return anchored(
31092
+ subjects.length > 0 ? subjects : imported,
31093
+ "sibling",
31094
+ "test of"
31095
+ );
31071
31096
  }
31072
31097
  function anchorModule(file, index3) {
31073
31098
  if (index3.external.has(file)) return root("imported from outside scope");
31074
31099
  const importers = sorted(index3.importers.get(file));
31075
31100
  if (importers.length > 0)
31076
- return {
31077
- root: false,
31078
- anchors: anchorsOf(importers, "child"),
31079
- reason: importers.length === 1 ? `imported only by ${names(importers)}` : `shared by ${names(importers)}`
31080
- };
31101
+ return anchored(
31102
+ importers,
31103
+ "child",
31104
+ importers.length === 1 ? "imported only by" : "shared by"
31105
+ );
31081
31106
  const tests = sorted(index3.testImporters.get(file));
31082
- if (tests.length > 0)
31083
- return {
31084
- root: false,
31085
- anchors: anchorsOf(tests, "sibling"),
31086
- reason: `used only by tests ${names(tests)}`
31087
- };
31107
+ if (tests.length > 0) return anchored(tests, "sibling", "used only by tests");
31088
31108
  return root("no importers in scope");
31089
31109
  }
31090
- function collectAnchors(files, index3) {
31091
- const anchorings = /* @__PURE__ */ new Map();
31092
- for (const file of files)
31093
- anchorings.set(
31094
- file,
31095
- isTestFile(file) ? anchorTest(file, index3) : anchorModule(file, index3)
31096
- );
31097
- return anchorings;
31110
+ function anchorFile(file, index3, pinned) {
31111
+ if (isTestFile(file)) return anchorTest(file, index3);
31112
+ const anchoring = anchorModule(file, index3);
31113
+ return pinned.has(moduleStem(file)) ? pin(anchoring) : anchoring;
31114
+ }
31115
+ function collectAnchors(files, index3, pinned) {
31116
+ return new Map(files.map((file) => [file, anchorFile(file, index3, pinned)]));
31098
31117
  }
31099
31118
 
31100
31119
  // src/commands/refactor/restructure/planRestructure/findCollisions.ts
@@ -31139,7 +31158,59 @@ function indexEdges(scope, edges) {
31139
31158
  }
31140
31159
 
31141
31160
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31161
+ import path70 from "path";
31162
+
31163
+ // src/commands/refactor/restructure/planRestructure/componentDir.ts
31164
+ import path69 from "path";
31165
+
31166
+ // src/commands/refactor/restructure/planRestructure/liftToPinFolder.ts
31167
+ import path67 from "path";
31168
+ function liftToPinFolder(dir, pinFolders, scopeRoot) {
31169
+ let lifted = scopeRoot;
31170
+ for (const folder of pinFolders)
31171
+ if ((dir === folder || dir.startsWith(folder + path67.sep)) && folder.length > lifted.length)
31172
+ lifted = folder;
31173
+ return lifted;
31174
+ }
31175
+
31176
+ // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
31142
31177
  import path68 from "path";
31178
+ function lowestCommonAncestor(dirs) {
31179
+ const [first, ...rest] = dirs.map((d) => d.split(path68.sep));
31180
+ let common = first;
31181
+ for (const parts of rest) {
31182
+ let i = 0;
31183
+ while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
31184
+ common = common.slice(0, i);
31185
+ }
31186
+ return common.join(path68.sep) || path68.sep;
31187
+ }
31188
+
31189
+ // src/commands/refactor/restructure/planRestructure/componentDir.ts
31190
+ function anchorFolder(anchor, dirs) {
31191
+ const dir = dirs.get(anchor.file);
31192
+ return anchor.mode === "child" ? path69.join(dir, moduleStem(anchor.file)) : dir;
31193
+ }
31194
+ function externalAnchors(component, anchorings) {
31195
+ const members = new Set(component);
31196
+ return component.flatMap(
31197
+ (file) => anchorings.get(file).anchors.filter(
31198
+ (a) => !members.has(a.file)
31199
+ )
31200
+ );
31201
+ }
31202
+ function plannedDir(component, anchorings, layout) {
31203
+ if (component.some((f) => anchorings.get(f).root))
31204
+ return layout.scopeRoot;
31205
+ const anchors = externalAnchors(component, anchorings);
31206
+ if (anchors.length === 0) return layout.scopeRoot;
31207
+ return lowestCommonAncestor(anchors.map((a) => anchorFolder(a, layout.dirs)));
31208
+ }
31209
+ function componentDir(component, anchorings, layout) {
31210
+ const planned = plannedDir(component, anchorings, layout);
31211
+ const pinned = component.some((f) => anchorings.get(f).pinned);
31212
+ return pinned ? liftToPinFolder(planned, layout.pinFolders, layout.scopeRoot) : planned;
31213
+ }
31143
31214
 
31144
31215
  // src/commands/refactor/restructure/planRestructure/findStronglyConnectedComponents.ts
31145
31216
  function push(state, frames, node) {
@@ -31194,56 +31265,29 @@ function findStronglyConnectedComponents(nodes, successors) {
31194
31265
  return state.components;
31195
31266
  }
31196
31267
 
31197
- // src/commands/refactor/restructure/planRestructure/lowestCommonAncestor.ts
31198
- import path67 from "path";
31199
- function lowestCommonAncestor(dirs) {
31200
- const [first, ...rest] = dirs.map((d) => d.split(path67.sep));
31201
- let common = first;
31202
- for (const parts of rest) {
31203
- let i = 0;
31204
- while (i < common.length && i < parts.length && common[i] === parts[i]) i++;
31205
- common = common.slice(0, i);
31206
- }
31207
- return common.join(path67.sep) || path67.sep;
31208
- }
31209
-
31210
31268
  // src/commands/refactor/restructure/planRestructure/placeComponents.ts
31211
- function anchorFolder(anchor, dirs) {
31212
- const dir = dirs.get(anchor.file);
31213
- return anchor.mode === "child" ? path68.join(dir, moduleStem(anchor.file)) : dir;
31214
- }
31215
- function externalAnchors(component, anchorings) {
31216
- const members = new Set(component);
31217
- return component.flatMap(
31218
- (file) => anchorings.get(file).anchors.filter(
31219
- (a) => !members.has(a.file)
31220
- )
31221
- );
31222
- }
31223
- function componentDir(component, anchorings, dirs, scopeRoot) {
31224
- if (component.some((f) => anchorings.get(f).root))
31225
- return scopeRoot;
31226
- const anchors = externalAnchors(component, anchorings);
31227
- if (anchors.length === 0) return scopeRoot;
31228
- return lowestCommonAncestor(anchors.map((a) => anchorFolder(a, dirs)));
31269
+ function isPinFolderOwner(anchoring) {
31270
+ return anchoring.root || anchoring.pinned === true;
31229
31271
  }
31230
31272
  function componentReason(file, component, base) {
31231
31273
  if (component.length === 1) return base;
31232
- const others = component.filter((f) => f !== file).map((f) => path68.basename(f));
31274
+ const others = component.filter((f) => f !== file).map((f) => path70.basename(f));
31233
31275
  return `${base}; cycle with ${others.join(", ")}`;
31234
31276
  }
31235
31277
  function placeComponents(files, anchorings, scopeRoot) {
31236
31278
  const successors = (file) => anchorings.get(file).anchors.map((a) => a.file);
31237
- const dirs = /* @__PURE__ */ new Map();
31279
+ const layout = { scopeRoot, dirs: /* @__PURE__ */ new Map(), pinFolders: /* @__PURE__ */ new Set() };
31238
31280
  const placements = /* @__PURE__ */ new Map();
31239
31281
  for (const component of findStronglyConnectedComponents(files, successors)) {
31240
- const dir = componentDir(component, anchorings, dirs, scopeRoot);
31282
+ const dir = componentDir(component, anchorings, layout);
31241
31283
  for (const file of component) {
31242
- dirs.set(file, dir);
31243
- const base = anchorings.get(file).reason;
31284
+ const anchoring = anchorings.get(file);
31285
+ layout.dirs.set(file, dir);
31286
+ if (isPinFolderOwner(anchoring))
31287
+ layout.pinFolders.add(path70.join(dir, moduleStem(file)));
31244
31288
  placements.set(file, {
31245
31289
  dir,
31246
- reason: componentReason(file, component, base)
31290
+ reason: componentReason(file, component, anchoring.reason)
31247
31291
  });
31248
31292
  }
31249
31293
  }
@@ -31252,16 +31296,16 @@ function placeComponents(files, anchorings, scopeRoot) {
31252
31296
 
31253
31297
  // src/commands/refactor/restructure/planRestructure.ts
31254
31298
  function planRestructure(input) {
31255
- const scopeRoot = path69.resolve(input.scopeRoot);
31299
+ const scopeRoot = path71.resolve(input.scopeRoot);
31256
31300
  const files = [...new Set(input.files)].sort();
31257
31301
  const index3 = indexEdges(new Set(files), input.edges);
31258
- const anchorings = collectAnchors(files, index3);
31302
+ const anchorings = collectAnchors(files, index3, new Set(input.pinnedModules));
31259
31303
  const placements = placeComponents(files, anchorings, scopeRoot);
31260
31304
  const targets = /* @__PURE__ */ new Map();
31261
31305
  const moves = [];
31262
31306
  for (const file of files) {
31263
31307
  const { dir, reason: reason4 } = placements.get(file);
31264
- const to = path69.join(dir, path69.basename(file));
31308
+ const to = path71.join(dir, path71.basename(file));
31265
31309
  targets.set(file, to);
31266
31310
  if (to !== file) moves.push({ from: file, to, reason: reason4 });
31267
31311
  }
@@ -31270,27 +31314,28 @@ function planRestructure(input) {
31270
31314
 
31271
31315
  // src/commands/refactor/restructure/buildPlan.ts
31272
31316
  function moduleKey(file) {
31273
- return path70.join(path70.dirname(file), moduleStem(file));
31317
+ return path72.join(path72.dirname(file), moduleStem(file));
31274
31318
  }
31275
31319
  function findIgnoredOccupants(moves, ignored, scopeRoot) {
31276
31320
  const occupants = new Map(ignored.map((f) => [moduleKey(f), f]));
31277
31321
  return moves.flatMap((move2) => {
31278
31322
  const occupant = occupants.get(moduleKey(move2.to));
31279
31323
  if (!occupant) return [];
31280
- const rel = (f) => path70.relative(scopeRoot, f);
31324
+ const rel = (f) => path72.relative(scopeRoot, f);
31281
31325
  return [
31282
31326
  `Target of ${rel(move2.from)} is occupied by ignored file ${rel(occupant)}`
31283
31327
  ];
31284
31328
  });
31285
31329
  }
31286
- function buildPlan3(scopeRoot, files, ignored = []) {
31330
+ function buildPlan3(scopeRoot, files, ignored = [], pinnedModules = []) {
31287
31331
  const graph = buildImportGraph(new Set(files), findTsConfig(files[0]), {
31288
31332
  includeMocks: true
31289
31333
  });
31290
31334
  const { targets, moves, errors } = planRestructure({
31291
31335
  scopeRoot,
31292
31336
  files,
31293
- edges: graph.edges.filter((e) => !e.mock)
31337
+ edges: graph.edges.filter((e) => !e.mock),
31338
+ pinnedModules
31294
31339
  });
31295
31340
  const allProjectFiles = /* @__PURE__ */ new Set([
31296
31341
  ...graph.importedBy.keys(),
@@ -31310,10 +31355,10 @@ function buildPlan3(scopeRoot, files, ignored = []) {
31310
31355
  import chalk218 from "chalk";
31311
31356
 
31312
31357
  // src/commands/refactor/restructure/displayDrift.ts
31313
- import path71 from "path";
31358
+ import path73 from "path";
31314
31359
  import chalk217 from "chalk";
31315
31360
  function displayDrift(plan2) {
31316
- const rel = (file) => path71.relative(process.cwd(), file);
31361
+ const rel = (file) => path73.relative(process.cwd(), file);
31317
31362
  if (plan2.moves.length > 0) {
31318
31363
  console.log(chalk217.red(`${plan2.moves.length} file(s) drift from the plan:`));
31319
31364
  for (const move2 of plan2.moves)
@@ -31330,17 +31375,17 @@ function checkPlan(plan2) {
31330
31375
  }
31331
31376
 
31332
31377
  // src/commands/refactor/restructure/displayPlan.ts
31333
- import path74 from "path";
31378
+ import path76 from "path";
31334
31379
  import chalk219 from "chalk";
31335
31380
 
31336
31381
  // src/commands/refactor/restructure/computeDepthStats.ts
31337
- import path72 from "path";
31382
+ import path74 from "path";
31338
31383
  function computeDepthStats(targets, scopeRoot) {
31339
31384
  const distribution = /* @__PURE__ */ new Map();
31340
31385
  let max = 0;
31341
31386
  for (const target of targets) {
31342
- const dir = path72.relative(scopeRoot, path72.dirname(target));
31343
- const depth = dir === "" ? 0 : dir.split(path72.sep).length;
31387
+ const dir = path74.relative(scopeRoot, path74.dirname(target));
31388
+ const depth = dir === "" ? 0 : dir.split(path74.sep).length;
31344
31389
  distribution.set(depth, (distribution.get(depth) ?? 0) + 1);
31345
31390
  max = Math.max(max, depth);
31346
31391
  }
@@ -31348,7 +31393,7 @@ function computeDepthStats(targets, scopeRoot) {
31348
31393
  }
31349
31394
 
31350
31395
  // src/commands/refactor/restructure/formatTree.ts
31351
- import path73 from "path";
31396
+ import path75 from "path";
31352
31397
  function insert(root2, parts) {
31353
31398
  let node = root2;
31354
31399
  for (const part of parts) {
@@ -31370,7 +31415,7 @@ function render(node, indent3, lines2) {
31370
31415
  function formatTree(files, scopeRoot) {
31371
31416
  const root2 = /* @__PURE__ */ new Map();
31372
31417
  for (const file of files)
31373
- insert(root2, path73.relative(scopeRoot, file).split(path73.sep));
31418
+ insert(root2, path75.relative(scopeRoot, file).split(path75.sep));
31374
31419
  const lines2 = [];
31375
31420
  render(root2, "", lines2);
31376
31421
  return lines2;
@@ -31378,7 +31423,7 @@ function formatTree(files, scopeRoot) {
31378
31423
 
31379
31424
  // src/commands/refactor/restructure/displayPlan.ts
31380
31425
  function relPath2(filePath) {
31381
- return path74.relative(process.cwd(), filePath);
31426
+ return path76.relative(process.cwd(), filePath);
31382
31427
  }
31383
31428
  function displayMoves(plan2) {
31384
31429
  if (plan2.moves.length === 0) return;
@@ -31428,11 +31473,11 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
31428
31473
  }
31429
31474
 
31430
31475
  // src/commands/refactor/restructure/partitionIgnored.ts
31431
- import path75 from "path";
31476
+ import path77 from "path";
31432
31477
  import { minimatch as minimatch4 } from "minimatch";
31433
31478
  function partitionIgnored(files) {
31434
31479
  const globs = loadConfig().restructure?.ignore ?? [];
31435
- const isIgnored = (file) => globs.some((glob) => minimatch4(path75.relative(process.cwd(), file), glob));
31480
+ const isIgnored = (file) => globs.some((glob) => minimatch4(path77.relative(process.cwd(), file), glob));
31436
31481
  return {
31437
31482
  scoped: files.filter((f) => !isIgnored(f)),
31438
31483
  ignored: files.filter(isIgnored)
@@ -31441,7 +31486,7 @@ function partitionIgnored(files) {
31441
31486
 
31442
31487
  // src/commands/refactor/restructure.ts
31443
31488
  async function restructure(root2, options2 = {}) {
31444
- const scopeRoot = path76.resolve(root2 ?? "src");
31489
+ const scopeRoot = path78.resolve(root2 ?? "src");
31445
31490
  if (!fs38.existsSync(scopeRoot) || !fs38.statSync(scopeRoot).isDirectory()) {
31446
31491
  console.log(chalk220.red(`Not a directory: ${root2 ?? "src"}`));
31447
31492
  process.exit(1);
@@ -31453,7 +31498,8 @@ async function restructure(root2, options2 = {}) {
31453
31498
  console.log(chalk220.yellow("No files found under root"));
31454
31499
  return;
31455
31500
  }
31456
- const plan2 = buildPlan3(scopeRoot, scoped, ignored);
31501
+ const pinned = loadConfig().restructure?.pin ?? [];
31502
+ const plan2 = buildPlan3(scopeRoot, scoped, ignored, pinned);
31457
31503
  if (options2.check) return checkPlan(plan2);
31458
31504
  displayPlan2(plan2);
31459
31505
  if (plan2.moves.length === 0 && plan2.errors.length === 0) {
@@ -31839,8 +31885,8 @@ function groupFilesByDirectory(files) {
31839
31885
  }
31840
31886
 
31841
31887
  // src/commands/review/highLevel/buildHighLevelTree.ts
31842
- function basename19(path101) {
31843
- return path101.slice(path101.lastIndexOf("/") + 1);
31888
+ function basename19(path103) {
31889
+ return path103.slice(path103.lastIndexOf("/") + 1);
31844
31890
  }
31845
31891
  function sum(nodes, key) {
31846
31892
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -31863,19 +31909,19 @@ function nodesOf(at2, prefix2) {
31863
31909
  }
31864
31910
  function collapsedDirNode(name, at2, prefix2) {
31865
31911
  let label2 = name;
31866
- let path101 = prefix2 ? `${prefix2}/${name}` : name;
31912
+ let path103 = prefix2 ? `${prefix2}/${name}` : name;
31867
31913
  let node = at2;
31868
31914
  while (node.files.length === 0 && node.dirs.size === 1) {
31869
31915
  const [childName, child] = [...node.dirs][0];
31870
31916
  label2 = `${label2}/${childName}`;
31871
- path101 = `${path101}/${childName}`;
31917
+ path103 = `${path103}/${childName}`;
31872
31918
  node = child;
31873
31919
  }
31874
- const children = nodesOf(node, path101);
31920
+ const children = nodesOf(node, path103);
31875
31921
  return {
31876
31922
  kind: "dir",
31877
31923
  name: label2,
31878
- path: path101,
31924
+ path: path103,
31879
31925
  additions: sum(children, "additions"),
31880
31926
  deletions: sum(children, "deletions"),
31881
31927
  children
@@ -32133,8 +32179,8 @@ function toStatus(status3) {
32133
32179
  if (status3 === "removed") return "removed";
32134
32180
  return "modified";
32135
32181
  }
32136
- function diffUrl(repo, prNumber, path101) {
32137
- const anchor = createHash3("sha256").update(path101).digest("hex");
32182
+ function diffUrl(repo, prNumber, path103) {
32183
+ const anchor = createHash3("sha256").update(path103).digest("hex");
32138
32184
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32139
32185
  }
32140
32186
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32190,10 +32236,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32190
32236
 
32191
32237
  // src/commands/review/highLevel/loadHighLevelReview.ts
32192
32238
  function loadHighLevelReview(repo, headRef, headSha) {
32193
- const path101 = highLevelReviewPath(repo, headRef, headSha);
32194
- if (!existsSync63(path101)) return void 0;
32239
+ const path103 = highLevelReviewPath(repo, headRef, headSha);
32240
+ if (!existsSync63(path103)) return void 0;
32195
32241
  try {
32196
- return JSON.parse(readFileSync47(path101, "utf8"));
32242
+ return JSON.parse(readFileSync47(path103, "utf8"));
32197
32243
  } catch {
32198
32244
  return void 0;
32199
32245
  }
@@ -32204,8 +32250,8 @@ import { minimatch as minimatch7 } from "minimatch";
32204
32250
  function selectCriticalDiffs(files, criticalPaths) {
32205
32251
  if (criticalPaths.length === 0) return [];
32206
32252
  return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
32207
- ({ path: path101, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32208
- path: path101,
32253
+ ({ path: path103, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32254
+ path: path103,
32209
32255
  status: status3,
32210
32256
  additions,
32211
32257
  deletions,
@@ -32320,11 +32366,11 @@ function highLevelPreviewPayload(subject) {
32320
32366
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
32321
32367
  import { dirname as dirname35 } from "path";
32322
32368
  function saveHighLevelReview(record) {
32323
- const path101 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32324
- mkdirSync22(dirname35(path101), { recursive: true });
32325
- writeFileSync39(path101, `${JSON.stringify(record, null, 2)}
32369
+ const path103 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32370
+ mkdirSync22(dirname35(path103), { recursive: true });
32371
+ writeFileSync39(path103, `${JSON.stringify(record, null, 2)}
32326
32372
  `);
32327
- return path101;
32373
+ return path103;
32328
32374
  }
32329
32375
 
32330
32376
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -32343,9 +32389,9 @@ async function openHighLevelOverlay(sessionId, subject) {
32343
32389
  { rejectIsOutcome: true }
32344
32390
  );
32345
32391
  const record = buildHighLevelRecord(subject, decision);
32346
- const path101 = saveHighLevelReview(record);
32392
+ const path103 = saveHighLevelReview(record);
32347
32393
  console.log(`Verdict: ${record.verdict}`);
32348
- console.log(`Saved ${path101}`);
32394
+ console.log(`Saved ${path103}`);
32349
32395
  console.log("Nothing was posted to GitHub.");
32350
32396
  return record;
32351
32397
  }
@@ -33360,8 +33406,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
33360
33406
  // src/commands/review/prepareReviewDir.ts
33361
33407
  import { existsSync as existsSync64, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
33362
33408
  function clearReviewFiles(paths) {
33363
- for (const path101 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33364
- if (existsSync64(path101)) unlinkSync18(path101);
33409
+ for (const path103 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33410
+ if (existsSync64(path103)) unlinkSync18(path103);
33365
33411
  }
33366
33412
  }
33367
33413
  function prepareReviewDir(paths, requestBody, force) {
@@ -34599,7 +34645,7 @@ function registerReview(program2) {
34599
34645
 
34600
34646
  // src/commands/rules/addRule.ts
34601
34647
  import { existsSync as existsSync69, readFileSync as readFileSync53, writeFileSync as writeFileSync43 } from "fs";
34602
- import path81 from "path";
34648
+ import path83 from "path";
34603
34649
  import chalk232 from "chalk";
34604
34650
 
34605
34651
  // src/commands/rules/insertRuleBullet.ts
@@ -34627,7 +34673,7 @@ import { readFileSync as readFileSync50 } from "fs";
34627
34673
 
34628
34674
  // src/commands/rules/findClaudeFiles.ts
34629
34675
  import { readdirSync as readdirSync13 } from "fs";
34630
- import path77 from "path";
34676
+ import path79 from "path";
34631
34677
  var SKIP_DIRECTORIES = /* @__PURE__ */ new Set(["node_modules", "dist", "build", "coverage"]);
34632
34678
  function findClaudeFiles(dir) {
34633
34679
  const results = [];
@@ -34635,9 +34681,9 @@ function findClaudeFiles(dir) {
34635
34681
  if (entry.isDirectory()) {
34636
34682
  if (entry.name.startsWith(".") || SKIP_DIRECTORIES.has(entry.name))
34637
34683
  continue;
34638
- results.push(...findClaudeFiles(path77.join(dir, entry.name)));
34684
+ results.push(...findClaudeFiles(path79.join(dir, entry.name)));
34639
34685
  } else if (entry.name === "CLAUDE.md") {
34640
- results.push(path77.join(dir, entry.name));
34686
+ results.push(path79.join(dir, entry.name));
34641
34687
  }
34642
34688
  }
34643
34689
  return results;
@@ -34656,34 +34702,34 @@ function nextRuleCode(root2) {
34656
34702
 
34657
34703
  // src/commands/rules/resolveRuleScope.ts
34658
34704
  import { existsSync as existsSync67 } from "fs";
34659
- import path78 from "path";
34705
+ import path80 from "path";
34660
34706
  function resolveRuleScope(target) {
34661
- const resolved = path78.resolve(target);
34662
- if (path78.basename(resolved) === "CLAUDE.md") return resolved;
34707
+ const resolved = path80.resolve(target);
34708
+ if (path80.basename(resolved) === "CLAUDE.md") return resolved;
34663
34709
  const startDir = scopeDirectory(resolved);
34664
34710
  const root2 = findRepoRoot(startDir) ?? startDir;
34665
34711
  let current = startDir;
34666
34712
  while (true) {
34667
- const candidate = path78.join(current, "CLAUDE.md");
34713
+ const candidate = path80.join(current, "CLAUDE.md");
34668
34714
  if (existsSync67(candidate)) return candidate;
34669
- if (current === root2 || current === path78.dirname(current)) break;
34670
- current = path78.dirname(current);
34715
+ if (current === root2 || current === path80.dirname(current)) break;
34716
+ current = path80.dirname(current);
34671
34717
  }
34672
- return path78.join(root2, "CLAUDE.md");
34718
+ return path80.join(root2, "CLAUDE.md");
34673
34719
  }
34674
34720
 
34675
34721
  // src/commands/rules/updateScopedRulesIndex.ts
34676
34722
  import { existsSync as existsSync68, readFileSync as readFileSync52, writeFileSync as writeFileSync42 } from "fs";
34677
- import path80 from "path";
34723
+ import path82 from "path";
34678
34724
 
34679
34725
  // src/commands/rules/scopedRuleDirectories.ts
34680
34726
  import { readFileSync as readFileSync51 } from "fs";
34681
- import path79 from "path";
34727
+ import path81 from "path";
34682
34728
  function scopedRuleDirectories(root2) {
34683
34729
  return findClaudeFiles(root2).filter(
34684
- (file) => path79.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
34730
+ (file) => path81.dirname(file) !== root2 && parseRulesSection(readFileSync51(file, "utf8")).length > 0
34685
34731
  ).map(
34686
- (file) => `${path79.relative(root2, path79.dirname(file)).split(path79.sep).join("/")}/`
34732
+ (file) => `${path81.relative(root2, path81.dirname(file)).split(path81.sep).join("/")}/`
34687
34733
  ).sort();
34688
34734
  }
34689
34735
 
@@ -34722,7 +34768,7 @@ function upsertScopedRulesPointer(content, directories) {
34722
34768
  // src/commands/rules/updateScopedRulesIndex.ts
34723
34769
  function updateScopedRulesIndex(root2) {
34724
34770
  const directories = scopedRuleDirectories(root2);
34725
- const rootFile = path80.join(root2, "CLAUDE.md");
34771
+ const rootFile = path82.join(root2, "CLAUDE.md");
34726
34772
  const before = existsSync68(rootFile) ? readFileSync52(rootFile, "utf8") : "";
34727
34773
  const after = upsertScopedRulesPointer(before, directories);
34728
34774
  if (after !== before) writeFileSync42(rootFile, after);
@@ -34741,7 +34787,7 @@ function addRule(text18, options2) {
34741
34787
  return;
34742
34788
  }
34743
34789
  const target = resolveRuleScope(options2.scope ?? process.cwd());
34744
- const targetDir = path81.dirname(target);
34790
+ const targetDir = path83.dirname(target);
34745
34791
  const root2 = findRepoRoot(targetDir) ?? targetDir;
34746
34792
  const code = nextRuleCode(root2);
34747
34793
  writeFileSync43(
@@ -34754,18 +34800,18 @@ function addRule(text18, options2) {
34754
34800
  );
34755
34801
  updateScopedRulesIndex(root2);
34756
34802
  console.log(
34757
- `Added ${chalk232.cyan(code)} to ${path81.relative(process.cwd(), target) || target}`
34803
+ `Added ${chalk232.cyan(code)} to ${path83.relative(process.cwd(), target) || target}`
34758
34804
  );
34759
34805
  }
34760
34806
 
34761
34807
  // src/commands/rules/indexRules.ts
34762
- import path82 from "path";
34808
+ import path84 from "path";
34763
34809
  import chalk233 from "chalk";
34764
34810
  function indexRules() {
34765
34811
  const startDir = scopeDirectory(process.cwd());
34766
34812
  const root2 = findRepoRoot(startDir) ?? startDir;
34767
34813
  const directories = updateScopedRulesIndex(root2);
34768
- const rootFile = path82.relative(process.cwd(), path82.join(root2, "CLAUDE.md"));
34814
+ const rootFile = path84.relative(process.cwd(), path84.join(root2, "CLAUDE.md"));
34769
34815
  if (directories.length === 0) {
34770
34816
  console.log(
34771
34817
  chalk233.gray(`No directories carry their own \`## Rules\` under ${root2}`)
@@ -34778,13 +34824,13 @@ function indexRules() {
34778
34824
  }
34779
34825
 
34780
34826
  // src/commands/rules/listRules.ts
34781
- import path83 from "path";
34827
+ import path85 from "path";
34782
34828
  import chalk234 from "chalk";
34783
34829
  function listRules(target, options2 = {}) {
34784
- const resolved = path83.resolve(target ?? process.cwd());
34830
+ const resolved = path85.resolve(target ?? process.cwd());
34785
34831
  const rules3 = readScopedRules(resolved);
34786
34832
  if (rules3.length === 0) {
34787
- const label2 = path83.relative(process.cwd(), resolved) || ".";
34833
+ const label2 = path85.relative(process.cwd(), resolved) || ".";
34788
34834
  console.log(chalk234.gray(`No rules in scope for ${label2}`));
34789
34835
  return;
34790
34836
  }
@@ -34795,7 +34841,7 @@ function listRules(target, options2 = {}) {
34795
34841
  if (rule.source !== shown) {
34796
34842
  shown = rule.source;
34797
34843
  console.log(
34798
- chalk234.dim(base ? path83.relative(base, rule.source) : rule.source)
34844
+ chalk234.dim(base ? path85.relative(base, rule.source) : rule.source)
34799
34845
  );
34800
34846
  }
34801
34847
  console.log(
@@ -34891,8 +34937,8 @@ import chalk240 from "chalk";
34891
34937
 
34892
34938
  // src/commands/seq/fetchSeq.ts
34893
34939
  import chalk237 from "chalk";
34894
- async function fetchSeq(conn, path101, params) {
34895
- const url = `${conn.url}${path101}?${params}`;
34940
+ async function fetchSeq(conn, path103, params) {
34941
+ const url = `${conn.url}${path103}?${params}`;
34896
34942
  const response = await fetch(url, {
34897
34943
  headers: {
34898
34944
  Accept: "application/json",
@@ -35273,7 +35319,7 @@ async function previewSlackThreadParts({
35273
35319
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35274
35320
  );
35275
35321
  paths.forEach(
35276
- (path101, index3) => console.log(`${index3 + 1}/${paths.length} ${path101}`)
35322
+ (path103, index3) => console.log(`${index3 + 1}/${paths.length} ${path103}`)
35277
35323
  );
35278
35324
  console.log(
35279
35325
  threadTs ? `Post every part as a reply with thread_ts ${threadTs}.` : `Post 1/${paths.length} to ${channel}, then the rest with the thread_ts it returns.`
@@ -35616,15 +35662,15 @@ function registerSql(program2) {
35616
35662
  // src/commands/sync.ts
35617
35663
  import * as fs47 from "fs";
35618
35664
  import * as os5 from "os";
35619
- import * as path94 from "path";
35665
+ import * as path96 from "path";
35620
35666
  import { fileURLToPath as fileURLToPath8 } from "url";
35621
35667
 
35622
35668
  // src/commands/sync/pruneCommands.ts
35623
- import * as path85 from "path";
35669
+ import * as path87 from "path";
35624
35670
 
35625
35671
  // src/commands/sync/pruneTarget.ts
35626
35672
  import * as fs39 from "fs";
35627
- import * as path84 from "path";
35673
+ import * as path86 from "path";
35628
35674
  function pruneTarget(targetDir, keepNames, shape, options2) {
35629
35675
  const result = {
35630
35676
  orphans: [],
@@ -35642,7 +35688,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
35642
35688
  }
35643
35689
  if (keep.has(name)) continue;
35644
35690
  result.orphans.push(entry.name);
35645
- const entryPath = path84.join(targetDir, entry.name);
35691
+ const entryPath = path86.join(targetDir, entry.name);
35646
35692
  const reason4 = shape.blockedBy?.(entryPath);
35647
35693
  if (reason4) {
35648
35694
  result.skipped.push({ name: entry.name, reason: reason4 });
@@ -35662,7 +35708,7 @@ function pruneCommands(targetDir, commandNames, options2) {
35662
35708
  targetDir,
35663
35709
  commandNames,
35664
35710
  {
35665
- nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path85.basename(entry.name, ".md") : void 0
35711
+ nameOf: (entry) => entry.isFile() && entry.name.endsWith(".md") ? path87.basename(entry.name, ".md") : void 0
35666
35712
  },
35667
35713
  options2
35668
35714
  );
@@ -35697,11 +35743,11 @@ function reportPrune(label2, result, force) {
35697
35743
 
35698
35744
  // src/commands/sync/reportRetiredAgentsFiles.ts
35699
35745
  import * as fs40 from "fs";
35700
- import * as path86 from "path";
35746
+ import * as path88 from "path";
35701
35747
  var retired = [
35702
- path86.join(harnesses.claude.homeDir, "CLAUDE.md"),
35703
- path86.join(harnesses.codex.homeDir, "AGENTS.md"),
35704
- path86.join(harnesses.pi.homeDir, "AGENTS.md")
35748
+ path88.join(harnesses.claude.homeDir, "CLAUDE.md"),
35749
+ path88.join(harnesses.codex.homeDir, "AGENTS.md"),
35750
+ path88.join(harnesses.pi.homeDir, "AGENTS.md")
35705
35751
  ];
35706
35752
  function reportRetiredAgentsFiles() {
35707
35753
  const leftovers = retired.filter((file) => fs40.existsSync(file));
@@ -35716,27 +35762,27 @@ function reportRetiredAgentsFiles() {
35716
35762
  }
35717
35763
 
35718
35764
  // src/commands/sync/syncCodex.ts
35719
- import * as path89 from "path";
35765
+ import * as path91 from "path";
35720
35766
 
35721
35767
  // src/commands/sync/installHarnessCommands.ts
35722
35768
  import * as fs41 from "fs";
35723
- import * as path87 from "path";
35769
+ import * as path89 from "path";
35724
35770
  function installHarnessCommands(claudeDir, harness, transform) {
35725
- const commandsSource = path87.join(claudeDir, "commands");
35771
+ const commandsSource = path89.join(claudeDir, "commands");
35726
35772
  const files = fs41.readdirSync(commandsSource);
35727
- const names2 = [];
35773
+ const names = [];
35728
35774
  let synced = 0;
35729
35775
  for (const file of files) {
35730
35776
  if (!file.endsWith(".md")) continue;
35731
35777
  const name = file.replace(/\.md$/, "");
35732
- names2.push(name);
35733
- const content = fs41.readFileSync(path87.join(commandsSource, file), "utf8");
35734
- const target = path87.join(harness.homeDir, harness.sync.commandDest(name));
35735
- fs41.mkdirSync(path87.dirname(target), { recursive: true });
35778
+ names.push(name);
35779
+ const content = fs41.readFileSync(path89.join(commandsSource, file), "utf8");
35780
+ const target = path89.join(harness.homeDir, harness.sync.commandDest(name));
35781
+ fs41.mkdirSync(path89.dirname(target), { recursive: true });
35736
35782
  fs41.writeFileSync(target, transform(name, content));
35737
35783
  synced++;
35738
35784
  }
35739
- return { total: files.length, synced, names: names2 };
35785
+ return { total: files.length, synced, names };
35740
35786
  }
35741
35787
 
35742
35788
  // src/commands/sync/pruneSkills.ts
@@ -35761,7 +35807,7 @@ function unexpectedContent(skillDir) {
35761
35807
 
35762
35808
  // src/commands/sync/syncCodexHooks.ts
35763
35809
  import * as fs43 from "fs";
35764
- import * as path88 from "path";
35810
+ import * as path90 from "path";
35765
35811
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
35766
35812
  var END = "# <<< assist codex hooks (managed) <<<";
35767
35813
  function upsertManagedBlock(existing, body) {
@@ -35792,9 +35838,9 @@ ${rest}
35792
35838
  }
35793
35839
  function syncCodexHooks(sourcePath) {
35794
35840
  const body = fs43.readFileSync(sourcePath, "utf8");
35795
- const configPath = path88.join(harnesses.codex.homeDir, "config.toml");
35841
+ const configPath = path90.join(harnesses.codex.homeDir, "config.toml");
35796
35842
  const existing = fs43.existsSync(configPath) ? fs43.readFileSync(configPath, "utf8") : "";
35797
- fs43.mkdirSync(path88.dirname(configPath), { recursive: true });
35843
+ fs43.mkdirSync(path90.dirname(configPath), { recursive: true });
35798
35844
  fs43.writeFileSync(configPath, upsertManagedBlock(existing, body));
35799
35845
  console.log(
35800
35846
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
@@ -35821,53 +35867,53 @@ description: ${quoteYaml(description)}
35821
35867
  }
35822
35868
  function syncCodex(claudeDir, options2) {
35823
35869
  if (!isHarnessAvailable("codex")) return;
35824
- const { total, names: names2 } = installHarnessCommands(
35870
+ const { total, names } = installHarnessCommands(
35825
35871
  claudeDir,
35826
35872
  harnesses.codex,
35827
35873
  commandToSkill
35828
35874
  );
35829
- syncCodexHooks(path89.join(claudeDir, "..", "codex", "config.toml"));
35875
+ syncCodexHooks(path91.join(claudeDir, "..", "codex", "config.toml"));
35830
35876
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
35831
35877
  if (!options2?.prune) return;
35832
35878
  const force = options2.force ?? false;
35833
35879
  reportPrune(
35834
35880
  "~/.codex/skills",
35835
- pruneSkills(path89.join(harnesses.codex.homeDir, "skills"), names2, { force }),
35881
+ pruneSkills(path91.join(harnesses.codex.homeDir, "skills"), names, { force }),
35836
35882
  force
35837
35883
  );
35838
35884
  }
35839
35885
 
35840
35886
  // src/commands/sync/syncDesign.ts
35841
35887
  import * as fs44 from "fs";
35842
- import * as path90 from "path";
35888
+ import * as path92 from "path";
35843
35889
  function syncDesign(claudeDir, targetBase) {
35844
- const systemPromptSource = path90.join(claudeDir, "design-system-prompt.md");
35845
- const systemPromptTarget = path90.join(targetBase, "design-system-prompt.md");
35890
+ const systemPromptSource = path92.join(claudeDir, "design-system-prompt.md");
35891
+ const systemPromptTarget = path92.join(targetBase, "design-system-prompt.md");
35846
35892
  fs44.copyFileSync(systemPromptSource, systemPromptTarget);
35847
35893
  console.log(
35848
35894
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
35849
35895
  );
35850
- const skillsSource = path90.join(claudeDir, "skills");
35851
- const skillsTarget = path90.join(targetBase, "skills");
35896
+ const skillsSource = path92.join(claudeDir, "skills");
35897
+ const skillsTarget = path92.join(targetBase, "skills");
35852
35898
  fs44.mkdirSync(skillsTarget, { recursive: true });
35853
35899
  const files = fs44.readdirSync(skillsSource);
35854
35900
  for (const file of files) {
35855
35901
  fs44.copyFileSync(
35856
- path90.join(skillsSource, file),
35857
- path90.join(skillsTarget, file)
35902
+ path92.join(skillsSource, file),
35903
+ path92.join(skillsTarget, file)
35858
35904
  );
35859
35905
  }
35860
35906
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
35861
35907
  }
35862
35908
 
35863
35909
  // src/commands/sync/syncPi.ts
35864
- import * as path92 from "path";
35910
+ import * as path94 from "path";
35865
35911
 
35866
35912
  // src/commands/sync/syncPiHooks.ts
35867
35913
  import * as fs45 from "fs";
35868
- import * as path91 from "path";
35914
+ import * as path93 from "path";
35869
35915
  function piExtensionsDir() {
35870
- return path91.join(harnesses.pi.homeDir, "extensions");
35916
+ return path93.join(harnesses.pi.homeDir, "extensions");
35871
35917
  }
35872
35918
  function syncPiHooks(sourceDir) {
35873
35919
  const target = piExtensionsDir();
@@ -35875,8 +35921,8 @@ function syncPiHooks(sourceDir) {
35875
35921
  const files = fs45.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
35876
35922
  for (const file of files) {
35877
35923
  fs45.copyFileSync(
35878
- path91.join(sourceDir, file),
35879
- path91.join(target, `assist-${file}`)
35924
+ path93.join(sourceDir, file),
35925
+ path93.join(target, `assist-${file}`)
35880
35926
  );
35881
35927
  }
35882
35928
  console.log(
@@ -35908,29 +35954,29 @@ function commandToPrompt(name, content) {
35908
35954
  }
35909
35955
  function syncPi(claudeDir, options2) {
35910
35956
  if (!isHarnessAvailable("pi")) return;
35911
- const { synced, names: names2 } = installHarnessCommands(
35957
+ const { synced, names } = installHarnessCommands(
35912
35958
  claudeDir,
35913
35959
  harnesses.pi,
35914
35960
  commandToPrompt
35915
35961
  );
35916
- syncPiHooks(path92.join(claudeDir, "..", "pi"));
35962
+ syncPiHooks(path94.join(claudeDir, "..", "pi"));
35917
35963
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
35918
35964
  if (!options2?.prune) return;
35919
35965
  const force = options2.force ?? false;
35920
35966
  reportPrune(
35921
35967
  "~/.pi/agent/prompts",
35922
- pruneCommands(path92.join(harnesses.pi.homeDir, "prompts"), names2, { force }),
35968
+ pruneCommands(path94.join(harnesses.pi.homeDir, "prompts"), names, { force }),
35923
35969
  force
35924
35970
  );
35925
35971
  }
35926
35972
 
35927
35973
  // src/commands/sync/syncSettings.ts
35928
35974
  import * as fs46 from "fs";
35929
- import * as path93 from "path";
35975
+ import * as path95 from "path";
35930
35976
  import chalk247 from "chalk";
35931
35977
  async function syncSettings(claudeDir, targetBase, options2) {
35932
- const source = path93.join(claudeDir, "settings.json");
35933
- const target = path93.join(targetBase, "settings.json");
35978
+ const source = path95.join(claudeDir, "settings.json");
35979
+ const target = path95.join(targetBase, "settings.json");
35934
35980
  const sourceContent = fs46.readFileSync(source, "utf8");
35935
35981
  const sourceSettings = JSON.parse(sourceContent);
35936
35982
  const targetExists = fs46.existsSync(target);
@@ -35970,13 +36016,13 @@ async function syncSettings(claudeDir, targetBase, options2) {
35970
36016
 
35971
36017
  // src/commands/sync.ts
35972
36018
  var __filename4 = fileURLToPath8(import.meta.url);
35973
- var __dirname5 = path94.dirname(__filename4);
36019
+ var __dirname5 = path96.dirname(__filename4);
35974
36020
  async function sync(options2) {
35975
36021
  const config = loadConfig();
35976
36022
  const yes = options2?.yes ?? config.sync.autoConfirm;
35977
36023
  const prune = { prune: options2?.prune, force: options2?.force };
35978
- const claudeDir = path94.join(__dirname5, "..", "claude");
35979
- const targetBase = path94.join(os5.homedir(), ".claude");
36024
+ const claudeDir = path96.join(__dirname5, "..", "claude");
36025
+ const targetBase = path96.join(os5.homedir(), ".claude");
35980
36026
  const commandFiles = syncCommands(claudeDir, targetBase);
35981
36027
  syncDesign(claudeDir, targetBase);
35982
36028
  await syncSettings(claudeDir, targetBase, { yes });
@@ -35984,21 +36030,21 @@ async function sync(options2) {
35984
36030
  syncPi(claudeDir, prune);
35985
36031
  reportRetiredAgentsFiles();
35986
36032
  if (!options2?.prune) return;
35987
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path94.basename(file, ".md"));
36033
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path96.basename(file, ".md"));
35988
36034
  const force = options2.force ?? false;
35989
36035
  reportPrune(
35990
36036
  "~/.claude/commands",
35991
- pruneCommands(path94.join(targetBase, "commands"), commandNames, { force }),
36037
+ pruneCommands(path96.join(targetBase, "commands"), commandNames, { force }),
35992
36038
  force
35993
36039
  );
35994
36040
  }
35995
36041
  function syncCommands(claudeDir, targetBase) {
35996
- const sourceDir = path94.join(claudeDir, "commands");
35997
- const targetDir = path94.join(targetBase, "commands");
36042
+ const sourceDir = path96.join(claudeDir, "commands");
36043
+ const targetDir = path96.join(targetBase, "commands");
35998
36044
  fs47.mkdirSync(targetDir, { recursive: true });
35999
36045
  const files = fs47.readdirSync(sourceDir);
36000
36046
  for (const file of files) {
36001
- fs47.copyFileSync(path94.join(sourceDir, file), path94.join(targetDir, file));
36047
+ fs47.copyFileSync(path96.join(sourceDir, file), path96.join(targetDir, file));
36002
36048
  console.log(`Copied ${file} to ${targetDir}`);
36003
36049
  }
36004
36050
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -37053,9 +37099,9 @@ import { existsSync as existsSync78, readFileSync as readFileSync59 } from "fs";
37053
37099
 
37054
37100
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37055
37101
  import { minimatch as minimatch9 } from "minimatch";
37056
- function resolveStringsAtPath(data, path101) {
37102
+ function resolveStringsAtPath(data, path103) {
37057
37103
  let current = data;
37058
- for (const segment of path101.split(".")) {
37104
+ for (const segment of path103.split(".")) {
37059
37105
  if (current === null || typeof current !== "object") return [];
37060
37106
  current = current[segment];
37061
37107
  }
@@ -37068,10 +37114,10 @@ function resolveStringsAtPath(data, path101) {
37068
37114
  }
37069
37115
  function findRuleViolations(data, rule) {
37070
37116
  const violations = [];
37071
- for (const path101 of rule.paths) {
37072
- for (const value of resolveStringsAtPath(data, path101)) {
37117
+ for (const path103 of rule.paths) {
37118
+ for (const value of resolveStringsAtPath(data, path103)) {
37073
37119
  if (minimatch9(value, rule.disallowed))
37074
- violations.push({ file: rule.file, path: path101, value });
37120
+ violations.push({ file: rule.file, path: path103, value });
37075
37121
  }
37076
37122
  }
37077
37123
  return violations;
@@ -37110,8 +37156,8 @@ function forbiddenStrings() {
37110
37156
  process.exit(0);
37111
37157
  }
37112
37158
  console.log("Forbidden strings found:\n");
37113
- for (const { file, path: path101, value } of violations) {
37114
- console.log(` ${file} ${path101}: ${value}`);
37159
+ for (const { file, path: path103, value } of violations) {
37160
+ console.log(` ${file} ${path103}: ${value}`);
37115
37161
  }
37116
37162
  console.log(`
37117
37163
  Total: ${violations.length} forbidden string(s).`);
@@ -37167,7 +37213,7 @@ Total: ${lines2.length} hardcoded color(s)`);
37167
37213
 
37168
37214
  // src/commands/verify/migrations.ts
37169
37215
  import { readFileSync as readFileSync60 } from "fs";
37170
- import path96 from "path";
37216
+ import path98 from "path";
37171
37217
 
37172
37218
  // src/commands/verify/migrations/checkAppendOnly.ts
37173
37219
  function checkAppendOnly(baseline, current) {
@@ -37259,15 +37305,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37259
37305
  } catch {
37260
37306
  return baseline;
37261
37307
  }
37262
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path101) => MIGRATION_FILE3.test(basename25(path101)));
37263
- for (const path101 of paths) {
37308
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path103) => MIGRATION_FILE3.test(basename25(path103)));
37309
+ for (const path103 of paths) {
37264
37310
  try {
37265
- const content = execSync63(`git show "${ref}:${path101}"`, {
37311
+ const content = execSync63(`git show "${ref}:${path103}"`, {
37266
37312
  encoding: "utf8",
37267
37313
  maxBuffer: 16 * 1024 * 1024,
37268
37314
  stdio: ["pipe", "pipe", "pipe"]
37269
37315
  });
37270
- baseline.set(basename25(path101), content);
37316
+ baseline.set(basename25(path103), content);
37271
37317
  } catch {
37272
37318
  }
37273
37319
  }
@@ -37306,11 +37352,11 @@ function resolveBaselineRef() {
37306
37352
  }
37307
37353
 
37308
37354
  // src/commands/verify/migrations/migrationsDir.ts
37309
- import path95 from "path";
37355
+ import path97 from "path";
37310
37356
  import { fileURLToPath as fileURLToPath9 } from "url";
37311
37357
  function migrationsDir() {
37312
- return path95.resolve(
37313
- path95.dirname(fileURLToPath9(import.meta.url)),
37358
+ return path97.resolve(
37359
+ path97.dirname(fileURLToPath9(import.meta.url)),
37314
37360
  "../../../shared/db/migrations"
37315
37361
  );
37316
37362
  }
@@ -37331,7 +37377,7 @@ function migrations2() {
37331
37377
  if (ref) {
37332
37378
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
37333
37379
  const current = new Map(
37334
- files.map((file) => [file, readFileSync60(path96.join(dir, file), "utf8")])
37380
+ files.map((file) => [file, readFileSync60(path98.join(dir, file), "utf8")])
37335
37381
  );
37336
37382
  for (const finding of checkAppendOnly(baseline, current)) {
37337
37383
  problems.push(
@@ -37836,11 +37882,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
37836
37882
  var sessionsPrefix = "src/commands/sessions/";
37837
37883
  var rules = [
37838
37884
  {
37839
- matches: (path101) => path101.startsWith(webUiPrefix),
37885
+ matches: (path103) => path103.startsWith(webUiPrefix),
37840
37886
  advice: "restart the web server, then hard-reload the browser tab"
37841
37887
  },
37842
37888
  {
37843
- matches: (path101) => path101.startsWith(sessionsPrefix) && !path101.startsWith(webUiPrefix),
37889
+ matches: (path103) => path103.startsWith(sessionsPrefix) && !path103.startsWith(webUiPrefix),
37844
37890
  advice: "restart the daemon"
37845
37891
  }
37846
37892
  ];
@@ -37851,27 +37897,27 @@ function restartAdvice(paths) {
37851
37897
  // src/commands/watch/syncAdvice.ts
37852
37898
  var rules2 = [
37853
37899
  {
37854
- matches: (path101) => path101.startsWith("claude/commands/"),
37900
+ matches: (path103) => path103.startsWith("claude/commands/"),
37855
37901
  reason: "claude/commands changed"
37856
37902
  },
37857
37903
  {
37858
- matches: (path101) => path101.startsWith("claude/skills/"),
37904
+ matches: (path103) => path103.startsWith("claude/skills/"),
37859
37905
  reason: "claude/skills changed"
37860
37906
  },
37861
37907
  {
37862
- matches: (path101) => path101 === "claude/settings.json",
37908
+ matches: (path103) => path103 === "claude/settings.json",
37863
37909
  reason: "claude/settings.json changed"
37864
37910
  },
37865
37911
  {
37866
- matches: (path101) => path101 === "claude/design-system-prompt.md",
37912
+ matches: (path103) => path103 === "claude/design-system-prompt.md",
37867
37913
  reason: "claude/design-system-prompt.md changed"
37868
37914
  },
37869
37915
  {
37870
- matches: (path101) => path101.startsWith("codex/"),
37916
+ matches: (path103) => path103.startsWith("codex/"),
37871
37917
  reason: "codex sources changed"
37872
37918
  },
37873
37919
  {
37874
- matches: (path101) => path101.startsWith("pi/"),
37920
+ matches: (path103) => path103.startsWith("pi/"),
37875
37921
  reason: "pi sources changed"
37876
37922
  }
37877
37923
  ];
@@ -38103,8 +38149,8 @@ function resolveParams(params, cliArgs) {
38103
38149
  }
38104
38150
  if (missing.length > 0) {
38105
38151
  const s = missing.length > 1 ? "s" : "";
38106
- const names2 = missing.map((n) => `"${n}"`).join(", ");
38107
- console.error(`Missing required param${s}: ${names2}`);
38152
+ const names = missing.map((n) => `"${n}"`).join(", ");
38153
+ console.error(`Missing required param${s}: ${names}`);
38108
38154
  process.exit(1);
38109
38155
  }
38110
38156
  resolved.push(...cliArgs.slice(params.length));
@@ -38579,9 +38625,9 @@ function findPortFile(roamDir) {
38579
38625
  return void 0;
38580
38626
  }
38581
38627
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
38582
- const path101 = join100(roamDir, name);
38628
+ const path103 = join100(roamDir, name);
38583
38629
  try {
38584
- return { path: path101, mtimeMs: statSync13(path101).mtimeMs };
38630
+ return { path: path103, mtimeMs: statSync13(path103).mtimeMs };
38585
38631
  } catch {
38586
38632
  return void 0;
38587
38633
  }
@@ -38652,10 +38698,10 @@ function formatConfiguredCommands() {
38652
38698
  const { run: entries } = loadConfig();
38653
38699
  const configs = resolveRunConfigs(entries, runConfigBaseDir());
38654
38700
  if (configs.length === 0) return "\nNo configured commands";
38655
- const names2 = configs.map((r) => ` ${r.name}`).join("\n");
38701
+ const names = configs.map((r) => ` ${r.name}`).join("\n");
38656
38702
  return `
38657
38703
  Configured commands:
38658
- ${names2}`;
38704
+ ${names}`;
38659
38705
  }
38660
38706
 
38661
38707
  // src/commands/run/spawnRunCommand.ts
@@ -38825,11 +38871,11 @@ function findLinkIndex() {
38825
38871
  function parseLinkArgs() {
38826
38872
  const idx = findLinkIndex();
38827
38873
  if (idx === -1) return null;
38828
- const path101 = process.argv[idx + 1];
38874
+ const path103 = process.argv[idx + 1];
38829
38875
  const rest = process.argv.slice(idx + 2);
38830
38876
  const { value: prefix2 } = extractOption(rest, "--prefix");
38831
38877
  if (!prefix2) return null;
38832
- return { path: path101, prefix: prefix2 };
38878
+ return { path: path103, prefix: prefix2 };
38833
38879
  }
38834
38880
  function hasDuplicateLink(runList, linkPath) {
38835
38881
  return runList.some(
@@ -39431,14 +39477,14 @@ import * as pty from "node-pty";
39431
39477
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
39432
39478
  import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
39433
39479
  import { createRequire as createRequire3 } from "module";
39434
- import path97 from "path";
39480
+ import path99 from "path";
39435
39481
  var require4 = createRequire3(import.meta.url);
39436
39482
  var ensured = false;
39437
39483
  function ensureSpawnHelperExecutable() {
39438
39484
  if (ensured || process.platform !== "darwin") return;
39439
39485
  ensured = true;
39440
- const ptyRoot = path97.join(path97.dirname(require4.resolve("node-pty")), "..");
39441
- const helper = path97.join(
39486
+ const ptyRoot = path99.join(path99.dirname(require4.resolve("node-pty")), "..");
39487
+ const helper = path99.join(
39442
39488
  ptyRoot,
39443
39489
  "prebuilds",
39444
39490
  `${process.platform}-${process.arch}`,
@@ -39569,12 +39615,12 @@ function serverRunMeta(runName, cwd) {
39569
39615
 
39570
39616
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
39571
39617
  import * as fs50 from "fs";
39572
- import * as path98 from "path";
39618
+ import * as path100 from "path";
39573
39619
  import { fileURLToPath as fileURLToPath11 } from "url";
39574
39620
  var __filename5 = fileURLToPath11(import.meta.url);
39575
- var __dirname7 = path98.dirname(__filename5);
39621
+ var __dirname7 = path100.dirname(__filename5);
39576
39622
  function readDesignSystemPrompt() {
39577
- const promptPath = path98.join(
39623
+ const promptPath = path100.join(
39578
39624
  __dirname7,
39579
39625
  "..",
39580
39626
  "claude",
@@ -40605,8 +40651,8 @@ async function seedRunningMsFromUsage(session, notify2) {
40605
40651
  var DEBOUNCE_MS2 = 50;
40606
40652
  function watchActivity(session, notify2, onClaudeSessionId) {
40607
40653
  if (session.commandType !== "assist" || !session.cwd) return;
40608
- const path101 = activityPath(session.id);
40609
- const dir = dirname42(path101);
40654
+ const path103 = activityPath(session.id);
40655
+ const dir = dirname42(path103);
40610
40656
  try {
40611
40657
  mkdirSync37(dir, { recursive: true });
40612
40658
  } catch {
@@ -40616,7 +40662,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40616
40662
  let timer = null;
40617
40663
  const read3 = () => {
40618
40664
  timer = null;
40619
- const activity2 = readActivity(path101);
40665
+ const activity2 = readActivity(path103);
40620
40666
  if (!activity2) return;
40621
40667
  applyActivityToSession(session, activity2);
40622
40668
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -40625,11 +40671,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
40625
40671
  notify2();
40626
40672
  };
40627
40673
  session.activityWatcher = watch2(dir, (_event, filename) => {
40628
- if (filename && !path101.endsWith(filename)) return;
40674
+ if (filename && !path103.endsWith(filename)) return;
40629
40675
  if (timer) clearTimeout(timer);
40630
40676
  timer = setTimeout(read3, DEBOUNCE_MS2);
40631
40677
  });
40632
- if (existsSync94(path101)) read3();
40678
+ if (existsSync94(path103)) read3();
40633
40679
  }
40634
40680
  function refreshActivity(session) {
40635
40681
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -40772,12 +40818,12 @@ import { watch as watch3 } from "fs";
40772
40818
 
40773
40819
  // src/commands/sessions/shared/findTranscriptPathSync.ts
40774
40820
  import * as fs52 from "fs";
40775
- import * as path99 from "path";
40821
+ import * as path101 from "path";
40776
40822
  function projectDirForCwd(cwd) {
40777
- return path99.join(claudeProjectsRoot(), projectSlug(cwd));
40823
+ return path101.join(claudeProjectsRoot(), projectSlug(cwd));
40778
40824
  }
40779
40825
  function transcriptPathFor(cwd, claudeSessionId) {
40780
- return path99.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40826
+ return path101.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
40781
40827
  }
40782
40828
  function findTranscriptPathSync(cwd, claudeSessionId) {
40783
40829
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -40791,8 +40837,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
40791
40837
  }
40792
40838
  for (const file of files) {
40793
40839
  if (!file.endsWith(".jsonl")) continue;
40794
- if (headContainsSessionId(path99.join(dir, file), claudeSessionId))
40795
- return path99.join(dir, file);
40840
+ if (headContainsSessionId(path101.join(dir, file), claudeSessionId))
40841
+ return path101.join(dir, file);
40796
40842
  }
40797
40843
  return null;
40798
40844
  }
@@ -41966,9 +42012,9 @@ function tempRoots() {
41966
42012
  }
41967
42013
  return [...roots];
41968
42014
  }
41969
- function underTempRoot(path101) {
42015
+ function underTempRoot(path103) {
41970
42016
  return tempRoots().some(
41971
- (root2) => path101.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42017
+ (root2) => path103.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
41972
42018
  );
41973
42019
  }
41974
42020
 
@@ -42313,7 +42359,7 @@ function restoreAll(spawner, sessions) {
42313
42359
  const persisted = dropTempRootedSessions(loadPersistedSessions());
42314
42360
  const cap2 = sessionLimits.maxRestore();
42315
42361
  const restoredIds = /* @__PURE__ */ new Map();
42316
- const names2 = persisted.slice(0, cap2).map((entry) => {
42362
+ const names = persisted.slice(0, cap2).map((entry) => {
42317
42363
  const id = restoreOne(entry, spawner, sessions);
42318
42364
  if (entry.id != null && id != null) restoredIds.set(entry.id, id);
42319
42365
  return entry.name;
@@ -42321,7 +42367,7 @@ function restoreAll(spawner, sessions) {
42321
42367
  for (const over of persisted.slice(cap2))
42322
42368
  deferOne(over, spawner.recoveryCard, cap2);
42323
42369
  remapLaunchedFrom(sessions, restoredIds);
42324
- return names2;
42370
+ return names;
42325
42371
  }
42326
42372
  function deferOne(persisted, spawnRecoveryCard, cap2) {
42327
42373
  try {
@@ -42410,15 +42456,15 @@ function bindResumedWorktree(session, cwd, notify2) {
42410
42456
  import { existsSync as existsSync96 } from "fs";
42411
42457
  async function reclaimVanishedWorktrees(clone, paths) {
42412
42458
  if (!existsSync96(clone)) {
42413
- for (const { path: path101 } of paths) forgetWorktree(path101);
42459
+ for (const { path: path103 } of paths) forgetWorktree(path103);
42414
42460
  daemonLog(
42415
42461
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
42416
42462
  );
42417
42463
  return;
42418
42464
  }
42419
42465
  await pruneBookkeeping2(clone);
42420
- for (const { path: path101, branch: branch2 } of paths)
42421
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path101);
42466
+ for (const { path: path103, branch: branch2 } of paths)
42467
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path103);
42422
42468
  }
42423
42469
  async function pruneBookkeeping2(clone) {
42424
42470
  try {
@@ -42445,37 +42491,37 @@ async function reclaimBranch(clone, branch2) {
42445
42491
  }
42446
42492
 
42447
42493
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
42448
- function logVanishedTree(sessions, path101) {
42494
+ function logVanishedTree(sessions, path103) {
42449
42495
  const claimants = [...sessions.values()].filter(
42450
- (s) => s.cwd === path101 || s.worktree?.path === path101
42496
+ (s) => s.cwd === path103 || s.worktree?.path === path103
42451
42497
  );
42452
42498
  if (claimants.length === 0) {
42453
- daemonLog(`worktree ${path101} gone from disk and unclaimed; reclaiming it`);
42499
+ daemonLog(`worktree ${path103} gone from disk and unclaimed; reclaiming it`);
42454
42500
  return;
42455
42501
  }
42456
42502
  for (const s of claimants)
42457
42503
  daemonLog(
42458
- `session ${s.id} ("${s.name}") claims worktree ${path101}, which is gone from disk; reclaiming it`
42504
+ `session ${s.id} ("${s.name}") claims worktree ${path103}, which is gone from disk; reclaiming it`
42459
42505
  );
42460
42506
  }
42461
42507
 
42462
42508
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
42463
42509
  var MAX_ITEMS = 20;
42464
- async function describeHeldWork(path101, reason4) {
42465
- if (reason4.startsWith("uncommitted")) return await changedFiles(path101);
42466
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path101, reason4);
42510
+ async function describeHeldWork(path103, reason4) {
42511
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path103);
42512
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path103, reason4);
42467
42513
  return { summary: reason4, items: [] };
42468
42514
  }
42469
- async function changedFiles(path101) {
42470
- const status3 = await gitResult(path101, ["status", "--porcelain"]);
42515
+ async function changedFiles(path103) {
42516
+ const status3 = await gitResult(path103, ["status", "--porcelain"]);
42471
42517
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
42472
42518
  return {
42473
42519
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
42474
42520
  items: capped2(lines2)
42475
42521
  };
42476
42522
  }
42477
- async function unpushedCommits(path101, reason4) {
42478
- const log2 = await gitResult(path101, ["log", "--oneline", "@{upstream}..HEAD"]);
42523
+ async function unpushedCommits(path103, reason4) {
42524
+ const log2 = await gitResult(path103, ["log", "--oneline", "@{upstream}..HEAD"]);
42479
42525
  if (!log2.ok) return { summary: reason4, items: [] };
42480
42526
  const lines2 = nonEmptyLines(log2.out);
42481
42527
  return {
@@ -42567,24 +42613,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
42567
42613
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
42568
42614
  const accounted = accountedTrees(sessions);
42569
42615
  const vanished = /* @__PURE__ */ new Map();
42570
- for (const { path: path101, clone } of readWorktreeRegistry()) {
42571
- if (underTempRoot(path101)) {
42572
- forgetWorktree(path101);
42616
+ for (const { path: path103, clone } of readWorktreeRegistry()) {
42617
+ if (underTempRoot(path103)) {
42618
+ forgetWorktree(path103);
42573
42619
  daemonLog(
42574
- `worktree ${path101} lies outside any project root; pruned from the registry rather than recovered`
42620
+ `worktree ${path103} lies outside any project root; pruned from the registry rather than recovered`
42575
42621
  );
42576
42622
  continue;
42577
42623
  }
42578
- if (!existsSync97(path101)) {
42579
- logVanishedTree(sessions, path101);
42624
+ if (!existsSync97(path103)) {
42625
+ logVanishedTree(sessions, path103);
42580
42626
  vanished.set(clone, [
42581
42627
  ...vanished.get(clone) ?? [],
42582
- { path: path101, branch: basename28(path101) }
42628
+ { path: path103, branch: basename28(path103) }
42583
42629
  ]);
42584
42630
  continue;
42585
42631
  }
42586
- if (accounted.has(path101)) continue;
42587
- await recoverOrphan(sessions, spawnWith, { path: path101, clone }, notify2);
42632
+ if (accounted.has(path103)) continue;
42633
+ await recoverOrphan(sessions, spawnWith, { path: path103, clone }, notify2);
42588
42634
  }
42589
42635
  for (const [clone, paths] of vanished)
42590
42636
  await reclaimVanishedWorktrees(clone, paths);
@@ -42592,10 +42638,10 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
42592
42638
 
42593
42639
  // src/commands/sessions/daemon/restoreAllSessions.ts
42594
42640
  function restoreAllSessions(spawner, sessions, notify2) {
42595
- const names2 = restoreAll(spawner, sessions);
42641
+ const names = restoreAll(spawner, sessions);
42596
42642
  reconcileWorktreesOnRestore(sessions, spawner.recoveryCard, notify2);
42597
42643
  rearmStoppedSessions(sessions, notify2);
42598
- return names2;
42644
+ return names;
42599
42645
  }
42600
42646
 
42601
42647
  // src/commands/sessions/daemon/retrySession.ts
@@ -44463,12 +44509,12 @@ function handleSetStatus(client, m, d) {
44463
44509
  import * as fs56 from "fs";
44464
44510
 
44465
44511
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
44466
- import * as path100 from "path";
44512
+ import * as path102 from "path";
44467
44513
  async function findCodexRolloutPath(sessionId) {
44468
44514
  if (!sessionId) return null;
44469
44515
  const paths = await discoverCodexRolloutPaths();
44470
44516
  const suffix = `-${sessionId}.jsonl`;
44471
- return paths.find((file) => path100.basename(file).endsWith(suffix)) ?? null;
44517
+ return paths.find((file) => path102.basename(file).endsWith(suffix)) ?? null;
44472
44518
  }
44473
44519
 
44474
44520
  // src/commands/sessions/shared/codex/codexToolTarget.ts