@codebakers/cli 3.9.13 → 3.9.15
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/go.js +13 -0
- package/dist/index.js +2 -2
- package/dist/mcp/server.js +73 -5
- package/package.json +1 -1
- package/src/commands/go.ts +14 -0
- package/src/index.ts +2 -2
- package/src/mcp/server.ts +87 -5
package/dist/commands/go.js
CHANGED
|
@@ -1018,6 +1018,19 @@ async function go(options = {}) {
|
|
|
1018
1018
|
if (projectState.isSetUp) {
|
|
1019
1019
|
// Project already has CodeBakers - show context and resume
|
|
1020
1020
|
showResumeContext(projectState);
|
|
1021
|
+
// CRITICAL: Ensure .mcp.json exists for Claude Code MCP tools
|
|
1022
|
+
// This fixes the issue where existing projects set up before v3.9.14
|
|
1023
|
+
// never got .mcp.json created (it was only created in first-time setup)
|
|
1024
|
+
const mcpJsonPath = (0, path_1.join)(cwd, '.mcp.json');
|
|
1025
|
+
if (!(0, fs_1.existsSync)(mcpJsonPath)) {
|
|
1026
|
+
console.log(chalk_1.default.yellow(' ⚠️ MCP config missing - creating .mcp.json...\n'));
|
|
1027
|
+
setupClaudeCodeMCP(cwd);
|
|
1028
|
+
console.log(chalk_1.default.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
|
|
1029
|
+
console.log(chalk_1.default.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
|
|
1030
|
+
console.log(chalk_1.default.cyan(' To reload:\n'));
|
|
1031
|
+
console.log(chalk_1.default.gray(' VS Code: ') + chalk_1.default.white('Press ') + chalk_1.default.cyan('Cmd/Ctrl+Shift+P') + chalk_1.default.white(' → type ') + chalk_1.default.cyan('"Reload Window"'));
|
|
1032
|
+
console.log(chalk_1.default.gray(' CLI: ') + chalk_1.default.white('Press ') + chalk_1.default.cyan('Ctrl+C') + chalk_1.default.white(' and run ') + chalk_1.default.cyan('claude') + chalk_1.default.white(' again\n'));
|
|
1033
|
+
}
|
|
1021
1034
|
// Verify auth is still valid
|
|
1022
1035
|
const existingApiKey = (0, config_js_1.getApiKey)();
|
|
1023
1036
|
const existingTrial = (0, config_js_1.getTrialState)();
|
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ const api_js_1 = require("./lib/api.js");
|
|
|
34
34
|
// ============================================
|
|
35
35
|
// Automatic Update Notification
|
|
36
36
|
// ============================================
|
|
37
|
-
const CURRENT_VERSION = '3.9.
|
|
37
|
+
const CURRENT_VERSION = '3.9.14';
|
|
38
38
|
// Simple semver comparison: returns true if v1 > v2
|
|
39
39
|
function isNewerVersion(v1, v2) {
|
|
40
40
|
const parts1 = v1.split('.').map(Number);
|
|
@@ -210,7 +210,7 @@ const program = new commander_1.Command();
|
|
|
210
210
|
program
|
|
211
211
|
.name('codebakers')
|
|
212
212
|
.description('CodeBakers CLI - Production patterns for AI-assisted development')
|
|
213
|
-
.version('3.9.
|
|
213
|
+
.version('3.9.14');
|
|
214
214
|
// Zero-friction trial entry (no signup required)
|
|
215
215
|
program
|
|
216
216
|
.command('go')
|
package/dist/mcp/server.js
CHANGED
|
@@ -4185,15 +4185,21 @@ Just describe what you want to build! I'll automatically:
|
|
|
4185
4185
|
responseText += `**Follow these established patterns for consistency.**\n\n`;
|
|
4186
4186
|
}
|
|
4187
4187
|
responseText += `---\n\n`;
|
|
4188
|
-
// Section 1: Patterns from server
|
|
4188
|
+
// Section 1: Patterns from server (CONDENSED - not full content)
|
|
4189
4189
|
if (result.patterns && result.patterns.length > 0) {
|
|
4190
4190
|
responseText += `## 📦 MANDATORY PATTERNS\n\n`;
|
|
4191
|
-
responseText += `
|
|
4191
|
+
responseText += `The following patterns apply to this task. Key rules are shown below:\n\n`;
|
|
4192
4192
|
for (const pattern of result.patterns) {
|
|
4193
|
-
responseText += `### ${pattern.name}\n\n`;
|
|
4194
|
-
|
|
4195
|
-
|
|
4193
|
+
responseText += `### ${pattern.name} (${pattern.relevance} relevance)\n\n`;
|
|
4194
|
+
// Extract only KEY RULES (first ~100 lines or critical sections)
|
|
4195
|
+
// This prevents 100K+ character responses
|
|
4196
|
+
const content = pattern.content || '';
|
|
4197
|
+
const condensed = this.extractKeyRules(content, pattern.name);
|
|
4198
|
+
if (condensed) {
|
|
4199
|
+
responseText += condensed + '\n\n';
|
|
4200
|
+
}
|
|
4196
4201
|
}
|
|
4202
|
+
responseText += `> **Note:** These are condensed key rules. The full patterns are enforced server-side.\n\n`;
|
|
4197
4203
|
}
|
|
4198
4204
|
// Section 2: Test Requirements (ALL from server, not local file)
|
|
4199
4205
|
responseText += `---\n\n`;
|
|
@@ -4313,6 +4319,68 @@ Just describe what you want to build! I'll automatically:
|
|
|
4313
4319
|
const stopWords = ['the', 'and', 'for', 'add', 'fix', 'create', 'make', 'build', 'implement', 'update', 'modify', 'change', 'new', 'with', 'from', 'this', 'that'];
|
|
4314
4320
|
return words.filter(w => !stopWords.includes(w));
|
|
4315
4321
|
}
|
|
4322
|
+
/**
|
|
4323
|
+
* Extract key rules from pattern content (CONDENSED - max ~2000 chars per pattern)
|
|
4324
|
+
* This prevents 100K+ character responses that exceed token limits
|
|
4325
|
+
*/
|
|
4326
|
+
extractKeyRules(content, patternName) {
|
|
4327
|
+
if (!content)
|
|
4328
|
+
return '';
|
|
4329
|
+
const MAX_CHARS = 2000; // ~50 lines max per pattern
|
|
4330
|
+
const lines = content.split('\n');
|
|
4331
|
+
// Strategy: Extract headers, key rules, and first code example
|
|
4332
|
+
const keyParts = [];
|
|
4333
|
+
let inCodeBlock = false;
|
|
4334
|
+
let codeBlockCount = 0;
|
|
4335
|
+
let currentSize = 0;
|
|
4336
|
+
for (const line of lines) {
|
|
4337
|
+
// Track code blocks
|
|
4338
|
+
if (line.trim().startsWith('```')) {
|
|
4339
|
+
inCodeBlock = !inCodeBlock;
|
|
4340
|
+
if (!inCodeBlock)
|
|
4341
|
+
codeBlockCount++;
|
|
4342
|
+
}
|
|
4343
|
+
// Skip if we've hit the limit
|
|
4344
|
+
if (currentSize > MAX_CHARS) {
|
|
4345
|
+
keyParts.push('...(truncated - server enforces full pattern)');
|
|
4346
|
+
break;
|
|
4347
|
+
}
|
|
4348
|
+
// Always include headers
|
|
4349
|
+
if (line.startsWith('#')) {
|
|
4350
|
+
keyParts.push(line);
|
|
4351
|
+
currentSize += line.length;
|
|
4352
|
+
continue;
|
|
4353
|
+
}
|
|
4354
|
+
// Include lines with key indicators
|
|
4355
|
+
const isKeyLine = line.includes('MUST') ||
|
|
4356
|
+
line.includes('NEVER') ||
|
|
4357
|
+
line.includes('ALWAYS') ||
|
|
4358
|
+
line.includes('REQUIRED') ||
|
|
4359
|
+
line.includes('MANDATORY') ||
|
|
4360
|
+
line.includes('DO NOT') ||
|
|
4361
|
+
line.includes('✅') ||
|
|
4362
|
+
line.includes('❌') ||
|
|
4363
|
+
line.includes('⚠️') ||
|
|
4364
|
+
line.startsWith('- ') ||
|
|
4365
|
+
line.startsWith('* ') ||
|
|
4366
|
+
line.startsWith('|'); // Tables
|
|
4367
|
+
if (isKeyLine && !inCodeBlock) {
|
|
4368
|
+
keyParts.push(line);
|
|
4369
|
+
currentSize += line.length;
|
|
4370
|
+
continue;
|
|
4371
|
+
}
|
|
4372
|
+
// Include first code example only
|
|
4373
|
+
if (inCodeBlock && codeBlockCount === 0) {
|
|
4374
|
+
keyParts.push(line);
|
|
4375
|
+
currentSize += line.length;
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
// If we got nothing useful, return first N characters
|
|
4379
|
+
if (keyParts.length < 5) {
|
|
4380
|
+
return content.substring(0, MAX_CHARS) + '\n...(truncated)';
|
|
4381
|
+
}
|
|
4382
|
+
return keyParts.join('\n');
|
|
4383
|
+
}
|
|
4316
4384
|
/**
|
|
4317
4385
|
* Find files recursively with given extensions
|
|
4318
4386
|
*/
|
package/package.json
CHANGED
package/src/commands/go.ts
CHANGED
|
@@ -1151,6 +1151,20 @@ export async function go(options: GoOptions = {}): Promise<void> {
|
|
|
1151
1151
|
// Project already has CodeBakers - show context and resume
|
|
1152
1152
|
showResumeContext(projectState);
|
|
1153
1153
|
|
|
1154
|
+
// CRITICAL: Ensure .mcp.json exists for Claude Code MCP tools
|
|
1155
|
+
// This fixes the issue where existing projects set up before v3.9.14
|
|
1156
|
+
// never got .mcp.json created (it was only created in first-time setup)
|
|
1157
|
+
const mcpJsonPath = join(cwd, '.mcp.json');
|
|
1158
|
+
if (!existsSync(mcpJsonPath)) {
|
|
1159
|
+
console.log(chalk.yellow(' ⚠️ MCP config missing - creating .mcp.json...\n'));
|
|
1160
|
+
setupClaudeCodeMCP(cwd);
|
|
1161
|
+
console.log(chalk.yellow(' ⚠️ RELOAD REQUIRED to load MCP tools\n'));
|
|
1162
|
+
console.log(chalk.white(' Claude Code needs to reload to detect the new .mcp.json file.\n'));
|
|
1163
|
+
console.log(chalk.cyan(' To reload:\n'));
|
|
1164
|
+
console.log(chalk.gray(' VS Code: ') + chalk.white('Press ') + chalk.cyan('Cmd/Ctrl+Shift+P') + chalk.white(' → type ') + chalk.cyan('"Reload Window"'));
|
|
1165
|
+
console.log(chalk.gray(' CLI: ') + chalk.white('Press ') + chalk.cyan('Ctrl+C') + chalk.white(' and run ') + chalk.cyan('claude') + chalk.white(' again\n'));
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1154
1168
|
// Verify auth is still valid
|
|
1155
1169
|
const existingApiKey = getApiKey();
|
|
1156
1170
|
const existingTrial = getTrialState();
|
package/src/index.ts
CHANGED
|
@@ -34,7 +34,7 @@ import { join } from 'path';
|
|
|
34
34
|
// Automatic Update Notification
|
|
35
35
|
// ============================================
|
|
36
36
|
|
|
37
|
-
const CURRENT_VERSION = '3.9.
|
|
37
|
+
const CURRENT_VERSION = '3.9.14';
|
|
38
38
|
|
|
39
39
|
// Simple semver comparison: returns true if v1 > v2
|
|
40
40
|
function isNewerVersion(v1: string, v2: string): boolean {
|
|
@@ -230,7 +230,7 @@ const program = new Command();
|
|
|
230
230
|
program
|
|
231
231
|
.name('codebakers')
|
|
232
232
|
.description('CodeBakers CLI - Production patterns for AI-assisted development')
|
|
233
|
-
.version('3.9.
|
|
233
|
+
.version('3.9.14');
|
|
234
234
|
|
|
235
235
|
// Zero-friction trial entry (no signup required)
|
|
236
236
|
program
|
package/src/mcp/server.ts
CHANGED
|
@@ -4652,15 +4652,25 @@ Just describe what you want to build! I'll automatically:
|
|
|
4652
4652
|
|
|
4653
4653
|
responseText += `---\n\n`;
|
|
4654
4654
|
|
|
4655
|
-
// Section 1: Patterns from server
|
|
4655
|
+
// Section 1: Patterns from server (CONDENSED - not full content)
|
|
4656
4656
|
if (result.patterns && result.patterns.length > 0) {
|
|
4657
4657
|
responseText += `## 📦 MANDATORY PATTERNS\n\n`;
|
|
4658
|
-
responseText += `
|
|
4658
|
+
responseText += `The following patterns apply to this task. Key rules are shown below:\n\n`;
|
|
4659
|
+
|
|
4659
4660
|
for (const pattern of result.patterns) {
|
|
4660
|
-
responseText += `### ${pattern.name}\n\n`;
|
|
4661
|
-
|
|
4662
|
-
|
|
4661
|
+
responseText += `### ${pattern.name} (${pattern.relevance} relevance)\n\n`;
|
|
4662
|
+
|
|
4663
|
+
// Extract only KEY RULES (first ~100 lines or critical sections)
|
|
4664
|
+
// This prevents 100K+ character responses
|
|
4665
|
+
const content = pattern.content || '';
|
|
4666
|
+
const condensed = this.extractKeyRules(content, pattern.name);
|
|
4667
|
+
|
|
4668
|
+
if (condensed) {
|
|
4669
|
+
responseText += condensed + '\n\n';
|
|
4670
|
+
}
|
|
4663
4671
|
}
|
|
4672
|
+
|
|
4673
|
+
responseText += `> **Note:** These are condensed key rules. The full patterns are enforced server-side.\n\n`;
|
|
4664
4674
|
}
|
|
4665
4675
|
|
|
4666
4676
|
// Section 2: Test Requirements (ALL from server, not local file)
|
|
@@ -4791,6 +4801,78 @@ Just describe what you want to build! I'll automatically:
|
|
|
4791
4801
|
return words.filter(w => !stopWords.includes(w));
|
|
4792
4802
|
}
|
|
4793
4803
|
|
|
4804
|
+
/**
|
|
4805
|
+
* Extract key rules from pattern content (CONDENSED - max ~2000 chars per pattern)
|
|
4806
|
+
* This prevents 100K+ character responses that exceed token limits
|
|
4807
|
+
*/
|
|
4808
|
+
private extractKeyRules(content: string, patternName: string): string {
|
|
4809
|
+
if (!content) return '';
|
|
4810
|
+
|
|
4811
|
+
const MAX_CHARS = 2000; // ~50 lines max per pattern
|
|
4812
|
+
const lines = content.split('\n');
|
|
4813
|
+
|
|
4814
|
+
// Strategy: Extract headers, key rules, and first code example
|
|
4815
|
+
const keyParts: string[] = [];
|
|
4816
|
+
let inCodeBlock = false;
|
|
4817
|
+
let codeBlockCount = 0;
|
|
4818
|
+
let currentSize = 0;
|
|
4819
|
+
|
|
4820
|
+
for (const line of lines) {
|
|
4821
|
+
// Track code blocks
|
|
4822
|
+
if (line.trim().startsWith('```')) {
|
|
4823
|
+
inCodeBlock = !inCodeBlock;
|
|
4824
|
+
if (!inCodeBlock) codeBlockCount++;
|
|
4825
|
+
}
|
|
4826
|
+
|
|
4827
|
+
// Skip if we've hit the limit
|
|
4828
|
+
if (currentSize > MAX_CHARS) {
|
|
4829
|
+
keyParts.push('...(truncated - server enforces full pattern)');
|
|
4830
|
+
break;
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4833
|
+
// Always include headers
|
|
4834
|
+
if (line.startsWith('#')) {
|
|
4835
|
+
keyParts.push(line);
|
|
4836
|
+
currentSize += line.length;
|
|
4837
|
+
continue;
|
|
4838
|
+
}
|
|
4839
|
+
|
|
4840
|
+
// Include lines with key indicators
|
|
4841
|
+
const isKeyLine =
|
|
4842
|
+
line.includes('MUST') ||
|
|
4843
|
+
line.includes('NEVER') ||
|
|
4844
|
+
line.includes('ALWAYS') ||
|
|
4845
|
+
line.includes('REQUIRED') ||
|
|
4846
|
+
line.includes('MANDATORY') ||
|
|
4847
|
+
line.includes('DO NOT') ||
|
|
4848
|
+
line.includes('✅') ||
|
|
4849
|
+
line.includes('❌') ||
|
|
4850
|
+
line.includes('⚠️') ||
|
|
4851
|
+
line.startsWith('- ') ||
|
|
4852
|
+
line.startsWith('* ') ||
|
|
4853
|
+
line.startsWith('|'); // Tables
|
|
4854
|
+
|
|
4855
|
+
if (isKeyLine && !inCodeBlock) {
|
|
4856
|
+
keyParts.push(line);
|
|
4857
|
+
currentSize += line.length;
|
|
4858
|
+
continue;
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4861
|
+
// Include first code example only
|
|
4862
|
+
if (inCodeBlock && codeBlockCount === 0) {
|
|
4863
|
+
keyParts.push(line);
|
|
4864
|
+
currentSize += line.length;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4868
|
+
// If we got nothing useful, return first N characters
|
|
4869
|
+
if (keyParts.length < 5) {
|
|
4870
|
+
return content.substring(0, MAX_CHARS) + '\n...(truncated)';
|
|
4871
|
+
}
|
|
4872
|
+
|
|
4873
|
+
return keyParts.join('\n');
|
|
4874
|
+
}
|
|
4875
|
+
|
|
4794
4876
|
/**
|
|
4795
4877
|
* Find files recursively with given extensions
|
|
4796
4878
|
*/
|