Skip to content

Toolchains

This document defines the built-in toolchain presets for Structyl.

Overview

A toolchain is a preset that provides default commands for a specific build ecosystem. Toolchains eliminate boilerplate by mapping Structyl's standard command vocabulary to ecosystem-specific invocations.

Usage

Specify the toolchain in target configuration:

json
{
  "targets": {
    "rs": {
      "type": "language",
      "title": "Rust",
      "toolchain": "cargo"
    }
  }
}

If toolchain is omitted, Structyl attempts auto-detection based on files in the target directory.

Auto-Detection

Structyl checks for marker files in order:

FileToolchain
Cargo.tomlcargo
go.modgo
deno.jsonc, deno.jsondeno
pnpm-lock.yamlpnpm
yarn.lockyarn
bun.lockbbun
package.jsonnpm
uv.lockuv
poetry.lockpoetry
pyproject.toml, setup.pypython
build.gradle.kts, build.gradlegradle
pom.xmlmaven
build.sbtsbt
Package.swiftswift
CMakeLists.txtcmake
Makefilemake
*.csproj, *.fsprojdotnet
Gemfilebundler
composer.jsoncomposer
mix.exsmix
stack.yamlstack
*.cabalcabal
dune-projectdune
project.cljlein
build.zigzig
rebar.configrebar3
DESCRIPTIONr

First match wins. Explicit toolchain declaration is recommended for clarity.

Standard Command Vocabulary

All toolchains implement this vocabulary:

CommandPurposeMutates
cleanRemove build artifactsYes
restoreInstall dependenciesYes
buildCompile/buildYes
testRun testsNo
checkStatic analysis (read-only)No
lintLinting onlyNo
formatAuto-fix formattingYes
format-checkVerify formattingNo
benchRun benchmarksNo
packCreate packageYes
docGenerate documentationYes

Commands not applicable to a toolchain are set to null (skipped).


Built-in Toolchains

cargo

Ecosystem: Rust

CommandImplementation
cleancargo clean
restore
buildcargo build
build:releasecargo build --release
testcargo test
test:unitcargo test --lib
test:integrationcargo test --test '*'
test:doccargo test --doc
check["lint", "format-check"]
lintcargo clippy -- -D warnings
formatcargo fmt
format-checkcargo fmt --check
benchcargo bench
packcargo package
doccargo doc --no-deps

dotnet

Ecosystem: .NET (C#, F#, VB)

CommandImplementation
cleandotnet clean
restoredotnet restore
builddotnet build
build:releasedotnet build -c Release
testdotnet test
test:releasedotnet test -c Release
checkdotnet format --verify-no-changes
lintdotnet format --verify-no-changes
formatdotnet format
format-checkdotnet format --verify-no-changes
bench
packdotnet pack
pack:releasedotnet pack -c Release
doc

go

Ecosystem: Go

CommandImplementation
cleango clean
restorego mod download
buildgo build ./...
testgo test ./...
test:verbosego test -v ./...
test:coveragego test -cover ./...
check["lint", "vet"]
lintgolangci-lint run
vetgo vet ./...
formatgo fmt ./...
format-checktest -z "$(gofmt -l .)"
benchgo test -bench=. ./...
pack
docgo doc ./...
  • Note: lint requires golangci-lint to be installed

npm

Ecosystem: Node.js (npm)

CommandImplementation
cleannpm run clean
restorenpm ci
buildnpm run build
testnpm test
test:coveragenpm run test:coverage
check["lint", "typecheck", "format-check"]
lintnpm run lint
typechecknpm run typecheck
formatnpm run format
format-checknpm run format:check
bench
packnpm pack
doc
  • Note: Assumes package.json defines corresponding scripts

pnpm

Ecosystem: Node.js (pnpm)

CommandImplementation
cleanpnpm run clean
restorepnpm install --frozen-lockfile
buildpnpm build
testpnpm test
test:coveragepnpm test:coverage
check["lint", "typecheck", "format-check"]
lintpnpm lint
typecheckpnpm typecheck
formatpnpm format
format-checkpnpm format:check
bench
packpnpm pack
doc

yarn

Ecosystem: Node.js (Yarn)

CommandImplementation
cleanyarn clean
restoreyarn install --frozen-lockfile
buildyarn build
testyarn test
test:coverageyarn test:coverage
check["lint", "typecheck", "format-check"]
lintyarn lint
typecheckyarn typecheck
formatyarn format
format-checkyarn format:check
bench
packyarn pack
doc

bun

Ecosystem: Bun

CommandImplementation
cleanbun run clean
restorebun install --frozen-lockfile
buildbun run build
testbun test
test:coveragebun test --coverage
check["lint", "typecheck", "format-check"]
lintbun run lint
typecheckbun run typecheck
formatbun run format
format-checkbun run format:check
bench
packbun pm pack
doc

python

Ecosystem: Python (pip/setuptools)

CommandImplementation
cleanrm -rf dist/ build/ *.egg-info **/__pycache__/
restorepip install -e .
buildpython -m build
testpytest
test:coveragepytest --cov
check["lint", "typecheck"]
lintruff check .
typecheckmypy .
formatruff format .
format-checkruff format --check .
bench
packpython -m build
doc
  • Note: Assumes ruff and mypy are installed

uv

Ecosystem: Python (uv)

CommandImplementation
cleanrm -rf dist/ build/ *.egg-info .venv/
restoreuv sync
builduv build
testuv run pytest
test:coverageuv run pytest --cov
check["lint", "typecheck"]
lintuv run ruff check .
typecheckuv run mypy .
formatuv run ruff format .
format-checkuv run ruff format --check .
bench
packuv build
doc

poetry

Ecosystem: Python (Poetry)

CommandImplementation
cleanrm -rf dist/
restorepoetry install
buildpoetry build
testpoetry run pytest
test:coveragepoetry run pytest --cov
check["lint", "typecheck"]
lintpoetry run ruff check .
typecheckpoetry run mypy .
formatpoetry run ruff format .
format-checkpoetry run ruff format --check .
bench
packpoetry build
doc

gradle

Ecosystem: JVM (Gradle)

CommandImplementation
cleangradle clean
restore
buildgradle build -x test
testgradle test
checkgradle check -x test
lintgradle check -x test
formatgradle spotlessApply
format-checkgradle spotlessCheck
bench
packgradle jar
docgradle javadoc
  • Note: Use ./gradlew if wrapper present

maven

Ecosystem: JVM (Maven)

CommandImplementation
cleanmvn clean
restoremvn dependency:resolve
buildmvn compile
testmvn test
checkmvn verify -DskipTests
lintmvn checkstyle:check
formatmvn spotless:apply
format-checkmvn spotless:check
bench
packmvn package -DskipTests
docmvn javadoc:javadoc
  • Note: format and format-check require the Spotless Maven plugin

make

Ecosystem: Generic (Make)

CommandImplementation
cleanmake clean
restore
buildmake
build:releasemake release
testmake test
checkmake check
lintmake lint
formatmake format
format-check
benchmake bench
packmake dist
docmake doc
  • Note: Assumes Makefile defines corresponding targets

cmake

Ecosystem: C/C++ (CMake)

CommandImplementation
cleancmake --build build --target clean
restorecmake -B build -S .
restore:releasecmake -B build -S . -DCMAKE_BUILD_TYPE=Release
buildcmake --build build
testctest --test-dir build
check
lintcmake --build build --target lint
formatcmake --build build --target format
format-checkcmake --build build --target format-check
bench
packcmake --build build --target package
doccmake --build build --target doc
  • Note: lint, format, and format-check require corresponding CMake targets to be defined

swift

Ecosystem: Swift

CommandImplementation
cleanswift package clean
restoreswift package resolve
buildswift build
build:releaseswift build -c release
testswift test
check
lintswiftlint
formatswiftformat .
format-checkswiftformat --lint .
bench
pack
doc

deno

Ecosystem: Deno (TypeScript/JavaScript)

CommandImplementation
clean
restoredeno install
build
testdeno test
test:coveragedeno test --coverage
check["lint", "typecheck"]
lintdeno lint
typecheckdeno check **/*.ts
formatdeno fmt
format-checkdeno fmt --check
benchdeno bench
docdeno doc

r

Ecosystem: R

CommandImplementation
cleanrm -rf *.tar.gz *.Rcheck/
restore
buildR CMD build .
testRscript -e "devtools::test()"
checkR CMD check --no-manual --no-tests *.tar.gz
check:fullR CMD check --as-cran *.tar.gz
lintRscript -e "lintr::lint_package()"
formatRscript -e "styler::style_pkg()"
format-checkRscript -e "styler::style_pkg(dry='on')"
bench
packR CMD build .
docRscript -e "roxygen2::roxygenise()"
  • Note: Requires devtools, lintr, styler, and roxygen2 packages

bundler

Ecosystem: Ruby (Bundler)

CommandImplementation
cleanbundle clean
restorebundle install
buildbundle exec rake build
testbundle exec rake test
test:coveragebundle exec rake test COVERAGE=true
check["lint"]
lintbundle exec rubocop
formatbundle exec rubocop -a
format-checkbundle exec rubocop --format offenses --fail-level convention
bench
packgem build *.gemspec
docbundle exec yard doc
publishgem push *.gem

composer

Ecosystem: PHP (Composer)

CommandImplementation
clean
restorecomposer install
build
testcomposer test
test:coveragecomposer test -- --coverage
check["lint"]
lintcomposer run-script lint
formatcomposer run-script format
format-checkcomposer run-script format:check
bench
doc
  • Note: Assumes composer.json defines corresponding scripts

mix

Ecosystem: Elixir (Mix)

CommandImplementation
cleanmix clean
restoremix deps.get
buildmix compile
testmix test
test:coveragemix test --cover
check["lint", "typecheck"]
lintmix credo
typecheckmix dialyzer
formatmix format
format-checkmix format --check-formatted
bench
docmix docs
publishmix hex.publish

sbt

Ecosystem: Scala (sbt)

CommandImplementation
cleansbt clean
restoresbt update
buildsbt compile
testsbt test
checksbt scalafmtCheck
lintsbt scalafmtCheck
formatsbt scalafmt
format-checksbt scalafmtCheck
bench
packsbt package
docsbt doc
publishsbt publish

cabal

Ecosystem: Haskell (Cabal)

CommandImplementation
cleancabal clean
restorecabal update
buildcabal build
testcabal test
checkcabal check
linthlint .
formatormolu --mode inplace $(find . -name '*.hs')
format-checkormolu --mode check $(find . -name '*.hs')
benchcabal bench
doccabal haddock
publishcabal upload
  • Note: lint requires hlint, format requires ormolu

stack

Ecosystem: Haskell (Stack)

CommandImplementation
cleanstack clean
restorestack setup
buildstack build
teststack test
check
lintstack exec -- hlint .
formatstack exec -- ormolu --mode inplace $(find . -name '*.hs')
format-checkstack exec -- ormolu --mode check $(find . -name '*.hs')
benchstack bench
docstack haddock
publishstack upload

dune

Ecosystem: OCaml (Dune)

CommandImplementation
cleandune clean
restoreopam install . --deps-only
builddune build
testdune runtest
check
lint
formatdune fmt
format-checkdune fmt --preview
bench
docdune build @doc

lein

Ecosystem: Clojure (Leiningen)

CommandImplementation
cleanlein clean
restorelein deps
buildlein compile
testlein test
checklein check
lintlein eastwood
formatlein cljfmt fix
format-checklein cljfmt check
bench
packlein jar
doclein codox
publishlein deploy clojars
  • Note: lint requires eastwood, format requires cljfmt, doc requires codox

zig

Ecosystem: Zig

CommandImplementation
clean
restore
buildzig build
build:releasezig build -Doptimize=ReleaseFast
testzig build test
check
lint
formatzig fmt .
format-checkzig fmt --check .
bench

rebar3

Ecosystem: Erlang (Rebar3)

CommandImplementation
cleanrebar3 clean
restorerebar3 get-deps
buildrebar3 compile
testrebar3 eunit
test:ctrebar3 ct
checkrebar3 dialyzer
lintrebar3 lint
formatrebar3 format
format-check
bench
packrebar3 tar
docrebar3 edoc
publishrebar3 hex publish

Custom Toolchains

Define custom toolchains in .structyl/config.json:

json
{
  "toolchains": {
    "my-toolchain": {
      "commands": {
        "build": "custom-build-tool compile",
        "build:release": "custom-build-tool compile --optimize",
        "test": "custom-build-tool test",
        "clean": "rm -rf out/"
      }
    }
  },
  "targets": {
    "custom": {
      "toolchain": "my-toolchain"
    }
  }
}

Extending Built-in Toolchains

json
{
  "toolchains": {
    "cargo-workspace": {
      "extends": "cargo",
      "commands": {
        "build": "cargo build --workspace",
        "test": "cargo test --workspace"
      }
    }
  }
}

The extends field inherits all commands from the base toolchain, with specified commands overridden.

Released under the MIT License.