@gamemaker/gm-cli

中文文档
2.4.1发布于 2026/09/28Apache-2.0ES Module零依赖近 30 天下载 4494

The GameMaker command-line interface GM-CLI is a helpful tool to edit, compile, package, and run your GameMaker projects.

原始使用文档
文档目录7 节
  1. Create new projects
  2. Compile, run, and package projects
  3. Edit projects without the IDE
  4. Signing-in
  5. Query the GameMaker Manual
  6. Publish to GX.Games
  7. Contributing

GameMaker CLI

The GameMaker command-line interface gm-cli is a helpful tool to edit, compile, package, and run your GameMaker projects.

Recording of the gm-cli run command

Usage

IMPORTANT: You must first install nodeJS which comes with the tools npm and npx.

Run:

npx @gamemaker/gm-cli@latest --help

...or if your prefer to install gm-cli globally

npm install -g @gamemaker/gm-cli@latest
gm-cli --help

GameMaker CLI has many commands, to learn more about them, use the --help flag. For example, to see how the compile command works, run:

npx @gamemaker/gm-cli@latest compile --help

Create new projects

Use gm-cli init to create a new project, either from a blank game or a template.

npx @gamemaker/gm-cli@latest init

If you wish, it will also help you setup more advanced feature like:

  • GitHub automation pipelines to compile and package your project
  • AI agent integration (AGENTS.md, MCP, Claude config)

Compile, run, and package projects

GameMaker CLI can automatically download the runtime and all other tools needed to compile and run your projects.

Try running one of these commands in a folder with a .yyp file:

npx @gamemaker/gm-cli@latest run
npx @gamemaker/gm-cli@latest compile
npx @gamemaker/gm-cli@latest package

Note that there are many options, like target, runtime and toolchain to configure if you wish. Use the --help flag for more details. For example:

npx @gamemaker/gm-cli@latest compile --runtime=vm --target=operagx [email protected]

Edit projects without the IDE

Use gm-cli resourcetool to programmatically make changes to your project files without having to use the IDE. Try it out inside a project:

gm-cli resourcetool eval "resource list"

There are many ways of using ResourceTool, the most convenient is with an AI agent using the Model Context Protocol gm-cli resourcetool mcp. But you can also use it yourself in interactive session gm-cli resourcetool repl or as a script.

Signing-in

GameMaker CLI automatically gives you a guest license, so there is no need to sign in. But if you prefer to use your own access key from https://gamemaker.io/en/account/access-keys. You may run:

npx @gamemaker/gm-cli@latest login <my key>

Query the GameMaker Manual

The command gm-cli manual can be used to semantically search GameMaker Manual. Use the open subcommand to open a a web page in your browser. You can also get results in a specific language through --language. Try it out:

gm-cli manual open "sprites" --language=es

The read subcommand displays an article directly in your terminal,

gm-cli manual read "data structures"

Publish to GX.Games

Use gm-cli gxgames to publish a game to gx.games. Run gm-cli gxgames --help for the full list of subcommands.

The flow:

  1. Package the game as an OperaGX zip:
    npx @gamemaker/gm-cli@latest package --target=operagx --output=game.zip
    
  2. Link the project to a studio and game (opens the browser to sign in on first use):
    npx @gamemaker/gm-cli@latest gxgames link --studioid=<id> --gameid=<id>
    
    Omit the flags to pick interactively.
  3. Upload the zip (prompts for a X.Y.Z.B version if --version is omitted):
    npx @gamemaker/gm-cli@latest gxgames upload --file=game.zip --version=1.0.0.0
    
  4. Set metadata required for publishing — title (must be unique across GX.Games), description, age rating, platforms, 16:9 cover, and 16:9 screenshot. Cover and graphic must have an exact 16:9 aspect ratio (e.g. 1920×1080):
    npx @gamemaker/gm-cli@latest gxgames meta \
      --title="My Game" \
      --description="A short description" \
      --age-rating=EVERYONE \
      --platforms=DESKTOP,MOBILE \
      --cover=cover_1920x1080.png \
      --graphic=screenshot_1920x1080.png
    
    Each flag overrides one field; omitted flags keep the current server value.
  5. Publish to make the game public (opens the published page on success):
    npx @gamemaker/gm-cli@latest gxgames publish
    

Contributing

The GameMaker CLI is made for the community and we welcome your feedback! Please suggest features or tell us about any issues you are having.

版本与发布记录

@gamemaker/gm-cli 共发布 16 个版本,首次发布于 2026/04/29;过去 12 个月发布了 16 个版本。

版本发布日期距今
2.4.1latest2026/09/281 个月前
2.4.02026/09/231 个月前
2.3.02026/08/172 个月前
2.2.02026/06/055 个月前
2.1.02026/06/035 个月前
2.0.02026/05/265 个月前

关于 @gamemaker/gm-cli 的常见问题

@gamemaker/gm-cli 是什么?

The GameMaker command-line interface GM-CLI is a helpful tool to edit, compile, package, and run your GameMaker projects.

如何安装 @gamemaker/gm-cli?

在项目目录运行 npm install @gamemaker/gm-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 gm-cli,可以用 npx gm-cli 直接运行。

@gamemaker/gm-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/gamemaker__gm-cli 是否存在。

@gamemaker/gm-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@gamemaker/gm-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@gamemaker/gm-cli 可以商用吗?

@gamemaker/gm-cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@gamemaker/gm-cli 的下载量有多少?

根据 npm 官方下载统计,@gamemaker/gm-cli 在 2026/10/16 – 2026/11/14 这 30 天内被下载 4,494 次,日均约 150 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@gamemaker/gm-cli 还在维护吗?

最新版本 2.4.1 发布于 2026/09/28(1 个月前);至今共发布 16 个版本,其中过去 12 个月发布了 16 个;首次发布于 2026/04/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。