协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
conventional-commit-gen【开发与工程】Analyzes git diff to generate commit messages following the Conventional Commits spec, with automatic scope detection and commit type inference. Trigger when users ask to write or generate a commit message, mention Conventional Commits, git commits, standardized commits, scope detection, or phrases like 'help me write a commit message'.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: conventional-commit-gen description: "Analyzes git diff to generate commit messages following the Conventional Commits spec, with automatic scope detection and commit type inference. Trigger when users ask to write or generate a commit message, mention Conventional Commits, git commits, standardized commits, scope detection, or phrases like 'help me write a commit message'." type: tool license: MIT tags:
Analyzes the current git diff and automatically generates a commit message that follows the Conventional Commits specification, with smart scope detection.
# Analyze unstaged changes and generate a commit message
python3 scripts/analyze_diff.py
# Analyze staged changes only
python3 scripts/analyze_diff.py --staged
# Specify a repository path
python3 scripts/analyze_diff.py --repo /path/to/repo
# JSON output (useful for programmatic integration)
python3 scripts/analyze_diff.py --staged --format json
# Manually override type or scope
python3 scripts/analyze_diff.py --staged --type-override feat --scope-override auth
Run the script in the user's git repository to get the automated analysis:
python3 scripts/analyze_diff.py --staged --format json
The script outputs:
After reviewing the output, adjust as needed:
chore but it's actually a feat), use --type-override to override--scope-override to overrideNote: Type detection is based on file paths and change statistics. It works well for types like test/docs/ci/build, but for modifications to existing source code files (feat vs fix vs refactor), you should read the diff content and make the final call.
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
| Type | Meaning |
|---|---|
feat | A new feature |
fix | A bug fix |
docs | Documentation changes |
style | Code formatting (no logic changes) |
refactor | Refactoring (no new features or bug fixes) |
test | Test-related changes |
chore | Build/tooling/dependency maintenance |
perf | Performance improvements |
ci | CI/CD configuration changes |
build | Build system or external dependency changes |
If the change includes a breaking change, add ! after the type:
feat(api)!: change authentication endpoint response format
| Parameter | Description | Default |
|---|---|---|
--repo | Path to the git repository | . |
--staged | Analyze staged changes only | No |
--format | Output format: text or json | text |
--type-override | Manually specify the commit type, skipping auto-detection | None |
--scope-override | Manually specify the scope, skipping auto-detection | None |
--repo points to a valid git repository