CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
changelog-generator.ts
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 6e41e81 | 1 | /** |
| 2 | * changelog-generator.ts — AI-powered changelog generator for releases. | |
| 3 | * | |
| 4 | * Public entrypoint used by the release form and external automation. | |
| 5 | * Thin wrapper over `ai-release-notes.ts` that exposes the canonical | |
| 6 | * `generateChangelog(owner, repo, fromTag, toRef, repoId)` signature. | |
| 7 | * | |
| 8 | * Pipeline: | |
| 9 | * 1. Walk `git log fromTag..toRef --no-merges` for raw commits. | |
| 10 | * 2. Cross-reference commits with the `pull_requests` table to enrich | |
| 11 | * each entry with PR metadata (labels, author, body excerpt). | |
| 12 | * 3. Bucket commits/PRs by conventional-commit prefix or label into | |
| 13 | * categories: features, fixes, perf, docs, security, ai_changes, other. | |
| 14 | * 4. If `ANTHROPIC_API_KEY` is set, ask Claude (claude-sonnet-4-6) to write | |
| 15 | * a polished, human-readable Markdown changelog from the grouped input. | |
| 16 | * 5. Fall back to a deterministic grouped list when the key is absent. | |
| 17 | * | |
| 18 | * Output format (AI path): | |
| 19 | * | |
| 20 | * ## v1.3.0 (since v1.2.0) | |
| 21 | * **Short release tagline** | |
| 22 | * | |
| 23 | * One-to-three sentence summary of what changed and why it matters. | |
| 24 | * | |
| 25 | * ### Features | |
| 26 | * - Add PR preview environments (#42) — @alice | |
| 27 | * | |
| 28 | * ### Bug fixes | |
| 29 | * - Fix race condition in SSE reconnection (#37) — @bob | |
| 30 | * | |
| 31 | * _Full changelog_: `v1.2.0...v1.3.0` | |
| 32 | */ | |
| 33 | ||
| 34 | import { generateReleaseNotes } from "./ai-release-notes"; | |
| 35 | ||
| 36 | /** | |
| 37 | * Generate a human-readable Markdown changelog for the commit range | |
| 38 | * `fromTag..toRef` on `owner/repo`. | |
| 39 | * | |
| 40 | * @param owner — repository owner username | |
| 41 | * @param repo — repository name | |
| 42 | * @param fromTag — previous tag/ref (e.g. "v1.2.0"); pass empty string for | |
| 43 | * "all commits reachable from toRef" | |
| 44 | * @param toRef — target tag/ref (e.g. "HEAD" or "v1.3.0") | |
| 45 | * @param repoId — database UUID of the repository (for PR cross-reference) | |
| 46 | * @returns — Markdown string ready to store in `releases.body` | |
| 47 | */ | |
| 48 | export async function generateChangelog( | |
| 49 | owner: string, | |
| 50 | repo: string, | |
| 51 | fromTag: string, | |
| 52 | toRef: string, | |
| 53 | repoId: string | |
| 54 | ): Promise<string> { | |
| 55 | const result = await generateReleaseNotes({ | |
| 56 | repositoryId: repoId, | |
| 57 | fromTag: fromTag.trim() || null, | |
| 58 | toTag: toRef.trim() || "HEAD", | |
| 59 | }); | |
| 60 | return result.markdown; | |
| 61 | } | |
| 62 | ||
| 63 | // Re-export helpers that callers may want for testing / introspection. | |
| 64 | export type { ReleaseNotesResult, ReleaseSections, ReleaseSectionKey } from "./ai-release-notes"; | |
| 65 | export { classifyPr, bucketPrs, renderSectionsToMarkdown, isSemverTag } from "./ai-release-notes"; |