@leejungkiin/awkit 1.0.5 → 1.0.7

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,20 +1,20 @@
1
1
  ---
2
- description: 🔧 Dịch ngược APK Android (Apktool output) → App Kotlin hiện đại với Jetpack Compose, Clean Architecture. Progressive Disclosure: Map → Blueprint → Build.
2
+ description: 🔧 Dịch ngược APK Android (Apktool output) → App Kotlin hiện đại với Jetpack Compose, Clean Architecture, UI-First methodology.
3
3
  skill: smali-to-kotlin
4
4
  ---
5
5
 
6
6
  # /reverse-android — Android APK Reverse Engineering Workflow
7
7
 
8
8
  > **Skill:** `smali-to-kotlin` v2.0 | **Tech:** Kotlin + Compose + Hilt + Retrofit + Room
9
- > **Philosophy:** "Treat decompiled code as a MAP, not a TODO list"
10
- > **Approach:** Map Blueprint Build (progressive disclosure)
9
+ > **Philosophy:** "Map Blueprint UI First Logic Behind"
10
+ > **Key:** UI is designed and approved BEFORE coding any business logic.
11
11
 
12
12
  ---
13
13
 
14
14
  ## ⚡ QUICK START
15
15
 
16
16
  User cung cấp: Apktool output dir, `AndroidManifest.xml`, hoặc nói "reverse engineer APK này".
17
- Workflow dẫn dắt qua **4 phases** — mỗi phase có zoom level riêng, **không bao giờ nhảy cóc**.
17
+ Workflow dẫn dắt qua **5 phases** — UI-First approach, **không bao giờ nhảy cóc**.
18
18
 
19
19
  ---
20
20
 
@@ -27,10 +27,11 @@ reverse_session:
27
27
  project_name: "[TBD - từ manifest]"
28
28
  apktool_dir: "[path]"
29
29
  current_phase: 0
30
- current_zoom: 0 # 0=satellite, 1=district, 2=block, 3=ground
31
- current_feature: null # set khi user chọn feature ở Phase 2
32
- app_map_done: false
33
- architecture_done: false
30
+ current_feature: null
31
+ phase_2_status:
32
+ contracts: pending
33
+ ui_shell: pending
34
+ resources: pending
34
35
  completed_features: []
35
36
  pending_features: []
36
37
  decisions: []
@@ -39,7 +40,7 @@ reverse_session:
39
40
  ### Bước 0.2: Xác nhận input
40
41
 
41
42
  ```
42
- 🔧 Android Reverse Engineering v2.0 — Map → Blueprint → Build
43
+ 🔧 Android Reverse Engineering v2.0 — UI-First Pipeline
43
44
 
44
45
  Em cần biết:
45
46
  1. Thư mục Apktool output ở đâu?
@@ -50,14 +51,15 @@ Chưa chạy Apktool? → apktool d your-app.apk -o ./decompiled/
50
51
 
51
52
  ---
52
53
 
53
- ## 📋 Pipeline Overview (4 Phases)
54
+ ## 📋 Pipeline Overview (5 Phases — UI-First)
54
55
 
55
- | Phase | Name | Sub-workflow | Zoom | Code? | Gate |
56
- |-------|------|-------------|------|-------|------|
57
- | 0 | 🗺️ Discovery | [`/re-android-discover`](reverse-android-discover.md) | Satellite | ❌ | User approves Map |
58
- | 1 | 🏗️ Architecture | [`/re-android-design`](reverse-android-design.md) | District | ❌ | User approves Architecture |
59
- | 2 | 📐 Blueprint | [`/re-android-build`](reverse-android-build.md) | Block | Signatures | Per-feature approval |
60
- | 3 | 🔨 Implementation | [`/re-android-build`](reverse-android-build.md) | Ground | Full | Per-feature checkpoint |
56
+ | Phase | Name | Sub-workflow | Code? | Gate |
57
+ |-------|------|-------------|-------|------|
58
+ | 0 | 🗺️ Discovery | [`/re-android-discover`](reverse-android-discover.md) | ❌ | User approves Map |
59
+ | 1 | 🏗️ Architecture | [`/re-android-design`](reverse-android-design.md) | ❌ | User approves Architecture |
60
+ | 2 | 📐🎨 Blueprint + UI | [`/re-android-build`](reverse-android-build.md) | UI code | User approves UI + Contracts |
61
+ | 3 | 🔨 Logic Build | [`/re-android-build`](reverse-android-build.md) | Full logic | Feature checkpoint |
62
+ | 4 | ✅ Final Parity | [`/re-android-build`](reverse-android-build.md) | — | Final check |
61
63
 
62
64
  ### Execution Flow
63
65
 
@@ -68,31 +70,34 @@ Phase 0: Discovery (/re-android-discover) → App Map
68
70
  ↓ [User approves]
69
71
  Phase 1: Architecture (/re-android-design) → Architecture Blueprint
70
72
  ↓ [User approves + picks feature]
71
- Phase 2+3 Loop (/re-android-build):
72
- Blueprint Feature X Build Feature X Checkpoint
73
- Blueprint Feature Y Build Feature Y → Checkpoint
74
- ... (repeat for all features)
73
+ Feature Loop (/re-android-build):
74
+ Phase 2: Blueprint + UI (contracts + visual shell + resources)
75
+ 🚦 GATE: User approves UI + contracts
76
+ Phase 3: Logic Build (domain data → DI → VM → wire UI)
77
+ ↓ 📊 CHECKPOINT: Feature done
78
+ → Repeat for next feature
75
79
 
76
- Final: Parity Check & Quality Gate
80
+ Phase 4: Final Parity Check & Quality Gate
77
81
  ```
78
82
 
79
83
  ---
80
84
 
81
85
  ## 🔭 ZOOM CONTROL
82
86
 
83
- AI phải tự check **TRƯỚC MỖI output**:
84
-
85
87
  ```yaml
86
88
  pre_output_check:
87
- - "Đang ở zoom level nào? (0/1/2/3)"
88
- - "Output có đúng zoom level không?"
89
- - "Có function body trong Phase 0/1 không? REMOVE"
90
-
91
- zoom_rules:
92
- zoom_0: "NO CODE. Only diagrams, tables, maps."
93
- zoom_1: "NO CODE BODIES. Only architecture diagrams, file lists."
94
- zoom_2: "SIGNATURES ONLY. Interfaces, data classes, sealed classes."
95
- zoom_3: "FULL CODE. Implementation for ONE feature at a time."
89
+ - "Đang ở phase nào?"
90
+ - "Output có đúng phase rule không?"
91
+ - "Phase 0/1: NO CODE BODIES"
92
+ - "Phase 2: UI code + signatures (no logic bodies)"
93
+ - "Phase 3: Full implementation code"
94
+
95
+ phase_rules:
96
+ phase_0: "NO CODE. Only diagrams, tables, maps."
97
+ phase_1: "NO CODE BODIES. Only architecture diagrams, file lists."
98
+ phase_2_contracts: "SIGNATURES ONLY. Interfaces, data classes, sealed classes."
99
+ phase_2_ui: "FULL UI CODE. Compose with hardcoded mock data + @Preview."
100
+ phase_3: "FULL LOGIC CODE. Domain → Data → DI → VM → Wire UI."
96
101
  ```
97
102
 
98
103
  ---
@@ -101,23 +106,24 @@ zoom_rules:
101
106
 
102
107
  ```yaml
103
108
  never_skip:
104
- - Phase 0 (Discovery) — always first, MUST create App Map
105
- - Phase 1 (Architecture) — MUST design before coding
106
- - User approval at each phase gate
107
- - Per-feature Blueprint before Implementation
109
+ - Phase 0 (Discovery) — always first
110
+ - Phase 1 (Architecture) — design before coding
111
+ - Phase 2 UI Gate user MUST approve UI before Phase 3
112
+ - Per-feature Blueprint before Logic Build
108
113
 
109
114
  never_do:
110
- - Write code in Phase 0 or Phase 1
115
+ - Write logic code before UI is approved
111
116
  - Mass-copy resources from APK (on-demand only)
112
117
  - Implement multiple features simultaneously
113
- - Skip parity check for crypto utils
118
+ - Modify UI significantly in Phase 3 (only wire, don't redesign)
119
+ - Skip crypto parity check
114
120
 
115
121
  always_do:
116
- - Start with App Map (Phase 0)
117
- - Present Architecture for review (Phase 1)
118
- - Create Blueprint before coding each feature (Phase 2)
119
- - Checkpoint after each feature (Phase 3)
120
- - Document all decisions in session state
122
+ - Extract resources BEFORE coding UI (Phase 2.7 → 2.8)
123
+ - Create @Preview for ALL states
124
+ - Keep stateless composable (LoginScreenContent) after wiring
125
+ - Checkpoint after each feature
126
+ - Document all decisions
121
127
  ```
122
128
 
123
129
  ---
@@ -127,11 +133,11 @@ always_do:
127
133
  - **Sub-workflows:**
128
134
  - [`/re-android-discover`](reverse-android-discover.md) — Phase 0: Discovery
129
135
  - [`/re-android-design`](reverse-android-design.md) — Phase 1: Architecture
130
- - [`/re-android-build`](reverse-android-build.md) — Phase 2+3: Blueprint + Build
131
- - **Skill:** `smali-to-kotlin` v2.0 (core knowledge & rules)
136
+ - [`/re-android-build`](reverse-android-build.md) — Phase 2+3+4: Blueprint + UI + Build
137
+ - **Skill:** `smali-to-kotlin` v2.0 (UI-First pipeline)
132
138
  - **Sibling:** `/reverse-ios` (iOS counterpart)
133
139
  - **After RE done:** `/test`, `/deploy`, `/code-janitor`
134
140
 
135
141
  ---
136
142
 
137
- *reverse-android workflow v3.0.0 — Progressive Disclosure RE Pipeline*
143
+ *reverse-android workflow v4.0.0 — UI-First RE Pipeline*
@@ -1,36 +1,37 @@
1
1
  ---
2
- description: 🔨 RE iOS Phase 2+3 — Per-feature Blueprint → Implementation → Parity Check
2
+ description: 🔨 RE iOS Phase 2+3+4 — Blueprint + UI Shell Logic Build Final Parity (UI-First)
3
3
  parent: reverse-ios
4
4
  ---
5
5
 
6
- # /re-ios-build — Blueprint & Build (Per Feature)
6
+ # /re-ios-build — Blueprint + UI + Build (Per Feature)
7
7
 
8
- > **Parent:** [`/reverse-ios`](reverse-ios.md) → Phase 2+3
8
+ > **Parent:** [`/reverse-ios`](reverse-ios.md) → Phase 2+3+4
9
9
  > **Prerequisite:** Completed Architecture from [`/re-ios-design`](reverse-ios-design.md)
10
- > **Skill:** `smali-to-swift` → `phase-2-blueprint.md` + `phase-3-build.md`
10
+ > **Skill:** `smali-to-swift` → `phase-2-blueprint-ui.md` + `phase-3-logic-build.md`
11
11
 
12
12
  ---
13
13
 
14
- ## 🔄 Feature Loop
14
+ ## 🔄 Feature Loop (UI-First)
15
15
 
16
16
  ```
17
17
  For each feature (from Architecture Build Order):
18
- Phase 2: Blueprint (Zoom 2 signatures only)
19
- [User approves]
20
- Phase 3: Implementation (Zoom 3 full code)
21
- [Checkpoint]
18
+ Phase 2: Blueprint + UI (contracts + visual shell)
19
+ 🚦 GATE: User approves UI + contracts
20
+ Phase 3: Logic Build (domain data wire)
21
+ 📊 CHECKPOINT
22
22
  → Next feature
23
23
  ```
24
24
 
25
25
  ---
26
26
 
27
- ## 📐 Phase 2: Feature Blueprint (Zoom 2)
27
+ ## 📐🎨 Phase 2: Blueprint + UI Design
28
28
 
29
- > **Output:** Contracts, protocols, state design. **Signatures only.**
29
+ > **Output:** Approved contracts + Working SwiftUI shell with mock data.
30
30
 
31
- ### 2.1: Deep Header Reading
31
+ ### Part A: Contracts (signatures only)
32
32
 
33
- Read class-dump headers + Hopper pseudo-code for chosen feature.
33
+ #### 2.1: Deep Header Reading
34
+ Read class-dump headers + Hopper pseudo-code. See `objc-reading-guide.md`.
34
35
 
35
36
  **ObjC → Swift Quick Ref:**
36
37
  ```
@@ -40,90 +41,200 @@ Read class-dump headers + Hopper pseudo-code for chosen feature.
40
41
  + (instancetype)sharedInstance → static let shared
41
42
  ```
42
43
 
43
- ### 2.2: Domain Contracts
44
-
44
+ #### 2.2–2.5: Define Contracts
45
45
  ```swift
46
+ // 2.2 Domain Model
46
47
  struct [Model]: Codable, Identifiable, Sendable {
47
- let field1: Type
48
- // CodingKeys if needed
48
+ let field: Type
49
49
  }
50
50
 
51
+ // 2.3 Repository Protocol
51
52
  protocol [Feature]Repository: Sendable {
52
53
  func [method](...) async throws -> [Type]
53
54
  }
54
55
 
55
- struct [Action]UseCase: Sendable {
56
- func execute(...) async throws -> [Type]
56
+ // 2.4 API Endpoint
57
+ enum [Feature]Endpoint {
58
+ case [action](param: Type)
59
+ var path: String { /* ... */ }
60
+ }
61
+
62
+ // 2.5 UseCase
63
+ struct [Action]UseCase {
64
+ func execute(...) async throws -> [Type] // TODO
65
+ }
66
+ ```
67
+
68
+ #### 2.6: UI State Design
69
+ ```swift
70
+ struct [Screen]ViewState {
71
+ var field: Type = default
72
+ var isLoading: Bool = false
73
+ var error: String? = nil
74
+ }
75
+ enum [Screen]Action { /* user interactions */ }
76
+ enum [Screen]Event { /* navigation, alerts */ }
77
+
78
+ extension [Screen]ViewState {
79
+ static let normal = [Screen]ViewState(/* sample */)
80
+ static let loading = [Screen]ViewState(isLoading: true)
81
+ static let error = [Screen]ViewState(error: "Error message")
82
+ }
83
+ ```
84
+
85
+ ### Part B: UI Visual Shell
86
+
87
+ #### 2.7: Resource Extraction ⭐ (BEFORE UI code!)
88
+
89
+ Extract from IPA bundle / Assets.car:
90
+ - Images → Assets.xcassets
91
+ - Colors → Color extension or asset catalog
92
+ - Strings → Localizable.xcstrings
93
+ - Fonts → custom fonts
94
+
95
+ Copy ONLY needed resources. Verify they build.
96
+
97
+ #### 2.8: UI Implementation ⭐ (Visual shell with mock data)
98
+
99
+ - Use ViewState from 2.6 with hardcoded defaults
100
+ - Use REAL resources from 2.7
101
+ - Create `[Screen]Content` view (stateless)
102
+ - Match visual parity with original app
103
+ - NO ViewModel connection, NO real API calls
104
+
105
+ ```swift
106
+ struct [Screen]Content: View {
107
+ var state: [Screen]ViewState = .normal // Mock
108
+ var onAction: ([Screen]Action) -> Void = { _ in } // No-op
109
+
110
+ var body: some View {
111
+ // Full SwiftUI matching original app
112
+ }
57
113
  }
114
+
115
+ #Preview("Normal") { [Screen]Content(state: .normal) }
116
+ #Preview("Loading") { [Screen]Content(state: .loading) }
117
+ #Preview("Error") { [Screen]Content(state: .error) }
58
118
  ```
59
119
 
60
- ### 2.3: UI State Design
120
+ #### 2.9: Visual Parity Check ⭐
61
121
 
62
- - @Observable ViewModel properties
63
- - User actions
64
- - Navigation events
65
- - Wireframe
122
+ Compare with original app:
123
+ - [ ] Layout structure matches
124
+ - [ ] Colors, typography, spacing correct
125
+ - [ ] Icons/images positioned correctly
126
+ - [ ] All states: normal, loading, error, empty
66
127
 
67
- ### Blueprint Gate
128
+ ### 🚦 UI + Contracts Gate (MANDATORY)
68
129
 
69
130
  ```
70
- "📐 Blueprint cho [Feature] xong. OK? → Code."
131
+ "📐🎨 Blueprint + UI cho [Feature] xong:
132
+ 📝 Contracts: [N] models, [N] protocols, [N] use cases, [N] endpoints
133
+ 🎨 UI: [Screen] with [N] state previews
134
+ 📸 Visual Parity: [OK / needs adjustment]
135
+
136
+ → ✅ Approve → Phase 3 (Logic Build)
137
+ → 🎨 Adjust UI → fix then re-check
138
+ → 📝 Adjust contracts → revise"
71
139
  ```
72
140
 
141
+ > ⚠️ **DO NOT proceed to Phase 3 without user approval.**
142
+
73
143
  ---
74
144
 
75
- ## 🔨 Phase 3: Implementation (Zoom 3)
145
+ ## 🔨 Phase 3: Logic Build
76
146
 
77
- > **Full Swift code for THIS feature only.**
147
+ > **Output:** Full Swift code. Wire logic to EXISTING UI.
78
148
 
79
- ### 3.1: Domain → Data → DI → ViewModel → Screen
149
+ ### 3.1: Domain Layer
150
+ Models + Repository protocols + UseCases (implement with repo calls)
80
151
 
81
- Standard implementation order:
82
- 1. Codable structs
83
- 2. Repository protocol + implementation
84
- 3. APIClient endpoints
85
- 4. SwiftData models (if applicable)
86
- 5. DI container entries
87
- 6. @Observable ViewModel
88
- 7. SwiftUI Screen
89
- 8. Resource extraction (on-demand only)
152
+ ### 3.2: Data Layer
153
+ DTOs + APIClient endpoints + SwiftData (if applicable) + Repository implementation
90
154
 
91
- ### 🔒 Crypto (Special)
155
+ ### 3.3: DI Container
156
+ AppContainer with lazy properties for repos, use cases, view models
157
+
158
+ ### 3.4: ViewModel
159
+ @Observable with state property + handle(_ action:) + event handler
160
+
161
+ ### 3.5: Wire UI ↔ Logic ⭐ (NOT "code new UI")
162
+
163
+ The UI already exists from Phase 2.8. Only CONNECT it:
92
164
 
165
+ ```swift
166
+ // Keep stateless Content view from Phase 2 (for Preview):
167
+ // [Screen]Content(state:, onAction:) — DO NOT MODIFY
168
+
169
+ // ADD wrapper that wires ViewModel:
170
+ struct [Screen]: View {
171
+ @State private var viewModel: [Screen]ViewModel
172
+
173
+ init(container: AppContainer) {
174
+ _viewModel = State(initialValue: container.make[Screen]ViewModel())
175
+ }
176
+
177
+ var body: some View {
178
+ [Screen]Content(
179
+ state: viewModel.state,
180
+ onAction: viewModel.handle
181
+ )
182
+ }
183
+ }
184
+ ```
185
+
186
+ ### 3.6: Integration Test ⭐
187
+ - [ ] API calls succeed, data displays
188
+ - [ ] Loading/error states work
189
+ - [ ] Navigation correct
190
+ - [ ] Crypto output matches (if applicable)
191
+
192
+ ### 🔒 Crypto (Special)
93
193
  ```swift
94
194
  import CryptoKit
95
195
  import CommonCrypto
96
196
  // XCTest mandatory for crypto utils
97
197
  ```
98
-
99
198
  > ⚠️ Crypto MUST match original output.
100
199
 
101
200
  ### ✅ Feature Checkpoint
102
201
 
103
202
  ```markdown
104
203
  ## ✅ Feature Complete: [Name]
105
- ### Files created: [list]
106
- ### Tests: [crypto verified?]
107
- ⏭️ Next: Phase 2 for [next feature]
204
+ Files: [list] | Resources: [count] | Tests: [status]
205
+ ⏭️ Next Feature: [Name] → Return to Phase 2
108
206
  ```
109
207
 
110
208
  ---
111
209
 
112
- ## ✅ Final Parity Check
210
+ ## ✅ Phase 4: Final Parity Check (After ALL features)
113
211
 
114
- - [ ] API Parity
115
- - [ ] Data/Crypto Parity
116
- - [ ] UI Parity
212
+ ### Checklist
213
+ - [ ] API Parity — all endpoints match
214
+ - [ ] Data/Crypto Parity — output identical
215
+ - [ ] UI Parity — screen-by-screen comparison
216
+ - [ ] Edge Cases — empty, error, offline, lifecycle
117
217
  - [ ] Build: `xcodebuild build && xcodebuild test`
118
218
 
219
+ ### 🎉 Final Summary
220
+
221
+ ```markdown
222
+ ## ✅ Reverse Engineering Complete!
223
+ - Screens: [N] | Features: [N]
224
+ - Frameworks reused: [N] | Replaced: [N]
225
+ - Tests: [pass/fail]
226
+
227
+ ⏭️ Next: /test → /deploy → /code-janitor
228
+ ```
229
+
119
230
  ---
120
231
 
121
232
  ## 🔗 Related
122
233
 
123
234
  - **Parent:** [`/reverse-ios`](reverse-ios.md)
124
- - **Previous:** [`/re-ios-design`](reverse-ios-design.md)
125
- - **Skill:** `smali-to-swift` → `phase-2-blueprint.md` + `phase-3-build.md`
235
+ - **Previous:** [`/re-ios-design`](reverse-ios-design.md) (Phase 1)
236
+ - **Skill:** `smali-to-swift` → `phase-2-blueprint-ui.md` + `phase-3-logic-build.md`
126
237
 
127
238
  ---
128
239
 
129
- *re-ios-build v3.0.0 — Phase 2+3: Blueprint & Build*
240
+ *re-ios-build v4.0.0 — UI-First Blueprint + Build*
@@ -65,10 +65,19 @@ App/
65
65
  └── Resources/
66
66
  ```
67
67
 
68
- ### Step 6: Build Order
68
+ ### Step 6: Build Order (UI-First) ⭐
69
69
 
70
70
  | # | Phase | Scope | Complexity |
71
71
  |---|-------|-------|-----------|
72
+ | 1 | 🟢 Foundation | Xcode project + DI skeleton + Theme | Low |
73
+ | 2 | 🟢 Navigation | NavigationStack, TabView, routes | Low |
74
+ | 3 | 🔵 Per Feature | Blueprint (contracts) + UI Shell (visual) | Medium |
75
+ | 4 | 🚦 UI Gate | User approves UI before logic | — |
76
+ | 5 | 🟡 Per Feature | Logic Build (Domain → Data → VM → Wire UI) | High |
77
+ | 6 | 📦 SDKs | Third-party SDK + Native libs integration | Medium |
78
+ | N | 🔴 Final | Full Parity Check | High |
79
+
80
+ > **UI-First:** Design and approve UI before coding logic for each feature.
72
81
 
73
82
  ### Step 7: Tech Decisions
74
83
 
@@ -1,13 +1,13 @@
1
1
  ---
2
- description: 🍎 Dịch ngược IPA iOS (class-dump, Hopper output) → App Swift hiện đại với SwiftUI, Clean Architecture. Progressive Disclosure: Map → Blueprint → Build.
2
+ description: 🍎 Dịch ngược IPA iOS (class-dump, Hopper output) → App Swift hiện đại với SwiftUI, Clean Architecture, UI-First methodology.
3
3
  skill: smali-to-swift
4
4
  ---
5
5
 
6
6
  # /reverse-ios — iOS IPA Reverse Engineering Workflow
7
7
 
8
8
  > **Skill:** `smali-to-swift` v2.0 | **Tech:** Swift + SwiftUI + async/await + URLSession + SwiftData
9
- > **Philosophy:** "Treat decompiled code as a MAP, not a TODO list"
10
- > **Approach:** Map Blueprint Build (progressive disclosure)
9
+ > **Philosophy:** "Map Blueprint UI First Logic Behind"
10
+ > **Key:** UI is designed and approved BEFORE coding any business logic.
11
11
  > **Sibling:** `/reverse-android`
12
12
 
13
13
  ---
@@ -15,7 +15,7 @@ skill: smali-to-swift
15
15
  ## ⚡ QUICK START
16
16
 
17
17
  User cung cấp: Decrypted `.app` bundle, class-dump headers, Hopper pseudo-code, hoặc nói "reverse engineer IPA này".
18
- Workflow dẫn dắt qua **4 phases** — mỗi phase có zoom level riêng, **không bao giờ nhảy cóc**.
18
+ Workflow dẫn dắt qua **5 phases** — UI-First approach, **không bao giờ nhảy cóc**.
19
19
 
20
20
  ---
21
21
 
@@ -29,10 +29,11 @@ reverse_ios_session:
29
29
  app_bundle_dir: "[path]"
30
30
  headers_dir: "[class-dump output]"
31
31
  current_phase: 0
32
- current_zoom: 0
33
32
  current_feature: null
34
- app_map_done: false
35
- architecture_done: false
33
+ phase_2_status:
34
+ contracts: pending
35
+ ui_shell: pending
36
+ resources: pending
36
37
  completed_features: []
37
38
  pending_features: []
38
39
  decisions: []
@@ -41,7 +42,7 @@ reverse_ios_session:
41
42
  ### Bước 0.2: Xác nhận input
42
43
 
43
44
  ```
44
- 🍎 iOS Reverse Engineering v2.0 — Map → Blueprint → Build
45
+ 🍎 iOS Reverse Engineering v2.0 — UI-First Pipeline
45
46
 
46
47
  Em cần biết:
47
48
  1. Decrypted .app bundle ở đâu?
@@ -55,14 +56,15 @@ Chưa chuẩn bị?
55
56
 
56
57
  ---
57
58
 
58
- ## 📋 Pipeline Overview (4 Phases)
59
+ ## 📋 Pipeline Overview (5 Phases — UI-First)
59
60
 
60
- | Phase | Name | Sub-workflow | Zoom | Code? | Gate |
61
- |-------|------|-------------|------|-------|------|
62
- | 0 | 🗺️ Discovery | [`/re-ios-discover`](reverse-ios-discover.md) | Satellite | ❌ | User approves Map |
63
- | 1 | 🏗️ Architecture | [`/re-ios-design`](reverse-ios-design.md) | District | ❌ | User approves Architecture |
64
- | 2 | 📐 Blueprint | [`/re-ios-build`](reverse-ios-build.md) | Block | Signatures | Per-feature approval |
65
- | 3 | 🔨 Implementation | [`/re-ios-build`](reverse-ios-build.md) | Ground | Full | Per-feature checkpoint |
61
+ | Phase | Name | Sub-workflow | Code? | Gate |
62
+ |-------|------|-------------|-------|------|
63
+ | 0 | 🗺️ Discovery | [`/re-ios-discover`](reverse-ios-discover.md) | ❌ | User approves Map |
64
+ | 1 | 🏗️ Architecture | [`/re-ios-design`](reverse-ios-design.md) | ❌ | User approves Architecture |
65
+ | 2 | 📐🎨 Blueprint + UI | [`/re-ios-build`](reverse-ios-build.md) | UI code | User approves UI + Contracts |
66
+ | 3 | 🔨 Logic Build | [`/re-ios-build`](reverse-ios-build.md) | Full logic | Feature checkpoint |
67
+ | 4 | ✅ Final Parity | [`/re-ios-build`](reverse-ios-build.md) | — | Final check |
66
68
 
67
69
  ### Execution Flow
68
70
 
@@ -73,11 +75,14 @@ Phase 0: Discovery (/re-ios-discover) → App Map
73
75
  ↓ [User approves]
74
76
  Phase 1: Architecture (/re-ios-design) → Architecture Blueprint
75
77
  ↓ [User approves + picks feature]
76
- Phase 2+3 Loop (/re-ios-build):
77
- Blueprint Feature X Build Feature X Checkpoint
78
- Blueprint Feature Y Build Feature Y → Checkpoint
78
+ Feature Loop (/re-ios-build):
79
+ Phase 2: Blueprint + UI (contracts + visual shell + resources)
80
+ 🚦 GATE: User approves UI + contracts
81
+ Phase 3: Logic Build (domain → data → DI → VM → wire UI)
82
+ ↓ 📊 CHECKPOINT: Feature done
83
+ → Repeat for next feature
79
84
 
80
- Final: Parity Check & Quality Gate
85
+ Phase 4: Final Parity Check & Quality Gate
81
86
  ```
82
87
 
83
88
  ---
@@ -86,15 +91,18 @@ Final: Parity Check & Quality Gate
86
91
 
87
92
  ```yaml
88
93
  pre_output_check:
89
- - "Đang ở zoom level nào?"
90
- - "Output có đúng zoom level không?"
91
- - "Có function body trong Phase 0/1 không? REMOVE"
92
-
93
- zoom_rules:
94
- zoom_0: "NO CODE. Only diagrams, tables, maps."
95
- zoom_1: "NO CODE BODIES. Only architecture, file lists."
96
- zoom_2: "SIGNATURES ONLY. Protocols, structs, enums."
97
- zoom_3: "FULL CODE. Implementation for ONE feature."
94
+ - "Đang ở phase nào?"
95
+ - "Output có đúng phase rule không?"
96
+ - "Phase 0/1: NO CODE BODIES"
97
+ - "Phase 2: UI code + signatures (no logic bodies)"
98
+ - "Phase 3: Full implementation code"
99
+
100
+ phase_rules:
101
+ phase_0: "NO CODE. Only diagrams, tables, maps."
102
+ phase_1: "NO CODE BODIES. Only architecture, file lists."
103
+ phase_2_contracts: "SIGNATURES ONLY. Protocols, structs, enums."
104
+ phase_2_ui: "FULL UI CODE. SwiftUI with hardcoded mock data + #Preview."
105
+ phase_3: "FULL LOGIC CODE. Domain → Data → DI → VM → Wire UI."
98
106
  ```
99
107
 
100
108
  ---
@@ -104,23 +112,27 @@ zoom_rules:
104
112
  ```yaml
105
113
  never_skip:
106
114
  - Phase 0 (Discovery) — always first
107
- - Phase 1 (Architecture) — design before code
108
- - Per-feature Blueprint before Implementation
115
+ - Phase 1 (Architecture) — design before coding
116
+ - Phase 2 UI Gate — user MUST approve UI before Phase 3
117
+ - Per-feature Blueprint before Logic Build
109
118
 
110
119
  never_do:
111
- - Write code in Phase 0 or Phase 1
112
- - Mass-copy assets from IPA
120
+ - Write logic code before UI is approved
121
+ - Mass-copy assets from IPA (on-demand only)
113
122
  - Use UIKit when SwiftUI equivalent exists
114
123
  - Use GCD for new async code (use async/await)
115
124
  - Use ObjC in new code (Swift only)
125
+ - Modify UI significantly in Phase 3 (only wire, don't redesign)
116
126
  - Implement multiple features simultaneously
117
127
 
118
128
  always_do:
119
- - Start with App Map
120
- - Create Blueprint before each feature
129
+ - Extract resources BEFORE coding UI (Phase 2.7 → 2.8)
130
+ - Create #Preview for ALL states
131
+ - Keep stateless View (LoginScreenContent) after wiring
121
132
  - XCTest all crypto/hash functions
122
133
  - Use @Observable for ViewModels
123
134
  - Use NavigationStack, SPM
135
+ - Checkpoint after each feature
124
136
  ```
125
137
 
126
138
  ---
@@ -130,11 +142,11 @@ always_do:
130
142
  - **Sub-workflows:**
131
143
  - [`/re-ios-discover`](reverse-ios-discover.md) — Phase 0: Discovery
132
144
  - [`/re-ios-design`](reverse-ios-design.md) — Phase 1: Architecture
133
- - [`/re-ios-build`](reverse-ios-build.md) — Phase 2+3: Blueprint + Build
134
- - **Skill:** `smali-to-swift` v2.0
145
+ - [`/re-ios-build`](reverse-ios-build.md) — Phase 2+3+4: Blueprint + UI + Build
146
+ - **Skill:** `smali-to-swift` v2.0 (UI-First pipeline)
135
147
  - **Sibling:** `/reverse-android`
136
148
  - **After RE done:** `/test`, `/deploy`, `/code-janitor`
137
149
 
138
150
  ---
139
151
 
140
- *reverse-ios workflow v3.0.0 — Progressive Disclosure RE Pipeline*
152
+ *reverse-ios workflow v4.0.0 — UI-First RE Pipeline*