Thanks for your interest in contributing to loaders.zig! This document covers the process for reporting issues, suggesting features, and submitting code changes.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Making Changes
- Testing
- Code Style
- Documentation
- Submitting a Pull Request
- Reporting Bugs
- Requesting Features
Be respectful and constructive. We're here to build something useful together.
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/<your-username>/loaders.zig.git cd loaders.zig
- Create a branch for your change:
git checkout -b my-feature
| Requirement | Version |
|---|---|
| Zig | 0.16.0 |
| OS | Linux, macOS, or Windows |
# Run all tests
zig build test --summary all
# Build all examples
zig build examples
# Run all examples
zig build run-all-examples
# Format check
zig fmt --check build.zig src/ examples/Docs are built with VitePress and Bun:
cd docs
bun install
bun run dev # local dev server
bun run build # production buildloaders.zig/
├── src/
│ ├── loaders.zig # Root module (public API entry point)
│ ├── bar.zig # Progress bar implementation
│ ├── spinner.zig # Background-threaded spinner
│ ├── batch.zig # BatchBar multi-task progress
│ ├── color.zig # ANSI color/escape code generation
│ ├── style.zig # BarStyle + SpinnerStyle presets
│ ├── terminal.zig # TTY detection, terminal sizing
│ ├── utils.zig # Pure utility functions
│ ├── version.zig # Version metadata
│ └── update_checker.zig # GitHub release update checker
├── examples/ # Example programs
├── docs/ # VitePress documentation site
├── build.zig # Build system
├── build.zig.zon # Package manifest
└── README.md
- Create a topic branch from
main. - Make your changes in small, focused commits.
- Write or update tests for any new functionality.
- Ensure all tests pass:
zig build test --summary all - Ensure examples build:
zig build examples - Format your code:
zig fmt src/ examples/ - Push and open a pull request.
Use clear, concise commit messages:
add fire bar style presetfix indeterminate bar bounce rangedocs: update spinner guide examples
All tests live inside each source file as test blocks. The root src/loaders.zig pulls in tests from all sub-modules.
# Run all tests
zig build test --summary allWhen adding new functionality:
- Add unit tests in the relevant source file.
- Test both the happy path and edge cases.
- Tests should not require a real TTY — use
TermInfo.dumbandcolor_enabled = false.
Follow existing conventions:
- No comments unless explicitly requested.
- Use
snake_casefor variables and functions. - Use
PascalCasefor types and structs. - Keep functions focused and short.
- Prefer stack allocation over heap when possible.
- All public types and functions must have doc comments (
///).
Format with:
zig fmt src/ examples/CI will reject PRs that fail zig fmt --check.
- Update
docs/guide/if you change user-facing behavior. - Update
docs/api/index.mdif you add or change public API. - Add SEO frontmatter (
description,keywords) to new doc pages. - Test docs locally:
cd docs && bun install && bun run dev
- Fill out the PR template completely.
- Link any related issues.
- PRs should target the
mainbranch. - Keep PRs focused — one feature or fix per PR.
- Ensure CI passes (tests, examples, format check).
-
zig build test --summary allpasses -
zig build examplessucceeds -
zig fmt --check build.zig src/ examples/passes - Tests added for new functionality
- Documentation updated (if applicable)
Use the bug report template. Include:
- Zig version and OS
- Minimal code to reproduce
- Expected vs actual behavior
Use the feature request template. Describe the use case and expected API.
Open a discussion or ask in the relevant issue.