Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
4b7a4a2
refactor(cli): extract sandbox live state helpers
cv May 2, 2026
2ce87dd
refactor(cli): extract sandbox skill install action
cv May 2, 2026
4cd3cf3
refactor(cli): extract sandbox connect action
cv May 3, 2026
e9dd46e
refactor(cli): extract sandbox status action
cv May 3, 2026
aab6c86
refactor(cli): extract sandbox doctor action
cv May 3, 2026
8908521
refactor(cli): extract sandbox destroy action
cv May 3, 2026
56e4f05
refactor(cli): extract sandbox rebuild action
cv May 3, 2026
8bf1958
refactor(cli): extract upgrade sandboxes action
cv May 3, 2026
38eb84d
refactor(cli): remove runtime bridge
cv May 3, 2026
b2ad5da
refactor(cli): remove legacy dispatch fallbacks
cv May 3, 2026
edd2650
refactor(cli): expose explicit main entrypoint
cv May 3, 2026
a15da95
refactor(cli): add oclif examples for utility commands
cv May 3, 2026
4f57ebb
refactor(cli): validate logs flags with oclif
cv May 3, 2026
8b2d077
refactor(cli): improve sandbox diagnostic command metadata
cv May 3, 2026
a09cc51
refactor(cli): tighten policy and channel parser validation
cv May 3, 2026
75857dc
refactor(cli): improve snapshot command metadata
cv May 3, 2026
11c0676
refactor(cli): require skill install path in oclif
cv May 3, 2026
05f9eca
refactor(cli): add lifecycle confirmation flag aliases
cv May 3, 2026
4ebeae4
refactor(cli): split share into oclif subcommands
cv May 3, 2026
7d72437
Revert "refactor(cli): split share into oclif subcommands"
cv May 3, 2026
0ee5ca5
refactor(cli): split share into oclif subcommands
cv May 3, 2026
928219c
refactor(cli): model debug flags with oclif
cv May 3, 2026
36cce5e
refactor(cli): model onboard flags with oclif
cv May 3, 2026
702afb1
docs: sync oclif UX command reference
cv May 3, 2026
3224350
refactor(cli): extract public argv normalizer
cv May 3, 2026
cd4cdb8
refactor(cli): rename oclif dispatch module
cv May 3, 2026
9499ca6
refactor(cli): normalize policy command ids
cv May 3, 2026
42028ef
test(cli): require oclif command metadata
cv May 3, 2026
a05c6b3
refactor(cli): return typed debug parse results
cv May 3, 2026
1875fe9
refactor(cli): add public command display ids
cv May 3, 2026
36f1dbe
refactor(cli): use oclif summaries in root help
cv May 3, 2026
78bfd5a
refactor(cli): table-drive sandbox dispatch
cv May 3, 2026
96ce61f
refactor(cli): normalize gateway token command id
cv May 3, 2026
266ebc9
refactor(cli): render public oclif help
cv May 3, 2026
dc98994
refactor(cli): add shared oclif command base
cv May 3, 2026
d0d2a70
refactor(cli): use oclif flag relationships
cv May 3, 2026
8396c06
refactor(cli): pass lifecycle typed options
cv May 3, 2026
1532b19
refactor(cli): parse durations with oclif flags
cv May 3, 2026
7c0445a
refactor(cli): project public help through oclif
cv May 3, 2026
3978c32
test(cli): cover oclif metadata routing helpers
cv May 3, 2026
591eabb
test(cli): cover global oclif command adapters
cv May 3, 2026
8a6ecbc
test(cli): cover sandbox oclif command adapters
cv May 3, 2026
e5aa22f
refactor(cli): split share oclif commands
cv May 3, 2026
e179336
test(cli): narrow sandbox logs coverage ignores
cv May 3, 2026
a629813
test(cli): cover remaining global oclif adapters
cv May 3, 2026
c5954e7
test(cli): cover credentials oclif adapter
cv May 3, 2026
3380de9
test(cli): cover runtime utility helpers
cv May 3, 2026
f60a190
test(cli): improve global adapter coverage
cv May 3, 2026
78a16d1
merge: sync simple global adapter coverage
cv May 3, 2026
a58dc90
merge: sync credentials adapter coverage
cv May 3, 2026
034454f
merge: include credentials adapter coverage
cv May 3, 2026
28bc497
merge: sync combined global adapter coverage
cv May 3, 2026
e9ed6ba
test(cli): cover global action facade
cv May 3, 2026
00b288c
merge: sync global action facade coverage
cv May 3, 2026
7bd5f32
test(cli): stabilize coverage dist sourcemaps
cv May 4, 2026
d4b55d9
test(cli): rebaseline clean-dist function coverage
cv May 4, 2026
b872474
refactor(cli): extract maintenance image helpers
cv May 4, 2026
4965762
refactor(cli): extract upgrade sandbox helpers
cv May 4, 2026
9acd660
refactor(cli): extract sandbox destroy helpers
cv May 4, 2026
cc0eaa1
refactor(cli): extract sandbox logs helpers
cv May 4, 2026
847e115
refactor(cli): extract policy channel helpers
cv May 4, 2026
b6c0f5a
test(cli): allow clean coverage variance
cv May 4, 2026
5c98bd1
merge: sync coverage stabilization
cv May 4, 2026
4754f3e
merge: sync maintenance helper extraction
cv May 4, 2026
96f0758
merge: sync upgrade helper extraction
cv May 4, 2026
b6bd105
merge: sync destroy helper extraction
cv May 4, 2026
98fb75d
merge: sync logs helper extraction
cv May 4, 2026
5920d5b
test(cli): keep destroy helpers outside coverage ratchet
cv May 4, 2026
64d1646
merge: sync destroy helper coverage boundary
cv May 4, 2026
717c482
test(cli): keep logs helpers outside coverage ratchet
cv May 4, 2026
688074f
merge: sync logs helper coverage boundary
cv May 4, 2026
1314270
test(cli): keep policy channel helpers outside coverage ratchet
cv May 4, 2026
79d81c2
refactor(cli): group oclif core modules
cv May 4, 2026
5453a89
refactor(cli): split oclif commands by command tree
cv May 4, 2026
bbc297f
test(cli): reset credential command helper cache
cv May 4, 2026
25224c1
test(cli): avoid generic warning assertion in debug output
cv May 4, 2026
231f912
merge(main): reconcile oclif command tree split
cv May 6, 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: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"bin": "nemoclaw",
"commands": {
"strategy": "explicit",
"target": "./dist/lib/oclif-commands.js"
"target": "./dist/lib/commands/index.js"
}
},
"scripts": {
Expand Down
119 changes: 0 additions & 119 deletions src/lib/channels-mutate-cli-commands.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/lib/cli/oclif-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export type OclifCommandMetadata = {

function loadOclifCommands(): Record<string, OclifCommandMetadata> | null {
for (const modulePath of [
"../oclif-commands",
"../oclif-commands.js",
"../../../dist/lib/oclif-commands.js",
"../commands",
"../commands/index.js",
"../../../dist/lib/commands/index.js",
]) {
try {
const registry = require(modulePath) as {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/command-display-metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { describe, expect, it } from "vitest";

import { COMMANDS, visibleCommands } from "./command-registry";
import commands from "../../dist/lib/oclif-commands.js";
import commands from "../../dist/lib/commands/index.js";

describe("public command display metadata", () => {
it("maps every command display entry to a registered oclif command", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ const mocks = vi.hoisted(() => ({
runOpenshellProviderCommand: vi.fn(),
}));

vi.mock("./credentials", () => ({ prompt: mocks.prompt }));
vi.mock("./global-cli-actions", () => ({
vi.mock("../credentials", () => ({ prompt: mocks.prompt }));
vi.mock("../global-cli-actions", () => ({
recoverNamedGatewayRuntime: mocks.recoverNamedGatewayRuntime,
runOpenshellProviderCommand: mocks.runOpenshellProviderCommand,
}));

import {
CredentialsCommand,
CredentialsListCommand,
CredentialsResetCommand,
} from "./credentials-cli-command";
import CredentialsCommand from "./credentials";
import CredentialsListCommand from "./credentials/list";
import CredentialsResetCommand from "./credentials/reset";

const rootDir = process.cwd();

Expand Down
27 changes: 27 additions & 0 deletions src/lib/commands/credentials.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

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

import { printCredentialsUsage } from "./credentials/common";

export default class CredentialsCommand extends Command {
static id = "credentials";
static strict = true;
static summary = "Manage provider credentials";
static description =
"List or reset provider credentials registered with the OpenShell gateway.";
static usage = ["credentials <list|reset>"];
static examples = [
"<%= config.bin %> credentials list",
"<%= config.bin %> credentials reset nvidia-prod --yes",
];
static flags = {
help: Flags.help({ char: "h" }),
};

public async run(): Promise<void> {
await this.parse(CredentialsCommand);
printCredentialsUsage(this.log.bind(this));
}
}
44 changes: 44 additions & 0 deletions src/lib/commands/credentials/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { CLI_DISPLAY_NAME, CLI_NAME } from "../../branding";
import { recoverNamedGatewayRuntime } from "../../global-cli-actions";

// Suffixes that mark per-sandbox messaging integrations in the gateway's
// provider list. These are managed by `channels`, not `credentials`.
const BRIDGE_PROVIDER_SUFFIXES: readonly string[] = [
"-telegram-bridge",
"-discord-bridge",
"-slack-bridge",
"-slack-app",
];

export function isBridgeProviderName(name: string): boolean {
return BRIDGE_PROVIDER_SUFFIXES.some((suffix) => name.endsWith(suffix));
}

export function printCredentialsUsage(log: (message?: string) => void = console.log): void {
log("");
log(` Usage: ${CLI_NAME} credentials <subcommand>`);
log("");
log(" Subcommands:");
log(" list List provider credentials registered with the OpenShell gateway");
log(" reset <PROVIDER> [--yes] Remove a provider credential so onboard re-prompts");
log("");
log(" Credentials live in the OpenShell gateway. Inspect with `openshell provider list`.");
log(" Nothing is persisted to host disk; deploy/non-onboard commands read from env vars.");
log("");
}

export async function recoverGatewayOrExit(kind: "query" | "reach"): Promise<void> {
const recovery = await recoverNamedGatewayRuntime();
if (recovery.recovered) return;

if (kind === "query") {
console.error(` Could not query the ${CLI_DISPLAY_NAME} OpenShell gateway. Is it running?`);
} else {
console.error(` Could not reach the ${CLI_DISPLAY_NAME} OpenShell gateway. Is it running?`);
}
console.error(` Run 'openshell gateway start --name nemoclaw' or '${CLI_NAME} onboard' first.`);
process.exit(1);
}
58 changes: 58 additions & 0 deletions src/lib/commands/credentials/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

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

import { CLI_NAME } from "../../branding";
import { runOpenshellProviderCommand } from "../../global-cli-actions";
import { OPENSHELL_OPERATION_TIMEOUT_MS } from "../../openshell-timeouts";
import { isBridgeProviderName, recoverGatewayOrExit } from "./common";

export default class CredentialsListCommand extends Command {
static id = "credentials:list";
static strict = true;
static summary = "List stored credential providers";
static description = "List provider credentials registered with the OpenShell gateway.";
static usage = ["credentials list"];
static examples = ["<%= config.bin %> credentials list"];
static flags = {
help: Flags.help({ char: "h" }),
};

public async run(): Promise<void> {
await this.parse(CredentialsListCommand);
await recoverGatewayOrExit("query");

const result = runOpenshellProviderCommand(["provider", "list", "--names"], {
ignoreError: true,
stdio: ["ignore", "pipe", "pipe"],
timeout: OPENSHELL_OPERATION_TIMEOUT_MS,
});
if (result.status !== 0) {
console.error(" Could not query OpenShell gateway. Is it running?");
console.error(` Run 'openshell gateway start --name nemoclaw' or '${CLI_NAME} onboard' first.`);
process.exit(1);
}

const allNames = String(result.stdout || "")
.split("\n")
.map((name) => name.trim())
.filter((name) => name.length > 0);
const credentialNames = allNames.filter((name) => !isBridgeProviderName(name)).sort();
const bridgeNames = allNames.filter((name) => isBridgeProviderName(name));

if (credentialNames.length === 0) {
this.log(" No provider credentials registered.");
} else {
this.log(" Providers registered with the OpenShell gateway:");
for (const name of credentialNames) {
this.log(` ${name}`);
}
}
if (bridgeNames.length > 0) {
this.log("");
this.log(` ${String(bridgeNames.length)} per-sandbox messaging bridge(s) are also registered.`);
this.log(` Manage those with \`${CLI_NAME} <sandbox> channels list/remove/stop\` — not this command.`);
}
}
}
89 changes: 89 additions & 0 deletions src/lib/commands/credentials/reset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

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 { OPENSHELL_OPERATION_TIMEOUT_MS } from "../../openshell-timeouts";
import { isBridgeProviderName, recoverGatewayOrExit } from "./common";

export default class CredentialsResetCommand extends Command {
static id = "credentials:reset";
static strict = true;
static summary = "Remove a provider credential";
static description = "Remove a provider credential so onboard re-prompts for it.";
static usage = ["credentials reset <PROVIDER> [--yes]"];
static examples = [
"<%= config.bin %> credentials reset nvidia-prod",
"<%= config.bin %> credentials reset nvidia-prod --yes",
];
static args = {
provider: Args.string({
name: "PROVIDER",
description: "OpenShell provider name",
required: false,
}),
};
static flags = {
help: Flags.help({ char: "h" }),
yes: Flags.boolean({ char: "y", description: "Skip the confirmation prompt" }),
};

public async run(): Promise<void> {
const { args, flags } = await this.parse(CredentialsResetCommand);
const key = args.provider;

if (!key || key.startsWith("-")) {
console.error(` Usage: ${CLI_NAME} credentials reset <PROVIDER> [--yes]`);
console.error(` PROVIDER is an OpenShell provider name. Run '${CLI_NAME} credentials list' first.`);
process.exit(1);
}

if (isBridgeProviderName(key)) {
console.error(` '${key}' is a per-sandbox messaging bridge, not a credential.`);
console.error(
` Use \`${CLI_NAME} <sandbox> channels remove <telegram|discord|slack>\` to retire`,
);
console.error(" the integration (it tears down the bridge provider and rebuilds the sandbox),");
console.error(` or \`${CLI_NAME} <sandbox> channels stop <…>\` to pause it without clearing tokens.`);
process.exit(1);
}

if (!flags.yes) {
const answer = (await askPrompt(` Remove provider '${key}' from the OpenShell gateway? [y/N]: `))
.trim()
.toLowerCase();
if (answer !== "y" && answer !== "yes") {
this.log(" Cancelled.");
return;
}
}

await recoverGatewayOrExit("reach");

const result = runOpenshellProviderCommand(["provider", "delete", key], {
ignoreError: true,
stdio: ["ignore", "pipe", "pipe"],
timeout: OPENSHELL_OPERATION_TIMEOUT_MS,
});
if (result.status === 0) {
this.log(` Removed provider '${key}' from the OpenShell gateway.`);
this.log(` Re-run '${CLI_NAME} onboard' to enter a new value.`);
return;
}

console.error(` Could not remove provider '${key}'.`);
if (/^[A-Z][A-Z0-9_]+$/.test(key)) {
console.error("");
console.error(` '${key}' looks like a credential env variable name.`);
console.error(" As of this release, 'credentials reset' takes an OpenShell");
console.error(` provider name. Run '${CLI_NAME} credentials list' to see the`);
console.error(" registered providers, then retry with one of those names.");
}
const stderr = String(result.stderr || "").trim();
if (stderr) console.error(` ${stderr}`);
process.exit(1);
}
}
Loading
Loading