@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
package/agents/build-fixer.md
CHANGED
|
@@ -14,8 +14,8 @@ Execute a build-fix loop: resolve environment → validate project → build →
|
|
|
14
14
|
|
|
15
15
|
## Expected Input
|
|
16
16
|
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
17
|
+
- `harmony_project_dir`: Absolute path to the HarmonyOS project root (the directory containing `build-profile.json5`) — **required**
|
|
18
|
+
- `output_path`: Absolute path to the directory where `build-fix-report.md` should be written — **optional** (defaults to cwd)
|
|
19
19
|
- `--signed`: Optional flag. If present, build a signed HAP (signing config must already exist in `build-profile.json5`). Default is unsigned.
|
|
20
20
|
|
|
21
21
|
## Expected Output
|
|
@@ -29,34 +29,24 @@ Execute a build-fix loop: resolve environment → validate project → build →
|
|
|
29
29
|
|
|
30
30
|
The build requires the **DevEco Studio installation path**, from which Node.js, hvigor, and ohpm are derived.
|
|
31
31
|
|
|
32
|
-
### 0a. Read the
|
|
33
|
-
|
|
34
|
-
Read the
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"OHOS_SDK_PATH": "...", // <DEVECO_SDK_HOME>/default/openharmony/ets (derived)
|
|
43
|
-
"HMS_SDK_PATH": "...", // <DEVECO_SDK_HOME>/default/hms/ets (derived)
|
|
44
|
-
"TEST_API_KEY": "...",
|
|
45
|
-
"TOOL_PATH": "..." // HomeTrans tools dir, e.g. "C:/Users/<you>/.hometrans/tools"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
```
|
|
32
|
+
### 0a. Read the DevEco environment variables
|
|
33
|
+
|
|
34
|
+
Read these **directly from the OS environment** — `ht init` persists them as machine environment variables (`echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows):
|
|
35
|
+
|
|
36
|
+
| Variable | Meaning |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `DEVECO_SDK_HOME` | DevEco sdk dir, e.g. `D:/DevEco Studio/sdk` — single source of truth |
|
|
39
|
+
| `DEVECO_HOME` | DevEco install root, e.g. `D:/DevEco Studio` |
|
|
40
|
+
| `OHOS_SDK_PATH` | `<DEVECO_SDK_HOME>/default/openharmony/ets` |
|
|
41
|
+
| `HMS_SDK_PATH` | `<DEVECO_SDK_HOME>/default/hms/ets` |
|
|
49
42
|
|
|
50
|
-
### 0b. Resolve the DevEco root `<deveco>` —
|
|
43
|
+
### 0b. Resolve the DevEco root `<deveco>` — env vars first, then auto-detect, then ask
|
|
51
44
|
|
|
52
45
|
Stop at the **first** source that yields a path:
|
|
53
46
|
|
|
54
|
-
1. **
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- else (legacy configs) strip the trailing `/sdk/default/openharmony/ets` from `env.OHOS_SDK_PATH` (or `/sdk/default/hms/ets` from `env.HMS_SDK_PATH`) to get `<deveco>`.
|
|
58
|
-
2. **Environment variables** (same precedence): `DEVECO_PATH` → `DEVECO_SDK_HOME` (parent dir) → `OHOS_SDK_PATH` / `HMS_SDK_PATH` (strip suffix as above).
|
|
59
|
-
3. **Auto-detect** (0c below). If that also fails, **ask the user** for the DevEco Studio install path.
|
|
47
|
+
1. **Environment variables**: `DEVECO_HOME` if non-empty → that is `<deveco>`; else `DEVECO_SDK_HOME` → `<deveco>` is its **parent directory**; else (legacy) strip the trailing `/sdk/default/openharmony/ets` from `OHOS_SDK_PATH` (or `/sdk/default/hms/ets` from `HMS_SDK_PATH`) to get `<deveco>`.
|
|
48
|
+
2. **Auto-detect** (0c below).
|
|
49
|
+
3. If both fail, **ask the user** for the DevEco Studio install path (suggest running `ht init` to persist it as an environment variable).
|
|
60
50
|
|
|
61
51
|
> Example: `DEVECO_SDK_HOME = D:/DevEco Studio/sdk` → `<deveco> = D:/DevEco Studio`.
|
|
62
52
|
|
|
@@ -66,11 +56,11 @@ From `<deveco>`, derive:
|
|
|
66
56
|
- **ohpm**: `<deveco>/tools/ohpm/bin/ohpm`
|
|
67
57
|
- **SDK directory**: `<deveco>/sdk`
|
|
68
58
|
|
|
69
|
-
Verify these files exist. If they do, use them and skip auto-detection. If
|
|
59
|
+
Verify these files exist. If they do, use them and skip auto-detection. If an env-sourced path does **not** exist on disk, treat that source as invalid and continue down the resolution order.
|
|
70
60
|
|
|
71
|
-
### 0c. Auto-detect if
|
|
61
|
+
### 0c. Auto-detect if env vars are missing or invalid
|
|
72
62
|
|
|
73
|
-
If
|
|
63
|
+
If the environment variables do not yield a valid install, auto-detect:
|
|
74
64
|
|
|
75
65
|
1. **Find DevEco Studio installation**:
|
|
76
66
|
- Search common locations: `D:\DevEco Studio`, `C:\DevEco Studio`, `C:\Program Files\DevEco Studio`
|
|
@@ -86,7 +76,7 @@ If auto-detection fails for any critical path, **ask the user directly** for the
|
|
|
86
76
|
### 0d. Store resolved paths
|
|
87
77
|
|
|
88
78
|
Keep these resolved values for use in later steps:
|
|
89
|
-
- `
|
|
79
|
+
- `DEVECO_HOME` — absolute path to DevEco Studio installation root
|
|
90
80
|
- `NODE_EXE` — absolute path to node executable
|
|
91
81
|
- `HVIGORW_JS` — absolute path to hvigorw.js
|
|
92
82
|
- `OHPM` — absolute path to ohpm executable
|
|
@@ -95,14 +85,14 @@ Keep these resolved values for use in later steps:
|
|
|
95
85
|
|
|
96
86
|
## Step 1: Validate Inputs & Setup Project
|
|
97
87
|
|
|
98
|
-
1. **Verify project exists** — Check that `
|
|
88
|
+
1. **Verify project exists** — Check that `harmony_project_dir` contains:
|
|
99
89
|
- `build-profile.json5`
|
|
100
90
|
- `entry/src` directory
|
|
101
91
|
- `oh-package.json5`
|
|
102
92
|
|
|
103
93
|
2. **Set up `local.properties`** — Ensure the project root has `local.properties` with:
|
|
104
94
|
```properties
|
|
105
|
-
hwsdk.dir=<
|
|
95
|
+
hwsdk.dir=<DEVECO_HOME>/sdk
|
|
106
96
|
```
|
|
107
97
|
Create it if missing. Use forward slashes in the path.
|
|
108
98
|
|
|
@@ -152,19 +142,19 @@ Execute the following loop. **Maximum 20 iterations** to prevent infinite loops.
|
|
|
152
142
|
**For unsigned builds** (no `--signed`):
|
|
153
143
|
```bat
|
|
154
144
|
@echo off
|
|
155
|
-
set "DEVECO_SDK_HOME=<
|
|
145
|
+
set "DEVECO_SDK_HOME=<DEVECO_HOME>\sdk"
|
|
156
146
|
cd /d "<project-dir>"
|
|
157
|
-
"<
|
|
147
|
+
"<DEVECO_HOME>\tools\node\node.exe" "<DEVECO_HOME>\tools\hvigor\bin\hvigorw.js" assembleHap --mode module -p module=entry --no-daemon
|
|
158
148
|
```
|
|
159
149
|
|
|
160
150
|
**For signed builds** (`--signed`):
|
|
161
151
|
```bat
|
|
162
152
|
@echo off
|
|
163
|
-
set "PATH=<
|
|
164
|
-
set "JAVA_HOME=<
|
|
165
|
-
set "DEVECO_SDK_HOME=<
|
|
153
|
+
set "PATH=<DEVECO_HOME>\jbr\bin;%PATH%"
|
|
154
|
+
set "JAVA_HOME=<DEVECO_HOME>\jbr"
|
|
155
|
+
set "DEVECO_SDK_HOME=<DEVECO_HOME>\sdk"
|
|
166
156
|
cd /d "<project-dir>"
|
|
167
|
-
"<
|
|
157
|
+
"<DEVECO_HOME>\tools\node\node.exe" "<DEVECO_HOME>\tools\hvigor\bin\hvigorw.js" assembleHap --mode module -p module=entry --no-daemon
|
|
168
158
|
```
|
|
169
159
|
Note: Signed builds need `JAVA_HOME` and `jbr\bin` in PATH because the `SignHap` step spawns `java` as a child process.
|
|
170
160
|
|
|
@@ -238,16 +228,16 @@ Then go back to **2.1** and rebuild.
|
|
|
238
228
|
|
|
239
229
|
## Step 2.6: Copy HAP to Output Directory
|
|
240
230
|
|
|
241
|
-
If `
|
|
231
|
+
If `output_path` was provided, copy the built HAP file to the output directory after a successful build:
|
|
242
232
|
|
|
243
233
|
1. **Locate the HAP file** under `<project-dir>/entry/build/default/outputs/default/`:
|
|
244
234
|
- If `--signed`: search for `*-signed.hap`
|
|
245
235
|
- If unsigned (no `--signed`): search for `*-unsigned.hap`
|
|
246
236
|
2. **Copy** the HAP to the output directory:
|
|
247
237
|
```bash
|
|
248
|
-
cp "<
|
|
238
|
+
cp "<hap_path>" "<output_path>/"
|
|
249
239
|
```
|
|
250
|
-
3. **Verify** the copied file exists in `
|
|
240
|
+
3. **Verify** the copied file exists in `output_path`.
|
|
251
241
|
4. If no matching HAP is found, report the issue in `build-fix-report.md` and note the expected path.
|
|
252
242
|
|
|
253
243
|
---
|
|
@@ -297,25 +287,25 @@ Files modified: {comma-separated list of modified files}
|
|
|
297
287
|
cd "<project-dir>" && git rev-parse HEAD
|
|
298
288
|
```
|
|
299
289
|
|
|
300
|
-
4. **Write commit info** to `<
|
|
290
|
+
4. **Write commit info** to `<output_path>/build-fix-commit-info.md`:
|
|
301
291
|
```
|
|
302
|
-
|
|
292
|
+
commit_id: <commit_id>
|
|
303
293
|
```
|
|
304
294
|
|
|
305
295
|
**If no source files were modified** (build succeeded on first attempt with zero errors):
|
|
306
|
-
- Write `<
|
|
296
|
+
- Write `<output_path>/build-fix-commit-info.md` with:
|
|
307
297
|
```
|
|
308
|
-
|
|
298
|
+
commit_id: none
|
|
309
299
|
```
|
|
310
300
|
|
|
311
301
|
**If not in a git repository**:
|
|
312
302
|
- Record issue "Not a git repository — skipped commit" in `build-fix-report.md`.
|
|
313
|
-
- Write `<
|
|
303
|
+
- Write `<output_path>/build-fix-commit-info.md` with:
|
|
314
304
|
```
|
|
315
|
-
|
|
305
|
+
commit_id: none
|
|
316
306
|
```
|
|
317
307
|
|
|
318
|
-
**If `
|
|
308
|
+
**If `output_path` was not provided**, skip writing `build-fix-commit-info.md`.
|
|
319
309
|
|
|
320
310
|
---
|
|
321
311
|
|
package/agents/code-reviewer.md
CHANGED
|
@@ -14,14 +14,14 @@ Read the user scenario design document, then systematically verify the HarmonyOS
|
|
|
14
14
|
|
|
15
15
|
## Expected Input
|
|
16
16
|
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
17
|
+
- `harmony_project_dir`: Absolute path to the HarmonyOS project root (directory containing ArkTS source code)
|
|
18
|
+
- `commit_id`: The commit ID of the code submission to review (required)
|
|
19
|
+
- `output_path`: Absolute path to the directory where the review report should be written (required)
|
|
20
|
+
- `test_case_path`: Absolute path to the user scenario design document. If not provided, defaults to `<output_path>/test_case.md`
|
|
21
21
|
|
|
22
22
|
## Expected Output
|
|
23
23
|
|
|
24
|
-
- A file named `code-review-report.md` in `
|
|
24
|
+
- A file named `code-review-report.md` in `output_path`
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -30,19 +30,19 @@ Read the user scenario design document, then systematically verify the HarmonyOS
|
|
|
30
30
|
Before starting the review, extract the code context for the commit via the `extract_commit_context` MCP tool.
|
|
31
31
|
|
|
32
32
|
1. **Call the MCP tool** `extract_commit_context` with:
|
|
33
|
-
- `projectPath`: `<
|
|
34
|
-
- `commitId`: `<
|
|
33
|
+
- `projectPath`: `<harmony_project_dir>` (absolute path to the HarmonyOS project root containing the `.git` directory)
|
|
34
|
+
- `commitId`: `<commit_id>` (the git commit to analyze — diffs against its first parent)
|
|
35
35
|
- `mode`: `"default"` (builds full call graph for call-chain context)
|
|
36
|
-
- `ohosSdkPath` / `hmsSdkPath`: the OpenHarmony / HMS SDK ETS directory paths. Resolve each
|
|
37
|
-
1. `
|
|
38
|
-
2. Omit the parameter to let the tool read `OHOS_SDK_PATH` / `HMS_SDK_PATH` from the environment
|
|
39
|
-
3. If
|
|
36
|
+
- `ohosSdkPath` / `hmsSdkPath`: the OpenHarmony / HMS SDK ETS directory paths. Resolve each **from the OS environment**, stopping at the first hit:
|
|
37
|
+
1. `OHOS_SDK_PATH` / `HMS_SDK_PATH` environment variables; if those are empty but `DEVECO_SDK_HOME` is set, derive them as `<DEVECO_SDK_HOME>/default/openharmony/ets` and `<DEVECO_SDK_HOME>/default/hms/ets`.
|
|
38
|
+
2. Omit the parameter to let the tool read `OHOS_SDK_PATH` / `HMS_SDK_PATH` from the environment itself.
|
|
39
|
+
3. If the environment provides no path that exists on disk, **ask the user** for the DevEco `sdk` directory (and suggest running `ht init` to persist it as an environment variable).
|
|
40
40
|
|
|
41
41
|
2. **On success** — the tool returns the affected code context (diffs, call graphs, impacted files). Treat this response as the **code context** for the review.
|
|
42
42
|
|
|
43
43
|
3. **On failure** — if the MCP tool call fails (network error, tool unavailable, or returns an error), fall back to direct commit analysis:
|
|
44
|
-
- Run `git diff <
|
|
45
|
-
- Run `git show --stat <
|
|
44
|
+
- Run `git diff <commit_id>^..<commit_id>` in `<harmony_project_dir>` to obtain the raw diff.
|
|
45
|
+
- Run `git show --stat <commit_id>` to list affected files.
|
|
46
46
|
- Read the changed files directly from the project to build the code context manually.
|
|
47
47
|
- Proceed with the review using this manually assembled context — do not stop.
|
|
48
48
|
|
|
@@ -52,15 +52,15 @@ Before starting the review, extract the code context for the commit via the `ext
|
|
|
52
52
|
|
|
53
53
|
0. **Resolve document paths**:
|
|
54
54
|
|
|
55
|
-
- If `
|
|
55
|
+
- If `test_case_path` is not provided, use `<output_path>/test_case.md`
|
|
56
56
|
|
|
57
57
|
1. **Read the code context** (from Step 0):
|
|
58
58
|
- Parse the code context returned by the MCP tool (or the manually assembled fallback)
|
|
59
|
-
- This contains the diff and relevant code context for commit `
|
|
59
|
+
- This contains the diff and relevant code context for commit `commit_id`
|
|
60
60
|
- Understand the scope of changes: which files were modified, added, or deleted
|
|
61
61
|
- Build a map of the changed code areas — these are the primary focus of the review
|
|
62
62
|
|
|
63
|
-
3. **Read the user scenario design document** (`
|
|
63
|
+
3. **Read the user scenario design document** (`test_case_path`):
|
|
64
64
|
|
|
65
65
|
- Extract every user scenario / user story / use case described
|
|
66
66
|
- For each scenario, identify:
|
|
@@ -82,7 +82,7 @@ Before starting the review, extract the code context for the commit via the `ext
|
|
|
82
82
|
Review the code based on the extracted code context (from the MCP tool or fallback) combined with the broader project structure:
|
|
83
83
|
|
|
84
84
|
1. **Code context analysis** (primary focus): Analyze the extracted code context to understand:
|
|
85
|
-
- Which files were changed in commit `
|
|
85
|
+
- Which files were changed in commit `commit_id`
|
|
86
86
|
- The specific diffs and surrounding code for each changed file
|
|
87
87
|
- The intent and scope of the changes relative to the commit
|
|
88
88
|
|
|
@@ -152,7 +152,7 @@ After per-scenario review, check these cross-cutting concerns that affect multip
|
|
|
152
152
|
|
|
153
153
|
## Step 5 — Write `code-review-report.md`
|
|
154
154
|
|
|
155
|
-
Write the report to `
|
|
155
|
+
Write the report to `output_path/code-review-report.md` with the following structure:
|
|
156
156
|
|
|
157
157
|
```markdown
|
|
158
158
|
# Code Review Report
|
|
@@ -160,8 +160,8 @@ Write the report to `output-path/code-review-report.md` with the following struc
|
|
|
160
160
|
## Overview
|
|
161
161
|
|
|
162
162
|
- **Project**: <project name/path>
|
|
163
|
-
- **Commit ID**: <
|
|
164
|
-
- **Scenario Doc**: <
|
|
163
|
+
- **Commit ID**: <commit_id>
|
|
164
|
+
- **Scenario Doc**: <test_case_path>
|
|
165
165
|
- **Code Context**: extract_commit_context MCP tool (or git-diff fallback)
|
|
166
166
|
- **Review Date**: <date>
|
|
167
167
|
- **Total Scenarios**: <N>
|
package/agents/logic-coder.md
CHANGED
|
@@ -7,10 +7,10 @@ min-model: sonnet
|
|
|
7
7
|
|
|
8
8
|
## Inputs
|
|
9
9
|
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
10
|
+
- `plan_file` = `{output_path}/plan.md`
|
|
11
|
+
- `harmony_project_dir` (abs)
|
|
12
|
+
- `output_path` (abs)
|
|
13
|
+
- `plugin_path` (abs) — plugin root; `{scripts}` = `{plugin_path}/agents/logic-coder/scripts/`
|
|
14
14
|
|
|
15
15
|
## Tools
|
|
16
16
|
|
|
@@ -38,15 +38,15 @@ blocked, write the gap instead of fake completion.
|
|
|
38
38
|
|
|
39
39
|
## Procedure
|
|
40
40
|
|
|
41
|
-
1. Read `
|
|
42
|
-
2. If runtime provides checked constraints, read them after `
|
|
41
|
+
1. Read `plan_file` first.
|
|
42
|
+
2. If runtime provides checked constraints, read them after `plan_file`; they
|
|
43
43
|
narrow unsafe choices but do not broaden plan scope.
|
|
44
44
|
3. Verify local facts (per Verification, in stated order).
|
|
45
45
|
4. Patch only plan-required behavior.
|
|
46
46
|
5. Validate (per Validate And Output). Stage only plan-required files; do not
|
|
47
47
|
use `git add -A`.
|
|
48
48
|
6. Commit with a non-interactive message naming the decision contract.
|
|
49
|
-
7. Write `{output_path}/commit-info.md` with `
|
|
49
|
+
7. Write `{output_path}/commit-info.md` with `commit_id: <full hash>`.
|
|
50
50
|
8. Write `{output_path}/issues.md` only for blocking `Unknown`,
|
|
51
51
|
repo-vs-plan contradiction, platform drift, missing proof, or validation
|
|
52
52
|
failure.
|
|
@@ -55,7 +55,7 @@ Never ask. Never commit outside plan scope.
|
|
|
55
55
|
|
|
56
56
|
## Read Scope
|
|
57
57
|
|
|
58
|
-
After `
|
|
58
|
+
After `plan_file`, read only plan-named files, direct imports/exports, needed
|
|
59
59
|
symbol/type definitions, current producer/owner/consumer/target display,
|
|
60
60
|
same-pattern local code, build-error files, and plan-named platform evidence.
|
|
61
61
|
|
|
@@ -7,10 +7,10 @@ min-model: sonnet
|
|
|
7
7
|
|
|
8
8
|
## Inputs
|
|
9
9
|
|
|
10
|
-
- `
|
|
11
|
-
- `
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
10
|
+
- `spec_file` (abs)
|
|
11
|
+
- `harmony_project_dir` (abs)
|
|
12
|
+
- `output_path` (abs)
|
|
13
|
+
- `plugin_path` (abs) — plugin root; `{scripts}` = `{plugin_path}/agents/logic-coder/scripts/`
|
|
14
14
|
|
|
15
15
|
## Tools
|
|
16
16
|
|
|
@@ -66,7 +66,7 @@ chooses."
|
|
|
66
66
|
Evidence priority: visible/resource text > render/caller path >
|
|
67
67
|
producer/consumer > route/menu > file/class names. Reject name-only/comment-only.
|
|
68
68
|
|
|
69
|
-
1. Read `
|
|
69
|
+
1. Read `spec_file`. Extract SPEC anchors: visible text/resources, route/menu,
|
|
70
70
|
UI section, component/builder, entity/field/action, acceptance, non-goals.
|
|
71
71
|
2. Reason internally until a chain node needs a concrete fact.
|
|
72
72
|
3. Narrow chain nodes by project and platform evidence. Write plan.md.
|
package/agents/review-fixer.md
CHANGED
|
@@ -18,10 +18,10 @@ Read a code-review report (`code-review-report.md`), double-check every reported
|
|
|
18
18
|
|
|
19
19
|
## Expected Input
|
|
20
20
|
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
23
|
-
- `
|
|
24
|
-
- `
|
|
21
|
+
- `review_report_path`: Path to the code-review report file (`.md`) — **required**
|
|
22
|
+
- `harmony_project_dir`: Path to the HarmonyOS project root — **required**
|
|
23
|
+
- `android_project_dir`: Path to the Android source project — **optional** (enables reference-based fixing)
|
|
24
|
+
- `output_path`: Directory to store `review-fix-report.md` — **optional** (defaults to cwd)
|
|
25
25
|
|
|
26
26
|
## Expected Output
|
|
27
27
|
|
|
@@ -134,7 +134,7 @@ For each **CONFIRMED** issue, apply the appropriate fix strategy based on the is
|
|
|
134
134
|
|
|
135
135
|
**When**: A page or component referenced by a scenario does not exist.
|
|
136
136
|
|
|
137
|
-
1. **Read the Android source** (if `
|
|
137
|
+
1. **Read the Android source** (if `android_project_dir` is provided):
|
|
138
138
|
- Find the corresponding Android Activity/Fragment/View.
|
|
139
139
|
- Document: layout structure, event handlers, data sources, navigation targets.
|
|
140
140
|
2. **Use Context7 MCP tool** to look up the HarmonyOS equivalent UI components (e.g., `Grid` for `RecyclerView`, `List` for `ListView`).
|
|
@@ -216,7 +216,7 @@ For each **CONFIRMED** issue, apply the appropriate fix strategy based on the is
|
|
|
216
216
|
|
|
217
217
|
After completing fixes for a group of related issues (e.g., all issues in one scenario, or all permission issues), verify the project still compiles:
|
|
218
218
|
|
|
219
|
-
1. Launch the **build-fixer** agent with `
|
|
219
|
+
1. Launch the **build-fixer** agent with `harmony_project_dir` and `output_path`.
|
|
220
220
|
2. If compilation fails, the build-fixer agent will auto-fix compile errors — this does **not** count as an effective attempt.
|
|
221
221
|
3. If compilation succeeds, proceed to the next group of issues.
|
|
222
222
|
4. If compilation cannot be fixed after build-fixer's attempts, **revert the most recent changes** for that group and record the issue as "failed to fix — compilation error".
|
|
@@ -239,9 +239,9 @@ After processing all issues, write `review-fix-report.md` to the output director
|
|
|
239
239
|
|
|
240
240
|
## Overview
|
|
241
241
|
|
|
242
|
-
- **Review Report**: <
|
|
243
|
-
- **HarmonyOS Project**: <
|
|
244
|
-
- **Android Source**: <
|
|
242
|
+
- **Review Report**: <review_report_path>
|
|
243
|
+
- **HarmonyOS Project**: <harmony_project_dir>
|
|
244
|
+
- **Android Source**: <android_project_dir or "not provided">
|
|
245
245
|
- **Fix Date**: <date>
|
|
246
246
|
- **Total Issues in Report**: <N>
|
|
247
247
|
- **Verified (CONFIRMED)**: <X>
|
|
@@ -368,25 +368,25 @@ Confirmed: {X}, Fixed: {A}, False positives: {Y}
|
|
|
368
368
|
cd "<project-dir>" && git rev-parse HEAD
|
|
369
369
|
```
|
|
370
370
|
|
|
371
|
-
4. **Write commit info** to `<
|
|
371
|
+
4. **Write commit info** to `<output_path>/review-fix-commit-info.md`:
|
|
372
372
|
```
|
|
373
|
-
|
|
373
|
+
commit_id: <commit_id>
|
|
374
374
|
```
|
|
375
375
|
|
|
376
376
|
**If no files were modified** (all issues were false positives or all fix attempts failed):
|
|
377
|
-
- Write `<
|
|
377
|
+
- Write `<output_path>/review-fix-commit-info.md` with:
|
|
378
378
|
```
|
|
379
|
-
|
|
379
|
+
commit_id: none
|
|
380
380
|
```
|
|
381
381
|
|
|
382
382
|
**If not in a git repository**:
|
|
383
383
|
- Record issue "Not a git repository — skipped commit" in `review-fix-report.md`.
|
|
384
|
-
- Write `<
|
|
384
|
+
- Write `<output_path>/review-fix-commit-info.md` with:
|
|
385
385
|
```
|
|
386
|
-
|
|
386
|
+
commit_id: none
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
**If `
|
|
389
|
+
**If `output_path` was not provided**, skip writing `review-fix-commit-info.md`.
|
|
390
390
|
|
|
391
391
|
---
|
|
392
392
|
|
|
@@ -14,10 +14,10 @@ Read a self-test report (`self-test-report.md`), extract all failed scenarios, w
|
|
|
14
14
|
|
|
15
15
|
## Expected Input
|
|
16
16
|
|
|
17
|
-
- `
|
|
18
|
-
- `
|
|
19
|
-
- `
|
|
20
|
-
- `
|
|
17
|
+
- `self_test_report_path`: Path to the self-test report file (`.md`) — **required**
|
|
18
|
+
- `harmony_project_dir`: Path to the HarmonyOS project root — **required**
|
|
19
|
+
- `android_project_dir`: Path to the Android source project — **optional** (enables reference-based fixing)
|
|
20
|
+
- `output_path`: Directory to store `self-test-fix-report.md` — **optional** (defaults to cwd)
|
|
21
21
|
|
|
22
22
|
## Expected Output
|
|
23
23
|
|
|
@@ -28,7 +28,7 @@ Read a self-test report (`self-test-report.md`), extract all failed scenarios, w
|
|
|
28
28
|
|
|
29
29
|
## Step 1 — Read Report and Extract Failed Scenarios
|
|
30
30
|
|
|
31
|
-
Read the self-test report file at `
|
|
31
|
+
Read the self-test report file at `self_test_report_path`. **Do not assume any fixed format** — understand the report structure by reading it, then extract all scenarios that are marked as failed / not passed / unsuccessful.
|
|
32
32
|
|
|
33
33
|
For each failed scenario, record whatever information is available:
|
|
34
34
|
|
|
@@ -102,7 +102,7 @@ Before modifying any code, analyze all `confirmed` failures together and create
|
|
|
102
102
|
|
|
103
103
|
For each fix item in the plan:
|
|
104
104
|
|
|
105
|
-
1. **Reference Android implementation** (if `
|
|
105
|
+
1. **Reference Android implementation** (if `android_project_dir` is provided):
|
|
106
106
|
- Search the Android source for the corresponding feature
|
|
107
107
|
- Understand: entry point, event handling, business logic, persistence, UI feedback
|
|
108
108
|
- Use the Android behavior as the specification for the fix
|
|
@@ -126,7 +126,7 @@ For each fix item in the plan:
|
|
|
126
126
|
|
|
127
127
|
After **all** fix items are complete, launch the **build-fixer** agent **once** to verify compilation:
|
|
128
128
|
|
|
129
|
-
- Pass `
|
|
129
|
+
- Pass `harmony_project_dir` and `output_path` to the build-fixer agent
|
|
130
130
|
- If compilation fails, build-fixer will auto-fix compile errors
|
|
131
131
|
- Compilation issues do NOT count as effective fix attempts
|
|
132
132
|
|
|
@@ -159,25 +159,25 @@ Fixed: {N}/{M} failed scenarios
|
|
|
159
159
|
cd "<project-dir>" && git rev-parse HEAD
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
4. **Write commit info** to `<
|
|
162
|
+
4. **Write commit info** to `<output_path>/self-test-fix-commit-info.md`:
|
|
163
163
|
```
|
|
164
|
-
|
|
164
|
+
commit_id: <commit_id>
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
**If no files were modified** (all failures were false positives):
|
|
168
|
-
- Write `<
|
|
168
|
+
- Write `<output_path>/self-test-fix-commit-info.md` with:
|
|
169
169
|
```
|
|
170
|
-
|
|
170
|
+
commit_id: none
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
**If not in a git repository**:
|
|
174
174
|
- Record issue "Not a git repository — skipped commit" in `self-test-fix-report.md`.
|
|
175
|
-
- Write `<
|
|
175
|
+
- Write `<output_path>/self-test-fix-commit-info.md` with:
|
|
176
176
|
```
|
|
177
|
-
|
|
177
|
+
commit_id: none
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
**If `
|
|
180
|
+
**If `output_path` was not provided**, skip writing `self-test-fix-commit-info.md`.
|
|
181
181
|
|
|
182
182
|
### 3d. Retry Logic (Maximum 2 Effective Attempts)
|
|
183
183
|
|
|
@@ -194,7 +194,7 @@ An "effective attempt" = code was modified AND compilation succeeded, but code r
|
|
|
194
194
|
|
|
195
195
|
## Step 4 — Generate Detailed Fix Report
|
|
196
196
|
|
|
197
|
-
Write `self-test-fix-report.md` to `
|
|
197
|
+
Write `self-test-fix-report.md` to `output_path`. The report must be comprehensive and actionable.
|
|
198
198
|
|
|
199
199
|
### Report Structure
|
|
200
200
|
|