refactor: streamline routed cli setup

This commit is contained in:
Peter Steinberger
2026-01-19 00:52:13 +00:00
parent 989543c9c3
commit c532d161c4
6 changed files with 110 additions and 37 deletions

View File

@@ -1,7 +1,7 @@
import type { Command } from "commander";
import { defaultRuntime } from "../../runtime.js";
import { emitCliBanner } from "../banner.js";
import { getCommandPath, hasHelpOrVersion, isReadOnlyCommand } from "../argv.js";
import { getCommandPath, hasHelpOrVersion, shouldMigrateState } from "../argv.js";
import { ensureConfigReady } from "./config-guard.js";
function setProcessTitleForCommand(actionCommand: Command) {
@@ -22,7 +22,7 @@ export function registerPreActionHooks(program: Command, programVersion: string)
if (hasHelpOrVersion(argv)) return;
const [primary] = getCommandPath(argv, 1);
if (primary === "doctor") return;
const migrateState = !isReadOnlyCommand(argv);
const migrateState = shouldMigrateState(argv);
await ensureConfigReady({ runtime: defaultRuntime, migrateState });
});
}