fix(cli): honor dashboard no-open and expand maintenance coverage
This commit is contained in:
@@ -73,4 +73,92 @@ describe("registerMaintenanceCommands doctor action", () => {
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
expect(runtime.exit).not.toHaveBeenCalledWith(0);
|
||||
});
|
||||
|
||||
it("maps --fix to repair=true", async () => {
|
||||
doctorCommand.mockResolvedValue(undefined);
|
||||
|
||||
await runMaintenanceCli(["doctor", "--fix"]);
|
||||
|
||||
expect(doctorCommand).toHaveBeenCalledWith(
|
||||
runtime,
|
||||
expect.objectContaining({
|
||||
repair: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("passes noOpen to dashboard command", async () => {
|
||||
dashboardCommand.mockResolvedValue(undefined);
|
||||
|
||||
await runMaintenanceCli(["dashboard", "--no-open"]);
|
||||
|
||||
expect(dashboardCommand).toHaveBeenCalledWith(
|
||||
runtime,
|
||||
expect.objectContaining({
|
||||
noOpen: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("passes reset options to reset command", async () => {
|
||||
resetCommand.mockResolvedValue(undefined);
|
||||
|
||||
await runMaintenanceCli([
|
||||
"reset",
|
||||
"--scope",
|
||||
"full",
|
||||
"--yes",
|
||||
"--non-interactive",
|
||||
"--dry-run",
|
||||
]);
|
||||
|
||||
expect(resetCommand).toHaveBeenCalledWith(
|
||||
runtime,
|
||||
expect.objectContaining({
|
||||
scope: "full",
|
||||
yes: true,
|
||||
nonInteractive: true,
|
||||
dryRun: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("passes uninstall options to uninstall command", async () => {
|
||||
uninstallCommand.mockResolvedValue(undefined);
|
||||
|
||||
await runMaintenanceCli([
|
||||
"uninstall",
|
||||
"--service",
|
||||
"--state",
|
||||
"--workspace",
|
||||
"--app",
|
||||
"--all",
|
||||
"--yes",
|
||||
"--non-interactive",
|
||||
"--dry-run",
|
||||
]);
|
||||
|
||||
expect(uninstallCommand).toHaveBeenCalledWith(
|
||||
runtime,
|
||||
expect.objectContaining({
|
||||
service: true,
|
||||
state: true,
|
||||
workspace: true,
|
||||
app: true,
|
||||
all: true,
|
||||
yes: true,
|
||||
nonInteractive: true,
|
||||
dryRun: true,
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("exits with code 1 when dashboard fails", async () => {
|
||||
dashboardCommand.mockRejectedValue(new Error("dashboard failed"));
|
||||
|
||||
await runMaintenanceCli(["dashboard"]);
|
||||
|
||||
expect(runtime.error).toHaveBeenCalledWith("Error: dashboard failed");
|
||||
expect(runtime.exit).toHaveBeenCalledWith(1);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,11 +48,11 @@ export function registerMaintenanceCommands(program: Command) {
|
||||
() =>
|
||||
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/dashboard", "docs.openclaw.ai/cli/dashboard")}\n`,
|
||||
)
|
||||
.option("--no-open", "Print URL but do not launch a browser", false)
|
||||
.option("--no-open", "Print URL but do not launch a browser")
|
||||
.action(async (opts) => {
|
||||
await runCommandWithRuntime(defaultRuntime, async () => {
|
||||
await dashboardCommand(defaultRuntime, {
|
||||
noOpen: Boolean(opts.noOpen),
|
||||
noOpen: opts.open === false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user