mcpField
C
cocos-build

cocos-build

github.com/958877748Development0108 installsUpdated 13w ago
Repository

About cocos-build

cocos-build is a development workflow skill for Cocos Creator 2.x projects, with the editor running locally as a prerequisite. It guides script compilation, component .meta generation, and preview verification.

Key features

  1. 01Trigger compilation of assets scripts
  2. 02Generate component .meta files
  3. 03Check changes in a preview
  4. 04Specify the editor prerequisite

Use cases

  1. 01Compile after editing TypeScript or JavaScript
  2. 02Create a component and generate UUID metadata
  3. 03Check the display of Label, Sprite, and other components

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/958877748/skills --skill cocos-build

After installing, type/cocos-buildin Claude Code to confirm it loaded.

Details

From the project README

cocos-build

用于 Cocos Creator 2.x 项目的开发工作流自动化。

前提条件

  • Cocos Creator 编辑器必须正在运行(监听 localhost:7456)

使用场景

  1. 修改或创建 TypeScript/JavaScript 脚本后需要编译
  2. 创建新组件后需要生成 .meta 文件
  3. 需要验证代码修改在预览中的效果

编译指令

修改任何 assets/ 目录下的脚本文件后,执行以下命令触发编译:

curl.exe http://localhost:7456/update-db

成功返回:Changes submitted

完整工作流

  1. 修改代码 - 编辑 assets/ 下的 .ts 文件
  2. 触发编译 - 调用 curl.exe http://localhost:7456/update-db
  3. 验证效果 - 使用 frontend-tester agent 截图预览页面 http://localhost:7456/
  4. 确认结果 - 检查 Label、Sprite 等组件显示是否符合预期

新建组件

创建新的 TypeScript 组件时:

  1. 在 assets/ 目录下创建 .ts 文件
  2. 执行编译命令
  3. Creator 自动生成对应的 .meta 文件(包含 uuid)

预览验证

使用 frontend-tester agent 截图验证:

task(subagent_type="frontend-tester")

预览地址:http://localhost:7456/

注意事项

  • Windows 环境必须使用 curl.exe 而非 curl(PowerShell 别名问题)
  • 编译前确保 Creator 编辑器处于打开状态

Comments

Markdown supported