natureco-cli 2.12.3 → 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 +23 -5
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
|
|
@@ -81,6 +88,10 @@ async function migrate(options) {
|
|
|
81
88
|
const cronData = JSON.parse(fs.readFileSync(cronJobsPath, 'utf8'));
|
|
82
89
|
const jobs = cronData.jobs || cronData || []; // jobs property or direct array
|
|
83
90
|
|
|
91
|
+
// Get WhatsApp target from config
|
|
92
|
+
const config = getConfig();
|
|
93
|
+
const whatsappTarget = config.whatsappPhone || '+905422842631'; // fallback
|
|
94
|
+
|
|
84
95
|
const naturecoCrons = [];
|
|
85
96
|
|
|
86
97
|
for (const job of jobs) {
|
|
@@ -100,21 +111,28 @@ async function migrate(options) {
|
|
|
100
111
|
|
|
101
112
|
// Determine action based on delivery channel
|
|
102
113
|
let action = 'whatsapp'; // default
|
|
114
|
+
let target = whatsappTarget;
|
|
115
|
+
|
|
103
116
|
if (job.delivery?.channel === 'telegram') {
|
|
104
117
|
action = 'telegram';
|
|
118
|
+
// Get telegram target from config if available
|
|
119
|
+
const telegramChats = config.telegramAllowedChats || [];
|
|
120
|
+
target = telegramChats[0] || ''; // Use first allowed chat
|
|
105
121
|
}
|
|
106
122
|
|
|
107
|
-
// Get prompt (
|
|
123
|
+
// Get prompt (max 300 chars)
|
|
108
124
|
let prompt = job.payload?.message || '';
|
|
109
|
-
if (prompt.length >
|
|
110
|
-
prompt = prompt.slice(0,
|
|
125
|
+
if (prompt.length > 300) {
|
|
126
|
+
prompt = prompt.slice(0, 300);
|
|
111
127
|
}
|
|
112
128
|
|
|
113
129
|
naturecoCrons.push({
|
|
114
130
|
name: job.name || 'Unnamed Job',
|
|
115
131
|
schedule: job.schedule.expr,
|
|
116
132
|
action: action,
|
|
133
|
+
target: target,
|
|
117
134
|
prompt: prompt,
|
|
135
|
+
enabled: true, // Enable migrated crons
|
|
118
136
|
});
|
|
119
137
|
}
|
|
120
138
|
|