feat: Add --json flag for LLM-friendly CLI help output#335
Open
aronchick wants to merge 1 commit intodlorenc:mainfrom
Open
feat: Add --json flag for LLM-friendly CLI help output#335aronchick wants to merge 1 commit intodlorenc:mainfrom
aronchick wants to merge 1 commit intodlorenc:mainfrom
Conversation
Add support for machine-readable JSON output of the command tree: - `multiclaude --json` outputs full command tree as JSON - `multiclaude --help --json` same as above - `multiclaude <cmd> --json` outputs that command's schema This enables LLMs and automation tools to programmatically discover available commands, their descriptions, usage patterns, and subcommands. Includes CommandSchema struct for clean JSON serialization that filters internal commands (prefixed with _) from output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
|
✅ Merge Queue: READY TO MERGE
This PR is ready for maintainer merge. |
whitmo
added a commit
to whitmo/multiclaude
that referenced
this pull request
Feb 28, 2026
whitmo
added a commit
to whitmo/multiclaude
that referenced
this pull request
Feb 28, 2026
…nc#336, dlorenc#340, dlorenc#342 Add 659 lines of tests covering: - All 18 structured error constructors from PR dlorenc#340 (individual + bulk format test) - JSON CLI output edge cases from PR dlorenc#335 (empty/nested/all-internal subcommands) - Structured CLIError validation for workspace names from PR dlorenc#340 integration - Message routing edge cases from PR dlorenc#342 (no acked, mixed ack status) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Feb 28, 2026
whitmo
added a commit
to whitmo/multiclaude
that referenced
this pull request
Mar 1, 2026
Gemini-assisted review of dlorenc#335 which adds --json flag for machine-readable CLI output. Found clean implementation with one suggestion to improve test assertions on JSON content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
whitmo
added a commit
to whitmo/multiclaude
that referenced
this pull request
Mar 1, 2026
Resolved conflicts with dlorenc#337 categorized help: kept categorized output and added JSON hint line. showCommandHelp now supports both outputJSON parameter and root command redirect to categorized help. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
whitmo
added a commit
to whitmo/multiclaude
that referenced
this pull request
Mar 1, 2026
…nc#336, dlorenc#340, dlorenc#342 Add 659 lines of tests covering: - All 18 structured error constructors from PR dlorenc#340 (individual + bulk format test) - JSON CLI output edge cases from PR dlorenc#335 (empty/nested/all-internal subcommands) - Structured CLIError validation for workspace names from PR dlorenc#340 integration - Message routing edge cases from PR dlorenc#342 (no acked, mixed ack status) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Mar 1, 2026
3 tasks
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
--jsonflag to CLI help for machine-readable outputmulticlaude --jsonoutputs full command tree as JSONmulticlaude --help --jsonsame as abovemulticlaude <cmd> --jsonoutputs that command's schemaThis enables LLMs and automation tools to programmatically discover available commands, their descriptions, usage patterns, and subcommands.
Implementation
CommandSchemastruct for clean JSON serializationtoSchema()method onCommandthat recursively converts the command tree_) are filtered from output--jsonflagExample Output
$ multiclaude agent --json { "name": "agent", "description": "Agent communication commands", "subcommands": { "attach": { "name": "attach", "description": "Attach to an agent's tmux window", "usage": "multiclaude agent attach <agent-name> [--read-only]" }, ... } }Test plan
go build ./cmd/multiclaudego test ./...--jsonflag at root and subcommand levels🤖 Generated with Claude Code