If settings.json contained invalid JSON, JSON.parse threw a SyntaxError, which
has no .code, so the catch rethrew it and crashed the script — after the mode
flag and config file were already removed, leaving cleanup half-done. Handle
SyntaxError explicitly: warn that the statusLine entry couldn't be removed and
leave the file untouched, since invalid JSON can't be safely edited. Adds a
regression test that a malformed settings.json exits 0, warns, and is left
byte-for-byte intact.
Closes#434
Co-authored-by: isaukywhite <50426537+isaukywhite@users.noreply.github.com>
uninstall deleted the whole statusLine key whenever the command contained
'ponytail-statusline'. For a user-combined statusline (e.g. caveman && ponytail)
that destroyed the other plugin's statusline too. Only remove the statusLine
when ponytail owns the whole command; if it's combined with other segments,
leave it and tell the user to strip ponytail's part by hand. Never leaves a
malformed husk. Adds a regression test for the combined case.
Closes#374
Co-authored-by: nanaubusiness <195150264+nanaubusiness@users.noreply.github.com>
Follow-up to #228 (issue #226):
- README: state that scripts/uninstall.js must run *before* the host
remove command, since the script is itself a plugin file and gets
deleted by the removal (or run it from a separate clone).
- uninstall.js: add a ponytail: comment naming the statusLine match
ceiling — substring match + whole-key delete removes a combined
(e.g. caveman+ponytail) statusline wholesale; upgrade path noted.
- Add trailing newline to the file.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>