feat: add --file flag and better errors to crit comment --json#480
Merged
tomasz-tomczyk merged 2 commits intomainfrom May 7, 2026
Merged
feat: add --file flag and better errors to crit comment --json#480tomasz-tomczyk merged 2 commits intomainfrom
tomasz-tomczyk merged 2 commits intomainfrom
Conversation
Pass --file <path> instead of piping JSON through stdin to avoid shell-quoting hazards with multi-paragraph bodies. --file - keeps stdin behavior explicit. Stdin remains the default when --file is omitted. Parse errors now include byte offset, line/column, and a snippet around the offending position with control characters rendered visibly, so a stray newline inside a "body" string is immediately locatable instead of opaque. Documented across AGENTS.md and all 8 agent integration prompts; plugin manifest bumped to 1.5.1 so users pick up the updated guidance.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #480 +/- ##
==========================================
+ Coverage 69.06% 69.33% +0.26%
==========================================
Files 43 43
Lines 10733 10817 +84
==========================================
+ Hits 7413 7500 +87
+ Misses 2759 2751 -8
- Partials 561 566 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Adds helper-subprocess tests around runCommentJSONScoped (success, parse-error exit, missing-file exit) and table-driven coverage for jsonErrorOffset (SyntaxError / UnmarshalTypeError / generic / nil) and visibleControl (LF / CR / TAB / mixed / empty).
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
--file <path>flag (alias-f, with-for stdin) oncrit comment --jsonso callers can hand JSON over via a file path instead of shell-quoted stdin. Multi-paragraph"body"strings are exactly the case where shell quoting silently corrupts JSON; pointing at a file written by the agent's normal write tooling sidesteps the whole class.>>>HERE<<<next to the literal\nthat broke things). Replaces the opaqueinvalid character '\n' in string literalwith a locatable diagnostic.--filefor multi-paragraph bodies" guidance acrossAGENTS.mdand all 8 integration prompts (claude-code, codex, cursor, github-copilot, cline, windsurf, opencode, aider). Bumpedplugin.jsonto 1.5.1 so claude-code users pick up the updated SKILL.Review
Test plan
comment_json_input_test.go:--file <path>happy path,--file -reads stdin,--file <missing>errors with path in message, default stdin still works, malformed JSON parse-error formatting (offset/line/col/snippet/visible-control), flag parsing for--fileand-f.gofmt -l,go vet,golangci-lint run,go test -race ./...all clean.🤖 Generated with Claude Code