@@ -15336,6 +15336,21 @@ TEST(cli_print_tool_help_issue680) {
1533615336 PASS();
1533715337}
1533815338
15339+ /* #2102: top-level `cli --help` (CLI_USAGE) must point at tool-level
15340+ * `--format json` and distinguish it from outer `--json`. This is help-only:
15341+ * the usage synopsis still has no session-wide --format / CBM_CLI_FORMAT. */
15342+ TEST(cli_usage_points_to_tool_format_json_issue2102) {
15343+ ASSERT_NOT_NULL(strstr(CBM_CLI_USAGE, "--format tree|json"));
15344+ ASSERT_NOT_NULL(strstr(CBM_CLI_USAGE, "payload JSON"));
15345+ ASSERT_NOT_NULL(strstr(CBM_CLI_USAGE, "full MCP envelope"));
15346+ ASSERT_NOT_NULL(strstr(CBM_CLI_USAGE, "--json Print the raw MCP result envelope"));
15347+ ASSERT_NOT_NULL(strstr(CBM_CLI_USAGE, "cli [--quiet] [--progress] [--verbose] [--json] "
15348+ "<tool_name>"));
15349+ ASSERT_NULL(strstr(CBM_CLI_USAGE, "[--format"));
15350+ ASSERT_NULL(strstr(CBM_CLI_USAGE, "CBM_CLI_FORMAT"));
15351+ PASS();
15352+ }
15353+
1533915354/* #1359: `cli <tool>` with no argument-bearing token used to slurp stdin to EOF
1534015355 * for ANY non-terminal stdin. The ordinary automation caller never sends that
1534115356 * EOF — Node's child_process.spawn defaults to stdio:['pipe','pipe','pipe'] and
@@ -16376,6 +16391,7 @@ SUITE(cli) {
1637616391 RUN_TEST(cli_build_args_json_key_equals_value_issue680);
1637716392 RUN_TEST(cli_build_args_json_bad_positional_errors_issue680);
1637816393 RUN_TEST(cli_print_tool_help_issue680);
16394+ RUN_TEST(cli_usage_points_to_tool_format_json_issue2102);
1637916395
1638016396 /* Stdin argument gate (#1359) */
1638116397 RUN_TEST(cli_zero_argument_tool_never_reads_stdin_issue1359);
0 commit comments