@routerhub/agent-rules 1.0.8 → 1.0.10

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 CHANGED
@@ -49,6 +49,7 @@
49
49
  ## 自动化测试规则
50
50
 
51
51
  - 自动化测试默认必须使用真实接口数据,禁止使用 mock/route.fulfill/本地伪造返回;仅在明确同意的情况下才允许使用模拟数据。
52
+ - UI 自动化测试必须请求真实的后端接口,不允许使用本地 mock 数据或截断真实请求。
52
53
  - 编写自动化测试时,关键步骤之间需间隔 2 秒后再执行下一步,以保证操作过程可观察。
53
54
  - 自动化测试执行完毕后,自动打开 UI 界面,允许开发者进行手动验证。
54
55
 
package/README.md CHANGED
@@ -5,6 +5,8 @@
5
5
  1. 生成项目可用的 `AGENTS.md`
6
6
  2. 自动监听 `AGENTS.private.md` 并同步
7
7
 
8
+ 完整中文说明见 `README.zh-CN.md`。
9
+
8
10
  ## 安装
9
11
 
10
12
  在你的项目里安装:
@@ -0,0 +1,79 @@
1
+ # @routerhub/agent-rules 中文说明
2
+
3
+ `@routerhub/agent-rules` 用来把通用规则和项目私有规则合并成项目根目录下可直接使用的 `AGENTS.md`。
4
+
5
+ 它主要提供两类能力:
6
+
7
+ 1. 生成项目可用的 `AGENTS.md`
8
+ 2. 监听 `AGENTS.private.md` 变更并自动同步
9
+
10
+ ## 安装
11
+
12
+ 在目标项目中安装:
13
+
14
+ ```bash
15
+ pnpm add -D concurrently @routerhub/agent-rules
16
+ ```
17
+
18
+ ## 初始化
19
+
20
+ 如果项目里还没有 `AGENTS.private.md`,可以执行:
21
+
22
+ ```bash
23
+ pnpm exec agent-rules init
24
+ ```
25
+
26
+ 执行后会在项目根目录生成一份可编辑的私有规则模板。
27
+
28
+ ## 同步规则
29
+
30
+ 将基础规则与项目私有规则合并为 `AGENTS.md`:
31
+
32
+ ```bash
33
+ pnpm exec agent-rules sync
34
+ ```
35
+
36
+ 适合以下场景:
37
+
38
+ - 首次接入后生成规则文件
39
+ - 修改了 `AGENTS.private.md` 后手动重建
40
+ - CI 或脚本中显式同步规则
41
+
42
+ ## 监听模式
43
+
44
+ 开发时建议通过监听模式自动保持 `AGENTS.md` 最新:
45
+
46
+ ```json
47
+ {
48
+ "scripts": {
49
+ "dev": "concurrently \"next dev\" \"agent-rules watch\""
50
+ }
51
+ }
52
+ ```
53
+
54
+ 监听模式会:
55
+
56
+ - 先执行一次同步,生成最新的 `AGENTS.md`
57
+ - 持续监听项目根目录下的 `AGENTS.private.md`
58
+ - 在文件变更后自动重新同步
59
+
60
+ ## 规则来源
61
+
62
+ - `AGENTS.base.md`:规则包内置的通用基础规则
63
+ - `AGENTS.private.md`:项目自己的私有规则
64
+ - `AGENTS.md`:最终合并结果,供项目中的 Copilot 或 Agent 使用
65
+
66
+ ## 推荐用法
67
+
68
+ 项目接入时推荐保持以下流程:
69
+
70
+ 1. 安装 `@routerhub/agent-rules`
71
+ 2. 执行 `pnpm exec agent-rules init`
72
+ 3. 根据项目情况编辑 `AGENTS.private.md`
73
+ 4. 使用 `pnpm exec agent-rules sync` 或 `agent-rules watch` 生成最终的 `AGENTS.md`
74
+
75
+ ## 注意事项
76
+
77
+ - 私有规则应只写项目特有的限制、接口地址、组件路径和业务规范
78
+ - 通用规范应维护在规则包的 `AGENTS.base.md` 中
79
+ - 若私有规则与基础规则冲突,以项目私有规则为准
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routerhub/agent-rules",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Shared Copilot agent rules and guidelines for RouterHub projects",
5
5
  "main": "AGENTS.base.md",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "AGENTS.base.md",
11
11
  "merge.js",
12
12
  "AGENTS.private.example.md",
13
+ "README.zh-CN.md",
13
14
  "postinstall.js",
14
15
  "package.json"
15
16
  ],