Skip to content

Commit 7110ec9

Browse files
committed
chore: support commit ordinals in changelog and release notes skill
Allow passing a commit number (e.g. 3665) to changelog.sh and the release-notes skill, resolving it to the Nth commit in repo history. Also add Dependencies section and bug fix inclusion rules to the release notes prompt. Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent d6deda3 commit 7110ec9

2 files changed

Lines changed: 31 additions & 10 deletions

File tree

.claude/skills/release-notes/SKILL.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: release-notes
3-
description: Generate GitHub release notes from git tags. Usage - /release-notes <from_tag> <to_tag>. Runs the changelog script, then rewrites the output into polished GitHub release notes.
4-
disable-model-invocation: true
5-
argument-hint: <from_tag> <to_tag>
3+
description: Generate GitHub release notes from git refs (tags, commits, or HEAD). Usage - /release-notes <from> <to>. Runs the changelog script, then rewrites the output into polished GitHub release notes.
4+
argument-hint: <from_ref> [to_ref]
65
user-invocable: true
76
allowed-tools: Bash(git log *), Bash(git tag *), Bash(git describe *), Bash(bash scripts/changelog.sh *), Bash(gh release *), Read, Agent
87
---
@@ -18,12 +17,14 @@ Generate polished GitHub release notes for the code-android-app repository.
1817

1918
## Input
2019

21-
Parse the two tags from `$ARGUMENTS`, e.g.:
20+
Parse the two refs from `$ARGUMENTS`. Each ref can be a tag, a commit SHA, a commit number (Nth commit in repo history), or `HEAD`:
2221
- `/release-notes fcash/2026.4.10 fcash/2026.4.11`
2322
- `/release-notes fcash/2026.4.9 HEAD`
23+
- `/release-notes a3f2417 HEAD`
24+
- `/release-notes 3599 HEAD` (from the 3599th commit to HEAD)
2425

25-
If only one tag is provided, use it as `<from>` and default `<to>` to `HEAD`.
26-
If no tags are provided, use the pre-flight latest tag as `<from>` and `HEAD` as `<to>`.
26+
If only one ref is provided, use it as `<from>` and default `<to>` to `HEAD`.
27+
If no refs are provided, use the pre-flight latest tag as `<from>` and `HEAD` as `<to>`.
2728

2829
## Steps
2930

@@ -42,14 +43,15 @@ Use the Agent tool with `model: "haiku"`. Pass the raw changelog output with thi
4243
> Given these git commits (conventional commit format), write user-facing release notes.
4344
>
4445
> Rules:
45-
> - Group under: **Features**, **Bug Fixes**, **Improvements** (omit empty sections)
46+
> - Group under: **Features**, **Bug Fixes**, **Improvements**, **Dependencies** (omit empty sections)
4647
> - Write for end users — no jargon, file names, or internals
4748
> - One short sentence per item
4849
> - Group related commits into a single bullet when they address the same area
4950
> - Use scope as context but write in plain language; keep scope in **bold** prefix when it adds clarity
50-
> - Drop internal-only changes (pure refactors, CI tweaks, build config) unless user-facing
51+
> - ALWAYS include bug fixes — only drop pure refactors, CI pipeline changes, and release/manifest bookkeeping
5152
> - Feature bullets start with a lowercase verb (e.g., "add", "support", "enable")
5253
> - Bug fix bullets start with "Fixed" (capitalized)
54+
> - **Dependencies** section: list each dependency bump as `Name X.Y.Z → A.B.C` (use the human-readable library name, not the Maven coordinate). Include targetSdkVersion and Gradle wrapper bumps in this section too.
5355
> - Use 2-space indent before each bullet (` - `)
5456
> - Do NOT include commit hashes
5557
> - If no user-facing changes, output: Bug fixes and performance improvements.

scripts/changelog.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,27 @@
1010

1111
set -euo pipefail
1212

13-
FROM="${1:?Usage: changelog.sh <from> <to>}"
14-
TO="${2:-HEAD}"
13+
# Resolve a ref that might be a commit number (e.g. 3599 = the 3599th commit).
14+
# Pure numbers with fewer than 7 digits are always treated as commit ordinals
15+
# (7 is the minimum git short-SHA length, so this avoids ambiguity).
16+
# Everything else (tags, SHAs, HEAD) passes through as-is.
17+
resolve_ref() {
18+
local ref="$1"
19+
if [[ "$ref" =~ ^[0-9]+$ ]] && [ "${#ref}" -lt 7 ]; then
20+
local sha
21+
sha=$(git rev-list --reverse HEAD | sed -n "${ref}p")
22+
if [ -z "$sha" ]; then
23+
echo "Error: commit #$ref not found (repo has $(git rev-list --count HEAD) commits)" >&2
24+
exit 1
25+
fi
26+
echo "$sha"
27+
else
28+
echo "$ref"
29+
fi
30+
}
31+
32+
FROM=$(resolve_ref "${1:?Usage: changelog.sh <from|commit#> [to|commit#]}")
33+
TO=$(resolve_ref "${2:-HEAD}")
1534

1635
# Collect commits (skip merges)
1736
COMMITS=$(git log --no-merges --format="%H %s" "$FROM".."$TO")

0 commit comments

Comments
 (0)