Skip to content

Commit df94948

Browse files
dicksontsaiclaude
andauthored
Add settings option to ClaudeCodeOptions (#100)
## Summary - Add `settings` field to `ClaudeCodeOptions` to expose the `--settings` CLI flag - Allow SDK users to specify custom settings configuration path ## Changes - Added `settings: str | None = None` field to `ClaudeCodeOptions` dataclass - Added CLI argument conversion logic in `SubprocessCLITransport` to pass `--settings` flag to Claude Code CLI ## Test plan - [x] All existing tests pass - [x] Linting passes (`python -m ruff check`) - [x] Type checking passes (`python -m mypy src/`) 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude <[email protected]>
1 parent 472aa23 commit df94948

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.0.18
4+
5+
- Add `ClaudeCodeOptions.settings` for `--settings`
6+
7+
## 0.0.17
8+
9+
- Remove dependency on asyncio for Trio compatibility
10+
311
## 0.0.16
412

513
- Introduce ClaudeSDKClient for bidirectional streaming conversation

src/claude_code_sdk/_internal/transport/subprocess_cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ def _build_command(self) -> list[str]:
118118
if self._options.resume:
119119
cmd.extend(["--resume", self._options.resume])
120120

121+
if self._options.settings:
122+
cmd.extend(["--settings", self._options.settings])
123+
121124
if self._options.mcp_servers:
122125
cmd.extend(
123126
["--mcp-config", json.dumps({"mcpServers": self._options.mcp_servers})]

src/claude_code_sdk/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,4 @@ class ClaudeCodeOptions:
127127
model: str | None = None
128128
permission_prompt_tool_name: str | None = None
129129
cwd: str | Path | None = None
130+
settings: str | None = None

0 commit comments

Comments
 (0)