fix: lazy-load heavy CLI commands
This commit is contained in:
+7
-7
@@ -1,7 +1,6 @@
|
||||
import { readConfig } from "./src/config";
|
||||
import { debugDispatch, debugHealth, debugTask, isDebugDispatchCommand, type DebugDispatchCommand } from "./src/debug";
|
||||
import { isRebuildableService, rebuildService, stackLogs, stackStatus, startStack, stopStack, unsupportedRebuildService } from "./src/docker";
|
||||
import { parseE2ERunOptions, runE2E } from "./src/e2e";
|
||||
import { emitError, emitJson } from "./src/output";
|
||||
import { cancelJob, jobWithTail, listJobs, listJobsSummary, readJob, runJob } from "./src/jobs";
|
||||
import { checkHelp, parseCheckOptions, runChecks, runRecoveryGuardrailsCheck } from "./src/check";
|
||||
@@ -24,12 +23,7 @@ import { isGhContentRoute, runGhContentRoute } from "./src/gh-route";
|
||||
import { runCommanderCommand } from "./src/commander";
|
||||
import { isHelpToken, rootHelp, serverHelp, sshHelp, staticNamespaceHelp } from "./src/help";
|
||||
import { runServerCleanupCommand } from "./src/server-cleanup";
|
||||
import { runHwlabCdCommand } from "./src/hwlab-cd";
|
||||
import { runHwlabG14Command } from "./src/hwlab-g14";
|
||||
import { runHwlabNodeCommand } from "./src/hwlab-node";
|
||||
import { runGcCommand } from "./src/gc";
|
||||
import { runAgentRunCommand } from "./src/agentrun";
|
||||
import { runPlatformInfraCommand } from "./src/platform-infra";
|
||||
|
||||
const remoteOptions = extractRemoteCliOptions(process.argv.slice(2));
|
||||
const args = remoteOptions.args;
|
||||
@@ -235,7 +229,7 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const namespaceHelp = staticNamespaceHelp(args);
|
||||
const namespaceHelp = await staticNamespaceHelp(args);
|
||||
if (namespaceHelp !== null) {
|
||||
emitJson(commandName, namespaceHelp);
|
||||
return;
|
||||
@@ -293,6 +287,7 @@ async function main(): Promise<void> {
|
||||
|
||||
if (top === "hwlab") {
|
||||
if (sub === "node" || sub === "nodes") {
|
||||
const { runHwlabNodeCommand } = await import("./src/hwlab-node");
|
||||
const result = await runHwlabNodeCommand(readConfig(), args.slice(2));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
emitJson(commandName, result, ok);
|
||||
@@ -300,12 +295,14 @@ async function main(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
if (sub === "g14") {
|
||||
const { runHwlabG14Command } = await import("./src/hwlab-g14");
|
||||
const result = await runHwlabG14Command(readConfig(), args.slice(2));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
emitJson(commandName, result, ok);
|
||||
if (!ok) process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
const { runHwlabCdCommand } = await import("./src/hwlab-cd");
|
||||
const result = await runHwlabCdCommand(args.slice(1));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
emitJson(commandName, result, ok);
|
||||
@@ -314,6 +311,7 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
if (top === "agentrun") {
|
||||
const { runAgentRunCommand } = await import("./src/agentrun");
|
||||
const result = await runAgentRunCommand(readConfig(), args.slice(1));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
emitJson(commandName, result, ok);
|
||||
@@ -322,6 +320,7 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
if (top === "platform-infra") {
|
||||
const { runPlatformInfraCommand } = await import("./src/platform-infra");
|
||||
const result = await runPlatformInfraCommand(readConfig(), args.slice(1));
|
||||
const ok = (result as { ok?: unknown }).ok !== false;
|
||||
emitJson(commandName, result, ok);
|
||||
@@ -525,6 +524,7 @@ async function main(): Promise<void> {
|
||||
}
|
||||
|
||||
if (top === "e2e" && sub === "run") {
|
||||
const { parseE2ERunOptions, runE2E } = await import("./src/e2e");
|
||||
const result = await runE2E(config, parseE2ERunOptions(args.slice(2)));
|
||||
const ok = (result as { ok?: unknown }).ok === true;
|
||||
emitJson(commandName, result, ok);
|
||||
|
||||
Reference in New Issue
Block a user