Initial commit
This commit is contained in:
6
skills/git-commit-smart/assets/README.md
Normal file
6
skills/git-commit-smart/assets/README.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for git-commit-smart skill
|
||||
|
||||
- [ ] commit_template.txt: A template for the generated commit message.
|
||||
- [ ] example_diff.txt: An example of a Git diff that can be used for testing and demonstration purposes.
|
||||
114
skills/git-commit-smart/assets/commit_template.txt
Normal file
114
skills/git-commit-smart/assets/commit_template.txt
Normal file
@@ -0,0 +1,114 @@
|
||||
# Commit Message Template
|
||||
|
||||
This template is designed to help you create a well-structured and informative commit message following the Conventional Commits standard. Please fill in the placeholders below with relevant information about your changes.
|
||||
|
||||
## Commit Type
|
||||
|
||||
Choose one of the following commit types that best describes the nature of your changes:
|
||||
|
||||
* **feat**: A new feature
|
||||
* **fix**: A bug fix
|
||||
* **docs**: Documentation only changes
|
||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
* **refactor**: A code change that neither adds a feature nor fixes a bug
|
||||
* **perf**: A code change that improves performance
|
||||
* **test**: Adding missing tests or correcting existing tests
|
||||
* **build**: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
* **chore**: Other changes that don't modify src or test files
|
||||
* **revert**: Reverts a previous commit
|
||||
|
||||
**Placeholder:** `type(scope): description`
|
||||
|
||||
**Example:** `feat(auth): Implement user authentication`
|
||||
|
||||
## Scope (Optional)
|
||||
|
||||
The scope could be anything specifying the place of the commit change. For example `auth`, `user`, `profile`, etc.
|
||||
|
||||
* If the change affects more than one scope, you can omit the scope entirely.
|
||||
* If the change is a global change, you can use `*` as the scope.
|
||||
|
||||
**Placeholder:** `(scope)`
|
||||
|
||||
**Example:** `(api)`
|
||||
|
||||
## Description
|
||||
|
||||
Write a concise and clear description of the changes made. Use the imperative, present tense: "change" not "changed" nor "changes".
|
||||
|
||||
**Placeholder:** `description`
|
||||
|
||||
**Example:** `Add support for JWT authentication`
|
||||
|
||||
## Body (Optional)
|
||||
|
||||
Provide a more detailed explanation of the changes made. This section is optional but highly recommended for complex changes. Use the imperative, present tense: "change" not "changed" nor "changes".
|
||||
|
||||
* Explain the motivation for the change.
|
||||
* Describe the approach taken.
|
||||
* Include any relevant context or background information.
|
||||
|
||||
**Placeholder:**
|
||||
|
||||
```
|
||||
Longer explanation of the commit, if necessary.
|
||||
|
||||
- Explain the problem and why this commit solves it.
|
||||
- Provide context about the changes.
|
||||
- Add any relevant details.
|
||||
```
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
This commit introduces JWT authentication to improve the security of the API.
|
||||
|
||||
The previous authentication mechanism was based on simple API keys, which were vulnerable to brute-force attacks. JWTs provide a more secure and scalable solution.
|
||||
|
||||
The following steps were taken:
|
||||
|
||||
- Added the `jsonwebtoken` library as a dependency.
|
||||
- Implemented a new `authenticate` middleware function.
|
||||
- Updated the API endpoints to use the new middleware.
|
||||
```
|
||||
|
||||
## Footer(s) (Optional)
|
||||
|
||||
Footers can be used to add metadata to the commit message, such as:
|
||||
|
||||
* **BREAKING CHANGE**: If the commit introduces a breaking change, add a `BREAKING CHANGE:` footer with a description of the change.
|
||||
* **Closes**: Referencing issue tracker ids.
|
||||
|
||||
**Placeholder:**
|
||||
|
||||
```
|
||||
BREAKING CHANGE: Description of the breaking change.
|
||||
|
||||
Closes #123
|
||||
Refs #456
|
||||
```
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
BREAKING CHANGE: The API endpoint `/users` has been renamed to `/profiles`.
|
||||
|
||||
Closes #123
|
||||
```
|
||||
|
||||
## Complete Example
|
||||
|
||||
```
|
||||
feat(auth): Implement user authentication
|
||||
|
||||
This commit introduces JWT authentication to improve the security of the API.
|
||||
|
||||
The previous authentication mechanism was based on simple API keys, which were vulnerable to brute-force attacks. JWTs provide a more secure and scalable solution.
|
||||
|
||||
The following steps were taken:
|
||||
|
||||
- Added the `jsonwebtoken` library as a dependency.
|
||||
- Implemented a new `authenticate` middleware function.
|
||||
- Updated the API endpoints to use the new middleware.
|
||||
```
|
||||
105
skills/git-commit-smart/assets/example_diff.txt
Normal file
105
skills/git-commit-smart/assets/example_diff.txt
Normal file
@@ -0,0 +1,105 @@
|
||||
# Example Git Diff for Git Commit Smart Plugin
|
||||
|
||||
This document provides an example Git diff that can be used to test and demonstrate the functionality of the `git-commit-smart` Claude Code plugin. You can copy and paste this diff into a file named `example_diff.txt` and then use it as input for the plugin.
|
||||
|
||||
## Purpose
|
||||
|
||||
The `example_diff.txt` file serves as a sample input for the plugin, allowing users to:
|
||||
|
||||
* Understand how the plugin interprets different types of code changes.
|
||||
* Experiment with the plugin's ability to generate conventional commit messages.
|
||||
* Troubleshoot any issues with the plugin's analysis or message generation.
|
||||
|
||||
## Example Diff
|
||||
|
||||
Below is an example Git diff. It includes a variety of changes, such as:
|
||||
|
||||
* Adding a new feature
|
||||
* Fixing a bug
|
||||
* Refactoring existing code
|
||||
* Updating documentation
|
||||
|
||||
```diff
|
||||
--- a/README.md
|
||||
+++ b/README.md
|
||||
@@ -1,4 +1,4 @@
|
||||
-# My Awesome Project
|
||||
+# My Super Awesome Project
|
||||
|
||||
This is a brief description of my project.
|
||||
|
||||
|
||||
--- a/src/index.js
|
||||
+++ b/src/index.js
|
||||
@@ -1,5 +1,9 @@
|
||||
function add(a, b) {
|
||||
- return a + b;
|
||||
+ if (typeof a !== 'number' || typeof b !== 'number') {
|
||||
+ throw new Error('Both arguments must be numbers.');
|
||||
+ }
|
||||
+
|
||||
+ return a + b
|
||||
}
|
||||
|
||||
|
||||
function subtract(a, b) {
|
||||
--- a/test/index.test.js
|
||||
+++ b/test/index.test.js
|
||||
@@ -1,7 +1,14 @@
|
||||
const { add, subtract } = require('../src/index');
|
||||
|
||||
describe('Math Functions', () => {
|
||||
+ it('should throw an error if arguments are not numbers', () => {
|
||||
+ expect(() => add('a', 1)).toThrowError('Both arguments must be numbers.');
|
||||
+ expect(() => add(1, 'b')).toThrowError('Both arguments must be numbers.');
|
||||
+ expect(() => add('a', 'b')).toThrowError('Both arguments must be numbers.');
|
||||
+ });
|
||||
+
|
||||
it('should add two numbers correctly', () => {
|
||||
expect(add(1, 2)).toBe(3);
|
||||
});
|
||||
+
|
||||
it('should subtract two numbers correctly', () => {
|
||||
expect(subtract(5, 2)).toBe(3);
|
||||
});
|
||||
```
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
1. **Save the Diff:** Copy the entire diff above and save it to a file named `example_diff.txt`.
|
||||
2. **Stage the Changes (Optional):** If you have a Git repository, you can apply this diff using `git apply example_diff.txt`. This is not required, as the plugin can directly analyze the `example_diff.txt` file.
|
||||
3. **Invoke the Plugin:** Use the `/gc` command or the appropriate command in your Claude environment to invoke the `git-commit-smart` plugin.
|
||||
4. **Provide the File:** When prompted, specify `example_diff.txt` as the input file containing the Git diff.
|
||||
5. **Review the Output:** The plugin will analyze the diff and generate a conventional commit message. Review the suggested message and make any necessary adjustments.
|
||||
|
||||
## Expected Output (Example)
|
||||
|
||||
Based on the provided diff, the `git-commit-smart` plugin might suggest a commit message similar to:
|
||||
|
||||
```
|
||||
feat(math): implement input validation for add function and update README
|
||||
|
||||
This commit introduces input validation to the `add` function in `src/index.js` to ensure that both arguments are numbers. An error is thrown if either argument is not a number.
|
||||
|
||||
Additionally, the README.md file has been updated to reflect the project's name change to "My Super Awesome Project."
|
||||
|
||||
The test suite has also been updated to include tests for the new input validation in `add`.
|
||||
```
|
||||
|
||||
**Note:** The actual output may vary depending on the specific implementation of the `git-commit-smart` plugin and its AI model.
|
||||
|
||||
## Customization
|
||||
|
||||
You can modify the `example_diff.txt` file to include different types of changes and test the plugin's ability to handle various scenarios. Experiment with adding new files, deleting files, renaming files, and making more complex code changes.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter any issues, ensure that:
|
||||
|
||||
* The `example_diff.txt` file is correctly formatted as a Git diff.
|
||||
* The `git-commit-smart` plugin is properly installed and configured.
|
||||
* Your Claude environment has the necessary permissions to access the file.
|
||||
|
||||
## Further Examples
|
||||
|
||||
You can find more example diffs online by searching for "example git diff" or looking at the commit history of open-source projects. Remember to adapt the examples to fit the context of your own projects and testing needs.
|
||||
Reference in New Issue
Block a user