Skip to content

CLI Reference

CLI Reference

The Thagore compiler (stage2.exe / thagore) provides a rich command-line interface for building, testing, fixing, and managing Thagore projects.

Usage

thagore <command> [options]
thagore <file.tg> [options] # shorthand for 'build'

Commands

build — Compile a Thagore source file

Terminal window
thagore build <input.tg> -o <output> [options]
FlagDescription
-o <path>Output file path (default: derived from input name)
--emit-llvmEmit LLVM IR (.ll) instead of linking a binary
--autofix=<mode>Enable autofix (safe, aggressive, or off)
--autofix-lock=<path>Lock file for autofix session (default: thagore.fix.lock)
--autofix-lock-strictStrict lock enforcement
--autofix-lockedOnly apply fixes from existing lock
--autofix-max-iterations=<n>Max autofix iterations (default: 3)
--autofix-max-files=<n>Max files to process (default: 10)
--autofix-workspaceRun autofix across entire workspace
--autofix-exclude=<pattern>Exclude files matching pattern

Examples:

Terminal window
# Basic build
thagore build examples/hello.tg -o hello.exe
# Shorthand (omit 'build' keyword)
thagore examples/hello.tg -o hello.exe
# Emit LLVM IR for inspection
thagore build examples/fib.tg --emit-llvm
# Build with safe autofix
thagore build src/app.tg -o app.exe --autofix=safe

test — Run test suites

Terminal window
thagore test [filter] [options]
FlagDescription
--workspace / --allDiscover and run all tests in workspace
--no-runCompile tests but don’t execute
--fail-fastStop on first failure
--jsonOutput results as JSON
--listList discovered tests without running
--package=<name> / -p <name>Filter by package name
--exclude=<pattern>Exclude tests matching pattern
--exclude-package=<name>Exclude entire packages
--message-format=<fmt>Output format: json or human

Examples:

Terminal window
# Run all workspace tests
thagore test --workspace
# Run tests matching a filter
thagore test test_syntax
# List available tests
thagore test --list --workspace

fix — Autofix code issues

Terminal window
thagore fix <subcommand> <entry.tg> [options]

Subcommands:

SubcommandDescription
doctorDiagnose issues without applying fixes
dry-runShow what fixes would be applied
applyApply fixes to source files
explainShow detailed explanations for each fix
rollback <session-id>Undo a previous fix session
FlagDescription
--level=<level>Fix aggressiveness (default: safe)
--workspace / --allFix across entire workspace
--lock=<path>Lock file path
--lock-strictStrict lock enforcement
--lockedOnly apply locked fixes
--exclude=<pattern>Exclude files
--max-files=<n>Max files to fix (default: 25)
--max-iterations=<n>Max fix iterations (default: 3)
--jsonJSON output

install — Toolchain management

Terminal window
thagore install toolchain [options]

Installs or updates the Thagore toolchain (LLVM, runtime ABI, etc.).

Global Options

FlagDescription
--help / helpShow help message
--version / versionShow compiler version