{# scrat release-notes template — rendered by git-cliff via --from-context / --body #}
{# Context: git-cliff's native release object + extra.stats, extra.deps, extra.metadata #}
{% if version -%}
## {{ version }}
{%- else -%}
## Unreleased
{%- endif %}{% if timestamp %} — {{ timestamp | date(format="%Y-%m-%d") }}{% endif %}
{% if previous and previous.version and version %}
[Compare](../compare/{{ previous.version }}...{{ version }})
{% endif %}
{# ── Breaking changes ── #}
{% set breaking_commits = commits | filter(attribute="breaking", value=true) -%}
{% if breaking_commits | length > 0 %}
> [!WARNING]
> **Breaking changes in this release**
{% for commit in breaking_commits %}
> - {{ commit.message }}{% if commit.breaking_description %} — {{ commit.breaking_description }}{% endif %}
{%- endfor %}

{% endif -%}

{# ── Grouped changes ── #}
{# Group names may include sort-priority HTML comments (e.g., "<!-- 0 -->Features") #}
{% for group, commits in commits | group_by(attribute="group") -%}
{% if "feat" in group or "Features" in group or "Added" in group -%}
### ✨ Added
{% elif "fix" in group or "Bug Fixes" in group -%}
### 🩹 Fixed
{% elif "perf" in group or "Performance" in group -%}
### ⚡ Performance
{% elif "refactor" in group or "Refactor" in group -%}
### 🧰 Refactor
{% elif "docs" in group or "Documentation" in group -%}
### 📚 Docs
{% elif "test" in group or "Testing" in group -%}
### 🧪 Tests
{% elif "style" in group or "Styling" in group -%}
### 🎨 Style
{% elif "chore" in group or "Miscellaneous" in group -%}
### 🧹 Chores
{% else -%}
### {{ group }}
{% endif -%}
{% for commit in commits -%}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{{ commit.message }} ([{{ commit.id | truncate(length=7, end="") }}](../commit/{{ commit.id }}))
{% endfor %}
{% endfor -%}

{# ── Dependencies ── #}
{% if extra and extra.deps and extra.deps | length > 0 -%}
### 📦 Dependencies

{% for d in extra.deps -%}
{% if d.from and d.to -%}
- **{{ d.name }}**: `{{ d.from }}` → `{{ d.to }}`
{% elif d.to -%}
- **{{ d.name }}** `{{ d.to }}` *(added)*
{% elif d.from -%}
- ~~{{ d.name }}~~ `{{ d.from }}` *(removed)*
{% endif -%}
{% endfor %}
{% endif -%}

{# ── Stats table ── #}
{% set s = extra.stats | default(value=false) -%}
{% if s -%}
### 📊 Stats

| Metric | Value |
|---|---:|
| Commits | {{ statistics.commit_count | default(value="—") }} |
{% if s.files_changed is defined -%}
| Files changed | {{ s.files_changed }} |
{% endif -%}
{% if s.insertions is defined -%}
| Insertions | +{{ s.insertions }} |
{% endif -%}
{% if s.deletions is defined -%}
| Deletions | -{{ s.deletions }} |
{% endif -%}

{% endif -%}

{# ── Nerd drawer ── #}
<details>
<summary>Full commit list</summary>

{% for commit in commits -%}
- [`{{ commit.id | truncate(length=7, end="") }}`](../commit/{{ commit.id }}) {{ commit.message }}{% if commit.author and commit.author.name %} — *{{ commit.author.name }}*{% endif %}
{% endfor -%}
{% if s and s.contributors and s.contributors | length > 0 %}
**Contributors:** {% for c in s.contributors %}{{ c.name }} ({{ c.count }}){% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}
</details>

<!-- another release powered by scrat: github.com/claylo/scrat -->
