@wonderwhy-er/desktop-commander 0.2.18-alpha.12 → 0.2.18-alpha.14
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/dist/setup-claude-server.js +29 -102
- package/dist/setup.log +84 -0
- package/dist/test-setup.js +14 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -207,96 +207,41 @@ function detectShell() {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// Function to get the package spec that was used to run this script
|
|
210
|
-
function getPackageSpec() {
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
try {
|
|
216
|
-
appendFileSync(debugFile, `${msg}\n`);
|
|
217
|
-
} catch (e) { /* ignore */ }
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
debug('\n[DEBUG getPackageSpec] Starting detection...');
|
|
221
|
-
debug(`[DEBUG getPackageSpec] process.argv: ${JSON.stringify(process.argv)}`);
|
|
222
|
-
debug(`[DEBUG getPackageSpec] __dirname: ${__dirname}`);
|
|
223
|
-
debug(`[DEBUG getPackageSpec] __filename: ${__filename}`);
|
|
224
|
-
|
|
225
|
-
// Strategy: Check multiple sources to detect the version
|
|
226
|
-
// 1. Check process.argv[1] which contains the actual script path
|
|
227
|
-
// 2. Check package.json in the script's directory
|
|
228
|
-
// 3. Fall back to @latest for stable, keep version for pre-release
|
|
229
|
-
|
|
230
|
-
// Method 1: Check the script path (process.argv[1] or __dirname)
|
|
231
|
-
// npx extracts packages to: ~/.npm/_npx/<hash>/node_modules/@scope/package-name/
|
|
232
|
-
// The actual script path will contain this structure
|
|
233
|
-
const scriptPath = __dirname;
|
|
234
|
-
debug('[DEBUG getPackageSpec] Checking script path for version...');
|
|
235
|
-
|
|
236
|
-
// Look for node_modules/@wonderwhy-er/desktop-commander in the path
|
|
237
|
-
// This works because npx extracts to a predictable location
|
|
238
|
-
const nodeModulesMatch = scriptPath.match(/node_modules\/@wonderwhy-er\/desktop-commander/);
|
|
239
|
-
if (nodeModulesMatch) {
|
|
240
|
-
debug('[DEBUG getPackageSpec] Script is in node_modules, reading package.json...');
|
|
210
|
+
function getPackageSpec(versionArg = null) {
|
|
211
|
+
// If explicit version/tag argument provided, use it
|
|
212
|
+
// Usage: npx @wonderwhy-er/desktop-commander setup alpha
|
|
213
|
+
if (versionArg) {
|
|
214
|
+
return `@wonderwhy-er/desktop-commander@${versionArg}`;
|
|
241
215
|
}
|
|
242
216
|
|
|
243
|
-
//
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
if (version.includes('alpha') || version.includes('beta') || version.includes('rc')) {
|
|
256
|
-
const spec = `@wonderwhy-er/desktop-commander@${version}`;
|
|
257
|
-
debug(`[DEBUG getPackageSpec] ✓ Using pre-release version: ${spec}`);
|
|
258
|
-
return spec;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// For stable versions, use @latest tag
|
|
262
|
-
debug('[DEBUG getPackageSpec] ✓ Stable version, using @latest');
|
|
263
|
-
return '@wonderwhy-er/desktop-commander@latest';
|
|
217
|
+
// Check if running via npx - look for the package spec in process.argv
|
|
218
|
+
// e.g., npx @wonderwhy-er/desktop-commander@0.2.18-alpha setup
|
|
219
|
+
const argv = process.argv;
|
|
220
|
+
|
|
221
|
+
// Look for the package name in argv
|
|
222
|
+
for (let i = 0; i < argv.length; i++) {
|
|
223
|
+
const arg = argv[i];
|
|
224
|
+
if (arg.includes('@wonderwhy-er/desktop-commander')) {
|
|
225
|
+
// Extract just the package spec (e.g., @wonderwhy-er/desktop-commander@0.2.18-alpha)
|
|
226
|
+
const match = arg.match(/(@wonderwhy-er\/desktop-commander(@[^\/\s]+)?)/);
|
|
227
|
+
if (match) {
|
|
228
|
+
return match[1];
|
|
264
229
|
}
|
|
265
|
-
} else {
|
|
266
|
-
debug('[DEBUG getPackageSpec] ✗ package.json not found');
|
|
267
230
|
}
|
|
268
|
-
} catch (error) {
|
|
269
|
-
debug(`[DEBUG getPackageSpec] ✗ Error reading package.json: ${error.message}`);
|
|
270
231
|
}
|
|
271
232
|
|
|
272
|
-
// Fallback
|
|
273
|
-
debug('[DEBUG getPackageSpec] ⚠ Falling back to @latest');
|
|
233
|
+
// Fallback to @latest if we can't detect
|
|
274
234
|
return '@wonderwhy-er/desktop-commander@latest';
|
|
275
235
|
}
|
|
276
236
|
|
|
277
237
|
// Function to determine execution context
|
|
278
238
|
function getExecutionContext() {
|
|
279
|
-
const debugFile = '/tmp/dc-setup-debug.log';
|
|
280
|
-
try {
|
|
281
|
-
appendFileSync(debugFile, `\n=== getExecutionContext ===\n`);
|
|
282
|
-
appendFileSync(debugFile, `process.env.npm_lifecycle_event: ${process.env.npm_lifecycle_event}\n`);
|
|
283
|
-
appendFileSync(debugFile, `process.env.npm_execpath: ${process.env.npm_execpath}\n`);
|
|
284
|
-
appendFileSync(debugFile, `process.env._: ${process.env._}\n`);
|
|
285
|
-
appendFileSync(debugFile, `import.meta.url: ${import.meta.url}\n`);
|
|
286
|
-
appendFileSync(debugFile, `__dirname: ${__dirname}\n`);
|
|
287
|
-
} catch (e) { /* ignore */ }
|
|
288
|
-
|
|
289
239
|
// Check if running from npx
|
|
290
240
|
const isNpx = process.env.npm_lifecycle_event === 'npx' ||
|
|
291
241
|
process.env.npm_execpath?.includes('npx') ||
|
|
292
242
|
process.env._?.includes('npx') ||
|
|
293
243
|
import.meta.url.includes('node_modules');
|
|
294
244
|
|
|
295
|
-
try {
|
|
296
|
-
appendFileSync(debugFile, `isNpx: ${isNpx}\n`);
|
|
297
|
-
appendFileSync(debugFile, `======================\n\n`);
|
|
298
|
-
} catch (e) { /* ignore */ }
|
|
299
|
-
|
|
300
245
|
// Check if installed globally
|
|
301
246
|
const isGlobal = process.env.npm_config_global === 'true' ||
|
|
302
247
|
process.argv[1]?.includes('node_modules/.bin');
|
|
@@ -305,7 +250,6 @@ function getExecutionContext() {
|
|
|
305
250
|
const isNpmScript = !!process.env.npm_lifecycle_script;
|
|
306
251
|
|
|
307
252
|
return {
|
|
308
|
-
isNpx,
|
|
309
253
|
runMethod: isNpx ? 'npx' : (isGlobal ? 'global' : (isNpmScript ? 'npm_script' : 'direct')),
|
|
310
254
|
isCI: !!process.env.CI || !!process.env.GITHUB_ACTIONS || !!process.env.TRAVIS || !!process.env.CIRCLECI,
|
|
311
255
|
shell: detectShell()
|
|
@@ -696,19 +640,21 @@ async function restartClaude() {
|
|
|
696
640
|
|
|
697
641
|
// Main function to export for ESM compatibility
|
|
698
642
|
export default async function setup() {
|
|
699
|
-
//
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
643
|
+
// Parse command line arguments for version/tag
|
|
644
|
+
// Usage: npx -y -p @wonderwhy-er/desktop-commander@alpha setup
|
|
645
|
+
// or: npx -y -p @wonderwhy-er/desktop-commander setup alpha
|
|
646
|
+
const versionArg = process.argv[2]; // argv[0]=node, argv[1]=script, argv[2]=version/tag
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
706
650
|
// Add tracking for setup function entry
|
|
707
651
|
await trackEvent('npx_setup_function_started');
|
|
708
652
|
|
|
709
653
|
const setupStep = addSetupStep('main_setup');
|
|
710
654
|
const debugMode = isDebugMode();
|
|
711
655
|
|
|
656
|
+
console.log("Args", process.argv);
|
|
657
|
+
|
|
712
658
|
// Print ASCII art for DESKTOP COMMANDER
|
|
713
659
|
console.log('\n');
|
|
714
660
|
console.log('██████╗ ███████╗███████╗██╗ ██╗████████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗ █████╗ ███╗ ██╗██████╗ ███████╗██████╗ ');
|
|
@@ -802,8 +748,6 @@ export default async function setup() {
|
|
|
802
748
|
|
|
803
749
|
// Determine if running through npx or locally
|
|
804
750
|
const isNpx = import.meta.url.includes('node_modules');
|
|
805
|
-
logToFile(`\n[SETUP] import.meta.url: ${import.meta.url}\n`);
|
|
806
|
-
logToFile(`[SETUP] isNpx: ${isNpx}\n`);
|
|
807
751
|
await trackEvent('npx_setup_execution_mode', { isNpx });
|
|
808
752
|
|
|
809
753
|
// Fix Windows path handling for npx execution
|
|
@@ -821,7 +765,7 @@ export default async function setup() {
|
|
|
821
765
|
"DEBUG": "*"
|
|
822
766
|
};
|
|
823
767
|
|
|
824
|
-
const packageSpec = getPackageSpec();
|
|
768
|
+
const packageSpec = getPackageSpec(versionArg);
|
|
825
769
|
serverConfig = {
|
|
826
770
|
"command": isWindows ? "node.exe" : "node",
|
|
827
771
|
"args": [
|
|
@@ -857,22 +801,13 @@ export default async function setup() {
|
|
|
857
801
|
} else {
|
|
858
802
|
// Standard configuration without debug
|
|
859
803
|
if (isNpx) {
|
|
860
|
-
const packageSpec = getPackageSpec();
|
|
861
|
-
const debugFile = '/tmp/dc-setup-debug.log';
|
|
862
|
-
try {
|
|
863
|
-
appendFileSync(debugFile, `\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
|
|
864
|
-
} catch (e) { /* ignore */ }
|
|
865
|
-
logToFile(`\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
|
|
804
|
+
const packageSpec = getPackageSpec(versionArg);
|
|
866
805
|
serverConfig = {
|
|
867
806
|
"command": isWindows ? "npx.cmd" : "npx",
|
|
868
807
|
"args": [
|
|
869
808
|
packageSpec
|
|
870
809
|
]
|
|
871
810
|
};
|
|
872
|
-
try {
|
|
873
|
-
appendFileSync(debugFile, `[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
|
|
874
|
-
} catch (e) { /* ignore */ }
|
|
875
|
-
logToFile(`[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
|
|
876
811
|
await trackEvent('npx_setup_config_standard_npx', { packageSpec });
|
|
877
812
|
} else {
|
|
878
813
|
// For local installation, use absolute path to handle Windows properly
|
|
@@ -910,16 +845,8 @@ export default async function setup() {
|
|
|
910
845
|
// Add or update the terminal server config with the proper name "desktop-commander"
|
|
911
846
|
config.mcpServers["desktop-commander"] = serverConfig;
|
|
912
847
|
|
|
913
|
-
logToFile('\n[SETUP] Writing config to Claude:\n');
|
|
914
|
-
logToFile(`[SETUP] desktop-commander args: ${JSON.stringify(config.mcpServers["desktop-commander"].args)}\n`);
|
|
915
|
-
|
|
916
848
|
// Write the updated config back
|
|
917
849
|
writeFileSync(claudeConfigPath, JSON.stringify(config, null, 2), 'utf8');
|
|
918
|
-
|
|
919
|
-
// Verify what was written
|
|
920
|
-
const writtenConfig = JSON.parse(readFileSync(claudeConfigPath, 'utf8'));
|
|
921
|
-
logToFile(`[SETUP] Verified written args: ${JSON.stringify(writtenConfig.mcpServers["desktop-commander"].args)}\n\n`);
|
|
922
|
-
|
|
923
850
|
updateSetupStep(updateConfigStep, 'completed');
|
|
924
851
|
await trackEvent('npx_setup_update_config');
|
|
925
852
|
} catch (updateError) {
|
package/dist/setup.log
CHANGED
|
@@ -82,3 +82,87 @@ The server is available as "desktop-commander" in Claude's MCP server list
|
|
|
82
82
|
2025-10-22T15:22:46.665Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
2025-10-23T10:10:37.029Z - ✅ Desktop Commander MCP v0.2.18-alpha.13 successfully added to Claude’s configuration.
|
|
86
|
+
2025-10-23T10:10:37.030Z - Configuration location: /Users/fiberta/Library/Application Support/Claude/claude_desktop_config.json
|
|
87
|
+
2025-10-23T10:10:40.163Z -
|
|
88
|
+
✅ Claude has been restarted automatically!
|
|
89
|
+
2025-10-23T10:10:40.184Z -
|
|
90
|
+
✅ Installation successfully completed! Thank you for using Desktop Commander!
|
|
91
|
+
|
|
92
|
+
2025-10-23T10:10:40.184Z -
|
|
93
|
+
The server is available as "desktop-commander" in Claude's MCP server list
|
|
94
|
+
2025-10-23T10:10:40.184Z - Future updates will install automatically — no need to run this setup again.
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
2025-10-23T10:10:40.184Z - 🤔 Need help or have feedback? Happy to jump on a quick call:
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
2025-10-23T10:10:40.184Z - https://calendar.app.google/SHMNZN5MJznJWC5A7
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
2025-10-23T10:10:40.184Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
2025-10-23T10:11:28.520Z - ✅ Desktop Commander MCP v0.2.18-alpha.13 successfully added to Claude’s configuration.
|
|
107
|
+
2025-10-23T10:11:28.520Z - Configuration location: /Users/fiberta/Library/Application Support/Claude/claude_desktop_config.json
|
|
108
|
+
2025-10-23T10:11:31.626Z -
|
|
109
|
+
✅ Claude has been restarted automatically!
|
|
110
|
+
2025-10-23T10:11:31.645Z -
|
|
111
|
+
✅ Installation successfully completed! Thank you for using Desktop Commander!
|
|
112
|
+
|
|
113
|
+
2025-10-23T10:11:31.645Z -
|
|
114
|
+
The server is available as "desktop-commander" in Claude's MCP server list
|
|
115
|
+
2025-10-23T10:11:31.645Z - Future updates will install automatically — no need to run this setup again.
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
2025-10-23T10:11:31.645Z - 🤔 Need help or have feedback? Happy to jump on a quick call:
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
2025-10-23T10:11:31.645Z - https://calendar.app.google/SHMNZN5MJznJWC5A7
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
2025-10-23T10:11:31.645Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
2025-10-23T10:19:51.580Z - ✅ Desktop Commander MCP v0.2.18-alpha.13 successfully added to Claude’s configuration.
|
|
128
|
+
2025-10-23T10:19:51.580Z - Configuration location: /Users/fiberta/Library/Application Support/Claude/claude_desktop_config.json
|
|
129
|
+
2025-10-23T10:19:54.733Z -
|
|
130
|
+
✅ Claude has been restarted automatically!
|
|
131
|
+
2025-10-23T10:19:54.755Z -
|
|
132
|
+
✅ Installation successfully completed! Thank you for using Desktop Commander!
|
|
133
|
+
|
|
134
|
+
2025-10-23T10:19:54.755Z -
|
|
135
|
+
The server is available as "desktop-commander" in Claude's MCP server list
|
|
136
|
+
2025-10-23T10:19:54.756Z - Future updates will install automatically — no need to run this setup again.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
2025-10-23T10:19:54.756Z - 🤔 Need help or have feedback? Happy to jump on a quick call:
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
2025-10-23T10:19:54.756Z - https://calendar.app.google/SHMNZN5MJznJWC5A7
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
2025-10-23T10:19:54.756Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
2025-10-23T10:20:46.785Z - ✅ Desktop Commander MCP v0.2.18-alpha.13 successfully added to Claude’s configuration.
|
|
149
|
+
2025-10-23T10:20:46.785Z - Configuration location: /Users/fiberta/Library/Application Support/Claude/claude_desktop_config.json
|
|
150
|
+
2025-10-23T10:20:49.891Z -
|
|
151
|
+
✅ Claude has been restarted automatically!
|
|
152
|
+
2025-10-23T10:20:49.913Z -
|
|
153
|
+
✅ Installation successfully completed! Thank you for using Desktop Commander!
|
|
154
|
+
|
|
155
|
+
2025-10-23T10:20:49.913Z -
|
|
156
|
+
The server is available as "desktop-commander" in Claude's MCP server list
|
|
157
|
+
2025-10-23T10:20:49.913Z - Future updates will install automatically — no need to run this setup again.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
2025-10-23T10:20:49.913Z - 🤔 Need help or have feedback? Happy to jump on a quick call:
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
2025-10-23T10:20:49.913Z - https://calendar.app.google/SHMNZN5MJznJWC5A7
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
2025-10-23T10:20:49.913Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
167
|
+
|
|
168
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Test what argv looks like when called as a bin script
|
|
4
|
+
console.log('=== Test Script Argv ===');
|
|
5
|
+
console.log('process.argv:');
|
|
6
|
+
process.argv.forEach((arg, index) => {
|
|
7
|
+
console.log(` ${index}: "${arg}"`);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
const versionArg2 = process.argv[2];
|
|
11
|
+
const versionArg3 = process.argv[3];
|
|
12
|
+
|
|
13
|
+
console.log('\nUsing argv[2]:', versionArg2);
|
|
14
|
+
console.log('Using argv[3]:', versionArg3);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.2.18-alpha.
|
|
1
|
+
export declare const VERSION = "0.2.18-alpha.13";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.18-alpha.
|
|
1
|
+
export const VERSION = '0.2.18-alpha.13';
|
package/package.json
CHANGED