Skip to content

Commit 9809ebe

Browse files
committed
refactor(cli): restructure flat 52-command surface into 12 subcommand groups
The CLI is becoming the primary agent tool surface (replacing MCP), but 52 commands in a flat alphabetical list is unusable for discovery. This restructure groups them hierarchically so `sprout --help` shows 12 domain groups and `sprout <group> --help` shows that group's subcommands with descriptions and examples. Breaking change — zero external consumers exist today. Key migrations: `sprout send-message` -> `sprout messages send`, `sprout approve-step --approved true` -> `sprout workflows approve`. Also deduplicates parse_event_id/parse_uuid into validate.rs, inlines the vestigial sign_and_submit_builder wrapper in channels.rs, and converts --approved from string to proper boolean flag.
1 parent 1b87a09 commit 9809ebe

7 files changed

Lines changed: 973 additions & 897 deletions

File tree

‎crates/sprout-cli/README.md‎

Lines changed: 88 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Two modes, checked in order:
2020
```bash
2121
# Option 1: Private key (NIP-98 signed requests)
2222
export SPROUT_PRIVATE_KEY="nsec1..."
23-
sprout list-channels
23+
sprout channels list
2424

2525
# Option 2: Dev mode (no auth)
2626
export SPROUT_PUBKEY="<hex>"
27-
sprout list-channels
27+
sprout channels list
2828
```
2929

3030
## Usage
@@ -36,106 +36,116 @@ All output is JSON on stdout. Errors are JSON on stderr. Exit codes: 0=ok, 1=use
3636
export SPROUT_RELAY_URL="https://relay.example.com"
3737

3838
# Messages
39-
sprout send-message --channel <uuid> --content "Hello"
40-
sprout send-message --channel <uuid> --content "Reply" --reply-to <event-id> --broadcast
41-
sprout get-messages --channel <uuid> --limit 20
42-
sprout get-thread --channel <uuid> --event <event-id>
43-
sprout search --query "architecture"
44-
sprout edit-message --event <event-id> --content "Updated text"
45-
sprout delete-message --event <event-id>
39+
sprout messages send --channel <uuid> --content "Hello"
40+
sprout messages send --channel <uuid> --content "Reply" --reply-to <event-id> --broadcast
41+
sprout messages get --channel <uuid> --limit 20
42+
sprout messages thread --channel <uuid> --event <event-id>
43+
sprout messages search --query "architecture"
44+
sprout messages edit --event <event-id> --content "Updated text"
45+
sprout messages delete --event <event-id>
4646

4747
# Diffs
48-
sprout send-diff-message --channel <uuid> --diff - --repo https://github.com/org/repo --commit abc123 < diff.patch
48+
sprout messages send-diff --channel <uuid> --diff - --repo https://github.com/org/repo --commit abc123 < diff.patch
4949

5050
# Channels
51-
sprout list-channels
52-
sprout create-channel --name "my-channel" --type stream --visibility open
53-
sprout join-channel --channel <uuid>
54-
sprout set-channel-topic --channel <uuid> --topic "New topic"
51+
sprout channels list
52+
sprout channels create --name "my-channel" --type stream --visibility open
53+
sprout channels join --channel <uuid>
54+
sprout channels topic --channel <uuid> --topic "New topic"
5555

5656
# Reactions
57-
sprout add-reaction --event <event-id> --emoji "👍"
58-
sprout get-reactions --event <event-id>
57+
sprout reactions add --event <event-id> --emoji "👍"
58+
sprout reactions get --event <event-id>
5959

6060
# Users & Presence
61-
sprout get-users # your own profile
62-
sprout get-users --pubkey <hex> # single user
63-
sprout get-users --pubkey <hex> --pubkey <hex> # batch (max 200)
64-
sprout set-presence --status online
61+
sprout users get # your own profile
62+
sprout users get --pubkey <hex> # single user
63+
sprout users get --pubkey <hex> --pubkey <hex> # batch (max 200)
64+
sprout users set-presence --status online
6565

6666
# DMs
67-
sprout open-dm --pubkey <hex>
68-
sprout list-dms
67+
sprout dms open --pubkey <hex>
68+
sprout dms list
6969

7070
# Workflows
71-
sprout list-workflows --channel <uuid>
72-
sprout trigger-workflow --workflow <uuid>
73-
sprout approve-step --token <uuid> --approved true
71+
sprout workflows list --channel <uuid>
72+
sprout workflows trigger --workflow <uuid>
73+
sprout workflows approve --token <uuid> --approved
7474

7575
# Forum
76-
sprout vote-on-post --event <event-id> --direction up
76+
sprout messages vote --event <event-id> --direction up
7777

7878
# Canvas
79-
sprout get-canvas --channel <uuid>
80-
sprout set-canvas --channel <uuid> --content "# Welcome"
79+
sprout canvas get --channel <uuid>
80+
sprout canvas set --channel <uuid> --content "# Welcome"
8181

8282
# Pipe to jq
83-
sprout list-channels | jq '.[].name'
83+
sprout channels list | jq '.[].name'
8484
```
8585

86-
## All 44 Commands
87-
88-
| Command | Description |
89-
|---------|-------------|
90-
| `send-message` | Send a message to a channel |
91-
| `send-diff-message` | Send a code diff with metadata |
92-
| `edit-message` | Edit a message you sent |
93-
| `delete-message` | Delete a message |
94-
| `get-messages` | List messages in a channel |
95-
| `get-thread` | Get a message thread |
96-
| `search` | Full-text search |
97-
| `list-channels` | List channels |
98-
| `get-channel` | Get channel details |
99-
| `create-channel` | Create a channel |
100-
| `update-channel` | Update channel name/description |
101-
| `set-channel-topic` | Set channel topic |
102-
| `set-channel-purpose` | Set channel purpose |
103-
| `join-channel` | Join a channel |
104-
| `leave-channel` | Leave a channel |
105-
| `archive-channel` | Archive a channel |
106-
| `unarchive-channel` | Unarchive a channel |
107-
| `delete-channel` | Delete a channel |
108-
| `list-channel-members` | List channel members |
109-
| `add-channel-member` | Add a member |
110-
| `remove-channel-member` | Remove a member |
111-
| `get-canvas` | Get channel canvas |
112-
| `set-canvas` | Set channel canvas |
113-
| `add-reaction` | React to a message |
114-
| `remove-reaction` | Remove a reaction |
115-
| `get-reactions` | List reactions |
116-
| `list-dms` | List DM conversations |
117-
| `open-dm` | Open a DM (1–8 pubkeys) |
118-
| `add-dm-member` | Add member to DM group |
119-
| `get-users` | Get user profile(s) |
120-
| `set-profile` | Update your profile |
121-
| `get-presence` | Get presence status |
122-
| `set-presence` | Set presence status |
123-
| `set-channel-add-policy` | Set who can add you to channels |
124-
| `list-workflows` | List workflows |
125-
| `create-workflow` | Create a workflow |
126-
| `update-workflow` | Update a workflow |
127-
| `delete-workflow` | Delete a workflow |
128-
| `trigger-workflow` | Trigger a workflow |
129-
| `get-workflow-runs` | Get workflow run history |
130-
| `get-workflow` | Get workflow definition |
131-
| `approve-step` | Approve/deny a workflow step |
132-
| `get-feed` | Get your activity feed |
133-
| `vote-on-post` | Vote on a forum post |
86+
## 54 Subcommands across 12 Groups
87+
88+
| Group | Subcommand | Description |
89+
|-------|-----------|-------------|
90+
| `messages` | `send` | Send a message to a channel |
91+
| | `send-diff` | Send a code diff with metadata |
92+
| | `edit` | Edit a message you sent |
93+
| | `delete` | Delete a message |
94+
| | `get` | List messages in a channel |
95+
| | `thread` | Get a message thread |
96+
| | `search` | Full-text search |
97+
| | `vote` | Vote on a forum post |
98+
| `channels` | `list` | List channels |
99+
| | `get` | Get channel details |
100+
| | `create` | Create a channel |
101+
| | `update` | Update channel name/description |
102+
| | `topic` | Set channel topic |
103+
| | `purpose` | Set channel purpose |
104+
| | `join` | Join a channel |
105+
| | `leave` | Leave a channel |
106+
| | `archive` | Archive a channel |
107+
| | `unarchive` | Unarchive a channel |
108+
| | `delete` | Delete a channel |
109+
| | `members` | List channel members |
110+
| | `add-member` | Add a member |
111+
| | `remove-member` | Remove a member |
112+
| `canvas` | `get` | Get channel canvas |
113+
| | `set` | Set channel canvas |
114+
| `reactions` | `add` | React to a message |
115+
| | `remove` | Remove a reaction |
116+
| | `get` | List reactions |
117+
| `dms` | `list` | List DM conversations |
118+
| | `open` | Open a DM (1–8 pubkeys) |
119+
| | `add-member` | Add member to DM group |
120+
| `users` | `get` | Get user profile(s) |
121+
| | `set-profile` | Update your profile |
122+
| | `presence` | Get presence status |
123+
| | `set-presence` | Set presence status |
124+
| `workflows` | `list` | List workflows |
125+
| | `get` | Get workflow definition |
126+
| | `create` | Create a workflow |
127+
| | `update` | Update a workflow |
128+
| | `delete` | Delete a workflow |
129+
| | `trigger` | Trigger a workflow |
130+
| | `runs` | Get workflow run history |
131+
| | `approve` | Approve/deny a workflow step |
132+
| `feed` | `get` | Get your activity feed |
133+
| `social` | `publish-note` | Publish a NIP-01 note |
134+
| | `set-contact-list` | Set NIP-02 contact list |
135+
| | `get-event` | Get a Nostr event |
136+
| | `get-user-notes` | Get notes for a user |
137+
| | `get-contact-list` | Get NIP-02 contact list |
138+
| `repos` | `create` | Announce a git repository (NIP-34) |
139+
| | `get` | Get a repository announcement |
140+
| | `list` | List repository announcements |
141+
| `upload` | `file` | Upload a file to the Blossom store |
142+
| `pack` | `validate` | Validate a persona pack (local, no relay) |
143+
| | `inspect` | Inspect a persona pack (local, no relay) |
134144

135145
## Architecture
136146

137147
```
138-
sprout <command> [flags]
148+
sprout <group> <subcommand> [flags]
139149
│
140150
├─ main.rs ──▶ commands/*.rs ──▶ client.rs ──▶ Sprout Relay REST API
141151
│ (clap) (handlers) (reqwest)

0 commit comments

Comments
 (0)