Split out of the #590 docsite audit (reference/cli.mdx exit-code table). The docs now state current behaviour; this issue tracks whether the code should change.
In packages/agent-bundle/src/cli.ts, option-argument validators are inconsistent about how they fail:
| Validator |
Throws |
Result |
mcpAppProfile (serve-app --profile) |
InvalidArgumentError |
Commander error → exit 2 |
consentCapability (serve-app --allow) |
InvalidArgumentError |
exit 2 |
doctorHost (doctor --host) |
InvalidArgumentError |
exit 2 |
port (--port) |
TypeError |
rethrown by Commander → generic catch → one AB5000 diagnostic on stderr, exit 1 |
trialCount (--trials) |
TypeError |
AB5000, exit 1 |
installHost (dev --install-host) |
TypeError |
AB5000, exit 1 |
installMode (install/uninstall --mode) |
TypeError |
AB5000, exit 1 |
installScope (install/uninstall --scope) |
TypeError |
AB5000, exit 1 |
(parseJsonObject for --input/--input-file also throws TypeError → AB5000, exit 1; that one is arguably a runtime input failure rather than a parser failure and may be fine as is.)
A bad option value is a usage error like an unknown option, so the five TypeError validators should probably throw InvalidArgumentError so Commander prints error: option '--port <port>' argument 'x' is invalid. Port must be a TCP port number. and the process exits 2 — matching --profile/--allow/--host. Tests in packages/agent-bundle/tests/** that assert the AB5000 shape for these would need updating, and website/docs/{en,zh}/reference/cli.mdx exit-code rows (updated in #590 to describe today's split) would move those options to the exit-2 row.
Deliberately not done in the #590 docs PR to keep that change docs-only.
Split out of the #590 docsite audit (
reference/cli.mdxexit-code table). The docs now state current behaviour; this issue tracks whether the code should change.In
packages/agent-bundle/src/cli.ts, option-argument validators are inconsistent about how they fail:mcpAppProfile(serve-app --profile)InvalidArgumentErrorconsentCapability(serve-app --allow)InvalidArgumentErrordoctorHost(doctor --host)InvalidArgumentErrorport(--port)TypeErrorAB5000diagnostic on stderr, exit 1trialCount(--trials)TypeErrorAB5000, exit 1installHost(dev --install-host)TypeErrorAB5000, exit 1installMode(install/uninstall --mode)TypeErrorAB5000, exit 1installScope(install/uninstall --scope)TypeErrorAB5000, exit 1(
parseJsonObjectfor--input/--input-filealso throwsTypeError→AB5000, exit 1; that one is arguably a runtime input failure rather than a parser failure and may be fine as is.)A bad option value is a usage error like an unknown option, so the five
TypeErrorvalidators should probably throwInvalidArgumentErrorso Commander printserror: option '--port <port>' argument 'x' is invalid. Port must be a TCP port number.and the process exits 2 — matching--profile/--allow/--host. Tests inpackages/agent-bundle/tests/**that assert theAB5000shape for these would need updating, andwebsite/docs/{en,zh}/reference/cli.mdxexit-code rows (updated in #590 to describe today's split) would move those options to the exit-2 row.Deliberately not done in the #590 docs PR to keep that change docs-only.