From ce4b11b0d3c44a85ff616636597f9330b43dab65 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Mon, 25 May 2026 11:00:37 +0900 Subject: [PATCH] fix(cli): add explicit helpOption configuration for consistent help-flag ordering Add explicit .helpOption('-h, --help') call to the Commander program configuration so the help option is explicitly defined rather than relying on Commander.js lazy initialization. Add corresponding test to pin the behavior. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/cli/cli-program.test.ts | 17 +++++++++++++++++ src/cli/cli-program.ts | 1 + 2 files changed, 18 insertions(+) diff --git a/src/cli/cli-program.test.ts b/src/cli/cli-program.test.ts index c7c493830..58612e54c 100644 --- a/src/cli/cli-program.test.ts +++ b/src/cli/cli-program.test.ts @@ -20,3 +20,20 @@ describe("cli-program", () => { expect(installBlock?.[1]).toContain('.alias("setup")') }) }) + +test("program configures explicit '-h, --help' help option for consistent help-flag ordering", async () => { + // given + const cliProgramSource = await readFile( + path.resolve(import.meta.dir, "cli-program.ts"), + "utf-8", + ) + + // when + const programBlock = cliProgramSource.match( + /program\s*\n((?:\s*\.\w+\([^)]*\)\s*\n?)*)/, + ) + + // then + expect(programBlock).not.toBeNull() + expect(programBlock?.[1]).toContain('.helpOption("-h, --help", "Display help for command")') +}) diff --git a/src/cli/cli-program.ts b/src/cli/cli-program.ts index dc3a0d4d2..96519bd48 100644 --- a/src/cli/cli-program.ts +++ b/src/cli/cli-program.ts @@ -20,6 +20,7 @@ program .name("oh-my-opencode") .description("The ultimate OpenCode plugin - multi-model orchestration, LSP tools, and more") .version(VERSION, "-v, --version", "Show version number") + .helpOption("-h, --help", "Display help for command") .enablePositionalOptions() program