Skip to content

fix: preserve repeated add-dir flags in claude args#1256

Open
Jerry2003826 wants to merge 1 commit intoanthropics:mainfrom
Jerry2003826:codex/fix-repeated-add-dir-claude-args
Open

fix: preserve repeated add-dir flags in claude args#1256
Jerry2003826 wants to merge 1 commit intoanthropics:mainfrom
Jerry2003826:codex/fix-repeated-add-dir-claude-args

Conversation

@Jerry2003826
Copy link
Copy Markdown

Fixes #1215

Summary

  • Preserve repeated --add-dir flags parsed from claude_args.
  • Map parsed directory values onto the SDK's typed additionalDirectories option.
  • Remove add-dir from extraArgs so the SDK does not receive a single overwritten or delimiter-joined value.

Root Cause

parseClaudeArgsToExtraArgs() stores CLI flags in a record keyed by flag name. Since add-dir was not treated as an accumulating flag, repeated values overwrote earlier directories before reaching the SDK.

Validation

  • bun test test/parse-sdk-options.test.ts -t add-dir
  • bun test test/parse-sdk-options.test.ts
  • bun test
  • bun run typecheck
  • bunx prettier --check src/parse-sdk-options.ts test/parse-sdk-options.test.ts

@Jerry2003826 Jerry2003826 marked this pull request as ready for review April 25, 2026 11:16
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.

When passing multiple --add-dir flags, the last silently overwrites instead of being combined

1 participant