@staff0rd/assist 0.1063.1 → 0.1065.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.1063.1",
9
+ version: "0.1065.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -482,11 +482,11 @@ function linkedWorktree(dir) {
482
482
  return existsSync(clone) ? { root: root2, clone } : null;
483
483
  }
484
484
  function findGitLink(dir) {
485
- let current = resolve2(dir);
486
- while (current !== dirname2(current)) {
487
- const entry = join4(current, ".git");
488
- if (existsSync(entry)) return isFile(entry) ? current : null;
489
- current = dirname2(current);
485
+ let current2 = resolve2(dir);
486
+ while (current2 !== dirname2(current2)) {
487
+ const entry = join4(current2, ".git");
488
+ if (existsSync(entry)) return isFile(entry) ? current2 : null;
489
+ current2 = dirname2(current2);
490
490
  }
491
491
  return null;
492
492
  }
@@ -682,12 +682,12 @@ import chalk2 from "chalk";
682
682
  import { existsSync as existsSync5 } from "fs";
683
683
  import path from "path";
684
684
  function findRepoRoot(dir) {
685
- let current = dir;
686
- while (current !== path.dirname(current)) {
687
- if (existsSync5(path.join(current, ".git"))) {
688
- return current;
685
+ let current2 = dir;
686
+ while (current2 !== path.dirname(current2)) {
687
+ if (existsSync5(path.join(current2, ".git"))) {
688
+ return current2;
689
689
  }
690
- current = path.dirname(current);
690
+ current2 = path.dirname(current2);
691
691
  }
692
692
  return null;
693
693
  }
@@ -1308,7 +1308,8 @@ var assistConfigShape = {
1308
1308
  intervalMinutes: z6.number().int().positive().optional()
1309
1309
  }).optional(),
1310
1310
  autoUpdate: z6.strictObject({
1311
- enabled: z6.boolean().default(true)
1311
+ enabled: z6.boolean().default(true),
1312
+ restart: z6.boolean().default(false)
1312
1313
  }).optional(),
1313
1314
  worktree: z6.strictObject({
1314
1315
  enabled: z6.boolean().default(false),
@@ -1467,14 +1468,14 @@ function warnUnsharedAdviceRules(globalRaw, userDb) {
1467
1468
 
1468
1469
  // src/shared/loadConfigFrom.ts
1469
1470
  function findConfigUp(startDir) {
1470
- let current = startDir;
1471
- while (current !== dirname3(current)) {
1472
- const claudePath = join7(current, ".claude", "assist.yml");
1471
+ let current2 = startDir;
1472
+ while (current2 !== dirname3(current2)) {
1473
+ const claudePath = join7(current2, ".claude", "assist.yml");
1473
1474
  if (existsSync6(claudePath))
1474
- return { configPath: claudePath, rootDir: current };
1475
- const rootPath = join7(current, "assist.yml");
1476
- if (existsSync6(rootPath)) return { configPath: rootPath, rootDir: current };
1477
- current = dirname3(current);
1475
+ return { configPath: claudePath, rootDir: current2 };
1476
+ const rootPath = join7(current2, "assist.yml");
1477
+ if (existsSync6(rootPath)) return { configPath: rootPath, rootDir: current2 };
1478
+ current2 = dirname3(current2);
1478
1479
  }
1479
1480
  return null;
1480
1481
  }
@@ -1624,15 +1625,15 @@ async function readServeConfig() {
1624
1625
 
1625
1626
  // src/commands/sessions/nodes/runningStatus.ts
1626
1627
  async function runningStatus(status2) {
1627
- let current;
1628
+ let current2;
1628
1629
  try {
1629
- current = await status2();
1630
+ current2 = await status2();
1630
1631
  } catch (error) {
1631
1632
  if (error.code === "ENOENT")
1632
1633
  return `skipped, ${tailscaleCli()} is not installed`;
1633
1634
  throw error;
1634
1635
  }
1635
- return current.BackendState === "Running" ? current : `skipped, Tailscale is ${current.BackendState ?? "not running"}`;
1636
+ return current2.BackendState === "Running" ? current2 : `skipped, Tailscale is ${current2.BackendState ?? "not running"}`;
1636
1637
  }
1637
1638
 
1638
1639
  // src/commands/sessions/nodes/tailnetHttpsPort.ts
@@ -1659,10 +1660,10 @@ async function ensureTailscaleServe(port, deps2 = {}) {
1659
1660
  ...deps2
1660
1661
  };
1661
1662
  if (!enabled()) return "skipped, sessions.tailscaleServe is false";
1662
- const current = await runningStatus(status2);
1663
- if (typeof current === "string") return current;
1663
+ const current2 = await runningStatus(status2);
1664
+ if (typeof current2 === "string") return current2;
1664
1665
  for (let attempt2 = 1; ; attempt2++) {
1665
- const plan2 = planServe(current, await serveStatus(), port, httpsPort(port));
1666
+ const plan2 = planServe(current2, await serveStatus(), port, httpsPort(port));
1666
1667
  if (plan2.alreadyServing) return `${plan2.url} already serves ${plan2.target}`;
1667
1668
  try {
1668
1669
  await serve(plan2.args);
@@ -1816,13 +1817,13 @@ function createBrowserLink(options2 = {}) {
1816
1817
  },
1817
1818
  connectedVersion: () => state.version(),
1818
1819
  async request(request, timeoutMs) {
1819
- const current = await state.connected();
1820
+ const current2 = await state.connected();
1820
1821
  const reply2 = await replies.send(
1821
- current.ws,
1822
+ current2.ws,
1822
1823
  timeoutMs,
1823
- (id) => current.ws.send(JSON.stringify({ ...request, type: "request", id }))
1824
+ (id) => current2.ws.send(JSON.stringify({ ...request, type: "request", id }))
1824
1825
  );
1825
- return { ...reply2, version: current.version };
1826
+ return { ...reply2, version: current2.version };
1826
1827
  }
1827
1828
  };
1828
1829
  }
@@ -3761,12 +3762,12 @@ var BACKLOG_MARKERS = [
3761
3762
  "assist.backlog.yml"
3762
3763
  ];
3763
3764
  function findBacklogUp(startDir) {
3764
- let current = startDir;
3765
- while (current !== dirname4(current)) {
3766
- if (BACKLOG_MARKERS.some((marker2) => existsSync11(join11(current, marker2)))) {
3767
- return current;
3765
+ let current2 = startDir;
3766
+ while (current2 !== dirname4(current2)) {
3767
+ if (BACKLOG_MARKERS.some((marker2) => existsSync11(join11(current2, marker2)))) {
3768
+ return current2;
3768
3769
  }
3769
- current = dirname4(current);
3770
+ current2 = dirname4(current2);
3770
3771
  }
3771
3772
  return null;
3772
3773
  }
@@ -4644,14 +4645,14 @@ async function resolveTarget(port, deps2) {
4644
4645
  "sessions.tailscaleServe is false on this node",
4645
4646
  `Run \`assist config set sessions.tailscaleServe true --node\`, ${RESTART}`
4646
4647
  );
4647
- const current = await runningStatus(deps2.status);
4648
- if (typeof current === "string")
4648
+ const current2 = await runningStatus(deps2.status);
4649
+ if (typeof current2 === "string")
4649
4650
  return notServing(
4650
- current.replace(/^skipped, /, ""),
4651
+ current2.replace(/^skipped, /, ""),
4651
4652
  `Install Tailscale and run \`${tailscaleCli()} up\`, ${RESTART}`
4652
4653
  );
4653
4654
  const plan2 = planServe(
4654
- current,
4655
+ current2,
4655
4656
  await deps2.serveStatus(),
4656
4657
  port,
4657
4658
  deps2.httpsPort(port)
@@ -5830,17 +5831,17 @@ var WRAPPER_TYPES = /* @__PURE__ */ new Set([
5830
5831
  ]);
5831
5832
  var OPTIONAL_TYPES = /* @__PURE__ */ new Set(["optional", "nullish"]);
5832
5833
  function unwrapSchemaNode(node) {
5833
- let current = node;
5834
+ let current2 = node;
5834
5835
  let defaultValue;
5835
5836
  let optional = false;
5836
- while (current.def && WRAPPER_TYPES.has(current.def.type ?? "") && current.def.innerType) {
5837
- if (current.def.type === "default" && defaultValue === void 0) {
5838
- defaultValue = current.def.defaultValue;
5837
+ while (current2.def && WRAPPER_TYPES.has(current2.def.type ?? "") && current2.def.innerType) {
5838
+ if (current2.def.type === "default" && defaultValue === void 0) {
5839
+ defaultValue = current2.def.defaultValue;
5839
5840
  }
5840
- if (OPTIONAL_TYPES.has(current.def.type ?? "")) optional = true;
5841
- current = current.def.innerType;
5841
+ if (OPTIONAL_TYPES.has(current2.def.type ?? "")) optional = true;
5842
+ current2 = current2.def.innerType;
5842
5843
  }
5843
- return { inner: current, defaultValue, optional };
5844
+ return { inner: current2, defaultValue, optional };
5844
5845
  }
5845
5846
 
5846
5847
  // src/shared/scalarUnionMembers.ts
@@ -6144,13 +6145,13 @@ function redactConfigSecrets(value, node) {
6144
6145
  function isTraversable(value) {
6145
6146
  return value !== null && value !== void 0 && typeof value === "object";
6146
6147
  }
6147
- function stepInto(current, key) {
6148
- return isTraversable(current) ? current[key] : void 0;
6148
+ function stepInto(current2, key) {
6149
+ return isTraversable(current2) ? current2[key] : void 0;
6149
6150
  }
6150
6151
  function getNestedValue(obj, path109) {
6151
- let current = obj;
6152
- for (const key of path109.split(".")) current = stepInto(current, key);
6153
- return current;
6152
+ let current2 = obj;
6153
+ for (const key of path109.split(".")) current2 = stepInto(current2, key);
6154
+ return current2;
6154
6155
  }
6155
6156
 
6156
6157
  // src/commands/config/configEntryLayers.ts
@@ -6201,12 +6202,12 @@ function step(node, segment) {
6201
6202
  }
6202
6203
  }
6203
6204
  function findConfigNode(root2, path109) {
6204
- let current = root2;
6205
+ let current2 = root2;
6205
6206
  for (const segment of path109) {
6206
- if (!current) return void 0;
6207
- current = step(current, segment);
6207
+ if (!current2) return void 0;
6208
+ current2 = step(current2, segment);
6208
6209
  }
6209
- return current;
6210
+ return current2;
6210
6211
  }
6211
6212
 
6212
6213
  // src/shared/parseConfigPath.ts
@@ -6359,6 +6360,11 @@ var autoUpdateConfigHelp = [
6359
6360
  key: "autoUpdate.enabled",
6360
6361
  setter: "assist config set autoUpdate.enabled false --node",
6361
6362
  note: "when this install is a git clone, the daemon pulls and builds it in the background as origin moves (assist watch wait --pull --build), logging each lap to ~/.assist/watchers/; a branch that cannot fast-forward starts a claude session to reconcile it and the loop resumes once it closes. Set false to stop it (default on)"
6363
+ },
6364
+ {
6365
+ key: "autoUpdate.restart",
6366
+ setter: "assist config set autoUpdate.restart true --node",
6367
+ note: "the node's web server applies a ready update itself, restarting the daemon and/or web server once every live agent session has been awaiting the user for a minute (or there are none); skipped while the build is pending, the loop is diverged or paused, and attempted once per built version. Toggle it per node from the Updates page (default off)"
6362
6368
  }
6363
6369
  ];
6364
6370
 
@@ -7127,11 +7133,11 @@ function stepIntoNested(container, key, nextKey) {
7127
7133
  function setNestedValue(obj, path109, value) {
7128
7134
  const keys = path109.split(".");
7129
7135
  const result = { ...obj };
7130
- let current = result;
7136
+ let current2 = result;
7131
7137
  for (let i = 0; i < keys.length - 1; i++) {
7132
- current = stepIntoNested(current, keys[i], keys[i + 1]);
7138
+ current2 = stepIntoNested(current2, keys[i], keys[i + 1]);
7133
7139
  }
7134
- setItem(current, resolveKey(keys[keys.length - 1]), value);
7140
+ setItem(current2, resolveKey(keys[keys.length - 1]), value);
7135
7141
  return result;
7136
7142
  }
7137
7143
 
@@ -8898,6 +8904,65 @@ function queryNodes() {
8898
8904
  return requestDaemonReply({ type: "nodes" }, "nodes");
8899
8905
  }
8900
8906
 
8907
+ // src/commands/watch/resolveUpstream.ts
8908
+ import { execFileSync as execFileSync2 } from "child_process";
8909
+ function runGit3(args, cwd) {
8910
+ return execFileSync2("git", args, {
8911
+ encoding: "utf8",
8912
+ stdio: ["pipe", "pipe", "pipe"],
8913
+ cwd,
8914
+ windowsHide: true
8915
+ }).trim();
8916
+ }
8917
+ function resolveUpstream(cwd) {
8918
+ try {
8919
+ runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
8920
+ } catch {
8921
+ throw new Error(
8922
+ "not a git repository \u2014 run assist watch wait from inside a repo"
8923
+ );
8924
+ }
8925
+ let branch2;
8926
+ try {
8927
+ branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
8928
+ } catch {
8929
+ throw new Error(
8930
+ "HEAD is detached \u2014 check out a branch before waiting on its upstream"
8931
+ );
8932
+ }
8933
+ try {
8934
+ return {
8935
+ branch: branch2,
8936
+ upstream: runGit3(
8937
+ ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
8938
+ cwd
8939
+ )
8940
+ };
8941
+ } catch {
8942
+ throw new Error(
8943
+ `branch "${branch2}" has no upstream \u2014 set one with: git push -u origin ${branch2}`
8944
+ );
8945
+ }
8946
+ }
8947
+
8948
+ // src/commands/watch/headCommit.ts
8949
+ function headCommit2(cwd) {
8950
+ try {
8951
+ return runGit3(["rev-parse", "HEAD"], cwd);
8952
+ } catch {
8953
+ return void 0;
8954
+ }
8955
+ }
8956
+
8957
+ // src/commands/sessions/web/updates/webStartCommit.ts
8958
+ var captured;
8959
+ var webStartCommit = {
8960
+ capture: () => {
8961
+ captured = headCommit2(getInstallDir());
8962
+ },
8963
+ value: () => captured
8964
+ };
8965
+
8901
8966
  // src/commands/sessions/web/health.ts
8902
8967
  async function health(_req, res) {
8903
8968
  const [reachable, nodes] = await Promise.all([
@@ -8907,6 +8972,7 @@ async function health(_req, res) {
8907
8972
  respondJson(res, 200, {
8908
8973
  nodeName: resolveNodeName(),
8909
8974
  version: ASSIST_VERSION,
8975
+ startCommit: webStartCommit.value(),
8910
8976
  protocol: PROTOCOL_VERSION,
8911
8977
  daemon: { reachable },
8912
8978
  links: nodes?.links ?? []
@@ -9376,7 +9442,7 @@ var ownerOpenPrsQuery = `query($requested: String!, $authored: String!, $mine: S
9376
9442
  var sameLogin = (a, b) => a?.toLowerCase() === b.toLowerCase();
9377
9443
 
9378
9444
  // src/commands/sessions/web/next/headCommit.ts
9379
- function headCommit2(node) {
9445
+ function headCommit3(node) {
9380
9446
  return node.commits?.nodes?.[0]?.commit ?? null;
9381
9447
  }
9382
9448
 
@@ -9395,7 +9461,7 @@ function lastRequestedAt(node, viewer) {
9395
9461
  return events.at(-1)?.createdAt ?? node.createdAt;
9396
9462
  }
9397
9463
  function toNextPr(node, author, requested, viewer) {
9398
- const rollup = headCommit2(node)?.statusCheckRollup?.state;
9464
+ const rollup = headCommit3(node)?.statusCheckRollup?.state;
9399
9465
  return {
9400
9466
  number: node.number,
9401
9467
  title: node.title,
@@ -9841,10 +9907,10 @@ function assertProjectScope() {
9841
9907
  }
9842
9908
 
9843
9909
  // src/shared/runGhOrThrow.ts
9844
- import { execFileSync as execFileSync2 } from "child_process";
9910
+ import { execFileSync as execFileSync3 } from "child_process";
9845
9911
  function runGhOrThrow(args, fallbackMessage, input) {
9846
9912
  try {
9847
- execFileSync2("gh", args, {
9913
+ execFileSync3("gh", args, {
9848
9914
  stdio: [input === void 0 ? "ignore" : "pipe", "ignore", "pipe"],
9849
9915
  encoding: "utf8",
9850
9916
  ...input === void 0 ? {} : { input }
@@ -10084,12 +10150,12 @@ function scopedClaudeFiles(target) {
10084
10150
  const startDir = scopeDirectory(target);
10085
10151
  const root2 = findRepoRoot(startDir) ?? startDir;
10086
10152
  const files = [];
10087
- let current = startDir;
10153
+ let current2 = startDir;
10088
10154
  while (true) {
10089
- const candidate = path12.join(current, "CLAUDE.md");
10155
+ const candidate = path12.join(current2, "CLAUDE.md");
10090
10156
  if (existsSync21(candidate)) files.push(candidate);
10091
- if (current === root2 || current === path12.dirname(current)) break;
10092
- current = path12.dirname(current);
10157
+ if (current2 === root2 || current2 === path12.dirname(current2)) break;
10158
+ current2 = path12.dirname(current2);
10093
10159
  }
10094
10160
  return files;
10095
10161
  }
@@ -11363,7 +11429,7 @@ function deploymentsQuery(environments) {
11363
11429
  }
11364
11430
 
11365
11431
  // src/commands/sessions/web/releases/liveDeployments.ts
11366
- function headCommit3(node) {
11432
+ function headCommit4(node) {
11367
11433
  return node?.oid ? releaseCommit(node.oid, node) : null;
11368
11434
  }
11369
11435
  function environmentNodes(repository, count10) {
@@ -11390,7 +11456,7 @@ async function liveDeployments(cwd, repo, environments) {
11390
11456
  if (!repository) throw new Error(`Repository not readable: ${repo}`);
11391
11457
  return {
11392
11458
  defaultBranch: repository.defaultBranchRef?.name ?? null,
11393
- head: headCommit3(repository.defaultBranchRef?.target),
11459
+ head: headCommit4(repository.defaultBranchRef?.target),
11394
11460
  ...deploymentMaps(environmentNodes(repository, distinct.length))
11395
11461
  };
11396
11462
  }
@@ -11781,13 +11847,13 @@ function expandEnv(env) {
11781
11847
  }
11782
11848
 
11783
11849
  // src/commands/run/resolveCommand.ts
11784
- import { execFileSync as execFileSync3 } from "child_process";
11850
+ import { execFileSync as execFileSync4 } from "child_process";
11785
11851
  import { existsSync as existsSync22 } from "fs";
11786
11852
  import { dirname as dirname11, join as join26, resolve as resolve10 } from "path";
11787
11853
  function resolveCommand(command) {
11788
11854
  if (process.platform !== "win32" || command !== "bash") return command;
11789
11855
  try {
11790
- const gitPath = execFileSync3("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
11856
+ const gitPath = execFileSync4("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
11791
11857
  const gitRoot = resolve10(dirname11(gitPath), "..");
11792
11858
  const gitBash = join26(gitRoot, "bin", "bash.exe");
11793
11859
  if (existsSync22(gitBash)) return gitBash;
@@ -12353,14 +12419,14 @@ function coerceString(key, raw) {
12353
12419
 
12354
12420
  // src/shared/configLeafSchema.ts
12355
12421
  function configLeafSchema(schema2, key) {
12356
- let current = schema2;
12422
+ let current2 = schema2;
12357
12423
  for (const name of key.split(".")) {
12358
- const { inner } = unwrapSchemaNode(current);
12424
+ const { inner } = unwrapSchemaNode(current2);
12359
12425
  const child = inner.def?.type === "object" ? inner.def.shape?.[name] : void 0;
12360
12426
  if (!child) return void 0;
12361
- current = child;
12427
+ current2 = child;
12362
12428
  }
12363
- return current;
12429
+ return current2;
12364
12430
  }
12365
12431
 
12366
12432
  // src/commands/config/coerceStructuredConfigValue.ts
@@ -12490,17 +12556,17 @@ function coerceUnion(key, raw, types) {
12490
12556
 
12491
12557
  // src/shared/valueAtConfigPath.ts
12492
12558
  function valueAtConfigPath(value, path109) {
12493
- let current = value;
12559
+ let current2 = value;
12494
12560
  for (const key of path109) {
12495
12561
  if (typeof key === "number") {
12496
- if (!Array.isArray(current)) return void 0;
12497
- current = current[key];
12562
+ if (!Array.isArray(current2)) return void 0;
12563
+ current2 = current2[key];
12498
12564
  continue;
12499
12565
  }
12500
- if (typeof current !== "object" || current === null) return void 0;
12501
- current = current[key];
12566
+ if (typeof current2 !== "object" || current2 === null) return void 0;
12567
+ current2 = current2[key];
12502
12568
  }
12503
- return current;
12569
+ return current2;
12504
12570
  }
12505
12571
 
12506
12572
  // src/shared/restoreConfigSecrets.ts
@@ -12709,9 +12775,9 @@ async function applyUserConfigSet(key, coerced) {
12709
12775
  const nodeOnly = userDbKeyError(key, "Set");
12710
12776
  if (nodeOnly) return nodeOnly;
12711
12777
  const orm = await getDb();
12712
- const outcome = await updateUserConfig(orm, (current) => {
12713
- const value = typeof coerced === "function" ? coerced(getNestedValue(current, key)) : coerced;
12714
- const config = setNestedValue(current, key, value);
12778
+ const outcome = await updateUserConfig(orm, (current2) => {
12779
+ const value = typeof coerced === "function" ? coerced(getNestedValue(current2, key)) : coerced;
12780
+ const config = setNestedValue(current2, key, value);
12715
12781
  const validation = validateConfig(config, key);
12716
12782
  return validation.ok ? { ok: true, config, result: void 0 } : validation;
12717
12783
  });
@@ -12937,9 +13003,9 @@ async function applyUserConfigUnset(key) {
12937
13003
  const nodeOnly = userDbKeyError(key, "Unset");
12938
13004
  if (nodeOnly) return nodeOnly;
12939
13005
  const orm = await getDb();
12940
- const outcome = await updateUserConfig(orm, (current) => {
12941
- const { config, removed } = unsetNestedValue(current, key);
12942
- if (!removed) return { ok: true, config: current, result: false };
13006
+ const outcome = await updateUserConfig(orm, (current2) => {
13007
+ const { config, removed } = unsetNestedValue(current2, key);
13008
+ if (!removed) return { ok: true, config: current2, result: false };
12943
13009
  const validation = validateConfig(config, key);
12944
13010
  return validation.ok ? { ok: true, config, result: true } : validation;
12945
13011
  });
@@ -12990,54 +13056,94 @@ function unsetConfig(req, res) {
12990
13056
  });
12991
13057
  }
12992
13058
 
12993
- // src/commands/watch/isBuildPending.ts
12994
- import { existsSync as existsSync25 } from "fs";
12995
-
12996
- // src/commands/watch/gitMarkerPath.ts
12997
- import { resolve as resolve11 } from "path";
12998
-
12999
- // src/commands/watch/resolveUpstream.ts
13000
- import { execFileSync as execFileSync4 } from "child_process";
13001
- function runGit3(args, cwd) {
13002
- return execFileSync4("git", args, {
13003
- encoding: "utf8",
13004
- stdio: ["pipe", "pipe", "pipe"],
13005
- cwd,
13006
- windowsHide: true
13007
- }).trim();
13059
+ // src/commands/extension/extensionUpdateStatus.ts
13060
+ import semver from "semver";
13061
+ function extensionUpdateStatus(connected, latest2) {
13062
+ const behind = Boolean(
13063
+ connected && latest2 && semver.valid(connected) && semver.valid(latest2.version) && semver.gt(latest2.version, connected)
13064
+ );
13065
+ return {
13066
+ connected,
13067
+ latest: latest2?.version,
13068
+ updateLink: behind ? latest2?.update_link : void 0,
13069
+ installLink: latest2?.update_link,
13070
+ behind
13071
+ };
13008
13072
  }
13009
- function resolveUpstream(cwd) {
13010
- try {
13011
- runGit3(["rev-parse", "--is-inside-work-tree"], cwd);
13012
- } catch {
13013
- throw new Error(
13014
- "not a git repository \u2014 run assist watch wait from inside a repo"
13015
- );
13016
- }
13017
- let branch2;
13073
+
13074
+ // src/commands/sessions/web/updates/autoRestartEnabled.ts
13075
+ function autoRestartEnabled(installDir) {
13018
13076
  try {
13019
- branch2 = runGit3(["symbolic-ref", "--quiet", "--short", "HEAD"], cwd);
13077
+ return loadConfigFrom(installDir).autoUpdate?.restart ?? false;
13020
13078
  } catch {
13021
- throw new Error(
13022
- "HEAD is detached \u2014 check out a branch before waiting on its upstream"
13023
- );
13079
+ return false;
13024
13080
  }
13025
- try {
13026
- return {
13027
- branch: branch2,
13028
- upstream: runGit3(
13029
- ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
13030
- cwd
13031
- )
13032
- };
13033
- } catch {
13034
- throw new Error(
13035
- `branch "${branch2}" has no upstream \u2014 set one with: git push -u origin ${branch2}`
13036
- );
13081
+ }
13082
+
13083
+ // src/commands/sessions/web/updates/autoRestart/autoRestartWait.ts
13084
+ var current;
13085
+ var autoRestartWait = {
13086
+ get: () => current,
13087
+ set: (wait2) => {
13088
+ current = wait2;
13037
13089
  }
13090
+ };
13091
+
13092
+ // src/commands/extension/fetchLatestSignedExtension.ts
13093
+ import { readFile as readFile2 } from "fs/promises";
13094
+ import { join as join28 } from "path";
13095
+
13096
+ // src/commands/extension/extensionDir.ts
13097
+ import { existsSync as existsSync24 } from "fs";
13098
+ import { dirname as dirname13, join as join27 } from "path";
13099
+ import { fileURLToPath as fileURLToPath2 } from "url";
13100
+ var moduleDir = dirname13(fileURLToPath2(import.meta.url));
13101
+ function extensionDir() {
13102
+ const bundled = join27(moduleDir, "commands", "extension", "extension");
13103
+ if (existsSync24(bundled)) return bundled;
13104
+ return join27(moduleDir, "..", "..", "..", "extension");
13105
+ }
13106
+
13107
+ // src/commands/extension/latestUpdate.ts
13108
+ function latestUpdate(manifest, updates2) {
13109
+ const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
13110
+ return JSON.parse(updates2).addons[id]?.updates.at(-1);
13111
+ }
13112
+
13113
+ // src/commands/extension/fetchLatestSignedExtension.ts
13114
+ async function fetchLatestSignedExtension() {
13115
+ const manifest = await readFile2(
13116
+ join28(extensionDir(), "manifest.json"),
13117
+ "utf8"
13118
+ );
13119
+ const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
13120
+ const response = await fetch(updateUrl, {
13121
+ signal: AbortSignal.timeout(1e4)
13122
+ });
13123
+ if (!response.ok) return { updateUrl };
13124
+ return { updateUrl, latest: latestUpdate(manifest, await response.text()) };
13125
+ }
13126
+
13127
+ // src/commands/sessions/web/updates/latestSignedExtension.ts
13128
+ var CACHE_MS = 6e4;
13129
+ var cached = {
13130
+ at: Number.NEGATIVE_INFINITY,
13131
+ value: Promise.resolve(void 0)
13132
+ };
13133
+ function latestSignedExtension(now = Date.now()) {
13134
+ if (now - cached.at < CACHE_MS) return cached.value;
13135
+ cached = {
13136
+ at: now,
13137
+ value: fetchLatestSignedExtension().then(({ latest: latest2 }) => latest2).catch(() => void 0)
13138
+ };
13139
+ return cached.value;
13038
13140
  }
13039
13141
 
13142
+ // src/commands/watch/isBuildPending.ts
13143
+ import { existsSync as existsSync26 } from "fs";
13144
+
13040
13145
  // src/commands/watch/gitMarkerPath.ts
13146
+ import { resolve as resolve11 } from "path";
13041
13147
  function gitMarkerPath(name, cwd) {
13042
13148
  return resolve11(
13043
13149
  cwd ?? process.cwd(),
@@ -13051,7 +13157,7 @@ function buildPendingPath(cwd) {
13051
13157
  }
13052
13158
 
13053
13159
  // src/commands/watch/readBuiltVersion.ts
13054
- import { join as join28 } from "path";
13160
+ import { join as join30 } from "path";
13055
13161
 
13056
13162
  // src/shared/readPackageJson.ts
13057
13163
  import * as fs8 from "fs";
@@ -13101,7 +13207,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
13101
13207
  function readBuiltVersion(cwd) {
13102
13208
  try {
13103
13209
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
13104
- return readPackageJson(join28(root2, "package.json")).version ?? "unknown";
13210
+ return readPackageJson(join30(root2, "package.json")).version ?? "unknown";
13105
13211
  } catch {
13106
13212
  return "unknown";
13107
13213
  }
@@ -13109,11 +13215,11 @@ function readBuiltVersion(cwd) {
13109
13215
 
13110
13216
  // src/commands/watch/readDistVersion.ts
13111
13217
  import { readFileSync as readFileSync10 } from "fs";
13112
- import { join as join29 } from "path";
13218
+ import { join as join31 } from "path";
13113
13219
  function readDistVersion(cwd) {
13114
13220
  try {
13115
13221
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
13116
- return readFileSync10(join29(root2, "dist", "built-version"), "utf8").trim();
13222
+ return readFileSync10(join31(root2, "dist", "built-version"), "utf8").trim();
13117
13223
  } catch {
13118
13224
  return void 0;
13119
13225
  }
@@ -13128,7 +13234,7 @@ function isDistBehind(cwd) {
13128
13234
  // src/commands/watch/isBuildPending.ts
13129
13235
  function markedPending(cwd) {
13130
13236
  try {
13131
- return existsSync25(buildPendingPath(cwd));
13237
+ return existsSync26(buildPendingPath(cwd));
13132
13238
  } catch {
13133
13239
  return false;
13134
13240
  }
@@ -13137,69 +13243,20 @@ function isBuildPending(cwd) {
13137
13243
  return markedPending(cwd) || isDistBehind(cwd);
13138
13244
  }
13139
13245
 
13140
- // src/commands/extension/extensionUpdateStatus.ts
13141
- import semver from "semver";
13142
- function extensionUpdateStatus(connected, latest2) {
13143
- const behind = Boolean(
13144
- connected && latest2 && semver.valid(connected) && semver.valid(latest2.version) && semver.gt(latest2.version, connected)
13145
- );
13146
- return {
13147
- connected,
13148
- latest: latest2?.version,
13149
- updateLink: behind ? latest2?.update_link : void 0,
13150
- installLink: latest2?.update_link,
13151
- behind
13152
- };
13153
- }
13154
-
13155
- // src/commands/extension/fetchLatestSignedExtension.ts
13156
- import { readFile as readFile2 } from "fs/promises";
13157
- import { join as join31 } from "path";
13158
-
13159
- // src/commands/extension/extensionDir.ts
13160
- import { existsSync as existsSync26 } from "fs";
13161
- import { dirname as dirname14, join as join30 } from "path";
13162
- import { fileURLToPath as fileURLToPath2 } from "url";
13163
- var moduleDir = dirname14(fileURLToPath2(import.meta.url));
13164
- function extensionDir() {
13165
- const bundled = join30(moduleDir, "commands", "extension", "extension");
13166
- if (existsSync26(bundled)) return bundled;
13167
- return join30(moduleDir, "..", "..", "..", "extension");
13168
- }
13169
-
13170
- // src/commands/extension/latestUpdate.ts
13171
- function latestUpdate(manifest, updates2) {
13172
- const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
13173
- return JSON.parse(updates2).addons[id]?.updates.at(-1);
13174
- }
13175
-
13176
- // src/commands/extension/fetchLatestSignedExtension.ts
13177
- async function fetchLatestSignedExtension() {
13178
- const manifest = await readFile2(
13179
- join31(extensionDir(), "manifest.json"),
13180
- "utf8"
13181
- );
13182
- const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
13183
- const response = await fetch(updateUrl, {
13184
- signal: AbortSignal.timeout(1e4)
13185
- });
13186
- if (!response.ok) return { updateUrl };
13187
- return { updateUrl, latest: latestUpdate(manifest, await response.text()) };
13246
+ // src/commands/watch/changedPaths.ts
13247
+ function changedPaths(from, cwd) {
13248
+ return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
13188
13249
  }
13189
13250
 
13190
- // src/commands/sessions/web/updates/latestSignedExtension.ts
13191
- var CACHE_MS = 6e4;
13192
- var cached = {
13193
- at: Number.NEGATIVE_INFINITY,
13194
- value: Promise.resolve(void 0)
13195
- };
13196
- function latestSignedExtension(now = Date.now()) {
13197
- if (now - cached.at < CACHE_MS) return cached.value;
13198
- cached = {
13199
- at: now,
13200
- value: fetchLatestSignedExtension().then(({ latest: latest2 }) => latest2).catch(() => void 0)
13251
+ // src/commands/sessions/web/updates/changedSince.ts
13252
+ function changedSince(installDir) {
13253
+ return (commit2) => {
13254
+ try {
13255
+ return changedPaths(commit2, installDir);
13256
+ } catch {
13257
+ return [];
13258
+ }
13201
13259
  };
13202
- return cached.value;
13203
13260
  }
13204
13261
 
13205
13262
  // src/commands/watch/restartRules.ts
@@ -13238,6 +13295,29 @@ function pendingRestarts(input) {
13238
13295
  ];
13239
13296
  }
13240
13297
 
13298
+ // src/commands/sessions/web/updates/readRestartState.ts
13299
+ async function readRestartState(installDir) {
13300
+ const reply2 = await requestDaemonReply(
13301
+ { type: "auto-update" },
13302
+ "auto-update"
13303
+ );
13304
+ const built = readBuiltVersion(installDir);
13305
+ const buildPending = isBuildPending(installDir);
13306
+ return {
13307
+ reply: reply2,
13308
+ built,
13309
+ buildPending,
13310
+ restart: pendingRestarts({
13311
+ daemonVersion: reply2?.version,
13312
+ daemonStartCommit: reply2?.startCommit,
13313
+ webStartCommit: webStartCommit.value(),
13314
+ built,
13315
+ buildPending,
13316
+ changedSince: changedSince(installDir)
13317
+ })
13318
+ };
13319
+ }
13320
+
13241
13321
  // src/shared/stripAnsi.ts
13242
13322
  var ANSI = new RegExp(
13243
13323
  `${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`,
@@ -13277,63 +13357,19 @@ function readUpdateHistory(installDir) {
13277
13357
  return readLogTail(watcherLogPath(installDir), HISTORY_LINES * 2).flatMap((line) => line.split("\r")).map((line) => stripAnsi(line).trimEnd()).filter((line) => line.trim().length > 0).slice(-HISTORY_LINES);
13278
13358
  }
13279
13359
 
13280
- // src/commands/watch/headCommit.ts
13281
- function headCommit4(cwd) {
13282
- try {
13283
- return runGit3(["rev-parse", "HEAD"], cwd);
13284
- } catch {
13285
- return void 0;
13286
- }
13287
- }
13288
-
13289
- // src/commands/sessions/web/updates/webStartCommit.ts
13290
- var captured;
13291
- var webStartCommit = {
13292
- capture: () => {
13293
- captured = headCommit4(getInstallDir());
13294
- },
13295
- value: () => captured
13296
- };
13297
-
13298
- // src/commands/watch/changedPaths.ts
13299
- function changedPaths(from, cwd) {
13300
- return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
13301
- }
13302
-
13303
- // src/commands/sessions/web/updates/changedSince.ts
13304
- function changedSince(installDir) {
13305
- return (commit2) => {
13306
- try {
13307
- return changedPaths(commit2, installDir);
13308
- } catch {
13309
- return [];
13310
- }
13311
- };
13312
- }
13313
-
13314
13360
  // src/commands/sessions/web/updates/updates.ts
13315
13361
  async function updates(_req, res) {
13316
13362
  const installDir = getInstallDir();
13317
- const reply2 = await requestDaemonReply(
13318
- { type: "auto-update" },
13319
- "auto-update"
13320
- );
13321
- const built = readBuiltVersion(installDir);
13322
- const buildPending = isBuildPending(installDir);
13363
+ const { reply: reply2, built, buildPending, restart } = await readRestartState(installDir);
13323
13364
  const status2 = {
13324
13365
  nodeName: resolveNodeName(),
13325
13366
  installDir,
13326
13367
  running: reply2?.version ?? ASSIST_VERSION,
13327
13368
  built,
13328
13369
  buildPending,
13329
- restart: pendingRestarts({
13330
- daemonVersion: reply2?.version,
13331
- daemonStartCommit: reply2?.startCommit,
13332
- webStartCommit: webStartCommit.value(),
13333
- built,
13334
- buildPending,
13335
- changedSince: changedSince(installDir)
13336
- }),
13370
+ restart,
13371
+ autoRestart: autoRestartEnabled(installDir),
13372
+ autoRestartWait: autoRestartWait.get(),
13337
13373
  daemonReachable: reply2 !== void 0,
13338
13374
  loop: reply2?.loop ?? {
13339
13375
  phase: "off",
@@ -13800,9 +13836,9 @@ function parseMenuKey(data, toggleKey) {
13800
13836
 
13801
13837
  // src/commands/sessions/web/restartMenu/createKeyHandler.ts
13802
13838
  function createKeyHandler(deps2) {
13803
- const { menu, toggleKey, isBusy, activate, quit } = deps2;
13839
+ const { menu, toggleKey, isBusy: isBusy2, activate, quit } = deps2;
13804
13840
  return (chunk) => {
13805
- if (isBusy()) return;
13841
+ if (isBusy2()) return;
13806
13842
  const { key, digit } = parseMenuKey(chunk, toggleKey);
13807
13843
  if (key === "quit") return quit();
13808
13844
  if (key === "toggle") {
@@ -13820,10 +13856,10 @@ function createKeyHandler(deps2) {
13820
13856
  }
13821
13857
 
13822
13858
  // src/commands/sessions/web/restartMenu/nextIndex.ts
13823
- function nextIndex(items2, current, direction) {
13859
+ function nextIndex(items2, current2, direction) {
13824
13860
  const n = items2.length;
13825
- if (n === 0) return current;
13826
- return (current + direction + n) % n;
13861
+ if (n === 0) return current2;
13862
+ return (current2 + direction + n) % n;
13827
13863
  }
13828
13864
  function firstEnabledIndex(items2) {
13829
13865
  const idx = items2.findIndex((item) => !item.disabled);
@@ -13923,14 +13959,14 @@ function installRestartMenu(options2 = {}) {
13923
13959
  const log2 = createLogUpdate(out);
13924
13960
  const menu = createMenuState(items2, log2);
13925
13961
  const reExec = () => reExecFn({ beforeExec: () => cleanup(), exit });
13926
- const { isBusy, activate } = createActivate(menu, {
13962
+ const { isBusy: isBusy2, activate } = createActivate(menu, {
13927
13963
  runRestartDaemon: restartDaemonFn,
13928
13964
  reExec
13929
13965
  });
13930
13966
  const handler = createKeyHandler({
13931
13967
  menu,
13932
13968
  toggleKey,
13933
- isBusy,
13969
+ isBusy: isBusy2,
13934
13970
  activate,
13935
13971
  quit: () => {
13936
13972
  cleanup();
@@ -13991,6 +14027,181 @@ function scheduleReconnect() {
13991
14027
  setTimeout(() => void connect2(), RECONNECT_MS).unref();
13992
14028
  }
13993
14029
 
14030
+ // src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
14031
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
14032
+ import { dirname as dirname17, join as join36 } from "path";
14033
+ var defaultPath = join36(daemonPaths.dir, "auto-restart-attempts.json");
14034
+ function read(path109) {
14035
+ try {
14036
+ return JSON.parse(readFileSync13(path109, "utf8"));
14037
+ } catch {
14038
+ return {};
14039
+ }
14040
+ }
14041
+ function autoRestartAttempts(port, path109 = defaultPath) {
14042
+ const key = String(port);
14043
+ return {
14044
+ get: () => read(path109)[key],
14045
+ set: (built) => {
14046
+ mkdirSync7(dirname17(path109), { recursive: true });
14047
+ writeFileSync6(
14048
+ path109,
14049
+ `${JSON.stringify({ ...read(path109), [key]: built }, null, 2)}
14050
+ `
14051
+ );
14052
+ }
14053
+ };
14054
+ }
14055
+
14056
+ // src/commands/sessions/web/updates/autoRestart/attemptAutoRestart.ts
14057
+ async function attemptAutoRestart(deps2, target, built) {
14058
+ deps2.attempted.set(built);
14059
+ deps2.log(`auto-restart: restarting ${target} to apply v${built}`);
14060
+ try {
14061
+ await deps2.restart(target);
14062
+ } catch (error) {
14063
+ deps2.log(
14064
+ `auto-restart: ${target} restart for v${built} failed: ${error instanceof Error ? error.message : String(error)}`
14065
+ );
14066
+ }
14067
+ }
14068
+
14069
+ // src/commands/sessions/web/updates/autoRestart/autoRestartTarget.ts
14070
+ function autoRestartTarget(restart) {
14071
+ return restart.length > 1 ? "both" : restart[0];
14072
+ }
14073
+
14074
+ // src/commands/sessions/web/updates/autoRestart/autoRestartBlocker.ts
14075
+ function isBusy(session) {
14076
+ if (session.node !== void 0 || session.commandType === "run") return false;
14077
+ if (session.status !== "running") return false;
14078
+ const preview = session.pendingPrPreview;
14079
+ return preview === void 0 || preview.kind === "show";
14080
+ }
14081
+ function autoRestartBlocker(input) {
14082
+ if (input.buildPending) return "build pending";
14083
+ if (!input.loop) return "daemon not reachable";
14084
+ if (input.loop.paused) return "auto-update paused";
14085
+ if (input.loop.phase === "diverged") return "auto-update diverged";
14086
+ const busy = input.sessions.filter(isBusy);
14087
+ if (busy.length > 0)
14088
+ return `waiting on ${busy.length} running session${busy.length === 1 ? "" : "s"} (${busy.map((s) => s.name).join(", ")})`;
14089
+ return void 0;
14090
+ }
14091
+
14092
+ // src/commands/sessions/web/updates/autoRestart/blockedBy.ts
14093
+ function blockedBy(snap, attempted2) {
14094
+ if (attempted2 === snap.built) return "already attempted";
14095
+ return autoRestartBlocker(snap);
14096
+ }
14097
+
14098
+ // src/commands/sessions/web/updates/autoRestart/createAutoRestartNotes.ts
14099
+ function createAutoRestartNotes(deps2) {
14100
+ const report = deps2.report ?? (() => {
14101
+ });
14102
+ let idleSince;
14103
+ let lastNote;
14104
+ return {
14105
+ idleSince: () => idleSince,
14106
+ settling: (at2) => {
14107
+ idleSince = at2;
14108
+ },
14109
+ note: (message3, wait2) => {
14110
+ if (message3 !== void 0 && message3 !== lastNote)
14111
+ deps2.log(`auto-restart: ${message3}`);
14112
+ lastNote = message3;
14113
+ idleSince = void 0;
14114
+ report(wait2);
14115
+ }
14116
+ };
14117
+ }
14118
+
14119
+ // src/commands/sessions/web/updates/autoRestart/createAutoRestartCheck.ts
14120
+ var AUTO_RESTART_SETTLE_MS = 6e4;
14121
+ function createAutoRestartCheck(deps2) {
14122
+ const now = deps2.now ?? Date.now;
14123
+ const notes = createAutoRestartNotes(deps2);
14124
+ const { note } = notes;
14125
+ return async function tick() {
14126
+ if (!deps2.enabled()) return note(void 0);
14127
+ const snap = await deps2.snapshot();
14128
+ if (snap.restart.length === 0) return note(void 0);
14129
+ const target = autoRestartTarget(snap.restart);
14130
+ const blocker = blockedBy(snap, deps2.attempted.get());
14131
+ if (blocker)
14132
+ return note(
14133
+ `skipped ${target} restart for v${snap.built}: ${blocker}`,
14134
+ blocker
14135
+ );
14136
+ const at2 = now();
14137
+ const idleSince = notes.idleSince();
14138
+ if (idleSince === void 0) {
14139
+ note(
14140
+ `${target} restart for v${snap.built} ready; restarting once idle for ${AUTO_RESTART_SETTLE_MS / 1e3}s`,
14141
+ `idle \xB7 restarting within ${AUTO_RESTART_SETTLE_MS / 1e3}s`
14142
+ );
14143
+ notes.settling(at2);
14144
+ return;
14145
+ }
14146
+ if (at2 - idleSince < AUTO_RESTART_SETTLE_MS) return;
14147
+ note(void 0, "restarting");
14148
+ await attemptAutoRestart(deps2, target, snap.built);
14149
+ };
14150
+ }
14151
+
14152
+ // src/commands/sessions/web/updates/autoRestart/logViaDaemon.ts
14153
+ var ACK_TIMEOUT_MS = 1e3;
14154
+ async function logViaDaemon(message3) {
14155
+ const ack = await requestDaemonReply(
14156
+ { type: "web-log", message: message3 },
14157
+ "web-logged",
14158
+ ACK_TIMEOUT_MS
14159
+ );
14160
+ if (!ack) console.log(message3);
14161
+ }
14162
+
14163
+ // src/commands/sessions/web/updates/autoRestart/startAutoRestart.ts
14164
+ var CHECK_INTERVAL_MS = 2e4;
14165
+ async function snapshot(installDir) {
14166
+ const [state, greeting] = await Promise.all([
14167
+ readRestartState(installDir),
14168
+ requestDaemonReply(
14169
+ { type: "ping" },
14170
+ "sessions"
14171
+ )
14172
+ ]);
14173
+ return {
14174
+ built: state.built,
14175
+ buildPending: state.buildPending,
14176
+ restart: state.restart,
14177
+ loop: greeting ? state.reply?.loop : void 0,
14178
+ sessions: greeting?.sessions ?? []
14179
+ };
14180
+ }
14181
+ function startAutoRestart(port) {
14182
+ const installDir = getInstallDir();
14183
+ const tick = createAutoRestartCheck({
14184
+ enabled: () => autoRestartEnabled(installDir),
14185
+ snapshot: () => snapshot(installDir),
14186
+ attempted: autoRestartAttempts(port),
14187
+ restart: (target) => performRestart(target),
14188
+ log: (message3) => void logViaDaemon(message3),
14189
+ report: autoRestartWait.set
14190
+ });
14191
+ let running3 = false;
14192
+ setInterval(() => {
14193
+ if (running3) return;
14194
+ running3 = true;
14195
+ tick().catch(
14196
+ (error) => console.log(
14197
+ `auto-restart: check failed: ${error instanceof Error ? error.message : String(error)}`
14198
+ )
14199
+ ).finally(() => {
14200
+ running3 = false;
14201
+ });
14202
+ }, CHECK_INTERVAL_MS).unref();
14203
+ }
14204
+
13994
14205
  // src/commands/sessions/daemon/originForCwd.ts
13995
14206
  var cache5 = /* @__PURE__ */ new Map();
13996
14207
  function originResolutionForCwd(cwd) {
@@ -14147,10 +14358,10 @@ function resolveRepoGroup(cwd) {
14147
14358
  };
14148
14359
  const reaped = worktreeAttributionIncludingReaped(cwd);
14149
14360
  if (!reaped) return { group: void 0, stable: repoDirExists(cwd) };
14150
- const current = currentOriginOfClone(reaped.clone);
14361
+ const current2 = currentOriginOfClone(reaped.clone);
14151
14362
  return {
14152
- group: hostedGroup(current?.origin ?? reaped.origin, reaped.clone),
14153
- stable: current?.stable === true
14363
+ group: hostedGroup(current2?.origin ?? reaped.origin, reaped.clone),
14364
+ stable: current2?.stable === true
14154
14365
  };
14155
14366
  }
14156
14367
  function currentOriginOfClone(clone) {
@@ -14183,6 +14394,7 @@ async function web(options2) {
14183
14394
  repoCwd: isGitRepo(serverCwd) ? repoEntryCwd(serverCwd) : void 0
14184
14395
  };
14185
14396
  attachSessionSocket(server, ctx);
14397
+ startAutoRestart(port);
14186
14398
  installRestartMenu();
14187
14399
  sweepStagedAttachments();
14188
14400
  streamDaemonLogs();
@@ -14251,10 +14463,10 @@ async function promptMultiselect(message3, options2) {
14251
14463
 
14252
14464
  // src/commands/verify/installPackage.ts
14253
14465
  import { execSync as execSync6 } from "child_process";
14254
- import { writeFileSync as writeFileSync6 } from "fs";
14466
+ import { writeFileSync as writeFileSync7 } from "fs";
14255
14467
  import chalk17 from "chalk";
14256
14468
  function writePackageJson(filePath, pkg) {
14257
- writeFileSync6(filePath, `${JSON.stringify(pkg, null, 2)}
14469
+ writeFileSync7(filePath, `${JSON.stringify(pkg, null, 2)}
14258
14470
  `);
14259
14471
  }
14260
14472
  function addScript(pkg, name, command) {
@@ -14511,23 +14723,23 @@ import * as path16 from "path";
14511
14723
  import chalk21 from "chalk";
14512
14724
 
14513
14725
  // src/commands/verify/addToKnipIgnoreBinaries.ts
14514
- import { existsSync as existsSync29, readFileSync as readFileSync13, writeFileSync as writeFileSync7 } from "fs";
14515
- import { join as join36 } from "path";
14726
+ import { existsSync as existsSync29, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
14727
+ import { join as join37 } from "path";
14516
14728
  import chalk20 from "chalk";
14517
14729
  function loadKnipConfig(knipJsonPath) {
14518
14730
  if (existsSync29(knipJsonPath)) {
14519
- return JSON.parse(readFileSync13(knipJsonPath, "utf8"));
14731
+ return JSON.parse(readFileSync14(knipJsonPath, "utf8"));
14520
14732
  }
14521
14733
  return { $schema: "https://unpkg.com/knip@5/schema.json" };
14522
14734
  }
14523
14735
  function addToKnipIgnoreBinaries(cwd, binary) {
14524
- const knipJsonPath = join36(cwd, "knip.json");
14736
+ const knipJsonPath = join37(cwd, "knip.json");
14525
14737
  try {
14526
14738
  const knipConfig = loadKnipConfig(knipJsonPath);
14527
14739
  const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
14528
14740
  if (!ignoreBinaries.includes(binary)) {
14529
14741
  knipConfig.ignoreBinaries = [...ignoreBinaries, binary];
14530
- writeFileSync7(
14742
+ writeFileSync8(
14531
14743
  knipJsonPath,
14532
14744
  `${JSON.stringify(knipConfig, null, " ")}
14533
14745
  `
@@ -14568,7 +14780,7 @@ import * as path18 from "path";
14568
14780
  import chalk26 from "chalk";
14569
14781
 
14570
14782
  // src/commands/format/init.ts
14571
- import { existsSync as existsSync30, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
14783
+ import { existsSync as existsSync30, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
14572
14784
  import chalk24 from "chalk";
14573
14785
 
14574
14786
  // src/shared/promptConfirm.ts
@@ -14630,13 +14842,13 @@ async function init() {
14630
14842
  const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
14631
14843
  `;
14632
14844
  const configPath = ".oxfmtrc.json";
14633
- const oldContent = existsSync30(configPath) ? readFileSync14(configPath, "utf8") : "";
14845
+ const oldContent = existsSync30(configPath) ? readFileSync15(configPath, "utf8") : "";
14634
14846
  if (oldContent === newContent) {
14635
14847
  console.log(".oxfmtrc.json already has the baseline formatter config");
14636
14848
  return;
14637
14849
  }
14638
14850
  if (!oldContent) {
14639
- writeFileSync8(configPath, newContent);
14851
+ writeFileSync9(configPath, newContent);
14640
14852
  console.log("Created .oxfmtrc.json with baseline formatter config");
14641
14853
  return;
14642
14854
  }
@@ -14648,17 +14860,17 @@ async function init() {
14648
14860
  console.log("Skipped .oxfmtrc.json update");
14649
14861
  return;
14650
14862
  }
14651
- writeFileSync8(configPath, newContent);
14863
+ writeFileSync9(configPath, newContent);
14652
14864
  console.log("Updated .oxfmtrc.json with baseline formatter config");
14653
14865
  }
14654
14866
 
14655
14867
  // src/commands/lint/init.ts
14656
- import { existsSync as existsSync33, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
14868
+ import { existsSync as existsSync33, readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "fs";
14657
14869
  import chalk25 from "chalk";
14658
14870
 
14659
14871
  // src/shared/removeEslint.ts
14660
14872
  import { execSync as execSync7 } from "child_process";
14661
- import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
14873
+ import { existsSync as existsSync32, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
14662
14874
 
14663
14875
  // src/shared/removeEslint/removeEslintConfigFiles.ts
14664
14876
  import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
@@ -14702,13 +14914,13 @@ function removeEslintFromPackageJson(options2) {
14702
14914
  if (!existsSync32(packageJsonPath)) {
14703
14915
  return false;
14704
14916
  }
14705
- const packageJson = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
14917
+ const packageJson = JSON.parse(readFileSync16(packageJsonPath, "utf8"));
14706
14918
  let modified = false;
14707
14919
  modified = removeEslintDeps(packageJson.dependencies) || modified;
14708
14920
  modified = removeEslintDeps(packageJson.devDependencies) || modified;
14709
14921
  modified = removeEslintScripts(packageJson.scripts, options2) || modified;
14710
14922
  if (modified) {
14711
- writeFileSync9(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
14923
+ writeFileSync10(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
14712
14924
  `);
14713
14925
  console.log("Removed eslint references from package.json");
14714
14926
  }
@@ -14766,13 +14978,13 @@ async function writeOxlintConfig() {
14766
14978
  const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
14767
14979
  `;
14768
14980
  const configPath = ".oxlintrc.json";
14769
- const oldContent = existsSync33(configPath) ? readFileSync16(configPath, "utf8") : "";
14981
+ const oldContent = existsSync33(configPath) ? readFileSync17(configPath, "utf8") : "";
14770
14982
  if (oldContent === newContent) {
14771
14983
  console.log(".oxlintrc.json already has the baseline linter config");
14772
14984
  return;
14773
14985
  }
14774
14986
  if (!oldContent) {
14775
- writeFileSync10(configPath, newContent);
14987
+ writeFileSync11(configPath, newContent);
14776
14988
  console.log("Created .oxlintrc.json with baseline linter config");
14777
14989
  return;
14778
14990
  }
@@ -14784,7 +14996,7 @@ async function writeOxlintConfig() {
14784
14996
  console.log("Skipped .oxlintrc.json update");
14785
14997
  return;
14786
14998
  }
14787
- writeFileSync10(configPath, newContent);
14999
+ writeFileSync11(configPath, newContent);
14788
15000
  console.log("Updated .oxlintrc.json with baseline linter config");
14789
15001
  }
14790
15002
 
@@ -15454,11 +15666,11 @@ async function run(options2 = {}) {
15454
15666
 
15455
15667
  // src/commands/new/registerNew/initGit.ts
15456
15668
  import { execSync as execSync10 } from "child_process";
15457
- import { writeFileSync as writeFileSync14 } from "fs";
15669
+ import { writeFileSync as writeFileSync15 } from "fs";
15458
15670
  function initGit() {
15459
15671
  console.log("Initializing git repository...");
15460
15672
  execSync10("git init", { stdio: "inherit" });
15461
- writeFileSync14(".gitignore", "dist\nnode_modules\n");
15673
+ writeFileSync15(".gitignore", "dist\nnode_modules\n");
15462
15674
  }
15463
15675
 
15464
15676
  // src/commands/new/registerNew/newCli/initPackageJson.ts
@@ -15477,10 +15689,10 @@ function initPackageJson(name) {
15477
15689
  }
15478
15690
 
15479
15691
  // src/commands/new/registerNew/newCli/writeCliTemplate.ts
15480
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync15 } from "fs";
15692
+ import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync16 } from "fs";
15481
15693
  function writeCliTemplate(name) {
15482
15694
  console.log("Writing tsconfig.json...");
15483
- writeFileSync15(
15695
+ writeFileSync16(
15484
15696
  "tsconfig.json",
15485
15697
  JSON.stringify(
15486
15698
  {
@@ -15504,7 +15716,7 @@ function writeCliTemplate(name) {
15504
15716
  )
15505
15717
  );
15506
15718
  console.log("Writing tsup.config.ts...");
15507
- writeFileSync15(
15719
+ writeFileSync16(
15508
15720
  "tsup.config.ts",
15509
15721
  `import { defineConfig } from "tsup";
15510
15722
  export default defineConfig({
@@ -15518,8 +15730,8 @@ export default defineConfig({
15518
15730
  `
15519
15731
  );
15520
15732
  console.log("Writing src/index.ts...");
15521
- mkdirSync8("src", { recursive: true });
15522
- writeFileSync15(
15733
+ mkdirSync9("src", { recursive: true });
15734
+ writeFileSync16(
15523
15735
  "src/index.ts",
15524
15736
  `#!/usr/bin/env node
15525
15737
  import { Command } from "commander";
@@ -15547,7 +15759,7 @@ async function newCli() {
15547
15759
 
15548
15760
  // src/commands/new/registerNew/newProject.ts
15549
15761
  import { execSync as execSync14 } from "child_process";
15550
- import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
15762
+ import { existsSync as existsSync38, readFileSync as readFileSync21, writeFileSync as writeFileSync18 } from "fs";
15551
15763
 
15552
15764
  // src/commands/deploy/init.ts
15553
15765
  import { execSync as execSync13 } from "child_process";
@@ -15555,33 +15767,33 @@ import chalk36 from "chalk";
15555
15767
  import enquirer3 from "enquirer";
15556
15768
 
15557
15769
  // src/commands/deploy/init/updateWorkflow.ts
15558
- import { existsSync as existsSync37, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync16 } from "fs";
15559
- import { dirname as dirname24, join as join43 } from "path";
15770
+ import { existsSync as existsSync37, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
15771
+ import { dirname as dirname25, join as join44 } from "path";
15560
15772
  import { fileURLToPath as fileURLToPath4 } from "url";
15561
15773
  import chalk35 from "chalk";
15562
15774
  var WORKFLOW_PATH = ".github/workflows/build.yml";
15563
- var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
15775
+ var __dirname3 = dirname25(fileURLToPath4(import.meta.url));
15564
15776
  function getExistingSiteId() {
15565
15777
  if (!existsSync37(WORKFLOW_PATH)) {
15566
15778
  return null;
15567
15779
  }
15568
- const content = readFileSync19(WORKFLOW_PATH, "utf8");
15780
+ const content = readFileSync20(WORKFLOW_PATH, "utf8");
15569
15781
  const match = content.match(/-s\s+([a-f0-9-]{36})/);
15570
15782
  return match ? match[1] : null;
15571
15783
  }
15572
15784
  function getTemplateContent(siteId) {
15573
- const templatePath = join43(__dirname3, "commands/deploy/build.yml");
15574
- const template = readFileSync19(templatePath, "utf8");
15785
+ const templatePath = join44(__dirname3, "commands/deploy/build.yml");
15786
+ const template = readFileSync20(templatePath, "utf8");
15575
15787
  return template.replace("{{NETLIFY_SITE_ID}}", siteId);
15576
15788
  }
15577
15789
  async function updateWorkflow(siteId) {
15578
15790
  const newContent = getTemplateContent(siteId);
15579
15791
  const workflowDir = ".github/workflows";
15580
15792
  if (!existsSync37(workflowDir)) {
15581
- mkdirSync9(workflowDir, { recursive: true });
15793
+ mkdirSync10(workflowDir, { recursive: true });
15582
15794
  }
15583
15795
  if (existsSync37(WORKFLOW_PATH)) {
15584
- const oldContent = readFileSync19(WORKFLOW_PATH, "utf8");
15796
+ const oldContent = readFileSync20(WORKFLOW_PATH, "utf8");
15585
15797
  if (oldContent === newContent) {
15586
15798
  console.log(chalk35.green("build.yml is already up to date"));
15587
15799
  return;
@@ -15595,7 +15807,7 @@ async function updateWorkflow(siteId) {
15595
15807
  return;
15596
15808
  }
15597
15809
  }
15598
- writeFileSync16(WORKFLOW_PATH, newContent);
15810
+ writeFileSync17(WORKFLOW_PATH, newContent);
15599
15811
  console.log(chalk35.green(`
15600
15812
  Created ${WORKFLOW_PATH}`));
15601
15813
  }
@@ -15679,7 +15891,7 @@ function addViteBaseConfig() {
15679
15891
  console.log("No vite.config.ts found, skipping base config");
15680
15892
  return;
15681
15893
  }
15682
- const content = readFileSync20(viteConfigPath, "utf8");
15894
+ const content = readFileSync21(viteConfigPath, "utf8");
15683
15895
  if (content.includes("base:")) {
15684
15896
  console.log("vite.config.ts already has base config");
15685
15897
  return;
@@ -15689,7 +15901,7 @@ function addViteBaseConfig() {
15689
15901
  'defineConfig({\n base: "./",'
15690
15902
  );
15691
15903
  if (updated2 !== content) {
15692
- writeFileSync17(viteConfigPath, updated2);
15904
+ writeFileSync18(viteConfigPath, updated2);
15693
15905
  console.log('Added base: "./" to vite.config.ts');
15694
15906
  }
15695
15907
  }
@@ -15877,19 +16089,19 @@ function adviceContextFor(cwd, env = process.env) {
15877
16089
  }
15878
16090
 
15879
16091
  // src/commands/advise/loadAdviceFragments.ts
15880
- import { readdirSync as readdirSync7, readFileSync as readFileSync21 } from "fs";
15881
- import { basename as basename12, join as join45 } from "path";
16092
+ import { readdirSync as readdirSync7, readFileSync as readFileSync22 } from "fs";
16093
+ import { basename as basename12, join as join46 } from "path";
15882
16094
 
15883
16095
  // src/commands/advise/adviceDir.ts
15884
16096
  import { existsSync as existsSync39 } from "fs";
15885
- import { dirname as dirname25, join as join44 } from "path";
16097
+ import { dirname as dirname26, join as join45 } from "path";
15886
16098
  import { fileURLToPath as fileURLToPath5 } from "url";
15887
16099
  function adviceDir() {
15888
- let current = dirname25(fileURLToPath5(import.meta.url));
15889
- while (current !== dirname25(current)) {
15890
- const candidate = join44(current, "claude", "advice");
16100
+ let current2 = dirname26(fileURLToPath5(import.meta.url));
16101
+ while (current2 !== dirname26(current2)) {
16102
+ const candidate = join45(current2, "claude", "advice");
15891
16103
  if (existsSync39(candidate)) return candidate;
15892
- current = dirname25(current);
16104
+ current2 = dirname26(current2);
15893
16105
  }
15894
16106
  throw new Error("Could not locate the shipped claude/advice directory");
15895
16107
  }
@@ -15920,7 +16132,7 @@ function loadAdviceFragments(dir = adviceDir()) {
15920
16132
  return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
15921
16133
  (file) => parseAdviceFragment(
15922
16134
  basename12(file, ".md"),
15923
- readFileSync21(join45(dir, file), "utf8")
16135
+ readFileSync22(join46(dir, file), "utf8")
15924
16136
  )
15925
16137
  );
15926
16138
  }
@@ -15955,12 +16167,12 @@ function renderAdviceBody(fragment, context) {
15955
16167
 
15956
16168
  // src/commands/advise/adviceConditions.ts
15957
16169
  import { existsSync as existsSync40 } from "fs";
15958
- import { join as join46 } from "path";
16170
+ import { join as join47 } from "path";
15959
16171
  function repoFile(file, label) {
15960
16172
  return {
15961
16173
  whenMet: `the repo has ${label}`,
15962
16174
  whenUnmet: `the repo has no ${label}`,
15963
- matches: ({ rootDir }) => existsSync40(join46(rootDir, file))
16175
+ matches: ({ rootDir }) => existsSync40(join47(rootDir, file))
15964
16176
  };
15965
16177
  }
15966
16178
  var adviceConditions = {
@@ -15986,11 +16198,11 @@ var adviceConditions = {
15986
16198
  },
15987
16199
  typescript: repoFile("tsconfig.json", "a tsconfig.json"),
15988
16200
  filenameConvention: repoFile(
15989
- join46("oxlint-rules", "filenameConvention.ts"),
16201
+ join47("oxlint-rules", "filenameConvention.ts"),
15990
16202
  "oxlint-rules/filenameConvention.ts"
15991
16203
  ),
15992
16204
  claudeSettings: repoFile(
15993
- join46("claude", "settings.json"),
16205
+ join47("claude", "settings.json"),
15994
16206
  "claude/settings.json"
15995
16207
  ),
15996
16208
  verify: {
@@ -16080,10 +16292,10 @@ function explainAdvice(context, fragments = loadAdviceFragments()) {
16080
16292
 
16081
16293
  // src/commands/advise/advise.ts
16082
16294
  async function hookCwd(options2) {
16083
- const read3 = options2.stdin ?? (process.stdin.isTTY ? void 0 : readStdin);
16084
- if (!read3) return void 0;
16295
+ const read4 = options2.stdin ?? (process.stdin.isTTY ? void 0 : readStdin);
16296
+ if (!read4) return void 0;
16085
16297
  try {
16086
- const raw = await read3();
16298
+ const raw = await read4();
16087
16299
  if (!raw.trim()) return void 0;
16088
16300
  return JSON.parse(raw).cwd;
16089
16301
  } catch {
@@ -16600,7 +16812,7 @@ async function resolveCheckBump(check2) {
16600
16812
  }
16601
16813
 
16602
16814
  // src/commands/backlog/readJsonPayload.ts
16603
- import { readFileSync as readFileSync22 } from "fs";
16815
+ import { readFileSync as readFileSync23 } from "fs";
16604
16816
  import chalk38 from "chalk";
16605
16817
  function fail(message3) {
16606
16818
  console.error(chalk38.red(message3));
@@ -16612,7 +16824,7 @@ function describe(error) {
16612
16824
  async function readSource(source) {
16613
16825
  try {
16614
16826
  if (source === "-") return (await readStdinBuffer()).toString("utf8");
16615
- return readFileSync22(source, "utf8");
16827
+ return readFileSync23(source, "utf8");
16616
16828
  } catch (error) {
16617
16829
  return fail(
16618
16830
  `Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
@@ -16872,7 +17084,7 @@ function registerAskQuestion(program) {
16872
17084
 
16873
17085
  // src/commands/registerBackup.ts
16874
17086
  import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
16875
- import { join as join48, resolve as resolve16 } from "path";
17087
+ import { join as join49, resolve as resolve16 } from "path";
16876
17088
  import chalk41 from "chalk";
16877
17089
 
16878
17090
  // src/shared/db/recordBackup.ts
@@ -16886,7 +17098,7 @@ async function recordBackup(db, {
16886
17098
 
16887
17099
  // src/commands/backup/scheduleBackup.ts
16888
17100
  import { mkdir as mkdir2 } from "fs/promises";
16889
- import { join as join47 } from "path";
17101
+ import { join as join48 } from "path";
16890
17102
  import chalk39 from "chalk";
16891
17103
 
16892
17104
  // src/commands/backup/readCrontab.ts
@@ -17028,7 +17240,7 @@ async function scheduleBackup({
17028
17240
  const cronExpr = durationToCron(every);
17029
17241
  const dir = expandTilde(loadConfig().backup.dir);
17030
17242
  await mkdir2(dir, { recursive: true });
17031
- const logPath2 = join47(dir, "cron.log");
17243
+ const logPath2 = join48(dir, "cron.log");
17032
17244
  const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
17033
17245
  writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
17034
17246
  console.error(
@@ -17051,13 +17263,13 @@ function scheduleStatus() {
17051
17263
  console.error(`assist backup runs every ${block.every} (${block.cron}).`);
17052
17264
  }
17053
17265
  function scheduleRemove() {
17054
- const current = readCrontab();
17055
- if (!readScheduleBlock(current)) {
17266
+ const current2 = readCrontab();
17267
+ if (!readScheduleBlock(current2)) {
17056
17268
  console.error("No assist backup schedule is set; nothing to remove.");
17057
17269
  return;
17058
17270
  }
17059
17271
  try {
17060
- writeCrontab(removeScheduleBlock(current));
17272
+ writeCrontab(removeScheduleBlock(current2));
17061
17273
  } catch (error) {
17062
17274
  fail2(error.message);
17063
17275
  }
@@ -17207,7 +17419,7 @@ async function backup({ out }) {
17207
17419
  await mkdir3(dir, { recursive: true });
17208
17420
  const start2 = Date.now();
17209
17421
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
17210
- const filePath = resolve16(join48(dir, `backup-${timestamp9}.dump`));
17422
+ const filePath = resolve16(join49(dir, `backup-${timestamp9}.dump`));
17211
17423
  await exportBacklog(filePath);
17212
17424
  const { size } = await stat4(filePath);
17213
17425
  const durationMs = Date.now() - start2;
@@ -17961,9 +18173,9 @@ async function countRows(client, table) {
17961
18173
  );
17962
18174
  return rows[0].n;
17963
18175
  }
17964
- function printSummary(tables, current, incoming) {
18176
+ function printSummary(tables, current2, incoming) {
17965
18177
  const lines2 = tables.map(
17966
- (t, i) => ` ${t.name}: ${current[i]} \u2192 ${incoming[i]} rows`
18178
+ (t, i) => ` ${t.name}: ${current2[i]} \u2192 ${incoming[i]} rows`
17967
18179
  );
17968
18180
  console.error(chalk53.bold("\nThis will REPLACE all backlog data:"));
17969
18181
  console.error(`${lines2.join("\n")}
@@ -17975,10 +18187,10 @@ async function confirmReplace(client, tables, incoming, fromStdin) {
17975
18187
  "Reading a dump from stdin requires --yes (stdin is consumed by the dump)."
17976
18188
  );
17977
18189
  }
17978
- const current = await Promise.all(
18190
+ const current2 = await Promise.all(
17979
18191
  tables.map((t) => countRows(client, t.name))
17980
18192
  );
17981
- printSummary(tables, current, incoming);
18193
+ printSummary(tables, current2, incoming);
17982
18194
  return promptConfirm("Replace all backlog data with this dump?", false);
17983
18195
  }
17984
18196
 
@@ -18103,9 +18315,9 @@ function ensureRemoteOrigin() {
18103
18315
 
18104
18316
  // src/commands/backlog/add/shared.ts
18105
18317
  import { spawnSync as spawnSync5 } from "child_process";
18106
- import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
18318
+ import { mkdtempSync, readFileSync as readFileSync24, unlinkSync as unlinkSync3, writeFileSync as writeFileSync19 } from "fs";
18107
18319
  import { tmpdir } from "os";
18108
- import { join as join50 } from "path";
18320
+ import { join as join51 } from "path";
18109
18321
  import enquirer4 from "enquirer";
18110
18322
  async function promptType() {
18111
18323
  const { type } = await enquirer4.prompt({
@@ -18145,15 +18357,15 @@ async function promptDescription() {
18145
18357
  }
18146
18358
  function openEditor() {
18147
18359
  const editor = process.env.EDITOR || process.env.VISUAL || "vi";
18148
- const dir = mkdtempSync(join50(tmpdir(), "assist-"));
18149
- const filePath = join50(dir, "description.md");
18150
- writeFileSync18(filePath, "");
18360
+ const dir = mkdtempSync(join51(tmpdir(), "assist-"));
18361
+ const filePath = join51(dir, "description.md");
18362
+ writeFileSync19(filePath, "");
18151
18363
  const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
18152
18364
  if (result.status !== 0) {
18153
18365
  unlinkSync3(filePath);
18154
18366
  return void 0;
18155
18367
  }
18156
- const content = readFileSync23(filePath, "utf8").trim();
18368
+ const content = readFileSync24(filePath, "utf8").trim();
18157
18369
  unlinkSync3(filePath);
18158
18370
  return content || void 0;
18159
18371
  }
@@ -18580,11 +18792,11 @@ function startProposedRun(id) {
18580
18792
  import { randomUUID as randomUUID9 } from "crypto";
18581
18793
 
18582
18794
  // src/commands/backlog/propose/mutateLedger.ts
18583
- import { mkdirSync as mkdirSync10, readFileSync as readFileSync24, renameSync as renameSync4, writeFileSync as writeFileSync19 } from "fs";
18584
- import { dirname as dirname26 } from "path";
18795
+ import { mkdirSync as mkdirSync11, readFileSync as readFileSync25, renameSync as renameSync4, writeFileSync as writeFileSync20 } from "fs";
18796
+ import { dirname as dirname27 } from "path";
18585
18797
  function readLedger(path109) {
18586
18798
  try {
18587
- const parsed = JSON.parse(readFileSync24(path109, "utf8"));
18799
+ const parsed = JSON.parse(readFileSync25(path109, "utf8"));
18588
18800
  return { open: parsed.open ?? [], created: parsed.created };
18589
18801
  } catch {
18590
18802
  return { open: [] };
@@ -18593,9 +18805,9 @@ function readLedger(path109) {
18593
18805
  function mutateLedger(path109, mutate) {
18594
18806
  const ledger = readLedger(path109);
18595
18807
  mutate(ledger);
18596
- mkdirSync10(dirname26(path109), { recursive: true });
18808
+ mkdirSync11(dirname27(path109), { recursive: true });
18597
18809
  const tmp = `${path109}.${process.pid}.tmp`;
18598
- writeFileSync19(tmp, JSON.stringify(ledger));
18810
+ writeFileSync20(tmp, JSON.stringify(ledger));
18599
18811
  renameSync4(tmp, path109);
18600
18812
  }
18601
18813
 
@@ -18624,9 +18836,9 @@ async function findPredecessor(path109, token, startedAt) {
18624
18836
 
18625
18837
  // src/commands/backlog/propose/proposalLedgerPath.ts
18626
18838
  import { homedir as homedir14 } from "os";
18627
- import { join as join51 } from "path";
18839
+ import { join as join52 } from "path";
18628
18840
  function proposalLedgerPath(sessionId2) {
18629
- return join51(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
18841
+ return join52(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
18630
18842
  }
18631
18843
 
18632
18844
  // src/commands/backlog/propose/trackProposal.ts
@@ -18745,11 +18957,11 @@ function hasCycle(adjacency, fromId, toId) {
18745
18957
  const visited = /* @__PURE__ */ new Set();
18746
18958
  const stack = [toId];
18747
18959
  while (stack.length > 0) {
18748
- const current = stack.pop();
18749
- if (current === fromId) return true;
18750
- if (visited.has(current)) continue;
18751
- visited.add(current);
18752
- for (const target of adjacency.get(current) ?? []) {
18960
+ const current2 = stack.pop();
18961
+ if (current2 === fromId) return true;
18962
+ if (visited.has(current2)) continue;
18963
+ visited.add(current2);
18964
+ for (const target of adjacency.get(current2) ?? []) {
18753
18965
  stack.push(target);
18754
18966
  }
18755
18967
  }
@@ -19120,13 +19332,13 @@ function hasLocalChanges() {
19120
19332
  // src/commands/backlog/acquireLock.ts
19121
19333
  import {
19122
19334
  existsSync as existsSync44,
19123
- mkdirSync as mkdirSync11,
19124
- readFileSync as readFileSync26,
19335
+ mkdirSync as mkdirSync12,
19336
+ readFileSync as readFileSync27,
19125
19337
  unlinkSync as unlinkSync4,
19126
- writeFileSync as writeFileSync20
19338
+ writeFileSync as writeFileSync21
19127
19339
  } from "fs";
19128
19340
  import { homedir as homedir15 } from "os";
19129
- import { join as join52 } from "path";
19341
+ import { join as join53 } from "path";
19130
19342
 
19131
19343
  // src/commands/backlog/bootedAt.ts
19132
19344
  import { uptime } from "os";
@@ -19135,11 +19347,11 @@ function bootedAt() {
19135
19347
  }
19136
19348
 
19137
19349
  // src/commands/backlog/processStartedAt.ts
19138
- import { readFileSync as readFileSync25 } from "fs";
19350
+ import { readFileSync as readFileSync26 } from "fs";
19139
19351
  var clockTicksPerSecond = 100;
19140
19352
  function processStartedAt(pid) {
19141
19353
  try {
19142
- const stat5 = readFileSync25(`/proc/${pid}/stat`, "utf8");
19354
+ const stat5 = readFileSync26(`/proc/${pid}/stat`, "utf8");
19143
19355
  const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
19144
19356
  const ticks = Number(fields[19]);
19145
19357
  if (!Number.isFinite(ticks)) return void 0;
@@ -19162,10 +19374,10 @@ function isStaleLock(pid, timestamp9) {
19162
19374
 
19163
19375
  // src/commands/backlog/acquireLock.ts
19164
19376
  function getLocksDir() {
19165
- return join52(homedir15(), ".assist", "locks");
19377
+ return join53(homedir15(), ".assist", "locks");
19166
19378
  }
19167
19379
  function getLockPath(itemId2) {
19168
- return join52(getLocksDir(), `lock-${itemId2}.json`);
19380
+ return join53(getLocksDir(), `lock-${itemId2}.json`);
19169
19381
  }
19170
19382
  function isProcessAlive(pid) {
19171
19383
  try {
@@ -19179,7 +19391,7 @@ function foreignLockHolder(itemId2) {
19179
19391
  const lockPath = getLockPath(itemId2);
19180
19392
  if (!existsSync44(lockPath)) return null;
19181
19393
  try {
19182
- const lock2 = JSON.parse(readFileSync26(lockPath, "utf8"));
19394
+ const lock2 = JSON.parse(readFileSync27(lockPath, "utf8"));
19183
19395
  if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
19184
19396
  if (!isProcessAlive(lock2.pid)) return null;
19185
19397
  if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
@@ -19192,8 +19404,8 @@ function isLockedByOther(itemId2) {
19192
19404
  return foreignLockHolder(itemId2) !== null;
19193
19405
  }
19194
19406
  function acquireLock(itemId2) {
19195
- mkdirSync11(getLocksDir(), { recursive: true });
19196
- writeFileSync20(
19407
+ mkdirSync12(getLocksDir(), { recursive: true });
19408
+ writeFileSync21(
19197
19409
  getLockPath(itemId2),
19198
19410
  JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
19199
19411
  );
@@ -19562,8 +19774,8 @@ Failed to launch Claude for ${context}: ${message3}`)
19562
19774
  }
19563
19775
 
19564
19776
  // src/commands/sessions/daemon/ensureHooksSettings.ts
19565
- import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync21 } from "fs";
19566
- import { dirname as dirname27 } from "path";
19777
+ import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync22 } from "fs";
19778
+ import { dirname as dirname28 } from "path";
19567
19779
  var SET_STATUS = "assist sessions set-status";
19568
19780
  function running(source) {
19569
19781
  return `${SET_STATUS} running --source ${source}`;
@@ -19596,8 +19808,8 @@ var hooksSettings = {
19596
19808
  };
19597
19809
  function ensureHooksSettings() {
19598
19810
  const path109 = daemonPaths.hooksSettings;
19599
- mkdirSync12(dirname27(path109), { recursive: true });
19600
- writeFileSync21(path109, JSON.stringify(hooksSettings, null, 2));
19811
+ mkdirSync13(dirname28(path109), { recursive: true });
19812
+ writeFileSync22(path109, JSON.stringify(hooksSettings, null, 2));
19601
19813
  return path109;
19602
19814
  }
19603
19815
 
@@ -19662,18 +19874,18 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
19662
19874
  }
19663
19875
 
19664
19876
  // src/commands/backlog/consumePause.ts
19665
- import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
19877
+ import { existsSync as existsSync45, mkdirSync as mkdirSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync23 } from "fs";
19666
19878
  import { homedir as homedir16 } from "os";
19667
- import { join as join53 } from "path";
19879
+ import { join as join54 } from "path";
19668
19880
  function getControlsDir() {
19669
- return join53(homedir16(), ".assist", "controls");
19881
+ return join54(homedir16(), ".assist", "controls");
19670
19882
  }
19671
19883
  function getPausePath(itemId2) {
19672
- return join53(getControlsDir(), `pause-${itemId2}.json`);
19884
+ return join54(getControlsDir(), `pause-${itemId2}.json`);
19673
19885
  }
19674
19886
  function requestPause(itemId2) {
19675
- mkdirSync13(getControlsDir(), { recursive: true });
19676
- writeFileSync22(
19887
+ mkdirSync14(getControlsDir(), { recursive: true });
19888
+ writeFileSync23(
19677
19889
  getPausePath(itemId2),
19678
19890
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
19679
19891
  );
@@ -19738,7 +19950,7 @@ async function ensureDone(id) {
19738
19950
  import chalk79 from "chalk";
19739
19951
 
19740
19952
  // src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
19741
- var ACK_TIMEOUT_MS = 1e3;
19953
+ var ACK_TIMEOUT_MS2 = 1e3;
19742
19954
  function sendToDaemonAwaitAck(message3) {
19743
19955
  return new Promise((resolve34, reject) => {
19744
19956
  connectToDaemon().then((socket) => {
@@ -19753,7 +19965,7 @@ function sendToDaemonAwaitAck(message3) {
19753
19965
  };
19754
19966
  const timer = setTimeout(
19755
19967
  () => finish2(new Error("timed out awaiting daemon ack")),
19756
- ACK_TIMEOUT_MS
19968
+ ACK_TIMEOUT_MS2
19757
19969
  );
19758
19970
  readSocketLines(socket, (line) => {
19759
19971
  if (isAck(line)) finish2();
@@ -19944,12 +20156,12 @@ function spawnHarness(harness, prompt, options2 = {}) {
19944
20156
  import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
19945
20157
 
19946
20158
  // src/commands/backlog/readSignal.ts
19947
- import { existsSync as existsSync46, readFileSync as readFileSync27 } from "fs";
20159
+ import { existsSync as existsSync46, readFileSync as readFileSync28 } from "fs";
19948
20160
  function readSignal() {
19949
20161
  const path109 = getSignalPath();
19950
20162
  if (!path109 || !existsSync46(path109)) return void 0;
19951
20163
  try {
19952
- return JSON.parse(readFileSync27(path109, "utf8"));
20164
+ return JSON.parse(readFileSync28(path109, "utf8"));
19953
20165
  } catch {
19954
20166
  return void 0;
19955
20167
  }
@@ -20125,9 +20337,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
20125
20337
  }
20126
20338
 
20127
20339
  // src/shared/emitActivity.ts
20128
- import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
20340
+ import { mkdirSync as mkdirSync15, readFileSync as readFileSync29, rmSync as rmSync4, writeFileSync as writeFileSync24 } from "fs";
20129
20341
  import { homedir as homedir17 } from "os";
20130
- import { dirname as dirname28, join as join54 } from "path";
20342
+ import { dirname as dirname29, join as join55 } from "path";
20131
20343
  import { z as z17 } from "zod";
20132
20344
  var activitySchema = z17.object({
20133
20345
  kind: z17.enum(["command", "backlog"]),
@@ -20144,18 +20356,18 @@ var activitySchema = z17.object({
20144
20356
  startedAt: z17.number()
20145
20357
  });
20146
20358
  function activityPath(sessionId2) {
20147
- return join54(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
20359
+ return join55(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
20148
20360
  }
20149
20361
  function emitActivity(activity2) {
20150
20362
  const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
20151
20363
  if (!sessionId2) return;
20152
20364
  const path109 = activityPath(sessionId2);
20153
- mkdirSync14(dirname28(path109), { recursive: true });
20154
- writeFileSync23(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
20365
+ mkdirSync15(dirname29(path109), { recursive: true });
20366
+ writeFileSync24(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
20155
20367
  }
20156
20368
  function readActivity(path109) {
20157
20369
  try {
20158
- return JSON.parse(readFileSync28(path109, "utf8"));
20370
+ return JSON.parse(readFileSync29(path109, "utf8"));
20159
20371
  } catch {
20160
20372
  return void 0;
20161
20373
  }
@@ -20166,14 +20378,14 @@ function reconcileActivity(sessionId2, activity2) {
20166
20378
  return;
20167
20379
  }
20168
20380
  const path109 = activityPath(sessionId2);
20169
- mkdirSync14(dirname28(path109), { recursive: true });
20170
- writeFileSync23(path109, JSON.stringify(activity2));
20381
+ mkdirSync15(dirname29(path109), { recursive: true });
20382
+ writeFileSync24(path109, JSON.stringify(activity2));
20171
20383
  }
20172
20384
  function writeActivityIfAbsent(sessionId2, activity2) {
20173
20385
  const path109 = activityPath(sessionId2);
20174
- mkdirSync14(dirname28(path109), { recursive: true });
20386
+ mkdirSync15(dirname29(path109), { recursive: true });
20175
20387
  try {
20176
- writeFileSync23(path109, JSON.stringify(activity2), { flag: "wx" });
20388
+ writeFileSync24(path109, JSON.stringify(activity2), { flag: "wx" });
20177
20389
  return true;
20178
20390
  } catch (error) {
20179
20391
  if (error.code === "EEXIST") return false;
@@ -21250,8 +21462,8 @@ function hasListMutations(options2) {
21250
21462
  options2.add && options2.add.length > 0 || options2.edit || options2.remove
21251
21463
  );
21252
21464
  }
21253
- function applyListMutations(current, options2, flags2) {
21254
- let items2 = [...current];
21465
+ function applyListMutations(current2, options2, flags2) {
21466
+ let items2 = [...current2];
21255
21467
  if (options2.edit) {
21256
21468
  const [rawIndex, ...textParts] = options2.edit;
21257
21469
  if (rawIndex === void 0 || textParts.length === 0) {
@@ -21284,7 +21496,7 @@ function applyListMutations(current, options2, flags2) {
21284
21496
  }
21285
21497
 
21286
21498
  // src/commands/backlog/update/resolveListUpdate.ts
21287
- function resolveListUpdate(whole, current, mutations, wholeFlag, flags2) {
21499
+ function resolveListUpdate(whole, current2, mutations, wholeFlag, flags2) {
21288
21500
  if (!hasListMutations(mutations)) return { ok: true, items: whole };
21289
21501
  if (whole) {
21290
21502
  return {
@@ -21292,7 +21504,7 @@ function resolveListUpdate(whole, current, mutations, wholeFlag, flags2) {
21292
21504
  error: `Cannot combine ${wholeFlag} with ${flags2.add}/${flags2.edit}/${flags2.remove}.`
21293
21505
  };
21294
21506
  }
21295
- return applyListMutations(current, mutations, flags2);
21507
+ return applyListMutations(current2, mutations, flags2);
21296
21508
  }
21297
21509
 
21298
21510
  // src/commands/backlog/resolvePhaseFields.ts
@@ -21306,19 +21518,19 @@ var CHECK_FLAGS = {
21306
21518
  edit: "--edit-check",
21307
21519
  remove: "--remove-check"
21308
21520
  };
21309
- function resolveTasks(o, current) {
21521
+ function resolveTasks(o, current2) {
21310
21522
  return resolveListUpdate(
21311
21523
  o.task,
21312
- (current?.tasks ?? []).map((t) => t.task),
21524
+ (current2?.tasks ?? []).map((t) => t.task),
21313
21525
  { add: o.addTask, edit: o.editTask, remove: o.removeTask },
21314
21526
  "--task",
21315
21527
  TASK_FLAGS
21316
21528
  );
21317
21529
  }
21318
- function resolveChecks(o, current) {
21530
+ function resolveChecks(o, current2) {
21319
21531
  return resolveListUpdate(
21320
21532
  o.manualCheck,
21321
- current?.manualChecks ?? [],
21533
+ current2?.manualChecks ?? [],
21322
21534
  { add: o.addCheck, edit: o.editCheck, remove: o.removeCheck },
21323
21535
  "--manual-check",
21324
21536
  CHECK_FLAGS
@@ -21338,10 +21550,10 @@ function buildFields(name, tasks, checks2) {
21338
21550
  }
21339
21551
  return { ok: true, fields };
21340
21552
  }
21341
- function resolvePhaseFields(options2, current) {
21342
- const tasks = resolveTasks(options2, current);
21553
+ function resolvePhaseFields(options2, current2) {
21554
+ const tasks = resolveTasks(options2, current2);
21343
21555
  if (!tasks.ok) return tasks;
21344
- const checks2 = resolveChecks(options2, current);
21556
+ const checks2 = resolveChecks(options2, current2);
21345
21557
  if (!checks2.ok) return checks2;
21346
21558
  return buildFields(options2.name, tasks, checks2);
21347
21559
  }
@@ -21463,9 +21675,9 @@ function hasAcMutations(options2) {
21463
21675
  remove: options2.removeAc
21464
21676
  });
21465
21677
  }
21466
- function applyAcMutations(current, options2) {
21678
+ function applyAcMutations(current2, options2) {
21467
21679
  const result = applyListMutations(
21468
- current,
21680
+ current2,
21469
21681
  { add: options2.addAc, edit: options2.editAc, remove: options2.removeAc },
21470
21682
  { add: "--add-ac", edit: "--edit-ac", remove: "--remove-ac" }
21471
21683
  );
@@ -22230,7 +22442,7 @@ function isUnderPosixTmp(target, tmp) {
22230
22442
  }
22231
22443
 
22232
22444
  // src/shared/consumeRedirect.ts
22233
- function consumeRedirect(tokens, opIndex, current) {
22445
+ function consumeRedirect(tokens, opIndex, current2) {
22234
22446
  const target = tokens[opIndex + 1];
22235
22447
  if (typeof target !== "string") {
22236
22448
  return { ok: false, error: "unable to parse" };
@@ -22241,32 +22453,32 @@ function consumeRedirect(tokens, opIndex, current) {
22241
22453
  error: `redirect target '${target}' is outside the OS temp directory`
22242
22454
  };
22243
22455
  }
22244
- popFdPrefix(current);
22456
+ popFdPrefix(current2);
22245
22457
  return { ok: true, nextIndex: opIndex + 1 };
22246
22458
  }
22247
- function popFdPrefix(current) {
22248
- if (current.length > 0 && /^\d$/.test(current[current.length - 1])) {
22249
- current.pop();
22459
+ function popFdPrefix(current2) {
22460
+ if (current2.length > 0 && /^\d$/.test(current2[current2.length - 1])) {
22461
+ current2.pop();
22250
22462
  }
22251
22463
  }
22252
22464
 
22253
22465
  // src/shared/consumeHeredoc.ts
22254
- function consumeHeredoc(tokens, opIndex, current) {
22466
+ function consumeHeredoc(tokens, opIndex, current2) {
22255
22467
  const delimiter = tokens[opIndex + 2];
22256
22468
  if (typeof delimiter !== "string") {
22257
22469
  return { ok: false, error: "unable to parse" };
22258
22470
  }
22259
- popFdPrefix(current);
22471
+ popFdPrefix(current2);
22260
22472
  return { ok: true, nextIndex: opIndex + 2 };
22261
22473
  }
22262
22474
 
22263
22475
  // src/shared/consumeInputRedirect.ts
22264
- function consumeInputRedirect(tokens, opIndex, current) {
22476
+ function consumeInputRedirect(tokens, opIndex, current2) {
22265
22477
  const source = tokens[opIndex + 1];
22266
22478
  if (typeof source !== "string") {
22267
22479
  return { ok: false, error: "unable to parse" };
22268
22480
  }
22269
- popFdPrefix(current);
22481
+ popFdPrefix(current2);
22270
22482
  return { ok: true, nextIndex: opIndex + 1 };
22271
22483
  }
22272
22484
 
@@ -22300,8 +22512,8 @@ function handleToken(tokens, i, groups) {
22300
22512
  return consumeRedirect(tokens, i, groups[groups.length - 1]);
22301
22513
  }
22302
22514
  if (op === INPUT_REDIRECT_OP) {
22303
- const current = groups[groups.length - 1];
22304
- return getOp(tokens[i + 1]) === INPUT_REDIRECT_OP ? consumeHeredoc(tokens, i, current) : consumeInputRedirect(tokens, i, current);
22515
+ const current2 = groups[groups.length - 1];
22516
+ return getOp(tokens[i + 1]) === INPUT_REDIRECT_OP ? consumeHeredoc(tokens, i, current2) : consumeInputRedirect(tokens, i, current2);
22305
22517
  }
22306
22518
  return UNPARSEABLE;
22307
22519
  }
@@ -22438,7 +22650,7 @@ function stripEnvPrefix(parts) {
22438
22650
  }
22439
22651
 
22440
22652
  // src/commands/cliHook/isGhGraphqlIssueMutation.ts
22441
- import { readFileSync as readFileSync29 } from "fs";
22653
+ import { readFileSync as readFileSync30 } from "fs";
22442
22654
  var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
22443
22655
  var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
22444
22656
  function isGhGraphqlIssueMutation(command) {
@@ -22450,7 +22662,7 @@ function isGhGraphqlIssueMutation(command) {
22450
22662
  }
22451
22663
  function readOrEmpty(path109) {
22452
22664
  try {
22453
- return readFileSync29(path109, "utf8");
22665
+ return readFileSync30(path109, "utf8");
22454
22666
  } catch {
22455
22667
  return "";
22456
22668
  }
@@ -22653,10 +22865,10 @@ function pipesToFilter(rawCommand, filters) {
22653
22865
  function namedFilters(filters) {
22654
22866
  return `${filters.slice(0, -1).join(", ")} or ${filters.at(-1)}`;
22655
22867
  }
22656
- function readDecision(read3) {
22868
+ function readDecision(read4) {
22657
22869
  return {
22658
22870
  permissionDecision: "deny",
22659
- permissionDecisionReason: `Do not pipe '${read3.prefix}' through ${namedFilters(read3.filters)}. ${read3.reason}`
22871
+ permissionDecisionReason: `Do not pipe '${read4.prefix}' through ${namedFilters(read4.filters)}. ${read4.reason}`
22660
22872
  };
22661
22873
  }
22662
22874
  function gatedDecision(gated) {
@@ -22666,18 +22878,18 @@ function gatedDecision(gated) {
22666
22878
  };
22667
22879
  }
22668
22880
  function findTruncatedReadDeny(parts) {
22669
- const read3 = parts.map(matchUntruncatableRead).find(Boolean);
22670
- if (read3 && parts.some((part) => startsWithFilter(part, read3.filters)))
22671
- return readDecision(read3);
22881
+ const read4 = parts.map(matchUntruncatableRead).find(Boolean);
22882
+ if (read4 && parts.some((part) => startsWithFilter(part, read4.filters)))
22883
+ return readDecision(read4);
22672
22884
  const gated = parts.map(matchApprovalGatedCommand).find(Boolean);
22673
22885
  if (gated && parts.some((part) => startsWithFilter(part, TRUNCATOR_BINARIES)))
22674
22886
  return gatedDecision(gated);
22675
22887
  return void 0;
22676
22888
  }
22677
22889
  function findTruncatedReadDenyRaw(rawCommand) {
22678
- const read3 = matchUntruncatableRead(rawCommand);
22679
- if (read3 && pipesToFilter(rawCommand, read3.filters))
22680
- return readDecision(read3);
22890
+ const read4 = matchUntruncatableRead(rawCommand);
22891
+ if (read4 && pipesToFilter(rawCommand, read4.filters))
22892
+ return readDecision(read4);
22681
22893
  const gated = matchApprovalGatedCommand(rawCommand);
22682
22894
  if (gated && pipesToFilter(rawCommand, TRUNCATOR_BINARIES))
22683
22895
  return gatedDecision(gated);
@@ -22702,29 +22914,29 @@ function configuresReleases(command) {
22702
22914
  // src/shared/tokenize.ts
22703
22915
  function tokenize(command) {
22704
22916
  const tokens = [];
22705
- let current = "";
22917
+ let current2 = "";
22706
22918
  let inSingle = false;
22707
22919
  let inDouble = false;
22708
22920
  for (let i = 0; i < command.length; i++) {
22709
22921
  const ch = command[i];
22710
22922
  if (ch === "'" && !inDouble) {
22711
22923
  inSingle = !inSingle;
22712
- current += ch;
22924
+ current2 += ch;
22713
22925
  } else if (ch === '"' && !inSingle) {
22714
22926
  inDouble = !inDouble;
22715
- current += ch;
22927
+ current2 += ch;
22716
22928
  } else if (ch === "\\" && inDouble && i + 1 < command.length) {
22717
- current += ch + command[++i];
22929
+ current2 += ch + command[++i];
22718
22930
  } else if (/\s/.test(ch) && !inSingle && !inDouble) {
22719
- if (current) {
22720
- tokens.push(current);
22721
- current = "";
22931
+ if (current2) {
22932
+ tokens.push(current2);
22933
+ current2 = "";
22722
22934
  }
22723
22935
  } else {
22724
- current += ch;
22936
+ current2 += ch;
22725
22937
  }
22726
22938
  }
22727
- if (current) tokens.push(current);
22939
+ if (current2) tokens.push(current2);
22728
22940
  return tokens;
22729
22941
  }
22730
22942
 
@@ -22781,17 +22993,17 @@ function extractGraphqlQuery(args) {
22781
22993
  }
22782
22994
 
22783
22995
  // src/shared/loadCliReads.ts
22784
- import { existsSync as existsSync49, readFileSync as readFileSync30, writeFileSync as writeFileSync24 } from "fs";
22785
- import { dirname as dirname29, resolve as resolve18 } from "path";
22996
+ import { existsSync as existsSync49, readFileSync as readFileSync31, writeFileSync as writeFileSync25 } from "fs";
22997
+ import { dirname as dirname30, resolve as resolve18 } from "path";
22786
22998
  import { fileURLToPath as fileURLToPath6 } from "url";
22787
22999
  var __filename3 = fileURLToPath6(import.meta.url);
22788
- var __dirname4 = dirname29(__filename3);
23000
+ var __dirname4 = dirname30(__filename3);
22789
23001
  function packageRoot() {
22790
23002
  return __dirname4;
22791
23003
  }
22792
23004
  function readLines(path109) {
22793
23005
  if (!existsSync49(path109)) return [];
22794
- return readFileSync30(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
23006
+ return readFileSync31(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
22795
23007
  }
22796
23008
  var cachedReads;
22797
23009
  var cachedWrites;
@@ -22811,7 +23023,7 @@ function loadCliReads() {
22811
23023
  return getCliReadsLines();
22812
23024
  }
22813
23025
  function saveCliReads(commands) {
22814
- writeFileSync24(
23026
+ writeFileSync25(
22815
23027
  resolve18(packageRoot(), "allowed.cli-reads"),
22816
23028
  `${commands.join("\n")}
22817
23029
  `
@@ -22837,14 +23049,14 @@ function findCliWrite(command) {
22837
23049
  }
22838
23050
 
22839
23051
  // src/shared/readSettingsPerms.ts
22840
- import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
23052
+ import { existsSync as existsSync50, readFileSync as readFileSync32 } from "fs";
22841
23053
  import { homedir as homedir18 } from "os";
22842
- import { join as join55 } from "path";
23054
+ import { join as join56 } from "path";
22843
23055
  function readSettingsPerms(key) {
22844
23056
  const paths = [
22845
- join55(homedir18(), ".claude", "settings.json"),
22846
- join55(process.cwd(), ".claude", "settings.json"),
22847
- join55(process.cwd(), ".claude", "settings.local.json")
23057
+ join56(homedir18(), ".claude", "settings.json"),
23058
+ join56(process.cwd(), ".claude", "settings.json"),
23059
+ join56(process.cwd(), ".claude", "settings.local.json")
22848
23060
  ];
22849
23061
  const entries = [];
22850
23062
  for (const p of paths) {
@@ -22855,7 +23067,7 @@ function readSettingsPerms(key) {
22855
23067
  function readPermissionArray(filePath, key) {
22856
23068
  if (!existsSync50(filePath)) return [];
22857
23069
  try {
22858
- const data = JSON.parse(readFileSync31(filePath, "utf8"));
23070
+ const data = JSON.parse(readFileSync32(filePath, "utf8"));
22859
23071
  const arr = data?.permissions?.[key];
22860
23072
  return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
22861
23073
  } catch {
@@ -23125,14 +23337,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
23125
23337
  }
23126
23338
 
23127
23339
  // src/commands/schema/isSchemaPath.ts
23128
- import { readFileSync as readFileSync32 } from "fs";
23340
+ import { readFileSync as readFileSync33 } from "fs";
23129
23341
  import { relative as relative7, resolve as resolve21 } from "path";
23130
23342
  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; otherwise it lasts for this Claude session.";
23131
23343
  var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
23132
23344
  var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
23133
23345
  function readOrEmpty2(path109) {
23134
23346
  try {
23135
- return readFileSync32(path109, "utf8");
23347
+ return readFileSync33(path109, "utf8");
23136
23348
  } catch {
23137
23349
  return "";
23138
23350
  }
@@ -23199,13 +23411,13 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
23199
23411
  }
23200
23412
 
23201
23413
  // src/commands/cliHook/logDeniedToolCall.ts
23202
- import { mkdirSync as mkdirSync15 } from "fs";
23414
+ import { mkdirSync as mkdirSync16 } from "fs";
23203
23415
  import { homedir as homedir19 } from "os";
23204
- import { join as join56 } from "path";
23416
+ import { join as join57 } from "path";
23205
23417
  import Database from "better-sqlite3";
23206
23418
  var _db;
23207
23419
  function getDbDir() {
23208
- return join56(homedir19(), ".assist");
23420
+ return join57(homedir19(), ".assist");
23209
23421
  }
23210
23422
  function initSchema(db) {
23211
23423
  db.exec(`
@@ -23223,8 +23435,8 @@ function initSchema(db) {
23223
23435
  function openPromptsDb(dir) {
23224
23436
  if (_db) return _db;
23225
23437
  const dbDir = dir ?? getDbDir();
23226
- mkdirSync15(dbDir, { recursive: true });
23227
- const db = new Database(join56(dbDir, "assist.db"));
23438
+ mkdirSync16(dbDir, { recursive: true });
23439
+ const db = new Database(join57(dbDir, "assist.db"));
23228
23440
  db.pragma("journal_mode = WAL");
23229
23441
  initSchema(db);
23230
23442
  _db = db;
@@ -23291,26 +23503,26 @@ function tryParseInput(raw) {
23291
23503
  import { existsSync as existsSync51 } from "fs";
23292
23504
 
23293
23505
  // src/commands/schema/getSchemaSessionApprovalPath.ts
23294
- import { join as join58 } from "path";
23506
+ import { join as join59 } from "path";
23295
23507
 
23296
23508
  // src/commands/codeComment/getRestrictedDir.ts
23297
23509
  import { homedir as homedir20 } from "os";
23298
- import { join as join57 } from "path";
23510
+ import { join as join58 } from "path";
23299
23511
  function getRestrictedDir() {
23300
- return join57(homedir20(), ".assist", "restricted");
23512
+ return join58(homedir20(), ".assist", "restricted");
23301
23513
  }
23302
23514
  function getPinStatePath(pin2) {
23303
- return join57(getRestrictedDir(), `code-comment-${pin2}.json`);
23515
+ return join58(getRestrictedDir(), `code-comment-${pin2}.json`);
23304
23516
  }
23305
23517
 
23306
23518
  // src/commands/schema/getSchemaSessionApprovalPath.ts
23307
23519
  var SESSION_ID = /^[\w-]+$/;
23308
23520
  function getSchemaSessionApprovalDir() {
23309
- return join58(getRestrictedDir(), "schema-sessions");
23521
+ return join59(getRestrictedDir(), "schema-sessions");
23310
23522
  }
23311
23523
  function getSchemaSessionApprovalPath(claudeSessionId) {
23312
23524
  if (!SESSION_ID.test(claudeSessionId)) return void 0;
23313
- return join58(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
23525
+ return join59(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
23314
23526
  }
23315
23527
 
23316
23528
  // src/commands/schema/isSchemaLocked.ts
@@ -23407,9 +23619,9 @@ ${reasons.join("\n")}`);
23407
23619
  }
23408
23620
 
23409
23621
  // src/commands/permitCliReads.ts
23410
- import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
23622
+ import { existsSync as existsSync52, mkdirSync as mkdirSync17, readFileSync as readFileSync34, writeFileSync as writeFileSync26 } from "fs";
23411
23623
  import { homedir as homedir21 } from "os";
23412
- import { join as join59 } from "path";
23624
+ import { join as join60 } from "path";
23413
23625
 
23414
23626
  // src/commands/permitCliReads/assertCliExists.ts
23415
23627
  function assertCliExists(cli) {
@@ -23672,17 +23884,17 @@ function updateSettings(cli, commands) {
23672
23884
  // src/commands/permitCliReads.ts
23673
23885
  function logPath(cli) {
23674
23886
  const safeName = cli.replace(/\s+/g, "-");
23675
- return join59(homedir21(), ".assist", `cli-discover-${safeName}.log`);
23887
+ return join60(homedir21(), ".assist", `cli-discover-${safeName}.log`);
23676
23888
  }
23677
23889
  function readCache(cli) {
23678
23890
  const path109 = logPath(cli);
23679
23891
  if (!existsSync52(path109)) return void 0;
23680
- return readFileSync33(path109, "utf8");
23892
+ return readFileSync34(path109, "utf8");
23681
23893
  }
23682
23894
  function writeCache(cli, output) {
23683
- const dir = join59(homedir21(), ".assist");
23684
- mkdirSync16(dir, { recursive: true });
23685
- writeFileSync25(logPath(cli), output);
23895
+ const dir = join60(homedir21(), ".assist");
23896
+ mkdirSync17(dir, { recursive: true });
23897
+ writeFileSync26(logPath(cli), output);
23686
23898
  }
23687
23899
  async function permitCliReads(cli, options2 = { noCache: false }) {
23688
23900
  if (!cli) {
@@ -23812,7 +24024,7 @@ function registerCliHook(program) {
23812
24024
  }
23813
24025
 
23814
24026
  // src/commands/codeComment/codeCommentConfirm.ts
23815
- import { existsSync as existsSync54, readFileSync as readFileSync35, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
24027
+ import { existsSync as existsSync54, readFileSync as readFileSync36, unlinkSync as unlinkSync8, writeFileSync as writeFileSync27 } from "fs";
23816
24028
  import chalk120 from "chalk";
23817
24029
 
23818
24030
  // src/shared/isHashCommentFile.ts
@@ -23846,7 +24058,7 @@ function isHashCommentFile(filePath) {
23846
24058
 
23847
24059
  // src/commands/codeComment/sweepRestrictedDir.ts
23848
24060
  import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
23849
- import { join as join60 } from "path";
24061
+ import { join as join61 } from "path";
23850
24062
  var STALE_AFTER_MS = 30 * 60 * 1e3;
23851
24063
  function sweepRestrictedDir(dir = getRestrictedDir()) {
23852
24064
  let entries;
@@ -23857,7 +24069,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
23857
24069
  }
23858
24070
  const cutoff = Date.now() - STALE_AFTER_MS;
23859
24071
  for (const entry of entries) {
23860
- const path109 = join60(dir, entry);
24072
+ const path109 = join61(dir, entry);
23861
24073
  try {
23862
24074
  if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
23863
24075
  } catch {
@@ -23867,12 +24079,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
23867
24079
  }
23868
24080
 
23869
24081
  // src/commands/codeComment/readPinState.ts
23870
- import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
24082
+ import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
23871
24083
  function readPinState(pin2) {
23872
24084
  const path109 = getPinStatePath(pin2);
23873
24085
  if (!existsSync53(path109)) return void 0;
23874
24086
  try {
23875
- const state = JSON.parse(readFileSync34(path109, "utf8"));
24087
+ const state = JSON.parse(readFileSync35(path109, "utf8"));
23876
24088
  if (state.pin !== pin2) return void 0;
23877
24089
  return state;
23878
24090
  } catch {
@@ -23894,7 +24106,7 @@ function codeCommentConfirm(pin2) {
23894
24106
  process.exitCode = 1;
23895
24107
  return;
23896
24108
  }
23897
- const original = readFileSync35(state.file, "utf8");
24109
+ const original = readFileSync36(state.file, "utf8");
23898
24110
  const lines2 = original.split("\n");
23899
24111
  const index3 = state.line - 1;
23900
24112
  if (index3 > lines2.length) {
@@ -23910,7 +24122,7 @@ function codeCommentConfirm(pin2) {
23910
24122
  const indentSource = lines2[index3] ?? "";
23911
24123
  const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
23912
24124
  lines2.splice(index3, 0, `${indent4}${marker2} ${state.text}`);
23913
- writeFileSync26(state.file, lines2.join("\n"));
24125
+ writeFileSync27(state.file, lines2.join("\n"));
23914
24126
  unlinkSync8(getPinStatePath(pin2));
23915
24127
  console.log(
23916
24128
  chalk120.green(
@@ -23948,7 +24160,7 @@ function validateCommentText(raw, isHash = false) {
23948
24160
  }
23949
24161
 
23950
24162
  // src/commands/codeComment/issuePin.ts
23951
- import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
24163
+ import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync28 } from "fs";
23952
24164
  import { randomInt } from "crypto";
23953
24165
 
23954
24166
  // src/commands/notify/deliverPinNotification.ts
@@ -24033,9 +24245,9 @@ async function deliverPinNotification(notification) {
24033
24245
  // src/commands/codeComment/issuePin.ts
24034
24246
  function issuePin(file, lineNumber, text20) {
24035
24247
  const pin2 = generatePin();
24036
- mkdirSync17(getRestrictedDir(), { recursive: true });
24248
+ mkdirSync18(getRestrictedDir(), { recursive: true });
24037
24249
  sweepRestrictedDir();
24038
- writeFileSync27(
24250
+ writeFileSync28(
24039
24251
  getPinStatePath(pin2),
24040
24252
  JSON.stringify({ pin: pin2, file, line: lineNumber, text: text20 })
24041
24253
  );
@@ -24259,8 +24471,8 @@ function upstreamBranch() {
24259
24471
  function warnIfUnexpectedBranch(config) {
24260
24472
  const expected = config.commit?.expectedBranch;
24261
24473
  if (!expected) return;
24262
- const current = currentBranch3();
24263
- if (current === null || current === expected) return;
24474
+ const current2 = currentBranch3();
24475
+ if (current2 === null || current2 === expected) return;
24264
24476
  if (upstreamBranch() === expected) return;
24265
24477
  const line = "\u2500".repeat(64);
24266
24478
  console.warn(
@@ -24268,7 +24480,7 @@ function warnIfUnexpectedBranch(config) {
24268
24480
  [
24269
24481
  "",
24270
24482
  line,
24271
- `\u26A0 On branch "${current}", but this repo expects "${expected}".`,
24483
+ `\u26A0 On branch "${current2}", but this repo expects "${expected}".`,
24272
24484
  ` Work committed here may be orphaned and never reach "${expected}".`,
24273
24485
  line,
24274
24486
  ""
@@ -25501,8 +25713,8 @@ function exitWithConfigErrors(errors) {
25501
25713
 
25502
25714
  // src/commands/config/diffRepoConfigLeaves.ts
25503
25715
  import { isDeepStrictEqual as isDeepStrictEqual2 } from "util";
25504
- function diffRepoConfigLeaves(current, incoming) {
25505
- const existing = new Map(leaves(current));
25716
+ function diffRepoConfigLeaves(current2, incoming) {
25717
+ const existing = new Map(leaves(current2));
25506
25718
  return leaves(incoming).flatMap(([key, to]) => {
25507
25719
  if (!existing.has(key)) return [{ key, to }];
25508
25720
  const from = existing.get(key);
@@ -25523,12 +25735,12 @@ function isPlainObject4(value) {
25523
25735
  function planRepoConfigImport(ymlRepos, dbRepos) {
25524
25736
  return Object.entries(ymlRepos).map(([ymlKey, block]) => {
25525
25737
  const dbKey = matchDbKey(dbRepos, ymlKey) ?? ymlKey;
25526
- const current = dbRepos[dbKey] ?? {};
25738
+ const current2 = dbRepos[dbKey] ?? {};
25527
25739
  const incoming = isPlainObject5(block) ? block : {};
25528
- const changes = diffRepoConfigLeaves(current, incoming);
25740
+ const changes = diffRepoConfigLeaves(current2, incoming);
25529
25741
  const merged = changes.reduce(
25530
25742
  (acc, change) => setNestedValue(acc, change.key, change.to),
25531
- current
25743
+ current2
25532
25744
  );
25533
25745
  const validation = validateConfig(merged, ymlKey, repoConfigSchema);
25534
25746
  const errors = validation.ok ? [] : validation.errors.map((error) => `repos.${ymlKey}.${error}`);
@@ -25633,8 +25845,8 @@ function planValue(merged, key, incoming) {
25633
25845
  };
25634
25846
  }
25635
25847
  function planArray(merged, key, incoming) {
25636
- const current = getNestedValue(merged, key);
25637
- const existing = Array.isArray(current) ? current : [];
25848
+ const current2 = getNestedValue(merged, key);
25849
+ const existing = Array.isArray(current2) ? current2 : [];
25638
25850
  const added = incoming.filter(
25639
25851
  (item) => !existing.some((entry) => isDeepStrictEqual3(entry, item))
25640
25852
  );
@@ -25710,8 +25922,8 @@ async function configImportUser(keys) {
25710
25922
  console.log("Nothing imported.");
25711
25923
  return;
25712
25924
  }
25713
- const outcome = await updateUserConfig(orm, (current) => {
25714
- const latest2 = planUserConfigImport(yml, current, plan2.imported);
25925
+ const outcome = await updateUserConfig(orm, (current2) => {
25926
+ const latest2 = planUserConfigImport(yml, current2, plan2.imported);
25715
25927
  return latest2.errors.length > 0 ? { ok: false, errors: latest2.errors } : { ok: true, config: latest2.merged, result: void 0 };
25716
25928
  });
25717
25929
  if (!outcome.ok) exitWithConfigErrors(outcome.errors);
@@ -26074,7 +26286,7 @@ async function browserInspect(selector, options2) {
26074
26286
  }
26075
26287
 
26076
26288
  // src/commands/browser/browserRun.ts
26077
- import { readFileSync as readFileSync36 } from "fs";
26289
+ import { readFileSync as readFileSync37 } from "fs";
26078
26290
  import chalk149 from "chalk";
26079
26291
 
26080
26292
  // src/commands/browser/formatRunOutcome.ts
@@ -26094,7 +26306,7 @@ function formatRunOutcome(run4) {
26094
26306
  async function browserRun(options2) {
26095
26307
  let code;
26096
26308
  try {
26097
- code = readFileSync36(options2.file, "utf8");
26309
+ code = readFileSync37(options2.file, "utf8");
26098
26310
  } catch (error) {
26099
26311
  console.error(
26100
26312
  chalk149.red(
@@ -26119,16 +26331,16 @@ async function browserRun(options2) {
26119
26331
  }
26120
26332
 
26121
26333
  // src/commands/browser/browserSnapshot.ts
26122
- import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync28 } from "fs";
26123
- import { dirname as dirname30 } from "path";
26334
+ import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync29 } from "fs";
26335
+ import { dirname as dirname31 } from "path";
26124
26336
 
26125
26337
  // src/commands/browser/snapshotPath.ts
26126
26338
  import { homedir as homedir22 } from "os";
26127
- import { join as join61 } from "path";
26339
+ import { join as join62 } from "path";
26128
26340
  function snapshotPath(tabUrl, now) {
26129
26341
  const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
26130
26342
  const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
26131
- return join61(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
26343
+ return join62(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
26132
26344
  }
26133
26345
 
26134
26346
  // src/commands/browser/browserSnapshot.ts
@@ -26138,8 +26350,8 @@ async function browserSnapshot(options2) {
26138
26350
  url: options2.url
26139
26351
  });
26140
26352
  const path109 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
26141
- mkdirSync18(dirname30(path109), { recursive: true });
26142
- writeFileSync28(path109, result.html);
26353
+ mkdirSync19(dirname31(path109), { recursive: true });
26354
+ writeFileSync29(path109, result.html);
26143
26355
  console.log(`snapshot: ${path109}`);
26144
26356
  }
26145
26357
 
@@ -26335,15 +26547,15 @@ async function printExtensionUrl() {
26335
26547
  // src/commands/extension/signExtension.ts
26336
26548
  import { rm as rm2 } from "fs/promises";
26337
26549
  import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
26338
- import { join as join67 } from "path";
26550
+ import { join as join68 } from "path";
26339
26551
  import chalk154 from "chalk";
26340
26552
 
26341
26553
  // src/commands/extension/copySignedXpi.ts
26342
26554
  import { copyFile } from "fs/promises";
26343
- import { join as join62 } from "path";
26555
+ import { join as join63 } from "path";
26344
26556
  var SIGNED_XPI_NAME = "assist-extension.xpi";
26345
26557
  async function copySignedXpi(xpi, dir) {
26346
- const fixed2 = join62(dir, SIGNED_XPI_NAME);
26558
+ const fixed2 = join63(dir, SIGNED_XPI_NAME);
26347
26559
  if (fixed2 === xpi) return fixed2;
26348
26560
  await copyFile(xpi, fixed2);
26349
26561
  return fixed2;
@@ -26352,11 +26564,11 @@ async function copySignedXpi(xpi, dir) {
26352
26564
  // src/commands/extension/findSignedXpi.ts
26353
26565
  import { existsSync as existsSync55 } from "fs";
26354
26566
  import { readdir } from "fs/promises";
26355
- import { join as join63 } from "path";
26567
+ import { join as join64 } from "path";
26356
26568
  async function findSignedXpi(dir) {
26357
26569
  if (!existsSync55(dir)) return null;
26358
26570
  const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
26359
- return name ? join63(dir, name) : null;
26571
+ return name ? join64(dir, name) : null;
26360
26572
  }
26361
26573
 
26362
26574
  // src/commands/extension/signedAddonInstallPath.ts
@@ -26379,10 +26591,10 @@ async function signedAddonInstallPath(xpi) {
26379
26591
 
26380
26592
  // src/commands/extension/signPreflightProblem.ts
26381
26593
  import { existsSync as existsSync56 } from "fs";
26382
- import { join as join64 } from "path";
26594
+ import { join as join65 } from "path";
26383
26595
  var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
26384
26596
  function signPreflightProblem(source) {
26385
- if (!existsSync56(join64(source, "content.js")))
26597
+ if (!existsSync56(join65(source, "content.js")))
26386
26598
  return {
26387
26599
  message: `no content.js in ${source}`,
26388
26600
  hint: "run npm run build to bundle the content script"
@@ -26397,7 +26609,7 @@ function signPreflightProblem(source) {
26397
26609
 
26398
26610
  // src/commands/extension/stageExtension.ts
26399
26611
  import { cp as cp3, mkdir as mkdir5, readFile as readFile5, rm, writeFile as writeFile4 } from "fs/promises";
26400
- import { basename as basename16, join as join65 } from "path";
26612
+ import { basename as basename16, join as join66 } from "path";
26401
26613
 
26402
26614
  // src/commands/extension/stampManifestVersion.ts
26403
26615
  function stampManifestVersion(manifest, version2) {
@@ -26414,7 +26626,7 @@ async function stageExtension(source, staging, version2) {
26414
26626
  recursive: true,
26415
26627
  filter: (path109) => basename16(path109) !== "updates.json"
26416
26628
  });
26417
- const manifest = join65(staging, "manifest.json");
26629
+ const manifest = join66(staging, "manifest.json");
26418
26630
  const stamped = stampManifestVersion(
26419
26631
  await readFile5(manifest, "utf8"),
26420
26632
  version2
@@ -26424,7 +26636,7 @@ async function stageExtension(source, staging, version2) {
26424
26636
 
26425
26637
  // src/commands/extension/writeUpdateManifest.ts
26426
26638
  import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
26427
- import { join as join66 } from "path";
26639
+ import { join as join67 } from "path";
26428
26640
 
26429
26641
  // src/commands/extension/buildUpdateManifest.ts
26430
26642
  var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
@@ -26449,17 +26661,17 @@ function buildUpdateManifest(manifest, version2) {
26449
26661
  // src/commands/extension/writeUpdateManifest.ts
26450
26662
  async function writeUpdateManifest(source, dir, version2) {
26451
26663
  await writeFile5(
26452
- join66(dir, "updates.json"),
26664
+ join67(dir, "updates.json"),
26453
26665
  buildUpdateManifest(
26454
- await readFile6(join66(source, "manifest.json"), "utf8"),
26666
+ await readFile6(join67(source, "manifest.json"), "utf8"),
26455
26667
  version2
26456
26668
  )
26457
26669
  );
26458
26670
  }
26459
26671
 
26460
26672
  // src/commands/extension/signExtension.ts
26461
- var ARTIFACTS_DIR = join67(homedir23(), ".assist", "extension");
26462
- var STAGING_DIR = join67(tmpdir3(), "assist-extension");
26673
+ var ARTIFACTS_DIR = join68(homedir23(), ".assist", "extension");
26674
+ var STAGING_DIR = join68(tmpdir3(), "assist-extension");
26463
26675
  async function signExtension() {
26464
26676
  const source = extensionDir();
26465
26677
  const problem = signPreflightProblem(source);
@@ -26643,7 +26855,7 @@ function registerDb(program) {
26643
26855
  }
26644
26856
 
26645
26857
  // src/commands/deploy/redirect.ts
26646
- import { existsSync as existsSync57, readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
26858
+ import { existsSync as existsSync57, readFileSync as readFileSync38, writeFileSync as writeFileSync30 } from "fs";
26647
26859
  import chalk157 from "chalk";
26648
26860
  var TRAILING_SLASH_SCRIPT = ` <script>
26649
26861
  if (!window.location.pathname.endsWith('/')) {
@@ -26656,7 +26868,7 @@ function redirect() {
26656
26868
  console.log(chalk157.yellow("No index.html found"));
26657
26869
  return;
26658
26870
  }
26659
- const content = readFileSync37(indexPath, "utf8");
26871
+ const content = readFileSync38(indexPath, "utf8");
26660
26872
  if (content.includes("window.location.pathname.endsWith('/')")) {
26661
26873
  console.log(chalk157.dim("Trailing slash script already present"));
26662
26874
  return;
@@ -26668,7 +26880,7 @@ function redirect() {
26668
26880
  }
26669
26881
  const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
26670
26882
  ${content.slice(headCloseIndex)}`;
26671
- writeFileSync29(indexPath, newContent);
26883
+ writeFileSync30(indexPath, newContent);
26672
26884
  console.log(chalk157.green("Added trailing slash redirect to index.html"));
26673
26885
  }
26674
26886
 
@@ -26747,22 +26959,22 @@ function printWeekHeader(week, state) {
26747
26959
  }
26748
26960
 
26749
26961
  // src/commands/devlog/loadDevEntry.ts
26750
- import { readFileSync as readFileSync38 } from "fs";
26751
- import { join as join68 } from "path";
26962
+ import { readFileSync as readFileSync39 } from "fs";
26963
+ import { join as join69 } from "path";
26752
26964
  import { parse as parseYaml3 } from "yaml";
26753
26965
  function asString(value) {
26754
26966
  return value === void 0 || value === null ? null : String(value);
26755
26967
  }
26756
26968
  function readFrontmatter(path109) {
26757
26969
  try {
26758
- const match = readFileSync38(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
26970
+ const match = readFileSync39(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
26759
26971
  return match ? parseYaml3(match[1]) ?? {} : null;
26760
26972
  } catch {
26761
26973
  return null;
26762
26974
  }
26763
26975
  }
26764
26976
  function loadDevEntry(repoName, week, devDir) {
26765
- const path109 = join68(devDir, repoName, `${week.toLowerCase()}.md`);
26977
+ const path109 = join69(devDir, repoName, `${week.toLowerCase()}.md`);
26766
26978
  const frontmatter2 = readFrontmatter(path109);
26767
26979
  if (!frontmatter2) return null;
26768
26980
  const versions = frontmatter2.versions;
@@ -26858,17 +27070,17 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
26858
27070
  import chalk160 from "chalk";
26859
27071
 
26860
27072
  // src/shared/getRepoName.ts
26861
- import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
26862
- import { basename as basename17, join as join69 } from "path";
27073
+ import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
27074
+ import { basename as basename17, join as join70 } from "path";
26863
27075
  function getRepoName() {
26864
27076
  const config = loadConfig();
26865
27077
  if (config.devlog?.name) {
26866
27078
  return config.devlog.name;
26867
27079
  }
26868
- const packageJsonPath = join69(process.cwd(), "package.json");
27080
+ const packageJsonPath = join70(process.cwd(), "package.json");
26869
27081
  if (existsSync58(packageJsonPath)) {
26870
27082
  try {
26871
- const content = readFileSync39(packageJsonPath, "utf8");
27083
+ const content = readFileSync40(packageJsonPath, "utf8");
26872
27084
  const pkg = JSON.parse(content);
26873
27085
  if (pkg.name) {
26874
27086
  return pkg.name;
@@ -26944,7 +27156,7 @@ function list2(options2) {
26944
27156
 
26945
27157
  // src/commands/devlog/loadDevWeeks.ts
26946
27158
  import { readdirSync as readdirSync10 } from "fs";
26947
- import { join as join70 } from "path";
27159
+ import { join as join71 } from "path";
26948
27160
  var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
26949
27161
  function parseDevWeekFilename(filename) {
26950
27162
  const match = filename.match(DEV_FILENAME_PATTERN);
@@ -26958,7 +27170,7 @@ function readFilenames(dir) {
26958
27170
  }
26959
27171
  }
26960
27172
  function loadDevWeeks(repoName, devDir) {
26961
- return readFilenames(join70(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
27173
+ return readFilenames(join71(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
26962
27174
  }
26963
27175
 
26964
27176
  // src/commands/devlog/next/displayNextEntry.ts
@@ -27112,8 +27324,8 @@ async function skip2(week, cwd = process.cwd()) {
27112
27324
  }
27113
27325
 
27114
27326
  // src/commands/devlog/write.ts
27115
- import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync30 } from "fs";
27116
- import { dirname as dirname31, join as join71 } from "path";
27327
+ import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync31 } from "fs";
27328
+ import { dirname as dirname32, join as join72 } from "path";
27117
27329
  import chalk164 from "chalk";
27118
27330
 
27119
27331
  // src/commands/devlog/write/devEntryInputSchema.ts
@@ -27206,9 +27418,9 @@ async function write() {
27206
27418
  }
27207
27419
  const devDir = resolveDevDir();
27208
27420
  const repoName = getRepoName();
27209
- const path109 = join71(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
27210
- mkdirSync19(dirname31(path109), { recursive: true });
27211
- writeFileSync30(path109, formatDevEntry(repoName, result.data));
27421
+ const path109 = join72(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
27422
+ mkdirSync20(dirname32(path109), { recursive: true });
27423
+ writeFileSync31(path109, formatDevEntry(repoName, result.data));
27212
27424
  console.log(chalk164.green(`Wrote ${path109}`));
27213
27425
  }
27214
27426
 
@@ -27340,11 +27552,11 @@ function version() {
27340
27552
  const name = getRepoName();
27341
27553
  const lastWeek = loadDevWeeks(name, devDir).at(-1) ?? null;
27342
27554
  const entry = lastWeek ? loadDevEntry(name, lastWeek, devDir) : null;
27343
- const current = getVersionAtCommit("HEAD");
27555
+ const current2 = getVersionAtCommit("HEAD");
27344
27556
  printField2("name", name);
27345
27557
  printField2("last week", lastWeek);
27346
27558
  printField2("last version", entry?.lastVersion);
27347
- printField2("current", current ? stripToMinor(current) : null);
27559
+ printField2("current", current2 ? stripToMinor(current2) : null);
27348
27560
  }
27349
27561
 
27350
27562
  // src/commands/registerDevlog.ts
@@ -27394,13 +27606,13 @@ async function findPhaseUnlockItem(itemId2, phase) {
27394
27606
  }
27395
27607
 
27396
27608
  // src/commands/docs/getDocsUnlockPinPath.ts
27397
- import { join as join72 } from "path";
27609
+ import { join as join73 } from "path";
27398
27610
  function getDocsUnlockPinPath(pin2) {
27399
- return join72(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
27611
+ return join73(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
27400
27612
  }
27401
27613
 
27402
27614
  // src/commands/docs/readDocsUnlockPinState.ts
27403
- import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
27615
+ import { existsSync as existsSync59, readFileSync as readFileSync41 } from "fs";
27404
27616
  function isPositiveInteger(value) {
27405
27617
  return Number.isInteger(value) && value > 0;
27406
27618
  }
@@ -27408,7 +27620,7 @@ function readDocsUnlockPinState(pin2) {
27408
27620
  const path109 = getDocsUnlockPinPath(pin2);
27409
27621
  if (!existsSync59(path109)) return void 0;
27410
27622
  try {
27411
- const state = JSON.parse(readFileSync40(path109, "utf8"));
27623
+ const state = JSON.parse(readFileSync41(path109, "utf8"));
27412
27624
  if (state.pin !== pin2) return void 0;
27413
27625
  if (!isPositiveInteger(state.itemId)) return void 0;
27414
27626
  if (!isPositiveInteger(state.phase)) return void 0;
@@ -27457,7 +27669,7 @@ import chalk169 from "chalk";
27457
27669
 
27458
27670
  // src/commands/notify/issueUnlockPin.ts
27459
27671
  import { randomInt as randomInt2 } from "crypto";
27460
- import { mkdirSync as mkdirSync20, unlinkSync as unlinkSync10, writeFileSync as writeFileSync31 } from "fs";
27672
+ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync10, writeFileSync as writeFileSync32 } from "fs";
27461
27673
  async function issueUnlockPin({
27462
27674
  area,
27463
27675
  label,
@@ -27465,10 +27677,10 @@ async function issueUnlockPin({
27465
27677
  state
27466
27678
  }) {
27467
27679
  const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
27468
- mkdirSync20(getRestrictedDir(), { recursive: true });
27680
+ mkdirSync21(getRestrictedDir(), { recursive: true });
27469
27681
  sweepRestrictedDir();
27470
27682
  const path109 = pinPath(pin2);
27471
- writeFileSync31(path109, JSON.stringify({ ...state, pin: pin2 }));
27683
+ writeFileSync32(path109, JSON.stringify({ ...state, pin: pin2 }));
27472
27684
  const delivery = await deliverPinNotification({
27473
27685
  area,
27474
27686
  pin: pin2,
@@ -27540,17 +27752,17 @@ function registerDocs(parent) {
27540
27752
  }
27541
27753
 
27542
27754
  // src/commands/schema/schemaConfirm.ts
27543
- import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as writeFileSync32 } from "fs";
27755
+ import { mkdirSync as mkdirSync22, unlinkSync as unlinkSync11, writeFileSync as writeFileSync33 } from "fs";
27544
27756
  import chalk170 from "chalk";
27545
27757
 
27546
27758
  // src/commands/schema/getSchemaUnlockPinPath.ts
27547
- import { join as join73 } from "path";
27759
+ import { join as join74 } from "path";
27548
27760
  function getSchemaUnlockPinPath(pin2) {
27549
- return join73(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
27761
+ return join74(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
27550
27762
  }
27551
27763
 
27552
27764
  // src/commands/schema/readSchemaUnlockPinState.ts
27553
- import { existsSync as existsSync60, readFileSync as readFileSync41 } from "fs";
27765
+ import { existsSync as existsSync60, readFileSync as readFileSync42 } from "fs";
27554
27766
  function isPositiveInteger2(value) {
27555
27767
  return Number.isInteger(value) && value > 0;
27556
27768
  }
@@ -27566,7 +27778,7 @@ function readSchemaUnlockPinState(pin2) {
27566
27778
  const path109 = getSchemaUnlockPinPath(pin2);
27567
27779
  if (!existsSync60(path109)) return void 0;
27568
27780
  try {
27569
- const raw = JSON.parse(readFileSync41(path109, "utf8"));
27781
+ const raw = JSON.parse(readFileSync42(path109, "utf8"));
27570
27782
  if (raw.pin !== pin2) return void 0;
27571
27783
  return toState(raw);
27572
27784
  } catch {
@@ -27592,8 +27804,8 @@ async function approveItemPhase(itemId2, phase) {
27592
27804
  function approveClaudeSession(claudeSessionId) {
27593
27805
  const path109 = getSchemaSessionApprovalPath(claudeSessionId);
27594
27806
  if (!path109) return;
27595
- mkdirSync21(getSchemaSessionApprovalDir(), { recursive: true });
27596
- writeFileSync32(path109, JSON.stringify({ claudeSessionId }));
27807
+ mkdirSync22(getSchemaSessionApprovalDir(), { recursive: true });
27808
+ writeFileSync33(path109, JSON.stringify({ claudeSessionId }));
27597
27809
  console.log(
27598
27810
  chalk170.green(
27599
27811
  `Approved schema changes for Claude session ${claudeSessionId}. It may edit and commit database schema files until the session ends.`
@@ -27689,7 +27901,7 @@ function registerSchema(parent) {
27689
27901
 
27690
27902
  // src/commands/dotnet/checkBuildLocks.ts
27691
27903
  import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
27692
- import { join as join74 } from "path";
27904
+ import { join as join75 } from "path";
27693
27905
  import chalk172 from "chalk";
27694
27906
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
27695
27907
  function isLockedDll(debugDir) {
@@ -27701,7 +27913,7 @@ function isLockedDll(debugDir) {
27701
27913
  }
27702
27914
  for (const file of files) {
27703
27915
  if (!file.toLowerCase().endsWith(".dll")) continue;
27704
- const dllPath = join74(debugDir, file);
27916
+ const dllPath = join75(debugDir, file);
27705
27917
  try {
27706
27918
  const fd = openSync6(dllPath, "r+");
27707
27919
  closeSync5(fd);
@@ -27719,13 +27931,13 @@ function findFirstLockedDll(dir) {
27719
27931
  return null;
27720
27932
  }
27721
27933
  if (entries.includes("bin")) {
27722
- const locked = isLockedDll(join74(dir, "bin", "Debug"));
27934
+ const locked = isLockedDll(join75(dir, "bin", "Debug"));
27723
27935
  if (locked) return locked;
27724
27936
  }
27725
27937
  for (const entry of entries) {
27726
27938
  if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
27727
27939
  continue;
27728
- const found = findFirstLockedDll(join74(dir, entry));
27940
+ const found = findFirstLockedDll(join75(dir, entry));
27729
27941
  if (found) return found;
27730
27942
  }
27731
27943
  return null;
@@ -27748,11 +27960,11 @@ async function checkBuildLocksCommand() {
27748
27960
  }
27749
27961
 
27750
27962
  // src/commands/dotnet/buildTree.ts
27751
- import { readFileSync as readFileSync42 } from "fs";
27963
+ import { readFileSync as readFileSync43 } from "fs";
27752
27964
  import path36 from "path";
27753
27965
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
27754
27966
  function getProjectRefs(csprojPath) {
27755
- const content = readFileSync42(csprojPath, "utf8");
27967
+ const content = readFileSync43(csprojPath, "utf8");
27756
27968
  const refs = [];
27757
27969
  for (const match of content.matchAll(PROJECT_REF_RE)) {
27758
27970
  refs.push(match[1].replace(/\\/g, "/"));
@@ -27769,7 +27981,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
27769
27981
  for (const ref of getProjectRefs(abs)) {
27770
27982
  const childAbs = path36.resolve(dir, ref);
27771
27983
  try {
27772
- readFileSync42(childAbs);
27984
+ readFileSync43(childAbs);
27773
27985
  node.children.push(buildTree(childAbs, repoRoot2, visited));
27774
27986
  } catch {
27775
27987
  node.children.push({
@@ -27794,7 +28006,7 @@ function collectAllDeps(node) {
27794
28006
  }
27795
28007
 
27796
28008
  // src/commands/dotnet/findContainingSolutions.ts
27797
- import { readdirSync as readdirSync13, readFileSync as readFileSync43, statSync as statSync9 } from "fs";
28009
+ import { readdirSync as readdirSync13, readFileSync as readFileSync44, statSync as statSync9 } from "fs";
27798
28010
  import path37 from "path";
27799
28011
  function findSlnFiles(dir, maxDepth, depth = 0) {
27800
28012
  if (depth > maxDepth) return [];
@@ -27829,7 +28041,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
27829
28041
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
27830
28042
  for (const sln of slnFiles) {
27831
28043
  try {
27832
- const content = readFileSync43(sln, "utf8");
28044
+ const content = readFileSync44(sln, "utf8");
27833
28045
  if (pattern2.test(content)) {
27834
28046
  matches.push(path37.relative(repoRoot2, sln));
27835
28047
  }
@@ -28072,11 +28284,11 @@ import chalk178 from "chalk";
28072
28284
 
28073
28285
  // src/commands/dotnet/findSolution.ts
28074
28286
  import { readdirSync as readdirSync14 } from "fs";
28075
- import { dirname as dirname32, join as join75 } from "path";
28287
+ import { dirname as dirname33, join as join76 } from "path";
28076
28288
  import chalk177 from "chalk";
28077
28289
  function findSlnInDir(dir) {
28078
28290
  try {
28079
- return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join75(dir, f));
28291
+ return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join76(dir, f));
28080
28292
  } catch {
28081
28293
  return [];
28082
28294
  }
@@ -28084,20 +28296,20 @@ function findSlnInDir(dir) {
28084
28296
  function findSolution() {
28085
28297
  const repoRoot2 = findRepoRoot(process.cwd());
28086
28298
  const ceiling = repoRoot2 ?? process.cwd();
28087
- let current = process.cwd();
28299
+ let current2 = process.cwd();
28088
28300
  while (true) {
28089
- const slnFiles = findSlnInDir(current);
28301
+ const slnFiles = findSlnInDir(current2);
28090
28302
  if (slnFiles.length === 1) return slnFiles[0];
28091
28303
  if (slnFiles.length > 1) {
28092
- console.error(chalk177.red(`Multiple .sln files found in ${current}:`));
28304
+ console.error(chalk177.red(`Multiple .sln files found in ${current2}:`));
28093
28305
  for (const f of slnFiles) console.error(` ${f}`);
28094
28306
  console.error(
28095
28307
  chalk177.yellow("Specify which one: assist dotnet inspect <sln>")
28096
28308
  );
28097
28309
  process.exit(1);
28098
28310
  }
28099
- if (current === ceiling) break;
28100
- current = dirname32(current);
28311
+ if (current2 === ceiling) break;
28312
+ current2 = dirname33(current2);
28101
28313
  }
28102
28314
  console.error(chalk177.red("No .sln file found between cwd and repo root"));
28103
28315
  process.exit(1);
@@ -28147,7 +28359,7 @@ function parseInspectReport(json) {
28147
28359
 
28148
28360
  // src/commands/dotnet/runInspectCode.ts
28149
28361
  import { execSync as execSync40 } from "child_process";
28150
- import { existsSync as existsSync63, readFileSync as readFileSync44, unlinkSync as unlinkSync12 } from "fs";
28362
+ import { existsSync as existsSync63, readFileSync as readFileSync45, unlinkSync as unlinkSync12 } from "fs";
28151
28363
  import { tmpdir as tmpdir4 } from "os";
28152
28364
  import path40 from "path";
28153
28365
  import chalk179 from "chalk";
@@ -28182,7 +28394,7 @@ function runInspectCode(slnPath, include, swea) {
28182
28394
  console.error(chalk179.red("Report file not generated"));
28183
28395
  process.exit(1);
28184
28396
  }
28185
- const xml = readFileSync44(reportPath, "utf8");
28397
+ const xml = readFileSync45(reportPath, "utf8");
28186
28398
  unlinkSync12(reportPath);
28187
28399
  return xml;
28188
28400
  }
@@ -28619,16 +28831,16 @@ var RAZOR_OPEN = "@*";
28619
28831
  var RAZOR_CLOSE = "*@";
28620
28832
  var HTML_OPEN = "<!--";
28621
28833
  var HTML_CLOSE = "-->";
28622
- function read(content, index3, open, close) {
28834
+ function read2(content, index3, open, close) {
28623
28835
  const found = content.indexOf(close, index3 + open.length);
28624
28836
  const end = found === -1 ? content.length : found + close.length;
28625
28837
  return { end, text: content.slice(index3, end) };
28626
28838
  }
28627
28839
  function readRazorComment(content, index3) {
28628
28840
  if (content.startsWith(RAZOR_OPEN, index3))
28629
- return read(content, index3, RAZOR_OPEN, RAZOR_CLOSE);
28841
+ return read2(content, index3, RAZOR_OPEN, RAZOR_CLOSE);
28630
28842
  if (content.startsWith(HTML_OPEN, index3))
28631
- return read(content, index3, HTML_OPEN, HTML_CLOSE);
28843
+ return read2(content, index3, HTML_OPEN, HTML_CLOSE);
28632
28844
  return void 0;
28633
28845
  }
28634
28846
 
@@ -29062,9 +29274,9 @@ function aggregateCommitters(authorLists) {
29062
29274
 
29063
29275
  // src/shared/runGhGraphql.ts
29064
29276
  import { spawnSync as spawnSync6 } from "child_process";
29065
- import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync33 } from "fs";
29277
+ import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync34 } from "fs";
29066
29278
  import { tmpdir as tmpdir5 } from "os";
29067
- import { join as join76 } from "path";
29279
+ import { join as join77 } from "path";
29068
29280
  function buildArgs2(queryFile, vars) {
29069
29281
  const args = ["api", "graphql", "-F", `query=@${queryFile}`];
29070
29282
  for (const [key, value] of Object.entries(vars)) {
@@ -29074,8 +29286,8 @@ function buildArgs2(queryFile, vars) {
29074
29286
  return args;
29075
29287
  }
29076
29288
  function runGhGraphql(mutation, vars) {
29077
- const queryFile = join76(tmpdir5(), `gh-query-${Date.now()}.graphql`);
29078
- writeFileSync33(queryFile, mutation);
29289
+ const queryFile = join77(tmpdir5(), `gh-query-${Date.now()}.graphql`);
29290
+ writeFileSync34(queryFile, mutation);
29079
29291
  try {
29080
29292
  const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
29081
29293
  encoding: "utf8",
@@ -30356,10 +30568,10 @@ import { basename as basename18 } from "path";
30356
30568
 
30357
30569
  // src/shared/removeStagedAttachments.ts
30358
30570
  import { rmSync as rmSync5 } from "fs";
30359
- import { dirname as dirname33 } from "path";
30571
+ import { dirname as dirname34 } from "path";
30360
30572
  function removeStagedAttachments(attachments) {
30361
30573
  for (const { path: path109 } of attachments) {
30362
- const dir = dirname33(path109);
30574
+ const dir = dirname34(path109);
30363
30575
  if (!isStagedAttachmentPath(dir)) continue;
30364
30576
  rmSync5(dir, { recursive: true, force: true });
30365
30577
  }
@@ -30522,26 +30734,26 @@ function slugFromUrl(url) {
30522
30734
  }
30523
30735
 
30524
30736
  // src/commands/github/issue/writeIssueWorkingFile.ts
30525
- import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync34 } from "fs";
30737
+ import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync35 } from "fs";
30526
30738
 
30527
30739
  // src/commands/github/issue/issueWorkingFile.ts
30528
- import { join as join77 } from "path";
30740
+ import { join as join78 } from "path";
30529
30741
  function issueWorkingFile(slug2, number) {
30530
30742
  const [owner = "unknown", repo = "unknown"] = slug2.split("/");
30531
- const dir = join77(getStoreDir(), "github-issues", owner, repo);
30743
+ const dir = join78(getStoreDir(), "github-issues", owner, repo);
30532
30744
  return {
30533
30745
  dir,
30534
- bodyPath: join77(dir, `${number}.md`),
30535
- metaPath: join77(dir, `${number}.json`)
30746
+ bodyPath: join78(dir, `${number}.md`),
30747
+ metaPath: join78(dir, `${number}.json`)
30536
30748
  };
30537
30749
  }
30538
30750
 
30539
30751
  // src/commands/github/issue/writeIssueWorkingFile.ts
30540
30752
  function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
30541
30753
  const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
30542
- mkdirSync22(dir, { recursive: true });
30543
- writeFileSync34(bodyPath, body);
30544
- writeFileSync34(
30754
+ mkdirSync23(dir, { recursive: true });
30755
+ writeFileSync35(bodyPath, body);
30756
+ writeFileSync35(
30545
30757
  metaPath,
30546
30758
  `${JSON.stringify({ target, updatedAt }, null, 2)}
30547
30759
  `
@@ -30567,14 +30779,14 @@ function fetchIssueToWorkingFile(number, repo) {
30567
30779
  }
30568
30780
 
30569
30781
  // src/commands/github/issue/resumeIssueBody.ts
30570
- import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
30782
+ import { existsSync as existsSync64, readFileSync as readFileSync46 } from "fs";
30571
30783
  function resumeIssueBody(slug2, number, updatedAt) {
30572
30784
  const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
30573
30785
  if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
30574
30786
  try {
30575
- const meta = JSON.parse(readFileSync45(metaPath, "utf8"));
30787
+ const meta = JSON.parse(readFileSync46(metaPath, "utf8"));
30576
30788
  if (meta.updatedAt !== updatedAt) return void 0;
30577
- return readFileSync45(bodyPath, "utf8");
30789
+ return readFileSync46(bodyPath, "utf8");
30578
30790
  } catch {
30579
30791
  return void 0;
30580
30792
  }
@@ -31438,14 +31650,14 @@ function recentDaemonLogLines(includeRelayed = true) {
31438
31650
 
31439
31651
  // src/commands/sessions/daemon/worktree/createWorktree.ts
31440
31652
  import { existsSync as existsSync65 } from "fs";
31441
- import { basename as basename20, dirname as dirname34 } from "path";
31653
+ import { basename as basename20, dirname as dirname35 } from "path";
31442
31654
 
31443
31655
  // src/commands/sessions/daemon/worktree/nextWorktreePath.ts
31444
- import { basename as basename19, join as join78 } from "path";
31656
+ import { basename as basename19, join as join79 } from "path";
31445
31657
  function nextWorktreePath(clone, base, isTaken) {
31446
31658
  const name = basename19(clone);
31447
31659
  for (let n = 2; n < 1e3; n++) {
31448
- const candidate = join78(base, `${name}-${n}`);
31660
+ const candidate = join79(base, `${name}-${n}`);
31449
31661
  if (!isTaken(candidate)) return candidate;
31450
31662
  }
31451
31663
  throw new Error(`no free worktree suffix for ${clone}`);
@@ -31466,7 +31678,7 @@ async function cloneTrunkBranch(clone) {
31466
31678
  // src/commands/sessions/daemon/worktree/createWorktree.ts
31467
31679
  var FETCH_TIMEOUT_MS = 6e4;
31468
31680
  function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
31469
- const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
31681
+ const base = strategy.root ? expandTilde(strategy.root) : dirname35(clone);
31470
31682
  const registered = new Set(listWorktreePaths(clone));
31471
31683
  const branches = new Set(listLocalBranches(clone));
31472
31684
  const isTaken = (candidate) => registered.has(candidate) || existsSync65(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
@@ -31707,21 +31919,21 @@ function persistedTreeRoots() {
31707
31919
  }
31708
31920
 
31709
31921
  // src/commands/sessions/daemon/worktree/seedWorktree.ts
31710
- import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync23 } from "fs";
31711
- import { dirname as dirname35, join as join80 } from "path";
31922
+ import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync24 } from "fs";
31923
+ import { dirname as dirname36, join as join81 } from "path";
31712
31924
 
31713
31925
  // src/commands/sessions/daemon/worktree/runInstall.ts
31714
31926
  import { resolve as resolve22 } from "path";
31715
31927
 
31716
31928
  // src/commands/sessions/daemon/worktree/detectInstallCommand.ts
31717
31929
  import { existsSync as existsSync66 } from "fs";
31718
- import { join as join79 } from "path";
31930
+ import { join as join80 } from "path";
31719
31931
  function detectInstallCommand(dir) {
31720
- if (!existsSync66(join79(dir, "package.json"))) return null;
31721
- if (existsSync66(join79(dir, "pnpm-lock.yaml"))) return "pnpm install";
31722
- if (existsSync66(join79(dir, "yarn.lock"))) return "yarn install";
31723
- if (existsSync66(join79(dir, "bun.lockb"))) return "bun install";
31724
- if (existsSync66(join79(dir, "package-lock.json"))) return "npm ci";
31932
+ if (!existsSync66(join80(dir, "package.json"))) return null;
31933
+ if (existsSync66(join80(dir, "pnpm-lock.yaml"))) return "pnpm install";
31934
+ if (existsSync66(join80(dir, "yarn.lock"))) return "yarn install";
31935
+ if (existsSync66(join80(dir, "bun.lockb"))) return "bun install";
31936
+ if (existsSync66(join80(dir, "package-lock.json"))) return "npm ci";
31725
31937
  return "npm install";
31726
31938
  }
31727
31939
 
@@ -31886,11 +32098,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
31886
32098
  }
31887
32099
  function copyConfigFiles(worktreePath, clone, copy) {
31888
32100
  for (const rel of copy) {
31889
- const src = join80(clone, rel);
32101
+ const src = join81(clone, rel);
31890
32102
  if (!existsSync67(src)) continue;
31891
- const dest = join80(worktreePath, rel);
32103
+ const dest = join81(worktreePath, rel);
31892
32104
  try {
31893
- mkdirSync23(dirname35(dest), { recursive: true });
32105
+ mkdirSync24(dirname36(dest), { recursive: true });
31894
32106
  copyFileSync(src, dest);
31895
32107
  daemonLog(`worktree ${worktreePath} seeded ${rel}`);
31896
32108
  } catch (error) {
@@ -32357,12 +32569,12 @@ function registerLitellm(program) {
32357
32569
  }
32358
32570
 
32359
32571
  // src/commands/mermaidExport.ts
32360
- import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
32572
+ import { mkdirSync as mkdirSync25, readdirSync as readdirSync15 } from "fs";
32361
32573
  import { resolve as resolve24 } from "path";
32362
32574
  import chalk196 from "chalk";
32363
32575
 
32364
32576
  // src/commands/mermaid/exportFile.ts
32365
- import { readFileSync as readFileSync46, writeFileSync as writeFileSync35 } from "fs";
32577
+ import { readFileSync as readFileSync47, writeFileSync as writeFileSync36 } from "fs";
32366
32578
  import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
32367
32579
  import chalk195 from "chalk";
32368
32580
 
@@ -32388,7 +32600,7 @@ async function renderBlock(krokiUrl, source) {
32388
32600
 
32389
32601
  // src/commands/mermaid/exportFile.ts
32390
32602
  async function exportFile(file, outDir, krokiUrl, onlyIndex) {
32391
- const content = readFileSync46(file, "utf8");
32603
+ const content = readFileSync47(file, "utf8");
32392
32604
  const blocks = extractMermaidBlocks(content);
32393
32605
  const stem = basename21(file, extname4(file));
32394
32606
  if (onlyIndex !== void 0) {
@@ -32413,7 +32625,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
32413
32625
  if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
32414
32626
  const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
32415
32627
  const svg = await renderBlock(krokiUrl, source);
32416
- writeFileSync35(outPath, svg, "utf8");
32628
+ writeFileSync36(outPath, svg, "utf8");
32417
32629
  console.log(chalk195.green(` \u2192 ${outPath}`));
32418
32630
  }
32419
32631
  }
@@ -32426,7 +32638,7 @@ function extractMermaidBlocks(markdown) {
32426
32638
  async function mermaidExport(file, options2 = {}) {
32427
32639
  const { mermaid } = loadConfig();
32428
32640
  const outDir = resolve24(process.cwd(), options2.out ?? ".");
32429
- mkdirSync24(outDir, { recursive: true });
32641
+ mkdirSync25(outDir, { recursive: true });
32430
32642
  if (options2.index !== void 0) {
32431
32643
  if (!Number.isInteger(options2.index) || options2.index < 1) {
32432
32644
  console.error(
@@ -32521,8 +32733,8 @@ function boardSource(raw, anchorId, options2) {
32521
32733
  import { stringify as stringify2 } from "yaml";
32522
32734
 
32523
32735
  // src/commands/miro/writeExtract.ts
32524
- import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync36 } from "fs";
32525
- import { dirname as dirname36 } from "path";
32736
+ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync37 } from "fs";
32737
+ import { dirname as dirname37 } from "path";
32526
32738
  import { stringify } from "yaml";
32527
32739
  function headerLines(header) {
32528
32740
  const { rect } = header;
@@ -32535,8 +32747,8 @@ function headerLines(header) {
32535
32747
  ];
32536
32748
  }
32537
32749
  function writeExtract(file, header, texts) {
32538
- mkdirSync25(dirname36(file), { recursive: true });
32539
- writeFileSync36(file, `${headerLines(header).join("\n")}
32750
+ mkdirSync26(dirname37(file), { recursive: true });
32751
+ writeFileSync37(file, `${headerLines(header).join("\n")}
32540
32752
  ${stringify(texts)}`);
32541
32753
  }
32542
32754
 
@@ -32600,14 +32812,14 @@ function applyIgnore(texts, ignore3) {
32600
32812
  }
32601
32813
 
32602
32814
  // src/commands/miro/readIgnoreList.ts
32603
- import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
32815
+ import { existsSync as existsSync68, readFileSync as readFileSync48 } from "fs";
32604
32816
  import { parse as parse2 } from "yaml";
32605
32817
  function readIgnoreList(file) {
32606
32818
  if (!existsSync68(file))
32607
32819
  throw new MiroExtractError(
32608
32820
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
32609
32821
  );
32610
- const parsed = parse2(readFileSync47(file, "utf8"));
32822
+ const parsed = parse2(readFileSync48(file, "utf8"));
32611
32823
  if (parsed === null || parsed === void 0) return [];
32612
32824
  if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
32613
32825
  throw new MiroExtractError(
@@ -32787,7 +32999,7 @@ async function pickAnchors(sessionId2, items2) {
32787
32999
  }
32788
33000
 
32789
33001
  // src/commands/miro/readMiroItems.ts
32790
- import { readFileSync as readFileSync48 } from "fs";
33002
+ import { readFileSync as readFileSync49 } from "fs";
32791
33003
  function tryParse(text20) {
32792
33004
  try {
32793
33005
  return JSON.parse(text20);
@@ -32816,7 +33028,7 @@ function parsePages(raw, file) {
32816
33028
  return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
32817
33029
  }
32818
33030
  function readMiroItems(file) {
32819
- const items2 = parsePages(readFileSync48(file, "utf8"), file).flatMap(
33031
+ const items2 = parsePages(readFileSync49(file, "utf8"), file).flatMap(
32820
33032
  (page) => page.data ?? []
32821
33033
  );
32822
33034
  if (items2.length === 0)
@@ -33009,7 +33221,7 @@ function registerMiro(program) {
33009
33221
  // src/commands/netcap/netcap.ts
33010
33222
  import { mkdir as mkdir6 } from "fs/promises";
33011
33223
  import { createServer as createServer2 } from "http";
33012
- import { dirname as dirname38 } from "path";
33224
+ import { dirname as dirname39 } from "path";
33013
33225
  import chalk200 from "chalk";
33014
33226
 
33015
33227
  // src/commands/netcap/corsHeaders.ts
@@ -33088,15 +33300,15 @@ function createNetcapHandler(options2) {
33088
33300
  // src/commands/netcap/prepareExtensionForLoad.ts
33089
33301
  import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
33090
33302
  import { networkInterfaces } from "os";
33091
- import { join as join82 } from "path";
33303
+ import { join as join83 } from "path";
33092
33304
  import chalk199 from "chalk";
33093
33305
 
33094
33306
  // src/commands/netcap/netcapExtensionDir.ts
33095
- import { dirname as dirname37, join as join81 } from "path";
33307
+ import { dirname as dirname38, join as join82 } from "path";
33096
33308
  import { fileURLToPath as fileURLToPath7 } from "url";
33097
- var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
33309
+ var moduleDir2 = dirname38(fileURLToPath7(import.meta.url));
33098
33310
  function netcapExtensionDir() {
33099
- return join81(moduleDir2, "commands", "netcap", "netcap-extension");
33311
+ return join82(moduleDir2, "commands", "netcap", "netcap-extension");
33100
33312
  }
33101
33313
 
33102
33314
  // src/commands/netcap/prepareExtensionForLoad.ts
@@ -33111,7 +33323,7 @@ function lanIPv4() {
33111
33323
  return void 0;
33112
33324
  }
33113
33325
  async function configureBackground(dir, host, port, filter) {
33114
- const file = join82(dir, "background.js");
33326
+ const file = join83(dir, "background.js");
33115
33327
  const source = await readFile7(file, "utf8");
33116
33328
  await writeFile6(
33117
33329
  file,
@@ -33151,20 +33363,20 @@ async function prepareExtensionForLoad(port, filter = "") {
33151
33363
  }
33152
33364
 
33153
33365
  // src/commands/netcap/resolveNetcapOutPath.ts
33154
- import { isAbsolute as isAbsolute5, join as join84, resolve as resolve26 } from "path";
33366
+ import { isAbsolute as isAbsolute5, join as join85, resolve as resolve26 } from "path";
33155
33367
 
33156
33368
  // src/commands/netcap/defaultCapturePath.ts
33157
33369
  import { homedir as homedir24 } from "os";
33158
- import { join as join83 } from "path";
33370
+ import { join as join84 } from "path";
33159
33371
  function defaultCapturePath() {
33160
- return join83(homedir24(), ".assist", "netcap", "capture.jsonl");
33372
+ return join84(homedir24(), ".assist", "netcap", "capture.jsonl");
33161
33373
  }
33162
33374
 
33163
33375
  // src/commands/netcap/resolveNetcapOutPath.ts
33164
33376
  function resolveNetcapOutPath(out) {
33165
33377
  if (!out) return defaultCapturePath();
33166
33378
  const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
33167
- return join84(dir, "capture.jsonl");
33379
+ return join85(dir, "capture.jsonl");
33168
33380
  }
33169
33381
 
33170
33382
  // src/commands/netcap/netcap.ts
@@ -33172,7 +33384,7 @@ async function netcap(options2) {
33172
33384
  const port = Number(options2.port);
33173
33385
  const outPath = resolveNetcapOutPath(options2.out);
33174
33386
  const filter = options2.filter ?? "";
33175
- await mkdir6(dirname38(outPath), { recursive: true });
33387
+ await mkdir6(dirname39(outPath), { recursive: true });
33176
33388
  const extensionPath = await prepareExtensionForLoad(port, filter);
33177
33389
  let count10 = 0;
33178
33390
  const handler = createNetcapHandler({
@@ -33210,12 +33422,12 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
33210
33422
  }
33211
33423
 
33212
33424
  // src/commands/netcap/netcapExtract.ts
33213
- import { writeFileSync as writeFileSync37 } from "fs";
33214
- import { join as join85 } from "path";
33425
+ import { writeFileSync as writeFileSync38 } from "fs";
33426
+ import { join as join86 } from "path";
33215
33427
  import chalk201 from "chalk";
33216
33428
 
33217
33429
  // src/commands/netcap/extractPostsFromCapture.ts
33218
- import { readFileSync as readFileSync49 } from "fs";
33430
+ import { readFileSync as readFileSync50 } from "fs";
33219
33431
 
33220
33432
  // src/commands/netcap/parseRscRows.ts
33221
33433
  var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
@@ -33611,7 +33823,7 @@ function extractVoyagerPosts(body) {
33611
33823
 
33612
33824
  // src/commands/netcap/extractPostsFromCapture.ts
33613
33825
  function captureEntries(captureFile) {
33614
- const lines2 = readFileSync49(captureFile, "utf8").split("\n").filter(Boolean);
33826
+ const lines2 = readFileSync50(captureFile, "utf8").split("\n").filter(Boolean);
33615
33827
  const entries = [];
33616
33828
  for (const line of lines2) {
33617
33829
  let entry;
@@ -33656,8 +33868,8 @@ function extractPostsFromCapture(captureFile) {
33656
33868
  function netcapExtract(file) {
33657
33869
  const captureFile = file ?? defaultCapturePath();
33658
33870
  const posts = extractPostsFromCapture(captureFile);
33659
- const outFile = join85(captureFile, "..", "posts.json");
33660
- writeFileSync37(outFile, `${JSON.stringify(posts, null, 2)}
33871
+ const outFile = join86(captureFile, "..", "posts.json");
33872
+ writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
33661
33873
  `);
33662
33874
  console.log(
33663
33875
  chalk201.green(`extracted ${posts.length} posts`),
@@ -34052,9 +34264,9 @@ async function comment2(path109, line, body, options2 = {}) {
34052
34264
 
34053
34265
  // src/commands/prs/commentsCachePath.ts
34054
34266
  import { homedir as homedir25 } from "os";
34055
- import { join as join86 } from "path";
34267
+ import { join as join87 } from "path";
34056
34268
  function commentsCachePath(org, repo, prNumber) {
34057
- return join86(
34269
+ return join87(
34058
34270
  homedir25(),
34059
34271
  ".assist",
34060
34272
  "pr-comments",
@@ -34065,19 +34277,19 @@ function commentsCachePath(org, repo, prNumber) {
34065
34277
  }
34066
34278
 
34067
34279
  // src/commands/prs/listComments/updateCommentsCache.ts
34068
- import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync38 } from "fs";
34069
- import { dirname as dirname39 } from "path";
34280
+ import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync39 } from "fs";
34281
+ import { dirname as dirname40 } from "path";
34070
34282
  import { stringify as stringify3 } from "yaml";
34071
34283
 
34072
34284
  // src/commands/prs/loadCommentsCache.ts
34073
- import { existsSync as existsSync69, readFileSync as readFileSync50, unlinkSync as unlinkSync14 } from "fs";
34285
+ import { existsSync as existsSync69, readFileSync as readFileSync51, unlinkSync as unlinkSync14 } from "fs";
34074
34286
  import { parse as parse3 } from "yaml";
34075
34287
  function loadCommentsCache(org, repo, prNumber) {
34076
34288
  const cachePath = commentsCachePath(org, repo, prNumber);
34077
34289
  if (!existsSync69(cachePath)) {
34078
34290
  return null;
34079
34291
  }
34080
- const content = readFileSync50(cachePath, "utf8");
34292
+ const content = readFileSync51(cachePath, "utf8");
34081
34293
  return parse3(content);
34082
34294
  }
34083
34295
  function deleteCommentsCache(org, repo, prNumber) {
@@ -34090,10 +34302,10 @@ function deleteCommentsCache(org, repo, prNumber) {
34090
34302
 
34091
34303
  // src/commands/prs/removeStaleCommentsCaches.ts
34092
34304
  import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
34093
- import { join as join87 } from "path";
34305
+ import { join as join88 } from "path";
34094
34306
  var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
34095
34307
  function removeStaleCommentsCaches(cwd = process.cwd()) {
34096
- const dir = join87(cwd, ".assist");
34308
+ const dir = join88(cwd, ".assist");
34097
34309
  let entries;
34098
34310
  try {
34099
34311
  entries = readdirSync16(dir);
@@ -34101,20 +34313,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
34101
34313
  return;
34102
34314
  }
34103
34315
  for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
34104
- unlinkSync15(join87(dir, entry));
34316
+ unlinkSync15(join88(dir, entry));
34105
34317
  }
34106
34318
  }
34107
34319
 
34108
34320
  // src/commands/prs/listComments/updateCommentsCache.ts
34109
34321
  function writeCommentsCache(org, repo, prNumber, comments3) {
34110
34322
  const cachePath = commentsCachePath(org, repo, prNumber);
34111
- mkdirSync26(dirname39(cachePath), { recursive: true });
34323
+ mkdirSync27(dirname40(cachePath), { recursive: true });
34112
34324
  const cacheData = {
34113
34325
  prNumber,
34114
34326
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
34115
34327
  comments: comments3
34116
34328
  };
34117
- writeFileSync38(cachePath, stringify3(cacheData));
34329
+ writeFileSync39(cachePath, stringify3(cacheData));
34118
34330
  }
34119
34331
  function updateCommentsCache(org, repo, prNumber, comments3) {
34120
34332
  removeStaleCommentsCaches();
@@ -34217,9 +34429,9 @@ function failAzureDevops(error) {
34217
34429
 
34218
34430
  // src/commands/prs/azureDevops/invokeAzDevops.ts
34219
34431
  import { execFileSync as execFileSync19 } from "child_process";
34220
- import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync39 } from "fs";
34432
+ import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
34221
34433
  import { tmpdir as tmpdir6 } from "os";
34222
- import { join as join88 } from "path";
34434
+ import { join as join89 } from "path";
34223
34435
  function azDevopsInvokeArgs(request, inFile) {
34224
34436
  return [
34225
34437
  "devops",
@@ -34254,10 +34466,10 @@ function runAz2(args) {
34254
34466
  }
34255
34467
  function invokeAzDevops(request) {
34256
34468
  if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
34257
- const dir = mkdtempSync2(join88(tmpdir6(), "assist-az-"));
34258
- const inFile = join88(dir, "body.json");
34469
+ const dir = mkdtempSync2(join89(tmpdir6(), "assist-az-"));
34470
+ const inFile = join89(dir, "body.json");
34259
34471
  try {
34260
- writeFileSync39(inFile, JSON.stringify(request.body));
34472
+ writeFileSync40(inFile, JSON.stringify(request.body));
34261
34473
  return runAz2(azDevopsInvokeArgs(request, inFile));
34262
34474
  } finally {
34263
34475
  rmSync6(dir, { recursive: true, force: true });
@@ -34939,12 +35151,12 @@ ${sections.how}`);
34939
35151
  // src/commands/prs/parsePrBody.ts
34940
35152
  function parsePrBody(body) {
34941
35153
  const sections = [];
34942
- let current = null;
35154
+ let current2 = null;
34943
35155
  const flush = () => {
34944
- if (current) {
35156
+ if (current2) {
34945
35157
  sections.push({
34946
- heading: current.heading,
34947
- content: current.lines.join("\n").trim()
35158
+ heading: current2.heading,
35159
+ content: current2.lines.join("\n").trim()
34948
35160
  });
34949
35161
  }
34950
35162
  };
@@ -34952,9 +35164,9 @@ function parsePrBody(body) {
34952
35164
  const match = /^##\s+(.+?)\s*$/.exec(line);
34953
35165
  if (match) {
34954
35166
  flush();
34955
- current = { heading: match[1], lines: [] };
34956
- } else if (current) {
34957
- current.lines.push(line);
35167
+ current2 = { heading: match[1], lines: [] };
35168
+ } else if (current2) {
35169
+ current2.lines.push(line);
34958
35170
  }
34959
35171
  }
34960
35172
  flush();
@@ -36041,7 +36253,7 @@ function registerPrsStatus(prsCommand) {
36041
36253
  }
36042
36254
 
36043
36255
  // src/commands/readTime/readTime.ts
36044
- import { readFileSync as readFileSync51 } from "fs";
36256
+ import { readFileSync as readFileSync52 } from "fs";
36045
36257
 
36046
36258
  // src/commands/readTime/countReadingWords.ts
36047
36259
  var FENCE_PATTERN = /^\s*(```|~~~)/;
@@ -36202,7 +36414,7 @@ async function loadBody(target) {
36202
36414
  }
36203
36415
  function readDraftFile(path109) {
36204
36416
  try {
36205
- return readFileSync51(path109, "utf8");
36417
+ return readFileSync52(path109, "utf8");
36206
36418
  } catch {
36207
36419
  console.error(`Error: Could not read \`${path109}\`.`);
36208
36420
  console.error(
@@ -36709,10 +36921,10 @@ function checkStreamGraph(streams) {
36709
36921
  }
36710
36922
 
36711
36923
  // src/commands/releases/readStreamsInput.ts
36712
- import { readFileSync as readFileSync52 } from "fs";
36924
+ import { readFileSync as readFileSync53 } from "fs";
36713
36925
  import { parse as parse4 } from "yaml";
36714
36926
  function readSource2(source) {
36715
- return readFileSync52(source === "-" ? 0 : source, "utf8");
36927
+ return readFileSync53(source === "-" ? 0 : source, "utf8");
36716
36928
  }
36717
36929
  function readStreamsInput(source) {
36718
36930
  let parsed;
@@ -37383,9 +37595,9 @@ async function notify() {
37383
37595
 
37384
37596
  // src/commands/screenshot.ts
37385
37597
  import { execSync as execSync54 } from "child_process";
37386
- import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
37598
+ import { existsSync as existsSync70, mkdirSync as mkdirSync28, unlinkSync as unlinkSync16, writeFileSync as writeFileSync41 } from "fs";
37387
37599
  import { tmpdir as tmpdir7 } from "os";
37388
- import { join as join89, resolve as resolve28 } from "path";
37600
+ import { join as join90, resolve as resolve28 } from "path";
37389
37601
  import chalk228 from "chalk";
37390
37602
 
37391
37603
  // src/commands/screenshot/captureWindowPs1.ts
@@ -37516,14 +37728,14 @@ Write-Output $OutputPath
37516
37728
  // src/commands/screenshot.ts
37517
37729
  function buildOutputPath(outputDir, processName) {
37518
37730
  if (!existsSync70(outputDir)) {
37519
- mkdirSync27(outputDir, { recursive: true });
37731
+ mkdirSync28(outputDir, { recursive: true });
37520
37732
  }
37521
37733
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
37522
37734
  return resolve28(outputDir, `${processName}-${timestamp9}.png`);
37523
37735
  }
37524
37736
  function runPowerShellScript(processName, outputPath) {
37525
- const scriptPath = join89(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
37526
- writeFileSync40(scriptPath, captureWindowPs1, "utf8");
37737
+ const scriptPath = join90(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
37738
+ writeFileSync41(scriptPath, captureWindowPs1, "utf8");
37527
37739
  try {
37528
37740
  execSync54(
37529
37741
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
@@ -37623,10 +37835,10 @@ function buildLimitsSegment(rateLimits) {
37623
37835
  }
37624
37836
 
37625
37837
  // src/commands/readGitBranch.ts
37626
- import { readFileSync as readFileSync53, statSync as statSync11 } from "fs";
37627
- import { isAbsolute as isAbsolute6, join as join90, resolve as resolve29 } from "path";
37838
+ import { readFileSync as readFileSync54, statSync as statSync11 } from "fs";
37839
+ import { isAbsolute as isAbsolute6, join as join91, resolve as resolve29 } from "path";
37628
37840
  function resolveGitDir(cwd) {
37629
- const dotGit = join90(cwd, ".git");
37841
+ const dotGit = join91(cwd, ".git");
37630
37842
  let stat5;
37631
37843
  try {
37632
37844
  stat5 = statSync11(dotGit);
@@ -37638,7 +37850,7 @@ function resolveGitDir(cwd) {
37638
37850
  }
37639
37851
  let contents;
37640
37852
  try {
37641
- contents = readFileSync53(dotGit, "utf8");
37853
+ contents = readFileSync54(dotGit, "utf8");
37642
37854
  } catch {
37643
37855
  return null;
37644
37856
  }
@@ -37656,7 +37868,7 @@ function readGitBranch(cwd) {
37656
37868
  }
37657
37869
  let head;
37658
37870
  try {
37659
- head = readFileSync53(join90(gitDir, "HEAD"), "utf8");
37871
+ head = readFileSync54(join91(gitDir, "HEAD"), "utf8");
37660
37872
  } catch {
37661
37873
  return null;
37662
37874
  }
@@ -38190,9 +38402,9 @@ function getCalledFunctionNames(fn) {
38190
38402
  function collectPrivateFunctions(target, fnMap) {
38191
38403
  const collected = /* @__PURE__ */ new Set();
38192
38404
  const queue = [target];
38193
- let current = queue.pop();
38194
- while (current) {
38195
- for (const name of getCalledFunctionNames(current)) {
38405
+ let current2 = queue.pop();
38406
+ while (current2) {
38407
+ for (const name of getCalledFunctionNames(current2)) {
38196
38408
  if (collected.has(name)) continue;
38197
38409
  const fn = fnMap.get(name);
38198
38410
  if (fn && isPrivate(fn)) {
@@ -38200,7 +38412,7 @@ function collectPrivateFunctions(target, fnMap) {
38200
38412
  queue.push(fn);
38201
38413
  }
38202
38414
  }
38203
- current = queue.pop();
38415
+ current2 = queue.pop();
38204
38416
  }
38205
38417
  return [...collected].flatMap((name) => {
38206
38418
  const fn = fnMap.get(name);
@@ -38591,15 +38803,15 @@ var DECLARATION_KINDS = /* @__PURE__ */ new Set([
38591
38803
  SyntaxKind18.ExportSpecifier
38592
38804
  ]);
38593
38805
  function isInsideExtractedFunction(node, extracted) {
38594
- let current = node;
38595
- while (current) {
38596
- if (current.getKind() !== SyntaxKind18.FunctionDeclaration) {
38597
- current = current.getParent();
38806
+ let current2 = node;
38807
+ while (current2) {
38808
+ if (current2.getKind() !== SyntaxKind18.FunctionDeclaration) {
38809
+ current2 = current2.getParent();
38598
38810
  continue;
38599
38811
  }
38600
- const name = current.getName?.();
38812
+ const name = current2.getName?.();
38601
38813
  if (name && extracted.has(name)) return true;
38602
- current = current.getParent();
38814
+ current2 = current2.getParent();
38603
38815
  }
38604
38816
  return false;
38605
38817
  }
@@ -40091,39 +40303,39 @@ var highLevelConfigKeys = {
40091
40303
  };
40092
40304
 
40093
40305
  // src/commands/review/highLevel/buildHighLevelQuestions.ts
40094
- function buildHighLevelQuestions(current, proposed) {
40306
+ function buildHighLevelQuestions(current2, proposed) {
40095
40307
  return [
40096
40308
  {
40097
40309
  key: highLevelConfigKeys.criticalPaths,
40098
40310
  question: "Critical paths \u2014 comma-separated globs whose full diffs the review shows (blank to leave unset)",
40099
40311
  suggest: suggestCriticalPaths(
40100
- current.criticalPaths,
40312
+ current2.criticalPaths,
40101
40313
  proposed.criticalPaths
40102
40314
  )
40103
40315
  },
40104
40316
  {
40105
40317
  key: highLevelConfigKeys.uiPaths,
40106
40318
  question: "UI paths \u2014 comma-separated globs that make a change a UI change, so a screenshot or video is required (blank to leave unset)",
40107
- suggest: suggestGlobs(current.uiPaths, proposed.uiPaths)
40319
+ suggest: suggestGlobs(current2.uiPaths, proposed.uiPaths)
40108
40320
  },
40109
40321
  {
40110
40322
  key: highLevelConfigKeys.descriptionWordCap,
40111
40323
  question: "Description word cap (blank to leave unset)",
40112
- suggest: String(current.descriptionWordCap)
40324
+ suggest: String(current2.descriptionWordCap)
40113
40325
  },
40114
40326
  {
40115
40327
  key: highLevelConfigKeys.collapsedPaths,
40116
40328
  question: "Collapsed paths \u2014 comma-separated globs whose files start collapsed in the changed-files tree (blank to leave unset)",
40117
- suggest: suggestGlobs(current.collapsedPaths, [])
40329
+ suggest: suggestGlobs(current2.collapsedPaths, [])
40118
40330
  }
40119
40331
  ];
40120
40332
  }
40121
- function suggestCriticalPaths(current, proposed) {
40122
- if (current) return suggestGlobs(current, []);
40333
+ function suggestCriticalPaths(current2, proposed) {
40334
+ if (current2) return suggestGlobs(current2, []);
40123
40335
  return [.../* @__PURE__ */ new Set([...defaultCriticalPaths, ...proposed])].join(",");
40124
40336
  }
40125
- function suggestGlobs(current, proposed) {
40126
- const globs = current.length > 0 ? current : proposed;
40337
+ function suggestGlobs(current2, proposed) {
40338
+ const globs = current2.length > 0 ? current2 : proposed;
40127
40339
  return globs.length > 0 ? globs.join(",") : void 0;
40128
40340
  }
40129
40341
 
@@ -40201,7 +40413,7 @@ function readGlobs(value) {
40201
40413
 
40202
40414
  // src/commands/review/highLevel/summariseRepoTree.ts
40203
40415
  import { execFileSync as execFileSync25 } from "child_process";
40204
- import { dirname as dirname41, extname as extname6 } from "path";
40416
+ import { dirname as dirname42, extname as extname6 } from "path";
40205
40417
  var MAX_DIRECTORIES = 200;
40206
40418
  var MAX_EXTENSIONS_PER_DIRECTORY = 6;
40207
40419
  function summariseRepoTree(cwd = process.cwd()) {
@@ -40228,7 +40440,7 @@ function listTrackedFiles(cwd) {
40228
40440
  function countByDirectory(files) {
40229
40441
  const directories = /* @__PURE__ */ new Map();
40230
40442
  for (const file of files) {
40231
- const directory = dirname41(file) === "." ? "(repo root)" : dirname41(file);
40443
+ const directory = dirname42(file) === "." ? "(repo root)" : dirname42(file);
40232
40444
  const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
40233
40445
  const extension2 = extname6(file) === "" ? "(no extension)" : extname6(file);
40234
40446
  extensions.set(extension2, (extensions.get(extension2) ?? 0) + 1);
@@ -40293,11 +40505,11 @@ var NOTHING_PROPOSED2 = { criticalPaths: [], uiPaths: [] };
40293
40505
  async function configureHighLevelReview(options2 = {}) {
40294
40506
  const answers = parseConfigureAnswers(options2.answer ?? []);
40295
40507
  const proposed = answersCoverEveryKey(answers) ? NOTHING_PROPOSED2 : proposeHighLevelGlobs();
40296
- const current = resolveHighLevelConfig(loadConfig());
40508
+ const current2 = resolveHighLevelConfig(loadConfig());
40297
40509
  const questions = buildHighLevelQuestions(
40298
40510
  {
40299
- ...current,
40300
- criticalPaths: isConfigKeySet(highLevelConfigKeys.criticalPaths) ? current.criticalPaths : void 0
40511
+ ...current2,
40512
+ criticalPaths: isConfigKeySet(highLevelConfigKeys.criticalPaths) ? current2.criticalPaths : void 0
40301
40513
  },
40302
40514
  proposed
40303
40515
  );
@@ -40775,7 +40987,7 @@ function fetchHighLevelPr(prNumber, repo) {
40775
40987
  }
40776
40988
 
40777
40989
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
40778
- import { readFileSync as readFileSync55 } from "fs";
40990
+ import { readFileSync as readFileSync56 } from "fs";
40779
40991
 
40780
40992
  // src/commands/review/highLevel/formatSlicingRequest.ts
40781
40993
  var RULES = [
@@ -40836,12 +41048,12 @@ function formatSlicingRequest(hunks) {
40836
41048
  }
40837
41049
 
40838
41050
  // src/commands/review/highLevel/highLevelReviewPath.ts
40839
- import { join as join91 } from "path";
41051
+ import { join as join92 } from "path";
40840
41052
  function slug(value) {
40841
41053
  return value.replace(/[^\w.-]+/g, "-");
40842
41054
  }
40843
41055
  function highLevelReviewPath(repo, headRef, headSha) {
40844
- return join91(
41056
+ return join92(
40845
41057
  getStoreDir(),
40846
41058
  "high-level-reviews",
40847
41059
  slug(repo),
@@ -40893,11 +41105,11 @@ function listHighLevelHunks(files) {
40893
41105
  }
40894
41106
 
40895
41107
  // src/commands/review/highLevel/readJsonFile.ts
40896
- import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
41108
+ import { existsSync as existsSync71, readFileSync as readFileSync55 } from "fs";
40897
41109
  function readJsonFile(path109) {
40898
41110
  if (!existsSync71(path109)) return void 0;
40899
41111
  try {
40900
- return JSON.parse(readFileSync54(path109, "utf8"));
41112
+ return JSON.parse(readFileSync55(path109, "utf8"));
40901
41113
  } catch {
40902
41114
  return void 0;
40903
41115
  }
@@ -40976,11 +41188,11 @@ function resolveHighLevelSlices(raw, hunks) {
40976
41188
  }
40977
41189
 
40978
41190
  // src/commands/review/highLevel/writeJsonFile.ts
40979
- import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync41 } from "fs";
40980
- import { dirname as dirname42 } from "path";
41191
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync42 } from "fs";
41192
+ import { dirname as dirname43 } from "path";
40981
41193
  function writeJsonFile(path109, data) {
40982
- mkdirSync28(dirname42(path109), { recursive: true });
40983
- writeFileSync41(path109, `${JSON.stringify(data, null, 2)}
41194
+ mkdirSync29(dirname43(path109), { recursive: true });
41195
+ writeFileSync42(path109, `${JSON.stringify(data, null, 2)}
40984
41196
  `);
40985
41197
  return path109;
40986
41198
  }
@@ -40988,7 +41200,7 @@ function writeJsonFile(path109, data) {
40988
41200
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
40989
41201
  function readSlicesFile(file) {
40990
41202
  try {
40991
- return JSON.parse(readFileSync55(file, "utf8"));
41203
+ return JSON.parse(readFileSync56(file, "utf8"));
40992
41204
  } catch (error) {
40993
41205
  throw new Error(
40994
41206
  `could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
@@ -41596,22 +41808,22 @@ function postHighLevelReview(repo, prNumber, { event, body, comments: comments3
41596
41808
  var HUNK_HEADER2 = /^@@ -(\d+)(?:,\d+)? \+(\d+)/;
41597
41809
  function patchHunkLines(patch2) {
41598
41810
  const hunks = [];
41599
- let current;
41811
+ let current2;
41600
41812
  let left = 0;
41601
41813
  let right = 0;
41602
41814
  for (const line of patch2.split("\n")) {
41603
41815
  const header = HUNK_HEADER2.exec(line);
41604
41816
  if (header) {
41605
- current = { LEFT: /* @__PURE__ */ new Set(), RIGHT: /* @__PURE__ */ new Set() };
41606
- hunks.push(current);
41817
+ current2 = { LEFT: /* @__PURE__ */ new Set(), RIGHT: /* @__PURE__ */ new Set() };
41818
+ hunks.push(current2);
41607
41819
  left = Number(header[1]);
41608
41820
  right = Number(header[2]);
41609
- } else if (!current || line.startsWith("\\")) continue;
41610
- else if (line.startsWith("+")) current.RIGHT.add(right++);
41611
- else if (line.startsWith("-")) current.LEFT.add(left++);
41821
+ } else if (!current2 || line.startsWith("\\")) continue;
41822
+ else if (line.startsWith("+")) current2.RIGHT.add(right++);
41823
+ else if (line.startsWith("-")) current2.LEFT.add(left++);
41612
41824
  else {
41613
- current.LEFT.add(left++);
41614
- current.RIGHT.add(right++);
41825
+ current2.LEFT.add(left++);
41826
+ current2.RIGHT.add(right++);
41615
41827
  }
41616
41828
  }
41617
41829
  return hunks;
@@ -41925,7 +42137,7 @@ async function runHighLevelReview(number, options2 = {}) {
41925
42137
  import { basename as basename26 } from "path";
41926
42138
 
41927
42139
  // src/commands/review/ci/writeJobSummary.ts
41928
- import { appendFileSync as appendFileSync3, readFileSync as readFileSync56 } from "fs";
42140
+ import { appendFileSync as appendFileSync3, readFileSync as readFileSync57 } from "fs";
41929
42141
 
41930
42142
  // src/commands/review/carriedUnanchoredFindings.ts
41931
42143
  function carriedUnanchoredFindings(unanchored) {
@@ -42307,7 +42519,7 @@ function buildTokenUsageTable(usages) {
42307
42519
  // src/commands/review/ci/writeJobSummary.ts
42308
42520
  function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
42309
42521
  if (!summaryPath) return;
42310
- const markdown = readFileSync56(synthesisPath, "utf8");
42522
+ const markdown = readFileSync57(synthesisPath, "utf8");
42311
42523
  const { unanchored } = selectPostableFindings(markdown, prInfo);
42312
42524
  const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
42313
42525
  appendFileSync3(
@@ -42425,8 +42637,8 @@ function renderEntry(entry, frame) {
42425
42637
  import { format as format2 } from "util";
42426
42638
 
42427
42639
  // src/commands/review/createReviewLogSink.ts
42428
- import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
42429
- import { join as join92 } from "path";
42640
+ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync30 } from "fs";
42641
+ import { join as join93 } from "path";
42430
42642
  var LOG_FILE = "review.log";
42431
42643
  function createReviewLogSink() {
42432
42644
  let logPath2;
@@ -42442,8 +42654,8 @@ function createReviewLogSink() {
42442
42654
  `);
42443
42655
  },
42444
42656
  attach(reviewDir) {
42445
- mkdirSync29(reviewDir, { recursive: true });
42446
- logPath2 = join92(reviewDir, LOG_FILE);
42657
+ mkdirSync30(reviewDir, { recursive: true });
42658
+ logPath2 = join93(reviewDir, LOG_FILE);
42447
42659
  const lines2 = [
42448
42660
  "",
42449
42661
  `=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
@@ -42734,7 +42946,7 @@ function buildCodexModelArgs() {
42734
42946
  }
42735
42947
 
42736
42948
  // src/commands/review/runClaudeReviewer.ts
42737
- import { writeFileSync as writeFileSync42 } from "fs";
42949
+ import { writeFileSync as writeFileSync43 } from "fs";
42738
42950
 
42739
42951
  // src/commands/review/formatToolSummary.ts
42740
42952
  function truncate3(value, max = 80) {
@@ -43118,7 +43330,7 @@ async function runClaudeReviewer(spec) {
43118
43330
  onLine
43119
43331
  });
43120
43332
  if (result.exitCode === 0 && state.finalText)
43121
- writeFileSync42(spec.outputPath, state.finalText);
43333
+ writeFileSync43(spec.outputPath, state.finalText);
43122
43334
  const finalised = finaliseReviewerRun(
43123
43335
  { ...spec, command, model: override?.model },
43124
43336
  spinner,
@@ -43314,7 +43526,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
43314
43526
  import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
43315
43527
 
43316
43528
  // src/commands/review/synthesise.ts
43317
- import { readFileSync as readFileSync57 } from "fs";
43529
+ import { readFileSync as readFileSync58 } from "fs";
43318
43530
 
43319
43531
  // src/commands/review/buildSynthesisStdin.ts
43320
43532
  var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
@@ -43383,7 +43595,7 @@ Files:
43383
43595
 
43384
43596
  // src/commands/review/synthesise.ts
43385
43597
  function printSummary2(synthesisPath) {
43386
- const markdown = readFileSync57(synthesisPath, "utf8");
43598
+ const markdown = readFileSync58(synthesisPath, "utf8");
43387
43599
  console.log("");
43388
43600
  console.log(buildReviewSummary(markdown));
43389
43601
  console.log("");
@@ -43650,9 +43862,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
43650
43862
 
43651
43863
  // src/commands/review/buildReviewPaths.ts
43652
43864
  import { homedir as homedir26 } from "os";
43653
- import { basename as basename25, join as join93 } from "path";
43865
+ import { basename as basename25, join as join94 } from "path";
43654
43866
  function buildReviewPaths(repoRoot2, key) {
43655
- const reviewDir = join93(
43867
+ const reviewDir = join94(
43656
43868
  homedir26(),
43657
43869
  ".assist",
43658
43870
  "reviews",
@@ -43661,10 +43873,10 @@ function buildReviewPaths(repoRoot2, key) {
43661
43873
  );
43662
43874
  return {
43663
43875
  reviewDir,
43664
- requestPath: join93(reviewDir, "request.md"),
43665
- claudePath: join93(reviewDir, "claude.md"),
43666
- codexPath: join93(reviewDir, "codex.md"),
43667
- synthesisPath: join93(reviewDir, "synthesis.md")
43876
+ requestPath: join94(reviewDir, "request.md"),
43877
+ claudePath: join94(reviewDir, "claude.md"),
43878
+ codexPath: join94(reviewDir, "codex.md"),
43879
+ synthesisPath: join94(reviewDir, "synthesis.md")
43668
43880
  };
43669
43881
  }
43670
43882
 
@@ -43702,16 +43914,16 @@ function fetchExistingComments() {
43702
43914
  }
43703
43915
 
43704
43916
  // src/commands/review/prepareReviewDir.ts
43705
- import { existsSync as existsSync74, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
43917
+ import { existsSync as existsSync74, mkdirSync as mkdirSync31, unlinkSync as unlinkSync19, writeFileSync as writeFileSync44 } from "fs";
43706
43918
  function clearReviewFiles(paths) {
43707
43919
  for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
43708
43920
  if (existsSync74(path109)) unlinkSync19(path109);
43709
43921
  }
43710
43922
  }
43711
43923
  function prepareReviewDir(paths, requestBody, force) {
43712
- mkdirSync30(paths.reviewDir, { recursive: true });
43924
+ mkdirSync31(paths.reviewDir, { recursive: true });
43713
43925
  if (force) clearReviewFiles(paths);
43714
- writeFileSync43(paths.requestPath, requestBody);
43926
+ writeFileSync44(paths.requestPath, requestBody);
43715
43927
  }
43716
43928
 
43717
43929
  // src/commands/review/setupReviewDir.ts
@@ -43828,7 +44040,7 @@ function gatherChangedContext() {
43828
44040
  }
43829
44041
 
43830
44042
  // src/commands/review/postReviewToPr.ts
43831
- import { readFileSync as readFileSync58 } from "fs";
44043
+ import { readFileSync as readFileSync59 } from "fs";
43832
44044
 
43833
44045
  // src/commands/review/chainAddressComments.ts
43834
44046
  function chainAddressComments(prNumber, announce) {
@@ -43969,10 +44181,10 @@ function currentPrNumber() {
43969
44181
  }
43970
44182
  }
43971
44183
  function stillOnReviewedPr(prNumber) {
43972
- const current = currentPrNumber();
43973
- if (current === prNumber) return true;
44184
+ const current2 = currentPrNumber();
44185
+ if (current2 === prNumber) return true;
43974
44186
  console.error(
43975
- `Error: this tree is now on ${current === null ? "a branch with no open PR" : `PR #${current}`}, not the reviewed PR #${prNumber}; skipping the post and any chained sessions.`
44187
+ `Error: this tree is now on ${current2 === null ? "a branch with no open PR" : `PR #${current2}`}, not the reviewed PR #${prNumber}; skipping the post and any chained sessions.`
43976
44188
  );
43977
44189
  return false;
43978
44190
  }
@@ -44010,7 +44222,7 @@ async function confirmPost(prNumber, work, options2) {
44010
44222
  return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
44011
44223
  }
44012
44224
  async function postFindingsToPr(prInfo, synthesisPath, options2) {
44013
- const markdown = readFileSync58(synthesisPath, "utf8");
44225
+ const markdown = readFileSync59(synthesisPath, "utf8");
44014
44226
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
44015
44227
  const carried = carriedUnanchoredFindings(unanchored);
44016
44228
  if (inDiff.length === 0 && carried.length === 0)
@@ -44374,11 +44586,11 @@ import path88 from "path";
44374
44586
  import chalk263 from "chalk";
44375
44587
 
44376
44588
  // src/commands/rules/updateScopedRulesIndex.ts
44377
- import { existsSync as existsSync75, readFileSync as readFileSync60, writeFileSync as writeFileSync44 } from "fs";
44589
+ import { existsSync as existsSync75, readFileSync as readFileSync61, writeFileSync as writeFileSync45 } from "fs";
44378
44590
  import path87 from "path";
44379
44591
 
44380
44592
  // src/commands/rules/scopedRuleDirectories.ts
44381
- import { readFileSync as readFileSync59 } from "fs";
44593
+ import { readFileSync as readFileSync60 } from "fs";
44382
44594
  import path86 from "path";
44383
44595
 
44384
44596
  // src/commands/rules/findClaudeFiles.ts
@@ -44402,7 +44614,7 @@ function findClaudeFiles(dir) {
44402
44614
  // src/commands/rules/scopedRuleDirectories.ts
44403
44615
  function scopedRuleDirectories(root2) {
44404
44616
  return findClaudeFiles(root2).filter(
44405
- (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync59(file, "utf8")).length > 0
44617
+ (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync60(file, "utf8")).length > 0
44406
44618
  ).map(
44407
44619
  (file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
44408
44620
  ).sort();
@@ -44444,9 +44656,9 @@ function upsertScopedRulesPointer(content, directories) {
44444
44656
  function updateScopedRulesIndex(root2) {
44445
44657
  const directories = scopedRuleDirectories(root2);
44446
44658
  const rootFile = path87.join(root2, "CLAUDE.md");
44447
- const before = existsSync75(rootFile) ? readFileSync60(rootFile, "utf8") : "";
44659
+ const before = existsSync75(rootFile) ? readFileSync61(rootFile, "utf8") : "";
44448
44660
  const after = upsertScopedRulesPointer(before, directories);
44449
- if (after !== before) writeFileSync44(rootFile, after);
44661
+ if (after !== before) writeFileSync45(rootFile, after);
44450
44662
  return directories;
44451
44663
  }
44452
44664
 
@@ -44497,7 +44709,7 @@ function listRules(target, options2 = {}) {
44497
44709
  }
44498
44710
 
44499
44711
  // src/commands/rules/addRule.ts
44500
- import { existsSync as existsSync77, readFileSync as readFileSync62, writeFileSync as writeFileSync45 } from "fs";
44712
+ import { existsSync as existsSync77, readFileSync as readFileSync63, writeFileSync as writeFileSync46 } from "fs";
44501
44713
  import path91 from "path";
44502
44714
  import chalk265 from "chalk";
44503
44715
 
@@ -44522,11 +44734,11 @@ function insertRuleBullet(content, rule) {
44522
44734
  }
44523
44735
 
44524
44736
  // src/commands/rules/nextRuleCode.ts
44525
- import { readFileSync as readFileSync61 } from "fs";
44737
+ import { readFileSync as readFileSync62 } from "fs";
44526
44738
  var CODE_PREFIX = "R";
44527
44739
  function nextRuleCode(root2) {
44528
44740
  const numbers = findClaudeFiles(root2).flatMap(
44529
- (file) => parseRulesSection(readFileSync61(file, "utf8")).map(
44741
+ (file) => parseRulesSection(readFileSync62(file, "utf8")).map(
44530
44742
  (rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
44531
44743
  )
44532
44744
  );
@@ -44541,19 +44753,19 @@ function resolveRuleScope(target) {
44541
44753
  if (path90.basename(resolved) === "CLAUDE.md") return resolved;
44542
44754
  const startDir = scopeDirectory(resolved);
44543
44755
  const root2 = findRepoRoot(startDir) ?? startDir;
44544
- let current = startDir;
44756
+ let current2 = startDir;
44545
44757
  while (true) {
44546
- const candidate = path90.join(current, "CLAUDE.md");
44758
+ const candidate = path90.join(current2, "CLAUDE.md");
44547
44759
  if (existsSync76(candidate)) return candidate;
44548
- if (current === root2 || current === path90.dirname(current)) break;
44549
- current = path90.dirname(current);
44760
+ if (current2 === root2 || current2 === path90.dirname(current2)) break;
44761
+ current2 = path90.dirname(current2);
44550
44762
  }
44551
44763
  return path90.join(root2, "CLAUDE.md");
44552
44764
  }
44553
44765
 
44554
44766
  // src/commands/rules/addRule.ts
44555
- function read2(file) {
44556
- return existsSync77(file) ? readFileSync62(file, "utf8") : "";
44767
+ function read3(file) {
44768
+ return existsSync77(file) ? readFileSync63(file, "utf8") : "";
44557
44769
  }
44558
44770
  function addRule(text20, options2) {
44559
44771
  const rule = text20.trim();
@@ -44566,9 +44778,9 @@ function addRule(text20, options2) {
44566
44778
  const targetDir = path91.dirname(target);
44567
44779
  const root2 = findRepoRoot(targetDir) ?? targetDir;
44568
44780
  const code = nextRuleCode(root2);
44569
- writeFileSync45(
44781
+ writeFileSync46(
44570
44782
  target,
44571
- insertRuleBullet(read2(target), {
44783
+ insertRuleBullet(read3(target), {
44572
44784
  code,
44573
44785
  title: options2.title?.trim() || void 0,
44574
44786
  text: rule
@@ -44597,8 +44809,8 @@ function optionsError(options2) {
44597
44809
  return void 0;
44598
44810
  }
44599
44811
  async function addToUserDb(rule) {
44600
- const result = await applyUserConfigSet("advice.rules", (current) => [
44601
- ...asRules(current),
44812
+ const result = await applyUserConfigSet("advice.rules", (current2) => [
44813
+ ...asRules(current2),
44602
44814
  rule
44603
44815
  ]);
44604
44816
  if (!result.ok) return fail10(result.errors.join("\n"));
@@ -45076,7 +45288,7 @@ function findShownSessionFiles(body, writtenPaths, locations) {
45076
45288
  }
45077
45289
 
45078
45290
  // src/commands/show/sessionWrittenPaths.ts
45079
- import { readFileSync as readFileSync63 } from "fs";
45291
+ import { readFileSync as readFileSync64 } from "fs";
45080
45292
 
45081
45293
  // src/commands/sessions/shared/asRecord.ts
45082
45294
  function asRecord(value) {
@@ -45104,7 +45316,7 @@ function writtenFilePaths(entry) {
45104
45316
  function sessionWrittenPaths(transcriptPath2) {
45105
45317
  let text20;
45106
45318
  try {
45107
- text20 = readFileSync63(transcriptPath2, "utf8");
45319
+ text20 = readFileSync64(transcriptPath2, "utf8");
45108
45320
  } catch {
45109
45321
  return [];
45110
45322
  }
@@ -45217,18 +45429,18 @@ function parseSlackThreadRef(value) {
45217
45429
  }
45218
45430
 
45219
45431
  // src/commands/slack/postSlackMessage.ts
45220
- import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
45432
+ import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync48 } from "fs";
45221
45433
 
45222
45434
  // src/commands/slack/previewSlackThreadParts.ts
45223
- import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
45435
+ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
45224
45436
 
45225
45437
  // src/commands/slack/readSlackParts.ts
45226
- import { readFileSync as readFileSync64 } from "fs";
45438
+ import { readFileSync as readFileSync65 } from "fs";
45227
45439
  function readSlackParts(files) {
45228
45440
  return files.map((file) => {
45229
45441
  let contents;
45230
45442
  try {
45231
- contents = readFileSync64(file, "utf8");
45443
+ contents = readFileSync65(file, "utf8");
45232
45444
  } catch {
45233
45445
  console.error(`Error: Part file not found: ${file}`);
45234
45446
  process.exit(1);
@@ -45266,12 +45478,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
45266
45478
  }
45267
45479
 
45268
45480
  // src/commands/slack/slackWorkingFile.ts
45269
- import { join as join94 } from "path";
45481
+ import { join as join95 } from "path";
45270
45482
  function slackWorkingFile(channel, partIndex) {
45271
45483
  const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
45272
- const dir = join94(getStoreDir(), "slack");
45484
+ const dir = join95(getStoreDir(), "slack");
45273
45485
  const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
45274
- return { dir, bodyPath: join94(dir, `${name}.md`) };
45486
+ return { dir, bodyPath: join95(dir, `${name}.md`) };
45275
45487
  }
45276
45488
 
45277
45489
  // src/commands/slack/previewSlackThreadParts.ts
@@ -45283,10 +45495,10 @@ async function previewSlackThreadParts({
45283
45495
  }) {
45284
45496
  const bodies = readSlackParts(partFiles);
45285
45497
  const { dir } = slackWorkingFile(channel);
45286
- mkdirSync31(dir, { recursive: true });
45498
+ mkdirSync32(dir, { recursive: true });
45287
45499
  const paths = bodies.map((body, index3) => {
45288
45500
  const { bodyPath } = slackWorkingFile(channel, index3 + 1);
45289
- writeFileSync46(bodyPath, `${body}
45501
+ writeFileSync47(bodyPath, `${body}
45290
45502
  `);
45291
45503
  return bodyPath;
45292
45504
  });
@@ -45337,8 +45549,8 @@ async function postSlackMessage(channelArg, options2) {
45337
45549
  process.exit(1);
45338
45550
  }
45339
45551
  const { dir, bodyPath } = slackWorkingFile(channel);
45340
- mkdirSync32(dir, { recursive: true });
45341
- writeFileSync47(bodyPath, `${body}
45552
+ mkdirSync33(dir, { recursive: true });
45553
+ writeFileSync48(bodyPath, `${body}
45342
45554
  `);
45343
45555
  await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
45344
45556
  console.log(`Approved for ${target}. The body to post is at:`);
@@ -46191,23 +46403,23 @@ function joinWithOverlap(currentText, nextText) {
46191
46403
  }
46192
46404
  return currentText.includes(nextText) ? currentText : `${currentText} ${nextText}`;
46193
46405
  }
46194
- function canMergeCues(current, next3) {
46195
- return current.speaker === next3.speaker && next3.startMs <= current.endMs + 500;
46406
+ function canMergeCues(current2, next3) {
46407
+ return current2.speaker === next3.speaker && next3.startMs <= current2.endMs + 500;
46196
46408
  }
46197
46409
  function mergeOverlappingCues(cues) {
46198
46410
  if (cues.length === 0) return [];
46199
46411
  const result = [];
46200
- let current = { ...cues[0] };
46412
+ let current2 = { ...cues[0] };
46201
46413
  for (let i = 1; i < cues.length; i++) {
46202
- if (canMergeCues(current, cues[i])) {
46203
- current.text = joinWithOverlap(current.text, cues[i].text);
46204
- current.endMs = Math.max(current.endMs, cues[i].endMs);
46414
+ if (canMergeCues(current2, cues[i])) {
46415
+ current2.text = joinWithOverlap(current2.text, cues[i].text);
46416
+ current2.endMs = Math.max(current2.endMs, cues[i].endMs);
46205
46417
  } else {
46206
- result.push(current);
46207
- current = { ...cues[i] };
46418
+ result.push(current2);
46419
+ current2 = { ...cues[i] };
46208
46420
  }
46209
46421
  }
46210
- result.push(current);
46422
+ result.push(current2);
46211
46423
  return result;
46212
46424
  }
46213
46425
  function deduplicateCues(cues) {
@@ -46342,9 +46554,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
46342
46554
  }
46343
46555
 
46344
46556
  // src/commands/transcript/convert/readCleanedCues.ts
46345
- import { readFileSync as readFileSync69 } from "fs";
46557
+ import { readFileSync as readFileSync70 } from "fs";
46346
46558
  function readCleanedCues(inputPath) {
46347
- return deduplicateCues(parseVtt(readFileSync69(inputPath, "utf8")));
46559
+ return deduplicateCues(parseVtt(readFileSync70(inputPath, "utf8")));
46348
46560
  }
46349
46561
 
46350
46562
  // src/commands/transcript/clean.ts
@@ -46399,8 +46611,8 @@ function askQuestion2(rl, question) {
46399
46611
  }
46400
46612
 
46401
46613
  // src/commands/transcript/configure.ts
46402
- function buildPrompt4(label, current) {
46403
- return current ? `${label} [${current}]: ` : `${label}: `;
46614
+ function buildPrompt4(label, current2) {
46615
+ return current2 ? `${label} [${current2}]: ` : `${label}: `;
46404
46616
  }
46405
46617
  function printExisting(existing) {
46406
46618
  console.log("Current configuration:");
@@ -46454,20 +46666,20 @@ async function configure() {
46454
46666
 
46455
46667
  // src/commands/transcript/list.ts
46456
46668
  import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
46457
- import { join as join106 } from "path";
46669
+ import { join as join107 } from "path";
46458
46670
  function list5() {
46459
46671
  const { vttDir } = getTranscriptConfig();
46460
46672
  if (!existsSync83(vttDir)) return;
46461
46673
  for (const entry of readdirSync24(vttDir)) {
46462
46674
  if (!entry.endsWith(".vtt")) continue;
46463
- if (statSync13(join106(vttDir, entry)).isDirectory()) continue;
46675
+ if (statSync13(join107(vttDir, entry)).isDirectory()) continue;
46464
46676
  console.log(entry);
46465
46677
  }
46466
46678
  }
46467
46679
 
46468
46680
  // src/commands/transcript/move.ts
46469
- import { existsSync as existsSync84, mkdirSync as mkdirSync38, renameSync as renameSync5, writeFileSync as writeFileSync52 } from "fs";
46470
- import { basename as basename29, join as join107 } from "path";
46681
+ import { existsSync as existsSync84, mkdirSync as mkdirSync39, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
46682
+ import { basename as basename29, join as join108 } from "path";
46471
46683
 
46472
46684
  // src/commands/transcript/convertVttToMarkdown.ts
46473
46685
  function convertVttToMarkdown(inputPath) {
@@ -46477,9 +46689,9 @@ function convertVttToMarkdown(inputPath) {
46477
46689
  // src/commands/transcript/move.ts
46478
46690
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
46479
46691
  function archiveRawVtt(vttDir, sourcePath, filename) {
46480
- const processedDir = join107(vttDir, "processed");
46481
- mkdirSync38(processedDir, { recursive: true });
46482
- renameSync5(sourcePath, join107(processedDir, filename));
46692
+ const processedDir = join108(vttDir, "processed");
46693
+ mkdirSync39(processedDir, { recursive: true });
46694
+ renameSync5(sourcePath, join108(processedDir, filename));
46483
46695
  }
46484
46696
  function move(file, options2) {
46485
46697
  const { date, client } = options2;
@@ -46489,25 +46701,25 @@ function move(file, options2) {
46489
46701
  }
46490
46702
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
46491
46703
  const filename = basename29(file);
46492
- const sourcePath = join107(vttDir, filename);
46704
+ const sourcePath = join108(vttDir, filename);
46493
46705
  if (!existsSync84(sourcePath)) {
46494
46706
  console.error(`Error: VTT file not found: ${sourcePath}`);
46495
46707
  process.exit(1);
46496
46708
  }
46497
46709
  const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
46498
46710
  const outputName = `${date} ${base}.md`;
46499
- const formattedDir = join107(transcriptsDir, client);
46500
- mkdirSync38(formattedDir, { recursive: true });
46501
- const formattedPath = join107(formattedDir, outputName);
46502
- writeFileSync52(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
46711
+ const formattedDir = join108(transcriptsDir, client);
46712
+ mkdirSync39(formattedDir, { recursive: true });
46713
+ const formattedPath = join108(formattedDir, outputName);
46714
+ writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
46503
46715
  archiveRawVtt(vttDir, sourcePath, filename);
46504
- const summaryPath = join107(summaryDir, client, outputName);
46716
+ const summaryPath = join108(summaryDir, client, outputName);
46505
46717
  console.log(`Formatted transcript: ${formattedPath}`);
46506
46718
  console.log(`Summary target: ${summaryPath}`);
46507
46719
  }
46508
46720
 
46509
46721
  // src/commands/transcript/merge.ts
46510
- import { existsSync as existsSync85, writeFileSync as writeFileSync53 } from "fs";
46722
+ import { existsSync as existsSync85, writeFileSync as writeFileSync54 } from "fs";
46511
46723
  import { basename as basename30 } from "path";
46512
46724
 
46513
46725
  // src/commands/transcript/failTranscript.ts
@@ -46684,7 +46896,7 @@ async function merge(files, options2 = {}) {
46684
46896
  console.log(document);
46685
46897
  return;
46686
46898
  }
46687
- writeFileSync53(options2.out, `${document}
46899
+ writeFileSync54(options2.out, `${document}
46688
46900
  `, "utf8");
46689
46901
  console.log(`Merged transcript: ${options2.out}`);
46690
46902
  }
@@ -46957,27 +47169,27 @@ function toFindings(file, lines2, raw, exempt) {
46957
47169
 
46958
47170
  // src/commands/verify/blockCodeComments/collectFileComments.ts
46959
47171
  function collectFileComments(file, lines2, project) {
46960
- const read3 = () => fs50.readFileSync(file, "utf8");
47172
+ const read4 = () => fs50.readFileSync(file, "utf8");
46961
47173
  if (isYamlFile(file))
46962
- return toFindings(file, lines2, collectYamlComments(read3()), false);
47174
+ return toFindings(file, lines2, collectYamlComments(read4()), false);
46963
47175
  if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
46964
47176
  return toFindings(
46965
47177
  file,
46966
47178
  lines2,
46967
- collectHashComments(read3(), { skipHeader: isShellFile(file) }),
47179
+ collectHashComments(read4(), { skipHeader: isShellFile(file) }),
46968
47180
  true
46969
47181
  );
46970
47182
  if (isBicepFile(file))
46971
- return toFindings(file, lines2, collectBicepComments(read3()), true);
47183
+ return toFindings(file, lines2, collectBicepComments(read4()), true);
46972
47184
  if (isCsharpFile(file)) {
46973
- const content = read3();
47185
+ const content = read4();
46974
47186
  if (isGeneratedCsharpFile(file, content)) return [];
46975
47187
  return toFindings(file, lines2, collectCsharpComments(content), true);
46976
47188
  }
46977
47189
  if (isRazorFile(file))
46978
- return toFindings(file, lines2, extractRazorComments(read3()), true);
47190
+ return toFindings(file, lines2, extractRazorComments(read4()), true);
46979
47191
  if (isRustFile(file))
46980
- return toFindings(file, lines2, extractRustComments(read3()), true);
47192
+ return toFindings(file, lines2, extractRustComments(read4()), true);
46981
47193
  return collectSourceFindings(file, lines2, project);
46982
47194
  }
46983
47195
 
@@ -47124,19 +47336,19 @@ function configKeys2() {
47124
47336
  }
47125
47337
 
47126
47338
  // src/commands/verify/forbiddenStrings.ts
47127
- import { existsSync as existsSync86, readFileSync as readFileSync70 } from "fs";
47339
+ import { existsSync as existsSync86, readFileSync as readFileSync71 } from "fs";
47128
47340
 
47129
47341
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
47130
47342
  import { minimatch as minimatch10 } from "minimatch";
47131
47343
  function resolveStringsAtPath(data, path109) {
47132
- let current = data;
47344
+ let current2 = data;
47133
47345
  for (const segment of path109.split(".")) {
47134
- if (current === null || typeof current !== "object") return [];
47135
- current = current[segment];
47346
+ if (current2 === null || typeof current2 !== "object") return [];
47347
+ current2 = current2[segment];
47136
47348
  }
47137
- if (typeof current === "string") return [current];
47138
- if (Array.isArray(current))
47139
- return current.filter(
47349
+ if (typeof current2 === "string") return [current2];
47350
+ if (Array.isArray(current2))
47351
+ return current2.filter(
47140
47352
  (value) => typeof value === "string"
47141
47353
  );
47142
47354
  return [];
@@ -47171,7 +47383,7 @@ function forbiddenStrings() {
47171
47383
  }
47172
47384
  let parsed;
47173
47385
  try {
47174
- parsed = JSON.parse(readFileSync70(file, "utf8"));
47386
+ parsed = JSON.parse(readFileSync71(file, "utf8"));
47175
47387
  } catch (error) {
47176
47388
  console.log(`Could not parse ${file}: ${error.message}`);
47177
47389
  process.exit(1);
@@ -47243,14 +47455,14 @@ Total: ${lines2.length} hardcoded color(s)`);
47243
47455
  }
47244
47456
 
47245
47457
  // src/commands/verify/migrations.ts
47246
- import { readFileSync as readFileSync71 } from "fs";
47458
+ import { readFileSync as readFileSync72 } from "fs";
47247
47459
  import path105 from "path";
47248
47460
 
47249
47461
  // src/commands/verify/migrations/checkAppendOnly.ts
47250
- function checkAppendOnly(baseline, current) {
47462
+ function checkAppendOnly(baseline, current2) {
47251
47463
  const findings2 = [];
47252
47464
  for (const [file, content] of baseline) {
47253
- const now = current.get(file);
47465
+ const now = current2.get(file);
47254
47466
  if (now === void 0) findings2.push({ file, kind: "removed" });
47255
47467
  else if (now !== content) findings2.push({ file, kind: "modified" });
47256
47468
  }
@@ -47407,10 +47619,10 @@ function migrations2() {
47407
47619
  const ref = resolveBaselineRef();
47408
47620
  if (ref) {
47409
47621
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
47410
- const current = new Map(
47411
- files.map((file) => [file, readFileSync71(path105.join(dir, file), "utf8")])
47622
+ const current2 = new Map(
47623
+ files.map((file) => [file, readFileSync72(path105.join(dir, file), "utf8")])
47412
47624
  );
47413
- for (const finding of checkAppendOnly(baseline, current)) {
47625
+ for (const finding of checkAppendOnly(baseline, current2)) {
47414
47626
  problems.push(
47415
47627
  finding.kind === "removed" ? `Migration ${finding.file} was removed but ships in ${ref}; migrations are append-only once shipped.` : `Migration ${finding.file} was edited but already ships in ${ref}; migrations are append-only. Add a new numbered migration instead.`
47416
47628
  );
@@ -47937,19 +48149,19 @@ ${result.reason}`
47937
48149
  }
47938
48150
 
47939
48151
  // src/commands/watch/markBuildPending.ts
47940
- import { writeFileSync as writeFileSync54 } from "fs";
48152
+ import { writeFileSync as writeFileSync55 } from "fs";
47941
48153
  function markBuildPending() {
47942
48154
  try {
47943
- writeFileSync54(buildPendingPath(), "");
48155
+ writeFileSync55(buildPendingPath(), "");
47944
48156
  } catch {
47945
48157
  }
47946
48158
  }
47947
48159
 
47948
48160
  // src/commands/watch/markSyncPending.ts
47949
- import { writeFileSync as writeFileSync55 } from "fs";
48161
+ import { writeFileSync as writeFileSync56 } from "fs";
47950
48162
  function writePendingMarker() {
47951
48163
  try {
47952
- writeFileSync55(syncPendingPath(), "");
48164
+ writeFileSync56(syncPendingPath(), "");
47953
48165
  } catch {
47954
48166
  }
47955
48167
  }
@@ -48269,10 +48481,10 @@ function registerWatchWait(watchCommand) {
48269
48481
  }
48270
48482
 
48271
48483
  // src/commands/watch/simulateDivergence.ts
48272
- import { writeFileSync as writeFileSync56 } from "fs";
48484
+ import { writeFileSync as writeFileSync57 } from "fs";
48273
48485
  function simulateDivergence() {
48274
48486
  try {
48275
- writeFileSync56(simulatedDivergencePath(), "");
48487
+ writeFileSync57(simulatedDivergencePath(), "");
48276
48488
  console.log(
48277
48489
  `the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
48278
48490
  );
@@ -48366,8 +48578,8 @@ function registerWatch(program) {
48366
48578
 
48367
48579
  // src/commands/roam/postRoamActivity.ts
48368
48580
  import { execFileSync as execFileSync31 } from "child_process";
48369
- import { readdirSync as readdirSync26, readFileSync as readFileSync72, statSync as statSync14 } from "fs";
48370
- import { join as join108 } from "path";
48581
+ import { readdirSync as readdirSync26, readFileSync as readFileSync73, statSync as statSync14 } from "fs";
48582
+ import { join as join109 } from "path";
48371
48583
  function findPortFile(roamDir) {
48372
48584
  let entries;
48373
48585
  try {
@@ -48376,7 +48588,7 @@ function findPortFile(roamDir) {
48376
48588
  return void 0;
48377
48589
  }
48378
48590
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
48379
- const path109 = join108(roamDir, name);
48591
+ const path109 = join109(roamDir, name);
48380
48592
  try {
48381
48593
  return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
48382
48594
  } catch {
@@ -48393,11 +48605,11 @@ var PID_BY_APP = {
48393
48605
  function postRoamActivity(app, event) {
48394
48606
  const appData = process.env.APPDATA;
48395
48607
  if (!appData) return;
48396
- const portFile = findPortFile(join108(appData, "Roam"));
48608
+ const portFile = findPortFile(join109(appData, "Roam"));
48397
48609
  if (!portFile) return;
48398
48610
  let port;
48399
48611
  try {
48400
- port = readFileSync72(portFile, "utf8").trim();
48612
+ port = readFileSync73(portFile, "utf8").trim();
48401
48613
  } catch {
48402
48614
  return;
48403
48615
  }
@@ -48576,8 +48788,8 @@ function link2() {
48576
48788
  }
48577
48789
 
48578
48790
  // src/commands/run/add.ts
48579
- import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync57 } from "fs";
48580
- import { dirname as dirname46 } from "path";
48791
+ import { mkdirSync as mkdirSync40, writeFileSync as writeFileSync58 } from "fs";
48792
+ import { dirname as dirname47 } from "path";
48581
48793
 
48582
48794
  // src/commands/run/editRepoRunList.ts
48583
48795
  async function editRepoRunList(repoName, cwd, edit2) {
@@ -48736,11 +48948,11 @@ function requireParsedArgs() {
48736
48948
  }
48737
48949
 
48738
48950
  // src/commands/run/runCommandFilePath.ts
48739
- import { join as join109 } from "path";
48951
+ import { join as join110 } from "path";
48740
48952
  function runCommandFilePath(name) {
48741
48953
  const segments = name.split(":");
48742
48954
  const file = `${segments.pop()}.md`;
48743
- return join109(".claude", "commands", ...segments, file);
48955
+ return join110(".claude", "commands", ...segments, file);
48744
48956
  }
48745
48957
 
48746
48958
  // src/commands/run/add.ts
@@ -48757,14 +48969,14 @@ function saveProjectRunConfig(entry) {
48757
48969
  }
48758
48970
  function createCommandFile(name) {
48759
48971
  const filePath = runCommandFilePath(name);
48760
- mkdirSync39(dirname46(filePath), { recursive: true });
48972
+ mkdirSync40(dirname47(filePath), { recursive: true });
48761
48973
  const content = `---
48762
48974
  description: Run ${name}
48763
48975
  ---
48764
48976
 
48765
48977
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
48766
48978
  `;
48767
- writeFileSync57(filePath, content);
48979
+ writeFileSync58(filePath, content);
48768
48980
  console.log(`Created command file: ${filePath}`);
48769
48981
  }
48770
48982
  async function add4() {
@@ -48869,7 +49081,7 @@ function registerRunAdd(runCommand) {
48869
49081
 
48870
49082
  // src/commands/run/remove.ts
48871
49083
  import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
48872
- import { dirname as dirname47, join as join110 } from "path";
49084
+ import { dirname as dirname48, join as join111 } from "path";
48873
49085
 
48874
49086
  // src/commands/run/removeRepoRunConfig.ts
48875
49087
  function isNamed(entry, name) {
@@ -48887,15 +49099,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
48887
49099
 
48888
49100
  // src/commands/run/remove.ts
48889
49101
  function removeEmptyNamespaceDirs(filePath) {
48890
- const root2 = join110(".claude", "commands");
48891
- for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
49102
+ const root2 = join111(".claude", "commands");
49103
+ for (let dir = dirname48(filePath); dir !== root2; dir = dirname48(dir)) {
48892
49104
  if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
48893
49105
  rmdirSync(dir);
48894
49106
  }
48895
49107
  }
48896
49108
  function deleteCommandFile(name) {
48897
49109
  const filePath = runCommandFilePath(name);
48898
- const legacyPath = join110(".claude", "commands", `${name}.md`);
49110
+ const legacyPath = join111(".claude", "commands", `${name}.md`);
48899
49111
  for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
48900
49112
  if (existsSync90(path109)) {
48901
49113
  unlinkSync20(path109);
@@ -49018,11 +49230,11 @@ function applyLine(result, pending, line) {
49018
49230
  }
49019
49231
 
49020
49232
  // src/commands/sessions/daemon/readDaemonPidFile.ts
49021
- import { readFileSync as readFileSync73 } from "fs";
49233
+ import { readFileSync as readFileSync74 } from "fs";
49022
49234
  function readDaemonPidFile() {
49023
49235
  try {
49024
49236
  const pid = Number.parseInt(
49025
- readFileSync73(daemonPaths.pid, "utf8").trim(),
49237
+ readFileSync74(daemonPaths.pid, "utf8").trim(),
49026
49238
  10
49027
49239
  );
49028
49240
  return Number.isInteger(pid) ? pid : void 0;
@@ -49179,7 +49391,7 @@ function requestDrain(socket, lines2) {
49179
49391
  }
49180
49392
 
49181
49393
  // src/commands/sessions/daemon/runDaemon.ts
49182
- import { mkdirSync as mkdirSync44 } from "fs";
49394
+ import { mkdirSync as mkdirSync45 } from "fs";
49183
49395
 
49184
49396
  // src/commands/sessions/daemon/broadcast.ts
49185
49397
  function sendTo(client, msg) {
@@ -49702,7 +49914,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
49702
49914
 
49703
49915
  // src/commands/sessions/daemon/findServerParents.ts
49704
49916
  import { existsSync as existsSync92 } from "fs";
49705
- import { join as join111, resolve as resolve32 } from "path";
49917
+ import { join as join112, resolve as resolve32 } from "path";
49706
49918
  function isLive(session) {
49707
49919
  return !!session.pty && session.status !== "done" && session.status !== "error";
49708
49920
  }
@@ -49711,7 +49923,7 @@ function isLiveAgent(session) {
49711
49923
  }
49712
49924
  function serverRunDirs(sessions, file) {
49713
49925
  return new Set(
49714
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join111(dir, file)))
49926
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join112(dir, file)))
49715
49927
  );
49716
49928
  }
49717
49929
  function findServerParents(sessions, file) {
@@ -49725,8 +49937,8 @@ import { readFile as readFile9 } from "fs/promises";
49725
49937
  function normalise2(path109) {
49726
49938
  return path109.replaceAll("\\", "/");
49727
49939
  }
49728
- function latest(current, at2) {
49729
- return current === void 0 || at2 > current ? at2 : current;
49940
+ function latest(current2, at2) {
49941
+ return current2 === void 0 || at2 > current2 ? at2 : current2;
49730
49942
  }
49731
49943
  async function lastWriteTimes(transcriptPath2, target) {
49732
49944
  const text20 = await readFile9(transcriptPath2, "utf8").catch(() => "");
@@ -49865,7 +50077,7 @@ function sendResizeSnapshot(s, send) {
49865
50077
  }
49866
50078
 
49867
50079
  // src/commands/sessions/daemon/viewerSize.ts
49868
- import { readFileSync as readFileSync74, writeFileSync as writeFileSync58 } from "fs";
50080
+ import { readFileSync as readFileSync75, writeFileSync as writeFileSync59 } from "fs";
49869
50081
  var DEFAULT_SIZE = { cols: 120, rows: 30 };
49870
50082
  var remembered;
49871
50083
  function rememberViewerSize(cols, rows) {
@@ -49873,7 +50085,7 @@ function rememberViewerSize(cols, rows) {
49873
50085
  if (remembered?.cols === cols && remembered.rows === rows) return;
49874
50086
  remembered = { cols, rows };
49875
50087
  try {
49876
- writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
50088
+ writeFileSync59(daemonPaths.viewerSize, JSON.stringify(remembered));
49877
50089
  } catch (error) {
49878
50090
  daemonLog(
49879
50091
  `viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
@@ -49887,7 +50099,7 @@ function viewerSize() {
49887
50099
  function readSavedSize() {
49888
50100
  try {
49889
50101
  const { cols, rows } = JSON.parse(
49890
- readFileSync74(daemonPaths.viewerSize, "utf8")
50102
+ readFileSync75(daemonPaths.viewerSize, "utf8")
49891
50103
  );
49892
50104
  if (typeof cols === "number" && typeof rows === "number" && cols > 0)
49893
50105
  return { cols, rows };
@@ -50618,13 +50830,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
50618
50830
  }
50619
50831
 
50620
50832
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
50621
- import { existsSync as existsSync95, rmSync as rmSync15, writeFileSync as writeFileSync59 } from "fs";
50833
+ import { existsSync as existsSync95, rmSync as rmSync15, writeFileSync as writeFileSync60 } from "fs";
50622
50834
  var paused;
50623
50835
  var wake;
50624
50836
  var holdReleased = false;
50625
50837
  function persist2(value) {
50626
50838
  try {
50627
- if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
50839
+ if (value) writeFileSync60(daemonPaths.autoUpdatePaused, "");
50628
50840
  else rmSync15(daemonPaths.autoUpdatePaused, { force: true });
50629
50841
  } catch {
50630
50842
  }
@@ -50765,29 +50977,29 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
50765
50977
  }
50766
50978
 
50767
50979
  // src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
50768
- import { readFileSync as readFileSync75, writeFileSync as writeFileSync60 } from "fs";
50980
+ import { readFileSync as readFileSync76, writeFileSync as writeFileSync61 } from "fs";
50769
50981
  var KEEP_TAIL = 256 * 1024;
50770
50982
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
50771
50983
  function trimWatcherLog(cwd) {
50772
50984
  const path109 = watcherLogPath(cwd);
50773
50985
  let log2;
50774
50986
  try {
50775
- log2 = readFileSync75(path109, "utf8");
50987
+ log2 = readFileSync76(path109, "utf8");
50776
50988
  } catch {
50777
50989
  return;
50778
50990
  }
50779
50991
  if (log2.length <= MAX_LOG_SIZE) return;
50780
- writeFileSync60(path109, log2.slice(-KEEP_TAIL));
50992
+ writeFileSync61(path109, log2.slice(-KEEP_TAIL));
50781
50993
  daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
50782
50994
  }
50783
50995
 
50784
50996
  // src/commands/sessions/daemon/worktree/appendWatcherLog.ts
50785
- import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync40 } from "fs";
50786
- import { dirname as dirname49 } from "path";
50997
+ import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync41 } from "fs";
50998
+ import { dirname as dirname50 } from "path";
50787
50999
  function appendWatcherLog(cwd, data) {
50788
51000
  try {
50789
51001
  const path109 = watcherLogPath(cwd);
50790
- mkdirSync40(dirname49(path109), { recursive: true });
51002
+ mkdirSync41(dirname50(path109), { recursive: true });
50791
51003
  appendFileSync5(path109, data);
50792
51004
  } catch {
50793
51005
  }
@@ -50864,9 +51076,9 @@ import { existsSync as existsSync97 } from "fs";
50864
51076
 
50865
51077
  // src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
50866
51078
  import { existsSync as existsSync96 } from "fs";
50867
- import { join as join113 } from "path";
51079
+ import { join as join114 } from "path";
50868
51080
  function holdsNoCheckout(path109) {
50869
- return existsSync96(path109) && !existsSync96(join113(path109, ".git"));
51081
+ return existsSync96(path109) && !existsSync96(join114(path109, ".git"));
50870
51082
  }
50871
51083
 
50872
51084
  // src/commands/sessions/daemon/worktree/treeDurability.ts
@@ -51133,7 +51345,7 @@ function startAutoUpdate(ctx) {
51133
51345
  stayOff(`${installDir} is not a git clone`);
51134
51346
  return;
51135
51347
  }
51136
- autoUpdateState.setStartCommit(headCommit4(installDir));
51348
+ autoUpdateState.setStartCommit(headCommit2(installDir));
51137
51349
  if (!autoUpdateEnabled(installDir)) {
51138
51350
  stayOff("autoUpdate.enabled is false");
51139
51351
  return;
@@ -51200,12 +51412,12 @@ import { basename as basename32 } from "path";
51200
51412
 
51201
51413
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
51202
51414
  import { existsSync as existsSync98 } from "fs";
51203
- import { join as join115 } from "path";
51415
+ import { join as join116 } from "path";
51204
51416
 
51205
51417
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
51206
51418
  import { statSync as statSync16 } from "fs";
51207
51419
  import { rm as rm3 } from "fs/promises";
51208
- import { join as join114 } from "path";
51420
+ import { join as join115 } from "path";
51209
51421
  async function deleteTreeDirectly(clone, worktreePath, why) {
51210
51422
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
51211
51423
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -51234,7 +51446,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
51234
51446
  return { removed: true };
51235
51447
  }
51236
51448
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
51237
- return statSync16(join114(worktreePath, ".git"), {
51449
+ return statSync16(join115(worktreePath, ".git"), {
51238
51450
  throwIfNoEntry: false
51239
51451
  })?.isDirectory() === true;
51240
51452
  }
@@ -51275,7 +51487,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
51275
51487
  );
51276
51488
  }
51277
51489
  function strandedReason(worktreePath, cause) {
51278
- if (!existsSync98(join115(worktreePath, ".git")))
51490
+ if (!existsSync98(join116(worktreePath, ".git")))
51279
51491
  return "its .git link is already gone";
51280
51492
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
51281
51493
  return "git no longer recognises it as a working tree";
@@ -51362,8 +51574,8 @@ function owningClone(worktreePath) {
51362
51574
  }
51363
51575
  async function deleteWorktreeBranch(clone, branch2) {
51364
51576
  if (!listLocalBranches(clone).includes(branch2)) return;
51365
- const current = await gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
51366
- if (branch2 === current) return;
51577
+ const current2 = await gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
51578
+ if (branch2 === current2) return;
51367
51579
  try {
51368
51580
  await git2(clone, ["branch", "-D", branch2]);
51369
51581
  daemonLog(`worktree branch ${branch2} deleted from clone ${clone}`);
@@ -51595,7 +51807,7 @@ function pidList(pids) {
51595
51807
  }
51596
51808
 
51597
51809
  // src/commands/sessions/daemon/worktree/readOccupant.ts
51598
- import { readFileSync as readFileSync76 } from "fs";
51810
+ import { readFileSync as readFileSync77 } from "fs";
51599
51811
  var VSCODE_PATHS = [
51600
51812
  "/.vscode-server/",
51601
51813
  "/.vscode-server-insiders/",
@@ -51613,12 +51825,12 @@ function readOccupant(pid, procRoot = "/proc") {
51613
51825
  };
51614
51826
  }
51615
51827
  function underVsCode(pid, procRoot) {
51616
- let current = pid;
51617
- for (let depth = 0; current && current > 1 && depth < MAX_ANCESTORS; depth++) {
51618
- const cmdline = readProc(procRoot, current, "cmdline");
51828
+ let current2 = pid;
51829
+ for (let depth = 0; current2 && current2 > 1 && depth < MAX_ANCESTORS; depth++) {
51830
+ const cmdline = readProc(procRoot, current2, "cmdline");
51619
51831
  if (cmdline && VSCODE_PATHS.some((path109) => cmdline.includes(path109)))
51620
51832
  return true;
51621
- current = parentPid(readProc(procRoot, current, "stat"));
51833
+ current2 = parentPid(readProc(procRoot, current2, "stat"));
51622
51834
  }
51623
51835
  return false;
51624
51836
  }
@@ -51630,7 +51842,7 @@ function parentPid(stat5) {
51630
51842
  }
51631
51843
  function readProc(procRoot, pid, file) {
51632
51844
  try {
51633
- return readFileSync76(`${procRoot}/${pid}/${file}`, "utf8");
51845
+ return readFileSync77(`${procRoot}/${pid}/${file}`, "utf8");
51634
51846
  } catch {
51635
51847
  return void 0;
51636
51848
  }
@@ -52460,8 +52672,8 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
52460
52672
  }
52461
52673
 
52462
52674
  // src/commands/sessions/daemon/watchActivity.ts
52463
- import { existsSync as existsSync102, mkdirSync as mkdirSync41, watch as watch2 } from "fs";
52464
- import { dirname as dirname50 } from "path";
52675
+ import { existsSync as existsSync102, mkdirSync as mkdirSync42, watch as watch2 } from "fs";
52676
+ import { dirname as dirname51 } from "path";
52465
52677
 
52466
52678
  // src/commands/sessions/daemon/applyActivityToSession.ts
52467
52679
  function applyActivityToSession(session, activity2) {
@@ -52522,15 +52734,15 @@ var DEBOUNCE_MS2 = 50;
52522
52734
  function watchActivity(session, notify2, onClaudeSessionId) {
52523
52735
  if (session.commandType !== "assist" || !session.cwd) return;
52524
52736
  const path109 = activityPath(session.id);
52525
- const dir = dirname50(path109);
52737
+ const dir = dirname51(path109);
52526
52738
  try {
52527
- mkdirSync41(dir, { recursive: true });
52739
+ mkdirSync42(dir, { recursive: true });
52528
52740
  } catch {
52529
52741
  return;
52530
52742
  }
52531
52743
  reconcileActivity(session.id, session.activity);
52532
52744
  let timer = null;
52533
- const read3 = () => {
52745
+ const read4 = () => {
52534
52746
  timer = null;
52535
52747
  const activity2 = readActivity(path109);
52536
52748
  if (!activity2) return;
@@ -52543,9 +52755,9 @@ function watchActivity(session, notify2, onClaudeSessionId) {
52543
52755
  session.activityWatcher = watch2(dir, (_event, filename) => {
52544
52756
  if (filename && !path109.endsWith(filename)) return;
52545
52757
  if (timer) clearTimeout(timer);
52546
- timer = setTimeout(read3, DEBOUNCE_MS2);
52758
+ timer = setTimeout(read4, DEBOUNCE_MS2);
52547
52759
  });
52548
- if (existsSync102(path109)) read3();
52760
+ if (existsSync102(path109)) read4();
52549
52761
  }
52550
52762
  function refreshActivity(session) {
52551
52763
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -52689,10 +52901,10 @@ function bindCodexSession(session, notify2) {
52689
52901
  import { watch as watch3 } from "fs";
52690
52902
 
52691
52903
  // src/commands/sessions/daemon/ensureProjectDirExists.ts
52692
- import { mkdirSync as mkdirSync42 } from "fs";
52904
+ import { mkdirSync as mkdirSync43 } from "fs";
52693
52905
  function ensureProjectDirExists(dir, sessionId2) {
52694
52906
  try {
52695
- mkdirSync42(dir, { recursive: true });
52907
+ mkdirSync43(dir, { recursive: true });
52696
52908
  return true;
52697
52909
  } catch (error) {
52698
52910
  daemonLog(
@@ -53529,7 +53741,7 @@ function settleTransfer(client, deps2, s, outcome, traceId) {
53529
53741
  }
53530
53742
 
53531
53743
  // src/commands/sessions/daemon/transfer/handOffToTarget.ts
53532
- async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot }) {
53744
+ async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot: snapshot2 }) {
53533
53745
  const outcome = await launchOnTarget(deps2.links, {
53534
53746
  type: "create-assist",
53535
53747
  assistArgs: args,
@@ -53538,7 +53750,7 @@ async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, s
53538
53750
  title: s.title,
53539
53751
  subtitle: s.subtitle,
53540
53752
  traceId,
53541
- transfer: snapshot
53753
+ transfer: snapshot2
53542
53754
  });
53543
53755
  settleTransfer(client, deps2, s, outcome, traceId);
53544
53756
  }
@@ -53643,11 +53855,11 @@ async function pushTransferSnapshot(path109, itemId2, treeRoot) {
53643
53855
  async function snapshotTree(s, args, traceId) {
53644
53856
  const path109 = s.worktree?.path ?? s.cwd;
53645
53857
  if (!path109) return void 0;
53646
- const snapshot = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
53858
+ const snapshot2 = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
53647
53859
  daemonLog(
53648
- `session ${s.id} pushed ${path109} to ${snapshot.ref} (branch=${snapshot.branch ?? "tree"} upstream=${snapshot.upstream ?? "none"}) trace=${traceId}`
53860
+ `session ${s.id} pushed ${path109} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
53649
53861
  );
53650
- return snapshot;
53862
+ return snapshot2;
53651
53863
  }
53652
53864
 
53653
53865
  // src/commands/sessions/daemon/transfer/snapshotOrFail.ts
@@ -55640,9 +55852,9 @@ function logUnrecognisedType(seen, prefix2, type) {
55640
55852
 
55641
55853
  // src/commands/sessions/daemon/links/relayLinkSessions.ts
55642
55854
  function relayLinkSessions(state, msg) {
55643
- const snapshot = JSON.stringify(msg.sessions ?? []);
55644
- if (snapshot === state.lastSnapshot) return;
55645
- state.lastSnapshot = snapshot;
55855
+ const snapshot2 = JSON.stringify(msg.sessions ?? []);
55856
+ if (snapshot2 === state.lastSnapshot) return;
55857
+ state.lastSnapshot = snapshot2;
55646
55858
  const ns = (id) => toNodeSessionId(state.node, id);
55647
55859
  state.sessions = (msg.sessions ?? []).map((s) => ({
55648
55860
  ...s,
@@ -56245,8 +56457,8 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
56245
56457
  import { existsSync as existsSync106 } from "fs";
56246
56458
 
56247
56459
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
56248
- import { copyFileSync as copyFileSync4, existsSync as existsSync105, mkdirSync as mkdirSync43 } from "fs";
56249
- import { join as join116 } from "path";
56460
+ import { copyFileSync as copyFileSync4, existsSync as existsSync105, mkdirSync as mkdirSync44 } from "fs";
56461
+ import { join as join117 } from "path";
56250
56462
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56251
56463
  const dir = projectDirForCwd(toCwd);
56252
56464
  if (dir === projectDirForCwd(fromCwd)) {
@@ -56255,7 +56467,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56255
56467
  );
56256
56468
  return;
56257
56469
  }
56258
- const dest = join116(dir, `${claudeSessionId}.jsonl`);
56470
+ const dest = join117(dir, `${claudeSessionId}.jsonl`);
56259
56471
  if (existsSync105(dest)) {
56260
56472
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
56261
56473
  return;
@@ -56268,7 +56480,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56268
56480
  return;
56269
56481
  }
56270
56482
  try {
56271
- mkdirSync43(dir, { recursive: true });
56483
+ mkdirSync44(dir, { recursive: true });
56272
56484
  copyFileSync4(source, dest);
56273
56485
  daemonLog(
56274
56486
  `transcript ${source} copied to ${dest} so ${toCwd} can resume it`
@@ -56573,10 +56785,10 @@ function autoUpdateReply() {
56573
56785
  }
56574
56786
 
56575
56787
  // src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
56576
- import { rmSync as rmSync17, writeFileSync as writeFileSync61 } from "fs";
56788
+ import { rmSync as rmSync17, writeFileSync as writeFileSync62 } from "fs";
56577
56789
  function signalLap(installDir, marker2) {
56578
56790
  const control = watchControlPaths(installDir);
56579
- if (control) writeFileSync61(control[marker2], "");
56791
+ if (control) writeFileSync62(control[marker2], "");
56580
56792
  }
56581
56793
  function applyAutoUpdateAction(action) {
56582
56794
  const installDir = getInstallDir();
@@ -56645,6 +56857,12 @@ var handleHelloRequest = (client, m, d) => {
56645
56857
  m.replayLocal(client);
56646
56858
  };
56647
56859
 
56860
+ // src/commands/sessions/daemon/handleWebLog.ts
56861
+ var handleWebLog = (client, _m, d) => {
56862
+ daemonLog(`web: ${String(d.message)}`);
56863
+ sendTo(client, { type: "web-logged" });
56864
+ };
56865
+
56648
56866
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
56649
56867
  import * as fs55 from "fs";
56650
56868
  import * as readline5 from "readline";
@@ -57497,8 +57715,8 @@ async function confirmTransferredRun(sessions, id, trace) {
57497
57715
 
57498
57716
  // src/commands/sessions/daemon/transfer/restoreTransferSnapshot.ts
57499
57717
  var FETCH_TIMEOUT_MS2 = 12e4;
57500
- async function switchToSnapshot(path109, snapshot, sha) {
57501
- const { branch: branch2 } = snapshot;
57718
+ async function switchToSnapshot(path109, snapshot2, sha) {
57719
+ const { branch: branch2 } = snapshot2;
57502
57720
  if (!branch2 || branch2 === await remoteDefaultBranch(path109)) {
57503
57721
  await git2(path109, ["reset", "--hard", "--quiet", sha]);
57504
57722
  return await gitOrNull(path109, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
@@ -57517,33 +57735,33 @@ async function trackUpstream(path109, upstream) {
57517
57735
  `transfer restore ${path109}: could not track origin/${upstream}: ${tracked.error}`
57518
57736
  );
57519
57737
  }
57520
- async function restoreTransferSnapshot(path109, snapshot) {
57738
+ async function restoreTransferSnapshot(path109, snapshot2) {
57521
57739
  if (await gitOrNull(path109, ["status", "--porcelain"]))
57522
57740
  throw new Error(`${path109} has uncommitted changes`);
57523
57741
  await git2(
57524
57742
  path109,
57525
- ["fetch", "--quiet", "origin", `refs/heads/${snapshot.ref}`],
57743
+ ["fetch", "--quiet", "origin", `refs/heads/${snapshot2.ref}`],
57526
57744
  FETCH_TIMEOUT_MS2
57527
57745
  );
57528
57746
  const sha = (await git2(path109, ["rev-parse", "FETCH_HEAD"])).trim();
57529
- const branch2 = await switchToSnapshot(path109, snapshot, sha);
57747
+ const branch2 = await switchToSnapshot(path109, snapshot2, sha);
57530
57748
  await git2(path109, ["reset", "--soft", "--quiet", "HEAD~1"]);
57531
- if (snapshot.upstream) await trackUpstream(path109, snapshot.upstream);
57749
+ if (snapshot2.upstream) await trackUpstream(path109, snapshot2.upstream);
57532
57750
  daemonLog(
57533
- `transfer restore ${path109}: ${snapshot.ref} restored onto ${branch2}${snapshot.upstream ? ` tracking origin/${snapshot.upstream}` : ""}`
57751
+ `transfer restore ${path109}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
57534
57752
  );
57535
57753
  const deleted = await gitResult(
57536
57754
  path109,
57537
- ["push", "--no-verify", "--quiet", "origin", "--delete", snapshot.ref],
57755
+ ["push", "--no-verify", "--quiet", "origin", "--delete", snapshot2.ref],
57538
57756
  FETCH_TIMEOUT_MS2
57539
57757
  );
57540
57758
  daemonLog(
57541
- deleted.ok ? `transfer restore ${path109}: deleted ${snapshot.ref} from origin` : `transfer restore ${path109}: could not delete ${snapshot.ref} from origin: ${deleted.error}`
57759
+ deleted.ok ? `transfer restore ${path109}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path109}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
57542
57760
  );
57543
57761
  }
57544
57762
 
57545
57763
  // src/commands/sessions/daemon/transfer/spawnTransferredRun.ts
57546
- async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot, traceId }, context) {
57764
+ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot: snapshot2, traceId }, context) {
57547
57765
  const trace = `trace=${traceId ?? "none"}`;
57548
57766
  const { id, prepared } = allocatePreparedAndBind(
57549
57767
  ctx,
@@ -57551,8 +57769,8 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
57551
57769
  (sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
57552
57770
  async (path109) => {
57553
57771
  if (!path109) throw new Error("no working tree to restore into");
57554
- daemonLog(`transfer restore ${path109}: fetching ${snapshot.ref} ${trace}`);
57555
- await restoreTransferSnapshot(path109, snapshot);
57772
+ daemonLog(`transfer restore ${path109}: fetching ${snapshot2.ref} ${trace}`);
57773
+ await restoreTransferSnapshot(path109, snapshot2);
57556
57774
  },
57557
57775
  { inPlace: meta.inPlace },
57558
57776
  context
@@ -57562,7 +57780,7 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
57562
57780
  } catch (error) {
57563
57781
  const reason4 = error instanceof Error ? error.message : String(error);
57564
57782
  daemonLog(
57565
- `session ${id} transfer restore failed ${trace}: ${reason4}; run not started, ${snapshot.ref} left on origin`
57783
+ `session ${id} transfer restore failed ${trace}: ${reason4}; run not started, ${snapshot2.ref} left on origin`
57566
57784
  );
57567
57785
  discard(id);
57568
57786
  throw new Error(`restore failed: ${reason4}`);
@@ -57627,8 +57845,8 @@ function spawnAssistCreate(m, d) {
57627
57845
  subtitle: d.subtitle,
57628
57846
  ...d.autoApprove === true && { autoApprove: true }
57629
57847
  };
57630
- const snapshot = parseTransferSnapshot(d.transfer);
57631
- if (snapshot)
57848
+ const snapshot2 = parseTransferSnapshot(d.transfer);
57849
+ if (snapshot2)
57632
57850
  return spawnTransferredRun(
57633
57851
  m.treeCtx(),
57634
57852
  m.discardSession,
@@ -57636,7 +57854,7 @@ function spawnAssistCreate(m, d) {
57636
57854
  assistArgs,
57637
57855
  cwd,
57638
57856
  meta: { ...meta, inPlace },
57639
- snapshot,
57857
+ snapshot: snapshot2,
57640
57858
  traceId: d.traceId
57641
57859
  },
57642
57860
  spawnContextFrom(d)
@@ -57710,6 +57928,7 @@ var handleCancelTransfer = routed((_client, m, d) => {
57710
57928
  var messageHandlers = {
57711
57929
  ping: (client) => sendTo(client, { type: "pong", pid: process.pid }),
57712
57930
  "subscribe-logs": (client, m, d) => m.clients.subscribeLogs(client, d.replay !== false),
57931
+ "web-log": handleWebLog,
57713
57932
  hello: handleHelloRequest,
57714
57933
  output: handleOutputRequest,
57715
57934
  nodes: (client, m) => m.links.sendNodes(client),
@@ -57827,10 +58046,10 @@ function handleConnection(socket, manager) {
57827
58046
  }
57828
58047
 
57829
58048
  // src/commands/sessions/daemon/onListening.ts
57830
- import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
58049
+ import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync63 } from "fs";
57831
58050
 
57832
58051
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
57833
- import { readFileSync as readFileSync77 } from "fs";
58052
+ import { readFileSync as readFileSync78 } from "fs";
57834
58053
  var WATCHDOG_INTERVAL_MS = 5e3;
57835
58054
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
57836
58055
  const timer = setInterval(() => {
@@ -57841,7 +58060,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
57841
58060
  }
57842
58061
  function ownsPidFile() {
57843
58062
  try {
57844
- return readFileSync77(daemonPaths.pid, "utf8").trim() === String(process.pid);
58063
+ return readFileSync78(daemonPaths.pid, "utf8").trim() === String(process.pid);
57845
58064
  } catch {
57846
58065
  return false;
57847
58066
  }
@@ -57849,7 +58068,7 @@ function ownsPidFile() {
57849
58068
 
57850
58069
  // src/commands/sessions/daemon/onListening.ts
57851
58070
  function onListening(manager, checkAutoExit) {
57852
- writeFileSync62(daemonPaths.pid, String(process.pid));
58071
+ writeFileSync63(daemonPaths.pid, String(process.pid));
57853
58072
  startPidFileWatchdog(() => {
57854
58073
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
57855
58074
  void manager.flushActiveMs().finally(() => {
@@ -57938,7 +58157,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
57938
58157
 
57939
58158
  // src/commands/sessions/daemon/runDaemon.ts
57940
58159
  async function runDaemon() {
57941
- mkdirSync44(daemonPaths.dir, { recursive: true });
58160
+ mkdirSync45(daemonPaths.dir, { recursive: true });
57942
58161
  daemonLog(
57943
58162
  `starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
57944
58163
  );