@staff0rd/assist 0.717.0 → 0.719.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.717.0",
9
+ version: "0.719.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -296,8 +296,8 @@ function getRemoteOriginUrl(cwd) {
296
296
  }
297
297
 
298
298
  // src/commands/backlog/getCurrentOrigin.ts
299
- function stripLeadingSlashes(path103) {
300
- return path103.replace(/^\/+/, "");
299
+ function stripLeadingSlashes(path104) {
300
+ return path104.replace(/^\/+/, "");
301
301
  }
302
302
  function normalizeOrigin(raw) {
303
303
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -347,9 +347,9 @@ function findGitLink(dir) {
347
347
  }
348
348
  return null;
349
349
  }
350
- function isFile(path103) {
350
+ function isFile(path104) {
351
351
  try {
352
- return statSync(path103).isFile();
352
+ return statSync(path104).isFile();
353
353
  } catch {
354
354
  return false;
355
355
  }
@@ -368,9 +368,9 @@ function linkedGitDirParent(gitDir) {
368
368
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
369
369
  return match ? match[1] : null;
370
370
  }
371
- function readTrimmed(path103) {
371
+ function readTrimmed(path104) {
372
372
  try {
373
- const content = readFileSync2(path103, "utf8").trim();
373
+ const content = readFileSync2(path104, "utf8").trim();
374
374
  return content === "" ? null : content;
375
375
  } catch {
376
376
  return null;
@@ -383,10 +383,10 @@ function absolute(target, from) {
383
383
  // src/shared/loadRawYaml.ts
384
384
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
385
385
  import { parse as parseYaml } from "yaml";
386
- function loadRawYaml(path103) {
387
- if (!existsSync3(path103)) return {};
386
+ function loadRawYaml(path104) {
387
+ if (!existsSync3(path104)) return {};
388
388
  try {
389
- const content = readFileSync3(path103, "utf8");
389
+ const content = readFileSync3(path104, "utf8");
390
390
  return parseYaml(content) || {};
391
391
  } catch {
392
392
  return {};
@@ -458,8 +458,8 @@ function mergeRawConfigs(globalRaw, projectRaw) {
458
458
  // src/commands/backlog/originDisplayName.ts
459
459
  function originDisplayName(origin) {
460
460
  if (origin.startsWith("local:")) {
461
- const path103 = origin.slice("local:".length).replace(/\/+$/, "");
462
- const segments = path103.split("/").filter(Boolean);
461
+ const path104 = origin.slice("local:".length).replace(/\/+$/, "");
462
+ const segments = path104.split("/").filter(Boolean);
463
463
  return segments[segments.length - 1] ?? origin;
464
464
  }
465
465
  const firstSlash = origin.indexOf("/");
@@ -4319,8 +4319,8 @@ function getPreferredRemoteRepo(cwd) {
4319
4319
  function gitRefUrl(kind, ref, cwd) {
4320
4320
  const repo = getPreferredRemoteRepo(cwd);
4321
4321
  if (!repo) return void 0;
4322
- const path103 = kind === "branch" ? "tree" : "commit";
4323
- return `https://github.com/${repo.org}/${repo.repo}/${path103}/${ref}`;
4322
+ const path104 = kind === "branch" ? "tree" : "commit";
4323
+ return `https://github.com/${repo.org}/${repo.repo}/${path104}/${ref}`;
4324
4324
  }
4325
4325
 
4326
4326
  // src/commands/sessions/shared/resolveSessionTranscript.ts
@@ -4481,9 +4481,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
4481
4481
  function backupLocalBacklogFiles(dir) {
4482
4482
  const moved = [];
4483
4483
  for (const name of LOCAL_FILES) {
4484
- const path103 = join19(dir, ".assist", name);
4485
- if (existsSync20(path103)) {
4486
- renameSync(path103, `${path103}.bak`);
4484
+ const path104 = join19(dir, ".assist", name);
4485
+ if (existsSync20(path104)) {
4486
+ renameSync(path104, `${path104}.bak`);
4487
4487
  moved.push(`${name} \u2192 ${name}.bak`);
4488
4488
  }
4489
4489
  }
@@ -4967,8 +4967,8 @@ var backlogItemSchema = z4.strictObject({
4967
4967
  var backlogFileSchema = z4.array(backlogItemSchema);
4968
4968
 
4969
4969
  // src/commands/backlog/parseBacklogJsonl.ts
4970
- function parseBacklogJsonl(path103) {
4971
- const content = readFileSync13(path103, "utf8").trim();
4970
+ function parseBacklogJsonl(path104) {
4971
+ const content = readFileSync13(path104, "utf8").trim();
4972
4972
  if (content.length === 0) return [];
4973
4973
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
4974
4974
  }
@@ -5514,9 +5514,9 @@ function originToSshUrl(origin) {
5514
5514
  const firstSlash = origin.indexOf("/");
5515
5515
  if (firstSlash <= 0) return null;
5516
5516
  const host = origin.slice(0, firstSlash);
5517
- const path103 = origin.slice(firstSlash + 1);
5518
- if (!path103) return null;
5519
- return `git@${host}:${path103}.git`;
5517
+ const path104 = origin.slice(firstSlash + 1);
5518
+ if (!path104) return null;
5519
+ return `git@${host}:${path104}.git`;
5520
5520
  }
5521
5521
 
5522
5522
  // src/commands/backlog/cloneRepo.ts
@@ -7154,10 +7154,10 @@ var hooksSettings = {
7154
7154
  }
7155
7155
  };
7156
7156
  function ensureHooksSettings() {
7157
- const path103 = daemonPaths.hooksSettings;
7158
- mkdirSync5(dirname15(path103), { recursive: true });
7159
- writeFileSync16(path103, JSON.stringify(hooksSettings, null, 2));
7160
- return path103;
7157
+ const path104 = daemonPaths.hooksSettings;
7158
+ mkdirSync5(dirname15(path104), { recursive: true });
7159
+ writeFileSync16(path104, JSON.stringify(hooksSettings, null, 2));
7160
+ return path104;
7161
7161
  }
7162
7162
 
7163
7163
  // src/shared/spawnInherit.ts
@@ -7913,24 +7913,24 @@ function getOwnerPath(itemId2) {
7913
7913
  function recordSignalOwner(itemId2) {
7914
7914
  const sessionId = process.env.ASSIST_SESSION_ID;
7915
7915
  if (!sessionId) return;
7916
- const path103 = getOwnerPath(itemId2);
7917
- mkdirSync7(dirname16(path103), { recursive: true });
7918
- writeFileSync18(path103, JSON.stringify({ sessionId }));
7916
+ const path104 = getOwnerPath(itemId2);
7917
+ mkdirSync7(dirname16(path104), { recursive: true });
7918
+ writeFileSync18(path104, JSON.stringify({ sessionId }));
7919
7919
  }
7920
7920
  function readSignalOwner(itemId2) {
7921
- const path103 = getOwnerPath(itemId2);
7922
- if (!existsSync26(path103)) return void 0;
7921
+ const path104 = getOwnerPath(itemId2);
7922
+ if (!existsSync26(path104)) return void 0;
7923
7923
  try {
7924
- const parsed = JSON.parse(readFileSync17(path103, "utf8"));
7924
+ const parsed = JSON.parse(readFileSync17(path104, "utf8"));
7925
7925
  return parsed.sessionId;
7926
7926
  } catch {
7927
7927
  return void 0;
7928
7928
  }
7929
7929
  }
7930
7930
  function clearSignalOwner(itemId2) {
7931
- const path103 = getOwnerPath(itemId2);
7931
+ const path104 = getOwnerPath(itemId2);
7932
7932
  try {
7933
- rmSync(path103);
7933
+ rmSync(path104);
7934
7934
  } catch {
7935
7935
  }
7936
7936
  }
@@ -7967,19 +7967,19 @@ function resolveSignalTarget(event, data) {
7967
7967
  function writeSignal(event, data) {
7968
7968
  const target = resolveSignalTarget(event, data);
7969
7969
  if (!target) return;
7970
- const path103 = getSignalPath(target);
7971
- if (!path103) return;
7970
+ const path104 = getSignalPath(target);
7971
+ if (!path104) return;
7972
7972
  const signal = { event, sessionId: target, ...data };
7973
- mkdirSync8(dirname17(path103), { recursive: true });
7974
- writeFileSync19(path103, JSON.stringify(signal));
7973
+ mkdirSync8(dirname17(path104), { recursive: true });
7974
+ writeFileSync19(path104, JSON.stringify(signal));
7975
7975
  }
7976
7976
 
7977
7977
  // src/commands/backlog/readSignal.ts
7978
7978
  function readSignal() {
7979
- const path103 = getSignalPath();
7980
- if (!path103 || !existsSync27(path103)) return void 0;
7979
+ const path104 = getSignalPath();
7980
+ if (!path104 || !existsSync27(path104)) return void 0;
7981
7981
  try {
7982
- return JSON.parse(readFileSync18(path103, "utf8"));
7982
+ return JSON.parse(readFileSync18(path104, "utf8"));
7983
7983
  } catch {
7984
7984
  return void 0;
7985
7985
  }
@@ -8177,13 +8177,13 @@ function activityPath(sessionId) {
8177
8177
  function emitActivity(activity2) {
8178
8178
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
8179
8179
  if (!sessionId) return;
8180
- const path103 = activityPath(sessionId);
8181
- mkdirSync9(dirname18(path103), { recursive: true });
8182
- writeFileSync20(path103, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8180
+ const path104 = activityPath(sessionId);
8181
+ mkdirSync9(dirname18(path104), { recursive: true });
8182
+ writeFileSync20(path104, JSON.stringify({ ...activity2, startedAt: Date.now() }));
8183
8183
  }
8184
- function readActivity(path103) {
8184
+ function readActivity(path104) {
8185
8185
  try {
8186
- return JSON.parse(readFileSync19(path103, "utf8"));
8186
+ return JSON.parse(readFileSync19(path104, "utf8"));
8187
8187
  } catch {
8188
8188
  return void 0;
8189
8189
  }
@@ -8193,9 +8193,9 @@ function reconcileActivity(sessionId, activity2) {
8193
8193
  removeActivity(sessionId);
8194
8194
  return;
8195
8195
  }
8196
- const path103 = activityPath(sessionId);
8197
- mkdirSync9(dirname18(path103), { recursive: true });
8198
- writeFileSync20(path103, JSON.stringify(activity2));
8196
+ const path104 = activityPath(sessionId);
8197
+ mkdirSync9(dirname18(path104), { recursive: true });
8198
+ writeFileSync20(path104, JSON.stringify(activity2));
8199
8199
  }
8200
8200
  function removeActivity(sessionId) {
8201
8201
  try {
@@ -10820,10 +10820,10 @@ function getStorePath(filename) {
10820
10820
  return join34(getStoreDir(), filename);
10821
10821
  }
10822
10822
  function loadJson(filename) {
10823
- const path103 = getStorePath(filename);
10824
- if (existsSync32(path103)) {
10823
+ const path104 = getStorePath(filename);
10824
+ if (existsSync32(path104)) {
10825
10825
  try {
10826
- return JSON.parse(readFileSync20(path103, "utf8"));
10826
+ return JSON.parse(readFileSync20(path104, "utf8"));
10827
10827
  } catch {
10828
10828
  return {};
10829
10829
  }
@@ -10842,22 +10842,22 @@ function saveJson(filename, data) {
10842
10842
  var REGISTRY_FILE = "worktrees.json";
10843
10843
  function readWorktreeRegistry() {
10844
10844
  const data = loadJson(REGISTRY_FILE);
10845
- return Object.entries(data).filter(([, record]) => !record.reaped).map(([path103, record]) => ({ path: path103, ...record }));
10845
+ return Object.entries(data).filter(([, record]) => !record.reaped).map(([path104, record]) => ({ path: path104, ...record }));
10846
10846
  }
10847
- function worktreeAttributionIncludingReaped(path103) {
10848
- const record = loadJson(REGISTRY_FILE)[path103];
10847
+ function worktreeAttributionIncludingReaped(path104) {
10848
+ const record = loadJson(REGISTRY_FILE)[path104];
10849
10849
  return record ? { clone: record.clone, origin: record.origin } : void 0;
10850
10850
  }
10851
- function recordWorktree(path103, clone, origin) {
10851
+ function recordWorktree(path104, clone, origin) {
10852
10852
  const data = loadJson(REGISTRY_FILE);
10853
- data[path103] = { clone, origin };
10853
+ data[path104] = { clone, origin };
10854
10854
  saveJson(REGISTRY_FILE, data);
10855
10855
  }
10856
- function forgetWorktree(path103) {
10856
+ function forgetWorktree(path104) {
10857
10857
  const data = loadJson(REGISTRY_FILE);
10858
- const record = data[path103];
10858
+ const record = data[path104];
10859
10859
  if (!record || record.reaped) return;
10860
- data[path103] = { ...record, reaped: true };
10860
+ data[path104] = { ...record, reaped: true };
10861
10861
  saveJson(REGISTRY_FILE, data);
10862
10862
  }
10863
10863
 
@@ -11467,10 +11467,10 @@ function completeLines(text18, windowIsPartial) {
11467
11467
  if (windowIsPartial) all.shift();
11468
11468
  return all;
11469
11469
  }
11470
- function readLogTail(path103, lines2) {
11470
+ function readLogTail(path104, lines2) {
11471
11471
  let fd;
11472
11472
  try {
11473
- fd = openSync4(path103, "r");
11473
+ fd = openSync4(path104, "r");
11474
11474
  } catch {
11475
11475
  return [];
11476
11476
  }
@@ -11735,8 +11735,8 @@ async function loadCommittedPaths(cwd, sessionId) {
11735
11735
  for (const commit2 of commits2) {
11736
11736
  const resolved = await resolveCommit(cwd, commit2.sha);
11737
11737
  if (!resolved) continue;
11738
- for (const path103 of resolved.paths) {
11739
- if (!bases.has(path103)) bases.set(path103, resolved.base);
11738
+ for (const path104 of resolved.paths) {
11739
+ if (!bases.has(path104)) bases.set(path104, resolved.base);
11740
11740
  }
11741
11741
  }
11742
11742
  return { commits: commits2, bases };
@@ -11754,16 +11754,16 @@ async function itemChangeSet(cwd, sessionId) {
11754
11754
  }
11755
11755
  function groupByBase(bases) {
11756
11756
  const groups = /* @__PURE__ */ new Map();
11757
- for (const [path103, base] of bases) {
11757
+ for (const [path104, base] of bases) {
11758
11758
  const paths = groups.get(base);
11759
- if (paths) paths.push(path103);
11760
- else groups.set(base, [path103]);
11759
+ if (paths) paths.push(path104);
11760
+ else groups.set(base, [path104]);
11761
11761
  }
11762
11762
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
11763
11763
  }
11764
11764
  async function dirtyPaths(cwd, bases) {
11765
11765
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
11766
- return output.split("\n").filter((path103) => path103 && !bases.has(path103)).sort();
11766
+ return output.split("\n").filter((path104) => path104 && !bases.has(path104)).sort();
11767
11767
  }
11768
11768
 
11769
11769
  // src/commands/sessions/web/scopedDiff.ts
@@ -11772,8 +11772,8 @@ async function scopedDiff(cwd, session, scope) {
11772
11772
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
11773
11773
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
11774
11774
  }
11775
- async function untrackedFileDiff(cwd, path103) {
11776
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path103], {
11775
+ async function untrackedFileDiff(cwd, path104) {
11776
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path104], {
11777
11777
  maxBuffer: MAX_DIFF_BYTES,
11778
11778
  allowFailure: true
11779
11779
  });
@@ -11786,7 +11786,7 @@ async function untrackedDiff(cwd) {
11786
11786
  ]);
11787
11787
  const paths = list5.split("\n").filter(Boolean);
11788
11788
  const diffs = await Promise.all(
11789
- paths.map((path103) => untrackedFileDiff(cwd, path103))
11789
+ paths.map((path104) => untrackedFileDiff(cwd, path104))
11790
11790
  );
11791
11791
  return diffs.join("");
11792
11792
  }
@@ -11879,9 +11879,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve10
11879
11879
  function repoRoot(cwd) {
11880
11880
  return resolve10(cwd);
11881
11881
  }
11882
- function resolveWithinCwd(cwd, path103) {
11882
+ function resolveWithinCwd(cwd, path104) {
11883
11883
  const root2 = repoRoot(cwd);
11884
- const target = resolve10(root2, path103);
11884
+ const target = resolve10(root2, path104);
11885
11885
  const rel = relative2(root2, target);
11886
11886
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
11887
11887
  return target;
@@ -11891,14 +11891,14 @@ function resolveWithinCwd(cwd, path103) {
11891
11891
  function getFileTarget(req, res) {
11892
11892
  const cwd = getCwdParam(req, res);
11893
11893
  if (!cwd) return null;
11894
- const path103 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11894
+ const path104 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
11895
11895
  "path"
11896
11896
  );
11897
- if (!path103) {
11897
+ if (!path104) {
11898
11898
  respondJson(res, 400, { error: "Missing path" });
11899
11899
  return null;
11900
11900
  }
11901
- const target = resolveWithinCwd(cwd, path103);
11901
+ const target = resolveWithinCwd(cwd, path104);
11902
11902
  if (!target) {
11903
11903
  respondJson(res, 400, { error: "Path outside cwd" });
11904
11904
  return null;
@@ -11957,9 +11957,9 @@ function segmentText(segment) {
11957
11957
  if (segment.kind === "index") return `[${segment.index}]`;
11958
11958
  return "[]";
11959
11959
  }
11960
- function formatConfigPath(path103) {
11960
+ function formatConfigPath(path104) {
11961
11961
  let text18 = "";
11962
- for (const segment of path103) {
11962
+ for (const segment of path104) {
11963
11963
  const dotted = segment.kind === "key" || segment.kind === "entry";
11964
11964
  const rendered = segmentText(segment);
11965
11965
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -12120,11 +12120,11 @@ function enumValues(node) {
12120
12120
  function opaqueConfigNode(inner, base) {
12121
12121
  return { ...base, kind: "other", type: leafTypeOf(inner) };
12122
12122
  }
12123
- function build(node, path103) {
12123
+ function build(node, path104) {
12124
12124
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
12125
12125
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
12126
12126
  const base = {
12127
- path: path103,
12127
+ path: path104,
12128
12128
  ...optional ? { optional: true } : {},
12129
12129
  ...defaultValue === void 0 ? {} : { defaultValue },
12130
12130
  ...secret ? { secret: true } : {}
@@ -12180,11 +12180,11 @@ function describeConfigLeaves(schema2) {
12180
12180
 
12181
12181
  // src/commands/config/globalConfigFileLabel.ts
12182
12182
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
12183
- function globalConfigFileLabel(path103) {
12184
- if (path103 === getGlobalConfigPath()) return "~/.assist.yml";
12185
- if (path103.startsWith(WINDOWS_MOUNT_PREFIX))
12186
- return `${path103} on the Windows host`;
12187
- return path103;
12183
+ function globalConfigFileLabel(path104) {
12184
+ if (path104 === getGlobalConfigPath()) return "~/.assist.yml";
12185
+ if (path104.startsWith(WINDOWS_MOUNT_PREFIX))
12186
+ return `${path104} on the Windows host`;
12187
+ return path104;
12188
12188
  }
12189
12189
 
12190
12190
  // src/commands/config/readRawConfigLayers.ts
@@ -12241,35 +12241,35 @@ function isPlainRecord(value) {
12241
12241
  }
12242
12242
 
12243
12243
  // src/shared/mapConfigSecrets.ts
12244
- function mapChildren(value, path103, childNode, map) {
12244
+ function mapChildren(value, path104, childNode, map) {
12245
12245
  if (!isPlainRecord(value)) return value;
12246
12246
  return Object.fromEntries(
12247
12247
  Object.entries(value).map(([name, child]) => [
12248
12248
  name,
12249
- walk(child, [...path103, name], childNode(name), map)
12249
+ walk(child, [...path104, name], childNode(name), map)
12250
12250
  ])
12251
12251
  );
12252
12252
  }
12253
- function mapItems(value, path103, item, map) {
12253
+ function mapItems(value, path104, item, map) {
12254
12254
  if (!Array.isArray(value)) return value;
12255
- return value.map((entry, index3) => walk(entry, [...path103, index3], item, map));
12255
+ return value.map((entry, index3) => walk(entry, [...path104, index3], item, map));
12256
12256
  }
12257
- function walk(value, path103, node, map) {
12257
+ function walk(value, path104, node, map) {
12258
12258
  if (!node || value === void 0 || value === null) return value;
12259
- if (node.secret) return map(value, path103);
12259
+ if (node.secret) return map(value, path104);
12260
12260
  switch (node.kind) {
12261
12261
  case "object":
12262
12262
  case "unionOfObjects":
12263
12263
  return mapChildren(
12264
12264
  value,
12265
- path103,
12265
+ path104,
12266
12266
  (name) => configNodeField(node, name),
12267
12267
  map
12268
12268
  );
12269
12269
  case "objectList":
12270
- return mapItems(value, path103, node.item, map);
12270
+ return mapItems(value, path104, node.item, map);
12271
12271
  case "record":
12272
- return mapChildren(value, path103, () => node.value, map);
12272
+ return mapChildren(value, path104, () => node.value, map);
12273
12273
  default:
12274
12274
  return value;
12275
12275
  }
@@ -12294,9 +12294,9 @@ function isTraversable(value) {
12294
12294
  function stepInto(current, key) {
12295
12295
  return isTraversable(current) ? current[key] : void 0;
12296
12296
  }
12297
- function getNestedValue(obj, path103) {
12297
+ function getNestedValue(obj, path104) {
12298
12298
  let current = obj;
12299
- for (const key of path103.split(".")) current = stepInto(current, key);
12299
+ for (const key of path104.split(".")) current = stepInto(current, key);
12300
12300
  return current;
12301
12301
  }
12302
12302
 
@@ -12346,9 +12346,9 @@ function step(node, segment) {
12346
12346
  return void 0;
12347
12347
  }
12348
12348
  }
12349
- function findConfigNode(root2, path103) {
12349
+ function findConfigNode(root2, path104) {
12350
12350
  let current = root2;
12351
- for (const segment of path103) {
12351
+ for (const segment of path104) {
12352
12352
  if (!current) return void 0;
12353
12353
  current = step(current, segment);
12354
12354
  }
@@ -12365,34 +12365,34 @@ function nameSegment(name) {
12365
12365
  return name === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name };
12366
12366
  }
12367
12367
  function parseConfigPath(text18) {
12368
- const path103 = [];
12368
+ const path104 = [];
12369
12369
  let at2 = 0;
12370
12370
  while (at2 < text18.length) {
12371
12371
  if (text18[at2] === "[") {
12372
12372
  const close = text18.indexOf("]", at2);
12373
12373
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
12374
12374
  if (!segment) return void 0;
12375
- path103.push(segment);
12375
+ path104.push(segment);
12376
12376
  at2 = close + 1;
12377
12377
  continue;
12378
12378
  }
12379
12379
  if (text18[at2] === ".") {
12380
- if (path103.length === 0) return void 0;
12380
+ if (path104.length === 0) return void 0;
12381
12381
  at2 += 1;
12382
12382
  }
12383
12383
  const start3 = at2;
12384
12384
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
12385
12385
  const name = text18.slice(start3, at2);
12386
12386
  if (!name) return void 0;
12387
- path103.push(nameSegment(name));
12387
+ path104.push(nameSegment(name));
12388
12388
  }
12389
- return path103;
12389
+ return path104;
12390
12390
  }
12391
12391
 
12392
12392
  // src/commands/config/configEntryNode.ts
12393
12393
  function configEntryNode(root2, key) {
12394
- const path103 = parseConfigPath(key);
12395
- return path103 ? findConfigNode(root2, path103) : void 0;
12394
+ const path104 = parseConfigPath(key);
12395
+ return path104 ? findConfigNode(root2, path104) : void 0;
12396
12396
  }
12397
12397
 
12398
12398
  // src/commands/backlog/harnessConfigHelp.ts
@@ -13131,7 +13131,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
13131
13131
  const parent = dirname22(branchKeyPath);
13132
13132
  const branchPrefix = basename10(branchKeyPath);
13133
13133
  if (!existsSync34(parent)) return null;
13134
- const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path103) => existsSync34(path103)).map((path103) => ({ path: path103, mtime: statSync5(path103).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13134
+ const synthesisFiles = readdirSync4(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join36(parent, name, "synthesis.md")).filter((path104) => existsSync34(path104)).map((path104) => ({ path: path104, mtime: statSync5(path104).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
13135
13135
  return synthesisFiles[0]?.path ?? null;
13136
13136
  }
13137
13137
 
@@ -13161,12 +13161,12 @@ async function getReviewSynthesis(req, res) {
13161
13161
  const cwd = getCwdParam(req, res);
13162
13162
  if (!cwd) return;
13163
13163
  try {
13164
- const path103 = await resolveSynthesisPath(cwd);
13165
- if (!path103) {
13164
+ const path104 = await resolveSynthesisPath(cwd);
13165
+ if (!path104) {
13166
13166
  respondJson(res, 404, { error: "No synthesis found" });
13167
13167
  return;
13168
13168
  }
13169
- respondJson(res, 200, { synthesis: readFileSync22(path103, "utf8") });
13169
+ respondJson(res, 200, { synthesis: readFileSync22(path104, "utf8") });
13170
13170
  } catch {
13171
13171
  respondJson(res, 404, { error: "No synthesis found" });
13172
13172
  }
@@ -13249,8 +13249,8 @@ function parseDiffNameStatus(output) {
13249
13249
  if (!status3 || fields.length < 2) continue;
13250
13250
  const category = categorize(status3[0]);
13251
13251
  if (!category) continue;
13252
- const path103 = fields[fields.length - 1];
13253
- if (path103) result[category].push(path103);
13252
+ const path104 = fields[fields.length - 1];
13253
+ if (path104) result[category].push(path104);
13254
13254
  }
13255
13255
  return result;
13256
13256
  }
@@ -13460,21 +13460,21 @@ function subsequenceScore(text18, query) {
13460
13460
  }
13461
13461
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13462
13462
  }
13463
- function scoreFilePath(path103, query) {
13463
+ function scoreFilePath(path104, query) {
13464
13464
  const needle = query.trim().toLowerCase();
13465
13465
  if (!needle) return 0;
13466
- const basename30 = path103.slice(path103.lastIndexOf("/") + 1);
13467
- const inBasename = subsequenceScore(basename30, needle);
13466
+ const basename31 = path104.slice(path104.lastIndexOf("/") + 1);
13467
+ const inBasename = subsequenceScore(basename31, needle);
13468
13468
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13469
- return subsequenceScore(path103, needle);
13469
+ return subsequenceScore(path104, needle);
13470
13470
  }
13471
13471
 
13472
13472
  // src/commands/sessions/web/rankFilePaths.ts
13473
13473
  function rankFilePaths(paths, query, limit) {
13474
13474
  const scored = [];
13475
- for (const path103 of paths) {
13476
- const score = scoreFilePath(path103, query);
13477
- if (score !== null) scored.push({ path: path103, score });
13475
+ for (const path104 of paths) {
13476
+ const score = scoreFilePath(path104, query);
13477
+ if (score !== null) scored.push({ path: path104, score });
13478
13478
  }
13479
13479
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
13480
13480
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -14184,11 +14184,11 @@ function logLinkedRequest(req, res) {
14184
14184
  const started = Date.now();
14185
14185
  const from = req.headers[LINKED_FROM_HEADER2];
14186
14186
  const trace = req.headers[TRACE_HEADER] ?? "none";
14187
- const path103 = new URL(req.url ?? "/", "http://localhost").pathname;
14187
+ const path104 = new URL(req.url ?? "/", "http://localhost").pathname;
14188
14188
  res.once("finish", () => {
14189
- if (isQuietPoll(path103, res.statusCode)) return;
14189
+ if (isQuietPoll(path104, res.statusCode)) return;
14190
14190
  console.log(
14191
- `link-from ${from} http: ${req.method} ${path103} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14191
+ `link-from ${from} http: ${req.method} ${path104} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
14192
14192
  );
14193
14193
  });
14194
14194
  }
@@ -14576,8 +14576,8 @@ async function liveDeployments(cwd, repo, environments) {
14576
14576
 
14577
14577
  // src/commands/sessions/web/releases/latestRun.ts
14578
14578
  async function latestRun(cwd, repo, workflow) {
14579
- const path103 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14580
- const response = await ghJson(cwd, ["api", path103]);
14579
+ const path104 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
14580
+ const response = await ghJson(cwd, ["api", path104]);
14581
14581
  const run4 = response.workflow_runs?.[0];
14582
14582
  if (!run4) return null;
14583
14583
  return {
@@ -14858,38 +14858,38 @@ async function performRestart(target, deps2 = {}) {
14858
14858
  import { relative as relative3 } from "path";
14859
14859
 
14860
14860
  // src/commands/sessions/web/revertPathChanges.ts
14861
- async function isTracked(cwd, path103) {
14861
+ async function isTracked(cwd, path104) {
14862
14862
  try {
14863
- await execGit(cwd, ["ls-files", "--error-unmatch", "--", path103]);
14863
+ await execGit(cwd, ["ls-files", "--error-unmatch", "--", path104]);
14864
14864
  return true;
14865
14865
  } catch {
14866
14866
  return false;
14867
14867
  }
14868
14868
  }
14869
- async function isInHead(cwd, path103) {
14870
- const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path103]);
14869
+ async function isInHead(cwd, path104) {
14870
+ const listing = await execGit(cwd, ["ls-tree", "HEAD", "--", path104]);
14871
14871
  return listing.trim().length > 0;
14872
14872
  }
14873
- async function revertPathChanges(cwd, path103) {
14874
- if (!await isTracked(cwd, path103)) {
14875
- await execGit(cwd, ["clean", "-f", "--", path103]);
14873
+ async function revertPathChanges(cwd, path104) {
14874
+ if (!await isTracked(cwd, path104)) {
14875
+ await execGit(cwd, ["clean", "-f", "--", path104]);
14876
14876
  return;
14877
14877
  }
14878
- if (await isInHead(cwd, path103)) {
14879
- await execGit(cwd, ["checkout", "HEAD", "--", path103]);
14878
+ if (await isInHead(cwd, path104)) {
14879
+ await execGit(cwd, ["checkout", "HEAD", "--", path104]);
14880
14880
  return;
14881
14881
  }
14882
- await execGit(cwd, ["rm", "-f", "--", path103]);
14882
+ await execGit(cwd, ["rm", "-f", "--", path104]);
14883
14883
  }
14884
14884
 
14885
14885
  // src/commands/sessions/web/revertDiffFile.ts
14886
14886
  async function revertDiffFile(req, res) {
14887
14887
  const resolved = getFileTarget(req, res);
14888
14888
  if (!resolved) return;
14889
- const path103 = relative3(repoRoot(resolved.cwd), resolved.target);
14889
+ const path104 = relative3(repoRoot(resolved.cwd), resolved.target);
14890
14890
  try {
14891
- await revertPathChanges(resolved.cwd, path103);
14892
- respondJson(res, 200, { reverted: path103 });
14891
+ await revertPathChanges(resolved.cwd, path104);
14892
+ respondJson(res, 200, { reverted: path104 });
14893
14893
  } catch (error) {
14894
14894
  respondJson(res, 500, {
14895
14895
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -14994,7 +14994,7 @@ async function readJsonBody(req) {
14994
14994
  function requestedPaths(body) {
14995
14995
  const paths = body.paths;
14996
14996
  if (!Array.isArray(paths)) return null;
14997
- if (paths.some((path103) => typeof path103 !== "string")) return null;
14997
+ if (paths.some((path104) => typeof path104 !== "string")) return null;
14998
14998
  return paths;
14999
14999
  }
15000
15000
  async function revertDiffPaths(req, res) {
@@ -15014,10 +15014,10 @@ async function revertDiffPaths(req, res) {
15014
15014
  const root2 = repoRoot(cwd);
15015
15015
  const reverted = [];
15016
15016
  const failed3 = [];
15017
- for (const path103 of paths) {
15018
- const target = resolveWithinCwd(cwd, path103);
15017
+ for (const path104 of paths) {
15018
+ const target = resolveWithinCwd(cwd, path104);
15019
15019
  if (!target) {
15020
- failed3.push({ path: path103, error: "Path outside cwd" });
15020
+ failed3.push({ path: path104, error: "Path outside cwd" });
15021
15021
  continue;
15022
15022
  }
15023
15023
  const relativePath = relative4(root2, target);
@@ -15116,11 +15116,11 @@ function coerceStructuredConfigValue(key, raw) {
15116
15116
  };
15117
15117
  }
15118
15118
  function formatIssue(key, issue) {
15119
- const path103 = formatConfigPath([
15119
+ const path104 = formatConfigPath([
15120
15120
  { kind: "key", name: key },
15121
15121
  ...issue.path.map(toSegment)
15122
15122
  ]);
15123
- return `${path103}: ${issue.message}`;
15123
+ return `${path104}: ${issue.message}`;
15124
15124
  }
15125
15125
  function toSegment(part) {
15126
15126
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -15215,9 +15215,9 @@ function coerceUnion(key, raw, types) {
15215
15215
  }
15216
15216
 
15217
15217
  // src/shared/valueAtConfigPath.ts
15218
- function valueAtConfigPath(value, path103) {
15218
+ function valueAtConfigPath(value, path104) {
15219
15219
  let current = value;
15220
- for (const key of path103) {
15220
+ for (const key of path104) {
15221
15221
  if (typeof key === "number") {
15222
15222
  if (!Array.isArray(current)) return void 0;
15223
15223
  current = current[key];
@@ -15234,7 +15234,7 @@ function restoreConfigSecrets(value, stored, node) {
15234
15234
  return mapConfigSecrets(
15235
15235
  value,
15236
15236
  node,
15237
- (secret, path103) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path103) : secret
15237
+ (secret, path104) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path104) : secret
15238
15238
  );
15239
15239
  }
15240
15240
 
@@ -15283,8 +15283,8 @@ function stepIntoNested(container, key, nextKey) {
15283
15283
  }
15284
15284
  return ensureObject(container, resolved);
15285
15285
  }
15286
- function setNestedValue(obj, path103, value) {
15287
- const keys = path103.split(".");
15286
+ function setNestedValue(obj, path104, value) {
15287
+ const keys = path104.split(".");
15288
15288
  const result = { ...obj };
15289
15289
  let current = result;
15290
15290
  for (let i = 0; i < keys.length - 1; i++) {
@@ -15311,8 +15311,8 @@ function formatIssue2(issue, key) {
15311
15311
  return issue.keys.map(
15312
15312
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
15313
15313
  );
15314
- const path103 = issue.path.length > 0 ? issue.path.join(".") : key;
15315
- return [`${path103}: ${issue.message}`];
15314
+ const path104 = issue.path.length > 0 ? issue.path.join(".") : key;
15315
+ return [`${path104}: ${issue.message}`];
15316
15316
  }
15317
15317
 
15318
15318
  // src/commands/config/applyConfigSet.ts
@@ -15554,8 +15554,8 @@ function removeAt(container, keys) {
15554
15554
  }
15555
15555
  return removeFromChild(container, key, rest);
15556
15556
  }
15557
- function unsetNestedValue(obj, path103) {
15558
- const { container, removed } = removeAt(obj, path103.split("."));
15557
+ function unsetNestedValue(obj, path104) {
15558
+ const { container, removed } = removeAt(obj, path104.split("."));
15559
15559
  return { config: container, removed };
15560
15560
  }
15561
15561
 
@@ -17044,13 +17044,13 @@ function findBuiltinDenyRaw(rawCommand) {
17044
17044
 
17045
17045
  // src/commands/cliHook/findRestrictedPathDeny.ts
17046
17046
  var RESTRICTED_PATHS = [".assist/restricted"];
17047
- function restrictedPathRegex(path103) {
17048
- const pattern2 = path103.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17047
+ function restrictedPathRegex(path104) {
17048
+ const pattern2 = path104.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
17049
17049
  return new RegExp(pattern2);
17050
17050
  }
17051
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path103) => ({
17052
- path: path103,
17053
- regex: restrictedPathRegex(path103)
17051
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path104) => ({
17052
+ path: path104,
17053
+ regex: restrictedPathRegex(path104)
17054
17054
  }));
17055
17055
  function findRestrictedPathDenyRaw(rawCommand) {
17056
17056
  const rule = RESTRICTED_PATH_RULES.find(
@@ -17227,9 +17227,9 @@ var __dirname4 = dirname25(__filename3);
17227
17227
  function packageRoot() {
17228
17228
  return __dirname4;
17229
17229
  }
17230
- function readLines(path103) {
17231
- if (!existsSync40(path103)) return [];
17232
- return readFileSync25(path103, "utf8").split("\n").filter((line) => line.trim() !== "");
17230
+ function readLines(path104) {
17231
+ if (!existsSync40(path104)) return [];
17232
+ return readFileSync25(path104, "utf8").split("\n").filter((line) => line.trim() !== "");
17233
17233
  }
17234
17234
  var cachedReads;
17235
17235
  var cachedWrites;
@@ -17761,14 +17761,14 @@ function showProgress(p, label2) {
17761
17761
  const pct = Math.round(p.done / p.total * 100);
17762
17762
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
17763
17763
  }
17764
- async function resolveCommand2(cli, path103, description, depth, p) {
17765
- showProgress(p, path103.join(" "));
17766
- const subHelp = await runHelp([cli, ...path103]);
17764
+ async function resolveCommand2(cli, path104, description, depth, p) {
17765
+ showProgress(p, path104.join(" "));
17766
+ const subHelp = await runHelp([cli, ...path104]);
17767
17767
  if (!subHelp || !hasSubcommands(subHelp)) {
17768
- return [{ path: path103, description }];
17768
+ return [{ path: path104, description }];
17769
17769
  }
17770
- const children = await discoverAt(cli, path103, depth + 1, p);
17771
- return children.length > 0 ? children : [{ path: path103, description }];
17770
+ const children = await discoverAt(cli, path104, depth + 1, p);
17771
+ return children.length > 0 ? children : [{ path: path104, description }];
17772
17772
  }
17773
17773
  async function discoverAt(cli, parentPath, depth, p) {
17774
17774
  if (depth > SAFETY_DEPTH) return [];
@@ -17916,9 +17916,9 @@ function logPath(cli) {
17916
17916
  return join43(homedir17(), ".assist", `cli-discover-${safeName}.log`);
17917
17917
  }
17918
17918
  function readCache(cli) {
17919
- const path103 = logPath(cli);
17920
- if (!existsSync42(path103)) return void 0;
17921
- return readFileSync27(path103, "utf8");
17919
+ const path104 = logPath(cli);
17920
+ if (!existsSync42(path104)) return void 0;
17921
+ return readFileSync27(path104, "utf8");
17922
17922
  }
17923
17923
  function writeCache(cli, output) {
17924
17924
  const dir = join43(homedir17(), ".assist");
@@ -18107,9 +18107,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18107
18107
  }
18108
18108
  const cutoff = Date.now() - STALE_AFTER_MS;
18109
18109
  for (const entry of entries) {
18110
- const path103 = join45(dir, entry);
18110
+ const path104 = join45(dir, entry);
18111
18111
  try {
18112
- if (statSync7(path103).mtimeMs < cutoff) unlinkSync7(path103);
18112
+ if (statSync7(path104).mtimeMs < cutoff) unlinkSync7(path104);
18113
18113
  } catch {
18114
18114
  continue;
18115
18115
  }
@@ -18119,10 +18119,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
18119
18119
  // src/commands/codeComment/readPinState.ts
18120
18120
  import { existsSync as existsSync43, readFileSync as readFileSync28 } from "fs";
18121
18121
  function readPinState(pin2) {
18122
- const path103 = getPinStatePath(pin2);
18123
- if (!existsSync43(path103)) return void 0;
18122
+ const path104 = getPinStatePath(pin2);
18123
+ if (!existsSync43(path104)) return void 0;
18124
18124
  try {
18125
- const state = JSON.parse(readFileSync28(path103, "utf8"));
18125
+ const state = JSON.parse(readFileSync28(path104, "utf8"));
18126
18126
  if (state.pin !== pin2) return void 0;
18127
18127
  return state;
18128
18128
  } catch {
@@ -18543,8 +18543,8 @@ function findUnmergedPaths() {
18543
18543
  }
18544
18544
  const found = /* @__PURE__ */ new Set();
18545
18545
  for (const line of output.split("\n")) {
18546
- const path103 = line.split(" ")[1];
18547
- if (path103) found.add(path103.trim());
18546
+ const path104 = line.split(" ")[1];
18547
+ if (path104) found.add(path104.trim());
18548
18548
  }
18549
18549
  return [...found];
18550
18550
  }
@@ -19791,11 +19791,11 @@ async function loadPath(source) {
19791
19791
  }
19792
19792
  }
19793
19793
  async function criteriaExtension() {
19794
- const path103 = await loadPath(criteriaExtensionDir());
19794
+ const path104 = await loadPath(criteriaExtensionDir());
19795
19795
  console.log(
19796
19796
  chalk137.bold("acceptance criteria outliner \u2014 GitHub browser extension")
19797
19797
  );
19798
- console.log(chalk137.dim(`load the unpacked extension from ${path103}`));
19798
+ console.log(chalk137.dim(`load the unpacked extension from ${path104}`));
19799
19799
  }
19800
19800
 
19801
19801
  // src/commands/criteriaExtension/signCriteriaExtension.ts
@@ -19920,10 +19920,10 @@ async function signCriteriaExtension() {
19920
19920
  process.exitCode = 1;
19921
19921
  return;
19922
19922
  }
19923
- const path103 = await signedAddonInstallPath(
19923
+ const path104 = await signedAddonInstallPath(
19924
19924
  await copySignedXpi(xpi, ARTIFACTS_DIR)
19925
19925
  );
19926
- console.log(chalk139.dim(`install the signed add-on from ${path103}`));
19926
+ console.log(chalk139.dim(`install the signed add-on from ${path104}`));
19927
19927
  }
19928
19928
 
19929
19929
  // src/commands/registerCriteriaExtension.ts
@@ -20021,10 +20021,10 @@ function getMigrationApprovalPath(migrationId) {
20021
20021
  // src/commands/dbMigration/readMigrationPinState.ts
20022
20022
  import { existsSync as existsSync48, readFileSync as readFileSync30 } from "fs";
20023
20023
  function readMigrationPinState(pin2) {
20024
- const path103 = getMigrationPinPath(pin2);
20025
- if (!existsSync48(path103)) return void 0;
20024
+ const path104 = getMigrationPinPath(pin2);
20025
+ if (!existsSync48(path104)) return void 0;
20026
20026
  try {
20027
- const state = JSON.parse(readFileSync30(path103, "utf8"));
20027
+ const state = JSON.parse(readFileSync30(path104, "utf8"));
20028
20028
  if (state.pin !== pin2) return void 0;
20029
20029
  if (!Number.isInteger(state.migrationId)) return void 0;
20030
20030
  return state;
@@ -21934,10 +21934,10 @@ function decideCommentGuard(input, existingContent) {
21934
21934
  import { existsSync as existsSync54, unlinkSync as unlinkSync11 } from "fs";
21935
21935
  function consumeMigrationApproval(migrationId) {
21936
21936
  sweepRestrictedDir();
21937
- const path103 = getMigrationApprovalPath(migrationId);
21938
- if (!existsSync54(path103)) return false;
21937
+ const path104 = getMigrationApprovalPath(migrationId);
21938
+ if (!existsSync54(path104)) return false;
21939
21939
  try {
21940
- unlinkSync11(path103);
21940
+ unlinkSync11(path104);
21941
21941
  return true;
21942
21942
  } catch {
21943
21943
  return false;
@@ -24341,11 +24341,11 @@ function recentDaemonLogLines(includeRelayed = true) {
24341
24341
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
24342
24342
  import { realpathSync as realpathSync2 } from "fs";
24343
24343
  import { resolve as resolve15 } from "path";
24344
- function canonicalTreePath(path103) {
24344
+ function canonicalTreePath(path104) {
24345
24345
  try {
24346
- return realpathSync2(path103);
24346
+ return realpathSync2(path104);
24347
24347
  } catch {
24348
- return resolve15(path103);
24348
+ return resolve15(path104);
24349
24349
  }
24350
24350
  }
24351
24351
 
@@ -24398,22 +24398,22 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
24398
24398
  const registered = new Set(listWorktreePaths(clone));
24399
24399
  const branches = new Set(listLocalBranches(clone));
24400
24400
  const isTaken = (candidate) => registered.has(candidate) || existsSync57(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename17(candidate));
24401
- const path103 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24401
+ const path104 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
24402
24402
  const start3 = worktreeStartPoint(clone, strategy.trunk);
24403
24403
  gitSync(clone, [
24404
24404
  "worktree",
24405
24405
  "add",
24406
24406
  start3.track ? "--track" : "--no-track",
24407
24407
  "-b",
24408
- basename17(path103),
24409
- path103,
24408
+ basename17(path104),
24409
+ path104,
24410
24410
  start3.ref
24411
24411
  ]);
24412
- recordWorktree(path103, clone, getCurrentOrigin(clone));
24412
+ recordWorktree(path104, clone, getCurrentOrigin(clone));
24413
24413
  daemonLog(
24414
- start3.track ? `worktree allocated ${path103} (branch ${basename17(path103)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path103} (branch ${basename17(path103)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24414
+ start3.track ? `worktree allocated ${path104} (branch ${basename17(path104)} tracking ${start3.ref}) for clone ${clone}` : `worktree allocated ${path104} (branch ${basename17(path104)} off ${start3.ref}, no mainline tracking) for clone ${clone}`
24415
24415
  );
24416
- return path103;
24416
+ return path104;
24417
24417
  }
24418
24418
 
24419
24419
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -24554,13 +24554,13 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
24554
24554
  if (forcedSpill) daemonLog(forcedSpill);
24555
24555
  else if (reusesClone(clone, boundTreeRoots2, reuse))
24556
24556
  return { cwd: clone, kind: "primary", created: false, clone };
24557
- const path103 = createWorktree(
24557
+ const path104 = createWorktree(
24558
24558
  clone,
24559
24559
  { root: cfg.root, trunk: cfg.trunk },
24560
24560
  boundTreeRoots2,
24561
24561
  options2.replacesTree
24562
24562
  );
24563
- return { cwd: path103, kind: "worktree", created: true, clone };
24563
+ return { cwd: path104, kind: "worktree", created: true, clone };
24564
24564
  }
24565
24565
 
24566
24566
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -24910,13 +24910,13 @@ function worktreeHoldingBranch(cwd, branch2) {
24910
24910
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
24911
24911
  if (!listing) return null;
24912
24912
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
24913
- let path103 = null;
24913
+ let path104 = null;
24914
24914
  for (const line of listing.split("\n")) {
24915
24915
  const trimmed = line.trim();
24916
24916
  if (trimmed.startsWith("worktree "))
24917
- path103 = trimmed.slice("worktree ".length).trim();
24917
+ path104 = trimmed.slice("worktree ".length).trim();
24918
24918
  else if (trimmed === `branch refs/heads/${branch2}`)
24919
- return path103 && path103 !== here ? path103 : null;
24919
+ return path104 && path104 !== here ? path104 : null;
24920
24920
  }
24921
24921
  return null;
24922
24922
  }
@@ -26020,9 +26020,9 @@ function parseRscRows(flight) {
26020
26020
  }
26021
26021
  function makeRscResolver(rows) {
26022
26022
  return (ref) => {
26023
- const [id, ...path103] = ref.slice(1).replace(/^[L@]/, "").split(":");
26023
+ const [id, ...path104] = ref.slice(1).replace(/^[L@]/, "").split(":");
26024
26024
  let v = rows[id];
26025
- for (const key of path103) {
26025
+ for (const key of path104) {
26026
26026
  if (v == null || typeof v !== "object") return void 0;
26027
26027
  v = v[key];
26028
26028
  }
@@ -26773,18 +26773,18 @@ function validateLine(line) {
26773
26773
  process.exit(1);
26774
26774
  }
26775
26775
  }
26776
- async function comment2(path103, line, body, options2 = {}) {
26776
+ async function comment2(path104, line, body, options2 = {}) {
26777
26777
  const { startLine, skipPreview } = options2;
26778
26778
  validateBody(body);
26779
26779
  validateLine(line);
26780
26780
  if (startLine !== void 0) validateLine(startLine);
26781
26781
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
26782
26782
  if (!skipPreview)
26783
- await reviewProposedPrComment(`Comment on ${path103}:${range}`, body, null);
26783
+ await reviewProposedPrComment(`Comment on ${path104}:${range}`, body, null);
26784
26784
  try {
26785
26785
  const prId = getCurrentPrNodeId();
26786
- postReviewComment({ prId, body, path: path103, line, startLine });
26787
- console.log(`Added review comment on ${path103}:${range}`);
26786
+ postReviewComment({ prId, body, path: path104, line, startLine });
26787
+ console.log(`Added review comment on ${path104}:${range}`);
26788
26788
  } catch (error) {
26789
26789
  if (isGhNotInstalled(error)) {
26790
26790
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -27353,9 +27353,9 @@ function registerPrsComments(prsCommand) {
27353
27353
  });
27354
27354
  prsCommand.command("comment <path> <line> <body>").description(
27355
27355
  "Add a line comment to the pending review (body of - reads it from stdin)"
27356
- ).action(async (path103, line, body) => {
27356
+ ).action(async (path104, line, body) => {
27357
27357
  await comment2(
27358
- path103,
27358
+ path104,
27359
27359
  Number.parseInt(line, 10),
27360
27360
  await readBodyArgument(body)
27361
27361
  );
@@ -28576,11 +28576,11 @@ async function loadBody(target) {
28576
28576
  if (target.kind === "file") return readDraftFile(target.path);
28577
28577
  return fetchPrBody(target.number, target.repo);
28578
28578
  }
28579
- function readDraftFile(path103) {
28579
+ function readDraftFile(path104) {
28580
28580
  try {
28581
- return readFileSync44(path103, "utf8");
28581
+ return readFileSync44(path104, "utf8");
28582
28582
  } catch {
28583
- console.error(`Error: Could not read \`${path103}\`.`);
28583
+ console.error(`Error: Could not read \`${path104}\`.`);
28584
28584
  console.error(
28585
28585
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
28586
28586
  );
@@ -28860,10 +28860,10 @@ function resolveOpSecret(reference) {
28860
28860
  }
28861
28861
 
28862
28862
  // src/commands/ravendb/ravenFetch.ts
28863
- async function ravenFetch(connection, path103) {
28863
+ async function ravenFetch(connection, path104) {
28864
28864
  const apiKey = resolveOpSecret(connection.apiKeyRef);
28865
28865
  let accessToken = await getAccessToken(apiKey);
28866
- const url = `${connection.url}${path103}`;
28866
+ const url = `${connection.url}${path104}`;
28867
28867
  const headers = {
28868
28868
  Authorization: `Bearer ${accessToken}`,
28869
28869
  "Content-Type": "application/json"
@@ -28953,16 +28953,16 @@ import chalk195 from "chalk";
28953
28953
  // src/commands/ravendb/buildQueryPath.ts
28954
28954
  function buildQueryPath(opts) {
28955
28955
  const db = encodeURIComponent(opts.db);
28956
- let path103;
28956
+ let path104;
28957
28957
  if (opts.collection) {
28958
- path103 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28958
+ path104 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
28959
28959
  } else {
28960
- path103 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28960
+ path104 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
28961
28961
  }
28962
28962
  if (opts.query) {
28963
- path103 += `&query=${encodeURIComponent(opts.query)}`;
28963
+ path104 += `&query=${encodeURIComponent(opts.query)}`;
28964
28964
  }
28965
- return path103;
28965
+ return path104;
28966
28966
  }
28967
28967
 
28968
28968
  // src/commands/ravendb/fetchAllPages.ts
@@ -28971,7 +28971,7 @@ async function fetchAllPages(connection, opts) {
28971
28971
  let start3 = 0;
28972
28972
  while (true) {
28973
28973
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
28974
- const path103 = buildQueryPath({
28974
+ const path104 = buildQueryPath({
28975
28975
  db: connection.database,
28976
28976
  collection: opts.collection,
28977
28977
  start: start3,
@@ -28979,7 +28979,7 @@ async function fetchAllPages(connection, opts) {
28979
28979
  sort: opts.sort,
28980
28980
  query: opts.query
28981
28981
  });
28982
- const data = await ravenFetch(connection, path103);
28982
+ const data = await ravenFetch(connection, path104);
28983
28983
  const results = data.Results ?? [];
28984
28984
  const totalResults = data.TotalResults ?? 0;
28985
28985
  if (results.length === 0) break;
@@ -32406,8 +32406,8 @@ function groupFilesByDirectory(files) {
32406
32406
  }
32407
32407
 
32408
32408
  // src/commands/review/highLevel/buildHighLevelTree.ts
32409
- function basename19(path103) {
32410
- return path103.slice(path103.lastIndexOf("/") + 1);
32409
+ function basename19(path104) {
32410
+ return path104.slice(path104.lastIndexOf("/") + 1);
32411
32411
  }
32412
32412
  function sum(nodes, key) {
32413
32413
  return nodes.reduce((total, node) => total + node[key], 0);
@@ -32430,19 +32430,19 @@ function nodesOf(at2, prefix2) {
32430
32430
  }
32431
32431
  function collapsedDirNode(name, at2, prefix2) {
32432
32432
  let label2 = name;
32433
- let path103 = prefix2 ? `${prefix2}/${name}` : name;
32433
+ let path104 = prefix2 ? `${prefix2}/${name}` : name;
32434
32434
  let node = at2;
32435
32435
  while (node.files.length === 0 && node.dirs.size === 1) {
32436
32436
  const [childName, child] = [...node.dirs][0];
32437
32437
  label2 = `${label2}/${childName}`;
32438
- path103 = `${path103}/${childName}`;
32438
+ path104 = `${path104}/${childName}`;
32439
32439
  node = child;
32440
32440
  }
32441
- const children = nodesOf(node, path103);
32441
+ const children = nodesOf(node, path104);
32442
32442
  return {
32443
32443
  kind: "dir",
32444
32444
  name: label2,
32445
- path: path103,
32445
+ path: path104,
32446
32446
  additions: sum(children, "additions"),
32447
32447
  deletions: sum(children, "deletions"),
32448
32448
  children
@@ -32700,8 +32700,8 @@ function toStatus(status3) {
32700
32700
  if (status3 === "removed") return "removed";
32701
32701
  return "modified";
32702
32702
  }
32703
- function diffUrl(repo, prNumber, path103) {
32704
- const anchor = createHash3("sha256").update(path103).digest("hex");
32703
+ function diffUrl(repo, prNumber, path104) {
32704
+ const anchor = createHash3("sha256").update(path104).digest("hex");
32705
32705
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
32706
32706
  }
32707
32707
  function fetchHighLevelFiles(prNumber, repo) {
@@ -32757,10 +32757,10 @@ function highLevelReviewPath(repo, headRef, headSha) {
32757
32757
 
32758
32758
  // src/commands/review/highLevel/loadHighLevelReview.ts
32759
32759
  function loadHighLevelReview(repo, headRef, headSha) {
32760
- const path103 = highLevelReviewPath(repo, headRef, headSha);
32761
- if (!existsSync64(path103)) return void 0;
32760
+ const path104 = highLevelReviewPath(repo, headRef, headSha);
32761
+ if (!existsSync64(path104)) return void 0;
32762
32762
  try {
32763
- return JSON.parse(readFileSync47(path103, "utf8"));
32763
+ return JSON.parse(readFileSync47(path104, "utf8"));
32764
32764
  } catch {
32765
32765
  return void 0;
32766
32766
  }
@@ -32771,8 +32771,8 @@ import { minimatch as minimatch7 } from "minimatch";
32771
32771
  function selectCriticalDiffs(files, criticalPaths) {
32772
32772
  if (criticalPaths.length === 0) return [];
32773
32773
  return files.filter((file) => criticalPaths.some((glob) => minimatch7(file.path, glob))).map(
32774
- ({ path: path103, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32775
- path: path103,
32774
+ ({ path: path104, status: status3, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
32775
+ path: path104,
32776
32776
  status: status3,
32777
32777
  additions,
32778
32778
  deletions,
@@ -32887,11 +32887,11 @@ function highLevelPreviewPayload(subject) {
32887
32887
  import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync39 } from "fs";
32888
32888
  import { dirname as dirname36 } from "path";
32889
32889
  function saveHighLevelReview(record) {
32890
- const path103 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32891
- mkdirSync22(dirname36(path103), { recursive: true });
32892
- writeFileSync39(path103, `${JSON.stringify(record, null, 2)}
32890
+ const path104 = highLevelReviewPath(record.repo, record.headRef, record.headSha);
32891
+ mkdirSync22(dirname36(path104), { recursive: true });
32892
+ writeFileSync39(path104, `${JSON.stringify(record, null, 2)}
32893
32893
  `);
32894
- return path103;
32894
+ return path104;
32895
32895
  }
32896
32896
 
32897
32897
  // src/commands/review/highLevel/openHighLevelOverlay.ts
@@ -32910,9 +32910,9 @@ async function openHighLevelOverlay(sessionId, subject) {
32910
32910
  { rejectIsOutcome: true }
32911
32911
  );
32912
32912
  const record = buildHighLevelRecord(subject, decision);
32913
- const path103 = saveHighLevelReview(record);
32913
+ const path104 = saveHighLevelReview(record);
32914
32914
  console.log(`Verdict: ${record.verdict}`);
32915
- console.log(`Saved ${path103}`);
32915
+ console.log(`Saved ${path104}`);
32916
32916
  console.log("Nothing was posted to GitHub.");
32917
32917
  return record;
32918
32918
  }
@@ -33927,8 +33927,8 @@ async function handlePostSynthesis(synthesisPath, prInfo, options2) {
33927
33927
  // src/commands/review/prepareReviewDir.ts
33928
33928
  import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
33929
33929
  function clearReviewFiles(paths) {
33930
- for (const path103 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33931
- if (existsSync65(path103)) unlinkSync18(path103);
33930
+ for (const path104 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
33931
+ if (existsSync65(path104)) unlinkSync18(path104);
33932
33932
  }
33933
33933
  }
33934
33934
  function prepareReviewDir(paths, requestBody, force) {
@@ -35458,8 +35458,8 @@ import chalk240 from "chalk";
35458
35458
 
35459
35459
  // src/commands/seq/fetchSeq.ts
35460
35460
  import chalk237 from "chalk";
35461
- async function fetchSeq(conn, path103, params) {
35462
- const url = `${conn.url}${path103}?${params}`;
35461
+ async function fetchSeq(conn, path104, params) {
35462
+ const url = `${conn.url}${path104}?${params}`;
35463
35463
  const response = await fetch(url, {
35464
35464
  headers: {
35465
35465
  Accept: "application/json",
@@ -35840,7 +35840,7 @@ async function previewSlackThreadParts({
35840
35840
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
35841
35841
  );
35842
35842
  paths.forEach(
35843
- (path103, index3) => console.log(`${index3 + 1}/${paths.length} ${path103}`)
35843
+ (path104, index3) => console.log(`${index3 + 1}/${paths.length} ${path104}`)
35844
35844
  );
35845
35845
  console.log(
35846
35846
  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.`
@@ -36181,9 +36181,8 @@ function registerSql(program2) {
36181
36181
  }
36182
36182
 
36183
36183
  // src/commands/sync.ts
36184
- import * as fs47 from "fs";
36185
36184
  import * as os5 from "os";
36186
- import * as path96 from "path";
36185
+ import * as path97 from "path";
36187
36186
  import { fileURLToPath as fileURLToPath8 } from "url";
36188
36187
 
36189
36188
  // src/commands/sync/pruneCommands.ts
@@ -36262,52 +36261,36 @@ function reportPrune(label2, result, force) {
36262
36261
  }
36263
36262
  }
36264
36263
 
36265
- // src/commands/sync/reportRetiredAgentsFiles.ts
36266
- import * as fs40 from "fs";
36267
- import * as path88 from "path";
36268
- var retired = [
36269
- path88.join(harnesses.claude.homeDir, "CLAUDE.md"),
36270
- path88.join(harnesses.codex.homeDir, "AGENTS.md"),
36271
- path88.join(harnesses.pi.homeDir, "AGENTS.md")
36272
- ];
36273
- function reportRetiredAgentsFiles() {
36274
- const leftovers = retired.filter((file) => fs40.existsSync(file));
36275
- if (leftovers.length === 0) return;
36276
- console.log(
36277
- "No longer written by sync \u2014 each harness now composes its own advice at session start:"
36278
- );
36279
- for (const file of leftovers) console.log(` ${file}`);
36280
- console.log(
36281
- " Delete them, or they keep injecting the retired global instructions."
36282
- );
36283
- }
36264
+ // src/commands/sync/syncClaudeCommands.ts
36265
+ import * as fs43 from "fs";
36266
+ import * as path91 from "path";
36284
36267
 
36285
36268
  // src/commands/sync/syncCodex.ts
36286
- import * as path91 from "path";
36269
+ import * as path90 from "path";
36287
36270
 
36288
36271
  // src/commands/sync/installHarnessCommands.ts
36289
- import * as fs41 from "fs";
36290
- import * as path89 from "path";
36272
+ import * as fs40 from "fs";
36273
+ import * as path88 from "path";
36291
36274
  function installHarnessCommands(claudeDir, harness, transform) {
36292
- const commandsSource = path89.join(claudeDir, "commands");
36293
- const files = fs41.readdirSync(commandsSource);
36275
+ const commandsSource = path88.join(claudeDir, "commands");
36276
+ const files = fs40.readdirSync(commandsSource);
36294
36277
  const names = [];
36295
36278
  let synced = 0;
36296
36279
  for (const file of files) {
36297
36280
  if (!file.endsWith(".md")) continue;
36298
36281
  const name = file.replace(/\.md$/, "");
36299
36282
  names.push(name);
36300
- const content = fs41.readFileSync(path89.join(commandsSource, file), "utf8");
36301
- const target = path89.join(harness.homeDir, harness.sync.commandDest(name));
36302
- fs41.mkdirSync(path89.dirname(target), { recursive: true });
36303
- fs41.writeFileSync(target, transform(name, content));
36283
+ const content = fs40.readFileSync(path88.join(commandsSource, file), "utf8");
36284
+ const target = path88.join(harness.homeDir, harness.sync.commandDest(name));
36285
+ fs40.mkdirSync(path88.dirname(target), { recursive: true });
36286
+ fs40.writeFileSync(target, transform(name, content));
36304
36287
  synced++;
36305
36288
  }
36306
36289
  return { total: files.length, synced, names };
36307
36290
  }
36308
36291
 
36309
36292
  // src/commands/sync/pruneSkills.ts
36310
- import * as fs42 from "fs";
36293
+ import * as fs41 from "fs";
36311
36294
  function pruneSkills(targetDir, skillNames, options2) {
36312
36295
  return pruneTarget(
36313
36296
  targetDir,
@@ -36320,15 +36303,15 @@ function pruneSkills(targetDir, skillNames, options2) {
36320
36303
  );
36321
36304
  }
36322
36305
  function unexpectedContent(skillDir) {
36323
- const entries = fs42.readdirSync(skillDir);
36306
+ const entries = fs41.readdirSync(skillDir);
36324
36307
  const others = entries.filter((entry) => entry !== "SKILL.md");
36325
36308
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
36326
36309
  return entries.length === 0 ? "no SKILL.md" : void 0;
36327
36310
  }
36328
36311
 
36329
36312
  // src/commands/sync/syncCodexHooks.ts
36330
- import * as fs43 from "fs";
36331
- import * as path90 from "path";
36313
+ import * as fs42 from "fs";
36314
+ import * as path89 from "path";
36332
36315
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
36333
36316
  var END = "# <<< assist codex hooks (managed) <<<";
36334
36317
  function upsertManagedBlock(existing, body) {
@@ -36358,11 +36341,11 @@ ${rest}
36358
36341
  `;
36359
36342
  }
36360
36343
  function syncCodexHooks(sourcePath) {
36361
- const body = fs43.readFileSync(sourcePath, "utf8");
36362
- const configPath = path90.join(harnesses.codex.homeDir, "config.toml");
36363
- const existing = fs43.existsSync(configPath) ? fs43.readFileSync(configPath, "utf8") : "";
36364
- fs43.mkdirSync(path90.dirname(configPath), { recursive: true });
36365
- fs43.writeFileSync(configPath, upsertManagedBlock(existing, body));
36344
+ const body = fs42.readFileSync(sourcePath, "utf8");
36345
+ const configPath = path89.join(harnesses.codex.homeDir, "config.toml");
36346
+ const existing = fs42.existsSync(configPath) ? fs42.readFileSync(configPath, "utf8") : "";
36347
+ fs42.mkdirSync(path89.dirname(configPath), { recursive: true });
36348
+ fs42.writeFileSync(configPath, upsertManagedBlock(existing, body));
36366
36349
  console.log(
36367
36350
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
36368
36351
  );
@@ -36393,57 +36376,117 @@ function syncCodex(claudeDir, options2) {
36393
36376
  harnesses.codex,
36394
36377
  commandToSkill
36395
36378
  );
36396
- syncCodexHooks(path91.join(claudeDir, "..", "codex", "config.toml"));
36379
+ syncCodexHooks(path90.join(claudeDir, "..", "codex", "config.toml"));
36397
36380
  console.log(`Synced ${total} skill(s) to ~/.codex/skills`);
36398
36381
  if (!options2?.prune) return;
36399
36382
  const force = options2.force ?? false;
36400
36383
  reportPrune(
36401
36384
  "~/.codex/skills",
36402
- pruneSkills(path91.join(harnesses.codex.homeDir, "skills"), names, { force }),
36385
+ pruneSkills(path90.join(harnesses.codex.homeDir, "skills"), names, { force }),
36403
36386
  force
36404
36387
  );
36405
36388
  }
36406
36389
 
36407
- // src/commands/sync/syncDesign.ts
36390
+ // src/commands/sync/syncClaudeCommands.ts
36391
+ function isSkillFlagged(content) {
36392
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
36393
+ return match ? /^skill:\s*true\s*$/m.test(match[1]) : false;
36394
+ }
36395
+ function replaceFileWithoutFollowingSymlink(file, content) {
36396
+ fs43.rmSync(file, { force: true });
36397
+ fs43.writeFileSync(file, content);
36398
+ }
36399
+ function writeSkill(targetBase, name, content) {
36400
+ const skillDir = path91.join(targetBase, "skills", name);
36401
+ fs43.mkdirSync(skillDir, { recursive: true });
36402
+ replaceFileWithoutFollowingSymlink(
36403
+ path91.join(skillDir, "SKILL.md"),
36404
+ commandToSkill(name, content)
36405
+ );
36406
+ fs43.rmSync(path91.join(targetBase, "commands", `${name}.md`), { force: true });
36407
+ console.log(`Wrote ${name} as a skill to ${skillDir}`);
36408
+ }
36409
+ function syncClaudeCommands(claudeDir, targetBase) {
36410
+ const sourceDir = path91.join(claudeDir, "commands");
36411
+ const targetDir = path91.join(targetBase, "commands");
36412
+ fs43.mkdirSync(targetDir, { recursive: true });
36413
+ const files = fs43.readdirSync(sourceDir);
36414
+ for (const file of files) {
36415
+ const source = path91.join(sourceDir, file);
36416
+ if (file.endsWith(".md")) {
36417
+ const content = fs43.readFileSync(source, "utf8");
36418
+ if (isSkillFlagged(content)) {
36419
+ writeSkill(targetBase, path91.basename(file, ".md"), content);
36420
+ continue;
36421
+ }
36422
+ }
36423
+ fs43.copyFileSync(source, path91.join(targetDir, file));
36424
+ console.log(`Copied ${file} to ${targetDir}`);
36425
+ }
36426
+ console.log(`Synced ${files.length} command(s) to ~/.claude`);
36427
+ return files;
36428
+ }
36429
+
36430
+ // src/commands/sync/reportRetiredAgentsFiles.ts
36408
36431
  import * as fs44 from "fs";
36409
36432
  import * as path92 from "path";
36433
+ var retired = [
36434
+ path92.join(harnesses.claude.homeDir, "CLAUDE.md"),
36435
+ path92.join(harnesses.codex.homeDir, "AGENTS.md"),
36436
+ path92.join(harnesses.pi.homeDir, "AGENTS.md")
36437
+ ];
36438
+ function reportRetiredAgentsFiles() {
36439
+ const leftovers = retired.filter((file) => fs44.existsSync(file));
36440
+ if (leftovers.length === 0) return;
36441
+ console.log(
36442
+ "No longer written by sync \u2014 each harness now composes its own advice at session start:"
36443
+ );
36444
+ for (const file of leftovers) console.log(` ${file}`);
36445
+ console.log(
36446
+ " Delete them, or they keep injecting the retired global instructions."
36447
+ );
36448
+ }
36449
+
36450
+ // src/commands/sync/syncDesign.ts
36451
+ import * as fs45 from "fs";
36452
+ import * as path93 from "path";
36410
36453
  function syncDesign(claudeDir, targetBase) {
36411
- const systemPromptSource = path92.join(claudeDir, "design-system-prompt.md");
36412
- const systemPromptTarget = path92.join(targetBase, "design-system-prompt.md");
36413
- fs44.copyFileSync(systemPromptSource, systemPromptTarget);
36454
+ const systemPromptSource = path93.join(claudeDir, "design-system-prompt.md");
36455
+ const systemPromptTarget = path93.join(targetBase, "design-system-prompt.md");
36456
+ fs45.copyFileSync(systemPromptSource, systemPromptTarget);
36414
36457
  console.log(
36415
36458
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
36416
36459
  );
36417
- const skillsSource = path92.join(claudeDir, "skills");
36418
- const skillsTarget = path92.join(targetBase, "skills");
36419
- fs44.mkdirSync(skillsTarget, { recursive: true });
36420
- const files = fs44.readdirSync(skillsSource);
36460
+ const skillsSource = path93.join(claudeDir, "skills");
36461
+ const skillsTarget = path93.join(targetBase, "skills");
36462
+ fs45.mkdirSync(skillsTarget, { recursive: true });
36463
+ const files = fs45.readdirSync(skillsSource);
36421
36464
  for (const file of files) {
36422
- fs44.copyFileSync(
36423
- path92.join(skillsSource, file),
36424
- path92.join(skillsTarget, file)
36465
+ fs45.copyFileSync(
36466
+ path93.join(skillsSource, file),
36467
+ path93.join(skillsTarget, file)
36425
36468
  );
36426
36469
  }
36427
36470
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
36428
36471
  }
36429
36472
 
36430
36473
  // src/commands/sync/syncPi.ts
36431
- import * as path94 from "path";
36474
+ import * as path95 from "path";
36432
36475
 
36433
36476
  // src/commands/sync/syncPiHooks.ts
36434
- import * as fs45 from "fs";
36435
- import * as path93 from "path";
36477
+ import * as fs46 from "fs";
36478
+ import * as path94 from "path";
36436
36479
  function piExtensionsDir() {
36437
- return path93.join(harnesses.pi.homeDir, "extensions");
36480
+ return path94.join(harnesses.pi.homeDir, "extensions");
36438
36481
  }
36439
36482
  function syncPiHooks(sourceDir) {
36440
36483
  const target = piExtensionsDir();
36441
- fs45.mkdirSync(target, { recursive: true });
36442
- const files = fs45.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36484
+ fs46.mkdirSync(target, { recursive: true });
36485
+ const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
36443
36486
  for (const file of files) {
36444
- fs45.copyFileSync(
36445
- path93.join(sourceDir, file),
36446
- path93.join(target, `assist-${file}`)
36487
+ fs46.copyFileSync(
36488
+ path94.join(sourceDir, file),
36489
+ path94.join(target, `assist-${file}`)
36447
36490
  );
36448
36491
  }
36449
36492
  console.log(
@@ -36480,28 +36523,28 @@ function syncPi(claudeDir, options2) {
36480
36523
  harnesses.pi,
36481
36524
  commandToPrompt
36482
36525
  );
36483
- syncPiHooks(path94.join(claudeDir, "..", "pi"));
36526
+ syncPiHooks(path95.join(claudeDir, "..", "pi"));
36484
36527
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
36485
36528
  if (!options2?.prune) return;
36486
36529
  const force = options2.force ?? false;
36487
36530
  reportPrune(
36488
36531
  "~/.pi/agent/prompts",
36489
- pruneCommands(path94.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36532
+ pruneCommands(path95.join(harnesses.pi.homeDir, "prompts"), names, { force }),
36490
36533
  force
36491
36534
  );
36492
36535
  }
36493
36536
 
36494
36537
  // src/commands/sync/syncSettings.ts
36495
- import * as fs46 from "fs";
36496
- import * as path95 from "path";
36538
+ import * as fs47 from "fs";
36539
+ import * as path96 from "path";
36497
36540
  import chalk247 from "chalk";
36498
36541
  async function syncSettings(claudeDir, targetBase, options2) {
36499
- const source = path95.join(claudeDir, "settings.json");
36500
- const target = path95.join(targetBase, "settings.json");
36501
- const sourceContent = fs46.readFileSync(source, "utf8");
36542
+ const source = path96.join(claudeDir, "settings.json");
36543
+ const target = path96.join(targetBase, "settings.json");
36544
+ const sourceContent = fs47.readFileSync(source, "utf8");
36502
36545
  const sourceSettings = JSON.parse(sourceContent);
36503
- const targetExists = fs46.existsSync(target);
36504
- const targetContent = targetExists ? fs46.readFileSync(target, "utf8") : "";
36546
+ const targetExists = fs47.existsSync(target);
36547
+ const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
36505
36548
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
36506
36549
  const mergedContent = JSON.stringify(
36507
36550
  { ...preservedUserSettings, ...sourceSettings },
@@ -36531,46 +36574,34 @@ async function syncSettings(claudeDir, targetBase, options2) {
36531
36574
  }
36532
36575
  }
36533
36576
  }
36534
- fs46.writeFileSync(target, mergedContent);
36577
+ fs47.writeFileSync(target, mergedContent);
36535
36578
  console.log("Copied settings.json to ~/.claude/settings.json");
36536
36579
  }
36537
36580
 
36538
36581
  // src/commands/sync.ts
36539
36582
  var __filename4 = fileURLToPath8(import.meta.url);
36540
- var __dirname5 = path96.dirname(__filename4);
36583
+ var __dirname5 = path97.dirname(__filename4);
36541
36584
  async function sync(options2) {
36542
36585
  const config = loadConfig();
36543
36586
  const yes = options2?.yes ?? config.sync.autoConfirm;
36544
36587
  const prune = { prune: options2?.prune, force: options2?.force };
36545
- const claudeDir = path96.join(__dirname5, "..", "claude");
36546
- const targetBase = path96.join(os5.homedir(), ".claude");
36547
- const commandFiles = syncCommands(claudeDir, targetBase);
36588
+ const claudeDir = path97.join(__dirname5, "..", "claude");
36589
+ const targetBase = path97.join(os5.homedir(), ".claude");
36590
+ const commandFiles = syncClaudeCommands(claudeDir, targetBase);
36548
36591
  syncDesign(claudeDir, targetBase);
36549
36592
  await syncSettings(claudeDir, targetBase, { yes });
36550
36593
  syncCodex(claudeDir, prune);
36551
36594
  syncPi(claudeDir, prune);
36552
36595
  reportRetiredAgentsFiles();
36553
36596
  if (!options2?.prune) return;
36554
- const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path96.basename(file, ".md"));
36597
+ const commandNames = commandFiles.filter((file) => file.endsWith(".md")).map((file) => path97.basename(file, ".md"));
36555
36598
  const force = options2.force ?? false;
36556
36599
  reportPrune(
36557
36600
  "~/.claude/commands",
36558
- pruneCommands(path96.join(targetBase, "commands"), commandNames, { force }),
36601
+ pruneCommands(path97.join(targetBase, "commands"), commandNames, { force }),
36559
36602
  force
36560
36603
  );
36561
36604
  }
36562
- function syncCommands(claudeDir, targetBase) {
36563
- const sourceDir = path96.join(claudeDir, "commands");
36564
- const targetDir = path96.join(targetBase, "commands");
36565
- fs47.mkdirSync(targetDir, { recursive: true });
36566
- const files = fs47.readdirSync(sourceDir);
36567
- for (const file of files) {
36568
- fs47.copyFileSync(path96.join(sourceDir, file), path96.join(targetDir, file));
36569
- console.log(`Copied ${file} to ${targetDir}`);
36570
- }
36571
- console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
36572
- return files;
36573
- }
36574
36605
 
36575
36606
  // src/commands/registerSync.ts
36576
36607
  function registerSync(program2) {
@@ -36843,9 +36874,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
36843
36874
  }
36844
36875
 
36845
36876
  // src/commands/transcript/convert/readCleanedCues.ts
36846
- import { readFileSync as readFileSync58 } from "fs";
36877
+ import { readFileSync as readFileSync59 } from "fs";
36847
36878
  function readCleanedCues(inputPath) {
36848
- return deduplicateCues(parseVtt(readFileSync58(inputPath, "utf8")));
36879
+ return deduplicateCues(parseVtt(readFileSync59(inputPath, "utf8")));
36849
36880
  }
36850
36881
 
36851
36882
  // src/commands/transcript/clean.ts
@@ -36955,20 +36986,20 @@ async function configure() {
36955
36986
 
36956
36987
  // src/commands/transcript/list.ts
36957
36988
  import { existsSync as existsSync76, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
36958
- import { join as join92 } from "path";
36989
+ import { join as join93 } from "path";
36959
36990
  function list3() {
36960
36991
  const { vttDir } = getTranscriptConfig();
36961
36992
  if (!existsSync76(vttDir)) return;
36962
36993
  for (const entry of readdirSync20(vttDir)) {
36963
36994
  if (!entry.endsWith(".vtt")) continue;
36964
- if (statSync12(join92(vttDir, entry)).isDirectory()) continue;
36995
+ if (statSync12(join93(vttDir, entry)).isDirectory()) continue;
36965
36996
  console.log(entry);
36966
36997
  }
36967
36998
  }
36968
36999
 
36969
37000
  // src/commands/transcript/move.ts
36970
- import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync49 } from "fs";
36971
- import { basename as basename23, join as join93 } from "path";
37001
+ import { existsSync as existsSync77, mkdirSync as mkdirSync32, renameSync as renameSync2, writeFileSync as writeFileSync50 } from "fs";
37002
+ import { basename as basename24, join as join94 } from "path";
36972
37003
 
36973
37004
  // src/commands/transcript/convertVttToMarkdown.ts
36974
37005
  function convertVttToMarkdown(inputPath) {
@@ -36978,9 +37009,9 @@ function convertVttToMarkdown(inputPath) {
36978
37009
  // src/commands/transcript/move.ts
36979
37010
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
36980
37011
  function archiveRawVtt(vttDir, sourcePath, filename) {
36981
- const processedDir = join93(vttDir, "processed");
37012
+ const processedDir = join94(vttDir, "processed");
36982
37013
  mkdirSync32(processedDir, { recursive: true });
36983
- renameSync2(sourcePath, join93(processedDir, filename));
37014
+ renameSync2(sourcePath, join94(processedDir, filename));
36984
37015
  }
36985
37016
  function move(file, options2) {
36986
37017
  const { date, client } = options2;
@@ -36989,27 +37020,27 @@ function move(file, options2) {
36989
37020
  process.exit(1);
36990
37021
  }
36991
37022
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
36992
- const filename = basename23(file);
36993
- const sourcePath = join93(vttDir, filename);
37023
+ const filename = basename24(file);
37024
+ const sourcePath = join94(vttDir, filename);
36994
37025
  if (!existsSync77(sourcePath)) {
36995
37026
  console.error(`Error: VTT file not found: ${sourcePath}`);
36996
37027
  process.exit(1);
36997
37028
  }
36998
- const base = basename23(filename, ".vtt").replace(/ Transcription$/, "");
37029
+ const base = basename24(filename, ".vtt").replace(/ Transcription$/, "");
36999
37030
  const outputName = `${date} ${base}.md`;
37000
- const formattedDir = join93(transcriptsDir, client);
37031
+ const formattedDir = join94(transcriptsDir, client);
37001
37032
  mkdirSync32(formattedDir, { recursive: true });
37002
- const formattedPath = join93(formattedDir, outputName);
37003
- writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
37033
+ const formattedPath = join94(formattedDir, outputName);
37034
+ writeFileSync50(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
37004
37035
  archiveRawVtt(vttDir, sourcePath, filename);
37005
- const summaryPath = join93(summaryDir, client, outputName);
37036
+ const summaryPath = join94(summaryDir, client, outputName);
37006
37037
  console.log(`Formatted transcript: ${formattedPath}`);
37007
37038
  console.log(`Summary target: ${summaryPath}`);
37008
37039
  }
37009
37040
 
37010
37041
  // src/commands/transcript/merge.ts
37011
- import { existsSync as existsSync78, writeFileSync as writeFileSync50 } from "fs";
37012
- import { basename as basename24 } from "path";
37042
+ import { existsSync as existsSync78, writeFileSync as writeFileSync51 } from "fs";
37043
+ import { basename as basename25 } from "path";
37013
37044
 
37014
37045
  // src/commands/transcript/failTranscript.ts
37015
37046
  function failTranscript(message3) {
@@ -37155,7 +37186,7 @@ function readSource3(file) {
37155
37186
  if (!existsSync78(file)) failTranscript(`VTT file not found: ${file}`);
37156
37187
  const cues = readCleanedCues(file);
37157
37188
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
37158
- return { path: file, name: basename24(file), cues };
37189
+ return { path: file, name: basename25(file), cues };
37159
37190
  }
37160
37191
  function wholePassages(sources) {
37161
37192
  return sources.map((source) => ({
@@ -37185,7 +37216,7 @@ async function merge(files, options2 = {}) {
37185
37216
  console.log(document);
37186
37217
  return;
37187
37218
  }
37188
- writeFileSync50(options2.out, `${document}
37219
+ writeFileSync51(options2.out, `${document}
37189
37220
  `, "utf8");
37190
37221
  console.log(`Merged transcript: ${options2.out}`);
37191
37222
  }
@@ -37619,13 +37650,13 @@ function configKeys2() {
37619
37650
  }
37620
37651
 
37621
37652
  // src/commands/verify/forbiddenStrings.ts
37622
- import { existsSync as existsSync79, readFileSync as readFileSync59 } from "fs";
37653
+ import { existsSync as existsSync79, readFileSync as readFileSync60 } from "fs";
37623
37654
 
37624
37655
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
37625
37656
  import { minimatch as minimatch9 } from "minimatch";
37626
- function resolveStringsAtPath(data, path103) {
37657
+ function resolveStringsAtPath(data, path104) {
37627
37658
  let current = data;
37628
- for (const segment of path103.split(".")) {
37659
+ for (const segment of path104.split(".")) {
37629
37660
  if (current === null || typeof current !== "object") return [];
37630
37661
  current = current[segment];
37631
37662
  }
@@ -37638,10 +37669,10 @@ function resolveStringsAtPath(data, path103) {
37638
37669
  }
37639
37670
  function findRuleViolations(data, rule) {
37640
37671
  const violations = [];
37641
- for (const path103 of rule.paths) {
37642
- for (const value of resolveStringsAtPath(data, path103)) {
37672
+ for (const path104 of rule.paths) {
37673
+ for (const value of resolveStringsAtPath(data, path104)) {
37643
37674
  if (minimatch9(value, rule.disallowed))
37644
- violations.push({ file: rule.file, path: path103, value });
37675
+ violations.push({ file: rule.file, path: path104, value });
37645
37676
  }
37646
37677
  }
37647
37678
  return violations;
@@ -37666,7 +37697,7 @@ function forbiddenStrings() {
37666
37697
  }
37667
37698
  let parsed;
37668
37699
  try {
37669
- parsed = JSON.parse(readFileSync59(file, "utf8"));
37700
+ parsed = JSON.parse(readFileSync60(file, "utf8"));
37670
37701
  } catch (error) {
37671
37702
  console.log(`Could not parse ${file}: ${error.message}`);
37672
37703
  process.exit(1);
@@ -37680,8 +37711,8 @@ function forbiddenStrings() {
37680
37711
  process.exit(0);
37681
37712
  }
37682
37713
  console.log("Forbidden strings found:\n");
37683
- for (const { file, path: path103, value } of violations) {
37684
- console.log(` ${file} ${path103}: ${value}`);
37714
+ for (const { file, path: path104, value } of violations) {
37715
+ console.log(` ${file} ${path104}: ${value}`);
37685
37716
  }
37686
37717
  console.log(`
37687
37718
  Total: ${violations.length} forbidden string(s).`);
@@ -37736,8 +37767,8 @@ Total: ${lines2.length} hardcoded color(s)`);
37736
37767
  }
37737
37768
 
37738
37769
  // src/commands/verify/migrations.ts
37739
- import { readFileSync as readFileSync60 } from "fs";
37740
- import path98 from "path";
37770
+ import { readFileSync as readFileSync61 } from "fs";
37771
+ import path99 from "path";
37741
37772
 
37742
37773
  // src/commands/verify/migrations/checkAppendOnly.ts
37743
37774
  function checkAppendOnly(baseline, current) {
@@ -37816,7 +37847,7 @@ function listMigrationFiles(dir) {
37816
37847
 
37817
37848
  // src/commands/verify/migrations/readBaselineMigrations.ts
37818
37849
  import { execSync as execSync63 } from "child_process";
37819
- import { basename as basename25 } from "path";
37850
+ import { basename as basename26 } from "path";
37820
37851
  var MIGRATION_FILE3 = /^migration\d+[A-Za-z0-9]*\.ts$/;
37821
37852
  function readBaselineMigrations(repoRelativeDir, ref) {
37822
37853
  const baseline = /* @__PURE__ */ new Map();
@@ -37829,15 +37860,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
37829
37860
  } catch {
37830
37861
  return baseline;
37831
37862
  }
37832
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path103) => MIGRATION_FILE3.test(basename25(path103)));
37833
- for (const path103 of paths) {
37863
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path104) => MIGRATION_FILE3.test(basename26(path104)));
37864
+ for (const path104 of paths) {
37834
37865
  try {
37835
- const content = execSync63(`git show "${ref}:${path103}"`, {
37866
+ const content = execSync63(`git show "${ref}:${path104}"`, {
37836
37867
  encoding: "utf8",
37837
37868
  maxBuffer: 16 * 1024 * 1024,
37838
37869
  stdio: ["pipe", "pipe", "pipe"]
37839
37870
  });
37840
- baseline.set(basename25(path103), content);
37871
+ baseline.set(basename26(path104), content);
37841
37872
  } catch {
37842
37873
  }
37843
37874
  }
@@ -37876,11 +37907,11 @@ function resolveBaselineRef() {
37876
37907
  }
37877
37908
 
37878
37909
  // src/commands/verify/migrations/migrationsDir.ts
37879
- import path97 from "path";
37910
+ import path98 from "path";
37880
37911
  import { fileURLToPath as fileURLToPath9 } from "url";
37881
37912
  function migrationsDir() {
37882
- return path97.resolve(
37883
- path97.dirname(fileURLToPath9(import.meta.url)),
37913
+ return path98.resolve(
37914
+ path98.dirname(fileURLToPath9(import.meta.url)),
37884
37915
  "../../../shared/db/migrations"
37885
37916
  );
37886
37917
  }
@@ -37901,7 +37932,7 @@ function migrations2() {
37901
37932
  if (ref) {
37902
37933
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
37903
37934
  const current = new Map(
37904
- files.map((file) => [file, readFileSync60(path98.join(dir, file), "utf8")])
37935
+ files.map((file) => [file, readFileSync61(path99.join(dir, file), "utf8")])
37905
37936
  );
37906
37937
  for (const finding of checkAppendOnly(baseline, current)) {
37907
37938
  problems.push(
@@ -38038,50 +38069,50 @@ function registerVerify(program2) {
38038
38069
 
38039
38070
  // src/commands/voice/devices.ts
38040
38071
  import { spawnSync as spawnSync9 } from "child_process";
38041
- import { join as join95 } from "path";
38072
+ import { join as join96 } from "path";
38042
38073
 
38043
38074
  // src/commands/voice/shared.ts
38044
38075
  import { homedir as homedir25 } from "os";
38045
- import { dirname as dirname40, join as join94 } from "path";
38076
+ import { dirname as dirname40, join as join95 } from "path";
38046
38077
  import { fileURLToPath as fileURLToPath10 } from "url";
38047
38078
  var __dirname6 = dirname40(fileURLToPath10(import.meta.url));
38048
- var VOICE_DIR = join94(homedir25(), ".assist", "voice");
38079
+ var VOICE_DIR = join95(homedir25(), ".assist", "voice");
38049
38080
  var voicePaths = {
38050
38081
  dir: VOICE_DIR,
38051
- pid: join94(VOICE_DIR, "voice.pid"),
38052
- log: join94(VOICE_DIR, "voice.log"),
38053
- venv: join94(VOICE_DIR, ".venv"),
38054
- lock: join94(VOICE_DIR, "voice.lock")
38082
+ pid: join95(VOICE_DIR, "voice.pid"),
38083
+ log: join95(VOICE_DIR, "voice.log"),
38084
+ venv: join95(VOICE_DIR, ".venv"),
38085
+ lock: join95(VOICE_DIR, "voice.lock")
38055
38086
  };
38056
38087
  function getPythonDir() {
38057
- return join94(__dirname6, "commands", "voice", "python");
38088
+ return join95(__dirname6, "commands", "voice", "python");
38058
38089
  }
38059
38090
  function getVenvPython() {
38060
- return process.platform === "win32" ? join94(voicePaths.venv, "Scripts", "python.exe") : join94(voicePaths.venv, "bin", "python");
38091
+ return process.platform === "win32" ? join95(voicePaths.venv, "Scripts", "python.exe") : join95(voicePaths.venv, "bin", "python");
38061
38092
  }
38062
38093
  function getLockDir() {
38063
38094
  const config = loadConfig();
38064
38095
  return config.voice?.lockDir ?? VOICE_DIR;
38065
38096
  }
38066
38097
  function getLockFile() {
38067
- return join94(getLockDir(), "voice.lock");
38098
+ return join95(getLockDir(), "voice.lock");
38068
38099
  }
38069
38100
 
38070
38101
  // src/commands/voice/devices.ts
38071
38102
  function devices() {
38072
- const script = join95(getPythonDir(), "list_devices.py");
38103
+ const script = join96(getPythonDir(), "list_devices.py");
38073
38104
  spawnSync9(getVenvPython(), [script], { stdio: "inherit" });
38074
38105
  }
38075
38106
 
38076
38107
  // src/commands/voice/logs.ts
38077
- import { existsSync as existsSync80, readFileSync as readFileSync61 } from "fs";
38108
+ import { existsSync as existsSync80, readFileSync as readFileSync62 } from "fs";
38078
38109
  function logs(options2) {
38079
38110
  if (!existsSync80(voicePaths.log)) {
38080
38111
  console.log("No voice log file found");
38081
38112
  return;
38082
38113
  }
38083
38114
  const count8 = Number.parseInt(options2.lines ?? "150", 10);
38084
- const content = readFileSync61(voicePaths.log, "utf8").trim();
38115
+ const content = readFileSync62(voicePaths.log, "utf8").trim();
38085
38116
  if (!content) {
38086
38117
  console.log("Voice log is empty");
38087
38118
  return;
@@ -38104,12 +38135,12 @@ function logs(options2) {
38104
38135
  // src/commands/voice/setup.ts
38105
38136
  import { spawnSync as spawnSync10 } from "child_process";
38106
38137
  import { mkdirSync as mkdirSync34 } from "fs";
38107
- import { join as join97 } from "path";
38138
+ import { join as join98 } from "path";
38108
38139
 
38109
38140
  // src/commands/voice/checkLockFile.ts
38110
38141
  import { execSync as execSync66 } from "child_process";
38111
- import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync62, writeFileSync as writeFileSync51 } from "fs";
38112
- import { join as join96 } from "path";
38142
+ import { existsSync as existsSync81, mkdirSync as mkdirSync33, readFileSync as readFileSync63, writeFileSync as writeFileSync52 } from "fs";
38143
+ import { join as join97 } from "path";
38113
38144
  function isProcessAlive2(pid) {
38114
38145
  try {
38115
38146
  process.kill(pid, 0);
@@ -38122,7 +38153,7 @@ function checkLockFile() {
38122
38153
  const lockFile = getLockFile();
38123
38154
  if (!existsSync81(lockFile)) return;
38124
38155
  try {
38125
- const lock2 = JSON.parse(readFileSync62(lockFile, "utf8"));
38156
+ const lock2 = JSON.parse(readFileSync63(lockFile, "utf8"));
38126
38157
  if (lock2.pid && isProcessAlive2(lock2.pid)) {
38127
38158
  console.error(
38128
38159
  `Voice daemon already running (PID ${lock2.pid}, env: ${lock2.env}). Stop it first with: assist voice stop`
@@ -38146,8 +38177,8 @@ function bootstrapVenv() {
38146
38177
  }
38147
38178
  function writeLockFile(pid) {
38148
38179
  const lockFile = getLockFile();
38149
- mkdirSync33(join96(lockFile, ".."), { recursive: true });
38150
- writeFileSync51(
38180
+ mkdirSync33(join97(lockFile, ".."), { recursive: true });
38181
+ writeFileSync52(
38151
38182
  lockFile,
38152
38183
  JSON.stringify({
38153
38184
  pid,
@@ -38162,7 +38193,7 @@ function setup() {
38162
38193
  mkdirSync34(voicePaths.dir, { recursive: true });
38163
38194
  bootstrapVenv();
38164
38195
  console.log("\nDownloading models...\n");
38165
- const script = join97(getPythonDir(), "setup_models.py");
38196
+ const script = join98(getPythonDir(), "setup_models.py");
38166
38197
  const result = spawnSync10(getVenvPython(), [script], {
38167
38198
  stdio: "inherit",
38168
38199
  env: { ...process.env, VOICE_LOG_FILE: voicePaths.log }
@@ -38175,8 +38206,8 @@ function setup() {
38175
38206
 
38176
38207
  // src/commands/voice/start.ts
38177
38208
  import { spawn as spawn9 } from "child_process";
38178
- import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync52 } from "fs";
38179
- import { join as join98 } from "path";
38209
+ import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync53 } from "fs";
38210
+ import { join as join99 } from "path";
38180
38211
 
38181
38212
  // src/commands/voice/buildDaemonEnv.ts
38182
38213
  function buildDaemonEnv(options2) {
@@ -38204,7 +38235,7 @@ function spawnBackground(python, script, env) {
38204
38235
  console.error("Failed to start voice daemon");
38205
38236
  process.exit(1);
38206
38237
  }
38207
- writeFileSync52(voicePaths.pid, String(pid));
38238
+ writeFileSync53(voicePaths.pid, String(pid));
38208
38239
  writeLockFile(pid);
38209
38240
  console.log(`Voice daemon started (PID ${pid})`);
38210
38241
  }
@@ -38214,7 +38245,7 @@ function start2(options2) {
38214
38245
  bootstrapVenv();
38215
38246
  const debug = options2.debug || options2.foreground || process.platform === "win32";
38216
38247
  const env = buildDaemonEnv({ debug });
38217
- const script = join98(getPythonDir(), "voice_daemon.py");
38248
+ const script = join99(getPythonDir(), "voice_daemon.py");
38218
38249
  const python = getVenvPython();
38219
38250
  if (options2.foreground) {
38220
38251
  spawnForeground(python, script, env);
@@ -38224,7 +38255,7 @@ function start2(options2) {
38224
38255
  }
38225
38256
 
38226
38257
  // src/commands/voice/status.ts
38227
- import { existsSync as existsSync82, readFileSync as readFileSync63 } from "fs";
38258
+ import { existsSync as existsSync82, readFileSync as readFileSync64 } from "fs";
38228
38259
  function isProcessAlive3(pid) {
38229
38260
  try {
38230
38261
  process.kill(pid, 0);
@@ -38235,7 +38266,7 @@ function isProcessAlive3(pid) {
38235
38266
  }
38236
38267
  function readRecentLogs(count8) {
38237
38268
  if (!existsSync82(voicePaths.log)) return [];
38238
- const lines2 = readFileSync63(voicePaths.log, "utf8").trim().split("\n");
38269
+ const lines2 = readFileSync64(voicePaths.log, "utf8").trim().split("\n");
38239
38270
  return lines2.slice(-count8);
38240
38271
  }
38241
38272
  function status2() {
@@ -38243,7 +38274,7 @@ function status2() {
38243
38274
  console.log("Voice daemon: not running (no PID file)");
38244
38275
  return;
38245
38276
  }
38246
- const pid = Number.parseInt(readFileSync63(voicePaths.pid, "utf8").trim(), 10);
38277
+ const pid = Number.parseInt(readFileSync64(voicePaths.pid, "utf8").trim(), 10);
38247
38278
  const alive = isProcessAlive3(pid);
38248
38279
  console.log(`Voice daemon: ${alive ? "running" : "dead"} (PID ${pid})`);
38249
38280
  const recent = readRecentLogs(5);
@@ -38262,13 +38293,13 @@ function status2() {
38262
38293
  }
38263
38294
 
38264
38295
  // src/commands/voice/stop.ts
38265
- import { existsSync as existsSync83, readFileSync as readFileSync64, unlinkSync as unlinkSync21 } from "fs";
38296
+ import { existsSync as existsSync83, readFileSync as readFileSync65, unlinkSync as unlinkSync21 } from "fs";
38266
38297
  function stop2() {
38267
38298
  if (!existsSync83(voicePaths.pid)) {
38268
38299
  console.log("Voice daemon is not running (no PID file)");
38269
38300
  return;
38270
38301
  }
38271
- const pid = Number.parseInt(readFileSync64(voicePaths.pid, "utf8").trim(), 10);
38302
+ const pid = Number.parseInt(readFileSync65(voicePaths.pid, "utf8").trim(), 10);
38272
38303
  try {
38273
38304
  process.kill(pid, "SIGTERM");
38274
38305
  console.log(`Sent SIGTERM to voice daemon (PID ${pid})`);
@@ -38345,11 +38376,11 @@ function changedPaths(from, cwd) {
38345
38376
  }
38346
38377
 
38347
38378
  // src/commands/watch/readBuiltVersion.ts
38348
- import { join as join99 } from "path";
38379
+ import { join as join100 } from "path";
38349
38380
  function readBuiltVersion(cwd) {
38350
38381
  try {
38351
38382
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
38352
- return readPackageJson(join99(root2, "package.json")).version ?? "unknown";
38383
+ return readPackageJson(join100(root2, "package.json")).version ?? "unknown";
38353
38384
  } catch {
38354
38385
  return "unknown";
38355
38386
  }
@@ -38406,11 +38437,11 @@ var webUiPrefix = "src/commands/sessions/web/ui/";
38406
38437
  var sessionsPrefix = "src/commands/sessions/";
38407
38438
  var rules = [
38408
38439
  {
38409
- matches: (path103) => path103.startsWith(webUiPrefix),
38440
+ matches: (path104) => path104.startsWith(webUiPrefix),
38410
38441
  advice: "restart the web server, then hard-reload the browser tab"
38411
38442
  },
38412
38443
  {
38413
- matches: (path103) => path103.startsWith(sessionsPrefix) && !path103.startsWith(webUiPrefix),
38444
+ matches: (path104) => path104.startsWith(sessionsPrefix) && !path104.startsWith(webUiPrefix),
38414
38445
  advice: "restart the daemon"
38415
38446
  }
38416
38447
  ];
@@ -38421,27 +38452,27 @@ function restartAdvice(paths) {
38421
38452
  // src/commands/watch/syncAdvice.ts
38422
38453
  var rules2 = [
38423
38454
  {
38424
- matches: (path103) => path103.startsWith("claude/commands/"),
38455
+ matches: (path104) => path104.startsWith("claude/commands/"),
38425
38456
  reason: "claude/commands changed"
38426
38457
  },
38427
38458
  {
38428
- matches: (path103) => path103.startsWith("claude/skills/"),
38459
+ matches: (path104) => path104.startsWith("claude/skills/"),
38429
38460
  reason: "claude/skills changed"
38430
38461
  },
38431
38462
  {
38432
- matches: (path103) => path103 === "claude/settings.json",
38463
+ matches: (path104) => path104 === "claude/settings.json",
38433
38464
  reason: "claude/settings.json changed"
38434
38465
  },
38435
38466
  {
38436
- matches: (path103) => path103 === "claude/design-system-prompt.md",
38467
+ matches: (path104) => path104 === "claude/design-system-prompt.md",
38437
38468
  reason: "claude/design-system-prompt.md changed"
38438
38469
  },
38439
38470
  {
38440
- matches: (path103) => path103.startsWith("codex/"),
38471
+ matches: (path104) => path104.startsWith("codex/"),
38441
38472
  reason: "codex sources changed"
38442
38473
  },
38443
38474
  {
38444
- matches: (path103) => path103.startsWith("pi/"),
38475
+ matches: (path104) => path104.startsWith("pi/"),
38445
38476
  reason: "pi sources changed"
38446
38477
  }
38447
38478
  ];
@@ -39082,8 +39113,8 @@ async function auth() {
39082
39113
 
39083
39114
  // src/commands/roam/postRoamActivity.ts
39084
39115
  import { execFileSync as execFileSync23 } from "child_process";
39085
- import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync13 } from "fs";
39086
- import { join as join100 } from "path";
39116
+ import { readdirSync as readdirSync22, readFileSync as readFileSync66, statSync as statSync13 } from "fs";
39117
+ import { join as join101 } from "path";
39087
39118
  function findPortFile(roamDir) {
39088
39119
  let entries;
39089
39120
  try {
@@ -39092,9 +39123,9 @@ function findPortFile(roamDir) {
39092
39123
  return void 0;
39093
39124
  }
39094
39125
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
39095
- const path103 = join100(roamDir, name);
39126
+ const path104 = join101(roamDir, name);
39096
39127
  try {
39097
- return { path: path103, mtimeMs: statSync13(path103).mtimeMs };
39128
+ return { path: path104, mtimeMs: statSync13(path104).mtimeMs };
39098
39129
  } catch {
39099
39130
  return void 0;
39100
39131
  }
@@ -39109,11 +39140,11 @@ var PID_BY_APP = {
39109
39140
  function postRoamActivity(app, event) {
39110
39141
  const appData = process.env.APPDATA;
39111
39142
  if (!appData) return;
39112
- const portFile = findPortFile(join100(appData, "Roam"));
39143
+ const portFile = findPortFile(join101(appData, "Roam"));
39113
39144
  if (!portFile) return;
39114
39145
  let port;
39115
39146
  try {
39116
- port = readFileSync65(portFile, "utf8").trim();
39147
+ port = readFileSync66(portFile, "utf8").trim();
39117
39148
  } catch {
39118
39149
  return;
39119
39150
  }
@@ -39244,8 +39275,8 @@ async function run3(name, args) {
39244
39275
  }
39245
39276
 
39246
39277
  // src/commands/run/add.ts
39247
- import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync53 } from "fs";
39248
- import { join as join101 } from "path";
39278
+ import { mkdirSync as mkdirSync36, writeFileSync as writeFileSync54 } from "fs";
39279
+ import { join as join102 } from "path";
39249
39280
 
39250
39281
  // src/commands/run/extractOption.ts
39251
39282
  function extractOption(args, flag) {
@@ -39306,7 +39337,7 @@ function saveNewRunConfig(name, command, args, cwd) {
39306
39337
  saveConfig(config);
39307
39338
  }
39308
39339
  function createCommandFile(name) {
39309
- const dir = join101(".claude", "commands");
39340
+ const dir = join102(".claude", "commands");
39310
39341
  mkdirSync36(dir, { recursive: true });
39311
39342
  const content = `---
39312
39343
  description: Run ${name}
@@ -39314,8 +39345,8 @@ description: Run ${name}
39314
39345
 
39315
39346
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
39316
39347
  `;
39317
- const filePath = join101(dir, `${name}.md`);
39318
- writeFileSync53(filePath, content);
39348
+ const filePath = join102(dir, `${name}.md`);
39349
+ writeFileSync54(filePath, content);
39319
39350
  console.log(`Created command file: ${filePath}`);
39320
39351
  }
39321
39352
  function add4() {
@@ -39338,11 +39369,11 @@ function findLinkIndex() {
39338
39369
  function parseLinkArgs() {
39339
39370
  const idx = findLinkIndex();
39340
39371
  if (idx === -1) return null;
39341
- const path103 = process.argv[idx + 1];
39372
+ const path104 = process.argv[idx + 1];
39342
39373
  const rest = process.argv.slice(idx + 2);
39343
39374
  const { value: prefix2 } = extractOption(rest, "--prefix");
39344
39375
  if (!prefix2) return null;
39345
- return { path: path103, prefix: prefix2 };
39376
+ return { path: path104, prefix: prefix2 };
39346
39377
  }
39347
39378
  function hasDuplicateLink(runList, linkPath) {
39348
39379
  return runList.some(
@@ -39371,7 +39402,7 @@ function link2() {
39371
39402
 
39372
39403
  // src/commands/run/remove.ts
39373
39404
  import { existsSync as existsSync85, unlinkSync as unlinkSync22 } from "fs";
39374
- import { join as join102 } from "path";
39405
+ import { join as join103 } from "path";
39375
39406
  function findRemoveIndex() {
39376
39407
  const idx = process.argv.indexOf("remove");
39377
39408
  if (idx === -1 || idx + 1 >= process.argv.length) return -1;
@@ -39386,7 +39417,7 @@ function parseRemoveName() {
39386
39417
  return process.argv[idx + 1];
39387
39418
  }
39388
39419
  function deleteCommandFile(name) {
39389
- const filePath = join102(".claude", "commands", `${name}.md`);
39420
+ const filePath = join103(".claude", "commands", `${name}.md`);
39390
39421
  if (existsSync85(filePath)) {
39391
39422
  unlinkSync22(filePath);
39392
39423
  console.log(`Deleted command file: ${filePath}`);
@@ -39505,11 +39536,11 @@ function applyLine(result, pending, line) {
39505
39536
  }
39506
39537
 
39507
39538
  // src/commands/sessions/daemon/readDaemonPidFile.ts
39508
- import { readFileSync as readFileSync66 } from "fs";
39539
+ import { readFileSync as readFileSync67 } from "fs";
39509
39540
  function readDaemonPidFile() {
39510
39541
  try {
39511
39542
  const pid = Number.parseInt(
39512
- readFileSync66(daemonPaths.pid, "utf8").trim(),
39543
+ readFileSync67(daemonPaths.pid, "utf8").trim(),
39513
39544
  10
39514
39545
  );
39515
39546
  return Number.isInteger(pid) ? pid : void 0;
@@ -39987,14 +40018,14 @@ import * as pty from "node-pty";
39987
40018
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
39988
40019
  import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
39989
40020
  import { createRequire as createRequire3 } from "module";
39990
- import path99 from "path";
40021
+ import path100 from "path";
39991
40022
  var require4 = createRequire3(import.meta.url);
39992
40023
  var ensured = false;
39993
40024
  function ensureSpawnHelperExecutable() {
39994
40025
  if (ensured || process.platform !== "darwin") return;
39995
40026
  ensured = true;
39996
- const ptyRoot = path99.join(path99.dirname(require4.resolve("node-pty")), "..");
39997
- const helper = path99.join(
40027
+ const ptyRoot = path100.join(path100.dirname(require4.resolve("node-pty")), "..");
40028
+ const helper = path100.join(
39998
40029
  ptyRoot,
39999
40030
  "prebuilds",
40000
40031
  `${process.platform}-${process.arch}`,
@@ -40125,12 +40156,12 @@ function serverRunMeta(runName, cwd) {
40125
40156
 
40126
40157
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
40127
40158
  import * as fs50 from "fs";
40128
- import * as path100 from "path";
40159
+ import * as path101 from "path";
40129
40160
  import { fileURLToPath as fileURLToPath11 } from "url";
40130
40161
  var __filename5 = fileURLToPath11(import.meta.url);
40131
- var __dirname7 = path100.dirname(__filename5);
40162
+ var __dirname7 = path101.dirname(__filename5);
40132
40163
  function readDesignSystemPrompt() {
40133
- const promptPath = path100.join(
40164
+ const promptPath = path101.join(
40134
40165
  __dirname7,
40135
40166
  "..",
40136
40167
  "claude",
@@ -40230,16 +40261,16 @@ function setStatus2(session, newStatus) {
40230
40261
 
40231
40262
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
40232
40263
  import { existsSync as existsSync90 } from "fs";
40233
- import { basename as basename26 } from "path";
40264
+ import { basename as basename27 } from "path";
40234
40265
 
40235
40266
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
40236
40267
  import { existsSync as existsSync89 } from "fs";
40237
- import { join as join105 } from "path";
40268
+ import { join as join106 } from "path";
40238
40269
 
40239
40270
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
40240
40271
  import { statSync as statSync15 } from "fs";
40241
40272
  import { rm as rm4 } from "fs/promises";
40242
- import { join as join104 } from "path";
40273
+ import { join as join105 } from "path";
40243
40274
  async function deleteTreeDirectly(clone, worktreePath, why) {
40244
40275
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
40245
40276
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -40267,7 +40298,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
40267
40298
  return { removed: true };
40268
40299
  }
40269
40300
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
40270
- return statSync15(join104(worktreePath, ".git"), {
40301
+ return statSync15(join105(worktreePath, ".git"), {
40271
40302
  throwIfNoEntry: false
40272
40303
  })?.isDirectory() === true;
40273
40304
  }
@@ -40303,7 +40334,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
40303
40334
  );
40304
40335
  }
40305
40336
  function strandedReason(worktreePath, cause) {
40306
- if (!existsSync89(join105(worktreePath, ".git")))
40337
+ if (!existsSync89(join106(worktreePath, ".git")))
40307
40338
  return "its .git link is already gone";
40308
40339
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
40309
40340
  return "git no longer recognises it as a working tree";
@@ -40373,7 +40404,7 @@ async function reapWorktree(worktreePath, force = false) {
40373
40404
  const clone = owningClone(worktreePath);
40374
40405
  const removal = await removeTree(clone, worktreePath, force);
40375
40406
  if (!removal.removed) return removal;
40376
- await deleteWorktreeBranch(clone, basename26(worktreePath));
40407
+ await deleteWorktreeBranch(clone, basename27(worktreePath));
40377
40408
  forgetWorktree(worktreePath);
40378
40409
  daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
40379
40410
  return removal;
@@ -41164,8 +41195,8 @@ async function seedRunningMsFromUsage(session, notify2) {
41164
41195
  var DEBOUNCE_MS2 = 50;
41165
41196
  function watchActivity(session, notify2, onClaudeSessionId) {
41166
41197
  if (session.commandType !== "assist" || !session.cwd) return;
41167
- const path103 = activityPath(session.id);
41168
- const dir = dirname42(path103);
41198
+ const path104 = activityPath(session.id);
41199
+ const dir = dirname42(path104);
41169
41200
  try {
41170
41201
  mkdirSync37(dir, { recursive: true });
41171
41202
  } catch {
@@ -41175,7 +41206,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41175
41206
  let timer = null;
41176
41207
  const read3 = () => {
41177
41208
  timer = null;
41178
- const activity2 = readActivity(path103);
41209
+ const activity2 = readActivity(path104);
41179
41210
  if (!activity2) return;
41180
41211
  applyActivityToSession(session, activity2);
41181
41212
  if (activity2.claudeSessionId) onClaudeSessionId?.(session);
@@ -41184,11 +41215,11 @@ function watchActivity(session, notify2, onClaudeSessionId) {
41184
41215
  notify2();
41185
41216
  };
41186
41217
  session.activityWatcher = watch2(dir, (_event, filename) => {
41187
- if (filename && !path103.endsWith(filename)) return;
41218
+ if (filename && !path104.endsWith(filename)) return;
41188
41219
  if (timer) clearTimeout(timer);
41189
41220
  timer = setTimeout(read3, DEBOUNCE_MS2);
41190
41221
  });
41191
- if (existsSync93(path103)) read3();
41222
+ if (existsSync93(path104)) read3();
41192
41223
  }
41193
41224
  function refreshActivity(session) {
41194
41225
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -41331,12 +41362,12 @@ import { watch as watch3 } from "fs";
41331
41362
 
41332
41363
  // src/commands/sessions/shared/findTranscriptPathSync.ts
41333
41364
  import * as fs52 from "fs";
41334
- import * as path101 from "path";
41365
+ import * as path102 from "path";
41335
41366
  function projectDirForCwd(cwd) {
41336
- return path101.join(claudeProjectsRoot(), projectSlug(cwd));
41367
+ return path102.join(claudeProjectsRoot(), projectSlug(cwd));
41337
41368
  }
41338
41369
  function transcriptPathFor(cwd, claudeSessionId) {
41339
- return path101.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41370
+ return path102.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
41340
41371
  }
41341
41372
  function findTranscriptPathSync(cwd, claudeSessionId) {
41342
41373
  const direct = transcriptPathFor(cwd, claudeSessionId);
@@ -41350,8 +41381,8 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
41350
41381
  }
41351
41382
  for (const file of files) {
41352
41383
  if (!file.endsWith(".jsonl")) continue;
41353
- if (headContainsSessionId(path101.join(dir, file), claudeSessionId))
41354
- return path101.join(dir, file);
41384
+ if (headContainsSessionId(path102.join(dir, file), claudeSessionId))
41385
+ return path102.join(dir, file);
41355
41386
  }
41356
41387
  return null;
41357
41388
  }
@@ -42551,9 +42582,9 @@ function tempRoots() {
42551
42582
  }
42552
42583
  return [...roots];
42553
42584
  }
42554
- function underTempRoot(path103) {
42585
+ function underTempRoot(path104) {
42555
42586
  return tempRoots().some(
42556
- (root2) => path103.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42587
+ (root2) => path104.startsWith(root2.endsWith(sep3) ? root2 : root2 + sep3)
42557
42588
  );
42558
42589
  }
42559
42590
 
@@ -42982,7 +43013,7 @@ function rearmStoppedSessions(sessions, notify2) {
42982
43013
 
42983
43014
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
42984
43015
  import { existsSync as existsSync96 } from "fs";
42985
- import { basename as basename28 } from "path";
43016
+ import { basename as basename29 } from "path";
42986
43017
 
42987
43018
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
42988
43019
  function accountedTrees(sessions) {
@@ -43039,15 +43070,15 @@ function bindResumedWorktree(session, cwd, notify2) {
43039
43070
  import { existsSync as existsSync95 } from "fs";
43040
43071
  async function reclaimVanishedWorktrees(clone, paths) {
43041
43072
  if (!existsSync95(clone)) {
43042
- for (const { path: path103 } of paths) forgetWorktree(path103);
43073
+ for (const { path: path104 } of paths) forgetWorktree(path104);
43043
43074
  daemonLog(
43044
43075
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
43045
43076
  );
43046
43077
  return;
43047
43078
  }
43048
43079
  await pruneBookkeeping2(clone);
43049
- for (const { path: path103, branch: branch2 } of paths)
43050
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path103);
43080
+ for (const { path: path104, branch: branch2 } of paths)
43081
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path104);
43051
43082
  }
43052
43083
  async function pruneBookkeeping2(clone) {
43053
43084
  try {
@@ -43074,37 +43105,37 @@ async function reclaimBranch(clone, branch2) {
43074
43105
  }
43075
43106
 
43076
43107
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
43077
- function logVanishedTree(sessions, path103) {
43108
+ function logVanishedTree(sessions, path104) {
43078
43109
  const claimants = [...sessions.values()].filter(
43079
- (s) => s.cwd === path103 || s.worktree?.path === path103
43110
+ (s) => s.cwd === path104 || s.worktree?.path === path104
43080
43111
  );
43081
43112
  if (claimants.length === 0) {
43082
- daemonLog(`worktree ${path103} gone from disk and unclaimed; reclaiming it`);
43113
+ daemonLog(`worktree ${path104} gone from disk and unclaimed; reclaiming it`);
43083
43114
  return;
43084
43115
  }
43085
43116
  for (const s of claimants)
43086
43117
  daemonLog(
43087
- `session ${s.id} ("${s.name}") claims worktree ${path103}, which is gone from disk; reclaiming it`
43118
+ `session ${s.id} ("${s.name}") claims worktree ${path104}, which is gone from disk; reclaiming it`
43088
43119
  );
43089
43120
  }
43090
43121
 
43091
43122
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
43092
43123
  var MAX_ITEMS = 20;
43093
- async function describeHeldWork(path103, reason4) {
43094
- if (reason4.startsWith("uncommitted")) return await changedFiles(path103);
43095
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path103, reason4);
43124
+ async function describeHeldWork(path104, reason4) {
43125
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path104);
43126
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path104, reason4);
43096
43127
  return { summary: reason4, items: [] };
43097
43128
  }
43098
- async function changedFiles(path103) {
43099
- const status3 = await gitResult(path103, ["status", "--porcelain"]);
43129
+ async function changedFiles(path104) {
43130
+ const status3 = await gitResult(path104, ["status", "--porcelain"]);
43100
43131
  const lines2 = status3.ok ? nonEmptyLines(status3.out) : [];
43101
43132
  return {
43102
43133
  summary: `${lines2.length} uncommitted ${lines2.length === 1 ? "file" : "files"}`,
43103
43134
  items: capped2(lines2)
43104
43135
  };
43105
43136
  }
43106
- async function unpushedCommits(path103, reason4) {
43107
- const log2 = await gitResult(path103, ["log", "--oneline", "@{upstream}..HEAD"]);
43137
+ async function unpushedCommits(path104, reason4) {
43138
+ const log2 = await gitResult(path104, ["log", "--oneline", "@{upstream}..HEAD"]);
43108
43139
  if (!log2.ok) return { summary: reason4, items: [] };
43109
43140
  const lines2 = nonEmptyLines(log2.out);
43110
43141
  return {
@@ -43124,7 +43155,7 @@ function capped2(lines2) {
43124
43155
  }
43125
43156
 
43126
43157
  // src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
43127
- import { basename as basename27 } from "path";
43158
+ import { basename as basename28 } from "path";
43128
43159
  function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
43129
43160
  const { orphan, reason: reason4, held } = recovered;
43130
43161
  let id;
@@ -43147,7 +43178,7 @@ function orphanedSession(id, recovered) {
43147
43178
  const { orphan, reason: reason4, held } = recovered;
43148
43179
  return {
43149
43180
  ...sessionBase(id, "stopped"),
43150
- name: `recovered ${basename27(orphan.path)}`,
43181
+ name: `recovered ${basename28(orphan.path)}`,
43151
43182
  subtitle: `${held.summary} in ${orphan.path}`,
43152
43183
  commandType: "claude",
43153
43184
  pty: null,
@@ -43196,24 +43227,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
43196
43227
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
43197
43228
  const accounted = accountedTrees(sessions);
43198
43229
  const vanished = /* @__PURE__ */ new Map();
43199
- for (const { path: path103, clone } of readWorktreeRegistry()) {
43200
- if (underTempRoot(path103)) {
43201
- forgetWorktree(path103);
43230
+ for (const { path: path104, clone } of readWorktreeRegistry()) {
43231
+ if (underTempRoot(path104)) {
43232
+ forgetWorktree(path104);
43202
43233
  daemonLog(
43203
- `worktree ${path103} lies outside any project root; pruned from the registry rather than recovered`
43234
+ `worktree ${path104} lies outside any project root; pruned from the registry rather than recovered`
43204
43235
  );
43205
43236
  continue;
43206
43237
  }
43207
- if (!existsSync96(path103)) {
43208
- logVanishedTree(sessions, path103);
43238
+ if (!existsSync96(path104)) {
43239
+ logVanishedTree(sessions, path104);
43209
43240
  vanished.set(clone, [
43210
43241
  ...vanished.get(clone) ?? [],
43211
- { path: path103, branch: basename28(path103) }
43242
+ { path: path104, branch: basename29(path104) }
43212
43243
  ]);
43213
43244
  continue;
43214
43245
  }
43215
- if (accounted.has(path103)) continue;
43216
- await recoverOrphan(sessions, spawnWith, { path: path103, clone }, notify2);
43246
+ if (accounted.has(path104)) continue;
43247
+ await recoverOrphan(sessions, spawnWith, { path: path104, clone }, notify2);
43217
43248
  }
43218
43249
  for (const [clone, paths] of vanished)
43219
43250
  await reclaimVanishedWorktrees(clone, paths);
@@ -44792,7 +44823,7 @@ import { existsSync as existsSync98 } from "fs";
44792
44823
 
44793
44824
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
44794
44825
  import { copyFileSync as copyFileSync5, existsSync as existsSync97, mkdirSync as mkdirSync39 } from "fs";
44795
- import { join as join107 } from "path";
44826
+ import { join as join108 } from "path";
44796
44827
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
44797
44828
  const dir = projectDirForCwd(toCwd);
44798
44829
  if (dir === projectDirForCwd(fromCwd)) {
@@ -44801,7 +44832,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
44801
44832
  );
44802
44833
  return;
44803
44834
  }
44804
- const dest = join107(dir, `${claudeSessionId}.jsonl`);
44835
+ const dest = join108(dir, `${claudeSessionId}.jsonl`);
44805
44836
  if (existsSync97(dest)) {
44806
44837
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
44807
44838
  return;
@@ -45238,8 +45269,22 @@ function handleCreateRun(client, m, d) {
45238
45269
  }
45239
45270
 
45240
45271
  // src/commands/sessions/daemon/handleOutputRequest.ts
45272
+ function resolveTarget2(m, d) {
45273
+ const server = d.server;
45274
+ if (!server) return { sessionId: d.sessionId };
45275
+ const run4 = m.liveServerRun(server.origin, server.group);
45276
+ return run4 ? { sessionId: run4.id } : {
45277
+ error: `No live server run for ${server.origin} (${server.group})`
45278
+ };
45279
+ }
45241
45280
  var handleOutputRequest = (client, m, d) => {
45242
- const sessionId = d.sessionId;
45281
+ const target = resolveTarget2(m, d);
45282
+ if ("error" in target) {
45283
+ daemonLog(`output requested: ${target.error}`);
45284
+ sendTo(client, { type: "session-output", error: target.error });
45285
+ return;
45286
+ }
45287
+ const { sessionId } = target;
45243
45288
  let scrollback;
45244
45289
  m.update((sessions) => {
45245
45290
  scrollback = sessions.get(sessionId)?.scrollback;
@@ -45277,12 +45322,12 @@ function handleSetStatus(client, m, d) {
45277
45322
  import * as fs56 from "fs";
45278
45323
 
45279
45324
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
45280
- import * as path102 from "path";
45325
+ import * as path103 from "path";
45281
45326
  async function findCodexRolloutPath(sessionId) {
45282
45327
  if (!sessionId) return null;
45283
45328
  const paths = await discoverCodexRolloutPaths();
45284
45329
  const suffix = `-${sessionId}.jsonl`;
45285
- return paths.find((file) => path102.basename(file).endsWith(suffix)) ?? null;
45330
+ return paths.find((file) => path103.basename(file).endsWith(suffix)) ?? null;
45286
45331
  }
45287
45332
 
45288
45333
  // src/commands/sessions/shared/codex/codexToolTarget.ts
@@ -45648,10 +45693,10 @@ function handleConnection(socket, manager) {
45648
45693
  }
45649
45694
 
45650
45695
  // src/commands/sessions/daemon/onListening.ts
45651
- import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync54 } from "fs";
45696
+ import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync55 } from "fs";
45652
45697
 
45653
45698
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
45654
- import { readFileSync as readFileSync68 } from "fs";
45699
+ import { readFileSync as readFileSync69 } from "fs";
45655
45700
  var WATCHDOG_INTERVAL_MS = 5e3;
45656
45701
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
45657
45702
  const timer = setInterval(() => {
@@ -45662,7 +45707,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
45662
45707
  }
45663
45708
  function ownsPidFile() {
45664
45709
  try {
45665
- return readFileSync68(daemonPaths.pid, "utf8").trim() === String(process.pid);
45710
+ return readFileSync69(daemonPaths.pid, "utf8").trim() === String(process.pid);
45666
45711
  } catch {
45667
45712
  return false;
45668
45713
  }
@@ -45670,7 +45715,7 @@ function ownsPidFile() {
45670
45715
 
45671
45716
  // src/commands/sessions/daemon/onListening.ts
45672
45717
  function onListening(manager, checkAutoExit) {
45673
- writeFileSync54(daemonPaths.pid, String(process.pid));
45718
+ writeFileSync55(daemonPaths.pid, String(process.pid));
45674
45719
  startPidFileWatchdog(() => {
45675
45720
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
45676
45721
  void manager.flushActiveMs().finally(() => {
@@ -45865,13 +45910,13 @@ function describePeerError(error) {
45865
45910
  const cause = error.cause;
45866
45911
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
45867
45912
  }
45868
- async function fetchPeerJson(baseUrl, path103, timeoutMs = PEER_TIMEOUT_MS) {
45869
- const res = await fetch(new URL(path103, baseUrl), {
45913
+ async function fetchPeerJson(baseUrl, path104, timeoutMs = PEER_TIMEOUT_MS) {
45914
+ const res = await fetch(new URL(path104, baseUrl), {
45870
45915
  signal: AbortSignal.timeout(timeoutMs)
45871
45916
  });
45872
45917
  if (!res.ok)
45873
45918
  throw Object.assign(
45874
- new Error(`GET ${path103} returned ${res.status} ${res.statusText}`),
45919
+ new Error(`GET ${path104} returned ${res.status} ${res.statusText}`),
45875
45920
  { status: res.status }
45876
45921
  );
45877
45922
  return await res.json();
@@ -46416,41 +46461,10 @@ function registerNodes(sessions) {
46416
46461
  configHelp(cmd, nodesConfigHelp);
46417
46462
  }
46418
46463
 
46419
- // src/commands/sessions/registerSetStatusCommand.ts
46420
- function registerSetStatusCommand(cmd) {
46421
- cmd.command("set-status <status>").description(
46422
- "Report the current session's status to the sessions daemon (used by Claude Code hooks)"
46423
- ).option(
46424
- "--source <source>",
46425
- "Originating hook (permission, stop, notification, prompt, pretool, posttool)"
46426
- ).option(
46427
- "--ack",
46428
- "Wait for the daemon to acknowledge delivery, retrying on failure"
46429
- ).action(
46430
- (status3, options2) => setSessionStatus(status3, { source: options2.source, ack: options2.ack })
46431
- );
46432
- }
46433
-
46434
- // src/commands/sessions/renameSession.ts
46435
- async function renameSession(title) {
46436
- if (!inWebSession()) {
46437
- console.log("No daemon-managed session to rename.");
46438
- return;
46439
- }
46440
- const sessionId = process.env.ASSIST_SESSION_ID;
46441
- try {
46442
- await sendToDaemon({ type: "rename", sessionId, title });
46443
- } catch (error) {
46444
- appendDaemonLog(
46445
- `rename send failed: id=${sessionId}: ${error instanceof Error ? error.message : String(error)}`
46446
- );
46447
- }
46448
- }
46449
-
46450
46464
  // src/commands/sessions/daemon/requestSessionOutput.ts
46451
46465
  import { createInterface as createInterface12 } from "readline";
46452
46466
  var OUTPUT_TIMEOUT_MS = 5e3;
46453
- async function requestSessionOutput(sessionId) {
46467
+ async function requestSessionOutput(target) {
46454
46468
  const socket = await connectToDaemon().catch(() => {
46455
46469
  throw new Error("No sessions daemon is running");
46456
46470
  });
@@ -46462,9 +46476,9 @@ async function requestSessionOutput(sessionId) {
46462
46476
  lines2,
46463
46477
  OUTPUT_TIMEOUT_MS,
46464
46478
  { error: "Timed out waiting for the sessions daemon" },
46465
- (data) => data.type === "session-output" && data.sessionId === sessionId ? data : void 0
46479
+ (data) => data.type === "session-output" ? data : void 0
46466
46480
  );
46467
- socket.write(`${JSON.stringify({ type: "output", sessionId })}
46481
+ socket.write(`${JSON.stringify({ type: "output", ...target })}
46468
46482
  `);
46469
46483
  const { scrollback, error } = await reply2;
46470
46484
  if (scrollback === void 0) throw new Error(error);
@@ -46482,16 +46496,29 @@ function lastLines(scrollback, count8) {
46482
46496
  }
46483
46497
 
46484
46498
  // src/commands/sessions/sessionOutput.ts
46499
+ function resolveTarget3(sessionId, server) {
46500
+ if (sessionId && server)
46501
+ return "Pass either a session id or --server, not both";
46502
+ if (server)
46503
+ return {
46504
+ server: {
46505
+ origin: getCurrentOrigin(process.cwd()),
46506
+ group: server === true ? "default" : server
46507
+ }
46508
+ };
46509
+ if (!sessionId) return "Pass a session id or --server [group]";
46510
+ if (sessionId.includes(":"))
46511
+ return `Session ${sessionId} is on a linked node; reading linked-node sessions is not supported yet`;
46512
+ return { sessionId };
46513
+ }
46485
46514
  async function sessionOutput(sessionId, options2) {
46486
46515
  const count8 = Number.parseInt(options2.lines, 10);
46487
46516
  if (!Number.isInteger(count8) || count8 < 1)
46488
46517
  return fail7(`-n must be a positive integer, got ${options2.lines}`);
46489
- if (sessionId.includes(":"))
46490
- return fail7(
46491
- `Session ${sessionId} is on a linked node; reading linked-node sessions is not supported yet`
46492
- );
46518
+ const target = resolveTarget3(sessionId, options2.server);
46519
+ if (typeof target === "string") return fail7(target);
46493
46520
  try {
46494
- const scrollback = await requestSessionOutput(sessionId);
46521
+ const scrollback = await requestSessionOutput(target);
46495
46522
  for (const line of lastLines(scrollback, count8)) console.log(line);
46496
46523
  } catch (error) {
46497
46524
  fail7(error instanceof Error ? error.message : String(error));
@@ -46502,6 +46529,47 @@ function fail7(message3) {
46502
46529
  process.exitCode = 1;
46503
46530
  }
46504
46531
 
46532
+ // src/commands/sessions/registerOutputCommand.ts
46533
+ function registerOutputCommand(cmd) {
46534
+ cmd.command("output [session-id]").description(
46535
+ "Print a snapshot of a session's output with ANSI codes stripped"
46536
+ ).option("-n, --lines <count>", "Number of lines", "200").option(
46537
+ "--server [group]",
46538
+ "Read the live server run for this repo's remote and group (default: default)"
46539
+ ).action(sessionOutput);
46540
+ }
46541
+
46542
+ // src/commands/sessions/registerSetStatusCommand.ts
46543
+ function registerSetStatusCommand(cmd) {
46544
+ cmd.command("set-status <status>").description(
46545
+ "Report the current session's status to the sessions daemon (used by Claude Code hooks)"
46546
+ ).option(
46547
+ "--source <source>",
46548
+ "Originating hook (permission, stop, notification, prompt, pretool, posttool)"
46549
+ ).option(
46550
+ "--ack",
46551
+ "Wait for the daemon to acknowledge delivery, retrying on failure"
46552
+ ).action(
46553
+ (status3, options2) => setSessionStatus(status3, { source: options2.source, ack: options2.ack })
46554
+ );
46555
+ }
46556
+
46557
+ // src/commands/sessions/renameSession.ts
46558
+ async function renameSession(title) {
46559
+ if (!inWebSession()) {
46560
+ console.log("No daemon-managed session to rename.");
46561
+ return;
46562
+ }
46563
+ const sessionId = process.env.ASSIST_SESSION_ID;
46564
+ try {
46565
+ await sendToDaemon({ type: "rename", sessionId, title });
46566
+ } catch (error) {
46567
+ appendDaemonLog(
46568
+ `rename send failed: id=${sessionId}: ${error instanceof Error ? error.message : String(error)}`
46569
+ );
46570
+ }
46571
+ }
46572
+
46505
46573
  // src/commands/sessions/summarise.ts
46506
46574
  import * as fs58 from "fs";
46507
46575
  import chalk255 from "chalk";
@@ -46629,9 +46697,7 @@ function registerSessions(program2) {
46629
46697
  cmd.command("rename <title>").description(
46630
46698
  "Retitle the current daemon-managed session, overriding the generated title for the rest of its life"
46631
46699
  ).action(renameSession);
46632
- cmd.command("output <session-id>").description(
46633
- "Print a snapshot of a session's output with ANSI codes stripped"
46634
- ).option("-n, --lines <count>", "Number of lines", "200").action(sessionOutput);
46700
+ registerOutputCommand(cmd);
46635
46701
  registerSetStatusCommand(cmd);
46636
46702
  registerNodes(cmd);
46637
46703
  configHelp(cmd, sessionsConfigHelp);