@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
|
@@ -11,30 +11,41 @@ allowed-tools:
|
|
|
11
11
|
|
|
12
12
|
# Self-Test Skill
|
|
13
13
|
|
|
14
|
-
You are a **Self-Test Runner**. Your job is to invoke the `self-tester` with the correct parameters, optionally drive a test-and-fix loop (test → fix → build → retest, default up to 3 rounds, configurable via `
|
|
14
|
+
You are a **Self-Test Runner**. Your job is to invoke the `self-tester` with the correct parameters, optionally drive a test-and-fix loop (test → fix → build → retest, default up to 3 rounds, configurable via `max_rounds`), and surface results to the user. You do NOT run test tools directly — you delegate all test work to `self-tester`.
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
## Prerequisites
|
|
19
19
|
|
|
20
|
-
The skill requires two user inputs: `
|
|
20
|
+
The skill requires two user inputs: `test_case_path` and `hap_path`. `output_path` is optional — if omitted, it defaults to the directory containing `test_case_path`. After the initial test the skill can optionally enter a test-and-fix loop. Each round writes outputs into `<output_path>/round-{n}/` as a snapshot for history; the canonical "latest" copies live at `<output_path>/` root.
|
|
21
21
|
|
|
22
22
|
A signed `.hap` file is required (this is a device test — the HAP will be installed on a real HarmonyOS device). Confirm the HAP source with the user before proceeding.
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
## Step 0 — Environment Variables Check (run first)
|
|
27
|
+
|
|
28
|
+
This skill (via `self-tester`) reads its settings **directly from the OS environment variables**. Before parsing inputs, verify (read each from the OS environment: `echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows):
|
|
29
|
+
|
|
30
|
+
| Variable | Purpose | Valid when |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| `TEST_API_KEY` | LLM API key AutoTest uses to drive test cases | non-empty |
|
|
33
|
+
| `HOMETRANS_TOOL_PATH` | HomeTrans tools dir (`<HOMETRANS_TOOL_PATH>/test-tools/autotest`) | path exists on disk; if unset, falls back to `~/.hometrans/tools` |
|
|
34
|
+
|
|
35
|
+
If `TEST_API_KEY` is missing/empty, **stop and ask the user to provide it** before proceeding (suggest running `ht init` to persist it as a machine environment variable). `HOMETRANS_TOOL_PATH` may be left unset (it defaults to `~/.hometrans/tools`).
|
|
36
|
+
|
|
26
37
|
## Step 1 — Parse Inputs
|
|
27
38
|
|
|
28
39
|
Extract the following from the user's message. If any required input is missing, use `AskUserQuestion` with the template below — do not guess and do not invent paths.
|
|
29
40
|
|
|
30
41
|
| Variable | Required | Meaning | Typical Phrasing |
|
|
31
42
|
|----------|----------|---------|------------------|
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
43
|
+
| `test_case_path` | yes | Path to test_case.md | "测试用例在...", "用例文件...", "test case path" |
|
|
44
|
+
| `hap_path` | yes | Path to the signed .hap file | "HAP路径...", "安装包在...", "hap file..." |
|
|
45
|
+
| `output_path` | no (default: directory of `test_case_path`) | Directory for all output artifacts | "输出到...", "产物目录...", "output to..." |
|
|
46
|
+
| `pre_test_case_path` | no | Path to pre_test_case.md | "前置用例...", "pre test case..." |
|
|
47
|
+
| `android_project_dir` | no (for fix loop) | Path to Android source project for reference-based fixing | "Android路径...", "android project..." |
|
|
48
|
+
| `max_rounds` | no (default `3`) | Max iterations for the test-and-fix loop. Must be a positive integer (`>= 1`). Only meaningful when the fix loop is enabled. | "最多 X 轮", "max rounds X", "迭代 X 次" |
|
|
38
49
|
|
|
39
50
|
**AskUserQuestion template (use this exact shape — do NOT ad-lib free-form questions):**
|
|
40
51
|
|
|
@@ -46,11 +57,11 @@ choices:
|
|
|
46
57
|
|
|
47
58
|
Map the user's reply back to the variable.
|
|
48
59
|
|
|
49
|
-
**Default `
|
|
60
|
+
**Default `output_path`**: If the user did not provide `output_path`, set it to the parent directory of `test_case_path` (the directory portion, without the filename). Use this resolved value everywhere downstream.
|
|
50
61
|
|
|
51
62
|
**Validation command** (platform-agnostic — adapt to OS):
|
|
52
63
|
|
|
53
|
-
Verify that `
|
|
64
|
+
Verify that `test_case_path` and `hap_path` point to readable files and `output_path` is an existing directory (create if missing).
|
|
54
65
|
|
|
55
66
|
| OS | Example check |
|
|
56
67
|
|----|---------------|
|
|
@@ -80,10 +91,10 @@ Substitute `<MAX_ROUNDS>` in the question text with the parsed value (default `3
|
|
|
80
91
|
|
|
81
92
|
### 2.0 — Loop Setup
|
|
82
93
|
|
|
83
|
-
1. Record `CURRENT_HAP = <
|
|
84
|
-
2. Initialize `round = 1`, `MAX_ROUNDS = <
|
|
85
|
-
3. Set `ROUND_DIR = <
|
|
86
|
-
4. `PROJECT_ROOT` is **unset** at this point — it will be read after round 1's agent invocation produces `<
|
|
94
|
+
1. Record `CURRENT_HAP = <hap_path>`.
|
|
95
|
+
2. Initialize `round = 1`, `MAX_ROUNDS = <max_rounds from Step 1, default 3>`. If the parsed value is missing or not a positive integer, use `3`.
|
|
96
|
+
3. Set `ROUND_DIR = <output_path>/round-1`. Create the directory.
|
|
97
|
+
4. `PROJECT_ROOT` is **unset** at this point — it will be read after round 1's agent invocation produces `<output_path>/app-metadata.json`.
|
|
87
98
|
5. Mark step description with round info (e.g., "**Round 1/<MAX_ROUNDS>**").
|
|
88
99
|
|
|
89
100
|
---
|
|
@@ -102,13 +113,13 @@ Agent(
|
|
|
102
113
|
|
|
103
114
|
Assemble the prompt by joining these lines with `\n`, skipping any line whose value is unset:
|
|
104
115
|
|
|
105
|
-
- `
|
|
106
|
-
- `
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
116
|
+
- `hap_path: <CURRENT_HAP>`
|
|
117
|
+
- `output_path: <output_path>` (the ROOT — the agent always writes here)
|
|
118
|
+
- `test_case_path: <test_case_path>`
|
|
119
|
+
- `pre_test_case_path: <pre_test_case_path>` (only if provided / resolved)
|
|
109
120
|
- `setup: true`
|
|
110
121
|
|
|
111
|
-
After the agent returns, read `<
|
|
122
|
+
After the agent returns, read `<output_path>/app-metadata.json` and extract `project_root` → store as `PROJECT_ROOT`. This is the canonical source from now on.
|
|
112
123
|
|
|
113
124
|
**Round 2+ invocation** — skips the parse phase and reuses the JSONs round 1 produced:
|
|
114
125
|
|
|
@@ -116,21 +127,21 @@ After the agent returns, read `<output-path>/app-metadata.json` and extract `pro
|
|
|
116
127
|
Agent(
|
|
117
128
|
subagent_type="self-tester",
|
|
118
129
|
description="Run Device Tests (Round {round})",
|
|
119
|
-
prompt="
|
|
130
|
+
prompt="hap_path: <CURRENT_HAP>\noutput_path: <output_path>\nsetup: false"
|
|
120
131
|
)
|
|
121
132
|
```
|
|
122
133
|
|
|
123
|
-
Before each round 2+ invocation, apply the **PROJECT_ROOT refresh rule**: re-read `<
|
|
134
|
+
Before each round 2+ invocation, apply the **PROJECT_ROOT refresh rule**: re-read `<output_path>/app-metadata.json` (canonical source). If the previous round's `<PREV_ROUND_DIR>/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.
|
|
124
135
|
|
|
125
136
|
---
|
|
126
137
|
|
|
127
138
|
### 2A.1 — Detect early-exit (sentinel) reports first
|
|
128
139
|
|
|
129
|
-
The agent writes a degraded sentinel report when T1 / T3 / T4 / T7 fail before the case table is rendered. Look at the first two non-frontmatter lines of `<
|
|
140
|
+
The agent writes a degraded sentinel report when T1 / T3 / T4 / T7 fail before the case table is rendered. Look at the first two non-frontmatter lines of `<output_path>/self-test-report.md`:
|
|
130
141
|
|
|
131
142
|
```bash
|
|
132
|
-
grep -m1 -E '^status:' "<
|
|
133
|
-
grep -m1 -E '^reason:' "<
|
|
143
|
+
grep -m1 -E '^status:' "<output_path>/self-test-report.md"
|
|
144
|
+
grep -m1 -E '^reason:' "<output_path>/self-test-report.md"
|
|
134
145
|
```
|
|
135
146
|
|
|
136
147
|
- If the first line matches `status: FAIL` → this is a sentinel report. Set `stop_reason = agent_early_exit`, capture the `reason:` line for the user (`early_exit_reason = <reason>`), snapshot the round (2.5), and exit the loop. Do NOT enter 2B (the fixer cannot fix an environment / connectivity / config issue).
|
|
@@ -140,12 +151,12 @@ grep -m1 -E '^reason:' "<output-path>/self-test-report.md"
|
|
|
140
151
|
|
|
141
152
|
### 2A.2 — Parse the normal case table
|
|
142
153
|
|
|
143
|
-
Read `<
|
|
154
|
+
Read `<output_path>/self-test-report.md` (first 80 lines). Extract:
|
|
144
155
|
- `total` — total test cases
|
|
145
156
|
- `passed` — passed count
|
|
146
157
|
- `failed` — failed count
|
|
147
158
|
|
|
148
|
-
**Empty-suite guard**: If `total == 0` (e.g., `testcases.json` happened to be empty), set `stop_reason = no_testcases`, surface a clear message to the user (`<
|
|
159
|
+
**Empty-suite guard**: If `total == 0` (e.g., `testcases.json` happened to be empty), set `stop_reason = no_testcases`, surface a clear message to the user (`<output_path>/testcases.json contains 0 cases — nothing to run`), snapshot the round (2.5), and exit the loop. Do NOT enter the fix loop.
|
|
149
160
|
|
|
150
161
|
Otherwise: Set `round_all_passed = true` if `failed == 0` and `passed == total` (and `total > 0`, which the guard above ensures).
|
|
151
162
|
|
|
@@ -166,11 +177,11 @@ Launch `self-test-fixer`. Use `PROJECT_ROOT`:
|
|
|
166
177
|
Agent(
|
|
167
178
|
subagent_type="self-test-fixer",
|
|
168
179
|
description="Fix Self-Test Failures (Round {round})",
|
|
169
|
-
prompt="
|
|
180
|
+
prompt="self_test_report_path: <output_path>/self-test-report.md\nharmony_project_dir: <PROJECT_ROOT>\noutput_path: <ROUND_DIR>"
|
|
170
181
|
)
|
|
171
182
|
```
|
|
172
183
|
|
|
173
|
-
> `
|
|
184
|
+
> `android_project_dir` is optional — if the user mentioned an Android source path, add the line `android_project_dir: <android_project_dir>` to the prompt. Omit otherwise.
|
|
174
185
|
|
|
175
186
|
After completion, read `<ROUND_DIR>/self-test-fix-report.md` (first 60 lines). Extract:
|
|
176
187
|
- `confirmed` — white-box confirmed defect count
|
|
@@ -201,7 +212,7 @@ Launch `build-fixer` with `--signed`:
|
|
|
201
212
|
Agent(
|
|
202
213
|
subagent_type="build-fixer",
|
|
203
214
|
description="Rebuild Signed HAP After Fix (Round {round})",
|
|
204
|
-
prompt="
|
|
215
|
+
prompt="harmony_project_dir: <PROJECT_ROOT>\noutput_path: <ROUND_DIR>\n--signed"
|
|
205
216
|
)
|
|
206
217
|
```
|
|
207
218
|
|
|
@@ -226,7 +237,7 @@ elif round >= MAX_ROUNDS: stop_reason = max_rounds_reached; snapshot (2.5);
|
|
|
226
237
|
else:
|
|
227
238
|
snapshot (2.5) # snapshot the just-completed round
|
|
228
239
|
round += 1
|
|
229
|
-
ROUND_DIR = <
|
|
240
|
+
ROUND_DIR = <output_path>/round-{round}
|
|
230
241
|
create ROUND_DIR
|
|
231
242
|
go to 2A
|
|
232
243
|
```
|
|
@@ -235,19 +246,19 @@ else:
|
|
|
235
246
|
|
|
236
247
|
### 2.5 — Per-round Snapshot
|
|
237
248
|
|
|
238
|
-
After every round's 2A returns (round 1 and rounds 2+), snapshot these files from `<
|
|
249
|
+
After every round's 2A returns (round 1 and rounds 2+), snapshot these files from `<output_path>/` to `<ROUND_DIR>`. Each copy follows the rule **"skip if source missing"**.
|
|
239
250
|
|
|
240
251
|
| Source | Destination | Notes |
|
|
241
252
|
|--------|-------------|-------|
|
|
242
|
-
| `<
|
|
243
|
-
| `<
|
|
244
|
-
| `<
|
|
253
|
+
| `<output_path>/self-test-report.md` | `<ROUND_DIR>/self-test-report.md` | Always expected after a successful T9. If missing, sentinel-FAIL detection in 2A.1 already routed via `agent_early_exit`. |
|
|
254
|
+
| `<output_path>/task/` | `<ROUND_DIR>/task/` | Per-round runner artifacts. Skip if missing (e.g., agent FAILed before T6 created the dir). |
|
|
255
|
+
| `<output_path>/_extracted.json` | `<ROUND_DIR>/_extracted.json` | Only present after round 1 (S4.2 wrote it). Skip in rounds 2+. |
|
|
245
256
|
|
|
246
257
|
**NOT snapshotted** (these stay at root only as the canonical, cross-round artifacts):
|
|
247
|
-
- `<
|
|
248
|
-
- `<
|
|
258
|
+
- `<output_path>/testcases.json` — written once by round 1; rounds 2+ read it in place.
|
|
259
|
+
- `<output_path>/app-metadata.json` — written once by round 1; rounds 2+ read it in place.
|
|
249
260
|
|
|
250
|
-
**`task/` cleanup ordering**: T5 (inside the agent) cleans `<
|
|
261
|
+
**`task/` cleanup ordering**: T5 (inside the agent) cleans `<output_path>/task/` at the start of each test invocation. The invariant: by the time T5 wipes the root `task/` at the start of round N, the previous round's `task/` has already been snapshotted into `<output_path>/round-{N-1}/task/`.
|
|
251
262
|
|
|
252
263
|
**Cross-platform copy syntax**:
|
|
253
264
|
|
|
@@ -262,15 +273,15 @@ Use forward slashes for cross-platform safety; both shells accept them.
|
|
|
262
273
|
|
|
263
274
|
### 2.6 — Loop Finalization (HAP mirror only)
|
|
264
275
|
|
|
265
|
-
When the loop exits, mirror the final HAP from `CURRENT_HAP` (which may live under the last `<ROUND_DIR>`) to `<
|
|
276
|
+
When the loop exits, mirror the final HAP from `CURRENT_HAP` (which may live under the last `<ROUND_DIR>`) to `<output_path>/entry-default-signed.hap`. This is the only "latest" artifact whose primary location is a round dir; `self-test-report.md`, `testcases.json`, `app-metadata.json`, and `task/` already live at `<output_path>/` as canonical copies.
|
|
266
277
|
|
|
267
|
-
Copy `CURRENT_HAP` → `<
|
|
278
|
+
Copy `CURRENT_HAP` → `<output_path>/entry-default-signed.hap` using the same cross-platform syntax above. Skip if `CURRENT_HAP` is already at `<output_path>/entry-default-signed.hap`.
|
|
268
279
|
|
|
269
280
|
---
|
|
270
281
|
|
|
271
282
|
## Step 3 — Surface Results
|
|
272
283
|
|
|
273
|
-
Read `<
|
|
284
|
+
Read `<output_path>/self-test-report.md` (first 80 lines) and extract the overview section:
|
|
274
285
|
|
|
275
286
|
```
|
|
276
287
|
## 自测报告
|
|
@@ -286,11 +297,11 @@ Read `<output-path>/self-test-report.md` (first 80 lines) and extract the overvi
|
|
|
286
297
|
| 常规通过率 | <pass-rate>% |
|
|
287
298
|
```
|
|
288
299
|
|
|
289
|
-
> If the report file is missing or malformed, report the error to the user with the agent's output path — do NOT fabricate results. If the report exists but is truncated or unexpectedly formatted, read up to the first 80 lines for the overview section, and point the user to the full file at `<
|
|
300
|
+
> If the report file is missing or malformed, report the error to the user with the agent's output path — do NOT fabricate results. If the report exists but is truncated or unexpectedly formatted, read up to the first 80 lines for the overview section, and point the user to the full file at `<output_path>/self-test-report.md`.
|
|
290
301
|
|
|
291
302
|
**Pre-case reminder**: If pre-cases failed, note that these are environment/setup issues (permissions, media imports, tutorial skipping), NOT application defects. The regular pass rate (常规通过率) is the primary quality metric.
|
|
292
303
|
|
|
293
|
-
**Point the user to the full report**: `<
|
|
304
|
+
**Point the user to the full report**: `<output_path>/self-test-report.md` and per-round artifacts at `<output_path>/round-{N}/`.
|
|
294
305
|
|
|
295
306
|
### Loop Summary (if loop ran)
|
|
296
307
|
|
|
@@ -311,7 +322,7 @@ After the report, present:
|
|
|
311
322
|
- `no_confirmed_defects` — failures exist but fixer judged them all as false positives.
|
|
312
323
|
- `no_signed_hap` — build-fixer did not produce a signed HAP, loop cannot continue.
|
|
313
324
|
- `max_rounds_reached` — hit the configured `MAX_ROUNDS` cap (default 3) with failures remaining.
|
|
314
|
-
- `no_testcases` — `<
|
|
325
|
+
- `no_testcases` — `<output_path>/testcases.json` contained 0 cases; nothing to run. Surface the path so the user can inspect.
|
|
315
326
|
- `agent_early_exit` — `self-tester` wrote a sentinel FAIL report (config / device / autotest-dir / batch crash / `setup: false` precondition failure). Surface the captured `early_exit_reason` so the user knows what to fix manually.
|
|
316
327
|
|
|
317
328
|
If failures remain (for `max_rounds_reached`), list them briefly (scenario names from the report overview). Also surface paths to `<ROUND_DIR>/self-test-fix-report.md` and `<ROUND_DIR>/build-fix-report.md` (from the final round, when those reports exist).
|
|
@@ -322,16 +333,16 @@ If failures remain (for `max_rounds_reached`), list them briefly (scenario names
|
|
|
322
333
|
|
|
323
334
|
| Scenario | Action |
|
|
324
335
|
|----------|--------|
|
|
325
|
-
| `
|
|
326
|
-
| `
|
|
327
|
-
| `
|
|
328
|
-
| Agent returns error / times out | Report the error to user. Suggest: check device connection (`hdc list targets`), verify HAP is valid, check `config.
|
|
329
|
-
| `<
|
|
336
|
+
| `test_case_path` does not exist | Ask user for correct path, do not proceed |
|
|
337
|
+
| `hap_path` does not exist | Ask user for correct HAP path, do not proceed |
|
|
338
|
+
| `output_path` parent does not exist | Create it, proceed |
|
|
339
|
+
| Agent returns error / times out | Report the error to user. Suggest: check device connection (`hdc list targets`), verify HAP is valid, check the `autotest` block in `~/.hometrans/config.json` (or the `TEST_API_KEY` env var) has a real api_key |
|
|
340
|
+
| `<output_path>/self-test-report.md` missing after agent completes | Report: "Agent completed but no report was generated. Check agent output at <output_path>." |
|
|
330
341
|
| `self-test-report.md` exists but format is unrecognizable | Show the file path, report the first 80 lines as context, let user investigate |
|
|
331
342
|
| Device not found (agent reports "No device") | Remind user: connect device via USB, verify `hdc list targets` shows the device |
|
|
332
343
|
| Pre-case failures in report | Note: these are environment issues, not app defects. Highlight regular pass rate |
|
|
333
|
-
| `<
|
|
334
|
-
| `<
|
|
344
|
+
| `<output_path>/testcases.json` or `app-metadata.json` missing after round 1 | Round 1 setup may have failed; inspect agent output at `<output_path>/` |
|
|
345
|
+
| `<output_path>/testcases.json` is empty (`total == 0` in 2A) | Report: "testcases.json contains 0 cases — nothing to run." Exit loop with `stop_reason = no_testcases`. Do NOT enter the fix loop. |
|
|
335
346
|
| `self-tester` writes a sentinel FAIL report (first line `status: FAIL`) | Capture the `reason:` line. Exit loop with `stop_reason = agent_early_exit` and surface the captured reason. Do NOT enter the fix loop — these failures (config / device / autotest-dir / crash / timeout / setup=false preconditions) are not application defects. |
|
|
336
347
|
| Fixer returns `confirmed == 0` (all false positives) | Exit loop with `stop_reason = no_confirmed_defects`. Surface the fix report summary. |
|
|
337
348
|
| Build-fixer produces no signed HAP in ROUND_DIR | Report: "Build did not produce a signed HAP — cannot re-test." Exit loop with `stop_reason = no_signed_hap`. |
|
|
@@ -351,7 +362,7 @@ If failures remain (for `max_rounds_reached`), list them briefly (scenario names
|
|
|
351
362
|
- **Fix-and-retest loop is opt-in**: Follow Step 2 Entry — ask the user unless they already opted in with "自动修复".
|
|
352
363
|
- **Test → Fix → Build is the mandatory order**: Never re-test without rebuilding after a fix (would test old code). Never skip the build step in the loop.
|
|
353
364
|
- **`CURRENT_HAP` must track the latest build**: After each 2C rebuild, update `CURRENT_HAP` to the new signed HAP from `ROUND_DIR`. Never re-test with the old HAP.
|
|
354
|
-
- **Per-round snapshots**: Each round writes its latest artifacts to `<
|
|
365
|
+
- **Per-round snapshots**: Each round writes its latest artifacts to `<output_path>/` (root), then the SKILL snapshots per-round outputs to `<output_path>/round-{N}/`. The persistent JSONs (`testcases.json`, `app-metadata.json`) are written exactly once by round 1 and consumed unchanged by rounds 2+.
|
|
355
366
|
- **Loop stop conditions**: Normal exits (3) — `all_passed`, `no_confirmed_defects`, `max_rounds_reached`. Error exits (3) — `no_signed_hap` (build did not produce HAP), `no_testcases` (empty testcases.json), `agent_early_exit` (self-tester sentinel FAIL: config / device / autotest-dir / crash / timeout / `setup: false` precondition failure).
|
|
356
367
|
- **Loop iterations are strictly sequential**: Never launch more than one fixer or tester at a time.
|
|
357
368
|
|
|
@@ -363,7 +374,7 @@ If failures remain (for `max_rounds_reached`), list them briefly (scenario names
|
|
|
363
374
|
- ❌ Reading the full `self-test-report.md` (read only first 80 lines for summary)
|
|
364
375
|
- ❌ Reading the full `self-test-fix-report.md` (read only first 60 lines for summary)
|
|
365
376
|
- ❌ Fabricating results when the report is missing or unreadable
|
|
366
|
-
- ❌ Passing `
|
|
377
|
+
- ❌ Passing `output_path: <output_path>/round-N` to the agent — the agent always writes to `<output_path>/` root; per-round directories are populated by the SKILL's snapshot step
|
|
367
378
|
- ❌ Skipping the build step in the loop (rebuild is mandatory after each confirmed fix)
|
|
368
379
|
- ❌ Re-testing with an old HAP after a build
|
|
369
380
|
- ❌ Launching more than one fixer or tester at a time — loop rounds are strictly sequential
|
|
@@ -38,13 +38,13 @@ Try to build the Android project to produce an APK containing all merged resourc
|
|
|
38
38
|
|
|
39
39
|
2. Run the build:
|
|
40
40
|
```bash
|
|
41
|
-
cd <
|
|
41
|
+
cd <android_project_dir>
|
|
42
42
|
./gradlew <variant>
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
3. **If the build succeeds**: locate the APK in `<
|
|
45
|
+
3. **If the build succeeds**: locate the APK in `<android_project_dir>/app/build/outputs/apk/`. If multiple APKs exist, prefer the debug variant. Record `build_status = "success"` and proceed to Step 3 (decompile).
|
|
46
46
|
|
|
47
|
-
4. **If the build fails**: record the build error output and `build_status = "failed"`. Also check if a previously-built APK already exists at `<
|
|
47
|
+
4. **If the build fails**: record the build error output and `build_status = "failed"`. Also check if a previously-built APK already exists at `<android_project_dir>/app/build/outputs/apk/`. If an existing APK is found, use it and record `build_status = "failed_using_cached_apk"`. If no APK exists at all, skip Step 3 entirely and proceed to Step 4 using the source `res/` directory. Set `resource_source = "source_res"`.
|
|
48
48
|
|
|
49
49
|
The reason we prefer the decompiled APK: it contains all merged resources from source code AND library dependencies (AARs, Maven artifacts). When falling back to source `res/`, library resources are missing, which means some resource references may be unresolvable. The conversion report will clearly flag this.
|
|
50
50
|
|
|
@@ -60,14 +60,14 @@ The skill bundles `apktool_3.0.1.jar` in its `tools/` directory. Java must be av
|
|
|
60
60
|
|
|
61
61
|
The decompiled output at `<decompiled_output_path>/res/` contains the **complete merged resource set**. Set `resource_source = "decompiled_apk"` and use this as the conversion source.
|
|
62
62
|
|
|
63
|
-
If no APK is available, skip this step. The conversion source will be the project's source `res/` directory (typically `<
|
|
63
|
+
If no APK is available, skip this step. The conversion source will be the project's source `res/` directory (typically `<android_project_dir>/app/src/main/res/`). Set `resource_source = "source_res"`.
|
|
64
64
|
|
|
65
65
|
### Step 4: Convert Resources
|
|
66
66
|
|
|
67
67
|
Read the detailed conversion rules from `references/conversion-rules.md` before performing conversions. Convert all resources found in the resource source directory (either decompiled `res/` or source `res/`). Read `references/resource-mapping-rules.md` before conversion as well — every conversion, skip, fallback, and unmappable case must also append structured mapping metadata for the final markdown written to `resource_mapping_path`.
|
|
68
68
|
|
|
69
69
|
**Determining the source `res/` directory when using source fallback:**
|
|
70
|
-
- Check `<
|
|
70
|
+
- Check `<android_project_dir>/app/src/main/res/`
|
|
71
71
|
- If multi-module, also check other module directories
|
|
72
72
|
- If the project uses flavor source sets, include those too (e.g., `app/src/debug/res/`, `app/src/flavor/res/`)
|
|
73
73
|
|