@haposoft/cafekit 0.3.1 → 0.3.5

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.
@@ -0,0 +1,604 @@
1
+ # Report Template - Mẫu Báo Cáo Impact Analysis
2
+
3
+ Template chuẩn cho báo cáo phân tích tác động và hướng dẫn test.
4
+
5
+ ## Full Report Template
6
+
7
+ ```markdown
8
+ # Impact Analysis Report
9
+ **Date:** {YYYY-MM-DD HH:mm}
10
+ **Analyst:** {Agent/User Name}
11
+ **Branch:** {git-branch}
12
+ **Commit:** {commit-hash}
13
+
14
+ ---
15
+
16
+ ## 📋 Executive Summary
17
+
18
+ **Overview:**
19
+ {Brief description of changes - 2-3 sentences}
20
+
21
+ **Key Metrics:**
22
+ - **Files Changed:** {count} files
23
+ - **Lines Changed:** +{added} -{deleted}
24
+ - **Affected Components:** {count} components
25
+ - **Risk Level:** {Low/Medium/High/Critical}
26
+ - **Estimated Test Time:** {duration}
27
+ - **Recommended Actions:** {count} items
28
+
29
+ **Quick Assessment:**
30
+ {One paragraph summary of impact and recommendations}
31
+
32
+ ---
33
+
34
+ ## 🔍 Changed Files Analysis
35
+
36
+ ### Backend Changes ({count} files)
37
+
38
+ #### {File 1}
39
+ - **Path:** `{full-path}`
40
+ - **Type:** {API/Service/Controller/Utility}
41
+ - **Changes:** {Brief description}
42
+ - **LOC:** +{added} -{deleted}
43
+ - **Risk:** {Low/Medium/High}
44
+ - **Reason:** {Why this risk level}
45
+
46
+ **Key Changes:**
47
+ - {Change 1}
48
+ - {Change 2}
49
+
50
+ **Potential Issues:**
51
+ - {Issue 1}
52
+ - {Issue 2}
53
+
54
+ ---
55
+
56
+ #### {File 2}
57
+ ...
58
+
59
+ ### Frontend Changes ({count} files)
60
+
61
+ #### {File 1}
62
+ - **Path:** `{full-path}`
63
+ - **Type:** {Component/Hook/Page/Utility}
64
+ - **Changes:** {Brief description}
65
+ - **LOC:** +{added} -{deleted}
66
+ - **Risk:** {Low/Medium/High}
67
+
68
+ **Key Changes:**
69
+ - {Change 1}
70
+
71
+ **UI Impact:**
72
+ - {Impact 1}
73
+
74
+ ---
75
+
76
+ ### Database Changes ({count} files)
77
+
78
+ #### {File 1}
79
+ - **Path:** `{full-path}`
80
+ - **Type:** {Schema/Migration/Seed}
81
+ - **Changes:** {Brief description}
82
+ - **Risk:** {Critical/High/Medium}
83
+
84
+ **Schema Changes:**
85
+ - {Table/Column changes}
86
+
87
+ **Migration Required:** {Yes/No}
88
+
89
+ ---
90
+
91
+ ### Configuration Changes ({count} files)
92
+
93
+ #### {File 1}
94
+ - **Path:** `{full-path}`
95
+ - **Type:** {Env/Config/Dependencies}
96
+ - **Changes:** {Brief description}
97
+ - **Risk:** {Low/Medium/High}
98
+
99
+ ---
100
+
101
+ ## 🔗 Dependency Analysis
102
+
103
+ ### Direct Dependencies
104
+ **Files that changed code imports/uses:**
105
+
106
+ | File | Imports | Risk | Notes |
107
+ |------|---------|------|-------|
108
+ | `{file-path}` | {module-list} | {risk} | {notes} |
109
+
110
+ ### Reverse Dependencies
111
+ **Files that will be affected by changes:**
112
+
113
+ | Affected File | Uses | Impact | Reason |
114
+ |---------------|------|--------|--------|
115
+ | `{file-path}` | {function/class} | {High/Medium/Low} | {explanation} |
116
+
117
+ **Total Affected:** {count} files
118
+
119
+ ### Integration Points
120
+
121
+ #### API Endpoints
122
+ | Endpoint | Method | Changed | Consumers |
123
+ |----------|--------|---------|-----------|
124
+ | `{path}` | {GET/POST/etc} | {Yes/No} | {count} files |
125
+
126
+ **Details:**
127
+ - `{endpoint}`: {description}
128
+ - Consumers: `{file1}`, `{file2}`
129
+ - Breaking change: {Yes/No}
130
+ - Migration needed: {Yes/No}
131
+
132
+ #### Database Tables
133
+ | Table | Columns Changed | Queries Affected |
134
+ |-------|----------------|------------------|
135
+ | `{table}` | {columns} | {count} |
136
+
137
+ #### Event Handlers
138
+ | Event | Changed | Listeners |
139
+ |-------|---------|-----------|
140
+ | `{event-name}` | {Yes/No} | {count} |
141
+
142
+ #### State Management
143
+ | Store/Context | Changed | Consumers |
144
+ |---------------|---------|-----------|
145
+ | `{store-name}` | {Yes/No} | {count} |
146
+
147
+ ---
148
+
149
+ ## ⚠️ Edge Cases Identified
150
+
151
+ ### Critical Issues ({count})
152
+
153
+ #### 1. {Issue Title}
154
+ - **Category:** {Data Flow/Boundary/Error/Race Condition}
155
+ - **Location:** `{file}:{line}`
156
+ - **Severity:** Critical
157
+ - **Description:** {Detailed description}
158
+ - **Impact:** {What could go wrong}
159
+ - **Recommendation:** {How to fix}
160
+
161
+ **Example:**
162
+ ```typescript
163
+ // Current code (problematic)
164
+ {code-snippet}
165
+
166
+ // Recommended fix
167
+ {fixed-code-snippet}
168
+ ```
169
+
170
+ ---
171
+
172
+ ### High Priority Issues ({count})
173
+
174
+ #### 1. {Issue Title}
175
+ - **Category:** {category}
176
+ - **Location:** `{file}:{line}`
177
+ - **Severity:** High
178
+ - **Description:** {description}
179
+ - **Recommendation:** {fix}
180
+
181
+ ---
182
+
183
+ ### Medium Priority Issues ({count})
184
+
185
+ #### 1. {Issue Title}
186
+ - **Category:** {category}
187
+ - **Severity:** Medium
188
+ - **Description:** {description}
189
+ - **Recommendation:** {fix}
190
+
191
+ ---
192
+
193
+ ### Edge Case Checklist
194
+
195
+ #### Data Flow
196
+ - [ ] Null/undefined handling verified
197
+ - [ ] Empty collections handled
198
+ - [ ] Type coercion checked
199
+ - [ ] Default values provided
200
+
201
+ #### Boundaries
202
+ - [ ] String length limits validated
203
+ - [ ] Numeric ranges checked
204
+ - [ ] Date/time edge cases handled
205
+ - [ ] Unicode/emoji support verified
206
+
207
+ #### Errors
208
+ - [ ] Network failures handled
209
+ - [ ] Database errors caught
210
+ - [ ] Permission checks in place
211
+ - [ ] Validation errors clear
212
+
213
+ #### Concurrency
214
+ - [ ] Race conditions prevented
215
+ - [ ] Atomic operations used
216
+ - [ ] State mutations safe
217
+ - [ ] Idempotency ensured
218
+
219
+ #### Integration
220
+ - [ ] API contracts maintained
221
+ - [ ] Event handlers cleaned up
222
+ - [ ] Dependencies updated
223
+ - [ ] Backward compatibility checked
224
+
225
+ ---
226
+
227
+ ## 🧪 Test Scenarios
228
+
229
+ ### Priority 0: Critical ({count} scenarios)
230
+
231
+ #### Scenario 1: {Title}
232
+ **Objective:** {What we're testing}
233
+
234
+ **Preconditions:**
235
+ - {Condition 1}
236
+ - {Condition 2}
237
+
238
+ **Test Steps:**
239
+ 1. {Step 1}
240
+ 2. {Step 2}
241
+ 3. {Step 3}
242
+
243
+ **Expected Results:**
244
+ - {Result 1}
245
+ - {Result 2}
246
+
247
+ **Edge Cases to Check:**
248
+ - {Edge case 1}
249
+ - {Edge case 2}
250
+
251
+ **Affected Components:**
252
+ - `{component-1}`
253
+ - `{component-2}`
254
+
255
+ **Automated:** {Yes/No}
256
+ **Estimated Time:** {duration}
257
+
258
+ ---
259
+
260
+ ### Priority 1: High ({count} scenarios)
261
+
262
+ #### Scenario 1: {Title}
263
+ {Same structure as above}
264
+
265
+ ---
266
+
267
+ ### Priority 2: Medium ({count} scenarios)
268
+
269
+ #### Scenario 1: {Title}
270
+ {Same structure as above}
271
+
272
+ ---
273
+
274
+ ### Priority 3: Low ({count} scenarios)
275
+
276
+ #### Scenario 1: {Title}
277
+ {Same structure as above}
278
+
279
+ ---
280
+
281
+ ## ✅ Test Execution Checklist
282
+
283
+ ### Pre-Test Setup
284
+ - [ ] Pull latest code
285
+ - [ ] Install dependencies: `npm install`
286
+ - [ ] Run database migrations: `npm run migrate`
287
+ - [ ] Seed test data: `npm run seed:test`
288
+ - [ ] Start development server: `npm run dev`
289
+
290
+ ### Unit Tests
291
+ - [ ] Run all tests: `npm test`
292
+ - [ ] Run changed files only: `npm test -- {files}`
293
+ - [ ] Check coverage: `npm run test:coverage`
294
+ - [ ] Coverage threshold met: {Yes/No} ({percentage}%)
295
+
296
+ **Results:**
297
+ - Total: {count} tests
298
+ - Passed: {count}
299
+ - Failed: {count}
300
+ - Skipped: {count}
301
+
302
+ **Failed Tests:**
303
+ - {test-name}: {reason}
304
+
305
+ ### Integration Tests
306
+ - [ ] API endpoint tests: `npm run test:api`
307
+ - [ ] Database integration: `npm run test:db`
308
+ - [ ] Authentication flow: `npm run test:auth`
309
+
310
+ **Results:**
311
+ - {summary}
312
+
313
+ ### UI Tests (if applicable)
314
+ - [ ] Visual regression: Screenshot comparison
315
+ - [ ] Responsive design: Mobile/Tablet/Desktop
316
+ - [ ] Accessibility: ARIA, keyboard navigation
317
+ - [ ] Browser compatibility: Chrome/Firefox/Safari
318
+
319
+ **Tools:**
320
+ - [ ] Playwright/Cypress tests
321
+ - [ ] Chrome DevTools MCP
322
+ - [ ] Manual testing
323
+
324
+ ### Manual Testing Checklist
325
+
326
+ #### Feature: {Feature Name}
327
+ - [ ] Happy path works
328
+ - [ ] Error handling works
329
+ - [ ] Edge case 1: {description}
330
+ - [ ] Edge case 2: {description}
331
+ - [ ] Performance acceptable
332
+ - [ ] No console errors
333
+
334
+ #### Regression Testing
335
+ - [ ] {Existing feature 1} still works
336
+ - [ ] {Existing feature 2} still works
337
+ - [ ] {Existing feature 3} still works
338
+
339
+ ### Performance Testing
340
+ - [ ] API response time < {threshold}ms
341
+ - [ ] Page load time < {threshold}s
342
+ - [ ] No memory leaks detected
343
+ - [ ] Database query performance acceptable
344
+
345
+ ---
346
+
347
+ ## 🎯 Recommended Actions
348
+
349
+ ### Immediate (Do Before Commit)
350
+
351
+ #### Priority 0: Critical
352
+ 1. **{Action 1}**
353
+ - **Why:** {Reason}
354
+ - **How:** {Steps}
355
+ - **Time:** {estimate}
356
+
357
+ 2. **{Action 2}**
358
+ - **Why:** {Reason}
359
+ - **How:** {Steps}
360
+ - **Time:** {estimate}
361
+
362
+ ### Short Term (Do Before PR)
363
+
364
+ #### Priority 1: High
365
+ 1. **{Action 1}**
366
+ - **Why:** {Reason}
367
+ - **Impact:** {What happens if not done}
368
+ - **Time:** {estimate}
369
+
370
+ ### Medium Term (Do Before Release)
371
+
372
+ #### Priority 2: Medium
373
+ 1. **{Action 1}**
374
+ - **Why:** {Reason}
375
+ - **Time:** {estimate}
376
+
377
+ ### Long Term (Technical Debt)
378
+
379
+ #### Priority 3: Low
380
+ 1. **{Action 1}**
381
+ - **Why:** {Reason}
382
+ - **Time:** {estimate}
383
+
384
+ ---
385
+
386
+ ## 📊 Risk Assessment
387
+
388
+ ### Overall Risk: {Low/Medium/High/Critical}
389
+
390
+ **Risk Factors:**
391
+
392
+ | Factor | Score (1-5) | Weight | Total | Notes |
393
+ |--------|-------------|--------|-------|-------|
394
+ | Security Impact | {score} | 5 | {total} | {notes} |
395
+ | Data Loss Risk | {score} | 5 | {total} | {notes} |
396
+ | User Impact | {score} | 3 | {total} | {notes} |
397
+ | Business Impact | {score} | 2 | {total} | {notes} |
398
+ | Complexity | {score} | 1 | {total} | {notes} |
399
+
400
+ **Total Risk Score:** {sum} / 80
401
+
402
+ **Risk Level Calculation:**
403
+ - 0-20: Low
404
+ - 21-40: Medium
405
+ - 41-60: High
406
+ - 61-80: Critical
407
+
408
+ ### Risk Breakdown
409
+
410
+ #### Security Risks
411
+ - {Risk 1}: {description}
412
+ - {Risk 2}: {description}
413
+
414
+ **Mitigation:**
415
+ - {Strategy 1}
416
+ - {Strategy 2}
417
+
418
+ #### Data Integrity Risks
419
+ - {Risk 1}: {description}
420
+
421
+ **Mitigation:**
422
+ - {Strategy 1}
423
+
424
+ #### Performance Risks
425
+ - {Risk 1}: {description}
426
+
427
+ **Mitigation:**
428
+ - {Strategy 1}
429
+
430
+ #### Integration Risks
431
+ - {Risk 1}: {description}
432
+
433
+ **Mitigation:**
434
+ - {Strategy 1}
435
+
436
+ ---
437
+
438
+ ## 🔄 Regression Prevention
439
+
440
+ ### Features to Verify
441
+
442
+ | Feature | Test Method | Status | Notes |
443
+ |---------|-------------|--------|-------|
444
+ | {Feature 1} | {Manual/Automated} | {Pass/Fail/Pending} | {notes} |
445
+ | {Feature 2} | {Manual/Automated} | {Pass/Fail/Pending} | {notes} |
446
+
447
+ ### Automated Regression Tests
448
+
449
+ **Command:** `{test-command}`
450
+
451
+ **Expected:** All tests pass
452
+
453
+ **Results:**
454
+ - {summary}
455
+
456
+ ### Manual Regression Checklist
457
+
458
+ - [ ] {Feature 1}: {specific check}
459
+ - [ ] {Feature 2}: {specific check}
460
+ - [ ] {Feature 3}: {specific check}
461
+
462
+ ---
463
+
464
+ ## 📈 Metrics & Statistics
465
+
466
+ ### Code Metrics
467
+ - **Total Files Changed:** {count}
468
+ - **Total LOC Changed:** {count}
469
+ - **Files Added:** {count}
470
+ - **Files Deleted:** {count}
471
+ - **Files Modified:** {count}
472
+
473
+ ### Test Metrics
474
+ - **Test Scenarios Created:** {count}
475
+ - **Automated Tests:** {count}
476
+ - **Manual Tests:** {count}
477
+ - **Estimated Test Time:** {duration}
478
+ - **Test Coverage:** {percentage}%
479
+
480
+ ### Impact Metrics
481
+ - **Components Affected:** {count}
482
+ - **API Endpoints Affected:** {count}
483
+ - **Database Tables Affected:** {count}
484
+ - **Edge Cases Identified:** {count}
485
+
486
+ ### Risk Metrics
487
+ - **Critical Issues:** {count}
488
+ - **High Priority Issues:** {count}
489
+ - **Medium Priority Issues:** {count}
490
+ - **Low Priority Issues:** {count}
491
+ - **Overall Risk Score:** {score}/80
492
+
493
+ ---
494
+
495
+ ## 📝 Additional Notes
496
+
497
+ ### Assumptions Made
498
+ - {Assumption 1}
499
+ - {Assumption 2}
500
+
501
+ ### Limitations
502
+ - {Limitation 1}
503
+ - {Limitation 2}
504
+
505
+ ### Future Considerations
506
+ - {Consideration 1}
507
+ - {Consideration 2}
508
+
509
+ ---
510
+
511
+ ## ❓ Unresolved Questions
512
+
513
+ 1. **{Question 1}**
514
+ - **Context:** {Why this is unclear}
515
+ - **Impact:** {What depends on this}
516
+ - **Action:** {Who should answer}
517
+
518
+ 2. **{Question 2}**
519
+ - **Context:** {context}
520
+ - **Impact:** {impact}
521
+ - **Action:** {action}
522
+
523
+ ---
524
+
525
+ ## 📎 Appendices
526
+
527
+ ### Appendix A: Git Diff Summary
528
+ ```bash
529
+ {git diff --stat output}
530
+ ```
531
+
532
+ ### Appendix B: Dependency Graph
533
+ ```
534
+ {ASCII dependency tree}
535
+ ```
536
+
537
+ ### Appendix C: Test Data
538
+ ```json
539
+ {test-data.json}
540
+ ```
541
+
542
+ ### Appendix D: Related Documents
543
+ - [Original Plan]({link})
544
+ - [API Documentation]({link})
545
+ - [Architecture Diagram]({link})
546
+
547
+ ---
548
+
549
+ **Report Generated:** {timestamp}
550
+ **Tool Version:** impact-analyzer v1.0.0
551
+ **Next Review:** {date}
552
+ ```
553
+
554
+ ## Compact Report Template (For Quick Reviews)
555
+
556
+ ```markdown
557
+ # Impact Analysis - Quick Report
558
+
559
+ **Changes:** {count} files | **Risk:** {level} | **Test Time:** {duration}
560
+
561
+ ## Changed
562
+ {file-list}
563
+
564
+ ## Affected
565
+ {affected-component-list}
566
+
567
+ ## Edge Cases
568
+ {critical-issues-only}
569
+
570
+ ## Test Scenarios
571
+ {priority-0-and-1-only}
572
+
573
+ ## Actions
574
+ {immediate-actions-only}
575
+
576
+ ## Questions
577
+ {unresolved-questions}
578
+ ```
579
+
580
+ ## Report Sections Guide
581
+
582
+ ### When to Include Each Section
583
+
584
+ | Section | Always | High Risk | Complex | Simple |
585
+ |---------|--------|-----------|---------|--------|
586
+ | Executive Summary | ✅ | ✅ | ✅ | ✅ |
587
+ | Changed Files | ✅ | ✅ | ✅ | ✅ |
588
+ | Dependencies | ✅ | ✅ | ✅ | Optional |
589
+ | Edge Cases | ✅ | ✅ | ✅ | If found |
590
+ | Test Scenarios | ✅ | ✅ | ✅ | ✅ |
591
+ | Test Checklist | ✅ | ✅ | ✅ | ✅ |
592
+ | Recommended Actions | ✅ | ✅ | ✅ | ✅ |
593
+ | Risk Assessment | Optional | ✅ | ✅ | Optional |
594
+ | Regression Prevention | ✅ | ✅ | ✅ | Optional |
595
+ | Metrics | Optional | ✅ | Optional | No |
596
+ | Appendices | Optional | ✅ | Optional | No |
597
+
598
+ ## Output Naming
599
+
600
+ Use pattern from hooks: `impact-analysis-{date}-{slug}.md`
601
+
602
+ **Examples:**
603
+ - `impact-analysis-251218-1430-auth-refactor.md`
604
+ - `impact-analysis-251218-1445-GH-123-user-api.md`