flutter-skill-mcp 0.2.10 → 0.2.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.
Files changed (2) hide show
  1. package/bin/cli.js +74 -0
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -10,6 +10,10 @@ const os = require('os');
10
10
  const packageJson = require('../package.json');
11
11
  const VERSION = packageJson.version;
12
12
 
13
+ // Update check config
14
+ const CHECK_INTERVAL_HOURS = 24;
15
+ const UPDATE_CHECK_FILE = path.join(os.homedir(), '.flutter-skill', 'update-check.json');
16
+
13
17
  // Paths
14
18
  const cacheDir = path.join(os.homedir(), '.flutter-skill');
15
19
  const binDir = path.join(cacheDir, 'bin');
@@ -185,4 +189,74 @@ function checkFlutter() {
185
189
  }
186
190
  }
187
191
 
192
+ // Check for updates (non-blocking, runs in background)
193
+ function checkForUpdates() {
194
+ // Only check periodically
195
+ try {
196
+ const checkDir = path.dirname(UPDATE_CHECK_FILE);
197
+ if (!fs.existsSync(checkDir)) {
198
+ fs.mkdirSync(checkDir, { recursive: true });
199
+ }
200
+
201
+ let lastCheck = 0;
202
+ let skippedVersion = null;
203
+
204
+ if (fs.existsSync(UPDATE_CHECK_FILE)) {
205
+ try {
206
+ const data = JSON.parse(fs.readFileSync(UPDATE_CHECK_FILE, 'utf-8'));
207
+ lastCheck = data.lastCheck || 0;
208
+ skippedVersion = data.skippedVersion;
209
+ } catch {}
210
+ }
211
+
212
+ const now = Date.now();
213
+ const hoursSinceLastCheck = (now - lastCheck) / (1000 * 60 * 60);
214
+
215
+ if (hoursSinceLastCheck < CHECK_INTERVAL_HOURS) {
216
+ return;
217
+ }
218
+
219
+ // Update last check time
220
+ fs.writeFileSync(UPDATE_CHECK_FILE, JSON.stringify({
221
+ lastCheck: now,
222
+ skippedVersion
223
+ }));
224
+
225
+ // Check npm registry for latest version (async, non-blocking)
226
+ https.get('https://registry.npmjs.org/flutter-skill-mcp', (res) => {
227
+ let data = '';
228
+ res.on('data', (chunk) => data += chunk);
229
+ res.on('end', () => {
230
+ try {
231
+ const json = JSON.parse(data);
232
+ const latestVersion = json['dist-tags'].latest;
233
+
234
+ if (latestVersion && compareVersions(latestVersion, VERSION) > 0) {
235
+ if (skippedVersion !== latestVersion) {
236
+ console.error(`\n[flutter-skill] Update available: ${VERSION} → ${latestVersion}`);
237
+ console.error(`[flutter-skill] Run: npm update -g flutter-skill-mcp\n`);
238
+ }
239
+ }
240
+ } catch {}
241
+ });
242
+ }).on('error', () => {});
243
+ } catch {}
244
+ }
245
+
246
+ function compareVersions(v1, v2) {
247
+ const parts1 = v1.split('.').map(Number);
248
+ const parts2 = v2.split('.').map(Number);
249
+
250
+ for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
251
+ const p1 = parts1[i] || 0;
252
+ const p2 = parts2[i] || 0;
253
+ if (p1 > p2) return 1;
254
+ if (p1 < p2) return -1;
255
+ }
256
+ return 0;
257
+ }
258
+
259
+ // Run update check in background (non-blocking)
260
+ checkForUpdates();
261
+
188
262
  main().catch(console.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flutter-skill-mcp",
3
- "version": "0.2.10",
3
+ "version": "0.2.11",
4
4
  "description": "MCP Server for Flutter app automation - Give your AI Agent eyes and hands inside your Flutter app",
5
5
  "main": "index.js",
6
6
  "bin": {