godot-cli 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -1
- package/README.md +8 -4
- package/dist/commands/close.js +3 -2
- package/dist/commands/close.js.map +1 -1
- package/dist/commands/open.js +5 -6
- package/dist/commands/open.js.map +1 -1
- package/dist/lib/exec.d.ts +7 -3
- package/dist/lib/exec.js +6 -2
- package/dist/lib/exec.js.map +1 -1
- package/dist/lib/session.d.ts +14 -13
- package/dist/lib/session.js +73 -83
- package/dist/lib/session.js.map +1 -1
- package/dist/lib.d.ts +2 -2
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/utils/addon-deps.d.ts +26 -0
- package/dist/utils/addon-deps.js +27 -6
- package/dist/utils/addon-deps.js.map +1 -1
- package/dist/utils/addon-nuget-deps.d.ts +8 -3
- package/dist/utils/addon-nuget-deps.js +15 -8
- package/dist/utils/addon-nuget-deps.js.map +1 -1
- package/dist/utils/csproj-deps.d.ts +2 -1
- package/dist/utils/csproj-deps.js +59 -13
- package/dist/utils/csproj-deps.js.map +1 -1
- package/dist/utils/machine-store.js +2 -22
- package/dist/utils/machine-store.js.map +1 -1
- package/dist/utils/server-source.d.ts +1 -1
- package/dist/utils/server-source.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,35 @@ All notable changes to `godot-cli` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
- **In-game `script-execute` opt-in.** `install-plugin` writes Code-Exec, its Roslyn adapter and
|
|
8
|
+
`Microsoft.CodeAnalysis.CSharp` with `'$(GodotMcpCodeExecInGame)' == 'true' or (<editor-only condition>)`, so a game
|
|
9
|
+
that sets `GodotMcpCodeExecInGame=true` keeps them in its exports (RQL stays editor-only). Entries an older
|
|
10
|
+
version wrote with the editor-only condition are upgraded; a `Condition` the project set is kept. The addon marks
|
|
11
|
+
those packages `inGameOptIn` in `nuget-deps.json` (an older `godot-cli` ignores the flag and writes them
|
|
12
|
+
editor-only; with `--source` it reads the new csproj condition as none and writes them unconditioned, so use
|
|
13
|
+
this version for `--source` installs). A newer Roslyn the project pins keeps its version but moves between the
|
|
14
|
+
two canonical conditions too.
|
|
15
|
+
- **McpPlugin 8.11.0; `exec` waits for the server's tool timeout.** `install-plugin` pins `com.IvanMurzak.McpPlugin`
|
|
16
|
+
8.11.0 (fallback for addons without `nuget-deps.json`). The addon starts its local server with
|
|
17
|
+
`tool-timeout=300000` (on a server built on McpPlugin 8.11.0+ a call is sent to the editor once and may run
|
|
18
|
+
5 minutes; `plugin-timeout` is only the connection timeout), so `exec`'s default `--timeout` goes from 180000 to
|
|
19
|
+
310000 ms and a slow call ends with the server's timeout error rather than a client abort. Older servers ignore
|
|
20
|
+
`tool-timeout` and still give up after about 110 s.
|
|
21
|
+
- **No Roslyn in exported games.** `install-plugin` writes the addon's editor-only packages (RQL, Code-Exec, Roslyn)
|
|
22
|
+
with a Condition that leaves them out of Godot's export builds, and adds it to entries an older version wrote (a
|
|
23
|
+
`Condition` the project set is kept). The installed addon says which packages are editor-only (`editorOnly` in
|
|
24
|
+
`nuget-deps.json`); an older addon marks none.
|
|
25
|
+
- **Editor sessions on `@baizor/gamedev-cli-core` 0.7.1.** The pre-launch C# build of `exec` / `open --headless`
|
|
26
|
+
runs in the session's `beforeLaunch` hook, under its heartbeated startup lock and only when the call starts the
|
|
27
|
+
editor: parallel cold calls build once (the CLI's own `.ai-game-dev/build.lock` is gone). The lease records the
|
|
28
|
+
server URL and connection mode; while cli-core verifies that lease live (same host, pid and process start time),
|
|
29
|
+
`exec` / `open --headless` talk to that server whatever `--url` / `GODOT_MCP_HOST` say (a crashed editor's lease
|
|
30
|
+
is never followed), and `close --owned-only` / a windowed `open` send `session-close` there with the lease's nonce
|
|
31
|
+
(`close --url` is now a hidden fallback for a lease written by 0.30.0). A user's editor that does not answer is
|
|
32
|
+
reported after the session's own `foreign` wait (now 60 s, as in unity-mcp-cli). An editor started by another
|
|
33
|
+
call that does not answer is no longer stopped (that call may still wait for it). The session files are listed
|
|
34
|
+
in `.ai-game-dev/.gitignore`. Library: `createGodotSession` and the `GodotSession` type are exported;
|
|
35
|
+
`GodotSession.probe` is removed (the session probes itself).
|
|
7
36
|
- **`exec`: run C# in the editor.** `godot-cli exec '<code>'` (or `-f <file>` / stdin, repeatable `--using` /
|
|
8
37
|
`--include`) calls the addon's new `script-execute` tool. A running editor of the project is reused; otherwise the
|
|
9
38
|
C# assembly is built and a **headless** editor starts (`--window` for a GUI one) on the project's local server,
|
|
@@ -16,7 +45,7 @@ All notable changes to `godot-cli` are documented in this file.
|
|
|
16
45
|
the CLI started, through the plugin's `session-close` system tool (a windowless editor gets no WM_CLOSE).
|
|
17
46
|
- `install-plugin` keeps a newer third-party package the project already pins (e.g. its own Roslyn) instead of
|
|
18
47
|
downgrading it to the addon's pin; `com.IvanMurzak.*` pins are still reconciled exactly.
|
|
19
|
-
- `install-plugin` writes the addon's three new NuGet pins (`com.IvanMurzak.CodeExec` and `.Roslyn` 0.2.
|
|
48
|
+
- `install-plugin` writes the addon's three new NuGet pins (`com.IvanMurzak.CodeExec` and `.Roslyn` 0.2.1,
|
|
20
49
|
`Microsoft.CodeAnalysis.CSharp` 4.12.0); `setup-skills` lists `script-execute` and the `session` family.
|
|
21
50
|
|
|
22
51
|
- **Extension catalog: the extensions are RQL modules.** The `EXTENSIONS_CATALOG` mirror follows the shared
|
package/README.md
CHANGED
|
@@ -185,16 +185,20 @@ at the snippet's line (`snippet.cs(2,12)`) and exits 1.
|
|
|
185
185
|
- **None running:** the C# assembly is built, then a **headless** editor starts (`--headless --editor --path`, or a
|
|
186
186
|
window with `--window`) connected to the project's local server (`http://localhost:<derived port>`, or `--url`),
|
|
187
187
|
which its plugin starts itself. A headless one quits after `--idle <seconds>` (default 300, `0` = never) without
|
|
188
|
-
tool calls, saving the open scenes that have a file (a windowed one stays open). Parallel calls
|
|
189
|
-
a user's editor whose local server does not answer is waited for
|
|
188
|
+
tool calls, saving the open scenes that have a file (a windowed one stays open). Parallel calls build once and
|
|
189
|
+
start one editor; a user's editor whose local server does not answer is waited for up to 60 s, then reported.
|
|
190
190
|
- `open --headless [--idle-timeout <s>]` starts the same session without running code; `close --owned-only` saves
|
|
191
191
|
and quits it (through the plugin's `session-close` tool — never a user's editor).
|
|
192
192
|
|
|
193
193
|
Sessions use [`@baizor/gamedev-cli-core`](https://www.npmjs.com/package/@baizor/gamedev-cli-core) `EditorSession`:
|
|
194
194
|
the lease `<project>/.ai-game-dev/session.json` marks an editor as started by the CLI (only such an editor is ever
|
|
195
|
-
closed)
|
|
195
|
+
closed) and records the server it runs on: while that editor provably lives, later `exec` / `open` / `close` calls
|
|
196
|
+
use that server, whatever `--url` says.
|
|
197
|
+
`<project>/.ai-game-dev/session.lock` makes concurrent calls start one editor: the C# build runs under it, only in the
|
|
198
|
+
call that starts the editor. Both files are listed in `<project>/.ai-game-dev/.gitignore`. The editor receives
|
|
196
199
|
`AIGD_SESSION_IDLE_SECONDS`, `AIGD_SESSION_OWNER=cli` and `AIGD_SESSION_NONCE`, plus `GODOT_MCP_CONNECTION_MODE=Custom`,
|
|
197
|
-
`GODOT_MCP_HOST` and `GODOT_MCP_START_SERVER=true`. Options: `--ready-timeout <ms>`, `--timeout <ms>` (tool call
|
|
200
|
+
`GODOT_MCP_HOST` and `GODOT_MCP_START_SERVER=true`. Options: `--ready-timeout <ms>`, `--timeout <ms>` (tool call, default 310000: just over the
|
|
201
|
+
server's 5-minute `tool-timeout`),
|
|
198
202
|
`--no-build`, `--editor-path`, `--token`, `--raw`.
|
|
199
203
|
|
|
200
204
|
## `login`
|
package/dist/commands/close.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import { platform as nodePlatform } from 'os';
|
|
@@ -53,7 +53,8 @@ export const closeCommand = new Command('close')
|
|
|
53
53
|
.option('--timeout <seconds>', `Polite-quit timeout in seconds (default: ${DEFAULT_TIMEOUT_SECONDS})`, String(DEFAULT_TIMEOUT_SECONDS))
|
|
54
54
|
.option('--force', 'Hard-kill the editor if it does not exit within --timeout')
|
|
55
55
|
.option('--owned-only', 'Close only an editor started by godot-cli (exec / open --headless); never a user editor')
|
|
56
|
-
|
|
56
|
+
// Hidden fallback: a lease written by godot-cli 0.30.0 (cli-core 0.7.0) does not record the editor's server.
|
|
57
|
+
.addOption(new Option('--url <url>', 'With --owned-only: the local MCP server of that editor, for a lease without one').hideHelp())
|
|
57
58
|
.option('--token <token>', 'With --owned-only: bearer token (default: GODOT_MCP_TOKEN)')
|
|
58
59
|
.action(async (positionalPath, options) => {
|
|
59
60
|
const projectPath = resolveCloseProjectPath(positionalPath, process.cwd());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,WAAW,GAEZ,MAAM,4B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GAAG,4BAA4B,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC;YAC7I,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
|
package/dist/commands/open.js
CHANGED
|
@@ -5,7 +5,6 @@ import { verbose } from '../utils/ui.js';
|
|
|
5
5
|
import { openProject, resolveProjectPath as libResolveProjectPath, isGodotProjectDir as libIsGodotProjectDir, } from '../lib/open.js';
|
|
6
6
|
import { resolveOpenAuthToken, resolveSessionConnection } from '../utils/connection.js';
|
|
7
7
|
import { createGodotSession, ensureEditor } from '../lib/session.js';
|
|
8
|
-
import { isLocalhostUrl } from '../utils/project-marker.js';
|
|
9
8
|
import { parsePositiveIntFlag } from '../utils/input.js';
|
|
10
9
|
import { DEFAULT_SESSION_IDLE_SECONDS, DEFAULT_SESSION_READY_TIMEOUT_MS } from '@baizor/gamedev-cli-core';
|
|
11
10
|
/**
|
|
@@ -70,11 +69,11 @@ export const openCommand = new Command('open')
|
|
|
70
69
|
await openHeadless(projectPath, options);
|
|
71
70
|
return;
|
|
72
71
|
}
|
|
73
|
-
// A headless editor this CLI started holds the project: close it so the windowed one can open
|
|
74
|
-
|
|
72
|
+
// A headless editor this CLI started holds the project: close it so the windowed one can open (its lease
|
|
73
|
+
// names the server it runs on, so `--url` — this open's connection, possibly remote — is not needed here).
|
|
75
74
|
let prepared;
|
|
76
75
|
try {
|
|
77
|
-
prepared = await createGodotSession({ projectPath, ...resolveSessionConnection({
|
|
76
|
+
prepared = await createGodotSession({ projectPath, ...resolveSessionConnection({ token: options.token }) }).session.prepareWindowOpen();
|
|
78
77
|
}
|
|
79
78
|
catch (err) {
|
|
80
79
|
ui.error(err instanceof Error ? err.message : String(err));
|
|
@@ -204,10 +203,10 @@ async function openHeadless(projectPath, options) {
|
|
|
204
203
|
ui.error(result.message);
|
|
205
204
|
process.exit(1);
|
|
206
205
|
}
|
|
207
|
-
const { ensured
|
|
206
|
+
const { ensured } = result;
|
|
208
207
|
const pid = ensured.lease?.pid;
|
|
209
208
|
const what = ensured.source === 'started' ? 'Started a headless Godot editor' : 'A Godot editor is already running for this project';
|
|
210
|
-
spinner.success(`${what}${pid !== undefined ? ` (PID ${pid})` : ''}; MCP server ready at ${
|
|
209
|
+
spinner.success(`${what}${pid !== undefined ? ` (PID ${pid})` : ''}; MCP server ready at ${ensured.ready}`);
|
|
211
210
|
if (ensured.source === 'started' && idleSeconds > 0)
|
|
212
211
|
ui.info(`It quits after ${idleSeconds}s without tool calls.`);
|
|
213
212
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/commands/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,WAAW,EACX,kBAAkB,IAAI,qBAAqB,EAC3C,iBAAiB,IAAI,oBAAoB,GAC1C,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/commands/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,WAAW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C;QAC9B,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC;QACtH,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC3B,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;IAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,iCAAiC,CAAC,CAAC,CAAC,oDAAoD,CAAC;IACrI,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,yBAAyB,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5G,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,GAAG,CAAC;QAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,WAAW,uBAAuB,CAAC,CAAC;AACrH,CAAC"}
|
package/dist/lib/exec.d.ts
CHANGED
|
@@ -2,8 +2,12 @@ import type { EnsureResult } from '@baizor/gamedev-cli-core';
|
|
|
2
2
|
import { type EnsureEditorDeps, type EnsureEditorOptions, type EnsureEditorResult } from './session.js';
|
|
3
3
|
import type { RunToolFailure, RunToolOptions, RunToolResult } from './types.js';
|
|
4
4
|
export declare const SCRIPT_EXECUTE_TOOL = "script-execute";
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Default `script-execute` call timeout. Longer than the server `tool-timeout` the addon passes
|
|
7
|
+
* (`GodotMcpServerView.ToolTimeoutMs`, parity-tested), so a call the server gives up on returns the server's
|
|
8
|
+
* timeout error instead of a client abort.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_EXEC_TIMEOUT_MS = 310000;
|
|
7
11
|
/** Injection points for tests. */
|
|
8
12
|
export interface ExecDeps extends EnsureEditorDeps {
|
|
9
13
|
invoke: (options: RunToolOptions) => Promise<RunToolResult>;
|
|
@@ -12,7 +16,7 @@ export interface ExecCodeOptions extends EnsureEditorOptions {
|
|
|
12
16
|
code: string;
|
|
13
17
|
usings?: string[];
|
|
14
18
|
include?: string[];
|
|
15
|
-
/** Tool call timeout. Default
|
|
19
|
+
/** Tool call timeout. Default {@link DEFAULT_EXEC_TIMEOUT_MS}. */
|
|
16
20
|
timeoutMs?: number;
|
|
17
21
|
deps?: Partial<ExecDeps>;
|
|
18
22
|
}
|
package/dist/lib/exec.js
CHANGED
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
import { runTool } from './run-tool.js';
|
|
4
4
|
import { ensureEditor } from './session.js';
|
|
5
5
|
export const SCRIPT_EXECUTE_TOOL = 'script-execute';
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Default `script-execute` call timeout. Longer than the server `tool-timeout` the addon passes
|
|
8
|
+
* (`GodotMcpServerView.ToolTimeoutMs`, parity-tested), so a call the server gives up on returns the server's
|
|
9
|
+
* timeout error instead of a client abort.
|
|
10
|
+
*/
|
|
11
|
+
export const DEFAULT_EXEC_TIMEOUT_MS = 310000;
|
|
8
12
|
/**
|
|
9
13
|
* Run C# in the project's editor. A running editor (GUI or headless) is reused and never closed; otherwise one is
|
|
10
14
|
* started headless (or windowed) on the project's local server that quits by itself after `idleSeconds` without
|
package/dist/lib/exec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/lib/exec.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,8FAA8F;AAG9F,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,YAAY,EAA4E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,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;YACvI,CAAC,CAAC,IAAI,CAAC;QACT,IAAI,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,IAAI,QAAQ,KAAK,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC5H,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,IAAI,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvG,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AACtE,CAAC"}
|
package/dist/lib/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditorSession, type EngineAdapter, type EnsureResult, type SessionProcessOps } from '@baizor/gamedev-cli-core';
|
|
1
|
+
import { EditorSession, type EditorSessionOptions, type EngineAdapter, type EnsureResult, type SessionProcessOps } from '@baizor/gamedev-cli-core';
|
|
2
2
|
import type { BuildProjectResult } from './types.js';
|
|
3
3
|
/** The plugin's system tool that saves and quits a CLI-started editor (a windowless one gets no WM_CLOSE). */
|
|
4
4
|
export declare const SESSION_CLOSE_TOOL = "session-close";
|
|
@@ -7,6 +7,7 @@ export interface GodotSessionOptions {
|
|
|
7
7
|
/**
|
|
8
8
|
* The server the editor's plugin connects to and the session probes. Default: the project's local port
|
|
9
9
|
* (`http://localhost:<derived>`). A non-loopback URL is rejected: headless sessions are local only.
|
|
10
|
+
* {@link ensureEditor} prefers the server of a verified live CLI editor of the project (its lease).
|
|
10
11
|
*/
|
|
11
12
|
url?: string;
|
|
12
13
|
/** Bearer token: the started editor uses it (auth Required) and every probe / call sends it. */
|
|
@@ -17,14 +18,14 @@ export interface GodotSessionOptions {
|
|
|
17
18
|
idleSeconds?: number;
|
|
18
19
|
/** How long to wait for a started editor's MCP server. Default 300000. */
|
|
19
20
|
readyTimeoutMs?: number;
|
|
21
|
+
/** Runs under the session's startup lock right before it starts an editor (the C# build). */
|
|
22
|
+
beforeLaunch?: EditorSessionOptions<string>['beforeLaunch'];
|
|
20
23
|
onStatus?: (message: string) => void;
|
|
21
24
|
/** Tests: OS process primitives. */
|
|
22
25
|
processOps?: Partial<SessionProcessOps>;
|
|
23
26
|
}
|
|
24
27
|
export interface GodotSession {
|
|
25
28
|
session: EditorSession<string>;
|
|
26
|
-
/** One readiness check of the local server (the session's warm-path probe): the URL, or undefined. */
|
|
27
|
-
probe: () => Promise<string | undefined>;
|
|
28
29
|
/** The local server URL the session probes and a started editor binds. */
|
|
29
30
|
url: string;
|
|
30
31
|
}
|
|
@@ -33,22 +34,20 @@ export interface GodotSession {
|
|
|
33
34
|
* (there is no dock button to press in a headless editor), and the token when one is given.
|
|
34
35
|
*/
|
|
35
36
|
export declare function sessionEditorEnv(url: string, token: string | undefined): Record<string, string>;
|
|
36
|
-
/** The Godot adapter with the CLI's hooks: running-editor detection and the plugin-side graceful close. */
|
|
37
|
-
export declare function godotSessionAdapter(url: string, token: string | undefined, readNonce: () => string | undefined): EngineAdapter;
|
|
38
|
-
/** Build the session of a Godot project. Throws when `url` is not local. */
|
|
39
|
-
export declare function createGodotSession(options: GodotSessionOptions): GodotSession;
|
|
40
37
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
38
|
+
* The Godot adapter with the CLI's hooks: running-editor detection (its pid, so the session notices when it exits)
|
|
39
|
+
* and the plugin-side graceful close through the verified lease (its nonce, and the server it was started on;
|
|
40
|
+
* `url` serves a lease written before cli-core 0.7.1, which has no `serverUrl`).
|
|
44
41
|
*/
|
|
45
|
-
export declare function
|
|
42
|
+
export declare function godotSessionAdapter(url: string, token: string | undefined): EngineAdapter;
|
|
43
|
+
/** Build the session of a Godot project. Throws when `url` is not local. */
|
|
44
|
+
export declare function createGodotSession(options: GodotSessionOptions): GodotSession;
|
|
46
45
|
/** Injection points for tests. */
|
|
47
46
|
export interface EnsureEditorDeps {
|
|
48
47
|
ensure: (session: EditorSession<string>, mode: 'headless' | 'window') => Promise<EnsureResult<string>>;
|
|
49
48
|
build: (projectPath: string) => Promise<BuildProjectResult>;
|
|
50
49
|
}
|
|
51
|
-
export interface EnsureEditorOptions extends GodotSessionOptions {
|
|
50
|
+
export interface EnsureEditorOptions extends Omit<GodotSessionOptions, 'beforeLaunch'> {
|
|
52
51
|
/** Start the editor with a window instead of headless (only when none is running yet). */
|
|
53
52
|
window?: boolean;
|
|
54
53
|
/** Build the C# assembly before starting an editor. Default true. */
|
|
@@ -73,6 +72,8 @@ export type EnsureEditorResult = {
|
|
|
73
72
|
};
|
|
74
73
|
/**
|
|
75
74
|
* A ready editor of the project (the `exec` / `open --headless` policy): reuse a running one, otherwise build the
|
|
76
|
-
* C# assembly and start
|
|
75
|
+
* C# assembly (Godot does not build it in a headless editor, and a missing assembly disables the addon) and start
|
|
76
|
+
* ours. The build runs under the session's startup lock, only when this call starts the editor: parallel cold calls
|
|
77
|
+
* build once and join that editor.
|
|
77
78
|
*/
|
|
78
79
|
export declare function ensureEditor(options: EnsureEditorOptions): Promise<EnsureEditorResult>;
|
package/dist/lib/session.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Godot editor sessions on the shared cli-core EditorSession (Code-Exec plan §4.6): reuse any running editor of
|
|
2
2
|
// the project, otherwise start our own (headless by default) connected to the project's LOCAL MCP server, with a
|
|
3
3
|
// lease so only our own editor is ever closed. Library-safe: no console output, no `process.exit`.
|
|
4
|
-
import * as fs from 'fs';
|
|
5
|
-
import * as os from 'os';
|
|
6
4
|
import * as path from 'path';
|
|
7
|
-
import {
|
|
5
|
+
import { EditorSession, EditorSessionError, godotAdapter, mcpReadinessProbe, } from '@baizor/gamedev-cli-core';
|
|
8
6
|
import { buildProject } from './build.js';
|
|
9
7
|
import { runSystemTool } from './run-tool.js';
|
|
10
8
|
import { findGodotBinary } from '../utils/godot-editor.js';
|
|
@@ -13,38 +11,41 @@ import { isLocalhostUrl } from '../utils/project-marker.js';
|
|
|
13
11
|
import { ENV_AUTH_OPTION, ENV_CONNECTION_MODE, ENV_HOST, ENV_START_SERVER, ENV_TOKEN, localProjectUrl, } from '../utils/connection.js';
|
|
14
12
|
/** The plugin's system tool that saves and quits a CLI-started editor (a windowless one gets no WM_CLOSE). */
|
|
15
13
|
export const SESSION_CLOSE_TOOL = 'session-close';
|
|
16
|
-
/** Serializes the pre-start C# build of a project (beside the session lock). */
|
|
17
|
-
const BUILD_LOCK_FILE_NAME = 'build.lock';
|
|
18
14
|
/** How long to wait for a user's own editor whose local server does not answer yet (it may still be loading). */
|
|
19
|
-
const FOREIGN_READY_TIMEOUT_MS =
|
|
15
|
+
const FOREIGN_READY_TIMEOUT_MS = 60000;
|
|
16
|
+
/** The connection mode of an editor the session starts (a local server), in its env and its lease. */
|
|
17
|
+
const SESSION_CONNECTION_MODE = 'Custom';
|
|
20
18
|
/**
|
|
21
19
|
* Environment of an editor the session starts: Custom mode on the local URL, the plugin starts the local server
|
|
22
20
|
* (there is no dock button to press in a headless editor), and the token when one is given.
|
|
23
21
|
*/
|
|
24
22
|
export function sessionEditorEnv(url, token) {
|
|
25
23
|
return {
|
|
26
|
-
[ENV_CONNECTION_MODE]:
|
|
24
|
+
[ENV_CONNECTION_MODE]: SESSION_CONNECTION_MODE,
|
|
27
25
|
[ENV_HOST]: url,
|
|
28
26
|
[ENV_START_SERVER]: 'true',
|
|
29
27
|
...(token ? { [ENV_TOKEN]: token, [ENV_AUTH_OPTION]: 'Required' } : {}),
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
|
-
/**
|
|
33
|
-
|
|
30
|
+
/**
|
|
31
|
+
* The Godot adapter with the CLI's hooks: running-editor detection (its pid, so the session notices when it exits)
|
|
32
|
+
* and the plugin-side graceful close through the verified lease (its nonce, and the server it was started on;
|
|
33
|
+
* `url` serves a lease written before cli-core 0.7.1, which has no `serverUrl`).
|
|
34
|
+
*/
|
|
35
|
+
export function godotSessionAdapter(url, token) {
|
|
34
36
|
return {
|
|
35
37
|
...godotAdapter,
|
|
36
38
|
editor: {
|
|
37
39
|
...godotAdapter.editor,
|
|
38
|
-
findRunningEditor: async (projectRoot) => findGodotProcess(projectRoot)
|
|
39
|
-
requestClose: async () => {
|
|
40
|
-
|
|
41
|
-
if (nonce === undefined)
|
|
40
|
+
findRunningEditor: async (projectRoot) => findGodotProcess(projectRoot)?.pid ?? false,
|
|
41
|
+
requestClose: async (_pid, _projectRoot, lease) => {
|
|
42
|
+
if (lease === undefined)
|
|
42
43
|
return false;
|
|
43
44
|
const result = await runSystemTool({
|
|
44
45
|
toolName: SESSION_CLOSE_TOOL,
|
|
45
|
-
url,
|
|
46
|
+
url: lease.serverUrl ?? url,
|
|
46
47
|
...(token ? { token } : {}),
|
|
47
|
-
input: { nonce },
|
|
48
|
+
input: { nonce: lease.nonce },
|
|
48
49
|
timeoutMs: 15000,
|
|
49
50
|
});
|
|
50
51
|
// A refusing tool (wrong nonce, an addon without session-close) answers 200 with status "error".
|
|
@@ -53,19 +54,20 @@ export function godotSessionAdapter(url, token, readNonce) {
|
|
|
53
54
|
},
|
|
54
55
|
};
|
|
55
56
|
}
|
|
57
|
+
function normalizeUrl(url) {
|
|
58
|
+
return url.replace(/\/+$/, '');
|
|
59
|
+
}
|
|
56
60
|
/** Build the session of a Godot project. Throws when `url` is not local. */
|
|
57
61
|
export function createGodotSession(options) {
|
|
58
62
|
const projectRoot = path.resolve(options.projectPath);
|
|
59
|
-
const url = (options.url ?? localProjectUrl(projectRoot))
|
|
63
|
+
const url = normalizeUrl(options.url ?? localProjectUrl(projectRoot));
|
|
60
64
|
if (!isLocalhostUrl(url)) {
|
|
61
65
|
throw new Error(`editor sessions connect to a local server only; ${url} is not on this machine`);
|
|
62
66
|
}
|
|
63
|
-
const probe = mcpReadinessProbe({ urls: [url], ...(options.token ? { token: options.token } : {}) });
|
|
64
67
|
const session = new EditorSession({
|
|
65
|
-
|
|
66
|
-
adapter: godotSessionAdapter(url, options.token, () => session.readLease()?.nonce),
|
|
68
|
+
adapter: godotSessionAdapter(url, options.token),
|
|
67
69
|
projectRoot,
|
|
68
|
-
probeReady:
|
|
70
|
+
probeReady: mcpReadinessProbe({ urls: [url], ...(options.token ? { token: options.token } : {}) }),
|
|
69
71
|
editorBinary: () => {
|
|
70
72
|
const binary = findGodotBinary(options.editorPath);
|
|
71
73
|
if (!binary)
|
|
@@ -73,106 +75,94 @@ export function createGodotSession(options) {
|
|
|
73
75
|
return binary;
|
|
74
76
|
},
|
|
75
77
|
env: sessionEditorEnv(url, options.token),
|
|
78
|
+
// The resolved, normalised connection the started editor gets (env above), recorded in the lease.
|
|
79
|
+
serverUrl: url,
|
|
80
|
+
connectionMode: SESSION_CONNECTION_MODE,
|
|
81
|
+
// The user's editor without a reachable local server: it may still be loading, but do not wait the full start budget.
|
|
82
|
+
foreignReadyTimeoutMs: Math.min(options.readyTimeoutMs ?? FOREIGN_READY_TIMEOUT_MS, FOREIGN_READY_TIMEOUT_MS),
|
|
83
|
+
...(options.beforeLaunch ? { beforeLaunch: options.beforeLaunch } : {}),
|
|
76
84
|
...(options.idleSeconds !== undefined ? { idleSeconds: options.idleSeconds } : {}),
|
|
77
85
|
...(options.readyTimeoutMs !== undefined ? { readyTimeoutMs: options.readyTimeoutMs } : {}),
|
|
78
86
|
...(options.onStatus ? { onStatus: options.onStatus } : {}),
|
|
79
87
|
...(options.processOps ? { processOps: options.processOps } : {}),
|
|
80
88
|
});
|
|
81
|
-
return { session,
|
|
89
|
+
return { session, url };
|
|
82
90
|
}
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const dir = path.join(path.resolve(projectPath), SESSION_DIR_NAME);
|
|
90
|
-
removeDeadBuildLock(path.join(dir, BUILD_LOCK_FILE_NAME));
|
|
91
|
-
const lock = new MachineCredentialLock(dir, {
|
|
92
|
-
lockFileName: BUILD_LOCK_FILE_NAME,
|
|
93
|
-
staleMs: 600000,
|
|
94
|
-
acquireBudgetMs: 900000,
|
|
95
|
-
});
|
|
96
|
-
return lock.withLock(() => buildProject({ projectPath }));
|
|
91
|
+
/** The pre-launch C# build failed (thrown from `beforeLaunch`, which `ensure` propagates unchanged). */
|
|
92
|
+
class BuildFailedError extends Error {
|
|
93
|
+
constructor(buildError) {
|
|
94
|
+
super(buildError.message);
|
|
95
|
+
this.buildError = buildError;
|
|
96
|
+
}
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
99
|
* A ready editor of the project (the `exec` / `open --headless` policy): reuse a running one, otherwise build the
|
|
100
|
-
* C# assembly and start
|
|
100
|
+
* C# assembly (Godot does not build it in a headless editor, and a missing assembly disables the addon) and start
|
|
101
|
+
* ours. The build runs under the session's startup lock, only when this call starts the editor: parallel cold calls
|
|
102
|
+
* build once and join that editor.
|
|
101
103
|
*/
|
|
102
104
|
export async function ensureEditor(options) {
|
|
103
105
|
const deps = {
|
|
104
106
|
ensure: (session, mode) => session.ensure({ mode }),
|
|
105
|
-
build:
|
|
107
|
+
build: (projectPath) => buildProject({ projectPath }),
|
|
106
108
|
...options.deps,
|
|
107
109
|
};
|
|
108
110
|
const fail = (reason, err, hint = '') => {
|
|
109
111
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
110
112
|
return { kind: 'failure', success: false, reason, message: error.message + hint, error };
|
|
111
113
|
};
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
godot = createGodotSession(options);
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
return fail('invalid-options', err);
|
|
118
|
-
}
|
|
119
|
-
// Warm path: the local server answers, so an editor is up (the session would only probe it again).
|
|
120
|
-
const running = await godot.probe();
|
|
121
|
-
if (running !== undefined)
|
|
122
|
-
return { kind: 'success', success: true, godot, ensured: { ready: running, source: 'running' } };
|
|
123
|
-
const ours = await godot.session.ownedSession();
|
|
124
|
-
const foreign = ours === undefined && godot.session.readLease() === undefined && findGodotProcess(godot.session.projectRoot) !== null;
|
|
125
|
-
if (foreign) {
|
|
126
|
-
// The user's editor without a reachable local server: it may still be loading, but do not wait the full start budget.
|
|
127
|
-
godot = createGodotSession({ ...options, readyTimeoutMs: Math.min(options.readyTimeoutMs ?? FOREIGN_READY_TIMEOUT_MS, FOREIGN_READY_TIMEOUT_MS) });
|
|
128
|
-
}
|
|
129
|
-
else if (options.build !== false && ours === undefined) {
|
|
130
|
-
// Build only when an editor is about to be started: none of ours runs (or is starting), and no other editor has the project.
|
|
114
|
+
const beforeLaunch = async (projectRoot) => {
|
|
131
115
|
options.onStatus?.('Building C# assembly...');
|
|
132
116
|
let built;
|
|
133
117
|
try {
|
|
134
|
-
built = await deps.build(
|
|
118
|
+
built = await deps.build(projectRoot);
|
|
135
119
|
}
|
|
136
120
|
catch (err) {
|
|
137
|
-
|
|
121
|
+
throw new BuildFailedError(err instanceof Error ? err : new Error(String(err)));
|
|
138
122
|
}
|
|
139
123
|
if (built.kind === 'failure')
|
|
140
|
-
|
|
124
|
+
throw new BuildFailedError(built.error);
|
|
125
|
+
};
|
|
126
|
+
const sessionOptions = { ...options, ...(options.build !== false ? { beforeLaunch } : {}) };
|
|
127
|
+
let godot;
|
|
128
|
+
try {
|
|
129
|
+
godot = createGodotSession(sessionOptions);
|
|
130
|
+
// Our editor of this project runs: talk to the server it was started on (it may differ from --url /
|
|
131
|
+
// GODOT_MCP_HOST). Only a lease cli-core verified live counts: a crashed editor's lease may name a port that
|
|
132
|
+
// another project's editor serves now.
|
|
133
|
+
const leasedUrl = (await godot.session.ownedSession())?.serverUrl;
|
|
134
|
+
if (leasedUrl !== undefined && isLocalhostUrl(leasedUrl) && normalizeUrl(leasedUrl) !== godot.url) {
|
|
135
|
+
godot = createGodotSession({ ...sessionOptions, url: leasedUrl });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
return fail('invalid-options', err);
|
|
141
140
|
}
|
|
142
141
|
try {
|
|
143
142
|
return { kind: 'success', success: true, godot, ensured: await deps.ensure(godot.session, options.window ? 'window' : 'headless') };
|
|
144
143
|
}
|
|
145
144
|
catch (err) {
|
|
146
|
-
|
|
145
|
+
if (err instanceof BuildFailedError)
|
|
146
|
+
return fail('build-failed', err.buildError);
|
|
147
|
+
const sessionError = err instanceof EditorSessionError ? err : undefined;
|
|
147
148
|
let hint = '';
|
|
148
|
-
if (
|
|
149
|
-
if (
|
|
150
|
-
//
|
|
151
|
-
hint = ` (
|
|
149
|
+
if (sessionError?.reason === 'not-ready') {
|
|
150
|
+
if (sessionError.source === 'foreign') {
|
|
151
|
+
// Core's message says what is wrong; add only how to fix it in Godot.
|
|
152
|
+
hint = ` (Godot: in that editor's AI Game Developer dock choose Custom mode and start the server on ${godot.url})`;
|
|
152
153
|
}
|
|
153
|
-
else {
|
|
154
|
-
//
|
|
154
|
+
else if (sessionError.source === 'started') {
|
|
155
|
+
// The editor this call started never answered (e.g. the addon failed to load): it would never idle out.
|
|
155
156
|
const closed = await godot.session.closeOwned({ timeoutMs: 5000, force: true });
|
|
156
157
|
hint = closed.kind === 'closed' ? ` (stopped the unresponsive editor, PID ${closed.pid}; see its log)` : '';
|
|
157
158
|
}
|
|
159
|
+
else {
|
|
160
|
+
// Another call's editor: that call may still be waiting for it, so it is not stopped here.
|
|
161
|
+
hint = ' (an editor started by another godot-cli call; `godot-cli close --owned-only --force` stops it)';
|
|
162
|
+
}
|
|
158
163
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Delete a build lock whose holder was this machine and is gone (a Ctrl+C mid-build never releases it); the lock
|
|
164
|
-
* protocol alone would wait out its staleness bar. Best-effort.
|
|
165
|
-
*/
|
|
166
|
-
function removeDeadBuildLock(lockPath) {
|
|
167
|
-
try {
|
|
168
|
-
const holder = JSON.parse(fs.readFileSync(lockPath, 'utf-8'));
|
|
169
|
-
if (typeof holder.pid === 'number' && typeof holder.hostId === 'string' && holder.hostId.toLowerCase() === os.hostname().toLowerCase()
|
|
170
|
-
&& !defaultSessionProcessOps.isAlive(holder.pid)) {
|
|
171
|
-
fs.rmSync(lockPath, { force: true });
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
// no lock, or one we cannot read: the lock protocol decides
|
|
164
|
+
const notReady = sessionError?.reason === 'exited' || sessionError?.reason === 'not-ready';
|
|
165
|
+
return fail(notReady ? 'not-ready' : 'launch-failed', err, hint);
|
|
176
166
|
}
|
|
177
167
|
}
|
|
178
168
|
//# sourceMappingURL=session.js.map
|
package/dist/lib/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,iHAAiH;AACjH,mGAAmG;AAEnG,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,iHAAiH;AACjH,mGAAmG;AAEnG,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,GAKlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,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|
3
3
|
export type { ExecCodeOptions, ExecCodeResult, ExecCodeSuccess, ExecCodeFailure } from './lib/exec.js';
|
|
4
|
-
export { ensureEditor, SESSION_CLOSE_TOOL } from './lib/session.js';
|
|
5
|
-
export type { GodotSessionOptions, EnsureEditorOptions, EnsureEditorResult } from './lib/session.js';
|
|
4
|
+
export { createGodotSession, ensureEditor, SESSION_CLOSE_TOOL } from './lib/session.js';
|
|
5
|
+
export type { GodotSession, GodotSessionOptions, EnsureEditorOptions, EnsureEditorResult } from './lib/session.js';
|
|
6
6
|
export { buildProject } from './lib/build.js';
|
|
7
7
|
export { createProject } from './lib/create-project.js';
|
|
8
8
|
export { runTool, runSystemTool } from './lib/run-tool.js';
|
package/dist/lib.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// via the `exports` field in package.json).
|
|
15
15
|
export { openProject } from './lib/open.js';
|
|
16
16
|
export { execCode, readToolResponse, buildScriptExecuteInput, SCRIPT_EXECUTE_TOOL } from './lib/exec.js';
|
|
17
|
-
export { ensureEditor, SESSION_CLOSE_TOOL } from './lib/session.js';
|
|
17
|
+
export { createGodotSession, ensureEditor, SESSION_CLOSE_TOOL } from './lib/session.js';
|
|
18
18
|
export { buildProject } from './lib/build.js';
|
|
19
19
|
export { createProject } from './lib/create-project.js';
|
|
20
20
|
export { runTool, runSystemTool } from './lib/run-tool.js';
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,eAAe;AACf,+EAA+E;AAC/E,wDAAwD;AACxD,oDAAoD;AACpD,yEAAyE;AACzE,4DAA4D;AAC5D,+EAA+E;AAC/E,gEAAgE;AAChE,6EAA6E;AAC7E,EAAE;AACF,0EAA0E;AAC1E,4CAA4C;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAA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,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -4,7 +4,33 @@ export interface AddonPackageReference {
|
|
|
4
4
|
id: string;
|
|
5
5
|
/** The pinned version (the `Version=` attribute). */
|
|
6
6
|
version: string;
|
|
7
|
+
/**
|
|
8
|
+
* Only editor (`#if TOOLS`) code uses the package: it is written with `EDITOR_ONLY_CONDITION`, so Godot's
|
|
9
|
+
* export builds leave it out (an exported game ships no RQL / Roslyn).
|
|
10
|
+
*/
|
|
11
|
+
editorOnly?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* With `editorOnly`: a game that opts in to in-game `script-execute` (MSBuild property `GodotMcpCodeExecInGame=true`)
|
|
14
|
+
* keeps the package in its export builds, so it is written with `CODE_EXEC_IN_GAME_CONDITION` instead. A CLI that
|
|
15
|
+
* predates this flag reads such a manifest entry as plain editor-only (safe: no in-game code execution).
|
|
16
|
+
*/
|
|
17
|
+
inGameOptIn?: boolean;
|
|
7
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The MSBuild condition of an editor-only `<PackageReference>`: every configuration except Godot's two export
|
|
21
|
+
* builds (`ExportDebug` / `ExportRelease`, the ones without `TOOLS`). The Godot SDK applies the same rule to
|
|
22
|
+
* GodotSharpEditor. Godot-MCP.csproj marks its editor-only packages with this exact attribute.
|
|
23
|
+
*/
|
|
24
|
+
export declare const EDITOR_ONLY_CONDITION = "'$(Configuration)' != 'ExportDebug' and '$(Configuration)' != 'ExportRelease'";
|
|
25
|
+
/** The MSBuild property a game sets to `true` to keep Code-Exec and Roslyn in its exports (in-game `script-execute`). */
|
|
26
|
+
export declare const CODE_EXEC_IN_GAME_PROPERTY = "GodotMcpCodeExecInGame";
|
|
27
|
+
/**
|
|
28
|
+
* The MSBuild condition of an `inGameOptIn` package: the editor-only condition, or the game opted in to in-game
|
|
29
|
+
* `script-execute`. Godot-MCP.csproj marks its Code-Exec packages with this exact attribute.
|
|
30
|
+
*/
|
|
31
|
+
export declare const CODE_EXEC_IN_GAME_CONDITION = "'$(GodotMcpCodeExecInGame)' == 'true' or ('$(Configuration)' != 'ExportDebug' and '$(Configuration)' != 'ExportRelease')";
|
|
32
|
+
/** The canonical Condition `install-plugin` writes for a reference (undefined: none). */
|
|
33
|
+
export declare function canonicalCondition(ref: AddonPackageReference): string | undefined;
|
|
8
34
|
/**
|
|
9
35
|
* A single `<EmbeddedResource>` the consumer csproj must declare so an asset the
|
|
10
36
|
* addon reads at editor runtime via `GetManifestResourceStream` is embedded into
|
package/dist/utils/addon-deps.js
CHANGED
|
@@ -11,12 +11,33 @@
|
|
|
11
11
|
// this CLI's version — the SAME values, never a bump of those pins. `com.IvanMurzak.Rql` (the RQL data layer of
|
|
12
12
|
// the editor tools, PolyForm Shield 1.0.0) is a direct dependency of the addon sources since 1.0; Code-Exec
|
|
13
13
|
// (`com.IvanMurzak.CodeExec` + the source-only `.Roslyn` adapter, compiled against the pinned
|
|
14
|
-
// `Microsoft.CodeAnalysis.CSharp`) runs `script-execute`.
|
|
14
|
+
// `Microsoft.CodeAnalysis.CSharp`) runs `script-execute`. Those four are `editorOnly`: only `#if TOOLS` code
|
|
15
|
+
// uses them, so exported games ship neither RQL nor Roslyn. The three Code-Exec ones are also `inGameOptIn`: a game
|
|
16
|
+
// that opts in to in-game `script-execute` (`GodotMcpCodeExecInGame=true`) keeps them in its exports. A parity test
|
|
15
17
|
// (`cli/tests/addon-deps-parity.test.ts`) reads `Godot-MCP.csproj` and FAILS the
|
|
16
18
|
// build if these constants ever drift from the addon's pins, so the scaffold can
|
|
17
19
|
// never silently install a mismatched version.
|
|
18
20
|
//
|
|
19
21
|
// No top-level side effects; pure data + pure string transforms only.
|
|
22
|
+
/**
|
|
23
|
+
* The MSBuild condition of an editor-only `<PackageReference>`: every configuration except Godot's two export
|
|
24
|
+
* builds (`ExportDebug` / `ExportRelease`, the ones without `TOOLS`). The Godot SDK applies the same rule to
|
|
25
|
+
* GodotSharpEditor. Godot-MCP.csproj marks its editor-only packages with this exact attribute.
|
|
26
|
+
*/
|
|
27
|
+
export const EDITOR_ONLY_CONDITION = "'$(Configuration)' != 'ExportDebug' and '$(Configuration)' != 'ExportRelease'";
|
|
28
|
+
/** The MSBuild property a game sets to `true` to keep Code-Exec and Roslyn in its exports (in-game `script-execute`). */
|
|
29
|
+
export const CODE_EXEC_IN_GAME_PROPERTY = 'GodotMcpCodeExecInGame';
|
|
30
|
+
/**
|
|
31
|
+
* The MSBuild condition of an `inGameOptIn` package: the editor-only condition, or the game opted in to in-game
|
|
32
|
+
* `script-execute`. Godot-MCP.csproj marks its Code-Exec packages with this exact attribute.
|
|
33
|
+
*/
|
|
34
|
+
export const CODE_EXEC_IN_GAME_CONDITION = `'$(${CODE_EXEC_IN_GAME_PROPERTY})' == 'true' or (${EDITOR_ONLY_CONDITION})`;
|
|
35
|
+
/** The canonical Condition `install-plugin` writes for a reference (undefined: none). */
|
|
36
|
+
export function canonicalCondition(ref) {
|
|
37
|
+
if (!ref.editorOnly)
|
|
38
|
+
return undefined;
|
|
39
|
+
return ref.inGameOptIn ? CODE_EXEC_IN_GAME_CONDITION : EDITOR_ONLY_CONDITION;
|
|
40
|
+
}
|
|
20
41
|
/**
|
|
21
42
|
* The NuGet `PackageReference`s the addon of THIS CLI's version needs (fallback when
|
|
22
43
|
* the installed addon carries no `nuget-deps.json`), mirroring `Godot-MCP.csproj`.
|
|
@@ -24,11 +45,11 @@
|
|
|
24
45
|
*/
|
|
25
46
|
export const ADDON_PACKAGE_REFERENCES = [
|
|
26
47
|
{ id: 'com.IvanMurzak.ReflectorNet', version: '5.4.3' },
|
|
27
|
-
{ id: 'com.IvanMurzak.McpPlugin', version: '8.
|
|
28
|
-
{ id: 'com.IvanMurzak.Rql', version: '0.1.1' },
|
|
29
|
-
{ id: 'com.IvanMurzak.CodeExec', version: '0.2.
|
|
30
|
-
{ id: 'com.IvanMurzak.CodeExec.Roslyn', version: '0.2.
|
|
31
|
-
{ id: 'Microsoft.CodeAnalysis.CSharp', version: '4.12.0' },
|
|
48
|
+
{ id: 'com.IvanMurzak.McpPlugin', version: '8.11.0' },
|
|
49
|
+
{ id: 'com.IvanMurzak.Rql', version: '0.1.1', editorOnly: true },
|
|
50
|
+
{ id: 'com.IvanMurzak.CodeExec', version: '0.2.1', editorOnly: true, inGameOptIn: true },
|
|
51
|
+
{ id: 'com.IvanMurzak.CodeExec.Roslyn', version: '0.2.1', editorOnly: true, inGameOptIn: true },
|
|
52
|
+
{ id: 'Microsoft.CodeAnalysis.CSharp', version: '4.12.0', editorOnly: true, inGameOptIn: true },
|
|
32
53
|
];
|
|
33
54
|
/**
|
|
34
55
|
* The exact `<EmbeddedResource>`s the consumer's project `.csproj` needs, single-sourced
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon-deps.js","sourceRoot":"","sources":["../../src/utils/addon-deps.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,mFAAmF;AACnF,oEAAoE;AACpE,6BAA6B;AAC7B,EAAE;AACF,gFAAgF;AAChF,0EAA0E;AAC1E,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,gHAAgH;AAChH,4GAA4G;AAC5G,8FAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"addon-deps.js","sourceRoot":"","sources":["../../src/utils/addon-deps.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,mFAAmF;AACnF,oEAAoE;AACpE,6BAA6B;AAC7B,EAAE;AACF,gFAAgF;AAChF,0EAA0E;AAC1E,mFAAmF;AACnF,oFAAoF;AACpF,oFAAoF;AACpF,gHAAgH;AAChH,4GAA4G;AAC5G,8FAA8F;AAC9F,6GAA6G;AAC7G,oHAAoH;AACpH,oHAAoH;AACpH,iFAAiF;AACjF,iFAAiF;AACjF,+CAA+C;AAC/C,EAAE;AACF,sEAAsE;AAqBtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,+EAA+E,CAAC;AAErH,yHAAyH;AACzH,MAAM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
|
file?: string;
|
|
8
8
|
warnings: string[];
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Every `<PackageReference Include=".." Version="..">` in a csproj text, in document order. A reference whose
|
|
12
|
+
* `Condition` is `EDITOR_ONLY_CONDITION` is editor-only; `CODE_EXEC_IN_GAME_CONDITION` adds `inGameOptIn`.
|
|
13
|
+
*/
|
|
11
14
|
export declare function parseCsprojPackageReferences(csprojText: string): AddonPackageReference[];
|
|
12
15
|
/**
|
|
13
|
-
* Parse a `nuget-deps.json` manifest (`{ "packageReferences": [{ "id", "version" }] }`).
|
|
14
|
-
*
|
|
16
|
+
* Parse a `nuget-deps.json` manifest (`{ "packageReferences": [{ "id", "version", "editorOnly"?, "inGameOptIn"? }] }`).
|
|
17
|
+
* Manifests that predate `editorOnly` mark nothing editor-only, which those addons need (their RQL sources
|
|
18
|
+
* compile into export builds); `inGameOptIn` counts only with `editorOnly`. Throws on malformed JSON, a missing/empty
|
|
19
|
+
* list, or an invalid entry.
|
|
15
20
|
*/
|
|
16
21
|
export declare function parseAddonNugetDeps(text: string): AddonPackageReference[];
|
|
17
22
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import { ADDON_PACKAGE_REFERENCES } from './addon-deps.js';
|
|
3
|
+
import { ADDON_PACKAGE_REFERENCES, CODE_EXEC_IN_GAME_CONDITION, EDITOR_ONLY_CONDITION, } from './addon-deps.js';
|
|
4
4
|
// Resolve the NuGet PackageReferences the INSTALLED addon needs, so `install-plugin`
|
|
5
5
|
// pins the consumer csproj to what that addon release was built against — not to the
|
|
6
6
|
// constants baked into this CLI build (they differ whenever the addon version differs
|
|
@@ -22,24 +22,31 @@ const ADDON_CSPROJ_FILE = 'Godot-MCP.csproj';
|
|
|
22
22
|
// NuGet-shaped ids and versions are accepted (no quotes, `<`, `&`, whitespace).
|
|
23
23
|
const NUGET_ID_RE = /^[A-Za-z0-9_][A-Za-z0-9_.-]*$/;
|
|
24
24
|
const NUGET_VERSION_RE = /^[0-9A-Za-z][0-9A-Za-z.+-]*$/;
|
|
25
|
-
function validRef(id, version) {
|
|
25
|
+
function validRef(id, version, editorOnly, inGameOptIn) {
|
|
26
26
|
return typeof id === 'string' && typeof version === 'string' && NUGET_ID_RE.test(id) && NUGET_VERSION_RE.test(version)
|
|
27
|
-
? { id, version }
|
|
27
|
+
? { id, version, ...(editorOnly && { editorOnly }), ...(editorOnly && inGameOptIn && { inGameOptIn }) }
|
|
28
28
|
: null;
|
|
29
29
|
}
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Every `<PackageReference Include=".." Version="..">` in a csproj text, in document order. A reference whose
|
|
32
|
+
* `Condition` is `EDITOR_ONLY_CONDITION` is editor-only; `CODE_EXEC_IN_GAME_CONDITION` adds `inGameOptIn`.
|
|
33
|
+
*/
|
|
31
34
|
export function parseCsprojPackageReferences(csprojText) {
|
|
32
35
|
const refs = [];
|
|
33
36
|
for (const element of csprojText.match(/<PackageReference\b[^>]*>/gi) ?? []) {
|
|
34
|
-
const
|
|
37
|
+
const condition = /\bCondition\s*=\s*"([^"]*)"/i.exec(element)?.[1];
|
|
38
|
+
const inGameOptIn = condition === CODE_EXEC_IN_GAME_CONDITION;
|
|
39
|
+
const ref = validRef(/\bInclude\s*=\s*"([^"]+)"/i.exec(element)?.[1], /\bVersion\s*=\s*"([^"]+)"/i.exec(element)?.[1], inGameOptIn || condition === EDITOR_ONLY_CONDITION, inGameOptIn);
|
|
35
40
|
if (ref !== null)
|
|
36
41
|
refs.push(ref);
|
|
37
42
|
}
|
|
38
43
|
return refs;
|
|
39
44
|
}
|
|
40
45
|
/**
|
|
41
|
-
* Parse a `nuget-deps.json` manifest (`{ "packageReferences": [{ "id", "version" }] }`).
|
|
42
|
-
*
|
|
46
|
+
* Parse a `nuget-deps.json` manifest (`{ "packageReferences": [{ "id", "version", "editorOnly"?, "inGameOptIn"? }] }`).
|
|
47
|
+
* Manifests that predate `editorOnly` mark nothing editor-only, which those addons need (their RQL sources
|
|
48
|
+
* compile into export builds); `inGameOptIn` counts only with `editorOnly`. Throws on malformed JSON, a missing/empty
|
|
49
|
+
* list, or an invalid entry.
|
|
43
50
|
*/
|
|
44
51
|
export function parseAddonNugetDeps(text) {
|
|
45
52
|
const parsed = JSON.parse(text);
|
|
@@ -49,7 +56,7 @@ export function parseAddonNugetDeps(text) {
|
|
|
49
56
|
}
|
|
50
57
|
return list.map((entry, i) => {
|
|
51
58
|
const e = entry;
|
|
52
|
-
const ref = validRef(e?.id, e?.version);
|
|
59
|
+
const ref = validRef(e?.id, e?.version, e?.editorOnly === true, e?.inGameOptIn === true);
|
|
53
60
|
if (ref === null)
|
|
54
61
|
throw new Error(`packageReferences[${i}] is not a valid { id, version } pair`);
|
|
55
62
|
return ref;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon-nuget-deps.js","sourceRoot":"","sources":["../../src/utils/addon-nuget-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"addon-nuget-deps.js","sourceRoot":"","sources":["../../src/utils/addon-nuget-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAEzB,qFAAqF;AACrF,qFAAqF;AACrF,sFAAsF;AACtF,yEAAyE;AACzE,EAAE;AACF,qBAAqB;AACrB,sFAAsF;AACtF,2EAA2E;AAC3E,iFAAiF;AACjF,uFAAuF;AACvF,0DAA0D;AAC1D,oFAAoF;AACpF,yCAAyC;AAEzC,sEAAsE;AACtE,MAAM,qBA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E,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;QACxF,iGAAiG,CACpG,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AACzE,CAAC"}
|
|
@@ -8,7 +8,8 @@ import { type AddonPackageReference, type AddonEmbeddedResource } from './addon-
|
|
|
8
8
|
* - a project with NO `<ItemGroup>` at all (appends one before `</Project>`);
|
|
9
9
|
* - a project that already declares both pins at the right version (no change);
|
|
10
10
|
* - a project that declares one or both at a DIFFERENT version (reconciles in place);
|
|
11
|
-
* - a project that declares only one of the two (adds the missing one)
|
|
11
|
+
* - a project that declares only one of the two (adds the missing one);
|
|
12
|
+
* - an editor-only package declared without a Condition (adds the editor-only Condition, see `desiredCondition`).
|
|
12
13
|
*
|
|
13
14
|
* It deliberately does a minimal, well-scoped text edit rather than a full XML
|
|
14
15
|
* parse/serialize, to preserve the rest of the consumer's csproj formatting
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isNewerVersion } from './semver.js';
|
|
2
|
-
import { ADDON_PACKAGE_REFERENCES, ADDON_EMBEDDED_RESOURCES, } from './addon-deps.js';
|
|
2
|
+
import { ADDON_PACKAGE_REFERENCES, ADDON_EMBEDDED_RESOURCES, CODE_EXEC_IN_GAME_CONDITION, EDITOR_ONLY_CONDITION, canonicalCondition, } from './addon-deps.js';
|
|
3
3
|
/** Escape a string for use inside a RegExp source. */
|
|
4
4
|
function escapeRegExp(value) {
|
|
5
5
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
@@ -30,9 +30,40 @@ function embeddedResourceRegex(include) {
|
|
|
30
30
|
const escInclude = escapeRegExp(include);
|
|
31
31
|
return new RegExp(`<EmbeddedResource\\b[^>]*?\\bInclude\\s*=\\s*"${escInclude}"[^>]*?(?:/>|></EmbeddedResource>)`, 'i');
|
|
32
32
|
}
|
|
33
|
-
/** Render the
|
|
34
|
-
function renderRef(ref) {
|
|
35
|
-
|
|
33
|
+
/** Render the self-closing element for a reference, with its Condition when it has one. */
|
|
34
|
+
function renderRef(ref, condition) {
|
|
35
|
+
const conditionAttr = condition === undefined ? '' : ` Condition="${condition}"`;
|
|
36
|
+
return `<PackageReference Include="${ref.id}" Version="${ref.version}"${conditionAttr} />`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Rewrite an existing element's Version and Condition in place, keeping every other attribute the project set
|
|
40
|
+
* (`PrivateAssets`, `IncludeAssets`, ...) and its attribute order.
|
|
41
|
+
*/
|
|
42
|
+
function patchRef(element, version, condition) {
|
|
43
|
+
const conditionRe = /\s+Condition\s*=\s*"[^"]*"/i;
|
|
44
|
+
// Function replacers throughout: a Condition holds `$`.
|
|
45
|
+
let out = element.replace(/(\bVersion\s*=\s*")[^"]*"/i, (_m, head) => `${head}${version}"`);
|
|
46
|
+
if (condition === undefined)
|
|
47
|
+
return out.replace(conditionRe, '');
|
|
48
|
+
if (conditionRe.test(out))
|
|
49
|
+
return out.replace(conditionRe, () => ` Condition="${condition}"`);
|
|
50
|
+
out = out.replace(/\s*(\/>|><\/PackageReference>)$/i, (_m, end) => ` Condition="${condition}"${end === '/>' ? ' />' : end}`);
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/** The packages this CLI knows as editor-only (an older addon's manifest may not mark them). */
|
|
54
|
+
const KNOWN_EDITOR_ONLY_IDS = new Set(ADDON_PACKAGE_REFERENCES.filter((r) => r.editorOnly).map((r) => r.id));
|
|
55
|
+
/** The Conditions `install-plugin` writes; any other Condition on an element is the project's own. */
|
|
56
|
+
const CANONICAL_CONDITIONS = new Set([EDITOR_ONLY_CONDITION, CODE_EXEC_IN_GAME_CONDITION]);
|
|
57
|
+
/**
|
|
58
|
+
* The Condition a reference's element should carry, given the one it has (`undefined` for a new element): a missing or
|
|
59
|
+
* canonical Condition becomes the reference's canonical one (dropped for a known editor-only package the addon now needs
|
|
60
|
+
* in exports); any other Condition is the project's own and stays. Cases: `csproj-deps.test.ts`.
|
|
61
|
+
*/
|
|
62
|
+
function desiredCondition(ref, existing) {
|
|
63
|
+
const canonical = existing === undefined || CANONICAL_CONDITIONS.has(existing);
|
|
64
|
+
if (ref.editorOnly)
|
|
65
|
+
return canonical ? canonicalCondition(ref) : existing;
|
|
66
|
+
return canonical && KNOWN_EDITOR_ONLY_IDS.has(ref.id) ? undefined : existing;
|
|
36
67
|
}
|
|
37
68
|
/** Render the canonical self-closing element for a required embedded resource. */
|
|
38
69
|
function renderEmbed(res) {
|
|
@@ -73,25 +104,40 @@ export function addAddonPackageReferences(csprojText, requiredRefs = ADDON_PACKA
|
|
|
73
104
|
continue;
|
|
74
105
|
}
|
|
75
106
|
const existingVersion = match[1] ?? match[2] ?? '';
|
|
76
|
-
|
|
77
|
-
|
|
107
|
+
const existingCondition = /\bCondition\s*=\s*"([^"]*)"/i.exec(match[0])?.[1];
|
|
108
|
+
// A third-party package (Roslyn) the project already uses at a newer version keeps its version and, unless an older
|
|
109
|
+
// install wrote one of our canonical Conditions, its Condition: the addon needs "at least" (the source-only
|
|
110
|
+
// Code-Exec adapter compiles against Roslyn 3.8+), and a downgrade, or making it editor-only, would break the
|
|
111
|
+
// project's own use. A canonical Condition still moves to the current canonical one (editor-only -> in-game opt-in).
|
|
112
|
+
if (!ref.id.startsWith('com.IvanMurzak.') && isNewerVersion(ref.version, existingVersion)) {
|
|
113
|
+
const migrated = ref.editorOnly && existingCondition !== undefined && CANONICAL_CONDITIONS.has(existingCondition)
|
|
114
|
+
? canonicalCondition(ref)
|
|
115
|
+
: existingCondition;
|
|
116
|
+
if (migrated === existingCondition) {
|
|
117
|
+
changes.push({ id: ref.id, action: 'unchanged', version: existingVersion });
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const patched = patchRef(match[0], existingVersion, migrated);
|
|
121
|
+
text = text.replace(re, () => patched);
|
|
122
|
+
changes.push({ id: ref.id, action: 'updated', from: existingVersion, version: existingVersion });
|
|
123
|
+
}
|
|
78
124
|
continue;
|
|
79
125
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
changes.push({ id: ref.id, action: 'unchanged', version: existingVersion });
|
|
126
|
+
const condition = desiredCondition(ref, existingCondition);
|
|
127
|
+
if (existingVersion === ref.version && condition === existingCondition) {
|
|
128
|
+
changes.push({ id: ref.id, action: 'unchanged', version: ref.version });
|
|
84
129
|
continue;
|
|
85
130
|
}
|
|
86
|
-
// Reconcile in place:
|
|
87
|
-
|
|
131
|
+
// Reconcile in place: patch Version / Condition, keeping the element's other attributes.
|
|
132
|
+
const patched = patchRef(match[0], ref.version, condition);
|
|
133
|
+
text = text.replace(re, () => patched);
|
|
88
134
|
changes.push({ id: ref.id, action: 'updated', from: existingVersion, version: ref.version });
|
|
89
135
|
}
|
|
90
136
|
// Second pass: add the missing references. Prefer an existing <ItemGroup> that
|
|
91
137
|
// already holds a <PackageReference> (group them together); else append a fresh
|
|
92
138
|
// <ItemGroup> just before </Project>.
|
|
93
139
|
if (missing.length > 0) {
|
|
94
|
-
const block = missing.map((ref) => `${indent}${renderRef(ref)}`).join(eol);
|
|
140
|
+
const block = missing.map((ref) => `${indent}${renderRef(ref, desiredCondition(ref, undefined))}`).join(eol);
|
|
95
141
|
const pkgItemGroupClose = findPackageReferenceItemGroupClose(text);
|
|
96
142
|
if (pkgItemGroupClose !== -1) {
|
|
97
143
|
// Insert the missing refs just before that ItemGroup's closing tag.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csproj-deps.js","sourceRoot":"","sources":["../../src/utils/csproj-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,wBAAwB,EACxB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"csproj-deps.js","sourceRoot":"","sources":["../../src/utils/csproj-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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OAAO,4BAA4B,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;AACpE,CAAC;AAED;;;;;GAKG;AACH,SAAS,4BAA4B,CAAC,IAAY,EAAE,UAAkB;IACpE,MAAM,WAAW,GAAG,6CAA6C,CAAC;IAClE,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1B,iEAAiE;YACjE,MAAM,QAAQ,GAAG,cAAc,CAAC;YAChC,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QACjD,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
1
|
import * as os from 'os';
|
|
3
2
|
import * as path from 'path';
|
|
4
|
-
import { MachineCredentialStore, MachineCredentialLock, MachineCredentialProvider, HttpTokenRefresher, godotAdapter, effectiveFamilies, MACHINE_STORE_DIR_NAME, DEFAULT_CLOUD_BASE_URL, } from '@baizor/gamedev-cli-core';
|
|
3
|
+
import { MachineCredentialStore, MachineCredentialLock, MachineCredentialProvider, HttpTokenRefresher, godotAdapter, effectiveFamilies, ensureAiGameDevGitignore, MACHINE_STORE_DIR_NAME, DEFAULT_CLOUD_BASE_URL, } from '@baizor/gamedev-cli-core';
|
|
5
4
|
/**
|
|
6
5
|
* Thin resolution shim over the `@baizor/gamedev-cli-core` machine credential store — the ONLY
|
|
7
6
|
* store implementation this CLI ships (unified-machine-auth 06 D7: "CLI-local store copies …
|
|
@@ -62,26 +61,7 @@ export function openProjectStore(projectPath) {
|
|
|
62
61
|
* version-controllable. Idempotent and best-effort — a failure never blocks persisting.
|
|
63
62
|
*/
|
|
64
63
|
export function ensureProjectStoreGitignored(projectPath) {
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
const dir = resolveProjectStoreDir(projectPath);
|
|
68
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
69
|
-
const gitignorePath = path.join(dir, '.gitignore');
|
|
70
|
-
if (!fs.existsSync(gitignorePath)) {
|
|
71
|
-
fs.writeFileSync(gitignorePath, entries.join('\n') + '\n');
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const existing = fs.readFileSync(gitignorePath, 'utf-8');
|
|
75
|
-
const lines = existing.split(/\r?\n/).map((l) => l.trim());
|
|
76
|
-
const missing = entries.filter((e) => !lines.includes(e));
|
|
77
|
-
if (missing.length > 0) {
|
|
78
|
-
const prefix = existing.length > 0 && !existing.endsWith('\n') ? '\n' : '';
|
|
79
|
-
fs.appendFileSync(gitignorePath, `${prefix}${missing.join('\n')}\n`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
// Best-effort only — never fail a login over a .gitignore write.
|
|
84
|
-
}
|
|
64
|
+
ensureAiGameDevGitignore(projectPath, ['credentials.json', 'credentials.lock', 'credentials.lock.takeover']);
|
|
85
65
|
}
|
|
86
66
|
/**
|
|
87
67
|
* Build the cli-core {@link MachineCredentialProvider} for a store — THE single entry point for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine-store.js","sourceRoot":"","sources":["../../src/utils/machine-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"machine-store.js","sourceRoot":"","sources":["../../src/utils/machine-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,E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AAW,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAC5F,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAmC;IAC1E,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC;IACjD,OAAO,OAAO,KAAK,EAAE,WAAW,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACvF,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* download entirely (offline / CI). Bumping the addon's server pin requires
|
|
6
6
|
* bumping this in the same PR or the parity test goes red.
|
|
7
7
|
*/
|
|
8
|
-
export declare const DEFAULT_SERVER_VERSION = "9.2.
|
|
8
|
+
export declare const DEFAULT_SERVER_VERSION = "9.2.13";
|
|
9
9
|
/** GitHub-release host the server zip + manifest are downloaded from. NOTHING else is trusted. */
|
|
10
10
|
export declare const TRUSTED_DOWNLOAD_HOST = "github.com";
|
|
11
11
|
/** The `owner/repo` the shared server releases live under. */
|
|
@@ -18,7 +18,7 @@ import { createHash } from 'crypto';
|
|
|
18
18
|
* download entirely (offline / CI). Bumping the addon's server pin requires
|
|
19
19
|
* bumping this in the same PR or the parity test goes red.
|
|
20
20
|
*/
|
|
21
|
-
export const DEFAULT_SERVER_VERSION = '9.2.
|
|
21
|
+
export const DEFAULT_SERVER_VERSION = '9.2.13';
|
|
22
22
|
/** GitHub-release host the server zip + manifest are downloaded from. NOTHING else is trusted. */
|
|
23
23
|
export const TRUSTED_DOWNLOAD_HOST = 'github.com';
|
|
24
24
|
/** The `owner/repo` the shared server releases live under. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "godot-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Cross-platform CLI tool for Godot-MCP (Skills & MCP). Resolves and launches the Godot editor with MCP connection env vars, runs MCP/system tools over HTTP, probes server health, configures AI agents (Claude Code, Cursor, VS Code, …), and enables/disables the godot_mcp addon. Works with Claude Code, Cursor, Copilot, and any MCP client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/lib.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"node": "^20.19.0 || >=22.12.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@baizor/gamedev-cli-core": "^0.7.
|
|
65
|
+
"@baizor/gamedev-cli-core": "^0.7.1",
|
|
66
66
|
"chalk": "^5.6.2",
|
|
67
67
|
"commander": "^13.1.0",
|
|
68
68
|
"yocto-spinner": "^1.1.0"
|