natureco-cli 2.23.25 → 2.23.27

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.25",
3
+ "version": "2.23.27",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -239,10 +239,7 @@ async function runToolCall(toolCall, stats, dryRun = false) {
239
239
 
240
240
  if (needsConfirm) {
241
241
  console.log(chalk.yellow(`\n ⚠️ ${toolCall.name}: ${inputPreview}`));
242
- const { ok } = await inquirer.prompt([{
243
- type: 'confirm', name: 'ok',
244
- message: ' Devam edilsin mi?', default: true,
245
- }]);
242
+ const ok = await confirmAction('Devam edilsin mi?');
246
243
  if (!ok) {
247
244
  console.log(chalk.gray(' İptal edildi.\n'));
248
245
  return { success: false, output: 'Kullanıcı iptal etti.' };
@@ -274,11 +271,8 @@ async function runTests(projectIndex, conversationMessages, tools, providerConfi
274
271
  const testScript = projectIndex.packageJson?.scripts?.test;
275
272
  if (!testScript || testScript.includes('no test')) return;
276
273
 
277
- const { confirm } = await inquirer.prompt([{
278
- type: 'confirm', name: 'confirm',
279
- message: chalk.yellow(' 🧪 Testleri çalıştıralım mı?'), default: true,
280
- }]);
281
- if (!confirm) return;
274
+ const confirmed = await confirmAction('🧪 Testleri çalıştıralım mı?');
275
+ if (!confirmed) return;
282
276
 
283
277
  console.log(chalk.gray('\n npm test çalışıyor...\n'));
284
278
  try {
@@ -292,10 +286,7 @@ async function runTests(projectIndex, conversationMessages, tools, providerConfi
292
286
  console.log(chalk.gray(' ' + errOutput.split('\n').join('\n ')));
293
287
  console.log();
294
288
 
295
- const { fix } = await inquirer.prompt([{
296
- type: 'confirm', name: 'fix',
297
- message: chalk.yellow(' Agent test hatasını düzeltsin mi?'), default: true,
298
- }]);
289
+ const fix = await confirmAction('Agent test hatasını düzeltsin mi?');
299
290
  if (fix) {
300
291
  return `Test hatası oluştu:\n${errOutput}\nBu hatayı düzelt.`;
301
292
  }
@@ -467,12 +458,7 @@ ${indexPrompt}`;
467
458
  console.log(chalk.gray(' ' + errorOutput.split('\n').join('\n ')));
468
459
  console.log();
469
460
 
470
- const { fix } = await inquirer.prompt([{
471
- type: 'confirm', name: 'fix',
472
- message: chalk.yellow(' Hatayı otomatik düzeltmemi ister misin?'),
473
- default: true,
474
- }]);
475
-
461
+ const fix = await confirmAction('Hatayı otomatik düzeltmemi ister misin?');
476
462
  if (fix) {
477
463
  const fixMessage = `Şu komut çalıştırıldı: ${cmd}\nHata oluştu:\n${errorOutput}\nBu hatayı analiz et ve düzelt.`;
478
464
  console.log(chalk.cyan('\n Düzeltiliyor...\n'));
@@ -582,10 +568,7 @@ ${indexPrompt}`;
582
568
  const commitMsg = await generateCommitMessage(diff.slice(0, 2000), providerConfig);
583
569
  stopSpinner(sp, 'Commit mesajı hazır', true);
584
570
  console.log(chalk.cyan(`\n Önerilen: ${chalk.white(commitMsg)}\n`));
585
- const { ok } = await inquirer.prompt([{
586
- type: 'confirm', name: 'ok',
587
- message: ' Commit edilsin mi?', default: true,
588
- }]);
571
+ const ok = await confirmAction('Commit edilsin mi?');
589
572
  if (ok) {
590
573
  execSync(`git commit -m "${commitMsg.replace(/"/g, '\\"')}"`, { cwd: workDir, stdio: 'pipe' });
591
574
  console.log(chalk.green(' ✓ Commit yapıldı!\n'));
@@ -689,6 +672,16 @@ ${indexPrompt}`;
689
672
  // ── Input loop — readline herhangi bir sebepten kapanırsa yeniden oluştur ───
690
673
  let rl;
691
674
 
675
+ async function confirmAction(message) {
676
+ return new Promise(resolve => {
677
+ rl.question(chalk.yellow(`⚠ ${message}\n[? Devam edilsin mi? (Y/n) `), answer => {
678
+ const confirmed = !answer || answer.toLowerCase() === 'y';
679
+ console.log(chalk.gray(` ✓ Devam edilsin mi? ${confirmed ? 'Yes' : 'No'}`));
680
+ resolve(confirmed);
681
+ });
682
+ });
683
+ }
684
+
692
685
  function createRl() {
693
686
  if (rl) {
694
687
  try { rl.removeAllListeners(); rl.close(); } catch {}
@@ -704,11 +697,7 @@ ${indexPrompt}`;
704
697
  rl.pause();
705
698
  if (conversationMessages.filter(m => m.role === 'user').length > 0) {
706
699
  try {
707
- const { save } = await inquirer.prompt([{
708
- type: 'confirm', name: 'save',
709
- message: chalk.yellow("Bu session'ı proje hafızasına kaydet?"),
710
- default: true,
711
- }]);
700
+ const save = await confirmAction("Bu session'ı proje hafızasına kaydet?");
712
701
  if (save) await saveProjectMemory(conversationMessages, providerConfig, workDir);
713
702
  } catch {}
714
703
  }