@harmonyos-arkts/droid2hmos 0.0.7 → 0.0.8

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 CHANGED
@@ -8,13 +8,13 @@ Android 应用迁移到 HarmonyOS 的报告驱动 AI 插件,支持 Claude Code
8
8
 
9
9
  迁移工作区固定位于安卓工程父目录下的 `<工程名>-migration/.migration/`,由 CLI 自动创建;下文 `.migration/...` 均相对该工作区根目录。
10
10
 
11
- 1. 检查 Android 技术栈、构建基线和设备环境。HarmonyOS HDC 设备是必需门禁;Android 模拟器是可选对照环境,缺失时只给出安装建议。
11
+ 1. 检查 Android 技术栈、构建基线和设备环境。HarmonyOS HDC 设备是必需门禁;Android 运行环境依赖(SDK/adb/模拟器/Android 侧构建测试)已移除,相关检查固定为 `not_applicable`。
12
12
  2. 运行 AppGraph,生成只读 `.migration/spec/facts/` 与人工查看的 `spec.html`。
13
13
  3. 从 facts 初始化 `.migration/report/` 报告分片。
14
14
  4. 从 `.migration/spec/` 的 Facts 分片契约 `2.0.0` 与受管 correction/review 编译 `.migration/tasks/`,校验 Launcher、行为闭包、Fact 所有权和 Task DAG。
15
15
  5. AI 通过 `task next`/`task show` 取得一个完整行为责任,以 Android 源码和运行行为为权威持续实现 HarmonyOS 应用。
16
16
  6. 每完成一个可验证 Task,同步填写实现映射和测试证据,并创建 Git 检查点。
17
- 7. 在 HarmonyOS 模拟器或真机上执行端到端功能验证;若 Android 模拟器可用,则同步进行双端页面对照。具备图片理解能力时全面比较视觉细节,否则比较页面内容、控件、状态与交互结果,不宣称像素级一致。发现 facts 遗漏时写入报告 discoveries。
17
+ 7. 在 HarmonyOS 模拟器或真机上执行端到端功能验证。Android 运行时对照能力已移除,一致性基准为 Android 源码、静态 facts 与 `evidence compare` 对既有证据目录的比较;发现 facts 遗漏时写入报告 discoveries。
18
18
  8. 使用 Task Plan 与报告门禁检查已知 facts 覆盖;最终完成必须同时满足真实应用验收。
19
19
 
20
20
  ## 保留结构
@@ -67,7 +67,7 @@ droid2hmos status <android-project>
67
67
  droid2hmos complete <android-project>
68
68
  droid2hmos analyze <android|harmony|all> <android-project>
69
69
  droid2hmos preflight <android-project> [--sdk-path <path>] [--no-init-harmony]
70
- droid2hmos config init <android-project> [--harmony-project <path>] [--android-build <command>] [--android-test <command>]
70
+ droid2hmos config init <android-project> [--harmony-project <path>]
71
71
  droid2hmos config validate <android-project>
72
72
  droid2hmos report init <android-project>
73
73
  droid2hmos report validate <android-project> [--require-complete]
@@ -79,18 +79,17 @@ droid2hmos task validate <android-project>
79
79
  droid2hmos task status <android-project>
80
80
  droid2hmos task next <android-project>
81
81
  droid2hmos task show <android-project> <task-id> [--cursor <cursor>] [--max-source-context <count>]
82
- droid2hmos build <android|harmony|all> <android-project>
83
- droid2hmos test android <android-project> [--task <task>]
82
+ droid2hmos build harmony <android-project>
84
83
  droid2hmos test harmony <android-project> [--runner arkts] --class <class> [--case <case>] [--target <serial>] [--case-timeout-ms <ms>] [--ref <report-ref>...]
85
84
  droid2hmos test harmony <android-project> [--runner arkts] --all [--target <serial>] [--case-timeout-ms <ms>] [--ref <report-ref>...]
86
85
  droid2hmos test harmony <android-project> --runner python --hypium-project <path> --test-list <name>... [--target <serial>] [--python <path>] [--report-path <path>] [--ref <report-ref>...]
87
86
  droid2hmos checkpoint status <android-project>
88
87
  droid2hmos checkpoint create <android-project> --message <message> (--include <path>...|--all)
89
- droid2hmos device check <android|harmony>
88
+ droid2hmos device check harmony
90
89
  droid2hmos sign <android-project> [--target <serial>] [--force]
91
- droid2hmos evidence capture <android|harmony> <android-project> --name <name> [--target <id>]
92
- droid2hmos evidence compare <android-project> --name <name> --android <evidence-dir> --harmony <evidence-dir>
93
- droid2hmos evidence flow <android|harmony> <android-project> --name <name> [--task <task>|--class <class> [--case <case>]|--all]
90
+ droid2hmos evidence capture harmony <android-project> --name <name> [--target <id>]
91
+ droid2hmos evidence compare <android-project> --name <name> --android <evidence-dir> --harmony <harmony-evidence-dir>
92
+ droid2hmos evidence flow harmony <android-project> --name <name> [--class <class> [--case <case>]|--all]
94
93
  droid2hmos mock init <android-project> --spec <protocol-spec.json>
95
94
  droid2hmos upgrade
96
95
  droid2hmos service start <name> <android-project> [--health-url <url>] -- <command> [args...]
@@ -103,8 +102,8 @@ droid2hmos service stop <name> <android-project>
103
102
  - `complete`:最终硬门禁;只有 Preflight/设备、当前 Android 分析、完整报告、当前 HarmonyOS 全量回归和逐项受管证据都成立时返回成功。
104
103
  - `preflight`:读取 CLI 内置的全局 `config/preflight-checklist.json`,按其中启用的 Android 技术栈、Git、主机工具链、DevEco CLI 登录、AppGraph、配置、Android 构建/模拟器、HarmonyOS 工程/SDK/构建/设备门禁执行,并生成 `.migration/preflight-report.json`。硬门禁失败后停止后续阶段;修改 `enabled` 会影响该 CLI 处理的所有项目。
105
104
  - Preflight 的完整检查项、阻断规则和当前边界见 [`docs/preflight-checks.md`](docs/preflight-checks.md)。
106
- - `config`:初始化或校验 `.migration/config.json`;允许显式配置 Android 构建与测试命令(`androidBuild` 默认为 null,迁移流程不编译 Android 工程;显式配置时按当前操作系统修正 Gradle Wrapper 格式)。
107
- - `analyze android`:通过 AppGraph 对 Android 源码做纯静态分析,生成确定性 facts 和 `spec.html`,无需 APK;同时只读清点既有 APK(写入 `spec/android-apk-inventory.json`),供双端运行对照决策使用。
105
+ - `config`:初始化或校验 `.migration/config.json`(harmony-project 路径)。`androidBuild`/`androidTest` 字段仅为兼容旧工作区保留,不再有设置入口也不执行(Android 构建与测试能力已移除)。
106
+ - `analyze android`:通过 AppGraph 对 Android 源码做纯静态分析,生成确定性 facts 和 `spec.html`,无需 APK;同时只读清点既有 APK(写入 `spec/android-apk-inventory.json`),仅作参考信息(Android 运行时对照能力已移除)。Android Gradle 依赖分析入口暂时关闭,受管 AppGraph 调用拒绝 `--resolve-dependencies`;源码分析不执行 Gradle。
108
107
  - `analyze harmony`:分析 HarmonyOS 工程,并自动读取 `config.json` 中经验证的 HarmonyOS SDK 路径。
109
108
  - `report init`:从 facts 初始化报告 `1.2.0`;存量 `1.1.0` 报告会原地升级并为条目补空 `sourceProvenance`,不伪造来源。
110
109
  - `report validate`:检查报告结构、facts 覆盖、Android 受管成员清单/hash/范围、Task source closure、D1 顺序审计与 D2 稳定抽样;项目内自行写入的事件文件不被信任,没有运行器可信集成时 D1 明确返回 `unavailable`,D2 只产生 warning。`--require-complete` 用于最终门禁。
@@ -113,10 +112,9 @@ droid2hmos service stop <name> <android-project>
113
112
  - `task status/next/show`:只读推导 Task 运行态、选择 Ready Frontier,并按需分页返回源码上下文;不写新的状态机文件。
114
113
  - `build harmony`:读取 DevEco JSON5 配置生成应用构建命令;Hvigor 命中增量缓存时允许复用不早于当前构建输入的非空 HAP,源码更新但产物过旧仍会失败。
115
114
  - `sign`:真机自动签名。检测目标设备(默认第一个可响应设备,可用 `--target` 指定),读取设备 UDID,在签名材料未覆盖该设备时自动执行 `devecocli signature generate --force` 重新生成(devecocli 会把当前连接的设备注册进调试 profile);模拟器自动跳过。同时读取真机系统版本判据(`param get const.ohos.apiversion` 声称值与 `/system/etc/abc/framework/stateMgmt.abc` 文件头解析出的运行时字节码上限取较小值;log 版镜像 param 可能虚报),若有效 API 低于工程 `compatibleSdkVersion` 则自动下调兼容版本(`targetSdkVersion` 保持不变,产物 abc 字节码版本由 compatibleSdkVersion 决定),保证老系统真机可安装且可启动。覆盖情况记录在 `.migration/signature/devices.json`,材料未变化时不重复生成;`--force` 强制重签。
116
- - `test harmony`:支持 ArkTS 与 Python Hypium。多设备时优先真机,安装前自动检查签名和兼容版本;ArkTS 支持 `--case-timeout-ms` 和严格测试摘要校验,`--ref` 声明受管证据覆盖的报告项。
117
- - `test android`:通过同一个有限命令运行器执行 `commands.androidTest`;可使用 `{task}` 模板接收 `--task`。
115
+ - `test harmony`:支持 ArkTS 与 Python Hypium。多设备时优先真机,安装前自动检查签名和兼容版本;ArkTS 支持 `--case-timeout-ms` 和严格测试摘要校验,`--ref` 声明受管证据覆盖的报告项。Android 侧测试已移除。
118
116
  - `checkpoint`:检查 Git 基线并重新校验源码治理,或只提交显式 `--include` 的文件;`--all` 必须由调用者明确选择。声明的 Android 来源和 HarmonyOS 实现必须分别与所属 Git 仓库的 index 一致。默认同级 HarmonyOS 工程若尚未建仓,首次 checkpoint 会初始化独立仓库并继承 Android 仓库的提交身份;两个仓库按实际变更分别提交并返回各自 commit,不会移动或嵌套工程。`checkpoint-provenance.json` 写入兄弟迁移工作区的 `.migration/audit/`,记录完整成员清单、文件 hash、映射、所属仓库和本次 commit;不会在 Android 工程内创建 `.migration/`。提交前的暂存或一致性检查失败会回滚本次产生的暂存项。
119
- - `device` 与 `evidence`:检查设备,采集截图、UI Tree 和有限设备日志,生成交互前后证据包,并对双端截图身份/尺寸及 UI Tree 文本做确定性比较。视觉一致性仍需图片审查。
117
+ - `device` 与 `evidence`:检查 HarmonyOS 设备,采集截图、UI Tree 和有限设备日志,生成交互前后证据包,并对既有证据目录做截图身份/尺寸及 UI Tree 文本的确定性比较(Android 端采集已移除)。视觉一致性仍需图片审查。
120
118
  - `report update`:按 ref 更新状态、实现文件、Android 源码依据、测试证据和差异字段。`--android-source` 写入当前文件 SHA-256;`implemented` / `verified` 必须具备有效 `sourceProvenance`。
121
119
  - `mock init`:从有 Android 源码证据的协议 JSON 生成无第三方依赖的 Node.js Mock Server、四类场景和请求 transcript;不会凭空推断接口。
122
120
  - `upgrade`:通过 npm 将当前安装的 CLI 包全局升级到最新版本。