fix(cli): Add error handling to prevent silent failures#5687
fix(cli): Add error handling to prevent silent failures#5687Ashwinhegde19 wants to merge 1 commit intoKilo-Org:mainfrom
Conversation
Add uncaughtException and unhandledRejection handlers to ensure errors are displayed instead of exiting silently. Wrap subcommands and program parsing in try-catch blocks. Fixes Kilo-Org#5683
🦋 Changeset detectedLatest commit: e532ff7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @Ashwinhegde19 - thank you for taking the time to contribute to this project—we really appreciate it. We've recently re-platformed the Kilo CLI with a complete rebuild based on OpenCode as our new foundation, which means this PR unfortunately won't be compatible with the new architecture. You can read more about why we made this change here: https://blog.kilo.ai/p/kilo-cli If you think this feature or fix is still relevant, we'd love for you to check out the new CLI and consider contributing there: https://github.com/Kilo-Org/kilo I sent you a DM on Discord Thanks again for your support! |
Fixes #5683
Problem
The CLI was exiting silently without any output when errors occurred during startup. This happened because there were no error handlers for uncaught exceptions or unhandled promise rejections.
Solution
Added comprehensive error handling:
Global error handlers:
uncaughtException- catches synchronous errorsunhandledRejection- catches async promise rejectionsProgram parsing:
program.parse()toprogram.parseAsync().catch()to catch Commander.js errorsSubcommand wrappers:
Testing Completed ✅
Manual CLI Testing:
--helpdisplays correctly: Shows full help output--versionworks: Returns0.26.1error: unknown option '--invalid-flag'Unit Tests:
Checklist