@staff0rd/assist 0.970.0 → 0.972.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.970.0",
9
+ version: "0.972.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -369,9 +369,9 @@ var daemonPaths = {
369
369
 
370
370
  // src/commands/sessions/daemon/connectToDaemon.ts
371
371
  function connectToDaemon() {
372
- return new Promise((resolve31, reject) => {
372
+ return new Promise((resolve32, reject) => {
373
373
  const socket = net.connect(daemonPaths.socket);
374
- socket.once("connect", () => resolve31(socket));
374
+ socket.once("connect", () => resolve32(socket));
375
375
  socket.once("error", reject);
376
376
  });
377
377
  }
@@ -452,7 +452,7 @@ function spawnDaemon(reason4) {
452
452
  child.unref();
453
453
  }
454
454
  function delay(ms) {
455
- return new Promise((resolve31) => setTimeout(resolve31, ms));
455
+ return new Promise((resolve32) => setTimeout(resolve32, ms));
456
456
  }
457
457
 
458
458
  // src/shared/loadConfig.ts
@@ -1630,7 +1630,7 @@ var defaultDeps = {
1630
1630
  serve: async (args) => {
1631
1631
  await runTailscale(args);
1632
1632
  },
1633
- sleep: (ms) => new Promise((resolve31) => setTimeout(resolve31, ms)),
1633
+ sleep: (ms) => new Promise((resolve32) => setTimeout(resolve32, ms)),
1634
1634
  httpsPort: tailnetHttpsPort
1635
1635
  };
1636
1636
  async function ensureTailscaleServe(port, deps2 = {}) {
@@ -1665,11 +1665,11 @@ function createLinkWaiters() {
1665
1665
  const waiters = /* @__PURE__ */ new Set();
1666
1666
  return {
1667
1667
  wait(timeoutMs, onTimeout) {
1668
- return new Promise((resolve31, reject) => {
1668
+ return new Promise((resolve32, reject) => {
1669
1669
  const onLink = (link3) => {
1670
1670
  clearTimeout(timer);
1671
1671
  waiters.delete(onLink);
1672
- resolve31(link3);
1672
+ resolve32(link3);
1673
1673
  };
1674
1674
  const timer = setTimeout(() => {
1675
1675
  waiters.delete(onLink);
@@ -1732,7 +1732,7 @@ function createPendingReplies() {
1732
1732
  return {
1733
1733
  send(ws, timeoutMs, write) {
1734
1734
  const id = randomUUID();
1735
- return new Promise((resolve31, reject) => {
1735
+ return new Promise((resolve32, reject) => {
1736
1736
  const timer = setTimeout(() => {
1737
1737
  pending.delete(id);
1738
1738
  reject(
@@ -1742,7 +1742,7 @@ function createPendingReplies() {
1742
1742
  )
1743
1743
  );
1744
1744
  }, timeoutMs);
1745
- pending.set(id, { ws, timer, resolve: resolve31, reject });
1745
+ pending.set(id, { ws, timer, resolve: resolve32, reject });
1746
1746
  write(id);
1747
1747
  });
1748
1748
  },
@@ -3782,13 +3782,29 @@ function storyEntry(story) {
3782
3782
  }
3783
3783
  function buildDocsRefreshDescription(stories) {
3784
3784
  return [
3785
- "Update the docs pages under `docs/src/content/docs/` from what these done stories shipped. Stories already add `covers` entries for new commands and config keys; this item handles prose: wording, new behaviour on existing pages, and removed features.",
3785
+ "Update the docs pages under `docs/src/content/docs/` from what these done stories shipped. Stories leave docs alone during development, so this item owns both the prose (wording, new behaviour on existing pages, removed features) and the `covers` entries that document new commands, skills, config keys and routes.",
3786
3786
  "For detail on a story, run `assist backlog view <id>` (description, acceptance criteria, summaries and activity) and `git show <sha>` on its commits.",
3787
3787
  "## Covered stories",
3788
3788
  ...stories.map(storyEntry)
3789
3789
  ].join("\n\n");
3790
3790
  }
3791
3791
 
3792
+ // src/shared/isRunLink.ts
3793
+ function isRunLink(entry) {
3794
+ return "link" in entry;
3795
+ }
3796
+
3797
+ // src/commands/backlog/hasDocsCoverageRun.ts
3798
+ function hasDocsCoverageRun() {
3799
+ try {
3800
+ return (loadConfigFrom(getBacklogDir()).run ?? []).some(
3801
+ (entry) => !isRunLink(entry) && entry.name === "docs:coverage"
3802
+ );
3803
+ } catch {
3804
+ return false;
3805
+ }
3806
+ }
3807
+
3792
3808
  // src/commands/backlog/insertPhaseAt.ts
3793
3809
  import { eq as eq12 } from "drizzle-orm";
3794
3810
 
@@ -3837,7 +3853,7 @@ async function loadDocsRefreshStories(orm, ids) {
3837
3853
  }
3838
3854
 
3839
3855
  // src/commands/backlog/createDocsRefreshItem.ts
3840
- async function createDocsRefreshItem(orm, origin, storyIds) {
3856
+ async function createDocsRefreshItem(orm, origin, storyIds, coverageCheck = hasDocsCoverageRun()) {
3841
3857
  const stories = await loadDocsRefreshStories(orm, storyIds);
3842
3858
  const storyList = storyIds.map(formatItemId).join(", ");
3843
3859
  const id = await insertItem(
@@ -3863,7 +3879,10 @@ async function createDocsRefreshItem(orm, origin, storyIds) {
3863
3879
  [
3864
3880
  `Walk each covered story (${storyList}): read it with \`assist backlog view <id>\` and its commits with \`git show <sha>\`, and note what it changed for users`,
3865
3881
  "Skip stories with no user-facing change and leave their pages untouched",
3866
- "For the rest, update the affected pages under `docs/src/content/docs/` (wording, new behaviour on existing pages, removed features) following the rules in `docs/CLAUDE.md`"
3882
+ "For the rest, update the affected pages under `docs/src/content/docs/` (wording, new behaviour on existing pages, removed features) following the rules in `docs/CLAUDE.md`",
3883
+ ...coverageCheck ? [
3884
+ "Run `assist run docs:coverage`; while it fails, list the gaps with `assist run docs:coverage --report` and add `covers` entries to the pages that document them (or new pages) until it passes"
3885
+ ] : []
3867
3886
  ],
3868
3887
  null,
3869
3888
  void 0
@@ -4074,12 +4093,12 @@ async function loadVisibleItems(req) {
4074
4093
 
4075
4094
  // src/commands/backlog/web/parseStatusBody.ts
4076
4095
  function readBody(req) {
4077
- return new Promise((resolve31, reject) => {
4096
+ return new Promise((resolve32, reject) => {
4078
4097
  let body = "";
4079
4098
  req.on("data", (chunk) => {
4080
4099
  body += chunk.toString();
4081
4100
  });
4082
- req.on("end", () => resolve31(body));
4101
+ req.on("end", () => resolve32(body));
4083
4102
  req.on("error", reject);
4084
4103
  });
4085
4104
  }
@@ -4611,11 +4630,11 @@ async function requestDaemonReply(request, replyType, timeoutMs = QUERY_TIMEOUT_
4611
4630
  } catch {
4612
4631
  return void 0;
4613
4632
  }
4614
- return new Promise((resolve31) => {
4633
+ return new Promise((resolve32) => {
4615
4634
  const finish2 = (result) => {
4616
4635
  clearTimeout(timer);
4617
4636
  socket.destroy();
4618
- resolve31(result);
4637
+ resolve32(result);
4619
4638
  };
4620
4639
  const timer = setTimeout(() => finish2(void 0), timeoutMs);
4621
4640
  const lines2 = createInterface2({ input: socket });
@@ -4810,7 +4829,7 @@ function parseIncoming(line, type) {
4810
4829
  }
4811
4830
  }
4812
4831
  function requestSession(message3) {
4813
- return new Promise((resolve31, reject) => {
4832
+ return new Promise((resolve32, reject) => {
4814
4833
  connectToDaemon().then((socket) => {
4815
4834
  let settled = false;
4816
4835
  const finish2 = (error, sessionId) => {
@@ -4818,7 +4837,7 @@ function requestSession(message3) {
4818
4837
  settled = true;
4819
4838
  socket.destroy();
4820
4839
  if (error) reject(error);
4821
- else resolve31(sessionId);
4840
+ else resolve32(sessionId);
4822
4841
  };
4823
4842
  readSocketLines(socket, (line) => {
4824
4843
  const incoming = parseIncoming(line, message3.type);
@@ -6707,11 +6726,6 @@ function findLinkedConfigPath(linkPath, fromDir) {
6707
6726
  throw new Error(`No assist.yml found in linked project: ${resolved}`);
6708
6727
  }
6709
6728
 
6710
- // src/shared/isRunLink.ts
6711
- function isRunLink(entry) {
6712
- return "link" in entry;
6713
- }
6714
-
6715
6729
  // src/shared/loadLinkedEntries.ts
6716
6730
  import { resolve as resolve6 } from "path";
6717
6731
  function loadLinkedEntries(configPath, visited) {
@@ -8150,7 +8164,7 @@ function forwardToPeer(req, res, node, url) {
8150
8164
  const label = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
8151
8165
  const log2 = (outcome) => console.log(`${label} -> ${outcome} (${Date.now() - started}ms)`);
8152
8166
  const send = url.protocol === "https:" ? httpsRequest : httpRequest;
8153
- return new Promise((resolve31) => {
8167
+ return new Promise((resolve32) => {
8154
8168
  const upstream = send(
8155
8169
  url,
8156
8170
  {
@@ -8162,7 +8176,7 @@ function forwardToPeer(req, res, node, url) {
8162
8176
  [TRACE_HEADER]: traceId
8163
8177
  }
8164
8178
  },
8165
- (peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve31)
8179
+ (peer) => relayPeerResponse(peer, res, url.pathname, log2, resolve32)
8166
8180
  );
8167
8181
  boundUpstream(upstream, res, peerTimeoutFor(url.pathname));
8168
8182
  upstream.on("error", (error) => {
@@ -8172,7 +8186,7 @@ function forwardToPeer(req, res, node, url) {
8172
8186
  respondJson(res, 502, {
8173
8187
  error: `${node} unreachable: ${error.message}`
8174
8188
  });
8175
- resolve31();
8189
+ resolve32();
8176
8190
  });
8177
8191
  req.pipe(upstream);
8178
8192
  });
@@ -10543,17 +10557,17 @@ async function stopDaemon() {
10543
10557
  }
10544
10558
  }
10545
10559
  function closedBeforeTimeout(socket) {
10546
- return new Promise((resolve31) => {
10560
+ return new Promise((resolve32) => {
10547
10561
  const timer = setTimeout(() => {
10548
10562
  socket.destroy();
10549
- resolve31(false);
10563
+ resolve32(false);
10550
10564
  }, STOP_TIMEOUT_MS);
10551
10565
  socket.resume();
10552
10566
  socket.on("error", () => {
10553
10567
  });
10554
10568
  socket.once("close", () => {
10555
10569
  clearTimeout(timer);
10556
- resolve31(true);
10570
+ resolve32(true);
10557
10571
  });
10558
10572
  });
10559
10573
  }
@@ -10611,8 +10625,8 @@ async function restartWeb(req, res, deps2 = {}) {
10611
10625
  return;
10612
10626
  }
10613
10627
  console.log(`restart ${target} ${linkedRequester(req)}`);
10614
- await new Promise((resolve31) => {
10615
- res.once("finish", resolve31);
10628
+ await new Promise((resolve32) => {
10629
+ res.once("finish", resolve32);
10616
10630
  respondJson(res, 200, { ok: true });
10617
10631
  });
10618
10632
  try {
@@ -10803,8 +10817,8 @@ async function selfUpdate(req, res, deps2 = {}) {
10803
10817
  return;
10804
10818
  }
10805
10819
  console.log("self-update: updated; restarting daemon and web server");
10806
- await new Promise((resolve31) => {
10807
- res.once("finish", resolve31);
10820
+ await new Promise((resolve32) => {
10821
+ res.once("finish", resolve32);
10808
10822
  respondJson(res, 200, { ok: true });
10809
10823
  });
10810
10824
  await performRestart("both", restartDeps);
@@ -10899,14 +10913,14 @@ function linkWebSocketUrl(url) {
10899
10913
  return target.toString();
10900
10914
  }
10901
10915
  function connectLinkWebSocket(url, handlers) {
10902
- return new Promise((resolve31, reject) => {
10916
+ return new Promise((resolve32, reject) => {
10903
10917
  const ws = new WebSocket(linkWebSocketUrl(url), {
10904
10918
  handshakeTimeout: HANDSHAKE_TIMEOUT_MS
10905
10919
  });
10906
10920
  let open = false;
10907
10921
  ws.on("open", () => {
10908
10922
  open = true;
10909
- resolve31({
10923
+ resolve32({
10910
10924
  send: (line) => {
10911
10925
  if (ws.readyState !== WebSocket.OPEN) return false;
10912
10926
  ws.send(line);
@@ -10932,8 +10946,8 @@ var HELLO_TIMEOUT_MS = 5e3;
10932
10946
  async function probePeerHello(url) {
10933
10947
  let settle = () => {
10934
10948
  };
10935
- const reply2 = new Promise((resolve31) => {
10936
- settle = resolve31;
10949
+ const reply2 = new Promise((resolve32) => {
10950
+ settle = resolve32;
10937
10951
  });
10938
10952
  const socket = await connectLinkWebSocket(url, {
10939
10953
  onLine: (line) => {
@@ -12824,10 +12838,10 @@ function gitInvocation(cwd, args) {
12824
12838
  }
12825
12839
  function git2(cwd, args, timeout) {
12826
12840
  const { file, argv, options: options2 } = gitInvocation(cwd, args);
12827
- return new Promise((resolve31, reject) => {
12841
+ return new Promise((resolve32, reject) => {
12828
12842
  execFile10(file, argv, { ...options2, timeout }, (error, stdout) => {
12829
12843
  if (error) reject(error);
12830
- else resolve31(stdout.toString());
12844
+ else resolve32(stdout.toString());
12831
12845
  });
12832
12846
  });
12833
12847
  }
@@ -14177,7 +14191,7 @@ ${failed3.length} script(s) failed:`);
14177
14191
  }
14178
14192
  }
14179
14193
  function runEntry(entry) {
14180
- return new Promise((resolve31) => {
14194
+ return new Promise((resolve32) => {
14181
14195
  const startTime = Date.now();
14182
14196
  const child = spawnCommand(
14183
14197
  entry.fullCommand,
@@ -14189,7 +14203,7 @@ function runEntry(entry) {
14189
14203
  child.on("close", (code) => {
14190
14204
  const exitCode = code ?? 1;
14191
14205
  flushIfFailed(exitCode, chunks);
14192
- resolve31({
14206
+ resolve32({
14193
14207
  script: entry.name,
14194
14208
  code: exitCode,
14195
14209
  durationMs: Date.now() - startTime
@@ -15085,7 +15099,7 @@ function parsePreviewDecision(line, requestId) {
15085
15099
 
15086
15100
  // src/commands/sessions/shared/requestPreviewDecision.ts
15087
15101
  function requestPreviewDecision(request) {
15088
- return new Promise((resolve31, reject) => {
15102
+ return new Promise((resolve32, reject) => {
15089
15103
  connectToDaemon().then((socket) => {
15090
15104
  let settled = false;
15091
15105
  const finish2 = (error, outcome) => {
@@ -15093,7 +15107,7 @@ function requestPreviewDecision(request) {
15093
15107
  settled = true;
15094
15108
  socket.destroy();
15095
15109
  if (error) reject(error);
15096
- else resolve31(outcome);
15110
+ else resolve32(outcome);
15097
15111
  };
15098
15112
  readSocketLines(socket, (line) => {
15099
15113
  const incoming = parsePreviewDecision(line, request.requestId);
@@ -17881,8 +17895,8 @@ function spawnInherit(command, args, options2 = {}) {
17881
17895
  env: { ...env, ...options2.env },
17882
17896
  cwd: options2.cwd
17883
17897
  });
17884
- const done2 = new Promise((resolve31, reject) => {
17885
- child.on("close", (code) => resolve31(code ?? 0));
17898
+ const done2 = new Promise((resolve32, reject) => {
17899
+ child.on("close", (code) => resolve32(code ?? 0));
17886
17900
  child.on("error", reject);
17887
17901
  });
17888
17902
  return { child, done: done2 };
@@ -18007,7 +18021,7 @@ import chalk77 from "chalk";
18007
18021
  // src/commands/sessions/daemon/sendToDaemonAwaitAck.ts
18008
18022
  var ACK_TIMEOUT_MS = 1e3;
18009
18023
  function sendToDaemonAwaitAck(message3) {
18010
- return new Promise((resolve31, reject) => {
18024
+ return new Promise((resolve32, reject) => {
18011
18025
  connectToDaemon().then((socket) => {
18012
18026
  let settled = false;
18013
18027
  const finish2 = (error) => {
@@ -18016,7 +18030,7 @@ function sendToDaemonAwaitAck(message3) {
18016
18030
  clearTimeout(timer);
18017
18031
  socket.destroy();
18018
18032
  if (error) reject(error);
18019
- else resolve31();
18033
+ else resolve32();
18020
18034
  };
18021
18035
  const timer = setTimeout(
18022
18036
  () => finish2(new Error("timed out awaiting daemon ack")),
@@ -18097,7 +18111,7 @@ async function deliver(sessionId, status2, payload, attempts) {
18097
18111
  }
18098
18112
  }
18099
18113
  function sleep(ms) {
18100
- return new Promise((resolve31) => setTimeout(resolve31, ms));
18114
+ return new Promise((resolve32) => setTimeout(resolve32, ms));
18101
18115
  }
18102
18116
  function describeError(error) {
18103
18117
  return error instanceof Error ? error.message : String(error);
@@ -20356,6 +20370,27 @@ function registerBranch(program) {
20356
20370
  // src/commands/cliHook.ts
20357
20371
  import { basename as basename15 } from "path";
20358
20372
 
20373
+ // src/commands/backlog/isDocsLocked.ts
20374
+ import { and as and20, eq as eq48 } from "drizzle-orm";
20375
+ async function isDocsRefreshItem(itemId2) {
20376
+ const orm = await getDb();
20377
+ const [row3] = await orm.select({ itemId: links.itemId }).from(links).where(and20(eq48(links.itemId, itemId2), eq48(links.type, "docs-refresh"))).limit(1);
20378
+ return row3 !== void 0;
20379
+ }
20380
+ async function isDocsLocked() {
20381
+ if (docsRefreshAfter() === void 0) return false;
20382
+ const itemId2 = resolveSessionItemId();
20383
+ if (itemId2 === null) return false;
20384
+ try {
20385
+ return !await isDocsRefreshItem(itemId2);
20386
+ } catch {
20387
+ return false;
20388
+ } finally {
20389
+ await closeDb().catch(() => {
20390
+ });
20391
+ }
20392
+ }
20393
+
20359
20394
  // src/shared/splitCompound.ts
20360
20395
  import { parse } from "shell-quote";
20361
20396
 
@@ -21231,6 +21266,37 @@ ${questionsJson}`
21231
21266
  };
21232
21267
  }
21233
21268
 
21269
+ // src/commands/backlog/isDocsPath.ts
21270
+ import { relative as relative6, resolve as resolve18 } from "path";
21271
+ var DOCS_LOCK_REASON = "Docs under 'docs/' are locked during development: they are updated by the Refresh docs backlog item after stories ship, not during development. Leave docs untouched and carry on with the phase.";
21272
+ var RELATIVE_DOCS = /(?:^|[\s'"=(<>|;&:])(?:\.[/\\])?docs[/\\]/;
21273
+ function escapeRegExp(value) {
21274
+ return value.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
21275
+ }
21276
+ function isDocsPath(filePath, root2 = getProjectRoot()) {
21277
+ const rel = relative6(root2, resolve18(root2, filePath)).replace(/\\/g, "/");
21278
+ return rel.startsWith("docs/");
21279
+ }
21280
+ function mentionsDocsPath(command, root2 = getProjectRoot()) {
21281
+ if (RELATIVE_DOCS.test(command)) return true;
21282
+ const absolute2 = `${root2.replace(/\\/g, "/")}/docs/`;
21283
+ return new RegExp(escapeRegExp(absolute2)).test(command.replace(/\\/g, "/"));
21284
+ }
21285
+
21286
+ // src/commands/cliHook/findDocsPathDeny.ts
21287
+ function findDocsPathDeny(toolName, rawCommand, root2) {
21288
+ const result = splitCompound(rawCommand);
21289
+ const parts = result.ok ? result.parts : [rawCommand];
21290
+ const writes = parts.some(
21291
+ (part) => mentionsDocsPath(part, root2) && !isApprovedRead(part, toolName)
21292
+ );
21293
+ if (!writes) return void 0;
21294
+ return {
21295
+ permissionDecision: "deny",
21296
+ permissionDecisionReason: DOCS_LOCK_REASON
21297
+ };
21298
+ }
21299
+
21234
21300
  // src/commands/cliHook/logDeniedToolCall.ts
21235
21301
  import { mkdirSync as mkdirSync14 } from "fs";
21236
21302
  import { homedir as homedir18 } from "os";
@@ -21321,10 +21387,17 @@ function tryParseInput(raw) {
21321
21387
  }
21322
21388
 
21323
21389
  // src/commands/cliHook.ts
21390
+ async function decideBash(toolName, command) {
21391
+ const decision = decideCommand(toolName, command);
21392
+ if (decision?.permissionDecision === "deny") return decision;
21393
+ const docsDeny = findDocsPathDeny(toolName, command);
21394
+ if (docsDeny && await isDocsLocked()) return docsDeny;
21395
+ return decision;
21396
+ }
21324
21397
  async function cliHook() {
21325
21398
  const input = tryParseInput(await readStdin());
21326
21399
  if (!input) return;
21327
- const decision = input.kind === "command" ? decideCommand(input.toolName, input.command) : input.kind === "question" ? findAskQuestionDeny(input.command) : findRestrictedPathDeny(input.paths);
21400
+ const decision = input.kind === "command" ? await decideBash(input.toolName, input.command) : input.kind === "question" ? findAskQuestionDeny(input.command) : findRestrictedPathDeny(input.paths);
21328
21401
  if (!decision) return;
21329
21402
  console.log(
21330
21403
  JSON.stringify({
@@ -21477,12 +21550,12 @@ function hasSubcommands(helpText) {
21477
21550
  // src/commands/permitCliReads/runHelp.ts
21478
21551
  import { exec as exec2 } from "child_process";
21479
21552
  function runHelp(args) {
21480
- return new Promise((resolve31) => {
21553
+ return new Promise((resolve32) => {
21481
21554
  exec2(
21482
21555
  `${args.join(" ")} --help`,
21483
21556
  { encoding: "utf8", timeout: 3e4 },
21484
21557
  (_err, stdout, stderr) => {
21485
- resolve31(stdout || stderr || "");
21558
+ resolve32(stdout || stderr || "");
21486
21559
  }
21487
21560
  );
21488
21561
  });
@@ -26295,6 +26368,15 @@ function decideCommentGuard(input, existingContent) {
26295
26368
  return introduced.length > 0 ? denyReason(gate.marker) : void 0;
26296
26369
  }
26297
26370
 
26371
+ // src/commands/editHook/decideDocsGuard.ts
26372
+ var WRITE_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit"]);
26373
+ async function decideDocsGuard(input) {
26374
+ const filePath = input.tool_input.file_path;
26375
+ if (!WRITE_TOOLS.has(input.tool_name) || !filePath) return void 0;
26376
+ if (!isDocsPath(filePath)) return void 0;
26377
+ return await isDocsLocked() ? DOCS_LOCK_REASON : void 0;
26378
+ }
26379
+
26298
26380
  // src/commands/dbMigration/consumeMigrationApproval.ts
26299
26381
  import { existsSync as existsSync58, unlinkSync as unlinkSync11 } from "fs";
26300
26382
  function consumeMigrationApproval(migrationId) {
@@ -26384,7 +26466,7 @@ async function editHook() {
26384
26466
  const input = tryParseInput2(await readStdin());
26385
26467
  if (!input) return;
26386
26468
  const existing = input.tool_name === "Write" ? readExisting(input.tool_input.file_path) : void 0;
26387
- const reason4 = decideOverrideGuard(input, existing) ?? decideCommentGuard(input, existing) ?? decideMigrationGuard(input, existing);
26469
+ const reason4 = decideOverrideGuard(input, existing) ?? decideCommentGuard(input, existing) ?? decideMigrationGuard(input, existing) ?? await decideDocsGuard(input);
26388
26470
  if (!reason4) return;
26389
26471
  console.log(
26390
26472
  JSON.stringify({
@@ -29142,7 +29224,7 @@ import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync20 } fr
29142
29224
  import { dirname as dirname33, join as join74 } from "path";
29143
29225
 
29144
29226
  // src/commands/sessions/daemon/worktree/runInstall.ts
29145
- import { resolve as resolve18 } from "path";
29227
+ import { resolve as resolve19 } from "path";
29146
29228
 
29147
29229
  // src/commands/sessions/daemon/worktree/detectInstallCommand.ts
29148
29230
  import { existsSync as existsSync61 } from "fs";
@@ -29283,7 +29365,7 @@ function installPaths(worktreePath, paths, onSeeded, onInstalling) {
29283
29365
  onSeeded();
29284
29366
  return;
29285
29367
  }
29286
- const dir = resolve18(worktreePath, rel);
29368
+ const dir = resolve19(worktreePath, rel);
29287
29369
  const command = detectInstallCommand(dir);
29288
29370
  if (!command) {
29289
29371
  daemonLog(
@@ -29342,7 +29424,7 @@ function placedByDaemon() {
29342
29424
  function seed(worktreePath, clone) {
29343
29425
  console.log(`Preparing ${worktreePath}\u2026`);
29344
29426
  return new Promise(
29345
- (resolve31) => seedWorktree(worktreePath, clone, resolve31)
29427
+ (resolve32) => seedWorktree(worktreePath, clone, resolve32)
29346
29428
  );
29347
29429
  }
29348
29430
  async function moveToPrCheckoutTree() {
@@ -29430,7 +29512,7 @@ function prHeadBranch({
29430
29512
  // src/commands/sessions/daemon/sendToDaemon.ts
29431
29513
  var WRITE_TIMEOUT_MS = 500;
29432
29514
  function sendToDaemon(message3) {
29433
- return new Promise((resolve31, reject) => {
29515
+ return new Promise((resolve32, reject) => {
29434
29516
  connectToDaemon().then((socket) => {
29435
29517
  const timer = setTimeout(() => {
29436
29518
  socket.destroy();
@@ -29444,7 +29526,7 @@ function sendToDaemon(message3) {
29444
29526
  `, () => {
29445
29527
  clearTimeout(timer);
29446
29528
  socket.end();
29447
- resolve31();
29529
+ resolve32();
29448
29530
  });
29449
29531
  }, reject);
29450
29532
  });
@@ -29800,12 +29882,12 @@ function registerLitellm(program) {
29800
29882
 
29801
29883
  // src/commands/mermaidExport.ts
29802
29884
  import { mkdirSync as mkdirSync21, readdirSync as readdirSync12 } from "fs";
29803
- import { resolve as resolve20 } from "path";
29885
+ import { resolve as resolve21 } from "path";
29804
29886
  import chalk185 from "chalk";
29805
29887
 
29806
29888
  // src/commands/mermaid/exportFile.ts
29807
29889
  import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "fs";
29808
- import { basename as basename22, extname as extname4, resolve as resolve19 } from "path";
29890
+ import { basename as basename22, extname as extname4, resolve as resolve20 } from "path";
29809
29891
  import chalk184 from "chalk";
29810
29892
 
29811
29893
  // src/commands/mermaid/renderBlock.ts
@@ -29853,7 +29935,7 @@ async function exportFile(file, outDir, krokiUrl, onlyIndex) {
29853
29935
  for (const [i, source] of blocks.entries()) {
29854
29936
  const idx = i + 1;
29855
29937
  if (onlyIndex !== void 0 && idx !== onlyIndex) continue;
29856
- const outPath = resolve19(outDir, `${stem}-${idx}.svg`);
29938
+ const outPath = resolve20(outDir, `${stem}-${idx}.svg`);
29857
29939
  const svg = await renderBlock(krokiUrl, source);
29858
29940
  writeFileSync34(outPath, svg, "utf8");
29859
29941
  console.log(chalk184.green(` \u2192 ${outPath}`));
@@ -29867,7 +29949,7 @@ function extractMermaidBlocks(markdown) {
29867
29949
  // src/commands/mermaidExport.ts
29868
29950
  async function mermaidExport(file, options2 = {}) {
29869
29951
  const { mermaid } = loadConfig();
29870
- const outDir = resolve20(process.cwd(), options2.out ?? ".");
29952
+ const outDir = resolve21(process.cwd(), options2.out ?? ".");
29871
29953
  mkdirSync21(outDir, { recursive: true });
29872
29954
  if (options2.index !== void 0) {
29873
29955
  if (!Number.isInteger(options2.index) || options2.index < 1) {
@@ -29995,18 +30077,18 @@ function emitExtract(out, header, texts) {
29995
30077
  }
29996
30078
 
29997
30079
  // src/commands/miro/resolveExtractPath.ts
29998
- import { isAbsolute as isAbsolute4, relative as relative6, resolve as resolve21 } from "path";
30080
+ import { isAbsolute as isAbsolute4, relative as relative7, resolve as resolve22 } from "path";
29999
30081
  function extractRoot(cwd) {
30000
30082
  return findConfigUp(cwd)?.rootDir ?? cwd;
30001
30083
  }
30002
30084
  function resolveExtractPath(value, cwd) {
30003
30085
  if (value === void 0) return void 0;
30004
- return isAbsolute4(value) ? value : resolve21(extractRoot(cwd), value);
30086
+ return isAbsolute4(value) ? value : resolve22(extractRoot(cwd), value);
30005
30087
  }
30006
30088
  function storedExtractPath(value, cwd) {
30007
30089
  if (value === void 0) return void 0;
30008
- const absolute2 = resolve21(cwd, value);
30009
- const within = relative6(extractRoot(cwd), absolute2);
30090
+ const absolute2 = resolve22(cwd, value);
30091
+ const within = relative7(extractRoot(cwd), absolute2);
30010
30092
  return within.startsWith("..") ? absolute2 : within;
30011
30093
  }
30012
30094
 
@@ -30593,7 +30675,7 @@ async function prepareExtensionForLoad(port, filter = "") {
30593
30675
  }
30594
30676
 
30595
30677
  // src/commands/netcap/resolveNetcapOutPath.ts
30596
- import { isAbsolute as isAbsolute5, join as join78, resolve as resolve22 } from "path";
30678
+ import { isAbsolute as isAbsolute5, join as join78, resolve as resolve23 } from "path";
30597
30679
 
30598
30680
  // src/commands/netcap/defaultCapturePath.ts
30599
30681
  import { homedir as homedir24 } from "os";
@@ -30605,7 +30687,7 @@ function defaultCapturePath() {
30605
30687
  // src/commands/netcap/resolveNetcapOutPath.ts
30606
30688
  function resolveNetcapOutPath(out) {
30607
30689
  if (!out) return defaultCapturePath();
30608
- const dir = isAbsolute5(out) ? out : resolve22(process.cwd(), out);
30690
+ const dir = isAbsolute5(out) ? out : resolve23(process.cwd(), out);
30609
30691
  return join78(dir, "capture.jsonl");
30610
30692
  }
30611
30693
 
@@ -30696,25 +30778,25 @@ function isVisibleText(t) {
30696
30778
  return /[a-zA-Z]{3,}/.test(t);
30697
30779
  }
30698
30780
  var isHashtag = (t) => /^#[A-Za-z0-9_]+$/.test(t);
30699
- function collectRscText(v, resolve31, sink3, seen) {
30781
+ function collectRscText(v, resolve32, sink3, seen) {
30700
30782
  if (v == null) return;
30701
30783
  if (typeof v === "string") {
30702
30784
  if (isRscRef(v)) {
30703
30785
  if (!seen.has(v)) {
30704
30786
  seen.add(v);
30705
- collectRscText(resolve31(v), resolve31, sink3, seen);
30787
+ collectRscText(resolve32(v), resolve32, sink3, seen);
30706
30788
  }
30707
30789
  } else if (isHashtag(v)) sink3.hashtags.push(v);
30708
30790
  else if (isVisibleText(v)) sink3.text.push(v);
30709
30791
  return;
30710
30792
  }
30711
30793
  if (Array.isArray(v)) {
30712
- for (const x of v) collectRscText(x, resolve31, sink3, seen);
30794
+ for (const x of v) collectRscText(x, resolve32, sink3, seen);
30713
30795
  return;
30714
30796
  }
30715
30797
  if (typeof v === "object") {
30716
30798
  for (const val of Object.values(v)) {
30717
- collectRscText(val, resolve31, sink3, seen);
30799
+ collectRscText(val, resolve32, sink3, seen);
30718
30800
  }
30719
30801
  }
30720
30802
  }
@@ -30746,7 +30828,7 @@ function visitObjects(root2, fn) {
30746
30828
  }
30747
30829
  }
30748
30830
  }
30749
- function buildMentionMap(rows, resolve31) {
30831
+ function buildMentionMap(rows, resolve32) {
30750
30832
  const map = /* @__PURE__ */ new Map();
30751
30833
  visitObjects(rows, (o) => {
30752
30834
  const url = profileActionUrl(o);
@@ -30754,7 +30836,7 @@ function buildMentionMap(rows, resolve31) {
30754
30836
  const slug2 = slugFromProfileUrl(url);
30755
30837
  if (!slug2 || map.has(slug2)) return;
30756
30838
  const sink3 = { text: [], hashtags: [] };
30757
- collectRscText(o.children, resolve31, sink3, /* @__PURE__ */ new Set());
30839
+ collectRscText(o.children, resolve32, sink3, /* @__PURE__ */ new Set());
30758
30840
  const name = sink3.text.join(" ").replace(/\s+/g, " ").trim();
30759
30841
  map.set(slug2, name ? { slug: slug2, name, url } : { slug: slug2, url });
30760
30842
  });
@@ -30840,10 +30922,10 @@ function buildPost(raw, mentionMap, author) {
30840
30922
 
30841
30923
  // src/commands/netcap/walkPostRow.ts
30842
30924
  var isCommentary = (o) => asObject(o.viewTrackingSpecs)?.viewName === "feed-commentary";
30843
- function walkPostRow(v, resolve31, raw) {
30925
+ function walkPostRow(v, resolve32, raw) {
30844
30926
  if (v == null || typeof v !== "object") return;
30845
30927
  if (Array.isArray(v)) {
30846
- for (const x of v) walkPostRow(x, resolve31, raw);
30928
+ for (const x of v) walkPostRow(x, resolve32, raw);
30847
30929
  return;
30848
30930
  }
30849
30931
  const o = v;
@@ -30857,9 +30939,9 @@ function walkPostRow(v, resolve31, raw) {
30857
30939
  }
30858
30940
  if (isCommentary(o)) {
30859
30941
  const sink3 = { text: raw.text, hashtags: raw.hashtags };
30860
- collectRscText(o.children, resolve31, sink3, /* @__PURE__ */ new Set());
30942
+ collectRscText(o.children, resolve32, sink3, /* @__PURE__ */ new Set());
30861
30943
  }
30862
- for (const val of Object.values(o)) walkPostRow(val, resolve31, raw);
30944
+ for (const val of Object.values(o)) walkPostRow(val, resolve32, raw);
30863
30945
  }
30864
30946
 
30865
30947
  // src/commands/netcap/extractLinkedInPosts.ts
@@ -30873,8 +30955,8 @@ function findCommentaryRows(rows) {
30873
30955
  }
30874
30956
  function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
30875
30957
  const rows = parseRscRows(flight);
30876
- const resolve31 = makeRscResolver(rows);
30877
- const mentionMap = buildMentionMap(rows, resolve31);
30958
+ const resolve32 = makeRscResolver(rows);
30959
+ const mentionMap = buildMentionMap(rows, resolve32);
30878
30960
  const posts = [];
30879
30961
  for (const id of findCommentaryRows(rows)) {
30880
30962
  const raw = {
@@ -30884,7 +30966,7 @@ function extractLinkedInPosts(flight, author = findAuthorSlug(flight)) {
30884
30966
  links: [],
30885
30967
  related: []
30886
30968
  };
30887
- walkPostRow(rows[id], resolve31, raw);
30969
+ walkPostRow(rows[id], resolve32, raw);
30888
30970
  const post2 = buildPost(raw, mentionMap, author);
30889
30971
  if (post2) posts.push(post2);
30890
30972
  }
@@ -31166,9 +31248,9 @@ async function list4() {
31166
31248
  import chalk193 from "chalk";
31167
31249
 
31168
31250
  // src/commands/backlog/removeFeed.ts
31169
- import { eq as eq48 } from "drizzle-orm";
31251
+ import { eq as eq49 } from "drizzle-orm";
31170
31252
  async function removeFeed(db, url) {
31171
- const deleted = await db.delete(feeds).where(eq48(feeds.url, url)).returning({ id: feeds.id });
31253
+ const deleted = await db.delete(feeds).where(eq49(feeds.url, url)).returning({ id: feeds.id });
31172
31254
  return deleted.length > 0;
31173
31255
  }
31174
31256
 
@@ -32444,7 +32526,7 @@ ${resolves}` : baseWhy);
32444
32526
 
32445
32527
  // src/commands/prs/parseScreenshotSpec.ts
32446
32528
  import { statSync as statSync9 } from "fs";
32447
- import { basename as basename23, extname as extname5, resolve as resolve23 } from "path";
32529
+ import { basename as basename23, extname as extname5, resolve as resolve24 } from "path";
32448
32530
  function splitOnce(value, separator) {
32449
32531
  const index2 = value.indexOf(separator);
32450
32532
  if (index2 === -1) return null;
@@ -32460,7 +32542,7 @@ function isFile2(path108) {
32460
32542
  function parseScreenshotSpec(spec) {
32461
32543
  const [label, rawPath] = splitOnce(spec, "=") ?? ["", spec];
32462
32544
  const [group, caption] = splitOnce(label, "/") ?? ["", label];
32463
- const path108 = resolve23(rawPath.trim());
32545
+ const path108 = resolve24(rawPath.trim());
32464
32546
  const ext = extname5(path108).replace(/^\./, "").toLowerCase();
32465
32547
  if (!isFile2(path108))
32466
32548
  throw new Error(`--screenshot '${spec}': file not found: ${path108}`);
@@ -34733,7 +34815,7 @@ async function notify() {
34733
34815
  import { execSync as execSync49 } from "child_process";
34734
34816
  import { existsSync as existsSync65, mkdirSync as mkdirSync24, unlinkSync as unlinkSync15, writeFileSync as writeFileSync39 } from "fs";
34735
34817
  import { tmpdir as tmpdir7 } from "os";
34736
- import { join as join83, resolve as resolve24 } from "path";
34818
+ import { join as join83, resolve as resolve25 } from "path";
34737
34819
  import chalk217 from "chalk";
34738
34820
 
34739
34821
  // src/commands/screenshot/captureWindowPs1.ts
@@ -34867,7 +34949,7 @@ function buildOutputPath(outputDir, processName) {
34867
34949
  mkdirSync24(outputDir, { recursive: true });
34868
34950
  }
34869
34951
  const timestamp8 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
34870
- return resolve24(outputDir, `${processName}-${timestamp8}.png`);
34952
+ return resolve25(outputDir, `${processName}-${timestamp8}.png`);
34871
34953
  }
34872
34954
  function runPowerShellScript(processName, outputPath) {
34873
34955
  const scriptPath = join83(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
@@ -34883,7 +34965,7 @@ function runPowerShellScript(processName, outputPath) {
34883
34965
  }
34884
34966
  function screenshot(processName) {
34885
34967
  const config = loadConfig();
34886
- const outputDir = resolve24(config.screenshot.outputDir);
34968
+ const outputDir = resolve25(config.screenshot.outputDir);
34887
34969
  const outputPath = buildOutputPath(outputDir, processName);
34888
34970
  console.log(chalk217.gray(`Capturing window for process "${processName}" ...`));
34889
34971
  try {
@@ -34985,7 +35067,7 @@ function buildLimitsSegment(rateLimits) {
34985
35067
 
34986
35068
  // src/commands/readGitBranch.ts
34987
35069
  import { readFileSync as readFileSync48, statSync as statSync10 } from "fs";
34988
- import { isAbsolute as isAbsolute6, join as join84, resolve as resolve25 } from "path";
35070
+ import { isAbsolute as isAbsolute6, join as join84, resolve as resolve26 } from "path";
34989
35071
  function resolveGitDir(cwd) {
34990
35072
  const dotGit = join84(cwd, ".git");
34991
35073
  let stat5;
@@ -35008,7 +35090,7 @@ function resolveGitDir(cwd) {
35008
35090
  return null;
35009
35091
  }
35010
35092
  const gitDir = match[1].trim();
35011
- return isAbsolute6(gitDir) ? gitDir : resolve25(cwd, gitDir);
35093
+ return isAbsolute6(gitDir) ? gitDir : resolve26(cwd, gitDir);
35012
35094
  }
35013
35095
  function readGitBranch(cwd) {
35014
35096
  const gitDir = resolveGitDir(cwd);
@@ -35322,7 +35404,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
35322
35404
 
35323
35405
  // src/commands/refactor/check.ts
35324
35406
  function runScript(script, cwd) {
35325
- return new Promise((resolve31) => {
35407
+ return new Promise((resolve32) => {
35326
35408
  const child = spawn7("npm", ["run", script], {
35327
35409
  stdio: "pipe",
35328
35410
  shell: true,
@@ -35336,7 +35418,7 @@ function runScript(script, cwd) {
35336
35418
  output += data.toString();
35337
35419
  });
35338
35420
  child.on("close", (code) => {
35339
- resolve31({ script, code: code ?? 1, output });
35421
+ resolve32({ script, code: code ?? 1, output });
35340
35422
  });
35341
35423
  });
35342
35424
  }
@@ -40141,12 +40223,12 @@ function onCloseResult(ctx, code) {
40141
40223
  return { ...closed, stderr: ctx.stderr.value, stdout: ctx.stdout.value };
40142
40224
  }
40143
40225
  function waitForChildExit(ctx) {
40144
- return new Promise((resolve31) => {
40226
+ return new Promise((resolve32) => {
40145
40227
  let settled = false;
40146
40228
  const settle = (result) => {
40147
40229
  if (settled) return;
40148
40230
  settled = true;
40149
- resolve31(result);
40231
+ resolve32(result);
40150
40232
  };
40151
40233
  ctx.child.on("error", (err) => settle(onErrorResult(ctx, err)));
40152
40234
  ctx.child.on("close", (code) => settle(onCloseResult(ctx, code)));
@@ -42089,11 +42171,11 @@ import { randomUUID as randomUUID22 } from "crypto";
42089
42171
  // src/commands/sessions/shared/sendShowPreview.ts
42090
42172
  async function sendShowPreview(request) {
42091
42173
  const socket = await connectToDaemon();
42092
- await new Promise((resolve31, reject) => {
42174
+ await new Promise((resolve32, reject) => {
42093
42175
  const finish2 = (error) => {
42094
42176
  socket.destroy();
42095
42177
  if (error) reject(error);
42096
- else resolve31();
42178
+ else resolve32();
42097
42179
  };
42098
42180
  readSocketLines(socket, (line) => {
42099
42181
  const reply2 = parseReply(line);
@@ -43368,9 +43450,9 @@ function createReadlineInterface() {
43368
43450
  });
43369
43451
  }
43370
43452
  function askQuestion2(rl, question) {
43371
- return new Promise((resolve31) => {
43453
+ return new Promise((resolve32) => {
43372
43454
  rl.question(question, (answer) => {
43373
- resolve31(answer.trim());
43455
+ resolve32(answer.trim());
43374
43456
  });
43375
43457
  });
43376
43458
  }
@@ -44831,7 +44913,7 @@ function resolveParams(params, cliArgs) {
44831
44913
 
44832
44914
  // src/commands/run/resolveRunCwd.ts
44833
44915
  import { existsSync as existsSync82 } from "fs";
44834
- import { resolve as resolve27 } from "path";
44916
+ import { resolve as resolve28 } from "path";
44835
44917
  var MissingRunCwdError = class extends Error {
44836
44918
  constructor(runName, cwd) {
44837
44919
  super(`run config "${runName}": cwd ${cwd} does not exist`);
@@ -44842,7 +44924,7 @@ var MissingRunCwdError = class extends Error {
44842
44924
  };
44843
44925
  function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
44844
44926
  if (!config.cwd) return void 0;
44845
- const cwd = resolve27(baseDir, config.cwd);
44927
+ const cwd = resolve28(baseDir, config.cwd);
44846
44928
  if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
44847
44929
  return cwd;
44848
44930
  }
@@ -44975,9 +45057,9 @@ function consumeMarker(path108) {
44975
45057
  }
44976
45058
 
44977
45059
  // src/commands/watch/gitMarkerPath.ts
44978
- import { resolve as resolve28 } from "path";
45060
+ import { resolve as resolve29 } from "path";
44979
45061
  function gitMarkerPath(name, cwd) {
44980
- return resolve28(
45062
+ return resolve29(
44981
45063
  cwd ?? process.cwd(),
44982
45064
  runGit3(["rev-parse", "--git-path", name], cwd)
44983
45065
  );
@@ -45036,7 +45118,7 @@ function readMovement(cwd) {
45036
45118
  var CONTROL_POLL_MS = 1e3;
45037
45119
  function pollForMovement(options2) {
45038
45120
  const { upstream, intervalMs, timeoutMs, timeout, cwd, control } = options2;
45039
- return new Promise((resolve31) => {
45121
+ return new Promise((resolve32) => {
45040
45122
  let settled = false;
45041
45123
  const finish2 = (outcome) => {
45042
45124
  if (settled) return;
@@ -45045,7 +45127,7 @@ function pollForMovement(options2) {
45045
45127
  clearInterval(controller);
45046
45128
  clearTimeout(deadline);
45047
45129
  process.off("SIGINT", onInterrupt);
45048
- resolve31(outcome);
45130
+ resolve32(outcome);
45049
45131
  };
45050
45132
  const onInterrupt = () => finish2({ kind: "interrupted" });
45051
45133
  const check2 = () => {
@@ -45186,12 +45268,12 @@ function decideLap(end, interrupted) {
45186
45268
  import { spawn as spawn9 } from "child_process";
45187
45269
  var WATCH_LAP_ARGS = ["watch", "wait", "--pull", "--build"];
45188
45270
  function runWatchLap() {
45189
- return new Promise((resolve31, reject) => {
45271
+ return new Promise((resolve32, reject) => {
45190
45272
  const assistFromPath = spawn9("assist", WATCH_LAP_ARGS, {
45191
45273
  stdio: "inherit",
45192
45274
  shell: process.platform === "win32"
45193
45275
  });
45194
- assistFromPath.on("close", (code, signal) => resolve31({ code, signal }));
45276
+ assistFromPath.on("close", (code, signal) => resolve32({ code, signal }));
45195
45277
  assistFromPath.on("error", reject);
45196
45278
  });
45197
45279
  }
@@ -45538,12 +45620,12 @@ function parseEnvPairs(pairs) {
45538
45620
  if (pairs.length === 0) return void 0;
45539
45621
  const env = {};
45540
45622
  for (const pair of pairs) {
45541
- const eq51 = pair.indexOf("=");
45542
- if (eq51 <= 0) {
45623
+ const eq52 = pair.indexOf("=");
45624
+ if (eq52 <= 0) {
45543
45625
  console.error(`--env must be KEY=VALUE, got "${pair}"`);
45544
45626
  process.exit(1);
45545
45627
  }
45546
- env[pair.slice(0, eq51)] = pair.slice(eq51 + 1);
45628
+ env[pair.slice(0, eq52)] = pair.slice(eq52 + 1);
45547
45629
  }
45548
45630
  return env;
45549
45631
  }
@@ -45556,11 +45638,11 @@ function fail9(spec) {
45556
45638
  process.exit(1);
45557
45639
  }
45558
45640
  function parseParamSpec(spec) {
45559
- const eq51 = spec.indexOf("=");
45560
- const name = eq51 === -1 ? spec : spec.slice(0, eq51);
45561
- if (eq51 !== -1) {
45562
- if (eq51 === 0 || name.endsWith("!")) fail9(spec);
45563
- return { name, default: spec.slice(eq51 + 1) };
45641
+ const eq52 = spec.indexOf("=");
45642
+ const name = eq52 === -1 ? spec : spec.slice(0, eq52);
45643
+ if (eq52 !== -1) {
45644
+ if (eq52 === 0 || name.endsWith("!")) fail9(spec);
45645
+ return { name, default: spec.slice(eq52 + 1) };
45564
45646
  }
45565
45647
  if (name.endsWith("!")) {
45566
45648
  if (name.length === 1) fail9(spec);
@@ -45878,10 +45960,10 @@ var STATUS_TIMEOUT_MS2 = 5e3;
45878
45960
  function queryDaemon(socket) {
45879
45961
  socket.write(`${JSON.stringify({ type: "ping" })}
45880
45962
  `);
45881
- return new Promise((resolve31) => {
45963
+ return new Promise((resolve32) => {
45882
45964
  const result = { sessions: [] };
45883
45965
  const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
45884
- const timer = setTimeout(() => resolve31(result), STATUS_TIMEOUT_MS2);
45966
+ const timer = setTimeout(() => resolve32(result), STATUS_TIMEOUT_MS2);
45885
45967
  const lines2 = createInterface8({ input: socket });
45886
45968
  lines2.on("error", () => {
45887
45969
  });
@@ -45889,7 +45971,7 @@ function queryDaemon(socket) {
45889
45971
  applyLine(result, pending, line);
45890
45972
  if (pending.size === 0) {
45891
45973
  clearTimeout(timer);
45892
- resolve31(result);
45974
+ resolve32(result);
45893
45975
  }
45894
45976
  });
45895
45977
  });
@@ -45989,11 +46071,11 @@ function clearPersistedSessionsOnDrain() {
45989
46071
 
45990
46072
  // src/commands/sessions/daemon/readDaemonMessage.ts
45991
46073
  function readDaemonMessage(lines2, timeoutMs, fallback, match) {
45992
- return new Promise((resolve31) => {
46074
+ return new Promise((resolve32) => {
45993
46075
  const finish2 = (value) => {
45994
46076
  clearTimeout(timer);
45995
46077
  lines2.off("line", onLine);
45996
- resolve31(value);
46078
+ resolve32(value);
45997
46079
  };
45998
46080
  const timer = setTimeout(() => finish2(fallback), timeoutMs);
45999
46081
  const onLine = (line) => {
@@ -46440,7 +46522,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
46440
46522
 
46441
46523
  // src/commands/sessions/daemon/findServerParents.ts
46442
46524
  import { existsSync as existsSync86 } from "fs";
46443
- import { join as join105, resolve as resolve29 } from "path";
46525
+ import { join as join105, resolve as resolve30 } from "path";
46444
46526
  function isLive(session) {
46445
46527
  return !!session.pty && session.status !== "done" && session.status !== "error";
46446
46528
  }
@@ -46449,13 +46531,13 @@ function isLiveAgent(session) {
46449
46531
  }
46450
46532
  function serverRunDirs(sessions, file) {
46451
46533
  return new Set(
46452
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(join105(dir, file)))
46534
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve30(s.cwd)).filter((dir) => existsSync86(join105(dir, file)))
46453
46535
  );
46454
46536
  }
46455
46537
  function findServerParents(sessions, file) {
46456
46538
  const all = [...sessions.values()];
46457
46539
  const dirs = serverRunDirs(all, file);
46458
- return all.filter((s) => isLiveAgent(s) && s.cwd && dirs.has(resolve29(s.cwd)));
46540
+ return all.filter((s) => isLiveAgent(s) && s.cwd && dirs.has(resolve30(s.cwd)));
46459
46541
  }
46460
46542
 
46461
46543
  // src/commands/sessions/daemon/lastWriteTimes.ts
@@ -46467,7 +46549,7 @@ function asRecord(value) {
46467
46549
  }
46468
46550
 
46469
46551
  // src/commands/sessions/shared/writtenFilePaths.ts
46470
- var WRITE_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
46552
+ var WRITE_TOOLS2 = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
46471
46553
  function writtenFilePaths(entry) {
46472
46554
  if (entry.type !== "assistant") return [];
46473
46555
  const content = asRecord(entry.message)?.content;
@@ -46475,7 +46557,7 @@ function writtenFilePaths(entry) {
46475
46557
  const paths = [];
46476
46558
  for (const block of content) {
46477
46559
  const b = asRecord(block);
46478
- if (b?.type !== "tool_use" || !WRITE_TOOLS.has(String(b.name))) continue;
46560
+ if (b?.type !== "tool_use" || !WRITE_TOOLS2.has(String(b.name))) continue;
46479
46561
  const input = asRecord(b.input);
46480
46562
  const path108 = input?.file_path ?? input?.notebook_path;
46481
46563
  if (typeof path108 === "string") paths.push(path108);
@@ -47334,11 +47416,11 @@ var autoUpdateControl = {
47334
47416
  persist2(value);
47335
47417
  wake?.();
47336
47418
  },
47337
- sleep: (ms) => new Promise((resolve31) => {
47419
+ sleep: (ms) => new Promise((resolve32) => {
47338
47420
  const done2 = () => {
47339
47421
  clearTimeout(timer);
47340
47422
  if (wake === done2) wake = void 0;
47341
- resolve31();
47423
+ resolve32();
47342
47424
  };
47343
47425
  const timer = setTimeout(done2, ms);
47344
47426
  wake = done2;
@@ -47751,7 +47833,7 @@ function clearLapSignals(cwd) {
47751
47833
  }
47752
47834
  function runUpdateLap(cwd, onOutput) {
47753
47835
  clearLapSignals(cwd);
47754
- return new Promise((resolve31, reject) => {
47836
+ return new Promise((resolve32, reject) => {
47755
47837
  const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
47756
47838
  const child = spawn11(
47757
47839
  process.execPath,
@@ -47771,7 +47853,7 @@ function runUpdateLap(cwd, onOutput) {
47771
47853
  child.stderr.on("data", (chunk) => onOutput(chunk.toString()));
47772
47854
  child.on("close", (code, signal) => {
47773
47855
  process.off("exit", killWithDaemon);
47774
- resolve31({ code, signal });
47856
+ resolve32({ code, signal });
47775
47857
  });
47776
47858
  child.on("error", (error) => {
47777
47859
  process.off("exit", killWithDaemon);
@@ -48182,12 +48264,12 @@ function processCwd(link3) {
48182
48264
  var POLL_MS2 = 500;
48183
48265
  var GRACE_MS = 5e3;
48184
48266
  function awaitTreeVacated(session, treePath) {
48185
- return new Promise((resolve31) => {
48267
+ return new Promise((resolve32) => {
48186
48268
  let ticks = GRACE_MS / POLL_MS2;
48187
48269
  const settle = (outcome) => {
48188
48270
  clearTimeout(timer);
48189
48271
  session.closeGrace = void 0;
48190
- resolve31(outcome);
48272
+ resolve32(outcome);
48191
48273
  };
48192
48274
  const tick = () => {
48193
48275
  if (liveProcessesInTree(treePath).length === 0) settle("vacated");
@@ -48894,7 +48976,7 @@ function emitSessionOutput(session, clients, data) {
48894
48976
 
48895
48977
  // src/commands/sessions/daemon/exitReason.ts
48896
48978
  import { existsSync as existsSync95 } from "fs";
48897
- import { resolve as resolve30 } from "path";
48979
+ import { resolve as resolve31 } from "path";
48898
48980
  function exitDetail(session) {
48899
48981
  if (session.cwd && !existsSync95(session.cwd))
48900
48982
  return `working directory ${session.cwd} no longer exists`;
@@ -48909,7 +48991,7 @@ function missingRunConfigCwd(session) {
48909
48991
  const dir = session.cwd ?? process.cwd();
48910
48992
  const config = resolveRunConfig(session.runName, dir);
48911
48993
  if (!config?.cwd) return void 0;
48912
- const configured = resolve30(runConfigBaseDirFrom(dir), config.cwd);
48994
+ const configured = resolve31(runConfigBaseDirFrom(dir), config.cwd);
48913
48995
  if (existsSync95(configured)) return void 0;
48914
48996
  return `run config "${config.name}": cwd ${configured} does not exist`;
48915
48997
  }
@@ -48981,10 +49063,10 @@ function applyReviewPause(session, activity2) {
48981
49063
  }
48982
49064
 
48983
49065
  // src/shared/db/getPhaseActiveMs.ts
48984
- import { and as and20, eq as eq49 } from "drizzle-orm";
49066
+ import { and as and21, eq as eq50 } from "drizzle-orm";
48985
49067
  async function getPhaseActiveMs(db, itemId2, phaseIdx) {
48986
49068
  const [row3] = await db.select({ activeMs: phaseUsage.activeMs }).from(phaseUsage).where(
48987
- and20(eq49(phaseUsage.itemId, itemId2), eq49(phaseUsage.phaseIdx, phaseIdx))
49069
+ and21(eq50(phaseUsage.itemId, itemId2), eq50(phaseUsage.phaseIdx, phaseIdx))
48988
49070
  );
48989
49071
  return row3?.activeMs ?? 0;
48990
49072
  }
@@ -49871,17 +49953,17 @@ async function recordPhaseTranscriptUsage(db, itemId2, phaseIdx, responses) {
49871
49953
  }
49872
49954
 
49873
49955
  // src/shared/db/recordWindowTokens.ts
49874
- import { and as and21, eq as eq50, sql as sql29 } from "drizzle-orm";
49956
+ import { and as and22, eq as eq51, sql as sql29 } from "drizzle-orm";
49875
49957
  async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
49876
49958
  if (tokensUp <= 0 && tokensDown <= 0) return;
49877
49959
  await db.update(usagePeaks).set({
49878
49960
  tokensUp: sql29`${usagePeaks.tokensUp} + ${tokensUp}`,
49879
49961
  tokensDown: sql29`${usagePeaks.tokensDown} + ${tokensDown}`
49880
49962
  }).where(
49881
- and21(
49882
- eq50(usagePeaks.window, window),
49883
- eq50(usagePeaks.resetsAt, resetsAt),
49884
- eq50(usagePeaks.segment, 0)
49963
+ and22(
49964
+ eq51(usagePeaks.window, window),
49965
+ eq51(usagePeaks.resetsAt, resetsAt),
49966
+ eq51(usagePeaks.segment, 0)
49885
49967
  )
49886
49968
  );
49887
49969
  }
@@ -51740,7 +51822,7 @@ function failPendingCreators(state, message3) {
51740
51822
  }
51741
51823
  function resetRelayState(state, reason4) {
51742
51824
  failPendingCreators(state, reason4);
51743
- for (const resolve31 of state.historyWaiters) resolve31([]);
51825
+ for (const resolve32 of state.historyWaiters) resolve32([]);
51744
51826
  state.historyWaiters = [];
51745
51827
  state.sessions = [];
51746
51828
  state.lastSnapshot = void 0;
@@ -52133,16 +52215,16 @@ var HISTORY_TIMEOUT_MS = 5e3;
52133
52215
  function requestLinkHistory(ctx) {
52134
52216
  if (!ctx.greeted) return Promise.resolve([]);
52135
52217
  const waiters = ctx.relay.historyWaiters;
52136
- return new Promise((resolve31) => {
52218
+ return new Promise((resolve32) => {
52137
52219
  const settle = (sessions) => {
52138
52220
  clearTimeout(timer);
52139
- resolve31(sessions);
52221
+ resolve32(sessions);
52140
52222
  };
52141
52223
  const timer = setTimeout(() => {
52142
52224
  const index2 = waiters.indexOf(settle);
52143
52225
  if (index2 !== -1) waiters.splice(index2, 1);
52144
52226
  daemonLog(`link ${ctx.spec.name} ws: history timed out`);
52145
- resolve31(ctx.relay.lastHistory ?? []);
52227
+ resolve32(ctx.relay.lastHistory ?? []);
52146
52228
  }, HISTORY_TIMEOUT_MS);
52147
52229
  timer.unref?.();
52148
52230
  waiters.push(settle);
@@ -52894,7 +52976,7 @@ function claudeMessages(line) {
52894
52976
  }
52895
52977
 
52896
52978
  // src/commands/sessions/daemon/historySearch/findTranscriptMatch.ts
52897
- function escapeRegExp(text18) {
52979
+ function escapeRegExp2(text18) {
52898
52980
  return text18.replace(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
52899
52981
  }
52900
52982
  function encodesVerbatimInJson(query) {
@@ -52913,7 +52995,7 @@ function matchTexts(texts, pattern2) {
52913
52995
  return null;
52914
52996
  }
52915
52997
  function queryPattern(query) {
52916
- return new RegExp(escapeRegExp(query), "i");
52998
+ return new RegExp(escapeRegExp2(query), "i");
52917
52999
  }
52918
53000
  async function findTranscriptMatch(filePath, harness, query) {
52919
53001
  const pattern2 = queryPattern(query);
@@ -53493,12 +53575,12 @@ import { execFile as execFile15 } from "child_process";
53493
53575
  import { existsSync as existsSync102 } from "fs";
53494
53576
  function prHeadBranch2(number, cwd) {
53495
53577
  const { headBranch } = prCliCommands(number, cwd);
53496
- return new Promise((resolve31) => {
53578
+ return new Promise((resolve32) => {
53497
53579
  execFile15(
53498
53580
  headBranch.file,
53499
53581
  headBranch.args,
53500
53582
  { cwd, encoding: "utf8", windowsHide: true },
53501
- (error, stdout) => resolve31(error ? null : headBranch.parse(stdout))
53583
+ (error, stdout) => resolve32(error ? null : headBranch.parse(stdout))
53502
53584
  );
53503
53585
  });
53504
53586
  }