diff --git a/src/lib/deploy-action.ts b/src/lib/actions/deploy.ts similarity index 89% rename from src/lib/deploy-action.ts rename to src/lib/actions/deploy.ts index e987c073c43..6fc24e2c8e1 100644 --- a/src/lib/deploy-action.ts +++ b/src/lib/actions/deploy.ts @@ -3,9 +3,9 @@ import { execFileSync, spawnSync } from "node:child_process"; -import { getCredential } from "./credentials"; -import { executeDeploy } from "./deploy"; -import { ROOT, run, runInteractive, shellQuote, validateName } from "./runner"; +import { getCredential } from "../credentials"; +import { executeDeploy } from "../deploy"; +import { ROOT, run, runInteractive, shellQuote, validateName } from "../runner"; export async function runDeployAction(instanceName?: string): Promise { await executeDeploy({ diff --git a/src/lib/global-cli-actions.test.ts b/src/lib/actions/global.test.ts similarity index 89% rename from src/lib/global-cli-actions.test.ts rename to src/lib/actions/global.test.ts index cb395e78778..82ecbb52f35 100644 --- a/src/lib/global-cli-actions.test.ts +++ b/src/lib/actions/global.test.ts @@ -16,21 +16,21 @@ const mocks = vi.hoisted(() => ({ version: vi.fn(), })); -vi.mock("./deploy-action", () => ({ runDeployAction: mocks.runDeployAction })); -vi.mock("./gateway-runtime-action", () => ({ +vi.mock("./deploy", () => ({ runDeployAction: mocks.runDeployAction })); +vi.mock("../gateway-runtime-action", () => ({ recoverNamedGatewayRuntime: mocks.recoverNamedGatewayRuntime, })); -vi.mock("./maintenance-actions", () => ({ +vi.mock("./maintenance", () => ({ backupAll: mocks.backupAll, garbageCollectImages: mocks.garbageCollectImages, })); -vi.mock("./onboard-action", () => ({ +vi.mock("./onboard", () => ({ runOnboardAction: mocks.runOnboardAction, runSetupAction: mocks.runSetupAction, runSetupSparkAction: mocks.runSetupSparkAction, })); -vi.mock("./adapters/openshell/runtime", () => ({ runOpenshell: mocks.runOpenshell })); -vi.mock("./root-help-action", () => ({ help: mocks.help, version: mocks.version })); +vi.mock("../adapters/openshell/runtime", () => ({ runOpenshell: mocks.runOpenshell })); +vi.mock("./root-help", () => ({ help: mocks.help, version: mocks.version })); import { recoverNamedGatewayRuntime, @@ -45,7 +45,7 @@ import { setGlobalCliActionRuntimeHooksForTest, showRootHelp, showVersion, -} from "./global-cli-actions"; +} from "./global"; describe("global cli action facade", () => { beforeEach(() => { diff --git a/src/lib/global-cli-actions.ts b/src/lib/actions/global.ts similarity index 89% rename from src/lib/global-cli-actions.ts rename to src/lib/actions/global.ts index a13bbf7ee02..241c23f3c58 100644 --- a/src/lib/global-cli-actions.ts +++ b/src/lib/actions/global.ts @@ -1,23 +1,23 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { runDeployAction as executeDeployAction } from "./deploy-action"; +import { runDeployAction as executeDeployAction } from "./deploy"; import { type GarbageCollectImagesOptions, type UpgradeSandboxesOptions, -} from "./domain/lifecycle/options"; +} from "../domain/lifecycle/options"; import { backupAll as executeBackupAllAction, garbageCollectImages as executeGarbageCollectImagesAction, -} from "./maintenance-actions"; +} from "./maintenance"; import { runOnboardAction as executeOnboardAction, runSetupAction as executeSetupAction, runSetupSparkAction as executeSetupSparkAction, -} from "./onboard-action"; -import { recoverNamedGatewayRuntime as recoverNamedGatewayRuntimeAction } from "./gateway-runtime-action"; -import { runOpenshell } from "./adapters/openshell/runtime"; -import { help, version } from "./root-help-action"; +} from "./onboard"; +import { recoverNamedGatewayRuntime as recoverNamedGatewayRuntimeAction } from "../gateway-runtime-action"; +import { runOpenshell } from "../adapters/openshell/runtime"; +import { help, version } from "./root-help"; type GatewayRecovery = { recovered: boolean }; @@ -62,7 +62,7 @@ export async function runUpgradeSandboxesAction( await runtimeHooks.upgradeSandboxes(options); return; } - const { upgradeSandboxes } = require("./upgrade-sandboxes-action") as { + const { upgradeSandboxes } = require("./upgrade-sandboxes") as { upgradeSandboxes: (options?: string[] | UpgradeSandboxesOptions) => Promise; }; await upgradeSandboxes(options); diff --git a/src/lib/maintenance-actions.ts b/src/lib/actions/maintenance.ts similarity index 91% rename from src/lib/maintenance-actions.ts rename to src/lib/actions/maintenance.ts index 5be7f5a1266..3515d5ff7f5 100644 --- a/src/lib/maintenance-actions.ts +++ b/src/lib/actions/maintenance.ts @@ -3,17 +3,17 @@ /* v8 ignore start -- exercised through CLI subprocess maintenance tests. */ -import { prompt as askPrompt } from "./credentials"; +import { prompt as askPrompt } from "../credentials"; import { type GarbageCollectImagesOptions, normalizeGarbageCollectImagesOptions, -} from "./domain/lifecycle/options"; -import { dockerListImagesFormat, dockerRmi } from "./docker"; -import { findOrphanedSandboxImages, parseSandboxImageRows } from "./domain/maintenance/images"; -import { captureOpenshell } from "./adapters/openshell/runtime"; -import * as registry from "./registry"; -import { parseLiveSandboxNames } from "./runtime-recovery"; -import * as sandboxState from "./sandbox-state"; +} from "../domain/lifecycle/options"; +import { dockerListImagesFormat, dockerRmi } from "../docker"; +import { findOrphanedSandboxImages, parseSandboxImageRows } from "../domain/maintenance/images"; +import { captureOpenshell } from "../adapters/openshell/runtime"; +import * as registry from "../registry"; +import { parseLiveSandboxNames } from "../runtime-recovery"; +import * as sandboxState from "../sandbox-state"; const useColor = !process.env.NO_COLOR && !!process.stdout.isTTY; const trueColor = diff --git a/src/lib/onboard-action.ts b/src/lib/actions/onboard.ts similarity index 84% rename from src/lib/onboard-action.ts rename to src/lib/actions/onboard.ts index 53a099baac2..133ff026ea4 100644 --- a/src/lib/onboard-action.ts +++ b/src/lib/actions/onboard.ts @@ -1,11 +1,11 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { listAgents } from "./agent-defs"; -import { runDeprecatedOnboardAliasCommand, runOnboardCommand } from "./onboard-command"; -import { NOTICE_ACCEPT_ENV, NOTICE_ACCEPT_FLAG } from "./usage-notice"; +import { listAgents } from "../agent-defs"; +import { runDeprecatedOnboardAliasCommand, runOnboardCommand } from "../onboard-command"; +import { NOTICE_ACCEPT_ENV, NOTICE_ACCEPT_FLAG } from "../usage-notice"; -const { onboard: runOnboard } = require("./onboard") as { +const { onboard: runOnboard } = require("../onboard") as { onboard: (options?: unknown) => Promise; }; diff --git a/src/lib/root-help-action.ts b/src/lib/actions/root-help.ts similarity index 96% rename from src/lib/root-help-action.ts rename to src/lib/actions/root-help.ts index df970e7ea02..c1d39fd3274 100644 --- a/src/lib/root-help-action.ts +++ b/src/lib/actions/root-help.ts @@ -1,10 +1,10 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { AGENT_PRODUCT_NAME, CLI_DISPLAY_NAME, CLI_NAME } from "./branding"; -import { commandsByGroup, visibleCommands, type CommandDef } from "./command-registry"; -import { getRegisteredOclifCommandSummary } from "./cli/oclif-metadata"; -import { getVersion } from "./version"; +import { AGENT_PRODUCT_NAME, CLI_DISPLAY_NAME, CLI_NAME } from "../branding"; +import { commandsByGroup, visibleCommands, type CommandDef } from "../command-registry"; +import { getRegisteredOclifCommandSummary } from "../cli/oclif-metadata"; +import { getVersion } from "../version"; const useColor = !process.env.NO_COLOR && !!process.stdout.isTTY; const trueColor = diff --git a/src/lib/upgrade-sandboxes-action.ts b/src/lib/actions/upgrade-sandboxes.ts similarity index 88% rename from src/lib/upgrade-sandboxes-action.ts rename to src/lib/actions/upgrade-sandboxes.ts index 7a95f2655e0..0261a6749f3 100644 --- a/src/lib/upgrade-sandboxes-action.ts +++ b/src/lib/actions/upgrade-sandboxes.ts @@ -3,23 +3,23 @@ /* v8 ignore start -- exercised through CLI subprocess upgrade tests. */ -import { CLI_NAME } from "./branding"; -import { prompt as askPrompt } from "./credentials"; +import { CLI_NAME } from "../branding"; +import { prompt as askPrompt } from "../credentials"; import { normalizeUpgradeSandboxesOptions, type UpgradeSandboxesOptions, -} from "./domain/lifecycle/options"; -import { captureOpenshell } from "./adapters/openshell/runtime"; -import * as registry from "./registry"; -import { parseLiveSandboxNames } from "./runtime-recovery"; -import { rebuildSandbox } from "./actions/sandbox/rebuild"; -import * as sandboxVersion from "./sandbox-version"; -import { B, D, G, R, YW } from "./terminal-style"; +} from "../domain/lifecycle/options"; +import { captureOpenshell } from "../adapters/openshell/runtime"; +import * as registry from "../registry"; +import { parseLiveSandboxNames } from "../runtime-recovery"; +import { rebuildSandbox } from "./sandbox/rebuild"; +import * as sandboxVersion from "../sandbox-version"; +import { B, D, G, R, YW } from "../terminal-style"; import { classifyUpgradeableSandboxes, shouldSkipUpgradeConfirmation, splitRebuildableSandboxes, -} from "./domain/maintenance/upgrade"; +} from "../domain/maintenance/upgrade"; // ── Upgrade sandboxes (#1904) ──────────────────────────────────── // Detect sandboxes running stale agent versions and offer to rebuild them. diff --git a/src/lib/commands/credentials.test.ts b/src/lib/commands/credentials.test.ts index 6c2156dfe8e..b0d784aaa14 100644 --- a/src/lib/commands/credentials.test.ts +++ b/src/lib/commands/credentials.test.ts @@ -10,7 +10,7 @@ const mocks = vi.hoisted(() => ({ })); vi.mock("../credentials", () => ({ prompt: mocks.prompt })); -vi.mock("../global-cli-actions", () => ({ +vi.mock("../actions/global", () => ({ recoverNamedGatewayRuntime: mocks.recoverNamedGatewayRuntime, runOpenshellProviderCommand: mocks.runOpenshellProviderCommand, })); diff --git a/src/lib/commands/credentials/common.ts b/src/lib/commands/credentials/common.ts index 2fb9c7dcc1c..f48de6686e2 100644 --- a/src/lib/commands/credentials/common.ts +++ b/src/lib/commands/credentials/common.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { CLI_DISPLAY_NAME, CLI_NAME } from "../../branding"; -import { recoverNamedGatewayRuntime } from "../../global-cli-actions"; +import { recoverNamedGatewayRuntime } from "../../actions/global"; // Suffixes that mark per-sandbox messaging integrations in the gateway's // provider list. These are managed by `channels`, not `credentials`. diff --git a/src/lib/commands/credentials/list.ts b/src/lib/commands/credentials/list.ts index 7c47c731b07..86a165fc0c9 100644 --- a/src/lib/commands/credentials/list.ts +++ b/src/lib/commands/credentials/list.ts @@ -4,7 +4,7 @@ import { Command, Flags } from "@oclif/core"; import { CLI_NAME } from "../../branding"; -import { runOpenshellProviderCommand } from "../../global-cli-actions"; +import { runOpenshellProviderCommand } from "../../actions/global"; import { OPENSHELL_OPERATION_TIMEOUT_MS } from "../../adapters/openshell/timeouts"; import { isBridgeProviderName, recoverGatewayOrExit } from "./common"; diff --git a/src/lib/commands/credentials/reset.ts b/src/lib/commands/credentials/reset.ts index afe1e42cbb8..f86e8d0f6ae 100644 --- a/src/lib/commands/credentials/reset.ts +++ b/src/lib/commands/credentials/reset.ts @@ -5,7 +5,7 @@ import { Args, Command, Flags } from "@oclif/core"; import { CLI_NAME } from "../../branding"; import { prompt as askPrompt } from "../../credentials"; -import { runOpenshellProviderCommand } from "../../global-cli-actions"; +import { runOpenshellProviderCommand } from "../../actions/global"; import { OPENSHELL_OPERATION_TIMEOUT_MS } from "../../adapters/openshell/timeouts"; import { isBridgeProviderName, recoverGatewayOrExit } from "./common"; diff --git a/src/lib/commands/deploy.ts b/src/lib/commands/deploy.ts index 31d460f81e4..78a27ece12d 100644 --- a/src/lib/commands/deploy.ts +++ b/src/lib/commands/deploy.ts @@ -3,7 +3,7 @@ import { Args, Command, Flags } from "@oclif/core"; -import { runDeployAction } from "../global-cli-actions"; +import { runDeployAction } from "../actions/global"; export default class DeployCliCommand extends Command { static id = "deploy"; diff --git a/src/lib/commands/global-oclif-command-adapters.test.ts b/src/lib/commands/global-oclif-command-adapters.test.ts index 7ae8255b664..ee9395883d7 100644 --- a/src/lib/commands/global-oclif-command-adapters.test.ts +++ b/src/lib/commands/global-oclif-command-adapters.test.ts @@ -33,7 +33,7 @@ vi.mock("../status-command-deps", () => ({ buildStatusCommandDeps: mocks.buildStatusCommandDeps, })); -vi.mock("../global-cli-actions", () => ({ +vi.mock("../actions/global", () => ({ runBackupAllAction: mocks.runBackupAllAction, runGarbageCollectImagesAction: mocks.runGarbageCollectImagesAction, runOnboardAction: mocks.runOnboardAction, diff --git a/src/lib/commands/maintenance/backup-all.ts b/src/lib/commands/maintenance/backup-all.ts index e1ac85d9440..a48f0176e3f 100644 --- a/src/lib/commands/maintenance/backup-all.ts +++ b/src/lib/commands/maintenance/backup-all.ts @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. // SPDX-License-Identifier: Apache-2.0 -import { runBackupAllAction } from "../../global-cli-actions"; +import { runBackupAllAction } from "../../actions/global"; import { NemoClawCommand } from "../../cli/nemoclaw-oclif-command"; export default class BackupAllCommand extends NemoClawCommand { diff --git a/src/lib/commands/maintenance/gc.ts b/src/lib/commands/maintenance/gc.ts index 5af768a3e46..6f7fdada155 100644 --- a/src/lib/commands/maintenance/gc.ts +++ b/src/lib/commands/maintenance/gc.ts @@ -3,7 +3,7 @@ import { Flags } from "@oclif/core"; -import { runGarbageCollectImagesAction } from "../../global-cli-actions"; +import { runGarbageCollectImagesAction } from "../../actions/global"; import { NemoClawCommand } from "../../cli/nemoclaw-oclif-command"; export default class GarbageCollectImagesCommand extends NemoClawCommand { diff --git a/src/lib/commands/maintenance/upgrade-sandboxes.ts b/src/lib/commands/maintenance/upgrade-sandboxes.ts index 094ddf7f2fc..83cff6d13c0 100644 --- a/src/lib/commands/maintenance/upgrade-sandboxes.ts +++ b/src/lib/commands/maintenance/upgrade-sandboxes.ts @@ -3,7 +3,7 @@ import { Flags } from "@oclif/core"; -import { runUpgradeSandboxesAction } from "../../global-cli-actions"; +import { runUpgradeSandboxesAction } from "../../actions/global"; import { NemoClawCommand } from "../../cli/nemoclaw-oclif-command"; export default class UpgradeSandboxesCommand extends NemoClawCommand { diff --git a/src/lib/commands/onboard.test.ts b/src/lib/commands/onboard.test.ts index 64c1240538b..bfcbff58cef 100644 --- a/src/lib/commands/onboard.test.ts +++ b/src/lib/commands/onboard.test.ts @@ -3,10 +3,10 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; -import { runOnboardAction } from "../global-cli-actions"; +import { runOnboardAction } from "../actions/global"; import OnboardCliCommand from "./onboard"; -vi.mock("../global-cli-actions", () => ({ +vi.mock("../actions/global", () => ({ runOnboardAction: vi.fn().mockResolvedValue(undefined), runSetupAction: vi.fn().mockResolvedValue(undefined), runSetupSparkAction: vi.fn().mockResolvedValue(undefined), diff --git a/src/lib/commands/onboard.ts b/src/lib/commands/onboard.ts index 090614bce7b..4e2bf9b9c8c 100644 --- a/src/lib/commands/onboard.ts +++ b/src/lib/commands/onboard.ts @@ -3,7 +3,7 @@ import { Command } from "@oclif/core"; -import { runOnboardAction } from "../global-cli-actions"; +import { runOnboardAction } from "../actions/global"; import { buildOnboardFlags, onboardExamples, diff --git a/src/lib/commands/root/help.ts b/src/lib/commands/root/help.ts index 7200337fe63..ca629dbf65f 100644 --- a/src/lib/commands/root/help.ts +++ b/src/lib/commands/root/help.ts @@ -3,7 +3,7 @@ import { Command } from "@oclif/core"; -import { showRootHelp } from "../../global-cli-actions"; +import { showRootHelp } from "../../actions/global"; export default class RootHelpCommand extends Command { static id = "root:help"; diff --git a/src/lib/commands/root/version.ts b/src/lib/commands/root/version.ts index 7d098b80b9c..c93a4ad677f 100644 --- a/src/lib/commands/root/version.ts +++ b/src/lib/commands/root/version.ts @@ -3,7 +3,7 @@ import { Command } from "@oclif/core"; -import { showVersion } from "../../global-cli-actions"; +import { showVersion } from "../../actions/global"; export default class VersionCommand extends Command { static id = "root:version"; diff --git a/src/lib/commands/setup-spark.ts b/src/lib/commands/setup-spark.ts index f51e1ced685..a3c8e0ab810 100644 --- a/src/lib/commands/setup-spark.ts +++ b/src/lib/commands/setup-spark.ts @@ -3,7 +3,7 @@ import { Command } from "@oclif/core"; -import { runSetupSparkAction } from "../global-cli-actions"; +import { runSetupSparkAction } from "../actions/global"; import { buildOnboardFlags, type OnboardFlags, toLegacyOnboardArgs } from "./onboard/common"; export default class SetupSparkCliCommand extends Command { diff --git a/src/lib/commands/setup.ts b/src/lib/commands/setup.ts index 3ba216e30b7..c55f90240e9 100644 --- a/src/lib/commands/setup.ts +++ b/src/lib/commands/setup.ts @@ -3,7 +3,7 @@ import { Command } from "@oclif/core"; -import { runSetupAction } from "../global-cli-actions"; +import { runSetupAction } from "../actions/global"; import { buildOnboardFlags, type OnboardFlags, toLegacyOnboardArgs } from "./onboard/common"; export default class SetupCliCommand extends Command { diff --git a/src/lib/commands/simple-global-oclif-adapters.test.ts b/src/lib/commands/simple-global-oclif-adapters.test.ts index f0b6c01c0b7..8e40bae33e3 100644 --- a/src/lib/commands/simple-global-oclif-adapters.test.ts +++ b/src/lib/commands/simple-global-oclif-adapters.test.ts @@ -31,7 +31,7 @@ vi.mock("../debug-command", () => ({ vi.mock("../gateway-token-command", () => ({ runGatewayTokenCommand: mocks.runGatewayTokenCommand, })); -vi.mock("../global-cli-actions", () => ({ +vi.mock("../actions/global", () => ({ runDeployAction: mocks.runDeployAction, showRootHelp: mocks.showRootHelp, showVersion: mocks.showVersion, diff --git a/src/nemoclaw.ts b/src/nemoclaw.ts index 47d32a88822..77062101b1d 100644 --- a/src/nemoclaw.ts +++ b/src/nemoclaw.ts @@ -44,7 +44,7 @@ const { parseGatewayInference } = require("./lib/inference-config"); const policies = require("./lib/policies"); const { probeProviderHealth } = require("./lib/inference-health"); const { buildStatusCommandDeps } = require("./lib/status-command-deps"); -const { help, version } = require("./lib/root-help-action"); +const { help, version } = require("./lib/actions/root-help"); const onboardSession = require("./lib/onboard-session"); import type { Session } from "./lib/onboard-session"; const { stripAnsi } = require("./lib/adapters/openshell/client"); diff --git a/test/credentials-cli-command.test.ts b/test/credentials-cli-command.test.ts index 35da4ec77e1..032288f58c6 100644 --- a/test/credentials-cli-command.test.ts +++ b/test/credentials-cli-command.test.ts @@ -13,7 +13,7 @@ const COMMAND_PATHS = { list: path.join(REPO_ROOT, "dist", "lib", "commands", "credentials", "list.js"), reset: path.join(REPO_ROOT, "dist", "lib", "commands", "credentials", "reset.js"), }; -const GLOBAL_ACTIONS_PATH = path.join(REPO_ROOT, "dist", "lib", "global-cli-actions.js"); +const GLOBAL_ACTIONS_PATH = path.join(REPO_ROOT, "dist", "lib", "actions", "global.js"); type CredentialsCommandClasses = { CredentialsCommand: typeof import("../dist/lib/commands/credentials.js").default; CredentialsListCommand: typeof import("../dist/lib/commands/credentials/list.js").default; diff --git a/test/image-cleanup.test.ts b/test/image-cleanup.test.ts index 3830ac8ef99..1b0892c4bc7 100644 --- a/test/image-cleanup.test.ts +++ b/test/image-cleanup.test.ts @@ -14,7 +14,7 @@ import { } from "../src/lib/actions/sandbox/destroy"; import { getSandboxDeleteOutcome } from "../src/lib/domain/sandbox/destroy"; import { normalizeGarbageCollectImagesOptions } from "../src/lib/domain/lifecycle/options"; -import { help as renderRootHelp } from "../src/lib/root-help-action"; +import { help as renderRootHelp } from "../src/lib/actions/root-help"; const ROOT = path.resolve(import.meta.dirname, "..");