ribo-cli-setup 2.2.0 → 2.4.0

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.js +31 -11
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * npx ribo-cli-setup --force # 忽略本地已存在版本,强制重新下载
11
11
  * npx ribo-cli-setup --upgrade # 升级:强制重下二进制 + 重新安装技能(不碰 mcp.json)
12
12
  * npx ribo-cli-setup --uninstall # 解除注册
13
+ * npx ribo-cli-setup --auth # 独立执行实名授权(需已安装 ribo-cli)
13
14
  *
14
15
  * 环境变量:RIBO_GATEWAY_URL 可替代 --gateway
15
16
  * 流程:检测 os/arch → 拉 /download/manifest → 匹配平台二进制 → 下载校验 sha256
@@ -37,8 +38,9 @@ function parseArgs(argv) {
37
38
  force: false,
38
39
  upgrade: false,
39
40
  uninstall: false,
41
+ auth: false,
40
42
  skipAuth: false,
41
- yes: false,
43
+ yes: true,
42
44
  help: false,
43
45
  };
44
46
  for (let i = 0; i < argv.length; i++) {
@@ -52,6 +54,7 @@ function parseArgs(argv) {
52
54
  case '--force': case '-f': opts.force = true; break;
53
55
  case '--upgrade': opts.upgrade = true; break;
54
56
  case '--uninstall': opts.uninstall = true; break;
57
+ case '--auth': opts.auth = true; break;
55
58
  case '--skip-auth': opts.skipAuth = true; break;
56
59
  case '--yes': case '-y': opts.yes = true; break;
57
60
  case '--help': case '-h': opts.help = true; break;
@@ -69,6 +72,10 @@ function parseArgs(argv) {
69
72
  console.error(`--upgrade 与 --uninstall 不能同时使用`);
70
73
  process.exit(2);
71
74
  }
75
+ if (opts.auth && (opts.upgrade || opts.uninstall)) {
76
+ console.error(`--auth 不能与 --upgrade/--uninstall 同时使用`);
77
+ process.exit(2);
78
+ }
72
79
  return opts;
73
80
  }
74
81
 
@@ -87,6 +94,7 @@ function printHelp() {
87
94
  --bin-dir <dir> 二进制安装目录(默认 ~/.local/bin)
88
95
  -f, --force 忽略本地已有版本,强制重新下载
89
96
  --upgrade 升级:强制重下二进制 + 重新安装技能(不碰 mcp.json)
97
+ --auth 独立执行实名授权(需已安装 ribo-cli)
90
98
  --skip-auth 安装后不自动执行 auth init
91
99
  --uninstall 解除注册(移除 mcp.json 条目与 Skill 包)
92
100
  -y, --yes 跳过所有确认
@@ -218,13 +226,25 @@ async function main() {
218
226
  const binPath = path.join(binDir, BIN_NAME);
219
227
 
220
228
  console.log('┌─────────────────────────────────────────────┐');
221
- console.log('│ ribo-cli-setup 一键安装器 │');
229
+ console.log('│ 播AI工具(ribo-cli) 管理器 │');
222
230
  console.log('└─────────────────────────────────────────────┘');
223
231
  console.log(` 平台: ${plat.osName}/${plat.archName}`);
224
232
  console.log(` 网关: ${opts.gateway}`);
225
233
  console.log(` 安装目录: ${binDir}`);
226
234
  console.log();
227
235
 
236
+ // 独立授权分支:仅执行 auth init,不拉清单、不下载
237
+ if (opts.auth) {
238
+ if (!fs.existsSync(binPath)) {
239
+ console.error(`✗ 未找到 ${binPath}`);
240
+ console.error(` 请先执行 npx ribo-cli-setup 安装 ribo-cli`);
241
+ process.exit(1);
242
+ }
243
+ console.log('→ 发起实名授权(将打开浏览器/企微扫码,完成后回到终端)…');
244
+ runInteractive(binPath, ['auth', 'init']);
245
+ return;
246
+ }
247
+
228
248
  // 拉取清单
229
249
  let manifest;
230
250
  try {
@@ -338,15 +358,7 @@ async function main() {
338
358
  console.log('→ 配置网关地址…');
339
359
  run(binPath, ['config', 'set-gateway', opts.gateway]);
340
360
 
341
- // 选择接入目标
342
- const tgt = opts.target || (await pickTarget(opts));
343
- if (!tgt) { console.error('未指定接入目标,已取消(仅完成二进制安装)'); notePathIfMissing(binDir); return; }
344
- const flag = tgt === 'qwenwork' ? '--qwenwork' : '--workbuddy';
345
-
346
- console.log(`→ 接入 ${tgt === 'qwenwork' ? '千问办公' : 'WorkBuddy'}…`);
347
- run(binPath, ['install', flag]);
348
-
349
- // 实名授权
361
+ // 实名授权(先于技能安装,确保安装时已有有效凭据)
350
362
  if (!opts.skipAuth) {
351
363
  const doAuth = opts.yes || (await confirm('是否现在执行实名授权(ribo-cli auth init)?', false));
352
364
  if (doAuth) {
@@ -357,6 +369,14 @@ async function main() {
357
369
  }
358
370
  }
359
371
 
372
+ // 选择接入目标并安装技能
373
+ const tgt = opts.target || (await pickTarget(opts));
374
+ if (!tgt) { console.error('未指定接入目标,已取消(仅完成二进制安装)'); notePathIfMissing(binDir); return; }
375
+ const flag = tgt === 'qwenwork' ? '--qwenwork' : '--workbuddy';
376
+
377
+ console.log(`→ 接入 ${tgt === 'qwenwork' ? '千问办公' : 'WorkBuddy'}…`);
378
+ run(binPath, ['install', flag]);
379
+
360
380
  notePathIfMissing(binDir);
361
381
  console.log();
362
382
  console.log('✓ 全部完成。');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ribo-cli-setup",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "ribo-cli 一键安装器:检测操作系统与 CPU 架构,从 ribo 网关下载对应平台 CLI 二进制,完成 WorkBuddy / 千问办公接入与实名授权",
5
5
  "bin": {
6
6
  "ribo-cli-setup": "bin/cli.js"