@routerhub/agent-rules 1.5.98 → 1.5.100

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
@@ -47,6 +47,7 @@
47
47
  - ⚠️ PR Title / Description / Test Plan 全部中文。一个 PR 只做一件事。
48
48
  - ⚠️ 必须附截图作为可视化证据(前后对比、标注改动区域)。
49
49
  - ⚠️ 创建 PR 使用 `/create-pr` skill(自动生成中文内容 + 效果截图 + CDN 上传)。
50
+ - ⚠️ **私有仓库的 PR/Issue 正文中插入截图,禁止使用 `raw.githubusercontent.com` 链接,必须使用 `github.com/OWNER/REPO/blob/BRANCH/path?raw=true` 格式。** 原因:`raw.githubusercontent.com` 不识别 GitHub 网页端的登录态(session cookie),GitHub 渲染 PR/Issue 正文图片时走的是 camo 图片代理服务器端匿名拉取——对私有仓库该链接返回 404,导致图片框显示为普通文字链接而非图片;`github.com/.../blob/...?raw=true` 走的是 github.com 主域名,能通过登录态正确鉴权,图片才能正常渲染。凡是「先 `git add -f` 把截图提交进 `screenshots/` 目录、再在 PR 描述里用 Markdown 引用」的流程,图片链接一律拼接为后一种格式。
50
51
 
51
52
  ## 安全
52
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routerhub/agent-rules",
3
- "version": "1.5.98",
3
+ "version": "1.5.100",
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
@@ -59,10 +59,14 @@ if (projectRoot.includes("node_modules")) {
59
59
  process.exit(0);
60
60
  }
61
61
 
62
- // 确保下游项目 .npmrc 中关闭 frozen-lockfile + 启用依赖 pre/post 脚本
62
+ // 确保下游项目 .npmrc 中关闭 frozen-lockfile + 启用依赖 pre/post 脚本 + 关闭副作用缓存
63
63
  // frozen-lockfile=false:让 pnpm install 能在版本更新后直接执行
64
64
  // enable-pre-post-scripts=true:让 pnpm 始终执行依赖包的 postinstall 生命周期脚本,
65
65
  // 否则 pnpm 默认不会运行依赖的 postinstall,导致 agent-rules 更新后规则文件不刷新
66
+ // side-effects-cache=false:pnpm 会按包内容哈希跨项目缓存"是否已执行过构建脚本",
67
+ // 一旦同一版本在本机任意项目装过一次,其他新项目直接装/更新该版本会被静默跳过 postinstall,
68
+ // 而 agent-rules 的 postinstall 恰恰是往下游项目根目录写文件(不是往自身 node_modules 写副作用),
69
+ // 关闭该缓存让 pnpm 每次都真正重新执行脚本
66
70
  const npmrcPath = path.join(projectRoot, ".npmrc");
67
71
  let npmrcContent = "";
68
72
  if (fs.existsSync(npmrcPath)) {
@@ -77,6 +81,10 @@ if (!npmrcContent.includes("enable-pre-post-scripts")) {
77
81
  npmrcEntries.push("# 确保依赖包的 postinstall 生命周期脚本始终执行(由 agent-rules 自动添加)");
78
82
  npmrcEntries.push("enable-pre-post-scripts=true");
79
83
  }
84
+ if (!npmrcContent.includes("side-effects-cache")) {
85
+ npmrcEntries.push("# 关闭 pnpm 跨项目构建缓存,确保 agent-rules 每次 install/update 都重新生成规则文件(由 agent-rules 自动添加)");
86
+ npmrcEntries.push("side-effects-cache=false");
87
+ }
80
88
  if (npmrcEntries.length > 0) {
81
89
  const newEntry = "\n" + npmrcEntries.join("\n") + "\n";
82
90
  fs.appendFileSync(npmrcPath, newEntry);
package/rules/global.md CHANGED
@@ -47,6 +47,7 @@ name: "通用规则"
47
47
  - ⚠️ PR Title / Description / Test Plan 全部中文。一个 PR 只做一件事。
48
48
  - ⚠️ 必须附截图作为可视化证据(前后对比、标注改动区域)。
49
49
  - ⚠️ 创建 PR 使用 `/create-pr` skill(自动生成中文内容 + 效果截图 + CDN 上传)。
50
+ - ⚠️ **私有仓库的 PR/Issue 正文中插入截图,禁止使用 `raw.githubusercontent.com` 链接,必须使用 `github.com/OWNER/REPO/blob/BRANCH/path?raw=true` 格式。** 原因:`raw.githubusercontent.com` 不识别 GitHub 网页端的登录态(session cookie),GitHub 渲染 PR/Issue 正文图片时走的是 camo 图片代理服务器端匿名拉取——对私有仓库该链接返回 404,导致图片框显示为普通文字链接而非图片;`github.com/.../blob/...?raw=true` 走的是 github.com 主域名,能通过登录态正确鉴权,图片才能正常渲染。凡是「先 `git add -f` 把截图提交进 `screenshots/` 目录、再在 PR 描述里用 Markdown 引用」的流程,图片链接一律拼接为后一种格式。
50
51
 
51
52
  ## 安全
52
53