fix(cli): restore shipped surface capabilities

This commit is contained in:
Turtle
2026-07-29 17:34:50 +08:00
parent bee0a77aad
commit 857a4941be
13 changed files with 133 additions and 54 deletions

View File

@@ -30,12 +30,7 @@ describe('parseDshArgs', () => {
expect(parse(['--config-replace', 'tree.yml'])).toEqual({ mode: 'tui', configReplace: 'tree.yml' })
expect(parse(['--resume', 'sess', '--config', 'app.yml'])).toEqual({ mode: 'tui', config: 'app.yml', resume: 'sess' })
expect(parse(['-p', 'do the thing'])).toEqual({ mode: 'headless', prompt: 'do the thing' })
// `meta` accepts `--resume` but does not redeclare it: a shared option parses
// into program.opts() on either side of the subcommand, and redeclaring it
// would leave the subcommand's own options empty and drop the id.
expect(parse(['meta'])).toEqual({ mode: 'meta' })
expect(parse(['meta', '--resume', 'sess'])).toEqual({ mode: 'meta', resume: 'sess' })
expect(parse(['--resume', 'sess', 'meta'])).toEqual({ mode: 'meta', resume: 'sess' })
// Credential setup is option-free: it writes the Harness-home .env, so
// there is nothing for a flag to select.
// Bare `web` carries no host/port: the shipped cordis.yml owns the default.
@@ -72,9 +67,9 @@ describe('parseDshArgs', () => {
expect(exitCode(['--config-replace', 'tree.yml', 'web'])).toBe(1)
// Same rule for credential setup: it shares no option with the default
// surface, so a leaked flag is a typo, not something to ignore.
// `meta` fixes its own config tree and is interactive, so --config/-p are
// rejected; an empty id is swallowed downstream exactly as above.
expect(exitCode(['meta', '--resume='])).toBe(1)
// `meta` fixes its own config tree and always starts fresh, so every
// default-surface option is rejected.
expect(exitCode(['meta', '--resume', 's'])).toBe(1)
expect(exitCode(['meta', '--config', 'c.yml'])).toBe(1)
expect(exitCode(['meta', '--config-replace', 'tree.yml'])).toBe(1)
expect(exitCode(['meta', '-p', 'task'])).toBe(1)