From afd4f8217d2fd80b0a3abd3891d6499578becba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20Bre=C3=B1a=20Moral?= Date: Sun, 5 Apr 2026 23:29:37 +0200 Subject: [PATCH 1/2] feat: Adding precommit hooks suppport --- .github/workflows/maven.yaml | 19 +++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 27 +++++++++++++++++++++++++++ AGENTS.md | 18 ++++++++++++++++++ CONTRIBUTING.md | 7 +++++++ README.md | 2 +- 6 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml index e872d959..5b9fdf83 100644 --- a/.github/workflows/maven.yaml +++ b/.github/workflows/maven.yaml @@ -57,6 +57,25 @@ jobs: env: SKILL_CHECK_NO_BANNER: 1 + pre-commit: + name: Pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + submodules: true + - uses: actions/setup-python@v6 + with: + python-version: "3.x" + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit (all files) + run: pre-commit run --all-files + - name: Validate HEAD commit message + run: | + git log -1 --pretty=%B > /tmp/commit-msg.txt + pre-commit run conventional-pre-commit --hook-stage commit-msg --commit-msg-filename /tmp/commit-msg.txt + examples: name: Build Examples runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 2dc89be6..03e58bb8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ target/ dependency-reduced-pom.xml docs-local/ .quarkus/ +.venv-precommit/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..4558dd10 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +# https://pre-commit.com/ +# Install: pip install pre-commit && pre-commit install --install-hooks +# Commit messages must match AGENTS.md (Conventional Commits + required scope). +default_install_hook_types: + - pre-commit + - commit-msg + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: check-yaml + + - repo: https://github.com/compilerla/conventional-pre-commit + rev: v4.4.0 + hooks: + - id: conventional-pre-commit + stages: [commit-msg] + args: + - --force-scope + - feat + - fix + - docs + - style + - refactor + - test + - chore diff --git a/AGENTS.md b/AGENTS.md index e0076086..0928fb33 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -66,6 +66,24 @@ npx skill-check skills - `fix(generator): resolve template parsing issue` - `docs(readme): update installation instructions` +### Pre-commit hooks (recommended) + +This repository includes [pre-commit](https://pre-commit.com/) configuration at [`.pre-commit-config.yaml`](.pre-commit-config.yaml): YAML checks and a **commit-msg** hook that enforces the Conventional Commit rules above (including a required **scope**). + +**Setup (once per clone):** + +```bash +pip install pre-commit # or: brew install pre-commit +pre-commit install --install-hooks +``` + +The install registers both the default `pre-commit` stage and `commit-msg` hooks. To validate the latest commit message manually: + +```bash +git log -1 --pretty=%B > /tmp/msg.txt +pre-commit run conventional-pre-commit --hook-stage commit-msg --commit-msg-filename /tmp/msg.txt +``` + ## Boundaries - ✅ **Always do:** Edit XML in `system-prompts-generator/src/main/resources/` to change rules, run `./mvnw clean verify` before promoting changes. When edit XML, follow PML Schema: [https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd](https://jabrena.github.io/pml/schemas/0.7.0/pml.xsd). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 01801743..10be5b3c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,12 @@ # Contributing +## Conventions + +Read [AGENTS.md](./AGENTS.md) for the full contributor guide (tech stack, boundaries, and commands). + +- **Git:** use [Conventional Commits](https://www.conventionalcommits.org/) in the form `type(scope): description`, with types such as `feat`, `fix`, `docs`, `style`, `refactor`, `test`, and `chore` (see AGENTS.md). +- **Pre-commit (recommended):** this repo includes [pre-commit](https://pre-commit.com/) in [`.pre-commit-config.yaml`](.pre-commit-config.yaml) (YAML checks and a commit-msg hook aligned with the rules above). Install once per clone: `pip install pre-commit` or `brew install pre-commit`, then `pre-commit install --install-hooks`. Details and manual checks are in AGENTS.md under **Pre-commit hooks**. + ## Generator The entire set of cursor rules is autogenerated by XML files in the project `system-prompts-generator`. diff --git a/README.md b/README.md index 6ea719d1..af9d06b9 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Models are able to generate code, but they cannot run code with your local data. ## Contribute -If you have great ideas, [read the following document](./CONTRIBUTING.md) to contribute. +See [CONTRIBUTING.md](./CONTRIBUTING.md) for conventions, generator workflows, tests, and how to open a pull request. ## Examples From c25802f2893cf1e3de4d2d5fb381f74b728a663b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Antonio=20Bre=C3=B1a=20Moral?= Date: Sun, 5 Apr 2026 23:38:04 +0200 Subject: [PATCH 2/2] feat(tooling): add pre-commit hooks support --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 0928fb33..c6a9f0d8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -68,7 +68,7 @@ npx skill-check skills ### Pre-commit hooks (recommended) -This repository includes [pre-commit](https://pre-commit.com/) configuration at [`.pre-commit-config.yaml`](.pre-commit-config.yaml): YAML checks and a **commit-msg** hook that enforces the Conventional Commit rules above (including a required **scope**). +This repository includes [pre-commit](https://pre-commit.com/) configuration at [`.pre-commit-config.yaml`](.pre-commit-config.yaml): YAML checks and a **commit-msg** hook that enforces the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) rules above (including a required **scope**). **Setup (once per clone):**