@codebakers/cli 3.7.1 → 3.8.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/lib/engineering-state.d.ts +269 -0
- package/dist/lib/engineering-state.js +605 -0
- package/dist/mcp/engineering-tools.d.ts +396 -0
- package/dist/mcp/engineering-tools.js +808 -0
- package/dist/mcp/server.js +34 -125
- package/package.json +1 -1
- package/src/lib/engineering-state.ts +823 -0
- package/src/mcp/engineering-tools.ts +977 -0
- package/src/mcp/server.ts +35 -130
package/dist/mcp/server.js
CHANGED
|
@@ -42,6 +42,7 @@ const config_js_1 = require("../config.js");
|
|
|
42
42
|
const audit_js_1 = require("../commands/audit.js");
|
|
43
43
|
const heal_js_1 = require("../commands/heal.js");
|
|
44
44
|
const api_js_1 = require("../lib/api.js");
|
|
45
|
+
const engineering_tools_js_1 = require("./engineering-tools.js");
|
|
45
46
|
const fs = __importStar(require("fs"));
|
|
46
47
|
const path = __importStar(require("path"));
|
|
47
48
|
const child_process_1 = require("child_process");
|
|
@@ -1075,13 +1076,13 @@ class CodeBakersServer {
|
|
|
1075
1076
|
},
|
|
1076
1077
|
{
|
|
1077
1078
|
name: 'detect_intent',
|
|
1078
|
-
description: '
|
|
1079
|
+
description: 'Lists all available CodeBakers MCP tools. Only use this when user explicitly asks "what tools are available" or "help". Do NOT use for normal requests - just call the appropriate tool directly.',
|
|
1079
1080
|
inputSchema: {
|
|
1080
1081
|
type: 'object',
|
|
1081
1082
|
properties: {
|
|
1082
1083
|
userMessage: {
|
|
1083
1084
|
type: 'string',
|
|
1084
|
-
description: 'The user\'s message
|
|
1085
|
+
description: 'The user\'s message (for context only)',
|
|
1085
1086
|
},
|
|
1086
1087
|
},
|
|
1087
1088
|
required: ['userMessage'],
|
|
@@ -1439,6 +1440,8 @@ class CodeBakersServer {
|
|
|
1439
1440
|
properties: {},
|
|
1440
1441
|
},
|
|
1441
1442
|
},
|
|
1443
|
+
// Engineering workflow tools
|
|
1444
|
+
...engineering_tools_js_1.ENGINEERING_TOOLS,
|
|
1442
1445
|
],
|
|
1443
1446
|
}));
|
|
1444
1447
|
// Handle tool calls
|
|
@@ -1567,6 +1570,18 @@ class CodeBakersServer {
|
|
|
1567
1570
|
return this.handleProjectSync(args);
|
|
1568
1571
|
case 'project_dashboard_url':
|
|
1569
1572
|
return this.handleProjectDashboardUrl();
|
|
1573
|
+
// Engineering workflow tools
|
|
1574
|
+
case 'engineering_start':
|
|
1575
|
+
case 'engineering_scope':
|
|
1576
|
+
case 'engineering_status':
|
|
1577
|
+
case 'engineering_advance':
|
|
1578
|
+
case 'engineering_gate':
|
|
1579
|
+
case 'engineering_artifact':
|
|
1580
|
+
case 'engineering_decision':
|
|
1581
|
+
case 'engineering_graph_add':
|
|
1582
|
+
case 'engineering_impact':
|
|
1583
|
+
case 'engineering_graph_view':
|
|
1584
|
+
return (0, engineering_tools_js_1.handleEngineeringTool)(name, args, this.apiUrl, this.getAuthHeaders());
|
|
1570
1585
|
default:
|
|
1571
1586
|
throw new types_js_1.McpError(types_js_1.ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
1572
1587
|
}
|
|
@@ -5934,130 +5949,24 @@ You cannot write code without calling this tool first.
|
|
|
5934
5949
|
*/
|
|
5935
5950
|
handleDetectIntent(args) {
|
|
5936
5951
|
const { userMessage } = args;
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
const intentPatterns = [
|
|
5940
|
-
{
|
|
5941
|
-
keywords: ['upgrade codebakers', 'update patterns', 'sync patterns', 'download patterns', 'get latest patterns'],
|
|
5942
|
-
tool: 'update_patterns',
|
|
5943
|
-
description: 'Download latest CLAUDE.md and all .claude/ modules from the CodeBakers server',
|
|
5944
|
-
action: 'WRITE - Will overwrite local pattern files with server versions',
|
|
5945
|
-
isDestructive: true,
|
|
5946
|
-
},
|
|
5947
|
-
{
|
|
5948
|
-
keywords: ['upgrade', 'improve code', 'make production ready', 'code quality'],
|
|
5949
|
-
tool: 'upgrade',
|
|
5950
|
-
description: 'Analyze your code for quality improvements (does NOT download patterns)',
|
|
5951
|
-
action: 'READ-ONLY - Analyzes code and suggests improvements',
|
|
5952
|
-
isDestructive: false,
|
|
5953
|
-
},
|
|
5954
|
-
{
|
|
5955
|
-
keywords: ['build', 'create project', 'new project', 'scaffold', 'start fresh'],
|
|
5956
|
-
tool: 'scaffold_project',
|
|
5957
|
-
description: 'Create a new project from scratch with CodeBakers patterns',
|
|
5958
|
-
action: 'WRITE - Will create new files and folders',
|
|
5959
|
-
isDestructive: true,
|
|
5960
|
-
},
|
|
5961
|
-
{
|
|
5962
|
-
keywords: ['add feature', 'implement', 'build feature', 'create feature'],
|
|
5963
|
-
tool: 'optimize_and_build',
|
|
5964
|
-
description: 'Optimize your feature request with AI and fetch relevant patterns',
|
|
5965
|
-
action: 'READ + ASSIST - Fetches patterns and guides implementation',
|
|
5966
|
-
isDestructive: false,
|
|
5967
|
-
},
|
|
5968
|
-
{
|
|
5969
|
-
keywords: ['audit', 'review code', 'check code', 'code review'],
|
|
5970
|
-
tool: 'run_audit',
|
|
5971
|
-
description: 'Run comprehensive code quality audit',
|
|
5972
|
-
action: 'READ-ONLY - Analyzes code and reports issues',
|
|
5973
|
-
isDestructive: false,
|
|
5974
|
-
},
|
|
5975
|
-
{
|
|
5976
|
-
keywords: ['heal', 'fix errors', 'auto-fix', 'fix bugs'],
|
|
5977
|
-
tool: 'heal',
|
|
5978
|
-
description: 'AI-powered error detection and automatic fixing',
|
|
5979
|
-
action: 'WRITE - May modify files to fix errors',
|
|
5980
|
-
isDestructive: true,
|
|
5981
|
-
},
|
|
5982
|
-
{
|
|
5983
|
-
keywords: ['design', 'clone design', 'copy design', 'match design'],
|
|
5984
|
-
tool: 'design',
|
|
5985
|
-
description: 'Clone a design from mockups, screenshots, or websites',
|
|
5986
|
-
action: 'WRITE - Will generate component files',
|
|
5987
|
-
isDestructive: true,
|
|
5988
|
-
},
|
|
5989
|
-
{
|
|
5990
|
-
keywords: ['status', 'progress', "what's built", 'where am i'],
|
|
5991
|
-
tool: 'project_status',
|
|
5992
|
-
description: 'Show current project build progress and stats',
|
|
5993
|
-
action: 'READ-ONLY - Shows project state',
|
|
5994
|
-
isDestructive: false,
|
|
5995
|
-
},
|
|
5996
|
-
{
|
|
5997
|
-
keywords: ['run tests', 'test', 'check tests'],
|
|
5998
|
-
tool: 'run_tests',
|
|
5999
|
-
description: 'Execute the project test suite',
|
|
6000
|
-
action: 'READ-ONLY - Runs tests and reports results',
|
|
6001
|
-
isDestructive: false,
|
|
6002
|
-
},
|
|
6003
|
-
{
|
|
6004
|
-
keywords: ['list patterns', 'show patterns', 'what patterns'],
|
|
6005
|
-
tool: 'list_patterns',
|
|
6006
|
-
description: 'List all available CodeBakers patterns',
|
|
6007
|
-
action: 'READ-ONLY - Shows available patterns',
|
|
6008
|
-
isDestructive: false,
|
|
6009
|
-
},
|
|
6010
|
-
{
|
|
6011
|
-
keywords: ['init', 'initialize', 'add patterns to existing'],
|
|
6012
|
-
tool: 'init_project',
|
|
6013
|
-
description: 'Add CodeBakers patterns to an existing project',
|
|
6014
|
-
action: 'WRITE - Will add CLAUDE.md and .claude/ folder',
|
|
6015
|
-
isDestructive: true,
|
|
6016
|
-
},
|
|
6017
|
-
];
|
|
6018
|
-
// Find matching intents
|
|
6019
|
-
const matches = intentPatterns.filter(pattern => pattern.keywords.some(keyword => msg.includes(keyword)));
|
|
6020
|
-
let response = `# 🔍 Intent Detection\n\n`;
|
|
5952
|
+
// Simple tool list - no keyword guessing. Let the AI figure it out from context.
|
|
5953
|
+
let response = `# Available CodeBakers MCP Tools\n\n`;
|
|
6021
5954
|
response += `**Your message:** "${userMessage}"\n\n`;
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
response += `| **Description** | ${match.description} |\n`;
|
|
6038
|
-
response += `| **Action Type** | ${match.action} |\n`;
|
|
6039
|
-
response += `| **Destructive?** | ${match.isDestructive ? '⚠️ YES - modifies files' : '✅ NO - read-only'} |\n\n`;
|
|
6040
|
-
if (match.isDestructive) {
|
|
6041
|
-
response += `### ⚠️ Confirmation Required\n\n`;
|
|
6042
|
-
response += `This action will modify files. Do you want to proceed?\n\n`;
|
|
6043
|
-
response += `**Reply "yes" or "proceed" to execute, or describe what you actually want.**\n`;
|
|
6044
|
-
}
|
|
6045
|
-
else {
|
|
6046
|
-
response += `This is a read-only operation. Safe to proceed.\n\n`;
|
|
6047
|
-
response += `**Reply "yes" to execute, or clarify your request.**\n`;
|
|
6048
|
-
}
|
|
6049
|
-
}
|
|
6050
|
-
else {
|
|
6051
|
-
response += `## Multiple Possible Intents\n\n`;
|
|
6052
|
-
response += `Your request could match several tools:\n\n`;
|
|
6053
|
-
matches.forEach((match, i) => {
|
|
6054
|
-
response += `### Option ${i + 1}: \`${match.tool}\`\n`;
|
|
6055
|
-
response += `- **What it does:** ${match.description}\n`;
|
|
6056
|
-
response += `- **Action:** ${match.action}\n`;
|
|
6057
|
-
response += `- **Destructive:** ${match.isDestructive ? '⚠️ Yes' : '✅ No'}\n\n`;
|
|
6058
|
-
});
|
|
6059
|
-
response += `**Which option do you want?** Reply with the tool name or option number.\n`;
|
|
6060
|
-
}
|
|
5955
|
+
response += `## Tools\n\n`;
|
|
5956
|
+
response += `| Tool | Description |\n`;
|
|
5957
|
+
response += `|------|-------------|\n`;
|
|
5958
|
+
response += `| \`update_patterns\` | Download latest CLAUDE.md from server |\n`;
|
|
5959
|
+
response += `| \`discover_patterns\` | Find patterns for a feature request |\n`;
|
|
5960
|
+
response += `| \`optimize_and_build\` | AI-optimize a feature request |\n`;
|
|
5961
|
+
response += `| \`run_audit\` | Code quality audit |\n`;
|
|
5962
|
+
response += `| \`heal\` | Auto-fix errors |\n`;
|
|
5963
|
+
response += `| \`project_status\` | Show build progress |\n`;
|
|
5964
|
+
response += `| \`run_tests\` | Run test suite |\n`;
|
|
5965
|
+
response += `| \`scaffold_project\` | Create new project |\n`;
|
|
5966
|
+
response += `| \`init_project\` | Add patterns to existing project |\n`;
|
|
5967
|
+
response += `| \`list_patterns\` | List all available patterns |\n`;
|
|
5968
|
+
response += `| \`billing_action\` | Manage subscription |\n\n`;
|
|
5969
|
+
response += `**Pick the tool that matches what you want to do.**\n`;
|
|
6061
5970
|
return {
|
|
6062
5971
|
content: [{
|
|
6063
5972
|
type: 'text',
|