MicroStudio

CLI reference

Every command, flag and exit code.

CLI reference

The CLI installs as microstudio, and as @microstudio/cli under the same package. It is the same binary either way.

microstudio — a local, headless Roblox development runtime
 
Usage: microstudio [<file.luau>] [-e <code>]        run a script, or prompt
       microstudio <dev|test|repl|run> [options]

Arguments are parsed by hand, with these rules:

  • The first token is treated as a command only when it does not start with -. A bare - is not a flag: it means "read the script from stdin".
  • A value flag accepts either --flag value or --flag=value.
  • Anything that is not a flag is a positional argument.

Global flags

FlagTypeEffect
-h, --helpbooleanprint the help text and exit 0
-v, --versionbooleanprint microstudio <version> and exit 0

The subcommands help and version do the same thing.

run

Runs a Luau file, a -e snippet, or stdin on a fresh world, with the full Roblox API available and nothing read from disk.

microstudio [<file.luau>] [-e <code>] [-]
microstudio run [<file.luau>] [-e <code>] [--interactive] [--watch]
                [--clock virtual|real] [--state-dir <path>]
FlagTypeDefaultEffect
<file.luau>positional—a script to run; a path that is not a file is an error
-positional—read the script from stdin
-e <code>, --eval <code>string—run one line of Luau
--interactivebooleanoffkeep the world running and prompt into it after the script finishes
--watchbooleanoffre-run the file when it changes (requires a file, not -e or stdin)
--clock virtual|realenumsee belowvirtual time, or wall time
--state-dir <path>pathsee state directorywhere simulated services keep their JSON

With no file, -e or -, MicroStudio starts a prompt instead — see The REPL.

Clock selection: a plain script runs on the virtual clock and finishes as fast as the CPU allows. --clock real selects wall time, and --interactive alone also selects wall time so the prompt and the script share a live clock. Passing --clock virtual forces virtual time.

Exit codes:

CodeMeaning
0the script (and the work it scheduled) completed without errors
1the script errored, or the run recorded an error
2no script exists at the given path

dev

Reads the Rojo project, loads the compiled Luau into a live DataModel and runs the server scripts. Runs until Ctrl-C, unless --once is given.

microstudio dev [dir] [--project <file>] [--services a,b]
                [--once] [--interactive] [--watch] [--clock virtual|real]
                [--timeout <seconds>] [--state-dir <path>]
FlagTypeDefaultEffect
[dir]positionalworking directorythe directory a Rojo project is searched from
--project <file>pathsearched for automaticallythe Rojo project file to read
--services <a,b>comma-separated namesthe server-side setwhich services to mount
--oncebooleanoffboot, drive for --timeout, then exit
--timeout <seconds>number0.1how long --once drives the project, in seconds
--interactivebooleanoffkeep running and prompt for Luau against the live world
--watchbooleanoffrestart the session when a mount or the project file changes
--clock virtual|realenumrealwall time, or virtual time that only moves on :advance
--state-dir <path>path<project>/.microstudiowhere simulated services keep their JSON

Exit codes:

CodeMeaning
0the session stopped with no recorded errors
1the run recorded one or more errors (this is what --once reports for CI)
2no Rojo project file was found

test

Finds the project's specs, gives each file its own world, and reports the result.

microstudio test [dir] [--project <file>] [--include <glob>] [--exclude <glob>]
                [--module path=file] [--services a,b] [--isolate]
                [--timeout <ms>] [--json] [--watch] [--tsconfig <file>]
                [--no-compile] [--state-dir <path>]
FlagTypeDefaultEffect
[dir]positionalworking directorywhere to look for specs, and the directory a Rojo project is searched from
--project <file>pathsearched for automaticallythe Rojo project to read
--include <glob>comma-separated globs**/*.spec.luau, **/*.spec.lua, **/*.test.luau, **/*.test.lua, and their .ts/.tsx spellingswhich files are specs
--exclude <glob>comma-separated globsthe compiled output directory and rbxts_includefiles the spec walk skips
--module path=filerepeatable by comma—inject a ModuleScript from a file, e.g. --module ReplicatedStorage.Counter=src/counter.luau
--services <a,b>comma-separated namesthe server-side setwhich services to mount when loading the project's instances
--isolatebooleanoffrebuild the world from the project before every test
--timeout <ms>number5000per-test watchdog, in milliseconds; 0 disables it
--jsonbooleanoffprint the whole report as JSON: { summary, files }
--watchbooleanoffre-run everything when a .lua/.luau/.ts file changes
--tsconfig <file>path<root>/tsconfig.jsonthe config TypeScript specs are compiled with
--no-compilebooleanoffskip running the project's rbxtsc; run an existing build
--state-dir <path>path<project>/.microstudio, or in memorywhere simulated services keep their JSON

Exit codes:

CodeMeaning
0every test passed, was skipped, or is a todo
1at least one test failed, or no spec files were found
2a compile or configuration failure (missing tsconfig.json, no roblox-ts compiler, an uncompiled spec, or a bad --module value)

See Writing tests for the DSL and the report format.

repl

Loads the project's instances and prompts for Luau, without running the project's scripts.

microstudio repl [dir] [--project <file>] [--services a,b]
                [--state-dir <path>]
FlagTypeDefaultEffect
[dir]positionalworking directorythe directory a Rojo project is searched from
--project <file>pathsearched for automaticallythe Rojo project file to load; with none, the prompt opens on a fresh world
--services <a,b>comma-separated namesthe server-side setwhich services to mount
--state-dir <path>path<project>/.microstudiowhere simulated services keep their JSON

repl always uses the virtual clock. It exits 0 when the prompt is quit.

Environment

VariableEffect
MICROSTUDIO_RUNTIME_BINuse this sidecar binary instead of the installed one; it must exist, or the driver fails loudly
MICROSTUDIO_TARGET_DIRcargo target directory to search for the sidecar
CARGO_TARGET_DIRsame, for redirected cargo output
MICROSTUDIO_STATE_DIRsame as --state-dir
MICROSTUDIO_PROJECT_DIRthe directory a hand-started sidecar appends .microstudio to
MICROSTUDIO_SECRET_<NAME>a secret HttpService:GetSecret can read