chompyy 0.4.6 → 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 +14 -13
- package/dist/appstate.js +2 -1
- package/dist/board.js +4 -0
- package/dist/cli.js +29 -13
- package/dist/deps.js +3 -2
- package/dist/dream.js +2 -1
- package/dist/exe.js +34 -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 +140 -86
- 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/dist/verify.js
CHANGED
|
@@ -117,13 +117,16 @@ export async function verifyRun(opts) {
|
|
|
117
117
|
rmSync(linked);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
+
// Enough for a whole test run: the names of failing tests are read from it, and a 20k tail cut off the first
|
|
121
|
+
// failures of a run with a dozen (each prints its stack), so they looked new on the card (2026-11-30).
|
|
122
|
+
const MAX_OUTPUT = 2_000_000;
|
|
120
123
|
export function run(argv, cwd, env, timeoutMs) {
|
|
121
124
|
return new Promise((resolve, reject) => {
|
|
122
125
|
const child = spawn(argv[0], argv.slice(1), { cwd, env, stdio: ['ignore', 'pipe', 'pipe'], detached: true });
|
|
123
126
|
let output = '';
|
|
124
127
|
let timedOut = false;
|
|
125
128
|
const add = (d) => {
|
|
126
|
-
output = (output + d.toString()).slice(-
|
|
129
|
+
output = (output + d.toString()).slice(-MAX_OUTPUT);
|
|
127
130
|
};
|
|
128
131
|
child.stdout.on('data', add);
|
|
129
132
|
child.stderr.on('data', add);
|
package/dist/verifycard.js
CHANGED
|
@@ -6,15 +6,22 @@
|
|
|
6
6
|
// fails on both, same failing tests → not the card: main fails the same way
|
|
7
7
|
// fails on both, new failing tests on the card → the card broke those tests
|
|
8
8
|
// Main's results are cached per commit, so cards that started from the same main share one run.
|
|
9
|
+
//
|
|
10
|
+
// Confirm alone (2026-11-30): on a busy Mac the full run times out a different handful of slow tests every time,
|
|
11
|
+
// so comparing failing names blamed four cards in a row for tests they never touched (main failed 11 of its own).
|
|
12
|
+
// When the output names every failure and the runner can run single tests (vitest), Chompyy instead re-runs just
|
|
13
|
+
// the failing tests on their own: on the card, then the ones still failing on main. A test is the card's fault only
|
|
14
|
+
// if it fails alone on the card and passes alone on main. This replaces both full re-runs, so it's faster too.
|
|
9
15
|
import { execFileSync } from 'node:child_process';
|
|
10
16
|
import { createHash } from 'node:crypto';
|
|
11
|
-
import { existsSync, rmSync } from 'node:fs';
|
|
17
|
+
import { existsSync, readFileSync, rmSync } from 'node:fs';
|
|
12
18
|
import { basename, join } from 'node:path';
|
|
13
19
|
import { cacheEnv } from './away.js';
|
|
14
20
|
import { setupDependencies } from './deps.js';
|
|
15
21
|
import { homePath, readJson, writeJson } from './home.js';
|
|
16
22
|
import { detectChecks } from './preflight.js';
|
|
17
23
|
import { run as runCmd, sandboxProfile } from './verify.js';
|
|
24
|
+
import { exe } from './exe.js';
|
|
18
25
|
/** Names of failing tests in common test runners' output (vitest/jest, go test, pytest, XCTest, cargo). */
|
|
19
26
|
export function failingTests(output) {
|
|
20
27
|
const clean = output.replace(/\u001b\[[0-9;]*[A-Za-z]/g, '');
|
|
@@ -35,40 +42,88 @@ export function failingTests(output) {
|
|
|
35
42
|
const all = [...names];
|
|
36
43
|
return all.filter((n) => !all.some((m) => m !== n && m.endsWith(` > ${n}`))).sort();
|
|
37
44
|
}
|
|
38
|
-
const
|
|
45
|
+
const plain = (t) => t.replace(/\u001b\[[0-9;]*[A-Za-z]/g, '');
|
|
46
|
+
const lastMatch = (t, re) => [...t.matchAll(re)].at(-1)?.[1] ?? null;
|
|
47
|
+
const count = (line, word) => Number(line?.match(new RegExp(`(\\d+) ${word}`))?.[1] ?? 0);
|
|
48
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
49
|
+
/** "test/a.test.ts > suite > name" → its file, or null for a name without one. */
|
|
50
|
+
const fileOf = (name) => (/^\S+\.(?:test|spec)\.[jt]sx? > /.test(name) ? name.slice(0, name.indexOf(' > ')) : null);
|
|
51
|
+
/** vitest's summary lines: "Tests 2 failed | 24 passed (26)", "Test Files 1 failed | 1 passed (2)", "Errors 1 error". */
|
|
52
|
+
function vitestSummary(output) {
|
|
53
|
+
const o = plain(output);
|
|
54
|
+
const tests = lastMatch(o, /^\s*Tests\s+(.+)$/gm);
|
|
55
|
+
if (!tests)
|
|
56
|
+
return null;
|
|
57
|
+
const files = lastMatch(o, /^\s*Test Files\s+(.+)$/gm);
|
|
58
|
+
return { passed: count(tests, 'passed'), failed: count(tests, 'failed'), filesFailed: count(files, 'failed'), errors: count(lastMatch(o, /^\s*Errors\s+(.+)$/gm), 'errors?') };
|
|
59
|
+
}
|
|
60
|
+
/** For a check whose test script runs vitest; null for any other runner (those keep the full re-run). */
|
|
61
|
+
export function vitestRerun(check, repoDir) {
|
|
62
|
+
let script = '';
|
|
63
|
+
try {
|
|
64
|
+
script = JSON.parse(readFileSync(join(repoDir, check.dir, 'package.json'), 'utf8')).scripts?.test ?? '';
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
if (check.kind !== 'test' || !/\bvitest\b/.test(script))
|
|
68
|
+
return null;
|
|
69
|
+
return {
|
|
70
|
+
argv(names) {
|
|
71
|
+
const files = [...new Set(names.map((n) => fileOf(n)))];
|
|
72
|
+
// vitest's -t is a regex on the suite and test names joined by spaces.
|
|
73
|
+
const tests = names.map((n) => n.slice(n.indexOf(' > ') + 3).split(' > ').map(escapeRe).join(' '));
|
|
74
|
+
const extra = [...files, '-t', `^(?:${tests.join('|')})$`];
|
|
75
|
+
return check.argv[0] === 'npm' ? [...check.argv, '--', ...extra] : [...check.argv, ...extra];
|
|
76
|
+
},
|
|
77
|
+
ran(output) {
|
|
78
|
+
const s = vitestSummary(output);
|
|
79
|
+
return s ? s.passed + s.failed : null;
|
|
80
|
+
},
|
|
81
|
+
complete(output, names) {
|
|
82
|
+
const s = vitestSummary(output);
|
|
83
|
+
if (!s || !names.length || names.some((n) => !fileOf(n)))
|
|
84
|
+
return false;
|
|
85
|
+
// A test file that failed to load fails without naming a test; any other unhandled error could be the card's.
|
|
86
|
+
// vitest's own worker timeouts ("Timeout calling onTaskUpdate", a blocked worker on a busy Mac) are neither.
|
|
87
|
+
const timeouts = plain(output).match(/^\s*\w*Error: \[(?:vitest-[a-z]+|birpc)\]:? [Tt]imeout (?:on )?calling/gm)?.length ?? 0;
|
|
88
|
+
return names.length >= s.failed && new Set(names.map(fileOf)).size >= s.filesFailed && s.errors <= timeouts;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const tail = (t) => plain(t).trimEnd().split('\n').slice(-12).join('\n').slice(-1500);
|
|
39
93
|
const key = (c) => `${c.dir}::${c.label}`;
|
|
40
94
|
function baselinePath(root, commit) {
|
|
41
95
|
const repo = `${basename(root)}-${createHash('sha256').update(root).digest('hex').slice(0, 8)}`;
|
|
42
96
|
return homePath('baselines', repo, `${commit}.json`);
|
|
43
97
|
}
|
|
98
|
+
const checkEnv = (opts) => ({ ...process.env, ...cacheEnv(opts.cacheDir), CI: '1', NO_COLOR: '1', FORCE_COLOR: '0' });
|
|
44
99
|
async function runChecks(checks, dir, opts, exec) {
|
|
45
|
-
const env =
|
|
100
|
+
const env = checkEnv(opts);
|
|
46
101
|
const out = {};
|
|
47
102
|
const once = (c) => exec(c.argv, join(dir, c.dir), env, opts.timeoutMs, [dir, opts.cacheDir]).catch((err) => ({ code: null, output: String(err), timedOut: false }));
|
|
48
103
|
for (const c of checks) {
|
|
49
104
|
let r = await once(c);
|
|
50
105
|
let flaky = false;
|
|
106
|
+
const failed = (x) => x.code !== 0 || x.timedOut;
|
|
107
|
+
const named = failed(r) && !r.timedOut ? vitestRerun(c, dir) : null;
|
|
108
|
+
const rerun = named?.complete(r.output, failingTests(r.output)) ? named : undefined;
|
|
51
109
|
// A failure gets one retry: passing the second time means flaky (slow tests on a busy Mac), not broken.
|
|
52
|
-
|
|
110
|
+
// Not when every failing test is named and can be re-run alone: verifyCard does that, test by test.
|
|
111
|
+
if (failed(r) && !rerun) {
|
|
53
112
|
const again = await once(c);
|
|
54
|
-
if (
|
|
113
|
+
if (!failed(again))
|
|
55
114
|
flaky = true;
|
|
56
|
-
r = again
|
|
115
|
+
r = failed(again) ? r : again;
|
|
57
116
|
}
|
|
58
|
-
const passed =
|
|
59
|
-
out[key(c)] = { result: passed ? 'passed' : 'failed', failures: passed ? [] : failingTests(r.output), output: r.timedOut ? `${r.output}\n(timed out)` : r.output, ...(flaky ? { flaky } : {}) };
|
|
117
|
+
const passed = !failed(r);
|
|
118
|
+
out[key(c)] = { result: passed ? 'passed' : 'failed', failures: passed ? [] : failingTests(r.output), output: r.timedOut ? `${r.output}\n(timed out)` : r.output, ...(flaky ? { flaky } : {}), ...(!passed && rerun ? { rerun } : {}) };
|
|
60
119
|
}
|
|
61
120
|
return out;
|
|
62
121
|
}
|
|
63
|
-
/**
|
|
64
|
-
async function
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
if (cached && !missing.length)
|
|
69
|
-
return cached;
|
|
70
|
-
const dir = homePath('baseline-copy', basename(path, '.json'));
|
|
71
|
-
const git = (args) => execFileSync('git', ['-C', opts.root, ...args], { stdio: 'ignore' });
|
|
122
|
+
/** A clean copy of the card's main, with dependencies, for the length of `fn`. */
|
|
123
|
+
async function onMainCopy(opts, fn) {
|
|
124
|
+
const name = basename(baselinePath(opts.root, opts.baseCommit), '.json');
|
|
125
|
+
const dir = homePath('baseline-copy', name);
|
|
126
|
+
const git = (args) => execFileSync(exe('git'), ['-C', opts.root, ...args], { stdio: 'ignore' });
|
|
72
127
|
try {
|
|
73
128
|
git(['worktree', 'remove', '--force', dir]);
|
|
74
129
|
}
|
|
@@ -76,14 +131,8 @@ async function baseline(checks, opts, exec) {
|
|
|
76
131
|
rmSync(dir, { recursive: true, force: true });
|
|
77
132
|
git(['worktree', 'add', '--detach', '--quiet', dir, opts.baseCommit]);
|
|
78
133
|
try {
|
|
79
|
-
setupDependencies(opts.root, dir,
|
|
80
|
-
|
|
81
|
-
const results = { ...(cached?.results ?? {}) };
|
|
82
|
-
for (const [k, v] of Object.entries(ran))
|
|
83
|
-
results[k] = { result: v.result, failures: v.failures };
|
|
84
|
-
const b = { commit: opts.baseCommit, at: (opts.now ?? (() => new Date()))().toISOString(), results };
|
|
85
|
-
writeJson(path, b);
|
|
86
|
-
return b;
|
|
134
|
+
setupDependencies(opts.root, dir, name, { env: cacheEnv(opts.cacheDir) });
|
|
135
|
+
return await fn(dir);
|
|
87
136
|
}
|
|
88
137
|
finally {
|
|
89
138
|
try {
|
|
@@ -93,10 +142,36 @@ async function baseline(checks, opts, exec) {
|
|
|
93
142
|
rmSync(dir, { recursive: true, force: true });
|
|
94
143
|
}
|
|
95
144
|
}
|
|
96
|
-
/**
|
|
97
|
-
function
|
|
98
|
-
|
|
145
|
+
/** Main's results for these checks at `commit`: from the cache, else run once on a clean copy and cached. */
|
|
146
|
+
async function baseline(checks, opts, exec) {
|
|
147
|
+
const path = baselinePath(opts.root, opts.baseCommit);
|
|
148
|
+
const cached = readJson(path, null);
|
|
149
|
+
const missing = checks.filter((c) => !cached?.results[key(c)]);
|
|
150
|
+
if (cached && !missing.length)
|
|
151
|
+
return cached;
|
|
152
|
+
return onMainCopy(opts, async (dir) => {
|
|
153
|
+
const ran = await runChecks(missing, dir, opts, exec);
|
|
154
|
+
const results = { ...(cached?.results ?? {}) };
|
|
155
|
+
for (const [k, v] of Object.entries(ran))
|
|
156
|
+
results[k] = { result: v.result, failures: v.failures };
|
|
157
|
+
const b = { commit: opts.baseCommit, at: (opts.now ?? (() => new Date()))().toISOString(), results };
|
|
158
|
+
writeJson(path, b);
|
|
159
|
+
return b;
|
|
160
|
+
});
|
|
99
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Run just `names` on their own in `dir`; the ones that still fail. Null when the run doesn't show they ran
|
|
164
|
+
* (nothing matched, it timed out, or it failed without naming them); the caller then compares with main's full run.
|
|
165
|
+
*/
|
|
166
|
+
async function failingAlone(c, rerun, names, dir, opts, exec) {
|
|
167
|
+
const r = await exec(rerun.argv(names), join(dir, c.dir), checkEnv(opts), opts.timeoutMs, [dir, opts.cacheDir]).catch(() => null);
|
|
168
|
+
if (!r || r.timedOut || (rerun.ran(r.output) ?? 0) < names.length)
|
|
169
|
+
return null;
|
|
170
|
+
const asked = new Set(names);
|
|
171
|
+
const failing = failingTests(r.output).filter((f) => asked.has(f));
|
|
172
|
+
return (r.code === 0) === (failing.length === 0) ? failing : null;
|
|
173
|
+
}
|
|
174
|
+
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
100
175
|
/** Run the repo's checks on the card and on its main; report only what the card made worse. Never throws. */
|
|
101
176
|
export async function verifyCard(opts) {
|
|
102
177
|
const at = (opts.now ?? (() => new Date()))().toISOString();
|
|
@@ -109,38 +184,83 @@ export async function verifyCard(opts) {
|
|
|
109
184
|
return { result: 'not run', why: 'no checks found in the repo (tests, typecheck or build)', at };
|
|
110
185
|
try {
|
|
111
186
|
const onCard = await runChecks(checks, opts.dir, opts, exec);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const main =
|
|
115
|
-
const outcomes =
|
|
187
|
+
// Main's full run only for failures that can't be confirmed test by test; a clean card needs no comparison.
|
|
188
|
+
const compare = checks.filter((c) => onCard[key(c)].result === 'failed' && !onCard[key(c)].rerun);
|
|
189
|
+
const main = compare.length ? await baseline(compare, opts, exec) : null;
|
|
190
|
+
const outcomes = [];
|
|
191
|
+
for (const c of checks) {
|
|
116
192
|
const mine = onCard[key(c)];
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
193
|
+
if (mine.result === 'passed') {
|
|
194
|
+
outcomes.push({ label: c.label, dir: c.dir, card: 'passed', main: main?.results[key(c)]?.result ?? 'unknown', newFailures: [], verdict: 'ok', ...(mine.flaky ? { flaky: true } : {}) });
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (!mine.rerun) {
|
|
198
|
+
outcomes.push(compareFull(c, mine, mine.failures, main?.results[key(c)]));
|
|
199
|
+
continue;
|
|
122
200
|
}
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
201
|
+
const alone = await confirmAlone(c, mine, mine.rerun, opts, exec);
|
|
202
|
+
if ('verdict' in alone) {
|
|
203
|
+
outcomes.push(alone);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
// Re-running alone couldn't tell: compare the tests still in question with main's full run.
|
|
207
|
+
const theirs = (await baseline([c], opts, exec)).results[key(c)];
|
|
208
|
+
outcomes.push(compareFull(c, mine, alone.unclear, theirs, alone.passedAlone.length ? { passedAlone: alone.passedAlone } : {}));
|
|
209
|
+
}
|
|
129
210
|
const broke = outcomes.filter((o) => o.verdict === 'broke');
|
|
130
211
|
const same = outcomes.filter((o) => o.verdict === 'same-as-main');
|
|
131
212
|
const names = (o) => `${o.dir ? `${o.dir}: ` : ''}${o.label.split(' --')[0]}`;
|
|
132
213
|
if (broke.length) {
|
|
133
214
|
const detail = broke.map((o) => `${names(o)}${o.newFailures.length ? ` (${o.newFailures.slice(0, 3).join('; ')}${o.newFailures.length > 3 ? ` and ${o.newFailures.length - 3} more` : ''})` : ''}`).join(', ');
|
|
134
|
-
|
|
215
|
+
const proof = broke.every((o) => o.confirmed)
|
|
216
|
+
? 'they fail when run alone too, and pass on main'
|
|
217
|
+
: broke.every((o) => o.main === 'passed')
|
|
218
|
+
? 'it passes on main'
|
|
219
|
+
: "they don't fail on main";
|
|
220
|
+
return { result: 'failed', command: broke.map(names).join(', '), why: `this change broke ${detail}; ${proof}`, at, tail: broke[0].tail, outcomes };
|
|
135
221
|
}
|
|
136
222
|
const okList = outcomes.filter((o) => o.verdict === 'ok').map((o) => `${names(o)}${o.flaky ? ' (flaky: failed once, passed on retry)' : ''}`);
|
|
137
|
-
const unnamed = same.some((o) =>
|
|
223
|
+
const unnamed = same.some((o) => o.unnamed);
|
|
224
|
+
const slow = outcomes.flatMap((o) => o.passedAlone ?? []).length;
|
|
225
|
+
const slowNote = slow ? `; ${plural(slow, 'test', 'tests')} failed only in the full run and ${slow === 1 ? 'passes on its' : 'pass on their'} own (slow, not broken)` : '';
|
|
138
226
|
const why = same.length
|
|
139
227
|
? `${okList.length ? `${okList.join(', ')} pass` : 'nothing new fails'}; ${same.map(names).join(', ')} fail${same.length === 1 ? 's' : ''} the same way on main, so not because of this change${unnamed ? " (its output doesn't name tests, so this compares pass/fail only)" : ''}`
|
|
140
228
|
: `${okList.join(', ')} pass`;
|
|
141
|
-
return { result: 'passed', command: outcomes.map(names).join(', '), why, at, outcomes };
|
|
229
|
+
return { result: 'passed', command: outcomes.map(names).join(', '), why: why + slowNote, at, outcomes };
|
|
142
230
|
}
|
|
143
231
|
catch (err) {
|
|
144
232
|
return { result: 'not run', why: `couldn't run the checks: ${err instanceof Error ? err.message : err}`, at };
|
|
145
233
|
}
|
|
146
234
|
}
|
|
235
|
+
/** Card vs main's full run, by failing test names: what the card fails that main doesn't. */
|
|
236
|
+
function compareFull(c, mine, failures, theirs, extra = {}) {
|
|
237
|
+
// Until 2026-11-30 this was read from the 12-line tail, which never holds names: every same-as-main card said it.
|
|
238
|
+
const base = { label: c.label, dir: c.dir, card: 'failed', tail: tail(mine.output), ...(mine.failures.length ? {} : { unnamed: true }), ...extra };
|
|
239
|
+
if (!theirs || theirs.result === 'passed')
|
|
240
|
+
return { ...base, main: theirs?.result ?? 'unknown', newFailures: failures, verdict: 'broke' };
|
|
241
|
+
const known = new Set(theirs.failures);
|
|
242
|
+
const fresh = failures.filter((f) => !known.has(f));
|
|
243
|
+
// Both fail. New failing tests on the card → the card broke them; otherwise main fails the same way.
|
|
244
|
+
return { ...base, main: 'failed', newFailures: fresh, verdict: fresh.length ? 'broke' : 'same-as-main' };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The card's failing tests, re-run on their own: on the card, then the ones still failing on main. Only a test
|
|
248
|
+
* that fails alone on the card and passes alone on main is the card's fault. When a re-run can't tell, it hands
|
|
249
|
+
* back the tests still in question for the full comparison.
|
|
250
|
+
*/
|
|
251
|
+
async function confirmAlone(c, mine, rerun, opts, exec) {
|
|
252
|
+
const onCard = await failingAlone(c, rerun, mine.failures, opts.dir, opts, exec);
|
|
253
|
+
if (!onCard)
|
|
254
|
+
return { unclear: mine.failures, passedAlone: [] };
|
|
255
|
+
const passedAlone = mine.failures.filter((f) => !onCard.includes(f));
|
|
256
|
+
const base = { label: c.label, dir: c.dir, card: 'failed', tail: tail(mine.output), ...(passedAlone.length ? { passedAlone } : {}) };
|
|
257
|
+
if (!onCard.length)
|
|
258
|
+
return { ...base, main: 'unknown', newFailures: [], verdict: 'ok' };
|
|
259
|
+
const onMain = await onMainCopy(opts, (dir) => failingAlone(c, rerun, onCard, dir, opts, exec));
|
|
260
|
+
if (!onMain)
|
|
261
|
+
return { unclear: onCard, passedAlone };
|
|
262
|
+
const broke = onCard.filter((f) => !onMain.includes(f));
|
|
263
|
+
if (broke.length)
|
|
264
|
+
return { ...base, main: onMain.length ? 'failed' : 'passed', newFailures: broke, verdict: 'broke', confirmed: true };
|
|
265
|
+
return { ...base, main: 'failed', newFailures: [], verdict: 'same-as-main' };
|
|
266
|
+
}
|
package/dist/workspace.js
CHANGED
|
@@ -5,8 +5,9 @@ import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSy
|
|
|
5
5
|
import { basename, dirname, join, resolve } from 'node:path';
|
|
6
6
|
import { setupDependencies } from './deps.js';
|
|
7
7
|
import { homePath } from './home.js';
|
|
8
|
+
import { exe } from './exe.js';
|
|
8
9
|
function git(cwd, args) {
|
|
9
|
-
return execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
10
|
+
return execFileSync(exe('git'), ['-C', cwd, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
10
11
|
}
|
|
11
12
|
const tryGit = (cwd, args) => {
|
|
12
13
|
try {
|
|
@@ -175,7 +176,7 @@ function neverCommit(f) {
|
|
|
175
176
|
}
|
|
176
177
|
/** Every changed or new (not ignored) file in a folder, exact paths (NUL-separated, so spaces and quotes are safe). */
|
|
177
178
|
function changedPaths(dir) {
|
|
178
|
-
const out = execFileSync('git', ['-C', dir, 'status', '--porcelain', '-z', '--untracked-files=all'], { encoding: 'utf8' });
|
|
179
|
+
const out = execFileSync(exe('git'), ['-C', dir, 'status', '--porcelain', '-z', '--untracked-files=all'], { encoding: 'utf8' });
|
|
179
180
|
const parts = out.split('\0').filter(Boolean);
|
|
180
181
|
const paths = [];
|
|
181
182
|
for (let i = 0; i < parts.length; i++) {
|
package/package.json
CHANGED