Skip to content

Commit e99a53d

Browse files
committed
cp dines
1 parent 40ae537 commit e99a53d

2 files changed

Lines changed: 24 additions & 15 deletions

File tree

src/cli.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { exitAlternateScreenBuffer } from "./utils/screen.js";
44
import { processUtils } from "./utils/processUtils.js";
55
import { createProgram } from "./utils/commands.js";
6+
import { getApiKeyErrorMessage } from "./utils/config.js";
67

78
// Global Ctrl+C handler to ensure it always exits
89
processUtils.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
}

src/utils/config.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,25 @@ export function setDetectedTheme(theme: "light" | "dark"): void {
100100
export 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+
}

0 commit comments

Comments
 (0)