|
| 1 | +# AGENTS instructions |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +This file provides **project-specific guidance for AI agents** (and other automated tools) working on the `commitizen` repository. |
| 6 | +Follow these instructions in addition to any higher-level system or tool rules. |
| 7 | + |
| 8 | +## Project Overview |
| 9 | + |
| 10 | +- **Project**: `commitizen` - a tool to help enforce and automate conventional commits, version bumps, and changelog generation. |
| 11 | +- **Primary language**: Python (library + CLI). |
| 12 | +- **Key entrypoints**: |
| 13 | + - `commitizen/cli.py` - main CLI implementation. |
| 14 | + - `commitizen/commands/` - subcommands such as `bump`, `commit`, `changelog`, `check`, etc. |
| 15 | + - `commitizen/config/` - configuration discovery and loading. |
| 16 | + - `commitizen/providers/` - version providers (e.g., `pep621`, `poetry`, `npm`, `uv`). |
| 17 | + |
| 18 | +## General Expectations |
| 19 | + |
| 20 | +- **Preserve public behavior and CLI UX.** |
| 21 | +- **Avoid breaking changes** (APIs, CLI flags, exit codes) unless explicitly requested. |
| 22 | +- **Keep changes small and focused.** |
| 23 | +- **Update or add tests/docs** when you change user-facing behavior. |
| 24 | + |
| 25 | +## How to Explore and Validate Changes |
| 26 | + |
| 27 | +- **Code entrypoints**: |
| 28 | + - CLI behavior: `commitizen/cli.py` and `commitizen/commands/`. |
| 29 | + - Config resolution: `commitizen/config/factory.py` and config modules. |
| 30 | + - Bump/changelog/versioning: `commitizen/bump.py`, `commitizen/changelog.py`, `commitizen/version_schemes.py`, `commitizen/providers/`. |
| 31 | +- **Docs to consult** (before larger changes): |
| 32 | + - `docs/README.md` |
| 33 | + - `docs/contributing.md` |
| 34 | + - `docs/commands/` and `docs/config/` |
| 35 | +- **Tests**: |
| 36 | + - Prefer targeted runs, e.g. `uv run pytest tests/test_cli.py` or a specific `tests/commands/` file. |
| 37 | + |
| 38 | +## Coding Guidelines (for AI tools) |
| 39 | + |
| 40 | +- **Style**: Follow patterns in nearby code; keep functions focused. |
| 41 | +- **Types**: Preserve or improve existing type hints. |
| 42 | +- **Errors**: Prefer `commitizen/exceptions.py` error types; keep messages clear for CLI users. |
| 43 | +- **Output**: Use `commitizen/out.py`; do not add noisy logging. |
| 44 | + |
| 45 | +## Common Task Pointers |
| 46 | + |
| 47 | +- **CLI commands**: edit `commitizen/commands/<name>.py`, wire via `commitizen/cli.py`, and adjust `tests/commands/` + `docs/commands/`. |
| 48 | +- **Version bumps / changelog**: use `commitizen/bump.py`, `commitizen/changelog.py`, `commitizen/version_schemes.py`, and `commitizen/providers/` (+ matching tests). |
| 49 | +- **Config resolution**: use `commitizen/config/factory.py` and config modules; update `tests/test_conf.py` and related tests. |
| 50 | + |
| 51 | +## When Unsure |
| 52 | + |
| 53 | +- Prefer **reading tests and documentation first** to understand the expected behavior. |
| 54 | +- When behavior is ambiguous, **assume backward compatibility** with current tests and docs is required. |
0 commit comments