Skip to content

插件系统

插件(Plugins)是 Codex 的功能扩展包,每个插件可以包含多个技能、MCP 服务器和应用工具。插件通过统一的包格式分发和管理。

什么是插件

插件是一种模块化扩展机制,能够:

  • 打包多个相关技能
  • 提供 MCP 服务器配置
  • 注册应用工具
  • 通过市场统一分发

插件 vs 技能

技能是单一功能单元,插件是技能的容器。一个插件可以包含多个技能、MCP 服务器和应用工具。

插件结构

每个插件是一个独立文件夹,核心文件是 .codex-plugin/plugin.json

plugin-name/
├── .codex-plugin/
│   ├── plugin.json       # 必需 - 插件清单
│   ├── .app.json         # 可选 - 应用工具配置
│   └── .mcp.json         # 可选 - MCP 服务器配置
├── skills/               # 可选 - 技能目录
│   ├── skill-a/
│   │   └── SKILL.md
│   └── skill-b/
│       └── SKILL.md
├── references/           # 可选 - 参考文档
└── assets/               # 可选 - 资源文件

plugin.json 结构

插件清单文件定义了插件的元数据和组成:

json
{
  "name": "codex-security",
  "version": "0.1.10",
  "description": "Codex Security workflows for security scans, analysis, and investigation.",
  "author": {
    "name": "OpenAI"
  },
  "homepage": "https://developers.openai.com/codex/security",
  "repository": "https://github.com/openai/plugins",
  "license": "Proprietary",
  "keywords": ["security", "code-review", "appsec"],
  "skills": "./skills/",
  "apps": "./.app.json",
  "mcpServers": "./.mcp.json",
  "interface": {
    "displayName": "Codex Security",
    "shortDescription": "Security scanning for your codebase",
    "longDescription": "Codex Security packages reusable workflows for security scans...",
    "developerName": "OpenAI",
    "category": "Security",
    "capabilities": ["Interactive", "Read", "Write"],
    "brandColor": "#111111",
    "composerIcon": "./assets/logo.png",
    "logo": "./assets/logo.png"
  }
}

字段说明

字段必需说明
name插件名称(唯一标识)
version语义化版本号
description插件功能描述
author作者信息
skills技能目录路径
apps应用工具配置路径
mcpServersMCP 服务器配置路径
interfaceUI 展示信息

已安装的插件

完整插件列表

插件名称说明包含技能数
codex-security@openai-api-curated安全扫描工作流10
build-web-apps@openai-api-curatedWeb 应用构建6
build-web-data-visualization@openai-api-curated数据可视化1
remotion@openai-api-curatedRemotion 视频创建1
github@openai-api-curatedGitHub 集成4
coderabbit@openai-api-curatedCodeRabbit 代码审查1
hyperframes@openai-api-curatedHyperFrames 视频合成4
magicpath@openai-api-curatedMagicPath UI 组件1
superpowers@openai-api-curated超级能力工具集12
sentry@openai-api-curatedSentry 错误监控1

各插件技能详情

codex-security

技能说明
security-scan仓库范围安全扫描
security-diff-scanPR/提交安全扫描
deep-security-scan深度安全扫描
finding-discovery发现候选安全问题
validation验证安全问题
attack-path-analysis攻击路径分析
threat-model威胁建模
triage-finding安全问题分类
fix-finding修复安全问题
track-findings跟踪安全问题

build-web-apps

技能说明
frontend-app-builder前端应用构建
frontend-testing-debugging前端测试调试
react-best-practicesReact 最佳实践
shadcnshadcn/ui 组件管理
stripe-best-practicesStripe 集成指南
supabase-postgres-best-practicesSupabase/Postgres 优化

superpowers

技能说明
brainstorming需求探索与设计
dispatching-parallel-agents并行代理调度
executing-plans计划执行
finishing-a-development-branch开发分支收尾
receiving-code-review接收代码审查
requesting-code-review请求代码审查
subagent-driven-development子代理驱动开发
systematic-debugging系统化调试
test-driven-development测试驱动开发
using-git-worktreesGit worktree 使用
using-superpowers超级能力使用指南
verification-before-completion完成前验证

github

技能说明
githubGitHub 通用操作
gh-address-comments处理 PR 评论
gh-fix-ci修复 CI 失败
yeet发布更改到 GitHub

hyperframes

技能说明
hyperframesHyperFrames 视频合成
hyperframes-cliHyperFrames CLI 工具
hyperframes-registryHyperFrames 注册表
website-to-hyperframes网站转视频

插件管理

查看已安装插件

bash
# 列出所有插件
codex config show plugins

# 或直接查看配置文件
cat ~/.codex/config.toml

启用/禁用插件

~/.codex/config.toml 中配置:

toml
[plugins."plugin-name@openai-api-curated"]
enabled = true   # 启用
# 或
enabled = false  # 禁用

安装新插件

bash
# 从市场安装
codex plugins install <plugin-name>

# 从 GitHub 安装
codex plugins install github:owner/repo

卸载插件

bash
codex plugins uninstall <plugin-name>

更新插件

bash
# 更新单个插件
codex plugins update <plugin-name>

# 更新所有插件
codex plugins update --all

插件配置

插件通过 ~/.codex/config.toml 中的 [plugins.*] 节点进行管理:

toml
[plugins."codex-security@openai-api-curated"]
enabled = true

[plugins."build-web-apps@openai-api-curated"]
enabled = true

[plugins."build-web-data-visualization@openai-api-curated"]
enabled = true

[plugins."remotion@openai-api-curated"]
enabled = true

[plugins."github@openai-api-curated"]
enabled = true

[plugins."coderabbit@openai-api-curated"]
enabled = true

[plugins."hyperframes@openai-api-curated"]
enabled = true

[plugins."magicpath@openai-api-curated"]
enabled = true

[plugins."superpowers@openai-api-curated"]
enabled = true

[plugins."sentry@openai-api-curated"]
enabled = true

插件市场

浏览市场

在线浏览可用插件和技能:

搜索插件

bash
# 搜索插件
codex plugins search "security"

# 搜索技能
npx skills find "react"

安装前缀

已安装的插件使用 openai-api-curated 前缀标识来源:

plugin-name@openai-api-curated

这表示该插件来自 OpenAI API 策划的插件集合。

创建自定义插件

使用 plugin-creator 技能

Codex 内置了 plugin-creator 技能来指导插件创建:

bash
> 使用 $plugin-creator 创建一个新的插件

手动创建

  1. 创建插件目录结构
  2. 编写 .codex-plugin/plugin.json
  3. 添加技能到 skills/ 目录
  4. 在配置文件中启用

提示

建议先研究现有插件的结构作为参考,特别是 plugin.json 的格式。

下一步

基于 Codex CLI v0.142.5