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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.23.23",
3
+ "version": "2.23.25",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -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({ input: process.stdin, output: process.stdout, terminal: true });
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
- // close event → inquirer tool onayı sırasında tetiklenebilir, hemen yeniden oluştur
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
- rl.question(chalk.gray('> '), async (msg) => {
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(msg);
742
+ await handleMessage(trimmed);
732
743
  } catch (err) {
733
- console.log(chalk.red(`\n ❌ Beklenmeyen hata: ${err.message}\n`));
744
+ console.error(chalk.red('Error: ' + err.message));
734
745
  }
735
- promptLoop();
736
- });
746
+ }
737
747
  }
738
748
 
739
749
  createRl();