Command-Line Tool
Alia's command-line tool alia (CmdAlia) integrates project management, dependency installation, and Mods Space publishing.
Project Management
| Command | Description |
|---|---|
alia build | Compiles the project into build/<lang>/; if the @compileConfig declares a build Alias, it is interpreted and executed after compilation. Target language priority: CLI --lang:<value> > compiler.lang in config.json > default js (a notice is printed when neither is declared). The build preserves existing artifacts and caches, overwriting only the compiled output |
alia run | Compiles and runs the project; target language resolution follows the same rules as build. If the @compileConfig declares a run Alias, it is interpreted and executed; otherwise js/nodejs use node and rs uses cargo run |
alia clean | Cleans build artifacts and caches: by default removes the entire build/; alia clean --lang:<value> removes only the corresponding language directory |
alia create <name> | Creates a standard Alia project skeleton in ./<name>/ |
alia init [name] | Initializes a standard Alia project skeleton in the current directory (when name is omitted, the directory name is used) |
alia check | Performs static type checking on all .alia files; the exit code is 1 when errors exist |
alia format | Formats all .alia files |
alia start | Executes main.alia in interpreted mode |
Example of the notice shown when the target language is not explicitly declared:
Notice: no target language specified; using the default language 'js'.
Set "compiler": { "lang": "<language>" } in config.json, or pass an explicit target such as --lang:js, to silence this notice.
Creating a Project
alia create my-app # create a new project in ./my-app/
alia init # initialize in the current directory; the project name comes from the directory name
alia create my-app --version:'0.2.0' --author:'alice' --description:'demo' --license:'MIT'
Supported basic parameters: --version:<value>, --description:<value>, --author:<value>, --license:<value>; --force:true allows writing into a non-empty directory. The generated project contains config.json, main.alia, lib.alia, mods/, and an annotated .gitignore (ignoring build/ and mods/).
alia run / alia build support arbitrary --key:value parameters. They are injected by name into the run/build Alias declared by @compileConfig (outDir is always injected and cannot be overridden by a same-named argument). If an Alias parameter is declared as a nullable type (<Type? param>), a parameter that is not provided is bound to null instead of raising an error. Argument names are not built into the toolchain: each backend declares in params which names it consumes and interprets them on the override side; the compiler kernel pre-registers no argument at all.
--outDir:<value> selects the output directory directly (default <compiler.outDir>/<lang>). The toolchain consumes it itself, so it is never passed to the backend's run/build Alias.
Target-specific behavior is declared as data by the backend in @compileConfig, and the manager simply executes what the data says:
~ target name -> capability table: this target installs no third-party runtimes
targetCaps: *['web': *['noPackageManager': true]],
~ target name -> output directory
targetOutDir: *['web': './build/nodejs-web'],
~ target name -> step sequence: the web target owns its whole lifecycle and skips build
targetSteps: *['web': ['run']],
run: alias <String outDir> <String? filename> <String? target> -> {
import 'process' as process
let entry = 'main.js'
if Ok filename { if filename != '' { entry = filename } }
process.spawn 'node' with [entry] with *[cwd: outDir, stdio: 'inherit']
}
alia run --target:'web' # runs only the run step per targetSteps; artifacts land in targetOutDir
alia run # no target: the default build -> run sequence
alia build --outDir:'dist' # artifacts go straight to ./dist
Without --target, none of targetSteps/targetCaps/targetOutDir match and the default behavior applies.
Project Dependencies
| Command | Description |
|---|---|
alia add <package> | Adds a dependency and downloads it to mods/<name>@<version>/ |
alia remove <package> | Removes a dependency |
alia update | Checks and updates all dependencies to the latest versions |
Global Packages
| Command | Description |
|---|---|
alia install <package> | Installs a package globally into ~/.alia/packages/ |
alia uninstall <package> | Uninstalls a global package |
Package names may include a version: alia install foo@1.2.0; when the version is omitted, the latest version is resolved automatically.
Mods Space
| Command | Description |
|---|---|
alia space <url> | Sets the Mods Space address (persisted to ~/.alia/config.json) |
alia login | Logs in (stores the token in ~/.alia/config.json) |
alia logout | Logs out |
alia publish | Publishes the current project to Mods Space |
Before publishing, config.json must declare name and version, and alia login must have been executed.