@harmonyos-arkts/d2h 0.1.11 → 0.1.13

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 (126) hide show
  1. package/.claude-plugin/marketplace.json +15 -13
  2. package/.claude-plugin/plugin.json +13 -7
  3. package/AGENTS.md +5 -5
  4. package/README.md +212 -212
  5. package/agents/android-to-hmos-00-orchestrator.md +318 -318
  6. package/agents/d2h.md +157 -157
  7. package/dist/bin/install-opencode.js +30 -30
  8. package/docs/environment-check.md +86 -86
  9. package/install-opencode.sh +160 -160
  10. package/opencode/agents.json +16 -16
  11. package/opencode/vscode-d2h-package.json +7 -7
  12. package/opencode/vscode-d2h-plugin.mjs +29 -29
  13. package/package.json +54 -54
  14. package/schemas/android-source-manifest.schema.json +25 -25
  15. package/schemas/checkpoint-provenance.schema.json +67 -67
  16. package/schemas/final-acceptance.schema.json +29 -29
  17. package/schemas/managed-evidence-index.schema.json +15 -15
  18. package/schemas/managed-evidence.schema.json +114 -114
  19. package/schemas/migration-config.schema.json +51 -51
  20. package/schemas/migration-report-index.schema.json +39 -39
  21. package/schemas/migration-report-item.schema.json +51 -51
  22. package/schemas/migration-report-summary.schema.json +25 -25
  23. package/schemas/migration-status.schema.json +202 -202
  24. package/schemas/preflight.schema.json +60 -60
  25. package/schemas/source-order-audit.schema.json +16 -16
  26. package/schemas/source-provenance-event.schema.json +19 -19
  27. package/schemas/spec-app-shard.schema.json +45 -45
  28. package/schemas/spec-fact-corrections-shard.schema.json +13 -13
  29. package/schemas/spec-features-shard.schema.json +43 -43
  30. package/schemas/spec-index.schema.json +26 -26
  31. package/schemas/spec-interactions-shard.schema.json +40 -40
  32. package/schemas/spec-page.schema.json +98 -98
  33. package/schemas/spec-pages-index.schema.json +1 -1
  34. package/schemas/spec-unresolved-shard.schema.json +1 -1
  35. package/schemas/task-envelope.schema.json +109 -109
  36. package/schemas/task-plan.schema.json +341 -341
  37. package/scripts/check-environment.mjs +320 -320
  38. package/skills/android2hmos_resources_convert/SKILL.md +180 -180
  39. package/skills/android2hmos_resources_convert/references/image-conversion-rules.md +230 -230
  40. package/skills/android2hmos_resources_convert/references/svg-fix-patterns.md +175 -175
  41. package/skills/android2hmos_resources_convert/references/xml-drawable-to-svg-rules.md +513 -513
  42. package/skills/arkts-app-identity/SKILL.md +238 -238
  43. package/skills/arkts-i18n/SKILL.md +496 -496
  44. package/skills/arkts-i18n/evals/evals.json +84 -84
  45. package/skills/arkts-i18n/references/code-examples.md +302 -302
  46. package/skills/arkts-i18n/references/common-pitfalls.md +391 -391
  47. package/skills/arkts-i18n/references/dynamic-language-switch.md +604 -604
  48. package/skills/arkts-i18n/references/hardcoded-string-scanner.md +348 -348
  49. package/skills/arkts-i18n/references/language-codes.md +104 -104
  50. package/skills/arkts-i18n/references/resource-file-structure.md +775 -775
  51. package/skills/arkts-i18n/references/static-vs-dynamic.md +242 -242
  52. package/skills/arkts-i18n/references/v1-compat.md +244 -244
  53. package/skills/arkts-i18n/scripts/audit_i18n_completeness.sh +174 -174
  54. package/skills/arkts-icon-sizing/SKILL.md +211 -211
  55. package/skills/arkts-icon-sizing/scripts/icon_audit.py +131 -131
  56. package/skills/arkts-icon-sizing/scripts/icon_autofix.py +88 -88
  57. package/skills/arkts-icon-sizing/scripts/icon_dims.py +179 -179
  58. package/skills/arkts-icon-sizing/scripts/icon_fix.py +119 -119
  59. package/skills/arkts-mvvm-architecture/SKILL.md +613 -613
  60. package/skills/d2h-hypium-forge/SKILL.md +309 -309
  61. package/skills/d2h-hypium-forge/references/functional-spec-template.md +140 -140
  62. package/skills/d2h-hypium-forge/references/official-api.md +135 -135
  63. package/skills/d2h-hypium-forge/references/pitfalls.md +98 -98
  64. package/skills/d2h-hypium-forge/references/testability-template.md +71 -71
  65. package/skills/d2h-hypium-forge/scripts/_common_template.py +659 -659
  66. package/skills/d2h-hypium-forge/scripts/analyze_results.py +165 -165
  67. package/skills/d2h-hypium-forge/scripts/assert_audit.py +107 -107
  68. package/skills/d2h-hypium-forge/scripts/collect_runtime_pages.py +169 -169
  69. package/skills/d2h-hypium-forge/scripts/forge_report.py +325 -325
  70. package/skills/d2h-hypium-forge/scripts/inject_resource_ids.py +114 -114
  71. package/skills/d2h-hypium-forge/scripts/lint_asserts.py +80 -80
  72. package/skills/d2h-hypium-forge/scripts/lint_locate.py +60 -60
  73. package/skills/d2h-hypium-forge/scripts/merge_appgraph.py +249 -249
  74. package/skills/d2h-hypium-forge/scripts/precondition.py +140 -140
  75. package/skills/d2h-hypium-forge/scripts/preinject_ids.py +232 -232
  76. package/skills/d2h-hypium-forge/scripts/probe.py +197 -197
  77. package/skills/d2h-hypium-forge/scripts/run_direct.py +823 -823
  78. package/skills/d2h-hypium-forge/scripts/run_parallel.py +121 -121
  79. package/skills/d2h-hypium-forge/scripts/scan_features.py +255 -255
  80. package/skills/d2h-hypium-forge/scripts/upgrade_asserts.py +66 -66
  81. package/skills/d2h-hypium-forge/scripts/validate_scenarios.py +84 -84
  82. package/skills/d2h-page-develop/SKILL.md +112 -112
  83. package/skills/d2h-page-develop/agents/openai.yaml +7 -7
  84. package/skills/d2h-page-spec-generate/SKILL.md +206 -206
  85. package/skills/d2h-page-spec-generate/scripts/build_batch_report.py +227 -227
  86. package/skills/d2h-utg-ai-generate/SKILL.md +128 -128
  87. package/skills/d2h-utg-ai-generate/references/click-paths-schema.json +76 -76
  88. package/skills/d2h-utg-ai-generate/references/extraction-guide.md +34 -34
  89. package/skills/d2h-utg-ai-generate/references/facts-contract.md +96 -96
  90. package/skills/d2h-utg-ai-generate/references/page-schema.json +61 -61
  91. package/skills/d2h-utg-ai-generate/references/utg-schema.json +89 -89
  92. package/skills/d2h-utg-ai-generate/scripts/build_page_json.py +314 -314
  93. package/skills/d2h-utg-ai-generate/scripts/build_utg.py +123 -123
  94. package/skills/d2h-utg-ai-generate/scripts/capture_from_page_json.ts +280 -280
  95. package/skills/d2h-utg-ai-generate/scripts/utg_common.py +524 -524
  96. package/skills/d2h-utg-ai-generate/scripts/utg_html.py +489 -489
  97. package/skills/d2h-utg-ai-generate/scripts/validate_utg.py +69 -69
  98. package/skills/d2h-utg-ai-generate/scripts/vendor/D3-LICENSE +13 -13
  99. package/skills/d2h-utg-ai-generate/scripts/vendor/d3-7.9.0.min.js +2 -2
  100. package/skills/d2h-utg-ai-generate/tests/test_pipeline.py +369 -369
  101. package/skills/d2h-utg-static-generate/SKILL.md +73 -73
  102. package/skills/d2h-utg-static-generate/references/discoveries.md +38 -38
  103. package/skills/d2h-utg-static-generate/scripts/generate.py +499 -499
  104. package/skills/d2h-utg-static-generate/tests/test_static.py +335 -335
  105. package/skills/d2h-utg-static-generate/tests/verify-offline-html.py +60 -60
  106. package/skills/d2h-utg-static-generate/tests/verify-produced-fixture.py +131 -131
  107. package/skills/harmonyos-migration-playbook/SKILL.md +83 -83
  108. package/skills/harmonyos-migration-playbook/agents/openai.yaml +7 -7
  109. package/skills/harmonyos-migration-playbook/references/arkts-compile.md +24 -24
  110. package/skills/harmonyos-migration-playbook/references/harmony-runtime.md +53 -53
  111. package/skills/harmonyos-migration-playbook/references/lesson-lifecycle.md +45 -45
  112. package/skills/harmonyos-migration-playbook/references/protocol-e2e.md +23 -23
  113. package/skills/harmonyos-migration-playbook/references/ui-automation.md +53 -53
  114. package/skills/harmonyos-migration-playbook/references/windows-environment.md +38 -38
  115. package/skills/maintaining-migration-report/SKILL.md +144 -144
  116. package/skills/maintaining-migration-report/references/final-acceptance.md +48 -48
  117. package/skills/maintaining-migration-report/references/source-provenance.md +66 -66
  118. package/skills/managing-d2h-toolchain/SKILL.md +24 -24
  119. package/skills/managing-d2h-toolchain/environment-requirements.json +16 -16
  120. package/skills/managing-d2h-toolchain/scripts/manage-toolchain.mjs +98 -98
  121. package/skills/managing-d2h-toolchain/toolchain.json +16 -16
  122. package/skills/native-library-substitution/SKILL.md +384 -384
  123. package/skills/native-library-substitution/references/native-library-substitution.json +56905 -56905
  124. package/skills/native-library-substitution/references/native-library-substitution.md +163 -163
  125. package/skills/preparing-migration-workspace/SKILL.md +131 -131
  126. package/skills/reviewing-migration-process/SKILL.md +62 -62
@@ -1,175 +1,175 @@
1
- # SVG Display Issue Fix Patterns
2
-
3
- Common display abnormalities and fixes when migrating SVG/Vector Drawables from Android projects or manually creating SVGs.
4
-
5
- ---
6
-
7
- ## Issue 1: viewBox Does Not Match Path Coordinates
8
-
9
- ### Symptoms
10
- Icon does not display at all, or only shows a blank area.
11
-
12
- ### Cause
13
- The coordinate range defined by `viewBox` does not match the coordinate data in the `d` attribute of `<path>`.
14
-
15
- For example: path data is based on a 512×512 coordinate system (coordinate values range from 85 to 448), but `viewBox` is set to `0 0 24 24`, causing all paths to exceed the visible area.
16
-
17
- ### Fix
18
-
19
- **Option A: Adjust viewBox to Match Path Coordinates (Recommended for Simple Cases)**
20
- ```xml
21
- <!-- Wrong: viewBox too small -->
22
- <svg viewBox="0 0 24 24">
23
- <path d="M101.51,411.23 Q85.21,395.05 ..." /> <!-- coordinates far exceed 24 -->
24
- </svg>
25
-
26
- <!-- Fixed: viewBox matches coordinate system, use width/height to control render size -->
27
- <svg width="24" height="24" viewBox="0 0 512 512">
28
- <path d="M101.51,411.23 Q85.21,395.05 ..." />
29
- </svg>
30
- ```
31
-
32
- > Note: `viewBox` defines the path coordinate space, while `width`/`height` define the render size. They are independent.
33
-
34
- **Option B: Scale Path Coordinates Proportionally (Recommended for Standardization)**
35
-
36
- Scale all values in the path proportionally to the target coordinate system. For example, scaling from 512 to 24:
37
-
38
- ```python
39
- import re
40
-
41
- scale = 24.0 / 512.0 # 0.046875
42
-
43
- def scale_number(match):
44
- num = float(match.group(0))
45
- scaled = round(num * scale, 2)
46
- return '{:.2f}'.format(scaled).rstrip('0').rstrip('.')
47
-
48
- path_data = "M101.51,411.23Q85.21,395.05 85.22,371.75..."
49
- result = re.sub(r'[0-9]+\.?[0-9]*', scale_number, path_data)
50
- ```
51
-
52
- After scaling, you can use the standard `viewBox="0 0 24 24"`, consistent with other Material Design icons.
53
-
54
- ---
55
-
56
- ## Issue 2: Android Vector Drawable Syntax Remnants
57
-
58
- ### Symptoms
59
- The SVG file contains Android-specific XML attributes that standard SVG renderers cannot parse.
60
-
61
- ### Common Remnant Syntax
62
-
63
- | Android Syntax | Standard SVG Equivalent |
64
- |---------------|----------------------|
65
- | `<group android:translateX="24" android:rotation="90">` | `<g transform="translate(24,0) rotate(90)">` |
66
- | `android:fillColor="#FF000000"` | `fill="#000000"` |
67
- | `android:pathData="..."` | `d="..."` |
68
- | `android:viewportWidth="24"` | Part of `viewBox="0 0 24 24"` |
69
- | `<vector>` root element | `<svg>` root element |
70
- | `<clip-path android:pathData="..."/>` | `<defs><clipPath id="..."><path d="..."/></clipPath></defs>` |
71
-
72
- ### Fix
73
-
74
- Fully convert Android `<group>` transform attributes to SVG `transform`:
75
-
76
- ```xml
77
- <!-- Android Vector Drawable -->
78
- <group
79
- android:translateX="24"
80
- android:translateY="0"
81
- android:rotation="90"
82
- android:pivotX="12"
83
- android:pivotY="12"
84
- android:scaleX="1.5"
85
- android:scaleY="1.5">
86
- <path android:pathData="M18,12l4,-4..." android:fillColor="#FFFFFF"/>
87
- </group>
88
-
89
- <!-- Converted to Standard SVG -->
90
- <g transform="translate(24,0) rotate(90,12,12) scale(1.5,1.5)">
91
- <path d="M18,12l4,-4..." fill="#FFFFFF"/>
92
- </g>
93
- ```
94
-
95
- Transform order: `translate` → `rotate` (with pivot point) → `scale`
96
-
97
- ---
98
-
99
- ## Issue 3: Fill Color is White Causing Invisible Icon
100
-
101
- ### Symptoms
102
- SVG file exists and path is correct, but icon does not display (invisible on white background).
103
-
104
- ### Cause
105
- The original Android drawable's `fillColor` is `#FFFFFF` (white), which is invisible on a white background. Common for icons designed to appear on dark ActionBars.
106
-
107
- ### Fix
108
-
109
- Change `fill="#FFFFFF"` to `fill="#000000"` (black), or choose a suitable color based on UI needs:
110
-
111
- ```xml
112
- <!-- Before fix: white fill invisible on white background -->
113
- <path fill="#FFFFFF" d="M18,12l4,-4..."/>
114
-
115
- <!-- After fix -->
116
- <path fill="#000000" d="M18,12l4,-4..."/>
117
- ```
118
-
119
- ---
120
-
121
- ## Issue 4: Google Material Symbols Coordinate System
122
-
123
- ### Description
124
- Material Symbols SVGs downloaded from Google Fonts use a special coordinate system:
125
-
126
- ```xml
127
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000">
128
- <path d="M200-120q-33 0-56.5-23.5T120-200v-560..."/>
129
- </svg>
130
- ```
131
-
132
- - `viewBox="0 -960 960 960"` — Y-axis starts at -960 (positive is upward)
133
- - Many negative values in path coordinates are normal
134
- - This format renders correctly in HarmonyOS, **no additional conversion needed**
135
-
136
- ---
137
-
138
- ## Issue 5: HarmonyOS media Directory Does Not Support Subdirectories
139
-
140
- ### Symptoms
141
- Compilation error: `CompileResource` error "invalid path, not a file"
142
-
143
- ### Cause
144
- Created subdirectories under `resources/base/media/` (e.g., `media/icons/`, `media/md/`).
145
-
146
- ### Fix
147
-
148
- Move all files from subdirectories to the `media/` root directory, using file name prefixes to distinguish sources:
149
-
150
- ```bash
151
- # Wrong: using subdirectories
152
- media/
153
- md/
154
- share.svg
155
- home.svg
156
-
157
- # Correct: flat storage with prefixes
158
- media/
159
- md_share.svg
160
- md_home.svg
161
- ic_custom_icon.svg
162
- ```
163
-
164
- ---
165
-
166
- ## Quick Diagnosis Checklist
167
-
168
- When SVG icon does not display, check in order:
169
-
170
- 1. **File exists?** — Confirm the file exists under `entry/src/main/resources/base/media/`
171
- 2. **Reference correct?** — `$r('app.media.filename_without_extension')`, filename is case-sensitive
172
- 3. **viewBox matches?** — `viewBox` coordinate range must cover path data coordinate values
173
- 4. **Syntax standard?** — No `android:` namespace attributes, root element is `<svg>` not `<vector>`
174
- 5. **Fill color visible?** — `fill` is not `#FFFFFF` (invisible on white background)
175
- 6. **No subdirectories?** — SVG files are directly under `media/` root directory
1
+ # SVG Display Issue Fix Patterns
2
+
3
+ Common display abnormalities and fixes when migrating SVG/Vector Drawables from Android projects or manually creating SVGs.
4
+
5
+ ---
6
+
7
+ ## Issue 1: viewBox Does Not Match Path Coordinates
8
+
9
+ ### Symptoms
10
+ Icon does not display at all, or only shows a blank area.
11
+
12
+ ### Cause
13
+ The coordinate range defined by `viewBox` does not match the coordinate data in the `d` attribute of `<path>`.
14
+
15
+ For example: path data is based on a 512×512 coordinate system (coordinate values range from 85 to 448), but `viewBox` is set to `0 0 24 24`, causing all paths to exceed the visible area.
16
+
17
+ ### Fix
18
+
19
+ **Option A: Adjust viewBox to Match Path Coordinates (Recommended for Simple Cases)**
20
+ ```xml
21
+ <!-- Wrong: viewBox too small -->
22
+ <svg viewBox="0 0 24 24">
23
+ <path d="M101.51,411.23 Q85.21,395.05 ..." /> <!-- coordinates far exceed 24 -->
24
+ </svg>
25
+
26
+ <!-- Fixed: viewBox matches coordinate system, use width/height to control render size -->
27
+ <svg width="24" height="24" viewBox="0 0 512 512">
28
+ <path d="M101.51,411.23 Q85.21,395.05 ..." />
29
+ </svg>
30
+ ```
31
+
32
+ > Note: `viewBox` defines the path coordinate space, while `width`/`height` define the render size. They are independent.
33
+
34
+ **Option B: Scale Path Coordinates Proportionally (Recommended for Standardization)**
35
+
36
+ Scale all values in the path proportionally to the target coordinate system. For example, scaling from 512 to 24:
37
+
38
+ ```python
39
+ import re
40
+
41
+ scale = 24.0 / 512.0 # 0.046875
42
+
43
+ def scale_number(match):
44
+ num = float(match.group(0))
45
+ scaled = round(num * scale, 2)
46
+ return '{:.2f}'.format(scaled).rstrip('0').rstrip('.')
47
+
48
+ path_data = "M101.51,411.23Q85.21,395.05 85.22,371.75..."
49
+ result = re.sub(r'[0-9]+\.?[0-9]*', scale_number, path_data)
50
+ ```
51
+
52
+ After scaling, you can use the standard `viewBox="0 0 24 24"`, consistent with other Material Design icons.
53
+
54
+ ---
55
+
56
+ ## Issue 2: Android Vector Drawable Syntax Remnants
57
+
58
+ ### Symptoms
59
+ The SVG file contains Android-specific XML attributes that standard SVG renderers cannot parse.
60
+
61
+ ### Common Remnant Syntax
62
+
63
+ | Android Syntax | Standard SVG Equivalent |
64
+ |---------------|----------------------|
65
+ | `<group android:translateX="24" android:rotation="90">` | `<g transform="translate(24,0) rotate(90)">` |
66
+ | `android:fillColor="#FF000000"` | `fill="#000000"` |
67
+ | `android:pathData="..."` | `d="..."` |
68
+ | `android:viewportWidth="24"` | Part of `viewBox="0 0 24 24"` |
69
+ | `<vector>` root element | `<svg>` root element |
70
+ | `<clip-path android:pathData="..."/>` | `<defs><clipPath id="..."><path d="..."/></clipPath></defs>` |
71
+
72
+ ### Fix
73
+
74
+ Fully convert Android `<group>` transform attributes to SVG `transform`:
75
+
76
+ ```xml
77
+ <!-- Android Vector Drawable -->
78
+ <group
79
+ android:translateX="24"
80
+ android:translateY="0"
81
+ android:rotation="90"
82
+ android:pivotX="12"
83
+ android:pivotY="12"
84
+ android:scaleX="1.5"
85
+ android:scaleY="1.5">
86
+ <path android:pathData="M18,12l4,-4..." android:fillColor="#FFFFFF"/>
87
+ </group>
88
+
89
+ <!-- Converted to Standard SVG -->
90
+ <g transform="translate(24,0) rotate(90,12,12) scale(1.5,1.5)">
91
+ <path d="M18,12l4,-4..." fill="#FFFFFF"/>
92
+ </g>
93
+ ```
94
+
95
+ Transform order: `translate` → `rotate` (with pivot point) → `scale`
96
+
97
+ ---
98
+
99
+ ## Issue 3: Fill Color is White Causing Invisible Icon
100
+
101
+ ### Symptoms
102
+ SVG file exists and path is correct, but icon does not display (invisible on white background).
103
+
104
+ ### Cause
105
+ The original Android drawable's `fillColor` is `#FFFFFF` (white), which is invisible on a white background. Common for icons designed to appear on dark ActionBars.
106
+
107
+ ### Fix
108
+
109
+ Change `fill="#FFFFFF"` to `fill="#000000"` (black), or choose a suitable color based on UI needs:
110
+
111
+ ```xml
112
+ <!-- Before fix: white fill invisible on white background -->
113
+ <path fill="#FFFFFF" d="M18,12l4,-4..."/>
114
+
115
+ <!-- After fix -->
116
+ <path fill="#000000" d="M18,12l4,-4..."/>
117
+ ```
118
+
119
+ ---
120
+
121
+ ## Issue 4: Google Material Symbols Coordinate System
122
+
123
+ ### Description
124
+ Material Symbols SVGs downloaded from Google Fonts use a special coordinate system:
125
+
126
+ ```xml
127
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000">
128
+ <path d="M200-120q-33 0-56.5-23.5T120-200v-560..."/>
129
+ </svg>
130
+ ```
131
+
132
+ - `viewBox="0 -960 960 960"` — Y-axis starts at -960 (positive is upward)
133
+ - Many negative values in path coordinates are normal
134
+ - This format renders correctly in HarmonyOS, **no additional conversion needed**
135
+
136
+ ---
137
+
138
+ ## Issue 5: HarmonyOS media Directory Does Not Support Subdirectories
139
+
140
+ ### Symptoms
141
+ Compilation error: `CompileResource` error "invalid path, not a file"
142
+
143
+ ### Cause
144
+ Created subdirectories under `resources/base/media/` (e.g., `media/icons/`, `media/md/`).
145
+
146
+ ### Fix
147
+
148
+ Move all files from subdirectories to the `media/` root directory, using file name prefixes to distinguish sources:
149
+
150
+ ```bash
151
+ # Wrong: using subdirectories
152
+ media/
153
+ md/
154
+ share.svg
155
+ home.svg
156
+
157
+ # Correct: flat storage with prefixes
158
+ media/
159
+ md_share.svg
160
+ md_home.svg
161
+ ic_custom_icon.svg
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Quick Diagnosis Checklist
167
+
168
+ When SVG icon does not display, check in order:
169
+
170
+ 1. **File exists?** — Confirm the file exists under `entry/src/main/resources/base/media/`
171
+ 2. **Reference correct?** — `$r('app.media.filename_without_extension')`, filename is case-sensitive
172
+ 3. **viewBox matches?** — `viewBox` coordinate range must cover path data coordinate values
173
+ 4. **Syntax standard?** — No `android:` namespace attributes, root element is `<svg>` not `<vector>`
174
+ 5. **Fill color visible?** — `fill` is not `#FFFFFF` (invisible on white background)
175
+ 6. **No subdirectories?** — SVG files are directly under `media/` root directory