feat(sdk): add disabled_slash_commands option to Python and TS SDKs - #6480
feat(sdk): add disabled_slash_commands option to Python and TS SDKs#6480juhuan wants to merge 1 commit into
Conversation
Expose CLI's --disabled-slash-commands flag through both SDKs' QueryOptions, allowing users to hide/disable specific slash commands.
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
Hey @juhuan — thanks for the PR! The code changes look clean and focused — adding disabledSlashCommands / disabled_slash_commands to both SDKs is a straightforward wiring job, and the implementation follows existing patterns well.
However, the PR body doesn't follow the PR template. Most required sections are missing:
- What this PR does — PR has "Summary" instead
- Why it's needed — no motivation or problem statement
- Reviewer Test Plan (How to verify, Evidence Before/After, Tested on table) — PR has a minimal "Test plan" with checkboxes but not the structured format
- Risk & Scope — missing
- Linked Issues — missing
- 中文说明 — missing
Could you restructure the PR body to match the template? This helps maintainers review efficiently and understand the context at a glance. Happy to help if anything is unclear.
中文说明
你好 @juhuan — 感谢提交 PR!代码改动本身很简洁,在两个 SDK 中添加 disabledSlashCommands / disabled_slash_commands 的实现也遵循了现有模式。
不过,PR 正文没有遵循 PR 模板,大部分必填部分缺失:
- What this PR does — PR 用的是 "Summary"
- Why it's needed — 缺少动机或问题描述
- Reviewer Test Plan(验证方法、前后对比、测试平台)— PR 只有一个简单的 "Test plan" 复选框
- Risk & Scope — 缺失
- Linked Issues — 缺失
- 中文说明 — 缺失
能否按照模板重新组织 PR 正文?这样有助于维护者快速理解和审查。如有疑问随时沟通。
— Qwen Code · qwen3.7-max
| * Equivalent to CLI's `--disabled-slash-commands` flag. | ||
| * Matched case-insensitively against the final command name. | ||
| * @example ['/init', '/vim'] | ||
| */ |
There was a problem hiding this comment.
[Critical] The @example ['/init', '/vim'] uses slash-prefixed names, but the CLI matches against bare command names ('init', 'vim'). The yargs coerce and addDisabled functions never strip a leading /, so '/init' will never match 'init' — commands will silently remain enabled.
Verified at both matching sites (CommandService.create and nonInteractiveCliCommands.ts): they compare against cmd.name.toLowerCase() where cmd.name is the bare name (e.g., 'init' in initCommand.ts, 'vim' in vimCommand.ts). The official CLI docs in docs/users/configuration/settings.md correctly use bare names: "disabled": ["auth", "mcp"].
| */ | |
| * @example ['init', 'vim'] |
Alternatively, strip the leading / in both SDK transports before joining, since users will naturally think in /command terms.
— qwen3.7-max via Qwen Code /review
| ) | ||
|
|
||
| assert "--disabled-slash-commands" in args | ||
| idx = args.index("--disabled-slash-commands") |
There was a problem hiding this comment.
[Suggestion] Test values ["/init", "/vim"] use slash-prefixed names, but the CLI expects bare names ('init', 'vim'). This propagates the incorrect format as test-as-documentation — developers reading this test will copy the slash-prefixed format.
| idx = args.index("--disabled-slash-commands") | |
| QueryOptions(disabled_slash_commands=["init", "vim"]) |
Also update the assertion:
assert args[idx + 1] == "init,vim"— qwen3.7-max via Qwen Code /review
| pathToQwenExecutable: 'qwen', | ||
| disabledSlashCommands: ['/init', '/vim'], | ||
| }; | ||
|
|
There was a problem hiding this comment.
[Suggestion] Test values ['/init', '/vim'] use slash-prefixed names, but the CLI expects bare names ('init', 'vim'). This propagates the incorrect format as test-as-documentation.
| disabledSlashCommands: ['init', 'vim'], |
Also update the assertion:
expect.arrayContaining(['--disabled-slash-commands', 'init,vim']),— 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
disabled_slash_commands(Python) /disabledSlashCommands(TS) option mapping to CLI's--disabled-slash-commandsflagTest plan
--disabled-slash-commandsflag present in CLI args with comma-separated values