natureco-cli 2.12.8 → 2.13.0
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 +53 -7
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.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.13.0</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.
|
|
344
|
+
version: 'v2.13.0',
|
|
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
|
/**
|
|
@@ -117,11 +118,18 @@ async function migrate(options) {
|
|
|
117
118
|
// First, convert all backslashes to forward slashes
|
|
118
119
|
content = content.replace(/\\/g, '/');
|
|
119
120
|
|
|
120
|
-
// Then normalize Windows path patterns
|
|
121
|
+
// Then normalize Windows path patterns (comprehensive)
|
|
122
|
+
// Handle escaped backslashes in strings (C:\\\\Users\\\\user\\\\ → homedir/)
|
|
121
123
|
content = content
|
|
122
|
-
.replace(/C
|
|
123
|
-
.replace(/
|
|
124
|
+
.replace(/C:\/\/\/\/Users\/\/\/\/user\/\/\/\//g, `${os.homedir()}/`)
|
|
125
|
+
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
124
126
|
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
127
|
+
// String literals with quotes
|
|
128
|
+
.replace(/'C:\/Users\/user\/\.natureco\//g, `'${os.homedir()}/.natureco/`)
|
|
129
|
+
.replace(/"C:\/Users\/user\/\.natureco\//g, `"${os.homedir()}/.natureco/`)
|
|
130
|
+
.replace(/'C:\/\/\/\/Users\/\/\/\/user\/\/\/\/\.natureco\/\/\/\//g, `'${os.homedir()}/.natureco/`)
|
|
131
|
+
// General patterns
|
|
132
|
+
.replace(/E:\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
125
133
|
.replace(/\.openclaw\//g, '.natureco/')
|
|
126
134
|
.replace(/workspace\/scripts\\/g, 'workspace/scripts/');
|
|
127
135
|
}
|
|
@@ -130,6 +138,38 @@ async function migrate(options) {
|
|
|
130
138
|
fs.writeFileSync(destPath, content);
|
|
131
139
|
report.scripts++;
|
|
132
140
|
}
|
|
141
|
+
|
|
142
|
+
// Create package.json for workspace scripts
|
|
143
|
+
const workspaceDir = path.join(os.homedir(), '.natureco', 'workspace', 'scripts');
|
|
144
|
+
const workspacePackageJson = {
|
|
145
|
+
name: "natureco-workspace",
|
|
146
|
+
version: "1.0.0",
|
|
147
|
+
description: "NatureCo workspace scripts",
|
|
148
|
+
dependencies: {
|
|
149
|
+
"dotenv": "^16.0.0",
|
|
150
|
+
"axios": "^1.0.0",
|
|
151
|
+
"node-fetch": "^2.6.0",
|
|
152
|
+
"googleapis": "^118.0.0",
|
|
153
|
+
"playwright": "^1.40.0",
|
|
154
|
+
"twitter-api-v2": "^1.15.0",
|
|
155
|
+
"openai": "^4.0.0"
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
fs.writeFileSync(
|
|
160
|
+
path.join(workspaceDir, 'package.json'),
|
|
161
|
+
JSON.stringify(workspacePackageJson, null, 2)
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
// Install npm packages
|
|
165
|
+
console.log(chalk.yellow('\n📦 Workspace npm paketleri kuruluyor...\n'));
|
|
166
|
+
try {
|
|
167
|
+
execSync('npm install', { cwd: workspaceDir, stdio: 'inherit' });
|
|
168
|
+
console.log(chalk.green('\n✅ npm paketleri kuruldu\n'));
|
|
169
|
+
} catch (err) {
|
|
170
|
+
console.log(chalk.yellow('\n⚠️ npm install başarısız, manuel olarak çalıştırın:\n'));
|
|
171
|
+
console.log(chalk.cyan(` cd ${workspaceDir} && npm install\n`));
|
|
172
|
+
}
|
|
133
173
|
}
|
|
134
174
|
} catch (err) {
|
|
135
175
|
console.log(chalk.gray('⚠️ Workspace scripts migration atlandı:', err.message));
|
|
@@ -179,16 +219,22 @@ async function migrate(options) {
|
|
|
179
219
|
// Get prompt (max 300 chars)
|
|
180
220
|
let prompt = job.payload?.message || '';
|
|
181
221
|
|
|
182
|
-
// Fix Windows paths in prompts
|
|
222
|
+
// Fix Windows paths in prompts (comprehensive)
|
|
183
223
|
// First, convert all backslashes to forward slashes
|
|
184
224
|
prompt = prompt.replace(/\\/g, '/');
|
|
185
225
|
|
|
186
226
|
// Then normalize Windows path patterns
|
|
187
|
-
//
|
|
227
|
+
// Handle escaped backslashes and string literals
|
|
188
228
|
prompt = prompt
|
|
189
|
-
.replace(/C
|
|
190
|
-
.replace(/
|
|
229
|
+
.replace(/C:\/\/\/\/Users\/\/\/\/user\/\/\/\//g, `${os.homedir()}/`)
|
|
230
|
+
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
191
231
|
.replace(/C:\/Users\/user\//g, `${os.homedir()}/`)
|
|
232
|
+
// String literals with quotes
|
|
233
|
+
.replace(/'C:\/Users\/user\/\.natureco\//g, `'${os.homedir()}/.natureco/`)
|
|
234
|
+
.replace(/"C:\/Users\/user\/\.natureco\//g, `"${os.homedir()}/.natureco/`)
|
|
235
|
+
.replace(/'C:\/\/\/\/Users\/\/\/\/user\/\/\/\/\.natureco\/\/\/\//g, `'${os.homedir()}/.natureco/`)
|
|
236
|
+
// General patterns
|
|
237
|
+
.replace(/E:\/\.openclaw\//g, `${os.homedir()}/.natureco/`)
|
|
192
238
|
.replace(/\.openclaw\//g, '.natureco/')
|
|
193
239
|
.replace(/workspace\/scripts\\/g, 'workspace/scripts/');
|
|
194
240
|
|