@wonderwhy-er/desktop-commander 0.3.1-alpha.0 → 0.3.1-alpha.2

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 (76) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +1152 -1152
  3. package/dist/bootstrap.js +0 -0
  4. package/dist/command-manager.js +0 -0
  5. package/dist/config-field-definitions.js +0 -0
  6. package/dist/config-manager.d.ts +6 -0
  7. package/dist/config-manager.js +1 -1
  8. package/dist/config-recovery.js +0 -0
  9. package/dist/config.js +0 -0
  10. package/dist/custom-stdio.js +0 -0
  11. package/dist/data/onboarding-prompts.json +70 -70
  12. package/dist/error-handlers.js +0 -0
  13. package/dist/handlers/filesystem-handlers.js +2 -2
  14. package/dist/index.js +0 -0
  15. package/dist/npm-scripts/remote.js +34 -19
  16. package/dist/remote-device/diagnostics/device-log.d.ts +63 -0
  17. package/dist/remote-device/diagnostics/device-log.js +219 -0
  18. package/dist/remote-device/diagnostics/redact.d.ts +1 -0
  19. package/dist/remote-device/diagnostics/redact.js +76 -0
  20. package/dist/remote-device/diagnostics/report.d.ts +118 -0
  21. package/dist/remote-device/diagnostics/report.js +748 -0
  22. package/dist/remote-device/diagnostics/upload.d.ts +11 -0
  23. package/dist/remote-device/diagnostics/upload.js +59 -0
  24. package/dist/remote-device/scripts/blocking-offline-update.js +133 -133
  25. package/dist/search-manager.js +0 -0
  26. package/dist/server.js +610 -610
  27. package/dist/setup-claude-server.js +942 -942
  28. package/dist/terminal-manager.js +0 -0
  29. package/dist/tools/edit.js +2 -2
  30. package/dist/tools/fuzzySearch.js +9 -9
  31. package/dist/tools/improved-process-tools.js +10 -10
  32. package/dist/tools/pdf/extract-images.js +1 -1
  33. package/dist/tools/prompts.js +1 -1
  34. package/dist/track-installation.js +387 -387
  35. package/dist/types.js +0 -0
  36. package/dist/ui/config-editor/index.html +13 -13
  37. package/dist/ui/config-editor/src/app.js +30 -30
  38. package/dist/ui/config-editor/src/array-modal.js +32 -32
  39. package/dist/ui/config-editor/styles.css +586 -586
  40. package/dist/ui/file-preview/index.html +16 -16
  41. package/dist/ui/file-preview/src/app.js +8 -8
  42. package/dist/ui/file-preview/src/document-layout.js +31 -31
  43. package/dist/ui/file-preview/src/document-outline.js +8 -8
  44. package/dist/ui/file-preview/src/markdown/conflict-dialog.js +33 -33
  45. package/dist/ui/file-preview/src/markdown/controller.js +9 -9
  46. package/dist/ui/file-preview/src/markdown/editor.js +31 -31
  47. package/dist/ui/file-preview/styles.css +1630 -1630
  48. package/dist/uninstall-claude-server.js +745 -745
  49. package/dist/utils/files/binary.js +4 -4
  50. package/dist/utils/files/excel.js +3 -3
  51. package/dist/utils/lazy-package.d.ts +5 -3
  52. package/dist/utils/lazy-package.js +6 -4
  53. package/dist/utils/system-info.js +90 -90
  54. package/dist/utils/usageTracker.js +49 -49
  55. package/dist/version.d.ts +1 -1
  56. package/dist/version.js +1 -1
  57. package/node_modules/@desktop-commander/telemetry-contract/README.md +56 -56
  58. package/node_modules/@desktop-commander/telemetry-contract/package.json +32 -32
  59. package/node_modules/@desktop-commander/telemetry-contract/transport.d.ts +38 -38
  60. package/node_modules/@desktop-commander/telemetry-contract/transport.js +164 -164
  61. package/package.json +29 -15
  62. package/vendor/telemetry-contract/README.md +56 -56
  63. package/vendor/telemetry-contract/package.json +32 -32
  64. package/vendor/telemetry-contract/transport.d.ts +38 -38
  65. package/vendor/telemetry-contract/transport.js +164 -164
  66. package/vendor/telemetry-contract/transport.test.js +39 -39
  67. package/dist/remote-device/broadcast-analytics.d.ts +0 -28
  68. package/dist/remote-device/broadcast-analytics.js +0 -41
  69. package/dist/remote-device/mqtt-enrollment.d.ts +0 -16
  70. package/dist/remote-device/mqtt-enrollment.js +0 -162
  71. package/dist/remote-device/mqtt-transport.d.ts +0 -44
  72. package/dist/remote-device/mqtt-transport.js +0 -197
  73. package/dist/remote-device/transport-analytics.d.ts +0 -29
  74. package/dist/remote-device/transport-analytics.js +0 -44
  75. package/dist/tools/search.d.ts +0 -32
  76. package/dist/tools/search.js +0 -202
@@ -1,202 +0,0 @@
1
- import { spawn } from 'child_process';
2
- import path from 'path';
3
- import fs from 'fs/promises';
4
- import { validatePath } from './filesystem.js';
5
- import { rgPath } from '@vscode/ripgrep';
6
- import { capture } from "../utils/capture.js";
7
- // Function to search file contents using ripgrep
8
- export async function searchCode(options) {
9
- const { rootPath, pattern, filePattern, ignoreCase = true, maxResults = 1000, includeHidden = false, contextLines = 0 } = options;
10
- // Validate path for security
11
- const validPath = await validatePath(rootPath);
12
- // Build command arguments
13
- const args = [
14
- '--json', // Output in JSON format for easier parsing
15
- '--line-number', // Include line numbers
16
- ];
17
- if (ignoreCase) {
18
- args.push('-i');
19
- }
20
- if (maxResults) {
21
- args.push('-m', maxResults.toString());
22
- }
23
- if (includeHidden) {
24
- args.push('--hidden');
25
- }
26
- if (contextLines > 0) {
27
- args.push('-C', contextLines.toString());
28
- }
29
- if (filePattern) {
30
- const patterns = filePattern
31
- .split('|')
32
- .map(p => p.trim()) // remove surrounding spaces
33
- .filter(Boolean); // drop empty tokens
34
- // If all patterns were empty, return no results
35
- if (patterns.length === 0) {
36
- return [];
37
- }
38
- patterns.forEach(p => args.push('-g', p));
39
- }
40
- // Add pattern and path
41
- args.push(pattern, validPath);
42
- // Run ripgrep command
43
- return new Promise((resolve, reject) => {
44
- const results = [];
45
- const rg = spawn(rgPath, args);
46
- let stdoutBuffer = '';
47
- // Store a reference to the child process for potential termination
48
- const childProcess = rg;
49
- // Store in a process list - this could be expanded to a global registry
50
- // of running search processes if needed for management
51
- globalThis.currentSearchProcess = childProcess;
52
- rg.stdout.on('data', (data) => {
53
- stdoutBuffer += data.toString();
54
- });
55
- rg.stderr.on('data', (data) => {
56
- console.error(`ripgrep error: ${data}`);
57
- });
58
- rg.on('close', (code) => {
59
- // Clean up the global reference
60
- if (globalThis.currentSearchProcess === childProcess) {
61
- delete globalThis.currentSearchProcess;
62
- }
63
- if (code === 0 || code === 1) {
64
- // Process the buffered output
65
- const lines = stdoutBuffer.trim().split('\n');
66
- for (const line of lines) {
67
- if (!line)
68
- continue;
69
- try {
70
- const result = JSON.parse(line);
71
- if (result.type === 'match') {
72
- result.data.submatches.forEach((submatch) => {
73
- results.push({
74
- file: result.data.path.text,
75
- line: result.data.line_number,
76
- match: submatch.match.text
77
- });
78
- });
79
- }
80
- else if (result.type === 'context' && contextLines > 0) {
81
- results.push({
82
- file: result.data.path.text,
83
- line: result.data.line_number,
84
- match: result.data.lines.text.trim()
85
- });
86
- }
87
- }
88
- catch (error) {
89
- const errorMessage = error instanceof Error ? error.message : String(error);
90
- capture('server_request_error', { error: `Error parsing ripgrep output: ${errorMessage}` });
91
- console.error(`Error parsing ripgrep output: ${errorMessage}`);
92
- }
93
- }
94
- resolve(results);
95
- }
96
- else {
97
- reject(new Error(`ripgrep process exited with code ${code}`));
98
- }
99
- });
100
- });
101
- }
102
- // Fallback implementation using Node.js for environments without ripgrep
103
- export async function searchCodeFallback(options) {
104
- const { rootPath, pattern, filePattern, ignoreCase = true, maxResults = 1000, excludeDirs = ['node_modules', '.git'], contextLines = 0 } = options;
105
- const validPath = await validatePath(rootPath);
106
- const results = [];
107
- const regex = new RegExp(pattern, ignoreCase ? 'i' : '');
108
- // Handle filePattern similarly to main implementation
109
- let fileRegex = null;
110
- if (filePattern) {
111
- const patterns = filePattern
112
- .split('|')
113
- .map(p => p.trim())
114
- .filter(Boolean);
115
- // If all patterns were empty, return no results
116
- if (patterns.length === 0) {
117
- return [];
118
- }
119
- // Create a regex that matches any of the patterns
120
- const combinedPattern = patterns.map(p => p.replace(/\./g, '\\.').replace(/\*/g, '.*').replace(/\?/g, '.')).join('|');
121
- fileRegex = new RegExp(`^(${combinedPattern})$`);
122
- }
123
- async function searchDir(dirPath) {
124
- if (results.length >= maxResults)
125
- return;
126
- try {
127
- const entries = await fs.readdir(dirPath, { withFileTypes: true });
128
- for (const entry of entries) {
129
- if (results.length >= maxResults)
130
- break;
131
- const fullPath = path.join(dirPath, entry.name);
132
- try {
133
- await validatePath(fullPath);
134
- if (entry.isDirectory()) {
135
- if (!excludeDirs.includes(entry.name)) {
136
- await searchDir(fullPath);
137
- }
138
- }
139
- else if (entry.isFile()) {
140
- if (!fileRegex || fileRegex.test(entry.name)) {
141
- const content = await fs.readFile(fullPath, 'utf-8');
142
- const lines = content.split('\n');
143
- for (let i = 0; i < lines.length; i++) {
144
- if (regex.test(lines[i])) {
145
- // Add the matched line
146
- results.push({
147
- file: fullPath,
148
- line: i + 1,
149
- match: lines[i].trim()
150
- });
151
- // Add context lines
152
- if (contextLines > 0) {
153
- const startIdx = Math.max(0, i - contextLines);
154
- const endIdx = Math.min(lines.length - 1, i + contextLines);
155
- for (let j = startIdx; j <= endIdx; j++) {
156
- if (j !== i) { // Skip the match line as it's already added
157
- results.push({
158
- file: fullPath,
159
- line: j + 1,
160
- match: lines[j].trim()
161
- });
162
- }
163
- }
164
- }
165
- if (results.length >= maxResults)
166
- break;
167
- }
168
- }
169
- }
170
- }
171
- }
172
- catch (error) {
173
- // Skip files/directories we can't access
174
- continue;
175
- }
176
- }
177
- }
178
- catch (error) {
179
- // Skip directories we can't read
180
- }
181
- }
182
- await searchDir(validPath);
183
- return results;
184
- }
185
- // Main function that tries ripgrep first, falls back to native implementation
186
- export async function searchTextInFiles(options) {
187
- try {
188
- // For better performance and consistency, prefer the search session manager
189
- // when doing content search, but keep the original direct ripgrep approach as primary
190
- return await searchCode(options);
191
- }
192
- catch (error) {
193
- capture('searchTextInFiles_ripgrep_fallback', {
194
- error: error instanceof Error ? error.message : 'Unknown error'
195
- });
196
- // Use consistent exclusions - remove 'dist' to match ripgrep behavior
197
- return searchCodeFallback({
198
- ...options,
199
- excludeDirs: ['node_modules', '.git']
200
- });
201
- }
202
- }