Skip to content

Comments

fix(happy-cli): pass positional prompt arguments correctly to Claude CLI#690

Open
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/prompt-positional-arg-passthrough
Open

fix(happy-cli): pass positional prompt arguments correctly to Claude CLI#690
davidrimshnick wants to merge 1 commit intoslopus:mainfrom
davidrimshnick:fix/prompt-positional-arg-passthrough

Conversation

@davidrimshnick
Copy link

Summary

  • Positional prompt arguments (e.g. happy "/review URL") were not being passed correctly to Claude CLI
  • Root cause 1: The unknown-arg parser in index.ts had a heuristic that incorrectly consumed the next argument after any unknown flag if it didn't start with -. This broke positional prompts and could eat unrelated arguments.
  • Root cause 2: In claudeLocal.ts, --settings was added after claudeArgs, so positional prompts weren't at the end of the argv array where Claude CLI expects them.

Fixes #663

Changes

  1. index.ts: Removed the arg-pairing heuristic — unknown args are now passed through as-is (the shell already handles quoting/grouping)
  2. claudeLocal.ts: Moved claudeArgs to the end of the spawn args, after --settings

Test plan

  • Added test verifying positional prompts are placed after --settings in spawn args
  • All 11 claudeLocal.test.ts tests pass
  • Manual: happy "/review https://example.com/pr/123" should forward the prompt to Claude correctly

🤖 Generated with Claude Code

Two fixes:

1. Remove incorrect arg-pairing heuristic in index.ts that consumed the
   next argument after any unknown flag if it didn't start with "-".
   This broke positional prompts like: happy "/review URL"

2. Move claudeArgs after --settings in claudeLocal.ts so positional
   prompts end up at the end of the argv array where Claude CLI
   expects them.

Fixes slopus#663

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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