Skip to content

feat(wallet-cli): add mm daemon list for callable-surface discovery#9339

Merged
sirtimid merged 6 commits into
mainfrom
sirtimid/wallet-cli-daemon-list
Jul 1, 2026
Merged

feat(wallet-cli): add mm daemon list for callable-surface discovery#9339
sirtimid merged 6 commits into
mainfrom
sirtimid/wallet-cli-daemon-list

Conversation

@sirtimid

@sirtimid sirtimid commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

mm daemon call <Controller>:<method> can dispatch any registered messenger action, but a consumer had no way to see what's callable — and the surface grows silently as controllers are wired. This adds mm daemon list to enumerate it.

  • listActions RPC handler in the daemon, backed by the live messenger's getRegisteredActionTypes() (landed in feat(messenger): add getRegisteredActionTypes accessor #9271), so the list can never drift from what call actually accepts — no hand-kept catalog to rot.
  • mm daemon list command renders an indented, counted list on a TTY, and a bare, sorted, newline-delimited list when piped (so it pipes cleanly into grep/fzf).
  • README usage section refreshed: documents list, frames the surface as evolving (not a stability contract), links out to each controller's TypeDoc/README for exhaustive detail, and drops the stale @deprecated AccountsController:listAccounts example (fixed to KeyringController:getState).

Testing

  • New list.test.ts and a listActions handler test in daemon-entry.test.ts; package stays at 100% coverage.
  • build, test, lint, and changelog:validate all pass.

🤖 Generated with Claude Code


Note

Low Risk
CLI-only discovery and error-message refactors; no changes to wallet auth, key handling, or messenger dispatch semantics beyond a read-only introspection RPC.

Overview
Adds mm daemon list so users can see which messenger actions the running wallet daemon accepts via daemon call, without maintaining a static catalog.

The daemon exposes a new listActions JSON-RPC handler that returns messenger.getRegisteredActionTypes(), keeping discovery aligned with what call can dispatch. The CLI sorts actions lexicographically: on a TTY it prints a counted, indented list with usage hints; when piped it emits a bare newline-delimited list for grep/fzf.

mm daemon call now shares centralized socket and JSON-RPC error handling via makeDaemonConnectionError, formatJsonRpcError, and isStringArray in daemon/utils, including clearer messages for ECONNRESET and permission errors. README and changelog document list and refresh call examples.

Reviewed by Cursor Bugbot for commit e9a0545. Bugbot is set up for automated code reviews on this repo. Configure here.

@sirtimid sirtimid marked this pull request as ready for review July 1, 2026 11:16
@sirtimid sirtimid requested review from a team as code owners July 1, 2026 11:16
@sirtimid sirtimid temporarily deployed to default-branch July 1, 2026 11:16 — with GitHub Actions Inactive
@sirtimid sirtimid enabled auto-merge July 1, 2026 11:17
@sirtimid sirtimid force-pushed the sirtimid/wallet-cli-daemon-list branch from bf5b16c to c6ed2ec Compare July 1, 2026 14:35
sirtimid added a commit that referenced this pull request Jul 1, 2026
Follow-up to the `mm daemon list` review:

- Distinguish `ECONNRESET` (connection dropped mid-request, likely a
  daemon crash) from a stopped daemon, rather than telling the user to
  `mm daemon start` when one is already running.
- Name `MM_DATA_DIR` (the user-facing override) instead of the internal
  `MM_DAEMON_DATA_DIR` in the permission-denied hint.
- Extract a shared `formatJsonRpcError` helper and move `isStringArray`
  into `daemon/utils`; `daemon call` and `daemon list` now both use them.
- Parse argv in `daemon list` so unknown flags are rejected (matching
  `daemon call`).
- Fix the `daemon call` action example to a wired controller
  (`KeyringController:getState`).
- Point the connection-error changelog entry at #9339 (was #9343).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid added a commit that referenced this pull request Jul 1, 2026
Follow-up to the `mm daemon list` review:

- Distinguish `ECONNRESET` (connection dropped mid-request, likely a
  daemon crash) from a stopped daemon, rather than telling the user to
  `mm daemon start` when one is already running.
- Name `MM_DATA_DIR` (the user-facing override) instead of the internal
  `MM_DAEMON_DATA_DIR` in the permission-denied hint.
- Extract a shared `formatJsonRpcError` helper and move `isStringArray`
  into `daemon/utils`; `daemon call` and `daemon list` now both use them.
- Parse argv in `daemon list` so unknown flags are rejected (matching
  `daemon call`).
- Fix the `daemon call` action example to a wired controller
  (`KeyringController:getState`).
- Point the connection-error changelog entry at #9339 (was #9343).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid force-pushed the sirtimid/wallet-cli-daemon-list branch from 25db423 to 26cca95 Compare July 1, 2026 14:57
sirtimid added a commit that referenced this pull request Jul 1, 2026
Follow-up to the `mm daemon list` review:

- Distinguish `ECONNRESET` (connection dropped mid-request, likely a
  daemon crash) from a stopped daemon, rather than telling the user to
  `mm daemon start` when one is already running.
- Name `MM_DATA_DIR` (the user-facing override) instead of the internal
  `MM_DAEMON_DATA_DIR` in the permission-denied hint.
- Extract a shared `formatJsonRpcError` helper and move `isStringArray`
  into `daemon/utils`; `daemon call` and `daemon list` now both use them.
- Parse argv in `daemon list` so unknown flags are rejected (matching
  `daemon call`).
- Fix the `daemon call` action example to a wired controller
  (`KeyringController:getState`).
- Point the connection-error changelog entry at #9339 (was #9343).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid force-pushed the sirtimid/wallet-cli-daemon-list branch 2 times, most recently from 64ccbdb to 1376aa0 Compare July 1, 2026 15:03
sirtimid and others added 6 commits July 1, 2026 18:43
Add a `daemon list` command that prints the messenger actions the running
daemon can dispatch via `daemon call`. The daemon exposes a `listActions`
RPC handler backed by the live messenger's `getRegisteredActionTypes()`, so
the list can never drift from what `call` actually accepts. `list` renders an
indented, counted list on a TTY and a bare, sorted, newline-delimited list
when piped (greppable). Also refresh the README usage section and drop the
stale `@deprecated AccountsController:listAccounts` example.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Every existing test forced `process.stdout.isTTY` to a concrete boolean,
leaving the `?? false` nullish fallback on line 55 uncovered. Widen the
`withTTY` helper to accept `undefined` and add a case asserting the bare
non-TTY output, restoring 100% branch coverage for `list.ts`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the duplicated connection-error `catch` blocks in `daemon call`
and `daemon list` with a shared `makeDaemonConnectionError` helper that
maps daemon socket errno codes to a user-facing message. Aligns the
handled codes with `classifyUnreachable` (adds `ECONNRESET` and `EPERM`).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up to the `mm daemon list` review:

- Distinguish `ECONNRESET` (connection dropped mid-request, likely a
  daemon crash) from a stopped daemon, rather than telling the user to
  `mm daemon start` when one is already running.
- Name `MM_DATA_DIR` (the user-facing override) instead of the internal
  `MM_DAEMON_DATA_DIR` in the permission-denied hint.
- Extract a shared `formatJsonRpcError` helper and move `isStringArray`
  into `daemon/utils`; `daemon call` and `daemon list` now both use them.
- Parse argv in `daemon list` so unknown flags are rejected (matching
  `daemon call`).
- Fix the `daemon call` action example to a wired controller
  (`KeyringController:getState`).
- Point the connection-error changelog entry at #9339 (was #9343).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid force-pushed the sirtimid/wallet-cli-daemon-list branch from 1376aa0 to e9a0545 Compare July 1, 2026 16:45
@sirtimid sirtimid added this pull request to the merge queue Jul 1, 2026
Merged via the queue into main with commit ba3c869 Jul 1, 2026
409 checks passed
@sirtimid sirtimid deleted the sirtimid/wallet-cli-daemon-list branch July 1, 2026 16:55
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.

2 participants