Thanks for your interest in contributing to cTUI! This document outlines the guidelines for contributing to the project.
This project follows the Rust Code of Conduct. By participating, you agree to uphold this code. Please report any unacceptable behavior to the maintainers.
We welcome high quality contributions, whether they are human generated or made with the assistance of AI tools. Please follow these guidelines:
- Attribution: Tell us about your use of AI tools. Don't make us guess whether you're using it.
- Review: Review every line of AI generated content for correctness and relevance.
- Quality: AI-generated content should meet the same quality standards as human-written content.
- Quantity: Avoid submitting large amounts of AI generated content in a single PR. Quality over quantity.
- License: Ensure that AI-generated content is compatible with cTUI's MIT License.
Important
AI tools can assist in generating content, but you are responsible for the final quality and accuracy of the contributions.
- Rust 1.75 or later (install via rustup)
- Git
# Clone the repository
git clone https://github.com/CortexLM/cTUI.git
cd cTUI
# Build the project
cargo build
# Run tests
cargo test --all
# Run clippy
cargo clippy --all-targets --all-features
# Format code
cargo fmt --all
# Run an example
cargo run --example countercTUI/
├── ctui-core/ # Core rendering primitives
├── ctui-macros/ # Procedural macros
├── ctui-layout/ # Flexbox layout engine
├── ctui-components/ # Built-in widgets
├── ctui-animate/ # Animation system
├── ctui-theme/ # Theming and styling
├── ctui-cli/ # CLI tool and templates
├── ctui-tests/ # Integration tests
├── examples/ # Example applications
└── benches/ # Benchmarks
See ARCHITECTURE.md for detailed information about crate responsibilities.
Before reporting an issue, please:
- Search existing issues to avoid duplicates
- Check if the issue exists in the latest version
- Use the appropriate issue template
When reporting bugs, include:
- A minimal reproducible example
- Your environment (OS, terminal, Rust version)
- Expected vs actual behavior
- Keep PRs small and focused - One change per PR when possible
- Reference related issues - Link any related issues in your PR description
- Write clear commit messages - Follow Conventional Commits
- Add tests - New features need tests
- Update documentation - Public APIs must be documented
- Ideal: Under 500 lines of changes
- Split large features into incremental PRs
- Separate refactoring from functional changes
- If a large PR is unavoidable, explain why
We prioritize backwards compatibility:
- Prefer deprecation over removal
- Provide migration paths for breaking changes
- Document breaking changes in PR descriptions
- Wait at least two versions before removing deprecated items
We use Conventional Commits. Format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or modifying testschore: Maintenance tasks
feat(components): add Scrollable widget
fix(layout): prevent overflow in flex calculation
docs(readme): update installation instructions
# Run all tests
cargo test --all
# Run tests for a specific crate
cargo test -p ctui-core
# Run a specific test
cargo test test_buffer_diff -- --nocapture- Write unit tests in the same file as the code
- Write integration tests in the
tests/directory - Use doc tests for public APIs
- Test edge cases and error conditions
Good test coverage is important. Focus on:
- Public API behavior
- Edge cases
- Error handling
- Performance critical paths
Every public API must be documented:
/// Brief description.
///
/// Detailed description with examples.
///
/// # Examples
///
/// ```
/// use ctui::Buffer;
/// let buf = Buffer::empty(Rect::new(0, 0, 10, 10));
/// ```
fn my_function() {}- First line is summary, second is blank, third onward is detail
- Max line length: 100 characters
- Use backticks for code items:
Buffer, not Buffer - Document parameters and return values
When making changes, consider:
- Which crate should contain the changes
- Whether changes affect the public API of
ctui-core - How changes fit into the overall architecture
See ARCHITECTURE.md for crate responsibilities.
CI runs on every pull request:
- Build on stable and MSRV
- Run all tests
- Run clippy
- Check formatting
Run locally before pushing:
cargo test --all && cargo clippy --all-targets --all-features && cargo fmt --all -- --check- Open a Discussion for questions
- Join our community chat (coming soon)
- Check existing issues and documentation
By contributing, you agree that your contributions will be licensed under the MIT License.