# git-cliff ~ configuration
# https://git-cliff.org/docs/configuration

[changelog]
# Changelog header
header = """
# 🚀 Pantheon Changelog

All notable changes to this project will be documented in this file.

Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and versioning follows [Semantic Versioning](https://semver.org/).
"""

# Body template for each release
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 %}
        - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}**[BREAKING]** {% endif %}\
{{ commit.message | upper_first }}{% if commit.links %} ({% for link in commit.links %}[{{ link.text }}]({{ link.href }}){% if not loop.last %}, {% endif %}{% endfor %}){% endif %}\
{% endfor %}{% endfor %}{% if github and github.contributors %}\
{% for contributor in github.contributors %}

    > Contributed by @{{ contributor }}
{% endfor %}{% endif %}\
"""

# Changelog footer
footer = """
---

> [!NOTE]
> **Auto-generated by [git-cliff](https://git-cliff.org/)** — Do not edit manually.
"""

# Trim whitespace
trim = true

# Render body even if no commits
render_always = true

# Post-processors
postprocessors = [
    # Link GitHub issues
    { pattern = '#(\\d+)', replace = "[#$1](https://github.com/ils15/pantheon/issues/$1)" },
    # Link commit hashes
    { pattern = "(\\b[0-9a-f]{7,40}\\b)", replace = "[$1](https://github.com/ils15/pantheon/commit/$1)" },
]

[git]
# Parse conventional commits
conventional_commits = true

# Exclude non-conventional commits
filter_unconventional = true

# Don't require all commits to be conventional
require_conventional = false

# Don't split commits
split_commits = false

# Commit parsers - map commit types to changelog groups
commit_parsers = [
    { message = "^feat", group = "✨ Features" },
    { message = "^fix", group = "🐛 Bug Fixes" },
    { message = "^doc", group = "📚 Documentation" },
    { message = "^perf", group = "⚡ Performance" },
    { message = "^refactor", group = "🔧 Refactor" },
    { message = "^style", group = "🎨 Styling" },
    { message = "^test", group = "🧪 Testing" },
    { message = "^ci", group = "🤖 CI/CD" },
    { message = "^build", group = "📦 Build" },
    { message = "^chore\\(deps.*\\)", skip = true },
    { message = "^chore\\(pr\\)", skip = true },
    { message = "^chore\\(pull\\)", skip = true },
    { message = "^chore\\(release\\): prepare for", skip = true },
    { message = "^chore\\(release\\)", skip = true },
    { message = "^chore|^misc", group = " miscellaneous Tasks" },
    { body = ".*security", group = "🔒 Security" },
]

# Filter commits
filter_commits = false

# Tag pattern
tag_pattern = "v[0-9].*"

# Skip tags
skip_tags = ""

# Ignore tags
ignore_tags = ""

# Topological order
topo_order = false

# Sort commits
sort_commits = "oldest"

# Link parsers
link_parsers = [
    { pattern = "#(\\d+)", href = "https://github.com/ils15/pantheon/issues/$1" },
    { pattern = "RFC(\\d+)", text = "ietf-rfc$1", href = "https://datatracker.ietf.org/doc/html/rfc$1" },
]

# Processing order
processing_order = [
    "commit_preprocessors",
    "split_commits",
    "conventional_commits",
    "commit_parsers",
    "link_parsers",
]

# Limit commits (0 = no limit)
limit_commits = 0

# Include paths
include_paths = []

# Exclude paths
exclude_paths = []

# GitHub integration
github = true
