CLI Reference

The covenant CLI is the primary interface to the Covenant toolchain. All commands follow the pattern covenant <command> [options] [args].

What’s new in V0.9

V0.9 brings Foundry-class developer ergonomics. Seven commands round out the CLI:

CommandPurpose
covenant test --watch / --coveragePer-test isolation, watch mode, name-heuristic coverage
covenant fmtCanonical formatting, --check for CI gates
covenant doctor9 environment probes (Rust toolchain, network, helper bridge, …)
covenant lint6-rule linter for Solidity-isms (L001–L006)
covenant initScaffold from template (token, ceremony, defi)
covenant explain <code>Long-form explanation of a diagnostic code
covenant build --target-chainPer-chain helper-address embedding (mockchain · sepolia · aster)

Install: cargo install covenant-cli --version 0.9.0

Global flags

FlagDescription
--versionPrint compiler version
--verboseVerbose output
--quietSuppress all output except errors
--no-colorDisable ANSI color output
--config <path>Path to covenant.toml (default: project root)

covenant new

Create a new project.

covenant new <name> [--template <template>]
TemplateDescription
defaultCounter contract (default)
erc20ERC-20 token
fheEncrypted counter with FHE
upgradeableUUPS upgradeable contract

covenant build

Compile source files to EVM bytecode.

covenant build [source.cov] [options]
OptionDefaultDescription
--target <chain>evmTarget chain: evm, aster, wasm
--optimizeoffEnable IR optimizer
--output <dir>target/Output directory
--emit-iroffAlso emit typed IR (.cov.ir)
--strictoffTreat warnings as errors

covenant test

Run the test suite.

covenant test [--filter <pattern>] [--verbose]

Tests are defined in tests/*.cov or inline in source with #[test].

covenant lint

Run all static analysis detectors.

covenant lint [source.cov] [--fix] [--strict]

38+ detectors cover: reentrancy, integer overflow, unchecked external calls, missing guards, CEI violations, FHE reveal without guard, PQ signature misconfiguration, and more.

covenant deploy

Deploy a compiled artifact to a network.

covenant deploy <artifact> --network <network> [options]
OptionDescription
--network <name>Network from covenant.toml
--constructor-args <args...>Constructor arguments (ABI-encoded)
--value <amount>ETH to send with deployment
--gas-limit <n>Override gas limit
--dry-runSimulate without broadcasting

covenant call

Call a view action (no transaction).

covenant call <address> <action> [args...] --network <network>

covenant send

Send a transaction to a contract.

covenant send <address> <action> [args...] --network <network> [--value <eth>]

covenant verify

Verify source on a block explorer.

covenant verify <address> --network <network> --source <file> --compiler-version <ver>

covenant upgrade-check

Check storage layout compatibility between two artifacts.

covenant upgrade-check <old.artifact> <new.artifact>

Exits 0 if safe, non-zero on collision with a human-readable diff.

covenant zk prove

Generate a ZK proof off-chain.

covenant zk prove --circuit <circuit-id> --private <key=val...> --public <key=val...>

covenant fmt V0.9

Canonical source formatter — opinionated, no configuration. Same role as gofmt / cargo fmt.

covenant fmt                # format all .cov files in src/
covenant fmt --check        # CI gate — non-zero exit if reformat needed
covenant fmt --diff         # show what would change without writing
covenant fmt path/to/file   # single file

Idempotent: running fmt twice on the same input produces identical output.

covenant doctor V0.9

Diagnose your environment. Runs 9 probes covering Rust toolchain, Cargo registry, Foundry availability, helper-bridge connectivity, RPC endpoints, and more.

covenant doctor          # human-readable summary
covenant doctor --json   # machine-readable
covenant doctor --strict # exit non-zero on any warning (CI use)

Each probe reports OK / WARN / FAIL with a remediation hint. Useful as a first step when something breaks unexpectedly.

covenant init V0.9

Scaffold a new project from a template. Replaces the older covenant new (which still works as an alias).

covenant init my-token                    # default: blank record contract
covenant init --template token my-token   # ERC-20 starter
covenant init --template ceremony my-cer  # amnesia ceremony starter
covenant init --template defi my-amm      # DeFi protocol scaffold

The scaffold creates covenant.toml, src/, tests/, a sample contract, and a CI workflow.

covenant explain V0.9

Show the long-form explanation of any diagnostic code (E0xxx for compiler errors, W0xxx for warnings, L00x for linter, C100+ for security findings).

covenant explain E0421
covenant explain L003
covenant explain C100

Output includes: what the diagnostic means, why it fires, common causes, and how to fix or suppress it.

covenant.toml reference

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

[compiler]
target  = "evm"         # default target
strict  = false
optimize = true

[networks.sepolia]
rpc_url    = "https://rpc.sepolia.org"
chain_id   = 11155111
explorer   = "https://sepolia.etherscan.io"

[networks.aster]
rpc_url    = "https://tapi.asterdex.com"
chain_id   = 1996
explorer   = "https://explorer.asterdex.com"

[deploy]
private_key_env = "DEPLOYER_PRIVATE_KEY"

Environment variables

VariableDescription
DEPLOYER_PRIVATE_KEYPrivate key for signing transactions
COVENANT_RPC_URLOverride network RPC URL
COVENANT_LOGLog level: error, warn, info, debug, trace

Exit codes

CodeMeaning
0Success
1Compile error
2Test failure
3Lint error (with --strict)
4Deployment failure
5Upgrade storage collision