@harmonyos-arkts/d2h 0.0.0-stage → 0.1.1
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 +177 -2
- package/agents/android-to-hmos-00-orchestrator.md +312 -0
- package/agents/d2h.md +168 -0
- package/bin/install-opencode.mjs +57 -0
- package/install-opencode.sh +160 -0
- package/opencode/agents.json +16 -0
- package/package.json +43 -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 +110 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://harmonyos-ai.dev/skills/appgraph-rule-audit/schemas/rule-opportunities.schema.json",
|
|
4
|
+
"title": "AppGraph rule improvement opportunities",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["schemaVersion", "skillVersion", "source", "summary", "opportunities", "acceptedLimitations", "auditWarnings"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"schemaVersion": { "const": "1.0.0" },
|
|
9
|
+
"skillVersion": { "const": "1.0.0" },
|
|
10
|
+
"source": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"required": ["project", "sourceRevision", "factsSha256", "appGraphVersion", "rulePacks"],
|
|
13
|
+
"properties": {
|
|
14
|
+
"project": { "type": "string", "minLength": 1 },
|
|
15
|
+
"sourceRevision": { "type": ["string", "null"] },
|
|
16
|
+
"factsSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
|
17
|
+
"appGraphVersion": { "type": ["string", "null"] },
|
|
18
|
+
"rulePacks": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
|
|
19
|
+
},
|
|
20
|
+
"additionalProperties": false
|
|
21
|
+
},
|
|
22
|
+
"summary": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["conclusion", "pages", "navigation", "hosts", "unresolved", "coverageWarnings"],
|
|
25
|
+
"properties": {
|
|
26
|
+
"conclusion": { "type": "string" },
|
|
27
|
+
"pages": { "type": "integer", "minimum": 0 },
|
|
28
|
+
"navigation": { "type": "integer", "minimum": 0 },
|
|
29
|
+
"hosts": { "type": "integer", "minimum": 0 },
|
|
30
|
+
"unresolved": { "type": "integer", "minimum": 0 },
|
|
31
|
+
"coverageWarnings": { "type": "integer", "minimum": 0 }
|
|
32
|
+
},
|
|
33
|
+
"additionalProperties": false
|
|
34
|
+
},
|
|
35
|
+
"opportunities": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/opportunity" } },
|
|
36
|
+
"acceptedLimitations": { "type": "array", "items": { "$ref": "#/$defs/limitation" } },
|
|
37
|
+
"auditWarnings": { "type": "array", "items": { "type": "string", "minLength": 1 } }
|
|
38
|
+
},
|
|
39
|
+
"$defs": {
|
|
40
|
+
"level": { "enum": ["high", "medium", "low"] },
|
|
41
|
+
"evidence": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"required": ["role", "file", "line", "symbol", "entityRefs", "ruleIds", "observation"],
|
|
44
|
+
"properties": {
|
|
45
|
+
"role": { "enum": ["positive", "negative", "boundary", "ambiguous"] },
|
|
46
|
+
"file": { "type": "string", "minLength": 1 },
|
|
47
|
+
"line": { "type": ["integer", "null"], "minimum": 1 },
|
|
48
|
+
"symbol": { "type": ["string", "null"] },
|
|
49
|
+
"entityRefs": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
50
|
+
"ruleIds": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
51
|
+
"observation": { "type": "string", "minLength": 1 }
|
|
52
|
+
},
|
|
53
|
+
"additionalProperties": false
|
|
54
|
+
},
|
|
55
|
+
"ratedReason": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": ["level", "reason"],
|
|
58
|
+
"properties": { "level": { "$ref": "#/$defs/level" }, "reason": { "type": "string", "minLength": 1 } },
|
|
59
|
+
"additionalProperties": false
|
|
60
|
+
},
|
|
61
|
+
"metricDelta": {
|
|
62
|
+
"type": "object",
|
|
63
|
+
"required": ["pages", "navigation", "hosts", "unresolved", "falsePositives"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"pages": { "enum": ["increase", "decrease", "unchanged", "unknown"] },
|
|
66
|
+
"navigation": { "enum": ["increase", "decrease", "unchanged", "unknown"] },
|
|
67
|
+
"hosts": { "enum": ["increase", "decrease", "unchanged", "unknown"] },
|
|
68
|
+
"unresolved": { "enum": ["increase", "decrease", "unchanged", "unknown"] },
|
|
69
|
+
"falsePositives": { "enum": ["increase", "decrease", "unchanged", "unknown"] }
|
|
70
|
+
},
|
|
71
|
+
"additionalProperties": false
|
|
72
|
+
},
|
|
73
|
+
"opportunity": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"required": ["id", "priority", "category", "scope", "title", "frameworkIdentity", "observation", "rootCause", "expectedBehavior", "affectedEntities", "evidence", "proposal", "confidence", "generality", "risk", "testPlan", "expectedMetricDelta", "status"],
|
|
76
|
+
"properties": {
|
|
77
|
+
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]+$" },
|
|
78
|
+
"priority": { "enum": ["P0", "P1", "P2"] },
|
|
79
|
+
"category": { "enum": ["analyzer-gap", "judge-gap", "lift-gap", "spec-gap", "host-gap", "false-positive", "performance"] },
|
|
80
|
+
"scope": { "enum": ["builtin-generic", "framework-pack", "project-pack"] },
|
|
81
|
+
"title": { "type": "string", "minLength": 1 },
|
|
82
|
+
"frameworkIdentity": { "type": "string", "minLength": 1 },
|
|
83
|
+
"observation": { "type": "string", "minLength": 1 },
|
|
84
|
+
"rootCause": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"required": ["certainty", "description"],
|
|
87
|
+
"properties": { "certainty": { "enum": ["confirmed", "hypothesis"] }, "description": { "type": "string", "minLength": 1 } },
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
},
|
|
90
|
+
"expectedBehavior": { "type": "string", "minLength": 1 },
|
|
91
|
+
"affectedEntities": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
92
|
+
"evidence": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/evidence" } },
|
|
93
|
+
"proposal": {
|
|
94
|
+
"type": "object",
|
|
95
|
+
"required": ["layer", "ruleShape", "likelyFilesOrRules"],
|
|
96
|
+
"properties": {
|
|
97
|
+
"layer": { "enum": ["Analyzer", "Judge", "Lift", "SPEC", "Host", "Performance"] },
|
|
98
|
+
"ruleShape": { "type": "string", "minLength": 1 },
|
|
99
|
+
"likelyFilesOrRules": { "type": "array", "uniqueItems": true, "items": { "type": "string", "minLength": 1 } }
|
|
100
|
+
},
|
|
101
|
+
"additionalProperties": false
|
|
102
|
+
},
|
|
103
|
+
"confidence": { "$ref": "#/$defs/ratedReason" },
|
|
104
|
+
"generality": { "$ref": "#/$defs/ratedReason" },
|
|
105
|
+
"risk": { "$ref": "#/$defs/ratedReason" },
|
|
106
|
+
"testPlan": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } },
|
|
107
|
+
"expectedMetricDelta": { "$ref": "#/$defs/metricDelta" },
|
|
108
|
+
"status": { "const": "proposed" }
|
|
109
|
+
},
|
|
110
|
+
"additionalProperties": false
|
|
111
|
+
},
|
|
112
|
+
"limitation": {
|
|
113
|
+
"type": "object",
|
|
114
|
+
"required": ["id", "reason", "evidence", "requiredEvidence"],
|
|
115
|
+
"properties": {
|
|
116
|
+
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]+$" },
|
|
117
|
+
"reason": { "type": "string", "minLength": 1 },
|
|
118
|
+
"evidence": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/evidence" } },
|
|
119
|
+
"requiredEvidence": { "type": "string", "minLength": 1 }
|
|
120
|
+
},
|
|
121
|
+
"additionalProperties": false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"additionalProperties": false
|
|
125
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkts-app-identity
|
|
3
|
+
description: >-
|
|
4
|
+
Android App 身份信息迁移到 HarmonyOS:App 名称(label)、图标(含 layered_image.json 分层自适应图标)、版本号(versionName/versionCode)、包名/厂商(app.json5 的 bundleName/vendor)。当用户需要迁移这些身份字段、或发现 app.json5 中 bundleName/vendor/versionName 仍是模板默认值时触发,从 AndroidManifest.xml / build.gradle 提取原值。即使只说"app 名字不对""图标没迁移""包名还是默认的"也应触发。不处理全量资源迁移(用 android2hmos_resources_convert)、运行时权限或深度链接。
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ArkTS App Identity — 应用身份迁移
|
|
8
|
+
|
|
9
|
+
## 定位
|
|
10
|
+
|
|
11
|
+
从当前 Android 源码提取 App 身份信息(名称、图标、版本号、包名),更新现有 HarmonyOS 工程。也可以在缺少 Android 源码时诊断模板值或按调用方提供的权威值修复,但必须标明缺失的源码依据。
|
|
12
|
+
|
|
13
|
+
根据用户请求和当前工作区确定范围,没有固定 Plan、Stage 或 Task 编号。始终执行同一套身份提取、写入和审计流程,并返回统一领域结果;不识别或修改外部编排状态。
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Android 项目 → [本 skill] → app.json5 + string.json + 图标资源
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 输入
|
|
22
|
+
|
|
23
|
+
| 项 | 内容 |
|
|
24
|
+
|----|------|
|
|
25
|
+
| **必须** | 要更新的 HarmonyOS 工程路径;未显式给出时可从当前工作区定位 |
|
|
26
|
+
| **写入时至少一项** | Android 项目根路径,或调用方明确提供的权威身份值;仅诊断模板问题时可以缺省并返回依据缺口 |
|
|
27
|
+
| **可选** | `scope`:`full`(默认)/ `dev-identity`(仅在签名或 AGC 外部依赖未满足时暂缓 bundleName/vendor,并返回未解决项) |
|
|
28
|
+
|
|
29
|
+
自动定位以下文件:
|
|
30
|
+
- `app/src/main/AndroidManifest.xml`(或扫描 `**/AndroidManifest.xml`)
|
|
31
|
+
- `app/build.gradle` 或 `app/build.gradle.kts`
|
|
32
|
+
- `**/res/values/strings.xml`(或 `common.gradle` 中的 `resValue`)
|
|
33
|
+
- `**/res/mipmap-xxxhdpi/ic_launcher*.png`
|
|
34
|
+
- `**/res/mipmap-anydpi-v26/ic_launcher.xml`(自适应图标定义)
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 输出
|
|
39
|
+
|
|
40
|
+
| 文件 | 内容 | 说明 |
|
|
41
|
+
|------|------|------|
|
|
42
|
+
| `AppScope/app.json5` | bundleName, vendor, versionCode, versionName, icon, label | 更新已有文件,不覆盖无关字段 |
|
|
43
|
+
| `AppScope/resources/base/element/string.json` | app_name 字段 | 更新 app_name 值 |
|
|
44
|
+
| `AppScope/resources/base/media/foreground.png` | 前景图标 | 从 Android xxxhdpi 提取 |
|
|
45
|
+
| `AppScope/resources/base/media/background.png` | 背景图标 | 从 Android xxxhdpi 提取 |
|
|
46
|
+
| `AppScope/resources/base/media/layered_image.json` | 自适应图标配置 | 生成或验证 |
|
|
47
|
+
| `entry/src/main/resources/base/media/startIcon.png` | 启动图标 | 复制 foreground 或 ic_launcher |
|
|
48
|
+
| `entry/src/main/resources/base/element/string.json` | EntryAbility_label | 更新为 app_name |
|
|
49
|
+
| 统一领域结果 | Android 原值、HarmonyOS 填充值、修改文件、未解决项和后续验证请求 | 返回调用方 |
|
|
50
|
+
|
|
51
|
+
返回结果至少包含:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"status": "completed | partial | failed",
|
|
56
|
+
"changedFiles": [],
|
|
57
|
+
"sourceFiles": [],
|
|
58
|
+
"evidence": [],
|
|
59
|
+
"domainChecks": [{"name": "", "status": "passed | failed", "evidence": []}],
|
|
60
|
+
"unresolved": [{"kind": "", "blocking": true, "location": "", "reason": ""}],
|
|
61
|
+
"verificationRequests": [{"type": "build | test | device | review", "scope": [], "reason": ""}],
|
|
62
|
+
"suggestedRemediation": [],
|
|
63
|
+
"details": {"mappings": []}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`status` 只表示本 Skill 的领域工作状态,不表示工程已构建、设备已验证或迁移已完成。证据充分时直接完成确定性映射;源码缺失、多 flavor 无法确定或签名/AGC 存在真实分歧时写入 `unresolved`。需要构建、安装启动或设备核对应用身份时写入 `verificationRequests`,不在本 Skill 内决定如何执行。
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 核心映射规则
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Android → HarmonyOS
|
|
75
|
+
──────────────────────────────────────────────────────
|
|
76
|
+
applicationId → bundleName
|
|
77
|
+
规则: 默认保持真实 applicationId;不得无证据改写包名前缀
|
|
78
|
+
例外: HarmonyOS 格式、签名或 AGC 约束不允许时,记录差异和外部依赖
|
|
79
|
+
|
|
80
|
+
android:label / app_name (string) → app.json5 label ($string:app_name)
|
|
81
|
+
规则: 从 strings.xml 或 build.gradle resValue 解析真实值
|
|
82
|
+
|
|
83
|
+
versionName → versionName
|
|
84
|
+
规则: 保持一致
|
|
85
|
+
|
|
86
|
+
versionCode → versionCode
|
|
87
|
+
规则: 保持一致
|
|
88
|
+
|
|
89
|
+
namespace / applicationId 的组织名 → vendor
|
|
90
|
+
规则: 提取第二段 (com.example.app → example)
|
|
91
|
+
|
|
92
|
+
mipmap-xxxhdpi/ic_launcher.png → foreground.png
|
|
93
|
+
规则: 优先 xxxhdpi,降级到 xxhdpi/xhdpi
|
|
94
|
+
|
|
95
|
+
ic_launcher_background.png → background.png
|
|
96
|
+
规则: 优先 xxxhdpi,如不存在生成纯色 PNG
|
|
97
|
+
|
|
98
|
+
adaptive-icon XML (ic_launcher.xml) → layered_image.json
|
|
99
|
+
格式: { "layered-image": { "background": "$media:background", "foreground": "$media:foreground" } }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 工作流程
|
|
105
|
+
|
|
106
|
+
### Step 1: 提取 Android 身份信息
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
1. Read AndroidManifest.xml
|
|
110
|
+
→ 提取 android:label (通常是 @string/app_name)
|
|
111
|
+
→ 提取 android:icon (通常是 @mipmap/ic_launcher)
|
|
112
|
+
|
|
113
|
+
2. Read build.gradle / build.gradle.kts
|
|
114
|
+
→ 提取 applicationId / namespace
|
|
115
|
+
→ 提取 versionName, versionCode
|
|
116
|
+
→ 检查 buildTypes 中的 resValue (动态 app_name)
|
|
117
|
+
|
|
118
|
+
3. Read strings.xml (如果 label 是 @string 引用)
|
|
119
|
+
→ 解析 app_name 的实际文本值
|
|
120
|
+
→ 如果 build.gradle 有 resValue 覆盖,使用 release buildType 的值
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Step 2: 提取图标资源
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
4. 定位图标文件
|
|
127
|
+
优先级: mipmap-xxxhdpi > mipmap-xxhdpi > mipmap-xhdpi > mipmap-hdpi
|
|
128
|
+
文件: ic_launcher.png, ic_launcher_foreground.png, ic_launcher_background.png
|
|
129
|
+
|
|
130
|
+
5. 检查自适应图标
|
|
131
|
+
文件: mipmap-anydpi-v26/ic_launcher.xml
|
|
132
|
+
如果存在:
|
|
133
|
+
→ 解析 <foreground android:drawable="@xxx"/>
|
|
134
|
+
→ 解析 <background android:drawable="@xxx"/>
|
|
135
|
+
→ 定位对应的 PNG 文件
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Step 3: 生成 HarmonyOS 配置
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
6. 更新 AppScope/app.json5
|
|
142
|
+
仅更新以下字段(保留其他字段不变):
|
|
143
|
+
- versionCode: 保持
|
|
144
|
+
- versionName: 保持
|
|
145
|
+
- icon: "$media:layered_image" (不变)
|
|
146
|
+
- label: "$string:app_name" (不变)
|
|
147
|
+
- bundleName: 从 applicationId 映射 ⚠️ 仅 scope=full
|
|
148
|
+
- vendor: 从 namespace 提取组织名 ⚠️ 仅 scope=full
|
|
149
|
+
|
|
150
|
+
> **scope=dev-identity**:仅当当前环境已有证据表明签名或 AGC 是外部依赖、且修改
|
|
151
|
+
> bundleName/vendor 会使当前可验证工程失效时使用。跳过的字段必须返回到 `unresolved`,
|
|
152
|
+
> 保持未完成状态;不得把模板值当作最终迁移结果。app_name、versionName、versionCode
|
|
153
|
+
> 和图标等不依赖签名的身份字段仍需正常迁移。
|
|
154
|
+
|
|
155
|
+
7. 更新 AppScope/resources/base/element/string.json
|
|
156
|
+
更新 app_name 的 value 字段
|
|
157
|
+
|
|
158
|
+
8. 复制图标文件
|
|
159
|
+
- foreground.png → AppScope/resources/base/media/foreground.png
|
|
160
|
+
- background.png → AppScope/resources/base/media/background.png
|
|
161
|
+
- ic_launcher.png → entry/src/main/resources/base/media/startIcon.png
|
|
162
|
+
- ic_launcher.png → entry/src/main/resources/base/media/ic_launcher.png (如存在)
|
|
163
|
+
|
|
164
|
+
9. 生成/验证 layered_image.json
|
|
165
|
+
确保内容为:
|
|
166
|
+
{
|
|
167
|
+
"layered-image": {
|
|
168
|
+
"background": "$media:background",
|
|
169
|
+
"foreground": "$media:foreground"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
10. 更新 entry/src/main/resources/base/element/string.json
|
|
174
|
+
更新 EntryAbility_label 的 value 与 app_name 一致
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Step 4: 返回映射结果
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
11. 输出对照表:
|
|
181
|
+
| 字段 | Android 原值 | HarmonyOS 填充值 |
|
|
182
|
+
|------|-------------|-----------------|
|
|
183
|
+
| 应用名称 | AntennaPod | AntennaPod |
|
|
184
|
+
| 包名 | de.danoeh.antennapod | de.danoeh.antennapod |
|
|
185
|
+
| 版本号 | 3.11.0 | 3.11.0 |
|
|
186
|
+
| 版本码 | 3110095 | 3110095 |
|
|
187
|
+
| 厂商 | danoeh | danoeh |
|
|
188
|
+
| 图标 | mipmap-xxxhdpi/ic_launcher.png | foreground.png (XXkb) |
|
|
189
|
+
|
|
190
|
+
若 bundleName 因格式、签名或 AGC 约束不能直接采用,写入 unresolved;
|
|
191
|
+
普通可确定映射不询问用户。
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 边界情况处理
|
|
197
|
+
|
|
198
|
+
| 场景 | 处理方式 |
|
|
199
|
+
|------|---------|
|
|
200
|
+
| 多模块项目,icon 在子模块 | 从 AndroidManifest.xml 追踪 icon 引用,跨模块定位 |
|
|
201
|
+
| build.gradle.kts (Kotlin DSL) | 同时支持 Groovy 和 KTS 语法解析 |
|
|
202
|
+
| 无 adaptive-icon (API < 26) | 只有单个 ic_launcher.png → 复制为 foreground.png,生成纯白 background.png |
|
|
203
|
+
| app_name 在 build.gradle resValue 中动态定义 | 优先使用 release buildType 的 resValue |
|
|
204
|
+
| 多 flavor 的 applicationId | 根据当前选择的构建变体和 Manifest/Gradle 合并结果选择;无法确定时返回 unresolved,不猜默认值 |
|
|
205
|
+
| 调用方已提供身份摘要 | 只把摘要用于定位;有 Android 工程时仍读取当前 AndroidManifest、Gradle 和资源源码 |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## 可选领域协作
|
|
210
|
+
|
|
211
|
+
下列能力存在时可以协作,但不改变本 Skill 的输入、流程或统一结果:
|
|
212
|
+
|
|
213
|
+
| 协作对象 | 关系 |
|
|
214
|
+
|---------|------|
|
|
215
|
+
| `android2hmos_resources_convert` | 它处理全量资源,本 skill 只处理 app 级身份资源 |
|
|
216
|
+
| `arkts-i18n` | app_name 等用户可见字符串的多语言资源由它校验 |
|
|
217
|
+
|
|
218
|
+
本 Skill 不更新迁移报告、不创建 checkpoint、不调用 `complete`,也不暂存或提交工作区;所有外层动作只能由调用方根据统一结果决定。
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 触发 Prompt 示例
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
迁移 app 图标
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
app 名字不对
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
配置应用信息
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
bundleName 还是默认的
|
|
238
|
+
```
|