@staff0rd/assist 0.1063.0 → 0.1064.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.0",
9
+ version: "0.1064.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -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),
@@ -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
 
@@ -12990,8 +12996,82 @@ function unsetConfig(req, res) {
12990
12996
  });
12991
12997
  }
12992
12998
 
12999
+ // src/commands/extension/extensionUpdateStatus.ts
13000
+ import semver from "semver";
13001
+ function extensionUpdateStatus(connected, latest2) {
13002
+ const behind = Boolean(
13003
+ connected && latest2 && semver.valid(connected) && semver.valid(latest2.version) && semver.gt(latest2.version, connected)
13004
+ );
13005
+ return {
13006
+ connected,
13007
+ latest: latest2?.version,
13008
+ updateLink: behind ? latest2?.update_link : void 0,
13009
+ installLink: latest2?.update_link,
13010
+ behind
13011
+ };
13012
+ }
13013
+
13014
+ // src/commands/sessions/web/updates/autoRestartEnabled.ts
13015
+ function autoRestartEnabled(installDir) {
13016
+ try {
13017
+ return loadConfigFrom(installDir).autoUpdate?.restart ?? false;
13018
+ } catch {
13019
+ return false;
13020
+ }
13021
+ }
13022
+
13023
+ // src/commands/extension/fetchLatestSignedExtension.ts
13024
+ import { readFile as readFile2 } from "fs/promises";
13025
+ import { join as join28 } from "path";
13026
+
13027
+ // src/commands/extension/extensionDir.ts
13028
+ import { existsSync as existsSync24 } from "fs";
13029
+ import { dirname as dirname13, join as join27 } from "path";
13030
+ import { fileURLToPath as fileURLToPath2 } from "url";
13031
+ var moduleDir = dirname13(fileURLToPath2(import.meta.url));
13032
+ function extensionDir() {
13033
+ const bundled = join27(moduleDir, "commands", "extension", "extension");
13034
+ if (existsSync24(bundled)) return bundled;
13035
+ return join27(moduleDir, "..", "..", "..", "extension");
13036
+ }
13037
+
13038
+ // src/commands/extension/latestUpdate.ts
13039
+ function latestUpdate(manifest, updates2) {
13040
+ const { id } = JSON.parse(manifest).browser_specific_settings.gecko;
13041
+ return JSON.parse(updates2).addons[id]?.updates.at(-1);
13042
+ }
13043
+
13044
+ // src/commands/extension/fetchLatestSignedExtension.ts
13045
+ async function fetchLatestSignedExtension() {
13046
+ const manifest = await readFile2(
13047
+ join28(extensionDir(), "manifest.json"),
13048
+ "utf8"
13049
+ );
13050
+ const updateUrl = JSON.parse(manifest).browser_specific_settings.gecko.update_url;
13051
+ const response = await fetch(updateUrl, {
13052
+ signal: AbortSignal.timeout(1e4)
13053
+ });
13054
+ if (!response.ok) return { updateUrl };
13055
+ return { updateUrl, latest: latestUpdate(manifest, await response.text()) };
13056
+ }
13057
+
13058
+ // src/commands/sessions/web/updates/latestSignedExtension.ts
13059
+ var CACHE_MS = 6e4;
13060
+ var cached = {
13061
+ at: Number.NEGATIVE_INFINITY,
13062
+ value: Promise.resolve(void 0)
13063
+ };
13064
+ function latestSignedExtension(now = Date.now()) {
13065
+ if (now - cached.at < CACHE_MS) return cached.value;
13066
+ cached = {
13067
+ at: now,
13068
+ value: fetchLatestSignedExtension().then(({ latest: latest2 }) => latest2).catch(() => void 0)
13069
+ };
13070
+ return cached.value;
13071
+ }
13072
+
12993
13073
  // src/commands/watch/isBuildPending.ts
12994
- import { existsSync as existsSync25 } from "fs";
13074
+ import { existsSync as existsSync26 } from "fs";
12995
13075
 
12996
13076
  // src/commands/watch/gitMarkerPath.ts
12997
13077
  import { resolve as resolve11 } from "path";
@@ -13051,7 +13131,7 @@ function buildPendingPath(cwd) {
13051
13131
  }
13052
13132
 
13053
13133
  // src/commands/watch/readBuiltVersion.ts
13054
- import { join as join28 } from "path";
13134
+ import { join as join30 } from "path";
13055
13135
 
13056
13136
  // src/shared/readPackageJson.ts
13057
13137
  import * as fs8 from "fs";
@@ -13101,7 +13181,7 @@ function findPackageJsonWithVerifyScripts(startDir) {
13101
13181
  function readBuiltVersion(cwd) {
13102
13182
  try {
13103
13183
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
13104
- return readPackageJson(join28(root2, "package.json")).version ?? "unknown";
13184
+ return readPackageJson(join30(root2, "package.json")).version ?? "unknown";
13105
13185
  } catch {
13106
13186
  return "unknown";
13107
13187
  }
@@ -13109,11 +13189,11 @@ function readBuiltVersion(cwd) {
13109
13189
 
13110
13190
  // src/commands/watch/readDistVersion.ts
13111
13191
  import { readFileSync as readFileSync10 } from "fs";
13112
- import { join as join29 } from "path";
13192
+ import { join as join31 } from "path";
13113
13193
  function readDistVersion(cwd) {
13114
13194
  try {
13115
13195
  const root2 = runGit3(["rev-parse", "--show-toplevel"], cwd);
13116
- return readFileSync10(join29(root2, "dist", "built-version"), "utf8").trim();
13196
+ return readFileSync10(join31(root2, "dist", "built-version"), "utf8").trim();
13117
13197
  } catch {
13118
13198
  return void 0;
13119
13199
  }
@@ -13128,7 +13208,7 @@ function isDistBehind(cwd) {
13128
13208
  // src/commands/watch/isBuildPending.ts
13129
13209
  function markedPending(cwd) {
13130
13210
  try {
13131
- return existsSync25(buildPendingPath(cwd));
13211
+ return existsSync26(buildPendingPath(cwd));
13132
13212
  } catch {
13133
13213
  return false;
13134
13214
  }
@@ -13137,69 +13217,20 @@ function isBuildPending(cwd) {
13137
13217
  return markedPending(cwd) || isDistBehind(cwd);
13138
13218
  }
13139
13219
 
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()) };
13220
+ // src/commands/watch/changedPaths.ts
13221
+ function changedPaths(from, cwd) {
13222
+ return runGit3(["diff", "--name-only", `${from}..HEAD`], cwd).split("\n").filter((line) => line.length > 0);
13188
13223
  }
13189
13224
 
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)
13225
+ // src/commands/sessions/web/updates/changedSince.ts
13226
+ function changedSince(installDir) {
13227
+ return (commit2) => {
13228
+ try {
13229
+ return changedPaths(commit2, installDir);
13230
+ } catch {
13231
+ return [];
13232
+ }
13201
13233
  };
13202
- return cached.value;
13203
13234
  }
13204
13235
 
13205
13236
  // src/commands/watch/restartRules.ts
@@ -13238,6 +13269,47 @@ function pendingRestarts(input) {
13238
13269
  ];
13239
13270
  }
13240
13271
 
13272
+ // src/commands/watch/headCommit.ts
13273
+ function headCommit4(cwd) {
13274
+ try {
13275
+ return runGit3(["rev-parse", "HEAD"], cwd);
13276
+ } catch {
13277
+ return void 0;
13278
+ }
13279
+ }
13280
+
13281
+ // src/commands/sessions/web/updates/webStartCommit.ts
13282
+ var captured;
13283
+ var webStartCommit = {
13284
+ capture: () => {
13285
+ captured = headCommit4(getInstallDir());
13286
+ },
13287
+ value: () => captured
13288
+ };
13289
+
13290
+ // src/commands/sessions/web/updates/readRestartState.ts
13291
+ async function readRestartState(installDir) {
13292
+ const reply2 = await requestDaemonReply(
13293
+ { type: "auto-update" },
13294
+ "auto-update"
13295
+ );
13296
+ const built = readBuiltVersion(installDir);
13297
+ const buildPending = isBuildPending(installDir);
13298
+ return {
13299
+ reply: reply2,
13300
+ built,
13301
+ buildPending,
13302
+ restart: pendingRestarts({
13303
+ daemonVersion: reply2?.version,
13304
+ daemonStartCommit: reply2?.startCommit,
13305
+ webStartCommit: webStartCommit.value(),
13306
+ built,
13307
+ buildPending,
13308
+ changedSince: changedSince(installDir)
13309
+ })
13310
+ };
13311
+ }
13312
+
13241
13313
  // src/shared/stripAnsi.ts
13242
13314
  var ANSI = new RegExp(
13243
13315
  `${String.fromCharCode(27)}\\[[0-9;?]*[ -/]*[@-~]`,
@@ -13277,63 +13349,18 @@ function readUpdateHistory(installDir) {
13277
13349
  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
13350
  }
13279
13351
 
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
13352
  // src/commands/sessions/web/updates/updates.ts
13315
13353
  async function updates(_req, res) {
13316
13354
  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);
13355
+ const { reply: reply2, built, buildPending, restart } = await readRestartState(installDir);
13323
13356
  const status2 = {
13324
13357
  nodeName: resolveNodeName(),
13325
13358
  installDir,
13326
13359
  running: reply2?.version ?? ASSIST_VERSION,
13327
13360
  built,
13328
13361
  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
- }),
13362
+ restart,
13363
+ autoRestart: autoRestartEnabled(installDir),
13337
13364
  daemonReachable: reply2 !== void 0,
13338
13365
  loop: reply2?.loop ?? {
13339
13366
  phase: "off",
@@ -13800,9 +13827,9 @@ function parseMenuKey(data, toggleKey) {
13800
13827
 
13801
13828
  // src/commands/sessions/web/restartMenu/createKeyHandler.ts
13802
13829
  function createKeyHandler(deps2) {
13803
- const { menu, toggleKey, isBusy, activate, quit } = deps2;
13830
+ const { menu, toggleKey, isBusy: isBusy2, activate, quit } = deps2;
13804
13831
  return (chunk) => {
13805
- if (isBusy()) return;
13832
+ if (isBusy2()) return;
13806
13833
  const { key, digit } = parseMenuKey(chunk, toggleKey);
13807
13834
  if (key === "quit") return quit();
13808
13835
  if (key === "toggle") {
@@ -13923,14 +13950,14 @@ function installRestartMenu(options2 = {}) {
13923
13950
  const log2 = createLogUpdate(out);
13924
13951
  const menu = createMenuState(items2, log2);
13925
13952
  const reExec = () => reExecFn({ beforeExec: () => cleanup(), exit });
13926
- const { isBusy, activate } = createActivate(menu, {
13953
+ const { isBusy: isBusy2, activate } = createActivate(menu, {
13927
13954
  runRestartDaemon: restartDaemonFn,
13928
13955
  reExec
13929
13956
  });
13930
13957
  const handler = createKeyHandler({
13931
13958
  menu,
13932
13959
  toggleKey,
13933
- isBusy,
13960
+ isBusy: isBusy2,
13934
13961
  activate,
13935
13962
  quit: () => {
13936
13963
  cleanup();
@@ -13991,6 +14018,158 @@ function scheduleReconnect() {
13991
14018
  setTimeout(() => void connect2(), RECONNECT_MS).unref();
13992
14019
  }
13993
14020
 
14021
+ // src/commands/sessions/web/updates/autoRestart/autoRestartAttempts.ts
14022
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
14023
+ import { dirname as dirname17, join as join36 } from "path";
14024
+ var defaultPath = join36(daemonPaths.dir, "auto-restart-attempts.json");
14025
+ function read(path109) {
14026
+ try {
14027
+ return JSON.parse(readFileSync13(path109, "utf8"));
14028
+ } catch {
14029
+ return {};
14030
+ }
14031
+ }
14032
+ function autoRestartAttempts(port, path109 = defaultPath) {
14033
+ const key = String(port);
14034
+ return {
14035
+ get: () => read(path109)[key],
14036
+ set: (built) => {
14037
+ mkdirSync7(dirname17(path109), { recursive: true });
14038
+ writeFileSync6(
14039
+ path109,
14040
+ `${JSON.stringify({ ...read(path109), [key]: built }, null, 2)}
14041
+ `
14042
+ );
14043
+ }
14044
+ };
14045
+ }
14046
+
14047
+ // src/commands/sessions/web/updates/autoRestart/attemptAutoRestart.ts
14048
+ async function attemptAutoRestart(deps2, target, built) {
14049
+ deps2.attempted.set(built);
14050
+ deps2.log(`auto-restart: restarting ${target} to apply v${built}`);
14051
+ try {
14052
+ await deps2.restart(target);
14053
+ } catch (error) {
14054
+ deps2.log(
14055
+ `auto-restart: ${target} restart for v${built} failed: ${error instanceof Error ? error.message : String(error)}`
14056
+ );
14057
+ }
14058
+ }
14059
+
14060
+ // src/commands/sessions/web/updates/autoRestart/autoRestartBlocker.ts
14061
+ function isBusy(session) {
14062
+ if (session.node !== void 0 || session.commandType === "run") return false;
14063
+ if (session.status !== "running") return false;
14064
+ const preview = session.pendingPrPreview;
14065
+ return preview === void 0 || preview.kind === "show";
14066
+ }
14067
+ function autoRestartBlocker(input) {
14068
+ if (input.buildPending) return "build pending";
14069
+ if (!input.loop) return "daemon not reachable";
14070
+ if (input.loop.paused) return "auto-update paused";
14071
+ if (input.loop.phase === "diverged") return "auto-update diverged";
14072
+ const busy = input.sessions.filter(isBusy);
14073
+ if (busy.length > 0)
14074
+ return `waiting on ${busy.length} running session${busy.length === 1 ? "" : "s"} (${busy.map((s) => s.name).join(", ")})`;
14075
+ return void 0;
14076
+ }
14077
+
14078
+ // src/commands/sessions/web/updates/autoRestart/autoRestartTarget.ts
14079
+ function autoRestartTarget(restart) {
14080
+ return restart.length > 1 ? "both" : restart[0];
14081
+ }
14082
+
14083
+ // src/commands/sessions/web/updates/autoRestart/createAutoRestartCheck.ts
14084
+ var AUTO_RESTART_SETTLE_MS = 6e4;
14085
+ function skipReason(snap, attempted2) {
14086
+ if (attempted2 === snap.built) return `: already attempted for v${snap.built}`;
14087
+ const blocker = autoRestartBlocker(snap);
14088
+ return blocker && ` for v${snap.built}: ${blocker}`;
14089
+ }
14090
+ function createAutoRestartCheck(deps2) {
14091
+ const now = deps2.now ?? Date.now;
14092
+ let idleSince;
14093
+ let lastNote;
14094
+ const note = (message3) => {
14095
+ if (message3 !== void 0 && message3 !== lastNote)
14096
+ deps2.log(`auto-restart: ${message3}`);
14097
+ lastNote = message3;
14098
+ idleSince = void 0;
14099
+ };
14100
+ return async function tick() {
14101
+ if (!deps2.enabled()) return note(void 0);
14102
+ const snap = await deps2.snapshot();
14103
+ if (snap.restart.length === 0) return note(void 0);
14104
+ const target = autoRestartTarget(snap.restart);
14105
+ const skip3 = skipReason(snap, deps2.attempted.get());
14106
+ if (skip3) return note(`skipped ${target} restart${skip3}`);
14107
+ const at2 = now();
14108
+ if (idleSince === void 0) {
14109
+ note(
14110
+ `${target} restart for v${snap.built} ready; restarting once idle for ${AUTO_RESTART_SETTLE_MS / 1e3}s`
14111
+ );
14112
+ idleSince = at2;
14113
+ return;
14114
+ }
14115
+ if (at2 - idleSince < AUTO_RESTART_SETTLE_MS) return;
14116
+ note(void 0);
14117
+ await attemptAutoRestart(deps2, target, snap.built);
14118
+ };
14119
+ }
14120
+
14121
+ // src/commands/sessions/web/updates/autoRestart/logViaDaemon.ts
14122
+ var ACK_TIMEOUT_MS = 1e3;
14123
+ async function logViaDaemon(message3) {
14124
+ const ack = await requestDaemonReply(
14125
+ { type: "web-log", message: message3 },
14126
+ "web-logged",
14127
+ ACK_TIMEOUT_MS
14128
+ );
14129
+ if (!ack) console.log(message3);
14130
+ }
14131
+
14132
+ // src/commands/sessions/web/updates/autoRestart/startAutoRestart.ts
14133
+ var CHECK_INTERVAL_MS = 2e4;
14134
+ async function snapshot(installDir) {
14135
+ const [state, greeting] = await Promise.all([
14136
+ readRestartState(installDir),
14137
+ requestDaemonReply(
14138
+ { type: "ping" },
14139
+ "sessions"
14140
+ )
14141
+ ]);
14142
+ return {
14143
+ built: state.built,
14144
+ buildPending: state.buildPending,
14145
+ restart: state.restart,
14146
+ loop: greeting ? state.reply?.loop : void 0,
14147
+ sessions: greeting?.sessions ?? []
14148
+ };
14149
+ }
14150
+ function startAutoRestart(port) {
14151
+ const installDir = getInstallDir();
14152
+ const tick = createAutoRestartCheck({
14153
+ enabled: () => autoRestartEnabled(installDir),
14154
+ snapshot: () => snapshot(installDir),
14155
+ attempted: autoRestartAttempts(port),
14156
+ restart: (target) => performRestart(target),
14157
+ log: (message3) => void logViaDaemon(message3)
14158
+ });
14159
+ let running3 = false;
14160
+ setInterval(() => {
14161
+ if (running3) return;
14162
+ running3 = true;
14163
+ tick().catch(
14164
+ (error) => console.log(
14165
+ `auto-restart: check failed: ${error instanceof Error ? error.message : String(error)}`
14166
+ )
14167
+ ).finally(() => {
14168
+ running3 = false;
14169
+ });
14170
+ }, CHECK_INTERVAL_MS).unref();
14171
+ }
14172
+
13994
14173
  // src/commands/sessions/daemon/originForCwd.ts
13995
14174
  var cache5 = /* @__PURE__ */ new Map();
13996
14175
  function originResolutionForCwd(cwd) {
@@ -14183,6 +14362,7 @@ async function web(options2) {
14183
14362
  repoCwd: isGitRepo(serverCwd) ? repoEntryCwd(serverCwd) : void 0
14184
14363
  };
14185
14364
  attachSessionSocket(server, ctx);
14365
+ startAutoRestart(port);
14186
14366
  installRestartMenu();
14187
14367
  sweepStagedAttachments();
14188
14368
  streamDaemonLogs();
@@ -14251,10 +14431,10 @@ async function promptMultiselect(message3, options2) {
14251
14431
 
14252
14432
  // src/commands/verify/installPackage.ts
14253
14433
  import { execSync as execSync6 } from "child_process";
14254
- import { writeFileSync as writeFileSync6 } from "fs";
14434
+ import { writeFileSync as writeFileSync7 } from "fs";
14255
14435
  import chalk17 from "chalk";
14256
14436
  function writePackageJson(filePath, pkg) {
14257
- writeFileSync6(filePath, `${JSON.stringify(pkg, null, 2)}
14437
+ writeFileSync7(filePath, `${JSON.stringify(pkg, null, 2)}
14258
14438
  `);
14259
14439
  }
14260
14440
  function addScript(pkg, name, command) {
@@ -14511,23 +14691,23 @@ import * as path16 from "path";
14511
14691
  import chalk21 from "chalk";
14512
14692
 
14513
14693
  // 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";
14694
+ import { existsSync as existsSync29, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
14695
+ import { join as join37 } from "path";
14516
14696
  import chalk20 from "chalk";
14517
14697
  function loadKnipConfig(knipJsonPath) {
14518
14698
  if (existsSync29(knipJsonPath)) {
14519
- return JSON.parse(readFileSync13(knipJsonPath, "utf8"));
14699
+ return JSON.parse(readFileSync14(knipJsonPath, "utf8"));
14520
14700
  }
14521
14701
  return { $schema: "https://unpkg.com/knip@5/schema.json" };
14522
14702
  }
14523
14703
  function addToKnipIgnoreBinaries(cwd, binary) {
14524
- const knipJsonPath = join36(cwd, "knip.json");
14704
+ const knipJsonPath = join37(cwd, "knip.json");
14525
14705
  try {
14526
14706
  const knipConfig = loadKnipConfig(knipJsonPath);
14527
14707
  const ignoreBinaries = knipConfig.ignoreBinaries ?? [];
14528
14708
  if (!ignoreBinaries.includes(binary)) {
14529
14709
  knipConfig.ignoreBinaries = [...ignoreBinaries, binary];
14530
- writeFileSync7(
14710
+ writeFileSync8(
14531
14711
  knipJsonPath,
14532
14712
  `${JSON.stringify(knipConfig, null, " ")}
14533
14713
  `
@@ -14568,7 +14748,7 @@ import * as path18 from "path";
14568
14748
  import chalk26 from "chalk";
14569
14749
 
14570
14750
  // src/commands/format/init.ts
14571
- import { existsSync as existsSync30, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
14751
+ import { existsSync as existsSync30, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
14572
14752
  import chalk24 from "chalk";
14573
14753
 
14574
14754
  // src/shared/promptConfirm.ts
@@ -14630,13 +14810,13 @@ async function init() {
14630
14810
  const newContent = `${JSON.stringify(oxfmtrc_template_default, null, " ")}
14631
14811
  `;
14632
14812
  const configPath = ".oxfmtrc.json";
14633
- const oldContent = existsSync30(configPath) ? readFileSync14(configPath, "utf8") : "";
14813
+ const oldContent = existsSync30(configPath) ? readFileSync15(configPath, "utf8") : "";
14634
14814
  if (oldContent === newContent) {
14635
14815
  console.log(".oxfmtrc.json already has the baseline formatter config");
14636
14816
  return;
14637
14817
  }
14638
14818
  if (!oldContent) {
14639
- writeFileSync8(configPath, newContent);
14819
+ writeFileSync9(configPath, newContent);
14640
14820
  console.log("Created .oxfmtrc.json with baseline formatter config");
14641
14821
  return;
14642
14822
  }
@@ -14648,17 +14828,17 @@ async function init() {
14648
14828
  console.log("Skipped .oxfmtrc.json update");
14649
14829
  return;
14650
14830
  }
14651
- writeFileSync8(configPath, newContent);
14831
+ writeFileSync9(configPath, newContent);
14652
14832
  console.log("Updated .oxfmtrc.json with baseline formatter config");
14653
14833
  }
14654
14834
 
14655
14835
  // src/commands/lint/init.ts
14656
- import { existsSync as existsSync33, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
14836
+ import { existsSync as existsSync33, readFileSync as readFileSync17, writeFileSync as writeFileSync11 } from "fs";
14657
14837
  import chalk25 from "chalk";
14658
14838
 
14659
14839
  // src/shared/removeEslint.ts
14660
14840
  import { execSync as execSync7 } from "child_process";
14661
- import { existsSync as existsSync32, readFileSync as readFileSync15, writeFileSync as writeFileSync9 } from "fs";
14841
+ import { existsSync as existsSync32, readFileSync as readFileSync16, writeFileSync as writeFileSync10 } from "fs";
14662
14842
 
14663
14843
  // src/shared/removeEslint/removeEslintConfigFiles.ts
14664
14844
  import { existsSync as existsSync31, unlinkSync as unlinkSync2 } from "fs";
@@ -14702,13 +14882,13 @@ function removeEslintFromPackageJson(options2) {
14702
14882
  if (!existsSync32(packageJsonPath)) {
14703
14883
  return false;
14704
14884
  }
14705
- const packageJson = JSON.parse(readFileSync15(packageJsonPath, "utf8"));
14885
+ const packageJson = JSON.parse(readFileSync16(packageJsonPath, "utf8"));
14706
14886
  let modified = false;
14707
14887
  modified = removeEslintDeps(packageJson.dependencies) || modified;
14708
14888
  modified = removeEslintDeps(packageJson.devDependencies) || modified;
14709
14889
  modified = removeEslintScripts(packageJson.scripts, options2) || modified;
14710
14890
  if (modified) {
14711
- writeFileSync9(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
14891
+ writeFileSync10(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
14712
14892
  `);
14713
14893
  console.log("Removed eslint references from package.json");
14714
14894
  }
@@ -14766,13 +14946,13 @@ async function writeOxlintConfig() {
14766
14946
  const newContent = `${JSON.stringify(oxlintrc_template_default, null, " ")}
14767
14947
  `;
14768
14948
  const configPath = ".oxlintrc.json";
14769
- const oldContent = existsSync33(configPath) ? readFileSync16(configPath, "utf8") : "";
14949
+ const oldContent = existsSync33(configPath) ? readFileSync17(configPath, "utf8") : "";
14770
14950
  if (oldContent === newContent) {
14771
14951
  console.log(".oxlintrc.json already has the baseline linter config");
14772
14952
  return;
14773
14953
  }
14774
14954
  if (!oldContent) {
14775
- writeFileSync10(configPath, newContent);
14955
+ writeFileSync11(configPath, newContent);
14776
14956
  console.log("Created .oxlintrc.json with baseline linter config");
14777
14957
  return;
14778
14958
  }
@@ -14784,7 +14964,7 @@ async function writeOxlintConfig() {
14784
14964
  console.log("Skipped .oxlintrc.json update");
14785
14965
  return;
14786
14966
  }
14787
- writeFileSync10(configPath, newContent);
14967
+ writeFileSync11(configPath, newContent);
14788
14968
  console.log("Updated .oxlintrc.json with baseline linter config");
14789
14969
  }
14790
14970
 
@@ -15454,11 +15634,11 @@ async function run(options2 = {}) {
15454
15634
 
15455
15635
  // src/commands/new/registerNew/initGit.ts
15456
15636
  import { execSync as execSync10 } from "child_process";
15457
- import { writeFileSync as writeFileSync14 } from "fs";
15637
+ import { writeFileSync as writeFileSync15 } from "fs";
15458
15638
  function initGit() {
15459
15639
  console.log("Initializing git repository...");
15460
15640
  execSync10("git init", { stdio: "inherit" });
15461
- writeFileSync14(".gitignore", "dist\nnode_modules\n");
15641
+ writeFileSync15(".gitignore", "dist\nnode_modules\n");
15462
15642
  }
15463
15643
 
15464
15644
  // src/commands/new/registerNew/newCli/initPackageJson.ts
@@ -15477,10 +15657,10 @@ function initPackageJson(name) {
15477
15657
  }
15478
15658
 
15479
15659
  // src/commands/new/registerNew/newCli/writeCliTemplate.ts
15480
- import { mkdirSync as mkdirSync8, writeFileSync as writeFileSync15 } from "fs";
15660
+ import { mkdirSync as mkdirSync9, writeFileSync as writeFileSync16 } from "fs";
15481
15661
  function writeCliTemplate(name) {
15482
15662
  console.log("Writing tsconfig.json...");
15483
- writeFileSync15(
15663
+ writeFileSync16(
15484
15664
  "tsconfig.json",
15485
15665
  JSON.stringify(
15486
15666
  {
@@ -15504,7 +15684,7 @@ function writeCliTemplate(name) {
15504
15684
  )
15505
15685
  );
15506
15686
  console.log("Writing tsup.config.ts...");
15507
- writeFileSync15(
15687
+ writeFileSync16(
15508
15688
  "tsup.config.ts",
15509
15689
  `import { defineConfig } from "tsup";
15510
15690
  export default defineConfig({
@@ -15518,8 +15698,8 @@ export default defineConfig({
15518
15698
  `
15519
15699
  );
15520
15700
  console.log("Writing src/index.ts...");
15521
- mkdirSync8("src", { recursive: true });
15522
- writeFileSync15(
15701
+ mkdirSync9("src", { recursive: true });
15702
+ writeFileSync16(
15523
15703
  "src/index.ts",
15524
15704
  `#!/usr/bin/env node
15525
15705
  import { Command } from "commander";
@@ -15547,7 +15727,7 @@ async function newCli() {
15547
15727
 
15548
15728
  // src/commands/new/registerNew/newProject.ts
15549
15729
  import { execSync as execSync14 } from "child_process";
15550
- import { existsSync as existsSync38, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
15730
+ import { existsSync as existsSync38, readFileSync as readFileSync21, writeFileSync as writeFileSync18 } from "fs";
15551
15731
 
15552
15732
  // src/commands/deploy/init.ts
15553
15733
  import { execSync as execSync13 } from "child_process";
@@ -15555,33 +15735,33 @@ import chalk36 from "chalk";
15555
15735
  import enquirer3 from "enquirer";
15556
15736
 
15557
15737
  // 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";
15738
+ import { existsSync as existsSync37, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync17 } from "fs";
15739
+ import { dirname as dirname25, join as join44 } from "path";
15560
15740
  import { fileURLToPath as fileURLToPath4 } from "url";
15561
15741
  import chalk35 from "chalk";
15562
15742
  var WORKFLOW_PATH = ".github/workflows/build.yml";
15563
- var __dirname3 = dirname24(fileURLToPath4(import.meta.url));
15743
+ var __dirname3 = dirname25(fileURLToPath4(import.meta.url));
15564
15744
  function getExistingSiteId() {
15565
15745
  if (!existsSync37(WORKFLOW_PATH)) {
15566
15746
  return null;
15567
15747
  }
15568
- const content = readFileSync19(WORKFLOW_PATH, "utf8");
15748
+ const content = readFileSync20(WORKFLOW_PATH, "utf8");
15569
15749
  const match = content.match(/-s\s+([a-f0-9-]{36})/);
15570
15750
  return match ? match[1] : null;
15571
15751
  }
15572
15752
  function getTemplateContent(siteId) {
15573
- const templatePath = join43(__dirname3, "commands/deploy/build.yml");
15574
- const template = readFileSync19(templatePath, "utf8");
15753
+ const templatePath = join44(__dirname3, "commands/deploy/build.yml");
15754
+ const template = readFileSync20(templatePath, "utf8");
15575
15755
  return template.replace("{{NETLIFY_SITE_ID}}", siteId);
15576
15756
  }
15577
15757
  async function updateWorkflow(siteId) {
15578
15758
  const newContent = getTemplateContent(siteId);
15579
15759
  const workflowDir = ".github/workflows";
15580
15760
  if (!existsSync37(workflowDir)) {
15581
- mkdirSync9(workflowDir, { recursive: true });
15761
+ mkdirSync10(workflowDir, { recursive: true });
15582
15762
  }
15583
15763
  if (existsSync37(WORKFLOW_PATH)) {
15584
- const oldContent = readFileSync19(WORKFLOW_PATH, "utf8");
15764
+ const oldContent = readFileSync20(WORKFLOW_PATH, "utf8");
15585
15765
  if (oldContent === newContent) {
15586
15766
  console.log(chalk35.green("build.yml is already up to date"));
15587
15767
  return;
@@ -15595,7 +15775,7 @@ async function updateWorkflow(siteId) {
15595
15775
  return;
15596
15776
  }
15597
15777
  }
15598
- writeFileSync16(WORKFLOW_PATH, newContent);
15778
+ writeFileSync17(WORKFLOW_PATH, newContent);
15599
15779
  console.log(chalk35.green(`
15600
15780
  Created ${WORKFLOW_PATH}`));
15601
15781
  }
@@ -15679,7 +15859,7 @@ function addViteBaseConfig() {
15679
15859
  console.log("No vite.config.ts found, skipping base config");
15680
15860
  return;
15681
15861
  }
15682
- const content = readFileSync20(viteConfigPath, "utf8");
15862
+ const content = readFileSync21(viteConfigPath, "utf8");
15683
15863
  if (content.includes("base:")) {
15684
15864
  console.log("vite.config.ts already has base config");
15685
15865
  return;
@@ -15689,7 +15869,7 @@ function addViteBaseConfig() {
15689
15869
  'defineConfig({\n base: "./",'
15690
15870
  );
15691
15871
  if (updated2 !== content) {
15692
- writeFileSync17(viteConfigPath, updated2);
15872
+ writeFileSync18(viteConfigPath, updated2);
15693
15873
  console.log('Added base: "./" to vite.config.ts');
15694
15874
  }
15695
15875
  }
@@ -15877,19 +16057,19 @@ function adviceContextFor(cwd, env = process.env) {
15877
16057
  }
15878
16058
 
15879
16059
  // 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";
16060
+ import { readdirSync as readdirSync7, readFileSync as readFileSync22 } from "fs";
16061
+ import { basename as basename12, join as join46 } from "path";
15882
16062
 
15883
16063
  // src/commands/advise/adviceDir.ts
15884
16064
  import { existsSync as existsSync39 } from "fs";
15885
- import { dirname as dirname25, join as join44 } from "path";
16065
+ import { dirname as dirname26, join as join45 } from "path";
15886
16066
  import { fileURLToPath as fileURLToPath5 } from "url";
15887
16067
  function adviceDir() {
15888
- let current = dirname25(fileURLToPath5(import.meta.url));
15889
- while (current !== dirname25(current)) {
15890
- const candidate = join44(current, "claude", "advice");
16068
+ let current = dirname26(fileURLToPath5(import.meta.url));
16069
+ while (current !== dirname26(current)) {
16070
+ const candidate = join45(current, "claude", "advice");
15891
16071
  if (existsSync39(candidate)) return candidate;
15892
- current = dirname25(current);
16072
+ current = dirname26(current);
15893
16073
  }
15894
16074
  throw new Error("Could not locate the shipped claude/advice directory");
15895
16075
  }
@@ -15920,7 +16100,7 @@ function loadAdviceFragments(dir = adviceDir()) {
15920
16100
  return readdirSync7(dir).filter((file) => file.endsWith(".md")).sort().map(
15921
16101
  (file) => parseAdviceFragment(
15922
16102
  basename12(file, ".md"),
15923
- readFileSync21(join45(dir, file), "utf8")
16103
+ readFileSync22(join46(dir, file), "utf8")
15924
16104
  )
15925
16105
  );
15926
16106
  }
@@ -15955,12 +16135,12 @@ function renderAdviceBody(fragment, context) {
15955
16135
 
15956
16136
  // src/commands/advise/adviceConditions.ts
15957
16137
  import { existsSync as existsSync40 } from "fs";
15958
- import { join as join46 } from "path";
16138
+ import { join as join47 } from "path";
15959
16139
  function repoFile(file, label) {
15960
16140
  return {
15961
16141
  whenMet: `the repo has ${label}`,
15962
16142
  whenUnmet: `the repo has no ${label}`,
15963
- matches: ({ rootDir }) => existsSync40(join46(rootDir, file))
16143
+ matches: ({ rootDir }) => existsSync40(join47(rootDir, file))
15964
16144
  };
15965
16145
  }
15966
16146
  var adviceConditions = {
@@ -15986,11 +16166,11 @@ var adviceConditions = {
15986
16166
  },
15987
16167
  typescript: repoFile("tsconfig.json", "a tsconfig.json"),
15988
16168
  filenameConvention: repoFile(
15989
- join46("oxlint-rules", "filenameConvention.ts"),
16169
+ join47("oxlint-rules", "filenameConvention.ts"),
15990
16170
  "oxlint-rules/filenameConvention.ts"
15991
16171
  ),
15992
16172
  claudeSettings: repoFile(
15993
- join46("claude", "settings.json"),
16173
+ join47("claude", "settings.json"),
15994
16174
  "claude/settings.json"
15995
16175
  ),
15996
16176
  verify: {
@@ -16080,10 +16260,10 @@ function explainAdvice(context, fragments = loadAdviceFragments()) {
16080
16260
 
16081
16261
  // src/commands/advise/advise.ts
16082
16262
  async function hookCwd(options2) {
16083
- const read3 = options2.stdin ?? (process.stdin.isTTY ? void 0 : readStdin);
16084
- if (!read3) return void 0;
16263
+ const read4 = options2.stdin ?? (process.stdin.isTTY ? void 0 : readStdin);
16264
+ if (!read4) return void 0;
16085
16265
  try {
16086
- const raw = await read3();
16266
+ const raw = await read4();
16087
16267
  if (!raw.trim()) return void 0;
16088
16268
  return JSON.parse(raw).cwd;
16089
16269
  } catch {
@@ -16600,7 +16780,7 @@ async function resolveCheckBump(check2) {
16600
16780
  }
16601
16781
 
16602
16782
  // src/commands/backlog/readJsonPayload.ts
16603
- import { readFileSync as readFileSync22 } from "fs";
16783
+ import { readFileSync as readFileSync23 } from "fs";
16604
16784
  import chalk38 from "chalk";
16605
16785
  function fail(message3) {
16606
16786
  console.error(chalk38.red(message3));
@@ -16612,7 +16792,7 @@ function describe(error) {
16612
16792
  async function readSource(source) {
16613
16793
  try {
16614
16794
  if (source === "-") return (await readStdinBuffer()).toString("utf8");
16615
- return readFileSync22(source, "utf8");
16795
+ return readFileSync23(source, "utf8");
16616
16796
  } catch (error) {
16617
16797
  return fail(
16618
16798
  `Cannot read the payload from ${source === "-" ? "stdin" : source}: ${describe(error)}`
@@ -16872,7 +17052,7 @@ function registerAskQuestion(program) {
16872
17052
 
16873
17053
  // src/commands/registerBackup.ts
16874
17054
  import { mkdir as mkdir3, stat as stat4 } from "fs/promises";
16875
- import { join as join48, resolve as resolve16 } from "path";
17055
+ import { join as join49, resolve as resolve16 } from "path";
16876
17056
  import chalk41 from "chalk";
16877
17057
 
16878
17058
  // src/shared/db/recordBackup.ts
@@ -16886,7 +17066,7 @@ async function recordBackup(db, {
16886
17066
 
16887
17067
  // src/commands/backup/scheduleBackup.ts
16888
17068
  import { mkdir as mkdir2 } from "fs/promises";
16889
- import { join as join47 } from "path";
17069
+ import { join as join48 } from "path";
16890
17070
  import chalk39 from "chalk";
16891
17071
 
16892
17072
  // src/commands/backup/readCrontab.ts
@@ -17028,7 +17208,7 @@ async function scheduleBackup({
17028
17208
  const cronExpr = durationToCron(every);
17029
17209
  const dir = expandTilde(loadConfig().backup.dir);
17030
17210
  await mkdir2(dir, { recursive: true });
17031
- const logPath2 = join47(dir, "cron.log");
17211
+ const logPath2 = join48(dir, "cron.log");
17032
17212
  const cronLine = `${cronExpr} ${resolveAssistCommand()} backup >> ${logPath2} 2>&1`;
17033
17213
  writeCrontab(upsertScheduleBlock(readCrontab(), every, cronLine));
17034
17214
  console.error(
@@ -17207,7 +17387,7 @@ async function backup({ out }) {
17207
17387
  await mkdir3(dir, { recursive: true });
17208
17388
  const start2 = Date.now();
17209
17389
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
17210
- const filePath = resolve16(join48(dir, `backup-${timestamp9}.dump`));
17390
+ const filePath = resolve16(join49(dir, `backup-${timestamp9}.dump`));
17211
17391
  await exportBacklog(filePath);
17212
17392
  const { size } = await stat4(filePath);
17213
17393
  const durationMs = Date.now() - start2;
@@ -18103,9 +18283,9 @@ function ensureRemoteOrigin() {
18103
18283
 
18104
18284
  // src/commands/backlog/add/shared.ts
18105
18285
  import { spawnSync as spawnSync5 } from "child_process";
18106
- import { mkdtempSync, readFileSync as readFileSync23, unlinkSync as unlinkSync3, writeFileSync as writeFileSync18 } from "fs";
18286
+ import { mkdtempSync, readFileSync as readFileSync24, unlinkSync as unlinkSync3, writeFileSync as writeFileSync19 } from "fs";
18107
18287
  import { tmpdir } from "os";
18108
- import { join as join50 } from "path";
18288
+ import { join as join51 } from "path";
18109
18289
  import enquirer4 from "enquirer";
18110
18290
  async function promptType() {
18111
18291
  const { type } = await enquirer4.prompt({
@@ -18145,15 +18325,15 @@ async function promptDescription() {
18145
18325
  }
18146
18326
  function openEditor() {
18147
18327
  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, "");
18328
+ const dir = mkdtempSync(join51(tmpdir(), "assist-"));
18329
+ const filePath = join51(dir, "description.md");
18330
+ writeFileSync19(filePath, "");
18151
18331
  const result = spawnSync5(editor, [filePath], { stdio: "inherit" });
18152
18332
  if (result.status !== 0) {
18153
18333
  unlinkSync3(filePath);
18154
18334
  return void 0;
18155
18335
  }
18156
- const content = readFileSync23(filePath, "utf8").trim();
18336
+ const content = readFileSync24(filePath, "utf8").trim();
18157
18337
  unlinkSync3(filePath);
18158
18338
  return content || void 0;
18159
18339
  }
@@ -18580,11 +18760,11 @@ function startProposedRun(id) {
18580
18760
  import { randomUUID as randomUUID9 } from "crypto";
18581
18761
 
18582
18762
  // 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";
18763
+ import { mkdirSync as mkdirSync11, readFileSync as readFileSync25, renameSync as renameSync4, writeFileSync as writeFileSync20 } from "fs";
18764
+ import { dirname as dirname27 } from "path";
18585
18765
  function readLedger(path109) {
18586
18766
  try {
18587
- const parsed = JSON.parse(readFileSync24(path109, "utf8"));
18767
+ const parsed = JSON.parse(readFileSync25(path109, "utf8"));
18588
18768
  return { open: parsed.open ?? [], created: parsed.created };
18589
18769
  } catch {
18590
18770
  return { open: [] };
@@ -18593,9 +18773,9 @@ function readLedger(path109) {
18593
18773
  function mutateLedger(path109, mutate) {
18594
18774
  const ledger = readLedger(path109);
18595
18775
  mutate(ledger);
18596
- mkdirSync10(dirname26(path109), { recursive: true });
18776
+ mkdirSync11(dirname27(path109), { recursive: true });
18597
18777
  const tmp = `${path109}.${process.pid}.tmp`;
18598
- writeFileSync19(tmp, JSON.stringify(ledger));
18778
+ writeFileSync20(tmp, JSON.stringify(ledger));
18599
18779
  renameSync4(tmp, path109);
18600
18780
  }
18601
18781
 
@@ -18624,9 +18804,9 @@ async function findPredecessor(path109, token, startedAt) {
18624
18804
 
18625
18805
  // src/commands/backlog/propose/proposalLedgerPath.ts
18626
18806
  import { homedir as homedir14 } from "os";
18627
- import { join as join51 } from "path";
18807
+ import { join as join52 } from "path";
18628
18808
  function proposalLedgerPath(sessionId2) {
18629
- return join51(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
18809
+ return join52(homedir14(), ".assist", "proposals", `session-${sessionId2}.json`);
18630
18810
  }
18631
18811
 
18632
18812
  // src/commands/backlog/propose/trackProposal.ts
@@ -19120,13 +19300,13 @@ function hasLocalChanges() {
19120
19300
  // src/commands/backlog/acquireLock.ts
19121
19301
  import {
19122
19302
  existsSync as existsSync44,
19123
- mkdirSync as mkdirSync11,
19124
- readFileSync as readFileSync26,
19303
+ mkdirSync as mkdirSync12,
19304
+ readFileSync as readFileSync27,
19125
19305
  unlinkSync as unlinkSync4,
19126
- writeFileSync as writeFileSync20
19306
+ writeFileSync as writeFileSync21
19127
19307
  } from "fs";
19128
19308
  import { homedir as homedir15 } from "os";
19129
- import { join as join52 } from "path";
19309
+ import { join as join53 } from "path";
19130
19310
 
19131
19311
  // src/commands/backlog/bootedAt.ts
19132
19312
  import { uptime } from "os";
@@ -19135,11 +19315,11 @@ function bootedAt() {
19135
19315
  }
19136
19316
 
19137
19317
  // src/commands/backlog/processStartedAt.ts
19138
- import { readFileSync as readFileSync25 } from "fs";
19318
+ import { readFileSync as readFileSync26 } from "fs";
19139
19319
  var clockTicksPerSecond = 100;
19140
19320
  function processStartedAt(pid) {
19141
19321
  try {
19142
- const stat5 = readFileSync25(`/proc/${pid}/stat`, "utf8");
19322
+ const stat5 = readFileSync26(`/proc/${pid}/stat`, "utf8");
19143
19323
  const fields = stat5.slice(stat5.lastIndexOf(")") + 2).split(" ");
19144
19324
  const ticks = Number(fields[19]);
19145
19325
  if (!Number.isFinite(ticks)) return void 0;
@@ -19162,10 +19342,10 @@ function isStaleLock(pid, timestamp9) {
19162
19342
 
19163
19343
  // src/commands/backlog/acquireLock.ts
19164
19344
  function getLocksDir() {
19165
- return join52(homedir15(), ".assist", "locks");
19345
+ return join53(homedir15(), ".assist", "locks");
19166
19346
  }
19167
19347
  function getLockPath(itemId2) {
19168
- return join52(getLocksDir(), `lock-${itemId2}.json`);
19348
+ return join53(getLocksDir(), `lock-${itemId2}.json`);
19169
19349
  }
19170
19350
  function isProcessAlive(pid) {
19171
19351
  try {
@@ -19179,7 +19359,7 @@ function foreignLockHolder(itemId2) {
19179
19359
  const lockPath = getLockPath(itemId2);
19180
19360
  if (!existsSync44(lockPath)) return null;
19181
19361
  try {
19182
- const lock2 = JSON.parse(readFileSync26(lockPath, "utf8"));
19362
+ const lock2 = JSON.parse(readFileSync27(lockPath, "utf8"));
19183
19363
  if (typeof lock2.pid !== "number" || lock2.pid === process.pid) return null;
19184
19364
  if (!isProcessAlive(lock2.pid)) return null;
19185
19365
  if (isStaleLock(lock2.pid, lock2.timestamp)) return null;
@@ -19192,8 +19372,8 @@ function isLockedByOther(itemId2) {
19192
19372
  return foreignLockHolder(itemId2) !== null;
19193
19373
  }
19194
19374
  function acquireLock(itemId2) {
19195
- mkdirSync11(getLocksDir(), { recursive: true });
19196
- writeFileSync20(
19375
+ mkdirSync12(getLocksDir(), { recursive: true });
19376
+ writeFileSync21(
19197
19377
  getLockPath(itemId2),
19198
19378
  JSON.stringify({ pid: process.pid, timestamp: (/* @__PURE__ */ new Date()).toISOString() })
19199
19379
  );
@@ -19562,8 +19742,8 @@ Failed to launch Claude for ${context}: ${message3}`)
19562
19742
  }
19563
19743
 
19564
19744
  // src/commands/sessions/daemon/ensureHooksSettings.ts
19565
- import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync21 } from "fs";
19566
- import { dirname as dirname27 } from "path";
19745
+ import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync22 } from "fs";
19746
+ import { dirname as dirname28 } from "path";
19567
19747
  var SET_STATUS = "assist sessions set-status";
19568
19748
  function running(source) {
19569
19749
  return `${SET_STATUS} running --source ${source}`;
@@ -19596,8 +19776,8 @@ var hooksSettings = {
19596
19776
  };
19597
19777
  function ensureHooksSettings() {
19598
19778
  const path109 = daemonPaths.hooksSettings;
19599
- mkdirSync12(dirname27(path109), { recursive: true });
19600
- writeFileSync21(path109, JSON.stringify(hooksSettings, null, 2));
19779
+ mkdirSync13(dirname28(path109), { recursive: true });
19780
+ writeFileSync22(path109, JSON.stringify(hooksSettings, null, 2));
19601
19781
  return path109;
19602
19782
  }
19603
19783
 
@@ -19662,18 +19842,18 @@ async function resumeDoneConversation({ item, resumeSessionId }, spawnOptions) {
19662
19842
  }
19663
19843
 
19664
19844
  // src/commands/backlog/consumePause.ts
19665
- import { existsSync as existsSync45, mkdirSync as mkdirSync13, unlinkSync as unlinkSync5, writeFileSync as writeFileSync22 } from "fs";
19845
+ import { existsSync as existsSync45, mkdirSync as mkdirSync14, unlinkSync as unlinkSync5, writeFileSync as writeFileSync23 } from "fs";
19666
19846
  import { homedir as homedir16 } from "os";
19667
- import { join as join53 } from "path";
19847
+ import { join as join54 } from "path";
19668
19848
  function getControlsDir() {
19669
- return join53(homedir16(), ".assist", "controls");
19849
+ return join54(homedir16(), ".assist", "controls");
19670
19850
  }
19671
19851
  function getPausePath(itemId2) {
19672
- return join53(getControlsDir(), `pause-${itemId2}.json`);
19852
+ return join54(getControlsDir(), `pause-${itemId2}.json`);
19673
19853
  }
19674
19854
  function requestPause(itemId2) {
19675
- mkdirSync13(getControlsDir(), { recursive: true });
19676
- writeFileSync22(
19855
+ mkdirSync14(getControlsDir(), { recursive: true });
19856
+ writeFileSync23(
19677
19857
  getPausePath(itemId2),
19678
19858
  JSON.stringify({ timestamp: (/* @__PURE__ */ new Date()).toISOString() })
19679
19859
  );
@@ -19738,7 +19918,7 @@ async function ensureDone(id) {
19738
19918
  import chalk79 from "chalk";
19739
19919
 
19740
19920
  // src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
19741
- var ACK_TIMEOUT_MS = 1e3;
19921
+ var ACK_TIMEOUT_MS2 = 1e3;
19742
19922
  function sendToDaemonAwaitAck(message3) {
19743
19923
  return new Promise((resolve34, reject) => {
19744
19924
  connectToDaemon().then((socket) => {
@@ -19753,7 +19933,7 @@ function sendToDaemonAwaitAck(message3) {
19753
19933
  };
19754
19934
  const timer = setTimeout(
19755
19935
  () => finish2(new Error("timed out awaiting daemon ack")),
19756
- ACK_TIMEOUT_MS
19936
+ ACK_TIMEOUT_MS2
19757
19937
  );
19758
19938
  readSocketLines(socket, (line) => {
19759
19939
  if (isAck(line)) finish2();
@@ -19944,12 +20124,12 @@ function spawnHarness(harness, prompt, options2 = {}) {
19944
20124
  import { existsSync as existsSync47, unwatchFile, watchFile } from "fs";
19945
20125
 
19946
20126
  // src/commands/backlog/readSignal.ts
19947
- import { existsSync as existsSync46, readFileSync as readFileSync27 } from "fs";
20127
+ import { existsSync as existsSync46, readFileSync as readFileSync28 } from "fs";
19948
20128
  function readSignal() {
19949
20129
  const path109 = getSignalPath();
19950
20130
  if (!path109 || !existsSync46(path109)) return void 0;
19951
20131
  try {
19952
- return JSON.parse(readFileSync27(path109, "utf8"));
20132
+ return JSON.parse(readFileSync28(path109, "utf8"));
19953
20133
  } catch {
19954
20134
  return void 0;
19955
20135
  }
@@ -20125,9 +20305,9 @@ async function persistPhaseSessionId(itemId2, phaseIdx, claudeSessionId) {
20125
20305
  }
20126
20306
 
20127
20307
  // src/shared/emitActivity.ts
20128
- import { mkdirSync as mkdirSync14, readFileSync as readFileSync28, rmSync as rmSync4, writeFileSync as writeFileSync23 } from "fs";
20308
+ import { mkdirSync as mkdirSync15, readFileSync as readFileSync29, rmSync as rmSync4, writeFileSync as writeFileSync24 } from "fs";
20129
20309
  import { homedir as homedir17 } from "os";
20130
- import { dirname as dirname28, join as join54 } from "path";
20310
+ import { dirname as dirname29, join as join55 } from "path";
20131
20311
  import { z as z17 } from "zod";
20132
20312
  var activitySchema = z17.object({
20133
20313
  kind: z17.enum(["command", "backlog"]),
@@ -20144,18 +20324,18 @@ var activitySchema = z17.object({
20144
20324
  startedAt: z17.number()
20145
20325
  });
20146
20326
  function activityPath(sessionId2) {
20147
- return join54(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
20327
+ return join55(homedir17(), ".assist", "activity", `activity-${sessionId2}.json`);
20148
20328
  }
20149
20329
  function emitActivity(activity2) {
20150
20330
  const sessionId2 = process.env.ASSIST_ACTIVITY_ID;
20151
20331
  if (!sessionId2) return;
20152
20332
  const path109 = activityPath(sessionId2);
20153
- mkdirSync14(dirname28(path109), { recursive: true });
20154
- writeFileSync23(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
20333
+ mkdirSync15(dirname29(path109), { recursive: true });
20334
+ writeFileSync24(path109, JSON.stringify({ ...activity2, startedAt: Date.now() }));
20155
20335
  }
20156
20336
  function readActivity(path109) {
20157
20337
  try {
20158
- return JSON.parse(readFileSync28(path109, "utf8"));
20338
+ return JSON.parse(readFileSync29(path109, "utf8"));
20159
20339
  } catch {
20160
20340
  return void 0;
20161
20341
  }
@@ -20166,14 +20346,14 @@ function reconcileActivity(sessionId2, activity2) {
20166
20346
  return;
20167
20347
  }
20168
20348
  const path109 = activityPath(sessionId2);
20169
- mkdirSync14(dirname28(path109), { recursive: true });
20170
- writeFileSync23(path109, JSON.stringify(activity2));
20349
+ mkdirSync15(dirname29(path109), { recursive: true });
20350
+ writeFileSync24(path109, JSON.stringify(activity2));
20171
20351
  }
20172
20352
  function writeActivityIfAbsent(sessionId2, activity2) {
20173
20353
  const path109 = activityPath(sessionId2);
20174
- mkdirSync14(dirname28(path109), { recursive: true });
20354
+ mkdirSync15(dirname29(path109), { recursive: true });
20175
20355
  try {
20176
- writeFileSync23(path109, JSON.stringify(activity2), { flag: "wx" });
20356
+ writeFileSync24(path109, JSON.stringify(activity2), { flag: "wx" });
20177
20357
  return true;
20178
20358
  } catch (error) {
20179
20359
  if (error.code === "EEXIST") return false;
@@ -22438,7 +22618,7 @@ function stripEnvPrefix(parts) {
22438
22618
  }
22439
22619
 
22440
22620
  // src/commands/cliHook/isGhGraphqlIssueMutation.ts
22441
- import { readFileSync as readFileSync29 } from "fs";
22621
+ import { readFileSync as readFileSync30 } from "fs";
22442
22622
  var ISSUE_MUTATION = /\bmutation\b[\s\S]*(?:issue|comment|label|assign|reaction|milestone)/i;
22443
22623
  var FILE_REFERENCE = /(?:=@|--input[\s=]+)["']?([^\s"';&|)]+)/g;
22444
22624
  function isGhGraphqlIssueMutation(command) {
@@ -22450,7 +22630,7 @@ function isGhGraphqlIssueMutation(command) {
22450
22630
  }
22451
22631
  function readOrEmpty(path109) {
22452
22632
  try {
22453
- return readFileSync29(path109, "utf8");
22633
+ return readFileSync30(path109, "utf8");
22454
22634
  } catch {
22455
22635
  return "";
22456
22636
  }
@@ -22653,10 +22833,10 @@ function pipesToFilter(rawCommand, filters) {
22653
22833
  function namedFilters(filters) {
22654
22834
  return `${filters.slice(0, -1).join(", ")} or ${filters.at(-1)}`;
22655
22835
  }
22656
- function readDecision(read3) {
22836
+ function readDecision(read4) {
22657
22837
  return {
22658
22838
  permissionDecision: "deny",
22659
- permissionDecisionReason: `Do not pipe '${read3.prefix}' through ${namedFilters(read3.filters)}. ${read3.reason}`
22839
+ permissionDecisionReason: `Do not pipe '${read4.prefix}' through ${namedFilters(read4.filters)}. ${read4.reason}`
22660
22840
  };
22661
22841
  }
22662
22842
  function gatedDecision(gated) {
@@ -22666,18 +22846,18 @@ function gatedDecision(gated) {
22666
22846
  };
22667
22847
  }
22668
22848
  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);
22849
+ const read4 = parts.map(matchUntruncatableRead).find(Boolean);
22850
+ if (read4 && parts.some((part) => startsWithFilter(part, read4.filters)))
22851
+ return readDecision(read4);
22672
22852
  const gated = parts.map(matchApprovalGatedCommand).find(Boolean);
22673
22853
  if (gated && parts.some((part) => startsWithFilter(part, TRUNCATOR_BINARIES)))
22674
22854
  return gatedDecision(gated);
22675
22855
  return void 0;
22676
22856
  }
22677
22857
  function findTruncatedReadDenyRaw(rawCommand) {
22678
- const read3 = matchUntruncatableRead(rawCommand);
22679
- if (read3 && pipesToFilter(rawCommand, read3.filters))
22680
- return readDecision(read3);
22858
+ const read4 = matchUntruncatableRead(rawCommand);
22859
+ if (read4 && pipesToFilter(rawCommand, read4.filters))
22860
+ return readDecision(read4);
22681
22861
  const gated = matchApprovalGatedCommand(rawCommand);
22682
22862
  if (gated && pipesToFilter(rawCommand, TRUNCATOR_BINARIES))
22683
22863
  return gatedDecision(gated);
@@ -22781,17 +22961,17 @@ function extractGraphqlQuery(args) {
22781
22961
  }
22782
22962
 
22783
22963
  // 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";
22964
+ import { existsSync as existsSync49, readFileSync as readFileSync31, writeFileSync as writeFileSync25 } from "fs";
22965
+ import { dirname as dirname30, resolve as resolve18 } from "path";
22786
22966
  import { fileURLToPath as fileURLToPath6 } from "url";
22787
22967
  var __filename3 = fileURLToPath6(import.meta.url);
22788
- var __dirname4 = dirname29(__filename3);
22968
+ var __dirname4 = dirname30(__filename3);
22789
22969
  function packageRoot() {
22790
22970
  return __dirname4;
22791
22971
  }
22792
22972
  function readLines(path109) {
22793
22973
  if (!existsSync49(path109)) return [];
22794
- return readFileSync30(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
22974
+ return readFileSync31(path109, "utf8").split("\n").filter((line) => line.trim() !== "");
22795
22975
  }
22796
22976
  var cachedReads;
22797
22977
  var cachedWrites;
@@ -22811,7 +22991,7 @@ function loadCliReads() {
22811
22991
  return getCliReadsLines();
22812
22992
  }
22813
22993
  function saveCliReads(commands) {
22814
- writeFileSync24(
22994
+ writeFileSync25(
22815
22995
  resolve18(packageRoot(), "allowed.cli-reads"),
22816
22996
  `${commands.join("\n")}
22817
22997
  `
@@ -22837,14 +23017,14 @@ function findCliWrite(command) {
22837
23017
  }
22838
23018
 
22839
23019
  // src/shared/readSettingsPerms.ts
22840
- import { existsSync as existsSync50, readFileSync as readFileSync31 } from "fs";
23020
+ import { existsSync as existsSync50, readFileSync as readFileSync32 } from "fs";
22841
23021
  import { homedir as homedir18 } from "os";
22842
- import { join as join55 } from "path";
23022
+ import { join as join56 } from "path";
22843
23023
  function readSettingsPerms(key) {
22844
23024
  const paths = [
22845
- join55(homedir18(), ".claude", "settings.json"),
22846
- join55(process.cwd(), ".claude", "settings.json"),
22847
- join55(process.cwd(), ".claude", "settings.local.json")
23025
+ join56(homedir18(), ".claude", "settings.json"),
23026
+ join56(process.cwd(), ".claude", "settings.json"),
23027
+ join56(process.cwd(), ".claude", "settings.local.json")
22848
23028
  ];
22849
23029
  const entries = [];
22850
23030
  for (const p of paths) {
@@ -22855,7 +23035,7 @@ function readSettingsPerms(key) {
22855
23035
  function readPermissionArray(filePath, key) {
22856
23036
  if (!existsSync50(filePath)) return [];
22857
23037
  try {
22858
- const data = JSON.parse(readFileSync31(filePath, "utf8"));
23038
+ const data = JSON.parse(readFileSync32(filePath, "utf8"));
22859
23039
  const arr = data?.permissions?.[key];
22860
23040
  return Array.isArray(arr) ? arr.filter((e) => typeof e === "string") : [];
22861
23041
  } catch {
@@ -23125,14 +23305,14 @@ function findDocsPathDeny(toolName, rawCommand, root2) {
23125
23305
  }
23126
23306
 
23127
23307
  // src/commands/schema/isSchemaPath.ts
23128
- import { readFileSync as readFileSync32 } from "fs";
23308
+ import { readFileSync as readFileSync33 } from "fs";
23129
23309
  import { relative as relative7, resolve as resolve21 } from "path";
23130
23310
  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
23311
  var FIXED_SCHEMA_PATH = /^src\/shared\/db\/(?:migrations\/migration\d{4}[^/]*\.ts|migrations\.ts|schema\.ts)$/;
23132
23312
  var DB_MODULE = /^src\/shared\/db\/[^/]+\.ts$/;
23133
23313
  function readOrEmpty2(path109) {
23134
23314
  try {
23135
- return readFileSync32(path109, "utf8");
23315
+ return readFileSync33(path109, "utf8");
23136
23316
  } catch {
23137
23317
  return "";
23138
23318
  }
@@ -23199,13 +23379,13 @@ function findSchemaPathDeny(toolName, rawCommand, root2 = getProjectRoot()) {
23199
23379
  }
23200
23380
 
23201
23381
  // src/commands/cliHook/logDeniedToolCall.ts
23202
- import { mkdirSync as mkdirSync15 } from "fs";
23382
+ import { mkdirSync as mkdirSync16 } from "fs";
23203
23383
  import { homedir as homedir19 } from "os";
23204
- import { join as join56 } from "path";
23384
+ import { join as join57 } from "path";
23205
23385
  import Database from "better-sqlite3";
23206
23386
  var _db;
23207
23387
  function getDbDir() {
23208
- return join56(homedir19(), ".assist");
23388
+ return join57(homedir19(), ".assist");
23209
23389
  }
23210
23390
  function initSchema(db) {
23211
23391
  db.exec(`
@@ -23223,8 +23403,8 @@ function initSchema(db) {
23223
23403
  function openPromptsDb(dir) {
23224
23404
  if (_db) return _db;
23225
23405
  const dbDir = dir ?? getDbDir();
23226
- mkdirSync15(dbDir, { recursive: true });
23227
- const db = new Database(join56(dbDir, "assist.db"));
23406
+ mkdirSync16(dbDir, { recursive: true });
23407
+ const db = new Database(join57(dbDir, "assist.db"));
23228
23408
  db.pragma("journal_mode = WAL");
23229
23409
  initSchema(db);
23230
23410
  _db = db;
@@ -23291,26 +23471,26 @@ function tryParseInput(raw) {
23291
23471
  import { existsSync as existsSync51 } from "fs";
23292
23472
 
23293
23473
  // src/commands/schema/getSchemaSessionApprovalPath.ts
23294
- import { join as join58 } from "path";
23474
+ import { join as join59 } from "path";
23295
23475
 
23296
23476
  // src/commands/codeComment/getRestrictedDir.ts
23297
23477
  import { homedir as homedir20 } from "os";
23298
- import { join as join57 } from "path";
23478
+ import { join as join58 } from "path";
23299
23479
  function getRestrictedDir() {
23300
- return join57(homedir20(), ".assist", "restricted");
23480
+ return join58(homedir20(), ".assist", "restricted");
23301
23481
  }
23302
23482
  function getPinStatePath(pin2) {
23303
- return join57(getRestrictedDir(), `code-comment-${pin2}.json`);
23483
+ return join58(getRestrictedDir(), `code-comment-${pin2}.json`);
23304
23484
  }
23305
23485
 
23306
23486
  // src/commands/schema/getSchemaSessionApprovalPath.ts
23307
23487
  var SESSION_ID = /^[\w-]+$/;
23308
23488
  function getSchemaSessionApprovalDir() {
23309
- return join58(getRestrictedDir(), "schema-sessions");
23489
+ return join59(getRestrictedDir(), "schema-sessions");
23310
23490
  }
23311
23491
  function getSchemaSessionApprovalPath(claudeSessionId) {
23312
23492
  if (!SESSION_ID.test(claudeSessionId)) return void 0;
23313
- return join58(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
23493
+ return join59(getSchemaSessionApprovalDir(), `${claudeSessionId}.json`);
23314
23494
  }
23315
23495
 
23316
23496
  // src/commands/schema/isSchemaLocked.ts
@@ -23407,9 +23587,9 @@ ${reasons.join("\n")}`);
23407
23587
  }
23408
23588
 
23409
23589
  // src/commands/permitCliReads.ts
23410
- import { existsSync as existsSync52, mkdirSync as mkdirSync16, readFileSync as readFileSync33, writeFileSync as writeFileSync25 } from "fs";
23590
+ import { existsSync as existsSync52, mkdirSync as mkdirSync17, readFileSync as readFileSync34, writeFileSync as writeFileSync26 } from "fs";
23411
23591
  import { homedir as homedir21 } from "os";
23412
- import { join as join59 } from "path";
23592
+ import { join as join60 } from "path";
23413
23593
 
23414
23594
  // src/commands/permitCliReads/assertCliExists.ts
23415
23595
  function assertCliExists(cli) {
@@ -23672,17 +23852,17 @@ function updateSettings(cli, commands) {
23672
23852
  // src/commands/permitCliReads.ts
23673
23853
  function logPath(cli) {
23674
23854
  const safeName = cli.replace(/\s+/g, "-");
23675
- return join59(homedir21(), ".assist", `cli-discover-${safeName}.log`);
23855
+ return join60(homedir21(), ".assist", `cli-discover-${safeName}.log`);
23676
23856
  }
23677
23857
  function readCache(cli) {
23678
23858
  const path109 = logPath(cli);
23679
23859
  if (!existsSync52(path109)) return void 0;
23680
- return readFileSync33(path109, "utf8");
23860
+ return readFileSync34(path109, "utf8");
23681
23861
  }
23682
23862
  function writeCache(cli, output) {
23683
- const dir = join59(homedir21(), ".assist");
23684
- mkdirSync16(dir, { recursive: true });
23685
- writeFileSync25(logPath(cli), output);
23863
+ const dir = join60(homedir21(), ".assist");
23864
+ mkdirSync17(dir, { recursive: true });
23865
+ writeFileSync26(logPath(cli), output);
23686
23866
  }
23687
23867
  async function permitCliReads(cli, options2 = { noCache: false }) {
23688
23868
  if (!cli) {
@@ -23812,7 +23992,7 @@ function registerCliHook(program) {
23812
23992
  }
23813
23993
 
23814
23994
  // src/commands/codeComment/codeCommentConfirm.ts
23815
- import { existsSync as existsSync54, readFileSync as readFileSync35, unlinkSync as unlinkSync8, writeFileSync as writeFileSync26 } from "fs";
23995
+ import { existsSync as existsSync54, readFileSync as readFileSync36, unlinkSync as unlinkSync8, writeFileSync as writeFileSync27 } from "fs";
23816
23996
  import chalk120 from "chalk";
23817
23997
 
23818
23998
  // src/shared/isHashCommentFile.ts
@@ -23846,7 +24026,7 @@ function isHashCommentFile(filePath) {
23846
24026
 
23847
24027
  // src/commands/codeComment/sweepRestrictedDir.ts
23848
24028
  import { readdirSync as readdirSync9, statSync as statSync8, unlinkSync as unlinkSync7 } from "fs";
23849
- import { join as join60 } from "path";
24029
+ import { join as join61 } from "path";
23850
24030
  var STALE_AFTER_MS = 30 * 60 * 1e3;
23851
24031
  function sweepRestrictedDir(dir = getRestrictedDir()) {
23852
24032
  let entries;
@@ -23857,7 +24037,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
23857
24037
  }
23858
24038
  const cutoff = Date.now() - STALE_AFTER_MS;
23859
24039
  for (const entry of entries) {
23860
- const path109 = join60(dir, entry);
24040
+ const path109 = join61(dir, entry);
23861
24041
  try {
23862
24042
  if (statSync8(path109).mtimeMs < cutoff) unlinkSync7(path109);
23863
24043
  } catch {
@@ -23867,12 +24047,12 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
23867
24047
  }
23868
24048
 
23869
24049
  // src/commands/codeComment/readPinState.ts
23870
- import { existsSync as existsSync53, readFileSync as readFileSync34 } from "fs";
24050
+ import { existsSync as existsSync53, readFileSync as readFileSync35 } from "fs";
23871
24051
  function readPinState(pin2) {
23872
24052
  const path109 = getPinStatePath(pin2);
23873
24053
  if (!existsSync53(path109)) return void 0;
23874
24054
  try {
23875
- const state = JSON.parse(readFileSync34(path109, "utf8"));
24055
+ const state = JSON.parse(readFileSync35(path109, "utf8"));
23876
24056
  if (state.pin !== pin2) return void 0;
23877
24057
  return state;
23878
24058
  } catch {
@@ -23894,7 +24074,7 @@ function codeCommentConfirm(pin2) {
23894
24074
  process.exitCode = 1;
23895
24075
  return;
23896
24076
  }
23897
- const original = readFileSync35(state.file, "utf8");
24077
+ const original = readFileSync36(state.file, "utf8");
23898
24078
  const lines2 = original.split("\n");
23899
24079
  const index3 = state.line - 1;
23900
24080
  if (index3 > lines2.length) {
@@ -23910,7 +24090,7 @@ function codeCommentConfirm(pin2) {
23910
24090
  const indentSource = lines2[index3] ?? "";
23911
24091
  const indent4 = indentSource.match(/^\s*/)?.[0] ?? "";
23912
24092
  lines2.splice(index3, 0, `${indent4}${marker2} ${state.text}`);
23913
- writeFileSync26(state.file, lines2.join("\n"));
24093
+ writeFileSync27(state.file, lines2.join("\n"));
23914
24094
  unlinkSync8(getPinStatePath(pin2));
23915
24095
  console.log(
23916
24096
  chalk120.green(
@@ -23948,7 +24128,7 @@ function validateCommentText(raw, isHash = false) {
23948
24128
  }
23949
24129
 
23950
24130
  // src/commands/codeComment/issuePin.ts
23951
- import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
24131
+ import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync28 } from "fs";
23952
24132
  import { randomInt } from "crypto";
23953
24133
 
23954
24134
  // src/commands/notify/deliverPinNotification.ts
@@ -24033,9 +24213,9 @@ async function deliverPinNotification(notification) {
24033
24213
  // src/commands/codeComment/issuePin.ts
24034
24214
  function issuePin(file, lineNumber, text20) {
24035
24215
  const pin2 = generatePin();
24036
- mkdirSync17(getRestrictedDir(), { recursive: true });
24216
+ mkdirSync18(getRestrictedDir(), { recursive: true });
24037
24217
  sweepRestrictedDir();
24038
- writeFileSync27(
24218
+ writeFileSync28(
24039
24219
  getPinStatePath(pin2),
24040
24220
  JSON.stringify({ pin: pin2, file, line: lineNumber, text: text20 })
24041
24221
  );
@@ -26074,7 +26254,7 @@ async function browserInspect(selector, options2) {
26074
26254
  }
26075
26255
 
26076
26256
  // src/commands/browser/browserRun.ts
26077
- import { readFileSync as readFileSync36 } from "fs";
26257
+ import { readFileSync as readFileSync37 } from "fs";
26078
26258
  import chalk149 from "chalk";
26079
26259
 
26080
26260
  // src/commands/browser/formatRunOutcome.ts
@@ -26094,7 +26274,7 @@ function formatRunOutcome(run4) {
26094
26274
  async function browserRun(options2) {
26095
26275
  let code;
26096
26276
  try {
26097
- code = readFileSync36(options2.file, "utf8");
26277
+ code = readFileSync37(options2.file, "utf8");
26098
26278
  } catch (error) {
26099
26279
  console.error(
26100
26280
  chalk149.red(
@@ -26119,16 +26299,16 @@ async function browserRun(options2) {
26119
26299
  }
26120
26300
 
26121
26301
  // src/commands/browser/browserSnapshot.ts
26122
- import { mkdirSync as mkdirSync18, writeFileSync as writeFileSync28 } from "fs";
26123
- import { dirname as dirname30 } from "path";
26302
+ import { mkdirSync as mkdirSync19, writeFileSync as writeFileSync29 } from "fs";
26303
+ import { dirname as dirname31 } from "path";
26124
26304
 
26125
26305
  // src/commands/browser/snapshotPath.ts
26126
26306
  import { homedir as homedir22 } from "os";
26127
- import { join as join61 } from "path";
26307
+ import { join as join62 } from "path";
26128
26308
  function snapshotPath(tabUrl, now) {
26129
26309
  const host = new URL(tabUrl).host.replace(/[^\w.-]/g, "-");
26130
26310
  const timestamp9 = now.toISOString().replace(/[:.]/g, "-");
26131
- return join61(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
26311
+ return join62(homedir22(), ".assist", "browser", `${host}-${timestamp9}.html`);
26132
26312
  }
26133
26313
 
26134
26314
  // src/commands/browser/browserSnapshot.ts
@@ -26138,8 +26318,8 @@ async function browserSnapshot(options2) {
26138
26318
  url: options2.url
26139
26319
  });
26140
26320
  const path109 = snapshotPath(result.tabUrl, /* @__PURE__ */ new Date());
26141
- mkdirSync18(dirname30(path109), { recursive: true });
26142
- writeFileSync28(path109, result.html);
26321
+ mkdirSync19(dirname31(path109), { recursive: true });
26322
+ writeFileSync29(path109, result.html);
26143
26323
  console.log(`snapshot: ${path109}`);
26144
26324
  }
26145
26325
 
@@ -26335,15 +26515,15 @@ async function printExtensionUrl() {
26335
26515
  // src/commands/extension/signExtension.ts
26336
26516
  import { rm as rm2 } from "fs/promises";
26337
26517
  import { homedir as homedir23, tmpdir as tmpdir3 } from "os";
26338
- import { join as join67 } from "path";
26518
+ import { join as join68 } from "path";
26339
26519
  import chalk154 from "chalk";
26340
26520
 
26341
26521
  // src/commands/extension/copySignedXpi.ts
26342
26522
  import { copyFile } from "fs/promises";
26343
- import { join as join62 } from "path";
26523
+ import { join as join63 } from "path";
26344
26524
  var SIGNED_XPI_NAME = "assist-extension.xpi";
26345
26525
  async function copySignedXpi(xpi, dir) {
26346
- const fixed2 = join62(dir, SIGNED_XPI_NAME);
26526
+ const fixed2 = join63(dir, SIGNED_XPI_NAME);
26347
26527
  if (fixed2 === xpi) return fixed2;
26348
26528
  await copyFile(xpi, fixed2);
26349
26529
  return fixed2;
@@ -26352,11 +26532,11 @@ async function copySignedXpi(xpi, dir) {
26352
26532
  // src/commands/extension/findSignedXpi.ts
26353
26533
  import { existsSync as existsSync55 } from "fs";
26354
26534
  import { readdir } from "fs/promises";
26355
- import { join as join63 } from "path";
26535
+ import { join as join64 } from "path";
26356
26536
  async function findSignedXpi(dir) {
26357
26537
  if (!existsSync55(dir)) return null;
26358
26538
  const name = (await readdir(dir)).find((entry) => entry.endsWith(".xpi"));
26359
- return name ? join63(dir, name) : null;
26539
+ return name ? join64(dir, name) : null;
26360
26540
  }
26361
26541
 
26362
26542
  // src/commands/extension/signedAddonInstallPath.ts
@@ -26379,10 +26559,10 @@ async function signedAddonInstallPath(xpi) {
26379
26559
 
26380
26560
  // src/commands/extension/signPreflightProblem.ts
26381
26561
  import { existsSync as existsSync56 } from "fs";
26382
- import { join as join64 } from "path";
26562
+ import { join as join65 } from "path";
26383
26563
  var KEY_URL = "https://addons.mozilla.org/en-US/developers/addon/api/key/";
26384
26564
  function signPreflightProblem(source) {
26385
- if (!existsSync56(join64(source, "content.js")))
26565
+ if (!existsSync56(join65(source, "content.js")))
26386
26566
  return {
26387
26567
  message: `no content.js in ${source}`,
26388
26568
  hint: "run npm run build to bundle the content script"
@@ -26397,7 +26577,7 @@ function signPreflightProblem(source) {
26397
26577
 
26398
26578
  // src/commands/extension/stageExtension.ts
26399
26579
  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";
26580
+ import { basename as basename16, join as join66 } from "path";
26401
26581
 
26402
26582
  // src/commands/extension/stampManifestVersion.ts
26403
26583
  function stampManifestVersion(manifest, version2) {
@@ -26414,7 +26594,7 @@ async function stageExtension(source, staging, version2) {
26414
26594
  recursive: true,
26415
26595
  filter: (path109) => basename16(path109) !== "updates.json"
26416
26596
  });
26417
- const manifest = join65(staging, "manifest.json");
26597
+ const manifest = join66(staging, "manifest.json");
26418
26598
  const stamped = stampManifestVersion(
26419
26599
  await readFile5(manifest, "utf8"),
26420
26600
  version2
@@ -26424,7 +26604,7 @@ async function stageExtension(source, staging, version2) {
26424
26604
 
26425
26605
  // src/commands/extension/writeUpdateManifest.ts
26426
26606
  import { readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
26427
- import { join as join66 } from "path";
26607
+ import { join as join67 } from "path";
26428
26608
 
26429
26609
  // src/commands/extension/buildUpdateManifest.ts
26430
26610
  var RELEASE_DOWNLOAD_URL = "https://github.com/staff0rd/assist/releases/download";
@@ -26449,17 +26629,17 @@ function buildUpdateManifest(manifest, version2) {
26449
26629
  // src/commands/extension/writeUpdateManifest.ts
26450
26630
  async function writeUpdateManifest(source, dir, version2) {
26451
26631
  await writeFile5(
26452
- join66(dir, "updates.json"),
26632
+ join67(dir, "updates.json"),
26453
26633
  buildUpdateManifest(
26454
- await readFile6(join66(source, "manifest.json"), "utf8"),
26634
+ await readFile6(join67(source, "manifest.json"), "utf8"),
26455
26635
  version2
26456
26636
  )
26457
26637
  );
26458
26638
  }
26459
26639
 
26460
26640
  // src/commands/extension/signExtension.ts
26461
- var ARTIFACTS_DIR = join67(homedir23(), ".assist", "extension");
26462
- var STAGING_DIR = join67(tmpdir3(), "assist-extension");
26641
+ var ARTIFACTS_DIR = join68(homedir23(), ".assist", "extension");
26642
+ var STAGING_DIR = join68(tmpdir3(), "assist-extension");
26463
26643
  async function signExtension() {
26464
26644
  const source = extensionDir();
26465
26645
  const problem = signPreflightProblem(source);
@@ -26643,7 +26823,7 @@ function registerDb(program) {
26643
26823
  }
26644
26824
 
26645
26825
  // src/commands/deploy/redirect.ts
26646
- import { existsSync as existsSync57, readFileSync as readFileSync37, writeFileSync as writeFileSync29 } from "fs";
26826
+ import { existsSync as existsSync57, readFileSync as readFileSync38, writeFileSync as writeFileSync30 } from "fs";
26647
26827
  import chalk157 from "chalk";
26648
26828
  var TRAILING_SLASH_SCRIPT = ` <script>
26649
26829
  if (!window.location.pathname.endsWith('/')) {
@@ -26656,7 +26836,7 @@ function redirect() {
26656
26836
  console.log(chalk157.yellow("No index.html found"));
26657
26837
  return;
26658
26838
  }
26659
- const content = readFileSync37(indexPath, "utf8");
26839
+ const content = readFileSync38(indexPath, "utf8");
26660
26840
  if (content.includes("window.location.pathname.endsWith('/')")) {
26661
26841
  console.log(chalk157.dim("Trailing slash script already present"));
26662
26842
  return;
@@ -26668,7 +26848,7 @@ function redirect() {
26668
26848
  }
26669
26849
  const newContent = `${content.slice(0, headCloseIndex) + TRAILING_SLASH_SCRIPT}
26670
26850
  ${content.slice(headCloseIndex)}`;
26671
- writeFileSync29(indexPath, newContent);
26851
+ writeFileSync30(indexPath, newContent);
26672
26852
  console.log(chalk157.green("Added trailing slash redirect to index.html"));
26673
26853
  }
26674
26854
 
@@ -26747,22 +26927,22 @@ function printWeekHeader(week, state) {
26747
26927
  }
26748
26928
 
26749
26929
  // src/commands/devlog/loadDevEntry.ts
26750
- import { readFileSync as readFileSync38 } from "fs";
26751
- import { join as join68 } from "path";
26930
+ import { readFileSync as readFileSync39 } from "fs";
26931
+ import { join as join69 } from "path";
26752
26932
  import { parse as parseYaml3 } from "yaml";
26753
26933
  function asString(value) {
26754
26934
  return value === void 0 || value === null ? null : String(value);
26755
26935
  }
26756
26936
  function readFrontmatter(path109) {
26757
26937
  try {
26758
- const match = readFileSync38(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
26938
+ const match = readFileSync39(path109, "utf8").match(/^---\n([\s\S]*?)\n---/);
26759
26939
  return match ? parseYaml3(match[1]) ?? {} : null;
26760
26940
  } catch {
26761
26941
  return null;
26762
26942
  }
26763
26943
  }
26764
26944
  function loadDevEntry(repoName, week, devDir) {
26765
- const path109 = join68(devDir, repoName, `${week.toLowerCase()}.md`);
26945
+ const path109 = join69(devDir, repoName, `${week.toLowerCase()}.md`);
26766
26946
  const frontmatter2 = readFrontmatter(path109);
26767
26947
  if (!frontmatter2) return null;
26768
26948
  const versions = frontmatter2.versions;
@@ -26858,17 +27038,17 @@ function findTargetWeek(weeks, { lastWeek, skip: skip3, today }) {
26858
27038
  import chalk160 from "chalk";
26859
27039
 
26860
27040
  // src/shared/getRepoName.ts
26861
- import { existsSync as existsSync58, readFileSync as readFileSync39 } from "fs";
26862
- import { basename as basename17, join as join69 } from "path";
27041
+ import { existsSync as existsSync58, readFileSync as readFileSync40 } from "fs";
27042
+ import { basename as basename17, join as join70 } from "path";
26863
27043
  function getRepoName() {
26864
27044
  const config = loadConfig();
26865
27045
  if (config.devlog?.name) {
26866
27046
  return config.devlog.name;
26867
27047
  }
26868
- const packageJsonPath = join69(process.cwd(), "package.json");
27048
+ const packageJsonPath = join70(process.cwd(), "package.json");
26869
27049
  if (existsSync58(packageJsonPath)) {
26870
27050
  try {
26871
- const content = readFileSync39(packageJsonPath, "utf8");
27051
+ const content = readFileSync40(packageJsonPath, "utf8");
26872
27052
  const pkg = JSON.parse(content);
26873
27053
  if (pkg.name) {
26874
27054
  return pkg.name;
@@ -26944,7 +27124,7 @@ function list2(options2) {
26944
27124
 
26945
27125
  // src/commands/devlog/loadDevWeeks.ts
26946
27126
  import { readdirSync as readdirSync10 } from "fs";
26947
- import { join as join70 } from "path";
27127
+ import { join as join71 } from "path";
26948
27128
  var DEV_FILENAME_PATTERN = /^(\d{4})-w(\d{2})\.md$/;
26949
27129
  function parseDevWeekFilename(filename) {
26950
27130
  const match = filename.match(DEV_FILENAME_PATTERN);
@@ -26958,7 +27138,7 @@ function readFilenames(dir) {
26958
27138
  }
26959
27139
  }
26960
27140
  function loadDevWeeks(repoName, devDir) {
26961
- return readFilenames(join70(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
27141
+ return readFilenames(join71(devDir, repoName)).map(parseDevWeekFilename).filter((week) => week !== null).sort();
26962
27142
  }
26963
27143
 
26964
27144
  // src/commands/devlog/next/displayNextEntry.ts
@@ -27112,8 +27292,8 @@ async function skip2(week, cwd = process.cwd()) {
27112
27292
  }
27113
27293
 
27114
27294
  // 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";
27295
+ import { mkdirSync as mkdirSync20, writeFileSync as writeFileSync31 } from "fs";
27296
+ import { dirname as dirname32, join as join72 } from "path";
27117
27297
  import chalk164 from "chalk";
27118
27298
 
27119
27299
  // src/commands/devlog/write/devEntryInputSchema.ts
@@ -27206,9 +27386,9 @@ async function write() {
27206
27386
  }
27207
27387
  const devDir = resolveDevDir();
27208
27388
  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));
27389
+ const path109 = join72(devDir, repoName, `${result.data.week.toLowerCase()}.md`);
27390
+ mkdirSync20(dirname32(path109), { recursive: true });
27391
+ writeFileSync31(path109, formatDevEntry(repoName, result.data));
27212
27392
  console.log(chalk164.green(`Wrote ${path109}`));
27213
27393
  }
27214
27394
 
@@ -27394,13 +27574,13 @@ async function findPhaseUnlockItem(itemId2, phase) {
27394
27574
  }
27395
27575
 
27396
27576
  // src/commands/docs/getDocsUnlockPinPath.ts
27397
- import { join as join72 } from "path";
27577
+ import { join as join73 } from "path";
27398
27578
  function getDocsUnlockPinPath(pin2) {
27399
- return join72(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
27579
+ return join73(getRestrictedDir(), `docs-unlock-pin-${pin2}.json`);
27400
27580
  }
27401
27581
 
27402
27582
  // src/commands/docs/readDocsUnlockPinState.ts
27403
- import { existsSync as existsSync59, readFileSync as readFileSync40 } from "fs";
27583
+ import { existsSync as existsSync59, readFileSync as readFileSync41 } from "fs";
27404
27584
  function isPositiveInteger(value) {
27405
27585
  return Number.isInteger(value) && value > 0;
27406
27586
  }
@@ -27408,7 +27588,7 @@ function readDocsUnlockPinState(pin2) {
27408
27588
  const path109 = getDocsUnlockPinPath(pin2);
27409
27589
  if (!existsSync59(path109)) return void 0;
27410
27590
  try {
27411
- const state = JSON.parse(readFileSync40(path109, "utf8"));
27591
+ const state = JSON.parse(readFileSync41(path109, "utf8"));
27412
27592
  if (state.pin !== pin2) return void 0;
27413
27593
  if (!isPositiveInteger(state.itemId)) return void 0;
27414
27594
  if (!isPositiveInteger(state.phase)) return void 0;
@@ -27457,7 +27637,7 @@ import chalk169 from "chalk";
27457
27637
 
27458
27638
  // src/commands/notify/issueUnlockPin.ts
27459
27639
  import { randomInt as randomInt2 } from "crypto";
27460
- import { mkdirSync as mkdirSync20, unlinkSync as unlinkSync10, writeFileSync as writeFileSync31 } from "fs";
27640
+ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync10, writeFileSync as writeFileSync32 } from "fs";
27461
27641
  async function issueUnlockPin({
27462
27642
  area,
27463
27643
  label,
@@ -27465,10 +27645,10 @@ async function issueUnlockPin({
27465
27645
  state
27466
27646
  }) {
27467
27647
  const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
27468
- mkdirSync20(getRestrictedDir(), { recursive: true });
27648
+ mkdirSync21(getRestrictedDir(), { recursive: true });
27469
27649
  sweepRestrictedDir();
27470
27650
  const path109 = pinPath(pin2);
27471
- writeFileSync31(path109, JSON.stringify({ ...state, pin: pin2 }));
27651
+ writeFileSync32(path109, JSON.stringify({ ...state, pin: pin2 }));
27472
27652
  const delivery = await deliverPinNotification({
27473
27653
  area,
27474
27654
  pin: pin2,
@@ -27540,17 +27720,17 @@ function registerDocs(parent) {
27540
27720
  }
27541
27721
 
27542
27722
  // src/commands/schema/schemaConfirm.ts
27543
- import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as writeFileSync32 } from "fs";
27723
+ import { mkdirSync as mkdirSync22, unlinkSync as unlinkSync11, writeFileSync as writeFileSync33 } from "fs";
27544
27724
  import chalk170 from "chalk";
27545
27725
 
27546
27726
  // src/commands/schema/getSchemaUnlockPinPath.ts
27547
- import { join as join73 } from "path";
27727
+ import { join as join74 } from "path";
27548
27728
  function getSchemaUnlockPinPath(pin2) {
27549
- return join73(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
27729
+ return join74(getRestrictedDir(), `schema-unlock-pin-${pin2}.json`);
27550
27730
  }
27551
27731
 
27552
27732
  // src/commands/schema/readSchemaUnlockPinState.ts
27553
- import { existsSync as existsSync60, readFileSync as readFileSync41 } from "fs";
27733
+ import { existsSync as existsSync60, readFileSync as readFileSync42 } from "fs";
27554
27734
  function isPositiveInteger2(value) {
27555
27735
  return Number.isInteger(value) && value > 0;
27556
27736
  }
@@ -27566,7 +27746,7 @@ function readSchemaUnlockPinState(pin2) {
27566
27746
  const path109 = getSchemaUnlockPinPath(pin2);
27567
27747
  if (!existsSync60(path109)) return void 0;
27568
27748
  try {
27569
- const raw = JSON.parse(readFileSync41(path109, "utf8"));
27749
+ const raw = JSON.parse(readFileSync42(path109, "utf8"));
27570
27750
  if (raw.pin !== pin2) return void 0;
27571
27751
  return toState(raw);
27572
27752
  } catch {
@@ -27592,8 +27772,8 @@ async function approveItemPhase(itemId2, phase) {
27592
27772
  function approveClaudeSession(claudeSessionId) {
27593
27773
  const path109 = getSchemaSessionApprovalPath(claudeSessionId);
27594
27774
  if (!path109) return;
27595
- mkdirSync21(getSchemaSessionApprovalDir(), { recursive: true });
27596
- writeFileSync32(path109, JSON.stringify({ claudeSessionId }));
27775
+ mkdirSync22(getSchemaSessionApprovalDir(), { recursive: true });
27776
+ writeFileSync33(path109, JSON.stringify({ claudeSessionId }));
27597
27777
  console.log(
27598
27778
  chalk170.green(
27599
27779
  `Approved schema changes for Claude session ${claudeSessionId}. It may edit and commit database schema files until the session ends.`
@@ -27689,7 +27869,7 @@ function registerSchema(parent) {
27689
27869
 
27690
27870
  // src/commands/dotnet/checkBuildLocks.ts
27691
27871
  import { closeSync as closeSync5, openSync as openSync6, readdirSync as readdirSync12 } from "fs";
27692
- import { join as join74 } from "path";
27872
+ import { join as join75 } from "path";
27693
27873
  import chalk172 from "chalk";
27694
27874
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
27695
27875
  function isLockedDll(debugDir) {
@@ -27701,7 +27881,7 @@ function isLockedDll(debugDir) {
27701
27881
  }
27702
27882
  for (const file of files) {
27703
27883
  if (!file.toLowerCase().endsWith(".dll")) continue;
27704
- const dllPath = join74(debugDir, file);
27884
+ const dllPath = join75(debugDir, file);
27705
27885
  try {
27706
27886
  const fd = openSync6(dllPath, "r+");
27707
27887
  closeSync5(fd);
@@ -27719,13 +27899,13 @@ function findFirstLockedDll(dir) {
27719
27899
  return null;
27720
27900
  }
27721
27901
  if (entries.includes("bin")) {
27722
- const locked = isLockedDll(join74(dir, "bin", "Debug"));
27902
+ const locked = isLockedDll(join75(dir, "bin", "Debug"));
27723
27903
  if (locked) return locked;
27724
27904
  }
27725
27905
  for (const entry of entries) {
27726
27906
  if (SKIP_DIRS.has(entry) || entry === "bin" || entry.startsWith("."))
27727
27907
  continue;
27728
- const found = findFirstLockedDll(join74(dir, entry));
27908
+ const found = findFirstLockedDll(join75(dir, entry));
27729
27909
  if (found) return found;
27730
27910
  }
27731
27911
  return null;
@@ -27748,11 +27928,11 @@ async function checkBuildLocksCommand() {
27748
27928
  }
27749
27929
 
27750
27930
  // src/commands/dotnet/buildTree.ts
27751
- import { readFileSync as readFileSync42 } from "fs";
27931
+ import { readFileSync as readFileSync43 } from "fs";
27752
27932
  import path36 from "path";
27753
27933
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
27754
27934
  function getProjectRefs(csprojPath) {
27755
- const content = readFileSync42(csprojPath, "utf8");
27935
+ const content = readFileSync43(csprojPath, "utf8");
27756
27936
  const refs = [];
27757
27937
  for (const match of content.matchAll(PROJECT_REF_RE)) {
27758
27938
  refs.push(match[1].replace(/\\/g, "/"));
@@ -27769,7 +27949,7 @@ function buildTree(csprojPath, repoRoot2, visited = /* @__PURE__ */ new Set()) {
27769
27949
  for (const ref of getProjectRefs(abs)) {
27770
27950
  const childAbs = path36.resolve(dir, ref);
27771
27951
  try {
27772
- readFileSync42(childAbs);
27952
+ readFileSync43(childAbs);
27773
27953
  node.children.push(buildTree(childAbs, repoRoot2, visited));
27774
27954
  } catch {
27775
27955
  node.children.push({
@@ -27794,7 +27974,7 @@ function collectAllDeps(node) {
27794
27974
  }
27795
27975
 
27796
27976
  // src/commands/dotnet/findContainingSolutions.ts
27797
- import { readdirSync as readdirSync13, readFileSync as readFileSync43, statSync as statSync9 } from "fs";
27977
+ import { readdirSync as readdirSync13, readFileSync as readFileSync44, statSync as statSync9 } from "fs";
27798
27978
  import path37 from "path";
27799
27979
  function findSlnFiles(dir, maxDepth, depth = 0) {
27800
27980
  if (depth > maxDepth) return [];
@@ -27829,7 +28009,7 @@ function findContainingSolutions(csprojPath, repoRoot2) {
27829
28009
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
27830
28010
  for (const sln of slnFiles) {
27831
28011
  try {
27832
- const content = readFileSync43(sln, "utf8");
28012
+ const content = readFileSync44(sln, "utf8");
27833
28013
  if (pattern2.test(content)) {
27834
28014
  matches.push(path37.relative(repoRoot2, sln));
27835
28015
  }
@@ -28072,11 +28252,11 @@ import chalk178 from "chalk";
28072
28252
 
28073
28253
  // src/commands/dotnet/findSolution.ts
28074
28254
  import { readdirSync as readdirSync14 } from "fs";
28075
- import { dirname as dirname32, join as join75 } from "path";
28255
+ import { dirname as dirname33, join as join76 } from "path";
28076
28256
  import chalk177 from "chalk";
28077
28257
  function findSlnInDir(dir) {
28078
28258
  try {
28079
- return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join75(dir, f));
28259
+ return readdirSync14(dir).filter((f) => f.endsWith(".sln")).map((f) => join76(dir, f));
28080
28260
  } catch {
28081
28261
  return [];
28082
28262
  }
@@ -28097,7 +28277,7 @@ function findSolution() {
28097
28277
  process.exit(1);
28098
28278
  }
28099
28279
  if (current === ceiling) break;
28100
- current = dirname32(current);
28280
+ current = dirname33(current);
28101
28281
  }
28102
28282
  console.error(chalk177.red("No .sln file found between cwd and repo root"));
28103
28283
  process.exit(1);
@@ -28147,7 +28327,7 @@ function parseInspectReport(json) {
28147
28327
 
28148
28328
  // src/commands/dotnet/runInspectCode.ts
28149
28329
  import { execSync as execSync40 } from "child_process";
28150
- import { existsSync as existsSync63, readFileSync as readFileSync44, unlinkSync as unlinkSync12 } from "fs";
28330
+ import { existsSync as existsSync63, readFileSync as readFileSync45, unlinkSync as unlinkSync12 } from "fs";
28151
28331
  import { tmpdir as tmpdir4 } from "os";
28152
28332
  import path40 from "path";
28153
28333
  import chalk179 from "chalk";
@@ -28182,7 +28362,7 @@ function runInspectCode(slnPath, include, swea) {
28182
28362
  console.error(chalk179.red("Report file not generated"));
28183
28363
  process.exit(1);
28184
28364
  }
28185
- const xml = readFileSync44(reportPath, "utf8");
28365
+ const xml = readFileSync45(reportPath, "utf8");
28186
28366
  unlinkSync12(reportPath);
28187
28367
  return xml;
28188
28368
  }
@@ -28619,16 +28799,16 @@ var RAZOR_OPEN = "@*";
28619
28799
  var RAZOR_CLOSE = "*@";
28620
28800
  var HTML_OPEN = "<!--";
28621
28801
  var HTML_CLOSE = "-->";
28622
- function read(content, index3, open, close) {
28802
+ function read2(content, index3, open, close) {
28623
28803
  const found = content.indexOf(close, index3 + open.length);
28624
28804
  const end = found === -1 ? content.length : found + close.length;
28625
28805
  return { end, text: content.slice(index3, end) };
28626
28806
  }
28627
28807
  function readRazorComment(content, index3) {
28628
28808
  if (content.startsWith(RAZOR_OPEN, index3))
28629
- return read(content, index3, RAZOR_OPEN, RAZOR_CLOSE);
28809
+ return read2(content, index3, RAZOR_OPEN, RAZOR_CLOSE);
28630
28810
  if (content.startsWith(HTML_OPEN, index3))
28631
- return read(content, index3, HTML_OPEN, HTML_CLOSE);
28811
+ return read2(content, index3, HTML_OPEN, HTML_CLOSE);
28632
28812
  return void 0;
28633
28813
  }
28634
28814
 
@@ -29062,9 +29242,9 @@ function aggregateCommitters(authorLists) {
29062
29242
 
29063
29243
  // src/shared/runGhGraphql.ts
29064
29244
  import { spawnSync as spawnSync6 } from "child_process";
29065
- import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync33 } from "fs";
29245
+ import { unlinkSync as unlinkSync13, writeFileSync as writeFileSync34 } from "fs";
29066
29246
  import { tmpdir as tmpdir5 } from "os";
29067
- import { join as join76 } from "path";
29247
+ import { join as join77 } from "path";
29068
29248
  function buildArgs2(queryFile, vars) {
29069
29249
  const args = ["api", "graphql", "-F", `query=@${queryFile}`];
29070
29250
  for (const [key, value] of Object.entries(vars)) {
@@ -29074,8 +29254,8 @@ function buildArgs2(queryFile, vars) {
29074
29254
  return args;
29075
29255
  }
29076
29256
  function runGhGraphql(mutation, vars) {
29077
- const queryFile = join76(tmpdir5(), `gh-query-${Date.now()}.graphql`);
29078
- writeFileSync33(queryFile, mutation);
29257
+ const queryFile = join77(tmpdir5(), `gh-query-${Date.now()}.graphql`);
29258
+ writeFileSync34(queryFile, mutation);
29079
29259
  try {
29080
29260
  const result = spawnSync6("gh", buildArgs2(queryFile, vars), {
29081
29261
  encoding: "utf8",
@@ -30356,10 +30536,10 @@ import { basename as basename18 } from "path";
30356
30536
 
30357
30537
  // src/shared/removeStagedAttachments.ts
30358
30538
  import { rmSync as rmSync5 } from "fs";
30359
- import { dirname as dirname33 } from "path";
30539
+ import { dirname as dirname34 } from "path";
30360
30540
  function removeStagedAttachments(attachments) {
30361
30541
  for (const { path: path109 } of attachments) {
30362
- const dir = dirname33(path109);
30542
+ const dir = dirname34(path109);
30363
30543
  if (!isStagedAttachmentPath(dir)) continue;
30364
30544
  rmSync5(dir, { recursive: true, force: true });
30365
30545
  }
@@ -30522,26 +30702,26 @@ function slugFromUrl(url) {
30522
30702
  }
30523
30703
 
30524
30704
  // src/commands/github/issue/writeIssueWorkingFile.ts
30525
- import { mkdirSync as mkdirSync22, writeFileSync as writeFileSync34 } from "fs";
30705
+ import { mkdirSync as mkdirSync23, writeFileSync as writeFileSync35 } from "fs";
30526
30706
 
30527
30707
  // src/commands/github/issue/issueWorkingFile.ts
30528
- import { join as join77 } from "path";
30708
+ import { join as join78 } from "path";
30529
30709
  function issueWorkingFile(slug2, number) {
30530
30710
  const [owner = "unknown", repo = "unknown"] = slug2.split("/");
30531
- const dir = join77(getStoreDir(), "github-issues", owner, repo);
30711
+ const dir = join78(getStoreDir(), "github-issues", owner, repo);
30532
30712
  return {
30533
30713
  dir,
30534
- bodyPath: join77(dir, `${number}.md`),
30535
- metaPath: join77(dir, `${number}.json`)
30714
+ bodyPath: join78(dir, `${number}.md`),
30715
+ metaPath: join78(dir, `${number}.json`)
30536
30716
  };
30537
30717
  }
30538
30718
 
30539
30719
  // src/commands/github/issue/writeIssueWorkingFile.ts
30540
30720
  function writeIssueWorkingFile(slug2, number, target, updatedAt, body) {
30541
30721
  const { dir, bodyPath, metaPath } = issueWorkingFile(slug2, number);
30542
- mkdirSync22(dir, { recursive: true });
30543
- writeFileSync34(bodyPath, body);
30544
- writeFileSync34(
30722
+ mkdirSync23(dir, { recursive: true });
30723
+ writeFileSync35(bodyPath, body);
30724
+ writeFileSync35(
30545
30725
  metaPath,
30546
30726
  `${JSON.stringify({ target, updatedAt }, null, 2)}
30547
30727
  `
@@ -30567,14 +30747,14 @@ function fetchIssueToWorkingFile(number, repo) {
30567
30747
  }
30568
30748
 
30569
30749
  // src/commands/github/issue/resumeIssueBody.ts
30570
- import { existsSync as existsSync64, readFileSync as readFileSync45 } from "fs";
30750
+ import { existsSync as existsSync64, readFileSync as readFileSync46 } from "fs";
30571
30751
  function resumeIssueBody(slug2, number, updatedAt) {
30572
30752
  const { bodyPath, metaPath } = issueWorkingFile(slug2, number);
30573
30753
  if (!existsSync64(bodyPath) || !existsSync64(metaPath)) return void 0;
30574
30754
  try {
30575
- const meta = JSON.parse(readFileSync45(metaPath, "utf8"));
30755
+ const meta = JSON.parse(readFileSync46(metaPath, "utf8"));
30576
30756
  if (meta.updatedAt !== updatedAt) return void 0;
30577
- return readFileSync45(bodyPath, "utf8");
30757
+ return readFileSync46(bodyPath, "utf8");
30578
30758
  } catch {
30579
30759
  return void 0;
30580
30760
  }
@@ -31438,14 +31618,14 @@ function recentDaemonLogLines(includeRelayed = true) {
31438
31618
 
31439
31619
  // src/commands/sessions/daemon/worktree/createWorktree.ts
31440
31620
  import { existsSync as existsSync65 } from "fs";
31441
- import { basename as basename20, dirname as dirname34 } from "path";
31621
+ import { basename as basename20, dirname as dirname35 } from "path";
31442
31622
 
31443
31623
  // src/commands/sessions/daemon/worktree/nextWorktreePath.ts
31444
- import { basename as basename19, join as join78 } from "path";
31624
+ import { basename as basename19, join as join79 } from "path";
31445
31625
  function nextWorktreePath(clone, base, isTaken) {
31446
31626
  const name = basename19(clone);
31447
31627
  for (let n = 2; n < 1e3; n++) {
31448
- const candidate = join78(base, `${name}-${n}`);
31628
+ const candidate = join79(base, `${name}-${n}`);
31449
31629
  if (!isTaken(candidate)) return candidate;
31450
31630
  }
31451
31631
  throw new Error(`no free worktree suffix for ${clone}`);
@@ -31466,7 +31646,7 @@ async function cloneTrunkBranch(clone) {
31466
31646
  // src/commands/sessions/daemon/worktree/createWorktree.ts
31467
31647
  var FETCH_TIMEOUT_MS = 6e4;
31468
31648
  function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
31469
- const base = strategy.root ? expandTilde(strategy.root) : dirname34(clone);
31649
+ const base = strategy.root ? expandTilde(strategy.root) : dirname35(clone);
31470
31650
  const registered = new Set(listWorktreePaths(clone));
31471
31651
  const branches = new Set(listLocalBranches(clone));
31472
31652
  const isTaken = (candidate) => registered.has(candidate) || existsSync65(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename20(candidate));
@@ -31707,21 +31887,21 @@ function persistedTreeRoots() {
31707
31887
  }
31708
31888
 
31709
31889
  // 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";
31890
+ import { copyFileSync, existsSync as existsSync67, mkdirSync as mkdirSync24 } from "fs";
31891
+ import { dirname as dirname36, join as join81 } from "path";
31712
31892
 
31713
31893
  // src/commands/sessions/daemon/worktree/runInstall.ts
31714
31894
  import { resolve as resolve22 } from "path";
31715
31895
 
31716
31896
  // src/commands/sessions/daemon/worktree/detectInstallCommand.ts
31717
31897
  import { existsSync as existsSync66 } from "fs";
31718
- import { join as join79 } from "path";
31898
+ import { join as join80 } from "path";
31719
31899
  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";
31900
+ if (!existsSync66(join80(dir, "package.json"))) return null;
31901
+ if (existsSync66(join80(dir, "pnpm-lock.yaml"))) return "pnpm install";
31902
+ if (existsSync66(join80(dir, "yarn.lock"))) return "yarn install";
31903
+ if (existsSync66(join80(dir, "bun.lockb"))) return "bun install";
31904
+ if (existsSync66(join80(dir, "package-lock.json"))) return "npm ci";
31725
31905
  return "npm install";
31726
31906
  }
31727
31907
 
@@ -31886,11 +32066,11 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
31886
32066
  }
31887
32067
  function copyConfigFiles(worktreePath, clone, copy) {
31888
32068
  for (const rel of copy) {
31889
- const src = join80(clone, rel);
32069
+ const src = join81(clone, rel);
31890
32070
  if (!existsSync67(src)) continue;
31891
- const dest = join80(worktreePath, rel);
32071
+ const dest = join81(worktreePath, rel);
31892
32072
  try {
31893
- mkdirSync23(dirname35(dest), { recursive: true });
32073
+ mkdirSync24(dirname36(dest), { recursive: true });
31894
32074
  copyFileSync(src, dest);
31895
32075
  daemonLog(`worktree ${worktreePath} seeded ${rel}`);
31896
32076
  } catch (error) {
@@ -32357,12 +32537,12 @@ function registerLitellm(program) {
32357
32537
  }
32358
32538
 
32359
32539
  // src/commands/mermaidExport.ts
32360
- import { mkdirSync as mkdirSync24, readdirSync as readdirSync15 } from "fs";
32540
+ import { mkdirSync as mkdirSync25, readdirSync as readdirSync15 } from "fs";
32361
32541
  import { resolve as resolve24 } from "path";
32362
32542
  import chalk196 from "chalk";
32363
32543
 
32364
32544
  // src/commands/mermaid/exportFile.ts
32365
- import { readFileSync as readFileSync46, writeFileSync as writeFileSync35 } from "fs";
32545
+ import { readFileSync as readFileSync47, writeFileSync as writeFileSync36 } from "fs";
32366
32546
  import { basename as basename21, extname as extname4, resolve as resolve23 } from "path";
32367
32547
  import chalk195 from "chalk";
32368
32548
 
@@ -32388,7 +32568,7 @@ async function renderBlock(krokiUrl, source) {
32388
32568
 
32389
32569
  // src/commands/mermaid/exportFile.ts
32390
32570
  async function exportFile(file, outDir, krokiUrl, onlyIndex) {
32391
- const content = readFileSync46(file, "utf8");
32571
+ const content = readFileSync47(file, "utf8");
32392
32572
  const blocks = extractMermaidBlocks(content);
32393
32573
  const stem = basename21(file, extname4(file));
32394
32574
  if (onlyIndex !== void 0) {
@@ -32413,7 +32593,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
32413
32593
  if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
32414
32594
  const outPath = resolve23(outDir, `${stem}-${idx}.svg`);
32415
32595
  const svg = await renderBlock(krokiUrl, source);
32416
- writeFileSync35(outPath, svg, "utf8");
32596
+ writeFileSync36(outPath, svg, "utf8");
32417
32597
  console.log(chalk195.green(` \u2192 ${outPath}`));
32418
32598
  }
32419
32599
  }
@@ -32426,7 +32606,7 @@ function extractMermaidBlocks(markdown) {
32426
32606
  async function mermaidExport(file, options2 = {}) {
32427
32607
  const { mermaid } = loadConfig();
32428
32608
  const outDir = resolve24(process.cwd(), options2.out ?? ".");
32429
- mkdirSync24(outDir, { recursive: true });
32609
+ mkdirSync25(outDir, { recursive: true });
32430
32610
  if (options2.index !== void 0) {
32431
32611
  if (!Number.isInteger(options2.index) || options2.index < 1) {
32432
32612
  console.error(
@@ -32521,8 +32701,8 @@ function boardSource(raw, anchorId, options2) {
32521
32701
  import { stringify as stringify2 } from "yaml";
32522
32702
 
32523
32703
  // src/commands/miro/writeExtract.ts
32524
- import { mkdirSync as mkdirSync25, writeFileSync as writeFileSync36 } from "fs";
32525
- import { dirname as dirname36 } from "path";
32704
+ import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync37 } from "fs";
32705
+ import { dirname as dirname37 } from "path";
32526
32706
  import { stringify } from "yaml";
32527
32707
  function headerLines(header) {
32528
32708
  const { rect } = header;
@@ -32535,8 +32715,8 @@ function headerLines(header) {
32535
32715
  ];
32536
32716
  }
32537
32717
  function writeExtract(file, header, texts) {
32538
- mkdirSync25(dirname36(file), { recursive: true });
32539
- writeFileSync36(file, `${headerLines(header).join("\n")}
32718
+ mkdirSync26(dirname37(file), { recursive: true });
32719
+ writeFileSync37(file, `${headerLines(header).join("\n")}
32540
32720
  ${stringify(texts)}`);
32541
32721
  }
32542
32722
 
@@ -32600,14 +32780,14 @@ function applyIgnore(texts, ignore3) {
32600
32780
  }
32601
32781
 
32602
32782
  // src/commands/miro/readIgnoreList.ts
32603
- import { existsSync as existsSync68, readFileSync as readFileSync47 } from "fs";
32783
+ import { existsSync as existsSync68, readFileSync as readFileSync48 } from "fs";
32604
32784
  import { parse as parse2 } from "yaml";
32605
32785
  function readIgnoreList(file) {
32606
32786
  if (!existsSync68(file))
32607
32787
  throw new MiroExtractError(
32608
32788
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
32609
32789
  );
32610
- const parsed = parse2(readFileSync47(file, "utf8"));
32790
+ const parsed = parse2(readFileSync48(file, "utf8"));
32611
32791
  if (parsed === null || parsed === void 0) return [];
32612
32792
  if (!Array.isArray(parsed) || parsed.some((entry) => typeof entry !== "string"))
32613
32793
  throw new MiroExtractError(
@@ -32787,7 +32967,7 @@ async function pickAnchors(sessionId2, items2) {
32787
32967
  }
32788
32968
 
32789
32969
  // src/commands/miro/readMiroItems.ts
32790
- import { readFileSync as readFileSync48 } from "fs";
32970
+ import { readFileSync as readFileSync49 } from "fs";
32791
32971
  function tryParse(text20) {
32792
32972
  try {
32793
32973
  return JSON.parse(text20);
@@ -32816,7 +32996,7 @@ function parsePages(raw, file) {
32816
32996
  return Array.isArray(parsed) ? parsed.map(toPage) : [toPage(parsed)];
32817
32997
  }
32818
32998
  function readMiroItems(file) {
32819
- const items2 = parsePages(readFileSync48(file, "utf8"), file).flatMap(
32999
+ const items2 = parsePages(readFileSync49(file, "utf8"), file).flatMap(
32820
33000
  (page) => page.data ?? []
32821
33001
  );
32822
33002
  if (items2.length === 0)
@@ -33009,7 +33189,7 @@ function registerMiro(program) {
33009
33189
  // src/commands/netcap/netcap.ts
33010
33190
  import { mkdir as mkdir6 } from "fs/promises";
33011
33191
  import { createServer as createServer2 } from "http";
33012
- import { dirname as dirname38 } from "path";
33192
+ import { dirname as dirname39 } from "path";
33013
33193
  import chalk200 from "chalk";
33014
33194
 
33015
33195
  // src/commands/netcap/corsHeaders.ts
@@ -33088,15 +33268,15 @@ function createNetcapHandler(options2) {
33088
33268
  // src/commands/netcap/prepareExtensionForLoad.ts
33089
33269
  import { cp as cp4, readFile as readFile7, writeFile as writeFile6 } from "fs/promises";
33090
33270
  import { networkInterfaces } from "os";
33091
- import { join as join82 } from "path";
33271
+ import { join as join83 } from "path";
33092
33272
  import chalk199 from "chalk";
33093
33273
 
33094
33274
  // src/commands/netcap/netcapExtensionDir.ts
33095
- import { dirname as dirname37, join as join81 } from "path";
33275
+ import { dirname as dirname38, join as join82 } from "path";
33096
33276
  import { fileURLToPath as fileURLToPath7 } from "url";
33097
- var moduleDir2 = dirname37(fileURLToPath7(import.meta.url));
33277
+ var moduleDir2 = dirname38(fileURLToPath7(import.meta.url));
33098
33278
  function netcapExtensionDir() {
33099
- return join81(moduleDir2, "commands", "netcap", "netcap-extension");
33279
+ return join82(moduleDir2, "commands", "netcap", "netcap-extension");
33100
33280
  }
33101
33281
 
33102
33282
  // src/commands/netcap/prepareExtensionForLoad.ts
@@ -33111,7 +33291,7 @@ function lanIPv4() {
33111
33291
  return void 0;
33112
33292
  }
33113
33293
  async function configureBackground(dir, host, port, filter) {
33114
- const file = join82(dir, "background.js");
33294
+ const file = join83(dir, "background.js");
33115
33295
  const source = await readFile7(file, "utf8");
33116
33296
  await writeFile6(
33117
33297
  file,
@@ -33151,20 +33331,20 @@ async function prepareExtensionForLoad(port, filter = "") {
33151
33331
  }
33152
33332
 
33153
33333
  // src/commands/netcap/resolveNetcapOutPath.ts
33154
- import { isAbsolute as isAbsolute5, join as join84, resolve as resolve26 } from "path";
33334
+ import { isAbsolute as isAbsolute5, join as join85, resolve as resolve26 } from "path";
33155
33335
 
33156
33336
  // src/commands/netcap/defaultCapturePath.ts
33157
33337
  import { homedir as homedir24 } from "os";
33158
- import { join as join83 } from "path";
33338
+ import { join as join84 } from "path";
33159
33339
  function defaultCapturePath() {
33160
- return join83(homedir24(), ".assist", "netcap", "capture.jsonl");
33340
+ return join84(homedir24(), ".assist", "netcap", "capture.jsonl");
33161
33341
  }
33162
33342
 
33163
33343
  // src/commands/netcap/resolveNetcapOutPath.ts
33164
33344
  function resolveNetcapOutPath(out) {
33165
33345
  if (!out) return defaultCapturePath();
33166
33346
  const dir = isAbsolute5(out) ? out : resolve26(process.cwd(), out);
33167
- return join84(dir, "capture.jsonl");
33347
+ return join85(dir, "capture.jsonl");
33168
33348
  }
33169
33349
 
33170
33350
  // src/commands/netcap/netcap.ts
@@ -33172,7 +33352,7 @@ async function netcap(options2) {
33172
33352
  const port = Number(options2.port);
33173
33353
  const outPath = resolveNetcapOutPath(options2.out);
33174
33354
  const filter = options2.filter ?? "";
33175
- await mkdir6(dirname38(outPath), { recursive: true });
33355
+ await mkdir6(dirname39(outPath), { recursive: true });
33176
33356
  const extensionPath = await prepareExtensionForLoad(port, filter);
33177
33357
  let count10 = 0;
33178
33358
  const handler = createNetcapHandler({
@@ -33210,12 +33390,12 @@ netcap stopped \u2014 captured ${count10} ${count10 === 1 ? "entry" : "entries"}
33210
33390
  }
33211
33391
 
33212
33392
  // src/commands/netcap/netcapExtract.ts
33213
- import { writeFileSync as writeFileSync37 } from "fs";
33214
- import { join as join85 } from "path";
33393
+ import { writeFileSync as writeFileSync38 } from "fs";
33394
+ import { join as join86 } from "path";
33215
33395
  import chalk201 from "chalk";
33216
33396
 
33217
33397
  // src/commands/netcap/extractPostsFromCapture.ts
33218
- import { readFileSync as readFileSync49 } from "fs";
33398
+ import { readFileSync as readFileSync50 } from "fs";
33219
33399
 
33220
33400
  // src/commands/netcap/parseRscRows.ts
33221
33401
  var isRscRef = (v) => typeof v === "string" && /^\$[0-9a-fL@]/.test(v);
@@ -33611,7 +33791,7 @@ function extractVoyagerPosts(body) {
33611
33791
 
33612
33792
  // src/commands/netcap/extractPostsFromCapture.ts
33613
33793
  function captureEntries(captureFile) {
33614
- const lines2 = readFileSync49(captureFile, "utf8").split("\n").filter(Boolean);
33794
+ const lines2 = readFileSync50(captureFile, "utf8").split("\n").filter(Boolean);
33615
33795
  const entries = [];
33616
33796
  for (const line of lines2) {
33617
33797
  let entry;
@@ -33656,8 +33836,8 @@ function extractPostsFromCapture(captureFile) {
33656
33836
  function netcapExtract(file) {
33657
33837
  const captureFile = file ?? defaultCapturePath();
33658
33838
  const posts = extractPostsFromCapture(captureFile);
33659
- const outFile = join85(captureFile, "..", "posts.json");
33660
- writeFileSync37(outFile, `${JSON.stringify(posts, null, 2)}
33839
+ const outFile = join86(captureFile, "..", "posts.json");
33840
+ writeFileSync38(outFile, `${JSON.stringify(posts, null, 2)}
33661
33841
  `);
33662
33842
  console.log(
33663
33843
  chalk201.green(`extracted ${posts.length} posts`),
@@ -34052,9 +34232,9 @@ async function comment2(path109, line, body, options2 = {}) {
34052
34232
 
34053
34233
  // src/commands/prs/commentsCachePath.ts
34054
34234
  import { homedir as homedir25 } from "os";
34055
- import { join as join86 } from "path";
34235
+ import { join as join87 } from "path";
34056
34236
  function commentsCachePath(org, repo, prNumber) {
34057
- return join86(
34237
+ return join87(
34058
34238
  homedir25(),
34059
34239
  ".assist",
34060
34240
  "pr-comments",
@@ -34065,19 +34245,19 @@ function commentsCachePath(org, repo, prNumber) {
34065
34245
  }
34066
34246
 
34067
34247
  // src/commands/prs/listComments/updateCommentsCache.ts
34068
- import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync38 } from "fs";
34069
- import { dirname as dirname39 } from "path";
34248
+ import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync39 } from "fs";
34249
+ import { dirname as dirname40 } from "path";
34070
34250
  import { stringify as stringify3 } from "yaml";
34071
34251
 
34072
34252
  // src/commands/prs/loadCommentsCache.ts
34073
- import { existsSync as existsSync69, readFileSync as readFileSync50, unlinkSync as unlinkSync14 } from "fs";
34253
+ import { existsSync as existsSync69, readFileSync as readFileSync51, unlinkSync as unlinkSync14 } from "fs";
34074
34254
  import { parse as parse3 } from "yaml";
34075
34255
  function loadCommentsCache(org, repo, prNumber) {
34076
34256
  const cachePath = commentsCachePath(org, repo, prNumber);
34077
34257
  if (!existsSync69(cachePath)) {
34078
34258
  return null;
34079
34259
  }
34080
- const content = readFileSync50(cachePath, "utf8");
34260
+ const content = readFileSync51(cachePath, "utf8");
34081
34261
  return parse3(content);
34082
34262
  }
34083
34263
  function deleteCommentsCache(org, repo, prNumber) {
@@ -34090,10 +34270,10 @@ function deleteCommentsCache(org, repo, prNumber) {
34090
34270
 
34091
34271
  // src/commands/prs/removeStaleCommentsCaches.ts
34092
34272
  import { readdirSync as readdirSync16, unlinkSync as unlinkSync15 } from "fs";
34093
- import { join as join87 } from "path";
34273
+ import { join as join88 } from "path";
34094
34274
  var STALE_PATTERN = /^pr-\d+-comments\.yaml$/;
34095
34275
  function removeStaleCommentsCaches(cwd = process.cwd()) {
34096
- const dir = join87(cwd, ".assist");
34276
+ const dir = join88(cwd, ".assist");
34097
34277
  let entries;
34098
34278
  try {
34099
34279
  entries = readdirSync16(dir);
@@ -34101,20 +34281,20 @@ function removeStaleCommentsCaches(cwd = process.cwd()) {
34101
34281
  return;
34102
34282
  }
34103
34283
  for (const entry of entries.filter((e) => STALE_PATTERN.test(e))) {
34104
- unlinkSync15(join87(dir, entry));
34284
+ unlinkSync15(join88(dir, entry));
34105
34285
  }
34106
34286
  }
34107
34287
 
34108
34288
  // src/commands/prs/listComments/updateCommentsCache.ts
34109
34289
  function writeCommentsCache(org, repo, prNumber, comments3) {
34110
34290
  const cachePath = commentsCachePath(org, repo, prNumber);
34111
- mkdirSync26(dirname39(cachePath), { recursive: true });
34291
+ mkdirSync27(dirname40(cachePath), { recursive: true });
34112
34292
  const cacheData = {
34113
34293
  prNumber,
34114
34294
  fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
34115
34295
  comments: comments3
34116
34296
  };
34117
- writeFileSync38(cachePath, stringify3(cacheData));
34297
+ writeFileSync39(cachePath, stringify3(cacheData));
34118
34298
  }
34119
34299
  function updateCommentsCache(org, repo, prNumber, comments3) {
34120
34300
  removeStaleCommentsCaches();
@@ -34217,9 +34397,9 @@ function failAzureDevops(error) {
34217
34397
 
34218
34398
  // src/commands/prs/azureDevops/invokeAzDevops.ts
34219
34399
  import { execFileSync as execFileSync19 } from "child_process";
34220
- import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync39 } from "fs";
34400
+ import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync40 } from "fs";
34221
34401
  import { tmpdir as tmpdir6 } from "os";
34222
- import { join as join88 } from "path";
34402
+ import { join as join89 } from "path";
34223
34403
  function azDevopsInvokeArgs(request, inFile) {
34224
34404
  return [
34225
34405
  "devops",
@@ -34254,10 +34434,10 @@ function runAz2(args) {
34254
34434
  }
34255
34435
  function invokeAzDevops(request) {
34256
34436
  if (request.body === void 0) return runAz2(azDevopsInvokeArgs(request));
34257
- const dir = mkdtempSync2(join88(tmpdir6(), "assist-az-"));
34258
- const inFile = join88(dir, "body.json");
34437
+ const dir = mkdtempSync2(join89(tmpdir6(), "assist-az-"));
34438
+ const inFile = join89(dir, "body.json");
34259
34439
  try {
34260
- writeFileSync39(inFile, JSON.stringify(request.body));
34440
+ writeFileSync40(inFile, JSON.stringify(request.body));
34261
34441
  return runAz2(azDevopsInvokeArgs(request, inFile));
34262
34442
  } finally {
34263
34443
  rmSync6(dir, { recursive: true, force: true });
@@ -36041,7 +36221,7 @@ function registerPrsStatus(prsCommand) {
36041
36221
  }
36042
36222
 
36043
36223
  // src/commands/readTime/readTime.ts
36044
- import { readFileSync as readFileSync51 } from "fs";
36224
+ import { readFileSync as readFileSync52 } from "fs";
36045
36225
 
36046
36226
  // src/commands/readTime/countReadingWords.ts
36047
36227
  var FENCE_PATTERN = /^\s*(```|~~~)/;
@@ -36202,7 +36382,7 @@ async function loadBody(target) {
36202
36382
  }
36203
36383
  function readDraftFile(path109) {
36204
36384
  try {
36205
- return readFileSync51(path109, "utf8");
36385
+ return readFileSync52(path109, "utf8");
36206
36386
  } catch {
36207
36387
  console.error(`Error: Could not read \`${path109}\`.`);
36208
36388
  console.error(
@@ -36709,10 +36889,10 @@ function checkStreamGraph(streams) {
36709
36889
  }
36710
36890
 
36711
36891
  // src/commands/releases/readStreamsInput.ts
36712
- import { readFileSync as readFileSync52 } from "fs";
36892
+ import { readFileSync as readFileSync53 } from "fs";
36713
36893
  import { parse as parse4 } from "yaml";
36714
36894
  function readSource2(source) {
36715
- return readFileSync52(source === "-" ? 0 : source, "utf8");
36895
+ return readFileSync53(source === "-" ? 0 : source, "utf8");
36716
36896
  }
36717
36897
  function readStreamsInput(source) {
36718
36898
  let parsed;
@@ -37383,9 +37563,9 @@ async function notify() {
37383
37563
 
37384
37564
  // src/commands/screenshot.ts
37385
37565
  import { execSync as execSync54 } from "child_process";
37386
- import { existsSync as existsSync70, mkdirSync as mkdirSync27, unlinkSync as unlinkSync16, writeFileSync as writeFileSync40 } from "fs";
37566
+ import { existsSync as existsSync70, mkdirSync as mkdirSync28, unlinkSync as unlinkSync16, writeFileSync as writeFileSync41 } from "fs";
37387
37567
  import { tmpdir as tmpdir7 } from "os";
37388
- import { join as join89, resolve as resolve28 } from "path";
37568
+ import { join as join90, resolve as resolve28 } from "path";
37389
37569
  import chalk228 from "chalk";
37390
37570
 
37391
37571
  // src/commands/screenshot/captureWindowPs1.ts
@@ -37516,14 +37696,14 @@ Write-Output $OutputPath
37516
37696
  // src/commands/screenshot.ts
37517
37697
  function buildOutputPath(outputDir, processName) {
37518
37698
  if (!existsSync70(outputDir)) {
37519
- mkdirSync27(outputDir, { recursive: true });
37699
+ mkdirSync28(outputDir, { recursive: true });
37520
37700
  }
37521
37701
  const timestamp9 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
37522
37702
  return resolve28(outputDir, `${processName}-${timestamp9}.png`);
37523
37703
  }
37524
37704
  function runPowerShellScript(processName, outputPath) {
37525
- const scriptPath = join89(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
37526
- writeFileSync40(scriptPath, captureWindowPs1, "utf8");
37705
+ const scriptPath = join90(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
37706
+ writeFileSync41(scriptPath, captureWindowPs1, "utf8");
37527
37707
  try {
37528
37708
  execSync54(
37529
37709
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
@@ -37623,10 +37803,10 @@ function buildLimitsSegment(rateLimits) {
37623
37803
  }
37624
37804
 
37625
37805
  // 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";
37806
+ import { readFileSync as readFileSync54, statSync as statSync11 } from "fs";
37807
+ import { isAbsolute as isAbsolute6, join as join91, resolve as resolve29 } from "path";
37628
37808
  function resolveGitDir(cwd) {
37629
- const dotGit = join90(cwd, ".git");
37809
+ const dotGit = join91(cwd, ".git");
37630
37810
  let stat5;
37631
37811
  try {
37632
37812
  stat5 = statSync11(dotGit);
@@ -37638,7 +37818,7 @@ function resolveGitDir(cwd) {
37638
37818
  }
37639
37819
  let contents;
37640
37820
  try {
37641
- contents = readFileSync53(dotGit, "utf8");
37821
+ contents = readFileSync54(dotGit, "utf8");
37642
37822
  } catch {
37643
37823
  return null;
37644
37824
  }
@@ -37656,7 +37836,7 @@ function readGitBranch(cwd) {
37656
37836
  }
37657
37837
  let head;
37658
37838
  try {
37659
- head = readFileSync53(join90(gitDir, "HEAD"), "utf8");
37839
+ head = readFileSync54(join91(gitDir, "HEAD"), "utf8");
37660
37840
  } catch {
37661
37841
  return null;
37662
37842
  }
@@ -40201,7 +40381,7 @@ function readGlobs(value) {
40201
40381
 
40202
40382
  // src/commands/review/highLevel/summariseRepoTree.ts
40203
40383
  import { execFileSync as execFileSync25 } from "child_process";
40204
- import { dirname as dirname41, extname as extname6 } from "path";
40384
+ import { dirname as dirname42, extname as extname6 } from "path";
40205
40385
  var MAX_DIRECTORIES = 200;
40206
40386
  var MAX_EXTENSIONS_PER_DIRECTORY = 6;
40207
40387
  function summariseRepoTree(cwd = process.cwd()) {
@@ -40228,7 +40408,7 @@ function listTrackedFiles(cwd) {
40228
40408
  function countByDirectory(files) {
40229
40409
  const directories = /* @__PURE__ */ new Map();
40230
40410
  for (const file of files) {
40231
- const directory = dirname41(file) === "." ? "(repo root)" : dirname41(file);
40411
+ const directory = dirname42(file) === "." ? "(repo root)" : dirname42(file);
40232
40412
  const extensions = directories.get(directory) ?? /* @__PURE__ */ new Map();
40233
40413
  const extension2 = extname6(file) === "" ? "(no extension)" : extname6(file);
40234
40414
  extensions.set(extension2, (extensions.get(extension2) ?? 0) + 1);
@@ -40775,7 +40955,7 @@ function fetchHighLevelPr(prNumber, repo) {
40775
40955
  }
40776
40956
 
40777
40957
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
40778
- import { readFileSync as readFileSync55 } from "fs";
40958
+ import { readFileSync as readFileSync56 } from "fs";
40779
40959
 
40780
40960
  // src/commands/review/highLevel/formatSlicingRequest.ts
40781
40961
  var RULES = [
@@ -40836,12 +41016,12 @@ function formatSlicingRequest(hunks) {
40836
41016
  }
40837
41017
 
40838
41018
  // src/commands/review/highLevel/highLevelReviewPath.ts
40839
- import { join as join91 } from "path";
41019
+ import { join as join92 } from "path";
40840
41020
  function slug(value) {
40841
41021
  return value.replace(/[^\w.-]+/g, "-");
40842
41022
  }
40843
41023
  function highLevelReviewPath(repo, headRef, headSha) {
40844
- return join91(
41024
+ return join92(
40845
41025
  getStoreDir(),
40846
41026
  "high-level-reviews",
40847
41027
  slug(repo),
@@ -40893,11 +41073,11 @@ function listHighLevelHunks(files) {
40893
41073
  }
40894
41074
 
40895
41075
  // src/commands/review/highLevel/readJsonFile.ts
40896
- import { existsSync as existsSync71, readFileSync as readFileSync54 } from "fs";
41076
+ import { existsSync as existsSync71, readFileSync as readFileSync55 } from "fs";
40897
41077
  function readJsonFile(path109) {
40898
41078
  if (!existsSync71(path109)) return void 0;
40899
41079
  try {
40900
- return JSON.parse(readFileSync54(path109, "utf8"));
41080
+ return JSON.parse(readFileSync55(path109, "utf8"));
40901
41081
  } catch {
40902
41082
  return void 0;
40903
41083
  }
@@ -40976,11 +41156,11 @@ function resolveHighLevelSlices(raw, hunks) {
40976
41156
  }
40977
41157
 
40978
41158
  // src/commands/review/highLevel/writeJsonFile.ts
40979
- import { mkdirSync as mkdirSync28, writeFileSync as writeFileSync41 } from "fs";
40980
- import { dirname as dirname42 } from "path";
41159
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync42 } from "fs";
41160
+ import { dirname as dirname43 } from "path";
40981
41161
  function writeJsonFile(path109, data) {
40982
- mkdirSync28(dirname42(path109), { recursive: true });
40983
- writeFileSync41(path109, `${JSON.stringify(data, null, 2)}
41162
+ mkdirSync29(dirname43(path109), { recursive: true });
41163
+ writeFileSync42(path109, `${JSON.stringify(data, null, 2)}
40984
41164
  `);
40985
41165
  return path109;
40986
41166
  }
@@ -40988,7 +41168,7 @@ function writeJsonFile(path109, data) {
40988
41168
  // src/commands/review/highLevel/gatherHighLevelSlices.ts
40989
41169
  function readSlicesFile(file) {
40990
41170
  try {
40991
- return JSON.parse(readFileSync55(file, "utf8"));
41171
+ return JSON.parse(readFileSync56(file, "utf8"));
40992
41172
  } catch (error) {
40993
41173
  throw new Error(
40994
41174
  `could not read slices from ${file}: ${error instanceof Error ? error.message : String(error)}`
@@ -41925,7 +42105,7 @@ async function runHighLevelReview(number, options2 = {}) {
41925
42105
  import { basename as basename26 } from "path";
41926
42106
 
41927
42107
  // src/commands/review/ci/writeJobSummary.ts
41928
- import { appendFileSync as appendFileSync3, readFileSync as readFileSync56 } from "fs";
42108
+ import { appendFileSync as appendFileSync3, readFileSync as readFileSync57 } from "fs";
41929
42109
 
41930
42110
  // src/commands/review/carriedUnanchoredFindings.ts
41931
42111
  function carriedUnanchoredFindings(unanchored) {
@@ -42307,7 +42487,7 @@ function buildTokenUsageTable(usages) {
42307
42487
  // src/commands/review/ci/writeJobSummary.ts
42308
42488
  function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
42309
42489
  if (!summaryPath) return;
42310
- const markdown = readFileSync56(synthesisPath, "utf8");
42490
+ const markdown = readFileSync57(synthesisPath, "utf8");
42311
42491
  const { unanchored } = selectPostableFindings(markdown, prInfo);
42312
42492
  const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
42313
42493
  appendFileSync3(
@@ -42425,8 +42605,8 @@ function renderEntry(entry, frame) {
42425
42605
  import { format as format2 } from "util";
42426
42606
 
42427
42607
  // src/commands/review/createReviewLogSink.ts
42428
- import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync29 } from "fs";
42429
- import { join as join92 } from "path";
42608
+ import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync30 } from "fs";
42609
+ import { join as join93 } from "path";
42430
42610
  var LOG_FILE = "review.log";
42431
42611
  function createReviewLogSink() {
42432
42612
  let logPath2;
@@ -42442,8 +42622,8 @@ function createReviewLogSink() {
42442
42622
  `);
42443
42623
  },
42444
42624
  attach(reviewDir) {
42445
- mkdirSync29(reviewDir, { recursive: true });
42446
- logPath2 = join92(reviewDir, LOG_FILE);
42625
+ mkdirSync30(reviewDir, { recursive: true });
42626
+ logPath2 = join93(reviewDir, LOG_FILE);
42447
42627
  const lines2 = [
42448
42628
  "",
42449
42629
  `=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
@@ -42734,7 +42914,7 @@ function buildCodexModelArgs() {
42734
42914
  }
42735
42915
 
42736
42916
  // src/commands/review/runClaudeReviewer.ts
42737
- import { writeFileSync as writeFileSync42 } from "fs";
42917
+ import { writeFileSync as writeFileSync43 } from "fs";
42738
42918
 
42739
42919
  // src/commands/review/formatToolSummary.ts
42740
42920
  function truncate3(value, max = 80) {
@@ -43118,7 +43298,7 @@ async function runClaudeReviewer(spec) {
43118
43298
  onLine
43119
43299
  });
43120
43300
  if (result.exitCode === 0 && state.finalText)
43121
- writeFileSync42(spec.outputPath, state.finalText);
43301
+ writeFileSync43(spec.outputPath, state.finalText);
43122
43302
  const finalised = finaliseReviewerRun(
43123
43303
  { ...spec, command, model: override?.model },
43124
43304
  spinner,
@@ -43314,7 +43494,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
43314
43494
  import { existsSync as existsSync73, unlinkSync as unlinkSync18 } from "fs";
43315
43495
 
43316
43496
  // src/commands/review/synthesise.ts
43317
- import { readFileSync as readFileSync57 } from "fs";
43497
+ import { readFileSync as readFileSync58 } from "fs";
43318
43498
 
43319
43499
  // src/commands/review/buildSynthesisStdin.ts
43320
43500
  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 +43563,7 @@ Files:
43383
43563
 
43384
43564
  // src/commands/review/synthesise.ts
43385
43565
  function printSummary2(synthesisPath) {
43386
- const markdown = readFileSync57(synthesisPath, "utf8");
43566
+ const markdown = readFileSync58(synthesisPath, "utf8");
43387
43567
  console.log("");
43388
43568
  console.log(buildReviewSummary(markdown));
43389
43569
  console.log("");
@@ -43434,7 +43614,7 @@ async function synthesiseAfterReviewers(input) {
43434
43614
  }
43435
43615
 
43436
43616
  // src/commands/review/skipReason.ts
43437
- function skipReason(results, failures, strict) {
43617
+ function skipReason2(results, failures, strict) {
43438
43618
  if (failures.length === results.length)
43439
43619
  return "Both reviewers failed; skipping synthesis.";
43440
43620
  if (strict && failures.length > 0)
@@ -43463,7 +43643,7 @@ async function runAndSynthesise(args) {
43463
43643
  );
43464
43644
  if (args.job) await recordReviewerRuns(fresh, args.job, startedAt);
43465
43645
  const failures = failed2(results);
43466
- const reason4 = skipReason(results, failures, args.strict);
43646
+ const reason4 = skipReason2(results, failures, args.strict);
43467
43647
  if (reason4) {
43468
43648
  console.error(reason4);
43469
43649
  return { ok: false, failures, slots: results };
@@ -43650,9 +43830,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
43650
43830
 
43651
43831
  // src/commands/review/buildReviewPaths.ts
43652
43832
  import { homedir as homedir26 } from "os";
43653
- import { basename as basename25, join as join93 } from "path";
43833
+ import { basename as basename25, join as join94 } from "path";
43654
43834
  function buildReviewPaths(repoRoot2, key) {
43655
- const reviewDir = join93(
43835
+ const reviewDir = join94(
43656
43836
  homedir26(),
43657
43837
  ".assist",
43658
43838
  "reviews",
@@ -43661,10 +43841,10 @@ function buildReviewPaths(repoRoot2, key) {
43661
43841
  );
43662
43842
  return {
43663
43843
  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")
43844
+ requestPath: join94(reviewDir, "request.md"),
43845
+ claudePath: join94(reviewDir, "claude.md"),
43846
+ codexPath: join94(reviewDir, "codex.md"),
43847
+ synthesisPath: join94(reviewDir, "synthesis.md")
43668
43848
  };
43669
43849
  }
43670
43850
 
@@ -43702,16 +43882,16 @@ function fetchExistingComments() {
43702
43882
  }
43703
43883
 
43704
43884
  // src/commands/review/prepareReviewDir.ts
43705
- import { existsSync as existsSync74, mkdirSync as mkdirSync30, unlinkSync as unlinkSync19, writeFileSync as writeFileSync43 } from "fs";
43885
+ import { existsSync as existsSync74, mkdirSync as mkdirSync31, unlinkSync as unlinkSync19, writeFileSync as writeFileSync44 } from "fs";
43706
43886
  function clearReviewFiles(paths) {
43707
43887
  for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
43708
43888
  if (existsSync74(path109)) unlinkSync19(path109);
43709
43889
  }
43710
43890
  }
43711
43891
  function prepareReviewDir(paths, requestBody, force) {
43712
- mkdirSync30(paths.reviewDir, { recursive: true });
43892
+ mkdirSync31(paths.reviewDir, { recursive: true });
43713
43893
  if (force) clearReviewFiles(paths);
43714
- writeFileSync43(paths.requestPath, requestBody);
43894
+ writeFileSync44(paths.requestPath, requestBody);
43715
43895
  }
43716
43896
 
43717
43897
  // src/commands/review/setupReviewDir.ts
@@ -43828,7 +44008,7 @@ function gatherChangedContext() {
43828
44008
  }
43829
44009
 
43830
44010
  // src/commands/review/postReviewToPr.ts
43831
- import { readFileSync as readFileSync58 } from "fs";
44011
+ import { readFileSync as readFileSync59 } from "fs";
43832
44012
 
43833
44013
  // src/commands/review/chainAddressComments.ts
43834
44014
  function chainAddressComments(prNumber, announce) {
@@ -44010,7 +44190,7 @@ async function confirmPost(prNumber, work, options2) {
44010
44190
  return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
44011
44191
  }
44012
44192
  async function postFindingsToPr(prInfo, synthesisPath, options2) {
44013
- const markdown = readFileSync58(synthesisPath, "utf8");
44193
+ const markdown = readFileSync59(synthesisPath, "utf8");
44014
44194
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
44015
44195
  const carried = carriedUnanchoredFindings(unanchored);
44016
44196
  if (inDiff.length === 0 && carried.length === 0)
@@ -44374,11 +44554,11 @@ import path88 from "path";
44374
44554
  import chalk263 from "chalk";
44375
44555
 
44376
44556
  // src/commands/rules/updateScopedRulesIndex.ts
44377
- import { existsSync as existsSync75, readFileSync as readFileSync60, writeFileSync as writeFileSync44 } from "fs";
44557
+ import { existsSync as existsSync75, readFileSync as readFileSync61, writeFileSync as writeFileSync45 } from "fs";
44378
44558
  import path87 from "path";
44379
44559
 
44380
44560
  // src/commands/rules/scopedRuleDirectories.ts
44381
- import { readFileSync as readFileSync59 } from "fs";
44561
+ import { readFileSync as readFileSync60 } from "fs";
44382
44562
  import path86 from "path";
44383
44563
 
44384
44564
  // src/commands/rules/findClaudeFiles.ts
@@ -44402,7 +44582,7 @@ function findClaudeFiles(dir) {
44402
44582
  // src/commands/rules/scopedRuleDirectories.ts
44403
44583
  function scopedRuleDirectories(root2) {
44404
44584
  return findClaudeFiles(root2).filter(
44405
- (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync59(file, "utf8")).length > 0
44585
+ (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync60(file, "utf8")).length > 0
44406
44586
  ).map(
44407
44587
  (file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
44408
44588
  ).sort();
@@ -44444,9 +44624,9 @@ function upsertScopedRulesPointer(content, directories) {
44444
44624
  function updateScopedRulesIndex(root2) {
44445
44625
  const directories = scopedRuleDirectories(root2);
44446
44626
  const rootFile = path87.join(root2, "CLAUDE.md");
44447
- const before = existsSync75(rootFile) ? readFileSync60(rootFile, "utf8") : "";
44627
+ const before = existsSync75(rootFile) ? readFileSync61(rootFile, "utf8") : "";
44448
44628
  const after = upsertScopedRulesPointer(before, directories);
44449
- if (after !== before) writeFileSync44(rootFile, after);
44629
+ if (after !== before) writeFileSync45(rootFile, after);
44450
44630
  return directories;
44451
44631
  }
44452
44632
 
@@ -44497,7 +44677,7 @@ function listRules(target, options2 = {}) {
44497
44677
  }
44498
44678
 
44499
44679
  // src/commands/rules/addRule.ts
44500
- import { existsSync as existsSync77, readFileSync as readFileSync62, writeFileSync as writeFileSync45 } from "fs";
44680
+ import { existsSync as existsSync77, readFileSync as readFileSync63, writeFileSync as writeFileSync46 } from "fs";
44501
44681
  import path91 from "path";
44502
44682
  import chalk265 from "chalk";
44503
44683
 
@@ -44522,11 +44702,11 @@ function insertRuleBullet(content, rule) {
44522
44702
  }
44523
44703
 
44524
44704
  // src/commands/rules/nextRuleCode.ts
44525
- import { readFileSync as readFileSync61 } from "fs";
44705
+ import { readFileSync as readFileSync62 } from "fs";
44526
44706
  var CODE_PREFIX = "R";
44527
44707
  function nextRuleCode(root2) {
44528
44708
  const numbers = findClaudeFiles(root2).flatMap(
44529
- (file) => parseRulesSection(readFileSync61(file, "utf8")).map(
44709
+ (file) => parseRulesSection(readFileSync62(file, "utf8")).map(
44530
44710
  (rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
44531
44711
  )
44532
44712
  );
@@ -44552,8 +44732,8 @@ function resolveRuleScope(target) {
44552
44732
  }
44553
44733
 
44554
44734
  // src/commands/rules/addRule.ts
44555
- function read2(file) {
44556
- return existsSync77(file) ? readFileSync62(file, "utf8") : "";
44735
+ function read3(file) {
44736
+ return existsSync77(file) ? readFileSync63(file, "utf8") : "";
44557
44737
  }
44558
44738
  function addRule(text20, options2) {
44559
44739
  const rule = text20.trim();
@@ -44566,9 +44746,9 @@ function addRule(text20, options2) {
44566
44746
  const targetDir = path91.dirname(target);
44567
44747
  const root2 = findRepoRoot(targetDir) ?? targetDir;
44568
44748
  const code = nextRuleCode(root2);
44569
- writeFileSync45(
44749
+ writeFileSync46(
44570
44750
  target,
44571
- insertRuleBullet(read2(target), {
44751
+ insertRuleBullet(read3(target), {
44572
44752
  code,
44573
44753
  title: options2.title?.trim() || void 0,
44574
44754
  text: rule
@@ -45076,7 +45256,7 @@ function findShownSessionFiles(body, writtenPaths, locations) {
45076
45256
  }
45077
45257
 
45078
45258
  // src/commands/show/sessionWrittenPaths.ts
45079
- import { readFileSync as readFileSync63 } from "fs";
45259
+ import { readFileSync as readFileSync64 } from "fs";
45080
45260
 
45081
45261
  // src/commands/sessions/shared/asRecord.ts
45082
45262
  function asRecord(value) {
@@ -45104,7 +45284,7 @@ function writtenFilePaths(entry) {
45104
45284
  function sessionWrittenPaths(transcriptPath2) {
45105
45285
  let text20;
45106
45286
  try {
45107
- text20 = readFileSync63(transcriptPath2, "utf8");
45287
+ text20 = readFileSync64(transcriptPath2, "utf8");
45108
45288
  } catch {
45109
45289
  return [];
45110
45290
  }
@@ -45217,18 +45397,18 @@ function parseSlackThreadRef(value) {
45217
45397
  }
45218
45398
 
45219
45399
  // src/commands/slack/postSlackMessage.ts
45220
- import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
45400
+ import { mkdirSync as mkdirSync33, writeFileSync as writeFileSync48 } from "fs";
45221
45401
 
45222
45402
  // src/commands/slack/previewSlackThreadParts.ts
45223
- import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync46 } from "fs";
45403
+ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync47 } from "fs";
45224
45404
 
45225
45405
  // src/commands/slack/readSlackParts.ts
45226
- import { readFileSync as readFileSync64 } from "fs";
45406
+ import { readFileSync as readFileSync65 } from "fs";
45227
45407
  function readSlackParts(files) {
45228
45408
  return files.map((file) => {
45229
45409
  let contents;
45230
45410
  try {
45231
- contents = readFileSync64(file, "utf8");
45411
+ contents = readFileSync65(file, "utf8");
45232
45412
  } catch {
45233
45413
  console.error(`Error: Part file not found: ${file}`);
45234
45414
  process.exit(1);
@@ -45266,12 +45446,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
45266
45446
  }
45267
45447
 
45268
45448
  // src/commands/slack/slackWorkingFile.ts
45269
- import { join as join94 } from "path";
45449
+ import { join as join95 } from "path";
45270
45450
  function slackWorkingFile(channel, partIndex) {
45271
45451
  const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
45272
- const dir = join94(getStoreDir(), "slack");
45452
+ const dir = join95(getStoreDir(), "slack");
45273
45453
  const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
45274
- return { dir, bodyPath: join94(dir, `${name}.md`) };
45454
+ return { dir, bodyPath: join95(dir, `${name}.md`) };
45275
45455
  }
45276
45456
 
45277
45457
  // src/commands/slack/previewSlackThreadParts.ts
@@ -45283,10 +45463,10 @@ async function previewSlackThreadParts({
45283
45463
  }) {
45284
45464
  const bodies = readSlackParts(partFiles);
45285
45465
  const { dir } = slackWorkingFile(channel);
45286
- mkdirSync31(dir, { recursive: true });
45466
+ mkdirSync32(dir, { recursive: true });
45287
45467
  const paths = bodies.map((body, index3) => {
45288
45468
  const { bodyPath } = slackWorkingFile(channel, index3 + 1);
45289
- writeFileSync46(bodyPath, `${body}
45469
+ writeFileSync47(bodyPath, `${body}
45290
45470
  `);
45291
45471
  return bodyPath;
45292
45472
  });
@@ -45337,8 +45517,8 @@ async function postSlackMessage(channelArg, options2) {
45337
45517
  process.exit(1);
45338
45518
  }
45339
45519
  const { dir, bodyPath } = slackWorkingFile(channel);
45340
- mkdirSync32(dir, { recursive: true });
45341
- writeFileSync47(bodyPath, `${body}
45520
+ mkdirSync33(dir, { recursive: true });
45521
+ writeFileSync48(bodyPath, `${body}
45342
45522
  `);
45343
45523
  await reviewProposedSlackMessage({ channel, threadTs }, body, bodyPath);
45344
45524
  console.log(`Approved for ${target}. The body to post is at:`);
@@ -46342,9 +46522,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
46342
46522
  }
46343
46523
 
46344
46524
  // src/commands/transcript/convert/readCleanedCues.ts
46345
- import { readFileSync as readFileSync69 } from "fs";
46525
+ import { readFileSync as readFileSync70 } from "fs";
46346
46526
  function readCleanedCues(inputPath) {
46347
- return deduplicateCues(parseVtt(readFileSync69(inputPath, "utf8")));
46527
+ return deduplicateCues(parseVtt(readFileSync70(inputPath, "utf8")));
46348
46528
  }
46349
46529
 
46350
46530
  // src/commands/transcript/clean.ts
@@ -46454,20 +46634,20 @@ async function configure() {
46454
46634
 
46455
46635
  // src/commands/transcript/list.ts
46456
46636
  import { existsSync as existsSync83, readdirSync as readdirSync24, statSync as statSync13 } from "fs";
46457
- import { join as join106 } from "path";
46637
+ import { join as join107 } from "path";
46458
46638
  function list5() {
46459
46639
  const { vttDir } = getTranscriptConfig();
46460
46640
  if (!existsSync83(vttDir)) return;
46461
46641
  for (const entry of readdirSync24(vttDir)) {
46462
46642
  if (!entry.endsWith(".vtt")) continue;
46463
- if (statSync13(join106(vttDir, entry)).isDirectory()) continue;
46643
+ if (statSync13(join107(vttDir, entry)).isDirectory()) continue;
46464
46644
  console.log(entry);
46465
46645
  }
46466
46646
  }
46467
46647
 
46468
46648
  // 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";
46649
+ import { existsSync as existsSync84, mkdirSync as mkdirSync39, renameSync as renameSync5, writeFileSync as writeFileSync53 } from "fs";
46650
+ import { basename as basename29, join as join108 } from "path";
46471
46651
 
46472
46652
  // src/commands/transcript/convertVttToMarkdown.ts
46473
46653
  function convertVttToMarkdown(inputPath) {
@@ -46477,9 +46657,9 @@ function convertVttToMarkdown(inputPath) {
46477
46657
  // src/commands/transcript/move.ts
46478
46658
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
46479
46659
  function archiveRawVtt(vttDir, sourcePath, filename) {
46480
- const processedDir = join107(vttDir, "processed");
46481
- mkdirSync38(processedDir, { recursive: true });
46482
- renameSync5(sourcePath, join107(processedDir, filename));
46660
+ const processedDir = join108(vttDir, "processed");
46661
+ mkdirSync39(processedDir, { recursive: true });
46662
+ renameSync5(sourcePath, join108(processedDir, filename));
46483
46663
  }
46484
46664
  function move(file, options2) {
46485
46665
  const { date, client } = options2;
@@ -46489,25 +46669,25 @@ function move(file, options2) {
46489
46669
  }
46490
46670
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
46491
46671
  const filename = basename29(file);
46492
- const sourcePath = join107(vttDir, filename);
46672
+ const sourcePath = join108(vttDir, filename);
46493
46673
  if (!existsSync84(sourcePath)) {
46494
46674
  console.error(`Error: VTT file not found: ${sourcePath}`);
46495
46675
  process.exit(1);
46496
46676
  }
46497
46677
  const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
46498
46678
  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");
46679
+ const formattedDir = join108(transcriptsDir, client);
46680
+ mkdirSync39(formattedDir, { recursive: true });
46681
+ const formattedPath = join108(formattedDir, outputName);
46682
+ writeFileSync53(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
46503
46683
  archiveRawVtt(vttDir, sourcePath, filename);
46504
- const summaryPath = join107(summaryDir, client, outputName);
46684
+ const summaryPath = join108(summaryDir, client, outputName);
46505
46685
  console.log(`Formatted transcript: ${formattedPath}`);
46506
46686
  console.log(`Summary target: ${summaryPath}`);
46507
46687
  }
46508
46688
 
46509
46689
  // src/commands/transcript/merge.ts
46510
- import { existsSync as existsSync85, writeFileSync as writeFileSync53 } from "fs";
46690
+ import { existsSync as existsSync85, writeFileSync as writeFileSync54 } from "fs";
46511
46691
  import { basename as basename30 } from "path";
46512
46692
 
46513
46693
  // src/commands/transcript/failTranscript.ts
@@ -46684,7 +46864,7 @@ async function merge(files, options2 = {}) {
46684
46864
  console.log(document);
46685
46865
  return;
46686
46866
  }
46687
- writeFileSync53(options2.out, `${document}
46867
+ writeFileSync54(options2.out, `${document}
46688
46868
  `, "utf8");
46689
46869
  console.log(`Merged transcript: ${options2.out}`);
46690
46870
  }
@@ -46957,27 +47137,27 @@ function toFindings(file, lines2, raw, exempt) {
46957
47137
 
46958
47138
  // src/commands/verify/blockCodeComments/collectFileComments.ts
46959
47139
  function collectFileComments(file, lines2, project) {
46960
- const read3 = () => fs50.readFileSync(file, "utf8");
47140
+ const read4 = () => fs50.readFileSync(file, "utf8");
46961
47141
  if (isYamlFile(file))
46962
- return toFindings(file, lines2, collectYamlComments(read3()), false);
47142
+ return toFindings(file, lines2, collectYamlComments(read4()), false);
46963
47143
  if (isDockerfile(file) || isEnvFile(file) || isShellFile(file))
46964
47144
  return toFindings(
46965
47145
  file,
46966
47146
  lines2,
46967
- collectHashComments(read3(), { skipHeader: isShellFile(file) }),
47147
+ collectHashComments(read4(), { skipHeader: isShellFile(file) }),
46968
47148
  true
46969
47149
  );
46970
47150
  if (isBicepFile(file))
46971
- return toFindings(file, lines2, collectBicepComments(read3()), true);
47151
+ return toFindings(file, lines2, collectBicepComments(read4()), true);
46972
47152
  if (isCsharpFile(file)) {
46973
- const content = read3();
47153
+ const content = read4();
46974
47154
  if (isGeneratedCsharpFile(file, content)) return [];
46975
47155
  return toFindings(file, lines2, collectCsharpComments(content), true);
46976
47156
  }
46977
47157
  if (isRazorFile(file))
46978
- return toFindings(file, lines2, extractRazorComments(read3()), true);
47158
+ return toFindings(file, lines2, extractRazorComments(read4()), true);
46979
47159
  if (isRustFile(file))
46980
- return toFindings(file, lines2, extractRustComments(read3()), true);
47160
+ return toFindings(file, lines2, extractRustComments(read4()), true);
46981
47161
  return collectSourceFindings(file, lines2, project);
46982
47162
  }
46983
47163
 
@@ -47124,7 +47304,7 @@ function configKeys2() {
47124
47304
  }
47125
47305
 
47126
47306
  // src/commands/verify/forbiddenStrings.ts
47127
- import { existsSync as existsSync86, readFileSync as readFileSync70 } from "fs";
47307
+ import { existsSync as existsSync86, readFileSync as readFileSync71 } from "fs";
47128
47308
 
47129
47309
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
47130
47310
  import { minimatch as minimatch10 } from "minimatch";
@@ -47171,7 +47351,7 @@ function forbiddenStrings() {
47171
47351
  }
47172
47352
  let parsed;
47173
47353
  try {
47174
- parsed = JSON.parse(readFileSync70(file, "utf8"));
47354
+ parsed = JSON.parse(readFileSync71(file, "utf8"));
47175
47355
  } catch (error) {
47176
47356
  console.log(`Could not parse ${file}: ${error.message}`);
47177
47357
  process.exit(1);
@@ -47243,7 +47423,7 @@ Total: ${lines2.length} hardcoded color(s)`);
47243
47423
  }
47244
47424
 
47245
47425
  // src/commands/verify/migrations.ts
47246
- import { readFileSync as readFileSync71 } from "fs";
47426
+ import { readFileSync as readFileSync72 } from "fs";
47247
47427
  import path105 from "path";
47248
47428
 
47249
47429
  // src/commands/verify/migrations/checkAppendOnly.ts
@@ -47408,7 +47588,7 @@ function migrations2() {
47408
47588
  if (ref) {
47409
47589
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
47410
47590
  const current = new Map(
47411
- files.map((file) => [file, readFileSync71(path105.join(dir, file), "utf8")])
47591
+ files.map((file) => [file, readFileSync72(path105.join(dir, file), "utf8")])
47412
47592
  );
47413
47593
  for (const finding of checkAppendOnly(baseline, current)) {
47414
47594
  problems.push(
@@ -47937,19 +48117,19 @@ ${result.reason}`
47937
48117
  }
47938
48118
 
47939
48119
  // src/commands/watch/markBuildPending.ts
47940
- import { writeFileSync as writeFileSync54 } from "fs";
48120
+ import { writeFileSync as writeFileSync55 } from "fs";
47941
48121
  function markBuildPending() {
47942
48122
  try {
47943
- writeFileSync54(buildPendingPath(), "");
48123
+ writeFileSync55(buildPendingPath(), "");
47944
48124
  } catch {
47945
48125
  }
47946
48126
  }
47947
48127
 
47948
48128
  // src/commands/watch/markSyncPending.ts
47949
- import { writeFileSync as writeFileSync55 } from "fs";
48129
+ import { writeFileSync as writeFileSync56 } from "fs";
47950
48130
  function writePendingMarker() {
47951
48131
  try {
47952
- writeFileSync55(syncPendingPath(), "");
48132
+ writeFileSync56(syncPendingPath(), "");
47953
48133
  } catch {
47954
48134
  }
47955
48135
  }
@@ -48269,10 +48449,10 @@ function registerWatchWait(watchCommand) {
48269
48449
  }
48270
48450
 
48271
48451
  // src/commands/watch/simulateDivergence.ts
48272
- import { writeFileSync as writeFileSync56 } from "fs";
48452
+ import { writeFileSync as writeFileSync57 } from "fs";
48273
48453
  function simulateDivergence() {
48274
48454
  try {
48275
- writeFileSync56(simulatedDivergencePath(), "");
48455
+ writeFileSync57(simulatedDivergencePath(), "");
48276
48456
  console.log(
48277
48457
  `the next assist watch wait poll in ${runGit3(["rev-parse", "--show-toplevel"])} will exit 3 as a simulated divergence`
48278
48458
  );
@@ -48366,8 +48546,8 @@ function registerWatch(program) {
48366
48546
 
48367
48547
  // src/commands/roam/postRoamActivity.ts
48368
48548
  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";
48549
+ import { readdirSync as readdirSync26, readFileSync as readFileSync73, statSync as statSync14 } from "fs";
48550
+ import { join as join109 } from "path";
48371
48551
  function findPortFile(roamDir) {
48372
48552
  let entries;
48373
48553
  try {
@@ -48376,7 +48556,7 @@ function findPortFile(roamDir) {
48376
48556
  return void 0;
48377
48557
  }
48378
48558
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
48379
- const path109 = join108(roamDir, name);
48559
+ const path109 = join109(roamDir, name);
48380
48560
  try {
48381
48561
  return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
48382
48562
  } catch {
@@ -48393,11 +48573,11 @@ var PID_BY_APP = {
48393
48573
  function postRoamActivity(app, event) {
48394
48574
  const appData = process.env.APPDATA;
48395
48575
  if (!appData) return;
48396
- const portFile = findPortFile(join108(appData, "Roam"));
48576
+ const portFile = findPortFile(join109(appData, "Roam"));
48397
48577
  if (!portFile) return;
48398
48578
  let port;
48399
48579
  try {
48400
- port = readFileSync72(portFile, "utf8").trim();
48580
+ port = readFileSync73(portFile, "utf8").trim();
48401
48581
  } catch {
48402
48582
  return;
48403
48583
  }
@@ -48576,8 +48756,8 @@ function link2() {
48576
48756
  }
48577
48757
 
48578
48758
  // src/commands/run/add.ts
48579
- import { mkdirSync as mkdirSync39, writeFileSync as writeFileSync57 } from "fs";
48580
- import { dirname as dirname46 } from "path";
48759
+ import { mkdirSync as mkdirSync40, writeFileSync as writeFileSync58 } from "fs";
48760
+ import { dirname as dirname47 } from "path";
48581
48761
 
48582
48762
  // src/commands/run/editRepoRunList.ts
48583
48763
  async function editRepoRunList(repoName, cwd, edit2) {
@@ -48736,11 +48916,11 @@ function requireParsedArgs() {
48736
48916
  }
48737
48917
 
48738
48918
  // src/commands/run/runCommandFilePath.ts
48739
- import { join as join109 } from "path";
48919
+ import { join as join110 } from "path";
48740
48920
  function runCommandFilePath(name) {
48741
48921
  const segments = name.split(":");
48742
48922
  const file = `${segments.pop()}.md`;
48743
- return join109(".claude", "commands", ...segments, file);
48923
+ return join110(".claude", "commands", ...segments, file);
48744
48924
  }
48745
48925
 
48746
48926
  // src/commands/run/add.ts
@@ -48757,14 +48937,14 @@ function saveProjectRunConfig(entry) {
48757
48937
  }
48758
48938
  function createCommandFile(name) {
48759
48939
  const filePath = runCommandFilePath(name);
48760
- mkdirSync39(dirname46(filePath), { recursive: true });
48940
+ mkdirSync40(dirname47(filePath), { recursive: true });
48761
48941
  const content = `---
48762
48942
  description: Run ${name}
48763
48943
  ---
48764
48944
 
48765
48945
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
48766
48946
  `;
48767
- writeFileSync57(filePath, content);
48947
+ writeFileSync58(filePath, content);
48768
48948
  console.log(`Created command file: ${filePath}`);
48769
48949
  }
48770
48950
  async function add4() {
@@ -48869,7 +49049,7 @@ function registerRunAdd(runCommand) {
48869
49049
 
48870
49050
  // src/commands/run/remove.ts
48871
49051
  import { existsSync as existsSync90, readdirSync as readdirSync27, rmdirSync, unlinkSync as unlinkSync20 } from "fs";
48872
- import { dirname as dirname47, join as join110 } from "path";
49052
+ import { dirname as dirname48, join as join111 } from "path";
48873
49053
 
48874
49054
  // src/commands/run/removeRepoRunConfig.ts
48875
49055
  function isNamed(entry, name) {
@@ -48887,15 +49067,15 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
48887
49067
 
48888
49068
  // src/commands/run/remove.ts
48889
49069
  function removeEmptyNamespaceDirs(filePath) {
48890
- const root2 = join110(".claude", "commands");
48891
- for (let dir = dirname47(filePath); dir !== root2; dir = dirname47(dir)) {
49070
+ const root2 = join111(".claude", "commands");
49071
+ for (let dir = dirname48(filePath); dir !== root2; dir = dirname48(dir)) {
48892
49072
  if (!existsSync90(dir) || readdirSync27(dir).length > 0) return;
48893
49073
  rmdirSync(dir);
48894
49074
  }
48895
49075
  }
48896
49076
  function deleteCommandFile(name) {
48897
49077
  const filePath = runCommandFilePath(name);
48898
- const legacyPath = join110(".claude", "commands", `${name}.md`);
49078
+ const legacyPath = join111(".claude", "commands", `${name}.md`);
48899
49079
  for (const path109 of /* @__PURE__ */ new Set([filePath, legacyPath])) {
48900
49080
  if (existsSync90(path109)) {
48901
49081
  unlinkSync20(path109);
@@ -49018,11 +49198,11 @@ function applyLine(result, pending, line) {
49018
49198
  }
49019
49199
 
49020
49200
  // src/commands/sessions/daemon/readDaemonPidFile.ts
49021
- import { readFileSync as readFileSync73 } from "fs";
49201
+ import { readFileSync as readFileSync74 } from "fs";
49022
49202
  function readDaemonPidFile() {
49023
49203
  try {
49024
49204
  const pid = Number.parseInt(
49025
- readFileSync73(daemonPaths.pid, "utf8").trim(),
49205
+ readFileSync74(daemonPaths.pid, "utf8").trim(),
49026
49206
  10
49027
49207
  );
49028
49208
  return Number.isInteger(pid) ? pid : void 0;
@@ -49179,7 +49359,7 @@ function requestDrain(socket, lines2) {
49179
49359
  }
49180
49360
 
49181
49361
  // src/commands/sessions/daemon/runDaemon.ts
49182
- import { mkdirSync as mkdirSync44 } from "fs";
49362
+ import { mkdirSync as mkdirSync45 } from "fs";
49183
49363
 
49184
49364
  // src/commands/sessions/daemon/broadcast.ts
49185
49365
  function sendTo(client, msg) {
@@ -49702,7 +49882,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
49702
49882
 
49703
49883
  // src/commands/sessions/daemon/findServerParents.ts
49704
49884
  import { existsSync as existsSync92 } from "fs";
49705
- import { join as join111, resolve as resolve32 } from "path";
49885
+ import { join as join112, resolve as resolve32 } from "path";
49706
49886
  function isLive(session) {
49707
49887
  return !!session.pty && session.status !== "done" && session.status !== "error";
49708
49888
  }
@@ -49711,7 +49891,7 @@ function isLiveAgent(session) {
49711
49891
  }
49712
49892
  function serverRunDirs(sessions, file) {
49713
49893
  return new Set(
49714
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join111(dir, file)))
49894
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve32(s.cwd)).filter((dir) => existsSync92(join112(dir, file)))
49715
49895
  );
49716
49896
  }
49717
49897
  function findServerParents(sessions, file) {
@@ -49865,7 +50045,7 @@ function sendResizeSnapshot(s, send) {
49865
50045
  }
49866
50046
 
49867
50047
  // src/commands/sessions/daemon/viewerSize.ts
49868
- import { readFileSync as readFileSync74, writeFileSync as writeFileSync58 } from "fs";
50048
+ import { readFileSync as readFileSync75, writeFileSync as writeFileSync59 } from "fs";
49869
50049
  var DEFAULT_SIZE = { cols: 120, rows: 30 };
49870
50050
  var remembered;
49871
50051
  function rememberViewerSize(cols, rows) {
@@ -49873,7 +50053,7 @@ function rememberViewerSize(cols, rows) {
49873
50053
  if (remembered?.cols === cols && remembered.rows === rows) return;
49874
50054
  remembered = { cols, rows };
49875
50055
  try {
49876
- writeFileSync58(daemonPaths.viewerSize, JSON.stringify(remembered));
50056
+ writeFileSync59(daemonPaths.viewerSize, JSON.stringify(remembered));
49877
50057
  } catch (error) {
49878
50058
  daemonLog(
49879
50059
  `viewer size ${cols}x${rows} not saved: ${error instanceof Error ? error.message : String(error)}`
@@ -49887,7 +50067,7 @@ function viewerSize() {
49887
50067
  function readSavedSize() {
49888
50068
  try {
49889
50069
  const { cols, rows } = JSON.parse(
49890
- readFileSync74(daemonPaths.viewerSize, "utf8")
50070
+ readFileSync75(daemonPaths.viewerSize, "utf8")
49891
50071
  );
49892
50072
  if (typeof cols === "number" && typeof rows === "number" && cols > 0)
49893
50073
  return { cols, rows };
@@ -50618,13 +50798,13 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
50618
50798
  }
50619
50799
 
50620
50800
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
50621
- import { existsSync as existsSync95, rmSync as rmSync15, writeFileSync as writeFileSync59 } from "fs";
50801
+ import { existsSync as existsSync95, rmSync as rmSync15, writeFileSync as writeFileSync60 } from "fs";
50622
50802
  var paused;
50623
50803
  var wake;
50624
50804
  var holdReleased = false;
50625
50805
  function persist2(value) {
50626
50806
  try {
50627
- if (value) writeFileSync59(daemonPaths.autoUpdatePaused, "");
50807
+ if (value) writeFileSync60(daemonPaths.autoUpdatePaused, "");
50628
50808
  else rmSync15(daemonPaths.autoUpdatePaused, { force: true });
50629
50809
  } catch {
50630
50810
  }
@@ -50765,29 +50945,29 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
50765
50945
  }
50766
50946
 
50767
50947
  // src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
50768
- import { readFileSync as readFileSync75, writeFileSync as writeFileSync60 } from "fs";
50948
+ import { readFileSync as readFileSync76, writeFileSync as writeFileSync61 } from "fs";
50769
50949
  var KEEP_TAIL = 256 * 1024;
50770
50950
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
50771
50951
  function trimWatcherLog(cwd) {
50772
50952
  const path109 = watcherLogPath(cwd);
50773
50953
  let log2;
50774
50954
  try {
50775
- log2 = readFileSync75(path109, "utf8");
50955
+ log2 = readFileSync76(path109, "utf8");
50776
50956
  } catch {
50777
50957
  return;
50778
50958
  }
50779
50959
  if (log2.length <= MAX_LOG_SIZE) return;
50780
- writeFileSync60(path109, log2.slice(-KEEP_TAIL));
50960
+ writeFileSync61(path109, log2.slice(-KEEP_TAIL));
50781
50961
  daemonLog(`auto-update: log ${path109} trimmed to its last ${KEEP_TAIL} chars`);
50782
50962
  }
50783
50963
 
50784
50964
  // src/commands/sessions/daemon/worktree/appendWatcherLog.ts
50785
- import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync40 } from "fs";
50786
- import { dirname as dirname49 } from "path";
50965
+ import { appendFileSync as appendFileSync5, mkdirSync as mkdirSync41 } from "fs";
50966
+ import { dirname as dirname50 } from "path";
50787
50967
  function appendWatcherLog(cwd, data) {
50788
50968
  try {
50789
50969
  const path109 = watcherLogPath(cwd);
50790
- mkdirSync40(dirname49(path109), { recursive: true });
50970
+ mkdirSync41(dirname50(path109), { recursive: true });
50791
50971
  appendFileSync5(path109, data);
50792
50972
  } catch {
50793
50973
  }
@@ -50864,9 +51044,9 @@ import { existsSync as existsSync97 } from "fs";
50864
51044
 
50865
51045
  // src/commands/sessions/daemon/worktree/holdsNoCheckout.ts
50866
51046
  import { existsSync as existsSync96 } from "fs";
50867
- import { join as join113 } from "path";
51047
+ import { join as join114 } from "path";
50868
51048
  function holdsNoCheckout(path109) {
50869
- return existsSync96(path109) && !existsSync96(join113(path109, ".git"));
51049
+ return existsSync96(path109) && !existsSync96(join114(path109, ".git"));
50870
51050
  }
50871
51051
 
50872
51052
  // src/commands/sessions/daemon/worktree/treeDurability.ts
@@ -51200,12 +51380,12 @@ import { basename as basename32 } from "path";
51200
51380
 
51201
51381
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
51202
51382
  import { existsSync as existsSync98 } from "fs";
51203
- import { join as join115 } from "path";
51383
+ import { join as join116 } from "path";
51204
51384
 
51205
51385
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
51206
51386
  import { statSync as statSync16 } from "fs";
51207
51387
  import { rm as rm3 } from "fs/promises";
51208
- import { join as join114 } from "path";
51388
+ import { join as join115 } from "path";
51209
51389
  async function deleteTreeDirectly(clone, worktreePath, why) {
51210
51390
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
51211
51391
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -51234,7 +51414,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
51234
51414
  return { removed: true };
51235
51415
  }
51236
51416
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
51237
- return statSync16(join114(worktreePath, ".git"), {
51417
+ return statSync16(join115(worktreePath, ".git"), {
51238
51418
  throwIfNoEntry: false
51239
51419
  })?.isDirectory() === true;
51240
51420
  }
@@ -51275,7 +51455,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
51275
51455
  );
51276
51456
  }
51277
51457
  function strandedReason(worktreePath, cause) {
51278
- if (!existsSync98(join115(worktreePath, ".git")))
51458
+ if (!existsSync98(join116(worktreePath, ".git")))
51279
51459
  return "its .git link is already gone";
51280
51460
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
51281
51461
  return "git no longer recognises it as a working tree";
@@ -51595,7 +51775,7 @@ function pidList(pids) {
51595
51775
  }
51596
51776
 
51597
51777
  // src/commands/sessions/daemon/worktree/readOccupant.ts
51598
- import { readFileSync as readFileSync76 } from "fs";
51778
+ import { readFileSync as readFileSync77 } from "fs";
51599
51779
  var VSCODE_PATHS = [
51600
51780
  "/.vscode-server/",
51601
51781
  "/.vscode-server-insiders/",
@@ -51630,7 +51810,7 @@ function parentPid(stat5) {
51630
51810
  }
51631
51811
  function readProc(procRoot, pid, file) {
51632
51812
  try {
51633
- return readFileSync76(`${procRoot}/${pid}/${file}`, "utf8");
51813
+ return readFileSync77(`${procRoot}/${pid}/${file}`, "utf8");
51634
51814
  } catch {
51635
51815
  return void 0;
51636
51816
  }
@@ -52460,8 +52640,8 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
52460
52640
  }
52461
52641
 
52462
52642
  // 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";
52643
+ import { existsSync as existsSync102, mkdirSync as mkdirSync42, watch as watch2 } from "fs";
52644
+ import { dirname as dirname51 } from "path";
52465
52645
 
52466
52646
  // src/commands/sessions/daemon/applyActivityToSession.ts
52467
52647
  function applyActivityToSession(session, activity2) {
@@ -52522,15 +52702,15 @@ var DEBOUNCE_MS2 = 50;
52522
52702
  function watchActivity(session, notify2, onClaudeSessionId) {
52523
52703
  if (session.commandType !== "assist" || !session.cwd) return;
52524
52704
  const path109 = activityPath(session.id);
52525
- const dir = dirname50(path109);
52705
+ const dir = dirname51(path109);
52526
52706
  try {
52527
- mkdirSync41(dir, { recursive: true });
52707
+ mkdirSync42(dir, { recursive: true });
52528
52708
  } catch {
52529
52709
  return;
52530
52710
  }
52531
52711
  reconcileActivity(session.id, session.activity);
52532
52712
  let timer = null;
52533
- const read3 = () => {
52713
+ const read4 = () => {
52534
52714
  timer = null;
52535
52715
  const activity2 = readActivity(path109);
52536
52716
  if (!activity2) return;
@@ -52543,9 +52723,9 @@ function watchActivity(session, notify2, onClaudeSessionId) {
52543
52723
  session.activityWatcher = watch2(dir, (_event, filename) => {
52544
52724
  if (filename && !path109.endsWith(filename)) return;
52545
52725
  if (timer) clearTimeout(timer);
52546
- timer = setTimeout(read3, DEBOUNCE_MS2);
52726
+ timer = setTimeout(read4, DEBOUNCE_MS2);
52547
52727
  });
52548
- if (existsSync102(path109)) read3();
52728
+ if (existsSync102(path109)) read4();
52549
52729
  }
52550
52730
  function refreshActivity(session) {
52551
52731
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -52689,10 +52869,10 @@ function bindCodexSession(session, notify2) {
52689
52869
  import { watch as watch3 } from "fs";
52690
52870
 
52691
52871
  // src/commands/sessions/daemon/ensureProjectDirExists.ts
52692
- import { mkdirSync as mkdirSync42 } from "fs";
52872
+ import { mkdirSync as mkdirSync43 } from "fs";
52693
52873
  function ensureProjectDirExists(dir, sessionId2) {
52694
52874
  try {
52695
- mkdirSync42(dir, { recursive: true });
52875
+ mkdirSync43(dir, { recursive: true });
52696
52876
  return true;
52697
52877
  } catch (error) {
52698
52878
  daemonLog(
@@ -53529,7 +53709,7 @@ function settleTransfer(client, deps2, s, outcome, traceId) {
53529
53709
  }
53530
53710
 
53531
53711
  // src/commands/sessions/daemon/transfer/handOffToTarget.ts
53532
- async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot }) {
53712
+ async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot: snapshot2 }) {
53533
53713
  const outcome = await launchOnTarget(deps2.links, {
53534
53714
  type: "create-assist",
53535
53715
  assistArgs: args,
@@ -53538,7 +53718,7 @@ async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, s
53538
53718
  title: s.title,
53539
53719
  subtitle: s.subtitle,
53540
53720
  traceId,
53541
- transfer: snapshot
53721
+ transfer: snapshot2
53542
53722
  });
53543
53723
  settleTransfer(client, deps2, s, outcome, traceId);
53544
53724
  }
@@ -53643,11 +53823,11 @@ async function pushTransferSnapshot(path109, itemId2, treeRoot) {
53643
53823
  async function snapshotTree(s, args, traceId) {
53644
53824
  const path109 = s.worktree?.path ?? s.cwd;
53645
53825
  if (!path109) return void 0;
53646
- const snapshot = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
53826
+ const snapshot2 = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
53647
53827
  daemonLog(
53648
- `session ${s.id} pushed ${path109} to ${snapshot.ref} (branch=${snapshot.branch ?? "tree"} upstream=${snapshot.upstream ?? "none"}) trace=${traceId}`
53828
+ `session ${s.id} pushed ${path109} to ${snapshot2.ref} (branch=${snapshot2.branch ?? "tree"} upstream=${snapshot2.upstream ?? "none"}) trace=${traceId}`
53649
53829
  );
53650
- return snapshot;
53830
+ return snapshot2;
53651
53831
  }
53652
53832
 
53653
53833
  // src/commands/sessions/daemon/transfer/snapshotOrFail.ts
@@ -55640,9 +55820,9 @@ function logUnrecognisedType(seen, prefix2, type) {
55640
55820
 
55641
55821
  // src/commands/sessions/daemon/links/relayLinkSessions.ts
55642
55822
  function relayLinkSessions(state, msg) {
55643
- const snapshot = JSON.stringify(msg.sessions ?? []);
55644
- if (snapshot === state.lastSnapshot) return;
55645
- state.lastSnapshot = snapshot;
55823
+ const snapshot2 = JSON.stringify(msg.sessions ?? []);
55824
+ if (snapshot2 === state.lastSnapshot) return;
55825
+ state.lastSnapshot = snapshot2;
55646
55826
  const ns = (id) => toNodeSessionId(state.node, id);
55647
55827
  state.sessions = (msg.sessions ?? []).map((s) => ({
55648
55828
  ...s,
@@ -56245,8 +56425,8 @@ function resumeSession(id, sessionId2, cwd, name, holdPty, harness) {
56245
56425
  import { existsSync as existsSync106 } from "fs";
56246
56426
 
56247
56427
  // 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";
56428
+ import { copyFileSync as copyFileSync4, existsSync as existsSync105, mkdirSync as mkdirSync44 } from "fs";
56429
+ import { join as join117 } from "path";
56250
56430
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56251
56431
  const dir = projectDirForCwd(toCwd);
56252
56432
  if (dir === projectDirForCwd(fromCwd)) {
@@ -56255,7 +56435,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56255
56435
  );
56256
56436
  return;
56257
56437
  }
56258
- const dest = join116(dir, `${claudeSessionId}.jsonl`);
56438
+ const dest = join117(dir, `${claudeSessionId}.jsonl`);
56259
56439
  if (existsSync105(dest)) {
56260
56440
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
56261
56441
  return;
@@ -56268,7 +56448,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
56268
56448
  return;
56269
56449
  }
56270
56450
  try {
56271
- mkdirSync43(dir, { recursive: true });
56451
+ mkdirSync44(dir, { recursive: true });
56272
56452
  copyFileSync4(source, dest);
56273
56453
  daemonLog(
56274
56454
  `transcript ${source} copied to ${dest} so ${toCwd} can resume it`
@@ -56573,10 +56753,10 @@ function autoUpdateReply() {
56573
56753
  }
56574
56754
 
56575
56755
  // src/commands/sessions/daemon/autoUpdate/applyAutoUpdateAction.ts
56576
- import { rmSync as rmSync17, writeFileSync as writeFileSync61 } from "fs";
56756
+ import { rmSync as rmSync17, writeFileSync as writeFileSync62 } from "fs";
56577
56757
  function signalLap(installDir, marker2) {
56578
56758
  const control = watchControlPaths(installDir);
56579
- if (control) writeFileSync61(control[marker2], "");
56759
+ if (control) writeFileSync62(control[marker2], "");
56580
56760
  }
56581
56761
  function applyAutoUpdateAction(action) {
56582
56762
  const installDir = getInstallDir();
@@ -56645,6 +56825,12 @@ var handleHelloRequest = (client, m, d) => {
56645
56825
  m.replayLocal(client);
56646
56826
  };
56647
56827
 
56828
+ // src/commands/sessions/daemon/handleWebLog.ts
56829
+ var handleWebLog = (client, _m, d) => {
56830
+ daemonLog(`web: ${String(d.message)}`);
56831
+ sendTo(client, { type: "web-logged" });
56832
+ };
56833
+
56648
56834
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
56649
56835
  import * as fs55 from "fs";
56650
56836
  import * as readline5 from "readline";
@@ -57497,8 +57683,8 @@ async function confirmTransferredRun(sessions, id, trace) {
57497
57683
 
57498
57684
  // src/commands/sessions/daemon/transfer/restoreTransferSnapshot.ts
57499
57685
  var FETCH_TIMEOUT_MS2 = 12e4;
57500
- async function switchToSnapshot(path109, snapshot, sha) {
57501
- const { branch: branch2 } = snapshot;
57686
+ async function switchToSnapshot(path109, snapshot2, sha) {
57687
+ const { branch: branch2 } = snapshot2;
57502
57688
  if (!branch2 || branch2 === await remoteDefaultBranch(path109)) {
57503
57689
  await git2(path109, ["reset", "--hard", "--quiet", sha]);
57504
57690
  return await gitOrNull(path109, ["symbolic-ref", "--short", "HEAD"]) ?? sha;
@@ -57517,33 +57703,33 @@ async function trackUpstream(path109, upstream) {
57517
57703
  `transfer restore ${path109}: could not track origin/${upstream}: ${tracked.error}`
57518
57704
  );
57519
57705
  }
57520
- async function restoreTransferSnapshot(path109, snapshot) {
57706
+ async function restoreTransferSnapshot(path109, snapshot2) {
57521
57707
  if (await gitOrNull(path109, ["status", "--porcelain"]))
57522
57708
  throw new Error(`${path109} has uncommitted changes`);
57523
57709
  await git2(
57524
57710
  path109,
57525
- ["fetch", "--quiet", "origin", `refs/heads/${snapshot.ref}`],
57711
+ ["fetch", "--quiet", "origin", `refs/heads/${snapshot2.ref}`],
57526
57712
  FETCH_TIMEOUT_MS2
57527
57713
  );
57528
57714
  const sha = (await git2(path109, ["rev-parse", "FETCH_HEAD"])).trim();
57529
- const branch2 = await switchToSnapshot(path109, snapshot, sha);
57715
+ const branch2 = await switchToSnapshot(path109, snapshot2, sha);
57530
57716
  await git2(path109, ["reset", "--soft", "--quiet", "HEAD~1"]);
57531
- if (snapshot.upstream) await trackUpstream(path109, snapshot.upstream);
57717
+ if (snapshot2.upstream) await trackUpstream(path109, snapshot2.upstream);
57532
57718
  daemonLog(
57533
- `transfer restore ${path109}: ${snapshot.ref} restored onto ${branch2}${snapshot.upstream ? ` tracking origin/${snapshot.upstream}` : ""}`
57719
+ `transfer restore ${path109}: ${snapshot2.ref} restored onto ${branch2}${snapshot2.upstream ? ` tracking origin/${snapshot2.upstream}` : ""}`
57534
57720
  );
57535
57721
  const deleted = await gitResult(
57536
57722
  path109,
57537
- ["push", "--no-verify", "--quiet", "origin", "--delete", snapshot.ref],
57723
+ ["push", "--no-verify", "--quiet", "origin", "--delete", snapshot2.ref],
57538
57724
  FETCH_TIMEOUT_MS2
57539
57725
  );
57540
57726
  daemonLog(
57541
- deleted.ok ? `transfer restore ${path109}: deleted ${snapshot.ref} from origin` : `transfer restore ${path109}: could not delete ${snapshot.ref} from origin: ${deleted.error}`
57727
+ deleted.ok ? `transfer restore ${path109}: deleted ${snapshot2.ref} from origin` : `transfer restore ${path109}: could not delete ${snapshot2.ref} from origin: ${deleted.error}`
57542
57728
  );
57543
57729
  }
57544
57730
 
57545
57731
  // src/commands/sessions/daemon/transfer/spawnTransferredRun.ts
57546
- async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot, traceId }, context) {
57732
+ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot: snapshot2, traceId }, context) {
57547
57733
  const trace = `trace=${traceId ?? "none"}`;
57548
57734
  const { id, prepared } = allocatePreparedAndBind(
57549
57735
  ctx,
@@ -57551,8 +57737,8 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
57551
57737
  (sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
57552
57738
  async (path109) => {
57553
57739
  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);
57740
+ daemonLog(`transfer restore ${path109}: fetching ${snapshot2.ref} ${trace}`);
57741
+ await restoreTransferSnapshot(path109, snapshot2);
57556
57742
  },
57557
57743
  { inPlace: meta.inPlace },
57558
57744
  context
@@ -57562,7 +57748,7 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
57562
57748
  } catch (error) {
57563
57749
  const reason4 = error instanceof Error ? error.message : String(error);
57564
57750
  daemonLog(
57565
- `session ${id} transfer restore failed ${trace}: ${reason4}; run not started, ${snapshot.ref} left on origin`
57751
+ `session ${id} transfer restore failed ${trace}: ${reason4}; run not started, ${snapshot2.ref} left on origin`
57566
57752
  );
57567
57753
  discard(id);
57568
57754
  throw new Error(`restore failed: ${reason4}`);
@@ -57627,8 +57813,8 @@ function spawnAssistCreate(m, d) {
57627
57813
  subtitle: d.subtitle,
57628
57814
  ...d.autoApprove === true && { autoApprove: true }
57629
57815
  };
57630
- const snapshot = parseTransferSnapshot(d.transfer);
57631
- if (snapshot)
57816
+ const snapshot2 = parseTransferSnapshot(d.transfer);
57817
+ if (snapshot2)
57632
57818
  return spawnTransferredRun(
57633
57819
  m.treeCtx(),
57634
57820
  m.discardSession,
@@ -57636,7 +57822,7 @@ function spawnAssistCreate(m, d) {
57636
57822
  assistArgs,
57637
57823
  cwd,
57638
57824
  meta: { ...meta, inPlace },
57639
- snapshot,
57825
+ snapshot: snapshot2,
57640
57826
  traceId: d.traceId
57641
57827
  },
57642
57828
  spawnContextFrom(d)
@@ -57710,6 +57896,7 @@ var handleCancelTransfer = routed((_client, m, d) => {
57710
57896
  var messageHandlers = {
57711
57897
  ping: (client) => sendTo(client, { type: "pong", pid: process.pid }),
57712
57898
  "subscribe-logs": (client, m, d) => m.clients.subscribeLogs(client, d.replay !== false),
57899
+ "web-log": handleWebLog,
57713
57900
  hello: handleHelloRequest,
57714
57901
  output: handleOutputRequest,
57715
57902
  nodes: (client, m) => m.links.sendNodes(client),
@@ -57827,10 +58014,10 @@ function handleConnection(socket, manager) {
57827
58014
  }
57828
58015
 
57829
58016
  // src/commands/sessions/daemon/onListening.ts
57830
- import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync62 } from "fs";
58017
+ import { unlinkSync as unlinkSync21, writeFileSync as writeFileSync63 } from "fs";
57831
58018
 
57832
58019
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
57833
- import { readFileSync as readFileSync77 } from "fs";
58020
+ import { readFileSync as readFileSync78 } from "fs";
57834
58021
  var WATCHDOG_INTERVAL_MS = 5e3;
57835
58022
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
57836
58023
  const timer = setInterval(() => {
@@ -57841,7 +58028,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
57841
58028
  }
57842
58029
  function ownsPidFile() {
57843
58030
  try {
57844
- return readFileSync77(daemonPaths.pid, "utf8").trim() === String(process.pid);
58031
+ return readFileSync78(daemonPaths.pid, "utf8").trim() === String(process.pid);
57845
58032
  } catch {
57846
58033
  return false;
57847
58034
  }
@@ -57849,7 +58036,7 @@ function ownsPidFile() {
57849
58036
 
57850
58037
  // src/commands/sessions/daemon/onListening.ts
57851
58038
  function onListening(manager, checkAutoExit) {
57852
- writeFileSync62(daemonPaths.pid, String(process.pid));
58039
+ writeFileSync63(daemonPaths.pid, String(process.pid));
57853
58040
  startPidFileWatchdog(() => {
57854
58041
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
57855
58042
  void manager.flushActiveMs().finally(() => {
@@ -57938,7 +58125,7 @@ async function recoverFromAddrInUse(server, manager, checkAutoExit) {
57938
58125
 
57939
58126
  // src/commands/sessions/daemon/runDaemon.ts
57940
58127
  async function runDaemon() {
57941
- mkdirSync44(daemonPaths.dir, { recursive: true });
58128
+ mkdirSync45(daemonPaths.dir, { recursive: true });
57942
58129
  daemonLog(
57943
58130
  `starting (reason: ${process.env.ASSIST_DAEMON_SPAWN_REASON ?? "manual"})`
57944
58131
  );