@coze/cli 0.1.0-alpha.391559 → 0.1.0-alpha.5276dd

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
@@ -23,7 +23,7 @@ coze space list
23
23
  coze space use <space_id>
24
24
 
25
25
  # 4. Start using Coze Coding
26
- coze code project create --message "Build an intelligent assistant" --type web
26
+ coze code project create -m "Build an intelligent assistant" --type web
27
27
  ```
28
28
 
29
29
  ## Authentication
@@ -40,7 +40,10 @@ coze auth login --token <YOUR_PAT>
40
40
  # Check current login status
41
41
  coze auth status
42
42
 
43
- # Logout
43
+ # Check status in JSON format
44
+ coze auth status --format json
45
+
46
+ # Logout and clear credentials
44
47
  coze auth logout
45
48
  ```
46
49
 
@@ -54,24 +57,30 @@ export COZE_API_TOKEN=<YOUR_PAT>
54
57
 
55
58
  ### `coze auth` — Authentication
56
59
 
60
+ Manage the full authentication lifecycle. Supports interactive OAuth login via browser and non-interactive login via Personal Access Token (PAT) for CI/CD pipelines.
61
+
57
62
  | Command | Description |
58
63
  |---|---|
59
64
  | `coze auth login --oauth` | Interactive login via browser |
60
65
  | `coze auth login --token <PAT>` | Login with a Personal Access Token |
61
- | `coze auth status` | Check current login status |
66
+ | `coze auth status` | Check current login status and credential validity |
62
67
  | `coze auth logout` | Logout and clear stored credentials |
63
68
 
64
69
  ### `coze organization` — Organization Management
65
70
 
71
+ View and switch organizations to set the default Organization ID for subsequent commands.
72
+
66
73
  | Command | Description |
67
74
  |---|---|
68
- | `coze organization list` | List all accessible organizations |
69
- | `coze organization use <org_id>` | Set the default organization |
75
+ | `coze organization list` | List all accessible organizations and their enterprises |
76
+ | `coze organization use <org_id>` | Set the default organization (auto-saves Enterprise ID) |
70
77
 
71
78
  Alias: `coze org`
72
79
 
73
80
  ### `coze space` — Workspace Management
74
81
 
82
+ View and switch workspaces to set the default Space ID for subsequent commands.
83
+
75
84
  | Command | Description |
76
85
  |---|---|
77
86
  | `coze space list` | List all spaces under the current organization |
@@ -81,92 +90,292 @@ Alias: `coze org`
81
90
 
82
91
  #### Project
83
92
 
93
+ Manage Coze Coding projects. Supports creating, viewing, listing, and deleting projects across various types.
94
+
84
95
  | Command | Description |
85
96
  |---|---|
86
97
  | `coze code project create` | Create a new project from natural language description |
87
- | `coze code project list` | List all projects |
88
- | `coze code project get <id>` | Get project details |
89
- | `coze code project delete <id>` | Delete a project |
98
+ | `coze code project list` | List all projects in the current space |
99
+ | `coze code project get <projectId>` | Get project details |
100
+ | `coze code project delete <projectId>` | Delete a project (irreversible) |
101
+
102
+ Alias: `coze code proj`
90
103
 
91
104
  ```bash
92
- # Create an Agent project
93
- coze code project create --message "Create a customer service bot" --type agent
105
+ # Create a Web project
106
+ coze code project create -m "Create a chatbot" --type web
94
107
 
95
- # Supported types: agent, workflow, app, skill, web, miniprogram, assistant
108
+ # Create and wait for the initial build to complete
109
+ coze code project create -m "Create a data dashboard" --type app --wait
110
+
111
+ # List projects with filters
112
+ coze code project list --type agent --type workflow
113
+ coze code project list --name "customer service"
114
+ coze code project list --size 20 --has-published true
96
115
  ```
97
116
 
117
+ **`project create` options:**
118
+
119
+ | Option | Description |
120
+ |---|---|
121
+ | `-m, --message <message>` | **(required)** Project description in natural language |
122
+ | `--type <type>` | **(required)** Project type: `web` \| `app` |
123
+ | `--wait` | Wait for project creation to complete |
124
+ | `--org-id <orgId>` | Organization ID (reads from context if omitted) |
125
+ | `--space-id <spaceId>` | Space ID (reads from context if omitted) |
126
+
127
+ **`project list` options:**
128
+
129
+ | Option | Description |
130
+ |---|---|
131
+ | `--size <size>` | Number of projects to return (default: 10) |
132
+ | `--cursor-id <cursorId>` | Cursor for pagination |
133
+ | `--type <type>` | Filter by type (can pass multiple times): `agent` \| `workflow` \| `webapp` \| `app` \| `web` \| `miniprogram` \| `assistant` |
134
+ | `--name <name>` | Filter by project name |
135
+ | `--has-published <bool>` | Filter by publish status |
136
+ | `--search-scope <n>` | Created by (0=All, 1=CreatedByMe, 2=AllWithCollaborator) |
137
+ | `--folder-id <id>` | Filter by folder |
138
+ | `--order-type <n>` | Sort type (0=descending, 1=ascending) |
139
+ | `--is-fav-filter <bool>` | Filter favorites only |
140
+
98
141
  #### Message
99
142
 
143
+ Send and manage chat messages in Coze Coding projects. The project ID is specified on the `message` parent command and shared by all subcommands.
144
+
100
145
  | Command | Description |
101
146
  |---|---|
102
147
  | `coze code message send [message]` | Send a prompt message to a project chat |
103
- | `coze code message status` | Check message status |
148
+ | `coze code message status` | Query message status and get result when completed |
104
149
  | `coze code message cancel` | Cancel an ongoing message |
105
150
 
106
151
  ```bash
107
152
  # Send a message to a project
108
- coze code message send "Fix the login bug" --project-id 123456
153
+ coze code message send "Fix the login bug" -p 123456
154
+
155
+ # Mention local files with @ syntax for upload as context
156
+ coze code message send "Refactor @src/utils.ts to use async/await" -p 123456
157
+
158
+ # Mention multiple files
159
+ coze code message send "Compare @src/old.ts and @src/new.ts" -p 123456
109
160
 
110
161
  # Pipe context via stdin
111
- cat error.log | coze code message send "Analyze this error" --project-id 123456
162
+ cat error.log | coze code message send "Analyze this error" -p 123456
163
+
164
+ # Check message status (auto-fetches result when completed)
165
+ coze code message status -p 123456
166
+
167
+ # Cancel an ongoing message
168
+ coze code message cancel -p 123456
169
+
170
+ # Use environment variable for project ID
171
+ export COZE_PROJECT_ID=123456
172
+ coze code message send "Hello"
112
173
  ```
113
174
 
175
+ **`message` options (shared by all subcommands):**
176
+
177
+ | Option | Description |
178
+ |---|---|
179
+ | `-p, --project-id <id>` | Coze project ID (or env `COZE_PROJECT_ID`) |
180
+
114
181
  #### Deploy
115
182
 
183
+ Deploy projects to the production environment. Supports multiple project types including Agent, Workflow, Skill, Web, Mini-program, etc.
184
+
116
185
  | Command | Description |
117
186
  |---|---|
118
187
  | `coze code deploy <projectId>` | Deploy a project to production |
119
188
  | `coze code deploy <projectId> --wait` | Deploy and wait for completion |
120
189
  | `coze code deploy status <projectId>` | Check deployment status |
121
190
 
191
+ ```bash
192
+ # Deploy a project
193
+ coze code deploy <projectId>
194
+
195
+ # Deploy and wait for completion
196
+ coze code deploy <projectId> --wait
197
+
198
+ # Check latest deployment status
199
+ coze code deploy status <projectId>
200
+
201
+ # Check a specific deployment record
202
+ coze code deploy status <projectId> --deploy-id <deployHistoryId>
203
+ ```
204
+
122
205
  #### Environment Variables
123
206
 
207
+ Manage project environment variables (Secrets). Supports development and production environments.
208
+
124
209
  | Command | Description |
125
210
  |---|---|
126
- | `coze code env list` | List environment variables |
127
- | `coze code env set <key> <value>` | Set an environment variable |
128
- | `coze code env delete <key>` | Delete an environment variable |
211
+ | `coze code env list -p <projectId>` | List environment variables |
212
+ | `coze code env set <key> <value> -p <projectId>` | Set an environment variable |
213
+ | `coze code env delete <key> -p <projectId>` | Delete an environment variable |
214
+
215
+ ```bash
216
+ # List dev environment variables (default)
217
+ coze code env list -p <projectId>
218
+
219
+ # List prod environment variables
220
+ coze code env list -p <projectId> --env prod
221
+
222
+ # Set an environment variable
223
+ coze code env set API_KEY sk-xxxxx -p <projectId>
224
+
225
+ # Delete an environment variable
226
+ coze code env delete API_KEY -p <projectId>
227
+ ```
129
228
 
130
229
  #### Domain
131
230
 
231
+ Manage custom domains for deployed projects.
232
+
132
233
  | Command | Description |
133
234
  |---|---|
134
- | `coze code domain list` | List custom domains |
135
- | `coze code domain add <domain>` | Add a custom domain |
136
- | `coze code domain remove <domain>` | Remove a custom domain |
235
+ | `coze code domain list <projectId>` | List all custom domains bound to the project |
236
+ | `coze code domain add <domain> -p <projectId>` | Add a custom domain |
237
+ | `coze code domain remove <domain> -p <projectId>` | Remove a custom domain |
137
238
 
138
239
  #### Skill
139
240
 
241
+ Manage skills associated with a project to extend its capabilities.
242
+
140
243
  | Command | Description |
141
244
  |---|---|
142
- | `coze code skill list` | List skills |
143
- | `coze code skill add` | Add a skill |
144
- | `coze code skill remove` | Remove a skill |
245
+ | `coze code skill list <projectId>` | List all skills (shows installed status) |
246
+ | `coze code skill add <skillId> -p <projectId>` | Add a skill to the project |
247
+ | `coze code skill remove <skillId> -p <projectId>` | Remove a skill from the project |
145
248
 
146
249
  #### Preview
147
250
 
251
+ Get the sandbox preview URL for a project.
252
+
148
253
  | Command | Description |
149
254
  |---|---|
150
- | `coze code preview` | Preview the project |
255
+ | `coze code preview <projectId>` | Get the project preview URL |
256
+
257
+ ```bash
258
+ # Get the preview URL (sandbox initialization takes 1-3 minutes)
259
+ coze code preview <projectId>
260
+ ```
151
261
 
152
262
  ### `coze generate` — Media Generation
153
263
 
264
+ Generate images, audio, and video using Coze AI models. All `generate` subcommands support `--output-path <path>` to save generated media to disk.
265
+
266
+ #### Image Generation
267
+
154
268
  ```bash
155
- # Generate an image
269
+ # Generate an image from text
156
270
  coze generate image "A sunset over the mountains"
157
271
 
158
- # Generate audio
272
+ # Save to a specific path
273
+ coze generate image "A logo design" --output-path ./assets
274
+
275
+ # Specify size (2K, 4K, or WIDTHxHEIGHT)
276
+ coze generate image "A futuristic city" --size 4K
277
+
278
+ # Disable watermark
279
+ coze generate image "A cat" --no-watermark
280
+
281
+ # Use reference image(s)
282
+ coze generate image "Similar style" --image https://example.com/ref.png
283
+
284
+ # Enable sequential (group) image generation
285
+ coze generate image "A storyboard" --sequential auto --max-images 5
286
+ ```
287
+
288
+ **`generate image` options:**
289
+
290
+ | Option | Default | Description |
291
+ |---|---|---|
292
+ | `--size <size>` | `2K` | Image size: `2K` \| `4K` \| `WIDTHxHEIGHT` |
293
+ | `--no-watermark` | enabled | Disable watermark |
294
+ | `--image <url>` | — | Reference image URL (repeatable) |
295
+ | `--response-format <fmt>` | `url` | Response format: `url` \| `b64_json` |
296
+ | `--optimize-prompt-mode <mode>` | `standard` | Prompt optimization mode |
297
+ | `--sequential <mode>` | `disabled` | Group image generation: `auto` \| `disabled` |
298
+ | `--max-images <n>` | `15` | Maximum group images (1–15) |
299
+ | `--output-path <path>` | — | Directory to save generated images |
300
+
301
+ #### Audio Generation (TTS)
302
+
303
+ ```bash
304
+ # Basic text-to-speech
159
305
  coze generate audio "Hello, welcome to Coze"
160
306
 
161
- # Generate a video
307
+ # Save to file
308
+ coze generate audio "Hello" --output-path ./audio.mp3
309
+
310
+ # Use SSML input
311
+ echo "<speak>Hello</speak>" | coze generate audio --ssml
312
+
313
+ # Custom speaker and format
314
+ coze generate audio "Hello" --speaker zh_female_xiaohe_uranus_bigtts --format ogg_opus
315
+ ```
316
+
317
+ **`generate audio` options:**
318
+
319
+ | Option | Default | Description |
320
+ |---|---|---|
321
+ | `--speaker <speaker>` | `zh_female_xiaohe_uranus_bigtts` | Voice speaker |
322
+ | `--format <fmt>` | `mp3` | Audio format: `pcm` \| `mp3` \| `ogg_opus` |
323
+ | `--sample-rate <n>` | `24000` | Sample rate |
324
+ | `--speech-rate <n>` | `0` | Speech rate (-50 to 100) |
325
+ | `--loudness-rate <n>` | `0` | Loudness (-50 to 100) |
326
+ | `--ssml` | `false` | Treat input as SSML instead of plain text |
327
+ | `--output-path <path>` | — | Directory to save generated audio |
328
+
329
+ #### Video Generation
330
+
331
+ ```bash
332
+ # Generate a video (waits for completion by default)
162
333
  coze generate video "A cat playing piano"
163
334
 
164
- # Save to a specific directory
165
- coze generate image "A logo design" --output-path ./assets
335
+ # Save to a specific path
336
+ coze generate video "A dancing kitten" --output-path ./video.mp4
337
+
338
+ # Create task only, don't wait for completion
339
+ coze generate video "A dancing kitten" --no-wait
340
+
341
+ # Custom resolution and aspect ratio
342
+ coze generate video "A landscape" --resolution 1080p --ratio 16:9
343
+
344
+ # Use reference images
345
+ coze generate video "Animate this" --first-frame https://example.com/frame.png
346
+ coze generate video "In this style" --reference-image https://example.com/ref.png
166
347
  ```
167
348
 
349
+ **`generate video` options:**
350
+
351
+ | Option | Default | Description |
352
+ |---|---|---|
353
+ | `--model <model>` | `doubao-seedance-1-5-pro-251215` | Video generation model |
354
+ | `--resolution <res>` | `720p` | Resolution: `480p` \| `720p` \| `1080p` |
355
+ | `--ratio <ratio>` | `16:9` | Aspect ratio (e.g., `16:9`, `9:16`, `1:1`) |
356
+ | `--size <size>` | — | Derive ratio/resolution from `WIDTHxHEIGHT` |
357
+ | `--duration <seconds>` | `5` | Duration in seconds (4–12) |
358
+ | `--no-watermark` | enabled | Disable watermark |
359
+ | `--seed <seed>` | — | Random seed for reproducibility |
360
+ | `--camerafixed` | `false` | Fix camera position (reduce motion) |
361
+ | `--no-generate-audio` | generates audio | Do not generate accompanying audio |
362
+ | `--first-frame <url>` | — | First frame image URL |
363
+ | `--last-frame <url>` | — | Last frame image URL |
364
+ | `--reference-image <url>` | — | Reference image URL (repeatable) |
365
+ | `--return-last-frame` | `false` | Return last frame URL in output |
366
+ | `--no-wait` | waits | Only create task, don't poll for completion |
367
+ | `--poll-interval <ms>` | `2000` | Polling interval in milliseconds |
368
+ | `--poll-timeout <ms>` | `300000` | Polling timeout in milliseconds (5 min) |
369
+ | `--output-path <path>` | — | Directory to save generated video |
370
+
168
371
  ### `coze file` — File Operations
169
372
 
373
+ Upload local files to Coze for use as attachments or context in projects.
374
+
375
+ | Command | Description |
376
+ |---|---|
377
+ | `coze file upload <path>` | Upload a local file |
378
+
170
379
  ```bash
171
380
  # Upload a file
172
381
  coze file upload ./document.pdf
@@ -174,20 +383,43 @@ coze file upload ./document.pdf
174
383
 
175
384
  ### `coze config` — Configuration
176
385
 
177
- Configuration is stored in `~/.coze/config.json` (global) and `.cozerc.json` (project-level).
386
+ Manage CLI configuration stored in `~/.coze/config.json` (global) and `.cozerc.json` (project-level).
178
387
 
179
388
  | Command | Description |
180
389
  |---|---|
181
390
  | `coze config list` | List all configuration items with sources |
182
- | `coze config get <key>` | Get a configuration value |
391
+ | `coze config get <keys...>` | Get one or more configuration values |
183
392
  | `coze config set <key> <value>` | Set a configuration value |
184
- | `coze config delete <key>` | Delete a configuration item |
393
+ | `coze config delete <keys...>` | Delete one or more configuration items |
394
+
395
+ ```bash
396
+ # List all configurations with their sources (env, local, global, default)
397
+ coze config list
398
+
399
+ # Get a single config value
400
+ coze config get spaceId
401
+
402
+ # Get multiple config values
403
+ coze config get apiBaseUrl spaceId organizationId
404
+
405
+ # Set a configuration value
406
+ coze config set spaceId 123456789
407
+
408
+ # Delete configuration keys
409
+ coze config delete spaceId
410
+ coze config delete spaceId apiBaseUrl
411
+ ```
185
412
 
186
413
  ### `coze completion` — Shell Autocompletion
187
414
 
415
+ Set up or remove shell autocompletion for bash/zsh.
416
+
188
417
  ```bash
189
- # Set up shell autocompletion
418
+ # Install shell completion script
190
419
  coze completion --setup
420
+
421
+ # Remove shell completion script
422
+ coze completion --cleanup
191
423
  ```
192
424
 
193
425
  ## Global Options
@@ -196,14 +428,17 @@ coze completion --setup
196
428
  |---|---|
197
429
  | `-h, --help` | Show help |
198
430
  | `-v, --version` | Show version |
199
- | `--format <fmt>` | Output format: `json` or `text` (default: `text`) |
431
+ | `--format <fmt>` | Output format: `json` or `text` (default: `json`) |
200
432
  | `--no-color` | Disable ANSI color output |
201
433
  | `--config <path>` | Use a custom configuration file |
202
434
  | `--org-id <id>` | Override the default Organization ID |
203
435
  | `--space-id <id>` | Override the default Space ID |
204
- | `--verbose` | Enable verbose logging |
205
- | `--debug` | Enable debug mode |
436
+ | `--verbose` | Enable verbose mode with detailed process information |
437
+ | `--debug` | Enable debug mode with all log output for diagnosing issues |
206
438
  | `--log-file <path>` | Write logs to a file |
439
+ | `--man` | Show full manual information |
440
+ | `--schema` | Output the command's JSON Schema |
441
+ | `--commands` | Output the list of subcommands |
207
442
 
208
443
  ## Configuration
209
444
 
@@ -223,6 +458,23 @@ The CLI reads configuration from multiple sources with the following priority (h
223
458
  | `COZE_ORG_ID` | Default Organization ID |
224
459
  | `COZE_ENTERPRISE_ID` | Default Enterprise ID |
225
460
  | `COZE_SPACE_ID` | Default Space ID |
461
+ | `COZE_PROJECT_ID` | Default Project ID (used by `message` commands) |
462
+
463
+ ## Exit Codes
464
+
465
+ | Code | Name | Description |
466
+ |---|---|---|
467
+ | `0` | `SUCCESS` | Command completed successfully |
468
+ | `1` | `GENERAL_ERROR` | General error |
469
+ | `2` | `AUTH_FAILED` | Authentication failed |
470
+ | `3` | `RESOURCE_NOT_FOUND` | Requested resource not found |
471
+ | `4` | `INVALID_ARGUMENT` | Invalid argument or option |
472
+ | `5` | `PERMISSION_DENIED` | Permission denied |
473
+ | `6` | `NETWORK_ERROR` | Network error |
474
+ | `7` | `SERVER_ERROR` | Server error |
475
+ | `8` | `TIMEOUT` | Operation timed out |
476
+ | `9` | `QUOTA_EXCEEDED` | Quota exceeded |
477
+ | `10` | `CONFLICT` | Resource conflict |
226
478
 
227
479
  ## CI/CD Usage
228
480
 
@@ -232,8 +484,18 @@ export COZE_API_TOKEN=<YOUR_PAT>
232
484
  export COZE_ORG_ID=<ORG_ID>
233
485
  export COZE_SPACE_ID=<SPACE_ID>
234
486
 
235
- # Deploy a project
487
+ # Create a project and wait for completion
488
+ coze code project create -m "Build a chatbot" --type web --wait --format json
489
+
490
+ # Send a message to a project
491
+ export COZE_PROJECT_ID=<PROJECT_ID>
492
+ coze code message send "Fix the authentication module" --format json
493
+
494
+ # Deploy a project and wait for completion
236
495
  coze code deploy <projectId> --wait --format json
496
+
497
+ # Check deployment status
498
+ coze code deploy status <projectId> --format json
237
499
  ```
238
500
 
239
501
  ## License