fix: strip shell comment lines from claude_args before parsing#1019
Open
dpdanpittman wants to merge 1 commit intoanthropics:mainfrom
Open
fix: strip shell comment lines from claude_args before parsing#1019dpdanpittman wants to merge 1 commit intoanthropics:mainfrom
dpdanpittman wants to merge 1 commit intoanthropics:mainfrom
Conversation
shell-quote treats # as a comment character, causing all content after a comment line to be swallowed. This strips lines starting with # before passing to parseShellArgs, so users can add documentation comments to their claude_args without breaking subsequent flags. Fixes anthropics#802 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Jah-yee
added a commit
to Jah-yee/claude-code-action
that referenced
this pull request
Mar 6, 2026
shell-quote treats # as a comment character, causing all content after a comment line to be swallowed. This fix strips lines starting with # before passing to parseShellArgs, so users can add documentation comments to their claude_args without breaking subsequent flags. Fixes: anthropics#1019, anthropics#802
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.
shell-quote treats # as a comment character, causing all content after a comment line to be swallowed. This strips lines starting with # before passing to parseShellArgs, so users can add documentation comments to their claude_args without breaking subsequent flags.
Fixes #802
Motivation and Context
As described in #802, users writing multi-line
claude_argswith explanatory comments like:find that
--allowed-toolsis never parsed becauseshell-quotetreats everything after#as a comment object.Changes
Added a
stripShellComments()function that removes lines whose first non-whitespace character is#before passing the input toshell-quote'sparse(). This is a line-level filter — hash characters inside quoted values on the same line as a flag are preserved.File changed:
base-action/src/parse-sdk-options.tsHow Has This Been Tested?
Added 4 new tests in
base-action/test/parse-sdk-options.test.tsunder a newshell comment strippingdescribe block:#is handledBash(echo #hello)is preservedFull test suite passes: 656/656 tests pass.
Breaking Changes
None. This only strips comment lines before parsing. Users who don't use comments see no change.
Types of changes