@codebakers/cli 1.5.0 → 2.0.0
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/audit.d.ts +19 -0
- package/dist/commands/audit.js +730 -0
- package/dist/commands/config.d.ts +4 -0
- package/dist/commands/config.js +176 -0
- package/dist/commands/doctor.js +59 -4
- package/dist/commands/heal.d.ts +41 -0
- package/dist/commands/heal.js +734 -0
- package/dist/commands/login.js +12 -16
- package/dist/commands/provision.d.ts +55 -3
- package/dist/commands/provision.js +243 -74
- package/dist/commands/scaffold.js +221 -41
- package/dist/commands/setup.js +60 -19
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.js +90 -0
- package/dist/config.d.ts +61 -5
- package/dist/config.js +268 -5
- package/dist/index.js +44 -3
- package/dist/lib/api.d.ts +45 -0
- package/dist/lib/api.js +159 -0
- package/dist/mcp/server.js +146 -0
- package/package.json +1 -1
- package/src/commands/audit.ts +827 -0
- package/src/commands/config.ts +216 -0
- package/src/commands/doctor.ts +69 -4
- package/src/commands/heal.ts +889 -0
- package/src/commands/login.ts +14 -18
- package/src/commands/provision.ts +323 -101
- package/src/commands/scaffold.ts +257 -43
- package/src/commands/setup.ts +65 -20
- package/src/commands/upgrade.ts +110 -0
- package/src/config.ts +320 -11
- package/src/index.ts +48 -3
- package/src/lib/api.ts +183 -0
- package/src/mcp/server.ts +160 -0
package/dist/mcp/server.js
CHANGED
|
@@ -39,6 +39,8 @@ const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
|
39
39
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
40
40
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
41
41
|
const config_js_1 = require("../config.js");
|
|
42
|
+
const audit_js_1 = require("../commands/audit.js");
|
|
43
|
+
const heal_js_1 = require("../commands/heal.js");
|
|
42
44
|
const fs = __importStar(require("fs"));
|
|
43
45
|
const path = __importStar(require("path"));
|
|
44
46
|
const child_process_1 = require("child_process");
|
|
@@ -421,6 +423,36 @@ class CodeBakersServer {
|
|
|
421
423
|
properties: {},
|
|
422
424
|
},
|
|
423
425
|
},
|
|
426
|
+
{
|
|
427
|
+
name: 'run_audit',
|
|
428
|
+
description: 'Run automated code quality and security checks on the current project. Checks TypeScript, ESLint, secrets in code, npm vulnerabilities, console.log usage, API validation, error boundaries, and more. Returns a score and list of issues to fix.',
|
|
429
|
+
inputSchema: {
|
|
430
|
+
type: 'object',
|
|
431
|
+
properties: {},
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: 'heal',
|
|
436
|
+
description: 'Run the self-healing system to auto-detect and fix common issues. Scans for TypeScript errors, missing dependencies, environment issues, security vulnerabilities, and database problems. Can automatically apply safe fixes with high confidence.',
|
|
437
|
+
inputSchema: {
|
|
438
|
+
type: 'object',
|
|
439
|
+
properties: {
|
|
440
|
+
auto: {
|
|
441
|
+
type: 'boolean',
|
|
442
|
+
description: 'Automatically apply safe fixes without prompting (default: false)',
|
|
443
|
+
},
|
|
444
|
+
dryRun: {
|
|
445
|
+
type: 'boolean',
|
|
446
|
+
description: 'Show what would be fixed without applying changes (default: false)',
|
|
447
|
+
},
|
|
448
|
+
severity: {
|
|
449
|
+
type: 'string',
|
|
450
|
+
enum: ['critical', 'high', 'medium', 'low'],
|
|
451
|
+
description: 'Filter issues by severity level',
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
},
|
|
424
456
|
],
|
|
425
457
|
}));
|
|
426
458
|
// Handle tool calls
|
|
@@ -452,6 +484,10 @@ class CodeBakersServer {
|
|
|
452
484
|
return this.handleGetExperienceLevel();
|
|
453
485
|
case 'get_status':
|
|
454
486
|
return this.handleGetStatus();
|
|
487
|
+
case 'run_audit':
|
|
488
|
+
return this.handleRunAudit();
|
|
489
|
+
case 'heal':
|
|
490
|
+
return this.handleHeal(args);
|
|
455
491
|
default:
|
|
456
492
|
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
457
493
|
}
|
|
@@ -1123,6 +1159,116 @@ phase: development
|
|
|
1123
1159
|
}],
|
|
1124
1160
|
};
|
|
1125
1161
|
}
|
|
1162
|
+
async handleRunAudit() {
|
|
1163
|
+
try {
|
|
1164
|
+
const result = await (0, audit_js_1.audit)();
|
|
1165
|
+
const passedChecks = result.checks.filter(c => c.passed);
|
|
1166
|
+
const failedChecks = result.checks.filter(c => !c.passed);
|
|
1167
|
+
let response = `# 🔍 Code Audit Results\n\n`;
|
|
1168
|
+
response += `**Score:** ${result.score}% (${passedChecks.length}/${result.checks.length} checks passed)\n\n`;
|
|
1169
|
+
if (result.passed) {
|
|
1170
|
+
response += `## ✅ Status: PASSED\n\nYour project is in good shape!\n\n`;
|
|
1171
|
+
}
|
|
1172
|
+
else {
|
|
1173
|
+
response += `## ⚠️ Status: NEEDS ATTENTION\n\nSome issues need to be fixed before deployment.\n\n`;
|
|
1174
|
+
}
|
|
1175
|
+
// Show passed checks
|
|
1176
|
+
if (passedChecks.length > 0) {
|
|
1177
|
+
response += `### Passed Checks\n`;
|
|
1178
|
+
for (const check of passedChecks) {
|
|
1179
|
+
response += `- ✅ ${check.message}\n`;
|
|
1180
|
+
}
|
|
1181
|
+
response += '\n';
|
|
1182
|
+
}
|
|
1183
|
+
// Show failed checks
|
|
1184
|
+
if (failedChecks.length > 0) {
|
|
1185
|
+
response += `### Issues Found\n`;
|
|
1186
|
+
for (const check of failedChecks) {
|
|
1187
|
+
const icon = check.severity === 'error' ? '❌' : '⚠️';
|
|
1188
|
+
response += `- ${icon} **${check.message}**\n`;
|
|
1189
|
+
if (check.details && check.details.length > 0) {
|
|
1190
|
+
for (const detail of check.details.slice(0, 3)) {
|
|
1191
|
+
response += ` - ${detail}\n`;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
response += '\n';
|
|
1196
|
+
}
|
|
1197
|
+
response += `---\n\n*Tip: Run \`/audit\` in Claude for a full 100-point inspection.*`;
|
|
1198
|
+
return {
|
|
1199
|
+
content: [{
|
|
1200
|
+
type: 'text',
|
|
1201
|
+
text: response,
|
|
1202
|
+
}],
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
catch (error) {
|
|
1206
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
1207
|
+
return {
|
|
1208
|
+
content: [{
|
|
1209
|
+
type: 'text',
|
|
1210
|
+
text: `# ❌ Audit Failed\n\nError: ${message}`,
|
|
1211
|
+
}],
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
async handleHeal(args) {
|
|
1216
|
+
try {
|
|
1217
|
+
const result = await (0, heal_js_1.heal)({
|
|
1218
|
+
auto: args.auto || false,
|
|
1219
|
+
dryRun: args.dryRun || false,
|
|
1220
|
+
severity: args.severity
|
|
1221
|
+
});
|
|
1222
|
+
let response = `# 🏥 Self-Healing Results\n\n`;
|
|
1223
|
+
if (result.errors.length === 0) {
|
|
1224
|
+
response += `## ✅ No Issues Found\n\nYour project is healthy!\n`;
|
|
1225
|
+
}
|
|
1226
|
+
else {
|
|
1227
|
+
response += `## Found ${result.errors.length} Issue(s)\n\n`;
|
|
1228
|
+
response += `**Fixed:** ${result.fixed} | **Remaining:** ${result.remaining}\n\n`;
|
|
1229
|
+
// Group by category
|
|
1230
|
+
const byCategory = new Map();
|
|
1231
|
+
for (const error of result.errors) {
|
|
1232
|
+
const cat = error.category;
|
|
1233
|
+
if (!byCategory.has(cat))
|
|
1234
|
+
byCategory.set(cat, []);
|
|
1235
|
+
byCategory.get(cat).push(error);
|
|
1236
|
+
}
|
|
1237
|
+
for (const [category, errors] of byCategory) {
|
|
1238
|
+
response += `### ${category.toUpperCase()}\n`;
|
|
1239
|
+
for (const error of errors) {
|
|
1240
|
+
const icon = error.fixed ? '✅' : (error.autoFixable ? '🔧' : '⚠️');
|
|
1241
|
+
response += `- ${icon} ${error.message}\n`;
|
|
1242
|
+
if (error.file) {
|
|
1243
|
+
response += ` - File: ${error.file}${error.line ? `:${error.line}` : ''}\n`;
|
|
1244
|
+
}
|
|
1245
|
+
if (error.suggestedFixes.length > 0 && !error.fixed) {
|
|
1246
|
+
response += ` - Fix: ${error.suggestedFixes[0].description}\n`;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
response += '\n';
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
if (!args.auto && result.errors.some(e => e.autoFixable && !e.fixed)) {
|
|
1253
|
+
response += `---\n\n*Run with \`auto: true\` to automatically apply safe fixes.*`;
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
content: [{
|
|
1257
|
+
type: 'text',
|
|
1258
|
+
text: response,
|
|
1259
|
+
}],
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
catch (error) {
|
|
1263
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
1264
|
+
return {
|
|
1265
|
+
content: [{
|
|
1266
|
+
type: 'text',
|
|
1267
|
+
text: `# ❌ Healing Failed\n\nError: ${message}`,
|
|
1268
|
+
}],
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1126
1272
|
handleGetStatus() {
|
|
1127
1273
|
const level = (0, config_js_1.getExperienceLevel)();
|
|
1128
1274
|
const context = this.gatherProjectContext();
|