@ppdocs/mcp 3.1.5 → 3.1.6

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.
Files changed (2) hide show
  1. package/dist/cli.js +31 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -513,6 +513,37 @@ function installAntigravityTemplates(cwd) {
513
513
  createMcpConfigAt(path.join(cwd, '.gemini', 'settings.json'));
514
514
  // 2. 生成 AGENTS.md
515
515
  generateAgentsMd(cwd);
516
+ // 3. 安装斜杠命令 → .agents/workflows/ (Antigravity 的 slash command 机制)
517
+ const cmdSrcDir = path.join(TEMPLATES_DIR, 'commands', 'pp');
518
+ if (fs.existsSync(cmdSrcDir)) {
519
+ const workflowDir = path.join(cwd, '.agents', 'workflows');
520
+ if (!fs.existsSync(workflowDir)) {
521
+ fs.mkdirSync(workflowDir, { recursive: true });
522
+ }
523
+ const files = fs.readdirSync(cmdSrcDir).filter(f => f.endsWith('.md'));
524
+ let count = 0;
525
+ for (const file of files) {
526
+ // 命名: init.md → pp-init.md, review.md → pp-review.md
527
+ const baseName = path.basename(file, '.md');
528
+ const workflowName = `pp-${baseName.toLowerCase()}`;
529
+ const destFile = path.join(workflowDir, `${workflowName}.md`);
530
+ if (fs.existsSync(destFile))
531
+ continue; // 不覆盖已有的
532
+ const content = fs.readFileSync(path.join(cmdSrcDir, file), 'utf-8');
533
+ // 从第一行提取描述 (去掉 markdown 格式)
534
+ const firstLine = content.split('\n')[0]
535
+ .replace(/^\*\*[^*]+\*\*:\s*/, '') // 去掉 **角色**: 前缀
536
+ .replace(/^#+\s*/, '') // 去掉 # 标题前缀
537
+ .trim()
538
+ .slice(0, 80); // 限长
539
+ const workflow = `---\ndescription: "${firstLine}"\n---\n\n${content}`;
540
+ fs.writeFileSync(destFile, workflow, 'utf-8');
541
+ count++;
542
+ }
543
+ if (count > 0) {
544
+ console.log(`✅ Installed ${count} workflows to .agents/workflows/ (use /pp-sync, /pp-review ...)`);
545
+ }
546
+ }
516
547
  }
517
548
  /** 安装 Kiro 模板 */
518
549
  function installKiroTemplates(cwd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ppdocs/mcp",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "ppdocs MCP Server - Knowledge Graph for Claude",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",