@hupan56/wlkj 2.4.9 → 2.5.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/bin/cli.js +52 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -328,6 +328,58 @@ function doUpdate() {
|
|
|
328
328
|
// === 4. 写版本戳 ===
|
|
329
329
|
writeEngineVersion(cwd);
|
|
330
330
|
|
|
331
|
+
// === 5. 清理旧版废弃文件 ===
|
|
332
|
+
const OBSOLETE_FILES = [
|
|
333
|
+
".qoder/workflow.md", // 被 rules/wl-pipeline.md 替代
|
|
334
|
+
".qoder/scripts/code_index.py", // 被 git_sync.py 替代
|
|
335
|
+
".qoder/scripts/notify.py", // 被 common/feishu.py 替代
|
|
336
|
+
".qoder/scripts/team.py", // 被 task.py + team_sync.py 替代
|
|
337
|
+
"packages/wlkj/templates/cli.js", // 旧版 CLI
|
|
338
|
+
".qoder/templates/qoder/config.toml", // 旧版配置
|
|
339
|
+
".qoder/templates/qoder/scripts/code_index.py",
|
|
340
|
+
".qoder/templates/qoder/scripts/notify.py",
|
|
341
|
+
".qoder/templates/qoder/scripts/team.py",
|
|
342
|
+
];
|
|
343
|
+
let cleaned = 0;
|
|
344
|
+
for (const f of OBSOLETE_FILES) {
|
|
345
|
+
const fp = path.join(cwd, f);
|
|
346
|
+
if (fs.existsSync(fp)) {
|
|
347
|
+
try {
|
|
348
|
+
if (fs.statSync(fp).isDirectory()) {
|
|
349
|
+
fs.rmSync(fp, { recursive: true, force: true });
|
|
350
|
+
} else {
|
|
351
|
+
fs.unlinkSync(fp);
|
|
352
|
+
}
|
|
353
|
+
console.log(` [清理] 删除废弃文件: ${f}`);
|
|
354
|
+
cleaned++;
|
|
355
|
+
} catch (e) { /* 删不掉跳过 */ }
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// 清理 .new 临时文件 (上次升级生成的配置对比文件)
|
|
359
|
+
try {
|
|
360
|
+
for (const f of fs.readdirSync(path.join(cwd, ".qoder"))) {
|
|
361
|
+
if (f.endsWith(".new")) {
|
|
362
|
+
fs.unlinkSync(path.join(cwd, ".qoder", f));
|
|
363
|
+
console.log(` [清理] 删除临时文件: .qoder/${f}`);
|
|
364
|
+
cleaned++;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
} catch { /* */ }
|
|
368
|
+
// 清理缓存 (索引重建后失效的旧缓存)
|
|
369
|
+
const runtimeDir = path.join(cwd, ".qoder", ".runtime");
|
|
370
|
+
let cacheCleaned = 0;
|
|
371
|
+
try {
|
|
372
|
+
for (const f of fs.readdirSync(runtimeDir)) {
|
|
373
|
+
if (f.startsWith("search-cache-") || f.startsWith("ctx-cache-")) {
|
|
374
|
+
fs.unlinkSync(path.join(runtimeDir, f));
|
|
375
|
+
cacheCleaned++;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
} catch { /* */ }
|
|
379
|
+
if (cleaned > 0 || cacheCleaned > 0) {
|
|
380
|
+
console.log(` [清理] 废弃文件 ${cleaned} 个 + 过期缓存 ${cacheCleaned} 个`);
|
|
381
|
+
}
|
|
382
|
+
|
|
331
383
|
console.log(`\n${"=".repeat(50)}`);
|
|
332
384
|
console.log(` 升级完成! (v${PKG_VERSION})`);
|
|
333
385
|
console.log(`${"=".repeat(50)}`);
|