@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.
@@ -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: Connect CodeBakers to Claude\n'));
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
- console.log(chalk_1.default.white(' Open a NEW terminal window and run this command:\n'));
81
- const terminalCmd = isWindows
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
- console.log(chalk_1.default.bgBlue.white('\n ' + terminalCmd + ' \n'));
85
- console.log(chalk_1.default.gray('\n ┌─────────────────────────────────────────────────────────┐'));
86
- console.log(chalk_1.default.gray(' │') + chalk_1.default.yellow(' ⚠️ IMPORTANT: ') + chalk_1.default.gray('│'));
87
- console.log(chalk_1.default.gray(' │') + chalk_1.default.white(' • Run this in a TERMINAL, not in Claude Code chat ') + chalk_1.default.gray('│'));
88
- console.log(chalk_1.default.gray(' │') + chalk_1.default.white(' • You only need to do this ONCE ') + chalk_1.default.gray('│'));
89
- console.log(chalk_1.default.gray(' │') + chalk_1.default.white(' After running, restart Claude Code ') + chalk_1.default.gray('│'));
90
- console.log(chalk_1.default.gray(' └─────────────────────────────────────────────────────────┘\n'));
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 STEP 3: Test it!\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(' After restarting Claude Code, try this prompt:\n'));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -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: Connect CodeBakers to Claude\n'));
87
+ console.log(chalk.white.bold('\n STEP 2: Connecting CodeBakers to Claude...\n'));
87
88
  console.log(chalk.blue(' ══════════════════════════════════════════════════════════\n'));
88
89
 
89
- console.log(chalk.white(' Open a NEW terminal window and run this command:\n'));
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
- console.log(chalk.bgBlue.white('\n ' + terminalCmd + ' \n'));
96
-
97
- console.log(chalk.gray('\n ┌─────────────────────────────────────────────────────────┐'));
98
- console.log(chalk.gray(' │') + chalk.yellow(' ⚠️ IMPORTANT: ') + chalk.gray('│'));
99
- console.log(chalk.gray(' │') + chalk.white(' Run this in a TERMINAL, not in Claude Code chat ') + chalk.gray('│'));
100
- console.log(chalk.gray(' │') + chalk.white(' • You only need to do this ONCE ') + chalk.gray('│'));
101
- console.log(chalk.gray('') + chalk.white(' After running, restart Claude Code ') + chalk.gray('│'));
102
- console.log(chalk.gray(' └─────────────────────────────────────────────────────────┘\n'));
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 STEP 3: Test it!\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(' After restarting Claude Code, try this prompt:\n'));
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'));