zero-ai 1.0.86 → 1.0.87
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
|
@@ -89,25 +89,72 @@ module.exports = async (options) => {
|
|
|
89
89
|
Ec.info(` ${index + 1}. ${file}`);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
// 按前缀分组 MDC 文件
|
|
93
|
+
const prefixGroups = [
|
|
94
|
+
{ prefix: "r2-spec-", label: "核心规范" },
|
|
95
|
+
{ prefix: "r2-go-", label: "GoLang全栈开发" },
|
|
96
|
+
{ prefix: "r2-rust-", label: "Rust前端开发" },
|
|
97
|
+
{ prefix: "r2-ui", label: "AntD前端开发" },
|
|
98
|
+
{ prefix: "r2-backend-spring-", label: "Spring后端开发" },
|
|
99
|
+
{ prefix: "r2-backend-zero-", label: "Zero后端开发" },
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
const groupedFiles = {};
|
|
103
|
+
const matchedFiles = new Set();
|
|
104
|
+
prefixGroups.forEach(({ prefix }) => {
|
|
105
|
+
const matched = ruleFiles.filter(f => f.startsWith(prefix));
|
|
106
|
+
if (matched.length > 0) {
|
|
107
|
+
groupedFiles[prefix] = matched;
|
|
108
|
+
matched.forEach(f => matchedFiles.add(f));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const ungroupedFiles = ruleFiles.filter(f => !matchedFiles.has(f));
|
|
113
|
+
|
|
114
|
+
// 构造选择列表:前缀组(显示中文标签+数量)+ 未匹配文件并排
|
|
115
|
+
const mdcChoices = [];
|
|
116
|
+
prefixGroups.forEach(({ prefix, label }) => {
|
|
117
|
+
if (groupedFiles[prefix]) {
|
|
118
|
+
mdcChoices.push({
|
|
119
|
+
name: `${label}(${groupedFiles[prefix].length} 个文件)`,
|
|
120
|
+
value: { type: "group", prefix },
|
|
121
|
+
checked: false,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
ungroupedFiles.forEach(file => {
|
|
126
|
+
mdcChoices.push({
|
|
127
|
+
name: file,
|
|
128
|
+
value: { type: "single", file },
|
|
129
|
+
checked: false,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const { selectedChoices } = await inquirer.prompt([
|
|
93
134
|
{
|
|
94
135
|
type: "checkbox",
|
|
95
|
-
name: "
|
|
136
|
+
name: "selectedChoices",
|
|
96
137
|
message: "请选择要安装的规则文件:",
|
|
97
138
|
loop: false,
|
|
98
|
-
choices:
|
|
99
|
-
name: file,
|
|
100
|
-
value: file,
|
|
101
|
-
checked: false
|
|
102
|
-
}))
|
|
139
|
+
choices: mdcChoices,
|
|
103
140
|
}
|
|
104
141
|
]);
|
|
105
142
|
|
|
106
|
-
if (
|
|
143
|
+
if (selectedChoices.length === 0) {
|
|
107
144
|
Ec.info(`未选择任何文件,操作取消。`);
|
|
108
145
|
process.exit(0);
|
|
109
146
|
}
|
|
110
147
|
|
|
148
|
+
// 展开所选项为最终文件列表
|
|
149
|
+
const selectedFiles = [];
|
|
150
|
+
selectedChoices.forEach(choice => {
|
|
151
|
+
if (choice.type === "group") {
|
|
152
|
+
groupedFiles[choice.prefix].forEach(f => selectedFiles.push(f));
|
|
153
|
+
} else {
|
|
154
|
+
selectedFiles.push(choice.file);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
111
158
|
const { selectedTargets } = await inquirer.prompt([
|
|
112
159
|
{
|
|
113
160
|
type: "checkbox",
|