Add Git workflow and update docs

This commit is contained in:
2026-04-03 03:32:00 -07:00
parent 1ac724603a
commit 63102473da
2 changed files with 83 additions and 19 deletions

View File

@@ -27,7 +27,9 @@ echo '{"a":1}' | uv run rp # Read from stdin
```
### Testing
This project does not yet have automated tests. When adding tests:
Run tests with pytest:
```bash
# Run all tests
uv run pytest
@@ -35,8 +37,11 @@ uv run pytest
# Run a single test file
uv run pytest tests/test_detect.py
# Run a single test class
uv run pytest tests/test_detect.py::TestExplicitType
# Run a single test function
uv run pytest tests/test_detect.py::test_detect_json_from_content
uv run pytest tests/test_detect.py::TestExplicitType::test_explicit_overrides_everything
# Run with verbose output
uv run pytest -v
@@ -160,32 +165,76 @@ Version metadata must stay in sync between `pyproject.toml` and `src/rp/__init__
## Project Structure
```
rich-viewer/
├── pyproject.toml # Project config, dependencies, entry point
├── uv.lock # Lockfile (commit this)
rich-print/
├── pyproject.toml # Project config, dependencies, entry point
├── uv.lock # Lockfile (commit this)
├── .gitignore
├── README.md
├── AGENTS.md # This file
── src/
└── rp/
├── __init__.py # Version metadata
├── cli.py # Typer CLI entry point
├── detect.py # File type detection
├── render.py # Rendering logic
├── pager.py # Pager integration
└── py.typed # PEP 561 marker
├── AGENTS.md # This file
── src/
└── rp/
├── __init__.py # Version metadata
├── cli.py # Typer CLI entry point
├── detect.py # File type detection
├── render.py # Rendering logic
├── pager.py # Pager integration
└── py.typed # PEP 561 marker
└── tests/
├── conftest.py
├── test_cli.py
├── test_detect.py
├── test_render.py
└── test_pager.py
```
## Dependencies
- `rich>=13.0` — Terminal rendering (Markdown, JSON, Syntax)
- `typer>=0.12` — CLI framework
Runtime dependencies. Dev dependencies: `ruff>=0.9`, `mypy>=1.14`.
Runtime dependencies. Dev dependencies: `ruff>=0.9`, `mypy>=1.14`, `pytest>=8.0`, `pytest-cov>=5.0`.
## Git Conventions
- Write clear, imperative commit messages
- Reference issues/PRs when applicable
- Keep commits focused (one logical change per commit)
## Git Workflow
### Branches
- **Long-lived branches**
- `main` — stable release branch; only updated via merges from `dev`
- `dev` — integration branch for day-to-day development
- **Short-lived branches**
- `feature/<topic>` — new features
- `fix/<topic>` — bug fixes
- `docs/<topic>` — documentation changes
- `chore/<topic>` — maintenance, tooling, CI
- `refactor/<topic>` — refactoring without behavior change
- `test/<topic>` — adding or improving tests
### Branching Rules
- Start normal work from the latest `dev`
- Keep branches short-lived and focused on one logical change
- Do not commit directly to `main` or `dev` unless explicitly requested
- Delete the short-lived branch after it is merged
### Pull Requests
- Open normal PRs into `dev`, not `main`
- Use **squash merge** for PRs into `dev`
- Ensure CI passes before merging
- Keep PRs focused; split unrelated changes into separate PRs
### Release Flow
- Merge `dev` into `main` when changes are ready to release
- Tag releases from `main` with version numbers (e.g., `v1.2.3`)
- If a hotfix is made directly against `main`, merge it back to `dev`
### Agent Expectations
- Unless the user says otherwise, assume new work should target `dev`
- If a branch must be created, follow the naming rules above
- Do not create or push branches automatically unless the user asks
- Do not commit changes unless the user explicitly asks
## Notes for Agents
- This is a small, focused CLI tool — prefer simplicity over abstraction

View File

@@ -72,6 +72,14 @@ rp --version
uv sync
```
### Testing
```bash
uv run pytest # Run all tests
uv run pytest -v # Verbose output
uv run pytest tests/test_detect.py # Single file
```
### Linting & Type Checking
```bash
@@ -86,6 +94,13 @@ uv run mypy src/
uv build
```
## Workflow
- `main` — stable release branch
- `dev` — integration branch for day-to-day work
- Short-lived branches: `feature/<topic>`, `fix/<topic>`, `docs/<topic>`
- Open PRs into `dev` (squash merge); merge `dev` to `main` for releases
## License
MIT