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)
This commit is contained in:
Alex Alecu
2026-04-08 11:38:15 +03:00
parent 37c63e0f8d
commit 89e61c6e65
+11 -2
View File
@@ -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(),