You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zsh completion uninstall strips the user's leading blank lines from .zshrc #2015
openspec completion uninstall zsh strips every blank line at the top of .zshrc, not just the separator line that completion install zsh added. A .zshrc that starts with blank lines doesn't come back byte for byte after an install/uninstall round trip.
Round trip through ZshInstaller.configureZshrc and then removeZshrcConfig:
Original .zshrc
After install + uninstall
"\n\nalias ll=\"ls -la\"\n"
"alias ll=\"ls -la\"\n" (both leading blank lines gone)
"alias ll=\"ls -la\"\n"
unchanged
"a\r\nb\r\n"
unchanged
""
unchanged
The cause is in removeZshrcConfig: after removing the block, while (lines[0].trim() === '') lines.shift() runs regardless of where the block was. It also strips leading blank lines when the user moved the block further down the file.
#1872 fixed the same thing for bash (removeBashrcConfig now drops one separator line, and only when the block was at the top). Its test comment says zsh "already" round-trips byte for byte, but it doesn't for files that start with blank lines.
What you expected instead
Uninstall hands .zshrc back exactly as install found it, the same as bash after #1872. It should drop only the separator line install added, and only when the block sits at the top of the file.
Minimal steps to reproduce
printf '\n\nalias ll="ls -la"\n' > ~/.zshrc
openspec completion install zsh (standard zsh, not Oh My Zsh)
openspec completion uninstall zsh
.zshrc now starts with alias ll=...; the two leading blank lines are gone.
OpenSpec version
1.13.2 (main, source checkout)
Coding agent and model
Found and reproduced by Claude Code (Claude Opus 5.5) working for @huiq777; a fix PR follows.
Activity
fix(completion): restore .zshrc byte for byte on zsh uninstall (Fissi…