feat(cli): add --json flag for machine-readable output with step traces - #64
Closed
Rasputin02 wants to merge 1 commit into
Closed
Rasputin02 wants to merge 1 commit into
Rasputin02 wants to merge 1 commit into
Conversation
The run_standard_pipeline() already returns step traces and timing, but the CLI discarded everything except the final text. Add a --json flag that dumps the full result as JSON to stdout, including all intermediate step outputs and processing time. Verbose step summaries go to stderr when --json is set so stdout stays clean for piping into other tools.
molly554
added a commit
that referenced
this pull request
Sep 16, 2026
Clean reimplementation of the ideas behind #65 and #64: - _validate_pipeline_config() runs before any API call and reports a missing niutrans_api_key or an unrecognized intermediate_lang together, so a later-step failure no longer wastes LLM credits (resolves #62) - --json emits the full result dict (step traces + timing) as JSON with ensure_ascii=False; plain and --verbose output unchanged (resolves #60) - tests/test_pipeline_features.py — 6 cases (validation + CLI) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks @Rasputin02 — good idea, and it has landed on main in c3c0fd2 (from #60). I reimplemented rather than merging directly because this PR added the |
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.
What
Add a
--jsonflag to the CLI that outputs the full pipeline result as JSON, including intermediate step outputs and timing.Why
run_standard_pipeline()already returns a rich dict with step traces, engine names, and per-step character counts — but the CLI only prints the final text. This makes it hard to build tooling around the pipeline (e.g., a web UI showing progressive steps, or a CI check that logs which engine handled each step).Usage
Output:
{ "result": "humanized text...", "steps": [ {"step": 1, "engine": "DeepSeek", "direction": "Input → Chinese (中文改写)", "output": "...", "length": 1234}, ... ], "processing_time_ms": 12345 }When
--verboseis combined with--json, step summaries go to stderr so stdout stays clean for piping.