跳转到内容

CLI

源码:github.com/tuist/tuist/tree/main/Tuistgithub.com/tuist/tuist/tree/main/cli

CLI 是 Tuist 的核心。它处理项目生成、自动化工作流(test、run、graph 和 inspect),并提供与 Tuist 服务器的接口,用于认证、缓存、洞察、预览、注册中心和选择性测试等功能。

  • macOS 14.0+
  • Xcode 26+
  • 克隆仓库:git clone [email protected]:tuist/tuist.git
  • 使用官方安装脚本安装 Mise(不要使用 Homebrew),然后运行 mise install
  • 安装 Tuist 依赖项:tuist install
  • 生成工作区:tuist generate

生成的项目会自动打开。如果之后需要重新打开,运行 open Tuist.xcworkspace

编辑 tuist scheme 并设置参数,如 generate --no-open。将工作目录设置为项目根目录(或使用 --path)。

首先生成工作区:

Terminal window
tuist generate --no-open

然后使用 Xcode 构建 tuist 可执行文件并从 DerivedData 运行它:

Terminal window
tuist_build_dir="$(xcodebuild -workspace Tuist.xcworkspace -scheme tuist -configuration Debug -destination 'platform=macOS' -showBuildSettings | awk -F' = ' '/BUILT_PRODUCTS_DIR/{print $2; exit}')"
"$tuist_build_dir/tuist" generate --path /path/to/project --no-open

或者通过 Swift Package Manager:

Terminal window
swift build --product ProjectDescription
swift run tuist generate --path /path/to/project --no-open