Claude Code 插件:Apifox 接口同步工具,支持双向操作。
operation.summary)
.claude/apis/<Apifox folder 原样层级>/<接口名>.json用户服务/v1/用户管理,summary=创建用户(POST /api/users)
→ .claude/apis/用户服务/v1/用户管理/创建用户.json.<METHOD> 后缀
(如 用户.POST.json / 用户.GET.json)GET /api/users → users.json)<folder>.json 聚合 / v1.3 URL 路径展开目录)在下一次 pull 选中对应 folder 时会自动迁移为新结构(按文件内部 method+path 匹配,保证不误删用户修改)在 Claude Code 对话中依次输入:
/plugin marketplace add https://github.com/anduinnn/apifox-sync
/plugin install apifox-sync@apifix-sync
项目级安装(仅当前项目生效):
git clone https://github.com/anduinnn/apifox-sync.git .opencode/skills/apifox-sync
全局安装(所有项目生效):
git clone https://github.com/anduinnn/apifox-sync.git ~/.config/opencode/skills/apifox-sync
OpenCode 启动时会自动加载插件目录下的插件。
# 配置 Apifox API Token 和项目 ID
/apifox-sync init
# 推送整个 Controller
/apifox-sync push @path/to/Controller.java
# 推送单个接口(指定行号)
/apifox-sync push @path/to/Controller.java#L35
# 从 Apifox 拉取指定目录的接口定义
/apifox-sync pull
每个 push 的接口在 Apifox 里会带上稳定锚点 x-source-method-fq({全限定类名}#{方法名})。再次 push 时:
AUTO_MERGE 更新DELETE /http-apis/{id} 端点清理,避免死接口残留CREATE_NEW 新建没有锚点的历史数据自动降级到原有 path+method 匹配规则,升级不破坏老项目。
pull 时会先扫描本地 .claude/apis/(新接口级布局优先,未命中回落到 v1.2.x 的 folder 聚合文件),与拉取回来的最新数据按 folder 聚合做 diff:
[DIFF ] 用户管理 → .claude/apis/用户管理/(将迁移旧文件并拆分为单接口文件)
+ POST /api/users/batch
~ PUT /api/users/{id}
- GET /api/users/list (远程已删除,本地将被清理)
提供「全部覆盖 / 逐目录选择 / 取消」三种处理方式,不会再静默覆盖本地文件。选中对应 folder 时会自动迁移老版本的 <folder>.json 聚合文件到新的接口级布局。
同 path+method 跨文件夹的限制:Apifox 允许同一个 path+method(如 POST /api/users)存在于不同文件夹中,但 OpenAPI 规范以 path+method 为唯一键,导出时只会保留其中一个。这会影响:
建议避免在不同文件夹中创建相同 path+method 的接口。
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub anduinnn/apifox-sync --plugin apifox-syncUse this agent to update, synchronize, or validate the OpenAPI specification (openapi.yml) against the actual REST API implementation. This includes adding new endpoints, updating request/response schemas, fixing discrepancies between the spec and code, or ensuring complete API documentation coverage.
Validate and synchronize API contracts (OpenAPI, GraphQL) with implementation, detect breaking changes, and generate client code
API design, documentation, and testing with OpenAPI spec generation
Generate RESTful APIs from schemas with proper routing, validation, and documentation
Creates professional API documentation using OpenAPI specifications with endpoints, authentication, and interactive examples. Use when documenting REST APIs, creating SDK references, or building developer portals.
Generate API documentation for endpoints