01
Dev.to Kotlin
作者:Jordan Demeulenaere
發布:02-06 17:54
Vibe coding mobile apps with Compose Driver
Compose Driver lets AI agents drive Jetpack Compose apps by exposing a test harness over HTTP so agents can query, interact with, and verify UI state programmatically.
重點摘要
Wraps Jetpack Compose UI in a test harness that listens for HTTP requests
Allows agents to query UI, perform clicks/swipes/typing, and capture screenshots or GIFs
Runs headlessly on the JVM and supports Desktop/Multiplatform and Android via Robolectric
Compose Driver is a library and Gradle plugin that closes the feedback loop for AI coding agents by letting them "drive" Jetpack Compose apps through a lightweight HTTP server. It wraps your Compose UI in a test harness and translates HTTP requests into ComposeUiTest actions, so an agent can discover UI nodes, perform input (click, swipe, type), advance a virtual clock, and capture screenshots or UI trees for verification. Because it runs headlessly on the JVM it’s fast and suitable for background or cloud agents, and it supports both Desktop/Multiplatform Compose and Android via Robolectric. The author demonstrates the tool by prompting an agent to build and iterate on an Instagram-like clone in under an hour, while cautioning that generated code still needs human review for production uses. The project is open source on GitHub for experimentation.
用 Compose Driver 讓 AI 驅動行動應用開發
Compose Driver 透過將 Compose UI 包在一個監聽 HTTP 的測試殼層,使 AI 代理能查詢、互動並驗證畫面狀態。
重點摘要
在 Compose UI 外层启动小型 HTTP 服务器并映射为 ComposeUiTest 操作
代理可以查找节点、执行点击/滑动/输入并截取截图或 UI 结构
以 JVM 无头方式运行,支持 Desktop/Multiplatform 与通过 Robolectric 的 Android
Compose Driver 是一个库和 Gradle 插件,旨在为 AI 编码代理提供可编程的 UI 操作通道,以缩短移动开发的反馈回路。它将应用内容包装进测试环境,并启动本地服务器,把 HTTP 请求翻译为 ComposeUiTest 的动作(例如定位节点、执行点击、推进虚拟时钟并捕获图像或 UI 树)以便代理能像用户一样导航应用但速度更快。该工具可在 JVM 上无头运行,适合在后台或云端执行,支持桌面/多平台 Compose 与通过 Robolectric 的 Android。作者以一个 Instagram 克隆示例展示了快速迭代的可能性,但同时强调生产环境仍需人工审查生成的代码。源码已在 GitHub 开放。
用 Compose Driver 給行動應用程式做 AI 驅動開發
Compose Driver 透過在 Compose UI 外圍包一個聆聽 HTTP 的測試環境,讓 AI 代理能查詢、操作並驗證應用畫面狀態。
重點摘要
把 Jetpack Compose 包在測試殼層中並啟動本地 HTTP 伺服器
代理可查詢節點、點擊/滑動/輸入並擷取截圖或 UI 結構
以 JVM 無頭模式運行,支援 Desktop/Multiplatform 與透過 Robolectric 的 Android
Compose Driver 是個 library 與 Gradle 插件,目的是為 AI 編碼代理建立一個可程式化的互動介面,縮短行動開發的回饋循環。它透過一個小型本地伺服器,將 HTTP 請求轉換成 ComposeUiTest 的動作:尋找節點、執行點擊或輸入、推進虛擬時鐘以加速動畫,並回傳 UI 樹或截圖以供驗證。因為能在 JVM 上無頭運行,所以速度快並適合背景或雲端代理,同時支援桌面與 Android(藉由 Robolectric)。作者示範用 agent 在不到一小時內操控、改進一個類似 Instagram 的範例應用,但也提醒在生產環境仍需人工審查與理解代理所產生的程式碼。原始碼已開放於 GitHub,方便實驗與探索。