ace-git-commit 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.ace-defaults/git/commit.yml +22 -0
- data/.ace-defaults/nav/protocols/guide-sources/ace-git-commit.yml +10 -0
- data/.ace-defaults/nav/protocols/prompt-sources/ace-git-commit.yml +19 -0
- data/.ace-defaults/nav/protocols/wfi-sources/ace-git-commit.yml +19 -0
- data/CHANGELOG.md +404 -0
- data/COMPARISON.md +176 -0
- data/LICENSE +21 -0
- data/README.md +44 -0
- data/Rakefile +14 -0
- data/exe/ace-git-commit +13 -0
- data/handbook/guides/version-control-system-message.g.md +507 -0
- data/handbook/prompts/git-commit.md +22 -0
- data/handbook/prompts/git-commit.system.md +150 -0
- data/handbook/skills/as-git-commit/SKILL.md +57 -0
- data/handbook/workflow-instructions/git/commit.wf.md +75 -0
- data/lib/ace/git_commit/atoms/git_executor.rb +62 -0
- data/lib/ace/git_commit/atoms/gitignore_checker.rb +118 -0
- data/lib/ace/git_commit/cli/commands/commit.rb +147 -0
- data/lib/ace/git_commit/cli.rb +23 -0
- data/lib/ace/git_commit/models/commit_group.rb +53 -0
- data/lib/ace/git_commit/models/commit_options.rb +75 -0
- data/lib/ace/git_commit/models/split_commit_result.rb +60 -0
- data/lib/ace/git_commit/models/stage_result.rb +71 -0
- data/lib/ace/git_commit/molecules/commit_grouper.rb +123 -0
- data/lib/ace/git_commit/molecules/commit_summarizer.rb +43 -0
- data/lib/ace/git_commit/molecules/diff_analyzer.rb +111 -0
- data/lib/ace/git_commit/molecules/file_stager.rb +153 -0
- data/lib/ace/git_commit/molecules/message_generator.rb +438 -0
- data/lib/ace/git_commit/molecules/path_resolver.rb +365 -0
- data/lib/ace/git_commit/molecules/split_commit_executor.rb +272 -0
- data/lib/ace/git_commit/organisms/commit_orchestrator.rb +330 -0
- data/lib/ace/git_commit/version.rb +7 -0
- data/lib/ace/git_commit.rb +41 -0
- metadata +149 -0
data/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1> ACE - Git Commit </h1>
|
|
3
|
+
|
|
4
|
+
Intention-aware conventional commit generation from diffs.
|
|
5
|
+
|
|
6
|
+
<img src="https://raw.githubusercontent.com/cs3b/ace/main/docs/brand/AgenticCodingEnvironment.Logo.XS.jpg" alt="ACE Logo" width="480">
|
|
7
|
+
<br><br>
|
|
8
|
+
|
|
9
|
+
<a href="https://rubygems.org/gems/ace-git-commit"><img alt="Gem Version" src="https://img.shields.io/gem/v/ace-git-commit.svg" /></a>
|
|
10
|
+
<a href="https://www.ruby-lang.org"><img alt="Ruby" src="https://img.shields.io/badge/Ruby-3.2+-CC342D?logo=ruby" /></a>
|
|
11
|
+
<a href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg" /></a>
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
> Works with: Claude Code, Codex CLI, OpenCode, Gemini CLI, pi-agent, and more.
|
|
16
|
+
|
|
17
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md)
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
`ace-git-commit` helps developers and coding agents turn repository changes into clear, scoped conventional commit messages while staying inside the terminal workflow. It analyzes diffs, supports intention hints, and handles monorepo scope-based splitting (separate commits per package) automatically.
|
|
22
|
+
|
|
23
|
+
## How It Works
|
|
24
|
+
|
|
25
|
+
1. Stage changes (by default) and analyze the diff to determine scope, type, and purpose.
|
|
26
|
+
2. Generate a conventional commit message using LLM analysis via [ace-llm](../ace-llm), optionally guided by an intention hint.
|
|
27
|
+
3. Create the commit, or split into multiple scope-based commits for monorepo change sets.
|
|
28
|
+
|
|
29
|
+
## Use Cases
|
|
30
|
+
|
|
31
|
+
**Generate high-quality commits from staged or unstaged changes** - run [`ace-git-commit`](docs/usage.md) to stage, analyze the diff, and produce a conventional commit message. Use `/as-git-commit` for the full agent-driven workflow.
|
|
32
|
+
|
|
33
|
+
**Guide message intent when diff context is not enough** - pass `-i "fix auth bug"` so the generated message reflects purpose, not only file deltas.
|
|
34
|
+
|
|
35
|
+
**Handle monorepo work without manual commit slicing** - commit path-scoped changes directly or rely on scope-aware splitting across packages with `--no-split` to override when needed.
|
|
36
|
+
|
|
37
|
+
**Preview and control commit behavior safely** - use `--dry-run` to preview, `--only-staged` for strict staging, or `-m` for explicit messages, with configuration cascade from [ace-support-config](../ace-support-config) for project and user overrides.
|
|
38
|
+
|
|
39
|
+
## Configuration
|
|
40
|
+
|
|
41
|
+
Override the default LLM model in `.ace/git/commit.yml` (see [defaults](.ace-defaults/git/commit.yml) for all options), or replace any prompt template in `.ace-handbook/prompts/` to match your commit style.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
[Getting Started](docs/getting-started.md) | [Usage Guide](docs/usage.md) | [Handbook - Skills, Agents, Templates](docs/handbook.md) | Part of [ACE](https://github.com/cs3b/ace)
|
data/Rakefile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "minitest/test_task"
|
|
5
|
+
|
|
6
|
+
desc "Run tests using ace-test"
|
|
7
|
+
task :test do
|
|
8
|
+
sh "ace-test"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
desc "Run tests directly (CI mode)"
|
|
12
|
+
Minitest::TestTask.create(:ci)
|
|
13
|
+
|
|
14
|
+
task default: :test
|
data/exe/ace-git-commit
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "ace/support/cli"
|
|
5
|
+
require_relative "../lib/ace/git_commit"
|
|
6
|
+
|
|
7
|
+
# Start ace-support-cli single-command entrypoint with exception-based exit code handling (per ADR-023)
|
|
8
|
+
begin
|
|
9
|
+
Ace::Support::Cli::Runner.new(Ace::GitCommit::CLI::Commands::Commit).call(args: ARGV)
|
|
10
|
+
rescue Ace::Support::Cli::Error => e
|
|
11
|
+
warn e.message
|
|
12
|
+
exit(e.exit_code)
|
|
13
|
+
end
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
---
|
|
2
|
+
doc-type: guide
|
|
3
|
+
title: Version Control System Message Guide
|
|
4
|
+
purpose: Documentation for ace-git-commit/handbook/guides/version-control-system-message.g.md
|
|
5
|
+
ace-docs:
|
|
6
|
+
last-updated: 2026-01-08
|
|
7
|
+
last-checked: 2026-03-21
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Version Control System Message Guide
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
|
|
14
|
+
This guide provides comprehensive documentation for version control commit message standards, specifically documenting the Conventional Commits specification required by project workflows. It serves as a standalone reference for creating clear, consistent, and actionable commit messages.
|
|
15
|
+
|
|
16
|
+
## Conventional Commits Specification
|
|
17
|
+
|
|
18
|
+
### Message Structure
|
|
19
|
+
|
|
20
|
+
All commit messages must follow the Conventional Commits specification:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<type>(<scope>): <subject>
|
|
24
|
+
|
|
25
|
+
<body>
|
|
26
|
+
|
|
27
|
+
<footer>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Components
|
|
31
|
+
|
|
32
|
+
#### Type (Required)
|
|
33
|
+
|
|
34
|
+
The type indicates the nature of the change:
|
|
35
|
+
|
|
36
|
+
- **feat**: A new feature for the user
|
|
37
|
+
- **fix**: A bug fix
|
|
38
|
+
- **docs**: Documentation only changes
|
|
39
|
+
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
|
|
40
|
+
- **refactor**: A code change that neither fixes a bug nor adds a feature
|
|
41
|
+
- **test**: Adding missing tests or correcting existing tests
|
|
42
|
+
- **chore**: Changes to the build process or auxiliary tools and libraries
|
|
43
|
+
|
|
44
|
+
#### Scope (Optional)
|
|
45
|
+
|
|
46
|
+
The scope indicates the section of the codebase affected:
|
|
47
|
+
|
|
48
|
+
- **Common scopes**: `api`, `ui`, `auth`, `db`, `config`, `cli`, `docs`
|
|
49
|
+
- **Component scopes**: `parser`, `router`, `validator`, `middleware`
|
|
50
|
+
- **Domain scopes**: `users`, `orders`, `payments`, `inventory`
|
|
51
|
+
|
|
52
|
+
#### Subject (Required)
|
|
53
|
+
|
|
54
|
+
The subject contains a succinct description of the change:
|
|
55
|
+
|
|
56
|
+
- Use imperative mood ("add" not "added" or "adds")
|
|
57
|
+
- Keep it 50 characters or less
|
|
58
|
+
- Do not capitalize the first letter
|
|
59
|
+
- Do not end with a period
|
|
60
|
+
|
|
61
|
+
#### Body (Optional)
|
|
62
|
+
|
|
63
|
+
The body provides additional context:
|
|
64
|
+
|
|
65
|
+
- Wrap lines at 72 characters
|
|
66
|
+
- Explain the what and why, not the how
|
|
67
|
+
- Use bullet points for multiple items
|
|
68
|
+
- Separate from subject with blank line
|
|
69
|
+
|
|
70
|
+
#### Footer (Optional)
|
|
71
|
+
|
|
72
|
+
The footer contains metadata:
|
|
73
|
+
|
|
74
|
+
- **Breaking changes**: Use `BREAKING CHANGE:` prefix
|
|
75
|
+
- **Issue references**: Use `Fixes #123`, `Closes #456`
|
|
76
|
+
- **Co-authors**: Use `Co-authored-by: Name <email>`
|
|
77
|
+
|
|
78
|
+
## Commit Types in Detail
|
|
79
|
+
|
|
80
|
+
### feat: New Features
|
|
81
|
+
|
|
82
|
+
Use `feat` for new functionality that adds value to users:
|
|
83
|
+
|
|
84
|
+
```git
|
|
85
|
+
feat(auth): add password reset functionality
|
|
86
|
+
|
|
87
|
+
Implement secure password reset flow with email verification.
|
|
88
|
+
- Add password reset request endpoint
|
|
89
|
+
- Create secure token generation
|
|
90
|
+
- Implement email notification system
|
|
91
|
+
- Add password reset confirmation page
|
|
92
|
+
|
|
93
|
+
Implements #234
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Guidelines:**
|
|
97
|
+
|
|
98
|
+
- Always include tests for new features
|
|
99
|
+
- Update documentation when adding user-facing features
|
|
100
|
+
- Consider breaking changes and version impact
|
|
101
|
+
|
|
102
|
+
### fix: Bug Fixes
|
|
103
|
+
|
|
104
|
+
Use `fix` for resolving issues or correcting unintended behavior:
|
|
105
|
+
|
|
106
|
+
```git
|
|
107
|
+
fix(api): handle null values in user response
|
|
108
|
+
|
|
109
|
+
Root cause: Missing null check in user serialization
|
|
110
|
+
Solution: Add proper validation before processing
|
|
111
|
+
|
|
112
|
+
- Add null checks for optional fields
|
|
113
|
+
- Update tests to cover edge cases
|
|
114
|
+
- Fix TypeScript types for nullable fields
|
|
115
|
+
|
|
116
|
+
Fixes #123
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Guidelines:**
|
|
120
|
+
|
|
121
|
+
- Include root cause analysis when helpful
|
|
122
|
+
- Reference the issue being fixed
|
|
123
|
+
- Ensure fix is covered by tests
|
|
124
|
+
|
|
125
|
+
### docs: Documentation
|
|
126
|
+
|
|
127
|
+
Use `docs` for documentation-only changes:
|
|
128
|
+
|
|
129
|
+
```git
|
|
130
|
+
docs(readme): update installation instructions
|
|
131
|
+
|
|
132
|
+
- Add prerequisites section
|
|
133
|
+
- Update Node.js version requirement
|
|
134
|
+
- Include troubleshooting steps
|
|
135
|
+
- Fix formatting issues
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Guidelines:**
|
|
139
|
+
|
|
140
|
+
- No functional code changes
|
|
141
|
+
- May include example updates
|
|
142
|
+
- Can affect README, comments, or separate docs
|
|
143
|
+
|
|
144
|
+
### style: Code Style
|
|
145
|
+
|
|
146
|
+
Use `style` for formatting changes that don't affect logic:
|
|
147
|
+
|
|
148
|
+
```git
|
|
149
|
+
style(parser): fix indentation and spacing
|
|
150
|
+
|
|
151
|
+
- Standardize indentation to 2 spaces
|
|
152
|
+
- Remove trailing whitespace
|
|
153
|
+
- Fix line length violations
|
|
154
|
+
- Organize imports alphabetically
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Guidelines:**
|
|
158
|
+
|
|
159
|
+
- No functional changes
|
|
160
|
+
- Often automated by linters/formatters
|
|
161
|
+
- Include scope of formatting changes
|
|
162
|
+
|
|
163
|
+
### refactor: Code Improvements
|
|
164
|
+
|
|
165
|
+
Use `refactor` for code changes that improve structure without changing behavior:
|
|
166
|
+
|
|
167
|
+
```git
|
|
168
|
+
refactor(service): simplify request handling logic
|
|
169
|
+
|
|
170
|
+
- Extract common patterns to helper methods
|
|
171
|
+
- Reduce code duplication
|
|
172
|
+
- Improve readability and maintainability
|
|
173
|
+
- Consolidate error handling
|
|
174
|
+
|
|
175
|
+
No functional changes
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Guidelines:**
|
|
179
|
+
|
|
180
|
+
- Explicitly state "No functional changes"
|
|
181
|
+
- Include reasoning for refactoring
|
|
182
|
+
- Ensure all tests still pass
|
|
183
|
+
|
|
184
|
+
### test: Testing
|
|
185
|
+
|
|
186
|
+
Use `test` for adding or modifying tests:
|
|
187
|
+
|
|
188
|
+
```git
|
|
189
|
+
test(validator): add comprehensive email validation tests
|
|
190
|
+
|
|
191
|
+
- Test valid email formats
|
|
192
|
+
- Test invalid email formats
|
|
193
|
+
- Test edge cases (empty, null, special chars)
|
|
194
|
+
- Add performance tests for large inputs
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Guidelines:**
|
|
198
|
+
|
|
199
|
+
- Focus on test coverage improvements
|
|
200
|
+
- May include test infrastructure changes
|
|
201
|
+
- Can be combined with fixes or features
|
|
202
|
+
|
|
203
|
+
### chore: Maintenance
|
|
204
|
+
|
|
205
|
+
Use `chore` for maintenance tasks that don't affect source code:
|
|
206
|
+
|
|
207
|
+
```git
|
|
208
|
+
chore(deps): update dependencies to latest versions
|
|
209
|
+
|
|
210
|
+
- Update Express to v4.18.2
|
|
211
|
+
- Update Jest to v29.0.0
|
|
212
|
+
- Update TypeScript to v4.8.0
|
|
213
|
+
- Resolve security vulnerabilities
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Guidelines:**
|
|
217
|
+
|
|
218
|
+
- Dependency updates
|
|
219
|
+
- Build tool changes
|
|
220
|
+
- CI/CD configuration
|
|
221
|
+
- Development environment changes
|
|
222
|
+
|
|
223
|
+
## Scope Usage Guidelines
|
|
224
|
+
|
|
225
|
+
### When to Include Scope
|
|
226
|
+
|
|
227
|
+
**Always include scope when:**
|
|
228
|
+
|
|
229
|
+
- Multiple modules exist in the project
|
|
230
|
+
- Change affects a specific component
|
|
231
|
+
- Scope provides meaningful context
|
|
232
|
+
|
|
233
|
+
**Optional scope when:**
|
|
234
|
+
|
|
235
|
+
- Change affects entire application
|
|
236
|
+
- Scope would be too generic (`app`, `main`)
|
|
237
|
+
- Project has simple structure
|
|
238
|
+
|
|
239
|
+
### Scope Naming Conventions
|
|
240
|
+
|
|
241
|
+
- **Lowercase**: Use lowercase for scopes
|
|
242
|
+
- **Kebab-case**: Use hyphens for multi-word scopes (`user-auth`)
|
|
243
|
+
- **Consistent**: Use established scopes from project history
|
|
244
|
+
- **Descriptive**: Make scope meaningful to team members
|
|
245
|
+
|
|
246
|
+
### Common Scope Patterns
|
|
247
|
+
|
|
248
|
+
#### By Layer
|
|
249
|
+
|
|
250
|
+
- `api`: Backend API changes
|
|
251
|
+
- `ui`: User interface changes
|
|
252
|
+
- `db`: Database-related changes
|
|
253
|
+
- `config`: Configuration changes
|
|
254
|
+
|
|
255
|
+
#### By Feature
|
|
256
|
+
|
|
257
|
+
- `auth`: Authentication and authorization
|
|
258
|
+
- `search`: Search functionality
|
|
259
|
+
- `payments`: Payment processing
|
|
260
|
+
- `notifications`: Notification system
|
|
261
|
+
|
|
262
|
+
#### By Component
|
|
263
|
+
|
|
264
|
+
- `parser`: Code parsing logic
|
|
265
|
+
- `router`: Routing logic
|
|
266
|
+
- `validator`: Validation logic
|
|
267
|
+
- `middleware`: Middleware components
|
|
268
|
+
|
|
269
|
+
## Breaking Changes
|
|
270
|
+
|
|
271
|
+
### Format for Breaking Changes
|
|
272
|
+
|
|
273
|
+
Breaking changes must be indicated in the footer:
|
|
274
|
+
|
|
275
|
+
```git
|
|
276
|
+
feat(api): update user authentication endpoint
|
|
277
|
+
|
|
278
|
+
Change authentication endpoint to use JWT tokens instead of sessions.
|
|
279
|
+
|
|
280
|
+
BREAKING CHANGE: Authentication endpoint now requires JWT token in Authorization header instead of session cookies. Update client applications to use new authentication flow.
|
|
281
|
+
|
|
282
|
+
Implements #456
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Guidelines for Breaking Changes
|
|
286
|
+
|
|
287
|
+
- Always use `BREAKING CHANGE:` prefix in footer
|
|
288
|
+
- Explain what changed and why
|
|
289
|
+
- Provide migration guidance
|
|
290
|
+
- Consider major version bump
|
|
291
|
+
- Document in changelog
|
|
292
|
+
|
|
293
|
+
## Multi-line Messages
|
|
294
|
+
|
|
295
|
+
### When to Use Body
|
|
296
|
+
|
|
297
|
+
Use body section when:
|
|
298
|
+
|
|
299
|
+
- Change requires explanation
|
|
300
|
+
- Multiple files affected
|
|
301
|
+
- Context needed for reviewers
|
|
302
|
+
- Implementation details important
|
|
303
|
+
|
|
304
|
+
### Body Structure
|
|
305
|
+
|
|
306
|
+
```git
|
|
307
|
+
feat(search): implement advanced search filters
|
|
308
|
+
|
|
309
|
+
Add support for complex search queries with multiple criteria.
|
|
310
|
+
This enables users to search by date range, category, and tags
|
|
311
|
+
simultaneously, improving search precision.
|
|
312
|
+
|
|
313
|
+
Implementation details:
|
|
314
|
+
- Add query builder for complex conditions
|
|
315
|
+
- Create filter component for UI
|
|
316
|
+
- Implement search result ranking
|
|
317
|
+
- Add caching for performance
|
|
318
|
+
|
|
319
|
+
Implements #789
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Common Patterns
|
|
323
|
+
|
|
324
|
+
### Revert Commits
|
|
325
|
+
|
|
326
|
+
```git
|
|
327
|
+
revert: "feat(auth): add password reset functionality"
|
|
328
|
+
|
|
329
|
+
This reverts commit abc123def456.
|
|
330
|
+
|
|
331
|
+
Reason: Password reset feature caused issues in production
|
|
332
|
+
with email delivery service.
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Co-authored Commits
|
|
336
|
+
|
|
337
|
+
```git
|
|
338
|
+
feat(api): implement user profile endpoints
|
|
339
|
+
|
|
340
|
+
Add CRUD operations for user profiles with validation.
|
|
341
|
+
|
|
342
|
+
Co-authored-by: Alice Developer <alice@example.com>
|
|
343
|
+
Co-authored-by: Bob Engineer <bob@example.com>
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Multiple Issue References
|
|
347
|
+
|
|
348
|
+
```git
|
|
349
|
+
fix(validator): resolve validation edge cases
|
|
350
|
+
|
|
351
|
+
- Fix null handling in email validator
|
|
352
|
+
- Resolve regex issues with special characters
|
|
353
|
+
- Update error messages for clarity
|
|
354
|
+
|
|
355
|
+
Fixes #123, #456
|
|
356
|
+
Closes #789
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Validation Rules
|
|
360
|
+
|
|
361
|
+
### Automated Validation
|
|
362
|
+
|
|
363
|
+
Projects should implement git hooks to validate commit messages:
|
|
364
|
+
|
|
365
|
+
```bash
|
|
366
|
+
# Example: Validate Conventional Commits format
|
|
367
|
+
if ! echo "$COMMIT_MSG" | grep -qE '^(feat|fix|docs|style|refactor|test|chore)(\(\S+\))?:\s.+'; then
|
|
368
|
+
echo "ERROR: Invalid commit message format." >&2
|
|
369
|
+
echo "Please follow the Conventional Commits specification: <type>(<scope>): <subject>" >&2
|
|
370
|
+
echo "Example: feat(api): add new endpoint" >&2
|
|
371
|
+
exit 1
|
|
372
|
+
fi
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Manual Validation Checklist
|
|
376
|
+
|
|
377
|
+
Before committing, verify:
|
|
378
|
+
|
|
379
|
+
- [ ] Type is one of: feat, fix, docs, style, refactor, test, chore
|
|
380
|
+
- [ ] Scope is lowercase and descriptive (if included)
|
|
381
|
+
- [ ] Subject uses imperative mood
|
|
382
|
+
- [ ] Subject is 50 characters or less
|
|
383
|
+
- [ ] Subject doesn't end with period
|
|
384
|
+
- [ ] Body lines are 72 characters or less
|
|
385
|
+
- [ ] Footer includes issue references
|
|
386
|
+
- [ ] Breaking changes are properly documented
|
|
387
|
+
|
|
388
|
+
## Common Anti-patterns
|
|
389
|
+
|
|
390
|
+
### Avoid These Patterns
|
|
391
|
+
|
|
392
|
+
**Vague messages:**
|
|
393
|
+
|
|
394
|
+
```git
|
|
395
|
+
# Bad
|
|
396
|
+
fix: bug fix
|
|
397
|
+
|
|
398
|
+
# Good
|
|
399
|
+
fix(auth): handle expired tokens gracefully
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Past tense:**
|
|
403
|
+
|
|
404
|
+
```git
|
|
405
|
+
# Bad
|
|
406
|
+
feat(api): added new endpoint
|
|
407
|
+
|
|
408
|
+
# Good
|
|
409
|
+
feat(api): add new endpoint
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Capitalized subject:**
|
|
413
|
+
|
|
414
|
+
```git
|
|
415
|
+
# Bad
|
|
416
|
+
feat(ui): Add dark mode toggle
|
|
417
|
+
|
|
418
|
+
# Good
|
|
419
|
+
feat(ui): add dark mode toggle
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Missing type:**
|
|
423
|
+
|
|
424
|
+
```git
|
|
425
|
+
# Bad
|
|
426
|
+
update user validation
|
|
427
|
+
|
|
428
|
+
# Good
|
|
429
|
+
refactor(validator): update user validation logic
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Integration with Workflows
|
|
433
|
+
|
|
434
|
+
### Semantic Versioning
|
|
435
|
+
|
|
436
|
+
Commit types determine version bumps:
|
|
437
|
+
|
|
438
|
+
- **feat**: Minor version bump (1.0.0 → 1.1.0)
|
|
439
|
+
- **fix**: Patch version bump (1.0.0 → 1.0.1)
|
|
440
|
+
- **BREAKING CHANGE**: Major version bump (1.0.0 → 2.0.0)
|
|
441
|
+
|
|
442
|
+
### Changelog Generation
|
|
443
|
+
|
|
444
|
+
Conventional commits enable automated changelog generation:
|
|
445
|
+
|
|
446
|
+
```markdown
|
|
447
|
+
## [1.2.0] - 2023-12-01
|
|
448
|
+
|
|
449
|
+
### Features
|
|
450
|
+
- **auth**: add password reset functionality (#234)
|
|
451
|
+
- **search**: implement advanced search filters (#789)
|
|
452
|
+
|
|
453
|
+
### Bug Fixes
|
|
454
|
+
- **api**: handle null values in user response (#123)
|
|
455
|
+
- **validator**: resolve validation edge cases (#456)
|
|
456
|
+
|
|
457
|
+
### Breaking Changes
|
|
458
|
+
- **api**: update user authentication endpoint (#456)
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
## Tools and Automation
|
|
462
|
+
|
|
463
|
+
### Recommended Tools
|
|
464
|
+
|
|
465
|
+
- **commitizen**: Interactive commit message prompts
|
|
466
|
+
- **commitlint**: Automated commit message validation
|
|
467
|
+
- **conventional-changelog**: Automated changelog generation
|
|
468
|
+
- **semantic-release**: Automated version management
|
|
469
|
+
|
|
470
|
+
### Git Hook Example
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
#!/bin/sh
|
|
474
|
+
# .git/hooks/commit-msg
|
|
475
|
+
|
|
476
|
+
commit_regex='^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,50}'
|
|
477
|
+
|
|
478
|
+
if ! grep -qE "$commit_regex" "$1"; then
|
|
479
|
+
echo "Invalid commit message format."
|
|
480
|
+
echo "Please use: <type>(<scope>): <subject>"
|
|
481
|
+
echo "Example: feat(api): add user authentication"
|
|
482
|
+
exit 1
|
|
483
|
+
fi
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
## Best Practices Summary
|
|
487
|
+
|
|
488
|
+
1. **Be consistent**: Follow the same patterns across your project
|
|
489
|
+
2. **Be descriptive**: Write clear, meaningful commit messages
|
|
490
|
+
3. **Be atomic**: One logical change per commit
|
|
491
|
+
4. **Be imperative**: Use imperative mood in subject line
|
|
492
|
+
5. **Be concise**: Keep subject line under 50 characters
|
|
493
|
+
6. **Be thorough**: Include context in body when needed
|
|
494
|
+
7. **Be traceable**: Reference issues and pull requests
|
|
495
|
+
8. **Be breaking-aware**: Document breaking changes clearly
|
|
496
|
+
|
|
497
|
+
## Related Documents
|
|
498
|
+
|
|
499
|
+
- [Version Control Git Guide](./version-control-system-git.g.md) - Complete Git workflow practices
|
|
500
|
+
- [Commit Workflow](../workflow-instructions/commit.wf.md) - Step-by-step commit process
|
|
501
|
+
- [Code Review Process](./code-review-process.g.md) - Review guidelines including commit quality
|
|
502
|
+
|
|
503
|
+
## References
|
|
504
|
+
|
|
505
|
+
- [Conventional Commits Specification](https://www.conventionalcommits.org/)
|
|
506
|
+
- [Semantic Versioning](https://semver.org/)
|
|
507
|
+
- [Git Best Practices](https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Git Commit Prompt
|
|
2
|
+
|
|
3
|
+
You are a Git commit assistant. Help users create well-structured commits by:
|
|
4
|
+
|
|
5
|
+
## Primary Tasks
|
|
6
|
+
1. Analyzing changes to understand their purpose
|
|
7
|
+
2. Suggesting appropriate commit messages
|
|
8
|
+
3. Ensuring conventional commit format
|
|
9
|
+
4. Grouping related changes
|
|
10
|
+
|
|
11
|
+
## Guidelines
|
|
12
|
+
- Keep commit messages clear and concise
|
|
13
|
+
- Use imperative mood in subject lines
|
|
14
|
+
- Explain the "why" not just the "what"
|
|
15
|
+
- Suggest splitting large changes into atomic commits
|
|
16
|
+
|
|
17
|
+
## Response Format
|
|
18
|
+
Provide commit suggestions with:
|
|
19
|
+
- Type and scope
|
|
20
|
+
- Subject line (50 chars max)
|
|
21
|
+
- Body explanation when needed
|
|
22
|
+
- Related issue references
|