erosolar-cli 1.7.30 → 1.7.32
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/core/isolatedVerifier.js +168 -17
- package/dist/core/isolatedVerifier.js.map +1 -1
- package/dist/shell/composableMessage.d.ts +1 -1
- package/dist/shell/composableMessage.js +2 -2
- package/dist/shell/composableMessage.js.map +1 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +90 -0
- package/dist/shell/enhancedInteractiveShell.d.ts.map +1 -0
- package/dist/shell/enhancedInteractiveShell.js +248 -0
- package/dist/shell/enhancedInteractiveShell.js.map +1 -0
- package/dist/shell/interactiveShell.d.ts +6 -3
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +26 -52
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/multiLinePasteManager.d.ts +106 -0
- package/dist/shell/multiLinePasteManager.d.ts.map +1 -0
- package/dist/shell/multiLinePasteManager.js +308 -0
- package/dist/shell/multiLinePasteManager.js.map +1 -0
- package/dist/shell/updateManager.d.ts.map +1 -1
- package/dist/shell/updateManager.js +66 -2
- package/dist/shell/updateManager.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MultiLinePasteManager - Enhanced multi-line paste handling with improved UX
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Short block description during input: "[Pasted: 15 lines]"
|
|
6
|
+
* - Full content sent to AI on submission
|
|
7
|
+
* - Graceful handling of large pastes
|
|
8
|
+
* - Visual feedback for paste operations
|
|
9
|
+
* - Configurable preview length
|
|
10
|
+
*/
|
|
11
|
+
export interface MultiLinePasteResult {
|
|
12
|
+
handled: boolean;
|
|
13
|
+
result?: string;
|
|
14
|
+
isPending?: boolean;
|
|
15
|
+
lineCount?: number;
|
|
16
|
+
preview?: string;
|
|
17
|
+
fullContent?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MultiLinePasteConfig {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
/** Maximum characters for preview display */
|
|
22
|
+
maxPreviewLength: number;
|
|
23
|
+
/** Time threshold (ms) for multi-line detection */
|
|
24
|
+
pasteThresholdMs: number;
|
|
25
|
+
/** Enable debug logging */
|
|
26
|
+
debug: boolean;
|
|
27
|
+
/** Show visual indicators for paste operations */
|
|
28
|
+
showVisualIndicators: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface PasteState {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
inPaste: boolean;
|
|
33
|
+
pasteBuffer: string[];
|
|
34
|
+
multiLineBuffer: string[];
|
|
35
|
+
multiLineMode: boolean;
|
|
36
|
+
lastInputTime: number;
|
|
37
|
+
rawPasteBuffer: string;
|
|
38
|
+
capturingRaw: boolean;
|
|
39
|
+
pasteJustCaptured: boolean;
|
|
40
|
+
pasteJustCapturedLineCount: number;
|
|
41
|
+
}
|
|
42
|
+
export declare class MultiLinePasteManager {
|
|
43
|
+
private config;
|
|
44
|
+
private state;
|
|
45
|
+
constructor(config?: Partial<MultiLinePasteConfig>);
|
|
46
|
+
/**
|
|
47
|
+
* Process input and detect multi-line pastes
|
|
48
|
+
*/
|
|
49
|
+
process(input: string): MultiLinePasteResult;
|
|
50
|
+
/**
|
|
51
|
+
* Handle bracketed paste mode (ANSI escape sequences)
|
|
52
|
+
*/
|
|
53
|
+
private handleBracketedPaste;
|
|
54
|
+
/**
|
|
55
|
+
* Handle multi-line detection via timing
|
|
56
|
+
*/
|
|
57
|
+
private handleMultiLineDetection;
|
|
58
|
+
/**
|
|
59
|
+
* Get result for bracketed paste
|
|
60
|
+
*/
|
|
61
|
+
private getBracketedPasteResult;
|
|
62
|
+
/**
|
|
63
|
+
* Generate a short preview description of the paste
|
|
64
|
+
*/
|
|
65
|
+
private generatePreview;
|
|
66
|
+
/**
|
|
67
|
+
* Finalize any pending paste operation
|
|
68
|
+
*/
|
|
69
|
+
finalize(): MultiLinePasteResult | null;
|
|
70
|
+
/**
|
|
71
|
+
* Check if currently processing a paste
|
|
72
|
+
*/
|
|
73
|
+
isInPaste(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Get current paste buffer
|
|
76
|
+
*/
|
|
77
|
+
getPasteBuffer(): string[];
|
|
78
|
+
/**
|
|
79
|
+
* Reset paste state
|
|
80
|
+
*/
|
|
81
|
+
reset(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Enable/disable paste handling
|
|
84
|
+
*/
|
|
85
|
+
setEnabled(enabled: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* Update configuration
|
|
88
|
+
*/
|
|
89
|
+
updateConfig(config: Partial<MultiLinePasteConfig>): void;
|
|
90
|
+
/**
|
|
91
|
+
* Get current state for debugging
|
|
92
|
+
*/
|
|
93
|
+
getState(): PasteState;
|
|
94
|
+
/**
|
|
95
|
+
* Get current configuration
|
|
96
|
+
*/
|
|
97
|
+
getConfig(): MultiLinePasteConfig;
|
|
98
|
+
/**
|
|
99
|
+
* Validate state consistency
|
|
100
|
+
*/
|
|
101
|
+
validateState(): {
|
|
102
|
+
valid: boolean;
|
|
103
|
+
issues: string[];
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=multiLinePasteManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiLinePasteManager.d.ts","sourceRoot":"","sources":["../../src/shell/multiLinePasteManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,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;IACH,QAAQ,IAAI,UAAU;IAItB;;OAEG;IACH,SAAS,IAAI,oBAAoB;IAIjC;;OAEG;IACH,aAAa,IAAI;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE;CAoBtD"}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MultiLinePasteManager - Enhanced multi-line paste handling with improved UX
|
|
3
|
+
*
|
|
4
|
+
* Features:
|
|
5
|
+
* - Short block description during input: "[Pasted: 15 lines]"
|
|
6
|
+
* - Full content sent to AI on submission
|
|
7
|
+
* - Graceful handling of large pastes
|
|
8
|
+
* - Visual feedback for paste operations
|
|
9
|
+
* - Configurable preview length
|
|
10
|
+
*/
|
|
11
|
+
const BRACKETED_PASTE_START = '\u001b[200~';
|
|
12
|
+
const BRACKETED_PASTE_END = '\u001b[201~';
|
|
13
|
+
export class MultiLinePasteManager {
|
|
14
|
+
config;
|
|
15
|
+
state;
|
|
16
|
+
constructor(config = {}) {
|
|
17
|
+
this.config = {
|
|
18
|
+
enabled: true,
|
|
19
|
+
maxPreviewLength: 80,
|
|
20
|
+
pasteThresholdMs: 50,
|
|
21
|
+
debug: false,
|
|
22
|
+
showVisualIndicators: true,
|
|
23
|
+
...config
|
|
24
|
+
};
|
|
25
|
+
this.state = {
|
|
26
|
+
enabled: this.config.enabled,
|
|
27
|
+
inPaste: false,
|
|
28
|
+
pasteBuffer: [],
|
|
29
|
+
multiLineBuffer: [],
|
|
30
|
+
multiLineMode: false,
|
|
31
|
+
lastInputTime: 0,
|
|
32
|
+
rawPasteBuffer: '',
|
|
33
|
+
capturingRaw: false,
|
|
34
|
+
pasteJustCaptured: false,
|
|
35
|
+
pasteJustCapturedLineCount: 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Process input and detect multi-line pastes
|
|
40
|
+
*/
|
|
41
|
+
process(input) {
|
|
42
|
+
if (!this.state.enabled) {
|
|
43
|
+
return { handled: false };
|
|
44
|
+
}
|
|
45
|
+
const currentTime = Date.now();
|
|
46
|
+
const timeSinceLastInput = currentTime - this.state.lastInputTime;
|
|
47
|
+
this.state.lastInputTime = currentTime;
|
|
48
|
+
// Handle bracketed paste mode
|
|
49
|
+
if (this.handleBracketedPaste(input)) {
|
|
50
|
+
return this.getBracketedPasteResult();
|
|
51
|
+
}
|
|
52
|
+
// Handle multi-line detection via timing
|
|
53
|
+
return this.handleMultiLineDetection(input, timeSinceLastInput);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Handle bracketed paste mode (ANSI escape sequences)
|
|
57
|
+
*/
|
|
58
|
+
handleBracketedPaste(input) {
|
|
59
|
+
if (input.includes(BRACKETED_PASTE_START)) {
|
|
60
|
+
this.state.inPaste = true;
|
|
61
|
+
this.state.pasteBuffer = [];
|
|
62
|
+
const startIndex = input.indexOf(BRACKETED_PASTE_START);
|
|
63
|
+
const contentAfterStart = input.slice(startIndex + BRACKETED_PASTE_START.length);
|
|
64
|
+
if (contentAfterStart.includes(BRACKETED_PASTE_END)) {
|
|
65
|
+
// Complete paste in single input
|
|
66
|
+
const endIndex = contentAfterStart.indexOf(BRACKETED_PASTE_END);
|
|
67
|
+
const pasteContent = contentAfterStart.slice(0, endIndex);
|
|
68
|
+
this.state.pasteBuffer = pasteContent.split('\n');
|
|
69
|
+
this.state.inPaste = false;
|
|
70
|
+
this.state.pasteJustCaptured = true;
|
|
71
|
+
this.state.pasteJustCapturedLineCount = this.state.pasteBuffer.length;
|
|
72
|
+
if (this.config.debug) {
|
|
73
|
+
console.log(`[MultiLinePaste] Complete bracketed paste: ${this.state.pasteBuffer.length} lines`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Start of multi-part paste
|
|
78
|
+
this.state.pasteBuffer = contentAfterStart.split('\n');
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (this.state.inPaste && input.includes(BRACKETED_PASTE_END)) {
|
|
83
|
+
// End of multi-part paste
|
|
84
|
+
const endIndex = input.indexOf(BRACKETED_PASTE_END);
|
|
85
|
+
const contentBeforeEnd = input.slice(0, endIndex);
|
|
86
|
+
this.state.pasteBuffer.push(...contentBeforeEnd.split('\n'));
|
|
87
|
+
this.state.inPaste = false;
|
|
88
|
+
this.state.pasteJustCaptured = true;
|
|
89
|
+
this.state.pasteJustCapturedLineCount = this.state.pasteBuffer.length;
|
|
90
|
+
if (this.config.debug) {
|
|
91
|
+
console.log(`[MultiLinePaste] Completed multi-part paste: ${this.state.pasteBuffer.length} lines`);
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
if (this.state.inPaste) {
|
|
96
|
+
// Continue accumulating paste content
|
|
97
|
+
this.state.pasteBuffer.push(...input.split('\n'));
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Handle multi-line detection via timing
|
|
104
|
+
*/
|
|
105
|
+
handleMultiLineDetection(input, timeSinceLastInput) {
|
|
106
|
+
const lines = input.split('\n');
|
|
107
|
+
const isRapidInput = timeSinceLastInput < this.config.pasteThresholdMs;
|
|
108
|
+
if (lines.length > 1 && isRapidInput) {
|
|
109
|
+
// Likely a multi-line paste
|
|
110
|
+
if (!this.state.multiLineMode) {
|
|
111
|
+
this.state.multiLineMode = true;
|
|
112
|
+
this.state.multiLineBuffer = [];
|
|
113
|
+
}
|
|
114
|
+
this.state.multiLineBuffer.push(...lines);
|
|
115
|
+
if (this.config.debug) {
|
|
116
|
+
console.log(`[MultiLinePaste] Multi-line paste detected: ${this.state.multiLineBuffer.length} lines`);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
handled: true,
|
|
120
|
+
isPending: true,
|
|
121
|
+
lineCount: this.state.multiLineBuffer.length,
|
|
122
|
+
preview: this.generatePreview(this.state.multiLineBuffer.join('\n'), this.state.multiLineBuffer.length)
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (this.state.multiLineMode) {
|
|
126
|
+
if (isRapidInput) {
|
|
127
|
+
// Continue accumulating
|
|
128
|
+
this.state.multiLineBuffer.push(...lines);
|
|
129
|
+
return {
|
|
130
|
+
handled: true,
|
|
131
|
+
isPending: true,
|
|
132
|
+
lineCount: this.state.multiLineBuffer.length,
|
|
133
|
+
preview: this.generatePreview(this.state.multiLineBuffer.join('\n'), this.state.multiLineBuffer.length)
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// End of paste
|
|
138
|
+
const result = this.state.multiLineBuffer.join('\n');
|
|
139
|
+
const lineCount = this.state.multiLineBuffer.length;
|
|
140
|
+
this.state.multiLineMode = false;
|
|
141
|
+
this.state.multiLineBuffer = [];
|
|
142
|
+
if (this.config.debug) {
|
|
143
|
+
console.log(`[MultiLinePaste] Multi-line paste completed: ${lineCount} lines`);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
handled: true,
|
|
147
|
+
result,
|
|
148
|
+
lineCount,
|
|
149
|
+
preview: this.generatePreview(result, lineCount),
|
|
150
|
+
fullContent: result
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { handled: false };
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get result for bracketed paste
|
|
158
|
+
*/
|
|
159
|
+
getBracketedPasteResult() {
|
|
160
|
+
if (this.state.inPaste) {
|
|
161
|
+
return {
|
|
162
|
+
handled: true,
|
|
163
|
+
isPending: true,
|
|
164
|
+
lineCount: this.state.pasteBuffer.length,
|
|
165
|
+
preview: this.generatePreview(this.state.pasteBuffer.join('\n'), this.state.pasteBuffer.length)
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (this.state.pasteJustCaptured) {
|
|
169
|
+
const result = this.state.pasteBuffer.join('\n');
|
|
170
|
+
const lineCount = this.state.pasteJustCapturedLineCount;
|
|
171
|
+
this.state.pasteJustCaptured = false;
|
|
172
|
+
this.state.pasteJustCapturedLineCount = 0;
|
|
173
|
+
return {
|
|
174
|
+
handled: true,
|
|
175
|
+
result,
|
|
176
|
+
lineCount,
|
|
177
|
+
preview: this.generatePreview(result, lineCount),
|
|
178
|
+
fullContent: result
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
return { handled: false };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Generate a short preview description of the paste
|
|
185
|
+
*/
|
|
186
|
+
generatePreview(content, lineCount) {
|
|
187
|
+
if (!content.trim()) {
|
|
188
|
+
return `[Empty paste: ${lineCount} lines]`;
|
|
189
|
+
}
|
|
190
|
+
const lines = content.split('\n').map(l => l.trim()).filter(Boolean);
|
|
191
|
+
if (lines.length === 0) {
|
|
192
|
+
return `[Empty paste: ${lineCount} lines]`;
|
|
193
|
+
}
|
|
194
|
+
const firstLine = lines[0] || '';
|
|
195
|
+
const maxLength = this.config.maxPreviewLength - 15; // Reserve space for line count
|
|
196
|
+
let preview = firstLine;
|
|
197
|
+
if (preview && preview.length > maxLength) {
|
|
198
|
+
preview = preview.slice(0, maxLength - 3) + '...';
|
|
199
|
+
}
|
|
200
|
+
const visualIndicator = this.config.showVisualIndicators ? '📋 ' : '';
|
|
201
|
+
return `${visualIndicator}${preview} [${lineCount} lines]`;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Finalize any pending paste operation
|
|
205
|
+
*/
|
|
206
|
+
finalize() {
|
|
207
|
+
if (this.state.multiLineMode && this.state.multiLineBuffer.length > 0) {
|
|
208
|
+
const result = this.state.multiLineBuffer.join('\n');
|
|
209
|
+
const lineCount = this.state.multiLineBuffer.length;
|
|
210
|
+
this.state.multiLineMode = false;
|
|
211
|
+
this.state.multiLineBuffer = [];
|
|
212
|
+
return {
|
|
213
|
+
handled: true,
|
|
214
|
+
result,
|
|
215
|
+
lineCount,
|
|
216
|
+
preview: this.generatePreview(result, lineCount),
|
|
217
|
+
fullContent: result
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (this.state.inPaste && this.state.pasteBuffer.length > 0) {
|
|
221
|
+
const result = this.state.pasteBuffer.join('\n');
|
|
222
|
+
const lineCount = this.state.pasteBuffer.length;
|
|
223
|
+
this.state.inPaste = false;
|
|
224
|
+
this.state.pasteBuffer = [];
|
|
225
|
+
return {
|
|
226
|
+
handled: true,
|
|
227
|
+
result,
|
|
228
|
+
lineCount,
|
|
229
|
+
preview: this.generatePreview(result, lineCount),
|
|
230
|
+
fullContent: result
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Check if currently processing a paste
|
|
237
|
+
*/
|
|
238
|
+
isInPaste() {
|
|
239
|
+
return this.state.inPaste || this.state.multiLineMode;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Get current paste buffer
|
|
243
|
+
*/
|
|
244
|
+
getPasteBuffer() {
|
|
245
|
+
return this.state.inPaste ? [...this.state.pasteBuffer] : [...this.state.multiLineBuffer];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Reset paste state
|
|
249
|
+
*/
|
|
250
|
+
reset() {
|
|
251
|
+
this.state.inPaste = false;
|
|
252
|
+
this.state.pasteBuffer = [];
|
|
253
|
+
this.state.multiLineMode = false;
|
|
254
|
+
this.state.multiLineBuffer = [];
|
|
255
|
+
this.state.rawPasteBuffer = '';
|
|
256
|
+
this.state.capturingRaw = false;
|
|
257
|
+
this.state.pasteJustCaptured = false;
|
|
258
|
+
this.state.pasteJustCapturedLineCount = 0;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Enable/disable paste handling
|
|
262
|
+
*/
|
|
263
|
+
setEnabled(enabled) {
|
|
264
|
+
this.state.enabled = enabled;
|
|
265
|
+
if (!enabled) {
|
|
266
|
+
this.reset();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Update configuration
|
|
271
|
+
*/
|
|
272
|
+
updateConfig(config) {
|
|
273
|
+
this.config = { ...this.config, ...config };
|
|
274
|
+
this.state.enabled = this.config.enabled;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get current state for debugging
|
|
278
|
+
*/
|
|
279
|
+
getState() {
|
|
280
|
+
return { ...this.state };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Get current configuration
|
|
284
|
+
*/
|
|
285
|
+
getConfig() {
|
|
286
|
+
return { ...this.config };
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Validate state consistency
|
|
290
|
+
*/
|
|
291
|
+
validateState() {
|
|
292
|
+
const issues = [];
|
|
293
|
+
if (this.state.inPaste && this.state.pasteBuffer.length === 0) {
|
|
294
|
+
issues.push('In paste mode but buffer is empty');
|
|
295
|
+
}
|
|
296
|
+
if (this.state.multiLineMode && this.state.multiLineBuffer.length === 0) {
|
|
297
|
+
issues.push('In multi-line mode but buffer is empty');
|
|
298
|
+
}
|
|
299
|
+
if (this.state.inPaste && this.state.multiLineMode) {
|
|
300
|
+
issues.push('Both paste and multi-line modes active simultaneously');
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
valid: issues.length === 0,
|
|
304
|
+
issues
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=multiLinePasteManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiLinePasteManager.js","sourceRoot":"","sources":["../../src/shell/multiLinePasteManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoCH,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAC5C,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAE1C,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAAuB;IAC7B,KAAK,CAAa;IAE1B,YAAY,SAAwC,EAAE;QACpD,IAAI,CAAC,MAAM,GAA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ACN,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,aAAa;QACX,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9D,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxE,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;YACnD,MAAM,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAC;QACvE,CAAC;QAED,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;SACP,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateManager.d.ts","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"updateManager.d.ts","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"AAoDA,wBAAsB,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiElF"}
|
|
@@ -1,11 +1,56 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
1
|
+
import { spawn, execSync } from 'node:child_process';
|
|
2
2
|
import { stdin as input, stdout as output } from 'node:process';
|
|
3
3
|
import { createInterface } from 'node:readline/promises';
|
|
4
4
|
import { display } from '../ui/display.js';
|
|
5
5
|
const PACKAGE_NAME = 'erosolar-cli';
|
|
6
6
|
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}/latest`;
|
|
7
7
|
const FETCH_TIMEOUT_MS = 4000;
|
|
8
|
+
/**
|
|
9
|
+
* Auto-relaunch the CLI after an update.
|
|
10
|
+
* Uses exec to replace the current process with a fresh instance.
|
|
11
|
+
*/
|
|
12
|
+
function relaunchCLI() {
|
|
13
|
+
const args = process.argv.slice(2);
|
|
14
|
+
display.showInfo('🔄 Relaunching CLI with updated version...\n');
|
|
15
|
+
// Small delay to let the message display
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
try {
|
|
18
|
+
// Find the CLI path
|
|
19
|
+
const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
|
|
20
|
+
const cliPath = `${npmRoot}/${PACKAGE_NAME}/dist/bin/erosolar.js`;
|
|
21
|
+
// Spawn a detached process that will outlive the current one
|
|
22
|
+
const child = spawn('node', [cliPath, ...args], {
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
detached: false,
|
|
25
|
+
env: {
|
|
26
|
+
...process.env,
|
|
27
|
+
EROSOLAR_JUST_UPDATED: '1', // Signal to skip update check
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
// Exit the current process once child is running
|
|
31
|
+
child.on('spawn', () => {
|
|
32
|
+
// Give child a moment to start
|
|
33
|
+
setTimeout(() => process.exit(0), 100);
|
|
34
|
+
});
|
|
35
|
+
child.on('error', (err) => {
|
|
36
|
+
display.showWarning(`Auto-relaunch failed: ${err.message}`);
|
|
37
|
+
display.showInfo(`Please restart the CLI manually.`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
display.showWarning(`Auto-relaunch failed: ${err instanceof Error ? err.message : 'unknown error'}`);
|
|
42
|
+
display.showInfo(`Please restart the CLI manually.`);
|
|
43
|
+
}
|
|
44
|
+
}, 500);
|
|
45
|
+
}
|
|
8
46
|
export async function maybeOfferCliUpdate(currentVersion) {
|
|
47
|
+
// Skip update check if we just relaunched after an update
|
|
48
|
+
if (process.env['EROSOLAR_JUST_UPDATED'] === '1') {
|
|
49
|
+
display.showInfo(`✨ Now running ${PACKAGE_NAME}@${currentVersion}`);
|
|
50
|
+
// Clear the flag for future runs
|
|
51
|
+
delete process.env['EROSOLAR_JUST_UPDATED'];
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
9
54
|
try {
|
|
10
55
|
const latestVersion = await fetchLatestVersion();
|
|
11
56
|
if (!latestVersion) {
|
|
@@ -30,7 +75,15 @@ export async function maybeOfferCliUpdate(currentVersion) {
|
|
|
30
75
|
}
|
|
31
76
|
const success = await installLatestVersion();
|
|
32
77
|
if (success) {
|
|
33
|
-
display.showInfo(
|
|
78
|
+
display.showInfo(`✅ Update to ${PACKAGE_NAME}@${latestVersion} complete!`);
|
|
79
|
+
// Ask if user wants auto-relaunch
|
|
80
|
+
const shouldRelaunch = await promptForRelaunch();
|
|
81
|
+
if (shouldRelaunch) {
|
|
82
|
+
relaunchCLI();
|
|
83
|
+
// Return false to signal we're exiting (relaunch handles the rest)
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
display.showInfo(`Restart the CLI to use the new version.`);
|
|
34
87
|
return false;
|
|
35
88
|
}
|
|
36
89
|
display.showWarning(`Failed to install ${PACKAGE_NAME}@latest. Please run "npm install -g ${PACKAGE_NAME}@latest" manually.`);
|
|
@@ -96,6 +149,17 @@ async function promptForUpdate() {
|
|
|
96
149
|
prompt.close();
|
|
97
150
|
}
|
|
98
151
|
}
|
|
152
|
+
async function promptForRelaunch() {
|
|
153
|
+
const prompt = createInterface({ input, output });
|
|
154
|
+
try {
|
|
155
|
+
const answer = await prompt.question('Relaunch now? (Y/n): ');
|
|
156
|
+
const normalized = answer.trim().toLowerCase();
|
|
157
|
+
return normalized === '' || normalized === 'y' || normalized === 'yes';
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
prompt.close();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
99
163
|
async function installLatestVersion() {
|
|
100
164
|
const binary = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
101
165
|
return new Promise((resolve) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateManager.js","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"updateManager.js","sourceRoot":"","sources":["../../src/shell/updateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,YAAY,GAAG,8BAA8B,YAAY,SAAS,CAAC;AACzE,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B;;;GAGG;AACH,SAAS,WAAW;IAClB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,OAAO,CAAC,QAAQ,CAAC,8CAA8C,CAAC,CAAC;IAEjE,yCAAyC;IACzC,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,CAAC;YACH,oBAAoB;YACpB,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;YACrE,MAAM,OAAO,GAAG,GAAG,OAAO,IAAI,YAAY,uBAAuB,CAAC;YAElE,6DAA6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4
|
"description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
|
|
5
5
|
"main": "dist/bin/erosolar-optimized.js",
|
|
6
6
|
"type": "module",
|