Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/sdk-python/src/qwen_code_sdk/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ def build_cli_arguments(options: QueryOptions) -> list[str]:
if options.allowed_tools:
args.extend(["--allowed-tools", ",".join(options.allowed_tools)])

if options.include_directories:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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

args.extend(["--include-directories", ",".join(options.include_directories)])

if options.auth_type:
args.extend(["--auth-type", options.auth_type])

Expand Down
3 changes: 3 additions & 0 deletions packages/sdk-python/src/qwen_code_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class QueryOptionsDict(TypedDict, total=False):
timeout: TimeoutOptionsDict
mcp_servers: dict[str, dict[str, Any]]
stderr: Callable[[str], None]
include_directories: list[str]


@dataclass
Expand All @@ -139,6 +140,7 @@ class QueryOptions:
timeout: TimeoutOptions = TimeoutOptions()
mcp_servers: dict[str, dict[str, Any]] | None = None
stderr: Callable[[str], None] | None = None
include_directories: list[str] | None = None

@classmethod
def from_mapping(cls, value: Mapping[str, Any] | None) -> QueryOptions:
Expand Down Expand Up @@ -183,6 +185,7 @@ def from_mapping(cls, value: Mapping[str, Any] | None) -> QueryOptions:
Callable[[str], None] | None,
_as_optional_callable(data, "stderr"),
),
include_directories=_as_optional_str_list(data, "include_directories"),
)


Expand Down
1 change: 1 addition & 0 deletions packages/sdk-typescript/src/query/createQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export function query({
excludeTools: options.excludeTools,
allowedTools: options.allowedTools,
authType: options.authType,
includeDirectories: options.includeDirectories,
includePartialMessages: options.includePartialMessages,
resume: options.resume,
sessionId,
Expand Down
10 changes: 10 additions & 0 deletions packages/sdk-typescript/src/transport/ProcessTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ export class ProcessTransport implements Transport {
args.push('--allowed-tools', this.options.allowedTools.join(','));
}

if (
this.options.includeDirectories &&
this.options.includeDirectories.length > 0
) {
args.push(
'--include-directories',
this.options.includeDirectories.join(','),
);
}

if (this.options.authType) {
args.push('--auth-type', this.options.authType);
}
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-typescript/src/types/queryOptionsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,6 @@ export const QueryOptionsSchema = z
resume: z.string().optional(),
sessionId: z.string().optional(),
timeout: TimeoutConfigSchema.optional(),
includeDirectories: z.array(z.string()).optional(),
})
.strict();
11 changes: 11 additions & 0 deletions packages/sdk-typescript/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export type TransportOptions = {
* When resume is provided, this should match the resume ID.
*/
sessionId?: string;
/**
* Additional directories to include in the workspace context.
* Equivalent to CLI's `--include-directories` flag.
*/
includeDirectories?: string[];
};

export interface QuerySystemPromptPreset {
Expand Down Expand Up @@ -503,4 +508,10 @@ export interface QueryOptions {
*/
streamClose?: number;
};

/**
* Additional directories to include in the workspace context.
* Equivalent to CLI's `--include-directories` flag.
*/
includeDirectories?: string[];
}
Loading