Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
1 change: 1 addition & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
failure-threshold: error
33 changes: 33 additions & 0 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,39 @@ This variant of `nemoclaw onboard` accepts a `--from <Dockerfile>` argument to b
$ nemoclaw onboard --from ./Dockerfile.custom
```

### `nemoclaw update`

Update the NemoClaw CLI to the latest version from npm.
The command checks the installed version against the latest published version, compares them using semantic versioning, and installs an update if a newer version is available.
By default, the installer spawns a detached child process so the active CLI process does not lock itself during installation.

```console
$ nemoclaw update [--check] [--auto]
```

#### `--check`

Perform a dry-run check only.
Shows the installed version, the latest available version, and whether an update is available without installing anything.
Use this to verify update availability before upgrading in automated workflows.

```console
$ nemoclaw update --check
```

#### `--auto`

Run in non-interactive mode.
After a successful binary update, automatically trigger `nemoclaw upgrade-sandboxes --auto` to synchronize the sandboxes with the new CLI version.
Before sandbox synchronization, the command verifies Docker reachability and warns (but does not fail) if the installed OpenShell version falls below the blueprint minimum version requirement.
Credentials are preserved with their original file permissions during and after the update.

```console
$ nemoclaw update --auto
```

If you use `--check --auto`, the update verifies the upgrade path without actually installing or running sandbox synchronization.

### `nemoclaw list`

List all registered sandboxes with their model, provider, and policy presets.
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@oclif/core": "^4.10.5",
"js-yaml": "^4.1.1",
"p-retry": "^4.6.2",
"semver": "^7.7.4",
"yaml": "^2.8.3"
},
"bundleDependencies": [
Expand Down Expand Up @@ -70,6 +71,7 @@
"@commitlint/config-conventional": "^20.5.0",
"@j178/prek": "^0.3.6",
"@types/node": "^25.5.2",
"@types/semver": "^7.7.1",
"@vitest/coverage-v8": "^4.1.0",
"ajv": "^8.17.0",
"execa": "^9.6.1",
Expand Down
29 changes: 20 additions & 9 deletions src/lib/command-registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import type { CommandDef } from "./command-registry";

describe("command-registry", () => {
describe("COMMANDS array", () => {
it("should contain exactly 49 commands", () => {
// 23 global (18 visible + 5 hidden help/version aliases)
it("should contain exactly 50 commands", () => {
// 24 global (19 visible + 5 hidden help/version aliases)
// 26 sandbox (22 visible + 4 hidden shields/config)
expect(COMMANDS).toHaveLength(49);
expect(COMMANDS).toHaveLength(50);
});

it("should have no duplicate usage strings", () => {
Expand All @@ -39,9 +39,9 @@ describe("command-registry", () => {
});

describe("globalCommands()", () => {
it("should return exactly 23 entries", () => {
// 18 visible + 5 hidden (help, --help, -h, --version, -v)
expect(globalCommands()).toHaveLength(23);
it("should return exactly 24 entries", () => {
// 19 visible + 5 hidden (help, --help, -h, --version, -v)
expect(globalCommands()).toHaveLength(24);
});

it("every entry has scope global", () => {
Expand All @@ -65,10 +65,10 @@ describe("command-registry", () => {
});

describe("visibleCommands()", () => {
it("should exclude 9 hidden commands (40 visible)", () => {
it("should exclude 9 hidden commands (41 visible)", () => {
// 5 hidden global (help, --help, -h, --version, -v) +
// 4 hidden sandbox (shields×3, config get)
expect(visibleCommands()).toHaveLength(40);
expect(visibleCommands()).toHaveLength(41);
});

it("no visible command has hidden=true", () => {
Expand Down Expand Up @@ -142,10 +142,11 @@ describe("command-registry", () => {
});

describe("globalCommandTokens()", () => {
it("returns the exact set of 20 tokens matching the old GLOBAL_COMMANDS", () => {
it("returns the exact set of 21 tokens matching GLOBAL_COMMANDS", () => {
const tokens = globalCommandTokens();
const expected = new Set([
"onboard",
"update",
"list",
"deploy",
"setup",
Expand All @@ -170,6 +171,16 @@ describe("command-registry", () => {
});
});

describe("update command invariants", () => {
it("registers nemoclaw update in Getting Started with expected flags", () => {
const update = COMMANDS.find((cmd: CommandDef) => cmd.usage === "nemoclaw update");
expect(update).toBeDefined();
expect(update?.group).toBe("Getting Started");
expect(update?.scope).toBe("global");
expect(update?.flags).toBe("[--check] [--auto]");
});
});

describe("sandboxActionTokens()", () => {
it("returns exactly 17 unique action tokens including empty string", () => {
const tokens = sandboxActionTokens();
Expand Down
9 changes: 8 additions & 1 deletion src/lib/command-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const GROUP_ORDER: readonly CommandGroup[] = [
] as const;

/**
* All 46 CLI commands. This is the single source of truth.
* All 48 CLI commands. This is the single source of truth.
*
* The order within each group matches the current help() display order.
*/
Expand All @@ -88,6 +88,13 @@ export const COMMANDS: readonly CommandDef[] = [
group: "Getting Started",
scope: "global",
},
{
usage: "nemoclaw update",
description: "Update NemoClaw CLI to the latest version",
flags: "[--check] [--auto]",
group: "Getting Started",
scope: "global",
},

// ── Sandbox Management ──
{
Expand Down
4 changes: 3 additions & 1 deletion src/lib/nim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ describe("nim", () => {
const { nimModule, restore } = loadNimWithMockedRunner(runCapture);

try {
expect(nimModule.waitForNimHealth(9000, 1)).toBe(true);
// Keep probe timeout above trivial limits so startup checks model
// real containerized gateway bring-up behavior.
expect(nimModule.waitForNimHealth(9000, 10)).toBe(true);
const commands = runCapture.mock.calls.map(([c]: [string | string[]]) => c);

expect(commands.some((c) => c[0] === "curl" && hasCurlTimeoutArgs(c))).toBe(true);
Expand Down
Loading