From 39e8403306af0764c6319a514193d9fb4dad794e Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:54:35 +0800 Subject: [PATCH] fix(cli): show --json in global help (#12058) --- src/cli/help.ts | 1 + tests/boundary/cli/commandHelp.test.ts | 1 + tests/fixtures/cli-parity/discovery-help-over-schema.txt | 1 + tests/fixtures/cli-parity/help-after-unknown-command.txt | 1 + tests/fixtures/cli-parity/help-contract-command.txt | 1 + tests/fixtures/cli-parity/help-contract-defaults.txt | 1 + tests/fixtures/cli-parity/help-contract-long-description.txt | 1 + tests/fixtures/cli-parity/help-contract-optional-positional.txt | 1 + tests/fixtures/cli-parity/help-hand-built-capture-process.txt | 1 + tests/fixtures/cli-parity/help-hand-built-doctor.txt | 1 + tests/fixtures/cli-parity/help-hand-built-environment-build.txt | 1 + tests/fixtures/cli-parity/help-hand-built-guidance.txt | 1 + tests/fixtures/cli-parity/help-hand-built-setup.txt | 1 + tests/fixtures/cli-parity/help-mcp-add.txt | 1 + tests/fixtures/cli-parity/help-mcp-without-subcommand.txt | 1 + tests/fixtures/cli-parity/help-mcp.txt | 1 + tests/fixtures/cli-parity/help-root-bare.txt | 1 + tests/fixtures/cli-parity/help-root-short.txt | 1 + tests/fixtures/cli-parity/help-root-with-format.txt | 1 + tests/fixtures/cli-parity/help-root.txt | 1 + tests/fixtures/cli-parity/help-update.txt | 1 + tests/fixtures/cli-parity/terminal-error-refined-number.txt | 1 + tests/fixtures/cli-parity/terminal-help-command.txt | 1 + tests/fixtures/cli-parity/terminal-help-root-bare.txt | 1 + 24 files changed, 24 insertions(+) diff --git a/src/cli/help.ts b/src/cli/help.ts index 040bab3b88..d4a167f906 100644 --- a/src/cli/help.ts +++ b/src/cli/help.ts @@ -147,6 +147,7 @@ const globalOptionRows = ({ formats, root }: GlobalOptionsHelp): Row[] => }, { label: `--format <${formats.join("|")}>`, description: "Output format" }, { label: "--help", description: "Show help" }, + { label: "--json", description: "Shorthand for --format json" }, { label: "--llms, --llms-full", description: "Print LLM-readable manifest", diff --git a/tests/boundary/cli/commandHelp.test.ts b/tests/boundary/cli/commandHelp.test.ts index 57f372bd9f..85cccbdb77 100644 --- a/tests/boundary/cli/commandHelp.test.ts +++ b/tests/boundary/cli/commandHelp.test.ts @@ -46,6 +46,7 @@ it("renders type placeholders, shown defaults and aliases", () => { " --format Output format", " --full-output Show full output envelope", " --help Show help", + " --json Shorthand for --format json", " --llms, --llms-full Print LLM-readable manifest", " --schema Show JSON Schema for command", " --token-count Print token count of output (instead of output)", diff --git a/tests/fixtures/cli-parity/discovery-help-over-schema.txt b/tests/fixtures/cli-parity/discovery-help-over-schema.txt index 4ed69e1dec..721e192794 100644 --- a/tests/fixtures/cli-parity/discovery-help-over-schema.txt +++ b/tests/fixtures/cli-parity/discovery-help-over-schema.txt @@ -21,6 +21,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-after-unknown-command.txt b/tests/fixtures/cli-parity/help-after-unknown-command.txt index d2b0433d4e..7fa203d060 100644 --- a/tests/fixtures/cli-parity/help-after-unknown-command.txt +++ b/tests/fixtures/cli-parity/help-after-unknown-command.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command diff --git a/tests/fixtures/cli-parity/help-contract-command.txt b/tests/fixtures/cli-parity/help-contract-command.txt index 05550949b3..1b42e38d66 100644 --- a/tests/fixtures/cli-parity/help-contract-command.txt +++ b/tests/fixtures/cli-parity/help-contract-command.txt @@ -21,6 +21,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-contract-defaults.txt b/tests/fixtures/cli-parity/help-contract-defaults.txt index cfceb0d6e0..6dfabe9b8b 100644 --- a/tests/fixtures/cli-parity/help-contract-defaults.txt +++ b/tests/fixtures/cli-parity/help-contract-defaults.txt @@ -24,6 +24,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-contract-long-description.txt b/tests/fixtures/cli-parity/help-contract-long-description.txt index be2557ff35..eb7632e7e3 100644 --- a/tests/fixtures/cli-parity/help-contract-long-description.txt +++ b/tests/fixtures/cli-parity/help-contract-long-description.txt @@ -29,6 +29,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-contract-optional-positional.txt b/tests/fixtures/cli-parity/help-contract-optional-positional.txt index 86f4815b7c..234368dfdb 100644 --- a/tests/fixtures/cli-parity/help-contract-optional-positional.txt +++ b/tests/fixtures/cli-parity/help-contract-optional-positional.txt @@ -25,6 +25,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-hand-built-capture-process.txt b/tests/fixtures/cli-parity/help-hand-built-capture-process.txt index 3bbaee8719..7cca121987 100644 --- a/tests/fixtures/cli-parity/help-hand-built-capture-process.txt +++ b/tests/fixtures/cli-parity/help-hand-built-capture-process.txt @@ -16,6 +16,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-hand-built-doctor.txt b/tests/fixtures/cli-parity/help-hand-built-doctor.txt index db83d64864..779a6deeda 100644 --- a/tests/fixtures/cli-parity/help-hand-built-doctor.txt +++ b/tests/fixtures/cli-parity/help-hand-built-doctor.txt @@ -19,6 +19,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-hand-built-environment-build.txt b/tests/fixtures/cli-parity/help-hand-built-environment-build.txt index 8f5169227b..3a2c1b7420 100644 --- a/tests/fixtures/cli-parity/help-hand-built-environment-build.txt +++ b/tests/fixtures/cli-parity/help-hand-built-environment-build.txt @@ -25,6 +25,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-hand-built-guidance.txt b/tests/fixtures/cli-parity/help-hand-built-guidance.txt index b7c513fa91..96e5398aa2 100644 --- a/tests/fixtures/cli-parity/help-hand-built-guidance.txt +++ b/tests/fixtures/cli-parity/help-hand-built-guidance.txt @@ -20,6 +20,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-hand-built-setup.txt b/tests/fixtures/cli-parity/help-hand-built-setup.txt index f17093d9e7..ddd5d8cca1 100644 --- a/tests/fixtures/cli-parity/help-hand-built-setup.txt +++ b/tests/fixtures/cli-parity/help-hand-built-setup.txt @@ -27,6 +27,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-mcp-add.txt b/tests/fixtures/cli-parity/help-mcp-add.txt index 9d11be3050..a4dc0800a4 100644 --- a/tests/fixtures/cli-parity/help-mcp-add.txt +++ b/tests/fixtures/cli-parity/help-mcp-add.txt @@ -17,6 +17,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-mcp-without-subcommand.txt b/tests/fixtures/cli-parity/help-mcp-without-subcommand.txt index 5dfb59ad1d..91803a85a0 100644 --- a/tests/fixtures/cli-parity/help-mcp-without-subcommand.txt +++ b/tests/fixtures/cli-parity/help-mcp-without-subcommand.txt @@ -14,6 +14,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-mcp.txt b/tests/fixtures/cli-parity/help-mcp.txt index 50784c0b41..5399b19c1f 100644 --- a/tests/fixtures/cli-parity/help-mcp.txt +++ b/tests/fixtures/cli-parity/help-mcp.txt @@ -14,6 +14,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/help-root-bare.txt b/tests/fixtures/cli-parity/help-root-bare.txt index 0b74f7de62..a1ab1fa9ba 100644 --- a/tests/fixtures/cli-parity/help-root-bare.txt +++ b/tests/fixtures/cli-parity/help-root-bare.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command diff --git a/tests/fixtures/cli-parity/help-root-short.txt b/tests/fixtures/cli-parity/help-root-short.txt index 111ddf5ee8..eb092e1ac9 100644 --- a/tests/fixtures/cli-parity/help-root-short.txt +++ b/tests/fixtures/cli-parity/help-root-short.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command diff --git a/tests/fixtures/cli-parity/help-root-with-format.txt b/tests/fixtures/cli-parity/help-root-with-format.txt index 49e10edc11..9e242a107d 100644 --- a/tests/fixtures/cli-parity/help-root-with-format.txt +++ b/tests/fixtures/cli-parity/help-root-with-format.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command diff --git a/tests/fixtures/cli-parity/help-root.txt b/tests/fixtures/cli-parity/help-root.txt index 286e27fd6f..0d01a23b2f 100644 --- a/tests/fixtures/cli-parity/help-root.txt +++ b/tests/fixtures/cli-parity/help-root.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command diff --git a/tests/fixtures/cli-parity/help-update.txt b/tests/fixtures/cli-parity/help-update.txt index e443a592f9..2f00ecee58 100644 --- a/tests/fixtures/cli-parity/help-update.txt +++ b/tests/fixtures/cli-parity/help-update.txt @@ -13,6 +13,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/terminal-error-refined-number.txt b/tests/fixtures/cli-parity/terminal-error-refined-number.txt index 56ee211944..33abe917b8 100644 --- a/tests/fixtures/cli-parity/terminal-error-refined-number.txt +++ b/tests/fixtures/cli-parity/terminal-error-refined-number.txt @@ -22,6 +22,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/terminal-help-command.txt b/tests/fixtures/cli-parity/terminal-help-command.txt index 713e4ba748..d62ef7f233 100644 --- a/tests/fixtures/cli-parity/terminal-help-command.txt +++ b/tests/fixtures/cli-parity/terminal-help-command.txt @@ -21,6 +21,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --schema Show JSON Schema for command --token-count Print token count of output (instead of output) diff --git a/tests/fixtures/cli-parity/terminal-help-root-bare.txt b/tests/fixtures/cli-parity/terminal-help-root-bare.txt index 2f12fb7889..912862fc37 100644 --- a/tests/fixtures/cli-parity/terminal-help-root-bare.txt +++ b/tests/fixtures/cli-parity/terminal-help-root-bare.txt @@ -30,6 +30,7 @@ Global Options: --format Output format --full-output Show full output envelope --help Show help + --json Shorthand for --format json --llms, --llms-full Print LLM-readable manifest --mcp Start as MCP stdio server --schema Show JSON Schema for command