godot-cli 0.29.0 → 0.31.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 +36 -0
- package/README.md +42 -3
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/close.d.ts +3 -0
- package/dist/commands/close.js +40 -1
- package/dist/commands/close.js.map +1 -1
- package/dist/commands/exec.d.ts +2 -0
- package/dist/commands/exec.js +101 -0
- package/dist/commands/exec.js.map +1 -0
- package/dist/commands/open.js +60 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/run-tool-builder.d.ts +9 -1
- package/dist/commands/run-tool-builder.js +1 -1
- package/dist/commands/run-tool-builder.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/exec.d.ts +65 -0
- package/dist/lib/exec.js +79 -0
- package/dist/lib/exec.js.map +1 -0
- package/dist/lib/session.d.ts +79 -0
- package/dist/lib/session.js +168 -0
- package/dist/lib/session.js.map +1 -0
- package/dist/lib.d.ts +4 -0
- package/dist/lib.js +2 -0
- package/dist/lib.js.map +1 -1
- package/dist/utils/addon-deps.d.ts +12 -1
- package/dist/utils/addon-deps.js +16 -4
- package/dist/utils/addon-deps.js.map +1 -1
- package/dist/utils/addon-nuget-deps.d.ts +7 -3
- package/dist/utils/addon-nuget-deps.js +12 -8
- package/dist/utils/addon-nuget-deps.js.map +1 -1
- package/dist/utils/connection.d.ts +18 -0
- package/dist/utils/connection.js +22 -3
- package/dist/utils/connection.js.map +1 -1
- package/dist/utils/csproj-deps.d.ts +2 -1
- package/dist/utils/csproj-deps.js +50 -8
- package/dist/utils/csproj-deps.js.map +1 -1
- package/dist/utils/input.d.ts +2 -0
- package/dist/utils/input.js +9 -0
- package/dist/utils/input.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/dist/utils/skills.js +16 -1
- package/dist/utils/skills.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,42 @@ All notable changes to `godot-cli` are documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## Unreleased
|
|
6
6
|
|
|
7
|
+
- **McpPlugin 8.11.0; `exec` waits for the server's tool timeout.** `install-plugin` pins `com.IvanMurzak.McpPlugin`
|
|
8
|
+
8.11.0 (fallback for addons without `nuget-deps.json`). The addon starts its local server with
|
|
9
|
+
`tool-timeout=300000` (on a server built on McpPlugin 8.11.0+ a call is sent to the editor once and may run
|
|
10
|
+
5 minutes; `plugin-timeout` is only the connection timeout), so `exec`'s default `--timeout` goes from 180000 to
|
|
11
|
+
310000 ms and a slow call ends with the server's timeout error rather than a client abort. Older servers ignore
|
|
12
|
+
`tool-timeout` and still give up after about 110 s.
|
|
13
|
+
- **No Roslyn in exported games.** `install-plugin` writes the addon's editor-only packages (RQL, Code-Exec, Roslyn)
|
|
14
|
+
with a Condition that leaves them out of Godot's export builds, and adds it to entries an older version wrote (a
|
|
15
|
+
`Condition` the project set is kept). The installed addon says which packages are editor-only (`editorOnly` in
|
|
16
|
+
`nuget-deps.json`); an older addon marks none.
|
|
17
|
+
- **Editor sessions on `@baizor/gamedev-cli-core` 0.7.1.** The pre-launch C# build of `exec` / `open --headless`
|
|
18
|
+
runs in the session's `beforeLaunch` hook, under its heartbeated startup lock and only when the call starts the
|
|
19
|
+
editor: parallel cold calls build once (the CLI's own `.ai-game-dev/build.lock` is gone). The lease records the
|
|
20
|
+
server URL and connection mode; while cli-core verifies that lease live (same host, pid and process start time),
|
|
21
|
+
`exec` / `open --headless` talk to that server whatever `--url` / `GODOT_MCP_HOST` say (a crashed editor's lease
|
|
22
|
+
is never followed), and `close --owned-only` / a windowed `open` send `session-close` there with the lease's nonce
|
|
23
|
+
(`close --url` is now a hidden fallback for a lease written by 0.30.0). A user's editor that does not answer is
|
|
24
|
+
reported after the session's own `foreign` wait (now 60 s, as in unity-mcp-cli). An editor started by another
|
|
25
|
+
call that does not answer is no longer stopped (that call may still wait for it). The session files are listed
|
|
26
|
+
in `.ai-game-dev/.gitignore`. Library: `createGodotSession` and the `GodotSession` type are exported;
|
|
27
|
+
`GodotSession.probe` is removed (the session probes itself).
|
|
28
|
+
- **`exec`: run C# in the editor.** `godot-cli exec '<code>'` (or `-f <file>` / stdin, repeatable `--using` /
|
|
29
|
+
`--include`) calls the addon's new `script-execute` tool. A running editor of the project is reused; otherwise the
|
|
30
|
+
C# assembly is built and a **headless** editor starts (`--window` for a GUI one) on the project's local server,
|
|
31
|
+
which its plugin starts itself (`GODOT_MCP_START_SERVER`); a headless one quits by itself after `--idle` seconds
|
|
32
|
+
(default 300) without tool calls. A user's editor whose local server does not answer is reported after 20 s. Built on `@baizor/gamedev-cli-core` 0.7.0 `EditorSession` (lease
|
|
33
|
+
`.ai-game-dev/session.json`, startup lock: parallel calls start one editor). Library: `execCode`, `ensureEditor`,
|
|
34
|
+
`createGodotSession`.
|
|
35
|
+
- **`open --headless [--idle-timeout <s>]`** starts that session without running code; a windowed `open` first
|
|
36
|
+
closes a headless editor the CLI started for the project. **`close --owned-only`** saves and quits only an editor
|
|
37
|
+
the CLI started, through the plugin's `session-close` system tool (a windowless editor gets no WM_CLOSE).
|
|
38
|
+
- `install-plugin` keeps a newer third-party package the project already pins (e.g. its own Roslyn) instead of
|
|
39
|
+
downgrading it to the addon's pin; `com.IvanMurzak.*` pins are still reconciled exactly.
|
|
40
|
+
- `install-plugin` writes the addon's three new NuGet pins (`com.IvanMurzak.CodeExec` and `.Roslyn` 0.2.1,
|
|
41
|
+
`Microsoft.CodeAnalysis.CSharp` 4.12.0); `setup-skills` lists `script-execute` and the `session` family.
|
|
42
|
+
|
|
7
43
|
- **Extension catalog: the extensions are RQL modules.** The `EXTENSIONS_CATALOG` mirror follows the shared
|
|
8
44
|
`extensions.catalog.json`: every Godot-AI-* extension (1.0.0) contributes no MCP tools any more (`tools: []`) and
|
|
9
45
|
its description names the RQL surface it adds to `rql-query` / `rql-mutate` instead.
|
package/README.md
CHANGED
|
@@ -67,6 +67,9 @@ godot-cli open ./MyGodotProject
|
|
|
67
67
|
|
|
68
68
|
# Wait until the MCP server is ready to accept tool calls
|
|
69
69
|
godot-cli wait-for-ready ./MyGodotProject
|
|
70
|
+
|
|
71
|
+
# Run C# in the editor — starts a headless editor when none is open, keeps it warm 5 minutes
|
|
72
|
+
godot-cli exec 'EditorInterface.Singleton.GetEditedSceneRoot()?.Name' --path ./MyGodotProject
|
|
70
73
|
```
|
|
71
74
|
|
|
72
75
|
Or run any command ad-hoc with `npx` — no global install required:
|
|
@@ -83,7 +86,8 @@ npx godot-cli install-plugin /path/to/godot/project
|
|
|
83
86
|
|
|
84
87
|
| Command | What it does |
|
|
85
88
|
| --- | --- |
|
|
86
|
-
| `open [path]` | Build the project's C# assembly (so the addon loads on first open — see below), resolve the Godot editor binary, and launch `--editor --path <project>` with `GODOT_MCP_*` connection env vars. `--no-build` skips the build. |
|
|
89
|
+
| `open [path]` | Build the project's C# assembly (so the addon loads on first open — see below), resolve the Godot editor binary, and launch `--editor --path <project>` with `GODOT_MCP_*` connection env vars. `--no-build` skips the build. `--headless` starts a windowless editor session instead (see [`exec`](#exec)). |
|
|
90
|
+
| `exec [code]` | Run C# in the editor through `script-execute` (see [`exec`](#exec)): reuses a running editor, otherwise starts a headless one and keeps it warm. |
|
|
87
91
|
| `build [path]` | Build the project's C# assembly (`dotnet build`) so the `godot_mcp` addon loads on the next editor open. GDScript-only projects (no `.csproj`) are a no-op. This is the same build `open` runs before launching. |
|
|
88
92
|
| `run-tool <tool> [path]` | POST to `<url>/api/tools/<tool>` with JSON input. |
|
|
89
93
|
| `run-system-tool <tool> [path]` | POST to `<url>/api/system-tools/<tool>` (tools not exposed to MCP clients). |
|
|
@@ -93,7 +97,7 @@ npx godot-cli install-plugin /path/to/godot/project
|
|
|
93
97
|
| `setup-mcp <agent> [path]` | Write the agent's MCP-client config pointing at the project-pinned `<host>/mcp/p/<pin>` URL (so the agent routes to *this* project's editor). In Cloud mode the config carries this project's key (`Authorization: Bearer agd_pk_…`). Add `--no-pin` for the bare `<host>/mcp` URL, `--oauth` for a URL-only config, `--regenerate-key` to replace the key. |
|
|
94
98
|
| `setup-skills <agent> [path]` | Generate Godot-MCP skill files (a `SKILL.md`-per-tool-family) under the agent's skills path. `--list` shows each agent's skills support. |
|
|
95
99
|
| `configure [path]` | List / enable / disable tools, prompts, and resources in the project-local `.godot-mcp/features.json`. |
|
|
96
|
-
| `close [path]` | Gracefully stop the Godot editor running for a project (`--force` to hard-kill). |
|
|
100
|
+
| `close [path]` | Gracefully stop the Godot editor running for a project (`--force` to hard-kill). `--owned-only` closes only an editor `godot-cli` started (`exec` / `open --headless`). |
|
|
97
101
|
| `install-plugin [path]` | Install the `godot_mcp` addon end-to-end: materialize `res://addons/godot_mcp/` (download the matching GitHub release, or `--source <path>` a local copy), add the NuGet `PackageReference`s the installed addon needs + the extension-catalog `<EmbeddedResource>` to the project `.csproj`, and enable the plugin. Idempotent. |
|
|
98
102
|
| `install-extension <id> [path]` | Install a Godot-MCP **extension** (an optional RQL-module package) into the project: resolve `<id>` from the shared catalog, add/update its `<PackageReference>` in the project `.csproj`, then rebuild to restore. Idempotent — behaviorally identical to the in-editor dock. |
|
|
99
103
|
| `remove-plugin [path]` | Disable the `godot_mcp` addon in `project.godot` `[editor_plugins]` (does not delete the addon files). |
|
|
@@ -162,6 +166,41 @@ local/self-hosted server explicitly.
|
|
|
162
166
|
|
|
163
167
|

|
|
164
168
|
|
|
169
|
+
## `exec`
|
|
170
|
+
|
|
171
|
+
Run C# in the project's Godot editor (the addon's `script-execute` tool, on [Code-Exec](https://github.com/IvanMurzak/Code-Exec)):
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
godot-cli exec '1 + 2' # → System.Int32: 3
|
|
175
|
+
godot-cli exec -f snippet.cs --using MyGame.Gameplay # code from a file ("-" or a pipe: stdin)
|
|
176
|
+
godot-cli exec 'Helper.Twice(21)' --include helpers # .cs files/folders under <project>/.ai-game-dev/snippets
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The code is plain statements; the last expression is the result. The output is the value (`Type: value`) and,
|
|
180
|
+
under `logs:`, what the code printed (`Console`; `GD.Print` / push_warning / push_error with Godot.NET.Sdk 4.5+). A compile error points
|
|
181
|
+
at the snippet's line (`snippet.cs(2,12)`) and exits 1.
|
|
182
|
+
|
|
183
|
+
- **A running editor of the project** (yours, with a window, or one `godot-cli` started) is reused and never closed.
|
|
184
|
+
Yours must serve the project's **local** server (dock: Custom mode, server started).
|
|
185
|
+
- **None running:** the C# assembly is built, then a **headless** editor starts (`--headless --editor --path`, or a
|
|
186
|
+
window with `--window`) connected to the project's local server (`http://localhost:<derived port>`, or `--url`),
|
|
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 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
|
+
- `open --headless [--idle-timeout <s>]` starts the same session without running code; `close --owned-only` saves
|
|
191
|
+
and quits it (through the plugin's `session-close` tool — never a user's editor).
|
|
192
|
+
|
|
193
|
+
Sessions use [`@baizor/gamedev-cli-core`](https://www.npmjs.com/package/@baizor/gamedev-cli-core) `EditorSession`:
|
|
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) 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
|
|
199
|
+
`AIGD_SESSION_IDLE_SECONDS`, `AIGD_SESSION_OWNER=cli` and `AIGD_SESSION_NONCE`, plus `GODOT_MCP_CONNECTION_MODE=Custom`,
|
|
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`),
|
|
202
|
+
`--no-build`, `--editor-path`, `--token`, `--raw`.
|
|
203
|
+
|
|
165
204
|
## `login`
|
|
166
205
|
|
|
167
206
|
`godot-cli login` authenticates the editor plugin's **cloud** connection to
|
|
@@ -287,7 +326,7 @@ godot-cli install-extension com.IvanMurzak.Godot.MCP.ProBuilder --version 1.3.0
|
|
|
287
326
|
The package also exports a side-effect-free library (the `.` entry):
|
|
288
327
|
|
|
289
328
|
```ts
|
|
290
|
-
import { openProject, runTool, setupMcp, installPlugin, installExtension } from 'godot-cli';
|
|
329
|
+
import { openProject, runTool, setupMcp, installPlugin, installExtension, execCode, ensureEditor } from 'godot-cli';
|
|
291
330
|
|
|
292
331
|
// The shared extension catalog + lookup helpers are exported too, so a GUI (the app)
|
|
293
332
|
// can render the same list the dock + CLI install from:
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { loginCommand } from './commands/login.js';
|
|
2
2
|
export { openCommand } from './commands/open.js';
|
|
3
|
+
export { execCommand } from './commands/exec.js';
|
|
3
4
|
export { runToolCommand } from './commands/run-tool.js';
|
|
4
5
|
export { runSystemToolCommand } from './commands/run-system-tool.js';
|
|
5
6
|
export { statusCommand } from './commands/status.js';
|
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// `bin/godot-cli.js`).
|
|
6
6
|
export { loginCommand } from './commands/login.js';
|
|
7
7
|
export { openCommand } from './commands/open.js';
|
|
8
|
+
export { execCommand } from './commands/exec.js';
|
|
8
9
|
export { runToolCommand } from './commands/run-tool.js';
|
|
9
10
|
export { runSystemToolCommand } from './commands/run-system-tool.js';
|
|
10
11
|
export { statusCommand } from './commands/status.js';
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,uBAAuB;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,8EAA8E;AAC9E,2EAA2E;AAC3E,uBAAuB;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/commands/close.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { Command } from 'commander';
|
|
|
2
2
|
export interface CloseOptions {
|
|
3
3
|
timeout?: string;
|
|
4
4
|
force?: boolean;
|
|
5
|
+
ownedOnly?: boolean;
|
|
6
|
+
url?: string;
|
|
7
|
+
token?: string;
|
|
5
8
|
}
|
|
6
9
|
/** Resolve the project path argument to an absolute, canonical path. */
|
|
7
10
|
export declare function resolveCloseProjectPath(positionalPath: string | undefined, cwd: string): string;
|
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';
|
|
@@ -6,6 +6,8 @@ import * as ui from '../utils/ui.js';
|
|
|
6
6
|
import { verbose } from '../utils/ui.js';
|
|
7
7
|
import { findGodotProcess } from '../utils/godot-process.js';
|
|
8
8
|
import { isProcessAlive, sendGracefulShutdown, sendForceKill, waitForExit, } from '../utils/godot-shutdown.js';
|
|
9
|
+
import { resolveSessionConnection } from '../utils/connection.js';
|
|
10
|
+
import { createGodotSession } from '../lib/session.js';
|
|
9
11
|
const DEFAULT_TIMEOUT_SECONDS = 30;
|
|
10
12
|
/** Resolve the project path argument to an absolute, canonical path. */
|
|
11
13
|
export function resolveCloseProjectPath(positionalPath, cwd) {
|
|
@@ -50,6 +52,10 @@ export const closeCommand = new Command('close')
|
|
|
50
52
|
.argument('[path]', 'Path to the Godot project (defaults to current directory)')
|
|
51
53
|
.option('--timeout <seconds>', `Polite-quit timeout in seconds (default: ${DEFAULT_TIMEOUT_SECONDS})`, String(DEFAULT_TIMEOUT_SECONDS))
|
|
52
54
|
.option('--force', 'Hard-kill the editor if it does not exit within --timeout')
|
|
55
|
+
.option('--owned-only', 'Close only an editor started by godot-cli (exec / open --headless); never a user editor')
|
|
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())
|
|
58
|
+
.option('--token <token>', 'With --owned-only: bearer token (default: GODOT_MCP_TOKEN)')
|
|
53
59
|
.action(async (positionalPath, options) => {
|
|
54
60
|
const projectPath = resolveCloseProjectPath(positionalPath, process.cwd());
|
|
55
61
|
verbose(`close invoked for project: ${projectPath}`);
|
|
@@ -66,6 +72,11 @@ export const closeCommand = new Command('close')
|
|
|
66
72
|
ui.error(`Invalid --timeout value: "${options.timeout}". Must be a positive integer (seconds).`);
|
|
67
73
|
process.exit(1);
|
|
68
74
|
}
|
|
75
|
+
if (options.ownedOnly) {
|
|
76
|
+
// The local port is derived from the path as typed (exec / open --headless do not resolve links either).
|
|
77
|
+
await closeOwned(path.resolve(positionalPath ?? process.cwd()), timeoutSeconds, options);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
69
80
|
const platform = nodePlatform();
|
|
70
81
|
const pid = resolveEditorPid(projectPath);
|
|
71
82
|
if (pid === null) {
|
|
@@ -109,4 +120,32 @@ export const closeCommand = new Command('close')
|
|
|
109
120
|
spinner.error(`Godot editor (PID ${pid}) is still alive after force-kill`);
|
|
110
121
|
process.exit(1);
|
|
111
122
|
});
|
|
123
|
+
/**
|
|
124
|
+
* `close --owned-only`: ask the editor named by our lease (`.ai-game-dev/session.json`) to save and quit through
|
|
125
|
+
* its plugin (a windowless editor gets no WM_CLOSE). Anything else — no lease, a stale lease, a user's editor — is
|
|
126
|
+
* left alone.
|
|
127
|
+
*/
|
|
128
|
+
async function closeOwned(projectPath, timeoutSeconds, options) {
|
|
129
|
+
let session;
|
|
130
|
+
try {
|
|
131
|
+
session = createGodotSession({ projectPath, ...resolveSessionConnection(options) }).session;
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
ui.error(err instanceof Error ? err.message : String(err));
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
const spinner = ui.startSpinner('Closing the editor started by godot-cli...');
|
|
138
|
+
const result = await session.closeOwned({ timeoutMs: timeoutSeconds * 1000, force: options.force === true });
|
|
139
|
+
switch (result.kind) {
|
|
140
|
+
case 'closed':
|
|
141
|
+
spinner.success(`Godot editor (PID ${result.pid}) ${result.forced ? 'force-killed' : 'closed'}`);
|
|
142
|
+
return;
|
|
143
|
+
case 'not-owned':
|
|
144
|
+
spinner.success(`No editor started by godot-cli is running for ${projectPath}${result.staleLeaseRemoved ? ' (removed a stale lease)' : ''}`);
|
|
145
|
+
return;
|
|
146
|
+
case 'still-running':
|
|
147
|
+
spinner.error(`Godot editor (PID ${result.pid}) is still running after ${timeoutSeconds}s` + (options.force ? '' : '; re-run with --force'));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
112
151
|
//# sourceMappingURL=close.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"close.js","sourceRoot":"","sources":["../../src/commands/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,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,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7G,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO,CAAC,OAAO,CAAC,qBAAqB,MAAM,CAAC,GAAG,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACjG,OAAO;QACT,KAAK,WAAW;YACd,OAAO,CAAC,OAAO,CAAC,iDAAiD,WAAW,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7I,OAAO;QACT,KAAK,eAAe;YAClB,OAAO,CAAC,KAAK,CAAC,qBAAqB,MAAM,CAAC,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"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import * as ui from '../utils/ui.js';
|
|
4
|
+
import { verbose } from '../utils/ui.js';
|
|
5
|
+
import { DEFAULT_SESSION_IDLE_SECONDS, DEFAULT_SESSION_READY_TIMEOUT_MS } from '@baizor/gamedev-cli-core';
|
|
6
|
+
import { resolveAndValidateProjectPath, resolveSessionConnection } from '../utils/connection.js';
|
|
7
|
+
import { parsePositiveIntFlag } from '../utils/input.js';
|
|
8
|
+
import { DEFAULT_EXEC_TIMEOUT_MS, execCode, readToolResponse } from '../lib/exec.js';
|
|
9
|
+
import { buildFailureMessage } from './run-tool-builder.js';
|
|
10
|
+
function collect(value, previous) {
|
|
11
|
+
return [...previous, value];
|
|
12
|
+
}
|
|
13
|
+
function readCode(code, file) {
|
|
14
|
+
if (code !== undefined && file !== undefined)
|
|
15
|
+
throw new Error('Pass the code either as an argument or with --file, not both.');
|
|
16
|
+
if (code !== undefined)
|
|
17
|
+
return code;
|
|
18
|
+
const fromStdin = file === '-' || (file === undefined && !process.stdin.isTTY);
|
|
19
|
+
if (!fromStdin && file === undefined)
|
|
20
|
+
throw new Error('No code given: pass it as an argument, with --file <file>, or on stdin.');
|
|
21
|
+
const text = fs.readFileSync(fromStdin ? 0 : file, 'utf-8');
|
|
22
|
+
if (text.trim() === '')
|
|
23
|
+
throw new Error(fromStdin ? 'No code received from stdin.' : `The file is empty: ${file}`);
|
|
24
|
+
return text;
|
|
25
|
+
}
|
|
26
|
+
export const execCommand = new Command('exec')
|
|
27
|
+
.description('Run C# in the Godot editor; starts a headless editor when none is open and keeps it warm')
|
|
28
|
+
.argument('[code]', 'C# snippet: statements, the last expression is the result')
|
|
29
|
+
.option('--path <path>', 'Godot project path (default: current directory)')
|
|
30
|
+
.option('-f, --file <file>', 'Read the code from a file ("-" for stdin)')
|
|
31
|
+
.option('--using <namespace>', 'Extra namespace (repeatable)', collect, [])
|
|
32
|
+
.option('--include <path>', 'Helper .cs file or folder, relative to <project>/.ai-game-dev/snippets (repeatable)', collect, [])
|
|
33
|
+
.option('--window', 'Start the editor with a window instead of headless (only when none is running yet)')
|
|
34
|
+
.option('--idle <seconds>', 'An editor started by exec quits after this many idle seconds (0 = never)', String(DEFAULT_SESSION_IDLE_SECONDS))
|
|
35
|
+
.option('--ready-timeout <ms>', 'How long to wait for a started editor to become ready', String(DEFAULT_SESSION_READY_TIMEOUT_MS))
|
|
36
|
+
.option('--timeout <ms>', 'Tool call timeout in milliseconds', String(DEFAULT_EXEC_TIMEOUT_MS))
|
|
37
|
+
.option('--no-build', 'Do not build the C# assembly before starting an editor')
|
|
38
|
+
.option('--editor-path <path>', 'Explicit path to the Godot editor executable')
|
|
39
|
+
.option('--raw', 'Print the raw tool response JSON')
|
|
40
|
+
.option('--url <url>', 'Local MCP server URL (default: the project\'s local port)')
|
|
41
|
+
.option('--token <token>', 'Bearer token (default: GODOT_MCP_TOKEN)')
|
|
42
|
+
.action(async (codeArg, options) => {
|
|
43
|
+
const idleSeconds = parsePositiveIntFlag(options.idle, '--idle', true);
|
|
44
|
+
const readyTimeoutMs = parsePositiveIntFlag(options.readyTimeout, '--ready-timeout');
|
|
45
|
+
const timeoutMs = parsePositiveIntFlag(options.timeout, '--timeout');
|
|
46
|
+
let code;
|
|
47
|
+
try {
|
|
48
|
+
code = readCode(codeArg, options.file);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
ui.error(err instanceof Error ? err.message : String(err));
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const projectPath = resolveAndValidateProjectPath(undefined, { path: options.path });
|
|
55
|
+
const spinner = options.raw ? null : ui.startSpinner('Connecting...');
|
|
56
|
+
const result = await execCode({
|
|
57
|
+
projectPath,
|
|
58
|
+
code,
|
|
59
|
+
usings: options.using,
|
|
60
|
+
include: options.include,
|
|
61
|
+
window: options.window === true,
|
|
62
|
+
build: options.build !== false,
|
|
63
|
+
idleSeconds,
|
|
64
|
+
readyTimeoutMs,
|
|
65
|
+
timeoutMs,
|
|
66
|
+
...resolveSessionConnection(options),
|
|
67
|
+
...(options.editorPath ? { editorPath: options.editorPath } : {}),
|
|
68
|
+
onStatus: (message) => {
|
|
69
|
+
verbose(message);
|
|
70
|
+
if (spinner)
|
|
71
|
+
spinner.text = message;
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
spinner?.stop();
|
|
75
|
+
if (result.kind === 'failure') {
|
|
76
|
+
if (options.raw && result.toolFailure?.data !== undefined) {
|
|
77
|
+
process.stdout.write(JSON.stringify(result.toolFailure.data));
|
|
78
|
+
}
|
|
79
|
+
else if (result.toolFailure && result.toolFailure.reason !== 'http-error') {
|
|
80
|
+
// Timeout, refused, reset: the same hints as run-tool.
|
|
81
|
+
const failure = result.toolFailure;
|
|
82
|
+
ui.error(buildFailureMessage(failure, { toolName: 'script-execute', endpoint: failure.endpoint, raw: false, timeoutMs, errorNoun: 'tool' }));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
ui.error(result.message);
|
|
86
|
+
}
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
verbose(`Ran on ${result.baseUrl} (editor: ${result.editor})`);
|
|
90
|
+
if (options.raw) {
|
|
91
|
+
process.stdout.write(typeof result.data === 'string' ? result.data : JSON.stringify(result.data));
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const response = readToolResponse(result.data);
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
ui.error(response.text);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
console.log(response.text);
|
|
100
|
+
});
|
|
101
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../src/commands/exec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAkB5D,SAAS,OAAO,CAAC,KAAa,EAAE,QAAkB;IACh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,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;QAC/I,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,UAAU,MAAM,CAAC,OAAO,aAAa,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/D,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAClG,OAAO;IACT,CAAC;IACD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC,CAAC,CAAC"}
|
package/dist/commands/open.js
CHANGED
|
@@ -3,7 +3,10 @@ import * as path from 'path';
|
|
|
3
3
|
import * as ui from '../utils/ui.js';
|
|
4
4
|
import { verbose } from '../utils/ui.js';
|
|
5
5
|
import { openProject, resolveProjectPath as libResolveProjectPath, isGodotProjectDir as libIsGodotProjectDir, } from '../lib/open.js';
|
|
6
|
-
import { resolveOpenAuthToken } from '../utils/connection.js';
|
|
6
|
+
import { resolveOpenAuthToken, resolveSessionConnection } from '../utils/connection.js';
|
|
7
|
+
import { createGodotSession, ensureEditor } from '../lib/session.js';
|
|
8
|
+
import { parsePositiveIntFlag } from '../utils/input.js';
|
|
9
|
+
import { DEFAULT_SESSION_IDLE_SECONDS, DEFAULT_SESSION_READY_TIMEOUT_MS } from '@baizor/gamedev-cli-core';
|
|
7
10
|
/**
|
|
8
11
|
* Resolve the project path from the positional argument, `--path` option, or
|
|
9
12
|
* the current working directory when neither is provided. Re-exported for tests.
|
|
@@ -28,6 +31,9 @@ export const openCommand = new Command('open')
|
|
|
28
31
|
.option('--auth <option>', 'Auth option: None or Required (sets GODOT_MCP_AUTH_OPTION)')
|
|
29
32
|
.option('--mode <mode>', 'Connection mode: Cloud or Custom (sets GODOT_MCP_CONNECTION_MODE)')
|
|
30
33
|
.option('--log-level <level>', 'Log level: Trace/Debug/Info/Warning/Error/None (sets GODOT_MCP_LOG_LEVEL)')
|
|
34
|
+
.option('--headless', "Start a windowless editor on the project's local MCP server and wait until it is ready (reuses a running one)")
|
|
35
|
+
.option('--idle-timeout <seconds>', 'With --headless: the started editor quits after this many seconds without tool calls (0 = never)', String(DEFAULT_SESSION_IDLE_SECONDS))
|
|
36
|
+
.option('--ready-timeout <ms>', 'With --headless: how long to wait for the editor to become ready', String(DEFAULT_SESSION_READY_TIMEOUT_MS))
|
|
31
37
|
.action(async (positionalPath, options) => {
|
|
32
38
|
const { projectPath, usedCwdFallback } = resolveOpenProjectPath(positionalPath, options.path, process.cwd());
|
|
33
39
|
const fs = await import('fs');
|
|
@@ -59,6 +65,30 @@ export const openCommand = new Command('open')
|
|
|
59
65
|
ui.error('--mode must be "Cloud" or "Custom"');
|
|
60
66
|
process.exit(1);
|
|
61
67
|
}
|
|
68
|
+
if (options.headless) {
|
|
69
|
+
await openHeadless(projectPath, options);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
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).
|
|
74
|
+
let prepared;
|
|
75
|
+
try {
|
|
76
|
+
prepared = await createGodotSession({ projectPath, ...resolveSessionConnection({ token: options.token }) }).session.prepareWindowOpen();
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
ui.error(err instanceof Error ? err.message : String(err));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
if (prepared.kind === 'already-open') {
|
|
83
|
+
ui.success(`The editor started by godot-cli already runs with a window (PID ${prepared.pid})`);
|
|
84
|
+
process.exit(0);
|
|
85
|
+
}
|
|
86
|
+
if (prepared.kind === 'still-running') {
|
|
87
|
+
ui.error(`The headless editor started by godot-cli (PID ${prepared.pid}) did not quit; run \`godot-cli close --owned-only --force\`.`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
if (prepared.stoppedPid !== undefined)
|
|
91
|
+
verbose(`Closed the headless editor (PID ${prepared.stoppedPid})`);
|
|
62
92
|
// In Cloud mode with no explicit --token / GODOT_MCP_TOKEN, inject the
|
|
63
93
|
// token persisted by `godot-cli login` so `open --mode Cloud` auto-connects.
|
|
64
94
|
const authToken = await resolveOpenAuthToken(projectPath, { token: options.token, mode: options.mode });
|
|
@@ -151,4 +181,33 @@ export const openCommand = new Command('open')
|
|
|
151
181
|
}
|
|
152
182
|
verbose(`Resolved project path: ${path.resolve(result.projectPath)}`);
|
|
153
183
|
});
|
|
184
|
+
/** `open --headless`: a ready windowless editor on the project's local server (cli-core EditorSession). */
|
|
185
|
+
async function openHeadless(projectPath, options) {
|
|
186
|
+
const idleSeconds = parsePositiveIntFlag(options.idleTimeout, '--idle-timeout', true);
|
|
187
|
+
const readyTimeoutMs = parsePositiveIntFlag(options.readyTimeout, '--ready-timeout');
|
|
188
|
+
const spinner = ui.startSpinner('Connecting...');
|
|
189
|
+
const result = await ensureEditor({
|
|
190
|
+
projectPath,
|
|
191
|
+
...resolveSessionConnection(options),
|
|
192
|
+
...(options.editorPath ? { editorPath: options.editorPath } : {}),
|
|
193
|
+
build: options.build !== false,
|
|
194
|
+
idleSeconds,
|
|
195
|
+
readyTimeoutMs,
|
|
196
|
+
onStatus: (message) => {
|
|
197
|
+
verbose(message);
|
|
198
|
+
spinner.text = message;
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
if (result.kind === 'failure') {
|
|
202
|
+
spinner.error(result.reason === 'not-ready' ? 'The editor did not become ready' : 'Could not start the Godot editor');
|
|
203
|
+
ui.error(result.message);
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
const { ensured } = result;
|
|
207
|
+
const pid = ensured.lease?.pid;
|
|
208
|
+
const what = ensured.source === 'started' ? 'Started a headless Godot editor' : 'A Godot editor is already running for this project';
|
|
209
|
+
spinner.success(`${what}${pid !== undefined ? ` (PID ${pid})` : ''}; MCP server ready at ${ensured.ready}`);
|
|
210
|
+
if (ensured.source === 'started' && idleSeconds > 0)
|
|
211
|
+
ui.info(`It quits after ${idleSeconds}s without tool calls.`);
|
|
212
|
+
}
|
|
154
213
|
//# sourceMappingURL=open.js.map
|
|
@@ -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,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file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EAAE,OAAO,CAAC,KAAK,KAAK,KAAK;QAC9B,WAAW;QACX,cAAc;QACd,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE;YACpB,OAAO,CAAC,OAAO,CAAC,CAAC;YACjB,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC;QACzB,CAAC;KACF,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import type { RunToolOptions, RunToolResult } from '../lib/types.js';
|
|
2
|
+
import type { RunToolFailure, RunToolOptions, RunToolResult } from '../lib/types.js';
|
|
3
3
|
interface BuilderOptions {
|
|
4
4
|
/** CLI subcommand name, e.g. `'run-tool'`. */
|
|
5
5
|
name: string;
|
|
@@ -21,5 +21,13 @@ interface BuilderOptions {
|
|
|
21
21
|
/** Library function — `runTool` or `runSystemTool`. */
|
|
22
22
|
invoke: (opts: RunToolOptions) => Promise<RunToolResult>;
|
|
23
23
|
}
|
|
24
|
+
export interface FailureContext {
|
|
25
|
+
toolName: string;
|
|
26
|
+
endpoint: string;
|
|
27
|
+
raw: boolean | undefined;
|
|
28
|
+
timeoutMs: number;
|
|
29
|
+
errorNoun: string;
|
|
30
|
+
}
|
|
24
31
|
export declare function buildRunToolCommand(cfg: BuilderOptions): Command;
|
|
32
|
+
export declare function buildFailureMessage(failure: RunToolFailure, ctx: FailureContext): string;
|
|
25
33
|
export {};
|
|
@@ -99,7 +99,7 @@ function handleFailure(failure, ctx) {
|
|
|
99
99
|
ui.error(`Failed to call ${ctx.errorNoun}: ${message}`);
|
|
100
100
|
process.exit(1);
|
|
101
101
|
}
|
|
102
|
-
function buildFailureMessage(failure, ctx) {
|
|
102
|
+
export function buildFailureMessage(failure, ctx) {
|
|
103
103
|
switch (failure.reason) {
|
|
104
104
|
case 'timeout':
|
|
105
105
|
return `${capitalize(ctx.errorNoun)} call timed out after ${ctx.timeoutMs / 1000} seconds: ${ctx.toolName}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tool-builder.js","sourceRoot":"","sources":["../../src/commands/run-tool-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AA2C/C,MAAM,UAAU,mBAAmB,CAAC,GAAmB;IACrD,OAA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AAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { createUpdateCommand } from './commands/update.js';
|
|
|
16
16
|
import { installPluginCommand } from './commands/install-plugin.js';
|
|
17
17
|
import { installExtensionCommand } from './commands/install-extension.js';
|
|
18
18
|
import { removePluginCommand } from './commands/remove-plugin.js';
|
|
19
|
+
import { execCommand } from './commands/exec.js';
|
|
19
20
|
import { configureStyledHelp, error as uiError, setVerbose } from './utils/ui.js';
|
|
20
21
|
import { checkForUpdate, isRunningViaNpx, printUpdateNotification } from './utils/update-check.js';
|
|
21
22
|
const require = createRequire(import.meta.url);
|
|
@@ -32,6 +33,7 @@ const subcommands = [
|
|
|
32
33
|
closeCommand,
|
|
33
34
|
configureCommand,
|
|
34
35
|
createProjectCommand,
|
|
36
|
+
execCommand,
|
|
35
37
|
installPluginCommand,
|
|
36
38
|
installExtensionCommand,
|
|
37
39
|
loginCommand,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,O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