CLI Reference
luxc is distributed as an alpha toolchain binary and can also be built from
source. The release zip includes install-lux-path.ps1, which installs the
compiler beside it into the user toolchain layout. Source builds can use the
same script with -LuxcPath .\compiler\target\release\luxc.exe.
With luxc on PATH, run commands as:
If luxc is not on PATH, use the explicit build output or installed user
entrypoint:
Official packages such as @lux/std are installed per project with
luxc init --std or luxc install.
Command Overview
All paths are read and written as UTF-8 text.
lex
Print tokens for one file:
Use this only when debugging parser or lexer behavior. Normal users should not need it.
parse
Parse one file and print the syntax tree:
This is useful when checking whether a new syntax form is recognized before lowering or codegen is implemented.
lint
Run syntax, resolver, module, and style checks without generating Lua:
lint reports diagnostics with source spans. It is the cheapest command to run
in editors and pre-commit checks.
Use local disables sparingly. If a rule is wrong for a whole project, configure the rule rather than scattering suppressions.
format
Check formatting:
Write formatting changes:
Formatter output is intended to preserve comments and keep Lux-specific syntax readable. Generated Lua formatting is controlled by the emitter, not this command.
build
Recursively compile .lux files under a source directory as isolated files and
preserve their source-relative paths in the output directory:
This is for gradual GLua integration where you want syntax improvements but do
not want Lux to generate a GMod loader tree. Each input file is compiled like
luxc compile, so imports, packages, exports, and realms are not resolved as a
project graph.
Add source maps and comments when debugging generated Lua:
init
Create a project skeleton:
Plain init is offline and writes an empty [dependencies] table. Add
--std when the project should install the official standard package set:
By default, init creates an addon-friendly GMod configuration:
Use --no-autorun when an existing entry point should include the generated
Lux loaders:
install
Add a direct package dependency and rewrite lux.lock:
Lux has no registry. The source passed with --from selects the package set:
github:owner/repo, a zip url, or a local path. For GitHub sources, pin the
selected package set with one of --tag, --branch, or --commit.
remove
Remove a direct dependency from lux.toml and rewrite lux.lock:
Transitive packages disappear naturally when no remaining direct dependency requires them. Removing a transitive-only package is rejected because it is not owned by the project manifest.
lock
Regenerate lux.lock from the current lux.toml:
This command does not search for newer versions. With Lux's registryless model,
version choice is the explicit source ref in the manifest; package versions in
lux.package.toml are compatibility checks for the selected package graph.
list
Print locked packages:
doctor
Inspect package manager state:
self
Install the current compiler into the user toolchain layout and make it the
global default. Release zips normally use install-lux-path.ps1 instead; this
command is mainly for explicit version management and source-build workflows:
The stable user entrypoint is ~/.lux/bin/luxc on Unix-like systems and
%USERPROFILE%\.lux\bin\luxc.exe on Windows. Installed compilers live under
~/.lux/toolchains/<version>/.
Install or update explicit versions:
Inspect and select installed versions:
Most projects use the global default. Pin only when a team or CI job needs a specific compiler:
lsp
Start the compiler-backed Language Server Protocol process:
Editors should launch this command from the compiler selected by the project or
user configuration. This keeps diagnostics, completions, package resolution,
and builds on the same luxc version.
compile
Compile one Lux file to Lua:
Emit source comments:
Emit a sidecar source map:
compile is for isolated examples and backend debugging. Use gmod build for
real addon projects so modules, packages, and realms are handled together.
map-error
Map a generated Lua location back to Lux source:
The input line/column should come from a GMod Lua stack trace or Lua syntax error. When source comments are disabled in production output, sidecar maps are the main way to recover Lux source locations.
gmod build
Build a GMod project from a manifest:
Build with explicit paths:
Preview the output plan without writing files:
gmod build performs module discovery, package resolution, realm splitting,
loader generation, source map generation, and diagnostics for the whole project.
--no-autorun disables only the addon-style forwarder under out/autorun; the
Lux loader tree and module registry are still emitted.
gmod package
Package a built addon with gmad.exe:
Add --run to actually invoke gmad. Without --run, Lux prints the package
plan so CI and release scripts can inspect it.
Packaging does not replace gmod build; it packages the addon layout produced
by the build step. --root is the package root passed to gmad; it is separate
from the build out path. Use --build-out only when the package command
should temporarily override the manifest build output.
gmod api update
Regenerate the bundled official GMod API database:
Use --offline only with an existing cache. --allow-failures is for parser
development and should not be used for release-quality bundled data.