sawbuck 0.1.39 → 0.1.41
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 +1 -1
- package/contract-cmd.mjs +10 -4
- package/package.json +2 -2
- package/sawbuck.mjs +15 -0
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Exit codes: `0` verified · `1` regression · `2` gamed · `3` inconclusive · `
|
|
|
84
84
|
Run `sawbuck context` first to see what broke in these files before (reverts, weakened tests,
|
|
85
85
|
fragile spots). Never skip, weaken, or delete a test to go green.
|
|
86
86
|
|
|
87
|
-
**After you sign.** A new contract starts by watching: protected paths, new install scripts and sources outside the registry block from day one, and new dependencies and structure changes show as notes. `sawbuck contract --strict` blocks them all. When something fails, the check says what changed in words. To accept it on a pull request, someone with write access comments `sawbuck-allow: <reason>` and re-runs the check; the reason stays on the record. An agent signed in as that person could post the same comment, so branch protection and review still matter. Locally, use `--allow "<reason>"`.
|
|
87
|
+
**After you sign.** A new contract starts by watching: protected paths, new install scripts and sources outside the registry block from day one, and new dependencies and structure changes show as notes. `sawbuck contract --strict` blocks them all. When something fails, the check says what changed in words. If your tests can't run in CI, the check says so and doesn't fail the job, and protected paths are still enforced. To accept it on a pull request, someone with write access comments `sawbuck-allow: <reason>` and re-runs the check; the reason stays on the record. An agent signed in as that person could post the same comment, so branch protection and review still matter. Locally, use `--allow "<reason>"`.
|
|
88
88
|
|
|
89
89
|
**Rewritten history.** Logbook reads git, so a squash or a rebase takes a revert with it. `sawbuck context` also reads the reflog for commits no branch reaches any more and shows them for the files in hand, and once attached it keeps them in `.sawbuck/rewritten.jsonl` after the reflog expires. It stays local: a clone does not get it, nothing older than the reflog comes back, and work that was never committed is not in git at all. Your steering is separate: `reins` reads your agent transcripts, not git.
|
|
90
90
|
|
package/contract-cmd.mjs
CHANGED
|
@@ -19,7 +19,9 @@ const noCi = process.argv.includes('--no-ci');
|
|
|
19
19
|
// a new contract starts by watching: everyday change shows as a note. Protected paths, install scripts and sources
|
|
20
20
|
// outside the registry still fail from day one. --strict holds them all, and an existing contract is left as it is.
|
|
21
21
|
const REPORT = new Set(['dependency_entries', 'lock_drift', 'pins_changed', 'unpinned_execution', 'install_policy_gaps']);
|
|
22
|
-
|
|
22
|
+
// Tests need their dependencies, so an npm lockfile gets an install, with no scripts. Elsewhere tests may not run in
|
|
23
|
+
// CI, so inconclusive does not fail the job: protected paths are checked either way, and a gamed or failed verdict still fails.
|
|
24
|
+
const workflow = (npm) => `# Written by sawbuck contract. Checks every pull request against the contract in promptwheel.config.json.
|
|
23
25
|
name: Sawbuck
|
|
24
26
|
on: pull_request
|
|
25
27
|
permissions: { contents: read, pull-requests: write }
|
|
@@ -29,7 +31,11 @@ jobs:
|
|
|
29
31
|
steps:
|
|
30
32
|
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
|
31
33
|
with: { fetch-depth: 0 }
|
|
32
|
-
- uses:
|
|
34
|
+
${npm ? ` - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
|
35
|
+
with: { node-version: 22 }
|
|
36
|
+
- run: npm ci --ignore-scripts
|
|
37
|
+
` : ''} - uses: promptwheel-ai/promptwheel@v0
|
|
38
|
+
with: { inconclusive: pass }
|
|
33
39
|
`;
|
|
34
40
|
const cfgPath = join(repo, 'promptwheel.config.json');
|
|
35
41
|
const run = (args, cwd, stdio = ['ignore', 'pipe', 'pipe']) => execFileSync(process.execPath, args, { cwd, encoding: 'utf8', stdio });
|
|
@@ -73,11 +79,11 @@ try {
|
|
|
73
79
|
let remote = ''; try { remote = execFileSync('git', ['-C', repo, 'remote', 'get-url', 'origin'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }); } catch {}
|
|
74
80
|
const realTests = !(cfg.metrics || []).some((m) => /set your test command/.test(String(m.cmd)));
|
|
75
81
|
let ci = '';
|
|
76
|
-
if (!noCi && /github\.com/.test(remote) && realTests && !existsSync(wf)) { mkdirSync(dirname(wf), { recursive: true }); writeFileSync(wf,
|
|
82
|
+
if (!noCi && /github\.com/.test(remote) && realTests && !existsSync(wf)) { mkdirSync(dirname(wf), { recursive: true }); writeFileSync(wf, workflow(existsSync(join(repo, 'package-lock.json')))); ci = wf; }
|
|
77
83
|
const locked = existsSync(join(repo, 'promptwheel.lock.json'));
|
|
78
84
|
if (!locked) run([join(pack, 'lock.mjs'), 'write', repo], repo);
|
|
79
85
|
const added = (cfg.mandates.length - before.m) + (cfg.metrics.length - before.g);
|
|
80
|
-
process.stdout.write(added || !locked ? `sawbuck: signed. ${cfg.metrics.length} guards, ${cfg.mandates.length} protected-path rules, and the shape of this repo in promptwheel.lock.json.\n${strict ? '' : ' New dependencies and structure changes show as notes for now; protected paths and install scripts block. --strict blocks them all.\n'}${ci ? ' Added .github/workflows/sawbuck.yml, so pull requests are checked in CI.\n' : ''}` : 'sawbuck: already signed, nothing changed.\n');
|
|
86
|
+
process.stdout.write(added || !locked ? `sawbuck: signed. ${cfg.metrics.length} guards, ${cfg.mandates.length} protected-path rules, and the shape of this repo in promptwheel.lock.json.\n${strict ? '' : ' New dependencies and structure changes show as notes for now; protected paths and install scripts block. --strict blocks them all.\n'}${ci ? ' Added .github/workflows/sawbuck.yml, so pull requests are checked in CI. Commit it with the contract.\n' : ''}` : 'sawbuck: already signed, nothing changed.\n');
|
|
81
87
|
}
|
|
82
88
|
} finally { rmSync(scratch, { recursive: true, force: true }); }
|
|
83
89
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sawbuck",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"description": "Sign your agent to a contract: a deterministic, zero-LLM check re-proves each win from the agent's source edits alone, so a test that went green by editing the test, grader, or config is sent back. For Claude Code, with Codex support in beta.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@promptwheel/logbook": "0.9.10",
|
|
37
|
-
"promptwheel": "0.7.
|
|
37
|
+
"promptwheel": "0.7.15"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"sawbuck.mjs",
|
package/sawbuck.mjs
CHANGED
|
@@ -582,6 +582,21 @@ function wireClaude(repo, opts) {
|
|
|
582
582
|
put('Stop', chk);
|
|
583
583
|
mkdirSync(dir, { recursive: true });
|
|
584
584
|
writeFileSync(f, JSON.stringify(cfg, null, 2) + '\n');
|
|
585
|
+
// attach often runs inside a turn (saying yes to the offer), and that turn's Stop hook then has no baseline, so the
|
|
586
|
+
// files signing just wrote would read as the agent's violations. What is here now is the baseline; anything after it counts.
|
|
587
|
+
if (!user && existsSync(join(repo, 'promptwheel.config.json'))) {
|
|
588
|
+
try {
|
|
589
|
+
ensureExcluded(repo);
|
|
590
|
+
const stPath = join(repo, '.sawbuck', 'state.json');
|
|
591
|
+
let st = {}; try { st = JSON.parse(readFileSync(stPath, 'utf8')); } catch {}
|
|
592
|
+
if (!st.turnBaseline) {
|
|
593
|
+
let sha = ''; try { sha = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: repo, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim(); } catch {}
|
|
594
|
+
st.turnBaseline = { sha, files: protectedDirty(repo, { store: true }) };
|
|
595
|
+
st.lastPromptAt = new Date().toISOString();
|
|
596
|
+
mkdirSync(dirname(stPath), { recursive: true }); writeFileSync(stPath, JSON.stringify(st, null, 2) + '\n');
|
|
597
|
+
}
|
|
598
|
+
} catch {}
|
|
599
|
+
}
|
|
585
600
|
const mode = user ? 'user' : shared ? 'claude-shared' : 'claude';
|
|
586
601
|
const mp = user ? userManifestPath() : manifestPath(repo);
|
|
587
602
|
const m = readManifest(mp);
|