@wonderwhy-er/desktop-commander 0.1.37 → 0.1.39

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/REPLSessionManager.d.ts +109 -0
  3. package/dist/REPLSessionManager.js +364 -0
  4. package/dist/REPLSessionManager.test.d.ts +1 -0
  5. package/dist/REPLSessionManager.test.js +75 -0
  6. package/dist/client/replClient.d.ts +63 -0
  7. package/dist/client/replClient.js +217 -0
  8. package/dist/client/sshClient.d.ts +82 -0
  9. package/dist/client/sshClient.js +200 -0
  10. package/dist/handlers/repl-handlers.d.ts +21 -0
  11. package/dist/handlers/repl-handlers.js +37 -0
  12. package/dist/handlers/replCommandHandler.d.ts +125 -0
  13. package/dist/handlers/replCommandHandler.js +255 -0
  14. package/dist/handlers/replCommandHandler.test.d.ts +1 -0
  15. package/dist/handlers/replCommandHandler.test.js +103 -0
  16. package/dist/index.js +1 -2
  17. package/dist/repl-manager.d.ts +73 -0
  18. package/dist/repl-manager.js +407 -0
  19. package/dist/replIntegration.d.ts +14 -0
  20. package/dist/replIntegration.js +27 -0
  21. package/dist/setup-claude-server.js +14 -15
  22. package/dist/tools/edit.js +83 -24
  23. package/dist/tools/enhanced-read-output.js +69 -0
  24. package/dist/tools/enhanced-send-input.js +111 -0
  25. package/dist/tools/filesystem.js +6 -5
  26. package/dist/tools/repl.d.ts +21 -0
  27. package/dist/tools/repl.js +217 -0
  28. package/dist/tools/send-input.d.ts +2 -0
  29. package/dist/tools/send-input.js +45 -0
  30. package/dist/utils/lineEndingHandler.d.ts +21 -0
  31. package/dist/utils/lineEndingHandler.js +77 -0
  32. package/dist/utils/lineEndingHandler_optimized.d.ts +21 -0
  33. package/dist/utils/lineEndingHandler_optimized.js +77 -0
  34. package/dist/version.d.ts +1 -1
  35. package/dist/version.js +1 -1
  36. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Line ending types
3
+ */
4
+ export type LineEndingStyle = '\r\n' | '\n' | '\r';
5
+ /**
6
+ * Detect the line ending style used in a file - Optimized version
7
+ * This algorithm uses early termination for maximum performance
8
+ */
9
+ export declare function detectLineEnding(content: string): LineEndingStyle;
10
+ /**
11
+ * Normalize line endings to match the target style
12
+ */
13
+ export declare function normalizeLineEndings(text: string, targetLineEnding: LineEndingStyle): string;
14
+ /**
15
+ * Analyze line ending usage in content
16
+ */
17
+ export declare function analyzeLineEndings(content: string): {
18
+ style: LineEndingStyle;
19
+ count: number;
20
+ hasMixed: boolean;
21
+ };
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Detect the line ending style used in a file - Optimized version
3
+ * This algorithm uses early termination for maximum performance
4
+ */
5
+ export function detectLineEnding(content) {
6
+ for (let i = 0; i < content.length; i++) {
7
+ if (content[i] === '\r') {
8
+ if (i + 1 < content.length && content[i + 1] === '\n') {
9
+ return '\r\n';
10
+ }
11
+ return '\r';
12
+ }
13
+ if (content[i] === '\n') {
14
+ return '\n';
15
+ }
16
+ }
17
+ // Default to system line ending if no line endings found
18
+ return process.platform === 'win32' ? '\r\n' : '\n';
19
+ }
20
+ /**
21
+ * Normalize line endings to match the target style
22
+ */
23
+ export function normalizeLineEndings(text, targetLineEnding) {
24
+ // First normalize to LF
25
+ let normalized = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
26
+ // Then convert to target
27
+ if (targetLineEnding === '\r\n') {
28
+ return normalized.replace(/\n/g, '\r\n');
29
+ }
30
+ else if (targetLineEnding === '\r') {
31
+ return normalized.replace(/\n/g, '\r');
32
+ }
33
+ return normalized;
34
+ }
35
+ /**
36
+ * Analyze line ending usage in content
37
+ */
38
+ export function analyzeLineEndings(content) {
39
+ let crlfCount = 0;
40
+ let lfCount = 0;
41
+ let crCount = 0;
42
+ // Count line endings
43
+ for (let i = 0; i < content.length; i++) {
44
+ if (content[i] === '\r') {
45
+ if (i + 1 < content.length && content[i + 1] === '\n') {
46
+ crlfCount++;
47
+ i++; // Skip the LF
48
+ }
49
+ else {
50
+ crCount++;
51
+ }
52
+ }
53
+ else if (content[i] === '\n') {
54
+ lfCount++;
55
+ }
56
+ }
57
+ // Determine predominant style
58
+ const total = crlfCount + lfCount + crCount;
59
+ let style;
60
+ if (crlfCount > lfCount && crlfCount > crCount) {
61
+ style = '\r\n';
62
+ }
63
+ else if (lfCount > crCount) {
64
+ style = '\n';
65
+ }
66
+ else {
67
+ style = '\r';
68
+ }
69
+ // Check for mixed line endings
70
+ const usedStyles = [crlfCount > 0, lfCount > 0, crCount > 0].filter(Boolean).length;
71
+ const hasMixed = usedStyles > 1;
72
+ return {
73
+ style,
74
+ count: total,
75
+ hasMixed
76
+ };
77
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Line ending types
3
+ */
4
+ export type LineEndingStyle = '\r\n' | '\n' | '\r';
5
+ /**
6
+ * Detect the line ending style used in a file - Optimized version
7
+ * This algorithm uses early termination for maximum performance
8
+ */
9
+ export declare function detectLineEnding(content: string): LineEndingStyle;
10
+ /**
11
+ * Normalize line endings to match the target style
12
+ */
13
+ export declare function normalizeLineEndings(text: string, targetLineEnding: LineEndingStyle): string;
14
+ /**
15
+ * Analyze line ending usage in content
16
+ */
17
+ export declare function analyzeLineEndings(content: string): {
18
+ style: LineEndingStyle;
19
+ count: number;
20
+ hasMixed: boolean;
21
+ };
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Detect the line ending style used in a file - Optimized version
3
+ * This algorithm uses early termination for maximum performance
4
+ */
5
+ export function detectLineEnding(content) {
6
+ for (let i = 0; i < content.length; i++) {
7
+ if (content[i] === '\r') {
8
+ if (i + 1 < content.length && content[i + 1] === '\n') {
9
+ return '\r\n';
10
+ }
11
+ return '\r';
12
+ }
13
+ if (content[i] === '\n') {
14
+ return '\n';
15
+ }
16
+ }
17
+ // Default to system line ending if no line endings found
18
+ return process.platform === 'win32' ? '\r\n' : '\n';
19
+ }
20
+ /**
21
+ * Normalize line endings to match the target style
22
+ */
23
+ export function normalizeLineEndings(text, targetLineEnding) {
24
+ // First normalize to LF
25
+ let normalized = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
26
+ // Then convert to target
27
+ if (targetLineEnding === '\r\n') {
28
+ return normalized.replace(/\n/g, '\r\n');
29
+ }
30
+ else if (targetLineEnding === '\r') {
31
+ return normalized.replace(/\n/g, '\r');
32
+ }
33
+ return normalized;
34
+ }
35
+ /**
36
+ * Analyze line ending usage in content
37
+ */
38
+ export function analyzeLineEndings(content) {
39
+ let crlfCount = 0;
40
+ let lfCount = 0;
41
+ let crCount = 0;
42
+ // Count line endings
43
+ for (let i = 0; i < content.length; i++) {
44
+ if (content[i] === '\r') {
45
+ if (i + 1 < content.length && content[i + 1] === '\n') {
46
+ crlfCount++;
47
+ i++; // Skip the LF
48
+ }
49
+ else {
50
+ crCount++;
51
+ }
52
+ }
53
+ else if (content[i] === '\n') {
54
+ lfCount++;
55
+ }
56
+ }
57
+ // Determine predominant style
58
+ const total = crlfCount + lfCount + crCount;
59
+ let style;
60
+ if (crlfCount > lfCount && crlfCount > crCount) {
61
+ style = '\r\n';
62
+ }
63
+ else if (lfCount > crCount) {
64
+ style = '\n';
65
+ }
66
+ else {
67
+ style = '\r';
68
+ }
69
+ // Check for mixed line endings
70
+ const usedStyles = [crlfCount > 0, lfCount > 0, crCount > 0].filter(Boolean).length;
71
+ const hasMixed = usedStyles > 1;
72
+ return {
73
+ style,
74
+ count: total,
75
+ hasMixed
76
+ };
77
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.37";
1
+ export declare const VERSION = "0.1.39";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.37';
1
+ export const VERSION = '0.1.39';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderwhy-er/desktop-commander",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "MCP server for terminal operations and file editing",
5
5
  "license": "MIT",
6
6
  "author": "Eduards Ruzga",