Skip to content

feat: add Codex plugin compatibility layer (MCP + skills + hooks) - #135

Closed
laserduor wants to merge 1 commit into
devcxl:mainfrom
laserduor:main
Closed

feat: add Codex plugin compatibility layer (MCP + skills + hooks)#135
laserduor wants to merge 1 commit into
devcxl:mainfrom
laserduor:main

Conversation

@laserduor

Copy link
Copy Markdown

概述

在现有 OpenCode 插件的基础上,增加 Codex 插件兼容层,使 的 5 个生命周期工具和 8 个 flow skills 也能在 Codex 中使用。

新增文件

Codex 插件核心

文件 说明
.codex-plugin/plugin.json Codex 插件清单(skills + MCP server + hooks + interface metadata)
.mcp.json MCP 服务器配置,指向编译后的 MCP server
src/mcp-server.ts MCP stdio 服务器,将 5 个生命周期工具包装为 MCP tools

Skills & Hooks

文件 说明
skills/ 8 个 flow-* skill 的 symlink(Codex 自动发现 skills/ 目录)
hooks/hooks.json SessionStart 生命周期钩子
hooks/session-start.ts 钩子脚本:加载 dev-lifecycle agent prompt + Project Context

市场配置

文件 说明
.agents/plugins/marketplace.json 本地 marketplace 入口,用于 Codex 本地测试

修改文件

文件 变更
package.json 添加 codex/codex-plugin 关键词,更新描述
tsconfig.json 放松 strict 约束 + esModuleInterop + downlevelIteration

架构说明

双平台兼容

  • OpenCode 模式:原有的 @opencode-ai/plugin 插件流程不变,通过 index.tsplugin.tsplugin/server.ts 注入
  • Codex 模式:通过 MCP 服务器暴露工具,通过 skills/ 目录暴露技能,通过 hooks/ 注入 agent prompt

MCP 工具

MCP server 暴露 5 个工具(setup_control, flow_control, task_control, tdd_checkpoint, release_control),
每个工具完整保留所有 op 和参数,通过 JSON Schema 定义。

使用方式

Resolves: #1

Add full Codex plugin support alongside existing OpenCode plugin:

- .codex-plugin/plugin.json — Codex plugin manifest (skills + MCP server)
- .mcp.json — MCP server config wrapping 5 lifecycle tools
- src/mcp-server.ts — MCP stdio server exposing setup_control, flow_control,
  task_control, tdd_checkpoint, release_control as MCP tools
- skills/ — Symlinks to existing flow-* skills, also usable by Codex
- hooks/hooks.json + hooks/session-start.ts — SessionStart lifecycle hook
- .agents/plugins/marketplace.json — Personal marketplace entry for local testing

The MCP server dynamically imports kernel functions and presents them as
Codex-compatible tools with full JSON Schema argument definitions. The dev-lifecycle
agent prompt and skills are shared between OpenCode and Codex.

tsconfig: relaxed strict mode, added esModuleInterop + downlevelIteration
  for compatibility with kernel code's discriminated union patterns.
@laserduor

Copy link
Copy Markdown
Author

Superseded by PR #136 (codex-compat-v2)

@laserduor laserduor closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

配置指南与 GitHub Pages 自动部署

1 participant