From 207e39d25947b2dac56d9cf9ffa35bf62ed725c6 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sat, 29 Nov 2025 18:02:16 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 12 ++++ README.md | 3 + commands/commit.md | 144 +++++++++++++++++++++++++++++++++++++ plugin.lock.json | 45 ++++++++++++ 4 files changed, 204 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/commit.md create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..ccc94af --- /dev/null +++ b/.claude-plugin/plugin.json @@ -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" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a9fd7fc --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# git + +Intelligent git commit workflow automation with AI-powered file grouping and configurable message formats diff --git a/commands/commit.md b/commands/commit.md new file mode 100644 index 0000000..1e6f287 --- /dev/null +++ b/commands/commit.md @@ -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 +``` +(): +``` +**Types**: feat, fix, docs, style, refactor, test, chore + +#### Imperative Mood Template +``` + +``` +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. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..8b5bc05 --- /dev/null +++ b/plugin.lock.json @@ -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": [] + } +} \ No newline at end of file