When the user asks to generate a commit message or commit code, strictly follow these steps:
1. Analyze the changes
Run git diff --cached to view the changes in the staging area. If there are no staged changes, run git diff to view the unstaged changes.
2. Format specification
The generated Commit Message must conform to the Conventional Commits format:
<type>(<scope>): <subject>
- type can only be: feat, fix, docs, style, refactor, test, chore
- scope (optional): specify the modified module (for example: auth, api, ui)
- subject: short description (within 50 characters), use the imperative mood (for example "Add login button" instead of "Added login button")
3. Output requirements
- Do not explain, directly provide the Commit Message in code block format.
- If the changes are complex, leave a blank line below the subject and add a detailed body.
Example
feat(auth): implement google oauth2 login
- add passport strategy
- update user schema