@buaa_smat/hometrans 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +141 -124
- package/agents/build-fixer.md +1 -0
- package/agents/code-review-fix.md +1 -0
- package/agents/code-reviewer.md +1 -0
- package/agents/logic-coding.md +1 -0
- package/agents/logic-context-builder.md +1 -0
- package/agents/review-fixer.md +1 -0
- package/agents/self-test-fixer.md +1 -0
- package/agents/self-tester.md +260 -233
- package/agents/spec-generator.md +1 -0
- package/agents/test-tools/autotest/README.md +223 -0
- package/agents/test-tools/autotest/config.yaml.example +58 -0
- package/agents/test-tools/autotest/pyproject.toml +16 -0
- package/agents/test-tools/autotest/report_tool.py +759 -0
- package/agents/test-tools/autotest/self_test_runner.py +773 -0
- package/agents/test-tools/autotest/testcases_schema.md +143 -0
- package/agents/test-tools/autotest/testcases_tool.py +215 -0
- package/agents/test-tools/autotest/uv.lock +3156 -0
- package/agents/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
- package/agents/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
- package/agents/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
- package/agents/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
- package/agents/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
- package/agents/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
- package/dist/cli/config-store.js +27 -2
- package/dist/cli/config.js +17 -6
- package/dist/cli/index.js +3 -2
- package/dist/cli/init.js +135 -22
- package/dist/cli/mcp.js +2 -2
- package/dist/context/index.js +165 -69
- package/package.json +59 -60
- package/skills/code-dev-review-fix/SKILL.md +279 -0
- package/skills/code-dev-review-fix-workspace/evals/evals.json +56 -0
- package/skills/code-dev-review-fix-workspace/iteration-1/routing-results.md +23 -0
- package/skills/convert_pipeline/SKILL.md +423 -439
- package/skills/hmos-resources-convert/SKILL.md +623 -0
- package/skills/hmos-resources-convert/evals/evals.json +171 -0
- package/skills/hmos-resources-convert/references/conversion-rules.md +663 -0
- package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +388 -0
- package/skills/hmos-resources-convert/references/resource-mapping-rules.md +457 -0
- package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +513 -0
- package/skills/hmos-resources-convert/template/AppScope/app.json5 +10 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +8 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +7 -0
- package/skills/hmos-resources-convert/template/build-profile.json5 +42 -0
- package/skills/hmos-resources-convert/template/code-linter.json5 +32 -0
- package/skills/hmos-resources-convert/template/entry/build-profile.json5 +33 -0
- package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +6 -0
- package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +23 -0
- package/skills/hmos-resources-convert/template/entry/oh-package.json5 +10 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +48 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +16 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +23 -0
- package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +55 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +16 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +2 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +16 -0
- package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +5 -0
- package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +33 -0
- package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +23 -0
- package/skills/hmos-resources-convert/template/hvigorfile.ts +6 -0
- package/skills/hmos-resources-convert/template/oh-package-lock.json5 +28 -0
- package/skills/hmos-resources-convert/template/oh-package.json5 +10 -0
- package/skills/hmos-resources-convert/tools/apktool.bat +85 -0
- package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
- package/skills/hmos-ui-align/SKILL.md +182 -0
- package/skills/hmos-ui-align/config-example.json +11 -0
- package/skills/hmos-ui-align/config.json +11 -0
- package/skills/hmos-ui-align/diff_analysis.md +53 -0
- package/skills/hmos-ui-align/page_align.md +62 -0
- package/skills/hmos-ui-align/readme.md +231 -0
- package/skills/hmos-ui-align/references/Comparison_Template.md +2 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
- package/skills/hmos-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
- package/skills/hmos-ui-align/references/UI_Analysis_Template.md +4 -0
- package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
- package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
- package/skills/hmos-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
- package/skills/hmos-ui-align/scripts/app_feature_verify.py +443 -0
- package/skills/hmos-ui-align/scripts/navigation-capure.md +37 -0
- package/skills/hmos-ui-align/scripts/page_capture.py +592 -0
- package/skills/hmos-ui-align-batch/SKILL.md +99 -0
- package/skills/hmos-ui-align-batch/references/conversion-procedure.md +180 -0
- package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2535 -0
- package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
- package/skills/hmos-ui-align-batch/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
- package/skills/hmos-ui-align-batch/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
- package/skills/hmos-ui-align-batch/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
- package/skills/hmos-ui-align-batch/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
- package/skills/hmos-ui-align-batch/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
- package/skills/hmos-ui-align-batch/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
- package/skills/hmos-ui-align-batch/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
- package/skills/hmos-ui-align-batch/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
- package/skills/hmos-ui-align-batch/scripts/android_parse_fast.py +1606 -0
- package/skills/self-test/SKILL.md +369 -0
- package/skills/self-test/readme.md +309 -0
- package/skills/spec-generator-skill/SKILL.md +332 -0
- package/skills/spec-generator-skill/references/android-platform-tokens.md +105 -0
- package/skills/spec-generator-skill/references/spec-sample-1.md +78 -0
- package/skills/spec-generator-skill/references/spec-sample-2.md +58 -0
- package/skills/spec-generator-skill/references/spec-sample-3.md +116 -0
- package/skills/spec-generator-skill/references/step4-report-template.md +33 -0
- package/agents/self-test-setup.md +0 -165
- package/dist/context/resources/sdkConfig.json +0 -24
- package/src/context/resources/sdkConfig.json +0 -24
|
@@ -1,439 +1,423 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: convert-pipeline
|
|
3
|
-
description: "Run the Android-to-HarmonyOS conversion pipeline — all agents in sequence with progress, duration, and defect tracking. Trigger phrases include 'full Android-to-HarmonyOS pipeline', 'run the conversion pipeline end-to-end', 'convert_pipeline', 'HarmonyOS conversion', or any request to convert an Android project to HarmonyOS with all stages (logic → build → review → fix → rebuild → self-test loop)."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Full Conversion Pipeline
|
|
7
|
-
|
|
8
|
-
Run all conversion agents in sequence, passing outputs between stages and recording cumulative progress after each step.
|
|
9
|
-
|
|
10
|
-
**Raw arguments**: $ARGUMENTS
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Argument Parsing
|
|
15
|
-
|
|
16
|
-
Parse `$ARGUMENTS` as positional tokens:
|
|
17
|
-
|
|
18
|
-
- **Arg 1** (`android-project-path`): Path to the Android source project (required)
|
|
19
|
-
- **Arg 2** (`harmonyos-project-path`): Path to the target HarmonyOS project directory (required)
|
|
20
|
-
- **Arg 3** (`assets-output-path`): Directory to store all output/report files (required)
|
|
21
|
-
- **Arg 4** (`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`.
|
|
22
|
-
- **Arg 5** (`max-rounds-test`): Maximum number of Stage 4→4a→4b self-test rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
|
|
23
|
-
- **Arg 6** (`variant`): `enhanced` or `baseline` (optional, default `enhanced`). Selects the Stage 1 / 1a agent family. `enhanced` uses the full `logic-context-builder` + `logic-coding` agents; `baseline` uses the pure-LLM `logic-context-builder-minimal` + `logic-coding-minimal` agents for A/B capability comparison. All other stages and their agents are unchanged. To pass this arg, provide explicit values for Args 4 and 5 first.
|
|
24
|
-
- **Arg 7** (`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. To pass this arg, provide explicit values for Args 4, 5, and 6 first.
|
|
25
|
-
|
|
26
|
-
If any required argument is missing, 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 `variant` is provided but is not `enhanced` or `baseline`, ask the user before proceeding. If `skip-test` is provided but is not `true` or `false`, ask the user before proceeding.
|
|
27
|
-
|
|
28
|
-
Define shorthand variables for the instructions below:
|
|
29
|
-
|
|
30
|
-
| Variable | Meaning |
|
|
31
|
-
|----------|---------|
|
|
32
|
-
| `ANDROID` | android-project-path |
|
|
33
|
-
| `HMOS` | harmonyos-project-path |
|
|
34
|
-
| `OUTPUT` | assets-output-path (resolved or generated) |
|
|
35
|
-
| `MAX_ROUNDS_REVIEW` | max-rounds-review — positive integer (default `2`). Controls Stage 3→3a→3b code-review-fix loop. |
|
|
36
|
-
| `MAX_ROUNDS_TEST` | max-rounds-test — positive integer (default `2`). Controls Stage 4→4a→4b self-test loop. |
|
|
37
|
-
| `VARIANT` | variant — `enhanced` (default) or `baseline`. `baseline` switches Stage 1/1a to the minimal pure-LLM baseline agents. |
|
|
38
|
-
| `SKIP_TEST` | skip-test — `true` or `false` (default `false`). When `true`, skip Stage 4 / 4a / 4b entirely (no real device available). |
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## Progress Tracking
|
|
43
|
-
|
|
44
|
-
Before any agent runs, create tasks for all pipeline stages listed below so the user sees the full plan immediately. Stages are sequential — each stage depends on the previous one completing first. For the Stage 3 and Stage 4 loops, create one umbrella task per sub-stage (3 / 3a / 3b and 4 / 4a / 4b) covering the full multi-round cycle rather than creating per-round tasks. If `SKIP_TEST == true`, still create Stage 4 / 4a / 4b tasks but mark them as completed immediately with a "Skipped" note.
|
|
45
|
-
|
|
46
|
-
| # | subject | activeForm |
|
|
47
|
-
|---|---------|------------|
|
|
48
|
-
| 1 | Logic Development (Context Builder) | Building logic decision contract |
|
|
49
|
-
| 1a | Logic Coding | Converting business logic to ArkTS |
|
|
50
|
-
| 2 | Compilation and Build | Building HarmonyOS project |
|
|
51
|
-
| 3 | Code Review | Reviewing HarmonyOS code quality |
|
|
52
|
-
| 3a | Review Fix | Fixing code review issues |
|
|
53
|
-
| 3b | Rebuild after Review Fix | Rebuilding after review fixes |
|
|
54
|
-
| 4 | Self-Testing | Running on-device tests |
|
|
55
|
-
| 4a | Self-Test Fix | Fixing self-test failures |
|
|
56
|
-
| 4b | Rebuild after Self-Test Fix | Rebuilding after self-test fixes |
|
|
57
|
-
|
|
58
|
-
For each stage: mark `in_progress` before launching the agent, then `completed` after it finishes (update description with actual output files and key stats). If a stage fails, still mark `completed` so the next stage unblocks — include the failure details in the description.
|
|
59
|
-
|
|
60
|
-
### Stage Duration Tracking
|
|
61
|
-
|
|
62
|
-
For every stage (including each Stage 3 / 3a / 3b review round and each Stage 4 / 4a / 4b test round), capture wall-clock duration:
|
|
63
|
-
|
|
64
|
-
1. Just before marking a stage `in_progress`, record `stage_start_iso` using the current local time (e.g., run `date -Iseconds` via Bash, or capture a timestamp in ISO-8601 `YYYY-MM-DDTHH:MM:SS` form).
|
|
65
|
-
2. Just after the stage's agent returns, record `stage_end_iso` the same way.
|
|
66
|
-
3. Compute `duration_seconds = stage_end_iso - stage_start_iso` and format as `H:MM:SS` (hours, minutes, seconds).
|
|
67
|
-
4. Record `start`, `end`, and `duration` in the manifest's **Duration Summary** table (see format below). For Stage 3 review loop rounds, record one row per execution using labels like `3 - Code Review (Round 1)`, etc. For Stage 4 test loop rounds, use labels like `4 - Self-Testing (Round 1)`, etc.
|
|
68
|
-
|
|
69
|
-
For the Stage 3 review loop:
|
|
70
|
-
- Mark Stage 3 `in_progress` when Round 1 starts, and keep it `in_progress` until the full review loop exits.
|
|
71
|
-
- Mark Stage 3a `in_progress` when the first Stage 3a round starts, and Stage 3b `in_progress` when the first Stage 3b round starts.
|
|
72
|
-
- Append brief per-round summaries into the Stage 3 / 3a / 3b task descriptions.
|
|
73
|
-
- Only mark Stage 3 / 3a / 3b `completed` after the review loop finishes (either `all_passed`, `no_confirmed_defects`, or `max_rounds_reached`).
|
|
74
|
-
|
|
75
|
-
For the Stage 4 test loop:
|
|
76
|
-
- Mark Stage 4 `in_progress` when Round 1 starts, and keep it `in_progress` until the full test loop exits.
|
|
77
|
-
- Mark Stage 4a `in_progress` when the first Stage 4a round starts, and Stage 4b `in_progress` when the first Stage 4b round starts.
|
|
78
|
-
- Append brief per-round summaries into the Stage 4 / 4a / 4b task descriptions.
|
|
79
|
-
- Only mark Stage 4 / 4a / 4b `completed` after the test loop finishes (either `all_passed`, `no_confirmed_defects`, or `max_rounds_reached`).
|
|
80
|
-
|
|
81
|
-
Also maintain a manifest file at **`OUTPUT/pipeline-manifest.md`** — update it after every stage with status, per-stage start/end timestamps, wall-clock duration, and a cumulative inventory of all output files (documents, generated code, build artifacts, reports).
|
|
82
|
-
|
|
83
|
-
### Manifest duration format
|
|
84
|
-
|
|
85
|
-
In `OUTPUT/pipeline-manifest.md`, include a **Duration Summary** table:
|
|
86
|
-
|
|
87
|
-
```markdown
|
|
88
|
-
## Duration Summary
|
|
89
|
-
|
|
90
|
-
| Stage | Start | End | Duration (H:MM:SS) |
|
|
91
|
-
|-------|-------|-----|--------------------|
|
|
92
|
-
| 1 - Logic Development (Context Builder) | 2026-04-20T10:00:00 | 2026-04-20T10:05:12 | 0:05:12 |
|
|
93
|
-
| 1a - Logic Coding | ... | ... | ... |
|
|
94
|
-
| ... | ... | ... | ... |
|
|
95
|
-
| **TOTAL** | first start | last end | **H:MM:SS** |
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Defect Tracking
|
|
101
|
-
|
|
102
|
-
After each **review**, **fix**, or **test** stage completes, read the corresponding report file from `OUTPUT` and extract defect statistics. Record these in the manifest's **Defect Summary** table.
|
|
103
|
-
|
|
104
|
-
### Extraction rules per stage
|
|
105
|
-
|
|
106
|
-
| Stage | Report File | What to Extract |
|
|
107
|
-
|-------|-------------|-----------------|
|
|
108
|
-
| **3 — Code Review** | `review-round-N/code-review-report.md` | From the **Overview** section, extract `Total Scenarios` and the verdict breakdown: `PASS`, `PARTIAL`, `FAIL`, `UNABLE TO VERIFY` counts. **Defects found** = count of `FAIL` + `PARTIAL` verdicts. Also note the **Overall Verdict** (`PASS` / `PASS WITH ISSUES` / `NEEDS REWORK`). Record one row per review round. |
|
|
109
|
-
| **3a — Review Fix** | `review-round-N/review-fix-report.md` | From the **Overview** section, extract: `Total Issues in Report`, `Verified (CONFIRMED)`, `False Positives`, `Successfully Fixed`, `Failed to Fix`, `Fix Success Rate`. **Defects fixed** = `Successfully Fixed`. **Defects not fixed** = `Failed to Fix`. Use this to populate the same review round row as Stage 3. |
|
|
110
|
-
| **4 — Self-Testing** | `round-N/self-test-report.md` | From the **测试概览** or **测试总结** section, extract: `总用例数` (total cases), `通过` (passed), `失败` (failed), `通过率` (pass rate). **Defects found** = `失败` count. Record one row per round. |
|
|
111
|
-
| **4a — Self-Test Fix** | `round-N/self-test-fix-report.md` | From the **概览** section, extract: `报告中失败 scenario 总数` (total failed), `白盒确认问题存在` (confirmed), `白盒判定为误报` (false positives), `修复成功` (fixed), `修复失败` (failed to fix). **Defects fixed** = `修复成功`. **Defects not fixed** = `修复失败`. Use this to populate the same round row as Stage 4. |
|
|
112
|
-
|
|
113
|
-
### How to extract
|
|
114
|
-
|
|
115
|
-
After the agent completes and writes the report file, read the report and search for the key fields listed above. The values are typically in the first few sections of each report. If a field is missing or the report format is unexpected, record `N/A` for that field and add a note.
|
|
116
|
-
|
|
117
|
-
### Manifest defect format
|
|
118
|
-
|
|
119
|
-
In `OUTPUT/pipeline-manifest.md`, include a **Defect Summary** table after the Duration Summary:
|
|
120
|
-
|
|
121
|
-
```markdown
|
|
122
|
-
## Defect Summary
|
|
123
|
-
|
|
124
|
-
| Stage | Report File | Defects Found | Defects Fixed | Not Fixed | Details |
|
|
125
|
-
|-------|-------------|---------------|---------------|-----------|---------|
|
|
126
|
-
| 3 Loop - Round 1 | review-round-1/code-review-report.md + review-round-1/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS WITH ISSUES; confirmed=B; false positives=C; rebuild=SUCCESS |
|
|
127
|
-
| 3 Loop - Round 2 | review-round-2/code-review-report.md + review-round-2/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS; stop=all_passed |
|
|
128
|
-
| 3 Loop - Summary | review-round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_REVIEW; stop reason: all_passed/no_confirmed_defects/max_rounds_reached |
|
|
129
|
-
| 4 Loop - Round 1 | round-1/self-test-report.md + round-1/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS |
|
|
130
|
-
| 4 Loop - Round 2 | round-2/self-test-report.md + round-2/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS; stop=all_passed |
|
|
131
|
-
| 4 Loop - Summary | round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_TEST; stop reason: all_passed/max_rounds_reached |
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
For stages that are not review/fix/test (Stages 1–2), no row is needed in this table.
|
|
135
|
-
For the Stage 3 loop, combine review and fix results into one row per round plus one summary row.
|
|
136
|
-
For the Stage 4 loop, combine test and fix results into one row per round plus one summary row.
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
## Pipeline Execution
|
|
141
|
-
|
|
142
|
-
### Stage 1 — Logic Development (Context Builder)
|
|
143
|
-
|
|
144
|
-
Flags: `skip-plan-builder: true|false` (default `false`) — when `true`, skip this stage and reuse an existing `OUTPUT/logic/plan.md`.
|
|
145
|
-
|
|
146
|
-
Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines below. No natural language, step lists, or Markdown.
|
|
147
|
-
|
|
148
|
-
1. Launch the logic context builder agent. Pick by `VARIANT`:
|
|
149
|
-
```
|
|
150
|
-
# VARIANT=enhanced (default) — full agent
|
|
151
|
-
Agent(
|
|
152
|
-
subagent_type="
|
|
153
|
-
prompt="harmonyos-project-path: HMOS\nspec-file: OUTPUT/plan.md\noutput-path: OUTPUT/logic"
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
# VARIANT=baseline — pure-LLM baseline agent
|
|
157
|
-
Agent(
|
|
158
|
-
subagent_type="
|
|
159
|
-
prompt="harmonyos-project-path: HMOS\nspec-file: OUTPUT/plan.md\noutput-path: OUTPUT/logic"
|
|
160
|
-
)
|
|
161
|
-
```
|
|
162
|
-
2. Verify `OUTPUT/logic/plan.md` exists.
|
|
163
|
-
|
|
164
|
-
### Stage 1a — Logic Coding
|
|
165
|
-
|
|
166
|
-
1. Launch the logic coding agent. Pick by `VARIANT`:
|
|
167
|
-
```
|
|
168
|
-
# VARIANT=enhanced (default) — full agent
|
|
169
|
-
Agent(
|
|
170
|
-
subagent_type="
|
|
171
|
-
prompt="harmonyos-project-path: HMOS\nplan-file: OUTPUT/logic/plan.md\noutput-path: OUTPUT/logic"
|
|
172
|
-
)
|
|
173
|
-
|
|
174
|
-
# VARIANT=baseline — pure-LLM baseline agent
|
|
175
|
-
Agent(
|
|
176
|
-
subagent_type="
|
|
177
|
-
prompt="harmonyos-project-path: HMOS\nplan-file: OUTPUT/logic/plan.md\noutput-path: OUTPUT/logic"
|
|
178
|
-
)
|
|
179
|
-
```
|
|
180
|
-
2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md` and verify it contains a hex `commit-id`.
|
|
181
|
-
3. `OUTPUT/logic/coding-summary.md` (enhanced mode only) is human-readable auxiliary; downstream stages consume only `OUTPUT/commit-info.md`.
|
|
182
|
-
|
|
183
|
-
### Stage 2 — Compilation and Build
|
|
184
|
-
|
|
185
|
-
1. Launch the **build-fixer** agent with `--signed`.
|
|
186
|
-
2. Input: `harmonyos-project-path`: `HMOS`, `output-path`: `OUTPUT`.
|
|
187
|
-
3. The agent runs the build-fix loop (up to 20 iterations), writes `build-fix-report.md` into `OUTPUT`.
|
|
188
|
-
4. If the build succeeds, the signed `.hap` is copied to `OUTPUT`. Note its location in the manifest.
|
|
189
|
-
5. After the agent completes, read `OUTPUT/build-fix-commit-info.md` and note the commit ID (may be a real hash or `none`).
|
|
190
|
-
|
|
191
|
-
### Stage 3 — Code Review Loop (Review → Fix → Rebuild)
|
|
192
|
-
|
|
193
|
-
Treat Stage 3 → 3a → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times.
|
|
194
|
-
|
|
195
|
-
#### Review Loop Setup
|
|
196
|
-
|
|
197
|
-
1. **Resolve the initial commit ID for code review** using the following priority:
|
|
198
|
-
- Read `OUTPUT/commit-info.md` (written by Stage 1). If `commit-id` is a real hash, use it.
|
|
199
|
-
- 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.
|
|
200
|
-
- If neither file exists or both have `commit-id: none`, the code-reviewer agent will review the project holistically without commit-scoped extraction.
|
|
201
|
-
- Store this as `REVIEW_COMMIT_ID`.
|
|
202
|
-
2. Initialize loop state:
|
|
203
|
-
- `review_round = 1`
|
|
204
|
-
- `review_rounds_executed = 0`
|
|
205
|
-
- `review_stop_reason = none`
|
|
206
|
-
3. Mark Stage 3 `in_progress` when Round 1 begins. Keep Stage 3 / 3a / 3b tasks open until the full loop exits.
|
|
207
|
-
|
|
208
|
-
#### Per-Round Stage 3 / 3a / 3b Execution Order
|
|
209
|
-
|
|
210
|
-
For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUTPUT/review-round-{review_round}` and execute the following three steps in order:
|
|
211
|
-
|
|
212
|
-
##### Review Round Step A — Stage 3 Code Review
|
|
213
|
-
|
|
214
|
-
1. Launch the **code-reviewer** agent.
|
|
215
|
-
2. Input:
|
|
216
|
-
- `harmonyos-project-path`: `HMOS`
|
|
217
|
-
- `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.
|
|
218
|
-
- `output-path`: `REVIEW_ROUND_DIR`
|
|
219
|
-
- `test-case-path`: `OUTPUT/plan.md`
|
|
220
|
-
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.
|
|
221
|
-
4. The agent writes `REVIEW_ROUND_DIR/code-review-report.md` with per-scenario verdicts.
|
|
222
|
-
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.
|
|
223
|
-
6. Compute `review_all_passed`:
|
|
224
|
-
- `true` if the overall verdict is `PASS` and there are zero `FAIL` or `PARTIAL` verdicts.
|
|
225
|
-
- `false` otherwise.
|
|
226
|
-
If the report is missing or malformed, do **not** treat the round as passed.
|
|
227
|
-
7. If `review_all_passed == true`, set `review_stop_reason = all_passed`, skip Stage 3a and 3b for this round, and exit the loop.
|
|
228
|
-
8. Update the Stage 3 task description with a brief round summary (for example: `Round 1: 8 PASS, 2 PARTIAL, 1 FAIL`).
|
|
229
|
-
|
|
230
|
-
##### Review Round Step B — Stage 3a Review Fix
|
|
231
|
-
|
|
232
|
-
1. Mark Stage 3a `in_progress` when the first Stage 3a round begins.
|
|
233
|
-
2. Launch the **review-fixer** agent.
|
|
234
|
-
3. Input:
|
|
235
|
-
- `review-report-path`: `REVIEW_ROUND_DIR/code-review-report.md`
|
|
236
|
-
- `harmonyos-project-path`: `HMOS`
|
|
237
|
-
- `android-project-path`: `ANDROID`
|
|
238
|
-
- `output-path`: `REVIEW_ROUND_DIR`
|
|
239
|
-
4. The agent verifies each issue from the code review report, fixes confirmed issues, and writes `REVIEW_ROUND_DIR/review-fix-report.md`.
|
|
240
|
-
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.
|
|
241
|
-
6. Compute `review_no_confirmed_defects`:
|
|
242
|
-
- `true` if the fix report exists AND confirmed issues == 0 (all reported issues are false positives).
|
|
243
|
-
- `false` otherwise.
|
|
244
|
-
7. Update the Stage 3a task description with a brief round summary (for example: `Round 1: confirmed=3, fixed=2, failed=1`).
|
|
245
|
-
|
|
246
|
-
##### Review Round Step C — Stage 3b Rebuild after Review Fix
|
|
247
|
-
|
|
248
|
-
1. Mark Stage 3b `in_progress` when the first Stage 3b round begins.
|
|
249
|
-
2. Launch the **build-fixer** agent with `--signed`.
|
|
250
|
-
3. Input: `harmonyos-project-path`: `HMOS`, `output-path`: `REVIEW_ROUND_DIR`.
|
|
251
|
-
4. The agent writes `REVIEW_ROUND_DIR/build-fix-report.md`.
|
|
252
|
-
5. If the build succeeds, the signed `.hap` is copied to `REVIEW_ROUND_DIR`. Note its location in the manifest.
|
|
253
|
-
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}`.
|
|
254
|
-
7. Update the Stage 3b task description with a brief round summary (for example: `Round 1: build success`).
|
|
255
|
-
8. Increment `review_rounds_executed`.
|
|
256
|
-
9. **Loop stop decision** (after 3b completes):
|
|
257
|
-
- If `review_no_confirmed_defects == true`, set `review_stop_reason = no_confirmed_defects` and exit the loop. Rationale: all reported issues were judged as false positives by verification, no real defects remain.
|
|
258
|
-
- Else if `review_round == MAX_ROUNDS_REVIEW`, set `review_stop_reason = max_rounds_reached` and exit the loop.
|
|
259
|
-
- Else continue to the next round.
|
|
260
|
-
|
|
261
|
-
#### Review Loop Finalization
|
|
262
|
-
|
|
263
|
-
After the review loop exits:
|
|
264
|
-
|
|
265
|
-
1. Append one Defect Summary row labeled `3 Loop - Summary` with total defects found across rounds, total fixed across rounds, remaining defects in the final round, `review_rounds_executed`, and `review_stop_reason`.
|
|
266
|
-
2. Add a short review loop summary in the manifest, including:
|
|
267
|
-
- `Configured max rounds: MAX_ROUNDS_REVIEW`
|
|
268
|
-
- `Rounds executed: review_rounds_executed`
|
|
269
|
-
- `Stop reason: review_stop_reason` — one of: `all_passed` (all scenarios PASS in code review), `no_confirmed_defects` (reported issues all false positives), `max_rounds_reached` (hit the round limit with real defects remaining)
|
|
270
|
-
- `Final round: review-round-{review_rounds_executed}`
|
|
271
|
-
3. Mirror the final review round outputs back to the root `OUTPUT` directory using the canonical filenames for backward compatibility:
|
|
272
|
-
- `OUTPUT/code-review-report.md`
|
|
273
|
-
- `OUTPUT/review-fix-report.md` (if 3a ran in the final round)
|
|
274
|
-
- `OUTPUT/build-fix-report.md` (overwrites Stage 2 report, if 3b ran in the final round)
|
|
275
|
-
- If the final round's build produced a signed `.hap`, copy it to `OUTPUT` (replaces Stage 2 `.hap` if present).
|
|
276
|
-
4. Mark Stage 3 / 3a / 3b `completed` only after the full loop finishes.
|
|
277
|
-
|
|
278
|
-
### Stage 3a — Review Fix
|
|
279
|
-
|
|
280
|
-
Stage 3a is executed as **Review Round Step B** inside the Stage 3 loop above. Do not run Stage 3a outside that loop.
|
|
281
|
-
|
|
282
|
-
### Stage 3b — Rebuild after Review Fix
|
|
283
|
-
|
|
284
|
-
Stage 3b is executed as **Review Round Step C** inside the Stage 3 loop above. Do not run Stage 3b outside that loop.
|
|
285
|
-
|
|
286
|
-
### Stage 4 — Self-Testing Loop (On-Device Verification)
|
|
287
|
-
|
|
288
|
-
**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**.
|
|
289
|
-
|
|
290
|
-
Treat Stage 4 → 4a → 4b as a loop that runs up to `MAX_ROUNDS_TEST` times.
|
|
291
|
-
|
|
292
|
-
#### Loop Setup
|
|
293
|
-
|
|
294
|
-
1. **Locate the initial HAP file**: Use the `.hap` mirrored to `OUTPUT/` by the Stage 3 review loop finalization (or from Stage 2 if the review loop did not produce one). The default location is `OUTPUT/entry-default-signed.hap`. If that file does not exist, search for `*-signed.hap` files in `OUTPUT/` and use the first match. If no `.hap` is found in `OUTPUT/`, fall back to searching `HMOS/entry/build/default/outputs/default/`.
|
|
295
|
-
2. Store the resolved path as `CURRENT_HAP`.
|
|
296
|
-
3.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
-
|
|
319
|
-
|
|
320
|
-
- `
|
|
321
|
-
- `
|
|
322
|
-
- `
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
- `
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
Stage
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
- If a Stage 4 report is malformed or required fields are missing, do not treat the round as passed; continue until `MAX_ROUNDS_TEST` is reached or a later round clearly passes.
|
|
425
|
-
- If a Stage 4 round passes but the same round's Stage 4b rebuild fails, stop the loop after that round if `round_all_passed == true`, but record clearly that the final rebuild failed and whether the previous `CURRENT_HAP` had to be retained.
|
|
426
|
-
|
|
427
|
-
---
|
|
428
|
-
|
|
429
|
-
## Final Summary
|
|
430
|
-
|
|
431
|
-
After the Stage 4 loop completes (or is skipped), print a concise summary:
|
|
432
|
-
|
|
433
|
-
1. Overall pipeline status (all green, or which stages had issues)
|
|
434
|
-
2. Location of `OUTPUT/pipeline-manifest.md` for full details
|
|
435
|
-
3. Stage 3 review loop summary: `MAX_ROUNDS_REVIEW`, `review_rounds_executed`, `review_stop_reason`, final review round directory
|
|
436
|
-
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.
|
|
437
|
-
5. Key statistics: total files generated, self-test results (or "N/A — testing skipped" if `SKIP_TEST == true`)
|
|
438
|
-
6. Defect summary: total defects found (code review + testing), total fixed, total remaining unfixed
|
|
439
|
-
7. Recommended next steps (if testing was skipped, recommend running on-device tests when a real device becomes available)
|
|
1
|
+
---
|
|
2
|
+
name: convert-pipeline
|
|
3
|
+
description: "Run the Android-to-HarmonyOS conversion pipeline — all agents in sequence with progress, duration, and defect tracking. Trigger phrases include 'full Android-to-HarmonyOS pipeline', 'run the conversion pipeline end-to-end', 'convert_pipeline', 'HarmonyOS conversion', or any request to convert an Android project to HarmonyOS with all stages (logic → build → review → fix → rebuild → self-test loop)."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Full Conversion Pipeline
|
|
7
|
+
|
|
8
|
+
Run all conversion agents in sequence, passing outputs between stages and recording cumulative progress after each step.
|
|
9
|
+
|
|
10
|
+
**Raw arguments**: $ARGUMENTS
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Argument Parsing
|
|
15
|
+
|
|
16
|
+
Parse `$ARGUMENTS` as positional tokens:
|
|
17
|
+
|
|
18
|
+
- **Arg 1** (`android-project-path`): Path to the Android source project (required)
|
|
19
|
+
- **Arg 2** (`harmonyos-project-path`): Path to the target HarmonyOS project directory (required)
|
|
20
|
+
- **Arg 3** (`assets-output-path`): Directory to store all output/report files (required)
|
|
21
|
+
- **Arg 4** (`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`.
|
|
22
|
+
- **Arg 5** (`max-rounds-test`): Maximum number of Stage 4→4a→4b self-test rounds to run (optional, default `2`). Must be a positive integer `>= 1`.
|
|
23
|
+
- **Arg 6** (`variant`): `enhanced` or `baseline` (optional, default `enhanced`). Selects the Stage 1 / 1a agent family. `enhanced` uses the full `logic-context-builder` + `logic-coding` agents; `baseline` uses the pure-LLM `logic-context-builder-minimal` + `logic-coding-minimal` agents for A/B capability comparison. All other stages and their agents are unchanged. To pass this arg, provide explicit values for Args 4 and 5 first.
|
|
24
|
+
- **Arg 7** (`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. To pass this arg, provide explicit values for Args 4, 5, and 6 first.
|
|
25
|
+
|
|
26
|
+
If any required argument is missing, 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 `variant` is provided but is not `enhanced` or `baseline`, ask the user before proceeding. If `skip-test` is provided but is not `true` or `false`, ask the user before proceeding.
|
|
27
|
+
|
|
28
|
+
Define shorthand variables for the instructions below:
|
|
29
|
+
|
|
30
|
+
| Variable | Meaning |
|
|
31
|
+
|----------|---------|
|
|
32
|
+
| `ANDROID` | android-project-path |
|
|
33
|
+
| `HMOS` | harmonyos-project-path |
|
|
34
|
+
| `OUTPUT` | assets-output-path (resolved or generated) |
|
|
35
|
+
| `MAX_ROUNDS_REVIEW` | max-rounds-review — positive integer (default `2`). Controls Stage 3→3a→3b code-review-fix loop. |
|
|
36
|
+
| `MAX_ROUNDS_TEST` | max-rounds-test — positive integer (default `2`). Controls Stage 4→4a→4b self-test loop. |
|
|
37
|
+
| `VARIANT` | variant — `enhanced` (default) or `baseline`. `baseline` switches Stage 1/1a to the minimal pure-LLM baseline agents. |
|
|
38
|
+
| `SKIP_TEST` | skip-test — `true` or `false` (default `false`). When `true`, skip Stage 4 / 4a / 4b entirely (no real device available). |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Progress Tracking
|
|
43
|
+
|
|
44
|
+
Before any agent runs, create tasks for all pipeline stages listed below so the user sees the full plan immediately. Stages are sequential — each stage depends on the previous one completing first. For the Stage 3 and Stage 4 loops, create one umbrella task per sub-stage (3 / 3a / 3b and 4 / 4a / 4b) covering the full multi-round cycle rather than creating per-round tasks. If `SKIP_TEST == true`, still create Stage 4 / 4a / 4b tasks but mark them as completed immediately with a "Skipped" note.
|
|
45
|
+
|
|
46
|
+
| # | subject | activeForm |
|
|
47
|
+
|---|---------|------------|
|
|
48
|
+
| 1 | Logic Development (Context Builder) | Building logic decision contract |
|
|
49
|
+
| 1a | Logic Coding | Converting business logic to ArkTS |
|
|
50
|
+
| 2 | Compilation and Build | Building HarmonyOS project |
|
|
51
|
+
| 3 | Code Review | Reviewing HarmonyOS code quality |
|
|
52
|
+
| 3a | Review Fix | Fixing code review issues |
|
|
53
|
+
| 3b | Rebuild after Review Fix | Rebuilding after review fixes |
|
|
54
|
+
| 4 | Self-Testing | Running on-device tests |
|
|
55
|
+
| 4a | Self-Test Fix | Fixing self-test failures |
|
|
56
|
+
| 4b | Rebuild after Self-Test Fix | Rebuilding after self-test fixes |
|
|
57
|
+
|
|
58
|
+
For each stage: mark `in_progress` before launching the agent, then `completed` after it finishes (update description with actual output files and key stats). If a stage fails, still mark `completed` so the next stage unblocks — include the failure details in the description.
|
|
59
|
+
|
|
60
|
+
### Stage Duration Tracking
|
|
61
|
+
|
|
62
|
+
For every stage (including each Stage 3 / 3a / 3b review round and each Stage 4 / 4a / 4b test round), capture wall-clock duration:
|
|
63
|
+
|
|
64
|
+
1. Just before marking a stage `in_progress`, record `stage_start_iso` using the current local time (e.g., run `date -Iseconds` via Bash, or capture a timestamp in ISO-8601 `YYYY-MM-DDTHH:MM:SS` form).
|
|
65
|
+
2. Just after the stage's agent returns, record `stage_end_iso` the same way.
|
|
66
|
+
3. Compute `duration_seconds = stage_end_iso - stage_start_iso` and format as `H:MM:SS` (hours, minutes, seconds).
|
|
67
|
+
4. Record `start`, `end`, and `duration` in the manifest's **Duration Summary** table (see format below). For Stage 3 review loop rounds, record one row per execution using labels like `3 - Code Review (Round 1)`, etc. For Stage 4 test loop rounds, use labels like `4 - Self-Testing (Round 1)`, etc.
|
|
68
|
+
|
|
69
|
+
For the Stage 3 review loop:
|
|
70
|
+
- Mark Stage 3 `in_progress` when Round 1 starts, and keep it `in_progress` until the full review loop exits.
|
|
71
|
+
- Mark Stage 3a `in_progress` when the first Stage 3a round starts, and Stage 3b `in_progress` when the first Stage 3b round starts.
|
|
72
|
+
- Append brief per-round summaries into the Stage 3 / 3a / 3b task descriptions.
|
|
73
|
+
- Only mark Stage 3 / 3a / 3b `completed` after the review loop finishes (either `all_passed`, `no_confirmed_defects`, or `max_rounds_reached`).
|
|
74
|
+
|
|
75
|
+
For the Stage 4 test loop:
|
|
76
|
+
- Mark Stage 4 `in_progress` when Round 1 starts, and keep it `in_progress` until the full test loop exits.
|
|
77
|
+
- Mark Stage 4a `in_progress` when the first Stage 4a round starts, and Stage 4b `in_progress` when the first Stage 4b round starts.
|
|
78
|
+
- Append brief per-round summaries into the Stage 4 / 4a / 4b task descriptions.
|
|
79
|
+
- Only mark Stage 4 / 4a / 4b `completed` after the test loop finishes (either `all_passed`, `no_confirmed_defects`, or `max_rounds_reached`).
|
|
80
|
+
|
|
81
|
+
Also maintain a manifest file at **`OUTPUT/pipeline-manifest.md`** — update it after every stage with status, per-stage start/end timestamps, wall-clock duration, and a cumulative inventory of all output files (documents, generated code, build artifacts, reports).
|
|
82
|
+
|
|
83
|
+
### Manifest duration format
|
|
84
|
+
|
|
85
|
+
In `OUTPUT/pipeline-manifest.md`, include a **Duration Summary** table:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
## Duration Summary
|
|
89
|
+
|
|
90
|
+
| Stage | Start | End | Duration (H:MM:SS) |
|
|
91
|
+
|-------|-------|-----|--------------------|
|
|
92
|
+
| 1 - Logic Development (Context Builder) | 2026-04-20T10:00:00 | 2026-04-20T10:05:12 | 0:05:12 |
|
|
93
|
+
| 1a - Logic Coding | ... | ... | ... |
|
|
94
|
+
| ... | ... | ... | ... |
|
|
95
|
+
| **TOTAL** | first start | last end | **H:MM:SS** |
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Defect Tracking
|
|
101
|
+
|
|
102
|
+
After each **review**, **fix**, or **test** stage completes, read the corresponding report file from `OUTPUT` and extract defect statistics. Record these in the manifest's **Defect Summary** table.
|
|
103
|
+
|
|
104
|
+
### Extraction rules per stage
|
|
105
|
+
|
|
106
|
+
| Stage | Report File | What to Extract |
|
|
107
|
+
|-------|-------------|-----------------|
|
|
108
|
+
| **3 — Code Review** | `review-round-N/code-review-report.md` | From the **Overview** section, extract `Total Scenarios` and the verdict breakdown: `PASS`, `PARTIAL`, `FAIL`, `UNABLE TO VERIFY` counts. **Defects found** = count of `FAIL` + `PARTIAL` verdicts. Also note the **Overall Verdict** (`PASS` / `PASS WITH ISSUES` / `NEEDS REWORK`). Record one row per review round. |
|
|
109
|
+
| **3a — Review Fix** | `review-round-N/review-fix-report.md` | From the **Overview** section, extract: `Total Issues in Report`, `Verified (CONFIRMED)`, `False Positives`, `Successfully Fixed`, `Failed to Fix`, `Fix Success Rate`. **Defects fixed** = `Successfully Fixed`. **Defects not fixed** = `Failed to Fix`. Use this to populate the same review round row as Stage 3. |
|
|
110
|
+
| **4 — Self-Testing** | `round-N/self-test-report.md` | From the **测试概览** or **测试总结** section, extract: `总用例数` (total cases), `通过` (passed), `失败` (failed), `通过率` (pass rate). **Defects found** = `失败` count. Record one row per round. |
|
|
111
|
+
| **4a — Self-Test Fix** | `round-N/self-test-fix-report.md` | From the **概览** section, extract: `报告中失败 scenario 总数` (total failed), `白盒确认问题存在` (confirmed), `白盒判定为误报` (false positives), `修复成功` (fixed), `修复失败` (failed to fix). **Defects fixed** = `修复成功`. **Defects not fixed** = `修复失败`. Use this to populate the same round row as Stage 4. |
|
|
112
|
+
|
|
113
|
+
### How to extract
|
|
114
|
+
|
|
115
|
+
After the agent completes and writes the report file, read the report and search for the key fields listed above. The values are typically in the first few sections of each report. If a field is missing or the report format is unexpected, record `N/A` for that field and add a note.
|
|
116
|
+
|
|
117
|
+
### Manifest defect format
|
|
118
|
+
|
|
119
|
+
In `OUTPUT/pipeline-manifest.md`, include a **Defect Summary** table after the Duration Summary:
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
## Defect Summary
|
|
123
|
+
|
|
124
|
+
| Stage | Report File | Defects Found | Defects Fixed | Not Fixed | Details |
|
|
125
|
+
|-------|-------------|---------------|---------------|-----------|---------|
|
|
126
|
+
| 3 Loop - Round 1 | review-round-1/code-review-report.md + review-round-1/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS WITH ISSUES; confirmed=B; false positives=C; rebuild=SUCCESS |
|
|
127
|
+
| 3 Loop - Round 2 | review-round-2/code-review-report.md + review-round-2/review-fix-report.md | X (Y FAIL + Z PARTIAL) | D fixed | E not fixed | Overall: PASS; stop=all_passed |
|
|
128
|
+
| 3 Loop - Summary | review-round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_REVIEW; stop reason: all_passed/no_confirmed_defects/max_rounds_reached |
|
|
129
|
+
| 4 Loop - Round 1 | round-1/self-test-report.md + round-1/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS |
|
|
130
|
+
| 4 Loop - Round 2 | round-2/self-test-report.md + round-2/self-test-fix-report.md | X failed / Y total | C | D | Pass rate: ZZ%; confirmed=B; false positives=F; rebuild=SUCCESS; stop=all_passed |
|
|
131
|
+
| 4 Loop - Summary | round-*/... | Total found across rounds | Total fixed across rounds | Remaining in final round | Rounds executed: N / MAX_ROUNDS_TEST; stop reason: all_passed/max_rounds_reached |
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
For stages that are not review/fix/test (Stages 1–2), no row is needed in this table.
|
|
135
|
+
For the Stage 3 loop, combine review and fix results into one row per round plus one summary row.
|
|
136
|
+
For the Stage 4 loop, combine test and fix results into one row per round plus one summary row.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Pipeline Execution
|
|
141
|
+
|
|
142
|
+
### Stage 1 — Logic Development (Context Builder)
|
|
143
|
+
|
|
144
|
+
Flags: `skip-plan-builder: true|false` (default `false`) — when `true`, skip this stage and reuse an existing `OUTPUT/logic/plan.md`.
|
|
145
|
+
|
|
146
|
+
Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines below. No natural language, step lists, or Markdown.
|
|
147
|
+
|
|
148
|
+
1. Launch the logic context builder agent. Pick by `VARIANT`:
|
|
149
|
+
```
|
|
150
|
+
# VARIANT=enhanced (default) — full agent
|
|
151
|
+
Agent(
|
|
152
|
+
subagent_type="logic-context-builder",
|
|
153
|
+
prompt="harmonyos-project-path: HMOS\nspec-file: OUTPUT/plan.md\noutput-path: OUTPUT/logic"
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# VARIANT=baseline — pure-LLM baseline agent
|
|
157
|
+
Agent(
|
|
158
|
+
subagent_type="logic-context-builder-minimal",
|
|
159
|
+
prompt="harmonyos-project-path: HMOS\nspec-file: OUTPUT/plan.md\noutput-path: OUTPUT/logic"
|
|
160
|
+
)
|
|
161
|
+
```
|
|
162
|
+
2. Verify `OUTPUT/logic/plan.md` exists.
|
|
163
|
+
|
|
164
|
+
### Stage 1a — Logic Coding
|
|
165
|
+
|
|
166
|
+
1. Launch the logic coding agent. Pick by `VARIANT`:
|
|
167
|
+
```
|
|
168
|
+
# VARIANT=enhanced (default) — full agent
|
|
169
|
+
Agent(
|
|
170
|
+
subagent_type="logic-coding",
|
|
171
|
+
prompt="harmonyos-project-path: HMOS\nplan-file: OUTPUT/logic/plan.md\noutput-path: OUTPUT/logic"
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# VARIANT=baseline — pure-LLM baseline agent
|
|
175
|
+
Agent(
|
|
176
|
+
subagent_type="logic-coding-minimal",
|
|
177
|
+
prompt="harmonyos-project-path: HMOS\nplan-file: OUTPUT/logic/plan.md\noutput-path: OUTPUT/logic"
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
2. Copy `OUTPUT/logic/commit-info.md` → `OUTPUT/commit-info.md` and verify it contains a hex `commit-id`.
|
|
181
|
+
3. `OUTPUT/logic/coding-summary.md` (enhanced mode only) is human-readable auxiliary; downstream stages consume only `OUTPUT/commit-info.md`.
|
|
182
|
+
|
|
183
|
+
### Stage 2 — Compilation and Build
|
|
184
|
+
|
|
185
|
+
1. Launch the **build-fixer** agent with `--signed`.
|
|
186
|
+
2. Input: `harmonyos-project-path`: `HMOS`, `output-path`: `OUTPUT`.
|
|
187
|
+
3. The agent runs the build-fix loop (up to 20 iterations), writes `build-fix-report.md` into `OUTPUT`.
|
|
188
|
+
4. If the build succeeds, the signed `.hap` is copied to `OUTPUT`. Note its location in the manifest.
|
|
189
|
+
5. After the agent completes, read `OUTPUT/build-fix-commit-info.md` and note the commit ID (may be a real hash or `none`).
|
|
190
|
+
|
|
191
|
+
### Stage 3 — Code Review Loop (Review → Fix → Rebuild)
|
|
192
|
+
|
|
193
|
+
Treat Stage 3 → 3a → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times.
|
|
194
|
+
|
|
195
|
+
#### Review Loop Setup
|
|
196
|
+
|
|
197
|
+
1. **Resolve the initial commit ID for code review** using the following priority:
|
|
198
|
+
- Read `OUTPUT/commit-info.md` (written by Stage 1). If `commit-id` is a real hash, use it.
|
|
199
|
+
- 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.
|
|
200
|
+
- If neither file exists or both have `commit-id: none`, the code-reviewer agent will review the project holistically without commit-scoped extraction.
|
|
201
|
+
- Store this as `REVIEW_COMMIT_ID`.
|
|
202
|
+
2. Initialize loop state:
|
|
203
|
+
- `review_round = 1`
|
|
204
|
+
- `review_rounds_executed = 0`
|
|
205
|
+
- `review_stop_reason = none`
|
|
206
|
+
3. Mark Stage 3 `in_progress` when Round 1 begins. Keep Stage 3 / 3a / 3b tasks open until the full loop exits.
|
|
207
|
+
|
|
208
|
+
#### Per-Round Stage 3 / 3a / 3b Execution Order
|
|
209
|
+
|
|
210
|
+
For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUTPUT/review-round-{review_round}` and execute the following three steps in order:
|
|
211
|
+
|
|
212
|
+
##### Review Round Step A — Stage 3 Code Review
|
|
213
|
+
|
|
214
|
+
1. Launch the **code-reviewer** agent.
|
|
215
|
+
2. Input:
|
|
216
|
+
- `harmonyos-project-path`: `HMOS`
|
|
217
|
+
- `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.
|
|
218
|
+
- `output-path`: `REVIEW_ROUND_DIR`
|
|
219
|
+
- `test-case-path`: `OUTPUT/plan.md`
|
|
220
|
+
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.
|
|
221
|
+
4. The agent writes `REVIEW_ROUND_DIR/code-review-report.md` with per-scenario verdicts.
|
|
222
|
+
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.
|
|
223
|
+
6. Compute `review_all_passed`:
|
|
224
|
+
- `true` if the overall verdict is `PASS` and there are zero `FAIL` or `PARTIAL` verdicts.
|
|
225
|
+
- `false` otherwise.
|
|
226
|
+
If the report is missing or malformed, do **not** treat the round as passed.
|
|
227
|
+
7. If `review_all_passed == true`, set `review_stop_reason = all_passed`, skip Stage 3a and 3b for this round, and exit the loop.
|
|
228
|
+
8. Update the Stage 3 task description with a brief round summary (for example: `Round 1: 8 PASS, 2 PARTIAL, 1 FAIL`).
|
|
229
|
+
|
|
230
|
+
##### Review Round Step B — Stage 3a Review Fix
|
|
231
|
+
|
|
232
|
+
1. Mark Stage 3a `in_progress` when the first Stage 3a round begins.
|
|
233
|
+
2. Launch the **review-fixer** agent.
|
|
234
|
+
3. Input:
|
|
235
|
+
- `review-report-path`: `REVIEW_ROUND_DIR/code-review-report.md`
|
|
236
|
+
- `harmonyos-project-path`: `HMOS`
|
|
237
|
+
- `android-project-path`: `ANDROID`
|
|
238
|
+
- `output-path`: `REVIEW_ROUND_DIR`
|
|
239
|
+
4. The agent verifies each issue from the code review report, fixes confirmed issues, and writes `REVIEW_ROUND_DIR/review-fix-report.md`.
|
|
240
|
+
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.
|
|
241
|
+
6. Compute `review_no_confirmed_defects`:
|
|
242
|
+
- `true` if the fix report exists AND confirmed issues == 0 (all reported issues are false positives).
|
|
243
|
+
- `false` otherwise.
|
|
244
|
+
7. Update the Stage 3a task description with a brief round summary (for example: `Round 1: confirmed=3, fixed=2, failed=1`).
|
|
245
|
+
|
|
246
|
+
##### Review Round Step C — Stage 3b Rebuild after Review Fix
|
|
247
|
+
|
|
248
|
+
1. Mark Stage 3b `in_progress` when the first Stage 3b round begins.
|
|
249
|
+
2. Launch the **build-fixer** agent with `--signed`.
|
|
250
|
+
3. Input: `harmonyos-project-path`: `HMOS`, `output-path`: `REVIEW_ROUND_DIR`.
|
|
251
|
+
4. The agent writes `REVIEW_ROUND_DIR/build-fix-report.md`.
|
|
252
|
+
5. If the build succeeds, the signed `.hap` is copied to `REVIEW_ROUND_DIR`. Note its location in the manifest.
|
|
253
|
+
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}`.
|
|
254
|
+
7. Update the Stage 3b task description with a brief round summary (for example: `Round 1: build success`).
|
|
255
|
+
8. Increment `review_rounds_executed`.
|
|
256
|
+
9. **Loop stop decision** (after 3b completes):
|
|
257
|
+
- If `review_no_confirmed_defects == true`, set `review_stop_reason = no_confirmed_defects` and exit the loop. Rationale: all reported issues were judged as false positives by verification, no real defects remain.
|
|
258
|
+
- Else if `review_round == MAX_ROUNDS_REVIEW`, set `review_stop_reason = max_rounds_reached` and exit the loop.
|
|
259
|
+
- Else continue to the next round.
|
|
260
|
+
|
|
261
|
+
#### Review Loop Finalization
|
|
262
|
+
|
|
263
|
+
After the review loop exits:
|
|
264
|
+
|
|
265
|
+
1. Append one Defect Summary row labeled `3 Loop - Summary` with total defects found across rounds, total fixed across rounds, remaining defects in the final round, `review_rounds_executed`, and `review_stop_reason`.
|
|
266
|
+
2. Add a short review loop summary in the manifest, including:
|
|
267
|
+
- `Configured max rounds: MAX_ROUNDS_REVIEW`
|
|
268
|
+
- `Rounds executed: review_rounds_executed`
|
|
269
|
+
- `Stop reason: review_stop_reason` — one of: `all_passed` (all scenarios PASS in code review), `no_confirmed_defects` (reported issues all false positives), `max_rounds_reached` (hit the round limit with real defects remaining)
|
|
270
|
+
- `Final round: review-round-{review_rounds_executed}`
|
|
271
|
+
3. Mirror the final review round outputs back to the root `OUTPUT` directory using the canonical filenames for backward compatibility:
|
|
272
|
+
- `OUTPUT/code-review-report.md`
|
|
273
|
+
- `OUTPUT/review-fix-report.md` (if 3a ran in the final round)
|
|
274
|
+
- `OUTPUT/build-fix-report.md` (overwrites Stage 2 report, if 3b ran in the final round)
|
|
275
|
+
- If the final round's build produced a signed `.hap`, copy it to `OUTPUT` (replaces Stage 2 `.hap` if present).
|
|
276
|
+
4. Mark Stage 3 / 3a / 3b `completed` only after the full loop finishes.
|
|
277
|
+
|
|
278
|
+
### Stage 3a — Review Fix
|
|
279
|
+
|
|
280
|
+
Stage 3a is executed as **Review Round Step B** inside the Stage 3 loop above. Do not run Stage 3a outside that loop.
|
|
281
|
+
|
|
282
|
+
### Stage 3b — Rebuild after Review Fix
|
|
283
|
+
|
|
284
|
+
Stage 3b is executed as **Review Round Step C** inside the Stage 3 loop above. Do not run Stage 3b outside that loop.
|
|
285
|
+
|
|
286
|
+
### Stage 4 — Self-Testing Loop (On-Device Verification)
|
|
287
|
+
|
|
288
|
+
**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**.
|
|
289
|
+
|
|
290
|
+
Treat Stage 4 → 4a → 4b as a loop that runs up to `MAX_ROUNDS_TEST` times.
|
|
291
|
+
|
|
292
|
+
#### Loop Setup
|
|
293
|
+
|
|
294
|
+
1. **Locate the initial HAP file**: Use the `.hap` mirrored to `OUTPUT/` by the Stage 3 review loop finalization (or from Stage 2 if the review loop did not produce one). The default location is `OUTPUT/entry-default-signed.hap`. If that file does not exist, search for `*-signed.hap` files in `OUTPUT/` and use the first match. If no `.hap` is found in `OUTPUT/`, fall back to searching `HMOS/entry/build/default/outputs/default/`.
|
|
295
|
+
2. Store the resolved path as `CURRENT_HAP`.
|
|
296
|
+
3. **`OUTPUT/test_case.md` existence guard**: If `OUTPUT/test_case.md` does not exist, mark Stage 4 / 4a / 4b as failed with note "No test case file available" and skip the loop entirely.
|
|
297
|
+
4. Initialize loop state:
|
|
298
|
+
- `round = 1`
|
|
299
|
+
- `rounds_executed = 0`
|
|
300
|
+
- `stop_reason = none`
|
|
301
|
+
5. Mark Stage 4 `in_progress` when Round 1 begins. Keep Stage 4 / 4a / 4b tasks open until the full loop exits.
|
|
302
|
+
|
|
303
|
+
#### Per-Round Stage 4 / 4a / 4b Execution Order
|
|
304
|
+
|
|
305
|
+
For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round}` and execute the following three steps in order:
|
|
306
|
+
|
|
307
|
+
##### Round Step A — Stage 4 Self-Testing
|
|
308
|
+
|
|
309
|
+
> ⚠️ **`CURRENT_HAP` must reflect the latest build**: If a previous round's Stage 4b produced a new signed HAP, `CURRENT_HAP` should already point to that HAP (e.g., `round-{N-1}/entry-default-signed.hap`). Do NOT reuse the original HAP from Stage 2/3b in subsequent rounds.
|
|
310
|
+
|
|
311
|
+
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".
|
|
312
|
+
2. If `CURRENT_HAP` exists, launch the **self-tester**.
|
|
313
|
+
3. Input (round 1):
|
|
314
|
+
- `hap-path`: `CURRENT_HAP`
|
|
315
|
+
- `output-path`: `OUTPUT` (the ROOT — the agent always writes here)
|
|
316
|
+
- `test-case-path`: `OUTPUT/test_case.md`
|
|
317
|
+
- `pre-test-case-path`: `OUTPUT/pre_test_case.md` (only include this line when the file exists)
|
|
318
|
+
- `setup`: `true`
|
|
319
|
+
4. Input (round 2+):
|
|
320
|
+
- `hap-path`: `CURRENT_HAP`
|
|
321
|
+
- `output-path`: `OUTPUT` (still the ROOT)
|
|
322
|
+
- `setup`: `false`
|
|
323
|
+
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`.
|
|
324
|
+
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.
|
|
325
|
+
7. Snapshot per-round artifacts to `ROUND_DIR` after the agent returns: copy `OUTPUT/self-test-report.md` → `ROUND_DIR/self-test-report.md`, `OUTPUT/task/` → `ROUND_DIR/task/`, and (round 1 only) `OUTPUT/_extracted.json` → `ROUND_DIR/_extracted.json`. Skip any source that is missing.
|
|
326
|
+
8. Read `ROUND_DIR/self-test-report.md` and extract total cases, passed, failed, and pass rate when the report exists.
|
|
327
|
+
9. Compute `round_all_passed` only when the report can be parsed clearly and:
|
|
328
|
+
- `总用例数` is known
|
|
329
|
+
- `失败 == 0`
|
|
330
|
+
- `通过 == 总用例数`
|
|
331
|
+
If the report is missing or fields are malformed, do **not** treat the round as passed.
|
|
332
|
+
10. Update the Stage 4 task description with a brief round summary (for example: `Round 1: 3/12 failed`).
|
|
333
|
+
|
|
334
|
+
##### Round Step B — Stage 4a Self-Test Fix
|
|
335
|
+
|
|
336
|
+
1. Mark Stage 4a `in_progress` when the first Stage 4a round begins.
|
|
337
|
+
2. If `ROUND_DIR/self-test-report.md` exists, launch the **self-test-fixer** agent.
|
|
338
|
+
3. Input:
|
|
339
|
+
- `self-test-report-path`: `ROUND_DIR/self-test-report.md`
|
|
340
|
+
- `harmonyos-project-path`: `HMOS`
|
|
341
|
+
- `android-project-path`: `ANDROID`
|
|
342
|
+
- `output-path`: `ROUND_DIR`
|
|
343
|
+
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`.
|
|
344
|
+
5. If `ROUND_DIR/self-test-report.md` is missing, do **not** launch the fixer. Record this round as `Skipped — missing self-test report`.
|
|
345
|
+
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.
|
|
346
|
+
7. Compute `round_no_confirmed_defects`:
|
|
347
|
+
- `true` if the fix report exists AND `白盒确认问题存在 == 0` (all failures are false positives, or the report says "No failures to fix — all scenarios passed").
|
|
348
|
+
- `false` otherwise (at least one confirmed defect exists, or the fix report is missing/malformed).
|
|
349
|
+
8. Update the Stage 4a task description with a brief round summary (for example: `Round 1: confirmed=3, fixed=2, failed=1`).
|
|
350
|
+
|
|
351
|
+
##### Round Step C — Stage 4b Rebuild after Self-Test Fix
|
|
352
|
+
|
|
353
|
+
1. Mark Stage 4b `in_progress` when the first Stage 4b round begins.
|
|
354
|
+
2. Launch the **build-fixer** agent with `--signed`.
|
|
355
|
+
3. Input: `harmonyos-project-path`: `HMOS`, `output-path`: `ROUND_DIR`.
|
|
356
|
+
4. The agent writes `ROUND_DIR/build-fix-report.md`.
|
|
357
|
+
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:
|
|
358
|
+
- `ROUND_DIR/entry-default-signed.hap`
|
|
359
|
+
- first `ROUND_DIR/*-signed.hap`
|
|
360
|
+
- otherwise keep the previous `CURRENT_HAP` and record that this round did not produce a fresh HAP
|
|
361
|
+
6. Append one Defect Summary row for this round by combining the parsed Stage 4 and Stage 4a results into a single row labeled `4 Loop - Round {round}`.
|
|
362
|
+
7. Update the Stage 4b task description with a brief round summary (for example: `Round 1: build success, hap=...`).
|
|
363
|
+
8. Increment `rounds_executed`.
|
|
364
|
+
9. **Loop stop decision** (after 4b completes):
|
|
365
|
+
- If `round_all_passed == true`, set `stop_reason = all_passed` and exit the loop.
|
|
366
|
+
- Else if `round_no_confirmed_defects == true`, set `stop_reason = no_confirmed_defects` and exit the loop. Rationale: all failures were judged as false positives (AutoTest limitations / environment issues) by white-box review, no code was changed, so repeating the test would yield identical results.
|
|
367
|
+
- Else if `round == MAX_ROUNDS_TEST`, set `stop_reason = max_rounds_reached` and exit the loop.
|
|
368
|
+
- Else continue to the next round.
|
|
369
|
+
|
|
370
|
+
#### Loop Finalization
|
|
371
|
+
|
|
372
|
+
After the loop exits:
|
|
373
|
+
|
|
374
|
+
1. Append one Defect Summary row labeled `4 Loop - Summary` with total defects found across rounds, total fixed across rounds, remaining defects in the final round, `rounds_executed`, and `stop_reason`.
|
|
375
|
+
2. Add a short Stage 4 loop summary in the manifest, including:
|
|
376
|
+
- `Configured max rounds: MAX_ROUNDS_TEST`
|
|
377
|
+
- `Rounds executed: rounds_executed`
|
|
378
|
+
- `Stop reason: stop_reason` — one of: `all_passed` (all tests green), `no_confirmed_defects` (failures exist but all judged as false positives by white-box review), `max_rounds_reached` (hit the round limit with real defects remaining)
|
|
379
|
+
- `Final round: round-{rounds_executed}`
|
|
380
|
+
3. Mirror the final round's `OUTPUT/round-{rounds_executed}/` Fix/Build artifacts back to `OUTPUT/` root using the canonical filenames (the test report and `task/` are already at `OUTPUT/` root as the latest copies — they do NOT need mirroring):
|
|
381
|
+
- `OUTPUT/self-test-fix-report.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-report.md` (if present)
|
|
382
|
+
- `OUTPUT/build-fix-report.md` ← `OUTPUT/round-{rounds_executed}/build-fix-report.md` (if present)
|
|
383
|
+
- `OUTPUT/self-test-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-commit-info.md` (if present)
|
|
384
|
+
- `OUTPUT/build-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/build-fix-commit-info.md` (if present)
|
|
385
|
+
- `OUTPUT/entry-default-signed.hap` ← `CURRENT_HAP` (the final HAP, which lives under `OUTPUT/round-{rounds_executed}/`); skip when `CURRENT_HAP` is already `OUTPUT/entry-default-signed.hap`
|
|
386
|
+
- `OUTPUT/screenshots/` when the final report still references `screenshots/...`
|
|
387
|
+
4. When mirroring Fix/Build files back to `OUTPUT`, treat the final round directory as the source of truth and ensure the mirrored root-level reports still reference files that actually exist at the root level.
|
|
388
|
+
5. Mark Stage 4 / 4a / 4b `completed` only after the full loop finishes.
|
|
389
|
+
|
|
390
|
+
### Stage 4a — Self-Test Fix
|
|
391
|
+
|
|
392
|
+
Stage 4a is executed as **Round Step B** inside the Stage 4 loop above. Do not run Stage 4a outside that loop.
|
|
393
|
+
|
|
394
|
+
### Stage 4b — Rebuild after Self-Test Fix
|
|
395
|
+
|
|
396
|
+
Stage 4b is executed as **Round Step C** inside the Stage 4 loop above. Do not run Stage 4b outside that loop.
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## Error Handling
|
|
401
|
+
|
|
402
|
+
- If a stage **fails**, log the error in the manifest and task, then **continue to the next stage** unless the loop logic says to continue to the next round.
|
|
403
|
+
- Stage 3 uses a bounded Stage 3 → 3a → 3b review loop (up to `MAX_ROUNDS_REVIEW` rounds). Stage 3a addresses issues found by Stage 3, followed by Stage 3b (Rebuild) to ensure compilation. The loop exits when all scenarios pass, all issues are false positives, or `MAX_ROUNDS_REVIEW` is reached.
|
|
404
|
+
- If Stage 3a determines that all reported issues are false positives (`confirmed == 0`), the review loop exits after 3b with `review_stop_reason = no_confirmed_defects`.
|
|
405
|
+
- Stage 4 uses a bounded Stage 4 → 4a → 4b test loop (up to `MAX_ROUNDS_TEST` rounds). Stage 4a addresses failures found by Stage 4, followed by Stage 4b (Rebuild) to ensure compilation, then the pipeline either continues to the next round or exits the loop based on `all_passed` / `no_confirmed_defects` / `max_rounds_reached`.
|
|
406
|
+
- If Stage 4a determines that all failures are false positives (`confirmed == 0`), the test loop exits after 4b with `stop_reason = no_confirmed_defects` — because no code was changed and repeating the test would yield identical results.
|
|
407
|
+
- If a Stage 4 round fails before producing `round-N/self-test-report.md`, do not call Stage 4a with a missing report; record the round accordingly and continue to Stage 4b.
|
|
408
|
+
- If a Stage 4 report is malformed or required fields are missing, do not treat the round as passed; continue until `MAX_ROUNDS_TEST` is reached or a later round clearly passes.
|
|
409
|
+
- If a Stage 4 round passes but the same round's Stage 4b rebuild fails, stop the loop after that round if `round_all_passed == true`, but record clearly that the final rebuild failed and whether the previous `CURRENT_HAP` had to be retained.
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## Final Summary
|
|
414
|
+
|
|
415
|
+
After the Stage 4 loop completes (or is skipped), print a concise summary:
|
|
416
|
+
|
|
417
|
+
1. Overall pipeline status (all green, or which stages had issues)
|
|
418
|
+
2. Location of `OUTPUT/pipeline-manifest.md` for full details
|
|
419
|
+
3. Stage 3 review loop summary: `MAX_ROUNDS_REVIEW`, `review_rounds_executed`, `review_stop_reason`, final review round directory
|
|
420
|
+
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.
|
|
421
|
+
5. Key statistics: total files generated, self-test results (or "N/A — testing skipped" if `SKIP_TEST == true`)
|
|
422
|
+
6. Defect summary: total defects found (code review + testing), total fixed, total remaining unfixed
|
|
423
|
+
7. Recommended next steps (if testing was skipped, recommend running on-device tests when a real device becomes available)
|