From 554a6aabd17ad6f27b20df7f717685efd11979d9 Mon Sep 17 00:00:00 2001 From: MoerAI Date: Tue, 19 May 2026 10:25:15 +0900 Subject: [PATCH] fix(cli): add 'setup' as an alias for the install command (fixes #4112) Discord support and other guidance still tell users 'bunx oh-my-opencode setup', but the CLI only registers 'install'. Running the recommended command produces: error: unknown command 'setup' which dead-ends users who are trying to refresh missing skills (hyperplan, etc.) after upgrading. Commander.js supports first-class aliases, so declaring '.alias("setup")' on the install command makes both names route to the same action without any code duplication. Help output now reads 'Usage: oh-my-opencode install|setup [options]', which is the right discovery hint for both newcomers and users following older docs. Regression test parses cli-program.ts and asserts the install command block contains '.alias("setup")' before its '.action(' so a future refactor of the CLI cannot silently drop the alias. --- src/cli/cli-program.test.ts | 22 ++++++++++++++++++++++ src/cli/cli-program.ts | 1 + 2 files changed, 23 insertions(+) create mode 100644 src/cli/cli-program.test.ts diff --git a/src/cli/cli-program.test.ts b/src/cli/cli-program.test.ts new file mode 100644 index 000000000..c7c493830 --- /dev/null +++ b/src/cli/cli-program.test.ts @@ -0,0 +1,22 @@ +import { describe, test, expect } from "bun:test" +import { readFile } from "node:fs/promises" +import path from "node:path" + +describe("cli-program", () => { + test("install command exposes 'setup' as an alias so the historical install path keeps working", async () => { + // given + const cliProgramSource = await readFile( + path.resolve(import.meta.dir, "cli-program.ts"), + "utf-8", + ) + + // when + const installBlock = cliProgramSource.match( + /program\s*\n\s*\.command\("install"\)([\s\S]*?)\.action\(/, + ) + + // then + expect(installBlock).not.toBeNull() + expect(installBlock?.[1]).toContain('.alias("setup")') + }) +}) diff --git a/src/cli/cli-program.ts b/src/cli/cli-program.ts index ff1b63345..dc3a0d4d2 100644 --- a/src/cli/cli-program.ts +++ b/src/cli/cli-program.ts @@ -24,6 +24,7 @@ program program .command("install") + .alias("setup") .description("Install and configure oh-my-opencode with interactive setup") .option("--no-tui", "Run in non-interactive mode (requires all options)") .option("--claude ", "Claude subscription: no, yes, max20")