makecindy / makecindy/cindy

feat: iOS 模拟器构建链路优化(arch 预检 + 缓存复用 + 回收)

Open
#2,891 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
401
Avg merge
21h 48m
Merged PRs (30d)
776

Description

### 使用场景 / Use case

用户在 Cindy 会话里让 Agent 构建并运行 iOS App 到模拟器,同一 worktree 反复 build/run。

### 当前问题 / Current limitation

1. build 用 `generic/platform=iOS Simulator` 不 pin arch,产物架构可能装不进当前模拟器(x86 vs arm64),装不进才报错,用户需换架构重新全量 build。
2. 构建缓存(DerivedData + SPM checkout + 编译索引)按 session 隔离(`sha256(instanceId)`),无跨 session 复用、无回收,实测约 158GB。
3. build 命令缺 `-onlyUsePackageVersionsFromResolvedFile`,每次白做 SPM 版本检查(约 1-2 分钟)。

### 期望方案 / Proposed solution

1. build 前 `-showBuildSettings` 读 `ARCHS − EXCLUDED_ARCHS`,跟目标模拟器架构比对,不匹配提前抛 `APP_ARCH_MISMATCH`(对 Pod/SPM/纯源码一视同仁,读 Xcode 最终裁决)。
2. derivedDataPath / SPM checkout 按 worktree 复用(`-clonedSourcePackagesDirPath`),归档 + 磁盘阈值触发回收(mtime 冷缓存,保护当前构建)。
3. build 加 `-onlyUsePackageVersionsFromResolvedFile`,无 resolved 时 fallback resolve。

### 已考虑的替代方案 / Alternatives considered

- 显式 pin arch(`-destination ...arch=arm64`):会跟依赖的 `EXCLUDED_ARCHS` 冲突、可能 build 失败,且不该改用户项目的 Podfile/Package.swift。
- 全局共享单一 DerivedData:不同项目互相污染。
- sim-use 替代:sim-use 不做构建,解决不了构建链路问题。

Contributor guide

Open the contributing guide

Research direction

Start by locating the iOS simulator build entry point and the session-scoped cache keyed by sha256(instanceId). Trace how build settings, DerivedData, SPM checkout paths, and cleanup are currently handled. Done means architecture mismatches fail early, worktree caches are reused and safely reclaimed, and resolved package versions are used with a fallback when no resolved file exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, typescript
Domain
build-system, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.