natureco-cli 2.9.0 → 2.9.1

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 CHANGED
@@ -106,12 +106,16 @@ program
106
106
  });
107
107
 
108
108
  program
109
- .command('cron <action> [params...]')
110
- .description('Manage scheduled tasks (add|list|remove)')
111
- .action((action, params) => {
109
+ .command('cron <action>')
110
+ .option('--name <name>', 'Cron job adı')
111
+ .option('--schedule <schedule>', 'Cron schedule (örnek: "0 9 * * *")')
112
+ .option('--action <action>', 'Aksiyon: whatsapp veya telegram')
113
+ .option('--target <target>', 'Hedef numara veya chat ID')
114
+ .option('--prompt <prompt>', 'AI\'a gönderilecek prompt')
115
+ .description('Cron job yönetimi (add|list|remove)')
116
+ .action((action, options) => {
112
117
  const cronCmd = require('../src/commands/cron');
113
- const args = process.argv.slice(3); // Get all args after 'cron'
114
- cronCmd(args);
118
+ cronCmd(action, options);
115
119
  });
116
120
 
117
121
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "NatureCo AI Bot Terminal Interface",
5
5
  "main": "bin/natureco.js",
6
6
  "bin": {
@@ -24,9 +24,7 @@ function saveCrons(crons) {
24
24
  fs.writeFileSync(CRONS_FILE, JSON.stringify(crons, null, 2), 'utf-8');
25
25
  }
26
26
 
27
- async function cron(args) {
28
- const action = args[0];
29
-
27
+ async function cron(action, options) {
30
28
  if (!action || !['add', 'list', 'remove'].includes(action)) {
31
29
  console.log(chalk.red('\n❌ Geçersiz aksiyon\n'));
32
30
  console.log(chalk.gray('Kullanım:'));
@@ -39,35 +37,20 @@ async function cron(args) {
39
37
  }
40
38
 
41
39
  if (action === 'add') {
42
- await addCron(args);
40
+ await addCron(options);
43
41
  } else if (action === 'list') {
44
42
  listCrons();
45
43
  } else if (action === 'remove') {
46
- removeCron(args);
44
+ removeCron(options);
47
45
  }
48
46
  }
49
47
 
50
- async function addCron(args) {
51
- const nameIndex = args.indexOf('--name');
52
- const scheduleIndex = args.indexOf('--schedule');
53
- const actionIndex = args.indexOf('--action');
54
- const targetIndex = args.indexOf('--target');
55
- const promptIndex = args.indexOf('--prompt');
56
-
57
- if (nameIndex === -1 || scheduleIndex === -1 || actionIndex === -1 || targetIndex === -1 || promptIndex === -1) {
58
- console.log(chalk.red('\n❌ Eksik parametre\n'));
59
- console.log(chalk.gray('Gerekli parametreler: --name, --schedule, --action, --target, --prompt\n'));
60
- process.exit(1);
61
- }
62
-
63
- const name = args[nameIndex + 1];
64
- const schedule = args[scheduleIndex + 1];
65
- const action = args[actionIndex + 1];
66
- const target = args[targetIndex + 1];
67
- const prompt = args[promptIndex + 1];
48
+ async function addCron(options) {
49
+ const { name, schedule, action, target, prompt } = options;
68
50
 
69
51
  if (!name || !schedule || !action || !target || !prompt) {
70
- console.log(chalk.red('\n❌ Parametreler boş olamaz\n'));
52
+ console.log(chalk.red('\n❌ Eksik parametre\n'));
53
+ console.log(chalk.gray('Gerekli parametreler: --name, --schedule, --action, --target, --prompt\n'));
71
54
  process.exit(1);
72
55
  }
73
56
 
@@ -142,18 +125,11 @@ function listCrons() {
142
125
  });
143
126
  }
144
127
 
145
- function removeCron(args) {
146
- const nameIndex = args.indexOf('--name');
147
-
148
- if (nameIndex === -1) {
149
- console.log(chalk.red('\n❌ --name parametresi gerekli\n'));
150
- process.exit(1);
151
- }
152
-
153
- const name = args[nameIndex + 1];
128
+ function removeCron(options) {
129
+ const { name } = options;
154
130
 
155
131
  if (!name) {
156
- console.log(chalk.red('\n❌ İsim boş olamaz\n'));
132
+ console.log(chalk.red('\n❌ --name parametresi gerekli\n'));
157
133
  process.exit(1);
158
134
  }
159
135
 
@@ -211,7 +211,7 @@ body::before{
211
211
  <div class="header-bot-name" id="header-bot-name">Nature Bot</div>
212
212
  <div class="header-bot-model" id="header-bot-model">NatureCo</div>
213
213
  </div>
214
- <div class="version-badge" id="version-badge">v2.9.0</div>
214
+ <div class="version-badge" id="version-badge">v2.9.1</div>
215
215
  </div>
216
216
  <div class="messages" id="messages"></div>
217
217
  <div class="input-area">
@@ -341,7 +341,7 @@ function dashboard(action) {
341
341
  apiKey: cfg.apiKey,
342
342
  defaultBot: cfg.defaultBot,
343
343
  defaultBotId: cfg.defaultBotId,
344
- version: 'v2.9.0',
344
+ version: 'v2.9.1',
345
345
  bots: cfg.bots || [],
346
346
  telegramToken: cfg.telegramToken || null,
347
347
  whatsappConnected: cfg.whatsappConnected || false,
@@ -138,7 +138,7 @@ async function startGateway() {
138
138
 
139
139
  async function runGatewayWorker() {
140
140
  // This runs in the background
141
- log('gateway', 'Starting NatureCo Gateway v2.9.0...', 'green');
141
+ log('gateway', 'Starting NatureCo Gateway v2.9.1...', 'green');
142
142
 
143
143
  // Load config
144
144
  const { getConfig } = require('../utils/config');