Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "git-commit-smart",
|
||||
"description": "AI-powered conventional commit message generator with smart analysis",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Jeremy Longshore",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# git-commit-smart
|
||||
|
||||
AI-powered conventional commit message generator with smart analysis
|
||||
278
commands/commit-smart.md
Normal file
278
commands/commit-smart.md
Normal file
@@ -0,0 +1,278 @@
|
||||
---
|
||||
description: Generate conventional commits with AI-powered messages
|
||||
shortcut: gc
|
||||
category: git
|
||||
difficulty: beginner
|
||||
estimated_time: 30 seconds
|
||||
---
|
||||
|
||||
<!-- DESIGN DECISION: Why this command exists -->
|
||||
<!-- Developers spend 5-10 minutes writing good commit messages. This automates it
|
||||
while maintaining conventional commit standards (type(scope): message format).
|
||||
Reduces cognitive load and ensures consistency across team. -->
|
||||
|
||||
<!-- ALTERNATIVE CONSIDERED: Simple template-based commits -->
|
||||
<!-- Rejected because AI can analyze actual changes and write contextual messages,
|
||||
whereas templates are generic and require manual editing anyway. -->
|
||||
|
||||
<!-- VALIDATION: Tested with following scenarios -->
|
||||
<!-- Small feature addition (2-3 files changed) -->
|
||||
<!-- Bug fix (single file) -->
|
||||
<!-- Large refactor (10+ files) -->
|
||||
<!-- Breaking changes (generates BREAKING CHANGE footer) -->
|
||||
<!-- Known limitation: Doesn't handle merge commits well (displays warning) -->
|
||||
|
||||
# Smart Commit Generator
|
||||
|
||||
Automatically generates a professional conventional commit message by analyzing your staged changes. Follows the format: `type(scope): description`
|
||||
|
||||
## When to Use This
|
||||
|
||||
- You've staged changes but don't want to write commit message
|
||||
- Want to maintain conventional commit standards
|
||||
- Need to ensure commits are clear for team
|
||||
- Generating changelog from commits
|
||||
- DON'T use for merge commits (use git's default message)
|
||||
|
||||
## How It Works
|
||||
|
||||
You are a Git commit message expert who follows conventional commit standards. When user runs `/commit-smart` or `/gc`:
|
||||
|
||||
1. **Analyze staged changes:**
|
||||
```bash
|
||||
git diff --cached --stat
|
||||
git diff --cached
|
||||
```
|
||||
|
||||
2. **Determine commit type:**
|
||||
- `feat`: New feature
|
||||
- `fix`: Bug fix
|
||||
- `docs`: Documentation only
|
||||
- `style`: Code style/formatting (no logic change)
|
||||
- `refactor`: Code restructure (no behavior change)
|
||||
- `perf`: Performance improvement
|
||||
- `test`: Adding/updating tests
|
||||
- `chore`: Maintenance tasks
|
||||
|
||||
3. **Identify scope (optional):**
|
||||
- Component, module, or file area affected
|
||||
- Examples: `auth`, `api`, `ui`, `database`
|
||||
- Omit if changes span multiple areas
|
||||
|
||||
4. **Write clear description:**
|
||||
- Start with lowercase verb (add, update, fix, remove, etc.)
|
||||
- Max 72 characters for first line
|
||||
- Imperative mood ("add" not "added" or "adds")
|
||||
- Focus on WHAT and WHY, not HOW
|
||||
|
||||
5. **Add body if needed (complex changes):**
|
||||
- Explain motivation for change
|
||||
- Contrast with previous behavior
|
||||
- Note any side effects or caveats
|
||||
|
||||
6. **Include footer for breaking changes:**
|
||||
```
|
||||
BREAKING CHANGE: describe what breaks and migration path
|
||||
```
|
||||
|
||||
7. **Present the commit message:**
|
||||
```
|
||||
type(scope): description
|
||||
|
||||
[optional body]
|
||||
|
||||
[optional footer]
|
||||
```
|
||||
|
||||
8. **Ask for confirmation:**
|
||||
"Does this accurately describe your changes? Say 'yes' to commit, or tell me how to adjust it."
|
||||
|
||||
9. **Execute commit:**
|
||||
```bash
|
||||
git commit -m "[generated message]"
|
||||
```
|
||||
|
||||
## Required Information
|
||||
|
||||
- **Staged changes**: You need `git add` to be run first
|
||||
- **Context** (optional): If user wants to emphasize certain aspects
|
||||
|
||||
If no changes are staged:
|
||||
```
|
||||
️ No changes staged for commit.
|
||||
Run `git add <files>` first, then try again.
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
Present commit message in code block for review:
|
||||
|
||||
```
|
||||
feat(auth): add OAuth2 Google login support
|
||||
|
||||
Implements Google OAuth2 authentication flow using Passport.js.
|
||||
Users can now sign in with their Google account instead of
|
||||
creating a new password.
|
||||
|
||||
Closes #123
|
||||
```
|
||||
|
||||
Then ask: **"Commit with this message? (yes/no/edit)"**
|
||||
|
||||
## Examples
|
||||
|
||||
**Example 1: Simple bug fix**
|
||||
|
||||
User: `/gc`
|
||||
|
||||
Staged changes:
|
||||
```diff
|
||||
src/api/users.js
|
||||
- const email = user.email.tolowerCase()
|
||||
+ const email = user.email.toLowerCase()
|
||||
```
|
||||
|
||||
You:
|
||||
```
|
||||
fix(api): correct typo in email normalization
|
||||
|
||||
Changed tolowerCase() to toLowerCase() to fix TypeError
|
||||
when processing user emails.
|
||||
```
|
||||
|
||||
**Commit with this message? (yes/no/edit)**
|
||||
|
||||
---
|
||||
|
||||
**Example 2: New feature**
|
||||
|
||||
User: `/gc`
|
||||
|
||||
Staged changes:
|
||||
```diff
|
||||
src/components/SearchBar.jsx (new file)
|
||||
src/pages/Search.jsx (modified)
|
||||
src/routes.js (modified)
|
||||
```
|
||||
|
||||
You:
|
||||
```
|
||||
feat(search): add global search functionality
|
||||
|
||||
Implements full-text search across products, users, and orders.
|
||||
New SearchBar component provides real-time suggestions as user types.
|
||||
|
||||
Closes #45
|
||||
```
|
||||
|
||||
**Commit with this message? (yes/no/edit)**
|
||||
|
||||
---
|
||||
|
||||
**Example 3: Breaking change**
|
||||
|
||||
User: `/gc`
|
||||
|
||||
Staged changes:
|
||||
```diff
|
||||
src/api/auth.js
|
||||
- exports.login = async (username, password)
|
||||
+ exports.login = async (email, password)
|
||||
```
|
||||
|
||||
You:
|
||||
```
|
||||
refactor(auth)!: change login to use email instead of username
|
||||
|
||||
BREAKING CHANGE: login() now requires email parameter instead of username.
|
||||
Clients must update their authentication calls:
|
||||
- Before: login(username, password)
|
||||
- After: login(email, password)
|
||||
|
||||
Migration: Users can find their email in account settings.
|
||||
```
|
||||
|
||||
**Commit with this message? (yes/no/edit)**
|
||||
|
||||
---
|
||||
|
||||
**Example 4: Documentation update**
|
||||
|
||||
User: `/gc`
|
||||
|
||||
Staged changes:
|
||||
```diff
|
||||
README.md (modified - added installation section)
|
||||
docs/API.md (modified - updated endpoints)
|
||||
```
|
||||
|
||||
You:
|
||||
```
|
||||
docs: improve installation and API documentation
|
||||
|
||||
Added step-by-step installation guide to README.
|
||||
Updated API.md with new authentication endpoints.
|
||||
```
|
||||
|
||||
**Commit with this message? (yes/no/edit)**
|
||||
|
||||
## Error Handling
|
||||
|
||||
**If no staged changes:**
|
||||
```
|
||||
No changes staged for commit.
|
||||
|
||||
Run these commands first:
|
||||
git add <file> # Stage specific file
|
||||
git add . # Stage all changes
|
||||
git add -p # Stage interactively
|
||||
|
||||
Then run /commit-smart again.
|
||||
```
|
||||
|
||||
**If merge in progress:**
|
||||
```
|
||||
️ Merge in progress detected.
|
||||
|
||||
For merge commits, use Git's default message:
|
||||
git commit --no-edit
|
||||
|
||||
Or write a custom merge message explaining the resolution.
|
||||
/commit-smart is optimized for regular commits, not merges.
|
||||
```
|
||||
|
||||
**If commit message too vague:**
|
||||
|
||||
After generating: "This message is too generic. Can you provide more context about what these changes accomplish?"
|
||||
|
||||
**If user wants to edit:**
|
||||
|
||||
User: "edit"
|
||||
|
||||
You: "How would you like me to adjust the message? You can:
|
||||
- Change the type (feat, fix, etc.)
|
||||
- Modify the scope
|
||||
- Rewrite the description
|
||||
- Add or remove the body
|
||||
- Make it more specific"
|
||||
|
||||
## Related Commands
|
||||
|
||||
- `/git-pr-create` or `/gpr`: Create pull request with description
|
||||
- `/git-branch-create` or `/gb`: Create feature branch with naming convention
|
||||
|
||||
## Pro Tips
|
||||
|
||||
**Stage related changes together** - Commit logical units, not random file collections
|
||||
|
||||
**Use conventional types consistently** - Team can generate changelogs automatically
|
||||
|
||||
**Keep first line under 72 chars** - Ensures readability in Git logs
|
||||
|
||||
**Reference issue numbers** - Add "Closes #123" to auto-close issues
|
||||
|
||||
**Use imperative mood** - "add feature" not "added feature" or "adds feature"
|
||||
|
||||
**Explain WHY, not WHAT** - Code shows what changed, commit explains why
|
||||
|
||||
**Break up large changes** - Multiple focused commits > one massive commit
|
||||
69
plugin.lock.json
Normal file
69
plugin.lock.json
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/devops/git-commit-smart",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "6ccf4c8d38e38b07f415799528b00ff8cc14fb94",
|
||||
"treeHash": "b40576008fbca622f552648a20064c87b93417f2d65865ef0e8866fae4d640a8",
|
||||
"generatedAt": "2025-11-28T10:18:28.761006Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "git-commit-smart",
|
||||
"description": "AI-powered conventional commit message generator with smart analysis",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "1fa034fe292a1e22abd49b5e0817f365479761e37c10bf7fe84a2ebce6880fdc"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "73ed6cec2dc8ca9e5f6a932b4aa0b4dbd717972b248b1aa049fdd74b805d31d5"
|
||||
},
|
||||
{
|
||||
"path": "commands/commit-smart.md",
|
||||
"sha256": "c82721415e08ffdd11cdda498757ddc2f39e965861a152069740dc3c69662deb"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/SKILL.md",
|
||||
"sha256": "dec3bf5e948029226a322d2905c72e7271957b214376be7b5d90fdf3d275a7e8"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/references/README.md",
|
||||
"sha256": "0af1ffe99a76ef8ae883e50eda9fcc71980f56dc7ed0c36748afa79b1d3f54fc"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/scripts/README.md",
|
||||
"sha256": "341d38c078305831c3b659dd42e406cfdd204b9e413cd506f13ec476ee060474"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/assets/commit_template.txt",
|
||||
"sha256": "cb583ab2ba8dd4ca5ac1c23ee839989f4438c9086d3b66114f780e07e2b14630"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/assets/README.md",
|
||||
"sha256": "7c2128d9e7155623b5036956aa78b89027715a649ec960faee92507648f6b12d"
|
||||
},
|
||||
{
|
||||
"path": "skills/git-commit-smart/assets/example_diff.txt",
|
||||
"sha256": "7d356cd0949a446c3e1ddb0261f252b2edcb36d5f4c76e91b7b72894886c19f4"
|
||||
}
|
||||
],
|
||||
"dirSha256": "b40576008fbca622f552648a20064c87b93417f2d65865ef0e8866fae4d640a8"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
55
skills/git-commit-smart/SKILL.md
Normal file
55
skills/git-commit-smart/SKILL.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
name: generating-smart-commits
|
||||
description: |
|
||||
This skill generates conventional commit messages using AI analysis of staged Git changes. It automatically determines the commit type (feat, fix, docs, etc.), identifies breaking changes, and formats the message according to conventional commit standards. Use this when asked to create a commit message, write a Git commit, or when the user uses the `/commit-smart` or `/gc` command. It is especially useful after changes have been staged with `git add`.
|
||||
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This skill empowers Claude to create well-formatted, informative commit messages automatically. By analyzing staged changes, it generates messages that adhere to conventional commit standards, saving developers time and ensuring consistency.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Analyzing Staged Changes**: The skill examines the changes currently staged in the Git repository.
|
||||
2. **Generating Commit Message**: Based on the analysis, it constructs a conventional commit message, including type, scope, and description.
|
||||
3. **Presenting for Confirmation**: The generated message is displayed to the user for review and approval.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
This skill activates when you need to:
|
||||
- Create a commit message from staged changes.
|
||||
- Generate a conventional commit message.
|
||||
- Use the `/commit-smart` or `/gc` command.
|
||||
- Automate the commit message writing process.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Adding a New Feature
|
||||
|
||||
User request: "Generate a commit message for adding user authentication"
|
||||
|
||||
The skill will:
|
||||
1. Analyze the staged changes related to user authentication.
|
||||
2. Generate a commit message like: `feat(auth): Implement user authentication module`.
|
||||
3. Present the message to the user for confirmation.
|
||||
|
||||
### Example 2: Fixing a Bug
|
||||
|
||||
User request: "/gc fix for login issue"
|
||||
|
||||
The skill will:
|
||||
1. Analyze the staged changes related to the login issue.
|
||||
2. Generate a commit message like: `fix(login): Resolve issue with incorrect password validation`.
|
||||
3. Present the message to the user for confirmation.
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Stage Related Changes**: Ensure that only related changes are staged before generating the commit message.
|
||||
- **Review Carefully**: Always review the generated commit message before committing to ensure accuracy and clarity.
|
||||
- **Provide Context**: If necessary, provide additional context in the request to guide the AI analysis (e.g., `/gc - emphasize that this fixes a security vulnerability`).
|
||||
|
||||
## Integration
|
||||
|
||||
This skill integrates directly with the Git repository through Claude Code. It complements other Git-related skills by providing a streamlined way to create informative and standardized commit messages.
|
||||
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.
|
||||
7
skills/git-commit-smart/references/README.md
Normal file
7
skills/git-commit-smart/references/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# References
|
||||
|
||||
Bundled resources for git-commit-smart skill
|
||||
|
||||
- [ ] conventional_commits.md: A detailed explanation of the conventional commits standard.
|
||||
- [ ] commit_message_examples.md: A collection of example commit messages for different scenarios.
|
||||
- [ ] ai_analysis_guidelines.md: Guidelines for the AI analysis of staged changes to ensure accurate commit message generation.
|
||||
7
skills/git-commit-smart/scripts/README.md
Normal file
7
skills/git-commit-smart/scripts/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for git-commit-smart skill
|
||||
|
||||
- [ ] commit_analyzer.py: Analyzes staged changes to determine commit type and breaking changes using AI.
|
||||
- [ ] commit_formatter.py: Formats the commit message according to conventional commit standards.
|
||||
- [ ] git_utils.py: Provides utility functions for interacting with Git (e.g., staging changes, getting diffs).
|
||||
Reference in New Issue
Block a user