android2harmony 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 +407 -407
- package/agents/code-reviewer.md +16 -17
- package/agents/scripts/hmos-precheck/index.mjs +0 -8
- package/dist/index.js +10 -70
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/skills/hmos-batch-ui-align/SKILL.md +5 -5
- package/skills/hmos-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/PersistenceV2/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 +1220 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
- package/skills/hmos-convert-pipeline/SKILL.md +37 -42
- package/skills/hmos-fix-build-errors/SKILL.md +20 -35
- package/skills/hmos-resources-convert/SKILL.md +2 -2
- package/skills/hmos-spec-generate/SKILL.md +10 -21
- package/agents/build-fixer.md +0 -385
- package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
- package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
- package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
- package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
- package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
|
@@ -48,15 +48,15 @@ Define shorthand variables for the instructions below:
|
|
|
48
48
|
|
|
49
49
|
## Environment Variables Check (run before Stage 1)
|
|
50
50
|
|
|
51
|
-
The pipeline's sub-agents resolve each setting
|
|
51
|
+
The pipeline's sub-agents resolve each setting from the **OS environment variable** — then ask the user if unset. Verify upfront so the long pipeline fails fast (read env vars with `echo "$VAR"` on macOS/Linux; `$env:VAR` in PowerShell on Windows):
|
|
52
52
|
|
|
53
|
-
| Variable |
|
|
54
|
-
|
|
55
|
-
| `
|
|
56
|
-
| `HOMETRANS_MODEL_API_KEY`
|
|
57
|
-
| `HOMETRANS_TOOL_PATH` |
|
|
53
|
+
| Variable | Needed for | Valid when |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `DEVECO_SDK_HOME` | Stage 2 build + Stage 3b/4b rebuilds | resolves to a valid DevEco install (derive the install root as its parent dir) |
|
|
56
|
+
| `HOMETRANS_MODEL_API_KEY` | Stage 4 self-test (only when `SKIP_TEST=false`) | non-empty / not the placeholder |
|
|
57
|
+
| `HOMETRANS_TOOL_PATH` | Stage 4 self-test AutoTest dir | path exists on disk; if unset, the self-test stage resolves the bundled AutoTest tools dir itself |
|
|
58
58
|
|
|
59
|
-
For each value, if the env var is unset,
|
|
59
|
+
For each value, if the env var is unset, **ask the user**: for the DevEco path / model api_key, **ask the user** (for the api_key they may instead pass `skip_test=true`). Suggest setting the corresponding machine environment variable directly (`DEVECO_SDK_HOME` / `HOMETRANS_MODEL_API_KEY` / `HOMETRANS_TOOL_PATH`).
|
|
60
60
|
|
|
61
61
|
---
|
|
62
62
|
|
|
@@ -163,15 +163,15 @@ For the Stage 4 loop, combine test and fix results into one row per round plus o
|
|
|
163
163
|
Several stages below need the **full signed package set** — the entry HAP plus any in-app HSPs (and any feature HAP the build freshly produced) — so the self-tester installs them in one `hdc install -r` transaction (in-app HSPs cannot install standalone). Those stages call this procedure.
|
|
164
164
|
|
|
165
165
|
**Inputs:**
|
|
166
|
-
- `BUILD_ROOT` — the project root build-
|
|
167
|
-
- `DEST` — a dedicated `package-set/` directory to populate; **must never be the directory
|
|
168
|
-
- `BUILD_START` — a marker captured **immediately before**
|
|
169
|
-
- `AUTHORITATIVE_ENTRY` — the entry HAP build
|
|
166
|
+
- `BUILD_ROOT` — the project root rebuilt by `hmos-fix-build-errors` (= `HMOS`).
|
|
167
|
+
- `DEST` — a dedicated `package-set/` directory to populate; **must never be the directory where you mirror the authoritative entry HAP** (step 1 clears `DEST`).
|
|
168
|
+
- `BUILD_START` — a marker captured **immediately before** invoking the build stage, e.g. `touch "<DEST>/../.build_start_marker"` (or record a timestamp). Used to tell freshly-rebuilt artifacts from stale ones. A touched marker + `find -newer` avoids clock-skew between the build stage and the host.
|
|
169
|
+
- `AUTHORITATIVE_ENTRY` — the authoritative signed entry HAP resolved directly from `HMOS/entry/build/default/outputs/default/` after `hmos-fix-build-errors` succeeds. Once resolved for the stage, treat it as authoritative regardless of mtime.
|
|
170
170
|
|
|
171
171
|
**Procedure:**
|
|
172
|
-
1. **Clear/create `DEST`** (remove prior contents, recreate) so stale packages never leak forward. `DEST` is a dedicated `package-set/` subdir, distinct from where
|
|
173
|
-
2. **Place the authoritative entry:** copy `AUTHORITATIVE_ENTRY` into `DEST`. Included **unconditionally — the mtime gate does NOT apply to the entry** (an incremental build may leave the build-tree entry UP-TO-DATE
|
|
174
|
-
3. **Discover non-entry outputs** under depth-1 modules `BUILD_ROOT/*/build/default/outputs/default/`, admitting **only files with mtime ≥ `BUILD_START`** (freshly rebuilt this invocation; cross-platform: `find "<dir>" -newer "<marker>"` or compare `stat` mtimes).
|
|
172
|
+
1. **Clear/create `DEST`** (remove prior contents, recreate) so stale packages never leak forward. `DEST` is a dedicated `package-set/` subdir, distinct from the location where you mirror the authoritative entry for this stage.
|
|
173
|
+
2. **Place the authoritative entry:** copy `AUTHORITATIVE_ENTRY` into `DEST`. Included **unconditionally — the mtime gate does NOT apply to the entry** (an incremental build may leave the build-tree entry UP-TO-DATE, but the resolved entry HAP still reflects the current build result).
|
|
174
|
+
3. **Discover non-entry outputs** under depth-1 modules `BUILD_ROOT/*/build/default/outputs/default/`, admitting **only files with mtime ≥ `BUILD_START`** (freshly rebuilt this invocation; cross-platform: `find "<dir>" -newer "<marker>"` or compare `stat` mtimes). Incremental rebuilds run **no clean**, so non-entry dirs still hold *prior*-build packages — the mtime gate is the only reliable way to reject those stale artifacts:
|
|
175
175
|
- **HSPs:** `*-signed.hsp` (the fresh in-app HSPs).
|
|
176
176
|
- **Feature HAPs:** `*-signed.hap` from non-entry modules the build freshly rebuilt; skip any whose basename equals `AUTHORITATIVE_ENTRY`'s.
|
|
177
177
|
4. **Exclude test artifacts:** skip `*ohosTest*` and `*-test-signed.*`.
|
|
@@ -216,12 +216,12 @@ Prompt format (applies to both Stage 1 and Stage 1a): ONLY the key-value lines b
|
|
|
216
216
|
|
|
217
217
|
### Stage 2 — Compilation and Build
|
|
218
218
|
|
|
219
|
-
1.
|
|
220
|
-
2.
|
|
221
|
-
3.
|
|
222
|
-
4.
|
|
223
|
-
5. **If the build succeeded**, run **Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = OUTPUT/package-set/`,
|
|
224
|
-
6.
|
|
219
|
+
1. Invoke the `hmos-fix-build-errors` skill for a signed build of `HMOS`.
|
|
220
|
+
2. Capture `BUILD_START` just before invoking the skill.
|
|
221
|
+
3. Treat the build stage as a compile/fix gate only — do **not** expect build-stage report or commit-info artifacts.
|
|
222
|
+
4. After a successful build, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (prefer `entry-default-signed.hap`, else the first `*-signed.hap`) and note it in the manifest.
|
|
223
|
+
5. **If the build succeeded**, run **Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = OUTPUT/package-set/`, the resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`. Record the inventory in the manifest. (If the build failed there is no fresh entry to collect; collection's ≥1-`.hap` guard fails and Stage 4 Loop Setup's legacy fallback applies.)
|
|
224
|
+
6. Do not read a build-stage commit-info file; `OUTPUT/commit-info.md` from Stage 1a remains the canonical commit handoff for later review stages.
|
|
225
225
|
|
|
226
226
|
### Stage 3 — Code Review Loop (Review-and-Fix → Rebuild)
|
|
227
227
|
|
|
@@ -231,7 +231,7 @@ Treat Stage 3 → 3b as a loop that runs up to `MAX_ROUNDS_REVIEW` times. `code-
|
|
|
231
231
|
|
|
232
232
|
1. **Resolve the initial commit ID for code review** using the following priority:
|
|
233
233
|
- Read `OUTPUT/commit-info.md` (written by Stage 1a) and use its `commit_id` when available.
|
|
234
|
-
- IMPORTANT: Use `commit-info.md` from Stage 1a
|
|
234
|
+
- IMPORTANT: Use `commit-info.md` from Stage 1a. The build stage no longer produces a separate commit-info artifact.
|
|
235
235
|
- Store this as `REVIEW_COMMIT_ID`.
|
|
236
236
|
2. Initialize loop state:
|
|
237
237
|
- `review_round = 1`
|
|
@@ -267,14 +267,13 @@ For each `review_round` from `1..MAX_ROUNDS_REVIEW`, set `REVIEW_ROUND_DIR = OUT
|
|
|
267
267
|
##### Review Round Step B — Stage 3b Rebuild after Review Fix
|
|
268
268
|
|
|
269
269
|
1. Mark Stage 3b `in_progress` when the first Stage 3b round begins.
|
|
270
|
-
2. Capture `BUILD_START` (touch a marker), then
|
|
271
|
-
3.
|
|
272
|
-
4.
|
|
273
|
-
5.
|
|
274
|
-
6.
|
|
275
|
-
7.
|
|
276
|
-
8.
|
|
277
|
-
9. **Loop stop decision** (after 3b completes):
|
|
270
|
+
2. Capture `BUILD_START` (touch a marker), then invoke the `hmos-fix-build-errors` skill for a signed rebuild of `HMOS`.
|
|
271
|
+
3. Treat this as a compile/fix gate only — do **not** expect a rebuild report artifact in `REVIEW_ROUND_DIR`.
|
|
272
|
+
4. If the build succeeds, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (prefer `entry-default-signed.hap`, else the first `*-signed.hap`), note it in the manifest, and **then run Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = REVIEW_ROUND_DIR/package-set/`, the resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`; on success set `LAST_GOOD_REVIEW_SET = REVIEW_ROUND_DIR/package-set/`. **If the 3b build failed, do NOT run collection and keep the previous `LAST_GOOD_REVIEW_SET`** (a failed rebuild leaves stale sibling-module outputs on disk; the mtime gate already prevents harvesting them, and skipping collection avoids re-touching `LAST_GOOD_REVIEW_SET` with an entry-less set).
|
|
273
|
+
5. Append one Defect Summary row for this round using the parsed Stage 3 stats, labeled `3 Loop - Round {review_round}`.
|
|
274
|
+
6. Update the Stage 3b task description with a brief round summary (for example: `Round 1: build success`).
|
|
275
|
+
7. Increment `review_rounds_executed`.
|
|
276
|
+
8. **Loop stop decision** (after 3b completes):
|
|
278
277
|
- If `review_stop_reason` was already set to `no_progress` in Step A, exit the loop.
|
|
279
278
|
- Else if `review_round == MAX_ROUNDS_REVIEW`, set `review_stop_reason = max_rounds_reached` and exit the loop.
|
|
280
279
|
- Else continue to the next round.
|
|
@@ -292,7 +291,6 @@ After the review loop exits:
|
|
|
292
291
|
3. Mirror the final review round outputs back to the root `OUTPUT` directory using the canonical filenames for backward compatibility:
|
|
293
292
|
- `OUTPUT/code-review-report.md`
|
|
294
293
|
- `OUTPUT/code-review-commit-info.md`
|
|
295
|
-
- `OUTPUT/build-fix-report.md` (overwrites Stage 2 report, if 3b ran in the final round)
|
|
296
294
|
- If the final round's build produced a signed `.hap`, copy it to `OUTPUT` (replaces Stage 2 `.hap` if present).
|
|
297
295
|
- **Mirror the package set:** if `LAST_GOOD_REVIEW_SET != none` (some review round rebuilt successfully), clear-then-copy `LAST_GOOD_REVIEW_SET` → `OUTPUT/package-set/`. **If `LAST_GOOD_REVIEW_SET == none`, leave `OUTPUT/package-set/` (the Stage-2 set) untouched — never clear it.** No self-copy guard is needed: `LAST_GOOD_REVIEW_SET` is always a `review-round-*/package-set/`, never `OUTPUT/package-set/`.
|
|
298
296
|
4. Mark Stage 3 / 3b `completed` only after the full loop finishes.
|
|
@@ -346,7 +344,7 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
|
|
|
346
344
|
- `output_path`: `OUTPUT` (still the ROOT)
|
|
347
345
|
- `setup`: `false`
|
|
348
346
|
5. The agent verifies device connectivity, invokes `ht autotest selftest run` to 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`.
|
|
349
|
-
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 (
|
|
347
|
+
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 (a previous rebuild step may have written one for a relocated project root), the round-dir copy overrides the root copy for this round.
|
|
350
348
|
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.
|
|
351
349
|
8. Read `ROUND_DIR/self-test-report.md` and extract total cases, passed, failed, and pass rate when the report exists.
|
|
352
350
|
9. Compute `round_all_passed` only when the report can be parsed clearly and:
|
|
@@ -376,14 +374,13 @@ For each `round` from `1..MAX_ROUNDS_TEST`, set `ROUND_DIR = OUTPUT/round-{round
|
|
|
376
374
|
##### Round Step C — Stage 4b Rebuild after Self-Test Fix
|
|
377
375
|
|
|
378
376
|
1. Mark Stage 4b `in_progress` when the first Stage 4b round begins.
|
|
379
|
-
2. Capture `BUILD_START` (touch a marker), then
|
|
380
|
-
3.
|
|
381
|
-
4.
|
|
382
|
-
5.
|
|
383
|
-
6.
|
|
384
|
-
7.
|
|
385
|
-
8.
|
|
386
|
-
9. **Loop stop decision** (after 4b completes):
|
|
377
|
+
2. Capture `BUILD_START` (touch a marker), then invoke the `hmos-fix-build-errors` skill for a signed rebuild of `HMOS`.
|
|
378
|
+
3. Treat this as a compile/fix gate only — do **not** expect rebuild-stage report or commit-info artifacts in `ROUND_DIR`.
|
|
379
|
+
4. ⚠️ **CRITICAL — Update `CURRENT_HAP` for the next round**: If the build succeeds, resolve `AUTHORITATIVE_ENTRY` directly from `HMOS/entry/build/default/outputs/default/` (prefer `entry-default-signed.hap`, else the first `*-signed.hap`), **run Package-Set Collection** with `BUILD_ROOT = HMOS`, `DEST = ROUND_DIR/package-set/`, that resolved `AUTHORITATIVE_ENTRY`, and the captured `BUILD_START`, and then set `CURRENT_HAP = ROUND_DIR/package-set/` so the next round's Stage 4 self-tester uses the freshly built set. If collection **fails** or yields zero HAPs, **keep the previous `CURRENT_HAP`** (the prior round's full set — fresher than any legacy single-file resolution) and record that this round produced no fresh package set.
|
|
380
|
+
5. 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}`.
|
|
381
|
+
6. Update the Stage 4b task description with a brief round summary (for example: `Round 1: build success, hap=...`).
|
|
382
|
+
7. Increment `rounds_executed`.
|
|
383
|
+
8. **Loop stop decision** (after 4b completes):
|
|
387
384
|
- If `round_all_passed == true`, set `stop_reason = all_passed` and exit the loop.
|
|
388
385
|
- 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.
|
|
389
386
|
- Else if `round == MAX_ROUNDS_TEST`, set `stop_reason = max_rounds_reached` and exit the loop.
|
|
@@ -399,11 +396,9 @@ After the loop exits:
|
|
|
399
396
|
- `Rounds executed: rounds_executed`
|
|
400
397
|
- `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)
|
|
401
398
|
- `Final round: round-{rounds_executed}`
|
|
402
|
-
3. Mirror the final round's `OUTPUT/round-{rounds_executed}/` Fix
|
|
399
|
+
3. Mirror the final round's `OUTPUT/round-{rounds_executed}/` Fix 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):
|
|
403
400
|
- `OUTPUT/self-test-fix-report.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-report.md` (if present)
|
|
404
|
-
- `OUTPUT/build-fix-report.md` ← `OUTPUT/round-{rounds_executed}/build-fix-report.md` (if present)
|
|
405
401
|
- `OUTPUT/self-test-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/self-test-fix-commit-info.md` (if present)
|
|
406
|
-
- `OUTPUT/build-fix-commit-info.md` ← `OUTPUT/round-{rounds_executed}/build-fix-commit-info.md` (if present)
|
|
407
402
|
- **Final package set** — branch on the type of `CURRENT_HAP`:
|
|
408
403
|
- **If `CURRENT_HAP` is a directory** (a `package-set/`): mirror `CURRENT_HAP/` → `OUTPUT/package-set/` (clear-then-copy), **but skip entirely when `CURRENT_HAP` already resolves to `OUTPUT/package-set/`** (source == dest — happens when every 4b build failed and `CURRENT_HAP` still holds the Loop-Setup value; a clear-then-copy onto itself would destroy the set). Then, best-effort, copy the single `entry-*.hap` out of the set to `OUTPUT/entry-default-signed.hap` for back-compat (skip if absent).
|
|
409
404
|
- **If `CURRENT_HAP` is a single file** (legacy fallback — no package set was ever produced): copy it to `OUTPUT/entry-default-signed.hap`, skipping when `CURRENT_HAP` is already that path. Do not attempt a directory mirror.
|
|
@@ -29,11 +29,10 @@ Note: `--signed` is a positional-order-independent flag — when `deveco_studio_
|
|
|
29
29
|
|
|
30
30
|
1. **Verify project exists** — Check that `harmony_project_dir` contains a valid HarmonyOS project (look for `build-profile.json5`, `entry/src` directory, `oh-package.json5`).
|
|
31
31
|
|
|
32
|
-
2. **Resolve `<deveco-path>`** — follow the
|
|
32
|
+
2. **Resolve `<deveco-path>`** — follow the resolution chain, stopping at the first source that yields a valid path (environment variable only, else ask):
|
|
33
33
|
1. `deveco_studio_path` if provided (and not `--signed`).
|
|
34
|
-
2. **OS environment
|
|
35
|
-
3.
|
|
36
|
-
4. **Ask the user** for the DevEco Studio install path (suggest running `ht init` to persist it as an environment variable).
|
|
34
|
+
2. **OS environment variable** `DEVECO_SDK_HOME` (`echo "$DEVECO_SDK_HOME"` on macOS/Linux; `$env:DEVECO_SDK_HOME` in PowerShell on Windows) — the DevEco SDK root (e.g. `D:/DevEco Studio/sdk`); derive `<deveco-path>` as its parent directory (the DevEco Studio install root).
|
|
35
|
+
3. **Ask the user** for the DevEco Studio install path (suggest setting `DEVECO_SDK_HOME` as a machine environment variable).
|
|
37
36
|
|
|
38
37
|
**Verify the resolved `<deveco-path>`** contains:
|
|
39
38
|
- `tools/node/node.exe`
|
|
@@ -49,16 +48,11 @@ Note: `--signed` is a positional-order-independent flag — when `deveco_studio_
|
|
|
49
48
|
```
|
|
50
49
|
Create it if missing. Use forward slashes in the path.
|
|
51
50
|
|
|
52
|
-
4. **
|
|
53
|
-
```bash
|
|
54
|
-
cd "<project-dir>"
|
|
55
|
-
export PATH="<deveco-path>/tools/ohpm/bin:$PATH"
|
|
56
|
-
"<deveco-path>/tools/ohpm/bin/ohpm" install
|
|
57
|
-
```
|
|
51
|
+
4. **Use `npx --yes devecocli build` as the build entrypoint** — The build-fix loop should call `npx --yes devecocli build` rather than invoking `ohpm` or `hvigorw.js` directly. `npx --yes devecocli build` wraps dependency install (`ohpm install`) and the underlying hvigor build.
|
|
58
52
|
|
|
59
53
|
5. **Determine Build Mode** — Check if any argument equals `--signed` (it may be `$ARGUMENTS[1]` when the DevEco path is omitted, or `$ARGUMENTS[2]` when it is provided):
|
|
60
54
|
- **If NOT `--signed`** → **Unsigned build mode**. Ensure `build-profile.json5` does NOT have `signingConfigs` or `signingConfig` references in products (remove them if present). Go to Step 1.
|
|
61
|
-
- **If `--signed`** → **Signed build mode**. Proceed to Step 0.5 to validate signing config
|
|
55
|
+
- **If `--signed`** → **Signed build mode**. Proceed to Step 0.5 to validate signing config before the Step 1 build loop invokes `npx --yes devecocli build`.
|
|
62
56
|
|
|
63
57
|
---
|
|
64
58
|
|
|
@@ -93,39 +87,30 @@ Execute the following loop. **Maximum 20 iterations** to prevent infinite loops.
|
|
|
93
87
|
|
|
94
88
|
### 1.1 Run CLI Build
|
|
95
89
|
|
|
96
|
-
|
|
90
|
+
Use `npx --yes devecocli build` as the build command inside the fix loop. It is the supported wrapper for dependency install and hvigor execution, so the skill should not instruct raw `hvigorw.js` calls.
|
|
97
91
|
|
|
98
|
-
1. **
|
|
92
|
+
1. **Invoke `npx --yes devecocli build` from the project root**:
|
|
99
93
|
|
|
100
94
|
**For unsigned builds** (no `--signed`):
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
cd /d "<project-dir>"
|
|
105
|
-
"<deveco-path>\tools\node\node.exe" "<deveco-path>\tools\hvigor\bin\hvigorw.js" assembleHap --mode module -p module=entry --no-daemon
|
|
95
|
+
```bash
|
|
96
|
+
cd "<project-dir>"
|
|
97
|
+
npx --yes devecocli build
|
|
106
98
|
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
set "PATH=<deveco-path>\jbr\bin;%PATH%"
|
|
112
|
-
set "JAVA_HOME=<deveco-path>\jbr"
|
|
113
|
-
set "DEVECO_SDK_HOME=<deveco-path>\sdk"
|
|
114
|
-
cd /d "<project-dir>"
|
|
115
|
-
"<deveco-path>\tools\node\node.exe" "<deveco-path>\tools\hvigor\bin\hvigorw.js" assembleHap --mode module -p module=entry --no-daemon
|
|
99
|
+
If the project needs an explicit module target, prefer:
|
|
100
|
+
```bash
|
|
101
|
+
cd "<project-dir>"
|
|
102
|
+
npx --yes devecocli build --modules entry
|
|
116
103
|
```
|
|
117
|
-
Note: Signed builds need `JAVA_HOME` and `jbr\bin` in PATH because the `SignHap` step spawns `java` as a child process.
|
|
118
104
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
2. **Run the batch file** via `cmd.exe`:
|
|
105
|
+
**For signed builds** (`--signed`):
|
|
122
106
|
```bash
|
|
123
|
-
|
|
107
|
+
cd "<project-dir>"
|
|
108
|
+
npx --yes devecocli build
|
|
124
109
|
```
|
|
110
|
+
Run this only after Step 0.5 verifies the signing config in `build-profile.json5`. Preserve any required signed-build environment setup (for example `JAVA_HOME` on Windows) before invoking `npx --yes devecocli build`, but do not bypass the CLI wrapper.
|
|
125
111
|
|
|
126
|
-
|
|
112
|
+
2. **Capture the full output** into a variable.
|
|
127
113
|
|
|
128
|
-
- Capture the **full output** into a variable.
|
|
129
114
|
- The build command may take 1-3 minutes. Use a timeout of 300000ms (5 minutes).
|
|
130
115
|
|
|
131
116
|
### 1.2 Check Build Result
|
|
@@ -270,7 +255,7 @@ All code must comply with ArkTS strict mode:
|
|
|
270
255
|
- **Don't over-fix**: Only fix errors reported by the compiler. Don't proactively refactor unrelated code.
|
|
271
256
|
- **Read before edit**: Always read a file before modifying it. Understand the surrounding context.
|
|
272
257
|
- **One error can cause many**: A single root-cause fix (like adding a missing interface) may resolve multiple reported errors. After fixing root causes, rebuild to see remaining issues.
|
|
273
|
-
- **ohpm errors**: If the build fails because of missing packages,
|
|
258
|
+
- **ohpm errors**: If the build fails because of missing packages, rerun `npx --yes devecocli build` so it can retry dependency install before you investigate deeper.
|
|
274
259
|
|
|
275
260
|
---
|
|
276
261
|
|
|
@@ -73,7 +73,7 @@ a2h-resource <apk_path> -o <decoded_output_path>
|
|
|
73
73
|
Alternatively, if you prefer not to install globally, run it on-demand with `npx` (which fetches the package automatically):
|
|
74
74
|
|
|
75
75
|
```bash
|
|
76
|
-
npx a2h-resource <apk_path> -o <decoded_output_path>
|
|
76
|
+
npx --yes a2h-resource <apk_path> -o <decoded_output_path>
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
`a2h-resource` is a pure-Node.js resource decoder distributed as an npm package and requires only Node.js `>= 20`. It reads the APK's `resources.arsc` — the fully-merged resource table produced at build time — so its output at `<decoded_output_path>/res/` is the **complete merged resource set** (source + all library/AAR resources merged in at build time). It produces:
|
|
@@ -646,7 +646,7 @@ Read `references/resource-mapping-rules.md` and write the mapping markdown with
|
|
|
646
646
|
- **Build is best-effort**: The APK build + decoding is attempted first because the decoded APK is the most complete resource source (it includes library dependencies). But if the build fails, conversion proceeds from source `res/` — a partial conversion with clear reporting is far more useful than no conversion at all.
|
|
647
647
|
- **XML drawable conversion is critical**: Android XML drawables (`<vector>`, `<shape>`, `<layer-list>`, `<selector>`) must be converted to SVG format, not skipped. HarmonyOS supports SVG in `media/`. Read `references/xml-drawable-to-svg-rules.md` for the detailed conversion rules for each drawable type.
|
|
648
648
|
- **Dependency analysis always runs**: Read `references/dependency-analysis-rules.md` for the complete dependency extraction patterns and reference formats. Even when converting from source `res/` with missing library resources, dependency analysis is essential — it tells the developer exactly which references are broken and why, so they can address them manually or fix the build.
|
|
649
|
-
- **APK decoding**: The decoder is `a2h-resource`, a pure-Node.js resource decoder published to npm (requires Node.js `>= 20`; no other runtime). Install it with `npm install -g a2h-resource` and run `a2h-resource <apk> -o <out>`, or run it on-demand with `npx a2h-resource <apk> -o <out>`. It covers resource extraction only — it does not disassemble `classes.dex` or repackage APKs, neither of which this skill needs. It decodes a single resource package (the app's); if it errors out or the APK is a rare multi-package/split APK, fall back to converting from the project's source `res/` directory (as in Step 3).
|
|
649
|
+
- **APK decoding**: The decoder is `a2h-resource`, a pure-Node.js resource decoder published to npm (requires Node.js `>= 20`; no other runtime). Install it with `npm install -g a2h-resource` and run `a2h-resource <apk> -o <out>`, or run it on-demand with `npx --yes a2h-resource <apk> -o <out>`. It covers resource extraction only — it does not disassemble `classes.dex` or repackage APKs, neither of which this skill needs. It decodes a single resource package (the app's); if it errors out or the APK is a rare multi-package/split APK, fall back to converting from the project's source `res/` directory (as in Step 3).
|
|
650
650
|
- When parsing Android XML resource files, handle XML namespaces, comments, and attributes correctly.
|
|
651
651
|
- For `values/` XML files, each `<resources>` element can contain multiple resource entries — extract ALL of them.
|
|
652
652
|
- When multiple Android value files contribute to the same HarmonyOS JSON file (e.g., both `strings.xml` and custom `app_strings.xml` both contain `<string>` entries), merge them into a single JSON file.
|
|
@@ -13,13 +13,6 @@ allowed-tools:
|
|
|
13
13
|
- TaskCreate
|
|
14
14
|
- TaskList
|
|
15
15
|
- TaskUpdate
|
|
16
|
-
- mcp__homegraph__search
|
|
17
|
-
- mcp__homegraph__explore
|
|
18
|
-
- mcp__homegraph__node
|
|
19
|
-
- mcp__homegraph__impact
|
|
20
|
-
- mcp__homegraph__callers
|
|
21
|
-
- mcp__homegraph__callees
|
|
22
|
-
- mcp__homegraph__files
|
|
23
16
|
---
|
|
24
17
|
|
|
25
18
|
# Spec Generator Skill
|
|
@@ -32,8 +25,7 @@ You are a **Spec Generator** that produces high-quality requirement specificatio
|
|
|
32
25
|
|------|-------|
|
|
33
26
|
| **Input** | `requirement-description-dir` + `android-project-path` + `spec-output-dir` |
|
|
34
27
|
| **Output** | One `<source_filename_without_ext>.md` per input `.txt` under `spec-output-dir` |
|
|
35
|
-
| **homegraph
|
|
36
|
-
| **homegraph (Code queries)** | `mcp__homegraph__*` tools (`search` / `explore` / `node` / `impact` / `callers` / `callees` / `files`) |
|
|
28
|
+
| **homegraph** | `npx --yes homegraph <command>` CLI via `Bash` (index management + code queries) |
|
|
37
29
|
| **Processing Mode** | Per-file end-to-end loop (no batch pre-read) |
|
|
38
30
|
|
|
39
31
|
## Expected Input
|
|
@@ -378,33 +370,30 @@ These are the authoring rules the final spec MUST follow:
|
|
|
378
370
|
|
|
379
371
|
### Step 1 — Ensure homegraph has a fresh index for the project
|
|
380
372
|
|
|
381
|
-
homegraph
|
|
373
|
+
homegraph is invoked exclusively through its CLI via `Bash`. Always prefix commands with `npx` (e.g. `npx --yes homegraph status <android-project-path>`); `npx` resolves the binary without requiring a global install. All index management and code query commands share the same CLI — there is no MCP surface in this skill.
|
|
382
374
|
|
|
383
|
-
-
|
|
384
|
-
- **Code queries** (`search`, `explore`, `node`, `impact`, `callers`, `callees`, `files`) → call `mcp__homegraph__*` tools directly.
|
|
385
|
-
|
|
386
|
-
homegraph indexes per-project into a local `.homegraph/` directory; there is no central repo registry. Scope every code query to the Android project with `projectPath: "<android-project-path>"` (this skill's working directory is the spec project, NOT the Android project, so the parameter is mandatory — omitting it queries the wrong project).
|
|
375
|
+
homegraph indexes per-project into a local `.homegraph/` directory; there is no central repo registry. Always pass the Android project path as the positional `[path]` argument to scope the command to the Android project (this skill's working directory is the spec project, NOT the Android project, so omitting the path queries the wrong project).
|
|
387
376
|
|
|
388
377
|
Procedure:
|
|
389
378
|
|
|
390
|
-
1. Run `homegraph status <android-project-path>` to inspect the index state.
|
|
379
|
+
1. Run `npx --yes homegraph status <android-project-path>` to inspect the index state.
|
|
391
380
|
2. Decide based on the output:
|
|
392
|
-
- **Not indexed** (no `.homegraph/`) → run `homegraph init -i <android-project-path>`, wait for completion.
|
|
393
|
-
- **Stale** (`homegraph status` output does NOT contain `[OK] Index is up to date`) → run `homegraph sync <android-project-path>` (incremental; use `homegraph index <android-project-path> --force` for a full rebuild), wait for completion.
|
|
381
|
+
- **Not indexed** (no `.homegraph/`) → run `npx --yes homegraph init -i <android-project-path>`, wait for completion.
|
|
382
|
+
- **Stale** (`npx --yes homegraph status` output does NOT contain `[OK] Index is up to date`) → run `npx --yes homegraph sync <android-project-path>` (incremental; use `npx --yes homegraph index <android-project-path> --force` for a full rebuild), wait for completion.
|
|
394
383
|
- **Fresh** → proceed to Step 2.
|
|
395
384
|
|
|
396
385
|
**Hard fail policy** — any of the following stops the skill and surfaces the error to the user; do NOT degrade to `Read` + `Grep`:
|
|
397
386
|
|
|
398
|
-
- `homegraph` CLI is not
|
|
399
|
-
- `homegraph status`, `init`, `sync`, or `index` returns an error → surface the error verbatim and stop. Do not attempt spec generation without an index — the resulting spec would miss code-grounded scenarios.
|
|
400
|
-
- Any `
|
|
387
|
+
- `homegraph` CLI is not reachable via `npx` → ask the user to install it (`npm install -g homegraph` or `npx --yes homegraph install`).
|
|
388
|
+
- `npx --yes homegraph status`, `init`, `sync`, or `index` returns an error → surface the error verbatim and stop. Do not attempt spec generation without an index — the resulting spec would miss code-grounded scenarios.
|
|
389
|
+
- Any `npx --yes homegraph` query reports the project is not indexed → verify `init -i` ran against `android-project-path`.
|
|
401
390
|
|
|
402
391
|
### Step 2 — Process each requirement file independently, one at a time
|
|
403
392
|
|
|
404
393
|
For each `.txt` filename collected in Step 0, in order, run 2.1 → 2.4 end-to-end before moving to the next file. Do NOT pre-read all `.txt` files.
|
|
405
394
|
|
|
406
395
|
- **2.1 Read**: Read this file's content verbatim. If empty, warn and skip to the next file.
|
|
407
|
-
- **2.2 Analyze**: Explore the Android codebase for this requirement using the `
|
|
396
|
+
- **2.2 Analyze**: Explore the Android codebase for this requirement using the `npx --yes homegraph` CLI (via `Bash`) to retrieve the complete code implementation (entry points, end-to-end call chains, state writes / persistence keys, manifest declarations). Query commands (`query` / `explore` / `node` / `callers` / `callees` / `impact` / `files`) resolve their target project from the current working directory's nearest `.homegraph/` index, so run them from within the Android project root using a subshell — e.g. `cd <android-project-path> && npx --yes homegraph explore "<query>"` (the index commands `status` / `init` / `sync` / `index` accept an explicit path argument, see Step 1). Use `npx --yes homegraph query "<keyword>"` / `npx --yes homegraph explore "<query>"` to locate symbols and read their line-numbered source; `npx --yes homegraph node "<symbol|file>"` to read a single symbol or whole file; `npx --yes homegraph callers "<symbol>"` / `npx --yes homegraph callees "<symbol>"` to walk call chains up and down; `npx --yes homegraph impact "<symbol>"` for change blast radius; `npx --yes homegraph files` to enumerate indexed files; and `Grep` for exact literals (settings keys, DAO columns, `android:key`) that live outside the code graph. Always run query commands from `<android-project-path>` — this skill's working directory is the spec project, NOT the Android project, so running them from elsewhere queries the wrong project (or none). Use the CLI directly — do NOT invoke any MCP tool or nested exploration skill. If any `npx --yes homegraph` call fails unexpectedly, surface the error and stop.
|
|
408
397
|
- **2.3 Decompose**: Using the raw requirement + code from 2.2, generate the spec per `## Principles` and `## Spec Few-shot Samples`.
|
|
409
398
|
- **2.4 Write**: Write the spec to `<spec-output-dir>/<source_filename_without_ext>.md` (overwrite if exists), then move on to the next file.
|
|
410
399
|
|