natureco-cli 2.12.7 → 2.12.9
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 +54 -13
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.9</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.9',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/commands/migrate.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
5
6
|
const { getConfig, setConfig } = require('../utils/config');
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -114,20 +115,54 @@ async function migrate(options) {
|
|
|
114
115
|
|
|
115
116
|
// Fix Windows paths in .js files
|
|
116
117
|
if (file.endsWith('.js')) {
|
|
117
|
-
//
|
|
118
|
-
content = content.replace(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
// First, convert all backslashes to forward slashes
|
|
119
|
+
content = content.replace(/\\/g, '/');
|
|
120
|
+
|
|
121
|
+
// Then normalize Windows path patterns
|
|
122
|
+
content = content
|
|
123
|
+
.replace(/C:\/Users\/user\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
124
|
+
.replace(/E:\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
125
|
+
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
126
|
+
.replace(/\.openclaw\//g, '.natureco/')
|
|
127
|
+
.replace(/workspace\/scripts\\/g, 'workspace/scripts/');
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
// Write fixed content
|
|
128
131
|
fs.writeFileSync(destPath, content);
|
|
129
132
|
report.scripts++;
|
|
130
133
|
}
|
|
134
|
+
|
|
135
|
+
// Create package.json for workspace scripts
|
|
136
|
+
const workspaceDir = path.join(os.homedir(), '.natureco', 'workspace', 'scripts');
|
|
137
|
+
const workspacePackageJson = {
|
|
138
|
+
name: "natureco-workspace",
|
|
139
|
+
version: "1.0.0",
|
|
140
|
+
description: "NatureCo workspace scripts",
|
|
141
|
+
dependencies: {
|
|
142
|
+
"dotenv": "^16.0.0",
|
|
143
|
+
"axios": "^1.0.0",
|
|
144
|
+
"node-fetch": "^2.6.0",
|
|
145
|
+
"googleapis": "^118.0.0",
|
|
146
|
+
"playwright": "^1.40.0",
|
|
147
|
+
"twitter-api-v2": "^1.15.0",
|
|
148
|
+
"openai": "^4.0.0"
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
fs.writeFileSync(
|
|
153
|
+
path.join(workspaceDir, 'package.json'),
|
|
154
|
+
JSON.stringify(workspacePackageJson, null, 2)
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
// Install npm packages
|
|
158
|
+
console.log(chalk.yellow('\n📦 Workspace npm paketleri kuruluyor...\n'));
|
|
159
|
+
try {
|
|
160
|
+
execSync('npm install', { cwd: workspaceDir, stdio: 'inherit' });
|
|
161
|
+
console.log(chalk.green('\n✅ npm paketleri kuruldu\n'));
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.log(chalk.yellow('\n⚠️ npm install başarısız, manuel olarak çalıştırın:\n'));
|
|
164
|
+
console.log(chalk.cyan(` cd ${workspaceDir} && npm install\n`));
|
|
165
|
+
}
|
|
131
166
|
}
|
|
132
167
|
} catch (err) {
|
|
133
168
|
console.log(chalk.gray('⚠️ Workspace scripts migration atlandı:', err.message));
|
|
@@ -178,11 +213,17 @@ async function migrate(options) {
|
|
|
178
213
|
let prompt = job.payload?.message || '';
|
|
179
214
|
|
|
180
215
|
// Fix Windows paths in prompts
|
|
181
|
-
//
|
|
182
|
-
prompt = prompt.replace(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
216
|
+
// First, convert all backslashes to forward slashes
|
|
217
|
+
prompt = prompt.replace(/\\/g, '/');
|
|
218
|
+
|
|
219
|
+
// Then normalize Windows path patterns
|
|
220
|
+
// "node C:/Users/user/.openclaw/workspace/scripts/xxx.js" → "node ~/.natureco/workspace/scripts/xxx.js"
|
|
221
|
+
prompt = prompt
|
|
222
|
+
.replace(/C:\/Users\/user\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
223
|
+
.replace(/E:\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
224
|
+
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
225
|
+
.replace(/\.openclaw\//g, '.natureco/')
|
|
226
|
+
.replace(/workspace\/scripts\\/g, 'workspace/scripts/');
|
|
186
227
|
|
|
187
228
|
if (prompt.length > 300) {
|
|
188
229
|
prompt = prompt.slice(0, 300);
|