A CLI tool designed to verify and validate Cairo programs, wrapping Cairo and Starknet plugins for quick verification of Cairo code examples.
- Compilation verification for Cairo programs and Starknet contracts
- Test execution and validation
- Code formatting checks
- Parallel processing of multiple packages
- Progress tracking with visual indicators
- Detailed error reporting and summaries
cargo install cairo-listings
The tool provides three main commands:
Runs comprehensive verification on Cairo programs:
cairo-listings verify [OPTIONS] <PATH>
Options:
--quiet
: Suppress progress output--compile-skip
: Skip compilation checks--run-skip
: Skip program execution checks--test-skip
: Skip test execution--formats-skip
: Skip format checking--starknet-skip
: Skip Starknet contract compilation
Runs formatting checks on Cairo files:
cairo-listings format [OPTIONS] <PATH>
Process output files in listings:
cairo-listings output [OPTIONS]
The tool performs several checks based on file content and tags:
-
Compilation Checks:
- Standard Cairo programs are compiled
- Starknet contracts are verified with
starknet-compile
-
Execution Checks:
- Runnable programs are executed with
cairo-run
- Tests are run with
cairo-test
- Runnable programs are executed with
-
Format Checks:
- Code formatting is verified unless explicitly ignored
Files can include special tags at the top of Cairo files to control verification behavior. Tags should be placed in comments at the beginning of the file and can be combined using commas.
does_not_compile
: Indicates that the code is intentionally non-compilable. The verification tool will skip compilation checks.does_not_run
: Marks code that shouldn't be executed. The tool will skip runtime verification.ignore_fmt
: Excludes the file from formatting checks.tests_fail
: Indicates that the tests are expected to fail. The tool will skip test verification.
// does_not_compile, tests_fail
fn example_function() {
// This code intentionally doesn't compile and has failing tests
}
Multiple tags can be combined in a single line, separated by commas:
// does_not_compile, ignore_fmt, tests_fail
The tool provides:
- Detailed error messages with file locations
- Progress bars for bulk verification
- Comprehensive error summaries
- Clickable file paths in terminal output
- 0: All checks passed
- 1: One or more checks failed
Contributions are welcome! Please feel free to submit a Pull Request.
This README provides a comprehensive overview of the tool's functionality based on the main.rs implementation, including all major features, commands, and options available in the CLI tool.