chompyy 0.4.5 → 0.4.7

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/macapp.js CHANGED
@@ -7,6 +7,7 @@ import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, w
7
7
  import { homedir, tmpdir } from 'node:os';
8
8
  import { dirname, join } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
+ import { exe } from './exe.js';
10
11
  export const REPO = 'BranchWork-HQ/Chompyy';
11
12
  /** The CLI's own version, from its package.json. */
12
13
  export function cliVersion() {
@@ -26,7 +27,7 @@ export function parseChecksum(text) {
26
27
  const defaultDeps = () => ({
27
28
  fetch: (url) => fetch(url),
28
29
  exec: (cmd, args) => {
29
- execFileSync(cmd, args, { stdio: 'ignore' });
30
+ execFileSync(exe(cmd), args, { stdio: 'ignore' });
30
31
  },
31
32
  platform: process.platform,
32
33
  appsDir: join(homedir(), 'Applications'),
package/dist/nudge.js CHANGED
@@ -85,6 +85,20 @@ function replyOf(line) {
85
85
  return null;
86
86
  }
87
87
  }
88
+ function compactionOf(line) {
89
+ if (!line.includes('"compact_boundary"'))
90
+ return null;
91
+ try {
92
+ const e = JSON.parse(line);
93
+ if (e.type !== 'system' || e.subtype !== 'compact_boundary')
94
+ return null;
95
+ const at = Date.parse(String(e.timestamp ?? ''));
96
+ return at ? { at, by: e.compactMetadata?.trigger === 'manual' ? 'you' : 'claude' } : null;
97
+ }
98
+ catch {
99
+ return null;
100
+ }
101
+ }
88
102
  /** Bytes from the start or the end of a file, without reading all of a long transcript. */
89
103
  function slice(file, bytes, fromEnd) {
90
104
  const size = statSync(file).size;
@@ -99,17 +113,24 @@ function slice(file, bytes, fromEnd) {
99
113
  }
100
114
  return buf.toString('utf8');
101
115
  }
102
- /** The conversation's last reply, and its first (about what a fresh conversation costs: tools, CLAUDE.md, memory). */
116
+ /**
117
+ * The conversation's last reply, its first (about what a fresh conversation costs: tools, CLAUDE.md, memory), and
118
+ * a compaction after the last reply, if there was one.
119
+ */
103
120
  export function replies(transcript) {
104
121
  const tail = slice(transcript, 4 << 20, true).split('\n');
105
122
  let last = null;
106
- for (let i = tail.length - 1; i >= 0 && !last; i--)
123
+ let compacted = null;
124
+ for (let i = tail.length - 1; i >= 0 && !last; i--) {
107
125
  last = replyOf(tail[i]);
126
+ if (!last)
127
+ compacted ??= compactionOf(tail[i]);
128
+ }
108
129
  let first = null;
109
130
  for (const line of slice(transcript, 2 << 20, false).split('\n'))
110
131
  if ((first = replyOf(line)))
111
132
  break;
112
- return { last, first };
133
+ return { last, first, compacted };
113
134
  }
114
135
  export function loadNudges() {
115
136
  const path = homePath('nudges.jsonl');
@@ -138,15 +159,17 @@ export function decide(input, now, events = loadNudges(), prefs = loadPrefs()) {
138
159
  return { block: false };
139
160
  let last;
140
161
  let first;
162
+ let compacted;
141
163
  try {
142
164
  if (!existsSync(transcript))
143
165
  return { block: false };
144
- ({ last, first } = replies(transcript));
166
+ ({ last, first, compacted } = replies(transcript));
145
167
  }
146
168
  catch {
147
169
  return { block: false };
148
170
  }
149
- if (!last)
171
+ // Compacted since its last reply (by you, or by Claude Code while you were away): this message sends a summary.
172
+ if (!last || compacted)
150
173
  return { block: false };
151
174
  const idleMs = now - last.at;
152
175
  if (idleMs <= COLD_AFTER_MS || last.context < MIN_CONTEXT)
@@ -226,8 +249,8 @@ export function goingCold(now = Date.now(), dir = projectsDir(), events = loadNu
226
249
  const mtime = statSync(transcript).mtimeMs;
227
250
  if (now - mtime > COLD_AFTER_MS || now - mtime < WARN_AFTER_MS - 60_000)
228
251
  continue;
229
- const { last, first } = replies(transcript);
230
- if (!last || last.context < MIN_CONTEXT)
252
+ const { last, first, compacted } = replies(transcript);
253
+ if (!last || compacted || last.context < MIN_CONTEXT)
231
254
  continue;
232
255
  const idleMs = now - last.at;
233
256
  if (idleMs < WARN_AFTER_MS || idleMs >= COLD_AFTER_MS)
@@ -272,20 +295,25 @@ export function coldWarningText(d) {
272
295
  body: `After ${at} its cache expires and coming back rewrites all ${k(d.context)}. Done with it? Do nothing.`,
273
296
  };
274
297
  }
275
- /** Read each stopped conversation after the stop: sent anyway, carried on small (compacted), or left. */
298
+ /**
299
+ * Read each stopped conversation after the stop: sent anyway, carried on small (compacted), or left. A stop that
300
+ * came after a compaction (Claude Code's own, while you were away) had nothing at stake: it isn't counted.
301
+ */
276
302
  export function outcomes(events = loadNudges()) {
277
303
  const stops = events.filter((e) => e.kind === 'stopped');
278
- return stops.map((event, i) => {
304
+ return stops.flatMap((event, i) => {
305
+ const at = Date.parse(event.at);
279
306
  const next = stops.slice(i + 1).find((s) => s.session === event.session);
280
307
  const until = next ? Date.parse(next.at) : Infinity;
281
- const wasSent = events.some((e) => e.kind === 'sent' && e.session === event.session && Date.parse(e.at) > Date.parse(event.at) && Date.parse(e.at) < until);
282
- if (wasSent)
283
- return { event, did: 'sent', saved: 0 };
284
308
  let after = null;
309
+ let compacted = null;
285
310
  try {
286
311
  for (const line of readFileSync(event.transcript, 'utf8').split('\n')) {
312
+ const c = compactionOf(line);
313
+ if (c && !compacted && c.at > at - event.idleMs && c.at < until)
314
+ compacted = c;
287
315
  const r = replyOf(line);
288
- if (r && r.at > Date.parse(event.at) && r.at < until) {
316
+ if (r && r.at > at && r.at < until) {
289
317
  after = r;
290
318
  break;
291
319
  }
@@ -294,19 +322,30 @@ export function outcomes(events = loadNudges()) {
294
322
  catch {
295
323
  /* transcript gone: count it as left */
296
324
  }
325
+ if (compacted && compacted.at < at)
326
+ return [];
327
+ // After your /compact the hook still sees the old last reply, so the next message is logged as "sent": the reply says what it cost.
328
+ const wasSent = !compacted && events.some((e) => e.kind === 'sent' && e.session === event.session && Date.parse(e.at) > at && Date.parse(e.at) < until);
329
+ if (wasSent)
330
+ return [{ event, did: 'sent', saved: 0 }];
297
331
  if (after)
298
- return { event, did: after.cacheWrite < event.context / 2 ? 'compacted' : 'sent', saved: Math.max(0, event.context - after.cacheWrite) };
299
- return { event, did: 'left', saved: Math.max(0, event.context - (event.fresh ?? 0)) };
332
+ return [{ event, did: after.cacheWrite < event.context / 2 ? 'compacted' : 'sent', saved: Math.max(0, event.context - after.cacheWrite) }];
333
+ return [{ event, did: 'left', saved: Math.max(0, event.context - (event.fresh ?? 0)) }];
300
334
  });
301
335
  }
302
336
  export function warnOutcomes(events = loadNudges()) {
303
337
  return events.filter((e) => e.kind === 'warned').map((event) => {
304
- const coldAt = Date.parse(event.coldAt ?? '') || Date.parse(event.at) + 15 * 60_000;
338
+ const at = Date.parse(event.at);
339
+ const coldAt = Date.parse(event.coldAt ?? '') || at + 15 * 60_000;
305
340
  let next = null;
341
+ let compacted = null;
306
342
  try {
307
343
  for (const line of readFileSync(event.transcript, 'utf8').split('\n')) {
344
+ const c = compactionOf(line);
345
+ if (c && !compacted && c.at > at && c.at < coldAt)
346
+ compacted = c;
308
347
  const r = replyOf(line);
309
- if (r && r.at > Date.parse(event.at)) {
348
+ if (r && r.at > at) {
310
349
  next = r;
311
350
  break;
312
351
  }
@@ -315,8 +354,13 @@ export function warnOutcomes(events = loadNudges()) {
315
354
  catch {
316
355
  /* transcript gone */
317
356
  }
357
+ if (compacted?.by === 'claude')
358
+ return { event, did: 'claude', saved: 0 };
318
359
  if (!next)
319
360
  return { event, did: 'left', saved: 0 };
361
+ // Compacted while warm: coming back later, even cold, rewrote the summary, not the whole conversation.
362
+ if (compacted)
363
+ return { event, did: 'compacted', saved: Math.max(0, event.context - next.context) };
320
364
  if (next.at >= coldAt)
321
365
  return { event, did: 'cold', saved: 0 };
322
366
  if (next.context < event.context / 2)
@@ -365,7 +409,7 @@ export function nudgeText(on, list = outcomes(), now = Date.now()) {
365
409
  // ---------- installing the hook in Claude Code's settings ----------
366
410
  export const claudeSettingsPath = () => process.env.CHOMPYY_CLAUDE_SETTINGS || join(homedir(), '.claude', 'settings.json');
367
411
  const settingsPath = claudeSettingsPath;
368
- function readSettings(path) {
412
+ export function readSettings(path) {
369
413
  if (!existsSync(path))
370
414
  return { settings: {}, raw: null };
371
415
  const raw = readFileSync(path, 'utf8');
@@ -382,16 +426,33 @@ const groups = (s) => {
382
426
  };
383
427
  const ours = (g) => (g.hooks ?? []).some((h) => h.command?.includes(MARK));
384
428
  const nudgeInstalledBefore = (raw) => Boolean(raw?.includes(MARK));
385
- /** When live suggestions were turned on: recorded since this version; before that, the settings backup `nudge on` made, else the first event. */
429
+ /**
430
+ * When live suggestions were turned on: the "before" for did-it-work, so it must never move.
431
+ *
432
+ * Recorded at `nudge on` since 0.4.2. Older installs have only clues: the settings backup (but every later settings
433
+ * change rewrites it, so its date only moves later) and the first event. Take the earliest, and while the hook is on,
434
+ * write it down so a later change can't move it.
435
+ */
386
436
  export function nudgeOnSince(events = loadNudges(), path = settingsPath()) {
387
- const at = Date.parse(loadPrefs().onAt ?? '');
437
+ const prefs = loadPrefs();
438
+ const at = Date.parse(prefs.onAt ?? '');
388
439
  if (at)
389
440
  return at;
441
+ const clues = [];
390
442
  try {
391
- return statSync(`${path}.chompyy-backup`).mtimeMs;
443
+ clues.push(statSync(`${path}.chompyy-backup`).mtimeMs);
392
444
  }
393
445
  catch { }
394
- return events.length ? Date.parse(events[0].at) : null;
446
+ if (events.length)
447
+ clues.push(Date.parse(events[0].at));
448
+ const since = clues.filter(Number.isFinite).reduce((a, b) => (a === null ? b : Math.min(a, b)), null);
449
+ if (since !== null && nudgeInstalled(path)) {
450
+ try {
451
+ savePrefs({ ...prefs, onAt: new Date(since).toISOString() });
452
+ }
453
+ catch { }
454
+ }
455
+ return since;
395
456
  }
396
457
  export function nudgeInstalled(path = settingsPath()) {
397
458
  try {
@@ -401,12 +462,16 @@ export function nudgeInstalled(path = settingsPath()) {
401
462
  return false;
402
463
  }
403
464
  }
404
- /** The command the hook runs: this CLI by absolute path. A copy npx unpacked for one run can vanish, so not that. */
405
- export function hookCommand(script = process.argv[1] ?? '', node = process.execPath) {
465
+ /** This CLI by absolute path, for Claude Code to run. A copy npx unpacked for one run can vanish, so not that. */
466
+ export function selfCommand(script = process.argv[1] ?? '', node = process.execPath) {
406
467
  const real = existsSync(script) ? realpathSync(script) : script;
407
468
  if (/[\\/]_npx[\\/]/.test(real))
408
- throw new Error('This is a one-off npx copy. Install Chompyy first (npm install -g chompyy), then run chompyy nudge on.');
409
- return `"${node}" "${real}" hook prompt ${MARK}`;
469
+ throw new Error('This is a one-off npx copy. Install Chompyy first (npm install -g chompyy), then run this again.');
470
+ return `"${node}" "${real}"`;
471
+ }
472
+ /** The command the hook runs. */
473
+ export function hookCommand(script, node) {
474
+ return `${selfCommand(script, node)} hook prompt ${MARK}`;
410
475
  }
411
476
  /** Add (or remove) the hook in ~/.claude/settings.json, keeping every other hook. Backs the file up first. */
412
477
  export function setNudge(on, command, path = settingsPath()) {
package/dist/pacing.js CHANGED
@@ -161,8 +161,11 @@ export function weekForecast(snap, samples, now) {
161
161
  const projected = v.usedPct + rate * v.msLeft;
162
162
  const windowPct = windowShareOfWeek(samples);
163
163
  const unusedPct = Math.max(0, 100 - projected);
164
- const spareWindows = windowPct ? unusedPct / windowPct : null;
165
- const maxReachablePct = windowPct ? Math.min(100, v.usedPct + (v.msLeft / FIVE_HOURS) * windowPct) : null;
164
+ const windowsLeft = v.msLeft / FIVE_HOURS;
165
+ // Time runs out before the spare does: only the windows that fit count.
166
+ const timeBound = windowPct !== null && windowsLeft * windowPct < unusedPct;
167
+ const spareWindows = windowPct ? Math.min(unusedPct / windowPct, windowsLeft) : null;
168
+ const maxReachablePct = windowPct ? Math.min(100, v.usedPct + windowsLeft * windowPct) : null;
166
169
  const resets = v.resetsAt * 1000;
167
170
  const head = `Week ${Math.round(v.usedPct)}% used.`;
168
171
  let line;
@@ -172,10 +175,15 @@ export function weekForecast(snap, samples, now) {
172
175
  line = `${head} At your pace it runs out ~${dayClock(runsOutAt)}, before the reset ${dayClock(resets)}.`;
173
176
  }
174
177
  else {
175
- const spare = spareWindows !== null && spareWindows >= 1 ? `: about ${Math.floor(spareWindows)} full 5-hour window${Math.floor(spareWindows) === 1 ? '' : 's'}` : '';
176
- line = `${head} At your pace ~${Math.round(unusedPct)}% resets unused on ${dayClock(resets)}${spare}.`;
177
- if (maxReachablePct !== null && maxReachablePct < 99)
178
- line += ` Even running every window flat out, you'd reach ~${Math.round(maxReachablePct)}%.`;
178
+ const n = spareWindows !== null ? Math.floor(spareWindows) : 0;
179
+ const windows = `${n} full 5-hour window${n === 1 ? '' : 's'}`;
180
+ line = `${head} At your pace ~${Math.round(unusedPct)}% resets unused on ${dayClock(resets)}`;
181
+ if (!timeBound)
182
+ line += n >= 1 ? `: about ${windows}.` : '.';
183
+ else if (n >= 1)
184
+ line += `. Time left for ${windows}: flat out, you'd use ~${Math.round(maxReachablePct)}% of the week.`;
185
+ else
186
+ line += '. Less than one 5-hour window left before then.';
179
187
  }
180
188
  const short = line.slice(head.length + 1);
181
189
  return { usedPct: v.usedPct, resetsAt: v.resetsAt, unusedPct, ...(runsOutAt ? { runsOutAt } : {}), windowPct, spareWindows, maxReachablePct, line, short };
package/dist/picture.js CHANGED
@@ -8,6 +8,7 @@ import { dirname, join } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { homePath } from './home.js';
10
10
  import { chosenType, suggestTypes, typeHint } from './picturetype.js';
11
+ import { exe } from './exe.js';
11
12
  export function skillDir() {
12
13
  return join(dirname(fileURLToPath(import.meta.url)), '..', 'vendor', 'diagram-design');
13
14
  }
@@ -95,7 +96,7 @@ export function cleanPicture(html) {
95
96
  export const darkPicture = (html) => apply(html, TO_DARK);
96
97
  /** The skill's own self-check (accessibility contract, single-file safety, content inside the viewBox). */
97
98
  function selfCheck(file) {
98
- const r = spawnSync('python3', [join(skillDir(), 'scripts', 'self_check.py'), file], { encoding: 'utf8', timeout: 20_000 });
99
+ const r = spawnSync(exe('python3'), [join(skillDir(), 'scripts', 'self_check.py'), file], { encoding: 'utf8', timeout: 20_000 });
99
100
  if (r.error)
100
101
  return null;
101
102
  return (r.stdout + r.stderr).trim().split('\n').slice(0, 12).join('\n') || (r.status === 0 ? 'OK' : `exit ${r.status}`);
package/dist/preflight.js CHANGED
@@ -15,6 +15,7 @@ import { homePath, readJson, writeJson } from './home.js';
15
15
  import { detectCheck, run, sandboxProfile } from './verify.js';
16
16
  import { setupDependencies } from './deps.js';
17
17
  import { latestMain } from './workspace.js';
18
+ import { exe } from './exe.js';
18
19
  export { latestMain };
19
20
  const SKIP = new Set(['node_modules', '.git', '.build', 'dist', 'build', 'vendor', 'Pods', 'DerivedData', '.venv', 'venv', 'target']);
20
21
  /** Every check the repo has, from what's in its folders (up to 3 levels deep). */
@@ -58,7 +59,7 @@ export function detectChecks(root, cacheDir, maxDepth = 3) {
58
59
  walk(root, 0);
59
60
  return checks;
60
61
  }
61
- const git = (cwd, args) => execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
62
+ const git = (cwd, args) => execFileSync(exe('git'), ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
62
63
  const tryGit = (cwd, args) => {
63
64
  try {
64
65
  return git(cwd, args);
package/dist/quota.js CHANGED
@@ -61,6 +61,16 @@ export function mergeSnapshot(prev, next) {
61
61
  ...(next.models ?? prev?.models ? { models: next.models ?? prev?.models } : {}),
62
62
  };
63
63
  }
64
+ /**
65
+ * What the status line saves: the merged snapshot when Claude Code sent quota numbers, else null. Before a
66
+ * session's first reply there are none; rewriting the old snapshot then would only make it look fresh.
67
+ */
68
+ export function statuslineSnapshot(stdin, now, prev) {
69
+ const parsed = parseStatusline(stdin, now);
70
+ if (!parsed.fiveHour && !parsed.sevenDay)
71
+ return null;
72
+ return mergeSnapshot(prev, { ...parsed, source: 'statusline' });
73
+ }
64
74
  /** % left, time left and pace for one window. Past resets_at the window has reset: unknown. */
65
75
  export function windowView(w, now) {
66
76
  if (!w)
package/dist/refresh.js CHANGED
@@ -12,7 +12,8 @@ import { getCard, loadBoard, updateBoard } from './board.js';
12
12
  import { homePath } from './home.js';
13
13
  import { windowView } from './quota.js';
14
14
  import { commitLeftovers, gitRoot, restoreGitLink } from './workspace.js';
15
- const git = (cwd, args) => execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
15
+ import { exe } from './exe.js';
16
+ const git = (cwd, args) => execFileSync(exe('git'), ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
16
17
  const ok = (cwd, args) => {
17
18
  try {
18
19
  git(cwd, args);
package/dist/report.js CHANGED
@@ -61,6 +61,12 @@ export function morningLine(cards, taste) {
61
61
  bits.push(`taste: ${t.join(', ')}`);
62
62
  return bits.length ? `Since last time: ${bits.join(' · ')}` : null;
63
63
  }
64
+ /** "taste: 4 learned, 1 new in the last 7 days". Null when taste.md has no learned lines. */
65
+ export function tasteCountLine(count) {
66
+ if (!count.total)
67
+ return null;
68
+ return `taste: ${count.total} learned${count.newWithin7Days ? `, ${count.newWithin7Days} new in the last 7 days` : ''}`;
69
+ }
64
70
  export function formatReport(cards, since, facts, extras = {}) {
65
71
  const footer = extras.footer?.length ? ['', ...extras.footer] : [];
66
72
  if (cards.length === 0)
package/dist/review.js CHANGED
@@ -2,9 +2,10 @@
2
2
  // Every git card works on its own branch, so undo is just removing that branch.
3
3
  import { execFileSync } from 'node:child_process';
4
4
  import { existsSync, readFileSync, readdirSync, rmSync } from 'node:fs';
5
- import { join } from 'node:path';
5
+ import { basename, join } from 'node:path';
6
6
  import { homePath } from './home.js';
7
7
  import { commitLeftovers, gitRoot, uncommittedWork } from './workspace.js';
8
+ import { exe } from './exe.js';
8
9
  /**
9
10
  * What a card's changes are measured from: the commit it started from (the latest main at the time), so the
10
11
  * list shows only the card's own work. Measuring from your folder's HEAD showed 56 files for a 6-file card when
@@ -14,7 +15,7 @@ function since(run) {
14
15
  return run.base?.commit ?? 'HEAD';
15
16
  }
16
17
  function git(cwd, args) {
17
- return execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
18
+ return execFileSync(exe('git'), ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
18
19
  }
19
20
  function ran(card) {
20
21
  if (!card.run)
@@ -107,6 +108,24 @@ export function overlaps(card, others, changed = changedFiles) {
107
108
  })
108
109
  .filter((o) => o.files.length);
109
110
  }
111
+ /**
112
+ * What approving a run card says: two lines at most (cli/STYLE.md). Overlaps get one line, not one per card: they
113
+ * need nothing from you now, because when a Keep makes another card clash, refresh fits it onto the new main.
114
+ */
115
+ export function approvedText(id, overlapping) {
116
+ const lines = [`✅ #${id} approved. Runs when you're away.`];
117
+ if (overlapping.length) {
118
+ const count = new Map();
119
+ for (const o of overlapping)
120
+ for (const f of new Set(o.files))
121
+ count.set(f, (count.get(f) ?? 0) + 1);
122
+ const top = [...count.entries()].sort((a, b) => b[1] - a[1]).map(([f]) => basename(f));
123
+ const files = top.length > 2 ? `${top.slice(0, 2).join(', ')} and more` : top.join(' and ');
124
+ const n = overlapping.length;
125
+ lines.push(`Shares ${files} with ${n} waiting card${n === 1 ? '' : 's'}. If they clash at Keep, Chompyy fits them together.`);
126
+ }
127
+ return lines.join('\n');
128
+ }
110
129
  export function diffCard(card) {
111
130
  const run = ran(card);
112
131
  if (!run.branch)
package/dist/runner.js CHANGED
@@ -4,6 +4,7 @@ import { spawn, spawnSync } from 'node:child_process';
4
4
  import { TokenTally } from './tokens.js';
5
5
  import { closeSync, openSync, writeSync } from 'node:fs';
6
6
  import { commandPattern, hostsInErrors } from './permissions.js';
7
+ import { exe } from './exe.js';
7
8
  /** The raw output written to disk, cut off after `max` bytes (with a note saying so). */
8
9
  export class RawLog {
9
10
  max;
@@ -264,7 +265,7 @@ export class ClaudeRunner {
264
265
  return new Promise((resolve) => {
265
266
  // The prompt goes in on stdin: no argument-length limits, nothing in `ps`.
266
267
  // Own process group, so a timeout also stops commands the agent started (tests, builds).
267
- const child = spawn(this.bin, claudeArgs(req), { cwd: req.cwd, stdio: ['pipe', 'pipe', 'pipe'], detached: true, env: { ...process.env, ...req.env } });
268
+ const child = spawn(exe(this.bin), claudeArgs(req), { cwd: req.cwd, stdio: ['pipe', 'pipe', 'pipe'], detached: true, env: { ...process.env, ...req.env } });
268
269
  stopActiveOnExit();
269
270
  if (child.pid) {
270
271
  active.add(child.pid);
@@ -400,6 +401,6 @@ export class ClaudeRunner {
400
401
  }
401
402
  }
402
403
  export function claudeAvailable(bin = 'claude') {
403
- const r = spawnSync(bin, ['--version'], { stdio: 'ignore', timeout: 10_000 });
404
+ const r = spawnSync(exe(bin), ['--version'], { stdio: 'ignore', timeout: 10_000 });
404
405
  return r.status === 0;
405
406
  }