@buaa_smat/hometrans 0.1.2 → 0.1.3
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/agents/build-fixer.md +22 -17
- package/agents/code-review-fix.md +4 -4
- package/package.json +1 -1
package/agents/build-fixer.md
CHANGED
|
@@ -29,35 +29,40 @@ 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
|
|
32
|
+
### 0a. Read the HomeTrans config
|
|
33
33
|
|
|
34
|
-
Read the config file at
|
|
34
|
+
Read the config file written by `ht init` at `~/.hometrans/config.json` (`$HOME/.hometrans/config.json`; on Windows `%USERPROFILE%\.hometrans\config.json`). Its shape is:
|
|
35
35
|
|
|
36
36
|
```jsonc
|
|
37
37
|
{
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
"editors": [ /* ... */ ],
|
|
39
|
+
"params": {
|
|
40
|
+
"OHOS_SDK_PATH": "...", // OpenHarmony SDK ETS path, e.g. "D:/DevEco Studio/sdk/default/openharmony/ets"
|
|
41
|
+
"HMS_SDK_PATH": "...", // HMS SDK ETS path, e.g. "D:/DevEco Studio/sdk/default/hms/ets"
|
|
42
|
+
"TEST_API_KEY": "..."
|
|
43
|
+
}
|
|
43
44
|
}
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
Read `params.OHOS_SDK_PATH` from this file.
|
|
47
48
|
|
|
48
|
-
### 0b. Derive
|
|
49
|
+
### 0b. Derive the DevEco Studio root and tool paths
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
- **Node executable**: `<deveco_studio_path>/tools/node/node.exe`
|
|
52
|
-
- **Hvigor script**: `<deveco_studio_path>/tools/hvigor/bin/hvigorw.js`
|
|
53
|
-
- **ohpm**: `<deveco_studio_path>/tools/ohpm/bin/ohpm`
|
|
54
|
-
- **SDK directory**: `<deveco_studio_path>/sdk`
|
|
51
|
+
The DevEco Studio installation root is the part of `OHOS_SDK_PATH` before the SDK suffix. Strip the trailing `/sdk/default/openharmony/ets` (or `\sdk\default\openharmony\ets`) from `OHOS_SDK_PATH` to get `<deveco>`.
|
|
55
52
|
|
|
56
|
-
|
|
53
|
+
> Example: `OHOS_SDK_PATH = D:/DevEco Studio/sdk/default/openharmony/ets` → `<deveco> = D:/DevEco Studio`.
|
|
54
|
+
|
|
55
|
+
From `<deveco>`, derive:
|
|
56
|
+
- **Node executable**: `<deveco>/tools/node/node.exe`
|
|
57
|
+
- **Hvigor script**: `<deveco>/tools/hvigor/bin/hvigorw.js`
|
|
58
|
+
- **ohpm**: `<deveco>/tools/ohpm/bin/ohpm`
|
|
59
|
+
- **SDK directory**: `<deveco>/sdk`
|
|
60
|
+
|
|
61
|
+
Verify these files exist. If they do, use them and skip auto-detection. (Fall back to `params.HMS_SDK_PATH` — stripping `/sdk/default/hms/ets` — if `OHOS_SDK_PATH` is absent but `HMS_SDK_PATH` is present.)
|
|
57
62
|
|
|
58
63
|
### 0c. Auto-detect if config is missing or invalid
|
|
59
64
|
|
|
60
|
-
If
|
|
65
|
+
If `~/.hometrans/config.json` is missing, has empty `params.OHOS_SDK_PATH`/`HMS_SDK_PATH`, or the derived paths don't point to real files, auto-detect:
|
|
61
66
|
|
|
62
67
|
1. **Find DevEco Studio installation**:
|
|
63
68
|
- Search common locations: `D:\DevEco Studio`, `C:\DevEco Studio`, `C:\Program Files\DevEco Studio`
|
|
@@ -68,7 +73,7 @@ If the config file is empty, missing, or the paths don't point to real files, au
|
|
|
68
73
|
- `where node` (Windows) or `which node` (Unix)
|
|
69
74
|
- Verify it runs: `node --version`
|
|
70
75
|
|
|
71
|
-
If auto-detection fails for any critical path, **stop and report clearly** what is missing so the user can run
|
|
76
|
+
If auto-detection fails for any critical path, **stop and report clearly** what is missing so the user can run `ht init` to configure it.
|
|
72
77
|
|
|
73
78
|
### 0d. Store resolved paths
|
|
74
79
|
|
|
@@ -41,7 +41,7 @@ If `commit-id` is provided and is not `none`:
|
|
|
41
41
|
- `projectPath`: `<harmonyos-project-path>`
|
|
42
42
|
- `commitId`: `<commit-id>`
|
|
43
43
|
- `mode`: `"default"`
|
|
44
|
-
- `ohosSdkPath` / `hmsSdkPath`: from
|
|
44
|
+
- `ohosSdkPath` / `hmsSdkPath`: omit to let the tool read `params.OHOS_SDK_PATH` / `params.HMS_SDK_PATH` from the `ht init` config (`~/.hometrans/config.json`), falling back to the `OHOS_SDK_PATH` / `HMS_SDK_PATH` env vars
|
|
45
45
|
|
|
46
46
|
2. **On failure**, fall back to:
|
|
47
47
|
```bash
|
|
@@ -231,16 +231,16 @@ Classify: **CONFIRMED** (fix) | **FALSE_POSITIVE** (skip, record reason) | **UNC
|
|
|
231
231
|
|
|
232
232
|
### Step 3.0: Resolve Build Environment
|
|
233
233
|
|
|
234
|
-
1. Read `
|
|
234
|
+
1. Read the `ht init` config at `~/.hometrans/config.json` (Windows: `%USERPROFILE%\.hometrans\config.json`). Take `params.OHOS_SDK_PATH` (e.g. `D:/DevEco Studio/sdk/default/openharmony/ets`) and strip the trailing `/sdk/default/openharmony/ets` to get the DevEco Studio root `<deveco>`. Fall back to `params.HMS_SDK_PATH` (strip `/sdk/default/hms/ets`) if needed.
|
|
235
235
|
|
|
236
236
|
2. Derive tool paths:
|
|
237
237
|
- `NODE_EXE`: `<deveco>/tools/node/node.exe`
|
|
238
238
|
- `HVIGORW_JS`: `<deveco>/tools/hvigor/bin/hvigorw.js`
|
|
239
239
|
- `OHPM`: `<deveco>/tools/ohpm/bin/ohpm`
|
|
240
240
|
|
|
241
|
-
3. If config missing, auto-detect: search `D:\DevEco Studio`, `C:\DevEco Studio`, `C:\Program Files\DevEco Studio` for `tools/hvigor/bin/hvigorw.js`.
|
|
241
|
+
3. If the config is missing or `params.OHOS_SDK_PATH`/`HMS_SDK_PATH` are empty, auto-detect: search `D:\DevEco Studio`, `C:\DevEco Studio`, `C:\Program Files\DevEco Studio` for `tools/hvigor/bin/hvigorw.js`.
|
|
242
242
|
|
|
243
|
-
4. If detection fails, stop and report clearly what is missing.
|
|
243
|
+
4. If detection fails, stop and report clearly what is missing so the user can run `ht init` to configure it.
|
|
244
244
|
|
|
245
245
|
### Step 3.1: Setup Project
|
|
246
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buaa_smat/hometrans",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "HomeTrans (Android-to-HarmonyOS) skill + agent installer. Run `ht init` to distribute conversion skills and subagents into AI editors.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|