@wonderwhy-er/desktop-commander 0.2.35 → 0.2.37

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.
Files changed (132) hide show
  1. package/README.md +3 -0
  2. package/dist/handlers/filesystem-handlers.js +58 -11
  3. package/dist/handlers/history-handlers.d.ts +7 -0
  4. package/dist/handlers/history-handlers.js +33 -1
  5. package/dist/remote-device/remote-channel.d.ts +8 -3
  6. package/dist/remote-device/remote-channel.js +68 -21
  7. package/dist/search-manager.d.ts +13 -0
  8. package/dist/search-manager.js +146 -0
  9. package/dist/server.js +56 -4
  10. package/dist/test-docx.d.ts +1 -0
  11. package/dist/tools/docx/builders/image.d.ts +14 -0
  12. package/dist/tools/docx/builders/image.js +84 -0
  13. package/dist/tools/docx/builders/index.d.ts +9 -3
  14. package/dist/tools/docx/builders/index.js +9 -3
  15. package/dist/tools/docx/builders/paragraph.d.ts +12 -0
  16. package/dist/tools/docx/builders/paragraph.js +29 -0
  17. package/dist/tools/docx/builders/table.d.ts +10 -0
  18. package/dist/tools/docx/builders/table.js +138 -0
  19. package/dist/tools/docx/builders/utils.d.ts +5 -0
  20. package/dist/tools/docx/builders/utils.js +18 -0
  21. package/dist/tools/docx/constants.d.ts +28 -32
  22. package/dist/tools/docx/constants.js +56 -52
  23. package/dist/tools/docx/create.d.ts +21 -0
  24. package/dist/tools/docx/create.js +386 -0
  25. package/dist/tools/docx/dom.d.ts +139 -0
  26. package/dist/tools/docx/dom.js +448 -0
  27. package/dist/tools/docx/index.d.ts +8 -12
  28. package/dist/tools/docx/index.js +8 -14
  29. package/dist/tools/docx/modify.d.ts +28 -0
  30. package/dist/tools/docx/modify.js +271 -0
  31. package/dist/tools/docx/ops/delete-paragraph-at-body-index.d.ts +11 -0
  32. package/dist/tools/docx/ops/delete-paragraph-at-body-index.js +23 -0
  33. package/dist/tools/docx/ops/header-replace-text-exact.d.ts +13 -0
  34. package/dist/tools/docx/ops/header-replace-text-exact.js +55 -0
  35. package/dist/tools/docx/ops/index.d.ts +17 -0
  36. package/dist/tools/docx/ops/index.js +70 -0
  37. package/dist/tools/docx/ops/insert-image-after-text.d.ts +24 -0
  38. package/dist/tools/docx/ops/insert-image-after-text.js +128 -0
  39. package/dist/tools/docx/ops/insert-paragraph-after-text.d.ts +12 -0
  40. package/dist/tools/docx/ops/insert-paragraph-after-text.js +74 -0
  41. package/dist/tools/docx/ops/insert-table-after-text.d.ts +19 -0
  42. package/dist/tools/docx/ops/insert-table-after-text.js +57 -0
  43. package/dist/tools/docx/ops/replace-hyperlink-url.d.ts +12 -0
  44. package/dist/tools/docx/ops/replace-hyperlink-url.js +37 -0
  45. package/dist/tools/docx/ops/replace-paragraph-at-body-index.d.ts +9 -0
  46. package/dist/tools/docx/ops/replace-paragraph-at-body-index.js +25 -0
  47. package/dist/tools/docx/ops/replace-paragraph-text-exact.d.ts +21 -0
  48. package/dist/tools/docx/ops/replace-paragraph-text-exact.js +36 -0
  49. package/dist/tools/docx/ops/replace-table-cell-text.d.ts +25 -0
  50. package/dist/tools/docx/ops/replace-table-cell-text.js +85 -0
  51. package/dist/tools/docx/ops/set-color-for-paragraph-exact.d.ts +9 -0
  52. package/dist/tools/docx/ops/set-color-for-paragraph-exact.js +24 -0
  53. package/dist/tools/docx/ops/set-color-for-style.d.ts +13 -0
  54. package/dist/tools/docx/ops/set-color-for-style.js +31 -0
  55. package/dist/tools/docx/ops/set-paragraph-style-at-body-index.d.ts +8 -0
  56. package/dist/tools/docx/ops/set-paragraph-style-at-body-index.js +57 -0
  57. package/dist/tools/docx/ops/table-set-cell-text.d.ts +9 -0
  58. package/dist/tools/docx/ops/table-set-cell-text.js +40 -0
  59. package/dist/tools/docx/read.d.ts +27 -0
  60. package/dist/tools/docx/read.js +308 -0
  61. package/dist/tools/docx/relationships.d.ts +22 -0
  62. package/dist/tools/docx/relationships.js +76 -0
  63. package/dist/tools/docx/types.d.ts +202 -103
  64. package/dist/tools/docx/types.js +2 -5
  65. package/dist/tools/docx/validate.d.ts +33 -0
  66. package/dist/tools/docx/validate.js +49 -0
  67. package/dist/tools/docx/write.d.ts +17 -0
  68. package/dist/tools/docx/write.js +88 -0
  69. package/dist/tools/docx/xml-view-test.d.ts +1 -0
  70. package/dist/tools/docx/xml-view-test.js +63 -0
  71. package/dist/tools/docx/xml-view.d.ts +56 -0
  72. package/dist/tools/docx/xml-view.js +169 -0
  73. package/dist/tools/docx/zip.d.ts +21 -0
  74. package/dist/tools/docx/zip.js +35 -0
  75. package/dist/tools/edit.js +57 -27
  76. package/dist/tools/schemas.d.ts +13 -0
  77. package/dist/tools/schemas.js +6 -1
  78. package/dist/types.d.ts +10 -0
  79. package/dist/ui/contracts.d.ts +14 -0
  80. package/dist/ui/contracts.js +18 -0
  81. package/dist/ui/file-preview/index.html +16 -0
  82. package/dist/ui/file-preview/preview-runtime.js +13983 -0
  83. package/dist/ui/file-preview/shared/preview-file-types.d.ts +5 -0
  84. package/dist/ui/file-preview/shared/preview-file-types.js +57 -0
  85. package/dist/ui/file-preview/src/app.d.ts +4 -0
  86. package/dist/ui/file-preview/src/app.js +800 -0
  87. package/dist/ui/file-preview/src/components/code-viewer.d.ts +6 -0
  88. package/dist/ui/file-preview/src/components/code-viewer.js +73 -0
  89. package/dist/ui/file-preview/src/components/highlighting.d.ts +2 -0
  90. package/dist/ui/file-preview/src/components/highlighting.js +54 -0
  91. package/dist/ui/file-preview/src/components/html-renderer.d.ts +9 -0
  92. package/dist/ui/file-preview/src/components/html-renderer.js +63 -0
  93. package/dist/ui/file-preview/src/components/markdown-renderer.d.ts +1 -0
  94. package/dist/ui/file-preview/src/components/markdown-renderer.js +21 -0
  95. package/dist/ui/file-preview/src/components/toolbar.d.ts +6 -0
  96. package/dist/ui/file-preview/src/components/toolbar.js +75 -0
  97. package/dist/ui/file-preview/src/image-preview.d.ts +3 -0
  98. package/dist/ui/file-preview/src/image-preview.js +21 -0
  99. package/dist/ui/file-preview/src/main.d.ts +1 -0
  100. package/dist/ui/file-preview/src/main.js +5 -0
  101. package/dist/ui/file-preview/src/types.d.ts +1 -0
  102. package/dist/ui/file-preview/src/types.js +1 -0
  103. package/dist/ui/file-preview/styles.css +764 -0
  104. package/dist/ui/resources.d.ts +21 -0
  105. package/dist/ui/resources.js +72 -0
  106. package/dist/ui/shared/escape-html.d.ts +4 -0
  107. package/dist/ui/shared/escape-html.js +11 -0
  108. package/dist/ui/shared/host-lifecycle.d.ts +16 -0
  109. package/dist/ui/shared/host-lifecycle.js +35 -0
  110. package/dist/ui/shared/rpc-client.d.ts +14 -0
  111. package/dist/ui/shared/rpc-client.js +72 -0
  112. package/dist/ui/shared/theme-adaptation.d.ts +10 -0
  113. package/dist/ui/shared/theme-adaptation.js +118 -0
  114. package/dist/ui/shared/tool-header.d.ts +9 -0
  115. package/dist/ui/shared/tool-header.js +25 -0
  116. package/dist/ui/shared/tool-shell.d.ts +16 -0
  117. package/dist/ui/shared/tool-shell.js +65 -0
  118. package/dist/ui/shared/widget-state.d.ts +28 -0
  119. package/dist/ui/shared/widget-state.js +60 -0
  120. package/dist/utils/capture.d.ts +1 -0
  121. package/dist/utils/capture.js +176 -8
  122. package/dist/utils/files/base.d.ts +3 -1
  123. package/dist/utils/files/docx.d.ts +28 -22
  124. package/dist/utils/files/docx.js +630 -196
  125. package/dist/utils/files/factory.d.ts +6 -5
  126. package/dist/utils/files/factory.js +18 -6
  127. package/dist/utils/files/text.js +9 -1
  128. package/dist/utils/system-info.js +1 -1
  129. package/dist/utils/usageTracker.js +5 -0
  130. package/dist/version.d.ts +1 -1
  131. package/dist/version.js +1 -1
  132. package/package.json +6 -2
@@ -14,11 +14,12 @@ import { FileHandler } from './base.js';
14
14
  * BinaryFileHandler uses async isBinaryFile for content-based detection.
15
15
  *
16
16
  * Priority order:
17
- * 1. PDF files (extension based)
18
- * 2. Excel files (xlsx, xls, xlsm) - extension based
19
- * 3. Image files (png, jpg, gif, webp) - extension based
20
- * 4. Binary files - content-based detection via isBinaryFile
21
- * 5. Text files (default)
17
+ * 1. DOCX files (extension based)
18
+ * 2. PDF files (extension based)
19
+ * 3. Excel files (xlsx, xls, xlsm) - extension based
20
+ * 4. Image files (png, jpg, gif, webp) - extension based
21
+ * 5. Binary files - content-based detection via isBinaryFile
22
+ * 6. Text files (default)
22
23
  *
23
24
  * @param filePath File path to get handler for
24
25
  * @returns FileHandler instance that can handle this file
@@ -10,12 +10,14 @@ import { ImageFileHandler } from './image.js';
10
10
  import { BinaryFileHandler } from './binary.js';
11
11
  import { ExcelFileHandler } from './excel.js';
12
12
  import { PdfFileHandler } from './pdf.js';
13
+ import { DocxFileHandler } from './docx.js';
13
14
  // Singleton instances of each handler
14
15
  let excelHandler = null;
15
16
  let imageHandler = null;
16
17
  let textHandler = null;
17
18
  let binaryHandler = null;
18
19
  let pdfHandler = null;
20
+ let docxHandler = null;
19
21
  /**
20
22
  * Initialize handlers (lazy initialization)
21
23
  */
@@ -44,6 +46,11 @@ function getPdfHandler() {
44
46
  pdfHandler = new PdfFileHandler();
45
47
  return pdfHandler;
46
48
  }
49
+ function getDocxHandler() {
50
+ if (!docxHandler)
51
+ docxHandler = new DocxFileHandler();
52
+ return docxHandler;
53
+ }
47
54
  /**
48
55
  * Get the appropriate file handler for a given file path
49
56
  *
@@ -52,17 +59,22 @@ function getPdfHandler() {
52
59
  * BinaryFileHandler uses async isBinaryFile for content-based detection.
53
60
  *
54
61
  * Priority order:
55
- * 1. PDF files (extension based)
56
- * 2. Excel files (xlsx, xls, xlsm) - extension based
57
- * 3. Image files (png, jpg, gif, webp) - extension based
58
- * 4. Binary files - content-based detection via isBinaryFile
59
- * 5. Text files (default)
62
+ * 1. DOCX files (extension based)
63
+ * 2. PDF files (extension based)
64
+ * 3. Excel files (xlsx, xls, xlsm) - extension based
65
+ * 4. Image files (png, jpg, gif, webp) - extension based
66
+ * 5. Binary files - content-based detection via isBinaryFile
67
+ * 6. Text files (default)
60
68
  *
61
69
  * @param filePath File path to get handler for
62
70
  * @returns FileHandler instance that can handle this file
63
71
  */
64
72
  export async function getFileHandler(filePath) {
65
- // Check PDF first (extension-based, sync)
73
+ // Check DOCX first (extension-based, sync)
74
+ if (getDocxHandler().canHandle(filePath)) {
75
+ return getDocxHandler();
76
+ }
77
+ // Check PDF (extension-based, sync)
66
78
  if (getPdfHandler().canHandle(filePath)) {
67
79
  return getPdfHandler();
68
80
  }
@@ -87,7 +87,15 @@ export class TextFileHandler {
87
87
  * Made static and public for use by other modules (e.g., writeFile telemetry in filesystem.ts)
88
88
  */
89
89
  static countLines(content) {
90
- return content.split('\n').length;
90
+ if (content === '')
91
+ return 0;
92
+ // A file with N lines has N-1 newline characters.
93
+ // If the file ends with a trailing newline, don't count the empty string after it.
94
+ const lines = content.split('\n');
95
+ if (lines[lines.length - 1] === '') {
96
+ return lines.length - 1;
97
+ }
98
+ return lines.length;
91
99
  }
92
100
  /**
93
101
  * Get file line count (for files under size limit)
@@ -129,7 +129,7 @@ function discoverContainerMounts(isContainer) {
129
129
  const device = parts[0];
130
130
  const mountPoint = parts[1];
131
131
  const fsType = parts[2];
132
- const options = parts[3];
132
+ const options = parts[3].split(',');
133
133
  // Skip system mount points
134
134
  const isSystemMountPoint = mountPoint === '/' ||
135
135
  mountPoint.startsWith('/dev') ||
@@ -331,6 +331,11 @@ class UsageTracker {
331
331
  if (!onboardingEnabled) {
332
332
  return false;
333
333
  }
334
+ // Check local config override (user can disable via config)
335
+ const localOverride = await configManager.getValue('onboarding_injection');
336
+ if (localOverride === false) {
337
+ return false;
338
+ }
334
339
  // Check if onboarding is disabled via command line argument
335
340
  if (global.disableOnboarding) {
336
341
  return false;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.2.35";
1
+ export declare const VERSION = "0.2.37";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.2.35';
1
+ export const VERSION = '0.2.37';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.2.35",
3
+ "version": "0.2.37",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "mcpName": "io.github.wonderwhy-er/desktop-commander",
6
6
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "bump": "node scripts/sync-version.js --bump",
32
32
  "bump:minor": "node scripts/sync-version.js --bump --minor",
33
33
  "bump:major": "node scripts/sync-version.js --bump --major",
34
- "build": "tsc && shx cp setup-claude-server.js uninstall-claude-server.js track-installation.js dist/ && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/ && shx mkdir -p dist/remote-device/scripts && shx cp src/remote-device/scripts/blocking-offline-update.js dist/remote-device/scripts/",
34
+ "build": "tsc && shx cp setup-claude-server.js uninstall-claude-server.js track-installation.js dist/ && shx chmod +x dist/*.js && shx mkdir -p dist/data && shx cp src/data/onboarding-prompts.json dist/data/ && shx mkdir -p dist/remote-device/scripts && shx cp src/remote-device/scripts/blocking-offline-update.js dist/remote-device/scripts/ && node scripts/build-ui-runtime.cjs file-preview",
35
35
  "watch": "tsc --watch",
36
36
  "start": "node dist/index.js",
37
37
  "start:debug": "node --inspect-brk=9229 dist/index.js",
@@ -90,10 +90,13 @@
90
90
  "fastest-levenshtein": "^1.0.16",
91
91
  "file-type": "^21.1.1",
92
92
  "glob": "^10.3.10",
93
+ "highlight.js": "^11.11.1",
93
94
  "isbinaryfile": "^5.0.4",
95
+ "markdown-it": "^14.1.0",
94
96
  "md-to-pdf": "^5.2.5",
95
97
  "open": "^10.2.0",
96
98
  "pdf-lib": "^1.17.1",
99
+ "pizzip": "^3.2.0",
97
100
  "remark": "^15.0.1",
98
101
  "remark-gfm": "^4.0.1",
99
102
  "remark-parse": "^11.0.0",
@@ -110,6 +113,7 @@
110
113
  "@anthropic-ai/mcpb": "^1.2.0",
111
114
  "@types/node": "^20.17.24",
112
115
  "commander": "^13.1.0",
116
+ "esbuild": "^0.27.3",
113
117
  "nexe": "^5.0.0-beta.4",
114
118
  "nodemon": "^3.0.2",
115
119
  "shx": "^0.3.4",