Skip to content

feat: support Windows natively - #596

Open
mayansharma wants to merge 26 commits into
mainfrom
feat/windows-support
Open

mayansharma wants to merge 26 commits into
mainfrom
feat/windows-support

Conversation

@mayansharma

@mayansharma mayansharma commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

What

Catalyst runs on native Windows (PowerShell, Command Prompt and Git Bash), not only through WSL. npx create-catalyst-app, catalyst start, build, serve, plugins and new-route work there. The Android commands have been ported but not yet run on Windows.

Why

Until now the docs listed macOS and Linux only, and on Windows the first command a new user runs failed:

  • create-catalyst-app spawned npm.cmd without a shell. Node 20.12.2 and later refuse that with EINVAL, so every scaffold stopped at CCA-006 before writing any files. new-route failed the same way with jscodeshift.cmd, and still exited 0.
  • start, build and serve read process.env.PWD, which cmd.exe and PowerShell don't set, and threw ERR_INVALID_ARG_TYPE.
  • --import and import() were given bare C:\ paths, which Node reads as a URL scheme (ERR_UNSUPPORTED_ESM_URL_SCHEME). The app's lifecycle hooks were skipped silently because those imports sit in try/catch.
  • node-loader.mjs detected dependencies with includes("/node_modules/"). With backslash paths every dependency was treated as app code, and catalyst build hung on its spinner while each bundle process grew past 20 GB and ran out of memory.
  • The Android build shelled out to sh -c, ./gradlew, rsync, find, mv and rm -rf, and looked for adb without .exe.

How

  • appRoot() replaces process.env.PWD, and every --import and import() gets a file:// URL.
  • The loader's node_modules check accepts either separator. optimizeDeps entries are relative globs, and diagnostics understand drive letters and file:///C:/ URLs.
  • npm and jscodeshift run through a shell on Windows. new-route exits non-zero on failure, and a failed scaffold removes its temp-* folder.
  • Android runs adb, emulator and gradlew.bat with quoting that survives spaces and parentheses. File work goes through fs (projectFiles.js) instead of POSIX tools. The LAN IP comes from the default route, and Android Studio's bundled JDK is found when java isn't on PATH.
  • iOS still needs a Mac. Bare buildApp and setupEmulator skip iOS on other platforms and carry on with Android. The :ios commands exit with the new IOS-002.
  • prepare no longer uses cp -r or single quotes, so npm install works on Windows. A new .gitattributes keeps checkouts LF and .bat files CRLF.
  • The Windows CI job from the first commit was removed in the second, by choice. scripts/test-windows-smoke.js is still there to run by hand.

These fixes also hold on macOS and Linux: new-route no longer crashes the redux and rtk templates with a ReferenceError, and the MCP config snippet now escapes backslashes.

Testing

  • On Windows 11 (PowerShell 7, Node 24.22), the published 1.1.0 failed every check above. With the fixes, npm start and npm run serve returned HTTP 200 with the app's hooks running, and catalyst build finished in 6.5 s at under 1 GB.
  • npm run test:unit and npm run lint pass on macOS.
  • Android on Windows has not been run. The test machine had no Android SDK, so setupEmulator:android and buildApp:android on Windows are untested.

New error codes

  • IOS-002: iOS builds need macOS and Xcode. errors/ docs are regenerated.

Test coverage

  • New tests: test/cli/platform.test.ts, test/cli/bin.test.ts, test/vite/node-loader.test.ts, test/native/projectFiles.test.ts, test/native/androidAssets.test.ts, create-catalyst-app/test/new-route.test.ts, plus Windows cases in utils, devOutput, buildErrors and diagnostic.
  • Coverage delta: see coverage-summary in CI.

Before merging




DeputyDev generated PR summary:


Size L: This PR changes include 389 lines and should take approximately 1-3 hours to review


This PR adds native Windows support for Catalyst, so Windows users can develop and build Android/web apps directly from PowerShell, Command Prompt, or Git Bash without WSL.

Main changes

  • Windows-compatible scripts and line endings

    • Adds .gitattributes to keep shell scripts as LF and batch files as CRLF.
    • Handles Windows .cmd/.bat executables correctly when spawning npm and Gradle.
  • Android support on Windows

    • Detects Windows SDK tools such as adb.exe and emulator.exe.
    • Supports Android Studio’s bundled JDK, JAVA_HOME, or a JDK on PATH.
    • Uses gradlew.bat through cmd.exe.
    • Handles SDK paths, project paths, and configuration paths containing spaces or drive letters.
    • Replaces Unix-only commands such as cp, rm, find, mv, rsync, chmod, and sh with Node.js filesystem APIs.
    • Adds Windows process cleanup using taskkill.
    • Uses netstat and tasklist to detect processes occupying development ports.
    • Supports signed Android release bundles.
  • Clear iOS behavior

    • Direct buildApp:ios and setupEmulator:ios commands now fail with the new IOS-002 error on Windows and Linux.
    • Aggregate buildApp and setupEmulator commands skip iOS on non-macOS systems and continue with Android.
    • iOS remains available only on macOS with Xcode.
  • Windows path and module-loading fixes

    • Uses process.cwd() instead of potentially stale PWD on Windows.
    • Converts filesystem paths to file URLs before dynamic imports.
    • Updates Vite and build diagnostics to understand Windows separators, drive letters, and file URLs.
    • Improves parsing of Windows compiler and bundler errors.
  • Create-app and tooling fixes

    • Makes create-catalyst-app work with Windows npm shims.
    • Runs jscodeshift through the current Node executable.
    • Escapes Windows paths correctly in generated MCP configuration.
    • Makes new-route return a nonzero exit code when it fails.
    • Cleans temporary scaffolding directories after failures.
  • Testing and documentation

    • Updates documentation and FAQs to describe native Windows usage.
    • Adds platform-specific unit tests for paths, Gradle, ports, Android project copying, diagnostics, and module loading.
    • Adds a Windows smoke-test script that scaffolds an app in a path containing spaces and parentheses, then tests catalyst start and catalyst serve.

In short, the PR removes many POSIX-shell assumptions, adds Windows-specific process and path handling, and makes Android/web Catalyst workflows work natively on Windows while explicitly preserving macOS as the requirement for iOS.


DeputyDev generated PR summary until 05db5a6

mayansharma and others added 4 commits November 4, 2026 10:05
Adds @Uttkarsh-Srivastava to the contributors on /releases/1.0.0.

---



---



 **DeputyDev generated PR summary:** 



---



**Size XS:** This PR changes include 2 lines and should take
approximately 5-15 minutes to review



---

This PR updates the `1.0.0` release documentation to credit
**Uttkarsh-Srivastava** as a contributor. It adds their username to the
`people` list in the `<Thanks>` component.

No application or functional code is changed.

---

DeputyDev generated PR summary until
ae07a87
## What

New apps from `create-catalyst-app` now start with a redesigned home
page, the animated HTML splash screen from the 1.1.0 release film, and a
restyled offline page. All of it lives in `templates/common`, so every
state and language variant gets it.

- **Starter page** (`containers/Home/`): follows the system light or
dark setting, shows how long the page took to become interactive, and
links to next steps and native hooks. The folder is self-contained, with
fonts and their OFL licences, so deleting it and its route removes the
page.
- **Splash screen**: `public/splashscreen.html` is byte-identical to the
film's file. This adds the native first-frame images for Android and
iOS, and a `WEBVIEW_CONFIG.splashScreen` block in `config.json`.
- **Offline page**: same palette as the starter page, light and dark.
- **Server lifecycle hooks**: `server/index.js` now stubs every hook
core calls, in call order, with what each receives. Previously it only
had `preServerInit`.
- **Docs**: the SSR Lifecycle page showed `export default { ... }`,
which core never reads, and listed three hooks. It and File Conventions
now match the code.
- **Starter route**: `routes/index.js` now loads Home through `split()`.
`RouterDataProvider` only runs `serverFetcher` and `clientFetcher` on
`split()` routes, so with the old plain `component: Home` route the
"Load data" step silently did nothing.
- **`.prettierignore`**: skips the splash file, which embeds generated
logo geometry.

## Why

The page a new app opened on was the first impression of Catalyst and
looked unfinished next to the release films. Splash screens were also
opt-in, so most developers wouldn't discover them.

## Things to review

- **Splash cut short on slow devices.** `minDuration` counts from when
the overlay appears, not from when the HTML starts. On a 2 GB API 36.1
emulator the splash WebView took about 5 seconds to start, and the
overlay was dismissed about 2 to 3 seconds into the animation, so only
the flat mark was visible. This is in `SplashOverlay.kt` and isn't
changed here. Now that the splash is on by default, more apps will hit
it.
- **Seven-second launch by default.** `minDuration` is 7000 so the
sequence finishes. Title and tagline are in by about 5.7 seconds, so it
could come down.
- **Dark splash in light mode.** `backgroundColor` is fixed at
`#0b0a14`, while the page follows the system setting. On a light-mode
device the dark splash will likely cut to a light page. Not tested.
- **Request hooks aren't awaited.** Core calls `onRouteMatch` and the
other request hooks without waiting (`handler.tsx:498`). A sync
`res.redirect` returns 302 and stops the request, but the same redirect
after an `await` returned 200 and then threw `ERR_HTTP_HEADERS_SENT`.
The template and docs say to keep these hooks synchronous; fixing core
is left for another PR.
- **`onServerError` is never called.** Core calls it only if the
`listen` callback receives an error, and Express 4 never passes one. A
taken port is caught by Catalyst's own check first. The hook is left out
of the template, and the docs say it isn't called at the moment.
- **Fetchers on plain routes.** The starter route works now, but
`new-route` still generates plain `component:` routes, and fetchers on
those never run. That needs a core fix in `RouterDataProvider`, not part
of this PR.

## New error codes

- [x] No new error codes

## Test coverage

No new tests. This is template content, and the 27 existing
`create-catalyst-app` tests pass.

Checked by hand:

- Scaffolded a fresh app from the local template and core, built it for
production and ran a cold launch on the Android emulator (`android`, API
35, RAM raised to 4 GB). The full splash played and faded into the page
with no flash.
- Dev and production builds in Chromium, also with Tailwind: no console
or hydration errors in production, and no horizontal scroll at 390, 820
and 1440 px. Hot reload updated the page.

- Hooks: with every hook logging, production and dev both called them in
the documented order, and a sync redirect in `onRouteMatch` returned
302. The template file passes the app's ESLint.

- Starter route via `split()`: a test `serverFetcher` returned data in
the server HTML and after hydration (on the old route it returned
`null`). Production at 390 and 1440 px in light and dark: no console
errors and no horizontal scroll. With JavaScript off the page renders
fully styled. In dev, the page renders on the server and hot reload
updates it without a reload.
- `new-route` transform run against the new routes file: it adds the
route, and both `/` and the new page render.

Not tested: iOS, a physical device, and the Redux, RTK and TypeScript
variants.

---

- [x] `npm run test:unit` passes locally
- [x] `npm run lint` passes locally
- [x] No new raw `throw new Error(...)` in changed files
- [ ] Coverage gate (`coverage-summary`, #415/#437) not regressed
(waiting on CI)


---



---



 **DeputyDev generated PR summary:** 



---



**Size XXL:** This PR changes include 1000+ lines and should take
approximately 6+ hours to review, potentially spread across multiple
sessions



---

This PR updates the default app generated by `create-catalyst-app` with
a more polished first-run experience. The changes are limited primarily
to the shared app template.

### 1. Adds a branded splash screen

- Adds splash-screen configuration:
  - Background: `#0b0a14`
  - Minimum duration: `7000ms`
  - Image size: `144x144`
  - No corner radius
- Adds platform-specific native splash images for Android and iOS.
- Adds an animated `public/splashscreen.html` featuring:
  - The Catalyst logo rendered from canvas geometry
  - 3D extrusion and turbine-like ray animations
  - Glow, sparks, shockwaves, dust, and a flash effect
- The Catalyst title and tagline: “One codebase. Web, iOS and Android.”
  - Device-pixel alignment and iOS safe-area handling
  - Reduced-motion support
  - A special still mode for generating native splash images

### 2. Redesigns the offline page

The offline fallback is changed from a basic dark page to a responsive,
accessible page that:

- Supports light and dark system themes
- Uses updated typography and colors
- Uses dynamic viewport sizing
- Provides visible keyboard focus styles
- Retains the `catalyst://retry` retry action
- Updates the messaging to “You're offline. Check your connection and
try again.”

### 3. Replaces the default starter home page

The previous minimal React welcome screen is replaced with an
onboarding-oriented Catalyst page containing:

- A Catalyst navigation bar with Docs and GitHub links
- A hero message: “Your app is running.”
- Instructions for editing `Home.js`
- Server-rendering and hydration status indicators
- “Build on it” guidance for:
  - Adding a route
  - Loading data
  - Building for Android
- A list of available native React hooks such as `useCamera`,
`useNotification`, `useNetworkStatus`, and `useAI`

### 4. Adds new visual assets and styling

- Adds a reusable animated Catalyst mark in `Mark.js`
- Adds responsive light/dark styling and reduced-motion behavior
- Bundles Inter and JetBrains Mono fonts with their SIL Open Font
licenses
- Adds responsive layouts for desktop and mobile screens

Overall, newly generated Catalyst apps will start with a branded
animated splash screen, a useful starter page for learning the
framework, and a more polished offline experience instead of the
previous generic screens.

---

DeputyDev generated PR summary until
522d85d
Refs #542

## Root cause

The original Android `NativeBridgeAI.buildSystemPrompt()` returned
before reading `options.systemPrompt` whenever attachment components
were missing or empty. App rules were consequently dropped. The runtime
fix already reached main through #503, incorporated into release PR #520
(commit 3b69553); #516 was an earlier release candidate. This PR adds
Android regression coverage for that existing fix rather than
duplicating it.

## Repro

`useAI({ provider: "native", systemPrompt: "Answer only in French." })`
with omitted or empty `attachmentComponents`. Previously the app prompt
never reached generation. Current behavior preserves trimmed app rules
and only adds attachment markup instructions when components exist.

## Change

Extract the existing prompt builder into an internal helper, preserving
prompt text and log messages, so JVM tests can exercise it without
loading the LiteRT engine. The LiteRT artifact contains Java 21 classes,
while the Android CI job uses Java 17; isolating this pure logic lets
these tests run on the existing CI JDK without downloading a model or
starting a device.

Add JUnit tests and run `:catalyst-ai:testDebugUnitTest` in the existing
Android AI compile job. Scope is Android prompt composition; no
JS/iOS/provider changes or new output-format setting.

## Regression test

- [x] Five native JVM tests cover absent/empty components, missing/blank
app prompts, app-plus-attachment instructions, component hints, and
components without an app prompt.
- [x] Temporarily replacing the no-components result with an empty
string reproduces the original defect: both app-prompt preservation
tests fail. Restoring production behavior passes all five tests.

## Validation

- [x] Android `:catalyst-ai:testDebugUnitTest`, JDK 17, using an
isolated Gradle host for the actual library module (AGP 8.11.1, Kotlin
1.9.0, Gradle 8.13).
- [x] `npm test --workspace packages/catalyst-ai`: 56 tests and type
check pass.
- [x] `npm run test:unit`: all workspace suites, MCP tests, and release
tests pass after building core.
- [x] `npm run lint` passes.
- [x] `git diff --check` passes.
- [x] No new raw `throw new Error(...)` in changed files.
- [ ] Coverage gate: pending CI.

Not validated on an Android device or emulator; no model inference run.
The local Android check used an isolated host rather than the full app
scaffold; CI exercises the existing app/module wiring.

## Affected error codes

None.

Signed-off-by: SpideyPotter <reddyravindra290@gmail.com>
…Studio or Xcode (#575)

Closes #508
Closes #302
Closes #301

Design: #569

## What

Android and iOS apps build, run and release from the Catalyst CLI
without opening Android Studio or Xcode. Targets 1.3.0.

```sh
npm run android            # dev build on the emulator (--device for a phone)
npm run ios                # dev build on the simulator (--device for an iPhone)
npm run android:release    # signed AAB
npm run ios:release        # signed IPA
```

- Machine setup runs inside `buildApp`: JDK (Homebrew), Android SDK,
emulator, iOS runtime and simulator are installed only when missing,
after asking. Existing simulators and AVDs are reused.
- Dev server: `buildApp` starts it and waits until it answers. Android
reaches it through `adb reverse`, the iOS simulator on localhost, a
physical iPhone on `<mac>.local`. `config.json` is no longer rewritten;
a one-time migration puts localhost back where the old setup saved this
machine's IP.
- Config: one `WEBVIEW_CONFIG.appId`, `appName` and `url`. Per-platform
keys, `LOCAL_IP`/`port` and `ios.version` keep working. Releases refuse
placeholder ids, malformed ids and local or private hosts. `buildType:
"release"` still works with a deprecation warning.
- Version from `package.json`; build number is minutes since 2024-01-01
UTC, overridable with `CATALYST_BUILD_NUMBER`.
- Release output in `build-output/<platform>/<version>-<build>/`.
Android also writes the upload certificate PEM.
- Credentials live in git-ignored `credentials/<platform>/`. CI needs
one secret per platform, printed by `catalyst credentials:export
<platform>`. The Android upload key is created once in a terminal and
never overwritten.
- People get prompts only in a terminal; the last device pick is kept in
`.catalyst/local.json`. Agents and CI use five flags (`--release`,
`--device`, `--url`, `--yes`, `--accept-licenses`) and never see a
prompt; a missing answer fails with an error naming the flag. `--yes`
never accepts a licence or creates a key.
- create-catalyst-app: the native prompt is gone. Every template gets
`appId`, `appName`, `public/icon.png`, the four npm scripts and
`.gitignore` entries.
- Store upload stays manual.

## Why

Today a native build needs Android Studio or Xcode at several points,
release builds can ship the dev host or the template app id, and Play
rejects our releases: targetSdk 34, a regenerated upload key (#508), 16
KB page size (#302), and SDK installs that break on stale downloads
(#301).

Play Store fixes:
- #508: targetSdk 36, upload key kept in `credentials/android/` and
never deleted or overwritten, PEM exported next to the AAB.
- #302: CameraX 1.3.4 to 1.4.2 and RootBeer 0.1.1 to 0.1.2; ML Kit
barcode 17.3.0 is already aligned on 64-bit. `node
scripts/native-release-check.mjs align <aab>` checks ELF alignment.
- #301: stale `<sdk>/.temp` downloads are cleared and a half-installed
package is retried once; JDK detection is limited to 17 to 23 (Gradle
8.13).

## Breaking changes for existing apps

- An iOS bundle id with an underscore now fails (Apple does not allow
it).
- A release with a placeholder app id or a local/private host fails
instead of shipping.
- Debug builds no longer pick a connected phone automatically; pass
`--device`.
- Unshipped branch-only options (`release` block, `--build-number`,
`--no-sign`, per-value CI env vars) do not exist.

## New error codes

- [x] Introduces new `CatalystError` codes: NATIVE-001 to NATIVE-011,
ANDROID-011, IOS-014, IOS-015. `errors/` docs regenerated and committed.

## Test coverage

- New tests:
`test/native/{nativeConfig,interaction,localState,credentials,androidDevices,androidElfAlignment}.test.ts`,
`create-catalyst-app/test/appIdentity.test.ts`; Android/iOS toolchain
and signing tests rewritten.
- catalyst-core 791 tests, create-catalyst-app 49, mcp_v2 44 pass.

Tested on a sandbox app from this branch (macOS, Xcode 26.0.1, JDK 17):
- `npm run android` on the emulator: app loads from the dev server, adb
reverse on 3005 and 24678, config.json untouched.
- `npm run ios` on the simulator: reuses the existing iPhone 17 Pro, app
loads from localhost.
- `npm run android:release` in a terminal: key created, AAB signed
(`jarsigner -verify`), PEM written; again from
`CATALYST_ANDROID_CREDENTIALS` with the same key.
- 16 KB check passes on the real AAB for every 64-bit library.
- Release guards: NATIVE-001, NATIVE-003, ANDROID-005, IOS-010 fire as
expected.

Not yet tested: signed iOS IPA, physical iPhone over `.local`, Android
USB phone, the store dry-run (docs:
`08-Deployment/04-Releasing-a-Full-App.md`), the error-catalog native
scenarios and the docs site build.

---

- [x] `npm run test:unit` passes locally
- [x] `npm run lint` passes locally
- [ ] No new raw `throw new Error(...)` in changed files (the diff adds
some in native setup paths)
- [ ] Coverage gate not checked locally
@deputydev-agent

Copy link
Copy Markdown

DeputyDev has started reviewing your pull request.

mayan-sharma and others added 2 commits November 5, 2026 17:51
Catalyst only ran on macOS, Linux and WSL. On native Windows
create-catalyst-app died packing its templates, every catalyst command
threw on process.env.PWD, and the Android build needed sh, rsync, find
and ./gradlew. create-catalyst-app, start, build, serve, plugins,
setupEmulator:android and buildApp:android, including signed release
bundles, now work in PowerShell, Command Prompt and Git Bash.

iOS still needs a Mac. buildApp and setupEmulator skip iOS elsewhere and
carry on with Android, and the :ios commands exit with the new IOS-002.

Web:
- node-loader's dependency check only knew "/", so on Windows it took
  every dependency for an app file and the build ran out of memory
- appRoot() replaces process.env.PWD, which is unset or stale on Windows
- --import and import() take file URLs, as a C:\ path reads as a scheme
- optimizeDeps entries are relative globs: absolute ones carried
  backslashes into the pattern and the scanner missed dependencies
- diagnostics read Windows paths: drives, file:///C:/ URLs, %20
- a taken port names its owner from netstat and tasklist

Android:
- adb, emulator and gradlew.bat run with quoting that survives spaces
  and parentheses in the SDK and app paths, on every platform
- the signed build and asset copy use fs instead of find, mv, rsync, rm
  and cp (projectFiles.js)
- Gradle runs without a lasting daemon on Windows: an idle one holds
  node_modules open, so npm install fails with EBUSY, and the signed
  build could not remove its temp copy
- the LAN IP comes from the default route, not a virtual adapter
- Android Studio's bundled JDK is found when java is not on PATH

create-catalyst-app:
- npm and jscodeshift no longer fail with EINVAL from spawning .cmd files
- new-route exits non-zero on failure, and its redux and rtk templates no
  longer crash the app with a ReferenceError (on any platform)
- a failed scaffold removes its temp-* folder
- the MCP config snippet escapes backslashes so it pastes as valid JSON

Repo:
- npm install works: prepare no longer uses cp -r or single quotes
- .gitattributes keeps every checkout LF, so gradlew and the husky hooks
  stay runnable, and gradlew.bat CRLF
- a windows-latest CI job runs the unit suites and a real scaffold,
  build, start and serve from a path with a space and parentheses
- the error-catalog harness runs on Windows too
listAvds built a shell command line from the SDK path, which comes from
config or the environment. Run the emulator with execFileSync and an
argument list instead, so the path is never parsed by a shell.
Addresses the CodeQL indirect uncontrolled command line alert.
@deputydev-agent

Copy link
Copy Markdown

DeputyDev has completed a review of your pull request for commit 05db5a6.

…reach

- skip adb serials with anything but letters, digits and . _ : - before
  they go into adb and Gradle command lines
- run the signed bundleRelease through runGradle with an argument list,
  so a quote, $ or % in a keystore path or password is not read by a shell
- findFiles returns regular files only, as find -type f did, so a later
  write never follows a symlink out of the project
- buildApp:ios loads config after the platform check, so off macOS a
  missing config still reports IOS-002
Brings in the 1.2.0 native build (#575), the new starter page (#585) and
the rest of the release, and carries the Windows support over to it.

Conflicts:
- IOS-002 was taken by both. 1.2.0 keeps it for "Full Xcode is not
  installed or selected"; "iOS builds need macOS and Xcode" moves to
  IOS-007. buildApp:ios checks the platform after the config is resolved,
  so config errors still show on Linux and Windows, and only the IOS-000
  error-catalog scenario is macOS-only.
- Gradle runs through runGradle (gradlew.bat on Windows) in the debug and
  signed builds, with 1.2.0's version and signing values passed in env.
- The project copy and renames keep the fs-based projectFiles code instead
  of find, rsync, cp -r and rm -rf.
- SDK tool paths keep .exe on Windows, and detached spawns hide their
  console window.

1.2.0's new toolchain on Windows:
- the JDK lookup finds Android Studio's JBR and a java on PATH, so
  exposeJavaOnPath is gone
- sdkmanager and avdmanager are batch files there and go through cmd.exe
- the cmdline-tools zip is unpacked with Windows' own tar
- a new SDK goes to %LOCALAPPDATA%\Android\Sdk, where Android Studio
  puts it

Tests:
- the build copy is projectFiles.copyWebBuild
- the loader's node_modules check is dependencyPath.mjs, tested with
  literal Windows paths so it fails on any OS if the bug comes back
mayansharma and others added 11 commits November 5, 2026 18:53
…kip off macOS

- batchInvocation refuses a path or argument with % or a quote or line
  break, which cmd.exe reads as syntax even inside quotes, and names
  cmd.exe rather than taking ComSpec from the environment. The paths come
  from config and the environment (SDK location, project folder).
- gradleCommandLine is gone: nothing builds a Gradle command string now.
- nativeFlags.test.ts expects bare buildApp and setupEmulator to run only
  Android off macOS, and ignores the skip line the bin prints there.
…le APKs (#595)

Makes native builds work for people without a technical background: no
JSON editing for a first release, iOS releases with no signing files on
a Mac that already has what it needs, and APKs to share.

## What

- **Ask once, save.** A release run in a terminal asks for a missing or
placeholder app id and a missing https website, and saves them to
`config/config.json`. CI and agents get the same NATIVE-003 / NATIVE-001
errors as before and nothing is written.
- **Per-platform id wins.** `android.packageName`,
`ios.bundleIdentifier` or `ios.appBundleId` wins over
`WEBVIEW_CONFIG.appId`, so the two stores can use different ids. iOS
keeps both iOS keys equal.
- **iOS signing from what the Mac has.** Release order:
`credentials/ios` .p12, `ios.provisioningProfile`, App Store Connect API
key, an installed App Store profile for this exact app id whose
certificate is in the keychain, then the Apple account signed in to
Xcode. The team comes from the profile or from Xcode; with several Xcode
teams the terminal asks once and saves `ios.developmentTeam` (CI uses it
for that build only). Personal teams are skipped for store builds.
- **Right certificate for an installed profile.** The archive signs with
the certificate the profile lists, not whichever distribution
certificate Xcode finds first.
- **Plain signing errors.** IOS-010 includes Xcode's own line (for
example a bundle id mismatch) and says to sign in to Xcode.
- **Shareable APKs.** `npm run android` writes
`build-output/android/debug/<App>-debug.apk` (or `-debug-devserver.apk`
when it loads this computer's dev server). `npm run android:release`
writes a signed `<App>.apk` next to the AAB. `build-output/` carries its
own `.gitignore`.
- **LOCAL_IP as before 1.2.0.** A debug build loads `LOCAL_IP` when it
is a real host, public or private (VPN or LAN staging), with no dev
server and no port forwarding. The LAN migration only rewrites this
machine's current addresses.
- Docs, error pages and the MCP tools updated; "1.3.0" mentions changed
to 1.2.0.

## Tested

On a Mac with Xcode 26 and JDK 17, in an app created from 1.2.0-canary.2
with this build:
- `npm run ios:release` with no `provisioningProfile` or
`developmentTeam`: picked the installed App Store profile and its team;
`codesign --verify` passes.
- `npm run android:release` from a placeholder app id in a terminal:
asked once, saved the id, wrote the AAB (`jarsigner` verified) and a
universal APK (`apksigner` verified, same upload certificate as the
PEM).
- `npm run android` with a public `LOCAL_IP`: loaded that site, wrote
the debug APK, no port forwarding.

Not tested here: a company team signed in to Xcode (this Mac has only a
personal team) and the .p12 path in CI; both have unit tests.

## Checks

- [x] `npm run test:unit` passes locally (catalyst-core 944, mcp_v2 47,
release tests)
- [x] `npm run lint` passes locally
- [x] Aggregate line coverage 97.01% (gate 95.38%)
- [x] No new error codes; IOS-010 hint and details updated in the
registry and `errors/`


---



---



 **DeputyDev generated PR summary:** 



---



**Size XXL:** This PR changes include 1000+ lines and should take
approximately 6+ hours to review, potentially spread across multiple
sessions



---

This PR makes Catalyst’s native build and release flow more self-service
and produces APKs that can be shared for testing.

### Main changes

- **Interactive release configuration**
- A release run in a terminal asks for a missing or placeholder app ID.
- It also asks for a valid HTTPS website when the production URL is
missing, local, or private.
- Answers are validated and saved back to `config/config.json`, so
subsequent builds do not ask again.
- CI and other non-interactive runs never prompt or modify
configuration; they continue to fail with the existing
`NATIVE-001`/`NATIVE-003` errors.
  - `--url` remains a one-build override and is not persisted.

- **Changed app ID precedence**
- Android’s `WEBVIEW_CONFIG.android.packageName` now overrides the
shared `appId`.
- On iOS, `ios.bundleIdentifier` takes precedence, followed by
`ios.appBundleId`, then the shared `appId`.
- Validation and interactive prompts target whichever platform-specific
value actually wins.

- **Shareable Android debug APKs**
- Every Android debug run now copies the generated APK to
`build-output/android/debug/`.
  - Builds that load a configured real host use `<App>-debug.apk`.
- Builds that use the local development server use
`<App>-debug-devserver.apk`.
- The APK is retained even if installation fails after Gradle has
packaged it.
  - The output is ignored by Git and is overwritten on later runs.

- **APK generation for Android releases**
  - `android:release` now creates both:
    - `<App>.aab` for Google Play
    - `<App>.apk` for test-device installation
- Both are signed with the same upload key, and `upload_certificate.pem`
is still emitted.
  - Release folders now refuse to overwrite an existing AAB or APK.
- The release APK is for testing only and cannot be uploaded as the Play
Store bundle. It also will not install over a Google Play-installed copy
without uninstalling it first.

- **More flexible iOS signing**
- On a Mac, signing files in `credentials/ios/` are no longer always
required.
  - Signing is attempted in this order:
    1. A `.p12` and provisioning profile
    2. The configured installed `ios.provisioningProfile`
    3. An App Store Connect API key
4. A matching App Store provisioning profile already installed on the
Mac
    5. An Apple account signed in to Xcode
- Installed profiles are checked against the bundle ID, expiration date,
signing certificate, team, and push-notification entitlement where
applicable.
- If Xcode has multiple usable teams, the CLI asks which one to use and
saves the selected team as `ios.developmentTeam` when running
interactively.
- CI still uses credentials supplied through `credentials/ios/` or
`CATALYST_IOS_CREDENTIALS`.
  - iOS signing errors now include the relevant Xcode diagnostic line.

- **More useful `LOCAL_IP` behavior**
- `WEBVIEW_CONFIG.LOCAL_IP` can now point to a real public, VPN, or LAN
staging host.
- Debug builds load that host directly instead of the development
server.
- `localhost`, loopback addresses, `0.0.0.0`, and the Mac’s own
addresses still use the development server.
- Android only runs `adb reverse` when the build is using the local dev
server.
- The old migration now resets only addresses belonging to the current
machine, preserving private staging-server addresses.

The documentation, CLI flow descriptions, error messages, MCP knowledge
base, and extensive tests are updated to reflect these behaviors. Store
uploading remains a manual step.

---

DeputyDev generated PR summary until
95884a3
…ates (#599)

Fixes found in the end-to-end test of 1.2.0-canary.3, plus the docs and
MCP server updates 1.2.0 needs before release.

## Code

- A private `LOCAL_IP` that equals `NODE_SERVER_HOSTNAME` is treated as
the LAN address this machine had on another network, and the one-time
migration puts localhost back. Before, it survived the upgrade and the
dev server could not bind it.
- `npm run start` on an address this machine does not have printed an
uncaught `EADDRNOTAVAIL` and hung. It now prints the usual diagnostic
with a hint naming `NODE_SERVER_HOSTNAME` and exits 1. Express 4 never
passed bind errors to the listen callback, so the old error branch never
ran.
- The `config.json` migration is printed by default instead of only with
`--verbose`.
- `body-parser` floor raised to `^1.20.9` (GHSA-27r3-jxmh-p828).
- IOS-010 says "no App Store provisioning profile for <bundle id> is
installed" when that is the cause, before the other options.
- A release that signs with an auto-picked installed App Store profile
saves it as `ios.provisioningProfile` when run in a terminal, so a newer
profile installed later does not change the signing silently. In CI it
is used for that build only.

## Docs

- Version Upgrades: "Upgrading From 1.1.x To 1.2.0" with the new
scripts, the config rewrite, the breaking changes and the signing files.
- `changelog.md`: 1.2.0 entry (dated Unreleased; set the date on
release).
- Cache Management examples use the `--release` scripts instead of
`buildType`, which core never read.
- Running Universal Apps and FAQs: how to fix a stale LAN address by
hand.
- Configuration reference: `appInfo` is optional.

## MCP server

- Task plans accept `npm run android`, `ios`, `android:release` and
`ios:release`.
- Conversion checks depend on the installed version: 1.2.0 apps need the
four new scripts and `appId`/`appName`/`url`, not `setupEmulator:*`.
- `check_config` no longer reports errors on a fresh 1.2.0 app
(`API_URL`, `appInfo`, `accessControl`), and warns about a stale private
`LOCAL_IP`.
- Knowledge base entries describe the new flow; adds a 1.1.x to 1.2.0
upgrade entry. Installed MCP servers get it after #592 reaches main.

## Testing

- vitest: native, server, cli and errors suites (811), mcp_v2 (74);
types and lint clean; coverage 97.01% against the 95.38% gate.
- Real `catalyst start` with `NODE_SERVER_HOSTNAME=10.255.255.1`:
diagnostic and exit 1; normal start on localhost still serves 200.
- Not run: a real iOS release build with this branch (signing changes
are covered by unit tests).

## Notes

- The migration runs once per checkout. Apps that already ran a 1.2.0
canary do not get the new leftover-IP rule; releases from 1.1.x do.


---



---



 **DeputyDev generated PR summary:** 



---



**Size XXL:** This PR changes include 1000+ lines and should take
approximately 6+ hours to review, potentially spread across multiple
sessions



---

This PR prepares Catalyst 1.2.0 for native Android/iOS release by
improving the CLI workflow, migration behavior, signing diagnostics,
documentation, and MCP conversion tooling.

### Main changes

- **Simplifies native commands**
  - Adds/documented one-step scripts:
    - `npm run android`
    - `npm run ios`
    - `npm run android:release`
    - `npm run ios:release`
- Debug commands can install missing tooling, start the dev server,
build, install, and launch the app.
  - Release commands produce signed Android and iOS artifacts.
- Existing `buildApp:*` and `setupEmulator:*` scripts remain supported;
older apps use `-- --release` for release builds.

- **Introduces the 1.2.0 app configuration model**
- Native apps use top-level `WEBVIEW_CONFIG.appId`, `appName`, and
`url`.
- Platform-specific identifiers such as `android.packageName` and
`ios.bundleIdentifier` still override `appId`.
- Release builds validate placeholder app IDs and unreachable URLs,
prompting for missing values in an interactive terminal.
- iOS bundle IDs containing underscores are now rejected with
`NATIVE-010`.
  - `appInfo` is now optional and treated as free-form metadata.

- **Deprecates native `buildType` configuration**
  - The command determines whether a build is debug or release.
- `cachePattern` documentation is corrected: Android uses a
comma-separated string, while iOS uses an array.
- Existing `buildType` settings continue to work temporarily with a
deprecation warning.

- **Fixes stale LAN address handling**
- The first 1.2.0 debug build can rewrite old LAN addresses in
`config/config.json` back to `localhost`.
- It also detects stale private addresses saved in both `LOCAL_IP` and
`NODE_SERVER_HOSTNAME`, even if the machine is now on another network.
- The migration skips releases, CI, and configurations using
`allowPrivateHost`.
- Documentation and FAQ guidance is added for manually correcting stale
IP addresses.

- **Improves server and iOS signing errors**
- Server bind failures such as `EADDRNOTAVAIL` now produce a clear
diagnostic identifying `NODE_SERVER_HOSTNAME` and exit cleanly.
- iOS builds can reuse an installed App Store provisioning profile and
save the selected profile interactively.
- `IOS-010` now explains when the required App Store profile is missing
and suggests concrete remedies.

- **Updates MCP conversion and validation tools**
- Makes native-script requirements version-aware: 1.2.0 apps are checked
for the four new scripts, while older apps retain legacy requirements.
- Stops incorrectly requiring `API_URL`, `appInfo`, or a
disabled/missing access-control block.
- Still validates the configuration keys required by Catalyst’s server.
  - Adds checks for stale LAN addresses and invalid iOS bundle IDs.
- Updates MCP knowledge-base content, command validation, conversion
tasks, and tests.

- **Other release-readiness updates**
  - Raises `body-parser` to `^1.20.9`.
- Documents credential storage under `credentials/android` and
`credentials/ios`.
  - Records Android API 36 and 16 KB memory-page compatibility.
- Expands upgrade guides, FAQs, changelog entries, and native error
documentation.

In short, the PR makes 1.2.0’s native build/release process more
CLI-driven and reliable, preserves backward compatibility for older
projects, and aligns the documentation and MCP migration tooling with
the new behavior.

---

DeputyDev generated PR summary until
07ec567
…pt (#608)

Fixes found building 1.2.0-canary.4 on a physical iPhone.

## Changes

- **Dev server blocked the iPhone (403).** The build passed the Mac's
Bonjour name to Vite's `server.allowedHosts` as macOS returns it, e.g.
`G206F1WHVF.local`. WebKit sends the Host header lowercased and Vite
compares exactly, so the phone got "Blocked request. This host is not
allowed". The `.local` name is now lowercased everywhere it is used.
- **iPhone debug builds sign from config.** Set `ios.developmentTeam`,
and `ios.provisioningProfile` to use an installed development profile.
No team lookup or prompt is added. Without a team, IOS-010 names those
keys; with a profile set, it says what to check (the profile includes
this iPhone, matches the bundle id, certificate in the keychain).
Release signing is unchanged (`buildAppIos.js` is identical to
release/1.2.0).
- **One Keychain prompt instead of three.** Xcode splits a Debug app
into the app, `<App>.debug.dylib` and `__preview.dylib` for Previews and
signs each. Debug builds now set `ENABLE_DEBUG_DYLIB=NO`. Release
archives are unchanged.
- **Docs.** Running Universal Apps: physical iPhone config example,
Local Network access, Keychain "Always Allow". iOS release guide:
IOS-010 as it behaves now. Android release: a release APK shows a
Security Alert on an emulator; `android.security.mode: "custom"` skips
it for testing.

## Testing

- vitest native, server, cli, errors: 815 passed; vite config tests
18/18; types and lint clean; coverage 97.01% (gate 95.38%).
- Real iPhone 17 Pro Max (iOS 26.6.1) with this branch and the config
above: builds, installs, loads `http://g206f1whvf.local:3005`; the dev
server answers 200 to the lowercase host; the built .app has no debug or
preview dylibs.
- Earlier commit on this branch, same code paths: iOS simulator, Android
debug, web start/build/serve, TTY ask-once release prompt,
`credentials:export` + `CATALYST_ANDROID_CREDENTIALS` release, release
APK on emulator, `buildApp:ios` and `setupEmulator:ios` on an app
upgraded from 1.0.0.
Brings in #595, #599, #608 and the 1.2.0 release commit. Conflicts were
imports only (both sides added some), plus the changelog, where the dated
1.2.0 entry stays and the Windows notes sit above it as Unreleased, with
the macOS-only error named IOS-007.
main is the squashed release/1.2.0, whose final tree was merged in the
previous commit, so there is nothing left to take from it.
Coverage is measured on imported files only, and the new-route test
brought the codemod in with most of it untested, which put the total
under the 1.2.0 baseline (96.95%).

- new-route: tests for path and name validation, toCamelCase, the routes
  file check, creating and discarding the folder, and the component and
  redux reducer templates. Removes a stray identifier from validatePath.
- androidToolchain: defaultSdkPath on Windows, and unzipArchive (now
  injectable) with unzip, System32 tar and tar from PATH.
- utils: batch files go through cmd.exe on Windows, other programs do not.
- preflight: runStaticPreflightOrExit exits 1 with every problem listed,
  returns for a valid app, and defaults to appRoot().
One conflict, in buildAndroid/index.js: #610 marked the old
path.join(sdkPath, "platform-tools", "adb") line with nosemgrep, and this
branch replaced that line with androidTools(), which adds .exe on Windows.
…ows in the Android setup docs

- credentials.js packs and unpacks with System32's tar on Windows. Git's
  GNU tar, often first on PATH there, reads the C: of an absolute path as
  a remote host name, so CI secrets and credentials:export failed with it.
- The Android setup page lists Windows as a prerequisite and says where
  the JDK and SDK are found there. Backslashes in its code spans were
  doubled, which code spans show as they are.
22 tests failed on Windows 11. None of them were product bugs:
- path.resolve adds a drive letter, and path.join gives backslashes,
  so expectations and fake tool paths are built the same way the code builds them
- the ensureAndroidSdk fixtures write POSIX tool names, so they pin
  platform linux, and a lookup miss can no longer fall through to the
  real cmdline-tools download (two tests timed out doing that)
- file modes (0o600, 0o700) are POSIX only, and chmod cannot make a
  Windows folder read-only, so those checks skip there
- a file in place of a folder is ENOENT on Windows, ENOTDIR elsewhere
- the stale dev server hint is taskkill on Windows

The ANDROID-009 messages name the cmdline-tools folder with path.join,
so there are no mixed separators on Windows.
…kes -p and -c

From the Windows 11 test run:
- resolveJavaHome also looks in the folders the Microsoft, Adoptium, Zulu
  and Oracle installers use, newest first. A JDK installed there is on
  PATH only in a new terminal, so the build missed one that was installed.
- The ANDROID-007 hint names the Windows install (Android Studio, or
  winget install Microsoft.OpenJDK.17) and says the --yes install is
  macOS only.
- new-route read its options the commander 7 way and was never passed
  them, so -p and -c were ignored and it always asked. They now work, and
  an invalid value exits 1.
… server on Windows

From the Windows 11 run:
- A batch file's %1..%9 and %* split an argument at ; , and =, so
  sdkmanager.bat received platforms;android-36 as two arguments and
  installed nothing. quoteWindowsArg quotes those too. Found and verified
  on Windows: setupEmulator:android --yes now installs android-36 and
  build-tools 36.0.0.
- On Windows the dev server a build leaves running keeps node_modules
  locked, so npm install fails with EBUSY. The build now says how to stop
  it, and taskkill hints stop the whole tree (/T), as catalyst start runs
  the server in a child process.
Found on Windows 11 with the emulator: the app showed "Webpage not
available ... net::ERR_EMPTY_RESPONSE". Windows resolves localhost to ::1
first, so catalyst start listened on [::1]:3005 alone, and adb reverse
dials the host side on 127.0.0.1.

For Android, ensureDevServer now starts the dev server with
NODE_SERVER_HOSTNAME 127.0.0.1 and waits for 127.0.0.1 to answer. A dev
server already running that answers on localhost but not 127.0.0.1 (one
started with npm start on Windows) stops the build with NATIVE-006 and
says how to fix it, rather than being reused. The iOS simulator reaches
::1 and keeps its behaviour.

Verified on the Windows emulator: the app renders the home page.
On macOS localhost also binds ::1 alone, and adb reverse reaches it
there, so the Android build has always worked with a localhost dev
server. Requiring 127.0.0.1 everywhere would have refused a dev server a
Mac user started with npm start. Only Windows, where adb dials 127.0.0.1,
gets the IPv4 server and the NATIVE-006 check; macOS and Linux keep the
1.2.0 behaviour.
# Conflicts:
#	.release-meta.json
#	packages/catalyst-core/changelog.md

This branch has not been deployed

No deployments
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.

4 participants