lov-finder-action
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFinder 快捷动作 · Finder Actions
Finder Quick Action · Finder Actions
创建 macOS Finder 文件快捷操作或目录背景菜单扩展。
Create macOS Finder file quick actions or directory background menu extensions.
Triggers
Triggers
Activate when
Activate when
- “创建 macOS Finder 文件快捷操作或目录背景菜单扩展。”
- “Create a Finder context menu action.”
- “Create a macOS Finder file quick action or directory background menu extension.”
- “Create a Finder context menu action.”
Do not activate when
Do not activate when
- 只是查询本 Skill 的说明,或请求与上述结果无关的任务;不执行实际业务操作。
- 用户仅要预览或审查时,不进入修改、提交或发布分支。
- The request is merely to query this Skill's documentation or asks for a task unrelated to the results above; do not perform any actual business operations.
- The user only wants a preview or review; do not enter the modification, commit, or publishing branch.
Execution boundary
Execution boundary
自然语言请求即可触发;无需旧 slash 路径、参数插值或指定助手。明确解析当前请求中的
项目、目标文件、选项与输出位置;用当前宿主实际提供的文件、搜索、CLI 和浏览器能力。
项目依赖版本与外部 API 在执行时核实,不能假设示例是现行配置。随包脚本从 Skill 根解析,
业务文件从目标项目根解析。先读当前状态,保护已有未提交内容与其他任务的暂存区。
分析、预览请求保持只读;修改、提交、推送、部署和发布各依当前请求的明确范围执行。
不绕过保护、自动发送消息、强制结束用户进程或抢前台。失败保留可诊断原始错误。
A natural-language request is sufficient to trigger this; no legacy slash path, argument interpolation, or designated assistant is required. Explicitly parse the project, target files, options, and output location from the current request; use the file, search, CLI, and browser capabilities actually provided by the current host.
Project dependency versions and external APIs must be verified at execution time; do not assume that examples represent current configurations. Packaged scripts are resolved from the Skill root, while business files are resolved from the target project root. Read the current state first and protect existing uncommitted changes and the staging area used by other tasks.
Analysis and preview requests remain read-only; modifications, commits, pushes, deployments, and releases proceed only within the explicit scope of the current request.
Do not bypass protections, automatically send messages, forcibly terminate user processes, or take over the foreground. On failure, preserve the original diagnostic error.
Workflow
Workflow
-
根据是否需要选中文件选择 Automator Quick Action 或 Finder Sync Extension;解析动作名称、文件类型、实际处理逻辑与目标目录。
-
Quick Action 使用按参数接收的脚本(,
inputMethod=1)与 workflow plist,工具路径从实际安装解析,处理中文、空格、多选和同名输出;按下文「Quick Action 安装」从 document.wflow 模板 与 Info.plist 模板 生成,并核验当前系统字段。"$@" -
Finder Extension 使用实际 Xcode 工具链、独立 bundle ID、必要沙盒权限和精确监控目录,菜单 action 明确 target;按当前 Apple 文档核实能力,不要求整个磁盘临时例外权限。
-
需要跨进程 helper 时使用可验证的结构化消息和固定操作集合,不从剪贴板读取任意 shell 命令,不用 helper 绕过系统权限。
-
生成构建配置和代码后检查 plist、编译及扩展注册;本地 ad-hoc 签名与可分发签名分别报告,不将前者称作正式发行。
-
不强制 killall Finder、打开 Automator 或切换应用前台;需用户启用扩展的步骤准确说明。实际菜单触发只有完成观察后才标验证。
-
保留现有 workflow 与应用,明确安装位置和回退路径;不覆盖同名菜单动作。
-
Choose an Automator Quick Action or a Finder Sync Extension based on whether selected files are required; parse the action name, file type, actual processing logic, and target directory.
-
A Quick Action uses a script that receives arguments (,
inputMethod=1) and a workflow plist. Resolve tool paths from the actual installation and handle Chinese characters, spaces, multiple selections, and same-name outputs. Generate the files from the document.wflow template and Info.plist template as described under “Quick Action Installation” below, and verify the current system fields."$@" -
A Finder Extension uses the actual Xcode toolchain, a standalone bundle ID, necessary sandbox permissions, and precisely monitored directories. The menu action must have an explicit target. Verify capabilities against the current Apple documentation and do not require temporary access exceptions for the entire disk.
-
When a cross-process helper is needed, use verifiable structured messages and a fixed set of operations. Do not read arbitrary shell commands from the clipboard or use a helper to bypass system permissions.
-
After generating the build configuration and code, inspect the plist, compile the project, and verify extension registration. Report local ad-hoc signing and distributable signing separately; do not describe the former as a formal release.
-
Do not force, open Automator, or bring an application to the foreground. Accurately explain the steps required for the user to enable the extension. Mark an actual menu trigger as verified only after observing it.
killall Finder -
Preserve existing workflows and applications, and clearly identify the installation location and rollback path. Do not overwrite a menu action with the same name.
Quick Action 安装
Quick Action Installation
document.wflowinputMethod=1shell=/bin/bashcom.apple.Automator.fileSystemObjectworkflowTypeIdentifier=com.apple.Automator.servicesMenupresentationMode=15com.apple.Automator.nothingInfo.plistNSRequiredContextNSApplicationIdentifier=com.apple.finderpbsNSServicesStatusContextMenu = 1SHELL_SCRIPTACTION_NAMEplutilSKILL_DIRbash
NAME="动作名称" # 菜单显示名,同时是 workflow 包名
DEST="$HOME/Library/Services/$NAME.workflow"
[ -e "$DEST" ] && { echo "同名 workflow 已存在:$DEST" >&2; exit 1; }
bash -n action.sh # 已写好的处理脚本
STAGE="$(mktemp -d)/$NAME.workflow"; mkdir -p "$STAGE/Contents"
cp "$SKILL_DIR/references/automator-template.xml" "$STAGE/Contents/document.wflow"
cp "$SKILL_DIR/references/automator-info-template.xml" "$STAGE/Contents/Info.plist"
plutil -replace actions.0.action.ActionParameters.COMMAND_STRING -string "$(cat action.sh)" "$STAGE/Contents/document.wflow"
plutil -replace NSServices.0.NSMenuItem.default -string "$NAME" "$STAGE/Contents/Info.plist"
plutil -replace NSServices.0.NSSendFileTypes -json '["com.adobe.pdf"]' "$STAGE/Contents/Info.plist" # 按目标 UTI;文件与文件夹通用保留 public.item
plutil -lint "$STAGE/Contents/document.wflow" "$STAGE/Contents/Info.plist"
plutil -extract NSServices.0.NSRequiredContext json -o - "$STAGE/Contents/Info.plist" # 应为 com.apple.finder
diff <(plutil -extract actions.0.action.ActionParameters.COMMAND_STRING raw -o - "$STAGE/Contents/document.wflow") action.sh
mv -n "$STAGE" "$DEST"
/System/Library/CoreServices/pbs -update- 同名 workflow 已存在时停止,换名或询问用户;不覆盖、不合并。lint 或 diff 失败时只丢弃 staging 目录。
- 不执行 ,不自动打开 Automator。
killall Finder - 回退路径:把 移到废纸篓(
$DEST)后再次运行mv "$DEST" ~/.Trash/。pbs -update - 报告安装路径与回退命令;实际右键触发经观察后才标记已验证。
The template contains only a Run Shell Script action: , , input , , , output , with Finder as the service application. The template retains (), which is Apple's requirement for a service to appear automatically. However, this alone is insufficient: testing on macOS 26.6 shows that a newly installed service, even with this key, appears under Finder's context menu “Quick Actions” only after the user selects it under the context menu “Quick Actions → Customize…”, and the preferences record in . This preference belongs to System Settings. The Agent must not write it on the user's behalf; instead, guide the user through the single step described under “Enabling” below. Both the script placeholder and the menu-name placeholder must be written with , which automatically handles XML escaping; never concatenate XML manually. refers to the root of this Skill.
document.wflowinputMethod=1shell=/bin/bashcom.apple.Automator.fileSystemObjectworkflowTypeIdentifier=com.apple.Automator.servicesMenupresentationMode=15com.apple.Automator.nothingInfo.plistNSRequiredContextNSApplicationIdentifier=com.apple.finderpbsContextMenu = 1NSServicesStatusSHELL_SCRIPTACTION_NAMEplutilSKILL_DIRbash
NAME="动作名称" # 菜单显示名,同时是 workflow 包名
DEST="$HOME/Library/Services/$NAME.workflow"
[ -e "$DEST" ] && { echo "同名 workflow 已存在:$DEST" >&2; exit 1; }
bash -n action.sh # 已写好的处理脚本
STAGE="$(mktemp -d)/$NAME.workflow"; mkdir -p "$STAGE/Contents"
cp "$SKILL_DIR/references/automator-template.xml" "$STAGE/Contents/document.wflow"
cp "$SKILL_DIR/references/automator-info-template.xml" "$STAGE/Contents/Info.plist"
plutil -replace actions.0.action.ActionParameters.COMMAND_STRING -string "$(cat action.sh)" "$STAGE/Contents/document.wflow"
plutil -replace NSServices.0.NSMenuItem.default -string "$NAME" "$STAGE/Contents/Info.plist"
plutil -replace NSServices.0.NSSendFileTypes -json '["com.adobe.pdf"]' "$STAGE/Contents/Info.plist" # 按目标 UTI;文件与文件夹通用保留 public.item
plutil -lint "$STAGE/Contents/document.wflow" "$STAGE/Contents/Info.plist"
plutil -extract NSServices.0.NSRequiredContext json -o - "$STAGE/Contents/Info.plist" # 应为 com.apple.finder
diff <(plutil -extract actions.0.action.ActionParameters.COMMAND_STRING raw -o - "$STAGE/Contents/document.wflow") action.sh
mv -n "$STAGE" "$DEST"
/System/Library/CoreServices/pbs -update- If a workflow with the same name already exists, stop and either change the name or ask the user; do not overwrite or merge it. If lint or diff fails, discard only the staging directory.
- Do not execute or automatically open Automator.
killall Finder - Rollback path: move to the Trash with
$DEST, then runmv "$DEST" ~/.Trash/again.pbs -update - Report the installation path and rollback command. Mark the actual context-menu trigger as verified only after observing it.
启用
Enabling
安装后立即只读检查是否已进右键菜单( 经 cfprefsd 读取,PlistBuddy 不受中文转义影响):
defaults exportbash
P="$(mktemp)"; defaults export pbs "$P"
/usr/libexec/PlistBuddy -c "Print ':NSServicesStatus:(null) - $NAME - runWorkflowAsService:presentation_modes:ContextMenu'" "$P" 2>/dev/null || echo "未启用"
rm -f "$P"- 输出 :已启用,直接报告。
true - 未启用:在安装结果的同一条回复里只给用户一步——勾选该动作(一次装多个时列出全部名称,一次勾完),并附上直达设置页的命令。这是 Finder「快速操作 → 自定…」打开的同一页面;用户同意后可代为执行,不自行改写 偏好:
pbs
bash
open "x-apple.systempreferences:com.apple.ExtensionsPreferences?extensionPointIdentifier=com.apple.finder-quick-actions"- 用户回复已勾选后重跑检查,输出 才报告已启用。
true
Immediately after installation, perform a read-only check to determine whether the action appears in the context menu. reads through cfprefsd, while PlistBuddy is unaffected by Chinese-character escaping:
defaults exportbash
P="$(mktemp)"; defaults export pbs "$P"
/usr/libexec/PlistBuddy -c "Print ':NSServicesStatus:(null) - $NAME - runWorkflowAsService:presentation_modes:ContextMenu'" "$P" 2>/dev/null || echo "未启用"
rm -f "$P"- If the output is , the action is enabled; report it directly.
true - If it is not enabled, provide only one step in the same reply as the installation result: select the action. When installing multiple actions, list all names and have the user select them together. Include the command that opens the settings page directly. This is the same page opened through Finder's “Quick Actions → Customize…”. You may execute it on the user's behalf after they consent, but do not modify the preferences yourself:
pbs
bash
open "x-apple.systempreferences:com.apple.ExtensionsPreferences?extensionPointIdentifier=com.apple.finder-quick-actions"- After the user confirms that the action has been selected, rerun the check. Report the action as enabled only when the output is .
true
Composition
Composition
执行前读取 能力组合,按明确制品交接相邻能力。
Before execution, read capability composition and hand off adjacent capabilities according to explicit artifacts.
Runtime context (shared)
Runtime context (shared)
运行前读取本包 与 Profile 合同。优先级为当前请求、
项目上下文、本 Skill records、共享 preferences、brand/user Profile、安全默认值。
只读取声明字段;没有专用运行时的宿主可使用 读取共享 Profile。
配置缺失只问影响结果的一个问题。用户明确要求长期保存的值通过该脚本原子写入,
报告实际路径;不保存推断、凭据或其他任务的资料。
skill.yamlscripts/profile_store.pyBefore execution, read this package's and Profile contract. The priority order is the current request, project context, this Skill's records, shared preferences, brand/user Profile, and security defaults.
Read only declared fields. Hosts without a dedicated runtime may use to read the shared Profile. If configuration is missing, ask only one question that affects the result. Values the user explicitly requests to store long-term are written atomically through this script, and their actual paths must be reported. Do not store inferred information, credentials, or data from other tasks.
skill.yamlscripts/profile_store.py通用反馈闭环
General Feedback Loop
用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
- 先判断意见是 (仅本次)还是
task-specific(可跨任务复用)。reusable - 只修改当前任务,不改 Skill。
task-specific - 先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。
reusable - 完成规则更新、版本、lint 与分发核验后,再把修改应用到当前任务。
- 修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。
reusable
When a user provides revision feedback during a Skill-driven task, the following steps must be performed before continuing the current artifact:
- First determine whether the feedback is (for this task only) or
task-specific(applicable across tasks).reusable - For feedback, modify only the current task and do not modify the Skill.
task-specific - For feedback, first determine its scope. Update the corresponding canonical Skill for domain-specific rules; for rules applicable to all Skills, update the shared specification first.
reusable - Complete the rule update, versioning, linting, and distribution verification before applying the modification to the current task.
- A modification invalidates earlier confirmations such as “confirmed,” “continue,” or “ship it.” After completing the current artifact modifications and read-back, stop and wait for the user's next instruction. Do not automatically proceed to publishing, committing, or other external writes.
reusable