sawbuck 0.1.39 → 0.1.40

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sawbuck.mjs +15 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sawbuck",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
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",
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);