Skip to content

Commit ab72e04

Browse files
committed
docs(contributing): add guide for adding new IDE support
- Document how to add system-level rules target path in RULES_TARGETS - Explain IDE-specific rules directory configuration in ideRulesConfigs - Add optional skills directory synchronization guide - Include verification steps and complete example for adding new IDE
1 parent e8dd265 commit ab72e04

1 file changed

Lines changed: 79 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,92 @@ config/
172172
- ✅ 通过硬链接自动同步到所有其他 IDE 的规则文件
173173
- ✅ 修改一个文件,所有文件都会更新(因为是硬链接)
174174

175+
### 如何新增 IDE 支持
176+
177+
当需要支持新的 AI IDE 时,需要修改 `scripts/fix-config-hardlinks.mjs` 文件中的以下配置:
178+
179+
#### 1. 添加系统顶级 Rules 目标路径
180+
181+
`RULES_TARGETS` 数组中添加新 IDE 的规则文件路径:
182+
183+
```javascript
184+
const RULES_TARGETS = [
185+
// ... 现有配置
186+
"config/.your-ide/rules/cloudbase-rules.md", // 新增 IDE 的规则文件路径
187+
];
188+
```
189+
190+
**注意事项**
191+
- 文件扩展名根据 IDE 要求选择(`.md``.mdc``.mdr` 等)
192+
- 路径格式:`config/.{ide-name}/rules/cloudbase-rules.{ext}`
193+
194+
#### 2. 添加 IDE 特定 Rules 目录配置
195+
196+
`syncRulesToIDEDirectories()` 函数的 `ideRulesConfigs` 数组中添加配置:
197+
198+
```javascript
199+
const ideRulesConfigs = [
200+
// ... 现有配置
201+
{
202+
dir: "config/.your-ide/rules",
203+
convertMdToMdc: false // 如果 IDE 需要 .mdc 格式,设为 true
204+
},
205+
];
206+
```
207+
208+
**配置说明**
209+
- `dir`: IDE 的 rules 目录路径
210+
- `convertMdToMdc`: 是否需要将 `.md` 文件转换为 `.mdc` 格式(仅 Cursor 需要)
211+
212+
#### 3. 添加 Skills 目录同步(可选)
213+
214+
如果新 IDE 需要同步 skills 目录,修改 `syncSkillsDirectory()` 函数:
215+
216+
```javascript
217+
const SKILLS_SOURCE_DIR = "config/.claude/skills";
218+
const SKILLS_TARGET_DIR = "config/.codebuddy/skills";
219+
// 如果需要同步到新 IDE,添加新的目标目录配置
220+
```
221+
222+
然后在 `main()` 函数中调用同步函数。
223+
224+
#### 4. 运行同步脚本验证
225+
226+
修改完成后,运行同步脚本验证配置:
227+
228+
```bash
229+
npm run build:rules-sync
230+
```
231+
232+
**验证检查**
233+
- ✅ 检查新 IDE 目录是否创建
234+
- ✅ 检查规则文件是否正确硬链接
235+
- ✅ 检查文件格式转换是否正确(如果设置了 `convertMdToMdc: true`
236+
237+
#### 示例:添加新 IDE "MyIDE"
238+
239+
```javascript
240+
// 1. 在 RULES_TARGETS 中添加
241+
const RULES_TARGETS = [
242+
// ... 现有配置
243+
"config/.myide/rules/cloudbase-rules.md",
244+
];
245+
246+
// 2. 在 ideRulesConfigs 中添加
247+
const ideRulesConfigs = [
248+
// ... 现有配置
249+
{ dir: "config/.myide/rules", convertMdToMdc: false },
250+
];
251+
```
252+
175253
### 重要提示
176254

177255
- ⚠️ **不要直接修改** `config/rules` 或其他 IDE 目录中的文件
178256
-**新增模块**:在 `config/.claude/skills` 中创建
179257
-**修改顶级规则**:在 `config/.cursor/rules/cloudbase-rules.mdc` 中修改
180258
-**运行同步**:修改后运行 `npm run build:rules-sync` 同步到所有位置
181259
- 💡 **硬链接机制**:使用硬链接确保所有 IDE 配置文件保持一致,修改一处即可同步到所有位置
260+
- 🔧 **新增 IDE**:修改 `fix-config-hardlinks.mjs` 中的配置数组,然后运行同步脚本
182261

183262
## 代码风格
184263

0 commit comments

Comments
 (0)