natureco-cli 2.13.22 → 2.13.23
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 +43 -0
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.13.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.13.23</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.13.
|
|
344
|
+
version: 'v2.13.23',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -247,9 +247,52 @@ async function migrate(options) {
|
|
|
247
247
|
const memoryDir = path.join(os.homedir(), '.natureco', 'memory');
|
|
248
248
|
fs.mkdirSync(memoryDir, { recursive: true });
|
|
249
249
|
|
|
250
|
+
// Save to universal-provider.json (primary)
|
|
250
251
|
const memoryFile = path.join(memoryDir, 'universal-provider.json');
|
|
251
252
|
fs.writeFileSync(memoryFile, JSON.stringify(memory, null, 2));
|
|
252
253
|
|
|
254
|
+
// Also copy to all existing bot memory files
|
|
255
|
+
try {
|
|
256
|
+
const memoryFiles = fs.readdirSync(memoryDir)
|
|
257
|
+
.filter(f => f.endsWith('.json') && f !== 'universal-provider.json');
|
|
258
|
+
|
|
259
|
+
for (const file of memoryFiles) {
|
|
260
|
+
const filePath = path.join(memoryDir, file);
|
|
261
|
+
|
|
262
|
+
try {
|
|
263
|
+
const existing = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
264
|
+
|
|
265
|
+
// Add botName and nickname (don't overwrite if already exists)
|
|
266
|
+
if (memory.botName && !existing.botName) {
|
|
267
|
+
existing.botName = memory.botName;
|
|
268
|
+
}
|
|
269
|
+
if (memory.nickname && !existing.nickname) {
|
|
270
|
+
existing.nickname = memory.nickname;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Merge facts (avoid duplicates)
|
|
274
|
+
if (!existing.facts) {
|
|
275
|
+
existing.facts = [];
|
|
276
|
+
}
|
|
277
|
+
for (const fact of (memory.facts || [])) {
|
|
278
|
+
addUniqueFact(existing.facts, fact);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Save updated memory
|
|
282
|
+
fs.writeFileSync(filePath, JSON.stringify(existing, null, 2));
|
|
283
|
+
} catch (err) {
|
|
284
|
+
// Skip file if error
|
|
285
|
+
console.log(chalk.gray(`⚠️ ${file} güncellenemedi`));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (memoryFiles.length > 0) {
|
|
290
|
+
console.log(chalk.green(`✅ Memory ${memoryFiles.length} bot dosyasına da kopyalandı`));
|
|
291
|
+
}
|
|
292
|
+
} catch (err) {
|
|
293
|
+
// Silently fail if can't read memory directory
|
|
294
|
+
}
|
|
295
|
+
|
|
253
296
|
report.memory = memory;
|
|
254
297
|
}
|
|
255
298
|
} catch (err) {
|