Skip to content

refactor(cli): restructure flat commands into 12 subcommand groups#585

Merged
wpfleger96 merged 6 commits into
mainfrom
wpfleger/refactor-cli-subcommand-groups
May 14, 2026
Merged

refactor(cli): restructure flat commands into 12 subcommand groups#585
wpfleger96 merged 6 commits into
mainfrom
wpfleger/refactor-cli-subcommand-groups

Conversation

@wpfleger96
Copy link
Copy Markdown
Collaborator

@wpfleger96 wpfleger96 commented May 14, 2026

Summary

  • Restructures the Sprout CLI from a flat command surface into 12 hierarchical subcommand groups (e.g. sprout send-messagesprout messages send), across messages, channels, canvas, reactions, dms, users, workflows, feed, social, repos, upload, pack
  • Every flag and argument now has a /// doc comment that renders in --help output — no bare parameters remain
  • Adds typed value_enum for --type (stream/forum), --visibility (open/private), and --status (online/away/offline) so clap rejects invalid values at parse time and --help shows valid options
  • Fixes the --approved flag on workflows approve — was broken (--no-approved rejected by clap). Now uses ArgAction::Set accepting --approved true / --approved false
  • Delegates dispatch from a monolithic 370-line run() match to per-module dispatch() functions, shrinking run() to ~30 lines
  • Renames SocialCmd subcommands to remove redundant prefixes: publish-notepublish, get-eventevent, get-user-notesnotes, get-contact-listcontacts, set-contact-listset-contacts
  • Deduplicates parse_event_id / parse_uuid into validate.rs, removes redundant validate_uuid + parse_uuid double-parse from 13 call sites, inlines vestigial sign_and_submit_builder wrapper
  • Adds subcommand_names_are_stable test asserting exact subcommand names per group (not just counts), preventing silent renames
  • Removes stale SPROUT_PUBKEY documentation from README.md and TESTING.md (env var is not wired in CLI source)
  • Adds long_about to the top-level sprout --help with configuration env vars, exit code table, and JSON error format — useful for both humans and agents parsing CLI output programmatically
  • Updates README.md and TESTING.md for new hierarchical syntax, new social names, and corrected auth docs

Rebased on #589 — workflow, DM, and presence write commands now use sprout_sdk builders instead of raw nostr::EventBuilder. workflows update gained a --channel flag (required by the updated build_workflow_update builder).

Zero external consumers — this is the right moment for a breaking interface change before the CLI becomes the primary agent tool surface.

@wpfleger96 wpfleger96 requested a review from wesbillman as a code owner May 14, 2026 18:55
@wpfleger96 wpfleger96 changed the title refactor(cli): restructure flat 52-command surface into 12 subcommand groups refactor(cli): restructure 54 commands into 12 hierarchical groups May 14, 2026
@wpfleger96 wpfleger96 changed the title refactor(cli): restructure 54 commands into 12 hierarchical groups refactor(cli): restructure flat 54-command surface into 12 subcommand groups May 14, 2026
@wesbillman
Copy link
Copy Markdown
Collaborator

@codex please review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wesbillman
Copy link
Copy Markdown
Collaborator

@wpfleger96 this LGTM! I'll check with @tlongwell-block to see how he's feeling

… 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.
The initial restructuring commit (9809ebe) was reviewed by 3 Claude
specialists, Codex, Gemini, and the plan author. This commit addresses
all 15 findings — 1 blocking bug, 10 should-fix, 4 optional.

Critical: --approved flag used default_value_t which broke --no-approved
negation. Changed to ArgAction::Set accepting --approved true/false.

Added doc comments to all ~78 bare arg fields, value_enum types for
--type/--visibility/--status, per-module dispatch() delegation
(shrinking run() from 370 to 30 lines), social subcommand renames
(publish-note→publish, get-event→event, etc.), subcommand name
assertions in tests, and stale SPROUT_PUBKEY doc removal.
The subcommand-level --relay flag on `repos create` shadowed the global
--relay flag (Sprout API endpoint). Renamed to --nostr-relay to avoid
clap parsing ambiguity — these are NIP-34 preferred relays for repo
discovery, not the Sprout relay URL.
Adds structured help text to the top-level sprout --help showing
configuration env vars, exit code table, and JSON error format —
useful for both humans and agents parsing CLI output programmatically.
Both branches added parse_uuid to validate.rs — keep the version
with the more descriptive error message (includes parse error detail).
The channel field had "Workflow UUID" as its doc comment instead of
"Channel UUID the workflow belongs to". Also adds missing doc comment
on the workflow field.
@wpfleger96 wpfleger96 force-pushed the wpfleger/refactor-cli-subcommand-groups branch from 7cc93c1 to 0048347 Compare May 14, 2026 22:59
@wpfleger96 wpfleger96 changed the title refactor(cli): restructure flat 54-command surface into 12 subcommand groups refactor(cli): restructure flat commands into 12 subcommand groups May 14, 2026
@wpfleger96 wpfleger96 merged commit 1d8a130 into main May 14, 2026
15 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/refactor-cli-subcommand-groups branch May 14, 2026 23:13
wpfleger96 added a commit that referenced this pull request May 15, 2026
base_prompt.md now leads with the sprout CLI (12 subcommand groups from
#585) rather than MCP tools, which are still available but secondary.
Adds the @mention formatting rule (no bold/italic), get_feed type
filtering, and a pointer to nest_agents.md for workspace conventions.

Reverts the hardcoded model/provider on Solo, Kit, and Scout back to
None. The agent binary's own default is the right choice here — pinning
claude-sonnet-4-20250514 is opinionated and will go stale. Users who
want a specific model can set it per-agent via the model picker.
wpfleger96 added a commit that referenced this pull request May 15, 2026
base_prompt.md now leads with the sprout CLI (12 subcommand groups from
#585) rather than MCP tools, which are still available but secondary.
Adds the @mention formatting rule (no bold/italic), get_feed type
filtering, and a pointer to nest_agents.md for workspace conventions.

Reverts the hardcoded model/provider on Solo, Kit, and Scout back to
None. The agent binary's own default is the right choice here — pinning
claude-sonnet-4-20250514 is opinionated and will go stale. Users who
want a specific model can set it per-agent via the model picker.
tlongwell-block added a commit that referenced this pull request May 15, 2026
* origin/main: (33 commits)
  dev-mcp: add view_image tool (#602)
  fix(relay,desktop): only advertise NIP-43 when enforced; probe pairing by supported_nips (#601)
  fix(desktop): derive unread state from NIP-RS + relay catch-up only (#599)
  docs(testing): rewrite TESTING.md for current API and CLI-first workflow (#597)
  fix(agent): fix OpenAI-compat request body serialization and max_tokens (#595)
  feat(desktop): per-persona and per-agent env var overrides (#594)
  fix(desktop): stop pinning agents to deprecated SPROUT_ACP_TURN_TIMEOUT (#592)
  fix(desktop): populate member_count in get_channels so channel browser shows real counts (#548)
  fix(desktop): autofocus message composer on channel/thread open (#572)
  refactor(cli): restructure flat commands into 12 subcommand groups (#585)
  feat(sdk): add builder functions for workflows, DMs, and presence (#589)
  feat(desktop): add message more-actions dropdown menu (#590)
  fix(mobile): preserve channel list across background/resume reconnection (#588)
  Redesign Home as an inbox (#582)
  fix(desktop): drive unread badges from live subscription, not refetched lastMessageAt (#581)
  fix(desktop): refine header scaling and shadow (#573)
  fix(desktop): keep day dividers below header (#574)
  Move agent activity below composer (#579)
  docs(nips): NIP-AE — Agent Engrams (#575)
  refactor: extract shared @mention resolver into sprout-sdk (#580)
  ...

Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
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.

3 participants