fix: harden update channel switching

This commit is contained in:
Peter Steinberger
2026-03-22 15:01:12 -07:00
parent 601f560682
commit e06b8d3e62
8 changed files with 305 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
import { Command } from "commander";
import fs from "node:fs/promises";
import path from "node:path";
import { beforeEach, describe, expect, it, vi } from "vitest";
@@ -449,6 +450,24 @@ describe("update-cli", () => {
}
});
it("parses update status --json as the subcommand option", async () => {
const program = new Command();
program.name("openclaw");
program.enablePositionalOptions();
let seenJson = false;
const update = program.command("update").option("--json", "", false);
update
.command("status")
.option("--json", "", false)
.action((opts) => {
seenJson = Boolean(opts.json);
});
await program.parseAsync(["node", "openclaw", "update", "status", "--json"]);
expect(seenJson).toBe(true);
});
it.each([
{
name: "defaults to dev channel for git installs when unset",