CLI: restore lightweight root help and scoped status plugin preload

This commit is contained in:
Vincent Koc
2026-03-15 17:37:36 -07:00
parent c455cccd3d
commit f87e7be55e
7 changed files with 127 additions and 38 deletions

View File

@@ -67,6 +67,10 @@ function loadPluginRegistryModule() {
return pluginRegistryModulePromise;
}
function resolvePluginRegistryScope(commandPath: string[]): "channels" | "all" {
return commandPath[0] === "status" || commandPath[0] === "health" ? "channels" : "all";
}
function getRootCommand(command: Command): Command {
let current = command;
while (current.parent) {
@@ -136,7 +140,7 @@ export function registerPreActionHooks(program: Command, programVersion: string)
// Load plugins for commands that need channel access
if (PLUGIN_REQUIRED_COMMANDS.has(commandPath[0])) {
const { ensurePluginRegistryLoaded } = await loadPluginRegistryModule();
ensurePluginRegistryLoaded();
ensurePluginRegistryLoaded({ scope: resolvePluginRegistryScope(commandPath) });
}
});
}