Skip to content

Comments

fix: ensure positional prompts are passed after --settings flag#677

Open
ex3ndr-bot wants to merge 1 commit intoslopus:mainfrom
ex3ndr-bot:fix/positional-prompt-663
Open

fix: ensure positional prompts are passed after --settings flag#677
ex3ndr-bot wants to merge 1 commit intoslopus:mainfrom
ex3ndr-bot:fix/positional-prompt-663

Conversation

@ex3ndr-bot
Copy link

Summary

When passing a positional prompt to happy (e.g., happy "/review https://..."), the prompt was being added to the args array before the --settings flag. This could cause Claude CLI to misinterpret the positional prompt since it appeared in the middle of flag arguments rather than at the end.

Problem

The issue was that claudeArgs (which may include positional prompts) were spread into the args array at line 224, but then --settings was added AFTER at line 228. This resulted in args like:

['--append-system-prompt', '...', '/review https://...', '--settings', '...']

When Claude CLI expects positional prompts to be at the end of the args array.

Solution

Separate flag arguments from positional arguments in claudeArgs:

  1. Add flag arguments (starting with -) first
  2. Add --settings (required for session hooks)
  3. Add positional arguments (prompts) at the very end

Changes

  • Modified packages/happy-cli/src/claude/claudeLocal.ts to separate flags from positional args
  • Added tests in packages/happy-cli/src/claude/claudeLocal.test.ts to verify correct ordering

Closes #663

When passing a positional prompt to happy (e.g., happy "/review ..."), the
prompt was being added to the args array before the --settings flag. This
could cause Claude CLI to misinterpret the positional prompt since it
appeared in the middle of flag arguments rather than at the end.

The fix separates flag arguments from positional arguments in claudeArgs
and ensures positional arguments (like prompts) are added at the very end
of the args array, after all flags including --settings.

Closes slopus#663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Prompt argument not passed correctly to Claude CLI

1 participant