Skip to content

Commit 202be6e

Browse files
feat(vscode): expose /skills as slash command with secondary picker (#2548)
* feat(vscode): expose /skills as slash command with secondary picker Add a secondary completion picker for the /skills slash command in the VSCode IDE companion, allowing users to browse and select skills from a dropdown before sending. Changes: - CLI: add 'skills' to ALLOWED_BUILTIN_COMMANDS_NON_INTERACTIVE whitelist - CLI: send available_skills_update via ACP with skill names/descriptions - Extension: handle available_skills_update in session update handler - Webview: implement secondary picker that triggers after selecting /skills - Webview: allow spaces in completion trigger for /skills sub-queries Closes #1562 Made-with: Cursor * feat(vscode-ide-companion): embed skills in commands update metadata - Move available skills from separate session update to _meta field of available_commands_update for more efficient delivery - Simplify skill data to just skill names (string array) - Add skillsCompletion utility for secondary picker logic - Cache available skills in WebViewProvider for replay on webview ready - Update all related types and handlers to support the new structure Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * refactor(vscode-ide-companion): simplify skills picker flow * refactor(vscode-ide-companion): extract skills completion utils to shared module Move `isSkillsSecondaryQuery`, `shouldOpenSkillsSecondaryPicker`, and `SKILL_ITEM_ID_PREFIX` from App.tsx and useCompletionTrigger.ts into a shared `completionUtils.ts` file to eliminate duplication. * fix(vscode-ide-companion): restore skills picker state on reload Cache and replay available skills when the webview becomes ready again. Clear stale skills when commands metadata does not include availableSkills. * fix(vscode-ide-companion): replay slash commands after webview reload Cache available commands in the webview provider. Replay them on webviewReady so slash command state survives reloads. * fix(vscode-ide-companion): import AvailableCommand from ACP SDK * fix(vscode-ide-companion): fallback /skills to direct command * test(vscode-ide-companion): cover skills secondary picker flow * test(vscode-ide-companion): guard App mock initialization * fix(vscode-ide-companion): remove duplicate AvailableCommand import The auto-merge introduced a duplicate AvailableCommand in the @agentclientprotocol/sdk import block, causing TS2300. * fix(vscode-ide-companion): remove duplicate availableCommands replay in handleWebviewReady The handleWebviewReady method was sending cachedAvailableCommands twice on every webview-ready handshake, causing an unnecessary extra state update in the webview. --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 3a2ee4a commit 202be6e

25 files changed

Lines changed: 1003 additions & 95 deletions

File tree

.qwen/agents/test-engineer.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Your sole responsibility is to **reproduce bugs** and **verify fixes**.
3333
## Critical constraints
3434

3535
1. **You must NEVER fix the bug.** Your job ends at confirming the bug exists
36-
or confirming a fix works. You do not propose fixes, apply patches, or modify
37-
source code in any way that changes the product's behavior.
36+
or confirming a fix works. You do not propose fixes, apply patches, or modify
37+
source code in any way that changes the product's behavior.
3838

3939
2. **You must NEVER use Edit or WriteFile on source files.** You have edit and
40-
write_file tools for two purposes only: updating the issue file with your
41-
report, and writing test scripts as a fallback reproduction method (step 3b
42-
below). Any use of these tools on project source code is forbidden. If you
43-
find yourself tempted to "just fix this one thing" — stop and report back
44-
instead.
40+
write_file tools for two purposes only: updating the issue file with your
41+
report, and writing test scripts as a fallback reproduction method (step 3b
42+
below). Any use of these tools on project source code is forbidden. If you
43+
find yourself tempted to "just fix this one thing" — stop and report back
44+
instead.
4545

4646
## Issue file
4747

@@ -57,22 +57,23 @@ can read your findings without relying on the agent return message.
5757
Follow these steps:
5858

5959
1. **Understand the issue.** Read the issue file. Identify reported behavior,
60-
expected behavior, and any reproduction steps the reporter included.
60+
expected behavior, and any reproduction steps the reporter included.
6161

6262
2. **Study the feature.** Read the relevant documentation (`docs/`, READMEs)
63-
and source code to understand how the feature is _supposed_ to work. This is
64-
critical — you need enough context to assess complexity and design a
65-
reproduction that actually targets the bug.
63+
and source code to understand how the feature is _supposed_ to work. This is
64+
critical — you need enough context to assess complexity and design a
65+
reproduction that actually targets the bug.
6666

6767
3. **Reproduce the bug.** Always attempt E2E reproduction — no exceptions:
6868

6969
a. **E2E reproduction (required first attempt).** Use the `e2e-testing` skill to
7070
learn how to run headless and interactive tests, then execute a reproduction:
71+
7172
- **Headless mode**: for logic bugs, tool execution issues, output problems.
7273
- **Interactive mode (tmux)**: for TUI rendering, keyboard, visual issues.
7374
- Use the globally installed `qwen` command — this matches what the user
74-
ran. Do NOT run `npm run build`, `npm run bundle`, or use
75-
`node dist/cli.js` during reproduction.
75+
ran. Do NOT run `npm run build`, `npm run bundle`, or use
76+
`node dist/cli.js` during reproduction.
7677

7778
b. **Test-script fallback.** Only if E2E reproduction is genuinely impractical
7879
(e.g., the bug is deep in internal logic with no observable CLI behavior, or the
@@ -89,14 +90,14 @@ The caller will tell you they've applied a fix and built the bundle, and give
8990
you the issue file path.
9091

9192
1. Read the issue file to get the issue details and your previous reproduction
92-
report.
93+
report.
9394
2. Use `node dist/cli.js` (not `qwen`) — this tests the local changes.
9495
3. Re-run the same reproduction steps that previously triggered the bug.
9596
4. Confirm the bug is gone and the basic happy path still works.
9697
5. If you originally reproduced via a test script, run that test again to
97-
confirm it passes.
98+
confirm it passes.
9899
6. Update the `## Reproduction report` section of the issue file with the
99-
verification result.
100+
verification result.
100101

101102
## Output format
102103

.qwen/commands/qc/code-review.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ description: Code review a pull request
55
You are an expert code reviewer. Follow these steps:
66

77
1. If no PR number is provided in the args, use Bash(\"gh pr list\") to show
8-
open PRs
8+
open PRs
99
2. If a PR number is provided, use Bash(\"gh pr view <number>\") to get PR
10-
details
10+
details
1111
3. Use Bash(\"gh pr diff <number>\") to get the diff
1212
4. Analyze the changes and provide a thorough code review that includes:
13+
1314
- Overview of what the PR does
1415
- Analysis of code quality and style
1516
- Specific suggestions for improvements

.qwen/commands/qc/commit.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ the user, then commit and push.
4141
- **If current branch is NOT main/master:**
4242
- Check if branch name matches the staged changes
4343
- If branch name doesn't match changes, ask user:
44-
- "Current branch `<branch>` doesn't seem to match these changes."
45-
- "Options: (1) Create a new branch, (2) Commit on current branch"
46-
- Wait for user decision
44+
- "Current branch `<branch>` doesn't seem to match these changes."
45+
- "Options: (1) Create a new branch, (2) Commit on current branch"
46+
- Wait for user decision
4747

4848
### 5. Generate commit message
4949

.qwen/commands/qc/create-issue.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,35 @@ The user provides a brief description of a feature request or bug report:
1717
## Steps
1818

1919
1. **Understand the request**
20+
2021
- Read the user's description carefully
2122
- Determine whether this is a feature request or a bug report
2223

2324
2. **Investigate the codebase**
25+
2426
- Search for relevant code, files, and existing behavior related to the request
2527
- Build a thorough understanding of how the current system works
2628
- Identify any related issues or prior art if mentioned
2729

2830
3. **Draft the issue**
31+
2932
- Write a markdown file for the user to review
3033
- Use the appropriate template:
31-
- Feature request: follow @.github/ISSUE_TEMPLATE/feature_request.yml
32-
- Bug report: follow @.github/ISSUE_TEMPLATE/bug_report.yml
34+
- Feature request: follow @.github/ISSUE_TEMPLATE/feature_request.yml
35+
- Bug report: follow @.github/ISSUE_TEMPLATE/bug_report.yml
3336
- Write from the user's perspective, not as an implementation spec
3437
- Keep the language clear and concise, AVOID internal implementation details
3538

3639
4. **Review with user**
40+
3741
- Present the draft file to the user
3842
- Iterate on feedback until the user is satisfied
3943
- Do NOT submit until the user explicitly asks to
4044

4145
5. **Submit the issue**
46+
4247
- When the user confirms, create the issue using `gh issue create`
4348
- Apply the appropriate labels:
44-
- Feature request: `type/feature-request`, `status/needs-triage`
45-
- Bug report: `type/bug`, `status/needs-triage`
49+
- Feature request: `type/feature-request`, `status/needs-triage`
50+
- Bug report: `type/bug`, `status/needs-triage`
4651
- Report back the issue URL

.qwen/commands/qc/create-pr.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ Create a well-structured pull request with proper description and title.
1111
## Steps
1212

1313
1. **Review staged changes**
14+
1415
- Review all staged changes to understand what has been done
1516
- Do not touch unstaged changes
1617

1718
2. **Prepare branch**
19+
1820
- Create a new branch with proper name if current branch is main
1921
- Ensure all changes are committed
2022
- Push branch to remote
2123

2224
3. **Write PR description**
25+
2326
- Use PR Template below
2427
- Summarize changes clearly
2528
- Include context and motivation
@@ -31,13 +34,14 @@ Create a well-structured pull request with proper description and title.
3134
Code](https://github.com/QwenLM/qwen-code)", with a line separator
3235

3336
4. **Set up PR**
37+
3438
- Create PR title and body
3539
- Submit PR with gh command
3640
- **If a GitHub token is provided in the user's message**, use it by setting
3741
the `GH_TOKEN` environment variable:
38-
```bash
39-
GH_TOKEN=<provided_token> gh pr create --title "..." --body "..."
40-
```
42+
```bash
43+
GH_TOKEN=<provided_token> gh pr create --title "..." --body "..."
44+
```
4145
- If no token is provided, use the default `gh` authentication
4246

4347
## PR Template

.qwen/skills/qwen-code-claw/SKILL.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,27 @@ To use acpx:
6565

6666
1. **Install acpx globally** (recommended) or use npx:
6767

68-
```bash
69-
npm install -g acpx@latest
70-
```
68+
```bash
69+
npm install -g acpx@latest
70+
```
7171

7272
Or without installing:
7373

74-
```bash
75-
npx acpx@latest
76-
```
74+
```bash
75+
npx acpx@latest
76+
```
7777

7878
2. **Install the acpx skill** for full reference:
7979

80-
```bash
81-
npx acpx@latest --skill install acpx
82-
```
80+
```bash
81+
npx acpx@latest --skill install acpx
82+
```
8383

8484
3. **Read the acpx skill reference** for every command, flag, and workflow
85-
pattern: See the [ACPX Reference](#acpx-reference) section below for details
85+
pattern: See the [ACPX Reference](#acpx-reference) section below for details
8686

8787
4. **For complete CLI reference with all options and examples**:
88-
https://raw.githubusercontent.com/openclaw/acpx/main/docs/CLI.md
88+
https://raw.githubusercontent.com/openclaw/acpx/main/docs/CLI.md
8989

9090
From now on, when you need to delegate work to Qwen Code, use `acpx` instead of
9191
spawning raw terminal sessions. For example:
@@ -96,7 +96,7 @@ npx acpx@latest qwen "refactor the auth module"
9696
npx acpx@latest qwen exec "one-shot: summarize this repo"
9797
```
9898

99-
> **Tip:** You should typically use the `--approve-all` flag to prevent task
99+
> **Tip:** You should typically use the `--approve-all` flag to prevent task
100100
> interruptions.
101101
102102
## Practical Workflows
@@ -207,17 +207,17 @@ Full reference: `docs/users/configuration/model-providers.md`.
207207
### Key Features
208208

209209
- Approval Mode: control tool execution permissions.
210-
See `docs/users/features/approval-mode.md`.
210+
See `docs/users/features/approval-mode.md`.
211211
- MCP: Model Context Protocol server integration.
212-
See `docs/users/features/mcp.md`.
212+
See `docs/users/features/mcp.md`.
213213
- Skills: reusable skill system via `/skill`.
214-
See `docs/users/features/skills.md`.
214+
See `docs/users/features/skills.md`.
215215
- Sub-agents: delegate tasks to specialized agents.
216-
See `docs/users/features/sub-agents.md`.
216+
See `docs/users/features/sub-agents.md`.
217217
- Sandbox: secure code execution environment.
218-
See `docs/users/features/sandbox.md`.
218+
See `docs/users/features/sandbox.md`.
219219
- Headless: non-interactive or CI mode.
220-
See `docs/users/features/headless.md`.
220+
See `docs/users/features/headless.md`.
221221

222222
## ACPX Reference
223223

@@ -254,7 +254,7 @@ acpx [global options] <agent> prompt [options] [prompt text...]
254254
acpx [global options] <agent> exec [options] [prompt text...]
255255
```
256256

257-
> **Note:** If prompt text is omitted and stdin is piped, `acpx` reads prompt
257+
> **Note:** If prompt text is omitted and stdin is piped, `acpx` reads prompt
258258
> from stdin.
259259
260260
### Global Options

.qwen/skills/structured-debugging/SKILL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ Then apply the fix, remove instrumentation, and verify with a clean run.
187187

188188
## Worked examples
189189

190-
-
191-
`examples/headless-bg-agent-empty-stdout.md`
190+
- `examples/headless-bg-agent-empty-stdout.md`
192191
— pipe-captured runs all passed; the user's TTY printed nothing. The
193192
contradiction _was_ the bug. Illustrates _reproduction contradiction is data_
194193
and _instrument data, not code paths_.

.qwen/skills/terminal-capture/SKILL.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ node-pty (pseudo-terminal)
3232
Core files:
3333

3434
- `integration-tests/terminal-capture/terminal-capture.ts`
35-
Low-level PTY, xterm.js, and Playwright engine.
35+
Low-level PTY, xterm.js, and Playwright engine.
3636
- `integration-tests/terminal-capture/scenario-runner.ts`
37-
Scenario executor for config, interactions, and screenshots.
37+
Scenario executor for config, interactions, and screenshots.
3838
- `integration-tests/terminal-capture/run.ts`
39-
CLI entry point for batch scenario runs.
39+
CLI entry point for batch scenario runs.
4040
- `integration-tests/terminal-capture/scenarios/*.ts`
41-
Scenario configuration files.
41+
Scenario configuration files.
4242

4343
## Quick Start
4444

@@ -226,17 +226,17 @@ This tool is commonly used for visual verification during PR reviews.
226226
## Troubleshooting
227227

228228
- Playwright error `browser not found`
229-
Cause: browser not installed.
230-
Solution: `npx playwright install chromium`.
229+
Cause: browser not installed.
230+
Solution: `npx playwright install chromium`.
231231
- Blank screenshot
232-
Cause: process starts slowly or build failed.
233-
Solution: check build success and the spawn command.
232+
Cause: process starts slowly or build failed.
233+
Solution: check build success and the spawn command.
234234
- PTY-related errors
235-
Cause: node-pty native module not compiled.
236-
Solution: `npm rebuild node-pty`.
235+
Cause: node-pty native module not compiled.
236+
Solution: `npm rebuild node-pty`.
237237
- Unstable screenshot output
238-
Cause: terminal output not fully rendered.
239-
Solution: add scenario wait time.
238+
Cause: terminal output not fully rendered.
239+
Solution: add scenario wait time.
240240

241241
## Full ScenarioConfig Type
242242

AGENTS.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ applicable.
165165

166166
Project artifacts live under `.qwen/`:
167167

168-
| Directory | Purpose |
169-
|---|---|
170-
| `.qwen/design/` | Design docs for planned features |
171-
| `.qwen/e2e-tests/` | E2E test plans and results |
172-
| `.qwen/issues/` | Issue drafts before filing on GitHub |
173-
| `.qwen/pr-drafts/` | PR drafts before submitting |
174-
| `.qwen/pr-reviews/` | PR review notes |
175-
| `.qwen/investigations/` | Structured debugging journals |
176-
| `.qwen/scripts/` | Utility scripts |
168+
| Directory | Purpose |
169+
| ----------------------- | ------------------------------------ |
170+
| `.qwen/design/` | Design docs for planned features |
171+
| `.qwen/e2e-tests/` | E2E test plans and results |
172+
| `.qwen/issues/` | Issue drafts before filing on GitHub |
173+
| `.qwen/pr-drafts/` | PR drafts before submitting |
174+
| `.qwen/pr-reviews/` | PR review notes |
175+
| `.qwen/investigations/` | Structured debugging journals |
176+
| `.qwen/scripts/` | Utility scripts |

packages/cli/src/acp-integration/session/Session.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,43 @@ describe('Session', () => {
246246
});
247247
});
248248

249+
it('attaches available skills to available_commands_update metadata', async () => {
250+
getAvailableCommandsSpy.mockResolvedValueOnce([
251+
{
252+
name: 'init',
253+
description: 'Initialize project context',
254+
},
255+
]);
256+
mockConfig.getSkillManager = vi.fn().mockReturnValue({
257+
listSkills: vi
258+
.fn()
259+
.mockResolvedValue([
260+
{ name: 'code-review-expert' },
261+
{ name: 'verification-pack' },
262+
]),
263+
});
264+
265+
await session.sendAvailableCommandsUpdate();
266+
267+
expect(mockClient.sessionUpdate).toHaveBeenCalledTimes(1);
268+
expect(mockClient.sessionUpdate).toHaveBeenCalledWith({
269+
sessionId: 'test-session-id',
270+
update: {
271+
sessionUpdate: 'available_commands_update',
272+
availableCommands: [
273+
{
274+
name: 'init',
275+
description: 'Initialize project context',
276+
input: null,
277+
},
278+
],
279+
_meta: {
280+
availableSkills: ['code-review-expert', 'verification-pack'],
281+
},
282+
},
283+
});
284+
});
285+
249286
it('swallows errors and does not throw', async () => {
250287
getAvailableCommandsSpy.mockRejectedValueOnce(
251288
new Error('Command discovery failed'),

0 commit comments

Comments
 (0)