build-dmg

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<EXTREMELY-IMPORTANT> This skill runs `xcodebuild archive` + `exportArchive` and packages the result into a DMG. It touches code signing, provisioning, and export options.
Non-negotiable rules:
  1. Detect project/workspace, scheme, and team ID before building — never guess signing identity.
  2. If multiple schemes exist, ask the user which one to build.
  3. Do not auto-create or overwrite
    ExportOptions.plist
    without explicit approval — wrong export options produce unsigned or wrong-distribution builds.
  4. Use the helper script (
    helpers/build-dmg.sh
    ) from the project root. Do not inline xcodebuild commands.
  5. If
    xcodegen
    is detected (
    project.yml
    present), run
    xcodegen generate
    before building.
  6. Report the built DMG path, app version, and signing status clearly.
</EXTREMELY-IMPORTANT>
<EXTREMELY-IMPORTANT> 本技能会运行`xcodebuild archive` + `exportArchive`命令,并将结果打包为DMG文件。涉及代码签名、配置文件和导出选项相关操作。
不可违背的规则:
  1. 构建前先检测项目/工作区、方案和团队ID——绝不猜测签名身份。
  2. 如果存在多个方案,询问用户要构建哪一个。
  3. 未经明确许可,不得自动创建或覆盖
    ExportOptions.plist
    ——错误的导出选项会生成未签名或分发类型错误的构建产物。
  4. 使用项目根目录下的辅助脚本(
    helpers/build-dmg.sh
    )。不要直接嵌入xcodebuild命令。
  5. 如果检测到
    xcodegen
    (存在
    project.yml
    文件),在构建前运行
    xcodegen generate
  6. 清晰报告已构建的DMG路径、应用版本和签名状态。
</EXTREMELY-IMPORTANT>

build-dmg

build-dmg

Inputs

输入项

  • $request
    : Optional project, workspace, scheme, or signing hint
  • $request
    :可选的项目、工作区、方案或签名提示信息

Goal

目标

Produce a DMG build by:
  • resolving the right Xcode target inputs
  • running the bundled helper script from the project root
  • reporting the resulting DMG path and any packaging blockers
通过以下步骤生成DMG构建产物:
  • 解析正确的Xcode目标输入信息
  • 从项目根目录运行内置的辅助脚本
  • 报告生成的DMG路径以及任何打包障碍

Step 0: Detect the packaging inputs

步骤0:检测打包输入信息

Read the repo and resolve:
  • app name
  • scheme
  • project or workspace path
  • ExportOptions.plist
    location if it exists
  • VERSION
    file if present
  • whether
    project.yml
    indicates
    xcodegen
  • team ID or signing hints if already present
If a required input is ambiguous, ask before building.
Success criteria: The build configuration is explicit before the helper runs.
读取仓库并解析:
  • 应用名称
  • 方案
  • 项目或工作区路径
  • 若存在
    ExportOptions.plist
    ,确定其位置
  • 若存在
    VERSION
    文件,读取该文件
  • project.yml
    是否表明使用
    xcodegen
  • 若已存在,获取团队ID或签名提示信息
若某个必填输入信息不明确,在构建前询问用户。
成功标准:辅助脚本运行前,构建配置已明确。

Step 1: Confirm helper and working directory

步骤1:确认辅助脚本和工作目录

The helper script lives next to this skill at:
  • helpers/build-dmg.sh
Run it from the project root so it can use the current repository as the build context.
Success criteria: The correct helper path and project root are established.
辅助脚本位于本技能的同级目录:
  • helpers/build-dmg.sh
从项目根目录运行该脚本,使其能将当前仓库作为构建上下文。
成功标准:已确定正确的辅助脚本路径和项目根目录。

Step 2: Build with explicit environment

步骤2:使用明确的环境变量进行构建

Provide the required environment variables such as:
  • APP_NAME
  • SCHEME
Add optional variables only when the project actually needs them:
  • PROJECT
  • WORKSPACE
  • INFO_PLIST
  • EXPORT_OPTIONS
  • TEAM_ID
  • VERSION_FILE
  • USE_XCODEGEN
  • DMG_BACKGROUND
Success criteria: The helper has all required inputs and only the needed optional ones.
提供所需的环境变量,例如:
  • APP_NAME
  • SCHEME
仅当项目实际需要时才添加可选变量:
  • PROJECT
  • WORKSPACE
  • INFO_PLIST
  • EXPORT_OPTIONS
  • TEAM_ID
  • VERSION_FILE
  • USE_XCODEGEN
  • DMG_BACKGROUND
成功标准:辅助脚本已获取所有必填输入信息,且仅包含所需的可选变量。

Step 3: Handle success or failure cleanly

步骤3:妥善处理成功或失败情况

On success, report:
  • DMG output path
  • app version and build number if available
  • whether the
    VERSION
    file was changed
On failure:
  • summarize the real error
  • surface the relevant
    xcodebuild
    or export failure lines
  • identify whether the blocker is signing, scheme selection, export options, or build failure
Success criteria: The user gets either a usable artifact path or a clear blocker summary.
成功时,报告:
  • DMG输出路径
  • 若可用,应用版本和构建编号
  • VERSION
    文件是否已修改
失败时:
  • 总结实际错误
  • 展示相关的
    xcodebuild
    或导出失败日志行
  • 确定障碍类型是签名问题、方案选择问题、导出选项问题还是构建失败
成功标准:用户要么获得可用的产物路径,要么得到清晰的障碍总结。

Guardrails

防护规则

  • Do not run this skill proactively.
  • Do not assume
    .claude
    -local helper paths; use the helper inside this skill directory.
  • Do not auto-create or overwrite export options without approval.
  • Do not hide signing failures behind generic "build failed" summaries.
  • 不得主动运行本技能。
  • 不要假设
    .claude
    本地辅助脚本路径;使用本技能目录内的辅助脚本。
  • 未经许可,不得自动创建或覆盖导出选项。
  • 不要用通用的“构建失败”总结掩盖签名失败问题。

Output Contract

输出约定

Report:
  1. resolved app/project/workspace/scheme inputs
  2. whether the helper ran successfully
  3. DMG path on success
  4. version/build info if available
  5. exact blocker category on failure
报告以下内容:
  1. 已解析的应用/项目/工作区/方案输入信息
  2. 辅助脚本是否运行成功
  3. 成功时的DMG路径
  4. 若可用,版本/构建信息
  5. 失败时明确的障碍类型