natureco-cli 2.23.23 → 2.23.25
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/package.json +1 -1
- package/src/commands/code.js +26 -16
package/package.json
CHANGED
package/src/commands/code.js
CHANGED
|
@@ -603,11 +603,6 @@ ${indexPrompt}`;
|
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
-
if (userMessage === 'exit' || userMessage === 'quit' || userMessage === 'çıkış' || userMessage === 'q') {
|
|
607
|
-
showSummary();
|
|
608
|
-
process.exit(0);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
606
|
stats.messageCount++;
|
|
612
607
|
console.log(chalk.white('You ') + userMessage);
|
|
613
608
|
conversationMessages.push({ role: 'user', content: userMessage });
|
|
@@ -698,7 +693,11 @@ ${indexPrompt}`;
|
|
|
698
693
|
if (rl) {
|
|
699
694
|
try { rl.removeAllListeners(); rl.close(); } catch {}
|
|
700
695
|
}
|
|
701
|
-
rl = readline.createInterface({
|
|
696
|
+
rl = readline.createInterface({
|
|
697
|
+
input: process.stdin,
|
|
698
|
+
output: process.stdout,
|
|
699
|
+
terminal: true,
|
|
700
|
+
});
|
|
702
701
|
|
|
703
702
|
rl.on('SIGINT', async () => {
|
|
704
703
|
console.log('\n');
|
|
@@ -717,23 +716,34 @@ ${indexPrompt}`;
|
|
|
717
716
|
process.exit(0);
|
|
718
717
|
});
|
|
719
718
|
|
|
720
|
-
|
|
721
|
-
rl.on('close', () => {
|
|
722
|
-
if (process.exitCode !== undefined) return;
|
|
723
|
-
createRl();
|
|
724
|
-
});
|
|
719
|
+
rl.on('close', () => {});
|
|
725
720
|
}
|
|
726
721
|
|
|
727
722
|
async function promptLoop() {
|
|
728
|
-
|
|
723
|
+
while (true) {
|
|
724
|
+
let msg;
|
|
725
|
+
try {
|
|
726
|
+
msg = await new Promise(resolve => {
|
|
727
|
+
rl.question(chalk.gray('> '), resolve);
|
|
728
|
+
});
|
|
729
|
+
} catch {
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
|
|
729
733
|
process.stdout.write('\x1b[1A\x1b[2K');
|
|
734
|
+
|
|
735
|
+
const trimmed = msg.trim();
|
|
736
|
+
if (!trimmed) continue;
|
|
737
|
+
if (['exit', 'quit', 'çıkış', 'q'].includes(trimmed.toLowerCase())) {
|
|
738
|
+
process.exit(0);
|
|
739
|
+
}
|
|
740
|
+
|
|
730
741
|
try {
|
|
731
|
-
await handleMessage(
|
|
742
|
+
await handleMessage(trimmed);
|
|
732
743
|
} catch (err) {
|
|
733
|
-
console.
|
|
744
|
+
console.error(chalk.red('Error: ' + err.message));
|
|
734
745
|
}
|
|
735
|
-
|
|
736
|
-
});
|
|
746
|
+
}
|
|
737
747
|
}
|
|
738
748
|
|
|
739
749
|
createRl();
|