perf(cli): cache agent bind command import

This commit is contained in:
Vincent Koc
2026-05-29 21:55:55 +02:00
parent 9b4b3aa348
commit 86e6fbcf52

View File

@@ -16,6 +16,12 @@ type AgentsIdentityModule = typeof import("../../commands/agents.commands.identi
type AgentsListModule = typeof import("../../commands/agents.commands.list.js");
type GlobalStateModule = typeof import("../../global-state.js");
let agentsBindModulePromise: Promise<AgentsBindModule> | undefined;
function loadAgentsBindModule(): Promise<AgentsBindModule> {
return (agentsBindModulePromise ??= import("../../commands/agents.commands.bind.js"));
}
async function loadAgentCliCommand(): Promise<AgentViaGatewayModule["agentCliCommand"]> {
return (await import("../../commands/agent-via-gateway.js")).agentCliCommand;
}
@@ -25,15 +31,15 @@ async function loadAgentsAddCommand(): Promise<AgentsAddModule["agentsAddCommand
}
async function loadAgentsBindCommand(): Promise<AgentsBindModule["agentsBindCommand"]> {
return (await import("../../commands/agents.commands.bind.js")).agentsBindCommand;
return (await loadAgentsBindModule()).agentsBindCommand;
}
async function loadAgentsBindingsCommand(): Promise<AgentsBindModule["agentsBindingsCommand"]> {
return (await import("../../commands/agents.commands.bind.js")).agentsBindingsCommand;
return (await loadAgentsBindModule()).agentsBindingsCommand;
}
async function loadAgentsUnbindCommand(): Promise<AgentsBindModule["agentsUnbindCommand"]> {
return (await import("../../commands/agents.commands.bind.js")).agentsUnbindCommand;
return (await loadAgentsBindModule()).agentsUnbindCommand;
}
async function loadAgentsDeleteCommand(): Promise<AgentsDeleteModule["agentsDeleteCommand"]> {