@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,311 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: ♿ Kiểm tra Accessibility (WCAG)
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# WORKFLOW: /accessibility-audit - Accessibility Compliance Check
|
|
6
|
+
|
|
7
|
+
Đảm bảo ứng dụng accessible cho mọi người dùng, bao gồm người khuyết tật.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Tại sao quan trọng?
|
|
12
|
+
|
|
13
|
+
- **Legal**: Nhiều quốc gia yêu cầu accessibility
|
|
14
|
+
- **Market**: 15% dân số có khuyết tật
|
|
15
|
+
- **UX**: Accessibility tốt = UX tốt cho tất cả
|
|
16
|
+
- **SEO/ASO**: App Store ưu tiên apps accessible
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## WCAG 2.1 Level AA Checklist
|
|
21
|
+
|
|
22
|
+
### 1. Perceivable (Nhận biết được)
|
|
23
|
+
|
|
24
|
+
#### 1.1. Text Alternatives
|
|
25
|
+
- [ ] Tất cả images có alt text/content description
|
|
26
|
+
- [ ] Icons có labels
|
|
27
|
+
- [ ] Decorative images được đánh dấu
|
|
28
|
+
|
|
29
|
+
#### 1.2. Color Contrast
|
|
30
|
+
- [ ] Text contrast ratio ≥ 4.5:1 (normal text)
|
|
31
|
+
- [ ] Text contrast ratio ≥ 3:1 (large text 18pt+)
|
|
32
|
+
- [ ] UI components contrast ≥ 3:1
|
|
33
|
+
|
|
34
|
+
#### 1.3. Adaptable Content
|
|
35
|
+
- [ ] Hỗ trợ Dynamic Type (iOS) / Font Scaling (Android)
|
|
36
|
+
- [ ] Layout không break khi text size tăng
|
|
37
|
+
- [ ] Thông tin không phụ thuộc vào màu sắc
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 2. Operable (Vận hành được)
|
|
42
|
+
|
|
43
|
+
#### 2.1. Keyboard/Switch Control
|
|
44
|
+
- [ ] Tất cả functions accessible bằng keyboard/switch
|
|
45
|
+
- [ ] Focus order hợp lý
|
|
46
|
+
- [ ] Focus visible rõ ràng
|
|
47
|
+
|
|
48
|
+
#### 2.2. Touch Targets
|
|
49
|
+
- [ ] Minimum size: 44x44pt (iOS) / 48x48dp (Android)
|
|
50
|
+
- [ ] Spacing giữa targets ≥ 8pt/dp
|
|
51
|
+
|
|
52
|
+
#### 2.3. Timing
|
|
53
|
+
- [ ] Không có time limits (hoặc có thể tắt/điều chỉnh)
|
|
54
|
+
- [ ] Auto-playing content có thể pause
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### 3. Understandable (Dễ hiểu)
|
|
59
|
+
|
|
60
|
+
#### 3.1. Readable
|
|
61
|
+
- [ ] Language được khai báo
|
|
62
|
+
- [ ] Text rõ ràng, đơn giản
|
|
63
|
+
- [ ] Error messages hữu ích
|
|
64
|
+
|
|
65
|
+
#### 3.2. Predictable
|
|
66
|
+
- [ ] Navigation nhất quán
|
|
67
|
+
- [ ] Components hoạt động như mong đợi
|
|
68
|
+
- [ ] Không có unexpected changes
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### 4. Robust (Bền vững)
|
|
73
|
+
|
|
74
|
+
#### 4.1. Compatible
|
|
75
|
+
- [ ] Hoạt động với screen readers
|
|
76
|
+
- [ ] Semantic markup đúng
|
|
77
|
+
- [ ] Accessibility APIs được sử dụng đúng
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Testing Tools
|
|
82
|
+
|
|
83
|
+
### iOS - VoiceOver
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Enable VoiceOver
|
|
87
|
+
Settings → Accessibility → VoiceOver → ON
|
|
88
|
+
|
|
89
|
+
# Or triple-click side button (if configured)
|
|
90
|
+
Settings → Accessibility → Accessibility Shortcut → VoiceOver
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Testing Checklist:**
|
|
94
|
+
- [ ] Mọi element được đọc rõ ràng
|
|
95
|
+
- [ ] Swipe navigation hợp lý
|
|
96
|
+
- [ ] Custom controls hoạt động
|
|
97
|
+
- [ ] Images có alt text
|
|
98
|
+
- [ ] Buttons có labels
|
|
99
|
+
|
|
100
|
+
### Android - TalkBack
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Enable TalkBack
|
|
104
|
+
Settings → Accessibility → TalkBack → ON
|
|
105
|
+
|
|
106
|
+
# Or volume key shortcut
|
|
107
|
+
Settings → Accessibility → Volume key shortcut
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Testing Checklist:**
|
|
111
|
+
- [ ] Content descriptions đầy đủ
|
|
112
|
+
- [ ] Navigation logic
|
|
113
|
+
- [ ] Custom views accessible
|
|
114
|
+
- [ ] Proper heading structure
|
|
115
|
+
|
|
116
|
+
### Automated Tools
|
|
117
|
+
|
|
118
|
+
**iOS:**
|
|
119
|
+
```bash
|
|
120
|
+
# Accessibility Inspector
|
|
121
|
+
Xcode → Open Developer Tool → Accessibility Inspector
|
|
122
|
+
|
|
123
|
+
# Run audit
|
|
124
|
+
Select device → Audit → Run
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Android:**
|
|
128
|
+
```bash
|
|
129
|
+
# Accessibility Scanner
|
|
130
|
+
# Install from Play Store
|
|
131
|
+
# Enable → Scan screen → Review issues
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Common Issues & Fixes
|
|
137
|
+
|
|
138
|
+
### Issue 1: Missing Labels
|
|
139
|
+
|
|
140
|
+
**iOS**
|
|
141
|
+
```swift
|
|
142
|
+
// ❌ BAD
|
|
143
|
+
Image(systemName: "heart")
|
|
144
|
+
|
|
145
|
+
// ✅ GOOD
|
|
146
|
+
Image(systemName: "heart")
|
|
147
|
+
.accessibilityLabel("Favorite")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Android**
|
|
151
|
+
```kotlin
|
|
152
|
+
// ❌ BAD
|
|
153
|
+
Icon(Icons.Default.Favorite, contentDescription = null)
|
|
154
|
+
|
|
155
|
+
// ✅ GOOD
|
|
156
|
+
Icon(Icons.Default.Favorite, contentDescription = "Favorite")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**React Native**
|
|
160
|
+
```typescript
|
|
161
|
+
// ❌ BAD
|
|
162
|
+
<Image source={heartIcon} />
|
|
163
|
+
|
|
164
|
+
// ✅ GOOD
|
|
165
|
+
<Image
|
|
166
|
+
source={heartIcon}
|
|
167
|
+
accessible={true}
|
|
168
|
+
accessibilityLabel="Favorite"
|
|
169
|
+
/>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Issue 2: Low Contrast
|
|
173
|
+
|
|
174
|
+
```swift
|
|
175
|
+
// ❌ BAD: Gray text on light gray background
|
|
176
|
+
Text("Hello")
|
|
177
|
+
.foregroundColor(.gray)
|
|
178
|
+
.background(.gray.opacity(0.2))
|
|
179
|
+
|
|
180
|
+
// ✅ GOOD: High contrast
|
|
181
|
+
Text("Hello")
|
|
182
|
+
.foregroundColor(.primary) // Adapts to light/dark mode
|
|
183
|
+
.background(.background)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Issue 3: Small Touch Targets
|
|
187
|
+
|
|
188
|
+
```kotlin
|
|
189
|
+
// ❌ BAD: 24dp button
|
|
190
|
+
Button(
|
|
191
|
+
onClick = { },
|
|
192
|
+
modifier = Modifier.size(24.dp)
|
|
193
|
+
) { }
|
|
194
|
+
|
|
195
|
+
// ✅ GOOD: 48dp minimum
|
|
196
|
+
Button(
|
|
197
|
+
onClick = { },
|
|
198
|
+
modifier = Modifier.size(48.dp)
|
|
199
|
+
) { }
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Issue 4: Complex Custom Controls
|
|
203
|
+
|
|
204
|
+
```swift
|
|
205
|
+
// ✅ GOOD: Proper accessibility for custom slider
|
|
206
|
+
struct CustomSlider: View {
|
|
207
|
+
@State private var value: Double = 0.5
|
|
208
|
+
|
|
209
|
+
var body: some View {
|
|
210
|
+
// Custom slider UI
|
|
211
|
+
sliderView
|
|
212
|
+
.accessibilityElement()
|
|
213
|
+
.accessibilityLabel("Volume")
|
|
214
|
+
.accessibilityValue("\(Int(value * 100))%")
|
|
215
|
+
.accessibilityAdjustableAction { direction in
|
|
216
|
+
switch direction {
|
|
217
|
+
case .increment:
|
|
218
|
+
value = min(value + 0.1, 1.0)
|
|
219
|
+
case .decrement:
|
|
220
|
+
value = max(value - 0.1, 0.0)
|
|
221
|
+
@unknown default:
|
|
222
|
+
break
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Audit Report Template
|
|
232
|
+
|
|
233
|
+
```markdown
|
|
234
|
+
# Accessibility Audit Report
|
|
235
|
+
Date: 2026-01-27
|
|
236
|
+
App Version: 1.0.0
|
|
237
|
+
Auditor: [Name]
|
|
238
|
+
|
|
239
|
+
## Summary
|
|
240
|
+
- Total Issues: 15
|
|
241
|
+
- Critical: 3
|
|
242
|
+
- High: 5
|
|
243
|
+
- Medium: 7
|
|
244
|
+
- Low: 0
|
|
245
|
+
|
|
246
|
+
## Critical Issues
|
|
247
|
+
|
|
248
|
+
### 1. Login button has no label
|
|
249
|
+
**Screen**: Login
|
|
250
|
+
**Issue**: Button not accessible to screen readers
|
|
251
|
+
**Fix**: Add accessibilityLabel
|
|
252
|
+
**Priority**: P0
|
|
253
|
+
**Status**: ❌ Open
|
|
254
|
+
|
|
255
|
+
### 2. Color-only error indication
|
|
256
|
+
**Screen**: Form validation
|
|
257
|
+
**Issue**: Errors shown only with red color
|
|
258
|
+
**Fix**: Add error icon and text
|
|
259
|
+
**Priority**: P0
|
|
260
|
+
**Status**: ❌ Open
|
|
261
|
+
|
|
262
|
+
## High Priority Issues
|
|
263
|
+
[...]
|
|
264
|
+
|
|
265
|
+
## Recommendations
|
|
266
|
+
1. Add accessibility tests to CI
|
|
267
|
+
2. Train team on accessibility
|
|
268
|
+
3. Regular audits (quarterly)
|
|
269
|
+
4. User testing with assistive tech users
|
|
270
|
+
|
|
271
|
+
## Compliance Status
|
|
272
|
+
- WCAG 2.1 Level A: ✅ Pass
|
|
273
|
+
- WCAG 2.1 Level AA: ⚠️ Partial (85%)
|
|
274
|
+
- WCAG 2.1 Level AAA: ❌ Not assessed
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Best Practices
|
|
280
|
+
|
|
281
|
+
### 1. Design for Accessibility
|
|
282
|
+
|
|
283
|
+
- Use system fonts (support Dynamic Type)
|
|
284
|
+
- Ensure 4.5:1 contrast minimum
|
|
285
|
+
- Make touch targets 44x44pt minimum
|
|
286
|
+
- Don't rely on color alone
|
|
287
|
+
|
|
288
|
+
### 2. Test Early and Often
|
|
289
|
+
|
|
290
|
+
- Test with VoiceOver/TalkBack weekly
|
|
291
|
+
- Include accessibility in QA checklist
|
|
292
|
+
- Get feedback from users with disabilities
|
|
293
|
+
|
|
294
|
+
### 3. Educate Team
|
|
295
|
+
|
|
296
|
+
- Accessibility training for designers
|
|
297
|
+
- Code review for accessibility
|
|
298
|
+
- Share accessibility guidelines
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Resources
|
|
303
|
+
|
|
304
|
+
- [Apple Accessibility](https://developer.apple.com/accessibility/)
|
|
305
|
+
- [Android Accessibility](https://developer.android.com/guide/topics/ui/accessibility)
|
|
306
|
+
- [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
307
|
+
- [WebAIM Contrast Checker](https://webaim.org/resources/contrastchecker/)
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
**Next Steps**: Fix critical issues → Re-test → Document compliance
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 🔍 Review thay đổi trước commit - Kiểm tra bảo mật, đa ngôn ngữ & chất lượng code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /audit - Pre-Commit Code Review
|
|
6
|
+
|
|
7
|
+
**Mục đích:** Review tất cả thay đổi code trước khi commit, tập trung vào 3 vấn đề chính:
|
|
8
|
+
1. 🛡️ **Bảo mật**: Hardcoded secrets, API keys, sensitive data
|
|
9
|
+
2. 🌐 **Đa ngôn ngữ**: Hardcoded strings trong UI (phải dùng localization)
|
|
10
|
+
3. ✅ **Chất lượng**: Architecture, performance, testing
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 🚀 Cách sử dụng
|
|
15
|
+
|
|
16
|
+
### Expert Mode (Tự động)
|
|
17
|
+
```bash
|
|
18
|
+
/audit --auto # Tự động quét và báo cáo
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Guided Mode (Chi tiết)
|
|
22
|
+
```bash
|
|
23
|
+
/audit # Hướng dẫn từng bước
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Phase 1: Xác định thay đổi
|
|
29
|
+
|
|
30
|
+
// turbo
|
|
31
|
+
```bash
|
|
32
|
+
# Kiểm tra các file đã thay đổi
|
|
33
|
+
git status
|
|
34
|
+
git diff --stat HEAD
|
|
35
|
+
git diff --name-only HEAD
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Output mong đợi:** Danh sách file đã sửa.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2: Kiểm tra 3 vấn đề chính
|
|
43
|
+
|
|
44
|
+
### 🛡️ 1. BẢO MẬT (Critical)
|
|
45
|
+
|
|
46
|
+
#### Checklist:
|
|
47
|
+
- [ ] Không có hardcoded API keys, secrets, passwords
|
|
48
|
+
- [ ] Dữ liệu nhạy cảm dùng Keychain (iOS) / EncryptedSharedPreferences (Android)
|
|
49
|
+
- [ ] Không log sensitive data (token, password)
|
|
50
|
+
- [ ] Input validation đúng cách
|
|
51
|
+
|
|
52
|
+
#### Script tự động quét:
|
|
53
|
+
// turbo
|
|
54
|
+
```bash
|
|
55
|
+
echo "🔍 Scanning for security issues..."
|
|
56
|
+
|
|
57
|
+
# 1. Hardcoded secrets
|
|
58
|
+
echo "\n1️⃣ Checking hardcoded secrets..."
|
|
59
|
+
git diff HEAD | grep -E "api_key|secret|password|token" | grep -v "^-" | grep -v "//"
|
|
60
|
+
|
|
61
|
+
# 2. Sensitive data in logs
|
|
62
|
+
echo "\n2️⃣ Checking logs for sensitive data..."
|
|
63
|
+
git diff HEAD --name-only | xargs grep -n "print\|Log\." 2>/dev/null | grep -iE "token|password|key"
|
|
64
|
+
|
|
65
|
+
# 3. Keychain/Secure storage check (iOS)
|
|
66
|
+
echo "\n3️⃣ Checking for proper secure storage (iOS)..."
|
|
67
|
+
git diff HEAD | grep -E "UserDefaults|NSUserDefaults" | grep -v "^-"
|
|
68
|
+
|
|
69
|
+
# 4. Keychain/Secure storage check (Android)
|
|
70
|
+
echo "\n4️⃣ Checking for proper secure storage (Android)..."
|
|
71
|
+
git diff HEAD | grep -E "SharedPreferences" | grep -v "Encrypted" | grep -v "^-"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**🔴 CRITICAL nếu tìm thấy vấn đề:** DỪNG ngay, không được commit!
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### 🌐 2. ĐA NGÔN NGỮ (High Priority)
|
|
79
|
+
|
|
80
|
+
#### Checklist:
|
|
81
|
+
- [ ] Không có hardcoded strings trong UI
|
|
82
|
+
- [ ] Tất cả text hiển thị dùng localization keys
|
|
83
|
+
- [ ] iOS: Dùng `LocalizedStringKey` hoặc `NSLocalizedString`
|
|
84
|
+
- [ ] Android: Dùng `R.string.xxx` hoặc `stringResource()`
|
|
85
|
+
|
|
86
|
+
#### Script tự động quét:
|
|
87
|
+
// turbo
|
|
88
|
+
```bash
|
|
89
|
+
echo "\n🌐 Scanning for hardcoded strings..."
|
|
90
|
+
|
|
91
|
+
# iOS - SwiftUI Text with hardcoded strings
|
|
92
|
+
echo "\n1️⃣ iOS: Checking SwiftUI Text..."
|
|
93
|
+
git diff HEAD --name-only "*.swift" | xargs grep -nE 'Text\("' 2>/dev/null | grep -v "LocalizedStringKey" | grep -v "^-"
|
|
94
|
+
|
|
95
|
+
# iOS - UILabel with hardcoded strings
|
|
96
|
+
echo "\n2️⃣ iOS: Checking UILabel..."
|
|
97
|
+
git diff HEAD --name-only "*.swift" | xargs grep -nE '\.text = "' 2>/dev/null | grep -v "NSLocalizedString" | grep -v "^-"
|
|
98
|
+
|
|
99
|
+
# Android - Kotlin hardcoded strings
|
|
100
|
+
echo "\n3️⃣ Android: Checking Kotlin..."
|
|
101
|
+
git diff HEAD --name-only "*.kt" | xargs grep -nE 'text = "' 2>/dev/null | grep -v "stringResource\|R.string" | grep -v "^-"
|
|
102
|
+
|
|
103
|
+
# Android - XML hardcoded strings
|
|
104
|
+
echo "\n4️⃣ Android: Checking XML..."
|
|
105
|
+
git diff HEAD --name-only "*.xml" | xargs grep -nE 'android:text="[^@]' 2>/dev/null | grep -v "^-"
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**🟠 HIGH PRIORITY nếu tìm thấy:** Phải sửa trước khi commit!
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### ✅ 3. CHẤT LƯỢNG CODE (Medium Priority)
|
|
113
|
+
|
|
114
|
+
#### Checklist:
|
|
115
|
+
- [ ] Functions < 50 lines
|
|
116
|
+
- [ ] Classes < 500 lines
|
|
117
|
+
- [ ] No code duplication
|
|
118
|
+
- [ ] Proper error handling
|
|
119
|
+
- [ ] No commented-out code
|
|
120
|
+
- [ ] No TODO/FIXME left behind
|
|
121
|
+
|
|
122
|
+
#### Script tự động quét:
|
|
123
|
+
// turbo
|
|
124
|
+
```bash
|
|
125
|
+
echo "\n✅ Checking code quality..."
|
|
126
|
+
|
|
127
|
+
# 1. TODO/FIXME
|
|
128
|
+
echo "\n1️⃣ Checking for TODO/FIXME..."
|
|
129
|
+
git diff HEAD --name-only | xargs grep -nE "TODO|FIXME" 2>/dev/null
|
|
130
|
+
|
|
131
|
+
# 2. Commented code
|
|
132
|
+
echo "\n2️⃣ Checking for commented code blocks..."
|
|
133
|
+
git diff HEAD | grep -E "^\+.*//.*func |^\+.*//.*class " | head -10
|
|
134
|
+
|
|
135
|
+
# 3. Long functions (approximate)
|
|
136
|
+
echo "\n3️⃣ Checking for potentially long functions..."
|
|
137
|
+
git diff HEAD --name-only "*.swift" "*.kt" | xargs -I {} sh -c 'echo "\n{}" && grep -n "func \|fun " {} | head -5'
|
|
138
|
+
|
|
139
|
+
# 4. Missing tests for new code
|
|
140
|
+
echo "\n4️⃣ Checking if tests are updated..."
|
|
141
|
+
if git diff HEAD --name-only | grep -qE "\.swift$|\.kt$"; then
|
|
142
|
+
if ! git diff HEAD --name-only | grep -qE "Test\.swift$|Test\.kt$"; then
|
|
143
|
+
echo "⚠️ WARNING: Production code changed but no test files modified"
|
|
144
|
+
fi
|
|
145
|
+
fi
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**🟡 MEDIUM PRIORITY:** Nên sửa nhưng không block commit.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Phase 3: Báo cáo kết quả
|
|
153
|
+
|
|
154
|
+
```markdown
|
|
155
|
+
# 📊 AUDIT REPORT
|
|
156
|
+
|
|
157
|
+
## 🛡️ Bảo mật
|
|
158
|
+
- ✅ Không phát hiện vấn đề / ❌ Tìm thấy X vấn đề
|
|
159
|
+
|
|
160
|
+
## 🌐 Đa ngôn ngữ
|
|
161
|
+
- ✅ Tất cả strings đã localized / ❌ Tìm thấy X hardcoded strings
|
|
162
|
+
|
|
163
|
+
## ✅ Chất lượng
|
|
164
|
+
- ✅ Code clean / ⚠️ Tìm thấy X vấn đề nhỏ
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 🚦 QUYẾT ĐỊNH:
|
|
169
|
+
- 🟢 **READY TO COMMIT** - Không có vấn đề critical
|
|
170
|
+
- 🟡 **FIX RECOMMENDED** - Có warnings, nên sửa nhưng có thể commit
|
|
171
|
+
- 🔴 **MUST FIX** - Có critical issues, KHÔNG được commit!
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Phase 4: Hành động tiếp theo
|
|
177
|
+
|
|
178
|
+
**Nếu 🟢 READY:**
|
|
179
|
+
```markdown
|
|
180
|
+
1️⃣ Tiếp tục commit (`/smart-git-ops` hoặc `git commit`)
|
|
181
|
+
2️⃣ Xem lại danh sách thay đổi (`git diff --staged`)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Nếu 🟡 FIX RECOMMENDED:**
|
|
185
|
+
```markdown
|
|
186
|
+
1️⃣ Xem chi tiết vấn đề (scroll up)
|
|
187
|
+
2️⃣ Sửa ngay (`/code`)
|
|
188
|
+
3️⃣ Tạo task để sửa sau (`bd create "Fix warnings"`)
|
|
189
|
+
4️⃣ Bỏ qua và commit (KHÔNG khuyến khích)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Nếu 🔴 MUST FIX:**
|
|
193
|
+
```markdown
|
|
194
|
+
❌ DỪNG! Không được commit.
|
|
195
|
+
|
|
196
|
+
🔧 Hành động bắt buộc:
|
|
197
|
+
1. Sửa tất cả vấn đề bảo mật
|
|
198
|
+
2. Localize tất cả hardcoded strings
|
|
199
|
+
3. Chạy lại /audit
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## 🧠 Brain Integration
|
|
205
|
+
|
|
206
|
+
Sau mỗi lần audit:
|
|
207
|
+
- Lưu báo cáo vào `brain/reports/audit_[timestamp].md`
|
|
208
|
+
- Track lỗi lặp lại → Gợi ý tạo rule tự động
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## ⚠️ LƯU Ý QUAN TRỌNG
|
|
213
|
+
|
|
214
|
+
1. **LUÔN chạy `/audit` trước khi commit code**
|
|
215
|
+
2. **Ưu tiên sửa theo thứ tự:** 🛡️ Bảo mật → 🌐 Đa ngôn ngữ → ✅ Chất lượng
|
|
216
|
+
3. **Không bỏ qua vấn đề 🔴 Critical**
|
|
217
|
+
4. **Nếu không chắc:** Hỏi trước, đừng commit sau
|