### Install build dependencies
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Installs Meson, xcodegen, and Zig 0.15.x via Homebrew.
```bash
brew install meson
```
```bash
brew install xcodegen
```
```bash
brew install zig@0.15
```
--------------------------------
### App ID Tracking Example
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/app.md
Example of the thread-specific instruction line used to track existing app identifiers.
```text
Apps saved in this thread so far: fitness-tracker (Fitness Tracker), todo-list (Todo List)
```
--------------------------------
### Install Xcode command line tools
Source: https://github.com/0xsero/litter/blob/main/apps/ios/fastlane/README.md
Run this command to ensure the necessary Xcode command line tools are installed on your system.
```sh
xcode-select --install
```
--------------------------------
### Install Rust and iOS targets
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Installs Rust via rustup and adds the required iOS compilation targets.
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios
```
--------------------------------
### Fitness Tracker Widget Implementation
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/app.md
A complete example demonstrating state loading, migration, debounced saving, and DOM rendering for a fitness tracker widget.
```html
Workout log
```
--------------------------------
### Debug Android Emulator
Source: https://github.com/0xsero/litter/blob/main/CLAUDE.md
Commands to build, install, and launch the application on an Android emulator.
```bash
make android-emulator-fast
```
```bash
adb -e install -r apps/android/app/build/outputs/apk/debug/app-debug.apk
```
```bash
adb -e shell am start -n com.sigkitten.litter.android/com.litter.android.MainActivity
```
--------------------------------
### Configure Xcode path
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Sets the active developer directory to the full Xcode installation.
```bash
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
```
--------------------------------
### Run app-server manually
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Starts the app-server bound to the loopback interface for SSH port forwarding.
```bash
codex app-server --listen ws://127.0.0.1:8390
```
--------------------------------
### Install InjectionIII
Source: https://github.com/0xsero/litter/blob/main/CLAUDE.md
Command to install the InjectionIII tool via Homebrew for hot reloading support.
```bash
brew install --cask injectioniii
```
--------------------------------
### Debug iOS Simulator
Source: https://github.com/0xsero/litter/blob/main/CLAUDE.md
Commands to install and launch the application directly from DerivedData on the iOS simulator.
```bash
xcrun simctl install booted <.../Build/Products/Debug-iphonesimulator/Litter.app>
```
```bash
xcrun simctl launch booted com.sigkitten.litter
```
--------------------------------
### Structural SVG Container Example
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/diagram_types.md
Defines a library branch layout using stacked regions with SVG markers and color classes for light/dark mode support.
```svg
Library branchMain floorCirculation deskCheckouts, returnsBooksReading roomSeating, reference
```
--------------------------------
### Implement Custom HTML Legend
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/charts_chart_js.md
Example structure for a custom legend using flexbox for layout and inline styles for color indicators.
```html
Chrome 65%Safari 18%
```
--------------------------------
### Mermaid ERD Schema Example
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/diagram_types.md
Defines a database schema using mermaid.js erDiagram syntax to handle layout and connector routing automatically.
```mermaid
erDiagram
USERS ||--o{ POSTS : writes
POSTS ||--o{ COMMENTS : has
USERS {
uuid id PK
string email
timestamp created_at
}
POSTS {
uuid id PK
uuid user_id FK
string title
}
```
--------------------------------
### Define Arrow Marker in SVG
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/svg_setup.md
Include this definition at the start of every SVG to enable consistent arrow markers that inherit the stroke color.
```xml
```
--------------------------------
### Build and Run iOS
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Commands for project generation, opening in Xcode, and CLI building.
```bash
make xcgen
```
```bash
open apps/ios/Litter.xcodeproj
```
```bash
xcodebuild \
-project apps/ios/Litter.xcodeproj \
-scheme Litter \
-configuration Debug \
-destination 'platform=iOS Simulator,name=iPhone 17 Pro' \
build
```
--------------------------------
### Build and Run Commands
Source: https://github.com/0xsero/litter/blob/main/README.md
Use these Makefile targets to trigger fast builds for iOS and Android devices or simulators.
```bash
make ios-device-fast # fast device build
make ios-sim-fast # fast simulator build
make android-emulator-fast # fast Android emulator build
```
--------------------------------
### Build and Run Android
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Commands for opening the project in Android Studio and executing build/test pipelines.
```bash
open -a "Android Studio" apps/android # open in Android Studio
make test-android # generate bindings and run unit tests
make android # full Rust/JNI + debug APK pipeline
make android-emulator-fast # host emulator ABI only
```
--------------------------------
### Build and Upload to TestFlight
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Builds the application and uploads it to TestFlight, automatically handling versioning and build number increments.
```bash
APP_BUNDLE_ID= \
APP_STORE_APP_ID= \
TEAM_ID= \
ASC_KEY_ID= \
ASC_ISSUER_ID= \
ASC_PRIVATE_KEY_PATH="$HOME/AppStore.p8" \
./apps/ios/scripts/testflight-upload.sh
```
--------------------------------
### Authenticate with App Store Connect
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Initializes the authentication session using App Store Connect credentials.
```bash
asc auth login \
--name "Litter ASC" \
--key-id "" \
--issuer-id "" \
--private-key "$HOME/AppStore.p8" \
--network
```
--------------------------------
### Build iOS with Make
Source: https://github.com/0xsero/litter/blob/main/docs/ios/quickstart.md
Use these commands to perform full or incremental builds of the iOS project.
```bash
# Full iOS build (device + simulator)
make ios
# Simulator development lane (faster; raw static library)
make ios-sim-fast
# Device development lane (faster; raw static library)
make ios-device-fast
# Build + open Xcode
make ios-run
```
--------------------------------
### Initialize Chart.js with Responsive Wrapper
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/charts_chart_js.md
Use a relative-positioned wrapper div for sizing and a named initialization function to handle asynchronous script loading.
```html
```
--------------------------------
### Run Local Iteration Commands
Source: https://github.com/0xsero/litter/blob/main/CLAUDE.md
Use these commands for fast local development cycles before packaging or releasing.
```bash
make ios-sim-fast
```
```bash
make ios-device-fast
```
```bash
make android-emulator-fast
```
--------------------------------
### Bootstrap TestFlight Defaults
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Configures the initial TestFlight environment settings for the specified bundle ID.
```bash
APP_BUNDLE_ID= ./apps/ios/scripts/testflight-setup.sh
```
--------------------------------
### Enable SSH via CLI
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Enables remote login on the Mac using the systemsetup utility.
```bash
sudo systemsetup -setremotelogin on
```
--------------------------------
### Open Project in Android Studio
Source: https://github.com/0xsero/litter/blob/main/apps/android/README.md
Opens the Android project directory in Android Studio on macOS.
```bash
open -a "Android Studio" apps/android
```
--------------------------------
### Repository Layout
Source: https://github.com/0xsero/litter/blob/main/README.md
Overview of the project directory structure and core components.
```text
apps/ios/ iOS app (Litter scheme, project.yml is source of truth)
apps/android/ Android app (Compose UI, Gradle build)
shared/rust-bridge/
codex-mobile-client/ Shared Rust client crate + UniFFI surface (iOS & Android)
codex-slingshot/ Slingshot HTTP/stream transport
uniffi-bindgen/ Local binding generator wrapper
shared/third_party/codex/ Upstream Codex submodule
shared/third_party/ghostty Upstream Ghostty submodule for the terminal renderer
patches/codex/ Local patch set applied during builds
tools/scripts/ Cross-platform helper scripts
```
--------------------------------
### Execute App Store Release
Source: https://github.com/0xsero/litter/blob/main/docs/DEVELOPMENT.md
Triggers the production release process using metadata from the local fastlane directory.
```bash
APP_BUNDLE_ID= \
APP_STORE_APP_ID= \
TEAM_ID= \
ASC_KEY_ID= \
ASC_ISSUER_ID= \
ASC_PRIVATE_KEY_PATH="$HOME/AppStore.p8" \
./apps/ios/scripts/app-store-release.sh
```
--------------------------------
### Build iOS App Manually
Source: https://github.com/0xsero/litter/blob/main/docs/ios/quickstart.md
Execute this command to build the generated Xcode project via the command line.
```bash
xcodebuild \
-project apps/ios/Litter.xcodeproj \
-scheme Litter \
-configuration Debug \
-destination 'generic/platform=iOS Simulator' \
build
```
--------------------------------
### Run Android Unit Tests
Source: https://github.com/0xsero/litter/blob/main/apps/android/docs/qa-matrix.md
Executes the unit-test suite for the single hybrid runtime using the Gradle wrapper.
```bash
./gradlew :app:testDebugUnitTest
```
--------------------------------
### window.saveAppState(obj)
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/app.md
Serializes and persists the provided state object to the native host.
```APIDOC
## window.saveAppState(obj)
### Description
Serializes the provided object to JSON and requests the native host to persist it. Persistence is asynchronous.
### Parameters
- **obj** (Object) - The state object to persist.
### Returns
- **boolean** - Returns true when the request is successfully dispatched.
```
--------------------------------
### Implement Calorie Tracker Widget
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/app.md
A complete HTML/JS implementation of a food tracker widget that uses structuredResponse to estimate calories from user input.
```html
Food log
```
--------------------------------
### Execute Mac Direct Distribution Pipeline
Source: https://github.com/0xsero/litter/blob/main/docs/releases/mac-distribution-checklist.md
Commands to trigger the build pipeline locally, with options to include notarization or skip specific steps like Finder layout automation.
```bash
# Full pipeline including notarization (needs ASC API key env vars)
ASC_PRIVATE_KEY_PATH=/path/to/AuthKey.p8 \
ASC_KEY_ID=ABC123 \
ASC_ISSUER_ID=00000000-0000-0000-0000-000000000000 \
make mac-direct-dist
# Build but skip notarization (for testing the script itself)
SKIP_NOTARIZATION=1 make mac-direct-dist
# Skip Finder layout automation if running on a host where Finder is unavailable.
DMG_SKIP_FINDER_LAYOUT=1 SKIP_NOTARIZATION=1 make mac-direct-dist
```
--------------------------------
### Rebuild and Reopen Workflow
Source: https://github.com/0xsero/litter/blob/main/apps/android/README.md
Automated script to rebuild the project and reopen the IDE, with optional flags for Rust recompilation or skipping the open action.
```bash
./apps/android/scripts/rebuild-and-reopen.sh
```
```bash
./apps/android/scripts/rebuild-and-reopen.sh --with-rust
```
```bash
./apps/android/scripts/rebuild-and-reopen.sh --no-open
```
--------------------------------
### Streaming HTML Structure
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/core.md
Follow this order to ensure content renders correctly during token-by-token streaming.
```html
```
--------------------------------
### Run iOS screenshots action
Source: https://github.com/0xsero/litter/blob/main/apps/ios/fastlane/README.md
Executes the Fastlane action to generate iOS screenshots, optionally using bundle exec.
```sh
[bundle exec] fastlane ios screenshots
```
--------------------------------
### window.structuredResponse({ prompt, responseFormat })
Source: https://github.com/0xsero/litter/blob/main/shared/rust-bridge/codex-mobile-client/src/widget_guidelines/app.md
Performs a one-shot AI query constrained by a provided JSON schema.
```APIDOC
## window.structuredResponse({ prompt, responseFormat })
### Description
Executes an AI-powered query that returns a structured JSON object based on the provided schema. This method supports follow-up context within the same app view session.
### Parameters
- **prompt** (string) - The input prompt for the AI model.
- **responseFormat** (Object) - A JSON Schema object defining the expected output structure. Must use strict mode (all fields required, additionalProperties: false).
### Returns
- **Promise