ali-skills 0.2.1-beta.0 → 0.2.1-beta.2

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 (2) hide show
  1. package/bin/cli.mjs +3 -35
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -7,7 +7,7 @@ import { pathToFileURL } from 'url';
7
7
 
8
8
  const REGISTRY = 'https://registry.anpm.alibaba-inc.com';
9
9
  const PKG = '@ali/cli-skills';
10
- const CACHE_DIR = join(homedir(), '.ali-skills');
10
+ const CACHE_DIR = join(homedir(), '.ali-skills', 'cli-skills');
11
11
  const PKG_DIR = join(CACHE_DIR, 'node_modules', PKG);
12
12
 
13
13
  /** 读取缓存中已安装的版本号 */
@@ -32,15 +32,6 @@ function getLatestVersion() {
32
32
  }
33
33
  }
34
34
 
35
- /** 获取用户当前配置的 npm registry */
36
- function getUserRegistry() {
37
- try {
38
- return execSync('npm config get registry', { encoding: 'utf8' }).trim().replace(/\/$/, '');
39
- } catch {
40
- return '';
41
- }
42
- }
43
-
44
35
  /** 安装指定版本到缓存目录 */
45
36
  function install(version) {
46
37
  mkdirSync(CACHE_DIR, { recursive: true });
@@ -57,32 +48,9 @@ function install(version) {
57
48
  const installedVersion = getInstalledVersion();
58
49
  const latestVersion = getLatestVersion();
59
50
 
60
- // 无法联通 registry,且本地无缓存 → 提示配置
51
+ // 无法联通内网 registry,且本地无缓存 → 报错
61
52
  if (!latestVersion && !installedVersion) {
62
- const registry = getUserRegistry();
63
- const isInternal = registry.includes('alibaba-inc.com') || registry.includes('anpm.alibaba');
64
-
65
- if (!isInternal) {
66
- console.error(`
67
- 错误:当前 npm registry 不是阿里内网源,无法安装内部依赖包 @ali/cli-skills
68
-
69
- 当前 registry: ${registry || '(未知)'}
70
-
71
- 请选择以下方式之一重新执行:
72
-
73
- 1. 配置内网源后重新执行:
74
- npm config set registry ${REGISTRY}
75
- npx ali-skills
76
-
77
- 2. 使用 tnpx 执行:
78
- tnpx ali-skills
79
-
80
- 3. 临时指定 registry 执行:
81
- npx --registry ${REGISTRY} ali-skills
82
- `);
83
- } else {
84
- console.error(`错误:无法从内网 registry 获取 ${PKG},请检查网络后重试`);
85
- }
53
+ console.error(`错误:无法连接内网 registry(${REGISTRY})且本地无缓存。\n请确保处于阿里内网或 VPN 环境后重试。`);
86
54
  process.exit(1);
87
55
  }
88
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ali-skills",
3
- "version": "0.2.1-beta.0",
3
+ "version": "0.2.1-beta.2",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {