SPECTRALANG_

// DOCS NAVIGATION

CLI_REFERENCE

SOURCE: section 5 of 01-introducao.md + README essentials

SOURCE: section 5 of content/docs/reference/01-introducao.md

[ FROM THE REFERENCE ]

5. Interface de Linha de Comando / Command-Line Interface

PT-BR:
O CLI do SpectraLang (spectralang) oferece os seguintes comandos e opções:

EN-US:
The SpectraLang CLI (spectralang) provides the following commands and options:

Comandos / Commands

Comando / CommandDescrição PT-BRDescription EN-US
spectralang run <arquivo>Compila e executa via JITCompile and execute via JIT
spectralang compile <arquivo>Compila via JIT sem executarCompile via JIT without executing
spectralang check <arquivo>Verifica tipos sem compilarType-check only, no code generation
spectralang lint <arquivo>Executa verificações de lintRun lint checks
spectralang fmt <arquivo>Formata o código-fonteFormat source code
spectralang replInicia o REPL interativoStart the interactive REPL
spectralang new <nome>Cria um novo projetoScaffold a new project

Flags

FlagDescrição PT-BRDescription EN-US
--run / -rExecuta após compilar (JIT)Execute after compilation (JIT)
--emit-object <saída>Gera arquivo objeto AOTGenerate AOT object file
--no-optimize / -O0Desativa todas as otimizaçõesDisable all optimizations
-O1Constant folding ativadoConstant folding enabled
-O2Constant folding + eliminação de código morto (padrão)Constant folding + dead code elimination (default)
-O3Todas as otimizações agressivasAll aggressive optimizations
--dump-astExibe a árvore AST para debugPrint the AST for debugging
--dump-irExibe o IR para debugPrint the IR for debugging
--timings / -TColeta métricas de compilaçãoCollect compilation metrics
--summaryExibe sumário do pipeline por móduloShow per-module pipeline summaries
--verbose / -vDetalhes adicionais do buildPrint additional build details
--lintAtiva verificações de lintEnable lint checks
--allow <rule>Permite (suprime) uma regra de lintAllow (suppress) a lint rule
--deny <rule>Eleva uma regra de lint a erroEscalate a lint rule to error
--enable-experimental <feature>Compatibilidade com scripts antigos; sem gates ativosCompatibility no-op; no active experimental syntax gates

Exemplos de Uso / Usage Examples

# Executar um programa / Run a program
spectralang run hello.spectra

# Verificar tipos apenas / Type-check only
spectralang check meu_programa.spectra

# Compilar com otimização nível 2 / Compile with level-2 optimization
spectralang compile -O2 algoritmos.spectra

# Gerar arquivo objeto AOT / Generate AOT object file
spectralang compile --emit-object meu_programa.o programa.spectra

# Formatar o código / Format the code
spectralang fmt meu_arquivo.spectra

# Lint com saída JSON / Lint with JSON output
spectralang lint --json meu_arquivo.spectra

# Iniciar REPL / Start REPL
spectralang repl

Códigos de Saída / Exit Codes

Código / CodeSignificado PT-BRMeaning EN-US
0SucessoSuccess
64Erro de uso (argumentos inválidos)Usage error (invalid arguments)
65Erro de compilaçãoCompilation error
74Erro de I/OI/O error

SNAPSHOT: README.md — CLI Essentials table (maintained on the home page)

[ CLI ESSENTIALS — SNAPSHOT ]

COMMANDDESCRIPTION
spectralang compile <paths>Compile Spectra modules (default).
spectralang check <paths>Type-check modules and report diagnostics without executing.
spectralang run <paths>Compile modules and execute the entry point via JIT.
spectralang lint <paths>Run lint checks and report warnings or denied rules.
spectralang bench <paths>Compile with timing metrics and optional JSON report.
spectralang fmt <paths>Format Spectra source files.
spectralang replStart an interactive Spectra prompt.
spectralang new <path>Scaffold a new Spectra project.
spectralang package <action>Resolve, lock, build, publish, and consume packages.
spectralang release-infoReport CLI and package release channel metadata.