Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work.
Python agent-skillsai-agentsbook-to-skillcontext-engineeringdocument-processingedtechknowledge-baseknowledge-managementllmpdf-to-markdownragself-studystudy-tools
chore(ci): generate CHANGELOG from commits with git-cliff (#104)
Virgilio Junior45870f6824c2
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.mdindex 062ea05..e4a1b25 100644--- a/.github/PULL_REQUEST_TEMPLATE.md+++ b/.github/PULL_REQUEST_TEMPLATE.md@@ -59,7 +59,7 @@ Closes #<!-- issue number, or "n/a" with a one-line reason if there is no issue- [ ] `pytest -q` is green on a clean checkout- [ ] `ruff check .` is clean- [ ] `python3 tools/validate_skill.py SKILL.md` passes (if `SKILL.md` changed)-- [ ] `CHANGELOG.md` updated under `## [Unreleased]`+- [ ] PR title follows Conventional Commits (`fix:`, `feat:`, `docs:`… — it becomes the changelog entry; do NOT edit `CHANGELOG.md` by hand)- [ ] No raw book text shipped; no net `SKILL.md` bloat without justification## Breaking changes & back-compat (Optional)diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f8cbb9d..ad729fc 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -169,3 +169,32 @@ jobs:sys.exit(1)print("PR description looks complete.")PY++ pr-title:+ name: PR title (Conventional Commits)+ # The changelog is generated from commit messages by git-cliff, and squash+ # merges use the PR title as the commit — so the title must be a valid+ # Conventional Commit or it won't show up (or shows up wrong) in the release+ # changelog. Skips Dependabot (its titles are already conventional).+ if: github.event_name == 'pull_request' && github.event.pull_request.user.login != 'dependabot[bot]'+ runs-on: ubuntu-latest+ steps:+ - name: Validate PR title+ # Title passed via env (never interpolated into the shell).+ env:+ PR_TITLE: ${{ github.event.pull_request.title }}+ run: |+ python3 - <<'PY'+ import os, re, sys+ title = (os.environ.get("PR_TITLE") or "").strip()+ # type(scope)!: subject — types per cliff.toml commit_parsers.+ pattern = r"^(feat|fix|perf|refactor|docs|sec|chore|ci|test|build|style|revert)(\([\w.\-/ ]+\))?!?: .+"+ if not re.match(pattern, title):+ print(f"PR title is not a Conventional Commit:\n {title!r}\n")+ print("Expected: <type>(<optional scope>): <subject>")+ print("Types: feat, fix, perf, refactor, docs, sec, chore, ci, test, build, style, revert")+ print("e.g. 'fix(extractor): detect Korean chapter headings'")+ print("\nThe title becomes the changelog entry (generated by git-cliff), so it must be conventional.")+ sys.exit(1)+ print("PR title looks good.")+ PYdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 72ac9bf..7150da9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,11 @@ All notable changes to **book-to-skill** are documented here.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+> **Do not edit this file by hand.** From the next release on it is generated+> from Conventional Commit messages by [git-cliff](https://github.com/orhun/git-cliff)+> (`git-cliff --tag vX.Y.Z -o CHANGELOG.md`). Write a good PR title instead — it+> becomes the changelog entry. See `cliff.toml` and CONTRIBUTING.md.+## [Unreleased]### Fixeddiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 3734c93..cfa0d51 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -39,8 +39,13 @@ python3 tools/validate_skill.py SKILL.md- **Conventional Commits** for titles and commits: `feat:`, `fix:`, `docs:`,`chore:`, `test:`, `ci:` … (e.g. `fix(extractor): scan full text`).- Add or update tests for any behavior change.-- Update `CHANGELOG.md` under an `## [Unreleased]` section.-- CI must be green (lint, test matrix py3.10–3.13, smoke, SKILL.md validation).+- **Do not edit `CHANGELOG.md`.** It is generated from Conventional Commit+ messages by [git-cliff](https://github.com/orhun/git-cliff) at release time.+ Your **PR title** must be a valid Conventional Commit (`fix:`, `feat:`,+ `docs:`, `perf:`, `refactor:`, `chore:`…) — squash-merge turns it into the+ commit, and that line becomes your changelog entry. CI checks the title.+- CI must be green (lint, test matrix py3.10–3.13, smoke, SKILL.md validation,+ PR title + description checks).- **We don't accept PRs that add third-party or "related / built-with" projectlinks to the README or docs.** Recognition in the README is a[GitHub Sponsors](https://github.com/sponsors/virgiliojr94) benefit (sponsors are@@ -50,9 +55,21 @@ python3 tools/validate_skill.py SKILL.md## Releases-Maintainers cut releases with semantic versioning: tag `vX.Y.Z`, move the-`Unreleased` changelog section under the new version with the date, and publish a-GitHub Release using those notes.+Maintainers cut releases with semantic versioning. The changelog is generated+from Conventional Commit messages — do not hand-edit it:++```bash+# 1. bump version in pyproject.toml+# 2. regenerate CHANGELOG.md from commits (needs git-cliff installed locally)+git-cliff --tag vX.Y.Z -o CHANGELOG.md+# 3. commit, tag, push+git commit -am "chore(release): vX.Y.Z"+git tag vX.Y.Z && git push origin master vX.Y.Z+# 4. publish a GitHub Release using the new CHANGELOG section as notes+```++git-cliff is a dev-only tool (a single static binary; not a runtime dependency+of book-to-skill). See `cliff.toml` for the type→section mapping.## Reporting bugs / requesting featuresdiff --git a/cliff.toml b/cliff.tomlnew file mode 100644index 0000000..bbf664b--- /dev/null+++ b/cliff.toml@@ -0,0 +1,57 @@+# git-cliff configuration — generates CHANGELOG.md from Conventional Commit+# messages so PRs never edit the changelog by hand (no more merge-conflict churn+# on a shared [Unreleased] section). Keep a Changelog style; grouped by type.+# Regenerate at release time: git-cliff --tag vX.Y.Z -o CHANGELOG.md++[changelog]+header = """+# Changelog++All notable changes to **book-to-skill** are documented here.++The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+This file is generated from Conventional Commit messages by+[git-cliff](https://github.com/orhun/git-cliff) — do not edit it by hand.+"""+body = """+{% if version %}\+## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}+{% else %}\+## [Unreleased]+{% endif %}\+{% for group, commits in commits | group_by(attribute="group") %}+### {{ group | upper_first }}+{% for commit in commits %}\+- {{ commit.message | upper_first }}{% if commit.remote.pr_number %} (#{{ commit.remote.pr_number }}){% endif %}+{% endfor %}\+{% endfor %}\n+"""+trim = true++[git]+conventional_commits = true+filter_unconventional = true+split_commits = false+protect_breaking_commits = true+filter_commits = false+tag_pattern = "v[0-9]*"+topo_order = false+sort_commits = "oldest"++# Map Conventional Commit types to Keep a Changelog sections.+commit_parsers = [+ { message = "^feat", group = "Added" },+ { message = "^fix", group = "Fixed" },+ { message = "^perf", group = "Changed" },+ { message = "^refactor", group = "Changed" },+ { message = "^docs", group = "Documentation" },+ { message = "^sec", group = "Security" },+ { message = "^.*: *sec", group = "Security" },+ { message = "^chore\\(release\\)", skip = true },+ { message = "^chore\\(deps\\)", skip = true },+ { message = "^chore", group = "Miscellaneous" },+ { message = "^ci", skip = true },+ { message = "^test", skip = true },+ { body = ".*security", group = "Security" },+]