@buaa_smat/hometrans 0.1.7 → 0.1.9

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.
Files changed (28) hide show
  1. package/README.md +15 -2
  2. package/dist/cli/config-store.js +148 -0
  3. package/dist/cli/config.js +40 -0
  4. package/dist/cli/index.js +43 -0
  5. package/dist/cli/init.js +378 -0
  6. package/dist/cli/mcp-setup.js +262 -0
  7. package/dist/cli/mcp.js +94 -0
  8. package/dist/cli/uninstall.js +310 -0
  9. package/dist/context/index.js +792 -0
  10. package/package.json +7 -2
  11. package/resource/choose_editor.png +0 -0
  12. package/resource/finish_init.png +0 -0
  13. package/skills/hmos-convert-pipeline/SKILL.md +5 -21
  14. package/skills/hmos-integration-test/SKILL.md +4 -4
  15. package/tools/test-tools/autotest/README.md +4 -4
  16. package/tools/test-tools/autotest/pyproject.toml +16 -6
  17. package/tools/test-tools/autotest/self_test_runner.py +4 -4
  18. package/tools/test-tools/autotest/uv.lock +3156 -3156
  19. package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +0 -911
  20. package/skills/skill-quality-evaluator/SKILL.md +0 -138
  21. package/skills/skill-quality-evaluator/assets/SKILL_TEMPLATE.md +0 -77
  22. package/skills/skill-quality-evaluator/references/Best-practices-for-skill-creators.md +0 -277
  23. package/skills/skill-quality-evaluator/references/Evaluating-skill-output-quality.md +0 -300
  24. package/skills/skill-quality-evaluator/references/Optimizing-skill-descriptions.md +0 -196
  25. package/skills/skill-quality-evaluator/references/Specification.md +0 -272
  26. package/skills/skill-quality-evaluator/references/Using-scripts-in-skills.md +0 -308
  27. package/skills/skill-quality-evaluator/references/report-template.md +0 -163
  28. package/skills/skill-quality-evaluator/references/scoring-rubric.md +0 -269
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@buaa_smat/hometrans",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "HomeTrans (Android-to-HarmonyOS) skill + agent installer. Run `ht init` to distribute conversion skills and subagents into AI editors.",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://gitcode.com/SMAT/HomeTrans"
9
+ },
6
10
  "type": "module",
7
11
  "bin": {
8
12
  "hometrans": "dist/cli/index.js",
@@ -12,7 +16,8 @@
12
16
  "dist",
13
17
  "skills",
14
18
  "agents",
15
- "tools"
19
+ "tools",
20
+ "resource"
16
21
  ],
17
22
  "scripts": {
18
23
  "build": "node scripts/build.js",
Binary file
Binary file
@@ -20,10 +20,9 @@ Parse `$ARGUMENTS` as positional tokens:
20
20
  - **Arg 3** (`assets-output-path`): Directory to store all output/report files (required)
21
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
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-coder` 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.
23
+ - **Arg 6** (`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 and 5 first.
25
24
 
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.
25
+ 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 `skip-test` is provided but is not `true` or `false`, ask the user before proceeding.
27
26
 
28
27
  Define shorthand variables for the instructions below:
29
28
 
@@ -34,7 +33,6 @@ Define shorthand variables for the instructions below:
34
33
  | `OUTPUT` | assets-output-path (resolved or generated) |
35
34
  | `MAX_ROUNDS_REVIEW` | max-rounds-review — positive integer (default `2`). Controls Stage 3→3a→3b code-review-fix loop. |
36
35
  | `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
36
  | `SKIP_TEST` | skip-test — `true` or `false` (default `false`). When `true`, skip Stage 4 / 4a / 4b entirely (no real device available). |
39
37
 
40
38
  ---
@@ -145,40 +143,26 @@ Flags: `skip-plan-builder: true|false` (default `false`) — when `true`, skip t
145
143
 
146
144
  Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines below. No natural language, step lists, or Markdown.
147
145
 
148
- 1. Launch the logic context builder agent. Pick by `VARIANT`:
146
+ 1. Launch the logic context builder agent:
149
147
  ```
150
- # VARIANT=enhanced (default) — full agent
151
148
  Agent(
152
149
  subagent_type="logic-context-builder",
153
150
  prompt="harmonyos-project-path: HMOS\nspec-file: OUTPUT/plan.md\noutput-path: OUTPUT/logic"
154
151
  )
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
152
  ```
162
153
  2. Verify `OUTPUT/logic/plan.md` exists.
163
154
 
164
155
  ### Stage 1a — Logic Coding
165
156
 
166
- 1. Launch the logic coding agent. Pick by `VARIANT`:
157
+ 1. Launch the logic coding agent:
167
158
  ```
168
- # VARIANT=enhanced (default) — full agent
169
159
  Agent(
170
160
  subagent_type="logic-coder",
171
161
  prompt="harmonyos-project-path: HMOS\nplan-file: OUTPUT/logic/plan.md\noutput-path: OUTPUT/logic"
172
162
  )
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
163
  ```
180
164
  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`.
165
+ 3. `OUTPUT/logic/coding-summary.md` is human-readable auxiliary; downstream stages consume only `OUTPUT/commit-info.md`.
182
166
 
183
167
  ### Stage 2 — Compilation and Build
184
168
 
@@ -30,11 +30,11 @@ Extract the following from the user's message. If any required input is missing,
30
30
  | Variable | Required | Meaning | Typical Phrasing |
31
31
  |----------|----------|---------|------------------|
32
32
  | `test-case-path` | yes | Path to test_case.md | "测试用例在...", "用例文件...", "test case path" |
33
- | `output-path` | no (default: directory of `test-case-path`) | Directory for all output artifacts | "输出到...", "产物目录...", "output to..." |
34
33
  | `hap-path` | yes | Path to the signed .hap file | "HAP路径...", "安装包在...", "hap file..." |
35
- | `pre-test-case-path` | optional | Path to pre_test_case.md | "前置用例...", "pre test case..." |
36
- | `android-project-path` | optional (for fix loop) | Path to Android source project for reference-based fixing | "Android路径...", "android project..." |
37
- | `max-rounds` | optional, default `3` | Max iterations for the test-and-fix loop. Must be a positive integer (`>= 1`). Only meaningful when the fix loop is enabled. | "最多 X 轮", "max rounds X", "迭代 X 次" |
34
+ | `output-path` | no (default: directory of `test-case-path`) | Directory for all output artifacts | "输出到...", "产物目录...", "output to..." |
35
+ | `pre-test-case-path` | no | Path to pre_test_case.md | "前置用例...", "pre test case..." |
36
+ | `android-project-path` | no (for fix loop) | Path to Android source project for reference-based fixing | "Android路径...", "android project..." |
37
+ | `max-rounds` | no (default `3`) | Max iterations for the test-and-fix loop. Must be a positive integer (`>= 1`). Only meaningful when the fix loop is enabled. | "最多 X 轮", "max rounds X", "迭代 X 次" |
38
38
 
39
39
  **AskUserQuestion template (use this exact shape — do NOT ad-lib free-form questions):**
40
40
 
@@ -18,7 +18,7 @@ HarmonyOS 应用自测执行器。负责把自然语言写的测试用例(`tes
18
18
  | `hdc` | 设备连接 / 安装 HAP | `hdc version` |
19
19
  | `python` ≥ 3.10 | 入口脚本 | `python --version` |
20
20
 
21
- > `uv sync`(拉取 6 个 whl)由 `self_test_runner.py` 自动执行,无需手动 `pip install`。
21
+ > `uv sync`(从本地 `tools/test-tools/` 目录加载 6 个 whl)由 `self_test_runner.py` 自动执行,无需手动 `pip install`。
22
22
 
23
23
  ### 2. 填写 `config.yaml`(包含真实 api_key)
24
24
 
@@ -183,7 +183,7 @@ uv run python report_tool.py validate <out>/self-test-report.md
183
183
  agents/test-tools/autotest/
184
184
  ├── README.md # 本文件
185
185
  ├── .gitignore # 排除 .venv / config.yaml / 运行期日志等
186
- ├── pyproject.toml # 声明 6 个远程 whl URL(harmony-autotest / hypium_mcp / hypium / xdevice*3
186
+ ├── pyproject.toml # 声明 6 个本地 whl 路径(harmony-autotest / hypium_mcp / hypium / xdevice*3,均在上一级 tools/test-tools/)
187
187
  ├── uv.lock # 与 pyproject.toml 配套的版本锁定文件
188
188
  ├── config.yaml.example # 用户拷贝填 api_key 的模板
189
189
  ├── config.yaml # 用户填好的真实配置(.gitignore 中,不入库)
@@ -202,13 +202,13 @@ agents/test-tools/autotest/
202
202
  A: 复制 `config.yaml.example` → `config.yaml` 并填入真实 api_key 后重试。
203
203
 
204
204
  **Q: `uv sync` 卡住或失败**
205
- A: 6 个 whl 都从 gitcode API v5 拉,需要外网访问 `gitcode.com`。失败时检查代理 / 网络;也可以 `--force-reinit` 强制重建。
205
+ A: 6 个 whl 改为从本地 `tools/test-tools/` 目录加载(`pyproject.toml` `[tool.uv.sources]` 用相对路径 `../*.whl`)。失败时确认这 6 个 whl 文件存在于上一级目录;其余依赖仍从清华 PyPI 镜像拉取,需基本网络。也可以 `--force-reinit` 强制重建。
206
206
 
207
207
  **Q: 测试过程被打断,下次跑会冲突吗?**
208
208
  A: 不会。`self_test_runner.py run` 启动时会扫描并 kill 残留的 `AutoTest.batch` / `hypium_mcp` / `harmony_autotest` 进程(不止靠 PID 文件,按命令行名兜底),并自动清掉本目录顶层的 `tmp_hypium/` / `hypium_mcp.log` 等遗留中间产物。`task/` 目录在 agent 流程里也会被清空。
209
209
 
210
210
  **Q: 想彻底重置一遍本地状态再跑?**
211
- A: 跑一次 `python self_test_runner.py clean`:杀残留 → 删 `.venv` → 删 `tmp_hypium/` / `hypium_mcp.log` / `batch.pid` / `batch_stdout.log`。**不要**手工 `uv cache clean`——全局缓存清空后重装 6 个 whl 要从 gitcode 重新拉(1–3 分钟);保留缓存的话 `uv sync` 只需几秒。
211
+ A: 跑一次 `python self_test_runner.py clean`:杀残留 → 删 `.venv` → 删 `tmp_hypium/` / `hypium_mcp.log` / `batch.pid` / `batch_stdout.log`。**不要**手工 `uv cache clean`——全局缓存清空后重装 6 个 whl 要从 gitcode 重新拉(1–3 分钟);这 6 个 whl 现在从本地加载、不走网络,但其余依赖仍走缓存,保留缓存的话 `uv sync` 只需几秒。
212
212
 
213
213
  **Q: 想自己改 `testcases.json` 后再跑?**
214
214
  A: 改完后跑一遍校验,再交给 `self-tester`(`setup=false`):
@@ -4,13 +4,23 @@ version = "0.1.0"
4
4
  description = "Self-test runner harness for HarmonyOS apps; delegates execution to the harmony-autotest whl."
5
5
  requires-python = ">=3.10"
6
6
  dependencies = [
7
- "harmony-autotest @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/harmony_autotest-0.1.0-py3-none-any.whl?ref=main",
8
- "hypium_mcp @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/hypium_mcp-0.6.5-py3-none-any.whl?ref=main",
9
- "hypium @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/hypium-6.1.0.210-py3-none-any.whl?ref=main",
10
- "xdevice @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/xdevice-6.1.0.210-py3-none-any.whl?ref=main",
11
- "xdevice-ohos @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl?ref=main",
12
- "xdevice-devicetest @ https://gitcode.com/api/v5/repos/SMAT/HomeTrans/raw/agents/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl?ref=main",
7
+ "harmony-autotest",
8
+ "hypium_mcp",
9
+ "hypium",
10
+ "xdevice",
11
+ "xdevice-ohos",
12
+ "xdevice-devicetest",
13
13
  ]
14
14
 
15
+ # 6 个 whl 改为从本地加载(仓库里放在上一级 tools/test-tools/ 目录),
16
+ # 路径相对于本 pyproject.toml;不再从 gitcode 远程拉取。
17
+ [tool.uv.sources]
18
+ harmony-autotest = { path = "../harmony_autotest-0.1.0-py3-none-any.whl" }
19
+ hypium_mcp = { path = "../hypium_mcp-0.6.5-py3-none-any.whl" }
20
+ hypium = { path = "../hypium-6.1.0.210-py3-none-any.whl" }
21
+ xdevice = { path = "../xdevice-6.1.0.210-py3-none-any.whl" }
22
+ xdevice-ohos = { path = "../xdevice_ohos-6.1.0.210-py3-none-any.whl" }
23
+ xdevice-devicetest = { path = "../xdevice_devicetest-6.1.0.210-py3-none-any.whl" }
24
+
15
25
  [[tool.uv.index]]
16
26
  url = "https://pypi.tuna.tsinghua.edu.cn/simple"
@@ -22,8 +22,8 @@
22
22
 
23
23
  后台:python -m AutoTest.batch(循环执行 testcases.jsonl,cwd 为 task_<timestamp> 子目录)
24
24
 
25
- 依赖:harmony-autotest 与 hypium_mcp 均在 pyproject.toml 中声明为远程 whl URL
26
- 依赖;`uv sync` 会拉取到本目录 .venv 内,不再需要手动 pip install。
25
+ 依赖:harmony-autotest 与 hypium_mcp 6 个 whl 在 pyproject.toml 中声明为本地路径
26
+ 依赖(上一级 tools/test-tools/ 目录);`uv sync` 会安装到本目录 .venv 内,不再需要手动 pip install。
27
27
 
28
28
  AutoTest.batch 启动时 cwd 设为 task_<timestamp>,因此 hypium_mcp.log / tmp_hypium/
29
29
  等中间产物会落在 task 子目录内,避免污染插件源码目录。
@@ -707,8 +707,8 @@ def cmd_clean(args):
707
707
  - 删除 .venv 及 __pycache__
708
708
  - 删除本目录顶层的 tmp_hypium / hypium_mcp.log / batch.pid / batch_stdout.log
709
709
 
710
- NOT touched: 全局 uv 缓存。重建缓存需重新从 gitcode 拉 6 个 whl
711
- 单纯"重跑一遍"不需要碰它。需要的话用 `uv cache clean` 自己清。
710
+ NOT touched: 全局 uv 缓存。6 个 whl 已改为从本地加载,不走网络;
711
+ 单纯"重跑一遍"不需要碰缓存。需要的话用 `uv cache clean` 自己清。
712
712
  """
713
713
  # 控制台输出即可,不写 self_test_*.log(避免污染 output-dir)
714
714
  logging.basicConfig(