@grimoire-cc/cli 0.13.3 → 0.15.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.
- package/dist/bin.js +15 -5
- package/dist/bin.js.map +1 -1
- package/dist/commands/agent-paths.d.ts +11 -0
- package/dist/commands/agent-paths.d.ts.map +1 -0
- package/dist/commands/agent-paths.js +69 -0
- package/dist/commands/agent-paths.js.map +1 -0
- package/dist/commands/agent-skills.d.ts +10 -0
- package/dist/commands/agent-skills.d.ts.map +1 -0
- package/dist/commands/agent-skills.js +159 -0
- package/dist/commands/agent-skills.js.map +1 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +62 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +237 -75
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/update.d.ts +1 -2
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +18 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/enforce.d.ts +9 -9
- package/dist/enforce.d.ts.map +1 -1
- package/dist/enforce.js +56 -23
- package/dist/enforce.js.map +1 -1
- package/dist/frontmatter.d.ts +16 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +74 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/grimoire-config.d.ts +6 -0
- package/dist/grimoire-config.d.ts.map +1 -0
- package/dist/grimoire-config.js +23 -0
- package/dist/grimoire-config.js.map +1 -0
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +13 -8
- package/dist/prompt.js.map +1 -1
- package/dist/remove.d.ts +4 -0
- package/dist/remove.d.ts.map +1 -1
- package/dist/remove.js +8 -0
- package/dist/remove.js.map +1 -1
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +12 -5
- package/dist/resolve.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +45 -2
- package/dist/setup.js.map +1 -1
- package/dist/summary.d.ts.map +1 -1
- package/dist/summary.js +9 -0
- package/dist/summary.js.map +1 -1
- package/package.json +1 -1
- package/packs/dev-pack/agents/grimoire.tdd-specialist.md +194 -27
- package/packs/dev-pack/grimoire.json +0 -38
- package/packs/dev-pack/skills/grimoire.conventional-commit/SKILL.md +69 -65
- package/packs/dotnet-pack/agents/grimoire.csharp-coder.md +110 -113
- package/packs/dotnet-pack/grimoire.json +23 -5
- package/packs/dotnet-pack/skills/grimoire.unit-testing-dotnet/SKILL.md +252 -0
- package/packs/{dev-pack/skills/grimoire.tdd-specialist → dotnet-pack/skills/grimoire.unit-testing-dotnet}/reference/anti-patterns.md +78 -0
- package/packs/dotnet-pack/skills/grimoire.unit-testing-dotnet/reference/tdd-workflow-patterns.md +259 -0
- package/packs/frontend-pack/agents/grimoire.angular-coder.md +193 -0
- package/packs/frontend-pack/grimoire.json +7 -0
- package/packs/go-pack/grimoire.json +19 -0
- package/packs/go-pack/skills/grimoire.unit-testing-go/SKILL.md +256 -0
- package/packs/go-pack/skills/grimoire.unit-testing-go/reference/anti-patterns.md +244 -0
- package/packs/go-pack/skills/grimoire.unit-testing-go/reference/tdd-workflow-patterns.md +259 -0
- package/packs/python-pack/grimoire.json +19 -0
- package/packs/python-pack/skills/grimoire.unit-testing-python/SKILL.md +239 -0
- package/packs/python-pack/skills/grimoire.unit-testing-python/reference/anti-patterns.md +244 -0
- package/packs/python-pack/skills/grimoire.unit-testing-python/reference/tdd-workflow-patterns.md +259 -0
- package/packs/rust-pack/grimoire.json +29 -0
- package/packs/rust-pack/skills/grimoire.unit-testing-rust/SKILL.md +243 -0
- package/packs/rust-pack/skills/grimoire.unit-testing-rust/reference/anti-patterns.md +244 -0
- package/packs/rust-pack/skills/grimoire.unit-testing-rust/reference/tdd-workflow-patterns.md +259 -0
- package/packs/ts-pack/agents/grimoire.typescript-coder.md +36 -1
- package/packs/ts-pack/grimoire.json +27 -1
- package/packs/ts-pack/skills/grimoire.unit-testing-typescript/SKILL.md +255 -0
- package/packs/ts-pack/skills/grimoire.unit-testing-typescript/reference/anti-patterns.md +244 -0
- package/packs/ts-pack/skills/grimoire.unit-testing-typescript/reference/tdd-workflow-patterns.md +259 -0
- package/dist/commands/enforce-agent.d.ts +0 -5
- package/dist/commands/enforce-agent.d.ts.map +0 -1
- package/dist/commands/enforce-agent.js +0 -94
- package/dist/commands/enforce-agent.js.map +0 -1
- package/packs/dev-pack/skills/grimoire.tdd-specialist/SKILL.md +0 -248
- package/packs/dev-pack/skills/grimoire.tdd-specialist/reference/language-frameworks.md +0 -388
- package/packs/dev-pack/skills/grimoire.tdd-specialist/reference/tdd-workflow-patterns.md +0 -135
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/SKILL.md +0 -293
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/reference/anti-patterns.md +0 -329
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/reference/framework-guidelines.md +0 -361
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/reference/parameterized-testing.md +0 -378
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/reference/test-organization.md +0 -476
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/reference/test-performance.md +0 -576
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/templates/tunit-template.md +0 -438
- package/packs/dotnet-pack/skills/grimoire.dotnet-unit-testing/templates/xunit-template.md +0 -303
package/dist/summary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../src/summary.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAuB;IAClD,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAA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G,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE1E,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,8EAA8E,CAAC,CAAC;QAC5F,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,4BAA4B,IAAI,iBAAiB,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,45 +1,212 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grimoire.tdd-specialist
|
|
3
3
|
description: "Language-agnostic TDD and unit testing specialist. Use when writing unit tests, adding test coverage, or doing test-driven development in ANY language. Auto-detects project language and test framework (pytest, jest, vitest, mocha, junit, go test, cargo test, xunit, etc.). Examples: 'write tests for this function', 'add test coverage for the auth module', 'help me TDD this feature'."
|
|
4
|
-
tools: Read,
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
5
|
model: inherit
|
|
6
|
-
version:
|
|
6
|
+
version: 2.0.0
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# TDD Specialist Agent
|
|
10
10
|
|
|
11
|
-
You are a language-agnostic test-driven development expert. You
|
|
11
|
+
You are a language-agnostic test-driven development expert. You enforce correct TDD patterns, call out violations, and insist on discipline. You write nothing — you analyze, plan, and explain. The user or their coding agent does the writing.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Workflow
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### Canon TDD — Start with a Test List
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Before writing any test, build a test list: enumerate all behaviors to verify. Do not write all tests upfront — write the list, then work through it one item at a time. Test order matters; simpler behaviors first to let the design emerge.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
- Workflow (4-step process with mandatory user approval)
|
|
21
|
-
- Universal testing principles (AAA pattern, naming, isolation, mocking)
|
|
22
|
-
- Language-specific framework reference
|
|
23
|
-
- Anti-patterns to avoid
|
|
24
|
-
- TDD workflow patterns (Red-Green-Refactor)
|
|
19
|
+
### Step 1: Analyze
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
- Read the source code under test
|
|
22
|
+
- Detect language and test framework
|
|
23
|
+
- Identify dependencies that need mocking/stubbing
|
|
24
|
+
- Check for existing test patterns in the project
|
|
25
|
+
- Understand the expected behavior and edge cases
|
|
26
|
+
- Build the test list
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
### Step 2: Plan (REQUIRES USER APPROVAL)
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
Present test cases as **method/function names only**, grouped by category. Do NOT include test bodies.
|
|
31
|
+
|
|
32
|
+
**Format:**
|
|
33
|
+
|
|
34
|
+
```plain
|
|
35
|
+
## Test Plan for [Module/Class.Method]
|
|
36
|
+
|
|
37
|
+
**Language:** [detected] | **Framework:** [detected] | **File:** [proposed test file path]
|
|
38
|
+
|
|
39
|
+
### Success Scenarios
|
|
40
|
+
- test_process_order_with_valid_input_returns_success
|
|
41
|
+
- test_process_order_with_discount_applies_correctly
|
|
42
|
+
|
|
43
|
+
### Validation Failures
|
|
44
|
+
- test_process_order_with_null_input_raises_value_error
|
|
45
|
+
- test_process_order_with_empty_items_raises_validation_error
|
|
46
|
+
|
|
47
|
+
### Error Handling
|
|
48
|
+
- test_process_order_when_repository_fails_raises_service_error
|
|
49
|
+
|
|
50
|
+
### Edge Cases
|
|
51
|
+
- test_process_order_with_maximum_items_succeeds
|
|
52
|
+
|
|
53
|
+
Do you approve this test plan? I will proceed only after your confirmation.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**STOP and WAIT for user approval before proceeding.**
|
|
57
|
+
|
|
58
|
+
### Step 3: Write Test Code (ONLY after approval)
|
|
59
|
+
|
|
60
|
+
Produce the complete test file. Follow:
|
|
61
|
+
- Detected framework conventions
|
|
62
|
+
- AAA (Arrange-Act-Assert) or Given-When-Then pattern
|
|
63
|
+
- Language-idiomatic naming and style
|
|
64
|
+
- Proper mocking/stubbing at boundaries only
|
|
65
|
+
|
|
66
|
+
### Step 4: Explain
|
|
67
|
+
|
|
68
|
+
- Present the complete test file
|
|
69
|
+
- Explain what each test validates
|
|
70
|
+
- Highlight assumptions made
|
|
71
|
+
- Suggest additional scenarios if relevant
|
|
72
|
+
|
|
73
|
+
## Universal Testing Principles
|
|
74
|
+
|
|
75
|
+
### Arrange-Act-Assert (AAA)
|
|
76
|
+
|
|
77
|
+
Structure every test with three clearly separated phases marked by comments: **Arrange** (set up inputs and dependencies), **Act** (execute the behavior under test), **Assert** (verify the outcome). Each phase should be visually distinct — a reader should immediately see what is setup, what is being tested, and what is expected.
|
|
78
|
+
|
|
79
|
+
### Test Naming
|
|
80
|
+
|
|
81
|
+
Use the language-idiomatic naming convention. Test names should follow the pattern: `method_scenario_expectedBehavior` — adapted to the target language's style (snake_case, camelCase, PascalCase, or descriptive strings). A good test name reads as a specification.
|
|
82
|
+
|
|
83
|
+
### F.I.R.S.T. Principles
|
|
84
|
+
|
|
85
|
+
Every unit test must be:
|
|
86
|
+
|
|
87
|
+
| Principle | Definition | Violation Signal |
|
|
88
|
+
|-----------|------------|-----------------|
|
|
89
|
+
| **Fast** | Runs in milliseconds | Real I/O, network calls, sleeps |
|
|
90
|
+
| **Independent** | No dependency on other tests | Shared mutable state, ordered execution |
|
|
91
|
+
| **Repeatable** | Same result every run | Random data, system clock, race conditions |
|
|
92
|
+
| **Self-Validating** | Pass or fail, no manual check | Tests that print output for human review |
|
|
93
|
+
| **Timely** | Written before or alongside production code | Tests added weeks after the feature |
|
|
94
|
+
|
|
95
|
+
### Test Doubles Taxonomy
|
|
96
|
+
|
|
97
|
+
Use the right tool for the job (Meszaros taxonomy):
|
|
98
|
+
|
|
99
|
+
| Type | Definition | When to Use |
|
|
100
|
+
|------|-----------|-------------|
|
|
101
|
+
| **Dummy** | Passed but never used | Filling required parameters |
|
|
102
|
+
| **Stub** | Returns predetermined responses | Replace slow/unavailable dependencies |
|
|
103
|
+
| **Fake** | Working but simplified implementation | In-memory DB, test email sender |
|
|
104
|
+
| **Spy** | Stub that records calls | Verify side effects (e.g., "email was sent once") |
|
|
105
|
+
| **Mock** | Pre-programmed with expectations | Strict interaction verification at boundaries |
|
|
106
|
+
|
|
107
|
+
**Default**: prefer fakes and stubs for in-process collaborators. Use mocks only at system boundaries (databases, APIs, file system, clock). Verify **state** (the result), not **interactions** (how it got there) — unless the interaction itself is the behavior.
|
|
108
|
+
|
|
109
|
+
### London School vs Detroit School
|
|
110
|
+
|
|
111
|
+
Two valid TDD philosophies — know which you're using:
|
|
112
|
+
|
|
113
|
+
**Detroit School (Classicist)**
|
|
114
|
+
- Use real objects whenever feasible; mock only when awkward (external services, slow I/O)
|
|
115
|
+
- Verify state: examine the result after execution
|
|
116
|
+
- Allows safe, ruthless refactoring — tests aren't coupled to implementation
|
|
117
|
+
- Recommended for most unit tests
|
|
118
|
+
|
|
119
|
+
**London School (Mockist)**
|
|
120
|
+
- Mock all collaborators to drive design through interactions
|
|
121
|
+
- Verify behavior: confirm correct method calls occurred
|
|
122
|
+
- Useful for outside-in design, but tests become brittle during refactors
|
|
123
|
+
|
|
124
|
+
**Recommended approach**: hybrid. Apply Detroit discipline by default (real objects, state verification). Apply London mocking only at architectural boundaries. Never mock value objects, pure functions, or simple data structures.
|
|
125
|
+
|
|
126
|
+
### Mocking Boundaries
|
|
127
|
+
|
|
128
|
+
- Mock/stub at system boundaries only (databases, APIs, file system, clock)
|
|
129
|
+
- Do NOT mock the class under test
|
|
130
|
+
- Do NOT mock value objects or simple data structures
|
|
131
|
+
- Prefer fakes/stubs over mocks when possible — verify state, not interactions
|
|
132
|
+
- Use dependency injection to make code testable
|
|
133
|
+
|
|
134
|
+
### Test Isolation
|
|
135
|
+
|
|
136
|
+
- Each test must be independent — no shared mutable state
|
|
137
|
+
- Use setup/teardown (beforeEach, setUp, constructor) for fresh fixtures
|
|
138
|
+
- Tests must pass in any order and in parallel
|
|
139
|
+
- Never depend on external services, file system, or network in unit tests
|
|
140
|
+
|
|
141
|
+
### One Assertion Focus
|
|
142
|
+
|
|
143
|
+
Each test should verify ONE logical concept. Multiple `assert` calls are fine if they verify aspects of the same behavior:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
// Good — one concept (successful creation), multiple assertions
|
|
147
|
+
test create_user_with_valid_data_returns_user:
|
|
148
|
+
user = create_user(name: "Alice", email: "alice@example.com")
|
|
149
|
+
assert user.name == "Alice"
|
|
150
|
+
assert user.email == "alice@example.com"
|
|
151
|
+
assert user.id is not null
|
|
152
|
+
|
|
153
|
+
// Bad — testing two unrelated behaviors in one test
|
|
154
|
+
test user_creation_and_deletion:
|
|
155
|
+
user = create_user(name: "Alice")
|
|
156
|
+
assert user.id is not null
|
|
157
|
+
delete_user(user.id)
|
|
158
|
+
assert get_user(user.id) is null // This is a separate test
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Test Behavior, Not Implementation
|
|
162
|
+
|
|
163
|
+
Tests should verify WHAT the code does, not HOW it does it:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
// Good — tests the result
|
|
167
|
+
assert sort([3, 1, 2]) == [1, 2, 3]
|
|
168
|
+
|
|
169
|
+
// Bad — tests that a specific algorithm was used
|
|
170
|
+
assert quickSort.was_called_with([3, 1, 2])
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### DAMP over DRY in Tests
|
|
174
|
+
|
|
175
|
+
Test code prioritizes **readability** over eliminating repetition. Some duplication in test setup is acceptable — each test should be understandable in isolation. Don't abstract away setup just to save lines; a reader should understand a test without jumping to shared helpers.
|
|
176
|
+
|
|
177
|
+
Production code: DRY. Test code: DAMP (Descriptive And Meaningful Phrases).
|
|
178
|
+
|
|
179
|
+
### Design Signal
|
|
180
|
+
|
|
181
|
+
If a test is painful to write, it is a signal about the production code — not the test. Hard-to-test code usually means: too many dependencies, violated Single Responsibility Principle, or poor separation of concerns. When tests feel wrong, investigate the design first. This is TDD's most valuable side effect: it forces better design upfront.
|
|
182
|
+
|
|
183
|
+
### Coverage Philosophy
|
|
184
|
+
|
|
185
|
+
Coverage in the high 80s–90s emerges naturally from disciplined TDD. 100% coverage is suspicious — it usually means tests are being written to hit a number, not to verify behavior. Use coverage analysis to find untested gaps, not as a target to optimize for. Confidence in the code, not a percentage, is the real metric.
|
|
37
186
|
|
|
38
187
|
## Constraints
|
|
39
188
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- ALWAYS
|
|
43
|
-
- ALWAYS
|
|
44
|
-
-
|
|
45
|
-
-
|
|
189
|
+
### ALWAYS
|
|
190
|
+
|
|
191
|
+
- ALWAYS detect language and framework before writing tests
|
|
192
|
+
- ALWAYS check for existing test files and match their conventions
|
|
193
|
+
- ALWAYS build a test list before planning individual tests (Canon TDD)
|
|
194
|
+
- ALWAYS present test plan as method names ONLY before writing
|
|
195
|
+
- ALWAYS ask for explicit approval: "Do you approve this test plan?"
|
|
196
|
+
- ALWAYS use AAA pattern with section comments
|
|
197
|
+
- ALWAYS use language-idiomatic naming conventions
|
|
198
|
+
- ALWAYS isolate tests — no shared mutable state between tests
|
|
199
|
+
- ALWAYS call out anti-patterns when you spot them in existing tests
|
|
200
|
+
- ALWAYS enforce F.I.R.S.T. — flag any test that would violate these principles
|
|
201
|
+
|
|
202
|
+
### NEVER
|
|
203
|
+
|
|
204
|
+
- NEVER write test implementations until user explicitly approves the plan
|
|
205
|
+
- NEVER create production code — only test code
|
|
206
|
+
- NEVER mock the class/module under test
|
|
207
|
+
- NEVER mock value objects or simple data structures
|
|
208
|
+
- NEVER write tests that depend on execution order
|
|
209
|
+
- NEVER use real external services (databases, APIs) in unit tests
|
|
210
|
+
- NEVER ignore existing project test conventions
|
|
211
|
+
- NEVER chase coverage percentages — coverage is a diagnostic, not a goal
|
|
212
|
+
|
|
@@ -17,44 +17,6 @@
|
|
|
17
17
|
}
|
|
18
18
|
],
|
|
19
19
|
"skills": [
|
|
20
|
-
{
|
|
21
|
-
"name": "grimoire.tdd-specialist",
|
|
22
|
-
"path": "skills/grimoire.tdd-specialist",
|
|
23
|
-
"description": "Language-agnostic TDD and unit testing specialist. Use when writing unit tests, adding test coverage, doing test-driven development, or setting up test infrastructure in ANY language. Auto-detects project language and test framework.",
|
|
24
|
-
"version": "1.0.0",
|
|
25
|
-
"triggers": {
|
|
26
|
-
"keywords": [
|
|
27
|
-
"tdd",
|
|
28
|
-
"test-driven",
|
|
29
|
-
"unittest",
|
|
30
|
-
"unit-test",
|
|
31
|
-
"pytest",
|
|
32
|
-
"jest",
|
|
33
|
-
"vitest",
|
|
34
|
-
"junit",
|
|
35
|
-
"gotest",
|
|
36
|
-
"cargo-test",
|
|
37
|
-
"mocha",
|
|
38
|
-
"rspec"
|
|
39
|
-
],
|
|
40
|
-
"file_extensions": [],
|
|
41
|
-
"patterns": [
|
|
42
|
-
"write.*test",
|
|
43
|
-
"add.*test",
|
|
44
|
-
"create.*test",
|
|
45
|
-
"test.*coverage",
|
|
46
|
-
"red.green.refactor"
|
|
47
|
-
],
|
|
48
|
-
"file_paths": [
|
|
49
|
-
"tests/**",
|
|
50
|
-
"test/**",
|
|
51
|
-
"__tests__/**",
|
|
52
|
-
"*_test.go",
|
|
53
|
-
"**/*.test.*",
|
|
54
|
-
"**/*.spec.*"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
20
|
{
|
|
59
21
|
"name": "grimoire.conventional-commit",
|
|
60
22
|
"path": "skills/grimoire.conventional-commit",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: grimoire.conventional-commit
|
|
3
|
-
description: "Generate git commits following Conventional Commits 1.0.0. Use for /conventional-commit, git commit, or when committing changes.
|
|
4
|
-
|
|
3
|
+
description: "Generate git commits following Conventional Commits 1.0.0. Use for /conventional-commit, git commit, or when committing changes."
|
|
4
|
+
user_invocable: true
|
|
5
5
|
disable-model-invocation: false
|
|
6
|
-
version: 1.1.0
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
# Git Commit Generator
|
|
@@ -13,13 +12,38 @@ Generate git commit messages following the [Conventional Commits 1.0.0](https://
|
|
|
13
12
|
## Commit Message Format
|
|
14
13
|
|
|
15
14
|
```plain
|
|
16
|
-
<type>[optional scope]: <
|
|
15
|
+
<type>[optional scope]: <subject>
|
|
17
16
|
|
|
18
|
-
[optional
|
|
17
|
+
[optional description paragraph]
|
|
18
|
+
|
|
19
|
+
[optional bullet points]
|
|
19
20
|
|
|
20
21
|
[optional footer(s)]
|
|
21
22
|
```
|
|
22
23
|
|
|
24
|
+
### Subject (mandatory)
|
|
25
|
+
|
|
26
|
+
One sentence. Imperative mood, lowercase, no period, ≤72 chars.
|
|
27
|
+
|
|
28
|
+
**Primary goal: answer "what problem does this change solve?"**
|
|
29
|
+
|
|
30
|
+
Lead with the symptom or outcome — not the technical mechanism:
|
|
31
|
+
|
|
32
|
+
- Prefer: `fix(auth): users locked out after password reset`
|
|
33
|
+
- Avoid: `fix(auth): fix token expiry logic in resetPassword`
|
|
34
|
+
|
|
35
|
+
When no problem framing fits (greenfield feature, pure refactor) — describe the value added instead. Don't force it.
|
|
36
|
+
|
|
37
|
+
### Description paragraph (optional)
|
|
38
|
+
|
|
39
|
+
Up to 3 sentences, plain prose. Answers **"what value does this add?"**
|
|
40
|
+
|
|
41
|
+
Include only when there's a clear, non-obvious answer. Omit otherwise. Does not restate the subject.
|
|
42
|
+
|
|
43
|
+
### Bullet points (optional)
|
|
44
|
+
|
|
45
|
+
Technical details and implementation notes — explain **why** each change was made (the reasoning behind the decision, not the mechanism). Use when the change is non-trivial and benefits from a breakdown. One point per logical change, lowercase, concise.
|
|
46
|
+
|
|
23
47
|
## Types
|
|
24
48
|
|
|
25
49
|
| Type | Description |
|
|
@@ -35,18 +59,11 @@ Generate git commit messages following the [Conventional Commits 1.0.0](https://
|
|
|
35
59
|
| `ci` | CI configuration files and scripts |
|
|
36
60
|
| `chore` | Other changes that don't modify src or test files |
|
|
37
61
|
|
|
38
|
-
## Scope
|
|
39
|
-
|
|
40
|
-
- Use lowercase kebab-case: `auth`, `csv-import`, `api`
|
|
41
|
-
- Scope = the module, component, or file area affected
|
|
42
|
-
- Omit scope when the change is truly global
|
|
43
|
-
|
|
44
62
|
## Breaking Changes
|
|
45
63
|
|
|
46
|
-
For breaking changes,
|
|
64
|
+
For breaking changes, either:
|
|
47
65
|
|
|
48
|
-
-
|
|
49
|
-
- Add `BREAKING CHANGE: <description>` footer in body
|
|
66
|
+
- Add `BREAKING CHANGE:` footer in body
|
|
50
67
|
|
|
51
68
|
Breaking changes correlate with MAJOR in SemVer.
|
|
52
69
|
|
|
@@ -61,34 +78,28 @@ When user invokes /commit:
|
|
|
61
78
|
git diff --cached
|
|
62
79
|
```
|
|
63
80
|
|
|
64
|
-
2. **
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
git log --oneline -10
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
3. **Analyze changes** and determine:
|
|
81
|
+
2. **Analyze changes** and determine:
|
|
71
82
|
- Filter out trivial changes (see below)
|
|
83
|
+
- Ask: **"what problem does this solve?"** — use that as the subject
|
|
72
84
|
- Primary type (feat, fix, docs, etc.)
|
|
73
85
|
- Scope if applicable (component, module, or file area)
|
|
74
|
-
-
|
|
75
|
-
- Whether body is needed for complex changes
|
|
86
|
+
- Whether description paragraph or bullet points add value
|
|
76
87
|
|
|
77
|
-
|
|
88
|
+
3. **Generate commit** using HEREDOC for proper formatting:
|
|
78
89
|
|
|
79
90
|
```bash
|
|
80
91
|
git commit -m "$(cat <<'EOF'
|
|
81
|
-
type(scope):
|
|
92
|
+
type(scope): subject
|
|
82
93
|
|
|
83
|
-
Optional
|
|
94
|
+
Optional description paragraph.
|
|
84
95
|
|
|
85
|
-
- bullet
|
|
86
|
-
-
|
|
96
|
+
- optional bullet
|
|
97
|
+
- optional bullet
|
|
87
98
|
EOF
|
|
88
99
|
)"
|
|
89
100
|
```
|
|
90
101
|
|
|
91
|
-
|
|
102
|
+
4. **Verify** the commit was created:
|
|
92
103
|
|
|
93
104
|
```bash
|
|
94
105
|
git log -1
|
|
@@ -107,71 +118,64 @@ Only document changes with semantic meaning or technical impact. For pure format
|
|
|
107
118
|
|
|
108
119
|
## Rules
|
|
109
120
|
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
- No period at end of
|
|
113
|
-
- Keep
|
|
121
|
+
- Subject answers "what problem does this solve?" when possible
|
|
122
|
+
- Subject must be lowercase, imperative mood ("add feature" not "added feature")
|
|
123
|
+
- No period at end of subject
|
|
124
|
+
- Keep subject under 72 characters
|
|
114
125
|
- Scope is optional but recommended for larger codebases
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
- Be concise—avoid redundant or verbose language
|
|
126
|
+
- Description paragraph: only include when there's a clear, non-obvious answer to "what value does this add?"
|
|
127
|
+
- Bullet points: technical details / implementation notes that explain why each change was made, one point per logical change
|
|
128
|
+
- Be concise — avoid redundant or verbose language
|
|
119
129
|
- **Never** use `--no-verify` unless explicitly requested
|
|
120
|
-
- **Never** amend commits that have been pushed to remote
|
|
130
|
+
- **Never** amend commits that have been pushed to remote
|
|
121
131
|
- **Never** include Co-Authored-By footers in commit messages
|
|
122
132
|
|
|
123
133
|
## Examples
|
|
124
134
|
|
|
125
|
-
**
|
|
135
|
+
**Subject only (simple change):**
|
|
126
136
|
|
|
127
137
|
```plain
|
|
128
|
-
|
|
138
|
+
docs: missing setup step in README
|
|
129
139
|
```
|
|
130
140
|
|
|
131
|
-
**
|
|
141
|
+
**Fix — problem-framed subject + full 3-part body:**
|
|
132
142
|
|
|
133
143
|
```plain
|
|
134
|
-
|
|
144
|
+
fix(auth): users locked out after password reset
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
Reset tokens were invalidated immediately on generation,
|
|
147
|
+
so the confirmation email always arrived with an expired link.
|
|
138
148
|
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
- returns enriched rows as streamed JSON
|
|
149
|
+
- token expiry moved to first use — creation-time expiry killed links before delivery
|
|
150
|
+
- integration test added because unit mocks couldn't reproduce the timing window
|
|
142
151
|
```
|
|
143
152
|
|
|
144
|
-
**
|
|
153
|
+
**Feature with scope:**
|
|
145
154
|
|
|
146
155
|
```plain
|
|
147
|
-
|
|
156
|
+
feat(api): no way to query enrichment results by date range
|
|
148
157
|
|
|
149
|
-
-
|
|
150
|
-
-
|
|
158
|
+
- date filtering was the top support request from enterprise customers
|
|
159
|
+
- ISO 8601 chosen for consistency with existing timestamp fields
|
|
151
160
|
```
|
|
152
161
|
|
|
153
|
-
**
|
|
162
|
+
**Subject + description (no bullets needed):**
|
|
154
163
|
|
|
155
164
|
```plain
|
|
156
|
-
|
|
165
|
+
fix(validation): form submission silently drops rows with empty dates
|
|
157
166
|
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
Previously empty dates caused a NullReferenceException that was swallowed.
|
|
168
|
+
Now validates and rejects rows with empty required fields with a clear error.
|
|
160
169
|
```
|
|
161
170
|
|
|
162
|
-
**
|
|
171
|
+
**Breaking change:**
|
|
163
172
|
|
|
164
173
|
```plain
|
|
165
|
-
|
|
174
|
+
feat(api)!: clients can't distinguish enrichment errors from empty results
|
|
175
|
+
|
|
176
|
+
BREAKING CHANGE: Response now returns JSON wrapper with metadata
|
|
177
|
+
instead of raw CSV. Clients must update parsing logic.
|
|
166
178
|
```
|
|
167
179
|
|
|
168
180
|
**Multiple changes (pick primary):**
|
|
169
181
|
When changes span multiple types, use the most significant one and mention others in body.
|
|
170
|
-
|
|
171
|
-
```plain
|
|
172
|
-
refactor(auth): simplify token refresh logic
|
|
173
|
-
|
|
174
|
-
- extract refresh logic into dedicated service
|
|
175
|
-
- remove redundant token cache layer
|
|
176
|
-
- update tests for new service boundary
|
|
177
|
-
```
|