ai-flow-dev 1.0.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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +791 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/fs-utils.d.ts +2 -0
  8. package/dist/fs-utils.d.ts.map +1 -0
  9. package/dist/fs-utils.js +46 -0
  10. package/dist/fs-utils.js.map +1 -0
  11. package/package.json +71 -0
  12. package/prompts/backend/flow-dev-feature.md +1318 -0
  13. package/prompts/backend/flow-dev-fix.md +903 -0
  14. package/prompts/backend/flow-dev-refactor.md +715 -0
  15. package/prompts/backend/flow-dev-review.md +401 -0
  16. package/prompts/backend/flow-dev-work.md +1129 -0
  17. package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
  18. package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
  19. package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
  20. package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
  21. package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
  22. package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
  23. package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
  24. package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
  25. package/prompts/backend/flow-docs-gen.md +820 -0
  26. package/prompts/backend/flow-docs-sync.md +526 -0
  27. package/prompts/backend/flow-project-init.md +248 -0
  28. package/prompts/backend/flow-project-roadmap.md +1159 -0
  29. package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
  30. package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
  31. package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
  32. package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
  33. package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
  34. package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
  35. package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
  36. package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
  37. package/prompts/frontend/flow-docs-gen.md +413 -0
  38. package/prompts/frontend/flow-docs-sync.md +561 -0
  39. package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
  40. package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
  41. package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
  42. package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
  43. package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
  44. package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
  45. package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
  46. package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
  47. package/prompts/mobile/flow-docs-gen.md +430 -0
  48. package/prompts/mobile/flow-docs-sync.md +634 -0
  49. package/templates/backend/.clauderules.template +111 -0
  50. package/templates/backend/.cursorrules.template +102 -0
  51. package/templates/backend/.env.example.template +122 -0
  52. package/templates/backend/README.template.md +200 -0
  53. package/templates/backend/ai-instructions.template.md +354 -0
  54. package/templates/backend/copilot-instructions.template.md +160 -0
  55. package/templates/backend/docs/api.template.md +251 -0
  56. package/templates/backend/docs/architecture.template.md +612 -0
  57. package/templates/backend/docs/business-flows.template.md +109 -0
  58. package/templates/backend/docs/code-standards.template.md +828 -0
  59. package/templates/backend/docs/contributing.template.md +163 -0
  60. package/templates/backend/docs/data-model.template.md +416 -0
  61. package/templates/backend/docs/operations.template.md +591 -0
  62. package/templates/backend/docs/testing.template.md +762 -0
  63. package/templates/backend/project-brief.template.md +176 -0
  64. package/templates/backend/specs/configuration.template.md +133 -0
  65. package/templates/backend/specs/security.template.md +422 -0
  66. package/templates/frontend/README.template.md +121 -0
  67. package/templates/frontend/ai-instructions.template.md +368 -0
  68. package/templates/frontend/docs/api-integration.template.md +390 -0
  69. package/templates/frontend/docs/components.template.md +567 -0
  70. package/templates/frontend/docs/error-handling.template.md +385 -0
  71. package/templates/frontend/docs/operations.template.md +123 -0
  72. package/templates/frontend/docs/performance.template.md +140 -0
  73. package/templates/frontend/docs/pwa.template.md +135 -0
  74. package/templates/frontend/docs/state-management.template.md +394 -0
  75. package/templates/frontend/docs/styling.template.md +779 -0
  76. package/templates/frontend/docs/testing.template.md +736 -0
  77. package/templates/frontend/project-brief.template.md +55 -0
  78. package/templates/frontend/specs/accessibility.template.md +111 -0
  79. package/templates/frontend/specs/configuration.template.md +520 -0
  80. package/templates/frontend/specs/security.template.md +197 -0
  81. package/templates/fullstack/README.template.md +282 -0
  82. package/templates/fullstack/ai-instructions.template.md +487 -0
  83. package/templates/fullstack/project-brief.template.md +197 -0
  84. package/templates/fullstack/specs/configuration.template.md +380 -0
  85. package/templates/mobile/AGENT.template.md +251 -0
  86. package/templates/mobile/README.template.md +195 -0
  87. package/templates/mobile/ai-instructions.template.md +221 -0
  88. package/templates/mobile/docs/app-store.template.md +163 -0
  89. package/templates/mobile/docs/architecture.template.md +100 -0
  90. package/templates/mobile/docs/native-features.template.md +137 -0
  91. package/templates/mobile/docs/navigation.template.md +81 -0
  92. package/templates/mobile/docs/offline-strategy.template.md +90 -0
  93. package/templates/mobile/docs/permissions.template.md +70 -0
  94. package/templates/mobile/docs/state-management.template.md +116 -0
  95. package/templates/mobile/docs/testing.template.md +146 -0
  96. package/templates/mobile/project-brief.template.md +97 -0
  97. package/templates/mobile/specs/build-configuration.template.md +116 -0
  98. package/templates/mobile/specs/deployment.template.md +114 -0
  99. package/templates/shared/AGENT.template.md +252 -0
@@ -0,0 +1,715 @@
1
+ # AI Flow - Quick Refactor Workflow
2
+
3
+ **YOU ARE AN EXPERT REFACTORING SPECIALIST.**
4
+
5
+ Your mission is to execute small refactorings quickly without the overhead of full spec and planning when the user executes `/refactor-quick`.
6
+
7
+ ---
8
+
9
+ ## Command: `/refactor-quick`
10
+
11
+ ### Objective
12
+
13
+ Quick refactor for small changes (3-5 minutes) without full specification process.
14
+
15
+ **Difference from `/feature refactor`:**
16
+
17
+ | Aspect | `/feature refactor` | `/refactor-quick` |
18
+ | ----------------- | ------------------- | ----------------- |
19
+ | **Time** | 15-20 min | 3-5 min |
20
+ | **Spec** | Complete | Not required |
21
+ | **Plan** | Detailed | Implicit/brief |
22
+ | **Documentation** | Complete | Minimal |
23
+ | **Use** | Large refactor | Small refactor |
24
+
25
+ ### Usage
26
+
27
+ ```bash
28
+ /refactor-quick "Extract validateEmail to utils"
29
+ /refactor-quick "Rename UserModel to User across codebase"
30
+ /refactor-quick "Move auth logic from controller to service"
31
+ /refactor-quick "Extract common validation to middleware"
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Workflow (3-5 minutes)
37
+
38
+ ### Step 0: Read Architecture Context (15 seconds)
39
+
40
+ **Before refactoring, understand project patterns:**
41
+
42
+ 1. **Read `docs/architecture.md`** - System architecture, design patterns, layering rules
43
+ 2. **Read `docs/code-standards.md`** - Naming conventions, file organization, code style
44
+ 3. **Read `ai-instructions.md`** - NEVER Rules (avoid violations during refactor)
45
+
46
+ **Validate refactor against:**
47
+
48
+ - Architecture patterns (don't break established design)
49
+ - Code standards (maintain consistency)
50
+ - NEVER Rules (don't introduce violations)
51
+
52
+ ---
53
+
54
+ ### Step 1: Identify Scope (30 seconds)
55
+
56
+ 1. **Parse refactor description** from user
57
+ 2. **Search affected files** using grep/glob
58
+ 3. **Find all occurrences** of code to refactor
59
+ 4. **Estimate impact** (lines, files, tests affected)
60
+ 5. **Validate against architecture patterns from Step 0**
61
+
62
+ **Example interaction:**
63
+
64
+ ```
65
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
66
+ ⚡ Quick Refactor
67
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
68
+
69
+ Refactor: Extract validateEmail to utils
70
+
71
+ Scanning codebase...
72
+ Found 3 files with email validation logic
73
+ ```
74
+
75
+ ---
76
+
77
+ ### Step 2: Propose Changes (30 seconds)
78
+
79
+ Show brief plan with affected files:
80
+
81
+ **Example output:**
82
+
83
+ ```
84
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+ 📋 Refactor Plan
86
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87
+
88
+ Files affected: 3
89
+ - src/utils/validators.ts (create new file)
90
+ - src/controllers/UserController.ts (modify)
91
+ - src/controllers/AuthController.ts (modify)
92
+
93
+ Changes:
94
+ 1. Create validateEmail() in utils/validators.ts
95
+ 2. Replace inline validation in UserController (2 locations)
96
+ 3. Replace inline validation in AuthController (1 location)
97
+ 4. Update imports in both controllers
98
+
99
+ Tests to update: 2 files
100
+ - tests/user.test.ts
101
+ - tests/auth.test.ts
102
+
103
+ Estimated time: 3-4 minutes
104
+
105
+ Proceed? (Y/n)
106
+ ```
107
+
108
+ ---
109
+
110
+ ### Step 3: Execute Refactor (2-3 minutes)
111
+
112
+ 1. **Create new files** if needed
113
+ 2. **Move/extract code** to new location
114
+ 3. **Update all usages** of refactored code
115
+ 4. **Update imports/references** across files
116
+ 5. **Adjust tests** if needed
117
+
118
+ **Show progress:**
119
+
120
+ ```
121
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
122
+ ⚙️ Executing Refactor
123
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
124
+
125
+ ✅ Created src/utils/validators.ts
126
+ ✅ Extracted validateEmail() function
127
+ ✅ Updated src/controllers/UserController.ts (2 locations)
128
+ ✅ Updated src/controllers/AuthController.ts (1 location)
129
+ ✅ Updated imports
130
+ ✅ Updated test files
131
+ ```
132
+
133
+ ---
134
+
135
+ ### Step 4: Validate (30 seconds)
136
+
137
+ 1. **Run tests automatically** (if test command exists)
138
+ 2. **Verify all tests pass**
139
+ 3. **Show summary**
140
+
141
+ **Example output:**
142
+
143
+ ```
144
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
145
+ ✅ Refactor Complete!
146
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
147
+
148
+ Changes:
149
+ - Created: src/utils/validators.ts
150
+ - Modified: src/controllers/UserController.ts (2 locations)
151
+ - Modified: src/controllers/AuthController.ts (1 location)
152
+ - Updated: 2 test files
153
+
154
+ Tests: ✅ All 24 tests passed
155
+
156
+ Summary:
157
+ - Extracted validateEmail() to utils
158
+ - Removed 15 lines of duplicated code
159
+ - Improved code reusability
160
+
161
+ No documentation update needed (code-only refactor)
162
+
163
+ Time: 4 minutes
164
+ ```
165
+
166
+ **Git Commit (Optional):**
167
+
168
+ ```bash
169
+ 🔧 Git Commit
170
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
171
+
172
+ Refactor complete. Create Git commit?
173
+
174
+ Pre-commit validation:
175
+ ✓ Lint passed
176
+ ✓ Type check passed
177
+ ✓ Tests passed (24 total)
178
+
179
+ Commit message:
180
+ refactor(validators): extract email validation to utils
181
+
182
+ Extracted validateEmail() to utils/validators.ts to reduce
183
+ code duplication across UserController and AuthController.
184
+
185
+ Changes:
186
+ - Created validators.ts with validateEmail()
187
+ - Updated UserController (2 locations)
188
+ - Updated AuthController (1 location)
189
+ - Removed 15 lines of duplicate code
190
+
191
+ Files changed: 3
192
+ - src/utils/validators.ts (new)
193
+ - src/controllers/UserController.ts
194
+ - src/controllers/AuthController.ts
195
+
196
+ Commit this refactor? (Y/n)
197
+ ```
198
+
199
+ **User confirms → Create commit:**
200
+
201
+ ```bash
202
+ git add src/utils/ src/controllers/
203
+ git commit -m "refactor(validators): extract email validation to utils
204
+
205
+ Extracted validateEmail() to utils/validators.ts to reduce
206
+ code duplication across UserController and AuthController.
207
+
208
+ Changes:
209
+ - Created validators.ts with validateEmail()
210
+ - Updated UserController (2 locations)
211
+ - Updated AuthController (1 location)
212
+ - Removed 15 lines of duplicate code"
213
+
214
+ # ✅ Committed as: c9d5f31
215
+ ```
216
+
217
+ **Final summary with Git info:**
218
+
219
+ ```bash
220
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
221
+ ✅ Refactor Complete
222
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
223
+
224
+ Refactor: Extract email validation to utils
225
+ Commit: c9d5f31
226
+ Files changed: 3
227
+ Tests: ✅ 24 passed
228
+ Time: 4 minutes
229
+
230
+ ℹ️ Quick refactor complete. No PR needed for internal refactors.
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Supported Refactor Types
236
+
237
+ ### 1. Extract Method/Function
238
+
239
+ **Pattern:** Duplicate code or complex logic → Separate function
240
+
241
+ **Examples:**
242
+
243
+ - "Extract email validation to utils"
244
+ - "Extract password hashing to auth utils"
245
+ - "Extract error handling to middleware"
246
+
247
+ ### 2. Rename
248
+
249
+ **Pattern:** Variable/function/class rename → Update all references
250
+
251
+ **Examples:**
252
+
253
+ - "Rename UserModel to User"
254
+ - "Rename getUserData to fetchUserProfile"
255
+ - "Rename isValid to isAuthenticated"
256
+
257
+ ### 3. Move Logic
258
+
259
+ **Pattern:** Logic in wrong place → Move to appropriate layer
260
+
261
+ **Examples:**
262
+
263
+ - "Move auth logic from controller to service"
264
+ - "Move validation from service to middleware"
265
+ - "Move formatting from controller to utils"
266
+
267
+ ### 4. Extract to Utility
268
+
269
+ **Pattern:** Reusable code → Utility module
270
+
271
+ **Examples:**
272
+
273
+ - "Extract date formatting to utils"
274
+ - "Extract string helpers to utils"
275
+ - "Extract constants to config file"
276
+
277
+ ---
278
+
279
+ ## When NOT to Use
280
+
281
+ ### ❌ Don't use `/refactor-quick` if:
282
+
283
+ - Refactor affects **>5 files**
284
+ - Requires **architectural changes**
285
+ - Needs to **modify database schema**
286
+ - Requires **detailed planning**
287
+ - Has **complex trade-offs** to consider
288
+ - **Tests are unclear** how to update
289
+
290
+ ### ✅ In those cases, use `/feature refactor`
291
+
292
+ The full `/feature refactor` mode provides:
293
+
294
+ - Complete specification
295
+ - Detailed planning
296
+ - Comprehensive testing strategy
297
+ - Full documentation update
298
+
299
+ ---
300
+
301
+ ## Git Integration
302
+
303
+ ### Overview
304
+
305
+ The `/refactor-quick` command integrates with Git to:
306
+
307
+ - Work on **current branch** (no branch creation for small refactors)
308
+ - Optionally commit refactor with **Conventional Commits** format
309
+ - Single commit at end (after refactor complete)
310
+ - **Never push automatically** (always manual review)
311
+ - **No PR suggestion** (internal refactors rarely need PRs)
312
+
313
+ ### When Git is Used
314
+
315
+ **Quick Refactors:**
316
+
317
+ - ✅ Work on current branch (no isolation needed)
318
+ - ✅ Single commit after refactor complete
319
+ - ✅ Commit is **optional** (user decides)
320
+ - ❌ No branch creation (too lightweight)
321
+ - ❌ No PR suggestion (internal change)
322
+
323
+ **If refactor is large:**
324
+
325
+ - Suggest using `/feature refactor` instead
326
+ - Larger refactors benefit from branch isolation
327
+ - Complex refactors need PR review
328
+
329
+ ### Conventional Commits Format
330
+
331
+ All refactor commits follow this structure:
332
+
333
+ ```
334
+ refactor(scope): brief description of refactor
335
+
336
+ [Detailed explanation of what was refactored and why]
337
+
338
+ Changes:
339
+ - [Change 1]
340
+ - [Change 2]
341
+ - [Change 3]
342
+ ```
343
+
344
+ **Commit Types:**
345
+
346
+ - `refactor` - Code restructuring without behavior change (always used)
347
+ - `style` - Code style/formatting only (rarely)
348
+ - `perf` - Performance improvement refactor (if applicable)
349
+
350
+ **Scopes (examples):**
351
+
352
+ - `validators` - Validation utilities
353
+ - `utils` - General utilities
354
+ - `controllers` - Controller layer
355
+ - `services` - Service layer
356
+ - `middleware` - Middleware components
357
+ - `models` - Data models
358
+
359
+ ### Pre-Commit Validation
360
+
361
+ Before committing, the following checks run automatically:
362
+
363
+ ```bash
364
+ 1. Lint check (npm run lint)
365
+ 2. Type check (npm run type-check or tsc --noEmit)
366
+ 3. Tests (npm test)
367
+ ```
368
+
369
+ **If validation fails:**
370
+
371
+ - Refactor is NOT committed
372
+ - User sees clear error message
373
+ - Must fix validation issues before retrying
374
+ - Can skip with explicit confirmation (not recommended)
375
+
376
+ ### Edge Cases
377
+
378
+ #### 1. Uncommitted Changes Exist
379
+
380
+ ```
381
+ ℹ️ You have uncommitted changes:
382
+ M src/app.ts
383
+ M src/config.ts
384
+
385
+ Refactor will work on current branch with these changes.
386
+ Consider committing or stashing them first.
387
+
388
+ Continue? (Y/n)
389
+ ```
390
+
391
+ #### 2. Tests Fail After Refactor
392
+
393
+ ```
394
+ ❌ Pre-commit validation failed:
395
+
396
+ ✗ Tests failed:
397
+ auth.test.ts: "should validate email format" FAILED
398
+
399
+ Expected: validateEmail to be defined
400
+ Received: undefined
401
+
402
+ Likely cause: Import path incorrect in test file.
403
+
404
+ Options:
405
+ 1. Fix test imports and retry
406
+ 2. Skip commit (manual commit later)
407
+ 3. Skip validation (⚠️ not recommended)
408
+
409
+ What would you like to do? (1/2/3)
410
+ ```
411
+
412
+ #### 3. Validation Fails
413
+
414
+ ```
415
+ ❌ Pre-commit validation failed:
416
+
417
+ ✗ Lint errors:
418
+ src/utils/validators.ts:12:1 - Missing JSDoc comment
419
+
420
+ Please fix these issues before committing.
421
+
422
+ Options:
423
+ 1. Fix issues and retry
424
+ 2. Skip commit (commit manually later)
425
+ 3. Skip validation (⚠️ not recommended)
426
+
427
+ What would you like to do? (1/2/3)
428
+ ```
429
+
430
+ #### 4. Not in a Git Repository
431
+
432
+ ```
433
+ ℹ️ Not a Git repository. Skipping version control.
434
+
435
+ Refactor complete. Changes applied without Git commit.
436
+ ```
437
+
438
+ #### 5. Detached HEAD State
439
+
440
+ ```
441
+ ⚠️ You are in detached HEAD state.
442
+
443
+ Options:
444
+ 1. Create branch from current commit first
445
+ 2. Checkout existing branch
446
+ 3. Continue without commit
447
+
448
+ What would you like to do? (1/2/3)
449
+ ```
450
+
451
+ #### 6. Large Refactor Detected
452
+
453
+ ```
454
+ ⚠️ Large refactor detected (8 files changed).
455
+
456
+ This is too complex for /refactor-quick.
457
+
458
+ Recommendation: Use `/feature refactor` instead for:
459
+ - Branch isolation
460
+ - Detailed planning
461
+ - PR review process
462
+
463
+ Continue with /refactor-quick anyway? (Y/n)
464
+ ```
465
+
466
+ #### 7. No Tests Available
467
+
468
+ ```
469
+ ℹ️ No test framework detected.
470
+
471
+ Pre-commit validation will skip test execution.
472
+ Consider adding tests to prevent regressions.
473
+
474
+ Continue? (Y/n)
475
+ ```
476
+
477
+ #### 8. User Declines Commit
478
+
479
+ ```
480
+ Commit this refactor? (Y/n): n
481
+
482
+ ℹ️ Skipping commit. You can commit manually:
483
+
484
+ git add src/utils/ src/controllers/
485
+ git commit -m "refactor(validators): extract email validation"
486
+
487
+ Refactor complete without commit.
488
+ ```
489
+
490
+ ### Workflow Example (Extract Validation)
491
+
492
+ ```bash
493
+ # User runs: /refactor-quick "Extract email validation to utils"
494
+
495
+ # 1. Scan codebase for email validation patterns
496
+ # 2. Propose refactor plan (3 files, 2 locations)
497
+ # 3. User confirms
498
+ # 4. Execute refactor:
499
+ # - Create validators.ts
500
+ # - Extract validateEmail()
501
+ # - Update UserController
502
+ # - Update AuthController
503
+ # 5. Run tests automatically
504
+ # 6. Tests pass ✓
505
+
506
+ # 7. Prompt for commit:
507
+ 🔧 Git Commit
508
+ Pre-commit validation:
509
+ ✓ Lint passed
510
+ ✓ Type check passed
511
+ ✓ Tests passed
512
+
513
+ Commit message:
514
+ refactor(validators): extract email validation to utils
515
+ ...
516
+
517
+ Commit this refactor? (Y/n)
518
+
519
+ # 8. User confirms → Commit
520
+ git commit -m "..."
521
+ # ✅ Committed as: c9d5f31
522
+
523
+ # 9. Show final summary:
524
+ ✅ Refactor Complete
525
+ Commit: c9d5f31
526
+ Files changed: 3
527
+ Tests: ✅ 24 passed
528
+ Time: 4 minutes
529
+ ```
530
+
531
+ ### Configuration
532
+
533
+ Git integration can be configured in `.ai-flow/core/config.json`:
534
+
535
+ ```json
536
+ {
537
+ "git": {
538
+ "enabled": true,
539
+ "autoCommit": "end",
540
+ "requireTests": true,
541
+ "requireLint": true,
542
+ "allowSkipValidation": false,
543
+ "autoPush": false
544
+ }
545
+ }
546
+ ```
547
+
548
+ **Options:**
549
+
550
+ - `enabled` - Enable/disable Git integration (default: true)
551
+ - `autoCommit` - "end" = prompt after refactor, "off" = never prompt
552
+ - `requireTests` - Fail if tests don't pass (default: true)
553
+ - `requireLint` - Fail if lint errors exist (default: true)
554
+ - `allowSkipValidation` - Allow skipping validation (default: false)
555
+ - `autoPush` - **Never enable** (default: false, not recommended)
556
+
557
+ ### Commit Message Style
558
+
559
+ **Good commit message:**
560
+
561
+ ```
562
+ refactor(validators): extract email validation to shared utility
563
+
564
+ Extracted validateEmail() to utils/validators.ts to eliminate
565
+ code duplication in UserController and AuthController.
566
+
567
+ Changes:
568
+ - Created validators.ts with validateEmail() and isValidEmail()
569
+ - Updated UserController to use shared validator (2 locations)
570
+ - Updated AuthController to use shared validator (1 location)
571
+ - Added unit tests for validators
572
+ - Removed 15 lines of duplicate code
573
+
574
+ No behavior changes - pure refactor.
575
+ ```
576
+
577
+ **Bad commit message:**
578
+
579
+ ```
580
+ refactor: cleanup
581
+ ```
582
+
583
+ **Why good messages matter:**
584
+
585
+ - Explains WHAT was refactored
586
+ - Explains WHY refactor was needed
587
+ - Shows impact (files, lines saved)
588
+ - Confirms no behavior change
589
+ - Future developers understand intent
590
+
591
+ ### Differences from `/feature refactor`
592
+
593
+ | Aspect | `/refactor-quick` | `/feature refactor` |
594
+ | ------------ | ----------------- | ---------------------------- |
595
+ | **Branch** | Current branch | New branch `refactor/[name]` |
596
+ | **Commits** | Single commit | Multiple commits (per phase) |
597
+ | **PR** | No suggestion | PR suggestion |
598
+ | **Scope** | 1-3 files | 5+ files |
599
+ | **Time** | 3-5 min | 15-20 min |
600
+ | **Planning** | Minimal | Detailed spec |
601
+ | **Docs** | Minimal | Complete |
602
+
603
+ ---
604
+
605
+ ## Important Rules
606
+
607
+ ### 1. Scope Limitation
608
+
609
+ - Keep refactors **small and focused**
610
+ - One refactor at a time
611
+ - If scope grows, suggest `/feature refactor` instead
612
+
613
+ ### 2. Test Preservation
614
+
615
+ - All existing tests **must pass**
616
+ - Update test imports/references
617
+ - No behavior changes (pure refactor)
618
+
619
+ ### 3. No Feature Changes
620
+
621
+ - Refactor **only** - no new features
622
+ - No behavior modifications
623
+ - No API changes
624
+
625
+ ### 4. Minimal Documentation
626
+
627
+ - Update docs **only if** public API changed
628
+ - Skip docs for internal refactors
629
+ - Quick summary sufficient
630
+
631
+ ---
632
+
633
+ ## Example Scenarios
634
+
635
+ ### Scenario 1: Extract Validation
636
+
637
+ ```
638
+ User: /refactor-quick "Extract email validation to validators.ts"
639
+
640
+ AI:
641
+ 1. Scans for email validation patterns
642
+ 2. Creates validators.ts with validateEmail()
643
+ 3. Replaces inline validation (5 locations)
644
+ 4. Updates imports
645
+ 5. Tests pass ✅
646
+ 6. Done in 3 minutes
647
+ ```
648
+
649
+ ### Scenario 2: Rename Class
650
+
651
+ ```
652
+ User: /refactor-quick "Rename UserModel to User"
653
+
654
+ AI:
655
+ 1. Finds all UserModel references (23 locations)
656
+ 2. Renames class definition
657
+ 3. Updates all imports
658
+ 4. Updates all type annotations
659
+ 5. Tests pass ✅
660
+ 6. Done in 4 minutes
661
+ ```
662
+
663
+ ### Scenario 3: Move Logic
664
+
665
+ ```
666
+ User: /refactor-quick "Move auth logic from AuthController to AuthService"
667
+
668
+ AI:
669
+ 1. Identifies auth logic in controller
670
+ 2. Creates/updates AuthService
671
+ 3. Moves logic to service layer
672
+ 4. Updates controller to call service
673
+ 5. Tests pass ✅
674
+ 6. Done in 5 minutes
675
+ ```
676
+
677
+ ---
678
+
679
+ ## Error Handling
680
+
681
+ ### If Scope Too Large:
682
+
683
+ ```
684
+ ⚠️ This refactor affects 8 files and requires architectural changes.
685
+
686
+ This is too complex for /refactor-quick.
687
+
688
+ Recommendation: Use `/feature refactor` instead for:
689
+ - Detailed planning
690
+ - Comprehensive testing
691
+ - Full documentation
692
+
693
+ Continue anyway? (Y/n)
694
+ ```
695
+
696
+ ### If Tests Fail:
697
+
698
+ ```
699
+ ❌ Tests Failed After Refactor
700
+
701
+ 3 tests failing:
702
+ - auth.test.ts: "should validate email format"
703
+ - user.test.ts: "should reject invalid emails"
704
+ - integration.test.ts: "registration flow"
705
+
706
+ Analyzing failures...
707
+ [Shows failure details and suggests fixes]
708
+
709
+ Fix automatically? (Y/n)
710
+ ```
711
+
712
+ ---
713
+
714
+ **BEGIN EXECUTION when user runs `/refactor-quick "description"`**
715
+