fix(cli): drive mcp doctor help from a single option schema

Parses rea mcp doctor arguments against one zod option schema that is also the help renderer's source of truth, answering --help/-h in any position without starting a diagnostic session and keeping actionable errors for unknown options and invalid formats. Updates the landed help assertion to the schema-rendered format list and adds boundary coverage for help positioning and --format edge cases.
This commit is contained in:
morluto
2026-10-09 08:00:07 +08:00
parent 5ac3dc96f0
commit b7d803dd10
3 changed files with 174 additions and 18 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ it("shows MCP doctor help without starting a server and keeps option errors acti
const help = await runCli(["mcp", "doctor", "--help"]);
expect(help.exitCode).toBe(0);
expect(help.stdout).toContain("Usage: rea mcp doctor [options]");
expect(help.stdout).toContain("--format <format>");
expect(help.stdout).toContain("--format <toon|json|yaml|md|jsonl>");
expect(help.stdout).toContain("--full-output");
const invalid = await runCli(["mcp", "doctor", "--not-an-option"]);