Skip to content

Tooling Overview

The zap command is your entry point for everything:

Terminal window
zap run file.zap # Compile and run
zap build # Build the project
zap test # Run tests
zap fmt # Format source files
zap lint # Check for common issues
zap repl # Interactive REPL

A typical Zap project:

my_app/
├── zap.toml # Project manifest
├── src/
│ ├── main.zap # Entry point
│ └── lib.zap # Library code
├── tests/
│ └── test_lib.zap # Test files
└── build/ # Compiled output (generated)

The project manifest:

[project]
name = "my_app"
version = "0.1.0"
authors = ["Your Name <you@example.com>"]
[dependencies]
# Add third-party modules here

zap fmt formats your code according to the official style guide:

Terminal window
zap fmt # Format all files in the project
zap fmt src/main.zap # Format a specific file
zap fmt --check # Check without modifying (useful in CI)

zap lint catches common mistakes and style issues:

Terminal window
zap lint # Lint the whole project
zap lint --fix # Auto-fix where possible
tests/test_math.zap
import std.testing { assert_eq }
import math
test "addition works" {
assert_eq(math.add(2, 3), 5)
}
test "negative numbers" {
assert_eq(math.add(-1, 1), 0)
}

Run tests:

Terminal window
zap test # Run all tests
zap test tests/test_math.zap # Run specific test file
zap test --verbose # Show individual test results