@leejungkiin/awkit 1.0.7 β†’ 1.0.9

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.
Files changed (55) hide show
  1. package/core/GEMINI.md.bak +168 -181
  2. package/package.json +2 -2
  3. package/schemas/brain-snapshot.json +167 -0
  4. package/skills/CATALOG.md +70 -0
  5. package/skills/beads-manager/SKILL.md +20 -1
  6. package/skills/memory-sync/SKILL.md +20 -2
  7. package/skills/nm-memory-audit/SKILL.md +157 -0
  8. package/skills/nm-memory-evolution/SKILL.md +202 -0
  9. package/skills/nm-memory-intake/SKILL.md +135 -0
  10. package/skills/nm-memory-sync/SKILL.md +184 -0
  11. package/skills/orchestrator/SKILL.md +41 -50
  12. package/skills/schemas/brain-snapshot.json +167 -0
  13. package/skills/skills/nm-memory-audit/SKILL.md +157 -0
  14. package/skills/skills/nm-memory-evolution/SKILL.md +202 -0
  15. package/skills/skills/nm-memory-intake/SKILL.md +135 -0
  16. package/skills/skills/nm-memory-sync/SKILL.md +184 -0
  17. package/skills/smali-to-kotlin/SKILL.md +331 -85
  18. package/skills/smali-to-kotlin/phase-0-discovery.md +93 -94
  19. package/skills/smali-to-kotlin/phase-1-architecture.md +67 -58
  20. package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
  21. package/skills/smali-to-kotlin/phase-3-build.md +248 -0
  22. package/skills/smali-to-kotlin/templates/app-map.md +101 -0
  23. package/skills/smali-to-kotlin/templates/architecture.md +142 -0
  24. package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
  25. package/skills/smali-to-swift/SKILL.md +532 -91
  26. package/skills/smali-to-swift/phase-0-discovery.md +101 -118
  27. package/skills/smali-to-swift/phase-1-architecture.md +62 -67
  28. package/skills/smali-to-swift/phase-2-blueprint.md +173 -0
  29. package/skills/smali-to-swift/phase-3-build.md +257 -0
  30. package/skills/smali-to-swift/templates/app-map.md +82 -0
  31. package/skills/smali-to-swift/templates/architecture.md +97 -0
  32. package/skills/smali-to-swift/templates/blueprint.md +82 -0
  33. package/skills/workflows/nm-import.md +73 -0
  34. package/skills/workflows/nm-recall.md +67 -0
  35. package/skills/workflows/nm-snapshot.md +69 -0
  36. package/workflows/_uncategorized/nm-import.md +73 -0
  37. package/workflows/_uncategorized/nm-recall.md +67 -0
  38. package/workflows/_uncategorized/nm-snapshot.md +69 -0
  39. package/workflows/_uncategorized/reverse-android-build.md +222 -0
  40. package/workflows/_uncategorized/reverse-android-design.md +139 -0
  41. package/workflows/_uncategorized/reverse-android-discover.md +150 -0
  42. package/workflows/_uncategorized/reverse-android-scan.md +158 -0
  43. package/workflows/_uncategorized/reverse-android.md +143 -0
  44. package/workflows/_uncategorized/reverse-ios-build.md +240 -0
  45. package/workflows/_uncategorized/reverse-ios-design.md +112 -0
  46. package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
  47. package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
  48. package/workflows/_uncategorized/reverse-ios.md +152 -0
  49. package/skills/adaptive-language/SKILL.md +0 -189
  50. package/skills/ambient-brain/SKILL.md +0 -314
  51. package/skills/ambient-brain/brain-router.md +0 -185
  52. package/skills/ambient-brain/brain-templates.md +0 -201
  53. package/skills/context-help/SKILL.md +0 -180
  54. package/skills/error-translator/SKILL.md +0 -153
  55. package/skills/session-restore/SKILL.md +0 -240
@@ -1,154 +1,137 @@
1
- # πŸ” Phase 0: Discovery (Satellite View) β€” iOS
1
+ # πŸ—ΊοΈ Phase 0: Discovery (Satellite View) β€” iOS
2
2
 
3
- > **Zoom Level:** 0 β€” ToΓ n cαΊ£nh
4
- > **Goal:** Understand the app: structure, frameworks, components, screen flow.
5
- > **Output:** App Map document.
3
+ > **Zoom Level:** 0 β€” Bird's Eye
4
+ > **Goal:** Create an "App Map" β€” understand WHAT the app is and WHAT it contains.
5
+ > **Output:** Diagrams, tables, maps. **NO CODE.**
6
6
 
7
7
  ---
8
8
 
9
9
  ## β›” OUTPUT RULE
10
10
 
11
11
  ```
12
- βœ… ALLOWED: Diagrams, tables, lists, reports
13
- βœ… ALLOWED: Shell commands for scanning
14
- ❌ BLOCKED: Any Swift code
15
- ❌ BLOCKED: Any implementation decisions (those come in Phase 1)
12
+ βœ… ALLOWED: ASCII diagrams, Mermaid, tables, bullet lists, bash scan commands
13
+ ❌ BLOCKED: Swift/ObjC code, function signatures, class definitions
16
14
  ```
17
15
 
18
16
  ---
19
17
 
20
18
  ## πŸ“‹ Sub-steps
21
19
 
22
- ### 0.1: Scan IPA Structure
20
+ ### 0.1: Confirm Input
23
21
 
24
- Verify decrypted IPA output:
25
22
  ```
26
- Payload/App.app/
27
- β”œβ”€β”€ App # Mach-O binary
28
- β”œβ”€β”€ Info.plist # App metadata
29
- β”œβ”€β”€ Frameworks/ # Embedded frameworks
30
- β”‚ β”œβ”€β”€ SomeSDK.framework/
31
- β”‚ └── libswiftCore.dylib
32
- β”œβ”€β”€ Assets.car # Compiled asset catalog
33
- β”œβ”€β”€ Base.lproj/ # Storyboards / XIBs (compiled)
34
- β”œβ”€β”€ *.momd # Core Data models
35
- └── [other resources]
23
+ 🍎 iOS Reverse Engineering bαΊ―t Δ‘αΊ§u!
24
+
25
+ Em cαΊ§n biαΊΏt:
26
+ 1. Decrypted .app bundle ở Δ‘Γ’u?
27
+ 2. Class-dump headers ở Δ‘Γ’u?
28
+ 3. TΓͺn app gα»‘c? Bundle ID?
29
+
30
+ ChΖ°a chuαΊ©n bα»‹?
31
+ β†’ bagbak -o ~/decrypted/ com.example.app
32
+ β†’ class-dump -H ~/decrypted/App.app -o ~/headers/
36
33
  ```
37
34
 
38
- ### 0.2: Framework Scanner
39
-
40
- Scan ALL dependencies before any coding:
41
-
42
- 1. **Scan `Frameworks/` directory:**
43
- ```
44
- Frameworks/Alamofire.framework β†’ Alamofire (network)
45
- Frameworks/SDWebImage.framework β†’ SDWebImage (image)
46
- Frameworks/Realm.framework β†’ Realm (database)
47
- Frameworks/FBSDKCoreKit.framework β†’ Facebook SDK
48
- ```
49
-
50
- 2. **Scan class-dump headers for imports:**
51
- ```
52
- #import <AFNetworking/...> β†’ AFNetworking
53
- #import <Masonry/...> β†’ Masonry (auto-layout)
54
- @import Firebase; β†’ Firebase SDK
55
- @import GoogleMobileAds; β†’ AdMob
56
- ```
57
-
58
- 3. **Check Mach-O linked frameworks:**
59
- ```bash
60
- otool -L Payload/App.app/App | grep -v /System | grep -v /usr/lib
61
- ```
62
-
63
- 4. **Check embedded dylibs:**
64
- ```bash
65
- find Payload/App.app -name "*.dylib" -o -name "*.framework" | sort
66
- ```
67
-
68
- 5. **Check for CocoaPods / SPM markers:**
69
- ```
70
- Pods/ directory β†’ was using CocoaPods
71
- .package.resolved β†’ was using SPM
72
- ```
73
-
74
- See `framework-patterns.md` for comprehensive detection patterns.
75
-
76
- ### 0.3: Info.plist & Entitlements Analysis
77
-
78
- Extract from `Info.plist`:
79
-
80
- 1. Bundle ID (`CFBundleIdentifier`)
81
- 2. Display Name
82
- 3. Min Deployment Target
83
- 4. Permissions (Privacy keys):
84
- ```
85
- NSCameraUsageDescription β†’ Camera
86
- NSPhotoLibraryUsageDescription β†’ Photo Library
87
- NSLocationWhenInUseUsageDescription β†’ Location
88
- NSMicrophoneUsageDescription β†’ Microphone
89
- ```
90
- 5. URL Schemes (deep links)
91
- 6. Capabilities from entitlements:
92
- ```
93
- com.apple.developer.associated-domains β†’ Universal Links
94
- aps-environment β†’ Push Notifications
95
- com.apple.developer.in-app-payments β†’ Apple Pay
96
- ```
97
-
98
- ### 0.4: Class Structure Analysis
99
-
100
- From class-dump headers:
101
-
102
- 1. **Entry points:** AppDelegate, SceneDelegate
103
- 2. **Root ViewController:** Tab bar? Navigation?
104
- 3. **Major ViewControllers** β†’ future SwiftUI screens
105
- 4. **Model classes** β†’ domain models
106
- 5. **Network managers** β†’ API client
107
- 6. **Singleton/manager classes** β†’ services to extract
108
-
109
- ### 0.5: Screen Flow Map
110
-
111
- ```mermaid
112
- graph LR
113
- Launch --> Login
114
- Login --> MainTab
115
- MainTab --> Home
116
- MainTab --> Search
117
- MainTab --> Profile
118
- Home --> Detail
119
- Profile --> Settings
35
+ ### 0.2: Structure Scan
36
+
37
+ QuΓ©t IPA structure để hiểu quy mΓ΄ app:
38
+
39
+ ```bash
40
+ # Embedded frameworks
41
+ ls [app_bundle]/Frameworks/ 2>/dev/null
42
+
43
+ # Linked libraries (non-system)
44
+ otool -L [app_bundle]/[AppName] | grep -v /System | grep -v /usr/lib
45
+
46
+ # Header imports (from class-dump)
47
+ grep -rh "#import <" [headers_dir]/ | sort -u | head -30
48
+ grep -rh "@import " [headers_dir]/ | sort -u
49
+
50
+ # Count ViewControllers
51
+ grep -rl "UIViewController" [headers_dir]/ | wc -l
52
+
53
+ # Resource overview
54
+ ls [app_bundle]/*.car [app_bundle]/*.momd [app_bundle]/*.storyboardc 2>/dev/null
55
+ find [app_bundle] -name "*.json" -o -name "*.plist" | grep -v Info.plist | sort
56
+
57
+ # SDK identifiers in binary
58
+ strings [app_bundle]/[AppName] | grep -i "cocoapods\|carthage\|firebase\|facebook\|google" | head -20
120
59
  ```
121
60
 
61
+ ### 0.3: Framework Detection
62
+
63
+ Scan for third-party frameworks. Ref: `framework-patterns.md`
64
+
65
+ **PhΓ’n loαΊ‘i thΓ nh 5 nhΓ³m:**
66
+
67
+ | Category | Meaning | Action |
68
+ |----------|---------|--------|
69
+ | βœ… Reuse | Modern, maintained | Add via SPM |
70
+ | πŸ”„ Replace | Legacy/deprecated | Map to modern Swift |
71
+ | 🍏 Apple | System frameworks | Use SwiftUI equivalents |
72
+ | πŸ“± Native | C/C++ dylibs | Keep, bridging header |
73
+ | 🏷️ App Code | Original app logic | Rebuild in Swift |
74
+
75
+ ### 0.4: Info.plist Analysis
76
+
77
+ ```bash
78
+ plutil -p [app_bundle]/Info.plist
79
+ codesign -d --entitlements :- [app_bundle]/[AppName] 2>/dev/null
80
+ ```
81
+
82
+ Extract:
83
+ - Bundle ID, Display Name, Min iOS version
84
+ - Privacy permissions (NSCameraUsageDescription, NSLocationWhenInUseUsageDescription, etc.)
85
+ - URL Schemes (deep links)
86
+ - Capabilities from entitlements (push, Apple Pay, Sign In with Apple, etc.)
87
+ - Supported orientations
88
+
89
+ ### 0.5: Screen Map
90
+
91
+ Analyze class-dump headers for ViewControllers:
92
+
93
+ ```bash
94
+ # Find all ViewControllers
95
+ grep -rl "UIViewController" [headers_dir]/ | sort
96
+
97
+ # Find tab bar controllers
98
+ grep -rl "UITabBarController" [headers_dir]/
99
+
100
+ # Find navigation controllers
101
+ grep -rl "UINavigationController" [headers_dir]/
102
+ ```
103
+
104
+ Map VCs β†’ future SwiftUI screens. Draw navigation flow.
105
+
122
106
  ### 0.6: Complexity Estimate
123
107
 
124
- | Area | Rating | Notes |
125
- |------|--------|-------|
126
- | Data Layer | ●●●○○ | [N] APIs, [N] Core Data entities |
127
- | Core Logic | ●●○○○ | [N] crypto utils, [N] formatters |
128
- | UI Screens | ●●●●○ | [N] screens, [N] complex views |
129
- | SDK Integration | ●●○○○ | [N] third-party, [N] native dylibs |
108
+ Rate each area 1-5 dots:
109
+ - Data Layer: ●●●○○ (APIs, DB, keychain)
110
+ - Core Logic: ●●○○○ (crypto, formatters, utils)
111
+ - UI Screens: ●●●●○ (screen count, complex layouts)
112
+ - SDK Integration: ●●○○○ (third-party, native libs)
130
113
 
131
114
  ---
132
115
 
133
116
  ## πŸ“Š Output: App Map
134
117
 
135
- Document all findings in structured format (adapt from Android `templates/app-map.md`).
118
+ Use template from `templates/app-map.md`. Must include:
119
+
120
+ 1. **Identity** β€” bundle ID, min iOS, screen count
121
+ 2. **Screen Flow** β€” navigation graph (ASCII or Mermaid)
122
+ 3. **Framework Landscape** β€” categorized dependency list
123
+ 4. **Complexity Estimate** β€” visual dots rating
124
+ 5. **Key Observations** β€” anything notable
136
125
 
137
126
  ---
138
127
 
139
128
  ## βœ… Gate
140
129
 
141
130
  ```
142
- "πŸ—ΊοΈ App Map xong. Anh review:
143
- - [N] screens detected
144
- - [N] frameworks found ([N] reuse, [N] replace)
145
- - [N] native dylibs
146
- - Complexity: [Low/Medium/High]
147
-
148
- CΓ³ gΓ¬ cαΊ§n Δ‘iều chỉnh khΓ΄ng?
149
- β†’ OK β†’ Phase 1 (Architecture Design)"
131
+ "πŸ—ΊοΈ ĐÒy lΓ  App Map. Anh review xem cΓ³ gΓ¬ cαΊ§n Δ‘iều chỉnh khΓ΄ng?"
132
+ β†’ User approves β†’ Proceed to Phase 1 (Architecture)
150
133
  ```
151
134
 
152
135
  ---
153
136
 
154
- *Phase 0: Discovery β€” Know your target before you build*
137
+ *Phase 0: Discovery β€” No code, just understanding*
@@ -1,19 +1,19 @@
1
1
  # πŸ—οΈ Phase 1: Architecture (District View) β€” iOS
2
2
 
3
3
  > **Zoom Level:** 1 β€” Architecture Design
4
- > **Goal:** Design overall architecture with UI-First build order. NO code bodies.
4
+ > **Goal:** Design the overall architecture BEFORE writing any code.
5
5
  > **Input:** Completed App Map from Phase 0.
6
- > **Output:** Architecture Blueprint document.
6
+ > **Output:** Architecture Blueprint (layer maps, feature tables). **NO CODE BODIES.**
7
7
 
8
8
  ---
9
9
 
10
10
  ## β›” OUTPUT RULE
11
11
 
12
12
  ```
13
- βœ… ALLOWED: Architecture diagrams, layer maps, feature-to-file mapping, API endpoint tables
13
+ βœ… ALLOWED: Architecture diagrams, layer maps, feature-to-file mapping tables
14
14
  βœ… ALLOWED: File paths, module names, dependency lists
15
- ⚠️ ALLOWED: Package.swift skeleton (dependencies only)
16
15
  ❌ BLOCKED: Function bodies, implementation details, actual Swift code
16
+ ⚠️ EXCEPTION: SPM dependency declarations only
17
17
  ```
18
18
 
19
19
  ---
@@ -22,65 +22,69 @@
22
22
 
23
23
  ### 1.1: Layer Design
24
24
 
25
+ Design Clean Architecture layers based on App Map:
26
+
25
27
  ```
26
28
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
27
29
  β”‚ Presentation β”‚
28
30
  β”‚ β”œβ”€β”€ Screens/ ([N] screens) β”‚
29
31
  β”‚ β”œβ”€β”€ Navigation/ (NavigationStack) β”‚
30
- β”‚ β”œβ”€β”€ Theme/ (Design system) β”‚
31
- β”‚ └── Components/ (Shared views) β”‚
32
+ β”‚ β”œβ”€β”€ Theme/ (AppTheme) β”‚
33
+ β”‚ └── Components/ (Shared Views) β”‚
32
34
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
33
35
  β”‚ Domain β”‚
34
36
  β”‚ β”œβ”€β”€ Models/ ([N] business models) β”‚
35
- β”‚ β”œβ”€β”€ Repositories/ ([N] protocols) β”‚
37
+ β”‚ β”œβ”€β”€ Repositories/ ([N] protocols) β”‚
36
38
  β”‚ └── UseCases/ ([N] use cases) β”‚
37
39
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
38
40
  β”‚ Data β”‚
39
- β”‚ β”œβ”€β”€ Network/ ([N] API endpoints) β”‚
40
- β”‚ β”œβ”€β”€ Local/ (SwiftData, Keychain) β”‚
41
- β”‚ └── Repositories/ (implementations) β”‚
41
+ β”‚ β”œβ”€β”€ Network/ (APIClient, Endpoints) β”‚
42
+ β”‚ β”œβ”€β”€ Local/ (SwiftData, Keychain) β”‚
43
+ β”‚ └── Repositories/ (implementations)β”‚
42
44
  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
43
- β”‚ DI / Utilities β”‚
44
- β”‚ └── Container, extensions, crypto β”‚
45
+ β”‚ DI β”‚
46
+ β”‚ └── AppContainer.swift β”‚
45
47
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
46
48
  ```
47
49
 
48
50
  ### 1.2: Feature β†’ File Mapping
49
51
 
50
- | Feature | Domain Model | Repository Protocol | UseCase | Screen | ViewModel |
51
- |---------|-------------|-------------------|---------|--------|-----------|
52
- | Auth | User, Token | AuthRepository | LoginUC | LoginScreen | AuthVM |
53
- | Home | Feed | HomeRepository | GetFeedUC | HomeScreen | HomeVM |
52
+ | Feature | Domain Model | Repository | UseCase | Screen(s) | ViewModel |
53
+ |---------|-------------|-----------|---------|-----------|-----------|
54
+ | Auth | User, Token | AuthRepo | LoginUC | Login, Register | AuthVM |
55
+ | Home | [Model] | [Repo] | [UC] | Home | HomeVM |
54
56
  | ... | ... | ... | ... | ... | ... |
55
57
 
56
58
  ### 1.3: API Endpoint Inventory
57
59
 
58
- | # | Method | Endpoint | Auth | Request | Response | Notes |
59
- |---|--------|----------|------|---------|----------|-------|
60
- | 1 | POST | /auth/login | No | email, pwd | JWT | - |
61
- | 2 | GET | /users/me | Bearer | - | User | - |
62
-
63
- **How to find in headers/disassembly:**
64
- ```objc
65
- // class-dump output
66
- - (void)requestWithURL:(NSURL *)url completion:(void (^)(id, NSError *))completion;
67
- // Look for string constants with "https://" or "api/"
68
- // Hopper: search for NSURLSession, dataTaskWithRequest
60
+ Extract ALL API endpoints from class-dump headers + disassembly:
61
+
62
+ | # | Method | Endpoint | Auth | Notes |
63
+ |---|--------|----------|------|-------|
64
+ | 1 | POST | /auth/login | No | JWT response |
65
+ | 2 | GET | /users/me | Bearer | User profile |
66
+
67
+ **How to find in class-dump/disassembly:**
68
+ ```
69
+ Look for: NSString init with "https://" or "http://"
70
+ Look for: properties named baseURL, apiURL, endpoint
71
+ Look for: method names like fetchUser, loginWith, getProfile
72
+ Look for: AFHTTPSessionManager or NSURLSession usage patterns
69
73
  ```
70
74
 
71
75
  ### 1.4: Data Schema Inventory
72
76
 
73
77
  | Model | Key Fields | Source | Storage |
74
78
  |-------|-----------|--------|---------|
75
- | User | id, name, email, avatar | API | SwiftData + Memory |
76
- | Settings | theme, language | Local | UserDefaults |
79
+ | User | id, name, email, avatar | API + Local | SwiftData |
80
+ | Settings | theme, lang, notif | Local only | @AppStorage |
77
81
 
78
- ### 1.5: Project Structure
82
+ ### 1.5: Xcode Project Structure
79
83
 
80
84
  ```
81
85
  App/
82
86
  β”œβ”€β”€ App.swift # @main entry point
83
- β”œβ”€β”€ AppDelegate.swift # UIKit lifecycle (for SDK init)
87
+ β”œβ”€β”€ AppDelegate.swift # UIKit lifecycle (if needed)
84
88
  β”œβ”€β”€ Info.plist
85
89
  β”œβ”€β”€ Assets.xcassets/
86
90
  β”œβ”€β”€ DI/
@@ -97,17 +101,20 @@ App/
97
101
  β”‚ └── Repositories/
98
102
  β”œβ”€β”€ Domain/
99
103
  β”‚ β”œβ”€β”€ Models/
100
- β”‚ β”œβ”€β”€ Repositories/ # Protocols
104
+ β”‚ β”œβ”€β”€ Repositories/
101
105
  β”‚ └── UseCases/
102
106
  β”œβ”€β”€ Presentation/
103
107
  β”‚ β”œβ”€β”€ Navigation/
108
+ β”‚ β”‚ β”œβ”€β”€ AppNavigation.swift
109
+ β”‚ β”‚ └── Route.swift
104
110
  β”‚ β”œβ”€β”€ Theme/
105
- β”‚ β”œβ”€β”€ Components/
111
+ β”‚ β”‚ β”œβ”€β”€ AppTheme.swift
112
+ β”‚ β”‚ └── Components/
106
113
  β”‚ └── Screens/
107
114
  β”‚ β”œβ”€β”€ Launch/
108
115
  β”‚ β”œβ”€β”€ Auth/
109
116
  β”‚ β”œβ”€β”€ Home/
110
- β”‚ └── [feature]/
117
+ β”‚ └── .../
111
118
  β”œβ”€β”€ Utilities/
112
119
  β”‚ β”œβ”€β”€ Extensions/
113
120
  β”‚ β”œβ”€β”€ Crypto/
@@ -117,57 +124,45 @@ App/
117
124
  └── Fonts/
118
125
  ```
119
126
 
120
- ### 1.6: Build Order (UI-First) ⭐
127
+ ### 1.6: Build Order
121
128
 
122
- > **IMPORTANT:** UI-First build order β€” design and approve UI before coding logic.
123
-
124
- ```
125
- Foundation (one-time):
126
- 1. 🟒 Xcode project setup + Theme/Design System
127
- 2. 🟒 Navigation structure (NavigationStack, TabView)
128
- 3. 🟒 DI Container skeleton
129
-
130
- Per Feature (repeat for each):
131
- 4. πŸ“ Blueprint: Contracts (models, protocols, use cases, state)
132
- 5. 🎨 UI Shell: Visual implementation + Resource extraction
133
- 6. 🚦 GATE: User approve UI
134
- 7. πŸ”¨ Logic: Domain β†’ Data β†’ ViewModel β†’ Wire UI
135
- 8. πŸ§ͺ Test: Integration + Parity
136
-
137
- Final (one-time):
138
- 9. πŸ“¦ SDK Integration + Native libs
139
- 10. βœ… Full Parity Check
140
- ```
129
+ | # | Phase | Scope | Complexity |
130
+ |---|-------|-------|-----------|
131
+ | 1 | 🟒 Setup | Xcode project + SPM deps + Theme | Low |
132
+ | 2 | 🟒 Models | Domain structs | Low |
133
+ | 3 | 🟑 Data | APIClient + SwiftData + Keychain | Medium |
134
+ | 4 | 🟑 Utils | Crypto, formatters (parity test!) | Medium |
135
+ | 5 | πŸ”΄ Feature: [First] | Blueprint β†’ Build | High |
136
+ | 6 | πŸ”΄ Feature: [Second] | Blueprint β†’ Build | High |
137
+ | N | πŸ”΄ Final | Parity check + QA | High |
141
138
 
142
139
  ### 1.7: Tech Stack Decisions
143
140
 
144
141
  | Decision | Choice | Rationale |
145
142
  |----------|--------|-----------|
146
- | Image Loading | Kingfisher | Mature, async, cache |
147
- | State Management | @Observable | iOS 17+ native |
148
- | Package Manager | SPM | Apple-native, modern |
149
- | ... | ... | ... |
143
+ | UI | SwiftUI + iOS 17+ | Modern, declarative |
144
+ | State | @Observable | Latest, no Combine boilerplate |
145
+ | Network | URLSession async/await | Apple native, no deps |
146
+ | JSON | Codable | Built-in, type-safe |
147
+ | Local DB | SwiftData | [or Core Data if < iOS 17] |
148
+ | DI | Protocol + init injection | No framework needed |
149
+ | Package Manager | SPM | Standard, no CocoaPods |
150
150
 
151
151
  ---
152
152
 
153
153
  ## πŸ“Š Output: Architecture Blueprint
154
154
 
155
- Structured document with all sections above.
155
+ Use template from `templates/architecture.md`.
156
156
 
157
157
  ---
158
158
 
159
159
  ## βœ… Gate
160
160
 
161
161
  ```
162
- "πŸ—οΈ Architecture Blueprint xong.
163
- Build order: UI-First per feature.
164
- Anh muα»‘n bαΊ―t Δ‘αΊ§u tα»« feature nΓ o?
165
- Em suggest: [Feature X] vì [reason]."
166
-
167
- β†’ User picks feature β†’ Phase 2 (Blueprint + UI Design)
168
- β†’ User wants changes β†’ Adjust architecture
162
+ "πŸ—οΈ Architecture Blueprint xong. Anh muα»‘n bαΊ―t Δ‘αΊ§u tα»« feature nΓ o?"
163
+ β†’ User picks feature β†’ Phase 2 (Blueprint)
169
164
  ```
170
165
 
171
166
  ---
172
167
 
173
- *Phase 1: Architecture β€” Design before you build, UI before logic*
168
+ *Phase 1: Architecture β€” Design before you build*
@@ -0,0 +1,173 @@
1
+ # πŸ“ Phase 2: Blueprint (Block View β€” per feature) β€” iOS
2
+
3
+ > **Zoom Level:** 2 β€” Feature Detail
4
+ > **Goal:** Design contracts and state for ONE specific feature.
5
+ > **Input:** Architecture Blueprint (Phase 1) + user's chosen feature.
6
+ > **Output:** Feature Blueprint with code signatures. **NO implementation bodies yet.**
7
+
8
+ ---
9
+
10
+ ## β›” OUTPUT RULE
11
+
12
+ ```
13
+ βœ… ALLOWED: Protocol signatures, struct definitions, enum cases
14
+ βœ… ALLOWED: Endpoint definitions (path + method, no body)
15
+ βœ… ALLOWED: State design (@Observable properties, no logic)
16
+ ❌ BLOCKED: Function body implementations
17
+ ❌ BLOCKED: Full ViewModel logic, full View implementations
18
+ ```
19
+
20
+ ---
21
+
22
+ ## πŸ“‹ Sub-steps (per feature)
23
+
24
+ ### 2.1: Deep Header/Disassembly Reading
25
+
26
+ Read class-dump headers + Hopper pseudo-code for the chosen feature.
27
+
28
+ **What to extract:**
29
+ - Class hierarchy (@interface ... : NSObject)
30
+ - Properties β†’ model fields
31
+ - Method signatures β†’ API contracts
32
+ - String constants β†’ URLs, keys
33
+ - Delegate/datasource patterns β†’ business rules
34
+
35
+ **ObjC Header Reading Quick Ref:**
36
+ ```objc
37
+ @property (nonatomic, copy) NSString *name; // β†’ let name: String
38
+ @property (nonatomic, strong) NSArray *items; // β†’ let items: [Any]
39
+ @property (nonatomic, assign) BOOL isActive; // β†’ let isActive: Bool
40
+ @property (nonatomic, assign) NSInteger count; // β†’ let count: Int
41
+ @property (nullable) NSString *bio; // β†’ let bio: String?
42
+
43
+ - (void)fetchWithCompletion:(void(^)(id, NSError*))completion;
44
+ // β†’ func fetch() async throws -> T
45
+
46
+ + (instancetype)sharedInstance;
47
+ // β†’ static let shared = ClassName()
48
+ ```
49
+
50
+ ### 2.2: Domain Model Contracts
51
+
52
+ ```swift
53
+ struct User: Codable, Identifiable, Sendable {
54
+ let id: String
55
+ let fullName: String
56
+ let email: String
57
+ let avatarUrl: String?
58
+ let isVerified: Bool
59
+
60
+ enum CodingKeys: String, CodingKey {
61
+ case id = "user_id"
62
+ case fullName = "full_name"
63
+ case email
64
+ case avatarUrl = "avatar_url"
65
+ case isVerified = "is_verified"
66
+ }
67
+ }
68
+ ```
69
+
70
+ ### 2.3: Repository Contract
71
+
72
+ ```swift
73
+ protocol AuthRepository: Sendable {
74
+ func login(email: String, password: String) async throws -> User
75
+ func register(name: String, email: String, password: String) async throws -> User
76
+ func logout() async
77
+ var isLoggedIn: AsyncStream<Bool> { get }
78
+ var currentUser: AsyncStream<User?> { get }
79
+ }
80
+ ```
81
+
82
+ ### 2.4: API Contract
83
+
84
+ ```swift
85
+ enum AuthEndpoint: Endpoint {
86
+ case login(email: String, password: String)
87
+ case register(name: String, email: String, password: String)
88
+ case currentUser
89
+
90
+ var path: String { /* ... */ }
91
+ var method: HTTPMethod { /* ... */ }
92
+ }
93
+ ```
94
+
95
+ ### 2.5: UseCase Signatures
96
+
97
+ ```swift
98
+ struct LoginUseCase: Sendable {
99
+ let authRepository: AuthRepository
100
+ func execute(email: String, password: String) async throws -> User
101
+ // Implementation: TODO
102
+ }
103
+ ```
104
+
105
+ ### 2.6: UI State Design
106
+
107
+ ```swift
108
+ // ViewModel properties (will be @Observable)
109
+ // - email: String
110
+ // - password: String
111
+ // - isLoading: Bool
112
+ // - showError: Bool
113
+ // - errorMessage: String
114
+ // - isPasswordVisible: Bool
115
+
116
+ // Actions the view can trigger:
117
+ // - updateEmail(String)
118
+ // - updatePassword(String)
119
+ // - togglePasswordVisibility()
120
+ // - login()
121
+
122
+ // Navigation events:
123
+ // - navigateToHome(User)
124
+ // - showSnackbar(String)
125
+ ```
126
+
127
+ ### 2.7: UI Wireframe
128
+
129
+ ```markdown
130
+ ### LoginScreen Wireframe
131
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
132
+ β”‚ [App Logo] β”‚
133
+ β”‚ β”‚
134
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
135
+ β”‚ β”‚ Email TextField β”‚ β”‚
136
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
137
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
138
+ β”‚ β”‚ Password Field πŸ‘β”‚ β”‚
139
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
140
+ β”‚ β”‚
141
+ β”‚ [═══ Login Button ══]β”‚
142
+ β”‚ β”‚
143
+ β”‚ Forgot Password? β”‚
144
+ β”‚ Register β”‚
145
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
146
+
147
+ Behaviors:
148
+ - Email: .textContentType(.emailAddress), .keyboardType(.emailAddress)
149
+ - Password: toggle visibility, .textContentType(.password)
150
+ - Button: .disabled when loading, overlay ProgressView
151
+ - Error: .alert modifier
152
+ - Success: NavigationStack push to Home
153
+ ```
154
+
155
+ ---
156
+
157
+ ## πŸ“Š Output: Feature Blueprint
158
+
159
+ Use template from `templates/blueprint.md`.
160
+
161
+ ---
162
+
163
+ ## βœ… Gate
164
+
165
+ ```
166
+ "πŸ“ Blueprint cho [Feature] xong. Anh xem contracts α»•n khΓ΄ng?"
167
+ β†’ OK β†’ Phase 3 (Implementation)
168
+ β†’ Adjust β†’ Update blueprint
169
+ ```
170
+
171
+ ---
172
+
173
+ *Phase 2: Blueprint β€” Contracts before code*