git:20261016.cf84037 to git:20261017.26864a9
43 added, 71 removed. Audit A to A.
# AGENTS.md — Godot-AI-PhantomCamera
- A **Godot-MCP extension** wrapping the third-party [**Phantom
- Camera**](https://github.com/ramokz/phantom-camera) addon (Cinemachine-style virtual cameras). Shipped as a
- **source-only NuGet package** (`com.IvanMurzak.Godot.MCP.PhantomCamera`) that compiles inside the consumer's
- Godot project against the consumer's own GodotSharp. Created from
- [`Godot-AI-Tools-Template`](https://github.com/IvanMurzak/Godot-MCP/tree/main/templates/extension). The packaging recipe is
- the load-bearing detail — read `docs/source-only-nuget-recipe.md`.
-
- ## Addon-dependent (Class B) — the load-bearing rules
-
- Phantom Camera is a third-party GDScript addon whose classes are NOT in GodotSharp, and the package must not
- depend on it:
-
- - **No compile-time dependency.** Reference Phantom Camera classes **by string name only**, resolved at
- runtime. `dotnet build -c Debug` MUST exit 0 with the addon ABSENT (the no-dependency gate).
- - **Resolution:** Phantom Camera registers GDScript `class_name` types in the **global script-class list**,
- not `ClassDB`: resolve via `ProjectSettings.GetGlobalClassList()` + `GD.Load`. `ClassDB.ClassExists` returns
- `false` for a `class_name` type even when installed (the #1 trap).
- - **Presence gate first.** Every editor tool's first action inside `MainThread.Instance.Run(...)` checks
- `AddonInterop.GlobalClassExists(PhantomCameraNames.PhantomCamera3D)` and, when missing, returns the
- structured `installed: false` result (`AddonGateResult`) with an install hint — never a raw throw (an opaque
- HTTP 500 to the LLM).
- - **Names are the contract.** Drive addon objects via `GodotObject.Set/Get/Call` with GDScript **snake_case**
- member names (not C# PascalCase); enums are plain ints. Keep these name constants centralized in
- `Runtime/PhantomCamera/PhantomCameraEnums.cs` and unit-tested — there are no compile-time types to lean on.
- - The addon is **never** vendored, submoduled, or downloaded by this repo; installing it is the consumer's
- job. CI installs the pinned `ramokz/phantom-camera` @ `v0.11.0.2` into `testbed/addons/phantom_camera/` only
- for the e2e leg (`ADDON_*` in `.github/workflows/test.yml`).
+ A **Godot-MCP extension** for the third-party [**Phantom Camera**](https://github.com/ramokz/phantom-camera) addon
+ (Cinemachine-style virtual cameras), shipped as an **RQL module**: it adds no MCP tools, only what the core
+ `rql-query` / `rql-mutate` / `rql-schema` tools need to work with phantom cameras (the `phantomcamera` source with
+ validated mode calls and an agent guide rendered into the core `godot-rql` skill). A **source-only NuGet package**
+ (`com.IvanMurzak.Godot.MCP.PhantomCamera`) compiled inside the consumer's Godot project against the consumer's own
+ GodotSharp; the packaging recipe is in `docs/source-only-nuget-recipe.md`.
## Layout
- - `src/Godot-AI-PhantomCamera/` — the source-only package (`Godot.NET.Sdk`):
- - `Runtime/Tools/` — `Tool_PhantomCamera.cs` (the `[AiToolType]` partial class), `Tool_PhantomCamera.Ids.cs`
- (all tool-id consts, pinned by tests), and the pure-managed `Tool_PhantomCamera.Defaults.cs`.
- - `Runtime/Interop/` — `AddonInterop.cs` (name resolution + instantiation; entirely behind `#if TOOLS`,
- E2E-verified, never unit-tested), `AddonGate.cs` (the `AddonGateResult` shape + `NotInstalled(...)`
- factory; pure-managed, unit-tested).
- - `Runtime/PhantomCamera/` — `PhantomCameraEnums.cs` (`PhantomCameraNames` snake_case names + follow/look-at
- enum ints), `PhantomCameraDefaults`, `PhantomCameraInfo`; all unit-tested.
- - `Editor/Tools/` — one file per editor tool (`Tool_PhantomCamera.<Name>.cs`) + shared helpers in
- `Tool_PhantomCamera.Editor.cs`; all behind `#if TOOLS`.
- - `build/com.IvanMurzak.Godot.MCP.PhantomCamera.props` — source-injection props, auto-imported by NuGet in
- the consumer; MUST stay named `<PackageId>.props`.
- - `tests/Godot-AI-PhantomCamera.Tests/` — xUnit specs for the pure-managed sources only (no Godot binary).
- - `tests/e2e/` — live `run-tool` E2E: the tool list `e2e-tools.json`, driven by `run_tool_e2e.py`.
- - `testbed/PhantomCamera-Testbed.csproj` — consumer `Godot.NET.Sdk` project restoring the local-packed
- package; its `dotnet build` is the source-injection proof.
+ - `src/Godot-AI-PhantomCamera/Editor/Rql/` — the module:
+ - `PhantomCameraModule.cs` — the `IRqlModule` (Order 100, `#if TOOLS`): the `phantomcamera` source and the guide.
+ - `PhantomCameraApi.cs` (the source: `installed`, `hint`, `cameras`, `hosts`), `PhantomCameraRow.cs` (camera row;
+ `SetFollow` / `SetLookAt`), `PhantomCameraHostRow.cs`, `PhantomCameraScripts.cs` (global script classes of a
+ node) — `#if TOOLS`.
+ - `PhantomCameraNames.cs` (addon class / property names, install hint), `PhantomCameraModes.cs` (mode enums, names),
+ `PhantomCameraRules.cs` (validation) and `PhantomCameraGuide.cs` (the guide) — pure-managed, NOT behind `#if TOOLS`.
+ - `src/Godot-AI-PhantomCamera/build/com.IvanMurzak.Godot.MCP.PhantomCamera.props` — source-injection props,
+ auto-imported by NuGet in the consumer; MUST stay named `<PackageId>.props`.
+ - `tests/Godot-AI-PhantomCamera.Tests/` — xUnit (no Godot binary): rules and mode names, guide examples parse, the
+ module's view types (GodotSharp metadata, `TOOLS` defined), and the e2e manifest runs every guide example.
+ - `tests/e2e/e2e-tools.json` — the live calls (`rql-*`), driven by `scripts/extension_e2e.py` from the monorepo suite, which
+ installs the pinned addon (`extension.json` `testAddon`) and registers its `PhantomCameraManager` autoload.
+ - `testbed/PhantomCamera-Testbed.csproj` — consumer project restoring the local-packed package (injection proof).
- `commands/` — `bump-version`, `update-core`, `init` (`.ps1` + `.py`), `get-version.ps1`.
- CI and publishing are centralized in the monorepo; see `../../docs/EXTENSION-MONOREPO.md`.
- - `docs/` — `source-only-nuget-recipe.md` (the packaging recipe + consumer story); `ci.md` (workflows, version
- gate, multi-Godot matrix, NuGet publishing setup).
-
- ## Tools
-
- Ids live in `Runtime/Tools/Tool_PhantomCamera.Ids.cs` (the source of truth). Current tools:
- `phantomcamera-defaults` (pure-managed), `phantomcamera-host-create`, `phantomcamera-create`,
- `phantomcamera-set-follow`, `phantomcamera-set-look-at`, `phantomcamera-set-priority`, `phantomcamera-get`.
+ ## Critical invariants
- The addon **requires** a `PhantomCameraHost` companion (under the `Camera3D`), or a PhantomCamera does nothing
- — `phantomcamera-host-create` ensures one exists.
+ - **No compile-time dependency on Phantom Camera.** Its classes are GDScript `class_name`s: no C# type (so no adapter
+ can target them), not in ClassDB, `GetClass()` returns the native base. They are named by string only
+ (`PhantomCameraNames`) and recognized through the node's script chain against `ProjectSettings.GetGlobalClassList()`.
+ `dotnet build -c Debug` must pass with the addon absent, and configuring the module never touches Godot.
+ - **Rows are read-only views; plain writes go through `node`** (`get node | set props["priority"] = 50`): the
+ core's write, undoable, marks the scene unsaved. Creation is the core `AddChild` (global script classes).
+ - **`SetFollow` / `SetLookAt`** validate everything (`PhantomCameraRules`) before writing, set the mode BEFORE the
+ target (the addon's target setters return early while the mode is None) and verify the target took. They are calls
+ on the row, so they are NOT undoable: they call `MarkSceneAsUnsaved` themselves — keep that documented.
+ - **Absent addon:** `installed` false, `hint` = the install hint, empty lists; never throw.
+ - Every guide example runs, in order, in `tests/e2e/e2e-tools.json` (xUnit-asserted). The module uses only Godot,
+ `com.IvanMurzak.Rql` and the BCL, never core-addon types (the authoring build has no core).
## Build / test (no Godot binary, addon absent)
```bash
- dotnet build src/Godot-AI-PhantomCamera/Godot-AI-PhantomCamera.csproj # source-only package compiles tools
+ dotnet build src/Godot-AI-PhantomCamera/Godot-AI-PhantomCamera.csproj -c Debug # the module (#if TOOLS included)
dotnet test tests/Godot-AI-PhantomCamera.Tests/Godot-AI-PhantomCamera.Tests.csproj
- dotnet pack src/Godot-AI-PhantomCamera/Godot-AI-PhantomCamera.csproj -p:Version=0.0.0-ci -o local-nuget
- dotnet build testbed/PhantomCamera-Testbed.csproj # consumes the local package (injection proof)
```
- `Godot.NET.Sdk` supplies GodotSharp from NuGet, so build/test/pack and the source-injection proof need no
- Godot install (the testbed build is a faithful proxy for `godot --build-solutions`). CI proves the recipe
- across Godot 4.4 / 4.5 (the central monorepo SDK matrix). `dotnet pack` reuses the **global NuGet cache**
- for an already-cached version: when re-packing the same `Version`, clear
- `~/.nuget/packages/com.ivanmurzak.godot.mcp.phantomcamera/<ver>` (or pack a unique version) before
- re-restoring the testbed, or you silently build the stale cached source.
+ The live suite (one headless editor for every module, the pinned addon installed) is
+ `python scripts/test_extensions.py` from the monorepo root (Godot 4.4+: `minGodotVersion`). `dotnet pack` reuses
+ the **global NuGet cache** for an already-cached version: when re-packing the same `Version`, clear
+ `~/.nuget/packages/com.ivanmurzak.godot.mcp.phantomcamera/<ver>` (or pack a unique version).
## Conventions
- - Root namespace `com.IvanMurzak.Godot.MCP.PhantomCamera`. Every `.cs` starts with the Apache-2.0 header.
- - Pure-managed code (tool ids, the `AddonGateResult` shape, name/enum-int constants, defaults) → `Runtime/`
- (outside `#if TOOLS`, unit-testable); editor-driving tools + `AddonInterop` → `#if TOOLS` (every Godot call
- via `MainThread.Instance.Run(...)`, E2E-verified).
- - The package declares ONLY the `com.IvanMurzak.McpPlugin` / `com.IvanMurzak.ReflectorNet` min-version deps;
- **GodotSharp and the Phantom Camera addon must never become a package dependency** (CI asserts the nuspec).
- Keep the MCP pins in lockstep with the core Godot-MCP addon; bump with `commands/update-core.ps1`.
- - One `[AiToolType] partial class Tool_PhantomCamera`; one `[AiTool]` method per partial-class file. Add every
- new pure-managed source to the test csproj `<Compile Include>` list so it is unit-tested.
+ - Root namespace `com.IvanMurzak.Godot.MCP.PhantomCamera`. Every `.cs` starts with the Apache-2.0 header and
+ `#nullable enable`.
+ - The package declares only the `com.IvanMurzak.McpPlugin` / `ReflectorNet` / `Rql` pins (equal to the core's); **GodotSharp and the
+ Phantom Camera addon must never become package dependencies** (CI asserts the nuspec). Bump them with
+ `commands/update-core.ps1`.