AGENTS.md
fileshrink is a command-line tool that compresses images in place. Python 3.10+, Typer for the CLI, Pillow for images.
Setup and commands
- Install for development:
uv sync - Run:
uv run fileshrink --help - Tests:
uv run pytest -q; one test:uv run pytest tests/test_resize.py::test_keeps_aspect_ratio - Lint and format:
uv run ruff check --fix . && uv run ruff format . - Types:
uv run mypy src
Layout
src/fileshrink/cli.py- Typer commands only; parse args and call intocore/src/fileshrink/core/- pure functions, no printing, nosys.exittests/fixtures/- small sample images (keep each under 100 KB)
Conventions
- Every CLI option has help text and appears in
README.mdusage. - Errors: raise
FileShrinkErrorin core; the CLI layer prints a one-line message and exits with code 1. - Never overwrite a file unless
--in-placeis passed; default output is<name>.min.<ext>. - Supported Python versions are listed in
pyproject.toml; do not use syntax newer than the minimum.
Done means
- Tests, ruff and mypy pass.
- New options documented in README and covered by a test using Typer’s
CliRunner.