feat: sprout-cli — agent-first CLI with full MCP parity (48 commands)#158
Merged
tlongwell-block merged 3 commits intomainfrom Mar 22, 2026
Merged
feat: sprout-cli — agent-first CLI with full MCP parity (48 commands)#158tlongwell-block merged 3 commits intomainfrom
tlongwell-block merged 3 commits intomainfrom
Conversation
Complete rewrite of sprout-cli as an agent-first, JSON-only CLI covering
all 42 MCP tools plus 6 CLI-only commands (token management, auth,
get-workflow, delete-channel).
## CLI (new crate: sprout-cli)
- 48 flat commands matching MCP tool names (sprout send-message, etc.)
- Pure JSON stdout, structured JSON errors on stderr
- Exit codes: 0=ok, 1=user, 2=network, 3=auth, 4=other
- Three-tier auth: SPROUT_API_TOKEN > SPROUT_PRIVATE_KEY (auto-mint) > SPROUT_PUBKEY
- Input validation before every network call (UUID, hex64, content size, enums)
- Single request() method — no HTTP method duplication
- 38 unit tests, clippy clean
## Relay (2 new REST endpoints)
- PUT /api/messages/{event_id} — edit message (kind:40003)
- POST /api/messages/{event_id}/votes — vote on forum post (kind:45002)
These were previously WebSocket-only. Adding REST endpoints makes the
relay API feature-complete and enables the CLI to cover all 42 MCP tools
without WebSocket/Nostr signing complexity.
## Why a rewrite
The previous CLI scored 3/10 in crossfire review (Opus + Codex):
- Did not compile (5 errors)
- 13 commands vs 42 MCP tools
- Token minted on every invocation
- No input validation
- Architecture doc described a different app
The new CLI was crossfired to 9-10/10 (Opus 9/10, Codex 10/10).
- Add crates/sprout-cli/TESTING.md: live testing runbook covering all 48 commands, 3 auth modes, error paths, and cleanup. Crossfired to 8.5/10. - Fix NIP-98 x-forwarded-proto header in auto_mint_token and cmd_auth. The relay defaults x-forwarded-proto to 'https', causing URL mismatch on localhost (http://). Both functions now send the correct scheme header. - Fix workflow YAML examples in TESTING.md to use correct trigger format (tagged enum with 'on:' field, not bare string). - Fix open-dm field extraction (relay returns 'channel_id' not 'id').
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
sprout-clicrate — an agent-first, JSON-only CLI for the Sprout relay. 48 commands covering all 42 MCP tools plus token management, auth bootstrap, and additional REST-only operations. Also adds two new REST endpoints to the relay.CLI (
crates/sprout-cli)Design: Pure JSON on stdout, structured JSON errors on stderr, meaningful exit codes (0/1/2/3/4). Designed for agent consumption — no tables, no colors, no rendering dependencies.
Auth: Three-tier resolution:
SPROUT_API_TOKEN— Bearer token (fastest, no extra HTTP call)SPROUT_PRIVATE_KEY— auto-mints a 1-day token via NIP-98 at startupSPROUT_PUBKEY— X-Pubkey header (dev mode,SPROUT_REQUIRE_AUTH_TOKEN=false)Architecture:
Stats: ~2900 lines across 13 source files. 38 unit tests. Clippy clean (workspace
-D warnings).Relay (2 new REST endpoints)
PUT /api/messages/{event_id}— edit message (kind:40003)POST /api/messages/{event_id}/votes— vote on forum post (kind:45002)These were previously WebSocket-only in the MCP server. Adding REST endpoints makes the relay API feature-complete and lets the CLI stay pure REST.
Commands (48 total)
Full command list
Messages:
send-message,send-diff-message,edit-message,delete-message,get-messages,get-thread,searchChannels:
list-channels,get-channel,create-channel,update-channel,set-channel-topic,set-channel-purpose,join-channel,leave-channel,archive-channel,unarchive-channel,delete-channel,list-channel-members,add-channel-member,remove-channel-member,get-canvas,set-canvasReactions:
add-reaction,remove-reaction,get-reactionsDMs:
list-dms,open-dm,add-dm-memberUsers:
get-users,set-profile,get-presence,set-presence,set-channel-add-policyWorkflows:
list-workflows,create-workflow,update-workflow,delete-workflow,trigger-workflow,get-workflow-runs,get-workflow,approve-stepFeed:
get-feedForum:
vote-on-postAuth & Tokens:
auth,list-tokens,delete-token,delete-all-tokensTesting
All 48 commands verified against a local relay. See
crates/sprout-cli/TESTING.mdfor the full runbook.