zero-ai 1.0.59 → 1.0.61
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
|
@@ -13,6 +13,7 @@ module.exports = async (options) => {
|
|
|
13
13
|
const cursorRulesSource = path.join(repoCache, ".cursor/rules");
|
|
14
14
|
const cursorRulesTarget = path.resolve(outputPath, ".cursor/rules");
|
|
15
15
|
const traeRulesTarget = path.resolve(outputPath, ".trae/rules");
|
|
16
|
+
const lingmaRulesTarget = path.resolve(outputPath, ".lingma/rules");
|
|
16
17
|
|
|
17
18
|
Ec.execute(`准备从远程仓库下载 Cursor 规则配置...`);
|
|
18
19
|
Ec.info(`远程仓库地址:${repoUrl}`);
|
|
@@ -92,7 +93,7 @@ module.exports = async (options) => {
|
|
|
92
93
|
{
|
|
93
94
|
type: "checkbox",
|
|
94
95
|
name: "selectedFiles",
|
|
95
|
-
message: "
|
|
96
|
+
message: "请选择要安装的规则文件:",
|
|
96
97
|
choices: ruleFiles.map(file => ({
|
|
97
98
|
name: file,
|
|
98
99
|
value: file,
|
|
@@ -106,38 +107,82 @@ module.exports = async (options) => {
|
|
|
106
107
|
process.exit(0);
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
const { selectedTargets } = await inquirer.prompt([
|
|
111
|
+
{
|
|
112
|
+
type: "checkbox",
|
|
113
|
+
name: "selectedTargets",
|
|
114
|
+
message: "请选择输出目标(选几个就输出几个):",
|
|
115
|
+
choices: [
|
|
116
|
+
{ name: "Cursor:.cursor/rules(.mdc)", value: "cursor", checked: true },
|
|
117
|
+
{ name: "Trae:.trae/rules(.md)", value: "trae", checked: true },
|
|
118
|
+
{ name: "Lingma:.lingma/rules(.mdc)", value: "lingma", checked: true }
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
if (selectedTargets.length === 0) {
|
|
124
|
+
Ec.info(`未选择任何输出目标,操作取消。`);
|
|
125
|
+
process.exit(0);
|
|
112
126
|
}
|
|
113
127
|
|
|
114
|
-
Ec.execute(`正在安装选中的 ${selectedFiles.length}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
fs.
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
Ec.execute(`正在安装选中的 ${selectedFiles.length} 个规则文件到 ${selectedTargets.length} 个目标...`);
|
|
129
|
+
|
|
130
|
+
// Cursor:.cursor/rules,mdc 格式
|
|
131
|
+
if (selectedTargets.includes("cursor")) {
|
|
132
|
+
if (!fs.existsSync(cursorRulesTarget)) {
|
|
133
|
+
fs.mkdirSync(cursorRulesTarget, { recursive: true });
|
|
134
|
+
Ec.info(`创建目标目录:${cursorRulesTarget}`);
|
|
135
|
+
}
|
|
136
|
+
Ec.execute(`输出到 Cursor (.cursor/rules, .mdc)...`);
|
|
137
|
+
selectedFiles.forEach(file => {
|
|
138
|
+
const sourcePath = path.join(cursorRulesSource, file);
|
|
139
|
+
const targetPath = path.join(cursorRulesTarget, file);
|
|
140
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
141
|
+
Ec.info(` ✓ ${file} → .cursor/rules`);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
121
144
|
|
|
122
|
-
//
|
|
123
|
-
if (
|
|
124
|
-
fs.
|
|
125
|
-
|
|
145
|
+
// Trae:.trae/rules,md 格式
|
|
146
|
+
if (selectedTargets.includes("trae")) {
|
|
147
|
+
if (!fs.existsSync(traeRulesTarget)) {
|
|
148
|
+
fs.mkdirSync(traeRulesTarget, { recursive: true });
|
|
149
|
+
Ec.info(`创建目标目录:${traeRulesTarget}`);
|
|
150
|
+
}
|
|
151
|
+
Ec.execute(`输出到 Trae (.trae/rules, .md)...`);
|
|
152
|
+
selectedFiles.forEach(file => {
|
|
153
|
+
const sourcePath = path.join(cursorRulesSource, file);
|
|
154
|
+
const targetFileName = file.endsWith(".mdc") ? file.slice(0, -4) + ".md" : file;
|
|
155
|
+
const targetPath = path.join(traeRulesTarget, targetFileName);
|
|
156
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
157
|
+
Ec.info(` ✓ ${file} → ${targetFileName} → .trae/rules`);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Lingma:.lingma/rules,mdc 格式
|
|
162
|
+
if (selectedTargets.includes("lingma")) {
|
|
163
|
+
if (!fs.existsSync(lingmaRulesTarget)) {
|
|
164
|
+
fs.mkdirSync(lingmaRulesTarget, { recursive: true });
|
|
165
|
+
Ec.info(`创建目标目录:${lingmaRulesTarget}`);
|
|
166
|
+
}
|
|
167
|
+
Ec.execute(`输出到 Lingma (.lingma/rules, .mdc)...`);
|
|
168
|
+
selectedFiles.forEach(file => {
|
|
169
|
+
const sourcePath = path.join(cursorRulesSource, file);
|
|
170
|
+
const targetPath = path.join(lingmaRulesTarget, file);
|
|
171
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
172
|
+
Ec.info(` ✓ ${file} → .lingma/rules`);
|
|
173
|
+
});
|
|
126
174
|
}
|
|
127
|
-
Ec.execute(`正在拷贝规则文件到 .trae/rules/...`);
|
|
128
|
-
selectedFiles.forEach(file => {
|
|
129
|
-
const sourcePath = path.join(cursorRulesSource, file);
|
|
130
|
-
const targetPath = path.join(traeRulesTarget, file);
|
|
131
|
-
fs.copyFileSync(sourcePath, targetPath);
|
|
132
|
-
Ec.info(` ✓ ${file} 已安装到 .trae/rules`);
|
|
133
|
-
});
|
|
134
175
|
|
|
176
|
+
const targetLabels = [];
|
|
177
|
+
if (selectedTargets.includes("cursor")) targetLabels.push(".cursor/rules");
|
|
178
|
+
if (selectedTargets.includes("trae")) targetLabels.push(".trae/rules");
|
|
179
|
+
if (selectedTargets.includes("lingma")) targetLabels.push(".lingma/rules");
|
|
135
180
|
Ec.info(`所有规则文件安装完成!`);
|
|
136
|
-
Ec.info(`安装位置:${
|
|
181
|
+
Ec.info(`安装位置:${targetLabels.join("、")}`);
|
|
137
182
|
Ec.info(`已安装 ${selectedFiles.length} 个规则文件`);
|
|
138
183
|
|
|
139
184
|
// 添加 AI 工具目录到 .git/info/exclude
|
|
140
|
-
const excludeEntries = [".cursor/", ".claude/", ".gemini/", ".trae/"];
|
|
185
|
+
const excludeEntries = [".cursor/", ".claude/", ".gemini/", ".trae/", ".lingma/"];
|
|
141
186
|
const gitPath = path.resolve(outputPath, ".git");
|
|
142
187
|
|
|
143
188
|
Ec.execute(`正在配置 Git 排除规则...`);
|