本页由英文机器翻译而成。阅读英文原文。

gamedev CLI 参考

gamedev CLI 的每条命令与选项:交互模式与无头模式、pkg、remote、daemon、acp、image-runtime、update,以及终端中的斜杠命令。

更新于 2026年11月4日 查看 Markdown 版本

gamedev CLI 是终端中的 AI Game Dev 智能体:与桌面应用使用相同的账号、模型、包和引擎连接。本参考列出了 CLI 的每条命令与选项、你在其中输入的斜杠命令,以及它的退出码。使用 npm install -g @baizor/gamedev 安装(参见安装)。

用法一览

gamedev [<project-dir>] [options]          interactive terminal UI
gamedev --print "<prompt>"                 headless one-shot query, reply on stdout
gamedev --print -                          headless, prompt read from stdin
gamedev --headless                         headless, prompt read from stdin
gamedev update                             upgrade the CLI to the latest version
gamedev pkg <subcommand> [args]            manage packages, then exit
gamedev image-runtime [status|start]       the local image runtime
gamedev remote <subcommand> [args]         remote access and your other devices
gamedev daemon <subcommand>                the background service
gamedev --on <name|id-prefix>              the terminal UI on another computer's chats
gamedev acp [--model <model>]              Agent Client Protocol agent on stdin/stdout
gamedev --help | --version

选项

选项含义
<project-dir>项目文件夹(等同于 --project);相对路径基于当前目录解析
--project、-p <path>项目文件夹(默认:当前目录)
--cwd <path>--project 的别名
--model <model>要使用的模型(默认:你账号所分配的模型)
--resume、-r <id>恢复之前的会话
--print <prompt>非交互:发送提示词,将回复流式输出到 stdout,然后退出。- 表示从 stdin 读取
--headless强制非交互模式,从 stdin 读取提示词
--on <name>在另一台已配对电脑的会话上打开终端 UI
--help、-h显示帮助
--version、-v打印版本号

--project 和 --cwd 的优先级高于位置参数中的文件夹。

交互模式

在项目文件夹中运行 gamedev。输入请求并按 Enter。常用按键:

  • / 打开斜杠命令面板;方向键移动,Tab 补全命令名。
  • 回复正在流式输出时按 Esc 可中断。
  • Ctrl+C 退出(按两次确认)。
  • 在输入框中按住空格约三分之一秒即可说话(按住说话语音输入)。

没有终端时(管道输入),CLI 会退回到简单的行模式。

无头模式与脚本化

无头运行只在 stdout 打印回复;CLI 检测到的内容(例如“Unity project detected”)输出到 stderr。

gamedev --print "List every scene in this project"
echo "Summarise the open TODOs in Assets/Scripts" | gamedev --headless
gamedev --project ./MyGame --model <model-id> --print "Run the edit-mode tests"
退出码何时
0回复已完成
1查询、网络或智能体错误,或运行开始后按下 Ctrl+C
2未登录、提示词为空,或文件夹或参数不可用
130运行开始前按下 Ctrl+C;未发送任何内容
143SIGTERM;CLI 分离,已发送的提示词继续在后台服务中运行

gamedev pkg

管理当前目录(或 --cwd <path>)中项目的包。层级标志:--user(本机上的所有项目)、--project(提交到仓库,默认)、--local(仅本次检出)。

gamedev pkg list [--user]                      packages in effect (--user: the user level alone)
gamedev pkg add <input> [level]                <publisher.name>[@range] | github:<owner>/<repo>[@tag|#ref] | npm:<name> | file:<path> | URL | owner/repo | folder
gamedev pkg remove <id> [level]                delete the id's entry at that level
gamedev pkg exclude <id> [level]               turn the package off at that level
gamedev pkg include <id> [level]               undo exclude
gamedev pkg update [<id>] [--user]             newest compatible version within the declared range, now
gamedev pkg auto-update on|off <id>            this computer's auto-update preference for one package
gamedev pkg sync [--user]                      make locks and cache match the level files
gamedev pkg link <folder> [level]              use a local folder instead of the published version (default --local)
gamedev pkg unlink <id> [level]                stop using the local folder
gamedev pkg dev <folder> [level]               link, and rebuild on every source change until Ctrl+C
gamedev pkg settings <id> [<key> [<value>]]    read or write a package's settings (--unset clears a value)

当某个值被拒绝时,gamedev pkg settings 以代码 1 退出;用法错误时以 2 退出。link 和 dev 参见创建包。

gamedev image-runtime

gamedev image-runtime status [--json]    show this computer's local image runtime coordinator
gamedev image-runtime start [--json]     start it through the background service

模型本身在 CLI 内通过 /images 管理(见下文)。

gamedev remote

在登录同一账号的电脑与设备之间进行远程访问。交互式 CLI 中的 /remote 就是同一条命令。

gamedev remote status                         this computer and your other devices
gamedev remote pair                           show a pairing code and QR, then approve the device that enters it
gamedev remote join <device> <code>           pair with another computer
gamedev remote allow [<device>]               allow remote control here, or let a device control chats
gamedev remote allow <device> --services      let a device use this computer's shared models
gamedev remote block [<device>] [--services]  turn remote control off, or take a device's access away
gamedev remote share [on|off]                 share this computer's models with your other computers
gamedev remote share pause|resume             stop or resume accepting images from other computers
gamedev remote forget <device>                unpin a computer you paired with
gamedev remote revoke <device>                remove a device paired with this computer
gamedev remote rename <name>                  the name your other devices see

设备可以用名称或其 id 的开头表示。pair 会分别询问查看、控制和共享模型。随后 gamedev --on <device> 打开那台电脑的会话;/machine 列出或切换电脑,/machine this 返回本机。

gamedev daemon

桌面应用与 CLI 共享的后台服务。

gamedev daemon status       installed and running; the Kernel, account, remote access, logs
gamedev daemon install      run it as a per-user OS service that starts at login and restarts if it stops
gamedev daemon uninstall    remove the OS service
gamedev daemon start        start the background service
gamedev daemon stop         stop it
gamedev daemon restart      stop, then start
gamedev daemon logs [kernel|service|remote|auth] [--lines N] [--follow]

操作系统服务在 macOS 上是 LaunchAgent,在 Linux 上是 systemd 用户单元,在 Windows 上是登录时运行的任务计划程序任务;它不需要管理员权限。

gamedev acp

gamedev acp 将 CLI 变为一个 Agent Client Protocol 智能体,供 T3 Code、Zed 和 JetBrains IDE 等 ACP 客户端使用。由客户端启动它;协议消息使用 stdout,诊断信息输出到 stderr。在客户端中添加一个自定义智能体,命令为 gamedev,参数为 acp。它使用本机的登录状态、你账号的模型以及项目的引擎工具。博文在 T3 Code 中将 AI Game Dev 用作 ACP 智能体详细介绍了配置过程。

斜杠命令

在交互式 CLI 中输入这些命令。许多命令在桌面聊天中同样可用。

聊天与会话

命令作用
/help列出可用命令
/clear开始一个新对话
/reset重置当前会话
/reopen从已保存的历史中重新打开丢失的聊天(不会重新发送任何内容)
/saved恢复已保存的消息、设置、图片以及文件或 Git 更改
/model选择模型(Tab:推理强度)
/agent列出智能体;/agent use <id> 切换,/agent refresh 重新加载列表
/skills列出此项目中可用的技能
/context切换上下文调试面板
/exit退出(也可用 /quit)

账号、设置与更新

命令作用
/login [--switch]登录;--switch 更换本机的账号
/logout退出登录
/config设置,包括本次会话的 Tools
/permissions查看或更改 AI 在运行工具前何时向你询问
/voice-language设置语音转写语言
/update [now]如何升级 CLI;now 会更新处于等待状态的后台服务
/remote、/machine远程访问;列出或切换计算机

引擎与项目

命令作用
/install-plugin [path]将 MCP 插件安装到当前的 Unity、Godot 或 Unreal 项目中
/install-extension浏览并安装引擎扩展
/open打开当前项目的编辑器
/create-project创建新的游戏项目,例如 /create-project unity MyGame(引擎为 unity、godot 或 unreal,一个名称,可选的父文件夹)
/file创建、重命名、移动、复制或删除项目文件
/files [n]列出本次对话中提到的文件;打开其中一个
/search、/replace搜索项目;保存、应用和恢复 Search Replace
/git状态、暂存、提交、丢弃、拉取、推送、强制推送和初始化

扩展、包与模型

命令作用
/packages与 gamedev pkg 相同的子命令,另加 views、tree <view id>、runs、cancel 和 reload
/mcp管理项目的 MCP 服务器:添加、启用、移除、测试
/plugin管理 Claude 插件与市场:安装、启用、更新
/images本地图像模型、下载与存储(/images help)
/image [n]列出本次会话的图像;打开或移除其中一个
/models运行媒体模型的所有方式,本地与云端;可加 image、video、audio 或 3d(/models help)
/cloud本次会话的 Cloud 生成设置:ask、budget <percent> 或 off
/blender、/supercollider、/kbBlender、Music 和知识库包的命令

已安装的包可以添加更多斜杠命令;它们会出现在 / 面板中。

/images 子命令

/images                               this computer, the runtime, storage and every image model
/images download <model> [--yes]      download a model (and the runtime when missing); asks first
/images cancel|resume <model|runtime> stop or continue a download
/images update <model> [--yes]        download a model's update
/images delete <model> [--yes]        delete a model's files from this computer
/images allow|block <model> [--user|--project]   whether the agent may use it
/images default <model|auto>          the default image model (auto = recommended for this computer)
/images stop [session|<job id>]       stop image generation and free the GPU
/images free-space [--yes]            delete model files no model uses any more
/images storage [<new folder>]        show or move the model storage folder
/images redetect                      detect the GPU, memory and driver again
/images reinstall                     set the image runtime up again

环境变量

变量用途
AI_GAME_DEV_MODEL覆盖默认模型
AI_GAME_DEV_ASCII_GLYPHS对于无法正确测量 emoji 宽度的终端,1 会强制在 /model 选择器中使用 ASCII 进度条

配置优先级:命令行选项,其次是环境变量,最后是 ~/.ai-game-dev/config.json。