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
+7
View File
@@ -73,5 +73,12 @@ describe('defineOperation', () => {
cli: { command: ['get'], flags: { ['other' as 'id']: ['-o'] } },
}),
).toThrow('unknown input "other"')
expect(() =>
defineOperation({
...baseDefinition(),
surfaces: ['cli'],
cli: { command: ['get'], defaults: { ['extra' as 'id']: 'x' } },
}),
).toThrow('unknown input "extra"')
})
})