From 9424e7235fc31b80b1b5411c4c056e1c23f855a7 Mon Sep 17 00:00:00 2001 From: Pau Torres Date: Thu, 5 Nov 2026 13:26:52 +0100 Subject: [PATCH 1/2] feat: add --resource-tool-version flag to pin ResourceTool gm-cli always ran @gm-tools/resource-tool-@latest. ResourceTool 2026.0.22 saves extensions with "$GMExtension":"v1" (plus fonts, notes and particles schema changes) as soon as it loads a project, which IDE LTS 2026.0.0.16 can no longer open. Users had no way to opt out. The new flag on all resourcetool subcommands (mcp, eval, repl, script) lets users pin a ResourceTool version that matches their IDE. The default stays "latest", so behaviour is unchanged unless the flag is passed. Refs #251 --- README.md | 2 ++ src/commands/resourcetool/command.ts | 7 +++++++ src/commands/resourcetool/impl.ts | 2 ++ src/resource-tool.ts | 5 ++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9ab1abb..f04b7a2 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,8 @@ Use `gm-cli resourcetool` to programmatically make changes to your project files 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](https://modelcontextprotocol.io/docs/getting-started/intro) `gm-cli resourcetool mcp`. But you can also use it yourself in interactive session `gm-cli resourcetool repl` or as a script. + +ResourceTool saves the project with its own resource record versions. If a newer ResourceTool upgrades files your IDE can no longer open, pin a version that matches your IDE with `--resource-tool-version`, for example `gm-cli resourcetool mcp --resource-tool-version=2026.0.17`. ### 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: ``` diff --git a/src/commands/resourcetool/command.ts b/src/commands/resourcetool/command.ts index 572cd40..870c662 100644 --- a/src/commands/resourcetool/command.ts +++ b/src/commands/resourcetool/command.ts @@ -31,6 +31,13 @@ const commonFlags = { brief: "GameMaker project config to use (default: 'Default')", optional: true as const, }, + resourceToolVersion: { + kind: "parsed" as const, + parse: String, + brief: + "ResourceTool version to use, e.g. 2026.0.17 (default: 'latest'). Pin it to match your IDE release", + optional: true as const, + }, }; const projectParam = { diff --git a/src/commands/resourcetool/impl.ts b/src/commands/resourcetool/impl.ts index 07d2326..40d3341 100644 --- a/src/commands/resourcetool/impl.ts +++ b/src/commands/resourcetool/impl.ts @@ -30,6 +30,7 @@ import { KnownError } from "~/error"; export interface CommonFlags { cacheDir?: string; config?: string; + resourceToolVersion?: string; } export async function run( @@ -85,5 +86,6 @@ export async function run( projectToolPath, prefabsFolder: await cache.getSubDirPath(ctx, "prefabs"), config: flags.config, + version: flags.resourceToolVersion, }); } diff --git a/src/resource-tool.ts b/src/resource-tool.ts index 4cb473a..79e8a73 100644 --- a/src/resource-tool.ts +++ b/src/resource-tool.ts @@ -32,6 +32,8 @@ export interface ResourceToolArgs { prefabsFolder?: string; config?: string; ignoreStdio?: boolean; + /** npm version or dist-tag of the ResourceTool package (default: "latest") */ + version?: string; } function splitCommand(input: string): string[] { @@ -80,6 +82,7 @@ export async function callResourceTool( prefabsFolder, config, ignoreStdio, + version = "latest", }: ResourceToolArgs, ): Promise { const command = modeToArgs(run); @@ -92,7 +95,7 @@ export async function callResourceTool( ...(config ? [`config=${config}`] : []), ]; const platformSuffix = getPlatformSuffix(ctx); - const packageName = `@gm-tools/resource-tool-${platformSuffix}@latest`; + const packageName = `@gm-tools/resource-tool-${platformSuffix}@${version}`; try { await npmExec(ctx, { packageName, From d64292e989c2c89e43b2ede0812ba421ed9a5ca7 Mon Sep 17 00:00:00 2001 From: Pau Torres Date: Thu, 5 Nov 2026 17:01:00 +0100 Subject: [PATCH 2/2] fix: only accept exact versions or dist-tags in --resource-tool-version On Windows npmExec runs npx through cmd.exe /c, and Node only quotes arguments containing spaces or quotes, so ranges like ">=2026.0.17" or "^2026.0" were mangled (">" redirects, "^" escapes). Reject anything that is not [A-Za-z0-9._-]+ at parse time with a clear error instead. --- src/commands/resourcetool/command.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/commands/resourcetool/command.ts b/src/commands/resourcetool/command.ts index 870c662..5de86a9 100644 --- a/src/commands/resourcetool/command.ts +++ b/src/commands/resourcetool/command.ts @@ -33,9 +33,18 @@ const commonFlags = { }, resourceToolVersion: { kind: "parsed" as const, - parse: String, + // Exact versions and dist-tags only: on Windows npx runs through cmd.exe, where ranges like + // ">=2026.0.17" or "^2026.0" are mangled (">" redirects, "^" escapes). + parse: (value: string) => { + if (!/^[A-Za-z0-9._-]+$/.test(value)) { + throw new Error( + `Expected an exact version or dist-tag (e.g. 2026.0.17 or latest), got '${value}'`, + ); + } + return value; + }, brief: - "ResourceTool version to use, e.g. 2026.0.17 (default: 'latest'). Pin it to match your IDE release", + "Exact ResourceTool version or dist-tag, e.g. 2026.0.17 (default: 'latest'). Pin it to match your IDE release", optional: true as const, }, };