diff --git a/plugins/README.md b/plugins/README.md index cf4a21ecc5..5e0b5f0d2c 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -15,7 +15,7 @@ Learn more in the [official plugins documentation](https://docs.claude.com/en/do | [agent-sdk-dev](./agent-sdk-dev/) | Development kit for working with the Claude Agent SDK | **Command:** `/new-sdk-app` - Interactive setup for new Agent SDK projects
**Agents:** `agent-sdk-verifier-py`, `agent-sdk-verifier-ts` - Validate SDK applications against best practices | | [claude-opus-4-5-migration](./claude-opus-4-5-migration/) | Migrate code and prompts from Sonnet 4.x and Opus 4.1 to Opus 4.5 | **Skill:** `claude-opus-4-5-migration` - Automated migration of model strings, beta headers, and prompt adjustments | | [code-review](./code-review/) | Automated PR code review using multiple specialized agents with confidence-based scoring to filter false positives | **Command:** `/code-review` - Automated PR review workflow
**Agents:** 5 parallel Sonnet agents for CLAUDE.md compliance, bug detection, historical context, PR history, and code comments | -| [commit-commands](./commit-commands/) | Git workflow automation for committing, pushing, and creating pull requests | **Commands:** `/commit`, `/commit-push-pr`, `/clean_gone` - Streamlined git operations | +| [commit-commands](./commit-commands/) | Git workflow automation for committing, pushing, and creating pull requests | **Commands:** `/commit`, `/commit-review`, `/commit-interactive`, `/commit-push-pr`, `/clean_gone` - Streamlined git operations with interactive options | | [explanatory-output-style](./explanatory-output-style/) | Adds educational insights about implementation choices and codebase patterns (mimics the deprecated Explanatory output style) | **Hook:** SessionStart - Injects educational context at the start of each session | | [feature-dev](./feature-dev/) | Comprehensive feature development workflow with a structured 7-phase approach | **Command:** `/feature-dev` - Guided feature development workflow
**Agents:** `code-explorer`, `code-architect`, `code-reviewer` - For codebase analysis, architecture design, and quality review | | [frontend-design](./frontend-design/) | Create distinctive, production-grade frontend interfaces that avoid generic AI aesthetics | **Skill:** `frontend-design` - Auto-invoked for frontend work, providing guidance on bold design choices, typography, animations, and visual details | diff --git a/plugins/commit-commands/README.md b/plugins/commit-commands/README.md index a918ec3ab9..100a3dda7d 100644 --- a/plugins/commit-commands/README.md +++ b/plugins/commit-commands/README.md @@ -44,6 +44,73 @@ Creates a git commit with an automatically generated commit message based on sta - Avoids committing files with secrets (.env, credentials.json) - Includes Claude Code attribution in commit message +### `/commit-review` + +Creates a git commit with interactive message review, allowing you to edit the commit message before finalizing. + +**What it does:** +1. Analyzes staged changes +2. Generates or uses provided commit message +3. Shows a summary of changes to be committed +4. Lets you review, edit, or cancel the commit +5. Creates the commit only after approval + +**Usage:** +```bash +# With auto-generated message: +/commit-review + +# With custom message: +/commit-review "feat: add user authentication" +``` + +**Example workflow:** +```bash +# Make and stage your changes +git add . + +# Run the interactive commit: +/commit-review + +# Claude will: +# - Show what will be committed +# - Present a draft commit message +# - Ask for confirmation with options to: +# - Use the draft message +# - Edit the message +# - Cancel the commit +``` + +**Features:** +- Interactive commit message review +- Option to provide custom message upfront +- Shows change summary before committing +- Ability to edit generated messages +- Safe cancellation option + +### `/commit-interactive` + +Advanced interactive commit workflow with full control over message editing and file staging. + +**What it does:** +1. Analyzes all changes (staged and unstaged) +2. Generates a draft commit message +3. Allows interactive message editing +4. Lets you select which files to include +5. Creates commit based on your selections + +**Usage:** +```bash +/commit-interactive +``` + +**Features:** +- Full interactive control +- Multi-select file staging +- Custom message editing +- Preview before commit +- Granular file selection + ### `/commit-push-pr` Complete workflow command that commits, pushes, and creates a pull request in one step. @@ -137,6 +204,18 @@ This plugin is included in the Claude Code repository. The commands are automati - Trust the automated message, but verify it's accurate - Use for routine commits during development +### Using `/commit-review` +- Best for when you want to review the message before committing +- Provide a custom message if you have specific wording in mind +- Use when commit message accuracy is critical +- Ideal for commits that will be part of public history + +### Using `/commit-interactive` +- Use when you need full control over the commit +- Ideal for complex changes with mixed staged/unstaged files +- Best when you want to carefully curate what gets committed +- Perfect for partial commits of work in progress + ### Using `/commit-push-pr` - Use when you're ready to create a PR - Ensure all your changes are complete and tested diff --git a/plugins/commit-commands/commands/commit-interactive.md b/plugins/commit-commands/commands/commit-interactive.md new file mode 100644 index 0000000000..931271f9b0 --- /dev/null +++ b/plugins/commit-commands/commands/commit-interactive.md @@ -0,0 +1,62 @@ +--- +allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), AskUserQuestion +description: Create a git commit with interactive message review +--- + +## Context + +- Current git status: !`git status` +- Current git diff (staged and unstaged changes): !`git diff HEAD` +- Current branch: !`git branch --show-current` +- Recent commits: !`git log --oneline -10` + +## Your task + +Based on the above changes, help the user create a git commit with an interactive review process. + +### Step 1: Analyze and Generate Draft + +First, analyze the changes and generate a draft commit message following the repository's conventions. Consider: +- The nature and scope of changes +- The commit style from recent commits +- Conventional commit format if applicable + +### Step 2: Interactive Review + +Use the AskUserQuestion tool to present the draft commit message and options: + +**Question 1 - Review commit message:** +- header: "Commit Msg" +- question: "Review the draft commit message. Choose an option or select 'Other' to edit:" +- multiSelect: false +- options: + - Use draft message as-is + - Edit commit message + - Cancel commit + +If the user chooses to edit, ask for the new message in a follow-up question. + +**Question 2 - Review staged files:** +- header: "Stage Files" +- question: "Which files should be included in this commit?" +- multiSelect: true +- options: [List current staged and unstaged files with their status] + +### Step 3: Execute Commit + +Based on the user's choices: +1. If they chose to edit the message, use their custom message +2. Stage/unstage files according to their selection +3. Create the commit with the final message +4. Show the commit result + +### Step 4: Confirm Success + +Display the created commit hash and message to confirm successful completion. + +## Important Notes + +- If the user cancels, exit gracefully without making changes +- Preserve the repository's existing commit style +- Handle both staged and unstaged changes appropriately +- Show clear status updates throughout the process \ No newline at end of file diff --git a/plugins/commit-commands/commands/commit-review.md b/plugins/commit-commands/commands/commit-review.md new file mode 100644 index 0000000000..d45d91065f --- /dev/null +++ b/plugins/commit-commands/commands/commit-review.md @@ -0,0 +1,54 @@ +--- +allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*), AskUserQuestion +description: Create a git commit with message review +arguments: + - name: message + description: Custom commit message (optional - if not provided, will generate one) + required: false +--- + +## Context + +- Current git status: !`git status --porcelain` +- Staged changes: !`git diff --cached --stat` +- Unstaged changes: !`git diff --stat` +- Current branch: !`git branch --show-current` +- Recent commits (for style reference): !`git log --oneline -5` + +## Your task + +Create a git commit with the ability to review and edit the commit message before finalizing. + +### Step 1: Prepare Commit Message + +${message ? `Use the provided message: "${message}"` : "Generate a commit message based on the staged changes. Follow the repository's commit style based on recent commits."} + +### Step 2: Show Changes Summary + +First, provide a brief summary of what will be committed: +- Number of files changed +- Key modifications +- Any warnings (e.g., large files, sensitive files like .env) + +### Step 3: Review Commit Message + +Use AskUserQuestion to let the user review and confirm: + +**Question - Confirm commit message:** +- header: "Commit" +- question: "Commit with this message?" +- options: + - "${message || '[Generated message will be shown here]'}" (Commit with this message) + - "Edit message" (Provide a custom message) + - "Cancel" (Don't commit) + +If user selects "Edit message" or "Other", ask for the custom message in a follow-up question. + +### Step 4: Execute or Cancel + +Based on user's choice: +- If confirmed: Stage all changes and create the commit +- If edited: Use the custom message for the commit +- If cancelled: Exit without committing + +Show the final result including the commit hash and message. \ No newline at end of file