-
Notifications
You must be signed in to change notification settings - Fork 72
docs(rules): improve PR template and add commit guide #3349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
TheSonOfThomp
wants to merge
2
commits into
main
Choose a base branch
from
at/cursor-settings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+117
−5
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| --- | ||
| description: This rule can be used to generate a git commit message. This rule depends on staged changes being available in the context to generate better commit messages. | ||
| alwaysApply: false | ||
| --- | ||
|
|
||
| Act as an expert software engineer preparing a git commit. Your task is to generate a clear, concise commit message based on the staged changes in the current git repository. | ||
|
|
||
| ## Commit Message Format | ||
|
|
||
| The commit message _must_ be a single line following the Conventional Commits standard: | ||
|
|
||
| ``` | ||
| type(scope): subject | ||
| ``` | ||
|
|
||
| **Maximum length: 50 characters total** | ||
|
|
||
| ### Rules | ||
|
|
||
| 1. **Format**: `type(scope): subject` | ||
|
|
||
| 2. **Type**: Choose the most appropriate type from: | ||
|
|
||
| - `feat`: A new feature | ||
| - `fix`: A bug fix | ||
| - `refactor`: Code change that neither fixes a bug nor adds a feature | ||
| - `perf`: Performance improvement | ||
| - `style`: Formatting changes | ||
| - `test`: Adding or updating tests | ||
| - `docs`: Documentation only changes | ||
| - `build`: Build system or dependency changes | ||
| - `ci`: CI configuration changes | ||
| - `chore`: Other changes | ||
|
|
||
| 3. **Scope**: The primary package or area affected: | ||
|
|
||
| - Single package: use the package name (e.g., `button`, `form-field`, `typography`) | ||
| - Tools: use the tool name (e.g., `build`, `cli`, `test`) | ||
| - Charts: use the chart component name (e.g., `chart-card`, `legend`) | ||
| - Chat: use the chat component name (e.g., `message`, `input-bar`) | ||
| - Multiple packages: use `*` or general scope (e.g., `deps`, `config`) | ||
| - Repository-level: use `repo`, `ci`, `docs`, etc. | ||
|
|
||
| 4. **Subject**: A concise description that: | ||
| - Uses lowercase (no capital first letter) | ||
| - Uses imperative mood ("add" not "added") | ||
| - Doesn't end with a period | ||
| - Is extremely concise to fit the 50 character limit | ||
| - Clearly states what the commit does | ||
|
|
||
| --- | ||
|
|
||
| ## Examples | ||
|
|
||
| **Good examples:** | ||
|
|
||
| - `feat(button): add loading state` | ||
| - `fix(text-input): prevent cursor jump` | ||
| - `refactor(hooks): simplify useIdAllocator` | ||
| - `test(table): add sorting tests` | ||
| - `docs(button): update API examples` | ||
| - `chore(deps): upgrade typescript` | ||
| - `feat(*): add dark mode support` | ||
| - `fix(combobox): handle rapid filtering` | ||
|
|
||
| **Bad examples:** | ||
|
|
||
| - `feat(button): Added loading state` (uses past tense) | ||
| - `fix: bug fix` (too vague, missing scope) | ||
| - `Update button component` (missing type and scope) | ||
| - `feat(button): Add loading state.` (has period) | ||
| - `feat(button): Added a new loading state feature with spinner icon and animation support` (too long) | ||
|
|
||
| --- | ||
|
|
||
| ## Instructions | ||
|
|
||
| 1. **Analyze the staged changes**: Review all staged files and their diffs to understand: | ||
|
|
||
| - What packages or areas are affected | ||
| - What functionality is being added, changed, or removed | ||
| - Whether this is a bug fix, new feature, refactor, etc. | ||
|
|
||
| 2. **Determine the scope**: | ||
|
|
||
| - If changes are in a single package, use that package name | ||
| - If changes span multiple packages, use `*` or an appropriate general scope | ||
| - For tooling/config changes, use appropriate scope like `build`, `ci`, `test` | ||
|
|
||
| 3. **Write the commit message**: | ||
| - Choose the correct type | ||
| - Add the scope in parentheses | ||
| - Write a concise description | ||
| - Ensure the total length is **50 characters or less** | ||
| - Be specific but brief | ||
|
|
||
| --- | ||
|
|
||
| ## Tips | ||
|
|
||
| - Each commit should represent one logical change | ||
| - Be specific but concise due to 50 char limit | ||
| - Use abbreviations when necessary (e.g., "config" not "configuration") | ||
| - Use present tense imperative: "add", "fix", "update", "remove" | ||
| - Prioritize clarity within the character constraint | ||
| - If you can't fit the message in 50 chars, simplify the description | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The 50-character limit is mentioned but may be overly restrictive for commit messages in this repository. Consider documenting whether this includes or excludes the type and scope, as
type(scope):alone can consume 15+ characters, leaving very limited space for the subject.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoa its doing nits now 🤯