@routerhub/agent-rules 1.5.27 → 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/merge.js +14 -2
- package/package.json +1 -1
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
|
);
|