feat: TS 构建管线、Spine 抓取器与 wallpapers/ 唯一真相来源

把项目从「手写 dist/」改成「wallpapers/ 是唯一真相来源,dist/ 由 pnpm build 生成」,
并补上配套的类型、门禁与抓取器。一次提交落地整条管线,因为拆开会留下不能构建的中间态。

- src/:运行时与模拟器源码(TS,strict),编译到 build/ 再拷进各分发
- tools/:build / dev / check-{syntax,paths,dist},以及抓取器与回归门禁 tools/checks/
  (.scratch/ 下那批一次性脚本移入 tools/checks/ 并入库为长期门禁)
- wallpapers/:七档壁纸的源数据 + README.md(id/音频/预设的完整规范)
- docs/adr/0005-0008:构建管线与分发拓扑、模拟器契约、自包含 sim、每骨架资源布局
- .gitignore:排除 .scratch/ 的参考资料副本(上游 spine 整仓克隆 ~1.2 GB、
  抓取侦查数据 ~680 MB)与调试转储;这些是本地调查材料,补偿会让仓库无法克隆
- 归一化 .gitignore/CONTEXT.md 行尾(工作区 CRLF、索引 LF 造成的整文件假 diff)

同时修掉三档卡住构建的未完工壁纸:
- kv45 的 meta.json 里 id 还是抓取期场景名 scene_main,经 downloader promote 正名为 kv45
- shajin / zhigengniao_juheye 的 meta.json 误用了骨架描述文件(name/spine/animations/pages)、
  且都缺 preset.template.json;现按规范重建:骨架沉到 spines/<名>/(spine-ts 按 atlas 所在
  目录解析贴图页)、补上元数据与单骨架预设,并清掉 zhigengniao 骨架里指向作者机的绝对路径
- 顺带 promote 已在 sources.yml 里的 kv46(月升之前,与兽共舞)

pnpm check 五道门全绿:10 个分发 / 7 档壁纸 / 141 处引用自包含。
This commit is contained in:
Shuery committed 2026-10-02 01:27:02 +08:00
1 parent b8eee05d78
commit 3f11426964
297 files changed
+216627 -1926

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
// 验证 sim 门禁**真的会拦**:往骨架里注入一个真实外链标签,看 check:dist 是否报错。
// 一个从不失败的检查等于没有检查——上一版它对整页扫标签,四个分发全是假阳性;
// 收紧之后必须确认它没有紧到"什么都查不到"。
import { readFileSync, writeFileSync, copyFileSync, unlinkSync } from "node:fs";
import { execFileSync } from "node:child_process";
const page = "dist/releases/single-hsr-kv37/sim/index.html";
const backup = `${page}.bak`;
function runCheck() {
try {
return execFileSync("node", ["tools/check-dist.ts"], { encoding: "utf8" });
} catch (error) {
const e = error as { stdout?: string; stderr?: string };
return (e.stdout || "") + (e.stderr || "");
}
}
function inject(html, tag) {
const anchor = '<div id="spine-container"></div>';
if (!html.includes(anchor)) throw new Error("锚点没找到,测试需要更新");
return html.replace(anchor, anchor + tag);
}
const cases = [
["外链 script", '<script src="https://evil.example.com/x.js"></script>'],
["file:// 绝对路径", '<script src="file:///D:/somewhere/x.js"></script>'],
["根绝对路径", '<link rel="stylesheet" href="/styles/x.css" />'],
["type=module", '<script type="module" src="x.js"></script>'],
];
const original = readFileSync(page, "utf8");
copyFileSync(page, backup);
let failed = 0;
try {
console.log("=== 干净页面应当通过 ===");
const clean = runCheck();
const cleanOk = clean.includes("✓ 自包含");
console.log(` ${cleanOk ? "✓" : "✗"} 未注入时通过`);
if (!cleanOk) failed++;
for (const [label, tag] of cases) {
writeFileSync(page, inject(original, tag));
const output = runCheck();
// 必须是**失败**,且失败原因里提到 sim/index.html
const caught = !output.includes("✓ 自包含") && output.includes("sim/index.html");
console.log(` ${caught ? "✓" : "✗"} 拦住了「${label}」`);
if (!caught) {
failed++;
console.log(` check 输出:${output.split("\n").slice(0, 3).join(" | ")}`);
}
}
} finally {
writeFileSync(page, original);
unlinkSync(backup);
}
const restored = runCheck();
console.log(`\n还原后:${restored.includes("✓ 自包含") ? "✓ 通过" : "✗ 仍失败"}`);
if (!restored.includes("✓ 自包含")) failed++;
console.log(failed === 0 ? "\nsim 门禁:四种外部依赖都能拦住" : `\nsim 门禁:${failed} 处不符合预期`);
process.exit(failed === 0 ? 0 : 1);