feat(sdk): add include_directories option to both SDKs - #6468
Conversation
Add `include_directories` (Python) / `includeDirectories` (TypeScript) option that maps to CLI's `--include-directories` flag, allowing users to add extra directories to the workspace context. Python SDK: - Add `include_directories: list[str] | None` to QueryOptions - Map to `--include-directories` (comma-separated) in build_cli_arguments TypeScript SDK: - Add `includeDirectories?: string[]` to TransportOptions and QueryOptions - Add to Zod schema - Pass through to ProcessTransport.buildCliArguments
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Thanks for the PR, @juhuan!
The PR body doesn't follow the PR template. The template requires these sections:
- What this PR does — your "Summary" covers this, but the heading name differs
- Why it's needed — missing. Why do SDK users need
includeDirectories? What workflow does it enable? - Reviewer Test Plan (How to verify / Evidence / Tested on) — missing. The "Test plan" lists passing unit tests, but the template asks for reviewer-facing verification steps and OS coverage
- Risk & Scope — missing
- Linked Issues — missing
- Chinese translation (
<details>block) — missing
Could you update the PR body to match the template? This helps reviewers evaluate the change efficiently.
The code change itself looks clean at a glance — follows the same pattern as allowedTools / coreTools in both SDKs. Happy to do a full review once the template is in place.
中文说明
感谢 PR,@juhuan!
PR 正文没有按照 PR 模板 填写。模板要求以下部分:
- What this PR does — 你的 "Summary" 覆盖了内容,但标题名称不同
- Why it's needed — 缺失。为什么 SDK 用户需要
includeDirectories?它支持什么工作流? - Reviewer Test Plan(验证方法 / 证据 / 测试平台)— 缺失。"Test plan" 列出了通过的单元测试,但模板要求面向审查者的验证步骤和操作系统覆盖情况
- Risk & Scope — 缺失
- Linked Issues — 缺失
- 中文翻译(
<details>块)— 缺失
能否更新 PR 正文以匹配模板?这有助于审查者高效评估变更。
代码变更本身看起来很干净——在两个 SDK 中都遵循了 allowedTools / coreTools 的相同模式。模板就位后,我很乐意进行完整的代码审查。
— Qwen Code · qwen3.7-max
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No review findings. Downgraded from Approve to Comment: CI still running.
The PR cleanly adds includeDirectories / include_directories to both TypeScript and Python SDKs, faithfully following the existing patterns for allowedTools / coreTools / excludeTools. All 58 Python tests and 1163 TypeScript tests pass.
One minor note for the author: consider adding include_directories to the existing CLI argument serialization tests in both SDKs (test_build_cli_arguments_maps_supported_options in Python, should build CLI arguments correctly with all options in TypeScript) to match the coverage of sibling options.
— qwen3.7-max via Qwen Code /review
doudouOUC
left a comment
There was a problem hiding this comment.
[Suggestion] Both SDK READMEs omit the new option from their API reference
packages/sdk-typescript/README.md documents all 21 QueryOptions in a table but omits includeDirectories. packages/sdk-python/README.md lists peer options (core_tools, exclude_tools, allowed_tools) but not include_directories. Consider adding a row/entry for the new option so SDK users can discover it.
— qwen3.7-max via Qwen Code /review
| if options.allowed_tools: | ||
| args.extend(["--allowed-tools", ",".join(options.allowed_tools)]) | ||
|
|
||
| if options.include_directories: |
There was a problem hiding this comment.
[Critical] Missing tests for include_directories in both SDKs
The existing test_build_cli_arguments_maps_supported_options test (Python) and equivalent ProcessTransport.test.ts test (TypeScript) cover all peer list options (core_tools, exclude_tools, allowed_tools) but include_directories is absent from both. The new code path (if options.include_directories: args.extend(...)) and the TypeScript .length > 0 guard are entirely untested.
Impact: A regression in the argument name, join separator, or guard condition would go undetected.
Suggested fix: Add include_directories=["/workspace/shared"] to the Python QueryOptions(...) call and assert "--include-directories", "/workspace/shared" in the expected args. Mirror in ProcessTransport.test.ts with includeDirectories: ['/workspace/shared']. Also add a test verifying that include_directories=[] / includeDirectories: [] does not emit the flag.
— qwen3.7-max via Qwen Code /review
💡 Suggestion: Consolidate SDK PRsHi @juhuan, thanks for the comprehensive SDK work! We noticed you have 15 open PRs that all modify the same core files ( The problem
Suggestion: regroup into 2 PRsWe recommend closing the current 15 PRs and reopening them as 2 consolidated PRs: PR 1 — Covers pure SDK-side option additions (~9 current PRs):
PR 2 — Covers features that also involve CLI-side
This keeps a reasonable separation of concerns while eliminating the merge-conflict chain and making review much more manageable. /cc @juhuan |
|
Closing in favor of consolidated PRs (see suggestion comment above). Please reopen as 2 grouped PRs. |
Summary
Add
include_directories(Python) /includeDirectories(TypeScript) option that maps to CLI's--include-directoriesflag, allowing users to add extra directories to the workspace context.include_directories: list[str] | NoneinQueryOptions, mapped to--include-directories(comma-separated)includeDirectories?: string[]inTransportOptionsandQueryOptions, with Zod schema validationTest plan
pytest— 58 passed)tsc --noEmit)vitest run— 1163 passed)