burnoff 1.2.0 → 1.3.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 +11 -0
- package/.github/workflows/burnoff-pr-gate.yml +3 -3
- package/.github/workflows/burnoff-startup-lint.yml +37 -0
- package/README.md +30 -3
- package/bin/burnoff.mjs +122 -5
- package/commands/burnoff.md +16 -0
- package/docs/CLAUDE_CODE_PLUGIN.md +67 -0
- package/docs/DESIGN_PARTNER_INTAKE.md +44 -0
- package/package.json +10 -4
- package/scripts/burnoff-statusline.mjs +84 -0
- package/src/cli/startup-audit.mjs +243 -69
- package/src/guards/pre-tool-engine.mjs +76 -52
- package/src/guards/snooze.mjs +360 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "burnoff",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Deterministic circuit breakers, bounded file-read guards, Turn-0 CI linters, and PR spend gates for Claude Code.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Gizzant"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": "https://github.com/Gizzant/burnoff",
|
|
10
|
+
"commands": "./commands/"
|
|
11
|
+
}
|
|
@@ -30,13 +30,13 @@ jobs:
|
|
|
30
30
|
if [ -s .burnoff-ci/provider-usage.json ]; then
|
|
31
31
|
USAGE_FLAG="--provider-usage .burnoff-ci/provider-usage.json"
|
|
32
32
|
fi
|
|
33
|
-
npx -y burnoff@1.
|
|
34
|
-
npx -y burnoff@1.
|
|
33
|
+
npx -y burnoff@1.3.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
|
|
34
|
+
npx -y burnoff@1.3.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
|
|
35
35
|
|
|
36
36
|
- name: Enforce CI Token-Budget Gate
|
|
37
37
|
id: gate
|
|
38
38
|
run: |
|
|
39
|
-
npx -y burnoff@1.
|
|
39
|
+
npx -y burnoff@1.3.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
|
|
40
40
|
cat .burnoff-ci/pr-cost.md >> "$GITHUB_STEP_SUMMARY"
|
|
41
41
|
cat .burnoff-ci/ci-gate.md >> "$GITHUB_STEP_SUMMARY"
|
|
42
42
|
echo "summary_path=.burnoff-ci/pr-cost.md" >> "$GITHUB_OUTPUT"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Burnoff Turn-0 Config & Rules Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths:
|
|
6
|
+
- 'CLAUDE.md'
|
|
7
|
+
- 'GEMINI.md'
|
|
8
|
+
- '.claude/**'
|
|
9
|
+
- '.agents/**'
|
|
10
|
+
- '.mcp.json'
|
|
11
|
+
- '.burnoff.yaml'
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
startup-lint:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout repository
|
|
22
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
23
|
+
|
|
24
|
+
- name: Setup Node.js
|
|
25
|
+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
|
26
|
+
with:
|
|
27
|
+
node-version: '22'
|
|
28
|
+
|
|
29
|
+
- name: Run Repo-Local Turn-0 Startup Audit
|
|
30
|
+
# External consumers copying this workflow can use npx -y burnoff@1.3.0 directly.
|
|
31
|
+
run: |
|
|
32
|
+
if [ -f bin/burnoff.mjs ]; then
|
|
33
|
+
node bin/burnoff.mjs audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
|
|
34
|
+
else
|
|
35
|
+
npx -y burnoff@1.3.0 audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
|
|
36
|
+
fi
|
|
37
|
+
cat burnoff-startup-lint.txt >> "$GITHUB_STEP_SUMMARY"
|
package/README.md
CHANGED
|
@@ -147,14 +147,41 @@ ciBudgetGate:
|
|
|
147
147
|
failOnMissingTranscripts: false
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
See [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.yml) for a SHA-pinned, least-privilege (`permissions: contents: read`) workflow built for `burnoff@1.
|
|
150
|
+
See [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.yml) for a SHA-pinned, least-privilege (`permissions: contents: read`) workflow built for `burnoff@1.3.0`:
|
|
151
151
|
|
|
152
|
-
- Runs `npx -y burnoff@1.
|
|
153
|
-
- Runs `npx -y burnoff@1.
|
|
152
|
+
- Runs `npx -y burnoff@1.3.0 pr-cost` (automatically passing `--provider-usage .burnoff-ci/provider-usage.json` when present) to produce `.burnoff-ci/pr-cost.json` and `.burnoff-ci/pr-cost.md`.
|
|
153
|
+
- Runs `npx -y burnoff@1.3.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations`.
|
|
154
154
|
- Appends the Markdown breakdown to `$GITHUB_STEP_SUMMARY` and posts non-fork PR summary comments.
|
|
155
155
|
|
|
156
156
|
> **Note on CI runners:** Ephemeral GitHub Actions runners do not have access to developers' local `~/.claude/projects/` transcripts. `failOnMissingTranscripts` automatically defaults to `true` when `CI` or `GITHUB_ACTIONS` is set (unless explicitly overridden in `.burnoff.yaml`), so upload `.burnoff-ci/provider-usage.json` or session transcripts before running `pr-cost` to enforce budgets cleanly.
|
|
157
157
|
|
|
158
|
+
## Turn-0 CI Config Linting (`audit --startup --ci`)
|
|
159
|
+
|
|
160
|
+
See [`.github/workflows/burnoff-startup-lint.yml`](.github/workflows/burnoff-startup-lint.yml) for a SHA-pinned, repo-local workflow that lints `CLAUDE.md`, `GEMINI.md`, `.claude/**`, `.agents/**`, `.mcp.json`, and `.burnoff.yaml` on PRs without touching runner home directories:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npx -y burnoff@1.3.0 audit --startup --ci --github-annotations --client auto
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Pass `--strict` to fail the workflow on warn-level lints as well as error-level secret/deprecated-model findings.
|
|
167
|
+
|
|
168
|
+
## Temporary `ask` Overrides (`allow-once` & `snooze`)
|
|
169
|
+
|
|
170
|
+
When an interactive `ask` prompt (`DET-01` soft discard, `DET-02` public-cert/arg check, `DET-03` lockfile/workflow edit, or `DET-04` warn-mode loop pause) blocks an intentional action:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npx -y burnoff@1.3.0 allow-once DET-03 --scope deploy.yml
|
|
174
|
+
npx -y burnoff@1.3.0 snooze DET-04 --minutes 15
|
|
175
|
+
npx -y burnoff@1.3.0 allow-once --list
|
|
176
|
+
npx -y burnoff@1.3.0 allow-once --clear
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`allow-once` and `snooze` apply strictly to `ask` verdicts — Ring-0 `deny` / `exitCode: 2` hard blocks (`git push --force`, `.env`/credential reads, `strict`-mode blocks) are never bypassed.
|
|
180
|
+
|
|
181
|
+
## Claude Code Plugin & Status Line
|
|
182
|
+
|
|
183
|
+
Burnoff includes `.claude-plugin/plugin.json`, the `/burnoff` slash command (`commands/burnoff.md`), and a fail-silent terminal status-line script (`scripts/burnoff-statusline.mjs`). See [`docs/CLAUDE_CODE_PLUGIN.md`](docs/CLAUDE_CODE_PLUGIN.md) for setup and [`docs/DESIGN_PARTNER_INTAKE.md`](docs/DESIGN_PARTNER_INTAKE.md) for the private MIT design-partner intake form.
|
|
184
|
+
|
|
158
185
|
## Environment Variables
|
|
159
186
|
|
|
160
187
|
- `BURNOFF_HOME`: Override `~/.burnoff/` state directory.
|
package/bin/burnoff.mjs
CHANGED
|
@@ -27,7 +27,7 @@ function getPackageVersion() {
|
|
|
27
27
|
} catch (err) {
|
|
28
28
|
void err; // ignore: package.json read fallback
|
|
29
29
|
}
|
|
30
|
-
return '1.
|
|
30
|
+
return '1.3.0';
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const BOOLEAN_FLAGS = new Set([
|
|
@@ -38,6 +38,9 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
38
38
|
'github-annotations',
|
|
39
39
|
'markdown',
|
|
40
40
|
'startup',
|
|
41
|
+
'ci',
|
|
42
|
+
'list',
|
|
43
|
+
'clear',
|
|
41
44
|
'foreground',
|
|
42
45
|
'skip-daemon',
|
|
43
46
|
'global',
|
|
@@ -101,7 +104,9 @@ function formatHelp() {
|
|
|
101
104
|
' init [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Install Burnoff hooks',
|
|
102
105
|
' uninstall [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Remove Burnoff hooks',
|
|
103
106
|
' doctor [--gc] [--json] Run Node/SQLite/hooks/daemon/FTS5/ledger diagnostics',
|
|
104
|
-
' audit [--startup] [--client auto|claude|antigravity] [--session <file>] [--json]
|
|
107
|
+
' audit [--startup [--ci] [--strict] [--github-annotations]] [--client auto|claude|antigravity|both] [--session <file>] [--json] Audit transcripts or Turn-0 config',
|
|
108
|
+
' allow-once [DET-01..DET-04|*] [--scope <substr>] [--minutes <N>] [--session <id>] [--list|--clear] Temporary ask-gate override',
|
|
109
|
+
' snooze [DET-01..DET-04|*] [--minutes 15] [--scope <substr>] [--session <id>] [--list|--clear] Timed ask-gate snooze',
|
|
105
110
|
' pr-cost [--base main] [--client auto|claude|antigravity|both] [--json|--markdown] Attribute branch commits to AI cost',
|
|
106
111
|
' export [--since <sha>] [--out <file>] Export PR attribution JSON for CI budget gate',
|
|
107
112
|
' ci-gate [--strict] [--github-annotations] Enforce .burnoff.yaml ciBudgetGate thresholds',
|
|
@@ -184,13 +189,36 @@ async function handleDoctor(flags, io) {
|
|
|
184
189
|
async function handleAudit(flags, io) {
|
|
185
190
|
const clientOpt = typeof flags.client === 'string' ? flags.client : 'auto';
|
|
186
191
|
if (flags.startup) {
|
|
187
|
-
const { runStartupAudit, formatStartupAuditReport } = await import(
|
|
192
|
+
const { runStartupAudit, formatStartupAuditReport, evaluateStartupAuditCi } = await import(
|
|
193
|
+
'../src/cli/startup-audit.mjs'
|
|
194
|
+
);
|
|
195
|
+
const cwd = flags.cwd || process.cwd();
|
|
196
|
+
const isCi = Boolean(flags.ci);
|
|
188
197
|
const report = runStartupAudit({
|
|
189
|
-
cwd
|
|
198
|
+
cwd,
|
|
190
199
|
homeDir: flags.home || undefined,
|
|
191
200
|
days: flags.days ? Number(flags.days) : 7,
|
|
192
|
-
client: clientOpt
|
|
201
|
+
client: clientOpt,
|
|
202
|
+
ci: isCi,
|
|
203
|
+
repoOnly: isCi
|
|
193
204
|
});
|
|
205
|
+
if (isCi) {
|
|
206
|
+
const ciResult = evaluateStartupAuditCi(report, {
|
|
207
|
+
strict: Boolean(flags.strict),
|
|
208
|
+
cwd
|
|
209
|
+
});
|
|
210
|
+
report.ci = ciResult;
|
|
211
|
+
if (flags['github-annotations'] && Array.isArray(ciResult.annotations)) {
|
|
212
|
+
for (const line of ciResult.annotations) {
|
|
213
|
+
io.stdout.write(`${line}\n`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const text = flags.json
|
|
217
|
+
? JSON.stringify(report, null, 2) + '\n'
|
|
218
|
+
: `${formatStartupAuditReport(report)}CI Verdict: ${ciResult.verdict} (errors=${ciResult.errorCount}, warnings=${ciResult.warnCount}, strict=${ciResult.strict})\n`;
|
|
219
|
+
writeOut(text, flags.out, io.stdout);
|
|
220
|
+
return ciResult.exitCode;
|
|
221
|
+
}
|
|
194
222
|
const text = flags.json ? JSON.stringify(report, null, 2) + '\n' : formatStartupAuditReport(report);
|
|
195
223
|
writeOut(text, flags.out, io.stdout);
|
|
196
224
|
return 0;
|
|
@@ -437,6 +465,92 @@ async function handleDaemon(positionals, flags, io) {
|
|
|
437
465
|
return 1;
|
|
438
466
|
}
|
|
439
467
|
|
|
468
|
+
async function handleAllowOnce(cmd, positionals, flags, io) {
|
|
469
|
+
const {
|
|
470
|
+
normalizeSnoozeDetectorId,
|
|
471
|
+
grantAskSnoozeAtomicSync,
|
|
472
|
+
listActiveSnoozes,
|
|
473
|
+
clearAskSnoozesAtomicSync,
|
|
474
|
+
DEFAULT_ALLOW_ONCE_TTL_MS,
|
|
475
|
+
DEFAULT_SNOOZE_TTL_MS
|
|
476
|
+
} = await import('../src/guards/snooze.mjs');
|
|
477
|
+
|
|
478
|
+
const cwd = path.resolve(flags.cwd || process.cwd());
|
|
479
|
+
const homeDir = flags.home || undefined;
|
|
480
|
+
const sessionId = typeof flags.session === 'string' && flags.session.trim() ? flags.session.trim() : null;
|
|
481
|
+
const rawClient = typeof flags.client === 'string' ? flags.client.trim().toLowerCase() : 'claude';
|
|
482
|
+
const client = rawClient === 'antigravity' || rawClient === 'ag' ? 'antigravity' : 'claude-code';
|
|
483
|
+
const storeOpts = { cwd, homeDir, client };
|
|
484
|
+
|
|
485
|
+
const rawDetArg = positionals[1];
|
|
486
|
+
const detectorId = normalizeSnoozeDetectorId(rawDetArg === undefined ? '*' : rawDetArg);
|
|
487
|
+
if (!detectorId) {
|
|
488
|
+
io.stderr.write(`Invalid detector ID "${rawDetArg}". Expected DET-01..DET-04, all, or *.\n`);
|
|
489
|
+
return 1;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
if (flags.list) {
|
|
493
|
+
const entries = listActiveSnoozes({ sessionId }, storeOpts);
|
|
494
|
+
if (flags.json) {
|
|
495
|
+
io.stdout.write(JSON.stringify({ ok: true, count: entries.length, snoozes: entries }, null, 2) + '\n');
|
|
496
|
+
} else if (entries.length === 0) {
|
|
497
|
+
io.stdout.write('No active Burnoff ask-gate snoozes.\n');
|
|
498
|
+
} else {
|
|
499
|
+
for (const e of entries) {
|
|
500
|
+
const remLabel = e.remaining === null ? 'timed' : `uses=${e.remaining}`;
|
|
501
|
+
io.stdout.write(
|
|
502
|
+
`[${e.source}] id=${e.id} detector=${e.detectorId} scope=${e.scope} ${remLabel} expires=${new Date(e.expiresAtMs).toISOString()}\n`
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
return 0;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
if (flags.clear) {
|
|
510
|
+
const res = clearAskSnoozesAtomicSync(
|
|
511
|
+
{ sessionId, detectorId: rawDetArg !== undefined ? detectorId : null },
|
|
512
|
+
storeOpts
|
|
513
|
+
);
|
|
514
|
+
if (flags.json) {
|
|
515
|
+
io.stdout.write(JSON.stringify(res, null, 2) + '\n');
|
|
516
|
+
} else {
|
|
517
|
+
io.stdout.write(`Cleared ${res.clearedCount} active Burnoff ask-gate snooze(s).\n`);
|
|
518
|
+
}
|
|
519
|
+
return 0;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
const defaultTtlMin = cmd === 'snooze' ? DEFAULT_SNOOZE_TTL_MS / 60000 : DEFAULT_ALLOW_ONCE_TTL_MS / 60000;
|
|
523
|
+
const parsedMinutes = flags.minutes !== undefined ? Number(flags.minutes) : defaultTtlMin;
|
|
524
|
+
const ttlMs =
|
|
525
|
+
Number.isFinite(parsedMinutes) && parsedMinutes > 0
|
|
526
|
+
? Math.round(parsedMinutes * 60 * 1000)
|
|
527
|
+
: cmd === 'snooze'
|
|
528
|
+
? DEFAULT_SNOOZE_TTL_MS
|
|
529
|
+
: DEFAULT_ALLOW_ONCE_TTL_MS;
|
|
530
|
+
const count =
|
|
531
|
+
flags.count !== undefined
|
|
532
|
+
? Math.max(1, Math.floor(Number(flags.count) || 1))
|
|
533
|
+
: cmd === 'snooze'
|
|
534
|
+
? null
|
|
535
|
+
: 1;
|
|
536
|
+
const scope = typeof flags.scope === 'string' && flags.scope.trim() ? flags.scope.trim() : '*';
|
|
537
|
+
const reason = typeof flags.reason === 'string' ? flags.reason : '';
|
|
538
|
+
|
|
539
|
+
const res = grantAskSnoozeAtomicSync(
|
|
540
|
+
{ sessionId, detectorId, scope, count, ttlMs, reason },
|
|
541
|
+
storeOpts
|
|
542
|
+
);
|
|
543
|
+
if (flags.json) {
|
|
544
|
+
io.stdout.write(JSON.stringify(res, null, 2) + '\n');
|
|
545
|
+
} else {
|
|
546
|
+
const modeLabel = res.grant.remaining === null ? 'timed snooze' : `allow-once (uses=${res.grant.remaining})`;
|
|
547
|
+
io.stdout.write(
|
|
548
|
+
`Granted ${modeLabel} for ${res.grant.detectorId} (scope=${res.grant.scope}, target=${res.target}, expires=${new Date(res.grant.expiresAtMs).toISOString()})\n`
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
return 0;
|
|
552
|
+
}
|
|
553
|
+
|
|
440
554
|
/**
|
|
441
555
|
* Dispatches Burnoff CLI commands and returns an exit code.
|
|
442
556
|
*/
|
|
@@ -471,6 +585,9 @@ export async function runCli(argv = process.argv.slice(2), io = { stdout: proces
|
|
|
471
585
|
return handleDoctor(flags, io);
|
|
472
586
|
case 'audit':
|
|
473
587
|
return handleAudit(flags, io);
|
|
588
|
+
case 'allow-once':
|
|
589
|
+
case 'snooze':
|
|
590
|
+
return handleAllowOnce(cmd, positionals, flags, io);
|
|
474
591
|
case 'pr-cost':
|
|
475
592
|
return handlePrCost(flags, io);
|
|
476
593
|
case 'export':
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run Burnoff diagnostics, Turn-0 startup audits, ask-gate overrides, or PR spend digests
|
|
3
|
+
argument-hint: "[doctor|audit|startup|allow-once <DET-xx>|snooze <DET-xx>|pr-cost|team-digest|init]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run Burnoff (`npx -y burnoff@1.3.0` or local `node bin/burnoff.mjs` when developing in the Burnoff repo) according to `$ARGUMENTS`:
|
|
7
|
+
|
|
8
|
+
- Empty arguments: run `burnoff doctor` and `burnoff team-digest --days 7` and summarize findings clearly.
|
|
9
|
+
- `doctor`: run `burnoff doctor` to verify Node/SQLite FTS5, hooks, and warm daemon health.
|
|
10
|
+
- `startup` or `audit --startup`: run `burnoff audit --startup --ci` for repo-local Turn-0 rule, secret, and MCP linting (or drop `--ci` to include local machine config).
|
|
11
|
+
- `audit`: run `burnoff audit --limit 10` across recent local transcripts.
|
|
12
|
+
- `allow-once ...` or `snooze ...`: run `burnoff $ARGUMENTS` to grant/list/clear temporary overrides for interactive `ask` gates (`DET-01`..`DET-04`; never bypasses `deny` hard blocks).
|
|
13
|
+
- `pr-cost` or `team-digest`: run `burnoff $ARGUMENTS` to inspect AI branch cost attribution or 7-day savings telemetry.
|
|
14
|
+
- `init`: run `burnoff init --client claude` to install/refresh `.claude/settings.local.json` hooks deterministically.
|
|
15
|
+
|
|
16
|
+
Keep the response concise and show exact command output numbers without guessing or extrapolating.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Burnoff Claude Code Plugin & Status Line
|
|
2
|
+
|
|
3
|
+
Burnoff ships a lightweight Claude Code plugin manifest (`.claude-plugin/plugin.json`), the `/burnoff` slash command (`commands/burnoff.md`), and a zero-dependency status-line snippet (`scripts/burnoff-statusline.mjs`).
|
|
4
|
+
|
|
5
|
+
## 1. Install Deterministic Hooks
|
|
6
|
+
|
|
7
|
+
Run the CLI installer in your repository (or pass `--global` for user-wide defaults):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx -y burnoff@1.3.0 init --client claude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Why hooks are installed via `burnoff init` instead of a static hook file:
|
|
14
|
+
|
|
15
|
+
- `burnoff init` resolves node paths cleanly across Windows, macOS, and Linux and configures `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `SessionStart`, and `PreCompact`.
|
|
16
|
+
- Verify installation anytime with:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx -y burnoff@1.3.0 doctor
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. Enable `/burnoff` Slash Command
|
|
23
|
+
|
|
24
|
+
Load the plugin directory when testing locally:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
claude --plugin-dir /path/to/burnoff
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or copy `commands/burnoff.md` into your project's `.claude/commands/` folder so team members get `/burnoff` automatically:
|
|
31
|
+
|
|
32
|
+
- `/burnoff` — run `doctor` + `team-digest --days 7`
|
|
33
|
+
- `/burnoff startup` — run Turn-0 repo-local linter (`audit --startup --ci`)
|
|
34
|
+
- `/burnoff allow-once DET-03 --scope deploy.yml` — grant a single-use `ask` override
|
|
35
|
+
- `/burnoff pr-cost` — inspect branch spend attribution
|
|
36
|
+
|
|
37
|
+
## 3. Add Status-Line Telemetry Snippet
|
|
38
|
+
|
|
39
|
+
Add a `"statusLine"` entry to `.claude/settings.local.json` or `~/.claude/settings.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"statusLine": {
|
|
44
|
+
"type": "command",
|
|
45
|
+
"command": "node /abs/path/to/burnoff/scripts/burnoff-statusline.mjs"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Example terminal output (`<50 ms`, zero network calls, fail-silent):
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
burnoff | saved: 14.2k tok ($0.04) | guards: 2 | ctx: 38%
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## 4. Temporary Overrides for `ask` Prompts
|
|
57
|
+
|
|
58
|
+
When interactive `ask` gates pause an intentional edit or command (`DET-01`, `DET-02`, `DET-03`, or `DET-04`), grant a scoped single-use or timed snooze from your terminal:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx -y burnoff@1.3.0 allow-once DET-03 --scope deploy.yml
|
|
62
|
+
npx -y burnoff@1.3.0 snooze DET-04 --minutes 15
|
|
63
|
+
npx -y burnoff@1.3.0 allow-once --list
|
|
64
|
+
npx -y burnoff@1.3.0 allow-once --clear
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Security invariant: `allow-once` and `snooze` apply **only** to `ask` decisions. Ring-0 `deny` / `exitCode: 2` hard blocks (`git push --force`, `.env`/credential reads, strict-mode blocks) are never bypassed.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Burnoff Private Design-Partner Intake
|
|
2
|
+
|
|
3
|
+
Burnoff (`MIT`, zero runtime dependencies, 100% local execution) is onboarding a small cohort of engineering teams using Claude Code and/or Google Antigravity to validate Turn-0 CI config linting, bounded file-read savings, and PR cost gates on real repositories.
|
|
4
|
+
|
|
5
|
+
- **Cost & Terms:** Free open-source MIT CLI during design partnership — no public SaaS tier, no seat license keys, and zero external telemetry uploads without explicit export.
|
|
6
|
+
- **How to Submit:** Open a private discussion/issue on `https://github.com/Gizzant/burnoff/issues` marked `[Design Partner]` (sanitized — do **not** paste secrets or `.env` values), or email maintainers with the template below.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Intake Questionnaire
|
|
11
|
+
|
|
12
|
+
### 1. Team & Repository Profile
|
|
13
|
+
- **Organization / Team Name:**
|
|
14
|
+
- **GitHub Org / Repo Count:**
|
|
15
|
+
- **Primary Languages & Monorepo Layout:**
|
|
16
|
+
- **Active Coding Harnesses (check all):**
|
|
17
|
+
- [ ] Claude Code CLI / IDE
|
|
18
|
+
- [ ] Google Antigravity CLI / IDE
|
|
19
|
+
- [ ] GitHub Actions PR Workflows
|
|
20
|
+
|
|
21
|
+
### 2. Current Failure Modes & Spend Hotspots (rank top 3)
|
|
22
|
+
- [ ] Oversized file reads blowing context (`Read` / `read_file`)
|
|
23
|
+
- [ ] Retry loops burning turns (`DET-04` repeated test/build failures)
|
|
24
|
+
- [ ] Turn-0 startup token tax (`CLAUDE.md` / `GEMINI.md` / eager MCP schemas / `BO-CFG-*`)
|
|
25
|
+
- [ ] Subagent fan-out or prompt bloat (`DET-05` / `BO-MCP-09`)
|
|
26
|
+
- [ ] PR cost visibility & CI budget enforcement (`pr-cost` / `ci-gate`)
|
|
27
|
+
- [ ] Destructive command / credential boundary incidents (`DET-01` / `DET-02`)
|
|
28
|
+
|
|
29
|
+
### 3. Baseline Snapshot (optional, local-only commands)
|
|
30
|
+
Run inside a representative repo and paste sanitized summary lines only:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx -y burnoff@1.3.0 doctor
|
|
34
|
+
npx -y burnoff@1.3.0 audit --startup --ci
|
|
35
|
+
npx -y burnoff@1.3.0 team-digest --days 7
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 4. Security & Privacy Requirements
|
|
39
|
+
- **Strict air-gap / offline CI runner?** (Yes / No)
|
|
40
|
+
- **Strict JSON-only config requirement?** (`BO-CFG-01`) (Yes / No)
|
|
41
|
+
- **Custom `.burnoff.yaml` thresholds needed?**
|
|
42
|
+
|
|
43
|
+
### 5. Success Criteria (30-Day Pilot)
|
|
44
|
+
What measurable outcome would make Burnoff a permanent default in your repos? (e.g., Turn-0 prefix tokens reduced, CI catches unignored secrets in `.claude/settings.local.json`, or zero runaway retry loops.)
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "burnoff",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Deterministic circuit breakers, bounded file-read guards, and CI spend gates for Claude Code and Google Antigravity.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Gizzant",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/Gizzant/burnoff.git"
|
|
10
|
+
"url": "git+https://github.com/Gizzant/burnoff.git"
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/Gizzant/burnoff#readme",
|
|
13
13
|
"bugs": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"guardrails"
|
|
25
25
|
],
|
|
26
26
|
"bin": {
|
|
27
|
-
"burnoff": "
|
|
27
|
+
"burnoff": "bin/burnoff.mjs"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
30
|
"node": ">=20.19.0"
|
|
@@ -33,7 +33,13 @@
|
|
|
33
33
|
"bin/",
|
|
34
34
|
"hooks/*.mjs",
|
|
35
35
|
"src/",
|
|
36
|
+
".claude-plugin/",
|
|
37
|
+
"commands/",
|
|
38
|
+
"scripts/",
|
|
36
39
|
".github/workflows/burnoff-pr-gate.yml",
|
|
40
|
+
".github/workflows/burnoff-startup-lint.yml",
|
|
41
|
+
"docs/CLAUDE_CODE_PLUGIN.md",
|
|
42
|
+
"docs/DESIGN_PARTNER_INTAKE.md",
|
|
37
43
|
"LICENSE",
|
|
38
44
|
"README.md"
|
|
39
45
|
],
|
|
@@ -42,6 +48,6 @@
|
|
|
42
48
|
"test": "node --test --test-concurrency=1",
|
|
43
49
|
"test:bench": "node --test test/ipc-daemon-bench.test.mjs",
|
|
44
50
|
"doctor": "node bin/burnoff.mjs doctor",
|
|
45
|
-
"check:brands": "node -e \"import('node:fs').then(async fs=>{const p=await import('node:path');const bad=new RegExp(['ctx'+'top','high'+'beam','attention[-_]'+'horizon','ga-visual'+'izer-v2','pro_'+'license','ah-status'+'line','\\\\bHB'+'-(?:CFG|MCP|SEC)-','\\\\ba'+'gy','default'+'_api:','phase0'+'_' ].join('|'),'i');const dirs=['bin','hooks','src','.github'];let hits=[];const walk=(d)=>{if(!fs.existsSync(d))return;for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory())walk(f);else if(/\\.(mjs|json|ya?ml|md)$/.test(e.name)){const t=fs.readFileSync(f,'utf8');if(bad.test(t))hits.push(f);}}};dirs.forEach(walk);['package.json','README.md'].forEach(f=>{if(fs.existsSync(f)&&bad.test(fs.readFileSync(f,'utf8')))hits.push(f);});if(hits.length){console.error('Brand leaks:',hits);process.exit(1);}console.log('Zero legacy brand strings found.');})\""
|
|
51
|
+
"check:brands": "node -e \"import('node:fs').then(async fs=>{const p=await import('node:path');const bad=new RegExp(['ctx'+'top','high'+'beam','attention[-_]'+'horizon','ga-visual'+'izer-v2','pro_'+'license','ah-status'+'line','\\\\bHB'+'-(?:CFG|MCP|SEC)-','\\\\ba'+'gy','default'+'_api:','phase0'+'_' ].join('|'),'i');const dirs=['bin','hooks','src','.github','.claude-plugin','commands','scripts'];let hits=[];const walk=(d)=>{if(!fs.existsSync(d))return;for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory())walk(f);else if(/\\.(mjs|json|ya?ml|md)$/.test(e.name)){const t=fs.readFileSync(f,'utf8');if(bad.test(t))hits.push(f);}}};dirs.forEach(walk);['package.json','README.md','docs/CLAUDE_CODE_PLUGIN.md','docs/DESIGN_PARTNER_INTAKE.md'].forEach(f=>{if(fs.existsSync(f)&&bad.test(fs.readFileSync(f,'utf8')))hits.push(f);});if(hits.length){console.error('Brand leaks:',hits);process.exit(1);}console.log('Zero legacy brand strings found.');})\""
|
|
46
52
|
}
|
|
47
53
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file scripts/burnoff-statusline.mjs
|
|
4
|
+
* Zero-dependency, fail-silent status-line renderer for Claude Code `settings.json` `"statusLine"`.
|
|
5
|
+
* Summarizes Burnoff ledger savings + guard interventions alongside live stdin context metrics.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import { readLedgerSummary } from '../src/storage/ledger.mjs';
|
|
10
|
+
import { isCliEntrypoint } from '../hooks/hook-io.mjs';
|
|
11
|
+
|
|
12
|
+
function formatCompactTokens(tokens = 0) {
|
|
13
|
+
const n = Math.max(0, Number(tokens || 0));
|
|
14
|
+
if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
|
|
15
|
+
if (n >= 1_000) return `${(n / 1_000).toFixed(1)}k`;
|
|
16
|
+
return String(Math.round(n));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function formatUsd(usd = 0) {
|
|
20
|
+
const n = Math.max(0, Number(usd || 0));
|
|
21
|
+
return `$${n.toFixed(2)}`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Renders a single compact terminal status line from Claude Code stdin JSON + Burnoff ledger.
|
|
26
|
+
*/
|
|
27
|
+
export function renderBurnoffStatusLine(inputJson = {}, options = {}) {
|
|
28
|
+
const payload = inputJson && typeof inputJson === 'object' ? inputJson : {};
|
|
29
|
+
const cwd = options.cwd || payload.workspace?.current_dir || payload.cwd || process.cwd();
|
|
30
|
+
const homeDir = options.homeDir;
|
|
31
|
+
|
|
32
|
+
let summary = null;
|
|
33
|
+
try {
|
|
34
|
+
summary = readLedgerSummary({
|
|
35
|
+
cwd,
|
|
36
|
+
homeDir,
|
|
37
|
+
windowDays: options.windowDays ?? 7,
|
|
38
|
+
nowMs: options.nowMs
|
|
39
|
+
});
|
|
40
|
+
} catch {
|
|
41
|
+
summary = null; // ignore: unreadable ledger fails silent on statusLine
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const savedTokens = Number(summary?.totalSavedTokens || 0);
|
|
45
|
+
const savedUsd = Number(summary?.totalSavedUSD || 0);
|
|
46
|
+
const guardCount = Number(summary?.categories?.loopAndReadGuarded?.count || 0);
|
|
47
|
+
|
|
48
|
+
const parts = [
|
|
49
|
+
`burnoff`,
|
|
50
|
+
`saved: ${formatCompactTokens(savedTokens)} tok (${formatUsd(savedUsd)})`,
|
|
51
|
+
`guards: ${guardCount}`
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const usedPct = Number(payload.context_window?.used_percentage);
|
|
55
|
+
if (Number.isFinite(usedPct) && usedPct >= 0) {
|
|
56
|
+
parts.push(`ctx: ${Math.round(usedPct)}%`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const sessionCost = Number(payload.cost?.total_cost_usd);
|
|
60
|
+
if (Number.isFinite(sessionCost) && sessionCost > 0) {
|
|
61
|
+
parts.push(`sess: ${formatUsd(sessionCost)}`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return parts.join(' | ');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function readStdinSyncSafe() {
|
|
68
|
+
try {
|
|
69
|
+
const raw = fs.readFileSync(0, 'utf8').trim();
|
|
70
|
+
if (!raw) return {};
|
|
71
|
+
return JSON.parse(raw);
|
|
72
|
+
} catch {
|
|
73
|
+
return {}; // ignore: malformed or empty stdin falls back cleanly
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (isCliEntrypoint(import.meta.url)) {
|
|
78
|
+
const stdinPayload = readStdinSyncSafe();
|
|
79
|
+
process.stdout.write(`${renderBurnoffStatusLine(stdinPayload)}\n`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default {
|
|
83
|
+
renderBurnoffStatusLine
|
|
84
|
+
};
|