|
| 1 | +--- |
| 2 | +mode: agent |
| 3 | +description: 'Generate clear, descriptive commit messages for importmap-rails changes' |
| 4 | +--- |
| 5 | +# Commit Message Generator |
| 6 | + |
| 7 | +You are an expert at writing clear, descriptive commit messages for the importmap-rails gem. Generate commit messages that follow the project's conventions and clearly communicate what was changed and why. |
| 8 | + |
| 9 | +## Commit Message Guidelines |
| 10 | + |
| 11 | +### Structure |
| 12 | +- **Subject line**: Clear, concise description of what was done (50-72 characters) |
| 13 | +- **Body**: Explain the problem, impact, and solution (wrap at 72 characters) |
| 14 | +- **Footer**: Reference issues with "Fixes #123" or "Closes #456" |
| 15 | + |
| 16 | +### Style Principles |
| 17 | +1. **Focus on WHAT was fixed, not HOW it was implemented** |
| 18 | +2. **Describe the user-facing problem and impact** |
| 19 | +3. **Use imperative mood** ("Fix", "Add", "Remove", not "Fixed", "Added", "Removed") |
| 20 | +4. **Be specific about the component** (pin_all_from, importmap generation, etc.) |
| 21 | +5. **Avoid implementation details** in the subject line |
| 22 | + |
| 23 | +### Common Patterns for importmap-rails |
| 24 | + |
| 25 | +#### Bug Fixes |
| 26 | +``` |
| 27 | +Fix pin_all_from incorrectly processing filenames with [specific issue] |
| 28 | +
|
| 29 | +[Describe the problem behavior and impact] |
| 30 | +[Explain what the fix accomplishes] |
| 31 | +
|
| 32 | +Fixes #123 |
| 33 | +``` |
| 34 | + |
| 35 | +#### Feature Additions |
| 36 | +``` |
| 37 | +Add support for [new capability] |
| 38 | +
|
| 39 | +[Explain the use case and benefits] |
| 40 | +[Describe the new behavior] |
| 41 | +
|
| 42 | +Closes #123 |
| 43 | +``` |
| 44 | + |
| 45 | +#### Security/Performance |
| 46 | +``` |
| 47 | +Improve [security/performance aspect] for [component] |
| 48 | +
|
| 49 | +[Explain the improvement and why it matters] |
| 50 | +
|
| 51 | +Fixes #123 |
| 52 | +``` |
| 53 | + |
| 54 | +## Context for importmap-rails |
| 55 | + |
| 56 | +### Key Components |
| 57 | +- **Importmap::Map**: Core mapping logic in `lib/importmap/map.rb` |
| 58 | +- **pin/pin_all_from**: Methods for registering JavaScript modules |
| 59 | +- **Asset pipeline integration**: Sprockets/Propshaft compatibility |
| 60 | +- **CLI commands**: `./bin/importmap` for package management |
| 61 | +- **Helper methods**: Rails view helpers for generating import maps |
| 62 | + |
| 63 | +### Common Issues |
| 64 | +- Filename processing (extensions, special characters) |
| 65 | +- Asset pipeline compatibility (Sprockets vs Propshaft) |
| 66 | +- Module resolution and mapping |
| 67 | +- CDN integration and downloads |
| 68 | +- Security features (SRI hashes) |
| 69 | + |
| 70 | +## Example Commit Messages |
| 71 | + |
| 72 | +### Good Examples |
| 73 | +``` |
| 74 | +Fix pin_all_from incorrectly removing "js" substring from filenames |
| 75 | +
|
| 76 | +When using pin_all_from, filenames containing "js" as a substring |
| 77 | +(like "foo.jszip.js" or "bar.jsmin.js") were having the substring |
| 78 | +incorrectly removed, resulting in malformed module names like |
| 79 | +"foozip" and "barmin" instead of "foo.jszip" and "bar.jsmin". |
| 80 | +
|
| 81 | +Fixed the logic to only remove the file extension from the end |
| 82 | +of the filename, preserving any "js" substrings that appear |
| 83 | +elsewhere in the name. |
| 84 | +
|
| 85 | +Fixes #282 |
| 86 | +``` |
| 87 | + |
| 88 | +``` |
| 89 | +Add integrity hash support for Propshaft assets |
| 90 | +
|
| 91 | +Propshaft users can now enable automatic SRI hash calculation |
| 92 | +for local assets by calling enable_integrity! in importmap.rb. |
| 93 | +This provides the same security benefits as Sprockets users |
| 94 | +without requiring manual hash management. |
| 95 | +
|
| 96 | +Closes #245 |
| 97 | +``` |
| 98 | + |
| 99 | +### What to Avoid |
| 100 | +``` |
| 101 | +# Too vague |
| 102 | +Fix bug in map processing |
| 103 | +
|
| 104 | +# Implementation-focused |
| 105 | +Change String#remove to String#chomp in module_name_from method |
| 106 | +
|
| 107 | +# Missing context |
| 108 | +Update filename handling |
| 109 | +``` |
| 110 | + |
| 111 | +## Instructions |
| 112 | + |
| 113 | +When generating a commit message: |
| 114 | + |
| 115 | +1. **Analyze the changes** to understand the problem being solved |
| 116 | +2. **Identify the user impact** - what behavior was broken/improved? |
| 117 | +3. **Write a clear subject line** focusing on the fix, not the implementation |
| 118 | +4. **Explain the problem** in the body - what was wrong and why it mattered |
| 119 | +5. **Describe the solution** in user terms, not code terms |
| 120 | +6. **Reference the issue** if applicable |
| 121 | + |
| 122 | +Focus on helping future developers understand why the change was needed and what problem it solves. |
0 commit comments