@leejungkiin/awkit 1.0.0 → 1.0.2
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/README.md +3 -3
- package/VERSION +1 -1
- package/bin/awk.js +1 -1
- package/core/GEMINI.md +4 -0
- package/package.json +2 -2
- package/skills/smali-to-kotlin/SKILL.md +521 -0
- package/skills/smali-to-kotlin/library-patterns.md +189 -0
- package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
- package/skills/smali-to-swift/SKILL.md +749 -0
- package/skills/smali-to-swift/framework-patterns.md +189 -0
- package/skills/smali-to-swift/objc-reading-guide.md +388 -0
- package/workflows/mobile/reverse-android.md +740 -0
- package/workflows/mobile/reverse-ios.md +674 -0
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ AWKit là framework điều phối AI agent chuyên nghiệp. Đây là **nơi d
|
|
|
8
8
|
|
|
9
9
|
## 🚀 Quick Start
|
|
10
10
|
|
|
11
|
-
###
|
|
11
|
+
### Cài đặt nhanh qua NPM (Khuyên dùng)
|
|
12
12
|
```bash
|
|
13
|
-
npm install -g
|
|
13
|
+
npm install -g @leejungkiin/awkit
|
|
14
14
|
awkit install
|
|
15
15
|
awkit doctor
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
###
|
|
18
|
+
### Cài đặt từ Source Github (Dành cho Developer)
|
|
19
19
|
```bash
|
|
20
20
|
git clone https://github.com/babyskill/awk.git ~/Dev/NodeJS/main-awf
|
|
21
21
|
cd ~/Dev/NodeJS/main-awf
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.2
|
package/bin/awk.js
CHANGED
|
@@ -1248,7 +1248,7 @@ function cmdHelp() {
|
|
|
1248
1248
|
log(`${C.bold}💡 Typical Workflow${C.reset}`);
|
|
1249
1249
|
log(line);
|
|
1250
1250
|
log(` ${C.cyan}# First time setup${C.reset}`);
|
|
1251
|
-
log(` ${C.gray}npm install -g
|
|
1251
|
+
log(` ${C.gray}npm install -g @leejungkiin/awkit${C.reset}`);
|
|
1252
1252
|
log(` ${C.gray}awkit install${C.reset}`);
|
|
1253
1253
|
log(` ${C.gray}awkit doctor${C.reset}`);
|
|
1254
1254
|
log('');
|
package/core/GEMINI.md
CHANGED
|
@@ -138,6 +138,8 @@ Workflows: Xem `global_workflows/` (75+ workflows, gõ `/xxx` để chạy)
|
|
|
138
138
|
| `/next` | Gợi ý tiếp theo |
|
|
139
139
|
| `/todo` | Xem tasks hiện tại |
|
|
140
140
|
| `/codebase-sync` | Đồng bộ CODEBASE.md với codebase thực tế |
|
|
141
|
+
| `/reverse-android` | Dịch ngược APK thành mã Kotlin hiện đại |
|
|
142
|
+
| `/reverse-ios` | Dịch ngược IPA thành mã Swift hiện đại |
|
|
141
143
|
|
|
142
144
|
**Active Skills** (tự động kích hoạt — theo thứ tự ưu tiên):
|
|
143
145
|
|
|
@@ -150,6 +152,8 @@ Workflows: Xem `global_workflows/` (75+ workflows, gõ `/xxx` để chạy)
|
|
|
150
152
|
| 5 | `brainstorm-agent` | `/brainstorm`, từ khoá ý tưởng | Brainstorm ý tưởng & tạo BRIEF |
|
|
151
153
|
| 6 | `awf-error-translator` | Khi có lỗi | Dịch lỗi dễ hiểu |
|
|
152
154
|
| 7 | `awf-adaptive-language` | Always | Điều chỉnh ngôn ngữ |
|
|
155
|
+
| 8 | `smali-to-kotlin` | `/reverse-android` hoặc từ khóa APK, Smali | Android Reverse Engineering specialist |
|
|
156
|
+
| 9 | `smali-to-swift` | `/reverse-ios` hoặc từ khóa IPA, class-dump | iOS Reverse Engineering specialist |
|
|
153
157
|
|
|
154
158
|
> ⚠️ **Phân biệt:** `memory-sync` = đọc/ghi bộ nhớ. `brainstorm-agent` = khám phá ý tưởng. Hai skill hoàn toàn độc lập.
|
|
155
159
|
> 📌 **Thứ tự:** `orchestrator` → `awf-session-restore` → `memory-sync` → action. Không được đảo.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leejungkiin/awkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "AWKit v1.0 — Antigravity Workflow Kit. Unified AI agent orchestration system.",
|
|
5
5
|
"main": "bin/awk.js",
|
|
6
6
|
"bin": {
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
"CHANGELOG.md",
|
|
44
44
|
"VERSION"
|
|
45
45
|
]
|
|
46
|
-
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: smali-to-kotlin
|
|
3
|
+
description: >-
|
|
4
|
+
Android Reverse Engineering specialist. Reads Apktool output (Smali, resources, manifest)
|
|
5
|
+
and rebuilds the app from scratch using modern Kotlin + Jetpack Compose + Clean Architecture.
|
|
6
|
+
Includes library detection to reuse existing dependencies.
|
|
7
|
+
author: Antigravity Team
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
trigger: conditional
|
|
10
|
+
activation_keywords:
|
|
11
|
+
- "/reverse-android"
|
|
12
|
+
- "smali"
|
|
13
|
+
- "apktool"
|
|
14
|
+
- "reverse engineer"
|
|
15
|
+
- "dịch ngược"
|
|
16
|
+
- "tái tạo apk"
|
|
17
|
+
- "rebuild apk"
|
|
18
|
+
- "smali to kotlin"
|
|
19
|
+
priority: high
|
|
20
|
+
platform: android
|
|
21
|
+
extensible_to:
|
|
22
|
+
- ios (separate skill: smali-to-swift — planned)
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# 🔧 Smali-to-Kotlin Skill
|
|
26
|
+
|
|
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."
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ⚠️ SCOPE CLARITY
|
|
33
|
+
|
|
34
|
+
| This skill DOES | This skill DOES NOT |
|
|
35
|
+
|-----------------|---------------------|
|
|
36
|
+
| Read & analyze Smali/Java decompiled code | Write Smali code |
|
|
37
|
+
| Rebuild logic in modern Kotlin | Modify original APK |
|
|
38
|
+
| Detect & reuse third-party libraries | Crack/bypass security |
|
|
39
|
+
| Extract only needed resources (on-demand) | Mass-copy resources blindly |
|
|
40
|
+
| Set up Clean Architecture project structure | Handle iOS reverse engineering |
|
|
41
|
+
| Scan APK libraries for package reuse | Deploy to Play Store |
|
|
42
|
+
|
|
43
|
+
→ For iOS reverse engineering → future skill: `smali-to-swift`
|
|
44
|
+
→ After rebuild complete → use `/test` or `/deploy` workflows
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🎯 ROLE DEFINITION
|
|
49
|
+
|
|
50
|
+
When this skill is active, the agent becomes:
|
|
51
|
+
|
|
52
|
+
> **Expert Android Reverse Engineer & Kotlin Architect**
|
|
53
|
+
> - Master at reading Smali bytecode and obfuscated Java
|
|
54
|
+
> - Fluent in Clean Architecture + MVVM + Jetpack Compose
|
|
55
|
+
> - Knows when to reuse vs rewrite third-party dependencies
|
|
56
|
+
> - Enforces resource-on-demand principle (zero bloat)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 🏗️ MODERN TECH STACK (Mandatory)
|
|
61
|
+
|
|
62
|
+
### Core
|
|
63
|
+
| Layer | Technology | Replaces |
|
|
64
|
+
|-------|-----------|----------|
|
|
65
|
+
| **UI** | Jetpack Compose + Material 3 | XML Layouts + findViewById |
|
|
66
|
+
| **State** | StateFlow + ViewModel | LiveData / AsyncTask |
|
|
67
|
+
| **Navigation** | Navigation Compose | Intent-based navigation |
|
|
68
|
+
| **DI** | Hilt (Dagger) | Manual DI / ServiceLocator |
|
|
69
|
+
|
|
70
|
+
### Data Layer
|
|
71
|
+
| Purpose | Technology | Replaces |
|
|
72
|
+
|---------|-----------|----------|
|
|
73
|
+
| **Network** | Retrofit + OkHttp + Kotlin Serialization | Volley / HttpURLConnection |
|
|
74
|
+
| **Local DB** | Room Database | Raw SQLite / SQLiteOpenHelper |
|
|
75
|
+
| **Preferences** | DataStore (Proto/Preferences) | SharedPreferences |
|
|
76
|
+
| **Image Loading** | Coil | Picasso / Glide (evaluate) |
|
|
77
|
+
| **Async** | Kotlin Coroutines + Flow | AsyncTask / Handler / Thread |
|
|
78
|
+
|
|
79
|
+
### Observability
|
|
80
|
+
| Purpose | Technology |
|
|
81
|
+
|---------|-----------|
|
|
82
|
+
| **Crash** | Firebase Crashlytics |
|
|
83
|
+
| **Analytics** | Firebase Analytics |
|
|
84
|
+
| **Logging** | Timber |
|
|
85
|
+
|
|
86
|
+
### Replacements Table (Legacy → Modern)
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
always_replace:
|
|
90
|
+
AsyncTask: "Coroutines (suspend fun / Flow)"
|
|
91
|
+
Volley: "Retrofit + OkHttp"
|
|
92
|
+
HttpURLConnection: "Retrofit + OkHttp"
|
|
93
|
+
Handler/Looper: "Coroutines (Dispatchers.Main)"
|
|
94
|
+
BroadcastReceiver (local): "Flow / EventBus → SharedFlow"
|
|
95
|
+
SharedPreferences: "DataStore"
|
|
96
|
+
SQLiteOpenHelper: "Room"
|
|
97
|
+
ListView/GridView: "LazyColumn/LazyGrid (Compose)"
|
|
98
|
+
findViewById: "Compose state"
|
|
99
|
+
Gson: "Kotlin Serialization (kotlinx.serialization)"
|
|
100
|
+
|
|
101
|
+
evaluate_before_replacing:
|
|
102
|
+
Glide: "Keep if deeply integrated, otherwise → Coil"
|
|
103
|
+
RxJava: "Migrate to Coroutines + Flow (gradual)"
|
|
104
|
+
EventBus: "Replace with SharedFlow"
|
|
105
|
+
Butter Knife: "Not needed in Compose"
|
|
106
|
+
Dagger 2: "Upgrade to Hilt"
|
|
107
|
+
|
|
108
|
+
keep_as_is:
|
|
109
|
+
- "OkHttp (still current)"
|
|
110
|
+
- "Retrofit (still current)"
|
|
111
|
+
- "Firebase SDKs (use latest version)"
|
|
112
|
+
- "Google Play Services"
|
|
113
|
+
- "Native .so libraries (JNI)"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
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
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
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
|
+
```
|
|
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
|
|
243
|
+
```
|
|
244
|
+
|
|
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
|
|
272
|
+
|
|
273
|
+
# Finding endpoints:
|
|
274
|
+
Look for: StringBuilder + append patterns
|
|
275
|
+
Look for: Annotation patterns (@GET, @POST in obfuscated form)
|
|
276
|
+
|
|
277
|
+
# Finding JSON parsing:
|
|
278
|
+
Look for: JSONObject, JSONArray usage
|
|
279
|
+
Look for: Gson.fromJson / TypeToken patterns
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
### Step 3: Core Logic & Utils Reconstruction 🧮
|
|
285
|
+
|
|
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
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## 🔄 WORKFLOW INTEGRATION
|
|
421
|
+
|
|
422
|
+
### With Other Skills/Workflows:
|
|
423
|
+
|
|
424
|
+
```yaml
|
|
425
|
+
triggers_from:
|
|
426
|
+
- "/reverse-android" workflow command
|
|
427
|
+
- Keywords: "smali", "apktool", "dịch ngược", "rebuild"
|
|
428
|
+
|
|
429
|
+
delegates_to:
|
|
430
|
+
- "/test" — after parity check
|
|
431
|
+
- "/deploy" — when rebuild is complete
|
|
432
|
+
- beads-manager — auto-track progress per step
|
|
433
|
+
|
|
434
|
+
works_with:
|
|
435
|
+
- memory-sync — saves decisions, patterns, solutions
|
|
436
|
+
- orchestrator — routes to this skill based on intent
|
|
437
|
+
|
|
438
|
+
independent_from:
|
|
439
|
+
- brainstorm-agent
|
|
440
|
+
- ios-engineer (but shares design philosophy)
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Session State Tracking:
|
|
444
|
+
|
|
445
|
+
```yaml
|
|
446
|
+
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"]
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## 🚫 ANTI-PATTERNS
|
|
457
|
+
|
|
458
|
+
```yaml
|
|
459
|
+
never_do:
|
|
460
|
+
- Copy all resources blindly from APK → only on-demand
|
|
461
|
+
- Use deprecated libraries (AsyncTask, Volley) → always use modern replacements
|
|
462
|
+
- Skip library scanning step → always detect reusable packages first
|
|
463
|
+
- Modify encryption output → must match original exactly
|
|
464
|
+
- Create massive God Activity → split into Compose screens + ViewModels
|
|
465
|
+
- Hardcode API keys/secrets → use BuildConfig or encrypted storage
|
|
466
|
+
- Skip parity check → always verify against original behavior
|
|
467
|
+
|
|
468
|
+
always_do:
|
|
469
|
+
- Run Library Scanner (Step 0) before any coding
|
|
470
|
+
- 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
|
+
- Unit test all encryption/hashing utils
|
|
474
|
+
- Use sealed classes for UI state
|
|
475
|
+
- Follow Clean Architecture layer separation strictly
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## 📊 CHECKPOINT TEMPLATE
|
|
481
|
+
|
|
482
|
+
After each step, output:
|
|
483
|
+
|
|
484
|
+
```markdown
|
|
485
|
+
## ✅ Step [N] Complete: [Step Name]
|
|
486
|
+
|
|
487
|
+
### What was done:
|
|
488
|
+
- [Summary of actions]
|
|
489
|
+
|
|
490
|
+
### Files created:
|
|
491
|
+
- [List of new files]
|
|
492
|
+
|
|
493
|
+
### Resources extracted:
|
|
494
|
+
- [List of resources moved to new project]
|
|
495
|
+
|
|
496
|
+
### Decisions made:
|
|
497
|
+
- [Key decisions documented]
|
|
498
|
+
|
|
499
|
+
### ⏭️ Next: Step [N+1] — [Step Name]
|
|
500
|
+
- [What user needs to provide]
|
|
501
|
+
- [What will be done]
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## 🧩 EXTENSIBILITY NOTE
|
|
507
|
+
|
|
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
|
|
517
|
+
|
|
518
|
+
---
|
|
519
|
+
|
|
520
|
+
*smali-to-kotlin v1.0.0 — Android Reverse Engineering Skill for AWF*
|
|
521
|
+
*Created by Antigravity Team*
|