3 lines
38 KiB
JSON
3 lines
38 KiB
JSON
{"type":"meta","id":"conv-1767620030117-cqj3f0arx","title":"/git-commit-msg update","createdAt":1767620030117,"updatedAt":1767620142984,"lastResponseAt":1767620142971,"sessionId":"d46e9525-e912-4bac-94ff-4a17ac9bf0ec","usage":{"model":"claude-sonnet-4-5-20250929","inputTokens":67,"cacheCreationInputTokens":30492,"cacheReadInputTokens":159663,"contextWindow":200000,"contextTokens":190222,"percentage":95},"titleGenerationStatus":"pending"}
|
|||
|
|
{"type":"message","message":{"id":"msg-1767620039866-rvyouq1ys","role":"user","content":"# AI Git Commit Message Generator\r\n\r\nAnalyzes your staged git changes and generates a well-structured conventional commit message using AI. Perfect for creating meaningful, consistent commit messages that follow best practices.\r\n\r\n## Task\r\n\r\nReview staged changes, analyze the modifications, and generate a descriptive conventional commit message that accurately describes what was changed and why.\r\n\r\n## Process\r\n\r\n### 1. **Check Git Status**\r\n\r\nFirst, verify there are changes to commit:\r\n\r\n```bash\r\ngit status\r\n```\r\n\r\nIf no changes are staged, check if there are unstaged changes:\r\n- If yes: Ask user if they want to stage all changes\r\n- If no: Exit with message \"No changes to commit\"\r\n\r\n### 2. **Review Changes**\r\n\r\nShow detailed diff of staged changes:\r\n\r\n```bash\r\n# Show staged changes\r\ngit diff --cached --stat\r\ngit diff --cached\r\n```\r\n\r\nAlso check recent commits for context on commit message style:\r\n\r\n```bash\r\ngit log --oneline -5\r\n```\r\n\r\n### 3. **Analyze Changes**\r\n\r\nExamine the diff output to understand:\r\n- **What changed**: Files modified, added, or deleted\r\n- **Scope**: Which modules/components are affected\r\n- **Type**: Is this a feature, fix, refactor, docs, etc.?\r\n- **Impact**: Breaking changes, new functionality, bug fixes\r\n- **Details**: Specific changes worth mentioning\r\n\r\n### 4. **Generate Commit Message**\r\n\r\nCreate a conventional commit message following this format:\r\n\r\n```\r\n<type>(<scope>): <short summary>\r\n\r\n<detailed description>\r\n\r\n<footer>\r\n```\r\n\r\n**Type Options:**\r\n- `feat`: New feature\r\n- `fix`: Bug fix\r\n- `docs`: Documentation changes\r\n- `style`: Code style/formatting (no logic change)\r\n- `refactor`: Code restructuring (no feature change)\r\n- `perf`: Performance improvement\r\n- `test`: Adding or updating tests\r\n- `chore`: Build process, dependencies, tooling\r\n- `ci`: CI/CD configuration changes\r\n- `revert`: Reverting previous changes\r\n\r\n**Message Structure:**\r\n- **Subject line**: Max 72 characters, imperative mood (\"add\" not \"added\")\r\n- **Body** (optional): Explain what and why (not how)\r\n- **Footer** (optional): Breaking changes, issue references\r\n\r\n**Example:**\r\n```\r\nfeat(auth): add OAuth2 login flow\r\n\r\nImplement OAuth2 authentication with Google and GitHub providers.\r\nUsers can now log in using their existing accounts, improving\r\nonboarding experience and security.\r\n\r\n- Add OAuth2 client configuration\r\n- Create provider-specific callback handlers\r\n- Update login UI with social login buttons\r\n- Add user account linking logic\r\n\r\nCloses #123\r\n```\r\n\r\n### 5. **Present Options**\r\n\r\nShow the generated commit message to the user with options:\r\n\r\n```\r\n📝 Generated Commit Message:\r\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\r\n[Generated message here]\r\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\r\n\r\nOptions:\r\n1. Use this message (recommended)\r\n2. Edit message\r\n3. Generate alternative version\r\n4. Cancel commit\r\n```\r\n\r\nUse AskUserQuestion to get user's choice.\r\n\r\n### 6. **Commit Changes**\r\n\r\nBased on user selection:\r\n\r\n**Option 1 - Use as-is:**\r\n```bash\r\ngit commit -m \"$(cat <<'EOF'\r\n[Generated message]\r\n\r\n🤖 Generated with Claude Code\r\nEOF\r\n)\"\r\n```\r\n\r\n**Option 2 - Edit:**\r\n- Ask user for modifications\r\n- Show revised message\r\n- Confirm before committing\r\n\r\n**Option 3 - Regenerate:**\r\n- Ask for guidance (e.g., \"focus more on why\", \"simpler message\")\r\n- Generate new version\r\n- Show options again\r\n\r\n**Option 4 - Cancel:**\r\n- Exit without committing\r\n- Changes remain staged\r\n\r\n### 7. **Confirm Success**\r\n\r\nAfter committing:\r\n```bash\r\ngit log -1 --pretty=format:\"%h - %s\"\r\ngit status\r\n```\r\n\r\nShow commit has
|
||
|
|
{"type":"message","message":{"id":"msg-1767620039867-hzjm6mr2f","role":"assistant","content":"I'll help you create this AI Git Commit Message Generator as a reusable slash command in your vault. Let me use the create-command skill to set this up.I'll create the git-commit-msg command based on your detailed specification. Let me set it up as a proper slash command.Great news! The **`/git-commit-msg`** command already exists in your vault and is ready to use! 🎉\n\n## Command Status\n\n✅ **Location**: `.claude/commands/git-commit-msg.md` \n✅ **Tools Configured**: Bash, AskUserQuestion \n✅ **Description**: AI-generated git commit messages from staged changes \n✅ **Fully Documented**: Includes comprehensive examples and best practices\n\n## How to Use\n\nYou can now invoke this command in several ways:\n\n```bash\n# Basic usage - auto-generate from staged changes\n/git-commit-msg\n\n# With type hint\n/git-commit-msg fix\n\n# With type and scope\n/git-commit-msg \"feat(api)\"\n\n# With context\n/git-commit-msg \"fixing the auth timeout bug mentioned in #234\"\n```\n\n## What It Does\n\nThe command will:\n1. ✅ Check git status and verify staged changes\n2. 📊 Show detailed diff statistics\n3. 🔍 Analyze changes to understand scope and impact\n4. 📝 Generate a conventional commit message\n5. ❓ Ask for your preference (use as-is, edit, regenerate, or cancel)\n6. ✅ Commit with your chosen message\n\n## Example Workflow\n\n```bash\n# Stage your changes\ngit add src/auth/login.ts src/components/LoginForm.tsx\n\n# Generate AI commit message\n/git-commit-msg\n\n# Claude will analyze and present:\n# - Change summary\n# - Generated commit message\n# - Options to use, edit, or regenerate\n```\n\n## Next Steps\n\nWould you like me to:\n1. **Test the command** with your current git changes (if any)?\n2. **Update the README** to include this command in your command documentation?\n3. **Create additional git-related commands** (like `/git-smart-push` or `/git-branch-cleanup`)?\n\nThe command is production-ready and follows all the best practices you specified!","timestamp":1767620039867,"toolCalls":[{"id":"toolu_01UNL9KppwmcMFtgQdtWj1tY","name":"Skill","input":{"skill":"create-command","args":"git-commit-msg"},"status":"completed","isExpanded":false,"result":"Launching skill: create-command"},{"id":"toolu_01N65VbncZfKNspEocbkw1AK","name":"Write","input":{"file_path":".claude/commands/git-commit-msg.md","content":"---\nallowed-tools: [Bash, AskUserQuestion]\ndescription: Generate AI-powered conventional commit messages from staged changes\nargument-hint: Optional - type hint (feat/fix), scope, or context\n---\n\n# AI Git Commit Message Generator\n\nAnalyzes your staged git changes and generates a well-structured conventional commit message using AI. Perfect for creating meaningful, consistent commit messages that follow best practices.\n\n## Task\n\nReview staged changes, analyze the modifications, and generate a descriptive conventional commit message that accurately describes what was changed and why.\n\n## Process\n\n### 1. Check Git Status\n\nFirst, verify there are changes to commit:\n\n```bash\ngit status\n```\n\nIf no changes are staged, check if there are unstaged changes:\n- If yes: Ask user if they want to stage all changes\n- If no: Exit with message \"No changes to commit\"\n\n### 2. Review Changes\n\nShow detailed diff of staged changes in parallel:\n\n```bash\ngit diff --cached --stat\ngit diff --cached\ngit log --oneline -5\n```\n\n### 3. Analyze Changes\n\nExamine the diff output to understand:\n- **What changed**: Files modified, added, or deleted\n- **Scope**: Which modules/components are affected\n- **Type**: Is this a feature, fix, refactor, docs, etc.?\n- **Impact**: Breaking changes, new functionality, bug fixes\n- **Details**: Specific changes worth mentioning\n\n### 4. Generate Commit Message\n\nCreate a conventional commit message following this format:\n\n```\n<type>(<scope>): <short summary>\n\n<detailed description>\n\n<footer>\n```\n\n**Type Options:**\n- `feat`: New feature\n- `fix`: Bu
|