Fix(CLI): Standardize error handling and remove deprecated auth options #1258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses inconsistent error handling in authentication commands and removes deprecated code past its removal deadline. We've encountered recurring issues where direct process.exit() calls cause CI/CD pipelines to hang, as documented in #1144 and #1149 . The fix involves consistently using the exitGracefully() utility across all auth-related commands.
The core change updates exitGracefully() to accept custom exit codes, as it previously only supported exit code 0. We replaced 5 direct process.exit() calls with exitGracefully() across auth.ts, login.ts, logout.ts, and index.ts. Additionally, we removed the deprecated --login and --logout options from the auth command, which were scheduled for removal after September 2025.
This change affects 6 files total. The exit-gracefully utility now supports custom exit codes while maintaining backward compatibility. All authentication commands now use standardized error handling. We added 2 new test cases specifically for exit code functionality, bringing the total to 12 passing tests. TypeCheck passes with no errors, and the build succeeds without issues.
Note that there are 5 pre-existing test failures on Windows related to path separator issues in buckets.spec.ts and find-locale-paths.spec.ts. These failures are unrelated to our changes and exist in the main branch.
This represents Phase 1 of standardizing error handling across the CLI as outlined in ISSUE_ERROR_HANDLING.md. It focuses on high-priority auth commands and establishes a foundation for similar improvements in config, show, and run commands. The changes prevent CI/CD pipeline hangs, make commands easier to test, remove technical debt, and establish a consistent error handling pattern.
Related to: #1144, #1149,