burnoff 1.4.1 → 2.1.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/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/burnoff-pr-gate.yml +5 -3
- package/.github/workflows/burnoff-startup-lint.yml +2 -2
- package/CHANGELOG.md +74 -0
- package/README.md +187 -213
- package/SECURITY.md +38 -0
- package/bin/burnoff.mjs +307 -32
- package/commands/burnoff.md +6 -4
- package/docs/CLAUDE_CODE_PLUGIN.md +29 -28
- package/docs/DESIGN_PARTNER_INTAKE.md +3 -3
- package/hooks/hook-io.mjs +216 -11
- package/hooks/hooks.json +44 -0
- package/hooks/post-tool-use.mjs +3 -1
- package/hooks/pre-tool-use.mjs +47 -8
- package/hooks/session-lifecycle.mjs +24 -3
- package/hooks/user-prompt-submit.mjs +98 -0
- package/package.json +6 -4
- package/scripts/bench-hooks.mjs +34 -3
- package/scripts/bench-savings.mjs +318 -0
- package/scripts/burnoff-statusline.mjs +138 -6
- package/src/ci/ci-gate.mjs +199 -13
- package/src/ci/pr-cost.mjs +417 -45
- package/src/ci/pr-summary.mjs +467 -0
- package/src/cli/audit.mjs +179 -28
- package/src/cli/doctor.mjs +32 -6
- package/src/cli/hook-health.mjs +9 -1
- package/src/cli/init.mjs +226 -39
- package/src/cli/preview.mjs +299 -0
- package/src/cli/startup-audit/formatter.mjs +248 -0
- package/src/cli/startup-audit/jsonc.mjs +601 -0
- package/src/cli/startup-audit/mcp-audit.mjs +735 -0
- package/src/cli/startup-audit/rules-hygiene.mjs +645 -0
- package/src/cli/startup-audit/telemetry-scan.mjs +975 -0
- package/src/cli/startup-audit.mjs +451 -2471
- package/src/clients/claude-code.mjs +41 -4
- package/src/config/catalog.json +295 -0
- package/src/config/effort.mjs +145 -0
- package/src/config/harness-quirks.mjs +340 -0
- package/src/config/loader.mjs +27 -2
- package/src/config/policy.mjs +81 -9
- package/src/config/pricing.mjs +247 -19
- package/src/config/semver.mjs +25 -0
- package/src/config/uncached-attribution.mjs +280 -41
- package/src/guards/compaction-baton.mjs +248 -0
- package/src/guards/loop-breaker.mjs +328 -47
- package/src/guards/model-switch-hook.mjs +126 -0
- package/src/guards/phase5-detectors.mjs +275 -21
- package/src/guards/post-tool-engine.mjs +333 -11
- package/src/guards/pre-tool-engine.mjs +607 -45
- package/src/guards/prefix-guard.mjs +609 -0
- package/src/guards/prompt-guard.mjs +309 -0
- package/src/guards/read-clamp.mjs +192 -8
- package/src/guards/session-hook.mjs +149 -7
- package/src/guards/shell-guard.mjs +56 -5
- package/src/guards/snooze.mjs +169 -5
- package/src/ipc/daemon.mjs +76 -0
- package/src/ipc/fast-client.mjs +165 -4
- package/src/ipc/protocol.mjs +16 -3
- package/src/storage/antigravity-parser.mjs +16 -2
- package/src/storage/file-lock.mjs +16 -3
- package/src/storage/jsonl-parser.mjs +133 -22
- package/src/storage/telemetry-metrics.mjs +254 -4
package/src/cli/init.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import fs from 'node:fs';
|
|
9
|
+
import os from 'node:os';
|
|
9
10
|
import path from 'node:path';
|
|
10
11
|
import { fileURLToPath } from 'node:url';
|
|
11
12
|
import { getHomeDir } from '../config/paths.mjs';
|
|
@@ -50,8 +51,14 @@ function isBurnoffCommand(command = '') {
|
|
|
50
51
|
const cmd = String(command || '').replace(/\\/g, '/');
|
|
51
52
|
if (!cmd) return false;
|
|
52
53
|
if (/\.claude\/burnoff-hook-shim\.mjs/i.test(cmd)) return true;
|
|
54
|
+
if (
|
|
55
|
+
/(?:^|[/"'\s])scripts\/burnoff-statusline\.mjs(?:["'\s]|$)/i.test(cmd) &&
|
|
56
|
+
(/burnoff/i.test(cmd) || cmd.includes(normalizeCommandPath(path.join(PACKAGE_ROOT, 'scripts'))))
|
|
57
|
+
) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
53
60
|
return (
|
|
54
|
-
/(?:^|[/"'\s])hooks\/(?:(?:pre|post)-tool-use|session-lifecycle)\.mjs(?:["'\s]|$)/i.test(cmd) &&
|
|
61
|
+
/(?:^|[/"'\s])hooks\/(?:(?:pre|post)-tool-use|session-lifecycle|user-prompt-submit)\.mjs(?:["'\s]|$)/i.test(cmd) &&
|
|
55
62
|
(/burnoff/i.test(cmd) ||
|
|
56
63
|
cmd.includes(normalizeCommandPath(path.join(PACKAGE_ROOT, 'hooks'))))
|
|
57
64
|
);
|
|
@@ -140,31 +147,33 @@ import { createRequire } from 'node:module';
|
|
|
140
147
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
141
148
|
|
|
142
149
|
const hookArgMap = {
|
|
143
|
-
post: 'post-tool-use.mjs',
|
|
144
|
-
session: 'session-lifecycle.mjs',
|
|
145
|
-
|
|
150
|
+
post: ['hooks', 'post-tool-use.mjs'],
|
|
151
|
+
session: ['hooks', 'session-lifecycle.mjs'],
|
|
152
|
+
prompt: ['hooks', 'user-prompt-submit.mjs'],
|
|
153
|
+
statusline: ['scripts', 'burnoff-statusline.mjs'],
|
|
154
|
+
pre: ['hooks', 'pre-tool-use.mjs']
|
|
146
155
|
};
|
|
147
|
-
const
|
|
156
|
+
const targetParts = hookArgMap[process.argv[2]] || hookArgMap.pre;
|
|
148
157
|
const cwd = process.cwd();
|
|
149
158
|
const parentDir = path.dirname(cwd);
|
|
150
159
|
const shimDir = path.dirname(fileURLToPath(import.meta.url));
|
|
151
160
|
const candidates = [
|
|
152
|
-
path.join(cwd, 'node_modules', 'burnoff',
|
|
153
|
-
path.join(parentDir, 'node_modules', 'burnoff',
|
|
154
|
-
path.join(shimDir, '..', 'node_modules', 'burnoff',
|
|
161
|
+
path.join(cwd, 'node_modules', 'burnoff', ...targetParts),
|
|
162
|
+
path.join(parentDir, 'node_modules', 'burnoff', ...targetParts),
|
|
163
|
+
path.join(shimDir, '..', 'node_modules', 'burnoff', ...targetParts)
|
|
155
164
|
];
|
|
156
165
|
|
|
157
166
|
for (const baseDir of [cwd, parentDir, path.join(shimDir, '..')]) {
|
|
158
167
|
try {
|
|
159
168
|
const req = createRequire(path.join(baseDir, 'package.json'));
|
|
160
169
|
const pkgPath = req.resolve('burnoff/package.json');
|
|
161
|
-
candidates.push(path.join(path.dirname(pkgPath),
|
|
170
|
+
candidates.push(path.join(path.dirname(pkgPath), ...targetParts));
|
|
162
171
|
} catch {
|
|
163
172
|
// ignore: local/global resolution miss falls back to bundled path
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
|
|
167
|
-
candidates.push(path.join(${JSON.stringify(fallback)},
|
|
176
|
+
candidates.push(path.join(${JSON.stringify(fallback)}, ...targetParts));
|
|
168
177
|
|
|
169
178
|
const resolved = candidates.find((p) => {
|
|
170
179
|
try {
|
|
@@ -181,13 +190,27 @@ if (!resolved) {
|
|
|
181
190
|
process.exit(0);
|
|
182
191
|
}
|
|
183
192
|
|
|
193
|
+
// Hooks gate their CLI entrypoint on argv[1]; publish the real hook path so the dynamic import runs it.
|
|
194
|
+
process.env.BURNOFF_SHIM_TARGET = resolved;
|
|
184
195
|
await import(pathToFileURL(resolved).href);
|
|
185
196
|
`;
|
|
186
197
|
}
|
|
187
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Builds the Claude Code `"statusLine"` shell command pointing to Burnoff's
|
|
201
|
+
* zero-dependency status-line script (or hook shim when installed from npx).
|
|
202
|
+
*/
|
|
203
|
+
export function buildBurnoffStatuslineCommand({ packageRoot = PACKAGE_ROOT, shimPath = null } = {}) {
|
|
204
|
+
if (shimPath) {
|
|
205
|
+
return `node "${normalizeCommandPath(shimPath)}" statusline`;
|
|
206
|
+
}
|
|
207
|
+
const root = path.resolve(packageRoot || PACKAGE_ROOT);
|
|
208
|
+
return `node "${normalizeCommandPath(path.join(root, 'scripts', 'burnoff-statusline.mjs'))}"`;
|
|
209
|
+
}
|
|
210
|
+
|
|
188
211
|
/**
|
|
189
212
|
* Builds Claude Code `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `SessionStart`,
|
|
190
|
-
* and `
|
|
213
|
+
* `PreCompact`, and `UserPromptSubmit` hook definitions pointing to Burnoff's fast-shell hooks.
|
|
191
214
|
*/
|
|
192
215
|
export function buildClaudeHooksConfig(options = {}) {
|
|
193
216
|
const root = path.resolve(options.packageRoot || PACKAGE_ROOT);
|
|
@@ -200,6 +223,9 @@ export function buildClaudeHooksConfig(options = {}) {
|
|
|
200
223
|
const sessionCmd = options.shimPath
|
|
201
224
|
? `node "${normalizeCommandPath(options.shimPath)}" session`
|
|
202
225
|
: `node "${normalizeCommandPath(path.join(root, 'hooks', 'session-lifecycle.mjs'))}"`;
|
|
226
|
+
const promptCmd = options.shimPath
|
|
227
|
+
? `node "${normalizeCommandPath(options.shimPath)}" prompt`
|
|
228
|
+
: `node "${normalizeCommandPath(path.join(root, 'hooks', 'user-prompt-submit.mjs'))}"`;
|
|
203
229
|
const timeout = Number.isFinite(Number(options.timeout)) ? Number(options.timeout) : 5;
|
|
204
230
|
|
|
205
231
|
return {
|
|
@@ -215,6 +241,17 @@ export function buildClaudeHooksConfig(options = {}) {
|
|
|
215
241
|
]
|
|
216
242
|
}
|
|
217
243
|
],
|
|
244
|
+
PreSkillShellCommand: [
|
|
245
|
+
{
|
|
246
|
+
hooks: [
|
|
247
|
+
{
|
|
248
|
+
type: 'command',
|
|
249
|
+
command: preCmd,
|
|
250
|
+
timeout
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
],
|
|
218
255
|
PostToolUse: [
|
|
219
256
|
{
|
|
220
257
|
matcher: options.postMatcher || POST_TOOL_MATCHER,
|
|
@@ -261,6 +298,39 @@ export function buildClaudeHooksConfig(options = {}) {
|
|
|
261
298
|
}
|
|
262
299
|
]
|
|
263
300
|
}
|
|
301
|
+
],
|
|
302
|
+
PreModelSwitch: [
|
|
303
|
+
{
|
|
304
|
+
hooks: [
|
|
305
|
+
{
|
|
306
|
+
type: 'command',
|
|
307
|
+
command: sessionCmd,
|
|
308
|
+
timeout
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
PostModelSwitch: [
|
|
314
|
+
{
|
|
315
|
+
hooks: [
|
|
316
|
+
{
|
|
317
|
+
type: 'command',
|
|
318
|
+
command: sessionCmd,
|
|
319
|
+
timeout
|
|
320
|
+
}
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
],
|
|
324
|
+
UserPromptSubmit: [
|
|
325
|
+
{
|
|
326
|
+
hooks: [
|
|
327
|
+
{
|
|
328
|
+
type: 'command',
|
|
329
|
+
command: promptCmd,
|
|
330
|
+
timeout
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
}
|
|
264
334
|
]
|
|
265
335
|
};
|
|
266
336
|
}
|
|
@@ -273,7 +343,64 @@ export function hasQuotedAntigravityPath(command = '') {
|
|
|
273
343
|
return /["']/.test(String(command || ''));
|
|
274
344
|
}
|
|
275
345
|
|
|
346
|
+
/** True when a path is safe to embed unquoted in an Antigravity hook command (no whitespace, not an ephemeral mount). */
|
|
347
|
+
function isSpaceFreeCommandPath(filePath) {
|
|
348
|
+
const norm = normalizeCommandPath(filePath);
|
|
349
|
+
return !/\s/.test(norm) && !/^\/(?:sessions|mnt|workspaces?)\//i.test(norm);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Chooses where the Antigravity hook shim lives so the emitted command never contains whitespace.
|
|
354
|
+
* Antigravity splits hook commands on whitespace (no shell) and spawns them from the workspace root,
|
|
355
|
+
* so relative commands are resolved from `cwd`, never from `.agents/`.
|
|
356
|
+
*/
|
|
357
|
+
export function planAntigravityShim({
|
|
358
|
+
useShim = false,
|
|
359
|
+
isGlobal = false,
|
|
360
|
+
cwd,
|
|
361
|
+
homeDir,
|
|
362
|
+
pkgRoot,
|
|
363
|
+
claudeShimPath = null
|
|
364
|
+
} = {}) {
|
|
365
|
+
const warnings = [];
|
|
366
|
+
const hookTargets = ['pre-tool-use.mjs', 'post-tool-use.mjs'].map((f) => path.join(pkgRoot, 'hooks', f));
|
|
367
|
+
const homeShim = path.join(homeDir, '.burnoff', 'bin', 'hook-shim.mjs');
|
|
368
|
+
const cwdShim = path.join(cwd, '.burnoff', 'hook-shim.mjs');
|
|
369
|
+
|
|
370
|
+
if (!useShim && hookTargets.every(isSpaceFreeCommandPath)) {
|
|
371
|
+
return { shimPath: null, relativeShim: null, warnings };
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const preferred = useShim ? claudeShimPath || (isGlobal ? homeShim : cwdShim) : null;
|
|
375
|
+
if (preferred && isSpaceFreeCommandPath(preferred)) {
|
|
376
|
+
return { shimPath: preferred, relativeShim: null, warnings };
|
|
377
|
+
}
|
|
378
|
+
if (isSpaceFreeCommandPath(homeShim)) {
|
|
379
|
+
return { shimPath: homeShim, relativeShim: null, warnings };
|
|
380
|
+
}
|
|
381
|
+
if (!isGlobal) {
|
|
382
|
+
if (isSpaceFreeCommandPath(cwdShim)) {
|
|
383
|
+
return { shimPath: cwdShim, relativeShim: null, warnings };
|
|
384
|
+
}
|
|
385
|
+
return { shimPath: cwdShim, relativeShim: '.burnoff/hook-shim.mjs', warnings };
|
|
386
|
+
}
|
|
387
|
+
const tmpShim = path.join(os.tmpdir(), 'burnoff', 'bin', 'hook-shim.mjs');
|
|
388
|
+
if (isSpaceFreeCommandPath(tmpShim)) {
|
|
389
|
+
warnings.push(
|
|
390
|
+
`Home directory contains whitespace; installed the Antigravity hook shim under ${normalizeCommandPath(tmpShim)} (space-free). Re-run "burnoff init --global" if the OS clears the temp directory.`
|
|
391
|
+
);
|
|
392
|
+
return { shimPath: tmpShim, relativeShim: null, warnings };
|
|
393
|
+
}
|
|
394
|
+
warnings.push(
|
|
395
|
+
'Home directory and temp directory both contain whitespace; Antigravity splits hook commands on whitespace, so the global hook may fail to spawn. Prefer a project-local install (burnoff init --client antigravity).'
|
|
396
|
+
);
|
|
397
|
+
return { shimPath: homeShim, relativeShim: null, warnings };
|
|
398
|
+
}
|
|
399
|
+
|
|
276
400
|
function resolveAntigravityHookCommand(hookFileName, shimArg, options = {}) {
|
|
401
|
+
if (options.relativeShim) {
|
|
402
|
+
return `node ${options.relativeShim} ${shimArg}`;
|
|
403
|
+
}
|
|
277
404
|
const root = path.resolve(options.packageRoot || PACKAGE_ROOT);
|
|
278
405
|
const absTarget = options.shimPath
|
|
279
406
|
? path.resolve(options.shimPath)
|
|
@@ -281,18 +408,16 @@ function resolveAntigravityHookCommand(hookFileName, shimArg, options = {}) {
|
|
|
281
408
|
const suffix = options.shimPath ? ` ${shimArg}` : '';
|
|
282
409
|
const normAbs = normalizeCommandPath(absTarget);
|
|
283
410
|
|
|
284
|
-
if (
|
|
411
|
+
if (isSpaceFreeCommandPath(absTarget)) {
|
|
285
412
|
return `node ${normAbs}${suffix}`;
|
|
286
413
|
}
|
|
287
414
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
const relPath = path.relative(hooksDir, absTarget).replace(/\\/g, '/');
|
|
295
|
-
return `node ${relPath}${suffix}`;
|
|
415
|
+
// Direct callers without a planned shim: Antigravity spawns hooks from the workspace root.
|
|
416
|
+
if (!options.global && options.cwd) {
|
|
417
|
+
const relPath = path.relative(path.resolve(options.cwd), absTarget).replace(/\\/g, '/');
|
|
418
|
+
if (relPath && !/\s/.test(relPath)) return `node ${relPath}${suffix}`;
|
|
419
|
+
}
|
|
420
|
+
return `node ${normAbs}${suffix}`;
|
|
296
421
|
}
|
|
297
422
|
|
|
298
423
|
/**
|
|
@@ -367,11 +492,14 @@ export function initBurnoff(options = {}) {
|
|
|
367
492
|
const installAntigravity = clients.includes('antigravity');
|
|
368
493
|
|
|
369
494
|
const warnings = [];
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
495
|
+
// Global Claude installs live in ~/.claude (settings.json); project installs stay in <cwd>/.claude.
|
|
496
|
+
const claudeDir = isGlobal ? path.join(homeDir, '.claude') : path.join(cwd, '.claude');
|
|
497
|
+
const shimPath = installClaude && useShim ? path.join(claudeDir, 'burnoff-hook-shim.mjs') : null;
|
|
498
|
+
const agPlan = installAntigravity
|
|
499
|
+
? planAntigravityShim({ useShim, isGlobal, cwd, homeDir, pkgRoot, claudeShimPath: shimPath })
|
|
500
|
+
: { shimPath: null, relativeShim: null, warnings: [] };
|
|
501
|
+
const agShimPath = agPlan.shimPath;
|
|
502
|
+
warnings.push(...agPlan.warnings);
|
|
375
503
|
|
|
376
504
|
if (ephemeralNpx) {
|
|
377
505
|
warnings.push(
|
|
@@ -379,8 +507,11 @@ export function initBurnoff(options = {}) {
|
|
|
379
507
|
);
|
|
380
508
|
}
|
|
381
509
|
|
|
382
|
-
|
|
510
|
+
const settingsPath = isGlobal
|
|
511
|
+
? path.join(homeDir, '.claude', 'settings.json')
|
|
512
|
+
: path.join(cwd, '.claude', 'settings.local.json');
|
|
383
513
|
let hooks = null;
|
|
514
|
+
let statusLineWired = false;
|
|
384
515
|
if (installClaude) {
|
|
385
516
|
hooks = buildClaudeHooksConfig({
|
|
386
517
|
...options,
|
|
@@ -395,22 +526,37 @@ export function initBurnoff(options = {}) {
|
|
|
395
526
|
: {};
|
|
396
527
|
|
|
397
528
|
const prevPre = filterOutBurnoffMatcherGroups(existingHooks.PreToolUse);
|
|
529
|
+
const prevPreSkillShell = filterOutBurnoffMatcherGroups(existingHooks.PreSkillShellCommand);
|
|
398
530
|
const prevPost = filterOutBurnoffMatcherGroups(existingHooks.PostToolUse);
|
|
399
531
|
const prevPostFail = filterOutBurnoffMatcherGroups(existingHooks.PostToolUseFailure);
|
|
400
532
|
const prevSessionStart = filterOutBurnoffMatcherGroups(existingHooks.SessionStart);
|
|
401
533
|
const prevPreCompact = filterOutBurnoffMatcherGroups(existingHooks.PreCompact);
|
|
534
|
+
const prevPreModelSwitch = filterOutBurnoffMatcherGroups(existingHooks.PreModelSwitch);
|
|
535
|
+
const prevPostModelSwitch = filterOutBurnoffMatcherGroups(existingHooks.PostModelSwitch);
|
|
536
|
+
const prevUserPrompt = filterOutBurnoffMatcherGroups(existingHooks.UserPromptSubmit);
|
|
402
537
|
|
|
403
538
|
const nextSettings = {
|
|
404
539
|
...current,
|
|
405
540
|
hooks: {
|
|
406
541
|
...existingHooks,
|
|
407
542
|
PreToolUse: [...prevPre, ...hooks.PreToolUse],
|
|
543
|
+
PreSkillShellCommand: [...prevPreSkillShell, ...hooks.PreSkillShellCommand],
|
|
408
544
|
PostToolUse: [...prevPost, ...hooks.PostToolUse],
|
|
409
545
|
PostToolUseFailure: [...prevPostFail, ...hooks.PostToolUseFailure],
|
|
410
546
|
SessionStart: [...prevSessionStart, ...hooks.SessionStart],
|
|
411
|
-
PreCompact: [...prevPreCompact, ...hooks.PreCompact]
|
|
547
|
+
PreCompact: [...prevPreCompact, ...hooks.PreCompact],
|
|
548
|
+
PreModelSwitch: [...prevPreModelSwitch, ...hooks.PreModelSwitch],
|
|
549
|
+
PostModelSwitch: [...prevPostModelSwitch, ...hooks.PostModelSwitch],
|
|
550
|
+
UserPromptSubmit: [...prevUserPrompt, ...hooks.UserPromptSubmit]
|
|
412
551
|
}
|
|
413
552
|
};
|
|
553
|
+
if (!current.statusLine && !options.noStatusline) {
|
|
554
|
+
nextSettings.statusLine = {
|
|
555
|
+
type: 'command',
|
|
556
|
+
command: buildBurnoffStatuslineCommand({ packageRoot: pkgRoot, shimPath })
|
|
557
|
+
};
|
|
558
|
+
statusLineWired = true;
|
|
559
|
+
}
|
|
414
560
|
|
|
415
561
|
if (!dryRun) {
|
|
416
562
|
if (shimPath) {
|
|
@@ -433,7 +579,8 @@ export function initBurnoff(options = {}) {
|
|
|
433
579
|
hooksDir: path.dirname(antigravityHooksPath),
|
|
434
580
|
global: isGlobal,
|
|
435
581
|
packageRoot: pkgRoot,
|
|
436
|
-
...(agShimPath ? { shimPath: agShimPath } : {})
|
|
582
|
+
...(agShimPath ? { shimPath: agShimPath } : {}),
|
|
583
|
+
...(agPlan.relativeShim ? { relativeShim: agPlan.relativeShim } : {})
|
|
437
584
|
});
|
|
438
585
|
|
|
439
586
|
const currentAg = readJsonObjectSafe(antigravityHooksPath);
|
|
@@ -452,7 +599,8 @@ export function initBurnoff(options = {}) {
|
|
|
452
599
|
|
|
453
600
|
let excludePath = null;
|
|
454
601
|
let excludeUpdated = false;
|
|
455
|
-
|
|
602
|
+
// Global installs never touch a project's .git/info/exclude.
|
|
603
|
+
const gitDir = !isGlobal ? resolveGitDir(cwd) : null;
|
|
456
604
|
if (gitDir) {
|
|
457
605
|
excludePath = path.join(gitDir, 'info', 'exclude');
|
|
458
606
|
const prevExclude = fs.existsSync(excludePath) ? fs.readFileSync(excludePath, 'utf8') : '';
|
|
@@ -473,6 +621,7 @@ export function initBurnoff(options = {}) {
|
|
|
473
621
|
clients,
|
|
474
622
|
global: isGlobal,
|
|
475
623
|
settingsPath,
|
|
624
|
+
statusLineWired,
|
|
476
625
|
antigravityHooksPath,
|
|
477
626
|
shimPath: shimPath || agShimPath,
|
|
478
627
|
ephemeralNpx,
|
|
@@ -498,12 +647,16 @@ export function uninstallBurnoff(options = {}) {
|
|
|
498
647
|
const uninstallClaude = clients.includes('claude');
|
|
499
648
|
const uninstallAntigravity = clients.includes('antigravity');
|
|
500
649
|
|
|
501
|
-
const settingsPath =
|
|
650
|
+
const settingsPath = isGlobal
|
|
651
|
+
? path.join(homeDir, '.claude', 'settings.json')
|
|
652
|
+
: path.join(cwd, '.claude', 'settings.local.json');
|
|
502
653
|
let removedSettings = false;
|
|
503
654
|
let updatedSettings = false;
|
|
504
655
|
|
|
505
656
|
if (uninstallClaude) {
|
|
506
|
-
const shimPath =
|
|
657
|
+
const shimPath = isGlobal
|
|
658
|
+
? path.join(homeDir, '.claude', 'burnoff-hook-shim.mjs')
|
|
659
|
+
: path.join(cwd, '.claude', 'burnoff-hook-shim.mjs');
|
|
507
660
|
if (fs.existsSync(shimPath) && !dryRun) {
|
|
508
661
|
try {
|
|
509
662
|
fs.unlinkSync(shimPath);
|
|
@@ -524,6 +677,11 @@ export function uninstallBurnoff(options = {}) {
|
|
|
524
677
|
if (keptPre.length > 0) nextHooks.PreToolUse = keptPre;
|
|
525
678
|
else delete nextHooks.PreToolUse;
|
|
526
679
|
}
|
|
680
|
+
if (nextHooks.PreSkillShellCommand) {
|
|
681
|
+
const keptPreSkillShell = filterOutBurnoffMatcherGroups(nextHooks.PreSkillShellCommand);
|
|
682
|
+
if (keptPreSkillShell.length > 0) nextHooks.PreSkillShellCommand = keptPreSkillShell;
|
|
683
|
+
else delete nextHooks.PreSkillShellCommand;
|
|
684
|
+
}
|
|
527
685
|
if (nextHooks.PostToolUse) {
|
|
528
686
|
const keptPost = filterOutBurnoffMatcherGroups(nextHooks.PostToolUse);
|
|
529
687
|
if (keptPost.length > 0) nextHooks.PostToolUse = keptPost;
|
|
@@ -544,6 +702,18 @@ export function uninstallBurnoff(options = {}) {
|
|
|
544
702
|
if (keptPreCompact.length > 0) nextHooks.PreCompact = keptPreCompact;
|
|
545
703
|
else delete nextHooks.PreCompact;
|
|
546
704
|
}
|
|
705
|
+
for (const modelSwitchEvent of ['PreModelSwitch', 'PostModelSwitch']) {
|
|
706
|
+
if (nextHooks[modelSwitchEvent]) {
|
|
707
|
+
const keptModelSwitch = filterOutBurnoffMatcherGroups(nextHooks[modelSwitchEvent]);
|
|
708
|
+
if (keptModelSwitch.length > 0) nextHooks[modelSwitchEvent] = keptModelSwitch;
|
|
709
|
+
else delete nextHooks[modelSwitchEvent];
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (nextHooks.UserPromptSubmit) {
|
|
713
|
+
const keptUserPrompt = filterOutBurnoffMatcherGroups(nextHooks.UserPromptSubmit);
|
|
714
|
+
if (keptUserPrompt.length > 0) nextHooks.UserPromptSubmit = keptUserPrompt;
|
|
715
|
+
else delete nextHooks.UserPromptSubmit;
|
|
716
|
+
}
|
|
547
717
|
|
|
548
718
|
const nextSettings = { ...current };
|
|
549
719
|
if (Object.keys(nextHooks).length > 0) {
|
|
@@ -551,6 +721,13 @@ export function uninstallBurnoff(options = {}) {
|
|
|
551
721
|
} else {
|
|
552
722
|
delete nextSettings.hooks;
|
|
553
723
|
}
|
|
724
|
+
if (
|
|
725
|
+
nextSettings.statusLine &&
|
|
726
|
+
typeof nextSettings.statusLine === 'object' &&
|
|
727
|
+
isBurnoffCommand(nextSettings.statusLine.command)
|
|
728
|
+
) {
|
|
729
|
+
delete nextSettings.statusLine;
|
|
730
|
+
}
|
|
554
731
|
|
|
555
732
|
if (Object.keys(nextSettings).length === 0) {
|
|
556
733
|
removedSettings = true;
|
|
@@ -558,7 +735,7 @@ export function uninstallBurnoff(options = {}) {
|
|
|
558
735
|
fs.unlinkSync(settingsPath);
|
|
559
736
|
const claudeDir = path.dirname(settingsPath);
|
|
560
737
|
try {
|
|
561
|
-
if (fs.existsSync(claudeDir) && fs.readdirSync(claudeDir).length === 0) {
|
|
738
|
+
if (!isGlobal && fs.existsSync(claudeDir) && fs.readdirSync(claudeDir).length === 0) {
|
|
562
739
|
fs.rmdirSync(claudeDir);
|
|
563
740
|
}
|
|
564
741
|
} catch (err) {
|
|
@@ -581,12 +758,20 @@ export function uninstallBurnoff(options = {}) {
|
|
|
581
758
|
let updatedAntigravityHooks = false;
|
|
582
759
|
|
|
583
760
|
if (uninstallAntigravity) {
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
761
|
+
const agShimPaths = [path.join(cwd, '.burnoff', 'hook-shim.mjs')];
|
|
762
|
+
if (isGlobal) {
|
|
763
|
+
agShimPaths.push(
|
|
764
|
+
path.join(homeDir, '.burnoff', 'bin', 'hook-shim.mjs'),
|
|
765
|
+
path.join(os.tmpdir(), 'burnoff', 'bin', 'hook-shim.mjs')
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
for (const agShimPath of agShimPaths) {
|
|
769
|
+
if (fs.existsSync(agShimPath) && !dryRun) {
|
|
770
|
+
try {
|
|
771
|
+
fs.unlinkSync(agShimPath);
|
|
772
|
+
} catch (err) {
|
|
773
|
+
void err; // ignore: Antigravity shim unlink best-effort
|
|
774
|
+
}
|
|
590
775
|
}
|
|
591
776
|
}
|
|
592
777
|
|
|
@@ -620,7 +805,7 @@ export function uninstallBurnoff(options = {}) {
|
|
|
620
805
|
|
|
621
806
|
let excludePath = null;
|
|
622
807
|
let excludeUpdated = false;
|
|
623
|
-
const gitDir = resolveGitDir(cwd);
|
|
808
|
+
const gitDir = isGlobal ? null : resolveGitDir(cwd);
|
|
624
809
|
if (gitDir) {
|
|
625
810
|
excludePath = path.join(gitDir, 'info', 'exclude');
|
|
626
811
|
if (fs.existsSync(excludePath)) {
|
|
@@ -659,8 +844,10 @@ export default {
|
|
|
659
844
|
SESSION_START_MATCHER,
|
|
660
845
|
ANTIGRAVITY_PRE_TOOL_MATCHER,
|
|
661
846
|
ANTIGRAVITY_POST_TOOL_MATCHER,
|
|
847
|
+
buildBurnoffStatuslineCommand,
|
|
662
848
|
buildClaudeHooksConfig,
|
|
663
849
|
buildAntigravityHooksConfig,
|
|
850
|
+
planAntigravityShim,
|
|
664
851
|
hasQuotedAntigravityPath,
|
|
665
852
|
resolveInitClients,
|
|
666
853
|
initBurnoff,
|