@haposoft/cafekit 0.3.7 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/antigravity/workflows/impact-analysis.md +14 -19
- package/src/common/skills/impact-analysis/references/change-detection.md +16 -16
- package/src/common/skills/impact-analysis/references/dependency-scouting.md +8 -8
- package/src/common/skills/impact-analysis/references/edge-case-identification.md +11 -11
- package/src/common/skills/impact-analysis/references/industry-techniques.md +36 -36
- package/src/common/skills/impact-analysis/references/practical-techniques-guide.md +16 -16
- package/src/common/skills/impact-analysis/references/project-detection.md +1 -1
- package/src/common/skills/impact-analysis/references/report-template.md +2 -2
- package/src/common/skills/impact-analysis/scripts/README.md +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Spec-Driven Development workflow for AI coding assistants. Supports Claude Code and Antigravity with spec-first and code-test-review workflows.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=18.0.0"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Analyze code change impacts on features and user actions
|
|
3
3
|
allowed-tools: Read, Glob, Grep, Bash, WebSearch
|
|
4
4
|
argument-hint: <feature-name> [--from <branch>]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# /impact-analysis -
|
|
7
|
+
# /impact-analysis - Feature Impact Analysis
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use this workflow after completing a feature (after `/code`) or before committing.
|
|
10
10
|
|
|
11
11
|
<background_information>
|
|
12
12
|
- **Mission**: Comprehensive impact analysis for completed features to prevent regression bugs
|
|
@@ -16,8 +16,8 @@ Sử dụng workflow này sau khi hoàn thành feature (sau `/code`) hoặc trư
|
|
|
16
16
|
- Test scenarios generated for all critical paths
|
|
17
17
|
- Regression risks assessed with mitigation recommendations
|
|
18
18
|
- Cross-referenced with spec artifacts when available
|
|
19
|
-
- **Timing**: After implementing all tasks for a feature, before running
|
|
20
|
-
- **Helper Scripts**: Optionally use advanced analysis scripts from `.
|
|
19
|
+
- **Timing**: After implementing all tasks for a feature, before running tests
|
|
20
|
+
- **Helper Scripts**: Optionally use advanced analysis scripts from `.agent/skills/impact-analysis/scripts/` for automated dependency analysis, AST-based semantic analysis, and risk scoring
|
|
21
21
|
</background_information>
|
|
22
22
|
|
|
23
23
|
<instructions>
|
|
@@ -26,11 +26,11 @@ Analyze the impact of code changes for feature **$ARGUMENTS** to identify affect
|
|
|
26
26
|
|
|
27
27
|
## Helper Scripts (Optional Enhancement)
|
|
28
28
|
|
|
29
|
-
If available in `.
|
|
29
|
+
If available in `.agent/skills/impact-analysis/scripts/`, these scripts provide advanced automated analysis:
|
|
30
30
|
|
|
31
31
|
**1. Dependency Analysis**:
|
|
32
32
|
```bash
|
|
33
|
-
.
|
|
33
|
+
.agent/skills/impact-analysis/scripts/find-dependencies.sh <file>
|
|
34
34
|
```
|
|
35
35
|
- Finds all files importing/using the changed file
|
|
36
36
|
- Identifies API consumers and component usage
|
|
@@ -38,7 +38,7 @@ If available in `.claude/skills/impact-analysis/scripts/`, these scripts provide
|
|
|
38
38
|
|
|
39
39
|
**2. AST-Based Analysis** (for TypeScript/JavaScript):
|
|
40
40
|
```bash
|
|
41
|
-
node .
|
|
41
|
+
node .agent/skills/impact-analysis/scripts/ast-analyze.js <file>
|
|
42
42
|
```
|
|
43
43
|
- Detects function signature changes
|
|
44
44
|
- Identifies breaking changes
|
|
@@ -46,7 +46,7 @@ node .claude/skills/impact-analysis/scripts/ast-analyze.js <file>
|
|
|
46
46
|
|
|
47
47
|
**3. Risk Calculation**:
|
|
48
48
|
```bash
|
|
49
|
-
node .
|
|
49
|
+
node .agent/skills/impact-analysis/scripts/calculate-risk.js
|
|
50
50
|
```
|
|
51
51
|
- Calculates risk score (0-25)
|
|
52
52
|
- Determines risk level (CRITICAL/HIGH/MEDIUM/LOW)
|
|
@@ -54,7 +54,7 @@ node .claude/skills/impact-analysis/scripts/calculate-risk.js
|
|
|
54
54
|
|
|
55
55
|
**4. Complete Analysis**:
|
|
56
56
|
```bash
|
|
57
|
-
.
|
|
57
|
+
.agent/skills/impact-analysis/scripts/run-analysis.sh
|
|
58
58
|
```
|
|
59
59
|
- Runs all techniques
|
|
60
60
|
- Generates comprehensive markdown report
|
|
@@ -160,8 +160,7 @@ Scan file contents for keywords to detect additional features:
|
|
|
160
160
|
|
|
161
161
|
If helper script available, run comprehensive analysis:
|
|
162
162
|
```bash
|
|
163
|
-
|
|
164
|
-
.claude/skills/impact-analysis/scripts/find-dependencies.sh <file>
|
|
163
|
+
.agent/skills/impact-analysis/scripts/find-dependencies.sh <file>
|
|
165
164
|
```
|
|
166
165
|
|
|
167
166
|
**Manual Dependency Analysis** (fallback):
|
|
@@ -200,11 +199,8 @@ For each changed file, find:
|
|
|
200
199
|
|
|
201
200
|
**Option 1: Use Helper Scripts** (if available):
|
|
202
201
|
```bash
|
|
203
|
-
|
|
204
|
-
node .
|
|
205
|
-
|
|
206
|
-
# Run risk calculation
|
|
207
|
-
node .claude/skills/impact-analysis/scripts/calculate-risk.js
|
|
202
|
+
node .agent/skills/impact-analysis/scripts/ast-analyze.js <file>
|
|
203
|
+
node .agent/skills/impact-analysis/scripts/calculate-risk.js
|
|
208
204
|
```
|
|
209
205
|
|
|
210
206
|
**Option 2: Manual Detection** (fallback):
|
|
@@ -328,8 +324,7 @@ For each affected feature and user action, generate:
|
|
|
328
324
|
**Automated Risk Assessment** (if helper script available):
|
|
329
325
|
|
|
330
326
|
```bash
|
|
331
|
-
|
|
332
|
-
node .claude/skills/impact-analysis/scripts/calculate-risk.js
|
|
327
|
+
node .agent/skills/impact-analysis/scripts/calculate-risk.js
|
|
333
328
|
|
|
334
329
|
# Output includes:
|
|
335
330
|
# - Risk score (0-25)
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Change Detection -
|
|
1
|
+
# Change Detection - Detecting Changes
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Methods for detecting and classifying code changes for impact analysis.
|
|
4
4
|
|
|
5
5
|
## Git Commands
|
|
6
6
|
|
|
7
7
|
### 1. Detect Recent Changes
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
#
|
|
10
|
+
# Uncommitted changes
|
|
11
11
|
git diff --name-only
|
|
12
12
|
|
|
13
|
-
#
|
|
13
|
+
# Staged changes
|
|
14
14
|
git diff --cached --name-only
|
|
15
15
|
|
|
16
|
-
# Changes
|
|
16
|
+
# Changes in last commit
|
|
17
17
|
git diff --name-only HEAD~1
|
|
18
18
|
|
|
19
|
-
# Changes
|
|
19
|
+
# Changes compared to another branch
|
|
20
20
|
git diff --name-only main...HEAD
|
|
21
21
|
|
|
22
|
-
#
|
|
22
|
+
# View detailed changes
|
|
23
23
|
git diff HEAD~1
|
|
24
24
|
|
|
25
|
-
#
|
|
25
|
+
# View statistics
|
|
26
26
|
git diff --stat HEAD~1
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### 2. Get Change Details
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
#
|
|
32
|
+
# Lines changed
|
|
33
33
|
git diff --numstat HEAD~1
|
|
34
34
|
|
|
35
|
-
# Files
|
|
35
|
+
# Files and change count
|
|
36
36
|
git diff --shortstat HEAD~1
|
|
37
37
|
|
|
38
|
-
#
|
|
38
|
+
# Only view added/deleted files
|
|
39
39
|
git diff --diff-filter=AD --name-only HEAD~1
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### 3. Historical Analysis
|
|
43
43
|
|
|
44
44
|
```bash
|
|
45
|
-
#
|
|
45
|
+
# View file history
|
|
46
46
|
git log --oneline -10 {file}
|
|
47
47
|
|
|
48
|
-
#
|
|
48
|
+
# See who modified which line
|
|
49
49
|
git blame {file}
|
|
50
50
|
|
|
51
|
-
#
|
|
51
|
+
# View changes in specific commit
|
|
52
52
|
git show {commit-hash}
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -57,7 +57,7 @@ git show {commit-hash}
|
|
|
57
57
|
### Backend Changes
|
|
58
58
|
|
|
59
59
|
**Indicators:**
|
|
60
|
-
- Files: `*.ts`, `*.js`, `*.py`, `*.go`
|
|
60
|
+
- Files: `*.ts`, `*.js`, `*.py`, `*.go` in `src/api/`, `src/services/`, `src/controllers/`
|
|
61
61
|
- Patterns: API routes, database queries, business logic
|
|
62
62
|
|
|
63
63
|
**Risk Level:**
|
|
@@ -79,7 +79,7 @@ grep -r "SELECT\|INSERT\|UPDATE\|DELETE" {changed-files}
|
|
|
79
79
|
### Frontend Changes
|
|
80
80
|
|
|
81
81
|
**Indicators:**
|
|
82
|
-
- Files: `*.tsx`, `*.jsx`, `*.vue`, `*.svelte`
|
|
82
|
+
- Files: `*.tsx`, `*.jsx`, `*.vue`, `*.svelte` in `src/components/`, `src/pages/`
|
|
83
83
|
- Patterns: Components, hooks, state management
|
|
84
84
|
|
|
85
85
|
**Risk Level:**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Dependency Scouting -
|
|
1
|
+
# Dependency Scouting - Finding Affected Files
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Methods for finding and analyzing dependencies to determine impact scope.
|
|
4
4
|
|
|
5
5
|
## Scouting Strategies
|
|
6
6
|
|
|
7
7
|
### 1. Import Analysis (Direct Dependencies)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Find files that import the modified code:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# JavaScript/TypeScript
|
|
@@ -35,7 +35,7 @@ grep -r "from.*utils/auth" src/
|
|
|
35
35
|
|
|
36
36
|
### 2. Function/Class Usage (Reverse Dependencies)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Find where functions/classes are used:
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
# Function calls
|
|
@@ -60,7 +60,7 @@ grep -r "validateEmail(" src/
|
|
|
60
60
|
|
|
61
61
|
### 3. API Endpoint Consumers
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
If backend API is modified, find frontend calls:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
66
|
# Fetch/Axios calls
|
|
@@ -84,7 +84,7 @@ grep -r "api/users" src/
|
|
|
84
84
|
|
|
85
85
|
### 4. Database Dependencies
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
If database schema is modified:
|
|
88
88
|
|
|
89
89
|
```bash
|
|
90
90
|
# Table usage
|
|
@@ -109,7 +109,7 @@ grep -r "prisma.user.findMany" src/
|
|
|
109
109
|
|
|
110
110
|
### 5. Type/Interface Dependencies
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
Find where types are used:
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
115
|
# TypeScript interfaces
|
|
@@ -134,7 +134,7 @@ grep -r "as User" src/
|
|
|
134
134
|
|
|
135
135
|
## Using /ck:scout for Parallel Scouting
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
When multiple files change, use `/ck:scout` for parallel search:
|
|
138
138
|
|
|
139
139
|
```
|
|
140
140
|
/ck:scout Scout dependencies for changes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Edge Case Identification -
|
|
1
|
+
# Edge Case Identification - Identifying Edge Cases
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Methods for detecting and analyzing edge cases to avoid potential bugs.
|
|
4
4
|
|
|
5
5
|
## Edge Case Categories
|
|
6
6
|
|
|
@@ -23,10 +23,10 @@ function getUser(id: string) {
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**Check:**
|
|
26
|
-
- [ ]
|
|
27
|
-
- [ ] Optional chaining (`?.`)
|
|
28
|
-
- [ ] Nullish coalescing (`??`)
|
|
29
|
-
- [ ] Type guards
|
|
26
|
+
- [ ] Check null/undefined before access?
|
|
27
|
+
- [ ] Optional chaining (`?.`) used?
|
|
28
|
+
- [ ] Nullish coalescing (`??`) for default values?
|
|
29
|
+
- [ ] Type guards for union types?
|
|
30
30
|
|
|
31
31
|
#### Empty Collections
|
|
32
32
|
|
|
@@ -39,9 +39,9 @@ const firstUser = users.length > 0 ? users[0].name : null;
|
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
**Check:**
|
|
42
|
-
- [ ] Array.length check
|
|
43
|
-
- [ ] Empty array handling
|
|
44
|
-
- [ ] Object.keys() check
|
|
42
|
+
- [ ] Array.length check before accessing index?
|
|
43
|
+
- [ ] Empty array handling in map/filter/reduce?
|
|
44
|
+
- [ ] Object.keys() check before iterating?
|
|
45
45
|
|
|
46
46
|
#### Type Coercion
|
|
47
47
|
|
|
@@ -54,8 +54,8 @@ if (value !== null && value !== undefined) { }
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
**Check:**
|
|
57
|
-
- [ ] Strict equality (`===`)
|
|
58
|
-
- [ ] Explicit type checks
|
|
57
|
+
- [ ] Strict equality (`===`) instead of loose (`==`)?
|
|
58
|
+
- [ ] Explicit type checks for boolean logic?
|
|
59
59
|
- [ ] Number validation (isNaN, isFinite)?
|
|
60
60
|
|
|
61
61
|
### 2. Boundary Conditions
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Industry Techniques - Code Change Impact Analysis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compilation of techniques and tools for analyzing code change impacts from industry and research.
|
|
4
4
|
|
|
5
|
-
## 📚
|
|
5
|
+
## 📚 References
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Based on research and industry best practices from:
|
|
8
8
|
- Academic papers (ACM, ResearchGate, arXiv)
|
|
9
9
|
- Static analysis tools (NDepend, CppDepend, SonarQube)
|
|
10
10
|
- Software engineering practices
|
|
@@ -12,22 +12,22 @@ Dựa trên research và industry best practices từ:
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
## 🎯
|
|
15
|
+
## 🎯 Main Methods
|
|
16
16
|
|
|
17
17
|
### 1. Traceability-Based Impact Analysis
|
|
18
18
|
|
|
19
|
-
**
|
|
20
|
-
|
|
19
|
+
**Concept:**
|
|
20
|
+
Use links between requirements, specifications, design elements, and tests to determine scope of changes.
|
|
21
21
|
|
|
22
|
-
**
|
|
22
|
+
**How it works:**
|
|
23
23
|
```
|
|
24
24
|
Requirement → Design → Code → Tests
|
|
25
25
|
↓ ↓ ↓ ↓
|
|
26
26
|
Change → Impact → Affected → Test Cases
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
- Map code changes
|
|
29
|
+
**Application in Impact Analysis:**
|
|
30
|
+
- Map code changes to requirements
|
|
31
31
|
- Identify affected user stories
|
|
32
32
|
- Generate test scenarios từ requirements
|
|
33
33
|
|
|
@@ -53,10 +53,10 @@ Requirement → Design → Code → Tests
|
|
|
53
53
|
|
|
54
54
|
### 2. Dependency-Based Impact Analysis
|
|
55
55
|
|
|
56
|
-
**
|
|
57
|
-
|
|
56
|
+
**Concept:**
|
|
57
|
+
Analyze dependencies (imports, function calls, class usage) to find affected files.
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**How it works:**
|
|
60
60
|
|
|
61
61
|
#### A. Call Graph Analysis
|
|
62
62
|
```
|
|
@@ -92,7 +92,7 @@ Module B imports Module C
|
|
|
92
92
|
- **Madge** (JavaScript): Circular dependency detection
|
|
93
93
|
- **jdeps** (Java): Package dependencies
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
**Application:**
|
|
96
96
|
```bash
|
|
97
97
|
# Find all files importing authService
|
|
98
98
|
grep -r "from.*authService" src/
|
|
@@ -108,10 +108,10 @@ madge --image graph.png src/
|
|
|
108
108
|
|
|
109
109
|
### 3. AST-Based Impact Analysis
|
|
110
110
|
|
|
111
|
-
**
|
|
112
|
-
|
|
111
|
+
**Concept:**
|
|
112
|
+
Use Abstract Syntax Tree to analyze code structure and detect changes at semantic level.
|
|
113
113
|
|
|
114
|
-
**
|
|
114
|
+
**How it works:**
|
|
115
115
|
```
|
|
116
116
|
Source Code → Parser → AST → Analysis → Impact Report
|
|
117
117
|
```
|
|
@@ -147,9 +147,9 @@ function login(email, password, rememberMe) {
|
|
|
147
147
|
- **Python ast module**: Python AST analysis
|
|
148
148
|
- **Roslyn** (.NET): C# AST analysis
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
**Application:**
|
|
151
151
|
```javascript
|
|
152
|
-
|
|
152
|
+
# Detect function signature changes
|
|
153
153
|
const ast = parse(sourceCode);
|
|
154
154
|
ast.body.forEach(node => {
|
|
155
155
|
if (node.type === 'FunctionDeclaration') {
|
|
@@ -163,8 +163,8 @@ ast.body.forEach(node => {
|
|
|
163
163
|
|
|
164
164
|
### 4. Static Analysis-Based Impact
|
|
165
165
|
|
|
166
|
-
**
|
|
167
|
-
Analyze code without executing
|
|
166
|
+
**Concept:**
|
|
167
|
+
Analyze code without executing to detect issues, dependencies, and potential impacts.
|
|
168
168
|
|
|
169
169
|
**Techniques:**
|
|
170
170
|
|
|
@@ -244,10 +244,10 @@ interface User {
|
|
|
244
244
|
|
|
245
245
|
### 5. Model-Based Impact Analysis
|
|
246
246
|
|
|
247
|
-
**
|
|
248
|
-
|
|
247
|
+
**Concept:**
|
|
248
|
+
Use models (UML, architecture diagrams) to predict impact before coding.
|
|
249
249
|
|
|
250
|
-
**
|
|
250
|
+
**How it works:**
|
|
251
251
|
```
|
|
252
252
|
Architecture Model → Component Dependencies → Impact Prediction
|
|
253
253
|
```
|
|
@@ -272,10 +272,10 @@ Architecture Model → Component Dependencies → Impact Prediction
|
|
|
272
272
|
|
|
273
273
|
### 6. Test-Based Impact Analysis
|
|
274
274
|
|
|
275
|
-
**
|
|
276
|
-
|
|
275
|
+
**Concept:**
|
|
276
|
+
Use test coverage to identify affected tests and features.
|
|
277
277
|
|
|
278
|
-
**
|
|
278
|
+
**How it works:**
|
|
279
279
|
```
|
|
280
280
|
Code Change → Test Coverage Map → Affected Tests → Affected Features
|
|
281
281
|
```
|
|
@@ -299,7 +299,7 @@ Code Change → Test Coverage Map → Affected Tests → Affected Features
|
|
|
299
299
|
- **JaCoCo**: Java code coverage
|
|
300
300
|
- **Istanbul**: JavaScript coverage
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
**Application:**
|
|
303
303
|
```bash
|
|
304
304
|
# Run tests with coverage
|
|
305
305
|
npm test -- --coverage
|
|
@@ -315,10 +315,10 @@ jest --coverage --coverageReporters=html
|
|
|
315
315
|
|
|
316
316
|
### 7. Behavior-Driven Impact Analysis
|
|
317
317
|
|
|
318
|
-
**
|
|
319
|
-
Map code changes
|
|
318
|
+
**Concept:**
|
|
319
|
+
Map code changes to user behaviors and scenarios (BDD approach).
|
|
320
320
|
|
|
321
|
-
**
|
|
321
|
+
**How it works:**
|
|
322
322
|
```
|
|
323
323
|
Code Change → Feature Mapping → User Scenarios → Test Scenarios
|
|
324
324
|
```
|
|
@@ -367,8 +367,8 @@ describe('Biometric Login', () => {
|
|
|
367
367
|
|
|
368
368
|
### 8. Feature Mapping Techniques
|
|
369
369
|
|
|
370
|
-
**
|
|
371
|
-
Map code files
|
|
370
|
+
**Concept:**
|
|
371
|
+
Map code files to features and user actions.
|
|
372
372
|
|
|
373
373
|
**Techniques:**
|
|
374
374
|
|
|
@@ -423,10 +423,10 @@ export function login(email: string, password: string) {
|
|
|
423
423
|
|
|
424
424
|
### 9. Machine Learning-Based Impact Analysis
|
|
425
425
|
|
|
426
|
-
**
|
|
427
|
-
|
|
426
|
+
**Concept:**
|
|
427
|
+
Use ML models to predict impact based on historical data.
|
|
428
428
|
|
|
429
|
-
**
|
|
429
|
+
**How it works:**
|
|
430
430
|
```
|
|
431
431
|
Historical Changes + Outcomes → ML Model → Predict Impact
|
|
432
432
|
```
|
|
@@ -547,7 +547,7 @@ Code Change → Feature Impact → User Action Impact → Test Scenarios
|
|
|
547
547
|
|
|
548
548
|
### 4. Prioritize by Risk
|
|
549
549
|
|
|
550
|
-
|
|
550
|
+
Use risk scoring:
|
|
551
551
|
|
|
552
552
|
```javascript
|
|
553
553
|
const riskScore =
|
|
@@ -14,8 +14,8 @@ Document này cung cấp:
|
|
|
14
14
|
|
|
15
15
|
## 🎯 Technique #1: Dependency Analysis (MUST HAVE)
|
|
16
16
|
|
|
17
|
-
###
|
|
18
|
-
|
|
17
|
+
### Purpose
|
|
18
|
+
Find all files affected by code changes.
|
|
19
19
|
|
|
20
20
|
### Tools & Commands
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ Tìm tất cả files bị ảnh hưởng bởi code changes.
|
|
|
23
23
|
|
|
24
24
|
**1. Find Direct Imports**
|
|
25
25
|
```bash
|
|
26
|
-
#
|
|
26
|
+
# Find files importing modified module
|
|
27
27
|
grep -r "from.*authService" src/ --include="*.ts" --include="*.tsx"
|
|
28
28
|
grep -r "import.*authService" src/ --include="*.ts" --include="*.tsx"
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ rg "from.*authService" src/ -t ts -t tsx
|
|
|
33
33
|
|
|
34
34
|
**2. Find Function Calls**
|
|
35
35
|
```bash
|
|
36
|
-
#
|
|
36
|
+
# Find files calling modified function
|
|
37
37
|
grep -r "login\(" src/ --include="*.ts" --include="*.tsx"
|
|
38
38
|
|
|
39
39
|
# Exclude test files
|
|
@@ -57,7 +57,7 @@ madge src/services/authService.ts
|
|
|
57
57
|
|
|
58
58
|
**4. Find API Consumers**
|
|
59
59
|
```bash
|
|
60
|
-
#
|
|
60
|
+
# Find frontend components calling API
|
|
61
61
|
grep -r "fetch.*\/api\/auth" src/
|
|
62
62
|
grep -r "axios.*\/api\/auth" src/
|
|
63
63
|
grep -r "\/api\/auth" src/ --include="*.ts" --include="*.tsx"
|
|
@@ -67,7 +67,7 @@ grep -r "\/api\/auth" src/ --include="*.ts" --include="*.tsx"
|
|
|
67
67
|
|
|
68
68
|
**Find Component Usage**
|
|
69
69
|
```bash
|
|
70
|
-
#
|
|
70
|
+
# Find components using modified component
|
|
71
71
|
grep -r "<LoginButton" src/ --include="*.tsx"
|
|
72
72
|
grep -r "LoginButton" src/ --include="*.tsx" | grep "import"
|
|
73
73
|
```
|
|
@@ -111,8 +111,8 @@ grep -r "login(" . --include="*.py"
|
|
|
111
111
|
|
|
112
112
|
## 🎯 Technique #2: AST-Based Analysis (NICE TO HAVE)
|
|
113
113
|
|
|
114
|
-
###
|
|
115
|
-
|
|
114
|
+
### Purpose
|
|
115
|
+
Detect semantic changes (function signature, type changes, breaking changes).
|
|
116
116
|
|
|
117
117
|
### Tools & Setup
|
|
118
118
|
|
|
@@ -222,8 +222,8 @@ diff /tmp/before.json /tmp/after.json
|
|
|
222
222
|
|
|
223
223
|
## 🎯 Technique #3: Static Analysis (NICE TO HAVE)
|
|
224
224
|
|
|
225
|
-
###
|
|
226
|
-
|
|
225
|
+
### Purpose
|
|
226
|
+
Detect code quality issues, security issues, and potential bugs.
|
|
227
227
|
|
|
228
228
|
### Tools
|
|
229
229
|
|
|
@@ -284,8 +284,8 @@ sonar-scanner \
|
|
|
284
284
|
|
|
285
285
|
## 🎯 Technique #4: Test Coverage Analysis (SHOULD HAVE)
|
|
286
286
|
|
|
287
|
-
###
|
|
288
|
-
|
|
287
|
+
### Purpose
|
|
288
|
+
Find affected tests and identify untested code.
|
|
289
289
|
|
|
290
290
|
### Tools & Commands
|
|
291
291
|
|
|
@@ -370,8 +370,8 @@ pytest --collect-only | grep auth_service
|
|
|
370
370
|
|
|
371
371
|
## 🎯 Technique #5: Feature Mapping (MUST HAVE)
|
|
372
372
|
|
|
373
|
-
###
|
|
374
|
-
Map code changes
|
|
373
|
+
### Purpose
|
|
374
|
+
Map code changes to features and user actions.
|
|
375
375
|
|
|
376
376
|
### Implementation
|
|
377
377
|
|
|
@@ -478,8 +478,8 @@ function mapFeatures(changedFiles) {
|
|
|
478
478
|
|
|
479
479
|
## 🎯 Technique #6: Risk Scoring (SHOULD HAVE)
|
|
480
480
|
|
|
481
|
-
###
|
|
482
|
-
|
|
481
|
+
### Purpose
|
|
482
|
+
Assess risk level of changes.
|
|
483
483
|
|
|
484
484
|
### Algorithm
|
|
485
485
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Report Template -
|
|
1
|
+
# Report Template - Impact Analysis Report Template
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Standard template for impact analysis reports and test guidance.
|
|
4
4
|
|
|
5
5
|
## Full Report Template
|
|
6
6
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Impact Analysis Scripts
|
|
2
2
|
|
|
3
|
-
Helper scripts
|
|
3
|
+
Helper scripts for performing advanced impact analysis techniques.
|
|
4
4
|
|
|
5
5
|
## 📋 Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
These scripts implement industry techniques from `references/industry-techniques.md`:
|
|
8
8
|
|
|
9
9
|
1. **ast-analyze.js** - AST-based analysis (Technique #3)
|
|
10
10
|
2. **find-dependencies.sh** - Dependency analysis (Technique #2)
|
|
11
11
|
3. **calculate-risk.js** - Risk scoring (Technique #6)
|
|
12
|
-
4. **run-analysis.sh** - Master script
|
|
12
|
+
4. **run-analysis.sh** - Master script that runs all
|
|
13
13
|
|
|
14
14
|
## 🚀 Quick Start
|
|
15
15
|
|