Skip to content

feat(pai.ts): passthrough unknown CLI flags to claude#986

Open
HyggeHacker wants to merge 1 commit intodanielmiessler:mainfrom
HyggeHacker:feat/passthrough-flags
Open

feat(pai.ts): passthrough unknown CLI flags to claude#986
HyggeHacker wants to merge 1 commit intodanielmiessler:mainfrom
HyggeHacker:feat/passthrough-flags

Conversation

@HyggeHacker
Copy link
Copy Markdown

Summary

PAI's arg parser silently dropped unrecognized flags (e.g., --plugin-dir, --mcp-config), preventing users from combining PAI with Claude Code's native flags. Unknown flags are now collected and forwarded to the underlying claude command, enabling use cases like:

pai -l --plugin-dir ~/Projects/boxie --mcp-config ~/.claude/mcp-profiles/boxie.json

Changes

  • Unknown flags (args starting with -) are collected into a passthrough array instead of being silently ignored
  • If the next arg after an unknown flag doesn't start with -, it's treated as that flag's value
  • Non-flag unknown args still produce the existing error message
  • The passthrough array is forwarded to cmdLaunch() and spread into the claude command args

Known limitation

Flags that accept multiple space-separated values (e.g., --add-dir dir1 dir2, --allowedTools Bash Edit Read) will only capture the first value. This covers the vast majority of Claude Code flags which take a single value. Multi-value flags can use repeated invocations (--add-dir dir1 --add-dir dir2) or = syntax as a workaround.

Test plan

  • pai -l --plugin-dir ~/Projects/boxie — plugin-dir passed through correctly
  • pai --mcp-config ~/.claude/mcp-profiles/boxie.json — mcp-config passed through
  • pai unknowncmd — still errors with "Unknown command"
  • pai --model opus — passed through correctly
  • Existing flags (-r, -m, -l, --safe) still work as before

PAI's arg parser silently dropped unrecognized flags (e.g., --plugin-dir,
--mcp-config), preventing users from combining PAI with Claude Code's
native flags. Unknown flags are now collected and forwarded to the
underlying claude command, enabling use cases like:
  pai -l --plugin-dir ~/Projects/boxie --mcp-config ~/.claude/mcp-profiles/boxie.json

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.

1 participant