File tree Expand file tree Collapse file tree 4 files changed +29
-0
lines changed
Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 0.0.19
4+
5+ - Add ` ClaudeCodeOptions.add_dirs ` for ` --add-dir `
6+ - Fix ClaudeCodeSDK hanging when MCP servers log to Claude Code stderr
7+
38## 0.0.18
49
510- Add ` ClaudeCodeOptions.settings ` for ` --settings `
Original file line number Diff line number Diff line change @@ -134,6 +134,11 @@ def _build_command(self) -> list[str]:
134134 if self ._options .settings :
135135 cmd .extend (["--settings" , self ._options .settings ])
136136
137+ if self ._options .add_dirs :
138+ # Convert all paths to strings and add each directory
139+ for directory in self ._options .add_dirs :
140+ cmd .extend (["--add-dir" , str (directory )])
141+
137142 if self ._options .mcp_servers :
138143 cmd .extend (
139144 ["--mcp-config" , json .dumps ({"mcpServers" : self ._options .mcp_servers })]
Original file line number Diff line number Diff line change @@ -128,3 +128,4 @@ class ClaudeCodeOptions:
128128 permission_prompt_tool_name : str | None = None
129129 cwd : str | Path | None = None
130130 settings : str | None = None
131+ add_dirs : list [str | Path ] = field (default_factory = list )
Original file line number Diff line number Diff line change @@ -79,6 +79,24 @@ def test_build_command_with_options(self):
7979 assert "--max-turns" in cmd
8080 assert "5" in cmd
8181
82+ def test_build_command_with_add_dirs (self ):
83+ """Test building CLI command with add_dirs option."""
84+ from pathlib import Path
85+
86+ transport = SubprocessCLITransport (
87+ prompt = "test" ,
88+ options = ClaudeCodeOptions (
89+ add_dirs = ["/path/to/dir1" , Path ("/path/to/dir2" )]
90+ ),
91+ cli_path = "/usr/bin/claude" ,
92+ )
93+
94+ cmd = transport ._build_command ()
95+ cmd_str = " " .join (cmd )
96+
97+ # Check that the command string contains the expected --add-dir flags
98+ assert "--add-dir /path/to/dir1 --add-dir /path/to/dir2" in cmd_str
99+
82100 def test_session_continuation (self ):
83101 """Test session continuation options."""
84102 transport = SubprocessCLITransport (
You can’t perform that action at this time.
0 commit comments