@wonderwhy-er/desktop-commander 0.2.18-alpha.1 → 0.2.18-alpha.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.
- package/dist/setup-claude-server.js +99 -25
- package/dist/setup.log +21 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -208,48 +208,95 @@ function detectShell() {
|
|
|
208
208
|
|
|
209
209
|
// Function to get the package spec that was used to run this script
|
|
210
210
|
function getPackageSpec() {
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
const
|
|
211
|
+
// Write to a debug file that we can check
|
|
212
|
+
const debugFile = '/tmp/dc-setup-debug.log';
|
|
213
|
+
const debug = (msg) => {
|
|
214
|
+
process.stderr.write(`${msg}\n`);
|
|
215
|
+
try {
|
|
216
|
+
appendFileSync(debugFile, `${msg}\n`);
|
|
217
|
+
} catch (e) { /* ignore */ }
|
|
218
|
+
};
|
|
214
219
|
|
|
215
|
-
|
|
216
|
-
|
|
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}`);
|
|
217
224
|
|
|
218
|
-
//
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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...');
|
|
229
241
|
}
|
|
230
242
|
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
// Method 2: Read package.json to get the actual installed version
|
|
244
|
+
try {
|
|
245
|
+
const packageJsonPath = join(__dirname, 'package.json');
|
|
246
|
+
debug(`[DEBUG getPackageSpec] Trying to read: ${packageJsonPath}`);
|
|
247
|
+
|
|
248
|
+
if (existsSync(packageJsonPath)) {
|
|
249
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
250
|
+
const version = packageJson.version;
|
|
251
|
+
debug(`[DEBUG getPackageSpec] Found version in package.json: ${version}`);
|
|
252
|
+
|
|
253
|
+
if (version) {
|
|
254
|
+
// Always use the exact version if it's a pre-release
|
|
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';
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
debug('[DEBUG getPackageSpec] ✗ package.json not found');
|
|
267
|
+
}
|
|
268
|
+
} catch (error) {
|
|
269
|
+
debug(`[DEBUG getPackageSpec] ✗ Error reading package.json: ${error.message}`);
|
|
238
270
|
}
|
|
239
271
|
|
|
240
|
-
|
|
241
|
-
|
|
272
|
+
// Fallback
|
|
273
|
+
debug('[DEBUG getPackageSpec] ⚠ Falling back to @latest');
|
|
242
274
|
return '@wonderwhy-er/desktop-commander@latest';
|
|
243
275
|
}
|
|
244
276
|
|
|
245
277
|
// Function to determine execution context
|
|
246
278
|
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
|
+
|
|
247
289
|
// Check if running from npx
|
|
248
290
|
const isNpx = process.env.npm_lifecycle_event === 'npx' ||
|
|
249
291
|
process.env.npm_execpath?.includes('npx') ||
|
|
250
292
|
process.env._?.includes('npx') ||
|
|
251
293
|
import.meta.url.includes('node_modules');
|
|
252
294
|
|
|
295
|
+
try {
|
|
296
|
+
appendFileSync(debugFile, `isNpx: ${isNpx}\n`);
|
|
297
|
+
appendFileSync(debugFile, `======================\n\n`);
|
|
298
|
+
} catch (e) { /* ignore */ }
|
|
299
|
+
|
|
253
300
|
// Check if installed globally
|
|
254
301
|
const isGlobal = process.env.npm_config_global === 'true' ||
|
|
255
302
|
process.argv[1]?.includes('node_modules/.bin');
|
|
@@ -258,6 +305,7 @@ function getExecutionContext() {
|
|
|
258
305
|
const isNpmScript = !!process.env.npm_lifecycle_script;
|
|
259
306
|
|
|
260
307
|
return {
|
|
308
|
+
isNpx,
|
|
261
309
|
runMethod: isNpx ? 'npx' : (isGlobal ? 'global' : (isNpmScript ? 'npm_script' : 'direct')),
|
|
262
310
|
isCI: !!process.env.CI || !!process.env.GITHUB_ACTIONS || !!process.env.TRAVIS || !!process.env.CIRCLECI,
|
|
263
311
|
shell: detectShell()
|
|
@@ -648,6 +696,13 @@ async function restartClaude() {
|
|
|
648
696
|
|
|
649
697
|
// Main function to export for ESM compatibility
|
|
650
698
|
export default async function setup() {
|
|
699
|
+
// VERY FIRST THING - test if stderr works AT ALL
|
|
700
|
+
process.stderr.write('\n\n========== SETUP FUNCTION STARTED ==========\n');
|
|
701
|
+
process.stderr.write(`__dirname: ${__dirname}\n`);
|
|
702
|
+
process.stderr.write(`__filename: ${__filename}\n`);
|
|
703
|
+
process.stderr.write(`process.argv: ${JSON.stringify(process.argv)}\n`);
|
|
704
|
+
process.stderr.write('=============================================\n\n');
|
|
705
|
+
|
|
651
706
|
// Add tracking for setup function entry
|
|
652
707
|
await trackEvent('npx_setup_function_started');
|
|
653
708
|
|
|
@@ -747,6 +802,8 @@ export default async function setup() {
|
|
|
747
802
|
|
|
748
803
|
// Determine if running through npx or locally
|
|
749
804
|
const isNpx = import.meta.url.includes('node_modules');
|
|
805
|
+
process.stderr.write(`\n[SETUP] import.meta.url: ${import.meta.url}\n`);
|
|
806
|
+
process.stderr.write(`[SETUP] isNpx: ${isNpx}\n`);
|
|
750
807
|
await trackEvent('npx_setup_execution_mode', { isNpx });
|
|
751
808
|
|
|
752
809
|
// Fix Windows path handling for npx execution
|
|
@@ -801,12 +858,21 @@ export default async function setup() {
|
|
|
801
858
|
// Standard configuration without debug
|
|
802
859
|
if (isNpx) {
|
|
803
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
|
+
process.stderr.write(`\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
|
|
804
866
|
serverConfig = {
|
|
805
867
|
"command": isWindows ? "npx.cmd" : "npx",
|
|
806
868
|
"args": [
|
|
807
869
|
packageSpec
|
|
808
870
|
]
|
|
809
871
|
};
|
|
872
|
+
try {
|
|
873
|
+
appendFileSync(debugFile, `[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
|
|
874
|
+
} catch (e) { /* ignore */ }
|
|
875
|
+
process.stderr.write(`[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
|
|
810
876
|
await trackEvent('npx_setup_config_standard_npx', { packageSpec });
|
|
811
877
|
} else {
|
|
812
878
|
// For local installation, use absolute path to handle Windows properly
|
|
@@ -844,8 +910,16 @@ export default async function setup() {
|
|
|
844
910
|
// Add or update the terminal server config with the proper name "desktop-commander"
|
|
845
911
|
config.mcpServers["desktop-commander"] = serverConfig;
|
|
846
912
|
|
|
913
|
+
process.stderr.write('\n[SETUP] Writing config to Claude:\n');
|
|
914
|
+
process.stderr.write(`[SETUP] desktop-commander args: ${JSON.stringify(config.mcpServers["desktop-commander"].args)}\n`);
|
|
915
|
+
|
|
847
916
|
// Write the updated config back
|
|
848
917
|
writeFileSync(claudeConfigPath, JSON.stringify(config, null, 2), 'utf8');
|
|
918
|
+
|
|
919
|
+
// Verify what was written
|
|
920
|
+
const writtenConfig = JSON.parse(readFileSync(claudeConfigPath, 'utf8'));
|
|
921
|
+
process.stderr.write(`[SETUP] Verified written args: ${JSON.stringify(writtenConfig.mcpServers["desktop-commander"].args)}\n\n`);
|
|
922
|
+
|
|
849
923
|
updateSetupStep(updateConfigStep, 'completed');
|
|
850
924
|
await trackEvent('npx_setup_update_config');
|
|
851
925
|
} catch (updateError) {
|
package/dist/setup.log
CHANGED
|
@@ -61,3 +61,24 @@ The server is available as "desktop-commander" in Claude's MCP server list
|
|
|
61
61
|
2025-08-21T15:01:43.932Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
2025-10-22T15:22:43.506Z - ✅ Desktop Commander MCP v0.2.18-alpha.6 successfully added to Claude’s configuration.
|
|
65
|
+
2025-10-22T15:22:43.507Z - Configuration location: /Users/fiberta/Library/Application Support/Claude/claude_desktop_config.json
|
|
66
|
+
2025-10-22T15:22:46.639Z -
|
|
67
|
+
✅ Claude has been restarted automatically!
|
|
68
|
+
2025-10-22T15:22:46.664Z -
|
|
69
|
+
✅ Installation successfully completed! Thank you for using Desktop Commander!
|
|
70
|
+
|
|
71
|
+
2025-10-22T15:22:46.664Z -
|
|
72
|
+
The server is available as "desktop-commander" in Claude's MCP server list
|
|
73
|
+
2025-10-22T15:22:46.665Z - Future updates will install automatically — no need to run this setup again.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
2025-10-22T15:22:46.665Z - 🤔 Need help or have feedback? Happy to jump on a quick call:
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
2025-10-22T15:22:46.665Z - https://calendar.app.google/SHMNZN5MJznJWC5A7
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
2025-10-22T15:22:46.665Z - or join our community: https://discord.com/invite/kQ27sNnZr7
|
|
83
|
+
|
|
84
|
+
|
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.11";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.18-alpha.
|
|
1
|
+
export const VERSION = '0.2.18-alpha.11';
|
package/package.json
CHANGED