feat: 新增 fix-borders —— 修复 Cocos 重启把九宫格 border 重置成 0 的 meta

Cocos 重启/重新导入有时把已设九宫格的图 meta 里 subMetas.*.userData.border*
重置成 0(九宫格丢失)。新增功能扫 git 改动的 .meta,把「git 有值、工作区被
清 0」的 border 还原成 git 的正确值,只动 border 字段、保留 meta 其它改动。

- cli/src/editor/fix-borders.js: 核心(git 对比 + 精准还原)
- cli fix-borders 命令(main.js 注册)
- MCP tool meta_fix_reset_border(main.js wrapper + server/tools.js)
- 跨平台纯 JS + git,带 dry-run

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
furao
2026-06-07 18:34:53 +08:00
parent 803a09517f
commit fc93911d31
5 changed files with 177 additions and 1 deletions
+11
View File
@@ -308,6 +308,17 @@ function defineTools(ctx) {
return local.cleanDevDir();
},
},
{
name: 'meta_fix_reset_border',
description: '修复 Cocos 重启把图片九宫格 bordersubMetas.*.userData.border*)重置成 0 的 meta:扫 git 改动的 .meta,把「git 有值、工作区被清 0」的 border 还原成 git 的正确值,只动 border 字段、保留 meta 其它改动。dryRun=true 只预览不写。',
inputSchema: {
type: 'object',
properties: { dryRun: { type: 'boolean', description: 'true=只预览不写文件,列出将还原的 meta' } },
},
handler: async function (args) {
return local.fixResetBorders({ dryRun: !!(args && args.dryRun) });
},
},
];
}