Measured (median of 9 spawns, this machine, 2026-09-11)
libby init --help — 2442 ms, exit 0. The init branch (bin/libby.mjs:232-235) ignores all args and always calls runInit(), which non-interactively:
- network-probes
detectInsecureTLS (src/init.mjs:64-75)
- resolves the saved library key over the network (
src/init.mjs:93)
- runs
authenticate (src/init.mjs:119) — cached-session verify() = GET /chip/sync
- reaches
saveConfig (src/init.mjs:134)
This run's probes + authenticate did execute (that is the 2.4 s); the owner's config.json/session.json were verified untouched by mtime afterward — but a wizard run that completes its save would rewrite the user config as a side effect of asking for help.
Fix shape
In the init branch, handle --help/-h before runInit(): print init usage, exit 0. Everything else about runInit is out of scope.
Out-of-scope observation for the owner (no change proposed in this ticket): non-TTY libby init runs the whole wizard silently on saved defaults — stdin-closed prompts resolve instantly, so a scripted/accidental invocation can network-probe, re-authenticate, and rewrite config with nobody watching.
Acceptance
libby init --help prints usage and exits 0 with spawn median within noise of libby help; zero network (hermetic: run with XDG_CONFIG_HOME pointed at an empty temp dir so even a regression cannot touch the real config).
- Spawn pin in
test/cli-lazy.test.mjs for the above.
libby init without flags still starts the wizard (no behavior change).
node --test green; changes confined to bin/libby.mjs + test/cli-lazy.test.mjs.
Related: #10 (usage-error paths pay session bootstrap), #12 (cached-session verify cost).
Measured (median of 9 spawns, this machine, 2026-09-11)
libby init --help— 2442 ms, exit 0. The init branch (bin/libby.mjs:232-235) ignores all args and always callsrunInit(), which non-interactively:detectInsecureTLS(src/init.mjs:64-75)src/init.mjs:93)authenticate(src/init.mjs:119) — cached-sessionverify()=GET /chip/syncsaveConfig(src/init.mjs:134)This run's probes + authenticate did execute (that is the 2.4 s); the owner's config.json/session.json were verified untouched by mtime afterward — but a wizard run that completes its save would rewrite the user config as a side effect of asking for help.
Fix shape
In the init branch, handle
--help/-hbeforerunInit(): print init usage, exit 0. Everything else aboutrunInitis out of scope.Out-of-scope observation for the owner (no change proposed in this ticket): non-TTY
libby initruns the whole wizard silently on saved defaults — stdin-closed prompts resolve instantly, so a scripted/accidental invocation can network-probe, re-authenticate, and rewrite config with nobody watching.Acceptance
libby init --helpprints usage and exits 0 with spawn median within noise oflibby help; zero network (hermetic: run withXDG_CONFIG_HOMEpointed at an empty temp dir so even a regression cannot touch the real config).test/cli-lazy.test.mjsfor the above.libby initwithout flags still starts the wizard (no behavior change).node --testgreen; changes confined tobin/libby.mjs+test/cli-lazy.test.mjs.Related: #10 (usage-error paths pay session bootstrap), #12 (cached-session verify cost).