Skip to content

Commit 4e83dbf

Browse files
Merge pull request #85 from sanafayyaz315/pre-commit-hooks-clean
chore: add conventional commits pre-commit hook
2 parents cb7a4be + d85856d commit 4e83dbf

2 files changed

Lines changed: 70 additions & 11 deletions

File tree

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Pre-commit configuration for agentic-starter-kits
2+
# Install: pre-commit install --install-hooks
3+
# Run manually: pre-commit run --all-files
4+
5+
default_install_hook_types:
6+
- pre-commit
7+
- commit-msg
8+
9+
repos:
10+
# Enforce Conventional Commits in commit messages
11+
- repo: https://github.com/espressif/conventional-precommit-linter
12+
rev: v1.11.0
13+
hooks:
14+
- id: conventional-precommit-linter
15+
stages: [commit-msg]
16+
# more args can be added here to customize the linter behavior
17+
# more args can be found here: https://github.com/espressif/conventional-precommit-linter
18+
args:
19+
- --types=feat,fix,docs,chore,test,perf,refactor,ci,build,style,revert
20+
- --subject-min-length=10
21+
- --subject-max-length=72
22+
- --allow-breaking

CONTRIBUTING.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ Thank you for your interest in contributing. This document gives a short overvie
1414

1515
Before submitting, please read our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to uphold it.
1616

17+
## Development setup
18+
19+
This repository uses [pre-commit](https://pre-commit.com/) hooks to enforce code quality checks before each commit. Set it up once after cloning:
20+
21+
```bash
22+
uv tool install pre-commit
23+
pre-commit install --install-hooks
24+
```
25+
26+
After this, every `git commit` will automatically validate your commit message format (see below).
27+
1728
## Linting and formatting
1829

1930
This project uses [ruff](https://docs.astral.sh/ruff/) for Python linting and formatting, and [markdownlint](https://github.com/DavidAnson/markdownlint) for Markdown linting. Both run as blocking CI checks on all pull requests via the `Code Quality` workflow.
@@ -44,18 +55,35 @@ Configuration is in [`.markdownlint.jsonc`](.markdownlint.jsonc) (rules) and [`.
4455

4556
## Commit message conventions
4657

47-
We encourage [Conventional Commits](https://www.conventionalcommits.org/) so that history and release notes stay clear.
58+
This repository enforces the [Conventional Commits](https://www.conventionalcommits.org/) specification via a pre-commit hook. Commits that don't follow this format will be blocked locally by the pre-commit hook.
59+
60+
> **Tip:** To bypass the hook in rare cases (e.g., merge commits, emergency hotfixes): `git commit --no-verify`
61+
62+
### Format
4863

49-
Use one of these prefixes at the start of your commit message:
64+
```
65+
<type>(optional scope): <description>
66+
67+
[optional body]
68+
69+
[optional footer(s)]
70+
```
5071

51-
| Prefix | Meaning |
52-
| --------- | -------- |
53-
| **feat:** | A new feature |
54-
| **fix:** | A bug fix |
55-
| **perf:** | A change that improves performance |
56-
| **chore:**| Maintenance (deps, tooling, config) |
57-
| **docs:** | Documentation only |
58-
| **test:** | Adding or updating tests |
72+
### Allowed types
73+
74+
| Prefix | Meaning |
75+
| ------------- | -------- |
76+
| **feat:** | A new feature |
77+
| **fix:** | A bug fix |
78+
| **docs:** | Documentation only |
79+
| **chore:** | Maintenance (deps, tooling, config) |
80+
| **test:** | Adding or updating tests |
81+
| **perf:** | A change that improves performance |
82+
| **refactor:** | Code change that neither fixes a bug nor adds a feature |
83+
| **ci:** | CI/CD changes |
84+
| **build:** | Build system or external dependency changes |
85+
| **style:** | Code style (formatting, whitespace — no logic changes) |
86+
| **revert:** | Reverts a previous commit |
5987

6088
You can optionally add a scope (e.g. the agent or module name) in parentheses after the type.
6189

@@ -67,9 +95,18 @@ fix: correct env var name in deployment in langgraph_react_agent
6795
docs: update README with OpenShift deploy steps
6896
test: add tests for tool registration
6997
chore: bump python-dotenv in requirements
98+
refactor(langgraph): extract tool registration into helper
99+
ci: add ruff linting workflow
100+
feat!: change /chat response format
70101
```
71102

72-
This is optional but appreciated; maintainers may ask you to reword commits when preparing a release.
103+
For breaking changes, add `!` after the type/scope (e.g. `feat!:`) or include a `BREAKING CHANGE:` footer:
104+
105+
```
106+
feat: change /chat response format
107+
108+
BREAKING CHANGE: response field "text" renamed to "content"
109+
```
73110

74111
## Automated PR labels
75112

0 commit comments

Comments
 (0)