v0.2.0
[0.2.0] - 2026-10-04
Added
- 导航菜单一级命令:
wpops menus list|get|create|update|delete;用--locations header,mobile把菜单绑定到主题位置。wpops menu-items list|get|create|update|delete,支持--menus、--menu-order、--parent、--status、--type、--object、--object-id、--url、--target、--classes、--description、--attr-title、--xfn;delete真正执行需--force。
- 核心 REST 覆盖大幅扩展:
content/terms:任意show_in_rest的 CPT / 自定义分类(按 rest_base)。search跨内容搜索;settings读取/更新站点设置;types/taxonomies/statuses自省。revisions(list/get/delete/restore)、blocks(可复用区块)、navigation、templates、template-parts、global-styles。widgets/sidebars、app-passwords(创建时明文只打印一次)。comments create;plugins delete <plugin> --force;media sideload --url(从 URL 导入)、media edit-image(裁剪/旋转)。abilities(list/get/run)、health(list/)、batch(仅 POST/PUT/PATCH/DELETE)。
- CLI 能力:
--all-pages自动翻页;--fields/--csv/--table输出投影;--quiet;--output <文件>;--site a,b;--timeout/--retries;sites show|rm|rename;completion bash|zsh|fish|powershell;help <组>。 - 单一事实来源
lib/spec.js:组/动作/写操作/别名一处声明,派生wpops help、wpops <组> --help、wpops commands --json、--all写操作护栏(isMutation)与 shell 补全,避免文档与代码漂移。 wpops commands --json:机器可读命令清单(组/动作/是否写操作/全局开关),供 agent 现查现用。- 命令分发抽到
lib/run.js(导出可测试的dispatch);新增 spec/help/dispatch 一致性测试,任何组或别名漏分发都会测试失败。 - 所有菜单写命令支持
--dry-run;--all护栏识别菜单与所有新写操作。 - 注:
/menus、/menu-items由站点插件提供;abilities、health也需对应插件。
Fixed
delete的--dry-run现在是真预览:预览不再要求--force(菜单/菜单项/分类/用户与文章/媒体 行为对齐);真正执行删除仍需--force。- 菜单端点不存在(
rest_no_route)时给出"需插件"的友好提示,便于排障。 - JSON 文件输入容忍 UTF-8 BOM(Windows 重定向/记事本常见),
--data/--requests-file/--from-file等不再因 BOM 解析失败。 batch明确拒绝 GET(核心/batch/v1只支持 POST/PUT/PATCH/DELETE),并兼容裸数组与{"requests":[...]}两种写法。
Changed
- 用法/参数错误统一处理:stderr 打印「错误 + 精简用法 +
wpops <组> --help提示」,退出码 2;运行期错误仍为 1;显式--help仍走 stdout、退出码 0;--all遇用法错误立即中止(不逐站重复)。 - 内置 skill 改为自洽薄索引:只保留安全流程、能力索引与"现查现用"指引,不再引用其他 skill;精确字段改为运行时向 CLI(
--help/commands --json/raw OPTIONS)查询。 - README 命令清单/能力表补充上述用法,并说明
--dry-run预览与--force的关系,以及"帮助由 spec 生成、不会漂移"。