| author | |
| committer | |
| log | b5a62504d4f15aa6f6ef4313d5914b485fa64ea4 |
| tree | 3548d05508c2cc85cd4beec8f0082104d71aee7e |
| parent | ec18938bf9be0a4ab682484812dc85395bfed133 |
4 files changed, 136 insertions(+), 136 deletions(-)
apps/mobile/README.md created+98| ... | ... | @@ -0,0 +1,98 @@ |
| 1 | # T3 Code Mobile | |
| 2 | ||
| 3 | > [!WARNING] | |
| 4 | > T3 Code Mobile is currently in development and is not distributed yet. If you want to try it out, you can build it from source. | |
| 5 | ||
| 6 | ## Quickstart | |
| 7 | ||
| 8 | > [!NOTE] | |
| 9 | > Uses native modules so using Expo Go is not supported. You need to use the Expo Dev Client. | |
| 10 | ||
| 11 | This app has three variants: | |
| 12 | ||
| 13 | - `development`: Expo dev client, installable side-by-side as `T3 Code Dev` | |
| 14 | - `preview`: persistent internal preview build, installable side-by-side as `T3 Code Preview` | |
| 15 | - `production`: store/release build as `T3 Code` | |
| 16 | ||
| 17 | Run commands from `apps/mobile`. | |
| 18 | ||
| 19 | T3 Cloud is optional and disabled in a fresh clone. Public configuration belongs in the | |
| 20 | repository-root `.env` or `.env.local`, not an `apps/mobile/.env` file. See | |
| 21 | [`../../.env.example`](../../.env.example). | |
| 22 | ||
| 23 | ## Development | |
| 24 | ||
| 25 | Start Metro for the dev client: | |
| 26 | ||
| 27 | ```bash | |
| 28 | vp run dev:client | |
| 29 | ``` | |
| 30 | ||
| 31 | Build and run the local iOS dev client: | |
| 32 | ||
| 33 | ```bash | |
| 34 | vp run ios:dev | |
| 35 | ``` | |
| 36 | ||
| 37 | Build and run the local iOS preview app: | |
| 38 | ||
| 39 | ```bash | |
| 40 | vp run ios:preview | |
| 41 | ``` | |
| 42 | ||
| 43 | Force the review diff highlighter engine: | |
| 44 | ||
| 45 | ```bash | |
| 46 | EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript vp run ios:dev | |
| 47 | ``` | |
| 48 | ||
| 49 | `javascript` is the default and recommended setting for the review diff screen. Set `EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=native` only when you explicitly want to test the native Shiki engine. | |
| 50 | ||
| 51 | Inspect the resolved Expo config for a variant: | |
| 52 | ||
| 53 | ```bash | |
| 54 | vp run config:dev | |
| 55 | vp run config:preview | |
| 56 | ``` | |
| 57 | ||
| 58 | Run static checks for mobile native code: | |
| 59 | ||
| 60 | ```bash | |
| 61 | node ../../scripts/mobile-native-static-check.ts | |
| 62 | ``` | |
| 63 | ||
| 64 | The native lint task runs SwiftLint for Swift plus ktlint and detekt for Kotlin. Missing native tools are reported as warnings and skipped locally. CI installs the default toolset from `apps/mobile/Brewfile` before running the native checks. | |
| 65 | ||
| 66 | ## EAS Builds | |
| 67 | ||
| 68 | CI uses Expo fingerprinting with the `preview:dev` profile to reuse an existing compatible build when possible, or start a new internal EAS build when native runtime inputs change. Production and default local builds continue to use the `appVersion` runtime policy. | |
| 69 | ||
| 70 | For preview or production EAS environments, set `T3CODE_CLERK_PUBLISHABLE_KEY`, | |
| 71 | `T3CODE_CLERK_JWT_TEMPLATE`, and `T3CODE_RELAY_URL` | |
| 72 | as EAS environment variables. Expo config maps the canonical values into the mobile build. | |
| 73 | ||
| 74 | Create a PR preview dev-client build manually: | |
| 75 | ||
| 76 | ```bash | |
| 77 | vp run eas:ios:preview:dev | |
| 78 | ``` | |
| 79 | ||
| 80 | Create a cloud dev-client build: | |
| 81 | ||
| 82 | ```bash | |
| 83 | vp run eas:ios:dev | |
| 84 | ``` | |
| 85 | ||
| 86 | Create a persistent preview build: | |
| 87 | ||
| 88 | ```bash | |
| 89 | vp run eas:ios:preview | |
| 90 | ``` | |
| 91 | ||
| 92 | Android equivalents: | |
| 93 | ||
| 94 | ```bash | |
| 95 | vp run eas:android:dev | |
| 96 | vp run eas:android:preview:dev | |
| 97 | vp run eas:android:preview | |
| 98 | ``` |
apps/mobile/modules/t3-terminal/README.md created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | # T3 Mobile Terminal Native Module | |
| 2 | ||
| 3 | This local Expo module owns the native terminal surface for the mobile app. | |
| 4 | ||
| 5 | The JavaScript contract is intentionally small: | |
| 6 | ||
| 7 | - input from the native surface is emitted as `{ data: string }` | |
| 8 | - resize from the native surface is emitted as `{ cols: number, rows: number }` | |
| 9 | - remote PTY output is delivered by the existing `WsRpcClient.terminal` RPC stream | |
| 10 | ||
| 11 | The iOS implementation uses the vendored `GhosttyKit.xcframework` built from the Ghostty custom-I/O | |
| 12 | fork, with T3's iOS 16 compatibility patch applied. `T3TerminalView` owns a `libghostty` surface and | |
| 13 | uses that callback I/O model: | |
| 14 | ||
| 15 | 1. initialize libghostty once for the process | |
| 16 | 2. create one Ghostty app and surface per native view | |
| 17 | 3. feed remote output into the surface with `ghostty_surface_feed_data` | |
| 18 | 4. send user input back to JS with the write callback | |
| 19 | 5. emit Ghostty's measured terminal size through `onResize` | |
| 20 | ||
| 21 | Android currently implements the same view name (`T3TerminalSurface`) and event payloads so the | |
| 22 | React Native screen and RPC code stay platform-neutral. The renderer backend can be replaced with a | |
| 23 | future Android Ghostty build without changing JS. | |
| 24 | ||
| 25 | Vendored Ghostty revision and license details are in `THIRD_PARTY_NOTICES.md`. | |
| 26 | ||
| 27 | ## Rebuilding GhosttyKit | |
| 28 | ||
| 29 | The checked-in `GhosttyKit.xcframework` is built from the Ghostty custom-I/O fork (https://github.com/Yash-Singh1/ghostty/tree/custom-io). | |
| 30 | Set the directory to the cloned repository checked out on the `custom-io` branch to `GHOSTTY_SOURCE_DIR`. | |
| 31 | ||
| 32 | ```bash | |
| 33 | apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh | |
| 34 | ``` | |
| 35 | ||
| 36 | The script builds Ghostty with Zig 0.15.2, strips the iOS archives, and replaces only the | |
| 37 | `ios-arm64` and `ios-arm64-simulator` slices. Xcode's Metal toolchain must be installed; if `metal` | |
| 38 | fails, run `xcodebuild -downloadComponent MetalToolchain`. |
docs/mobile/app.md deleted-98| ... | ... | @@ -1,98 +0,0 @@ |
| 1 | # T3 Code Mobile | |
| 2 | ||
| 3 | > [!WARNING] | |
| 4 | > T3 Code Mobile is currently in development and is not distributed yet. If you want to try it out, you can build it from source. | |
| 5 | ||
| 6 | ## Quickstart | |
| 7 | ||
| 8 | > [!NOTE] | |
| 9 | > Uses native modules so using Expo Go is not supported. You need to use the Expo Dev Client. | |
| 10 | ||
| 11 | This app has three variants: | |
| 12 | ||
| 13 | - `development`: Expo dev client, installable side-by-side as `T3 Code Dev` | |
| 14 | - `preview`: persistent internal preview build, installable side-by-side as `T3 Code Preview` | |
| 15 | - `production`: store/release build as `T3 Code` | |
| 16 | ||
| 17 | Run commands from `apps/mobile`. | |
| 18 | ||
| 19 | T3 Cloud is optional and disabled in a fresh clone. Public configuration belongs in the | |
| 20 | repository-root `.env` or `.env.local`, not an `apps/mobile/.env` file. See | |
| 21 | [`../../.env.example`](../../.env.example). | |
| 22 | ||
| 23 | ## Development | |
| 24 | ||
| 25 | Start Metro for the dev client: | |
| 26 | ||
| 27 | ```bash | |
| 28 | vp run dev:client | |
| 29 | ``` | |
| 30 | ||
| 31 | Build and run the local iOS dev client: | |
| 32 | ||
| 33 | ```bash | |
| 34 | vp run ios:dev | |
| 35 | ``` | |
| 36 | ||
| 37 | Build and run the local iOS preview app: | |
| 38 | ||
| 39 | ```bash | |
| 40 | vp run ios:preview | |
| 41 | ``` | |
| 42 | ||
| 43 | Force the review diff highlighter engine: | |
| 44 | ||
| 45 | ```bash | |
| 46 | EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=javascript vp run ios:dev | |
| 47 | ``` | |
| 48 | ||
| 49 | `javascript` is the default and recommended setting for the review diff screen. Set `EXPO_PUBLIC_REVIEW_HIGHLIGHTER_ENGINE=native` only when you explicitly want to test the native Shiki engine. | |
| 50 | ||
| 51 | Inspect the resolved Expo config for a variant: | |
| 52 | ||
| 53 | ```bash | |
| 54 | vp run config:dev | |
| 55 | vp run config:preview | |
| 56 | ``` | |
| 57 | ||
| 58 | Run static checks for mobile native code: | |
| 59 | ||
| 60 | ```bash | |
| 61 | node ../../scripts/mobile-native-static-check.ts | |
| 62 | ``` | |
| 63 | ||
| 64 | The native lint task runs SwiftLint for Swift plus ktlint and detekt for Kotlin. Missing native tools are reported as warnings and skipped locally. CI installs the default toolset from `apps/mobile/Brewfile` before running the native checks. | |
| 65 | ||
| 66 | ## EAS Builds | |
| 67 | ||
| 68 | CI uses Expo fingerprinting with the `preview:dev` profile to reuse an existing compatible build when possible, or start a new internal EAS build when native runtime inputs change. Production and default local builds continue to use the `appVersion` runtime policy. | |
| 69 | ||
| 70 | For preview or production EAS environments, set `T3CODE_CLERK_PUBLISHABLE_KEY`, | |
| 71 | `T3CODE_CLERK_JWT_TEMPLATE`, and `T3CODE_RELAY_URL` | |
| 72 | as EAS environment variables. Expo config maps the canonical values into the mobile build. | |
| 73 | ||
| 74 | Create a PR preview dev-client build manually: | |
| 75 | ||
| 76 | ```bash | |
| 77 | vp run eas:ios:preview:dev | |
| 78 | ``` | |
| 79 | ||
| 80 | Create a cloud dev-client build: | |
| 81 | ||
| 82 | ```bash | |
| 83 | vp run eas:ios:dev | |
| 84 | ``` | |
| 85 | ||
| 86 | Create a persistent preview build: | |
| 87 | ||
| 88 | ```bash | |
| 89 | vp run eas:ios:preview | |
| 90 | ``` | |
| 91 | ||
| 92 | Android equivalents: | |
| 93 | ||
| 94 | ```bash | |
| 95 | vp run eas:android:dev | |
| 96 | vp run eas:android:preview:dev | |
| 97 | vp run eas:android:preview | |
| 98 | ``` |
docs/mobile/terminal-native-module.md deleted-38| ... | ... | @@ -1,38 +0,0 @@ |
| 1 | # T3 Mobile Terminal Native Module | |
| 2 | ||
| 3 | This local Expo module owns the native terminal surface for the mobile app. | |
| 4 | ||
| 5 | The JavaScript contract is intentionally small: | |
| 6 | ||
| 7 | - input from the native surface is emitted as `{ data: string }` | |
| 8 | - resize from the native surface is emitted as `{ cols: number, rows: number }` | |
| 9 | - remote PTY output is delivered by the existing `WsRpcClient.terminal` RPC stream | |
| 10 | ||
| 11 | The iOS implementation uses the vendored `GhosttyKit.xcframework` built from the Ghostty custom-I/O | |
| 12 | fork, with T3's iOS 16 compatibility patch applied. `T3TerminalView` owns a `libghostty` surface and | |
| 13 | uses that callback I/O model: | |
| 14 | ||
| 15 | 1. initialize libghostty once for the process | |
| 16 | 2. create one Ghostty app and surface per native view | |
| 17 | 3. feed remote output into the surface with `ghostty_surface_feed_data` | |
| 18 | 4. send user input back to JS with the write callback | |
| 19 | 5. emit Ghostty's measured terminal size through `onResize` | |
| 20 | ||
| 21 | Android currently implements the same view name (`T3TerminalSurface`) and event payloads so the | |
| 22 | React Native screen and RPC code stay platform-neutral. The renderer backend can be replaced with a | |
| 23 | future Android Ghostty build without changing JS. | |
| 24 | ||
| 25 | Vendored Ghostty revision and license details are in `THIRD_PARTY_NOTICES.md`. | |
| 26 | ||
| 27 | ## Rebuilding GhosttyKit | |
| 28 | ||
| 29 | The checked-in `GhosttyKit.xcframework` is built from the Ghostty custom-I/O fork (https://github.com/Yash-Singh1/ghostty/tree/custom-io). | |
| 30 | Set the directory to the cloned repository checked out on the `custom-io` branch to `GHOSTTY_SOURCE_DIR`. | |
| 31 | ||
| 32 | ```bash | |
| 33 | apps/mobile/modules/t3-terminal/scripts/build-libghostty-ios16.sh | |
| 34 | ``` | |
| 35 | ||
| 36 | The script builds Ghostty with Zig 0.15.2, strips the iOS archives, and replaces only the | |
| 37 | `ios-arm64` and `ios-arm64-simulator` slices. Xcode's Metal toolchain must be installed; if `metal` | |
| 38 | fails, run `xcodebuild -downloadComponent MetalToolchain`. |