AI: Add skill to construct minor release changelog#34723
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📝 WalkthroughWalkthroughAdds a minor/major release workflow: new SKILL documentation, a CLI that aggregates and deduplicates prerelease changelog entries into a stable minor/major summary, and a CLI that composes and inserts the corresponding ChangesMinor Release Changelog Generation
sequenceDiagram
participant User as User (operator)
participant SumCLI as get-minor-changelog-summary CLI
participant WriteCLI as write-minor-changelog-section CLI
participant FS as Filesystem (`CHANGELOG*.md`)
User->>SumCLI: invoke (optionally) to preview entries OR used internally by WriteCLI
SumCLI->>FS: read `CHANGELOG.prerelease.md` + `CHANGELOG.md`
SumCLI->>SumCLI: parse sections, extract PRs, dedupe, return {text,entryCount,resolvedVersion}
User->>WriteCLI: run, piping highlights via stdin (and optional version/flags)
WriteCLI->>SumCLI: request full entries/resolved version
WriteCLI->>FS: read `CHANGELOG.md`
WriteCLI->>WriteCLI: compose `## X.Y.0` section with highlights + details block
WriteCLI->>FS: write updated `CHANGELOG.md` (or print on --dry-run)
WriteCLI->>User: output success/failure and summary
🎯 3 (Moderate) | ⏱️ ~20 minutes ✨ Finishing Touches📝 Generate docstrings
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.agents/skills/minor-release/get-minor-changelog-summary.ts:
- Around line 27-38: parseChangelogSections currently adds every "## " heading
as a key which can include non-semver headings and breaks downstream version
inference (used later when picking the first parsed section); update
parseChangelogSections to validate and only add keys that are valid
semver/semver-like headings (e.g., match a regex like
^v?\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$) or otherwise normalize headings to semver
before sections.set; ensure the function (parseChangelogSections) filters out
non-version headings so code that infers the target release from the first Map
key operates on actual release versions.
In @.agents/skills/minor-release/SKILL.md:
- Line 64: The fenced code blocks in SKILL.md that contain the example lines
starting with "> _Tagline phrase_", "> _Improved developer experience,
AI-assisting tools, and broader ecosystem support_", "> _Easier to setup, more
accessible to use_", and the block beginning "Storybook 10 contains one breaking
change: it's ESM-only." are missing language identifiers and trigger MD040;
update each opening triple-backtick fence for those blocks to include a language
tag (for example use ```text) so each fenced block becomes ```text ... ``` to
satisfy markdown linting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a02eab6e-638c-4c03-99d3-2c39af05026b
📒 Files selected for processing (3)
.agents/skills/minor-release/SKILL.md.agents/skills/minor-release/get-minor-changelog-summary.ts.agents/skills/minor-release/write-minor-changelog-section.ts
…s/storybook into jeppe/cahngelog-writing-skill
There was a problem hiding this comment.
Pull request overview
This PR introduces a new internal agent skill (minor-release) plus helper scripts to generate and write a Storybook X.Y.0 minor/major release section into CHANGELOG.md by aggregating prerelease changelog entries, filtering already-shipped patch PRs, and combining them with human-curated highlights.
Changes:
- Add a script to collect and de-duplicate prerelease changelog entries for a target
X.Y.0, filtering PRs already shipped in previous-minor patch releases. - Add a script to compose and insert/replace the
## X.Y.0section inCHANGELOG.mdusing highlights from stdin plus the generated full entry list. - Add a
minor-releaseskill guide (SKILL.md) documenting the workflow and the desired highlights-writing style.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.agents/skills/minor-release/get-minor-changelog-summary.ts |
Parses prerelease + stable changelogs to build the “all updates” list with patch-backport filtering. |
.agents/skills/minor-release/write-minor-changelog-section.ts |
Reads highlights from stdin, composes the full section, and writes/inserts it into CHANGELOG.md. |
.agents/skills/minor-release/SKILL.md |
Documents how to run the workflow and how to write the highlights block. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
.agents/skills/minor-release/get-minor-changelog-summary.ts (1)
29-40:⚠️ Potential issue | 🟠 Major | ⚡ Quick winFilter and normalize section headings to semver before inserting into the map.
parseChangelogSectionscurrently stores non-version headings/preface text too, so Line 82 can infer from an invalid key and fail the default “no version provided” path. Restrict map keys to valid semver headings (normalized) beforesections.set(...).💡 Minimal fix
function parseChangelogSections(content: string): Map<string, string> { const sections = new Map<string, string>(); const parts = content.split(/^## /m); for (const part of parts) { if (!part.trim()) { continue; } const newlineIdx = part.indexOf('\n'); - const version = newlineIdx === -1 ? part.trim() : part.slice(0, newlineIdx).trim(); + const rawHeading = newlineIdx === -1 ? part.trim() : part.slice(0, newlineIdx).trim(); const body = newlineIdx === -1 ? '' : part.slice(newlineIdx + 1); - sections.set(version, body); + const normalized = semver.valid(rawHeading) ? semver.clean(rawHeading) : null; + if (!normalized) { + continue; + } + sections.set(normalized, body); } return sections; }Also applies to: 82-95
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.agents/skills/minor-release/get-minor-changelog-summary.ts around lines 29 - 40, The parseChangelogSections function is adding non-version headings into the sections Map which later breaks version lookup; update parseChangelogSections to validate and normalize each section heading to a proper semver before calling sections.set(version, body). Use a semver parser/validator to accept only valid version headings (e.g., strip/normalize leading “v”, prerelease/build metadata handling) and skip any parts that do not parse to a legitimate semver; ensure the Map keys are the normalized semver strings so downstream code that reads from sections (the sections Map) never receives invalid keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In @.agents/skills/minor-release/get-minor-changelog-summary.ts:
- Around line 29-40: The parseChangelogSections function is adding non-version
headings into the sections Map which later breaks version lookup; update
parseChangelogSections to validate and normalize each section heading to a
proper semver before calling sections.set(version, body). Use a semver
parser/validator to accept only valid version headings (e.g., strip/normalize
leading “v”, prerelease/build metadata handling) and skip any parts that do not
parse to a legitimate semver; ensure the Map keys are the normalized semver
strings so downstream code that reads from sections (the sections Map) never
receives invalid keys.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8ffb8628-eab4-4872-aaca-3fd98ad1e590
📒 Files selected for processing (4)
.agents/skills/minor-release/SKILL.md.agents/skills/minor-release/get-minor-changelog-summary.ts.agents/skills/minor-release/write-minor-changelog-section.tsCHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
- CHANGELOG.md
Closes #
What I did
This PR adds a skill that we can use to build the changelog entry for minor/major releases. In summary it does:
The idea is to run this skill from the final release PR to update the changelog.
It's not perfect, here are the highlights it generated today:
But it's probably a good enough draft for @shilman to improve.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Just run
/minor-releasein your prefered agent.Caution
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit