engine7 7.1.10 → 7.1.11
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/dist/cli.mjs +42 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -153,8 +153,17 @@ async function doExport(opts) {
|
|
|
153
153
|
const dirs = { workspace, stateDir, engineHome };
|
|
154
154
|
const wsFiles = collectFiles(workspace, WORKSPACE_INCLUDE, WORKSPACE_OPTIONAL);
|
|
155
155
|
const sessionFiles = collectRecentSessions(path.join(stateDir, "agents"), 7);
|
|
156
|
+
const configsDir = path.join(stateDir, "configs");
|
|
157
|
+
const configFiles = [];
|
|
158
|
+
if (fs.existsSync(configsDir)) {
|
|
159
|
+
for (const f of collectAllFiles(configsDir)) {
|
|
160
|
+
if (shouldExclude(path.basename(f))) continue;
|
|
161
|
+
configFiles.push(f);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
156
164
|
console.log(` workspace \u6587\u4EF6: ${wsFiles.length}`);
|
|
157
165
|
console.log(` session jsonl: ${sessionFiles.length} (\u6700\u8FD17\u5929)`);
|
|
166
|
+
console.log(` configs: ${configFiles.length}`);
|
|
158
167
|
if (dryRun2) {
|
|
159
168
|
console.log(`
|
|
160
169
|
[DRY RUN] \u4F1A\u6253\u5305\u4EE5\u4E0B\u6587\u4EF6:`);
|
|
@@ -193,6 +202,19 @@ async function doExport(opts) {
|
|
|
193
202
|
fileCount++;
|
|
194
203
|
totalSize += fs.statSync(srcFile).size;
|
|
195
204
|
}
|
|
205
|
+
for (const srcFile of configFiles) {
|
|
206
|
+
const relPath = path.relative(stateDir, srcFile);
|
|
207
|
+
const destFile = path.join(stagingDir, relPath);
|
|
208
|
+
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
209
|
+
if (isTextFile(srcFile)) {
|
|
210
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
211
|
+
fs.writeFileSync(destFile, sanitizeContent(content, dirs));
|
|
212
|
+
} else {
|
|
213
|
+
fs.copyFileSync(srcFile, destFile);
|
|
214
|
+
}
|
|
215
|
+
fileCount++;
|
|
216
|
+
totalSize += fs.statSync(srcFile).size;
|
|
217
|
+
}
|
|
196
218
|
const manifest = {
|
|
197
219
|
agentName,
|
|
198
220
|
version,
|
|
@@ -289,9 +311,28 @@ async function doImport(opts) {
|
|
|
289
311
|
restoredCount++;
|
|
290
312
|
}
|
|
291
313
|
}
|
|
314
|
+
const configsStaging = path.join(stagingDir, "configs");
|
|
315
|
+
if (fs.existsSync(configsStaging)) {
|
|
316
|
+
const cfgFiles = collectAllFiles(configsStaging);
|
|
317
|
+
for (const srcFile of cfgFiles) {
|
|
318
|
+
const relPath = path.relative(stagingDir, srcFile);
|
|
319
|
+
const destFile = path.join(stateDir, relPath);
|
|
320
|
+
fs.mkdirSync(path.dirname(destFile), { recursive: true });
|
|
321
|
+
if (isTextFile(srcFile)) {
|
|
322
|
+
const content = fs.readFileSync(srcFile, "utf-8");
|
|
323
|
+
fs.writeFileSync(destFile, restoreContent(content, dirs));
|
|
324
|
+
} else {
|
|
325
|
+
fs.copyFileSync(srcFile, destFile);
|
|
326
|
+
}
|
|
327
|
+
restoredCount++;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
292
330
|
console.log(`\u2705 \u6062\u590D\u5B8C\u6210: ${restoredCount} \u6587\u4EF6 \u2192 ${stateDir}`);
|
|
331
|
+
const platformConfigName = process.platform === "darwin" ? "xiaoke-mac.json" : "xiaoke-win.json";
|
|
332
|
+
const restoredConfigPath = path.join(stateDir, "configs", platformConfigName);
|
|
333
|
+
const configToUse = fs.existsSync(restoredConfigPath) ? restoredConfigPath : path.join(stateDir, "configs", "xiaoke.json");
|
|
293
334
|
console.log(`
|
|
294
|
-
\u{1F4A1} \u4E0B\u4E00\u6B65: engine7 start --config
|
|
335
|
+
\u{1F4A1} \u4E0B\u4E00\u6B65: engine7 start --config "${configToUse}"`);
|
|
295
336
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
296
337
|
}
|
|
297
338
|
async function uploadToGitHub(cfg, archiveFile, agentName, version, manifest) {
|