promptwheel 0.7.7 → 0.7.8

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.
@@ -233,16 +233,12 @@ export declare const DIRECTIONS: readonly ['up', 'down', 'pass'];
233
233
  export declare function verdictExitCode(verdict: Verdict | string): 0 | 1 | 2 | 3;
234
234
 
235
235
  /**
236
- * Run the gate in process and return the Section 2 verdict object (identical to `run --json`).
236
+ * Runs the gate in process and returns the Section 2 verdict object (identical to `run --json`).
237
237
  * Measures only in throwaway git worktrees, never the caller's working tree. Never prints and
238
- * never calls `process.exit`; throws a plain `Error` on a precondition failure (not a git
239
- * repository, `auto: false` with no config, a `config` without a non-empty `metrics` array).
240
- */
241
- /**
242
- * Runs the gate in process and returns the report. Never prints and never exits the process: a
243
- * precondition failure (not a git repository, a missing, malformed or cyclic config, a missing
244
- * `extends` target, no commits yet) throws an Error whose `name` is `'ConfigError'` and whose
245
- * `exitCode` is 64, the code the CLI exits with for the same condition.
238
+ * never calls `process.exit`: every precondition failure (not a git repository, `auto: false`
239
+ * with no config, a `config` without a non-empty `metrics` array, a malformed or cyclic config,
240
+ * a missing `extends` target, no commits yet) throws an Error whose `name` is `'ConfigError'`
241
+ * and whose `exitCode` is 64, the code the CLI exits with for the same condition.
246
242
  */
247
243
  export declare function check(options?: CheckOptions): Report;
248
244
 
@@ -1120,8 +1120,9 @@ export function verdictExitCode(verdict) {
1120
1120
  // Run the gate in process and RETURN the Section 2 verdict object (identical to what
1121
1121
  // `run --json` prints). Measurement happens only in throwaway worktrees, never the
1122
1122
  // caller's working tree (constitution #4). This function never prints and never calls
1123
- // process.exit; it throws a plain Error on a precondition failure (not a git repo, or a
1124
- // missing / invalid config). Reproducible from (base, head, config) alone.
1123
+ // process.exit; every precondition failure (not a git repo, a missing / invalid config, no
1124
+ // commits) throws an Error named ConfigError with exitCode 64. Reproducible from (base, head,
1125
+ // config) alone.
1125
1126
  //
1126
1127
  // repo string repo path (default: discovered from process.cwd())
1127
1128
  // base string base ref (default: merge-base vs origin/main..., else HEAD~1)
@@ -1139,14 +1140,15 @@ export function check(options = {}) {
1139
1140
  try {
1140
1141
  repo = options.repo ? realpathSync(options.repo)
1141
1142
  : git(['rev-parse', '--show-toplevel'], process.cwd());
1142
- } catch { throw new Error(`promptwheel check: not inside a git repository (${options.repo || process.cwd()})`); }
1143
+ git(['rev-parse', '--show-toplevel'], repo); // an existing path that is not a repository fails here
1144
+ } catch { bad(`promptwheel check: not inside a git repository (${options.repo || process.cwd()})`); }
1143
1145
 
1144
1146
  let config = options.config;
1145
1147
  if (config !== undefined) {
1146
1148
  if (!config || typeof config !== 'object' || !Array.isArray(config.metrics) || config.metrics.length === 0)
1147
- throw new Error('promptwheel check: options.config.metrics must be a non-empty array');
1149
+ bad('promptwheel check: options.config.metrics must be a non-empty array');
1148
1150
  } else if (!hasConfigFile(repo)) {
1149
- if (options.auto === false) throw new Error(`promptwheel check: no promptwheel.config.json in ${repo} (pass options.config, or allow auto-detect)`);
1151
+ if (options.auto === false) bad(`promptwheel check: no promptwheel.config.json in ${repo} (pass options.config, or allow auto-detect)`);
1150
1152
  config = autoConfig(repo); // zero-config: gate the detected test command in process
1151
1153
  }
1152
1154
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptwheel",
3
- "version": "0.7.7",
3
+ "version": "0.7.8",
4
4
  "description": "A deterministic, zero-LLM check for your coding loop. It proves every change earned its win by re-running the result from the agent's source edits alone, so a green that came from editing the test reads GAMED. Runs in CI or a Claude Code hook, or import { check } in process.",
5
5
  "type": "module",
6
6
  "bin": {