fleetbo-cockpit-cli 1.0.147 → 1.0.149
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 +81 -60
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -250,8 +250,8 @@ if (command === 'alex') {
|
|
|
250
250
|
const initialPrompt = args.slice(1).join(' ');
|
|
251
251
|
|
|
252
252
|
const processAlexRequest = async (prompt) => {
|
|
253
|
-
if (prompt.length >
|
|
254
|
-
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/
|
|
253
|
+
if (prompt.length > 4000) {
|
|
254
|
+
console.log('\n\x1b[31m⛔ [Alex Safety] Request too long (' + prompt.length + '/4000 chars).\x1b[0m');
|
|
255
255
|
return;
|
|
256
256
|
}
|
|
257
257
|
|
|
@@ -309,8 +309,8 @@ if (command === 'alex') {
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
if (actualMetalCode) {
|
|
312
|
-
const sourceText = fs.existsSync(localKtPath) ? "LOCAL" : "CACHE";
|
|
313
|
-
process.stdout.write(` \x1b[32mFOUND METAL
|
|
312
|
+
//const sourceText = fs.existsSync(localKtPath) ? "LOCAL" : "CACHE";
|
|
313
|
+
process.stdout.write(` \x1b[32mFOUND METAL\x1b[0m\n`);
|
|
314
314
|
|
|
315
315
|
// Extraction des schémas mémoires (uniquement dispo dans le cache cloud)
|
|
316
316
|
let memoryScript = "";
|
|
@@ -587,47 +587,47 @@ if (command === 'alex') {
|
|
|
587
587
|
const modelLabel = aiModel && aiModel !== 'auto' ? aiModel : 'auto';
|
|
588
588
|
|
|
589
589
|
console.log('');
|
|
590
|
-
console.log('\x1b[90m
|
|
591
|
-
console.log('\x1b[90m
|
|
592
|
-
console.log('\x1b[90m
|
|
593
|
-
console.log('\x1b[90m
|
|
594
|
-
console.log('\x1b[90m
|
|
595
|
-
console.log('\x1b[90m
|
|
596
|
-
console.log('\x1b[90m
|
|
590
|
+
console.log('\x1b[90m┌─────────────────────────────────────────────────────────┐\x1b[0m');
|
|
591
|
+
console.log('\x1b[90m│ │\x1b[0m');
|
|
592
|
+
console.log('\x1b[90m│\x1b[0m \x1b[1m\x1b[36m⚡ ALEX\x1b[0m \x1b[90m— System Architect · Fleetbo OS\x1b[0m \x1b[90m│\x1b[0m');
|
|
593
|
+
console.log('\x1b[90m│ │\x1b[0m');
|
|
594
|
+
console.log('\x1b[90m│\x1b[0m \x1b[90mYour JS stays the brain. I forge the metal.\x1b[0m \x1b[90m│\x1b[0m');
|
|
595
|
+
console.log('\x1b[90m│ │\x1b[0m');
|
|
596
|
+
console.log('\x1b[90m└─────────────────────────────────────────────────────────┘\x1b[0m');
|
|
597
597
|
|
|
598
598
|
// AI ENGINE STATUS
|
|
599
599
|
console.log('');
|
|
600
|
-
console.log(
|
|
600
|
+
console.log(`\x1b[32m✓\x1b[0m ${providerLabel} \x1b[90m· ${modelLabel}\x1b[0m`);
|
|
601
601
|
|
|
602
602
|
// FORGE CAPABILITIES
|
|
603
603
|
console.log('');
|
|
604
|
-
console.log('
|
|
605
|
-
console.log('
|
|
606
|
-
console.log('
|
|
607
|
-
console.log('
|
|
608
|
-
console.log('
|
|
609
|
-
console.log('
|
|
610
|
-
console.log('
|
|
604
|
+
console.log('\x1b[36mCAPABILITIES\x1b[0m');
|
|
605
|
+
console.log('\x1b[90m─────────────────────────────────────────────────────\x1b[0m');
|
|
606
|
+
console.log('\x1b[1mHardware\x1b[0m\x1b[90m Camera · Scanner · GPS · Biometrics\x1b[0m');
|
|
607
|
+
console.log('\x1b[1mHigh-Perf\x1b[0m\x1b[90m Video Feed · Swipe Deck · Audio\x1b[0m');
|
|
608
|
+
console.log('\x1b[1mSovereign\x1b[0m\x1b[90m Form + Photo + Save-to-Cloud\x1b[0m');
|
|
609
|
+
console.log('\x1b[1mFleetbo View\x1b[0m\x1b[90m Full native tab (120 FPS)\x1b[0m');
|
|
610
|
+
console.log('\x1b[90m─────────────────────────────────────────────────────\x1b[0m');
|
|
611
611
|
|
|
612
612
|
// TRIGGER WORDS
|
|
613
613
|
console.log('');
|
|
614
|
-
console.log('
|
|
614
|
+
console.log('\x1b[36mTRIGGER WORDS\x1b[0m \x1b[90m(required to activate code generation)\x1b[0m');
|
|
615
615
|
console.log('');
|
|
616
|
-
console.log('
|
|
616
|
+
console.log('\x1b[33mforge\x1b[0m \x1b[90m·\x1b[0m \x1b[33mcreate\x1b[0m \x1b[90m·\x1b[0m \x1b[33mupdate\x1b[0m \x1b[90m·\x1b[0m \x1b[33mmodify\x1b[0m \x1b[90m·\x1b[0m \x1b[33mfix\x1b[0m \x1b[90m·\x1b[0m \x1b[33medit\x1b[0m');
|
|
617
617
|
console.log('');
|
|
618
|
-
console.log('
|
|
618
|
+
console.log('\x1b[90mWithout a trigger word, Alex answers but does not generate code.\x1b[0m');
|
|
619
619
|
|
|
620
620
|
// EXAMPLES
|
|
621
621
|
console.log('');
|
|
622
|
-
console.log('
|
|
622
|
+
console.log('\x1b[36mEXAMPLES\x1b[0m');
|
|
623
623
|
console.log('');
|
|
624
|
-
console.log('
|
|
625
|
-
console.log('
|
|
626
|
-
console.log('
|
|
624
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mforge\x1b[90m a camera module to scan receipts for my expense tracker"\x1b[0m');
|
|
625
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mcreate\x1b[90m a form module to add products with photos to my catalog"\x1b[0m');
|
|
626
|
+
console.log('\x1b[33m›\x1b[0m \x1b[90m"\x1b[33mupdate\x1b[90m the CloudCamera module to save in the collection orders"\x1b[0m');
|
|
627
627
|
|
|
628
628
|
// READY
|
|
629
629
|
console.log('');
|
|
630
|
-
console.log('
|
|
630
|
+
console.log('\x1b[32mAlex ❯\x1b[0m Describe your feature.');
|
|
631
631
|
console.log('');
|
|
632
632
|
|
|
633
633
|
const rl = readline.createInterface({
|
|
@@ -639,48 +639,69 @@ if (command === 'alex') {
|
|
|
639
639
|
process.stdout.write('\n\x1b[F');
|
|
640
640
|
rl.prompt();
|
|
641
641
|
|
|
642
|
-
let inputBuffer =
|
|
643
|
-
let isProcessing = false;
|
|
642
|
+
let inputBuffer = [];
|
|
643
|
+
let isProcessing = false;
|
|
644
|
+
let isPasteMode = false;
|
|
644
645
|
|
|
645
|
-
|
|
646
|
-
if (
|
|
647
|
-
|
|
648
|
-
const trimmedLine = line.trim();
|
|
649
|
-
|
|
650
|
-
if (['exit', 'quit'].includes(trimmedLine.toLowerCase())) {
|
|
646
|
+
const executePrompt = async (text) => {
|
|
647
|
+
if (['exit', 'quit'].includes(text.toLowerCase())) {
|
|
651
648
|
console.log('\n\x1b[90m Alex session closed.\x1b[0m');
|
|
652
649
|
rl.close();
|
|
653
650
|
return;
|
|
654
651
|
}
|
|
652
|
+
if (text !== "") {
|
|
653
|
+
if (text.length > 4000) {
|
|
654
|
+
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${text.length}/4000 characters).\x1b[0m`);
|
|
655
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
656
|
+
rl.prompt();
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
isProcessing = true;
|
|
660
|
+
rl.setPrompt("");
|
|
661
|
+
await processAlexRequest(text);
|
|
662
|
+
isProcessing = false;
|
|
663
|
+
console.log('');
|
|
664
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
665
|
+
rl.prompt();
|
|
666
|
+
} else {
|
|
667
|
+
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
668
|
+
rl.prompt();
|
|
669
|
+
}
|
|
670
|
+
};
|
|
655
671
|
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
rl.setPrompt("");
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
if (inputBuffer.trim() !== "") {
|
|
662
|
-
const finalPrompt = inputBuffer.trim();
|
|
663
|
-
inputBuffer = "";
|
|
664
|
-
|
|
665
|
-
if (finalPrompt.length > 1000) {
|
|
666
|
-
console.log(`\n\x1b[31m⛔ [Alex Safety] Mission rejected: Excessive size (${finalPrompt.length}/1000 characters).\x1b[0m`);
|
|
667
|
-
rl.setPrompt(`\x1b[34m${dynamicUsername} ❯ \x1b[0m`);
|
|
668
|
-
rl.prompt();
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
672
|
+
rl.on('line', async (line) => {
|
|
673
|
+
if (isProcessing) return;
|
|
671
674
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
675
|
+
// 1. SI LE MODE COLLAGE EST ACTIF
|
|
676
|
+
if (isPasteMode) {
|
|
677
|
+
// Dès que tu tapes EOF, on assemble tout le texte et on l'envoie à Alex
|
|
678
|
+
if (['/s', '/send', 'eof'].includes(line.trim().toLowerCase())) {
|
|
679
|
+
const finalPrompt = inputBuffer.join('\n').trim();
|
|
680
|
+
inputBuffer = [];
|
|
681
|
+
isPasteMode = false;
|
|
682
|
+
await executePrompt(finalPrompt);
|
|
680
683
|
} else {
|
|
681
|
-
|
|
682
|
-
|
|
684
|
+
// On accumule le texte collé silencieusement
|
|
685
|
+
inputBuffer.push(line);
|
|
683
686
|
}
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// 2. ACTIVATION DU MODE COLLAGE
|
|
691
|
+
if (['/paste', '/p'].includes(line.trim().toLowerCase())) {
|
|
692
|
+
isPasteMode = true;
|
|
693
|
+
console.log('\x1b[36m [MULTILINE MODE] Paste your content below. Type /s on a new line to submit.\x1b[0m');
|
|
694
|
+
// On efface le prompt "jojo ❯" pour que ton code collé s'affiche parfaitement !
|
|
695
|
+
rl.setPrompt("");
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// 3. MODE CHAT CLASSIQUE (1 Entrée = 1 Envoi)
|
|
700
|
+
const finalPrompt = line.trim();
|
|
701
|
+
if (finalPrompt === "") {
|
|
702
|
+
rl.prompt(); // Touche Entrée dans le vide
|
|
703
|
+
} else {
|
|
704
|
+
await executePrompt(finalPrompt); // Envoi instantané
|
|
684
705
|
}
|
|
685
706
|
});
|
|
686
707
|
};
|