natureco-cli 2.13.2 → 2.13.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 +73 -4
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.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.13.
|
|
344
|
+
version: 'v2.13.4',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -71,12 +71,75 @@ async function migrate(options) {
|
|
|
71
71
|
|
|
72
72
|
if (timezoneMatch) {
|
|
73
73
|
let timezone = timezoneMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
74
|
-
memory.facts.push(
|
|
74
|
+
memory.facts.push({
|
|
75
|
+
value: `Timezone: ${timezone}`,
|
|
76
|
+
score: 6,
|
|
77
|
+
updatedAt: new Date().toISOString().split('T')[0]
|
|
78
|
+
});
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
if (notesMatch) {
|
|
78
82
|
let notes = notesMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
79
|
-
memory.facts.push(
|
|
83
|
+
memory.facts.push({
|
|
84
|
+
value: notes,
|
|
85
|
+
score: 6,
|
|
86
|
+
updatedAt: new Date().toISOString().split('T')[0]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Skip patterns for useless lines
|
|
91
|
+
const skipPatterns = [
|
|
92
|
+
/^\|/, // tablo satırları
|
|
93
|
+
/^✅|^❌|^⚠️/, // emoji başlangıçlı
|
|
94
|
+
/^npm |^npx |^firebase |^node /, // komutlar
|
|
95
|
+
/^Status:/, // status satırları
|
|
96
|
+
/^#/ // başlıklar
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
const isUseful = (line) => !skipPatterns.some(p => p.test(line.trim()));
|
|
100
|
+
|
|
101
|
+
// Migrate workspace/MEMORY.md and workspace/memory/*.md files
|
|
102
|
+
const memoryMdFiles = [];
|
|
103
|
+
|
|
104
|
+
// Add MEMORY.md if exists
|
|
105
|
+
const mainMemoryPath = path.join(openclawDir, 'workspace', 'MEMORY.md');
|
|
106
|
+
if (fs.existsSync(mainMemoryPath)) {
|
|
107
|
+
memoryMdFiles.push(mainMemoryPath);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Add memory/*.md files if directory exists (skip macOS metadata files)
|
|
111
|
+
const memoryDirPath = path.join(openclawDir, 'workspace', 'memory');
|
|
112
|
+
if (fs.existsSync(memoryDirPath)) {
|
|
113
|
+
const memoryFiles = fs.readdirSync(memoryDirPath)
|
|
114
|
+
.filter(f => f.endsWith('.md') && !f.startsWith('._')) // skip ._MEMORY.md
|
|
115
|
+
.map(f => path.join(memoryDirPath, f));
|
|
116
|
+
memoryMdFiles.push(...memoryFiles);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Process each memory file
|
|
120
|
+
for (const file of memoryMdFiles) {
|
|
121
|
+
try {
|
|
122
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
123
|
+
|
|
124
|
+
// Extract meaningful lines (skip headers, empty lines, useless patterns)
|
|
125
|
+
const lines = content.split('\n')
|
|
126
|
+
.filter(l => l.trim() && !l.startsWith('#'))
|
|
127
|
+
.map(l => l.replace(/^[-*•]\s*/, '').trim())
|
|
128
|
+
.filter(l => l.length > 10)
|
|
129
|
+
.filter(isUseful);
|
|
130
|
+
|
|
131
|
+
// Add first 30 lines as facts (max 200 chars each)
|
|
132
|
+
for (const line of lines.slice(0, 30)) {
|
|
133
|
+
memory.facts.push({
|
|
134
|
+
value: line.slice(0, 200),
|
|
135
|
+
score: 6,
|
|
136
|
+
updatedAt: new Date().toISOString().split('T')[0]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
} catch (err) {
|
|
140
|
+
// Skip file if error
|
|
141
|
+
console.log(chalk.gray(`⚠️ ${path.basename(file)} okunamadı`));
|
|
142
|
+
}
|
|
80
143
|
}
|
|
81
144
|
|
|
82
145
|
// Save to NatureCo memory
|
|
@@ -342,8 +405,14 @@ async function migrate(options) {
|
|
|
342
405
|
console.log(chalk.green('✅ Migration tamamlandı!\n'));
|
|
343
406
|
|
|
344
407
|
if (report.memory) {
|
|
345
|
-
|
|
346
|
-
|
|
408
|
+
// Extract string facts for display (handle both string and object formats)
|
|
409
|
+
const factStrings = report.memory.facts
|
|
410
|
+
.map(f => typeof f === 'string' ? f : f.value)
|
|
411
|
+
.filter(f => f && f.length > 0)
|
|
412
|
+
.slice(0, 3); // Show first 3 facts
|
|
413
|
+
|
|
414
|
+
const factsDisplay = factStrings.length > 0 ? `, ${factStrings.join(', ')}` : '';
|
|
415
|
+
console.log(chalk.green('✅ Memory:'), chalk.white(`${report.memory.name || 'N/A'}${factsDisplay}`));
|
|
347
416
|
}
|
|
348
417
|
|
|
349
418
|
if (report.scripts > 0) {
|