feat(plugins): 新增资料目录插件索引体检/修复脚本 plugins:doctor
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 51s

背景:手工往 <资料目录>/plugins/ 拷文件、没更新同目录 index.json 时,加载器按索引里的旧哈希校验,
报「完整性校验失败(main.js 的 sha256 不符)」(2026-11-29 便利贴 1.0.8 实发)。

- scripts/plugin-index-doctor.js:扫描目录与索引,逐条报告 版本差异 / 哈希不符 / 文件缺失 / 未登记 / 孤儿条目;
  默认只报告(有待修项时非 0 退出),--write 按实际文件重写索引并自动备份 index.json.bak-<时间戳>
- package.json: npm run plugins:doctor(可带资料目录与 --write)
- docs/standards/plugin-source-of-truth.md:命令表补该脚本,排错行的处置改为指向它

用法:
  npm run plugins:doctor                          # 默认扫 ~/Documents/ImageWorkbench
  npm run plugins:doctor -- /path/to/data         # 指定资料目录(只报告)
  npm run plugins:doctor -- /path/to/data --write # 写入修复
This commit is contained in:
qiqi committed 2026-11-29 12:48:02 +08:00
1 parent a9b19e67de
commit 8e9a3b6ded
3 files changed
+110 -1

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
"test:facts": "node tests/architecture-facts-guard-test.js && node tests/release-records-test.js",
"plugins:gc": "node scripts/plugins-publish.mjs --gc",
"check:plugins": "node scripts/check-plugins-sync.js",
"plugins:doctor": "node scripts/plugin-index-doctor.js",
"hooks:install": "bash scripts/install-git-hooks.sh",
"coverage:browser": "npm run build && node scripts/coverage-browser.js",
"audit:pins": "node scripts/audit-source-pins.js",