Cocos Asset JSON
本 skill 的解析脚本只读;这不限制用户已授权的资产编辑任务。编辑时读取对应 prefab-workflow.md、scene-workflow.md 或 resource-api.md,完成编辑后用本 skill 校验。用户只要求检查时不写资源。
快速入口
优先运行脚本,避免临时手写解析器:
python .agents/skills/cocos-asset-json/scripts/cocos_asset_json.py inspect --file Client/assets/asset-raw/ui/TipUI.prefab
python .agents/skills/cocos-asset-json/scripts/cocos_asset_json.py validate --file Client/assets/scenes/main.scene --assets-root Client/assets
python .agents/skills/cocos-asset-json/scripts/cocos_asset_json.py uuid-index --assets-root Client/assets
python .agents/skills/cocos-asset-json/scripts/cocos_asset_json.py asset-index --file Client/assets/asset-raw/asset-catalog/asset-index.json
python .agents/skills/cocos-asset-json/scripts/cocos_asset_json.py atlas --plist Client/assets/asset-raw/ui-raw/atlas/foo/foo.plist --meta Client/assets/asset-raw/ui-raw/atlas/foo/foo.plist.meta
脚本只读,输出 JSON。需要编辑资产时,先读对应 Tyou 参考并按 sdd-explore/references/alignment-contract.md 判断风险和已有授权:Prefab 用 .agents/skills/tyou-dev/references/prefab-workflow.md,Scene 用 .agents/skills/tyou-dev/references/scene-workflow.md,资源索引用 .agents/skills/tyou-dev/references/resource-api.md。编辑后必须重新运行结构与引用校验。
何时读 reference
- Prefab/Scene 对象数组、
__id__、Prefab instance/override、自定义组件短类型 ID:读references/cocos-source-assets.md。 - SpriteAtlas
.plist和.plist.meta的 frame/subMeta/uuid 关系:读references/sprite-atlas.md。
边界
- 不解析 Luban
.bin。配表问题使用luban-dev,直接看Design/config/*.xlsx、Defines、导表脚本和生成 TS 访问面。 - 不修改
Client/library、Client/temp、Client/build等 Cocos 缓存或构建产物。 - 不承诺把 Cocos 自定义脚本短类型 ID 精确映射到类名。脚本会输出字段、挂载节点和候选线索;具体类名要结合源码
@ccclass、字段名和 Cocos 当前行为确认。
常用流程
inspect看对象数、节点数、组件类型、自定义组件字段、Prefab instance/override 摘要。validate查 JSON 解析、__id__悬空引用、meta importer/files、外部 uuid 是否能在assets-root下找到。uuid-index建立.metauuid 到路径的索引,排查__uuid__引用。asset-index看 bundle/type/path/name 分布和重复逻辑名。atlas查询 SpriteAtlas frame 名、rect、subMeta uuid 和 texture uuid。