@qwen-code/qwen-code 0.14.5 → 0.15.0-nightly.20260423.d40fe7cdb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  - **2026-04-13**: Qwen OAuth free tier policy update: daily quota adjusted to 100 requests/day (from 1,000).
26
26
 
27
- - **2026-04-02**: Qwen3.6-Plus is now live! Sign in via Qwen OAuth to use it directly, or get an API key from [Alibaba Cloud ModelStudio](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=doc#/doc/?type=model&url=2840914_2&modelId=qwen3.6-plus) to access it through the OpenAI-compatible API.
27
+ - **2026-04-02**: Qwen3.6-Plus is now live! Get an API key from [Alibaba Cloud ModelStudio](https://modelstudio.console.alibabacloud.com/ap-southeast-1?tab=doc#/doc/?type=model&url=2840914_2&modelId=qwen3.6-plus) to access it through the OpenAI-compatible API.
28
28
 
29
29
  - **2026-02-16**: Qwen3.5-Plus is now live!
30
30
 
@@ -49,10 +49,12 @@ Qwen Code is an open-source AI agent for the terminal, optimized for Qwen series
49
49
  bash -c "$(curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.sh)"
50
50
  ```
51
51
 
52
- #### Windows (Run as Administrator CMD)
52
+ #### Windows (Run as Administrator)
53
+
54
+ Works in both Command Prompt and PowerShell:
53
55
 
54
56
  ```cmd
55
- curl -fsSL -o %TEMP%\install-qwen.bat https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat && %TEMP%\install-qwen.bat
57
+ powershell -Command "Invoke-WebRequest 'https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen.bat' -OutFile (Join-Path $env:TEMP 'install-qwen.bat'); & (Join-Path $env:TEMP 'install-qwen.bat')"
56
58
  ```
57
59
 
58
60
  > **Note**: It's recommended to restart your terminal after installation to ensure environment variables take effect.
@@ -118,26 +120,16 @@ Then follow the instructions inside to install, authenticate, and use Qwen Code
118
120
 
119
121
  ## Authentication
120
122
 
121
- Qwen Code supports two authentication methods:
122
-
123
- - **Qwen OAuth (recommended & free)**: sign in with your `qwen.ai` account in a browser.
124
- - **API-KEY**: use an API key to connect to any supported provider (OpenAI, Anthropic, Google GenAI, Alibaba Cloud ModelStudio, and other compatible endpoints).
125
-
126
- #### Qwen OAuth (recommended)
127
-
128
- Start `qwen`, then run:
129
-
130
- ```bash
131
- /auth
132
- ```
123
+ Qwen Code supports the following authentication methods:
133
124
 
134
- Choose **Qwen OAuth** and complete the browser flow. Your credentials are cached locally so you usually won't need to log in again.
125
+ - **API Key (recommended)**: use an API key from Alibaba Cloud Model Studio ([Beijing](https://bailian.console.aliyun.com/) / [intl](https://modelstudio.console.alibabacloud.com/)) or any supported provider (OpenAI, Anthropic, Google GenAI, and other compatible endpoints).
126
+ - **Coding Plan**: subscribe to the Alibaba Cloud Coding Plan ([Beijing](https://bailian.console.aliyun.com/cn-beijing?tab=coding-plan#/efm/coding-plan-index) / [intl](https://modelstudio.console.alibabacloud.com/?tab=coding-plan#/efm/coding-plan-index)) for a fixed monthly fee with higher quotas.
135
127
 
136
- > **Note:** In non-interactive or headless environments (e.g., CI, SSH, containers), you typically **cannot** complete the OAuth browser login flow. In these cases, please use the API-KEY authentication method.
128
+ > ⚠️ **Qwen OAuth was discontinued on April 15, 2026.** If you were previously using Qwen OAuth, please switch to one of the methods above. Run `qwen` and then `/auth` to reconfigure.
137
129
 
138
- #### API-KEY (flexible)
130
+ #### API Key (recommended)
139
131
 
140
- Use this if you want more flexibility over which provider and model to use. Supports multiple protocols:
132
+ Use an API key to connect to Alibaba Cloud Model Studio or any supported provider. Supports multiple protocols:
141
133
 
142
134
  - **OpenAI-compatible**: Alibaba Cloud ModelStudio, ModelScope, OpenAI, OpenRouter, and other OpenAI-compatible providers
143
135
  - **Anthropic**: Claude models
@@ -357,6 +349,74 @@ Use the `/model` command at any time to switch between all configured models.
357
349
 
358
350
  > **Security note:** Never commit API keys to version control. The `~/.qwen/settings.json` file is in your home directory and should stay private.
359
351
 
352
+ #### Local Model Setup (Ollama / vLLM)
353
+
354
+ You can also run models locally — no API key or cloud account needed. This is not an authentication method; instead, configure your local model endpoint in `~/.qwen/settings.json` using the `modelProviders` field.
355
+
356
+ <details>
357
+ <summary>Ollama setup</summary>
358
+
359
+ 1. Install Ollama from [ollama.com](https://ollama.com/)
360
+ 2. Pull a model: `ollama pull qwen3:32b`
361
+ 3. Configure `~/.qwen/settings.json`:
362
+
363
+ ```json
364
+ {
365
+ "modelProviders": {
366
+ "openai": [
367
+ {
368
+ "id": "qwen3:32b",
369
+ "name": "Qwen3 32B (Ollama)",
370
+ "baseUrl": "http://localhost:11434/v1",
371
+ "description": "Qwen3 32B running locally via Ollama"
372
+ }
373
+ ]
374
+ },
375
+ "security": {
376
+ "auth": {
377
+ "selectedType": "openai"
378
+ }
379
+ },
380
+ "model": {
381
+ "name": "qwen3:32b"
382
+ }
383
+ }
384
+ ```
385
+
386
+ </details>
387
+
388
+ <details>
389
+ <summary>vLLM setup</summary>
390
+
391
+ 1. Install vLLM: `pip install vllm`
392
+ 2. Start the server: `vllm serve Qwen/Qwen3-32B`
393
+ 3. Configure `~/.qwen/settings.json`:
394
+
395
+ ```json
396
+ {
397
+ "modelProviders": {
398
+ "openai": [
399
+ {
400
+ "id": "Qwen/Qwen3-32B",
401
+ "name": "Qwen3 32B (vLLM)",
402
+ "baseUrl": "http://localhost:8000/v1",
403
+ "description": "Qwen3 32B running locally via vLLM"
404
+ }
405
+ ]
406
+ },
407
+ "security": {
408
+ "auth": {
409
+ "selectedType": "openai"
410
+ }
411
+ },
412
+ "model": {
413
+ "name": "Qwen/Qwen3-32B"
414
+ }
415
+ }
416
+ ```
417
+
418
+ </details>
419
+
360
420
  ## Usage
361
421
 
362
422
  As an open-source terminal agent, you can use Qwen Code in four primary ways:
@@ -459,6 +519,10 @@ Looking for a graphical interface?
459
519
 
460
520
  If you encounter issues, check the [troubleshooting guide](https://qwenlm.github.io/qwen-code-docs/en/users/support/troubleshooting/).
461
521
 
522
+ **Common issues:**
523
+
524
+ - **`Qwen OAuth free tier was discontinued on 2026-04-15`**: Qwen OAuth is no longer available. Run `qwen` → `/auth` and switch to API Key or Coding Plan. See the [Authentication](#authentication) section above for setup instructions.
525
+
462
526
  To report a bug from within the CLI, run `/bug` and include a short title and repro steps.
463
527
 
464
528
  ## Connect with Us
@@ -0,0 +1,303 @@
1
+ ---
2
+ name: batch
3
+ description: Execute batch operations on multiple files in parallel. Automatically discovers files, splits into chunks, and processes with parallel worker agents. Use `/batch` followed by operation and file pattern.
4
+ allowedTools:
5
+ - task
6
+ - glob
7
+ - grep_search
8
+ - read_file
9
+ - edit
10
+ - write_file
11
+ - run_shell_command
12
+ - ask_user_question
13
+ ---
14
+
15
+ # /batch - Parallel Batch Operations
16
+
17
+ You are orchestrating a batch operation across multiple files. Your job is to:
18
+
19
+ 1. Parse the user's request to understand the target files and operation
20
+ 2. Discover matching files using glob
21
+ 3. Split files into chunks for parallel processing
22
+ 4. Launch multiple worker agents to process files concurrently
23
+ 5. Aggregate results and present a summary
24
+
25
+ ## Step 1: Parse Intent and Discover Files
26
+
27
+ First, parse the user's request to identify:
28
+
29
+ - **Target pattern**: glob pattern for files (e.g., `src/**/*.ts`, `**/*.js`)
30
+ - **Operation**: what to do with each file (e.g., "add JSDoc comments", "convert to TypeScript")
31
+
32
+ If the user didn't specify a pattern, infer it from context or ask for clarification.
33
+
34
+ Use the `glob` tool to discover matching files.
35
+
36
+ **If no files match the pattern**:
37
+
38
+ - Inform the user that no files were found for the given pattern
39
+ - Suggest checking the pattern or broadening the search scope
40
+ - Do not proceed with an empty batch
41
+
42
+ Apply these common exclusions automatically:
43
+
44
+ - `node_modules/**`
45
+ - `dist/**`
46
+ - `build/**`
47
+ - `.git/**`
48
+ - `**/*.test.ts`, `**/*.test.js`
49
+ - `**/*.spec.ts`, `**/*.spec.js`
50
+ - `**/__tests__/**`
51
+ - `**/test/**`, `**/tests/**`
52
+ - `**/package-lock.json`
53
+ - `**/yarn.lock`
54
+ - `**/*.min.js`
55
+ - Binary files (images, fonts, etc.)
56
+ - Files larger than 500KB (check size if needed)
57
+
58
+ **Important**: If more than 50 files match, inform the user with the exact count and the file list, then proceed. The user can cancel (Ctrl+C) if needed. If the count exceeds 100 files, warn the user and suggest a more specific pattern instead of proceeding.
59
+
60
+ ## Step 2: Chunk Files for Parallel Processing
61
+
62
+ Split the discovered files into chunks based on these rules:
63
+
64
+ | Total Files | Chunk Count | Files Per Chunk |
65
+ | ----------- | ----------- | --------------- |
66
+ | 1-5 | 1 | All files |
67
+ | 6-15 | 2 | 3-8 each |
68
+ | 16-30 | 3 | ~10 each |
69
+ | 31-50 | 4 | ~10-12 each |
70
+ | 51-75 | 5 | ~10-15 each |
71
+ | 76-100 | 5 | ~15-20 each |
72
+
73
+ **Chunking algorithm**:
74
+
75
+ - Minimum chunk size: 3 files (avoid over-parallelization for small batches)
76
+ - Maximum chunk size: 15 files (ensure reasonable work per agent)
77
+ - Maximum parallel agents: 5 (API rate limit consideration)
78
+
79
+ Example: 24 files → 3 chunks of ~8 files each
80
+
81
+ ## Step 3: Launch Parallel Worker Agents
82
+
83
+ Launch worker agents **in parallel** by invoking the `task` tool (the Agent tool) multiple times in a **SINGLE message**.
84
+
85
+ **Note**: The `task` tool in allowedTools is the Agent tool used to spawn worker agents.
86
+
87
+ Each worker agent should receive:
88
+
89
+ - The list of files to process (full paths)
90
+ - The operation to perform
91
+ - Clear instructions to report success/failure per file
92
+
93
+ Use the `general-purpose` subagent type for workers.
94
+
95
+ **CRITICAL**: All Agent tool calls MUST be in a single response to enable parallel execution. The system automatically runs multiple Agent calls concurrently.
96
+
97
+ ### Agent Prompt Template
98
+
99
+ For each chunk, use this prompt format:
100
+
101
+ ```
102
+ You are a worker agent processing a batch of files.
103
+
104
+ **Operation**: [describe the operation, e.g., "Add JSDoc comments to all exported functions"]
105
+
106
+ **Files to process**:
107
+ - [file1.ts]
108
+ - [file2.ts]
109
+ - ...
110
+
111
+ **Instructions**:
112
+ 1. Process each file independently
113
+ 2. For each file, report one of:
114
+ - SUCCESS: [file path] - [brief description of change]
115
+ - FAILED: [file path] - [reason for failure]
116
+ - SKIPPED: [file path] - [reason for skipping]
117
+ 3. If a file fails or is skipped, continue with the next file - do not abort
118
+ 4. At the end, provide a summary of what was done
119
+
120
+ **Constraints**:
121
+ - Do not modify test files unless explicitly requested
122
+ - Preserve existing code style and formatting
123
+ - Make minimal necessary changes to accomplish the operation
124
+ ```
125
+
126
+ ### Example Invocation Pattern
127
+
128
+ ```
129
+ <Agent tool call 1>
130
+ description: "Process batch chunk 1/3"
131
+ prompt: "You are a worker agent... [full prompt as above]"
132
+ subagent_type: "general-purpose"
133
+ </Agent tool call 1>
134
+
135
+ <Agent tool call 2>
136
+ description: "Process batch chunk 2/3"
137
+ prompt: "You are a worker agent... [full prompt as above]"
138
+ subagent_type: "general-purpose"
139
+ </Agent tool call 2>
140
+
141
+ <Agent tool call 3>
142
+ description: "Process batch chunk 3/3"
143
+ prompt: "You are a worker agent... [full prompt as above]"
144
+ subagent_type: "general-purpose"
145
+ </Agent tool call 3>
146
+ ```
147
+
148
+ ## Step 4: Aggregate Results
149
+
150
+ After all worker agents complete, aggregate their results into a clear summary.
151
+
152
+ ### Output Format
153
+
154
+ ```markdown
155
+ ### Batch Operation Complete
156
+
157
+ **Operation**: [description of what was done]
158
+ **Files discovered**: [total count]
159
+ **Chunks processed**: [number of parallel agents]
160
+ **Total time**: [duration if tracked]
161
+
162
+ | Status | Count |
163
+ | ------- | ----- |
164
+ | Success | [N] |
165
+ | Failed | [N] |
166
+ | Skipped | [N] |
167
+
168
+ **Successful files**:
169
+
170
+ - [file1.ts] - [brief description]
171
+ - [file2.ts] - [brief description]
172
+ ...
173
+
174
+ **Failed files** (if any):
175
+
176
+ - [file.ts]: [reason for failure]
177
+
178
+ **Skipped files** (if any):
179
+
180
+ - [file.ts]: [reason for skipping]
181
+ ```
182
+
183
+ ### Handling Partial Failures
184
+
185
+ If some files failed but others succeeded:
186
+
187
+ - Clearly report which files succeeded
188
+ - List failures with specific reasons
189
+ - Suggest follow-up actions if appropriate
190
+
191
+ If all files failed:
192
+
193
+ - Report the common failure pattern
194
+ - Suggest potential fixes
195
+
196
+ ## Step 5: Error Handling
197
+
198
+ ### During Batch Processing
199
+
200
+ 1. **Single file failure**: Don't abort the batch. The worker agent records the error and continues.
201
+ 2. **Agent failure**: If a worker agent fails completely (timeout, crash), note the chunk as failed with reason.
202
+ 3. **User cancellation**: If the user sends Ctrl+C, the system will cancel all pending agents gracefully.
203
+
204
+ ### Error Reporting
205
+
206
+ For each failed file, include:
207
+
208
+ - File path
209
+ - Specific error message or reason
210
+ - Suggested fix if obvious
211
+
212
+ ## Usage Examples
213
+
214
+ ### Example 1: Add License Headers
215
+
216
+ ```
217
+ /batch Add Apache 2.0 license header to all .ts files in src/
218
+ ```
219
+
220
+ **Flow**:
221
+
222
+ 1. glob `src/**/*.ts` → find 45 files
223
+ 2. Split into 4 chunks
224
+ 3. Launch 4 parallel agents
225
+ 4. Each agent adds the license header to its assigned files
226
+ 5. Summary: 45 files processed, 45 succeeded, 0 failed
227
+
228
+ ### Example 2: Convert JavaScript to TypeScript
229
+
230
+ ```
231
+ /batch Convert all .js files in utils/ to TypeScript
232
+ ```
233
+
234
+ **Flow**:
235
+
236
+ 1. glob `utils/**/*.js` → find 12 files
237
+ 2. Split into 2 chunks
238
+ 3. Launch 2 parallel agents
239
+ 4. Each agent converts files and renames to .ts
240
+ 5. Summary: 12 files processed, 10 succeeded, 2 failed (complex dynamic patterns)
241
+
242
+ ### Example 3: Fix Lint Errors
243
+
244
+ ```
245
+ /batch Fix all @typescript-eslint/no-explicit-any errors in src/
246
+ ```
247
+
248
+ **Flow**:
249
+
250
+ 1. Use `grep_search` to find files containing `: any` pattern in `src/`
251
+ 2. Filter to relevant files
252
+ 3. Split into chunks and launch parallel agents
253
+ 4. Each agent fixes the specific lint issue (replace `any` with proper types)
254
+ 5. Summary: 8 files fixed
255
+
256
+ ## Constraints and Limits
257
+
258
+ | Constraint | Value | Reason |
259
+ | ------------------- | ----- | ---------------------------- |
260
+ | Max files per batch | 100 | Prevent resource exhaustion |
261
+ | Max parallel agents | 5 | API rate limit consideration |
262
+ | Min files per agent | 3 | Avoid over-parallelization |
263
+ | Max files per agent | 15 | Ensure meaningful work |
264
+ | File size limit | 500KB | Avoid context overflow |
265
+
266
+ ## Dry-Run Mode
267
+
268
+ If the user wants to preview what will be changed without actually modifying files (e.g., "preview", "show me what would change", "dry run"):
269
+
270
+ 1. Discover and list all matching files with counts
271
+ 2. Show the planned operation for each file
272
+ 3. Display the chunking strategy
273
+ 4. Ask the user if they want to proceed with the actual changes
274
+ 5. If user confirms, execute the batch operation
275
+
276
+ **Example**:
277
+
278
+ ```
279
+ /batch preview adding JSDoc comments to src/**/*.ts
280
+ ```
281
+
282
+ **Expected output**:
283
+
284
+ ```
285
+ ### Dry-Run Preview
286
+
287
+ **Operation**: Add JSDoc comments to all .ts files in src/
288
+
289
+ **Files discovered**: 24 files
290
+
291
+ **Chunking plan**:
292
+ | Chunk | Files |
293
+ |-------|-------|
294
+ | 1 | src/utils/a.ts, b.ts, c.ts, ... (8 files) |
295
+ | 2 | src/components/x.ts, y.ts, ... (8 files) |
296
+ | 3 | src/services/m.ts, n.ts, ... (8 files) |
297
+
298
+ **Planned operation per file**:
299
+ - Add JSDoc comments to all exported functions
300
+ - Preserve existing code style
301
+
302
+ Proceed? (y/n)
303
+ ```