Skip to content

Commit b47de7d

Browse files
committed
[copilot]:add copilot-instructions
1 parent b3f550c commit b47de7d

1 file changed

Lines changed: 193 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# GitHub Copilot Review Instructions for RT-Thread Packages / RT-Thread 软件包仓库 Copilot 评审指南
2+
3+
## Overview / 概述
4+
5+
RT-Thread Packages is a repository of package indexes. Each package entry is defined by a folder containing `Kconfig` and `package.json`. Reviewers must focus on metadata correctness, Kconfig consistency, and repository policies so packages can be discovered and fetched correctly by the RT-Thread tooling.
6+
7+
RT-Thread Packages 仓库用于保存软件包索引信息。每个软件包目录包含 `Kconfig``package.json`。评审时需重点关注元数据正确性、Kconfig 一致性以及仓库规范,确保包能被工具正确发现与下载。
8+
9+
**When reviewing PRs, you MUST check all items in the PR Review Checklist section and provide feedback according to the PR Review Instructions.**
10+
11+
**审查 PR 时,必须检查 PR 审查清单中的所有项目,并按 PR 审查指令提供反馈。**
12+
13+
## Language Requirements / 语言要求
14+
15+
Provide review feedback in **both English and Chinese**.
16+
17+
评审反馈必须**中英文双语**
18+
19+
## Review Focus Areas / 审查重点领域
20+
21+
1. **Package Index Integrity / 软件包索引完整性**
22+
- Folder name matches `package.json` field `name` (case-sensitive) / 目录名与 `package.json``name` 一致(区分大小写)
23+
- Each package folder includes `Kconfig` and `package.json` / 每个包目录包含 `Kconfig``package.json`
24+
- Category `Kconfig` sources the package / 分类 `Kconfig` 中引用该包
25+
26+
2. **package.json Schema & Style / package.json 结构与风格**
27+
- 4-space indent, UTF-8, no trailing commas / 4 空格缩进、UTF-8、无尾随逗号
28+
- Required fields: `name`, `description`, `author`, `license`, `site` / 必需字段:`name``description``author``license``site`
29+
- `site` entries include `version`, `URL`, `filename`, `VER_SHA` / `site` 中包含 `version``URL``filename``VER_SHA`
30+
- Keywords concise, lowercase naming preferred / 关键词简洁,名称尽量小写
31+
32+
3. **Versioning & Source URLs / 版本与源码链接**
33+
- Provide at least one fixed version plus `latest` when supported / 至少提供一个固定版本,支持时再提供 `latest`
34+
- Prefer immutable tags/commits for releases / 优先使用不可变标签或提交
35+
- `URL` must be GitHub HTTPS (no gitee links) / `URL` 必须为 GitHub HTTPS(禁止 gitee 链接)
36+
- `VER_SHA` resolves to an existing branch/commit / `VER_SHA` 指向有效分支/提交
37+
- Upstream repo name should not start with digits / 上游仓库名避免以数字开头
38+
- Upstream repo must not use submodules / 上游仓库禁止使用子模块
39+
40+
4. **Kconfig Consistency / Kconfig 一致性**
41+
- Main option `PKG_USING_<PACKAGE>` / 主选项 `PKG_USING_<PACKAGE>`
42+
- Feature options prefix `<PACKAGE>_` / 功能选项前缀 `<PACKAGE>_`
43+
- Preserve existing ordering and generated comments / 保持现有顺序与生成的注释
44+
45+
5. **Repository Hygiene / 仓库规范**
46+
- No binary blobs in git / 禁止提交二进制文件
47+
- Shared assets only in `figures/` / 共享资源仅放在 `figures/`
48+
49+
6. **Validation & Tests / 校验与测试**
50+
- `python ci.py` should pass / `python ci.py` 需通过
51+
- JSON syntax check recommended: `python -m json.tool path/to/package.json` / 建议进行 JSON 语法检查
52+
- If applicable, verify in Env: menuconfig -> `pkgs --update` -> build with `scons` / 条件允许时在 Env 中验证
53+
54+
## PR Review Checklist / PR 审查清单
55+
56+
- PR title follows repository conventions and matches modified package(s) / PR 标题符合仓库规范并匹配修改包
57+
- PR description includes What/Why/How and related files / PR 描述包含 What/Why/How 及相关文件
58+
- Changes focus on a single package or a tightly related set / 变更聚焦于单一包或紧密相关的集合
59+
- `package.json` field correctness, style, and URL policy / `package.json` 字段正确、格式规范、URL 合规
60+
- Kconfig entries are consistent with package name and location / Kconfig 与包名/目录一致
61+
- Version entries are valid and include fixed version(s) / 版本条目有效且包含固定版本
62+
- Repository hygiene rules are respected / 仓库规范得到遵守
63+
- CI/validation commands are run or explicitly acknowledged / CI/校验已运行或明确说明
64+
65+
## PR Review Instructions / PR 审查指令
66+
67+
**When reviewing a PR, you MUST systematically check the following items and provide feedback for any violations.**
68+
69+
**审查 PR 时,必须系统性检查以下项目,对违规项提供反馈。**
70+
71+
### Step 1: PR Title Check / 步骤 1:PR 标题检查
72+
73+
- Title should be specific and include package scope / 标题应具体并包含包范围
74+
- Acceptable formats: / 可接受格式:
75+
- `update(<package>): bump to vX.Y.Z`
76+
- `add(<package>): initial import`
77+
- `[category/package] ...`
78+
- Title scope must match modified files / 标题范围需匹配修改文件
79+
- Avoid vague titles like "update package" / 避免“update package”等模糊标题
80+
81+
**Feedback template / 反馈模板**:
82+
```
83+
🟡 [PR Title/PR 标题]: Missing or unclear scope / 缺少或不清晰的范围
84+
85+
English: PR title should include package scope and describe the change.
86+
Current title: `{current_title}`.
87+
Suggested: `{suggested_title}`.
88+
89+
中文:PR 标题应包含包范围并描述变更。
90+
当前标题:`{current_title}`。
91+
建议:`{suggested_title}`。
92+
```
93+
94+
### Step 2: PR Description Check / 步骤 2:PR 描述检查
95+
96+
- Must include What/Why/How and ideally modified files / 必须包含 What/Why/How,最好包含修改文件列表
97+
- Should reference upstream release/tag/commit when updating / 更新时应引用上游 release/tag/commit
98+
99+
**Feedback template / 反馈模板**:
100+
```
101+
🟢 [PR Description/PR 描述]: Missing or insufficient description / 缺少或不充分的描述
102+
103+
English: Please add What/Why/How and list modified files; include upstream release/tag when applicable.
104+
105+
中文:请补充 What/Why/How,并列出修改文件;更新时请注明上游 release/tag。
106+
```
107+
108+
### Step 3: PR File Modification Check / 步骤 3:PR 修改文件检查
109+
110+
- Ensure all changes are for one package or a tight set / 确保变更集中于单一包或紧密相关的集合
111+
- If multiple unrelated packages are modified, request split / 若涉及多个无关包,建议拆分 PR
112+
113+
**Feedback template / 反馈模板**:
114+
```
115+
🟡 [PR Structure/PR 结构]: Multiple unrelated packages in one PR / 一个 PR 中包含多个无关包
116+
117+
English: Please split into separate PRs, one per package or tightly related group.
118+
中文:请拆分为多个 PR,每个 PR 聚焦一个包或相关集合。
119+
```
120+
121+
### Step 4: package.json Validation / 步骤 4:package.json 校验
122+
123+
- Verify required fields and formatting / 检查必需字段与格式
124+
- Confirm `name` matches folder / 确认 `name` 与目录名一致
125+
- Verify all `URL` entries are GitHub HTTPS / 确认 `URL` 为 GitHub HTTPS
126+
- Check `VER_SHA` points to existing tag/commit / 检查 `VER_SHA` 指向有效 tag/commit
127+
- Ensure fixed version(s) plus `latest` where supported / 确保包含固定版本与 `latest`
128+
129+
**Feedback template / 反馈模板**:
130+
```
131+
🟡 [package.json/包信息]: Invalid field or policy violation / 字段无效或违反规范
132+
133+
English: `{field}` is missing/invalid or violates policy. Please update the package metadata accordingly.
134+
中文:`{field}` 缺失/无效或违反规范,请修正包元数据。
135+
```
136+
137+
### Step 5: Kconfig Consistency / 步骤 5:Kconfig 一致性检查
138+
139+
- `PKG_USING_<PACKAGE>` and option prefixes / `PKG_USING_<PACKAGE>` 与选项前缀
140+
- Package is sourced in category `Kconfig` / 分类 `Kconfig` 已引用该包
141+
142+
**Feedback template / 反馈模板**:
143+
```
144+
🟡 [Kconfig/Kconfig]: Inconsistent option or missing source / 选项不一致或缺少引用
145+
146+
English: Please align Kconfig symbols and ensure the package is sourced in the category Kconfig.
147+
中文:请对齐 Kconfig 符号并确保分类 Kconfig 引用该包。
148+
```
149+
150+
### Step 6: Policy & Hygiene / 步骤 6:规范与整洁性检查
151+
152+
- No binary blobs / 无二进制文件
153+
- No gitee URLs / 无 gitee 链接
154+
- No submodules / 无子模块
155+
156+
**Feedback template / 反馈模板**:
157+
```
158+
🟡 [Policy/规范]: Repository policy violation / 违反仓库规范
159+
160+
English: This PR violates repository policy: {policy}. Please adjust accordingly.
161+
中文:此 PR 违反仓库规范:{policy}。请按要求修改。
162+
```
163+
164+
## Review Comment Format / 审查评论格式
165+
166+
Use the following format for review comments:
167+
168+
审查评论使用以下格式:
169+
170+
```
171+
[Category/类别]: Brief description / 简要描述
172+
173+
English: Detailed explanation of the issue and suggested improvement.
174+
中文:问题的详细说明和改进建议。
175+
176+
Example/示例:
177+
```json
178+
{
179+
"name": "pahomqtt"
180+
}
181+
```
182+
```
183+
184+
**For PR-related issues, use severity level 🟡 Minor or 🟢 Suggestion.**
185+
186+
**PR 相关问题使用严重程度 🟡 Minor 或 🟢 Suggestion。**
187+
188+
## Severity Levels / 严重程度级别
189+
190+
- **🔴 Critical/严重**: Breaks tooling or makes packages unusable / 破坏工具链或导致包不可用
191+
- **🟠 Major/主要**: Likely to cause download/build failures / 可能导致下载或构建失败
192+
- **🟡 Minor/次要**: Style or minor metadata issues / 风格或次要元数据问题
193+
- **🟢 Suggestion/建议**: Best practices or optional improvements / 最佳实践或可选改进

0 commit comments

Comments
 (0)