fleetbo-cockpit-cli 1.0.37 → 1.0.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/cli.js +23 -22
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -213,8 +213,8 @@ if (command === 'alex') {
|
|
|
213
213
|
const initialPrompt = args.slice(1).join(' ');
|
|
214
214
|
|
|
215
215
|
const processAlexRequest = async (prompt) => {
|
|
216
|
-
if (prompt.length >
|
|
217
|
-
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/
|
|
216
|
+
if (prompt.length > 1000) {
|
|
217
|
+
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/1000 chars).\x1b[0m');
|
|
218
218
|
console.log('\x1b[90mAlex prefers concise instructions. Please summarize.\x1b[0m');
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
@@ -460,43 +460,44 @@ if (command === 'alex') {
|
|
|
460
460
|
rl.prompt();
|
|
461
461
|
|
|
462
462
|
// --- LOGIQUE DE BUFFER MULTILIGNE ---
|
|
463
|
-
let inputBuffer = "";
|
|
463
|
+
let inputBuffer = "";
|
|
464
|
+
let pasteTimer = null; // Debouncer for fast input streams
|
|
464
465
|
|
|
465
|
-
rl.on('line',
|
|
466
|
+
rl.on('line', (line) => {
|
|
466
467
|
const trimmedLine = line.trim();
|
|
467
468
|
|
|
468
|
-
//
|
|
469
|
+
// Exit commands
|
|
469
470
|
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
470
471
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
471
472
|
rl.close();
|
|
472
473
|
return;
|
|
473
474
|
}
|
|
474
475
|
|
|
475
|
-
//
|
|
476
|
+
// Accumulate all non-empty lines
|
|
476
477
|
if (trimmedLine !== "") {
|
|
477
|
-
// Si la ligne contient du texte, on l'ajoute au buffer
|
|
478
478
|
inputBuffer += (inputBuffer ? "\n" : "") + line;
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// DEBOUNCE LOGIC : Wait 50ms of silence before checking validation
|
|
482
|
+
if (pasteTimer) clearTimeout(pasteTimer);
|
|
483
|
+
|
|
484
|
+
pasteTimer = setTimeout(async () => {
|
|
485
|
+
// Trigger forge ONLY on an intentional EMPTY line + content in buffer
|
|
486
|
+
if (trimmedLine === "" && inputBuffer.trim() !== "") {
|
|
486
487
|
const finalPrompt = inputBuffer.trim();
|
|
487
|
-
inputBuffer = ""; //
|
|
488
|
+
inputBuffer = ""; // Flush immediately
|
|
488
489
|
|
|
489
|
-
// Remise à zéro du prompt visuel d'origine
|
|
490
490
|
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
491
|
-
|
|
492
|
-
// Lancement unique de la forge
|
|
493
491
|
await processAlexRequest(finalPrompt);
|
|
494
492
|
console.log('');
|
|
493
|
+
} else if (inputBuffer !== "") {
|
|
494
|
+
// Show we are still listening for the next line
|
|
495
|
+
rl.setPrompt(`\x1b[34m > \x1b[0m`);
|
|
495
496
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
497
|
+
|
|
498
|
+
process.stdout.write('\n\x1b[F');
|
|
499
|
+
rl.prompt();
|
|
500
|
+
}, 50); // 50ms absorbs the fastest "paste" bursts
|
|
500
501
|
});
|
|
501
502
|
};
|
|
502
503
|
|