godot-editor-controllisted
Install: claude install-skill chenhangcuisg-code/gat
# godot-editor-control — 用 AI 操控 Godot 编辑器
通过 **Hastur Operation Plugin**(rayxuln 作,Godot 4.x 远程代码执行插件)驱动**正在运行的 Godot 编辑器**:
发 GDScript 到 broker → broker 经 TCP 转给编辑器插件执行 → 回传 compile/run 结果与 outputs。
请求:$ARGUMENTS
> 架构:**本 skill(Agent)──HTTP:5302──▶ Broker(Node/Express)──TCP:5301──▶ Godot 编辑器插件**
> 插件 GitHub:https://github.com/rayxuln/hastur-operation-plugin
> ⚠️ **安全**:插件在编辑器里执行**任意 GDScript**。broker **只绑 localhost**,token 当密码,别提交/外泄。
## 环境(本机已验证)
- Python(客户端,**仅标准库**):`C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe`
- Node `v24.13.1`(跑 broker)。Godot 工程示例:`C:\Users\User\idle-engines\xiuxian-godot`(4.7)。
- 客户端/模板/测试都在本 skill 下:`scripts/` `gdscript/ops/` `references/`。
## 先决条件(一次性,见 `references/install.md`)
1. 把插件 `addons/hasturoperationgd/` 拷进 Godot 工程 → Project Settings → Plugins 启用 → dock 变绿。
2. 起 broker:`cd broker-server && npm install && npm run dev`(默认 HTTP `:5302` / TCP `:5301`),
**记下它打印的 64 位 hex token**。
3. 配置客户端连接:工程根/家目录放 `.hastur.json`:
```json
{ "broker": "http://localhost:5302", "token": "<broker打印的token>", "project_name": "修仙" }
```
(或用 `--broker/--token` 或环境变量 `HASTUR_BASE_URL/HASTUR_AUTH_TOKEN`。)
## 执行流程(收到一个"操控编辑器"的需求时)
1. **连通自检**:`gop.py health` → 200;`gop.py executors` → 看有没有 `type:editor` 实例、记下 `id`。
2. **选/拼操作**:
- 命中常用操作 → 用模板:`gop.py op <name> --set k=v ...`(`op --list` 看全部)。
- 不在模板里 → 写 GDScript:`gop.py exec --file x.gd`(或 `--code "..."`);照 `operations-cookbook.md`。
3. **先 `--dry-run`** 看将发送的 GDScript 对不对