feat(auth): Add auth refresh-token view command#76
Conversation
doistbot
left a comment
There was a problem hiding this comment.
This PR adds attachRefreshTokenViewCommand for auth refresh-token view, printing the stored refresh token with pipe-safe output and thorough test coverage.
Few things worth tightening:
- The attacher hardcodes the
refresh-tokenparent group, which breaks the pattern established byattachTokenViewCommandand prevents consumers from adding other commands (e.g.clear,revoke) to that group. Consider droppinggroupName/groupDescriptionfrom the options and attaching a single command, letting consumers create the group themselves. - The explicit
--usermiss translation duplicates logic thatrequireSnapshotForRefalready centralizes foractive(). Generalizing that helper (or adding a bundle variant) would keepACCOUNT_NOT_FOUND/NOT_AUTHENTICATEDbehavior consistent acrosstoken,status, andrefresh-token view.
I also included a few optional follow-up notes in the details below.
Optional follow-up note (1)
- [P3] src/auth/refresh-token-view.ts:45: This reimplements the explicit-
--usermiss translation thatrequireSnapshotForRefalready centralizes foractive(). Now that bundle reads are part of the public auth surface too, it would be better to generalize that helper or add a bundle variant here, soACCOUNT_NOT_FOUND/NOT_AUTHENTICATEDbehavior stays in one place instead of drifting acrosstoken,status, andrefresh-token view.
| const group = parent | ||
| .command(options.groupName ?? 'refresh-token') | ||
| .description(options.groupDescription ?? 'Manage the saved refresh token') | ||
| const command = group |
There was a problem hiding this comment.
🟡 P2 attachRefreshTokenViewCommand hardcodes the creation of a refresh-token parent group, which breaks the pattern established by attachTokenViewCommand. If a consumer CLI wants to add other commands to the refresh-token group (e.g. clear or revoke), they cannot easily do so because this attacher creates and owns the group (and Commander does not merge duplicate .command() calls on the same parent).
Consider matching attachTokenViewCommand: remove groupName/groupDescription from the options, and attach exactly one command (options.name ?? 'refresh-token'). If consumers want auth refresh-token view, they can create the group themselves and pass it as parent with name: 'view', exactly as the README advises for token view.
## [0.26.0](v0.25.1...v0.26.0) (2026-06-18) ### Features * **auth:** Add auth refresh-token view command ([#76](#76)) ([48d7248](48d7248))
|
🎉 This PR is included in version 0.26.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
attachRefreshTokenViewCommandforauth refresh-token viewstore.activeBundle(ref)with pipe-safe output--userbehaviorThis is basically a copy of
token-view.tsand its tests adapted for the refresh token.Tests
npm run checknpm run type-checknpm testnpm run build