natureco-cli 5.52.1 → 5.54.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/bin/natureco.js +6 -0
- 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/dna.js +14 -12
- package/src/commands/help.js +230 -226
- package/src/commands/lang.js +31 -0
- package/src/commands/login.js +58 -55
- package/src/commands/repl.js +11 -9
- package/src/commands/run.js +8 -6
- package/src/utils/dangerous.js +19 -14
- package/src/utils/i18n.js +95 -0
- package/src/utils/system-prompt.js +12 -4
package/src/commands/login.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
const inquirer = require('../utils/inquirer-wrapper');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const { saveApiKey } = require('../utils/config');
|
|
4
|
-
const { validateApiKey } = require('../utils/api');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
console.
|
|
11
|
-
|
|
12
|
-
console.log(
|
|
13
|
-
console.log('');
|
|
14
|
-
console.log(chalk.green.bold('
|
|
15
|
-
console.log(chalk.
|
|
16
|
-
console.log(
|
|
17
|
-
console.log('');
|
|
18
|
-
console.log(chalk.gray(' API key
|
|
19
|
-
console.log('');
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(chalk.
|
|
52
|
-
console.log('');
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
const inquirer = require('../utils/inquirer-wrapper');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const { saveApiKey } = require('../utils/config');
|
|
4
|
+
const { validateApiKey } = require('../utils/api');
|
|
5
|
+
const { getLang } = require('../utils/i18n');
|
|
6
|
+
|
|
7
|
+
const L = (tr, en) => (getLang() === 'en' ? en : tr);
|
|
8
|
+
|
|
9
|
+
async function login() {
|
|
10
|
+
console.clear();
|
|
11
|
+
|
|
12
|
+
console.log('');
|
|
13
|
+
console.log(chalk.green.bold(' (\\_/)'));
|
|
14
|
+
console.log(chalk.green.bold(' (•ᴥ•)'));
|
|
15
|
+
console.log(chalk.green(' />🌿'));
|
|
16
|
+
console.log('');
|
|
17
|
+
console.log(chalk.green.bold(' ' + L('NatureCo CLI — Giriş', 'NatureCo CLI — Sign in')));
|
|
18
|
+
console.log(chalk.gray(' ' + L("API key'ini gir ve başla.", 'Enter your API key to get started.') + '\n'));
|
|
19
|
+
console.log(chalk.gray(' ' + '─'.repeat(48)));
|
|
20
|
+
console.log('');
|
|
21
|
+
console.log(chalk.gray(' ' + L('API key almak için: ', 'Get an API key at: ')) + chalk.cyan('developers.natureco.me'));
|
|
22
|
+
console.log('');
|
|
23
|
+
|
|
24
|
+
const { apiKey } = await inquirer.prompt([{
|
|
25
|
+
type: 'password',
|
|
26
|
+
name: 'apiKey',
|
|
27
|
+
message: ' API Key:',
|
|
28
|
+
mask: '*',
|
|
29
|
+
validate: (v) => {
|
|
30
|
+
if (!v.trim()) return L('API key boş olamaz', "API key can't be empty");
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
}]);
|
|
34
|
+
|
|
35
|
+
console.log('');
|
|
36
|
+
console.log(chalk.gray(' ' + L('Doğrulanıyor...', 'Verifying...')));
|
|
37
|
+
|
|
38
|
+
const result = await validateApiKey(apiKey.trim());
|
|
39
|
+
|
|
40
|
+
if (!result.valid) {
|
|
41
|
+
console.log(chalk.red(`\n ❌ ${result.error || L('Geçersiz API key', 'Invalid API key')}\n`));
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (result.user?.email) {
|
|
46
|
+
console.log(chalk.gray(` ${L('Hoş geldin,', 'Welcome,')} ${chalk.white(result.user.email)}`));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
saveApiKey(apiKey.trim());
|
|
50
|
+
|
|
51
|
+
console.log(chalk.green('\n ✓ ' + L('Giriş başarılı!', 'Signed in!')));
|
|
52
|
+
console.log(chalk.gray(' Config: ~/.natureco/config.json'));
|
|
53
|
+
console.log('');
|
|
54
|
+
console.log(chalk.gray(' ' + L('Başlamak için: ', 'To get started: ')) + chalk.cyan('natureco chat'));
|
|
55
|
+
console.log('');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = login;
|
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();
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* NatureCo CLI — hafif i18n katmanı.
|
|
5
|
+
* Dil `~/.natureco/config.json` içindeki `language` alanından okunur (tr | en).
|
|
6
|
+
* Yoksa ortam değişkeninden (LANG/LC_ALL) tahmin edilir; varsayılan Türkçe.
|
|
7
|
+
*
|
|
8
|
+
* Kullanım: const { t } = require('../utils/i18n'); t('dna.avgAi')
|
|
9
|
+
* Yeni çeviri eklemek: aşağıdaki MESSAGES.tr ve MESSAGES.en'e aynı anahtarı ekle.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { getConfig } = require('./config');
|
|
13
|
+
|
|
14
|
+
let _cache = null;
|
|
15
|
+
|
|
16
|
+
function getLang() {
|
|
17
|
+
if (_cache) return _cache;
|
|
18
|
+
try {
|
|
19
|
+
const cfg = getConfig();
|
|
20
|
+
if (cfg && (cfg.language === 'en' || cfg.language === 'tr')) {
|
|
21
|
+
_cache = cfg.language;
|
|
22
|
+
return _cache;
|
|
23
|
+
}
|
|
24
|
+
} catch (_) { /* config yoksa ortam değişkenine düş */ }
|
|
25
|
+
const env = (process.env.NATURECO_LANG || process.env.LANG || process.env.LC_ALL || '').toLowerCase();
|
|
26
|
+
_cache = env.startsWith('en') ? 'en' : 'tr'; // varsayılan: Türkçe-öncelikli
|
|
27
|
+
return _cache;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Bellek önbelleğini güncelle (dil değiştirildiğinde çağrılır). */
|
|
31
|
+
function setLangCache(lang) {
|
|
32
|
+
_cache = lang === 'en' ? 'en' : 'tr';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const MESSAGES = {
|
|
36
|
+
tr: {
|
|
37
|
+
// dna
|
|
38
|
+
'dna.notInstalled': 'CodeDNA kurulu değil.',
|
|
39
|
+
'dna.installHint': 'Kurmak için:',
|
|
40
|
+
'dna.installDesc': 'CodeDNA, kodun ne kadarının yapay zekâ olduğunu ölçen NatureCo aracıdır.',
|
|
41
|
+
'dna.unreadable': 'CodeDNA çıktısı okunamadı.',
|
|
42
|
+
'dna.avgAi': 'Ortalama YZ olasılığı',
|
|
43
|
+
'dna.maxFile': 'En yüksek dosya',
|
|
44
|
+
'dna.scanned': 'Taranan dosya: {n}',
|
|
45
|
+
'dna.topFiles': 'En yüksek YZ olasılıklı dosyalar:',
|
|
46
|
+
'dna.understanding': 'anlama',
|
|
47
|
+
'dna.debtTitle': '🧠 Anlama borcu',
|
|
48
|
+
'dna.debtDesc': '(AI yazdı ama ekip muhtemelen anlamıyor):',
|
|
49
|
+
'dna.detail': 'Ayrıntı için:',
|
|
50
|
+
'dna.ecosystem': 'Ekosistem:',
|
|
51
|
+
// lang
|
|
52
|
+
'lang.current': 'Şu anki dil: {lang}',
|
|
53
|
+
'lang.set': 'Dil ayarlandı: {lang} ✓',
|
|
54
|
+
'lang.usage': 'Kullanım: natureco lang <tr|en>',
|
|
55
|
+
'lang.invalid': 'Geçersiz dil. "tr" veya "en" kullanın.',
|
|
56
|
+
'lang.restartHint': 'Değişiklik yeni komutlarda geçerli.',
|
|
57
|
+
},
|
|
58
|
+
en: {
|
|
59
|
+
// dna
|
|
60
|
+
'dna.notInstalled': 'CodeDNA is not installed.',
|
|
61
|
+
'dna.installHint': 'Install with:',
|
|
62
|
+
'dna.installDesc': "CodeDNA is the NatureCo tool that measures how much of your code is AI-written.",
|
|
63
|
+
'dna.unreadable': "Couldn't read CodeDNA output.",
|
|
64
|
+
'dna.avgAi': 'Average AI probability',
|
|
65
|
+
'dna.maxFile': 'Highest file',
|
|
66
|
+
'dna.scanned': 'Files scanned: {n}',
|
|
67
|
+
'dna.topFiles': 'Highest AI-probability files:',
|
|
68
|
+
'dna.understanding': 'understanding',
|
|
69
|
+
'dna.debtTitle': '🧠 Understanding debt',
|
|
70
|
+
'dna.debtDesc': "(AI-written code the team likely doesn't understand):",
|
|
71
|
+
'dna.detail': 'For details:',
|
|
72
|
+
'dna.ecosystem': 'Ecosystem:',
|
|
73
|
+
// lang
|
|
74
|
+
'lang.current': 'Current language: {lang}',
|
|
75
|
+
'lang.set': 'Language set to: {lang} ✓',
|
|
76
|
+
'lang.usage': 'Usage: natureco lang <tr|en>',
|
|
77
|
+
'lang.invalid': 'Invalid language. Use "tr" or "en".',
|
|
78
|
+
'lang.restartHint': 'Takes effect on the next commands.',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** Çeviri: geçerli dilde `key`'i döndür (yoksa TR'ye, o da yoksa key'in kendisine düşer). {var} enterpolasyonu. */
|
|
83
|
+
function t(key, vars) {
|
|
84
|
+
const lang = getLang();
|
|
85
|
+
const cat = MESSAGES[lang] || MESSAGES.tr;
|
|
86
|
+
let s = cat[key];
|
|
87
|
+
if (s == null) s = MESSAGES.tr[key];
|
|
88
|
+
if (s == null) s = key;
|
|
89
|
+
if (vars) {
|
|
90
|
+
for (const k of Object.keys(vars)) s = s.split('{' + k + '}').join(String(vars[k]));
|
|
91
|
+
}
|
|
92
|
+
return s;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
module.exports = { t, getLang, setLangCache, MESSAGES };
|
|
@@ -10,7 +10,11 @@
|
|
|
10
10
|
* Volatile is rebuilt every turn.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
let _getLang;
|
|
14
|
+
try { _getLang = require('./i18n').getLang; } catch (_) { _getLang = () => 'tr'; }
|
|
15
|
+
|
|
13
16
|
function buildTiers(opts) {
|
|
17
|
+
const lang = opts.language || _getLang();
|
|
14
18
|
const {
|
|
15
19
|
botName,
|
|
16
20
|
userName = 'kullanıcı',
|
|
@@ -43,7 +47,9 @@ function buildTiers(opts) {
|
|
|
43
47
|
`ASLA "MiniMax", "MiniMax-M2.5", "Claude", "GPT", "AI asistanı", "yapay zeka" gibi ifadeleri KENDİNİ tanıtmak için KULLANMA.`,
|
|
44
48
|
`Kullanıcı "adın ne?", "sen kimsin?" diye sorduğunda İLK cümlende MUTLAKA "Ben ${displayBot}" yaz.`,
|
|
45
49
|
`Senin adın: ${displayBot}. Tekrar: ${displayBot}. Asla unutma: ${displayBot}.`,
|
|
46
|
-
|
|
50
|
+
lang === 'en'
|
|
51
|
+
? `You are not a brand or product. You are ${displayBot}, the AI assistant of the NatureCo CLI.`
|
|
52
|
+
: `Sen bir marka veya ürün değilsin. Sen ${displayBot}sin, NatureCo CLI'nin yapay zeka asistanısın.`,
|
|
47
53
|
|
|
48
54
|
// Personality (stable)
|
|
49
55
|
`Kisiselik: Sen samimi, sicak, dosta benzeyen bir asistansin. "Selam", "tamam", "hadi yapalim", "bak simdi", "sakin ol" gibi gunluk ifadeler kullan.`,
|
|
@@ -52,9 +58,11 @@ function buildTiers(opts) {
|
|
|
52
58
|
`Kisa yanit: Uzun paragraflar yazma. Direkt konuya gir.`,
|
|
53
59
|
`Hata yaparsan "Pardon, yanlis yaptim, simdi duzelteyim" de. "Hata", "basarisiz", "imkansiz" deme.`,
|
|
54
60
|
|
|
55
|
-
// Language rules (stable)
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
// Language rules (stable) — honor the user's chosen interface language
|
|
62
|
+
lang === 'en'
|
|
63
|
+
? `CRITICAL LANGUAGE RULE: ALWAYS reply to the user in English. These internal instructions are written in Turkish, but every message you send to the user MUST be in natural, correct English. Never reply in Turkish.`
|
|
64
|
+
: `KRITIK DIL KURALI: Kullanici Turkce yaziyorsa MUTLAKA yuzde yuz Turkce cevap ver. Asla baska dil kullanma. Turkce karakterleri dogru kullan.`,
|
|
65
|
+
lang === 'en' ? '' : `Yazim: "degilim" dogru, "degil" degil. Turkce dil bilgisi kurallarina uy.`,
|
|
58
66
|
|
|
59
67
|
// Tool rules (stable)
|
|
60
68
|
`ONEMLI: Tool cagirma SIMULE ETME. Sadece duz metin cevap ver. Islem yapmak gerekirse tool'u gercekten cagir.`,
|