Add Git workflow and update docs
This commit is contained in:
87
AGENTS.md
87
AGENTS.md
@@ -27,7 +27,9 @@ echo '{"a":1}' | uv run rp # Read from stdin
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
This project does not yet have automated tests. When adding tests:
|
|
||||||
|
Run tests with pytest:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run all tests
|
# Run all tests
|
||||||
uv run pytest
|
uv run pytest
|
||||||
@@ -35,8 +37,11 @@ uv run pytest
|
|||||||
# Run a single test file
|
# Run a single test file
|
||||||
uv run pytest tests/test_detect.py
|
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
|
# 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
|
# Run with verbose output
|
||||||
uv run pytest -v
|
uv run pytest -v
|
||||||
@@ -160,32 +165,76 @@ Version metadata must stay in sync between `pyproject.toml` and `src/rp/__init__
|
|||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
```
|
```
|
||||||
rich-viewer/
|
rich-print/
|
||||||
├── pyproject.toml # Project config, dependencies, entry point
|
├── pyproject.toml # Project config, dependencies, entry point
|
||||||
├── uv.lock # Lockfile (commit this)
|
├── uv.lock # Lockfile (commit this)
|
||||||
├── .gitignore
|
├── .gitignore
|
||||||
├── README.md
|
├── README.md
|
||||||
├── AGENTS.md # This file
|
├── AGENTS.md # This file
|
||||||
└── src/
|
├── src/
|
||||||
└── rp/
|
│ └── rp/
|
||||||
├── __init__.py # Version metadata
|
│ ├── __init__.py # Version metadata
|
||||||
├── cli.py # Typer CLI entry point
|
│ ├── cli.py # Typer CLI entry point
|
||||||
├── detect.py # File type detection
|
│ ├── detect.py # File type detection
|
||||||
├── render.py # Rendering logic
|
│ ├── render.py # Rendering logic
|
||||||
├── pager.py # Pager integration
|
│ ├── pager.py # Pager integration
|
||||||
└── py.typed # PEP 561 marker
|
│ └── py.typed # PEP 561 marker
|
||||||
|
└── tests/
|
||||||
|
├── conftest.py
|
||||||
|
├── test_cli.py
|
||||||
|
├── test_detect.py
|
||||||
|
├── test_render.py
|
||||||
|
└── test_pager.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
- `rich>=13.0` — Terminal rendering (Markdown, JSON, Syntax)
|
- `rich>=13.0` — Terminal rendering (Markdown, JSON, Syntax)
|
||||||
- `typer>=0.12` — CLI framework
|
- `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
|
## Git Workflow
|
||||||
- Write clear, imperative commit messages
|
|
||||||
- Reference issues/PRs when applicable
|
### Branches
|
||||||
- Keep commits focused (one logical change per commit)
|
|
||||||
|
- **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
|
## Notes for Agents
|
||||||
- This is a small, focused CLI tool — prefer simplicity over abstraction
|
- This is a small, focused CLI tool — prefer simplicity over abstraction
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -72,6 +72,14 @@ rp --version
|
|||||||
uv sync
|
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
|
### Linting & Type Checking
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -86,6 +94,13 @@ uv run mypy src/
|
|||||||
uv build
|
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
|
## License
|
||||||
|
|
||||||
MIT
|
MIT
|
||||||
|
|||||||
Reference in New Issue
Block a user