feat(cli): add pi2 uninstall for cross-channel state cleanup

`install.sh --uninstall`, `brew uninstall`, `npm rm -g` and
`pi2 uninstall-service` each own one slice; none of them removed the
runtime directory, and deleting the binary left a running daemon behind.

`pi2 uninstall` now owns the state for every channel: disable and remove
the unit, stop the daemon, delete the runtime dir, and — with `--purge` /
`--purge-config` — the data, state and env file. On the curl channel
`--purge` also deletes the install tree, last, because the running binary
lives inside it; npm/brew/AUR trees stay with their package manager, and
the command to remove them is printed instead.

Destructive by design: the plan is always printed, `--yes` (or an
interactive `y`) is required, non-TTY runs refuse without it, and
everything a reinstall would silently lose is an explicit opt-in. The
next-steps footer names what no CLI can clean: the browser's site data and
the plugin-private copy from `:PiWebInstall`.

Docs: rewrite the install.md uninstall section around the two layers
(state vs. binaries) with a table of every path, point deployment.md at
the new command, and update the README.
This commit is contained in:
yuez committed 2026-10-30 09:40:05 +08:00
1 parent c2d1f1d960
commit 2240289426
7 files changed
+1000 -6

No files matched your search

+6
View File
@@ -564,6 +564,12 @@ too). For a login-less service to keep running on Linux enable linger
(`loginctl enable-linger $USER`, `pi2 doctor` warns when it is off;
`pi2 service status --json` reports `linger`).
`pi2 uninstall` chains the same steps plus the rest of the daemon's files:
disable + remove the unit, stop the daemon, delete the runtime directory, and
with `--purge` / `--purge-config` the data, state and env file as well. Use it
instead of this command when the goal is a clean machine, not just a missing
unit — see [install.md](install.md#uninstall) for the full table of paths.
## 10. Logs and health
- `pi2 daemon` logs JSONL to stderr: `systemctl --user status pi2` /