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/README.md +16 -15
- package/dist/appstate.js +6 -1
- package/dist/away.js +6 -1
- package/dist/board.js +4 -0
- package/dist/cli.js +67 -33
- package/dist/costs.js +43 -0
- package/dist/deps.js +3 -2
- package/dist/didwork.js +6 -4
- package/dist/dream.js +2 -1
- package/dist/exe.js +34 -0
- package/dist/keeplock.js +72 -0
- package/dist/live.js +4 -3
- package/dist/livequota.js +2 -1
- package/dist/macapp.js +2 -1
- package/dist/nudge.js +91 -26
- package/dist/pacing.js +14 -6
- 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 +21 -2
- package/dist/runner.js +3 -2
- package/dist/send.js +294 -0
- package/dist/statusline.js +110 -0
- package/dist/suggest.js +3 -2
- package/dist/taste-merge.js +79 -0
- package/dist/taste.js +40 -4
- package/dist/triggers.js +2 -1
- package/dist/verify.js +4 -1
- package/dist/verifycard.js +166 -46
- package/dist/workspace.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,20 +42,22 @@ By default Chompyy reads live quota with Claude Code's saved login (macOS Keycha
|
|
|
42
42
|
|
|
43
43
|
The rate comes from a small history of quota readings (`quota-history.json`, 8 days), saved whenever the numbers change; no extra calls.
|
|
44
44
|
|
|
45
|
-
##
|
|
45
|
+
## The status line: cache timer and quota
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
```bash
|
|
48
|
+
chompyy statusline on # off gives your old status line back
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Claude Code's status line then shows when the conversation's cache goes cold, and once it has, what your next message rewrites:
|
|
48
52
|
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"statusLine": {
|
|
52
|
-
"type": "command",
|
|
53
|
-
"command": "chompyy statusline"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
53
|
```
|
|
54
|
+
🍪 5h 62% left · 1h40m · ~43% unused at 20:55 | 7d 41% used | cache warm till 19:46
|
|
55
|
+
🍪 /compact first: cache cold, next message rewrites 242k | 5h 62% left · 1h40m | 7d 41% used
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The cache part needs Claude Code 2.1.251+, and shows only for conversations of 40k+ tokens (not right after a compaction). Claude Code re-runs the status line the moment the cache expires, so the clock time stays true. A status line you already had keeps running: Chompyy runs it on the same input and prints its line above Chompyy's. `on` backs up `~/.claude/settings.json` first.
|
|
57
59
|
|
|
58
|
-
Each status line refresh writes `~/.chompyy/quota.json
|
|
60
|
+
The same command also reads quota, never by sending a message (if no window is active, the first message would start a new 5-hour window). Each status line refresh writes `~/.chompyy/quota.json`:
|
|
59
61
|
|
|
60
62
|
```
|
|
61
63
|
🍪 5h 62% left · 1h40m · ~37%/h | 7d 41% used
|
|
@@ -63,8 +65,6 @@ Each status line refresh writes `~/.chompyy/quota.json` and shows one line:
|
|
|
63
65
|
|
|
64
66
|
That reads: 62% of the 5h window left, it resets in 1h40m, so about 37% per hour is available until then; 41% of the weekly limit is used. `rate_limits` only appears after the first reply of a session; until then the last snapshot is kept. Once the window's `resets_at` has passed, the snapshot is stale and Chompyy treats the window as unknown.
|
|
65
67
|
|
|
66
|
-
If you already have a status line command, keep it and call Chompyy from a small wrapper: save stdin to a variable, pipe it to `chompyy statusline`, and print both.
|
|
67
|
-
|
|
68
68
|
## Get to know you (cold start)
|
|
69
69
|
|
|
70
70
|
```bash
|
|
@@ -106,7 +106,8 @@ Each card in a git repo runs in its own worktree at `~/.chompyy/worktrees/<id>`
|
|
|
106
106
|
|
|
107
107
|
| Command | What it does |
|
|
108
108
|
|---|---|
|
|
109
|
-
| `chompyy statusline` | Status line hook: reads Claude Code's JSON on stdin, saves the snapshot, prints one line |
|
|
109
|
+
| `chompyy statusline` | Status line hook: reads Claude Code's JSON on stdin, saves the snapshot, prints one line with the cache timer |
|
|
110
|
+
| `chompyy statusline on\|off` | Makes it Claude Code's status line, keeping the one you had running above it; off gives yours back |
|
|
110
111
|
| `chompyy status` | % left in the 5h window, time to reset, weekly used, pace delta, forecast, today's allowance, per-model weekly windows |
|
|
111
112
|
| `chompyy eat-tokens` | Read-only view of remaining 5h quota and approved/later cards; starts nothing |
|
|
112
113
|
| `chompyy later "<idea>"` | New card in *later*, remembering the current directory. Drafts the blueprint in the background when `claude` is available (`--wait` to wait for it, `--no-blueprint` to skip). The card starts titled with the idea's first 60 characters; with the blueprint the same model writes a title of 10 words or fewer (one extra short call, no tools). If that call fails, the first title stays |
|
|
@@ -132,9 +133,9 @@ Each card in a git repo runs in its own worktree at `~/.chompyy/worktrees/<id>`
|
|
|
132
133
|
| `chompyy detect [--days 30] [--all] [--json]` | The detective: what wastes tokens in your setup and habits, from your own files. One screen: the findings ranked by tokens and the fix to start with; `--all` adds each finding's count, measured or estimated, what it doesn't prove, and every fix. A mid-session cache rebuild names its cause (e.g. Tool Search loading an MCP server's tools). Works cold with `npx chompyy detect`, nothing else installed. This version checks startup tax (long CLAUDE.md, unused skills and MCP servers, cut-off MEMORY.md) and cache (cold returns, mid-session rebuilds). Reads only; changes nothing |
|
|
133
134
|
| `chompyy advise [--json]` | The detective, step 3: turns detect's findings into suggested cards on the board (the app's "Find savings"). Each card's plan shows what Chompyy saw, what it doesn't prove, the exact change and how it will check it worked. Approve a settings card (e.g. turn off a plugin you never use) and Chompyy applies it once no Claude Code session has been active for 10 minutes, backed up first; `chompyy undo <id>` puts it back if nothing changed it since. Habit cards are tracked from the day you approve; some things only you can do (claude.ai-synced skills). Dropped advice never comes back. Advice never runs on an away run |
|
|
134
135
|
| `chompyy advise apply` | Apply approved settings advice now if no session has been active for 10 minutes (the app and the 5-minute tick do this on their own) |
|
|
135
|
-
| `chompyy nudge on\|off` | Live suggestions while you work. Adds a UserPromptSubmit hook to `~/.claude/settings.json` (backed up first; your other hooks stay). When you come back to a conversation of 40k+ tokens after more than an hour, its cache has expired: the hook stops that first message once and says what sending it rebuilds, what a fresh start costs, and the cheaper ways (/clear with a note, or /compact). Send it again and it goes through. Needs a global install (`npm install -g chompyy`); away runs turn hooks off, so it never touches them |
|
|
136
|
+
| `chompyy nudge on\|off` | Live suggestions while you work. Adds a UserPromptSubmit hook to `~/.claude/settings.json` (backed up first; your other hooks stay). When you come back to a conversation of 40k+ tokens after more than an hour, its cache has expired: the hook stops that first message once and says what sending it rebuilds, what a fresh start costs, and the cheaper ways (/clear with a note, or /compact). Send it again and it goes through. A conversation compacted since its last reply (your /compact, or Claude Code's own while you were away) sends a summary, so it isn't stopped. Needs a global install (`npm install -g chompyy`); away runs turn hooks off, so it never touches them |
|
|
136
137
|
| `chompyy nudge [--json]` | On or off, what the stops and warnings led to (compacted, left, sent anyway), the tokens not written again, and the measured trend: cold returns this week against last week. The menu panel shows the same line |
|
|
137
|
-
| `chompyy nudge due [--json]` | Conversations 45-60 minutes into a pause, about to go cold, each reported once (only while nudge is on). The menu bar app asks every minute and sends a notification, while /compact is still cheap |
|
|
138
|
+
| `chompyy nudge due [--json]` | Conversations 45-60 minutes into a pause, about to go cold, each reported once (only while nudge is on). The menu bar app asks every minute and sends a notification, while /compact is still cheap. Skips conversations already compacted |
|
|
138
139
|
| `chompyy triggers on\|off` | Install or remove the macOS LaunchAgent that runs `chompyy tick` every 5 minutes |
|
|
139
140
|
| `chompyy bedtime <23:30\|off>` / `last-hour <on\|off>` / `missed-reset <on\|off>` | Turn the bedtime, last-hour-before-reset and missed-reset (first tick after an unused reset, default off) triggers on or off |
|
|
140
141
|
|
package/dist/appstate.js
CHANGED
|
@@ -21,6 +21,8 @@ import { planFor } from './permissions.js';
|
|
|
21
21
|
import { loadProfile, preflightHosts } from './preflight.js';
|
|
22
22
|
import { gitRoot } from './workspace.js';
|
|
23
23
|
import { writeBlueprintFile } from './blueprint.js';
|
|
24
|
+
import { outboxes } from './send.js';
|
|
25
|
+
import { exe } from './exe.js';
|
|
24
26
|
export function cardView(card, runs = readRuns()) {
|
|
25
27
|
const qPath = card.run ? join(card.run.workdir, 'QUESTIONS.md') : '';
|
|
26
28
|
return {
|
|
@@ -48,7 +50,7 @@ function permissionPlanFor(card) {
|
|
|
48
50
|
/** The branch a folder is on (what Keep merges into), or null. */
|
|
49
51
|
export function currentBranch(cwd) {
|
|
50
52
|
try {
|
|
51
|
-
return execFileSync('git', ['-C', cwd, 'rev-parse', '--abbrev-ref', 'HEAD'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || null;
|
|
53
|
+
return execFileSync(exe('git'), ['-C', cwd, 'rev-parse', '--abbrev-ref', 'HEAD'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || null;
|
|
52
54
|
}
|
|
53
55
|
catch {
|
|
54
56
|
return null;
|
|
@@ -71,10 +73,13 @@ export function appState(board, snap, config, now) {
|
|
|
71
73
|
},
|
|
72
74
|
gate: budgetGate(snap, config, now),
|
|
73
75
|
cards: board.cards.map((c) => cardView(c, runs)),
|
|
76
|
+
/** Kept cards only on this Mac, per landing branch: the Done column's Send button. */
|
|
77
|
+
outbox: outboxes(board.cards),
|
|
74
78
|
coldStart: coldStartState(),
|
|
75
79
|
tasteQuestion: tasteQuestion(),
|
|
76
80
|
taste: tasteState(),
|
|
77
81
|
dream: dreamState(config, now),
|
|
82
|
+
pictures: config.pictures,
|
|
78
83
|
triggers: { installed: agentInstalled(), lastHour: config.lastHourTrigger, bedtime: config.bedtime, ...loadTriggerState() },
|
|
79
84
|
};
|
|
80
85
|
}
|
package/dist/away.js
CHANGED
|
@@ -264,6 +264,8 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
264
264
|
let verified;
|
|
265
265
|
let tokens;
|
|
266
266
|
let log = '';
|
|
267
|
+
/** Unset when the run failed before the prompt was built. */
|
|
268
|
+
let tasteApplied;
|
|
267
269
|
try {
|
|
268
270
|
ws = deps.prepare(card);
|
|
269
271
|
if (ws.base)
|
|
@@ -274,7 +276,9 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
274
276
|
const granted = applyPermissions(card.permissions);
|
|
275
277
|
if (card.permissions?.length)
|
|
276
278
|
out(` allowed for this card: ${card.permissions.join(', ')}`);
|
|
277
|
-
const
|
|
279
|
+
const taste = (deps.taste ?? tasteForPrompt)();
|
|
280
|
+
tasteApplied = taste !== '';
|
|
281
|
+
const prompt = taskPrompt(card, ws.dir, taste, deps.repoChecks?.(card) ?? []);
|
|
278
282
|
const cacheDir = homePath('cache', 'tools');
|
|
279
283
|
mkdirSync(cacheDir, { recursive: true });
|
|
280
284
|
const questionsPath = join(ws.dir, 'QUESTIONS.md');
|
|
@@ -388,6 +392,7 @@ export async function runCard(id, timeoutMs, deps, trigger) {
|
|
|
388
392
|
durationMs: finishedMs - startedMs,
|
|
389
393
|
...cost,
|
|
390
394
|
...(tokens ? { tokens } : {}),
|
|
395
|
+
...(tasteApplied !== undefined ? { tasteApplied } : {}),
|
|
391
396
|
});
|
|
392
397
|
out(` → ${status} · ${formatDuration(finishedMs - startedMs)}${cost.fiveHourPct !== null ? ` · used ${cost.fiveHourPct}% of the 5h window` : ''} · log ${logPath}`);
|
|
393
398
|
return card.id;
|
package/dist/board.js
CHANGED
|
@@ -157,6 +157,10 @@ export function dropCard(board, id, now) {
|
|
|
157
157
|
throw new Error(`Card #${card.id} is running; wait for the run to finish.`);
|
|
158
158
|
board.cards = board.cards.filter((c) => c !== card);
|
|
159
159
|
appendJsonl(homePath('archive.jsonl'), { ...card, droppedAt: now.toISOString() });
|
|
160
|
+
// Dropping advice you never approved is a "no, never": taste reads it as evidence (taste.ts 'advice-declined').
|
|
161
|
+
if (card.advice && (card.column === 'suggested' || card.column === 'later')) {
|
|
162
|
+
appendJsonl(homePath('signals.jsonl'), { at: now.toISOString(), card: card.id, title: card.title, kind: 'advice-declined', key: card.advice.key, rule: card.advice.rule, lane: card.advice.lane });
|
|
163
|
+
}
|
|
160
164
|
return card;
|
|
161
165
|
}
|
|
162
166
|
/**
|
package/dist/cli.js
CHANGED
|
@@ -16,10 +16,10 @@ import { loadConfig, setConfig } from './config.js';
|
|
|
16
16
|
import { formatDuration, parseDuration } from './duration.js';
|
|
17
17
|
import { budgetGate } from './gate.js';
|
|
18
18
|
import { chompyyHome, homePath } from './home.js';
|
|
19
|
-
import { loadSnapshot,
|
|
19
|
+
import { loadSnapshot, saveSnapshot, statuslineSnapshot, statusLineText, statusText as baseStatusText, windowView } from './quota.js';
|
|
20
20
|
import { loadSamples } from './pacing.js';
|
|
21
|
-
import { cardsSince, formatReport, lastReportAt, markReported, morningLine, rateCard, readTaste } from './report.js';
|
|
22
|
-
import { changedFiles, diffCard, keepCard, overlaps, questionsOf, undoCard } from './review.js';
|
|
21
|
+
import { cardsSince, formatReport, lastReportAt, markReported, morningLine, rateCard, readTaste, tasteCountLine } from './report.js';
|
|
22
|
+
import { approvedText, changedFiles, diffCard, keepCard, overlaps, questionsOf, undoCard } from './review.js';
|
|
23
23
|
import { CappedText, ClaudeRunner, claudeAvailable } from './runner.js';
|
|
24
24
|
import { branchOf, commitLeftovers, gitRoot, planWorkspace, prepareWorkspace } from './workspace.js';
|
|
25
25
|
import { answerCard, appState, cardView, currentBranch, editBlueprint, editIdea, recordCliLocation } from './appstate.js';
|
|
@@ -32,8 +32,8 @@ import { buildDigest, historyRetention, scanHistory } from './history.js';
|
|
|
32
32
|
import { acceptColdStart, forgetColdStart, formatColdStart, loadColdStart, runColdStart } from './coldstart.js';
|
|
33
33
|
import { keepHistory } from './claudesettings.js';
|
|
34
34
|
import { blueprintHash, drawPicture } from './picture.js';
|
|
35
|
-
import { costRange, formatCostRange, readRuns, trendLines } from './costs.js';
|
|
36
|
-
import { answerPreference, distill, distillDue, formatPrefs, formatQuestion, formatWhy, getPref, loadStore, nextQuestion, readSignals, recordOutcome, retirePreference, syncTasteFile, tasteChangesSince, } from './taste.js';
|
|
35
|
+
import { costRange, formatCostRange, readRuns, tasteEffect, tasteEffectLine, trendLines } from './costs.js';
|
|
36
|
+
import { answerPreference, distill, distillDue, formatPrefs, formatQuestion, formatWhy, getPref, learnedCount, loadStore, nextQuestion, readSignals, recordOutcome, retirePreference, syncTasteFile, tasteChangesSince, } from './taste.js';
|
|
37
37
|
import { cachedWorkspaces, dream, dreamDue, formatDream, formatWorkspaces, projectsDir, readLogPath, setTicked } from './dream.js';
|
|
38
38
|
import { byKind, compare, formatExtras, formatUsage, loadLedger, periodDays, PERIODS, prCosts, usageView } from './usage.js';
|
|
39
39
|
import { formatTrace, traceSession } from './trace.js';
|
|
@@ -43,12 +43,17 @@ import { adviseText, applyDue, approveAdvice, runAdvise, undoAdvice } from './ad
|
|
|
43
43
|
import { checkWorked, nudgeProof, nudgeProofText, shareText, workedText } from './didwork.js';
|
|
44
44
|
import { addSuggested, suggestTasks, suggestText } from './suggest.js';
|
|
45
45
|
import { coldWarningText, hookCommand, impact, loadNudges, nudgeInstalled, nudgeText, runHook, setNudge, setProjectMode, takeGoingCold } from './nudge.js';
|
|
46
|
+
import { withKeepLock } from './keeplock.js';
|
|
47
|
+
import { sendKept } from './send.js';
|
|
48
|
+
import { cacheText, composeLine, setStatusline, statuslineInstalled, statusLineOutput, wrappedCommand } from './statusline.js';
|
|
46
49
|
import { formatLive, keepAffectsLive, liveOff, liveSet, liveUpdateLocked, loadLive, startLiveUpdate } from './live.js';
|
|
47
50
|
import { agentInstalled, awayRunning, bedtimeKey, decideTrigger, installAgent, loadTriggerState, markFired, noteTick, parseClock, takeAwayLock, uninstallAgent } from './triggers.js';
|
|
51
|
+
import { exe } from './exe.js';
|
|
48
52
|
const HELP = `chompyy: use the 5-hour window capacity that would reset unused
|
|
49
53
|
|
|
50
54
|
Quota
|
|
51
|
-
chompyy statusline Claude Code statusLine command: reads JSON on stdin, saves a snapshot
|
|
55
|
+
chompyy statusline Claude Code statusLine command: reads JSON on stdin, saves a snapshot, shows the cache timer
|
|
56
|
+
chompyy statusline on|off use it as Claude Code's status line (the one you had keeps running above it)
|
|
52
57
|
chompyy status % left, time to reset, pace, weekly used, staleness
|
|
53
58
|
chompyy quota [--refresh] read live quota from Anthropic now (uses Claude Code's saved login; sends no message)
|
|
54
59
|
chompyy quota --allow-keychain | --no-keychain allow (or stop) reading that login from the macOS Keychain
|
|
@@ -56,7 +61,7 @@ Quota
|
|
|
56
61
|
chompyy advise [--json] turn detect's findings into suggested cards to approve or drop: settings changes are
|
|
57
62
|
applied (backed up, undoable) once no Claude Code session is active; habits are tracked
|
|
58
63
|
chompyy advise apply apply approved settings advice now, if no session has been active for 10 minutes
|
|
59
|
-
chompyy worked [--json]
|
|
64
|
+
chompyy worked [--all] [--json] did it work? measure each approved advice card against the check on its card
|
|
60
65
|
chompyy worked --share the same as a summary to paste (no project, skill or file names)
|
|
61
66
|
chompyy suggest [repo] [--force] a few tasks for a repo from its docs, issues and TODOs, as suggested cards
|
|
62
67
|
(one model call; waits for an active 5-hour window unless --force)
|
|
@@ -91,6 +96,7 @@ Back
|
|
|
91
96
|
chompyy report [--all] what ran, and the one thing to do about each
|
|
92
97
|
chompyy diff <id> the change it made
|
|
93
98
|
chompyy keep <id> merge its branch into the branch it started from (and update the live app, if set)
|
|
99
|
+
chompyy send [--json] open one PR on GitHub per kept card GitHub's main doesn't have yet
|
|
94
100
|
chompyy refresh [<id>] bring cards in review up to date with main (Chompyy does this by itself after each Keep)
|
|
95
101
|
chompyy undo <id> throw it away (removes its branch; yours are untouched)
|
|
96
102
|
chompyy answer <id> answer the run's questions (stdin); the card goes back to approved
|
|
@@ -101,7 +107,7 @@ Back
|
|
|
101
107
|
chompyy five-star <id> options for "what would have made it a 5?" (JSON)
|
|
102
108
|
chompyy signals [--json] everything Chompyy has recorded from you: ratings, edits, answers
|
|
103
109
|
chompyy tokens [--json] exact tokens and API-value cost of each run
|
|
104
|
-
chompyy trends last 7 days vs the 7 before: cost per card, keep rate, rating, blueprint edits
|
|
110
|
+
chompyy trends last 7 days vs the 7 before: cost per card, keep rate, rating, blueprint edits; keep rate with taste vs without
|
|
105
111
|
|
|
106
112
|
Taste (learned from what you keep, undo, edit and rate)
|
|
107
113
|
chompyy trace <id> one conversation turn by turn: cost per turn, context size, what ate the tokens
|
|
@@ -316,7 +322,11 @@ async function distillNow(now, force = false) {
|
|
|
316
322
|
return `Read ${r.read} new signal(s): ${parts.join(', ')}${c.dropped ? ` (${c.dropped} thrown out for weak evidence)` : ''}. See \`chompyy taste list\`.`;
|
|
317
323
|
}
|
|
318
324
|
/** Keep a card: merge it, record it, update the live app, and bring the other cards in review up to date. */
|
|
325
|
+
/** Keep a card: one Keep at a time (keeplock.ts), whether you pressed it or refresh keeps a card it brought up to date. */
|
|
319
326
|
function keepNow(id, now) {
|
|
327
|
+
withKeepLock(() => keepLocked(id, now));
|
|
328
|
+
}
|
|
329
|
+
function keepLocked(id, now) {
|
|
320
330
|
const kept = getCard(loadBoard(), id);
|
|
321
331
|
const files = changedFiles(kept); // read before Keep removes the branch
|
|
322
332
|
console.log(keepCard(kept));
|
|
@@ -399,7 +409,7 @@ function awayDeps(config, freshQuota) {
|
|
|
399
409
|
const cacheDir = homePath('cache', 'tools');
|
|
400
410
|
if (!root || ws.kind !== 'worktree')
|
|
401
411
|
return undefined;
|
|
402
|
-
const baseCommit = ws.base?.commit ?? execFileSync('git', ['-C', root, 'merge-base', 'HEAD', ws.branch], { encoding: 'utf8' }).trim();
|
|
412
|
+
const baseCommit = ws.base?.commit ?? execFileSync(exe('git'), ['-C', root, 'merge-base', 'HEAD', ws.branch], { encoding: 'utf8' }).trim();
|
|
403
413
|
return verifyCard({ root, dir: ws.dir, baseCommit, cacheDir, denyRead: config.denyReadPaths, timeoutMs: config.checkTimeoutMin * 60_000, now: () => new Date() });
|
|
404
414
|
},
|
|
405
415
|
}
|
|
@@ -516,16 +526,27 @@ async function main(argv) {
|
|
|
516
526
|
};
|
|
517
527
|
switch (command) {
|
|
518
528
|
case 'statusline': {
|
|
529
|
+
const sub = args[0];
|
|
530
|
+
if (sub === 'on' || sub === 'off')
|
|
531
|
+
return console.log(setStatusline(sub === 'on'));
|
|
532
|
+
if (process.stdin.isTTY)
|
|
533
|
+
return console.log(statuslineInstalled() ? 'Cache timer on in Claude Code\'s status line. Turn it off: chompyy statusline off' : 'Show the cache timer in Claude Code\'s status line: chompyy statusline on');
|
|
519
534
|
// Must never fail loudly: it runs on every status bar refresh.
|
|
535
|
+
let stdin = '';
|
|
536
|
+
let ours = '🍪';
|
|
520
537
|
try {
|
|
521
|
-
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
538
|
+
stdin = await readStdin();
|
|
539
|
+
const prev = loadSnapshot();
|
|
540
|
+
const fresh = statuslineSnapshot(stdin, now, prev);
|
|
541
|
+
if (fresh)
|
|
542
|
+
saveSnapshot(fresh);
|
|
543
|
+
const snap = fresh ?? prev ?? { capturedAt: now.toISOString() };
|
|
544
|
+
ours = composeLine(statusLineText(snap, now, { samples: loadSamples(), color: true }), cacheText(stdin, now), true);
|
|
525
545
|
}
|
|
526
546
|
catch {
|
|
527
|
-
|
|
547
|
+
/* the cookie alone */
|
|
528
548
|
}
|
|
549
|
+
console.log(statusLineOutput(ours, wrappedCommand(), stdin));
|
|
529
550
|
return;
|
|
530
551
|
}
|
|
531
552
|
case 'status': {
|
|
@@ -933,10 +954,7 @@ async function main(argv) {
|
|
|
933
954
|
delete c.permissions;
|
|
934
955
|
return c;
|
|
935
956
|
});
|
|
936
|
-
console.log(
|
|
937
|
-
for (const o of overlaps(card, loadBoard().cards)) {
|
|
938
|
-
console.log(` ⚠️ #${o.id} "${o.title}" may touch the same files (${o.files.slice(0, 3).join(', ')}). Keeping both can conflict; Run again fixes that.`);
|
|
939
|
-
}
|
|
957
|
+
console.log(approvedText(card.id, overlaps(card, loadBoard().cards)));
|
|
940
958
|
return;
|
|
941
959
|
}
|
|
942
960
|
case 'drop': {
|
|
@@ -1178,7 +1196,7 @@ async function main(argv) {
|
|
|
1178
1196
|
return json({ cards: cards.map((c) => ({ id: c.id, title: c.title, rule: c.advice.rule, lane: c.advice.lane, ...c.advice.result })), nudge: proof });
|
|
1179
1197
|
if (!cards.length && proof)
|
|
1180
1198
|
return console.log(nudgeProofText(proof).join('\n'));
|
|
1181
|
-
return console.log([workedText(cards), ...(proof ? ['', ...nudgeProofText(proof)] : [])].join('\n'));
|
|
1199
|
+
return console.log([workedText(cards, { all: Boolean(values.all) }), ...(proof ? ['', ...nudgeProofText(proof)] : [])].join('\n'));
|
|
1182
1200
|
}
|
|
1183
1201
|
case 'suggest': {
|
|
1184
1202
|
// A few tasks for a repo, from what it wants to become and what its code shows: suggested cards to approve.
|
|
@@ -1243,8 +1261,11 @@ async function main(argv) {
|
|
|
1243
1261
|
return;
|
|
1244
1262
|
}
|
|
1245
1263
|
case 'trends': {
|
|
1246
|
-
const
|
|
1264
|
+
const runs = readRuns();
|
|
1265
|
+
const signals = readSignals();
|
|
1266
|
+
const lines = trendLines(runs, signals, now);
|
|
1247
1267
|
console.log(lines.length ? lines.join('\n') : 'Not enough runs yet for trends (needs 3).');
|
|
1268
|
+
console.log(tasteEffectLine(tasteEffect(runs, signals)));
|
|
1248
1269
|
return;
|
|
1249
1270
|
}
|
|
1250
1271
|
case 'report': {
|
|
@@ -1255,7 +1276,9 @@ async function main(argv) {
|
|
|
1255
1276
|
const signals = readSignals();
|
|
1256
1277
|
const morning = morningLine(cards, tasteChangesSince(store, since));
|
|
1257
1278
|
const question = nextQuestion(store, signals);
|
|
1258
|
-
|
|
1279
|
+
// Footer, not header: the header is dropped when no cards ran, and the count should still show.
|
|
1280
|
+
const tasteCount = tasteCountLine(learnedCount(readTaste().text, now));
|
|
1281
|
+
const footer = [...(tasteCount ? [tasteCount] : []), ...(question ? formatQuestion(question, signals) : []), ...trendLines(readRuns(), signals, now)];
|
|
1259
1282
|
console.log(formatReport(cards, since, (c) => ({ files: changedFiles(c), questions: questionsOf(c) }), { header: morning ? [morning] : [], footer }));
|
|
1260
1283
|
markReported(now);
|
|
1261
1284
|
return;
|
|
@@ -1266,18 +1289,29 @@ async function main(argv) {
|
|
|
1266
1289
|
}
|
|
1267
1290
|
case 'keep': {
|
|
1268
1291
|
const id = need(args[0], 'chompyy keep <id>');
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1292
|
+
// The clash check reads main too, so it waits behind a Keep that is still changing main.
|
|
1293
|
+
withKeepLock(() => {
|
|
1294
|
+
const card = getCard(loadBoard(), id);
|
|
1295
|
+
if (card.outcome === 'kept')
|
|
1296
|
+
return console.log(`#${id} is already kept.`);
|
|
1297
|
+
const clash = clashOf(card);
|
|
1298
|
+
if (clash) {
|
|
1299
|
+
// Don't hand the clash to you: Chompyy brings the card onto the new main, checks it, then keeps it (refresh.ts).
|
|
1300
|
+
updateBoard((b) => {
|
|
1301
|
+
getCard(b, id).keepWhenRefreshed = true;
|
|
1302
|
+
});
|
|
1303
|
+
startBackground(['refresh', '--clashing'], 'refresh.log');
|
|
1304
|
+
console.log(`#${id} clashes with ${clash.branch} (${clash.files.join(', ')}): other cards were kept since it ran. Chompyy is bringing it up to date and will keep it once its checks pass.`);
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
keepNow(id, now);
|
|
1308
|
+
});
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
case 'send': {
|
|
1312
|
+
// Kept cards live on your local main only; this opens (or updates) one PR per card. Main itself is never pushed.
|
|
1313
|
+
const sent = sendKept(loadBoard().cards);
|
|
1314
|
+
console.log(args.includes('--json') ? JSON.stringify(sent) : sent.message);
|
|
1281
1315
|
return;
|
|
1282
1316
|
}
|
|
1283
1317
|
case 'refresh': {
|
package/dist/costs.js
CHANGED
|
@@ -160,3 +160,46 @@ export function trendLines(runs, signals, now, days = 7) {
|
|
|
160
160
|
bits.push(`~${fmtPct(all.costPerRun)}% of a 5h window per card`);
|
|
161
161
|
return [`📈 So far: ${bits.join(' · ')} (trends once there are two weeks to compare)`];
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Keep rate split by whether taste.md was in the prompt. The last decision per card counts (as periodStats),
|
|
165
|
+
* matched to that card's latest run at or before the decision. Decided cards with no run are left out.
|
|
166
|
+
*/
|
|
167
|
+
export function tasteEffect(runs, signals) {
|
|
168
|
+
const decided = new Map();
|
|
169
|
+
for (const s of signals)
|
|
170
|
+
if (s.kind === 'outcome' && s.card)
|
|
171
|
+
decided.set(s.card, { outcome: String(s.raw.outcome), at: Date.parse(s.at) });
|
|
172
|
+
const group = () => ({ n: 0, kept: 0, undone: 0, keepRate: null });
|
|
173
|
+
const out = { withTaste: group(), withoutTaste: group(), unrecorded: group() };
|
|
174
|
+
for (const [card, d] of decided) {
|
|
175
|
+
if (d.outcome !== 'kept' && d.outcome !== 'undone')
|
|
176
|
+
continue;
|
|
177
|
+
let last;
|
|
178
|
+
for (const r of runs) {
|
|
179
|
+
if (r.card !== card || Date.parse(r.at) > d.at)
|
|
180
|
+
continue;
|
|
181
|
+
if (!last || Date.parse(r.at) >= Date.parse(last.at))
|
|
182
|
+
last = r;
|
|
183
|
+
}
|
|
184
|
+
if (!last)
|
|
185
|
+
continue;
|
|
186
|
+
const g = last.tasteApplied === true ? out.withTaste : last.tasteApplied === false ? out.withoutTaste : out.unrecorded;
|
|
187
|
+
g.n++;
|
|
188
|
+
if (d.outcome === 'kept')
|
|
189
|
+
g.kept++;
|
|
190
|
+
else
|
|
191
|
+
g.undone++;
|
|
192
|
+
}
|
|
193
|
+
for (const g of [out.withTaste, out.withoutTaste, out.unrecorded])
|
|
194
|
+
g.keepRate = g.n ? g.kept / g.n : null;
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
/** One line for `chompyy trends`: both keep rates, or "not enough data" while a group is under MIN_POINTS. */
|
|
198
|
+
export function tasteEffectLine(e) {
|
|
199
|
+
const old = e.unrecorded.n ? ` · ${e.unrecorded.n} older card${e.unrecorded.n === 1 ? '' : 's'} not counted` : '';
|
|
200
|
+
if (e.withTaste.n < MIN_POINTS || e.withoutTaste.n < MIN_POINTS) {
|
|
201
|
+
return `Taste effect: not enough data (need ${MIN_POINTS}+ decided cards per group; with taste ${e.withTaste.n}, without ${e.withoutTaste.n})${old}`;
|
|
202
|
+
}
|
|
203
|
+
const pct = (g) => `${Math.round(g.keepRate * 100)}%`;
|
|
204
|
+
return `Taste effect: keep rate with taste ${pct(e.withTaste)} (n=${e.withTaste.n}) vs without ${pct(e.withoutTaste)} (n=${e.withoutTaste.n})${old}`;
|
|
205
|
+
}
|
package/dist/deps.js
CHANGED
|
@@ -10,6 +10,7 @@ import { createHash } from 'node:crypto';
|
|
|
10
10
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
|
11
11
|
import { join, relative } from 'node:path';
|
|
12
12
|
import { homePath } from './home.js';
|
|
13
|
+
import { exe } from './exe.js';
|
|
13
14
|
// The snapshot only has package.json and the lockfile, so the repo's own scripts (e.g. "prepare": "npm run build")
|
|
14
15
|
// can't run there: install with --ignore-scripts, then rebuild, which runs the dependencies' install steps only.
|
|
15
16
|
const LOCKFILES = [
|
|
@@ -60,7 +61,7 @@ function cloneModules(from, to) {
|
|
|
60
61
|
const dst = join(to, 'node_modules');
|
|
61
62
|
if (existsSync(dst))
|
|
62
63
|
rmSync(dst, { recursive: true, force: true });
|
|
63
|
-
return spawnSync('cp', ['-cR', join(from, 'node_modules'), dst], { stdio: 'ignore', timeout: 180_000 }).status === 0;
|
|
64
|
+
return spawnSync(exe('cp'), ['-cR', join(from, 'node_modules'), dst], { stdio: 'ignore', timeout: 180_000 }).status === 0;
|
|
64
65
|
}
|
|
65
66
|
/**
|
|
66
67
|
* Give every package folder in `worktree` its dependencies, preferring what's already installed. `checkout` is your
|
|
@@ -99,7 +100,7 @@ export function setupDependencies(checkout, worktree, repoKey, opts = {}) {
|
|
|
99
100
|
copyFileSync(join(dir, lock.file), join(snap, lock.file));
|
|
100
101
|
const ok = opts.install
|
|
101
102
|
? opts.install(lock.install, snap)
|
|
102
|
-
: lock.install.every((argv) => spawnSync(argv[0], argv.slice(1), { cwd: snap, stdio: 'ignore', timeout: opts.timeoutMs ?? 300_000, env: { ...process.env, ...opts.env } }).status === 0);
|
|
103
|
+
: lock.install.every((argv) => spawnSync(exe(argv[0]), argv.slice(1), { cwd: snap, stdio: 'ignore', timeout: opts.timeoutMs ?? 300_000, env: { ...process.env, ...opts.env } }).status === 0);
|
|
103
104
|
if (!ok || !hasModules(snap)) {
|
|
104
105
|
rmSync(join(snap, 'node_modules'), { recursive: true, force: true });
|
|
105
106
|
// Better something than nothing: your checkout's packages, flagged as a mismatch.
|
package/dist/didwork.js
CHANGED
|
@@ -360,20 +360,22 @@ export function nudgeProofText(p) {
|
|
|
360
360
|
}
|
|
361
361
|
const ICON = { 'too-early': '⏳', worked: '✅', short: '🟡', 'no-change': '➖', worse: '🔻', 'cant-tell': '❔' };
|
|
362
362
|
/** One screen: each fix, its verdict, and the saving by method (never added across methods). */
|
|
363
|
-
export function workedText(cards) {
|
|
363
|
+
export function workedText(cards, opts = {}) {
|
|
364
364
|
if (!cards.length)
|
|
365
365
|
return 'Nothing to measure yet. Approve an advice card: chompyy advise';
|
|
366
366
|
const lines = [];
|
|
367
|
-
|
|
367
|
+
// Five at most on one screen (cli/STYLE.md), losses first so a cut never hides one; the totals still count every card.
|
|
368
|
+
const shown = cards.filter((c) => c.advice.result).sort((a, b) => Number(b.advice.result.verdict === 'worse') - Number(a.advice.result.verdict === 'worse'));
|
|
369
|
+
for (const c of shown.slice(0, opts.all ? undefined : 5)) {
|
|
368
370
|
const r = c.advice.result;
|
|
369
|
-
if (!r)
|
|
370
|
-
continue;
|
|
371
371
|
lines.push(`${ICON[r.verdict]} #${c.id} ${c.title}`, ` ${r.line}`);
|
|
372
372
|
if (r.also)
|
|
373
373
|
lines.push(` ${r.also}`);
|
|
374
374
|
if (r.verdict === 'worse' && c.advice.lane === 'settings')
|
|
375
375
|
lines.push(` Put it back: chompyy undo ${c.id}`);
|
|
376
376
|
}
|
|
377
|
+
if (!opts.all && shown.length > 5)
|
|
378
|
+
lines.push(` …and ${shown.length - 5} more: chompyy worked --all`);
|
|
377
379
|
const recount = cards.map((c) => c.advice.result).filter((r) => r?.method === 'recount' && r.per === 'session start' && r.saved !== undefined && r.verdict !== 'cant-tell');
|
|
378
380
|
const weekly = cards.map((c) => c.advice.result).filter((r) => r?.method === 'before-after' && r.per === 'week' && r.saved !== undefined);
|
|
379
381
|
if (recount.length || weekly.length)
|
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/keeplock.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// One Keep at a time (2026-11-30): Keep merges into the folder that has main open. Three Keeps pressed within
|
|
2
|
+
// 15 seconds (#31, #39, #37) ran at once there; #37's stopped halfway and left that folder mid-merge, with a
|
|
3
|
+
// staged README that would have undone #39. Keeps now wait in line: each takes this lock, and a second one
|
|
4
|
+
// waits for the first to finish instead of merging alongside it.
|
|
5
|
+
import { closeSync, openSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
6
|
+
import { homePath } from './home.js';
|
|
7
|
+
/** How long a Keep waits for the one ahead of it. Keeps take seconds; this only catches a stuck one. */
|
|
8
|
+
export const KEEP_WAIT_MS = 3 * 60_000;
|
|
9
|
+
const sleep = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
10
|
+
const alive = (pid) => {
|
|
11
|
+
if (!pid)
|
|
12
|
+
return false;
|
|
13
|
+
try {
|
|
14
|
+
process.kill(pid, 0);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
// EPERM: it exists, it just isn't ours.
|
|
19
|
+
return e.code === 'EPERM';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/** Held by this process already (refresh keeps a card from inside its own Keep): don't wait on yourself. */
|
|
23
|
+
let depth = 0;
|
|
24
|
+
/** Run `fn` holding the Keep lock, waiting up to `waitMs` for another Keep to finish. A dead holder's lock is taken over. */
|
|
25
|
+
export function withKeepLock(fn, opts = {}) {
|
|
26
|
+
if (depth > 0) {
|
|
27
|
+
depth++;
|
|
28
|
+
try {
|
|
29
|
+
return fn();
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
depth--;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const lock = opts.lock ?? homePath('keep.lock');
|
|
36
|
+
const until = Date.now() + (opts.waitMs ?? KEEP_WAIT_MS);
|
|
37
|
+
let fd;
|
|
38
|
+
while (fd === undefined) {
|
|
39
|
+
try {
|
|
40
|
+
fd = openSync(lock, 'wx');
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
let holder = 0;
|
|
44
|
+
let age = 0;
|
|
45
|
+
try {
|
|
46
|
+
holder = Number(readFileSync(lock, 'utf8')) || 0;
|
|
47
|
+
age = Date.now() - statSync(lock).mtimeMs;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
continue; // released between the two calls
|
|
51
|
+
}
|
|
52
|
+
// A dead holder, or one that never wrote its pid (it writes right after taking the lock): take it over.
|
|
53
|
+
if (holder ? !alive(holder) : age > 5_000) {
|
|
54
|
+
rmSync(lock, { force: true });
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (Date.now() > until)
|
|
58
|
+
throw new Error(`Another Keep is still running after ${Math.round((opts.waitMs ?? KEEP_WAIT_MS) / 60_000)} min, so this one stopped. Press Keep again once it finishes.`);
|
|
59
|
+
sleep(opts.poll ?? 200);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
writeFileSync(fd, String(process.pid));
|
|
64
|
+
depth++;
|
|
65
|
+
return fn();
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
depth--;
|
|
69
|
+
closeSync(fd);
|
|
70
|
+
rmSync(lock, { force: true });
|
|
71
|
+
}
|
|
72
|
+
}
|
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));
|