@buaa_smat/hometrans 0.1.13 → 0.1.15
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 +194 -136
- package/agents/build-fixer.md +38 -48
- package/agents/code-reviewer.md +20 -20
- package/agents/logic-coder.md +8 -8
- package/agents/logic-context-builder.md +5 -5
- package/agents/review-fixer.md +16 -16
- package/agents/self-test-fixer.md +15 -15
- package/agents/self-tester.md +56 -55
- package/agents/spec-generator.md +16 -16
- package/dist/cli/config-store.js +120 -9
- package/dist/cli/config.js +4 -4
- package/dist/cli/env-vars.js +129 -0
- package/dist/cli/init.js +315 -276
- package/dist/cli/uninstall.js +152 -17
- package/dist/context/index.js +10 -197
- package/env-requirements.json +181 -181
- package/package.json +1 -1
- package/resource/choose_editor.png +0 -0
- package/resource/common_config.png +0 -0
- package/resource/integration_test_config.png +0 -0
- package/resource/migration_process.svg +94 -0
- package/resource/migration_process_transparent.svg +93 -0
- package/resource/set_env.png +0 -0
- package/resource/ui_align_config.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +10 -0
- package/skills/hmos-batch-ui-align/references/conversion-procedure.md +180 -180
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
- package/skills/hmos-batch-ui-align/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 -648
- package/skills/hmos-batch-ui-align/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 +2088 -2088
- package/skills/hmos-batch-ui-align/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 -1033
- package/skills/hmos-batch-ui-align/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 -1183
- package/skills/hmos-batch-ui-align/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 -576
- package/skills/hmos-batch-ui-align/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 -297
- package/skills/hmos-batch-ui-align/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 -395
- package/skills/hmos-batch-ui-align/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 +902 -902
- package/skills/hmos-batch-ui-align/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 -106
- package/skills/hmos-batch-ui-align/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 -1178
- package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
- package/skills/hmos-batch-ui-align/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 +354 -354
- package/skills/hmos-batch-ui-align/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 -11
- package/skills/hmos-convert-pipeline/SKILL.md +63 -49
- package/skills/hmos-fix-build-errors/SKILL.md +5 -6
- package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -219
- package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -157
- package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -131
- package/skills/hmos-incremental-ui-align/{readme.md → README.md} +28 -21
- package/skills/hmos-incremental-ui-align/SKILL.md +46 -27
- package/skills/hmos-incremental-ui-align/diff_analysis.md +52 -52
- package/skills/hmos-incremental-ui-align/page_align.md +62 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +2 -2
- package/skills/hmos-incremental-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 -648
- package/skills/hmos-incremental-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 +2088 -2088
- package/skills/hmos-incremental-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 -1033
- package/skills/hmos-incremental-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 -1183
- package/skills/hmos-incremental-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 -576
- package/skills/hmos-incremental-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 -297
- package/skills/hmos-incremental-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 -395
- package/skills/hmos-incremental-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 +902 -902
- package/skills/hmos-incremental-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 -106
- package/skills/hmos-incremental-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 -1178
- package/skills/hmos-incremental-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 -911
- package/skills/hmos-incremental-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 +354 -354
- package/skills/hmos-incremental-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 -11
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +3 -3
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +37 -37
- package/skills/hmos-integration-test/{readme.md → README.md} +38 -38
- package/skills/hmos-integration-test/SKILL.md +63 -52
- package/skills/hmos-resources-convert/SKILL.md +5 -5
- package/skills/hmos-resources-convert/references/conversion-rules.md +663 -663
- package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +388 -388
- package/skills/hmos-resources-convert/references/resource-mapping-rules.md +457 -457
- package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +513 -513
- package/skills/hmos-spec-generate/SKILL.md +19 -19
- package/skills/hmos-spec-generate/references/android-platform-tokens.md +105 -105
- package/skills/hmos-spec-generate/references/spec-sample-1.md +78 -78
- package/skills/hmos-spec-generate/references/spec-sample-2.md +58 -58
- package/skills/hmos-spec-generate/references/spec-sample-3.md +116 -116
- package/skills/hmos-spec-generate/references/step4-report-template.md +33 -33
- package/tools/test-tools/autotest/README.md +33 -17
- package/tools/test-tools/autotest/self_test_runner.py +109 -15
- package/resource/hometrans_config.png +0 -0
- package/skills/hmos-incremental-ui-align/config-example.json +0 -11
- package/tools/test-tools/autotest/config.yaml.example +0 -58
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# 管理应用拥有的状态概述
|
|
2
|
-
|
|
3
|
-
在管理组件拥有的状态章节中介绍的装饰器仅能在页面内,即一个组件树上共享状态变量。如果开发者要实现应用级的,或者多个页面的状态数据共享,就需要用到应用级别的状态管理的概念。ArkTS根据不同特性,提供了多种应用状态管理的能力:
|
|
4
|
-
|
|
5
|
-
- [LocalStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-localstorage):页面级UI状态存储,通常用于[UIAbility](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-app-ability-uiability)内、页面间的状态共享。
|
|
6
|
-
|
|
7
|
-
- [AppStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-appstorage):特殊的单例LocalStorage对象,由UI框架在应用程序启动时创建,为应用程序UI状态属性提供中央存储。
|
|
8
|
-
|
|
9
|
-
- [PersistentStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-persiststorage):持久化存储UI状态,通常和AppStorage配合使用,选择AppStorage存储的数据写入磁盘,以确保这些属性在应用程序重新启动时的值与应用程序关闭时的值相同。
|
|
10
|
-
|
|
11
|
-
- [Environment](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-environment):应用程序运行的设备的环境参数,环境参数会同步到AppStorage中,可以和AppStorage搭配使用。
|
|
1
|
+
# 管理应用拥有的状态概述
|
|
2
|
+
|
|
3
|
+
在管理组件拥有的状态章节中介绍的装饰器仅能在页面内,即一个组件树上共享状态变量。如果开发者要实现应用级的,或者多个页面的状态数据共享,就需要用到应用级别的状态管理的概念。ArkTS根据不同特性,提供了多种应用状态管理的能力:
|
|
4
|
+
|
|
5
|
+
- [LocalStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-localstorage):页面级UI状态存储,通常用于[UIAbility](https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-app-ability-uiability)内、页面间的状态共享。
|
|
6
|
+
|
|
7
|
+
- [AppStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-appstorage):特殊的单例LocalStorage对象,由UI框架在应用程序启动时创建,为应用程序UI状态属性提供中央存储。
|
|
8
|
+
|
|
9
|
+
- [PersistentStorage](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-persiststorage):持久化存储UI状态,通常和AppStorage配合使用,选择AppStorage存储的数据写入磁盘,以确保这些属性在应用程序重新启动时的值与应用程序关闭时的值相同。
|
|
10
|
+
|
|
11
|
+
- [Environment](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/arkts-environment):应用程序运行的设备的环境参数,环境参数会同步到AppStorage中,可以和AppStorage搭配使用。
|
|
@@ -15,33 +15,47 @@ Run all conversion agents in sequence, passing outputs between stages and record
|
|
|
15
15
|
|
|
16
16
|
Parse `$ARGUMENTS` as positional tokens:
|
|
17
17
|
|
|
18
|
-
- **Arg 1** (`
|
|
19
|
-
- **Arg 2** (`
|
|
20
|
-
- **Arg 3** (`
|
|
21
|
-
- **Arg 4** (`
|
|
22
|
-
- **Arg 5** (`
|
|
23
|
-
- **Arg 6** (`
|
|
24
|
-
- **Arg 7** (`
|
|
25
|
-
- **Arg 8** (`
|
|
26
|
-
- **Arg 9** (`
|
|
18
|
+
- **Arg 1** (`android_project_dir`): Path to the Android source project (required)
|
|
19
|
+
- **Arg 2** (`harmony_project_dir`): Path to the target HarmonyOS project directory (required)
|
|
20
|
+
- **Arg 3** (`spec_file_path`): Path to the requirement spec document (required). This is the plan/spec that drives Stage 1 logic development and Stage 3 code review — both stages read it directly from this path.
|
|
21
|
+
- **Arg 4** (`assets_output_path`): Directory to store all output/report files (optional). When omitted, default to `<harmony_project_dir>/.hometrans` — create the directory if it does not exist.
|
|
22
|
+
- **Arg 5** (`test_case_path`): Path to the self-test case file driving the Stage 4 self-testing loop (optional). When omitted, default to `OUTPUT/test_case.md`. If the resolved file does not exist, the Stage 4 loop is skipped (see Loop Setup).
|
|
23
|
+
- **Arg 6** (`pre_test_case_path`): Path to the pre-test case file (optional). When omitted, default to `OUTPUT/pre_test_case.md`. Only passed to the self-tester when the resolved file exists.
|
|
24
|
+
- **Arg 7** (`max_rounds_review`): Maximum number of Stage 3→3a→3b code-review-fix rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
|
|
25
|
+
- **Arg 8** (`max_rounds_test`): Maximum number of Stage 4→4a→4b self-test rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
|
|
26
|
+
- **Arg 9** (`skip_test`): `true` or `false` (optional, default `false`). When `true`, skip Stage 4 / 4a / 4b (Self-Testing Loop) entirely. Use this when no real HarmonyOS device is available for on-device testing.
|
|
27
27
|
|
|
28
|
-
Args are positional: to pass any optional arg, provide explicit values for all optional args before it (e.g., passing `
|
|
28
|
+
Args are positional: to pass any optional arg, provide explicit values for all optional args before it (e.g., passing `test_case_path` requires an explicit `assets_output_path`; passing `skip_test` requires explicit Args 4–8).
|
|
29
29
|
|
|
30
|
-
If any required argument is missing, ask the user before proceeding. If `
|
|
30
|
+
If any required argument is missing, ask the user before proceeding. If `spec_file_path` does not exist or is not a readable file, ask the user before proceeding. If `max_rounds_review` or `max_rounds_test` is provided but is not a positive integer, ask the user before proceeding. If `skip_test` is provided but is not `true` or `false`, ask the user before proceeding.
|
|
31
31
|
|
|
32
32
|
Define shorthand variables for the instructions below:
|
|
33
33
|
|
|
34
34
|
| Variable | Meaning |
|
|
35
35
|
|----------|---------|
|
|
36
|
-
| `ANDROID` |
|
|
37
|
-
| `HMOS` |
|
|
38
|
-
| `SPEC` |
|
|
39
|
-
| `OUTPUT` |
|
|
40
|
-
| `TEST_CASE` |
|
|
41
|
-
| `PRE_TEST_CASE` |
|
|
42
|
-
| `MAX_ROUNDS_REVIEW` |
|
|
43
|
-
| `MAX_ROUNDS_TEST` |
|
|
44
|
-
| `SKIP_TEST` |
|
|
36
|
+
| `ANDROID` | android_project_dir |
|
|
37
|
+
| `HMOS` | harmony_project_dir |
|
|
38
|
+
| `SPEC` | spec_file_path — requirement spec document, consumed directly by Stage 1 (`spec_file`) and Stage 3 (`test_case_path`) |
|
|
39
|
+
| `OUTPUT` | assets_output_path; defaults to `HMOS/.hometrans` when not provided (created on demand) |
|
|
40
|
+
| `TEST_CASE` | test_case_path; defaults to `OUTPUT/test_case.md` when not provided |
|
|
41
|
+
| `PRE_TEST_CASE` | pre_test_case_path; defaults to `OUTPUT/pre_test_case.md` when not provided |
|
|
42
|
+
| `MAX_ROUNDS_REVIEW` | max_rounds_review — positive integer (default `2`). Controls Stage 3→3a→3b code-review-fix loop. |
|
|
43
|
+
| `MAX_ROUNDS_TEST` | max_rounds_test — positive integer (default `2`). Controls Stage 4→4a→4b self-test loop. |
|
|
44
|
+
| `SKIP_TEST` | skip_test — `true` or `false` (default `false`). When `true`, skip Stage 4 / 4a / 4b entirely (no real device available). |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Environment Variables Check (run before Stage 1)
|
|
49
|
+
|
|
50
|
+
The pipeline's sub-agents read their settings **directly from the OS environment variables**. Verify upfront so the long pipeline fails fast (read each from the OS environment: `echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows):
|
|
51
|
+
|
|
52
|
+
| Variable | Needed for | Valid when |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `DEVECO_HOME` *(or `DEVECO_SDK_HOME`)* | Stage 2 build + Stage 3a/4b rebuilds | resolves to a valid DevEco install |
|
|
55
|
+
| `TEST_API_KEY` | Stage 4 self-test (only when `SKIP_TEST=false`) | non-empty |
|
|
56
|
+
| `HOMETRANS_TOOL_PATH` | Stage 4 self-test AutoTest dir; defaults to `~/.hometrans/tools` | path exists on disk |
|
|
57
|
+
|
|
58
|
+
If `DEVECO_HOME`/`DEVECO_SDK_HOME` is missing, **ask the user** for the DevEco Studio install path before starting. When `SKIP_TEST=false`, also require `TEST_API_KEY` — if missing, **ask the user** for it (or have them pass `skip_test=true`). Suggest running `ht init` to persist these as machine environment variables.
|
|
45
59
|
|
|
46
60
|
---
|
|
47
61
|
|
|
@@ -155,7 +169,7 @@ Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines b
|
|
|
155
169
|
```
|
|
156
170
|
Agent(
|
|
157
171
|
subagent_type="logic-context-builder",
|
|
158
|
-
prompt="
|
|
172
|
+
prompt="harmony_project_dir: HMOS\nspec_file: SPEC\noutput_path: OUTPUT/logic"
|
|
159
173
|
)
|
|
160
174
|
```
|
|
161
175
|
2. Verify `OUTPUT/logic/plan.md` exists.
|
|
@@ -166,16 +180,16 @@ Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines b
|
|
|
166
180
|
```
|
|
167
181
|
Agent(
|
|
168
182
|
subagent_type="logic-coder",
|
|
169
|
-
prompt="
|
|
183
|
+
prompt="harmony_project_dir: HMOS\nplan_file: OUTPUT/logic/plan.md\noutput_path: OUTPUT/logic"
|
|
170
184
|
)
|
|
171
185
|
```
|
|
172
|
-
2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md` and verify it contains a hex `
|
|
186
|
+
2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md` and verify it contains a hex `commit_id`.
|
|
173
187
|
3. `OUTPUT/logic/coding-summary.md` is human-readable auxiliary; downstream stages consume only `OUTPUT/commit-info.md`.
|
|
174
188
|
|
|
175
189
|
### Stage 2 — Compilation and Build
|
|
176
190
|
|
|
177
191
|
1. Launch the **build-fixer** agent with `--signed`.
|
|
178
|
-
2. Input: `
|
|
192
|
+
2. Input: `harmony_project_dir`: `HMOS`, `output_path`: `OUTPUT`.
|
|
179
193
|
3. The agent runs the build-fix loop (up to 20 iterations), writes `build-fix-report.md` into `OUTPUT`.
|
|
180
194
|
4. If the build succeeds, the signed `.hap` is copied to `OUTPUT`. Note its location in the manifest.
|
|
181
195
|
5. After the agent completes, read `OUTPUT/build-fix-commit-info.md` and note the commit ID (may be a real hash or `none`).
|
|
@@ -187,9 +201,9 @@ Treat Stage 3 → 3a → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times.
|
|
|
187
201
|
#### Review Loop Setup
|
|
188
202
|
|
|
189
203
|
1. **Resolve the initial commit ID for code review** using the following priority:
|
|
190
|
-
- Read `OUTPUT/commit-info.md` (written by Stage 1). If `
|
|
204
|
+
- Read `OUTPUT/commit-info.md` (written by Stage 1). If `commit_id` is a real hash, use it.
|
|
191
205
|
- IMPORTANT: Use `commit-info.md` from Stage 1, NOT `build-fix-commit-info.md` from Stage 2. The first review must target the logic-dev commit, not the build-fix commit.
|
|
192
|
-
- If neither file exists or both have `
|
|
206
|
+
- If neither file exists or both have `commit_id: none`, the code-reviewer agent will review the project holistically without commit-scoped extraction.
|
|
193
207
|
- Store this as `REVIEW_COMMIT_ID`.
|
|
194
208
|
2. Initialize loop state:
|
|
195
209
|
- `review_round = 1`
|
|
@@ -205,11 +219,11 @@ For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUT
|
|
|
205
219
|
|
|
206
220
|
1. Launch the **code-reviewer** agent.
|
|
207
221
|
2. Input:
|
|
208
|
-
- `
|
|
209
|
-
- `
|
|
210
|
-
- `
|
|
211
|
-
- `
|
|
212
|
-
3. If a valid `
|
|
222
|
+
- `harmony_project_dir`: `HMOS`
|
|
223
|
+
- `commit_id`: For Round 1, use `REVIEW_COMMIT_ID`. For Round 2+, review the project holistically (omit `commit_id` or pass `none`) since fixes have modified the codebase beyond the original commit scope.
|
|
224
|
+
- `output_path`: `REVIEW_ROUND_DIR`
|
|
225
|
+
- `test_case_path`: `SPEC`
|
|
226
|
+
3. If a valid `commit_id` is available, the agent will automatically call the `extract_commit_context` MCP tool to extract commit-scoped code context before reviewing. If the MCP call fails, the agent falls back to direct git-diff analysis. If no `commit_id` is available, the agent reviews the project holistically without commit-scoped extraction.
|
|
213
227
|
4. The agent writes `REVIEW_ROUND_DIR/code-review-report.md` with per-scenario verdicts.
|
|
214
228
|
5. **Extract defect stats**: Read `REVIEW_ROUND_DIR/code-review-report.md`, extract the verdict breakdown (PASS/PARTIAL/FAIL/UNABLE TO VERIFY counts) and overall verdict.
|
|
215
229
|
6. Compute `review_all_passed`:
|
|
@@ -224,10 +238,10 @@ For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUT
|
|
|
224
238
|
1. Mark Stage 3a `in_progress` when the first Stage 3a round begins.
|
|
225
239
|
2. Launch the **review-fixer** agent.
|
|
226
240
|
3. Input:
|
|
227
|
-
- `
|
|
228
|
-
- `
|
|
229
|
-
- `
|
|
230
|
-
- `
|
|
241
|
+
- `review_report_path`: `REVIEW_ROUND_DIR/code-review-report.md`
|
|
242
|
+
- `harmony_project_dir`: `HMOS`
|
|
243
|
+
- `android_project_dir`: `ANDROID`
|
|
244
|
+
- `output_path`: `REVIEW_ROUND_DIR`
|
|
231
245
|
4. The agent verifies each issue from the code review report, fixes confirmed issues, and writes `REVIEW_ROUND_DIR/review-fix-report.md`.
|
|
232
246
|
5. **Extract defect stats**: Read `REVIEW_ROUND_DIR/review-fix-report.md`, extract total issues, confirmed, false positives, successfully fixed, failed to fix, and fix success rate.
|
|
233
247
|
6. Compute `review_no_confirmed_defects`:
|
|
@@ -239,7 +253,7 @@ For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUT
|
|
|
239
253
|
|
|
240
254
|
1. Mark Stage 3b `in_progress` when the first Stage 3b round begins.
|
|
241
255
|
2. Launch the **build-fixer** agent with `--signed`.
|
|
242
|
-
3. Input: `
|
|
256
|
+
3. Input: `harmony_project_dir`: `HMOS`, `output_path`: `REVIEW_ROUND_DIR`.
|
|
243
257
|
4. The agent writes `REVIEW_ROUND_DIR/build-fix-report.md`.
|
|
244
258
|
5. If the build succeeds, the signed `.hap` is copied to `REVIEW_ROUND_DIR`. Note its location in the manifest.
|
|
245
259
|
6. Append one Defect Summary row for this round by combining the parsed Stage 3 and Stage 3a results into a single row labeled `3 Loop - Round {review_round}`.
|
|
@@ -277,7 +291,7 @@ Stage 3b is executed as **Review Round Step C** inside the Stage 3 loop above. D
|
|
|
277
291
|
|
|
278
292
|
### Stage 4 — Self-Testing Loop (On-Device Verification)
|
|
279
293
|
|
|
280
|
-
**Skip check**: If `SKIP_TEST == true`, immediately mark Stage 4 / 4a / 4b as `completed` with description "Skipped —
|
|
294
|
+
**Skip check**: If `SKIP_TEST == true`, immediately mark Stage 4 / 4a / 4b as `completed` with description "Skipped — skip_test=true (no real device available)". Record a single Duration Summary row with `Duration = SKIPPED`. Add a note in the manifest: `Stage 4 loop skipped by user configuration (skip_test=true)`. Then proceed directly to the **Final Summary**.
|
|
281
295
|
|
|
282
296
|
Treat Stage 4 → 4a → 4b as a loop that runs up to `MAX_ROUNDS_TEST` times.
|
|
283
297
|
|
|
@@ -303,14 +317,14 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
|
|
|
303
317
|
1. If `CURRENT_HAP` is missing, do **not** launch the test. Record this round as Stage 4 failure with note "No HAP file available — build may have failed in Stage 2/3b or a previous 4b round".
|
|
304
318
|
2. If `CURRENT_HAP` exists, launch the **self-tester**.
|
|
305
319
|
3. Input (round 1):
|
|
306
|
-
- `
|
|
307
|
-
- `
|
|
308
|
-
- `
|
|
309
|
-
- `
|
|
320
|
+
- `hap_path`: `CURRENT_HAP`
|
|
321
|
+
- `output_path`: `OUTPUT` (the ROOT — the agent always writes here)
|
|
322
|
+
- `test_case_path`: `TEST_CASE`
|
|
323
|
+
- `pre_test_case_path`: `PRE_TEST_CASE` (only include this line when the file exists)
|
|
310
324
|
- `setup`: `true`
|
|
311
325
|
4. Input (round 2+):
|
|
312
|
-
- `
|
|
313
|
-
- `
|
|
326
|
+
- `hap_path`: `CURRENT_HAP`
|
|
327
|
+
- `output_path`: `OUTPUT` (still the ROOT)
|
|
314
328
|
- `setup`: `false`
|
|
315
329
|
5. The agent verifies device connectivity, invokes `self_test_runner.py run` to set up the environment (`uv sync`), install the HAP, and run test cases. **Pre-cases are folded into `OUTPUT/testcases.json` by the agent's S4/S5 step during round 1's `setup: true` invocation; they run first in the same batch — no separate pre-case file or parameter is needed downstream.** The agent writes `OUTPUT/self-test-report.md`, `OUTPUT/task/`, and (round 1 only) `OUTPUT/testcases.json` + `OUTPUT/app-metadata.json` + `OUTPUT/_extracted.json`.
|
|
316
330
|
6. After round 1's agent returns, read `OUTPUT/app-metadata.json` and extract `project_root` → `PROJECT_ROOT`. For round 2+, re-read `OUTPUT/app-metadata.json` before invoking the agent; if the previous round's `OUTPUT/round-{round-1}/app-metadata.json` exists (build-fixer may have written one for a relocated project root), the round-dir copy overrides the root copy for this round.
|
|
@@ -328,10 +342,10 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
|
|
|
328
342
|
1. Mark Stage 4a `in_progress` when the first Stage 4a round begins.
|
|
329
343
|
2. If `ROUND_DIR/self-test-report.md` exists, launch the **self-test-fixer** agent.
|
|
330
344
|
3. Input:
|
|
331
|
-
- `
|
|
332
|
-
- `
|
|
333
|
-
- `
|
|
334
|
-
- `
|
|
345
|
+
- `self_test_report_path`: `ROUND_DIR/self-test-report.md`
|
|
346
|
+
- `harmony_project_dir`: `HMOS`
|
|
347
|
+
- `android_project_dir`: `ANDROID`
|
|
348
|
+
- `output_path`: `ROUND_DIR`
|
|
335
349
|
4. The agent analyzes failed feature points from the self-test report, references Android source for correct behavior, fixes HarmonyOS code, and writes `ROUND_DIR/self-test-fix-report.md`.
|
|
336
350
|
5. If `ROUND_DIR/self-test-report.md` is missing, do **not** launch the fixer. Record this round as `Skipped — missing self-test report`.
|
|
337
351
|
6. Read `ROUND_DIR/self-test-fix-report.md` when it exists, extract total failed scenarios, confirmed, false positives, successfully fixed, and failed to fix.
|
|
@@ -344,7 +358,7 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
|
|
|
344
358
|
|
|
345
359
|
1. Mark Stage 4b `in_progress` when the first Stage 4b round begins.
|
|
346
360
|
2. Launch the **build-fixer** agent with `--signed`.
|
|
347
|
-
3. Input: `
|
|
361
|
+
3. Input: `harmony_project_dir`: `HMOS`, `output_path`: `ROUND_DIR`.
|
|
348
362
|
4. The agent writes `ROUND_DIR/build-fix-report.md`.
|
|
349
363
|
5. ⚠️ **CRITICAL — Update `CURRENT_HAP` for the next round**: If the build succeeds, the signed `.hap` is copied to `ROUND_DIR`. You **MUST** update `CURRENT_HAP` so that the next round's Stage 4 self-tester uses the newly built HAP (not the original one). Update using this priority:
|
|
350
364
|
- `ROUND_DIR/entry-default-signed.hap`
|
|
@@ -409,7 +423,7 @@ After the Stage 4 loop completes (or is skipped), print a concise summary:
|
|
|
409
423
|
1. Overall pipeline status (all green, or which stages had issues)
|
|
410
424
|
2. Location of `OUTPUT/pipeline-manifest.md` for full details
|
|
411
425
|
3. Stage 3 review loop summary: `MAX_ROUNDS_REVIEW`, `review_rounds_executed`, `review_stop_reason`, final review round directory
|
|
412
|
-
4. Stage 4 test loop summary: If `SKIP_TEST == true`, print "Stage 4 skipped (
|
|
426
|
+
4. Stage 4 test loop summary: If `SKIP_TEST == true`, print "Stage 4 skipped (skip_test=true, no real device)". Otherwise print `MAX_ROUNDS_TEST`, `rounds_executed`, `stop_reason`, final round directory.
|
|
413
427
|
5. Key statistics: total files generated, self-test results (or "N/A — testing skipped" if `SKIP_TEST == true`)
|
|
414
428
|
6. Defect summary: total defects found (code review + testing), total fixed, total remaining unfixed
|
|
415
429
|
7. Recommended next steps (if testing was skipped, recommend running on-device tests when a real device becomes available)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hmos-fix-build-errors
|
|
3
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).
|
|
4
|
-
argument-hint: <
|
|
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
|
|
7
7
|
domain: engineering
|
|
@@ -21,11 +21,10 @@ Automatically build a HarmonyOS NEXT project from the command line, parse compil
|
|
|
21
21
|
|
|
22
22
|
1. **Verify project exists** — Check that `$ARGUMENTS[0]` contains a valid HarmonyOS project (look for `build-profile.json5`, `entry/src` directory, `oh-package.json5`).
|
|
23
23
|
|
|
24
|
-
2. **Resolve `<deveco-path>`** — stop at the first source that yields a valid path:
|
|
24
|
+
2. **Resolve `<deveco-path>`** — read **directly from the OS environment**; stop at the first source that yields a valid path:
|
|
25
25
|
1. `$ARGUMENTS[1]` if provided (and not `--signed`).
|
|
26
|
-
2.
|
|
27
|
-
3.
|
|
28
|
-
4. **Ask the user** for the DevEco Studio install path (suggest running `ht init` to persist it).
|
|
26
|
+
2. Environment variables (`echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows): `DEVECO_HOME` → parent of `DEVECO_SDK_HOME` → strip the trailing `/sdk/default/openharmony/ets` from `OHOS_SDK_PATH` (legacy).
|
|
27
|
+
3. **Ask the user** for the DevEco Studio install path (suggest running `ht init` to persist it as an environment variable).
|
|
29
28
|
|
|
30
29
|
**Verify the resolved `<deveco-path>`** contains:
|
|
31
30
|
- `tools/node/node.exe`
|
|
@@ -33,7 +32,7 @@ Automatically build a HarmonyOS NEXT project from the command line, parse compil
|
|
|
33
32
|
- `tools/ohpm/bin/ohpm`
|
|
34
33
|
- `sdk/` directory
|
|
35
34
|
|
|
36
|
-
If verification fails for
|
|
35
|
+
If verification fails for an env-sourced path, treat that source as invalid and continue down the list; if it fails for a user-supplied path, report what is missing and ask again.
|
|
37
36
|
|
|
38
37
|
3. **Set up `local.properties`** — Ensure the project root has `local.properties` with:
|
|
39
38
|
```properties
|