Name only the mnemonic when it cannot be read (closes #115)
check / check (push) Failing after 2s

secret init and secret vault create read the mnemonic with the new
secret.ReadMnemonic, whose every error wraps the new
secret.ErrMnemonicNotRead. It shares the terminal read with ReadPassphrase,
whose errors still wrap ErrPassphraseNotRead. Without a terminal the error
names the environment variable that gives the value instead:
SB_SECRET_MNEMONIC for the mnemonic, SB_UNLOCK_PASSPHRASE for the
passphrase. A test pins the message of init without a terminal.

Model: opus-5-5
This commit was merged in pull request #116.
This commit is contained in:
2026-10-05 01:43:00 +02:00
parent 43f66bf369
commit 2503f2db96
5 changed files with 86 additions and 23 deletions
+12
View File
@@ -18,6 +18,18 @@ https://git.eeqj.de/sneak/secret/milestone/12
# Completed Steps
- 2026-10-04: A mnemonic that cannot be read, in `secret init` and
`secret vault create`, gives an error that names the mnemonic only
(https://git.eeqj.de/sneak/secret/issues/115). It is read with
`secret.ReadMnemonic`, whose every error wraps the new
`secret.ErrMnemonicNotRead`; before, it was read with `ReadPassphrase`, so
the message said "failed to read mnemonic: failed to read passphrase:" and
advised setting `SB_UNLOCK_PASSPHRASE`. Without a terminal it now says
"failed to read mnemonic: stdin is not a terminal (piped input or script).
Please set the SB_SECRET_MNEMONIC environment variable or run
interactively". The passphrase messages no longer repeat "cannot read
passphrase" after "failed to read passphrase:", and empty input gives
"nothing was entered".
- 2026-10-04: A failure returns the same error value whichever command hits
it (https://git.eeqj.de/sneak/secret/issues/113). `internal/cli` no longer
keeps its own copies of `vault.ErrSecretNotFound`, `ErrVaultNotFound`,