Skip to content

Command line

RTypeEditor can create a project, a system, or a plugin from the terminal. The same functions live in Editor::CreateProject, Editor::CreateSystem, and Editor::CreatePlugin. With no arguments, the Gallery opens as usual.

Create a project

./RTypeEditor new <name> [--path <dir>] [--description <text>]

<name> is the window title. --path is the project directory; when omitted it is ./<name> in the current working directory. --description is stored in the Gallery list.

The command writes test.scene, project.json, assets/, and input.json. It also adds the project to the Gallery list and opens the editor on test.scene. The Gallery window is not shown.

The scene uses the project's name as its title, a 1280×720 window, 60 FPS, and a build executable name equal to the project name with spaces removed. main.cpp is not written; the editor generates it when you build.

If test.scene already exists, the command prints an error and does not open the editor. A project path already in the Gallery list is not added again.

Create a system

./RTypeEditor create system <Name> [--path <dir>]

<Name> is a C++ identifier. System is appended when the name does not already end with it, so Damage and DamageSystem both create DamageSystem.

--path is where the files are written; when omitted it is the current working directory. The command walks upward to find Engine/CMakeLists.txt (or an engine tree in the current folder) and updates that CMake so the new sources build.

  • Inside the engine: include/Systems/<Name>System.hpp, src/Systems/<Name>System.cpp, and entries appended to Engine/CMakeLists.txt.
  • Inside a Gallery project: system/<Name>System.hpp, system/<Name>System.cpp, plus system/build.cmake and system/rtype_scaffold_register.hpp for editor builds.

Rebuild after scaffolding. Existing files are left unchanged.

Create a plugin

./RTypeEditor create plugin <Name> [--path <dir>]

<Name> is a C++ identifier. Plugin is appended when the name does not already end with it. --path works the same as for create system.

In the engine tree, Health and HealthPlugin both create the usual include/ and src/ layout under Engine/. In a Gallery project they are created under system/ instead, with the same CMake and registration hooks as project systems.

MCP server

./RTypeEditor mcp
./RTypeEditor --mcp

Headless MCP server on stdin/stdout (JSON-RPC, one object per line). No Gallery and no window. Cursor launches this process; it is not a socket inside the open editor.

Tool calls load the scene, change the same registry the visual editor uses (CreateEntity, UI templates, SceneSerializer), and write the .scene back. Lua hook bodies go through attach_script. The model does not hand-write scene JSON.

If that scene is already open in the editor, reopen it after the tools run. Saving the open editor first would overwrite the file.

Engine logs go to stderr so they do not break the JSON on stdout. Use it only on a machine you trust: the tools can write scenes and scripts in the project folder.

Cursor .cursor/mcp.json (build the editor first):

{
  "mcpServers": {
    "rtype-author": {
      "command": "${workspaceFolder}/build/RTypeEditor",
      "args": ["mcp"],
      "env": {
        "RTYPE_ENGINE_ROOT": "${workspaceFolder}"
      }
    }
  }
}

On a multi-config build the binary may be build/Debug/RTypeEditor or build/Release/RTypeEditor.exe. RTYPE_ENGINE_ROOT is the repo root so lua_api can read Documentation/docs/lua/. RTYPE_PROJECT_FOLDER overrides the default project directory (otherwise the tool uses the projectFolder argument, or the process working directory).

Check it without Cursor:

cmake --build build --target McpCliTest
./build/McpCliTest

Exit status

A missing name, an unknown command, or an existing file prints an [ERROR] line and returns 1. Success prints an [INFO] line and returns 0. create returns after writing the files. new returns when the editor window closes.

Tests

cmake --build build --target ScaffoldRoundTrip
./build/ScaffoldRoundTrip
bash Tests/scaffold_integration.sh

Tests/scaffold_integration.sh exercises the CLI from a Gallery project folder and from Engine/, then compiles the generated sources (including an EDITOR_BUILD game target).

For a safe walkthrough that keeps everything under /tmp, run bash Tests/scaffold_cli_tmp.sh from the repository root. To exercise the real Engine/CMakeLists.txt, use bash Tests/manual_scaffold_cli.sh and remove the files it lists when you are done.

See also