@harmonyos-arkts/d2h 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +13 -0
- package/.claude-plugin/plugin.json +7 -0
- package/README.md +168 -2
- package/agents/android-to-hmos-00-orchestrator.md +312 -0
- package/agents/d2h.md +168 -0
- package/bin/install-opencode.mjs +51 -0
- package/install-opencode.sh +160 -0
- package/opencode/agents.json +16 -0
- package/package.json +16 -4
- package/schemas/android-source-manifest.schema.json +25 -0
- package/schemas/checkpoint-provenance.schema.json +67 -0
- package/schemas/final-acceptance.schema.json +29 -0
- package/schemas/managed-evidence-index.schema.json +15 -0
- package/schemas/managed-evidence.schema.json +114 -0
- package/schemas/migration-config.schema.json +51 -0
- package/schemas/migration-report-index.schema.json +39 -0
- package/schemas/migration-report-item.schema.json +51 -0
- package/schemas/migration-report-summary.schema.json +25 -0
- package/schemas/migration-status.schema.json +202 -0
- package/schemas/preflight.schema.json +60 -0
- package/schemas/source-order-audit.schema.json +16 -0
- package/schemas/source-provenance-event.schema.json +19 -0
- package/schemas/spec-app-shard.schema.json +45 -0
- package/schemas/spec-fact-corrections-shard.schema.json +13 -0
- package/schemas/spec-features-shard.schema.json +43 -0
- package/schemas/spec-index.schema.json +26 -0
- package/schemas/spec-interactions-shard.schema.json +40 -0
- package/schemas/spec-page.schema.json +98 -0
- package/schemas/spec-pages-index.schema.json +1 -0
- package/schemas/spec-unresolved-shard.schema.json +1 -0
- package/schemas/task-envelope.schema.json +55 -0
- package/schemas/task-plan.schema.json +123 -0
- package/skills/android2hmos_resources_convert/SKILL.md +162 -0
- package/skills/android2hmos_resources_convert/references/image-conversion-rules.md +230 -0
- package/skills/android2hmos_resources_convert/references/svg-fix-patterns.md +175 -0
- package/skills/android2hmos_resources_convert/references/xml-drawable-to-svg-rules.md +513 -0
- package/skills/appgraph-rule-audit/SKILL.md +58 -0
- package/skills/appgraph-rule-audit/references/audit-contract.md +47 -0
- package/skills/appgraph-rule-audit/references/recommendation-schema.md +41 -0
- package/skills/appgraph-rule-audit/schemas/rule-opportunities.schema.json +125 -0
- package/skills/arkts-app-identity/SKILL.md +238 -0
- package/skills/arkts-i18n/SKILL.md +496 -0
- package/skills/arkts-i18n/evals/evals.json +84 -0
- package/skills/arkts-i18n/references/code-examples.md +302 -0
- package/skills/arkts-i18n/references/common-pitfalls.md +391 -0
- package/skills/arkts-i18n/references/dynamic-language-switch.md +604 -0
- package/skills/arkts-i18n/references/hardcoded-string-scanner.md +348 -0
- package/skills/arkts-i18n/references/language-codes.md +104 -0
- package/skills/arkts-i18n/references/resource-file-structure.md +775 -0
- package/skills/arkts-i18n/references/static-vs-dynamic.md +242 -0
- package/skills/arkts-i18n/references/v1-compat.md +244 -0
- package/skills/arkts-i18n/scripts/audit_i18n_completeness.sh +174 -0
- package/skills/arkts-icon-sizing/SKILL.md +211 -0
- package/skills/arkts-icon-sizing/scripts/icon_audit.py +131 -0
- package/skills/arkts-icon-sizing/scripts/icon_autofix.py +88 -0
- package/skills/arkts-icon-sizing/scripts/icon_dims.py +179 -0
- package/skills/arkts-icon-sizing/scripts/icon_fix.py +119 -0
- package/skills/arkts-mvvm-architecture/SKILL.md +613 -0
- package/skills/harmonyos-migration-playbook/SKILL.md +56 -0
- package/skills/harmonyos-migration-playbook/agents/openai.yaml +7 -0
- package/skills/harmonyos-migration-playbook/references/arkts-compile.md +24 -0
- package/skills/harmonyos-migration-playbook/references/harmony-runtime.md +53 -0
- package/skills/harmonyos-migration-playbook/references/lesson-lifecycle.md +45 -0
- package/skills/harmonyos-migration-playbook/references/protocol-e2e.md +23 -0
- package/skills/harmonyos-migration-playbook/references/ui-automation.md +52 -0
- package/skills/harmonyos-migration-playbook/references/windows-environment.md +38 -0
- package/skills/maintaining-migration-report/SKILL.md +155 -0
- package/skills/native-library-substitution/SKILL.md +385 -0
- package/skills/native-library-substitution/references/native-library-substitution.json +56906 -0
- package/skills/native-library-substitution/references/native-library-substitution.md +163 -0
- package/skills/preparing-migration-workspace/SKILL.md +124 -0
- package/skills/preparing-migration-workspace/toolchain.json +43 -0
- package/skills/reviewing-migration-process/SKILL.md +62 -0
- package/src/install-opencode.mjs +108 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: native-library-substitution
|
|
3
|
+
description: 原生三方库鸿蒙替代方案查询。基于 ohpm 仓库完整数据库(2678 条映射记录),支持安卓库 → 鸿蒙替代方案查询。**场景 4 完整工作流模式**:Planning Agent 可直接调用执行多级检索(本地 → ohpm 仓库 → 全网搜索)+ 系统API补充 + 主方案自动选择 + 风险标记,返回标准 `native_dependency_mapping` + `risk_items` 格式。触发关键词:原生库、三方库、ohpm、替代方案、依赖替代、库替换、native dependency、Android库、iOS库、鸿蒙库。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Native Library Substitution Skill
|
|
7
|
+
|
|
8
|
+
本 Skill 维护 ohpm 仓库的完整三方库映射数据(2678 条映射,852 个唯一安卓库,2537 个唯一鸿蒙包)。
|
|
9
|
+
|
|
10
|
+
## 数据文件
|
|
11
|
+
|
|
12
|
+
| 文件 | 用途 | 数据规模 |
|
|
13
|
+
|------|------|---------|
|
|
14
|
+
| [references/native-library-substitution.json](references/native-library-substitution.json) | 单一映射表(JSON) | 2678 条映射记录 |
|
|
15
|
+
| [references/native-library-substitution.md](references/native-library-substitution.md) | 可读表格(按分类整理) | 按 source_type 和 category 分组 |
|
|
16
|
+
|
|
17
|
+
## 数据结构说明
|
|
18
|
+
|
|
19
|
+
### 单一扁平映射表(mappings)
|
|
20
|
+
|
|
21
|
+
每条记录包含 **15 个字段**,涵盖安卓库和鸿蒙包的完整信息:
|
|
22
|
+
|
|
23
|
+
| 字段 | 类型 | 说明 |
|
|
24
|
+
|------|------|------|
|
|
25
|
+
| `android_lib` | string/null | 安卓库标识符(如 `com.tencent:mmkv`),鸿蒙原生库为 `null` |
|
|
26
|
+
| `android_platform` | string | `android` / `ios` / `ohos_native` |
|
|
27
|
+
| `android_description` | string/null | 安卓库功能描述 |
|
|
28
|
+
| `ohpm_package` | string | 鸿蒙包名(如 `@tencent/mmkv`) |
|
|
29
|
+
| `ohpm_org` | string | ohpm 组织名 |
|
|
30
|
+
| `ohpm_description` | string | 鸿蒙包功能描述 |
|
|
31
|
+
| `ohpm_keywords` | array | 鸿蒙包关键词列表 |
|
|
32
|
+
| `ohpm_repo_url` | string | 鸿蒙包源码仓库地址 |
|
|
33
|
+
| `ohpm_homepage` | string | 鸿蒙包文档主页 |
|
|
34
|
+
| `source_type` | string | `安卓鸿蒙化库` / `TS/JS迁移库` / `鸿蒙原生库` / `C++/C鸿蒙化库` |
|
|
35
|
+
| `source_availability` | string | `COMMERCIAL_PUBLIC`(闭源) / `open_source`(开源) |
|
|
36
|
+
| `confidence` | string | `high` / `medium` / `low` |
|
|
37
|
+
| `install_command` | string | `ohpm install @xxx/yyy` |
|
|
38
|
+
| `category` | string | `media` / `network` / `notification` / `location` / `payment` / `auth` / `storage` / `ui` / `utils` / `other` |
|
|
39
|
+
| `inference_reason` | string | 映射关系说明 |
|
|
40
|
+
|
|
41
|
+
### 记录示例
|
|
42
|
+
|
|
43
|
+
**有安卓库的映射**:
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"android_lib": "com.tencent:mmkv",
|
|
47
|
+
"android_platform": "android",
|
|
48
|
+
"android_description": "腾讯MMKV键值存储",
|
|
49
|
+
"ohpm_package": "@tencent/mmkv",
|
|
50
|
+
"ohpm_org": "tencent",
|
|
51
|
+
"ohpm_description": "MMKV鸿蒙版键值存储组件",
|
|
52
|
+
"ohpm_keywords": ["storage", "mmkv", "key-value"],
|
|
53
|
+
"ohpm_repo_url": "https://gitee.com/openharmony-sig/ohos_mmkv",
|
|
54
|
+
"ohpm_homepage": "https://...",
|
|
55
|
+
"source_type": "安卓鸿蒙化库",
|
|
56
|
+
"source_availability": "COMMERCIAL_PUBLIC",
|
|
57
|
+
"confidence": "high",
|
|
58
|
+
"install_command": "ohpm install @tencent/mmkv",
|
|
59
|
+
"category": "storage",
|
|
60
|
+
"inference_reason": "基于官方工作簿映射,鸿蒙状态:有鸿蒙版"
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**鸿蒙原生库(无安卓库)**:
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"android_lib": null,
|
|
68
|
+
"android_platform": "ohos_native",
|
|
69
|
+
"android_description": null,
|
|
70
|
+
"ohpm_package": "@pura/harmony-utils",
|
|
71
|
+
"ohpm_org": "pura",
|
|
72
|
+
"ohpm_description": "一款功能丰富且极易上手的HarmonyOS工具库...",
|
|
73
|
+
"ohpm_keywords": ["工具类", "图片", "文件"],
|
|
74
|
+
"ohpm_repo_url": "https://gitee.com/tongyuyan/harmony-utils",
|
|
75
|
+
"ohpm_homepage": "https://gitee.com/tongyuyan",
|
|
76
|
+
"source_type": "鸿蒙原生库",
|
|
77
|
+
"source_availability": "open_source",
|
|
78
|
+
"confidence": "low",
|
|
79
|
+
"install_command": "ohpm install @pura/harmony-utils",
|
|
80
|
+
"category": "utils",
|
|
81
|
+
"inference_reason": "鸿蒙原生开发,无对应安卓库"
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 数据统计
|
|
86
|
+
|
|
87
|
+
### 总览
|
|
88
|
+
|
|
89
|
+
| 统计项 | 数量 |
|
|
90
|
+
|--------|------|
|
|
91
|
+
| 总映射数 | 2678 |
|
|
92
|
+
| 有安卓库的映射 | 1005 |
|
|
93
|
+
| 鸿蒙原生库(无安卓库) | 1673 |
|
|
94
|
+
| 唯一安卓库数 | 852 |
|
|
95
|
+
| 唯一鸿蒙包数 | 2537 |
|
|
96
|
+
|
|
97
|
+
### source_availability 分布
|
|
98
|
+
|
|
99
|
+
| 状态 | 数量 | 说明 |
|
|
100
|
+
|------|------|------|
|
|
101
|
+
| COMMERCIAL_PUBLIC | 175 | 闭源商业SDK(来自工作簿) |
|
|
102
|
+
| open_source | 2503 | 开源库 |
|
|
103
|
+
|
|
104
|
+
### source_type 分布
|
|
105
|
+
|
|
106
|
+
| 来源类型 | 数量 | 说明 |
|
|
107
|
+
|----------|------|------|
|
|
108
|
+
| 鸿蒙原生库 | 1321 | 鸿蒙原生开发,无对应安卓库 |
|
|
109
|
+
| TS/JS迁移库 | 790 | 从 npm 生态迁移 |
|
|
110
|
+
| 安卓鸿蒙化库 | 432 | 直接从安卓库移植 |
|
|
111
|
+
| C++/C鸿蒙化库 | 133 | 从 C++ 生态迁移 |
|
|
112
|
+
|
|
113
|
+
### category 分布
|
|
114
|
+
|
|
115
|
+
| Category | 数量 | 说明 |
|
|
116
|
+
|----------|------|------|
|
|
117
|
+
| other | 1527 | 其他 |
|
|
118
|
+
| ui | 370 | UI组件 |
|
|
119
|
+
| utils | 213 | 工具类 |
|
|
120
|
+
| network | 209 | 网络请求 |
|
|
121
|
+
| media | 89 | 音视频 |
|
|
122
|
+
| notification | 60 | 推送通知 |
|
|
123
|
+
| storage | 60 | 存储文件 |
|
|
124
|
+
| auth | 61 | 登录认证 |
|
|
125
|
+
| location | 50 | 地图定位 |
|
|
126
|
+
| analytics | 17 | 统计分析 |
|
|
127
|
+
| payment | 16 | 支付 |
|
|
128
|
+
| security | 4 | 安全加密 |
|
|
129
|
+
| im | 1 | 即时通讯 |
|
|
130
|
+
| social | 1 | 社交分享 |
|
|
131
|
+
|
|
132
|
+
## 检索流程
|
|
133
|
+
|
|
134
|
+
### 场景 1:查找安卓库的鸿蒙替代方案
|
|
135
|
+
|
|
136
|
+
**查询目标**:Android/iOS 原生库 → 鸿蒙替代方案
|
|
137
|
+
|
|
138
|
+
**检索流程**:
|
|
139
|
+
1. 在 `mappings` 中搜索 `android_lib` 字段匹配原生库标识符
|
|
140
|
+
2. 返回所有匹配的记录(按 `confidence` 排序)
|
|
141
|
+
3. 每条记录包含完整的鸿蒙包信息
|
|
142
|
+
|
|
143
|
+
**示例检索代码**:
|
|
144
|
+
```python
|
|
145
|
+
# 查询 com.tencent:mmkv 的所有鸿蒙替代方案
|
|
146
|
+
results = [m for m in mappings if m['android_lib'] == 'com.tencent:mmkv']
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 场景 2:查询鸿蒙包详情(反向查询)
|
|
150
|
+
|
|
151
|
+
**查询目标**:根据鸿蒙包名查询详细信息
|
|
152
|
+
|
|
153
|
+
**检索流程**:
|
|
154
|
+
1. 在 `mappings` 中搜索 `ohpm_package` 字段
|
|
155
|
+
2. 返回所有包含该鸿蒙包的记录(可能对应多个安卓库)
|
|
156
|
+
|
|
157
|
+
**示例检索代码**:
|
|
158
|
+
```python
|
|
159
|
+
# 查询 @tencent/mmkv 的所有映射记录
|
|
160
|
+
results = [m for m in mappings if m['ohpm_package'] == '@tencent/mmkv']
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 场景 3:按分类筛选
|
|
164
|
+
|
|
165
|
+
**查询目标**:筛选特定 category 或 source_type 的映射
|
|
166
|
+
|
|
167
|
+
**检索流程**:
|
|
168
|
+
```python
|
|
169
|
+
# 筛选所有闭源库
|
|
170
|
+
closed_source = [m for m in mappings if m['source_availability'] == 'COMMERCIAL_PUBLIC']
|
|
171
|
+
|
|
172
|
+
# 筛选所有音视频相关库
|
|
173
|
+
media_libs = [m for m in mappings if m['category'] == 'media']
|
|
174
|
+
|
|
175
|
+
# 筛选所有安卓鸿蒙化库
|
|
176
|
+
android_adapted = [m for m in mappings if m['source_type'] == '安卓鸿蒙化库']
|
|
177
|
+
|
|
178
|
+
# 筛选鸿蒙原生库(无安卓库)
|
|
179
|
+
native_libs = [m for m in mappings if m['android_platform'] == 'ohos_native']
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 场景 4:完整工作流模式(Planning Agent 推荐)
|
|
183
|
+
|
|
184
|
+
**查询目标**:原生依赖列表 → 完整的鸿蒙替代方案 + 风险标记
|
|
185
|
+
|
|
186
|
+
**适用场景**:Planning 阶段批量处理原生依赖,需要:
|
|
187
|
+
- 多级检索(本地 → ohpm 仓库 → 全网搜索)
|
|
188
|
+
- 系统API补充查询
|
|
189
|
+
- 主方案自动选择
|
|
190
|
+
- 无方案风险自动标记
|
|
191
|
+
- 辔回标准 `native_dependency_mapping` + `risk_items` 格式
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
#### 4.1 输入格式
|
|
196
|
+
|
|
197
|
+
从 `01-analysis.json` 的 `native_dependencies` 字段读取:
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"android": [
|
|
202
|
+
{ "name": "OkHttp", "identifier": "com.squareup.okhttp3:okhttp", "usage": "网络请求" }
|
|
203
|
+
],
|
|
204
|
+
"ios": [...],
|
|
205
|
+
"cpp": [...]
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### 4.2 完整检索流程(命中即停)
|
|
210
|
+
|
|
211
|
+
**优先级递减**,每级命中后继续执行后续处理步骤:
|
|
212
|
+
|
|
213
|
+
| 优先级 | 检索方式 | 数据源 | 命中条件 |
|
|
214
|
+
|--------|----------|--------|----------|
|
|
215
|
+
| 1 | 本地映射表查询 | `mappings`(本地) | `android_lib` 精确匹配或模糊匹配 |
|
|
216
|
+
| 2 | ohpm 仓库在线搜索 | `https://ohpm.harmonyos.com/#/cn/search?keyword={库名}` | 返回结果非空 |
|
|
217
|
+
| 3 | 全网 Web Search | `{库名} ohpm HarmonyOS 替代` 或 `{库名} HarmonyOS SDK` | 返回结果非空 |
|
|
218
|
+
|
|
219
|
+
**实现方式**:
|
|
220
|
+
|
|
221
|
+
1. **本地检索(优先级 1)**:在 `mappings` 中搜索 `android_lib` 字段
|
|
222
|
+
2. **ohpm 仓库在线搜索(优先级 2)**:
|
|
223
|
+
```
|
|
224
|
+
WebFetch: https://ohpm.harmonyos.com/#/cn/search?keyword={库名}
|
|
225
|
+
解析搜索结果页面,提取 ohpm 包名
|
|
226
|
+
```
|
|
227
|
+
3. **全网 Web Search(优先级 3)**:
|
|
228
|
+
```
|
|
229
|
+
搜索关键词:"{库名} ohpm HarmonyOS 替代" 或 "{库名} HarmonyOS SDK API"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### 4.3 系统API补充查询(必须执行)
|
|
233
|
+
|
|
234
|
+
> **核心规则**:无论是否找到 ohpm 包,都必须查找系统 API 作为补充备选。
|
|
235
|
+
|
|
236
|
+
**查询方式**:调用 Skill
|
|
237
|
+
`harmonyos-docs-lookup`
|
|
238
|
+
`harmonyos-sdk-api-lookup`
|
|
239
|
+
查找 {原生库名} {功能描述} 对应的鸿蒙系统API模块名。
|
|
240
|
+
|
|
241
|
+
**返回结果处理**:
|
|
242
|
+
- 找到系统API:记录为 `alternative_solution`
|
|
243
|
+
- 未找到系统API:`alternative_solution: null`
|
|
244
|
+
|
|
245
|
+
#### 4.4 主方案选择决策(三方库优先)
|
|
246
|
+
|
|
247
|
+
根据检索结果,按以下优先级选择主方案:
|
|
248
|
+
|
|
249
|
+
| 优先级 | source_type | confidence | 主方案类型 | 说明 |
|
|
250
|
+
|--------|-------------|------------|------------|------|
|
|
251
|
+
| 1 | `安卓鸿蒙化库` | `high` | `ohpm_package` | 直接移植,API 设计一致 |
|
|
252
|
+
| 2 | `安卓鸿蒙化库` | `medium` | `ohpm_package` | 直接移植,部分差异 |
|
|
253
|
+
| 3 | `TS/JS迁移库` | `medium` | `ohpm_package` | npm 生态迁移,需适配 |
|
|
254
|
+
| 4 | `C++/C鸿蒙化库` | `medium` | `ohpm_package` | C++ 生态迁移 |
|
|
255
|
+
| 5 | `鸿蒙原生库` | `low` | `ohpm_package` | 鸿蒙原生,无对应安卓库 |
|
|
256
|
+
| 6 | 仅系统API | - | `system_api` | 无 ohpm 包,基于系统API实现 |
|
|
257
|
+
| 7 | 无任何方案 | - | `not_available` | 标记高风险 |
|
|
258
|
+
|
|
259
|
+
**决策逻辑**:
|
|
260
|
+
```
|
|
261
|
+
if (找到 ohpm 包) {
|
|
262
|
+
选择 confidence 最高的 ohpm 包作为主方案
|
|
263
|
+
ohos_solution_type = "ohpm_package"
|
|
264
|
+
} else if (找到系统API) {
|
|
265
|
+
ohos_solution_type = "system_api"
|
|
266
|
+
ohos_module = 系统API模块名
|
|
267
|
+
} else {
|
|
268
|
+
ohos_solution_type = "not_available"
|
|
269
|
+
// 在 risk_items 中标记
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### 4.5 输出格式(Planning Agent 写入 `02-planning.json`)
|
|
274
|
+
|
|
275
|
+
**native_dependency_mapping 条目格式**:
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"original_platform": "android | ios | cpp",
|
|
280
|
+
"original_lib": "原生库标识符(如 com.squareup.okhttp3:okhttp)",
|
|
281
|
+
"original_usage": "在插件中的用途",
|
|
282
|
+
"ohos_solution_type": "ohpm_package | system_api | custom_implementation | not_available",
|
|
283
|
+
"ohos_package": "ohpm 包名(ohpm_package 时填写)| null",
|
|
284
|
+
"ohos_module": "@ohos.xxx(system_api 时填写)| null",
|
|
285
|
+
"install_command": "ohpm install xxx(ohpm_package 时填写)| null",
|
|
286
|
+
"confidence": "high | medium | low",
|
|
287
|
+
"notes": "说明(替代方案的能力覆盖度、已知限制、备选系统API、source_type、source_availability 等摘要)"
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**完整输出示例**:
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"native_dependency_mapping": [
|
|
296
|
+
{
|
|
297
|
+
"original_platform": "android",
|
|
298
|
+
"original_lib": "com.squareup.okhttp3:okhttp",
|
|
299
|
+
"original_usage": "HTTP 网络请求",
|
|
300
|
+
"ohos_solution_type": "ohpm_package",
|
|
301
|
+
"ohos_package": "@ohos/axios",
|
|
302
|
+
"install_command": "ohpm install @ohos/axios",
|
|
303
|
+
"confidence": "medium",
|
|
304
|
+
"notes": "TS/JS迁移库;备选系统 API: @ohos.net.http;source_availability: open_source"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"original_platform": "android",
|
|
308
|
+
"original_lib": "com.tencent:mmkv",
|
|
309
|
+
"original_usage": "键值存储",
|
|
310
|
+
"ohos_solution_type": "ohpm_package",
|
|
311
|
+
"ohos_package": "@tencent/mmkv",
|
|
312
|
+
"install_command": "ohpm install @tencent/mmkv",
|
|
313
|
+
"confidence": "high",
|
|
314
|
+
"notes": "安卓鸿蒙化库,直接移植;source_availability: COMMERCIAL_PUBLIC(闭源)"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"original_platform": "cpp",
|
|
318
|
+
"original_lib": "openssl",
|
|
319
|
+
"original_usage": "加密解密",
|
|
320
|
+
"ohos_solution_type": "system_api",
|
|
321
|
+
"ohos_module": "@ohos.security.cryptoFramework",
|
|
322
|
+
"install_command": null,
|
|
323
|
+
"confidence": "high",
|
|
324
|
+
"notes": "无 ohpm 包,使用系统加密框架"
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"risk_items": [
|
|
328
|
+
{
|
|
329
|
+
"description": "原生库 alipay(android)无鸿蒙替代方案或系统API",
|
|
330
|
+
"severity": "high",
|
|
331
|
+
"mitigation": "评估是否可移除该功能,或使用华为 IAP Kit 替代;阻塞级别:partial"
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
#### 4.6 无方案风险自动标记
|
|
338
|
+
|
|
339
|
+
当 `ohos_solution_type: "not_available"` 时,自动生成 `risk_items` 条目。
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"description": "原生库 {库名}({平台})无鸿蒙替代方案或系统API",
|
|
344
|
+
"severity": "high",
|
|
345
|
+
"mitigation": "评估是否可移除该功能,或使用其他鸿蒙渠道;阻塞级别:partial | full"
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## 来源分类说明
|
|
350
|
+
|
|
351
|
+
| 分类 | 数量 | 占比 | 含义 | 置信度 | source_availability |
|
|
352
|
+
|------|------|------|------|--------|---------------------|
|
|
353
|
+
| `鸿蒙原生库` | 1321 | 49.4% | 鸿蒙原生开发,无对应安卓库 | low | `open_source` |
|
|
354
|
+
| `TS/JS迁移库` | 790 | 29.5% | 从 npm 生态迁移 | medium | `open_source` |
|
|
355
|
+
| `安卓鸿蒙化库` | 432 | 16.1% | 直接从安卓库移植 | high | 部分闭源(175条) |
|
|
356
|
+
| `C++/C鸿蒙化库` | 133 | 5.0% | 从 C++ 生态迁移 | medium | `open_source` |
|
|
357
|
+
|
|
358
|
+
## 常见原生库映射参考
|
|
359
|
+
|
|
360
|
+
| 原生库 | 鸿蒙替代方案 | 来源类型 | 置信度 | 开闭源 | 安装命令 |
|
|
361
|
+
|--------|-------------|---------|--------|--------|----------|
|
|
362
|
+
| OkHttp | @ohos/axios | TS/JS迁移库 | medium | open_source | `ohpm install @ohos/axios` |
|
|
363
|
+
| Retrofit | @ohos/retrofit | 安卓鸿蒙化库 | high | open_source | `ohpm install @ohos/retrofit` |
|
|
364
|
+
| MMKV | @tencent/mmkv | 安卓鸿蒙化库 | high | COMMERCIAL_PUBLIC | `ohpm install @tencent/mmkv` |
|
|
365
|
+
| Glide | @ohos/imageknife | 安卓鸿蒙化库 | high | open_source | `ohpm install @ohos/imageknife` |
|
|
366
|
+
| ARouter | @ohos/arouter | 安卓鸿蒙化库 | high | open_source | `ohpm install @ohos/arouter` |
|
|
367
|
+
| 阿里云推送 | @aliyun/push | 安卓鸿蒙化库 | high | COMMERCIAL_PUBLIC | `ohpm install @aliyun/push` |
|
|
368
|
+
|
|
369
|
+
## 数据完整性保证
|
|
370
|
+
|
|
371
|
+
- ✅ **所有数据完整保留**(2678 条映射记录)
|
|
372
|
+
- ✅ **新增 source_availability 字段**(175 个闭源商业SDK)
|
|
373
|
+
- ✅ **单一扁平结构**:每条记录包含安卓库 + 鸿蒙包完整信息
|
|
374
|
+
- ✅ **支持双向查询**:安卓库 → 鸿蒙包,鸿蒙包 → 安卓库
|
|
375
|
+
|
|
376
|
+
## 数据更新说明
|
|
377
|
+
|
|
378
|
+
- **数据版本**:v3.0.0(结构重构为单一映射表)
|
|
379
|
+
- **更新日期**:2026-04-22
|
|
380
|
+
- **本次重构**:
|
|
381
|
+
- 合并 ohpm_libraries 和 native_library_index 为单一扁平映射表
|
|
382
|
+
- 每条记录包含 15 个字段(安卓库 + 鸿蒙包完整信息)
|
|
383
|
+
- 鸿蒙原生库(无安卓库)保留,标记为 `ohos_native`
|
|
384
|
+
- source_availability 字段:175 条闭源库 + 2503 条开源库
|
|
385
|
+
- 简化检索逻辑:单表查询替代双向索引
|