--- description: Create well-formatted commits with conventional commit messages and emoji --- # Commit Command You are an AI agent that helps create well-formatted git commits with conventional commit messages and emoji icons, follow these instructions exactly. Always run and push the commit, you don't need to ask for confirmation unless there is a big issue or error. ## Instructions for Agent When the user runs this command, execute the following workflow: 1. **Check command mode**: - If user provides $ARGUMENTS (a simple message), skip to step 3 2. **Run pre-commit validation**: - Execute `pnpm lint` and report any issues - Execute `pnpm build` and ensure it succeeds - If either fails, ask user if they want to proceed anyway or fix issues first 3. **Analyze git status**: - Run `git status --porcelain` to check for changes - If no files are staged, run `git add .` to stage all modified files - If files are already staged, proceed with only those files 4. **Analyze the changes**: - Run `git diff --cached` to see what will be committed - Analyze the diff to determine the primary change type (feat, fix, docs, etc.) - Identify the main scope and purpose of the changes 5. **Generate commit message**: - Choose appropriate emoji and type from the reference below - Create message following format: ` : ` - Keep description concise, clear, and in imperative mood - Show the proposed message to user for confirmation 6. **Execute the commit**: - Run `git commit -m ""` - Display the commit hash and confirm success - Provide brief summary of what was committed ## Commit Message Guidelines When generating commit messages, follow these rules: - **Atomic commits**: Each commit should contain related changes that serve a single purpose - **Imperative mood**: Write as commands (e.g., "add feature" not "added feature") - **Concise first line**: Keep under 72 characters - **Conventional format**: Use ` : ` where type is one of: - `feat`: A new feature - `fix`: A bug fix - `docs`: Documentation changes - `style`: Code style changes (formatting, etc.) - `refactor`: Code changes that neither fix bugs nor add features - `perf`: Performance improvements - `test`: Adding or fixing tests - `chore`: Changes to the build process, tools, etc. - **Present tense, imperative mood**: Write commit messages as commands (e.g., "add feature" not "added feature") - **Concise first line**: Keep the first line under 72 characters - **Emoji**: Each commit type is paired with an appropriate emoji: - โœจ `feat`: New feature - ๐Ÿ› `fix`: Bug fix - ๐Ÿ“ `docs`: Documentation - ๐Ÿ’„ `style`: Formatting/style - โ™ป๏ธ `refactor`: Code refactoring - โšก๏ธ `perf`: Performance improvements - โœ… `test`: Tests - ๐Ÿ”ง `chore`: Tooling, configuration - ๐Ÿš€ `ci`: CI/CD improvements - ๐Ÿ—‘๏ธ `revert`: Reverting changes - ๐Ÿงช `test`: Add a failing test - ๐Ÿšจ `fix`: Fix compiler/linter warnings - ๐Ÿ”’๏ธ `fix`: Fix security issues - ๐Ÿ‘ฅ `chore`: Add or update contributors - ๐Ÿšš `refactor`: Move or rename resources - ๐Ÿ—๏ธ `refactor`: Make architectural changes - ๐Ÿ”€ `chore`: Merge branches - ๐Ÿ“ฆ๏ธ `chore`: Add or update compiled files or packages - โž• `chore`: Add a dependency - โž– `chore`: Remove a dependency - ๐ŸŒฑ `chore`: Add or update seed files - ๐Ÿง‘โ€๐Ÿ’ป `chore`: Improve developer experience - ๐Ÿงต `feat`: Add or update code related to multithreading or concurrency - ๐Ÿ”๏ธ `feat`: Improve SEO - ๐Ÿท๏ธ `feat`: Add or update types - ๐Ÿ’ฌ `feat`: Add or update text and literals - ๐ŸŒ `feat`: Internationalization and localization - ๐Ÿ‘” `feat`: Add or update business logic - ๐Ÿ“ฑ `feat`: Work on responsive design - ๐Ÿšธ `feat`: Improve user experience / usability - ๐Ÿฉน `fix`: Simple fix for a non-critical issue - ๐Ÿฅ… `fix`: Catch errors - ๐Ÿ‘ฝ๏ธ `fix`: Update code due to external API changes - ๐Ÿ”ฅ `fix`: Remove code or files - ๐ŸŽจ `style`: Improve structure/format of the code - ๐Ÿš‘๏ธ `fix`: Critical hotfix - ๐ŸŽ‰ `chore`: Begin a project - ๐Ÿ”– `chore`: Release/Version tags - ๐Ÿšง `wip`: Work in progress - ๐Ÿ’š `fix`: Fix CI build - ๐Ÿ“Œ `chore`: Pin dependencies to specific versions - ๐Ÿ‘ท `ci`: Add or update CI build system - ๐Ÿ“ˆ `feat`: Add or update analytics or tracking code - โœ๏ธ `fix`: Fix typos - โช๏ธ `revert`: Revert changes - ๐Ÿ“„ `chore`: Add or update license - ๐Ÿ’ฅ `feat`: Introduce breaking changes - ๐Ÿฑ `assets`: Add or update assets - โ™ฟ๏ธ `feat`: Improve accessibility - ๐Ÿ’ก `docs`: Add or update comments in source code - ๐Ÿ—ƒ๏ธ `db`: Perform database related changes - ๐Ÿ”Š `feat`: Add or update logs - ๐Ÿ”‡ `fix`: Remove logs - ๐Ÿคก `test`: Mock things - ๐Ÿฅš `feat`: Add or update an easter egg - ๐Ÿ™ˆ `chore`: Add or update .gitignore file - ๐Ÿ“ธ `test`: Add or update snapshots - โš—๏ธ `experiment`: Perform experiments - ๐Ÿšฉ `feat`: Add, update, or remove feature flags - ๐Ÿ’ซ `ui`: Add or update animations and transitions - โšฐ๏ธ `refactor`: Remove dead code - ๐Ÿฆบ `feat`: Add or update code related to validation - โœˆ๏ธ `feat`: Improve offline support ## Reference: Good Commit Examples Use these as examples when generating commit messages: - โœจ feat: add user authentication system - ๐Ÿ› fix: resolve memory leak in rendering process - ๐Ÿ“ docs: update API documentation with new endpoints - โ™ป๏ธ refactor: simplify error handling logic in parser - ๐Ÿšจ fix: resolve linter warnings in component files - ๐Ÿง‘โ€๐Ÿ’ป chore: improve developer tooling setup process - ๐Ÿ‘” feat: implement business logic for transaction validation - ๐Ÿฉน fix: address minor styling inconsistency in header - ๐Ÿš‘๏ธ fix: patch critical security vulnerability in auth flow - ๐ŸŽจ style: reorganize component structure for better readability - ๐Ÿ”ฅ fix: remove deprecated legacy code - ๐Ÿฆบ feat: add input validation for user registration form - ๐Ÿ’š fix: resolve failing CI pipeline tests - ๐Ÿ“ˆ feat: implement analytics tracking for user engagement - ๐Ÿ”’๏ธ fix: strengthen authentication password requirements - โ™ฟ๏ธ feat: improve form accessibility for screen readers Example commit sequence: - โœจ feat: add user authentication system - ๐Ÿ› fix: resolve memory leak in rendering process - ๐Ÿ“ docs: update API documentation with new endpoints - โ™ป๏ธ refactor: simplify error handling logic in parser - ๐Ÿšจ fix: resolve linter warnings in component files - โœ… test: add unit tests for authentication flow ## Agent Behavior Notes - **Error handling**: If validation fails, give user option to proceed or fix issues first - **Auto-staging**: If no files are staged, automatically stage all changes with `git add .` - **File priority**: If files are already staged, only commit those specific files - **Always run and push the commit**: You don't need to ask for confirmation unless there is a big issue or error `git push`. - **Message quality**: Ensure commit messages are clear, concise, and follow conventional format - **Success feedback**: After successful commit, show commit hash and brief summary