@coze/cli 0.0.3 → 0.1.0-alpha.03c69e
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/LICENSE.md +1 -1
- package/README.md +490 -16
- package/THIRD-PARTY-LICENSES.md +31 -0
- package/bin/main +23 -0
- package/lib/cli.js +2 -0
- package/lib/index-DJO171OF.js +1 -0
- package/lib/send-message.worker.js +1 -0
- package/package.json +58 -46
- package/bin.mjs +0 -2
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -1
- package/dist/commands/base.d.ts +0 -15
- package/dist/commands/login.d.ts +0 -6
- package/dist/commands/logout.d.ts +0 -8
- package/dist/helpers/constants.d.ts +0 -10
- package/dist/helpers/logger.d.ts +0 -7
- package/dist/helpers/package.d.ts +0 -8
- package/dist/helpers/request.d.ts +0 -3
- package/dist/helpers/types.d.ts +0 -16
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -1
- package/dist/npm.d.ts +0 -28
- package/dist/oauth.d.ts +0 -9
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,40 +1,514 @@
|
|
|
1
|
-
# coze
|
|
1
|
+
# @coze/cli
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
# Installation
|
|
5
|
+
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
8
|
npm install -g @coze/cli
|
|
11
9
|
```
|
|
12
10
|
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 1. Login to your Coze account
|
|
15
|
+
coze auth login
|
|
16
|
+
|
|
17
|
+
# 2. Select your organization
|
|
18
|
+
coze organization list
|
|
19
|
+
coze organization use <org_id>
|
|
20
|
+
|
|
21
|
+
# 3. Select your workspace
|
|
22
|
+
coze space list
|
|
23
|
+
coze space use <space_id>
|
|
24
|
+
|
|
25
|
+
# 4. Start using Coze Coding
|
|
26
|
+
coze code project create --message "Build an intelligent assistant" --type web
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Authentication
|
|
30
|
+
|
|
31
|
+
Before using most commands, you need to authenticate with Coze.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Interactive login via browser (recommended)
|
|
35
|
+
coze auth login
|
|
36
|
+
|
|
37
|
+
# Check current login status
|
|
38
|
+
coze auth status
|
|
39
|
+
|
|
40
|
+
# Check status in JSON format
|
|
41
|
+
coze auth status --format json
|
|
42
|
+
|
|
43
|
+
# Logout and clear credentials
|
|
44
|
+
coze auth logout
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Commands
|
|
48
|
+
|
|
49
|
+
### `coze auth` — Authentication
|
|
50
|
+
|
|
51
|
+
Manage the full authentication lifecycle. Supports interactive OAuth login via browser.
|
|
52
|
+
|
|
53
|
+
| Command | Description |
|
|
54
|
+
| ------------------ | -------------------------------------------------- |
|
|
55
|
+
| `coze auth login` | Interactive login via browser |
|
|
56
|
+
| `coze auth status` | Check current login status and credential validity |
|
|
57
|
+
| `coze auth logout` | Logout and clear stored credentials |
|
|
58
|
+
|
|
59
|
+
### `coze organization` — Organization Management
|
|
60
|
+
|
|
61
|
+
View and switch organizations to set the default Organization ID for subsequent commands. Supports switching to personal account by omitting the org_id.
|
|
62
|
+
|
|
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) |
|
|
68
|
+
|
|
69
|
+
Alias: `coze org`
|
|
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
|
+
|
|
73
|
+
### `coze space` — Workspace Management
|
|
74
|
+
|
|
75
|
+
View and switch workspaces to set the default Space ID for subsequent commands.
|
|
76
|
+
|
|
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 |
|
|
81
|
+
|
|
82
|
+
### `coze code` — Coze Coding
|
|
83
|
+
|
|
84
|
+
#### Project
|
|
85
|
+
|
|
86
|
+
Manage Coze Coding projects. Supports creating, viewing, listing, and deleting projects across various types.
|
|
87
|
+
|
|
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) |
|
|
94
|
+
|
|
95
|
+
Alias: `coze code proj`
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Create a Web project
|
|
99
|
+
coze code project create --message "Create a chatbot" --type web
|
|
100
|
+
|
|
101
|
+
# Create and wait for the initial build to complete
|
|
102
|
+
coze code project create --message "Create a data dashboard" --type app --wait
|
|
103
|
+
|
|
104
|
+
# List projects with filters
|
|
105
|
+
coze code project list --type agent --type workflow
|
|
106
|
+
coze code project list --name "customer service"
|
|
107
|
+
coze code project list --size 20 --has-published
|
|
108
|
+
```
|
|
109
|
+
|
|
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 |
|
|
134
|
+
|
|
135
|
+
#### Message
|
|
136
|
+
|
|
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.
|
|
138
|
+
|
|
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 |
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Send a message to a project
|
|
147
|
+
coze code message send "Fix the login bug" -p 123456
|
|
148
|
+
|
|
149
|
+
# Mention local files with @ syntax for upload as context
|
|
150
|
+
coze code message send "Refactor @src/utils.ts to use async/await" -p 123456
|
|
151
|
+
|
|
152
|
+
# Mention multiple files
|
|
153
|
+
coze code message send "Compare @src/old.ts and @src/new.ts" -p 123456
|
|
154
|
+
|
|
155
|
+
# Pipe context via stdin
|
|
156
|
+
cat error.log | coze code message send "Analyze this error" -p 123456
|
|
157
|
+
|
|
158
|
+
# Check message status (auto-fetches result when completed)
|
|
159
|
+
coze code message status -p 123456
|
|
160
|
+
|
|
161
|
+
# Cancel an ongoing message
|
|
162
|
+
coze code message cancel -p 123456
|
|
163
|
+
|
|
164
|
+
# Use environment variable for project ID
|
|
165
|
+
export COZE_PROJECT_ID=123456
|
|
166
|
+
coze code message send "Hello"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**`message`** **options (shared by all subcommands):**
|
|
170
|
+
|
|
171
|
+
| Option | Description |
|
|
172
|
+
| ----------------------- | ------------------------------------------ |
|
|
173
|
+
| `-p, --project-id <id>` | Coze project ID (or env `COZE_PROJECT_ID`) |
|
|
174
|
+
|
|
175
|
+
#### Deploy
|
|
176
|
+
|
|
177
|
+
Deploy projects to the production environment. Supports multiple project types including Agent, Workflow, Skill, Web, Mini-program, etc.
|
|
178
|
+
|
|
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 |
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Deploy a project
|
|
188
|
+
coze code deploy <projectId>
|
|
189
|
+
|
|
190
|
+
# Deploy and wait for completion
|
|
191
|
+
coze code deploy <projectId> --wait
|
|
192
|
+
|
|
193
|
+
# Check latest deployment status
|
|
194
|
+
coze code deploy status <projectId>
|
|
195
|
+
|
|
196
|
+
# Check a specific deployment record
|
|
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
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Environment Variables
|
|
204
|
+
|
|
205
|
+
Manage project environment variables (Secrets). Supports development and production environments.
|
|
206
|
+
|
|
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 |
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# List dev environment variables (default)
|
|
215
|
+
coze code env list -p <projectId>
|
|
216
|
+
|
|
217
|
+
# List prod environment variables
|
|
218
|
+
coze code env list -p <projectId> --env prod
|
|
219
|
+
|
|
220
|
+
# Set an environment variable
|
|
221
|
+
coze code env set API_KEY sk-xxxxx -p <projectId>
|
|
222
|
+
|
|
223
|
+
# Delete an environment variable
|
|
224
|
+
coze code env delete API_KEY -p <projectId>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### Domain
|
|
228
|
+
|
|
229
|
+
Manage custom domains for deployed projects.
|
|
230
|
+
|
|
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 |
|
|
236
|
+
|
|
237
|
+
#### Skill
|
|
238
|
+
|
|
239
|
+
Manage skills associated with a project to extend its capabilities.
|
|
240
|
+
|
|
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 |
|
|
246
|
+
|
|
247
|
+
#### Preview
|
|
248
|
+
|
|
249
|
+
Get the sandbox preview URL for a project.
|
|
250
|
+
|
|
251
|
+
| Command | Description |
|
|
252
|
+
| ------------------------------- | --------------------------- |
|
|
253
|
+
| `coze code preview <projectId>` | Get the project preview URL |
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Get the preview URL (sandbox initialization takes 1-3 minutes)
|
|
257
|
+
coze code preview <projectId>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### `coze generate` — Media Generation
|
|
261
|
+
|
|
262
|
+
Generate images, audio, and video using Coze AI models. All `generate` subcommands support `--output-path <path>` to save generated media to disk.
|
|
263
|
+
|
|
264
|
+
#### Image Generation
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Generate an image from text
|
|
268
|
+
coze generate image "A sunset over the mountains"
|
|
269
|
+
|
|
270
|
+
# Save to a specific path
|
|
271
|
+
coze generate image "A logo design" --output-path ./assets
|
|
272
|
+
|
|
273
|
+
# Specify size (2K, 4K, or WIDTHxHEIGHT)
|
|
274
|
+
coze generate image "A futuristic city" --size 4K
|
|
275
|
+
|
|
276
|
+
# Disable watermark
|
|
277
|
+
coze generate image "A cat" --no-watermark
|
|
278
|
+
|
|
279
|
+
# Use reference image(s)
|
|
280
|
+
coze generate image "Similar style" --image https://example.com/ref.png
|
|
281
|
+
|
|
282
|
+
# Enable sequential (group) image generation
|
|
283
|
+
coze generate image "A storyboard" --sequential auto --max-images 5
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**`generate image`** **options:**
|
|
287
|
+
|
|
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 |
|
|
298
|
+
|
|
299
|
+
#### Audio Generation (TTS)
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Basic text-to-speech
|
|
303
|
+
coze generate audio "Hello, welcome to Coze"
|
|
304
|
+
|
|
305
|
+
# Save to file
|
|
306
|
+
coze generate audio "Hello" --output-path ./audio.mp3
|
|
307
|
+
|
|
308
|
+
# Use SSML input
|
|
309
|
+
echo "<speak>Hello</speak>" | coze generate audio --ssml
|
|
310
|
+
|
|
311
|
+
# Custom speaker and audio encoding
|
|
312
|
+
coze generate audio "Hello" --speaker zh_female_xiaohe_uranus_bigtts --audio-format ogg_opus
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**`generate audio`** **options:**
|
|
316
|
+
|
|
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 |
|
|
327
|
+
|
|
328
|
+
#### Video Generation
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Create a video generation task
|
|
332
|
+
coze generate video create "A cat playing piano"
|
|
333
|
+
|
|
334
|
+
# Create a task and wait for completion
|
|
335
|
+
coze generate video create "A dancing kitten" --wait
|
|
336
|
+
|
|
337
|
+
# Save to a specific path
|
|
338
|
+
coze generate video create "A dancing kitten" --wait --output-path ./video.mp4
|
|
339
|
+
|
|
340
|
+
# Custom resolution and aspect ratio
|
|
341
|
+
coze generate video create "A landscape" --resolution 1080p --ratio 16:9
|
|
342
|
+
|
|
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
|
|
348
|
+
```
|
|
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:**
|
|
353
|
+
|
|
354
|
+
| Option | Default | Description |
|
|
355
|
+
|---|---|---|
|
|
356
|
+
| `--callback-url <url>` | — | Callback URL for task status changes |
|
|
357
|
+
| `--resolution <res>` | `720p` | Resolution: `480p` \| `720p` \| `1080p` |
|
|
358
|
+
| `--ratio <ratio>` | `16:9` | Aspect ratio (e.g., `16:9`, `9:16`, `1:1`) |
|
|
359
|
+
| `--size <size>` | — | Derive ratio/resolution from `WIDTHxHEIGHT` |
|
|
360
|
+
| `--duration <seconds>` | `5` | Duration in seconds (4–12) |
|
|
361
|
+
| `--no-watermark` | enabled | Disable watermark |
|
|
362
|
+
| `--seed <seed>` | — | Random seed for reproducibility |
|
|
363
|
+
| `--camerafixed` | `false` | Fix camera position (reduce motion) |
|
|
364
|
+
| `--no-generate-audio` | generates audio | Do not generate accompanying audio |
|
|
365
|
+
| `--first-frame <url>` | — | First frame image URL |
|
|
366
|
+
| `--last-frame <url>` | — | Last frame image URL |
|
|
367
|
+
| `--return-last-frame` | `false` | Return last frame URL in output |
|
|
368
|
+
| `--wait` | `false` | Poll until completion instead of returning `taskId` immediately |
|
|
369
|
+
| `--output-path <path>` | — | Directory to save generated video |
|
|
370
|
+
|
|
371
|
+
**`generate video status`** **options:**
|
|
13
372
|
|
|
14
|
-
|
|
373
|
+
| Option | Default | Description |
|
|
374
|
+
| ------------------- | ------- | ------------------------------- |
|
|
375
|
+
| `--output <format>` | `text` | Output format: `text` \| `json` |
|
|
15
376
|
|
|
16
|
-
|
|
377
|
+
### `coze file` — File Operations
|
|
17
378
|
|
|
18
|
-
|
|
379
|
+
Upload local files to Coze for use as attachments or context in projects.
|
|
380
|
+
|
|
381
|
+
| Command | Description |
|
|
382
|
+
| ------------------------- | ------------------- |
|
|
383
|
+
| `coze file upload <path>` | Upload a local file |
|
|
19
384
|
|
|
20
385
|
```bash
|
|
21
|
-
|
|
386
|
+
# Upload a file
|
|
387
|
+
coze file upload ./document.pdf
|
|
22
388
|
```
|
|
23
389
|
|
|
24
|
-
|
|
390
|
+
### `coze config` — Configuration
|
|
25
391
|
|
|
26
|
-
|
|
392
|
+
Manage CLI configuration stored in `~/.coze/config.json` (global) and `.cozerc.json` (project-level).
|
|
27
393
|
|
|
28
|
-
|
|
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 |
|
|
29
400
|
|
|
30
401
|
```bash
|
|
31
|
-
|
|
402
|
+
# List all configurations with their sources (env, local, global, default)
|
|
403
|
+
coze config list
|
|
404
|
+
|
|
405
|
+
# Get a single config value
|
|
406
|
+
coze config get spaceId
|
|
407
|
+
|
|
408
|
+
# Get multiple config values
|
|
409
|
+
coze config get apiBaseUrl spaceId organizationId
|
|
410
|
+
|
|
411
|
+
# Set a configuration value
|
|
412
|
+
coze config set spaceId 123456789
|
|
413
|
+
|
|
414
|
+
# Delete configuration keys
|
|
415
|
+
coze config delete spaceId
|
|
416
|
+
coze config delete spaceId apiBaseUrl
|
|
32
417
|
```
|
|
33
418
|
|
|
34
|
-
|
|
419
|
+
### `coze completion` — Shell Autocompletion
|
|
35
420
|
|
|
36
|
-
|
|
421
|
+
Set up or remove shell autocompletion (supports bash/zsh/fish/powershell).
|
|
37
422
|
|
|
38
423
|
```bash
|
|
39
|
-
|
|
424
|
+
# Install shell completion script
|
|
425
|
+
coze completion --setup
|
|
426
|
+
|
|
427
|
+
# Remove shell completion script
|
|
428
|
+
coze completion --cleanup
|
|
40
429
|
```
|
|
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
|
+
|
|
451
|
+
## Global Options
|
|
452
|
+
|
|
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 |
|
|
468
|
+
|
|
469
|
+
## Configuration
|
|
470
|
+
|
|
471
|
+
The CLI reads configuration from multiple sources with the following priority (highest to lowest):
|
|
472
|
+
|
|
473
|
+
1. **Environment variables**
|
|
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**
|
|
479
|
+
|
|
480
|
+
### Environment Variables
|
|
481
|
+
|
|
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` |
|
|
491
|
+
|
|
492
|
+
## Exit Codes
|
|
493
|
+
|
|
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 |
|
|
507
|
+
|
|
508
|
+
## License
|
|
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:
|
|
511
|
+
|
|
512
|
+
- [Privacy Policy](https://docs.coze.cn/guides/privacy)
|
|
513
|
+
- [Terms of Service](https://docs.coze.cn/guides/terms-of-service)
|
|
514
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @coze/cli THIRD-PARTY LICENSES
|
|
2
|
+
|
|
3
|
+
**Copyright (c) 2026 ByteDance Ltd. and/or its affiliates**
|
|
4
|
+
|
|
5
|
+
This project, **@coze/cli**, incorporates components from the open source projects listed below.
|
|
6
|
+
The original copyright notices and the licenses under which ByteDance received such components are set forth below.
|
|
7
|
+
|
|
8
|
+
## Open Source and Third-Party Components
|
|
9
|
+
|
|
10
|
+
| Component | License | URL |
|
|
11
|
+
| :--- | :--- | :--- |
|
|
12
|
+
| **chalk** | MIT | [Link](https://www.npmjs.com/package/chalk) |
|
|
13
|
+
| **commander** | MIT | [Link](https://www.npmjs.com/package/commander) |
|
|
14
|
+
| **form-data** | MIT | [Link](https://www.npmjs.com/package/form-data) |
|
|
15
|
+
| **http-proxy-agent** | MIT | [Link](https://www.npmjs.com/package/http-proxy-agent) |
|
|
16
|
+
| **https-proxy-agent** | MIT | [Link](https://www.npmjs.com/package/https-proxy-agent) |
|
|
17
|
+
| **lodash** | MIT | [Link](https://www.npmjs.com/package/lodash) |
|
|
18
|
+
| **mitt** | MIT | [Link](https://www.npmjs.com/package/mitt) |
|
|
19
|
+
| **omelette** | MIT | [Link](https://www.npmjs.com/package/omelette) |
|
|
20
|
+
| **undici** | MIT | [Link](https://www.npmjs.com/package/undici) |
|
|
21
|
+
| **@rollup/plugin-commonjs** | MIT | [Link](https://www.npmjs.com/package/@rollup/plugin-commonjs) |
|
|
22
|
+
| **@rollup/plugin-json** | MIT | [Link](https://www.npmjs.com/package/@rollup/plugin-json) |
|
|
23
|
+
| **@rollup/plugin-node-resolve** | MIT | [Link](https://www.npmjs.com/package/@rollup/plugin-node-resolve) |
|
|
24
|
+
| **@rollup/plugin-sucrase** | MIT | [Link](https://www.npmjs.com/package/@rollup/plugin-sucrase) |
|
|
25
|
+
| **@types/lodash** | MIT | [Link](https://www.npmjs.com/package/@types/lodash) |
|
|
26
|
+
| **@types/node** | MIT | [Link](https://www.npmjs.com/package/@types/node) |
|
|
27
|
+
| **@vitest/coverage-v8** | MIT | [Link](https://www.npmjs.com/package/@vitest/coverage-v8) |
|
|
28
|
+
| **rollup** | MIT | [Link](https://www.npmjs.com/package/rollup) |
|
|
29
|
+
| **sucrase** | MIT | [Link](https://www.npmjs.com/package/sucrase) |
|
|
30
|
+
| **tsx** | MIT | [Link](https://www.npmjs.com/package/tsx) |
|
|
31
|
+
| **vitest** | MIT | [Link](https://www.npmjs.com/package/vitest) |
|
package/bin/main
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const isCompletion =
|
|
4
|
+
process.argv.includes('--compzsh') ||
|
|
5
|
+
process.argv.includes('--compbash') ||
|
|
6
|
+
process.argv.includes('--comppwsh') ||
|
|
7
|
+
process.argv.includes('--completion') ||
|
|
8
|
+
process.argv.includes('completion');
|
|
9
|
+
|
|
10
|
+
if (isCompletion) {
|
|
11
|
+
process.env.DOTENV_CONFIG_QUIET = 'true';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
process.env.NODE_ENV = 'production';
|
|
15
|
+
|
|
16
|
+
const isDebug = process.argv.includes('--debug');
|
|
17
|
+
|
|
18
|
+
// 如果不是 debug 模式,默认关闭 dotenv 的所有控制台输出
|
|
19
|
+
if (!isDebug) {
|
|
20
|
+
process.env.DOTENV_CONFIG_QUIET = 'true';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
require('../lib/cli.js');
|