@mearl/setup 2.20.0 → 2.20.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.md CHANGED
@@ -30,7 +30,7 @@ npx @mearl/setup plugin install trip/mearl --skill yuque-doc-fetch --yes
30
30
  mearl yuque read "https://aliyuque.antfin.com/group/book/doc"
31
31
  ```
32
32
 
33
- 安装参数透传给 `npx -y ali-skills add`,末尾统一追加 `--global --install-mode symlink`;不接受会截断后置选项的 `--` 参数分隔符,
33
+ 安装参数透传给 `npx -y ali-skills add`,统一使用全局 symlink 安装;不接受会截断后置选项的 `--` 参数分隔符,
34
34
  确保 skill 存放在 `~/.agents/skills` 并共享给所选 agent。安装日志实时显示,保留交互;
35
35
  setup 从 `Installed … skill(s)` 成功区块提取路径,仅注册本次安装且包含 `scripts/main.mjs` 或 `scripts/main.py` 的 skill;两者同时存在时使用 JavaScript 入口。
36
36
  普通 skill 正常安装。输出格式无法识别时提示手动注册,不扫描其他 skill 或猜测安装结果。
@@ -95,6 +95,7 @@ npx @mearl/setup provider uninstall brow
95
95
 
96
96
  ## 行为
97
97
 
98
+ - Mearl 自有 npm 包的安装和更新固定使用 `https://registry.npmjs.org/`,与最新版本查询使用同一来源;第三方包沿用当前包管理器的源配置。
98
99
  - `install` 可以省略;直接执行 `npx @mearl/setup` 等同于 `npx @mearl/setup install`。
99
100
  以选项开头时也默认安装,例如 `npx @mearl/setup --cloud --yes`。
100
101
  - `install` 未指定环境时默认 `--local`。
@@ -111,7 +112,7 @@ npx @mearl/setup provider uninstall brow
111
112
  - local/cloud 共用一份 `@mearl/client`;组合安装只处理一次,卸载单个环境时若另一个环境仍在使用则保留。
112
113
  - 从 2.5.x 更新 cloud 环境时会先卸载旧 `@mearl/cloud-client`,避免它遗留的 `mearl` bin 与统一 client 冲突。
113
114
  - local/cloud 共用的全局 mearl skill 通过 `ali-skills` 的 JSON 清单定位,只处理一次。
114
- - 安装始终通过 `ali-skills add --install-mode symlink` 写入最新的全局 mearl skill,并关联当前检测到的 Agent;
115
+ - 安装始终通过 `ali-skills add` 以 symlink 方式写入最新的全局 mearl skill,并关联当前检测到的 Agent;
115
116
  可用 `--skip-skill` 跳过。
116
117
  - 卸载一个环境但另一个仍依赖全局 mearl skill 时会保留 skill。
117
118
  - `uninstall --full` 在环境卸载之外,还会逐项卸载所有已注册 CLI 插件与浏览器 Provider。
package/dist/lifecycle.js CHANGED
@@ -13,6 +13,7 @@ import { isMearlReleaseLine } from './version.js';
13
13
  import { installAlibabaInternalPlugins, uninstallAlibabaInternalPlugins, } from './internalPlugins.js';
14
14
  import { uninstallPlugin } from './plugin.js';
15
15
  import { uninstallProviderPackage } from './provider.js';
16
+ import { packageRegistryEnvironment } from './npmRegistry.js';
16
17
  const LEGACY_CLOUD_CLIENT = '@mearl/cloud-client';
17
18
  const UNIFIED_CLIENT = '@mearl/client';
18
19
  const PROFILE_ORDER = ['local', 'cloud', 'mcp'];
@@ -79,7 +80,9 @@ async function runLifecycleCommand(runner, command, args, env, label, writeLine,
79
80
  async function runPackageOperation(installation, operation, packages, targetLine, runner, env, label, writeLine) {
80
81
  const command = buildGlobalPackageCommand(installation, operation, packages, targetLine);
81
82
  writeLine(`${label}: ${command.manager}`);
82
- const result = await runLifecycleCommand(runner, command.command, command.args, env, label, writeLine);
83
+ const result = await runLifecycleCommand(runner, command.command, command.args, operation === 'uninstall'
84
+ ? env
85
+ : packages.reduce((childEnv, name) => packageRegistryEnvironment(name, childEnv), env), label, writeLine);
83
86
  if (!result)
84
87
  return { command, ok: false };
85
88
  if (result.code !== 0) {
@@ -1,2 +1,3 @@
1
+ export declare const OFFICIAL_NPM_REGISTRY = "https://registry.npmjs.org/";
1
2
  export declare const ALIBABA_NPM_REGISTRY = "https://registry.anpm.alibaba-inc.com/";
2
3
  export declare function packageRegistryEnvironment(packageName: string, env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
@@ -1,6 +1,20 @@
1
+ export const OFFICIAL_NPM_REGISTRY = 'https://registry.npmjs.org/';
1
2
  export const ALIBABA_NPM_REGISTRY = 'https://registry.anpm.alibaba-inc.com/';
2
3
  export function packageRegistryEnvironment(packageName, env) {
3
- if (!packageName.startsWith('@ali/'))
4
+ const scope = packageName.split('/')[0];
5
+ const registry = scope === '@mearl'
6
+ ? OFFICIAL_NPM_REGISTRY
7
+ : scope === '@ali'
8
+ ? ALIBABA_NPM_REGISTRY
9
+ : undefined;
10
+ if (!registry)
4
11
  return env;
5
- return { ...env, npm_config_registry: ALIBABA_NPM_REGISTRY };
12
+ // npm-compatible managers and Bun receive the same registry, including scoped npm overrides.
13
+ return {
14
+ ...env,
15
+ npm_config_registry: registry,
16
+ NPM_CONFIG_REGISTRY: registry,
17
+ BUN_CONFIG_REGISTRY: registry,
18
+ [`npm_config_${scope}:registry`]: registry,
19
+ };
6
20
  }
@@ -4,6 +4,7 @@ import { join } from 'node:path';
4
4
  import { buildGlobalPackageCommand, detectCliPackage, detectGlobalPackage, resolveInvokingPackageManager, } from './packageManager.js';
5
5
  import { prependCommandPath, runCommand } from './process.js';
6
6
  import { compareMearlReleaseVersions, isMearlReleaseVersion } from './version.js';
7
+ import { packageRegistryEnvironment } from './npmRegistry.js';
7
8
  const require = createRequire(import.meta.url);
8
9
  export const PLUGIN_RUNTIME_VERSION = require('../package.json').version;
9
10
  /** 插件使用当前 setup 同版本的运行时;已安装的更高版本保持不动。 */
@@ -36,7 +37,7 @@ export async function ensurePluginRuntime(runner = runCommand) {
36
37
  const command = buildGlobalPackageCommand(manager, 'install', [packageName], PLUGIN_RUNTIME_VERSION);
37
38
  console.error(`${packageName}: ${before.version ?? '未安装'} → ${PLUGIN_RUNTIME_VERSION}`);
38
39
  const result = await runner(command.command, command.args, {
39
- env: prependCommandPath(command.command),
40
+ env: prependCommandPath(command.command, packageRegistryEnvironment(packageName, process.env)),
40
41
  });
41
42
  if (result.code !== 0)
42
43
  throw new Error(`${packageName} 安装失败 (exit ${result.code}),插件尚未注册。`);
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@mearl/setup",
3
- "version": "2.20.0",
3
+ "version": "2.20.1",
4
4
  "description": "One-shot environment setup and configuration for Mearl",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {
9
+ "./npm-registry": {
10
+ "types": "./dist/npmRegistry.d.ts",
11
+ "import": "./dist/npmRegistry.js"
12
+ },
9
13
  ".": {
10
14
  "types": "./dist/index.d.ts",
11
15
  "import": "./dist/index.js"
@@ -65,8 +69,8 @@
65
69
  "commander": "^15.0.0",
66
70
  "extract-zip": "^2.0.1",
67
71
  "ws": "^8.18.3",
68
- "@mearl/client": "2.20.0",
69
- "@mearl/provider": "2.20.0"
72
+ "@mearl/client": "2.20.1",
73
+ "@mearl/provider": "2.20.1"
70
74
  },
71
75
  "devDependencies": {
72
76
  "@types/node": "^24.9.1",