@buaa_smat/hometrans 0.1.17 → 0.1.19

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 (234) hide show
  1. package/README.md +120 -56
  2. package/agents/code-reviewer.md +321 -65
  3. package/agents/logic-coder.md +113 -88
  4. package/agents/logic-context-builder.md +47 -29
  5. package/agents/scripts/hmos-precheck/backends/arkts.mjs +567 -0
  6. package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +159 -0
  7. package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +398 -0
  8. package/agents/scripts/hmos-precheck/backends/codelinter.mjs +250 -0
  9. package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +321 -0
  10. package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +247 -0
  11. package/agents/scripts/hmos-precheck/core/config.mjs +184 -0
  12. package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +20 -0
  13. package/agents/scripts/hmos-precheck/core/process_adapter.mjs +47 -0
  14. package/agents/scripts/hmos-precheck/core/project_catalog.mjs +50 -0
  15. package/agents/scripts/hmos-precheck/core/result_projection.mjs +147 -0
  16. package/agents/scripts/hmos-precheck/core/scope_plan.mjs +131 -0
  17. package/agents/scripts/hmos-precheck/core/sdk_context.mjs +67 -0
  18. package/agents/scripts/hmos-precheck/docs/architecture.md +37 -0
  19. package/agents/scripts/hmos-precheck/docs/performance-optimization.md +28 -0
  20. package/agents/scripts/hmos-precheck/docs/upstream-reference.json +19 -0
  21. package/agents/scripts/hmos-precheck/docs/validation.md +50 -0
  22. package/agents/scripts/hmos-precheck/index.mjs +17 -0
  23. package/agents/scripts/hmos-precheck/invocation.mjs +231 -0
  24. package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +32 -0
  25. package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +64 -0
  26. package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +59 -0
  27. package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +54 -0
  28. package/agents/scripts/platform_query.mjs +626 -0
  29. package/agents/scripts/platform_query.test.mjs +422 -0
  30. package/agents/self-test-fixer.md +36 -34
  31. package/agents/self-tester.md +123 -143
  32. package/agents/test-case-generation-generator.md +317 -0
  33. package/agents/test-case-generation-validator.md +231 -0
  34. package/dist/cli/config-store.js +16 -63
  35. package/dist/cli/env-vars.js +1 -3
  36. package/dist/cli/index.js +0 -11
  37. package/dist/cli/init.js +123 -204
  38. package/dist/cli/uninstall.js +3 -127
  39. package/dist/utils/regex.js +8 -0
  40. package/env-requirements.json +55 -54
  41. package/package.json +6 -6
  42. package/resource/convert_pipeline_process.svg +103 -0
  43. package/resource/project_architecture.svg +122 -0
  44. package/resource/title_dark.png +0 -0
  45. package/skills/hmos-batch-ui-align/SKILL.md +345 -43
  46. package/skills/hmos-batch-ui-align/references/conversion-procedure.md +661 -180
  47. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  48. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  49. package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  50. package/skills/hmos-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
  51. package/skills/hmos-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
  52. package/skills/hmos-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
  53. package/skills/hmos-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
  54. package/skills/hmos-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
  55. package/skills/hmos-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
  56. package/skills/hmos-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
  57. package/skills/hmos-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
  58. package/skills/hmos-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
  59. package/skills/hmos-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
  60. package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
  61. package/skills/hmos-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
  62. package/skills/hmos-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
  63. package/skills/hmos-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
  64. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
  65. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
  66. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
  67. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
  68. package/skills/hmos-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
  69. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
  70. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
  71. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
  72. package/skills/hmos-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
  73. package/skills/hmos-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
  74. package/skills/hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
  75. package/skills/hmos-batch-ui-align/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
  76. package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
  77. package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +133 -0
  78. package/skills/hmos-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
  79. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.ts +1798 -0
  80. package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +1592 -0
  81. package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +752 -0
  82. package/skills/hmos-convert-pipeline/SKILL.md +168 -121
  83. package/skills/hmos-fix-build-errors/SKILL.md +87 -67
  84. package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -219
  85. package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -157
  86. package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -131
  87. package/skills/hmos-incremental-ui-align/README.md +53 -36
  88. package/skills/hmos-incremental-ui-align/SKILL.md +179 -23
  89. package/skills/hmos-incremental-ui-align/diff_analysis.md +52 -52
  90. package/skills/hmos-incremental-ui-align/page_align.md +62 -62
  91. package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +38 -2
  92. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
  93. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
  94. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
  95. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
  96. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
  97. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
  98. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
  99. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
  100. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
  101. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
  102. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -911
  103. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
  104. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
  105. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
  106. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
  107. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
  108. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
  109. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
  110. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
  111. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
  112. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
  113. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
  114. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
  115. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
  116. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
  117. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
  118. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
  119. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
  120. package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +74 -0
  121. package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +34 -4
  122. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
  123. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
  124. package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
  125. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +937 -0
  126. package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +343 -0
  127. package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +44 -5
  128. package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +977 -0
  129. package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +188 -0
  130. package/skills/hmos-integration-test/README.md +61 -70
  131. package/skills/hmos-integration-test/SKILL.md +128 -111
  132. package/skills/hmos-resources-convert/SKILL.md +334 -66
  133. package/skills/hmos-resources-convert/references/code-vector-icon-rules.md +335 -0
  134. package/skills/hmos-resources-convert/references/conversion-rules.md +676 -663
  135. package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +410 -388
  136. package/skills/hmos-resources-convert/references/lottie-conversion-rules.md +219 -0
  137. package/skills/hmos-resources-convert/references/resource-mapping-rules.md +482 -457
  138. package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +592 -513
  139. package/skills/hmos-resources-convert/scripts/a2h_resource_convert.ts +2163 -0
  140. package/skills/hmos-resources-convert/scripts/code_vector_icons.ts +591 -0
  141. package/skills/hmos-resources-convert/scripts/svg_fidelity_check.ts +632 -0
  142. package/skills/hmos-spec-generate/SKILL.md +293 -214
  143. package/skills/hmos-spec-generate/scripts/parse_requirements.ts +515 -0
  144. package/skills/hmos-spec-generate/template/REQ.txt +22 -0
  145. package/skills/hmos-spec-generate/template/REQ.xlsx +0 -0
  146. package/skills/hmos-test-case-generation/README.md +241 -0
  147. package/skills/hmos-test-case-generation/SKILL.md +324 -0
  148. package/skills/hmos-test-case-generation/references/contract.md +315 -0
  149. package/skills/hmos-test-case-generation/references/review-notes-template.md +84 -0
  150. package/skills/hmos-test-case-generation/references/ui-elements-schema.md +142 -0
  151. package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +550 -0
  152. package/skills/hmos-test-case-generation/tools/validate.ts +1312 -0
  153. package/tools/bfs-crawl/README.md +73 -0
  154. package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +1662 -0
  155. package/tools/test-tools/autotest/config.ts +175 -0
  156. package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
  157. package/tools/test-tools/autotest/docs/README.md +266 -0
  158. package/tools/test-tools/autotest/{testcases_schema.md → docs/testcases_schema.md} +1 -1
  159. package/tools/test-tools/autotest/engine/batch-launcher.ts +327 -0
  160. package/tools/test-tools/autotest/engine/report-tool.ts +773 -0
  161. package/tools/test-tools/autotest/engine/self-test-runner.ts +961 -0
  162. package/tools/test-tools/autotest/engine/testcases-tool.ts +246 -0
  163. package/tools/test-tools/autotest/paths.ts +41 -0
  164. package/tools/test-tools/autotest/resolve-metadata-tool.ts +143 -0
  165. package/tools/test-tools/autotest/runner/logger.ts +45 -0
  166. package/tools/test-tools/autotest/runner/process-utils.ts +41 -0
  167. package/tools/test-tools/autotest/validate.ts +167 -0
  168. package/agents/build-fixer.md +0 -385
  169. package/agents/logic-coder/scripts/platform_context_query.py +0 -568
  170. package/agents/review-fixer.md +0 -405
  171. package/agents/spec-generator.md +0 -541
  172. package/dist/cli/mcp-setup.js +0 -258
  173. package/dist/cli/mcp.js +0 -94
  174. package/dist/context/index.js +0 -694
  175. package/resource/migration_process.svg +0 -94
  176. package/resource/migration_process_transparent.svg +0 -93
  177. package/skills/hmos-batch-ui-align/scripts/android_parse_fast.py +0 -1606
  178. package/skills/hmos-incremental-ui-align/scripts/__pycache__/app_feature_verify.cpython-314.pyc +0 -0
  179. package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.py +0 -542
  180. package/skills/hmos-incremental-ui-align/scripts/page_capture.py +0 -597
  181. package/skills/hmos-resources-convert/evals/evals.json +0 -171
  182. package/skills/hmos-resources-convert/template/AppScope/app.json5 +0 -10
  183. package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +0 -8
  184. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
  185. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
  186. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +0 -7
  187. package/skills/hmos-resources-convert/template/build-profile.json5 +0 -42
  188. package/skills/hmos-resources-convert/template/code-linter.json5 +0 -32
  189. package/skills/hmos-resources-convert/template/entry/build-profile.json5 +0 -33
  190. package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +0 -6
  191. package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +0 -23
  192. package/skills/hmos-resources-convert/template/entry/oh-package.json5 +0 -10
  193. package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +0 -48
  194. package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +0 -16
  195. package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +0 -23
  196. package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +0 -55
  197. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +0 -8
  198. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +0 -8
  199. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +0 -16
  200. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
  201. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
  202. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +0 -7
  203. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
  204. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +0 -3
  205. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +0 -5
  206. package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +0 -8
  207. package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +0 -2
  208. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +0 -35
  209. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +0 -5
  210. package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +0 -16
  211. package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +0 -5
  212. package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +0 -33
  213. package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +0 -23
  214. package/skills/hmos-resources-convert/template/hvigorfile.ts +0 -6
  215. package/skills/hmos-resources-convert/template/oh-package-lock.json5 +0 -28
  216. package/skills/hmos-resources-convert/template/oh-package.json5 +0 -10
  217. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  218. package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
  219. package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
  220. package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
  221. package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
  222. package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
  223. package/tools/test-tools/autotest/README.md +0 -238
  224. package/tools/test-tools/autotest/pyproject.toml +0 -26
  225. package/tools/test-tools/autotest/report_tool.py +0 -759
  226. package/tools/test-tools/autotest/self_test_runner.py +0 -895
  227. package/tools/test-tools/autotest/testcases_tool.py +0 -215
  228. package/tools/test-tools/autotest/uv.lock +0 -3156
  229. package/tools/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  230. package/tools/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  231. package/tools/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  232. package/tools/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  233. package/tools/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  234. package/tools/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
@@ -5,71 +5,141 @@ description: Convert Android project resources to HarmonyOS project resources. U
5
5
 
6
6
  # Android to HarmonyOS Resource Converter
7
7
 
8
- This skill converts resource files from an Android project into the resource format used by HarmonyOS projects. It attempts to build the Android APK and decompile it with apktool to get the complete merged resource set (including all library dependencies). If the build fails or no APK is available, it falls back to converting directly from the project's source `res/` directory — which may be missing library-provided resources, but still produces a useful conversion with clear reporting of what's missing and why. In addition to the standard conversion report, it also produces a dedicated Android resources ↔ HarmonyOS resources mapping markdown document at the user-provided `resource_mapping_path`.
8
+ This skill converts resource files from an Android project into the resource format used by HarmonyOS projects. It decodes the APK supplied as `apk_path` with the `a2h-resource` npm package (a pure-Node.js resource decoder) to obtain the complete merged resource set, including all library dependencies. If decoding fails, it falls back to converting directly from the project's source `res/` directory — which may be missing library-provided resources, but still produces a useful conversion with clear reporting of what is missing and why. In addition to the standard conversion report, it also produces a dedicated Android resources ↔ HarmonyOS resources mapping markdown document at the user-provided `resource_mapping_path`.
9
+
10
+ It also covers icons that a Jetpack Compose application draws from **code** rather than from `res/` (`androidx.compose.material:material-icons-*`). Those are compiled `ImageVector` objects that never appear in `res/` or `resources.arsc`, so every `res/`-based step below is blind to them; Step 4.1.3 recovers them from `classes*.dex` and synthesizes the matching HarmonyOS media assets.
11
+
12
+ `apk_path` is decoded as given. `harmony_project_dir` is an initialized HarmonyOS project; converted resources are written into it.
9
13
 
10
14
  ## Inputs
11
15
 
12
- 1. **Android project path** — root directory of the Android project (contains `build.gradle` or `build.gradle.kts`)
13
- 2. **HarmonyOS project output path** — where the new HarmonyOS project will be created
14
- 3. **resource_mapping_path** — full output path of the markdown file that records the Android resource inventory and the Android ↔ HarmonyOS mapping details. Please write this file in 中文.
15
- 4. **Android apk path** (optional) — full path of the apk file corresponding to the "Android project path" above. If this is provided, then start the workflow below from step 3.
16
+ Declare all inputs up front as explicit `snake_case` variables — do not rely on semantically guessing natural-language phrases:
16
17
 
17
- ## Workflow
18
+ | Variable | Required | Meaning | Typical Phrases |
19
+ |---|---|---|---|
20
+ | `android_project_dir` | yes | Root directory of the Android project (contains `build.gradle` or `build.gradle.kts`) | "Android project path", "安卓项目", "source project" |
21
+ | `harmony_project_dir` | yes | An **initialized** HarmonyOS project. Converted resources are written into it. | "HarmonyOS project path", "鸿蒙项目", "target project" |
22
+ | `resource_mapping_path` | yes | Full output path of the markdown file that records the Android resource inventory and the Android ↔ HarmonyOS mapping details. Write this file in 中文. | "resource mapping path", "资源映射文档" |
23
+ | `apk_path` | yes | Full path of the APK corresponding to `android_project_dir`. It is decoded as given in Step 3 and is the conversion source. | "APK path", "apk文件", "安卓apk" |
24
+ | `material_icon_snapshot_dir` | no | Local copy of `google/material-design-icons`, for environments with no network access. Normally omitted: Step 4.1.3 fetches artwork from a pinned upstream commit. | "图标快照目录", "material icons snapshot" |
18
25
 
19
- ### Step 1: Initialize HarmonyOS Project
26
+ If any required input cannot be determined from the invocation, ask the user — do not guess. `material_icon_snapshot_dir` is optional: never block on it.
20
27
 
21
- **Skip condition**: Before copying, check if the HarmonyOS output path already exists and is non-empty (i.e., it contains files or directories such as `AppScope/`, `entry/`, `build-profile.json5`, etc.). If it does, this is an existing HarmonyOS project — skip template initialization entirely and proceed directly to Step 2. Only copy the template when the output path doesn't exist or is empty.
28
+ ## Toolchain — mandatory
22
29
 
23
- When initialization is needed, copy the bundled HarmonyOS project template to the output path:
30
+ **Do not write your own conversion scripts.** This skill ships a canonical implementation; use it.
24
31
 
25
- ```
26
- Template source: <skill_dir>/template/
32
+ The reason is measured, not stylistic. When this skill was run across 10 applications with agents implementing the conversion themselves, each run produced its own converter — 10 implementations, 3 languages, ~10,000 lines of throwaway code, 3 of them pulling floating-version npm dependencies. The results were not comparable: `converted` counts meant different things per run (file-level in one, entry-level in another), mapping documents ranged from 266 rows to 120,750 for similar inputs, and defect classes appeared in some outputs but not others — 9 of 15 committed patches carried unrenderable `d="@string/…"` path data, one dropped whitespace that Android's quoting syntax deliberately preserves, another lost `clip-path` geometry. Every one of those is a rule stated in `references/`, implemented correctly by some runs and incorrectly by others.
33
+
34
+ Run these four steps in order:
35
+
36
+ ```bash
37
+ # 1. Resources: values, qualifiers, media, XML drawables, adaptive icons, reference resolution
38
+ node ./scripts/a2h_resource_convert.ts \
39
+ --res <decoded_output_path>/res --harmony <harmony_project_dir> \
40
+ --records <work_dir>/records.json
41
+
42
+ # 2. Code-defined vector icons — REQUIRED for any Jetpack Compose app (see Step 4.1.3)
43
+ # --fetch pulls artwork from a pinned upstream commit, never a moving branch.
44
+ # Requires network access to raw.githubusercontent.com.
45
+ node ./scripts/code_vector_icons.ts \
46
+ --dex <decoded_output_path> --android-src <android_project_dir> \
47
+ --out <harmony_project_dir>/entry/src/main/resources/base/media \
48
+ --fetch --json <work_dir>/icons.json
49
+
50
+ # 3. Vector fidelity gate — any error blocks completion
51
+ node ./scripts/svg_fidelity_check.ts \
52
+ --android-res <decoded_output_path>/res \
53
+ --harmony-media <harmony_project_dir>/entry/src/main/resources/base/media \
54
+ --json <work_dir>/fidelity.json
55
+
56
+ # 4. Documents, rebuilt from the records of step 1 plus the results of steps 2-3
57
+ node ./scripts/a2h_resource_convert.ts --docs-only \
58
+ --records <work_dir>/records.json \
59
+ --icons-json <work_dir>/icons.json --fidelity-json <work_dir>/fidelity.json \
60
+ --report <work_dir>/resource_conversion_report.md \
61
+ --mapping <resource_mapping_path> \
62
+ --apk <apk_path> --android-commit <commit> --app-module <app_module> \
63
+ --harmony <harmony_project_dir>
27
64
  ```
28
65
 
29
- - Copy the entire template directory to the target path
30
- - Preserve the template's directory structure (AppScope, entry, hvigor, etc.)
31
- - The main resource target directory is: `<output>/entry/src/main/resources/`
66
+ Step 4 is separate because the documents need the fidelity and icon results, which in turn need the artifacts step 1 produces. It re-reads `records.json` rather than re-running the conversion.
32
67
 
33
- ### Step 2: Attempt to Build the Android APK
68
+ **What remains your job:**
34
69
 
35
- Try to build the Android project to produce an APK containing all merged resources (source + library dependencies + generated resources). The decompiled APK is the ideal source because it contains everything — but building is not always possible.
70
+ - resolving the inputs, including the Step 2 application-module decision (the converter cannot make it when several modules apply `com.android.application` — ask the user);
71
+ - reading the tool output and acting on it: a non-zero exit, any fidelity `error`, or any unresolved icon is a finding to address or report, never something to paper over;
72
+ - writing the final Chinese summary for the caller.
36
73
 
37
- 1. Ask the user which Gradle build variant to use (e.g., `assembleDebug`, `assembleRelease`, `assembleFossDebug`). Default to `assembleDebug` if the user has no preference — debug builds include all resources without optimization.
74
+ **What you must not do:** re-implement any rule from `references/` in an ad-hoc script, hand-edit generated resources to make a check pass, or create undocumented placeholder resources.
38
75
 
39
- 2. Run the build:
40
- ```bash
41
- cd <android_project_dir>
42
- ./gradlew <variant>
43
- ```
76
+ The tables and rules in the rest of this document describe **what the converter implements**. Read them to review its output and to judge edge cases — not as a specification to code against yourself.
77
+
78
+ ## Workflow
44
79
 
45
- 3. **If the build succeeds**: locate the APK in `<android_project_dir>/app/build/outputs/apk/`. If multiple APKs exist, prefer the debug variant. Record `build_status = "success"` and proceed to Step 3 (decompile).
80
+ ### Step 1: Validate Inputs
46
81
 
47
- 4. **If the build fails**: record the build error output and `build_status = "failed"`. Also check if a previously-built APK already exists at `<android_project_dir>/app/build/outputs/apk/`. If an existing APK is found, use it and record `build_status = "failed_using_cached_apk"`. If no APK exists at all, skip Step 3 entirely and proceed to Step 4 using the source `res/` directory. Set `resource_source = "source_res"`.
82
+ 1. **`apk_path`** — verify the file exists and is readable. If it is missing or unreadable, **stop and ask the user** for the correct path.
48
83
 
49
- The reason we prefer the decompiled APK: it contains all merged resources from source code AND library dependencies (AARs, Maven artifacts). When falling back to source `res/`, library resources are missing, which means some resource references may be unresolvable. The conversion report will clearly flag this.
84
+ 2. **`android_project_dir`** — verify it exists and contains `build.gradle` or `build.gradle.kts`. The source `res/` fallback in Step 3 and the library-dependency correlation in Step 5 both read from it.
50
85
 
51
- ### Step 3: Decompile the APK with apktool (skip if no APK)
86
+ The main resource target directory is `<harmony_project_dir>/entry/src/main/resources/`.
52
87
 
53
- If an APK is available (from a successful build or a cached previous build), decompile it:
88
+ ### Step 2: Resolve the Application Module
89
+
90
+ Resolve `<app_module>` — the module whose Gradle file applies the `com.android.application` plugin (grep `com.android.application` across `<android_project_dir>/*/build.gradle` and `*/build.gradle.kts`). It is **usually** `app/`, but do not assume that name: many projects use `mobile/`, `client/`, `androidApp/`, or a nested path. Store it relative to `<android_project_dir>` and use it everywhere below instead of a literal `app`. If several modules apply the plugin, ask the user which one corresponds to `apk_path`.
91
+
92
+ `<app_module>` is used by the source `res/` fallback (Step 3 / Step 4) and by the library-dependency correlation in the report. Resolve it now so those steps do not have to re-derive it.
93
+
94
+ Why the decoded APK is the preferred source: it carries all merged resources from application source **and** library dependencies (AARs, Maven artifacts). The source `res/` fallback is missing library resources, so some resource references become unresolvable. The conversion report flags this explicitly.
95
+
96
+ ### Step 3: Decode the APK's resources
97
+
98
+ Decode `apk_path` into `<decoded_output_path>` with the `a2h-resource` decoder.
99
+
100
+ First make sure the `a2h-resource` CLI is installed (published to npm). Install it once, globally:
54
101
 
55
102
  ```bash
56
- java -jar <skill_dir>/tools/apktool_3.0.1.jar d <apk_path> -o <decompiled_output_path>
103
+ npm install -g a2h-resource
57
104
  ```
58
105
 
59
- The skill bundles `apktool_3.0.1.jar` in its `tools/` directory. Java must be available in the system PATH.
106
+ Then run it directly:
60
107
 
61
- The decompiled output at `<decompiled_output_path>/res/` contains the **complete merged resource set**. Set `resource_source = "decompiled_apk"` and use this as the conversion source.
108
+ ```bash
109
+ a2h-resource <apk_path> -o <decoded_output_path>
110
+ ```
111
+
112
+ Alternatively, if you prefer not to install globally, run it on-demand with `npx` (which fetches the package automatically):
62
113
 
63
- If no APK is available, skip this step. The conversion source will be the project's source `res/` directory (typically `<android_project_dir>/app/src/main/res/`). Set `resource_source = "source_res"`.
114
+ ```bash
115
+ npx --yes a2h-resource <apk_path> -o <decoded_output_path>
116
+ ```
117
+
118
+ `a2h-resource` is a pure-Node.js resource decoder distributed as an npm package and requires only Node.js `>= 20`. It reads the APK's `resources.arsc` — the fully-merged resource table produced at build time — so its output at `<decoded_output_path>/res/` is the **complete merged resource set** (source + all library/AAR resources merged in at build time). It produces:
119
+
120
+ - `<decoded_output_path>/AndroidManifest.xml` — decoded, id references resolved (`@id/…`, `@string/…`, `@android:…`).
121
+ - `<decoded_output_path>/res/` — qualifier directories with **real resource names** and decoded content:
122
+ - `values*/`: `strings`, `colors`, `dimens`, `bools`, `integers`, `ids`, `<string-array>`/`<integer-array>`/`<array>`, `plurals` (plus `styles`/`attrs`, which this skill logs as unmappable).
123
+ - `drawable*/`, `mipmap*/`, `layout*/`, `menu/`, `xml/`, `color/`: binary XML decoded to text — `<vector>`, `<shape>`, `<selector>`, `<layer-list>`, `<adaptive-icon>`, layouts, menus — ready for the Step 4 conversions.
124
+ - `.9.png`: restored to **source form** (1-px border with stretch/padding markers).
125
+ - `raw/`, `font/`, and other file resources placed under their qualifier dirs.
126
+ - passthrough directories (`assets/`, `lib/`, `classes.dex`, …) copied as-is.
127
+ - `<decoded_output_path>/svg/` — VectorDrawables pre-converted to SVG. **This skill runs its own SVG conversion** per `references/xml-drawable-to-svg-rules.md`, so this directory is supplementary; ignore it and use the decoded XML under `res/drawable*/` as the conversion source.
128
+
129
+ On success, set `resource_source = "decoded_apk"` and use `<decoded_output_path>/res/` as the conversion source.
130
+
131
+ **If decoding fails** (the command errors out — e.g. a rare APK `a2h-resource` cannot parse, or a multi-package/split APK where only the first package is decoded): record the error, then fall back to the project's source `res/` directory at `<android_project_dir>/<app_module>/src/main/res/` (`<app_module>` from Step 2). Set `resource_source = "source_res"` and state in the report that decoding failed, so the developer knows library-merged resources may be missing.
64
132
 
65
133
  ### Step 4: Convert Resources
66
134
 
67
- Read the detailed conversion rules from `references/conversion-rules.md` before performing conversions. Convert all resources found in the resource source directory (either decompiled `res/` or source `res/`). Read `references/resource-mapping-rules.md` before conversion as well — every conversion, skip, fallback, and unmappable case must also append structured mapping metadata for the final markdown written to `resource_mapping_path`.
135
+ Conversion is performed by `scripts/a2h_resource_convert.ts` (Toolchain step 1). It reads the resource source directory, converts every resource type described below, and records an inventory row and a mapping row for each one — including skips, fallbacks, and unmappable cases — into `records.json`.
136
+
137
+ Read `references/conversion-rules.md` and `references/resource-mapping-rules.md` so you can **review** what it produced and reason about edge cases. Do not re-implement them.
68
138
 
69
- **Determining the source `res/` directory when using source fallback:**
70
- - Check `<android_project_dir>/app/src/main/res/`
139
+ **Determining the source `res/` directory when the Step 3 decode fallback applies:**
140
+ - Check `<android_project_dir>/<app_module>/src/main/res/` (`<app_module>` = the application module resolved in Step 2; do not hardcode `app`)
71
141
  - If multi-module, also check other module directories
72
- - If the project uses flavor source sets, include those too (e.g., `app/src/debug/res/`, `app/src/flavor/res/`)
142
+ - If the project uses flavor source sets, include those too (e.g., `<app_module>/src/debug/res/`, `<app_module>/src/flavor/res/`)
73
143
 
74
144
  #### 4.1 Resource Type Mapping
75
145
 
@@ -95,7 +165,10 @@ Read the detailed conversion rules from `references/conversion-rules.md` before
95
165
  | `values/plurals.xml` | `base/element/plural.json` | XML → JSON |
96
166
  | `values/styles.xml` | No direct equivalent | Log in report |
97
167
  | `values/attrs.xml` | No direct equivalent | Log in report |
98
- | `raw/` | `rawfile/` | Direct file copy |
168
+ | `raw/` (non-Lottie) | `rawfile/` | Direct file copy |
169
+ | `raw/` (Lottie JSON: `v`+`fr`+`ip`+`op`+`layers` signature) | `rawfile/lottie/<normalized>.json` | Identify by JSON structure signature; normalize filename to lowercase `[a-z0-9_]`. See `references/lottie-conversion-rules.md`. |
170
+ | `assets/` (Lottie JSON: `v`+`fr`+`ip`+`op`+`layers` signature) | `rawfile/lottie/<normalized>.json` | Same identification and normalization rules as `raw/` Lottie. `assets/` is a passthrough dir in APK decoding — scan `<decoded_output_path>/assets/` recursively. |
171
+ | `assets/` (non-Lottie files) | Passthrough | Not part of this skill's default conversion scope — reserved for future rules. Record inventory rows with `mapping_kind = unmappable`. |
99
172
  | `font/` | `rawfile/fonts/` | Copy fonts to rawfile |
100
173
  | `xml/` | `base/profile/` | Only config-like XML; rename to .json if possible |
101
174
  | `anim/`, `animator/` | No direct equivalent | Log in report |
@@ -120,8 +193,9 @@ Android adaptive-icon XML files (root element `<adaptive-icon>`, commonly found
120
193
  c. Name the PNG `<color_name>_bg.png` (e.g., `md_orange_700_bg.png`) and place it in `base/media/`.
121
194
  d. Reference it as `$media:<color_name>_bg` in the layered-image JSON.
122
195
  e. **If the color cannot be resolved** (e.g., it comes from a library and we're using source `res/`), log it as an unsatisfied dependency in the report and use a placeholder reference.
123
- 5. Output filename: `<original_name>_layered_image.json` (e.g., `ic_launcher.xml` → `ic_launcher_layered_image.json`)
124
- 6. Store in the target `media/` directory (typically `base/media/`)
196
+ 5. **Critical — inline layer content**: a layer can carry its artwork as a *child element* instead of an `android:drawable` reference (`<foreground><vector …/></foreground>`, common for shortcut icons). Convert that inline drawable to its own media file named `<icon_name>_<layer>.svg`, and reference it as `$media:<icon_name>_<layer>`. Never emit the layered-image JSON with the layer simply absent: the icon then renders with no artwork, and no existence check catches it because the JSON is present and valid. A `<bitmap android:src="@drawable/x"/>` wrapper is just a reference — point at `$media:x`. An inline drawable with no static SVG equivalent becomes an `unmappable` mapping row with the reason stated.
197
+ 6. Output filename: `<original_name>_layered_image.json` (e.g., `ic_launcher.xml` → `ic_launcher_layered_image.json`)
198
+ 7. Store in the target `media/` directory (typically `base/media/`)
125
199
 
126
200
  **Example:**
127
201
  ```xml
@@ -143,6 +217,105 @@ Suppose `@color/md_orange_700` resolves to `#F57C00`. Generate `base/media/md_or
143
217
  }
144
218
  ```
145
219
 
220
+ #### 4.1.2 Lottie Animation JSON Migration
221
+
222
+ Android projects that use `com.airbnb.android:lottie` ship their animations as JSON in `assets/` or `res/raw/`. On HarmonyOS these are consumed by `@ohos/lottie` (installed with `ohpm install @ohos/lottie`) which loads them from `rawfile/` at runtime. This skill migrates the JSON asset and records the host-screen binding — it does NOT generate ArkTS code.
223
+
224
+ **Identification (always required — do not rely on `.json` extension):**
225
+
226
+ A file is a Lottie animation JSON if its parsed root object contains ALL of these fields: `v`, `fr`, `ip`, `op`, `w`, `h`, and `layers` (array). Non-Lottie JSON in `raw/` continues to follow the normal raw-file rule.
227
+
228
+ **Sources scanned:**
229
+
230
+ - `<decoded_output_path>/assets/` (recursive) — assets is a passthrough directory in APK decoding
231
+ - `<decoded_output_path>/res/raw/`
232
+ - Source-fallback equivalents: every module's `src/*/assets/` and `src/*/res/raw/`, including flavor source sets
233
+
234
+ **Target:**
235
+
236
+ `entry/src/main/resources/rawfile/lottie/<normalized>.json`. The load path recorded for the developer (used later as `lottie.loadAnimation({ path: ... })`) is `lottie/<normalized>.json`, relative to `rawfile/`, no leading slash.
237
+
238
+ **Filename normalization:** lowercase; replace `[^a-z0-9_]` in the base name with `_`; collapse consecutive `_`; trim leading/trailing `_`; if starts with a digit, prefix `lottie_`. Examples:
239
+
240
+ | Original | Normalized |
241
+ |---|---|
242
+ | `AndroidWave.json` | `androidwave.json` |
243
+ | `Lottie Logo 1.json` | `lottie_logo_1.json` |
244
+ | `HamburgerArrow.json` | `hamburgerarrow.json` |
245
+ | `01-intro.json` | `lottie_01_intro.json` |
246
+
247
+ **Filename collision:** if `assets/logo.json` and `res/raw/logo.json` both target `lottie/logo.json`, disambiguate as `lottie/assets_logo.json` and `lottie/raw_logo.json`. Record both in `notes`.
248
+
249
+ **Reference extraction (in addition to the generic `@type/name` scan of `references/dependency-analysis-rules.md`):**
250
+
251
+ XML attribute patterns (namespace-agnostic — match by local name):
252
+
253
+ | Attribute | Points at | Migration action |
254
+ |---|---|---|
255
+ | `lottie_fileName="Xxx.json"` | `assets/Xxx.json` | Migrate the JSON. Attribute the JSON to the Activity/Fragment inflating the layout XML. |
256
+ | `lottie_rawRes="@raw/name"` | `res/raw/name.json` | Same. |
257
+ | `lottie_url="https://..."` | Runtime URL | No local file — record with `mapping_kind = remote resource (no local target)` and `source_category = 运行时远程资源`. |
258
+ | `lottie_fallbackRes="@drawable/xxx"` | Fallback drawable | Not a Lottie asset; use the normal drawable rules, but link it to the Lottie row in `notes`. |
259
+
260
+ Code patterns (grep across `.kt` / `.java`):
261
+
262
+ - Literal string arg to `LottieCompositionFactory.fromAsset(...)` / `.fromRawRes(...)` / `.fromJsonInputStream(...)` / `.fromUrl(...)` or `LottieAnimationView.setAnimation(...)`.
263
+ - `AssetManager.list(...)` results filtered by `.json` and dispatched to a factory method — this is the "dynamic picker" pattern. In this case attribute every listed JSON to the **detail screen** that the picker's click handler navigates to (via `startActivity`), not the picker itself. (See the airbnb `lottie-android` sample: `PreviewFragment` picker → `PlayerActivity` detail.)
264
+ - Data classes carrying `assetName` / `fileUri` / `url` consumed by a factory method — chase to the actual factory call site to classify local vs remote.
265
+
266
+ **Host-screen binding (required for every Lottie row):**
267
+
268
+ Attribute the JSON to the Activity/Fragment that plays it. Evidence sources, in priority order:
269
+
270
+ 1. XML host layout → the Activity/Fragment that inflates it (`setContentView(R.layout.<name>)`, `AppCompatActivity(R.layout.<name>)` constructor form, `Fragment(R.layout.<name>)`, ViewBinding/DataBinding class name derived from the layout).
271
+ 2. Code-loaded (literal): the enclosing class. If it is a ViewModel/repository, walk one hop up to its observing Fragment/Activity.
272
+ 3. Code-loaded (dynamic picker): the navigation target of the picker's click handler, not the picker itself.
273
+ 4. Manifest / Application / splash: `Global` or `Launcher`.
274
+ 5. No evidence: `Unknown` (explain in notes).
275
+
276
+ Then propose a HarmonyOS page name: strip the `Activity` / `Fragment` suffix and append `Page` (e.g., `PlayerActivity` → `PlayerPage`). Collapse Activity+Fragment pairs of the same screen to one page. `Launcher` → `EntryAbility`, `Global` → `App`, `Unknown` → `Unknown`. Mark this as a suggestion in notes: "HarmonyOS page name inferred from Android host; verify against actual ArkUI pages".
277
+
278
+ **Embedded image assets in a Lottie JSON:** if the JSON declares an `images` array pointing at external files, copy each referenced image to `rawfile/lottie/images/<relative_path>` preserving the JSON's `imagePath` layout, and record each image as its own inventory + mapping row.
279
+
280
+ **Read `references/lottie-conversion-rules.md` for the full, detailed rules** (identification thresholds, edge cases like dead assets and invalid JSON, mapping-record schema).
281
+
282
+ #### 4.1.3 Code-Defined Vector Icons (Jetpack Compose)
283
+
284
+ Jetpack Compose applications take most of their iconography from `androidx.compose.material:material-icons-core` / `-extended`. Those icons are Kotlin-generated `ImageVector` objects compiled into `classes*.dex`. They are **not** in `res/drawable*/` and **not** in `resources.arsc`, so they are absent from the decoded `res/` tree that every other step of this skill reads.
285
+
286
+ This blind spot fails silently and must be handled explicitly: Step 5.3's layout/menu scan finds nothing (a Compose app has no layout XML) and Step 6.8's `$r('app.media.…')` cross-check finds nothing (the HarmonyOS shell has no such references yet), so both gates report success while the migrated page renders no icons at all. On a real Compose app, 9 of the 10 icons on one screen were code-defined and produced no output and no warning.
287
+
288
+ **Run this analysis when any of these hold** — otherwise record `Code-defined vector icons: none detected` and skip:
289
+ - `build.gradle` / `build.gradle.kts` / `gradle/libs.versions.toml` declares `material-icons-core` or `material-icons-extended`
290
+ - any `.kt` file imports `androidx.compose.material.icons.`
291
+ - `classes*.dex` contains icon name strings (the checker below detects this on its own)
292
+
293
+ Three questions need three different sources — do not try to answer them all from one place:
294
+
295
+ | Question | Source | Needs `android_project_dir`? |
296
+ |---|---|---|
297
+ | **Which** icons the app uses | `classes*.dex` string pool | No |
298
+ | **What** each looks like | Pinned upstream Material Icons snapshot | No |
299
+ | **Where** each is used (screen attribution) | Android source `.kt` files | **Yes** |
300
+
301
+ The dex is authoritative for scope — it includes icons used by library code and excludes icons R8 removed as dead code — but it cannot give attribution, because R8 obfuscates the icon package and leaves only a flat, sorted string pool. Attribution comes from the one readable line in the Kotlin source (`icon = Icons.Outlined.GetApp`). `android_project_dir` is already a required input, so this adds no new dependency.
302
+
303
+ Run the bundled helper:
304
+
305
+ ```
306
+ node ./scripts/code_vector_icons.ts --dex <decoded_output_path> \
307
+ --android-src <android_project_dir> \
308
+ --out <harmony_project_dir>/entry/src/main/resources/base/media \
309
+ --snapshot <material_icon_snapshot_dir> \
310
+ --json <harmony_project_dir>/code_vector_icons.json
311
+ ```
312
+
313
+ `--fetch` is the normal mode: it pulls artwork from a pinned upstream commit — never a moving branch — and therefore needs network access to `raw.githubusercontent.com`. Use `--snapshot <dir>` instead only on network-isolated machines. Exit code 1 means some references could not be resolved; those MUST be recorded as `unmappable` rows, never dropped.
314
+
315
+ Targets are named `base/media/ic_<material_name>_<style>.svg`. The style suffix is mandatory: in the classic Material Icons set `Outlined.X` is sometimes different artwork from `Filled.X` (`bookmark`) and sometimes byte-identical (`favorite`), so naming by bare `ic_<name>.svg` silently drops one of the pair. `AutoMirrored` is **not** part of the filename — HarmonyOS qualifier directories have no right-to-left dimension, so mirroring is handled at the ArkUI component level and recorded in `notes`.
316
+
317
+ **Read `references/code-vector-icon-rules.md` for the full rules** (extraction patterns, the exact name transform, the `symbols`-category trap in the upstream index, SVG post-processing, collision handling with `res/`-derived media, and the fallback table for unresolvable or app-defined `ImageVector`s).
318
+
146
319
  #### 4.2 Qualifier Directory Mapping
147
320
 
148
321
  Android uses qualifiers as directory suffixes (e.g., `drawable-hdpi`, `values-ar`). HarmonyOS uses a different qualifier directory naming convention. Convert as follows:
@@ -271,10 +444,14 @@ When converting `values/*.xml` to HarmonyOS JSON format:
271
444
 
272
445
  ### Step 5: Analyze and Resolve Resource Dependencies
273
446
 
274
- Android resources often reference other resources using `@type/name` syntax (e.g., `@color/primary`, `@drawable/icon`). Dependency analysis runs regardless of whether resources came from a decompiled APK or source `res/` — the difference is that source-based conversion may have more unresolvable references because library resources are absent.
447
+ Android resources often reference other resources using `@type/name` syntax (e.g., `@color/primary`, `@drawable/icon`). Dependency analysis runs regardless of whether resources came from a decoded APK or source `res/` — the difference is that source-based conversion may have more unresolvable references because library resources are absent.
275
448
 
276
449
  Read `references/dependency-analysis-rules.md` for the complete dependency extraction patterns. Also use `references/resource-mapping-rules.md` during this step to infer resource function, screen ownership, source category, and type category for the mapping document.
277
450
 
451
+ For Lottie references (`lottie_fileName`, `lottie_rawRes`, `lottie_url`, and factory-method calls in Kotlin/Java code), follow the additional extraction and host-screen-binding rules in `references/lottie-conversion-rules.md`. Each detected Lottie asset must be attributed to the Activity/Fragment that plays it and paired with a suggested HarmonyOS page name; these facts are consumed by the report and mapping document in Step 7 and Step 8.
452
+
453
+ Dependency analysis here is `@type/name`-based and therefore covers only resources that exist in `res/`. It does **not** see the code-defined Compose icons handled in Step 4.1.3 — their references live in compiled code, not in XML. Carry the inventory produced by `scripts/code_vector_icons.ts` forward into Step 6, Step 7, and Step 8 alongside the `res/`-derived records; do not expect this step to rediscover them.
454
+
278
455
  #### 5.1 Build a Resource Value Lookup Table
279
456
 
280
457
  Before resolving references, build a complete lookup table from whichever resource source is being used. This table maps every resource name to its concrete value:
@@ -326,7 +503,7 @@ These reference Android framework built-in resources that do NOT exist in Harmon
326
503
  | `@android:color/tertiary_text_light` | `#54000000` |
327
504
  | `@android:color/widget_edittext_dark` | `#ff000000` |
328
505
 
329
- For `@android:color/*` values not in this table: if converting from a decompiled APK, look up the color in the decompiled framework resources (`res/values/colors.xml` from the APK). Otherwise, log a warning and use `#ff000000` (black) as a safe fallback.
506
+ For `@android:color/*` values not in this table: if converting from a decoded APK, look up the color in the decoded framework resources (`res/values/colors.xml` from the APK). Otherwise, log a warning and use `#ff000000` (black) as a safe fallback.
330
507
 
331
508
  For `@android:dimen/*` system dimensions: use the following common values:
332
509
 
@@ -381,7 +558,7 @@ For any other `@android:type/*` not covered by the tables above, log a warning i
381
558
 
382
559
  After completing the reference resolution pass, scan all element JSON files for any remaining unresolved `$type:xxx` references. These MUST be replaced with concrete fallback values — leaving unresolved references in the output will cause HarmonyOS compilation errors.
383
560
 
384
- - When the resource source is a **decompiled APK** (which contains the complete merged resource set), unresolved references indicate a bug in the resolution logic. Still apply fallbacks, but log prominently as errors.
561
+ - When the resource source is a **decoded APK** (which contains the complete merged resource set), unresolved references indicate a bug in the resolution logic. Still apply fallbacks, but log prominently as errors.
385
562
  - When the resource source is **source `res/`**, unresolved references are expected for library resources. Apply fallbacks and log as warnings.
386
563
 
387
564
  **Fallback values by type:**
@@ -420,7 +597,9 @@ After resolution, scan all converted resources for any remaining unresolved refe
420
597
 
421
598
  ### Step 6: Verify Completeness
422
599
 
423
- After conversion and dependency resolution, verify the output:
600
+ Items 1-9 and 11 below are performed by `scripts/a2h_resource_convert.ts` and reported in `records.json`; items 10 and 12 are the two separate gates (`svg_fidelity_check.ts` and `code_vector_icons.ts`). Your job is to confirm each one actually ran and to act on what it found — a gate whose output nobody read is not a gate.
601
+
602
+ The checks are:
424
603
 
425
604
  1. Build a list of all resource files found in the resource source directory
426
605
  2. For each, check if it was converted or marked as unmappable
@@ -429,12 +608,31 @@ After conversion and dependency resolution, verify the output:
429
608
  5. Flag any resources that were missed
430
609
  6. Verify all dependencies from converted resources are satisfied (all references resolved to true values)
431
610
  7. Verify all dependencies from layout and menu files are satisfied — any missing resources should appear in the Unsatisfied Dependencies section of the report
432
- 8. **Cross-validate with existing HarmonyOS UI code**: If the HarmonyOS output path already contains `.ets` source files (i.e., it's an existing project with UI code already converted), scan ALL `.ets` files for `$r('app.media.xxx')` resource references and cross-check against the converted `media/` resources:
611
+ 8. **Cross-validate with existing HarmonyOS UI code**: If `harmony_project_dir` already contains `.ets` source files (i.e., it's an existing project with UI code already converted), scan ALL `.ets` files for `$r('app.media.xxx')` resource references and cross-check against the converted `media/` resources:
433
612
  a. For each `$r('app.media.xxx')` reference found in `.ets` files, verify that a corresponding file `xxx.*` (any extension: .png, .svg, .jpg, etc.) exists in the output `resources/base/media/` directory
434
613
  b. For any referenced but missing media resource, **create a placeholder SVG** file: a simple 24x24 SVG with a colored rectangle and the resource name as text, placed in `base/media/`. This ensures the project compiles.
435
614
  c. Log all placeholder-created resources prominently in the conversion report under a dedicated "Placeholder Resources Created" section, so the developer knows these need to be replaced with real assets
436
615
  d. Also scan for `$r('app.string.xxx')`, `$r('app.color.xxx')`, `$r('app.float.xxx')` references and verify those exist in the corresponding element JSON files
616
+ e. For any `lottie.loadAnimation({ path: 'lottie/xxx.json' })` (or equivalent `@ohos/lottie` call) found in `.ets` files, verify that `xxx.json` exists at `rawfile/lottie/xxx.json`. If missing, do NOT create a placeholder — Lottie animations have no meaningful placeholder — instead log it as an unresolved Lottie reference in the report so the developer can drop in the correct JSON or fix the path.
437
617
  9. Before finishing verification, ensure every Android resource inventory row and every mapping row has the required metadata fields from `references/resource-mapping-rules.md`. If some fields cannot be proven, populate them with the rule-defined fallback labels (`Unknown`, `Common`, `Global`, `N/A`) rather than leaving them blank.
618
+ 10. **Vector content fidelity (static, required)**: steps 1-9 above all check *existence* — that a file or key is present. **A file that exists and parses can still be visually wrong**, and existence checks cannot detect a dropped `clip-path` or a `fill` injected onto a stroke-only path. Run the bundled checker:
619
+
620
+ ```
621
+ node ./scripts/svg_fidelity_check.ts --android-res <resource_source_res_dir> \
622
+ --harmony-media <harmony_project_dir>/entry/src/main/resources/base/media \
623
+ --json <harmony_project_dir>/svg_fidelity.json
624
+ ```
625
+
626
+ It statically compares each Android `<vector>` against its converted `.svg` and reports `CLIP_PATH_LOST`, `FILL_INJECTED`, `FILL_LOST`, `GRADIENT_LOST`, and `VIEWBOX_MISMATCH` (exit code 1 when any error is found; no device or emulator involved). Write the findings into the report section **Vector Fidelity Issues** with columns file / rule / severity / Android evidence / SVG evidence.
627
+
628
+ **Any `error`-severity finding blocks completion**: re-convert those drawables per the three-branch `fill` rule and the mandatory `clip-path` rule in `references/xml-drawable-to-svg-rules.md`, then re-run until only warnings remain. Do not mark the conversion complete while errors are outstanding, and do not silently re-emit the same output — a defect here propagates into every page that later references the icon, where it will again pass existence-based checks.
629
+ 11. **String escape self-check**: `references/conversion-rules.md` already requires stripping the outer quotes from Android's `"…"` quoting syntax (which exists to protect leading/trailing whitespace, and is *not* part of the literal text). Verify it was actually applied: scan every `element/string.json` for values that both begin and end with a `"` character. Each hit renders visible quote marks in the UI. Fix them and list them in the report. Apply the same check to every qualifier directory (`base/`, locale variants, etc.), not just `base/`.
630
+ 12. **Code-defined vector icon completeness**: steps 1-11 all reason about `res/`. If Step 4.1.3 applied, verify its output too:
631
+ a. Every icon reference in `code_vector_icons.json` is either `resolved` with its `.svg` present in `base/media/`, or carries an explicit `reason` and appears as an `unmappable` row in the report and mapping document. There is no third state — a reference that is neither written nor recorded is a silent omission.
632
+ b. No synthesized icon overwrote a `res/`-derived media file. The helper renames on collision (`…_material.svg`); confirm the rename is recorded in `notes`.
633
+ c. The pinned snapshot ref used for artwork is recorded in the report and in the mapping document metadata. A run whose artwork came from a moving branch is not reproducible and must be re-run against a pinned ref.
634
+
635
+ Unlike item 10, a failure here does not block completion — an unresolved icon is a recorded gap, not a corrupt asset. But an *unrecorded* icon does block: it reproduces exactly the defect this step exists to catch.
438
636
 
439
637
  **Placeholder SVG template** (for missing media resources):
440
638
  ```svg
@@ -447,20 +645,24 @@ Replace `RESOURCE_NAME` with the actual resource name (truncated if too long).
447
645
 
448
646
  ### Step 7: Generate Report
449
647
 
450
- Output the standard conversion report with these sections:
648
+ The report is written by Toolchain step 4 (`--docs-only --report`). It is deliberately **aggregated** so a human can read it end to end: counts by type, qualifier mappings, the full reference-resolution table, unmappable reasons grouped by cause, fidelity findings, code-defined icons, and warnings grouped by kind with a per-kind sample. The exhaustive per-resource listing belongs in the mapping document (Step 8), not here.
649
+
650
+ Your job is to read it and act on what it says — an unresolved reference, a fidelity error, or a target collision is a finding, not a formatting detail.
651
+
652
+ The generated report follows this structure:
451
653
 
452
654
  ```
453
655
  # Android to HarmonyOS Resource Conversion Report
454
656
 
455
- ## Build Status
456
- - Build attempted: Yes/No
457
- - Build result: Success / Failed / Skipped
458
- - Build error (if failed): <error summary>
459
- - APK source: <"freshly built" / "cached previous build" / "none — using source res/">
460
- - Resource source: <"decompiled APK (complete)" / "source res/ (may be missing library resources)">
657
+ ## Resource Source
658
+ - APK: <apk_path>
659
+ - Decode result: Success / Failed
660
+ - Decode error (if failed): <error summary>
661
+ - Resource source: <"decoded APK (complete)" / "source res/ (may be missing library resources)">
461
662
  - Resource source path: <path>
663
+ - Application module: <app_module>
462
664
 
463
- ⚠️ **Note** (if source res/ was used): Resources were converted from the project's source `res/` directory because no APK was available. Library-provided resources (from Maven dependencies, AARs) are NOT included. References to library resources will appear as unsatisfied dependencies below. To get a complete conversion with all library resources, fix the build and re-run.
665
+ ⚠️ **Note** (only when the decode failed and source `res/` was used): Resources were converted from the project's source `res/` directory because the APK could not be decoded. Library-provided resources (from Maven dependencies, AARs) are NOT included. References to library resources will appear as unsatisfied dependencies below. To get a complete conversion, supply an APK that decodes cleanly and re-run.
464
666
 
465
667
  ## Library Dependencies (from build.gradle)
466
668
  Libraries declared in the project's build.gradle that may provide resources:
@@ -473,7 +675,7 @@ Libraries declared in the project's build.gradle that may provide resources:
473
675
  (This section helps identify which unsatisfied dependencies come from which libraries.)
474
676
 
475
677
  ## Summary
476
- - Resource source: <decompiled APK / source res/>
678
+ - Resource source: <decoded APK / source res/>
477
679
  - Total Android resource files found: <count>
478
680
  - Successfully converted: <count>
479
681
  - Unmappable (no HarmonyOS equivalent): <count>
@@ -481,6 +683,16 @@ Libraries declared in the project's build.gradle that may provide resources:
481
683
  - Resource references resolved: <count>
482
684
  - Unresolved references (library resources missing): <count>
483
685
  - Unresolved references (other reasons): <count>
686
+ - Total Lottie animations found: <count>
687
+ - Lottie migrated to rawfile/lottie/: <count>
688
+ - Lottie remote / URL (no local target): <count>
689
+ - Lottie filename collisions disambiguated: <count>
690
+ - Code-defined icon references found (dex): <count | "none detected">
691
+ - Code-defined icons resolved to artwork: <count>
692
+ - Code-defined icons unresolved (recorded as unmappable): <count>
693
+ - Code-defined icon media files written: <count>
694
+ - Code-defined icons screen-attributed / Unknown: <count> / <count>
695
+ - Material Icons snapshot ref: <pinned commit or vendored snapshot path>
484
696
 
485
697
  ## Conversion Details
486
698
 
@@ -552,6 +764,35 @@ Dependencies from layout/menu files (not converted to HarmonyOS, but needed when
552
764
  | abc_btn_default.9.png | abc_btn_default_9.png | drawable-mdpi |
553
765
  | ... | ... | ... |
554
766
 
767
+ ### Lottie Animation Resources
768
+ Every Lottie JSON detected in the project (identified by structure signature: `v`+`fr`+`ip`+`op`+`layers`) and where it lands in HarmonyOS. Each row also identifies the Android Activity/Fragment that plays the animation and proposes the corresponding HarmonyOS page name so the developer knows where to call `@ohos/lottie`'s `lottie.loadAnimation({ path: 'lottie/<name>.json' })`.
769
+
770
+ | Android Source | Target Rawfile Path | Host Activity/Fragment | Host Layout / Loader | HarmonyOS Page (suggested) | Notes |
771
+ |---|---|---|---|---|---|
772
+ | assets/AndroidWave.json | rawfile/lottie/androidwave.json | DynamicActivity (via lottie_fileName) | res/layout/dynamic_activity.xml | DynamicPage | XML `lottie_fileName` reference |
773
+ | assets/Lottie Logo 1.json | rawfile/lottie/lottie_logo_1.json | PlayerActivity → PlayerFragment | PreviewFragment picker (AssetManager.list) → PlayerActivity.intent(...) | PlayerPage | Renamed from "Lottie Logo 1.json" (spaces normalized). Loaded via runtime picker, dispatches to PlayerActivity. |
774
+ | res/raw/lottielogo.json | rawfile/lottie/lottielogo.json | (multiple) | res/layout/auto_play.xml, auto_play_gone.xml, no_auto_play.xml (`lottie_rawRes="@raw/lottielogo"`) | AutoPlayPage / NoAutoPlayPage | Referenced by three demo layouts. |
775
+ | (remote) https://... | N/A | ... | code call to LottieCompositionFactory.fromUrl(...) | ... | Remote resource, no local target. |
776
+ | ... | ... | ... | ... | ... | ... |
777
+
778
+ ### Code-Defined Vector Icons
779
+ Icons the Android app draws from code (`androidx.compose.material:material-icons-*`) rather than from `res/`. These never appear in the decoded resource tree, so they are recovered from `classes*.dex` and synthesized from the pinned Material Icons snapshot. Omit this section only when no code-defined icons were detected.
780
+
781
+ Artwork source: `<pinned commit or vendored snapshot path>`
782
+
783
+ | Compose Reference | Material Name | Style | HarmonyOS Target | Host Screen(s) | Suggested Page | Notes |
784
+ |---|---|---|---|---|---|---|
785
+ | Icons.Outlined.GetApp | get_app | Outlined | base/media/ic_get_app_outlined.svg | MoreScreen | MorePage | |
786
+ | Icons.AutoMirrored.Outlined.Label | label | Outlined | base/media/ic_label_outlined.svg | MoreScreen | MorePage | AutoMirrored: mirror horizontally under right-to-left locales |
787
+ | Icons.Filled.DateRange | date_range | Filled | base/media/ic_date_range_filled.svg | Unknown | — | dex-only; no source reference found (likely used by a library) |
788
+ | ... | ... | ... | ... | ... | ... | ... |
789
+
790
+ Unresolved references (no artwork produced — these are real gaps, list every one):
791
+
792
+ | Compose Reference | Material Name | Reason |
793
+ |---|---|---|
794
+ | ... | ... | not found in Material Icons index / app-defined ImageVector / snapshot unavailable |
795
+
555
796
  ### Placeholder Resources Created
556
797
  Media resources referenced in `.ets` UI code but not found in converted resources. Placeholder SVGs were created to allow compilation — these MUST be replaced with real assets.
557
798
  | Resource Name | Referenced In | Placeholder File |
@@ -570,21 +811,34 @@ Media resources referenced in `.ets` UI code but not found in converted resource
570
811
  - Missing resources: <list if any>
571
812
  - All references resolved: Yes/No
572
813
  - Unresolved references: <count> (<count> due to missing library resources, <count> other)
814
+ - Vector fidelity errors: <count> (warnings: <count>) — from `scripts/svg_fidelity_check.ts`
815
+ - String escape artifacts: <count> (values still wrapped in literal quotes)
816
+ - Code-defined icons unrecorded: <count> (MUST be 0 — every reference is either written or listed as unmappable)
817
+
818
+ ### Vector Fidelity Issues
819
+ <Omit this section only when the checker reports zero findings.>
820
+
821
+ | File | Rule | Severity | Android evidence | SVG evidence |
822
+ |---|---|---|---|---|
823
+ | <name> | CLIP_PATH_LOST / FILL_INJECTED / FILL_LOST / GRADIENT_LOST / VIEWBOX_MISMATCH | error/warn | <clip count, fillColor, gradient stops, viewport…> | <clipPath count, fill value, gradient defs, viewBox…> |
573
824
  ```
574
825
 
575
826
  ### Step 8: Generate Resource Mapping Document
576
827
 
577
- After the standard conversion report is written, generate a second markdown document at `resource_mapping_path`.
828
+ The second document, at `resource_mapping_path`, is written by the same Toolchain step 4 invocation (`--mapping`). It is the audit surface: **every** observed Android resource appears as its own row, `values` at entry granularity. It does not sample, summarise, or aggregate — those are the report's job. Expect it to be large (measured range: 4 MB to 22 MB); that size is the cost of the no-omission requirement, and the dataset tracks these files with Git LFS for exactly that reason.
578
829
 
579
- Read `references/resource-mapping-rules.md` and write the mapping markdown with these required sections:
830
+ Do not hand-write or hand-trim this document. If it looks too large, that is not a reason to sample it.
831
+
832
+ The generated mapping markdown contains these required sections:
580
833
 
581
834
  1. **Metadata**
582
- - Android project path
583
- - HarmonyOS project output path
835
+ - `android_project_dir`
836
+ - `harmony_project_dir`
584
837
  - Resource source
585
838
  - Resource source path
586
- - Build result
839
+ - Decode result
587
840
  - Generation timestamp
841
+ - Material Icons snapshot ref — only when Step 4.1.3 applied; the pinned commit or vendored snapshot path used to synthesize code-defined icons
588
842
 
589
843
  2. **Android Resource Inventory**
590
844
  - One row per Android resource item
@@ -597,11 +851,17 @@ Read `references/resource-mapping-rules.md` and write the mapping markdown with
597
851
  4. **Unmapped / Unmappable / System / Remote Summary**
598
852
  - Explicitly list resources with no direct HarmonyOS target, Android framework resources, library-only resources inferred from the APK or dependency graph, and runtime remote resources
599
853
 
600
- 5. **Quick Findings**
601
- - Summarize important review findings such as launcher icons from `mipmap`, probable third-party library assets (`abc_*`, `mtrl_*`, `design_*`), and resources present only in the decompiled APK but not in source `res/`
854
+ 5. **Code-Defined Vector Icons** (only when Step 4.1.3 applied)
855
+ - One row per icon reference recovered from `classes*.dex`, including references that could not be resolved
856
+ - Required columns: Compose Reference, Material Name, Style, HarmonyOS Target (or `N/A`), Host Screen(s), Suggested HarmonyOS Page, Notes
857
+ - These rows are additional to — not a substitute for — the inventory and mapping rows required in sections 2 and 3. Record them there with `source_category = 第三方库资源`, `type_category = drawable`, and `mapping_kind = code-vector synthesized` (or `unmappable`), using `<source file>#Icons.<Style>.<Name>` as the Android resource path (or `classes.dex#Icons.<Style>.<Name>` when dex-only)
858
+
859
+ 6. **Quick Findings**
860
+ - Summarize important review findings such as launcher icons from `mipmap`, probable third-party library assets (`abc_*`, `mtrl_*`, `design_*`), and resources present only in the decoded APK but not in source `res/`
602
861
 
603
862
  **Hard requirements for the mapping markdown:**
604
863
  - Never omit an Android resource silently
864
+ - Never omit a code-defined icon reference silently — an icon that could not be resolved is an `N/A` row with a stated reason, never an absent row
605
865
  - For `values/*.xml`, inventory and mapping rows must be at entry granularity using `file_path#tag/name`
606
866
  - Every mapping row must include the Android-side Screen(s), Source Category, and Type Category columns
607
867
  - If one Android resource maps to multiple HarmonyOS outputs, emit multiple mapping rows
@@ -610,14 +870,22 @@ Read `references/resource-mapping-rules.md` and write the mapping markdown with
610
870
 
611
871
  ## Important Notes
612
872
 
873
+ - **Never write your own conversion script.** `scripts/a2h_resource_convert.ts` is the canonical implementation of every rule in `references/`; `scripts/code_vector_icons.ts` and `scripts/svg_fidelity_check.ts` complete the toolchain. Re-implementing any of it produces results that are not comparable across runs — that is the measured failure this toolchain exists to remove (see "Toolchain — mandatory"). If a rule appears wrong or a case is unhandled, fix the script and say so; do not route around it with a one-off converter, a hand-edited resource, or an undocumented placeholder.
874
+ - **`scripts/code_vector_icons.ts` is required, not optional, for Jetpack Compose applications.** Their icons live in `classes*.dex`, not `res/`, so every `res/`-based check in this skill will report success while the migrated page renders no icons at all. Skipping it is the one omission that passes every other gate.
613
875
  - Always read `references/conversion-rules.md` for the complete, detailed conversion rules before starting conversions. The tables above are summaries.
614
876
  - Always read `references/resource-mapping-rules.md` before producing `resource_mapping_path`. It defines the inventory schema, mapping schema, screen attribution rules, source categorization rules, type categorization rules, and markdown output format.
615
- - **Build is best-effort**: The APK build + decompilation is attempted first because the decompiled APK is the most complete resource source (it includes library dependencies). But if the build fails, conversion proceeds from source `res/` — a partial conversion with clear reporting is far more useful than no conversion at all.
877
+ - **Decoding is best-effort**: `apk_path` is decoded first because the decoded APK is the most complete resource source (it includes library dependencies merged in at build time). This skill does **not** build the APK — it decodes the one the caller supplies. If decoding fails, conversion proceeds from the project's source `res/` at `<android_project_dir>/<app_module>/src/main/res/` — a partial conversion with clear reporting is far more useful than no conversion at all.
616
878
  - **XML drawable conversion is critical**: Android XML drawables (`<vector>`, `<shape>`, `<layer-list>`, `<selector>`) must be converted to SVG format, not skipped. HarmonyOS supports SVG in `media/`. Read `references/xml-drawable-to-svg-rules.md` for the detailed conversion rules for each drawable type.
879
+ - **Lottie animations are special**: Android projects that use `com.airbnb.android:lottie` ship JSON files in `assets/` or `res/raw/`. These migrate to `entry/src/main/resources/rawfile/lottie/<normalized>.json` for consumption by `@ohos/lottie` (installed via `ohpm install @ohos/lottie`). Identify Lottie JSON by structure signature (must contain `v`+`fr`+`ip`+`op`+`layers`), not by extension. Every Lottie row in the mapping document MUST bind the JSON to the Android Activity/Fragment that plays it and propose a HarmonyOS page name. Read `references/lottie-conversion-rules.md` for the complete rules including reference extraction (`lottie_fileName` / `lottie_rawRes` / `lottie_url`), filename normalization, host-screen binding, and remote/dynamic edge cases.
880
+ - **Code-defined icons are invisible to `res/` scanning**: Jetpack Compose apps draw most icons from `androidx.compose.material:material-icons-*`. Those are compiled `ImageVector` objects in `classes*.dex` — not in `res/drawable*/`, not in `resources.arsc`, therefore not in the decoded `res/` tree. Every existence-based check in this skill will report success while the migrated page shows no icons. Step 4.1.3 and `scripts/code_vector_icons.ts` recover them: the dex gives the authoritative inventory, the Android source gives screen attribution, and a **pinned** Material Icons snapshot gives the artwork. Read `references/code-vector-icon-rules.md` for the complete rules. An icon this process cannot resolve must still become a visible `unmappable` row — never a silent omission.
617
881
  - **Dependency analysis always runs**: Read `references/dependency-analysis-rules.md` for the complete dependency extraction patterns and reference formats. Even when converting from source `res/` with missing library resources, dependency analysis is essential — it tells the developer exactly which references are broken and why, so they can address them manually or fix the build.
618
- - **APK decompilation**: The skill bundles `apktool_3.0.1.jar` in the `tools/` directory. Java must be available in the system PATH.
619
- - When parsing Android XML resource files, handle XML namespaces, comments, and attributes correctly.
620
- - For `values/` XML files, each `<resources>` element can contain multiple resource entries — extract ALL of them.
621
- - When multiple Android value files contribute to the same HarmonyOS JSON file (e.g., both `strings.xml` and custom `app_strings.xml` both contain `<string>` entries), merge them into a single JSON file.
622
- - Preserve resource names exactly as they appear in Android (they serve as identifiers).
623
- - If an element JSON file (like `string.json`) already exists from the template, merge new entries into it rather than overwriting — but template defaults can be replaced if they conflict.
882
+ - **APK decoding**: The decoder is `a2h-resource`, a pure-Node.js resource decoder published to npm (requires Node.js `>= 20`; no other runtime). Install it with `npm install -g a2h-resource` and run `a2h-resource <apk> -o <out>`, or run it on-demand with `npx --yes a2h-resource <apk> -o <out>`. It covers resource extraction only — it does not disassemble `classes.dex` or repackage APKs, neither of which this skill needs. It decodes a single resource package (the app's); if it errors out or the APK is a rare multi-package/split APK, fall back to converting from the project's source `res/` directory (as in Step 3).
883
+ The following are **behaviours the converter already guarantees**. They are listed so you know what to expect and what to check in its output — not as instructions to implement:
884
+
885
+ - Android XML is parsed with namespaces, comments, and CDATA handled; attributes are matched by local name, so any `android:` prefix works.
886
+ - Every entry of every `<resources>` element is extracted; multiple value files contributing the same type are merged into one HarmonyOS JSON file.
887
+ - Resource names are preserved exactly as Android spells them — they are identifiers.
888
+ - An element JSON that already exists in the HarmonyOS project is **merged**, not overwritten: existing entries keep their order and position, DevEco scaffold defaults are replaced when a real resource has the same name, and the replacement is recorded.
889
+ - Android's `"…"` quoting syntax is consumed as syntax, so leading and trailing whitespace it protects is preserved in the value. Do not "clean up" such strings; Android renders that whitespace.
890
+ - Decoded fixed-point dimensions are rounded to 3 decimals, so values like `6.500001dip` do not carry float noise into the output.
891
+ - When several Android sources map to one HarmonyOS target (`drawable/x.xml` and `drawable-anydpi/x.xml` both land in `base/media/`), the source with **fewer qualifiers** wins and the loser is recorded as an `unmappable` mapping row — never silently dropped.