@routerhub/agent-rules 1.5.1 → 1.5.3
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 +1 -0
- package/package.json +1 -1
- package/postinstall.js +10 -2
- package/rules/devops.md +1 -0
package/AGENTS.base.md
CHANGED
|
@@ -97,5 +97,6 @@
|
|
|
97
97
|
## Docker 与部署
|
|
98
98
|
|
|
99
99
|
- 默认本地 `docker build`,构建后 `docker push` 到 `ghcr.io`,推送前确保正确 tag。
|
|
100
|
+
- 部署时打镜像 tag 必须对项目内所有服务/镜像统一打 tag,无论该镜像是否有代码改动;确保所有镜像版本号一致后再发版。
|
|
100
101
|
- 部署通过 Portainer 管理界面操作,禁止 SSH 手动执行 docker 命令;地址和账号配置在 `AGENTS.private.md` 或环境变量中,禁止硬编码。
|
|
101
102
|
- 始终通过 Portainer API 更新 Stack 环境变量触发重新部署,不要 SSH 手动操作 Portainer 管理的容器。
|
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -4,13 +4,21 @@ const { spawn } = require("child_process");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
const projectRoot = process.cwd();
|
|
7
|
+
// 获取下游项目根目录(INIT_CWD 是 npm/pnpm 执行 install 时的原始目录)
|
|
8
|
+
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
9
9
|
const packageRoot = __dirname;
|
|
10
10
|
const mergeScriptPath = path.join(packageRoot, "merge.js");
|
|
11
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
|
+
|
|
12
19
|
console.log("");
|
|
13
20
|
console.log("[agent-rules] 安装完成");
|
|
21
|
+
console.log(`[agent-rules] 项目根目录: ${projectRoot}`);
|
|
14
22
|
console.log("[agent-rules] 正在初始化规则文件...");
|
|
15
23
|
|
|
16
24
|
// 第一步:执行初始化,生成 AGENTS.md 和 .github/copilot-instructions.md
|
package/rules/devops.md
CHANGED
|
@@ -7,5 +7,6 @@ outputName: "devops"
|
|
|
7
7
|
## Docker 与部署
|
|
8
8
|
|
|
9
9
|
- 默认本地 `docker build`,构建后 `docker push` 到 `ghcr.io`,推送前确保正确 tag。
|
|
10
|
+
- 部署时打镜像 tag 必须对项目内所有服务/镜像统一打 tag,无论该镜像是否有代码改动;确保所有镜像版本号一致后再发版。
|
|
10
11
|
- 部署通过 Portainer 管理界面操作,禁止 SSH 手动执行 docker 命令;地址和账号配置在 `AGENTS.private.md` 或环境变量中,禁止硬编码。
|
|
11
12
|
- 始终通过 Portainer API 更新 Stack 环境变量触发重新部署,不要 SSH 手动操作 Portainer 管理的容器。
|