natureco-cli 2.12.1 → 2.12.4
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/dashboard.js +2 -2
- package/src/commands/migrate.js +35 -13
package/package.json
CHANGED
|
@@ -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.4</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.4',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -51,12 +51,19 @@ async function migrate(options) {
|
|
|
51
51
|
facts: []
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
+
// Clean markdown bold syntax (** Gencay → Gencay)
|
|
55
|
+
if (memory.name) {
|
|
56
|
+
memory.name = memory.name.replace(/\*\*/g, '').trim();
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
if (timezoneMatch) {
|
|
55
|
-
|
|
60
|
+
let timezone = timezoneMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
61
|
+
memory.facts.push(`Timezone: ${timezone}`);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
if (notesMatch) {
|
|
59
|
-
|
|
65
|
+
let notes = notesMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
66
|
+
memory.facts.push(notes);
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
// Save to NatureCo memory
|
|
@@ -77,13 +84,24 @@ async function migrate(options) {
|
|
|
77
84
|
const cronJobsPath = path.join(openclawDir, 'cron', 'jobs.json');
|
|
78
85
|
|
|
79
86
|
if (fs.existsSync(cronJobsPath)) {
|
|
80
|
-
|
|
87
|
+
// OpenClaw cron format: { version: 1, jobs: [...] }
|
|
88
|
+
const cronData = JSON.parse(fs.readFileSync(cronJobsPath, 'utf8'));
|
|
89
|
+
const jobs = cronData.jobs || cronData || []; // jobs property or direct array
|
|
90
|
+
|
|
91
|
+
// Get WhatsApp target from config
|
|
92
|
+
const config = getConfig();
|
|
93
|
+
const whatsappTarget = config.whatsappPhone || '+905422842631'; // fallback
|
|
81
94
|
|
|
82
95
|
const naturecoCrons = [];
|
|
83
96
|
|
|
84
|
-
for (const job of
|
|
97
|
+
for (const job of jobs) {
|
|
85
98
|
report.crons.total++;
|
|
86
99
|
|
|
100
|
+
// Only migrate cron schedule (not "at" schedule)
|
|
101
|
+
if (job.schedule?.kind !== 'cron') {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
87
105
|
if (!job.enabled) {
|
|
88
106
|
report.crons.inactive++;
|
|
89
107
|
continue;
|
|
@@ -91,28 +109,30 @@ async function migrate(options) {
|
|
|
91
109
|
|
|
92
110
|
report.crons.active++;
|
|
93
111
|
|
|
94
|
-
// Only migrate cron schedule (not interval)
|
|
95
|
-
if (job.schedule?.kind !== 'cron') {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
112
|
// Determine action based on delivery channel
|
|
100
113
|
let action = 'whatsapp'; // default
|
|
114
|
+
let target = whatsappTarget;
|
|
115
|
+
|
|
101
116
|
if (job.delivery?.channel === 'telegram') {
|
|
102
117
|
action = 'telegram';
|
|
118
|
+
// Get telegram target from config if available
|
|
119
|
+
const telegramChats = config.telegramAllowedChats || [];
|
|
120
|
+
target = telegramChats[0] || ''; // Use first allowed chat
|
|
103
121
|
}
|
|
104
122
|
|
|
105
|
-
// Get prompt (
|
|
123
|
+
// Get prompt (max 300 chars)
|
|
106
124
|
let prompt = job.payload?.message || '';
|
|
107
|
-
if (prompt.length >
|
|
108
|
-
prompt = prompt.slice(0,
|
|
125
|
+
if (prompt.length > 300) {
|
|
126
|
+
prompt = prompt.slice(0, 300);
|
|
109
127
|
}
|
|
110
128
|
|
|
111
129
|
naturecoCrons.push({
|
|
112
130
|
name: job.name || 'Unnamed Job',
|
|
113
131
|
schedule: job.schedule.expr,
|
|
114
132
|
action: action,
|
|
133
|
+
target: target,
|
|
115
134
|
prompt: prompt,
|
|
135
|
+
enabled: true, // Enable migrated crons
|
|
116
136
|
});
|
|
117
137
|
}
|
|
118
138
|
|
|
@@ -178,11 +198,13 @@ async function migrate(options) {
|
|
|
178
198
|
}
|
|
179
199
|
|
|
180
200
|
if (report.crons.total > 0) {
|
|
181
|
-
console.log(chalk.green('✅ Cron jobs:'), chalk.white(`${report.crons.total} job
|
|
201
|
+
console.log(chalk.green('✅ Cron jobs:'), chalk.white(`${report.crons.total} job bulundu (${report.crons.active} aktif migrate edildi, ${report.crons.inactive} pasif atlandı)`));
|
|
182
202
|
}
|
|
183
203
|
|
|
184
204
|
if (report.telegram && report.telegram.length > 0) {
|
|
185
205
|
console.log(chalk.green('✅ Telegram allowFrom:'), chalk.white(report.telegram.join(', ')));
|
|
206
|
+
} else if (report.telegram !== null) {
|
|
207
|
+
console.log(chalk.gray('⚠️ Telegram allowFrom: Bulunamadı'));
|
|
186
208
|
}
|
|
187
209
|
|
|
188
210
|
if (report.whatsapp) {
|