@haposoft/cafekit 0.8.15 → 0.8.17

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.
@@ -1,245 +0,0 @@
1
- ---
2
- description: Update existing documentation to match current codebase. Use when code has changed and docs are out of sync, or after adding new features.
3
- ---
4
-
5
- # /docs-update - Update Project Documentation
6
-
7
- ## Overview
8
-
9
- This workflow updates all documentation to reflect the current state of the codebase:
10
- - Re-analyzes project structure
11
- - Updates all 7 documentation files
12
- - Syncs AGENTS.md with latest changes
13
- - Creates backup before updating
14
-
15
- ## ⚠️ IMPORTANT: Execute Immediately
16
-
17
- **DO NOT create an implementation plan.** This workflow should be executed directly without planning mode.
18
- - Run all steps sequentially
19
- - Update files immediately as described
20
- - No approval needed between steps
21
-
22
- ---
23
-
24
- ## Step 1: Verify Prerequisites
25
-
26
- **Check if docs/ exists:**
27
- ```bash
28
- ls docs/ 2>/dev/null || echo "ERROR: Run '/docs-init' first"
29
- ```
30
-
31
- **If docs/ not found:**
32
- - Stop and prompt: "❌ docs/ not found. Run `/docs-init` first to create documentation."
33
-
34
- ---
35
-
36
- ## Step 2: Create Backup
37
-
38
- // turbo
39
- ```bash
40
- cp -r docs docs.backup.$(date +%Y%m%d_%H%M%S)
41
- echo "Backup created: docs.backup.{timestamp}"
42
- ```
43
-
44
- ---
45
-
46
- ## Step 3: Ensure Repomix Available
47
-
48
- **Check if repomix is installed:**
49
- ```bash
50
- which repomix 2>/dev/null || npm list -g repomix 2>/dev/null
51
- ```
52
-
53
- **If repomix not found:**
54
- - Detect package manager:
55
- ```bash
56
- test -f pnpm-lock.yaml && PM="pnpm"
57
- test -f yarn.lock && PM="yarn"
58
- test -f bun.lockb && PM="bun"
59
- PM="${PM:-npm}"
60
- ```
61
-
62
- // turbo
63
- - Run `$PM install -g repomix`
64
-
65
- ---
66
-
67
- ## Step 4: Re-analyze Codebase
68
-
69
- // turbo
70
- ```bash
71
- repomix
72
- ls -la ./repomix-output.xml
73
- ```
74
-
75
- **Detect recent changes:**
76
- ```bash
77
- git diff --stat HEAD~5..HEAD 2>/dev/null || echo "No git history"
78
- ```
79
-
80
- ---
81
-
82
- ## Step 5: Read Current Documentation
83
-
84
- Read all existing docs to understand what needs updating:
85
- - `docs/codebase-summary.md`
86
- - `docs/project-overview-pdr.md`
87
- - `docs/code-standards.md`
88
- - `docs/system-architecture.md`
89
- - `docs/design-guidelines.md`
90
- - `docs/deployment-guide.md`
91
- - `docs/project-roadmap.md`
92
- - `.agent/rules/AGENTS.md` (if exists)
93
-
94
- ---
95
-
96
- ## Step 6: Detect Updated Project Info
97
-
98
- **Re-read config files:**
99
- - `package.json` - check for new scripts, dependencies, version changes
100
- - `pyproject.toml`, `go.mod`, etc. - based on project type
101
- - Check for new directories or removed ones
102
-
103
- **Detect changes:**
104
- - New frameworks/libraries added
105
- - Version updates
106
- - New scripts
107
- - Structure changes
108
- - New deployment configs
109
- - New database schemas
110
-
111
- ---
112
-
113
- ## Step 7: Update Documentation Files
114
-
115
- ### 7.1 Update docs/codebase-summary.md
116
-
117
- **Refresh:**
118
- - File count and token count from repomix
119
- - Tech stack versions (from package.json)
120
- - Directory structure if changed
121
- - Timestamp
122
-
123
- ### 7.2 Update docs/project-overview-pdr.md
124
-
125
- **Add:**
126
- - New features detected in codebase
127
- - Updated description if changed
128
- - Any new capabilities
129
-
130
- ### 7.3 Update docs/code-standards.md
131
-
132
- **Sync:**
133
- - New patterns detected in code
134
- - Updated conventions
135
- - New linting rules if config changed
136
-
137
- ### 7.4 Update docs/system-architecture.md
138
-
139
- **Update:**
140
- - New components or services
141
- - Changed data flows
142
- - New API endpoints
143
- - Database schema changes
144
-
145
- ### 7.5 Update docs/design-guidelines.md
146
-
147
- **Refresh:**
148
- - New UI components
149
- - Updated styling patterns
150
- - Theme changes
151
-
152
- ### 7.6 Update docs/deployment-guide.md
153
-
154
- **Update:**
155
- - New environment variables
156
- - Changed deployment commands
157
- - Platform updates
158
-
159
- ### 7.7 Update docs/project-roadmap.md
160
-
161
- **Progress tracking:**
162
- - Mark completed items
163
- - Add new tasks based on TODOs found
164
- - Update technical debt section
165
-
166
- ---
167
-
168
- ## Step 8: Update .agent/rules/AGENTS.md
169
-
170
- **Check if .agent/rules/AGENTS.md exists:**
171
- ```bash
172
- test -f .agent/rules/AGENTS.md && cat .agent/rules/AGENTS.md || echo "NOT_FOUND"
173
- ```
174
-
175
- **If exists - Update sections:**
176
- - **Tech Stack** - Update versions, add new dependencies
177
- - **Key Directories** - Add new directories
178
- - **Quick Commands** - Sync with package.json scripts
179
- - **Last Updated** - Refresh timestamp
180
-
181
- **If not exists - Create new:**
182
- - Use same template as in `/docs-init`
183
- - Or skip if user không muốn tạo
184
-
185
- **Note:** `.agent/rules/AGENTS.md` với `activation: always_on` sẽ luôn active trong Antigravity.
186
-
187
- ---
188
-
189
- ## Step 9: Clean Up
190
-
191
- // turbo
192
- **Remove old repomix if needed:**
193
- ```bash
194
- # Keep repomix-output.xml for AI context
195
- ls -la repomix-output.xml
196
- ```
197
-
198
- ---
199
-
200
- ## Step 10: Generate Report
201
-
202
- **Output success message:**
203
-
204
- ```
205
- 🔄 Documentation updated!
206
-
207
- 💾 Backup: docs.backup.{timestamp}/
208
-
209
- 📊 Changes:
210
- - Files: {old_count} → {new_count}
211
- - Tokens: {old_tokens} → {new_tokens}
212
-
213
- 📝 Updated:
214
- ✓ codebase-summary.md
215
- ✓ project-overview-pdr.md
216
- ✓ code-standards.md
217
- ✓ system-architecture.md
218
- ✓ design-guidelines.md
219
- ✓ deployment-guide.md
220
- ✓ project-roadmap.md
221
- ✓ .agent/rules/AGENTS.md (if exists)
222
-
223
- 💡 Review docs/ for any manual adjustments needed
224
- ```
225
-
226
- ---
227
-
228
- ## Error Handling
229
-
230
- | Scenario | Action |
231
- |----------|--------|
232
- | docs/ not found | Prompt to run `/docs-init` |
233
- | repomix fails | Continue with manual analysis |
234
- | Permission denied | Report path, suggest sudo/fix |
235
- | Conflicts detected | Ask user which version to keep |
236
-
237
- ---
238
-
239
- ## Notes
240
-
241
- - Always create backup before updating
242
- - Merge existing content with new analysis
243
- - Preserve manual edits when possible
244
- - Update timestamp on all modified files
245
- - Keep repomix-output.xml for AI context
@@ -1,313 +0,0 @@
1
- # Ví Dụ Output: Phân Tích Impact - Thêm Xác Thực Sinh Trắc Học
2
-
3
- > Đây là ví dụ output mẫu từ workflow Impact Analysis cho một thay đổi code thực tế.
4
- >
5
- > **Thay đổi**: Thêm tính năng xác thực sinh trắc học (Face ID/Touch ID) vào app React Native
6
- >
7
- > **Files thay đổi**: 5 files (auth service, login screen, biometric helper, profile settings, token storage)
8
-
9
- ---
10
-
11
- ## 📋 Tóm Tắt Nhanh
12
-
13
- **Mức độ rủi ro**: CAO ⚠️⚠️⚠️
14
-
15
- **Tác động chính**:
16
- - 🆕 Tính năng mới: Đăng nhập bằng Face ID/Touch ID
17
- - ⚠️ Breaking change: Format lưu token đã thay đổi
18
- - 🔄 Migration cần thiết: User hiện tại có thể phải đăng nhập lại
19
-
20
- **Thời gian ước tính**:
21
- - Sửa bugs: ~2 giờ
22
- - Testing: ~45 phút
23
- - Production-ready: 3-4 giờ
24
-
25
- **Vấn đề nghiêm trọng**: 3 bugs cần sửa trước khi deploy
26
-
27
- ---
28
-
29
- ## 🎯 Tính Năng Bị Ảnh Hưởng
30
-
31
- ### 1. Đăng Nhập (NGHIÊM TRỌNG) ⚠️⚠️⚠️
32
-
33
- **Hành động người dùng:**
34
- - ✓ Đăng nhập email/password (vẫn hoạt động)
35
- - 🆕 Đăng nhập bằng Face ID/Touch ID (tính năng mới)
36
- - ⚠️ Phiên hiện tại có thể bị mất (breaking change)
37
-
38
- **Tác động:**
39
- Thêm option đăng nhập bằng sinh trắc học. Đăng nhập email/password vẫn hoạt động nhưng cách lưu token đã thay đổi, có thể làm mất phiên hiện tại. User có thể phải đăng nhập lại sau khi update.
40
-
41
- **Người dùng sẽ thấy:**
42
- - Nút "Đăng nhập bằng Face ID" mới trên màn hình login
43
- - Prompt sinh trắc học khi tap nút
44
- - Đăng nhập nhanh hơn (không cần gõ password)
45
- - Có thể phải đăng nhập lại sau update app
46
-
47
- **Breaking changes:**
48
- - Format lưu token đã thay đổi
49
- - Phiên hiện tại có thể bị vô hiệu
50
- - User cần bật lại sinh trắc học sau update
51
-
52
- ---
53
-
54
- ### 2. Hồ Sơ Người Dùng (TRUNG BÌNH) ⚠️
55
-
56
- **Hành động người dùng:**
57
- - ✓ Xem hồ sơ (không đổi)
58
- - ✓ Sửa hồ sơ (không đổi)
59
- - 🆕 Bật/Tắt sinh trắc học (setting mới)
60
-
61
- **Tác động:**
62
- Thêm setting mới để bật/tắt xác thực sinh trắc học trong cài đặt hồ sơ.
63
-
64
- **Người dùng sẽ thấy:**
65
- - Toggle mới trong Settings: "Đăng nhập bằng sinh trắc học"
66
- - Prompt xin permission khi bật lần đầu
67
- - Có thể tắt bất cứ lúc nào
68
-
69
- ---
70
-
71
- ## 🎬 Scenarios Người Dùng
72
-
73
- ### Scenario 1: Đăng Nhập Bằng Face ID (Flow Mới)
74
- **Khi người dùng:**
75
- 1. Mở app
76
- 2. Tap nút "Đăng nhập bằng Face ID"
77
- 3. Nhìn vào camera (Face ID) hoặc đặt ngón tay (Touch ID)
78
-
79
- **Sẽ thấy:**
80
- - iOS: Prompt Face ID xuất hiện
81
- - Android: Prompt vân tay xuất hiện
82
- - Xác thực thành công → Đăng nhập
83
- - Xác thực thất bại → Hiện lỗi, cho thử lại hoặc dùng password
84
-
85
- **Cần test:** NGHIÊM TRỌNG ⚠️⚠️⚠️
86
- - Test trên cả iOS và Android
87
- - Test khi thành công
88
- - Test khi thất bại
89
- - Test khi chưa đăng ký sinh trắc học
90
- - Test khi từ chối permission
91
-
92
- ---
93
-
94
- ### Scenario 2: User Hiện Tại Mở App Sau Update
95
- **Khi người dùng:**
96
- 1. Đã đăng nhập trên app cũ
97
- 2. Update lên version mới (có sinh trắc học)
98
- 3. Mở app
99
-
100
- **Có thể thấy:**
101
- - Phiên bị mất → Phải đăng nhập lại
102
- - Hoặc: Phiên vẫn còn → Thấy option sinh trắc học mới
103
-
104
- **Cần test:** NGHIÊM TRỌNG ⚠️⚠️⚠️
105
- - Test migration phiên
106
- - Test user không bị logout
107
- - Test hiển thị option mới
108
-
109
- ---
110
-
111
- ### Scenario 3: Bật Sinh Trắc Học Trong Settings
112
- **Khi người dùng:**
113
- 1. Vào Profile > Settings
114
- 2. Tap toggle "Đăng nhập bằng sinh trắc học"
115
-
116
- **Sẽ thấy:**
117
- - iOS: Prompt xin permission (nếu chưa cho)
118
- - Android: Kiểm tra đã đăng ký vân tay chưa
119
- - Thành công: Sinh trắc học được bật
120
- - Thất bại: Hiện lỗi rõ ràng
121
-
122
- **Cần test:** QUAN TRỌNG ⚠️
123
- - Test permission flow
124
- - Test khi chưa đăng ký sinh trắc học
125
- - Test khi từ chối permission
126
-
127
- ---
128
-
129
- ### Scenario 4: Sinh Trắc Học Thất Bại
130
- **Khi người dùng:**
131
- 1. Tap "Đăng nhập bằng Face ID"
132
- 2. Xác thực thất bại (sai mặt/ngón tay)
133
-
134
- **Sẽ thấy:**
135
- - Thông báo lỗi
136
- - Option "Thử lại" hoặc "Dùng Password"
137
- - Không bị kẹt màn hình
138
-
139
- **Cần test:** QUAN TRỌNG ⚠️
140
-
141
- ---
142
-
143
- ### Scenario 5: Thiết Bị Không Hỗ Trợ
144
- **Khi người dùng:**
145
- 1. Mở app trên thiết bị không có sinh trắc học
146
-
147
- **Sẽ thấy:**
148
- - Nút sinh trắc học bị ẩn
149
- - Chỉ có option đăng nhập password
150
- - Thông báo: "Bật Face ID trong Settings để dùng tính năng này"
151
-
152
- **Cần test:** BÌNH THƯỜNG
153
-
154
- ---
155
-
156
- ## ⚠️ Vấn Đề Cần Sửa
157
-
158
- ### Nghiêm Trọng (3)
159
-
160
- **1. iOS Chưa Xin Permission Đúng Cách**
161
- - **Vị trí**: `src/utils/biometric/biometricHelper.ts:45`
162
- - **Vấn đề**: iOS cần xin permission trong Info.plist và runtime, nhưng code chỉ check availability
163
- - **Tác động**: Sinh trắc học sẽ fail trên iOS với lỗi "Permission denied"
164
- - **Cách sửa**: Thêm flow xin permission cho iOS
165
-
166
- ```typescript
167
- // Sửa:
168
- if (Platform.OS === 'ios') {
169
- const permission = await Biometrics.requestPermission();
170
- if (permission !== 'granted') {
171
- throw new Error('Cần cấp quyền sinh trắc học');
172
- }
173
- }
174
- ```
175
-
176
- ---
177
-
178
- **2. Thiếu Migration Token Storage**
179
- - **Vị trí**: `src/services/auth/authService.ts:89`
180
- - **Vấn đề**: Format lưu token đã đổi từ plain sang encrypted, nhưng không có logic migration
181
- - **Tác động**: User hiện tại sẽ bị logout sau update
182
- - **Cách sửa**: Thêm logic migration khi app start
183
-
184
- ```typescript
185
- // Thêm migration:
186
- async function migrateTokenStorage() {
187
- const oldToken = await AsyncStorage.getItem('auth_token');
188
- if (oldToken && !await SecureStore.getItemAsync('auth_token_encrypted')) {
189
- await SecureStore.setItemAsync('auth_token_encrypted', oldToken);
190
- await AsyncStorage.removeItem('auth_token');
191
- }
192
- }
193
- ```
194
-
195
- ---
196
-
197
- **3. Không Có Fallback Khi Sinh Trắc Học Thất Bại**
198
- - **Vị trí**: `src/screens/Auth/LoginScreen.tsx:123`
199
- - **Vấn đề**: Nếu sinh trắc học fail, không có option dùng password
200
- - **Tác động**: User bị kẹt màn hình login
201
- - **Cách sửa**: Thêm nút "Dùng Password" sau khi fail
202
-
203
- ```typescript
204
- // Thêm fallback:
205
- try {
206
- await authenticateWithBiometric();
207
- } catch (error) {
208
- Alert.alert(
209
- 'Sinh trắc học thất bại',
210
- 'Bạn muốn dùng password thay thế?',
211
- [
212
- { text: 'Thử lại', onPress: () => retry() },
213
- { text: 'Dùng Password', onPress: () => showPasswordLogin() }
214
- ]
215
- );
216
- }
217
- ```
218
-
219
- ---
220
-
221
- ### Quan Trọng (2)
222
-
223
- **4. Android Chưa Check Đăng Ký Vân Tay**
224
- - Có thể crash nếu user chưa đăng ký vân tay
225
-
226
- **5. Nút Chưa Có Debouncing**
227
- - Tap nhiều lần → Nhiều prompts
228
-
229
- ---
230
-
231
- ### Nhỏ (1)
232
-
233
- **6. Thiếu Loading State**
234
- - Màn hình trắng 1-2 giây khi check availability
235
-
236
- ---
237
-
238
- ## ✅ Checklist Trước Khi Deploy
239
-
240
- ### Code (NGHIÊM TRỌNG)
241
- - [ ] Sửa iOS permission (30 phút) ⚠️⚠️⚠️
242
- - [ ] Thêm token migration (45 phút) ⚠️⚠️⚠️
243
- - [ ] Thêm fallback UI (20 phút) ⚠️⚠️⚠️
244
- - [ ] Sửa Android enrollment check (15 phút)
245
- - [ ] Thêm debouncing (10 phút)
246
-
247
- ### Test
248
- - [ ] Test trên iPhone (iOS 15+)
249
- - [ ] Test trên Android (Android 10+)
250
- - [ ] Test với mạng yếu
251
- - [ ] Test offline
252
- - [ ] Test permission flows
253
- - [ ] Test ảnh lớn (> 5MB)
254
-
255
- ### Regression
256
- - [ ] Password login vẫn hoạt động
257
- - [ ] Logout hoạt động
258
- - [ ] Session persistence hoạt động
259
-
260
- ---
261
-
262
- ## 📊 Thống Kê
263
-
264
- - Files: 5 thay đổi
265
- - Rủi ro: CAO ⚠️⚠️⚠️
266
- - Vấn đề: 6 (3 nghiêm trọng)
267
- - Tests cần: 8 scenarios
268
- - Thời gian sửa: ~2 giờ
269
- - Thời gian test: ~45 phút
270
-
271
- ---
272
-
273
- ## 🚀 Bước Tiếp Theo
274
-
275
- 1. ✅ Đọc báo cáo đầy đủ
276
- 2. ⚠️ Sửa 3 vấn đề nghiêm trọng (~2 giờ)
277
- 3. ✅ Chạy tests (~45 phút)
278
- 4. ✅ Test trên thiết bị thật
279
- 5. ✅ Tạo PR với báo cáo này đính kèm
280
-
281
- **Ước tính production-ready**: 3-4 giờ
282
-
283
- ---
284
-
285
- **💡 Lưu ý**: Đây là thay đổi HIGH RISK. Cần test kỹ trước khi deploy!
286
- ```
287
-
288
- ---
289
-
290
- ## Key Changes
291
-
292
- ### 1. Ngôn Ngữ
293
- - ✅ Toàn bộ tiếng Việt
294
- - ✅ Thuật ngữ tech giữ nguyên (Face ID, Touch ID, etc.)
295
- - ✅ Dễ hiểu cho developer Việt Nam
296
-
297
- ### 2. Structure
298
- - ✅ **Tính năng trước** (🎯 Tính Năng Bị Ảnh Hưởng)
299
- - ✅ **Scenarios người dùng** (🎬 Scenarios Người Dùng)
300
- - ✅ **Vấn đề cần sửa** (⚠️ Vấn Đề Cần Sửa)
301
- - ✅ **Chi tiết kỹ thuật sau** (📝 Files Đã Sửa)
302
-
303
- ### 3. Focus
304
- - ✅ Tính năng và tác động lên user
305
- - ✅ Hành động cụ thể cần làm
306
- - ✅ Ước tính thời gian
307
- - ✅ Priority rõ ràng
308
-
309
- ### 4. Tone
310
- - ✅ Thân thiện, dễ hiểu
311
- - ✅ Actionable (có thể hành động ngay)
312
- - ✅ Emoji để dễ scan
313
- - ✅ Checklist để track progress