@jspg-ai/coding-bb 0.0.3-beta.31 → 0.0.3-beta.32
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.
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* 将编码规范分发到 .claude/rules/ 目录
|
|
5
5
|
*
|
|
6
6
|
* 退市(selectable: false):团队当前不使用 Claude Code,不在安装面板提供。
|
|
7
|
-
* 适配器代码与全部能力保留(含用户级 settings hook
|
|
8
|
-
*
|
|
7
|
+
* 适配器代码与全部能力保留(含用户级 settings hook);旧记录中的遗留内容
|
|
8
|
+
* 不在勾选范围时随清单差集与用户级差集清理移除(ADR 0006)。
|
|
9
9
|
* 恢复入口:删掉 selectable 即可重新出现在面板(决策:不留参数开关)。
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -22,6 +22,6 @@ module.exports = {
|
|
|
22
22
|
settingsFile: path.join(os.homedir(), '.claude', 'settings.json'),
|
|
23
23
|
settingsFileIsUserLevel: true,
|
|
24
24
|
hookEvents: ['UserPromptSubmit'],
|
|
25
|
-
//
|
|
25
|
+
// 退市:不在安装面板提供(代码保留;旧记录遗留随清单/用户级差集清理,ADR 0006)
|
|
26
26
|
selectable: false,
|
|
27
27
|
};
|
package/cbb/lib/install/init.js
CHANGED
|
@@ -105,7 +105,7 @@ const agentsNav = require('./agents-nav');
|
|
|
105
105
|
// 命令 → skill 形态转换(commandsAsSkills 适配器,当前仅 MiniMax Code)
|
|
106
106
|
const commandSkill = require('./command-skill');
|
|
107
107
|
|
|
108
|
-
//
|
|
108
|
+
// 工具选择策略(退市工具不在面板提供;勾选范围即权威,ADR 0006)
|
|
109
109
|
const toolSelection = require('./tool-selection');
|
|
110
110
|
|
|
111
111
|
/** 适配器的 hook 方言参数(Trae 需顶层 version 字段等差异) */
|
|
@@ -384,10 +384,7 @@ async function selectTools(isUpgrade) {
|
|
|
384
384
|
.map(i => selectable[i]);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
//
|
|
388
|
-
result = toolSelection.carryOverRetired(adapters, result, lastTools);
|
|
389
|
-
|
|
390
|
-
// 保存本次选择(含粘性保留项,避免记录丢失导致下次被清理),供下次运行时预选
|
|
387
|
+
// 保存本次选择(勾选范围即权威,供下次运行时预选)
|
|
391
388
|
saveLastTools(result);
|
|
392
389
|
return result;
|
|
393
390
|
}
|
|
@@ -1054,7 +1051,8 @@ async function init(targetDir, options = {}) {
|
|
|
1054
1051
|
fromRecord = true;
|
|
1055
1052
|
} else if (isNonInteractive) {
|
|
1056
1053
|
const lastTools = readLastTools();
|
|
1057
|
-
|
|
1054
|
+
// 旧记录只用于预选可选项——历史遗留的退市工具不并回(ADR 0006:勾选范围即权威)
|
|
1055
|
+
const reused = lastTools ? toolSelection.selectableAdapters(adapters).filter(a => lastTools.has(a.name)) : [];
|
|
1058
1056
|
selectedAdapters = reused.length > 0 ? reused : toolSelection.selectableAdapters(adapters);
|
|
1059
1057
|
fromRecord = reused.length > 0;
|
|
1060
1058
|
if (yes && process.stdin.isTTY) {
|
|
@@ -1066,19 +1064,10 @@ async function init(targetDir, options = {}) {
|
|
|
1066
1064
|
selectedAdapters = await selectTools(isUpgrade);
|
|
1067
1065
|
}
|
|
1068
1066
|
|
|
1069
|
-
//
|
|
1070
|
-
// 覆盖面板外入口:setup 预设(presetAdapters)与非交互记录沿用;交互面板已在 selectTools 内并过。
|
|
1071
|
-
const lastToolsForDir = readLastTools();
|
|
1072
|
-
const withRetired = toolSelection.carryOverRetired(adapters, selectedAdapters, lastToolsForDir);
|
|
1073
|
-
const retiredKept = toolSelection.retiredNames(withRetired);
|
|
1074
|
-
if (retiredKept.length > 0) {
|
|
1075
|
-
log(`保留上次选择的退市工具:${retiredKept.join('、')}(当前不在安装面板提供,内容继续维护)`, 'dim');
|
|
1076
|
-
}
|
|
1077
|
-
selectedAdapters = withRetired;
|
|
1067
|
+
// 退市工具不粘性保留(ADR 0006):选择集即权威,旧记录里的退市工具随清单差集清理
|
|
1078
1068
|
|
|
1079
|
-
//
|
|
1080
|
-
|
|
1081
|
-
if (isWorkspaceRoot && fromRecord) {
|
|
1069
|
+
// 本次选择落盘(沿用旧记录时同样落盘:归一化历史工具名 + 剔除退市遗留记录)
|
|
1070
|
+
if (fromRecord) {
|
|
1082
1071
|
saveLastTools(selectedAdapters);
|
|
1083
1072
|
}
|
|
1084
1073
|
|
|
@@ -1871,8 +1860,10 @@ function printSetupSummary(selected, selectedAdapters, parentDir) {
|
|
|
1871
1860
|
/**
|
|
1872
1861
|
* 安装用户级组件(与项目无关的内容,一次安装全局可用,幂等)。
|
|
1873
1862
|
*
|
|
1874
|
-
* - 清单:~/.cbb/.user-components
|
|
1863
|
+
* - 清单:~/.cbb/.user-components 只记录**本次实装**的用户级路径
|
|
1875
1864
|
* - 内容:check-update hook(settings 由 settingsManager 幂等管理)
|
|
1865
|
+
* - 差集清理(ADR 0006):不在本次目标集合内的适配器,其清单遗留路径、
|
|
1866
|
+
* 本包版本检查 hook、本地插件一并移除(仅删本包标记项,不动用户自装内容)
|
|
1876
1867
|
*/
|
|
1877
1868
|
const USER_MANIFEST_FILE = path.join(os.homedir(), '.cbb', '.user-components');
|
|
1878
1869
|
// 装到用户级的工具 skills(与具体项目无关,任何会话都可能用到)。
|
|
@@ -1884,15 +1875,18 @@ async function setupUserLevelComponents(targetAdapters = toolSelection.selectabl
|
|
|
1884
1875
|
const srcDir = path.join(SHARED_STANDARDS_DIR, 'cbb', 'tools');
|
|
1885
1876
|
if (!fs.existsSync(srcDir)) return;
|
|
1886
1877
|
|
|
1887
|
-
|
|
1878
|
+
// 旧清单仅作差集清理基准,不再并入 managed(ADR 0006:勾选范围即权威,
|
|
1879
|
+
// 本次未实装的路径由下方差集移除,而非累积保留)
|
|
1880
|
+
let oldPaths = [];
|
|
1888
1881
|
const manifestDir = path.dirname(USER_MANIFEST_FILE);
|
|
1889
1882
|
fs.mkdirSync(manifestDir, { recursive: true });
|
|
1890
1883
|
if (fs.existsSync(USER_MANIFEST_FILE)) {
|
|
1891
1884
|
try {
|
|
1892
1885
|
const data = JSON.parse(fs.readFileSync(USER_MANIFEST_FILE, 'utf-8'));
|
|
1893
|
-
|
|
1886
|
+
oldPaths = data.paths || [];
|
|
1894
1887
|
} catch (_) { /* ignore parse errors */ }
|
|
1895
1888
|
}
|
|
1889
|
+
const managed = new Set();
|
|
1896
1890
|
|
|
1897
1891
|
const summaryParts = [];
|
|
1898
1892
|
|
|
@@ -1939,6 +1933,43 @@ async function setupUserLevelComponents(targetAdapters = toolSelection.selectabl
|
|
|
1939
1933
|
summaryParts.push(`版本检查插件 → ${pluginHookAdapters.map(a => a.displayName).join('、')}`);
|
|
1940
1934
|
}
|
|
1941
1935
|
|
|
1936
|
+
// ── 用户级差集清理(ADR 0006:不在本次勾选范围内的工具,用户级组件一并移除)──
|
|
1937
|
+
const targetNames = new Set(targetAdapters.map(a => a.name));
|
|
1938
|
+
|
|
1939
|
+
// 1) 清单路径差集:旧有新无 → 删除(仅本包管理路径,不碰用户自装内容)
|
|
1940
|
+
const removedPaths = [];
|
|
1941
|
+
oldPaths.forEach(relPath => {
|
|
1942
|
+
if (!managed.has(relPath)) {
|
|
1943
|
+
const target = path.join(home, relPath);
|
|
1944
|
+
if (fs.existsSync(target)) {
|
|
1945
|
+
removePath(target);
|
|
1946
|
+
removedPaths.push(relPath);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
});
|
|
1950
|
+
if (removedPaths.length > 0) {
|
|
1951
|
+
summaryParts.push(`移除清单遗留 ×${removedPaths.length}`);
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// 2) 非目标适配器:摘除本包版本检查 hook(仅删 _managedBy: cbb 标记项,保留用户配置)
|
|
1955
|
+
// + 本地插件目录
|
|
1956
|
+
const removedNames = [];
|
|
1957
|
+
adapters.filter(a => !targetNames.has(a.name)).forEach(adapter => {
|
|
1958
|
+
let touched = false;
|
|
1959
|
+
if (adapter.settingsFile && adapter.hookEvents) {
|
|
1960
|
+
if (settingsManager.removeHooks(adapter.settingsFile, adapter.hookEvents, hookOpts(adapter))) touched = true;
|
|
1961
|
+
if (cleanLegacySettings(adapter)) touched = true;
|
|
1962
|
+
}
|
|
1963
|
+
if (adapter.pluginHook &&
|
|
1964
|
+
pluginHookManager.remove({ dataDir: adapter.resolveDataDir(), ...adapter.pluginHook })) {
|
|
1965
|
+
touched = true;
|
|
1966
|
+
}
|
|
1967
|
+
if (touched) removedNames.push(adapter.displayName);
|
|
1968
|
+
});
|
|
1969
|
+
if (removedNames.length > 0) {
|
|
1970
|
+
summaryParts.push(`清理 ${removedNames.join('、')} 的用户级组件`);
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1942
1973
|
if (summaryParts.length > 0) step('✓', '用户级组件', summaryParts.join(' · '));
|
|
1943
1974
|
|
|
1944
1975
|
const pkg = require(path.join(SHARED_STANDARDS_DIR, 'package.json'));
|
|
@@ -1955,9 +1986,10 @@ async function setupUserLevelComponents(targetAdapters = toolSelection.selectabl
|
|
|
1955
1986
|
* worktree 管理入口与空间导航;旧子集清单升级时由清单差集机制自动补齐全量内容。
|
|
1956
1987
|
*/
|
|
1957
1988
|
async function updateInstalled() {
|
|
1958
|
-
// 用户级组件沿用本目录的工具选择(.last-tools
|
|
1989
|
+
// 用户级组件沿用本目录的工具选择(.last-tools),无记录或为空才回退全量。
|
|
1990
|
+
// 旧记录只预选可选项——历史遗留的退市工具不并回(ADR 0006)
|
|
1959
1991
|
const lastTools = readLastTools();
|
|
1960
|
-
const reused = lastTools ? adapters.filter(a => lastTools.has(a.name)) : [];
|
|
1992
|
+
const reused = lastTools ? toolSelection.selectableAdapters(adapters).filter(a => lastTools.has(a.name)) : [];
|
|
1961
1993
|
await setupUserLevelComponents(reused.length > 0 ? reused : toolSelection.selectableAdapters(adapters));
|
|
1962
1994
|
|
|
1963
1995
|
const manifest = readManifest();
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* 退市(selectable: false):实测 MiniMax Code 不支持目录级 skill 与 command
|
|
20
20
|
* (无项目级 commands 目录,skill 亦需插件形态承载),当前分发形态不可用。
|
|
21
21
|
* 适配器代码与全部能力保留(备将来改走插件形态),但不在安装面板提供;
|
|
22
|
-
*
|
|
22
|
+
* 旧记录中的遗留内容不在勾选范围时随清单差集与用户级差集清理移除(ADR 0006)。
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const path = require('path');
|
|
@@ -55,6 +55,6 @@ module.exports = {
|
|
|
55
55
|
timeout: 10,
|
|
56
56
|
},
|
|
57
57
|
resolveDataDir,
|
|
58
|
-
//
|
|
58
|
+
// 退市:不在安装面板提供(代码保留;旧记录遗留随清单/用户级差集清理,ADR 0006)
|
|
59
59
|
selectable: false,
|
|
60
60
|
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 工具选择策略:安装面板的可见集合(未退市适配器)。
|
|
5
5
|
*
|
|
6
6
|
* 背景(2026-09-28 决策):MiniMax Code 实测不支持目录级 skill 与 command、
|
|
7
7
|
* Claude Code 团队当前未用,两者**退市**——适配器与全部能力保留(见各适配器
|
|
8
8
|
* 文件头),仅不在 `cbb setup` / `cbb update` 的安装面板提供。
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* 恢复入口:删掉适配器的 `selectable: false` 即回到面板(决策:不留参数开关)。
|
|
10
|
+
* 退市工具的取舍(ADR 0006,反转 beta.30 的粘性保留决策):
|
|
11
|
+
* - 退市工具**不进**选择集:面板、非交互沿用、setup 预设、用户级组件,
|
|
12
|
+
* 一律只用未退市适配器(`selectable !== false`);
|
|
13
|
+
* - 勾选范围即权威:`.last-tools` 只如实记录本次实际选择,不在范围内的
|
|
14
|
+
* 工具内容(含用户级 hook / 插件)由清单差集与用户级差集清理移除;
|
|
15
|
+
* - 恢复入口:删掉适配器的 `selectable: false` 即回到面板。
|
|
18
16
|
*/
|
|
19
17
|
|
|
20
18
|
/** 面板/默认可选适配器(未标 selectable: false 的全部) */
|
|
@@ -22,24 +20,4 @@ function selectableAdapters(adapters) {
|
|
|
22
20
|
return adapters.filter(a => a.selectable !== false);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
* 把「本空间旧记录中的退市工具」并入选择结果(按注册表顺序追加,去重)。
|
|
27
|
-
* @param {Array} adapters 注册表全量
|
|
28
|
-
* @param {Array} selected 本次选择(面板 / 预设 / 记录沿用)
|
|
29
|
-
* @param {Set<string>|null} lastTools 该空间的旧工具记录(.last-tools)
|
|
30
|
-
* @returns {Array} 并入后的有序数组(无退市工具需保留时原样返回)
|
|
31
|
-
*/
|
|
32
|
-
function carryOverRetired(adapters, selected, lastTools) {
|
|
33
|
-
if (!lastTools || lastTools.size === 0) return selected;
|
|
34
|
-
const selectedNames = new Set(selected.map(a => a.name));
|
|
35
|
-
const carried = adapters.filter(a =>
|
|
36
|
-
a.selectable === false && lastTools.has(a.name) && !selectedNames.has(a.name));
|
|
37
|
-
return carried.length > 0 ? selected.concat(carried) : selected;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** 结果集中退市工具的显示名(供安装输出提示,如「保留上次选择的 Claude Code」) */
|
|
41
|
-
function retiredNames(selected) {
|
|
42
|
-
return selected.filter(a => a.selectable === false).map(a => a.displayName);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = { selectableAdapters, carryOverRetired, retiredNames };
|
|
23
|
+
module.exports = { selectableAdapters };
|