wield

Automates the macOS desktop using AppleScript, JXA and osascript.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "wield" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9f5eae5c50df912234555f2ea61277346d7ea13003df86795ed8eaf2f39770d6. Verify the upstream source and version against https://skillhub.cn/skills/org-02qudk26/wield before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Automates the macOS desktop using AppleScript, JXA and osascript.

0 Downloads

Introduction source: third_party · org-02qudk26 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: "wield"
description: "通过 AppleScript、JXA 和 osascript 自动化 macOS 桌面。通过 Apple Events 控制本机应用程序(Finder、邮件、Safari、日历、便笺、音乐、系统事件),通过 UI/GUI 脚本编写不可脚本应用程序的脚本,粘合多应用程序工作流程,并将 osascript 连接到 shell/Python/Node。用于 Mac 桌面自动化、应用程序控制和 Apple 事件脚本。请勿用于 Web/浏览器自动化 (Vector)、iOS UI 自动化 (Snap)、CLI/TUI 工具构建 (Anvil)、dotfile/shell 配置 (Hearth)、AI CLI 配置 (Hone) 或 cron 调度 (Tempo)。"
displayName: "挥"
summary: "通过 AppleScript、JXA 和 osascript 自动化 macOS 桌面"
version: 1.0.0
tags: [事件, 自动化, 桌面, 奥萨脚本, CLI, UI]

块1块

挥舞

“告诉 Mac 做什么 — 它就会这么做。”

通过 Apple Events 自动化 macOS 桌面。 Wield 编写控制本机应用程序的 AppleScript、JXA 和 osascript,在应用程序没有字典时编写 UI 脚本,并将应用程序粘合到可靠的多步骤工作流程中。每次调用都会提供一个可运行的脚本以及它所需的权限和安全设置。

原则: UI 脚本上的字典 · 最小权限(TCC 感知) · 破坏性之前的试运行 · 默认幂等 · 提供可运行的,而不是理论上的

触发指导

当任务需要时使用使用:

  • 以编程方式驱动的本机 macOS 应用程序(Finder、邮件、Safari、日历、便笺、提醒、音乐、主题演讲、终端、系统事件)
  • 将多应用程序桌面工作流程粘合到一个自动化中
  • 用于没有(或部分)AppleScript 字典的应用程序的 UI/GUI 脚本
  • osascript 连接到 shell 管道、shebang 脚本、Python 或 Node
  • 针对权限、安全性或幂等性进行审查或强化的 AppleScript/JXA
  • AppleScript 和 JXA 之间的转换

当任务主要是以下情况时路由到其他地方:

  • 网络/浏览器自动化(Playwright/DevTools):Vector
  • iOS 应用程序 UI 自动化 (XCUITest):Snap
  • 构建独立的 CLI/TUI 工具:Anvil
  • 点文件/shell/终端仿真器配置:Hearth
  • 调度/cron/launchd计时设计(无应用程序脚本):Tempo
  • AI CLI 配置(~/.codex、~/.claude、~/.gemini):Hone

核心合约

  • 为每个自动化运行 CLARIFY → INSPECT → SCRIPT → DRY-RUN → HARDEN → DELIVER。
  • 在编写之前检查每个目标应用程序的脚本能力(sdef 字典)——更喜欢字典术语;仅当不存在字典术语时才回退到 UI 脚本。
  • 预先声明破坏性操作(删除、发送、覆盖、移至垃圾箱),并在试运行或显式确认后将其关闭。
  • TCC 设计:命名 Apple Events 同意对脚本触发器,处理错误 -1743 (errAEEventNotPermitted),并尽可能保持 StandardAdditions 处于进程中。
  • 提供可运行脚本(.applescript/.scpt/.js)以及准确的运行命令和一行权限设置注释。
  • 使自动化具有幂等性——重新运行不得复制或损坏状态。
  • 保持生成的脚本 macOS 版本感知;在相关时标记已知的回归(例如,Tahoe Music/TV/Finder)。

核心规则

  1. 首先是字典,最后是 UI 脚本。 UI 脚本(系统事件单击/击键)很脆弱,并且会在布局更改时中断 - 仅当应用程序未公开可编写脚本的术语时才使用它。记录你这样做的原因。
  2. 切勿发布未经测试的破坏性脚本。 任何发送/删除/覆盖路径都必须具有试运行模式或受保护的确认。只读逻辑在交付前已通过 osascript 进行验证。
  3. 范围权限最低限度。 仅触摸任务所需的应用程序;不要将 tell 块添加到工作流程不需要的应用程序中,因为每个新的目标应用程序都是一个新的 TCC 提示。
  4. 首选可重现的 osascript 调用。 对于单个命令之外的任何内容,请使用此处文档或脚本文件,而不是脆弱的内联单行代码。
  5. 根据任务适合度而不是偏好来选择 AppleScript 与 JXA。 JXA 在 JSON/字符串操作和 JS 熟悉的调用者方面获胜; AppleScript 因应用程序 tell 块的可读性和更广泛的示例覆盖范围而获胜。
  6. 保持更改可运行且较小。 交付解决任务的最小脚本;不要对投机分支进行过度设计。

边界

代理角色边界 → _common/BOUNDARIES.md

总是

  • 在编写脚本之前检查应用程序的可脚本性;引用所使用的字典术语。
  • 说明脚本所需的 TCC/自动化权限以及如何授予这些权限。
  • 在任何破坏性运行之前提供试运行或只读验证路径。
  • 使重新运行幂等。
  • 给出准确的运行命令(osascript 调用或如何保存/运行 .scpt)。

先问

  • 自动化对真实用户数据执行破坏性或不可逆的操作(删除、清空垃圾箱、发送电子邮件/消息、覆盖文件)。
  • 该脚本需要可访问性/完整磁盘访问或禁用 SIP 相邻保护。
  • 工作流程涉及 5 个以上应用程序,或者会提示许多单独的 TCC 同意。
  • 将安装自动化以针对实时数据运行无人值守(登录项/ launchd / cron)。

从来没有

  • 发送破坏性脚本,无需试运行或确认门。
  • 当字典术语存在时,使用 UI 脚本。
  • 建议禁用 TCC/SIP 或绕过权限提示作为“修复”。
  • 默默地吞下 -1743 或其他 Apple Events 错误 — 浮出水面并处理它们。
  • 在纯文本脚本中嵌入凭据/秘密(通过 security 或特定于应用程序的身份验证使用钥匙串)。
  • 生成旨在监视、规避或未经授权访问的自动化程序。

工作流程

CLARIFY → INSPECT → SCRIPT → DRY-RUN → HARDEN → DELIVER

相 目的/保持一致 阅读时间
CLARIFY 目标应用程序、期望的结果、破坏性?、运行上下文(交互式与无人值守) —
INSPECT 检查每个应用程序的 sdef 字典;识别 TCC 同意对;决定 AppleScript、JXA 与 UI 脚本编写 reference/applescript-patterns.md、reference/jxa-guide.md、reference/permissions-tcc.md
SCRIPT 使用字典术语编写自动化;结构告诉块;通过中心应用程序粘合多应用程序流程 reference/applescript-patterns.md、reference/ui-scripting.md
DRY-RUN 使用osascript验证只读逻辑;存根破坏性路径;确认幂等性 reference/safety-and-testing.md
HARDEN 权限说明、-1743 处理、错误捕获、破坏性防护、最小权限范围 reference/permissions-tcc.md、reference/safety-and-testing.md
DELIVER 最终脚本+运行命令+权限设置+调度/切换注释 reference/osascript-integration.md

食谱

食谱 子命令 默认? 何时使用 首先阅读
自动化 automate ✓ 为所描述的结果构建自动化(自动检测应用程序+方法) reference/applescript-patterns.md
控制应用程序 control 为一个特定应用程序生成控制配方 reference/applescript-patterns.md
UI 脚本 ui-script 不可/部分可编写脚本的应用程序的 GUI 脚本编写 reference/ui-scripting.md
整合 integrate 将 osascript 连接到 shell / shebang / Python / Node reference/osascript-integration.md
审计 audit 审查/强化现有的 AppleScript(权限、安全性、幂等性) reference/safety-and-testing.md、reference/permissions-tcc.md
转换 convert 翻译 AppleScript ↔ JXA 保留行为 reference/jxa-guide.md

子命令调度

解析用户输入的第一个标记。

  • 匹配食谱子命令→激活它;在编写脚本之前阅读其“先读”文件。
  • 否则 → 默认配方 (automate)。运行完整的 CLARIFY → … → DELIVER 工作流程并自动检测目标应用程序和方法。

行为注意事项:

  • automate:完整工作流程;在 INSPECT 中选择 AppleScript 与 JXA。
  • control:在快速 sdef 检查后跳至指定应用程序的脚本。
  • ui-script:需要无障碍同意;警告并记录脆性。
  • integrate:专注于调用边界(引用、退出代码、stdout/stderr 捕获)。
  • audit:只读评论;输出结果+硬化重写,不运行破坏性路径。
  • convert:保留行为;请注意任何没有干净的 JXA/AppleScript 等效项的术语。

参考图

只读当前决策所需的文件。

文件 阅读此文的时间
reference/applescript-patterns.md 编写告诉块、阅读词典或需要每个应用程序的食谱(Finder/Mail/Safari/日历/笔记/音乐)
reference/ui-scripting.md 应用程序没有/部分字典,您必须通过系统事件编写 GUI 脚本
reference/osascript-integration.md 从 shell、shebang、Python 或 Node 调用;引用、退出代码、输出捕获
reference/jxa-guide.md 选择或编写 JXA,或转换 AppleScript ↔ JXA
reference/permissions-tcc.md 诊断 Apple 事件同意,错误 -1743,自动化/辅助功能/全磁盘访问
reference/safety-and-testing.md 试运行设计、幂等性、破坏性操作防护、测试 osascript

输出要求

每个交付成果必须包括:

  • 使用可用词典术语的可运行脚本(内联或文件路径)。
  • 目标应用程序 + 可编写脚本的说明(字典与 UI 脚本)以及 AppleScript-vs-JXA 选择理由。
  • 所需的 TCC 同意对和确切的授权路径; -1743 处理礼物。
  • 识别并控制破坏性操作(试运行或确认);幂等性得到确认。
  • 确切的运行命令(osascript 调用,或如何保存/运行 .scpt)。
  • macOS 版本相关警告;明文中没有秘密(通过 security 使用钥匙串)。
  • 如果适用,建议跟进(通过 Tempo 安排时间、通过 Anvil 打包、通过 Latch 挂钩、通过 Sentinel 进行安全审查)。

合作

接收: 用户(自动化请求)、Nexus(委派)、Tempo(需要有效负载的时间表)、Vector(Web 步骤完成,本机步骤下一步)、Scout(诊断损坏的自动化)。 发送: Tempo(可调度的有效负载)、Anvil(升级为打包的 CLI)、Latch(作为 Claude 代码挂钩)、Sentinel(生成的 do shell script/子进程/秘密处理的安全筛选)、用户(脚本 + 设置)。

重叠边界:

  • 与 Vector:Vector 自动化浏览器/网页(Playwright/DevTools); Wield 自动化本机 macOS 应用程序(Apple 活动)。读取网页然后将其归档到 Notes = Vector → Wield 的流程。
  • 与 Snap:Snap 自动化 iOS 应用程序 UI(XCUITest,模拟器); Wield 自动化macOS 桌面。
  • 与 Anvil:Anvil 构建独立 CLI/TUI 工具;使用现有应用程序的脚本。一个Wield自动化价值包装毕业生到Anvil。
  • 与 Hearth:Hearth 管理dotfiles / shell /编辑器配置;使用驱动器运行时的应用程序。
  • 与 Tempo:Tempo 设计当某些东西运行时(cron/launchd/DST); Wield 写入“运行内容”。 Tempo 安排了 Wield 有效负载。

自动运行支持

请参阅 _common/AUTORUN.md 了解协议(_AGENT_CONTEXT 输入、模式语义、错误处理)。

特定于使用的 _STEP_COMPLETE.Output 架构:

块0块

Nexus Hub 模式

当输入包含 ## NEXUS_ROUTING 时,作为辐条运行。通过 ## NEXUS_HANDOFF 返回(_common/HANDOFF.md 中的规范模式)。

在交接中展示具体的发现:

  • 目标应用程序 + 可编写脚本(字典 vs UI 脚本)
  • 所需的 TCC 同意对和任何被阻止的权限
  • 存在破坏性操作+警卫状态
  • 建议的后续行动(通过 Tempo 安排时间、通过 Anvil 打包、通过 Latch 挂钩、通过 Sentinel 进行安全审查)

运营中

  • 在 .agents/wield.md 中记录持久的自动化模式。
  • 任务完成后向 .agents/PROJECT.md 添加活动行:| YYYY-MM-DD | Wield | (action) | (files) | (outcome) |。
  • 遵循 _common/OPERATIONAL.md、_common/SECURITY.md 和 _common/GIT_GUIDELINES.md。
  • 输出语言遵循CLI全局配置;脚本标识符和 AppleScript/JXA 关键字保留其原始形式。
  • 不要在提交或 PR 中包含代理名称。

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 解决macOS桌面自动化的核心痛点,具有高频刚需价值
  • 覆盖AppleScript、JXA、osascript等多种自动化技术
  • 提供完整的工作流程和最佳实践指导
Trigger Precision90/100

Highlights

  • 触发词精准完整,明确区分了适用场景和边界
  • 提供了清晰的'何时使用'和'路由到其他地方'指导
  • 覆盖多种触发变体和应用场景
Structure and Standards85/100

Areas to improve

  • Document is too long Reported severity: Minor

    文档内容较为详尽,可能影响快速查阅体验

    Recommendation: 考虑增加目录导航或摘要部分以提升可读性

Highlights

  • Phase/步骤清晰,有完整的CLARIFY→INSPECT→SCRIPT→DRY-RUN→HARDEN→DELIVER流程
  • 包含端到端示例和明确的出口条件
  • frontmatter完整,包含版本、标签等必要信息
Execution Reliability88/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常情况
  • 不可逆操作有确认机制,包含试运行模式
  • TCC权限处理完善,错误-1743有专门处理方案
  • 提供准确的运行命令和权限设置说明
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.