@codebakers/cli 3.3.9 ā 3.3.11
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/package.json +1 -1
- package/src/mcp/server.ts +47 -2
package/package.json
CHANGED
package/src/mcp/server.ts
CHANGED
|
@@ -65,6 +65,9 @@ class CodeBakersServer {
|
|
|
65
65
|
private authMode: 'apiKey' | 'trial' | 'none';
|
|
66
66
|
private autoUpdateChecked = false;
|
|
67
67
|
private autoUpdateInProgress = false;
|
|
68
|
+
private pendingUpdate: { current: string; latest: string } | null = null;
|
|
69
|
+
private lastUpdateCheck = 0;
|
|
70
|
+
private updateCheckInterval = 60 * 60 * 1000; // Check every hour
|
|
68
71
|
|
|
69
72
|
constructor() {
|
|
70
73
|
this.apiKey = getApiKey();
|
|
@@ -95,6 +98,21 @@ class CodeBakersServer {
|
|
|
95
98
|
this.checkCliVersion().catch(() => {
|
|
96
99
|
// Silently ignore errors
|
|
97
100
|
});
|
|
101
|
+
|
|
102
|
+
// Start periodic update checks (every hour)
|
|
103
|
+
setInterval(() => {
|
|
104
|
+
this.checkCliVersion().catch(() => {});
|
|
105
|
+
}, this.updateCheckInterval);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get update notice if a newer version is available
|
|
110
|
+
*/
|
|
111
|
+
private getUpdateNotice(): string {
|
|
112
|
+
if (this.pendingUpdate) {
|
|
113
|
+
return `\n\n---\nš **CodeBakers Update Available:** v${this.pendingUpdate.current} ā v${this.pendingUpdate.latest}\nRestart Cursor/Claude Code to get new features!`;
|
|
114
|
+
}
|
|
115
|
+
return '';
|
|
98
116
|
}
|
|
99
117
|
|
|
100
118
|
/**
|
|
@@ -102,6 +120,11 @@ class CodeBakersServer {
|
|
|
102
120
|
*/
|
|
103
121
|
private async checkCliVersion(): Promise<void> {
|
|
104
122
|
try {
|
|
123
|
+
// Rate limit checks
|
|
124
|
+
const now = Date.now();
|
|
125
|
+
if (now - this.lastUpdateCheck < 5 * 60 * 1000) return; // Min 5 minutes between checks
|
|
126
|
+
this.lastUpdateCheck = now;
|
|
127
|
+
|
|
105
128
|
const currentVersion = getCliVersion();
|
|
106
129
|
|
|
107
130
|
// Fetch latest version from npm
|
|
@@ -124,12 +147,21 @@ class CodeBakersServer {
|
|
|
124
147
|
(latest[0] === current[0] && latest[1] === current[1] && latest[2] > current[2]);
|
|
125
148
|
|
|
126
149
|
if (isNewer) {
|
|
150
|
+
// Store pending update for inclusion in tool responses
|
|
151
|
+
this.pendingUpdate = { current: currentVersion, latest: latestVersion };
|
|
152
|
+
|
|
153
|
+
// Also log to stderr for immediate visibility
|
|
127
154
|
console.error(`\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā`);
|
|
128
155
|
console.error(`ā š CodeBakers CLI Update Available: v${currentVersion} ā v${latestVersion.padEnd(10)}ā`);
|
|
129
156
|
console.error(`ā ā`);
|
|
130
157
|
console.error(`ā Restart Cursor/Claude Code to get the latest features! ā`);
|
|
131
158
|
console.error(`āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n`);
|
|
159
|
+
} else {
|
|
160
|
+
// No update available
|
|
161
|
+
this.pendingUpdate = null;
|
|
132
162
|
}
|
|
163
|
+
} else {
|
|
164
|
+
this.pendingUpdate = null;
|
|
133
165
|
}
|
|
134
166
|
} catch {
|
|
135
167
|
// Silently ignore - don't interrupt user experience
|
|
@@ -2705,6 +2737,9 @@ phase: development
|
|
|
2705
2737
|
response += `---\n\n*Run with \`auto: true\` to automatically apply safe fixes.*`;
|
|
2706
2738
|
}
|
|
2707
2739
|
|
|
2740
|
+
// Add CLI update notice if available
|
|
2741
|
+
response += this.getUpdateNotice();
|
|
2742
|
+
|
|
2708
2743
|
return {
|
|
2709
2744
|
content: [{
|
|
2710
2745
|
type: 'text' as const,
|
|
@@ -2716,7 +2751,7 @@ phase: development
|
|
|
2716
2751
|
return {
|
|
2717
2752
|
content: [{
|
|
2718
2753
|
type: 'text' as const,
|
|
2719
|
-
text: `# ā Healing Failed\n\nError: ${message}`,
|
|
2754
|
+
text: `# ā Healing Failed\n\nError: ${message}${this.getUpdateNotice()}`,
|
|
2720
2755
|
}],
|
|
2721
2756
|
};
|
|
2722
2757
|
}
|
|
@@ -2772,10 +2807,13 @@ Just describe what you want to build! I'll automatically:
|
|
|
2772
2807
|
---
|
|
2773
2808
|
*CodeBakers is providing AI-assisted development patterns for this project.*`;
|
|
2774
2809
|
|
|
2810
|
+
// Add CLI update notice if available
|
|
2811
|
+
const statusWithNotice = statusText + this.getUpdateNotice();
|
|
2812
|
+
|
|
2775
2813
|
return {
|
|
2776
2814
|
content: [{
|
|
2777
2815
|
type: 'text' as const,
|
|
2778
|
-
text:
|
|
2816
|
+
text: statusWithNotice,
|
|
2779
2817
|
}],
|
|
2780
2818
|
};
|
|
2781
2819
|
}
|
|
@@ -5564,6 +5602,7 @@ ${handlers.join('\n')}
|
|
|
5564
5602
|
response += `ā
**Already up to date!**\n\n`;
|
|
5565
5603
|
response += `Your patterns are current (v${latestVersion} with ${latestModuleCount} modules).\n`;
|
|
5566
5604
|
response += `Use \`force: true\` to re-download anyway.\n`;
|
|
5605
|
+
response += this.getUpdateNotice();
|
|
5567
5606
|
|
|
5568
5607
|
return {
|
|
5569
5608
|
content: [{
|
|
@@ -5645,6 +5684,9 @@ ${handlers.join('\n')}
|
|
|
5645
5684
|
}
|
|
5646
5685
|
}
|
|
5647
5686
|
|
|
5687
|
+
// Add CLI update notice if available
|
|
5688
|
+
response += this.getUpdateNotice();
|
|
5689
|
+
|
|
5648
5690
|
return {
|
|
5649
5691
|
content: [{
|
|
5650
5692
|
type: 'text' as const,
|
|
@@ -7028,6 +7070,9 @@ ${events.includes('call-started') ? ` case 'call-started':
|
|
|
7028
7070
|
response += `Could not read guardian state. Run \`guardian_analyze\` to rebuild.\n`;
|
|
7029
7071
|
}
|
|
7030
7072
|
|
|
7073
|
+
// Add update notice if available
|
|
7074
|
+
response += this.getUpdateNotice();
|
|
7075
|
+
|
|
7031
7076
|
return { content: [{ type: 'text' as const, text: response }] };
|
|
7032
7077
|
}
|
|
7033
7078
|
|