Skip to content

Implement pv uninstall command#16

Merged
munezaclovis merged 8 commits intomainfrom
feat/uninstall
Mar 5, 2026
Merged

Implement pv uninstall command#16
munezaclovis merged 8 commits intomainfrom
feat/uninstall

Conversation

@munezaclovis
Copy link
Copy Markdown
Contributor

Summary

  • Adds pv uninstall command that safely and completely removes pv from the system
  • Requires user to type "uninstall" to confirm (no --yes flag)
  • Offers to back up Composer auth tokens before deletion
  • Gracefully stops daemon/foreground services, removes launchd plist, DNS resolver, and CA cert
  • Reports leftover .pv-php files and shell config lines the user should clean up

Implementation

Follows the 9-task plan:

  1. Confirmation prompt — type "uninstall" to proceed
  2. Auth backup — backs up ~/.pv/composer/auth.json if it contains tokens
  3. Registry read — captures project paths before ~/.pv deletion
  4. Stop services — unloads daemon and/or kills foreground process
  5. Remove plist — deletes ~/Library/LaunchAgents/dev.prvious.pv.plist
  6. System cleanupsudo to remove /etc/resolver/{tld} and untrust CA cert (graceful fallback)
  7. Remove ~/.pv — single rm -rf
  8. Report .pv-php — lists files user can safely delete
  9. Print manual steps — shell config PATH lines to remove

Test plan

  • go test ./... passes (10 new tests, all existing tests pass)
  • E2E: run pv install, link a project, then pv uninstall — verify ~/.pv is gone
  • Verify sudo fallback messaging when declining sudo prompt
  • Verify auth backup creates ~/pv-auth-backup.json correctly

munezaclovis and others added 8 commits March 4, 2026 22:09
Adds a full uninstall command that safely removes all pv data:
- Confirmation prompt requiring user to type "uninstall"
- Composer auth token backup offer before deletion
- Reads registry to track .pv-php files before removing ~/.pv
- Stops daemon/foreground processes gracefully
- Removes launchd plist
- Removes DNS resolver and CA cert (sudo, graceful fallback)
- Removes ~/.pv directory
- Reports leftover .pv-php files in project directories
- Prints shell config cleanup instructions
Runs as Phase 18 after verify-final. Pipes "uninstall" confirmation,
then verifies ~/.pv, launchd plist, DNS resolver, and frankenphp
processes are all gone.
The sudo command inside uninstall was hanging in CI because stdin was
a pipe (already consumed by the confirmation prompt). Now uses sudo -n
(non-interactive) first, falling back to interactive sudo only when
a TTY is detected.
The security command triggers a macOS keychain dialog that hangs in
headless environments. Now runs the resolver removal and cert removal
as separate operations, with a 10-second timeout on the cert removal
that kills the process if it hangs.
In CI, some files under ~/.pv get root ownership from sudo -E pv start.
os.RemoveAll fails on those, so we fall back to sudo -n rm -rf.
- Detect the running binary via os.Executable(), resolve symlinks,
  and remove it (with sudo fallback for /usr/local/bin)
- Updated confirmation prompt to list the pv binary separately
- Manual cleanup instructions now include eval "$(pv env)"
- E2e test verifies the binary is gone after uninstall
@munezaclovis munezaclovis merged commit 34f9d9d into main Mar 5, 2026
1 of 2 checks passed
@munezaclovis munezaclovis deleted the feat/uninstall branch March 5, 2026 06:49
munezaclovis added a commit that referenced this pull request Mar 25, 2026
- #16 (setup TUI off-by-one): cursor bound is correct, max = len+1
- #19 (StartBackgroundUpdater): IS called from server.Start()
- #38 (updateSymlinks divergence): SetGlobal saves before calling,
  paths always agree
- #39 (frankenphp logFile leak): struct only built after Start()
  succeeds, Process is always non-nil
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.

1 participant