Add studio uninstall command for the standalone CLI - #3974
Merged
Conversation
Collaborator
📊 Performance Test ResultsComparing 131072d vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
fredrikekelund
approved these changes
Jun 29, 2026
fredrikekelund
left a comment
Contributor
There was a problem hiding this comment.
I haven't tested on Windows yet, but this looks good to me and works as expected on macOS 👍
I left a few comments that'd be nice to address, but I'll let you address the ones you think are relevant without waiting for another review from me, @bcotrim
Comment on lines
+127
to
+130
| if ( removeConfig ) { | ||
| fs.rmSync( configDir, { recursive: true, force: true } ); | ||
| removed.push( configDir ); | ||
| } |
Contributor
There was a problem hiding this comment.
Let's trash it instead.
Adds a `studio uninstall` subcommand that removes a curl-installed standalone CLI bundle and its PATH entry, keeping user config unless --purge is passed. Also fixes a stale cross-channel update banner by making the standalone update cache channel-aware.
bcotrim
force-pushed
the
stu-1938-add-cli-uninstall-command
branch
from
June 29, 2026 09:23
d3c856c to
d074394
Compare
bcotrim
enabled auto-merge (squash)
June 29, 2026 09:58
gcsecsey
pushed a commit
that referenced
this pull request
Jun 29, 2026
## Related issues - Fixes STU-1938 ## How AI was used in this PR Used Claude Code to confirm the standalone install layout against the live wpcom-hosted `install.sh`/`install.ps1` (paths aren't in this repo), scaffold the `uninstall` subcommand and tests, and diagnose the stale cross-channel update banner (live-probed the updates endpoint to confirm the server was correct and the cache was at fault). All code was reviewed by the author. ## Proposed Changes The standalone curl/irm one-liner installs the Studio CLI but there was no matching way to remove it (raised during nightly testing). This adds a discoverable, offline, cross-platform `studio uninstall`: - Removes the installed bundle and takes `studio` off PATH. On macOS/Linux it deletes its own runtime in place and removes the `~/.local/bin/studio` symlink (leaving the shell-profile PATH line, which the desktop app also relies on). On Windows — where the running `node.exe` can't delete itself — a detached helper finishes the removal after exit and strips the PATH registry entry the installer added. - Stops running sites and the daemon first so nothing holds open handles on the runtime being removed. - Preserves user data (`~/.studio` — sites, config) by default; `--purge`/`--all` removes it too, with a confirmation prompt. - Only acts on standalone installs; npm and desktop-embedded installs get pointed at the right uninstall path instead. It also fixes a related bug surfaced while testing: a production CLI could show an update banner offering a `-dev` nightly. The standalone update-check cache lives in the shared `~/.studio` config, so reinstalling a different channel onto the same directory reused the previous channel's cached result for up to 24h. The cache is now ignored when its channel differs from the running CLI's, so the server stays the source of truth. ## Testing Instructions Build a standalone bundle and install it locally: ```bash npm run cli:bundle -- darwin arm64 # or your platform/arch curl -fsSL https://public-api.wordpress.com/wpcom/v2/studio-app/install.sh \ | STUDIO_CLI_URL="$(pwd)/standalone-bundles" bash ``` Then, in a new shell: - `studio uninstall` — confirm `bin/`, `cli/`, and the `~/.local/bin/studio` symlink are removed, `studio` is gone from PATH, and `~/.studio` config/sites are kept. - Reinstall, then `studio uninstall --purge` — confirm it prompts before deleting `~/.studio`, and removes it on confirmation. - Start a site, then `studio uninstall` — confirm sites/daemon stop before removal. - Run `studio uninstall` from an npm install (`npm i -g wp-studio`) and a desktop-embedded build — confirm it does nothing destructive and prints the correct guidance. - **Windows** (needs manual cross-platform verification): confirm the detached helper removes the bundle after the process exits and strips the `<install>\bin` entry from the user PATH registry. Unit tests: `npm test -- apps/cli/commands/tests/uninstall.test.ts apps/cli/lib/tests/update-notifier.test.ts` > Note: this PR also carries a small drive-by fix to the standalone update notifier (the cross-channel cache guard), which is STU-1772 scope — bundled here because it's a one-line correctness fix surfaced during this work. ## Pre-merge Checklist - [x] Have you checked for TypeScript, React or other console errors?
gcsecsey
added a commit
that referenced
this pull request
Jun 30, 2026
## Related issues <!-- Link a related issue to this PR. If the PR does not immediately resolve the issue, for example, it requires a separate deployment to production, avoid using the "Fixes" keyword and use "Related to" instead. --> - N/A ## How AI was used in this PR Claude compared previous release-note sections and release-note PR descriptions, and drafted the curated 1.12.0 wording. The wording was reviewed in-thread before updating the PR. ## Proposed Changes - Replace the generated `1.12.0` release-note block with a shorter, user-facing summary. - Added the two PRs cherry-picked onto the release branch after code freeze: #3974 and #3988 - Folded all dependency/dependabot bumps into a single "Updated multiple dependencies" line. - Omitted internal-only PRs (test/CI infra, `AGENTS.md`/`STUDIO.md` docs, pure refactors, and the experimental Studio Web / "hosted" groundwork). ## Testing Instructions - Read the `1.12.0` section of `RELEASE-NOTES.txt` - Confirm the groupings and wording read well and are accurate - Cross-check against the merged-PR list for anything important that should be surfaced or reworded ## Pre-merge Checklist - [ ] Have you checked for TypeScript, React or other console errors?
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.
Related issues
How AI was used in this PR
Used Claude Code to confirm the standalone install layout against the live wpcom-hosted
install.sh/install.ps1(paths aren't in this repo), scaffold theuninstallsubcommand and tests, and diagnose the stale cross-channel update banner (live-probed the updates endpoint to confirm the server was correct and the cache was at fault). All code was reviewed by the author.Proposed Changes
The standalone curl/irm one-liner installs the Studio CLI but there was no matching way to remove it (raised during nightly testing). This adds a discoverable, offline, cross-platform
studio uninstall:studiooff PATH. On macOS/Linux it deletes its own runtime in place and removes the~/.local/bin/studiosymlink (leaving the shell-profile PATH line, which the desktop app also relies on). On Windows — where the runningnode.execan't delete itself — a detached helper finishes the removal after exit and strips the PATH registry entry the installer added.~/.studio— sites, config) by default;--purge/--allremoves it too, with a confirmation prompt.It also fixes a related bug surfaced while testing: a production CLI could show an update banner offering a
-devnightly. The standalone update-check cache lives in the shared~/.studioconfig, so reinstalling a different channel onto the same directory reused the previous channel's cached result for up to 24h. The cache is now ignored when its channel differs from the running CLI's, so the server stays the source of truth.Testing Instructions
Build a standalone bundle and install it locally:
Then, in a new shell:
studio uninstall— confirmbin/,cli/, and the~/.local/bin/studiosymlink are removed,studiois gone from PATH, and~/.studioconfig/sites are kept.studio uninstall --purge— confirm it prompts before deleting~/.studio, and removes it on confirmation.studio uninstall— confirm sites/daemon stop before removal.studio uninstallfrom an npm install (npm i -g wp-studio) and a desktop-embedded build — confirm it does nothing destructive and prints the correct guidance.<install>\binentry from the user PATH registry.Unit tests:
npm test -- apps/cli/commands/tests/uninstall.test.ts apps/cli/lib/tests/update-notifier.test.tsPre-merge Checklist