centaurus-cli 2.7.3 → 2.8.0
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/dist/cli-adapter.d.ts +2 -0
- package/dist/cli-adapter.d.ts.map +1 -1
- package/dist/cli-adapter.js +46 -4
- package/dist/cli-adapter.js.map +1 -1
- package/dist/context/handlers/wsl-handler.d.ts.map +1 -1
- package/dist/context/handlers/wsl-handler.js +2 -1
- package/dist/context/handlers/wsl-handler.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/services/ai-service-client.d.ts.map +1 -1
- package/dist/services/ai-service-client.js +20 -0
- package/dist/services/ai-service-client.js.map +1 -1
- package/dist/tools/file-ops.d.ts.map +1 -1
- package/dist/tools/file-ops.js +13 -3
- package/dist/tools/file-ops.js.map +1 -1
- package/dist/ui/components/App.d.ts +1 -0
- package/dist/ui/components/App.d.ts.map +1 -1
- package/dist/ui/components/App.js +73 -74
- package/dist/ui/components/App.js.map +1 -1
- package/dist/ui/components/InteractiveShell.d.ts +2 -1
- package/dist/ui/components/InteractiveShell.d.ts.map +1 -1
- package/dist/ui/components/InteractiveShell.js +41 -106
- package/dist/ui/components/InteractiveShell.js.map +1 -1
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/ui/components/MarkdownRenderer.js +12 -8
- package/dist/ui/components/MarkdownRenderer.js.map +1 -1
- package/dist/ui/components/MessageDisplay.d.ts.map +1 -1
- package/dist/ui/components/MessageDisplay.js +10 -2
- package/dist/ui/components/MessageDisplay.js.map +1 -1
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -1
- package/dist/ui/components/StreamingMessageDisplay.js +5 -5
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -1
- package/dist/utils/editor-utils.d.ts +50 -0
- package/dist/utils/editor-utils.d.ts.map +1 -0
- package/dist/utils/editor-utils.js +501 -0
- package/dist/utils/editor-utils.js.map +1 -0
- package/dist/utils/input-classifier.d.ts.map +1 -1
- package/dist/utils/input-classifier.js +2 -1
- package/dist/utils/input-classifier.js.map +1 -1
- package/dist/utils/shell.d.ts +32 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +97 -161
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/syntax-checker.d.ts +24 -0
- package/dist/utils/syntax-checker.d.ts.map +1 -0
- package/dist/utils/syntax-checker.js +320 -0
- package/dist/utils/syntax-checker.js.map +1 -0
- package/package.json +4 -3
package/dist/utils/shell.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as os from 'os';
|
|
2
|
-
import spawn from 'cross-spawn'; // Use cross-spawn for better Windows support
|
|
3
2
|
import { exec } from 'child_process';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
// Use createRequire for ESM compatibility with native modules
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const nodePty = require('@homebridge/node-pty-prebuilt-multiarch');
|
|
7
|
+
/**
|
|
8
|
+
* Check if PTY is available on this system
|
|
9
|
+
*/
|
|
10
|
+
export function isPtyAvailable() {
|
|
11
|
+
return nodePty !== null;
|
|
12
|
+
}
|
|
4
13
|
export function killProcessTree(pid, signal) {
|
|
5
14
|
if (os.platform() === 'win32') {
|
|
6
|
-
try {
|
|
7
|
-
require('fs').appendFileSync('shell_debug.log', `[${new Date().toISOString()}] Executing taskkill for PID ${pid}\n`);
|
|
8
|
-
}
|
|
9
|
-
catch (e) { }
|
|
10
15
|
exec(`taskkill /pid ${pid} /T /F`, (error, stdout, stderr) => {
|
|
11
16
|
if (error) {
|
|
12
|
-
|
|
13
|
-
require('fs').appendFileSync('shell_debug.log', `[${new Date().toISOString()}] taskkill failed: ${error.message}\nstderr: ${stderr}\n`);
|
|
14
|
-
}
|
|
15
|
-
catch (e) { }
|
|
16
|
-
// Fallback to normal kill if taskkill fails (e.g. permission issue)
|
|
17
|
+
// Fallback to normal kill if taskkill fails
|
|
17
18
|
try {
|
|
18
19
|
process.kill(pid, signal);
|
|
19
20
|
}
|
|
@@ -21,12 +22,6 @@ export function killProcessTree(pid, signal) {
|
|
|
21
22
|
// Ignore if process already gone
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
else {
|
|
25
|
-
try {
|
|
26
|
-
require('fs').appendFileSync('shell_debug.log', `[${new Date().toISOString()}] taskkill success: ${stdout}\n`);
|
|
27
|
-
}
|
|
28
|
-
catch (e) { }
|
|
29
|
-
}
|
|
30
25
|
});
|
|
31
26
|
}
|
|
32
27
|
else {
|
|
@@ -48,173 +43,114 @@ export function killProcessTree(pid, signal) {
|
|
|
48
43
|
export function getShellCommand() {
|
|
49
44
|
return os.platform() === 'win32' ? 'powershell.exe' : (process.env.SHELL || '/bin/bash');
|
|
50
45
|
}
|
|
51
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Execute a command using node-pty for full terminal emulation.
|
|
48
|
+
* This provides true PTY support with colors, cursor positioning, and interactive programs.
|
|
49
|
+
*/
|
|
50
|
+
export function executePtyCommand(command, cwd, onData, onExit) {
|
|
52
51
|
const shell = getShellCommand();
|
|
53
|
-
|
|
54
|
-
const args =
|
|
55
|
-
|
|
52
|
+
const isWindows = os.platform() === 'win32';
|
|
53
|
+
const args = isWindows ? ['-Command', command] : ['-c', command];
|
|
54
|
+
// Get initial terminal dimensions
|
|
55
|
+
const cols = process.stdout.columns || 80;
|
|
56
|
+
const rows = process.stdout.rows || 24;
|
|
57
|
+
// Spawn PTY process
|
|
58
|
+
const ptyProcess = nodePty.spawn(shell, args, {
|
|
59
|
+
name: 'xterm-256color',
|
|
60
|
+
cols,
|
|
61
|
+
rows,
|
|
56
62
|
cwd,
|
|
57
|
-
stdio: ['pipe', 'pipe', 'pipe'], // CRITICAL: All pipes must be open
|
|
58
63
|
env: {
|
|
59
64
|
...process.env,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// Force Color Output (Many tools check this)
|
|
65
|
+
TERM: 'xterm-256color',
|
|
66
|
+
COLORTERM: 'truecolor',
|
|
63
67
|
FORCE_COLOR: '1',
|
|
64
68
|
CLICOLOR: '1',
|
|
65
|
-
|
|
66
|
-
}
|
|
69
|
+
PYTHONUNBUFFERED: '1',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
let isRunning = true;
|
|
73
|
+
// Stream data as it comes
|
|
74
|
+
ptyProcess.onData((data) => {
|
|
75
|
+
onData(data);
|
|
67
76
|
});
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
onData(buffer, 'stdout'); // Merge to single stream for UI simplicity
|
|
74
|
-
buffer = '';
|
|
77
|
+
// Handle exit
|
|
78
|
+
ptyProcess.onExit(({ exitCode }) => {
|
|
79
|
+
isRunning = false;
|
|
80
|
+
if (onExit) {
|
|
81
|
+
onExit(exitCode);
|
|
75
82
|
}
|
|
76
|
-
throttleTimer = null;
|
|
77
|
-
};
|
|
78
|
-
const handleData = (data) => {
|
|
79
|
-
buffer += data.toString();
|
|
80
|
-
if (!throttleTimer)
|
|
81
|
-
throttleTimer = setTimeout(flush, 50); // 50ms debounce
|
|
82
|
-
};
|
|
83
|
-
childProcess.stdout?.on('data', handleData);
|
|
84
|
-
childProcess.stderr?.on('data', handleData); // Merge stderr so user sees errors inline
|
|
85
|
-
childProcess.on('close', (code) => {
|
|
86
|
-
if (throttleTimer)
|
|
87
|
-
clearTimeout(throttleTimer);
|
|
88
|
-
flush();
|
|
89
|
-
if (onExit)
|
|
90
|
-
onExit(code ?? 0);
|
|
91
83
|
});
|
|
92
84
|
return {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
85
|
+
write: (data) => {
|
|
86
|
+
if (isRunning) {
|
|
87
|
+
ptyProcess.write(data);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
resize: (cols, rows) => {
|
|
91
|
+
if (isRunning) {
|
|
92
|
+
ptyProcess.resize(cols, rows);
|
|
98
93
|
}
|
|
99
94
|
},
|
|
100
95
|
kill: () => {
|
|
101
|
-
|
|
96
|
+
if (isRunning) {
|
|
97
|
+
ptyProcess.kill();
|
|
98
|
+
isRunning = false;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
isRunning: () => isRunning,
|
|
102
|
+
pid: ptyProcess.pid,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Execute a command interactively using PTY.
|
|
107
|
+
* Now exclusively uses node-pty for production-grade terminal experience.
|
|
108
|
+
*/
|
|
109
|
+
export function executeCommandInteractive(command, cwd, onData, onExit) {
|
|
110
|
+
const ptyProc = executePtyCommand(command, cwd, (chunk) => onData(chunk, 'stdout'), onExit);
|
|
111
|
+
return {
|
|
112
|
+
process: null,
|
|
113
|
+
ptyProcess: ptyProc,
|
|
114
|
+
write: (input) => {
|
|
115
|
+
ptyProc.write(input);
|
|
102
116
|
},
|
|
117
|
+
kill: () => ptyProc.kill(),
|
|
103
118
|
signal: (signal) => {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
childProcess.kill(signal);
|
|
112
|
-
// 2. Set safety timeout to force kill if it doesn't exit
|
|
113
|
-
setTimeout(() => {
|
|
114
|
-
if (childProcess.exitCode === null && childProcess.pid) {
|
|
115
|
-
try {
|
|
116
|
-
require('fs').appendFileSync('shell_debug.log', `[${new Date().toISOString()}] Process ${childProcess.pid} still running, forcing killProcessTree\n`);
|
|
119
|
+
// For PTY, send control characters for signals
|
|
120
|
+
if (signal === 'SIGINT') {
|
|
121
|
+
ptyProc.write('\x03'); // Ctrl+C
|
|
122
|
+
// Also try to kill after a short delay if it doesn't respond
|
|
123
|
+
setTimeout(() => {
|
|
124
|
+
if (ptyProc.isRunning()) {
|
|
125
|
+
ptyProc.kill();
|
|
117
126
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
}, 500);
|
|
128
|
+
}
|
|
129
|
+
else if (signal === 'SIGTERM') {
|
|
130
|
+
ptyProc.kill();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
ptyProc.kill();
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
resize: (cols, rows) => ptyProc.resize(cols, rows),
|
|
137
|
+
isPty: true,
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
export async function executeCommand(command, cwd, onData) {
|
|
132
141
|
return new Promise((resolve) => {
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
const shell = isWindows ? 'powershell.exe' : (process.env.SHELL || '/bin/bash');
|
|
137
|
-
const shellArgs = isWindows ? ['-Command', command] : ['-c', command];
|
|
138
|
-
// Spawn the process with explicit pipe mode
|
|
139
|
-
const childProcess = spawn(shell, shellArgs, {
|
|
140
|
-
cwd,
|
|
141
|
-
windowsHide: true,
|
|
142
|
-
stdio: ['pipe', 'pipe', 'pipe'], // Explicit pipe mode - no inheritance
|
|
143
|
-
});
|
|
144
|
-
let stdout = '';
|
|
145
|
-
let stderr = '';
|
|
146
|
-
let isResolved = false;
|
|
147
|
-
// Throttling buffers
|
|
148
|
-
let stdoutBuffer = '';
|
|
149
|
-
let stderrBuffer = '';
|
|
150
|
-
let throttleTimer = null;
|
|
151
|
-
// Flush function - sends buffered data to callback
|
|
152
|
-
const flush = () => {
|
|
142
|
+
let output = '';
|
|
143
|
+
const proc = executeCommandInteractive(command, cwd, (chunk) => {
|
|
144
|
+
output += chunk;
|
|
153
145
|
if (onData) {
|
|
154
|
-
|
|
155
|
-
onData(stdoutBuffer, 'stdout');
|
|
156
|
-
stdoutBuffer = '';
|
|
157
|
-
}
|
|
158
|
-
if (stderrBuffer) {
|
|
159
|
-
onData(stderrBuffer, 'stderr');
|
|
160
|
-
stderrBuffer = '';
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
throttleTimer = null;
|
|
164
|
-
};
|
|
165
|
-
// Capture stdout with throttled streaming
|
|
166
|
-
childProcess.stdout?.on('data', (data) => {
|
|
167
|
-
const chunk = data.toString();
|
|
168
|
-
stdout += chunk;
|
|
169
|
-
// Buffer the chunk
|
|
170
|
-
stdoutBuffer += chunk;
|
|
171
|
-
// Set throttle timer if not already running
|
|
172
|
-
if (!throttleTimer && onData) {
|
|
173
|
-
throttleTimer = setTimeout(flush, 50); // 50ms throttle
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
// Capture stderr with throttled streaming
|
|
177
|
-
childProcess.stderr?.on('data', (data) => {
|
|
178
|
-
const chunk = data.toString();
|
|
179
|
-
stderr += chunk;
|
|
180
|
-
// Buffer the chunk
|
|
181
|
-
stderrBuffer += chunk;
|
|
182
|
-
// Set throttle timer if not already running
|
|
183
|
-
if (!throttleTimer && onData) {
|
|
184
|
-
throttleTimer = setTimeout(flush, 50); // 50ms throttle
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
// Handle process completion
|
|
188
|
-
childProcess.on('close', (exitCode) => {
|
|
189
|
-
if (!isResolved) {
|
|
190
|
-
isResolved = true;
|
|
191
|
-
// Clear throttle timer and flush remaining data
|
|
192
|
-
if (throttleTimer) {
|
|
193
|
-
clearTimeout(throttleTimer);
|
|
194
|
-
}
|
|
195
|
-
flush();
|
|
196
|
-
resolve({
|
|
197
|
-
stdout,
|
|
198
|
-
stderr,
|
|
199
|
-
exitCode: exitCode ?? 0,
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
// Handle process errors
|
|
204
|
-
childProcess.on('error', (error) => {
|
|
205
|
-
if (!isResolved) {
|
|
206
|
-
isResolved = true;
|
|
207
|
-
// Clear throttle timer and flush remaining data
|
|
208
|
-
if (throttleTimer) {
|
|
209
|
-
clearTimeout(throttleTimer);
|
|
210
|
-
}
|
|
211
|
-
flush();
|
|
212
|
-
resolve({
|
|
213
|
-
stdout,
|
|
214
|
-
stderr: stderr || error.message,
|
|
215
|
-
exitCode: 1,
|
|
216
|
-
});
|
|
146
|
+
onData(chunk, 'stdout');
|
|
217
147
|
}
|
|
148
|
+
}, (exitCode) => {
|
|
149
|
+
resolve({
|
|
150
|
+
stdout: output,
|
|
151
|
+
stderr: '',
|
|
152
|
+
exitCode,
|
|
153
|
+
});
|
|
218
154
|
});
|
|
219
155
|
});
|
|
220
156
|
}
|
package/dist/utils/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAgB,IAAI,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,8DAA8D;AAC9D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,yCAAyC,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,KAAK,IAAI,CAAC;AAC1B,CAAC;AAkBD,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,MAAuB;IAClE,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,OAAO,EAAE,CAAC;QAC9B,IAAI,CAAC,iBAAiB,GAAG,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAC3D,IAAI,KAAK,EAAE,CAAC;gBACV,4CAA4C;gBAC5C,IAAI,CAAC;oB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ACX,MAA2D;IAE3D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,MAAM,IAAI,GAAG,yBAAyB,CACpC,OAAO,EACP,GAAG,EACH,CAAC,KAAK,EAAE,EAAE;YACR,MAAM,IAAI,KAAK,CAAC;YAChB,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,EACD,CAAC,QAAQ,EAAE,EAAE;YACX,OAAO,CAAC;gBACN,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,EAAE;gBACV,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of a syntax check operation
|
|
3
|
+
*/
|
|
4
|
+
export interface SyntaxCheckResult {
|
|
5
|
+
success: boolean;
|
|
6
|
+
language: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
skipped?: boolean;
|
|
9
|
+
skipReason?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Detect language from file path
|
|
13
|
+
*/
|
|
14
|
+
export declare function detectLanguage(filePath: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Main syntax check function
|
|
17
|
+
* Checks the syntax of a file based on its extension
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkSyntax(filePath: string, content?: string): Promise<SyntaxCheckResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Format syntax check result as a human-readable string
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatSyntaxCheckResult(result: SyntaxCheckResult): string;
|
|
24
|
+
//# sourceMappingURL=syntax-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"syntax-checker.d.ts","sourceRoot":"","sources":["../../src/utils/syntax-checker.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA6ED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBvD;AA8KD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA6DhG;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAUzE"}
|