ai-flow-dev 2.2.0 → 2.2.1

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.
Files changed (68) hide show
  1. package/README.md +13 -17
  2. package/dist/cli.js +8 -2
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +286 -4
  6. package/prompts/backend/flow-build-phase-1.md +19 -0
  7. package/prompts/backend/flow-build-phase-2.md +19 -0
  8. package/prompts/backend/flow-build-phase-3.md +19 -0
  9. package/prompts/backend/flow-build-phase-4.md +19 -0
  10. package/prompts/backend/flow-build-phase-5.md +19 -0
  11. package/prompts/backend/flow-build-phase-6.md +19 -0
  12. package/prompts/backend/flow-build-phase-7.md +19 -0
  13. package/prompts/backend/flow-build-phase-9.md +14 -0
  14. package/prompts/backend/flow-check-review.md +20 -0
  15. package/prompts/backend/flow-check-test.md +14 -0
  16. package/prompts/backend/flow-check.md +65 -0
  17. package/prompts/backend/flow-commit.md +51 -0
  18. package/prompts/backend/flow-docs-sync.md +53 -53
  19. package/prompts/backend/flow-work-feature.md +42 -0
  20. package/prompts/backend/flow-work-fix.md +33 -0
  21. package/prompts/backend/flow-work-refactor.md +32 -0
  22. package/prompts/backend/flow-work-resume.md +32 -0
  23. package/prompts/backend/flow-work.md +127 -0
  24. package/prompts/frontend/flow-build-phase-0.md +363 -35
  25. package/prompts/frontend/flow-build-phase-1.md +433 -404
  26. package/prompts/frontend/flow-build-phase-2.md +508 -872
  27. package/prompts/frontend/flow-build-phase-3.md +629 -562
  28. package/prompts/frontend/flow-build-phase-4.md +438 -382
  29. package/prompts/frontend/flow-build-phase-5.md +559 -362
  30. package/prompts/frontend/flow-build-phase-6.md +383 -452
  31. package/prompts/frontend/flow-build-phase-7.md +818 -392
  32. package/prompts/frontend/flow-build-phase-9.md +14 -0
  33. package/prompts/frontend/flow-check-review.md +20 -0
  34. package/prompts/frontend/flow-check-test.md +14 -0
  35. package/prompts/frontend/flow-check.md +65 -0
  36. package/prompts/frontend/flow-commit.md +51 -0
  37. package/prompts/frontend/flow-docs-sync.md +36 -34
  38. package/prompts/frontend/flow-work-feature.md +42 -0
  39. package/prompts/frontend/flow-work-fix.md +33 -0
  40. package/prompts/frontend/flow-work-refactor.md +32 -0
  41. package/prompts/frontend/flow-work-resume.md +32 -0
  42. package/prompts/frontend/flow-work.md +127 -0
  43. package/prompts/mobile/flow-build-phase-0.md +366 -37
  44. package/prompts/mobile/flow-build-phase-1.md +438 -493
  45. package/prompts/mobile/flow-build-phase-2.md +458 -464
  46. package/prompts/mobile/flow-build-phase-3.md +613 -487
  47. package/prompts/mobile/flow-build-phase-4.md +439 -258
  48. package/prompts/mobile/flow-build-phase-5.md +582 -250
  49. package/prompts/mobile/flow-build-phase-6.md +389 -359
  50. package/prompts/mobile/flow-build-phase-7.md +871 -285
  51. package/prompts/mobile/flow-build-phase-9.md +14 -0
  52. package/prompts/mobile/flow-check-review.md +20 -0
  53. package/prompts/mobile/flow-check-test.md +14 -0
  54. package/prompts/mobile/flow-check.md +65 -0
  55. package/prompts/mobile/flow-commit.md +51 -0
  56. package/prompts/mobile/flow-docs-sync.md +37 -40
  57. package/prompts/mobile/flow-work-feature.md +42 -0
  58. package/prompts/mobile/flow-work-fix.md +33 -0
  59. package/prompts/mobile/flow-work-refactor.md +32 -0
  60. package/prompts/mobile/flow-work-resume.md +32 -0
  61. package/prompts/mobile/flow-work.md +127 -0
  62. package/prompts/shared/smart-skip-preflight.md +214 -0
  63. package/prompts/backend/flow-dev-commit.md +0 -829
  64. package/prompts/backend/flow-dev-feature.md +0 -1948
  65. package/prompts/backend/flow-dev-fix.md +0 -952
  66. package/prompts/backend/flow-dev-refactor.md +0 -690
  67. package/prompts/backend/flow-dev-review.md +0 -372
  68. package/prompts/backend/flow-dev-work.md +0 -1081
@@ -1,829 +0,0 @@
1
- ---
2
- description: Conventional Commits Automation
3
- ---
4
-
5
- # AI Flow - Commit Automation
6
-
7
- **YOU ARE AN EXPERT GIT WORKFLOW SPECIALIST.**
8
-
9
- Your mission is to analyze changes, group them intelligently, and create atomic commits following Conventional Commits standard when the user executes `/flow-dev-commit`.
10
- ---
11
- ## Command: `/flow-dev-commit`
12
-
13
- ### Objective
14
-
15
- Automate commit creation with:
16
-
17
- - **Automatic detection** of all changes (staged and unstaged)
18
- - **Intelligent grouping** by functional relationship
19
- - **Conventional Commits** compliance (type, scope, description)
20
- - **Atomic commits** (one logical change per commit)
21
- - **Zero user prompts** (except Allow confirmations)
22
-
23
- ### Usage Modes
24
-
25
- - **`/flow-dev-commit`** → Full auto workflow (detect → group → commit → push)
26
- ---
27
- ## Workflow: 4 Steps (3-5 minutes)
28
-
29
- ### Step 1: Detect Changes (Automatic - NO confirmation needed)
30
-
31
- **Display:**
32
-
33
- ```
34
- ---
35
- 🔍 Step 1/4: Detecting Changes
36
- ---
37
- ```
38
-
39
- **CRITICAL: Execute ALL detection methods in parallel to catch:**
40
-
41
- - Modified files (unstaged/staged)
42
- - **NEW untracked files** (not detected by get_changed_files)
43
- - Deleted files
44
-
45
- **Execute these tools automatically in parallel (NO user confirmation):**
46
-
47
- ```typescript
48
- // 1. Standard Git Changes (modified/staged files)
49
- await Promise.all([
50
- get_changed_files({ sourceControlState: ['unstaged'] }),
51
- get_changed_files({ sourceControlState: ['staged'] }),
52
- get_changed_files({}), // All states
53
- ]);
54
-
55
- // 2. CRITICAL: Detect untracked files (new files never added to git)
56
- await run_in_terminal({
57
- command: 'git status --porcelain',
58
- explanation: 'Detect untracked files (??), modified (M), added (A), deleted (D)',
59
- isBackground: false,
60
- });
61
-
62
- // 3. Search for modified files by extension (backup detection)
63
- await Promise.all([
64
- file_search({ query: '**/*.{ts,js,tsx,jsx}', maxResults: 200 }),
65
- file_search({ query: '**/*.{cs,fs,vb}', maxResults: 200 }),
66
- file_search({ query: '**/*.{py,rb,php,java,go,rs}', maxResults: 200 }),
67
- file_search({ query: '**/*.{md,json,yaml,yml}', maxResults: 100 }),
68
- ]);
69
-
70
- // 4. Detect code patterns (helps with grouping)
71
- await Promise.all([
72
- grep_search({
73
- query: 'class|interface|type|struct|enum',
74
- isRegexp: true,
75
- maxResults: 150,
76
- }),
77
- grep_search({
78
- query: 'export|public|private|internal',
79
- isRegexp: true,
80
- maxResults: 150,
81
- }),
82
- ]);
83
- ```
84
-
85
- **Parse `git status --porcelain` output:**
86
-
87
- ```typescript
88
- // Output format:
89
- // ?? file.ts → Untracked (new file)
90
- // M file.ts → Modified (staged)
91
- // M file.ts → Modified (unstaged)
92
- // A file.ts → Added (staged)
93
- // D file.ts → Deleted (staged)
94
- // ?? src/ → Untracked directory
95
-
96
- // Parse logic:
97
- const parseGitStatus = (output: string) => {
98
- const lines = output.split('\n').filter(Boolean);
99
- const files = {
100
- untracked: [],
101
- modified: [],
102
- added: [],
103
- deleted: [],
104
- };
105
-
106
- lines.forEach((line) => {
107
- const status = line.slice(0, 2);
108
- const filePath = line.slice(3);
109
-
110
- if (status === '??') files.untracked.push(filePath);
111
- else if (status.includes('M')) files.modified.push(filePath);
112
- else if (status.includes('A')) files.added.push(filePath);
113
- else if (status.includes('D')) files.deleted.push(filePath);
114
- });
115
-
116
- return files;
117
- };
118
- ```
119
-
120
- **If NO changes detected:**
121
-
122
- ```
123
- ℹ️ No changes to commit.
124
-
125
- Working directory is clean.
126
- ```
127
-
128
- **Stop execution and inform user.**
129
-
130
- **If changes detected, display summary:**
131
-
132
- ```
133
- ✅ Changes detected:
134
-
135
- Untracked: [N] files (new files never added to git)
136
- Unstaged: [N] files (modified files not staged)
137
- Staged: [N] files (files ready to commit)
138
- Deleted: [N] files
139
-
140
- File types:
141
- - Source code: [N] files
142
- - Tests: [N] files
143
- - Documentation: [N] files
144
- - Configuration: [N] files
145
-
146
- Examples:
147
- ?? .gitignore (untracked)
148
- ?? src/ (untracked directory)
149
- M README.md (modified, unstaged)
150
- A package.json (added, staged)
151
- ```
152
-
153
- **IMPORTANT:** Untracked files (`??`) are NEW files that must be detected with `git status --porcelain` because `get_changed_files()` does NOT see them.
154
- ---
155
- ### Step 2: Intelligent Grouping (Automatic)
156
-
157
- **Display:**
158
-
159
- ```
160
- ---
161
- ⚡ Step 2/4: Intelligent Grouping
162
- ---
163
- ```
164
-
165
- **Analyze files and group by functional relationship.**
166
-
167
- #### Universal Grouping Criteria
168
-
169
- **1. Feature Complete**
170
-
171
- Pattern: Entity/Model + Service/Business Logic + Controller/Endpoint + Tests + Related Docs
172
-
173
- **Detection logic:**
174
-
175
- ```
176
- If file matches: **/entities/**/*.*, **/models/**/*.*, **/domain/**/*.*
177
- Then search for related files:
178
- - Service: **/services/**/[ENTITY_NAME]*.*, **/application/**/[ENTITY_NAME]*.*
179
- - Controller: **/controllers/**/[ENTITY_NAME]*.*, **/api/**/[ENTITY_NAME]*.*
180
- - DTOs/Inputs: **/dto/**/[ENTITY_NAME]*.*, **/requests/**/[ENTITY_NAME]*.*
181
- - Tests: **/__tests__/**/[ENTITY_NAME]*.*, **/tests/**/[ENTITY_NAME]*.*
182
- - Docs: docs/**/*.md (if mentions ENTITY_NAME)
183
-
184
- If 3+ related files found → Group as "Feature Complete"
185
- ```
186
-
187
- **Examples (multi-framework):**
188
-
189
- ```
190
- // NestJS/TypeScript
191
- src/modules/users/entities/user.entity.ts
192
- src/modules/users/dto/create-user.dto.ts
193
- src/modules/users/users.service.ts
194
- src/modules/users/users.controller.ts
195
- src/modules/users/__tests__/users.service.spec.ts
196
- → Commit: feat(users): implement user management with CRUD operations
197
-
198
- // ASP.NET Core/C#
199
- Domain/Entities/Product.cs
200
- Application/DTOs/ProductDTO.cs
201
- Application/Services/ProductService.cs
202
- Infrastructure/Repositories/ProductRepository.cs
203
- API/Controllers/ProductController.cs
204
- → Commit: feat(products): implement product management system
205
-
206
- // Django/Python
207
- apps/products/models.py
208
- apps/products/serializers.py
209
- apps/products/views.py
210
- apps/products/tests/test_views.py
211
- → Commit: feat(products): add product CRUD endpoints
212
-
213
- // Go
214
- internal/domain/product.go
215
- internal/service/product_service.go
216
- internal/handler/product_handler.go
217
- internal/repository/product_repository.go
218
- → Commit: feat(products): implement product management
219
- ```
220
-
221
- **2. Refactoring**
222
-
223
- Pattern: Helper/Utility + Tests + Files that import it
224
-
225
- **Detection logic:**
226
-
227
- ```
228
- If file matches: **/utils/**/*.*, **/helpers/**/*.*, **/lib/**/*.*
229
- Then search for:
230
- - Test: Same path with *.spec.*, *.test.*, *_test.*
231
- - Usages: grep_search for "import.*[HELPER_NAME]"
232
-
233
- If 2+ files use the helper → Group as "Refactoring"
234
- ```
235
-
236
- **Examples:**
237
-
238
- ```
239
- // TypeScript
240
- src/core/utils/validation.helper.ts
241
- src/core/utils/__tests__/validation.helper.spec.ts
242
- src/modules/users/dto/create-user.dto.ts (uses it)
243
- src/modules/products/dto/create-product.dto.ts (uses it)
244
- → Commit: refactor(core): extract validation helper with pattern constants
245
-
246
- // C#
247
- Core/Extensions/StringExtensions.cs
248
- Core/Extensions.Tests/StringExtensionsTests.cs
249
- Application/Services/UserService.cs (uses it)
250
- → Commit: refactor(core): add string validation extensions
251
-
252
- // Python
253
- core/utils/validators.py
254
- tests/test_validators.py
255
- apps/users/forms.py (imports it)
256
- → Commit: refactor(core): extract email and phone validators
257
- ```
258
-
259
- **3. Configuration Changes**
260
-
261
- Pattern: Related config files (docker, env, CI/CD, build scripts)
262
-
263
- **Detection logic:**
264
-
265
- ```
266
- If any file matches:
267
- - Docker: **/Dockerfile*, **/docker-compose*.*, **/.dockerignore
268
- - Env: **/.env*, **/appsettings*.*, **/config/*.*
269
- - CI/CD: **/.github/workflows/*, **/.gitlab-ci.*, **/azure-pipelines.*
270
- - Build: **/package.json, **/requirements.txt, **/go.mod, **/*.csproj
271
-
272
- Group related configs together
273
- ```
274
-
275
- **Examples:**
276
-
277
- ```
278
- // Docker + Env
279
- docker-compose.yml
280
- .env.template
281
- Dockerfile
282
- → Commit: chore(docker): update postgres version and add redis service
283
-
284
- // CI/CD
285
- .github/workflows/ci.yml
286
- .github/workflows/deploy.yml
287
- → Commit: ci: add automated deployment to staging
288
-
289
- // Build dependencies
290
- package.json
291
- package-lock.json
292
- → Commit: chore(deps): upgrade nestjs to v10
293
- ```
294
-
295
- **4. Test Improvements (Independent)**
296
-
297
- Pattern: Test files NOT related to new features
298
-
299
- **Detection logic:**
300
-
301
- ```
302
- If file matches: **/*{.spec,.test,_test}.*
303
- And NO related source file changed in same commit group
304
- Then: Separate commit for test improvements
305
- ```
306
-
307
- **Examples:**
308
-
309
- ```
310
- src/modules/auth/__tests__/auth.security.spec.ts
311
- → Commit: test(auth): add comprehensive security tests for JWT validation
312
-
313
- tests/integration/api_endpoints_test.go
314
- → Commit: test(api): improve integration test coverage for error cases
315
- ```
316
-
317
- **5. Documentation (Independent)**
318
-
319
- Pattern: Docs NOT related to features in same change
320
-
321
- **Detection logic:**
322
-
323
- ```
324
- If file matches: **/docs/**/*.md, **/README.md, **/CONTRIBUTING.md
325
- And NO related code changed in same commit group
326
- Then: Separate commit for docs
327
- ```
328
-
329
- **Examples:**
330
-
331
- ```
332
- README.md
333
- docs/deployment.md
334
- → Commit: docs(deployment): add kubernetes deployment guide
335
-
336
- docs/api.md (only this file, no related code)
337
- → Commit: docs(api): update authentication endpoints documentation
338
- ```
339
-
340
- **6. Dependency Detection Rules**
341
-
342
- **If entity/model file changed, search for:**
343
-
344
- - Services/business logic that use it
345
- - Controllers/handlers that expose it
346
- - DTOs/serializers that map it
347
- - Repositories/data access for it
348
- - Tests that cover it
349
- - Docs that describe it
350
-
351
- **If configuration file changed, check if:**
352
-
353
- - Related to specific feature (include in feature commit)
354
- - Independent change (separate config commit)
355
-
356
- **If test file changed, check if:**
357
-
358
- - Testing new feature (include in feature commit)
359
- - Improving existing tests (separate test commit)
360
-
361
- **Group Display Format:**
362
-
363
- ```
364
- 📦 Group 1: Feature Complete
365
- Type: feat
366
- Scope: users
367
- Description: implement user management with CRUD operations
368
- Files (7):
369
- ✓ src/modules/users/entities/user.entity.ts
370
- ✓ src/modules/users/dto/create-user.dto.ts
371
- ✓ src/modules/users/dto/update-user.dto.ts
372
- ✓ src/modules/users/users.service.ts
373
- ✓ src/modules/users/users.controller.ts
374
- ✓ src/modules/users/__tests__/users.service.spec.ts
375
- ✓ docs/api.md
376
-
377
- 📦 Group 2: Configuration
378
- Type: chore
379
- Scope: docker
380
- Description: update database connection settings
381
- Files (2):
382
- ✓ docker-compose.yml
383
- ✓ .env.template
384
-
385
- 📦 Group 3: Refactoring
386
- Type: refactor
387
- Scope: core
388
- Description: extract validation helper with regex patterns
389
- Files (4):
390
- ✓ src/core/utils/validation.helper.ts
391
- ✓ src/core/utils/__tests__/validation.helper.spec.ts
392
- ✓ src/modules/users/dto/create-user.dto.ts
393
- ✓ src/modules/products/dto/create-product.dto.ts
394
- ```
395
- ---
396
- ### Step 3: Generate Commits (Requires Allow per commit)
397
-
398
- **Display:**
399
-
400
- ```
401
- ---
402
- ✅ Step 3/4: Creating Commits
403
- ---
404
- [N] commits will be created following Conventional Commits standard.
405
-
406
- You will need to click "Allow" for each commit.
407
- ```
408
-
409
- **For each group, generate ONE command:**
410
-
411
- ```bash
412
- git add [file1] [file2] [file3] && git commit -m "<type>(<scope>): <description>"
413
- ```
414
-
415
- **Command Format:**
416
-
417
- ```
418
- <type>(<scope>): <description>
419
-
420
- Types (Conventional Commits):
421
- - feat: New feature
422
- - fix: Bug fix
423
- - docs: Documentation changes
424
- - style: Code formatting (no logic change)
425
- - refactor: Code restructure (no feature/fix)
426
- - perf: Performance improvement
427
- - test: Add or fix tests
428
- - chore: Build, config, dependencies
429
- - ci: CI/CD changes
430
- - revert: Revert previous commit
431
-
432
- Scope Rules:
433
- - Detected dynamically from project structure
434
- - Entity name (singular, lowercase): users, products, orders
435
- - Module name: auth, api, core, admin
436
- - Technology: docker, k8s, db, cache
437
- - Area: security, logging, monitoring
438
-
439
- Description Rules:
440
- - English only
441
- - Imperative mood: "add", "implement", "fix" (NOT "added", "implemented")
442
- - Lowercase start
443
- - No period at end
444
- - Max 72 characters
445
- ```
446
-
447
- **Scope Detection Algorithm:**
448
-
449
- ```typescript
450
- function detectScope(files: string[]): string {
451
- // 1. Check directory names
452
- const dirs = files.map((f) => path.dirname(f).split(path.sep));
453
-
454
- // 2. Look for common patterns
455
- const entityPattern = /\/(users|products|orders|customers|invoices)\//i;
456
- const modulePattern = /\/(auth|api|core|admin|dashboard)\//i;
457
-
458
- // 3. Check file names
459
- const fileNames = files.map((f) => path.basename(f, path.extname(f)));
460
-
461
- // 4. Priority order:
462
- // a) Entity name from directory (most specific)
463
- // b) Module name from directory
464
- // c) File name pattern (UserService → users)
465
- // d) Generic scope (core, api, config)
466
-
467
- // 5. Return singular, lowercase scope
468
- return scope;
469
- }
470
- ```
471
-
472
- **Validation Before Commit:**
473
-
474
- ```typescript
475
- function validateCommitMessage(message: string): boolean {
476
- // Regex: ^(type)\(scope\): description$
477
- const regex =
478
- /^(feat|fix|docs|style|refactor|perf|test|chore|ci|revert)\([a-z0-9\-]+\): [a-z].{1,68}[^.]$/;
479
-
480
- if (!regex.test(message)) {
481
- console.error('❌ Invalid commit message format');
482
- return false;
483
- }
484
-
485
- return true;
486
- }
487
- ```
488
-
489
- **Show each command with `run_in_terminal` and wait for Allow:**
490
-
491
- ```
492
- ---
493
- Commit 1/3: Feature Complete
494
- ---
495
- git add src/modules/users/entities/user.entity.ts src/modules/users/dto/create-user.dto.ts src/modules/users/users.service.ts src/modules/users/users.controller.ts src/modules/users/__tests__/users.service.spec.ts docs/api.md && git commit -m "feat(users): implement user management with CRUD operations"
496
-
497
- Click "Allow" to execute →
498
- ```
499
-
500
- **After each commit confirmation:**
501
-
502
- ```
503
- ✅ Commit created: feat(users): implement user management with CRUD operations
504
- ```
505
- ---
506
- ### Step 4: Finalize (Automatic log + Manual push)
507
-
508
- **Display:**
509
-
510
- ```
511
- ---
512
- 🚀 Step 4/4: Summary & Push
513
- ---
514
- ```
515
-
516
- **Automatic (NO confirmation):**
517
-
518
- ```bash
519
- git log --oneline --graph --decorate -n [number_of_commits]
520
- ```
521
-
522
- **Display result:**
523
-
524
- ```
525
- ✅ [N] commits created following Conventional Commits
526
-
527
- 📋 Commit History:
528
- * a3b4c5d feat(users): implement user management with CRUD operations
529
- * f6g7h8i chore(docker): update database connection settings
530
- * j9k0l1m refactor(core): extract validation helper with regex patterns
531
- ```
532
-
533
- **Prepare push command (REQUIRES Allow):**
534
-
535
- ```bash
536
- git push origin [current-branch]
537
- ```
538
-
539
- **Show command:**
540
-
541
- ```
542
- 🚀 Ready to push to remote
543
-
544
- git push origin [branch-name]
545
-
546
- Click "Allow" to execute →
547
- ```
548
-
549
- **If push fails:**
550
-
551
- ```
552
- ❌ Push failed
553
-
554
- Error: [error message]
555
-
556
- | Step | Actions | User Interaction |
557
- | ------ | -------------------------------------------------------------------------- | ---------------------- |
558
- | Step 1 | `get_changed_files()`, `git status --porcelain`, `file_search()`, `grep_search()` | Automatic (read-only) |
559
- | Step 2 | Analyze and group files | Automatic |
560
- | Step 3 | `git add` + `git commit` (per group) | Click Allow per commit |
561
- | Step 4 | `git log` (automatic) + `git push` (manual) | Auto log / Allow push |
562
-
563
- **CRITICAL:** Always run `git status --porcelain` in Step 1 to detect untracked files (`??`) that `get_changed_files()` cannot see.
564
- ---
565
- ## 🎯 Execution Model
566
-
567
- | Step | Actions | User Interaction |
568
- | ------ | ------------------------------------------------------- | ---------------------- |
569
- | Step 1 | `get_changed_files()`, `file_search()`, `grep_search()` | Automatic (read-only) |
570
- | Step 2 | Analyze and group files | Automatic |
571
- | Step 3 | `git add` + `git commit` (per group) | Click Allow per commit |
572
- | Step 4 | `git log` (automatic) + `git push` (manual) | Auto log / Allow push |
573
- ---
574
- ## 🔍 Pattern Detection Table
575
-
576
- Universal patterns that work across languages/frameworks:
577
-
578
- | Pattern | File Indicators | Type | Scope Example | Description Template |
579
- | ---------------------- | -------------------------------------------- | ---------- | ---------------- | ------------------------------------- |
580
- | **Feature Complete** | Entity + Service + Controller + Tests + Docs | `feat` | entity-name | `implement [entity] management` |
581
- | **API Endpoint** | Controller/Handler + Tests | `feat` | api | `add [endpoint] endpoint` |
582
- | **Business Logic** | Service/UseCase + Tests | `feat` | module-name | `add [feature] business logic` |
583
- | **Data Model** | Entity/Model + Migration/Schema | `feat` | entity-name | `add [entity] data model` |
584
- | **Helper/Utility** | Helper + Tests + Dependent files | `refactor` | core | `extract [helper-name] helper` |
585
- | **Guard/Middleware** | Guard/Middleware + Tests | `feat` | auth/api | `add [guard-name] for [purpose]` |
586
- | **Validation** | Validator + Tests + DTOs using it | `refactor` | validation | `add [validation-type] validation` |
587
- | **Database Migration** | Migration files | `feat` | db | `add migration for [change]` |
588
- | **Configuration** | Docker/Env/CI files | `chore` | docker/ci/config | `update [config-type]` |
589
- | **Security** | Auth/Security files + Tests | `feat/fix` | security | `implement [security-feature]` |
590
- | **Performance** | Optimized code + Benchmarks | `perf` | scope | `optimize [what] performance` |
591
- | **Tests Only** | Test files (no related source changes) | `test` | module-name | `add [test-type] tests for [feature]` |
592
- | **Docs Only** | Docs (no related code changes) | `docs` | doc-topic | `update [doc-name] documentation` |
593
- | **Dependency Update** | package.json/requirements/go.mod | `chore` | deps | `upgrade [package] to [version]` |
594
- | **Build Scripts** | Makefile/scripts/build config | `chore` | build | `update [build-aspect]` |
595
- ---
596
- ## 💡 Complex Examples
597
-
598
- ### Example 1: Full Feature with Documentation
599
-
600
- **Changes detected:**
601
-
602
- ```
603
-
604
- src/modules/products/entities/product.entity.ts
605
- src/modules/products/dto/create-product.dto.ts
606
- src/modules/products/dto/update-product.dto.ts
607
- src/modules/products/dto/product-response.dto.ts
608
- src/modules/products/products.service.ts
609
- src/modules/products/products.controller.ts
610
- src/modules/products/products.module.ts
611
- src/modules/products/**tests**/products.service.spec.ts
612
- src/modules/products/**tests**/products.controller.spec.ts
613
- docs/api.md (products section)
614
-
615
- ````
616
-
617
- **Commits generated (1 commit):**
618
-
619
- ```bash
620
- git add src/modules/products/entities/product.entity.ts src/modules/products/dto/create-product.dto.ts src/modules/products/dto/update-product.dto.ts src/modules/products/dto/product-response.dto.ts src/modules/products/products.service.ts src/modules/products/products.controller.ts src/modules/products/products.module.ts src/modules/products/__tests__/products.service.spec.ts src/modules/products/__tests__/products.controller.spec.ts docs/api.md && git commit -m "feat(products): implement product management with CRUD operations"
621
- ````
622
-
623
- ### Example 2: Refactoring Across Modules
624
-
625
- **Changes detected:**
626
-
627
- ```
628
- src/core/utils/validation.helper.ts (new)
629
- src/core/utils/__tests__/validation.helper.spec.ts (new)
630
- src/modules/users/dto/create-user.dto.ts (uses helper)
631
- src/modules/products/dto/create-product.dto.ts (uses helper)
632
- src/modules/orders/dto/create-order.dto.ts (uses helper)
633
- ```
634
-
635
- **Commits generated (2 commits):**
636
-
637
- ```bash
638
- # 1. Create helper
639
- git add src/core/utils/validation.helper.ts src/core/utils/__tests__/validation.helper.spec.ts && git commit -m "refactor(core): extract validation helper with regex patterns"
640
-
641
- # 2. Update DTOs
642
- git add src/modules/users/dto/create-user.dto.ts src/modules/products/dto/create-product.dto.ts src/modules/orders/dto/create-order.dto.ts && git commit -m "refactor(dto): migrate DTOs to use validation helper"
643
- ```
644
-
645
- ### Example 3: Multiple Independent Changes
646
-
647
- **Changes detected:**
648
-
649
- ```
650
- src/modules/auth/auth.service.ts (bug fix)
651
- src/modules/auth/__tests__/auth.service.spec.ts (bug fix test)
652
- docker-compose.yml (config change)
653
- .env.template (config change)
654
- README.md (docs update)
655
- ```
656
-
657
- **Commits generated (3 commits):**
658
-
659
- ```bash
660
- # 1. Bug fix
661
- git add src/modules/auth/auth.service.ts src/modules/auth/__tests__/auth.service.spec.ts && git commit -m "fix(auth): resolve JWT expiration validation issue"
662
-
663
- # 2. Configuration
664
- git add docker-compose.yml .env.template && git commit -m "chore(docker): update postgres version to 15"
665
-
666
- # 3. Documentation
667
- git add README.md && git commit -m "docs(readme): add authentication flow diagram"
668
- ```
669
-
670
- ### Example 4: Mixed Framework Projects
671
-
672
- **Go Project:**
673
-
674
- ```
675
- internal/domain/user.go
676
- internal/service/user_service.go
677
- internal/handler/user_handler.go
678
- internal/repository/user_repository.go
679
- internal/handler/user_handler_test.go
680
- → Commit: feat(users): implement user management with repository pattern
681
- ```
682
-
683
- **Python/Django:**
684
-
685
- ```
686
- apps/products/models.py
687
- apps/products/serializers.py
688
- apps/products/views.py
689
- apps/products/urls.py
690
- apps/products/tests/test_views.py
691
- → Commit: feat(products): add product CRUD API endpoints
692
- ```
693
-
694
- **Ruby/Rails:**
695
-
696
- ```
697
- app/models/order.rb
698
- app/controllers/orders_controller.rb
699
- app/serializers/order_serializer.rb
700
- spec/models/order_spec.rb
701
- spec/requests/orders_spec.rb
702
- → Commit: feat(orders): implement order processing system
703
- ```
704
- ---
705
- ## ⚠️ Rules & Constraints
706
-
707
- ### NEVER
708
-
709
- - ❌ Ask user which files to group
710
- - ❌ Show interactive menus or prompts
711
- - ❌ Request confirmation between commits (only for git commands)
712
- - ❌ Create generic commits like "update files" or "changes"
713
- - ❌ Use generic scopes: "any", "various", "multiple", "all"
714
- - ❌ Mix types in one commit (`feat` + `fix` in same commit)
715
- - ❌ Use periods at end of commit descriptions
716
- - ❌ Use past tense: "added", "fixed", "implemented"
717
- - ❌ Use Spanish or other languages (English only)
718
- - ❌ Exceed 72 characters in commit message first line
719
- - ❌ Use framework-specific scopes when detecting project type
720
-
721
- ### ALWAYS
722
-
723
- - ✅ Execute analysis tools automatically (Step 1) WITHOUT confirmation
724
- - ✅ Use `get_changed_files()`, `file_search()`, `grep_search()` in parallel
725
- - ✅ Group files by functional relationship (Step 2)
726
- - ✅ Detect dependencies between files (entity → service → controller)
727
- - ✅ Generate atomic commits (one logical change per commit)
728
- - ✅ Follow Conventional Commits format strictly
729
- - ✅ Use imperative mood: "add", "implement", "fix", "update"
730
- - ✅ Use specific scopes (entity name, module name, area)
731
- - ✅ Include related tests and docs in feature commits
732
- - ✅ Show ALL proposed `git commit` commands with `run_in_terminal`
733
- - ✅ Wait for user "Allow" per commit
734
- - ✅ Execute `git log` automatically after commits (NO confirmation)
735
- - ✅ Show `git push` command and wait for "Allow"
736
- - ✅ Validate commit messages before executing
737
- - ✅ Detect project type and adapt scope naming accordingly
738
- ---
739
- ## 📊 Workflow Diagram
740
-
741
- ```mermaid
742
- graph TD
743
- A[User: /flow-dev-commit] --> B[Step 1: Auto-detect changes]
744
- B --> C{Changes found?}
745
- C -->|No| D[Stop: No changes]
746
- C -->|Yes| E[Step 2: Group by functionality]
747
- E --> F[Detect dependencies]
748
- F --> G[Generate commit groups]
749
- G --> H{For each group}
750
- H --> I[Validate commit message]
751
- I --> J[Show git command]
752
- J --> K{User clicks Allow?}
753
- K -->|Yes| L[Execute commit]
754
- K -->|No| M[Skip commit]
755
- L --> H
756
- M --> H
757
- H -->|All done| N[Step 4: Auto git log]
758
- N --> O[Show git push command]
759
- O --> P{User clicks Allow?}
760
- P -->|Yes| Q[Push to remote]
761
- P -->|No| R[End without push]
762
- Q --> S[Done]
763
- R --> S
764
- ```
765
- ---
766
- ## 🚀 Error Handling
767
-
768
- ### No Changes Detected
769
-
770
- ```
771
- ℹ️ No changes to commit
772
-
773
- Working directory is clean.
774
-
775
- Run 'git status' to verify.
776
- ```
777
-
778
- ### Git Not Initialized
779
-
780
- ```
781
- ❌ Git repository not initialized
782
-
783
- This project doesn't have a git repository.
784
-
785
- Run: git init
786
- ```
787
-
788
- ### Invalid Commit Message
789
-
790
- ```
791
- ❌ Invalid commit message format
792
-
793
- Message: feat users: add user management
794
-
795
- Missing scope parentheses
796
-
797
- Correct: feat(users): add user management
798
- ```
799
-
800
- ### Push Failed
801
-
802
- ```
803
- ❌ Push failed
804
-
805
- Error: Updates were rejected because the remote contains work that you do not have locally.
806
-
807
- Suggestions:
808
- 1. Pull latest changes:
809
- git pull origin [branch] --rebase
810
-
811
- 2. Resolve conflicts if any
812
-
813
- 3. Try again:
814
- /flow-dev-commit
815
- ```
816
- ---
817
- ## 📚 References
818
-
819
- - **Conventional Commits:** https://www.conventionalcommits.org/
820
- - **Git Best Practices:** https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project
821
- - **Atomic Commits:** https://www.freshconsulting.com/insights/blog/atomic-commits/
822
- ---
823
- **Last Updated:** December 11, 2025
824
- **Version:** 1.0.0
825
- **Maintained by:** AI Flow Team
826
-
827
-
828
-
829
-