natureco-cli 2.13.18 → 2.13.20
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 +48 -1
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.20</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.20',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -79,7 +79,7 @@ async function migrate(options) {
|
|
|
79
79
|
const memory = {
|
|
80
80
|
name: nameMatch ? nameMatch[1].trim() : null,
|
|
81
81
|
nickname: nicknameMatch ? nicknameMatch[1].trim() : null,
|
|
82
|
-
botName: null, // Will be extracted from MEMORY.md
|
|
82
|
+
botName: null, // Will be extracted from agents directory or MEMORY.md
|
|
83
83
|
facts: []
|
|
84
84
|
};
|
|
85
85
|
|
|
@@ -92,6 +92,26 @@ async function migrate(options) {
|
|
|
92
92
|
memory.nickname = memory.nickname.replace(/\*\*/g, '').trim();
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
// Extract botName from agents directory (primary method)
|
|
96
|
+
// ~/.openclaw/agents/ichigo/ → botName = "İchigo"
|
|
97
|
+
const agentsDir = path.join(openclawDir, 'agents');
|
|
98
|
+
if (fs.existsSync(agentsDir)) {
|
|
99
|
+
try {
|
|
100
|
+
const agents = fs.readdirSync(agentsDir).filter(a => {
|
|
101
|
+
const agentPath = path.join(agentsDir, a);
|
|
102
|
+
return a !== 'main' && !a.startsWith('.') && fs.statSync(agentPath).isDirectory();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (agents.length > 0) {
|
|
106
|
+
// Capitalize first letter: ichigo → İchigo
|
|
107
|
+
const agentName = agents[0];
|
|
108
|
+
memory.botName = agentName.charAt(0).toUpperCase() + agentName.slice(1);
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
// Silently fail if agents directory can't be read
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
95
115
|
if (timezoneMatch) {
|
|
96
116
|
let timezone = timezoneMatch[1].trim().replace(/\*\*/g, '').trim();
|
|
97
117
|
addUniqueFact(memory.facts, {
|
|
@@ -184,6 +204,33 @@ async function migrate(options) {
|
|
|
184
204
|
}
|
|
185
205
|
}
|
|
186
206
|
|
|
207
|
+
// Fallback: Extract botName from cron job names if still not found
|
|
208
|
+
// "Ichigo Brain — 3 Saatlik Döngü" → "Ichigo"
|
|
209
|
+
if (!memory.botName) {
|
|
210
|
+
try {
|
|
211
|
+
const cronJobsPath = path.join(openclawDir, 'cron', 'jobs.json');
|
|
212
|
+
|
|
213
|
+
if (fs.existsSync(cronJobsPath)) {
|
|
214
|
+
const cronData = JSON.parse(fs.readFileSync(cronJobsPath, 'utf8'));
|
|
215
|
+
const jobs = cronData.jobs || cronData || [];
|
|
216
|
+
|
|
217
|
+
// Skip list: generic names that are not bot names
|
|
218
|
+
const skipNames = ['Natureco', 'Gmail', 'Product', 'NatureCo', 'Twitter', 'Forum', 'Main'];
|
|
219
|
+
|
|
220
|
+
for (const job of jobs) {
|
|
221
|
+
// Extract first capitalized word from job name
|
|
222
|
+
const nameMatch = job.name?.match(/^([A-ZÇĞİÖŞÜ][a-zçğıöşü]+)\s/);
|
|
223
|
+
if (nameMatch && !skipNames.includes(nameMatch[1])) {
|
|
224
|
+
memory.botName = nameMatch[1];
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
} catch (err) {
|
|
230
|
+
// Silently fail
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
187
234
|
// Save to NatureCo memory
|
|
188
235
|
const memoryDir = path.join(os.homedir(), '.natureco', 'memory');
|
|
189
236
|
fs.mkdirSync(memoryDir, { recursive: true });
|