Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 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
a5ea73b
merge(main): reconcile oclif flag relationships
cv May 5, 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
25 changes: 25 additions & 0 deletions src/lib/onboard-cli-commands.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { describe, expect, it, vi } from "vitest";

import { OnboardCliCommand } from "./onboard-cli-commands";
import { runOnboardAction } from "./global-cli-actions";

vi.mock("./global-cli-actions", () => ({
runOnboardAction: vi.fn().mockResolvedValue(undefined),
runSetupAction: vi.fn().mockResolvedValue(undefined),
runSetupSparkAction: vi.fn().mockResolvedValue(undefined),
}));

const rootDir = process.cwd();

describe("onboard oclif command", () => {
it("rejects mutually exclusive resume and fresh flags before dispatch", async () => {
await expect(OnboardCliCommand.run(["--resume", "--fresh"], rootDir)).rejects.toThrow(
/resume|fresh/,
);

expect(runOnboardAction).not.toHaveBeenCalled();
});
});
10 changes: 8 additions & 2 deletions src/lib/onboard-cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ function buildOnboardFlags(): Record<string, any> {
return {
help: Flags.help({ char: "h" }),
"non-interactive": Flags.boolean({ description: "Run without interactive prompts" }),
resume: Flags.boolean({ description: "Resume an interrupted onboarding session" }),
fresh: Flags.boolean({ description: "Ignore any saved onboarding session" }),
resume: Flags.boolean({
description: "Resume an interrupted onboarding session",
exclusive: ["fresh"],
}),
fresh: Flags.boolean({
description: "Ignore any saved onboarding session",
exclusive: ["resume"],
}),
"recreate-sandbox": Flags.boolean({ description: "Delete and recreate an existing sandbox" }),
from: Flags.string({ description: "Path to a Dockerfile to use as the sandbox image source" }),
name: Flags.string({ description: "Sandbox name" }),
Expand Down
14 changes: 14 additions & 0 deletions src/lib/policy-mutate-cli-commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,18 @@ describe("policy mutation oclif commands", () => {

expect(runtime.sandboxPolicyAdd).not.toHaveBeenCalled();
});

it("rejects mutually exclusive custom policy sources before dispatch", async () => {
const runtime = {
sandboxPolicyAdd: vi.fn().mockResolvedValue(undefined),
sandboxPolicyRemove: vi.fn().mockResolvedValue(undefined),
};
setPolicyRuntimeBridgeFactoryForTest(() => runtime);

await expect(
PolicyAddCommand.run(["alpha", "--from-file", "preset.yaml", "--from-dir", "presets"], rootDir),
).rejects.toThrow(/from-file|from-dir/);

expect(runtime.sandboxPolicyAdd).not.toHaveBeenCalled();
});
});
10 changes: 8 additions & 2 deletions src/lib/policy-mutate-cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,14 @@ export class PolicyAddCommand extends Command {
yes: Flags.boolean({ char: "y", description: "Skip the confirmation prompt" }),
force: Flags.boolean({ description: "Skip the confirmation prompt" }),
"dry-run": Flags.boolean({ description: "Preview without applying" }),
"from-file": Flags.string({ description: "Load one custom preset YAML file" }),
"from-dir": Flags.string({ description: "Load all custom preset YAML files in a directory" }),
"from-file": Flags.string({
description: "Load one custom preset YAML file",
exclusive: ["from-dir"],
}),
"from-dir": Flags.string({
description: "Load all custom preset YAML files in a directory",
exclusive: ["from-file"],
}),
};

public async run(): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion test/policies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ Promise.resolve(require(${CLI_PATH}).mainPromise).finally(() => {
it("errors when --from-file and --from-dir are combined", () => {
const result = runPolicyAddExternal(["--from-file", "a.yaml", "--from-dir", "b"]);
expect(result.status).not.toBe(0);
expect(result.stderr).toMatch(/mutually exclusive/);
expect(result.stderr).toMatch(/cannot also be provided/);
});

it("errors when --from-file is missing its path argument", () => {
Expand Down
Loading