@routerhub/agent-rules 1.5.28 → 1.5.30
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/package.json +1 -1
- package/postinstall.js +8 -32
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -17,47 +17,23 @@ if (projectRoot.includes("node_modules")) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
console.log("");
|
|
20
|
-
console.log("[agent-rules]
|
|
21
|
-
console.log(`[agent-rules] 项目根目录: ${projectRoot}`);
|
|
22
|
-
console.log("[agent-rules] 正在初始化规则文件...");
|
|
20
|
+
console.log("[agent-rules] 安装完成,正在同步规则文件...");
|
|
23
21
|
|
|
24
|
-
//
|
|
25
|
-
const
|
|
22
|
+
// 执行 sync 生成所有规则输出文件
|
|
23
|
+
const syncProcess = spawn("node", [mergeScriptPath, "sync"], {
|
|
26
24
|
cwd: projectRoot,
|
|
27
25
|
stdio: "inherit",
|
|
28
26
|
});
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
syncProcess.on("close", (code) => {
|
|
31
29
|
if (code === 0) {
|
|
32
|
-
console.log("[agent-rules]
|
|
33
|
-
console.log("[agent-rules] 正在启动后台监听进程...");
|
|
34
|
-
|
|
35
|
-
// 第二步:在后台启动 watch 模式
|
|
36
|
-
const watchProcess = spawn("node", [mergeScriptPath, "watch"], {
|
|
37
|
-
cwd: projectRoot,
|
|
38
|
-
detached: true,
|
|
39
|
-
stdio: "ignore",
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// 将 watch 进程从父进程分离,允许其独立运行
|
|
43
|
-
watchProcess.unref();
|
|
44
|
-
|
|
45
|
-
console.log("[agent-rules] 后台监听进程已启动");
|
|
46
|
-
console.log(
|
|
47
|
-
"[agent-rules] AGENTS.private.md 的变更将自动同步到 AGENTS.md、.github/copilot-instructions.md 和 .github/instructions/*.instructions.md",
|
|
48
|
-
);
|
|
49
|
-
console.log("");
|
|
50
|
-
console.log("[agent-rules] 手动命令:");
|
|
51
|
-
console.log(" - 初始化: npx agent-rules init");
|
|
52
|
-
console.log(" - 同步规则: npx agent-rules sync");
|
|
53
|
-
console.log(" - 启动监听: npx agent-rules watch");
|
|
54
|
-
console.log(" - 查看帮助: npx agent-rules help");
|
|
30
|
+
console.log("[agent-rules] 规则文件同步完成");
|
|
55
31
|
console.log("");
|
|
56
32
|
} else {
|
|
57
|
-
console.error("[agent-rules]
|
|
33
|
+
console.error("[agent-rules] 同步失败,退出码:", code);
|
|
58
34
|
}
|
|
59
35
|
});
|
|
60
36
|
|
|
61
|
-
|
|
62
|
-
console.error("[agent-rules]
|
|
37
|
+
syncProcess.on("error", (err) => {
|
|
38
|
+
console.error("[agent-rules] 同步过程出错:", err.message);
|
|
63
39
|
});
|