feat(cli): generate shumai-cli commands from Operations with commander (#496)

Rebuild the CLI on commander. Commands for every cli-surface Operation
(project ls, ls, mkdir, rename, move/mv, delete/rm) are generated from
@shumai/operations: positionals, options, choices, numeric parsing and
help text come from the Zod input schema. They call POST /api/ops/:name
with x-shumai-client: cli.

Existing invocations keep working. Adds --json, ls --type/--first/
--after, typo suggestions, and generated help. upload and create-version
stay hand-written. Drops the unused @shumai/core dependency.
This commit is contained in:
Yiling-J
2026-10-27 08:09:10 +08:00
committed by GitHub
parent 4d61786799
commit e44938cb8f
25 changed files with 976 additions and 745 deletions
+4 -1
View File
@@ -20,7 +20,7 @@ export const listAssets = defineOperation({
.min(1)
.max(MAX_PAGE_SIZE)
.optional()
.describe(`Maximum number of assets to return. Default is 20, maximum ${MAX_PAGE_SIZE}.`),
.describe(`Maximum number of assets to return (at most ${MAX_PAGE_SIZE}).`),
after: z
.string()
.optional()
@@ -35,6 +35,9 @@ export const listAssets = defineOperation({
annotations: { readOnly: true, destructive: false, idempotent: true },
cli: {
command: ['ls'],
description: 'List the files and folders inside a parent folder.',
flags: { parent: ['-p', '--parent'] },
// The CLI shows up to the maximum page by default; agents use the smaller default.
defaults: { first: MAX_PAGE_SIZE },
},
})