@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/src/mcp/server.ts CHANGED
@@ -12,6 +12,7 @@ import { getApiKey, getApiUrl, getExperienceLevel, setExperienceLevel, getServic
12
12
  import { audit as runAudit } from '../commands/audit.js';
13
13
  import { heal as runHeal } from '../commands/heal.js';
14
14
  import { getCliVersion } from '../lib/api.js';
15
+ import { ENGINEERING_TOOLS, handleEngineeringTool } from './engineering-tools.js';
15
16
  import * as fs from 'fs';
16
17
  import * as path from 'path';
17
18
  import { execSync } from 'child_process';
@@ -1172,13 +1173,13 @@ class CodeBakersServer {
1172
1173
  {
1173
1174
  name: 'detect_intent',
1174
1175
  description:
1175
- 'CALL THIS FIRST when user request is ambiguous or could match multiple MCP tools. Analyzes user input and returns which MCP tool(s) would be appropriate, with explanations. Show the result to the user and ask for confirmation before executing. This prevents accidental destructive actions.',
1176
+ '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.',
1176
1177
  inputSchema: {
1177
1178
  type: 'object' as const,
1178
1179
  properties: {
1179
1180
  userMessage: {
1180
1181
  type: 'string',
1181
- description: 'The user\'s message or request to analyze',
1182
+ description: 'The user\'s message (for context only)',
1182
1183
  },
1183
1184
  },
1184
1185
  required: ['userMessage'],
@@ -1551,6 +1552,8 @@ class CodeBakersServer {
1551
1552
  properties: {},
1552
1553
  },
1553
1554
  },
1555
+ // Engineering workflow tools
1556
+ ...ENGINEERING_TOOLS,
1554
1557
  ],
1555
1558
  }));
1556
1559
 
@@ -1794,6 +1797,19 @@ class CodeBakersServer {
1794
1797
  case 'project_dashboard_url':
1795
1798
  return this.handleProjectDashboardUrl();
1796
1799
 
1800
+ // Engineering workflow tools
1801
+ case 'engineering_start':
1802
+ case 'engineering_scope':
1803
+ case 'engineering_status':
1804
+ case 'engineering_advance':
1805
+ case 'engineering_gate':
1806
+ case 'engineering_artifact':
1807
+ case 'engineering_decision':
1808
+ case 'engineering_graph_add':
1809
+ case 'engineering_impact':
1810
+ case 'engineering_graph_view':
1811
+ return handleEngineeringTool(name, args as Record<string, unknown>, this.apiUrl, this.getAuthHeaders());
1812
+
1797
1813
  default:
1798
1814
  throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
1799
1815
  }
@@ -6673,136 +6689,25 @@ You cannot write code without calling this tool first.
6673
6689
  */
6674
6690
  private handleDetectIntent(args: { userMessage: string }) {
6675
6691
  const { userMessage } = args;
6676
- const msg = userMessage.toLowerCase();
6677
6692
 
6678
- // Define intent patterns with their MCP tools
6679
- const intentPatterns = [
6680
- {
6681
- keywords: ['upgrade codebakers', 'update patterns', 'sync patterns', 'download patterns', 'get latest patterns'],
6682
- tool: 'update_patterns',
6683
- description: 'Download latest CLAUDE.md and all .claude/ modules from the CodeBakers server',
6684
- action: 'WRITE - Will overwrite local pattern files with server versions',
6685
- isDestructive: true,
6686
- },
6687
- {
6688
- keywords: ['upgrade', 'improve code', 'make production ready', 'code quality'],
6689
- tool: 'upgrade',
6690
- description: 'Analyze your code for quality improvements (does NOT download patterns)',
6691
- action: 'READ-ONLY - Analyzes code and suggests improvements',
6692
- isDestructive: false,
6693
- },
6694
- {
6695
- keywords: ['build', 'create project', 'new project', 'scaffold', 'start fresh'],
6696
- tool: 'scaffold_project',
6697
- description: 'Create a new project from scratch with CodeBakers patterns',
6698
- action: 'WRITE - Will create new files and folders',
6699
- isDestructive: true,
6700
- },
6701
- {
6702
- keywords: ['add feature', 'implement', 'build feature', 'create feature'],
6703
- tool: 'optimize_and_build',
6704
- description: 'Optimize your feature request with AI and fetch relevant patterns',
6705
- action: 'READ + ASSIST - Fetches patterns and guides implementation',
6706
- isDestructive: false,
6707
- },
6708
- {
6709
- keywords: ['audit', 'review code', 'check code', 'code review'],
6710
- tool: 'run_audit',
6711
- description: 'Run comprehensive code quality audit',
6712
- action: 'READ-ONLY - Analyzes code and reports issues',
6713
- isDestructive: false,
6714
- },
6715
- {
6716
- keywords: ['heal', 'fix errors', 'auto-fix', 'fix bugs'],
6717
- tool: 'heal',
6718
- description: 'AI-powered error detection and automatic fixing',
6719
- action: 'WRITE - May modify files to fix errors',
6720
- isDestructive: true,
6721
- },
6722
- {
6723
- keywords: ['design', 'clone design', 'copy design', 'match design'],
6724
- tool: 'design',
6725
- description: 'Clone a design from mockups, screenshots, or websites',
6726
- action: 'WRITE - Will generate component files',
6727
- isDestructive: true,
6728
- },
6729
- {
6730
- keywords: ['status', 'progress', "what's built", 'where am i'],
6731
- tool: 'project_status',
6732
- description: 'Show current project build progress and stats',
6733
- action: 'READ-ONLY - Shows project state',
6734
- isDestructive: false,
6735
- },
6736
- {
6737
- keywords: ['run tests', 'test', 'check tests'],
6738
- tool: 'run_tests',
6739
- description: 'Execute the project test suite',
6740
- action: 'READ-ONLY - Runs tests and reports results',
6741
- isDestructive: false,
6742
- },
6743
- {
6744
- keywords: ['list patterns', 'show patterns', 'what patterns'],
6745
- tool: 'list_patterns',
6746
- description: 'List all available CodeBakers patterns',
6747
- action: 'READ-ONLY - Shows available patterns',
6748
- isDestructive: false,
6749
- },
6750
- {
6751
- keywords: ['init', 'initialize', 'add patterns to existing'],
6752
- tool: 'init_project',
6753
- description: 'Add CodeBakers patterns to an existing project',
6754
- action: 'WRITE - Will add CLAUDE.md and .claude/ folder',
6755
- isDestructive: true,
6756
- },
6757
- ];
6758
-
6759
- // Find matching intents
6760
- const matches = intentPatterns.filter(pattern =>
6761
- pattern.keywords.some(keyword => msg.includes(keyword))
6762
- );
6763
-
6764
- let response = `# 🔍 Intent Detection\n\n`;
6693
+ // Simple tool list - no keyword guessing. Let the AI figure it out from context.
6694
+ let response = `# Available CodeBakers MCP Tools\n\n`;
6765
6695
  response += `**Your message:** "${userMessage}"\n\n`;
6766
-
6767
- if (matches.length === 0) {
6768
- response += `## No specific MCP tool detected\n\n`;
6769
- response += `Your request doesn't clearly match any MCP tool. I'll proceed with general assistance.\n\n`;
6770
- response += `**Available tools you might want:**\n`;
6771
- response += `- \`update_patterns\` - Download latest patterns from server\n`;
6772
- response += `- \`optimize_and_build\` - Get AI help building a feature\n`;
6773
- response += `- \`run_audit\` - Review your code quality\n`;
6774
- response += `- \`project_status\` - Check build progress\n`;
6775
- } else if (matches.length === 1) {
6776
- const match = matches[0];
6777
- response += `## Detected Intent\n\n`;
6778
- response += `| Property | Value |\n`;
6779
- response += `|----------|-------|\n`;
6780
- response += `| **Tool** | \`${match.tool}\` |\n`;
6781
- response += `| **Description** | ${match.description} |\n`;
6782
- response += `| **Action Type** | ${match.action} |\n`;
6783
- response += `| **Destructive?** | ${match.isDestructive ? '⚠️ YES - modifies files' : '✅ NO - read-only'} |\n\n`;
6784
-
6785
- if (match.isDestructive) {
6786
- response += `### ⚠️ Confirmation Required\n\n`;
6787
- response += `This action will modify files. Do you want to proceed?\n\n`;
6788
- response += `**Reply "yes" or "proceed" to execute, or describe what you actually want.**\n`;
6789
- } else {
6790
- response += `This is a read-only operation. Safe to proceed.\n\n`;
6791
- response += `**Reply "yes" to execute, or clarify your request.**\n`;
6792
- }
6793
- } else {
6794
- response += `## Multiple Possible Intents\n\n`;
6795
- response += `Your request could match several tools:\n\n`;
6796
-
6797
- matches.forEach((match, i) => {
6798
- response += `### Option ${i + 1}: \`${match.tool}\`\n`;
6799
- response += `- **What it does:** ${match.description}\n`;
6800
- response += `- **Action:** ${match.action}\n`;
6801
- response += `- **Destructive:** ${match.isDestructive ? '⚠️ Yes' : '✅ No'}\n\n`;
6802
- });
6803
-
6804
- response += `**Which option do you want?** Reply with the tool name or option number.\n`;
6805
- }
6696
+ response += `## Tools\n\n`;
6697
+ response += `| Tool | Description |\n`;
6698
+ response += `|------|-------------|\n`;
6699
+ response += `| \`update_patterns\` | Download latest CLAUDE.md from server |\n`;
6700
+ response += `| \`discover_patterns\` | Find patterns for a feature request |\n`;
6701
+ response += `| \`optimize_and_build\` | AI-optimize a feature request |\n`;
6702
+ response += `| \`run_audit\` | Code quality audit |\n`;
6703
+ response += `| \`heal\` | Auto-fix errors |\n`;
6704
+ response += `| \`project_status\` | Show build progress |\n`;
6705
+ response += `| \`run_tests\` | Run test suite |\n`;
6706
+ response += `| \`scaffold_project\` | Create new project |\n`;
6707
+ response += `| \`init_project\` | Add patterns to existing project |\n`;
6708
+ response += `| \`list_patterns\` | List all available patterns |\n`;
6709
+ response += `| \`billing_action\` | Manage subscription |\n\n`;
6710
+ response += `**Pick the tool that matches what you want to do.**\n`;
6806
6711
 
6807
6712
  return {
6808
6713
  content: [{