promptgraph-mcp 2.9.55 → 2.9.56
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/config.js +8 -1
- package/package.json +1 -1
package/config.js
CHANGED
|
@@ -57,7 +57,14 @@ function makeDefaults(skillsDir, platform) {
|
|
|
57
57
|
|
|
58
58
|
export function loadConfig() {
|
|
59
59
|
if (fs.existsSync(CONFIG_PATH)) {
|
|
60
|
-
|
|
60
|
+
// Strip a UTF-8/UTF-16 BOM if an editor or PowerShell wrote one — JSON.parse
|
|
61
|
+
// rejects a leading BOM and would otherwise crash every command.
|
|
62
|
+
const raw = fs.readFileSync(CONFIG_PATH, 'utf8').replace(/^/, '');
|
|
63
|
+
try {
|
|
64
|
+
return JSON.parse(raw);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
throw new Error(`Config file is corrupted (${CONFIG_PATH}): ${e.message}. Delete it to regenerate defaults.`);
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
return JSON.parse(JSON.stringify(makeDefaults()));
|
|
63
70
|
}
|