natureco-cli 4.5.1 → 4.5.2
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 +34 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natureco-cli",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
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,5 @@
|
|
|
1
1
|
const chalk = require('chalk');
|
|
2
|
+
const tui = require('../utils/tui');
|
|
2
3
|
const F = require('../utils/format');
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
const path = require('path');
|
|
@@ -138,18 +139,21 @@ async function addCron(options) {
|
|
|
138
139
|
|
|
139
140
|
function listCrons() {
|
|
140
141
|
const crons = loadCrons();
|
|
141
|
-
|
|
142
|
+
|
|
142
143
|
if (crons.length === 0) {
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
console.log('\n' + tui.styled(' ⏰ Zamanlanmış Görevler', { color: tui.PALETTE.primary, bold: true }));
|
|
145
|
+
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('');
|
|
145
149
|
return;
|
|
146
150
|
}
|
|
147
|
-
|
|
151
|
+
|
|
148
152
|
const { getConfig } = require('../utils/config');
|
|
149
153
|
const config = getConfig();
|
|
150
154
|
const defaultWhatsappTarget = normalizeWhatsAppNumber(config.whatsappPhone) || 'N/A';
|
|
151
155
|
const defaultTelegramTarget = (config.telegramAllowedChats && config.telegramAllowedChats[0]) || 'N/A';
|
|
152
|
-
|
|
156
|
+
|
|
153
157
|
const runs = loadRuns();
|
|
154
158
|
const rows = crons.map(c => {
|
|
155
159
|
let target = c.target;
|
|
@@ -160,15 +164,32 @@ function listCrons() {
|
|
|
160
164
|
}
|
|
161
165
|
const cronRuns = runs.filter(r => r.name === c.name);
|
|
162
166
|
const lastRun = cronRuns.sort((a, b) => new Date(b.timestamp) - new Date(a.timestamp))[0];
|
|
163
|
-
return
|
|
164
|
-
c.name,
|
|
165
|
-
c.schedule,
|
|
166
|
-
c.enabled
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
return {
|
|
168
|
+
name: c.name,
|
|
169
|
+
schedule: c.schedule,
|
|
170
|
+
status: c.enabled,
|
|
171
|
+
target,
|
|
172
|
+
lastRun: lastRun ? lastRun.timestamp.slice(0, 16).replace('T', ' ') : '—',
|
|
173
|
+
};
|
|
169
174
|
});
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
|
|
176
|
+
console.log('\n' + tui.styled(' ⏰ Zamanlanmış Görevler (' + crons.length + ')', { color: tui.PALETTE.primary, bold: true }));
|
|
177
|
+
console.log(tui.styled(' ' + '─'.repeat(56), { color: tui.PALETTE.border }));
|
|
178
|
+
|
|
179
|
+
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
|
+
{
|
|
183
|
+
key: 'status', label: 'Durum', minWidth: 10,
|
|
184
|
+
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
|
+
},
|
|
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
|
+
], { borderStyle: 'round', zebra: true }));
|
|
191
|
+
|
|
192
|
+
console.log('');
|
|
172
193
|
}
|
|
173
194
|
|
|
174
195
|
function removeCron(options) {
|