Unify unknown command and subcommand exit code classification

This commit is contained in:
gitea committed 2026-09-11 10:02:50 +08:00
1 parent bda8b82157
commit 225321f34a
5 files changed
+80 -61

No files matched your search

+1 -1
View File
@@ -40,7 +40,7 @@ export function classifyCliError(error: unknown): {
if (status === 401 || status === 403 || /(?:^|\s)(?:token|bearer|session) (?:expired|missing|invalid)/i.test(value)) {
return { exitCode: 11 };
}
if (/^(?:Usage:|Unknown (?:command|auth|config|corps|delegation|deploy|llm|permissions|preference|rules|simulation|users|webhook)|Invalid (?:number|boolean|command)|--json must|Missing required JSON field)/.test(value)) {
if (/^(?:Usage:|Unknown (?:[a-z0-9_-]+ )?command|Invalid (?:number|boolean|command)|--json must|Missing required JSON field)/i.test(value)) {
return { exitCode: 2 };
}
if (/^Refusing to (?:clear|delete)|without --yes|without confirm=true/i.test(value)) {