This file provides project-specific guidance for AI agents (and other automated tools) working on the commitizen repository.
Follow these instructions in addition to any higher-level system or tool rules.
- Project:
commitizen- a tool to help enforce and automate conventional commits, version bumps, and changelog generation. - Primary language: Python (library + CLI).
- Cross-platform: Tests run on Linux, macOS, and Windows. Avoid POSIX-only assumptions in code (paths, subprocesses, line endings).
- Key entrypoints:
commitizen/cli.py- main CLI implementation.commitizen/commands/- subcommands such asbump,commit,changelog,check, etc.commitizen/config/- configuration discovery and loading.commitizen/providers/- version providers (e.g.,pep621,poetry,npm,uv).
- Config sources:
pyproject.toml(project config, poe tasks, ruff, mypy),.pre-commit-config.yaml(hooks),.github/workflows/(CI).
- Preserve public behavior and CLI UX — no breaking changes to APIs, CLI flags, or exit codes unless explicitly requested.
- Update or add tests/docs when you change user-facing behavior.
- Commit messages must follow Conventional Commits (enforced by commitizen itself).
uv sync --frozen --group base --group test --group linters- Format:
uv run poe format(runsruff check --fixthenruff format) - Lint:
uv run poe lint(runsruff checkthenmypy) - Test:
uv run poe test(runspytest -n auto) - CI-equivalent:
uv run poe ci(commit check + pre-commit hooks viaprek+ test with coverage) - Full local check:
uv run poe all(format + lint + check-commit + coverage)
Always run at least uv run ruff check --fix . && uv run ruff format . before pushing. CI will fail if the formatter modifies any files.
- CI runs
poe cion a matrix of Python 3.10–3.14 × ubuntu/macos/windows. - Pre-commit hooks are defined in
.pre-commit-config.yamland run viaprek. - The matrix is fail-fast: inspect the earliest failing job that completed; others are cancelled.
- "Format Python code...Failed": Run
uv run poe formatand commit the result. - mypy
[arg-type]on TypedDict: Dynamically-constructed dicts (e.g., frompytest.mark.parametrize) passed to TypedDict-typed params need# type: ignore[arg-type]. - "pathspec 'vX.Y.Z' did not match":
.pre-commit-config.yamlpins a tag of this repo. Rebase onto master to pick up the tag. VersionProtocol+issubclass: This Protocol has non-method members (properties), soissubclass()raisesTypeError. Usehasattrchecks for runtime validation.
| Changing... | Read first |
|---|---|
| CLI flags/arguments | commitizen/cli.py, docs/commands/<cmd>.md, tests/test_cli/ |
| Bump logic | commitizen/bump.py, commitizen/commands/bump.py, docs/commands/bump.md |
| Changelog generation | commitizen/changelog.py, commitizen/changelog_formats/, docs/commands/changelog.md |
| Version schemes | commitizen/version_schemes.py, tests/test_version_schemes.py |
| Version providers | commitizen/providers/, tests/test_providers.py, docs/config/version_provider.md |
| Config resolution | commitizen/config/, tests/test_conf.py, docs/config/ |
| Tag handling | commitizen/tags.py, tests/test_tags.py |
| Pre-commit / CI | .pre-commit-config.yaml, .github/workflows/, pyproject.toml (poe tasks) |
- Types: Preserve or improve existing type hints.
- Errors: Prefer
commitizen/exceptions.pyerror types; keep messages clear for CLI users. - Output: Use
commitizen/out.py; do not add noisy logging.
- Prefer reading tests and documentation first to understand the expected behavior.
- When behavior is ambiguous, assume backward compatibility with current tests and docs is required.