feat(cli): make agentkeys init idempotent#167
Conversation
…t is discoverable The idempotent init path printed only "Already initialized as <wallet>", giving an operator no on-screen hint for how to deliberately re-initialize. Per the project's no-remembered-flags preference (auto-detect over flags; never make the operator recall a flag), surface the override at the exact moment it's relevant: Already initialized as 0x... -> Already initialized as 0x.... Run 'agentkeys init --force' to re-initialize. The default path stays flagless and idempotent; --force remains the single explicit, now self-advertising, escape hatch (its intent — discard a still -valid session — is not derivable from state, so it cannot be auto-detected). Updates the idempotent-init test assertion to match. Refs #3
|
Pushed a small follow-up to this branch ( What changed — the idempotent path now names the override in its own output: Why — this repo's standing preference is auto-detect over flags; never make the operator recall a flag (the CLAUDE.md "idempotent remote-setup" rule, e.g. why we never pass
The only gap was that a dead-end
Non-blocking follow-up (optional): |
Change:
agentkeys init.agentkeys init --forceto intentionally re-run initialization when a usable local session already exists.cmd_init, withcmd_init_with_forcefor forced paths.Objective Evidence:
cargo fmt --check(exit code 0)cargo test -p agentkeys-cli init_(exit code 0)cargo test -p agentkeys-cli --tests(exit code 0)Visual Evidence:
Reviewer:
Risks / Not Covered:
Refs #3