natureco-cli 5.56.0 → 5.58.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/cron.js +75 -73
- package/src/commands/discord.js +7 -5
- package/src/commands/gateway.js +25 -23
- package/src/commands/imessage.js +50 -48
- package/src/commands/irc.js +27 -25
- package/src/commands/mattermost.js +34 -32
- package/src/commands/plugins.js +69 -67
- package/src/commands/signal.js +61 -59
- package/src/commands/skills.js +76 -74
- package/src/commands/slack.js +7 -5
- package/src/commands/sms.js +35 -33
- package/src/commands/telegram.js +50 -48
- package/src/commands/whatsapp.js +43 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.58.0",
|
|
4
4
|
"description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"natureco": "bin/natureco.js"
|
package/src/commands/cron.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const { getLang: _gl } = require('../utils/i18n');
|
|
3
|
+
const L = (tr, en) => (_gl() === 'en' ? en : tr);
|
|
2
4
|
const tui = require('../utils/tui');
|
|
3
5
|
const F = require('../utils/format');
|
|
4
6
|
const fs = require('fs');
|
|
@@ -40,8 +42,8 @@ function saveCrons(crons) {
|
|
|
40
42
|
|
|
41
43
|
async function cron(action, options) {
|
|
42
44
|
if (!action || !['add', 'list', 'remove', 'get', 'edit', 'enable', 'disable', 'runs', 'run'].includes(action)) {
|
|
43
|
-
console.log(chalk.red('\n❌ Geçersiz aksiyon\n'));
|
|
44
|
-
console.log(chalk.gray('Kullanım:'));
|
|
45
|
+
console.log(chalk.red(L('\n❌ Geçersiz aksiyon\n', '\n❌ Invalid action\n')));
|
|
46
|
+
console.log(chalk.gray(L('Kullanım:', 'Usage:')));
|
|
45
47
|
console.log(chalk.cyan(' natureco cron add --name <name> --schedule <cron> --action <channel> --target <target> --prompt <prompt>'));
|
|
46
48
|
console.log(chalk.cyan(' natureco cron list'));
|
|
47
49
|
console.log(chalk.cyan(' natureco cron get <name>'));
|
|
@@ -51,8 +53,8 @@ async function cron(action, options) {
|
|
|
51
53
|
console.log(chalk.cyan(' natureco cron disable <name>'));
|
|
52
54
|
console.log(chalk.cyan(' natureco cron runs <name>'));
|
|
53
55
|
console.log(chalk.cyan(' natureco cron run <name>'));
|
|
54
|
-
console.log(chalk.gray('\nÖrnek:'));
|
|
55
|
-
console.log(chalk.cyan(' natureco cron add --name "bitcoin-fiyat" --schedule "0 9 * * *" --action "whatsapp" --target "+905422842631" --prompt "Bugünkü Bitcoin fiyatını öğren ve kısaca bildir"\n'));
|
|
56
|
+
console.log(chalk.gray(L('\nÖrnek:', '\nExample:')));
|
|
57
|
+
console.log(chalk.cyan(L(' natureco cron add --name "bitcoin-fiyat" --schedule "0 9 * * *" --action "whatsapp" --target "+905422842631" --prompt "Bugünkü Bitcoin fiyatını öğren ve kısaca bildir"\n', ' natureco cron add --name "bitcoin-price" --schedule "0 9 * * *" --action "whatsapp" --target "+905422842631" --prompt "Get today\'s Bitcoin price and report briefly"\n')));
|
|
56
58
|
process.exit(1);
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -81,13 +83,13 @@ async function addCron(options) {
|
|
|
81
83
|
const { name, schedule, action, target, prompt } = options;
|
|
82
84
|
|
|
83
85
|
if (!name || !schedule || !action || !target || !prompt) {
|
|
84
|
-
console.log(chalk.red('\n❌ Eksik parametre\n'));
|
|
85
|
-
console.log(chalk.gray('Gerekli parametreler: --name, --schedule, --action, --target, --prompt\n'));
|
|
86
|
+
console.log(chalk.red(L('\n❌ Eksik parametre\n', '\n❌ Missing parameter\n')));
|
|
87
|
+
console.log(chalk.gray(L('Gerekli parametreler: --name, --schedule, --action, --target, --prompt\n', 'Required parameters: --name, --schedule, --action, --target, --prompt\n')));
|
|
86
88
|
process.exit(1);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
if (!['whatsapp', 'telegram'].includes(action)) {
|
|
90
|
-
console.log(chalk.red('\n❌ Geçersiz action. Sadece "whatsapp" veya "telegram" kullanılabilir\n'));
|
|
92
|
+
console.log(chalk.red(L('\n❌ Geçersiz action. Sadece "whatsapp" veya "telegram" kullanılabilir\n', '\n❌ Invalid action. Only "whatsapp" or "telegram" can be used\n')));
|
|
91
93
|
process.exit(1);
|
|
92
94
|
}
|
|
93
95
|
|
|
@@ -95,13 +97,13 @@ async function addCron(options) {
|
|
|
95
97
|
try {
|
|
96
98
|
const nodeCron = require('node-cron');
|
|
97
99
|
if (!nodeCron.validate(schedule)) {
|
|
98
|
-
console.log(chalk.red('\n❌ Geçersiz cron ifadesi\n'));
|
|
99
|
-
console.log(chalk.gray('Örnek: "0 9 * * *" (her gün saat 09:00)\n'));
|
|
100
|
+
console.log(chalk.red(L('\n❌ Geçersiz cron ifadesi\n', '\n❌ Invalid cron expression\n')));
|
|
101
|
+
console.log(chalk.gray(L('Örnek: "0 9 * * *" (her gün saat 09:00)\n', 'Example: "0 9 * * *" (every day at 09:00)\n')));
|
|
100
102
|
process.exit(1);
|
|
101
103
|
}
|
|
102
104
|
} catch (err) {
|
|
103
|
-
console.log(chalk.red('\n❌ node-cron yüklü değil\n'));
|
|
104
|
-
console.log(chalk.yellow('Yüklemek için:'), chalk.cyan('npm install -g node-cron\n'));
|
|
105
|
+
console.log(chalk.red(L('\n❌ node-cron yüklü değil\n', '\n❌ node-cron not installed\n')));
|
|
106
|
+
console.log(chalk.yellow(L('Yüklemek için:', 'To install:')), chalk.cyan('npm install -g node-cron\n'));
|
|
105
107
|
process.exit(1);
|
|
106
108
|
}
|
|
107
109
|
|
|
@@ -109,8 +111,8 @@ async function addCron(options) {
|
|
|
109
111
|
|
|
110
112
|
// Check if name already exists
|
|
111
113
|
if (crons.find(c => c.name === name)) {
|
|
112
|
-
console.log(chalk.red('\n❌ Bu isimde bir cron zaten var\n'));
|
|
113
|
-
console.log(chalk.yellow('Önce silin:'), chalk.cyan(`natureco cron remove --name "${name}"\n`));
|
|
114
|
+
console.log(chalk.red(L('\n❌ Bu isimde bir cron zaten var\n', '\n❌ A cron with this name already exists\n')));
|
|
115
|
+
console.log(chalk.yellow(L('Önce silin:', 'Delete it first:')), chalk.cyan(`natureco cron remove --name "${name}"\n`));
|
|
114
116
|
process.exit(1);
|
|
115
117
|
}
|
|
116
118
|
|
|
@@ -127,24 +129,24 @@ async function addCron(options) {
|
|
|
127
129
|
crons.push(newCron);
|
|
128
130
|
saveCrons(crons);
|
|
129
131
|
|
|
130
|
-
console.log(chalk.green('\n✅ Cron eklendi!\n'));
|
|
131
|
-
console.log(chalk.cyan('İsim:'), chalk.white(name));
|
|
132
|
-
console.log(chalk.cyan('Zamanlama:'), chalk.white(schedule));
|
|
133
|
-
console.log(chalk.cyan('Kanal:'), chalk.white(action));
|
|
134
|
-
console.log(chalk.cyan('Hedef:'), chalk.white(target));
|
|
132
|
+
console.log(chalk.green(L('\n✅ Cron eklendi!\n', '\n✅ Cron added!\n')));
|
|
133
|
+
console.log(chalk.cyan(L('İsim:', 'Name:')), chalk.white(name));
|
|
134
|
+
console.log(chalk.cyan(L('Zamanlama:', 'Schedule:')), chalk.white(schedule));
|
|
135
|
+
console.log(chalk.cyan(L('Kanal:', 'Channel:')), chalk.white(action));
|
|
136
|
+
console.log(chalk.cyan(L('Hedef:', 'Target:')), chalk.white(target));
|
|
135
137
|
console.log(chalk.cyan('Prompt:'), chalk.white(prompt));
|
|
136
|
-
console.log(chalk.gray('\nCron\'lar gateway başlatıldığında aktif olur.'));
|
|
137
|
-
console.log(chalk.gray('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start\n'));
|
|
138
|
+
console.log(chalk.gray(L('\nCron\'lar gateway başlatıldığında aktif olur.', '\nCrons become active when the gateway starts.')));
|
|
139
|
+
console.log(chalk.gray(L('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start\n', 'If the gateway is running, restart it: natureco gateway stop && natureco gateway start\n')));
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
function listCrons() {
|
|
141
143
|
const crons = loadCrons();
|
|
142
144
|
|
|
143
145
|
if (crons.length === 0) {
|
|
144
|
-
console.log('\n' + tui.styled(' ⏰ Zamanlanmış Görevler', { color: tui.PALETTE.primary, bold: true }));
|
|
146
|
+
console.log('\n' + tui.styled(L(' ⏰ Zamanlanmış Görevler', ' ⏰ Scheduled Tasks'), { color: tui.PALETTE.primary, bold: true }));
|
|
145
147
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
146
|
-
console.log('\n ' + tui.C.muted('Henüz cron tanımlı değil. Eklemek için:'));
|
|
147
|
-
console.log(' ' + tui.C.brand('natureco cron add --name "görev" --schedule "0 9 * * *" --action telegram --prompt "..."'));
|
|
148
|
+
console.log('\n ' + tui.C.muted(L('Henüz cron tanımlı değil. Eklemek için:', 'No crons defined yet. To add:')));
|
|
149
|
+
console.log(' ' + tui.C.brand(L('natureco cron add --name "görev" --schedule "0 9 * * *" --action telegram --prompt "..."', 'natureco cron add --name "task" --schedule "0 9 * * *" --action telegram --prompt "..."')));
|
|
148
150
|
console.log('');
|
|
149
151
|
return;
|
|
150
152
|
}
|
|
@@ -177,16 +179,16 @@ function listCrons() {
|
|
|
177
179
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
178
180
|
|
|
179
181
|
console.log('\n' + tui.table(rows, [
|
|
180
|
-
{ key: 'name', label: 'İsim', minWidth: 20, render: r => tui.styled(r.name, { color: tui.PALETTE.primary, bold: true }) },
|
|
181
|
-
{ key: 'schedule', label: 'Zamanlama', minWidth: 18, render: r => tui.C.muted(r.schedule) },
|
|
182
|
+
{ key: 'name', label: L('İsim', 'Name'), minWidth: 20, render: r => tui.styled(r.name, { color: tui.PALETTE.primary, bold: true }) },
|
|
183
|
+
{ key: 'schedule', label: L('Zamanlama', 'Schedule'), minWidth: 18, render: r => tui.C.muted(r.schedule) },
|
|
182
184
|
{
|
|
183
|
-
key: 'status', label: 'Durum', minWidth: 10,
|
|
185
|
+
key: 'status', label: L('Durum', 'Status'), minWidth: 10,
|
|
184
186
|
render: r => r.status
|
|
185
|
-
? tui.styled(' ✓ Aktif ', { bg: tui.PALETTE.success, color: '#000', bold: true })
|
|
186
|
-
: tui.styled(' ✗ Pasif ', { bg: tui.PALETTE.muted, color: '#000', bold: true }),
|
|
187
|
+
? tui.styled(L(' ✓ Aktif ', ' ✓ Active '), { bg: tui.PALETTE.success, color: '#000', bold: true })
|
|
188
|
+
: tui.styled(L(' ✗ Pasif ', ' ✗ Inactive '), { bg: tui.PALETTE.muted, color: '#000', bold: true }),
|
|
187
189
|
},
|
|
188
|
-
{ key: 'target', label: 'Hedef', minWidth: 18, render: r => tui.C.text(r.target) },
|
|
189
|
-
{ key: 'lastRun', label: 'Son Çalışma', minWidth: 18, render: r => tui.C.muted(r.lastRun) },
|
|
190
|
+
{ key: 'target', label: L('Hedef', 'Target'), minWidth: 18, render: r => tui.C.text(r.target) },
|
|
191
|
+
{ key: 'lastRun', label: L('Son Çalışma', 'Last Run'), minWidth: 18, render: r => tui.C.muted(r.lastRun) },
|
|
190
192
|
], { borderStyle: 'round', zebra: true }));
|
|
191
193
|
|
|
192
194
|
console.log('');
|
|
@@ -196,7 +198,7 @@ function removeCron(options) {
|
|
|
196
198
|
const { name } = options;
|
|
197
199
|
|
|
198
200
|
if (!name) {
|
|
199
|
-
F.error('--name parametresi gerekli');
|
|
201
|
+
F.error(L('--name parametresi gerekli', '--name parameter required'));
|
|
200
202
|
process.exit(1);
|
|
201
203
|
}
|
|
202
204
|
|
|
@@ -204,39 +206,39 @@ function removeCron(options) {
|
|
|
204
206
|
const index = crons.findIndex(c => c.name === name);
|
|
205
207
|
|
|
206
208
|
if (index === -1) {
|
|
207
|
-
F.error('Bu isimde bir cron bulunamadı');
|
|
209
|
+
F.error(L('Bu isimde bir cron bulunamadı', 'No cron found with this name'));
|
|
208
210
|
process.exit(1);
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
crons.splice(index, 1);
|
|
212
214
|
saveCrons(crons);
|
|
213
215
|
|
|
214
|
-
F.success('Cron silindi!');
|
|
215
|
-
F.meta('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start');
|
|
216
|
+
F.success(L('Cron silindi!', 'Cron deleted!'));
|
|
217
|
+
F.meta(L('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start', 'If the gateway is running, restart it: natureco gateway stop && natureco gateway start'));
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
function getCron(options) {
|
|
219
221
|
const { name } = options;
|
|
220
222
|
if (!name) {
|
|
221
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron get <name>');
|
|
223
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron get <name>', 'Cron name required. Usage: natureco cron get <name>'));
|
|
222
224
|
process.exit(1);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
const crons = loadCrons();
|
|
226
228
|
const cron = crons.find(c => c.name === name);
|
|
227
229
|
if (!cron) {
|
|
228
|
-
F.error('"' + name + '" isminde bir cron bulunamadı');
|
|
230
|
+
F.error('"' + name + L('" isminde bir cron bulunamadı', '" — no cron found with this name'));
|
|
229
231
|
process.exit(1);
|
|
230
232
|
}
|
|
231
233
|
|
|
232
234
|
F.header('Cron: ' + cron.name);
|
|
233
|
-
F.kv('İsim', cron.name);
|
|
234
|
-
F.kv('Zamanlama', cron.schedule);
|
|
235
|
-
F.kv('Kanal', cron.action);
|
|
236
|
-
F.kv('Hedef', cron.target);
|
|
235
|
+
F.kv(L('İsim', 'Name'), cron.name);
|
|
236
|
+
F.kv(L('Zamanlama', 'Schedule'), cron.schedule);
|
|
237
|
+
F.kv(L('Kanal', 'Channel'), cron.action);
|
|
238
|
+
F.kv(L('Hedef', 'Target'), cron.target);
|
|
237
239
|
F.kv('Prompt', cron.prompt);
|
|
238
|
-
F.kv('Oluşturulma', cron.createdAt);
|
|
239
|
-
F.kv('Durum', cron.enabled ? 'Aktif' : 'Pasif');
|
|
240
|
+
F.kv(L('Oluşturulma', 'Created'), cron.createdAt);
|
|
241
|
+
F.kv(L('Durum', 'Status'), cron.enabled ? L('Aktif', 'Active') : L('Pasif', 'Inactive'));
|
|
240
242
|
}
|
|
241
243
|
|
|
242
244
|
function editCron(options) {
|
|
@@ -244,14 +246,14 @@ function editCron(options) {
|
|
|
244
246
|
const newName = options['newName'];
|
|
245
247
|
|
|
246
248
|
if (!name) {
|
|
247
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron edit <name> [--name <newName>] [--schedule <cron>] [--action <channel>] [--target <target>] [--prompt <prompt>]');
|
|
249
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron edit <name> [--name <newName>] [--schedule <cron>] [--action <channel>] [--target <target>] [--prompt <prompt>]', 'Cron name required. Usage: natureco cron edit <name> [--name <newName>] [--schedule <cron>] [--action <channel>] [--target <target>] [--prompt <prompt>]'));
|
|
248
250
|
process.exit(1);
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
const crons = loadCrons();
|
|
252
254
|
const cron = crons.find(c => c.name === name);
|
|
253
255
|
if (!cron) {
|
|
254
|
-
F.error('"' + name + '" isminde bir cron bulunamadı');
|
|
256
|
+
F.error('"' + name + L('" isminde bir cron bulunamadı', '" — no cron found with this name'));
|
|
255
257
|
process.exit(1);
|
|
256
258
|
}
|
|
257
259
|
|
|
@@ -260,18 +262,18 @@ function editCron(options) {
|
|
|
260
262
|
try {
|
|
261
263
|
const nodeCron = require('node-cron');
|
|
262
264
|
if (!nodeCron.validate(schedule)) {
|
|
263
|
-
F.error('Geçersiz cron ifadesi');
|
|
265
|
+
F.error(L('Geçersiz cron ifadesi', 'Invalid cron expression'));
|
|
264
266
|
process.exit(1);
|
|
265
267
|
}
|
|
266
268
|
} catch (err) {
|
|
267
|
-
F.error('node-cron yüklü değil');
|
|
269
|
+
F.error(L('node-cron yüklü değil', 'node-cron not installed'));
|
|
268
270
|
process.exit(1);
|
|
269
271
|
}
|
|
270
272
|
cron.schedule = schedule;
|
|
271
273
|
}
|
|
272
274
|
if (action) {
|
|
273
275
|
if (!['whatsapp', 'telegram'].includes(action)) {
|
|
274
|
-
F.error('Geçersiz action. Sadece "whatsapp" veya "telegram" kullanılabilir');
|
|
276
|
+
F.error(L('Geçersiz action. Sadece "whatsapp" veya "telegram" kullanılabilir', 'Invalid action. Only "whatsapp" or "telegram" can be used'));
|
|
275
277
|
process.exit(1);
|
|
276
278
|
}
|
|
277
279
|
cron.action = action;
|
|
@@ -281,65 +283,65 @@ function editCron(options) {
|
|
|
281
283
|
|
|
282
284
|
saveCrons(crons);
|
|
283
285
|
|
|
284
|
-
F.success('Cron güncellendi!');
|
|
285
|
-
F.kv('İsim', cron.name);
|
|
286
|
-
F.kv('Zamanlama', cron.schedule);
|
|
287
|
-
F.kv('Kanal', cron.action);
|
|
288
|
-
F.kv('Hedef', cron.target);
|
|
286
|
+
F.success(L('Cron güncellendi!', 'Cron updated!'));
|
|
287
|
+
F.kv(L('İsim', 'Name'), cron.name);
|
|
288
|
+
F.kv(L('Zamanlama', 'Schedule'), cron.schedule);
|
|
289
|
+
F.kv(L('Kanal', 'Channel'), cron.action);
|
|
290
|
+
F.kv(L('Hedef', 'Target'), cron.target);
|
|
289
291
|
F.kv('Prompt', cron.prompt);
|
|
290
|
-
F.meta('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start');
|
|
292
|
+
F.meta(L('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start', 'If the gateway is running, restart it: natureco gateway stop && natureco gateway start'));
|
|
291
293
|
}
|
|
292
294
|
|
|
293
295
|
function enableCron(options) {
|
|
294
296
|
const { name } = options;
|
|
295
297
|
if (!name) {
|
|
296
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron enable <name>');
|
|
298
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron enable <name>', 'Cron name required. Usage: natureco cron enable <name>'));
|
|
297
299
|
process.exit(1);
|
|
298
300
|
}
|
|
299
301
|
|
|
300
302
|
const crons = loadCrons();
|
|
301
303
|
const cron = crons.find(c => c.name === name);
|
|
302
304
|
if (!cron) {
|
|
303
|
-
F.error('"' + name + '" isminde bir cron bulunamadı');
|
|
305
|
+
F.error('"' + name + L('" isminde bir cron bulunamadı', '" — no cron found with this name'));
|
|
304
306
|
process.exit(1);
|
|
305
307
|
}
|
|
306
308
|
|
|
307
309
|
if (cron.enabled) {
|
|
308
|
-
F.warning('"' + name + '" cron zaten aktif');
|
|
310
|
+
F.warning('"' + name + L('" cron zaten aktif', '" cron already active'));
|
|
309
311
|
return;
|
|
310
312
|
}
|
|
311
313
|
|
|
312
314
|
cron.enabled = true;
|
|
313
315
|
saveCrons(crons);
|
|
314
316
|
F.dot(true, name);
|
|
315
|
-
F.success('"' + name + '" cron aktifleştirildi');
|
|
316
|
-
F.meta('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start');
|
|
317
|
+
F.success('"' + name + L('" cron aktifleştirildi', '" cron enabled'));
|
|
318
|
+
F.meta(L('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start', 'If the gateway is running, restart it: natureco gateway stop && natureco gateway start'));
|
|
317
319
|
}
|
|
318
320
|
|
|
319
321
|
function disableCron(options) {
|
|
320
322
|
const { name } = options;
|
|
321
323
|
if (!name) {
|
|
322
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron disable <name>');
|
|
324
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron disable <name>', 'Cron name required. Usage: natureco cron disable <name>'));
|
|
323
325
|
process.exit(1);
|
|
324
326
|
}
|
|
325
327
|
|
|
326
328
|
const crons = loadCrons();
|
|
327
329
|
const cron = crons.find(c => c.name === name);
|
|
328
330
|
if (!cron) {
|
|
329
|
-
F.error('"' + name + '" isminde bir cron bulunamadı');
|
|
331
|
+
F.error('"' + name + L('" isminde bir cron bulunamadı', '" — no cron found with this name'));
|
|
330
332
|
process.exit(1);
|
|
331
333
|
}
|
|
332
334
|
|
|
333
335
|
if (!cron.enabled) {
|
|
334
|
-
F.warning('"' + name + '" cron zaten pasif');
|
|
336
|
+
F.warning('"' + name + L('" cron zaten pasif', '" cron already inactive'));
|
|
335
337
|
return;
|
|
336
338
|
}
|
|
337
339
|
|
|
338
340
|
cron.enabled = false;
|
|
339
341
|
saveCrons(crons);
|
|
340
342
|
F.dot(false, name);
|
|
341
|
-
F.success('"' + name + '" cron pasifleştirildi');
|
|
342
|
-
F.meta('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start');
|
|
343
|
+
F.success('"' + name + L('" cron pasifleştirildi', '" cron disabled'));
|
|
344
|
+
F.meta(L('Gateway çalışıyorsa yeniden başlatın: natureco gateway stop && natureco gateway start', 'If the gateway is running, restart it: natureco gateway stop && natureco gateway start'));
|
|
343
345
|
}
|
|
344
346
|
|
|
345
347
|
function loadRuns() {
|
|
@@ -356,7 +358,7 @@ function loadRuns() {
|
|
|
356
358
|
function showRuns(options) {
|
|
357
359
|
const { name } = options;
|
|
358
360
|
if (!name) {
|
|
359
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron runs <name>');
|
|
361
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron runs <name>', 'Cron name required. Usage: natureco cron runs <name>'));
|
|
360
362
|
process.exit(1);
|
|
361
363
|
}
|
|
362
364
|
|
|
@@ -365,7 +367,7 @@ function showRuns(options) {
|
|
|
365
367
|
F.header('Cron Runs: ' + name);
|
|
366
368
|
|
|
367
369
|
if (runs.length === 0) {
|
|
368
|
-
F.meta('"' + name + '" için kayıtlı çalışma geçmişi yok');
|
|
370
|
+
F.meta('"' + name + L('" için kayıtlı çalışma geçmişi yok', '" — no run history recorded'));
|
|
369
371
|
return;
|
|
370
372
|
}
|
|
371
373
|
|
|
@@ -380,25 +382,25 @@ function showRuns(options) {
|
|
|
380
382
|
function runCron(options) {
|
|
381
383
|
const { name } = options;
|
|
382
384
|
if (!name) {
|
|
383
|
-
F.error('Cron adı gerekli. Kullanım: natureco cron run <name>');
|
|
385
|
+
F.error(L('Cron adı gerekli. Kullanım: natureco cron run <name>', 'Cron name required. Usage: natureco cron run <name>'));
|
|
384
386
|
process.exit(1);
|
|
385
387
|
}
|
|
386
388
|
|
|
387
389
|
const crons = loadCrons();
|
|
388
390
|
const cron = crons.find(c => c.name === name);
|
|
389
391
|
if (!cron) {
|
|
390
|
-
F.error('"' + name + '" isminde bir cron bulunamadı');
|
|
392
|
+
F.error('"' + name + L('" isminde bir cron bulunamadı', '" — no cron found with this name'));
|
|
391
393
|
process.exit(1);
|
|
392
394
|
}
|
|
393
395
|
|
|
394
396
|
const timestamp = new Date().toISOString();
|
|
395
397
|
|
|
396
|
-
F.info('"' + name + '" cron manuel olarak çalıştırılıyor...');
|
|
397
|
-
F.kv('Zamanlama', cron.schedule);
|
|
398
|
-
F.kv('Kanal', cron.action);
|
|
399
|
-
F.kv('Hedef', cron.target);
|
|
398
|
+
F.info('"' + name + L('" cron manuel olarak çalıştırılıyor...', '" cron running manually...'));
|
|
399
|
+
F.kv(L('Zamanlama', 'Schedule'), cron.schedule);
|
|
400
|
+
F.kv(L('Kanal', 'Channel'), cron.action);
|
|
401
|
+
F.kv(L('Hedef', 'Target'), cron.target);
|
|
400
402
|
F.kv('Prompt', cron.prompt);
|
|
401
|
-
F.success('Cron tetiklendi (mock)');
|
|
403
|
+
F.success(L('Cron tetiklendi (mock)', 'Cron triggered (mock)'));
|
|
402
404
|
|
|
403
405
|
// Log the run
|
|
404
406
|
const runs = loadRuns();
|
package/src/commands/discord.js
CHANGED
|
@@ -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 { getApiKey, getConfig, saveConfig } = require('../utils/config');
|
|
4
6
|
const { getBots } = require('../utils/api');
|
|
@@ -27,7 +29,7 @@ async function connectDiscord() {
|
|
|
27
29
|
const config = getConfig();
|
|
28
30
|
|
|
29
31
|
if (!config.providerUrl) {
|
|
30
|
-
console.log(chalk.red('\n❌ Setup yapılmamış. Önce "natureco setup" çalıştırın.\n'));
|
|
32
|
+
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')));
|
|
31
33
|
process.exit(1);
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -46,18 +48,18 @@ async function connectDiscord() {
|
|
|
46
48
|
const botId = `discord_${Date.now()}`;
|
|
47
49
|
const selectedBot = { name: 'Discord Bot', id: botId };
|
|
48
50
|
|
|
49
|
-
console.log(chalk.yellow('\n⏳ Discord bağlantısı kaydediliyor...\n'));
|
|
51
|
+
console.log(chalk.yellow(L('\n⏳ Discord bağlantısı kaydediliyor...\n', '\n⏳ Saving Discord connection...\n')));
|
|
50
52
|
|
|
51
53
|
// Save to config (v2.x - no backend call)
|
|
52
54
|
config.discordToken = answers.token.trim();
|
|
53
55
|
config.discordBotId = botId;
|
|
54
56
|
saveConfig(config);
|
|
55
57
|
|
|
56
|
-
console.log(chalk.green('✅ Discord token kaydedildi!\n'));
|
|
58
|
+
console.log(chalk.green(L('✅ Discord token kaydedildi!\n', '✅ Discord token saved!\n')));
|
|
57
59
|
console.log(chalk.cyan('Bot ID:'), chalk.white(botId));
|
|
58
60
|
console.log(chalk.cyan('Token:'), chalk.white(answers.token.slice(0, 20) + '...'));
|
|
59
|
-
console.log(chalk.gray('\nNot: Discord botunuzu Discord Developer Portal\'dan yapılandırmanız gerekiyor.'));
|
|
60
|
-
console.log(chalk.gray('Token config\'e kaydedildi: ~/.natureco/config.json\n'));
|
|
61
|
+
console.log(chalk.gray(L('\nNot: Discord botunuzu Discord Developer Portal\'dan yapılandırmanız gerekiyor.', '\nNote: You need to configure your Discord bot from the Discord Developer Portal.')));
|
|
62
|
+
console.log(chalk.gray(L('Token config\'e kaydedildi: ~/.natureco/config.json\n', 'Token saved to config: ~/.natureco/config.json\n')));
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
async function disconnectDiscord() {
|
package/src/commands/gateway.js
CHANGED
|
@@ -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 tui = require('../utils/tui');
|
|
3
5
|
const F = require('../utils/format');
|
|
4
6
|
const fs = require('fs');
|
|
@@ -349,10 +351,10 @@ async function gateway(action, ...args) {
|
|
|
349
351
|
}
|
|
350
352
|
|
|
351
353
|
F.section('Quick Start');
|
|
352
|
-
F.kv('natureco chat', 'Bot ile sohbet başlat');
|
|
353
|
-
F.kv('natureco setup', 'Kurulumu yeniden çalıştır');
|
|
354
|
-
F.kv('natureco gateway start', 'Gateway\'i arka planda başlat');
|
|
355
|
-
F.kv('natureco help', 'Tüm komutları göster');
|
|
354
|
+
F.kv('natureco chat', L('Bot ile sohbet başlat', 'Start chatting with the bot'));
|
|
355
|
+
F.kv('natureco setup', L('Kurulumu yeniden çalıştır', 'Re-run setup'));
|
|
356
|
+
F.kv('natureco gateway start', L('Gateway\'i arka planda başlat', 'Start the gateway in the background'));
|
|
357
|
+
F.kv('natureco help', L('Tüm komutları göster', 'Show all commands'));
|
|
356
358
|
|
|
357
359
|
F.meta('Docs: natureco.me/cli');
|
|
358
360
|
}
|
|
@@ -371,9 +373,9 @@ async function startGateway() {
|
|
|
371
373
|
const existingPid = parseInt(fs.readFileSync(pidFile, 'utf8').trim(), 10);
|
|
372
374
|
try {
|
|
373
375
|
process.kill(existingPid, 0); // Test et, canlı mı
|
|
374
|
-
console.log('\n' + tui.styled(' ⚠️ Gateway zaten çalışıyor (PID: ' + existingPid + ')', { color: tui.PALETTE.warning, bold: true }) + '\n');
|
|
375
|
-
console.log(' ' + tui.C.muted('Durdurmak için: ') + tui.C.brand('natureco gateway stop'));
|
|
376
|
-
console.log(' ' + tui.C.muted('Durum için: ') + tui.C.brand('natureco gateway status'));
|
|
376
|
+
console.log('\n' + tui.styled(L(' ⚠️ Gateway zaten çalışıyor (PID: ', ' ⚠️ Gateway already running (PID: ') + existingPid + ')', { color: tui.PALETTE.warning, bold: true }) + '\n');
|
|
377
|
+
console.log(' ' + tui.C.muted(L('Durdurmak için: ', 'To stop: ')) + tui.C.brand('natureco gateway stop'));
|
|
378
|
+
console.log(' ' + tui.C.muted(L('Durum için: ', 'For status: ')) + tui.C.brand('natureco gateway status'));
|
|
377
379
|
console.log('');
|
|
378
380
|
return;
|
|
379
381
|
} catch {
|
|
@@ -382,7 +384,7 @@ async function startGateway() {
|
|
|
382
384
|
}
|
|
383
385
|
}
|
|
384
386
|
|
|
385
|
-
console.log('\n' + tui.styled(' 🚀 Gateway Başlatılıyor...', { color: tui.PALETTE.primary, bold: true }));
|
|
387
|
+
console.log('\n' + tui.styled(L(' 🚀 Gateway Başlatılıyor...', ' 🚀 Starting Gateway...'), { color: tui.PALETTE.primary, bold: true }));
|
|
386
388
|
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
387
389
|
|
|
388
390
|
// Log dosyası
|
|
@@ -405,17 +407,17 @@ async function startGateway() {
|
|
|
405
407
|
// Başarı kartı
|
|
406
408
|
const cardW = 54;
|
|
407
409
|
console.log(tui.styled(' ╭' + '─'.repeat(cardW) + '╮', { color: tui.PALETTE.border }));
|
|
408
|
-
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Durum ') + tui.styled(' ✓ Çalışıyor '.padEnd(36), { bg: tui.PALETTE.success, color: '#000', bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
410
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted(L('Durum ', 'Status ')) + tui.styled(L(' ✓ Çalışıyor ', ' ✓ Running ').padEnd(36), { bg: tui.PALETTE.success, color: '#000', bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
409
411
|
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('PID ') + tui.styled(String(child.pid).padEnd(40), { color: tui.PALETTE.text, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
410
|
-
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Log dosyası ') + tui.styled(logFile.padEnd(40).slice(0, 40), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
412
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted(L('Log dosyası ', 'Log file ')) + tui.styled(logFile.padEnd(40).slice(0, 40), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
411
413
|
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Provider ') + tui.styled((config.providerUrl || '—').replace('https://', '').padEnd(40).slice(0, 40), { color: tui.PALETTE.text }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
412
|
-
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Telegram ') + tui.styled((config.telegramToken ? '✓ Token ayarlı' : '✗ Token yok').padEnd(40), { color: config.telegramToken ? tui.PALETTE.success : tui.PALETTE.warning, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
414
|
+
console.log(tui.styled(' │ ', { color: tui.PALETTE.border }) + tui.C.muted('Telegram ') + tui.styled((config.telegramToken ? L('✓ Token ayarlı', '✓ Token set') : L('✗ Token yok', '✗ No token')).padEnd(40), { color: config.telegramToken ? tui.PALETTE.success : tui.PALETTE.warning, bold: true }) + tui.styled(' │', { color: tui.PALETTE.border }));
|
|
413
415
|
console.log(tui.styled(' ╰' + '─'.repeat(cardW) + '╯', { color: tui.PALETTE.border }));
|
|
414
416
|
|
|
415
|
-
console.log('\n ' + tui.C.muted('Komutlar:'));
|
|
416
|
-
console.log(' ' + tui.C.muted(' Durum: ') + tui.C.brand('natureco gateway status'));
|
|
417
|
-
console.log(' ' + tui.C.muted(' Log: ') + tui.C.brand('natureco gateway logs') + ' ' + tui.C.muted('veya ') + tui.C.brand('tail -f ' + logFile));
|
|
418
|
-
console.log(' ' + tui.C.muted(' Dur: ') + tui.C.brand('natureco gateway stop'));
|
|
417
|
+
console.log('\n ' + tui.C.muted(L('Komutlar:', 'Commands:')));
|
|
418
|
+
console.log(' ' + tui.C.muted(L(' Durum: ', ' Status: ')) + tui.C.brand('natureco gateway status'));
|
|
419
|
+
console.log(' ' + tui.C.muted(' Log: ') + tui.C.brand('natureco gateway logs') + ' ' + tui.C.muted(L('veya ', 'or ')) + tui.C.brand('tail -f ' + logFile));
|
|
420
|
+
console.log(' ' + tui.C.muted(L(' Dur: ', ' Stop: ')) + tui.C.brand('natureco gateway stop'));
|
|
419
421
|
console.log('');
|
|
420
422
|
}
|
|
421
423
|
|
|
@@ -485,30 +487,30 @@ async function startWhatsAppProvider(sessionDir, config) {
|
|
|
485
487
|
if (trimmed.toLowerCase().startsWith('!code')) {
|
|
486
488
|
const task = trimmed.replace(/^!code\s*/i, '').trim();
|
|
487
489
|
if (!task) {
|
|
488
|
-
await sock.sendMessage(msg.key.remoteJid, { text: '⚙️ Kullanım: !code <görev>\nÖrnek: !code login sayfasına forgot password ekle' });
|
|
490
|
+
await sock.sendMessage(msg.key.remoteJid, { text: L('⚙️ Kullanım: !code <görev>\nÖrnek: !code login sayfasına forgot password ekle', '⚙️ Usage: !code <task>\nExample: !code add forgot password to the login page') });
|
|
489
491
|
continue;
|
|
490
492
|
}
|
|
491
|
-
console.log(chalk.cyan('[whatsapp]'), chalk.yellow(`!code komutu: ${task.slice(0, 60)}`));
|
|
493
|
+
console.log(chalk.cyan('[whatsapp]'), chalk.yellow(`!code ${L('komutu', 'command')}: ${task.slice(0, 60)}`));
|
|
492
494
|
|
|
493
495
|
try {
|
|
494
496
|
const { runCodeAgent } = require('../utils/headless');
|
|
495
|
-
await sock.sendMessage(msg.key.remoteJid, { text: `⚙️ Çalışıyor: ${task.slice(0, 80)}...` });
|
|
497
|
+
await sock.sendMessage(msg.key.remoteJid, { text: `⚙️ ${L('Çalışıyor', 'Running')}: ${task.slice(0, 80)}...` });
|
|
496
498
|
|
|
497
499
|
const result = await runCodeAgent(task, process.cwd(), (progress) => {
|
|
498
500
|
console.log(chalk.cyan('[whatsapp/code]'), chalk.gray(progress));
|
|
499
501
|
});
|
|
500
502
|
|
|
501
|
-
let reply = `✅ Tamamland
|
|
503
|
+
let reply = `✅ ${L('Tamamlandı!', 'Done!')}\n\n${result.reply}`;
|
|
502
504
|
if (result.filesChanged?.length) {
|
|
503
|
-
reply += `\n\n📝 Değiştirilen dosyalar:\n${result.filesChanged.map(f => `• ${f}`).join('\n')}`;
|
|
505
|
+
reply += `\n\n📝 ${L('Değiştirilen dosyalar', 'Changed files')}:\n${result.filesChanged.map(f => `• ${f}`).join('\n')}`;
|
|
504
506
|
}
|
|
505
507
|
|
|
506
508
|
await sock.sendMessage(msg.key.remoteJid, { text: reply.slice(0, 4000) });
|
|
507
|
-
console.log(chalk.cyan('[whatsapp]'), chalk.green(`!code tamamlandı (${result.iterations} iterasyon)`));
|
|
509
|
+
console.log(chalk.cyan('[whatsapp]'), chalk.green(`!code ${L('tamamlandı', 'completed')} (${result.iterations} ${L('iterasyon', 'iterations')})`));
|
|
508
510
|
} catch (err) {
|
|
509
511
|
const msg = err instanceof NatureCoError ? err.message : err?.message ?? 'Unknown error';
|
|
510
|
-
console.log(chalk.red('[whatsapp/code]'), chalk.gray(
|
|
511
|
-
await sock.sendMessage(msg.key.remoteJid, { text: `❌ Hata: ${msg}` });
|
|
512
|
+
console.log(chalk.red('[whatsapp/code]'), chalk.gray(`${L('hata', 'error')}: ${msg}`));
|
|
513
|
+
await sock.sendMessage(msg.key.remoteJid, { text: `❌ ${L('Hata', 'Error')}: ${msg}` });
|
|
512
514
|
}
|
|
513
515
|
continue;
|
|
514
516
|
}
|