chompyy 0.4.6 → 0.5.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/README.md +43 -19
- package/dist/advice.js +2 -1
- package/dist/appstate.js +11 -3
- package/dist/board.js +7 -0
- package/dist/cli.js +95 -24
- package/dist/daytime.js +68 -0
- package/dist/deps.js +3 -2
- package/dist/didwork.js +46 -0
- package/dist/dream.js +2 -1
- package/dist/exe.js +34 -0
- package/dist/learning.js +35 -0
- package/dist/live.js +4 -3
- package/dist/livequota.js +2 -1
- package/dist/macapp.js +2 -1
- package/dist/nudge.js +9 -5
- package/dist/picture.js +2 -1
- package/dist/preflight.js +2 -1
- package/dist/quota.js +10 -0
- package/dist/refresh.js +2 -1
- package/dist/report.js +6 -0
- package/dist/review.js +2 -1
- package/dist/runner.js +3 -2
- package/dist/send.js +172 -92
- package/dist/statusline.js +110 -0
- package/dist/suggest.js +3 -2
- package/dist/taste-merge.js +79 -0
- package/dist/taste.js +106 -10
- package/dist/triggers.js +2 -1
- package/dist/unkeep.js +220 -0
- package/dist/verify.js +4 -1
- package/dist/verifycard.js +166 -46
- package/dist/workspace.js +3 -2
- package/package.json +11 -3
package/dist/didwork.js
CHANGED
|
@@ -411,6 +411,52 @@ function shareLabel(a) {
|
|
|
411
411
|
return 'MEMORY.md compressed';
|
|
412
412
|
return 'Other fix';
|
|
413
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Only what was counted goes in: each stop's next request, and each re-counted fix times the sessions that started
|
|
416
|
+
* after it (every stop since the first, even across an off-and-on, unlike the verdict's clean before). Before-vs-after readings (habits, the cold-return trend) can't separate a fix from the rest of the week,
|
|
417
|
+
* so they stay beside the total, never in it (M1). A settings change altered since isn't claimed (M3).
|
|
418
|
+
*/
|
|
419
|
+
export function savedTotal(cards, stops, s, now) {
|
|
420
|
+
const counted = cards.filter((c) => {
|
|
421
|
+
const r = c.advice?.result;
|
|
422
|
+
return r?.method === 'recount' && r.per === 'session start' && r.saved !== undefined && r.verdict !== 'cant-tell' && r.verdict !== 'too-early' && (r.provenance ?? 'intact') === 'intact';
|
|
423
|
+
});
|
|
424
|
+
if (!counted.length && !stops)
|
|
425
|
+
return null;
|
|
426
|
+
let tokens = 0;
|
|
427
|
+
let starts = 0;
|
|
428
|
+
for (const c of counted) {
|
|
429
|
+
const n = sessionsIn(s, startOf(c), now + 1).length;
|
|
430
|
+
starts += n;
|
|
431
|
+
tokens += c.advice.result.saved * n;
|
|
432
|
+
}
|
|
433
|
+
const nudge = stops?.saved ?? 0;
|
|
434
|
+
const since = Math.min(...counted.map(startOf), stops?.since ?? Infinity);
|
|
435
|
+
const total = nudge + tokens;
|
|
436
|
+
const parts = [
|
|
437
|
+
...(stops ? [`live suggestions ~${k(nudge)}`] : []),
|
|
438
|
+
...(counted.length ? [`${plural(counted.length, 'fix', 'fixes')} ~${k(tokens)} over ${plural(starts, 'session start')}`] : []),
|
|
439
|
+
];
|
|
440
|
+
const head = total >= 0 ? `Saved so far: ~${k(total)} tokens since ${day(since)}` : `Cost so far: ~${k(-total)} tokens since ${day(since)}`;
|
|
441
|
+
return { tokens: total, since: new Date(since).toISOString(), nudge, fixes: { count: counted.length, tokens, starts }, line: `${head} (${parts.join(', ')}).` };
|
|
442
|
+
}
|
|
443
|
+
/** Live suggestions' proof and the running total, from one transcript scan long enough for both. */
|
|
444
|
+
export function savedSoFar(cards, now, opts = {}) {
|
|
445
|
+
const events = loadNudges();
|
|
446
|
+
const since = nudgeOnSince(events);
|
|
447
|
+
// The total counts every stop, the same way as the panel's "saved this week" line; the verdict keeps its own start.
|
|
448
|
+
const counted = [...outcomes(events), ...warnOutcomes(events)];
|
|
449
|
+
const stops = counted.length ? { saved: counted.reduce((a, o) => a + o.saved, 0), since: Math.min(...counted.map((o) => Date.parse(o.event.at))) } : null;
|
|
450
|
+
const starts = cards.filter((c) => c.advice?.result?.method === 'recount').map(startOf);
|
|
451
|
+
const earliest = Math.min(since ?? Infinity, stops?.since ?? Infinity, ...starts);
|
|
452
|
+
if (earliest === Infinity)
|
|
453
|
+
return { proof: null, total: null };
|
|
454
|
+
const t = now.getTime();
|
|
455
|
+
const root = opts.root ?? projectsDir();
|
|
456
|
+
const s = scan({ days: Math.max(30, Math.ceil((t - earliest) / DAY) + 8), now, root });
|
|
457
|
+
const proof = (opts.on ?? true) && since ? nudgeProof(now, { root, events, s }) : null;
|
|
458
|
+
return { proof, total: savedTotal(cards, stops, s, t) };
|
|
459
|
+
}
|
|
414
460
|
const VERDICT_WORD = { 'too-early': 'too early', worked: 'worked', short: 'fell short', 'no-change': 'no change', worse: 'went the wrong way', 'cant-tell': "can't tell" };
|
|
415
461
|
/** The numbers only: before → after, the method, the verdict or the day it comes. */
|
|
416
462
|
function shareNumbers(a, r) {
|
package/dist/dream.js
CHANGED
|
@@ -19,6 +19,7 @@ import { execFileSync } from 'node:child_process';
|
|
|
19
19
|
import { appendJsonl, chompyyHome, homePath, readJson, writeJson } from './home.js';
|
|
20
20
|
import { signalsPath } from './taste.js';
|
|
21
21
|
import { addTokens } from './tokens.js';
|
|
22
|
+
import { exe } from './exe.js';
|
|
22
23
|
export const DESKTOP = 'Claude desktop app';
|
|
23
24
|
/** First night: read this far back. */
|
|
24
25
|
export const FIRST_DAYS = 7;
|
|
@@ -65,7 +66,7 @@ function isRepo(dir, cache) {
|
|
|
65
66
|
if (!cache.has(dir)) {
|
|
66
67
|
let ok = false;
|
|
67
68
|
try {
|
|
68
|
-
execFileSync('git', ['-C', dir, 'rev-parse', '--git-dir'], { stdio: 'ignore' });
|
|
69
|
+
execFileSync(exe('git'), ['-C', dir, 'rev-parse', '--git-dir'], { stdio: 'ignore' });
|
|
69
70
|
ok = true;
|
|
70
71
|
}
|
|
71
72
|
catch { }
|
package/dist/exe.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Launch programs by full path (2026-11-30). Given a bare name like "git", Node tries each PATH folder in turn,
|
|
2
|
+
// and on macOS every miss still creates a short-lived process that the system vets as a copy of Node
|
|
3
|
+
// (syspolicyd, about 5 ms each, one at a time). /usr/bin is 15th on a typical PATH, and `npm test` adds more
|
|
4
|
+
// folders in front, so each git call cost about 14 of these. The app's `chompyy state` every 15 s (65 git calls)
|
|
5
|
+
// kept syspolicyd busy 40% of the time: every program launch on the Mac waited, and slow git tests timed out in
|
|
6
|
+
// Chompyy's own check. Looking the name up once here and launching the full path makes no throwaway processes.
|
|
7
|
+
import { accessSync, constants, statSync } from 'node:fs';
|
|
8
|
+
import { delimiter, join } from 'node:path';
|
|
9
|
+
const found = new Map();
|
|
10
|
+
/** The full path of `name`: the first match on PATH, the same one a spawn would run. A path, or a miss, comes back as given. */
|
|
11
|
+
export function exe(name, path = process.env.PATH ?? '') {
|
|
12
|
+
if (!name || name.includes('/'))
|
|
13
|
+
return name;
|
|
14
|
+
const key = `${name}\0${path}`;
|
|
15
|
+
const hit = found.get(key);
|
|
16
|
+
if (hit)
|
|
17
|
+
return hit;
|
|
18
|
+
for (const dir of path.split(delimiter)) {
|
|
19
|
+
if (!dir)
|
|
20
|
+
continue;
|
|
21
|
+
const full = join(dir, name);
|
|
22
|
+
try {
|
|
23
|
+
if (!statSync(full).isFile())
|
|
24
|
+
continue;
|
|
25
|
+
accessSync(full, constants.X_OK);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
found.set(key, full);
|
|
31
|
+
return full;
|
|
32
|
+
}
|
|
33
|
+
return name; // not on PATH: the spawn reports it as before
|
|
34
|
+
}
|
package/dist/learning.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const WEEK = 7 * 86_400_000;
|
|
2
|
+
/** Conversations read in each week before the correction rate is compared. */
|
|
3
|
+
export const MIN_READ = 5;
|
|
4
|
+
export function learning(store, signals, readThrough, waiting, now) {
|
|
5
|
+
const t = now.getTime();
|
|
6
|
+
const inWeek = (at, back) => {
|
|
7
|
+
const x = Date.parse(at);
|
|
8
|
+
return x >= t - (back + 1) * WEEK && x < t - back * WEEK;
|
|
9
|
+
};
|
|
10
|
+
const active = store.prefs.filter((p) => p.status === 'active');
|
|
11
|
+
const learnedThisWeek = active.filter((p) => p.validFrom && inWeek(p.validFrom, 0)).length;
|
|
12
|
+
const chats = signals.filter((s) => s.kind === 'chat');
|
|
13
|
+
const reads = Object.values(readThrough);
|
|
14
|
+
const c = {
|
|
15
|
+
thisWeek: chats.filter((s) => inWeek(s.at, 0)).length,
|
|
16
|
+
lastWeek: chats.filter((s) => inWeek(s.at, 1)).length,
|
|
17
|
+
readThisWeek: reads.filter((at) => inWeek(at, 0)).length,
|
|
18
|
+
readLastWeek: reads.filter((at) => inWeek(at, 1)).length,
|
|
19
|
+
perThis: null,
|
|
20
|
+
perLast: null,
|
|
21
|
+
};
|
|
22
|
+
if (c.readThisWeek >= MIN_READ && c.readLastWeek >= MIN_READ) {
|
|
23
|
+
c.perThis = c.thisWeek / c.readThisWeek;
|
|
24
|
+
c.perLast = c.lastWeek / c.readLastWeek;
|
|
25
|
+
}
|
|
26
|
+
const rules = (n) => `${n} rule${n === 1 ? '' : 's'}`;
|
|
27
|
+
const head = active.length
|
|
28
|
+
? `Chompyy learned ${learnedThisWeek ? `${rules(learnedThisWeek)} this week (${active.length} in all)` : `${rules(active.length)} so far, none new this week`}`
|
|
29
|
+
: 'Chompyy has no rules yet';
|
|
30
|
+
const wait = waiting ? `; ${waiting} wait${waiting === 1 ? 's' : ''} for your yes` : '';
|
|
31
|
+
const rate = c.perThis !== null && c.perLast !== null
|
|
32
|
+
? ` Corrections per conversation: ${c.perLast.toFixed(1)} → ${c.perThis.toFixed(1)}.`
|
|
33
|
+
: ` Corrections per conversation: not enough read yet (${c.readThisWeek} this week, needs ${MIN_READ}).`;
|
|
34
|
+
return { learned: active.length, learnedThisWeek, waiting, corrections: c, line: `${head}${wait}.${rate}` };
|
|
35
|
+
}
|
package/dist/live.js
CHANGED
|
@@ -11,10 +11,11 @@ import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, write
|
|
|
11
11
|
import { homedir } from 'node:os';
|
|
12
12
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
13
13
|
import { chompyyHome, homePath, readJson, writeJson } from './home.js';
|
|
14
|
+
import { exe } from './exe.js';
|
|
14
15
|
export const livePath = () => homePath('live.json');
|
|
15
16
|
export const liveDir = () => join(chompyyHome(), 'live');
|
|
16
17
|
export const loadLive = () => readJson(livePath(), null);
|
|
17
|
-
const git = (cwd, args) => execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
18
|
+
const git = (cwd, args) => execFileSync(exe('git'), ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
18
19
|
/** The repo's shared .git folder: the same for every worktree of one repo. */
|
|
19
20
|
export function commonDir(dir) {
|
|
20
21
|
try {
|
|
@@ -41,12 +42,12 @@ export function planUpdate(live, target, depsHash, appExists, macChanged) {
|
|
|
41
42
|
}
|
|
42
43
|
const defaultDeps = (log) => ({
|
|
43
44
|
run: (cmd, args, cwd) => {
|
|
44
|
-
execFileSync(cmd, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 64 * 1024 * 1024 });
|
|
45
|
+
execFileSync(exe(cmd), args, { cwd, stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 64 * 1024 * 1024 });
|
|
45
46
|
},
|
|
46
47
|
log,
|
|
47
48
|
appRunning: () => {
|
|
48
49
|
try {
|
|
49
|
-
execFileSync('pgrep', ['-x', 'Chompyy'], { stdio: 'ignore' });
|
|
50
|
+
execFileSync(exe('pgrep'), ['-x', 'Chompyy'], { stdio: 'ignore' });
|
|
50
51
|
return true;
|
|
51
52
|
}
|
|
52
53
|
catch {
|
package/dist/livequota.js
CHANGED
|
@@ -70,7 +70,8 @@ export async function refreshLiveQuota(opts = {}) {
|
|
|
70
70
|
if (state.retryAfterAt && Date.parse(state.retryAfterAt) > now.getTime()) {
|
|
71
71
|
return { ok: false, snapshot: current, message: `Anthropic limits how often quota can be checked; next check after ${hhmm(state.retryAfterAt)}.` };
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
// At most one request per 5 minutes, whichever wrote the snapshot since: the status line rewrites it on every reply.
|
|
74
|
+
if (!opts.force && state.lastTryAt && now.getTime() - Date.parse(state.lastTryAt) < MIN_INTERVAL_MS && current) {
|
|
74
75
|
return { ok: true, snapshot: current, message: 'Fresh enough.' };
|
|
75
76
|
}
|
|
76
77
|
const fetchQuota = opts.fetchQuota ?? ((o) => fetchClaudeQuota(o));
|
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
|
@@ -409,7 +409,7 @@ export function nudgeText(on, list = outcomes(), now = Date.now()) {
|
|
|
409
409
|
// ---------- installing the hook in Claude Code's settings ----------
|
|
410
410
|
export const claudeSettingsPath = () => process.env.CHOMPYY_CLAUDE_SETTINGS || join(homedir(), '.claude', 'settings.json');
|
|
411
411
|
const settingsPath = claudeSettingsPath;
|
|
412
|
-
function readSettings(path) {
|
|
412
|
+
export function readSettings(path) {
|
|
413
413
|
if (!existsSync(path))
|
|
414
414
|
return { settings: {}, raw: null };
|
|
415
415
|
const raw = readFileSync(path, 'utf8');
|
|
@@ -462,12 +462,16 @@ export function nudgeInstalled(path = settingsPath()) {
|
|
|
462
462
|
return false;
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
/**
|
|
466
|
-
export function
|
|
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) {
|
|
467
467
|
const real = existsSync(script) ? realpathSync(script) : script;
|
|
468
468
|
if (/[\\/]_npx[\\/]/.test(real))
|
|
469
|
-
throw new Error('This is a one-off npx copy. Install Chompyy first (npm install -g chompyy), then run
|
|
470
|
-
return `"${node}" "${real}"
|
|
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}`;
|
|
471
475
|
}
|
|
472
476
|
/** Add (or remove) the hook in ~/.claude/settings.json, keeping every other hook. Backs the file up first. */
|
|
473
477
|
export function setNudge(on, command, path = settingsPath()) {
|
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
|
-
|
|
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
|
@@ -5,6 +5,7 @@ import { existsSync, readFileSync, readdirSync, rmSync } from 'node:fs';
|
|
|
5
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)
|
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
|
}
|