Closed PreviewCompiler source opens July 1, 2026. Playground and binary available today.Join Discord →
MetaScript

Compiler Commands

Reference for all msc (MetaScript Compiler) commands.

Global Options

These options work with all commands:

msc [command] [options]

Options:
  -h, --help       Show help
  -v, --version    Show version number
  -q, --quiet      Suppress non-error output
  --verbose        Show detailed output
  --color          Force colored output
  --no-color       Disable colored output

Commands

msc build

Compile MetaScript to the target backend.

msc build [entry] [options]

Arguments:

ArgumentDescriptionDefault
entryEntry file or directorysrc/

Options:

OptionDescriptionDefault
-t, --targetCompilation target (js, c, erlang)js
-o, --outDirOutput directorydist/
--releaseEnable optimizationsfalse
--sourceMapsGenerate source mapstrue
--minifyMinify output (JS only)false
--watchWatch for changesfalse

Examples:

# Build to JavaScript
msc build

# Build to C with optimizations
msc build --target=c --release

# Build specific file
msc build src/main.ms -o build/

# Watch mode
msc build --watch

msc run

Build and execute the program.

msc run [entry] [options] -- [args]

Options:

OptionDescriptionDefault
-t, --targetCompilation targetjs
--releaseEnable optimizationsfalse

Examples:

# Run with JavaScript
msc run src/main.ms

# Run with C backend
msc run --target=c src/main.ms

# Pass arguments
msc run src/main.ms -- --port 3000

msc check

Type-check without compiling.

msc check [files] [options]

Options:

OptionDescriptionDefault
--strictEnable strict modetrue
--no-warningsHide warningsfalse

Examples:

# Check all files
msc check

# Check specific file
msc check src/main.ms

# Check with all warnings
msc check --strict

msc test

Run tests.

msc test [pattern] [options]

Options:

OptionDescriptionDefault
-t, --targetCompilation targetjs
--watchWatch for changesfalse
--coverageGenerate coverage reportfalse
--filterFilter tests by name-
--parallelRun tests in paralleltrue

Examples:

# Run all tests
msc test

# Run tests matching pattern
msc test "user*"

# Run with coverage
msc test --coverage

# Filter by name
msc test --filter "should handle errors"

msc expand

Show macro expansion output.

msc expand <file> [options]

Options:

OptionDescriptionDefault
--macroExpand specific macro only-
--lineExpand macros at specific line-

Examples:

# Expand all macros in file
msc expand src/models.ms

# Expand specific macro
msc expand src/models.ms --macro derive

# Expand at line
msc expand src/models.ms --line 42

msc fmt

Format source code.

msc fmt [files] [options]

Options:

OptionDescriptionDefault
--checkCheck formatting onlyfalse
--writeWrite changes to filestrue
--configPath to config file-

Examples:

# Format all files
msc fmt

# Check formatting (CI)
msc fmt --check

# Format specific files
msc fmt src/main.ms src/utils.ms

msc lint

Run linter.

msc lint [files] [options]

Options:

OptionDescriptionDefault
--fixAuto-fix issuesfalse
--configPath to config file-

Examples:

# Lint all files
msc lint

# Lint and fix
msc lint --fix

# Lint specific directory
msc lint src/

msc init

Initialize a new project.

msc init [directory] [options]

Options:

OptionDescriptionDefault
--templateProject templatedefault
--nameProject namedirectory name

Templates:

  • default - Basic project
  • cli - CLI tool
  • lambda - AWS Lambda
  • otp - Erlang/OTP service
  • lib - Library package

Examples:

# Initialize in current directory
msc init

# Initialize with template
msc init my-cli --template cli

# Initialize library
msc init my-lib --template lib

msc add

Add dependencies.

msc add <packages...> [options]

Options:

OptionDescriptionDefault
-D, --devAdd as dev dependencyfalse

Examples:

# Add runtime dependency
msc add @metascript/http

# Add dev dependency
msc add -D @metascript/test

msc docs

Generate documentation.

msc docs [options]

Options:

OptionDescriptionDefault
-o, --outDirOutput directorydocs/
--serveServe docs locallyfalse

Examples:

# Generate docs
msc docs

# Generate and serve
msc docs --serve

msc repl

Start interactive REPL.

msc repl [options]

Options:

OptionDescriptionDefault
-t, --targetCompilation targetjs
--loadLoad file before starting-

Examples:

# Start REPL
msc repl

# Start with C backend
msc repl --target=c

# Load file first
msc repl --load src/utils.ms

Environment Variables

VariableDescription
MSC_TARGETDefault compilation target
MSC_OUT_DIRDefault output directory
MSC_CONFIGPath to config file
MSC_CACHE_DIRCompiler cache directory
MSC_NO_COLORDisable colored output

Exit Codes

CodeMeaning
0Success
1General error
2Type errors
3Configuration error
4Build error

Next Steps