@wonderwhy-er/desktop-commander 0.2.18-alpha.10 → 0.2.18-alpha.12

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.
@@ -276,12 +276,27 @@ function getPackageSpec() {
276
276
 
277
277
  // Function to determine execution context
278
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
+
279
289
  // Check if running from npx
280
290
  const isNpx = process.env.npm_lifecycle_event === 'npx' ||
281
291
  process.env.npm_execpath?.includes('npx') ||
282
292
  process.env._?.includes('npx') ||
283
293
  import.meta.url.includes('node_modules');
284
294
 
295
+ try {
296
+ appendFileSync(debugFile, `isNpx: ${isNpx}\n`);
297
+ appendFileSync(debugFile, `======================\n\n`);
298
+ } catch (e) { /* ignore */ }
299
+
285
300
  // Check if installed globally
286
301
  const isGlobal = process.env.npm_config_global === 'true' ||
287
302
  process.argv[1]?.includes('node_modules/.bin');
@@ -290,6 +305,7 @@ function getExecutionContext() {
290
305
  const isNpmScript = !!process.env.npm_lifecycle_script;
291
306
 
292
307
  return {
308
+ isNpx,
293
309
  runMethod: isNpx ? 'npx' : (isGlobal ? 'global' : (isNpmScript ? 'npm_script' : 'direct')),
294
310
  isCI: !!process.env.CI || !!process.env.GITHUB_ACTIONS || !!process.env.TRAVIS || !!process.env.CIRCLECI,
295
311
  shell: detectShell()
@@ -681,11 +697,11 @@ async function restartClaude() {
681
697
  // Main function to export for ESM compatibility
682
698
  export default async function setup() {
683
699
  // VERY FIRST THING - test if stderr works AT ALL
684
- process.stderr.write('\n\n========== SETUP FUNCTION STARTED ==========\n');
685
- process.stderr.write(`__dirname: ${__dirname}\n`);
686
- process.stderr.write(`__filename: ${__filename}\n`);
687
- process.stderr.write(`process.argv: ${JSON.stringify(process.argv)}\n`);
688
- process.stderr.write('=============================================\n\n');
700
+ logToFile('\n\n========== SETUP FUNCTION STARTED ==========\n');
701
+ logToFile(`__dirname: ${__dirname}\n`);
702
+ logToFile(`__filename: ${__filename}\n`);
703
+ logToFile(`process.argv: ${JSON.stringify(process.argv)}\n`);
704
+ logToFile('=============================================\n\n');
689
705
 
690
706
  // Add tracking for setup function entry
691
707
  await trackEvent('npx_setup_function_started');
@@ -786,8 +802,8 @@ export default async function setup() {
786
802
 
787
803
  // Determine if running through npx or locally
788
804
  const isNpx = import.meta.url.includes('node_modules');
789
- process.stderr.write(`\n[SETUP] import.meta.url: ${import.meta.url}\n`);
790
- process.stderr.write(`[SETUP] isNpx: ${isNpx}\n`);
805
+ logToFile(`\n[SETUP] import.meta.url: ${import.meta.url}\n`);
806
+ logToFile(`[SETUP] isNpx: ${isNpx}\n`);
791
807
  await trackEvent('npx_setup_execution_mode', { isNpx });
792
808
 
793
809
  // Fix Windows path handling for npx execution
@@ -846,7 +862,7 @@ export default async function setup() {
846
862
  try {
847
863
  appendFileSync(debugFile, `\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
848
864
  } catch (e) { /* ignore */ }
849
- process.stderr.write(`\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
865
+ logToFile(`\n[SETUP] Creating config with package spec: ${packageSpec}\n`);
850
866
  serverConfig = {
851
867
  "command": isWindows ? "npx.cmd" : "npx",
852
868
  "args": [
@@ -856,7 +872,7 @@ export default async function setup() {
856
872
  try {
857
873
  appendFileSync(debugFile, `[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
858
874
  } catch (e) { /* ignore */ }
859
- process.stderr.write(`[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
875
+ logToFile(`[SETUP] serverConfig.args: ${JSON.stringify(serverConfig.args)}\n`);
860
876
  await trackEvent('npx_setup_config_standard_npx', { packageSpec });
861
877
  } else {
862
878
  // For local installation, use absolute path to handle Windows properly
@@ -894,15 +910,15 @@ export default async function setup() {
894
910
  // Add or update the terminal server config with the proper name "desktop-commander"
895
911
  config.mcpServers["desktop-commander"] = serverConfig;
896
912
 
897
- process.stderr.write('\n[SETUP] Writing config to Claude:\n');
898
- process.stderr.write(`[SETUP] desktop-commander args: ${JSON.stringify(config.mcpServers["desktop-commander"].args)}\n`);
913
+ logToFile('\n[SETUP] Writing config to Claude:\n');
914
+ logToFile(`[SETUP] desktop-commander args: ${JSON.stringify(config.mcpServers["desktop-commander"].args)}\n`);
899
915
 
900
916
  // Write the updated config back
901
917
  writeFileSync(claudeConfigPath, JSON.stringify(config, null, 2), 'utf8');
902
918
 
903
919
  // Verify what was written
904
920
  const writtenConfig = JSON.parse(readFileSync(claudeConfigPath, 'utf8'));
905
- process.stderr.write(`[SETUP] Verified written args: ${JSON.stringify(writtenConfig.mcpServers["desktop-commander"].args)}\n\n`);
921
+ logToFile(`[SETUP] Verified written args: ${JSON.stringify(writtenConfig.mcpServers["desktop-commander"].args)}\n\n`);
906
922
 
907
923
  updateSetupStep(updateConfigStep, 'completed');
908
924
  await trackEvent('npx_setup_update_config');
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.2.18-alpha.10";
1
+ export declare const VERSION = "0.2.18-alpha.12";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.18-alpha.10';
1
+ export const VERSION = '0.2.18-alpha.12';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.2.18-alpha.10",
3
+ "version": "0.2.18-alpha.12",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "mcpName": "io.github.wonderwhy-er/desktop-commander",
6
6
  "license": "MIT",