cli-anything-godot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Godot Engine CLI

Godot Engine CLI

Agent-native CLI for the Godot game engine. Manage projects, scenes, exports, and GDScript execution from the command line.
面向Godot游戏引擎的原生Agent CLI工具。可通过命令行管理项目、处理场景、执行导出操作及运行GDScript脚本。

Installation

安装

bash
pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=godot/agent-harness
bash
pip install git+https://github.com/HKUDS/CLI-Anything.git#subdirectory=godot/agent-harness

Requirements

要求

  • Godot 4.x on PATH (or set GODOT_BIN env var)
  • 系统PATH中需包含Godot 4.x(或设置GODOT_BIN环境变量)

Commands

命令

Project Management

项目管理

bash
undefined
bash
undefined

Create a new Godot project

创建新的Godot项目

cli-anything-godot project create <path> [--name "My Game"]
cli-anything-godot project create <path> [--name "My Game"]

Get project info (name, features, main scene)

获取项目信息(名称、特性、主场景)

cli-anything-godot --json -p <project> project info
cli-anything-godot --json -p <project> project info

List all scenes

列出所有场景

cli-anything-godot --json -p <project> project scenes
cli-anything-godot --json -p <project> project scenes

List all scripts

列出所有脚本

cli-anything-godot --json -p <project> project scripts
cli-anything-godot --json -p <project> project scripts

List all resources

列出所有资源

cli-anything-godot --json -p <project> project resources
cli-anything-godot --json -p <project> project resources

Re-import project resources

重新导入项目资源

cli-anything-godot -p <project> project reimport
undefined
cli-anything-godot -p <project> project reimport
undefined

Scene Operations

场景操作

bash
undefined
bash
undefined

Create a new scene with root node type

创建带有根节点类型的新场景

cli-anything-godot -p <project> scene create scenes/Level1.tscn --root-type Node3D
cli-anything-godot -p <project> scene create scenes/Level1.tscn --root-type Node3D

Read scene structure (nodes, resources, connections)

读取场景结构(节点、资源、连接关系)

cli-anything-godot --json -p <project> scene read scenes/Level1.tscn
cli-anything-godot --json -p <project> scene read scenes/Level1.tscn

Add a child node to a scene

向场景中添加子节点

cli-anything-godot -p <project> scene add-node scenes/Level1.tscn --name Player --type CharacterBody3D --parent .
undefined
cli-anything-godot -p <project> scene add-node scenes/Level1.tscn --name Player --type CharacterBody3D --parent .
undefined

GDScript Execution

GDScript执行

bash
undefined
bash
undefined

Run a GDScript file (must extend SceneTree)

运行GDScript文件(必须继承SceneTree)

cli-anything-godot -p <project> script run tools/build_navmesh.gd
cli-anything-godot -p <project> script run tools/build_navmesh.gd

Run inline GDScript code

运行内嵌GDScript代码

cli-anything-godot -p <project> script inline 'print(ProjectSettings.get_setting("application/config/name"))'
cli-anything-godot -p <project> script inline 'print(ProjectSettings.get_setting("application/config/name"))'

Validate GDScript syntax

验证GDScript语法

cli-anything-godot -p <project> script validate scripts/player.gd
undefined
cli-anything-godot -p <project> script validate scripts/player.gd
undefined

Export

导出

bash
undefined
bash
undefined

List configured export presets

列出已配置的导出预设

cli-anything-godot --json -p <project> export presets
cli-anything-godot --json -p <project> export presets

Export all presets

导出所有预设

cli-anything-godot -p <project> export build
cli-anything-godot -p <project> export build

Export a specific preset

导出指定预设

cli-anything-godot -p <project> export build --preset "Windows Desktop" --output build/game.exe
undefined
cli-anything-godot -p <project> export build --preset "Windows Desktop" --output build/game.exe
undefined

Engine

引擎

bash
undefined
bash
undefined

Check Godot availability and binary path

检查Godot可用性及二进制文件路径

cli-anything-godot --json engine status
cli-anything-godot --json engine status

Get engine version

获取引擎版本

cli-anything-godot engine version
undefined
cli-anything-godot engine version
undefined

JSON Mode

JSON模式

Add
--json
flag to any command for structured JSON output suitable for agent consumption:
bash
cli-anything-godot --json -p ./my-game project info
在任意命令后添加
--json
标志,即可获得适合Agent处理的结构化JSON输出:
bash
cli-anything-godot --json -p ./my-game project info

Interactive REPL

交互式REPL

bash
cli-anything-godot -p ./my-game session
bash
cli-anything-godot -p ./my-game session