@routerhub/agent-rules 1.5.26 → 1.5.28

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
@@ -143,6 +143,7 @@ Closes #456
143
143
  - 当用户要求截图时,必须截取整页(full page),不得只截可视区域。
144
144
  - 截图结果必须包含当前页面 URL(地址栏可见或在截图说明中明确写出完整 URL)。
145
145
  - 在截图上添加箭头、标注、提示文字等注释时,必须放在页面空白区域,不得覆盖页面原有内容(文字、按钮、表格数据等)。
146
+ - 当用户要求生成 HTML 页面并同时要求截图时,所有截图必须以 base64 data URI 形式内嵌到 HTML 文件中,禁止将截图单独输出为独立的 PNG、JPG、JPEG、SVG、WebP 等图片文件。他人只需打开单个 HTML 文件即可看到完整页面内容和截图,无需额外图片文件。
146
147
 
147
148
  ## 可视化汇报
148
149
 
package/merge.js CHANGED
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * 输出文件:
15
15
  * AGENTS.md 全量合并(兼容 Cursor/Claude Code)
16
+ * CLAUDE.md 全量合并(Claude Code 自动加载)
16
17
  * .github/copilot-instructions.md 全局规则(VS Code Copilot)
17
18
  * .github/instructions/*.instructions.md 按域条件加载(VS Code Copilot applyTo)
18
19
  * .github/PULL_REQUEST_TEMPLATE.md 统一 PR 模板(GitHub 新建 PR 时预填)
@@ -31,6 +32,7 @@ let pendingSync = false;
31
32
  function getDefaultConfig() {
32
33
  return {
33
34
  output: path.join(currentRoot, "AGENTS.md"),
35
+ claudeOutput: path.join(currentRoot, "CLAUDE.md"),
34
36
  copilotOutput: path.join(currentRoot, ".github", "copilot-instructions.md"),
35
37
  instructionsDir: path.join(currentRoot, ".github", "instructions"),
36
38
  rulesDir: path.join(packageRoot, "rules"),
@@ -353,6 +355,7 @@ function mergeAgents(config) {
353
355
  } = config;
354
356
 
355
357
  const agentsOutput = config.output || defaultConfig.output;
358
+ const claudeOutput = config.claudeOutput || defaultConfig.claudeOutput;
356
359
  const copilotOutput = config.copilotOutput || defaultConfig.copilotOutput;
357
360
 
358
361
  console.log("📦 开始合并规则文件...");
@@ -386,7 +389,7 @@ function mergeAgents(config) {
386
389
  privateRules;
387
390
  }
388
391
 
389
- for (const outputPath of [agentsOutput, copilotOutput]) {
392
+ for (const outputPath of [agentsOutput, claudeOutput, copilotOutput]) {
390
393
  ensureParentDir(outputPath);
391
394
  fs.writeFileSync(outputPath, merged, "utf-8");
392
395
  console.log(`✅ 规则已合并到 ${outputPath}`);
@@ -449,6 +452,11 @@ function mergeAgents(config) {
449
452
  ensureParentDir(agentsOutput);
450
453
  fs.writeFileSync(agentsOutput, agentsMerged, "utf-8");
451
454
  console.log(`✅ 全量规则已合并到 ${agentsOutput}`);
455
+
456
+ // CLAUDE.md 与 AGENTS.md 内容一致,供 Claude Code 会话自动加载
457
+ ensureParentDir(claudeOutput);
458
+ fs.writeFileSync(claudeOutput, agentsMerged, "utf-8");
459
+ console.log(`✅ 全量规则已合并到 ${claudeOutput}`);
452
460
  }
453
461
 
454
462
  function initAgents() {
@@ -467,6 +475,7 @@ function initAgents() {
467
475
 
468
476
  console.log("✅ 初始化完成,后续执行 agent-rules sync 即可刷新规则文件");
469
477
  console.log(" 输出文件:");
478
+ console.log(" - CLAUDE.md(全量,Claude Code 会话自动加载)");
470
479
  console.log(" - AGENTS.md(全量,兼容 Cursor/Claude Code)");
471
480
  console.log(" - .github/copilot-instructions.md(全局规则)");
472
481
  console.log(" - .github/instructions/*.instructions.md(按域条件加载)");
@@ -567,7 +576,7 @@ function main() {
567
576
  " agent-rules init 初始化规则文件,并在缺失时创建 AGENTS.private.md 模板",
568
577
  );
569
578
  console.log(
570
- " agent-rules sync 重新生成所有规则输出文件(AGENTS.md + copilot-instructions.md + instructions/*.instructions.md)",
579
+ " agent-rules sync 重新生成所有规则输出文件(CLAUDE.md + AGENTS.md + copilot-instructions.md + instructions/*.instructions.md)",
571
580
  );
572
581
  console.log(
573
582
  " agent-rules watch 监听 AGENTS.private.md,变更后自动同步所有规则文件",
@@ -575,6 +584,9 @@ function main() {
575
584
  console.log(" agent-rules help 查看帮助");
576
585
  console.log("");
577
586
  console.log("输出文件:");
587
+ console.log(
588
+ " CLAUDE.md 全量合并(Claude Code 会话自动加载)",
589
+ );
578
590
  console.log(
579
591
  " AGENTS.md 全量合并(兼容 Cursor/Claude Code)",
580
592
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routerhub/agent-rules",
3
- "version": "1.5.26",
3
+ "version": "1.5.28",
4
4
  "description": "Shared Copilot agent rules and guidelines for RouterHub projects",
5
5
  "main": "AGENTS.base.md",
6
6
  "bin": {
package/rules/devops.md CHANGED
@@ -4,10 +4,6 @@ applyTo: ["**/Dockerfile","**/Dockerfile.*","**/docker-compose*.yml","**/docker-
4
4
  outputName: "devops"
5
5
  ---
6
6
 
7
- ## Docker 与部署
7
+ ## 部署规则
8
8
 
9
- - 默认本地 `docker build`,构建后 `docker push` 到 `ghcr.io`,推送前确保正确 tag。
10
- - 部署时打包镜像必须统一使用当前 git 提交的 hash 作为镜像 tag 和版本号;项目内所有服务/镜像都必须使用同一个值,无论该镜像是否有代码改动,确保所有镜像版本号一致后再发版。
11
- - 部署通过 Portainer 管理界面操作,禁止 SSH 手动执行 docker 命令;地址和账号配置在 `AGENTS.private.md` 或环境变量中,禁止硬编码。
12
- - 始终通过 Portainer API 更新 Stack 环境变量触发重新部署,不要 SSH 手动操作 Portainer 管理的容器。
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` 三服务共用。
9
+ - 部署方式因项目而异,具体部署规则请在项目 `AGENTS.private.md` 中按需定义。
package/rules/global.md CHANGED
@@ -25,6 +25,7 @@ name: "通用规则"
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 重复追问。
@@ -142,6 +143,7 @@ Closes #456
142
143
  - 当用户要求截图时,必须截取整页(full page),不得只截可视区域。
143
144
  - 截图结果必须包含当前页面 URL(地址栏可见或在截图说明中明确写出完整 URL)。
144
145
  - 在截图上添加箭头、标注、提示文字等注释时,必须放在页面空白区域,不得覆盖页面原有内容(文字、按钮、表格数据等)。
146
+ - 当用户要求生成 HTML 页面并同时要求截图时,所有截图必须以 base64 data URI 形式内嵌到 HTML 文件中,禁止将截图单独输出为独立的 PNG、JPG、JPEG、SVG、WebP 等图片文件。他人只需打开单个 HTML 文件即可看到完整页面内容和截图,无需额外图片文件。
145
147
 
146
148
  ## 可视化汇报
147
149