Add a supported headless CLI for compiling, testing, validating, running, and exporting projects
What can't you do?
There is no supported, user-facing command-line interface for automating normal s&box project workflows.
I cannot reliably perform the following from a terminal or CI runner:
- Compile an
.sbprojand receive a meaningful exit code. - Run project tests with optional filters.
- Validate project configuration, scenes, assets, and resource references.
- Export a standalone build to a specified directory.
- Start a project in headless mode with a controlled lifetime.
- Execute a project-defined automation command.
- Request machine-readable diagnostics instead of parsing Editor logs.
- Cancel an operation or apply a timeout without killing processes manually.
There are some existing command-line pieces, but they do not provide a complete project automation interface:
sbox-dev -project <path>can open a project.-generatesolutionand-testexist for specific engine workflows.- Standalone applications support
-headless. - Console commands require an already-running process.
SboxBuildis primarily an engine build and deployment tool for contributors working on the s&box source tree.- The MCP server requires a running Editor and an MCP client.
Because these systems have different entry points and output behavior, project automation currently depends on launching the Editor, parsing logs, waiting for processes, and guessing whether an operation succeeded.
This makes it difficult to integrate s&box projects with CI services, build servers, pre-commit checks, IDE tasks, deployment scripts, and other development tools.
How would you like it to work?
Provide one documented and supported CLI entry point for project-level automation.
The exact executable name and syntax can follow existing s&box conventions, but the interface could look similar to:
sbox project compile --project path/to/game.sbproj
sbox project validate --project path/to/game.sbproj
sbox test --project path/to/game.sbproj --filter ExampleTests
sbox run --project path/to/game.sbproj --headless
sbox export --project path/to/game.sbproj --target windows --output ./build
sbox exec --project path/to/game.sbproj MyAutomation.BuildA smaller first version containing compile, test, and an extensible exec command would already cover most automation requirements.
Expected behavior:
- Commands must be non-interactive and must not display modal dialogs.
- The CLI must wait for compilation, validation, testing, or exporting to finish.
- Successful operations must return exit code
0. - Compilation errors, failed tests, invalid assets, and failed exports must return a non-zero exit code.
- Invalid arguments should use a distinct documented exit code.
- Diagnostics should be written to standard output and standard error.
--log-file <path>should optionally write the complete engine log.--jsonshould return stable machine-readable results for CI and external tooling.--timeout <duration>should prevent indefinitely hanging jobs.- Ctrl+C should cancel the operation and shut the engine down cleanly.
--helpand--versionshould work without loading a project.- Relative project paths should resolve consistently from the current working directory.
- Commands should produce the same compilation and validation results as opening the project in the Editor.
Project-defined automation should be supported through an explicit opt-in API. For example, an Editor-only static method could be marked with an attribute and invoked through sbox exec. Only explicitly exposed methods should be callable; arbitrary reflection over project code is not required.
The CLI and MCP server should share the same underlying engine services where possible. Compilation, scene validation, testing, and exporting should not have separate implementations for the Editor, CLI, and MCP.
The CLI must work without an MCP client and should not require an existing Editor instance. MCP could expose the same operations for interactive agents, while the CLI provides deterministic process execution for scripts and CI.
What have you tried?
I have investigated the existing command-line options and automation surfaces.
Launching sbox-dev with -project opens the requested project, but it remains an interactive Editor process without a documented completion contract for compilation, validation, or export.
-generatesolution handles one specific operation. -test is tied to the existing test mode, and there is no unified project-facing interface around it.
Running dotnet build on generated project files is not equivalent to an s&box project build. It does not cover the complete engine compilation environment, API whitelist checks, asset pipeline, scene validation, resource processing, or standalone export.
Console commands can automate some runtime behavior, but they require a running application and do not provide a reliable process lifecycle, structured output, or standardized exit codes.
The built-in MCP server is useful for interactively controlling an open Editor. It is not a practical replacement for a CLI in CI because it requires an Editor process, an MCP connection, tool discovery, and protocol calls before an operation can run.
Custom scripts can launch the Editor and parse its logs, but this depends on undocumented behavior and cannot reliably distinguish success, failure, a stalled compilation, or an Editor waiting on a modal dialog.
Additional context
Unity provides a useful precedent for this type of automation. Its Editor executable supports options such as:
Unity.exe -batchmode -nographics -quit \
-projectPath C:\Projects\Example \
-executeMethod BuildAutomation.Build \
-logFile -Unity also supports command-line test execution, build-target selection, custom static automation methods, log redirection, and process exit codes.
The important benefit is not matching Unity's exact argument names. The benefit is having a documented process contract:
- Start the engine with a specific project.
- Perform one requested operation.
- Write diagnostics to a predictable destination.
- Return an exit code.
- Exit without user interaction.
This enables:
- GitHub Actions and other CI systems.
- Automated testing before merging changes.
- Reproducible standalone builds.
- Nightly validation of projects and assets.
- IDE build and test tasks.
- Local pre-commit checks.
- Build farms and dedicated-server workflows.
- External tools that do not implement MCP.
- Easier reproduction of build failures.
This would complement the existing MCP server rather than replace it. MCP is appropriate for stateful interaction with a live Editor, scene editing, screenshots, and agent-driven workflows. A CLI is appropriate for deterministic build, test, validation, and export jobs.
The first implementation should remain narrowly scoped. A stable project loader, compilation command, test command, structured diagnostics, and correct exit behavior would establish the foundation. Additional commands could be added separately after that contract is proven.
Source: Facepunch/sbox-public