@mearl/setup 3.0.0 → 3.0.1
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.
- package/README.en.md +42 -42
- package/README.md +42 -42
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +60 -14
- package/package.json +6 -6
package/README.en.md
CHANGED
|
@@ -9,17 +9,17 @@ One-time installation, updates, removal, and configuration for Mearl environment
|
|
|
9
9
|
Run `node --version` before installation to verify Node.js >= 20.18.0.
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx @mearl/setup
|
|
13
|
-
npx @mearl/setup
|
|
14
|
-
npx @mearl/setup
|
|
15
|
-
npx @mearl/setup
|
|
16
|
-
npx @mearl/setup
|
|
17
|
-
npx @mearl/setup
|
|
18
|
-
npx @mearl/setup
|
|
19
|
-
npx @mearl/setup
|
|
20
|
-
npx @mearl/setup
|
|
21
|
-
npx @mearl/setup
|
|
22
|
-
npx @mearl/setup
|
|
12
|
+
npx @mearl/setup [install] [--local] [--cloud] [--cloud-mode <id>] [--mcp]
|
|
13
|
+
npx @mearl/setup update [--local] [--cloud] [--cloud-mode <id>] [--mcp]
|
|
14
|
+
npx @mearl/setup uninstall [--local] [--cloud] [--cloud-mode <id>] [--mcp] [--full]
|
|
15
|
+
npx @mearl/setup extension [--full] [--force]
|
|
16
|
+
npx @mearl/setup extension --extract
|
|
17
|
+
npx @mearl/setup plugin [name] <path>
|
|
18
|
+
npx @mearl/setup plugin install <skills add arguments...>
|
|
19
|
+
npx @mearl/setup plugin uninstall <name>
|
|
20
|
+
npx @mearl/setup provider <install|update|uninstall> <package|id>
|
|
21
|
+
npx @mearl/setup profile install <source> [--browser <id-or-name>]
|
|
22
|
+
npx @mearl/setup preset repair [--replace-skill <name> ...]
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Browser Providers install and evolve independently. After installation, run `mearl <providerId>` to inspect that version's capabilities,
|
|
@@ -30,7 +30,7 @@ Install optional cloud protocols through a preset before selecting `--cloud-mode
|
|
|
30
30
|
## Install App emulation
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npx @mearl/setup
|
|
33
|
+
npx @mearl/setup profile install mearlhq/wechat-profile
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
The source can be a public GitHub `owner/repo`, `owner/repo@ref`, or a full HTTPS bundle manifest URL. GitHub sources load the root `bundle.json` from the resolved commit. The command installs every App emulation configuration declared by that bundle and preserves the active Preset. When multiple local extensions are connected, select a target with `--browser`. Confirm source access in the extension if prompted.
|
|
@@ -42,11 +42,11 @@ In the extension's quick settings, open the App selector and choose **Add App em
|
|
|
42
42
|
Install a Skill and register its CLI, SDK, and MCP capabilities with one command:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
npx @mearl/setup
|
|
45
|
+
npx @mearl/setup plugin install https://github.com/mearlhq/mearl --skill browser-tab-manager --yes
|
|
46
46
|
mearl tabs summary
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Installation arguments pass to
|
|
49
|
+
Installation arguments pass to the public Skills CLI using the global shared directory. By default, `npx` resolves `skills` for the current Node.js version. Both default symlink and copy modes support registration. Copy mode uses list --global --json to confirm the canonical path for this successful install, without guessing directories or scanning other Skills. Set MEARL_SKILLS_PATH for a custom CLI. Arguments reject the -- separator, which would truncate trailing options.
|
|
50
50
|
|
|
51
51
|
The installation host's local plugin catalog determines preset-managed capabilities. install/update maintains managed registrations and preserves user registrations. Removing the last dependent environment removes managed plugins and the Mearl Skill; other dependent environments retain them. Configuration preparation, host synchronization, and actual status share the [installation contract](../../docs/preset-installation.en.md).
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ New registrations created by Native preset batches are setup-managed and retain
|
|
|
55
55
|
GUI and CLI share the preset installer and override rules. If a saved installation is incomplete, `preset repair` retries accepted local resources without redownloading the preset or implicitly replacing conflicting sources. Explicit repeated `--replace-skill` authorizes replacing those Skills' sources or same-name plugin registrations for this invocation:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
npx @mearl/setup
|
|
58
|
+
npx @mearl/setup preset repair --replace-skill example-skill --replace-skill another-skill
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Already installed Skills receive registration repair only; source conflicts reinstall. Unlisted conflicts still block installation, and undeclared tool names or changed installation identities are rejected. Replacement authorization does not persist into later repairs or automatic updates. Missing browser permissions still require extension authorization. Output uses preset JSON: ready exits `0`, pending components `3`, installation failure `1`, and invalid arguments `2`.
|
|
@@ -67,8 +67,8 @@ Reinstallation refreshes same-name bindings. JavaScript entries must default-exp
|
|
|
67
67
|
Register a Skill distributed elsewhere or a custom entry directly by path:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx @mearl/setup
|
|
71
|
-
npx @mearl/setup
|
|
70
|
+
npx @mearl/setup plugin /absolute/path/to/browser-tab-manager
|
|
71
|
+
npx @mearl/setup plugin custom ./skills/custom/entry.mjs
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
path accepts a directory or file. Directories default to `scripts/main.mjs` or `scripts/main.py`; relative paths resolve against the calling working directory. Plugin names prefer explicit name, then entry `name` metadata, then the Skill directory name. Normal registration needs only path; explicit name is for overrides or older entries. Python requires `python3 >= 3.9`; `MEARL_PYTHON` selects an interpreter. setup validates loading but does not install Python or run `pip install`.
|
|
@@ -83,7 +83,7 @@ After registration, run `mearl <name> --help` anywhere, use SDK `invokePlugin`,
|
|
|
83
83
|
To remove a plugin:
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
npx @mearl/setup
|
|
86
|
+
npx @mearl/setup plugin uninstall tabs
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
For entries under `~/.agents/skills/<skill>/`, setup first runs
|
|
@@ -99,9 +99,9 @@ for global package lifecycle and reads `package.json#mearl.provider` to register
|
|
|
99
99
|
browser type name, and form arguments:
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
|
-
npx @mearl/setup
|
|
103
|
-
npx @mearl/setup
|
|
104
|
-
npx @mearl/setup
|
|
102
|
+
npx @mearl/setup provider install @example/mearl-provider-device
|
|
103
|
+
npx @mearl/setup provider update example-device
|
|
104
|
+
npx @mearl/setup provider uninstall example-device
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
Install accepts package names, versions, and dist-tags; update/remove accept providerId or full package name. Core @mearl packages always use public npm; other scopes follow caller package-manager settings. Installation uses the package manager launching setup;
|
|
@@ -112,8 +112,8 @@ Registration clears only after successful package removal, allowing retries.
|
|
|
112
112
|
## Behavior
|
|
113
113
|
|
|
114
114
|
- Mearl-owned npm packages install and update from `https://registry.npmjs.org/`, matching version queries. Third-party packages use current manager registry settings.
|
|
115
|
-
- `install` is optional: `npx @mearl/setup
|
|
116
|
-
An initial option also implies installation, such as `npx @mearl/setup
|
|
115
|
+
- `install` is optional: `npx @mearl/setup` equals `npx @mearl/setup install`.
|
|
116
|
+
An initial option also implies installation, such as `npx @mearl/setup --cloud --yes`.
|
|
117
117
|
- `install` defaults to `--local` when no environment is specified.
|
|
118
118
|
- `-h` / `--help` shows help; `-v` / `--version` shows setup's version.
|
|
119
119
|
- Without environment flags, `update` and `uninstall` detect
|
|
@@ -159,17 +159,17 @@ Registration clears only after successful package removal, allowing retries.
|
|
|
159
159
|
|
|
160
160
|
## Install or update the browser extension
|
|
161
161
|
|
|
162
|
-
For first use, run `npx @mearl/setup
|
|
162
|
+
For first use, run `npx @mearl/setup` and load the matching release ZIP. You can also use the Chrome Web Store when it offers the matching version. [Installation steps](../../README.en.md#install-locally)
|
|
163
163
|
|
|
164
164
|
Use this command to let setup manage the extension.
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
|
-
npx @mearl/setup
|
|
167
|
+
npx @mearl/setup extension
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
Add `--full` to also install the local CLI, Native Host, and Skill in the same run.
|
|
171
171
|
|
|
172
|
-
To load the extension manually, run `npx @mearl/setup
|
|
172
|
+
To load the extension manually, run `npx @mearl/setup extension --extract`. Setup downloads the release ZIP,
|
|
173
173
|
unpacks it into a new directory under `~/.mearl/extension-downloads/`, and prints the full path. Open
|
|
174
174
|
`chrome://extensions/`, enable **Developer mode**, click **Load unpacked**, and select that directory.
|
|
175
175
|
Keep the directory while Chrome uses the extension. This works with Chrome closed and with remote debugging disabled.
|
|
@@ -177,7 +177,7 @@ Keep the directory while Chrome uses the extension. This works with Chrome close
|
|
|
177
177
|
Automatic installation uses CDP for first installation, initial migration of older setup extensions, or unavailable Native Host reload. If
|
|
178
178
|
Chrome has not enabled CDP, interactive setup prompts you to open
|
|
179
179
|
`chrome://inspect/#remote-debugging`, enable remote debugging, and allow the connection, then waits for installation. Human-facing
|
|
180
|
-
instructions should omit `--yes`. Without a TTY, use `npx @mearl/setup
|
|
180
|
+
instructions should omit `--yes`. Without a TTY, use `npx @mearl/setup extension --yes`: it tries
|
|
181
181
|
once and stops immediately if CDP is unavailable. If setup ownership cannot be confirmed and CDP is unavailable, it does not download or modify
|
|
182
182
|
the extension directory. Enable CDP and rerun the same command. If Chrome lacks required extension-installation CDP methods,
|
|
183
183
|
the command stops and asks for a Chrome upgrade.
|
|
@@ -207,7 +207,7 @@ starts the new version. Success requires both local CLI versions to match and be
|
|
|
207
207
|
|
|
208
208
|
Automatic updates never downgrade a newer Host or modify cloud, MCP, or independently installed Mearl Skills.
|
|
209
209
|
If the npm version is unpublished, the network unavailable, or updating fails, the old Host keeps running. The next extension background
|
|
210
|
-
lifecycle may retry; manual updates use `npx @mearl/setup
|
|
210
|
+
lifecycle may retry; manual updates use `npx @mearl/setup update --local`.
|
|
211
211
|
|
|
212
212
|
## Human and Agent use
|
|
213
213
|
|
|
@@ -222,41 +222,41 @@ lifecycle may retry; manual updates use `npx @mearl/setup@3 update --local`.
|
|
|
222
222
|
|
|
223
223
|
```bash
|
|
224
224
|
# Default local browser environment installation
|
|
225
|
-
npx @mearl/setup
|
|
225
|
+
npx @mearl/setup
|
|
226
226
|
|
|
227
227
|
# Equivalent to the previous command
|
|
228
|
-
npx @mearl/setup
|
|
228
|
+
npx @mearl/setup install
|
|
229
229
|
|
|
230
230
|
# Noninteractive Agent / CI installation
|
|
231
|
-
npx @mearl/setup
|
|
231
|
+
npx @mearl/setup --yes
|
|
232
232
|
|
|
233
233
|
# Install the cloud Agent environment
|
|
234
|
-
npx @mearl/setup
|
|
234
|
+
npx @mearl/setup --cloud
|
|
235
235
|
|
|
236
236
|
# Use one machine as both a local browser host and cloud Agent
|
|
237
|
-
npx @mearl/setup
|
|
237
|
+
npx @mearl/setup --local --cloud
|
|
238
238
|
|
|
239
239
|
# Update all detected Mearl environments in the current PATH
|
|
240
|
-
npx @mearl/setup
|
|
240
|
+
npx @mearl/setup update
|
|
241
241
|
|
|
242
242
|
# Independently install or update the latest browser extension
|
|
243
|
-
npx @mearl/setup
|
|
243
|
+
npx @mearl/setup extension
|
|
244
244
|
|
|
245
245
|
# Complete local environment: client, Native Host, Skill, and extension
|
|
246
|
-
npx @mearl/setup
|
|
246
|
+
npx @mearl/setup extension --full
|
|
247
247
|
|
|
248
248
|
# Remove only the local environment
|
|
249
|
-
npx @mearl/setup
|
|
249
|
+
npx @mearl/setup uninstall --local
|
|
250
250
|
|
|
251
251
|
# Detect and uninstall without interaction
|
|
252
|
-
npx @mearl/setup
|
|
252
|
+
npx @mearl/setup uninstall --yes
|
|
253
253
|
|
|
254
254
|
# Uninstall environments and all CLI plugins and Providers
|
|
255
|
-
npx @mearl/setup
|
|
255
|
+
npx @mearl/setup uninstall --full
|
|
256
256
|
|
|
257
257
|
# Install an optional browser Provider
|
|
258
|
-
npx @mearl/setup
|
|
259
|
-
npx @mearl/setup
|
|
258
|
+
npx @mearl/setup provider install @example/mearl-provider-device
|
|
259
|
+
npx @mearl/setup provider install @example/mearl-provider-cloud
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
Existing npm/npx installation methods and CLIs for Mearl environment packages remain available; setup is the unified convenience entry.
|
|
@@ -273,4 +273,4 @@ The default directory is the public site's `installation.json`; override with HT
|
|
|
273
273
|
|
|
274
274
|
Explicit setup first reuses the local preset. Without one, after runtime initialization and before Skill installation, it adopts the connected browser's trusted preset. Explicit `--preset <source>` wins. Differing browser selections, untrusted sources, or failed state reads require an explicit choice. First connection waits about one minute; closed browsers receive only the base environment and retry guidance. Ordinary connections and background core updates do not install an initial local preset.
|
|
275
275
|
|
|
276
|
-
Distributions can set local-process `MEARL_SETUP_DEFAULT_PRESET` to a default manifest source. It applies only when neither side has a selection. Plugin, Provider, removal, and other subcommands keep their behavior.
|
|
276
|
+
Distributions can set local-process `MEARL_SETUP_DEFAULT_PRESET` to a default manifest source. It applies only when neither side has a selection. Plugin, Provider, removal, and other subcommands keep their behavior. Setup performs installation and verifies its status.
|
package/README.md
CHANGED
|
@@ -9,17 +9,17 @@ Mearl 环境的一次性安装、更新、卸载与配置工具。无需先全
|
|
|
9
9
|
安装前用 `node --version` 确认 Node.js >= 20.18.0。
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx @mearl/setup
|
|
13
|
-
npx @mearl/setup
|
|
14
|
-
npx @mearl/setup
|
|
15
|
-
npx @mearl/setup
|
|
16
|
-
npx @mearl/setup
|
|
17
|
-
npx @mearl/setup
|
|
18
|
-
npx @mearl/setup
|
|
19
|
-
npx @mearl/setup
|
|
20
|
-
npx @mearl/setup
|
|
21
|
-
npx @mearl/setup
|
|
22
|
-
npx @mearl/setup
|
|
12
|
+
npx @mearl/setup [install] [--local] [--cloud] [--cloud-mode <id>] [--mcp]
|
|
13
|
+
npx @mearl/setup update [--local] [--cloud] [--cloud-mode <id>] [--mcp]
|
|
14
|
+
npx @mearl/setup uninstall [--local] [--cloud] [--cloud-mode <id>] [--mcp] [--full]
|
|
15
|
+
npx @mearl/setup extension [--full] [--force]
|
|
16
|
+
npx @mearl/setup extension --extract
|
|
17
|
+
npx @mearl/setup plugin [name] <path>
|
|
18
|
+
npx @mearl/setup plugin install <skills add 参数...>
|
|
19
|
+
npx @mearl/setup plugin uninstall <name>
|
|
20
|
+
npx @mearl/setup provider <install|update|uninstall> <package|id>
|
|
21
|
+
npx @mearl/setup profile install <来源> [--browser <标识或名称>]
|
|
22
|
+
npx @mearl/setup preset repair [--replace-skill <name> ...]
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
浏览器 Provider 独立安装和演进。安装后运行 `mearl <providerId>` 查看该版本声明的能力、
|
|
@@ -30,7 +30,7 @@ npx @mearl/setup@3 preset repair [--replace-skill <name> ...]
|
|
|
30
30
|
## 安装端模拟
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
npx @mearl/setup
|
|
33
|
+
npx @mearl/setup profile install mearlhq/wechat-profile
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
来源支持公开 GitHub 仓库的 `owner/repo`、`owner/repo@ref`,或能力包清单的完整 HTTPS 地址。GitHub 来源从解析后的提交读取根目录 `bundle.json`。命令安装能力包声明的全部端模拟配置,保留当前 Preset。有多个本地扩展连接时,用 `--browser` 选择目标。若扩展提示授权,请确认来源。
|
|
@@ -42,11 +42,11 @@ npx @mearl/setup@3 profile install mearlhq/wechat-profile
|
|
|
42
42
|
一个命令安装 skill 并注册它的 CLI、SDK 和 MCP 能力:
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
npx @mearl/setup
|
|
45
|
+
npx @mearl/setup plugin install https://github.com/mearlhq/mearl --skill browser-tab-manager --yes
|
|
46
46
|
mearl tabs summary
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
安装参数传给公共 Skills CLI,使用全局共享目录。默认由 `npx` 按当前 Node.js 版本解析 `skills`。公共 CLI 的默认 symlink 和复制模式都可注册;复制模式通过 list --global --json 确认本次成功结果对应的 canonical path,不猜测目录,也不扫描其他 Skills。自定义 CLI 可通过 MEARL_SKILLS_PATH 指定。参数不接受截断后置选项的 -- 分隔符。
|
|
50
50
|
|
|
51
51
|
安装宿主提供的本地插件目录决定哪些能力由 preset 管理。install/update 维护目录中的托管注册,保留用户自行注册的插件。卸载最后一个依赖环境时移除托管插件与 Mearl Skill;其他环境需要时保留。配置准备、宿主同步和实际安装状态共用 [安装合同](../../docs/preset-installation.md)。
|
|
52
52
|
|
|
@@ -55,7 +55,7 @@ Native preset 批次新建的插件注册使用 setup 托管归属,后续通
|
|
|
55
55
|
GUI 和 CLI 使用同一套 preset 安装器及覆盖规则。已保存的安装尚未完成时,运行 `preset repair` 从接受的本地资源重试,不重新下载 preset,也不隐式覆盖冲突来源。显式重复指定 `--replace-skill` 即授权本次替换这些 Skill 的来源或同名旧插件注册:
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
|
-
npx @mearl/setup
|
|
58
|
+
npx @mearl/setup preset repair --replace-skill example-skill --replace-skill another-skill
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
已安装的 Skill 仅修复注册;来源冲突项重新安装。未列出的冲突仍会阻止安装,声明外的工具名与变更后的安装身份也会被拒绝。覆盖授权不会保留到后续普通修复或自动更新。缺少浏览器权限时仍需在扩展中授权。输出沿用 preset JSON,已就绪退出 `0`、仍有待完成项退出 `3`、安装失败退出 `1`,无效参数退出 `2`。
|
|
@@ -67,8 +67,8 @@ npx @mearl/setup@3 preset repair --replace-skill example-skill --replace-skill a
|
|
|
67
67
|
已通过其他渠道分发的 skill 或自定义入口,可以直接传入路径注册:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
npx @mearl/setup
|
|
71
|
-
npx @mearl/setup
|
|
70
|
+
npx @mearl/setup plugin /absolute/path/to/browser-tab-manager
|
|
71
|
+
npx @mearl/setup plugin custom ./skills/custom/entry.mjs
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
path 接受目录或具体文件;目录默认读取 `scripts/main.mjs` 或 `scripts/main.py`,相对路径基于调用工作目录解析。插件名优先使用显式 name,其次读取入口的 `name` metadata,最后回退到 Skill 目录名;常规注册只传 path,显式 name 仅用于覆盖或兼容旧入口。Python 插件要求 `python3 >= 3.9`,可通过 `MEARL_PYTHON` 指定解释器路径;setup 只验证入口可加载,不安装 Python,也不执行 `pip install`。
|
|
@@ -83,7 +83,7 @@ JavaScript 插件可导出 `setup({ runCommand })`,在注册前准备 Skill
|
|
|
83
83
|
不再需要插件时执行:
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
|
-
npx @mearl/setup
|
|
86
|
+
npx @mearl/setup plugin uninstall tabs
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
若入口位于 `~/.agents/skills/<skill>/`,setup 会先执行
|
|
@@ -99,9 +99,9 @@ Provider 由 npm 包分发,但包本身无需暴露 CLI 或安装脚本。setu
|
|
|
99
99
|
可创建的浏览器类型名称及其表单参数:
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
|
-
npx @mearl/setup
|
|
103
|
-
npx @mearl/setup
|
|
104
|
-
npx @mearl/setup
|
|
102
|
+
npx @mearl/setup provider install @example/mearl-provider-device
|
|
103
|
+
npx @mearl/setup provider update example-device
|
|
104
|
+
npx @mearl/setup provider uninstall example-device
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
安装参数接受包名、版本或 dist-tag;更新和卸载可使用 providerId 或完整包名。核心 @mearl 包固定使用公共 npm registry;其余 scope 沿用调用方的包管理器配置。安装沿用启动 setup 的包管理器,
|
|
@@ -112,8 +112,8 @@ npx @mearl/setup@3 provider uninstall example-device
|
|
|
112
112
|
## 行为
|
|
113
113
|
|
|
114
114
|
- Mearl 自有 npm 包的安装和更新固定使用 `https://registry.npmjs.org/`,与最新版本查询使用同一来源;第三方包沿用当前包管理器的源配置。
|
|
115
|
-
- `install` 可以省略;直接执行 `npx @mearl/setup
|
|
116
|
-
以选项开头时也默认安装,例如 `npx @mearl/setup
|
|
115
|
+
- `install` 可以省略;直接执行 `npx @mearl/setup` 等同于 `npx @mearl/setup install`。
|
|
116
|
+
以选项开头时也默认安装,例如 `npx @mearl/setup --cloud --yes`。
|
|
117
117
|
- `install` 未指定环境时默认 `--local`。
|
|
118
118
|
- `-h` / `--help` 显示帮助,`-v` / `--version` 显示 setup 版本。
|
|
119
119
|
- `update` 和 `uninstall` 未指定环境时,从当前 `PATH` 中的
|
|
@@ -159,17 +159,17 @@ npx @mearl/setup@3 provider uninstall example-device
|
|
|
159
159
|
|
|
160
160
|
## 安装或更新浏览器扩展
|
|
161
161
|
|
|
162
|
-
首次使用时,先运行 `npx @mearl/setup
|
|
162
|
+
首次使用时,先运行 `npx @mearl/setup`,再加载同版的离线 ZIP。商店提供同版扩展时,也可以直接安装。[安装步骤](../../README.md#安装本机环境)
|
|
163
163
|
|
|
164
164
|
如需由 setup 管理扩展,运行下面的命令。
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
|
-
npx @mearl/setup
|
|
167
|
+
npx @mearl/setup extension
|
|
168
168
|
```
|
|
169
169
|
|
|
170
170
|
加上 `--full` 可以在同一次运行中安装本机 CLI、Native Host 和 Skill。
|
|
171
171
|
|
|
172
|
-
需要手动导入时,运行 `npx @mearl/setup
|
|
172
|
+
需要手动导入时,运行 `npx @mearl/setup extension --extract`。setup 会下载发行 ZIP,
|
|
173
173
|
在 `~/.mearl/extension-downloads/` 下创建新目录并解压,然后打印完整路径。打开
|
|
174
174
|
`chrome://extensions/`,启用**开发者模式**,点击**加载已解压的扩展程序**并选择该目录。
|
|
175
175
|
Chrome 使用扩展期间请保留目录。Chrome 关闭或远程调试关闭时也可以下载。
|
|
@@ -177,7 +177,7 @@ Chrome 使用扩展期间请保留目录。Chrome 关闭或远程调试关闭时
|
|
|
177
177
|
自动安装在首次安装、旧版 setup 扩展首次迁移,或 Native Host reload 不可用时使用 CDP。如果
|
|
178
178
|
Chrome 尚未开放 CDP,交互命令会提示打开
|
|
179
179
|
`chrome://inspect/#remote-debugging`、启用远程调试并允许连接,然后等待安装完成。面向人的
|
|
180
|
-
安装指引不要添加 `--yes`。无 TTY 环境使用 `npx @mearl/setup
|
|
180
|
+
安装指引不要添加 `--yes`。无 TTY 环境使用 `npx @mearl/setup extension --yes`;它只尝试
|
|
181
181
|
一次,CDP 不可用时立即中断。无法确认 setup 管理来源且 CDP 不可用时不会下载或修改插件
|
|
182
182
|
目录,打开 CDP 后重新执行同一命令即可。Chrome 版本过低、缺少扩展安装所需的 CDP 方法时,
|
|
183
183
|
命令会中断并提示升级 Chrome。
|
|
@@ -207,7 +207,7 @@ DevTools 面板的设置按钮会显示红点,快捷设置中提供“立即
|
|
|
207
207
|
|
|
208
208
|
自动更新不会降级较新的 Host,也不会改动 cloud、MCP 或独立安装的 Mearl Skill。
|
|
209
209
|
目标 npm 版本尚未发布、网络不可用或更新失败时,旧 Host 会继续运行;下一次扩展后台
|
|
210
|
-
生命周期可重新尝试,也可手动执行 `npx @mearl/setup
|
|
210
|
+
生命周期可重新尝试,也可手动执行 `npx @mearl/setup update --local`。
|
|
211
211
|
|
|
212
212
|
## 人工与 Agent 使用
|
|
213
213
|
|
|
@@ -222,41 +222,41 @@ DevTools 面板的设置按钮会显示红点,快捷设置中提供“立即
|
|
|
222
222
|
|
|
223
223
|
```bash
|
|
224
224
|
# 默认安装本地浏览器环境
|
|
225
|
-
npx @mearl/setup
|
|
225
|
+
npx @mearl/setup
|
|
226
226
|
|
|
227
227
|
# 与上一条等价
|
|
228
|
-
npx @mearl/setup
|
|
228
|
+
npx @mearl/setup install
|
|
229
229
|
|
|
230
230
|
# Agent / CI 无交互安装
|
|
231
|
-
npx @mearl/setup
|
|
231
|
+
npx @mearl/setup --yes
|
|
232
232
|
|
|
233
233
|
# 安装云端 Agent 环境
|
|
234
|
-
npx @mearl/setup
|
|
234
|
+
npx @mearl/setup --cloud
|
|
235
235
|
|
|
236
236
|
# 同一台机器同时作为本地浏览器宿主和云端 Agent
|
|
237
|
-
npx @mearl/setup
|
|
237
|
+
npx @mearl/setup --local --cloud
|
|
238
238
|
|
|
239
239
|
# 自动更新当前 PATH 中检测到的全部 Mearl 环境
|
|
240
|
-
npx @mearl/setup
|
|
240
|
+
npx @mearl/setup update
|
|
241
241
|
|
|
242
242
|
# 独立安装或更新到最新浏览器扩展
|
|
243
|
-
npx @mearl/setup
|
|
243
|
+
npx @mearl/setup extension
|
|
244
244
|
|
|
245
245
|
# 安装完整本地环境(client、Native Host、Skill 和扩展)
|
|
246
|
-
npx @mearl/setup
|
|
246
|
+
npx @mearl/setup extension --full
|
|
247
247
|
|
|
248
248
|
# 只卸载本地环境
|
|
249
|
-
npx @mearl/setup
|
|
249
|
+
npx @mearl/setup uninstall --local
|
|
250
250
|
|
|
251
251
|
# 自动检测并无交互卸载
|
|
252
|
-
npx @mearl/setup
|
|
252
|
+
npx @mearl/setup uninstall --yes
|
|
253
253
|
|
|
254
254
|
# 卸载环境,并清理全部 CLI 插件与 Provider
|
|
255
|
-
npx @mearl/setup
|
|
255
|
+
npx @mearl/setup uninstall --full
|
|
256
256
|
|
|
257
257
|
# 安装可选浏览器 Provider
|
|
258
|
-
npx @mearl/setup
|
|
259
|
-
npx @mearl/setup
|
|
258
|
+
npx @mearl/setup provider install @example/mearl-provider-device
|
|
259
|
+
npx @mearl/setup provider install @example/mearl-provider-cloud
|
|
260
260
|
```
|
|
261
261
|
|
|
262
262
|
原有 Mearl 环境包的 npm/npx 安装方式和 CLI 保持可用;setup 是统一的便利入口。
|
|
@@ -273,4 +273,4 @@ install/update 在替换包前保存选中 Preset 的确切资源和期望选择
|
|
|
273
273
|
|
|
274
274
|
主动执行 setup 时,先沿用本机已选 preset;本机未选择时,在运行时初始化后、安装 Skill 前采用已连接浏览器的受信 preset。显式 `--preset <source>` 优先。多个浏览器的选择不同、来源不受信或状态读取失败时要求显式选择。首次连接最多等待约一分钟;浏览器关闭时只安装基础环境并说明重试方式。普通连接和后台核心更新不会自动安装首次本机 preset。
|
|
275
275
|
|
|
276
|
-
发行包可设置本机进程环境变量 `MEARL_SETUP_DEFAULT_PRESET` 提供默认清单来源;默认值仅在两端均无选择时生效,插件、Provider
|
|
276
|
+
发行包可设置本机进程环境变量 `MEARL_SETUP_DEFAULT_PRESET` 提供默认清单来源;默认值仅在两端均无选择时生效,插件、Provider、卸载等子命令保持原行为。安装与状态核验仍由安装器负责。
|
package/dist/skills.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { inspectGlobalSkill } from './skillSources.js';
|
|
|
2
2
|
import type { PluginCatalogSelection } from '@mearl/client/plugin';
|
|
3
3
|
import type { ResolvedComponent } from '@mearl/preset';
|
|
4
4
|
import { type CommandRunner, type CommandResult, type RunCommandOptions } from '@mearl/daemon-core';
|
|
5
|
-
export declare const SKILLS_CLI_PACKAGE = "skills
|
|
5
|
+
export declare const SKILLS_CLI_PACKAGE = "skills";
|
|
6
6
|
export declare const MEARL_SKILL_SOURCE: string;
|
|
7
7
|
export interface ResolveSkillsOptions {
|
|
8
8
|
env?: NodeJS.ProcessEnv;
|
package/dist/skills.js
CHANGED
|
@@ -5,7 +5,7 @@ import { NodeCapabilityRegistry } from '@mearl/daemon-core/capabilities';
|
|
|
5
5
|
import { inspectGlobalSkill, readTrackedSkillSources } from './skillSources.js';
|
|
6
6
|
import { PresetInstallationStore } from './presetStore.js';
|
|
7
7
|
import { findExecutable, isExecutable, npmExecEnvironment, prependCommandPath, prependNodePath, runCommand, } from '@mearl/daemon-core';
|
|
8
|
-
export const SKILLS_CLI_PACKAGE = 'skills
|
|
8
|
+
export const SKILLS_CLI_PACKAGE = 'skills';
|
|
9
9
|
export const MEARL_SKILL_SOURCE = SETUP_VERSION.includes('-beta.')
|
|
10
10
|
? `https://github.com/mearlhq/mearl/tree/v${SETUP_VERSION}`
|
|
11
11
|
: 'https://github.com/mearlhq/mearl';
|
|
@@ -40,7 +40,7 @@ export function resolveSkillsInvocation(options = {}) {
|
|
|
40
40
|
return null;
|
|
41
41
|
return {
|
|
42
42
|
command: npx,
|
|
43
|
-
argsPrefix: ['-y', SKILLS_CLI_PACKAGE],
|
|
43
|
+
argsPrefix: ['-y', `--package=${SKILLS_CLI_PACKAGE}`, '--', 'skills'],
|
|
44
44
|
env: npmExecEnvironment(prependNodePath(prependCommandPath(npx, env), processExecPath)),
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -49,37 +49,81 @@ export async function captureSkillsCli(options = {}) {
|
|
|
49
49
|
const env = options.env ?? process.env;
|
|
50
50
|
const runner = options.runCommand ?? runCommand;
|
|
51
51
|
const directory = env.MEARL_CAPABILITY_DIR || path.join(homedir(), '.mearl', 'capabilities');
|
|
52
|
-
const current = await new PresetInstallationStore({ directory }).current({
|
|
52
|
+
const current = await new PresetInstallationStore({ directory }).current({
|
|
53
|
+
verifyResources: false,
|
|
54
|
+
});
|
|
53
55
|
const registry = new NodeCapabilityRegistry({ env: Object.freeze({ ...env }), runCommand: runner }, directory, { hooks: ['skills.manager'] });
|
|
54
56
|
await registry.refresh();
|
|
55
|
-
if (current.activation?.revision !== registry.revision ||
|
|
57
|
+
if (current.activation?.revision !== registry.revision ||
|
|
58
|
+
current.activation?.installationRevision !== registry.installationRevision)
|
|
56
59
|
throw new Error('SKILL_MANAGER_CHANGED');
|
|
57
60
|
const readSources = (scope, cwd) => readTrackedSkillSources(scope, cwd, { env });
|
|
58
|
-
const selection = current.rawHash
|
|
61
|
+
const selection = current.rawHash
|
|
62
|
+
? { path: path.resolve(directory, 'active-node.json'), sha256: current.rawHash }
|
|
63
|
+
: undefined;
|
|
59
64
|
const managedSkills = Object.fromEntries(Object.entries(current.preset?.skills ?? {}).filter(([, entry]) => entry.enabled !== false));
|
|
60
65
|
const backend = registry.get('skills.manager')?.();
|
|
61
66
|
if (backend !== undefined) {
|
|
62
67
|
if (backend?.readSources !== undefined && typeof backend.readSources !== 'function')
|
|
63
68
|
throw new Error('Invalid Skill source reader');
|
|
64
|
-
if (!backend ||
|
|
69
|
+
if (!backend ||
|
|
70
|
+
typeof backend.id !== 'string' ||
|
|
71
|
+
!/^[a-z][a-z0-9-]{0,63}$/.test(backend.id) ||
|
|
72
|
+
typeof backend.cli !== 'function')
|
|
65
73
|
throw new Error('The selected Skill manager requires a preset update for CLI operations');
|
|
66
|
-
return {
|
|
74
|
+
return {
|
|
75
|
+
id: backend.id,
|
|
76
|
+
managedSkills,
|
|
77
|
+
selection,
|
|
78
|
+
inspectGlobal: (source, name, version, inspection) => inspectGlobalSkill(source, name, version, {
|
|
79
|
+
migrateFrom: inspection?.migrateFrom,
|
|
80
|
+
externalManager: true,
|
|
81
|
+
normalizeSource: backend.normalizeSource,
|
|
82
|
+
readSources: backend.readSources ?? readSources,
|
|
83
|
+
}),
|
|
84
|
+
run: async (args, settings) => {
|
|
67
85
|
const result = await backend.cli([...args], settings);
|
|
68
|
-
if (!result ||
|
|
86
|
+
if (!result ||
|
|
87
|
+
!Number.isInteger(result.code) ||
|
|
88
|
+
typeof result.stdout !== 'string' ||
|
|
89
|
+
typeof result.stderr !== 'string')
|
|
69
90
|
throw new Error('Invalid Skill manager CLI result');
|
|
70
91
|
return result;
|
|
71
|
-
}
|
|
92
|
+
},
|
|
93
|
+
};
|
|
72
94
|
}
|
|
73
95
|
const invocation = resolveSkillsInvocation(options);
|
|
74
96
|
if (!invocation)
|
|
75
97
|
return undefined;
|
|
76
|
-
return {
|
|
98
|
+
return {
|
|
99
|
+
id: 'skills',
|
|
100
|
+
managedSkills,
|
|
101
|
+
selection,
|
|
102
|
+
inspectGlobal: (source, name, version, inspection) => inspectGlobalSkill(source, name, version, {
|
|
103
|
+
migrateFrom: inspection?.migrateFrom,
|
|
104
|
+
readSources,
|
|
105
|
+
}),
|
|
106
|
+
run: (args, settings) => runner(invocation.command, [...invocation.argsPrefix, ...args], {
|
|
107
|
+
...settings,
|
|
108
|
+
env: invocation.env,
|
|
109
|
+
}),
|
|
110
|
+
};
|
|
77
111
|
}
|
|
78
112
|
export function parseInstalledSkills(output) {
|
|
79
113
|
const value = JSON.parse(stripAnsi(output).trim());
|
|
80
|
-
if (!Array.isArray(value)
|
|
114
|
+
if (!Array.isArray(value))
|
|
81
115
|
throw new Error('Skills returned an invalid skill list');
|
|
82
|
-
|
|
116
|
+
const installed = [];
|
|
117
|
+
for (const item of value) {
|
|
118
|
+
if (!item || typeof item.name !== 'string' || !['global', 'project'].includes(item.scope))
|
|
119
|
+
throw new Error('Skills returned an invalid skill list');
|
|
120
|
+
if (item.status === 'missing' && item.path === null)
|
|
121
|
+
continue;
|
|
122
|
+
if (typeof item.path !== 'string')
|
|
123
|
+
throw new Error('Skills returned an invalid skill list');
|
|
124
|
+
installed.push(item);
|
|
125
|
+
}
|
|
126
|
+
return installed;
|
|
83
127
|
}
|
|
84
128
|
export function parseGlobalMearlSkillPaths(output) {
|
|
85
129
|
const parsed = parseInstalledSkills(output);
|
|
@@ -201,12 +245,14 @@ export async function runGlobalMearlSkillOperation(operation, options = {}) {
|
|
|
201
245
|
${result.stderr}`).trim();
|
|
202
246
|
if (detail)
|
|
203
247
|
writeLine(detail);
|
|
204
|
-
if (/Failed to (?:update|remove)\s+[1-9]\d*\s+skills?/i.test(detail) ||
|
|
248
|
+
if (/Failed to (?:update|remove)\s+[1-9]\d*\s+skills?/i.test(detail) ||
|
|
249
|
+
(operation === 'update' && !/\bInstalled [1-9]\d* skills?\b/.test(detail))) {
|
|
205
250
|
writeLine(`Skill: ${operation} failed.`);
|
|
206
251
|
return false;
|
|
207
252
|
}
|
|
208
253
|
const remainingPaths = await listMearlPaths();
|
|
209
|
-
if (!remainingPaths ||
|
|
254
|
+
if (!remainingPaths ||
|
|
255
|
+
(operation === 'uninstall' ? remainingPaths.length !== 0 : remainingPaths.length === 0)) {
|
|
210
256
|
writeLine(`Skill: ${operation} did not reach the expected installation state.`);
|
|
211
257
|
return false;
|
|
212
258
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mearl/setup",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "One-shot environment setup and configuration for Mearl",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -79,11 +79,11 @@
|
|
|
79
79
|
"ws": "^8.18.3",
|
|
80
80
|
"semver": "^7.8.5",
|
|
81
81
|
"adm-zip": "^0.6.1",
|
|
82
|
-
"@mearl/client": "3.0.
|
|
83
|
-
"@mearl/provider": "3.0.
|
|
84
|
-
"@mearl/daemon-core": "3.0.
|
|
85
|
-
"@mearl/preset": "3.0.
|
|
86
|
-
"@mearl/browser-core": "3.0.
|
|
82
|
+
"@mearl/client": "3.0.1",
|
|
83
|
+
"@mearl/provider": "3.0.1",
|
|
84
|
+
"@mearl/daemon-core": "3.0.1",
|
|
85
|
+
"@mearl/preset": "3.0.1",
|
|
86
|
+
"@mearl/browser-core": "3.0.1"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/node": "^24.9.1",
|