@wonderwhy-er/desktop-commander 0.1.29 → 0.1.30

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.
@@ -46,6 +46,15 @@ async function getNpmVersion() {
46
46
  }
47
47
  }
48
48
 
49
+ const getVersion = async () => {
50
+ try {
51
+ const packageJson = await import('./package.json', { assert: { type: 'json' } });
52
+ return packageJson.default.version;
53
+ } catch {
54
+ return 'unknown'
55
+ }
56
+ };
57
+
49
58
  // Function to detect shell environment
50
59
  function detectShell() {
51
60
  // Check for Windows shells
@@ -115,7 +124,7 @@ async function getTrackingProperties(additionalProps = {}) {
115
124
  }
116
125
 
117
126
  const context = getExecutionContext();
118
-
127
+ const version = await getVersion();
119
128
  return {
120
129
  platform: platform(),
121
130
  nodeVersion: nodeVersion,
@@ -123,6 +132,7 @@ async function getTrackingProperties(additionalProps = {}) {
123
132
  executionContext: context.runMethod,
124
133
  isCI: context.isCI,
125
134
  shell: context.shell,
135
+ DCVersion: version,
126
136
  timestamp: new Date().toISOString(),
127
137
  ...additionalProps
128
138
  };
@@ -40,8 +40,8 @@ export async function validatePath(requestedPath) {
40
40
  return await fs.realpath(absolute);
41
41
  }
42
42
  catch (error) {
43
- // return path if it's not exist. This will be used for folder creation and many other file operations
44
- return absolute;
43
+ // Path doesn't exist, throw an error
44
+ throw new Error(`Path does not exist: ${absolute}`);
45
45
  }
46
46
  /* Original implementation commented out for future reference
47
47
  const expandedPath = expandHome(requestedPath);
@@ -0,0 +1,2 @@
1
+ export declare function getMimeType(filePath: string): string;
2
+ export declare function isImageFile(mimeType: string): boolean;
@@ -0,0 +1,27 @@
1
+ // Simple MIME type detection based on file extension
2
+ export function getMimeType(filePath) {
3
+ const extension = filePath.toLowerCase().split('.').pop() || '';
4
+ // Image types
5
+ const imageTypes = {
6
+ 'png': 'image/png',
7
+ 'jpg': 'image/jpeg',
8
+ 'jpeg': 'image/jpeg',
9
+ 'gif': 'image/gif',
10
+ 'bmp': 'image/bmp',
11
+ 'svg': 'image/svg+xml',
12
+ 'webp': 'image/webp',
13
+ 'ico': 'image/x-icon',
14
+ 'tif': 'image/tiff',
15
+ 'tiff': 'image/tiff',
16
+ };
17
+ // Text types - consider everything else as text for simplicity
18
+ // Check if the file is an image
19
+ if (extension in imageTypes) {
20
+ return imageTypes[extension];
21
+ }
22
+ // Default to text/plain for all other files
23
+ return 'text/plain';
24
+ }
25
+ export function isImageFile(mimeType) {
26
+ return mimeType.startsWith('image/');
27
+ }
package/dist/utils.js CHANGED
@@ -1,4 +1,11 @@
1
1
  import { platform } from 'os';
2
+ let VERSION = 'unknown';
3
+ try {
4
+ const versionModule = await import('./version.js');
5
+ VERSION = versionModule.VERSION;
6
+ }
7
+ catch {
8
+ }
2
9
  // Set default tracking state
3
10
  const isTrackingEnabled = true;
4
11
  let uniqueUserId = 'unknown';
@@ -25,7 +32,7 @@ try {
25
32
  // Silently fail - we don't want analytics issues to break functionality
26
33
  });
27
34
  }
28
- catch (error) {
35
+ catch {
29
36
  //console.log('Analytics module not available - continuing without tracking');
30
37
  }
31
38
  export const capture = (event, properties) => {
@@ -36,14 +43,14 @@ export const capture = (event, properties) => {
36
43
  properties = properties || {};
37
44
  properties.timestamp = new Date().toISOString();
38
45
  properties.platform = platform();
46
+ properties.DCVersion = VERSION;
39
47
  posthog.capture({
40
48
  distinctId: uniqueUserId,
41
49
  event,
42
50
  properties
43
51
  });
44
52
  }
45
- catch (error) {
53
+ catch {
46
54
  // Silently fail - we don't want analytics issues to break functionality
47
- console.error('Analytics tracking failed:', error);
48
55
  }
49
56
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.29";
1
+ export declare const VERSION = "0.1.30";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.29';
1
+ export const VERSION = '0.1.30';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "license": "MIT",
6
6
  "author": "Eduards Ruzga",
@@ -70,7 +70,6 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/node": "^20.17.24",
73
- "nexe": "^5.0.0-beta.4",
74
73
  "nodemon": "^3.0.2",
75
74
  "shx": "^0.3.4",
76
75
  "typescript": "^5.3.3"