@leejungkiin/awkit 1.0.0
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/CHANGELOG.md +27 -0
- package/README.md +146 -0
- package/VERSION +1 -0
- package/bin/awf.js +549 -0
- package/bin/awk.js +1759 -0
- package/core/AGENTS.md +39 -0
- package/core/GEMINI.md +202 -0
- package/core/GEMINI.md.bak +244 -0
- package/core/orchestrator.md +58 -0
- package/package.json +46 -0
- package/schemas/brain.schema.json +342 -0
- package/schemas/preferences.schema.json +95 -0
- package/schemas/session.schema.json +112 -0
- package/skill-packs/neural-memory/README.md +111 -0
- package/skill-packs/neural-memory/pack.json +35 -0
- package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
- package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
- package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
- package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
- package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
- package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
- package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
- package/skills/adaptive-language/SKILL.md +189 -0
- package/skills/ambient-brain/SKILL.md +314 -0
- package/skills/ambient-brain/brain-router.md +185 -0
- package/skills/ambient-brain/brain-templates.md +201 -0
- package/skills/auto-save/SKILL.md +223 -0
- package/skills/awf-adaptive-language/SKILL.md +189 -0
- package/skills/awf-context-help/SKILL.md +180 -0
- package/skills/awf-error-translator/SKILL.md +153 -0
- package/skills/awf-session-restore/SKILL.md +270 -0
- package/skills/awf-version-tracker/SKILL.md +32 -0
- package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
- package/skills/beads-manager/SKILL.md +323 -0
- package/skills/brainstorm-agent/SKILL.md +295 -0
- package/skills/context-help/SKILL.md +180 -0
- package/skills/error-translator/SKILL.md +153 -0
- package/skills/ios-engineer/SKILL.md +101 -0
- package/skills/memory-sync/SKILL.md +378 -0
- package/skills/memory-sync/memory-router.md +185 -0
- package/skills/memory-sync/memory-templates.md +201 -0
- package/skills/orchestrator/SKILL.md +193 -0
- package/skills/session-restore/SKILL.md +240 -0
- package/templates/CODEBASE.md +80 -0
- package/templates/brain.example.json +321 -0
- package/templates/preferences.example.json +21 -0
- package/templates/project-identity/android.json +28 -0
- package/templates/project-identity/backend-nestjs.json +24 -0
- package/templates/project-identity/expo.json +27 -0
- package/templates/project-identity/ios.json +27 -0
- package/templates/project-identity/web-nextjs.json +24 -0
- package/templates/session.example.json +53 -0
- package/templates/specs/design-template.md +166 -0
- package/templates/specs/requirements-template.md +65 -0
- package/templates/specs/tasks-template.md +132 -0
- package/templates/structures/android.txt +10 -0
- package/templates/structures/backend-nestjs.txt +6 -0
- package/templates/structures/expo.txt +9 -0
- package/templates/structures/ios.txt +9 -0
- package/templates/structures/web-nextjs.txt +6 -0
- package/templates/workflow_dual_mode_template.md +87 -0
- package/workflows/_uncategorized/README.md +339 -0
- package/workflows/_uncategorized/ads-creative.md +357 -0
- package/workflows/_uncategorized/ads-full-optimization.md +308 -0
- package/workflows/_uncategorized/ads-plan.md +247 -0
- package/workflows/_uncategorized/ads-user-analysis.md +337 -0
- package/workflows/_uncategorized/skill-health.md +35 -0
- package/workflows/_uncategorized/skill-rollback.md +35 -0
- package/workflows/ads/admob.md +62 -0
- package/workflows/ads/ads-analyst.md +201 -0
- package/workflows/ads/ads-audit.md +106 -0
- package/workflows/ads/ads-optimize.md +97 -0
- package/workflows/ads/ads-targeting.md +241 -0
- package/workflows/ads/adsExpert.md +160 -0
- package/workflows/ads/smali-ads-config.md +400 -0
- package/workflows/ads/smali-ads-flow.md +331 -0
- package/workflows/ads/smali-ads-interstitial.md +377 -0
- package/workflows/ads/smali-ads-native.md +382 -0
- package/workflows/context/auto-execution-workflow.md +291 -0
- package/workflows/context/auto-implement.md +211 -0
- package/workflows/context/codebase-sync.md +163 -0
- package/workflows/context/logic-reasoning-workflow.md +260 -0
- package/workflows/context/next.md +195 -0
- package/workflows/context/recap.md +212 -0
- package/workflows/context/save-brain.md +285 -0
- package/workflows/context/user-intent-analysis-workflow.md +206 -0
- package/workflows/expert/codeExpert.md +126 -0
- package/workflows/expert/debugExpert.md +136 -0
- package/workflows/expert/planExpert.md +112 -0
- package/workflows/git/cloudflare-tunnel.md +135 -0
- package/workflows/git/git-commit-workflow.md +75 -0
- package/workflows/git/hotfix.md +357 -0
- package/workflows/git/release-notes.md +160 -0
- package/workflows/git/rollback.md +52 -0
- package/workflows/git/smart-git-ops.md +103 -0
- package/workflows/lifecycle/brainstorm.md +377 -0
- package/workflows/lifecycle/code.md +663 -0
- package/workflows/lifecycle/debug.md +116 -0
- package/workflows/lifecycle/deploy.md +95 -0
- package/workflows/lifecycle/init.md +152 -0
- package/workflows/lifecycle/master-code-workflow.md +300 -0
- package/workflows/lifecycle/migration.md +196 -0
- package/workflows/lifecycle/plan.md +91 -0
- package/workflows/lifecycle/refactor.md +165 -0
- package/workflows/lifecycle/run.md +52 -0
- package/workflows/lifecycle/test.md +91 -0
- package/workflows/meta/customize.md +346 -0
- package/workflows/meta/file-protection-rules.md +129 -0
- package/workflows/meta/help.html +350 -0
- package/workflows/meta/project-identity-enforcement.md +180 -0
- package/workflows/mobile/app-analysis.md +64 -0
- package/workflows/mobile/maestro-qa-workflow.md +470 -0
- package/workflows/mobile/maestro-test-workflow.md +84 -0
- package/workflows/mobile/structure-clean-architect.md +271 -0
- package/workflows/mobile/turbo-mobile-build.md +190 -0
- package/workflows/quality/accessibility-audit.md +311 -0
- package/workflows/quality/audit.md +217 -0
- package/workflows/quality/bug-hunter.md +243 -0
- package/workflows/quality/code-janitor.md +209 -0
- package/workflows/quality/code-quality-rules.md +132 -0
- package/workflows/quality/performance-audit.md +343 -0
- package/workflows/quality/project-audit.md +61 -0
- package/workflows/quality/self-healing-test.md +192 -0
- package/workflows/quality/ui-review.md +130 -0
- package/workflows/quality/ux-audit.md +213 -0
- package/workflows/quality/visual-debug.md +34 -0
- package/workflows/roles/oracle.md +267 -0
- package/workflows/roles/product-manager-workflow.md +52 -0
- package/workflows/roles/qa-engineer-workflow.md +41 -0
- package/workflows/roles/tech-lead-workflow.md +45 -0
- package/workflows/roles/ui-ux-designer-workflow.md +42 -0
- package/workflows/roles/vibe-coding-master-workflow.md +52 -0
- package/workflows/ui/app-screen-analyzer.md +152 -0
- package/workflows/ui/create-feature.md +332 -0
- package/workflows/ui/create-spec-architect.md +184 -0
- package/workflows/ui/design-to-ui.md +308 -0
- package/workflows/ui/ui-first-methodology.md +279 -0
- package/workflows/ui/visualize.md +298 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: ⚡ Phân tích & Tối ưu Performance
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WORKFLOW: /performance-audit - Performance Analysis & Optimization
|
|
6
|
+
|
|
7
|
+
Phân tích hiệu suất ứng dụng và đưa ra đề xuất tối ưu hóa.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Khi nào cần audit?
|
|
12
|
+
|
|
13
|
+
- App chạy chậm
|
|
14
|
+
- Battery drain cao
|
|
15
|
+
- Memory leaks
|
|
16
|
+
- Trước khi release
|
|
17
|
+
- Sau khi thêm tính năng lớn
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Giai đoạn 1: Profiling
|
|
22
|
+
|
|
23
|
+
### iOS - Instruments
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. Build for Profiling
|
|
27
|
+
# Xcode → Product → Profile (⌘I)
|
|
28
|
+
|
|
29
|
+
# 2. Choose template:
|
|
30
|
+
# - Time Profiler: CPU usage
|
|
31
|
+
# - Allocations: Memory usage
|
|
32
|
+
# - Leaks: Memory leaks
|
|
33
|
+
# - Energy Log: Battery usage
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Key Metrics:**
|
|
37
|
+
- CPU usage < 50% average
|
|
38
|
+
- Memory < 200MB for simple apps
|
|
39
|
+
- Frame rate: 60 FPS (16.67ms per frame)
|
|
40
|
+
- Launch time < 400ms
|
|
41
|
+
|
|
42
|
+
### Android - Profiler
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Android Studio → View → Tool Windows → Profiler
|
|
46
|
+
|
|
47
|
+
# Or command line:
|
|
48
|
+
adb shell am profile start <package> /data/local/tmp/profile.trace
|
|
49
|
+
# ... use app ...
|
|
50
|
+
adb shell am profile stop <package>
|
|
51
|
+
adb pull /data/local/tmp/profile.trace
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Key Metrics:**
|
|
55
|
+
- CPU usage < 40% average
|
|
56
|
+
- Memory < 150MB for simple apps
|
|
57
|
+
- Frame time < 16ms (60 FPS)
|
|
58
|
+
- Startup time < 500ms
|
|
59
|
+
|
|
60
|
+
### React Native - Flipper
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Install Flipper
|
|
64
|
+
brew install --cask flipper
|
|
65
|
+
|
|
66
|
+
# Run with Flipper
|
|
67
|
+
npx react-native run-ios
|
|
68
|
+
# or
|
|
69
|
+
npx react-native run-android
|
|
70
|
+
|
|
71
|
+
# Open Flipper → Connect to app
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Giai đoạn 2: Identify Bottlenecks
|
|
77
|
+
|
|
78
|
+
### Common Issues
|
|
79
|
+
|
|
80
|
+
| Issue | Symptoms | Tools |
|
|
81
|
+
|-------|----------|-------|
|
|
82
|
+
| **Slow rendering** | Janky scrolling, low FPS | Time Profiler, GPU Profiler |
|
|
83
|
+
| **Memory leaks** | Increasing memory, crashes | Allocations, Leaks |
|
|
84
|
+
| **Heavy computations** | High CPU, battery drain | Time Profiler |
|
|
85
|
+
| **Large images** | Slow loading, high memory | Network profiler |
|
|
86
|
+
| **Inefficient queries** | Slow data loading | Database profiler |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Giai đoạn 3: Optimization Strategies
|
|
91
|
+
|
|
92
|
+
### 3.1. Rendering Performance
|
|
93
|
+
|
|
94
|
+
**iOS (SwiftUI)**
|
|
95
|
+
```swift
|
|
96
|
+
// ❌ BAD: Re-renders entire list
|
|
97
|
+
ForEach(items) { item in
|
|
98
|
+
HeavyView(item: item)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ✅ GOOD: Use lazy loading
|
|
102
|
+
LazyVStack {
|
|
103
|
+
ForEach(items) { item in
|
|
104
|
+
HeavyView(item: item)
|
|
105
|
+
.id(item.id) // Stable identity
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Android (Compose)**
|
|
111
|
+
```kotlin
|
|
112
|
+
// ❌ BAD: Recomposition on every state change
|
|
113
|
+
@Composable
|
|
114
|
+
fun ItemList(items: List<Item>) {
|
|
115
|
+
Column {
|
|
116
|
+
items.forEach { item ->
|
|
117
|
+
HeavyItem(item)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ✅ GOOD: Use LazyColumn with keys
|
|
123
|
+
@Composable
|
|
124
|
+
fun ItemList(items: List<Item>) {
|
|
125
|
+
LazyColumn {
|
|
126
|
+
items(items, key = { it.id }) { item ->
|
|
127
|
+
HeavyItem(item)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**React Native**
|
|
134
|
+
```typescript
|
|
135
|
+
// ❌ BAD: FlatList without optimization
|
|
136
|
+
<FlatList
|
|
137
|
+
data={items}
|
|
138
|
+
renderItem={({ item }) => <HeavyComponent item={item} />}
|
|
139
|
+
/>
|
|
140
|
+
|
|
141
|
+
// ✅ GOOD: Optimized FlatList
|
|
142
|
+
<FlatList
|
|
143
|
+
data={items}
|
|
144
|
+
renderItem={({ item }) => <HeavyComponent item={item} />}
|
|
145
|
+
keyExtractor={(item) => item.id}
|
|
146
|
+
removeClippedSubviews={true}
|
|
147
|
+
maxToRenderPerBatch={10}
|
|
148
|
+
windowSize={5}
|
|
149
|
+
getItemLayout={(data, index) => ({
|
|
150
|
+
length: ITEM_HEIGHT,
|
|
151
|
+
offset: ITEM_HEIGHT * index,
|
|
152
|
+
index,
|
|
153
|
+
})}
|
|
154
|
+
/>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 3.2. Image Optimization
|
|
158
|
+
|
|
159
|
+
**iOS**
|
|
160
|
+
```swift
|
|
161
|
+
// Use appropriate image size
|
|
162
|
+
Image("photo")
|
|
163
|
+
.resizable()
|
|
164
|
+
.aspectRatio(contentMode: .fill)
|
|
165
|
+
.frame(width: 100, height: 100)
|
|
166
|
+
.clipped()
|
|
167
|
+
|
|
168
|
+
// Lazy loading
|
|
169
|
+
AsyncImage(url: URL(string: imageURL)) { image in
|
|
170
|
+
image.resizable()
|
|
171
|
+
} placeholder: {
|
|
172
|
+
ProgressView()
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Android**
|
|
177
|
+
```kotlin
|
|
178
|
+
// Use Coil for efficient image loading
|
|
179
|
+
AsyncImage(
|
|
180
|
+
model = imageUrl,
|
|
181
|
+
contentDescription = null,
|
|
182
|
+
modifier = Modifier.size(100.dp),
|
|
183
|
+
contentScale = ContentScale.Crop
|
|
184
|
+
)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**React Native**
|
|
188
|
+
```typescript
|
|
189
|
+
// Use FastImage
|
|
190
|
+
import FastImage from 'react-native-fast-image';
|
|
191
|
+
|
|
192
|
+
<FastImage
|
|
193
|
+
source={{ uri: imageUrl, priority: FastImage.priority.normal }}
|
|
194
|
+
style={{ width: 100, height: 100 }}
|
|
195
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
196
|
+
/>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 3.3. Memory Management
|
|
200
|
+
|
|
201
|
+
**iOS**
|
|
202
|
+
```swift
|
|
203
|
+
// Use weak references to avoid retain cycles
|
|
204
|
+
class ViewModel: ObservableObject {
|
|
205
|
+
private var cancellables = Set<AnyCancellable>()
|
|
206
|
+
|
|
207
|
+
func fetchData() {
|
|
208
|
+
apiService.getData()
|
|
209
|
+
.sink { [weak self] data in
|
|
210
|
+
self?.updateUI(data)
|
|
211
|
+
}
|
|
212
|
+
.store(in: &cancellables)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Android**
|
|
218
|
+
```kotlin
|
|
219
|
+
// Use lifecycle-aware components
|
|
220
|
+
class MyViewModel : ViewModel() {
|
|
221
|
+
private val _data = MutableLiveData<Data>()
|
|
222
|
+
val data: LiveData<Data> = _data
|
|
223
|
+
|
|
224
|
+
override fun onCleared() {
|
|
225
|
+
// Clean up resources
|
|
226
|
+
super.onCleared()
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 3.4. Database Optimization
|
|
232
|
+
|
|
233
|
+
**iOS (SwiftData)**
|
|
234
|
+
```swift
|
|
235
|
+
// Use indexes
|
|
236
|
+
@Model
|
|
237
|
+
class User {
|
|
238
|
+
@Attribute(.unique) var id: UUID
|
|
239
|
+
@Attribute(.indexed) var email: String // Index for faster queries
|
|
240
|
+
var name: String
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Batch operations
|
|
244
|
+
let users = try context.fetch(FetchDescriptor<User>())
|
|
245
|
+
context.delete(users) // Batch delete
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Android (Room)**
|
|
249
|
+
```kotlin
|
|
250
|
+
@Entity(indices = [Index(value = ["email"], unique = true)])
|
|
251
|
+
data class User(
|
|
252
|
+
@PrimaryKey val id: String,
|
|
253
|
+
val email: String,
|
|
254
|
+
val name: String
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
// Use transactions for batch operations
|
|
258
|
+
@Transaction
|
|
259
|
+
suspend fun updateUsers(users: List<User>) {
|
|
260
|
+
users.forEach { userDao.update(it) }
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Giai đoạn 4: Measure Improvements
|
|
267
|
+
|
|
268
|
+
### Before/After Comparison
|
|
269
|
+
|
|
270
|
+
```markdown
|
|
271
|
+
## Performance Audit Report
|
|
272
|
+
|
|
273
|
+
### Metrics Before Optimization
|
|
274
|
+
- App launch: 800ms
|
|
275
|
+
- Memory usage: 250MB
|
|
276
|
+
- FPS: 45 average
|
|
277
|
+
- CPU usage: 65%
|
|
278
|
+
|
|
279
|
+
### Optimizations Applied
|
|
280
|
+
1. Implemented lazy loading for lists
|
|
281
|
+
2. Optimized image loading with caching
|
|
282
|
+
3. Fixed memory leaks in ViewModels
|
|
283
|
+
4. Added database indexes
|
|
284
|
+
|
|
285
|
+
### Metrics After Optimization
|
|
286
|
+
- App launch: 400ms ✅ (50% improvement)
|
|
287
|
+
- Memory usage: 150MB ✅ (40% reduction)
|
|
288
|
+
- FPS: 58 average ✅ (29% improvement)
|
|
289
|
+
- CPU usage: 35% ✅ (46% reduction)
|
|
290
|
+
|
|
291
|
+
### Recommendations
|
|
292
|
+
- [ ] Monitor memory in production
|
|
293
|
+
- [ ] Add performance tests to CI
|
|
294
|
+
- [ ] Profile quarterly
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## Giai đoạn 5: Continuous Monitoring
|
|
300
|
+
|
|
301
|
+
### Setup Analytics
|
|
302
|
+
|
|
303
|
+
```swift
|
|
304
|
+
// iOS - Track performance metrics
|
|
305
|
+
func trackPerformance() {
|
|
306
|
+
let launchTime = Date().timeIntervalSince(appLaunchTime)
|
|
307
|
+
Analytics.logEvent("app_launch_time", parameters: [
|
|
308
|
+
"duration_ms": launchTime * 1000
|
|
309
|
+
])
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```kotlin
|
|
314
|
+
// Android
|
|
315
|
+
class PerformanceMonitor {
|
|
316
|
+
fun trackStartup() {
|
|
317
|
+
val duration = SystemClock.elapsedRealtime() - startTime
|
|
318
|
+
FirebasePerformance.getInstance()
|
|
319
|
+
.newTrace("app_startup")
|
|
320
|
+
.apply {
|
|
321
|
+
putMetric("duration_ms", duration)
|
|
322
|
+
start()
|
|
323
|
+
stop()
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Checklist
|
|
332
|
+
|
|
333
|
+
- [ ] Profile with platform tools
|
|
334
|
+
- [ ] Identify top 3 bottlenecks
|
|
335
|
+
- [ ] Implement optimizations
|
|
336
|
+
- [ ] Measure improvements
|
|
337
|
+
- [ ] Setup continuous monitoring
|
|
338
|
+
- [ ] Document findings
|
|
339
|
+
- [ ] Add performance tests
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
**Next Steps**: `/test` để verify optimizations không break functionality
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Quét toàn bộ dự án để đánh giá mức độ hoàn thiện, phát hiện logic thiếu sót, và tạo báo cáo tổng quan kèm đề xuất test Maestro.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Project Comprehensive Audit Workflow 🕵️♂️
|
|
6
|
+
|
|
7
|
+
## 1. Khởi động & Nhận diện 🚩
|
|
8
|
+
1. **Đọc ngữ cảnh dự án**:
|
|
9
|
+
- Đọc file `.project-identity` (nếu có) để hiểu Tech Stack và Roadmap.
|
|
10
|
+
- Đọc file `App.swift` hoặc `SceneDelegate.swift` để xác định điểm entry của ứng dụng.
|
|
11
|
+
2. **Bản đồ cấu trúc**:
|
|
12
|
+
- Dùng `list_dir` (recursive hoặc depth=3) để nắm cấu trúc thư mục chính: `Core`, `Features`, `UI`, `Services`, `Models`.
|
|
13
|
+
- Xác định mô hình kiến trúc đang dùng (MVVM, VIPER, TCA, v.v.).
|
|
14
|
+
|
|
15
|
+
## 2. Quét độ hoàn thiện (Static Analysis) 🔍
|
|
16
|
+
1. **Tìm "Nợ kỹ thuật" & Placeholder**:
|
|
17
|
+
- Dùng `grep_search` tìm các từ khóa: `TODO`, `FIXME`, `fatalError`, `print(`, `Coming soon`, `placeholder`.
|
|
18
|
+
- Phát hiện các function/class rỗng hoặc chưa implement logic.
|
|
19
|
+
2. **Kiểm tra tính kết nối**:
|
|
20
|
+
- View có ViewModel không?
|
|
21
|
+
- Service có được inject vào ViewModel không? (Kiểm tra xem có hardcode singleton không mong muốn không).
|
|
22
|
+
3. **Kiểm tra tài nguyên**:
|
|
23
|
+
- Kiểm tra `Assets.xcassets` (sơ bộ) xem có ảnh thiếu hay tên không chuẩn không.
|
|
24
|
+
|
|
25
|
+
## 3. Phân tích chức năng (Feature Gap Analysis) 🧩
|
|
26
|
+
Dựa trên cấu trúc thư mục và code thực tế, lập bảng so sánh:
|
|
27
|
+
- **Tính năng đã có**: (Ví dụ: Auth, Home, Settings).
|
|
28
|
+
- **Trạng thái**:
|
|
29
|
+
- 🟢 **Done**: Logic đầy đủ, UI hoàn thiện.
|
|
30
|
+
- 🟡 **In Progress**: Có UI nhưng logic mock/hardcode.
|
|
31
|
+
- 🔴 **Missing**: Có trong plan/identity nhưng chưa thấy code.
|
|
32
|
+
- ⚪️ **Unknown**: Code rác, không rõ mục đích.
|
|
33
|
+
|
|
34
|
+
## 4. Kiểm thử giao diện thực tế (Maestro Integration) 📱
|
|
35
|
+
*Bước này yêu cầu Maestro đã được cài đặt (`brew install maestro`).*
|
|
36
|
+
|
|
37
|
+
1. **Đề xuất kịch bản test (Test Plan)**:
|
|
38
|
+
- Dựa trên các màn hình đã quét được, đề xuất 1 flow kiểm thử chính (Critical Path). Ví dụ: `Login -> Home -> Detail -> Back`.
|
|
39
|
+
2. **Tạo/Chạy Maestro Flow**:
|
|
40
|
+
- Tạo file tạm `audit_flow.yaml`.
|
|
41
|
+
- Chạy lệnh: `maestro test audit_flow.yaml`. (Nếu user đồng ý và môi trường sẵn sàng).
|
|
42
|
+
- *Lưu ý: Nếu không chạy được Maestro, chuyển sang phân tích code tĩnh sâu hơn.*
|
|
43
|
+
|
|
44
|
+
## 5. Báo cáo & Đề xuất (Final Report) bằng tiếng Việt 📝
|
|
45
|
+
Tổng hợp kết quả thành báo cáo Markdown:
|
|
46
|
+
|
|
47
|
+
### 📊 Báo cáo tiến độ dự án [Tên Dự Án]
|
|
48
|
+
| Tính năng | Trạng thái | Ghi chú (Lỗi/Thiếu/Cần tối ưu) |
|
|
49
|
+
| :--- | :--- | :--- |
|
|
50
|
+
| Authentication | 🟢 Done | Đã có login/register, chưa có forgot password |
|
|
51
|
+
| User Profile | 🟡 Partial | UI xong, chưa lưu data xuống DB |
|
|
52
|
+
| ... | ... | ... |
|
|
53
|
+
|
|
54
|
+
### 🛠 Đề xuất hành động
|
|
55
|
+
1. **Ưu tiên cao**: [Các crash tiềm ẩn, logic sai].
|
|
56
|
+
2. **Cần làm ngay**: [Các tính năng còn đang dang dở].
|
|
57
|
+
3. **Tối ưu**: [Refactor code rác, UI chưa mượt].
|
|
58
|
+
|
|
59
|
+
### 🤖 Lệnh tiếp theo
|
|
60
|
+
- `bd create "Fix logic ABC"`
|
|
61
|
+
- `/create-feature "Tên tính năng còn thiếu"`
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Tự động chạy lại, phát hiện lỗi và vá mã nguồn cho bài test XCTest/JUnit/Jest.
|
|
3
|
+
safe_auto_run: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /self-healing-test - Mobile Test Loop
|
|
7
|
+
|
|
8
|
+
A sophisticated workflow that doesn't just fail on error, but attempts to fix the test or the code.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Phase 1: Test Execution
|
|
13
|
+
// turbo
|
|
14
|
+
|
|
15
|
+
### iOS (XCTest)
|
|
16
|
+
```bash
|
|
17
|
+
xcodebuild test \
|
|
18
|
+
-workspace *.xcworkspace \
|
|
19
|
+
-scheme [Scheme] \
|
|
20
|
+
-destination 'platform=iOS Simulator,name=iPhone 15 Pro' \
|
|
21
|
+
-only-testing:[TestTarget]/[TestClass]/[testMethod]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Android (JUnit / Espresso)
|
|
25
|
+
```bash
|
|
26
|
+
# Unit tests
|
|
27
|
+
./gradlew testDebugUnitTest --tests "[TestClass]"
|
|
28
|
+
|
|
29
|
+
# Instrumented tests
|
|
30
|
+
./gradlew connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=[TestClass]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Expo (Jest)
|
|
34
|
+
```bash
|
|
35
|
+
npm test -- --testPathPattern="[pattern]" --watch=false
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Phase 2: Failure Interception
|
|
41
|
+
|
|
42
|
+
If test fails:
|
|
43
|
+
|
|
44
|
+
### 2.1. Capture Artifacts
|
|
45
|
+
// turbo
|
|
46
|
+
- **iOS**: Capture simulator screenshot, test logs
|
|
47
|
+
- **Android**: Capture emulator screenshot, logcat
|
|
48
|
+
- **Expo**: Capture test output
|
|
49
|
+
|
|
50
|
+
### 2.2. Analyze Failure Type
|
|
51
|
+
|
|
52
|
+
| Type | Pattern | Strategy |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
| **Selector Not Found** | "Unable to find element" | Update test selector |
|
|
55
|
+
| **Assertion Failed** | "Expected X but got Y" | Fix implementation |
|
|
56
|
+
| **Timeout** | "Timed out waiting" | Add wait, check async |
|
|
57
|
+
| **Null/Nil Error** | "unexpectedly found nil" | Add null check |
|
|
58
|
+
| **API Error** | "Network request failed" | Check mock setup |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Phase 3: The "Heal" Step
|
|
63
|
+
|
|
64
|
+
### Case A: Selector Not Found (UI Changed)
|
|
65
|
+
1. **Read UI file** to find current element
|
|
66
|
+
2. **Update test file** with new selector:
|
|
67
|
+
|
|
68
|
+
**iOS:**
|
|
69
|
+
```swift
|
|
70
|
+
// Before
|
|
71
|
+
app.buttons["oldButton"].tap()
|
|
72
|
+
|
|
73
|
+
// After (find new accessibilityIdentifier)
|
|
74
|
+
app.buttons["newButton"].tap()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Android:**
|
|
78
|
+
```kotlin
|
|
79
|
+
// Before
|
|
80
|
+
onView(withId(R.id.oldButton)).perform(click())
|
|
81
|
+
|
|
82
|
+
// After
|
|
83
|
+
onView(withId(R.id.newButton)).perform(click())
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Case B: Assertion Failed (Logic Bug)
|
|
87
|
+
1. **Analyze expected vs actual**
|
|
88
|
+
2. **Locate function** causing wrong output
|
|
89
|
+
3. **Apply fix** to implementation
|
|
90
|
+
|
|
91
|
+
### Case C: Timeout (Async Issue)
|
|
92
|
+
1. **Add explicit wait:**
|
|
93
|
+
|
|
94
|
+
**iOS:**
|
|
95
|
+
```swift
|
|
96
|
+
let exists = element.waitForExistence(timeout: 5)
|
|
97
|
+
XCTAssertTrue(exists)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Android:**
|
|
101
|
+
```kotlin
|
|
102
|
+
IdlingRegistry.getInstance().register(idlingResource)
|
|
103
|
+
// or use Espresso IdlingResource
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Expo:**
|
|
107
|
+
```typescript
|
|
108
|
+
await waitFor(() => expect(element).toBeVisible());
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Phase 4: Retry Loop
|
|
114
|
+
// turbo
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Loop (max 3 iterations):
|
|
118
|
+
1. Run failing test
|
|
119
|
+
2. If PASS → Break, report success
|
|
120
|
+
3. If FAIL → Analyze, Apply fix
|
|
121
|
+
4. Increment counter
|
|
122
|
+
|
|
123
|
+
If still failing after 3 attempts:
|
|
124
|
+
→ Abort and report to user
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Phase 5: Success Actions
|
|
130
|
+
|
|
131
|
+
### If Healed:
|
|
132
|
+
// turbo
|
|
133
|
+
1. **Report fix:**
|
|
134
|
+
```
|
|
135
|
+
✅ Test Healed!
|
|
136
|
+
|
|
137
|
+
Test: [TestName]
|
|
138
|
+
Issue: [Selector not found]
|
|
139
|
+
Fix: Updated accessibilityIdentifier in [File]
|
|
140
|
+
Attempts: 2
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
2. **Auto-commit (optional):**
|
|
144
|
+
```bash
|
|
145
|
+
git add .
|
|
146
|
+
git commit -m "test: auto-heal fix for [TestName]"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### If Not Healed:
|
|
150
|
+
```
|
|
151
|
+
❌ Could Not Auto-Heal
|
|
152
|
+
|
|
153
|
+
Test: [TestName]
|
|
154
|
+
Attempts: 3
|
|
155
|
+
Last Error: [Error details]
|
|
156
|
+
|
|
157
|
+
Possible Issues:
|
|
158
|
+
- Complex logic error requiring manual review
|
|
159
|
+
- Missing mock data
|
|
160
|
+
- Environment configuration
|
|
161
|
+
|
|
162
|
+
Recommendation: Use /debug for manual investigation
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Phase 6: Test Coverage Check (Optional)
|
|
168
|
+
|
|
169
|
+
After healing, optionally run coverage:
|
|
170
|
+
|
|
171
|
+
### iOS
|
|
172
|
+
```bash
|
|
173
|
+
xcodebuild test -enableCodeCoverage YES ...
|
|
174
|
+
xcrun xccov view --report build/Logs/Test/*.xcresult
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Android
|
|
178
|
+
```bash
|
|
179
|
+
./gradlew jacocoTestReport
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Expo
|
|
183
|
+
```bash
|
|
184
|
+
npm test -- --coverage
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## ⚠️ NEXT STEPS:
|
|
190
|
+
- All tests pass → `/deploy` or continue coding
|
|
191
|
+
- Tests still failing → `/debug` for manual fix
|
|
192
|
+
- Want more tests → `/feature-completion` with TDD
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Đánh giá thành phần giao diện, phân tích tính năng và kiểm tra triển khai logic.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /ui-review - The Visual Inspector
|
|
6
|
+
|
|
7
|
+
You are **Antigravity Creative Director**. User has a "Vibe" but doesn't know professional terminology.
|
|
8
|
+
|
|
9
|
+
**Mission:** Transform "Vibe" into beautiful, usable, professional interface.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Phase 1: Vibe Styling (Understand the Vibe)
|
|
14
|
+
|
|
15
|
+
### 1.1. Ask about Style
|
|
16
|
+
"What kind of look do you want?"
|
|
17
|
+
- A) **Clean, Minimal** (Light, spacious)
|
|
18
|
+
- B) **Luxury, Dark** (Premium, sophisticated)
|
|
19
|
+
- C) **Colorful, Playful** (Young, energetic)
|
|
20
|
+
- D) **Corporate, Formal** (Professional, business)
|
|
21
|
+
- E) **Tech, Futuristic** (Modern, cutting-edge)
|
|
22
|
+
|
|
23
|
+
### 1.2. Ask about Colors
|
|
24
|
+
- "Any preferred main color? (Or match company logo?)"
|
|
25
|
+
- "Light mode or Dark mode?"
|
|
26
|
+
|
|
27
|
+
### 1.3. Ask about Shapes
|
|
28
|
+
- "Rounded corners (soft) or sharp corners (edgy)?"
|
|
29
|
+
- "Need shadow effects for depth?"
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Phase 2: Hidden UX Discovery
|
|
34
|
+
|
|
35
|
+
Many Vibe Coders don't think about these. AI must proactively ask:
|
|
36
|
+
|
|
37
|
+
### 2.1. Device Usage
|
|
38
|
+
"Will users mainly use Phone or Computer?"
|
|
39
|
+
- Phone → Mobile-first, large buttons, hamburger menu
|
|
40
|
+
- Computer → Sidebar, wide data tables
|
|
41
|
+
|
|
42
|
+
### 2.2. Loading States
|
|
43
|
+
"What to show while loading data?"
|
|
44
|
+
- A) Spinner (circle)
|
|
45
|
+
- B) Progress bar
|
|
46
|
+
- C) Skeleton (looks professional)
|
|
47
|
+
|
|
48
|
+
### 2.3. Empty States
|
|
49
|
+
"What to show when no data? (e.g., empty cart)"
|
|
50
|
+
- AI designs beautiful Empty State with illustration + CTA
|
|
51
|
+
|
|
52
|
+
### 2.4. Error States
|
|
53
|
+
"How to show errors?"
|
|
54
|
+
- A) Popup in center
|
|
55
|
+
- B) Banner at top
|
|
56
|
+
- C) Toast notification in corner
|
|
57
|
+
|
|
58
|
+
### 2.5. Accessibility (Users often forget)
|
|
59
|
+
"Need screen reader support?"
|
|
60
|
+
AI will AUTOMATICALLY:
|
|
61
|
+
- Ensure color contrast (WCAG AA)
|
|
62
|
+
- Add alt text for images
|
|
63
|
+
- Enable keyboard navigation
|
|
64
|
+
|
|
65
|
+
### 2.6. Dark Mode
|
|
66
|
+
"Need dark mode?"
|
|
67
|
+
- If YES → AI designs both versions
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Phase 3: Reference & Inspiration
|
|
72
|
+
|
|
73
|
+
### 3.1. Find Inspiration
|
|
74
|
+
"Any website/app you find beautiful to reference?"
|
|
75
|
+
- If YES → AI analyzes and learns the style
|
|
76
|
+
- If NO → AI finds suitable inspiration
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Phase 4: Mockup Generation
|
|
81
|
+
|
|
82
|
+
### 4.1. Create Mockup
|
|
83
|
+
1. Compose detailed prompt for `generate_image`:
|
|
84
|
+
- Colors (hex codes)
|
|
85
|
+
- Layout (Grid, Cards, Sidebar)
|
|
86
|
+
- Typography (Font style)
|
|
87
|
+
- Spacing, Shadows, Borders
|
|
88
|
+
2. Call `generate_image` to create mockup
|
|
89
|
+
3. Show User: "Does this match your vision?"
|
|
90
|
+
|
|
91
|
+
### 4.2. Iteration (Repeat if needed)
|
|
92
|
+
- User: "Too dark" → AI increases brightness, redraws
|
|
93
|
+
- User: "Boring" → AI adds spacing, shadows
|
|
94
|
+
- User: "Colors too bright" → AI reduces saturation
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Phase 5: Pixel-Perfect Implementation
|
|
99
|
+
|
|
100
|
+
### 5.1. Component Breakdown
|
|
101
|
+
- Decompose mockup into Components (Header, Sidebar, Card, Button...)
|
|
102
|
+
|
|
103
|
+
### 5.2. Code Implementation
|
|
104
|
+
Write CSS/SwiftUI/Compose to recreate EXACTLY like mockup:
|
|
105
|
+
- Responsive (Desktop + Tablet + Mobile)
|
|
106
|
+
- Hover effects
|
|
107
|
+
- Smooth transitions/animations
|
|
108
|
+
- Loading states
|
|
109
|
+
- Error states
|
|
110
|
+
- Empty states
|
|
111
|
+
|
|
112
|
+
### 5.3. Accessibility Check
|
|
113
|
+
- Verify color contrast
|
|
114
|
+
- Add ARIA labels / accessibilityLabel
|
|
115
|
+
- Test keyboard navigation
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Phase 6: Handover
|
|
120
|
+
|
|
121
|
+
1. "UI is ready. Preview in browser/simulator."
|
|
122
|
+
2. "Try on mobile device too."
|
|
123
|
+
3. "Need any adjustments?"
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## ⚠️ NEXT STEPS:
|
|
128
|
+
- UI OK → `/code` or `/feature-completion` to add logic
|
|
129
|
+
- Need adjustments → Continue in `/ui-review`
|
|
130
|
+
- Display issues → `/debug`
|