Skip to content

Stop writing cliAutoInstalled, deprecate in favour of cliUserUninstalled - #3781

Merged
wojtekn merged 5 commits into
trunkfrom
remove-cli-auto-installed-flag
Jun 17, 2026
Merged

Stop writing cliAutoInstalled, deprecate in favour of cliUserUninstalled#3781
wojtekn merged 5 commits into
trunkfrom
remove-cli-auto-installed-flag

Conversation

@wojtekn

@wojtekn wojtekn commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Related issues

How AI was used in this PR

Developed with Claude Code assistance.

Proposed Changes

Now that cliUserUninstalled exists as an explicit signal, cliAutoInstalled no longer serves an ongoing purpose. Its original role — preventing re-installation after first launch — is fully handled by cliUserUninstalled (absent = not uninstalled).

The only remaining use is a one-time migration: on first launch of the new version, cliAutoInstalled: true + absent symlink/directory is treated as a deliberate uninstall and sets cliUserUninstalled: true. After that migration runs once per user, cliAutoInstalled is never meaningfully consulted again.

This PR stops writing cliAutoInstalled on new installs and marks it @deprecated in the storage type. The migration block still reads it, so existing users who uninstalled before #3713 shipped are correctly preserved. The flag and migration block can be removed entirely in a follow-up release.

On Windows, this also fixes updateWindowsCliVersionedPathIfNeeded() to run on every launch where the CLI is installed (not only when cliAutoInstalled was set), keeping the proxy .bat path up to date after app updates.

Testing Instructions

  • Launch Studio with cliAutoInstalled: true + symlink absent in app.jsoncliUserUninstalled should be set to true, CLI not reinstalled
  • Launch Studio with cliAutoInstalled: true + symlink present but stale → symlink re-pointed to current app
  • Fresh install (no flags set) → CLI installs as normal, cliAutoInstalled is NOT written

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@wojtekn
wojtekn requested a review from a team June 11, 2026 10:30
@wojtekn
wojtekn marked this pull request as ready for review June 11, 2026 10:31

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see it was such a simple change. We have an explicit framework for migration in apps/studio/src/migrations, though, so I advise we put the migration code there.

Comment on lines +47 to +53
// Migration: before cliUserUninstalled existed, an absent CLI dir with cliAutoInstalled
// set was the only signal that the user had uninstalled the CLI via Settings. Preserve
// that intent rather than silently reinstalling on the first launch of this version.
if ( userData.cliAutoInstalled && ! ( await this.isCliInstalled() ) ) {
await updateAppdata( { cliUserUninstalled: true } );
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this in a apps/studio/src/migrations migration instead.

@wpmobilebot

wpmobilebot commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing e7b9c91 vs trunk

app-size

Metric trunk e7b9c91 Diff Change
App Size (Mac) 2329.13 MB 2329.13 MB 0.00 MB ⚪ 0.0%

site-editor

Metric trunk e7b9c91 Diff Change
load 1745 ms 1748 ms +3 ms ⚪ 0.0%

site-startup

Metric trunk e7b9c91 Diff Change
siteCreation 8491 ms 8499 ms +8 ms ⚪ 0.0%
siteStartup 3921 ms 3878 ms 43 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tweaked the migration logic so we rely on the canonical isStudioCliInstalled function instead of a custom reimplementation. I've tested this manually and reviewed with Claude locally. LGTM 👍

@wojtekn

wojtekn commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for tweaking that @fredrikekelund .

I've merged trunk to the branch and solved the conflict.

@wojtekn
wojtekn merged commit ad339ca into trunk Jun 17, 2026
12 checks passed
@wojtekn
wojtekn deleted the remove-cli-auto-installed-flag branch June 17, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants