@routerhub/agent-rules 1.5.29 → 1.5.31

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
@@ -144,6 +144,7 @@ Closes #456
144
144
  - 截图结果必须包含当前页面 URL(地址栏可见或在截图说明中明确写出完整 URL)。
145
145
  - 在截图上添加箭头、标注、提示文字等注释时,必须放在页面空白区域,不得覆盖页面原有内容(文字、按钮、表格数据等)。
146
146
  - 当用户要求生成 HTML 页面并同时要求截图时,所有截图必须以 base64 data URI 形式内嵌到 HTML 文件中,禁止将截图单独输出为独立的 PNG、JPG、JPEG、SVG、WebP 等图片文件。他人只需打开单个 HTML 文件即可看到完整页面内容和截图,无需额外图片文件。
147
+ - 制作 HTML 报告过程中产生的所有截图、图表、插图等图片文件,必须统一存放到项目根目录的 `screenshots/` 文件夹下,禁止散落在桌面、下载目录、临时目录或其他任意位置。如该文件夹不存在则先创建。
147
148
 
148
149
  ## 可视化汇报
149
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routerhub/agent-rules",
3
- "version": "1.5.29",
3
+ "version": "1.5.31",
4
4
  "description": "Shared Copilot agent rules and guidelines for RouterHub projects",
5
5
  "main": "AGENTS.base.md",
6
6
  "bin": {
package/postinstall.js CHANGED
@@ -1,11 +1,39 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // 安装完成后仅打印提示,不再自动初始化规则文件
4
- // 如需生成规则文件,请手动执行对应命令
5
- console.log("");
6
- console.log("[agent-rules] 安装完成,如需手动操作:");
7
- console.log(" - 初始化规则: npx agent-rules init");
8
- console.log(" - 同步规则: npx agent-rules sync");
9
- console.log(" - 启动监听: npx agent-rules watch");
10
- console.log(" - 查看帮助: npx agent-rules help");
3
+ const { spawn } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ // 获取下游项目根目录(INIT_CWD npm/pnpm 执行 install 时的原始目录)
8
+ const projectRoot = process.env.INIT_CWD || process.cwd();
9
+ const packageRoot = __dirname;
10
+ const mergeScriptPath = path.join(packageRoot, "merge.js");
11
+
12
+ // 安全检查:如果项目根目录在 node_modules 内,说明 INIT_CWD 未正确设置,跳过初始化
13
+ if (projectRoot.includes("node_modules")) {
14
+ console.log("[agent-rules] 检测到在 node_modules 内运行,跳过自动初始化");
15
+ console.log("[agent-rules] 请手动执行: npx agent-rules init");
16
+ process.exit(0);
17
+ }
18
+
11
19
  console.log("");
20
+ console.log("[agent-rules] 安装完成,正在同步规则文件...");
21
+
22
+ // 执行 sync 生成所有规则输出文件
23
+ const syncProcess = spawn("node", [mergeScriptPath, "sync"], {
24
+ cwd: projectRoot,
25
+ stdio: "inherit",
26
+ });
27
+
28
+ syncProcess.on("close", (code) => {
29
+ if (code === 0) {
30
+ console.log("[agent-rules] 规则文件同步完成");
31
+ console.log("");
32
+ } else {
33
+ console.error("[agent-rules] 同步失败,退出码:", code);
34
+ }
35
+ });
36
+
37
+ syncProcess.on("error", (err) => {
38
+ console.error("[agent-rules] 同步过程出错:", err.message);
39
+ });
package/rules/global.md CHANGED
@@ -144,6 +144,7 @@ Closes #456
144
144
  - 截图结果必须包含当前页面 URL(地址栏可见或在截图说明中明确写出完整 URL)。
145
145
  - 在截图上添加箭头、标注、提示文字等注释时,必须放在页面空白区域,不得覆盖页面原有内容(文字、按钮、表格数据等)。
146
146
  - 当用户要求生成 HTML 页面并同时要求截图时,所有截图必须以 base64 data URI 形式内嵌到 HTML 文件中,禁止将截图单独输出为独立的 PNG、JPG、JPEG、SVG、WebP 等图片文件。他人只需打开单个 HTML 文件即可看到完整页面内容和截图,无需额外图片文件。
147
+ - 制作 HTML 报告过程中产生的所有截图、图表、插图等图片文件,必须统一存放到项目根目录的 `screenshots/` 文件夹下,禁止散落在桌面、下载目录、临时目录或其他任意位置。如该文件夹不存在则先创建。
147
148
 
148
149
  ## 可视化汇报
149
150