@codebakers/cli 3.3.9 → 3.3.10

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mcp/server.ts +35 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.3.9",
3
+ "version": "3.3.10",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
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
@@ -7028,6 +7060,9 @@ ${events.includes('call-started') ? ` case 'call-started':
7028
7060
  response += `Could not read guardian state. Run \`guardian_analyze\` to rebuild.\n`;
7029
7061
  }
7030
7062
 
7063
+ // Add update notice if available
7064
+ response += this.getUpdateNotice();
7065
+
7031
7066
  return { content: [{ type: 'text' as const, text: response }] };
7032
7067
  }
7033
7068