@yuanjielab/cli 0.3.0 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuanjielab/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "原界 CLI —— 让外部 AI 工具读写原界云文档(含 stdio MCP 面)",
5
5
  "bin": {
6
6
  "yj": "bin/yj.js"
@@ -97,11 +97,20 @@ async function main() {
97
97
  die(`清单里 ${key} 这条没有 sha256,拒绝在不校验的情况下安装。`);
98
98
  }
99
99
 
100
+ // 清单里的 `path` 是从清单所在目录出发的相对路径,拼上去必对;老清单没有
101
+ // 这一格,回落到 bin/+file——**这个回落不是可选项**:本脚本按版本号读的
102
+ // versions/<版本>.json 都是不动的老清单,不回落就装不了任何历史版本。
103
+ // ⚠️ 绝对 URL 一律拒绝:那会让清单把下载指到别处,且 YJ_DOWNLOAD_BASE
104
+ // 那个换源开关安静失效,两件事都不报错。
105
+ const rel = entry.path || `bin/${entry.file}`;
106
+ if (/:\/\//.test(rel) || rel.startsWith('/') || rel.includes('..')) {
107
+ die(`清单里 ${key} 这条的 path 不是相对路径(${rel}),拒绝下载。`);
108
+ }
100
109
  let buf;
101
110
  try {
102
- buf = await get(`${BASE}/bin/${entry.file}`);
111
+ buf = await get(`${BASE}/${rel}`);
103
112
  } catch (err) {
104
- die(`下载 ${BASE}/bin/${entry.file} 失败(${err.message})。`);
113
+ die(`下载 ${BASE}/${rel} 失败(${err.message})。`);
105
114
  }
106
115
 
107
116
  // 长度与校验和**各报各的**:长度对不上多半是网络截断(重试有用),