@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
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-dev-review-fix
|
|
3
|
+
description: "Flexibly orchestrate HarmonyOS code development, build, scenario review, and fix agents from a natural-language request. Reads what the user actually wants — plan a change, implement from a spec/plan, compile-fix, scenario-review code, or review-and-fix — then composes only the needed agents (logic-context-builder → logic-coding → build-fixer → code-reviewer / code-review-fix) in the right order, instead of running a fixed pipeline. Use this whenever the user describes a HarmonyOS coding task in natural language and wants it taken through development and/or functional (scenario) verification. Triggers on phrases like '开发并检视', '代码开发检视修复', '实现这个需求并验证', '按plan开发', '检视一下这段代码', '检视并修复', '编译修复', 'develop and review', 'review and fix this commit', 'implement and verify', 'code dev review fix'. Prefer this skill over running individual agents by hand when the request mixes development with review/verification."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Agent
|
|
12
|
+
- AskUserQuestion
|
|
13
|
+
- TaskCreate
|
|
14
|
+
- TaskUpdate
|
|
15
|
+
- TaskList
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Code Dev · Review · Fix (Flexible Orchestrator)
|
|
19
|
+
|
|
20
|
+
You are an **orchestrator**. From a natural-language request you decide **which** of five HarmonyOS agents to run and in **what order**, then drive them — passing each one's outputs into the next. This is *not* a fixed pipeline: a request like "just compile-fix this project" runs one agent; "implement this spec and verify it" runs four. You choose.
|
|
21
|
+
|
|
22
|
+
You do **not** write ArkTS, run builds, or judge scenarios yourself — every unit of real work is delegated to an agent. Your job is intent → plan → confirm → drive → report.
|
|
23
|
+
|
|
24
|
+
**Raw request**: $ARGUMENTS
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## The Five Agents (capability cards)
|
|
29
|
+
|
|
30
|
+
Each card lists what the agent does, its `subagent_type`, the `key: value` inputs it accepts, and what it produces. Inputs are passed **only** as `key: value` lines joined by `\n` — no prose, no extra instructions (the agent has its own workflow).
|
|
31
|
+
|
|
32
|
+
### A. `logic-context-builder` — PLAN
|
|
33
|
+
Turns a requirement **spec** into one short `plan.md` *decision contract* (target surface, truth owner, access path, forbidden paths, completion evidence). Plans, does not code.
|
|
34
|
+
- `subagent_type`: `logic-context-builder`
|
|
35
|
+
- Inputs: `harmonyos-project-path`, `spec-file`, `output-path`
|
|
36
|
+
- Produces: `<output-path>/plan.md`
|
|
37
|
+
- Pick when: the user has a requirement/spec and wants it scoped before coding, or asks for a design/plan.
|
|
38
|
+
|
|
39
|
+
### B. `logic-coding` — CODE
|
|
40
|
+
Executes an existing `plan.md` contract: verifies local facts, patches the approved path, validates, commits.
|
|
41
|
+
- `subagent_type`: `logic-coding`
|
|
42
|
+
- Inputs: `harmonyos-project-path`, `plan-file`, `output-path`
|
|
43
|
+
- Produces: code changes + `<output-path>/commit-info.md` (contains `commit-id: <hash>`); may write `issues.md` for blockers.
|
|
44
|
+
- Pick when: a `plan.md` exists (provided, or just produced by PLAN) and the user wants it implemented.
|
|
45
|
+
|
|
46
|
+
### C. `build-fixer` — BUILD
|
|
47
|
+
Runs the HarmonyOS build, parses compile errors, fixes them in source, rebuilds — looped until success or 20 iterations.
|
|
48
|
+
- `subagent_type`: `build-fixer`
|
|
49
|
+
- Inputs: `harmonyos-project-path`, `output-path`, optional `--signed`
|
|
50
|
+
- Produces: fixed sources + `<output-path>/build-fix-report.md`, `<output-path>/build-fix-commit-info.md`, and (on success) a `.hap` copied to `output-path`.
|
|
51
|
+
- Pick when: code must compile — after CODE, or standalone ("fix the build / make it compile").
|
|
52
|
+
|
|
53
|
+
### D. `code-reviewer` — REVIEW (report only)
|
|
54
|
+
Reviews the code against a user-scenario document and assigns per-scenario verdicts (PASS / PARTIAL / FAIL / UNABLE TO VERIFY). **Does not change code.**
|
|
55
|
+
- `subagent_type`: `code-reviewer`
|
|
56
|
+
- Inputs: `harmonyos-project-path`, `commit-id`, `output-path`, `test-case-path`
|
|
57
|
+
- Produces: `<output-path>/code-review-report.md`
|
|
58
|
+
- Pick when: the user wants an assessment/report, not edits ("检视一下 / 给个检视报告 / is this commit complete?").
|
|
59
|
+
|
|
60
|
+
### E. `code-review-fix` — REVIEW + FIX + REBUILD (one pass)
|
|
61
|
+
One-pass cycle: review against scenarios → independently **verify** each finding (rejects false positives) → fix confirmed issues → rebuild. Self-contained verification + build.
|
|
62
|
+
- `subagent_type`: `code-review-fix`
|
|
63
|
+
- Inputs: `harmonyos-project-path`, optional `commit-id` (omit/`none` → holistic), `output-path`, optional `test-case-path` (defaults to `<output-path>/test_case.md`), optional `android-project-path` (enables reference-based fixing), optional `--signed`
|
|
64
|
+
- Produces: `code-review-report.md`, `review-fix-report.md`, `build-fix-report.md`, `review-fix-commit-info.md`, and a `.hap` when it builds.
|
|
65
|
+
- Pick when: the user wants problems **found and fixed** in one go. Because it already builds internally, do **not** chain a separate `build-fixer` after it.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Step 1 — Parse Intent and Inputs
|
|
70
|
+
|
|
71
|
+
Read `$ARGUMENTS` (and the surrounding conversation). Extract two things: the **intent primitives** present, and the **paths/flags** available.
|
|
72
|
+
|
|
73
|
+
### 1a. Intent primitives
|
|
74
|
+
|
|
75
|
+
Detect which of these the request implies (it may imply several):
|
|
76
|
+
|
|
77
|
+
| Primitive | Means | Signal words (zh / en) |
|
|
78
|
+
|-----------|-------|------------------------|
|
|
79
|
+
| `PLAN` | scope a change into a plan first | 规划, 设计方案, 出方案, 先想清楚, plan, design the change |
|
|
80
|
+
| `CODE` | implement / write the code | 开发, 实现, 编码, 写代码, 按plan开发, implement, build the feature |
|
|
81
|
+
| `BUILD` | compile and fix compile errors | 编译, 构建, 修复编译, 出包, make it compile, fix the build |
|
|
82
|
+
| `REVIEW` | assess against scenarios, report only | 检视, 审查, 评审, 出报告, review, assess, is it complete |
|
|
83
|
+
| `REVIEW_FIX` | review **and** fix the confirmed gaps | 检视并修复, 检视修复, 审查修复, 修复问题, review and fix, find and fix gaps |
|
|
84
|
+
|
|
85
|
+
If the request is broad ("代码开发以及功能验证全流程" / "develop and verify end-to-end"), treat it as `PLAN + CODE + BUILD + REVIEW_FIX`.
|
|
86
|
+
|
|
87
|
+
### 1b. Paths and flags
|
|
88
|
+
|
|
89
|
+
Pull these from the request; do **not** invent any. Missing-but-required ones are asked for in Step 3.
|
|
90
|
+
|
|
91
|
+
| Variable | Meaning |
|
|
92
|
+
|----------|---------|
|
|
93
|
+
| `HMOS` | `harmonyos-project-path` — the HarmonyOS project root (contains `build-profile.json5`). Required for every primitive. |
|
|
94
|
+
| `OUTPUT` | output/report directory. If unstated, default to `<HMOS>/.code-dev-review-fix` and tell the user. |
|
|
95
|
+
| `SPEC` | requirement spec file — required for `PLAN`. |
|
|
96
|
+
| `PLAN_FILE` | existing `plan.md` — for `CODE` when `PLAN` is not run. |
|
|
97
|
+
| `TC` | scenario / test-case document — for `REVIEW` / `REVIEW_FIX` when no `plan.md` is produced. |
|
|
98
|
+
| `ANDROID` | Android source project — optional; improves `REVIEW_FIX` fixes. |
|
|
99
|
+
| `COMMIT_ID` | commit to scope review — optional. |
|
|
100
|
+
| `SIGNED` | build a signed HAP? `true`/`false`, default `false`. Signed builds need a signing config already in `build-profile.json5`. |
|
|
101
|
+
| `MAX_REVIEW_ROUNDS` | optional cap for an iterated review→fix loop (default `1`; raise only if the user wants "iterate until it passes"). |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Step 2 — Build the Orchestration Plan
|
|
106
|
+
|
|
107
|
+
Turn the primitives into an **ordered agent list**, resolving dependencies. This is the core of the skill — reason from the request, don't apply a fixed sequence.
|
|
108
|
+
|
|
109
|
+
### 2a. Dependency resolution rules
|
|
110
|
+
|
|
111
|
+
- **`CODE` needs a plan.** If `CODE` is requested but no `PLAN_FILE` is available and `PLAN` is not already in the plan: if a `SPEC` exists, prepend `PLAN`; if neither plan nor spec exists, this is a blocker → ask in Step 3.
|
|
112
|
+
- **`CODE` should be followed by `BUILD`** so the change compiles, unless the user explicitly says "don't build" or a `REVIEW_FIX` follows immediately (E builds internally — see next rule).
|
|
113
|
+
- **`REVIEW_FIX` already builds.** Never place a standalone `build-fixer` right after `code-review-fix`. If both `BUILD` and `REVIEW_FIX` are implied and `REVIEW_FIX` is last, drop the standalone `BUILD`.
|
|
114
|
+
- **`REVIEW` vs `REVIEW_FIX`** (per the intent answer — choose by intent): report-only wording → `code-reviewer` (D). "find and fix" wording → `code-review-fix` (E). If ambiguous and the user asked to "verify"/"功能验证" as part of development, prefer **E** (it closes gaps, not just reports them).
|
|
115
|
+
- **Scenario document for D/E.** Resolve `TC` in this order: explicit `TC` from the user → the `plan.md` produced by `PLAN` (`<OUTPUT>/logic/plan.md`, the convention used elsewhere in this repo) → `SPEC` → omit (E falls back to holistic; D requires a doc, so if none exists, ask).
|
|
116
|
+
- **Commit scoping.** If `CODE` ran, use the `commit-id` from its `commit-info.md` for the first review. If reviewing pre-existing code, use a user-supplied `COMMIT_ID`, else holistic (omit/`none`). After any fix round, re-review **holistically** (fixes move the code beyond the original commit).
|
|
117
|
+
|
|
118
|
+
### 2b. Canonical recipes (starting points, adapt freely)
|
|
119
|
+
|
|
120
|
+
| Request shape | Agent chain |
|
|
121
|
+
|---------------|-------------|
|
|
122
|
+
| "Compile-fix / make it build" | C |
|
|
123
|
+
| "Implement this plan.md" | B → C |
|
|
124
|
+
| "Develop this spec" | A → B → C |
|
|
125
|
+
| "Review this commit / give me a report" | D |
|
|
126
|
+
| "Review and fix this commit" | E |
|
|
127
|
+
| "Develop this spec and verify it" (功能验证全流程) | A → B → C → E |
|
|
128
|
+
| "Develop from plan, then review (report only)" | B → C → D |
|
|
129
|
+
| "Iterate review-fix until it passes" | E, looped up to `MAX_REVIEW_ROUNDS` |
|
|
130
|
+
|
|
131
|
+
### 2c. Write the plan object
|
|
132
|
+
|
|
133
|
+
Produce an ordered list. For each step record: agent letter + name, why it's there, its resolved inputs, and its key output that feeds the next step. Keep a short rationale for *omissions* too (e.g. "no standalone build — E rebuilds internally").
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Step 3 — Confirm Inputs, Then the Plan
|
|
138
|
+
|
|
139
|
+
**Inputs first.** If any *required* input for the chosen chain is missing (`HMOS` always; `SPEC` for A; a plan-or-spec for B; a scenario doc for D), ask with `AskUserQuestion` — one question per missing item, no free-form guessing:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
question: "缺少必填参数 <param>(<chain step that needs it>)。请提供绝对路径。"
|
|
143
|
+
header: "<param>"
|
|
144
|
+
options:
|
|
145
|
+
- { label: "我来补路径", description: "在下一条消息里给出绝对路径" }
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Then confirm the plan.** Present the ordered chain compactly and ask for sign-off before executing (per the propose-then-confirm decision). Show it like:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
## 编排计划
|
|
152
|
+
项目: <HMOS> 输出: <OUTPUT> 签名: <SIGNED>
|
|
153
|
+
1. A logic-context-builder — 把 <SPEC> 收敛为 plan.md
|
|
154
|
+
2. B logic-coding — 按 plan.md 实现并提交
|
|
155
|
+
3. C build-fixer — 编译并修复编译错误
|
|
156
|
+
4. E code-review-fix — 场景检视→核实→修复→重建(功能验证)
|
|
157
|
+
省略: 不单独跑 build(E 内部已重建)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Use `AskUserQuestion` (确认执行 / 调整计划 / 取消) or accept a plain "go". If the user adjusts, revise and re-show. **Do not run any agent before confirmation** — unless the user already said "直接执行 / just run it", in which case skip the confirm and proceed.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Step 4 — Execute the Plan
|
|
165
|
+
|
|
166
|
+
Create one task per planned step via `TaskCreate` so the user sees the whole chain. Mark each `in_progress` before launching its agent and `completed` after — if a step fails, still mark it `completed` with the failure noted so later steps can react. Maintain a short manifest at **`<OUTPUT>/orchestration-manifest.md`**: the chosen chain, per-step start/end timestamps and status, output files, and review/fix defect counts.
|
|
167
|
+
|
|
168
|
+
Run steps **strictly sequentially** (each depends on the previous). For every agent, assemble the prompt as `key: value` lines joined with `\n`, **omitting any line whose value is unset**.
|
|
169
|
+
|
|
170
|
+
### Step A — logic-context-builder
|
|
171
|
+
```
|
|
172
|
+
Agent(
|
|
173
|
+
subagent_type="logic-context-builder",
|
|
174
|
+
description="Plan: build decision contract",
|
|
175
|
+
prompt="harmonyos-project-path: <HMOS>\nspec-file: <SPEC>\noutput-path: <OUTPUT>/logic"
|
|
176
|
+
)
|
|
177
|
+
```
|
|
178
|
+
Verify `<OUTPUT>/logic/plan.md` exists. Set `PLAN_FILE = <OUTPUT>/logic/plan.md`. If absent, treat as a blocker for any following `CODE` step.
|
|
179
|
+
|
|
180
|
+
### Step B — logic-coding
|
|
181
|
+
```
|
|
182
|
+
Agent(
|
|
183
|
+
subagent_type="logic-coding",
|
|
184
|
+
description="Code: implement plan.md",
|
|
185
|
+
prompt="harmonyos-project-path: <HMOS>\nplan-file: <PLAN_FILE>\noutput-path: <OUTPUT>/logic"
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
Read `<OUTPUT>/logic/commit-info.md`; copy it to `<OUTPUT>/commit-info.md` and extract `commit-id` → `CODE_COMMIT_ID`. If `logic-coding` wrote `<OUTPUT>/logic/issues.md`, surface its blockers in the manifest (the change may be a safe partial).
|
|
189
|
+
|
|
190
|
+
### Step C — build-fixer
|
|
191
|
+
```
|
|
192
|
+
Agent(
|
|
193
|
+
subagent_type="build-fixer",
|
|
194
|
+
description="Build: compile and fix errors",
|
|
195
|
+
prompt="harmonyos-project-path: <HMOS>\noutput-path: <OUTPUT>" # append "\n--signed" when SIGNED
|
|
196
|
+
)
|
|
197
|
+
```
|
|
198
|
+
Read `<OUTPUT>/build-fix-report.md` for SUCCESS/FAILED and note the `.hap` location. If the build FAILED, record it and stop the chain unless a later `REVIEW_FIX` step is expected to repair sources (rare) — otherwise report and halt.
|
|
199
|
+
|
|
200
|
+
### Step D — code-reviewer (report only)
|
|
201
|
+
```
|
|
202
|
+
Agent(
|
|
203
|
+
subagent_type="code-reviewer",
|
|
204
|
+
description="Review: scenario verdicts",
|
|
205
|
+
prompt="harmonyos-project-path: <HMOS>\ncommit-id: <REVIEW_COMMIT_ID>\noutput-path: <OUTPUT>\ntest-case-path: <TC>"
|
|
206
|
+
)
|
|
207
|
+
```
|
|
208
|
+
`REVIEW_COMMIT_ID` = `CODE_COMMIT_ID` if B ran, else `COMMIT_ID` if supplied, else omit the line (holistic). Read the first ~80 lines of `<OUTPUT>/code-review-report.md`, extract the PASS/PARTIAL/FAIL/UNABLE counts and overall verdict into the manifest. D never edits code — the chain ends here unless the user also asked to fix (then a `REVIEW_FIX` step should already be in the plan).
|
|
209
|
+
|
|
210
|
+
### Step E — code-review-fix (review + verify + fix + rebuild)
|
|
211
|
+
```
|
|
212
|
+
Agent(
|
|
213
|
+
subagent_type="code-review-fix",
|
|
214
|
+
description="Review+Fix (Round <r>): verify, fix, rebuild",
|
|
215
|
+
prompt="harmonyos-project-path: <HMOS>\ncommit-id: <REVIEW_COMMIT_ID>\noutput-path: <ROUND_DIR>\ntest-case-path: <TC>\nandroid-project-path: <ANDROID>" # append "\n--signed" when SIGNED; omit android-project-path / commit-id / test-case-path lines when unset
|
|
216
|
+
)
|
|
217
|
+
```
|
|
218
|
+
- For the **first** round, `REVIEW_COMMIT_ID` follows the same rule as D. For **round 2+**, omit `commit-id` (review holistically — fixes have moved past the original commit).
|
|
219
|
+
- `ROUND_DIR = <OUTPUT>/review-round-<r>` (use `<OUTPUT>` directly when `MAX_REVIEW_ROUNDS == 1`).
|
|
220
|
+
- After the agent returns, read the first lines of `<ROUND_DIR>/code-review-report.md` (overall verdict, FAIL/PARTIAL counts) and `<ROUND_DIR>/review-fix-report.md` (confirmed / false positives / fixed / failed-to-fix). Record one manifest row per round.
|
|
221
|
+
|
|
222
|
+
#### Optional review-fix loop (only when `MAX_REVIEW_ROUNDS > 1`)
|
|
223
|
+
Repeat Step E up to `MAX_REVIEW_ROUNDS`, exiting early when any of:
|
|
224
|
+
- **all_passed** — the round's review has zero FAIL and zero PARTIAL.
|
|
225
|
+
- **no_confirmed_defects** — the round's fix report confirms 0 real issues (all false positives) → fixing more is pointless; code is unchanged.
|
|
226
|
+
- **max_rounds_reached** — hit the cap with real defects remaining.
|
|
227
|
+
|
|
228
|
+
Mirror the final round's `code-review-report.md`, `review-fix-report.md`, `build-fix-report.md`, and `.hap` back to `<OUTPUT>/` with their canonical names.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Step 5 — Surface Results
|
|
233
|
+
|
|
234
|
+
Give a tight summary — never dump full reports (they can be large; read only the first ~80 lines for review and ~60 for fix). Include:
|
|
235
|
+
|
|
236
|
+
1. **The chain that ran**, with per-step status (✅ / ⚠️ failed) and durations.
|
|
237
|
+
2. **Development outcome** (if A/B/C ran): plan written? commit-id? build SUCCESS/FAILED + `.hap` path.
|
|
238
|
+
3. **Verification outcome** (if D/E ran): scenario verdict counts (PASS/PARTIAL/FAIL/UNABLE), and for E: confirmed defects / fixed / false positives, plus the review-fix loop stop reason when looped.
|
|
239
|
+
4. **Pointers** to the full artifacts under `<OUTPUT>/` and `<OUTPUT>/orchestration-manifest.md`.
|
|
240
|
+
5. **Open blockers**: anything from `issues.md`, a failed build, or `UNCERTAIN`/`failed-to-fix` items, with a concrete next step.
|
|
241
|
+
|
|
242
|
+
If a report file is missing or malformed, say so and point at the agent's output directory — **never fabricate results**.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Error Handling
|
|
247
|
+
|
|
248
|
+
| Situation | Action |
|
|
249
|
+
|-----------|--------|
|
|
250
|
+
| `HMOS` missing or has no `build-profile.json5` | Ask for the correct project root; do not proceed. |
|
|
251
|
+
| `CODE` requested but no plan and no spec | Block: ask for a `plan.md` or a spec, or offer to drop the code step. |
|
|
252
|
+
| `PLAN` produced no `plan.md` | Stop before `CODE`; surface the planner's `issues.md`/`Unknown` blockers. |
|
|
253
|
+
| `logic-coding` wrote `issues.md` | Continue if a safe partial committed; surface the blocker. If no commit-id, treat as failed CODE and halt before review. |
|
|
254
|
+
| Build FAILED | Record remaining errors from `build-fix-report.md`; halt the chain (don't review uncompilable code) unless the user opted into review-on-failure. |
|
|
255
|
+
| `code-reviewer` needs a scenario doc but none resolved | Ask for `test-case-path`, or switch to `code-review-fix` (which can run holistically). |
|
|
256
|
+
| Agent errors / times out | Mark the step failed in the manifest and task, report to the user, and stop dependent steps. |
|
|
257
|
+
| Signed build but no signing config | Relay the agent's guidance (DevEco → Project Structure → Signing Configs → auto-generate), then halt the signed build. |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Key Constraints
|
|
262
|
+
|
|
263
|
+
- **Delegate everything.** Never write ArkTS, run `hvigor`/builds, or score scenarios yourself — drive the agents. Your own edits are limited to manifest/report bookkeeping under `<OUTPUT>`.
|
|
264
|
+
- **Parameter purity.** Agent prompts contain only `key: value` lines (and bare `--signed`). No prose, schema hints, or step lists — each agent has its own workflow.
|
|
265
|
+
- **Flexible, not fixed.** Run the *minimum* chain the request needs. A one-word "compile-fix" must not drag in review.
|
|
266
|
+
- **No redundant build after E.** `code-review-fix` rebuilds internally; never append a standalone `build-fixer` to it.
|
|
267
|
+
- **Confirm before executing** (unless the user said "直接执行"). Show the chain and let the user adjust.
|
|
268
|
+
- **Sequential only.** Steps depend on each other — never launch two agents at once.
|
|
269
|
+
- **Don't read full reports.** First ~80 lines for review reports, ~60 for fix reports; point the user to the full files.
|
|
270
|
+
- **Quote all paths** (they may contain spaces) and keep `<OUTPUT>` consistent across steps so outputs chain correctly.
|
|
271
|
+
|
|
272
|
+
## Forbidden
|
|
273
|
+
|
|
274
|
+
- ❌ Running an agent before the plan is confirmed (when confirmation is required).
|
|
275
|
+
- ❌ Adding `build-fixer` immediately after `code-review-fix`.
|
|
276
|
+
- ❌ Pulling in `REVIEW`/`REVIEW_FIX` when the user only asked to develop or compile.
|
|
277
|
+
- ❌ Inventing paths, commit-ids, or scenario docs the user did not provide and that no upstream step produced.
|
|
278
|
+
- ❌ Fabricating review/build results when a report is missing or unreadable.
|
|
279
|
+
- ❌ Coding without a `plan.md` (provided or produced by `PLAN`).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"skill_name": "code-dev-review-fix",
|
|
3
|
+
"eval_type": "routing",
|
|
4
|
+
"note": "Each eval checks that the skill's intent->agent-chain routing is correct. Subagents output only the proposed chain (no heavy execution).",
|
|
5
|
+
"evals": [
|
|
6
|
+
{
|
|
7
|
+
"id": 0,
|
|
8
|
+
"name": "build-only",
|
|
9
|
+
"prompt": "把 D:\\proj\\HMOS 这个鸿蒙项目编译过,修一下编译错误",
|
|
10
|
+
"expected_chain": ["build-fixer"],
|
|
11
|
+
"expected_omitted": ["review (user only asked to compile)"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": 1,
|
|
15
|
+
"name": "code-then-build",
|
|
16
|
+
"prompt": "按 D:\\out\\logic\\plan.md 把功能实现了,项目在 D:\\proj\\HMOS",
|
|
17
|
+
"expected_chain": ["logic-coding", "build-fixer"],
|
|
18
|
+
"expected_omitted": ["plan (plan.md already provided)", "review (not requested)"]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": 2,
|
|
22
|
+
"name": "full-dev-and-verify",
|
|
23
|
+
"prompt": "根据 D:\\specs\\login.md 开发登录功能并做功能验证全流程,鸿蒙项目 D:\\proj\\HMOS,安卓源码 D:\\proj\\ANDROID",
|
|
24
|
+
"expected_chain": ["logic-context-builder", "logic-coding", "build-fixer", "code-review-fix"],
|
|
25
|
+
"expected_omitted": ["standalone build after code-review-fix (E rebuilds internally)"]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": 3,
|
|
29
|
+
"name": "review-report-only",
|
|
30
|
+
"prompt": "检视一下 commit a1b2c3 的代码完整性,项目 D:\\proj\\HMOS,场景文档 D:\\out\\test_case.md,只要报告不要改代码",
|
|
31
|
+
"expected_chain": ["code-reviewer"],
|
|
32
|
+
"expected_omitted": ["fix/build (report only)"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": 4,
|
|
36
|
+
"name": "review-and-fix-only",
|
|
37
|
+
"prompt": "检视并修复 D:\\proj\\HMOS 里这次提交的问题,参考安卓 D:\\proj\\ANDROID",
|
|
38
|
+
"expected_chain": ["code-review-fix"],
|
|
39
|
+
"expected_omitted": ["standalone build (E rebuilds internally)"]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": 5,
|
|
43
|
+
"name": "plan-only",
|
|
44
|
+
"prompt": "我有需求文档 D:\\specs\\profile.md,先帮我出个开发方案就行,项目 D:\\proj\\HMOS",
|
|
45
|
+
"expected_chain": ["logic-context-builder"],
|
|
46
|
+
"expected_omitted": ["code/build/review (only a plan was asked for)"]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": 6,
|
|
50
|
+
"name": "code-without-plan-blocker",
|
|
51
|
+
"prompt": "把 D:\\proj\\HMOS 的业务代码实现了",
|
|
52
|
+
"expected_chain": [],
|
|
53
|
+
"expected_blocker": "CODE requested but no plan.md and no spec available -> must ask user for a plan or spec before proceeding"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Routing Eval — code-dev-review-fix (iteration 1)
|
|
2
|
+
|
|
3
|
+
Each case checks intent → proposed agent chain. Agents are NOT executed; subagents output only the chain they would propose.
|
|
4
|
+
|
|
5
|
+
| # | Case | Prompt (abridged) | Expected chain | Actual chain | Verdict |
|
|
6
|
+
|---|------|-------------------|----------------|--------------|---------|
|
|
7
|
+
| 0 | build-only | 把项目编译过,修编译错误 | build-fixer | build-fixer | ✅ |
|
|
8
|
+
| 1 | code-then-build | 按 plan.md 把功能实现了 | logic-coding → build-fixer | logic-coding → build-fixer | ✅ |
|
|
9
|
+
| 2 | full-dev-and-verify | 根据 spec 开发并做功能验证全流程 | logic-context-builder → logic-coding → build-fixer → code-review-fix | (same) | ✅ |
|
|
10
|
+
| 3 | review-report-only | 检视…只要报告不要改代码 | code-reviewer | code-reviewer | ✅ |
|
|
11
|
+
| 4 | review-and-fix-only | 检视并修复这次提交的问题 | code-review-fix | code-review-fix | ✅ |
|
|
12
|
+
| 5 | plan-only | 先帮我出个开发方案就行 | logic-context-builder | logic-context-builder | ✅ |
|
|
13
|
+
| 6 | code-without-plan (blocker) | 把业务代码实现了 | [] + block/ask for plan-or-spec | [] + blocker (asks for SPEC/PLAN_FILE) | ✅ |
|
|
14
|
+
|
|
15
|
+
**Score: 7/7 (100%)**
|
|
16
|
+
|
|
17
|
+
## Key discriminators verified
|
|
18
|
+
- **D vs E by intent**: "只要报告不要改代码" → `code-reviewer` (D); "检视并修复" → `code-review-fix` (E). ✅
|
|
19
|
+
- **No redundant build after E**: case 2 & 4 both omit a standalone `build-fixer` after `code-review-fix` (E rebuilds internally). ✅
|
|
20
|
+
- **Review not pulled into pure dev/compile**: cases 0, 1, 5 correctly omit review. ✅
|
|
21
|
+
- **CODE-needs-plan dependency**: case 6 blocks and asks for a plan-or-spec instead of guessing. ✅
|
|
22
|
+
- **TC fallback**: case 2 resolves the scenario doc from the produced plan.md; case 4 lets E run holistically. ✅
|
|
23
|
+
- **Input resolution**: HMOS, SPEC, ANDROID, COMMIT_ID, TC parsed from natural language; OUTPUT defaulted to `<HMOS>/.code-dev-review-fix` and surfaced. ✅
|