@ppdocs/mcp 3.2.29 → 3.2.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/dist/cli.js +50 -28
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -486,37 +486,53 @@ function installClaudeTemplates(cwd) {
|
|
|
486
486
|
fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2));
|
|
487
487
|
console.log(`✅ Configured .claude/settings.json hooks (${process.platform})`);
|
|
488
488
|
console.log(`✅ Added ${mcpPermissions.length} MCP method permissions`);
|
|
489
|
-
// 4.
|
|
489
|
+
// 4. 生成 CLAUDE.md 全局规则 (Claude Code 官方标准)
|
|
490
|
+
installGlobalRules(cwd, 'CLAUDE.md');
|
|
491
|
+
// 5. 安装工作流到 .agents/workflows/ (全平台通用)
|
|
490
492
|
installWorkflows(cwd);
|
|
491
493
|
}
|
|
492
494
|
/** 安装 Codex 模板 (生成 AGENTS.md + 工作流) */
|
|
493
495
|
function installCodexTemplates(cwd) {
|
|
494
|
-
|
|
496
|
+
installGlobalRules(cwd, 'AGENTS.md');
|
|
495
497
|
installWorkflows(cwd);
|
|
496
498
|
}
|
|
497
|
-
/**
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
499
|
+
/**
|
|
500
|
+
* 生成全局规则文件 (各平台统一内容, 不同文件名)
|
|
501
|
+
* Claude Code → CLAUDE.md | Codex → AGENTS.md | Gemini → GEMINI.md
|
|
502
|
+
*/
|
|
503
|
+
function installGlobalRules(cwd, filename) {
|
|
504
|
+
const srcRules = path.join(TEMPLATES_DIR, 'cursorrules.md');
|
|
505
|
+
const destFile = path.join(cwd, filename);
|
|
506
|
+
if (fs.existsSync(srcRules)) {
|
|
507
|
+
// 总是覆盖写入最新版全局规则
|
|
508
|
+
fs.copyFileSync(srcRules, destFile);
|
|
509
|
+
console.log(`✅ Installed ${filename} (global rules)`);
|
|
504
510
|
}
|
|
505
|
-
else
|
|
506
|
-
console.log(`⚠️
|
|
511
|
+
else {
|
|
512
|
+
console.log(`⚠️ Global rules template not found`);
|
|
507
513
|
}
|
|
508
514
|
}
|
|
509
515
|
/** 安装 Cursor 模板 */
|
|
510
516
|
function installCursorTemplates(cwd, apiUrl, user) {
|
|
511
517
|
createMcpConfigAt(path.join(cwd, '.cursor', 'mcp.json'), apiUrl, { user });
|
|
512
|
-
// 2. 生成 .cursorrules
|
|
518
|
+
// 2. 生成 .cursor/rules/ppdocs.md (官方标准, .cursorrules 已废弃)
|
|
519
|
+
const cursorRulesDir = path.join(cwd, '.cursor', 'rules');
|
|
520
|
+
if (!fs.existsSync(cursorRulesDir)) {
|
|
521
|
+
fs.mkdirSync(cursorRulesDir, { recursive: true });
|
|
522
|
+
}
|
|
513
523
|
const srcRules = path.join(TEMPLATES_DIR, 'cursorrules.md');
|
|
514
|
-
const destRules = path.join(
|
|
515
|
-
if (fs.existsSync(srcRules)
|
|
524
|
+
const destRules = path.join(cursorRulesDir, 'ppdocs.md');
|
|
525
|
+
if (fs.existsSync(srcRules)) {
|
|
516
526
|
fs.copyFileSync(srcRules, destRules);
|
|
517
|
-
console.log(`✅
|
|
527
|
+
console.log(`✅ Installed .cursor/rules/ppdocs.md`);
|
|
518
528
|
}
|
|
519
|
-
// 3.
|
|
529
|
+
// 3. 清理废弃的 .cursorrules 文件
|
|
530
|
+
const legacyCursorrules = path.join(cwd, '.cursorrules');
|
|
531
|
+
if (fs.existsSync(legacyCursorrules)) {
|
|
532
|
+
fs.unlinkSync(legacyCursorrules);
|
|
533
|
+
console.log(`🗑️ Removed deprecated .cursorrules`);
|
|
534
|
+
}
|
|
535
|
+
// 4. 安装工作流到 .agents/workflows/
|
|
520
536
|
installWorkflows(cwd);
|
|
521
537
|
}
|
|
522
538
|
// ========================================================================
|
|
@@ -590,8 +606,8 @@ function installWorkflows(cwd, extraDirs = []) {
|
|
|
590
606
|
function installAntigravityTemplates(cwd, apiUrl, user) {
|
|
591
607
|
// Antigravity 由 gemini CLI 注册 env,文件配置不注入避免冲突
|
|
592
608
|
createMcpConfigAt(path.join(cwd, '.gemini', 'settings.json'), apiUrl, { noEnv: true, user });
|
|
593
|
-
// 2. 生成
|
|
594
|
-
|
|
609
|
+
// 2. 生成 GEMINI.md 全局规则 (Gemini CLI 官方标准)
|
|
610
|
+
installGlobalRules(cwd, 'GEMINI.md');
|
|
595
611
|
// 3. Antigravity 全局 workflows 目录 (额外安装目标)
|
|
596
612
|
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
597
613
|
const globalWorkflowDir = path.join(homeDir, '.gemini', 'antigravity', 'global_workflows');
|
|
@@ -604,18 +620,24 @@ function installAntigravityTemplates(cwd, apiUrl, user) {
|
|
|
604
620
|
/** 安装 Kiro 模板 */
|
|
605
621
|
function installKiroTemplates(cwd, apiUrl, user) {
|
|
606
622
|
createMcpConfigAt(path.join(cwd, '.kiro', 'settings', 'mcp.json'), apiUrl, { user });
|
|
607
|
-
// 2. 生成 Kiro
|
|
608
|
-
const
|
|
609
|
-
if (!fs.existsSync(
|
|
610
|
-
fs.mkdirSync(
|
|
623
|
+
// 2. 生成 Kiro Steering 文件 (官方标准: .kiro/steering/ 而非 rules/)
|
|
624
|
+
const steeringDir = path.join(cwd, '.kiro', 'steering');
|
|
625
|
+
if (!fs.existsSync(steeringDir)) {
|
|
626
|
+
fs.mkdirSync(steeringDir, { recursive: true });
|
|
611
627
|
}
|
|
612
628
|
const srcRules = path.join(TEMPLATES_DIR, 'kiro-rules', 'ppdocs.md');
|
|
613
|
-
const
|
|
614
|
-
if (fs.existsSync(srcRules)
|
|
615
|
-
fs.copyFileSync(srcRules,
|
|
616
|
-
console.log(`✅
|
|
617
|
-
}
|
|
618
|
-
// 3.
|
|
629
|
+
const destSteering = path.join(steeringDir, 'ppdocs.md');
|
|
630
|
+
if (fs.existsSync(srcRules)) {
|
|
631
|
+
fs.copyFileSync(srcRules, destSteering);
|
|
632
|
+
console.log(`✅ Installed .kiro/steering/ppdocs.md`);
|
|
633
|
+
}
|
|
634
|
+
// 3. 清理废弃的 .kiro/rules/ 旧路径
|
|
635
|
+
const legacyRules = path.join(cwd, '.kiro', 'rules', 'ppdocs.md');
|
|
636
|
+
if (fs.existsSync(legacyRules)) {
|
|
637
|
+
fs.unlinkSync(legacyRules);
|
|
638
|
+
console.log(`🗑️ Removed deprecated .kiro/rules/ppdocs.md`);
|
|
639
|
+
}
|
|
640
|
+
// 4. 安装工作流到 .agents/workflows/
|
|
619
641
|
installWorkflows(cwd);
|
|
620
642
|
}
|
|
621
643
|
/** 检测当前工作区包含的 IDE */
|