Skip to content

Consolidate Unix CLI installation managers into a shared base#3972

Open
bcotrim wants to merge 1 commit into
trunkfrom
consolidate-cli-installation-managers
Open

Consolidate Unix CLI installation managers into a shared base#3972
bcotrim wants to merge 1 commit into
trunkfrom
consolidate-cli-installation-managers

Conversation

@bcotrim

@bcotrim bcotrim commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • N/A

How AI was used in this PR

Claude Code traced the three platform installation managers and the shared dispatch in ipc-handlers.ts, then hoisted the duplicated Unix logic into a base class. All changes were reviewed manually; type-checking and the existing CLI unit test were run locally.

Proposed Changes

The macOS and Linux CLI installation managers were ~85% identical — shell-profile editing, symlink management, the standalone-install detection helpers, and the install/uninstall error-dialog handling were duplicated nearly verbatim, and all three platforms repeated the same auto-install try/catch shape.

This consolidates that shared logic into a single Unix base class that macOS and Linux extend, overriding only what is genuinely platform-specific (shell-profile filenames, default profile, the production CLI path, and macOS's legacy /usr/local/bin symlink cleanup). Windows keeps its registry/path mechanics but now reuses the shared error/info dialog and auto-install helpers.

Pure internal refactor: no behavior change — same dialogs, same shell-profile edits, same symlink handling, same Sentry/error reporting. Net ~240 fewer lines, making future changes to install behavior a single edit instead of three. No user-visible impact.

Testing Instructions

This is a behavior-preserving refactor, so existing CLI install/uninstall flows should work exactly as before:

  • macOS/Linux: install the CLI from the app, confirm studio resolves and ~/.local/bin is added to the shell profile; uninstall and confirm the symlink is removed (and, on macOS, the legacy /usr/local/bin/studio is cleaned up).
  • Windows: install/uninstall and confirm the PATH entry + proxy bat file behave as before.
  • Standalone (curl) installs must still be detected and left untouched on all platforms.
  • npm run typecheck (the only failures are pre-existing missing-bundled-dep errors unrelated to this change) and npm test -- apps/studio/src/modules/cli/lib/tests/cli-site-creator.test.ts pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 5de064d vs trunk

app-size

Metric trunk 5de064d Diff Change
App Size (Mac) 1315.48 MB 1315.48 MB 0.01 MB ⚪ 0.0%

site-editor

Metric trunk 5de064d Diff Change
load 1055 ms 1079 ms +24 ms ⚪ 0.0%

site-startup

Metric trunk 5de064d Diff Change
siteCreation 6487 ms 6513 ms +26 ms ⚪ 0.0%
siteStartup 6987 ms 6964 ms 23 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

@bcotrim bcotrim requested a review from a team June 26, 2026 11:04
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.

2 participants