mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 15:44:28 +00:00
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:
@@ -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 },
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user