@moonquake2004/dsh-doctor 0.4.3 → 0.4.4
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/dsh-doctor.mjs +31 -0
- package/package.json +1 -1
package/dsh-doctor.mjs
CHANGED
|
@@ -707,6 +707,36 @@ function checkProfile(name) {
|
|
|
707
707
|
} catch (e) {
|
|
708
708
|
report('profile', 'installed_bundle', false, `bundle 版本对比异常: ${e.message.slice(0, 60)}`, undefined);
|
|
709
709
|
}
|
|
710
|
+
|
|
711
|
+
// P15:关键文件 BOM 检测(#5176:package.json 被意外加 BOM 头导致 JSON 解析失败)
|
|
712
|
+
// UTF-8 BOM = EF BB BF = '\uFEFF',pnpm/node 解析 JSON 时不认识 BOM → 报错
|
|
713
|
+
const bomTargets = [
|
|
714
|
+
join(dir, 'package.json'),
|
|
715
|
+
join(dir, 'cordis.patch.yml'),
|
|
716
|
+
join(dir, 'settings.yaml'),
|
|
717
|
+
];
|
|
718
|
+
// 加上 config/*.json
|
|
719
|
+
const configDir = join(dir, 'config');
|
|
720
|
+
if (existsSync(configDir)) {
|
|
721
|
+
try {
|
|
722
|
+
for (const f of readdirSync(configDir)) {
|
|
723
|
+
if (f.endsWith('.json')) bomTargets.push(join(configDir, f));
|
|
724
|
+
}
|
|
725
|
+
} catch { /* skip */ }
|
|
726
|
+
}
|
|
727
|
+
const bomFiles = [];
|
|
728
|
+
for (const f of bomTargets) {
|
|
729
|
+
if (!existsSync(f)) continue;
|
|
730
|
+
try {
|
|
731
|
+
const head = readFileSync(f, 'utf8').slice(0, 1);
|
|
732
|
+
if (head === '\uFEFF') bomFiles.push(f.replace(dir + '/', ''));
|
|
733
|
+
} catch { /* skip */ }
|
|
734
|
+
}
|
|
735
|
+
if (bomFiles.length > 0) {
|
|
736
|
+
report('profile', 'P15', false, `检测到 BOM 头(#5176:JSON/YAML 解析将失败): ${bomFiles.join(', ')}`, '用文本编辑器打开文件,删除首字符(BOM/U+FEFF)后保存;或运行: sed -i "" "1s/^\xEF\xBB\xBF//" <file>');
|
|
737
|
+
} else {
|
|
738
|
+
report('profile', 'P15', true, '关键文件无 BOM 头', undefined);
|
|
739
|
+
}
|
|
710
740
|
}
|
|
711
741
|
|
|
712
742
|
/* ================= session ================= */
|
|
@@ -945,6 +975,7 @@ catalogSeverity.set('E3-node', 'warn');
|
|
|
945
975
|
catalogSeverity.set('installed_bundle', 'warn');
|
|
946
976
|
catalogSeverity.set('P13', 'warn');
|
|
947
977
|
catalogSeverity.set('P14', 'warn');
|
|
978
|
+
catalogSeverity.set('P15', 'error');
|
|
948
979
|
|
|
949
980
|
function bundledCatalog() {
|
|
950
981
|
const p = new URL('./checks.json', import.meta.url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonquake2004/dsh-doctor",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Offline diagnostic for DeepSeek Harness — 28 built-in + 5 catalog checks across env/profile/session (Layer A checks-as-data), self-update (Layer B), and a semi-automatic LLM observer (Layer C, --observe); Doctor panel in web UI settings.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|