Severity: major. The only output of these commands goes to the wrong stream: secret generate mnemonic | tee file, $(secret generate mnemonic) and secret vault list --json | jq all receive nothing, so --json is unusable from a script.
What happens. The commands print through cobra's cmd.Println/cmd.Printf, which write to OutOrStderr(): stderr unless an output writer was set, and the binary sets none. secret list --json, secret info --json and secret get write to stdout.
Reproduction (SB_SECRET_STATE_DIR set to a fresh directory, vault made with secret init):
secret generate mnemonic | wc -c # 0: the mnemonic went to stderr
secret vault list --json | wc -c # 0: the JSON went to stderr
secret unlocker list --json | wc -c # 0
The text form of both listings and secret version list's "No versions found" go to stderr too.
Correct behaviour. README's Getting Started says secret generate mnemonic "prints a new BIP39 mnemonic", and the code comment says stdout. Listings and --json belong on stdout, as secret list --json and secret info --json already do. Status messages such as "Created vault" can stay on stderr.
Definition of done
The mnemonic, both listings in text and --json form, and "No versions found" go to stdout; the warning text of generate mnemonic stays on stderr.
A test runs the built binary, as TestGetCommandOutputsToStdout does, for generate mnemonic, vault list --json and unlocker list --json, and fails before the fix because stdout is empty.
Model: fable-5-1
Severity: major. The only output of these commands goes to the wrong stream: `secret generate mnemonic | tee file`, `$(secret generate mnemonic)` and `secret vault list --json | jq` all receive nothing, so `--json` is unusable from a script.
**What happens.** The commands print through cobra's `cmd.Println`/`cmd.Printf`, which write to `OutOrStderr()`: stderr unless an output writer was set, and the binary sets none. `secret list --json`, `secret info --json` and `secret get` write to stdout.
**Reproduction** (`SB_SECRET_STATE_DIR` set to a fresh directory, vault made with `secret init`):
```
secret generate mnemonic | wc -c # 0: the mnemonic went to stderr
secret vault list --json | wc -c # 0: the JSON went to stderr
secret unlocker list --json | wc -c # 0
```
The text form of both listings and `secret version list`'s "No versions found" go to stderr too.
**Where.** https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/generate.go#L106 (the comment above it says "Output mnemonic to stdout"), https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/vault.go#L208 and https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/vault.go#L211, https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/unlockers.go#L369 and https://git.eeqj.de/sneak/secret/src/commit/ef0ae90768c8b18a829033b3ebd4cf98fcaeb3d1/internal/cli/unlockers.go#L383.
**Correct behaviour.** README's Getting Started says `secret generate mnemonic` "prints a new BIP39 mnemonic", and the code comment says stdout. Listings and `--json` belong on stdout, as `secret list --json` and `secret info --json` already do. Status messages such as "Created vault" can stay on stderr.
**Definition of done**
- The mnemonic, both listings in text and `--json` form, and "No versions found" go to stdout; the warning text of `generate mnemonic` stays on stderr.
- A test runs the built binary, as `TestGetCommandOutputsToStdout` does, for `generate mnemonic`, `vault list --json` and `unlocker list --json`, and fails before the fix because stdout is empty.
Model: fable-5-1
sneak
was assigned by clawbot2026-10-13 00:30:12 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Severity: major. The only output of these commands goes to the wrong stream:
secret generate mnemonic | tee file,$(secret generate mnemonic)andsecret vault list --json | jqall receive nothing, so--jsonis unusable from a script.What happens. The commands print through cobra's
cmd.Println/cmd.Printf, which write toOutOrStderr(): stderr unless an output writer was set, and the binary sets none.secret list --json,secret info --jsonandsecret getwrite to stdout.Reproduction (
SB_SECRET_STATE_DIRset to a fresh directory, vault made withsecret init):The text form of both listings and
secret version list's "No versions found" go to stderr too.Where.
Correct behaviour. README's Getting Started says
secret generate mnemonic"prints a new BIP39 mnemonic", and the code comment says stdout. Listings and--jsonbelong on stdout, assecret list --jsonandsecret info --jsonalready do. Status messages such as "Created vault" can stay on stderr.Definition of done
--jsonform, and "No versions found" go to stdout; the warning text ofgenerate mnemonicstays on stderr.TestGetCommandOutputsToStdoutdoes, forgenerate mnemonic,vault list --jsonandunlocker list --json, and fails before the fix because stdout is empty.Model: fable-5-1