|
| 1 | +--- |
| 2 | +allowed-tools: Bash(git tag:*), Bash(git log:*), Bash(git diff:*), Bash(git status:*), Bash(git fetch:*), Bash(git branch:*), Bash(pwd), Bash(ls:*), Bash(cat:*), Bash(cd:*), Bash(head:*), Bash(echo:*), Read, Write, Edit |
| 3 | +description: Generate a changelog comparing a specified tag (or latest if not provided) with the previous version across OSS and enterprise repositories. |
| 4 | +--- |
| 5 | + |
| 6 | +## Your task |
| 7 | + |
| 8 | +Generate a succinct changelog by comparing a specified git tag with the previous version following semantic versioning patterns. If no tag is specified via $ARGUMENTS, use the latest tag. Take changes in only the OSS repository (current directory), try to ignore any enterprise or adp related changes. Update the root CHANGELOG.md file with up to 10 most significant changes. |
| 9 | + |
| 10 | +The version comparison logic: |
| 11 | +- For patch versions (x.y.z): compare with x.y.(z-1) or x.y.(highest patch) |
| 12 | + - Example: 2.8.9 compares with 2.8.7 |
| 13 | +- For minor versions (x.y.0): compare with x.(y-1).(highest patch) |
| 14 | + - Example: 3.2.0 compares with 3.1.3 |
| 15 | + |
| 16 | +## Context |
| 17 | + |
| 18 | +### User provided input for this command |
| 19 | + |
| 20 | +The user provided the following additional input for this command (may be empty): $ARGUMENTS |
| 21 | + |
| 22 | +**Usage**: |
| 23 | +- `changelog` - Generate changelog for the latest tag |
| 24 | +- `changelog v2.8.9` - Generate changelog for a specific tag (v2.8.9) |
| 25 | +- `changelog 2.8.9` - Generate changelog for a specific tag (accepts with or without 'v' prefix) |
| 26 | + |
| 27 | +### Repository Information |
| 28 | +- Current directory: !`pwd` |
| 29 | +- OSS repository latest tags: !`git tag --sort=-version:refname | head -10` |
| 30 | + |
| 31 | + |
| 32 | +### Current State |
| 33 | +- OSS current branch: !`git branch --show-current` (should be master) |
| 34 | +- OSS git status: !`git status --porcelain` |
| 35 | + |
| 36 | +### Changelog Generation Steps |
| 37 | + |
| 38 | +1. **Determine Version Range**: |
| 39 | + - If $ARGUMENTS is provided, use that as the target tag (add 'v' prefix if missing) |
| 40 | + - If $ARGUMENTS is empty, get the latest tag from OSS repo |
| 41 | + - Calculate the previous version based on semantic versioning rules |
| 42 | + - Verify both tags exist |
| 43 | + |
| 44 | +2. **Check if Changelog Entry Already Exists**: |
| 45 | + - Read CHANGELOG.md to see if the target version already has an entry |
| 46 | + - If entry exists and there are commits since the tag, update "Master / Unreleased" section instead |
| 47 | + - If no entry exists, proceed with creating a new version section |
| 48 | + |
| 49 | +3. **Collect Changes from OSS Repository**: |
| 50 | + - For existing entries: Get commits since the target tag: `git log --pretty=format:"%s" <target_tag>..HEAD` |
| 51 | + - For new entries: Get commits between versions: `git log --pretty=format:"%s" <prev_tag>..<target_tag>` |
| 52 | + - Filter and categorize commits into [BUGFIX], [IMPROVEMENT], [CHANGE], and [SECURITY] |
| 53 | + - Select up to 10 most significant changes |
| 54 | + - |
| 55 | + |
| 56 | +4. **Update CHANGELOG.md**: |
| 57 | + - **For existing entries**: Update "Master / Unreleased" section with new changes since the tag |
| 58 | + - **For new patch releases**: Create new version section with changes from previous version |
| 59 | + - **For new minor/major releases**: Create new version section using unreleased changes + new changes from previous version |
| 60 | + - Limit to 10 most significant changes total across both repositories |
| 61 | + - Format: |
| 62 | + ``` |
| 63 | + ## [v<target_tag>] - YYYY-MM-DD |
| 64 | + |
| 65 | + - [IMPROVEMENT] Description of improvement |
| 66 | + - [BUGFIX] Description of bug fix |
| 67 | + - [CHANGE] Description of breaking or significant change |
| 68 | + - [SECURITY] Description of security fix |
| 69 | + ``` |
| 70 | + |
| 71 | +### Classification Guidelines |
| 72 | + |
| 73 | +**[IMPROVEMENT]** entries include: |
| 74 | +- New features (feat:, feature:) |
| 75 | +- Enhancements to existing functionality |
| 76 | +- Performance improvements (perf:) |
| 77 | +- UI/UX improvements |
| 78 | +- Documentation updates (docs:) |
| 79 | +- Refactoring that adds value (refactor:) |
| 80 | + |
| 81 | +**[BUGFIX]** entries include: |
| 82 | +- Bug fixes (fix:) |
| 83 | +- Critical patches |
| 84 | +- Hotfixes |
| 85 | +- Error handling improvements |
| 86 | + |
| 87 | +**[CHANGE]** entries include: |
| 88 | +- Breaking changes |
| 89 | +- API changes |
| 90 | +- Configuration changes |
| 91 | +- Deprecations |
| 92 | +- Significant architectural changes |
| 93 | + |
| 94 | +**[SECURITY]** entries include: |
| 95 | +- Security fixes (security:) |
| 96 | +- Vulnerability patches |
| 97 | +- Authentication/authorization improvements |
| 98 | +- Security-related configuration changes |
| 99 | + |
| 100 | +### Output Requirements |
| 101 | + |
| 102 | +- Update the root `CHANGELOG.md` file appropriately based on the scenario: |
| 103 | + - **Existing version entry**: Update "Master / Unreleased" section with changes since the tag |
| 104 | + - **New patch version**: Create new version section with changes from previous version |
| 105 | + - **New minor/major version**: Incorporate existing unreleased changes into the new version section |
| 106 | +- Limit to 10 most significant changes total across both repositories |
| 107 | +- Display a summary of changes found |
| 108 | +- Group similar changes together |
| 109 | +- Exclude merge commits, version bumps, and CI-only changes |
| 110 | +- Use clear, concise descriptions that focus on user-facing changes |
| 111 | +- Prioritize user-impacting changes over internal refactoring |
| 112 | +- Add in date order to the `CHANGELOG.md` file |
| 113 | + |
| 114 | +### Special Handling for Non-Patch Releases |
| 115 | + |
| 116 | +For minor (x.y.0) and major (x.0.0) releases: |
| 117 | +1. **Preserve Unreleased Changes**: Extract existing bullet points from "Master / Unreleased" section |
| 118 | +2. **Merge with New Changes**: Combine unreleased changes with new changes from the version comparison |
| 119 | +3. **Create Complete Version Section**: Use the merged changes to create a comprehensive changelog entry |
| 120 | +4. **Clear Unreleased Section**: Reset "Master / Unreleased" to empty or minimal state after incorporating changes |
| 121 | +5. **Maintain Chronological Order**: Ensure changes are ordered logically within each category |
| 122 | + |
| 123 | +### Version-Specific Logic |
| 124 | + |
| 125 | +- **Patch releases (x.y.z where z > 0)**: Only include changes from the comparison range |
| 126 | +- **Minor releases (x.y.0)**: Include unreleased changes + comparison range changes |
| 127 | +- **Major releases (x.0.0)**: Include unreleased changes + comparison range changes |
| 128 | +- **Pre-release versions (x.y.z-alpha/beta/rc)**: Treat as patch releases unless otherwise specified |
0 commit comments