CLI Reference
veloxc is the command-line tool that scaffolds, builds, lints, and runs Velox applications — install it with cargo install veloxc. Every command on this page is verified against the CLI source; veloxc --help lists them, and veloxc <subcommand> --help is the authoritative flag reference.
Command summary
| Command | Purpose |
|---|---|
veloxc init <name> | Create a new Velox project with scaffolding |
veloxc build [input] | Build the current project, or compile a .vx component to Rust |
veloxc run | Build and run the current project |
veloxc dev | Start the dev server with file watching and hot reload |
veloxc lint [target] | Check .vx files for issues |
veloxc add component <name> | Generate a new component .vx file |
veloxc version | Show version and system info |
veloxc init <name>
Creates a complete, working project — not a stub. The scaffold is a todo list app with components, assets, and a build script, so everything is on screen from the first veloxc dev.
| Flag | Short | Default | Meaning |
|---|---|---|---|
--template <name> | -t | default | Project template. The flag is accepted; today every template value produces the same scaffold. |
--local <path> | (none) | (none) | Use the Velox workspace at <path> for path dependencies instead of git. |
The scaffold writes:
<name>/
├── Cargo.toml # velox-core/dom/style, velox-renderer (skia-native), veloxc build-dep
├── build.rs # compiles src/App.vx + imports via veloxc::build_cmd
├── README.md
├── assets/
│ ├── velox-logo.svg
│ └── velox-logo.png
└── src/
├── main.rs
├── App.vx
└── components/
├── Todos.vx TodoInput.vx TodoItem.vx
└── Confirm.vx Modal.vx
Dependency resolution, in order: --local <path> wins; otherwise the CLI walks up from the current directory looking for a Velox workspace (a velox-core/Cargo.toml), or uses the checkout the CLI itself was built in — either way the scaffold gets relative path dependencies. When no workspace is found it falls back to git dependencies pinned to the commit the CLI was built at, so a scaffold always compiles against tested code.
veloxc init counter
✅ Created Velox project: counter
📦 To get started:
cd counter
veloxc dev
veloxc build
veloxc run
✅ Created Velox project at: counter
📖 Next steps:
cd counter
veloxc dev
The scaffold writes
veloxccommands in its next-steps banner (line 21 of itsREADME.md). The CLI and the scaffold are consistent. The installed-CLI case (cargo install veloxc) is covered by theversion = "..."dependency branch:generate_cargo_tomldetectsrev == "unknown"(theVELOX_GIT_REV_FALLBACKsentinel) and emits plain version pins instead of an unresolvablerev = "unknown", which cargo rejects (revspec 'unknown' not found).
veloxc build [input]
Two modes, chosen by whether a positional input is given:
| Mode | Invocation | Behavior |
|---|---|---|
| Project build | veloxc build | cargo build for the current project |
| Component compile | veloxc build src/App.vx | Compile the .vx file and all imported components to Rust source |
| Flag | Short | Meaning |
|---|---|---|
--out-dir <dir> | -o | Output directory when compiling a .vx file (default target/velox-gen) |
--release | (none) | Release mode when building the current project |
The component compile is recursive: every component imported from <script setup> is parsed and compiled, one .rs file per component in the output directory. The root component is wrapped in a pub mod block (so include! in main.rs works), imported components are declared with #[path] attributes, and child-component styles are merged into the root stylesheet — scoped ones stay scoped. When run from a build script, cargo:rerun-if-changed directives are emitted for every .vx file read, so Cargo re-runs the build script when a component changes.
veloxc build src/App.vx -o target/velox-gen
[velox] Generated: target/velox-gen/app.rs
ℹ️ The generated .rs file is source code, not an executable.
veloxc run
Builds first when --release is passed, then runs the project. The app inherits your terminal.
| Flag | Meaning |
|---|---|
--release | Build in release mode before running |
veloxc run # debug build (existing binary is reused by cargo)
veloxc run --release # builds in release mode first, then runs
veloxc dev
Starts the dev server: file watching, rebuild on save, and the HMR channel that tells the running app to restart itself.
| Flag | Short | Default | Meaning |
|---|---|---|---|
--watch <dir> | -w | . | Watch directory (project root; builds with cargo run) |
--release | (none) | (none) | Release mode build |
There is no positional directory argument — the watch root is passed with --watch/-w. The server watches src/ and assets/ (roots that do not exist are skipped), binds 127.0.0.1:31313 for hot reload, and serves keyboard commands on stdin.
veloxc dev
The full workflow — what updates live, what restarts, the banner, the shortcuts, and inotify troubleshooting — is on Dev Workflow & HMR.
veloxc lint [target] [--fix]
Checks .vx files for issues. Three kinds of findings:
| Finding | Example | Severity |
|---|---|---|
| Parse errors | Unclosed {{, multiple root elements | Error — fails the command |
| Script-idiom warnings | Cell/RefCell usage where Ref is expected | Warning — advisory only |
| Parsed-but-unrendered CSS | visibility: hidden, box-shadow, transition | Warning — with the reason |
The target defaults to src and may be a single .vx file or a directory (walked recursively, .vx files only). CSS warnings are reported by file and rule index; unknown declarations are not flagged — the cascade filters those out silently, so vendor prefixes and custom properties stay quiet.
--fix applies the two auto-fixes — trailing whitespace on every line, and exactly one final newline. Parse errors are not auto-fixable: non-parseable files are reported as errors and left untouched.
veloxc lint src/App.vx
veloxc lint # every .vx under src/
veloxc lint --fix # …and fix whitespace issues
📊 Lint results: 8 files, 0 errors
veloxc add component <name>
Generates a new, self-contained component .vx file in src/components/. The name is normalized: my-counter, side_bar, and My Component all produce a PascalCase struct (SideBar), a matching PascalCase filename (SideBar.vx), and a kebab-case CSS class (side-bar). The name must start with a letter, and the file is never overwritten.
| Flag | Short | Default | Meaning |
|---|---|---|---|
--slots <NAME,NAME> | -s | header | Named slots to declare, comma-separated. The implicit default slot is always included. |
Slot names are folded to the form the SFC parser registers — footerBar and main_content are scaffolded as footer-bar and main-content — and default cannot be requested explicitly.
veloxc add component side-bar --slots header,footer
✅ Created component: src/components/SideBar.vx
Slots: default, header, footer
Fill one from a parent: <SideBar><template v-slot:header>…</template></SideBar>
(shorthand: <SideBar><template #header>…</template></SideBar>)
Import it from a parent component, e.g.:
import SideBar from './components/SideBar.vx'
veloxc version
veloxc version
velox 0.1.2
Edition: 2021
Platform: Linux
Note:
Edition: 2021is a fixed string from the CLI itself, not read from your project’s manifest.
Exit codes
| Code | Meaning |
|---|---|
0 | Success — also the code the app exits with when it receives an HMR FullReload |
1 | Any command failure: cargo build/run failure, SFC parse errors, lint findings (Lint failed with N errors), missing project, invalid names |
2 | Invalid usage (unknown flag, missing subcommand) — standard clap behavior |
A failing veloxc lint exits non-zero, so it drops straight into CI: veloxc lint src/ as a step fails the pipeline on the first parse error.
Environment variables
| Variable | Set by | Read by | Meaning |
|---|---|---|---|
VELOX_PATH | veloxc init --local | veloxc init | Workspace to link as path dependencies |
VELOX_HMR | veloxc dev (spawn) | the running app | 1 enables the HMR client; 0 disables it |
VELOX_HMR_PORT | veloxc dev (spawn) | the running app | Port of the dev server’s HMR listener (default 31313) |
VELOX_HEADLESS | you | the renderer | 1 forces offscreen rendering (no presentation) |
See also
- Dev Workflow & HMR —
veloxc devend to end. - Renderer — the HMR channel and rendering backends the CLI wires up.
- Template Syntax — what
veloxc lintchecks and whatveloxc buildcompiles.