promptwheel 0.8.3 → 0.8.5

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.
@@ -254,6 +254,8 @@ export interface SetupFailure {
254
254
  // ---------------------------------------------------------------------------
255
255
 
256
256
  /** The Contract revision this build implements; bumps only when the verdict schema or the exit codes change. */
257
+ /** The output lines read as a missing dependency in the clean copy (module not found, a shell's "command not found"). */
258
+ export declare const MISSING_DEP: RegExp;
257
259
  export declare const CONTRACT_VERSION: '1';
258
260
  export declare const VERDICTS: readonly ['pass', 'fail', 'gamed', 'inconclusive'];
259
261
  export declare const METRIC_STATUSES: readonly ['improved', 'regressed', 'unchanged', 'inconclusive', 'unmeasurable'];
@@ -45,7 +45,10 @@ function tmpBase(repo) {
45
45
  try { rmSync(mkdtempSync(join(base, 'pw-probe-')), { recursive: true, force: true }); }
46
46
  catch {
47
47
  let gd = ''; try { gd = resolve(repo, execFileSync('git', ['-C', repo, 'rev-parse', '--git-common-dir'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim()); } catch { /* */ }
48
- if (gd) { base = join(gd, 'promptwheel-tmp'); try { mkdirSync(base, { recursive: true }); } catch { base = tmpdir(); } }
48
+ let ok = false;
49
+ if (gd) { const g = join(gd, 'promptwheel-tmp'); try { mkdirSync(g, { recursive: true }); rmSync(mkdtempSync(join(g, 'pw-probe-')), { recursive: true, force: true }); base = g; ok = true; } catch { /* */ } }
50
+ // a sandboxed shell (Claude Code's sandbox makes the temp folder and .git read-only): say so plainly, not with a stack
51
+ if (!ok) throw new Error('this shell cannot write a temp folder or .git (a sandboxed agent shell). Run the check outside the sandbox; under attach, the Stop hook checks each turn outside it.');
49
52
  }
50
53
  tmpBases.set(repo, base); return base;
51
54
  }
@@ -162,7 +165,7 @@ const exitCodes = new WeakMap();
162
165
  const neverRan = (samples) => { const c = exitCodes.get(samples) || []; return c.length > 0 && c.every((x) => x == null || x === 126 || x === 127); };
163
166
  // Why a metric's command failed, read from its output: a dependency the clean copy does not have reads differently
164
167
  // from tests that simply fail. A hint for the person, never part of a verdict.
165
- const MISSING_DEP = /Cannot find (?:module|package) ['"][^'"\n]+['"]|ERR_MODULE_NOT_FOUND[^\n]*|ModuleNotFoundError: [^\n]+|No module named [^\n]+|error TS2307: [^\n]+|[^\n:]*: (?:command )?not found[^\n]*|can't find crate[^\n]*|cannot find package [^\n]+/i;
168
+ const MISSING_DEP = /Cannot find (?:module|package) ['"][^'"\n]+['"]|ERR_MODULE_NOT_FOUND[^\n]*|ModuleNotFoundError: [^\n]+|No module named [^\n]+|error TS2307: [^\n]+|(?:^|\n)[^\n:]*(?:sh|bash|zsh|dash)(?::\s*\d+)?:[^\n]*?: (?:command )?not found[^\n]*|(?:^|\n)\S+: command not found[^\n]*|can't find crate[^\n]*|cannot find package [^\n]+/i;
166
169
  function whyFailed(text) {
167
170
  const m = String(text || '').replace(/\x1b\[[0-9;]*m/g, '').match(MISSING_DEP);
168
171
  return m ? { cause: 'missing-dependency', detail: m[0].trim().slice(0, 200) } : { cause: 'failing' };
@@ -1365,7 +1368,7 @@ function parseArgs(argv) {
1365
1368
 
1366
1369
  // pure, side-effect-free helpers are exported for unit testing; the CLI below only
1367
1370
  // runs when this file is executed directly (not when imported by the test suite).
1368
- export { extract, evaluate, median, spread, renderMarkdown, isNonSource, evaluatorMatcher, gain, judgeGaming, verdictFingerprint };
1371
+ export { MISSING_DEP, extract, evaluate, median, spread, renderMarkdown, isNonSource, evaluatorMatcher, gain, judgeGaming, verdictFingerprint };
1369
1372
 
1370
1373
  // ─────────────────────────────────────────────────────────────────────────────
1371
1374
  // Public library API: the Verified-Outcome Contract, in process.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptwheel",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "description": "A deterministic, zero-LLM check for your coding loop. A win must survive a re-run from the agent's source edits alone, so a test that went green by editing the test reads GAMED. Runs in CI or a Claude Code plugin.",
5
5
  "type": "module",
6
6
  "bin": {