@ppdocs/mcp 3.2.12 → 3.2.14
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 +46 -26
- package/dist/web/server.js +38 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -528,37 +528,57 @@ function installAntigravityTemplates(cwd, apiUrl) {
|
|
|
528
528
|
createMcpConfigAt(path.join(cwd, '.gemini', 'settings.json'), apiUrl, { noEnv: true });
|
|
529
529
|
// 2. 生成 AGENTS.md
|
|
530
530
|
generateAgentsMd(cwd);
|
|
531
|
-
// 3. 安装斜杠命令 →
|
|
531
|
+
// 3. 安装斜杠命令 → 全局目录 ~/.gemini/antigravity/global_workflows/
|
|
532
|
+
// Antigravity 从此目录读取全局斜杠命令,文件名=命令名,必须有 YAML frontmatter
|
|
532
533
|
const cmdSrcDir = path.join(TEMPLATES_DIR, 'commands', 'pp');
|
|
533
|
-
if (fs.existsSync(cmdSrcDir))
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
534
|
+
if (!fs.existsSync(cmdSrcDir))
|
|
535
|
+
return;
|
|
536
|
+
// Antigravity 全局 workflows 目录
|
|
537
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
538
|
+
const globalWorkflowDir = path.join(homeDir, '.gemini', 'antigravity', 'global_workflows');
|
|
539
|
+
if (!fs.existsSync(globalWorkflowDir)) {
|
|
540
|
+
fs.mkdirSync(globalWorkflowDir, { recursive: true });
|
|
541
|
+
}
|
|
542
|
+
// 同时也安装到项目本地 .agents/workflows/ (作为备用)
|
|
543
|
+
const localWorkflowDir = path.join(cwd, '.agents', 'workflows');
|
|
544
|
+
if (!fs.existsSync(localWorkflowDir)) {
|
|
545
|
+
fs.mkdirSync(localWorkflowDir, { recursive: true });
|
|
546
|
+
}
|
|
547
|
+
// 模板文件名 → { 简短命令名, 中文描述 }
|
|
548
|
+
const COMMAND_MAP = {
|
|
549
|
+
'init.md': { name: 'pp-init', desc: '初始化项目知识图谱' },
|
|
550
|
+
'sync.md': { name: 'pp-sync', desc: '同步代码与知识图谱' },
|
|
551
|
+
'review.md': { name: 'pp-shencha', desc: '审查任务成果' },
|
|
552
|
+
'DiagnosticProtocol.md': { name: 'pp-fenxi', desc: '深度分析错误' },
|
|
553
|
+
'Execution_Task.md': { name: 'pp-task', desc: '执行开发任务' },
|
|
554
|
+
'Sentinel_4.md': { name: 'pp-audit', desc: '多Agent代码审计' },
|
|
555
|
+
'SynchronizationProtocol.md': { name: 'pp-syncpro', desc: '知识图谱同步协议' },
|
|
556
|
+
'Zero_Defec_Genesis.md': { name: 'plan', desc: '零缺陷创生协议' },
|
|
557
|
+
};
|
|
558
|
+
const files = fs.readdirSync(cmdSrcDir).filter(f => f.endsWith('.md'));
|
|
559
|
+
let count = 0;
|
|
560
|
+
for (const file of files) {
|
|
561
|
+
const mapping = COMMAND_MAP[file];
|
|
562
|
+
if (!mapping)
|
|
563
|
+
continue; // 未映射的模板跳过
|
|
564
|
+
const content = fs.readFileSync(path.join(cmdSrcDir, file), 'utf-8');
|
|
565
|
+
// 生成 Antigravity 格式: YAML frontmatter + 内容
|
|
566
|
+
const workflow = `---\ndescription: ${mapping.desc}\n---\n\n${content}`;
|
|
567
|
+
// 写入全局目录
|
|
568
|
+
const globalFile = path.join(globalWorkflowDir, `${mapping.name}.md`);
|
|
569
|
+
if (!fs.existsSync(globalFile)) {
|
|
570
|
+
fs.writeFileSync(globalFile, workflow, 'utf-8');
|
|
556
571
|
count++;
|
|
557
572
|
}
|
|
558
|
-
|
|
559
|
-
|
|
573
|
+
// 同时写入项目本地目录
|
|
574
|
+
const localFile = path.join(localWorkflowDir, `${mapping.name}.md`);
|
|
575
|
+
if (!fs.existsSync(localFile)) {
|
|
576
|
+
fs.writeFileSync(localFile, workflow, 'utf-8');
|
|
560
577
|
}
|
|
561
578
|
}
|
|
579
|
+
if (count > 0) {
|
|
580
|
+
console.log(`✅ Installed ${count} slash commands to global_workflows/ (use /plan, /pp-init, /pp-fenxi ...)`);
|
|
581
|
+
}
|
|
562
582
|
}
|
|
563
583
|
/** 安装 Kiro 模板 */
|
|
564
584
|
function installKiroTemplates(cwd, apiUrl) {
|
package/dist/web/server.js
CHANGED
|
@@ -563,7 +563,13 @@ export function startWebServer(webPort) {
|
|
|
563
563
|
key: proj.remote.password,
|
|
564
564
|
user: `Agent@${os.hostname()}`,
|
|
565
565
|
}, null, 2));
|
|
566
|
-
|
|
566
|
+
let extra = '';
|
|
567
|
+
if (platform === 'antigravity') {
|
|
568
|
+
const cmdCount = installAntigravitySlashCommands();
|
|
569
|
+
if (cmdCount > 0)
|
|
570
|
+
extra = ` + ${cmdCount}个斜杠命令`;
|
|
571
|
+
}
|
|
572
|
+
res.json({ ok: true, message: `✅ ${platform} MCP 已安装${extra}` });
|
|
567
573
|
}
|
|
568
574
|
catch (e) {
|
|
569
575
|
res.json({ ok: false, error: String(e) });
|
|
@@ -667,6 +673,37 @@ function removeMcpFromConfig(filePath, serverName) {
|
|
|
667
673
|
}
|
|
668
674
|
catch { /* ignore */ }
|
|
669
675
|
}
|
|
676
|
+
/** 安装 Antigravity 斜杠命令到全局目录 ~/.gemini/antigravity/global_workflows/ */
|
|
677
|
+
function installAntigravitySlashCommands() {
|
|
678
|
+
const templatesDir = path.join(__dirname, '..', 'templates', 'commands', 'pp');
|
|
679
|
+
if (!fs.existsSync(templatesDir))
|
|
680
|
+
return 0;
|
|
681
|
+
const globalDir = path.join(os.homedir(), '.gemini', 'antigravity', 'global_workflows');
|
|
682
|
+
fs.mkdirSync(globalDir, { recursive: true });
|
|
683
|
+
const COMMAND_MAP = {
|
|
684
|
+
'init.md': { name: 'pp-init', desc: '初始化项目知识图谱' },
|
|
685
|
+
'sync.md': { name: 'pp-sync', desc: '同步代码与知识图谱' },
|
|
686
|
+
'review.md': { name: 'pp-shencha', desc: '审查任务成果' },
|
|
687
|
+
'DiagnosticProtocol.md': { name: 'pp-fenxi', desc: '深度分析错误' },
|
|
688
|
+
'Execution_Task.md': { name: 'pp-task', desc: '执行开发任务' },
|
|
689
|
+
'Sentinel_4.md': { name: 'pp-audit', desc: '多Agent代码审计' },
|
|
690
|
+
'SynchronizationProtocol.md': { name: 'pp-syncpro', desc: '知识图谱同步协议' },
|
|
691
|
+
'Zero_Defec_Genesis.md': { name: 'plan', desc: '零缺陷创生协议' },
|
|
692
|
+
};
|
|
693
|
+
let count = 0;
|
|
694
|
+
for (const [file, mapping] of Object.entries(COMMAND_MAP)) {
|
|
695
|
+
const dest = path.join(globalDir, `${mapping.name}.md`);
|
|
696
|
+
if (fs.existsSync(dest))
|
|
697
|
+
continue;
|
|
698
|
+
const src = path.join(templatesDir, file);
|
|
699
|
+
if (!fs.existsSync(src))
|
|
700
|
+
continue;
|
|
701
|
+
const content = fs.readFileSync(src, 'utf-8');
|
|
702
|
+
fs.writeFileSync(dest, `---\ndescription: ${mapping.desc}\n---\n\n${content}`);
|
|
703
|
+
count++;
|
|
704
|
+
}
|
|
705
|
+
return count;
|
|
706
|
+
}
|
|
670
707
|
/** 获取 Claude Desktop 全局配置路径 */
|
|
671
708
|
function getClaudeGlobalPath() {
|
|
672
709
|
if (process.platform === 'win32')
|