Skip to content

Make Studio CLI available in AppX via AppExecutionAlias#2547

Merged
gcsecsey merged 9 commits intotrunkfrom
stu-1249-fix-cli-installation-appx-2
Feb 12, 2026
Merged

Make Studio CLI available in AppX via AppExecutionAlias#2547
gcsecsey merged 9 commits intotrunkfrom
stu-1249-fix-cli-installation-appx-2

Conversation

@gcsecsey
Copy link
Contributor

@gcsecsey gcsecsey commented Feb 6, 2026

Related issues

Proposed Changes

On Windows AppX (Microsoft Store) installations, the studio CLI command was not available in the terminal because AppX packages require special handling. This PR:

  • Adds AppExecutionAlias support by compiling a Node.js launcher script to a standalone .exe via @yao-pkg/pkg, which is configured as a Windows AppExecutionAlias in the AppxManifest. When users type studio in a terminal, Windows activates the package context and runs the CLI.
  • Hides the CLI toggle for Store users. Since the CLI is automatically installed with the AppX package, the Settings toggle to install/uninstall the CLI is hidden for Store installations using Electron's process.windowsStore flag for detection.

The PR uses a new dependency @yao-pkg/pkg, but node.js also has a single executable applications feature which could be used to compile it. The downsides of using SEA would be:

  • no cross-compilation at this time (Node 26+ will ship with --build-sea command that supports this)
  • slightly bigger binary
  • requires a slightly more complex build script

If not adding a new dependency is more important than the binary size, we could also adapt this approach, because our CI builds are run on Windows already.

Testing Instructions

Store version:

  1. Download and install the signed .appx package from the CI run
  2. Open a terminal and run where studio, and check that it outputs a path similar to C:\Users\gcsecsey\AppData\Local\Microsoft\WindowsApps\studio.exe
  3. Run other CLI commands, eg. studio site list, these should work as expected
  4. Start Studio and check that Settings > Preferences > Studio CLI toggle is NOT visible

Installer version:

  1. Remove the Store version if it's installed
  2. Download and install the studio-setup.exe from the CI run
  3. Open a terminal and run where studio, and check that it outputs a path similar to C:\Users\gcsecsey\AppData\Local\studio\bin\studio.bat
  4. Run other CLI commands, eg. studio site list, these should work as expected
  5. Start Studio and check that Settings > Preferences > Studio CLI toggle IS visible

Also check for any regressions on Mac.

Windows Store version Installer version Mac (regression)
CleanShot 2026-02-06 at 12 37 16@2x CleanShot 2026-02-06 at 12 47 39@2x CleanShot 2026-02-09 at 12 32 49@2x
image CleanShot 2026-02-06 at 12 48 07@2x CleanShot 2026-02-09 at 12 32 36@2x

Pre-merge Checklist

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

@gcsecsey gcsecsey changed the title Fix: Make Studio CLI available in AppX via AppExecutionAlias Make Studio CLI available in AppX via AppExecutionAlias Feb 6, 2026
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 6, 2026

📊 Performance Test Results

Comparing e25cbb0 vs trunk

site-editor

Metric trunk e25cbb0 Diff Change
load 2749.00 ms 2745.00 ms -4.00 ms ⚪ 0.0%

site-startup

Metric trunk e25cbb0 Diff Change
siteCreation 7083.00 ms 7071.00 ms -12.00 ms ⚪ 0.0%
siteStartup 3925.00 ms 3925.00 ms 0.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

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

The npx/shell approach failed on Windows CI with swallowed errors.
Calling pkg's exec() directly avoids path resolution, shell escaping,
and child process buffer issues.
Without --public, --no-bytecode strips bytecode but pkg also doesn't
include the raw source, resulting in an empty executable.
@gcsecsey gcsecsey requested a review from a team February 9, 2026 12:21
Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

Thank you for detailed description and testing instructions, Gergely. That helps!

I can confirm the changes work correctly. I did not observe any regressions.

Installer version:

Image Image

Store version:

Image Image

macOS version

Image Image

I haven't reviewed the code yet though, but will do so tomorrow with fresh brain.

Copy link
Contributor

@ivan-ottinger ivan-ottinger left a comment

Choose a reason for hiding this comment

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

The changes look good as well! I did not observe any issues. 👍🏼

We will just need to resolve conflicts In package-lock.json.

@gcsecsey gcsecsey merged commit 2dcbbbc into trunk Feb 12, 2026
10 checks passed
@gcsecsey gcsecsey deleted the stu-1249-fix-cli-installation-appx-2 branch February 12, 2026 13:13
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.

3 participants