@harmonyos-arkts/d2h 0.1.2 → 0.1.5
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 +78 -44
- package/agents/android-to-hmos-00-orchestrator.md +34 -28
- package/agents/d2h.md +266 -95
- package/dist/bin/install-opencode.js +137 -43
- package/dist/src/install-opencode.js +44 -0
- package/dist/src/install-vscode.js +226 -0
- package/dist/src/toolchain.js +83 -0
- package/docs/environment-check.md +86 -0
- package/opencode/agents.json +1 -1
- package/opencode/vscode-d2h-package.json +7 -0
- package/opencode/vscode-d2h-plugin.mjs +29 -0
- package/package.json +6 -4
- package/schemas/task-envelope.schema.json +58 -4
- package/schemas/task-plan.schema.json +281 -63
- package/scripts/check-environment.mjs +321 -0
- package/skills/android2hmos_resources_convert/SKILL.md +37 -19
- package/skills/appgraph-rule-audit/SKILL.md +24 -5
- package/skills/d2h-hypium-forge/SKILL.md +252 -0
- package/skills/d2h-hypium-forge/references/functional-spec-template.md +140 -0
- package/skills/d2h-hypium-forge/references/official-api.md +135 -0
- package/skills/d2h-hypium-forge/references/pitfalls.md +98 -0
- package/skills/d2h-hypium-forge/references/testability-template.md +71 -0
- package/skills/d2h-hypium-forge/scripts/_common_template.py +614 -0
- package/skills/d2h-hypium-forge/scripts/analyze_results.py +156 -0
- package/skills/d2h-hypium-forge/scripts/assert_audit.py +107 -0
- package/skills/d2h-hypium-forge/scripts/collect_runtime_pages.py +169 -0
- package/skills/d2h-hypium-forge/scripts/forge_report.py +325 -0
- package/skills/d2h-hypium-forge/scripts/inject_resource_ids.py +114 -0
- package/skills/d2h-hypium-forge/scripts/lint_asserts.py +80 -0
- package/skills/d2h-hypium-forge/scripts/lint_locate.py +60 -0
- package/skills/d2h-hypium-forge/scripts/merge_appgraph.py +249 -0
- package/skills/d2h-hypium-forge/scripts/precondition.py +140 -0
- package/skills/d2h-hypium-forge/scripts/preinject_ids.py +232 -0
- package/skills/d2h-hypium-forge/scripts/run_direct.py +392 -0
- package/skills/d2h-hypium-forge/scripts/run_parallel.py +121 -0
- package/skills/d2h-hypium-forge/scripts/scan_features.py +255 -0
- package/skills/d2h-hypium-forge/scripts/upgrade_asserts.py +66 -0
- package/skills/d2h-hypium-forge/scripts/validate_scenarios.py +84 -0
- package/skills/d2h-utg-ai-generate/SKILL.md +128 -0
- package/skills/d2h-utg-ai-generate/references/click-paths-schema.json +76 -0
- package/skills/d2h-utg-ai-generate/references/extraction-guide.md +34 -0
- package/skills/d2h-utg-ai-generate/references/facts-contract.md +96 -0
- package/skills/d2h-utg-ai-generate/references/page-schema.json +61 -0
- package/skills/d2h-utg-ai-generate/references/utg-schema.json +89 -0
- package/skills/d2h-utg-ai-generate/scripts/build_page_json.py +314 -0
- package/skills/d2h-utg-ai-generate/scripts/build_utg.py +123 -0
- package/skills/d2h-utg-ai-generate/scripts/capture_from_page_json.ts +280 -0
- package/skills/d2h-utg-ai-generate/scripts/utg_common.py +524 -0
- package/skills/d2h-utg-ai-generate/scripts/utg_html.py +489 -0
- package/skills/d2h-utg-ai-generate/scripts/validate_utg.py +69 -0
- package/skills/d2h-utg-ai-generate/scripts/vendor/D3-LICENSE +13 -0
- package/skills/d2h-utg-ai-generate/scripts/vendor/d3-7.9.0.min.js +2 -0
- package/skills/d2h-utg-ai-generate/tests/test_pipeline.py +369 -0
- package/skills/d2h-utg-static-generate/SKILL.md +73 -0
- package/skills/d2h-utg-static-generate/references/discoveries.md +38 -0
- package/skills/d2h-utg-static-generate/scripts/generate.py +499 -0
- package/skills/d2h-utg-static-generate/tests/test_static.py +335 -0
- package/skills/d2h-utg-static-generate/tests/verify-offline-html.py +60 -0
- package/skills/d2h-utg-static-generate/tests/verify-produced-fixture.py +131 -0
- package/skills/harmonyos-migration-playbook/SKILL.md +30 -3
- package/skills/harmonyos-migration-playbook/references/lesson-lifecycle.md +4 -4
- package/skills/harmonyos-migration-playbook/references/ui-automation.md +4 -3
- package/skills/harmonyos-migration-playbook/references/windows-environment.md +2 -2
- package/skills/maintaining-migration-report/SKILL.md +88 -99
- package/skills/maintaining-migration-report/references/final-acceptance.md +48 -0
- package/skills/maintaining-migration-report/references/source-provenance.md +66 -0
- package/skills/managing-d2h-toolchain/SKILL.md +23 -0
- package/skills/managing-d2h-toolchain/environment-requirements.json +16 -0
- package/skills/managing-d2h-toolchain/toolchain.json +16 -0
- package/skills/preparing-migration-workspace/SKILL.md +76 -69
- package/skills/preparing-migration-workspace/toolchain.json +0 -43
|
@@ -13,13 +13,12 @@ Use device automation as evidence, not as a substitute for understanding the UI.
|
|
|
13
13
|
Use the managed evidence commands for collection and packaging:
|
|
14
14
|
|
|
15
15
|
```text
|
|
16
|
-
droid2hmos evidence capture
|
|
17
|
-
droid2hmos evidence flow android <android-project> --name <name> [--task <task>]
|
|
16
|
+
droid2hmos evidence capture harmony <android-project> --name <name> [--target <id>]
|
|
18
17
|
droid2hmos evidence flow harmony <android-project> --name <name> (--class <class> [--case <case>] | --all)
|
|
19
18
|
droid2hmos evidence compare <android-project> --name <name> --android <android-evidence-dir> --harmony <harmony-evidence-dir>
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
`capture` collects the screenshot, UI tree/`dumpLayout`, and device logs. `flow` creates before/after captures around a
|
|
21
|
+
`capture` collects the screenshot, UI tree/`dumpLayout`, and device logs. `flow` creates before/after captures around a HarmonyOS Hypium test (Android-side flow has been removed with the Android runtime dependency). `compare` creates a dual-platform evidence record from existing evidence directories; it supports human review but does not by itself prove semantic equivalence. Preserve command output paths as report evidence.
|
|
23
22
|
|
|
24
23
|
For text input, verify focus and current value after each operation. A click can hit an input field or IME candidate and inject unintended text. Close the IME only with a method proven in the current environment.
|
|
25
24
|
|
|
@@ -39,6 +38,8 @@ White/non-white screenshot heuristics only detect gross rendering failures. They
|
|
|
39
38
|
|
|
40
39
|
## Prefer semantic Hypium UI tests over coordinate injection
|
|
41
40
|
|
|
41
|
+
> Update (2026-10): migration-flow Hypium test case creation and execution are now standardized on the Python-based `d2h-hypium-forge` pipeline (`.hypium_forge/` assets; iteration via its `run_direct.py`, managed acceptance via `droid2hmos test harmony --runner python --test-list ...`). The ArkTS `entry_test` module workflow below remains valid only as a project-verified lesson for existing ArkTS assets; the principle "semantic location over coordinate injection" and the exception boundaries continue to apply.
|
|
42
|
+
|
|
42
43
|
- **Evidence level:** project-validated
|
|
43
44
|
- **Applies when:** HarmonyOS user flows need repeatable device-side verification and the relevant ArkUI controls can expose semantic nodes. Verified with DevEco SDK 6.0.2(22) and `@ohos/hypium` 1.0.25; recheck APIs on other versions.
|
|
44
45
|
- **Symptom:** a migration relies on repeated coordinate-based device injection, requiring layout dumps and manual coordinate calculation at every step. Scrolling or layout changes cause misclicks, stale-frame dumps and evidence that cannot be replayed reliably.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Check actual paths rather than trusting environment variables:
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- JDK/DevEco SDK directories exist and match the invoked tool.
|
|
6
6
|
- Included Gradle builds have the local configuration they require.
|
|
7
7
|
- Proxy settings apply to Gradle/Node and do not unexpectedly intercept device or mail ports.
|
|
8
8
|
- Node/npm pairs come from compatible installations.
|
|
@@ -24,7 +24,7 @@ droid2hmos service start mock-server <PROJECT> --health-url <URL> -- <command> [
|
|
|
24
24
|
|
|
25
25
|
On Windows it asks `Win32_Process.Create` to create a short-lived host outside the command runner's process tree. The host starts the service with closed stdin and file-backed stdout/stderr, records the actual service PID, then exits. The outer launcher performs only a bounded health check and exits immediately after success.
|
|
26
26
|
|
|
27
|
-
Do not substitute `Start-Process`, a foreground server command, or a project-local `spawn(..., { detached: true }).unref()` launcher. If the system-level creation mechanism is unavailable,
|
|
27
|
+
Do not substitute `Start-Process`, a foreground server command, or a project-local `spawn(..., { detached: true }).unref()` launcher. If the system-level creation mechanism is unavailable, return a blocking external-service item in `unresolved`, put the manual start instruction in `suggestedRemediation`, and let the caller handle user coordination rather than risking an unbounded migration run.
|
|
28
28
|
|
|
29
29
|
## DevEco CLI login callback server lifecycle
|
|
30
30
|
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: maintaining-migration-report
|
|
3
|
-
description: Maintain the lightweight fact-linked migration ledger while
|
|
3
|
+
description: Maintain and validate the lightweight fact-linked Android-to-HarmonyOS migration ledger while implementation evidence is fresh. Record implementation files, Android source provenance, managed evidence, differences, discoveries, summary, and final-acceptance data without scheduling tests, regression, checkpoints, rendering, or completion.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Maintain the migration
|
|
6
|
+
# Maintain the migration ledger
|
|
7
7
|
|
|
8
|
-
The migration report is
|
|
8
|
+
The migration report is a verifiable ledger linked to deterministic facts, Android source, HarmonyOS implementation files, and managed evidence. It is not the authority for application behavior: current Android source and observable behavior remain authoritative, and Kernel validation remains authoritative for machine gates.
|
|
9
9
|
|
|
10
|
-
All `.migration/...` paths below live in the sibling migration workspace `<android-project>-migration/.migration/`
|
|
10
|
+
All `.migration/...` paths below live in the sibling migration workspace `<android-project>-migration/.migration/` created by the CLI, never inside the Android project.
|
|
11
|
+
|
|
12
|
+
## Scope and inputs
|
|
13
|
+
|
|
14
|
+
This Skill owns only:
|
|
15
|
+
|
|
16
|
+
- `report init`, `report update`, and `report validate`;
|
|
17
|
+
- recording analyzer omissions in `discoveries.json`;
|
|
18
|
+
- maintaining `summary.json`;
|
|
19
|
+
- writing `final-acceptance.json` from test results and managed evidence supplied by the caller.
|
|
20
|
+
|
|
21
|
+
For an update, accept the Android project root, report ref, requested status, real HarmonyOS implementation files, current Android source files, managed evidence paths, and any real difference or blocker. When the caller has a current Task/epoch, also accept its identifier and source closure so provenance can be reconciled with the exact implementation unit. Never replace these inputs with a prose summary.
|
|
22
|
+
|
|
23
|
+
Read [references/source-provenance.md](references/source-provenance.md) whenever an item becomes `implemented` or `verified`. Read [references/final-acceptance.md](references/final-acceptance.md) when maintaining final acceptance.
|
|
11
24
|
|
|
12
25
|
## Invariants
|
|
13
26
|
|
|
14
|
-
- Treat `.migration/spec/facts/` and `.migration/spec/index.json` as immutable analyzer output. Never edit them to make
|
|
15
|
-
- The JSON files under `.migration/report/` are lightweight overlays.
|
|
27
|
+
- Treat `.migration/spec/facts/` and `.migration/spec/index.json` as immutable analyzer output. Never edit them to make validation pass.
|
|
28
|
+
- The JSON files under `.migration/report/` are lightweight overlays. Preserve stable refs, fact labels, and control-entry ownership generated by the CLI.
|
|
16
29
|
- Do not edit `.migration/report/index.json` or `validation.json`; host scripts own indexes, hashes, counts, and validation output.
|
|
17
|
-
- A
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
30
|
+
- A mapping must name the concrete HarmonyOS file and symbol that performs the behavior. Imports, comments, ref strings, registries without executable wiring, generated hashes, stubs, and test-only symbols are not implementations.
|
|
31
|
+
- Compilation alone does not prove that a page, control, handler, navigation path, Dialog, or business function works.
|
|
32
|
+
- `implemented` and `verified` items require current Android `sourceProvenance`; a prose description or stale hash is insufficient.
|
|
33
|
+
- `verified` and passed final-acceptance tests require fresh Kernel-managed evidence. Never hand-write, copy, or modify receipts or archived artifacts.
|
|
34
|
+
- A receipt supports a ref only when `scope.coveredRefs` contains it, the structured result has a non-zero execution count with zero failures, errors, and ignored cases, the target matches, and archived artifacts pass integrity checks.
|
|
21
35
|
|
|
22
36
|
## Initialize and select work
|
|
23
37
|
|
|
@@ -27,129 +41,104 @@ Run once when no report exists:
|
|
|
27
41
|
droid2hmos report init <android-project>
|
|
28
42
|
```
|
|
29
43
|
|
|
30
|
-
Start from `.migration/report/index.json`. Select only the
|
|
44
|
+
Start from `.migration/report/index.json`. Select only the shards relevant to the caller's current implementation or review. Follow each shard's `factsFile`, then read the Android source named by the fact and current source closure. Read additional Android source when facts are ambiguous or may omit behavior.
|
|
31
45
|
|
|
32
|
-
## Update one
|
|
46
|
+
## Update one item
|
|
33
47
|
|
|
34
|
-
Update
|
|
48
|
+
Update while implementation and source context are fresh. Preserve `ref`, `kind`, `factLabel`, and `controlRef`. Maintain only:
|
|
35
49
|
|
|
36
|
-
- `status`: `pending`, `implemented`, `verified`, or `blocked
|
|
37
|
-
- `harmonyosFiles[]`: project-relative files
|
|
38
|
-
- `
|
|
39
|
-
- `
|
|
50
|
+
- `status`: `pending`, `implemented`, `verified`, or `blocked`;
|
|
51
|
+
- `harmonyosFiles[]`: project-relative files containing reachable implementation;
|
|
52
|
+
- `sourceProvenance[]`: current Android files and CLI-computed hashes;
|
|
53
|
+
- `testEvidence[]`: managed evidence whose `scope.coveredRefs` contains the ref;
|
|
54
|
+
- `difference`: `null` unless a real behavior difference or blocker exists.
|
|
40
55
|
|
|
41
|
-
Use the safe
|
|
56
|
+
Use the safe update interface:
|
|
42
57
|
|
|
43
58
|
```text
|
|
44
|
-
droid2hmos report update <android-project> --ref <ref> [--status <status>] [--harmony-file <path>...] [--evidence <path>...] [--difference <text>|--clear-difference]
|
|
59
|
+
droid2hmos report update <android-project> --ref <ref> [--status <status>] [--harmony-file <path>...] [--android-source <path>...] [--evidence <path>...] [--difference <text>|--clear-difference]
|
|
45
60
|
```
|
|
46
61
|
|
|
47
|
-
The command must resolve exactly one existing ref and
|
|
62
|
+
The command must resolve exactly one existing ref and validates project files and source membership before writing. Use `--android-source` for every Android file that informed the implementation. If a current Task/epoch source closure exists, reconcile it before update; a closure member that affects the behavior but is absent from `sourceProvenance` is unresolved, not silently ignored.
|
|
48
63
|
|
|
49
64
|
Use statuses strictly:
|
|
50
65
|
|
|
51
|
-
- `pending`: not implemented
|
|
52
|
-
- `implemented`:
|
|
53
|
-
- `verified`:
|
|
54
|
-
- `blocked`:
|
|
66
|
+
- `pending`: not implemented;
|
|
67
|
+
- `implemented`: reachable implementation and source provenance exist, but item-specific runtime verification is incomplete;
|
|
68
|
+
- `verified`: implementation, provenance, and relevant managed evidence all exist and validate;
|
|
69
|
+
- `blocked`: implementation or verification is impossible for the concrete reason in `difference`.
|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
If evidence is missing or invalid, keep the item at `implemented` (or `blocked` when appropriate) and return a verification request. Do not run a targeted test or full regression from this Skill.
|
|
57
72
|
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
"ref": "interaction.open-settings",
|
|
61
|
-
"kind": "interaction",
|
|
62
|
-
"factLabel": "打开设置页",
|
|
63
|
-
"status": "verified",
|
|
64
|
-
"harmonyosFiles": ["ohos/entry/src/main/ets/pages/MainActivity.ets"],
|
|
65
|
-
"testEvidence": [".migration/evidence/managed/test-harmony-targeted-<fingerprint>.json"],
|
|
66
|
-
"difference": null
|
|
67
|
-
}
|
|
68
|
-
```
|
|
73
|
+
## Record analyzer omissions
|
|
69
74
|
|
|
70
|
-
|
|
75
|
+
When Android source proves that deterministic facts missed a page, control, entry, interaction, or business feature, append a semantic record to `.migration/report/discoveries.json`. Include a unique `discovered.*` ref, kind, concise label, Android source evidence, implementation files, status, test evidence, and optional difference. Do not inject it into immutable facts.
|
|
71
76
|
|
|
72
|
-
|
|
77
|
+
Validate immediately after changing discoveries. A discovery is not automatically verified merely because its file exists.
|
|
73
78
|
|
|
74
|
-
|
|
79
|
+
## Maintain final acceptance
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
Only write final-acceptance results supplied by the caller from a real managed test run. Follow [references/final-acceptance.md](references/final-acceptance.md). This Skill checks schema, stable refs, `coveredRefs`, receipt freshness and integrity, and consistency between test status and blockers.
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
It does not decide when application-wide regression should run, choose or expand its scope, execute the suite, or decide whether the workflow may advance.
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
droid2hmos report validate <android-project>
|
|
82
|
-
```
|
|
85
|
+
## Maintain the user summary
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
`summary.json` is the only free-form user summary. Keep it concise and limited to:
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
- `summary`: what has been migrated and what the validated evidence supports;
|
|
90
|
+
- `incomplete`: remaining behavior, why it remains, and user impact;
|
|
91
|
+
- `nextSteps`: concrete work still required;
|
|
92
|
+
- optional `additionalSections` for meaningful platform differences, risks, or usage notes.
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
droid2hmos test harmony <android-project> --all --target <device-id> --ref <report-ref> [--ref <report-ref>...]
|
|
90
|
-
```
|
|
94
|
+
Before updating the summary, run `report validate` and read `.migration/report/validation.json`. The prose must agree with that machine result:
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
- if validation says the ledger is incomplete or final acceptance is not passed, describe it as partial/incomplete;
|
|
97
|
+
- do not relabel pending or blocked behavior as harmless without a recorded decision;
|
|
98
|
+
- do not duplicate calculated counts, mappings, test inventories, or blocker lists owned by the renderer;
|
|
99
|
+
- do not add fields outside the current summary or final-acceptance schemas.
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
{
|
|
96
|
-
"reportShardVersion": "1.2.0",
|
|
97
|
-
"kind": "final-acceptance",
|
|
98
|
-
"status": "passed",
|
|
99
|
-
"tests": [
|
|
100
|
-
{
|
|
101
|
-
"ref": "acceptance.create-note-from-launcher",
|
|
102
|
-
"name": "从启动页进入首页并完成新增笔记",
|
|
103
|
-
"status": "passed",
|
|
104
|
-
"evidence": [".migration/evidence/managed/test-harmony-all-<fingerprint>.json"]
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
"blockers": [],
|
|
108
|
-
"notes": ["在 HarmonyOS 模拟器上从真实应用入口验证"]
|
|
109
|
-
}
|
|
110
|
-
```
|
|
101
|
+
## Validate and return
|
|
111
102
|
|
|
112
|
-
|
|
103
|
+
After every semantic update, run:
|
|
113
104
|
|
|
114
105
|
```text
|
|
115
|
-
droid2hmos
|
|
106
|
+
droid2hmos report validate <android-project>
|
|
116
107
|
```
|
|
117
108
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
## Generate the user-facing report
|
|
121
|
-
|
|
122
|
-
The JSON shards are the machine-verifiable ledger, not the user deliverable. After validation, generate the Chinese HTML report entirely from the ledger and deterministic facts:
|
|
123
|
-
|
|
124
|
-
Before final rendering, fill `.migration/report/summary.json`. This is the only free-form user summary. Keep it useful and concise; it has only three mandatory questions:
|
|
109
|
+
Return the validation result without converting failure into success. `valid: true, complete: false` is acceptable during migration and does not authorize a completion claim.
|
|
125
110
|
|
|
126
|
-
|
|
127
|
-
- `incomplete`: What remains incomplete, why, and what is its user impact? Use an empty array only when nothing remains.
|
|
128
|
-
- `nextSteps`: What must the user do next? Use an empty array when no action is needed.
|
|
129
|
-
|
|
130
|
-
`additionalSections` is optional. Use it freely for meaningful information such as important platform differences, migration highlights, risks, or usage notes. Do not manually repeat counts, page lists, mappings, tests, or blockers that the renderer derives from the ledger.
|
|
131
|
-
|
|
132
|
-
Before writing the summary, run `report validate` and read `.migration/report/validation.json`. The summary must agree with the machine result:
|
|
133
|
-
|
|
134
|
-
- If `complete` is false or final acceptance is not `passed`, explicitly call the result partial/incomplete and never say “fully migrated”, “complete”, “all implemented”, or “zero remaining”.
|
|
135
|
-
- Describe unresolved and blocked behavior as incomplete when it has observable user impact. Do not relabel pending analyzer findings as harmless without recording a decision in `unresolved.json`.
|
|
136
|
-
- Do not copy calculated counts into prose. The renderer owns counts, percentages, completion state, and the technical incomplete inventory.
|
|
137
|
-
- `final-acceptance.json` contains only the documented fields. Blockers and notes are concise strings; do not add run IDs, commit hashes, nested blocker objects, or alternative legacy fields.
|
|
111
|
+
Return a structured result:
|
|
138
112
|
|
|
139
113
|
```json
|
|
140
114
|
{
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
|
|
146
|
-
]
|
|
115
|
+
"status": "completed | partial | failed",
|
|
116
|
+
"changedFiles": [],
|
|
117
|
+
"sourceFiles": [],
|
|
118
|
+
"evidence": [],
|
|
119
|
+
"domainChecks": [],
|
|
120
|
+
"unresolved": [],
|
|
121
|
+
"verificationRequests": [],
|
|
122
|
+
"suggestedRemediation": [],
|
|
123
|
+
"details": {
|
|
124
|
+
"updatedRefs": [],
|
|
125
|
+
"validation": {},
|
|
126
|
+
"taskId": null,
|
|
127
|
+
"epochId": null
|
|
128
|
+
}
|
|
147
129
|
}
|
|
148
130
|
```
|
|
149
131
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
132
|
+
`status` describes ledger maintenance only. It does not mean regression passed or migration completed. Missing provenance, invalid receipts, closure mismatches, schema failures, and report gaps belong in `unresolved`; requested test or review work belongs in `verificationRequests`.
|
|
133
|
+
|
|
134
|
+
## Boundaries
|
|
135
|
+
|
|
136
|
+
This Skill never:
|
|
137
|
+
|
|
138
|
+
- decides when targeted tests or full regression run;
|
|
139
|
+
- calls `droid2hmos test`, `checkpoint create`, `complete`, or `report render`;
|
|
140
|
+
- changes test scope or marks a failed, ignored, zero-execution, stale, or damaged result as passed;
|
|
141
|
+
- decides an outer workflow state or announces migration completion;
|
|
142
|
+
- uses report field completeness to override Android source, observable behavior, or Kernel denial.
|
|
154
143
|
|
|
155
|
-
|
|
144
|
+
The caller owns workflow transitions, test execution, checkpoint timing, completion gates, visual/business judgment, and final report delivery.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Final acceptance ledger contract
|
|
2
|
+
|
|
3
|
+
`final-acceptance.json` records application-wide test results already produced by the caller. It does not schedule regression and does not decide that migration is complete.
|
|
4
|
+
|
|
5
|
+
## Required shape
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"reportShardVersion": "1.2.0",
|
|
10
|
+
"kind": "final-acceptance",
|
|
11
|
+
"status": "pending | passed | failed",
|
|
12
|
+
"tests": [
|
|
13
|
+
{
|
|
14
|
+
"ref": "acceptance.create-note-from-launcher",
|
|
15
|
+
"name": "从启动页进入首页并完成新增笔记",
|
|
16
|
+
"status": "passed | failed",
|
|
17
|
+
"evidence": [".migration/evidence/managed/test-harmony-all-<fingerprint>.json"]
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"blockers": [],
|
|
21
|
+
"notes": []
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Only these fields are allowed by `schemas/final-acceptance.schema.json`. `blockers` and `notes` are concise strings; do not add run IDs, commit hashes, nested blocker objects, or legacy aliases.
|
|
26
|
+
|
|
27
|
+
## Inputs from the caller
|
|
28
|
+
|
|
29
|
+
The caller supplies:
|
|
30
|
+
|
|
31
|
+
- the managed receipt from the application-wide suite it chose to run;
|
|
32
|
+
- the exact stable refs actually asserted by that suite;
|
|
33
|
+
- the structured execution totals and target device;
|
|
34
|
+
- any failed scenarios or external blockers;
|
|
35
|
+
- concise notes supported by observation.
|
|
36
|
+
|
|
37
|
+
Do not add every report ref to make coverage appear complete. A receipt may support only refs in its actual `scope.coveredRefs`.
|
|
38
|
+
|
|
39
|
+
## Recording rules
|
|
40
|
+
|
|
41
|
+
- Each test has a stable, unique, non-empty `ref` and a user-readable `name`.
|
|
42
|
+
- A `passed` test has at least one fresh managed receipt whose `scope.coveredRefs` contains that exact ref.
|
|
43
|
+
- The structured result must report a non-zero execution count and zero failures, errors, and ignored cases.
|
|
44
|
+
- The receipt must match current HarmonyOS source, facts and target device, and every archived artifact must pass size and SHA-256 checks.
|
|
45
|
+
- `status: passed` is invalid when tests are empty, any test failed, evidence is stale or damaged, coverage is absent, or blockers remain.
|
|
46
|
+
- When evidence is missing or invalid, record `pending` or `failed` according to observed results and return the gap; never synthesize a pass.
|
|
47
|
+
|
|
48
|
+
After writing, run `droid2hmos report validate <android-project>` and return its result unchanged. The caller, not this Skill, decides workflow state, runs any additional regression, invokes completion gates, and renders or delivers the final report.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Android source provenance
|
|
2
|
+
|
|
3
|
+
Use this contract whenever a report item becomes `implemented` or `verified`. Provenance binds a claim to current Android source; it does not prove runtime behavior and does not by itself prove that source was read before target code was written.
|
|
4
|
+
|
|
5
|
+
## Required inputs
|
|
6
|
+
|
|
7
|
+
For each report ref collect:
|
|
8
|
+
|
|
9
|
+
- the Android project root and exact report ref;
|
|
10
|
+
- every Android source file that informed the behavior, including manifests, Kotlin/Java, XML and relevant resources;
|
|
11
|
+
- the real HarmonyOS implementation files;
|
|
12
|
+
- the current Task and epoch identifiers when the caller has them;
|
|
13
|
+
- the current Task source closure, when available.
|
|
14
|
+
|
|
15
|
+
A prose summary, fact label, earlier report, or generated plan can help locate source but cannot replace current files.
|
|
16
|
+
|
|
17
|
+
## Safe update
|
|
18
|
+
|
|
19
|
+
Use the CLI so it verifies source membership and computes hashes:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
droid2hmos report update <android-project> \
|
|
23
|
+
--ref <report-ref> \
|
|
24
|
+
--status implemented \
|
|
25
|
+
--harmony-file <harmony-file> \
|
|
26
|
+
--android-source <android-file> \
|
|
27
|
+
[--android-source <android-file>...]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`--android-source` records whole-file provenance. Prefer whole files when a symbol cannot be located deterministically. If the active host provides a schema-aware way to record precise ranges, every range must include `symbol`, `startLine`, and `endLine` and must satisfy `migration-report-item.schema.json`; do not bypass the safe update path with an ad hoc report edit.
|
|
31
|
+
|
|
32
|
+
## Source-closure reconciliation
|
|
33
|
+
|
|
34
|
+
When a current Task/epoch source closure exists:
|
|
35
|
+
|
|
36
|
+
1. compare its members with the Android files actually read for the behavior;
|
|
37
|
+
2. include every behavior-relevant member in `--android-source`;
|
|
38
|
+
3. treat a newly discovered relevant file as a closure/epoch issue for the caller to resolve;
|
|
39
|
+
4. do not silently add an unrelated file merely to satisfy a count;
|
|
40
|
+
5. do not mark the item `implemented` or `verified` while a relevant closure member is missing from provenance.
|
|
41
|
+
|
|
42
|
+
`report validate` generates `.migration/audit/android-source-manifest.json` and checks managed file membership and hashes. When a Task Plan is available it also reconciles report provenance with the plan's source closure.
|
|
43
|
+
|
|
44
|
+
## Evidence levels
|
|
45
|
+
|
|
46
|
+
- `declared-hash-validated`: the declared file is in the managed Android project and its SHA-256 matches the current file. This is the normal CLI guarantee.
|
|
47
|
+
- `observed-order-audited`: available only when a trusted host/runner supplies ordered Read/Write events for the same session and epoch and D1 passes.
|
|
48
|
+
- `enforced-prewrite`: not provided by the current CLI; ordinary writes are not intercepted before they occur.
|
|
49
|
+
|
|
50
|
+
Project-created `.migration/audit/source-events.jsonl` is not a trusted event source and must not upgrade the evidence level.
|
|
51
|
+
|
|
52
|
+
## D1 and D2 audits
|
|
53
|
+
|
|
54
|
+
D1 writes `.migration/audit/source-order-audit.json`:
|
|
55
|
+
|
|
56
|
+
- `passed`: trusted events show declared Android reads before the first target write in the same session/epoch;
|
|
57
|
+
- `red-flag`: reads are missing, late, concurrent in an invalid action group, malformed, or inconsistent; report validation fails;
|
|
58
|
+
- `unavailable`: no trusted event source exists; hash evidence remains usable, but read-before-write must not be claimed.
|
|
59
|
+
|
|
60
|
+
D2 writes `.migration/audit/literal-drift-audit.json`. It deterministically samples up to five implemented/verified refs and compares selected strings, colors, values and simple conditions. D2 warnings require source and behavior review; they are not automatic failures because i18n, resource renaming, unit conversion, theming, and equivalent refactors can be valid.
|
|
61
|
+
|
|
62
|
+
## Existing reports
|
|
63
|
+
|
|
64
|
+
`report init` upgrades supported older reports by adding empty `sourceProvenance` arrays without fabricating history. Existing `implemented` or `verified` claims remain invalid until current Android sources are declared and validation passes.
|
|
65
|
+
|
|
66
|
+
Return provenance or closure gaps to the caller as `unresolved`. This Skill does not create a checkpoint or invoke completion after provenance validation.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: managing-d2h-toolchain
|
|
3
|
+
description: 安装、检查或升级 D2H 所依赖的 AppGraph 与 droid2hmos CLI 时使用。统一读取 D2H 包内的精确版本锁,保留本地 npm link,并把安装结果交还迁移主流程;其他 Skill 不执行工具安装。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 管理 D2H 工具链
|
|
7
|
+
|
|
8
|
+
本 Skill 是 AppGraph、droid2hmos 依赖声明、版本维护和安装的唯一流程入口。**依赖包、精确版本及命令能力只在本目录的 `toolchain.json` 声明**;`environment-requirements.json` 提供对应的主机检查边界。其他 Agent/Skill 不声明这些依赖或版本,也不执行 npm 安装或升级。`d2h` CLI 只解析本 Skill 的清单并实现确定性的探测、安装和校验;本 Skill 负责选择时机、目标 Agent 和失败分流。
|
|
9
|
+
|
|
10
|
+
## 选择 D2H 版本
|
|
11
|
+
|
|
12
|
+
- 已安装的 OpenCode/DevEco 定义读取配置根目录的 `.d2h-installation.json`;VS Code 定义读取扩展 `resources/opencode/plugin/d2h/.d2h-installation.json`。其中的 `packageVersion` 是本次调用 D2H CLI 的精确版本。
|
|
13
|
+
- `d2h` 命令可用时先执行 `d2h --help`,确认支持 `install`、`upgrade`、`doctor`。需要通过 npx 调用时使用 `npx --yes @harmonyos-arkts/d2h@<packageVersion>`;Windows 使用 `npx.cmd`。不可用或记录缺失时,请调用方提供已批准的**精确 D2H 版本**完成首次安装,不猜测 `latest`。
|
|
14
|
+
- 源码开发使用当前仓库构建出的 `node dist/bin/install-opencode.js`,不要把 npm 上同版本的旧包误当成本地源码。修改 D2H 依赖版本时只改包内 `skills/managing-d2h-toolchain/toolchain.json`,同时更新环境约束、兼容性测试和发布版本。
|
|
15
|
+
|
|
16
|
+
## 检查与执行
|
|
17
|
+
|
|
18
|
+
1. 确定目标 `--agent opencode|deveco|vscode`;VS Code 可通过 `--extension-dir` 指定扩展根目录。先运行 `d2h upgrade --check --agent <agent>` 只读预览,再运行 `d2h doctor --agent <agent>` 检查定义完整性、精确版本、命令能力与主机环境。
|
|
19
|
+
2. 若缺少定义或受管 CLI,运行 `d2h install --agent <agent>`;已安装但需要应用当前锁定组合时运行 `d2h upgrade --agent <agent>`。开发者的 npm link 不被覆盖:遇到 link 冲突,返回具体路径并等待维护者显式处理。
|
|
20
|
+
3. 安装后重新运行 `doctor`,核对 `.d2h-installation.json`、AppGraph/droid2hmos 的版本及能力,再把状态交给 `preparing-migration-workspace`。项目级 `droid2hmos preflight` 仍由准备 Skill 执行。
|
|
21
|
+
4. 只想检查主机工具时使用 `d2h --check-env --output-dir <目录>`;读取生成的 JSON/Markdown 报告,不把 DevEco 登录、SDK 或设备缺失误判为需要升级 AppGraph/droid2hmos。
|
|
22
|
+
|
|
23
|
+
安装失败时保留命令输出和失败阶段。包不可达、版本不匹配、能力不符分别报告;不得把失败掩盖成“使用已安装版本继续”。不允许在其他 Skill 中直接执行 `npm install -g`、`npm update` 或以浮动版本重新安装这两个 CLI。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"tools": {
|
|
4
|
+
"node": { "minimum": "22.5.0", "maximumExclusive": "25.0.0" },
|
|
5
|
+
"python": { "minimum": "3.10.0" },
|
|
6
|
+
"git": null,
|
|
7
|
+
"npm": null,
|
|
8
|
+
"java": null,
|
|
9
|
+
"python-json5": null,
|
|
10
|
+
"appgraph": { "minimum": "0.0.10", "maximumExclusive": "0.0.11" },
|
|
11
|
+
"droid2hmos": { "minimum": "0.0.11", "maximumExclusive": "0.0.12" },
|
|
12
|
+
"hvigor": null,
|
|
13
|
+
"ohpm": null,
|
|
14
|
+
"devecocli": null
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"node": { "minimum": "22.5.0", "maximumExclusive": "25.0.0" },
|
|
4
|
+
"tools": {
|
|
5
|
+
"appgraph": {
|
|
6
|
+
"package": "@harmonyos-arkts/appgraph",
|
|
7
|
+
"version": "0.0.10",
|
|
8
|
+
"capabilities": { "build-android": ["build", "--help"], "spec-analysis": ["spec-analysis", "--help"] }
|
|
9
|
+
},
|
|
10
|
+
"droid2hmos": {
|
|
11
|
+
"package": "@harmonyos-arkts/droid2hmos",
|
|
12
|
+
"version": "0.0.11",
|
|
13
|
+
"capabilities": { "analyze-android": ["--help"], "preflight": ["--help"], "status": ["--help"] }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|