@routerhub/agent-rules 1.5.24 → 1.5.25
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/AGENTS.base.md +2 -1
- package/CHANGELOG.md +7 -0
- package/PULL_REQUEST_TEMPLATE.md +27 -0
- package/merge.js +17 -0
- package/package.json +2 -1
- package/rules/devops.md +1 -1
package/AGENTS.base.md
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
- PR Title 示例:`[auth] Fix token refresh race condition on concurrent requests`、`[payments] Add idempotency key to charge API`、`[infra] Migrate cache layer from Redis 6 to Redis 7`。
|
|
26
26
|
- PR Title 禁止使用 `fix bug`、`update code`、`改了一下` 等无法表达实际改动的标题。
|
|
27
27
|
- PR Description 必须足够充分,至少回答 What(改了什么)、Why(为什么改,解决什么问题或满足什么需求)、How(采用什么方案,为什么选该方案)。
|
|
28
|
+
- PR Description 必须使用中文编写,方便团队成员阅读理解;涉及 UI 改动、交互流程、页面效果等可视化变更时,必须附上截图或录屏作为证据。
|
|
28
29
|
- PR Description 和 Test Plan 的文字应尽可能简洁明了,优先用页面操作路径、按钮点击、表单输入、可见结果描述验证过程;尽量少用代码片段解释,除非代码是理解变更或复现问题的必要证据。
|
|
29
30
|
- 涉及行为变更、接口变更、数据迁移、性能影响时,必须在 Description 中显式写出。
|
|
30
31
|
- 有意不做的事、已知局限、后续 follow-up 必须写清楚,避免 reviewer 重复追问。
|
|
@@ -228,7 +229,7 @@ Closes #456
|
|
|
228
229
|
## Docker 与部署
|
|
229
230
|
|
|
230
231
|
- 默认本地 `docker build`,构建后 `docker push` 到 `ghcr.io`,推送前确保正确 tag。
|
|
231
|
-
- 部署时打包镜像必须统一使用当前 git 提交的
|
|
232
|
+
- 部署时打包镜像必须统一使用当前 git 提交的 hash 作为镜像 tag 和版本号;项目内所有服务/镜像都必须使用同一个值,无论该镜像是否有代码改动,确保所有镜像版本号一致后再发版。
|
|
232
233
|
- 部署通过 Portainer 管理界面操作,禁止 SSH 手动执行 docker 命令;地址和账号配置在 `AGENTS.private.md` 或环境变量中,禁止硬编码。
|
|
233
234
|
- 始终通过 Portainer API 更新 Stack 环境变量触发重新部署,不要 SSH 手动操作 Portainer 管理的容器。
|
|
234
235
|
- 测试环境和生产环境都通过 Portainer 部署,严禁 SSH 手动操作。测试环境是 Edge Agent(endpoint 7, stack 31),tunnel 按需建立、空闲自动断开,调 API 前必须先请求 `/endpoints/7/docker/info` 预热 tunnel;推荐直接用 `python3 portainer-update-stack.py <VERSION>` 部署(内置 tunnel 预热 + 重试)。生产环境是 Docker API(endpoint 8, stack 26),`APP_VERSION` 三服务共用。
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
所有对 @routerhub/agent-rules 的重大更改都会记录在这个文件中。
|
|
4
4
|
|
|
5
|
+
## [1.5.25] - 2026-06-26
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- 新增分发式 PR 模板:`agent-rules` 在 init/sync/watch 时会把统一的 `.github/PULL_REQUEST_TEMPLATE.md` 同步到各项目,强制 PR 描述包含 Description / Test Plan / Screenshots(UI 改动必须贴前后对比截图)和自查清单;对人(GitHub 网页新建 PR 自动预填)和 AI agent 都生效。
|
|
10
|
+
- 新增 PR 描述语言与截图规则:PR Description 必须使用中文编写,方便团队成员阅读理解;涉及 UI 改动、交互流程、页面效果等可视化变更时,必须附上截图或录屏作为证据。
|
|
11
|
+
|
|
5
12
|
## [1.5.24] - 2026-06-17
|
|
6
13
|
|
|
7
14
|
### Added
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<!-- 本文件由 @routerhub/agent-rules 统一管理,请勿手动编辑;改动请提到 agent-rules 包。 -->
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
<!-- What / Why / How:改了什么、为什么改(解决什么问题或满足什么需求)、采用什么方案及取舍。 -->
|
|
6
|
+
<!-- 涉及行为变更 / 接口变更 / 数据迁移 / 性能影响时必须显式写出;有意不做的事、已知局限、后续 follow-up 也要写清。 -->
|
|
7
|
+
|
|
8
|
+
Closes #
|
|
9
|
+
|
|
10
|
+
## Test Plan
|
|
11
|
+
|
|
12
|
+
<!-- 硬性必填:如何验证改动正确,附可复现步骤或证据(命令 + 结果、手动操作步骤、日志、请求响应、修复前后对比)。 -->
|
|
13
|
+
<!-- 禁止只写「tested locally / 测了没问题」。 -->
|
|
14
|
+
|
|
15
|
+
## Screenshots
|
|
16
|
+
|
|
17
|
+
<!-- UI / 前端改动必须贴截图(整页、含 URL);行为有变化时贴「改动前 / 改动后」对比。把图片直接拖拽到此处。 -->
|
|
18
|
+
<!-- 纯后端 / 无界面改动写「N/A(无界面变化)」。 -->
|
|
19
|
+
|
|
20
|
+
## Checklist
|
|
21
|
+
|
|
22
|
+
- [ ] 一个 PR 只做一件事,无夹带无关改动
|
|
23
|
+
- [ ] Description 已说明 What / Why / How
|
|
24
|
+
- [ ] Test Plan 完整且带证据
|
|
25
|
+
- [ ] UI 改动已贴截图(或注明无界面变化)
|
|
26
|
+
- [ ] 本地编译 / lint / 测试通过,CI 全绿
|
|
27
|
+
- [ ] 已关联 issue、指定 reviewer
|
package/merge.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* AGENTS.md 全量合并(兼容 Cursor/Claude Code)
|
|
16
16
|
* .github/copilot-instructions.md 全局规则(VS Code Copilot)
|
|
17
17
|
* .github/instructions/*.instructions.md 按域条件加载(VS Code Copilot applyTo)
|
|
18
|
+
* .github/PULL_REQUEST_TEMPLATE.md 统一 PR 模板(GitHub 新建 PR 时预填)
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
const fs = require("fs");
|
|
@@ -35,6 +36,8 @@ function getDefaultConfig() {
|
|
|
35
36
|
rulesDir: path.join(packageRoot, "rules"),
|
|
36
37
|
baseRulesPath: path.join(packageRoot, "AGENTS.base.md"),
|
|
37
38
|
privateRulesPath: path.join(currentRoot, "AGENTS.private.md"),
|
|
39
|
+
prTemplateSrc: path.join(packageRoot, "PULL_REQUEST_TEMPLATE.md"),
|
|
40
|
+
prTemplateOutput: path.join(currentRoot, ".github", "PULL_REQUEST_TEMPLATE.md"),
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
|
|
@@ -329,6 +332,17 @@ function generateInstructionFile(
|
|
|
329
332
|
console.log(`✅ 条件规则已生成: ${outputPath}`);
|
|
330
333
|
}
|
|
331
334
|
|
|
335
|
+
function syncPrTemplate(config) {
|
|
336
|
+
const defaultConfig = getDefaultConfig();
|
|
337
|
+
const src = config.prTemplateSrc || defaultConfig.prTemplateSrc;
|
|
338
|
+
const output = config.prTemplateOutput || defaultConfig.prTemplateOutput;
|
|
339
|
+
const content = readFileIfExists(src);
|
|
340
|
+
if (!content) return;
|
|
341
|
+
ensureParentDir(output);
|
|
342
|
+
fs.writeFileSync(output, content, "utf-8");
|
|
343
|
+
console.log(`✅ PR 模板已同步到 ${output}`);
|
|
344
|
+
}
|
|
345
|
+
|
|
332
346
|
function mergeAgents(config) {
|
|
333
347
|
const defaultConfig = getDefaultConfig();
|
|
334
348
|
const {
|
|
@@ -346,6 +360,9 @@ function mergeAgents(config) {
|
|
|
346
360
|
console.log(` 规则目录: ${rulesDir}`);
|
|
347
361
|
console.log(` 私有规则: ${privateRulesPath}`);
|
|
348
362
|
|
|
363
|
+
// 同步统一 PR 模板到 .github/PULL_REQUEST_TEMPLATE.md(独立于 rules/ 是否为空)
|
|
364
|
+
syncPrTemplate(config);
|
|
365
|
+
|
|
349
366
|
// 0. 从 AGENTS.base.md 自动拆分生成 rules/*.md
|
|
350
367
|
generateRulesFromBase(baseRulesPath, rulesDir);
|
|
351
368
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routerhub/agent-rules",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.25",
|
|
4
4
|
"description": "Shared Copilot agent rules and guidelines for RouterHub projects",
|
|
5
5
|
"main": "AGENTS.base.md",
|
|
6
6
|
"bin": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"rules/",
|
|
12
12
|
"merge.js",
|
|
13
13
|
"AGENTS.private.example.md",
|
|
14
|
+
"PULL_REQUEST_TEMPLATE.md",
|
|
14
15
|
"README.zh-CN.md",
|
|
15
16
|
"postinstall.js",
|
|
16
17
|
"package.json",
|
package/rules/devops.md
CHANGED
|
@@ -7,7 +7,7 @@ outputName: "devops"
|
|
|
7
7
|
## Docker 与部署
|
|
8
8
|
|
|
9
9
|
- 默认本地 `docker build`,构建后 `docker push` 到 `ghcr.io`,推送前确保正确 tag。
|
|
10
|
-
- 部署时打包镜像必须统一使用当前 git 提交的
|
|
10
|
+
- 部署时打包镜像必须统一使用当前 git 提交的 hash 作为镜像 tag 和版本号;项目内所有服务/镜像都必须使用同一个值,无论该镜像是否有代码改动,确保所有镜像版本号一致后再发版。
|
|
11
11
|
- 部署通过 Portainer 管理界面操作,禁止 SSH 手动执行 docker 命令;地址和账号配置在 `AGENTS.private.md` 或环境变量中,禁止硬编码。
|
|
12
12
|
- 始终通过 Portainer API 更新 Stack 环境变量触发重新部署,不要 SSH 手动操作 Portainer 管理的容器。
|
|
13
13
|
- 测试环境和生产环境都通过 Portainer 部署,严禁 SSH 手动操作。测试环境是 Edge Agent(endpoint 7, stack 31),tunnel 按需建立、空闲自动断开,调 API 前必须先请求 `/endpoints/7/docker/info` 预热 tunnel;推荐直接用 `python3 portainer-update-stack.py <VERSION>` 部署(内置 tunnel 预热 + 重试)。生产环境是 Docker API(endpoint 8, stack 26),`APP_VERSION` 三服务共用。
|