refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries

This commit is contained in:
root committed 2026-10-13 14:37:03 +08:00
1 parent 3f1c6d02f6
commit 27c0f27434
268 files changed
+7468 -7852

No files matched your search

+6 -6
View File
@@ -3,8 +3,8 @@
// → 移动 → 可选跨驱动复制 / 移动(Alist 异步任务)→ 下载回本地比对 sha256 → 不存在 ≠ 失败 → 清理。
//
// 用法:
// deno run -A scripts/alist-e2e.ts --url http://127.0.0.1:5244 --token <令牌> --root /s1 [--root2 /s2] [--size-mb 8]
// deno run -A scripts/alist-e2e.ts --url ... --user admin --password <密码> --root /s1
// bun scripts/alist-e2e.ts --url http://127.0.0.1:5244 --token <令牌> --root /s1 [--root2 /s2] [--size-mb 8]
// bun scripts/alist-e2e.ts --url ... --user admin --password <密码> --root /s1
// 也可用环境变量 UMT_ALIST_REAL_URL / _TOKEN / _USER / _PASSWORD / _ROOT / _ROOT2。退出码 0 = 全部通过。
import { createHash, randomBytes } from "node:crypto";
import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
@@ -14,7 +14,7 @@ import { parseArgs } from "node:util";
import { type AlistAuth, AlistClient, AlistError, redactAlistText } from "../packages/adapters/src/alist/index.ts";
const { values: a } = parseArgs({
args: Deno.args,
args: process.argv.slice(2),
options: {
url: { type: "string" },
token: { type: "string" },
@@ -26,7 +26,7 @@ const { values: a } = parseArgs({
keep: { type: "boolean" },
},
});
const env = (k: string) => Deno.env.get(`UMT_ALIST_REAL_${k}`);
const env = (k: string) => process.env[`UMT_ALIST_REAL_${k}`];
const url = a.url ?? env("URL");
const token = a.token ?? env("TOKEN");
const user = a.user ?? env("USER");
@@ -37,7 +37,7 @@ if (!url || !root || (!token && !user)) {
console.error(
"用法:--url <地址> (--token <令牌> | --user <用户> --password <密码>) --root <可写目录> [--root2 <另一驱动目录>]",
);
Deno.exit(2);
process.exit(2);
}
const auth: AlistAuth = token
? { kind: "token", token }
@@ -137,4 +137,4 @@ if (!a.keep) {
}
await rm(dir, { recursive: true, force: true });
console.log(failed ? `\n${failed} 步失败` : "\n全部通过");
Deno.exit(failed ? 1 : 0);
process.exit(failed ? 1 : 0);