Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
116111c
refactor(cli): harden oclif bridge
cv Apr 30, 2026
5e997cb
test(cli): relax uninstall helper timeouts
cv Apr 30, 2026
88cd958
refactor(cli): migrate status and tunnel commands to oclif
cv Apr 30, 2026
3f748d6
refactor(cli): migrate debug uninstall and gateway-token to oclif
cv Apr 30, 2026
0bc877a
refactor(cli): migrate credentials commands to oclif
cv Apr 30, 2026
3fd15fc
refactor(cli): migrate sandbox inspection commands to oclif
cv Apr 30, 2026
81c62bb
refactor(cli): migrate maintenance commands to oclif
cv Apr 30, 2026
7d6a6fb
refactor(cli): migrate sandbox logs command to oclif
cv May 1, 2026
3f17a4f
refactor(cli): migrate skill install command to oclif
cv May 1, 2026
0fb3c41
refactor(cli): migrate snapshot list and create to oclif
cv May 1, 2026
d11eeee
refactor(cli): migrate shields commands to oclif
cv May 1, 2026
74806ce
refactor(cli): migrate channels mutation commands to oclif
cv May 1, 2026
e637e84
refactor(cli): migrate policy mutation commands to oclif
cv May 1, 2026
ee20dfb
refactor(cli): migrate snapshot restore command to oclif
cv May 1, 2026
8d3a568
refactor(cli): migrate destroy command to oclif
cv May 1, 2026
b447f36
refactor(cli): migrate rebuild command to oclif
cv May 1, 2026
02431db
refactor(cli): migrate connect command to oclif
cv May 1, 2026
37ce2ff
refactor(cli): migrate deploy command to oclif
cv May 1, 2026
d3e218e
refactor(cli): migrate onboard aliases to oclif
cv May 1, 2026
df05a3e
refactor(cli): migrate help and version commands to oclif
cv May 1, 2026
cd00997
merge(main): resolve help version oclif conflicts
cv May 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/command-registry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

/* v8 ignore start -- command metadata is covered by registry unit tests. */

/**
* Typed command registry — single source of truth for all CLI commands.
*
Expand Down
39 changes: 39 additions & 0 deletions src/lib/help-version-cli-commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

/* v8 ignore start -- thin oclif adapters covered through CLI integration tests. */

import { Command } from "@oclif/core";

type RuntimeBridge = {
help: () => void;
version: () => void;
};

function getRuntimeBridge(): RuntimeBridge {
return require("../nemoclaw") as RuntimeBridge;
}

export class RootHelpCommand extends Command {
static id = "root:help";
static hidden = true;
static strict = false;
static summary = "Show help";

public async run(): Promise<void> {
this.parsed = true;
getRuntimeBridge().help();
}
}

export class VersionCommand extends Command {
static id = "root:version";
static hidden = true;
static strict = true;
static summary = "Show version";

public async run(): Promise<void> {
this.parsed = true;
getRuntimeBridge().version();
}
}
3 changes: 3 additions & 0 deletions src/lib/oclif-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ConnectCliCommand from "./connect-cli-command";
import DebugCliCommand from "./debug-cli-command";
import DeployCliCommand from "./deploy-cli-command";
import DestroyCliCommand from "./destroy-cli-command";
import { RootHelpCommand, VersionCommand } from "./help-version-cli-commands";
import GatewayTokenCliCommand from "./gateway-token-cli-command";
import ListCommand from "./list-command";
import {
Expand Down Expand Up @@ -67,6 +68,8 @@ export default {
deploy: DeployCliCommand,
list: ListCommand,
onboard: OnboardCliCommand,
"root:help": RootHelpCommand,
"root:version": VersionCommand,
"sandbox:channels:add": ChannelsAddCommand,
"sandbox:channels:list": SandboxChannelsListCommand,
"sandbox:channels:remove": ChannelsRemoveCommand,
Expand Down
13 changes: 9 additions & 4 deletions src/nemoclaw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ exports.captureOpenshell = captureOpenshell;
exports.backupAll = backupAll;
exports.deploy = deploy;
exports.garbageCollectImages = garbageCollectImages;
exports.help = help;
exports.onboard = onboard;
exports.recoverNamedGatewayRuntime = recoverNamedGatewayRuntime;
exports.recoverRegistryEntries = recoverRegistryEntries;
Expand All @@ -673,6 +674,7 @@ exports.ensureLiveSandboxOrExit = ensureLiveSandboxOrExit;
exports.G = G;
exports.R = R;
exports.upgradeSandboxes = upgradeSandboxes;
exports.version = version;

function hasNamedGateway(output = ""): boolean {
return stripAnsi(output).includes("Gateway: nemoclaw");
Expand Down Expand Up @@ -4640,6 +4642,10 @@ async function garbageCollectImages(args: string[] = []): Promise<void> {

// ── Help ─────────────────────────────────────────────────────────

function version(): void {
console.log(`${CLI_NAME} v${getVersion()}`);
}

/** Print CLI usage with all commands, flags, and reconfiguration guidance. */
function help() {
const PAD = 38; // column width for usage strings before description
Expand Down Expand Up @@ -4767,7 +4773,7 @@ const [cmd, ...args] = process.argv.slice(2);
const mainPromise = (async () => {
// No command → help
if (!cmd || cmd === "help" || cmd === "--help" || cmd === "-h") {
help();
await runOclif("root:help", []);
return;
}

Expand Down Expand Up @@ -4826,10 +4832,9 @@ const mainPromise = (async () => {
await runOclif("gc", args);
break;
case "--version":
case "-v": {
console.log(`${CLI_NAME} v${getVersion()}`);
case "-v":
await runOclif("root:version", []);
break;
}
default:
help();
break;
Expand Down
Loading