名称: shortcuts-generator
描述: 通过创建 plist 文件来生成 macOS/iOS 快捷指令。当被要求创建快捷指令、自动化工作流、构建 .shortcut 文件或生成快捷指令 plist 时使用。涵盖 1,155 个操作(427 个 WFActions + 728 个 AppIntents)、变量引用和控制流。
允许工具:* Write, Bash
生成有效的 .shortcut 文件,这些文件可以被签名并导入到 Apple 的“快捷指令”应用中。
一个快捷指令是一个具有以下结构的二进制 plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>WFWorkflowActions</key>
<array>
<!-- 操作放在这里 -->
</array>
<key>WFWorkflowClientVersion</key>
<string>2700.0.4</string>
<key>WFWorkflowHasOutputFallback</key>
<false/>
<key>WFWorkflowIcon</key>
<dict>
<key>WFWorkflowIconGlyphNumber</key>
<integer>59511</integer>
<key>WFWorkflowIconStartColor</key>
<integer>4282601983</integer>
</dict>
<key>WFWorkflowImportQuestions</key>
<array/>
<key>WFWorkflowMinimumClientVersion</key>
<integer>900</integer>
<key>WFWorkflowMinimumClientVersionString</key>
<string>900</string>
<key>WFWorkflowName</key>
<string>我的快捷指令</string>
<key>WFWorkflowOutputContentItemClasses</key>
<array/>
<key>WFWorkflowTypes</key>
<array/>
</dict>
</plist>
<dict>
<key>WFWorkflowActionIdentifier</key>
<string>is.workflow.actions.gettext</string>
<key>WFWorkflowActionParameters</key>
<dict>
<key>UUID</key>
<string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
<key>WFTextActionText</key>
<string>Hello World!</string>
</dict>
</dict>
<dict>
<key>WFWorkflowActionIdentifier</key>
<string>is.workflow.actions.showresult</string>
<key>WFWorkflowActionParameters</key>
<dict>
<key>Text</key>
<dict>
<key>Value</key>
<dict>
<key>attachmentsByRange</key>
<dict>
<key>{0, 1}</key>
<dict>
<key>OutputName</key>
<string>Text</string>
<key>OutputUUID</key>
<string>A1B2C3D4-E5F6-7890-ABCD-EF1234567890</string>
<key>Type</key>
<string>ActionOutput</string>
</dict>
</dict>
<key>string</key>
<string></string>
</dict>
<key>WFSerializationType</key>
<string>WFTextTokenString</string>
</dict>
</dict>
</dict>
每个操作都包含:
- 标识符:is.workflow.actions.<名称> (例如,is.workflow.actions.showresult)
- 参数:位于 WFWorkflowActionParameters 中的操作特定配置
- UUID:用于引用此操作输出的唯一标识符
要使用先前操作的输出:
1. 源操作需要一个 UUID 参数
2. 在 attachmentsByRange 字典中使用 OutputUUID 引用它
3. 在字符串中变量应插入的位置使用  (U+FFFC) 作为占位符
4. 将 WFSerializationType 设置为 WFTextTokenString
控制流操作(重复、条件、菜单)使用:
- GroupingIdentifier:连接开始/中间/结束操作的 UUID
- WFControlFlowMode:0=开始,1=中间(否则/分支),2=结束
| 操作 | 标识符 | 关键参数 |
|---|---|---|
| 文本 | is.workflow.actions.gettext |
WFTextActionText |
| 显示结果 | is.workflow.actions.showresult |
Text |
| 请求输入 | is.workflow.actions.ask |
WFAskActionPrompt, WFInputType |
| 使用 AI 模型 | is.workflow.actions.askllm |
WFLLMPrompt, WFLLMModel, WFGenerativeResultType |
| 注释 | is.workflow.actions.comment |
WFCommentActionText |
| URL | is.workflow.actions.url |
WFURLActionURL |
| 获取 URL 内容 | is.workflow.actions.downloadurl |
WFURL, WFHTTPMethod |
| 获取天气 | is.workflow.actions.weather.currentconditions |
(无必需参数) |
| 打开 App | is.workflow.actions.openapp |
WFAppIdentifier |
| 打开 URL | is.workflow.actions.openurl |
WFInput |
| 提醒 | is.workflow.actions.alert |
WFAlertActionTitle, WFAlertActionMessage |
| 通知 | is.workflow.actions.notification |
WFNotificationActionTitle, WFNotificationActionBody |
| 设定变量 | is.workflow.actions.setvariable |
WFVariableName, WFInput |
| 获取变量 | is.workflow.actions.getvariable |
WFVariable |
| 数字 | is.workflow.actions.number |
WFNumberActionNumber |
| 列表 | is.workflow.actions.list |
WFItems |
| 词典 | is.workflow.actions.dictionary |
WFItems |
| 重复(计数) | is.workflow.actions.repeat.count |
WFRepeatCount, GroupingIdentifier, WFControlFlowMode |
| 重复(每个) | is.workflow.actions.repeat.each |
WFInput, GroupingIdentifier, WFControlFlowMode |
| 如果/否则 | is.workflow.actions.conditional |
WFInput, WFCondition, GroupingIdentifier, WFControlFlowMode |
| 从菜单中选取 | is.workflow.actions.choosefrommenu |
WFMenuPrompt, WFMenuItems, GroupingIdentifier, WFControlFlowMode |
| 查找照片 | is.workflow.actions.filter.photos |
WFContentItemFilter (参见 FILTERS.md) |
| 删除照片 | is.workflow.actions.deletephotos |
photos (不是 WFInput!) |
完整文档请参阅:
- PLIST_FORMAT.md - 完整的 plist 结构
- ACTIONS.md - 所有 427 个 WF*Action 标识符和参数
- APPINTENTS.md - 所有 728 个 AppIntent 操作
- PARAMETER_TYPES.md - 所有参数值类型和序列化格式
- VARIABLES.md - 变量引用系统
- CONTROL_FLOW.md - 重复、条件、菜单模式
- FILTERS.md - 用于查找/筛选操作的内容过滤器(照片、文件等)
- EXAMPLES.md - 完整的工作示例
快捷指令在导入前必须签名。使用 macOS shortcuts 命令行工具:
# 为任何人签名
shortcuts sign --mode anyone --input MyShortcut.shortcut --output MyShortcut_signed.shortcut
# 为认识您的人签名
shortcuts sign --mode people-who-know-me --input MyShortcut.shortcut --output MyShortcut_signed.shortcut
签名过程:
1. 将你的 plist 以 XML 格式写入 .shortcut 文件
2. 运行 shortcuts sign 以添加加密签名(约增加 19KB)
3. 签名后的文件可以在 Shortcuts.app 中打开/导入
OutputUUID 将输出连接到输入.shortcut 文件(XML plist 格式即可)shortcuts sign 使其可导入A1B2C3D4-E5F6-7890-ABCD-EF1234567890<integer>0</integer> 而非 <string>0</string>{位置, 长度} - 例如,第一个字符为 {0, 1} (U+FFFC) 标记变量插入的位置GroupingIdentifier 的结束操作