@geoly-ai/skills-hub 0.3.2 → 0.3.4
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 +103 -27
- package/bin/skills-hub.mjs +34 -13
- package/package.json +1 -1
- package/src/cli.mjs +4 -0
- package/src/commands/install.mjs +1 -1
- package/src/commands/project-lockfile.mjs +116 -0
- package/src/commands/refgraph.mjs +290 -0
- package/src/commands/registry.mjs +12 -11
- package/src/commands/remove.mjs +378 -0
- package/src/commands/update.mjs +835 -0
- package/src/download.mjs +34 -4
package/src/download.mjs
CHANGED
|
@@ -178,10 +178,40 @@ export async function download(url, {
|
|
|
178
178
|
// 2026-09-03 我自己被这句话挡了两轮,最后是手写探针才挖出
|
|
179
179
|
// UND_ERR_CONNECT_TIMEOUT,进而发现是代理没被认。
|
|
180
180
|
const why = e.cause?.code ?? e.cause?.message ?? e.code ?? '';
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
// 🔴 提示要**按当前环境分情形**,不能一句话套所有人。
|
|
182
|
+
// 我第一版无论如何都说「需要 Node ≥ 24」,而在 Node 25 上读者会
|
|
183
|
+
// 合理地认为「我满足了,那问题在别处」—— 一句正确但不适用的话,
|
|
184
|
+
// 比不说更能把人带偏。
|
|
185
|
+
let hint = '';
|
|
186
|
+
if (/TIMEOUT|ETIMEDOUT|ECONNREFUSED|ENOTFOUND|EAI_AGAIN/.test(String(why))) {
|
|
187
|
+
const major = Number(process.versions.node.split('.')[0]);
|
|
188
|
+
const hasProxyEnv = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy']
|
|
189
|
+
.some((k) => process.env[k]);
|
|
190
|
+
if (hasProxyEnv && major < 24) {
|
|
191
|
+
hint = `\n 你配了代理,但代理支持需要 Node ≥ 24(当前 ${process.version})。`
|
|
192
|
+
+ '\n 可以先在能直连的网络里跑一次把缓存热起来,之后 --offline 可用。';
|
|
193
|
+
} else if (hasProxyEnv && process.env.NODE_USE_ENV_PROXY === '0') {
|
|
194
|
+
hint = '\n 你配了代理,但显式设了 NODE_USE_ENV_PROXY=0 —— CLI 因此没走代理。';
|
|
195
|
+
} else if (!hasProxyEnv) {
|
|
196
|
+
// 🔴 **系统代理不等于环境变量。** Clash / Surge / 公司 VPN 客户端
|
|
197
|
+
// 通常只写 macOS 的系统代理设置,而 **Node 的内建 fetch 不读它**
|
|
198
|
+
// (curl 和浏览器读,所以「浏览器能开 github」不能证明 CLI 能)。
|
|
199
|
+
// 2026-09-04 用户就是这么撞上的:一句「设置 HTTPS_PROXY」
|
|
200
|
+
// 对一个「我明明挂着代理」的人来说,读起来像是答非所问。
|
|
201
|
+
hint = '\n 连不上 —— 无法访问 github.com。'
|
|
202
|
+
+ '\n ⚠️ 如果你在用 Clash / Surge / VPN 客户端:它们通常只设**系统代理**,'
|
|
203
|
+
+ '\n 而 Node 不读系统代理(curl 和浏览器读,所以浏览器能打开不算数)。'
|
|
204
|
+
+ '\n 要显式导出环境变量:'
|
|
205
|
+
+ (process.platform === 'darwin'
|
|
206
|
+
? '\n scutil --proxy | grep -iE "HTTPSProxy|HTTPSPort" # 看端口'
|
|
207
|
+
+ '\n export HTTPS_PROXY=http://127.0.0.1:<端口>'
|
|
208
|
+
: '\n export HTTPS_PROXY=http://<host>:<port>')
|
|
209
|
+
+ '\n (NO_PROXY 也会被尊重。代理支持需要 Node ≥ 24,当前 '
|
|
210
|
+
+ process.version + '。)';
|
|
211
|
+
} else {
|
|
212
|
+
hint = '\n 代理已配置且已启用,但仍然连不上 —— 请检查代理本身是否可达。';
|
|
213
|
+
}
|
|
214
|
+
}
|
|
185
215
|
throw new NetworkError(`${what} 下载失败:${e.message}${why ? `(${why})` : ''}${hint}`);
|
|
186
216
|
}
|
|
187
217
|
|