changelog-from-commits.yaml 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. version: 1.0.0
  2. title: Update Changelog from last commits
  3. description: A custom recipe to update changelog from the last X commits
  4. instructions: Analyze recent Git commits and automatically update project changelogs following Keep a Changelog format. Read commit history using git log, understand the nature of code changes (API refactoring, new features, bug fixes, etc.), and add appropriately categorized entries to the Unreleased section. Use the git author's username for attribution and follow established changelog patterns including proper formatting with contributor links. Requires git command line tools and file editing capabilities.
  5. prompt: |
  6. You are tasked with updating the CHANGELOG.md file based on recent Git commits. Follow these instructions:
  7. ## Analysis Process:
  8. 1. **Get commit count**: Check if a COMMITS environment variable was provided (default to 5 if not specified)
  9. 2. **Read recent commits**: Use `git log -n X` to analyze the last X commits (where X is the number specified by user or default)
  10. 3. **Get git author**: Use `git config --get user.name` to get the author name for attribution
  11. 4. **Analyze change types**: Categorize changes into:
  12. - **Added**: New features, new functions, new files, new functionality
  13. - **Changed**: Modifications to existing functionality, refactoring, API changes, dependency updates
  14. - **Fixed**: Bug fixes, error handling improvements, corrections
  15. - **Removed**: Deleted files, deprecated functions, removed dependencies
  16. ## CHANGELOG.md Update Requirements:
  17. 1. **Preserve existing format**: Keep the exact formatting style of the existing CHANGELOG.md
  18. 2. **Update Unreleased section**: Add new entries to the "## [Unreleased]" section only
  19. 3. **Use proper categories**: Add entries under the appropriate subsections (Added, Changed, Fixed, Removed)
  20. 4. **Follow format pattern**: Each entry should follow this exact format:
  21. ```
  22. - component: Description of change ([author]).
  23. ```
  24. 5. **Author attribution**: Use the git author name in square brackets at the end of each entry
  25. 6. **Component identification**: Identify the relevant component (e.g., "cdk", "cashu", "cdk-cli", etc.) from file paths
  26. 7. **Maintain formatting**:
  27. - Use proper bullet points with hyphens
  28. - Maintain consistent spacing
  29. - Keep entries concise but descriptive
  30. - End each entry with period before author attribution
  31. ## Example Entry Format:
  32. ```markdown
  33. ### Added
  34. - cdk: New keyset refresh functionality with improved error handling ([thesimplekid]).
  35. ### Changed
  36. - cdk: Refactored wallet keyset management for better performance ([thesimplekid]).
  37. ### Fixed
  38. - cdk-cli: Fixed token parsing error for malformed inputs ([thesimplekid]).
  39. ```
  40. ## Important Guidelines:
  41. - **DO NOT** modify any existing changelog entries
  42. - **DO NOT** change the structure or format of the changelog
  43. - **ONLY** add new entries to the Unreleased section
  44. - **DO NOT** add duplicate entries
  45. - **BE SPECIFIC** about what changed, not just which files
  46. - **FOCUS** on user-facing changes and important internal improvements
  47. - **IGNORE** trivial changes like whitespace, comments, or formatting unless they're significant
  48. ## Steps to Execute:
  49. 1. Check for COMMITS environment variable or ask user for the number of recent commits to analyze (default to 5)
  50. 2. Read current CHANGELOG.md file to understand format
  51. 3. Get git author name
  52. 4. Analyze recent commits with `git log -n X --pretty=format:"%h %s"`
  53. 5. For each commit, examine detailed changes with `git show COMMIT_HASH`
  54. 6. Categorize and write appropriate changelog entries
  55. 7. Update the CHANGELOG.md file preserving all existing content
  56. extensions:
  57. - type: builtin
  58. name: developer
  59. display_name: Developer
  60. timeout: 300
  61. bundled: true
  62. activities:
  63. - Update changelog from recent commits
  64. - Analyze API refactoring commits
  65. - Add new feature entries
  66. - Categorize bug fix changes
  67. - Format contributor attributions
  68. author:
  69. contact: thesimplekid