# Commands

> Every rmp command, read from the framework's own tool.

Source: https://omardev29.github.io/rmp-docs/reference/commands.html

Every `rmp` command, as `rmp help` describes it at the commit this site documents. `rmp help <command>` prints the same page in a terminal.

## For a game

### `rmp run [sudo|windows]`

Build the game in debug, then play it; only what changed is compiled again. On a Linux console with no desktop it builds for DRM/KMS (build/debug-drm/) and first checks that the game can open the screen and read the keyboard, saying what to do when it cannot; sudo builds as you and starts only the game as root. RMP_DRM=1 or 0 overrides what rmp decides.

| `rmp run` | build, then start the game |
|---|---|
| `rmp run sudo` | on a console: the game as root, the build as you |
| `rmp run windows` | on Linux: the Windows .exe, built and started under Wine |
| `rmp clean` | if a build goes strange, start from nothing |

### `rmp build [release|windows]`

Compile the game without running it: debug into build/debug/ by default, or release into build/release/ (optimised, reading ./resources/: the one next to the executable when there is one, as in a shipped package, and the working directory's otherwise — so run it from the project folder). Each has its folder: switching between them rebuilds nothing. On a Linux console with no desktop, build/debug-drm/ and build/release-drm/, for DRM/KMS. On Linux, `windows` builds the release .exe for Windows: with MinGW-w64 into build/windows/, or with `windows clang-cl` into build/windows-clang-cl/, against Microsoft's own C runtime, which xwin downloads into ~/.xwin (XWIN_DIR) the first time, once you accept Microsoft's licence.

| `rmp build` | writes build/debug/<name> |
|---|---|
| `rmp build release` | writes build/release/<name>, as CI ships it |
| `rmp build windows` | on Linux: build/windows/<name>.exe (MinGW-w64) |
| `rmp build windows clang-cl` | the same with clang-cl and lld-link |

### `rmp web`

Build build/web/<name>.html with Emscripten; activate the emsdk first, so that EMSDK is set.

| `rmp web` | writes build/web/<name>.html |
|---|---|
| `python3 -m http.server -d build/web` | then open localhost:8000/<name>.html |

### `rmp package [desktop|windows|web|android]`

Make, on this machine, the archive a release job would upload, into build/package/: the release binary, the resource pack and LICENSES.txt, packed with UPX where `[upx] asks`, zipped. desktop is this machine's own target; windows is the .exe made on Linux (add clang-cl for clang-cl); web is the page, zipped; android is the release .aab and .apk, signed with your upload key: set ANDROID_KEYSTORE_FILE, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS and ANDROID_KEY_PASSWORD.

| `rmp package` | build/package/<name>-<this machine's target>.zip |
|---|---|
| `rmp package windows` | build/package/<name>-windows-x64.zip, made on Linux |
| `rmp package web` | build/package/<name>-web.zip, ready to upload |
| `rmp package android` | build/package/<name>-android.aab and .apk, signed |

### `rmp android`

Build a debug APK with Gradle; it needs the Android SDK and NDK.

| `rmp android` | prints the APK it wrote |
|---|---|
| `adb install -r <apk>` | puts it on a connected phone |

### `rmp test [stage]`

Check the project. With no stage, every one of them; name a stage to run only that one.

| `rmp test` | everything |
|---|---|
| `rmp test smoke` | build, boot and see it draw |
| `rmp test config` | the .toml, the pinned versions, the licences |

Its stages, in the order `rmp test` runs them:

| Stage | Checks | In | In `rmp test` |
|---|---|---|---|
| `fmt` | every file is clang-format clean | framework | yes |
| `config` | the .toml, the pinned versions and every licence | game and framework | yes |
| `repo` | the index tracks sources, not build output | framework | yes |
| `seam` | nothing in src/rmp reads the clock, input or `rand()` itself | framework | yes |
| `workflows` | every reusable workflow gets what it asks for | framework | yes |
| `portable` | the scripts run on macOS's bash 3.2 and the BSDs | framework | yes |
| `shell` | no `A && B \|\| C` in the shell | framework | yes |
| `naming` | the names follow the convention, every #if branch | framework | yes |
| `style` | the style rules clang-tidy cannot see, every #if branch | framework | yes |
| `ownership` | nothing owned by hand: new/delete, raylib's Load*/Unload* | framework | yes |
| `pointers` | no raw pointer and no C string a game can name | framework | yes |
| `cppcheck` | cppcheck over src/rmp: no finding, each suppression says why | framework | yes |
| `headers` | every public header stands alone | framework | yes |
| `cost` | what each public header costs to include | framework | yes |
| `gates` | each tools/*_check.sh seen red on a planted mistake | framework | yes |
| `text` | every language `[lang] ships` has every text | game and framework | yes |
| `yarn` | every Yarn script compiles, against what the C++ registers | game and framework | yes |
| `text-tool` | rmp text's and rmp yarn's tools, each mistake seen | framework | yes |
| `configure` | tools/configure.py, every rejection | framework | yes |
| `rmp` | this command itself | framework | yes |
| `api` | the API-change gate: what a pull request changes of the API | framework | yes |
| `binaries` | the readers that judge a shipped .exe and Mac binary | framework | yes |
| `size` | every shipped binary has a size budget, and its reader works | framework | yes |
| `unit` | the unit tests in two orders, and tests/game/ | framework | yes |
| `unit` | your tests in tests/game/, with no window | game | yes |
| `layout` | the UI layout at four resolutions, headless | framework | yes |
| `property` | properties: RapidCheck on the C++, Hypothesis on the Python | framework | yes |
| `ui-render` | the UI on a real GPU: a hidden window, read back | framework | yes |
| `render` | draw a frame in software and check it | game and framework | yes |
| `smoke` | build the game, boot it, see it draw | game and framework | yes |
| `examples` | boot every example, play the platformer and the e2e scripts | framework | only by name |
| `sanitize` | the unit and layout tests again, under gcc's ASan and UBSan | framework | only by name |
| `fuzz` | every fuzz target built, and every committed input replayed | framework | only by name |
| `mutation` | Mull and mutmut against every floor (build image, hours) | framework | only by name |
| `coverage` | what the tests run of src/rmp, against its floors | framework | only by name |
| `render-update` | record the frame as the new golden hash | framework | only by name |
| `e2e-update` | record every e2e shot as its golden (inside the build image) | framework | only by name |

### `rmp fmt [check]`

Format your C and C++ with clang-format — the version pinned in thirdparty/FROZEN_VERSIONS.md.

| `rmp fmt` | rewrite what needs it |
|---|---|
| `rmp fmt check` | only report what it would change |

### `rmp pack`

Bundle resources/ into resources/resources.rres, encrypted, the way a release ships it.

| `rmp pack` | the game reads the pack from now on |
|---|---|
| `rmp unpack` | back to the loose files while you add art |

### `rmp text scan|check`

scan reads src/ and include/ for every literal the framework translates — the first argument of `rmp::ui`'s text functions and of `rmp::Text`, the .text, .placeholder and .items of a kept widget — the line ids of resources/**/*.yarn and what a debug build saw that the tables lack (build/debug/lang_seen.tsv), and adds a row to `[lang] file` for each that is not there. It never deletes a translation: a row nothing uses any more gets an x in its unused column. check fails on a text a language of `[lang] languages` lacks, a placeholder a translation lost or added, and a plural with the wrong number of forms; `rmp test` runs it.

| `rmp text scan` | add the new texts to resources/lang.tsv |
|---|---|
| `rmp text check` | what a translation lacks or got wrong |

### `rmp yarn check|ysls`

check compiles every resources/**/*.yarn with the framework's own compiler (rmp_yarnc --check), each error as file:line:column, with the types of the functions the C++ registers (on_function("name", [&](std::string s) -> bool {...})) told to it; a function a script calls that nothing registers is an error, a command nothing handles a warning. Name files to check only those. `rmp test` runs it. ysls writes rmp.ysls.json beside resources/: the commands and functions the C++ registers, typed and with the comment above each, which the Yarn Spinner extension for VS Code reads to complete and check them.

| `rmp yarn check` | every script, against the game's C++ |
|---|---|
| `rmp yarn check resources/intro.yarn` | one script |
| `rmp yarn ysls` | VS Code learns the C++ commands |

### `rmp unpack`

Delete resources/resources.rres, so that the game reads the loose files in resources/ again.

| `rmp unpack` | loose files again |
|---|---|
| `rmp pack` | bundle them again |

### `rmp clean`

Delete build/ — every build in it: debug, release, web and the rest — and every file generated from raylib_multiplatform.toml; the next build makes them again.

| `rmp clean` | everything, gone |
|---|---|
| `rmp run` | rebuild from nothing, and play |

### `rmp push [force]`

Run git push — refused while a CI run is in flight, because the push would cancel it; with `[ci] on_push` = false a push starts no run, and nothing is checked. The first push of a branch sets its upstream on origin.

| `rmp push` | push, or say which run it would kill |
|---|---|
| `rmp push force` | push anyway, and cancel the run |

### `rmp deploy VERSION`

Release a version: check it the way CI will, tag it, push the tag. CI builds every target and attaches them to the release.

| `rmp deploy 1.2.0` | tags v1.2.0 (the v is added) |
|---|---|
| `rmp deploy 1.2.0-rc1` | a pre-release, marked as one |
| `rmp push` | first, if your last commit is not on GitHub yet |

### `rmp new DIR`

Make a new game in DIR: a copy of what a game needs from this framework, named after the folder, ready to build and to ship.

| `rmp new my_game` | makes my_game/, here |
|---|---|
| `rmp new ~/games/space_rocks` | anywhere; the name is the folder's |
| `rmp new --list` | what a new game gets, without making one |

### `rmp install [force]`

Put this framework's rmp on your PATH: a link in ~/.local/bin, and a line in your shell's startup file only when that folder is not on PATH yet. On Windows, a shim in %LOCALAPPDATA%\Programs\rmp and that folder on your user PATH. Running it again changes nothing; force replaces another rmp that is in the way. The installer runs it for you.

| `rmp install` | link it, or say it already is |
|---|---|
| `rmp install force` | replace a different rmp that is in the way |
| `rmp help` | then, in a new terminal |

### `rmp update`

Update the framework that this rmp comes from: fetch origin and move main forward to it. A clone with changes of its own, on another branch or with commits origin does not have is refused, never merged. A game is not touched: it keeps the framework it was made with.

| `rmp update` | prints the commit before and after |
|---|---|
| `rmp new my_game` | a new game gets the updated framework |

### `rmp help [command]`

Show the commands, or one command in detail.

| `rmp help` | every command |
|---|---|
| `rmp help deploy` | one of them |
| `rmp help --json` | every command and test stage, for a tool to read |

## In the framework's own repository

### `rmp lint [fix]`

Run clang-tidy over src/, tests/ and examples/; a warning tools/lint_debt.txt does not owe fails.

| `rmp lint` | report |
|---|---|
| `rmp lint fix` | apply what clang-tidy is sure of, then format |

### `rmp example [name]`

Build and run one example from examples/, by name or by path.

| `rmp example` | list them |
|---|---|
| `rmp example 01_pong` | a bare name, when it is unique |
| `rmp example games/01_pong` | or the path under examples/ |
