fix(cli): 收敛逐级披露与输入错误

This commit is contained in:
Codex
2026-07-12 02:01:47 +02:00
parent e4b7fb9fbc
commit 80edc6c08b
12 changed files with 2044 additions and 1195 deletions
+7 -2
View File
@@ -4,7 +4,7 @@
import { readConfig } from "./src/config";
import { debugDispatch, debugEgressProxy, debugHealth, debugProviderRootfs, debugSshPool, debugTask, isDebugDispatchCommand, type DebugDispatchCommand } from "./src/debug";
import { isRebuildableService, isRestartableService, rebuildService, restartService, stackLogs, stackStatus, startStack, stopStack, unsupportedRebuildService, unsupportedRestartService } from "./src/docker";
import { emitError, emitJson, emitText, isRenderedCliResult } from "./src/output";
import { CliInputError, emitError, emitJson, emitText, isRenderedCliResult } from "./src/output";
import { cancelJob, jobWithTail, listJobs, listJobsSummary, readJob, renderJobLaunchSummary, renderJobStatusSummary, runJob } from "./src/jobs";
import { checkHelp, parseCheckOptions, runChecks, runRecoveryGuardrailsCheck } from "./src/check";
import { runSsh } from "./src/ssh";
@@ -786,7 +786,12 @@ async function main(): Promise<void> {
throw error;
}
throw new Error(`Unknown command: ${commandName}`);
throw new CliInputError(`Unknown command: ${commandName}`, {
code: "unknown-command",
argument: args[0] ?? "",
usage: "bun scripts/cli.ts help",
hint: "Run the top-level help, then use the matching namespace-scoped help before retrying.",
});
}
if (import.meta.main && !process.execArgv.includes("--check")) {