技能版本 1.0.0

godot-headless-verify

Run Godot in headless mode to verify a project — quick load tests ("does this scene still instantiate?"), cache/UID cache repair ("editor shows red errors but game runs fine"), and batch resource operations. Use this skill when the user says things like "clear Godot cache", "editor shows referenced non-existent resource", "verify the project still loads", "run headless validation", "sanity-check after a refactor", or when they ask how to drive Godot from the command line without opening the UI.

价格

免费

  • 安装:免费

在组织开通时一次性收取;再次读取清单或下载不重复收费。

以上为公开标价。你的组织可能有协议价,以控制台显示的价格为准。

如何使用

  1. 为组织安装

    开通即安装:组织固定使用开通时的版本(当前为 1.0.0)。升级到新版本需要取消后重新开通。

  2. 创建凭证

    客户端使用组织凭证读取;绑定到数字人后,数字人使用绑定凭证按需加载。请求中携带:

    Authorization: Bearer $ZGI_MARKET_KEY

  3. 读取清单与安装包

    清单列出版本、文件和校验值;安装包是一个 zip 文件。

    读取清单
    curl "https://market-api.zgi.im/v1/market/skills/godot-headless-verify/manifest" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY"
    下载安装包
    curl "https://market-api.zgi.im/v1/market/skills/godot-headless-verify/package" \
      -H "Authorization: Bearer $ZGI_MARKET_KEY" \
      -o godot-headless-verify.zip

    读取清单和下载安装包不计入用量。下载后请用响应头中的 SHA-256 校验文件。

技能说明

名称
godot-headless-verify
说明
Run Godot in headless mode to verify a project — quick load tests ("does this scene still instantiate?"), cache/UID cache repair ("editor shows red errors but game runs fine"), and batch resource operations. Use this skill when the user says things like "clear Godot cache", "editor shows referenced non-existent resource", "verify the project still loads", "run headless validation", "sanity-check after a refactor", or when they ask how to drive Godot from the command line without opening the UI.
仅指令

技能包内没有脚本文件:这个技能是供模型阅读的文本。

SKILL.md 节选

# Godot Headless Verify & Repair

> A pocket toolkit of **reproducible CLI recipes** for Godot 4 projects.
> Every recipe here is a copy-paste-ready one-liner (or short script) that
> exercises the engine without opening the editor. Use these instead of
> asking the user "can you open the editor and…" — that's slower and
> lossy.

---

## 0. The one-binary convention

Every recipe assumes you can reach Godot via either `$GODOT` env var or
its standard macOS location. Prefix every command with:

```bash
GODOT="${GODOT:-/Applications/Godot.app/Contents/MacOS/Godot}"
```

On Linux / Windows, set `$GODOT` to your binary. **Never** hard-code
`godot4` or `/opt/godot/...` in scripts — it breaks across machines.

---

## 1. Recipe: cache clean (safe)

**When**: editor shows `Cannot open file 'res://…'` or
`referenced non-existent resource` *even though the file exists*, typically
after a refactor / folder rename / branch swap.

**Why**: `.godot/imported/` and `.godot/uid_cache.bin` remember pre-move
paths. Godot doesn't self-heal until you force a rebuild.

```bash
# Requires: editor closed.
cd <project-root>

# Safe cache reset — preserves window layout + per-file folding state.
rm -rf .godot/imported \
       .godot/uid_cache.bin \
       .godot/global_script_class_cache.cfg \
       .godot/scene_groups_cache.cfg \
       .godot/editor/filesystem_cache* \
       .godot/editor/filesystem_update_* \
       .godot/editor/filesystem_update[0-9]*
# (zsh note: use `setopt NULL_GLOB` or run in bash if the * patterns
#  don't match anything and zsh complains)

# Rebuild cache headlessly (takes 30s-2min depending on project size).
"$GODOT" --headless --import --path .
```

**Keep these** (do NOT rm):
- `.godot/shader_cache/` — compiled shaders, expensive to rebuild
- `.godot/editor/*-folding-*.cfg` — per-file UI state
- `.godot/editor/editor_layout.cfg` — window layout

---

## 2. Recipe: scene-load smoke test

**When**: you just refactored something and want a 5-second "does it still
load?" answer before bothering with the full editor.

```bash
cat > /tmp/smoke.gd <<'EOF'
extends SceneTree

# Edit the paths you want to smoke-test:
const SCENES := [
    "res://scenes/boot/main.tscn",
    "res://scenes/levels/arena/arena.tscn",
    "res://scenes/levels/forest/forest.tscn",
]

func _initialize() -> void:
    var failed := 0
    for s in SCENES:
        var ps := load(s) as PackedScene
        if ps == null:
            push_error("FAIL load: %s" % s); failed += 1; continue
        var inst := ps.instantiate()
        if inst == null:
            push_error("FAIL instantiate: %s" % s); failed += 1; continue
        print("OK %s (children=%d)" % [s, inst.get_child_count()])
        inst.queue_free()
    quit(0 if failed == 0 else 1)
EOF

GODOT="${GODOT:-/Applications/Godot.app/Contents/MacOS/Godot}"
"$GODOT" --headless --path . --script /tmp/smoke.gd \
    2>&1 | grep -E 'ERROR|OK '

rm -f /tmp/smoke.gd
```

**Exit code** is 0 iff every scene loaded. Good for CI.

**Important**: `/tmp/smoke.gd` is outside the project, so Godot can't
resolve `res://` in its own script path. Always pass the full `/tmp/...`
filesystem path via `--script`. Don't put it inside `tools/` without the
matching `.uid` sidecar (pre-commit hook will otherwise complain).

---

## 3. Recipe: script-only parse check

**When**: you edited a bunch of `.gd` files and want to confirm they all
parse without opening the editor.

```bash
# --check-only runs the GDScript parser over all scripts the project
# touches; no scene is instantiated.
"$GODOT" --headless --quit --path . 2>&1 \
    | grep -iE 'SCRIPT ERROR|Parse Error' || echo "all scripts parse OK"
```

Note: `--quit` without a script exits after the engine's first idle frame,
which is enough to trigger script preloading.

---

## 4. Recipe: forced reimport of one folder

**When**: one specific asset got stuck with stale `.import` data but you
don't want a full project reimport.

```bash
# Delete just the .import files under the folder you care about.

SKILL.md 不止这些内容,安装后可阅读全文。

技能包内容

共 1 个文件,合计 8.9 KiB

  • SKILL.md8.9 KiB

来源与审核

审核状态
尚未审核,内容来自上游来源
许可证
未说明

审核状态是平台对上架信息的记录,不构成对上游服务质量或可用性的担保。