CLI
The starstream binary is the unified entry point to the toolchain. It
exposes one single-file command (wasm) and three scan-based commands
(check, docs, build) plus the language server (lsp).
Run starstream --help for the auto-generated overview, or
starstream <command> --help for per-command flags.
See the language spec for the meaning of contract;,
path imports, and the workspace module graph these commands operate over.
Single-file: starstream wasm
starstream wasm -c <file> [--output-core PATH] [--output-component PATH]
[--output-wit PATH] [--output-binary-wit PATH]
[-M, --depfile PATH]
- Compiles one
.starfile. - The file is treated as a contract regardless of whether it declares
contract;. Path imports it pulls in still must NOT themselves declarecontract;— cross-contract imports remain a hard error. - Output flags follow the legacy single-file shape and write to whichever paths the caller specifies. Nothing is written automatically.
- Use this for one-off scripted compilation. For project-wide builds, see
starstream build.
Scan-based: starstream check, docs, build
starstream check [DIR] [-D | --deny-warnings]
starstream docs [DIR] [--pretty]
starstream build [DIR]
All three share the same shared-workspace-graph model:
-
Directory selection.
- With no
DIR: scan the current working directory. - With an explicit
DIR: scan exactly that directory. - The CLI does not walk up the filesystem looking for a marker file —
if you want a different scan root,
cdthere or pass it explicitly.
- With no
-
File discovery. Within the scan root the compiler recursively walks for
.starfiles. Hidden directories (.git,.vscode, …) and the conventionaltarget/andartifacts/directories are skipped. Every.starfile becomes a node in the workspace graph; path imports may pull in additional files outside the scan root, which join the graph too. Files containingcontract;are flagged as codegen entries. -
One graph, one typecheck. All three commands build the workspace graph once via
load_workspace, then runtypecheck_modulesover the whole graph in a single pass. Diagnostics are stamped with the module they originated in. Cross-contract import edges (any edge whose target declarescontract;) are rejected at graph-build time. -
Per-command work on top of the shared graph:
checkprints every diagnostic from the typecheck pass and exits non-zero if there are any errors (or any warnings under-D). The summary reports modules and contracts scanned.docsgenerates JSON per contract entry, writing it to<artifacts>/<filename-stem>/docs.json.buildrunscompile_contractonce percontract;entry. Each invocation walks only the subgraph reachable from that contract via path-import edges and emitscore.wasm,component.wasm,contract.wit, and a Make/Ninja-styledeps.d.
-
Artifacts location (
docsandbuild). Per-contract outputs land at<scan-dir>/artifacts/<filename-stem>/— i.e. directly under whatever directory you scanned (or cwd, if you passed noDIR).
Language server: starstream lsp
The language server uses the same shared-workspace-graph model:
- Pick a workspace root from the
workspaceFoldersthe editor announced duringinitialize. The first folder that contains the open file becomes the scan root (the deepest one wins when nested folders overlap). If the editor announced no folders, or none contain this file, fall back to the open file's parent directory. - Build one workspace graph via
load_workspace. This is the same graph the CLI scan-based commands build. - Locate the open file in the graph by canonical absolute path.
- If found, run
typecheck_modulesonce over the whole graph and surface diagnostics for the open file's module id only. Other files' diagnostics get published when those files are themselves analysed. - If the file isn't in the workspace graph (for example, it lives outside the scanned tree), or the workspace scan failed (cross- contract edge somewhere we don't own), fall back to a single-file graph rooted at the open file. This still goes through the multi- file pipeline, so W0002 doesn't fire.
- If found, run
The LSP only falls back to single-file typecheck_program when the
document URI isn't a filesystem path — i.e. the browser playground, or
untitled: / vscode-vfs: schemes. Single-file mode is the one place
where the W0002 path-import-ignored warning can
fire.
Other commands
starstream format(aliasfmt) — auto-format.starfiles in place. Takes one or more file/directory arguments.starstream explain <code>— show the long-form explanation for a diagnostic code (e.g.starstream explain E0050).