@buaa_smat/hometrans 0.1.0 → 0.1.2

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 (136) hide show
  1. package/README.md +141 -124
  2. package/agents/build-fixer.md +1 -0
  3. package/agents/code-review-fix.md +1 -0
  4. package/agents/code-reviewer.md +1 -0
  5. package/agents/logic-coding.md +1 -0
  6. package/agents/logic-context-builder.md +1 -0
  7. package/agents/review-fixer.md +1 -0
  8. package/agents/self-test-fixer.md +1 -0
  9. package/agents/self-tester.md +260 -233
  10. package/agents/spec-generator.md +1 -0
  11. package/agents/test-tools/autotest/README.md +223 -0
  12. package/agents/test-tools/autotest/config.yaml.example +58 -0
  13. package/agents/test-tools/autotest/pyproject.toml +16 -0
  14. package/agents/test-tools/autotest/report_tool.py +759 -0
  15. package/agents/test-tools/autotest/self_test_runner.py +773 -0
  16. package/agents/test-tools/autotest/testcases_schema.md +143 -0
  17. package/agents/test-tools/autotest/testcases_tool.py +215 -0
  18. package/agents/test-tools/autotest/uv.lock +3156 -0
  19. package/agents/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
  20. package/agents/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
  21. package/agents/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
  22. package/agents/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
  23. package/agents/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
  24. package/agents/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
  25. package/dist/cli/config-store.js +27 -2
  26. package/dist/cli/config.js +17 -6
  27. package/dist/cli/index.js +3 -2
  28. package/dist/cli/init.js +135 -22
  29. package/dist/cli/mcp.js +2 -2
  30. package/dist/context/index.js +165 -69
  31. package/package.json +59 -60
  32. package/skills/code-dev-review-fix/SKILL.md +279 -0
  33. package/skills/code-dev-review-fix-workspace/evals/evals.json +56 -0
  34. package/skills/code-dev-review-fix-workspace/iteration-1/routing-results.md +23 -0
  35. package/skills/convert_pipeline/SKILL.md +423 -439
  36. package/skills/hmos-resources-convert/SKILL.md +623 -0
  37. package/skills/hmos-resources-convert/evals/evals.json +171 -0
  38. package/skills/hmos-resources-convert/references/conversion-rules.md +663 -0
  39. package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +388 -0
  40. package/skills/hmos-resources-convert/references/resource-mapping-rules.md +457 -0
  41. package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +513 -0
  42. package/skills/hmos-resources-convert/template/AppScope/app.json5 +10 -0
  43. package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +8 -0
  44. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
  45. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
  46. package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +7 -0
  47. package/skills/hmos-resources-convert/template/build-profile.json5 +42 -0
  48. package/skills/hmos-resources-convert/template/code-linter.json5 +32 -0
  49. package/skills/hmos-resources-convert/template/entry/build-profile.json5 +33 -0
  50. package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +6 -0
  51. package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +23 -0
  52. package/skills/hmos-resources-convert/template/entry/oh-package.json5 +10 -0
  53. package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +48 -0
  54. package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +16 -0
  55. package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +23 -0
  56. package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +55 -0
  57. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +8 -0
  58. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +8 -0
  59. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +16 -0
  60. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
  61. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
  62. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +7 -0
  63. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
  64. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +3 -0
  65. package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +5 -0
  66. package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +8 -0
  67. package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +2 -0
  68. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +35 -0
  69. package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +5 -0
  70. package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +16 -0
  71. package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +5 -0
  72. package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +33 -0
  73. package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +23 -0
  74. package/skills/hmos-resources-convert/template/hvigorfile.ts +6 -0
  75. package/skills/hmos-resources-convert/template/oh-package-lock.json5 +28 -0
  76. package/skills/hmos-resources-convert/template/oh-package.json5 +10 -0
  77. package/skills/hmos-resources-convert/tools/apktool.bat +85 -0
  78. package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
  79. package/skills/hmos-ui-align/SKILL.md +182 -0
  80. package/skills/hmos-ui-align/config-example.json +11 -0
  81. package/skills/hmos-ui-align/config.json +11 -0
  82. package/skills/hmos-ui-align/diff_analysis.md +53 -0
  83. package/skills/hmos-ui-align/page_align.md +62 -0
  84. package/skills/hmos-ui-align/readme.md +231 -0
  85. package/skills/hmos-ui-align/references/Comparison_Template.md +2 -0
  86. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +648 -0
  87. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +2089 -0
  88. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +1033 -0
  89. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +1183 -0
  90. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +576 -0
  91. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +297 -0
  92. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@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 +395 -0
  93. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +903 -0
  94. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
  95. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +1178 -0
  96. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -0
  97. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
  98. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/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 +355 -0
  99. package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//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 +11 -0
  100. package/skills/hmos-ui-align/references/UI_Analysis_Template.md +4 -0
  101. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
  102. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
  103. package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
  104. package/skills/hmos-ui-align/scripts/app_feature_verify.py +443 -0
  105. package/skills/hmos-ui-align/scripts/navigation-capure.md +37 -0
  106. package/skills/hmos-ui-align/scripts/page_capture.py +592 -0
  107. package/skills/hmos-ui-align-batch/SKILL.md +99 -0
  108. package/skills/hmos-ui-align-batch/references/conversion-procedure.md +180 -0
  109. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
  110. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
  111. package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
  112. package/skills/hmos-ui-align-batch/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 +648 -0
  113. package/skills/hmos-ui-align-batch/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 +2089 -0
  114. package/skills/hmos-ui-align-batch/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 +1033 -0
  115. package/skills/hmos-ui-align-batch/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 +1183 -0
  116. package/skills/hmos-ui-align-batch/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 +576 -0
  117. package/skills/hmos-ui-align-batch/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 +297 -0
  118. package/skills/hmos-ui-align-batch/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 +395 -0
  119. package/skills/hmos-ui-align-batch/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 +903 -0
  120. package/skills/hmos-ui-align-batch/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 +106 -0
  121. package/skills/hmos-ui-align-batch/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 +1178 -0
  122. package/skills/hmos-ui-align-batch/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
  123. package/skills/hmos-ui-align-batch/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 +355 -0
  124. package/skills/hmos-ui-align-batch/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 +11 -0
  125. package/skills/hmos-ui-align-batch/scripts/android_parse_fast.py +1606 -0
  126. package/skills/self-test/SKILL.md +369 -0
  127. package/skills/self-test/readme.md +309 -0
  128. package/skills/spec-generator-skill/SKILL.md +332 -0
  129. package/skills/spec-generator-skill/references/android-platform-tokens.md +105 -0
  130. package/skills/spec-generator-skill/references/spec-sample-1.md +78 -0
  131. package/skills/spec-generator-skill/references/spec-sample-2.md +58 -0
  132. package/skills/spec-generator-skill/references/spec-sample-3.md +116 -0
  133. package/skills/spec-generator-skill/references/step4-report-template.md +33 -0
  134. package/agents/self-test-setup.md +0 -165
  135. package/dist/context/resources/sdkConfig.json +0 -24
  136. package/src/context/resources/sdkConfig.json +0 -24
package/README.md CHANGED
@@ -1,124 +1,141 @@
1
- # hometrans
2
-
3
- > Skill + agent installer for the **HomeTrans** Android-to-HarmonyOS conversion toolkit. One command (`ht init`) distributes **1 skill**, **10 subagents** (with 1 script bundle), and an **MCP server** into Claude Code, Cursor, OpenCode, and Codex.
4
-
5
- ---
6
-
7
- ## Install
8
-
9
- Global install — exposes both `hometrans` and the short alias `ht` on `PATH`:
10
-
11
- ```bash
12
- npm install -g hometrans
13
- ht init
14
- ```
15
-
16
- One-shot via `npx` (no global install required):
17
-
18
- ```bash
19
- npx hometrans init
20
- ```
21
-
22
- Requires Node.js **>= 18**.
23
-
24
- ---
25
-
26
- ## Commands
27
-
28
- | Command | Description |
29
- |---------|-------------|
30
- | `ht init` | Interactive setup: detect installed editors, copy skills/agents to target directories, register MCP server |
31
- | `ht mcp` | Start the HomeTrans MCP server (stdio mode), exposing the `extract_commit_context` tool |
32
- | `ht config` | Display `~/.hometrans/editors.json` path and content (read-only; edit the file directly, then re-run `ht init`) |
33
- | `ht uninstall` | Remove all skills, agents, and MCP entries installed by `ht init` from configured editors |
34
- | `ht --version` | Show installed version |
35
- | `ht --help` | List all commands |
36
-
37
- > `hometrans` and `ht` are fully equivalent — both point to the same CLI entry.
38
-
39
- ---
40
-
41
- ## What `ht init` does
42
-
43
- 1. **Detects** each supported editor by checking whether its standard config directory exists under `$HOME`.
44
- 2. For every detected editor, **copies**:
45
- - every skill folder under `skills/` `<editor>/skills/<skill-name>/` (recursive preserves subdirectory structure)
46
- - every agent under `agents/` `<editor>/agents/` (recursive preserves `<agent>/scripts/` subtrees)
47
- 3. **Registers the MCP server** (auto-adapts to editor config format: jsonc-object / jsonc-command-array / codex-cli / toml-section).
48
- 4. Editors whose marker directory is missing are reported as **`skipped`** nothing is written for them.
49
- 5. The install is **idempotent** — re-running overwrites bundled content only. It never touches files under `<editor>/skills/` or `<editor>/agents/` that don't share a name with a bundled item.
50
-
51
- ### Target directories
52
-
53
- | Editor | Marker | Skills target | Agents target |
54
- |--------|--------|---------------|---------------|
55
- | Claude Code | `~/.claude/` | `~/.claude/skills/` | `~/.claude/agents/` |
56
- | Cursor | `~/.cursor/` | `~/.cursor/skills/` | `~/.cursor/agents/` |
57
- | OpenCode | `~/.config/opencode/` | `~/.config/opencode/skills/` | `~/.config/opencode/agents/` |
58
- | Codex | `~/.codex/` | `~/.agents/skills/` | `~/.codex/agents/` |
59
-
60
- ---
61
-
62
- ## What `ht mcp` does
63
-
64
- Starts a stdio-mode MCP server exposing the following tool:
65
-
66
- ### `extract_commit_context`
67
-
68
- Extracts code context index from a given git commit in a HarmonyOS project (git diff + ArkTS semantic dependency analysis), for use during AI-assisted Android-to-HarmonyOS code review.
69
-
70
- **Input parameters:**
71
-
72
- | Parameter | Type | Required | Description |
73
- |-----------|------|----------|-------------|
74
- | `projectPath` | string | Yes | Absolute path to HarmonyOS project root (must contain `.git`) |
75
- | `commitId` | string | Yes | Git commit ID (diffs against its first parent) |
76
- | `mode` | string | No | `"default"` builds full call graph; other values skip (default: `"default"`) |
77
- | `ohosSdkPath` | string | No | OpenHarmony SDK ETS path; falls back to env var `OHOS_SDK_PATH` |
78
- | `hmsSdkPath` | string | No | HMS SDK ETS path; falls back to env var `HMS_SDK_PATH` |
79
-
80
- **Output:** `{path, kind, ranges?, resourceNames?}[]`
81
- - `source` files: 1-based `[start, end]` line-range arrays
82
- - `resource` files: list of referenced resource names
83
-
84
- ---
85
-
86
- ## Skills
87
-
88
- | Skill | Trigger phrases | Description |
89
- |-------|-----------------|-------------|
90
- | `convert-pipeline` | "full Android-to-HarmonyOS pipeline", "run the conversion pipeline end-to-end", "convert_pipeline" | Runs all conversion agents in sequence with progress tracking, duration stats, and defect recording. 9 stages: Logic Context → Logic Coding → Build → Code Review → Review Fix → Rebuild → Self-Test → Self-Test Fix → Rebuild |
91
-
92
- **Arguments:**
93
- 1. `android-project-path` (required): path to the Android source project
94
- 2. `harmonyos-project-path` (required): path to the target HarmonyOS project
95
- 3. `assets-output-path` (required): directory for output/report files
96
- 4. `max-rounds-review` (optional, default `2`): max Code ReviewFix loop rounds
97
- 5. `max-rounds-test` (optional, default `2`): max Self-Test Fix loop rounds
98
- 6. `variant` (optional, default `enhanced`): `enhanced` | `baseline` selects the Stage 1/1a agent family
99
-
100
- ---
101
-
102
- ## Agents
103
-
104
- | Agent | Description |
105
- |-------|-------------|
106
- | `logic-context-builder` | Constrains HarmonyOS ArkTS app changes into an executable decision contract |
107
- | `logic-coding` | Executes HarmonyOS ArkTS code implementation from the decision contract (ships with `scripts/platform_context_query.py`) |
108
- | `build-fixer` | Automatically builds a HarmonyOS project, parses compile errors, fixes them, and retries in a loop until the build succeeds |
109
- | `code-reviewer` | Reviews HarmonyOS code against user scenarios to validate functional coverage |
110
- | `code-review-fix` | One-pass review-fix-build cycle reviews code, verifies and fixes confirmed issues, rebuilds the project |
111
- | `review-fixer` | Fixes issues from code review reports — verifies each issue before fixing, references Android source, uses cautious per-scenario fix strategies |
112
- | `spec-generator` | Generates requirement spec documents for each requirement description file in a folder by exploring the Android codebase and decomposing into atomic user scenarios |
113
- | `self-test-setup` | Prepares everything needed for AutoTest — parses `test_case.md` into `testcases.json` plus app metadata |
114
- | `self-tester` | Performs functional verification of HAP packages on real HarmonyOS devices using AutoTest Mode |
115
- | `self-test-fixer` | Fixes issues identified by self-testing — reads the self-test report, white-box verifies failures, plans and executes fixes in order |
116
-
117
- ---
118
-
119
- MIT
120
-
121
- <p align="center">
122
- <a href="https://gitcode.com/SMAT/HomeTrans">Official Repository</a>
123
- <a href="https://gitcode.com/SMAT/HomeTrans/blob/main/LICENSE">MIT License</a>
124
- </p>
1
+ # hometrans
2
+
3
+ > Skill + agent installer for the **HomeTrans** Android-to-HarmonyOS conversion toolkit. One command (`ht init`) distributes **7 skills**, **9 subagents** (with a script bundle + on-device test tooling), and an **MCP server** into Claude Code, Cursor, OpenCode, and Codex.
4
+
5
+ ---
6
+
7
+ ## Install
8
+
9
+ Global install — exposes both `hometrans` and the short alias `ht` on `PATH`:
10
+
11
+ ```bash
12
+ npm install -g @buaa_smat/hometrans
13
+ ht init
14
+ ```
15
+
16
+ One-shot via `npx` (no global install required):
17
+
18
+ ```bash
19
+ npx hometrans init
20
+ ```
21
+
22
+ Requires Node.js **>= 18**.
23
+
24
+ ---
25
+
26
+ ## Commands
27
+
28
+ | Command | Description |
29
+ |---------|-------------|
30
+ | `ht init` | Interactive setup: detect installed editors, prompt for SDK paths + test API key, copy skills/agents to target directories, seed/refresh autotest `config.yaml`, register MCP server |
31
+ | `ht mcp` | Start the HomeTrans MCP server (stdio mode), exposing the `extract_commit_context` tool |
32
+ | `ht config` | Display `~/.hometrans/config.json` path, parameters (with masked API key), and full content (read-only; edit the file directly, then re-run `ht init`) |
33
+ | `ht uninstall` | Remove all skills, agents, and MCP entries installed by `ht init` from configured editors |
34
+ | `ht --version` | Show installed version |
35
+ | `ht --help` | List all commands |
36
+
37
+ > `hometrans` and `ht` are fully equivalent — both point to the same CLI entry.
38
+
39
+ ---
40
+
41
+ ## What `ht init` does
42
+
43
+ 1. **Detects** each supported editor by checking whether its standard config directory exists under `$HOME`, then lets you select which ones to configure (detected editors are pre-checked). Use `ht init --all` to skip the prompt and select every editor.
44
+ 2. **Prompts for user parameters** and stores them in `~/.hometrans/config.json` (press Enter to keep the current value or leave empty):
45
+ - `OHOS_SDK_PATH` OpenHarmony SDK ETS path
46
+ - `HMS_SDK_PATH` HMS SDK ETS path
47
+ - `TEST_API_KEY` API key written into the autotest `config.yaml`
48
+ 3. **Seeds/refreshes the autotest config**: if `agents/test-tools/autotest/config.yaml` is missing it is created from `config.yaml.example`, and every `api_key:` line is filled with the supplied `TEST_API_KEY`.
49
+ 4. For every selected editor, **copies**:
50
+ - every skill folder under `skills/` (those containing a `SKILL.md`) → `<editor>/skills/<skill-name>/` (recursive — preserves subdirectory structure)
51
+ - every agent under `agents/` → `<editor>/agents/` (recursive — preserves `<agent>/scripts/` and `test-tools/` subtrees)
52
+ 5. **Registers the MCP server** (auto-adapts to editor config format: jsonc-object / jsonc-command-array / codex-cli / toml-section).
53
+ 6. Editors whose marker directory is missing are reported as **`skipped`** — nothing is written for them.
54
+ 7. The install is **idempotent** — re-running overwrites bundled content only. It never touches files under `<editor>/skills/` or `<editor>/agents/` that don't share a name with a bundled item.
55
+
56
+ ### Target directories
57
+
58
+ | Editor | Marker | Skills target | Agents target |
59
+ |--------|--------|---------------|---------------|
60
+ | Claude Code | `~/.claude/` | `~/.claude/skills/` | `~/.claude/agents/` |
61
+ | Cursor | `~/.cursor/` | `~/.cursor/skills/` | `~/.cursor/agents/` |
62
+ | OpenCode | `~/.config/opencode/` | `~/.config/opencode/skills/` | `~/.config/opencode/agents/` |
63
+ | Codex | `~/.codex/` | `~/.agents/skills/` | `~/.codex/agents/` |
64
+
65
+ ---
66
+
67
+ ## What `ht mcp` does
68
+
69
+ Starts a stdio-mode MCP server exposing the following tool:
70
+
71
+ ### `extract_commit_context`
72
+
73
+ Extracts code context index from a given git commit in a HarmonyOS project (git diff + ArkTS semantic dependency analysis), for use during AI-assisted Android-to-HarmonyOS code review.
74
+
75
+ **Input parameters:**
76
+
77
+ | Parameter | Type | Required | Description |
78
+ |-----------|------|----------|-------------|
79
+ | `projectPath` | string | Yes | Absolute path to HarmonyOS project root (must contain `.git`) |
80
+ | `commitId` | string | Yes | Git commit ID (diffs against its first parent) |
81
+ | `mode` | string | No | `"default"` builds full call graph; other values skip (default: `"default"`) |
82
+ | `ohosSdkPath` | string | No | OpenHarmony SDK ETS path; falls back to env var `OHOS_SDK_PATH` |
83
+ | `hmsSdkPath` | string | No | HMS SDK ETS path; falls back to env var `HMS_SDK_PATH` |
84
+
85
+ **Output:** `{path, kind, ranges?, resourceNames?}[]`
86
+ - `source` files: 1-based `[start, end]` line-range arrays
87
+ - `resource` files: list of referenced resource names
88
+
89
+ ---
90
+
91
+ ## Skills
92
+
93
+ | Skill | Trigger phrases | Description |
94
+ |-------|-----------------|-------------|
95
+ | `convert-pipeline` | "full Android-to-HarmonyOS pipeline", "run the conversion pipeline end-to-end", "convert_pipeline" | Runs all conversion agents in sequence with progress tracking, duration stats, and defect recording. 9 stages: Logic Context Logic Coding → Build → Code Review → Review Fix → Rebuild → Self-Test → Self-Test Fix → Rebuild |
96
+ | `code-dev-review-fix` | "开发并检视", "代码开发检视修复", "实现这个需求并验证", "develop and review", "review and fix this commit" | Flexibly orchestrates HarmonyOS development/build/scenario-review/fix agents from a natural-language request — composes only the needed agents (logic-context-builder logic-coding build-fixer → code-reviewer / code-review-fix) instead of running a fixed pipeline |
97
+ | `spec-generator-skill` | "spec generation", "generate spec", "requirement to spec", "atomic scenarios", "scenario decomposition", "req to spec" | Generates atomic-scenario requirement specs from raw `.txt` requirement batches. Reads REQ blocks, explores the Android code graph via GitNexus, writes per-REQ trace files, then synthesizes specs from the trace |
98
+ | `hmos-resources-convert` | "Android resources to HarmonyOS", "migrate Android res", "convert drawables/strings/colors" | Converts Android project resources (strings, colors, dimensions, images, drawables, icons) into HarmonyOS resources, including qualifier directories and XML→JSON format conversion |
99
+ | `hmos-ui-align` | "UI对齐", "页面对齐", "和安卓对齐", "鸿蒙页面修复", "align HarmonyOS with Android" | Automated HarmonyOS-Android UI alignment: navigates to target pages on both devices, captures view trees + screenshots, then aligns HarmonyOS code to match Android |
100
+ | `hmos-ui-align-batch` | "把安卓页面迁移到鸿蒙", "Android UI 转鸿蒙", "批量转 ArkTS" | Batch-converts multiple Android Activity UI snapshots (`page_NNNN_ActivityName`) to HarmonyOS ArkUI (ArkTS) pages |
101
+ | `self-test` | "跑自测", "运行自测", "自动测试", "设备测试", "self test", "run autotest" | Runs on-device self-test for a HarmonyOS app: parses `test_case.md`, installs the HAP, executes AutoTest, and produces a verification report — optionally entering a test-and-fix loop |
102
+
103
+ ### `convert-pipeline` Arguments
104
+
105
+ 1. `android-project-path` (required): path to the Android source project
106
+ 2. `harmonyos-project-path` (required): path to the target HarmonyOS project
107
+ 3. `assets-output-path` (required): directory for output/report files
108
+ 4. `max-rounds-review` (optional, default `2`): max Code Review Fix loop rounds
109
+ 5. `max-rounds-test` (optional, default `2`): max Self-Test Fix loop rounds
110
+ 6. `variant` (optional, default `enhanced`): `enhanced` | `baseline` selects the Stage 1/1a agent family
111
+
112
+ ### `spec-generator-skill` Arguments
113
+
114
+ 1. `requirement-description-file` (required): absolute path to a single `.txt` file containing one or more REQ blocks separated by blank lines
115
+ 2. `android-project-path` (required): absolute path to the Android project root (must be inside a Git repo)
116
+ 3. `spec-output-dir` (required): absolute path to the directory where spec files will be written
117
+
118
+ ---
119
+
120
+ ## Agents
121
+
122
+ | Agent | Description |
123
+ |-------|-------------|
124
+ | `logic-context-builder` | Constrains HarmonyOS ArkTS app changes into an executable decision contract |
125
+ | `logic-coding` | Executes HarmonyOS ArkTS code implementation from the decision contract (ships with `scripts/platform_context_query.py`) |
126
+ | `build-fixer` | Automatically builds a HarmonyOS project, parses compile errors, fixes them, and retries in a loop until the build succeeds |
127
+ | `code-reviewer` | Reviews HarmonyOS code against user scenarios to validate functional coverage |
128
+ | `code-review-fix` | One-pass review-fix-build cycle — reviews code, verifies and fixes confirmed issues, rebuilds the project |
129
+ | `review-fixer` | Fixes issues from code review reports — verifies each issue before fixing, references Android source, uses cautious per-scenario fix strategies |
130
+ | `spec-generator` | Generates requirement spec documents for each requirement description file in a folder by exploring the Android codebase and decomposing into atomic user scenarios |
131
+ | `self-tester` | Unified self-test agent — parses `test_case.md` into `testcases.json`, runs on-device AutoTest verification, and produces a report. A `setup` boolean controls whether the parse phase runs (skip on round-2+ to reuse prior artifacts) |
132
+ | `self-test-fixer` | Fixes issues identified by self-testing — reads the self-test report, white-box verifies failures, plans and executes fixes in order |
133
+
134
+ ---
135
+
136
+ MIT
137
+
138
+ <p align="center">
139
+ <a href="https://gitcode.com/SMAT/HomeTrans">Official Repository</a> •
140
+ <a href="https://gitcode.com/SMAT/HomeTrans/blob/main/LICENSE">MIT License</a>
141
+ </p>
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: build-fixer
2
3
  description: Automatically builds a HarmonyOS project, parses compile errors, fixes them, and retries in a loop until build succeeds
3
4
  color: orange
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: code-review-fix
2
3
  description: One-pass review-fix-build cycle — reviews HarmonyOS code against scenarios, verifies and fixes confirmed issues, rebuilds the project
3
4
  color: red
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: code-reviewer
2
3
  description: Reviews HarmonyOS code against user scenarios to validate functional coverage
3
4
  color: red
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: logic-coding
2
3
  description: "Execute the HarmonyOS ArkTS app contract without reopening design choices."
3
4
  color: blue
4
5
  min-model: sonnet
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: logic-context-builder
2
3
  description: "Constrain HarmonyOS ArkTS app changes into an executable decision contract."
3
4
  color: blue
4
5
  min-model: sonnet
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: review-fixer
2
3
  description: Fixes issues from code review reports — verifies each issue before fixing, references Android source, and uses cautious per-scenario fix strategies
3
4
  color: red
4
5
  ---
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: self-test-fixer
2
3
  description: Fixes issues identified by self-testing — reads self-test report, white-box verifies failures in HarmonyOS code, plans and executes fixes in order, produces detailed report
3
4
  color: cyan
4
5
  ---