Skip to content

Commands

Structyl provides a unified command interface that works across all programming languages.

Standard Commands

CommandPurposeExample
cleanRemove build artifactsstructyl clean rs
restoreInstall dependenciesstructyl restore py
checkRun all checks (lint + format)structyl check go
lintRun linterstructyl lint rs
formatAuto-format codestructyl format py
format-checkVerify formattingstructyl format-check ts
buildBuild the projectstructyl build rs
testRun testsstructyl test py
benchRun benchmarksstructyl bench go
demoRun demo codestructyl demo cs
packCreate packagestructyl pack ts
docGenerate API docsstructyl doc rs

Running Commands

On a Single Target

bash
structyl <command> <target>

# Examples
structyl build rs
structyl test py
structyl clean go

On All Targets

bash
structyl <command>

# Examples
structyl build    # Build everything
structyl test     # Test all languages
structyl clean    # Clean everything

With Arguments

Pass arguments to the underlying command:

bash
structyl test py --verbose
structyl build rs --release

Use -- to separate Structyl flags from command arguments:

bash
structyl build rs -- --help

Command Variants

Related commands use a colon (:) naming convention:

bash
structyl build rs           # Debug build
structyl build:release rs   # Release build

structyl test py            # All tests
structyl test:unit py       # Unit tests only

Define variants in configuration:

json
{
  "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:

CommandDescription
structyl buildBuild all targets (respects dependencies)
structyl testTest all language targets
structyl cleanClean all targets
structyl ciRun full CI pipeline

CI Pipeline

The ci command runs a complete build pipeline:

bash
structyl ci

Executes: restorecheckbuildtest

See CI Integration for details.

Utility Commands

CommandDescription
structyl targetsList configured targets
structyl release <version>Set version and release
structyl upgrade [version]Manage pinned CLI version
structyl config validateValidate configuration
structyl completion <shell>Generate shell completion (bash, zsh, fish)

Defining Commands

From Toolchain

Specify a toolchain to get standard commands:

json
{
  "targets": {
    "rs": {
      "toolchain": "cargo"
    }
  }
}

Override Commands

Customize specific commands:

json
{
  "targets": {
    "cs": {
      "toolchain": "dotnet",
      "commands": {
        "test": "dotnet run --project MyLib.Tests"
      }
    }
  }
}

Explicit Commands

For targets without a toolchain:

json
{
  "targets": {
    "img": {
      "type": "auxiliary",
      "commands": {
        "build": "python scripts/generate.py",
        "clean": "rm -rf output/"
      }
    }
  }
}

Command Composition

Combine commands using arrays:

json
{
  "commands": {
    "check": ["lint", "format-check"],
    "ci": ["restore", "check", "build", "test"]
  }
}

Array elements execute sequentially.

Command Objects

For commands needing custom working directory or environment:

json
{
  "commands": {
    "test": {
      "run": "pytest",
      "cwd": "tests",
      "env": {
        "PYTHONPATH": "."
      }
    }
  }
}

Variables

Use variables in commands:

json
{
  "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:

json
{
  "commands": {
    "bench": null
  }
}

Running a null command succeeds with a warning.

Global Flags

FlagDescription
--dockerRun in Docker container
--continueContinue on errors
--type=<type>Filter by target type

Exit Codes

CodeMeaning
0Success
1Command failed
2Configuration error
3Environment error

Next Steps

Released under the MIT License.