Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:02:16 +08:00
commit 207e39d259
4 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "git",
"description": "Intelligent git commit workflow automation with AI-powered file grouping and configurable message formats",
"version": "1.0.0",
"author": {
"name": "Bradley Golden",
"email": "hello@bradleygolden.dev"
},
"commands": [
"./commands/commit.md"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# git
Intelligent git commit workflow automation with AI-powered file grouping and configurable message formats

144
commands/commit.md Normal file
View File

@@ -0,0 +1,144 @@
---
allowed-tools: Bash(git status:*), Bash(git diff:*), Bash(git add:*), Bash(git commit:*), Read(*), Write(*), Edit(*), AskUserQuestion
description: Create structured git commits with intelligent file grouping
---
# Commit Changes
You are tasked with committing changes using a structured process that respects user preferences and maintains clean commit history.
## Process Overview
1. **Check user's commit style preference** (first time only)
2. **Review** the conversation and run `git status` and `git diff` to understand what has changed
3. **Plan** the commits by grouping related files and drafting appropriate commit messages
4. **Present** the plan to the user for approval ("Shall I proceed?")
5. **Execute** by adding files and creating commits, then show results
## Check for User's Commit Message Preference
Before creating commits, check if the user has configured their preferred commit message format:
1. **Check for configuration** in this order:
- Read `CLAUDE.md` if it exists
- Otherwise, read `AGENTS.md` if it exists
- If neither exists, create `CLAUDE.md`
2. **Look for existing configuration** by searching for a `## Git Commit Configuration` section
3. **If no configuration exists**, prompt the user:
Use AskUserQuestion to ask:
```javascript
{
"questions": [
{
"question": "What commit message format would you like to use?",
"header": "Format",
"multiSelect": false,
"options": [
{
"label": "Conventional Commits",
"description": "Structured format like 'feat(auth): add login' with types: feat, fix, docs, refactor, test, chore"
},
{
"label": "Imperative Mood",
"description": "Simple imperative statements like 'Add user authentication' - direct and concise"
},
{
"label": "Custom Template",
"description": "Use your own format - you can describe it after selection"
}
]
}
]
}
```
4. **Store the preference** by appending this section to the configuration file:
```markdown
## Git Commit Configuration
**Configured**: [today's date]
### Commit Message Format
**Format**: [conventional-commits|imperative-mood|custom]
#### Conventional Commits Template
```
<type>(<scope>): <description>
```
**Types**: feat, fix, docs, style, refactor, test, chore
#### Imperative Mood Template
```
<description>
```
Start with imperative verb: Add, Update, Fix, Remove, etc.
#### Custom Template
```
[user's template if they chose custom]
```
```
5. **Parse the preference** and use it when generating commit messages
## Planning Commits
Group related changes together logically:
- Features with their tests
- Bug fixes with their tests
- Documentation separately
- Configuration/tooling separately
- Refactoring separately
Draft commit messages using the user's preferred format:
- **Conventional Commits**: `type(scope): description` (e.g., `feat(auth): add login`)
- **Imperative Mood**: Start with verb (e.g., `Add user authentication`)
- **Custom**: Follow their template
Use imperative mood for descriptions. Explain the "why" not just the "what".
## Present the Plan
Ask: "I plan to create [N] commits:
1. **[Brief description]** ([X] files)
- file1.ex
- file2.ex
Message: `[commit message]`
2. **[Next description]** ([Y] files)
- file3.md
Message: `[commit message]`
Shall I proceed?"
Wait for explicit approval before executing.
## Execute Commits
For each commit in the plan:
1. Stage files with explicit paths: `git add file1 file2 file3`
2. Create commit: `git commit -m "[message]"`
3. If a commit fails, inform the user and ask how to proceed
After all commits, run `git log --oneline -n [count]` to show what was created.
## Important
**CRITICAL**: Create user-only commits with NO Claude Code attribution:
- Do NOT add "Generated with Claude Code" messages
- Do NOT add "Co-Authored-By: Claude" lines
- Commits must appear solely authored by the user
Use explicit file names with `git add` - never use `git add -A` or `git add .`
The user trusts your judgment to group changes appropriately and write clear commit messages based on their preferred format.

45
plugin.lock.json Normal file
View File

@@ -0,0 +1,45 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:bradleygolden/claude-marketplace-elixir:plugins/git",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "b3ce5a29d124ae75d3853b08e50229ff8c6a3340",
"treeHash": "342982cc1325afb046c12d55c4961344d7c11913dc2e631eb87d1152e1c5112b",
"generatedAt": "2025-11-28T10:14:23.984350Z",
"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",
"description": "Intelligent git commit workflow automation with AI-powered file grouping and configurable message formats",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "479d2bf3edbfe7a1e6712564512a2b681c1ada9387771a427ea97cd65fdd6665"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "ac0391322a99d280799ebb8f6cce975a0babbc52a5179690abb926b5f047fe96"
},
{
"path": "commands/commit.md",
"sha256": "ae8825012605b6fb13a0dc8beea4b7a4cc4a1386abbcb895ed5e86d2665cf0cd"
}
],
"dirSha256": "342982cc1325afb046c12d55c4961344d7c11913dc2e631eb87d1152e1c5112b"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}