natureco-cli 2.12.4 → 2.12.5
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 +13 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/migrate.js +12 -2
package/package.json
CHANGED
package/src/commands/cron.js
CHANGED
|
@@ -113,12 +113,24 @@ function listCrons() {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
// Load config for fallback targets
|
|
117
|
+
const { getConfig } = require('../utils/config');
|
|
118
|
+
const config = getConfig();
|
|
119
|
+
const defaultWhatsappTarget = config.whatsappPhone || 'N/A';
|
|
120
|
+
const defaultTelegramTarget = (config.telegramAllowedChats && config.telegramAllowedChats[0]) || 'N/A';
|
|
121
|
+
|
|
116
122
|
console.log(chalk.green(`\n📅 Kayıtlı Cron'lar (${crons.length})\n`));
|
|
117
123
|
|
|
118
124
|
crons.forEach((c, i) => {
|
|
125
|
+
// Use target from cron or fallback to config
|
|
126
|
+
let target = c.target;
|
|
127
|
+
if (!target || target === 'undefined') {
|
|
128
|
+
target = c.action === 'telegram' ? defaultTelegramTarget : defaultWhatsappTarget;
|
|
129
|
+
}
|
|
130
|
+
|
|
119
131
|
console.log(chalk.cyan(`${i + 1}. ${c.name}`));
|
|
120
132
|
console.log(chalk.gray(` Zamanlama: ${c.schedule}`));
|
|
121
|
-
console.log(chalk.gray(` Kanal: ${c.action} → ${
|
|
133
|
+
console.log(chalk.gray(` Kanal: ${c.action} → ${target}`));
|
|
122
134
|
console.log(chalk.gray(` Prompt: ${c.prompt.substring(0, 60)}${c.prompt.length > 60 ? '...' : ''}`));
|
|
123
135
|
console.log(chalk.gray(` Durum: ${c.enabled ? '✅ Aktif' : '❌ Pasif'}`));
|
|
124
136
|
console.log('');
|
|
@@ -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.12.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.12.5</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.12.
|
|
344
|
+
version: 'v2.12.5',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -139,14 +139,24 @@ async function migrate(options) {
|
|
|
139
139
|
// Save to NatureCo crons
|
|
140
140
|
const cronsFile = path.join(os.homedir(), '.natureco', 'crons.json');
|
|
141
141
|
|
|
142
|
-
//
|
|
142
|
+
// Load existing crons and check for duplicates by name
|
|
143
143
|
let existingCrons = [];
|
|
144
144
|
if (fs.existsSync(cronsFile)) {
|
|
145
145
|
existingCrons = JSON.parse(fs.readFileSync(cronsFile, 'utf8'));
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
// Filter out duplicates (check by name)
|
|
149
|
+
const existingNames = existingCrons.map(c => c.name);
|
|
150
|
+
const toAdd = naturecoCrons.filter(c => !existingNames.includes(c.name));
|
|
151
|
+
|
|
152
|
+
// Merge without duplicates
|
|
153
|
+
const mergedCrons = [...existingCrons, ...toAdd];
|
|
149
154
|
fs.writeFileSync(cronsFile, JSON.stringify(mergedCrons, null, 2));
|
|
155
|
+
|
|
156
|
+
// Update report with actual added count
|
|
157
|
+
if (toAdd.length < naturecoCrons.length) {
|
|
158
|
+
console.log(chalk.yellow(`⚠️ ${naturecoCrons.length - toAdd.length} cron zaten mevcut, atlandı`));
|
|
159
|
+
}
|
|
150
160
|
}
|
|
151
161
|
} catch (err) {
|
|
152
162
|
console.log(chalk.gray('⚠️ Cron migration atlandı:', err.message));
|