Skip to content

fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148)#151

Open
Lakshya77089 wants to merge 1 commit into
DietrichGebert:mainfrom
Lakshya77089:fix/settings-bom-strip-148
Open

fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148)#151
Lakshya77089 wants to merge 1 commit into
DietrichGebert:mainfrom
Lakshya77089:fix/settings-bom-strip-148

Conversation

@Lakshya77089

@Lakshya77089 Lakshya77089 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #148. ponytail-activate.js:46 read and parsed ~/.claude/settings.json without stripping a UTF-8 BOM. On Windows, settings.json written by Notepad or VS Code can carry a BOM; JSON.parse then throws SyntaxError, the outer catch at line 68 silently swallows it, hasStatusline stays false, and the statusline setup nudge is never emitted.

Fix

Strip the leading BOM before parsing, matching the handling already present in ponytail-mode-tracker.js:

// Strip UTF-8 BOM some editors prepend on Windows (breaks JSON.parse)
const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^/, '');
const settings = JSON.parse(raw);

Notes

  • fix: six small bugs from a codebase read #96 added a null guard on the parsed result but did not add BOM stripping.
  • Verified: the  escape matches the sibling hook byte-for-byte, the BOM strip parses a BOM-prefixed payload, and node --check passes.

Severity per the issue: MEDIUM — silent failure; the statusline nudge never surfaces for users with a BOM-prefixed settings.json.

DietrichGebert#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. (DietrichGebert#96 added a null guard but not BOM stripping.)
@Lakshya77089 Lakshya77089 force-pushed the fix/settings-bom-strip-148 branch from b895026 to 20aa9f7 Compare June 18, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ponytail-activate.js: settings.json parsed without BOM strip - statusline nudge silently lost on BOM-prefixed files

1 participant