Commands
Structyl provides a unified command interface that works across all programming languages.
Standard Commands
| Command | Purpose | Example |
|---|---|---|
clean | Remove build artifacts | structyl clean rs |
restore | Install dependencies | structyl restore py |
check | Run all checks (lint + format) | structyl check go |
lint | Run linter | structyl lint rs |
format | Auto-format code | structyl format py |
format-check | Verify formatting | structyl format-check ts |
build | Build the project | structyl build rs |
test | Run tests | structyl test py |
bench | Run benchmarks | structyl bench go |
demo | Run demo code | structyl demo cs |
pack | Create package | structyl pack ts |
doc | Generate API docs | structyl doc rs |
Running Commands
On a Single Target
structyl <command> <target>
# Examples
structyl build rs
structyl test py
structyl clean goOn All Targets
structyl <command>
# Examples
structyl build # Build everything
structyl test # Test all languages
structyl clean # Clean everythingWith Arguments
Pass arguments to the underlying command:
structyl test py --verbose
structyl build rs --releaseUse -- to separate Structyl flags from command arguments:
structyl build rs -- --helpCommand Variants
Related commands use a colon (:) naming convention:
structyl build rs # Debug build
structyl build:release rs # Release build
structyl test py # All tests
structyl test:unit py # Unit tests onlyDefine variants in configuration:
{
"commands": {
"build": "cargo build",
"build:release": "cargo build --release",
"test": "cargo test",
"test:unit": "cargo test --lib"
}
}Meta Commands
Commands that operate on multiple targets:
| Command | Description |
|---|---|
structyl build | Build all targets (respects dependencies) |
structyl test | Test all language targets |
structyl clean | Clean all targets |
structyl ci | Run full CI pipeline |
CI Pipeline
The ci command runs a complete build pipeline:
structyl ciExecutes: restore → check → build → test
See CI Integration for details.
Utility Commands
| Command | Description |
|---|---|
structyl targets | List configured targets |
structyl release <version> | Set version and release |
structyl upgrade [version] | Manage pinned CLI version |
structyl config validate | Validate configuration |
structyl completion <shell> | Generate shell completion (bash, zsh, fish) |
Defining Commands
From Toolchain
Specify a toolchain to get standard commands:
{
"targets": {
"rs": {
"toolchain": "cargo"
}
}
}Override Commands
Customize specific commands:
{
"targets": {
"cs": {
"toolchain": "dotnet",
"commands": {
"test": "dotnet run --project MyLib.Tests"
}
}
}
}Explicit Commands
For targets without a toolchain:
{
"targets": {
"img": {
"type": "auxiliary",
"commands": {
"build": "python scripts/generate.py",
"clean": "rm -rf output/"
}
}
}
}Command Composition
Combine commands using arrays:
{
"commands": {
"check": ["lint", "format-check"],
"ci": ["restore", "check", "build", "test"]
}
}Array elements execute sequentially.
Command Objects
For commands needing custom working directory or environment:
{
"commands": {
"test": {
"run": "pytest",
"cwd": "tests",
"env": {
"PYTHONPATH": "."
}
}
}
}Variables
Use variables in commands:
{
"vars": {
"test_project": "MyLib.Tests"
},
"commands": {
"test": "dotnet run --project ${test_project}"
}
}Built-in variables:
${target}- Target slug${target_dir}- Target directory${root}- Project root${version}- Project version
Null Commands
Set a command to null to disable it:
{
"commands": {
"bench": null
}
}Running a null command succeeds with a warning.
Global Flags
| Flag | Description |
|---|---|
--docker | Run in Docker container |
--continue | Continue on errors |
--type=<type> | Filter by target type |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Command failed |
| 2 | Configuration error |
| 3 | Environment error |
Next Steps
- Toolchains - See toolchain command mappings
- CI Integration - Set up CI pipelines