@coze/cli 0.1.8 → 0.2.0-alpha.094e22
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 +344 -25
- package/lib/cli.js +3 -3
- package/lib/fetch-client-DC0c3ox3.js +1 -0
- package/lib/index-CkTEdvpA.js +1 -0
- package/lib/send-message.worker.js +1 -1
- package/lib/session-task-refresh.worker.js +1 -1
- package/lib/{task-worker-DhR5dnFi.js → task-worker-C2ZfSQY6.js} +1 -1
- package/package.json +6 -1
- package/skills/manifest.json +25 -0
- package/skills/using-coze-cli/SKILL.md +448 -0
- package/skills/using-coze-cli/coze-claw/MODULE.md +189 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-agent-routing.md +45 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-artifacts.md +52 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-async-followup.md +266 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-message.md +176 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-podcast.md +73 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-ppt.md +78 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-progress.md +112 -0
- package/skills/using-coze-cli/coze-claw/references/coze-claw-session.md +144 -0
- package/skills/using-coze-cli/coze-code/MODULE.md +252 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-db.md +537 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-deploy.md +258 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-domain.md +73 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-env.md +82 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-git.md +181 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-message.md +240 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-model.md +51 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-preview.md +33 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-project.md +176 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-repo.md +285 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-skill.md +117 -0
- package/skills/using-coze-cli/coze-code/references/coze-code-tools.md +47 -0
- package/skills/using-coze-cli/coze-file/MODULE.md +46 -0
- package/skills/using-coze-cli/coze-file/references/coze-file-upload.md +59 -0
- package/skills/using-coze-cli/coze-generate/MODULE.md +84 -0
- package/skills/using-coze-cli/coze-generate/references/coze-generate-audio.md +105 -0
- package/skills/using-coze-cli/coze-generate/references/coze-generate-image.md +80 -0
- package/skills/using-coze-cli/coze-generate/references/coze-generate-video.md +125 -0
- package/lib/fetch-client-Qn1wyhrf.js +0 -1
- package/lib/index-Bl0Pqb9j.js +0 -1
package/README.md
CHANGED
|
@@ -91,6 +91,8 @@ Manage Coze Coding projects. Supports creating, viewing, listing, and deleting p
|
|
|
91
91
|
| `coze code project list` | List all projects in the current space |
|
|
92
92
|
| `coze code project get <projectId>` | Get project details |
|
|
93
93
|
| `coze code project delete <projectId>` | Delete a project (irreversible) |
|
|
94
|
+
| `coze code project import` | Import a project from GitHub repo or local zip file |
|
|
95
|
+
| `coze code project db list -p <projectId>` | List the project's database tables |
|
|
94
96
|
|
|
95
97
|
Alias: `coze code proj`
|
|
96
98
|
|
|
@@ -109,13 +111,17 @@ coze code project list --size 20 --has-published
|
|
|
109
111
|
|
|
110
112
|
**`project create`** **options:**
|
|
111
113
|
|
|
112
|
-
| Option
|
|
113
|
-
|
|
|
114
|
-
| `--message <message>`
|
|
115
|
-
| `--type <type>`
|
|
116
|
-
| `--wait`
|
|
117
|
-
| `--
|
|
118
|
-
| `--
|
|
114
|
+
| Option | Description |
|
|
115
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| `--message <message>` | **(required)** Project description/requirements in natural language |
|
|
117
|
+
| `--type <type>` | **(required)** Project type: `agent` \| `workflow` \| `app` \| `skill` \| `web` \| `miniprogram` \| `assistant` |
|
|
118
|
+
| `--wait` | Wait for project creation to complete (also waits for the first AI message response) |
|
|
119
|
+
| `--chat-mode <chatMode>` | Chat mode: `ask` \| `agent` \| `dangerous_confirm` \| `plan` |
|
|
120
|
+
| `--model-name <name>` | Model name for the project |
|
|
121
|
+
| `--tool-name <toolName>` | Tool name to enable (can be passed multiple times) |
|
|
122
|
+
| `--design` | Enable design wizard (auto-enabled when `--chat-mode` is `plan`) |
|
|
123
|
+
| `--org-id <orgId>` | Organization ID (reads from context if omitted) |
|
|
124
|
+
| `--space-id <spaceId>` | Space ID (reads from context if omitted) |
|
|
119
125
|
|
|
120
126
|
**`project list`** **options:**
|
|
121
127
|
|
|
@@ -130,7 +136,17 @@ coze code project list --size 20 --has-published
|
|
|
130
136
|
| `--folder-id <id>` | Filter by folder |
|
|
131
137
|
| `--order-type <n>` | Sort type (0=descending, 1=ascending) |
|
|
132
138
|
| `--order-by <n>` | Order by (0=updated\_at, 1=created\_at) |
|
|
133
|
-
| `--is-fav-filter` | Filter favorites only
|
|
139
|
+
| `--is-fav-filter` | Filter favorites only |
|
|
140
|
+
|
|
141
|
+
**`project import`** **options:**
|
|
142
|
+
|
|
143
|
+
| Option | Description |
|
|
144
|
+
| ----------------------- | ------------------------------------------------------------------- |
|
|
145
|
+
| `-s, --source <source>` | **(required)** Import source: `github` \| `local` |
|
|
146
|
+
| `-r, --repo <fullName>` | Remote repo full name, e.g. `user/repo` (required when source is `github`) |
|
|
147
|
+
| `-f, --file <path>` | Local zip file path, max 500MB (required when source is `local`) |
|
|
148
|
+
|
|
149
|
+
> Remote import requires prior OAuth authorization via `coze code git auth login`, and imported projects are automatically bound to the source repo.
|
|
134
150
|
|
|
135
151
|
#### Message
|
|
136
152
|
|
|
@@ -141,19 +157,23 @@ Send and manage chat messages in Coze Coding projects. The project ID is specifi
|
|
|
141
157
|
| `coze code message send [message]` | Send a prompt message to a project chat |
|
|
142
158
|
| `coze code message status` | Query message status and get result when completed |
|
|
143
159
|
| `coze code message cancel` | Cancel an ongoing message |
|
|
160
|
+
| `coze code message history` | View the conversation history of a project chat |
|
|
144
161
|
|
|
145
162
|
```bash
|
|
146
163
|
# Send a message to a project
|
|
147
164
|
coze code message send "Fix the login bug" -p 123456
|
|
148
165
|
|
|
166
|
+
# Wait for the chat response before returning
|
|
167
|
+
coze code message send "Fix the login bug" -p 123456 --wait
|
|
168
|
+
|
|
149
169
|
# Mention local files with @ syntax for upload as context
|
|
150
170
|
coze code message send "Refactor @src/utils.ts to use async/await" -p 123456
|
|
151
171
|
|
|
152
172
|
# Mention multiple files
|
|
153
173
|
coze code message send "Compare @src/old.ts and @src/new.ts" -p 123456
|
|
154
174
|
|
|
155
|
-
# Pipe context via stdin
|
|
156
|
-
cat error.log | coze code message send "Analyze this error" -p 123456
|
|
175
|
+
# Pipe additional context via stdin (the --stdin flag is required)
|
|
176
|
+
cat error.log | coze code message send "Analyze this error" --stdin -p 123456
|
|
157
177
|
|
|
158
178
|
# Check message status (auto-fetches result when completed)
|
|
159
179
|
coze code message status -p 123456
|
|
@@ -161,6 +181,9 @@ coze code message status -p 123456
|
|
|
161
181
|
# Cancel an ongoing message
|
|
162
182
|
coze code message cancel -p 123456
|
|
163
183
|
|
|
184
|
+
# View conversation history (paginate with --before / --after)
|
|
185
|
+
coze code message history -p 123456
|
|
186
|
+
|
|
164
187
|
# Use environment variable for project ID
|
|
165
188
|
export COZE_PROJECT_ID=123456
|
|
166
189
|
coze code message send "Hello"
|
|
@@ -172,16 +195,31 @@ coze code message send "Hello"
|
|
|
172
195
|
| ----------------------- | ------------------------------------------ |
|
|
173
196
|
| `-p, --project-id <id>` | Coze project ID (or env `COZE_PROJECT_ID`) |
|
|
174
197
|
|
|
198
|
+
**`message send`** **options:**
|
|
199
|
+
|
|
200
|
+
| Option | Description |
|
|
201
|
+
| ---------- | ----------------------------------------------------------------- |
|
|
202
|
+
| `--wait` | Wait for the chat response before returning (otherwise sent in background) |
|
|
203
|
+
| `--stdin` | Read additional context from stdin (pipe input) |
|
|
204
|
+
|
|
205
|
+
**`message history`** **options:**
|
|
206
|
+
|
|
207
|
+
| Option | Description |
|
|
208
|
+
| ------------------- | ------------------------------------------------- |
|
|
209
|
+
| `--after <msg_id>` | Cursor for fetching newer messages |
|
|
210
|
+
| `--before <msg_id>` | Cursor for fetching older messages |
|
|
211
|
+
|
|
175
212
|
#### Deploy
|
|
176
213
|
|
|
177
214
|
Deploy projects to the production environment. Supports multiple project types including Agent, Workflow, Skill, Web, Mini-program, etc.
|
|
178
215
|
|
|
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
|
|
216
|
+
| Command | Description |
|
|
217
|
+
| -------------------------------------------- | ------------------------------------------------------ |
|
|
218
|
+
| `coze code deploy <projectId>` | Deploy a project to production |
|
|
219
|
+
| `coze code deploy <projectId> --wait` | Deploy and wait for completion |
|
|
220
|
+
| `coze code deploy status <projectId>` | Check deployment status |
|
|
221
|
+
| `coze code deploy list <projectId>` | List deployment history for a project |
|
|
222
|
+
| `coze code deploy fix <projectId>` | Fix a failed deployment by sending deploy logs to AI |
|
|
185
223
|
|
|
186
224
|
```bash
|
|
187
225
|
# Deploy a project
|
|
@@ -190,16 +228,54 @@ coze code deploy <projectId>
|
|
|
190
228
|
# Deploy and wait for completion
|
|
191
229
|
coze code deploy <projectId> --wait
|
|
192
230
|
|
|
231
|
+
# Deploy a specific commit and sync database tables to production
|
|
232
|
+
coze code deploy <projectId> --commit-id <commitId> --table-name users --table-name orders
|
|
233
|
+
|
|
193
234
|
# Check latest deployment status
|
|
194
235
|
coze code deploy status <projectId>
|
|
195
236
|
|
|
196
237
|
# Check a specific deployment record
|
|
197
238
|
coze code deploy status <projectId> --deploy-id <deployHistoryId>
|
|
198
239
|
|
|
199
|
-
#
|
|
200
|
-
coze code deploy
|
|
240
|
+
# List deployment history
|
|
241
|
+
coze code deploy list <projectId> --page-size 10
|
|
242
|
+
|
|
243
|
+
# Fix the latest failed deployment with AI
|
|
244
|
+
coze code deploy fix <projectId> --wait
|
|
201
245
|
```
|
|
202
246
|
|
|
247
|
+
**`deploy <projectId>`** **options:**
|
|
248
|
+
|
|
249
|
+
| Option | Description |
|
|
250
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
251
|
+
| `--commit-id <commitId>` | Commit ID (queries the latest commit if omitted) |
|
|
252
|
+
| `--wait` | Wait for the deployment to complete (polling interval: 3 seconds) |
|
|
253
|
+
| `--table-name <tableName...>` | Database table name(s) to sync to production (variadic / repeatable) |
|
|
254
|
+
| `--encrypt-deploy <string>` | Pre-encrypted environment variable string (for Skill projects) |
|
|
255
|
+
| `--connector-id <connectorId>` | Connector ID for mini-program deployment channels, repeatable (e.g. `10000127` WeChat, `10000126` TikTok) |
|
|
256
|
+
|
|
257
|
+
**`deploy status <projectId>`** **options:**
|
|
258
|
+
|
|
259
|
+
| Option | Description |
|
|
260
|
+
| ----------------------- | ------------------------------------------------------- |
|
|
261
|
+
| `--deploy-id <deployId>` | Deployment history ID (queries the latest if omitted) |
|
|
262
|
+
|
|
263
|
+
> `deploy status` reuses the parent `deploy --wait` flag to poll until the deployment reaches a terminal state.
|
|
264
|
+
|
|
265
|
+
**`deploy list <projectId>`** **options:**
|
|
266
|
+
|
|
267
|
+
| Option | Description |
|
|
268
|
+
| --------------------------- | -------------------------------------- |
|
|
269
|
+
| `--page-size <pageSize>` | Number of records per page (default: 10) |
|
|
270
|
+
| `--page-token <pageToken>` | Page token for pagination |
|
|
271
|
+
|
|
272
|
+
**`deploy fix <projectId>`** **options:**
|
|
273
|
+
|
|
274
|
+
| Option | Description |
|
|
275
|
+
| ------------------------ | ----------------------------------------------------------- |
|
|
276
|
+
| `--deploy-id <deployId>` | Deployment history ID (queries the latest failed if omitted) |
|
|
277
|
+
| `--wait` | Wait for the fix message response |
|
|
278
|
+
|
|
203
279
|
#### Environment Variables
|
|
204
280
|
|
|
205
281
|
Manage project environment variables (Secrets). Supports development and production environments.
|
|
@@ -220,29 +296,47 @@ coze code env list -p <projectId> --env prod
|
|
|
220
296
|
# Set an environment variable
|
|
221
297
|
coze code env set API_KEY sk-xxxxx -p <projectId>
|
|
222
298
|
|
|
223
|
-
# Delete an environment variable
|
|
299
|
+
# Delete an environment variable (operates on the dev environment)
|
|
224
300
|
coze code env delete API_KEY -p <projectId>
|
|
225
301
|
```
|
|
226
302
|
|
|
303
|
+
> `env list` filters by `--env dev|prod` (default `dev`). `env delete` always targets the dev environment. `env set` is not yet supported for Skill projects.
|
|
304
|
+
|
|
227
305
|
#### Domain
|
|
228
306
|
|
|
229
307
|
Manage custom domains for deployed projects.
|
|
230
308
|
|
|
231
309
|
| Command | Description |
|
|
232
310
|
| ------------------------------------------------- | -------------------------------------------- |
|
|
233
|
-
| `coze code domain list <projectId>`
|
|
311
|
+
| `coze code domain list -p <projectId>` | List all custom domains bound to the project |
|
|
234
312
|
| `coze code domain add <domain> -p <projectId>` | Add a custom domain |
|
|
235
313
|
| `coze code domain remove <domain> -p <projectId>` | Remove a custom domain |
|
|
236
314
|
|
|
315
|
+
> `domain add` validates the format and accepts a single-level domain such as `example.com`.
|
|
316
|
+
|
|
237
317
|
#### Skill
|
|
238
318
|
|
|
239
319
|
Manage skills associated with a project to extend its capabilities.
|
|
240
320
|
|
|
241
|
-
| Command
|
|
242
|
-
|
|
|
243
|
-
| `coze code skill list -p <projectId>`
|
|
244
|
-
| `coze code skill add <skillId> -p <projectId>`
|
|
245
|
-
| `coze code skill remove <skillId> -p <projectId>`
|
|
321
|
+
| Command | Description |
|
|
322
|
+
| -------------------------------------------------- | ---------------------------------------------------------------- |
|
|
323
|
+
| `coze code skill list -p <projectId>` | List available skills (shows installed status) |
|
|
324
|
+
| `coze code skill add <skillId> -p <projectId>` | Add (mount) a skill to the project's default conversation |
|
|
325
|
+
| `coze code skill remove <skillId> -p <projectId>` | Remove (unmount) a skill from the default conversation |
|
|
326
|
+
| `coze code skill upload <filePath> -p <projectId>` | Upload a local `.skill` file as a personal skill |
|
|
327
|
+
| `coze code skill delete <skillId> -p <projectId>` | Permanently delete a personal skill (different from `remove`) |
|
|
328
|
+
|
|
329
|
+
> `add`/`remove` only mount or unmount a skill on the project's default conversation. `delete` permanently removes the personal skill itself. On naming conflict, `upload` auto-confirms an overwrite.
|
|
330
|
+
|
|
331
|
+
**`skill list`** **options:**
|
|
332
|
+
|
|
333
|
+
| Option | Description |
|
|
334
|
+
| ---------------------- | -------------------------------------------------- |
|
|
335
|
+
| `-p, --project-id <id>` | **(required)** Project ID |
|
|
336
|
+
| `--space-id <spaceId>` | Space ID (reads from config if omitted) |
|
|
337
|
+
| `--my` | List personal skills only |
|
|
338
|
+
| `--page <page>` | Page number (for personal skills, default: 1) |
|
|
339
|
+
| `--size <size>` | Page size (for personal skills, default: 20) |
|
|
246
340
|
|
|
247
341
|
#### Preview
|
|
248
342
|
|
|
@@ -257,6 +351,231 @@ Get the sandbox preview URL for a project.
|
|
|
257
351
|
coze code preview <projectId>
|
|
258
352
|
```
|
|
259
353
|
|
|
354
|
+
> Preview is available for Web/App project types. Agent, Automation, Skill, Mini-program, and Assistant projects are not previewable from the CLI — use the Web dashboard instead.
|
|
355
|
+
|
|
356
|
+
#### Git
|
|
357
|
+
|
|
358
|
+
Manage Git platform integrations including OAuth authorization and repository search. Use `--provider` to specify the Git service provider (default: github).
|
|
359
|
+
|
|
360
|
+
| Command | Description |
|
|
361
|
+
| -------------------------------- | ---------------------------------------------------- |
|
|
362
|
+
| `coze code git auth login` | Authorize a Git platform via OAuth (opens browser) |
|
|
363
|
+
| `coze code git auth status` | Check the current OAuth authorization status |
|
|
364
|
+
| `coze code git auth logout` | Revoke OAuth authorization for a Git platform |
|
|
365
|
+
| `coze code git search` | Search repositories on the authorized Git platform |
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Authorize GitHub (default provider)
|
|
369
|
+
coze code git auth login
|
|
370
|
+
|
|
371
|
+
# Check authorization status
|
|
372
|
+
coze code git auth status
|
|
373
|
+
|
|
374
|
+
# Search repos by keyword
|
|
375
|
+
coze code git search --keyword react
|
|
376
|
+
|
|
377
|
+
# Paginated search
|
|
378
|
+
coze code git search -k react --page 2 --page-size 10
|
|
379
|
+
|
|
380
|
+
# Revoke authorization
|
|
381
|
+
coze code git auth logout
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**`git`** **options (shared by subcommands):**
|
|
385
|
+
|
|
386
|
+
| Option | Description |
|
|
387
|
+
| ----------------------- | ----------------------------------------------------- |
|
|
388
|
+
| `--provider <provider>` | Git service provider: `github` / `gitlab` (default: `github`) |
|
|
389
|
+
|
|
390
|
+
#### Repo
|
|
391
|
+
|
|
392
|
+
Manage remote repository bindings and sync operations for Coze Coding projects.
|
|
393
|
+
|
|
394
|
+
| Command | Description |
|
|
395
|
+
| --------------------------------------------------- | ------------------------------------------------------- |
|
|
396
|
+
| `coze code repo create --name <name>` | Create a new repository on the remote Git platform |
|
|
397
|
+
| `coze code repo bind -p <projectId> -r <fullName>` | Bind a remote repository to a project |
|
|
398
|
+
| `coze code repo unbind -p <projectId>` | Unbind the remote repository from a project |
|
|
399
|
+
| `coze code repo push -p <projectId>` | Push local commits to the bound remote repository |
|
|
400
|
+
| `coze code repo pull -p <projectId>` | Pull remote changes from the bound repository |
|
|
401
|
+
| `coze code repo status -p <projectId>` | Show remote repository binding and sync status |
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
# Create a private repository
|
|
405
|
+
coze code repo create --name my-app --private
|
|
406
|
+
|
|
407
|
+
# Bind a repo to a project
|
|
408
|
+
coze code repo bind -p <projectId> -r user/my-repo
|
|
409
|
+
|
|
410
|
+
# Check binding and sync status
|
|
411
|
+
coze code repo status -p <projectId>
|
|
412
|
+
|
|
413
|
+
# Push local changes to remote
|
|
414
|
+
coze code repo push -p <projectId>
|
|
415
|
+
|
|
416
|
+
# Pull remote changes (auto-resolve conflicts keeping local)
|
|
417
|
+
coze code repo pull -p <projectId> --conflict-strategy ours
|
|
418
|
+
|
|
419
|
+
# Unbind repository
|
|
420
|
+
coze code repo unbind -p <projectId> --force
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**`repo create`** **options:**
|
|
424
|
+
|
|
425
|
+
| Option | Description |
|
|
426
|
+
| ------------------- | --------------------------------------- |
|
|
427
|
+
| `-n, --name <name>` | **(required)** Repository name |
|
|
428
|
+
| `--private` | Create as private repository |
|
|
429
|
+
|
|
430
|
+
**`repo bind`** **options:**
|
|
431
|
+
|
|
432
|
+
| Option | Description |
|
|
433
|
+
| -------------------------------- | ------------------------------------------- |
|
|
434
|
+
| `-p, --project-id <projectId>` | **(required)** Project ID |
|
|
435
|
+
| `-r, --repo <fullName>` | **(required)** Remote repo (e.g. user/repo) |
|
|
436
|
+
|
|
437
|
+
**`repo pull`** **options:**
|
|
438
|
+
|
|
439
|
+
| Option | Description |
|
|
440
|
+
| ------------------------------------- | ------------------------------------------------------- |
|
|
441
|
+
| `-p, --project-id <projectId>` | **(required)** Project ID |
|
|
442
|
+
| `--conflict-strategy <strategy>` | Auto conflict resolution: `ours` / `theirs` |
|
|
443
|
+
|
|
444
|
+
**`repo unbind`** **options:**
|
|
445
|
+
|
|
446
|
+
| Option | Description |
|
|
447
|
+
| ------------------------------ | ------------------------- |
|
|
448
|
+
| `-p, --project-id <projectId>` | **(required)** Project ID |
|
|
449
|
+
| `--force` | Skip confirmation prompt |
|
|
450
|
+
|
|
451
|
+
> `repo push` and `repo pull` are placeholder implementations pending backend wiring — they currently report success without performing a real sync.
|
|
452
|
+
|
|
453
|
+
#### Database
|
|
454
|
+
|
|
455
|
+
Manage Supabase-backed databases in the current Coze space. Supports the full database lifecycle, SQL execution, TypeScript type generation, schema/data export, and point-in-time rollback. All `db` subcommands accept `--space-id <spaceId>` (reads from context if omitted).
|
|
456
|
+
|
|
457
|
+
| Command | Description |
|
|
458
|
+
| --------------------------------------------------- | ----------------------------------------------------- |
|
|
459
|
+
| `coze code db create` | Create a new database (name and credentials auto-generated) |
|
|
460
|
+
| `coze code db list` | List databases in the current space |
|
|
461
|
+
| `coze code db get --db-id <id>` | Get database details (connection URLs and credentials) |
|
|
462
|
+
| `coze code db query --db-id <id> --sql "<sql>"` | Execute SQL on a database |
|
|
463
|
+
| `coze code db gen-types --db-id <id>` | Generate TypeScript types from the database schema |
|
|
464
|
+
| `coze code db dump --db-id <id>` | Export database schema (DDL) or data as SQL |
|
|
465
|
+
| `coze code db rollback --db-id <id> --timestamp <ts> --confirm` | Roll back a database to a point in time (PITR) |
|
|
466
|
+
| `coze code db status --db-id <id>` | Get database status and restore/rollback info |
|
|
467
|
+
| `coze code db delete --db-id <id> --confirm` | Delete a database (irreversible) |
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# Create a database
|
|
471
|
+
coze code db create
|
|
472
|
+
|
|
473
|
+
# List databases (text mode auto-paginates; use --all in JSON mode)
|
|
474
|
+
coze code db list --all
|
|
475
|
+
|
|
476
|
+
# Execute SQL (read from --sql, --file, or stdin)
|
|
477
|
+
coze code db query --db-id <id> --sql "SELECT * FROM users LIMIT 10"
|
|
478
|
+
|
|
479
|
+
# Dangerous SQL (DROP/TRUNCATE/ALTER TABLE/DELETE or UPDATE without WHERE) requires --confirm
|
|
480
|
+
coze code db query --db-id <id> --sql "DROP TABLE old_data" --confirm
|
|
481
|
+
|
|
482
|
+
# Generate TS types (default output: types/database.ts)
|
|
483
|
+
coze code db gen-types --db-id <id> --include-schema public --include-schema auth
|
|
484
|
+
|
|
485
|
+
# Export schema only (default) or data only
|
|
486
|
+
coze code db dump --db-id <id> --output db/schema.sql
|
|
487
|
+
coze code db dump --db-id <id> --data-only
|
|
488
|
+
|
|
489
|
+
# Roll back to a timestamp (milliseconds), --confirm required
|
|
490
|
+
coze code db rollback --db-id <id> --timestamp 1713254400000 --confirm
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**`db query`** **options:**
|
|
494
|
+
|
|
495
|
+
| Option | Description |
|
|
496
|
+
| ------------------ | ---------------------------------------------------------------- |
|
|
497
|
+
| `--db-id <dbId>` | **(required)** Database ID |
|
|
498
|
+
| `--sql <sql>` | Inline SQL to execute |
|
|
499
|
+
| `--file <path>` | Read SQL from a file |
|
|
500
|
+
| `--confirm` | Confirm execution of dangerous SQL (required in JSON mode) |
|
|
501
|
+
|
|
502
|
+
> SQL is read from `--sql`, then `--file`, then stdin. Dangerous operations (`DROP`, `TRUNCATE`, `ALTER TABLE`, `DELETE`/`UPDATE` without `WHERE`) require `--confirm`; in JSON mode they error out without it, while text mode prompts interactively.
|
|
503
|
+
|
|
504
|
+
**`db list`** **options:**
|
|
505
|
+
|
|
506
|
+
| Option | Description |
|
|
507
|
+
| ------------------------ | --------------------------------------------------- |
|
|
508
|
+
| `--limit <limit>` | Number of databases per page, 1–100 (default: 20) |
|
|
509
|
+
| `--cursor <cursorId>` | Cursor for pagination |
|
|
510
|
+
| `--all` | Fetch all databases across pages |
|
|
511
|
+
| `--max-pages <maxPages>` | Max pages to fetch in text mode (default: 10) |
|
|
512
|
+
|
|
513
|
+
**`db gen-types`** **options:**
|
|
514
|
+
|
|
515
|
+
| Option | Description |
|
|
516
|
+
| ------------------------ | --------------------------------------------------------- |
|
|
517
|
+
| `--db-id <dbId>` | **(required)** Database ID |
|
|
518
|
+
| `--output <path>` | Output file path (default: `types/database.ts`) |
|
|
519
|
+
| `--include-schema <name>` | Schema name, repeatable (default: `public`) |
|
|
520
|
+
|
|
521
|
+
**`db dump`** **options:**
|
|
522
|
+
|
|
523
|
+
| Option | Description |
|
|
524
|
+
| ------------------------ | -------------------------------------------------------- |
|
|
525
|
+
| `--db-id <dbId>` | **(required)** Database ID |
|
|
526
|
+
| `--output <path>` | Output file path (default: `db/schema.sql`) |
|
|
527
|
+
| `--schema-only` | Export schema only (the default when neither flag is set) |
|
|
528
|
+
| `--data-only` | Export data only |
|
|
529
|
+
| `--include-schema <name>` | Schema name, repeatable (default: `public`) |
|
|
530
|
+
|
|
531
|
+
**`db rollback`** / **`db delete`** **options:**
|
|
532
|
+
|
|
533
|
+
| Option | Description |
|
|
534
|
+
| ----------------------- | ------------------------------------------------ |
|
|
535
|
+
| `--db-id <dbId>` | **(required)** Database ID |
|
|
536
|
+
| `--timestamp <ts>` | **(required, rollback only)** Target timestamp in milliseconds |
|
|
537
|
+
| `--confirm` | **(required)** Confirm the destructive operation |
|
|
538
|
+
|
|
539
|
+
#### Model
|
|
540
|
+
|
|
541
|
+
Manage the model used by a Coze Coding project's default conversation.
|
|
542
|
+
|
|
543
|
+
| Command | Description |
|
|
544
|
+
| --------------------------------------------------- | ----------------------------------------------- |
|
|
545
|
+
| `coze code model list -p <projectId>` | List available models (marks the active one) |
|
|
546
|
+
| `coze code model list --type <type>` | List available models for a project type |
|
|
547
|
+
| `coze code model set <modelName> -p <projectId>` | Set the model for the default conversation |
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
# List available models for a project
|
|
551
|
+
coze code model list -p <projectId>
|
|
552
|
+
|
|
553
|
+
# List models by project type (when no project ID is available)
|
|
554
|
+
coze code model list --type web
|
|
555
|
+
|
|
556
|
+
# Set the conversation model
|
|
557
|
+
coze code model set doubao-dev-0213 -p <projectId>
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
#### Tools
|
|
561
|
+
|
|
562
|
+
Manage the tools enabled on a project's default conversation (e.g. web search, image generation).
|
|
563
|
+
|
|
564
|
+
| Command | Description |
|
|
565
|
+
| ------------------------------------------------------ | ---------------------------------------------- |
|
|
566
|
+
| `coze code tools list -p <projectId>` | List available tools (shows enabled status) |
|
|
567
|
+
| `coze code tools enable <toolName> -p <projectId>` | Enable a tool on the default conversation |
|
|
568
|
+
| `coze code tools disable <toolName> -p <projectId>` | Disable a tool on the default conversation |
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
# List available tools
|
|
572
|
+
coze code tools list -p <projectId>
|
|
573
|
+
|
|
574
|
+
# Enable / disable a tool
|
|
575
|
+
coze code tools enable enable_image_gen -p <projectId>
|
|
576
|
+
coze code tools disable enable_image_gen -p <projectId>
|
|
577
|
+
```
|
|
578
|
+
|
|
260
579
|
### `coze generate` — Media Generation
|
|
261
580
|
|
|
262
581
|
Generate images, audio, and video using Coze AI models. All `generate` subcommands support `--output-path <path>` to save generated media to disk.
|