@leejungkiin/awkit 1.7.1 → 1.7.4

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 (245) hide show
  1. package/bin/awk.js +576 -84
  2. package/core/CLAUDE.md +1 -1
  3. package/core/GEMINI.md +148 -167
  4. package/core/GEMINI.md.bak +149 -116
  5. package/core/skill-runtime-manifest.json +3 -0
  6. package/docs/Claude Fable 5.md +3826 -0
  7. package/docs/android_kotlin_system_instruction.md +210 -0
  8. package/docs/brainstorm_ponytail_integration.md +146 -0
  9. package/docs/brainstorm_smart_setup.md +113 -0
  10. package/docs/deep-research-report (1).md +293 -0
  11. package/docs/history/GEMINI.v1.md +135 -0
  12. package/docs/history/brainstorm_antigravity_unified_architecture.v1.md +105 -0
  13. package/docs/history/implementation_plan.v1.md +58 -0
  14. package/package.json +4 -1
  15. package/scripts/artifact-storage.js +130 -0
  16. package/scripts/automation-gate.js +35 -2
  17. package/scripts/claude-plan.js +76 -0
  18. package/scripts/dependency-manager.js +210 -0
  19. package/scripts/exec-rtk.js +11 -5
  20. package/scripts/i18n-helper.js +381 -0
  21. package/scripts/multi-model-pipeline.js +144 -0
  22. package/skill-packs/mobile-ios/pack.json +4 -2
  23. package/skill-packs/reverse-engineering/pack.json +1 -0
  24. package/skills/CATALOG.md +20 -0
  25. package/skills/GEMINI.md +9 -1
  26. package/skills/TRIGGER_INDEX.md +10 -0
  27. package/skills/ai-music/SKILL.md +275 -0
  28. package/skills/android-re-analyzer/SKILL.md +238 -0
  29. package/skills/android-re-analyzer/references/api-extraction-patterns.md +119 -0
  30. package/skills/android-re-analyzer/references/call-flow-analysis.md +176 -0
  31. package/skills/android-re-analyzer/references/fernflower-usage.md +115 -0
  32. package/skills/android-re-analyzer/references/jadx-usage.md +116 -0
  33. package/skills/android-re-analyzer/references/setup-guide.md +221 -0
  34. package/skills/android-re-analyzer/scripts/check-deps.sh +129 -0
  35. package/skills/android-re-analyzer/scripts/decompile.sh +375 -0
  36. package/skills/android-re-analyzer/scripts/find-api-calls.sh +118 -0
  37. package/skills/android-re-analyzer/scripts/install-dep.sh +448 -0
  38. package/skills/animal-island-ui-style/SKILL.md +1450 -0
  39. package/skills/app-store-review-agent/SKILL.md +164 -0
  40. package/skills/app-store-review-agent/references/guidelines/README.md +154 -0
  41. package/skills/app-store-review-agent/references/guidelines/by-app-type/ai_apps.md +37 -0
  42. package/skills/app-store-review-agent/references/guidelines/by-app-type/all_apps.md +50 -0
  43. package/skills/app-store-review-agent/references/guidelines/by-app-type/crypto_finance.md +31 -0
  44. package/skills/app-store-review-agent/references/guidelines/by-app-type/games.md +31 -0
  45. package/skills/app-store-review-agent/references/guidelines/by-app-type/health_fitness.md +31 -0
  46. package/skills/app-store-review-agent/references/guidelines/by-app-type/kids.md +27 -0
  47. package/skills/app-store-review-agent/references/guidelines/by-app-type/macos.md +38 -0
  48. package/skills/app-store-review-agent/references/guidelines/by-app-type/social_ugc.md +32 -0
  49. package/skills/app-store-review-agent/references/guidelines/by-app-type/subscription_iap.md +34 -0
  50. package/skills/app-store-review-agent/references/guidelines/by-app-type/vpn.md +18 -0
  51. package/skills/app-store-review-agent/references/rules/design/minimum_functionality.md +96 -0
  52. package/skills/app-store-review-agent/references/rules/design/sign_in_with_apple.md +54 -0
  53. package/skills/app-store-review-agent/references/rules/entitlements/unused_entitlements.md +83 -0
  54. package/skills/app-store-review-agent/references/rules/metadata/accurate_metadata.md +54 -0
  55. package/skills/app-store-review-agent/references/rules/metadata/apple_trademark.md +99 -0
  56. package/skills/app-store-review-agent/references/rules/metadata/china_storefront.md +72 -0
  57. package/skills/app-store-review-agent/references/rules/metadata/competitor_terms.md +56 -0
  58. package/skills/app-store-review-agent/references/rules/metadata/subscription_metadata.md +81 -0
  59. package/skills/app-store-review-agent/references/rules/privacy/privacy_manifest.md +84 -0
  60. package/skills/app-store-review-agent/references/rules/privacy/unnecessary_data.md +60 -0
  61. package/skills/app-store-review-agent/references/rules/subscription/misleading_pricing.md +63 -0
  62. package/skills/app-store-review-agent/references/rules/subscription/missing_tos_pp.md +54 -0
  63. package/skills/awf-ponytail/SKILL.md +91 -0
  64. package/skills/awf-ponytail-review/SKILL.md +67 -0
  65. package/skills/awf-session-restore/SKILL.md +3 -3
  66. package/skills/brainstorm-agent/SKILL.md +11 -2
  67. package/skills/brainstorm-agent/templates/brief-template.md +8 -0
  68. package/skills/claude-planner/SKILL.md +47 -0
  69. package/skills/code-review/SKILL.md +87 -0
  70. package/skills/expo-game-development/SKILL.md +163 -0
  71. package/skills/flutter/LICENSE.txt +202 -0
  72. package/skills/flutter/SKILL.md +127 -0
  73. package/skills/flutter-project-creater/LICENSE.txt +202 -0
  74. package/skills/flutter-project-creater/SKILL.md +106 -0
  75. package/skills/game-developer/SKILL.md +163 -0
  76. package/skills/game-developer/references/ecs-patterns.md +501 -0
  77. package/skills/game-developer/references/multiplayer-networking.md +475 -0
  78. package/skills/game-developer/references/performance-optimization.md +422 -0
  79. package/skills/game-developer/references/unity-patterns.md +271 -0
  80. package/skills/game-developer/references/unreal-cpp.md +352 -0
  81. package/skills/generate-gui-assets/SKILL.md +305 -0
  82. package/skills/generate-gui-assets/agents/openai.yaml +4 -0
  83. package/skills/generate-gui-assets/references/catalog-schema.md +58 -0
  84. package/skills/generate-gui-assets/references/extraction-techniques.md +21 -0
  85. package/skills/generate-gui-assets/references/prompt-patterns.md +58 -0
  86. package/skills/generate-gui-assets/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  87. package/skills/generate-gui-assets/scripts/build_gui_contact_sheet.py +51 -0
  88. package/skills/generate-gui-assets/scripts/clean_chroma_edges.py +262 -0
  89. package/skills/generate-gui-assets/scripts/copy_approved_icons.py +64 -0
  90. package/skills/generate-gui-assets/scripts/prepare_gui_asset_run.py +91 -0
  91. package/skills/generate-gui-assets/scripts/suggest_grid_options.py +63 -0
  92. package/skills/generate-gui-assets/scripts/validate_gui_catalog.py +50 -0
  93. package/skills/godot-game-development/SKILL.md +142 -0
  94. package/skills/hatch-pet/LICENSE.txt +201 -0
  95. package/skills/hatch-pet/SKILL.md +420 -0
  96. package/skills/hatch-pet/agents/openai.yaml +4 -0
  97. package/skills/hatch-pet/references/animation-rows.md +29 -0
  98. package/skills/hatch-pet/references/codex-pet-contract.md +35 -0
  99. package/skills/hatch-pet/references/qa-rubric.md +60 -0
  100. package/skills/hatch-pet/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  101. package/skills/hatch-pet/scripts/clean_chroma_edges.py +262 -0
  102. package/skills/hatch-pet/scripts/compose_atlas.py +150 -0
  103. package/skills/hatch-pet/scripts/derive_running_left_from_running_right.py +143 -0
  104. package/skills/hatch-pet/scripts/extract_strip_frames.py +323 -0
  105. package/skills/hatch-pet/scripts/finalize_pet_run.py +382 -0
  106. package/skills/hatch-pet/scripts/generate_pet_images.py +287 -0
  107. package/skills/hatch-pet/scripts/inspect_frames.py +246 -0
  108. package/skills/hatch-pet/scripts/make_contact_sheet.py +96 -0
  109. package/skills/hatch-pet/scripts/package_custom_pet.py +108 -0
  110. package/skills/hatch-pet/scripts/pet_job_status.py +117 -0
  111. package/skills/hatch-pet/scripts/prepare_pet_run.py +673 -0
  112. package/skills/hatch-pet/scripts/queue_pet_repairs.py +172 -0
  113. package/skills/hatch-pet/scripts/record_imagegen_result.py +250 -0
  114. package/skills/hatch-pet/scripts/render_animation_videos.py +134 -0
  115. package/skills/hatch-pet/scripts/render_animation_videos.sh +5 -0
  116. package/skills/hatch-pet/scripts/validate_atlas.py +139 -0
  117. package/skills/i18n-orchestrator/SKILL.md +37 -0
  118. package/skills/ios-simulator-skill/SKILL.md +390 -0
  119. package/skills/ios-simulator-skill/scripts/accessibility_audit.py +300 -0
  120. package/skills/ios-simulator-skill/scripts/app_launcher.py +326 -0
  121. package/skills/ios-simulator-skill/scripts/app_state_capture.py +400 -0
  122. package/skills/ios-simulator-skill/scripts/appearance.py +385 -0
  123. package/skills/ios-simulator-skill/scripts/build_and_test.py +348 -0
  124. package/skills/ios-simulator-skill/scripts/clipboard.py +103 -0
  125. package/skills/ios-simulator-skill/scripts/common/__init__.py +61 -0
  126. package/skills/ios-simulator-skill/scripts/common/cache_utils.py +289 -0
  127. package/skills/ios-simulator-skill/scripts/common/device_utils.py +462 -0
  128. package/skills/ios-simulator-skill/scripts/common/env_config.py +35 -0
  129. package/skills/ios-simulator-skill/scripts/common/hang_pipeline.py +862 -0
  130. package/skills/ios-simulator-skill/scripts/common/hang_sessions.py +490 -0
  131. package/skills/ios-simulator-skill/scripts/common/idb_utils.py +180 -0
  132. package/skills/ios-simulator-skill/scripts/common/screenshot_utils.py +338 -0
  133. package/skills/ios-simulator-skill/scripts/container.py +668 -0
  134. package/skills/ios-simulator-skill/scripts/gesture.py +394 -0
  135. package/skills/ios-simulator-skill/scripts/hang_watcher.py +1533 -0
  136. package/skills/ios-simulator-skill/scripts/keyboard.py +391 -0
  137. package/skills/ios-simulator-skill/scripts/localization_audit.py +483 -0
  138. package/skills/ios-simulator-skill/scripts/location.py +467 -0
  139. package/skills/ios-simulator-skill/scripts/log_monitor.py +493 -0
  140. package/skills/ios-simulator-skill/scripts/model_inspector.py +645 -0
  141. package/skills/ios-simulator-skill/scripts/navigator.py +461 -0
  142. package/skills/ios-simulator-skill/scripts/privacy_manager.py +310 -0
  143. package/skills/ios-simulator-skill/scripts/push_notification.py +240 -0
  144. package/skills/ios-simulator-skill/scripts/screen_mapper.py +296 -0
  145. package/skills/ios-simulator-skill/scripts/sim_health_check.sh +245 -0
  146. package/skills/ios-simulator-skill/scripts/sim_list.py +299 -0
  147. package/skills/ios-simulator-skill/scripts/simctl_boot.py +312 -0
  148. package/skills/ios-simulator-skill/scripts/simctl_create.py +316 -0
  149. package/skills/ios-simulator-skill/scripts/simctl_delete.py +357 -0
  150. package/skills/ios-simulator-skill/scripts/simctl_erase.py +351 -0
  151. package/skills/ios-simulator-skill/scripts/simctl_shutdown.py +290 -0
  152. package/skills/ios-simulator-skill/scripts/simulator_selector.py +375 -0
  153. package/skills/ios-simulator-skill/scripts/status_bar.py +250 -0
  154. package/skills/ios-simulator-skill/scripts/test_recorder.py +323 -0
  155. package/skills/ios-simulator-skill/scripts/visual_diff.py +235 -0
  156. package/skills/ios-simulator-skill/scripts/xcode/__init__.py +13 -0
  157. package/skills/ios-simulator-skill/scripts/xcode/builder.py +397 -0
  158. package/skills/ios-simulator-skill/scripts/xcode/cache.py +204 -0
  159. package/skills/ios-simulator-skill/scripts/xcode/config.py +178 -0
  160. package/skills/ios-simulator-skill/scripts/xcode/reporter.py +343 -0
  161. package/skills/ios-simulator-skill/scripts/xcode/xcresult.py +451 -0
  162. package/skills/ios-visual-qa-strategist/SKILL.md +111 -0
  163. package/skills/ios-visual-qa-strategist/agents/openai.yaml +4 -0
  164. package/skills/ios-visual-qa-strategist/references/ios-tool-selection.md +61 -0
  165. package/skills/ios-visual-qa-strategist/references/minimal-capture-policy.md +56 -0
  166. package/skills/ios-visual-qa-strategist/references/visual-reasoning-heuristics.md +53 -0
  167. package/skills/orchestrator/SKILL.md +0 -20
  168. package/skills/persistent-storage/SKILL.md +55 -0
  169. package/skills/short-maker/SKILL.md +23 -0
  170. package/skills/short-maker/scripts/effects.js +56 -0
  171. package/skills/short-maker/scripts/shortmaker-bridge.js +332 -0
  172. package/skills/short-maker/scripts/videomix.js +601 -0
  173. package/skills/short-maker/templates/hyperframes/cinematic-character.template.html +172 -0
  174. package/skills/short-maker/templates/hyperframes/index.template.html +194 -0
  175. package/skills/smali-to-kotlin/SKILL.md +128 -0
  176. package/skills/smali-to-kotlin/examples/getting-started/tech-stack.md +58 -0
  177. package/skills/smali-to-kotlin/examples/pipeline/data-ui-parity.md +118 -0
  178. package/skills/smali-to-kotlin/examples/pipeline/scanner-and-bootstrap.md +106 -0
  179. package/skills/smali-to-kotlin/library-patterns.md +189 -0
  180. package/skills/smali-to-kotlin/phase-0-discovery.md +128 -0
  181. package/skills/smali-to-kotlin/phase-1-architecture.md +166 -0
  182. package/skills/smali-to-kotlin/phase-2-blueprint-ui.md +347 -0
  183. package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
  184. package/skills/smali-to-kotlin/phase-3-build.md +248 -0
  185. package/skills/smali-to-kotlin/phase-3-logic-build.md +268 -0
  186. package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
  187. package/skills/smali-to-kotlin/templates/app-map.md +101 -0
  188. package/skills/smali-to-kotlin/templates/architecture.md +142 -0
  189. package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
  190. package/skills/spec-gate/SKILL.md +6 -2
  191. package/skills/symphony-enforcer/SKILL.md +8 -0
  192. package/skills/symphony-enforcer/examples/mindful-stop.md +2 -0
  193. package/skills/symphony-enforcer/examples/three-phase.md +16 -0
  194. package/skills/symphony-enforcer/examples/trigger-points.md +7 -1
  195. package/skills/unity-game-development/SKILL.md +231 -0
  196. package/skills/video-edit/SKILL.md +36 -0
  197. package/skills/video-edit/scripts/video_edit.py +324 -0
  198. package/templates/project-identity/android.json +2 -2
  199. package/templates/project-identity/backend-nestjs.json +2 -2
  200. package/templates/project-identity/expo.json +2 -2
  201. package/templates/project-identity/ios.json +2 -2
  202. package/templates/project-identity/web-nextjs.json +2 -2
  203. package/templates/setup-mapping.json +48 -0
  204. package/templates/specs/design-template.md +161 -71
  205. package/templates/specs/requirements-template.md +65 -133
  206. package/templates/specs/task-spec-template.xml +3 -0
  207. package/workflows/_uncategorized/critic.md +40 -0
  208. package/workflows/_uncategorized/git-rebase-flow.md +81 -0
  209. package/workflows/_uncategorized/image-gen.md +118 -0
  210. package/workflows/_uncategorized/multi-model-pipeline.md +60 -0
  211. package/workflows/_uncategorized/pixel-gen.md +86 -0
  212. package/workflows/_uncategorized/pixel-setup.md +90 -0
  213. package/workflows/_uncategorized/ponytail-review.md +59 -0
  214. package/workflows/_uncategorized/reverse-android-build.md +222 -0
  215. package/workflows/_uncategorized/reverse-android-design.md +139 -0
  216. package/workflows/_uncategorized/reverse-android-discover.md +150 -0
  217. package/workflows/_uncategorized/reverse-android-scan.md +158 -0
  218. package/workflows/_uncategorized/reverse-android.md +143 -0
  219. package/workflows/_uncategorized/reverse-ios-build.md +240 -0
  220. package/workflows/_uncategorized/reverse-ios-design.md +112 -0
  221. package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
  222. package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
  223. package/workflows/_uncategorized/reverse-ios.md +152 -0
  224. package/workflows/_uncategorized/safety-router.md +34 -0
  225. package/workflows/_uncategorized/teach.md +89 -0
  226. package/workflows/_uncategorized/verify-ui.md +53 -0
  227. package/workflows/_uncategorized/visualize-screenshots.md +34 -0
  228. package/workflows/ads/ads-analyst.md +201 -0
  229. package/workflows/ads/ads-audit.md +106 -0
  230. package/workflows/ads/ads-optimize.md +97 -0
  231. package/workflows/ads/ads-targeting.md +241 -0
  232. package/workflows/ads/adsExpert.md +160 -0
  233. package/workflows/ads/smali-ads-config.md +400 -0
  234. package/workflows/ads/smali-ads-flow.md +331 -0
  235. package/workflows/ads/smali-ads-interstitial.md +377 -0
  236. package/workflows/ads/smali-ads-native.md +382 -0
  237. package/workflows/context/teach.md +89 -0
  238. package/workflows/gitnexus.md +8 -8
  239. package/workflows/lifecycle/brainstorm.md +43 -0
  240. package/workflows/lifecycle/code.md +5 -0
  241. package/workflows/lifecycle/init.md +23 -5
  242. package/workflows/lifecycle/multi-model-pipeline.md +60 -0
  243. package/workflows/quality/ponytail-review.md +59 -0
  244. package/workflows/roles/critic.md +40 -0
  245. package/workflows/roles/safety-router.md +34 -0
@@ -0,0 +1,160 @@
1
+ ---
2
+ description: ⚡ Tối ưu Ads tự động (Expert Mode)
3
+ ---
4
+
5
+ # WORKFLOW: /adsExpert - Instant Ads Optimization
6
+
7
+ > **Expert Mode Only:** Tự động Audit & Optimize tài khoản Google Ads. Không hỏi, chỉ làm & báo cáo. Nội dung phản hồi và báo cáo bằng tiếng Việt
8
+
9
+ ---
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ /adsExpert [account_id] [--auto-fix]
15
+ ```
16
+
17
+ **Examples:**
18
+ ```bash
19
+ /adsExpert 5527743070 # Audit & Report only
20
+ /adsExpert 5527743070 --auto-fix # Pause bad ads/keywords automatically
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Execution Flow
26
+
27
+ ### 1. Data Fetching (Auto)
28
+ *Utilizes `mcp-google-ads`*
29
+
30
+ 1. **Get Currency:** `get_account_currency(customer_id)`
31
+ 2. **Get Performance:**
32
+ - `get_campaign_performance(days=1)` (Yesterday)
33
+ - `get_campaign_performance(days=7)` (Trend)
34
+ - `get_ad_performance(days=30)` (Deep Dive)
35
+
36
+ ### 2. Rule-Based Analysis (Auto)
37
+
38
+ AI tự động check các rules sau:
39
+
40
+ | Rule ID | Name | Condition | Severity |
41
+ |---------|------|-----------|----------|
42
+ | R1 | Wasted Spend | Cost > 200k & Conv = 0 | 🔴 Critical |
43
+ | R2 | High CPA | CPA > 2x Account Avg | 🟠 Warning |
44
+ | R3 | Low CTR | CTR < 1.0% (Search) | 🟡 Info |
45
+ | R4 | Limited Budget | Cost ~= Budget | 🟠 Warning |
46
+ | R5 | Good Mover | ROAS > 2.0 | 🟢 Opportunity |
47
+
48
+ ### 3. Execution (Action)
49
+
50
+ **Without `--auto-fix`:**
51
+ - Tổng hợp lỗi vào Report.
52
+ - Tạo Symphony Tasks cho các lỗi R1, R2.
53
+
54
+ **With `--auto-fix`:**
55
+ - **R1 (Wasted Spend):** Auto-pause Keyword/Ad Group.
56
+ - **R2, R3, R4:** Tạo Symphony Task.
57
+
58
+ ### 4. Symphony Integration
59
+
60
+ ```bash
61
+ # R1: Wasted Spend -> Critical Task
62
+ symphony_create_task(title="Pause Waste: [Keyword] ($$ Spend, 0 Conv)", priority=1)
63
+
64
+ # R2: High CPA -> Investigation Task
65
+ symphony_create_task(title="Investigate High CPA: [Campaign] (CPA: $$)", priority=1)
66
+
67
+ # R5: Good Mover -> Scale Task
68
+ symphony_create_task(title="Scale Up: [Campaign] (ROAS: 2.5)", priority=1)
69
+ ```
70
+
71
+ ### 5. Report Generation
72
+
73
+ Tạo file: `reports/ads/[date]_expert_audit.md`
74
+
75
+ ```markdown
76
+ # ⚡ Ads Expert Report - [Date]
77
+
78
+ ## 📊 Pulse Check
79
+ - Spend Yesterday: 500,000 VND
80
+ - Conversions: 10 (CPA: 50,000 VND)
81
+ - ROAS: 2.1
82
+
83
+ ## 🚨 Actions Taken (Auto-Fix)
84
+ - Paused Keyword: "free download" (Spent 200k, 0 conv)
85
+
86
+ ## 📿 Symphony Tasks Created
87
+ 1. [P0] Pause Waste: "cheat codes" (Spent 150k, 0 conv) #123
88
+ 2. [P1] Investigate High CPA: "Competitor Campaign" #124
89
+ 3. [P1] Scale Up: "Brand Campaign" #125
90
+
91
+ ➡️ **Next:** Review tasks at `/todo`
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 📜 History Tracking Rule (Bắt buộc)
97
+
98
+ Sau khi hoàn thành workflow, AI **PHẢI** ghi log vào file `brain/ads_history_log.md` theo format sau:
99
+
100
+ ```markdown
101
+ ### [YYYY-MM-DD HH:mm] /adsExpert
102
+ - **Action:** [Mô tả ngắn gọn hành động đã làm, vd: Auto-fix, Report Only]
103
+ - **Target:** [Account ID]
104
+ - **Action Details:** [List các hành động auto-fix đã thực hiện]
105
+ ```
106
+
107
+ **Lưu ý:** Nếu file không tồn tại, hãy tạo mới.
108
+
109
+ ---
110
+
111
+ ## Analysis Logic (Internal)
112
+
113
+ ### Wasted Spend Query (GAQL)
114
+ ```sql
115
+ SELECT
116
+ campaign.name,
117
+ ad_group.name,
118
+ keyword_view.resource_name,
119
+ metrics.cost_micros,
120
+ metrics.conversions
121
+ FROM keyword_view
122
+ WHERE
123
+ segments.date DURING LAST_30_DAYS
124
+ AND metrics.cost_micros > 200000000
125
+ AND metrics.conversions = 0
126
+ ```
127
+
128
+ ### High CPA Query (GAQL)
129
+ ```sql
130
+ SELECT
131
+ campaign.name,
132
+ metrics.cost_micros,
133
+ metrics.conversions,
134
+ metrics.cost_per_conversion
135
+ FROM campaign
136
+ WHERE
137
+ segments.date DURING LAST_7_DAYS
138
+ AND metrics.conversions > 0
139
+ ORDER BY metrics.cost_per_conversion DESC
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Error Handling
145
+
146
+ ### API Failures
147
+ - `get_campaign_performance` fail -> Retry 3 times.
148
+ - If fail -> Create Task "Check Google Ads Connection" & Exit.
149
+
150
+ ### No Data
151
+ - If Spend = 0 -> "Account inactive. No optimization needed."
152
+
153
+ ---
154
+
155
+ ## ⚠️ NEXT STEPS (Menu):
156
+ ```
157
+ 1️⃣ Review tasks (`/todo`)
158
+ 2️⃣ Chạy Creative Audit (`/ads-creative`)
159
+ 3️⃣ Chạy Full Audit (`/ads-audit`)
160
+ ```
@@ -0,0 +1,400 @@
1
+ ---
2
+ description: ⚙️ Remote Config cho Ad Settings - Điều chỉnh ads mà không cần rebuild APK
3
+ ---
4
+
5
+ # Smali Ads Remote Config
6
+
7
+ > **🎯 Mục tiêu**: Setup Remote Config để điều chỉnh ad settings (frequency, ad units, enable/disable) từ xa.
8
+
9
+ ---
10
+
11
+ ## 📋 Overview - Tại sao cần Remote Config?
12
+
13
+ ### Benefits
14
+
15
+ | Without Remote Config | With Remote Config |
16
+ |----------------------|-------------------|
17
+ | ❌ Hardcode ad unit IDs | ✅ Update ad IDs remotely |
18
+ | ❌ Fixed frequency (3-5) | ✅ Adjust frequency dynamic |
19
+ | ❌ Rebuild APK để thay đổi | ✅ Change instantly |
20
+ | ❌ Rollback = new release | ✅ Rollback = change config |
21
+ | ❌ A/B test = multiple APKs | ✅ A/B test via config |
22
+
23
+ ### Use Cases
24
+
25
+ 1. **Update Ad Unit IDs** - Khi switch AdMob account
26
+ 2. **Adjust Frequency** - Optimize revenue vs UX
27
+ 3. **Feature Flags** - Enable/disable ads per screen
28
+ 4. **A/B Testing** - Test different strategies
29
+ 5. **Emergency Kill Switch** - Disable ads if issues
30
+
31
+ ---
32
+
33
+ ## 🔍 Phase 1: Choose Config Strategy
34
+
35
+ ### Option 1: Firebase Remote Config (Recommended)
36
+
37
+ **Pros:**
38
+ - Free tier available
39
+ - Real-time updates
40
+ - User targeting (country, app version, etc.)
41
+ - Analytics integration
42
+ - No server needed
43
+
44
+ **Cons:**
45
+ - Requires Firebase SDK
46
+ - Network dependency
47
+ - Có thể conflict nếu app đã có Firebase
48
+
49
+ **Best for**: Production apps, need targeting
50
+
51
+ ---
52
+
53
+ ### Option 2: JSON from Server
54
+
55
+ **Pros:**
56
+ - Full control
57
+ - Lightweight
58
+ - Custom logic
59
+ - No third-party dependency
60
+
61
+ **Cons:**
62
+ - Need own server/CDN
63
+ - Implement sync logic
64
+ - Không có targeting built-in
65
+
66
+ **Best for**: Apps có backend riêng
67
+
68
+ ---
69
+
70
+ ### Option 3: Assets Fallback + Remote
71
+
72
+ **Strategy**: Local JSON fallback + remote override
73
+
74
+ **Pros:**
75
+ - App works offline
76
+ - Fast first load
77
+ - Graceful degradation
78
+
79
+ **Implementation:**
80
+ ```
81
+ 1. Load from assets/ad_config.json (defaults)
82
+ 2. Fetch from remote
83
+ 3. Merge/override
84
+ 4. Cache locally
85
+ ```
86
+
87
+ **Best for**: Hybrid approach, production ready
88
+
89
+ ---
90
+
91
+ ## 🔧 Phase 2: Config Schema Design
92
+
93
+ ### 2.1. JSON Structure
94
+
95
+ ```json
96
+ {
97
+ "version": "1.0",
98
+ "last_updated": "2024-01-20T10:00:00Z",
99
+
100
+ "ad_units": {
101
+ "interstitial": {
102
+ "splash": "ca-app-pub-XXX/111",
103
+ "onboarding": "ca-app-pub-XXX/222",
104
+ "general": "ca-app-pub-XXX/333"
105
+ },
106
+ "native": {
107
+ "onboarding": "ca-app-pub-XXX/444",
108
+ "list": "ca-app-pub-XXX/555"
109
+ },
110
+ "banner": {
111
+ "home": "ca-app-pub-XXX/666"
112
+ }
113
+ },
114
+
115
+ "frequency": {
116
+ "interstitial": {
117
+ "min_launches": 3,
118
+ "max_launches": 5,
119
+ "min_interval_ms": 10000
120
+ }
121
+ },
122
+
123
+ "feature_flags": {
124
+ "enable_splash_ad": true,
125
+ "enable_onboarding_ad": true,
126
+ "enable_random_inter": true,
127
+ "enable_native_ads": true
128
+ },
129
+
130
+ "test_mode": {
131
+ "enabled": false,
132
+ "use_test_ads": false
133
+ }
134
+ }
135
+ ```
136
+
137
+ ### 2.2. Config Keys Strategy
138
+
139
+ **Naming convention:**
140
+ ```
141
+ {feature}_{type}_{location}
142
+
143
+ Examples:
144
+ - ad_inter_splash
145
+ - ad_native_onboarding
146
+ - freq_inter_min
147
+ - flag_enable_ads
148
+ ```
149
+
150
+ ---
151
+
152
+ ## 📦 Phase 3: Implementation
153
+
154
+ ### 3.1. Discovery - Check Firebase Presence
155
+
156
+ ```bash
157
+ # Check if Firebase already in APK
158
+ find smali* -path "*/com/google/firebase/*" -type d
159
+
160
+ # Check Firebase config
161
+ ls assets/google-services.json 2>/dev/null
162
+ ```
163
+
164
+ **Scenarios:**
165
+
166
+ **A. Firebase đã có**
167
+ - Reuse existing Firebase instance
168
+ - Add Remote Config component
169
+ - Risk: Conflict với existing config
170
+
171
+ **B. Firebase chưa có**
172
+ - Add Firebase SDK (heavy ~5-10MB)
173
+ - Setup google-services.json
174
+ - Risk: Method count, size increase
175
+
176
+ **C. Custom server**
177
+ - Implement HTTP client
178
+ - Parse JSON
179
+ - Cache mechanism
180
+
181
+ ---
182
+
183
+ ### 3.2. Config Helper Class
184
+
185
+ **Create wrapper:**
186
+ ```
187
+ {SDK_DIR}/config/RemoteConfigHelper.smali
188
+ ```
189
+
190
+ **Methods needed:**
191
+ ```smali
192
+ .method public static init(Context)V
193
+ # Initialize config (Firebase or HTTP)
194
+ .end method
195
+
196
+ .method public static fetch()V
197
+ # Fetch latest config from remote
198
+ .end method
199
+
200
+ .method public static getString(String key)String
201
+ # Get string value
202
+ .end method
203
+
204
+ .method public static getInt(String key)I
205
+ # Get int value
206
+ .end method
207
+
208
+ .method public static getBoolean(String key)Z
209
+ # Get boolean value
210
+ .end method
211
+
212
+ .method public static isFeatureEnabled(String)Z
213
+ # Check feature flag
214
+ .end method
215
+ ```
216
+
217
+ ### 3.3. Integration với AppPreferences
218
+
219
+ **Update AppPreferences để dùng RemoteConfig:**
220
+
221
+ ```
222
+ Before:
223
+ const/4 v0, 0x3 # Hardcoded min = 3
224
+
225
+ After:
226
+ invoke-static {"freq_inter_min"}, RemoteConfigHelper;->getInt()I
227
+ move-result v0 # Dynamic min from config
228
+ ```
229
+
230
+ ---
231
+
232
+ ## 🔌 Phase 4: Fetch Strategy
233
+
234
+ ### 4.1. When to Fetch?
235
+
236
+ **Strategy A: Application.onCreate()**
237
+ ```
238
+ Pros: Early fetch, ready when needed
239
+ Cons: Delay app start
240
+ ```
241
+
242
+ **Strategy B: Background fetch**
243
+ ```
244
+ Pros: No blocking
245
+ Cons: First launch uses defaults
246
+ ```
247
+
248
+ **Strategy C: Lazy fetch**
249
+ ```
250
+ Pros: On-demand
251
+ Cons: Delay when showing ad
252
+ ```
253
+
254
+ **Recommended: Hybrid**
255
+ ```
256
+ 1. Load cached config immediately
257
+ 2. Fetch in background
258
+ 3. Apply on next launch (or live if safe)
259
+ ```
260
+
261
+ ### 4.2. Caching Mechanism
262
+
263
+ **SharedPreferences caching:**
264
+ ```
265
+ Keys:
266
+ - remote_config_json: Full JSON string
267
+ - remote_config_timestamp: Last fetch time
268
+ - remote_config_version: Config version
269
+
270
+ Invalidation:
271
+ - TTL: 12-24 hours
272
+ - Force refresh on app update
273
+ - Manual refresh option
274
+ ```
275
+
276
+ ### 4.3. Fallback Strategy
277
+
278
+ ```
279
+ Priority:
280
+ 1. Remote config (if fresh)
281
+ 2. Cached config
282
+ 3. Assets config (bundled)
283
+ 4. Hardcoded defaults
284
+ ```
285
+
286
+ ---
287
+
288
+ ## ✅ Phase 5: Testing & Rollout
289
+
290
+ ### 5.1. Test Scenarios
291
+
292
+ | Test | Expected | Command |
293
+ |------|----------|---------|
294
+ | **First launch (no cached)** | Use assets config | Clear data, launch |
295
+ | **Fetch success** | Use remote values | Normal launch with network |
296
+ | **Fetch fail** | Use cached/assets | Airplane mode |
297
+ | **Config change** | Reflect on next launch | Change remote, relaunch |
298
+ | **Invalid JSON** | Fallback gracefully | Corrupt remote config |
299
+
300
+ ### 5.2. Gradual Rollout
301
+
302
+ **Phase 1: Test with dev account**
303
+ - Use test ad IDs
304
+ - Small audience (1%)
305
+ - Monitor crashes
306
+
307
+ **Phase 2: Staging**
308
+ - Real ad IDs
309
+ - 10-20% audience
310
+ - Monitor metrics (impressions, revenue)
311
+
312
+ **Phase 3: Full rollout**
313
+ - 100% audience
314
+ - Monitor continuously
315
+
316
+ ### 5.3. Monitoring
317
+
318
+ ```bash
319
+ # Log config values on app start
320
+ adb logcat | grep "RemoteConfig"
321
+
322
+ # Verify fetched values
323
+ adb shell run-as {package} cat /data/data/{package}/shared_prefs/remote_config.xml
324
+ ```
325
+
326
+ ---
327
+
328
+ ## 📋 Implementation Checklist
329
+
330
+ ### Setup
331
+ - [ ] Choose config strategy (Firebase/Server/Hybrid)
332
+ - [ ] Design JSON schema
333
+ - [ ] Create RemoteConfigHelper class
334
+ - [ ] Setup fallback config in assets
335
+
336
+ ### Firebase (if used)
337
+ - [ ] Add Firebase SDK dependencies
338
+ - [ ] Add google-services.json
339
+ - [ ] Initialize Firebase
340
+ - [ ] Test Remote Config connection
341
+
342
+ ### Integration
343
+ - [ ] Update AppPreferences to use RemoteConfig
344
+ - [ ] Replace hardcoded values với config keys
345
+ - [ ] Implement fetch logic
346
+ - [ ] Add caching mechanism
347
+
348
+ ### Testing
349
+ - [ ] Test all fallback scenarios
350
+ - [ ] Verify config updates apply
351
+ - [ ] Test with invalid/missing config
352
+ - [ ] Monitor performance impact
353
+
354
+ ---
355
+
356
+ ## 🔗 Related Resources
357
+
358
+ ### Workflows
359
+ - `/smali-ads-flow` - Uses config for frequency
360
+ - `/smali-ads-interstitial` - Uses ad unit IDs
361
+ - `/smali-ads-native` - Uses ad unit IDs
362
+
363
+ ### Firebase Docs
364
+ - [Firebase Remote Config](https://firebase.google.com/docs/remote-config)
365
+ - [Android Integration](https://firebase.google.com/docs/remote-config/use-config-android)
366
+
367
+ ---
368
+
369
+ ## 💡 Tips & Best Practices
370
+
371
+ 1. **Always have fallback**: App phải work khi remote config fail
372
+ 2. **Cache aggressively**: Reduce network calls
373
+ 3. **Version config**: Track changes, rollback if needed
374
+ 4. **Test offline**: Ensure graceful degradation
375
+ 5. **Don't fetch too often**: Respect rate limits, battery
376
+ 6. **Use feature flags**: Easy enable/disable features
377
+ 7. **Monitor impact**: Track config changes vs metrics
378
+
379
+ ---
380
+
381
+ ## ⚠️ Important Considerations
382
+
383
+ ### Performance
384
+ - Fetch config async, don't block UI
385
+ - Cache effectively to minimize network
386
+ - Consider app size impact (Firebase SDK ~5-10MB)
387
+
388
+ ### Security
389
+ - Don't put sensitive data in remote config
390
+ - Validate config values (prevent abuse)
391
+ - Monitor for unexpected changes
392
+
393
+ ### User Experience
394
+ - Changes should be non-disruptive
395
+ - Consider showing update notice if major change
396
+ - Test across different Android versions
397
+
398
+ ---
399
+
400
+ **🎯 Goal**: Balance flexibility với stability. Remote Config là powerful tool nhưng phải implement carefully!