@codebakers/cli 1.1.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/setup.js +30 -13
- package/package.json +1 -1
- package/src/commands/setup.ts +29 -15
package/dist/commands/setup.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.setup = setup;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const ora_1 = __importDefault(require("ora"));
|
|
9
9
|
const readline_1 = require("readline");
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
10
11
|
const config_js_1 = require("../config.js");
|
|
11
12
|
function prompt(question) {
|
|
12
13
|
const rl = (0, readline_1.createInterface)({
|
|
@@ -72,22 +73,38 @@ async function setup() {
|
|
|
72
73
|
showFinalInstructions();
|
|
73
74
|
}
|
|
74
75
|
function showFinalInstructions() {
|
|
75
|
-
console.log(chalk_1.default.white(' Step 2: Add MCP Server\n'));
|
|
76
|
-
// Detect platform
|
|
77
76
|
const isWindows = process.platform === 'win32';
|
|
78
|
-
console.log(chalk_1.default.
|
|
79
|
-
|
|
77
|
+
console.log(chalk_1.default.green('\n ✅ API key saved!\n'));
|
|
78
|
+
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
|
|
79
|
+
console.log(chalk_1.default.white.bold('\n STEP 2: Connecting CodeBakers to Claude...\n'));
|
|
80
|
+
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
81
|
+
// Auto-install MCP server
|
|
82
|
+
const mcpCmd = isWindows
|
|
80
83
|
? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
|
|
81
84
|
: 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
try {
|
|
86
|
+
(0, child_process_1.execSync)(mcpCmd, { stdio: 'pipe' });
|
|
87
|
+
console.log(chalk_1.default.green(' ✅ CodeBakers MCP server installed!\n'));
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// Check if it's already installed (command might fail if already exists)
|
|
91
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
92
|
+
if (errorMessage.includes('already exists') || errorMessage.includes('already registered')) {
|
|
93
|
+
console.log(chalk_1.default.green(' ✅ CodeBakers MCP server already installed!\n'));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
console.log(chalk_1.default.yellow(' ⚠️ Could not auto-install MCP server.\n'));
|
|
97
|
+
console.log(chalk_1.default.white(' Run this command manually in your terminal:\n'));
|
|
98
|
+
console.log(chalk_1.default.bgBlue.white('\n ' + mcpCmd + ' \n'));
|
|
99
|
+
console.log(chalk_1.default.gray('\n Then restart Claude Code.\n'));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
|
|
104
|
+
console.log(chalk_1.default.white.bold('\n 🎉 Setup Complete!\n'));
|
|
105
|
+
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
106
|
+
console.log(chalk_1.default.white(' CodeBakers is now ready. Try this prompt:\n'));
|
|
91
107
|
console.log(chalk_1.default.cyan(' "Build a login form with email validation"\n'));
|
|
108
|
+
console.log(chalk_1.default.gray(' Claude will now use CodeBakers patterns automatically.\n'));
|
|
92
109
|
console.log(chalk_1.default.gray(' Need help? https://codebakers.ai/docs\n'));
|
|
93
110
|
}
|
package/package.json
CHANGED
package/src/commands/setup.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { createInterface } from 'readline';
|
|
4
|
+
import { execSync } from 'child_process';
|
|
4
5
|
import { setApiKey, getApiKey, getApiUrl } from '../config.js';
|
|
5
6
|
|
|
6
7
|
function prompt(question: string): Promise<string> {
|
|
@@ -79,30 +80,43 @@ export async function setup(): Promise<void> {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
function showFinalInstructions(): void {
|
|
82
|
-
console.log(chalk.white(' Step 2: Add MCP Server\n'));
|
|
83
|
-
|
|
84
|
-
// Detect platform
|
|
85
83
|
const isWindows = process.platform === 'win32';
|
|
86
84
|
|
|
87
|
-
console.log(chalk.
|
|
85
|
+
console.log(chalk.green('\n ✅ API key saved!\n'));
|
|
86
|
+
console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
|
|
87
|
+
console.log(chalk.white.bold('\n STEP 2: Connecting CodeBakers to Claude...\n'));
|
|
88
|
+
console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
88
89
|
|
|
89
|
-
|
|
90
|
+
// Auto-install MCP server
|
|
91
|
+
const mcpCmd = isWindows
|
|
90
92
|
? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
|
|
91
93
|
: 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
try {
|
|
96
|
+
execSync(mcpCmd, { stdio: 'pipe' });
|
|
97
|
+
console.log(chalk.green(' ✅ CodeBakers MCP server installed!\n'));
|
|
98
|
+
} catch (error) {
|
|
99
|
+
// Check if it's already installed (command might fail if already exists)
|
|
100
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
101
|
+
if (errorMessage.includes('already exists') || errorMessage.includes('already registered')) {
|
|
102
|
+
console.log(chalk.green(' ✅ CodeBakers MCP server already installed!\n'));
|
|
103
|
+
} else {
|
|
104
|
+
console.log(chalk.yellow(' ⚠️ Could not auto-install MCP server.\n'));
|
|
105
|
+
console.log(chalk.white(' Run this command manually in your terminal:\n'));
|
|
106
|
+
console.log(chalk.bgBlue.white('\n ' + mcpCmd + ' \n'));
|
|
107
|
+
console.log(chalk.gray('\n Then restart Claude Code.\n'));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
96
111
|
|
|
97
|
-
console.log(chalk.blue('
|
|
98
|
-
console.log(chalk.
|
|
99
|
-
console.log(chalk.
|
|
100
|
-
console.log(chalk.gray(' • Claude will have access to 34 production patterns'));
|
|
101
|
-
console.log(chalk.gray(' • Patterns are fetched on-demand (never stored locally)'));
|
|
102
|
-
console.log(chalk.gray(' • Works across all your projects\n'));
|
|
112
|
+
console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
|
|
113
|
+
console.log(chalk.white.bold('\n 🎉 Setup Complete!\n'));
|
|
114
|
+
console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
103
115
|
|
|
104
|
-
console.log(chalk.white('
|
|
116
|
+
console.log(chalk.white(' CodeBakers is now ready. Try this prompt:\n'));
|
|
105
117
|
console.log(chalk.cyan(' "Build a login form with email validation"\n'));
|
|
106
118
|
|
|
119
|
+
console.log(chalk.gray(' Claude will now use CodeBakers patterns automatically.\n'));
|
|
120
|
+
|
|
107
121
|
console.log(chalk.gray(' Need help? https://codebakers.ai/docs\n'));
|
|
108
122
|
}
|