|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +Core code lives in `subs_diff/`: |
| 5 | +- `cli.py` and `__main__.py` provide the CLI entry points. |
| 6 | +- `parser.py`, `align.py`, `heuristics.py`, `segments.py`, and `llm.py` implement parsing, matching, scoring, long-segment checks, and LLM verification. |
| 7 | +- `report.py` and `reporter.py` generate JSON/HTML reports. |
| 8 | +- Shared dataclasses and config types are in `types.py` and `config.py`. |
| 9 | + |
| 10 | +Tests live in `tests/` and follow the same feature split (for example, `tests/test_align.py`, `tests/test_cli_filters.py`). |
| 11 | + |
| 12 | +## Build, Test, and Development Commands |
| 13 | +- `pip install -e .` installs the package in editable mode. |
| 14 | +- `pip install -e ".[dev]"` installs development tools (`pytest`, `ruff`, `black`, `mypy`). |
| 15 | +- `python -m subs_diff compare --stt A.srt --ref B.srt --out report.json` runs the main compare flow. |
| 16 | +- `pytest -q` runs the test suite. |
| 17 | +- `pytest --cov=subs_diff --cov-report=html` runs tests with coverage output in `htmlcov/`. |
| 18 | +- `ruff check .` runs lint checks. |
| 19 | +- `black .` formats code. |
| 20 | +- `mypy subs_diff` runs strict type checking. |
| 21 | + |
| 22 | +## Coding Style & Naming Conventions |
| 23 | +- Python 3.10+ codebase; keep compatibility with versions listed in `pyproject.toml`. |
| 24 | +- Use 4-space indentation and max line length `100` (Black/Ruff config). |
| 25 | +- Use snake_case for functions/variables/modules; PascalCase for dataclasses/types. |
| 26 | +- Prefer explicit type annotations; `mypy` is configured with `strict = true`. |
| 27 | +- Keep modules focused; add new logic to existing domain modules before creating new top-level files. |
| 28 | + |
| 29 | +## Testing Guidelines |
| 30 | +- Framework: `pytest` (`tests/`, files named `test_*.py`). |
| 31 | +- Add tests for every behavior change, especially CLI flags and alignment heuristics. |
| 32 | +- Name tests by behavior, e.g. `test_compare_resumes_from_checkpoint`. |
| 33 | +- For bug fixes, add a regression test that fails before the fix. |
| 34 | + |
| 35 | +## Commit & Pull Request Guidelines |
| 36 | +Current history uses short, direct subjects (for example, `long segments detection`, `Update .gitignore`). Follow that style, but make subjects specific and actionable. |
| 37 | + |
| 38 | +- Commit message format: short imperative subject, optionally with scope (e.g. `align: tighten time window filter`). |
| 39 | +- PRs should include: purpose, key changes, test evidence (`pytest`/lint/type-check output), and sample CLI command(s) for manual verification. |
| 40 | +- Link related issues and attach report artifacts/screenshots when output format changes. |
| 41 | + |
| 42 | +## Security & Configuration Tips |
| 43 | +- Do not commit API keys or local config files. |
| 44 | +- Prefer CLI/config storage for secrets (`subs_diff config set ...`) and keep generated reports/debug logs out of commits unless needed for fixtures. |
0 commit comments