@codebakers/cli 1.2.0 → 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 +24 -12
- package/package.json +1 -1
- package/src/commands/setup.ts +22 -14
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)({
|
|
@@ -75,23 +76,34 @@ function showFinalInstructions() {
|
|
|
75
76
|
const isWindows = process.platform === 'win32';
|
|
76
77
|
console.log(chalk_1.default.green('\n ✅ API key saved!\n'));
|
|
77
78
|
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
|
|
78
|
-
console.log(chalk_1.default.white.bold('\n STEP 2:
|
|
79
|
+
console.log(chalk_1.default.white.bold('\n STEP 2: Connecting CodeBakers to Claude...\n'));
|
|
79
80
|
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
80
|
-
|
|
81
|
-
const
|
|
81
|
+
// Auto-install MCP server
|
|
82
|
+
const mcpCmd = isWindows
|
|
82
83
|
? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
|
|
83
84
|
: 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
|
|
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
|
+
}
|
|
91
103
|
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════'));
|
|
92
|
-
console.log(chalk_1.default.white.bold('\n
|
|
104
|
+
console.log(chalk_1.default.white.bold('\n 🎉 Setup Complete!\n'));
|
|
93
105
|
console.log(chalk_1.default.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
94
|
-
console.log(chalk_1.default.white('
|
|
106
|
+
console.log(chalk_1.default.white(' CodeBakers is now ready. Try this prompt:\n'));
|
|
95
107
|
console.log(chalk_1.default.cyan(' "Build a login form with email validation"\n'));
|
|
96
108
|
console.log(chalk_1.default.gray(' Claude will now use CodeBakers patterns automatically.\n'));
|
|
97
109
|
console.log(chalk_1.default.gray(' Need help? https://codebakers.ai/docs\n'));
|
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> {
|
|
@@ -83,29 +84,36 @@ function showFinalInstructions(): void {
|
|
|
83
84
|
|
|
84
85
|
console.log(chalk.green('\n ✅ API key saved!\n'));
|
|
85
86
|
console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
|
|
86
|
-
console.log(chalk.white.bold('\n STEP 2:
|
|
87
|
+
console.log(chalk.white.bold('\n STEP 2: Connecting CodeBakers to Claude...\n'));
|
|
87
88
|
console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const terminalCmd = isWindows
|
|
90
|
+
// Auto-install MCP server
|
|
91
|
+
const mcpCmd = isWindows
|
|
92
92
|
? 'claude mcp add --transport stdio codebakers -- cmd /c npx -y @codebakers/cli serve'
|
|
93
93
|
: 'claude mcp add --transport stdio codebakers -- npx -y @codebakers/cli serve';
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
+
}
|
|
103
111
|
|
|
104
112
|
console.log(chalk.blue(' ══════════════════════════════════════════════════════════'));
|
|
105
|
-
console.log(chalk.white.bold('\n
|
|
113
|
+
console.log(chalk.white.bold('\n 🎉 Setup Complete!\n'));
|
|
106
114
|
console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
|
|
107
115
|
|
|
108
|
-
console.log(chalk.white('
|
|
116
|
+
console.log(chalk.white(' CodeBakers is now ready. Try this prompt:\n'));
|
|
109
117
|
console.log(chalk.cyan(' "Build a login form with email validation"\n'));
|
|
110
118
|
|
|
111
119
|
console.log(chalk.gray(' Claude will now use CodeBakers patterns automatically.\n'));
|