Apply --max-chars consistently to all commands, skip in --json mode#157
Merged
Apply --max-chars consistently to all commands, skip in --json mode#157
Conversation
… mode --max-chars now only appears on the commands where it applies (tools-call, prompts-get, resources-read) rather than as a global option. Truncation is skipped in --json mode to avoid producing invalid JSON output. https://claude.ai/code/session_01PiFuVVaizRowPPHUwMPKVa
Move truncation logic into formatOutput() so every command that uses it gets --max-chars support automatically in human mode. This replaces the previous per-handler truncation which only covered 3 commands. JSON output is never truncated to avoid producing invalid JSON. https://claude.ai/code/session_01PiFuVVaizRowPPHUwMPKVa
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.
Summary
--max-charstruncation now applies consistently to all commands (not justtools-call,prompts-get,resources-read)--jsonmode to avoid producing invalid JSONformatOutput()so every command gets it for freeChanges
maxCharstoFormatOptionsand applied truncation centrally informatOutput()(human mode only)maxCharsthroughFormatOptionsat allformatOutput()call sites that useoptions.outputModetruncateOutput()calls and cleaned up unused imports--max-chars <n> Truncate output to n characters (ignored in --json mode)Test plan
npm run lintpassesnpm run buildpassesnpm run test:unitpasses (500/500)https://claude.ai/code/session_01PiFuVVaizRowPPHUwMPKVa