easytouch-macos 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. package/LICENSE.txt +201 -0
  2. package/README.md +161 -0
  3. package/SKILL.md +366 -0
  4. package/bin/et +0 -0
  5. package/package.json +18 -0
package/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # EasyTouch
2
+
3
+ 跨平台系统自动化操作工具,支持 Windows、Linux、macOS。提供 CLI 命令行和 MCP 服务器两种使用方式,支持鼠标键盘控制、屏幕截图、窗口管理、系统信息查询等功能。
4
+
5
+ 目前:
6
+
7
+ - [x] Windows
8
+
9
+ - [x] Linux
10
+ - [ ] MAC(目前缺少设备验证功能)
11
+
12
+ 大家平时使用各类 AI 编程工具,写页面是不是经常碰到 AI 写的页面怎么也不满意,写出来跟设计稿差异很大,这是因为 AI 只能通过读写代码来改进代码,它看不到界面,不像人类有感官。
13
+
14
+ 所以 EasyTouch 是给 AI 装上手和眼睛。
15
+
16
+
17
+
18
+ **你能用它做什么?**
19
+
20
+ - 系统信息:系统、CPU、内存、磁盘、进程
21
+ - 屏幕能力:显示器枚举、像素取色、截图
22
+ - 窗口控制:枚举、查找、激活、关闭、前台窗口读取
23
+ - 输入控制:鼠标移动/点击/滚轮,键盘按键/组合键/输入/粘贴
24
+ - 剪贴板:读文本、写文本、读文件列表
25
+ - 等待器:等待窗口、焦点、像素、剪贴板、进程状态
26
+ - 应用启动:按路径或 URI 启动目标
27
+
28
+
29
+
30
+ ### 安装
31
+
32
+ 按照操作系统安装,安装命令:
33
+
34
+ ```
35
+ # Windows
36
+ npm i -g easytouch-windows
37
+
38
+ # Linux
39
+ npm i -g easytouch-linux
40
+
41
+ # macOS
42
+ npm i -g easytouch-mac
43
+ ```
44
+
45
+
46
+
47
+ ### 使用示例
48
+
49
+
50
+
51
+
52
+
53
+ ### 作为 Skills 给 AI 使用
54
+
55
+ 只需要执行命令安装 skills 即可。
56
+
57
+ ```bash
58
+ npx skills add https://github.com/whuanle/EasyTouch
59
+ ```
60
+
61
+
62
+
63
+ 注:skills 里面不带脚本,需提前使用 `npm i easytouch-windows` 安装工具。
64
+
65
+ ![image-20260224090411080](images/image-20260224090411080.png)
66
+
67
+
68
+
69
+ ### 作为 MCP 工具使用
70
+
71
+ 如果只是给 AI 工具使用,建议使用 skills 即可,配置 MCP 可能会麻烦一些。
72
+
73
+ 在 Claude、Cursor 等工具中,配置 MCP 的方式都是大同小异,通过 npm/bun 等方式安装的 EasyTouch,程序文件在 `$basedir/node_modules/easytouch-windows` 下面,。
74
+
75
+
76
+
77
+ 在配置文件中添加:
78
+
79
+ **Windows**
80
+
81
+ ```json
82
+ {
83
+ "mcpServers": {
84
+ "easytouch": {
85
+ "command": "C:\\path\\to\\et.exe",
86
+ "args": ["--mcp"]
87
+ }
88
+ }
89
+ }
90
+ ```
91
+
92
+ **NPM 安装方式**
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "easytouch": {
98
+ "command": "npx",
99
+ "args": ["-y", "easytouch-windows", "--mcp"]
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ **Linux / macOS**
106
+
107
+ ```json
108
+ {
109
+ "mcpServers": {
110
+ "easytouch": {
111
+ "command": "/path/to/et",
112
+ "args": ["--mcp"]
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+
119
+
120
+
121
+
122
+ ### 平台说明
123
+
124
+ Windows
125
+
126
+ - 完全支持所有功能
127
+ - 部分功能可能需要管理员权限
128
+
129
+ Linux
130
+
131
+ - 官方验证环境:Ubuntu Desktop(22.04 / 24.04)
132
+ - 其他发行版和桌面环境为 best-effort,建议先用测试脚本验证
133
+ - 建议在图形界面环境中使用(优先 X11 会话)
134
+ - 有些功能可能需要 sudo 管理员权限
135
+
136
+ Linux 依赖可手动安装(Ubuntu):
137
+
138
+ ```bash
139
+ # 基础依赖(推荐)
140
+ sudo apt install xdotool xclip xsel imagemagick gnome-screenshot
141
+
142
+ # Wayland 补充依赖(按需)
143
+ sudo apt install ydotool wl-clipboard grim
144
+ ```
145
+
146
+ 安装后可执行脚本测试兼容性:
147
+
148
+ ```bash
149
+ node scripts/test-easytouch.js --cli-only --verbose
150
+ ```
151
+
152
+ macOS
153
+
154
+ - 需要授予辅助功能权限(系统设置 → 隐私与安全性 → 辅助功能)
155
+ - 截图功能需要屏幕录制权限
156
+
157
+
158
+
159
+ ## 许可证
160
+
161
+ MIT License
package/SKILL.md ADDED
@@ -0,0 +1,366 @@
1
+ ---
2
+ name: easytouch
3
+ description: EasyTouch Skill 接入文档(CLI + MCP)。
4
+ ---
5
+
6
+ # EasyTouch Skill
7
+
8
+ ## 环境要求
9
+
10
+ 使用 npm 安装时:Node.js >= 18(npm 安装场景)
11
+
12
+ > 直接从 Github Release 下载文件后添加环境变量。
13
+
14
+
15
+
16
+ ## 安装方式
17
+
18
+ ### npm 安装
19
+
20
+ ```bash
21
+ npm install easytouch
22
+ ```
23
+
24
+ 安装后命令入口:
25
+
26
+ ```bash
27
+ et help
28
+ ```
29
+
30
+
31
+
32
+ ## CLI 命令
33
+
34
+ ### 核心命令
35
+
36
+ ```bash
37
+ # 显示命令总览与参数格式
38
+ et help
39
+
40
+ # 显示当前运行时状态与主机平台信息
41
+ et status
42
+
43
+ # 列出各平台实现状态与能力模块
44
+ et platforms
45
+
46
+ # 显示 CLI/MCP 接口与能力映射概览
47
+ et interfaces
48
+
49
+ # 显示能力接入和运行时要求清单
50
+ et requirements
51
+
52
+ # 启动 MCP stdio 服务
53
+ et mcp-stdio
54
+
55
+ # 输出 MCP manifest(工具清单)JSON
56
+ et mcp-stdio --output json
57
+ ```
58
+
59
+
60
+
61
+ ### 自动化命令
62
+
63
+ 默认命令执行输出结果内容为 json,如需直接输出文本可使用 `-output text` 指定。
64
+
65
+
66
+
67
+ #### 系统信息
68
+
69
+ | 命令 | 用途 |
70
+ | --- | --- |
71
+ | `system os-info` | 读取操作系统版本、架构、主机名等信息 |
72
+ | `system cpu-info` | 读取 CPU 架构与核心信息 |
73
+ | `system memory-info` | 读取内存总量、可用量与占用情况 |
74
+ | `system disk-list` | 列出磁盘与容量信息 |
75
+ | `system process-list` | 列出当前进程列表 |
76
+ | `system hardware-info` | 读取硬件概览(架构、核心、页大小、物理内存、虚拟内存、机器名) |
77
+ | `system network-info` | 读取网络适配器信息(IPv4、MAC、网卡类型、DHCP 状态) |
78
+
79
+ 平台说明:
80
+
81
+ - Windows:全部可用。
82
+ - Linux:整体可用,`system network-info` 依赖 `ip` 命令。
83
+ - macOS:整体可用,信息主要来自 `sysctl`、`vm_stat`、`ifconfig` 等系统命令。
84
+
85
+
86
+
87
+ #### 鼠标操作
88
+
89
+ | 命令 | 用途 |
90
+ | --- | --- |
91
+ | `mouse position` | 读取当前鼠标坐标 |
92
+ | `mouse move --x <x> --y <y> [--duration-ms <ms>] [--jitter-px <px>] [--step-delay-ms <ms>]` | 以渐进轨迹移动鼠标,支持抖动与延迟,更接近人类操作 |
93
+ | `mouse click [--button <left\|right\|middle>] [--count <n>]` | 执行鼠标点击 |
94
+ | `mouse scroll --delta <amount>` | 执行鼠标滚轮滚动 |
95
+
96
+ 平台说明:
97
+
98
+ - Windows:全部可用。
99
+ - Linux:依赖 `xdotool`,并要求运行在 X11 或 XWayland 会话中;Wayland 原生会话下可能被桌面环境限制。
100
+ - macOS:依赖系统 Accessibility 权限;未授权时鼠标读取和注入会失败。
101
+
102
+
103
+
104
+ 参数说明:
105
+
106
+ - `--x` / `--y`:目标坐标(整数)
107
+ - `--duration-ms`:总移动时长(毫秒),默认 `280`
108
+ - `--jitter-px`:轨迹抖动幅度(像素),默认 `3`
109
+ - `--step-delay-ms`:每一步移动间隔(毫秒),默认 `8`
110
+ - `--button`:按键类型,`left`、`right`、`middle`
111
+ - `--count`:点击次数,默认 `1`
112
+ - `--delta`:滚动量,正负值分别代表不同方向
113
+
114
+
115
+
116
+ #### 窗口与应用
117
+
118
+ | 命令 | 用途 |
119
+ | --- | --- |
120
+ | `window list [--include-hidden] [--pid <pid>]` | 列出窗口,可按可见性和进程过滤 |
121
+ | `window foreground` | 读取当前前台窗口信息 |
122
+ | `window find --title <text> [--match <contains\|exact>] [--include-hidden] [--pid <pid>]` | 按标题查找窗口 |
123
+ | `window activate --handle <handle>` | 按句柄激活窗口 |
124
+ | `window show --handle <handle>` | 显示窗口并请求激活 |
125
+ | `window minimize --handle <handle>` | 最小化窗口 |
126
+ | `window maximize --handle <handle>` | 最大化窗口 |
127
+ | `window restore --handle <handle>` | 恢复窗口(从最小化/最大化) |
128
+ | `window move --handle <handle> --x <x> --y <y> [--width <n>] [--height <n>]` | 拖曳/移动窗口到指定坐标,可选调整尺寸 |
129
+ | `window close --handle <handle>` | 按句柄请求关闭窗口 |
130
+ | `app launch --target <path-or-uri>` | 启动应用、打开文件或 URI |
131
+
132
+ 平台说明:
133
+
134
+ - Windows:全部可用。
135
+ - Linux:`window list`、`window foreground`、`window activate`、`window close` 可用;`window show`、`window minimize` 依赖 `xdotool`,`window maximize`、`window restore`、`window move` 依赖 `wmctrl` 和兼容 EWMH 的窗口管理器。
136
+ - Linux:整体要求 X11 或 XWayland 会话,Wayland 原生会话下窗口句柄和控制能力可能受限。
137
+ - macOS:窗口控制依赖 Accessibility 和 Automation 权限;`window show`、`window minimize`、`window maximize`、`window restore`、`window move`、`window close` 通过 `System Events` 操作,若同一进程里有多个同名窗口,系统会按首个匹配窗口执行。
138
+
139
+ 参数说明:
140
+ - `--title`:窗口标题关键字
141
+ - `--match`:匹配模式,`contains` 或 `exact`
142
+ - `--include-hidden`:包含隐藏窗口
143
+ - `--pid`:按进程 ID 过滤
144
+ - `--handle`:窗口句柄(非负整数)
145
+ - `--x` / `--y`:窗口目标位置
146
+ - `--width` / `--height`:窗口目标尺寸(可选,不传则保持原尺寸)
147
+ - `--target`:可执行路径、文件路径或 URI
148
+
149
+
150
+
151
+ #### 剪贴板
152
+
153
+ | 命令 | 用途 |
154
+ | --- | --- |
155
+ | `clipboard get-text` | 读取剪贴板文本 |
156
+ | `clipboard set-text --text <value>` | 写入剪贴板文本 |
157
+ | `clipboard get-files` | 读取剪贴板中的文件列表 |
158
+ | `clipboard set-files --paths <path1;path2;...>` | 写入剪贴板文件列表(用于后续粘贴文件) |
159
+ | `clipboard set-image --path <image-file>` | 写入剪贴板图片(用于后续粘贴图片) |
160
+
161
+ 平台说明:
162
+
163
+ - Windows:全部可用。
164
+ - Linux:依赖 `wl-copy` / `wl-paste` 或 `xclip` / `xsel`;缺少这些工具时,对应文本、文件、图片剪贴板能力不可用。
165
+ - macOS:文本剪贴板通过 `pbcopy` / `pbpaste`;文件和图片剪贴板通过 `osascript` / JXA 写入,若宿主进程缺少 Automation 权限可能失败。
166
+
167
+ 参数说明:
168
+ - `--text`:要写入的文本内容
169
+ - `--paths`:多个文件路径,使用分号 `;` 分隔
170
+ - `--path`:单个图片文件路径
171
+
172
+
173
+
174
+ #### 键盘操作
175
+
176
+ | 命令 | 用途 |
177
+ | --- | --- |
178
+ | `keyboard key --key <name>` | 发送单个按键 |
179
+ | `keyboard hotkey --keys <combo>` | 发送组合键 |
180
+ | `keyboard type --text <value>` | 直接注入文本内容(直输模式) |
181
+ | `keyboard type-keys --text <value> [--key-delay-ms <ms>]` | 按键位逐字输入(模拟人类打字模式) |
182
+ | `keyboard ime-switch [--strategy <win-space\|alt-shift\|ctrl-shift>]` | 切换输入法 |
183
+ | `keyboard caps-lock [--state <toggle\|on\|off>]` | 控制大小写状态 |
184
+ | `keyboard paste [--expect-title <text>] [--match <contains\|exact>]` | 发送粘贴动作,可加窗口标题保护 |
185
+
186
+ 平台说明:
187
+
188
+ - Windows:全部可用。
189
+ - Linux:依赖 `xdotool`,并要求运行在 X11 或 XWayland 会话中;Wayland 原生会话下键盘注入通常不稳定或被系统阻止。
190
+ - macOS:依赖 Accessibility 权限;`keyboard ime-switch` 的策略会映射到系统快捷键,是否真正切换输入法取决于系统当前输入源绑定。
191
+ - macOS:`keyboard caps-lock` 目前仅稳定支持 `toggle`,`on` / `off` 仍不保证可用。
192
+
193
+ 参数说明:
194
+ - `--key`:按键名(如 `enter`、`esc`、`f5`)
195
+ - `--keys`:组合键(如 `ctrl+c`、`ctrl+shift+s`)
196
+ - `--text`:输入文本
197
+ - `--key-delay-ms`:模拟键位输入时每个按键之间的延迟
198
+ - `--strategy`:输入法切换快捷键策略
199
+ - `--state`:大小写状态,`toggle`、`on`、`off`
200
+ - `--expect-title`:执行粘贴前要求前台窗口标题匹配
201
+ - `--match`:标题匹配模式,`contains` 或 `exact`
202
+
203
+
204
+
205
+ #### 屏幕与截图
206
+
207
+ | 命令 | 用途 |
208
+ | --- | --- |
209
+ | `screen displays` | 列出显示器与分辨率信息 |
210
+ | `screen pixel-color --x <x> --y <y>` | 读取指定像素颜色 |
211
+ | `screen capture [--path <file>] [--display-id <id>] [--window-handle <handle>]` | 默认截取所有屏幕,或按屏幕/窗口定向截图 |
212
+
213
+ 平台说明:
214
+
215
+ - Windows:全部可用。
216
+ - Linux:`screen displays` 依赖 `xrandr`,`screen capture` 依赖 `grim`、`gnome-screenshot`、`scrot` 或 `import` 之一。
217
+ - Linux:`screen capture --display-id` 和 `screen capture --window-handle` 仍未实现,当前只保证整桌面截图。
218
+ - Linux:Wayland 原生会话下,截图和像素读取可能受桌面权限或会话类型限制。
219
+ - macOS:`screen capture` 依赖系统 `screencapture` 命令;若系统未授予屏幕录制权限,截图或像素读取会失败。
220
+ - macOS:支持 `--display-id` 与 `--window-handle` 定向截图,但前提是目标窗口仍存在于当前 CoreGraphics 快照中。
221
+
222
+ 参数说明:
223
+ - `--x` / `--y`:像素坐标
224
+ - `--path`:截图输出路径,不传则使用默认路径
225
+ - `--display-id`:指定屏幕 ID(来自 `screen displays`)
226
+ - `--window-handle`:指定窗口句柄(来自 `window list` / `window foreground`)
227
+
228
+ ```bash
229
+ # 默认:截取所有屏幕
230
+ screen capture --path ./captures/all.png
231
+
232
+ # 截取指定屏幕
233
+ screen capture --display-id 1 --path ./captures/display-1.png
234
+
235
+ # 截取指定窗口
236
+ screen capture --window-handle 0x001A09F2 --path ./captures/window.png
237
+ ```
238
+
239
+
240
+
241
+ #### 等待器
242
+
243
+ 等待器用于“动作后确认状态”,避免脚本只执行动作却不验证结果。
244
+ 典型用法:点击/输入/窗口切换之后,先等待目标条件成立,再继续下一步。
245
+ 这样可以降低因为界面刷新延迟、窗口抢焦点、颜色尚未变化导致的误操作。
246
+
247
+ | 命令 | 用途 |
248
+ | --- | --- |
249
+ | `wait window --title <text> [--timeout-ms <ms>] [--match <contains\|exact>] [--foreground-only]` | 等待目标窗口出现或满足前台条件 |
250
+ | `wait focus --title <text> [--timeout-ms <ms>] [--match <contains\|exact>]` | 等待焦点窗口标题匹配 |
251
+ | `wait activate --handle <handle> [--expect-active <true\|false>] [--timeout-ms <ms>]` | 监听指定窗口句柄是否成为前台激活窗口(或等待其失去激活) |
252
+ | `wait pixel --x <x> --y <y> --hex <RRGGBB> [--timeout-ms <ms>]` | 等待指定像素达到目标颜色 |
253
+ | `wait clipboard [--expect-text <value>] [--timeout-ms <ms>] [--match <contains\|exact>]` | 等待剪贴板变化或匹配目标文本 |
254
+ | `wait process [--name <text>\|--pid <pid>] [--expect-running <true\|false>] [--timeout-ms <ms>] [--match <contains\|exact>]` | 等待进程进入期望状态 |
255
+
256
+ 平台说明:
257
+
258
+ - Windows:全部可用。
259
+ - Linux:等待器本身可用,但会继承底层能力依赖;例如 `wait activate` 依赖 X11/XWayland 窗口焦点能力,`wait clipboard` 依赖剪贴板后端工具,`wait pixel` 依赖图形会话可读。
260
+ - macOS:等待器整体可用,但 `wait activate`、`wait clipboard`、`wait pixel` 等同样受系统权限和图形会话状态影响。
261
+
262
+ 参数说明:
263
+ - `--timeout-ms`:最长等待时间(毫秒),超时会返回失败
264
+ - `--match`:文本匹配模式,`contains` 或 `exact`
265
+ - `--foreground-only`:仅匹配当前前台窗口(仅 wait window)
266
+ - `--handle`:目标窗口句柄(用于 wait activate)
267
+ - `--expect-active`:`true` 等待激活,`false` 等待失去激活
268
+ - `--expect-text`:剪贴板期望文本,不传则等待任意变化
269
+ - `--name` / `--pid`:进程名称或进程 ID
270
+ - `--expect-running`:期望进程是否存在,`true` 表示等待启动,`false` 表示等待退出
271
+
272
+
273
+
274
+ 复杂参数组合示例:
275
+
276
+ ```bash
277
+ # 标题精确匹配 + 只接受前台窗口
278
+ wait window --title "记事本" --match exact --foreground-only --timeout-ms 5000
279
+
280
+ # 监听窗口激活(句柄来自 window list)
281
+ wait activate --handle 0x001A09F2 --expect-active true --timeout-ms 5000
282
+
283
+ # 颜色等待(十六进制)
284
+ wait pixel --x 100 --y 200 --hex FFCC00 --timeout-ms 3000
285
+
286
+ # 进程退出等待
287
+ wait process --name "chrome" --expect-running false --match contains --timeout-ms 10000
288
+ ```
289
+
290
+
291
+
292
+ ## 注意事项
293
+
294
+ 功能按照 Windows 设计,以上所有功能在 Windows 下均可用,Linux 和 macOS 已补齐大部分常用能力,但仍有平台依赖和少量限制,使用前需要先确认桌面会话、系统权限和命令行工具是否满足。
295
+
296
+ Linux:
297
+
298
+ - 鼠标、键盘、窗口控制依赖 `xdotool`,并要求运行在 X11 或 XWayland 会话里。
299
+ - `window maximize`、`window restore`、`window move` 依赖 `wmctrl` 和兼容 EWMH 的窗口管理器。
300
+ - 剪贴板文本/文件/图片依赖 `wl-copy` / `wl-paste` 或 `xclip` / `xsel`。
301
+ - `screen displays` 依赖 `xrandr`,`screen capture` 依赖 `grim`、`gnome-screenshot`、`scrot` 或 `import` 之一。
302
+ - `system network-info` 依赖 `ip` 命令。
303
+ - `screen capture --display-id` 和 `screen capture --window-handle` 在 Linux 仍未实现,当前只保证整桌面截图。
304
+ - Wayland 原生会话下,部分窗口句柄、键鼠注入、像素读取和窗口控制可能被桌面环境限制;X11/XWayland 兼容性更好。
305
+
306
+ macOS:
307
+
308
+ - 窗口控制、键盘输入、剪贴板文件/图片等自动化依赖系统的 Accessibility 和 Automation 授权;如果宿主进程没有权限,命令会失败。
309
+ - `window show`、`window minimize`、`window maximize`、`window restore`、`window move`、`window close` 通过 `System Events` 操作窗口;如果同一进程里有多个同名窗口,系统会按首个匹配窗口执行。
310
+ - `keyboard ime-switch` 在 macOS 下做了策略映射:`win-space` 对应 `Command+Space`,`alt-shift` 对应 `Option+Space`,`ctrl-shift` 对应 `Control+Space`。是否真正切换输入法,取决于系统当前输入源快捷键绑定。
311
+ - `keyboard caps-lock` 目前只支持 `toggle`;`on` / `off` 还不能稳定判断系统真实状态。
312
+
313
+
314
+
315
+ 任务编排:
316
+
317
+ - 建议工作流:先观察,再动作,最后等待确认
318
+ - 观察:window.find / window.foreground / screen.pixel-color
319
+ - 动作:window.activate / keyboard.* / mouse.* / app.launch
320
+ - 确认:wait.window / wait.focus / wait.pixel / wait.clipboard / wait.process
321
+ - 不要连续盲操作(点击、输入、窗口切换后应立即确认状态)
322
+ - 参数约定:
323
+ - 匹配模式:contains|exact
324
+ - handle:非负整数
325
+ - x/y、delta:32 位有符号整数
326
+ - wait 默认超时:timeout_ms=2000
327
+ - wait_process:expect_running=true|false
328
+ - 高风险动作(鼠标/键盘/窗口激活/窗口关闭/剪贴板写)前后都应插入观察或等待
329
+ - Linux/macOS 的部分能力仍需以目标环境实测为准
330
+ - 失败时优先读取:failure.code / failure.message / failure.detail
331
+
332
+
333
+
334
+ ## MCP 接入
335
+
336
+ ### 启动 MCP stdio 服务
337
+
338
+ ```bash
339
+ et mcp-stdio
340
+ ```
341
+
342
+
343
+
344
+ ### 导出工具清单(manifest)
345
+
346
+ ```bash
347
+ et mcp-stdio --output json
348
+ ```
349
+
350
+
351
+
352
+
353
+ ### 配置示例
354
+
355
+ ```json
356
+ {
357
+ "mcpServers": {
358
+ "easytouch": {
359
+ "command": "et",
360
+ "args": ["mcp-stdio"]
361
+ }
362
+ }
363
+ }
364
+ ```
365
+
366
+
package/bin/et ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "easytouch-macos",
3
+ "version": "1.0.11",
4
+ "description": "macOS binary distribution for EasyTouch.",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "os": [
7
+ "darwin"
8
+ ],
9
+ "cpu": [
10
+ "x64"
11
+ ],
12
+ "files": [
13
+ "bin/**",
14
+ "LICENSE.txt",
15
+ "README.md",
16
+ "SKILL.md"
17
+ ]
18
+ }