Tooling Overview
The Zap CLI
Section titled “The Zap CLI”The zap command is your entry point for everything:
zap run file.zap # Compile and runzap build # Build the projectzap test # Run testszap fmt # Format source fileszap lint # Check for common issueszap repl # Interactive REPLProject Structure
Section titled “Project Structure”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)zap.toml
Section titled “zap.toml”The project manifest:
[project]name = "my_app"version = "0.1.0"authors = ["Your Name <you@example.com>"]
[dependencies]# Add third-party modules hereFormatter
Section titled “Formatter”zap fmt formats your code according to the official style guide:
zap fmt # Format all files in the projectzap fmt src/main.zap # Format a specific filezap fmt --check # Check without modifying (useful in CI)Linter
Section titled “Linter”zap lint catches common mistakes and style issues:
zap lint # Lint the whole projectzap lint --fix # Auto-fix where possibleTesting
Section titled “Testing”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:
zap test # Run all testszap test tests/test_math.zap # Run specific test filezap test --verbose # Show individual test results