perf(cli): speed up startup

This commit is contained in:
Peter Steinberger
2026-02-14 12:16:16 +00:00
parent a7a08b6650
commit c90b3e4d5e
8 changed files with 223 additions and 44 deletions

View File

@@ -5,8 +5,6 @@ import { defaultRuntime } from "../../runtime.js";
import { getCommandPath, getVerboseFlag, hasHelpOrVersion } from "../argv.js";
import { emitCliBanner } from "../banner.js";
import { resolveCliName } from "../cli-name.js";
import { ensurePluginRegistryLoaded } from "../plugin-registry.js";
import { ensureConfigReady } from "./config-guard.js";
function setProcessTitleForCommand(actionCommand: Command) {
let current: Command = actionCommand;
@@ -48,9 +46,11 @@ export function registerPreActionHooks(program: Command, programVersion: string)
if (commandPath[0] === "doctor" || commandPath[0] === "completion") {
return;
}
const { ensureConfigReady } = await import("./config-guard.js");
await ensureConfigReady({ runtime: defaultRuntime, commandPath });
// Load plugins for commands that need channel access
if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) {
const { ensurePluginRegistryLoaded } = await import("../plugin-registry.js");
ensurePluginRegistryLoaded();
}
});