fix(install,uninstall): refresh MCP skills on install, add teardown prompts#235
Merged
fix(install,uninstall): refresh MCP skills on install, add teardown prompts#235
Conversation
…rompts Install now calls refreshGlobalMCPSkills + refreshProjectMCPSkills at the end of runInstall, matching the tail of runUpdate. After an uninstall+reinstall (or any reinstall from a newer binary), global skill/rules/guidelines and per-project .claude/.cursor/.junie artefacts are brought back in sync with the binary instead of staying pinned to whatever shipped when `lerd update` last ran. Uninstall gained three opt-in prompts (all yes when --force): - "Remove MCP integration (global skills + per-site files)" — calls new RemoveGlobalAISkills + RemoveProjectAISkills across every registered site. Strips Claude Code user-scope MCP registration, deletes SKILL.md and lerd.mdc, drops the "lerd" entry from shared mcp.json files (preserves other servers), and removes the lerd block from .junie/guidelines.md (preserves user content). - "Uninstall mkcert CA from system trust stores" — runs `mkcert -uninstall` so browsers / OS stores stop trusting the lerd CA that install added. - "Purge lerd-built container images" — removes lerd-php*-fpm, lerd-custom-*, and lerd-dnsmasq tags. Upstream pulls (mysql, redis, etc.) are left alone because they're expensive to re-pull and user data lives in host bind mounts under ~/.local/share/lerd/data/, not inside the images. New helpers are pure-string where possible (removeMCPServerEntry, stripJunieLerdSection, isLerdBuiltImage) so they're testable without podman or a real filesystem. Round-trip tests confirm Write+Remove symmetry for both global and per-project paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two install-time/uninstall-time asymmetries surfaced while looking at the state of a machine after
lerd uninstall && lerd install.Install never wrote MCP skills. Those were only refreshed by
lerd update(which callsrefreshGlobalMCPSkills/refreshProjectMCPSkillsat its tail). After a reinstall,~/.claude/skills/lerd/SKILL.md,~/.cursor/rules/lerd.mdc,~/.junie/guidelines.md, and each registered site's equivalent files stayed pinned to whatever version the binary was whenlerd updatelast ran — which could be days or weeks stale relative to the currently-installed binary. The same two function calls now run at the end ofrunInstall, using the existing opt-in semantics (global refreshed only if Claude Code user-scope MCP is registered; per-project only for directories that already have lerd markers).Uninstall was the mirror of that problem: it stopped and removed containers, the podman network, and the binary itself, but intentionally left user artefacts behind. That's the right default for config/data/site files, but there's a class of artefacts the user may legitimately want cleaned up — they're lerd-specific, easy to lose track of, and regenerate on next install. Three opt-in prompts added (all default no;
--forceimplies yes to all for parity with the existingremoveDataprompt):RemoveGlobalAISkills+RemoveProjectAISkillsrun across every registered site. Drops Claude Code user-scope MCP registration, deletesSKILL.md/lerd.mdc, removes the"lerd"entry from sharedmcp.jsonfiles while preserving other servers, and strips the<!-- lerd:begin -->…<!-- lerd:end -->block from.junie/guidelines.mdwhile preserving surrounding user content.mkcert -uninstallso browsers and OS trust stores stop trusting the lerd CA thatinstalloriginally added viamkcert -install.lerd-php*-fpm:local,lerd-custom-*:local, andlerd-dnsmasq:local. Upstream pulled images (mysql/redis/postgres/meilisearch/rustfs/mailpit/frankenphp/stripe-cli/…) are deliberately left alone because they're expensive to re-pull and user data lives in host bind mounts under~/.local/share/lerd/data/, not inside the images.New shared helpers (
removeMCPServerEntry,stripJunieLerdSection,isLerdBuiltImage) are pure enough to test without podman or a real filesystem. Round-trip tests confirmWrite/Removesymmetry for both global and project scopes, and that preserving unrelated MCP servers + user content in guidelines.md works correctly. On macOS everything routes through the sameservices.Mgr/ filesystem paths;mkcert -uninstallandclaude mcp removeare platform-agnostic CLIs.