@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.
- package/README.md +1 -1
- package/dist/REPLSessionManager.d.ts +109 -0
- package/dist/REPLSessionManager.js +364 -0
- package/dist/REPLSessionManager.test.d.ts +1 -0
- package/dist/REPLSessionManager.test.js +75 -0
- package/dist/client/replClient.d.ts +63 -0
- package/dist/client/replClient.js +217 -0
- package/dist/client/sshClient.d.ts +82 -0
- package/dist/client/sshClient.js +200 -0
- package/dist/handlers/repl-handlers.d.ts +21 -0
- package/dist/handlers/repl-handlers.js +37 -0
- package/dist/handlers/replCommandHandler.d.ts +125 -0
- package/dist/handlers/replCommandHandler.js +255 -0
- package/dist/handlers/replCommandHandler.test.d.ts +1 -0
- package/dist/handlers/replCommandHandler.test.js +103 -0
- package/dist/index.js +1 -2
- package/dist/repl-manager.d.ts +73 -0
- package/dist/repl-manager.js +407 -0
- package/dist/replIntegration.d.ts +14 -0
- package/dist/replIntegration.js +27 -0
- package/dist/setup-claude-server.js +14 -15
- package/dist/tools/edit.js +83 -24
- package/dist/tools/enhanced-read-output.js +69 -0
- package/dist/tools/enhanced-send-input.js +111 -0
- package/dist/tools/filesystem.js +6 -5
- package/dist/tools/repl.d.ts +21 -0
- package/dist/tools/repl.js +217 -0
- package/dist/tools/send-input.d.ts +2 -0
- package/dist/tools/send-input.js +45 -0
- package/dist/utils/lineEndingHandler.d.ts +21 -0
- package/dist/utils/lineEndingHandler.js +77 -0
- package/dist/utils/lineEndingHandler_optimized.d.ts +21 -0
- package/dist/utils/lineEndingHandler_optimized.js +77 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- 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.
|
|
1
|
+
export declare const VERSION = "0.1.39";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.39';
|