Stats
Actions
Tags
How this skill is triggered — by the user, by Claude, or both
Slash command
/apifox-sync:apifox-sync <init|push|pull> [args]<init|push|pull> [args]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Apifox 接口同步工具,支持双向操作:
data/api-config.jsondata/framework-schemas.jsondata/type-mappings.jsonreferences/enum-detection.mdreferences/init.mdreferences/openapi-gen.mdreferences/pull.mdreferences/push-api.mdreferences/push-parse.mdreferences/type-resolution.mdscripts/api_path.pyscripts/debug_log.pyscripts/detect_mode.pyscripts/json_safe.pyscripts/list_folders.pyscripts/load_config.pyscripts/path_codec.pyscripts/pull_approve_all.pyscripts/pull_diff.pyscripts/pull_extract.pyApifox 接口同步工具,支持双向操作:
解析 {{ARGUMENTS}} 的第一个词:
init → 读取 references/init.md 并执行push → 按下方 Push 流程 执行pull → 按下方 Pull 流程 执行用法:
/apifox-sync init— 配置 Apifox API Token 和项目 ID/apifox-sync push @Controller.java— 推送整个 Controller/apifox-sync push @Controller.java#L35— 推送单个接口/apifox-sync pull— 交互式选择目录拉取/apifox-sync pull 用户管理— 直接拉取指定目录/apifox-sync pull 用户管理/创建用户— 只拉取指定目录下的单个接口/apifox-sync pull 获取用户列表— 按关键词搜索接口并拉取
读取对应参考文件后按步骤顺序执行:
| 步骤 | 参考文件 | 内容 |
|---|---|---|
| 1-5 | references/push-parse.md | 解析参数、加载配置、读取 Controller、定位方法、提取接口信息 |
| 6 | references/type-resolution.md | 递归展开 DTO/VO 类型,两级降级定位 |
| 7 | references/enum-detection.md | Integer 字段匹配枚举,提取 code+desc |
| 8 | references/push-api.md 步骤 8 | export-openapi 获取文件夹,AskUserQuestion 选目标 |
| 9 | references/openapi-gen.md | 组装 OpenAPI 3.0 JSON,写入 spec |
| 10-12 | references/push-api.md 步骤 10-12 | JSON 预验证、分类推送(锚点匹配/死接口清理/import)、报告 |
读取 references/pull.md 按步骤顺序执行:
pull 参数解析(步骤 2.5 由 detect_mode.py 脚本自动完成):
<目录>/<接口名> 且目录部分匹配 → 接口模式| 步骤 | 内容 |
|---|---|
| 1 | 加载配置(env > .claude/apifox.json) |
| 2 | export-openapi 获取全量,list_folders.py 枚举目录 |
| 2.5 | detect_mode.py 自动检测参数模式,确定 PULL_MODE |
| 3 | 交互模式:AskUserQuestion 多选目录;其他模式:跳过 |
| 4 | pull_extract.py 按接口粒度切片 + 精简扩展字段 |
| 5 | 精简规则(内聚到脚本,仅保留 paths+schemas) |
| 5.5 | pull_diff.py diff 预览;目录/接口/关键词模式:自动 approve,跳过确认;交互模式:AskUserQuestion 确认 |
| 6 | pull_save.py 落盘,自动迁移 v1.2 旧聚合文件 |
| 7 | 输出摘要,清理临时文件 |
| 文件 | 用途 |
|---|---|
data/type-mappings.json | Java → OpenAPI 基础类型映射、集合类型规则、框架注入参数忽略列表、验证注解映射 |
data/framework-schemas.json | Page/R/PageRequest 骨架模板、Schema 命名与清洗规则、泛型占位符替换规则 |
data/api-config.json | Apifox API 常量(base URL、版本头、端点路径、临时文件前缀) |
{type: object},不中断流程.claude/apifox.json,建议加 .gitignore;也可用 APIFOX_API_TOKEN 环境变量。禁止明文输出 TokenPROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")AUTO_MERGE;推到不同文件夹则 CREATE_NEW。已知限制:同 path+method 跨文件夹已存在时后续更新可能不准确Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub anduinnn/apifox-sync --plugin apifox-sync