natureco-cli 2.23.25 → 2.23.26
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 +17 -28
package/package.json
CHANGED
package/src/commands/code.js
CHANGED
|
@@ -206,6 +206,16 @@ async function streamMessage(providerConfig, messages, tools) {
|
|
|
206
206
|
return { text: result?.message?.content || '', toolCalls };
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
async function confirmAction(message) {
|
|
210
|
+
return new Promise(resolve => {
|
|
211
|
+
rl.question(chalk.yellow(`⚠ ${message}\n[? Devam edilsin mi? (Y/n) `), answer => {
|
|
212
|
+
const confirmed = !answer || answer.toLowerCase() === 'y';
|
|
213
|
+
console.log(chalk.gray(` ✓ Devam edilsin mi? ${confirmed ? 'Yes' : 'No'}`));
|
|
214
|
+
resolve(confirmed);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
209
219
|
// ── Tool execution ────────────────────────────────────────────────────────────
|
|
210
220
|
const DANGEROUS = [/\brm\b/, /\brmdir\b/, /\bdelete\b/i, /\bdrop\b/i, /\btruncate\b/i];
|
|
211
221
|
|
|
@@ -239,10 +249,7 @@ async function runToolCall(toolCall, stats, dryRun = false) {
|
|
|
239
249
|
|
|
240
250
|
if (needsConfirm) {
|
|
241
251
|
console.log(chalk.yellow(`\n ⚠️ ${toolCall.name}: ${inputPreview}`));
|
|
242
|
-
const
|
|
243
|
-
type: 'confirm', name: 'ok',
|
|
244
|
-
message: ' Devam edilsin mi?', default: true,
|
|
245
|
-
}]);
|
|
252
|
+
const ok = await confirmAction('Devam edilsin mi?');
|
|
246
253
|
if (!ok) {
|
|
247
254
|
console.log(chalk.gray(' İptal edildi.\n'));
|
|
248
255
|
return { success: false, output: 'Kullanıcı iptal etti.' };
|
|
@@ -274,11 +281,8 @@ async function runTests(projectIndex, conversationMessages, tools, providerConfi
|
|
|
274
281
|
const testScript = projectIndex.packageJson?.scripts?.test;
|
|
275
282
|
if (!testScript || testScript.includes('no test')) return;
|
|
276
283
|
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
message: chalk.yellow(' 🧪 Testleri çalıştıralım mı?'), default: true,
|
|
280
|
-
}]);
|
|
281
|
-
if (!confirm) return;
|
|
284
|
+
const confirmed = await confirmAction('🧪 Testleri çalıştıralım mı?');
|
|
285
|
+
if (!confirmed) return;
|
|
282
286
|
|
|
283
287
|
console.log(chalk.gray('\n npm test çalışıyor...\n'));
|
|
284
288
|
try {
|
|
@@ -292,10 +296,7 @@ async function runTests(projectIndex, conversationMessages, tools, providerConfi
|
|
|
292
296
|
console.log(chalk.gray(' ' + errOutput.split('\n').join('\n ')));
|
|
293
297
|
console.log();
|
|
294
298
|
|
|
295
|
-
const
|
|
296
|
-
type: 'confirm', name: 'fix',
|
|
297
|
-
message: chalk.yellow(' Agent test hatasını düzeltsin mi?'), default: true,
|
|
298
|
-
}]);
|
|
299
|
+
const fix = await confirmAction('Agent test hatasını düzeltsin mi?');
|
|
299
300
|
if (fix) {
|
|
300
301
|
return `Test hatası oluştu:\n${errOutput}\nBu hatayı düzelt.`;
|
|
301
302
|
}
|
|
@@ -467,12 +468,7 @@ ${indexPrompt}`;
|
|
|
467
468
|
console.log(chalk.gray(' ' + errorOutput.split('\n').join('\n ')));
|
|
468
469
|
console.log();
|
|
469
470
|
|
|
470
|
-
const
|
|
471
|
-
type: 'confirm', name: 'fix',
|
|
472
|
-
message: chalk.yellow(' Hatayı otomatik düzeltmemi ister misin?'),
|
|
473
|
-
default: true,
|
|
474
|
-
}]);
|
|
475
|
-
|
|
471
|
+
const fix = await confirmAction('Hatayı otomatik düzeltmemi ister misin?');
|
|
476
472
|
if (fix) {
|
|
477
473
|
const fixMessage = `Şu komut çalıştırıldı: ${cmd}\nHata oluştu:\n${errorOutput}\nBu hatayı analiz et ve düzelt.`;
|
|
478
474
|
console.log(chalk.cyan('\n Düzeltiliyor...\n'));
|
|
@@ -582,10 +578,7 @@ ${indexPrompt}`;
|
|
|
582
578
|
const commitMsg = await generateCommitMessage(diff.slice(0, 2000), providerConfig);
|
|
583
579
|
stopSpinner(sp, 'Commit mesajı hazır', true);
|
|
584
580
|
console.log(chalk.cyan(`\n Önerilen: ${chalk.white(commitMsg)}\n`));
|
|
585
|
-
const
|
|
586
|
-
type: 'confirm', name: 'ok',
|
|
587
|
-
message: ' Commit edilsin mi?', default: true,
|
|
588
|
-
}]);
|
|
581
|
+
const ok = await confirmAction('Commit edilsin mi?');
|
|
589
582
|
if (ok) {
|
|
590
583
|
execSync(`git commit -m "${commitMsg.replace(/"/g, '\\"')}"`, { cwd: workDir, stdio: 'pipe' });
|
|
591
584
|
console.log(chalk.green(' ✓ Commit yapıldı!\n'));
|
|
@@ -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
|
|
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
|
}
|