natureco-cli 5.55.0 → 5.57.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.
@@ -1,171 +1,173 @@
1
- /**
2
- * natureco team — Multi-agent orkestrasyon (Phase 7)
3
- *
4
- * Birden fazla uzman agent'ı aynı görev üzerinde paralel çalıştır.
5
- * Her biri kendi system prompt'u ve tool setiyle bağımsız çalışır.
6
- *
7
- * Kullanım:
8
- * natureco team list Mevcut agent tipleri
9
- * natureco team status Son çalışan agent'lar
10
- * natureco team spawn <type> <task> Tek agent çalıştır
11
- * natureco team parallel <spec> Paralel çalıştır (JSON)
12
- *
13
- * Örnek:
14
- * natureco team spawn seo "natureco.me için anahtar kelime öner"
15
- * natureco team parallel '[{"type":"seo","task":"..."}, {"type":"content","task":"..."}]'
16
- */
17
-
1
+ /**
2
+ * natureco team — Multi-agent orkestrasyon (Phase 7)
3
+ *
4
+ * Birden fazla uzman agent'ı aynı görev üzerinde paralel çalıştır.
5
+ * Her biri kendi system prompt'u ve tool setiyle bağımsız çalışır.
6
+ *
7
+ * Kullanım:
8
+ * natureco team list Mevcut agent tipleri
9
+ * natureco team status Son çalışan agent'lar
10
+ * natureco team spawn <type> <task> Tek agent çalıştır
11
+ * natureco team parallel <spec> Paralel çalıştır (JSON)
12
+ *
13
+ * Örnek:
14
+ * natureco team spawn seo "natureco.me için anahtar kelime öner"
15
+ * natureco team parallel '[{"type":"seo","task":"..."}, {"type":"content","task":"..."}]'
16
+ */
17
+
18
18
  const chalk = require('chalk');
19
- const tui = require('../utils/tui');
20
- const subAgent = require('../utils/sub-agent');
21
- const audit = require('../utils/audit');
22
-
23
- async function cmdList() {
24
- console.log('\n' + tui.styled(' 🤖 Mevcut Agent Tipleri', { color: tui.PALETTE.primary, bold: true }));
25
- console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
26
-
27
- const rows = Object.entries(subAgent.SYSTEM_PROMPTS).map(([type, prompt]) => ({
28
- type,
29
- prompt: prompt.length > 80 ? prompt.slice(0, 77) + '...' : prompt,
30
- }));
31
- console.log('\n' + tui.table(rows, [
32
- { key: 'type', label: 'Tip', minWidth: 14, render: r => tui.styled(r.type, { color: tui.PALETTE.primary, bold: true }) },
33
- { key: 'prompt', label: 'Sistem Prompt', minWidth: 50, render: r => tui.C.muted(r.prompt) },
34
- ], { borderStyle: 'round', zebra: true }));
35
- console.log('');
36
- }
37
-
38
- async function cmdStatus() {
39
- const status = subAgent.getStatus();
40
- console.log('\n' + tui.styled(' 📊 Sub-Agent İstatistikleri', { color: tui.PALETTE.primary, bold: true }));
41
- console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
42
-
43
- // Üst metrik kartı
44
- const w = 50;
45
- const lines = [];
46
- lines.push(tui.styled(' ╭' + '─'.repeat(w) + '╮', { color: tui.PALETTE.border }));
47
- lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Toplam ') + tui.styled(String(status.total).padStart(8), { color: tui.PALETTE.text, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
48
- lines.push(tui.styled(' ', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Çalışan ') + tui.styled(String(status.running).padStart(8), { color: tui.PALETTE.warning, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
49
- lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Tamamlanan ') + tui.styled(String(status.completed).padStart(8), { color: tui.PALETTE.success, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
50
- lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted('Başarısız ') + tui.styled(String(status.failed).padStart(8), { color: tui.PALETTE.danger, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
51
- lines.push(tui.styled(' ' + ''.repeat(w) + '', { color: tui.PALETTE.border }));
52
- console.log('\n' + lines.join('\n'));
53
-
54
- if (status.agents.length > 0) {
55
- console.log('\n' + tui.styled(' 📜 Son 10 Agent', { color: tui.PALETTE.secondary, bold: true }));
56
- const rows = status.agents.slice(0, 10).map(a => {
57
- const icon = a.status === 'completed'
58
- ? tui.styled(' ', { bg: tui.PALETTE.success, color: '#000', bold: true })
59
- : a.status === 'failed'
60
- ? tui.styled(' ', { bg: tui.PALETTE.danger, color: '#000', bold: true })
61
- : tui.styled(' ', { bg: tui.PALETTE.warning, color: '#000', bold: true });
62
- const dur = a.completedAt ? Math.round((new Date(a.completedAt) - new Date(a.startedAt)) / 100) / 10 : '-';
63
- return { icon, type: a.type, task: a.task.slice(0, 60), dur: dur + 's' };
64
- });
65
- console.log('\n' + tui.table(rows, [
66
- { key: 'icon', label: ' ', minWidth: 5 },
67
- { key: 'type', label: 'Tip', minWidth: 12, render: r => tui.styled(r.type, { color: tui.PALETTE.primary }) },
68
- { key: 'task', label: 'Görev', minWidth: 30, render: r => tui.C.muted(r.task) },
69
- { key: 'dur', label: 'Süre', minWidth: 8, render: r => tui.C.text(r.dur) },
70
- ], { borderStyle: 'round', zebra: true }));
71
- }
72
- console.log('');
73
- }
74
-
75
- async function cmdSpawn(args) {
76
- const [type, ...taskParts] = args;
77
- const task = taskParts.join(' ');
78
-
79
- if (!type || !task) {
80
- console.log(chalk.red('\n Kullanım: natureco team spawn <type> <task>\n'));
81
- console.log(chalk.gray(' Tipler: ') + Object.keys(subAgent.SYSTEM_PROMPTS).join(', '));
82
- console.log('');
83
- return;
84
- }
85
- if (!subAgent.SYSTEM_PROMPTS[type]) {
86
- console.log(chalk.red(`\n Bilinmeyen agent tipi: ${type}`));
87
- console.log(chalk.gray(' Tipler: ') + Object.keys(subAgent.SYSTEM_PROMPTS).join(', ') + '\n');
88
- return;
89
- }
90
-
91
- console.log(chalk.cyan(`\n 🤖 ${type} agent başlatılıyor...\n`));
92
- console.log(chalk.gray(` Görev: ${task.slice(0, 100)}\n`));
93
-
94
- try {
95
- const { result, usage, duration } = await subAgent.spawnSubAgent(type, task);
96
- console.log(chalk.green(` Tamamlandı (${duration}ms)\n`));
97
- console.log(chalk.gray(' ' + '─'.repeat(50)));
98
- console.log(result);
99
- console.log(chalk.gray(' ' + '─'.repeat(50)));
100
- if (usage?.total_tokens) {
101
- console.log(chalk.gray(` Token: ${usage.total_tokens} (${usage.prompt_tokens} in, ${usage.completion_tokens} out)\n`));
102
- }
103
- audit.log(audit.ACTIONS.TOOL_CALL, { source: 'team', type, task: task.slice(0, 100) });
104
- } catch (e) {
105
- console.log(chalk.red(`\n ❌ Hata: ${e.message}\n`));
106
- }
107
- }
108
-
109
- async function cmdParallel(args) {
110
- const spec = args.join(' ');
111
- if (!spec) {
112
- console.log(chalk.red('\n Kullanım: natureco team parallel \'<json-spec>\'\n'));
113
- console.log(chalk.gray(' Örnek: natureco team parallel \'[{"type":"seo","task":"..."},{"type":"content","task":"..."}]\'\n'));
114
- return;
115
- }
116
-
117
- let agents;
118
- try { agents = JSON.parse(spec); }
119
- catch (e) {
120
- console.log(chalk.red(`\n Geçersiz JSON: ${e.message}\n`));
121
- return;
122
- }
123
-
124
- if (!Array.isArray(agents) || agents.length === 0) {
125
- console.log(chalk.red('\n JSON array olmalı.\n'));
126
- return;
127
- }
128
-
129
- console.log(chalk.cyan(`\n 🤝 ${agents.length} agent paralel başlatılıyor...\n`));
130
-
131
- try {
132
- const { results, failed } = await subAgent.spawnParallel(agents);
133
- console.log(chalk.green(`\n ${results.length - failed.length}/${results.length} agent tamamlandı\n`));
134
-
135
- for (let i = 0; i < results.length; i++) {
136
- const r = results[i];
137
- const a = agents[i];
138
- console.log(chalk.bold(`\n ── Agent ${i+1}: ${a.type} ──`));
139
- if (r.status === 'fulfilled') {
140
- console.log(chalk.gray(` Görev: ${a.task.slice(0, 60)}`));
141
- console.log(chalk.green(' ✓ Sonuç:'));
142
- console.log(' ' + (r.value?.result || '').slice(0, 500));
143
- } else {
144
- console.log(chalk.red(` Hata: ${r.reason}`));
145
- }
146
- }
147
- console.log('');
148
- } catch (e) {
149
- console.log(chalk.red(`\n ❌ Hata: ${e.message}\n`));
150
- }
151
- }
152
-
153
- async function team(args) {
154
- const [action, ...params] = args || [];
155
- if (!action || action === 'help') {
156
- console.log(chalk.yellow('\n Kullanım:'));
157
- console.log(chalk.gray(' natureco team list Agent tipleri'));
158
- console.log(chalk.gray(' natureco team status Son çalışan agent\'lar'));
159
- console.log(chalk.gray(' natureco team spawn <type> <task> Tek agent çalıştır'));
160
- console.log(chalk.gray(' natureco team parallel <json> Paralel çalıştır'));
161
- console.log('');
162
- return;
163
- }
164
- if (action === 'list') return cmdList();
165
- if (action === 'status') return cmdStatus();
166
- if (action === 'spawn') return cmdSpawn(params);
167
- if (action === 'parallel') return cmdParallel(params);
168
- console.log(chalk.red(`\n Bilinmeyen: ${action}\n`));
169
- }
170
-
171
- module.exports = team;
19
+ const { getLang: _gl } = require('../utils/i18n');
20
+ const L = (tr, en) => (_gl() === 'en' ? en : tr);
21
+ const tui = require('../utils/tui');
22
+ const subAgent = require('../utils/sub-agent');
23
+ const audit = require('../utils/audit');
24
+
25
+ async function cmdList() {
26
+ console.log('\n' + tui.styled(L(' 🤖 Mevcut Agent Tipleri', ' 🤖 Available Agent Types'), { color: tui.PALETTE.primary, bold: true }));
27
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
28
+
29
+ const rows = Object.entries(subAgent.SYSTEM_PROMPTS).map(([type, prompt]) => ({
30
+ type,
31
+ prompt: prompt.length > 80 ? prompt.slice(0, 77) + '...' : prompt,
32
+ }));
33
+ console.log('\n' + tui.table(rows, [
34
+ { key: 'type', label: L('Tip', 'Type'), minWidth: 14, render: r => tui.styled(r.type, { color: tui.PALETTE.primary, bold: true }) },
35
+ { key: 'prompt', label: L('Sistem Prompt', 'System Prompt'), minWidth: 50, render: r => tui.C.muted(r.prompt) },
36
+ ], { borderStyle: 'round', zebra: true }));
37
+ console.log('');
38
+ }
39
+
40
+ async function cmdStatus() {
41
+ const status = subAgent.getStatus();
42
+ console.log('\n' + tui.styled(L(' 📊 Sub-Agent İstatistikleri', ' 📊 Sub-Agent Statistics'), { color: tui.PALETTE.primary, bold: true }));
43
+ console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
44
+
45
+ // Üst metrik kartı
46
+ const w = 50;
47
+ const lines = [];
48
+ lines.push(tui.styled(' ' + ''.repeat(w) + '', { color: tui.PALETTE.border }));
49
+ lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Toplam ', 'Total ')) + tui.styled(String(status.total).padStart(8), { color: tui.PALETTE.text, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
50
+ lines.push(tui.styled(' │', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Çalışan ', 'Running ')) + tui.styled(String(status.running).padStart(8), { color: tui.PALETTE.warning, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
51
+ lines.push(tui.styled(' ', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Tamamlanan ', 'Completed ')) + tui.styled(String(status.completed).padStart(8), { color: tui.PALETTE.success, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
52
+ lines.push(tui.styled('', { color: tui.PALETTE.border }) + ' ' + tui.C.muted(L('Başarısız ', 'Failed ')) + tui.styled(String(status.failed).padStart(8), { color: tui.PALETTE.danger, bold: true }) + ' ' + tui.styled('│', { color: tui.PALETTE.border }));
53
+ lines.push(tui.styled(' ╰' + '─'.repeat(w) + '╯', { color: tui.PALETTE.border }));
54
+ console.log('\n' + lines.join('\n'));
55
+
56
+ if (status.agents.length > 0) {
57
+ console.log('\n' + tui.styled(L(' 📜 Son 10 Agent', ' 📜 Last 10 Agents'), { color: tui.PALETTE.secondary, bold: true }));
58
+ const rows = status.agents.slice(0, 10).map(a => {
59
+ const icon = a.status === 'completed'
60
+ ? tui.styled(' ', { bg: tui.PALETTE.success, color: '#000', bold: true })
61
+ : a.status === 'failed'
62
+ ? tui.styled(' ', { bg: tui.PALETTE.danger, color: '#000', bold: true })
63
+ : tui.styled(' ⋯ ', { bg: tui.PALETTE.warning, color: '#000', bold: true });
64
+ const dur = a.completedAt ? Math.round((new Date(a.completedAt) - new Date(a.startedAt)) / 100) / 10 : '-';
65
+ return { icon, type: a.type, task: a.task.slice(0, 60), dur: dur + 's' };
66
+ });
67
+ console.log('\n' + tui.table(rows, [
68
+ { key: 'icon', label: ' ', minWidth: 5 },
69
+ { key: 'type', label: L('Tip', 'Type'), minWidth: 12, render: r => tui.styled(r.type, { color: tui.PALETTE.primary }) },
70
+ { key: 'task', label: L('Görev', 'Task'), minWidth: 30, render: r => tui.C.muted(r.task) },
71
+ { key: 'dur', label: L('Süre', 'Duration'), minWidth: 8, render: r => tui.C.text(r.dur) },
72
+ ], { borderStyle: 'round', zebra: true }));
73
+ }
74
+ console.log('');
75
+ }
76
+
77
+ async function cmdSpawn(args) {
78
+ const [type, ...taskParts] = args;
79
+ const task = taskParts.join(' ');
80
+
81
+ if (!type || !task) {
82
+ console.log(chalk.red(L('\n Kullanım: natureco team spawn <type> <task>\n', '\n Usage: natureco team spawn <type> <task>\n')));
83
+ console.log(chalk.gray(L(' Tipler: ', ' Types: ')) + Object.keys(subAgent.SYSTEM_PROMPTS).join(', '));
84
+ console.log('');
85
+ return;
86
+ }
87
+ if (!subAgent.SYSTEM_PROMPTS[type]) {
88
+ console.log(chalk.red(`\n ${L('Bilinmeyen agent tipi', 'Unknown agent type')}: ${type}`));
89
+ console.log(chalk.gray(L(' Tipler: ', ' Types: ')) + Object.keys(subAgent.SYSTEM_PROMPTS).join(', ') + '\n');
90
+ return;
91
+ }
92
+
93
+ console.log(chalk.cyan(`\n 🤖 ${type} agent ${L('başlatılıyor...', 'starting...')}\n`));
94
+ console.log(chalk.gray(` ${L('Görev', 'Task')}: ${task.slice(0, 100)}\n`));
95
+
96
+ try {
97
+ const { result, usage, duration } = await subAgent.spawnSubAgent(type, task);
98
+ console.log(chalk.green(` ✓ ${L('Tamamlandı', 'Completed')} (${duration}ms)\n`));
99
+ console.log(chalk.gray(' ' + '─'.repeat(50)));
100
+ console.log(result);
101
+ console.log(chalk.gray(' ' + '─'.repeat(50)));
102
+ if (usage?.total_tokens) {
103
+ console.log(chalk.gray(` Token: ${usage.total_tokens} (${usage.prompt_tokens} in, ${usage.completion_tokens} out)\n`));
104
+ }
105
+ audit.log(audit.ACTIONS.TOOL_CALL, { source: 'team', type, task: task.slice(0, 100) });
106
+ } catch (e) {
107
+ console.log(chalk.red(`\n ❌ ${L('Hata', 'Error')}: ${e.message}\n`));
108
+ }
109
+ }
110
+
111
+ async function cmdParallel(args) {
112
+ const spec = args.join(' ');
113
+ if (!spec) {
114
+ console.log(chalk.red(L('\n Kullanım: natureco team parallel \'<json-spec>\'\n', '\n Usage: natureco team parallel \'<json-spec>\'\n')));
115
+ console.log(chalk.gray(L(' Örnek: natureco team parallel \'[{"type":"seo","task":"..."},{"type":"content","task":"..."}]\'\n', ' Example: natureco team parallel \'[{"type":"seo","task":"..."},{"type":"content","task":"..."}]\'\n')));
116
+ return;
117
+ }
118
+
119
+ let agents;
120
+ try { agents = JSON.parse(spec); }
121
+ catch (e) {
122
+ console.log(chalk.red(`\n ${L('Geçersiz JSON', 'Invalid JSON')}: ${e.message}\n`));
123
+ return;
124
+ }
125
+
126
+ if (!Array.isArray(agents) || agents.length === 0) {
127
+ console.log(chalk.red(L('\n JSON array olmalı.\n', '\n JSON must be an array.\n')));
128
+ return;
129
+ }
130
+
131
+ console.log(chalk.cyan(`\n 🤝 ${agents.length} agent ${L('paralel başlatılıyor...', 'starting in parallel...')}\n`));
132
+
133
+ try {
134
+ const { results, failed } = await subAgent.spawnParallel(agents);
135
+ console.log(chalk.green(`\n ✓ ${results.length - failed.length}/${results.length} agent ${L('tamamlandı', 'completed')}\n`));
136
+
137
+ for (let i = 0; i < results.length; i++) {
138
+ const r = results[i];
139
+ const a = agents[i];
140
+ console.log(chalk.bold(`\n ── Agent ${i+1}: ${a.type} ──`));
141
+ if (r.status === 'fulfilled') {
142
+ console.log(chalk.gray(` ${L('Görev', 'Task')}: ${a.task.slice(0, 60)}`));
143
+ console.log(chalk.green(L(' ✓ Sonuç:', ' ✓ Result:')));
144
+ console.log(' ' + (r.value?.result || '').slice(0, 500));
145
+ } else {
146
+ console.log(chalk.red(` ✗ ${L('Hata', 'Error')}: ${r.reason}`));
147
+ }
148
+ }
149
+ console.log('');
150
+ } catch (e) {
151
+ console.log(chalk.red(`\n ❌ ${L('Hata', 'Error')}: ${e.message}\n`));
152
+ }
153
+ }
154
+
155
+ async function team(args) {
156
+ const [action, ...params] = args || [];
157
+ if (!action || action === 'help') {
158
+ console.log(chalk.yellow(L('\n Kullanım:', '\n Usage:')));
159
+ console.log(chalk.gray(L(' natureco team list Agent tipleri', ' natureco team list Agent types')));
160
+ console.log(chalk.gray(L(' natureco team status Son çalışan agent\'lar', ' natureco team status Recently run agents')));
161
+ console.log(chalk.gray(L(' natureco team spawn <type> <task> Tek agent çalıştır', ' natureco team spawn <type> <task> Run a single agent')));
162
+ console.log(chalk.gray(L(' natureco team parallel <json> Paralel çalıştır', ' natureco team parallel <json> Run in parallel')));
163
+ console.log('');
164
+ return;
165
+ }
166
+ if (action === 'list') return cmdList();
167
+ if (action === 'status') return cmdStatus();
168
+ if (action === 'spawn') return cmdSpawn(params);
169
+ if (action === 'parallel') return cmdParallel(params);
170
+ console.log(chalk.red(`\n ${L('Bilinmeyen', 'Unknown')}: ${action}\n`));
171
+ }
172
+
173
+ module.exports = team;
@@ -1,4 +1,6 @@
1
1
  const chalk = require('chalk');
2
+ const { getLang: _gl } = require('../utils/i18n');
3
+ const L = (tr, en) => (_gl() === 'en' ? en : tr);
2
4
  const inquirer = require('../utils/inquirer-wrapper');
3
5
  const { getConfig, saveConfig } = require('../utils/config');
4
6
 
@@ -17,8 +19,8 @@ async function telegram(action, chatId) {
17
19
 
18
20
  if (action === 'allow') {
19
21
  if (!chatId) {
20
- console.log(chalk.red('\n❌ Chat ID belirtmelisiniz\n'));
21
- console.log(chalk.gray('Kullanım: natureco telegram allow <chatId>\n'));
22
+ console.log(chalk.red(L('\n❌ Chat ID belirtmelisiniz\n', '\n❌ You must specify a Chat ID\n')));
23
+ console.log(chalk.gray(L('Kullanım: natureco telegram allow <chatId>\n', 'Usage: natureco telegram allow <chatId>\n')));
22
24
  process.exit(1);
23
25
  }
24
26
  return allowChat(chatId);
@@ -38,35 +40,35 @@ async function connectTelegram() {
38
40
  const config = getConfig();
39
41
 
40
42
  if (!config.providerUrl) {
41
- console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
43
+ console.log(chalk.red(L('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n', '\n❌ Setup not done. Run "natureco setup" first.\n')));
42
44
  process.exit(1);
43
45
  }
44
46
 
45
47
  // v5.4.21: Eğer zaten token kaydedilmişse, kullanıcıya sor — değiştirmek ister mi?
46
48
  if (config.telegramToken) {
47
49
  const masked = config.telegramToken.slice(0, 15) + '...' + config.telegramToken.slice(-5);
48
- console.log(chalk.green('\n✓ Telegram token zaten kayıtlı: ' + masked));
49
- console.log(chalk.gray(' Bot ID: ' + (config.telegramBotId || 'yok')));
50
- console.log(chalk.gray(' İzinli chat: ' + (config.telegramAllowedChats || []).join(', ') + '\n'));
50
+ console.log(chalk.green(L('\n✓ Telegram token zaten kayıtlı: ', '\n✓ Telegram token already saved: ') + masked));
51
+ console.log(chalk.gray(' Bot ID: ' + (config.telegramBotId || L('yok', 'none'))));
52
+ console.log(chalk.gray(L(' İzinli chat: ', ' Allowed chat: ') + (config.telegramAllowedChats || []).join(', ') + '\n'));
51
53
  const ans = await inquirer.prompt([{
52
54
  type: 'confirm',
53
55
  name: 'change',
54
- message: 'Token değiştirmek istiyor musun?',
56
+ message: L('Token değiştirmek istiyor musun?', 'Do you want to change the token?'),
55
57
  default: false,
56
58
  }]);
57
59
  if (!ans.change) {
58
- console.log(chalk.green('\n✅ Mevcut token kullanılacak.\n'));
59
- console.log(chalk.gray('Gateway başlat: natureco gateway start\n'));
60
+ console.log(chalk.green(L('\n✅ Mevcut token kullanılacak.\n', '\n✅ Existing token will be used.\n')));
61
+ console.log(chalk.gray(L('Gateway başlat: natureco gateway start\n', 'Start gateway: natureco gateway start\n')));
60
62
  return;
61
63
  }
62
64
  }
63
65
 
64
- console.log(chalk.yellow('\n⏳ Telegram bot bağlantısı hazırlanıyor...\n'));
65
- console.log(chalk.gray('Telegram bot token almak için:'));
66
- console.log(chalk.gray('1. Telegram\'da @BotFather\'ı aç'));
67
- console.log(chalk.gray('2. /newbot komutunu gönder'));
68
- console.log(chalk.gray('3. Bot adı ve kullanıcı adı belirle'));
69
- console.log(chalk.gray('4. Aldığın token\'ı buraya gir\n'));
66
+ console.log(chalk.yellow(L('\n⏳ Telegram bot bağlantısı hazırlanıyor...\n', '\n⏳ Preparing Telegram bot connection...\n')));
67
+ console.log(chalk.gray(L('Telegram bot token almak için:', 'To get a Telegram bot token:')));
68
+ console.log(chalk.gray(L('1. Telegram\'da @BotFather\'ı aç', '1. Open @BotFather on Telegram')));
69
+ console.log(chalk.gray(L('2. /newbot komutunu gönder', '2. Send the /newbot command')));
70
+ console.log(chalk.gray(L('3. Bot adı ve kullanıcı adı belirle', '3. Set a bot name and username')));
71
+ console.log(chalk.gray(L('4. Aldığın token\'ı buraya gir\n', '4. Enter the token you received here\n')));
70
72
 
71
73
  process.stdin.resume();
72
74
 
@@ -76,26 +78,26 @@ async function connectTelegram() {
76
78
  name: 'token',
77
79
  message: 'Telegram bot token:',
78
80
  validate: (val) => {
79
- if (val.trim() === '') return 'Token boş olamaz';
80
- if (!val.includes(':')) return 'Geçersiz token formatı (örnek: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)';
81
+ if (val.trim() === '') return L('Token boş olamaz', 'Token cannot be empty');
82
+ if (!val.includes(':')) return L('Geçersiz token formatı (örnek: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)', 'Invalid token format (example: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)');
81
83
  return true;
82
84
  },
83
85
  },
84
86
  ]);
85
87
 
86
- console.log(chalk.yellow('\n⏳ Telegram Chat ID almak için:\n'));
87
- console.log(chalk.gray('1. Telegram\'da @userinfobot veya @getmyid_bot\'a mesaj gönder'));
88
- console.log(chalk.gray('2. Sana chat ID\'ni söyleyecek'));
89
- console.log(chalk.gray('3. Chat ID\'yi buraya gir (örnek: 123456789)\n'));
88
+ console.log(chalk.yellow(L('\n⏳ Telegram Chat ID almak için:\n', '\n⏳ To get your Telegram Chat ID:\n')));
89
+ console.log(chalk.gray(L('1. Telegram\'da @userinfobot veya @getmyid_bot\'a mesaj gönder', '1. Message @userinfobot or @getmyid_bot on Telegram')));
90
+ console.log(chalk.gray(L('2. Sana chat ID\'ni söyleyecek', '2. It will tell you your chat ID')));
91
+ console.log(chalk.gray(L('3. Chat ID\'yi buraya gir (örnek: 123456789)\n', '3. Enter the Chat ID here (example: 123456789)\n')));
90
92
 
91
93
  const chatIdAnswer = await inquirer.prompt([
92
94
  {
93
95
  type: 'input',
94
96
  name: 'chatId',
95
- message: 'Telegram Chat ID\'n:',
97
+ message: L('Telegram Chat ID\'n:', 'Your Telegram Chat ID:'),
96
98
  validate: (val) => {
97
- if (val.trim() === '') return 'Chat ID boş olamaz';
98
- if (!/^-?\d+$/.test(val.trim())) return 'Geçersiz Chat ID formatı (sadece rakam olmalı)';
99
+ if (val.trim() === '') return L('Chat ID boş olamaz', 'Chat ID cannot be empty');
100
+ if (!/^-?\d+$/.test(val.trim())) return L('Geçersiz Chat ID formatı (sadece rakam olmalı)', 'Invalid Chat ID format (must be digits only)');
99
101
  return true;
100
102
  },
101
103
  },
@@ -104,7 +106,7 @@ async function connectTelegram() {
104
106
  // Telegram için bot ID oluştur (timestamp-based)
105
107
  const botId = `telegram_${Date.now()}`;
106
108
 
107
- console.log(chalk.yellow('\n⏳ Telegram bağlantısı kaydediliyor...\n'));
109
+ console.log(chalk.yellow(L('\n⏳ Telegram bağlantısı kaydediliyor...\n', '\n⏳ Saving Telegram connection...\n')));
108
110
 
109
111
  // Save to config (v2.x - no backend call)
110
112
  config.telegramToken = answers.token.trim();
@@ -112,16 +114,16 @@ async function connectTelegram() {
112
114
  config.telegramAllowedChats = [chatIdAnswer.chatId.trim()];
113
115
  saveConfig(config);
114
116
 
115
- console.log(chalk.green('✅ Telegram bot token kaydedildi!\n'));
117
+ console.log(chalk.green(L('✅ Telegram bot token kaydedildi!\n', '✅ Telegram bot token saved!\n')));
116
118
  console.log(chalk.cyan('Bot ID:'), chalk.white(botId));
117
119
  console.log(chalk.cyan('Token:'), chalk.white(answers.token.slice(0, 20) + '...'));
118
- console.log(chalk.cyan('İzin verilen chat:'), chalk.white(chatIdAnswer.chatId.trim()));
119
- console.log(chalk.gray('\nSession kaydedildi: ~/.natureco/config.json'));
120
- console.log(chalk.gray('Başka chat eklemek için: natureco telegram allow <chatId>'));
120
+ console.log(chalk.cyan(L('İzin verilen chat:', 'Allowed chat:')), chalk.white(chatIdAnswer.chatId.trim()));
121
+ console.log(chalk.gray(L('\nSession kaydedildi: ~/.natureco/config.json', '\nSession saved: ~/.natureco/config.json')));
122
+ console.log(chalk.gray(L('Başka chat eklemek için: natureco telegram allow <chatId>', 'To add another chat: natureco telegram allow <chatId>')));
121
123
 
122
- console.log(chalk.green('\n✅ Kurulum tamamlandı!\n'));
123
- console.log(chalk.yellow('Gateway ile başlatmak için:'), chalk.cyan('natureco gateway start'));
124
- console.log(chalk.gray('Gateway, Telegram botunu otomatik olarak başlatacak.\n'));
124
+ console.log(chalk.green(L('\n✅ Kurulum tamamlandı!\n', '\n✅ Setup complete!\n')));
125
+ console.log(chalk.yellow(L('Gateway ile başlatmak için:', 'To start with the gateway:')), chalk.cyan('natureco gateway start'));
126
+ console.log(chalk.gray(L('Gateway, Telegram botunu otomatik olarak başlatacak.\n', 'The gateway will start the Telegram bot automatically.\n')));
125
127
  }
126
128
 
127
129
  async function disconnectTelegram() {
@@ -178,9 +180,9 @@ function statusTelegram() {
178
180
  // Show allowed chats
179
181
  const allowedChats = config.telegramAllowedChats || [];
180
182
  if (allowedChats.length === 0) {
181
- console.log(chalk.cyan('İzin listesi:'), chalk.gray('Boş (herkesten mesaj kabul edilir)'));
183
+ console.log(chalk.cyan(L('İzin listesi:', 'Allowlist:')), chalk.gray(L('Boş (herkesten mesaj kabul edilir)', 'Empty (accepts messages from anyone)')));
182
184
  } else {
183
- console.log(chalk.cyan('İzin listesi:'));
185
+ console.log(chalk.cyan(L('İzin listesi:', 'Allowlist:')));
184
186
  allowedChats.forEach(chatId => console.log(chalk.white(` - ${chatId}`)));
185
187
  }
186
188
 
@@ -200,15 +202,15 @@ function allowChat(chatId) {
200
202
  const normalized = chatId.trim();
201
203
 
202
204
  if (!/^-?\d+$/.test(normalized)) {
203
- console.log(chalk.red('\n❌ Geçersiz Chat ID formatı\n'));
204
- console.log(chalk.gray('Chat ID sadece rakamlardan oluşmalı (örnek: 123456789 veya -123456789)\n'));
205
+ console.log(chalk.red(L('\n❌ Geçersiz Chat ID formatı\n', '\n❌ Invalid Chat ID format\n')));
206
+ console.log(chalk.gray(L('Chat ID sadece rakamlardan oluşmalı (örnek: 123456789 veya -123456789)\n', 'Chat ID must consist of digits only (example: 123456789 or -123456789)\n')));
205
207
  process.exit(1);
206
208
  }
207
209
 
208
210
  const allowedChats = config.telegramAllowedChats || [];
209
211
 
210
212
  if (allowedChats.includes(normalized)) {
211
- console.log(chalk.yellow('\n⚠️ Bu chat ID zaten izin listesinde\n'));
213
+ console.log(chalk.yellow(L('\n⚠️ Bu chat ID zaten izin listesinde\n', '\n⚠️ This chat ID is already in the allowlist\n')));
212
214
  return;
213
215
  }
214
216
 
@@ -216,10 +218,10 @@ function allowChat(chatId) {
216
218
  config.telegramAllowedChats = allowedChats;
217
219
  saveConfig(config);
218
220
 
219
- console.log(chalk.green('\n✅ Chat ID izin listesine eklendi\n'));
221
+ console.log(chalk.green(L('\n✅ Chat ID izin listesine eklendi\n', '\n✅ Chat ID added to allowlist\n')));
220
222
  console.log(chalk.cyan('Chat ID:'), chalk.white(normalized));
221
- console.log(chalk.cyan('Toplam:'), chalk.white(`${allowedChats.length} chat`));
222
- console.log(chalk.gray('\nGateway\'i yeniden başlatın: natureco gateway stop && natureco gateway start\n'));
223
+ console.log(chalk.cyan(L('Toplam:', 'Total:')), chalk.white(`${allowedChats.length} chat`));
224
+ console.log(chalk.gray(L('\nGateway\'i yeniden başlatın: natureco gateway stop && natureco gateway start\n', '\nRestart the gateway: natureco gateway stop && natureco gateway start\n')));
223
225
  }
224
226
 
225
227
  module.exports = telegram;
@@ -233,12 +235,12 @@ module.exports = telegram;
233
235
  async function autoDetectChatId() {
234
236
  const config = getConfig();
235
237
  if (!config.telegramToken) {
236
- console.log(chalk.red('\n❌ Once natureco telegram connect yapin\n'));
238
+ console.log(chalk.red(L('\n❌ Once natureco telegram connect yapin\n', '\n❌ First run natureco telegram connect\n')));
237
239
  process.exit(1);
238
240
  }
239
241
 
240
- console.log(chalk.cyan('\n🤖 Telegram bot calistiriliyor, ilk mesaji bekliyorum...\n'));
241
- console.log(chalk.gray('Telegramda botunuza /start yazin veya bir mesaj gonderin\n'));
242
+ console.log(chalk.cyan(L('\n🤖 Telegram bot calistiriliyor, ilk mesaji bekliyorum...\n', '\n🤖 Running Telegram bot, waiting for first message...\n')));
243
+ console.log(chalk.gray(L('Telegramda botunuza /start yazin veya bir mesaj gonderin\n', 'Send /start or a message to your bot on Telegram\n')));
242
244
 
243
245
  const TelegramBot = require('node-telegram-bot-api');
244
246
  const bot = new TelegramBot(config.telegramToken, { polling: true });
@@ -250,10 +252,10 @@ async function autoDetectChatId() {
250
252
  detected = true;
251
253
 
252
254
  const chatId = String(msg.chat.id);
253
- const name = msg.from?.first_name || msg.from?.username || 'Bilinmeyen';
255
+ const name = msg.from?.first_name || msg.from?.username || L('Bilinmeyen', 'Unknown');
254
256
 
255
- console.log(chalk.green('\n✓ Mesaj alindi!'));
256
- console.log(chalk.cyan(` Kullanici: ${name}`));
257
+ console.log(chalk.green(L('\n✓ Mesaj alindi!', '\n✓ Message received!')));
258
+ console.log(chalk.cyan(` ${L('Kullanici', 'User')}: ${name}`));
257
259
  console.log(chalk.cyan(` Chat ID: ${chatId}`));
258
260
 
259
261
  // Kaydet
@@ -263,7 +265,7 @@ async function autoDetectChatId() {
263
265
  }
264
266
  saveConfig(config);
265
267
 
266
- console.log(chalk.green('\n✅ Chat ID kaydedildi: ' + chatId + '\n'));
268
+ console.log(chalk.green(L('\n✅ Chat ID kaydedildi: ', '\n✅ Chat ID saved: ') + chatId + '\n'));
267
269
  bot.stopPolling();
268
270
  process.exit(0);
269
271
  });
@@ -271,7 +273,7 @@ async function autoDetectChatId() {
271
273
  // 60 saniye timeout
272
274
  setTimeout(() => {
273
275
  if (!detected) {
274
- console.log(chalk.red('\n⏱ 60 saniye icinde mesaj gelmedi. Tekrar deneyin.\n'));
276
+ console.log(chalk.red(L('\n⏱ 60 saniye icinde mesaj gelmedi. Tekrar deneyin.\n', '\n⏱ No message within 60 seconds. Try again.\n')));
275
277
  bot.stopPolling();
276
278
  process.exit(1);
277
279
  }