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 <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-05-25 11:00:37 +09:00
parent 222adeb606
commit ce4b11b0d3
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -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")')
})