Getting Started

Configuration

vary.toml

Every Vary project can have a vary.toml file at its root. The compiler searches upward from the current directory to find it. If no config file exists, defaults are used for everything.

Create one with:

vary init

Or view the active configuration with:

vary config --verbose

Minimal example

Most projects only need a few lines:

[project]
name = "my-app"
version = "0.1.0"

[source]
directories = ["src"]
test_directories = ["tests"]

Full reference

[project]

Project metadata. Used in build output and artifact naming.

FieldTypeDefaultDescription
nameStr"unnamed"Project name
versionStr"0.1.0"Version string (available as __project_version__ in code)
descriptionStr""Short description

[source]

Where the compiler looks for .vary files.

FieldTypeDefaultDescription
directoriesArray["src"]Source code directories
test_directoriesArray["tests"]Test file directories
excludesArray[]Patterns to skip during compilation

roots is accepted as an alias for directories.

[compiler]

Controls how code is compiled.

FieldTypeDefaultDescription
targetStr"17"JVM target version (e.g. "17", "21")
stdlibStrnullCustom path to stdlib (rarely needed)
output_dirStr"build"Where compiled output goes
warnings_as_errorsBoolfalseTreat warnings as errors
verboseBoolfalseVerbose compiler output
optimizationInt0Optimization level: 0 = none, 1 = basic, 2 = aggressive
debug_infoBooltrueInclude debug info in bytecode
strict_null_checksBooltrueEnforce null safety

[test]

Test execution settings.

FieldTypeDefaultDescription
parallelInt1Number of parallel test runners
coverageBoolfalseEnable coverage tracking
coverage_thresholdInt0Minimum coverage percentage (0 = no gate)
timeoutInt300Test timeout in seconds

[mutation]

Mutation testing settings used by vary mutate.

FieldTypeDefaultDescription
operatorsStr"all"Which mutation operators to apply, comma-separated or "all"
quick_limitInt20Maximum mutants in --quick mode
timeoutInt5000Per-mutant timeout in milliseconds
report_formatStr"text"Output format: "text", "html", or "json"
report_dirStr"mutation-reports"Where reports are written
min_scoreFloat0.0Minimum mutation score (0-100), fails the run if not met
fail_on_decreaseBoolfalseFail if mutation score dropped since last run
max_survivorsIntunlimitedMaximum allowed surviving mutants
pairing_modeStr"fallback_all_tests"How mutants are paired with tests: "fallback_all_tests" or "strict"
emit_manifestBooltrueEmit mutation manifest (.vary/mutation-manifest.json) during builds
max_pure_survivorsIntunlimitedMaximum surviving mutants in pure def regions
require_contracts_in_pureBoolfalseRequire contracts on pure functions touched by mutants
min_contract_killsInt0Minimum contract kills (PRE+POST+INVARIANT) required
min_contract_adequacyFloat0.0Minimum contract adequacy score (0-100)
allow_no_oracle_testsBoolfalseAllow tests without oracles (otherwise warned/errored)
min_integrityFloat0.0Minimum integrity score gate (0-100)

[validate]

Settings for vary validate.

FieldTypeDefaultDescription
contractsBoolfalseEnable structured contract violation reporting in test output

When contracts is true, contract violations detected during test execution are reported in a structured block showing the violation kind, function name, source location, and failing expression.

[format]

Code formatting settings used by vary fmt.

FieldTypeDefaultDescription
indent_sizeInt4Spaces per indent level
max_line_lengthInt100Maximum line length
use_spacesBooltrueSpaces instead of tabs
trailing_newlineBooltrueEnsure files end with a newline
sort_importsBooltrueSort and group import statements

[cache]

Controls the content-addressed artifact cache in .vary/artifacts/.

FieldTypeDefaultDescription
enabledBooltrueEnable caching
directoryStr".vary/artifacts"Cache directory path
max_size_mbInt500Maximum cache size in MB
max_age_daysInt30Evict artifacts older than this
eviction_policyStr"lru""lru" (least recently used), "lfu" (least frequently used), or "none"
auto_gcBooltrueRun garbage collection automatically
validate_on_loadBooltrueValidate artifacts before using them

[check]

Settings for vary check diagnostics.

FieldTypeDefaultDescription
profileStr"local"Check profile: "local" (default) or "ci" (JSON output, warnings as errors)
warningsStr"all"Warning mode: "all", "none", or "error"

[check.analysis]

FieldTypeDefaultDescription
broad_effects_thresholdInt3Warn if a function produces more than this many distinct effect classes

[check.effects]

FieldTypeDefaultDescription
denyArray[]Effect classes to forbid (e.g. ["PROCESS", "NETWORK"]). Functions producing denied effects are flagged as errors.

Available effect classes: IO, NETWORK, FILESYSTEM, PROCESS, STATE, CONCURRENCY, TIME, RANDOM.

[lsp]

Language server configuration.

FieldTypeDefaultDescription
enabledBooltrueEnable the LSP server
portInt0TCP port (0 = use stdio mode)
log_fileStrnullOptional path for LSP logs

[services]

Network host restrictions for service declarations (typed HTTP clients).

FieldTypeDefaultDescription
allowed_hostsArray[]Hosts the project may connect to (empty = all allowed)
denied_hostsArray[]Hosts explicitly blocked

Host patterns support wildcard subdomains: *.example.com matches api.example.com and foo.bar.example.com.

[services]
allowed_hosts = ["api.example.com", "*.internal.example.com"]
denied_hosts = ["untrusted.com"]

When allowed_hosts is non-empty, any service targeting a host not in the list is flagged by VCS008. Hosts in denied_hosts are always blocked.

[profiles.*]

Custom validation profiles for vary validate --profile <name>. Each profile defines which checks to run and their thresholds.

FieldTypeDefaultDescription
checksArray[]Stages to run (e.g., "check", "test", "mutation")
timeoutInt300Timeout in seconds

Thresholds are nested under [profiles.<name>.thresholds]:

[profiles.local]
checks = ["check", "test"]

[profiles.local.thresholds]
coverage = 70

[profiles.ci]
checks = ["check", "test", "mutation"]

[profiles.ci.thresholds]
coverage = 80
mutation = 80

[profiles.nightly]
checks = ["check", "test", "mutation"]
timeout = 600

[profiles.nightly.thresholds]
coverage = 90
mutation = 90

[dependencies]

Dependencies use a different format from other sections. Each dependency is a key-value pair where the key is the dependency name:

[dependencies]
my-lib = "1.0.0"
local-lib = { version = "2.0.0", path = "./libs/local-lib" }

The path form points to a local directory containing another Vary project with its own vary.toml.

Bigger example

A project that gates on mutation score and runs tests in parallel:

[project]
name = "my-api"
version = "0.2.0"
description = "Order management API"

[source]
directories = ["src"]
test_directories = ["tests"]
excludes = ["src/scratch"]

[compiler]
target = "21"
warnings_as_errors = true
optimization = 1

[test]
parallel = 4
timeout = 60

[mutation]
min_score = 75.0
fail_on_decrease = true
max_survivors = 10
timeout = 3000

[validate]
contracts = true

[cache]
max_size_mb = 200
max_age_days = 7
← CLI reference
Project layout →