ai-flow-dev 2.1.2 → 2.1.4

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