@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.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.0.7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@leejungkiin/awkit",
3
- "version": "1.0.5",
4
- "description": "AWKit v1.0.5 — Antigravity Workflow Kit. Unified AI agent orchestration system.",
3
+ "version": "1.0.7",
4
+ "description": "AWKit v1.0.7 — Antigravity Workflow Kit. Unified AI agent orchestration system.",
5
5
  "main": "bin/awk.js",
6
6
  "bin": {
7
7
  "awkit": "bin/awk.js",
@@ -3,9 +3,10 @@ name: smali-to-kotlin
3
3
  description: >-
4
4
  Android Reverse Engineering specialist. Reads Apktool output (Smali, resources, manifest)
5
5
  and rebuilds the app from scratch using modern Kotlin + Jetpack Compose + Clean Architecture.
6
+ UI-First approach: design and approve UI visuals before coding logic.
6
7
  Includes library detection to reuse existing dependencies.
7
8
  author: Antigravity Team
8
- version: 1.0.0
9
+ version: 2.0.0
9
10
  trigger: conditional
10
11
  activation_keywords:
11
12
  - "/reverse-android"
@@ -18,14 +19,14 @@ activation_keywords:
18
19
  - "smali to kotlin"
19
20
  priority: high
20
21
  platform: android
21
- extensible_to:
22
- - ios (separate skill: smali-to-swift — planned)
22
+ sibling_skill: smali-to-swift (iOS counterpart)
23
23
  ---
24
24
 
25
- # 🔧 Smali-to-Kotlin Skill
25
+ # 🔧 Smali-to-Kotlin Skill v2 — UI-First
26
26
 
27
27
  > **Purpose:** Transform decompiled Android APK (Apktool output) into a modern Kotlin app with Jetpack Compose, Clean Architecture, and MVVM.
28
- > **Philosophy:** "Read Smali to understand WHAT and WHY Write Kotlin for HOW."
28
+ > **Philosophy:** "Map Blueprint UI FirstLogic Behind"
29
+ > **Key Change (v2):** UI is designed and approved BEFORE coding any business logic.
29
30
 
30
31
  ---
31
32
 
@@ -38,9 +39,9 @@ extensible_to:
38
39
  | Detect & reuse third-party libraries | Crack/bypass security |
39
40
  | Extract only needed resources (on-demand) | Mass-copy resources blindly |
40
41
  | Set up Clean Architecture project structure | Handle iOS reverse engineering |
41
- | Scan APK libraries for package reuse | Deploy to Play Store |
42
+ | Code UI first, then wire logic behind | Deploy to Play Store |
42
43
 
43
- → For iOS reverse engineering → future skill: `smali-to-swift`
44
+ → For iOS reverse engineering → sibling skill: `smali-to-swift`
44
45
  → After rebuild complete → use `/test` or `/deploy` workflows
45
46
 
46
47
  ---
@@ -53,7 +54,7 @@ When this skill is active, the agent becomes:
53
54
  > - Master at reading Smali bytecode and obfuscated Java
54
55
  > - Fluent in Clean Architecture + MVVM + Jetpack Compose
55
56
  > - Knows when to reuse vs rewrite third-party dependencies
56
- > - Enforces resource-on-demand principle (zero bloat)
57
+ > - Enforces UI-First and resource-on-demand principles
57
58
 
58
59
  ---
59
60
 
@@ -97,7 +98,7 @@ always_replace:
97
98
  ListView/GridView: "LazyColumn/LazyGrid (Compose)"
98
99
  findViewById: "Compose state"
99
100
  Gson: "Kotlin Serialization (kotlinx.serialization)"
100
-
101
+
101
102
  evaluate_before_replacing:
102
103
  Glide: "Keep if deeply integrated, otherwise → Coil"
103
104
  RxJava: "Migrate to Coroutines + Flow (gradual)"
@@ -115,312 +116,58 @@ keep_as_is:
115
116
 
116
117
  ---
117
118
 
118
- ## 📋 EXECUTION PIPELINE (6 Steps)
119
-
120
- > **Rule:** Always complete one step fully before moving to the next.
121
- > **Rule:** After each step, create a checkpoint summary for the user.
122
-
123
- ### Step 0: Library Scanner (PRE-STEP — Always First) 🔍
124
-
125
- **Purpose:** Scan the APK structure to identify all third-party libraries before any coding.
126
-
127
- **Process:**
128
- 1. **Scan `smali/` directories** for package patterns:
129
- ```
130
- smali/com/google/ → Google SDKs
131
- smali/com/facebook/ → Facebook SDK
132
- smali/com/squareup/ → OkHttp, Retrofit, Picasso
133
- smali/io/reactivex/ → RxJava
134
- smali/org/greenrobot/ → EventBus
135
- smali/com/bumptech/ → Glide
136
- smali/com/airbnb/ → Lottie
137
- smali/androidx/ → AndroidX (baseline)
138
- smali/com/jakewharton/ → Butterknife, Timber
139
- ```
140
-
141
- 2. **Check `lib/` for native libraries (.so)**:
142
- ```
143
- lib/arm64-v8a/*.so → 64-bit native libs
144
- lib/armeabi-v7a/*.so → 32-bit native libs
145
- ```
146
-
147
- 3. **Check `assets/` for embedded resources:**
148
- - ML models (.tflite, .onnx)
149
- - WebView HTML/JS bundles
150
- - Config files (JSON, XML)
151
-
152
- 4. **Output: Library Report**
153
- ```markdown
154
- ## 📦 Library Detection Report
155
-
156
- ### ✅ Can Reuse (add to build.gradle)
157
- | Library | Detected Package | Latest Version | Action |
158
- |---------|-----------------|----------------|--------|
159
- | Retrofit | com.squareup.retrofit2 | 2.9.0 | Add dependency |
160
- | OkHttp | com.squareup.okhttp3 | 4.12.0 | Add dependency |
161
- | Glide | com.bumptech.glide | 4.16.0 | Evaluate → Coil? |
162
-
163
- ### 🔄 Must Replace (legacy)
164
- | Old Library | Detected Package | Replacement |
165
- |-------------|-----------------|-------------|
166
- | Volley | com.android.volley | Retrofit |
167
- | AsyncTask | android.os.AsyncTask | Coroutines |
168
-
169
- ### 📱 Native (.so) — Keep As-Is
170
- | File | Architecture | Notes |
171
- |------|-------------|-------|
172
- | libfoo.so | arm64-v8a | Need JNI bridge |
173
-
174
- ### ❓ Unknown (investigate)
175
- | Package | Path | Possible Library |
176
- |---------|------|-----------------|
177
- | com.xyz.abc | smali/com/xyz/abc | Custom? |
178
- ```
119
+ ## 📋 EXECUTION PIPELINE (v2 — UI-First)
179
120
 
180
- ---
121
+ > **Philosophy:** "Nhìn thấy trước, code logic sau"
122
+ > **Rule:** Always complete one phase fully before moving to the next.
123
+ > **Rule:** UI must be approved before coding logic.
181
124
 
182
- ### Step 1: AndroidManifest Analysis & Project Bootstrap 📄
183
-
184
- **Input:** User provides `AndroidManifest.xml` from Apktool output.
185
-
186
- **Tasks:**
187
- 1. Extract Application ID and original package name
188
- 2. List all required permissions (group by category: network, storage, camera, etc.)
189
- 3. Identify entry points:
190
- - `Application` class (custom init logic?)
191
- - `SplashActivity` / Launcher Activity
192
- - `MainActivity`
193
- 4. Map all components:
194
- - Activities → future Compose screens
195
- - Services → WorkManager candidates?
196
- - BroadcastReceivers → keep or replace with Flow?
197
- - ContentProviders → keep or replace with Room?
198
- 5. Detect intent-filters for deep links
199
- 6. **Output:** Propose Clean Architecture project structure
200
-
201
- **Project Structure Template:**
202
125
  ```
203
- app/
204
- ├── src/main/
205
- │ ├── java/com/package/app/
206
- │ ├── App.kt # Application class
207
- │ ├── di/ # Hilt modules
208
- │ ├── AppModule.kt
209
- │ ├── NetworkModule.kt
210
- │ │ │ └── DatabaseModule.kt
211
- │ │ ├── data/ # Data Layer
212
- │ │ │ ├── remote/
213
- │ │ │ │ ├── api/ # Retrofit interfaces
214
- │ │ │ │ ├── dto/ # Data Transfer Objects
215
- │ │ │ │ └── interceptor/ # OkHttp interceptors
216
- │ │ │ ├── local/
217
- │ │ │ │ ├── db/ # Room database
218
- │ │ │ │ ├── dao/ # Room DAOs
219
- │ │ │ │ ├── entity/ # Room entities
220
- │ │ │ │ └── datastore/ # DataStore preferences
221
- │ │ │ └── repository/ # Repository implementations
222
- │ │ ├── domain/ # Domain Layer
223
- │ │ │ ├── model/ # Business models
224
- │ │ │ ├── repository/ # Repository interfaces
225
- │ │ │ └── usecase/ # Use cases
226
- │ │ ├── presentation/ # Presentation Layer
227
- │ │ │ ├── navigation/ # NavGraph + Routes
228
- │ │ │ ├── theme/ # Material 3 Theme
229
- │ │ │ ├── components/ # Reusable Compose components
230
- │ │ │ └── screens/ # Feature screens
231
- │ │ │ ├── splash/
232
- │ │ │ │ ├── SplashScreen.kt
233
- │ │ │ │ └── SplashViewModel.kt
234
- │ │ │ ├── home/
235
- │ │ │ │ ├── HomeScreen.kt
236
- │ │ │ │ └── HomeViewModel.kt
237
- │ │ │ └── ...
238
- │ │ └── util/ # Extensions, helpers
239
- │ ├── res/ # Only needed resources
240
- │ └── AndroidManifest.xml # Clean manifest
241
- ├── build.gradle.kts
242
- └── proguard-rules.pro
126
+ Phase 0: Discovery → App Map (satellite view)
127
+ Phase 1: Architecture → Layer design + UI-First build order (district view)
128
+ ┌─── Loop per Feature ──────────────────────────────────────┐
129
+ Phase 2: Blueprint + UI → Contracts + Visual UI Shell │
130
+ 🚦 GATE: User approves UI + Contracts │
131
+ Phase 3: Logic Build → Domain → Data → Wire UI↔Logic
132
+ 📊 CHECKPOINT: Feature complete
133
+ └─── Repeat for next feature ───────────────────────────────┘
134
+ Phase 4: Final Parity Check
243
135
  ```
244
136
 
245
- ---
246
-
247
- ### Step 2: Data Layer Reconstruction 💾
248
-
249
- **Input:** User provides Smali/Java code for API endpoints, JSON models, database queries.
250
-
251
- **Tasks:**
252
- 1. **Models:** Convert POJO/Model Smali → Kotlin `data class`
253
- - Use `@Serializable` (kotlinx.serialization) or `@JsonClass` (Moshi)
254
- - Preserve JSON field names with `@SerialName`
255
- 2. **API Layer:**
256
- - Extract base URL, endpoints, headers from Smali
257
- - Create Retrofit `@GET/@POST` interfaces
258
- - Identify auth patterns (token, API key, custom headers)
259
- 3. **Local Storage:**
260
- - SQLite queries → Room entities + DAOs
261
- - SharedPreferences keys → DataStore schema
262
- 4. **Repository:**
263
- - Create interface in `domain/repository/`
264
- - Implement in `data/repository/`
265
- - Use Flow for reactive data streams
266
-
267
- **Smali Reading Tips:**
268
- ```
269
- # Finding API base URL:
270
- Look for: const-string → "https://" or "http://"
271
- Look for: .field → BASE_URL or API_URL
137
+ ### Reference Files
272
138
 
273
- # Finding endpoints:
274
- Look for: StringBuilder + append patterns
275
- Look for: Annotation patterns (@GET, @POST in obfuscated form)
139
+ Each phase has a detailed instruction file:
140
+ - `phase-0-discovery.md` Library scan, manifest analysis, app map
141
+ - `phase-1-architecture.md` Layer design, feature mapping, build order
142
+ - `phase-2-blueprint-ui.md` — Contracts + UI visual shell + parity check
143
+ - `phase-3-logic-build.md` — Domain, data, DI, ViewModel, wire UI↔logic
276
144
 
277
- # Finding JSON parsing:
278
- Look for: JSONObject, JSONArray usage
279
- Look for: Gson.fromJson / TypeToken patterns
280
- ```
145
+ ### Supporting Files
146
+ - `smali-reading-guide.md` How to read Smali bytecode
147
+ - `library-patterns.md` Common Android library detection patterns
148
+ - `templates/app-map.md` — App Map output template
149
+ - `templates/architecture.md` — Architecture Blueprint template
150
+ - `templates/blueprint.md` — Feature Blueprint template
281
151
 
282
152
  ---
283
153
 
284
- ### Step 3: Core Logic & Utils Reconstruction 🧮
154
+ ## 🔑 KEY DIFFERENCES FROM v1
285
155
 
286
- **Input:** User provides Smali for encryption, hashing, time formatting, custom utils.
287
-
288
- **Tasks:**
289
- 1. Translate mathematical/encryption logic from Smali Kotlin
290
- - Preserve exact input/output signatures (critical for server compatibility)
291
- - Use `object` for stateless utils, extension functions for type-specific
292
- 2. Map special encoding patterns:
293
- - MD5/SHA hashing `MessageDigest`
294
- - AES/DES encryption `javax.crypto.Cipher`
295
- - Base64 `android.util.Base64` or `java.util.Base64`
296
- - Custom obfuscation → reverse engineer step-by-step
297
- 3. **Verification:** Create unit tests that compare output with original app
298
-
299
- **Critical Rule:**
300
- > ⚠️ Encryption and hashing functions MUST produce identical output to the original app.
301
- > Any mismatch will break server communication. Always unit test with known input/output pairs.
302
-
303
- ---
304
-
305
- ### Step 4: UI & ViewModel Reconstruction (Per Screen) 🎨
306
-
307
- **Input:** User provides `layout_xxx.xml` + corresponding Smali for Activity/Fragment.
308
-
309
- **Tasks:**
310
- 1. **Resource Extraction (On-Demand):**
311
- - List ONLY the drawables, strings, colors, dimens used in this specific screen
312
- - User copies only those resources to the new project
313
- - Clean up namespace references in resources
314
-
315
- 2. **Compose Migration:**
316
- - Convert XML layout → Jetpack Compose composables
317
- - Map View attributes → Compose modifiers
318
- - Common mappings:
319
- ```
320
- LinearLayout (vertical) → Column
321
- LinearLayout (horizontal) → Row
322
- FrameLayout → Box
323
- RelativeLayout → Box with alignment / ConstraintLayout
324
- RecyclerView → LazyColumn / LazyGrid
325
- ScrollView → verticalScroll modifier
326
- ImageView → Image / AsyncImage (Coil)
327
- TextView → Text
328
- EditText → TextField / OutlinedTextField
329
- Button → Button / TextButton / OutlinedButton
330
- ProgressBar → CircularProgressIndicator / LinearProgressIndicator
331
- CardView → Card (Material 3)
332
- Toolbar/ActionBar → TopAppBar (Material 3)
333
- BottomNavigationView → NavigationBar (Material 3)
334
- TabLayout + ViewPager → TabRow + HorizontalPager
335
- SwipeRefreshLayout → pullRefresh modifier
336
- ```
337
-
338
- 3. **ViewModel Creation:**
339
- - Read Smali logic flow: when API calls happen, loading states, form validation
340
- - Create sealed class for UI state:
341
- ```kotlin
342
- sealed interface ScreenUiState {
343
- data object Loading : ScreenUiState
344
- data class Success(val data: ScreenData) : ScreenUiState
345
- data class Error(val message: String) : ScreenUiState
346
- }
347
- ```
348
- - Expose via `StateFlow` from ViewModel
349
- - Handle one-time events via `SharedFlow` (navigation, snackbar, toast)
350
-
351
- 4. **Screen Composable:**
352
- - Collect state from ViewModel
353
- - Implement Material 3 theming
354
- - Handle navigation via Navigation Compose
355
-
356
- ---
357
-
358
- ### Step 5: Third-party SDK & Native Library Integration 📦
359
-
360
- **Input:** User provides JNI libs list and SDK detection from Step 0.
361
-
362
- **Tasks:**
363
- 1. **Native Libraries (.so):**
364
- - Keep .so files in `jniLibs/` directory
365
- - Declare `external fun` in Kotlin matching C/C++ signatures
366
- - Use `System.loadLibrary("name")` in companion object or init block
367
- - Document JNI method signatures
368
-
369
- 2. **SDKs (from Library Report):**
370
- - Add latest stable versions to `build.gradle.kts`
371
- - Initialize in `Application` class using modern patterns:
372
- ```kotlin
373
- @HiltAndroidApp
374
- class App : Application() {
375
- override fun onCreate() {
376
- super.onCreate()
377
- // Firebase (auto-init via manifest, or manual)
378
- // Timber
379
- if (BuildConfig.DEBUG) {
380
- Timber.plant(Timber.DebugTree())
381
- }
382
- }
383
- }
384
- ```
385
- - Replace deprecated SDK API calls with current documentation
386
-
387
- 3. **build.gradle.kts Setup:**
388
- - Use Version Catalogs (`libs.versions.toml`) for dependency management
389
- - Configure Compose compiler, Hilt plugin, KSP
390
- - Set up proper minSdk, targetSdk, compileSdk
391
-
392
- ---
393
-
394
- ### Step 6: Parity Check & Quality Gate ✅
395
-
396
- **Per-module checklist:**
397
- 1. **Branch Coverage:** Review all `if-else`, `switch/when`, `try-catch` paths from Smali
398
- - List discovered branches as test cases
399
- - Ask user to test each edge case
400
-
401
- 2. **API Parity:** Verify all API endpoints produce same request/response
402
- - Compare headers, body format, encoding
403
- - Test auth flow end-to-end
404
-
405
- 3. **Data Parity:** Verify local storage read/write matches original
406
- - Migration path from old DB schema if user needs it
407
-
408
- 4. **UI Parity:** Compare screen-by-screen
409
- - Layout matches (spacing, colors, interactions)
410
- - Navigation flow matches
411
- - Error states handled
412
-
413
- 5. **Performance Check:**
414
- - ProGuard/R8 rules for release build
415
- - No unnecessary allocations in Compose (stable/immutable)
416
- - Proper coroutine scope management
156
+ | Aspect | v1 (Old) | v2 (UI-First) |
157
+ |--------|----------|---------------|
158
+ | **Pipeline** | 6-step linear | 4-phase with feature loop |
159
+ | **UI coded when** | Last (Step 4) | Early (Phase 2, before logic) |
160
+ | **Resource extraction** | Last (Step 4.1) | Early (Phase 2.7, before UI code) |
161
+ | **Visual parity check** | End only (Step 6) | Mid-pipeline (Phase 2.9) + Final |
162
+ | **Gate between UI/Logic** | None | Mandatory — user approves UI first |
163
+ | **Wireframe** | ASCII text only | Full Compose code with @Preview |
164
+ | **User feedback** | 1 time (end) | 2 times (UI gate + final check) |
165
+ | **Rework risk** | High | Low (UI locked before logic) |
417
166
 
418
167
  ---
419
168
 
420
169
  ## 🔄 WORKFLOW INTEGRATION
421
170
 
422
- ### With Other Skills/Workflows:
423
-
424
171
  ```yaml
425
172
  triggers_from:
426
173
  - "/reverse-android" workflow command
@@ -429,7 +176,7 @@ triggers_from:
429
176
  delegates_to:
430
177
  - "/test" — after parity check
431
178
  - "/deploy" — when rebuild is complete
432
- - beads-manager — auto-track progress per step
179
+ - beads-manager — auto-track progress per phase
433
180
 
434
181
  works_with:
435
182
  - memory-sync — saves decisions, patterns, solutions
@@ -437,18 +184,21 @@ works_with:
437
184
 
438
185
  independent_from:
439
186
  - brainstorm-agent
440
- - ios-engineer (but shares design philosophy)
187
+ - smali-to-swift (sibling, same pattern, different platform)
441
188
  ```
442
189
 
443
- ### Session State Tracking:
190
+ ### Session State Tracking
444
191
 
445
192
  ```yaml
446
193
  session_state:
447
- current_step: 0-6
448
- current_screen: "HomeScreen" (for step 4 iterations)
449
- library_report: generated | pending
450
- completed_screens: ["SplashScreen", "LoginScreen"]
451
- pending_screens: ["HomeScreen", "SettingsScreen"]
194
+ current_phase: 0-4
195
+ current_feature: "Auth"
196
+ phase_2_status:
197
+ contracts: approved | pending
198
+ ui_shell: approved | pending
199
+ resources: extracted | pending
200
+ completed_features: ["Splash", "Login"]
201
+ pending_features: ["Home", "Settings"]
452
202
  ```
453
203
 
454
204
  ---
@@ -457,8 +207,11 @@ session_state:
457
207
 
458
208
  ```yaml
459
209
  never_do:
460
- - Copy all resources blindly from APK → only on-demand
461
- - Use deprecated libraries (AsyncTask, Volley)always use modern replacements
210
+ - Copy all resources blindly from APK → only on-demand per screen
211
+ - Skip Phase 2 UI gatejump to logic coding
212
+ - Code ViewModel before UI is approved → UI design might change
213
+ - Modify UI shell significantly in Phase 3 → only wire, don't redesign
214
+ - Use deprecated libraries → always use modern replacements
462
215
  - Skip library scanning step → always detect reusable packages first
463
216
  - Modify encryption output → must match original exactly
464
217
  - Create massive God Activity → split into Compose screens + ViewModels
@@ -466,10 +219,12 @@ never_do:
466
219
  - Skip parity check → always verify against original behavior
467
220
 
468
221
  always_do:
469
- - Run Library Scanner (Step 0) before any coding
222
+ - Run Library Scanner (Phase 0) before any coding
223
+ - Extract resources BEFORE coding UI (2.7 → 2.8)
224
+ - Create @Preview for ALL states (normal, loading, error, empty)
225
+ - Get user approval on UI before coding logic
226
+ - Keep stateless composable for Preview even after wiring
470
227
  - Present library report to user for approval
471
- - Ask user to confirm each step's output before proceeding
472
- - Create checkpoint summary after each step
473
228
  - Unit test all encryption/hashing utils
474
229
  - Use sealed classes for UI state
475
230
  - Follow Clean Architecture layer separation strictly
@@ -479,43 +234,42 @@ always_do:
479
234
 
480
235
  ## 📊 CHECKPOINT TEMPLATE
481
236
 
482
- After each step, output:
237
+ After each phase/feature, output:
483
238
 
484
239
  ```markdown
485
- ## ✅ Step [N] Complete: [Step Name]
240
+ ## ✅ [Phase/Feature] Complete: [Name]
486
241
 
487
242
  ### What was done:
488
- - [Summary of actions]
243
+ - [Summary]
489
244
 
490
245
  ### Files created:
491
- - [List of new files]
246
+ - [List]
492
247
 
493
248
  ### Resources extracted:
494
- - [List of resources moved to new project]
249
+ - [Only what was needed]
495
250
 
496
251
  ### Decisions made:
497
- - [Key decisions documented]
252
+ - [Key decisions]
498
253
 
499
- ### ⏭️ Next: Step [N+1] — [Step Name]
254
+ ### ⏭️ Next: [Phase/Feature] — [Name]
500
255
  - [What user needs to provide]
501
- - [What will be done]
502
256
  ```
503
257
 
504
258
  ---
505
259
 
506
- ## 🧩 EXTENSIBILITY NOTE
260
+ ## 🧩 PLATFORM RE TEMPLATE PATTERN
261
+
262
+ This skill follows the same **4-phase pipeline** as `smali-to-swift`:
507
263
 
508
- This skill follows the **Platform RE Template Pattern**:
509
- - Core workflow (6 steps) is transferable to other platforms
510
- - Technology mappings are platform-specific (this file: Android)
511
- - Future `smali-to-swift` skill will follow same structure with iOS tech stack:
512
- - Smali Swift
513
- - Jetpack Compose SwiftUI
514
- - Room Core Data / SwiftData
515
- - Retrofit → URLSession / Alamofire
516
- - Hilt → Swift DI patterns
264
+ | Phase | Android (smali-to-kotlin) | iOS (smali-to-swift) |
265
+ |-------|--------------------------|---------------------|
266
+ | 0 | Library Scanner (Smali packages) | Framework Scanner (Frameworks/ + headers) |
267
+ | 1 | AndroidManifest Architecture | Info.plist Architecture |
268
+ | 2 | Contracts + Compose UI Shell | Contracts + SwiftUI Shell |
269
+ | 3 | Domain + Data + Wire Compose | Domain + Data + Wire SwiftUI |
270
+ | 4 | Parity Check | Parity Check |
517
271
 
518
272
  ---
519
273
 
520
- *smali-to-kotlin v1.0.0 — Android Reverse Engineering Skill for AWF*
274
+ *smali-to-kotlin v2.0.0 — UI-First Android Reverse Engineering Skill*
521
275
  *Created by Antigravity Team*
@@ -0,0 +1,129 @@
1
+ # 🔍 Phase 0: Discovery (Satellite View) — Android
2
+
3
+ > **Zoom Level:** 0 — Toàn cảnh
4
+ > **Goal:** Understand the app: structure, libraries, components, screen flow.
5
+ > **Output:** App Map document (`app-map.md`)
6
+
7
+ ---
8
+
9
+ ## ⛔ OUTPUT RULE
10
+
11
+ ```
12
+ ✅ ALLOWED: Diagrams, tables, lists, reports
13
+ ✅ ALLOWED: Shell commands for scanning
14
+ ❌ BLOCKED: Any Kotlin code
15
+ ❌ BLOCKED: Any implementation decisions (those come in Phase 1)
16
+ ```
17
+
18
+ ---
19
+
20
+ ## 📋 Sub-steps
21
+
22
+ ### 0.1: Scan APK Structure
23
+
24
+ Verify Apktool output structure:
25
+ ```
26
+ [apktool_dir]/
27
+ ├── AndroidManifest.xml ← Entry point
28
+ ├── smali/ ← Decompiled bytecode
29
+ ├── res/ ← Resources (layouts, drawables, strings...)
30
+ ├── assets/ ← Raw assets (ML models, configs...)
31
+ ├── lib/ ← Native libraries (.so)
32
+ └── original/ ← Original META-INF
33
+ ```
34
+
35
+ ### 0.2: Library Scanner
36
+
37
+ Scan ALL dependencies before any coding:
38
+
39
+ 1. **Scan `smali/` directories** for package patterns:
40
+ ```
41
+ smali/com/google/ → Google SDKs
42
+ smali/com/facebook/ → Facebook SDK
43
+ smali/com/squareup/ → OkHttp, Retrofit, Picasso
44
+ smali/io/reactivex/ → RxJava
45
+ smali/org/greenrobot/ → EventBus
46
+ smali/com/bumptech/ → Glide
47
+ smali/com/airbnb/ → Lottie
48
+ smali/androidx/ → AndroidX (baseline)
49
+ smali/com/jakewharton/ → Butterknife, Timber
50
+ ```
51
+
52
+ 2. **Check `lib/` for native libraries (.so)**:
53
+ ```
54
+ lib/arm64-v8a/*.so → 64-bit native libs
55
+ lib/armeabi-v7a/*.so → 32-bit native libs
56
+ ```
57
+
58
+ 3. **Check `assets/` for embedded resources:**
59
+ - ML models (.tflite, .onnx)
60
+ - WebView HTML/JS bundles
61
+ - Config files (JSON, XML)
62
+
63
+ 4. **Output: Library Detection Report** — see `library-patterns.md` for comprehensive patterns.
64
+
65
+ ### 0.3: AndroidManifest Analysis
66
+
67
+ Extract from `AndroidManifest.xml`:
68
+
69
+ 1. Application ID (`package` attribute)
70
+ 2. Min/Target SDK versions
71
+ 3. Permissions (group by category: network, storage, camera, etc.)
72
+ 4. Entry points:
73
+ - `Application` class (custom init?)
74
+ - Launcher Activity (SplashActivity? MainActivity?)
75
+ 5. All components:
76
+ - Activities → future Compose screens
77
+ - Services → WorkManager candidates?
78
+ - BroadcastReceivers → keep or replace with Flow?
79
+ - ContentProviders → keep or replace with Room?
80
+ 6. Intent-filters and deep links
81
+
82
+ ### 0.4: Screen Flow Map
83
+
84
+ Map navigation based on Activities:
85
+
86
+ ```mermaid
87
+ graph LR
88
+ Splash --> Login
89
+ Login --> MainTab
90
+ MainTab --> Home
91
+ MainTab --> Search
92
+ MainTab --> Profile
93
+ Home --> Detail
94
+ Profile --> Settings
95
+ ```
96
+
97
+ ### 0.5: Complexity Estimate
98
+
99
+ | Area | Rating | Notes |
100
+ |------|--------|-------|
101
+ | Data Layer | ●●●○○ | [N] APIs, [N] DB tables, [N] DataStores |
102
+ | Core Logic | ●●○○○ | [N] crypto utils, [N] formatters |
103
+ | UI Screens | ●●●●○ | [N] screens, [N] complex layouts |
104
+ | SDK Integration | ●●○○○ | [N] third-party, [N] native libs |
105
+
106
+ ---
107
+
108
+ ## 📊 Output: App Map
109
+
110
+ Use template from `templates/app-map.md`.
111
+
112
+ ---
113
+
114
+ ## ✅ Gate
115
+
116
+ ```
117
+ "🗺️ App Map xong. Anh review:
118
+ - [N] screens detected
119
+ - [N] libraries found ([N] reuse, [N] replace)
120
+ - [N] native libs
121
+ - Complexity: [Low/Medium/High]
122
+
123
+ Có gì cần điều chỉnh không?
124
+ → OK → Phase 1 (Architecture Design)"
125
+ ```
126
+
127
+ ---
128
+
129
+ *Phase 0: Discovery — Know your target before you build*