From 20aa9f7486a5e57463826c436741965b7275f3d3 Mon Sep 17 00:00:00 2001 From: Lakshya77089 Date: Thu, 18 Jun 2026 14:17:08 +0530 Subject: [PATCH] fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148) settings.json written by Notepad or VS Code on Windows can carry a UTF-8 BOM. JSON.parse then throws SyntaxError, the outer catch swallows it, hasStatusline stays false, and the statusline setup nudge is never emitted. Strip the leading BOM before parsing, matching the existing handling in ponytail-mode-tracker.js. (#96 added a null guard but not BOM stripping.) --- hooks/ponytail-activate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hooks/ponytail-activate.js b/hooks/ponytail-activate.js index 9610721..51aca92 100644 --- a/hooks/ponytail-activate.js +++ b/hooks/ponytail-activate.js @@ -43,7 +43,9 @@ let output = getPonytailInstructions(mode); if (!isCodex) try { let hasStatusline = false; if (fs.existsSync(settingsPath)) { - const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); + // Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse) + const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, ''); + const settings = JSON.parse(raw); if (settings.statusLine) { hasStatusline = true; }