Save values in bench.local.env: bench.sh init writes a template

./bench.sh init writes a commented bench.local.env next to bench.sh; fill it
in once and the run is just ./bench.sh (--dry-run, --full). New saved keys:
BENCH_ENDPOINT, BENCH_MODEL, BENCH_SERVER_CMD_FILE, BENCH_ENV_FILE.
--settings FILE picks another file (a second server or model).

The file is now read as KEY=value data instead of being sourced: no code in
it runs, the environment wins over it (flags > environment > file), relative
paths are relative to the file, and BETTERBENCH_API_KEY in it is refused.
Each run says which values came from the file. A missing value's error
points to the file and to init.

AGENTS.md: read the file for round 1 defaults, offer to save the confirmed
values after round 2. 11 new tests (47 in all).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EooZ9aTJE7srSQEYUqdQio
This commit is contained in:
Claude committed 2026-11-01 20:41:55 +00:00
1 parent 1c50b7b1fb
commit 6cb02ecc0a
5 files changed
+274 -19

No files matched your search

+9
View File
@@ -62,6 +62,10 @@ Before I start, a few questions. Answer by number; "find it" is fine for any of
10. May I install BetterBench if it's missing? [yes; I'll ask before upgrading one]
```
If `bench.local.env` exists next to `bench.sh` (your human saved values with
`./bench.sh init`), read it first and put its values in as the defaults. It never holds
the API key, so it's safe to read. Still ask every question; a saved value can be stale.
What the answers mean:
- **2 = no:** BetterBench runs elsewhere. Use `--env-file` ([below](#when-something-goes-wrong)).
- **4 = yes:** wait until they say it's set. Check with `[ -n "$BETTERBENCH_API_KEY" ]`,
@@ -161,6 +165,11 @@ Every `bench.sh: warning:` needs fixing or an explanation before the real run. F
`--X A but the launch command sets ...: declare --X B`, don't just switch to B: show it
here and let your human decide. Rerun the dry run after any change.
Once the values are confirmed, offer to save them, so the next run needs no typing:
`./bench.sh init` writes `bench.local.env` (it refuses to overwrite one), then fill in
the confirmed values. Ask before changing an existing file. After that the run is
just `./bench.sh` plus `--dry-run` or `--full`.
### 7. Quick run
Run the same command without `--dry-run`. This is a quick check of a few minutes,