Skip to main content

ios-codex-preview

搭建 iOS 模拟器预览,让 Codex 构建、运行、检查 SwiftUI 应用。

跳到安装

来源信息

仓库
bronc-x/lotus
最近来源活动
2026年7月4日 17:24
检测到的 SKILL.md 语言
英语
星标
23
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
ios-codex-preview
description
搭建 iOS 模拟器预览,让 Codex 构建、运行、检查 SwiftUI 应用。
# iOS Codex Preview Intel Use this skill to make an iOS project ready for Codex-driven development with a live right-side preview. ## What To Deliver - A booted iOS Simulator. - A built, installed, launched app. - A Browser-visible preview at `http://127.0.0.1:3200`. - A watcher that rebuilds and relaunches after Swift/Xcode project changes. - A health check that proves simulator, server, watcher, screenshot, and port are working. - Clear project-local commands for start, stop, screenshot, and health. ## Preferred Flow 1. Inspect the project root for `.xcodeproj` or `.xcworkspace`, schemes, bundle ID, and existing helper scripts. 2. Run `scripts/install-ios-codex-preview.sh` from this skill if the project does not already have `scripts/ios-preview/*` or if they are stale. 3. Start the preview with `scripts/ios-preview/start-all.sh --daemon`. 4. Open or keep `http://127.0.0.1:3200` in the Codex in-app Browser and make it visible. 5. Run `scripts/ios-preview/health.sh`. 6. Prove hot reload by making a small visible SwiftUI text change, waiting for the watcher, and taking a simulator screenshot. ## Machine-Specific Rule On Apple Silicon, an official `serve-sim` / iOS Simulator Browser flow may be available. Prefer it only when it actually runs. On Intel Macs (`uname -m == x86_64`), do not spend time retrying `serve-sim` if it fails with an architecture error. Install the compatibility preview. It polls `xcrun simctl io <udid> screenshot` and shows the latest image in Codex Browser. ## Important Pitfalls - Do not rely on LaunchAgents for projects under `~/Documents`; macOS TCC can block background agents from reading the project. - If a stale LaunchAgent exists, unload and disable it before declaring success: - `launchctl list | rg 'codex.*preview|lotusapp|ios-preview|watch-run'` - `launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/<plist>` - move the plist to `~/Library/LaunchAgents.disabled/`. - Health checks must match both relative and absolute process paths, e.g. `scripts/ios-preview/server.mjs`, not just `node scripts/...`. - A reachable `/status` endpoint alone is not sufficient. The watcher process must be alive and a fresh screenshot must be updating. ## Commands Install/update preview helpers in a project: ```bash /Users/broncin/.codex/skills/ios-codex-preview/scripts/install-ios-codex-preview.sh ``` Start: ```bash scripts/ios-preview/start-all.sh --daemon ``` Stop: ```bash scripts/ios-preview/stop.sh ``` Health: ```bash scripts/ios-preview/health.sh ``` ## Completion Criteria Only report completion when all are true: - `scripts/ios-preview/health.sh` exits 0. - `curl -sS http://127.0.0.1:3200/status` returns `ok: true` and `hasImage: true`. - `ps` shows both `server.mjs` and `watch-run.sh`. - Codex Browser tab at `http://127.0.0.1:3200/` shows `live` and an image. - A visible Swift change has appeared in a new simulator screenshot after watcher rebuild/relaunch.
在 GitHub 查看