android2harmony 0.1.4 → 0.1.6
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/README.md +1 -407
- package/agents/self-tester.md +55 -376
- package/dist/index.js +238 -124
- package/dist/index.js.map +4 -4
- package/package.json +36 -32
- package/skills/a2h-resource-convert/SKILL.md +931 -0
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +335 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/conversion-rules.md +15 -2
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/dependency-analysis-rules.md +24 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +219 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/resource-mapping-rules.md +27 -2
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/xml-drawable-to-svg-rules.md +118 -1
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.js +2186 -0
- package/skills/a2h-resource-convert/scripts/app_identity.js +741 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.js +607 -0
- package/skills/a2h-resource-convert/scripts/package.json +3 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.js +632 -0
- package/skills/a2h-ui-transfer/SKILL.md +431 -0
- package/skills/a2h-ui-transfer/references/conversion-procedure.md +547 -0
- package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +1 -1
- package/skills/a2h-ui-transfer/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +133 -0
- package/skills/{hmos-batch-ui-align/scripts/android_parse_fast.ts → a2h-ui-transfer/scripts/android_parse_fast.js} +532 -301
- package/skills/a2h-ui-transfer/scripts/arkts_static_check.js +1624 -0
- package/skills/a2h-ui-transfer/scripts/measure_pack.js +1005 -0
- package/skills/a2h-ui-transfer/scripts/package.json +3 -0
- package/skills/hmos-fix-build-errors/SKILL.md +1 -1
- package/skills/hmos-incremental-ui-align/README.md +15 -15
- package/skills/hmos-incremental-ui-align/SKILL.md +15 -15
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +2 -2
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.js +790 -0
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.js +285 -0
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +76 -76
- package/skills/hmos-incremental-ui-align/scripts/page_capture.js +756 -0
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.js +155 -0
- package/skills/hmos-integration-test/README.md +341 -0
- package/skills/hmos-integration-test/SKILL.md +446 -0
- package/skills/hmos-integration-test/scripts/report-tool.mjs +646 -0
- package/skills/hmos-integration-test/scripts/resolve-metadata-tool.mjs +147 -0
- package/skills/hmos-integration-test/scripts/self-test-runner.mjs +1006 -0
- package/skills/hmos-integration-test/scripts/testcases-tool.mjs +189 -0
- package/skills/hmos-spec-generate/SKILL.md +26 -24
- package/skills/hmos-spec-generate/scripts/parse_requirements.ts +515 -0
- package/skills/hmos-spec-generate/template/REQ.txt +22 -0
- package/skills/hmos-spec-generate/template/REQ.xlsx +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +0 -141
- package/skills/hmos-batch-ui-align/references/conversion-procedure.md +0 -217
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +0 -999
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +0 -343
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +0 -977
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +0 -188
- package/skills/hmos-resources-convert/SKILL.md +0 -654
- package/skills/hmos-resources-convert/template/AppScope/app.json5 +0 -10
- package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +0 -8
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +0 -7
- package/skills/hmos-resources-convert/template/build-profile.json5 +0 -42
- package/skills/hmos-resources-convert/template/code-linter.json5 +0 -32
- package/skills/hmos-resources-convert/template/entry/build-profile.json5 +0 -33
- package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +0 -6
- package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +0 -23
- package/skills/hmos-resources-convert/template/entry/oh-package.json5 +0 -10
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +0 -48
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +0 -16
- package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +0 -23
- package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +0 -55
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +0 -16
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +0 -7
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +0 -3
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +0 -5
- package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +0 -2
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +0 -35
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +0 -5
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +0 -16
- package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +0 -5
- package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +0 -33
- package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +0 -23
- package/skills/hmos-resources-convert/template/hvigorfile.ts +0 -6
- package/skills/hmos-resources-convert/template/oh-package-lock.json5 +0 -28
- package/skills/hmos-resources-convert/template/oh-package.json5 +0 -10
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-ui-transfer}/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" +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hmos-fix-build-errors
|
|
3
|
-
description: Build a HarmonyOS project via CLI and automatically fix compile errors in a loop until the build succeeds. Default unsigned HAP; pass --signed to build a signed HAP (signing config must already exist in the project's build-profile.json5).
|
|
3
|
+
description: Build a HarmonyOS project via CLI and automatically fix compile errors in a loop until the build succeeds. Default unsigned HAP; pass --signed to build a signed HAP (signing config must already exist in the project's build-profile.json5). Allowed to be called only in Android-to-HarmonyOS migration scenarios.
|
|
4
4
|
argument-hint: <harmony_project_dir> [deveco-studio-path] [--signed]
|
|
5
5
|
allowed-tools: Agent, Read, Write, Edit, Glob, Grep, Bash
|
|
6
6
|
type: tool
|
|
@@ -31,10 +31,10 @@ HarmonyOS-Android UI 自动对齐流水线。
|
|
|
31
31
|
- 两台设备建议都保持亮屏解锁
|
|
32
32
|
|
|
33
33
|
2. **运行时依赖**
|
|
34
|
-
- 采集脚本 `page_capture.
|
|
34
|
+
- 采集脚本 `page_capture.js` 与寻路脚本 `app_feature_verify.js` 为零第三方依赖的 Node 脚本(`.js` 即源码、零编译、`node` 直跑;路径在不在 `node_modules` 下都能跑,无原生剥类型问题)。确认 `node --version`(≥ 22.18)即可,无需 Python / uv。
|
|
35
35
|
|
|
36
36
|
3. **模型配置**(寻路导航用)
|
|
37
|
-
与自测共用同一个多模态模型。插件场景下由 `a2h_app_feature_verify`
|
|
37
|
+
与自测共用同一个多模态模型。插件场景下由 `a2h_app_feature_verify` 工具(参数为顶层字段、key 注入由工具处理:key 从 host 解析、经 stdin 注入 `app_feature_verify.js`、不进环境变量、不泄露给 adb/hdc 子进程),无需单独配置。直接 `node` 运行(调试)时:`ht init` 把模型四要素写入 `~/.hometrans/config.json` 的 `autotest.unified_model`(并导出 `HOMETRANS_MODEL_*` 环境变量),脚本优先读 stdin → `--api-key` → 环境变量 → config.json;都没有时兼容老版本 `GLM_API_KEY`(走智谱 GLM 端点)。
|
|
38
38
|
|
|
39
39
|
4. **鸿蒙 SDK 路径**(给改码阶段查 API 用)
|
|
40
40
|
取自 OS 环境变量 `OHOS_SDK_PATH` / `HMS_SDK_PATH`(为空时由 `DEVECO_SDK_HOME` 派生),由 `ht init` 写入机器环境变量;例如 DevEco Studio 自带的 `E:\DevEco Studio\sdk\default\openharmony\ets`。
|
|
@@ -122,10 +122,10 @@ skill 会严格按 `SKILL.md` 里的流水线跑:
|
|
|
122
122
|
|
|
123
123
|
### Step 1 · 双端页面采集
|
|
124
124
|
1.1 解析你的需求,拆成一组「基础页」,每个基础页有 `android_nav_path` 和 `hmos_nav_path`
|
|
125
|
-
1.2 对每个基础页,两端分别:`app_feature_verify.
|
|
125
|
+
1.2 对每个基础页,两端分别:`app_feature_verify.js` 寻路 → 成功后 `page_capture.js` 截图 + dump view tree
|
|
126
126
|
1.3 扫描基础页 view tree,发现 tab、弹窗、下拉等交互元素,自动对每个子状态再采集一遍
|
|
127
127
|
1.4 扫描安卓源码里的动画/Toast/语音传感器等 API,产出 `dynamic_ui_inventory.md`(截图和 view tree 抓不到这些效果)
|
|
128
|
-
1.5 识别多状态组件(如语音输入的 idle/recording/cancelling),读源码建 `state_model.md`,用 `page_capture_burst.
|
|
128
|
+
1.5 识别多状态组件(如语音输入的 idle/recording/cancelling),读源码建 `state_model.md`,用 `page_capture_burst.js` 连续采帧捕捉每个状态的代表帧
|
|
129
129
|
1.6 鸿蒙端页面不存在时,寻路会失败,对应目录留空(Step 2 会改从源码读)
|
|
130
130
|
|
|
131
131
|
产物目录结构:
|
|
@@ -156,7 +156,7 @@ skill 会严格按 `SKILL.md` 里的流水线跑:
|
|
|
156
156
|
所有尺寸都会以 `126px (3.0x → 42vp)` 的格式同时给出原始 px、**从各自 `meta.json` 读到的真实设备密度**、换算后的 vp(不再假设固定 3x)。
|
|
157
157
|
|
|
158
158
|
### Step 3 · 改鸿蒙源码
|
|
159
|
-
- 跑 `node ./scripts/extract_checklist.
|
|
159
|
+
- 跑 `node ./scripts/extract_checklist.js --task-dir "{task_dir}"` 确定性地从所有 `UI_comparison.md` 抽取 diff 项,生成 `{task_dir}/fix_checklist.md`(唯一 source of truth),并核对脚本输出的 `items >= diff_rows` 对账报告,避免人工枚举漏项
|
|
160
160
|
- 先探测工程状态管理范式(V1/V2,工程级判定一次):新工程/0→1 转换默认 V2,已有 V1 的工程沿用 V1
|
|
161
161
|
- 按范式读对应文档:V1 读 `references/MVVM开发文档/`,V2 读 `references/MVVM开发文档V2/`(详见 `references/MVVM开发文档V2/_范式选择说明.md`)
|
|
162
162
|
- 读 `page_align.md` 学习转换规则
|
|
@@ -177,10 +177,10 @@ skills/hmos-incremental-ui-align/
|
|
|
177
177
|
├── page_align.md # Step 3 的转换规则
|
|
178
178
|
├── diff_analysis.md # 内部说明
|
|
179
179
|
├── scripts/
|
|
180
|
-
│ ├── app_feature_verify.
|
|
181
|
-
│ ├── page_capture.
|
|
182
|
-
│ ├── page_capture_burst.
|
|
183
|
-
│ ├── extract_checklist.
|
|
180
|
+
│ ├── app_feature_verify.js # 寻路工具(.js 源码,Node 直跑)
|
|
181
|
+
│ ├── page_capture.js # view tree + 截图采集工具(.js 源码,Node 直跑,含密度换算)
|
|
182
|
+
│ ├── page_capture_burst.js # 连续帧采集工具(多状态组件用,.js 源码,Node 直跑)
|
|
183
|
+
│ ├── extract_checklist.js # 确定性 diff→checklist 抽取工具(.js 源码,Node 直跑)
|
|
184
184
|
│ └── navigation-capure.md # 各脚本的调用约定
|
|
185
185
|
└── references/
|
|
186
186
|
├── UI_Analysis_Template.md # Step 2 分析模板(含动态UI/多状态章节)
|
|
@@ -197,19 +197,19 @@ skills/hmos-incremental-ui-align/
|
|
|
197
197
|
|
|
198
198
|
## 单独运行脚本(调试用)
|
|
199
199
|
|
|
200
|
-
跳过 skill 手动跑采集(直接 `node` 运行不经工具,模型 key 需来自 `~/.hometrans/config.json` 的 `autotest.unified_model` 或 `HOMETRANS_MODEL_*` 环境变量;插件场景应改用 `a2h_app_feature_verify`
|
|
200
|
+
跳过 skill 手动跑采集(直接 `node` 运行不经工具,模型 key 需来自 `~/.hometrans/config.json` 的 `autotest.unified_model` 或 `HOMETRANS_MODEL_*` 环境变量;插件场景应改用 `a2h_app_feature_verify` 工具,参数与 key 注入由工具处理):
|
|
201
201
|
|
|
202
202
|
```powershell
|
|
203
|
-
#
|
|
204
|
-
node
|
|
203
|
+
# 安卓寻路(.js 源码,`node …/app_feature_verify.js` 直跑)
|
|
204
|
+
node skills/hmos-incremental-ui-align/scripts/app_feature_verify.js `
|
|
205
205
|
--device adb `
|
|
206
206
|
--app "Salt Player" `
|
|
207
207
|
--package "com.salt.music" `
|
|
208
208
|
--prompt "进入首页-点击AI智能填报-点击专业筛选按钮" `
|
|
209
209
|
--max-steps 15
|
|
210
210
|
|
|
211
|
-
#
|
|
212
|
-
node
|
|
211
|
+
# 安卓采集(.js 源码,`node …/page_capture.js` 直跑)
|
|
212
|
+
node skills/hmos-incremental-ui-align/scripts/page_capture.js --device adb -o ./tmp/android_page_1_xxx
|
|
213
213
|
|
|
214
214
|
# 鸿蒙同理,把 --device adb 换成 --device hdc
|
|
215
215
|
```
|
|
@@ -239,7 +239,7 @@ A: 目前流水线是端到端的。如果只想要分析产物,跑完 Step 2
|
|
|
239
239
|
A: 能。Step 1.4 会扫描安卓源码里的动画/Toast/语音传感器 API,产出 `dynamic_ui_inventory.md`;Step 2.3 会生成对应的「Dynamic / Transient UI Comparison」diff 表;Step 3 逐条修复时会写入真实的 ArkUI `animateTo()` / `promptAction.showToast()` 等实现。
|
|
240
240
|
|
|
241
241
|
**Q: 像"按住说话"这种有多个状态的组件怎么对齐?**
|
|
242
|
-
A: Step 1.5 会先建 `state_model.md`(状态枚举 + 转移条件 + 每状态属性,均需溯源到源码行号),再用 `page_capture_burst.
|
|
242
|
+
A: Step 1.5 会先建 `state_model.md`(状态枚举 + 转移条件 + 每状态属性,均需溯源到源码行号),再用 `page_capture_burst.js` 连续采帧抓每个状态的代表帧。单击、松开长按等手势可自动触发;长按保持/拖拽/语音等手势需要人工在设备上操作,skill 会打印操作说明等你确认。
|
|
243
243
|
|
|
244
244
|
---
|
|
245
245
|
|
|
@@ -16,11 +16,11 @@ You are writing ArkTS codes.
|
|
|
16
16
|
- If mock data is required, write them in `{harmony_project_dir}/entry/src/main/ets/model/` according to the hmos MVVM mode (V1 or V2, per the paradigm detected in Step 3.1).
|
|
17
17
|
- Do not make any other changes unrelated to the user's requirements.
|
|
18
18
|
|
|
19
|
-
**Skill scripts** (
|
|
20
|
-
- `navigation_tool` = `./scripts/app_feature_verify.
|
|
21
|
-
- `capture_tool` = `./scripts/page_capture.
|
|
22
|
-
- `burst_capture_tool` = `./scripts/page_capture_burst.
|
|
23
|
-
- `checklist_tool` = `./scripts/extract_checklist.
|
|
19
|
+
**Skill scripts** (`.js` sources, run with `node`; no build step, no third-party deps; all paths relative to this skill's root):
|
|
20
|
+
- `navigation_tool` = `./scripts/app_feature_verify.js`
|
|
21
|
+
- `capture_tool` = `./scripts/page_capture.js`
|
|
22
|
+
- `burst_capture_tool` = `./scripts/page_capture_burst.js` — continuous view-tree+screenshot capture at ~1s intervals, for multi-state components (Step 1.5)
|
|
23
|
+
- `checklist_tool` = `./scripts/extract_checklist.js` — deterministically extracts all diffs from `UI_comparison.md` files into `fix_checklist.md` (used in Step 3)
|
|
24
24
|
|
|
25
25
|
## Step 0: Resolve Inputs
|
|
26
26
|
|
|
@@ -46,13 +46,13 @@ Resolve each value along the standard chain — **OS environment variable first,
|
|
|
46
46
|
| `OHOS_SDK_PATH` | `env.OHOS_SDK_PATH` | HarmonyOS SDK ETS API reference (Step 3) | path exists on disk |
|
|
47
47
|
| `HMS_SDK_PATH` | `env.HMS_SDK_PATH` | HMS SDK ETS API reference (Step 3) | path exists on disk |
|
|
48
48
|
|
|
49
|
-
The model config is injected automatically: in the plugin context the `a2h_app_feature_verify` tool resolves the key from the host and pipes it to `scripts/app_feature_verify.
|
|
49
|
+
The model config is injected automatically: in the plugin context the `a2h_app_feature_verify` tool (navigation params passed as top-level fields `app`/`package`/`device`/`prompt`/`task`/`feature`/… — see `scripts/navigation-capure.md` for the field list) resolves the key from the host and pipes it to `scripts/app_feature_verify.js` over stdin, so the key never sits in an env var and is not visible to the spawned adb/hdc subprocesses — you do not read or pass the key by hand. For a direct `node scripts/app_feature_verify.js` run (no tool, e.g. debugging), the script still resolves `--api-key` → `HOMETRANS_MODEL_*` env → `~/.hometrans/config.json` → `GLM_API_KEY`; ensure one of those is set. For `OHOS_SDK_PATH` / `HMS_SDK_PATH`, if both the env var and `~/.hometrans/config.json` are empty but `DEVECO_SDK_HOME` is set (env or `env.DEVECO_SDK_HOME` in config.json), derive them as `<DEVECO_SDK_HOME>/default/openharmony/ets` and `<DEVECO_SDK_HOME>/default/hms/ets`.
|
|
50
50
|
|
|
51
51
|
For each value that is still missing/empty (or a path that does not exist) after both the env var and `~/.hometrans/config.json`, **stop and ask the user to provide a value**, then use what they give for this run. Suggest running `ht init` to persist them as machine environment variables for next time.
|
|
52
52
|
|
|
53
53
|
### Step 0.1: Auto-derive App Names & Package Names
|
|
54
54
|
|
|
55
|
-
`android.app_name` / `android.package` / `harmony.app_name` / `harmony.package` are required for navigation (passed to the `a2h_app_feature_verify` tool as
|
|
55
|
+
`android.app_name` / `android.package` / `harmony.app_name` / `harmony.package` are required for navigation (passed to the `a2h_app_feature_verify` tool as the `app` / `package` fields). They are not provided as inputs — resolve them from the project dirs (`android_project_dir` / `harmony_project_dir`) as follows.
|
|
56
56
|
|
|
57
57
|
**`app_name` matters because it is the launcher label the navigator taps to open the app** — when the resolved label is a localized resource and a Chinese (`zh`) variant exists, prefer the Chinese value (devices are typically zh-CN).
|
|
58
58
|
|
|
@@ -74,7 +74,7 @@ After resolving all four, briefly echo them to the user (e.g. `android.app_name=
|
|
|
74
74
|
|
|
75
75
|
## Step 1: Capture All Related Pages on Android & HarmonyOS Devices
|
|
76
76
|
|
|
77
|
-
Read `scripts/navigation-capure.md` to learn the usage of `scripts/app_feature_verify.
|
|
77
|
+
Read `scripts/navigation-capure.md` to learn the usage of `scripts/app_feature_verify.js` (navigation) and `scripts/page_capture.js` (capture).
|
|
78
78
|
|
|
79
79
|
### Step 1.1: Parse User Request and Build Capture Plan
|
|
80
80
|
Analyze the user's description and build a list of **base pages** to capture.
|
|
@@ -89,8 +89,8 @@ Create the timestamped output directory and per-page sub-directories following t
|
|
|
89
89
|
|
|
90
90
|
### Step 1.2: Capture Base Pages
|
|
91
91
|
For each base page in the plan, on **both** Android and HarmonyOS devices:
|
|
92
|
-
1. Use the `a2h_app_feature_verify` tool to navigate to the page (
|
|
93
|
-
2. On success, use `scripts/page_capture.
|
|
92
|
+
1. Use the `a2h_app_feature_verify` tool to navigate to the page: pass the navigation params as top-level fields (`app`, `package`, `device`, and one of `prompt`/`task`/`feature`; the tool description lists all fields). See `scripts/navigation-capure.md` for the navigation prompt rule and capture workflow.
|
|
93
|
+
2. On success, use `scripts/page_capture.js` to capture the view tree and screenshot.
|
|
94
94
|
3. For HarmonyOS pages that don't exist yet, navigation will fail — leave the directory empty (expected).
|
|
95
95
|
|
|
96
96
|
### Step 1.3: Discover and Capture Interactive States
|
|
@@ -102,7 +102,7 @@ After capturing each base page, scan its view tree for **interactive elements th
|
|
|
102
102
|
|
|
103
103
|
**For each interactive element found:**
|
|
104
104
|
1. Create a separate capture directory: `{platform}_page_{i}_{base_name}_{state_type}_{state_name}` (e.g., `android_page_1_detail_tab_city`, `android_page_1_detail_popup_filter_identity`).
|
|
105
|
-
2. Navigate to the base page (reuse the same nav path), then append the click action to trigger the state change. Capture with `scripts/page_capture.
|
|
105
|
+
2. Navigate to the base page (reuse the same nav path), then append the click action to trigger the state change. Capture with `scripts/page_capture.js`.
|
|
106
106
|
3. Repeat for **both** Android and HarmonyOS devices.
|
|
107
107
|
4. Each captured state is treated as a separate page pair in Step 2 and Step 3.
|
|
108
108
|
|
|
@@ -177,8 +177,8 @@ The model MUST include:
|
|
|
177
177
|
|
|
178
178
|
**For auto-capturable states** (single tap, simple long-press then release):
|
|
179
179
|
1. Navigate to the component's page
|
|
180
|
-
2. Start `scripts/page_capture_burst.
|
|
181
|
-
3. Trigger the state via the `a2h_app_feature_verify` tool
|
|
180
|
+
2. Start `scripts/page_capture_burst.js` (see `scripts/navigation-capure.md` for burst workflow)
|
|
181
|
+
3. Trigger the state via the `a2h_app_feature_verify` tool (navigation params as top-level fields)
|
|
182
182
|
4. Select representative frames from burst output
|
|
183
183
|
|
|
184
184
|
**For non-auto-capturable states** (long-press hold, drag, pan, sensor, voice):
|
|
@@ -231,7 +231,7 @@ Firstly, make sure whether the page exists, then:
|
|
|
231
231
|
- device density (read from the page's `meta.json` → `density_factor`; e.g. 3.0)
|
|
232
232
|
- converted dp/vp value (px ÷ density_factor)
|
|
233
233
|
Format: "126px (3.0x → 42vp)". Never write bare px or vp without the other.
|
|
234
|
-
**Density source**: `scripts/page_capture.
|
|
234
|
+
**Density source**: `scripts/page_capture.js` records the real device density into each capture directory's `meta.json` (`dpi` and `density_factor`). Read `density_factor` from there per page — do NOT assume 3x. Android and HarmonyOS captures may have different densities, so convert each side using its own `meta.json`. If a page's `meta.json` is missing `density_factor`, fall back to 3.0 and note the assumption.
|
|
235
235
|
**MANDATORY OUTPUT**: Write the result to `android_page_{i}_{name}/UI_Analysis.md`,写完后确认文件已创建。
|
|
236
236
|
**This step is NEVER skippable** — even if the HarmonyOS counterpart is empty, the Android analysis must still be written.
|
|
237
237
|
|
|
@@ -278,7 +278,7 @@ MUST verify:
|
|
|
278
278
|
2. If any `UI_comparison.md` is missing or contains only a status note without a component table, go back to Step 2 and complete it. For pages where HarmonyOS was not captured, read the source code to generate `UI_Analysis_from_code.md` first, then regenerate the comparison with a proper component-level diff table.
|
|
279
279
|
3. Generate `{task_dir}/fix_checklist.md` **deterministically** by running the extraction script — do NOT hand-enumerate diffs from the comparison tables (manual enumeration is the main cause of missed items):
|
|
280
280
|
```bash
|
|
281
|
-
node ./scripts/extract_checklist.
|
|
281
|
+
node ./scripts/extract_checklist.js --task-dir "{task_dir}"
|
|
282
282
|
```
|
|
283
283
|
The script parses ALL five table types in every `UI_comparison.md` (main static component table, Dynamic / Transient UI, State Machine, Per-Transition, Per-State Visual), skips rows whose Diff cell is empty / "一致" / "-", splits a row carrying multiple diffs (separated by `;`, `;`, or `<br>`) into separate items, and tags items with `[DYNAMIC]` / `[STATE]` / `[TRANSITION]` prefixes. It prints a per-page reconciliation table (`diff_rows` vs `items`).
|
|
284
284
|
|
|
@@ -63,12 +63,12 @@ For states that cannot be auto-captured, provide step-by-step instructions:
|
|
|
63
63
|
|
|
64
64
|
```
|
|
65
65
|
State S1 (recording):
|
|
66
|
-
1. Run: node ./scripts/page_capture_burst.
|
|
66
|
+
1. Run: node ./scripts/page_capture_burst.js --device adb -o {output_dir} --duration 5
|
|
67
67
|
2. On device: long-press the microphone button and HOLD
|
|
68
68
|
3. Wait for burst to complete, then release
|
|
69
69
|
|
|
70
70
|
State S2 (cancelling):
|
|
71
|
-
1. Run: node ./scripts/page_capture_burst.
|
|
71
|
+
1. Run: node ./scripts/page_capture_burst.js --device adb -o {output_dir} --duration 5
|
|
72
72
|
2. On device: long-press mic → drag finger UP past the cancel threshold
|
|
73
73
|
3. Wait for burst to complete, then release
|
|
74
74
|
```
|