@codebakers/cli 1.0.7 → 1.0.8
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/index.js +12 -94
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,10 +14,9 @@ import chalk2 from "chalk";
|
|
|
14
14
|
import inquirer from "inquirer";
|
|
15
15
|
import chalk from "chalk";
|
|
16
16
|
import ora from "ora";
|
|
17
|
-
import { writeFile, mkdir
|
|
17
|
+
import { writeFile, mkdir } from "fs/promises";
|
|
18
18
|
import { existsSync } from "fs";
|
|
19
19
|
import { join } from "path";
|
|
20
|
-
import { homedir } from "os";
|
|
21
20
|
|
|
22
21
|
// src/utils/api.ts
|
|
23
22
|
import nodeFetch from "node-fetch";
|
|
@@ -199,30 +198,17 @@ Validation failed: ${validation.error || "Unknown error"}`));
|
|
|
199
198
|
}
|
|
200
199
|
console.log(chalk.bold.green("\n\u{1F389} Setup complete!\n"));
|
|
201
200
|
if (ide === "claude-code") {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
console.log(chalk.cyan(" /mcp add codebakers npx -y @codebakers/cli serve"));
|
|
214
|
-
console.log(chalk.dim(""));
|
|
215
|
-
console.log(chalk.dim("Option 2 - Create .mcp.json in your project root:"));
|
|
216
|
-
console.log(chalk.cyan(` {
|
|
217
|
-
"mcpServers": {
|
|
218
|
-
"codebakers": {
|
|
219
|
-
"command": "npx",
|
|
220
|
-
"args": ["-y", "@codebakers/cli", "serve"]
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}`));
|
|
224
|
-
console.log(chalk.dim("\nThen restart Claude Code.\n"));
|
|
225
|
-
}
|
|
201
|
+
console.log(chalk.green("\u2713 CodeBakers patterns are ready to use!\n"));
|
|
202
|
+
console.log(chalk.dim("Your patterns have been installed to:"));
|
|
203
|
+
console.log(chalk.dim(" \u2022 CLAUDE.md - Smart router for pattern selection"));
|
|
204
|
+
console.log(chalk.dim(" \u2022 .claude/ folder - All pattern modules\n"));
|
|
205
|
+
console.log(chalk.bold("Start using CodeBakers now:"));
|
|
206
|
+
console.log(chalk.dim(" Just ask Claude Code to help with your coding tasks."));
|
|
207
|
+
console.log(chalk.dim(" The patterns will be automatically applied based on context.\n"));
|
|
208
|
+
console.log(chalk.dim("Example prompts:"));
|
|
209
|
+
console.log(chalk.cyan(' "Build a login form with validation"'));
|
|
210
|
+
console.log(chalk.cyan(' "Add Stripe checkout to my app"'));
|
|
211
|
+
console.log(chalk.cyan(' "Create an API endpoint for users"\n'));
|
|
226
212
|
} else if (ide) {
|
|
227
213
|
console.log(chalk.dim(`Pattern file created. Restart ${IDE_CONFIGS[ide].description} to load it.
|
|
228
214
|
`));
|
|
@@ -328,74 +314,6 @@ message: |
|
|
|
328
314
|
${router.split("\n").map((line) => " " + line).join("\n")}
|
|
329
315
|
`;
|
|
330
316
|
}
|
|
331
|
-
async function configureMcpServer() {
|
|
332
|
-
const locations = [
|
|
333
|
-
// Project-level .mcp.json (preferred for portability)
|
|
334
|
-
join(process.cwd(), ".mcp.json"),
|
|
335
|
-
// User-level Claude settings
|
|
336
|
-
join(homedir(), ".claude", "settings.json"),
|
|
337
|
-
// Alternative user-level location
|
|
338
|
-
join(homedir(), ".claude.json")
|
|
339
|
-
];
|
|
340
|
-
const mcpConfig = {
|
|
341
|
-
codebakers: {
|
|
342
|
-
command: "npx",
|
|
343
|
-
args: ["-y", "@codebakers/cli", "serve"]
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
const projectMcpPath = locations[0];
|
|
347
|
-
try {
|
|
348
|
-
let existingConfig = {};
|
|
349
|
-
if (existsSync(projectMcpPath)) {
|
|
350
|
-
try {
|
|
351
|
-
const content = await readFile(projectMcpPath, "utf-8");
|
|
352
|
-
existingConfig = JSON.parse(content);
|
|
353
|
-
} catch {
|
|
354
|
-
existingConfig = {};
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const newConfig = {
|
|
358
|
-
...existingConfig,
|
|
359
|
-
mcpServers: {
|
|
360
|
-
...existingConfig.mcpServers || {},
|
|
361
|
-
...mcpConfig
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
await writeFile(projectMcpPath, JSON.stringify(newConfig, null, 2), "utf-8");
|
|
365
|
-
console.log(chalk.dim(` Created/updated ${projectMcpPath}`));
|
|
366
|
-
return true;
|
|
367
|
-
} catch (error) {
|
|
368
|
-
}
|
|
369
|
-
for (const settingsPath of locations.slice(1)) {
|
|
370
|
-
try {
|
|
371
|
-
const dir = join(settingsPath, "..");
|
|
372
|
-
if (!existsSync(dir)) {
|
|
373
|
-
await mkdir(dir, { recursive: true });
|
|
374
|
-
}
|
|
375
|
-
let existingConfig = {};
|
|
376
|
-
if (existsSync(settingsPath)) {
|
|
377
|
-
try {
|
|
378
|
-
const content = await readFile(settingsPath, "utf-8");
|
|
379
|
-
existingConfig = JSON.parse(content);
|
|
380
|
-
} catch {
|
|
381
|
-
existingConfig = {};
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
const newConfig = {
|
|
385
|
-
...existingConfig,
|
|
386
|
-
mcpServers: {
|
|
387
|
-
...existingConfig.mcpServers || {},
|
|
388
|
-
...mcpConfig
|
|
389
|
-
}
|
|
390
|
-
};
|
|
391
|
-
await writeFile(settingsPath, JSON.stringify(newConfig, null, 2), "utf-8");
|
|
392
|
-
console.log(chalk.dim(` Created/updated ${settingsPath}`));
|
|
393
|
-
return true;
|
|
394
|
-
} catch {
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
317
|
|
|
400
318
|
// src/commands/serve.ts
|
|
401
319
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|