diff --git a/src/lib/deploy-action.ts b/src/lib/deploy-action.ts new file mode 100644 index 00000000000..e987c073c43 --- /dev/null +++ b/src/lib/deploy-action.ts @@ -0,0 +1,31 @@ +// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +import { execFileSync, spawnSync } from "node:child_process"; + +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({ + instanceName, + env: process.env, + rootDir: ROOT, + getCredential, + validateName, + shellQuote, + run, + runInteractive, + execFileSync: ( + file: string, + args: string[], + opts: Omit = {}, + ) => String(execFileSync(file, args, { encoding: "utf-8", ...opts })), + spawnSync, + log: console.log, + error: console.error, + stdoutWrite: (message: string) => process.stdout.write(message), + exit: (code: number) => process.exit(code), + }); +} diff --git a/src/lib/global-cli-actions.ts b/src/lib/global-cli-actions.ts index 13ac4c7f23d..09571b0f69e 100644 --- a/src/lib/global-cli-actions.ts +++ b/src/lib/global-cli-actions.ts @@ -3,6 +3,7 @@ /* v8 ignore start -- transitional action facade until implementations leave src/nemoclaw.ts. */ +import { runDeployAction as executeDeployAction } from "./deploy-action"; import { getNemoClawRuntimeBridge } from "./nemoclaw-runtime-bridge"; import { help, version } from "./root-help-action"; @@ -19,7 +20,7 @@ export async function runSetupSparkAction(args: string[] = []): Promise { } export async function runDeployAction(instanceName?: string): Promise { - await getNemoClawRuntimeBridge().deploy(instanceName); + await executeDeployAction(instanceName); } export function runBackupAllAction(): void { diff --git a/src/lib/nemoclaw-runtime-bridge.ts b/src/lib/nemoclaw-runtime-bridge.ts index a1bc200d98e..22a04a22c5a 100644 --- a/src/lib/nemoclaw-runtime-bridge.ts +++ b/src/lib/nemoclaw-runtime-bridge.ts @@ -25,7 +25,6 @@ export interface NemoClawRuntimeBridge { opts?: { ignoreError?: boolean; timeout?: number }, ) => { status: number | null; output: string }; backupAll: () => void; - deploy: (instanceName?: string) => Promise; garbageCollectImages: (args?: string[]) => Promise; onboard: (args?: string[]) => Promise; recoverNamedGatewayRuntime: () => Promise; diff --git a/src/nemoclaw.ts b/src/nemoclaw.ts index 5c96eedfbde..64b5a7d895d 100644 --- a/src/nemoclaw.ts +++ b/src/nemoclaw.ts @@ -68,7 +68,6 @@ const { versionGte, } = require("./lib/openshell"); const { runRegisteredOclifCommand } = require("./lib/oclif-runner"); -const { executeDeploy } = require("./lib/deploy"); const { isErrnoException }: typeof import("./lib/errno") = require("./lib/errno"); const agentRuntime = require("../bin/lib/agent-runtime"); const sandboxVersion = require("./lib/sandbox-version"); @@ -701,7 +700,6 @@ async function recoverRegistryEntries({ exports.runtimeBridge = { captureOpenshell, backupAll, - deploy, garbageCollectImages, onboard, recoverNamedGatewayRuntime, @@ -1308,32 +1306,6 @@ async function setupSpark(args: string[] = []): Promise { }); } -async function deploy(instanceName: string): Promise { - await executeDeploy({ - instanceName, - env: process.env, - rootDir: ROOT, - getCredential, - validateName, - shellQuote, - run, - runInteractive, - execFileSync: ( - file: string, - args: string[], - opts: Omit< - import("node:child_process").ExecFileSyncOptionsWithStringEncoding, - "encoding" - > = {}, - ) => String(execFileSync(file, args, { encoding: "utf-8", ...opts })), - spawnSync, - log: console.log, - error: console.error, - stdoutWrite: (message: string) => process.stdout.write(message), - exit: (code: number) => process.exit(code), - }); -} - async function runOclif(commandId: string, args: string[] = []): Promise { await runRegisteredOclifCommand(commandId, args, { rootDir: ROOT,