Repository navigation
feat(cli): add native Android support - #60903
Draft
sigsegv0x0b wants to merge 1 commit into
Draft
sigsegv0x0b wants to merge 1 commit into
sigsegv0x0b wants to merge 1 commit into
Conversation
Build the CLI natively for Termux with Bun's android target instead of requiring glibc-runner, and publish an @opencode/cli-android-arm64 package. - Add the android-arm64 target and map it to bun-linux-arm64-android, with the matching bun-linux-aarch64-android release asset. - Publish android in the distribution package os list and resolve @opencode/pty-android-arm64 from the CLI build. - Build opencode-pty for aarch64-linux-android, pin the Zig API level to 28 so the Ghostty build does not query getprop on Termux, and use TMPDIR for the service socket on Android because /tmp is not writable there. - Embed the Android fff native library so file search works in compiled binaries. The TUI additionally needs an @opentui/core-android-arm64 prebuild; that change lives in anomalyco/opentui.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Related to #47612
Type of change
What does this PR do?
Adds a native
android-arm64build target so@opencode/cliinstalls and runs on Termux/Android withoutglibc-runner.{ os: "android", arch: "arm64" }and map it to Bun'sbun-linux-arm64-android, including thebun-linux-aarch64-androidrelease asset name. Publishandroidin the distribution packageoslist so npm stops rejecting the install.opencode-ptyforaarch64-linux-androidand publish@opencode/pty-android-arm64. The Ghostty build pins API 28 (so Zig does not consultgetpropon Termux) and the daemon usesTMPDIRfor its socket because Android has no writable/tmp.fffnative library through the existing@ff-labs/fff-bunpatch so file search works in the compiled binary.Dependencies: this is a draft until two releases exist:
anomalyco/opentuineeds an@opentui/core-android-arm64prebuild; the published@opentui/core@0.8.0rejectsandroid-arm64at runtime. The opencode side alone getsnpm installworking but the TUI would still fail.@opencode/pty@0.4.0is already published without the android optional dependency, so the CLI build needs a new@opencode/ptyrelease (and a pin bump here) before it can resolve@opencode/pty-android-arm64.I can mark this ready and bump the pins once both are released.
How did you verify your code works?
On Termux (Android aarch64, SDK 37), using a locally built
libopentui.soandopencode-ptyfor the same commit:opencode --versionand--helprun natively (bionic ELF,/system/bin/linker64).opencode --standalonerenders the TUI (logo, prompt, status bar) with the native render library; noUnsupported OpenTUI Node asset targeterror.opencode-pty playspawns Termuxbash, captures output, and prints parsed libghostty screen state.bun run typecheckinpackages/cli,cargo fmt --check, and Prettier pass.The Android release job itself has not run on GitHub Actions yet; it is new in this PR.
Visual
Screenshots / recordings
No screenshot: the TUI was exercised over a headless Termux pty, so the output is terminal escape sequences rather than an image.
Checklist