From 89e61c6e65b80906c67b73dbdab3c9bda9e52d25 Mon Sep 17 00:00:00 2001 From: Alex Alecu Date: Wed, 8 Apr 2026 11:38:15 +0300 Subject: [PATCH] fix(cli): disable built-in help command to allow kilo help --all to work The .help('help', ...) method registers yargs' built-in help command which shadows the custom HelpCommand registered on the same 'help' path. This means 'kilo help --all' never reaches the custom handler. Fix by: - Replacing .help('help', ...) with .help(false) + .option('help', ...) to disable the built-in command while keeping --help/-h flags - Adding early-exit handlers in middleware for --help and --version to skip expensive initialization (telemetry, DB migration) --- packages/opencode/src/index.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/index.ts b/packages/opencode/src/index.ts index e8651453c5e..a27a7b51472 100644 --- a/packages/opencode/src/index.ts +++ b/packages/opencode/src/index.ts @@ -78,8 +78,8 @@ let cli = yargs(hideBin(process.argv)) .parserConfiguration({ "populate--": true }) .scriptName("kilo") // kilocode_change .wrap(100) - .help("help", "show help") - .alias("help", "h") + .help(false) + .option("help", { describe: "show help", type: "boolean", alias: "h" }) .version("version", "show version number", Installation.VERSION) .alias("version", "v") .option("print-logs", { @@ -92,6 +92,15 @@ let cli = yargs(hideBin(process.argv)) choices: ["DEBUG", "INFO", "WARN", "ERROR"], }) .middleware(async (opts) => { + if (opts.help) { + cli.showHelp() + process.exit(0) + } + if (opts.version) { + process.stdout.write(Installation.VERSION + "\n") + process.exit(0) + } + await Log.init({ print: process.argv.includes("--print-logs"), dev: Installation.isLocal(),