Contributing to Null Terminal¶
Thank you for your interest in contributing to Null Terminal! This document provides guidelines and instructions for contributing.
Code of Conduct¶
Be respectful, inclusive, and constructive. We're building something cool together.
Getting Started¶
Prerequisites¶
- Python 3.12+
uvpackage manager- Git
Development Setup¶
# Clone the repository
git clone https://github.com/starhound/null-terminal.git
cd null-terminal
# Install dependencies
uv sync
# Run the application
uv run main.py
# Run tests
uv run pytest
How to Contribute¶
Reporting Bugs¶
- Check existing issues to avoid duplicates
- Use the bug report template
- Include:
- Null Terminal version
- Python version
- OS and terminal emulator
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs or screenshots
Suggesting Features¶
- Check existing issues/discussions
- Describe the use case clearly
- Explain why existing features don't solve it
- Propose implementation if possible
Submitting Code¶
1. Fork and Branch¶
# Fork on GitHub, then:
git clone https://github.com/YOUR_USERNAME/null-terminal.git
cd null-terminal
git checkout -b feature/your-feature-name
Branch naming conventions: - feature/ - New features - fix/ - Bug fixes - docs/ - Documentation changes - refactor/ - Code refactoring - test/ - Test additions/fixes
2. Make Your Changes¶
Follow the coding standards below. Commit often with clear messages.
3. Test Your Changes¶
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=. --cov-report=term-missing
# Run specific tests
uv run pytest tests/unit/ai/
# Lint your code
uv run ruff check .
uv run ruff format --check .
4. Submit a Pull Request¶
- Push your branch to your fork
- Open a PR against
main - Fill out the PR template
- Link related issues
- Wait for review
Coding Standards¶
Python Style¶
- Formatter: We use
ruff format - Linter: We use
ruff check - Type hints: Required for all public functions
- Docstrings: Required for classes and public methods
async def my_function(param: str, count: int = 10) -> list[str]:
"""Brief description of what this does.
Args:
param: Description of param
count: Description of count
Returns:
Description of return value
"""
pass
Async Conventions¶
- All I/O operations must be async
- Use
asyncio.create_subprocess_shellinstead ofsubprocess - Use
httpx.AsyncClientinstead ofrequests - Never use
time.sleep()- useasyncio.sleep()
TUI Conventions¶
- Never use
print()- useself.notify()orself.log() - Use TCSS classes for styling, not inline styles
- Use
self.post_message()for widget communication - Keep widget
compose()methods simple
Testing Requirements¶
- All new features need tests
- All bug fixes need regression tests
- Use the
mock_homefixture to protect user data - Integration tests use the
pilotpattern
import pytest
@pytest.mark.asyncio
async def test_feature(mock_home, mock_storage):
"""Test description."""
# Arrange
...
# Act
...
# Assert
assert result == expected
Commit Messages¶
Follow conventional commits:
Types: feat, fix, docs, style, refactor, test, chore
Examples: - feat(ai): add support for Gemini 2.0 Flash - fix(blocks): handle empty command output - docs: update provider configuration guide - test(mcp): add client connection tests
Architecture Guidelines¶
Adding a New AI Provider¶
See DEVELOPMENT.md
- Create
ai/newprovider.pyinheriting fromLLMProvider - Implement required methods
- Register in
ai/factory.py - Add tests in
tests/unit/ai/ - Update
user/providers.md
Adding a New Command¶
See DEVELOPMENT.md
- Add
cmd_method to appropriate module incommands/ - Register in
commands/handler.py - Add tests
- Update
user/commands.md
Adding a New Widget¶
- Create widget in
widgets/ - Use
reactiveproperties for state - Style via TCSS in
styles/main.tcss - Add integration tests
Modifying Block Architecture¶
The block system (widgets/blocks/) is critical. Changes here require: - Unit tests for the widget - Integration tests for rendering - Review of BlockState model compatibility
Review Process¶
- Automated checks must pass (tests, linting)
- One approval required from maintainers
- Squash merge preferred for clean history
What Reviewers Look For¶
- Tests included and passing
- Code follows style guidelines
- No breaking changes without discussion
- Documentation updated if needed
- Commit messages are clear
Release Process¶
Releases are managed by maintainers:
- Version bump in
pyproject.toml - Update
CHANGELOG.md - Create GitHub release with tag
- CI/CD handles PyPI and Docker publishing
Getting Help¶
- Questions: Open a Discussion on GitHub
- Bugs: Open an Issue
- Chat: [Discord/Matrix link if available]
Recognition¶
Contributors are recognized in: - GitHub contributors list - Release notes for significant contributions - Special thanks in README for major features
Thank you for contributing to Null Terminal!