|
| 1 | +# Contributing to codechu-cli |
| 2 | + |
| 3 | +Thanks for thinking about contributing. `codechu-cli` is a small, |
| 4 | +focused CLI primitives library — pure stdlib, POSIX-first. Patches |
| 5 | +that keep that invariant intact are warmly received. |
| 6 | + |
| 7 | +This library was originally extracted from [Disk Cleaner](https://github.com/codechu/disk-cleaner), |
| 8 | +but is maintained independently with its own release cadence. |
| 9 | + |
| 10 | +## Development setup |
| 11 | + |
| 12 | +```bash |
| 13 | +git clone https://github.com/codechu/cli-py.git |
| 14 | +cd cli-py |
| 15 | +pip install -e ".[dev]" |
| 16 | +pytest -q |
| 17 | +ruff check src tests |
| 18 | +``` |
| 19 | + |
| 20 | +## Workflow |
| 21 | + |
| 22 | +- Branch names: `feature/<short>`, `fix/<short>`, `refactor/<short>`, |
| 23 | + `docs/<short>`, `test/<short>`. |
| 24 | +- Commit messages: [Conventional Commits](https://www.conventionalcommits.org/) |
| 25 | + (`feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`). |
| 26 | +- Open a PR using the template; describe the *why* in the body. |
| 27 | +- One change per PR — keep diffs reviewable. |
| 28 | + |
| 29 | +## Bug reports |
| 30 | + |
| 31 | +A useful bug report includes: |
| 32 | + |
| 33 | +- Python version + OS + terminal emulator (`$TERM`, `$LANG`). |
| 34 | +- A minimal reproducer (≤30 lines, stdlib-only if possible). |
| 35 | +- Expected vs observed behaviour. For TTY/non-TTY differences, |
| 36 | + mention whether you ran under a pty, a CI runner, or a real shell. |
| 37 | + |
| 38 | +## Tests |
| 39 | + |
| 40 | +- `pytest -q` must pass; coverage stays at **≥85 %**. |
| 41 | +- New feature → new test. Interactive components (`select`, |
| 42 | + `multiselect`, `Spinner`) need tests that bypass the raw-mode |
| 43 | + path — use non-TTY streams + monkeypatched `time.sleep`. |
| 44 | +- Don't introduce real sleeps for synchronization — mock `time`. |
| 45 | +- Prefer `io.StringIO` for stream injection over touching real fds. |
| 46 | + |
| 47 | +## Public API discipline |
| 48 | + |
| 49 | +The public surface is what `codechu_cli.__all__` exports. Everything |
| 50 | +else is internal — please don't extend it without a discussion first. |
| 51 | + |
| 52 | +## Style |
| 53 | + |
| 54 | +- `ruff check` + `ruff format` clean. |
| 55 | +- Type hints on public APIs (`from __future__ import annotations`). |
| 56 | +- Use `logging.getLogger(__name__)`; avoid `print`. |
| 57 | +- Pure stdlib — no new third-party runtime dependencies. |
| 58 | + |
| 59 | +## Security |
| 60 | + |
| 61 | +If you find a security issue, see [SECURITY.md](SECURITY.md) — do not |
| 62 | +open a public issue for it. |
0 commit comments