@wonderwhy-er/desktop-commander 0.2.33 → 0.2.34

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.
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Blocking script to update device status to offline
5
+ * Runs synchronously during shutdown to ensure DB update completes
6
+ *
7
+ * Usage: node blocking-offline-update.js <deviceId> <supabaseUrl> <supabaseKey> <accessToken> <refreshToken>
8
+ */
9
+
10
+ import { createClient } from '@supabase/supabase-js';
11
+
12
+ // Parse command line arguments
13
+ const [deviceId, supabaseUrl, supabaseKey, accessToken, refreshToken] = process.argv.slice(2);
14
+
15
+ if (!deviceId || !supabaseUrl || !supabaseKey || !accessToken || !refreshToken) {
16
+ console.error('❌ Missing required arguments');
17
+ console.error('Usage: node blocking-offline-update.js <deviceId> <supabaseUrl> <supabaseKey> <accessToken> <refreshToken>');
18
+ process.exit(1);
19
+ }
20
+
21
+ // Set timeout for entire operation
22
+ const TIMEOUT_MS = 3000;
23
+ const timeoutHandle = setTimeout(() => {
24
+ console.error('⏱️ Timeout: Update took too long');
25
+ process.exit(2); // Exit code 2 for timeout
26
+ }, TIMEOUT_MS);
27
+
28
+ try {
29
+ // Create Supabase client
30
+ const client = createClient(supabaseUrl, supabaseKey);
31
+
32
+ // Set session using access token and refresh token
33
+ const { error: authError } = await client.auth.setSession({
34
+ access_token: accessToken,
35
+ refresh_token: refreshToken
36
+ });
37
+
38
+ if (authError) {
39
+ console.error('❌ Auth error:', authError.message);
40
+ clearTimeout(timeoutHandle);
41
+ process.exit(3); // Exit code 3 for auth error
42
+ }
43
+
44
+ // Update device status to offline
45
+ const { error } = await client
46
+ .from('mcp_devices')
47
+ .update({ status: 'offline' })
48
+ .eq('id', deviceId);
49
+
50
+ clearTimeout(timeoutHandle);
51
+
52
+ if (error) {
53
+ console.error('❌ DB update error:', error.message);
54
+ process.exit(4); // Exit code 4 for DB error
55
+ }
56
+
57
+ console.log('✓ Device marked as offline');
58
+ process.exit(0); // Success
59
+
60
+ } catch (error) {
61
+ clearTimeout(timeoutHandle);
62
+ console.error('❌ Unexpected error:', error.message);
63
+ process.exit(5); // Exit code 5 for unexpected error
64
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.2.33";
1
+ export declare const VERSION = "0.2.34";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.33';
1
+ export const VERSION = '0.2.34';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "mcpName": "io.github.wonderwhy-er/desktop-commander",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "bump": "node scripts/sync-version.js --bump",
32
32
  "bump:minor": "node scripts/sync-version.js --bump --minor",
33
33
  "bump:major": "node scripts/sync-version.js --bump --major",
34
- "build": "tsc && shx cp setup-claude-server.js uninstall-claude-server.js track-installation.js dist/ && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/",
34
+ "build": "tsc && shx cp setup-claude-server.js uninstall-claude-server.js track-installation.js dist/ && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/ && shx mkdir -p dist/remote-device/scripts && shx cp src/remote-device/scripts/blocking-offline-update.js dist/remote-device/scripts/",
35
35
  "watch": "tsc --watch",
36
36
  "start": "node dist/index.js",
37
37
  "start:debug": "node --inspect-brk=9229 dist/index.js",