@coze/cli 0.1.0-alpha.f2dd23 → 0.1.0
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 +212 -201
- package/bin/main +3 -1
- package/lib/cli.js +1 -41641
- package/lib/index-DJO171OF.js +1 -0
- package/lib/send-message.worker.js +1 -52
- package/package.json +9 -6
- package/lib/index-SwtgDxQR.js +0 -25171
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
|
|
|
@@ -310,47 +308,52 @@ coze generate audio "Hello" --output-path ./audio.mp3
|
|
|
310
308
|
# Use SSML input
|
|
311
309
|
echo "<speak>Hello</speak>" | coze generate audio --ssml
|
|
312
310
|
|
|
313
|
-
# Custom speaker and
|
|
314
|
-
coze generate audio "Hello" --speaker zh_female_xiaohe_uranus_bigtts --format ogg_opus
|
|
311
|
+
# Custom speaker and audio encoding
|
|
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
|
-
| `--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
|
|
|
331
330
|
```bash
|
|
332
|
-
#
|
|
333
|
-
coze generate video "A cat playing piano"
|
|
331
|
+
# Create a video generation task
|
|
332
|
+
coze generate video create "A cat playing piano"
|
|
334
333
|
|
|
335
|
-
#
|
|
336
|
-
coze generate video "A dancing kitten" --
|
|
334
|
+
# Create a task and wait for completion
|
|
335
|
+
coze generate video create "A dancing kitten" --wait
|
|
337
336
|
|
|
338
|
-
#
|
|
339
|
-
coze generate video "A dancing kitten" --
|
|
337
|
+
# Save to a specific path
|
|
338
|
+
coze generate video create "A dancing kitten" --wait --output-path ./video.mp4
|
|
340
339
|
|
|
341
340
|
# Custom resolution and aspect ratio
|
|
342
|
-
coze generate video "A landscape" --resolution 1080p --ratio 16:9
|
|
341
|
+
coze generate video create "A landscape" --resolution 1080p --ratio 16:9
|
|
343
342
|
|
|
344
|
-
# Use
|
|
345
|
-
coze generate video "Animate this" --first-frame https://example.com/frame.png
|
|
346
|
-
|
|
343
|
+
# Use first frame / last frame
|
|
344
|
+
coze generate video create "Animate this" --first-frame https://example.com/frame.png
|
|
345
|
+
|
|
346
|
+
# Query task status later
|
|
347
|
+
coze generate video status task_123
|
|
347
348
|
```
|
|
348
349
|
|
|
349
|
-
|
|
350
|
+
Use `coze generate video create` to submit generation tasks, and `coze generate video status <taskId>` to query existing tasks.
|
|
351
|
+
|
|
352
|
+
**`generate video create`** **options:**
|
|
350
353
|
|
|
351
354
|
| Option | Default | Description |
|
|
352
355
|
|---|---|---|
|
|
353
|
-
| `--
|
|
356
|
+
| `--callback-url <url>` | — | Callback URL for task status changes |
|
|
354
357
|
| `--resolution <res>` | `720p` | Resolution: `480p` \| `720p` \| `1080p` |
|
|
355
358
|
| `--ratio <ratio>` | `16:9` | Aspect ratio (e.g., `16:9`, `9:16`, `1:1`) |
|
|
356
359
|
| `--size <size>` | — | Derive ratio/resolution from `WIDTHxHEIGHT` |
|
|
@@ -361,19 +364,22 @@ coze generate video "In this style" --reference-image https://example.com/ref.pn
|
|
|
361
364
|
| `--no-generate-audio` | generates audio | Do not generate accompanying audio |
|
|
362
365
|
| `--first-frame <url>` | — | First frame image URL |
|
|
363
366
|
| `--last-frame <url>` | — | Last frame image URL |
|
|
364
|
-
| `--reference-image <url>` | — | Reference image URL (repeatable) |
|
|
365
367
|
| `--return-last-frame` | `false` | Return last frame URL in output |
|
|
366
|
-
| `--
|
|
367
|
-
| `--poll-interval <ms>` | `2000` | Polling interval in milliseconds |
|
|
368
|
-
| `--poll-timeout <ms>` | `300000` | Polling timeout in milliseconds (5 min) |
|
|
368
|
+
| `--wait` | `false` | Poll until completion instead of returning `taskId` immediately |
|
|
369
369
|
| `--output-path <path>` | — | Directory to save generated video |
|
|
370
370
|
|
|
371
|
+
**`generate video status`** **options:**
|
|
372
|
+
|
|
373
|
+
| Option | Default | Description |
|
|
374
|
+
| ------------------- | ------- | ------------------------------- |
|
|
375
|
+
| `--output <format>` | `text` | Output format: `text` \| `json` |
|
|
376
|
+
|
|
371
377
|
### `coze file` — File Operations
|
|
372
378
|
|
|
373
379
|
Upload local files to Coze for use as attachments or context in projects.
|
|
374
380
|
|
|
375
|
-
| Command
|
|
376
|
-
|
|
381
|
+
| Command | Description |
|
|
382
|
+
| ------------------------- | ------------------- |
|
|
377
383
|
| `coze file upload <path>` | Upload a local file |
|
|
378
384
|
|
|
379
385
|
```bash
|
|
@@ -385,12 +391,12 @@ coze file upload ./document.pdf
|
|
|
385
391
|
|
|
386
392
|
Manage CLI configuration stored in `~/.coze/config.json` (global) and `.cozerc.json` (project-level).
|
|
387
393
|
|
|
388
|
-
| Command
|
|
389
|
-
|
|
390
|
-
| `coze config list`
|
|
391
|
-
| `coze config get <keys...>`
|
|
392
|
-
| `coze config set <key> <value>` | Set a configuration value
|
|
393
|
-
| `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 |
|
|
394
400
|
|
|
395
401
|
```bash
|
|
396
402
|
# List all configurations with their sources (env, local, global, default)
|
|
@@ -412,7 +418,7 @@ coze config delete spaceId apiBaseUrl
|
|
|
412
418
|
|
|
413
419
|
### `coze completion` — Shell Autocompletion
|
|
414
420
|
|
|
415
|
-
Set up or remove shell autocompletion
|
|
421
|
+
Set up or remove shell autocompletion (supports bash/zsh/fish/powershell).
|
|
416
422
|
|
|
417
423
|
```bash
|
|
418
424
|
# Install shell completion script
|
|
@@ -422,82 +428,87 @@ coze completion --setup
|
|
|
422
428
|
coze completion --cleanup
|
|
423
429
|
```
|
|
424
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
|
+
|
|
425
451
|
## Global Options
|
|
426
452
|
|
|
427
|
-
| Option
|
|
428
|
-
|
|
429
|
-
| `-h, --help`
|
|
430
|
-
| `-v, --version`
|
|
431
|
-
| `--format <fmt>`
|
|
432
|
-
| `--no-color`
|
|
433
|
-
| `--config <path>`
|
|
434
|
-
| `--org-id <id>`
|
|
435
|
-
| `--space-id <id>`
|
|
436
|
-
| `--verbose`
|
|
437
|
-
| `--debug`
|
|
438
|
-
| `--log-file <path>` | Write logs to a file
|
|
439
|
-
| `--man`
|
|
440
|
-
| `--schema`
|
|
441
|
-
| `--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 |
|
|
442
468
|
|
|
443
469
|
## Configuration
|
|
444
470
|
|
|
445
471
|
The CLI reads configuration from multiple sources with the following priority (highest to lowest):
|
|
446
472
|
|
|
447
473
|
1. **Environment variables**
|
|
448
|
-
2. **Command-line
|
|
449
|
-
3.
|
|
450
|
-
4. **
|
|
451
|
-
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**
|
|
452
479
|
|
|
453
480
|
### Environment Variables
|
|
454
481
|
|
|
455
|
-
| Variable
|
|
456
|
-
|
|
457
|
-
| `
|
|
458
|
-
| `
|
|
459
|
-
| `
|
|
460
|
-
| `
|
|
461
|
-
| `
|
|
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` |
|
|
462
491
|
|
|
463
492
|
## Exit Codes
|
|
464
493
|
|
|
465
|
-
| Code | Name
|
|
466
|
-
|
|
467
|
-
| `0`
|
|
468
|
-
| `1`
|
|
469
|
-
| `2`
|
|
470
|
-
| `3`
|
|
471
|
-
| `4`
|
|
472
|
-
| `5`
|
|
473
|
-
| `6`
|
|
474
|
-
| `7`
|
|
475
|
-
| `8`
|
|
476
|
-
| `9`
|
|
477
|
-
| `10` | `CONFLICT`
|
|
478
|
-
|
|
479
|
-
## 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 |
|
|
480
507
|
|
|
481
|
-
|
|
482
|
-
# Authenticate with a PAT
|
|
483
|
-
export COZE_API_TOKEN=<YOUR_PAT>
|
|
484
|
-
export COZE_ORG_ID=<ORG_ID>
|
|
485
|
-
export COZE_SPACE_ID=<SPACE_ID>
|
|
486
|
-
|
|
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
|
|
495
|
-
coze code deploy <projectId> --wait --format json
|
|
508
|
+
## License
|
|
496
509
|
|
|
497
|
-
|
|
498
|
-
coze code deploy status <projectId> --format json
|
|
499
|
-
```
|
|
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:
|
|
500
511
|
|
|
501
|
-
|
|
512
|
+
- [Privacy Policy](https://docs.coze.cn/guides/privacy)
|
|
513
|
+
- [Terms of Service](https://docs.coze.cn/guides/terms-of-service)
|
|
502
514
|
|
|
503
|
-
MIT
|
package/bin/main
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const isCompletion =
|
|
3
|
+
const isCompletion =
|
|
4
|
+
process.argv.includes('--compzsh') ||
|
|
4
5
|
process.argv.includes('--compbash') ||
|
|
6
|
+
process.argv.includes('--comppwsh') ||
|
|
5
7
|
process.argv.includes('--completion') ||
|
|
6
8
|
process.argv.includes('completion');
|
|
7
9
|
|