mirror of
https://github.com/HKUDS/CLI-Anything.git
synced 2026-08-28 23:27:04 +08:00
a5ad2499f0
* fix(comfyui): keep --json stdout parseable `workflow validate --json` printed the JSON document and then appended a human-readable summary line, so `json.loads()` on the output failed with "Extra data". The harness's own test already caught this (test_workflow_validate_json_output), leaving the suite at 59 passed / 1 failed. Route human-facing text through an `echo_human()` helper that no-ops in JSON mode, and send the `queue clear` confirmation prompt to stderr in JSON mode so it cannot corrupt stdout either. Human-mode output is unchanged. Adds regression tests for the invalid-workflow branch, for the human summary still being printed without --json, and for the confirm prompt staying off stdout. README test counts updated (70 -> 73). Fixes #401 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * test(comfyui): read real streams for the JSON-purity prompt test `CliRunner` emulates a terminal by echoing the answer typed at a prompt onto stdout. On click < 8.2 the echo lands there even when the prompt itself was routed to stderr, so with click 8.1.8 the runner produced `stdout == ' n\n{"error": "", "type": "Abort"}\n'` and the assertion `json.loads(result.stdout)` failed — the new test was red under the unbounded `click>=8.0.0` dependency. Click 8.2+ sends the echo to the prompt's own stream, which is why the test passed on 8.4.2. Drop the `split_runner` fixture and run the CLI in a real subprocess instead, so the test reads the streams a caller actually sees. Answering "n" aborts before any request, so no ComfyUI server is needed. Verified on click 8.1.8 and 8.4.2: 63 unit tests pass on both, and both fail this test again if the `err=_json_output` fix is reverted. Addresses Codex review feedback on #414. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: PAN CHAO <panchao@PANdeMacBook-Pro.local>