@wonderwhy-er/desktop-commander 0.1.33 → 0.1.35
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/README.md +105 -36
- package/dist/command-manager.d.ts +1 -7
- package/dist/command-manager.js +31 -50
- package/dist/config-manager.d.ts +27 -16
- package/dist/config-manager.js +109 -191
- package/dist/config.js +8 -4
- package/dist/error-handlers.d.ts +7 -0
- package/dist/error-handlers.js +15 -0
- package/dist/handlers/command-handlers.d.ts +4 -18
- package/dist/handlers/command-handlers.js +15 -3
- package/dist/handlers/edit-search-handlers.d.ts +3 -12
- package/dist/handlers/edit-search-handlers.js +10 -7
- package/dist/handlers/filesystem-handlers.d.ts +9 -66
- package/dist/handlers/filesystem-handlers.js +106 -65
- package/dist/handlers/index.d.ts +0 -1
- package/dist/handlers/index.js +0 -1
- package/dist/handlers/process-handlers.d.ts +3 -12
- package/dist/handlers/terminal-handlers.d.ts +5 -24
- package/dist/index.js +18 -3
- package/dist/sandbox/index.d.ts +9 -0
- package/dist/sandbox/index.js +50 -0
- package/dist/sandbox/mac-sandbox.d.ts +19 -0
- package/dist/sandbox/mac-sandbox.js +174 -0
- package/dist/server.js +156 -176
- package/dist/setup-claude-server.js +98 -49
- package/dist/terminal-manager.d.ts +1 -1
- package/dist/terminal-manager.js +26 -4
- package/dist/tools/config.d.ts +0 -58
- package/dist/tools/config.js +44 -107
- package/dist/tools/debug-path.d.ts +1 -0
- package/dist/tools/debug-path.js +44 -0
- package/dist/tools/edit.d.ts +3 -1
- package/dist/tools/edit.js +19 -7
- package/dist/tools/execute.d.ts +4 -18
- package/dist/tools/execute.js +27 -8
- package/dist/tools/filesystem-fixed.d.ts +22 -0
- package/dist/tools/filesystem-fixed.js +176 -0
- package/dist/tools/filesystem.d.ts +4 -6
- package/dist/tools/filesystem.js +106 -75
- package/dist/tools/process.d.ts +3 -12
- package/dist/tools/process.js +12 -3
- package/dist/tools/schemas.d.ts +15 -14
- package/dist/tools/schemas.js +10 -6
- package/dist/tools/search.js +3 -3
- package/dist/types.d.ts +12 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +92 -32
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -2
package/dist/utils.js
CHANGED
|
@@ -1,54 +1,104 @@
|
|
|
1
1
|
import { platform } from 'os';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
import * as https from 'https';
|
|
2
4
|
let VERSION = 'unknown';
|
|
3
5
|
try {
|
|
4
6
|
const versionModule = await import('./version.js');
|
|
5
7
|
VERSION = versionModule.VERSION;
|
|
6
8
|
}
|
|
7
9
|
catch {
|
|
10
|
+
// Continue without version info if not available
|
|
8
11
|
}
|
|
12
|
+
// Configuration
|
|
13
|
+
const GA_MEASUREMENT_ID = 'G-NGGDNL0K4L'; // Replace with your GA4 Measurement ID
|
|
14
|
+
const GA_API_SECRET = '5M0mC--2S_6t94m8WrI60A'; // Replace with your GA4 API Secret
|
|
15
|
+
const GA_BASE_URL = `https://www.google-analytics.com/mp/collect?measurement_id=${GA_MEASUREMENT_ID}&api_secret=${GA_API_SECRET}`;
|
|
9
16
|
// Set default tracking state
|
|
10
17
|
const isTrackingEnabled = true;
|
|
11
18
|
let uniqueUserId = 'unknown';
|
|
12
|
-
|
|
13
|
-
// Try to load PostHog without breaking if it's not available
|
|
19
|
+
// Try to generate a unique user ID without breaking if dependencies aren't available
|
|
14
20
|
try {
|
|
15
|
-
// Dynamic
|
|
16
|
-
import('
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// Access the default export from the module
|
|
20
|
-
uniqueUserId = machineIdModule.default.machineIdSync();
|
|
21
|
-
if (isTrackingEnabled) {
|
|
22
|
-
posthog = new PostHog('phc_BW8KJ0cajzj2v8qfMhvDQ4dtFdgHPzeYcMRvRFGvQdH', {
|
|
23
|
-
host: 'https://eu.i.posthog.com',
|
|
24
|
-
flushAt: 3, // send all every time
|
|
25
|
-
flushInterval: 5 // send always
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}).catch(() => {
|
|
29
|
-
// Silently fail - we don't want analytics issues to break functionality
|
|
30
|
-
});
|
|
21
|
+
// Dynamic import to prevent crashing if dependency isn't available
|
|
22
|
+
import('node-machine-id').then((machineIdModule) => {
|
|
23
|
+
// Access the default export from the module
|
|
24
|
+
uniqueUserId = machineIdModule.default.machineIdSync();
|
|
31
25
|
}).catch(() => {
|
|
32
|
-
//
|
|
26
|
+
// Fallback to a semi-random ID if machine-id isn't available
|
|
27
|
+
uniqueUserId = createHash('sha256')
|
|
28
|
+
.update(`${platform()}-${process.env.USER || process.env.USERNAME || 'user'}-${Date.now()}`)
|
|
29
|
+
.digest('hex');
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
32
|
catch {
|
|
36
|
-
//
|
|
33
|
+
// Fallback to a semi-random ID if import fails
|
|
34
|
+
uniqueUserId = createHash('sha256')
|
|
35
|
+
.update(`${platform()}-${process.env.USER || process.env.USERNAME || 'user'}-${Date.now()}`)
|
|
36
|
+
.digest('hex');
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Send an event to Google Analytics
|
|
40
|
+
* @param event Event name
|
|
41
|
+
* @param properties Optional event properties
|
|
42
|
+
*/
|
|
38
43
|
export const capture = (event, properties) => {
|
|
39
|
-
if (!
|
|
44
|
+
if (!isTrackingEnabled || !GA_MEASUREMENT_ID || !GA_API_SECRET) {
|
|
40
45
|
return;
|
|
41
46
|
}
|
|
42
47
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// Prepare standard properties
|
|
49
|
+
const baseProperties = {
|
|
50
|
+
timestamp: new Date().toISOString(),
|
|
51
|
+
platform: platform(),
|
|
52
|
+
app_version: VERSION,
|
|
53
|
+
engagement_time_msec: "100"
|
|
54
|
+
};
|
|
55
|
+
// Combine with custom properties
|
|
56
|
+
const eventProperties = {
|
|
57
|
+
...baseProperties,
|
|
58
|
+
...(properties || {})
|
|
59
|
+
};
|
|
60
|
+
// Prepare GA4 payload
|
|
61
|
+
const payload = {
|
|
62
|
+
client_id: uniqueUserId,
|
|
63
|
+
non_personalized_ads: false,
|
|
64
|
+
timestamp_micros: Date.now() * 1000,
|
|
65
|
+
events: [{
|
|
66
|
+
name: event,
|
|
67
|
+
params: eventProperties
|
|
68
|
+
}]
|
|
69
|
+
};
|
|
70
|
+
// Send data to Google Analytics
|
|
71
|
+
const postData = JSON.stringify(payload);
|
|
72
|
+
const options = {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: {
|
|
75
|
+
'Content-Type': 'application/json',
|
|
76
|
+
'Content-Length': Buffer.byteLength(postData)
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const req = https.request(GA_BASE_URL, options, (res) => {
|
|
80
|
+
// Response handling (optional)
|
|
81
|
+
let data = '';
|
|
82
|
+
res.on('data', (chunk) => {
|
|
83
|
+
data += chunk;
|
|
84
|
+
});
|
|
85
|
+
res.on('end', () => {
|
|
86
|
+
if (res.statusCode !== 200 && res.statusCode !== 204) {
|
|
87
|
+
// Optional debug logging
|
|
88
|
+
// console.debug(`GA tracking error: ${res.statusCode} ${data}`);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
req.on('error', () => {
|
|
93
|
+
// Silently fail - we don't want analytics issues to break functionality
|
|
94
|
+
});
|
|
95
|
+
// Set timeout to prevent blocking the app
|
|
96
|
+
req.setTimeout(3000, () => {
|
|
97
|
+
req.destroy();
|
|
51
98
|
});
|
|
99
|
+
// Send data
|
|
100
|
+
req.write(postData);
|
|
101
|
+
req.end();
|
|
52
102
|
}
|
|
53
103
|
catch {
|
|
54
104
|
// Silently fail - we don't want analytics issues to break functionality
|
|
@@ -65,13 +115,18 @@ export const capture = (event, properties) => {
|
|
|
65
115
|
* @returns Promise that resolves with the operation result or the default value on timeout
|
|
66
116
|
*/
|
|
67
117
|
export function withTimeout(operation, timeoutMs, operationName, defaultValue) {
|
|
68
|
-
return new Promise((resolve) => {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
69
119
|
let isCompleted = false;
|
|
70
120
|
// Set up timeout
|
|
71
121
|
const timeoutId = setTimeout(() => {
|
|
72
122
|
if (!isCompleted) {
|
|
73
123
|
isCompleted = true;
|
|
74
|
-
|
|
124
|
+
if (defaultValue !== null) {
|
|
125
|
+
resolve(defaultValue);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
reject(`__ERROR__: ${operationName} timed out after ${timeoutMs / 1000} seconds`);
|
|
129
|
+
}
|
|
75
130
|
}
|
|
76
131
|
}, timeoutMs);
|
|
77
132
|
// Execute the operation
|
|
@@ -87,7 +142,12 @@ export function withTimeout(operation, timeoutMs, operationName, defaultValue) {
|
|
|
87
142
|
if (!isCompleted) {
|
|
88
143
|
isCompleted = true;
|
|
89
144
|
clearTimeout(timeoutId);
|
|
90
|
-
|
|
145
|
+
if (defaultValue !== null) {
|
|
146
|
+
resolve(defaultValue);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
reject(error);
|
|
150
|
+
}
|
|
91
151
|
}
|
|
92
152
|
});
|
|
93
153
|
});
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.35";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.35';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wonderwhy-er/desktop-commander",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"description": "MCP server for terminal operations and file editing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eduards Ruzga",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"cross-fetch": "^4.1.0",
|
|
65
65
|
"glob": "^10.3.10",
|
|
66
66
|
"node-machine-id": "^1.1.12",
|
|
67
|
-
"posthog-node": "^4.11.1",
|
|
68
67
|
"zod": "^3.24.1",
|
|
69
68
|
"zod-to-json-schema": "^3.23.5"
|
|
70
69
|
},
|