mugon.net docs
CLI

Working with the CLI

The development loop, build scopes, CI/CD and staging.

The development loop

  1. mugon run install once, if your template has an install command.
  2. mugon dev and keep it running. It rebuilds when a file under watch-paths changes; reload your game tabs to pick up the new build.
  3. Test the multiplayer flow with two tabs: Start as host in one, Start as client in the other.
  4. Bump version in mugon.toml and run mugon publish.

Every version you publish is a new, separate version of your game, so you need a new version each time.

Fast dev builds, slow release builds

mugon dev runs the build command of the dev scope if there is one, and mugon publish runs the default one. Use this to keep the loop quick and still ship an optimised game. The bevy template does:

# mugon dev: no LTO, compiles quickly
[[command]]
name = "build"
scope = "dev"
command = "cargo build --release --target wasm32-unknown-unknown && ..."

# mugon publish: full LTO, much slower to compile
[[command]]
name = "build"
command = "cargo build --profile release-lto --target wasm32-unknown-unknown && ..."

Commands can also be limited to an operating system with os = "windows", "linux" or "darwin", which helps when a build step differs between machines.

Publishing from CI

Publish without an interactive login by giving the CLI the key directly. Either set the environment variable, which is never stored on disk:

MUGON_PROJECT_API_KEY=$MUGON_API_KEY mugon publish

or log in non-interactively first:

mugon login --project-id my-game --api-key $MUGON_API_KEY
mugon publish

Create a dedicated API key for CI in the game's Api Keys tab, with only the roles it needs, and keep it in your CI's secret store. You can set an expiry date on a key.

Staging

To use the staging platform, install the CLI from https://stage.mugon.net and point it at the staging API in ~/.mugon/config.toml:

mugon-net-api-url-override = "https://backend.stage.mugon.net/api/v1"

API keys belong to one environment, so create the game and its key on staging as well.

When something goes wrong

MessageWhat to check
no mugon.toml file foundRun the command in the project's root, or create a project with mugon init.
invalid API keyThe key is wrong, expired or was created for another game. Create a new one in Api Keys.
project '<id>' not foundThe id in mugon.toml has to match the game's name on mugon.net.
Command not foundmugon.toml has no [[command]] with that name, scope and operating system.
A publish check reports an SDK major mismatchjs-sdk-version in mugon.toml names another major than the @mugon/sdk in your build. See SDK versions.

On this page