@@ -25,6 +25,7 @@ import { version } from "../../package.json";
2525import build from "./build" ;
2626import deploy from "./deploy" ;
2727import setupSlackApp from "./setup-slack-app" ;
28+ import * as clack from "@clack/prompts" ;
2829
2930// This polyfill is because older versions of NodeJS don't have a global crypto object.
3031if ( ! globalThis . crypto ) {
@@ -122,14 +123,23 @@ program
122123 . action ( asyncEntry ( ( ) => import ( "./chat" ) ) ) ;
123124
124125program
125- . command ( "login" , {
126- // This is hidden intentionally.
127- // The Blink CLI should be primarily open-source,
128- // and deploying to cloud should be the *only* proprietary
129- // feature in this CLI.
130- hidden : true ,
131- } )
126+ . command ( "login" )
132127 . description ( "Log in to the Blink Cloud." )
133128 . action ( asyncEntry ( ( ) => import ( "./login" ) ) ) ;
134129
130+ // Configure error output
131+ program . configureOutput ( {
132+ writeErr : ( str ) => {
133+ // Strip ANSI codes from commander's default error messages
134+ const cleanStr = str . replace ( / \x1b \[ [ 0 - 9 ; ] * m / g, "" ) ;
135+ clack . log . error ( cleanStr . trim ( ) ) ;
136+ } ,
137+ } ) ;
138+
139+ // Global error handler for uncaught errors in command actions
140+ process . on ( "unhandledRejection" , ( error : any ) => {
141+ clack . log . error ( error ?. message || String ( error ) ) ;
142+ process . exit ( 1 ) ;
143+ } ) ;
144+
135145program . parse ( process . argv ) ;
0 commit comments