# =release-notes <from>..<to> [repo]: a changelog from git history, grouped by type.
#
# What this app teaches (copy the pattern):
# 1. User input that reaches git is validated first (no leading dash, allowlisted characters, refs resolved with rev-parse) and git runs without a shell, with `--` before any path.
# 2. One right pane only: the chart plots just the rows that carry `type_count` (Features, Fixes, Other); the changelog and commits are list rows whose `value` field the Copy action puts on the clipboard.
# 3. `=release-notes demo` shows a fabricated changelog, every row marked SAMPLE DATA; a range that fails gets an honest error row, never sample data.
#
# Type a range such as v1.0..v1.1 (or v1.0 for v1.0..HEAD). Repos come from Bolt's project folders (none configured: sample data is offered). The whole query is one argument, so a repo folder name may have spaces. If both refs exist in several repos, add the repo folder name after the range.
# Enter copies the highlighted row (the full changelog, a section, or one commit line).
schema_version: 1
runtime: bridge
id: release-notes
chip: release-notes
title: Release notes
icon: file-text
description: "Group the commits between two git refs into Features, Fixes and Other, with a copyable changelog. =release-notes demo shows sample data"
placeholder_examples: ["v1.0..v1.1", "v1.0 my-repo", "demo"]
emits: Generic

dispatch:
  confirm_label: 'Build release notes {{query}}'
  confirm_hint: "Press Enter to read git history (read-only) · a range like v1.0..v1.1 · demo shows sample data"

bridge:
  command:
    macos: "python3 {{scripts_dir}}/bolt-release-notes.py {{query}}"
    linux: "python3 {{scripts_dir}}/bolt-release-notes.py {{query}}"
    windows: "python {{scripts_dir}}/bolt-release-notes.py {{query}}"
  parse: json
  timeout_seconds: 30

presentation:
  widget: list
  title_field: title
  subtitle_field: subtitle
  searchable: true
  right_widget:
    kind: entity_preview
    mode: selected_row
    bind:
      title: "{{row.title}}"
      subtitle: "{{row.subtitle}}"
      fields:
        - { label: Type, value: "{{row.type_label}}" }
        - { label: Commits, value: "{{row.type_count}}" }
        - { label: Data, value: "{{row.data}}" }
      body: "{{row.body}}"
      actions: [copy-md]

actions:
  - { id: copy-md, kind: composer, target: row, label: Copy notes, insert: "{{row.value}}", primary: true }
