Skip to content

fix: wallet list routes human-readable summary to stderr, keeps only JSON on stdout - #406

Closed
Nicolai1205 wants to merge 4 commits into
mainfrom
fix/154-wallet-list-stderr-rebased
Closed

fix: wallet list routes human-readable summary to stderr, keeps only JSON on stdout#406
Nicolai1205 wants to merge 4 commits into
mainfrom
fix/154-wallet-list-stderr-rebased

Conversation

@Nicolai1205

Copy link
Copy Markdown
Contributor

Fixes #154

Rebased version of #289 (which had a merge conflict) onto current main.

What

nansen wallet list was writing human-readable text to stdout alongside JSON, breaking agent pipelines that use | jq ..

How

  • Route human-readable wallet summary to stderr via ttyOutput = console.error dep
  • Keep clean JSON output on stdout only
  • Interactive users still see the summary (it goes to stderr which terminals display)
  • Agent pipelines work: nansen wallet list | jq .

Test

nansen wallet list        # human-readable summary on stderr, JSON on stdout
nansen wallet list | jq . # parses cleanly

All 929 tests pass.

@erhnysr

erhnysr commented Sep 4, 2026

Copy link
Copy Markdown

Reopening this line of work in #576. This PR was closed on the understanding that the fix had already landed via #397 — but #397's diff only extracted a requireWalletFile() helper for the existence checks in showWallet/exportWallet/setDefaultWallet/deleteWallet; it never touched listWallets or the list handler. A full git log -L :listWallets:src/wallet.js trace confirms no commit ever introduced stderr/stdout separation for it, so the bug is still live on main. #576 is a fresh fix (summary → stderr, structured { wallets } → clean JSON on stdout) with a failing-first regression test and the full suite green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🟡 [Medium] wallet list writes human-readable text + JSON to stdout simultaneously (breaks piping)

4 participants