@staff0rd/assist 0.1121.1 → 0.1122.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.1121.1",
9
+ version: "0.1122.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -186,10 +186,10 @@ function sweepStagedAttachments(dir = stagedAttachmentsDir, now = Date.now()) {
186
186
  }
187
187
  for (const name2 of entries) {
188
188
  if (!name2.startsWith("upload-")) continue;
189
- const path126 = join2(dir, name2);
189
+ const path128 = join2(dir, name2);
190
190
  try {
191
- if (now - statSync(path126).mtimeMs > PANE_PERSIST_TTL_MS)
192
- rmSync(path126, { recursive: true, force: true });
191
+ if (now - statSync(path128).mtimeMs > PANE_PERSIST_TTL_MS)
192
+ rmSync(path128, { recursive: true, force: true });
193
193
  } catch {
194
194
  }
195
195
  }
@@ -1041,9 +1041,9 @@ var assistConfigSchema = z6.strictObject({
1041
1041
  });
1042
1042
 
1043
1043
  // src/shared/dropUnknownConfigKeys.ts
1044
- function objectAt(root2, path126) {
1044
+ function objectAt(root2, path128) {
1045
1045
  let node = root2;
1046
- for (const segment of path126) {
1046
+ for (const segment of path128) {
1047
1047
  if (!node || typeof node !== "object") return void 0;
1048
1048
  node = node[segment];
1049
1049
  }
@@ -1095,9 +1095,9 @@ function findGitLink(dir) {
1095
1095
  }
1096
1096
  return null;
1097
1097
  }
1098
- function isFile(path126) {
1098
+ function isFile(path128) {
1099
1099
  try {
1100
- return statSync3(path126).isFile();
1100
+ return statSync3(path128).isFile();
1101
1101
  } catch {
1102
1102
  return false;
1103
1103
  }
@@ -1116,9 +1116,9 @@ function linkedGitDirParent(gitDir) {
1116
1116
  const match = /^(.*)[/\\]worktrees[/\\][^/\\]+[/\\]?$/.exec(gitDir);
1117
1117
  return match ? match[1] : null;
1118
1118
  }
1119
- function readTrimmed(path126) {
1119
+ function readTrimmed(path128) {
1120
1120
  try {
1121
- const content = readFileSync(path126, "utf8").trim();
1121
+ const content = readFileSync(path128, "utf8").trim();
1122
1122
  return content === "" ? null : content;
1123
1123
  } catch {
1124
1124
  return null;
@@ -1131,10 +1131,10 @@ function absolute(target, from) {
1131
1131
  // src/shared/loadRawYaml.ts
1132
1132
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
1133
1133
  import { parse as parseYaml } from "yaml";
1134
- function loadRawYaml(path126) {
1135
- if (!existsSync2(path126)) return {};
1134
+ function loadRawYaml(path128) {
1135
+ if (!existsSync2(path128)) return {};
1136
1136
  try {
1137
- const content = readFileSync2(path126, "utf8");
1137
+ const content = readFileSync2(path128, "utf8");
1138
1138
  return parseYaml(content) || {};
1139
1139
  } catch {
1140
1140
  return {};
@@ -1236,10 +1236,10 @@ function getStorePath(filename) {
1236
1236
  return join5(getStoreDir(), filename);
1237
1237
  }
1238
1238
  function loadJson(filename) {
1239
- const path126 = getStorePath(filename);
1240
- if (existsSync3(path126)) {
1239
+ const path128 = getStorePath(filename);
1240
+ if (existsSync3(path128)) {
1241
1241
  try {
1242
- return JSON.parse(readFileSync3(path126, "utf8"));
1242
+ return JSON.parse(readFileSync3(path128, "utf8"));
1243
1243
  } catch {
1244
1244
  return {};
1245
1245
  }
@@ -1251,11 +1251,11 @@ function saveJson(filename, data) {
1251
1251
  if (!existsSync3(dir)) {
1252
1252
  mkdirSync2(dir, { recursive: true });
1253
1253
  }
1254
- const path126 = getStorePath(filename);
1255
- const tmp = `${path126}.${process.pid}.tmp`;
1254
+ const path128 = getStorePath(filename);
1255
+ const tmp = `${path128}.${process.pid}.tmp`;
1256
1256
  try {
1257
1257
  writeFileSync(tmp, JSON.stringify(data, null, 2));
1258
- renameSync(tmp, path126);
1258
+ renameSync(tmp, path128);
1259
1259
  } catch (error) {
1260
1260
  rmSync2(tmp, { force: true });
1261
1261
  throw error;
@@ -1267,10 +1267,10 @@ function repoConfigCachePath() {
1267
1267
  return join6(getStoreDir(), "repo-config-cache.json");
1268
1268
  }
1269
1269
  function readConfigCacheFile() {
1270
- const path126 = repoConfigCachePath();
1271
- if (!existsSync4(path126)) return {};
1270
+ const path128 = repoConfigCachePath();
1271
+ if (!existsSync4(path128)) return {};
1272
1272
  try {
1273
- const parsed = JSON.parse(readFileSync4(path126, "utf8"));
1273
+ const parsed = JSON.parse(readFileSync4(path128, "utf8"));
1274
1274
  return parsed ?? {};
1275
1275
  } catch {
1276
1276
  return {};
@@ -1337,8 +1337,8 @@ function getRemoteOriginUrl(cwd) {
1337
1337
 
1338
1338
  // src/commands/backlog/getCurrentOrigin.ts
1339
1339
  var WINDOWS_PATH = /^[A-Za-z]:[\\/]/;
1340
- function stripLeadingSlashes(path126) {
1341
- return path126.replace(/^\/+/, "");
1340
+ function stripLeadingSlashes(path128) {
1341
+ return path128.replace(/^\/+/, "");
1342
1342
  }
1343
1343
  function normalizeOrigin(raw) {
1344
1344
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -1381,8 +1381,8 @@ function getCachedOrigin(cwd) {
1381
1381
  // src/commands/backlog/originDisplayName.ts
1382
1382
  function originDisplayName(origin) {
1383
1383
  if (origin.startsWith("local:")) {
1384
- const path126 = origin.slice("local:".length).replace(/\/+$/, "");
1385
- const segments = path126.split("/").filter(Boolean);
1384
+ const path128 = origin.slice("local:".length).replace(/\/+$/, "");
1385
+ const segments = path128.split("/").filter(Boolean);
1386
1386
  return segments[segments.length - 1] ?? origin;
1387
1387
  }
1388
1388
  const firstSlash = origin.indexOf("/");
@@ -2652,9 +2652,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
2652
2652
  function backupLocalBacklogFiles(dir) {
2653
2653
  const moved = [];
2654
2654
  for (const name2 of LOCAL_FILES) {
2655
- const path126 = join9(dir, ".assist", name2);
2656
- if (existsSync9(path126)) {
2657
- renameSync2(path126, `${path126}.bak`);
2655
+ const path128 = join9(dir, ".assist", name2);
2656
+ if (existsSync9(path128)) {
2657
+ renameSync2(path128, `${path128}.bak`);
2658
2658
  moved.push(`${name2} \u2192 ${name2}.bak`);
2659
2659
  }
2660
2660
  }
@@ -3105,8 +3105,8 @@ var backlogItemSchema = z7.strictObject({
3105
3105
  var backlogFileSchema = z7.array(backlogItemSchema);
3106
3106
 
3107
3107
  // src/commands/backlog/parseBacklogJsonl.ts
3108
- function parseBacklogJsonl(path126) {
3109
- const content = readFileSync5(path126, "utf8").trim();
3108
+ function parseBacklogJsonl(path128) {
3109
+ const content = readFileSync5(path128, "utf8").trim();
3110
3110
  if (content.length === 0) return [];
3111
3111
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
3112
3112
  }
@@ -3303,8 +3303,8 @@ async function cleanupFalseResetSegments(db) {
3303
3303
  }
3304
3304
 
3305
3305
  // src/shared/db/describeDatabaseUrlSource.ts
3306
- function hasDatabaseUrl(path126) {
3307
- const database = loadRawYaml(path126).database;
3306
+ function hasDatabaseUrl(path128) {
3307
+ const database = loadRawYaml(path128).database;
3308
3308
  return database?.url !== void 0;
3309
3309
  }
3310
3310
  function describeDatabaseUrlSource(cwd = process.cwd(), globalConfigPath = getGlobalConfigPath()) {
@@ -4894,10 +4894,10 @@ function completeLines(text18, windowIsPartial) {
4894
4894
  if (windowIsPartial) all.shift();
4895
4895
  return all;
4896
4896
  }
4897
- function readLogTail(path126, lines) {
4897
+ function readLogTail(path128, lines) {
4898
4898
  let fd;
4899
4899
  try {
4900
- fd = openSync2(path126, "r");
4900
+ fd = openSync2(path128, "r");
4901
4901
  } catch {
4902
4902
  return [];
4903
4903
  }
@@ -5237,10 +5237,10 @@ var hooksSettings = {
5237
5237
  }
5238
5238
  };
5239
5239
  function ensureHooksSettings() {
5240
- const path126 = daemonPaths.hooksSettings;
5241
- mkdirSync3(dirname5(path126), { recursive: true });
5242
- writeFileSync3(path126, JSON.stringify(hooksSettings, null, 2));
5243
- return path126;
5240
+ const path128 = daemonPaths.hooksSettings;
5241
+ mkdirSync3(dirname5(path128), { recursive: true });
5242
+ writeFileSync3(path128, JSON.stringify(hooksSettings, null, 2));
5243
+ return path128;
5244
5244
  }
5245
5245
 
5246
5246
  // src/commands/sessions/daemon/spawnPty.ts
@@ -6137,12 +6137,12 @@ function claudeToolOperations({
6137
6137
  return paths.length ? [{ kind: "fileRead", tool: toolName, paths }] : [];
6138
6138
  }
6139
6139
  if (WRITE_TOOLS.has(toolName)) {
6140
- const [path126] = strings([toolInput.file_path, toolInput.notebook_path]);
6141
- return path126 ? [
6140
+ const [path128] = strings([toolInput.file_path, toolInput.notebook_path]);
6141
+ return path128 ? [
6142
6142
  {
6143
6143
  kind: "fileWrite",
6144
6144
  tool: toolName,
6145
- path: path126,
6145
+ path: path128,
6146
6146
  contents: incomingContents(toolInput)
6147
6147
  }
6148
6148
  ] : [];
@@ -7772,13 +7772,13 @@ function record2(value) {
7772
7772
  return value && typeof value === "object" ? value : {};
7773
7773
  }
7774
7774
  function fileWrites(changes) {
7775
- return Object.entries(changes).flatMap(([path126, change]) => {
7775
+ return Object.entries(changes).flatMap(([path128, change]) => {
7776
7776
  const { content, move_path: movePath } = record2(change);
7777
7777
  const contents = typeof content === "string" ? [content] : [];
7778
7778
  const write2 = {
7779
7779
  kind: "fileWrite",
7780
7780
  tool: "apply_patch",
7781
- path: path126,
7781
+ path: path128,
7782
7782
  contents
7783
7783
  };
7784
7784
  return typeof movePath === "string" ? [write2, { ...write2, path: movePath }] : [write2];
@@ -7885,8 +7885,8 @@ function parseApplyPatch(patch2) {
7885
7885
  }
7886
7886
  if (added && line.startsWith("+")) added.push(line.slice(1));
7887
7887
  }
7888
- return files.map(({ path: path126, added: lines }) => ({
7889
- path: path126,
7888
+ return files.map(({ path: path128, added: lines }) => ({
7889
+ path: path128,
7890
7890
  contents: lines.length ? [lines.join("\n")] : []
7891
7891
  }));
7892
7892
  }
@@ -7907,10 +7907,10 @@ function patchText(input) {
7907
7907
  );
7908
7908
  }
7909
7909
  function patchWrites(tool, patch2) {
7910
- return parseApplyPatch(patch2).map(({ path: path126, contents }) => ({
7910
+ return parseApplyPatch(patch2).map(({ path: path128, contents }) => ({
7911
7911
  kind: "fileWrite",
7912
7912
  tool,
7913
- path: path126,
7913
+ path: path128,
7914
7914
  contents
7915
7915
  }));
7916
7916
  }
@@ -7929,10 +7929,10 @@ function codexToolOperations({
7929
7929
  if (!PATCH_TOOLS.has(toolName)) return [];
7930
7930
  const patch2 = patchText(toolInput);
7931
7931
  if (patch2) return patchWrites(toolName, patch2);
7932
- const { file_path: path126, content } = toolInput;
7933
- if (typeof path126 !== "string") return [];
7932
+ const { file_path: path128, content } = toolInput;
7933
+ if (typeof path128 !== "string") return [];
7934
7934
  const contents = typeof content === "string" ? [content] : [];
7935
- return [{ kind: "fileWrite", tool: toolName, path: path126, contents }];
7935
+ return [{ kind: "fileWrite", tool: toolName, path: path128, contents }];
7936
7936
  }
7937
7937
 
7938
7938
  // src/shared/harnessAdapters/codexToolEvents.ts
@@ -8069,8 +8069,8 @@ var codexConversationReader = {
8069
8069
  headBytes: 2 * 1024 * 1024,
8070
8070
  locate: ({ harnessSessionId }) => harnessSessionId ? findCodexRolloutPathSync(harnessSessionId) : null,
8071
8071
  watchTarget: (ref) => {
8072
- const path126 = codexConversationReader.locate(ref);
8073
- return path126 ? { dir: dirname8(path126), file: basename6(path126) } : null;
8072
+ const path128 = codexConversationReader.locate(ref);
8073
+ return path128 ? { dir: dirname8(path128), file: basename6(path128) } : null;
8074
8074
  },
8075
8075
  events: (entries) => entries.flatMap(entryEvents),
8076
8076
  lifecycle: (entries) => ({
@@ -8745,15 +8745,15 @@ function piToolOperations({
8745
8745
  const command = stringField(toolInput, "command")?.trim();
8746
8746
  return command ? [{ kind: "command", tool: commandTool, command }] : [];
8747
8747
  }
8748
- const path126 = stringField(toolInput, "path", "file_path", "pattern");
8748
+ const path128 = stringField(toolInput, "path", "file_path", "pattern");
8749
8749
  if (READ_TOOLS2.has(name2))
8750
- return path126 ? [{ kind: "fileRead", tool: toolName, paths: [path126] }] : [];
8751
- if (WRITE_TOOLS2.has(name2) && path126)
8750
+ return path128 ? [{ kind: "fileRead", tool: toolName, paths: [path128] }] : [];
8751
+ if (WRITE_TOOLS2.has(name2) && path128)
8752
8752
  return [
8753
8753
  {
8754
8754
  kind: "fileWrite",
8755
8755
  tool: toolName,
8756
- path: path126,
8756
+ path: path128,
8757
8757
  contents: incomingContents2(toolInput)
8758
8758
  }
8759
8759
  ];
@@ -8921,8 +8921,8 @@ async function loadCommittedPaths(cwd, session) {
8921
8921
  for (const commit2 of commits2) {
8922
8922
  const resolved = await resolveCommit(cwd, commit2.sha);
8923
8923
  if (!resolved) continue;
8924
- for (const path126 of resolved.paths) {
8925
- if (!bases.has(path126)) bases.set(path126, resolved.base);
8924
+ for (const path128 of resolved.paths) {
8925
+ if (!bases.has(path128)) bases.set(path128, resolved.base);
8926
8926
  }
8927
8927
  }
8928
8928
  return { commits: commits2, bases };
@@ -8968,16 +8968,16 @@ async function itemChangeSet(cwd, session) {
8968
8968
  }
8969
8969
  function groupByBase(bases) {
8970
8970
  const groups = /* @__PURE__ */ new Map();
8971
- for (const [path126, base] of bases) {
8971
+ for (const [path128, base] of bases) {
8972
8972
  const paths = groups.get(base);
8973
- if (paths) paths.push(path126);
8974
- else groups.set(base, [path126]);
8973
+ if (paths) paths.push(path128);
8974
+ else groups.set(base, [path128]);
8975
8975
  }
8976
8976
  return [...groups].map(([base, paths]) => ({ base, paths: paths.sort() }));
8977
8977
  }
8978
8978
  async function dirtyPaths(cwd, bases) {
8979
8979
  const output = await execGit(cwd, ["diff", "--name-only", "HEAD"]);
8980
- return output.split("\n").filter((path126) => path126 && !bases.has(path126)).sort();
8980
+ return output.split("\n").filter((path128) => path128 && !bases.has(path128)).sort();
8981
8981
  }
8982
8982
 
8983
8983
  // src/commands/sessions/web/scopedDiff.ts
@@ -8986,8 +8986,8 @@ async function scopedDiff(cwd, session, scope) {
8986
8986
  if (scope.kind === "commit") return commitDiff(cwd, scope.sha);
8987
8987
  return await trackedScopeDiff(cwd, session, scope) + await untrackedDiff(cwd);
8988
8988
  }
8989
- async function untrackedFileDiff(cwd, path126) {
8990
- return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path126], {
8989
+ async function untrackedFileDiff(cwd, path128) {
8990
+ return execGit(cwd, ["diff", "--no-index", "--", "/dev/null", path128], {
8991
8991
  maxBuffer: MAX_DIFF_BYTES,
8992
8992
  allowFailure: true
8993
8993
  });
@@ -9000,7 +9000,7 @@ async function untrackedDiff(cwd) {
9000
9000
  ]);
9001
9001
  const paths = list7.split("\n").filter(Boolean);
9002
9002
  const diffs = await Promise.all(
9003
- paths.map((path126) => untrackedFileDiff(cwd, path126))
9003
+ paths.map((path128) => untrackedFileDiff(cwd, path128))
9004
9004
  );
9005
9005
  return diffs.join("");
9006
9006
  }
@@ -9209,8 +9209,8 @@ import { readFile, stat } from "fs/promises";
9209
9209
  // src/commands/sessions/web/fileContent/respondCommitFile.ts
9210
9210
  import { relative, sep } from "path";
9211
9211
  var MAX_FILE_BYTES = 2 * 1024 * 1024;
9212
- async function commitBlob(cwd, sha, path126) {
9213
- const line = await execGit(cwd, ["ls-tree", "-l", sha, "--", path126]);
9212
+ async function commitBlob(cwd, sha, path128) {
9213
+ const line = await execGit(cwd, ["ls-tree", "-l", sha, "--", path128]);
9214
9214
  const match = /^\d+ blob ([0-9a-f]+)\s+(\d+)\t/.exec(line);
9215
9215
  if (!match) return void 0;
9216
9216
  return { hash: match[1], size: Number(match[2]) };
@@ -9226,8 +9226,8 @@ async function respondCommitFile(req, res, { cwd, target }, commit2) {
9226
9226
  respondJson(res, 400, { error: "Invalid commit" });
9227
9227
  return;
9228
9228
  }
9229
- const path126 = relative(cwd, target).split(sep).join("/");
9230
- const blob = await commitBlob(cwd, scope.sha, path126);
9229
+ const path128 = relative(cwd, target).split(sep).join("/");
9230
+ const blob = await commitBlob(cwd, scope.sha, path128);
9231
9231
  if (!blob) {
9232
9232
  respondJson(res, 404, { error: "File not found" });
9233
9233
  return;
@@ -9250,9 +9250,9 @@ import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve4 }
9250
9250
  function repoRoot2(cwd) {
9251
9251
  return resolve4(cwd);
9252
9252
  }
9253
- function resolveWithinCwd(cwd, path126) {
9253
+ function resolveWithinCwd(cwd, path128) {
9254
9254
  const root2 = repoRoot2(cwd);
9255
- const target = resolve4(root2, path126);
9255
+ const target = resolve4(root2, path128);
9256
9256
  const rel = relative2(root2, target);
9257
9257
  if (rel === "" || rel.startsWith("..") || isAbsolute2(rel)) return null;
9258
9258
  return target;
@@ -9262,14 +9262,14 @@ function resolveWithinCwd(cwd, path126) {
9262
9262
  function getFileTarget(req, res) {
9263
9263
  const cwd = getCwdParam(req, res);
9264
9264
  if (!cwd) return null;
9265
- const path126 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
9265
+ const path128 = new URL(req.url ?? "/", "http://localhost").searchParams.get(
9266
9266
  "path"
9267
9267
  );
9268
- if (!path126) {
9268
+ if (!path128) {
9269
9269
  respondJson(res, 400, { error: "Missing path" });
9270
9270
  return null;
9271
9271
  }
9272
- const target = resolveWithinCwd(cwd, path126);
9272
+ const target = resolveWithinCwd(cwd, path128);
9273
9273
  if (!target) {
9274
9274
  respondJson(res, 400, { error: "Path outside cwd" });
9275
9275
  return null;
@@ -9844,9 +9844,9 @@ function segmentText(segment) {
9844
9844
  if (segment.kind === "index") return `[${segment.index}]`;
9845
9845
  return "[]";
9846
9846
  }
9847
- function formatConfigPath(path126) {
9847
+ function formatConfigPath(path128) {
9848
9848
  let text18 = "";
9849
- for (const segment of path126) {
9849
+ for (const segment of path128) {
9850
9850
  const dotted = segment.kind === "key" || segment.kind === "entry";
9851
9851
  const rendered = segmentText(segment);
9852
9852
  text18 += dotted && text18 ? `.${rendered}` : rendered;
@@ -10017,11 +10017,11 @@ function enumValues(node) {
10017
10017
  function opaqueConfigNode(inner, base) {
10018
10018
  return { ...base, kind: "other", type: leafTypeOf(inner) };
10019
10019
  }
10020
- function build(node, path126) {
10020
+ function build(node, path128) {
10021
10021
  const { inner, defaultValue, optional } = unwrapSchemaNode(node);
10022
10022
  const secret = isSecretSchemaNode(node) || isSecretSchemaNode(inner);
10023
10023
  const base = {
10024
- path: path126,
10024
+ path: path128,
10025
10025
  ...optional ? { optional: true } : {},
10026
10026
  ...defaultValue === void 0 ? {} : { defaultValue },
10027
10027
  ...secret ? { secret: true } : {}
@@ -10077,11 +10077,11 @@ function describeConfigLeaves(schema2) {
10077
10077
 
10078
10078
  // src/commands/config/globalConfigFileLabel.ts
10079
10079
  var WINDOWS_MOUNT_PREFIX = "/mnt/";
10080
- function globalConfigFileLabel(path126) {
10081
- if (path126 === getGlobalConfigPath()) return "~/.assist.yml";
10082
- if (path126.startsWith(WINDOWS_MOUNT_PREFIX))
10083
- return `${path126} on the Windows host`;
10084
- return path126;
10080
+ function globalConfigFileLabel(path128) {
10081
+ if (path128 === getGlobalConfigPath()) return "~/.assist.yml";
10082
+ if (path128.startsWith(WINDOWS_MOUNT_PREFIX))
10083
+ return `${path128} on the Windows host`;
10084
+ return path128;
10085
10085
  }
10086
10086
 
10087
10087
  // src/shared/readUserConfigCache.ts
@@ -10139,35 +10139,35 @@ function isPlainRecord(value) {
10139
10139
  }
10140
10140
 
10141
10141
  // src/shared/mapConfigSecrets.ts
10142
- function mapChildren(value, path126, childNode, map) {
10142
+ function mapChildren(value, path128, childNode, map) {
10143
10143
  if (!isPlainRecord(value)) return value;
10144
10144
  return Object.fromEntries(
10145
10145
  Object.entries(value).map(([name2, child2]) => [
10146
10146
  name2,
10147
- walk(child2, [...path126, name2], childNode(name2), map)
10147
+ walk(child2, [...path128, name2], childNode(name2), map)
10148
10148
  ])
10149
10149
  );
10150
10150
  }
10151
- function mapItems(value, path126, item, map) {
10151
+ function mapItems(value, path128, item, map) {
10152
10152
  if (!Array.isArray(value)) return value;
10153
- return value.map((entry, index3) => walk(entry, [...path126, index3], item, map));
10153
+ return value.map((entry, index3) => walk(entry, [...path128, index3], item, map));
10154
10154
  }
10155
- function walk(value, path126, node, map) {
10155
+ function walk(value, path128, node, map) {
10156
10156
  if (!node || value === void 0 || value === null) return value;
10157
- if (node.secret) return map(value, path126);
10157
+ if (node.secret) return map(value, path128);
10158
10158
  switch (node.kind) {
10159
10159
  case "object":
10160
10160
  case "unionOfObjects":
10161
10161
  return mapChildren(
10162
10162
  value,
10163
- path126,
10163
+ path128,
10164
10164
  (name2) => configNodeField(node, name2),
10165
10165
  map
10166
10166
  );
10167
10167
  case "objectList":
10168
- return mapItems(value, path126, node.item, map);
10168
+ return mapItems(value, path128, node.item, map);
10169
10169
  case "record":
10170
- return mapChildren(value, path126, () => node.value, map);
10170
+ return mapChildren(value, path128, () => node.value, map);
10171
10171
  default:
10172
10172
  return value;
10173
10173
  }
@@ -10192,9 +10192,9 @@ function isTraversable(value) {
10192
10192
  function stepInto(current2, key) {
10193
10193
  return isTraversable(current2) ? current2[key] : void 0;
10194
10194
  }
10195
- function getNestedValue(obj, path126) {
10195
+ function getNestedValue(obj, path128) {
10196
10196
  let current2 = obj;
10197
- for (const key of path126.split(".")) current2 = stepInto(current2, key);
10197
+ for (const key of path128.split(".")) current2 = stepInto(current2, key);
10198
10198
  return current2;
10199
10199
  }
10200
10200
 
@@ -10245,9 +10245,9 @@ function step(node, segment) {
10245
10245
  return void 0;
10246
10246
  }
10247
10247
  }
10248
- function findConfigNode(root2, path126) {
10248
+ function findConfigNode(root2, path128) {
10249
10249
  let current2 = root2;
10250
- for (const segment of path126) {
10250
+ for (const segment of path128) {
10251
10251
  if (!current2) return void 0;
10252
10252
  current2 = step(current2, segment);
10253
10253
  }
@@ -10264,34 +10264,34 @@ function nameSegment(name2) {
10264
10264
  return name2 === RECORD_ENTRY_TOKEN ? { kind: "entry" } : { kind: "key", name: name2 };
10265
10265
  }
10266
10266
  function parseConfigPath(text18) {
10267
- const path126 = [];
10267
+ const path128 = [];
10268
10268
  let at2 = 0;
10269
10269
  while (at2 < text18.length) {
10270
10270
  if (text18[at2] === "[") {
10271
10271
  const close = text18.indexOf("]", at2);
10272
10272
  const segment = close === -1 ? void 0 : bracketSegment(text18.slice(at2 + 1, close));
10273
10273
  if (!segment) return void 0;
10274
- path126.push(segment);
10274
+ path128.push(segment);
10275
10275
  at2 = close + 1;
10276
10276
  continue;
10277
10277
  }
10278
10278
  if (text18[at2] === ".") {
10279
- if (path126.length === 0) return void 0;
10279
+ if (path128.length === 0) return void 0;
10280
10280
  at2 += 1;
10281
10281
  }
10282
10282
  const start2 = at2;
10283
10283
  while (at2 < text18.length && text18[at2] !== "." && text18[at2] !== "[") at2 += 1;
10284
10284
  const name2 = text18.slice(start2, at2);
10285
10285
  if (!name2) return void 0;
10286
- path126.push(nameSegment(name2));
10286
+ path128.push(nameSegment(name2));
10287
10287
  }
10288
- return path126;
10288
+ return path128;
10289
10289
  }
10290
10290
 
10291
10291
  // src/commands/config/configEntryNode.ts
10292
10292
  function configEntryNode(root2, key) {
10293
- const path126 = parseConfigPath(key);
10294
- return path126 ? findConfigNode(root2, path126) : void 0;
10293
+ const path128 = parseConfigPath(key);
10294
+ return path128 ? findConfigNode(root2, path128) : void 0;
10295
10295
  }
10296
10296
 
10297
10297
  // src/commands/advise/adviceConfigHelp.ts
@@ -11261,8 +11261,8 @@ function stepIntoNested(container, key, nextKey) {
11261
11261
  }
11262
11262
  return ensureObject(container, resolved);
11263
11263
  }
11264
- function setNestedValue(obj, path126, value) {
11265
- const keys = path126.split(".");
11264
+ function setNestedValue(obj, path128, value) {
11265
+ const keys = path128.split(".");
11266
11266
  const result = { ...obj };
11267
11267
  let current2 = result;
11268
11268
  for (let i = 0; i < keys.length - 1; i++) {
@@ -11497,7 +11497,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
11497
11497
  const parent = dirname11(branchKeyPath);
11498
11498
  const branchPrefix = basename9(branchKeyPath);
11499
11499
  if (!existsSync25(parent)) return null;
11500
- const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join31(parent, name2, "synthesis.md")).filter((path126) => existsSync25(path126)).map((path126) => ({ path: path126, mtime: statSync8(path126).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11500
+ const synthesisFiles = readdirSync9(parent).filter((name2) => name2.startsWith(branchPrefix)).map((name2) => join31(parent, name2, "synthesis.md")).filter((path128) => existsSync25(path128)).map((path128) => ({ path: path128, mtime: statSync8(path128).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
11501
11501
  return synthesisFiles[0]?.path ?? null;
11502
11502
  }
11503
11503
 
@@ -11527,12 +11527,12 @@ async function getReviewSynthesis(req, res) {
11527
11527
  const cwd = getCwdParam(req, res);
11528
11528
  if (!cwd) return;
11529
11529
  try {
11530
- const path126 = await resolveSynthesisPath(cwd);
11531
- if (!path126) {
11530
+ const path128 = await resolveSynthesisPath(cwd);
11531
+ if (!path128) {
11532
11532
  respondJson(res, 404, { error: "No synthesis found" });
11533
11533
  return;
11534
11534
  }
11535
- respondJson(res, 200, { synthesis: readFileSync13(path126, "utf8") });
11535
+ respondJson(res, 200, { synthesis: readFileSync13(path128, "utf8") });
11536
11536
  } catch {
11537
11537
  respondJson(res, 404, { error: "No synthesis found" });
11538
11538
  }
@@ -11554,19 +11554,19 @@ var execFileAsync7 = promisify7(execFile7);
11554
11554
  var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
11555
11555
  var REPO = /^[\w.-]+\/[\w.-]+$/;
11556
11556
  var SHA = /^[0-9a-f]{7,40}$/i;
11557
- function validPath(path126) {
11558
- return path126.length > 0 && !path126.startsWith("/") && path126.split("/").every((part) => part !== "" && part !== "..");
11557
+ function validPath(path128) {
11558
+ return path128.length > 0 && !path128.startsWith("/") && path128.split("/").every((part) => part !== "" && part !== "..");
11559
11559
  }
11560
11560
  async function githubFileContent(req, res) {
11561
11561
  const params = new URL(req.url ?? "/", "http://localhost").searchParams;
11562
11562
  const repo = params.get("repo") ?? "";
11563
11563
  const sha = params.get("sha") ?? "";
11564
- const path126 = params.get("path") ?? "";
11565
- if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path126)) {
11564
+ const path128 = params.get("path") ?? "";
11565
+ if (!REPO.test(repo) || !SHA.test(sha) || !validPath(path128)) {
11566
11566
  respondJson(res, 400, { error: "Invalid repo, sha or path" });
11567
11567
  return;
11568
11568
  }
11569
- const encodedPath = path126.split("/").map(encodeURIComponent).join("/");
11569
+ const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
11570
11570
  try {
11571
11571
  const { stdout } = await execFileAsync7(
11572
11572
  "gh",
@@ -11733,8 +11733,8 @@ function parseDiffNameStatus(output) {
11733
11733
  if (!status2 || fields.length < 2) continue;
11734
11734
  const category = categorize(status2[0]);
11735
11735
  if (!category) continue;
11736
- const path126 = fields[fields.length - 1];
11737
- if (path126) result[category].push(path126);
11736
+ const path128 = fields[fields.length - 1];
11737
+ if (path128) result[category].push(path128);
11738
11738
  }
11739
11739
  return result;
11740
11740
  }
@@ -12140,24 +12140,24 @@ function getOwnerPath(itemId2) {
12140
12140
  function recordSignalOwner(itemId2) {
12141
12141
  const sessionId2 = process.env.ASSIST_SESSION_ID;
12142
12142
  if (!sessionId2) return;
12143
- const path126 = getOwnerPath(itemId2);
12144
- mkdirSync8(dirname12(path126), { recursive: true });
12145
- writeFileSync7(path126, JSON.stringify({ sessionId: sessionId2 }));
12143
+ const path128 = getOwnerPath(itemId2);
12144
+ mkdirSync8(dirname12(path128), { recursive: true });
12145
+ writeFileSync7(path128, JSON.stringify({ sessionId: sessionId2 }));
12146
12146
  }
12147
12147
  function readSignalOwner(itemId2) {
12148
- const path126 = getOwnerPath(itemId2);
12149
- if (!existsSync26(path126)) return void 0;
12148
+ const path128 = getOwnerPath(itemId2);
12149
+ if (!existsSync26(path128)) return void 0;
12150
12150
  try {
12151
- const parsed = JSON.parse(readFileSync14(path126, "utf8"));
12151
+ const parsed = JSON.parse(readFileSync14(path128, "utf8"));
12152
12152
  return parsed.sessionId;
12153
12153
  } catch {
12154
12154
  return void 0;
12155
12155
  }
12156
12156
  }
12157
12157
  function clearSignalOwner(itemId2) {
12158
- const path126 = getOwnerPath(itemId2);
12158
+ const path128 = getOwnerPath(itemId2);
12159
12159
  try {
12160
- rmSync3(path126);
12160
+ rmSync3(path128);
12161
12161
  } catch {
12162
12162
  }
12163
12163
  }
@@ -12194,11 +12194,11 @@ function resolveSignalTarget(event, data) {
12194
12194
  function writeSignal(event, data) {
12195
12195
  const target = resolveSignalTarget(event, data);
12196
12196
  if (!target) return;
12197
- const path126 = getSignalPath(target);
12198
- if (!path126) return;
12197
+ const path128 = getSignalPath(target);
12198
+ if (!path128) return;
12199
12199
  const signal = { event, sessionId: target, ...data };
12200
- mkdirSync9(dirname13(path126), { recursive: true });
12201
- writeFileSync8(path126, JSON.stringify(signal));
12200
+ mkdirSync9(dirname13(path128), { recursive: true });
12201
+ writeFileSync8(path128, JSON.stringify(signal));
12202
12202
  }
12203
12203
 
12204
12204
  // src/commands/backlog/rewindItemToPhase.ts
@@ -12626,11 +12626,11 @@ function logLinkedRequest(req, res) {
12626
12626
  const started2 = Date.now();
12627
12627
  const from = req.headers[LINKED_FROM_HEADER2];
12628
12628
  const trace = req.headers[TRACE_HEADER] ?? "none";
12629
- const path126 = new URL(req.url ?? "/", "http://localhost").pathname;
12629
+ const path128 = new URL(req.url ?? "/", "http://localhost").pathname;
12630
12630
  res.once("finish", () => {
12631
- if (isQuietPoll(path126, res.statusCode)) return;
12631
+ if (isQuietPoll(path128, res.statusCode)) return;
12632
12632
  console.log(
12633
- `link-from ${from} http: ${req.method} ${path126} trace=${trace} -> ${res.statusCode} (${Date.now() - started2}ms)`
12633
+ `link-from ${from} http: ${req.method} ${path128} trace=${trace} -> ${res.statusCode} (${Date.now() - started2}ms)`
12634
12634
  );
12635
12635
  });
12636
12636
  }
@@ -13204,21 +13204,21 @@ function subsequenceScore(text18, query) {
13204
13204
  }
13205
13205
  return score - Math.min(text18.length, MAX_LENGTH_PENALTY);
13206
13206
  }
13207
- function scoreFilePath(path126, query) {
13207
+ function scoreFilePath(path128, query) {
13208
13208
  const needle = query.trim().toLowerCase();
13209
13209
  if (!needle) return 0;
13210
- const basename38 = path126.slice(path126.lastIndexOf("/") + 1);
13210
+ const basename38 = path128.slice(path128.lastIndexOf("/") + 1);
13211
13211
  const inBasename = subsequenceScore(basename38, needle);
13212
13212
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
13213
- return subsequenceScore(path126, needle);
13213
+ return subsequenceScore(path128, needle);
13214
13214
  }
13215
13215
 
13216
13216
  // src/commands/sessions/web/rankFilePaths.ts
13217
13217
  function rankFilePaths(paths, query, limit) {
13218
13218
  const scored = [];
13219
- for (const path126 of paths) {
13220
- const score = scoreFilePath(path126, query);
13221
- if (score !== null) scored.push({ path: path126, score });
13219
+ for (const path128 of paths) {
13220
+ const score = scoreFilePath(path128, query);
13221
+ if (score !== null) scored.push({ path: path128, score });
13222
13222
  }
13223
13223
  scored.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
13224
13224
  return scored.slice(0, limit).map((entry) => entry.path);
@@ -14801,8 +14801,8 @@ import { stat as stat2 } from "fs/promises";
14801
14801
 
14802
14802
  // src/shared/isStagedAttachmentPath.ts
14803
14803
  import { isAbsolute as isAbsolute3, relative as relative4, resolve as resolve9, sep as sep2 } from "path";
14804
- function isStagedAttachmentPath(path126) {
14805
- const rel = relative4(stagedAttachmentsDir, resolve9(path126));
14804
+ function isStagedAttachmentPath(path128) {
14805
+ const rel = relative4(stagedAttachmentsDir, resolve9(path128));
14806
14806
  return rel !== "" && rel !== ".." && !rel.startsWith(`..${sep2}`) && !isAbsolute3(rel);
14807
14807
  }
14808
14808
 
@@ -14822,8 +14822,8 @@ var attachmentMimeTypes = {
14822
14822
  };
14823
14823
 
14824
14824
  // src/commands/sessions/web/attachmentContentType.ts
14825
- function attachmentContentType(path126) {
14826
- const ext = extname(path126).replace(/^\./, "").toLowerCase();
14825
+ function attachmentContentType(path128) {
14826
+ const ext = extname(path128).replace(/^\./, "").toLowerCase();
14827
14827
  const match = Object.entries(attachmentMimeTypes).find(([, e]) => e === ext);
14828
14828
  return match?.[0] ?? "application/octet-stream";
14829
14829
  }
@@ -14831,22 +14831,22 @@ function attachmentContentType(path126) {
14831
14831
  // src/commands/sessions/web/previewImage.ts
14832
14832
  async function previewImage(req, res) {
14833
14833
  const url = new URL(req.url ?? "/", "http://localhost");
14834
- const path126 = url.searchParams.get("path") ?? "";
14835
- if (!isStagedAttachmentPath(path126)) {
14834
+ const path128 = url.searchParams.get("path") ?? "";
14835
+ if (!isStagedAttachmentPath(path128)) {
14836
14836
  respondJson(res, 400, { error: "Not a staged attachment." });
14837
14837
  return;
14838
14838
  }
14839
- const info = await stat2(path126).catch(() => null);
14839
+ const info = await stat2(path128).catch(() => null);
14840
14840
  if (!info?.isFile()) {
14841
14841
  respondJson(res, 404, { error: "Attachment is no longer staged." });
14842
14842
  return;
14843
14843
  }
14844
14844
  res.writeHead(200, {
14845
- "Content-Type": attachmentContentType(path126),
14845
+ "Content-Type": attachmentContentType(path128),
14846
14846
  "Content-Length": info.size,
14847
14847
  "Cache-Control": "no-store"
14848
14848
  });
14849
- createReadStream2(path126).pipe(res);
14849
+ createReadStream2(path128).pipe(res);
14850
14850
  }
14851
14851
 
14852
14852
  // src/commands/sessions/web/getCurrentBranch.ts
@@ -15283,8 +15283,8 @@ async function liveDeployments(cwd, repo, environments) {
15283
15283
 
15284
15284
  // src/commands/sessions/web/releases/latestRun.ts
15285
15285
  async function latestRun(cwd, repo, workflow) {
15286
- const path126 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
15287
- const response = await ghJson(cwd, ["api", path126]);
15286
+ const path128 = `repos/${repo}/actions/workflows/${encodeURIComponent(workflow)}/runs?per_page=1&exclude_pull_requests=true`;
15287
+ const response = await ghJson(cwd, ["api", path128]);
15288
15288
  const run5 = response.workflow_runs?.[0];
15289
15289
  if (!run5) return null;
15290
15290
  return {
@@ -15579,36 +15579,36 @@ import { relative as relative5 } from "path";
15579
15579
  function git(cwd, args) {
15580
15580
  return execGit(cwd, ["--literal-pathspecs", ...args]);
15581
15581
  }
15582
- async function isTracked(cwd, path126) {
15582
+ async function isTracked(cwd, path128) {
15583
15583
  try {
15584
- await git(cwd, ["ls-files", "--error-unmatch", "--", path126]);
15584
+ await git(cwd, ["ls-files", "--error-unmatch", "--", path128]);
15585
15585
  return true;
15586
15586
  } catch {
15587
15587
  return false;
15588
15588
  }
15589
15589
  }
15590
- async function isInHead(cwd, path126) {
15591
- const listing = await git(cwd, ["ls-tree", "HEAD", "--", path126]);
15590
+ async function isInHead(cwd, path128) {
15591
+ const listing = await git(cwd, ["ls-tree", "HEAD", "--", path128]);
15592
15592
  return listing.trim().length > 0;
15593
15593
  }
15594
- async function hasChanges(cwd, path126) {
15594
+ async function hasChanges(cwd, path128) {
15595
15595
  const status2 = await git(cwd, [
15596
15596
  "status",
15597
15597
  "--porcelain",
15598
15598
  "-z",
15599
15599
  "--untracked-files=all",
15600
15600
  "--",
15601
- path126
15601
+ path128
15602
15602
  ]);
15603
15603
  return status2.length > 0;
15604
15604
  }
15605
- async function renameSources(cwd, path126) {
15605
+ async function renameSources(cwd, path128) {
15606
15606
  const fields = (await git(cwd, ["diff", "HEAD", "--name-status", "-z"])).split("\0");
15607
15607
  const sources = [];
15608
15608
  for (let i = 0; i < fields.length; ) {
15609
15609
  const status2 = fields[i];
15610
15610
  if (status2.startsWith("R")) {
15611
- if (fields[i + 2] === path126) sources.push(fields[i + 1]);
15611
+ if (fields[i + 2] === path128) sources.push(fields[i + 1]);
15612
15612
  i += 3;
15613
15613
  } else {
15614
15614
  i += status2.startsWith("C") ? 3 : 2;
@@ -15616,34 +15616,34 @@ async function renameSources(cwd, path126) {
15616
15616
  }
15617
15617
  return sources;
15618
15618
  }
15619
- async function restorePath(cwd, path126) {
15620
- if (await isInHead(cwd, path126)) {
15621
- await git(cwd, ["checkout", "HEAD", "--", path126]);
15619
+ async function restorePath(cwd, path128) {
15620
+ if (await isInHead(cwd, path128)) {
15621
+ await git(cwd, ["checkout", "HEAD", "--", path128]);
15622
15622
  return;
15623
15623
  }
15624
- if (await isTracked(cwd, path126)) {
15625
- await git(cwd, ["rm", "-f", "--", path126]);
15624
+ if (await isTracked(cwd, path128)) {
15625
+ await git(cwd, ["rm", "-f", "--", path128]);
15626
15626
  return;
15627
15627
  }
15628
- await git(cwd, ["clean", "-f", "--", path126]);
15628
+ await git(cwd, ["clean", "-f", "--", path128]);
15629
15629
  }
15630
- async function revertPathChanges(cwd, path126) {
15631
- if (!await hasChanges(cwd, path126))
15632
- throw new Error(`No uncommitted changes found for ${path126}`);
15633
- for (const target of [...await renameSources(cwd, path126), path126])
15630
+ async function revertPathChanges(cwd, path128) {
15631
+ if (!await hasChanges(cwd, path128))
15632
+ throw new Error(`No uncommitted changes found for ${path128}`);
15633
+ for (const target of [...await renameSources(cwd, path128), path128])
15634
15634
  await restorePath(cwd, target);
15635
- if (await hasChanges(cwd, path126))
15636
- throw new Error(`${path126} still has uncommitted changes`);
15635
+ if (await hasChanges(cwd, path128))
15636
+ throw new Error(`${path128} still has uncommitted changes`);
15637
15637
  }
15638
15638
 
15639
15639
  // src/commands/sessions/web/revertDiffFile.ts
15640
15640
  async function revertDiffFile(req, res) {
15641
15641
  const resolved = getFileTarget(req, res);
15642
15642
  if (!resolved) return;
15643
- const path126 = relative5(repoRoot2(resolved.cwd), resolved.target);
15643
+ const path128 = relative5(repoRoot2(resolved.cwd), resolved.target);
15644
15644
  try {
15645
- await revertPathChanges(resolved.cwd, path126);
15646
- respondJson(res, 200, { reverted: path126 });
15645
+ await revertPathChanges(resolved.cwd, path128);
15646
+ respondJson(res, 200, { reverted: path128 });
15647
15647
  } catch (error) {
15648
15648
  respondJson(res, 500, {
15649
15649
  error: error instanceof Error ? error.message : "Failed to revert file"
@@ -15755,7 +15755,7 @@ import { relative as relative6 } from "path";
15755
15755
  function requestedPaths(body) {
15756
15756
  const paths = body.paths;
15757
15757
  if (!Array.isArray(paths)) return null;
15758
- if (paths.some((path126) => typeof path126 !== "string")) return null;
15758
+ if (paths.some((path128) => typeof path128 !== "string")) return null;
15759
15759
  return paths;
15760
15760
  }
15761
15761
  async function revertDiffPaths(req, res) {
@@ -15775,10 +15775,10 @@ async function revertDiffPaths(req, res) {
15775
15775
  const root2 = repoRoot2(cwd);
15776
15776
  const reverted = [];
15777
15777
  const failed3 = [];
15778
- for (const path126 of paths) {
15779
- const target = resolveWithinCwd(cwd, path126);
15778
+ for (const path128 of paths) {
15779
+ const target = resolveWithinCwd(cwd, path128);
15780
15780
  if (!target) {
15781
- failed3.push({ path: path126, error: "Path outside cwd" });
15781
+ failed3.push({ path: path128, error: "Path outside cwd" });
15782
15782
  continue;
15783
15783
  }
15784
15784
  const relativePath = relative6(root2, target);
@@ -15871,13 +15871,13 @@ function describePeerError(error) {
15871
15871
  const cause = error.cause;
15872
15872
  return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
15873
15873
  }
15874
- async function fetchPeerJson(baseUrl2, path126, timeoutMs = PEER_TIMEOUT_MS) {
15875
- const res = await fetch(new URL(path126, baseUrl2), {
15874
+ async function fetchPeerJson(baseUrl2, path128, timeoutMs = PEER_TIMEOUT_MS) {
15875
+ const res = await fetch(new URL(path128, baseUrl2), {
15876
15876
  signal: AbortSignal.timeout(timeoutMs)
15877
15877
  });
15878
15878
  if (!res.ok)
15879
15879
  throw Object.assign(
15880
- new Error(`GET ${path126} returned ${res.status} ${res.statusText}`),
15880
+ new Error(`GET ${path128} returned ${res.status} ${res.statusText}`),
15881
15881
  { status: res.status }
15882
15882
  );
15883
15883
  return await res.json();
@@ -16278,8 +16278,8 @@ async function inviteTeamMember(client, appId, email) {
16278
16278
  }
16279
16279
 
16280
16280
  // src/commands/testflight/addInternalTester.ts
16281
- async function hasMatch(client, path126, params, attribute, email) {
16282
- const { data } = await client.get(path126, params);
16281
+ async function hasMatch(client, path128, params, attribute, email) {
16282
+ const { data } = await client.get(path128, params);
16283
16283
  return data.some(
16284
16284
  (item) => String(item.attributes?.[attribute]).toLowerCase() === email.toLowerCase()
16285
16285
  );
@@ -16320,9 +16320,9 @@ function parseErrors(body) {
16320
16320
  return body ? [body] : [];
16321
16321
  }
16322
16322
  }
16323
- function formatAscError(method, path126, status2, body) {
16323
+ function formatAscError(method, path128, status2, body) {
16324
16324
  const lines = [
16325
- `App Store Connect ${method} ${path126} failed (${status2})`,
16325
+ `App Store Connect ${method} ${path128} failed (${status2})`,
16326
16326
  ...parseErrors(body).map((line) => ` ${line}`)
16327
16327
  ];
16328
16328
  const hint = statusHints[status2];
@@ -16339,9 +16339,9 @@ var TestflightError = class extends Error {
16339
16339
  function baseUrl() {
16340
16340
  return process.env.ASSIST_ASC_BASE_URL ?? "https://api.appstoreconnect.apple.com";
16341
16341
  }
16342
- async function send(fetchFn, token, method, path126, body) {
16342
+ async function send(fetchFn, token, method, path128, body) {
16343
16343
  try {
16344
- return await fetchFn(`${baseUrl()}${path126}`, {
16344
+ return await fetchFn(`${baseUrl()}${path128}`, {
16345
16345
  method,
16346
16346
  headers: {
16347
16347
  Authorization: `Bearer ${token}`,
@@ -16355,12 +16355,12 @@ async function send(fetchFn, token, method, path126, body) {
16355
16355
  throw new TestflightError(`Failed to reach App Store Connect: ${reason4}`);
16356
16356
  }
16357
16357
  }
16358
- async function ascRequest(fetchFn, token, method, path126, body) {
16359
- const response = await send(fetchFn, token, method, path126, body);
16358
+ async function ascRequest(fetchFn, token, method, path128, body) {
16359
+ const response = await send(fetchFn, token, method, path128, body);
16360
16360
  const text18 = await response.text();
16361
16361
  if (!response.ok) {
16362
16362
  throw new TestflightError(
16363
- formatAscError(method, path126.split("?")[0], response.status, text18)
16363
+ formatAscError(method, path128.split("?")[0], response.status, text18)
16364
16364
  );
16365
16365
  }
16366
16366
  return text18 ? JSON.parse(text18) : void 0;
@@ -16369,11 +16369,11 @@ async function ascRequest(fetchFn, token, method, path126, body) {
16369
16369
  // src/commands/testflight/createAscClient.ts
16370
16370
  function createAscClient(token, fetchFn = fetch) {
16371
16371
  return {
16372
- get: (path126, params) => {
16372
+ get: (path128, params) => {
16373
16373
  const query = params ? `?${new URLSearchParams(params)}` : "";
16374
- return ascRequest(fetchFn, token, "GET", `${path126}${query}`);
16374
+ return ascRequest(fetchFn, token, "GET", `${path128}${query}`);
16375
16375
  },
16376
- post: (path126, body) => ascRequest(fetchFn, token, "POST", path126, body)
16376
+ post: (path128, body) => ascRequest(fetchFn, token, "POST", path128, body)
16377
16377
  };
16378
16378
  }
16379
16379
 
@@ -16719,11 +16719,11 @@ function parseJson(raw) {
16719
16719
  }
16720
16720
  }
16721
16721
  function formatIssue(key, issue) {
16722
- const path126 = formatConfigPath([
16722
+ const path128 = formatConfigPath([
16723
16723
  { kind: "key", name: key },
16724
16724
  ...issue.path.map(toSegment)
16725
16725
  ]);
16726
- return `${path126}: ${issue.message}`;
16726
+ return `${path128}: ${issue.message}`;
16727
16727
  }
16728
16728
  function toSegment(part) {
16729
16729
  return typeof part === "number" ? { kind: "index", index: part } : { kind: "key", name: String(part) };
@@ -16818,9 +16818,9 @@ function coerceUnion(key, raw, types) {
16818
16818
  }
16819
16819
 
16820
16820
  // src/shared/valueAtConfigPath.ts
16821
- function valueAtConfigPath(value, path126) {
16821
+ function valueAtConfigPath(value, path128) {
16822
16822
  let current2 = value;
16823
- for (const key of path126) {
16823
+ for (const key of path128) {
16824
16824
  if (typeof key === "number") {
16825
16825
  if (!Array.isArray(current2)) return void 0;
16826
16826
  current2 = current2[key];
@@ -16837,7 +16837,7 @@ function restoreConfigSecrets(value, stored, node) {
16837
16837
  return mapConfigSecrets(
16838
16838
  value,
16839
16839
  node,
16840
- (secret, path126) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path126) : secret
16840
+ (secret, path128) => isRedactedSecret(secret) ? valueAtConfigPath(stored, path128) : secret
16841
16841
  );
16842
16842
  }
16843
16843
 
@@ -16866,8 +16866,8 @@ function formatIssue2(issue, key) {
16866
16866
  return issue.keys.map(
16867
16867
  (unrecognized) => `${[...issue.path, unrecognized].join(".")}: Unrecognized key`
16868
16868
  );
16869
- const path126 = issue.path.length > 0 ? issue.path.join(".") : key;
16870
- return [`${path126}: ${issue.message}`];
16869
+ const path128 = issue.path.length > 0 ? issue.path.join(".") : key;
16870
+ return [`${path128}: ${issue.message}`];
16871
16871
  }
16872
16872
 
16873
16873
  // src/commands/config/applyConfigSet.ts
@@ -16964,16 +16964,16 @@ async function readUserConfig(orm) {
16964
16964
  import { mkdirSync as mkdirSync10, renameSync as renameSync3, writeFileSync as writeFileSync9 } from "fs";
16965
16965
  import { dirname as dirname15 } from "path";
16966
16966
  function writeRepoConfigCache(repos2, user = {}) {
16967
- const path126 = repoConfigCachePath();
16968
- mkdirSync10(dirname15(path126), { recursive: true });
16967
+ const path128 = repoConfigCachePath();
16968
+ mkdirSync10(dirname15(path128), { recursive: true });
16969
16969
  const cache7 = {
16970
16970
  refreshedAt: (/* @__PURE__ */ new Date()).toISOString(),
16971
16971
  repos: repos2,
16972
16972
  user
16973
16973
  };
16974
- const tmp = `${path126}.${process.pid}.tmp`;
16974
+ const tmp = `${path128}.${process.pid}.tmp`;
16975
16975
  writeFileSync9(tmp, JSON.stringify(cache7, null, 2));
16976
- renameSync3(tmp, path126);
16976
+ renameSync3(tmp, path128);
16977
16977
  }
16978
16978
 
16979
16979
  // src/shared/refreshRepoConfigCache.ts
@@ -17146,8 +17146,8 @@ function seesApp(item, appId) {
17146
17146
  const linked = item.relationships?.visibleApps?.data;
17147
17147
  return Array.isArray(linked) && linked.some((app) => app.id === appId);
17148
17148
  }
17149
- async function listEmails(client, path126, type, emailAttribute, appId) {
17150
- const { data } = await client.get(path126, {
17149
+ async function listEmails(client, path128, type, emailAttribute, appId) {
17150
+ const { data } = await client.get(path128, {
17151
17151
  include: "visibleApps",
17152
17152
  [`fields[${type}]`]: `${emailAttribute},allAppsVisible,visibleApps`,
17153
17153
  "fields[apps]": "bundleId",
@@ -17331,8 +17331,8 @@ function removeAt(container, keys) {
17331
17331
  }
17332
17332
  return removeFromChild(container, key, rest);
17333
17333
  }
17334
- function unsetNestedValue(obj, path126) {
17335
- const { container, removed } = removeAt(obj, path126.split("."));
17334
+ function unsetNestedValue(obj, path128) {
17335
+ const { container, removed } = removeAt(obj, path128.split("."));
17336
17336
  return { config: container, removed };
17337
17337
  }
17338
17338
 
@@ -17645,12 +17645,12 @@ var sessionsPrefix = "src/commands/sessions/";
17645
17645
  var restartRules = [
17646
17646
  {
17647
17647
  target: "webserver",
17648
- matches: (path126) => path126.startsWith(webUiPrefix),
17648
+ matches: (path128) => path128.startsWith(webUiPrefix),
17649
17649
  advice: "restart the web server, then hard-reload the browser tab"
17650
17650
  },
17651
17651
  {
17652
17652
  target: "daemon",
17653
- matches: (path126) => path126.startsWith(sessionsPrefix) && !path126.startsWith(webUiPrefix),
17653
+ matches: (path128) => path128.startsWith(sessionsPrefix) && !path128.startsWith(webUiPrefix),
17654
17654
  advice: "restart the daemon"
17655
17655
  }
17656
17656
  ];
@@ -17715,11 +17715,11 @@ import { basename as basename13, join as join41 } from "path";
17715
17715
  // src/commands/sessions/daemon/worktree/canonicalTreePath.ts
17716
17716
  import { realpathSync as realpathSync2 } from "fs";
17717
17717
  import { resolve as resolve12 } from "path";
17718
- function canonicalTreePath(path126) {
17718
+ function canonicalTreePath(path128) {
17719
17719
  try {
17720
- return realpathSync2(path126);
17720
+ return realpathSync2(path128);
17721
17721
  } catch {
17722
- return resolve12(path126);
17722
+ return resolve12(path128);
17723
17723
  }
17724
17724
  }
17725
17725
 
@@ -18463,22 +18463,22 @@ function scheduleReconnect() {
18463
18463
  import { mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync10 } from "fs";
18464
18464
  import { dirname as dirname20, join as join45 } from "path";
18465
18465
  var defaultPath = join45(daemonPaths.dir, "auto-restart-attempts.json");
18466
- function read(path126) {
18466
+ function read(path128) {
18467
18467
  try {
18468
- return JSON.parse(readFileSync20(path126, "utf8"));
18468
+ return JSON.parse(readFileSync20(path128, "utf8"));
18469
18469
  } catch {
18470
18470
  return {};
18471
18471
  }
18472
18472
  }
18473
- function autoRestartAttempts(port, path126 = defaultPath) {
18473
+ function autoRestartAttempts(port, path128 = defaultPath) {
18474
18474
  const key = String(port);
18475
18475
  return {
18476
- get: () => read(path126)[key],
18476
+ get: () => read(path128)[key],
18477
18477
  set: (built) => {
18478
- mkdirSync11(dirname20(path126), { recursive: true });
18478
+ mkdirSync11(dirname20(path128), { recursive: true });
18479
18479
  writeFileSync10(
18480
- path126,
18481
- `${JSON.stringify({ ...read(path126), [key]: built }, null, 2)}
18480
+ path128,
18481
+ `${JSON.stringify({ ...read(path128), [key]: built }, null, 2)}
18482
18482
  `
18483
18483
  );
18484
18484
  }
@@ -18788,29 +18788,29 @@ function gitCommonDir(cwd) {
18788
18788
  var REGISTRY_FILE = "worktrees.json";
18789
18789
  function readWorktreeRegistry() {
18790
18790
  const data = loadJson(REGISTRY_FILE);
18791
- return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path126, { reaped: _reaped, ...record3 }]) => ({ path: path126, ...record3 }));
18791
+ return Object.entries(data).filter(([, record3]) => !record3.reaped).map(([path128, { reaped: _reaped, ...record3 }]) => ({ path: path128, ...record3 }));
18792
18792
  }
18793
- function worktreeAttributionIncludingReaped(path126) {
18794
- const record3 = loadJson(REGISTRY_FILE)[path126];
18793
+ function worktreeAttributionIncludingReaped(path128) {
18794
+ const record3 = loadJson(REGISTRY_FILE)[path128];
18795
18795
  return record3 ? { clone: record3.clone, origin: record3.origin } : void 0;
18796
18796
  }
18797
- function recordWorktree(path126, clone, origin) {
18797
+ function recordWorktree(path128, clone, origin) {
18798
18798
  const data = loadJson(REGISTRY_FILE);
18799
- data[path126] = { clone, origin };
18799
+ data[path128] = { clone, origin };
18800
18800
  saveJson(REGISTRY_FILE, data);
18801
18801
  }
18802
- function recordWorktreeHarness(path126, harness) {
18802
+ function recordWorktreeHarness(path128, harness) {
18803
18803
  const data = loadJson(REGISTRY_FILE);
18804
- const record3 = data[path126];
18804
+ const record3 = data[path128];
18805
18805
  if (!record3 || record3.reaped || record3.harness === harness) return;
18806
- data[path126] = { ...record3, harness };
18806
+ data[path128] = { ...record3, harness };
18807
18807
  saveJson(REGISTRY_FILE, data);
18808
18808
  }
18809
- function forgetWorktree(path126) {
18809
+ function forgetWorktree(path128) {
18810
18810
  const data = loadJson(REGISTRY_FILE);
18811
- const record3 = data[path126];
18811
+ const record3 = data[path128];
18812
18812
  if (!record3 || record3.reaped) return;
18813
- data[path126] = { ...record3, reaped: true };
18813
+ data[path128] = { ...record3, reaped: true };
18814
18814
  saveJson(REGISTRY_FILE, data);
18815
18815
  }
18816
18816
 
@@ -20894,9 +20894,9 @@ function toAnswers(value) {
20894
20894
  function toAttachments(value) {
20895
20895
  if (!Array.isArray(value)) return void 0;
20896
20896
  return value.flatMap((entry) => {
20897
- const { path: path126, alt, group } = entry ?? {};
20898
- if (typeof path126 !== "string" || path126 === "") return [];
20899
- const attachment = { path: path126, alt: typeof alt === "string" ? alt : "" };
20897
+ const { path: path128, alt, group } = entry ?? {};
20898
+ if (typeof path128 !== "string" || path128 === "") return [];
20899
+ const attachment = { path: path128, alt: typeof alt === "string" ? alt : "" };
20900
20900
  return [
20901
20901
  typeof group === "string" && group !== "" ? { ...attachment, group } : attachment
20902
20902
  ];
@@ -20930,8 +20930,8 @@ function isReviewComment(value) {
20930
20930
  }
20931
20931
  function toReviewComments(value) {
20932
20932
  if (!Array.isArray(value)) return void 0;
20933
- return value.filter(isReviewComment).map(({ path: path126, startLine, endLine, quote, note, startSide, side }) => ({
20934
- path: path126,
20933
+ return value.filter(isReviewComment).map(({ path: path128, startLine, endLine, quote, note, startSide, side }) => ({
20934
+ path: path128,
20935
20935
  startLine,
20936
20936
  endLine,
20937
20937
  quote,
@@ -22115,8 +22115,8 @@ async function recordGitRef(db, itemId2, ref) {
22115
22115
  function gitRefUrl(kind, ref, cwd) {
22116
22116
  const repo = getPreferredRemoteRepo(cwd);
22117
22117
  if (!repo) return void 0;
22118
- const path126 = kind === "branch" ? "tree" : "commit";
22119
- return `https://github.com/${repo.org}/${repo.repo}/${path126}/${ref}`;
22118
+ const path128 = kind === "branch" ? "tree" : "commit";
22119
+ return `https://github.com/${repo.org}/${repo.repo}/${path128}/${ref}`;
22120
22120
  }
22121
22121
 
22122
22122
  // src/commands/sessions/summarise/readTranscriptHead.ts
@@ -22487,9 +22487,9 @@ function originToSshUrl(origin) {
22487
22487
  const firstSlash = origin.indexOf("/");
22488
22488
  if (firstSlash <= 0) return null;
22489
22489
  const host = origin.slice(0, firstSlash);
22490
- const path126 = origin.slice(firstSlash + 1);
22491
- if (!path126) return null;
22492
- return `git@${host}:${path126}.git`;
22490
+ const path128 = origin.slice(firstSlash + 1);
22491
+ if (!path128) return null;
22492
+ return `git@${host}:${path128}.git`;
22493
22493
  }
22494
22494
 
22495
22495
  // src/commands/backlog/cloneRepo.ts
@@ -23344,44 +23344,44 @@ import { randomUUID as randomUUID10 } from "crypto";
23344
23344
  // src/commands/backlog/propose/mutateLedger.ts
23345
23345
  import { mkdirSync as mkdirSync15, readFileSync as readFileSync32, renameSync as renameSync4, writeFileSync as writeFileSync24 } from "fs";
23346
23346
  import { dirname as dirname30 } from "path";
23347
- function readLedger(path126) {
23347
+ function readLedger(path128) {
23348
23348
  try {
23349
- const parsed = JSON.parse(readFileSync32(path126, "utf8"));
23349
+ const parsed = JSON.parse(readFileSync32(path128, "utf8"));
23350
23350
  return { open: parsed.open ?? [], created: parsed.created };
23351
23351
  } catch {
23352
23352
  return { open: [] };
23353
23353
  }
23354
23354
  }
23355
- function mutateLedger(path126, mutate) {
23356
- const ledger = readLedger(path126);
23355
+ function mutateLedger(path128, mutate) {
23356
+ const ledger = readLedger(path128);
23357
23357
  mutate(ledger);
23358
- mkdirSync15(dirname30(path126), { recursive: true });
23359
- const tmp = `${path126}.${process.pid}.tmp`;
23358
+ mkdirSync15(dirname30(path128), { recursive: true });
23359
+ const tmp = `${path128}.${process.pid}.tmp`;
23360
23360
  writeFileSync24(tmp, JSON.stringify(ledger));
23361
- renameSync4(tmp, path126);
23361
+ renameSync4(tmp, path128);
23362
23362
  }
23363
23363
 
23364
23364
  // src/commands/backlog/propose/findPredecessor.ts
23365
23365
  var GRACE_MS2 = 5e3;
23366
23366
  var SIBLING_WAIT_MS = 5e3;
23367
23367
  var POLL_MS = 100;
23368
- function knownPredecessor(path126, startedAt) {
23369
- const { created } = readLedger(path126);
23368
+ function knownPredecessor(path128, startedAt) {
23369
+ const { created } = readLedger(path128);
23370
23370
  if (!created) return void 0;
23371
23371
  if (created.startedAt > startedAt) return void 0;
23372
23372
  if (created.at < startedAt - GRACE_MS2) return void 0;
23373
23373
  return created.itemId;
23374
23374
  }
23375
- function hasOlderOpenSibling(path126, token, startedAt) {
23376
- return readLedger(path126).open.some(
23375
+ function hasOlderOpenSibling(path128, token, startedAt) {
23376
+ return readLedger(path128).open.some(
23377
23377
  (p) => p.token !== token && p.startedAt <= startedAt
23378
23378
  );
23379
23379
  }
23380
- async function findPredecessor(path126, token, startedAt) {
23380
+ async function findPredecessor(path128, token, startedAt) {
23381
23381
  const deadline = Date.now() + SIBLING_WAIT_MS;
23382
- while (hasOlderOpenSibling(path126, token, startedAt) && Date.now() < deadline)
23382
+ while (hasOlderOpenSibling(path128, token, startedAt) && Date.now() < deadline)
23383
23383
  await new Promise((resolve36) => setTimeout(resolve36, POLL_MS));
23384
- return knownPredecessor(path126, startedAt);
23384
+ return knownPredecessor(path128, startedAt);
23385
23385
  }
23386
23386
 
23387
23387
  // src/commands/backlog/propose/proposalLedgerPath.ts
@@ -23394,10 +23394,10 @@ function proposalLedgerPath(sessionId2) {
23394
23394
  // src/commands/backlog/propose/trackProposal.ts
23395
23395
  var STALE_OPEN_MS = 60 * 6e4;
23396
23396
  function trackProposal(sessionId2) {
23397
- const path126 = proposalLedgerPath(sessionId2);
23397
+ const path128 = proposalLedgerPath(sessionId2);
23398
23398
  const token = randomUUID10();
23399
23399
  const startedAt = Date.now();
23400
- mutateLedger(path126, (ledger) => {
23400
+ mutateLedger(path128, (ledger) => {
23401
23401
  ledger.open = ledger.open.filter(
23402
23402
  (p) => startedAt - p.startedAt < STALE_OPEN_MS
23403
23403
  );
@@ -23408,15 +23408,15 @@ function trackProposal(sessionId2) {
23408
23408
  if (closed) return;
23409
23409
  closed = true;
23410
23410
  process.off("exit", close);
23411
- mutateLedger(path126, (ledger) => {
23411
+ mutateLedger(path128, (ledger) => {
23412
23412
  ledger.open = ledger.open.filter((p) => p.token !== token);
23413
23413
  });
23414
23414
  };
23415
23415
  process.on("exit", close);
23416
23416
  return {
23417
- knownPredecessor: () => knownPredecessor(path126, startedAt),
23418
- findPredecessor: () => findPredecessor(path126, token, startedAt),
23419
- recordCreated: (itemId2) => mutateLedger(path126, (ledger) => {
23417
+ knownPredecessor: () => knownPredecessor(path128, startedAt),
23418
+ findPredecessor: () => findPredecessor(path128, token, startedAt),
23419
+ recordCreated: (itemId2) => mutateLedger(path128, (ledger) => {
23420
23420
  ledger.created = { itemId: itemId2, at: Date.now(), startedAt };
23421
23421
  }),
23422
23422
  close
@@ -24590,10 +24590,10 @@ import { existsSync as existsSync53, unwatchFile, watchFile } from "fs";
24590
24590
  // src/commands/backlog/readSignal.ts
24591
24591
  import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
24592
24592
  function readSignal() {
24593
- const path126 = getSignalPath();
24594
- if (!path126 || !existsSync52(path126)) return void 0;
24593
+ const path128 = getSignalPath();
24594
+ if (!path128 || !existsSync52(path128)) return void 0;
24595
24595
  try {
24596
- return JSON.parse(readFileSync35(path126, "utf8"));
24596
+ return JSON.parse(readFileSync35(path128, "utf8"));
24597
24597
  } catch {
24598
24598
  return void 0;
24599
24599
  }
@@ -24805,13 +24805,13 @@ function activityPath(sessionId2) {
24805
24805
  function emitActivity(activity2) {
24806
24806
  const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
24807
24807
  if (!sessionId2) return;
24808
- const path126 = activityPath(sessionId2);
24809
- mkdirSync18(dirname31(path126), { recursive: true });
24810
- writeFileSync27(path126, JSON.stringify({ ...activity2, startedAt: Date.now() }));
24808
+ const path128 = activityPath(sessionId2);
24809
+ mkdirSync18(dirname31(path128), { recursive: true });
24810
+ writeFileSync27(path128, JSON.stringify({ ...activity2, startedAt: Date.now() }));
24811
24811
  }
24812
- function readActivity(path126) {
24812
+ function readActivity(path128) {
24813
24813
  try {
24814
- return JSON.parse(readFileSync36(path126, "utf8"));
24814
+ return JSON.parse(readFileSync36(path128, "utf8"));
24815
24815
  } catch {
24816
24816
  return void 0;
24817
24817
  }
@@ -24821,15 +24821,15 @@ function reconcileActivity(sessionId2, activity2) {
24821
24821
  removeActivity(sessionId2);
24822
24822
  return;
24823
24823
  }
24824
- const path126 = activityPath(sessionId2);
24825
- mkdirSync18(dirname31(path126), { recursive: true });
24826
- writeFileSync27(path126, JSON.stringify(activity2));
24824
+ const path128 = activityPath(sessionId2);
24825
+ mkdirSync18(dirname31(path128), { recursive: true });
24826
+ writeFileSync27(path128, JSON.stringify(activity2));
24827
24827
  }
24828
24828
  function writeActivityIfAbsent(sessionId2, activity2) {
24829
- const path126 = activityPath(sessionId2);
24830
- mkdirSync18(dirname31(path126), { recursive: true });
24829
+ const path128 = activityPath(sessionId2);
24830
+ mkdirSync18(dirname31(path128), { recursive: true });
24831
24831
  try {
24832
- writeFileSync27(path126, JSON.stringify(activity2), { flag: "wx" });
24832
+ writeFileSync27(path128, JSON.stringify(activity2), { flag: "wx" });
24833
24833
  return true;
24834
24834
  } catch (error) {
24835
24835
  if (error.code === "EEXIST") return false;
@@ -27197,9 +27197,9 @@ function isGhGraphqlIssueMutation(command) {
27197
27197
  (m) => ISSUE_MUTATION.test(readOrEmpty(m[1]))
27198
27198
  );
27199
27199
  }
27200
- function readOrEmpty(path126) {
27200
+ function readOrEmpty(path128) {
27201
27201
  try {
27202
- return readFileSync37(path126, "utf8");
27202
+ return readFileSync37(path128, "utf8");
27203
27203
  } catch {
27204
27204
  return "";
27205
27205
  }
@@ -27336,13 +27336,13 @@ function findBuiltinDenyRaw(rawCommand) {
27336
27336
 
27337
27337
  // src/commands/cliHook/findRestrictedPathDeny.ts
27338
27338
  var RESTRICTED_PATHS = [".assist/restricted"];
27339
- function restrictedPathRegex(path126) {
27340
- const pattern2 = path126.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
27339
+ function restrictedPathRegex(path128) {
27340
+ const pattern2 = path128.split("/").map((segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`)).join(String.raw`[/\\]`);
27341
27341
  return new RegExp(pattern2);
27342
27342
  }
27343
- var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path126) => ({
27344
- path: path126,
27345
- regex: restrictedPathRegex(path126)
27343
+ var RESTRICTED_PATH_RULES = RESTRICTED_PATHS.map((path128) => ({
27344
+ path: path128,
27345
+ regex: restrictedPathRegex(path128)
27346
27346
  }));
27347
27347
  function findRestrictedPathDenyRaw(rawCommand) {
27348
27348
  const rule = RESTRICTED_PATH_RULES.find(
@@ -27562,9 +27562,9 @@ var __dirname4 = dirname32(__filename3);
27562
27562
  function packageRoot() {
27563
27563
  return __dirname4;
27564
27564
  }
27565
- function readLines(path126) {
27566
- if (!existsSync55(path126)) return [];
27567
- return readFileSync38(path126, "utf8").split("\n").filter((line) => line.trim() !== "");
27565
+ function readLines(path128) {
27566
+ if (!existsSync55(path128)) return [];
27567
+ return readFileSync38(path128, "utf8").split("\n").filter((line) => line.trim() !== "");
27568
27568
  }
27569
27569
  var cachedReads;
27570
27570
  var cachedWrites;
@@ -27906,9 +27906,9 @@ import { relative as relative8, resolve as resolve21 } from "path";
27906
27906
  var SCHEMA_LOCK_REASON = "Database schema files (src/shared/db/migrations/migrationNNNN*.ts, src/shared/db/migrations.ts, src/shared/db/schema.ts and any src/shared/db/*.ts that defines a pgTable) are locked: a schema change needs the user's sign-off (see src/shared/db/CLAUDE.md). Confirm the schema change with the user first, then run `assist schema unlock` to request a PIN and wait for the user to confirm it with `assist schema confirm <pin>` before retrying. In a backlog item session the unlock lasts for the current phase on this harness; otherwise it lasts for this conversation only.";
27907
27907
  var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
27908
27908
  var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
27909
- function readOrEmpty2(path126) {
27909
+ function readOrEmpty2(path128) {
27910
27910
  try {
27911
- return readFileSync40(path126, "utf8");
27911
+ return readFileSync40(path128, "utf8");
27912
27912
  } catch {
27913
27913
  return "";
27914
27914
  }
@@ -27976,9 +27976,9 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
27976
27976
 
27977
27977
  // src/commands/editHook/decideDocsGuard.ts
27978
27978
  async function decideDocsGuard({
27979
- path: path126
27979
+ path: path128
27980
27980
  }) {
27981
- if (!isDocsPath(path126)) return void 0;
27981
+ if (!isDocsPath(path128)) return void 0;
27982
27982
  return await isDocsLocked() ? DOCS_LOCK_REASON : void 0;
27983
27983
  }
27984
27984
 
@@ -28012,10 +28012,10 @@ function getSchemaSessionApprovalPath(scope) {
28012
28012
  }
28013
28013
 
28014
28014
  // src/commands/schema/isSchemaLocked.ts
28015
- function approvalMatches(path126, identity) {
28015
+ function approvalMatches(path128, identity) {
28016
28016
  try {
28017
28017
  const approval = JSON.parse(
28018
- readFileSync41(path126, "utf8")
28018
+ readFileSync41(path128, "utf8")
28019
28019
  );
28020
28020
  const conversation = approval.conversationId ?? approval.claudeSessionId;
28021
28021
  if (approval.harness !== void 0 && approval.harness !== identity.harness)
@@ -28028,8 +28028,8 @@ function approvalMatches(path126, identity) {
28028
28028
  function hasSessionApproval(identity) {
28029
28029
  const { harness, conversationId } = identity;
28030
28030
  if (!conversationId) return false;
28031
- const path126 = getSchemaSessionApprovalPath({ harness, conversationId });
28032
- return path126 !== void 0 && existsSync57(path126) && approvalMatches(path126, identity);
28031
+ const path128 = getSchemaSessionApprovalPath({ harness, conversationId });
28032
+ return path128 !== void 0 && existsSync57(path128) && approvalMatches(path128, identity);
28033
28033
  }
28034
28034
  async function isSchemaLocked(identity = currentExecutionIdentity()) {
28035
28035
  if (!identity) return false;
@@ -28049,8 +28049,8 @@ async function isSchemaLocked(identity = currentExecutionIdentity()) {
28049
28049
  }
28050
28050
 
28051
28051
  // src/commands/editHook/decideSchemaGuard.ts
28052
- async function decideSchemaGuard({ path: path126, contents }, identity) {
28053
- if (!isSchemaPath(path126, contents)) return void 0;
28052
+ async function decideSchemaGuard({ path: path128, contents }, identity) {
28053
+ if (!isSchemaPath(path128, contents)) return void 0;
28054
28054
  return await isSchemaLocked(identity) ? SCHEMA_LOCK_REASON : void 0;
28055
28055
  }
28056
28056
 
@@ -28343,14 +28343,14 @@ function showProgress(p, label) {
28343
28343
  const pct = Math.round(p.done / p.total * 100);
28344
28344
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label}...`);
28345
28345
  }
28346
- async function resolveCommand2(cli, path126, description, depth, p) {
28347
- showProgress(p, path126.join(" "));
28348
- const subHelp = await runHelp([cli, ...path126]);
28346
+ async function resolveCommand2(cli, path128, description, depth, p) {
28347
+ showProgress(p, path128.join(" "));
28348
+ const subHelp = await runHelp([cli, ...path128]);
28349
28349
  if (!subHelp || !hasSubcommands(subHelp)) {
28350
- return [{ path: path126, description }];
28350
+ return [{ path: path128, description }];
28351
28351
  }
28352
- const children = await discoverAt(cli, path126, depth + 1, p);
28353
- return children.length > 0 ? children : [{ path: path126, description }];
28352
+ const children = await discoverAt(cli, path128, depth + 1, p);
28353
+ return children.length > 0 ? children : [{ path: path128, description }];
28354
28354
  }
28355
28355
  async function discoverAt(cli, parentPath, depth, p) {
28356
28356
  if (depth > SAFETY_DEPTH) return [];
@@ -28498,9 +28498,9 @@ function logPath(cli) {
28498
28498
  return join68(homedir22(), ".assist", `cli-discover-${safeName}.log`);
28499
28499
  }
28500
28500
  function readCache(cli) {
28501
- const path126 = logPath(cli);
28502
- if (!existsSync58(path126)) return void 0;
28503
- return readFileSync42(path126, "utf8");
28501
+ const path128 = logPath(cli);
28502
+ if (!existsSync58(path128)) return void 0;
28503
+ return readFileSync42(path128, "utf8");
28504
28504
  }
28505
28505
  function writeCache(cli, output) {
28506
28506
  const dir = join68(homedir22(), ".assist");
@@ -28680,9 +28680,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
28680
28680
  }
28681
28681
  const cutoff = Date.now() - STALE_AFTER_MS;
28682
28682
  for (const entry of entries) {
28683
- const path126 = join69(dir, entry);
28683
+ const path128 = join69(dir, entry);
28684
28684
  try {
28685
- if (statSync11(path126).mtimeMs < cutoff) unlinkSync8(path126);
28685
+ if (statSync11(path128).mtimeMs < cutoff) unlinkSync8(path128);
28686
28686
  } catch {
28687
28687
  continue;
28688
28688
  }
@@ -28692,10 +28692,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
28692
28692
  // src/commands/codeComment/readPinState.ts
28693
28693
  import { existsSync as existsSync59, readFileSync as readFileSync43 } from "fs";
28694
28694
  function readPinState(pin2) {
28695
- const path126 = getPinStatePath(pin2);
28696
- if (!existsSync59(path126)) return void 0;
28695
+ const path128 = getPinStatePath(pin2);
28696
+ if (!existsSync59(path128)) return void 0;
28697
28697
  try {
28698
- const state = JSON.parse(readFileSync43(path126, "utf8"));
28698
+ const state = JSON.parse(readFileSync43(path128, "utf8"));
28699
28699
  if (state.pin !== pin2) return void 0;
28700
28700
  return state;
28701
28701
  } catch {
@@ -29153,17 +29153,17 @@ function routeCodexRpcLine(line, pending) {
29153
29153
  }
29154
29154
 
29155
29155
  // src/commands/sync/watchCodexAppServer.ts
29156
- function watchCodexAppServer(child2, fail15) {
29156
+ function watchCodexAppServer(child2, fail14) {
29157
29157
  let stderr = "";
29158
29158
  child2.stderr.on("data", (chunk2) => {
29159
29159
  stderr += chunk2;
29160
29160
  });
29161
- child2.on("error", fail15);
29161
+ child2.on("error", fail14);
29162
29162
  child2.stdin.on("error", () => {
29163
29163
  });
29164
29164
  child2.on(
29165
29165
  "exit",
29166
- (code) => fail15(
29166
+ (code) => fail14(
29167
29167
  new Error(
29168
29168
  `codex app-server exited (${code})${stderr.trim() ? `: ${stderr.trim()}` : ""}`
29169
29169
  )
@@ -29435,8 +29435,8 @@ function findUnmergedPaths() {
29435
29435
  }
29436
29436
  const found = /* @__PURE__ */ new Set();
29437
29437
  for (const line of output.split("\n")) {
29438
- const path126 = line.split(" ")[1];
29439
- if (path126) found.add(path126.trim());
29438
+ const path128 = line.split(" ")[1];
29439
+ if (path128) found.add(path128.trim());
29440
29440
  }
29441
29441
  return [...found];
29442
29442
  }
@@ -30628,8 +30628,8 @@ function diffRepoConfigLeaves(current2, incoming) {
30628
30628
  }
30629
30629
  function leaves(node, prefix2 = "") {
30630
30630
  return Object.entries(node).flatMap(([key, value]) => {
30631
- const path126 = prefix2 ? `${prefix2}.${key}` : key;
30632
- return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path126) : [[path126, value]];
30631
+ const path128 = prefix2 ? `${prefix2}.${key}` : key;
30632
+ return isPlainObject4(value) && Object.keys(value).length > 0 ? leaves(value, path128) : [[path128, value]];
30633
30633
  });
30634
30634
  }
30635
30635
  function isPlainObject4(value) {
@@ -31260,10 +31260,10 @@ async function browserSnapshot(options2) {
31260
31260
  op: "snapshot",
31261
31261
  url: options2.url
31262
31262
  });
31263
- const path126 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
31264
- mkdirSync22(dirname35(path126), { recursive: true });
31265
- writeFileSync32(path126, result.html);
31266
- console.log(`snapshot: ${path126}`);
31263
+ const path128 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
31264
+ mkdirSync22(dirname35(path128), { recursive: true });
31265
+ writeFileSync32(path128, result.html);
31266
+ console.log(`snapshot: ${path128}`);
31267
31267
  }
31268
31268
 
31269
31269
  // src/commands/browser/formatExtensionUpdate.ts
@@ -31438,9 +31438,9 @@ async function loadPath(source) {
31438
31438
  }
31439
31439
  }
31440
31440
  async function extension() {
31441
- const path126 = await loadPath(extensionDir());
31441
+ const path128 = await loadPath(extensionDir());
31442
31442
  console.log(chalk155.bold("assist \u2014 GitHub browser extension"));
31443
- console.log(chalk155.dim(`load the unpacked extension from ${path126}`));
31443
+ console.log(chalk155.dim(`load the unpacked extension from ${path128}`));
31444
31444
  }
31445
31445
 
31446
31446
  // src/commands/extension/printExtensionUrl.ts
@@ -31535,7 +31535,7 @@ async function stageExtension(source, staging, version2) {
31535
31535
  await mkdir5(staging, { recursive: true });
31536
31536
  await cp3(source, staging, {
31537
31537
  recursive: true,
31538
- filter: (path126) => basename18(path126) !== "updates.json"
31538
+ filter: (path128) => basename18(path128) !== "updates.json"
31539
31539
  });
31540
31540
  const manifest = join76(staging, "manifest.json");
31541
31541
  const stamped = stampManifestVersion(
@@ -31616,10 +31616,10 @@ async function signExtension() {
31616
31616
  return;
31617
31617
  }
31618
31618
  await writeUpdateManifest(source, ARTIFACTS_DIR, version2);
31619
- const path126 = await signedAddonInstallPath(
31619
+ const path128 = await signedAddonInstallPath(
31620
31620
  await copySignedXpi(xpi, ARTIFACTS_DIR)
31621
31621
  );
31622
- console.log(chalk158.dim(`install the signed add-on from ${path126}`));
31622
+ console.log(chalk158.dim(`install the signed add-on from ${path128}`));
31623
31623
  }
31624
31624
 
31625
31625
  // src/commands/registerExtension.ts
@@ -31885,17 +31885,17 @@ function devEntryPath(repoName, week, devDir) {
31885
31885
  function asString(value) {
31886
31886
  return value === void 0 || value === null ? null : String(value);
31887
31887
  }
31888
- function readFrontmatter(path126) {
31888
+ function readFrontmatter(path128) {
31889
31889
  try {
31890
- const match = readFileSync48(path126, "utf8").match(/^---\n([\s\S]*?)\n---/);
31890
+ const match = readFileSync48(path128, "utf8").match(/^---\n([\s\S]*?)\n---/);
31891
31891
  return match ? parseYaml3(match[1]) ?? {} : null;
31892
31892
  } catch {
31893
31893
  return null;
31894
31894
  }
31895
31895
  }
31896
31896
  function loadDevEntry(repoName, week, devDir) {
31897
- const path126 = devEntryPath(repoName, week, devDir);
31898
- const frontmatter2 = readFrontmatter(path126);
31897
+ const path128 = devEntryPath(repoName, week, devDir);
31898
+ const frontmatter2 = readFrontmatter(path128);
31899
31899
  if (!frontmatter2) return null;
31900
31900
  const versions = frontmatter2.versions;
31901
31901
  return {
@@ -32291,11 +32291,11 @@ function fail7(message4) {
32291
32291
  console.error(chalk168.red(message4));
32292
32292
  process.exit(1);
32293
32293
  }
32294
- function readEntry(path126) {
32294
+ function readEntry(path128) {
32295
32295
  try {
32296
- return readFileSync50(path126, "utf8");
32296
+ return readFileSync50(path128, "utf8");
32297
32297
  } catch {
32298
- fail7(`No dev entry at ${path126}`);
32298
+ fail7(`No dev entry at ${path128}`);
32299
32299
  }
32300
32300
  }
32301
32301
  function resolveValue(permalink, skipped) {
@@ -32312,11 +32312,11 @@ function resolveValue(permalink, skipped) {
32312
32312
  function posted(week, permalink, options2 = {}) {
32313
32313
  if (!isValidWeek(week)) fail7("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
32314
32314
  const value = resolveValue(permalink, options2.skip === true);
32315
- const path126 = devEntryPath(getRepoName(), week, resolveDevDir());
32316
- const updated2 = setFrontmatterSlack(readEntry(path126), value);
32317
- if (updated2 === null) fail7(`${path126} has no YAML frontmatter`);
32318
- writeFileSync34(path126, updated2);
32319
- console.log(chalk168.green(`Recorded slack: ${value} in ${path126}`));
32315
+ const path128 = devEntryPath(getRepoName(), week, resolveDevDir());
32316
+ const updated2 = setFrontmatterSlack(readEntry(path128), value);
32317
+ if (updated2 === null) fail7(`${path128} has no YAML frontmatter`);
32318
+ writeFileSync34(path128, updated2);
32319
+ console.log(chalk168.green(`Recorded slack: ${value} in ${path128}`));
32320
32320
  }
32321
32321
 
32322
32322
  // src/commands/devlog/skip.ts
@@ -32443,7 +32443,7 @@ async function previewSlackThreadParts({
32443
32443
  `Approved for ${target}. The ${bodies.length} bodies to post, in thread order, are at:`
32444
32444
  );
32445
32445
  paths.forEach(
32446
- (path126, index3) => console.log(`${index3 + 1}/${paths.length} ${path126}`)
32446
+ (path128, index3) => console.log(`${index3 + 1}/${paths.length} ${path128}`)
32447
32447
  );
32448
32448
  console.log(
32449
32449
  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.`
@@ -32504,10 +32504,10 @@ function devlogSlackChannel() {
32504
32504
  import { readFileSync as readFileSync52 } from "fs";
32505
32505
  import { parse as parseYaml4 } from "yaml";
32506
32506
  var FRONTMATTER2 = /^---\n([\s\S]*?)\n---\n?([\s\S]*)$/;
32507
- function readDevEntryFile(path126) {
32507
+ function readDevEntryFile(path128) {
32508
32508
  let contents;
32509
32509
  try {
32510
- contents = readFileSync52(path126, "utf8");
32510
+ contents = readFileSync52(path128, "utf8");
32511
32511
  } catch {
32512
32512
  return null;
32513
32513
  }
@@ -32645,9 +32645,9 @@ async function slack2(week) {
32645
32645
  }
32646
32646
  if (!isValidWeek(week)) fail8("Invalid week. Use YYYY-Www (e.g. 2026-W33)");
32647
32647
  const channel = devlogSlackChannel();
32648
- const path126 = devEntryPath(repoName, week, devDir);
32649
- const entry = readDevEntryFile(path126);
32650
- if (!entry) fail8(`No dev entry for ${week} at ${path126}`);
32648
+ const path128 = devEntryPath(repoName, week, devDir);
32649
+ const entry = readDevEntryFile(path128);
32650
+ if (!entry) fail8(`No dev entry for ${week} at ${path128}`);
32651
32651
  if (entry.slack) fail8(`${week} is already posted: slack: ${entry.slack}`);
32652
32652
  const parts2 = renderDevlogSlackParts(
32653
32653
  entry,
@@ -32757,10 +32757,10 @@ async function write() {
32757
32757
  }
32758
32758
  const devDir = resolveDevDir();
32759
32759
  const repoName = getRepoName();
32760
- const path126 = devEntryPath(repoName, result.data.week, devDir);
32761
- mkdirSync26(dirname36(path126), { recursive: true });
32762
- writeFileSync38(path126, formatDevEntry(repoName, result.data));
32763
- console.log(chalk171.green(`Wrote ${path126}`));
32760
+ const path128 = devEntryPath(repoName, result.data.week, devDir);
32761
+ mkdirSync26(dirname36(path128), { recursive: true });
32762
+ writeFileSync38(path128, formatDevEntry(repoName, result.data));
32763
+ console.log(chalk171.green(`Wrote ${path128}`));
32764
32764
  }
32765
32765
 
32766
32766
  // src/commands/devlog/registerDevlogEntryCommands.ts
@@ -32966,10 +32966,10 @@ function isPositiveInteger(value) {
32966
32966
  return Number.isInteger(value) && value > 0;
32967
32967
  }
32968
32968
  function readDocsUnlockPinState(pin2) {
32969
- const path126 = getDocsUnlockPinPath(pin2);
32970
- if (!existsSync66(path126)) return void 0;
32969
+ const path128 = getDocsUnlockPinPath(pin2);
32970
+ if (!existsSync66(path128)) return void 0;
32971
32971
  try {
32972
- const state = JSON.parse(readFileSync53(path126, "utf8"));
32972
+ const state = JSON.parse(readFileSync53(path128, "utf8"));
32973
32973
  if (state.pin !== pin2) return void 0;
32974
32974
  if (!isPositiveInteger(state.itemId)) return void 0;
32975
32975
  if (!isPositiveInteger(state.phase)) return void 0;
@@ -33023,15 +33023,15 @@ async function issueUnlockPin({
33023
33023
  const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
33024
33024
  mkdirSync27(getRestrictedDir(), { recursive: true });
33025
33025
  sweepRestrictedDir();
33026
- const path126 = pinPath(pin2);
33027
- writeFileSync39(path126, JSON.stringify({ ...state, pin: pin2 }));
33026
+ const path128 = pinPath(pin2);
33027
+ writeFileSync39(path128, JSON.stringify({ ...state, pin: pin2 }));
33028
33028
  const delivery = await deliverPinNotification({
33029
33029
  area,
33030
33030
  pin: pin2,
33031
33031
  title: `assist ${area} unlock: ${label}`,
33032
33032
  message: `Pin ${pin2} \u2014 run: assist ${area} confirm ${pin2}`
33033
33033
  });
33034
- if (!delivery.delivered) unlinkSync11(path126);
33034
+ if (!delivery.delivered) unlinkSync11(path128);
33035
33035
  return delivery;
33036
33036
  }
33037
33037
 
@@ -33129,10 +33129,10 @@ async function approveItemPhase({
33129
33129
  }
33130
33130
  function approveSession({ harness, conversationId }) {
33131
33131
  const scope = { harness, conversationId };
33132
- const path126 = getSchemaSessionApprovalPath(scope);
33133
- if (!path126) return;
33132
+ const path128 = getSchemaSessionApprovalPath(scope);
33133
+ if (!path128) return;
33134
33134
  mkdirSync28(getSchemaSessionApprovalDir(), { recursive: true });
33135
- writeFileSync40(path126, JSON.stringify(scope));
33135
+ writeFileSync40(path128, JSON.stringify(scope));
33136
33136
  console.log(
33137
33137
  chalk177.green(
33138
33138
  `Approved schema changes for ${schemaHarnessLabel(harness)} session ${conversationId}. It may edit and commit database schema files until the session ends.`
@@ -33175,10 +33175,10 @@ function toState(raw) {
33175
33175
  return sessionState(raw);
33176
33176
  }
33177
33177
  function readSchemaUnlockPinState(pin2) {
33178
- const path126 = getSchemaUnlockPinPath(pin2);
33179
- if (!existsSync67(path126)) return void 0;
33178
+ const path128 = getSchemaUnlockPinPath(pin2);
33179
+ if (!existsSync67(path128)) return void 0;
33180
33180
  try {
33181
- const raw = JSON.parse(readFileSync54(path126, "utf8"));
33181
+ const raw = JSON.parse(readFileSync54(path128, "utf8"));
33182
33182
  if (raw.pin !== pin2) return void 0;
33183
33183
  return toState(raw);
33184
33184
  } catch {
@@ -35555,8 +35555,8 @@ function collectLabels(value, previous) {
35555
35555
  import { extname as extname3 } from "path";
35556
35556
 
35557
35557
  // src/commands/prs/screenshotReference.ts
35558
- function screenshotReference({ path: path126, alt }) {
35559
- const target = /\s/.test(path126) ? `<${path126}>` : path126;
35558
+ function screenshotReference({ path: path128, alt }) {
35559
+ const target = /\s/.test(path128) ? `<${path128}>` : path128;
35560
35560
  return `![${alt}](${target})`;
35561
35561
  }
35562
35562
 
@@ -36013,7 +36013,7 @@ async function reviewProposedIssue(title, body, metadata2 = []) {
36013
36013
 
36014
36014
  // src/commands/prs/attachArgs.ts
36015
36015
  function attachArgs(attachments) {
36016
- return attachments.flatMap(({ path: path126 }) => ["--attach", path126]);
36016
+ return attachments.flatMap(({ path: path128 }) => ["--attach", path128]);
36017
36017
  }
36018
36018
 
36019
36019
  // src/commands/prs/runGhWithAttachments.ts
@@ -36024,8 +36024,8 @@ import { basename as basename20 } from "path";
36024
36024
  import { rmSync as rmSync5 } from "fs";
36025
36025
  import { dirname as dirname38 } from "path";
36026
36026
  function removeStagedAttachments(attachments) {
36027
- for (const { path: path126 } of attachments) {
36028
- const dir = dirname38(path126);
36027
+ for (const { path: path128 } of attachments) {
36028
+ const dir = dirname38(path128);
36029
36029
  if (!isStagedAttachmentPath(dir)) continue;
36030
36030
  rmSync5(dir, { recursive: true, force: true });
36031
36031
  }
@@ -36035,7 +36035,7 @@ function removeStagedAttachments(attachments) {
36035
36035
  var PLACED_URL = /https:\/\/\S+\/(pull|issues)\/\d+/;
36036
36036
  function reportPartialFailure(attachments, stderr) {
36037
36037
  const failed3 = attachments.filter(
36038
- ({ path: path126 }) => stderr.includes(path126) || stderr.includes(basename20(path126))
36038
+ ({ path: path128 }) => stderr.includes(path128) || stderr.includes(basename20(path128))
36039
36039
  );
36040
36040
  const named = failed3.length > 0 ? failed3 : attachments;
36041
36041
  console.error(
@@ -37414,13 +37414,13 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
37414
37414
  const registered = new Set(listWorktreePaths(clone));
37415
37415
  const branches = new Set(listLocalBranches(clone));
37416
37416
  const isTaken = (candidate) => registered.has(candidate) || existsSync72(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename22(candidate));
37417
- const path126 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
37418
- const ready = addWorktree(clone, path126, strategy.trunk);
37417
+ const path128 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
37418
+ const ready = addWorktree(clone, path128, strategy.trunk);
37419
37419
  ready.catch(() => {
37420
37420
  });
37421
- return { path: path126, ready };
37421
+ return { path: path128, ready };
37422
37422
  }
37423
- async function addWorktree(clone, path126, trunk) {
37423
+ async function addWorktree(clone, path128, trunk) {
37424
37424
  const fetched = await gitResult(
37425
37425
  clone,
37426
37426
  ["fetch", "--quiet"],
@@ -37436,13 +37436,13 @@ async function addWorktree(clone, path126, trunk) {
37436
37436
  "add",
37437
37437
  start2.track ? "--track" : "--no-track",
37438
37438
  "-b",
37439
- basename22(path126),
37440
- path126,
37439
+ basename22(path128),
37440
+ path128,
37441
37441
  start2.ref
37442
37442
  ]);
37443
- recordWorktree(path126, clone, getCachedOrigin(clone));
37443
+ recordWorktree(path128, clone, getCachedOrigin(clone));
37444
37444
  daemonLog(
37445
- start2.track ? `worktree allocated ${path126} (branch ${basename22(path126)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path126} (branch ${basename22(path126)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
37445
+ start2.track ? `worktree allocated ${path128} (branch ${basename22(path128)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path128} (branch ${basename22(path128)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
37446
37446
  );
37447
37447
  }
37448
37448
 
@@ -37487,16 +37487,16 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
37487
37487
  `worktree.enabled is off for ${repoRoot3}, so every session shares this tree`
37488
37488
  );
37489
37489
  const clone = canonicalTreePath(mainWorktree(repoRoot3) ?? repoRoot3);
37490
- const { path: path126, ready } = createWorktree(
37490
+ const { path: path128, ready } = createWorktree(
37491
37491
  clone,
37492
37492
  { root: cfg.root, trunk: cfg.trunk },
37493
37493
  boundTreeRoots2,
37494
37494
  options2.replacesTree
37495
37495
  );
37496
37496
  daemonLog(
37497
- `session spilled out of the clone ${clone} into ${path126}: worktree.enabled is on, so every session gets its own worktree`
37497
+ `session spilled out of the clone ${clone} into ${path128}: worktree.enabled is on, so every session gets its own worktree`
37498
37498
  );
37499
- return { cwd: path126, kind: "worktree", created: true, clone, ready };
37499
+ return { cwd: path128, kind: "worktree", created: true, clone, ready };
37500
37500
  }
37501
37501
 
37502
37502
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -38033,12 +38033,12 @@ async function reportCwdToDaemon(cwd) {
38033
38033
 
38034
38034
  // src/commands/sessions/daemon/worktree/worktreeWithBranch.ts
38035
38035
  function worktreeWithBranch(listing, branch2) {
38036
- let path126 = null;
38036
+ let path128 = null;
38037
38037
  for (const line of listing.split("\n")) {
38038
38038
  const trimmed = line.trim();
38039
38039
  if (trimmed.startsWith("worktree "))
38040
- path126 = trimmed.slice("worktree ".length).trim();
38041
- else if (trimmed === `branch refs/heads/${branch2}`) return path126;
38040
+ path128 = trimmed.slice("worktree ".length).trim();
38041
+ else if (trimmed === `branch refs/heads/${branch2}`) return path128;
38042
38042
  }
38043
38043
  return null;
38044
38044
  }
@@ -38048,8 +38048,8 @@ function worktreeHoldingBranch(cwd, branch2) {
38048
38048
  const listing = gitSyncOrNull(cwd, ["worktree", "list", "--porcelain"]);
38049
38049
  if (!listing) return null;
38050
38050
  const here = gitSyncOrNull(cwd, ["rev-parse", "--show-toplevel"]);
38051
- const path126 = worktreeWithBranch(listing, branch2);
38052
- return path126 && path126 !== here ? path126 : null;
38051
+ const path128 = worktreeWithBranch(listing, branch2);
38052
+ return path128 && path128 !== here ? path128 : null;
38053
38053
  }
38054
38054
 
38055
38055
  // src/commands/review/failCheckout.ts
@@ -39271,9 +39271,9 @@ function parseRscRows(flight) {
39271
39271
  }
39272
39272
  function makeRscResolver(rows) {
39273
39273
  return (ref) => {
39274
- const [id, ...path126] = ref.slice(1).replace(/^[L@]/, "").split(":");
39274
+ const [id, ...path128] = ref.slice(1).replace(/^[L@]/, "").split(":");
39275
39275
  let v = rows[id];
39276
- for (const key of path126) {
39276
+ for (const key of path128) {
39277
39277
  if (v == null || typeof v !== "object") return void 0;
39278
39278
  v = v[key];
39279
39279
  }
@@ -40062,18 +40062,18 @@ function validateLine(line) {
40062
40062
  process.exit(1);
40063
40063
  }
40064
40064
  }
40065
- async function comment2(path126, line, body, options2 = {}) {
40065
+ async function comment2(path128, line, body, options2 = {}) {
40066
40066
  const { startLine, skipPreview } = options2;
40067
40067
  validateBody(body);
40068
40068
  validateLine(line);
40069
40069
  if (startLine !== void 0) validateLine(startLine);
40070
40070
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
40071
40071
  if (!skipPreview)
40072
- await reviewProposedPrComment(`Comment on ${path126}:${range}`, body, null);
40072
+ await reviewProposedPrComment(`Comment on ${path128}:${range}`, body, null);
40073
40073
  try {
40074
40074
  const prId = getCurrentPrNodeId();
40075
- postReviewComment({ prId, body, path: path126, line, startLine });
40076
- console.log(`Added review comment on ${path126}:${range}`);
40075
+ postReviewComment({ prId, body, path: path128, line, startLine });
40076
+ console.log(`Added review comment on ${path128}:${range}`);
40077
40077
  } catch (error) {
40078
40078
  if (isGhNotInstalled(error)) {
40079
40079
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -40912,9 +40912,9 @@ function registerPrsComments(prsCommand) {
40912
40912
  internalCommand(
40913
40913
  prsCommand.command("comment <path> <line> <body>").description(
40914
40914
  "Add a line comment to the pending review (body of - reads it from stdin)"
40915
- ).action(async (path126, line, body) => {
40915
+ ).action(async (path128, line, body) => {
40916
40916
  await comment2(
40917
- path126,
40917
+ path128,
40918
40918
  Number.parseInt(line, 10),
40919
40919
  await readBodyArgument(body)
40920
40920
  );
@@ -41042,9 +41042,9 @@ function splitOnce(value, separator) {
41042
41042
  if (index3 === -1) return null;
41043
41043
  return [value.slice(0, index3), value.slice(index3 + separator.length)];
41044
41044
  }
41045
- function isFile2(path126) {
41045
+ function isFile2(path128) {
41046
41046
  try {
41047
- return statSync13(path126).isFile();
41047
+ return statSync13(path128).isFile();
41048
41048
  } catch {
41049
41049
  return false;
41050
41050
  }
@@ -41052,16 +41052,16 @@ function isFile2(path126) {
41052
41052
  function parseScreenshotSpec(spec) {
41053
41053
  const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
41054
41054
  const [group, caption] = splitOnce(label, "/") ?? ["", label];
41055
- const path126 = resolve27(rawPath.trim());
41056
- const ext = extname5(path126).replace(/^\./, "").toLowerCase();
41057
- if (!isFile2(path126))
41058
- throw new Error(`--screenshot '${spec}': file not found: ${path126}`);
41055
+ const path128 = resolve27(rawPath.trim());
41056
+ const ext = extname5(path128).replace(/^\./, "").toLowerCase();
41057
+ if (!isFile2(path128))
41058
+ throw new Error(`--screenshot '${spec}': file not found: ${path128}`);
41059
41059
  if (!ghAttachableExtensions.has(ext))
41060
41060
  throw new Error(
41061
41061
  `--screenshot '${spec}': gh cannot attach .${ext || "(none)"} files (supported: ${[...ghAttachableExtensions].join(", ")}).`
41062
41062
  );
41063
- const alt = caption.trim() || basename24(path126, extname5(path126));
41064
- return group.trim() ? { path: path126, alt, group: group.trim() } : { path: path126, alt };
41063
+ const alt = caption.trim() || basename24(path128, extname5(path128));
41064
+ return group.trim() ? { path: path128, alt, group: group.trim() } : { path: path128, alt };
41065
41065
  }
41066
41066
 
41067
41067
  // src/commands/prs/parseScreenshotSpecs.ts
@@ -42236,11 +42236,11 @@ async function loadBody(target) {
42236
42236
  if (target.kind === "file") return readDraftFile(target.path);
42237
42237
  return fetchPrBody(target.number, target.repo);
42238
42238
  }
42239
- function readDraftFile(path126) {
42239
+ function readDraftFile(path128) {
42240
42240
  try {
42241
- return readFileSync64(path126, "utf8");
42241
+ return readFileSync64(path128, "utf8");
42242
42242
  } catch {
42243
- console.error(`Error: Could not read \`${path126}\`.`);
42243
+ console.error(`Error: Could not read \`${path128}\`.`);
42244
42244
  console.error(
42245
42245
  "Pass a pull request number, a GitHub pull request URL, - for stdin, or a path to a file."
42246
42246
  );
@@ -42520,10 +42520,10 @@ function resolveOpSecret(reference) {
42520
42520
  }
42521
42521
 
42522
42522
  // src/commands/ravendb/ravenFetch.ts
42523
- async function ravenFetch(connection, path126) {
42523
+ async function ravenFetch(connection, path128) {
42524
42524
  const apiKey = resolveOpSecret(connection.apiKeyRef);
42525
42525
  let accessToken = await getAccessToken(apiKey);
42526
- const url = `${connection.url}${path126}`;
42526
+ const url = `${connection.url}${path128}`;
42527
42527
  const headers = {
42528
42528
  Authorization: `Bearer ${accessToken}`,
42529
42529
  "Content-Type": "application/json"
@@ -42613,16 +42613,16 @@ import chalk230 from "chalk";
42613
42613
  // src/commands/ravendb/buildQueryPath.ts
42614
42614
  function buildQueryPath(opts) {
42615
42615
  const db = encodeURIComponent(opts.db);
42616
- let path126;
42616
+ let path128;
42617
42617
  if (opts.collection) {
42618
- path126 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
42618
+ path128 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
42619
42619
  } else {
42620
- path126 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
42620
+ path128 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
42621
42621
  }
42622
42622
  if (opts.query) {
42623
- path126 += `&query=${encodeURIComponent(opts.query)}`;
42623
+ path128 += `&query=${encodeURIComponent(opts.query)}`;
42624
42624
  }
42625
- return path126;
42625
+ return path128;
42626
42626
  }
42627
42627
 
42628
42628
  // src/commands/ravendb/fetchAllPages.ts
@@ -42631,7 +42631,7 @@ async function fetchAllPages(connection, opts) {
42631
42631
  let start2 = 0;
42632
42632
  while (true) {
42633
42633
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
42634
- const path126 = buildQueryPath({
42634
+ const path128 = buildQueryPath({
42635
42635
  db: connection.database,
42636
42636
  collection: opts.collection,
42637
42637
  start: start2,
@@ -42639,7 +42639,7 @@ async function fetchAllPages(connection, opts) {
42639
42639
  sort: opts.sort,
42640
42640
  query: opts.query
42641
42641
  });
42642
- const data = await ravenFetch(connection, path126);
42642
+ const data = await ravenFetch(connection, path128);
42643
42643
  const results = data.Results ?? [];
42644
42644
  const totalResults = data.TotalResults ?? 0;
42645
42645
  if (results.length === 0) break;
@@ -45680,8 +45680,8 @@ function displayLongPaths(longPaths, maxPathLength) {
45680
45680
  Plan exceeds restructure.maxPathLength ${maxPathLength}: ${longPaths.length} repo-relative path(s) longer.`
45681
45681
  )
45682
45682
  );
45683
- for (const { path: path126, length } of longPaths)
45684
- console.log(` ${path126} [${length}]`);
45683
+ for (const { path: path128, length } of longPaths)
45684
+ console.log(` ${path128} [${length}]`);
45685
45685
  }
45686
45686
 
45687
45687
  // src/commands/refactor/restructure/displayLayoutLimits.ts
@@ -46397,8 +46397,8 @@ function groupFilesByDirectory(files) {
46397
46397
  }
46398
46398
 
46399
46399
  // src/commands/review/highLevel/buildHighLevelTree.ts
46400
- function basename26(path126) {
46401
- return path126.slice(path126.lastIndexOf("/") + 1);
46400
+ function basename26(path128) {
46401
+ return path128.slice(path128.lastIndexOf("/") + 1);
46402
46402
  }
46403
46403
  function sum(nodes, key) {
46404
46404
  return nodes.reduce((total2, node) => total2 + node[key], 0);
@@ -46419,19 +46419,19 @@ function nodesOf(at2, prefix2) {
46419
46419
  }
46420
46420
  function collapsedDirNode(name2, at2, prefix2) {
46421
46421
  let label = name2;
46422
- let path126 = prefix2 ? `${prefix2}/${name2}` : name2;
46422
+ let path128 = prefix2 ? `${prefix2}/${name2}` : name2;
46423
46423
  let node = at2;
46424
46424
  while (node.files.length === 0 && node.dirs.size === 1) {
46425
46425
  const [childName, child2] = [...node.dirs][0];
46426
46426
  label = `${label}/${childName}`;
46427
- path126 = `${path126}/${childName}`;
46427
+ path128 = `${path128}/${childName}`;
46428
46428
  node = child2;
46429
46429
  }
46430
- const children = nodesOf(node, path126);
46430
+ const children = nodesOf(node, path128);
46431
46431
  return {
46432
46432
  kind: "dir",
46433
46433
  name: label,
46434
- path: path126,
46434
+ path: path128,
46435
46435
  additions: sum(children, "additions"),
46436
46436
  deletions: sum(children, "deletions"),
46437
46437
  children
@@ -46736,8 +46736,8 @@ function toStatus(status2) {
46736
46736
  if (status2 === "removed") return "removed";
46737
46737
  return "modified";
46738
46738
  }
46739
- function diffUrl(repo, prNumber, path126) {
46740
- const anchor = createHash4("sha256").update(path126).digest("hex");
46739
+ function diffUrl(repo, prNumber, path128) {
46740
+ const anchor = createHash4("sha256").update(path128).digest("hex");
46741
46741
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
46742
46742
  }
46743
46743
  function fetchHighLevelFiles(prNumber, repo) {
@@ -46927,10 +46927,10 @@ function listHighLevelHunks(files) {
46927
46927
 
46928
46928
  // src/commands/review/highLevel/readJsonFile.ts
46929
46929
  import { existsSync as existsSync78, readFileSync as readFileSync67 } from "fs";
46930
- function readJsonFile(path126) {
46931
- if (!existsSync78(path126)) return void 0;
46930
+ function readJsonFile(path128) {
46931
+ if (!existsSync78(path128)) return void 0;
46932
46932
  try {
46933
- return JSON.parse(readFileSync67(path126, "utf8"));
46933
+ return JSON.parse(readFileSync67(path128, "utf8"));
46934
46934
  } catch {
46935
46935
  return void 0;
46936
46936
  }
@@ -47011,11 +47011,11 @@ function resolveHighLevelSlices(raw, hunks) {
47011
47011
  // src/commands/review/highLevel/writeJsonFile.ts
47012
47012
  import { mkdirSync as mkdirSync35, writeFileSync as writeFileSync49 } from "fs";
47013
47013
  import { dirname as dirname47 } from "path";
47014
- function writeJsonFile(path126, data) {
47015
- mkdirSync35(dirname47(path126), { recursive: true });
47016
- writeFileSync49(path126, `${JSON.stringify(data, null, 2)}
47014
+ function writeJsonFile(path128, data) {
47015
+ mkdirSync35(dirname47(path128), { recursive: true });
47016
+ writeFileSync49(path128, `${JSON.stringify(data, null, 2)}
47017
47017
  `);
47018
- return path126;
47018
+ return path128;
47019
47019
  }
47020
47020
 
47021
47021
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
@@ -47028,23 +47028,23 @@ function readSlicesFile(file) {
47028
47028
  );
47029
47029
  }
47030
47030
  }
47031
- function sliceFromFile(file, files, path126) {
47031
+ function sliceFromFile(file, files, path128) {
47032
47032
  const { warnings, ...set } = resolveHighLevelSlices(
47033
47033
  readSlicesFile(file),
47034
47034
  listHighLevelHunks(files)
47035
47035
  );
47036
47036
  for (const warning of warnings) console.warn(`Warning: ${warning}`);
47037
- writeJsonFile(path126, set);
47037
+ writeJsonFile(path128, set);
47038
47038
  return set;
47039
47039
  }
47040
- function readSavedSlices(path126) {
47041
- const saved = readJsonFile(path126);
47040
+ function readSavedSlices(path128) {
47041
+ const saved = readJsonFile(path128);
47042
47042
  return Array.isArray(saved) ? { slices: saved } : saved;
47043
47043
  }
47044
47044
  function gatherHighLevelSlices(head, files, slicing) {
47045
- const path126 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
47046
- if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path126);
47047
- const saved = slicing.force ? void 0 : readSavedSlices(path126);
47045
+ const path128 = highLevelSlicesPath(head.repo, head.headRef, head.headSha);
47046
+ if (slicing.slicesFile) return sliceFromFile(slicing.slicesFile, files, path128);
47047
+ const saved = slicing.force ? void 0 : readSavedSlices(path128);
47048
47048
  if (saved) return saved;
47049
47049
  console.log(formatSlicingRequest(listHighLevelHunks(files)));
47050
47050
  process.exit(2);
@@ -47226,13 +47226,13 @@ function visit(node, context) {
47226
47226
  }
47227
47227
  ];
47228
47228
  }
47229
- function extractTestHierarchy(path126, text18, changed) {
47229
+ function extractTestHierarchy(path128, text18, changed) {
47230
47230
  const project = new Project5({
47231
47231
  useInMemoryFileSystem: true,
47232
47232
  compilerOptions: { allowJs: true }
47233
47233
  });
47234
- const source = project.createSourceFile(`/${path126}`, text18);
47235
- return collect7(source, { path: path126, ...changed ? { changed } : {} });
47234
+ const source = project.createSourceFile(`/${path128}`, text18);
47235
+ return collect7(source, { path: path128, ...changed ? { changed } : {} });
47236
47236
  }
47237
47237
 
47238
47238
  // src/commands/review/highLevel/patchAddedLines.ts
@@ -47254,8 +47254,8 @@ function testFile(file, readSource4) {
47254
47254
  const changed = file.patch === void 0 ? void 0 : patchAddedLines(file.patch);
47255
47255
  const tests = extractTestHierarchy(file.path, readSource4(file.path), changed);
47256
47256
  if (tests.length === 0) return [];
47257
- const { path: path126, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
47258
- return [{ path: path126, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
47257
+ const { path: path128, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
47258
+ return [{ path: path128, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
47259
47259
  }
47260
47260
  function collectHighLevelTests(files, testPaths, readSource4) {
47261
47261
  return files.filter(
@@ -47265,8 +47265,8 @@ function collectHighLevelTests(files, testPaths, readSource4) {
47265
47265
 
47266
47266
  // src/commands/review/highLevel/fetchFileAtSha.ts
47267
47267
  import { execFileSync as execFileSync29 } from "child_process";
47268
- function fetchFileAtSha(repo, sha, path126) {
47269
- const encodedPath = path126.split("/").map(encodeURIComponent).join("/");
47268
+ function fetchFileAtSha(repo, sha, path128) {
47269
+ const encodedPath = path128.split("/").map(encodeURIComponent).join("/");
47270
47270
  try {
47271
47271
  return execFileSync29(
47272
47272
  "gh",
@@ -47284,7 +47284,7 @@ function fetchFileAtSha(repo, sha, path126) {
47284
47284
  );
47285
47285
  } catch (error) {
47286
47286
  throw new Error(
47287
- `Could not read ${path126} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
47287
+ `Could not read ${path128} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
47288
47288
  );
47289
47289
  }
47290
47290
  }
@@ -47295,7 +47295,7 @@ function gatherHighLevelTests(files, testPaths, repo, headSha) {
47295
47295
  collectHighLevelTests(
47296
47296
  files,
47297
47297
  testPaths,
47298
- (path126) => fetchFileAtSha(repo, headSha, path126)
47298
+ (path128) => fetchFileAtSha(repo, headSha, path128)
47299
47299
  )
47300
47300
  );
47301
47301
  }
@@ -47333,8 +47333,8 @@ import { minimatch as minimatch9 } from "minimatch";
47333
47333
  function selectCriticalDiffs(files, criticalPaths) {
47334
47334
  if (criticalPaths.length === 0) return [];
47335
47335
  return files.filter((file) => criticalPaths.some((glob) => minimatch9(file.path, glob))).map(
47336
- ({ path: path126, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
47337
- path: path126,
47336
+ ({ path: path128, status: status2, additions, deletions, diffUrl: diffUrl2, patch: patch2, truncated }) => ({
47337
+ path: path128,
47338
47338
  status: status2,
47339
47339
  additions,
47340
47340
  deletions,
@@ -47539,14 +47539,14 @@ function saveHighLevelReview(record3) {
47539
47539
 
47540
47540
  // src/commands/review/highLevel/formatReviewComment.ts
47541
47541
  function formatReviewComment({
47542
- path: path126,
47542
+ path: path128,
47543
47543
  startLine,
47544
47544
  endLine,
47545
47545
  quote,
47546
47546
  note
47547
47547
  }) {
47548
47548
  const lines = startLine === endLine ? `${startLine}` : `${startLine}-${endLine}`;
47549
- return `- \`${path126}:${lines}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
47549
+ return `- \`${path128}:${lines}\` ${quote}: ${note.replace(/\n/g, "\n ")}`;
47550
47550
  }
47551
47551
 
47552
47552
  // src/commands/review/highLevel/formatHighLevelReviewBody.ts
@@ -48895,8 +48895,8 @@ function fetchExistingComments() {
48895
48895
  // src/commands/review/prepareReviewDir.ts
48896
48896
  import { existsSync as existsSync80, mkdirSync as mkdirSync37, unlinkSync as unlinkSync19, writeFileSync as writeFileSync50 } from "fs";
48897
48897
  function clearReviewFiles(paths) {
48898
- for (const path126 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
48899
- if (existsSync80(path126)) unlinkSync19(path126);
48898
+ for (const path128 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
48899
+ if (existsSync80(path128)) unlinkSync19(path128);
48900
48900
  }
48901
48901
  }
48902
48902
  function prepareReviewDir(paths, requestBody, force) {
@@ -50009,50 +50009,85 @@ function addRule(text18, options2) {
50009
50009
  }
50010
50010
 
50011
50011
  // src/commands/rules/addUserRule.ts
50012
+ import chalk280 from "chalk";
50013
+
50014
+ // src/commands/rules/addToRepoDb.ts
50015
+ import chalk279 from "chalk";
50016
+
50017
+ // src/commands/rules/appendRule.ts
50018
+ function appendRule(current2, rule) {
50019
+ return [...Array.isArray(current2) ? current2 : [], rule];
50020
+ }
50021
+
50022
+ // src/commands/rules/failRule.ts
50012
50023
  import chalk278 from "chalk";
50013
- function fail12(message4) {
50024
+ function failRule(message4) {
50014
50025
  console.error(chalk278.red(message4));
50015
50026
  process.exitCode = 1;
50016
50027
  }
50017
- function asRules(value) {
50018
- return Array.isArray(value) ? value : [];
50028
+
50029
+ // src/commands/rules/addToRepoDb.ts
50030
+ async function addToRepoDb(rule, repo, cwd) {
50031
+ const repoName = typeof repo === "string" ? repo : void 0;
50032
+ const { block } = await resolveSharedRepoBlock(await getDb(), repoName, cwd);
50033
+ const advice = block.advice;
50034
+ const result = await applySharedRepoConfigSet(
50035
+ "advice.rules",
50036
+ appendRule(advice?.rules, rule),
50037
+ repoName,
50038
+ cwd
50039
+ );
50040
+ if (!result.ok) return failRule(result.errors.join("\n"));
50041
+ console.log(
50042
+ `Added ${chalk279.cyan(rule.title)} to advice.rules in repo (db): ${result.label}`
50043
+ );
50019
50044
  }
50020
- function optionsError(options2) {
50021
- if (options2.user && options2.node)
50022
- return "--user writes user (db) and --node writes user (node); pass one";
50045
+
50046
+ // src/commands/rules/userRuleOptionsError.ts
50047
+ function userRuleOptionsError(options2) {
50048
+ const targets = [
50049
+ options2.user && "--user",
50050
+ options2.node && "--node",
50051
+ options2.repo !== void 0 && "--repo"
50052
+ ].filter(Boolean);
50053
+ if (targets.length > 1)
50054
+ return `${targets.join(", ")} each write advice.rules in a different scope (user (db), user (node), repo (db)); pass one`;
50023
50055
  if (options2.scope !== void 0)
50024
- return "--user and --node write advice.rules, not a CLAUDE.md, and cannot be combined with --scope";
50056
+ return `${targets[0]} writes advice.rules, not a CLAUDE.md, and cannot be combined with --scope`;
50025
50057
  return void 0;
50026
50058
  }
50059
+
50060
+ // src/commands/rules/addUserRule.ts
50027
50061
  async function addToUserDb(rule) {
50028
- const result = await applyUserConfigSet("advice.rules", (current2) => [
50029
- ...asRules(current2),
50030
- rule
50031
- ]);
50032
- if (!result.ok) return fail12(result.errors.join("\n"));
50033
- console.log(`Added ${chalk278.cyan(rule.title)} to advice.rules in user (db)`);
50062
+ const result = await applyUserConfigSet(
50063
+ "advice.rules",
50064
+ (current2) => appendRule(current2, rule)
50065
+ );
50066
+ if (!result.ok) return failRule(result.errors.join("\n"));
50067
+ console.log(`Added ${chalk280.cyan(rule.title)} to advice.rules in user (db)`);
50034
50068
  }
50035
50069
  function addToUserNode(rule, globalConfigPath) {
50036
50070
  const advice = loadGlobalConfigRaw(globalConfigPath).advice;
50037
50071
  const result = applyConfigSet(
50038
50072
  "advice.rules",
50039
- [...asRules(advice?.rules), rule],
50073
+ appendRule(advice?.rules, rule),
50040
50074
  true,
50041
50075
  process.cwd(),
50042
50076
  globalConfigPath
50043
50077
  );
50044
- if (!result.ok) return fail12(result.errors.join("\n"));
50078
+ if (!result.ok) return failRule(result.errors.join("\n"));
50045
50079
  console.log(
50046
- `Added ${chalk278.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
50080
+ `Added ${chalk280.cyan(rule.title)} to advice.rules in user (node) (${globalConfigFileLabel(globalConfigPath)})`
50047
50081
  );
50048
50082
  }
50049
- async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath()) {
50050
- const error = optionsError(options2);
50051
- if (error) return fail12(error);
50083
+ async function addUserRule(text18, options2, globalConfigPath = getGlobalConfigPath(), cwd = process.cwd()) {
50084
+ const error = userRuleOptionsError(options2);
50085
+ if (error) return failRule(error);
50052
50086
  const rule = { title: options2.title?.trim() ?? "", text: text18.trim() };
50053
50087
  if (rule.text === "" || rule.title === "")
50054
- return fail12("User rules need both rule text and --title");
50088
+ return failRule("advice.rules entries need both rule text and --title");
50055
50089
  if (options2.user) return addToUserDb(rule);
50090
+ if (options2.repo !== void 0) return addToRepoDb(rule, options2.repo, cwd);
50056
50091
  addToUserNode(rule, globalConfigPath);
50057
50092
  }
50058
50093
 
@@ -50073,8 +50108,11 @@ function registerRulesAdd(rulesCommand) {
50073
50108
  ).option(
50074
50109
  "--node",
50075
50110
  "As --user, but append to advice.rules in user (node), this node's ~/.assist.yml"
50111
+ ).option(
50112
+ "--repo [name]",
50113
+ "As --user, but append to advice.rules in repo (db), the shared per-repo override every node sees, for the current repo or the named one"
50076
50114
  ).action(
50077
- (text18, options2) => options2.user || options2.node ? addUserRule(text18, options2) : addRule(text18, options2)
50115
+ (text18, options2) => options2.user || options2.node || options2.repo !== void 0 ? addUserRule(text18, options2) : addRule(text18, options2)
50078
50116
  ),
50079
50117
  "/add-rule and /fix-rules"
50080
50118
  );
@@ -50098,7 +50136,7 @@ function registerRules(program) {
50098
50136
  }
50099
50137
 
50100
50138
  // src/commands/seq/seqAuth.ts
50101
- import chalk280 from "chalk";
50139
+ import chalk282 from "chalk";
50102
50140
 
50103
50141
  // src/commands/seq/loadConnections.ts
50104
50142
  function loadConnections2() {
@@ -50127,10 +50165,10 @@ function setDefaultConnection(name2) {
50127
50165
  }
50128
50166
 
50129
50167
  // src/shared/assertUniqueName.ts
50130
- import chalk279 from "chalk";
50168
+ import chalk281 from "chalk";
50131
50169
  function assertUniqueName(existingNames, name2) {
50132
50170
  if (existingNames.includes(name2)) {
50133
- console.error(chalk279.red(`Connection "${name2}" already exists.`));
50171
+ console.error(chalk281.red(`Connection "${name2}" already exists.`));
50134
50172
  process.exit(1);
50135
50173
  }
50136
50174
  }
@@ -50148,18 +50186,18 @@ async function promptConnection2(existingNames) {
50148
50186
  var seqAuth = createConnectionAuth({
50149
50187
  load: loadConnections2,
50150
50188
  save: saveConnections2,
50151
- format: (c) => `${chalk280.bold(c.name)} ${c.url}`,
50189
+ format: (c) => `${chalk282.bold(c.name)} ${c.url}`,
50152
50190
  promptNew: promptConnection2,
50153
50191
  onFirst: (c) => setDefaultConnection(c.name)
50154
50192
  });
50155
50193
 
50156
50194
  // src/commands/seq/seqQuery.ts
50157
- import chalk284 from "chalk";
50195
+ import chalk286 from "chalk";
50158
50196
 
50159
50197
  // src/commands/seq/fetchSeq.ts
50160
- import chalk281 from "chalk";
50161
- async function fetchSeq(conn, path126, params) {
50162
- const url = `${conn.url}${path126}?${params}`;
50198
+ import chalk283 from "chalk";
50199
+ async function fetchSeq(conn, path128, params) {
50200
+ const url = `${conn.url}${path128}?${params}`;
50163
50201
  const response = await fetch(url, {
50164
50202
  headers: {
50165
50203
  Accept: "application/json",
@@ -50168,7 +50206,7 @@ async function fetchSeq(conn, path126, params) {
50168
50206
  });
50169
50207
  if (!response.ok) {
50170
50208
  const body = await response.text();
50171
- console.error(chalk281.red(`Seq returned ${response.status}: ${body}`));
50209
+ console.error(chalk283.red(`Seq returned ${response.status}: ${body}`));
50172
50210
  process.exit(1);
50173
50211
  }
50174
50212
  return response;
@@ -50227,23 +50265,23 @@ async function fetchSeqEvents(conn, params) {
50227
50265
  }
50228
50266
 
50229
50267
  // src/commands/seq/formatEvent.ts
50230
- import chalk282 from "chalk";
50268
+ import chalk284 from "chalk";
50231
50269
  function levelColor(level) {
50232
50270
  switch (level) {
50233
50271
  case "Fatal":
50234
- return chalk282.bgRed.white;
50272
+ return chalk284.bgRed.white;
50235
50273
  case "Error":
50236
- return chalk282.red;
50274
+ return chalk284.red;
50237
50275
  case "Warning":
50238
- return chalk282.yellow;
50276
+ return chalk284.yellow;
50239
50277
  case "Information":
50240
- return chalk282.cyan;
50278
+ return chalk284.cyan;
50241
50279
  case "Debug":
50242
- return chalk282.gray;
50280
+ return chalk284.gray;
50243
50281
  case "Verbose":
50244
- return chalk282.dim;
50282
+ return chalk284.dim;
50245
50283
  default:
50246
- return chalk282.white;
50284
+ return chalk284.white;
50247
50285
  }
50248
50286
  }
50249
50287
  function levelAbbrev(level) {
@@ -50284,12 +50322,12 @@ function formatTimestamp(iso) {
50284
50322
  function formatEvent(event) {
50285
50323
  const color = levelColor(event.Level);
50286
50324
  const abbrev = levelAbbrev(event.Level);
50287
- const ts10 = chalk282.dim(formatTimestamp(event.Timestamp));
50325
+ const ts10 = chalk284.dim(formatTimestamp(event.Timestamp));
50288
50326
  const msg = renderMessage(event);
50289
50327
  const lines = [`${ts10} ${color(`[${abbrev}]`)} ${msg}`];
50290
50328
  if (event.Exception) {
50291
50329
  for (const line of event.Exception.split("\n")) {
50292
- lines.push(chalk282.red(` ${line}`));
50330
+ lines.push(chalk284.red(` ${line}`));
50293
50331
  }
50294
50332
  }
50295
50333
  return lines.join("\n");
@@ -50322,11 +50360,11 @@ function rejectTimestampFilter(filter) {
50322
50360
  }
50323
50361
 
50324
50362
  // src/shared/resolveNamedConnection.ts
50325
- import chalk283 from "chalk";
50363
+ import chalk285 from "chalk";
50326
50364
  function resolveNamedConnection(connections, requested, defaultName, kind, authCommand) {
50327
50365
  if (connections.length === 0) {
50328
50366
  console.error(
50329
- chalk283.red(
50367
+ chalk285.red(
50330
50368
  `No ${kind} connections configured. Run '${authCommand}' first.`
50331
50369
  )
50332
50370
  );
@@ -50335,7 +50373,7 @@ function resolveNamedConnection(connections, requested, defaultName, kind, authC
50335
50373
  const target = requested ?? defaultName ?? connections[0].name;
50336
50374
  const connection = connections.find((c) => c.name === target);
50337
50375
  if (!connection) {
50338
- console.error(chalk283.red(`${kind} connection "${target}" not found.`));
50376
+ console.error(chalk285.red(`${kind} connection "${target}" not found.`));
50339
50377
  process.exit(1);
50340
50378
  }
50341
50379
  return connection;
@@ -50364,7 +50402,7 @@ async function seqQuery(filter, options2) {
50364
50402
  new URLSearchParams({ filter, count: String(count10) })
50365
50403
  );
50366
50404
  if (events.length === 0) {
50367
- console.log(chalk284.yellow("No events found."));
50405
+ console.log(chalk286.yellow("No events found."));
50368
50406
  return;
50369
50407
  }
50370
50408
  if (options2.json) {
@@ -50375,11 +50413,11 @@ async function seqQuery(filter, options2) {
50375
50413
  for (const event of chronological) {
50376
50414
  console.log(formatEvent(event));
50377
50415
  }
50378
- console.log(chalk284.dim(`
50416
+ console.log(chalk286.dim(`
50379
50417
  ${events.length} events`));
50380
50418
  if (events.length >= count10) {
50381
50419
  console.log(
50382
- chalk284.yellow(
50420
+ chalk286.yellow(
50383
50421
  `Results limited to ${count10}. Use --count to retrieve more.`
50384
50422
  )
50385
50423
  );
@@ -50387,10 +50425,10 @@ ${events.length} events`));
50387
50425
  }
50388
50426
 
50389
50427
  // src/shared/setNamedDefaultConnection.ts
50390
- import chalk285 from "chalk";
50428
+ import chalk287 from "chalk";
50391
50429
  function setNamedDefaultConnection(connections, name2, setDefault, kind) {
50392
50430
  if (!connections.find((c) => c.name === name2)) {
50393
- console.error(chalk285.red(`Connection "${name2}" not found.`));
50431
+ console.error(chalk287.red(`Connection "${name2}" not found.`));
50394
50432
  process.exit(1);
50395
50433
  }
50396
50434
  setDefault(name2);
@@ -50469,17 +50507,17 @@ import { homedir as homedir28 } from "os";
50469
50507
  // src/commands/show/findShownSessionFiles.ts
50470
50508
  var NOT_AFTER = String.raw`(?![\w\-/]|\.\w)`;
50471
50509
  var NOT_BEFORE_RELATIVE = String.raw`(?<=^|[^\w.\-/~]|(?:^|[^\w.\-/~])\./)`;
50472
- function normalise(path126) {
50473
- return path126.replaceAll("\\", "/").replace(/\/+$/, "");
50510
+ function normalise(path128) {
50511
+ return path128.replaceAll("\\", "/").replace(/\/+$/, "");
50474
50512
  }
50475
50513
  function escapeRegExp2(text18) {
50476
50514
  return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
50477
50515
  }
50478
- function within(path126, dir) {
50479
- return dir && path126.startsWith(`${dir}/`) ? path126.slice(dir.length + 1) : void 0;
50516
+ function within(path128, dir) {
50517
+ return dir && path128.startsWith(`${dir}/`) ? path128.slice(dir.length + 1) : void 0;
50480
50518
  }
50481
- function referencePatterns(path126, { home, cwd }) {
50482
- const file = normalise(path126);
50519
+ function referencePatterns(path128, { home, cwd }) {
50520
+ const file = normalise(path128);
50483
50521
  const forms = [escapeRegExp2(file)];
50484
50522
  const drive = /^\/mnt\/([a-z])\/(.+)$/i.exec(file);
50485
50523
  if (drive)
@@ -50499,7 +50537,7 @@ function referencePatterns(path126, { home, cwd }) {
50499
50537
  function findShownSessionFiles(body, writtenPaths2, locations) {
50500
50538
  const text18 = body.replaceAll("\\", "/");
50501
50539
  return writtenPaths2.filter(
50502
- (path126) => referencePatterns(path126, locations).some((pattern2) => pattern2.test(text18))
50540
+ (path128) => referencePatterns(path128, locations).some((pattern2) => pattern2.test(text18))
50503
50541
  );
50504
50542
  }
50505
50543
 
@@ -50531,7 +50569,7 @@ async function refuseSessionFiles(body) {
50531
50569
  console.error(
50532
50570
  [
50533
50571
  "Error: refusing to show files this session created or edited; the user already sees them in the session's diff:",
50534
- ...shown.map((path126) => ` ${path126}`),
50572
+ ...shown.map((path128) => ` ${path128}`),
50535
50573
  "Remove them (and any label or folder entry that exists only for them) and re-run, or skip the show if nothing is left."
50536
50574
  ].join("\n")
50537
50575
  );
@@ -50641,7 +50679,7 @@ function registerSlack(program) {
50641
50679
  }
50642
50680
 
50643
50681
  // src/commands/sql/sqlAuth.ts
50644
- import chalk287 from "chalk";
50682
+ import chalk289 from "chalk";
50645
50683
 
50646
50684
  // src/commands/sql/loadConnections.ts
50647
50685
  function loadConnections3() {
@@ -50670,7 +50708,7 @@ function setDefaultConnection2(name2) {
50670
50708
  }
50671
50709
 
50672
50710
  // src/commands/sql/promptConnection.ts
50673
- import chalk286 from "chalk";
50711
+ import chalk288 from "chalk";
50674
50712
  async function promptConnection3(existingNames) {
50675
50713
  const name2 = await promptInput("name", "Connection name:", "default");
50676
50714
  assertUniqueName(existingNames, name2);
@@ -50678,7 +50716,7 @@ async function promptConnection3(existingNames) {
50678
50716
  const portStr = await promptInput("port", "Port:", "1433");
50679
50717
  const port = Number.parseInt(portStr, 10);
50680
50718
  if (!Number.isFinite(port)) {
50681
- console.error(chalk286.red(`Invalid port "${portStr}".`));
50719
+ console.error(chalk288.red(`Invalid port "${portStr}".`));
50682
50720
  process.exit(1);
50683
50721
  }
50684
50722
  const user = await promptInput("user", "User:");
@@ -50691,13 +50729,13 @@ async function promptConnection3(existingNames) {
50691
50729
  var sqlAuth = createConnectionAuth({
50692
50730
  load: loadConnections3,
50693
50731
  save: saveConnections3,
50694
- format: (c) => `${chalk287.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
50732
+ format: (c) => `${chalk289.bold(c.name)} ${c.server}:${c.port}/${c.database} (${c.user})`,
50695
50733
  promptNew: promptConnection3,
50696
50734
  onFirst: (c) => setDefaultConnection2(c.name)
50697
50735
  });
50698
50736
 
50699
50737
  // src/commands/sql/printTable.ts
50700
- import chalk288 from "chalk";
50738
+ import chalk290 from "chalk";
50701
50739
  function formatCell(value) {
50702
50740
  if (value === null || value === void 0) return "";
50703
50741
  if (value instanceof Date) return value.toISOString();
@@ -50706,7 +50744,7 @@ function formatCell(value) {
50706
50744
  }
50707
50745
  function printTable(rows) {
50708
50746
  if (rows.length === 0) {
50709
- console.log(chalk288.yellow("(no rows)"));
50747
+ console.log(chalk290.yellow("(no rows)"));
50710
50748
  return;
50711
50749
  }
50712
50750
  const columns = Object.keys(rows[0]);
@@ -50714,13 +50752,13 @@ function printTable(rows) {
50714
50752
  (col) => Math.max(col.length, ...rows.map((r) => formatCell(r[col]).length))
50715
50753
  );
50716
50754
  const header = columns.map((c, i) => c.padEnd(widths[i])).join(" ");
50717
- console.log(chalk288.dim(header));
50718
- console.log(chalk288.dim("-".repeat(header.length)));
50755
+ console.log(chalk290.dim(header));
50756
+ console.log(chalk290.dim("-".repeat(header.length)));
50719
50757
  for (const row2 of rows) {
50720
50758
  const line = columns.map((c, i) => formatCell(row2[c]).padEnd(widths[i])).join(" ");
50721
50759
  console.log(line);
50722
50760
  }
50723
- console.log(chalk288.dim(`
50761
+ console.log(chalk290.dim(`
50724
50762
  ${rows.length} row${rows.length === 1 ? "" : "s"}`));
50725
50763
  }
50726
50764
 
@@ -50780,7 +50818,7 @@ async function sqlColumns(table, connectionName) {
50780
50818
  }
50781
50819
 
50782
50820
  // src/commands/sql/sqlMutate.ts
50783
- import chalk289 from "chalk";
50821
+ import chalk291 from "chalk";
50784
50822
 
50785
50823
  // src/commands/sql/isMutation.ts
50786
50824
  var MUTATION_KEYWORDS = [
@@ -50814,7 +50852,7 @@ function isMutation(sql33) {
50814
50852
  async function sqlMutate(query, connectionName) {
50815
50853
  if (!isMutation(query)) {
50816
50854
  console.error(
50817
- chalk289.red(
50855
+ chalk291.red(
50818
50856
  "assist sql mutate refuses non-mutating statements. Use `assist sql query` instead."
50819
50857
  )
50820
50858
  );
@@ -50824,18 +50862,18 @@ async function sqlMutate(query, connectionName) {
50824
50862
  const pool = await sqlConnect(conn);
50825
50863
  try {
50826
50864
  const result = await pool.request().query(query);
50827
- console.log(chalk289.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
50865
+ console.log(chalk291.dim(`${result.rowsAffected.join(", ")} row(s) affected`));
50828
50866
  } finally {
50829
50867
  await pool.close();
50830
50868
  }
50831
50869
  }
50832
50870
 
50833
50871
  // src/commands/sql/sqlQuery.ts
50834
- import chalk290 from "chalk";
50872
+ import chalk292 from "chalk";
50835
50873
  async function sqlQuery(query, connectionName) {
50836
50874
  if (isMutation(query)) {
50837
50875
  console.error(
50838
- chalk290.red(
50876
+ chalk292.red(
50839
50877
  "assist sql query refuses mutating statements. Use `assist sql mutate` instead."
50840
50878
  )
50841
50879
  );
@@ -50850,7 +50888,7 @@ async function sqlQuery(query, connectionName) {
50850
50888
  printTable(rows);
50851
50889
  } else {
50852
50890
  console.log(
50853
- chalk290.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
50891
+ chalk292.dim(`${result.rowsAffected.join(", ")} row(s) affected`)
50854
50892
  );
50855
50893
  }
50856
50894
  } finally {
@@ -50912,7 +50950,7 @@ function registerSql(program) {
50912
50950
 
50913
50951
  // src/commands/sync.ts
50914
50952
  import * as os6 from "os";
50915
- import * as path122 from "path";
50953
+ import * as path124 from "path";
50916
50954
  import { fileURLToPath as fileURLToPath9 } from "url";
50917
50955
 
50918
50956
  // src/commands/sync/createSyncFiles.ts
@@ -50922,11 +50960,11 @@ import * as fs56 from "fs";
50922
50960
  import * as fs52 from "fs";
50923
50961
 
50924
50962
  // src/commands/sync/resolveSyncConflicts.ts
50925
- import chalk291 from "chalk";
50963
+ import chalk293 from "chalk";
50926
50964
  async function resolveSyncConflicts(conflicts, yes) {
50927
50965
  if (conflicts.length === 0) return [];
50928
50966
  console.log(
50929
- chalk291.yellow(
50967
+ chalk293.yellow(
50930
50968
  `
50931
50969
  \u26A0\uFE0F ${conflicts.length} file(s) exist that assist sync did not write:`
50932
50970
  )
@@ -50935,7 +50973,7 @@ async function resolveSyncConflicts(conflicts, yes) {
50935
50973
  console.log(` ${action} ${target}`);
50936
50974
  }
50937
50975
  const confirmed = !yes && await promptConfirm(
50938
- chalk291.red("Replace them with assist's versions?"),
50976
+ chalk293.red("Replace them with assist's versions?"),
50939
50977
  false
50940
50978
  );
50941
50979
  if (confirmed) return conflicts;
@@ -51058,6 +51096,9 @@ function createSyncFiles(initial = syncManifest.load()) {
51058
51096
  };
51059
51097
  }
51060
51098
 
51099
+ // src/commands/sync/pruneClaude.ts
51100
+ import * as path110 from "path";
51101
+
51061
51102
  // src/commands/sync/pruneCommands.ts
51062
51103
  import * as path108 from "path";
51063
51104
 
@@ -51077,7 +51118,7 @@ function pruneEntry(entry, targetDir, keep, shape, options2, result) {
51077
51118
  return;
51078
51119
  }
51079
51120
  result.orphans.push(entry.name);
51080
- const reason4 = shape.blockedBy?.(entryPath);
51121
+ const reason4 = options2.owner.owns(entryPath) ? void 0 : shape.blockedBy?.(entryPath);
51081
51122
  if (reason4) {
51082
51123
  result.skipped.push({ name: entry.name, reason: reason4 });
51083
51124
  return;
@@ -51124,7 +51165,7 @@ function pruneSkills(targetDir, skillNames, options2) {
51124
51165
  targetDir,
51125
51166
  skillNames,
51126
51167
  {
51127
- nameOf: (entry) => entry.isDirectory() ? entry.name : void 0,
51168
+ nameOf: (entry) => entry.isDirectory() || entry.name.endsWith(".md") ? entry.name : void 0,
51128
51169
  ownedPaths: (skillDir) => [skillDir, path109.join(skillDir, "SKILL.md")],
51129
51170
  blockedBy: unexpectedContent
51130
51171
  },
@@ -51132,6 +51173,7 @@ function pruneSkills(targetDir, skillNames, options2) {
51132
51173
  );
51133
51174
  }
51134
51175
  function unexpectedContent(skillDir) {
51176
+ if (!fs58.statSync(skillDir).isDirectory()) return void 0;
51135
51177
  const entries = fs58.readdirSync(skillDir);
51136
51178
  const others = entries.filter((entry) => entry !== "SKILL.md");
51137
51179
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
@@ -51141,13 +51183,13 @@ function unexpectedContent(skillDir) {
51141
51183
  // src/commands/sync/reportPrune.ts
51142
51184
  function reportPrune(label, result, force) {
51143
51185
  if (result.orphans.length === 0) {
51144
- console.log(`No orphaned commands in ${label}`);
51186
+ console.log(`No orphaned files in ${label}`);
51145
51187
  } else if (force) {
51146
51188
  for (const name2 of result.removed) {
51147
51189
  console.log(`Removed ${name2} from ${label}`);
51148
51190
  }
51149
51191
  } else {
51150
- console.log(`Orphaned commands in ${label} (run with --force to remove):`);
51192
+ console.log(`Orphaned files in ${label} (run with --force to remove):`);
51151
51193
  for (const name2 of result.orphans) {
51152
51194
  console.log(` ${name2}`);
51153
51195
  }
@@ -51165,9 +51207,25 @@ function reportPrune(label, result, force) {
51165
51207
  }
51166
51208
  }
51167
51209
 
51210
+ // src/commands/sync/pruneClaude.ts
51211
+ function pruneClaude(targetBase, skillNames, options2, owner) {
51212
+ if (!options2.prune) return;
51213
+ const force = options2.force ?? false;
51214
+ reportPrune(
51215
+ "~/.claude/skills",
51216
+ pruneSkills(path110.join(targetBase, "skills"), skillNames, { force, owner }),
51217
+ force
51218
+ );
51219
+ reportPrune(
51220
+ "~/.claude/commands",
51221
+ pruneCommands(path110.join(targetBase, "commands"), [], { force, owner }),
51222
+ force
51223
+ );
51224
+ }
51225
+
51168
51226
  // src/commands/sync/syncClaudeCommands.ts
51169
51227
  import * as fs60 from "fs";
51170
- import * as path112 from "path";
51228
+ import * as path113 from "path";
51171
51229
 
51172
51230
  // src/commands/sync/commandToSkill.ts
51173
51231
  function commandToSkill(name2, content) {
@@ -51186,20 +51244,20 @@ function quoteYaml(value) {
51186
51244
 
51187
51245
  // src/commands/sync/markdownNames.ts
51188
51246
  import * as fs59 from "fs";
51189
- import * as path110 from "path";
51247
+ import * as path111 from "path";
51190
51248
  function markdownNames(dir) {
51191
- return fs59.readdirSync(dir).filter((file) => file.endsWith(".md")).map((file) => path110.basename(file, ".md"));
51249
+ return fs59.readdirSync(dir).filter((file) => file.endsWith(".md")).map((file) => path111.basename(file, ".md"));
51192
51250
  }
51193
51251
 
51194
51252
  // src/commands/sync/renderHarnessPaths.ts
51195
51253
  import * as os5 from "os";
51196
- import * as path111 from "path";
51254
+ import * as path112 from "path";
51197
51255
  function homePath(harness, dest) {
51198
- const relative12 = path111.relative(
51256
+ const relative12 = path112.relative(
51199
51257
  os5.homedir(),
51200
- path111.join(harness.homeDir, dest)
51258
+ path112.join(harness.homeDir, dest)
51201
51259
  );
51202
- return `~/${relative12.split(path111.sep).join("/")}`;
51260
+ return `~/${relative12.split(path112.sep).join("/")}`;
51203
51261
  }
51204
51262
  function renderHarnessPaths(content, harness) {
51205
51263
  const { sync: sync2 } = harness;
@@ -51217,33 +51275,33 @@ function renderHarnessPaths(content, harness) {
51217
51275
 
51218
51276
  // src/commands/sync/syncClaudeCommands.ts
51219
51277
  function syncClaudeCommands(claudeDir, targetBase, files) {
51220
- const sourceDir = path112.join(claudeDir, "commands");
51278
+ const sourceDir = path113.join(claudeDir, "commands");
51221
51279
  const names = markdownNames(sourceDir);
51222
51280
  for (const name2 of names) {
51223
- const content = fs60.readFileSync(path112.join(sourceDir, `${name2}.md`), "utf8");
51281
+ const content = fs60.readFileSync(path113.join(sourceDir, `${name2}.md`), "utf8");
51224
51282
  const rendered = renderHarnessPaths(content, harnesses.claude);
51225
51283
  files.write(
51226
- path112.join(targetBase, "skills", name2, "SKILL.md"),
51284
+ path113.join(targetBase, "skills", name2, "SKILL.md"),
51227
51285
  commandToSkill(name2, rendered)
51228
51286
  );
51229
- files.remove(path112.join(targetBase, "commands", `${name2}.md`), [
51287
+ files.remove(path113.join(targetBase, "commands", `${name2}.md`), [
51230
51288
  content,
51231
51289
  rendered
51232
51290
  ]);
51233
51291
  }
51234
51292
  console.log(
51235
- `Synced ${names.length} skill(s) to ${path112.join(targetBase, "skills")}`
51293
+ `Synced ${names.length} skill(s) to ${path113.join(targetBase, "skills")}`
51236
51294
  );
51237
51295
  return names;
51238
51296
  }
51239
51297
 
51240
51298
  // src/commands/sync/reportRetiredAgentsFiles.ts
51241
51299
  import * as fs61 from "fs";
51242
- import * as path113 from "path";
51300
+ import * as path114 from "path";
51243
51301
  var retired = [
51244
- path113.join(harnesses.claude.homeDir, "CLAUDE.md"),
51245
- path113.join(harnesses.codex.homeDir, "AGENTS.md"),
51246
- path113.join(harnesses.pi.homeDir, "AGENTS.md")
51302
+ path114.join(harnesses.claude.homeDir, "CLAUDE.md"),
51303
+ path114.join(harnesses.codex.homeDir, "AGENTS.md"),
51304
+ path114.join(harnesses.pi.homeDir, "AGENTS.md")
51247
51305
  ];
51248
51306
  function reportRetiredAgentsFiles() {
51249
51307
  const leftovers = retired.filter((file) => fs61.existsSync(file));
@@ -51257,12 +51315,62 @@ function reportRetiredAgentsFiles() {
51257
51315
  );
51258
51316
  }
51259
51317
 
51318
+ // src/commands/sync/retiredOwnedPaths.ts
51319
+ import * as fs62 from "fs";
51320
+ import * as path115 from "path";
51321
+
51322
+ // src/commands/sync/retiredSyncNames.ts
51323
+ var retiredSyncNames = {
51324
+ commands: [
51325
+ "adopt-rules",
51326
+ "associate-jira",
51327
+ "generate-cli-read-verbs",
51328
+ "handover",
51329
+ "high-level-config",
51330
+ "journal",
51331
+ "next-backlog-item",
51332
+ "recall",
51333
+ "review",
51334
+ "review-comments",
51335
+ "standup",
51336
+ "strip-code-comments",
51337
+ "strip-comments",
51338
+ "subtask",
51339
+ "transcript-format",
51340
+ "transcript-summarise",
51341
+ "update-jira",
51342
+ "voice-logs",
51343
+ "voice-setup",
51344
+ "voice-start",
51345
+ "voice-status",
51346
+ "voice-stop"
51347
+ ],
51348
+ skillDirs: ["review-ci"]
51349
+ };
51350
+
51351
+ // src/commands/sync/retiredOwnedPaths.ts
51352
+ function retiredOwnedPaths() {
51353
+ const { claude, codex, pi } = harnesses;
51354
+ const paths = retiredSyncNames.commands.flatMap((name2) => [
51355
+ path115.join(claude.homeDir, "commands", `${name2}.md`),
51356
+ path115.join(claude.homeDir, claude.sync.commandDest(name2)),
51357
+ path115.join(codex.homeDir, codex.sync.commandDest(name2)),
51358
+ path115.join(pi.homeDir, pi.sync.commandDest(name2))
51359
+ ]);
51360
+ for (const name2 of retiredSyncNames.skillDirs)
51361
+ paths.push(
51362
+ path115.join(claude.homeDir, "skills", name2),
51363
+ path115.join(codex.homeDir, "skills", name2)
51364
+ );
51365
+ return paths.filter((file) => fs62.existsSync(file));
51366
+ }
51367
+
51260
51368
  // src/commands/sync/syncCodex.ts
51261
- import * as path117 from "path";
51369
+ import * as path119 from "path";
51262
51370
 
51263
51371
  // src/commands/sync/installDesignResources.ts
51264
- import * as fs62 from "fs";
51265
- import * as path114 from "path";
51372
+ import * as fs63 from "fs";
51373
+ import * as path116 from "path";
51266
51374
 
51267
51375
  // src/commands/sync/designSkillToNative.ts
51268
51376
  function designSkillToNative(name2, content) {
@@ -51282,18 +51390,18 @@ ${content}`
51282
51390
  function installDesignResources(claudeDir, harness, files) {
51283
51391
  const { homeDir, sync: sync2 } = harness;
51284
51392
  files.write(
51285
- path114.join(homeDir, sync2.designPromptDest),
51286
- fs62.readFileSync(path114.join(claudeDir, "design-system-prompt.md"), "utf8")
51393
+ path116.join(homeDir, sync2.designPromptDest),
51394
+ fs63.readFileSync(path116.join(claudeDir, "design-system-prompt.md"), "utf8")
51287
51395
  );
51288
- const skillsSource = path114.join(claudeDir, "skills");
51396
+ const skillsSource = path116.join(claudeDir, "skills");
51289
51397
  const names = markdownNames(skillsSource);
51290
51398
  for (const name2 of names) {
51291
- const content = fs62.readFileSync(
51292
- path114.join(skillsSource, `${name2}.md`),
51399
+ const content = fs63.readFileSync(
51400
+ path116.join(skillsSource, `${name2}.md`),
51293
51401
  "utf8"
51294
51402
  );
51295
51403
  files.write(
51296
- path114.join(homeDir, sync2.designSkillDest(name2)),
51404
+ path116.join(homeDir, sync2.designSkillDest(name2)),
51297
51405
  sync2.nativeDesignSkills ? designSkillToNative(name2, content) : content
51298
51406
  );
51299
51407
  }
@@ -51301,19 +51409,19 @@ function installDesignResources(claudeDir, harness, files) {
51301
51409
  }
51302
51410
 
51303
51411
  // src/commands/sync/installHarnessCommands.ts
51304
- import * as fs63 from "fs";
51305
- import * as path115 from "path";
51412
+ import * as fs64 from "fs";
51413
+ import * as path117 from "path";
51306
51414
  function installHarnessCommands(claudeDir, harness, transform, files) {
51307
- const commandsSource = path115.join(claudeDir, "commands");
51308
- const sourceFiles = fs63.readdirSync(commandsSource);
51415
+ const commandsSource = path117.join(claudeDir, "commands");
51416
+ const sourceFiles = fs64.readdirSync(commandsSource);
51309
51417
  const names = [];
51310
51418
  for (const file of sourceFiles) {
51311
51419
  if (!file.endsWith(".md")) continue;
51312
51420
  const name2 = file.replace(/\.md$/, "");
51313
51421
  names.push(name2);
51314
- const content = fs63.readFileSync(path115.join(commandsSource, file), "utf8");
51422
+ const content = fs64.readFileSync(path117.join(commandsSource, file), "utf8");
51315
51423
  files.write(
51316
- path115.join(harness.homeDir, harness.sync.commandDest(name2)),
51424
+ path117.join(harness.homeDir, harness.sync.commandDest(name2)),
51317
51425
  transform(name2, renderHarnessPaths(content, harness))
51318
51426
  );
51319
51427
  }
@@ -51321,15 +51429,15 @@ function installHarnessCommands(claudeDir, harness, transform, files) {
51321
51429
  }
51322
51430
 
51323
51431
  // src/commands/sync/syncCodexHooks.ts
51324
- import * as fs64 from "fs";
51325
- import * as path116 from "path";
51432
+ import * as fs65 from "fs";
51433
+ import * as path118 from "path";
51326
51434
  async function syncCodexHooks(sourcePath) {
51327
- const body = fs64.readFileSync(sourcePath, "utf8");
51328
- const configPath = path116.join(harnesses.codex.homeDir, "config.toml");
51329
- const existing = fs64.existsSync(configPath) ? fs64.readFileSync(configPath, "utf8") : "";
51435
+ const body = fs65.readFileSync(sourcePath, "utf8");
51436
+ const configPath = path118.join(harnesses.codex.homeDir, "config.toml");
51437
+ const existing = fs65.existsSync(configPath) ? fs65.readFileSync(configPath, "utf8") : "";
51330
51438
  const next3 = upsertManagedBlock(existing, body);
51331
- fs64.mkdirSync(path116.dirname(configPath), { recursive: true });
51332
- fs64.writeFileSync(configPath, next3);
51439
+ fs65.mkdirSync(path118.dirname(configPath), { recursive: true });
51440
+ fs65.writeFileSync(configPath, next3);
51333
51441
  console.log(
51334
51442
  "Registered assist codex-hook in ~/.codex/config.toml (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
51335
51443
  );
@@ -51363,7 +51471,7 @@ async function syncCodex(claudeDir, files, options2) {
51363
51471
  harnesses.codex,
51364
51472
  files
51365
51473
  );
51366
- await syncCodexHooks(path117.join(claudeDir, "..", "codex", "config.toml"));
51474
+ await syncCodexHooks(path119.join(claudeDir, "..", "codex", "config.toml"));
51367
51475
  console.log(`Synced ${total2} skill(s) to ~/.codex/skills`);
51368
51476
  console.log(
51369
51477
  `Synced the design system prompt and ${designSkills.length} design skill(s) for Codex`
@@ -51373,7 +51481,7 @@ async function syncCodex(claudeDir, files, options2) {
51373
51481
  reportPrune(
51374
51482
  "~/.codex/skills",
51375
51483
  pruneSkills(
51376
- path117.join(harnesses.codex.homeDir, "skills"),
51484
+ path119.join(harnesses.codex.homeDir, "skills"),
51377
51485
  [...names, ...designSkills],
51378
51486
  { force, owner: files }
51379
51487
  ),
@@ -51382,34 +51490,36 @@ async function syncCodex(claudeDir, files, options2) {
51382
51490
  }
51383
51491
 
51384
51492
  // src/commands/sync/syncDesign.ts
51385
- import * as fs65 from "fs";
51386
- import * as path118 from "path";
51493
+ import * as fs66 from "fs";
51494
+ import * as path120 from "path";
51387
51495
  function syncDesign(claudeDir, targetBase, files) {
51388
51496
  files.write(
51389
- path118.join(targetBase, "design-system-prompt.md"),
51390
- fs65.readFileSync(path118.join(claudeDir, "design-system-prompt.md"), "utf8")
51497
+ path120.join(targetBase, "design-system-prompt.md"),
51498
+ fs66.readFileSync(path120.join(claudeDir, "design-system-prompt.md"), "utf8")
51391
51499
  );
51392
51500
  console.log(
51393
51501
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
51394
51502
  );
51395
- const skillsSource = path118.join(claudeDir, "skills");
51396
- const skillsTarget = path118.join(targetBase, "skills");
51397
- const entries = fs65.readdirSync(skillsSource, { withFileTypes: true });
51503
+ const skillsSource = path120.join(claudeDir, "skills");
51504
+ const skillsTarget = path120.join(targetBase, "skills");
51505
+ const entries = fs66.readdirSync(skillsSource, { withFileTypes: true }).filter(
51506
+ (entry) => !entry.isDirectory() || fs66.existsSync(path120.join(skillsSource, entry.name, "SKILL.md"))
51507
+ );
51398
51508
  for (const entry of entries) {
51399
- const source = path118.join(skillsSource, entry.name);
51400
- const target = path118.join(skillsTarget, entry.name);
51509
+ const source = path120.join(skillsSource, entry.name);
51510
+ const target = path120.join(skillsTarget, entry.name);
51401
51511
  if (entry.isDirectory()) {
51402
51512
  files.copyDir(source, target);
51403
51513
  } else {
51404
- files.write(target, fs65.readFileSync(source, "utf8"));
51514
+ files.write(target, fs66.readFileSync(source, "utf8"));
51405
51515
  }
51406
51516
  }
51407
51517
  console.log(`Synced ${entries.length} skill(s) to ~/.claude/skills`);
51408
- return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
51518
+ return entries.map((entry) => entry.name);
51409
51519
  }
51410
51520
 
51411
51521
  // src/commands/sync/syncPi.ts
51412
- import * as path119 from "path";
51522
+ import * as path121 from "path";
51413
51523
  import { stringify as stringify4 } from "yaml";
51414
51524
  function unquote(value) {
51415
51525
  return value.trim().replace(/^["']|["']$/g, "");
@@ -51438,7 +51548,7 @@ function syncPi(claudeDir, files, options2) {
51438
51548
  files
51439
51549
  );
51440
51550
  const designSkills = installDesignResources(claudeDir, harnesses.pi, files);
51441
- syncPiHooks(path119.join(claudeDir, "..", "pi"));
51551
+ syncPiHooks(path121.join(claudeDir, "..", "pi"));
51442
51552
  console.log(`Synced ${synced} prompt(s) to ~/.pi/agent/prompts`);
51443
51553
  console.log(
51444
51554
  `Synced the design system prompt and ${designSkills.length} design skill(s) to ~/.pi/agent/assist`
@@ -51447,7 +51557,7 @@ function syncPi(claudeDir, files, options2) {
51447
51557
  const force = options2.force ?? false;
51448
51558
  reportPrune(
51449
51559
  "~/.pi/agent/prompts",
51450
- pruneCommands(path119.join(harnesses.pi.homeDir, "prompts"), names, {
51560
+ pruneCommands(path121.join(harnesses.pi.homeDir, "prompts"), names, {
51451
51561
  force,
51452
51562
  owner: files
51453
51563
  }),
@@ -51456,9 +51566,9 @@ function syncPi(claudeDir, files, options2) {
51456
51566
  }
51457
51567
 
51458
51568
  // src/commands/sync/syncSettings.ts
51459
- import * as fs67 from "fs";
51460
- import * as path121 from "path";
51461
- import chalk292 from "chalk";
51569
+ import * as fs68 from "fs";
51570
+ import * as path123 from "path";
51571
+ import chalk294 from "chalk";
51462
51572
 
51463
51573
  // src/commands/sync/mergeSettings.ts
51464
51574
  function isPlainObject7(value) {
@@ -51496,26 +51606,26 @@ function mergeSettings(user, assist) {
51496
51606
  }
51497
51607
 
51498
51608
  // src/commands/sync/readSourceSettings.ts
51499
- import * as fs66 from "fs";
51500
- import * as path120 from "path";
51609
+ import * as fs67 from "fs";
51610
+ import * as path122 from "path";
51501
51611
  function readJson(file) {
51502
- return JSON.parse(fs66.readFileSync(file, "utf8"));
51612
+ return JSON.parse(fs67.readFileSync(file, "utf8"));
51503
51613
  }
51504
51614
  function readSourceSettings(claudeDir, preferences) {
51505
- const required = readJson(path120.join(claudeDir, "settings.json"));
51615
+ const required = readJson(path122.join(claudeDir, "settings.json"));
51506
51616
  if (!preferences) return required;
51507
51617
  return mergeSettings(
51508
51618
  required,
51509
- readJson(path120.join(claudeDir, "preferences.json"))
51619
+ readJson(path122.join(claudeDir, "preferences.json"))
51510
51620
  );
51511
51621
  }
51512
51622
 
51513
51623
  // src/commands/sync/syncSettings.ts
51514
51624
  async function syncSettings(claudeDir, targetBase, options2) {
51515
- const target = path121.join(targetBase, "settings.json");
51625
+ const target = path123.join(targetBase, "settings.json");
51516
51626
  const sourceSettings = readSourceSettings(claudeDir, options2?.preferences);
51517
- const targetExists = fs67.existsSync(target);
51518
- const targetContent = targetExists ? fs67.readFileSync(target, "utf8") : "";
51627
+ const targetExists = fs68.existsSync(target);
51628
+ const targetContent = targetExists ? fs68.readFileSync(target, "utf8") : "";
51519
51629
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
51520
51630
  const mergedContent = JSON.stringify(
51521
51631
  mergeSettings(preservedUserSettings, sourceSettings),
@@ -51527,7 +51637,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
51527
51637
  if (mergedContent !== normalizedTarget) {
51528
51638
  if (!options2?.yes) {
51529
51639
  console.log(
51530
- chalk292.yellow(
51640
+ chalk294.yellow(
51531
51641
  "\n\u26A0\uFE0F Warning: settings.json differs from existing file"
51532
51642
  )
51533
51643
  );
@@ -51535,7 +51645,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
51535
51645
  printDiff(targetContent, mergedContent);
51536
51646
  printAutoConfirmHint();
51537
51647
  const confirm = await promptConfirm(
51538
- chalk292.red("Write merged settings.json?"),
51648
+ chalk294.red("Write merged settings.json?"),
51539
51649
  false
51540
51650
  );
51541
51651
  if (!confirm) {
@@ -51545,22 +51655,25 @@ async function syncSettings(claudeDir, targetBase, options2) {
51545
51655
  }
51546
51656
  }
51547
51657
  }
51548
- fs67.writeFileSync(target, mergedContent);
51658
+ fs68.writeFileSync(target, mergedContent);
51549
51659
  console.log("Merged settings.json into ~/.claude/settings.json");
51550
51660
  }
51551
51661
 
51552
51662
  // src/commands/sync.ts
51553
51663
  var __filename5 = fileURLToPath9(import.meta.url);
51554
- var __dirname6 = path122.dirname(__filename5);
51664
+ var __dirname6 = path124.dirname(__filename5);
51555
51665
  async function sync(options2) {
51556
51666
  const config = loadConfig();
51557
51667
  const yes = options2?.yes ?? config.sync.autoConfirm;
51558
51668
  const prune = { prune: options2?.prune, force: options2?.force };
51559
- const claudeDir = path122.join(__dirname6, "..", "claude");
51560
- const targetBase = path122.join(os6.homedir(), ".claude");
51561
- const files = createSyncFiles();
51669
+ const claudeDir = path124.join(__dirname6, "..", "claude");
51670
+ const targetBase = path124.join(os6.homedir(), ".claude");
51671
+ const files = createSyncFiles([
51672
+ ...syncManifest.load(),
51673
+ ...retiredOwnedPaths()
51674
+ ]);
51562
51675
  const commandNames = syncClaudeCommands(claudeDir, targetBase, files);
51563
- const skillDirNames = syncDesign(claudeDir, targetBase, files);
51676
+ const designSkillNames = syncDesign(claudeDir, targetBase, files);
51564
51677
  await syncSettings(claudeDir, targetBase, {
51565
51678
  yes,
51566
51679
  preferences: config.sync.preferences
@@ -51568,26 +51681,7 @@ async function sync(options2) {
51568
51681
  await syncCodex(claudeDir, files, prune);
51569
51682
  syncPi(claudeDir, files, prune);
51570
51683
  reportRetiredAgentsFiles();
51571
- if (options2?.prune) {
51572
- const force = options2.force ?? false;
51573
- reportPrune(
51574
- "~/.claude/skills",
51575
- pruneSkills(
51576
- path122.join(targetBase, "skills"),
51577
- [...commandNames, ...skillDirNames],
51578
- { force, owner: files }
51579
- ),
51580
- force
51581
- );
51582
- reportPrune(
51583
- "~/.claude/commands",
51584
- pruneCommands(path122.join(targetBase, "commands"), [], {
51585
- force,
51586
- owner: files
51587
- }),
51588
- force
51589
- );
51590
- }
51684
+ pruneClaude(targetBase, [...commandNames, ...designSkillNames], prune, files);
51591
51685
  await files.finish(yes);
51592
51686
  }
51593
51687
 
@@ -51612,17 +51706,17 @@ function registerSync(program) {
51612
51706
  }
51613
51707
 
51614
51708
  // src/commands/testflight/testflightAdd.ts
51615
- import chalk293 from "chalk";
51709
+ import chalk295 from "chalk";
51616
51710
  async function testflightAdd(email, options2) {
51617
51711
  try {
51618
51712
  const config = readTestflightConfig(loadConfig());
51619
51713
  const { message: message4, waiting: waiting2 } = await addTesterOutcome(config, email, {
51620
51714
  internal: options2.internal
51621
51715
  });
51622
- console.log(waiting2 ? chalk293.yellow(message4) : chalk293.green(message4));
51716
+ console.log(waiting2 ? chalk295.yellow(message4) : chalk295.green(message4));
51623
51717
  } catch (error) {
51624
51718
  if (!(error instanceof TestflightError)) throw error;
51625
- console.error(chalk293.red(error.message));
51719
+ console.error(chalk295.red(error.message));
51626
51720
  process.exit(1);
51627
51721
  }
51628
51722
  }
@@ -51642,7 +51736,7 @@ function registerTestflight(program) {
51642
51736
  }
51643
51737
 
51644
51738
  // src/commands/transcript/clean.ts
51645
- import { existsSync as existsSync90 } from "fs";
51739
+ import { existsSync as existsSync92 } from "fs";
51646
51740
 
51647
51741
  // src/commands/transcript/convert/formatTimestamp.ts
51648
51742
  function pad2(value, width2) {
@@ -51920,7 +52014,7 @@ function clean(file, options2 = {}) {
51920
52014
  );
51921
52015
  process.exit(1);
51922
52016
  }
51923
- if (!existsSync90(file)) {
52017
+ if (!existsSync92(file)) {
51924
52018
  console.error(`Error: VTT file not found: ${file}`);
51925
52019
  process.exit(1);
51926
52020
  }
@@ -52003,21 +52097,21 @@ async function configure() {
52003
52097
  }
52004
52098
 
52005
52099
  // src/commands/transcript/list.ts
52006
- import { existsSync as existsSync91, readdirSync as readdirSync25, statSync as statSync16 } from "fs";
52007
- import { join as join119 } from "path";
52100
+ import { existsSync as existsSync93, readdirSync as readdirSync25, statSync as statSync17 } from "fs";
52101
+ import { join as join121 } from "path";
52008
52102
  function list5() {
52009
52103
  const { vttDir } = getTranscriptConfig();
52010
- if (!existsSync91(vttDir)) return;
52104
+ if (!existsSync93(vttDir)) return;
52011
52105
  for (const entry of readdirSync25(vttDir)) {
52012
52106
  if (!entry.endsWith(".vtt")) continue;
52013
- if (statSync16(join119(vttDir, entry)).isDirectory()) continue;
52107
+ if (statSync17(join121(vttDir, entry)).isDirectory()) continue;
52014
52108
  console.log(entry);
52015
52109
  }
52016
52110
  }
52017
52111
 
52018
52112
  // src/commands/transcript/move.ts
52019
- import { existsSync as existsSync92, mkdirSync as mkdirSync40, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
52020
- import { basename as basename31, join as join120 } from "path";
52113
+ import { existsSync as existsSync94, mkdirSync as mkdirSync40, renameSync as renameSync5, writeFileSync as writeFileSync56 } from "fs";
52114
+ import { basename as basename31, join as join122 } from "path";
52021
52115
 
52022
52116
  // src/commands/transcript/convertVttToMarkdown.ts
52023
52117
  function convertVttToMarkdown(inputPath) {
@@ -52027,9 +52121,9 @@ function convertVttToMarkdown(inputPath) {
52027
52121
  // src/commands/transcript/move.ts
52028
52122
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
52029
52123
  function archiveRawVtt(vttDir, sourcePath, filename) {
52030
- const processedDir = join120(vttDir, "processed");
52124
+ const processedDir = join122(vttDir, "processed");
52031
52125
  mkdirSync40(processedDir, { recursive: true });
52032
- renameSync5(sourcePath, join120(processedDir, filename));
52126
+ renameSync5(sourcePath, join122(processedDir, filename));
52033
52127
  }
52034
52128
  function move(file, options2) {
52035
52129
  const { date, client } = options2;
@@ -52039,25 +52133,25 @@ function move(file, options2) {
52039
52133
  }
52040
52134
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
52041
52135
  const filename = basename31(file);
52042
- const sourcePath = join120(vttDir, filename);
52043
- if (!existsSync92(sourcePath)) {
52136
+ const sourcePath = join122(vttDir, filename);
52137
+ if (!existsSync94(sourcePath)) {
52044
52138
  console.error(`Error: VTT file not found: ${sourcePath}`);
52045
52139
  process.exit(1);
52046
52140
  }
52047
52141
  const base = basename31(filename, ".vtt").replace(/ Transcription$/, "");
52048
52142
  const outputName = `${date} ${base}.md`;
52049
- const formattedDir = join120(transcriptsDir, client);
52143
+ const formattedDir = join122(transcriptsDir, client);
52050
52144
  mkdirSync40(formattedDir, { recursive: true });
52051
- const formattedPath = join120(formattedDir, outputName);
52145
+ const formattedPath = join122(formattedDir, outputName);
52052
52146
  writeFileSync56(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
52053
52147
  archiveRawVtt(vttDir, sourcePath, filename);
52054
- const summaryPath = join120(summaryDir, client, outputName);
52148
+ const summaryPath = join122(summaryDir, client, outputName);
52055
52149
  console.log(`Formatted transcript: ${formattedPath}`);
52056
52150
  console.log(`Summary target: ${summaryPath}`);
52057
52151
  }
52058
52152
 
52059
52153
  // src/commands/transcript/merge.ts
52060
- import { existsSync as existsSync93, writeFileSync as writeFileSync57 } from "fs";
52154
+ import { existsSync as existsSync95, writeFileSync as writeFileSync57 } from "fs";
52061
52155
  import { basename as basename32 } from "path";
52062
52156
 
52063
52157
  // src/commands/transcript/failTranscript.ts
@@ -52201,7 +52295,7 @@ function widenAudience(passages) {
52201
52295
 
52202
52296
  // src/commands/transcript/merge.ts
52203
52297
  function readSource3(file) {
52204
- if (!existsSync93(file)) failTranscript(`VTT file not found: ${file}`);
52298
+ if (!existsSync95(file)) failTranscript(`VTT file not found: ${file}`);
52205
52299
  const cues = readCleanedCues(file);
52206
52300
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
52207
52301
  return { path: file, name: basename32(file), cues };
@@ -52353,11 +52447,11 @@ function adviceFragments() {
52353
52447
 
52354
52448
  // src/commands/verify/blockCodeComments/findComments.ts
52355
52449
  import { execSync as execSync62 } from "child_process";
52356
- import fs69 from "fs";
52450
+ import fs70 from "fs";
52357
52451
  import { Project as Project6 } from "ts-morph";
52358
52452
 
52359
52453
  // src/commands/verify/blockCodeComments/collectFileComments.ts
52360
- import fs68 from "fs";
52454
+ import fs69 from "fs";
52361
52455
 
52362
52456
  // src/shared/isBicepFile.ts
52363
52457
  var BICEP_EXTENSIONS = [".bicep", ".bicepparam"];
@@ -52506,7 +52600,7 @@ function toFindings(file, lines, raw, exempt) {
52506
52600
 
52507
52601
  // src/commands/verify/blockCodeComments/collectFileComments.ts
52508
52602
  function collectFileComments(file, lines, project) {
52509
- const read4 = () => fs68.readFileSync(file, "utf8");
52603
+ const read4 = () => fs69.readFileSync(file, "utf8");
52510
52604
  if (isYamlFile(file))
52511
52605
  return toFindings(file, lines, collectYamlComments(read4()), false);
52512
52606
  if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
@@ -52587,7 +52681,7 @@ function shouldScan(file, ignoreGlobs) {
52587
52681
  if (!SCANNED_EXTENSIONS.some((ext) => file.endsWith(ext)) && !isHashCommentFile(file))
52588
52682
  return false;
52589
52683
  if (isCommentGateIgnored(file, ignoreGlobs)) return false;
52590
- return fs69.existsSync(file);
52684
+ return fs70.existsSync(file);
52591
52685
  }
52592
52686
  function findComments(options2) {
52593
52687
  const diff3 = execSync62("git diff HEAD", {
@@ -52673,13 +52767,13 @@ function configKeys2() {
52673
52767
  }
52674
52768
 
52675
52769
  // src/commands/verify/forbiddenStrings.ts
52676
- import { existsSync as existsSync94, readFileSync as readFileSync84 } from "fs";
52770
+ import { existsSync as existsSync96, readFileSync as readFileSync84 } from "fs";
52677
52771
 
52678
52772
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
52679
52773
  import { minimatch as minimatch10 } from "minimatch";
52680
- function resolveStringsAtPath(data, path126) {
52774
+ function resolveStringsAtPath(data, path128) {
52681
52775
  let current2 = data;
52682
- for (const segment of path126.split(".")) {
52776
+ for (const segment of path128.split(".")) {
52683
52777
  if (current2 === null || typeof current2 !== "object") return [];
52684
52778
  current2 = current2[segment];
52685
52779
  }
@@ -52692,10 +52786,10 @@ function resolveStringsAtPath(data, path126) {
52692
52786
  }
52693
52787
  function findRuleViolations(data, rule) {
52694
52788
  const violations = [];
52695
- for (const path126 of rule.paths) {
52696
- for (const value of resolveStringsAtPath(data, path126)) {
52789
+ for (const path128 of rule.paths) {
52790
+ for (const value of resolveStringsAtPath(data, path128)) {
52697
52791
  if (minimatch10(value, rule.disallowed))
52698
- violations.push({ file: rule.file, path: path126, value });
52792
+ violations.push({ file: rule.file, path: path128, value });
52699
52793
  }
52700
52794
  }
52701
52795
  return violations;
@@ -52714,7 +52808,7 @@ function forbiddenStrings() {
52714
52808
  const cache7 = /* @__PURE__ */ new Map();
52715
52809
  const readJson2 = (file) => {
52716
52810
  if (cache7.has(file)) return cache7.get(file);
52717
- if (!existsSync94(file)) {
52811
+ if (!existsSync96(file)) {
52718
52812
  console.log(`Forbidden-strings file not found: ${file}`);
52719
52813
  process.exit(1);
52720
52814
  }
@@ -52734,8 +52828,8 @@ function forbiddenStrings() {
52734
52828
  process.exit(0);
52735
52829
  }
52736
52830
  console.log("Forbidden strings found:\n");
52737
- for (const { file, path: path126, value } of violations) {
52738
- console.log(` ${file} ${path126}: ${value}`);
52831
+ for (const { file, path: path128, value } of violations) {
52832
+ console.log(` ${file} ${path128}: ${value}`);
52739
52833
  }
52740
52834
  console.log(`
52741
52835
  Total: ${violations.length} forbidden string(s).`);
@@ -52838,7 +52932,7 @@ async function harnessFollowUps() {
52838
52932
 
52839
52933
  // src/commands/verify/migrations.ts
52840
52934
  import { readFileSync as readFileSync85 } from "fs";
52841
- import path124 from "path";
52935
+ import path126 from "path";
52842
52936
 
52843
52937
  // src/commands/verify/migrations/checkAppendOnly.ts
52844
52938
  function checkAppendOnly(baseline, current2) {
@@ -52930,15 +53024,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
52930
53024
  } catch {
52931
53025
  return baseline;
52932
53026
  }
52933
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path126) => MIGRATION_FILE3.test(basename33(path126)));
52934
- for (const path126 of paths) {
53027
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path128) => MIGRATION_FILE3.test(basename33(path128)));
53028
+ for (const path128 of paths) {
52935
53029
  try {
52936
- const content = execSync63(`git show "${ref}:${path126}"`, {
53030
+ const content = execSync63(`git show "${ref}:${path128}"`, {
52937
53031
  encoding: "utf8",
52938
53032
  maxBuffer: 16 * 1024 * 1024,
52939
53033
  stdio: ["pipe", "pipe", "pipe"]
52940
53034
  });
52941
- baseline.set(basename33(path126), content);
53035
+ baseline.set(basename33(path128), content);
52942
53036
  } catch {
52943
53037
  }
52944
53038
  }
@@ -52977,11 +53071,11 @@ function resolveBaselineRef() {
52977
53071
  }
52978
53072
 
52979
53073
  // src/commands/verify/migrations/migrationsDir.ts
52980
- import path123 from "path";
53074
+ import path125 from "path";
52981
53075
  import { fileURLToPath as fileURLToPath10 } from "url";
52982
53076
  function migrationsDir() {
52983
- return path123.resolve(
52984
- path123.dirname(fileURLToPath10(import.meta.url)),
53077
+ return path125.resolve(
53078
+ path125.dirname(fileURLToPath10(import.meta.url)),
52985
53079
  "../../../shared/db/migrations"
52986
53080
  );
52987
53081
  }
@@ -53002,7 +53096,7 @@ function migrations2() {
53002
53096
  if (ref) {
53003
53097
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
53004
53098
  const current2 = new Map(
53005
- files.map((file) => [file, readFileSync85(path124.join(dir, file), "utf8")])
53099
+ files.map((file) => [file, readFileSync85(path126.join(dir, file), "utf8")])
53006
53100
  );
53007
53101
  for (const finding of checkAppendOnly(baseline, current2)) {
53008
53102
  problems.push(
@@ -53195,7 +53289,7 @@ function clearBuildPending() {
53195
53289
  }
53196
53290
 
53197
53291
  // src/commands/watch/isSyncPending.ts
53198
- import { existsSync as existsSync95 } from "fs";
53292
+ import { existsSync as existsSync97 } from "fs";
53199
53293
 
53200
53294
  // src/commands/watch/syncPendingPath.ts
53201
53295
  function syncPendingPath(cwd) {
@@ -53205,7 +53299,7 @@ function syncPendingPath(cwd) {
53205
53299
  // src/commands/watch/isSyncPending.ts
53206
53300
  function isSyncPending() {
53207
53301
  try {
53208
- return existsSync95(syncPendingPath());
53302
+ return existsSync97(syncPendingPath());
53209
53303
  } catch {
53210
53304
  return false;
53211
53305
  }
@@ -53332,7 +53426,7 @@ function resolveParams(params, cliArgs) {
53332
53426
  }
53333
53427
 
53334
53428
  // src/commands/run/resolveRunCwd.ts
53335
- import { existsSync as existsSync96 } from "fs";
53429
+ import { existsSync as existsSync98 } from "fs";
53336
53430
  import { resolve as resolve32 } from "path";
53337
53431
  var MissingRunCwdError = class extends Error {
53338
53432
  constructor(runName, cwd) {
@@ -53347,7 +53441,7 @@ var MissingRunCwdError = class extends Error {
53347
53441
  function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
53348
53442
  if (!config.cwd) return void 0;
53349
53443
  const cwd = resolve32(baseDir, config.cwd);
53350
- if (!existsSync96(cwd)) throw new MissingRunCwdError(config.name, cwd);
53444
+ if (!existsSync98(cwd)) throw new MissingRunCwdError(config.name, cwd);
53351
53445
  return cwd;
53352
53446
  }
53353
53447
 
@@ -53484,27 +53578,27 @@ function restartAdvice(paths) {
53484
53578
  // src/commands/watch/syncAdvice.ts
53485
53579
  var rules = [
53486
53580
  {
53487
- matches: (path126) => path126.startsWith("claude/commands/"),
53581
+ matches: (path128) => path128.startsWith("claude/commands/"),
53488
53582
  reason: "claude/commands changed"
53489
53583
  },
53490
53584
  {
53491
- matches: (path126) => path126.startsWith("claude/skills/"),
53585
+ matches: (path128) => path128.startsWith("claude/skills/"),
53492
53586
  reason: "claude/skills changed"
53493
53587
  },
53494
53588
  {
53495
- matches: (path126) => path126 === "claude/settings.json",
53589
+ matches: (path128) => path128 === "claude/settings.json",
53496
53590
  reason: "claude/settings.json changed"
53497
53591
  },
53498
53592
  {
53499
- matches: (path126) => path126 === "claude/design-system-prompt.md",
53593
+ matches: (path128) => path128 === "claude/design-system-prompt.md",
53500
53594
  reason: "claude/design-system-prompt.md changed"
53501
53595
  },
53502
53596
  {
53503
- matches: (path126) => path126.startsWith("codex/"),
53597
+ matches: (path128) => path128.startsWith("codex/"),
53504
53598
  reason: "codex sources changed"
53505
53599
  },
53506
53600
  {
53507
- matches: (path126) => path126.startsWith("pi/"),
53601
+ matches: (path128) => path128.startsWith("pi/"),
53508
53602
  reason: "pi sources changed"
53509
53603
  }
53510
53604
  ];
@@ -53682,11 +53776,11 @@ ${buildWatchReport(from)}`);
53682
53776
  }
53683
53777
 
53684
53778
  // src/commands/watch/consumeMarker.ts
53685
- import { existsSync as existsSync97, rmSync as rmSync15 } from "fs";
53686
- function consumeMarker(path126) {
53779
+ import { existsSync as existsSync99, rmSync as rmSync15 } from "fs";
53780
+ function consumeMarker(path128) {
53687
53781
  try {
53688
- if (!existsSync97(path126)) return false;
53689
- rmSync15(path126);
53782
+ if (!existsSync99(path128)) return false;
53783
+ rmSync15(path128);
53690
53784
  return true;
53691
53785
  } catch {
53692
53786
  return false;
@@ -53982,8 +54076,8 @@ function registerWatch(program) {
53982
54076
 
53983
54077
  // src/commands/roam/postRoamActivity.ts
53984
54078
  import { execFileSync as execFileSync32 } from "child_process";
53985
- import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as statSync17 } from "fs";
53986
- import { join as join121 } from "path";
54079
+ import { readdirSync as readdirSync27, readFileSync as readFileSync86, statSync as statSync18 } from "fs";
54080
+ import { join as join123 } from "path";
53987
54081
  function findPortFile(roamDir) {
53988
54082
  let entries;
53989
54083
  try {
@@ -53992,9 +54086,9 @@ function findPortFile(roamDir) {
53992
54086
  return void 0;
53993
54087
  }
53994
54088
  const candidates = entries.filter((name2) => /^roam-local-api(-[^.]+)?\.port$/.test(name2)).map((name2) => {
53995
- const path126 = join121(roamDir, name2);
54089
+ const path128 = join123(roamDir, name2);
53996
54090
  try {
53997
- return { path: path126, mtimeMs: statSync17(path126).mtimeMs };
54091
+ return { path: path128, mtimeMs: statSync18(path128).mtimeMs };
53998
54092
  } catch {
53999
54093
  return void 0;
54000
54094
  }
@@ -54009,7 +54103,7 @@ var PID_BY_APP = {
54009
54103
  function postRoamActivity(app, event) {
54010
54104
  const appData = process.env.APPDATA;
54011
54105
  if (!appData) return;
54012
- const portFile = findPortFile(join121(appData, "Roam"));
54106
+ const portFile = findPortFile(join123(appData, "Roam"));
54013
54107
  if (!portFile) return;
54014
54108
  let port;
54015
54109
  try {
@@ -54160,11 +54254,11 @@ function findLinkIndex() {
54160
54254
  function parseLinkArgs() {
54161
54255
  const idx = findLinkIndex();
54162
54256
  if (idx === -1) return null;
54163
- const path126 = process.argv[idx + 1];
54257
+ const path128 = process.argv[idx + 1];
54164
54258
  const rest = process.argv.slice(idx + 2);
54165
54259
  const { value: prefix2 } = extractOption(rest, "--prefix");
54166
54260
  if (!prefix2) return null;
54167
- return { path: path126, prefix: prefix2 };
54261
+ return { path: path128, prefix: prefix2 };
54168
54262
  }
54169
54263
  function hasDuplicateLink(runList, linkPath) {
54170
54264
  return runList.some(
@@ -54274,7 +54368,7 @@ function parseEnvPairs(pairs) {
54274
54368
  }
54275
54369
 
54276
54370
  // src/commands/run/parseParamSpecs.ts
54277
- function fail13(spec) {
54371
+ function fail12(spec) {
54278
54372
  console.error(
54279
54373
  `--param must be <name>, <name>! or <name>=<default>, got "${spec}"`
54280
54374
  );
@@ -54284,14 +54378,14 @@ function parseParamSpec(spec) {
54284
54378
  const eq60 = spec.indexOf("=");
54285
54379
  const name2 = eq60 === -1 ? spec : spec.slice(0, eq60);
54286
54380
  if (eq60 !== -1) {
54287
- if (eq60 === 0 || name2.endsWith("!")) fail13(spec);
54381
+ if (eq60 === 0 || name2.endsWith("!")) fail12(spec);
54288
54382
  return { name: name2, default: spec.slice(eq60 + 1) };
54289
54383
  }
54290
54384
  if (name2.endsWith("!")) {
54291
- if (name2.length === 1) fail13(spec);
54385
+ if (name2.length === 1) fail12(spec);
54292
54386
  return { name: name2.slice(0, -1), required: true };
54293
54387
  }
54294
- if (name2.length === 0) fail13(spec);
54388
+ if (name2.length === 0) fail12(spec);
54295
54389
  return { name: name2 };
54296
54390
  }
54297
54391
  function parseParamSpecs(specs) {
@@ -54336,8 +54430,8 @@ function extractAddArgs(addIndex) {
54336
54430
  const cwd = extractOption(filter.remaining, "--cwd");
54337
54431
  const port = extractOption(cwd.remaining, "--port");
54338
54432
  const protocol = extractOption(port.remaining, "--protocol");
54339
- const path126 = extractOption(protocol.remaining, "--path");
54340
- const server = extractOptionalValueFlag(path126.remaining, "--server");
54433
+ const path128 = extractOption(protocol.remaining, "--path");
54434
+ const server = extractOptionalValueFlag(path128.remaining, "--server");
54341
54435
  const repo = extractOptionalValueFlag(server.remaining, "--repo");
54342
54436
  return {
54343
54437
  name: process.argv[addIndex + 1],
@@ -54348,7 +54442,7 @@ function extractAddArgs(addIndex) {
54348
54442
  server: server.value,
54349
54443
  port: parsePort(port.value),
54350
54444
  protocol: parseProtocol(protocol.value),
54351
- path: path126.value,
54445
+ path: path128.value,
54352
54446
  env: parseEnvPairs(env.values),
54353
54447
  pre: pre.values.length > 0 ? pre.values : void 0,
54354
54448
  filter: filter.value,
@@ -54368,11 +54462,11 @@ function requireParsedArgs() {
54368
54462
  }
54369
54463
 
54370
54464
  // src/commands/run/runCommandFilePath.ts
54371
- import { join as join122 } from "path";
54465
+ import { join as join124 } from "path";
54372
54466
  function runCommandFilePath(name2) {
54373
54467
  const segments = name2.split(":");
54374
54468
  const file = `${segments.pop()}.md`;
54375
- return join122(".claude", "commands", ...segments, file);
54469
+ return join124(".claude", "commands", ...segments, file);
54376
54470
  }
54377
54471
 
54378
54472
  // src/commands/run/add.ts
@@ -54516,8 +54610,8 @@ function registerRunAdd(runCommand) {
54516
54610
  }
54517
54611
 
54518
54612
  // src/commands/run/remove.ts
54519
- import { existsSync as existsSync98, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
54520
- import { dirname as dirname52, join as join123 } from "path";
54613
+ import { existsSync as existsSync100, readdirSync as readdirSync28, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
54614
+ import { dirname as dirname52, join as join125 } from "path";
54521
54615
 
54522
54616
  // src/commands/run/removeRepoRunConfig.ts
54523
54617
  function isNamed(entry, name2) {
@@ -54535,19 +54629,19 @@ function removeRepoRunConfig(name2, repoName, cwd = process.cwd()) {
54535
54629
 
54536
54630
  // src/commands/run/remove.ts
54537
54631
  function removeEmptyNamespaceDirs(filePath) {
54538
- const root2 = join123(".claude", "commands");
54632
+ const root2 = join125(".claude", "commands");
54539
54633
  for (let dir = dirname52(filePath); dir !== root2; dir = dirname52(dir)) {
54540
- if (!existsSync98(dir) || readdirSync28(dir).length > 0) return;
54634
+ if (!existsSync100(dir) || readdirSync28(dir).length > 0) return;
54541
54635
  rmdirSync(dir);
54542
54636
  }
54543
54637
  }
54544
54638
  function deleteCommandFile(name2) {
54545
54639
  const filePath = runCommandFilePath(name2);
54546
- const legacyPath = join123(".claude", "commands", `${name2}.md`);
54547
- for (const path126 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
54548
- if (existsSync98(path126)) {
54549
- unlinkSync20(path126);
54550
- console.log(`Deleted command file: ${path126}`);
54640
+ const legacyPath = join125(".claude", "commands", `${name2}.md`);
54641
+ for (const path128 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
54642
+ if (existsSync100(path128)) {
54643
+ unlinkSync20(path128);
54644
+ console.log(`Deleted command file: ${path128}`);
54551
54645
  }
54552
54646
  }
54553
54647
  removeEmptyNamespaceDirs(filePath);
@@ -54600,18 +54694,18 @@ function registerRun(program) {
54600
54694
  }
54601
54695
 
54602
54696
  // src/commands/sessions/nodes/formatLink.ts
54603
- import chalk294 from "chalk";
54697
+ import chalk296 from "chalk";
54604
54698
  var STATE_COLOURS = {
54605
- connected: chalk294.green,
54606
- connecting: chalk294.yellow,
54607
- disconnected: chalk294.red,
54608
- "version-blocked": chalk294.red
54699
+ connected: chalk296.green,
54700
+ connecting: chalk296.yellow,
54701
+ disconnected: chalk296.red,
54702
+ "version-blocked": chalk296.red
54609
54703
  };
54610
54704
  function formatLink(link3) {
54611
- const colour = STATE_COLOURS[link3.state] ?? chalk294.white;
54705
+ const colour = STATE_COLOURS[link3.state] ?? chalk296.white;
54612
54706
  const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
54613
54707
  const error = link3.error ? `
54614
- ${chalk294.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
54708
+ ${chalk296.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
54615
54709
  return ` ${link3.name} ${colour(link3.state)} ${link3.url}${peer}${error}`;
54616
54710
  }
54617
54711
 
@@ -55283,12 +55377,12 @@ function toSessionViewInfo({
55283
55377
  }
55284
55378
 
55285
55379
  // src/commands/sessions/daemon/worktree/joinRefusal.ts
55286
- import { existsSync as existsSync99 } from "fs";
55380
+ import { existsSync as existsSync101 } from "fs";
55287
55381
  function joinRefusal(session) {
55288
55382
  if (session.commandType === "run") return "a server run has no agent stream";
55289
55383
  if (session.closing === true) return "the session is closing";
55290
55384
  if (!session.cwd) return "the session has no working directory";
55291
- if (!existsSync99(session.cwd))
55385
+ if (!existsSync101(session.cwd))
55292
55386
  return "the session's workspace no longer exists";
55293
55387
  return void 0;
55294
55388
  }
@@ -55378,8 +55472,8 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
55378
55472
  }
55379
55473
 
55380
55474
  // src/commands/sessions/daemon/findServerParents.ts
55381
- import { existsSync as existsSync100 } from "fs";
55382
- import { join as join124, resolve as resolve33 } from "path";
55475
+ import { existsSync as existsSync102 } from "fs";
55476
+ import { join as join126, resolve as resolve33 } from "path";
55383
55477
  function isLive(session) {
55384
55478
  return !!session.pty && session.status !== "done" && session.status !== "error";
55385
55479
  }
@@ -55388,7 +55482,7 @@ function isLiveAgent(session) {
55388
55482
  }
55389
55483
  function serverRunDirs(sessions, file) {
55390
55484
  return new Set(
55391
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync100(join124(dir, file)))
55485
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve33(s.cwd)).filter((dir) => existsSync102(join126(dir, file)))
55392
55486
  );
55393
55487
  }
55394
55488
  function findServerParents(sessions, file) {
@@ -55399,8 +55493,8 @@ function findServerParents(sessions, file) {
55399
55493
 
55400
55494
  // src/commands/sessions/daemon/lastWriteTimes.ts
55401
55495
  import { isAbsolute as isAbsolute8, resolve as resolve34 } from "path";
55402
- function normalise2(path126, cwd) {
55403
- const absolute2 = cwd && !isAbsolute8(path126) ? resolve34(cwd, path126) : path126;
55496
+ function normalise2(path128, cwd) {
55497
+ const absolute2 = cwd && !isAbsolute8(path128) ? resolve34(cwd, path128) : path128;
55404
55498
  return absolute2.replaceAll("\\", "/");
55405
55499
  }
55406
55500
  function latest(current2, at2) {
@@ -55417,10 +55511,10 @@ function lastWriteTimes(events, target, cwd) {
55417
55511
  for (const event of events) {
55418
55512
  const at2 = Date.parse(String(event.at));
55419
55513
  if (Number.isNaN(at2)) continue;
55420
- for (const path126 of writtenPaths(event).map((p) => normalise2(p, cwd))) {
55421
- if (path126.endsWith(`/${target.file}`))
55514
+ for (const path128 of writtenPaths(event).map((p) => normalise2(p, cwd))) {
55515
+ if (path128.endsWith(`/${target.file}`))
55422
55516
  result.file = latest(result.file, at2);
55423
- if (path126.includes(`/${target.within}`))
55517
+ if (path128.includes(`/${target.within}`))
55424
55518
  result.within = latest(result.within, at2);
55425
55519
  }
55426
55520
  }
@@ -56016,7 +56110,7 @@ var ClientHub = class extends Set {
56016
56110
  };
56017
56111
 
56018
56112
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
56019
- import { existsSync as existsSync101, rmSync as rmSync16, writeFileSync as writeFileSync62 } from "fs";
56113
+ import { existsSync as existsSync103, rmSync as rmSync16, writeFileSync as writeFileSync62 } from "fs";
56020
56114
  var paused;
56021
56115
  var wake;
56022
56116
  var holdReleased = false;
@@ -56029,7 +56123,7 @@ function persist2(value) {
56029
56123
  }
56030
56124
  var autoUpdateControl = {
56031
56125
  paused: () => {
56032
- paused ??= existsSync101(daemonPaths.autoUpdatePaused);
56126
+ paused ??= existsSync103(daemonPaths.autoUpdatePaused);
56033
56127
  return paused;
56034
56128
  },
56035
56129
  setPaused: (value) => {
@@ -56183,16 +56277,16 @@ import { readFileSync as readFileSync88, writeFileSync as writeFileSync63 } from
56183
56277
  var KEEP_TAIL = 256 * 1024;
56184
56278
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
56185
56279
  function trimWatcherLog(cwd) {
56186
- const path126 = watcherLogPath(cwd);
56280
+ const path128 = watcherLogPath(cwd);
56187
56281
  let log2;
56188
56282
  try {
56189
- log2 = readFileSync88(path126, "utf8");
56283
+ log2 = readFileSync88(path128, "utf8");
56190
56284
  } catch {
56191
56285
  return;
56192
56286
  }
56193
56287
  if (log2.length <= MAX_LOG_SIZE) return;
56194
- writeFileSync63(path126, log2.slice(-KEEP_TAIL));
56195
- daemonLog(`auto-update: log ${path126} trimmed to its last ${KEEP_TAIL} chars`);
56288
+ writeFileSync63(path128, log2.slice(-KEEP_TAIL));
56289
+ daemonLog(`auto-update: log ${path128} trimmed to its last ${KEEP_TAIL} chars`);
56196
56290
  }
56197
56291
 
56198
56292
  // src/commands/sessions/daemon/worktree/appendWatcherLog.ts
@@ -56200,20 +56294,20 @@ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync42 } from "fs"
56200
56294
  import { dirname as dirname53 } from "path";
56201
56295
  function appendWatcherLog(cwd, data) {
56202
56296
  try {
56203
- const path126 = watcherLogPath(cwd);
56204
- mkdirSync42(dirname53(path126), { recursive: true });
56205
- appendFileSync4(path126, data);
56297
+ const path128 = watcherLogPath(cwd);
56298
+ mkdirSync42(dirname53(path128), { recursive: true });
56299
+ appendFileSync4(path128, data);
56206
56300
  } catch {
56207
56301
  }
56208
56302
  }
56209
56303
 
56210
56304
  // src/commands/sessions/daemon/designSystemPromptPath.ts
56211
- import * as path125 from "path";
56305
+ import * as path127 from "path";
56212
56306
  import { fileURLToPath as fileURLToPath11 } from "url";
56213
56307
  var __filename6 = fileURLToPath11(import.meta.url);
56214
- var __dirname7 = path125.dirname(__filename6);
56308
+ var __dirname7 = path127.dirname(__filename6);
56215
56309
  function designSystemPromptPath() {
56216
- return path125.join(__dirname7, "..", "claude", "design-system-prompt.md");
56310
+ return path127.join(__dirname7, "..", "claude", "design-system-prompt.md");
56217
56311
  }
56218
56312
 
56219
56313
  // src/commands/sessions/daemon/sessionModeLaunch.ts
@@ -56300,27 +56394,27 @@ function detectExistingWorktree(cwd) {
56300
56394
 
56301
56395
  // src/commands/sessions/daemon/worktree/noteWorktreeHarness.ts
56302
56396
  function noteWorktreeHarness(session) {
56303
- const path126 = session.worktree?.path;
56304
- if (!path126) return;
56397
+ const path128 = session.worktree?.path;
56398
+ if (!path128) return;
56305
56399
  const harness = session.commandType === "claude" ? resolveHarness(session.harness) : session.harness;
56306
56400
  if (!harness) return;
56307
56401
  try {
56308
- recordWorktreeHarness(path126, harness);
56402
+ recordWorktreeHarness(path128, harness);
56309
56403
  } catch (error) {
56310
56404
  daemonLog(
56311
- `worktree ${path126} harness ${harness} not recorded for session ${session.id}: ${error instanceof Error ? error.message : String(error)}`
56405
+ `worktree ${path128} harness ${harness} not recorded for session ${session.id}: ${error instanceof Error ? error.message : String(error)}`
56312
56406
  );
56313
56407
  }
56314
56408
  }
56315
56409
 
56316
56410
  // src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
56317
- function refuseUnallocatedStart(session, path126, error, startHeld) {
56411
+ function refuseUnallocatedStart(session, path128, error, startHeld) {
56318
56412
  const reason4 = error instanceof Error ? error.message : String(error);
56319
56413
  daemonLog(
56320
- `session ${session.id} worktree ${path126} could not be created: ${reason4}`
56414
+ `session ${session.id} worktree ${path128} could not be created: ${reason4}`
56321
56415
  );
56322
56416
  session.pendingStart = () => {
56323
- throw new Error(`worktree ${path126} could not be created: ${reason4}`);
56417
+ throw new Error(`worktree ${path128} could not be created: ${reason4}`);
56324
56418
  };
56325
56419
  startHeld(session);
56326
56420
  }
@@ -56342,9 +56436,9 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
56342
56436
  }
56343
56437
  notify2();
56344
56438
  }
56345
- function seedHeldSession(session, path126, clone, notify2, startHeld) {
56439
+ function seedHeldSession(session, path128, clone, notify2, startHeld) {
56346
56440
  seedWorktree(
56347
- path126,
56441
+ path128,
56348
56442
  clone,
56349
56443
  () => {
56350
56444
  session.seeding = void 0;
@@ -56372,13 +56466,13 @@ function bindResumedWorktree(session, cwd, notify2) {
56372
56466
  }
56373
56467
 
56374
56468
  // src/commands/sessions/daemon/worktree/treeDurability.ts
56375
- import { existsSync as existsSync103 } from "fs";
56469
+ import { existsSync as existsSync105 } from "fs";
56376
56470
 
56377
56471
  // src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
56378
- import { existsSync as existsSync102 } from "fs";
56379
- import { join as join126 } from "path";
56380
- function holdsNoCheckout(path126) {
56381
- return existsSync102(path126) && !existsSync102(join126(path126, ".git"));
56472
+ import { existsSync as existsSync104 } from "fs";
56473
+ import { join as join128 } from "path";
56474
+ function holdsNoCheckout(path128) {
56475
+ return existsSync104(path128) && !existsSync104(join128(path128, ".git"));
56382
56476
  }
56383
56477
 
56384
56478
  // src/commands/sessions/daemon/worktree/treeDurability.ts
@@ -56416,14 +56510,14 @@ function notACheckout(cwd, error) {
56416
56510
  return holdsNoCheckout(cwd) && /not a git repository/i.test(error);
56417
56511
  }
56418
56512
  async function checkDurability(cwd) {
56419
- if (!existsSync103(cwd)) return treeIsGone;
56513
+ if (!existsSync105(cwd)) return treeIsGone;
56420
56514
  const probes = durabilityProbes(cwd);
56421
56515
  let step3 = probes.next();
56422
56516
  while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
56423
56517
  return step3.value;
56424
56518
  }
56425
56519
  function checkDurabilitySync(cwd) {
56426
- if (!existsSync103(cwd)) return treeIsGone;
56520
+ if (!existsSync105(cwd)) return treeIsGone;
56427
56521
  const probes = durabilityProbes(cwd);
56428
56522
  let step3 = probes.next();
56429
56523
  while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
@@ -56585,8 +56679,8 @@ import { rmSync as rmSync17 } from "fs";
56585
56679
  function clearLapSignals(cwd) {
56586
56680
  const control = watchControlPaths(cwd);
56587
56681
  if (!control) return;
56588
- for (const path126 of [control.check, control.stop])
56589
- rmSync17(path126, { force: true });
56682
+ for (const path128 of [control.check, control.stop])
56683
+ rmSync17(path128, { force: true });
56590
56684
  }
56591
56685
  function runUpdateLap(cwd, onOutput) {
56592
56686
  clearLapSignals(cwd);
@@ -56716,17 +56810,17 @@ function setStatus2(session, newStatus) {
56716
56810
  }
56717
56811
 
56718
56812
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
56719
- import { existsSync as existsSync105 } from "fs";
56813
+ import { existsSync as existsSync107 } from "fs";
56720
56814
  import { basename as basename34 } from "path";
56721
56815
 
56722
56816
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
56723
- import { existsSync as existsSync104 } from "fs";
56724
- import { join as join128 } from "path";
56817
+ import { existsSync as existsSync106 } from "fs";
56818
+ import { join as join130 } from "path";
56725
56819
 
56726
56820
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
56727
- import { statSync as statSync18 } from "fs";
56821
+ import { statSync as statSync19 } from "fs";
56728
56822
  import { rm as rm3 } from "fs/promises";
56729
- import { join as join127 } from "path";
56823
+ import { join as join129 } from "path";
56730
56824
  async function deleteTreeDirectly(clone, worktreePath, why) {
56731
56825
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
56732
56826
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -56755,7 +56849,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
56755
56849
  return { removed: true };
56756
56850
  }
56757
56851
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
56758
- return statSync18(join127(worktreePath, ".git"), {
56852
+ return statSync19(join129(worktreePath, ".git"), {
56759
56853
  throwIfNoEntry: false
56760
56854
  })?.isDirectory() === true;
56761
56855
  }
@@ -56796,7 +56890,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
56796
56890
  );
56797
56891
  }
56798
56892
  function strandedReason(worktreePath, cause) {
56799
- if (!existsSync104(join128(worktreePath, ".git")))
56893
+ if (!existsSync106(join130(worktreePath, ".git")))
56800
56894
  return "its .git link is already gone";
56801
56895
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
56802
56896
  return "git no longer recognises it as a working tree";
@@ -56848,7 +56942,7 @@ function reason3(error) {
56848
56942
 
56849
56943
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
56850
56944
  async function reapWorktree(worktreePath, force = false) {
56851
- if (!existsSync105(worktreePath)) {
56945
+ if (!existsSync107(worktreePath)) {
56852
56946
  forgetWorktree(worktreePath);
56853
56947
  daemonLog(
56854
56948
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -56873,7 +56967,7 @@ async function reapWorktree(worktreePath, force = false) {
56873
56967
  }
56874
56968
  function owningClone(worktreePath) {
56875
56969
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
56876
- if (recorded && existsSync105(recorded)) return recorded;
56970
+ if (recorded && existsSync107(recorded)) return recorded;
56877
56971
  const detected = mainWorktree(worktreePath);
56878
56972
  if (detected) return detected;
56879
56973
  daemonLog(
@@ -56923,11 +57017,11 @@ function holdFailedDiscard(session, reason4, notify2) {
56923
57017
  notify2();
56924
57018
  }
56925
57019
  function releaseUndeletableLeftover(session, reason4, notify2) {
56926
- const path126 = session.worktree?.path;
57020
+ const path128 = session.worktree?.path;
56927
57021
  daemonLog(
56928
- `session ${session.id} discard could not delete ${path126}, which holds no git checkout and so no work: ${reason4}; card released to error so it can be dismissed`
57022
+ `session ${session.id} discard could not delete ${path128}, which holds no git checkout and so no work: ${reason4}; card released to error so it can be dismissed`
56929
57023
  );
56930
- const message4 = `Discard could not delete ${path126}: ${reason4}`;
57024
+ const message4 = `Discard could not delete ${path128}: ${reason4}`;
56931
57025
  if (session.worktree) session.releasedFromClone = session.worktree.clone;
56932
57026
  session.worktree = void 0;
56933
57027
  session.closing = void 0;
@@ -57154,7 +57248,7 @@ function underVsCode(pid, procRoot) {
57154
57248
  let current2 = pid;
57155
57249
  for (let depth = 0; current2 && current2 > 1 && depth < MAX_ANCESTORS; depth++) {
57156
57250
  const cmdline = readProc(procRoot, current2, "cmdline");
57157
- if (cmdline && VSCODE_PATHS.some((path126) => cmdline.includes(path126)))
57251
+ if (cmdline && VSCODE_PATHS.some((path128) => cmdline.includes(path128)))
57158
57252
  return true;
57159
57253
  current2 = parentPid(readProc(procRoot, current2, "stat"));
57160
57254
  }
@@ -57190,12 +57284,12 @@ async function closeBlockReason(sessionId2, tree) {
57190
57284
  }
57191
57285
 
57192
57286
  // src/commands/sessions/daemon/worktree/watchGitState.ts
57193
- import { existsSync as existsSync106, watch } from "fs";
57287
+ import { existsSync as existsSync108, watch } from "fs";
57194
57288
  var DEBOUNCE_MS = 500;
57195
57289
  var POLL_MS5 = 3e4;
57196
57290
  function watchGitState(cwd, onChange) {
57197
57291
  const common = gitCommonDir(cwd);
57198
- if (!common || !existsSync106(common)) return void 0;
57292
+ if (!common || !existsSync108(common)) return void 0;
57199
57293
  const watchers = [
57200
57294
  watchGitDir(common, onChange),
57201
57295
  pollGitState(cwd, onChange)
@@ -57959,7 +58053,7 @@ function emitSessionOutput(session, clients, data) {
57959
58053
  }
57960
58054
 
57961
58055
  // src/commands/sessions/daemon/exitReason.ts
57962
- import { existsSync as existsSync107 } from "fs";
58056
+ import { existsSync as existsSync109 } from "fs";
57963
58057
  import { resolve as resolve35 } from "path";
57964
58058
 
57965
58059
  // src/commands/sessions/daemon/resolveRunConfig.ts
@@ -57978,7 +58072,7 @@ function resolveRunConfig(name2, cwd) {
57978
58072
 
57979
58073
  // src/commands/sessions/daemon/exitReason.ts
57980
58074
  function exitDetail(session) {
57981
- if (session.cwd && !existsSync107(session.cwd))
58075
+ if (session.cwd && !existsSync109(session.cwd))
57982
58076
  return `working directory ${session.cwd} no longer exists`;
57983
58077
  return missingRunConfigCwd(session);
57984
58078
  }
@@ -57992,7 +58086,7 @@ function missingRunConfigCwd(session) {
57992
58086
  const config = resolveRunConfig(session.runName, dir);
57993
58087
  if (!config?.cwd) return void 0;
57994
58088
  const configured = resolve35(runConfigBaseDirFrom(dir), config.cwd);
57995
- if (existsSync107(configured)) return void 0;
58089
+ if (existsSync109(configured)) return void 0;
57996
58090
  return `run config "${config.name}": cwd ${configured} does not exist`;
57997
58091
  }
57998
58092
 
@@ -58040,7 +58134,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
58040
58134
  }
58041
58135
 
58042
58136
  // src/commands/sessions/daemon/watchActivity.ts
58043
- import { existsSync as existsSync108, mkdirSync as mkdirSync43, watch as watch2 } from "fs";
58137
+ import { existsSync as existsSync110, mkdirSync as mkdirSync43, watch as watch2 } from "fs";
58044
58138
  import { dirname as dirname55 } from "path";
58045
58139
 
58046
58140
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -58224,8 +58318,8 @@ async function seedRunningMsFromUsage(session, notify2) {
58224
58318
  var DEBOUNCE_MS2 = 50;
58225
58319
  function watchActivity(session, notify2, onConversation) {
58226
58320
  if (session.commandType !== "assist" || !session.cwd) return;
58227
- const path126 = activityPath(session.id);
58228
- const dir = dirname55(path126);
58321
+ const path128 = activityPath(session.id);
58322
+ const dir = dirname55(path128);
58229
58323
  try {
58230
58324
  mkdirSync43(dir, { recursive: true });
58231
58325
  } catch {
@@ -58235,7 +58329,7 @@ function watchActivity(session, notify2, onConversation) {
58235
58329
  let timer = null;
58236
58330
  const read4 = () => {
58237
58331
  timer = null;
58238
- const activity2 = readActivity(path126);
58332
+ const activity2 = readActivity(path128);
58239
58333
  if (!activity2) return;
58240
58334
  applyLaunchActivity(session, activity2, notify2, onConversation);
58241
58335
  if (activity2.claudeSessionId) onConversation?.(session);
@@ -58244,11 +58338,11 @@ function watchActivity(session, notify2, onConversation) {
58244
58338
  notify2();
58245
58339
  };
58246
58340
  session.activityWatcher = watch2(dir, (_event, filename) => {
58247
- if (filename && !path126.endsWith(filename)) return;
58341
+ if (filename && !path128.endsWith(filename)) return;
58248
58342
  if (timer) clearTimeout(timer);
58249
58343
  timer = setTimeout(read4, DEBOUNCE_MS2);
58250
58344
  });
58251
- if (existsSync108(path126)) read4();
58345
+ if (existsSync110(path128)) read4();
58252
58346
  }
58253
58347
  function refreshActivity(session) {
58254
58348
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -58637,7 +58731,7 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
58637
58731
  }
58638
58732
 
58639
58733
  // src/commands/sessions/shared/transcriptUsage.ts
58640
- import * as fs70 from "fs";
58734
+ import * as fs71 from "fs";
58641
58735
  function transcriptUsage(lines) {
58642
58736
  const byId = /* @__PURE__ */ new Map();
58643
58737
  for (const line of lines) {
@@ -58661,7 +58755,7 @@ function transcriptUsage(lines) {
58661
58755
  return [...byId.values()];
58662
58756
  }
58663
58757
  async function readTranscriptUsage(transcriptPath) {
58664
- const content = await fs70.promises.readFile(transcriptPath, "utf8");
58758
+ const content = await fs71.promises.readFile(transcriptPath, "utf8");
58665
58759
  return transcriptUsage(content.split("\n"));
58666
58760
  }
58667
58761
 
@@ -59030,13 +59124,13 @@ var WIP_COMMIT = [
59030
59124
  "-m",
59031
59125
  "assist transfer WIP"
59032
59126
  ];
59033
- async function currentBranch6(path126, treeRoot) {
59034
- const branch2 = await gitOrNull(path126, ["symbolic-ref", "--short", "HEAD"]);
59127
+ async function currentBranch6(path128, treeRoot) {
59128
+ const branch2 = await gitOrNull(path128, ["symbolic-ref", "--short", "HEAD"]);
59035
59129
  if (!branch2 || treeRoot && branch2 === basename35(treeRoot)) return void 0;
59036
59130
  return branch2;
59037
59131
  }
59038
- async function upstreamBranch2(path126) {
59039
- const upstream = await gitOrNull(path126, [
59132
+ async function upstreamBranch2(path128) {
59133
+ const upstream = await gitOrNull(path128, [
59040
59134
  "rev-parse",
59041
59135
  "--abbrev-ref",
59042
59136
  "--symbolic-full-name",
@@ -59045,32 +59139,32 @@ async function upstreamBranch2(path126) {
59045
59139
  if (!upstream?.startsWith("origin/")) return void 0;
59046
59140
  return upstream.slice("origin/".length);
59047
59141
  }
59048
- async function pushTransferSnapshot(path126, itemId2, treeRoot) {
59142
+ async function pushTransferSnapshot(path128, itemId2, treeRoot) {
59049
59143
  const ref = transferRefFor(itemId2);
59050
- const branch2 = await currentBranch6(path126, treeRoot);
59051
- const upstream = await upstreamBranch2(path126);
59052
- const head = (await git2(path126, ["rev-parse", "HEAD"])).trim();
59053
- await git2(path126, ["add", "-A"]);
59144
+ const branch2 = await currentBranch6(path128, treeRoot);
59145
+ const upstream = await upstreamBranch2(path128);
59146
+ const head = (await git2(path128, ["rev-parse", "HEAD"])).trim();
59147
+ await git2(path128, ["add", "-A"]);
59054
59148
  try {
59055
- await git2(path126, WIP_COMMIT);
59149
+ await git2(path128, WIP_COMMIT);
59056
59150
  await git2(
59057
- path126,
59151
+ path128,
59058
59152
  ["push", "--no-verify", "--force", "origin", `HEAD:refs/heads/${ref}`],
59059
59153
  PUSH_TIMEOUT_MS
59060
59154
  );
59061
59155
  } finally {
59062
- await git2(path126, ["reset", "--mixed", "--quiet", head]);
59156
+ await git2(path128, ["reset", "--mixed", "--quiet", head]);
59063
59157
  }
59064
59158
  return { ref, branch: branch2, upstream };
59065
59159
  }
59066
59160
 
59067
59161
  // src/commands/sessions/daemon/transfer/snapshotTree.ts
59068
59162
  async function snapshotTree(s, args, traceId) {
59069
- const path126 = s.worktree?.path ?? s.cwd;
59070
- if (!path126) return void 0;
59071
- const snapshot2 = await pushTransferSnapshot(path126, args[2], s.worktree?.path);
59163
+ const path128 = s.worktree?.path ?? s.cwd;
59164
+ if (!path128) return void 0;
59165
+ const snapshot2 = await pushTransferSnapshot(path128, args[2], s.worktree?.path);
59072
59166
  daemonLog(
59073
- `session ${s.id} pushed ${path126} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
59167
+ `session ${s.id} pushed ${path128} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
59074
59168
  );
59075
59169
  return snapshot2;
59076
59170
  }
@@ -59672,9 +59766,9 @@ function tempRoots() {
59672
59766
  }
59673
59767
  return [...roots];
59674
59768
  }
59675
- function underTempRoot(path126) {
59769
+ function underTempRoot(path128) {
59676
59770
  return tempRoots().some(
59677
- (root2) => path126.startsWith(root2.endsWith(sep7) ? root2 : root2 + sep7)
59771
+ (root2) => path128.startsWith(root2.endsWith(sep7) ? root2 : root2 + sep7)
59678
59772
  );
59679
59773
  }
59680
59774
 
@@ -60193,7 +60287,7 @@ function rearmStoppedSessions(sessions, notify2) {
60193
60287
  }
60194
60288
 
60195
60289
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
60196
- import { existsSync as existsSync110 } from "fs";
60290
+ import { existsSync as existsSync112 } from "fs";
60197
60291
  import { basename as basename37 } from "path";
60198
60292
 
60199
60293
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
@@ -60214,18 +60308,18 @@ function accountedTrees(sessions) {
60214
60308
  }
60215
60309
 
60216
60310
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
60217
- import { existsSync as existsSync109 } from "fs";
60311
+ import { existsSync as existsSync111 } from "fs";
60218
60312
  async function reclaimVanishedWorktrees(clone, paths) {
60219
- if (!existsSync109(clone)) {
60220
- for (const { path: path126 } of paths) forgetWorktree(path126);
60313
+ if (!existsSync111(clone)) {
60314
+ for (const { path: path128 } of paths) forgetWorktree(path128);
60221
60315
  daemonLog(
60222
60316
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
60223
60317
  );
60224
60318
  return;
60225
60319
  }
60226
60320
  await pruneBookkeeping2(clone);
60227
- for (const { path: path126, branch: branch2 } of paths)
60228
- if (await reclaimBranch(clone, branch2)) forgetWorktree(path126);
60321
+ for (const { path: path128, branch: branch2 } of paths)
60322
+ if (await reclaimBranch(clone, branch2)) forgetWorktree(path128);
60229
60323
  }
60230
60324
  async function pruneBookkeeping2(clone) {
60231
60325
  try {
@@ -60252,37 +60346,37 @@ async function reclaimBranch(clone, branch2) {
60252
60346
  }
60253
60347
 
60254
60348
  // src/commands/sessions/daemon/worktree/logVanishedTree.ts
60255
- function logVanishedTree(sessions, path126) {
60349
+ function logVanishedTree(sessions, path128) {
60256
60350
  const claimants = [...sessions.values()].filter(
60257
- (s) => s.cwd === path126 || s.worktree?.path === path126
60351
+ (s) => s.cwd === path128 || s.worktree?.path === path128
60258
60352
  );
60259
60353
  if (claimants.length === 0) {
60260
- daemonLog(`worktree ${path126} gone from disk and unclaimed; reclaiming it`);
60354
+ daemonLog(`worktree ${path128} gone from disk and unclaimed; reclaiming it`);
60261
60355
  return;
60262
60356
  }
60263
60357
  for (const s of claimants)
60264
60358
  daemonLog(
60265
- `session ${s.id} ("${s.name}") claims worktree ${path126}, which is gone from disk; reclaiming it`
60359
+ `session ${s.id} ("${s.name}") claims worktree ${path128}, which is gone from disk; reclaiming it`
60266
60360
  );
60267
60361
  }
60268
60362
 
60269
60363
  // src/commands/sessions/daemon/worktree/describeHeldWork.ts
60270
60364
  var MAX_ITEMS = 20;
60271
- async function describeHeldWork(path126, reason4) {
60272
- if (reason4.startsWith("uncommitted")) return await changedFiles(path126);
60273
- if (reason4.startsWith("unpushed")) return await unpushedCommits(path126, reason4);
60365
+ async function describeHeldWork(path128, reason4) {
60366
+ if (reason4.startsWith("uncommitted")) return await changedFiles(path128);
60367
+ if (reason4.startsWith("unpushed")) return await unpushedCommits(path128, reason4);
60274
60368
  return { summary: reason4, items: [] };
60275
60369
  }
60276
- async function changedFiles(path126) {
60277
- const status2 = await gitResult(path126, ["status", "--porcelain"]);
60370
+ async function changedFiles(path128) {
60371
+ const status2 = await gitResult(path128, ["status", "--porcelain"]);
60278
60372
  const lines = status2.ok ? nonEmptyLines(status2.out) : [];
60279
60373
  return {
60280
60374
  summary: `${lines.length} uncommitted ${lines.length === 1 ? "file" : "files"}`,
60281
60375
  items: capped2(lines)
60282
60376
  };
60283
60377
  }
60284
- async function unpushedCommits(path126, reason4) {
60285
- const log2 = await gitResult(path126, ["log", "--oneline", "@{upstream}..HEAD"]);
60378
+ async function unpushedCommits(path128, reason4) {
60379
+ const log2 = await gitResult(path128, ["log", "--oneline", "@{upstream}..HEAD"]);
60286
60380
  if (!log2.ok) return { summary: reason4, items: [] };
60287
60381
  const lines = nonEmptyLines(log2.out);
60288
60382
  return {
@@ -60375,24 +60469,24 @@ function reconcileWorktreesOnRestore(sessions, spawnWith, notify2) {
60375
60469
  async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
60376
60470
  const accounted = accountedTrees(sessions);
60377
60471
  const vanished = /* @__PURE__ */ new Map();
60378
- for (const { path: path126, clone, harness } of readWorktreeRegistry()) {
60379
- if (underTempRoot(path126)) {
60380
- forgetWorktree(path126);
60472
+ for (const { path: path128, clone, harness } of readWorktreeRegistry()) {
60473
+ if (underTempRoot(path128)) {
60474
+ forgetWorktree(path128);
60381
60475
  daemonLog(
60382
- `worktree ${path126} lies outside any project root; pruned from the registry rather than recovered`
60476
+ `worktree ${path128} lies outside any project root; pruned from the registry rather than recovered`
60383
60477
  );
60384
60478
  continue;
60385
60479
  }
60386
- if (!existsSync110(path126)) {
60387
- logVanishedTree(sessions, path126);
60480
+ if (!existsSync112(path128)) {
60481
+ logVanishedTree(sessions, path128);
60388
60482
  vanished.set(clone, [
60389
60483
  ...vanished.get(clone) ?? [],
60390
- { path: path126, branch: basename37(path126) }
60484
+ { path: path128, branch: basename37(path128) }
60391
60485
  ]);
60392
60486
  continue;
60393
60487
  }
60394
- if (accounted.has(path126)) continue;
60395
- await recoverOrphan(sessions, spawnWith, { path: path126, clone, harness }, notify2);
60488
+ if (accounted.has(path128)) continue;
60489
+ await recoverOrphan(sessions, spawnWith, { path: path128, clone, harness }, notify2);
60396
60490
  }
60397
60491
  for (const [clone, paths] of vanished)
60398
60492
  await reclaimVanishedWorktrees(clone, paths);
@@ -60410,13 +60504,13 @@ function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
60410
60504
  // src/commands/sessions/daemon/worktree/reseedRestoredWorktrees.ts
60411
60505
  function reseedRestoredWorktrees(deps2) {
60412
60506
  const { sessions, clients, onStatusChange, notify: notify2 } = deps2;
60413
- for (const [path126, { session, clone }] of heldTrees(sessions)) {
60507
+ for (const [path128, { session, clone }] of heldTrees(sessions)) {
60414
60508
  daemonLog(
60415
- `session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path126} before starting it`
60509
+ `session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path128} before starting it`
60416
60510
  );
60417
60511
  seedHeldSession(
60418
60512
  session,
60419
- path126,
60513
+ path128,
60420
60514
  clone,
60421
60515
  notify2,
60422
60516
  (seeded) => startHeldInTree(seeded, sessions, clients, onStatusChange, notify2)
@@ -61657,7 +61751,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
61657
61751
  }
61658
61752
 
61659
61753
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
61660
- import { existsSync as existsSync112 } from "fs";
61754
+ import { existsSync as existsSync114 } from "fs";
61661
61755
 
61662
61756
  // src/commands/sessions/daemon/resumeSession.ts
61663
61757
  function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
@@ -61687,7 +61781,7 @@ function resumeSession(id, sessionId2, cwd, name2, holdPty, harness) {
61687
61781
  }
61688
61782
 
61689
61783
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
61690
- import { existsSync as existsSync111 } from "fs";
61784
+ import { existsSync as existsSync113 } from "fs";
61691
61785
  function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness) {
61692
61786
  const adapter = harnessAdapter(harness);
61693
61787
  const blocker = launchBlocker(adapter, conversationRecoveryFeature);
@@ -61722,7 +61816,7 @@ function resumeInReplacementTree(ctx, conversationId, missingCwd, name2, harness
61722
61816
  }
61723
61817
  function cloneForReapedTree(missingCwd) {
61724
61818
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
61725
- if (!clone || !existsSync111(clone))
61819
+ if (!clone || !existsSync113(clone))
61726
61820
  throw new Error(
61727
61821
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
61728
61822
  );
@@ -61731,7 +61825,7 @@ function cloneForReapedTree(missingCwd) {
61731
61825
 
61732
61826
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
61733
61827
  function resumeInTree(ctx, sessionId2, cwd, name2, harness) {
61734
- if (!existsSync112(cwd))
61828
+ if (!existsSync114(cwd))
61735
61829
  return resumeInReplacementTree(ctx, sessionId2, cwd, name2, harness);
61736
61830
  const blocker = launchBlocker(
61737
61831
  harnessAdapter(harness),
@@ -61938,13 +62032,13 @@ import {
61938
62032
  } from "fs";
61939
62033
  var MB = 1024 * 1024;
61940
62034
  function trimDaemonLog({
61941
- path: path126 = daemonPaths.log,
62035
+ path: path128 = daemonPaths.log,
61942
62036
  maxBytes = 50 * MB,
61943
62037
  keepBytes = 25 * MB
61944
62038
  } = {}) {
61945
62039
  let fd;
61946
62040
  try {
61947
- fd = openSync8(path126, "r+");
62041
+ fd = openSync8(path128, "r+");
61948
62042
  } catch {
61949
62043
  return void 0;
61950
62044
  }
@@ -62110,7 +62204,7 @@ var handleWebLog = (client, _m, d) => {
62110
62204
  };
62111
62205
 
62112
62206
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
62113
- import * as fs71 from "fs";
62207
+ import * as fs72 from "fs";
62114
62208
  import * as readline5 from "readline";
62115
62209
 
62116
62210
  // src/commands/sessions/daemon/historySearch/historySnippet.ts
@@ -62171,7 +62265,7 @@ function queryPattern(query) {
62171
62265
  async function findTranscriptMatch(filePath, harness, query) {
62172
62266
  const pattern2 = queryPattern(query);
62173
62267
  const mayMatch = rawLinePrefilter(query);
62174
- const stream = fs71.createReadStream(filePath, { encoding: "utf8" });
62268
+ const stream = fs72.createReadStream(filePath, { encoding: "utf8" });
62175
62269
  const reader = readline5.createInterface({
62176
62270
  input: stream,
62177
62271
  crlfDelay: Infinity
@@ -62252,7 +62346,7 @@ function creator(isNew, spawn14) {
62252
62346
  }
62253
62347
  sendTo(client, { type: "created", sessionId: result, isNew, traceId });
62254
62348
  };
62255
- const fail15 = (client, d, error) => {
62349
+ const fail14 = (client, d, error) => {
62256
62350
  const reason4 = error instanceof Error ? error.message : String(error);
62257
62351
  daemonLog(`${d.type} failed: ${reason4}`);
62258
62352
  reply2(client, d, { error: `${d.type} failed: ${reason4}` });
@@ -62263,20 +62357,20 @@ function creator(isNew, spawn14) {
62263
62357
  try {
62264
62358
  result = spawn14(m, d);
62265
62359
  } catch (error) {
62266
- fail15(client, d, error);
62360
+ fail14(client, d, error);
62267
62361
  return;
62268
62362
  }
62269
62363
  if (result instanceof Promise)
62270
62364
  result.then(
62271
62365
  (resolved) => reply2(client, d, resolved),
62272
- (error) => fail15(client, d, error)
62366
+ (error) => fail14(client, d, error)
62273
62367
  );
62274
62368
  else reply2(client, d, result);
62275
62369
  };
62276
62370
  }
62277
62371
 
62278
62372
  // src/commands/sessions/shared/codex/codexRolloutUsage.ts
62279
- import * as fs72 from "fs";
62373
+ import * as fs73 from "fs";
62280
62374
 
62281
62375
  // src/commands/sessions/shared/codex/applyTokenInfo.ts
62282
62376
  function applyTokenInfo(usage, byId, conversationId, rawInfo) {
@@ -62339,7 +62433,7 @@ function codexRolloutUsage(lines) {
62339
62433
  return usage;
62340
62434
  }
62341
62435
  async function readCodexRolloutUsage(rolloutPath) {
62342
- const content = await fs72.promises.readFile(rolloutPath, "utf8");
62436
+ const content = await fs73.promises.readFile(rolloutPath, "utf8");
62343
62437
  return codexRolloutUsage(content.split("\n"));
62344
62438
  }
62345
62439
  function sessionMetaId(entry) {
@@ -62584,12 +62678,12 @@ var handleUserActivity = (client, m, d) => {
62584
62678
  };
62585
62679
 
62586
62680
  // src/commands/sessions/shared/parseTranscript.ts
62587
- import * as fs73 from "fs";
62681
+ import * as fs74 from "fs";
62588
62682
  async function parseTranscript(conversationId) {
62589
62683
  const located = await locateConversation(conversationId);
62590
62684
  if (!located) return [];
62591
62685
  try {
62592
- const raw = await fs73.promises.readFile(located.filePath, "utf8");
62686
+ const raw = await fs74.promises.readFile(located.filePath, "utf8");
62593
62687
  return transcriptMessages(located.reader, raw.split("\n"));
62594
62688
  } catch {
62595
62689
  return [];
@@ -62915,48 +63009,48 @@ async function confirmTransferredRun(sessions, id, trace) {
62915
63009
 
62916
63010
  // src/commands/sessions/daemon/transfer/restoreTransferSnapshot.ts
62917
63011
  var FETCH_TIMEOUT_MS2 = 12e4;
62918
- async function switchToSnapshot(path126, snapshot2, sha) {
63012
+ async function switchToSnapshot(path128, snapshot2, sha) {
62919
63013
  const { branch: branch2 } = snapshot2;
62920
- if (!branch2 || branch2 === await remoteDefaultBranch(path126)) {
62921
- await git2(path126, ["reset", "--hard", "--quiet", sha]);
62922
- return await gitOrNull(path126, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
63014
+ if (!branch2 || branch2 === await remoteDefaultBranch(path128)) {
63015
+ await git2(path128, ["reset", "--hard", "--quiet", sha]);
63016
+ return await gitOrNull(path128, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
62923
63017
  }
62924
- await git2(path126, ["checkout", "--quiet", "-B", branch2, sha]);
63018
+ await git2(path128, ["checkout", "--quiet", "-B", branch2, sha]);
62925
63019
  return branch2;
62926
63020
  }
62927
- async function trackUpstream(path126, upstream) {
62928
- await gitResult(path126, ["fetch", "--quiet", "origin", upstream]);
62929
- const tracked = await gitResult(path126, [
63021
+ async function trackUpstream(path128, upstream) {
63022
+ await gitResult(path128, ["fetch", "--quiet", "origin", upstream]);
63023
+ const tracked = await gitResult(path128, [
62930
63024
  "branch",
62931
63025
  `--set-upstream-to=origin/${upstream}`
62932
63026
  ]);
62933
63027
  if (!tracked.ok)
62934
63028
  daemonLog(
62935
- `transfer restore ${path126}: could not track origin/${upstream}: ${tracked.error}`
63029
+ `transfer restore ${path128}: could not track origin/${upstream}: ${tracked.error}`
62936
63030
  );
62937
63031
  }
62938
- async function restoreTransferSnapshot(path126, snapshot2) {
62939
- if (await gitOrNull(path126, ["status", "--porcelain"]))
62940
- throw new Error(`${path126} has uncommitted changes`);
63032
+ async function restoreTransferSnapshot(path128, snapshot2) {
63033
+ if (await gitOrNull(path128, ["status", "--porcelain"]))
63034
+ throw new Error(`${path128} has uncommitted changes`);
62941
63035
  await git2(
62942
- path126,
63036
+ path128,
62943
63037
  ["fetch", "--quiet", "origin", `refs/heads/${snapshot2.ref}`],
62944
63038
  FETCH_TIMEOUT_MS2
62945
63039
  );
62946
- const sha = (await git2(path126, ["rev-parse", "FETCH_HEAD"])).trim();
62947
- const branch2 = await switchToSnapshot(path126, snapshot2, sha);
62948
- await git2(path126, ["reset", "--soft", "--quiet", "HEAD~1"]);
62949
- if (snapshot2.upstream) await trackUpstream(path126, snapshot2.upstream);
63040
+ const sha = (await git2(path128, ["rev-parse", "FETCH_HEAD"])).trim();
63041
+ const branch2 = await switchToSnapshot(path128, snapshot2, sha);
63042
+ await git2(path128, ["reset", "--soft", "--quiet", "HEAD~1"]);
63043
+ if (snapshot2.upstream) await trackUpstream(path128, snapshot2.upstream);
62950
63044
  daemonLog(
62951
- `transfer restore ${path126}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
63045
+ `transfer restore ${path128}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
62952
63046
  );
62953
63047
  const deleted = await gitResult(
62954
- path126,
63048
+ path128,
62955
63049
  ["push", "--no-verify", "--quiet", "origin", "--delete", snapshot2.ref],
62956
63050
  FETCH_TIMEOUT_MS2
62957
63051
  );
62958
63052
  daemonLog(
62959
- deleted.ok ? `transfer restore ${path126}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path126}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
63053
+ deleted.ok ? `transfer restore ${path128}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path128}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
62960
63054
  );
62961
63055
  }
62962
63056
 
@@ -62967,10 +63061,10 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
62967
63061
  ctx,
62968
63062
  cwd,
62969
63063
  (sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
62970
- async (path126) => {
62971
- if (!path126) throw new Error("no working tree to restore into");
62972
- daemonLog(`transfer restore ${path126}: fetching ${snapshot2.ref} ${trace}`);
62973
- await restoreTransferSnapshot(path126, snapshot2);
63064
+ async (path128) => {
63065
+ if (!path128) throw new Error("no working tree to restore into");
63066
+ daemonLog(`transfer restore ${path128}: fetching ${snapshot2.ref} ${trace}`);
63067
+ await restoreTransferSnapshot(path128, snapshot2);
62974
63068
  },
62975
63069
  { inPlace: meta.inPlace },
62976
63070
  context
@@ -63009,7 +63103,7 @@ function isPrCheckoutArgs(args) {
63009
63103
 
63010
63104
  // src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
63011
63105
  import { execFile as execFile15 } from "child_process";
63012
- import { existsSync as existsSync113 } from "fs";
63106
+ import { existsSync as existsSync115 } from "fs";
63013
63107
  function prHeadBranch2(number, cwd) {
63014
63108
  const { headBranch } = prCliCommands(number, cwd);
63015
63109
  return new Promise((resolve36) => {
@@ -63023,12 +63117,12 @@ function prHeadBranch2(number, cwd) {
63023
63117
  }
63024
63118
  async function prCheckoutHolder(assistArgs, cwd) {
63025
63119
  const number = prCheckoutNumber(assistArgs);
63026
- if (!number || !cwd || !existsSync113(cwd)) return void 0;
63120
+ if (!number || !cwd || !existsSync115(cwd)) return void 0;
63027
63121
  const headRef = await prHeadBranch2(number, cwd);
63028
63122
  if (!headRef) return void 0;
63029
63123
  const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
63030
63124
  const holder = listing ? worktreeWithBranch(listing, headRef) : null;
63031
- if (!holder || !existsSync113(holder)) return void 0;
63125
+ if (!holder || !existsSync115(holder)) return void 0;
63032
63126
  daemonLog(
63033
63127
  `pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
63034
63128
  );
@@ -63424,7 +63518,7 @@ async function closeSession2() {
63424
63518
  }
63425
63519
 
63426
63520
  // src/commands/sessions/nodes/listNodes.ts
63427
- import chalk295 from "chalk";
63521
+ import chalk297 from "chalk";
63428
63522
  async function nodesReport() {
63429
63523
  const live = await queryNodes();
63430
63524
  if (live)
@@ -63441,10 +63535,10 @@ async function listNodes(options2) {
63441
63535
  console.log(JSON.stringify(report, null, 2));
63442
63536
  return;
63443
63537
  }
63444
- console.log(`${report.local} ${chalk295.dim("(this node)")}`);
63538
+ console.log(`${report.local} ${chalk297.dim("(this node)")}`);
63445
63539
  if (!report.daemonRunning)
63446
- console.log(chalk295.dim(" daemon not running; showing configured links"));
63447
- if (report.links.length === 0) console.log(chalk295.dim(" no links"));
63540
+ console.log(chalk297.dim(" daemon not running; showing configured links"));
63541
+ if (report.links.length === 0) console.log(chalk297.dim(" no links"));
63448
63542
  for (const link3 of report.links) console.log(formatLink(link3));
63449
63543
  }
63450
63544
 
@@ -63466,7 +63560,7 @@ async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
63466
63560
  }
63467
63561
 
63468
63562
  // src/commands/sessions/nodes/printReport.ts
63469
- import chalk296 from "chalk";
63563
+ import chalk298 from "chalk";
63470
63564
  function printReport(report) {
63471
63565
  if (report.links.length === 0) {
63472
63566
  console.log(`${report.local} has no links`);
@@ -63480,11 +63574,11 @@ function printReport(report) {
63480
63574
  for (const diagnosis of report.links) printDiagnosis(diagnosis);
63481
63575
  }
63482
63576
  function printDiagnosis(diagnosis) {
63483
- console.log(`${chalk296.bold(diagnosis.name)} ${chalk296.dim(diagnosis.url)}`);
63577
+ console.log(`${chalk298.bold(diagnosis.name)} ${chalk298.dim(diagnosis.url)}`);
63484
63578
  for (const hop of diagnosis.hops) {
63485
- const mark = hop.ok ? chalk296.green("\u2713") : chalk296.red("\u2717");
63579
+ const mark = hop.ok ? chalk298.green("\u2713") : chalk298.red("\u2717");
63486
63580
  console.log(` ${mark} ${hop.hop.padEnd(9)} ${hop.detail ?? hop.error}`);
63487
- if (hop.remediation) console.log(` ${chalk296.yellow(hop.remediation)}`);
63581
+ if (hop.remediation) console.log(` ${chalk298.yellow(hop.remediation)}`);
63488
63582
  }
63489
63583
  }
63490
63584
 
@@ -63556,14 +63650,14 @@ function registerDiagnoseCommands(nodes, calledBy5) {
63556
63650
  }
63557
63651
 
63558
63652
  // src/commands/sessions/nodes/linkNode.ts
63559
- import chalk299 from "chalk";
63653
+ import chalk301 from "chalk";
63560
63654
 
63561
63655
  // src/commands/sessions/nodes/notifyDaemonLinks.ts
63562
- import chalk297 from "chalk";
63656
+ import chalk299 from "chalk";
63563
63657
  async function notifyDaemonLinks() {
63564
63658
  if (!await isDaemonRunning()) {
63565
63659
  console.log(
63566
- chalk297.yellow(
63660
+ chalk299.yellow(
63567
63661
  "The sessions daemon is not running; it loads the links when it starts."
63568
63662
  )
63569
63663
  );
@@ -63571,11 +63665,11 @@ async function notifyDaemonLinks() {
63571
63665
  }
63572
63666
  try {
63573
63667
  await sendToDaemonAwaitAck({ type: "reload-links" });
63574
- console.log(chalk297.dim("The sessions daemon reloaded its links."));
63668
+ console.log(chalk299.dim("The sessions daemon reloaded its links."));
63575
63669
  } catch (error) {
63576
63670
  const message4 = error instanceof Error ? error.message : String(error);
63577
63671
  console.log(
63578
- chalk297.yellow(
63672
+ chalk299.yellow(
63579
63673
  `Could not notify the sessions daemon (${message4}); run \`assist daemon restart\` to apply the change.`
63580
63674
  )
63581
63675
  );
@@ -63583,7 +63677,7 @@ async function notifyDaemonLinks() {
63583
63677
  }
63584
63678
 
63585
63679
  // src/commands/sessions/nodes/readLinks.ts
63586
- import chalk298 from "chalk";
63680
+ import chalk300 from "chalk";
63587
63681
 
63588
63682
  // src/commands/sessions/nodes/writeLinks.ts
63589
63683
  async function writeLinks(links2) {
@@ -63606,7 +63700,7 @@ async function readLinks() {
63606
63700
  await writeLinks(links2);
63607
63701
  const dropped = stored.filter((link3) => !link3.url).map((link3) => link3.name);
63608
63702
  console.log(
63609
- chalk298.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
63703
+ chalk300.yellow(`Removed ${dropped.join(", ")}: ${SSH_LINK_RETIRED}`)
63610
63704
  );
63611
63705
  return links2;
63612
63706
  }
@@ -63662,7 +63756,7 @@ async function linkNode(name2, url, options2) {
63662
63756
  throw new Error(`${name2} is this node; link to a different node`);
63663
63757
  const link3 = await buildLink(name2, url, options2);
63664
63758
  await writeLinks([...others, link3]);
63665
- console.log(chalk299.green(`Linked ${name2} (${link3.url})`));
63759
+ console.log(chalk301.green(`Linked ${name2} (${link3.url})`));
63666
63760
  await notifyDaemonLinks();
63667
63761
  }
63668
63762
 
@@ -63696,8 +63790,8 @@ async function awaitLinkReturn(name2, options2, deps2 = {}) {
63696
63790
  }
63697
63791
 
63698
63792
  // src/commands/sessions/nodes/postToPeer.ts
63699
- async function postToPeer(baseUrl2, path126, traceId, timeoutMs) {
63700
- const res = await fetch(new URL(path126, baseUrl2), {
63793
+ async function postToPeer(baseUrl2, path128, traceId, timeoutMs) {
63794
+ const res = await fetch(new URL(path128, baseUrl2), {
63701
63795
  method: "POST",
63702
63796
  headers: {
63703
63797
  "x-assist-linked-from": resolveNodeName(),
@@ -63707,7 +63801,7 @@ async function postToPeer(baseUrl2, path126, traceId, timeoutMs) {
63707
63801
  });
63708
63802
  if (res.ok) return;
63709
63803
  const body = await res.json().catch(() => ({}));
63710
- throw new Error(body.error ?? `POST ${path126} returned ${res.status}`);
63804
+ throw new Error(body.error ?? `POST ${path128} returned ${res.status}`);
63711
63805
  }
63712
63806
 
63713
63807
  // src/commands/sessions/nodes/startPeerAction.ts
@@ -63727,14 +63821,14 @@ function startPeerAction(name2, action) {
63727
63821
  const line = `nodes ${action} ${name2} trace=${traceId}`;
63728
63822
  console.log(line);
63729
63823
  appendDaemonLog(line);
63730
- const fail15 = async (summary, error) => new Error(await describeFailure(name2, summary, error));
63824
+ const fail14 = async (summary, error) => new Error(await describeFailure(name2, summary, error));
63731
63825
  return {
63732
63826
  spec,
63733
63827
  traceId,
63734
- fail: fail15,
63828
+ fail: fail14,
63735
63829
  async awaitReturn(sawDown, timeoutMs = RETURN_TIMEOUT_MS) {
63736
63830
  const link3 = await awaitLinkReturn(name2, { sawDown, timeoutMs });
63737
- if (!link3) throw await fail15(`${name2} did not come back`);
63831
+ if (!link3) throw await fail14(`${name2} did not come back`);
63738
63832
  return link3;
63739
63833
  }
63740
63834
  };
@@ -63845,16 +63939,16 @@ function registerPeerActionCommands(nodes, calledBy5) {
63845
63939
  }
63846
63940
 
63847
63941
  // src/commands/sessions/nodes/unlinkNode.ts
63848
- import chalk300 from "chalk";
63942
+ import chalk302 from "chalk";
63849
63943
  async function unlinkNode(name2) {
63850
63944
  const links2 = await readLinks();
63851
63945
  const remaining = links2.filter((link3) => link3.name !== name2);
63852
63946
  if (remaining.length === links2.length) {
63853
- console.log(chalk300.yellow(`No link named ${name2}`));
63947
+ console.log(chalk302.yellow(`No link named ${name2}`));
63854
63948
  return;
63855
63949
  }
63856
63950
  await writeLinks(remaining);
63857
- console.log(chalk300.green(`Unlinked ${name2}`));
63951
+ console.log(chalk302.green(`Unlinked ${name2}`));
63858
63952
  await notifyDaemonLinks();
63859
63953
  }
63860
63954
 
@@ -63928,9 +64022,9 @@ function resolveTarget4(sessionId2, server) {
63928
64022
  async function sessionOutput(sessionId2, options2) {
63929
64023
  const count10 = Number.parseInt(options2.lines, 10);
63930
64024
  if (!Number.isInteger(count10) || count10 < 1)
63931
- return fail14(`-n must be a positive integer, got ${options2.lines}`);
64025
+ return fail13(`-n must be a positive integer, got ${options2.lines}`);
63932
64026
  const target = resolveTarget4(sessionId2, options2.server);
63933
- if (typeof target === "string") return fail14(target);
64027
+ if (typeof target === "string") return fail13(target);
63934
64028
  try {
63935
64029
  const {
63936
64030
  sessionId: id,
@@ -63943,10 +64037,10 @@ async function sessionOutput(sessionId2, options2) {
63943
64037
  );
63944
64038
  for (const line of lastLines(scrollback, count10)) console.log(line);
63945
64039
  } catch (error) {
63946
- fail14(error instanceof Error ? error.message : String(error));
64040
+ fail13(error instanceof Error ? error.message : String(error));
63947
64041
  }
63948
64042
  }
63949
- function fail14(message4) {
64043
+ function fail13(message4) {
63950
64044
  console.error(message4);
63951
64045
  process.exitCode = 1;
63952
64046
  }
@@ -64103,10 +64197,10 @@ function createProgram() {
64103
64197
  }
64104
64198
 
64105
64199
  // src/reportCliError.ts
64106
- import chalk301 from "chalk";
64200
+ import chalk303 from "chalk";
64107
64201
  function reportCliError(error) {
64108
64202
  if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError || error instanceof MissingDatabaseUrlError || error instanceof DatabaseConnectionError) {
64109
- console.error(chalk301.red(error.message));
64203
+ console.error(chalk303.red(error.message));
64110
64204
  } else {
64111
64205
  console.error(error);
64112
64206
  }