@jspg-ai/coding-bb 0.0.2-beta.26 → 0.0.2-beta.28
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/cbb/lib/install/init.js +7 -16
- package/package.json +1 -1
package/cbb/lib/install/init.js
CHANGED
|
@@ -1160,16 +1160,16 @@ async function installWorkspaceConfig(targetDir, options = {}) {
|
|
|
1160
1160
|
// ── cbb setup 命令 ──────────────────────────────────────
|
|
1161
1161
|
|
|
1162
1162
|
/**
|
|
1163
|
-
* 若 targetDir
|
|
1163
|
+
* 若 targetDir 已安装,比较已装版本与当前包版本决定是否继续安装。
|
|
1164
1164
|
* - 版本一致 → 返回 'skip'(不询问、不重复安装)
|
|
1165
|
-
* - 版本不同 →
|
|
1165
|
+
* - 版本不同 → 返回 'install'(setup 已整体确认过,直接升级到当前包版本,不再二次询问)
|
|
1166
1166
|
* - 未安装 → 返回 'install'(不提示,直接继续)
|
|
1167
1167
|
*
|
|
1168
1168
|
* 注:只比较「已装版本 vs 当前包版本」——安装动作只能落盘当前包的产物,
|
|
1169
1169
|
* registry 是否有更新由用户级版本检查 hook 提醒,不在此处联网查询。
|
|
1170
|
-
* @returns {
|
|
1170
|
+
* @returns {'install'|'skip'}
|
|
1171
1171
|
*/
|
|
1172
|
-
|
|
1172
|
+
function decideUpgradeIfInstalled(targetDir) {
|
|
1173
1173
|
const installed = version.readInstalledVersion(targetDir);
|
|
1174
1174
|
if (!installed) return 'install'; // 未安装:不提示,直接继续
|
|
1175
1175
|
|
|
@@ -1181,12 +1181,7 @@ async function confirmUpgradeIfInstalled(targetDir) {
|
|
|
1181
1181
|
return 'skip';
|
|
1182
1182
|
}
|
|
1183
1183
|
|
|
1184
|
-
step('
|
|
1185
|
-
const answer = await ask(`? 升级到 v${pkg.version}?(Y/n) `);
|
|
1186
|
-
if (answer && answer.toLowerCase() === 'n') {
|
|
1187
|
-
step('!', '版本', '已跳过安装/升级', { iconColor: 'yellow' });
|
|
1188
|
-
return 'cancel';
|
|
1189
|
-
}
|
|
1184
|
+
step('✓', '版本', `v${installed} → v${pkg.version}`);
|
|
1190
1185
|
return 'install';
|
|
1191
1186
|
}
|
|
1192
1187
|
|
|
@@ -1479,11 +1474,8 @@ async function initSingleWorkspace(w, opts = {}) {
|
|
|
1479
1474
|
console.log(` ${c('gray', `${names} → 编辑 workspace-config.json 填入真实仓库地址`)}`);
|
|
1480
1475
|
}
|
|
1481
1476
|
|
|
1482
|
-
// 5.
|
|
1483
|
-
const decision =
|
|
1484
|
-
if (decision === 'cancel') {
|
|
1485
|
-
return { ok: false, error: 'USER_CANCELLED', skipped: true };
|
|
1486
|
-
}
|
|
1477
|
+
// 5. 若已安装:版本未变化直接跳过;有新版本直接升级(setup 已整体确认过,不再二次询问)
|
|
1478
|
+
const decision = decideUpgradeIfInstalled(targetDir);
|
|
1487
1479
|
if (decision === 'skip') {
|
|
1488
1480
|
return { ok: true, subdir: subdirName, upToDate: true };
|
|
1489
1481
|
}
|
|
@@ -1506,7 +1498,6 @@ function describeBatchError(r) {
|
|
|
1506
1498
|
case 'CLONE_FAILED': return `git clone 失败:${r.message || ''}`.trim();
|
|
1507
1499
|
case 'PULL_FAILED': return `工作空间仓库同步失败:${r.message || ''}`.trim();
|
|
1508
1500
|
case 'CONFIG_INVALID': return `workspace-config.json 不合法:${r.message || ''}`.trim();
|
|
1509
|
-
case 'USER_CANCELLED': return '用户取消升级';
|
|
1510
1501
|
case 'INIT_FAILED': return `初始化失败:${r.message || ''}`.trim();
|
|
1511
1502
|
default: return r.error || '未知错误';
|
|
1512
1503
|
}
|