feat: add list-wallets command#35
Conversation
Closes #24 Adds a `list-wallets` command that scans ~/.alby-cli for configured wallets and reports their name and connection status. Useful for users managing multiple NWC wallets via --wallet-name. Only wallet names and status (connected/pending) are reported; secret file contents are never read or exposed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 55 minutes and 10 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds a ChangesAdd list-wallets CLI command with centralized directory utilities
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/list-wallets.test.ts (1)
7-16: ⚡ Quick winImport types from source to prevent type drift.
These interface definitions duplicate types that exist in
src/utils.ts(per the PR summary). Duplicating types creates a maintenance risk: if the source types evolve, the test types won't automatically update, potentially masking type incompatibilities.♻️ Proposed refactor to import types from source
+import type { WalletInfo, ListWalletsOutput } from "../utils.js"; import { describe, test, expect, beforeEach, afterEach } from "vitest"; import { runCli } from "./helpers.js"; import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; import { tmpdir } from "node:os"; import { join } from "node:path"; - -interface WalletInfo { - name: string | null; - isDefault: boolean; - status: "connected" | "pending"; -} - -interface ListWalletsOutput { - directory: string; - wallets: WalletInfo[]; -}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/list-wallets.test.ts` around lines 7 - 16, Replace the duplicated test interfaces by importing the canonical types instead of redefining them: remove the local WalletInfo and ListWalletsOutput interface declarations and add an import-type for WalletInfo and ListWalletsOutput from the utils module where they are defined; update any references in the test to use those imported types so the test stays in sync with the source types.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/test/list-wallets.test.ts`:
- Around line 7-16: Replace the duplicated test interfaces by importing the
canonical types instead of redefining them: remove the local WalletInfo and
ListWalletsOutput interface declarations and add an import-type for WalletInfo
and ListWalletsOutput from the utils module where they are defined; update any
references in the test to use those imported types so the test stays in sync
with the source types.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fc6fd7b8-9d08-4189-8338-989da7425f41
📒 Files selected for processing (6)
README.mdsrc/commands/auth.tssrc/commands/list-wallets.tssrc/index.tssrc/test/list-wallets.test.tssrc/utils.ts
Closes #24
Adds a
list-walletscommand for users managing multiple NWC wallets. It scans~/.alby-clifor configured wallets and reports each wallet's name and connection status.Behaviour
--wallet-namewallets.statusasconnectedorpending(awaiting wallet approval). When both files exist for a name,connectedwins.Example
{ "directory": "/home/user/.alby-cli", "wallets": [ { "name": null, "isDefault": true, "status": "connected" }, { "name": "personal", "isDefault": false, "status": "connected" }, { "name": "test", "isDefault": false, "status": "pending" } ] }Changes
src/utils.ts— newlistWallets()andgetAlbyCliDir()helpers; refactored existing~/.alby-clipath construction to usegetAlbyCliDir().src/commands/list-wallets.ts— new command, registered in the Setup group.src/commands/auth.ts— usegetAlbyCliDir()helper.src/index.ts— wire up the command.src/test/list-wallets.test.ts— 7 tests.README.md— documented under "Multiple wallets".Verification
tsc --noEmitclean, build succeeds.helpunder Setup.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
list-walletsCLI command to display configured wallets and their connection status (connected or pending).Documentation
list-walletscommand usage example and description.