Use this file to discover all available pages before exploring further.
clx is the full development toolchain for the CLS programming language. It handles everything you need during development: creating projects, running scripts, type-checking, packaging, launching a language server for editor integration, and managing dependencies. Use clx when you are writing, debugging, or building CLS code. For deploying or distributing a finished application without the development toolchain overhead, use clxr instead.
clx new is the recommended way to start every CLS project. It creates a well-formed directory layout and a valid cls.json manifest that all other subcommands rely on.
Syntax
clx new <name> [--lib]
Creates a new CLS project directory at <name>/ containing:
cls.json — project manifest with name, version, entry point, and dependency fields pre-filled
src/main.clsx — a minimal main entry point (omitted for library targets)
modules/ — empty directory reserved for installed dependencies
.gitignore — pre-configured to ignore modules/, dist/, and .cls-types/
Flag
Description
--lib
Create a library project; no src/main.clsx is generated and project.target is set to "library"
Examples
# Create an executable projectclx new my-app# Create a reusable libraryclx new my-lib --lib
After running clx new my-app the generated src/main.clsx looks like:
function main(args: String[]) -> int { print("Hello from CLS!"); return 0;}
Lexes, parses, and executes a CLS source file using the tree-walker interpreter. If no file argument is given, clx run reads the entry field from cls.json in the current directory and falls back through the candidate list main.clsx → src/main.clsx → mod.clsx → src/mod.clsx until a file is found.Everything after the -- separator is collected and passed to the program’s main(args: String[]) function.During execution the following modules are available in addition to the core stdlib (math, json, async): fs, http, and Lib (desktop node modules).Examples
# Run the project entry point defined in cls.jsonclx run# Run a specific fileclx run src/main.clsx# Pass arguments to main()clx run src/main.clsx -- --port 8080 --debug
Runs the CLS type checker without executing any code. Accepts a single .clsx file or a directory path. When given a directory, clx check recursively scans all .clsx files, skipping hidden directories and the modules/, dist/, and libs/ folders.For each file, clx check resolves imports recursively and registers their exported types as a prelude so that cross-file type references (e.g. a struct defined in another module) are correctly validated.Diagnostics are printed with severity, message, source location, the offending source line, and a ^ caret pointing to the exact column.
Flag
Description
--strict
Enable strict mode — incompatible assignments become hard errors instead of warnings
Examples
# Check a single fileclx check src/main.clsx# Check all .clsx files in the projectclx check .# Strict mode (errors on any type mismatch)clx check src/ --strict
Running clx check with no arguments checks the current directory. Pipe the output to a file or CI log — exit code 1 means at least one error was found.
Starts an interactive Read-Eval-Print Loop. Expressions are evaluated and their result is printed immediately. Statements (var, function, for, etc.) are executed and their bindings persist for the rest of the session.Type :salir, :q, or :exit to quit, or press Ctrl+C. Type :help to see the list of REPL commands.Example
clx repl# CLS 2.0 REPL (Ctrl+C o :salir para salir)
> var x = 40 + 2> x42> function greet(name: String) { print("Hello,", name); };> greet("world")Hello, world> :salir
If no file is provided, the entry field from cls.json is used. The default output path is dist/app.clsapp; the output directory is created automatically.The resulting .clsapp can be executed directly with clxr.
Flag
Description
-o <out>
Output path for the .clsapp file (default: dist/app.clsapp)
--out <out>
Long form of -o
Examples
# Build using cls.json entry, output to dist/app.clsappclx build# Build a specific fileclx build src/main.clsx# Build with a custom output pathclx build src/main.clsx -o release/myapp.clsapp
Starts the CLS Language Server Protocol (LSP) server. By default the server communicates over stdin/stdout, which is the mode used by the VS Code extension and most editors.The LSP server provides:
Real-time diagnostics (syntax errors and type errors)
Listen on a TCP address instead of stdin/stdout (e.g. 127.0.0.1:9876)
--silent / -s
Suppress the [clx lsp] ready startup message
Examples
# Start LSP on stdin/stdout (default — used by editors)clx lsp# Start LSP on a TCP socketclx lsp --tcp 127.0.0.1:9876# Suppress startup messageclx lsp --silent
Most editors connect to clx lsp automatically when you install the CLS extension. You only need to run it manually when testing or debugging the LSP connection.
Parses a .clsx source file and dumps the resulting Abstract Syntax Tree (AST) to stdout. Without --json the output is Rust’s debug ({:#?}) representation, suitable for quick inspection. With --json it uses the JSON backend and emits structured JSON, which is easier to process programmatically.
Flag
Description
--json
Emit the AST as JSON instead of debug text
Examples
# Debug text dumpclx ast src/main.clsx# Machine-readable JSONclx ast src/main.clsx --json# Pipe JSON AST into jq for queryingclx ast src/main.clsx --json | jq '.statements[0]'
Generates .type.json type-map files from .clsx and .clsi source files. Type maps describe all declarations in a file — functions (with signatures, parameter types, return types, and doc-comment metadata), variables, constants, structures, classes, interfaces, modules, namespaces, and imports. They are consumed by the VS Code extension to power autocompletion.When path is a directory, clx maptype processes all .clsx / .clsi files recursively, preserving the source directory structure inside the output directory. When path is a single file, one .type.json file is written.The default output directory is .cls-types.
Flag
Description
-o <dir>
Output directory for .type.json files (default: ./.cls-types)
--out <dir>
Long form of -o
--watch / -w
Watch mode — polls for changes every 2 seconds and regenerates modified files automatically
Examples
# Generate type maps for the whole projectclx maptype . -o .cls-types# Generate for a single fileclx maptype src/utils.clsx -o .cls-types# Watch mode for continuous editor feedbackclx maptype . -o .cls-types --watch
Add .cls-types to your .gitignore — type maps are generated artifacts, not source files.
Adds a dependency entry to cls.json. The package is recorded with the version constraint ^1.0.0. Run clx install afterward to actually download the package into modules/.Requires a cls.json in the current directory. Create one first with clx new.
Flag
Description
--dev
Record the package under devDependencies instead of dependencies
Examples
# Add a runtime dependencyclx add cls-colors# Add a development-only dependencyclx add cls-test --dev
Removes a dependency from both dependencies and devDependencies in cls.json. Both remove and rm are equivalent aliases. Returns exit code 1 if the package is not found in either section.Example
Downloads all packages listed in dependencies and devDependencies from the registry and places them in the modules/ directory. After installation, a cls.lock lockfile is written recording the registry URL and resolved package versions.The registry URL is resolved in this priority order: