natureco-cli 5.53.0 → 5.55.0
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/account.js +34 -30
- package/src/commands/ask.js +5 -3
- package/src/commands/chat.js +5 -3
- package/src/commands/cost.js +61 -58
- package/src/commands/help.js +230 -226
- package/src/commands/login.js +58 -55
- package/src/commands/memory-cmd.js +70 -68
- package/src/commands/models.js +623 -621
- package/src/commands/repl.js +11 -9
- package/src/commands/run.js +8 -6
- package/src/utils/dangerous.js +19 -14
package/src/commands/repl.js
CHANGED
|
@@ -46,7 +46,9 @@ function extractPreferenceFacts(content) {
|
|
|
46
46
|
}
|
|
47
47
|
return out;
|
|
48
48
|
}
|
|
49
|
-
const chalk = require('chalk');
|
|
49
|
+
const chalk = require('chalk');
|
|
50
|
+
const { getLang: _getLang } = require('../utils/i18n');
|
|
51
|
+
const L = (tr, en) => (_getLang() === 'en' ? en : tr);
|
|
50
52
|
const tui = require('../utils/tui');
|
|
51
53
|
const { loadToolDefinitions, toOpenAIFormat, executeTool } = require('../utils/tools');
|
|
52
54
|
const { accumulateToolCallDeltas, finalizeToolCalls } = require('../utils/streaming-tools');
|
|
@@ -1031,7 +1033,7 @@ function runCliCommand(args) {
|
|
|
1031
1033
|
stdio: 'inherit',
|
|
1032
1034
|
});
|
|
1033
1035
|
proc.on('close', (code) => resolve(code));
|
|
1034
|
-
proc.on('error', (e) => { console.log(chalk.red(' Hata: ' + e.message)); resolve(1); });
|
|
1036
|
+
proc.on('error', (e) => { console.log(chalk.red(L(' Hata: ', ' Error: ') + e.message)); resolve(1); });
|
|
1035
1037
|
});
|
|
1036
1038
|
}
|
|
1037
1039
|
|
|
@@ -1117,7 +1119,7 @@ async function startRepl(args) {
|
|
|
1117
1119
|
messages = session.messages || [];
|
|
1118
1120
|
console.log(chalk.green(`\n ✓ Oturum yüklendi: ${session.id} (${messages.length} mesaj)\n`));
|
|
1119
1121
|
} else {
|
|
1120
|
-
console.log(chalk.yellow(`\n ⚠️ Oturum
|
|
1122
|
+
console.log(chalk.yellow(`\n ⚠️ ${L('Oturum bulunamadı', 'Session not found')}: ${resumeId}\n`));
|
|
1121
1123
|
}
|
|
1122
1124
|
}
|
|
1123
1125
|
|
|
@@ -1440,7 +1442,7 @@ async function startRepl(args) {
|
|
|
1440
1442
|
console.log(chalk.gray('\n Devam etmek için: /resume <id> veya /resume last\n'));
|
|
1441
1443
|
break;
|
|
1442
1444
|
case 'resume':
|
|
1443
|
-
if (!arg) { console.log(chalk.yellow(' Kullanım: /resume <id> veya /resume last')); break; }
|
|
1445
|
+
if (!arg) { console.log(chalk.yellow(L(' Kullanım: /resume <id> veya /resume last', ' Usage: /resume <id> or /resume last'))); break; }
|
|
1444
1446
|
const session = loadSession(arg);
|
|
1445
1447
|
if (session) {
|
|
1446
1448
|
messages = session.messages || [];
|
|
@@ -1449,11 +1451,11 @@ async function startRepl(args) {
|
|
|
1449
1451
|
else messages.unshift({ role: 'system', content: systemPrompt, _internal: true });
|
|
1450
1452
|
console.log(chalk.green(` ✓ Oturum yüklendi: ${session.id} (${messages.length} mesaj)`));
|
|
1451
1453
|
} else {
|
|
1452
|
-
console.log(chalk.yellow(` ⚠️ Oturum
|
|
1454
|
+
console.log(chalk.yellow(` ⚠️ ${L('Oturum bulunamadı', 'Session not found')}: ${arg}`));
|
|
1453
1455
|
}
|
|
1454
1456
|
break;
|
|
1455
1457
|
case 'system':
|
|
1456
|
-
if (!arg) { console.log(chalk.yellow(' Kullanım: /system <text>')); break; }
|
|
1458
|
+
if (!arg) { console.log(chalk.yellow(L(' Kullanım: /system <text>', ' Usage: /system <text>'))); break; }
|
|
1457
1459
|
// Override stable tier directly (user's custom text)
|
|
1458
1460
|
_cachedStable = arg;
|
|
1459
1461
|
// Rebuild volatile only (context stays unchanged)
|
|
@@ -1467,7 +1469,7 @@ async function startRepl(args) {
|
|
|
1467
1469
|
console.log(chalk.green(' ✓ System prompt güncellendi'));
|
|
1468
1470
|
break;
|
|
1469
1471
|
case 'model':
|
|
1470
|
-
if (!arg) { console.log(chalk.yellow(' Kullanım: /model <name>')); break; }
|
|
1472
|
+
if (!arg) { console.log(chalk.yellow(L(' Kullanım: /model <name>', ' Usage: /model <name>'))); break; }
|
|
1471
1473
|
model = arg;
|
|
1472
1474
|
console.log(chalk.green(' ✓ Model: ') + chalk.cyan(model));
|
|
1473
1475
|
break;
|
|
@@ -1508,7 +1510,7 @@ async function startRepl(args) {
|
|
|
1508
1510
|
console.log(tui.C.yellow(' Henüz plan yok.'));
|
|
1509
1511
|
}
|
|
1510
1512
|
} else {
|
|
1511
|
-
console.log(tui.C.yellow(' Kullanım: /plan on|off|show'));
|
|
1513
|
+
console.log(tui.C.yellow(L(' Kullanım: /plan on|off|show', ' Usage: /plan on|off|show')));
|
|
1512
1514
|
}
|
|
1513
1515
|
break;
|
|
1514
1516
|
case 'save':
|
|
@@ -1530,7 +1532,7 @@ async function startRepl(args) {
|
|
|
1530
1532
|
await runCliCommand(args2);
|
|
1531
1533
|
}
|
|
1532
1534
|
} else {
|
|
1533
|
-
console.log(chalk.yellow(` Bilinmeyen komut: /${cmd}. /help yazın
|
|
1535
|
+
console.log(chalk.yellow(` ${L('Bilinmeyen komut', 'Unknown command')}: /${cmd}. ${L('/help yazın.', 'type /help.')}`));
|
|
1534
1536
|
}
|
|
1535
1537
|
}
|
|
1536
1538
|
safePrompt();
|
package/src/commands/run.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { getLang: _getLang } = require('../utils/i18n');
|
|
5
|
+
const L = (tr, en) => (_getLang() === 'en' ? en : tr);
|
|
4
6
|
const { getApiKey, getConfig } = require('../utils/config');
|
|
5
7
|
const { sendMessage } = require('../utils/api');
|
|
6
8
|
const { getSkillPrompts } = require('../utils/skills');
|
|
@@ -9,7 +11,7 @@ async function run(scriptPath) {
|
|
|
9
11
|
const apiKey = getApiKey();
|
|
10
12
|
|
|
11
13
|
if (!apiKey) {
|
|
12
|
-
console.log(chalk.red('\n❌ Giriş yapılmamış. Önce "natureco login" çalıştırın.\n'));
|
|
14
|
+
console.log(chalk.red(L('\n❌ Giriş yapılmamış. Önce "natureco login" çalıştırın.\n', '\n❌ Not signed in. Run "natureco login" first.\n')));
|
|
13
15
|
process.exit(1);
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -17,7 +19,7 @@ async function run(scriptPath) {
|
|
|
17
19
|
const defaultBotId = config.defaultBotId;
|
|
18
20
|
|
|
19
21
|
if (!defaultBotId) {
|
|
20
|
-
console.log(chalk.red('\n❌ Varsayılan bot ayarlanmamış. "natureco config set defaultBotId <bot-id>" ile ayarlayın.\n'));
|
|
22
|
+
console.log(chalk.red(L('\n❌ Varsayılan bot ayarlanmamış. "natureco config set defaultBotId <bot-id>" ile ayarlayın.\n', '\n❌ No default bot set. Set one with "natureco config set defaultBotId <bot-id>".\n')));
|
|
21
23
|
process.exit(1);
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -25,21 +27,21 @@ async function run(scriptPath) {
|
|
|
25
27
|
const fullPath = path.resolve(scriptPath);
|
|
26
28
|
|
|
27
29
|
if (!fs.existsSync(fullPath)) {
|
|
28
|
-
console.log(chalk.red(`\n❌ Dosya
|
|
30
|
+
console.log(chalk.red(`\n❌ ${L('Dosya bulunamadı', 'File not found')}: ${scriptPath}\n`));
|
|
29
31
|
process.exit(1);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
const scriptContent = fs.readFileSync(fullPath, 'utf8');
|
|
33
35
|
|
|
34
36
|
if (!scriptContent || scriptContent.trim().length === 0) {
|
|
35
|
-
console.log(chalk.red('\n❌ Script dosyası boş.\n'));
|
|
37
|
+
console.log(chalk.red(L('\n❌ Script dosyası boş.\n', '\n❌ Script file is empty.\n')));
|
|
36
38
|
process.exit(1);
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
// Skill prompts'ları yükle
|
|
40
42
|
const skillPrompts = getSkillPrompts();
|
|
41
43
|
|
|
42
|
-
console.log(chalk.yellow(`\n⏳ Script çalıştırılıyor: ${path.basename(scriptPath)}\n`));
|
|
44
|
+
console.log(chalk.yellow(`\n⏳ ${L('Script çalıştırılıyor', 'Running script')}: ${path.basename(scriptPath)}\n`));
|
|
43
45
|
|
|
44
46
|
// Loading animasyonu
|
|
45
47
|
const frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
package/src/utils/dangerous.js
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
|
|
13
13
|
const inquirer = require('../utils/inquirer-wrapper');
|
|
14
14
|
const chalk = require('chalk');
|
|
15
|
+
const { getLang } = require('./i18n');
|
|
16
|
+
|
|
17
|
+
const L = (tr, en) => (getLang() === 'en' ? en : tr);
|
|
15
18
|
|
|
16
19
|
const RISK = {
|
|
17
20
|
LOW: 'low', // Otomatik onay
|
|
@@ -21,10 +24,10 @@ const RISK = {
|
|
|
21
24
|
};
|
|
22
25
|
|
|
23
26
|
const RISK_LABELS = {
|
|
24
|
-
low: { color: 'gray', icon: '⚪', label: '
|
|
25
|
-
medium: { color: 'yellow', icon: '🟡', label: 'ORTA RISK' },
|
|
26
|
-
high: { color: 'red', icon: '🔴', label: '
|
|
27
|
-
critical: { color: 'magenta', icon: '⛔', label: '
|
|
27
|
+
low: { color: 'gray', icon: '⚪', label: { tr: 'DÜŞÜK RİSK', en: 'LOW RISK' } },
|
|
28
|
+
medium: { color: 'yellow', icon: '🟡', label: { tr: 'ORTA RİSK', en: 'MEDIUM RISK' } },
|
|
29
|
+
high: { color: 'red', icon: '🔴', label: { tr: 'YÜKSEK RİSK', en: 'HIGH RISK' } },
|
|
30
|
+
critical: { color: 'magenta', icon: '⛔', label: { tr: 'KRİTİK - GERİ ALINAMAZ', en: 'CRITICAL - IRREVERSIBLE' } },
|
|
28
31
|
};
|
|
29
32
|
|
|
30
33
|
const RISK_RANK = { low: 0, medium: 1, high: 2, critical: 3 };
|
|
@@ -44,37 +47,39 @@ async function requireApproval(command, args = {}, risk = RISK.HIGH, reason = ''
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
const label = RISK_LABELS[risk] || RISK_LABELS.high;
|
|
50
|
+
const labelText = (label.label && (label.label[getLang()] || label.label.tr)) || '';
|
|
47
51
|
|
|
48
52
|
console.log();
|
|
49
|
-
console.log(chalk[label.color](` ${label.icon} ${
|
|
53
|
+
console.log(chalk[label.color](` ${label.icon} ${labelText}: ${command}`));
|
|
50
54
|
console.log(chalk.gray(' ' + '─'.repeat(60)));
|
|
51
|
-
console.log(chalk.white(` Komut: ${command}`));
|
|
55
|
+
console.log(chalk.white(` ${L('Komut', 'Command')}: ${command}`));
|
|
52
56
|
if (Object.keys(args).length > 0) {
|
|
53
|
-
console.log(chalk.gray(`
|
|
57
|
+
console.log(chalk.gray(` ${L('Argümanlar', 'Arguments')}: ${JSON.stringify(args)}`));
|
|
54
58
|
}
|
|
55
59
|
if (reason) {
|
|
56
|
-
console.log(chalk[label.color](` Neden: ${reason}`));
|
|
60
|
+
console.log(chalk[label.color](` ${L('Neden', 'Reason')}: ${reason}`));
|
|
57
61
|
}
|
|
58
62
|
console.log(chalk.gray(' ' + '─'.repeat(60)));
|
|
59
63
|
|
|
60
64
|
// Dusuk risk - otomatik onay, sadece mesaj goster
|
|
61
65
|
if (risk === RISK.LOW) {
|
|
62
|
-
console.log(chalk.gray(' Otomatik
|
|
66
|
+
console.log(chalk.gray(' ' + L('Otomatik onaylandı (düşük risk)', 'Auto-approved (low risk)')));
|
|
63
67
|
console.log();
|
|
64
68
|
return true;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
// Kritik risk - tam yazim gerekli
|
|
68
72
|
if (risk === RISK.CRITICAL) {
|
|
69
|
-
console.log(chalk.red(' Bu
|
|
73
|
+
console.log(chalk.red(' ' + L('Bu işlem geri alınamaz!', 'This action cannot be undone!')));
|
|
74
|
+
const yesWord = L('EVET SIL', 'YES DELETE');
|
|
70
75
|
const { confirm } = await inquirer.prompt([{
|
|
71
76
|
type: 'input',
|
|
72
77
|
name: 'confirm',
|
|
73
|
-
message: chalk.red(' Devam etmek
|
|
74
|
-
validate: (input) => input === 'EVET SIL' || input === ''
|
|
78
|
+
message: chalk.red(' ' + L(`Devam etmek için "${yesWord}" yazın (veya Enter ile iptal):`, `Type "${yesWord}" to continue (or Enter to cancel):`)),
|
|
79
|
+
validate: (input) => input === 'EVET SIL' || input === 'YES DELETE' || input === ''
|
|
75
80
|
}]);
|
|
76
81
|
console.log();
|
|
77
|
-
return confirm === 'EVET SIL';
|
|
82
|
+
return confirm === 'EVET SIL' || confirm === 'YES DELETE';
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
// Yuksek ve orta risk - basit onay
|
|
@@ -82,7 +87,7 @@ async function requireApproval(command, args = {}, risk = RISK.HIGH, reason = ''
|
|
|
82
87
|
const { ok } = await inquirer.prompt([{
|
|
83
88
|
type: promptType,
|
|
84
89
|
name: 'ok',
|
|
85
|
-
message: chalk[label.color](
|
|
90
|
+
message: chalk[label.color](' ' + L('Bu komutu çalıştırmak istediğinize emin misiniz?', 'Are you sure you want to run this command?')),
|
|
86
91
|
default: false,
|
|
87
92
|
}]);
|
|
88
93
|
console.log();
|