SuperAPI AI 工具集

plugin-creator

编程与开发

查看项目

更新于 10-16 09:14

技能介绍

Plugin Creator 用于搭建新的 cave 插件。一个 cave 插件是一个发布到 GitHub(或任意 zip URL)的目录,其中包含 .cave-plugin/plugin.json 清单,以及可选的 commands、skills、agents、themes、hooks 等子目录。

用途 当用户需要创建 cave 插件时,Plugin Creator 负责生成完整的插件骨架,包括清单文件和标准目录结构,使插件可以直接发布和安装。

清单(Manifest)结构 清单为 JSON 格式,包含以下字段:name、version、description、author、license、homepage、caveVersion、tags、capabilities。capabilities 下可声明 commands、skills、agents、themes、mcp 和 hooks。

字段规则

  • name:kebab-case,仅允许 a-z0-9 和连字符,必须在市场中唯一。
  • version:semver("major.minor.patch")。
  • description:一句话,纯文本。
  • tags:自由格式字符串,用于 caveman 插件搜索匹配。
  • capabilities.commands:存在 commands/ 目录时设为 true。
  • capabilities.skills:存在 skills/ 目录时设为 true。
  • capabilities.agents:存在 agents/ 目录时设为 true。
  • capabilities.themes:存在 themes/ 目录时设为 true。
  • capabilities.mcp:存在 .mcp.json 时设为 true。
  • capabilities.hooks:钩子条目数组。

钩子条目结构 形如 { "event": "PostToolUse", "command": "hooks/post-tool-use.sh", "matcher": "Bash" }。

目录结构 my-plugin/ 下包含:

  • .cave-plugin/plugin.json(必需)
  • commands/my-command.md(markdown 斜杠命令)
  • skills/my-skill/SKILL.md(带 frontmatter 的技能)
  • agents/my-agent.md(智能体定义 markdown)
  • themes/my-theme.json(cave 主题格式的 JSON)
  • hooks/post-tool-use.sh(钩子脚本,需 chmod +x)
  • .mcp.json(可选,MCP 服务器定义)
  • README.md

搭建步骤 当用户要求创建插件时,按以下步骤执行:

  1. 询问插件详情(名称、描述、需要哪些能力)。
  2. 使用上述 schema 创建 .cave-plugin/plugin.json。
  3. 只创建需要的子目录(不要创建空目录)。
  4. 为每个启用的能力添加占位文件:
    • commands/example.md,带 frontmatter ---\ndescription: Example command.\n---\n\n# Example\n\nDescribe what this command does.\n
    • skills/example/SKILL.md,带标准技能 frontmatter。
    • agents/example.md,带智能体 frontmatter。
    • hooks/example.sh,内容为 #!/bin/bash\n# Hook: <event>\n,并 chmod +x。
  5. 创建 README.md,包含安装说明和简短描述。
  6. 通过回显清单并检查所有必填字段来校验清单。

发布 搭建完成后,指引用户:

  1. 将插件推送到公开的 GitHub 仓库。
  2. 通过向 marketplace.json 添加条目来提交到市场,条目形如: { "plugins": [ { "ref": "your-handle/my-plugin", "name": "my-plugin", "description": "...", "tags": ["..."], "version": "0.1.0" } ] } 用户使用以下命令安装:caveman plugin install your-handle/my-plugin

示例交互 用户:"Create a plugin that adds a /summarize command and a post-save hook." 执行:

  1. 创建 .cave-plugin/plugin.json,设置 "commands": true,"hooks": [{ "event": "PostToolUse", "command": "hooks/post-save.sh", "matcher": "Write" }]。
  2. 创建 commands/summarize.md,包含 summarize 斜杠命令描述。
  3. 创建 hooks/post-save.sh,包含桩钩子脚本。
  4. 创建 README.md。
  5. 报告创建的文件树。

限制 资料未提供关于收费、价格、平台支持范围、运行环境要求或效果保证的信息。