@coze/cli 0.1.0-alpha.2c7d10 → 0.1.0-alpha.4245a4
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 +193 -192
- package/lib/cli.js +1 -42326
- package/lib/index-BH3he2V8.js +1 -0
- package/lib/send-message.worker.js +1 -52
- package/package.json +11 -4
- package/lib/index-5XDMejBE.js +0 -25174
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @coze/
|
|
1
|
+
# @coze/cli
|
|
2
2
|
|
|
3
|
-
Coze
|
|
3
|
+
Coze CLI — A command-line tool for interacting with [Coze](https://www.coze.cn) services. Manage organizations, workspaces, projects, deployments, and generate media — all from your terminal.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g @coze/
|
|
8
|
+
npm install -g @coze/cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Quick Start
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# 1. Login to your Coze account
|
|
15
|
-
coze auth login
|
|
15
|
+
coze auth login
|
|
16
16
|
|
|
17
17
|
# 2. Select your organization
|
|
18
18
|
coze organization list
|
|
@@ -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
|
|
26
|
+
coze code project create --message "Build an intelligent assistant" --type web
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Authentication
|
|
@@ -32,10 +32,7 @@ Before using most commands, you need to authenticate with Coze.
|
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
# Interactive login via browser (recommended)
|
|
35
|
-
coze auth login
|
|
36
|
-
|
|
37
|
-
# Non-interactive login with Personal Access Token (for CI/CD)
|
|
38
|
-
coze auth login --token <YOUR_PAT>
|
|
35
|
+
coze auth login
|
|
39
36
|
|
|
40
37
|
# Check current login status
|
|
41
38
|
coze auth status
|
|
@@ -47,44 +44,40 @@ coze auth status --format json
|
|
|
47
44
|
coze auth logout
|
|
48
45
|
```
|
|
49
46
|
|
|
50
|
-
You can also authenticate via environment variables for CI/CD pipelines:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
export COZE_API_TOKEN=<YOUR_PAT>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
47
|
## Commands
|
|
57
48
|
|
|
58
49
|
### `coze auth` — Authentication
|
|
59
50
|
|
|
60
|
-
Manage the full authentication lifecycle. Supports interactive OAuth login via browser
|
|
51
|
+
Manage the full authentication lifecycle. Supports interactive OAuth login via browser.
|
|
61
52
|
|
|
62
|
-
| Command
|
|
63
|
-
|
|
64
|
-
| `coze auth login
|
|
65
|
-
| `coze auth login --token <PAT>` | Login with a Personal Access Token |
|
|
53
|
+
| Command | Description |
|
|
54
|
+
| ------------------ | -------------------------------------------------- |
|
|
55
|
+
| `coze auth login` | Interactive login via browser |
|
|
66
56
|
| `coze auth status` | Check current login status and credential validity |
|
|
67
|
-
| `coze auth logout` | Logout and clear stored credentials
|
|
57
|
+
| `coze auth logout` | Logout and clear stored credentials |
|
|
68
58
|
|
|
69
59
|
### `coze organization` — Organization Management
|
|
70
60
|
|
|
71
|
-
View and switch organizations to set the default Organization ID for subsequent commands.
|
|
61
|
+
View and switch organizations to set the default Organization ID for subsequent commands. Supports switching to personal account by omitting the org_id.
|
|
72
62
|
|
|
73
|
-
| Command
|
|
74
|
-
|
|
75
|
-
| `coze organization list`
|
|
76
|
-
| `coze organization use <org_id>`
|
|
63
|
+
| Command | Description |
|
|
64
|
+
| ---------------------------------- | ---------------------------------------------------------------- |
|
|
65
|
+
| `coze organization list` | List all accessible organizations and their enterprises |
|
|
66
|
+
| `coze organization use <org_id>` | Set the default organization (auto-saves Enterprise ID) |
|
|
67
|
+
| `coze organization use` | Switch to personal account (clears Organization and Enterprise) |
|
|
77
68
|
|
|
78
69
|
Alias: `coze org`
|
|
79
70
|
|
|
71
|
+
> When switching to a different organization, the saved Space ID will be cleared automatically. If the specified org_id is not found, the command will fail without modifying the configuration.
|
|
72
|
+
|
|
80
73
|
### `coze space` — Workspace Management
|
|
81
74
|
|
|
82
75
|
View and switch workspaces to set the default Space ID for subsequent commands.
|
|
83
76
|
|
|
84
|
-
| Command
|
|
85
|
-
|
|
86
|
-
| `coze space list`
|
|
87
|
-
| `coze space use <space_id>` | Set the default workspace
|
|
77
|
+
| Command | Description |
|
|
78
|
+
| --------------------------- | ---------------------------------------------- |
|
|
79
|
+
| `coze space list` | List all spaces under the current organization |
|
|
80
|
+
| `coze space use <space_id>` | Set the default workspace |
|
|
88
81
|
|
|
89
82
|
### `coze code` — Coze Coding
|
|
90
83
|
|
|
@@ -92,61 +85,62 @@ View and switch workspaces to set the default Space ID for subsequent commands.
|
|
|
92
85
|
|
|
93
86
|
Manage Coze Coding projects. Supports creating, viewing, listing, and deleting projects across various types.
|
|
94
87
|
|
|
95
|
-
| Command
|
|
96
|
-
|
|
97
|
-
| `coze code project create`
|
|
98
|
-
| `coze code project list`
|
|
99
|
-
| `coze code project get <projectId>`
|
|
100
|
-
| `coze code project delete <projectId>` | Delete a project (irreversible)
|
|
88
|
+
| Command | Description |
|
|
89
|
+
| -------------------------------------- | ------------------------------------------------------ |
|
|
90
|
+
| `coze code project create` | Create a new project from natural language description |
|
|
91
|
+
| `coze code project list` | List all projects in the current space |
|
|
92
|
+
| `coze code project get <projectId>` | Get project details |
|
|
93
|
+
| `coze code project delete <projectId>` | Delete a project (irreversible) |
|
|
101
94
|
|
|
102
95
|
Alias: `coze code proj`
|
|
103
96
|
|
|
104
97
|
```bash
|
|
105
98
|
# Create a Web project
|
|
106
|
-
coze code project create
|
|
99
|
+
coze code project create --message "Create a chatbot" --type web
|
|
107
100
|
|
|
108
101
|
# Create and wait for the initial build to complete
|
|
109
|
-
coze code project create
|
|
102
|
+
coze code project create --message "Create a data dashboard" --type app --wait
|
|
110
103
|
|
|
111
104
|
# List projects with filters
|
|
112
105
|
coze code project list --type agent --type workflow
|
|
113
106
|
coze code project list --name "customer service"
|
|
114
|
-
coze code project list --size 20 --has-published
|
|
107
|
+
coze code project list --size 20 --has-published
|
|
115
108
|
```
|
|
116
109
|
|
|
117
|
-
**`project create
|
|
118
|
-
|
|
119
|
-
| Option
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
| `--type <type>`
|
|
123
|
-
| `--wait`
|
|
124
|
-
| `--org-id <orgId>`
|
|
125
|
-
| `--space-id <spaceId>` | Space ID (reads from context if omitted)
|
|
126
|
-
|
|
127
|
-
**`project list
|
|
128
|
-
|
|
129
|
-
| Option
|
|
130
|
-
|
|
131
|
-
| `--size <size>`
|
|
132
|
-
| `--cursor-id <cursorId>` | Cursor for pagination
|
|
133
|
-
| `--type <type>`
|
|
134
|
-
| `--name <name>`
|
|
135
|
-
| `--has-published
|
|
136
|
-
| `--search-scope <n>`
|
|
137
|
-
| `--folder-id <id>`
|
|
138
|
-
| `--order-type <n>`
|
|
139
|
-
| `--
|
|
110
|
+
**`project create`** **options:**
|
|
111
|
+
|
|
112
|
+
| Option | Description |
|
|
113
|
+
| ---------------------- | ------------------------------------------------------ |
|
|
114
|
+
| `--message <message>` | **(required)** Project description in natural language |
|
|
115
|
+
| `--type <type>` | **(required)** Project type: `web` \| `app` |
|
|
116
|
+
| `--wait` | Wait for project creation to complete |
|
|
117
|
+
| `--org-id <orgId>` | Organization ID (reads from context if omitted) |
|
|
118
|
+
| `--space-id <spaceId>` | Space ID (reads from context if omitted) |
|
|
119
|
+
|
|
120
|
+
**`project list`** **options:**
|
|
121
|
+
|
|
122
|
+
| Option | Description |
|
|
123
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
124
|
+
| `--size <size>` | Number of projects to return (default: 10) |
|
|
125
|
+
| `--cursor-id <cursorId>` | Cursor for pagination |
|
|
126
|
+
| `--type <type>` | Filter by type (can pass multiple times): `agent` \| `workflow` \| `webapp` \| `app` \| `web` \| `miniprogram` \| `assistant` |
|
|
127
|
+
| `--name <name>` | Filter by project name |
|
|
128
|
+
| `--has-published` | Filter by publish status |
|
|
129
|
+
| `--search-scope <n>` | Created by (0=All, 1=CreatedByMe, 2=AllWithCollaborator) |
|
|
130
|
+
| `--folder-id <id>` | Filter by folder |
|
|
131
|
+
| `--order-type <n>` | Sort type (0=descending, 1=ascending) |
|
|
132
|
+
| `--order-by <n>` | Order by (0=updated\_at, 1=created\_at) |
|
|
133
|
+
| `--is-fav-filter` | Filter favorites only |
|
|
140
134
|
|
|
141
135
|
#### Message
|
|
142
136
|
|
|
143
137
|
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
138
|
|
|
145
|
-
| Command
|
|
146
|
-
|
|
147
|
-
| `coze code message send [message]` | Send a prompt message to a project chat
|
|
148
|
-
| `coze code message status`
|
|
149
|
-
| `coze code message cancel`
|
|
139
|
+
| Command | Description |
|
|
140
|
+
| ---------------------------------- | -------------------------------------------------- |
|
|
141
|
+
| `coze code message send [message]` | Send a prompt message to a project chat |
|
|
142
|
+
| `coze code message status` | Query message status and get result when completed |
|
|
143
|
+
| `coze code message cancel` | Cancel an ongoing message |
|
|
150
144
|
|
|
151
145
|
```bash
|
|
152
146
|
# Send a message to a project
|
|
@@ -172,21 +166,22 @@ export COZE_PROJECT_ID=123456
|
|
|
172
166
|
coze code message send "Hello"
|
|
173
167
|
```
|
|
174
168
|
|
|
175
|
-
**`message
|
|
169
|
+
**`message`** **options (shared by all subcommands):**
|
|
176
170
|
|
|
177
|
-
| Option
|
|
178
|
-
|
|
171
|
+
| Option | Description |
|
|
172
|
+
| ----------------------- | ------------------------------------------ |
|
|
179
173
|
| `-p, --project-id <id>` | Coze project ID (or env `COZE_PROJECT_ID`) |
|
|
180
174
|
|
|
181
175
|
#### Deploy
|
|
182
176
|
|
|
183
177
|
Deploy projects to the production environment. Supports multiple project types including Agent, Workflow, Skill, Web, Mini-program, etc.
|
|
184
178
|
|
|
185
|
-
| Command
|
|
186
|
-
|
|
187
|
-
| `coze code deploy <projectId>`
|
|
188
|
-
| `coze code deploy <projectId> --wait`
|
|
189
|
-
| `coze code deploy status <projectId>`
|
|
179
|
+
| Command | Description |
|
|
180
|
+
| -------------------------------------------- | ----------------------------------------- |
|
|
181
|
+
| `coze code deploy <projectId>` | Deploy a project to production |
|
|
182
|
+
| `coze code deploy <projectId> --wait` | Deploy and wait for completion |
|
|
183
|
+
| `coze code deploy status <projectId>` | Check deployment status |
|
|
184
|
+
| `coze code deploy status <projectId> --wait` | Check and wait for deployment to complete |
|
|
190
185
|
|
|
191
186
|
```bash
|
|
192
187
|
# Deploy a project
|
|
@@ -200,17 +195,20 @@ coze code deploy status <projectId>
|
|
|
200
195
|
|
|
201
196
|
# Check a specific deployment record
|
|
202
197
|
coze code deploy status <projectId> --deploy-id <deployHistoryId>
|
|
198
|
+
|
|
199
|
+
# Check and wait for deployment to complete
|
|
200
|
+
coze code deploy status <projectId> --wait
|
|
203
201
|
```
|
|
204
202
|
|
|
205
203
|
#### Environment Variables
|
|
206
204
|
|
|
207
205
|
Manage project environment variables (Secrets). Supports development and production environments.
|
|
208
206
|
|
|
209
|
-
| Command
|
|
210
|
-
|
|
211
|
-
| `coze code env list -p <projectId>`
|
|
212
|
-
| `coze code env set <key> <value> -p <projectId>` | Set an environment variable
|
|
213
|
-
| `coze code env delete <key> -p <projectId>`
|
|
207
|
+
| Command | Description |
|
|
208
|
+
| ------------------------------------------------ | ------------------------------ |
|
|
209
|
+
| `coze code env list -p <projectId>` | List environment variables |
|
|
210
|
+
| `coze code env set <key> <value> -p <projectId>` | Set an environment variable |
|
|
211
|
+
| `coze code env delete <key> -p <projectId>` | Delete an environment variable |
|
|
214
212
|
|
|
215
213
|
```bash
|
|
216
214
|
# List dev environment variables (default)
|
|
@@ -230,28 +228,28 @@ coze code env delete API_KEY -p <projectId>
|
|
|
230
228
|
|
|
231
229
|
Manage custom domains for deployed projects.
|
|
232
230
|
|
|
233
|
-
| Command
|
|
234
|
-
|
|
235
|
-
| `coze code domain list <projectId>`
|
|
236
|
-
| `coze code domain add <domain> -p <projectId>`
|
|
237
|
-
| `coze code domain remove <domain> -p <projectId>` | Remove a custom domain
|
|
231
|
+
| Command | Description |
|
|
232
|
+
| ------------------------------------------------- | -------------------------------------------- |
|
|
233
|
+
| `coze code domain list <projectId>` | List all custom domains bound to the project |
|
|
234
|
+
| `coze code domain add <domain> -p <projectId>` | Add a custom domain |
|
|
235
|
+
| `coze code domain remove <domain> -p <projectId>` | Remove a custom domain |
|
|
238
236
|
|
|
239
237
|
#### Skill
|
|
240
238
|
|
|
241
239
|
Manage skills associated with a project to extend its capabilities.
|
|
242
240
|
|
|
243
|
-
| Command
|
|
244
|
-
|
|
245
|
-
| `coze code skill list <projectId>`
|
|
246
|
-
| `coze code skill add <skillId> -p <projectId>`
|
|
247
|
-
| `coze code skill remove <skillId> -p <projectId>` | Remove a skill from the project
|
|
241
|
+
| Command | Description |
|
|
242
|
+
| ------------------------------------------------- | ---------------------------------------- |
|
|
243
|
+
| `coze code skill list -p <projectId>` | List all skills (shows installed status) |
|
|
244
|
+
| `coze code skill add <skillId> -p <projectId>` | Add a skill to the project |
|
|
245
|
+
| `coze code skill remove <skillId> -p <projectId>` | Remove a skill from the project |
|
|
248
246
|
|
|
249
247
|
#### Preview
|
|
250
248
|
|
|
251
249
|
Get the sandbox preview URL for a project.
|
|
252
250
|
|
|
253
|
-
| Command
|
|
254
|
-
|
|
251
|
+
| Command | Description |
|
|
252
|
+
| ------------------------------- | --------------------------- |
|
|
255
253
|
| `coze code preview <projectId>` | Get the project preview URL |
|
|
256
254
|
|
|
257
255
|
```bash
|
|
@@ -285,18 +283,18 @@ coze generate image "Similar style" --image https://example.com/ref.png
|
|
|
285
283
|
coze generate image "A storyboard" --sequential auto --max-images 5
|
|
286
284
|
```
|
|
287
285
|
|
|
288
|
-
**`generate image
|
|
286
|
+
**`generate image`** **options:**
|
|
289
287
|
|
|
290
|
-
| Option
|
|
291
|
-
|
|
292
|
-
| `--size <size>`
|
|
293
|
-
| `--no-watermark`
|
|
294
|
-
| `--image <url>`
|
|
295
|
-
| `--response-format <fmt>`
|
|
296
|
-
| `--optimize-prompt-mode <mode>` | `standard` | Prompt optimization mode
|
|
297
|
-
| `--sequential <mode>`
|
|
298
|
-
| `--max-images <n>`
|
|
299
|
-
| `--output-path <path>`
|
|
288
|
+
| Option | Default | Description |
|
|
289
|
+
| ------------------------------- | ---------- | -------------------------------------------- |
|
|
290
|
+
| `--size <size>` | `2K` | Image size: `2K` \| `4K` \| `WIDTHxHEIGHT` |
|
|
291
|
+
| `--no-watermark` | enabled | Disable watermark |
|
|
292
|
+
| `--image <url>` | — | Reference image URL (repeatable) |
|
|
293
|
+
| `--response-format <fmt>` | `url` | Response format: `url` \| `b64_json` |
|
|
294
|
+
| `--optimize-prompt-mode <mode>` | `standard` | Prompt optimization mode |
|
|
295
|
+
| `--sequential <mode>` | `disabled` | Group image generation: `auto` \| `disabled` |
|
|
296
|
+
| `--max-images <n>` | `15` | Maximum group images (1–15) |
|
|
297
|
+
| `--output-path <path>` | — | Directory to save generated images |
|
|
300
298
|
|
|
301
299
|
#### Audio Generation (TTS)
|
|
302
300
|
|
|
@@ -314,17 +312,18 @@ echo "<speak>Hello</speak>" | coze generate audio --ssml
|
|
|
314
312
|
coze generate audio "Hello" --speaker zh_female_xiaohe_uranus_bigtts --audio-format ogg_opus
|
|
315
313
|
```
|
|
316
314
|
|
|
317
|
-
**`generate audio
|
|
315
|
+
**`generate audio`** **options:**
|
|
318
316
|
|
|
319
|
-
| Option
|
|
320
|
-
|
|
321
|
-
| `--speaker <speaker>`
|
|
322
|
-
| `--audio-format <fmt>` | `mp3`
|
|
323
|
-
| `--sample-rate <n>`
|
|
324
|
-
| `--speech-rate <n>`
|
|
325
|
-
| `--loudness-rate <n>`
|
|
326
|
-
| `--ssml`
|
|
327
|
-
| `--
|
|
317
|
+
| Option | Default | Description |
|
|
318
|
+
| ---------------------- | -------------------------------- | -------------------------------------------- |
|
|
319
|
+
| `--speaker <speaker>` | `zh_female_xiaohe_uranus_bigtts` | Voice speaker |
|
|
320
|
+
| `--audio-format <fmt>` | `mp3` | Audio encoding: `pcm` \| `mp3` \| `ogg_opus` |
|
|
321
|
+
| `--sample-rate <n>` | `24000` | Sample rate |
|
|
322
|
+
| `--speech-rate <n>` | `0` | Speech rate (-50 to 100) |
|
|
323
|
+
| `--loudness-rate <n>` | `0` | Loudness (-50 to 100) |
|
|
324
|
+
| `--ssml` | `false` | Treat input as SSML instead of plain text |
|
|
325
|
+
| `--uid <uid>` | `cli_user` | User UID |
|
|
326
|
+
| `--output-path <path>` | — | Directory to save generated audio |
|
|
328
327
|
|
|
329
328
|
#### Video Generation
|
|
330
329
|
|
|
@@ -341,9 +340,8 @@ coze generate video create "A dancing kitten" --wait --output-path ./video.mp4
|
|
|
341
340
|
# Custom resolution and aspect ratio
|
|
342
341
|
coze generate video create "A landscape" --resolution 1080p --ratio 16:9
|
|
343
342
|
|
|
344
|
-
# Use
|
|
343
|
+
# Use first frame / last frame
|
|
345
344
|
coze generate video create "Animate this" --first-frame https://example.com/frame.png
|
|
346
|
-
coze generate video create "In this style" --reference-image https://example.com/ref.png
|
|
347
345
|
|
|
348
346
|
# Query task status later
|
|
349
347
|
coze generate video status task_123
|
|
@@ -351,11 +349,10 @@ coze generate video status task_123
|
|
|
351
349
|
|
|
352
350
|
Use `coze generate video create` to submit generation tasks, and `coze generate video status <taskId>` to query existing tasks.
|
|
353
351
|
|
|
354
|
-
**`generate video create
|
|
352
|
+
**`generate video create`** **options:**
|
|
355
353
|
|
|
356
354
|
| Option | Default | Description |
|
|
357
355
|
|---|---|---|
|
|
358
|
-
| `--model <model>` | `doubao-seedance-1-5-pro-251215` | Video generation model |
|
|
359
356
|
| `--callback-url <url>` | — | Callback URL for task status changes |
|
|
360
357
|
| `--resolution <res>` | `720p` | Resolution: `480p` \| `720p` \| `1080p` |
|
|
361
358
|
| `--ratio <ratio>` | `16:9` | Aspect ratio (e.g., `16:9`, `9:16`, `1:1`) |
|
|
@@ -367,23 +364,22 @@ Use `coze generate video create` to submit generation tasks, and `coze generate
|
|
|
367
364
|
| `--no-generate-audio` | generates audio | Do not generate accompanying audio |
|
|
368
365
|
| `--first-frame <url>` | — | First frame image URL |
|
|
369
366
|
| `--last-frame <url>` | — | Last frame image URL |
|
|
370
|
-
| `--reference-image <url>` | — | Reference image URL (repeatable) |
|
|
371
367
|
| `--return-last-frame` | `false` | Return last frame URL in output |
|
|
372
368
|
| `--wait` | `false` | Poll until completion instead of returning `taskId` immediately |
|
|
373
369
|
| `--output-path <path>` | — | Directory to save generated video |
|
|
374
370
|
|
|
375
|
-
**`generate video status
|
|
371
|
+
**`generate video status`** **options:**
|
|
376
372
|
|
|
377
|
-
| Option
|
|
378
|
-
|
|
379
|
-
| `--output <format>` | `text`
|
|
373
|
+
| Option | Default | Description |
|
|
374
|
+
| ------------------- | ------- | ------------------------------- |
|
|
375
|
+
| `--output <format>` | `text` | Output format: `text` \| `json` |
|
|
380
376
|
|
|
381
377
|
### `coze file` — File Operations
|
|
382
378
|
|
|
383
379
|
Upload local files to Coze for use as attachments or context in projects.
|
|
384
380
|
|
|
385
|
-
| Command
|
|
386
|
-
|
|
381
|
+
| Command | Description |
|
|
382
|
+
| ------------------------- | ------------------- |
|
|
387
383
|
| `coze file upload <path>` | Upload a local file |
|
|
388
384
|
|
|
389
385
|
```bash
|
|
@@ -395,12 +391,12 @@ coze file upload ./document.pdf
|
|
|
395
391
|
|
|
396
392
|
Manage CLI configuration stored in `~/.coze/config.json` (global) and `.cozerc.json` (project-level).
|
|
397
393
|
|
|
398
|
-
| Command
|
|
399
|
-
|
|
400
|
-
| `coze config list`
|
|
401
|
-
| `coze config get <keys...>`
|
|
402
|
-
| `coze config set <key> <value>` | Set a configuration value
|
|
403
|
-
| `coze config delete <keys...>`
|
|
394
|
+
| Command | Description |
|
|
395
|
+
| ------------------------------- | ----------------------------------------- |
|
|
396
|
+
| `coze config list` | List all configuration items with sources |
|
|
397
|
+
| `coze config get <keys...>` | Get one or more configuration values |
|
|
398
|
+
| `coze config set <key> <value>` | Set a configuration value |
|
|
399
|
+
| `coze config delete <keys...>` | Delete one or more configuration items |
|
|
404
400
|
|
|
405
401
|
```bash
|
|
406
402
|
# List all configurations with their sources (env, local, global, default)
|
|
@@ -422,7 +418,7 @@ coze config delete spaceId apiBaseUrl
|
|
|
422
418
|
|
|
423
419
|
### `coze completion` — Shell Autocompletion
|
|
424
420
|
|
|
425
|
-
Set up or remove shell autocompletion
|
|
421
|
+
Set up or remove shell autocompletion (supports bash/zsh/fish/powershell).
|
|
426
422
|
|
|
427
423
|
```bash
|
|
428
424
|
# Install shell completion script
|
|
@@ -432,82 +428,87 @@ coze completion --setup
|
|
|
432
428
|
coze completion --cleanup
|
|
433
429
|
```
|
|
434
430
|
|
|
431
|
+
### `coze upgrade` — CLI Upgrade
|
|
432
|
+
|
|
433
|
+
Upgrade Coze CLI to the latest version. Detects the package manager used for the original installation (npm/pnpm/yarn) and runs the appropriate global install command.
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
# Upgrade to latest version
|
|
437
|
+
coze upgrade
|
|
438
|
+
|
|
439
|
+
# Force check and upgrade
|
|
440
|
+
coze upgrade --force
|
|
441
|
+
|
|
442
|
+
# Upgrade to a specific tag
|
|
443
|
+
coze upgrade --tag beta
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
| Option | Description |
|
|
447
|
+
| ------------- | ------------------------------------------------------ |
|
|
448
|
+
| `--force` | Force upgrade even if already on the latest version |
|
|
449
|
+
| `--tag <tag>` | Specify the dist-tag to upgrade to (default: `latest`) |
|
|
450
|
+
|
|
435
451
|
## Global Options
|
|
436
452
|
|
|
437
|
-
| Option
|
|
438
|
-
|
|
439
|
-
| `-h, --help`
|
|
440
|
-
| `-v, --version`
|
|
441
|
-
| `--format <fmt>`
|
|
442
|
-
| `--no-color`
|
|
443
|
-
| `--config <path>`
|
|
444
|
-
| `--org-id <id>`
|
|
445
|
-
| `--space-id <id>`
|
|
446
|
-
| `--verbose`
|
|
447
|
-
| `--debug`
|
|
448
|
-
| `--log-file <path>` | Write logs to a file
|
|
449
|
-
| `--man`
|
|
450
|
-
| `--schema`
|
|
451
|
-
| `--commands`
|
|
453
|
+
| Option | Description |
|
|
454
|
+
| ------------------- | ----------------------------------------------------------- |
|
|
455
|
+
| `-h, --help` | Show help |
|
|
456
|
+
| `-v, --version` | Show version |
|
|
457
|
+
| `--format <fmt>` | Output format: `json` or `text` (default: `text`) |
|
|
458
|
+
| `--no-color` | Disable ANSI color output |
|
|
459
|
+
| `--config <path>` | Use a custom configuration file |
|
|
460
|
+
| `--org-id <id>` | Override the default Organization ID |
|
|
461
|
+
| `--space-id <id>` | Override the default Space ID |
|
|
462
|
+
| `--verbose` | Enable verbose mode with detailed process information |
|
|
463
|
+
| `--debug` | Enable debug mode with all log output for diagnosing issues |
|
|
464
|
+
| `--log-file <path>` | Write logs to a file |
|
|
465
|
+
| `--man` | Show full manual information |
|
|
466
|
+
| `--schema` | Output the command's JSON Schema |
|
|
467
|
+
| `--commands` | Output the list of subcommands |
|
|
452
468
|
|
|
453
469
|
## Configuration
|
|
454
470
|
|
|
455
471
|
The CLI reads configuration from multiple sources with the following priority (highest to lowest):
|
|
456
472
|
|
|
457
473
|
1. **Environment variables**
|
|
458
|
-
2. **Command-line
|
|
459
|
-
3.
|
|
460
|
-
4. **
|
|
461
|
-
5. **
|
|
474
|
+
2. **Command-line** **`--config`** **file**
|
|
475
|
+
3. **`COZE_CONFIG_FILE`** **environment variable file**
|
|
476
|
+
4. **Project-level config** (`.cozerc.json` in current directory)
|
|
477
|
+
5. **Global config** (`~/.coze/config.json`)
|
|
478
|
+
6. **Built-in defaults**
|
|
462
479
|
|
|
463
480
|
### Environment Variables
|
|
464
481
|
|
|
465
|
-
| Variable
|
|
466
|
-
|
|
467
|
-
| `
|
|
468
|
-
| `
|
|
469
|
-
| `
|
|
470
|
-
| `
|
|
471
|
-
| `
|
|
482
|
+
| Variable | Description |
|
|
483
|
+
| ------------------------ | --------------------------------------------------- |
|
|
484
|
+
| `COZE_ORG_ID` | Default Organization ID |
|
|
485
|
+
| `COZE_ENTERPRISE_ID` | Default Enterprise ID |
|
|
486
|
+
| `COZE_SPACE_ID` | Default Space ID |
|
|
487
|
+
| `COZE_PROJECT_ID` | Default Project ID (used by `message` commands) |
|
|
488
|
+
| `COZE_CONFIG_FILE` | Custom configuration file path |
|
|
489
|
+
| `COZE_CONFIG_SCOPE` | Config write scope: `global` or `local` |
|
|
490
|
+
| `COZE_AUTO_CHECK_UPDATE` | Enable/disable auto update check: `true` or `false` |
|
|
472
491
|
|
|
473
492
|
## Exit Codes
|
|
474
493
|
|
|
475
|
-
| Code | Name
|
|
476
|
-
|
|
477
|
-
| `0`
|
|
478
|
-
| `1`
|
|
479
|
-
| `2`
|
|
480
|
-
| `3`
|
|
481
|
-
| `4`
|
|
482
|
-
| `5`
|
|
483
|
-
| `6`
|
|
484
|
-
| `7`
|
|
485
|
-
| `8`
|
|
486
|
-
| `9`
|
|
487
|
-
| `10` | `CONFLICT`
|
|
488
|
-
|
|
489
|
-
## CI/CD Usage
|
|
494
|
+
| Code | Name | Description |
|
|
495
|
+
| ---- | -------------------- | ------------------------------ |
|
|
496
|
+
| `0` | `SUCCESS` | Command completed successfully |
|
|
497
|
+
| `1` | `GENERAL_ERROR` | General error |
|
|
498
|
+
| `2` | `AUTH_FAILED` | Authentication failed |
|
|
499
|
+
| `3` | `RESOURCE_NOT_FOUND` | Requested resource not found |
|
|
500
|
+
| `4` | `INVALID_ARGUMENT` | Invalid argument or option |
|
|
501
|
+
| `5` | `PERMISSION_DENIED` | Permission denied |
|
|
502
|
+
| `6` | `NETWORK_ERROR` | Network error |
|
|
503
|
+
| `7` | `SERVER_ERROR` | Server error |
|
|
504
|
+
| `8` | `TIMEOUT` | Operation timed out |
|
|
505
|
+
| `9` | `QUOTA_EXCEEDED` | Quota exceeded |
|
|
506
|
+
| `10` | `CONFLICT` | Resource conflict |
|
|
490
507
|
|
|
491
|
-
|
|
492
|
-
# Authenticate with a PAT
|
|
493
|
-
export COZE_API_TOKEN=<YOUR_PAT>
|
|
494
|
-
export COZE_ORG_ID=<ORG_ID>
|
|
495
|
-
export COZE_SPACE_ID=<SPACE_ID>
|
|
496
|
-
|
|
497
|
-
# Create a project and wait for completion
|
|
498
|
-
coze code project create -m "Build a chatbot" --type web --wait --format json
|
|
499
|
-
|
|
500
|
-
# Send a message to a project
|
|
501
|
-
export COZE_PROJECT_ID=<PROJECT_ID>
|
|
502
|
-
coze code message send "Fix the authentication module" --format json
|
|
503
|
-
|
|
504
|
-
# Deploy a project and wait for completion
|
|
505
|
-
coze code deploy <projectId> --wait --format json
|
|
508
|
+
## License
|
|
506
509
|
|
|
507
|
-
|
|
508
|
-
coze code deploy status <projectId> --format json
|
|
509
|
-
```
|
|
510
|
+
This project is licensed under the **MIT License**. When running, it calls Coze Platform APIs. To use these APls, you must comply with the following agreements and privacy policies:
|
|
510
511
|
|
|
511
|
-
|
|
512
|
+
- [Privacy Policy](https://docs.coze.cn/guides/privacy)
|
|
513
|
+
- [Terms of Service](https://docs.coze.cn/guides/terms-of-service)
|
|
512
514
|
|
|
513
|
-
See the [LICENSE](LICENSE.md) file and [THIRD-PARTY-LICENSES](THIRD-PARTY-LICENSES.md) included in the package for full terms, conditions, and third-party notices.
|