@hupan56/wlkj 3.1.14 → 3.1.15
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 +20 -2
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -951,8 +951,26 @@ function doUpdate() {
|
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
953
|
} catch { /* */ }
|
|
954
|
-
|
|
955
|
-
|
|
954
|
+
// 清理引擎 __pycache__ (v3.x 加): 脚本重组后, 旧 .pyc 可能指向已删/已移的 .py
|
|
955
|
+
// → 某些机器 Python 加载死字节码 → 行为漂移 (机器特定, 难排查)。全删, 自动重建。
|
|
956
|
+
let pycCleaned = 0;
|
|
957
|
+
function _purgePycache(dir) {
|
|
958
|
+
try {
|
|
959
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
960
|
+
const p = path.join(dir, e.name);
|
|
961
|
+
if (e.isDirectory()) {
|
|
962
|
+
if (e.name === "__pycache__") {
|
|
963
|
+
try { fs.rmSync(p, { recursive: true, force: true }); pycCleaned++; } catch { /* 占用 */ }
|
|
964
|
+
} else {
|
|
965
|
+
_purgePycache(p);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
} catch { /* */ }
|
|
970
|
+
}
|
|
971
|
+
_purgePycache(path.join(cwd, ".qoder", "scripts"));
|
|
972
|
+
if (cleaned > 0 || cacheCleaned > 0 || pycCleaned > 0) {
|
|
973
|
+
console.log(` [清理] 废弃文件 ${cleaned} 个 + 过期缓存 ${cacheCleaned} 个 + __pycache__ ${pycCleaned} 个`);
|
|
956
974
|
}
|
|
957
975
|
|
|
958
976
|
// === 5c. 清理 .qoder 嵌套残留 (致命 bug 源) ===
|