# Contributing to cotis-layout
Thank you for your interest in contributing to cotis-layout. This repository contains the **layout engine** for the Cotis UI framework. Core traits, pipes, and render backends live in sibling repositories — see the [README](README.md#ecosystem).
## Getting started
### Prerequisites
- [Rust](https://rustup.rs/) **stable** toolchain (see `rust-toolchain.toml`)
- `rustfmt` and `clippy` components:
```bash
rustup component add rustfmt clippy
```
### Build and test
From the repository root:
```bash
# Format (apply changes)
cargo fmt --all
# Lint (library only; examples require unpublished ecosystem crates)
cargo clippy --lib --all-features -- -D warnings
# Test
cargo test --all-features
# Documentation
cargo doc --no-deps --all-features
```
These are the same checks run in [CI](.github/workflows/ci.yml). Please make sure they pass locally before opening a pull request.
### Runnable examples
For a full windowed demo, use a renderer backend such as [cotis-wgpu](https://github.com/igna-778/cotis-wgpu) or [cotis-raylib](https://github.com/igna-778/cotis-raylib):
```bash
git clone https://github.com/igna-778/cotis-wgpu
cd cotis-wgpu
cargo run --example basic_example -p cotis-wgpu
```
Local examples under `examples/` are kept in sync with the `cotis-raylib` API. They will compile once the Cotis ecosystem crates are published to crates.io.
## Making changes
### Scope
- Keep pull requests focused. Prefer several small PRs over one large change.
- Match existing code style and naming in the crate you are editing.
- Avoid drive-by refactors unrelated to the issue you are solving.
### Code style
- Run `cargo fmt --all` before committing. Project settings are in `rustfmt.toml` (Rust 2024 edition, 100-column width).
- Address all Clippy warnings (`-D warnings` in CI).
- Prefer clear, self-documenting code. Add comments only for non-obvious design decisions.
### Tests
- Add or update tests when fixing a bug or changing behavior.
- Unit tests live next to the code they cover (`#[cfg(test)]` modules).
- Run the test suite with `cargo test --all-features`.
### Documentation
- Update rustdoc for public APIs you add or change.
- Update `README.md` when user-facing behavior, features, or ecosystem wiring changes.
- Add an entry to `CHANGELOG.md` under **Unreleased** for notable changes.
## Pull request process
1. Fork the repository and create a branch from `main`.
2. Make your changes and ensure CI checks pass locally.
3. Open a pull request against `main` with:
- A clear summary of **what** changed and **why**
- Links to related issues, if any
- Notes on breaking changes or new feature flags
4. Maintainers will review and may request changes. Once approved, your PR will be merged.
### Commit messages
Write concise commit messages in the imperative mood, consistent with existing history:
- `feat: add grow constraint for nested flex containers`
- `fix: correct text wrap at container boundary`
- `docs: clarify CotisLayoutManager frame lifecycle`
- `refactor: simplify axis sizing helpers`
## Versioning and releases
| `cotis-layout` | 0.1.0-alpha |
We follow [Semantic Versioning](https://semver.org/). Pre-release versions (`-alpha`, `-beta`, etc.) may include breaking API changes — check `CHANGELOG.md` before upgrading.
Release tagging and publishing are handled by maintainers. Contributors do not need to bump versions unless asked.
## Where to report issues
| Core traits, defaults, utils, macros | [cotis issues](https://github.com/igna-778/cotis/issues) |
| Layout engine | [cotis-layout issues](https://github.com/igna-778/cotis-layout/issues) |
| Layout-to-render pipes | [cotis-pipes issues](https://github.com/igna-778/cotis-pipes/issues) |
| wgpu / raylib renderers | [cotis-wgpu](https://github.com/igna-778/cotis-wgpu) / [cotis-raylib](https://github.com/igna-778/cotis-raylib) |
| Security vulnerabilities | See [SECURITY.md](SECURITY.md) |
## License
By contributing, you agree that your contributions will be licensed under the same [MIT License](LICENSE) that covers this project.