fix: wallet list writes only JSON to stdout (#154) - #584
Conversation
pr-reviewer Summary for #0b7b1b9✅ No issues found The code review completed successfully with no findings. Review effort: 2/5 (Simple) SummaryThis is a clean, well-scoped bug fix. The core change — having A few things I verified and found to be fine:
No actionable findings. Token usage: 4,932 input, 4,362 output, 531,346 cache read, 35,344 cache write | Usage Guide New pushes are reviewed automatically with a 10-minute cooldown between reviews. To request a review at any time, comment |
There was a problem hiding this comment.
Auto-approved
This PR was automatically approved because:
- Claude recommends approval
- Claude assessed this as a moderate effort change
- The effort level is within the auto-approval threshold of 2
- No high or critical issues were detected
- Review comment contains non-blocking feedback
If you have any concerns, please request a manual review.
There was a problem hiding this comment.
Auto-approved
This PR was automatically approved because:
- Claude recommends approval
- Claude assessed this as a moderate effort change
- The effort level is within the auto-approval threshold of 2
- No high or critical issues were detected
If you have any concerns, please request a manual review.
Fixes #154.
Problem
nansen wallet listwrote its human-readable summary directly to stdout viaconsole.logand returnedundefined, so the CLI's normal{success, data}JSON envelope was never emitted.nansen wallet list | jq .had nothing valid to parse — breaking scripting/agent use, which this CLI is explicitly built for.Fix
listhandler now returns thelistWallets()result instead ofundefined, so the existing CLI dispatcher wraps it in the standard{"success":true,"data":{...}}envelope and prints it to stdout — consistent with every other command.stderrvia theerrorOutputdep, so a human running it interactively still gets the friendly view, but stdout stays clean JSON.--pretty,--table, and--csvnow work onwallet listtoo, since they're handled generically byformatOutputonce the command returns data instead of short-circuiting.errorOutputinstead oflog, and added two new tests covering the stdout/stderr split for both the populated and empty-wallet cases.Testing
The 5 failures are all pre-existing, in
src/__tests__/doctor.test.js, and reproduce identically onmainwithout this change — they rely onchmod-based unreadable-file simulation, which doesn't apply when tests run as root. Unrelated to this fix.Clean, no output.
Manual verification:
Human-readable summary confirmed on stderr, not stdout.
Checklist
npm testpasses (output above; unrelated pre-existing failures noted)npm run lintpassesconsole.login core (uses injectedlog/errorOutputdeps)patch— bug fix, user-facing output behavior change)src/schema.json— no changes needed (no new commands/options)