mobilecode README

The project's README from github.com/hsandhu/mobilecode. As one markdown file: README.md.

mobilecode

The open source AI coding agent for mobile apps.

MobileCode is a fork of opencode that knows about mobile projects. When it detects an iOS or Android project it can run the simulator or emulator preview server and render the live device inside the app, next to your session.

React Native

Run a React Native app on iOS and Android from one Play button. MobileCode starts one Metro server, builds both native projects, and launches them in embedded Simulator and Emulator panes.

MobileCode building and running a React Native app on iOS and Android

MobileCode building and running an iOS app in the embedded simulator

How the device pane works

Open a session in a mobile project and the device pane opens by itself, alongside your conversation. It starts npx serve-sim or npx serve-avd on the machine running the MobileCode server and streams the simulator or emulator into the app, with Start, Stop, Reload and Open in browser controls. Projects are detected up to two directories below the session root, so an app in a subfolder is still found.

Build and run

The session titlebar carries an Xcode-style run control for every detected platform, showing the current build status next to it.

The same operations are available over HTTP:

GET  /api/device-preview?location[directory]=<project>
POST /api/device-preview/start      { "platform": "ios" | "android" }
POST /api/device-preview/stop       { "platform": "ios" | "android" }
POST /api/device-preview/run        { "platform": "ios" | "android" }
POST /api/device-preview/run/stop   { "platform": "ios" | "android" }

Requirements: macOS with Xcode for iOS (serve-sim needs Node 20 or newer), and the Android SDK platform-tools with at least one AVD for Android. Android builds need a JDK your project's Gradle version supports, and the package name is read from the built APK with aapt2 when the SDK build-tools are installed.

Installation

# Install script (downloads a release binary from GitHub)
curl -fsSL https://raw.githubusercontent.com/hsandhu/mobilecode/main/install | bash

# From source
git clone https://github.com/hsandhu/mobilecode.git
cd mobilecode
bun install
bun run --cwd packages/opencode src/index.ts

The install script places the binary in ~/.mobilecode/bin and adds it to your shell PATH.

Configuration and data

MobileCode keeps opencode's configuration format and locations, so an existing opencode.json, provider credentials, plugins, and skills work unchanged. Configuration lives in ~/.config/opencode, data in ~/.local/share/opencode, and environment variables keep the OPENCODE_ prefix. See the opencode docs for the full reference.

Development

bun install
bun run --cwd packages/opencode src/index.ts serve --port 4096   # backend
bun --cwd packages/app dev -- --port 4444                        # web UI at http://localhost:4444
bun --cwd packages/desktop dev                                   # desktop app

Run bun typecheck inside a package directory before sending changes. Tests run from package directories, for example bun test in packages/opencode.

Building the macOS app

bun run build:macos

One command: it installs dependencies, bundles the server, builds the Electron app and writes MobileCode.app plus a .dmg and .zip to packages/desktop/dist. It needs Node 20 or newer and picks a suitable version from nvm when the one on your PATH is older.

The build is unsigned by default, so right-click the app and choose Open the first time. To ship a signed and notarized build, pass --sign with a Developer ID certificate in your keychain and APPLE_API_KEY, APPLE_API_KEY_ID and APPLE_API_ISSUER set. Other options are --arch arm64|x64|universal, --channel dev|beta|prod and --skip-install; --help lists them.

License

MIT. MobileCode is built on opencode, copyright (c) 2025 opencode, and keeps its MIT license.

mobilecode (hsandhu/mobilecode)

Searching Database…

这是什么?MobileCode 是一个用于构建移动应用的开源 AI 编码代理,从 opencode 分支而来。当它检测到 iOS 或 Android 项目时,可以启动模拟器/仿真器,并在你的对话旁边实时显示预览。
它是 CLI 工具,还是有桌面应用?它继承了 opencode 的全部界面:终端 UI、Electron 桌面应用和 Web UI,另外还支持任意模型供应商、MCP、插件和技能。
预览 iOS 或 Android 应用需要装什么?iOS 预览需要带 Xcode 的 macOS(serve-sim 还需要 Node 20+);Android 预览需要 Android SDK platform-tools 和至少一个 AVD,外加与项目 Gradle 版本匹配的 JDK。
我能同时预览多个移动项目吗?不能。模拟器、仿真器和 Metro 端口是共享的,启动新项目时会先自动停止其他项目里正在运行的应用。
它能兼容现有的 opencode 配置吗?可以。MobileCode 保留了 opencode 的配置格式和文件位置,现有的 opencode.json、供应商凭据、插件和技能无需改动即可使用。
它是怎么运行 React Native 或 Expo 应用的?按下 Play 会启动一个 Metro 服务器,按需运行 expo prebuild、安装 pods、构建两个原生项目,并通过 adb reverse 把 Android 仿真器连到 Metro,同时在 iOS 和 Android 上启动应用。
devicerun 工具让代理能做什么?它让 AI 代理能够自行构建并启动应用、等待结果,并直接读取构建错误和日志尾部,从而无需你粘贴日志就能修复失败的构建。
我能拿到签名的 macOS 应用构建吗?默认情况下 macOS 应用构建未签名,但传入 --sign 并提供 Developer ID 证书和 Apple API 密钥凭据,即可生成已签名并公证的 MobileCode.app、.dmg 和 .zip。
What are similar projects?Baize, skills, skills, 1code, zuse, kimi-code, acryl, lody-ios
Creator
hsandhu
Size
310.8 MB
Stars
242
Age
1mo
Commits · 90 Days