natureco-cli 2.13.3 → 2.13.5
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 +50 -9
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.5</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.5',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -16,6 +16,21 @@ function normalizeWhatsAppNumber(target) {
|
|
|
16
16
|
return match ? '+' + match[1] : target;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Add unique fact to facts array (prevent duplicates)
|
|
21
|
+
*/
|
|
22
|
+
function addUniqueFact(facts, newFact) {
|
|
23
|
+
const exists = facts.some(f => {
|
|
24
|
+
const existingVal = typeof f === 'string' ? f : f.value;
|
|
25
|
+
const newVal = typeof newFact === 'string' ? newFact : newFact.value;
|
|
26
|
+
return existingVal === newVal;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (!exists) {
|
|
30
|
+
facts.push(newFact);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
19
34
|
async function migrate(options) {
|
|
20
35
|
const from = options.from || 'openclaw';
|
|
21
36
|
|
|
@@ -71,14 +86,33 @@ async function migrate(options) {
|
|
|
71
86
|
|
|
72
87
|
if (timezoneMatch) {
|
|
73
88
|
let timezone = timezoneMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
74
|
-
memory.facts
|
|
89
|
+
addUniqueFact(memory.facts, {
|
|
90
|
+
value: `Timezone: ${timezone}`,
|
|
91
|
+
score: 6,
|
|
92
|
+
updatedAt: new Date().toISOString().split('T')[0]
|
|
93
|
+
});
|
|
75
94
|
}
|
|
76
95
|
|
|
77
96
|
if (notesMatch) {
|
|
78
97
|
let notes = notesMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
79
|
-
memory.facts
|
|
98
|
+
addUniqueFact(memory.facts, {
|
|
99
|
+
value: notes,
|
|
100
|
+
score: 6,
|
|
101
|
+
updatedAt: new Date().toISOString().split('T')[0]
|
|
102
|
+
});
|
|
80
103
|
}
|
|
81
104
|
|
|
105
|
+
// Skip patterns for useless lines
|
|
106
|
+
const skipPatterns = [
|
|
107
|
+
/^\|/, // tablo satırları
|
|
108
|
+
/^✅|^❌|^⚠️/, // emoji başlangıçlı
|
|
109
|
+
/^npm |^npx |^firebase |^node /, // komutlar
|
|
110
|
+
/^Status:/, // status satırları
|
|
111
|
+
/^#/ // başlıklar
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
const isUseful = (line) => !skipPatterns.some(p => p.test(line.trim()));
|
|
115
|
+
|
|
82
116
|
// Migrate workspace/MEMORY.md and workspace/memory/*.md files
|
|
83
117
|
const memoryMdFiles = [];
|
|
84
118
|
|
|
@@ -88,11 +122,11 @@ async function migrate(options) {
|
|
|
88
122
|
memoryMdFiles.push(mainMemoryPath);
|
|
89
123
|
}
|
|
90
124
|
|
|
91
|
-
// Add memory/*.md files if directory exists
|
|
125
|
+
// Add memory/*.md files if directory exists (skip macOS metadata files)
|
|
92
126
|
const memoryDirPath = path.join(openclawDir, 'workspace', 'memory');
|
|
93
127
|
if (fs.existsSync(memoryDirPath)) {
|
|
94
128
|
const memoryFiles = fs.readdirSync(memoryDirPath)
|
|
95
|
-
.filter(f => f.endsWith('.md'))
|
|
129
|
+
.filter(f => f.endsWith('.md') && !f.startsWith('._')) // skip ._MEMORY.md
|
|
96
130
|
.map(f => path.join(memoryDirPath, f));
|
|
97
131
|
memoryMdFiles.push(...memoryFiles);
|
|
98
132
|
}
|
|
@@ -102,15 +136,16 @@ async function migrate(options) {
|
|
|
102
136
|
try {
|
|
103
137
|
const content = fs.readFileSync(file, 'utf8');
|
|
104
138
|
|
|
105
|
-
// Extract meaningful lines (skip headers, empty lines)
|
|
139
|
+
// Extract meaningful lines (skip headers, empty lines, useless patterns)
|
|
106
140
|
const lines = content.split('\n')
|
|
107
141
|
.filter(l => l.trim() && !l.startsWith('#'))
|
|
108
142
|
.map(l => l.replace(/^[-*•]\s*/, '').trim())
|
|
109
|
-
.filter(l => l.length > 10)
|
|
143
|
+
.filter(l => l.length > 10)
|
|
144
|
+
.filter(isUseful);
|
|
110
145
|
|
|
111
146
|
// Add first 30 lines as facts (max 200 chars each)
|
|
112
147
|
for (const line of lines.slice(0, 30)) {
|
|
113
|
-
memory.facts
|
|
148
|
+
addUniqueFact(memory.facts, {
|
|
114
149
|
value: line.slice(0, 200),
|
|
115
150
|
score: 6,
|
|
116
151
|
updatedAt: new Date().toISOString().split('T')[0]
|
|
@@ -385,8 +420,14 @@ async function migrate(options) {
|
|
|
385
420
|
console.log(chalk.green('✅ Migration tamamlandı!\n'));
|
|
386
421
|
|
|
387
422
|
if (report.memory) {
|
|
388
|
-
|
|
389
|
-
|
|
423
|
+
// Extract string facts for display (handle both string and object formats)
|
|
424
|
+
const factStrings = report.memory.facts
|
|
425
|
+
.map(f => typeof f === 'string' ? f : f.value)
|
|
426
|
+
.filter(f => f && f.length > 0)
|
|
427
|
+
.slice(0, 3); // Show first 3 facts
|
|
428
|
+
|
|
429
|
+
const factsDisplay = factStrings.length > 0 ? `, ${factStrings.join(', ')}` : '';
|
|
430
|
+
console.log(chalk.green('✅ Memory:'), chalk.white(`${report.memory.name || 'N/A'}${factsDisplay}`));
|
|
390
431
|
}
|
|
391
432
|
|
|
392
433
|
if (report.scripts > 0) {
|