File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import { exitAlternateScreenBuffer } from "./utils/screen.js" ;
44import { processUtils } from "./utils/processUtils.js" ;
55import { createProgram } from "./utils/commands.js" ;
6+ import { getApiKeyErrorMessage } from "./utils/config.js" ;
67
78// Global Ctrl+C handler to ensure it always exits
89processUtils . on ( "SIGINT" , ( ) => {
@@ -24,21 +25,7 @@ const program = createProgram();
2425 // Check if API key is configured (except for mcp commands)
2526 const args = process . argv . slice ( 2 ) ;
2627 if ( ! process . env . RUNLOOP_API_KEY ) {
27- console . error ( `
28- ❌ API key not configured.
29-
30- To get started:
31- 1. Go to https://platform.runloop.ai/settings and create an API key
32- 2. Set the environment variable:
33-
34- export RUNLOOP_API_KEY=your_api_key_here
35-
36- To make it permanent, add this line to your shell config:
37- • For zsh: echo 'export RUNLOOP_API_KEY=your_api_key_here' >> ~/.zshrc
38- • For bash: echo 'export RUNLOOP_API_KEY=your_api_key_here' >> ~/.bashrc
39-
40- Then restart your terminal or run: source ~/.zshrc (or ~/.bashrc)
41- ` ) ;
28+ console . error ( getApiKeyErrorMessage ( ) ) ;
4229 processUtils . exit ( 1 ) ;
4330 return ; // Ensure execution stops
4431 }
Original file line number Diff line number Diff line change @@ -100,3 +100,25 @@ export function setDetectedTheme(theme: "light" | "dark"): void {
100100export function clearDetectedTheme ( ) : void {
101101 config . delete ( "detectedTheme" ) ;
102102}
103+
104+ /**
105+ * Returns the detailed error message for when the API key is not configured.
106+ * This message provides instructions on how to set up the API key.
107+ */
108+ export function getApiKeyErrorMessage ( ) : string {
109+ return `
110+ ❌ API key not configured.
111+
112+ To get started:
113+ 1. Go to https://platform.runloop.ai/settings and create an API key
114+ 2. Set the environment variable:
115+
116+ export RUNLOOP_API_KEY=your_api_key_here
117+
118+ To make it permanent, add this line to your shell config:
119+ • For zsh: echo 'export RUNLOOP_API_KEY=your_api_key_here' >> ~/.zshrc
120+ • For bash: echo 'export RUNLOOP_API_KEY=your_api_key_here' >> ~/.bashrc
121+
122+ Then restart your terminal or run: source ~/.zshrc (or ~/.bashrc)
123+ ` ;
124+ }
You can’t perform that action at this time.
0 commit comments