@harmonyos-arkts/d2h 0.1.1 → 0.1.3
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 +2 -2
- package/agents/android-to-hmos-00-orchestrator.md +1 -1
- package/agents/d2h.md +1 -1
- package/agents/d2h_v2.md +351 -0
- package/dist/bin/install-opencode.js +60 -0
- package/dist/src/install-opencode.js +135 -0
- package/package.json +51 -45
- package/skills/android2hmos_resources_convert/SKILL.md +37 -19
- package/skills/appgraph-rule-audit/SKILL.md +24 -5
- 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/windows-environment.md +1 -1
- 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/preparing-migration-workspace/SKILL.md +72 -67
- package/skills/preparing-migration-workspace/toolchain.json +1 -25
- package/bin/install-opencode.mjs +0 -57
- package/src/install-opencode.mjs +0 -110
|
@@ -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.
|
|
@@ -1,124 +1,129 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: preparing-migration-workspace
|
|
3
|
-
description: 在 Android 转 HarmonyOS 迁移开始或恢复时,通过 droid2hmos
|
|
3
|
+
description: 在 Android 转 HarmonyOS 迁移开始或恢复时,通过 droid2hmos 读取状态、执行 Preflight、初始化或校验配置,并采集设备与外部环境就绪度。只负责工作区准备和能力分流;不调度分析、实现、构建、测试、回归或 Git checkpoint。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 准备迁移工作区
|
|
7
7
|
|
|
8
|
-
本 Skill
|
|
8
|
+
本 Skill 只负责回答四个问题:项目和迁移工作区是否定位正确、非设备基线是否可用、设备是否可用、哪些外部条件仍阻塞特定能力。它不决定后续状态,也不把设备失败扩大为整个迁移停止。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
只调用 `droid2hmos` 的 `status`、`preflight`、`config init/validate` 和按需的 `device check`。不要直接调用 Node 脚本、Gradle、Hvigor、Hypium、ADB、HDC 或 AppGraph 分析命令,也不要在 `ohos/` 尚不存在时猜测 HarmonyOS 构建配置。
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
迁移产物(`.migration/`)统一位于 Android 工程父目录下的 `<工程名>-migration/.migration/`,由 CLI 创建和维护,不写入 Android 工程内部。下文所有 `.migration/...` 路径均相对该迁移工作区根目录。
|
|
13
|
+
|
|
14
|
+
## 输入与事实来源
|
|
15
|
+
|
|
16
|
+
输入必须包含 Android Gradle 工程根目录。根目录应有 Gradle 标记,应用模块中应有 `AndroidManifest.xml`。
|
|
17
|
+
|
|
18
|
+
开始或恢复时先获取只读快照:
|
|
13
19
|
|
|
14
20
|
```text
|
|
15
21
|
droid2hmos status <ANDROID_PROJECT>
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
以 CLI 返回的 `workspace`、`allowedActions`、`completion.unmet`、Preflight 检查项、`failedChecks` 和 `retry` 为机器事实。`phase` 只解释当前现场;不得创建或编辑 `.migration/state.json`。
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
如果 `workspace.projectPresent=false` 且 `workspace.projectCandidates` 非空,说明传入的是包装目录。改用列出的明确候选工程,不得在包装目录初始化第二套迁移工作区或 HarmonyOS 工程。
|
|
21
27
|
|
|
22
|
-
##
|
|
28
|
+
## 首次准备
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
运行统一预检:
|
|
25
31
|
|
|
26
32
|
```text
|
|
27
33
|
droid2hmos preflight <ANDROID_PROJECT> [--sdk-path <PATH>] [--timeout-ms <MS>]
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
`preflight`
|
|
36
|
+
`preflight` 由 Kernel 选择并判定检查项,可能包含:
|
|
31
37
|
|
|
32
38
|
- Android UI 技术栈支持性;
|
|
33
|
-
- Git 仓库、分支、`HEAD`
|
|
34
|
-
- Git、Node.js
|
|
35
|
-
-
|
|
39
|
+
- Git 仓库、分支、`HEAD` 和用户已有改动;
|
|
40
|
+
- Git、Node.js、npm、Python、JDK、Android SDK、DevEco 和 HarmonyOS SDK;
|
|
41
|
+
- AppGraph 健康检查;
|
|
36
42
|
- `.migration/config.json` 初始化和校验;
|
|
37
|
-
- Android
|
|
38
|
-
- 已有 HarmonyOS
|
|
39
|
-
-
|
|
43
|
+
- Android 基线状态;
|
|
44
|
+
- 已有 HarmonyOS 工程复用,或在空目标中创建工程壳;
|
|
45
|
+
- Preflight 自身所需的基线构建和设备检查;
|
|
40
46
|
- `.migration/preflight-report.json` 原子生成。
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
环境类门禁(`toolchain`、`devecocli-auth`、`appgraph`、`harmony-sdk`、`harmony-device`)只探测一次:它们依赖本机工具、华为账号授权或物理设备,原样重跑 `preflight` 不会自愈。这类失败会返回 `retry.kind=external` 且带 `remediation`;必须把 `remediation` 明确转述给用户、等待用户修改环境,不得在同一环境下连续重跑 `preflight`。其余(非环境类)失败在按 `retry` 指引改变输入后重跑。
|
|
45
|
-
|
|
46
|
-
本 Skill 不单独定义或重算任何子检查门禁。命令成功且报告总体结果为 `passed` 时继续。
|
|
48
|
+
这些是 Preflight 的内部门禁,不授权本 Skill 在预检后继续调度仓库级构建、测试或分析。已有 HarmonyOS 工程不得被覆盖;只校验现有工程且不允许初始化工程壳时使用 `--no-init-harmony`。
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
命令失败时读取 `failedChecks`、`retry` 和对应日志:
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
- `retry.kind=transient/bounded`:只在返回的上限内原样重试;
|
|
53
|
+
- `retry.kind=external`:记录为外部阻塞项并返回具体 `remediation`,不要在环境未变化时连续重跑;
|
|
54
|
+
- 其他失败:返回受影响能力和补救建议,不自行推断绕过方式。
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
- 语言数 = 1:也须在写入首个字符串资源前加载 `arkts-i18n` 确认资源组织方式;
|
|
54
|
-
- 任何情况下不得把用户可见文案硬编码进页面代码来替代字符串资源迁移。
|
|
56
|
+
不要把 `preflight` 非零退出一概解释为“迁移不能继续”。例如 HarmonyOS 设备不可用只阻止设备测试、运行态验收和依赖设备的证据采集;当 `allowedActions` 仍允许时,源码阅读、静态分析和非设备实现可以继续。反之,工程定位、配置或必要工具链缺失可能使 `allowedNonDeviceWork=false`。最终分流必须忠实反映本次 CLI 快照。
|
|
55
57
|
|
|
56
|
-
##
|
|
58
|
+
## 配置
|
|
57
59
|
|
|
58
|
-
需要显式提供项目特有的 Android
|
|
60
|
+
需要显式提供项目特有的 Android 命令或 HarmonyOS 工程路径时使用:
|
|
59
61
|
|
|
60
62
|
```text
|
|
61
63
|
droid2hmos config init <ANDROID_PROJECT> [--harmony-project <PATH>] [--android-build <COMMAND>] [--android-test <COMMAND>]
|
|
62
64
|
droid2hmos config validate <ANDROID_PROJECT>
|
|
63
65
|
```
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`androidBuild` 默认为 null:迁移流程不编译 Android 工程,`analyze android` 是纯源码静态分析且不要求 APK。只有用户明确要求 Android/HarmonyOS 双端运行对照时,才通过 `--android-build` 显式配置构建命令;未配置时执行 `droid2hmos build android` 会返回引导提示而非自动探测。
|
|
68
|
-
|
|
69
|
-
在首次 Preflight 之后需要针对性诊断或验证时使用:
|
|
70
|
-
|
|
71
|
-
```text
|
|
72
|
-
droid2hmos build <android|harmony|all> <ANDROID_PROJECT> [--timeout-ms <MS>]
|
|
73
|
-
droid2hmos test android <ANDROID_PROJECT> [--task <TASK>] [--timeout-ms <MS>]
|
|
74
|
-
droid2hmos test harmony <ANDROID_PROJECT> (--class <CLASS> [--case <CASE>] | --all) [--target <DEVICE>] [--case-timeout-ms <MS>] [--ref <REPORT_REF>...]
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Android 测试只有在 `.migration/config.json` 已声明可执行的 `androidTest` 时运行。HarmonyOS 测试只有在已有 Hypium 测试资产时运行;没有测试资产时记录缺口,并在第一个可交互功能验收前建立。多个 HDC 目标可响应时必须显式传 `--target`,防止证据偶然落在另一台设备。`--case-timeout-ms` 控制单个 Hypium 用例超时,`--ref` 只声明该测试实际断言的报告项。CLI 会解析 Hypium 摘要:失败、错误、忽略、零执行或缺少摘要即使 HDC 退出码为零也视为失败。
|
|
78
|
-
|
|
79
|
-
Hvigor 返回成功但没有刷新输出时,CLI 只复用不早于各自构建输入的既有应用/ohosTest HAP;应用源码变化只要求应用 HAP 更新,不会强制无关的 ohosTest HAP 重打。产物比对应源码或构建配置旧时必须失败并要求修复构建,而不是安装过期包。
|
|
80
|
-
|
|
81
|
-
## 分析与设备诊断
|
|
67
|
+
配置中只保存能够确认的路径和 Android 侧有限命令。不得保存或猜测 `harmonyBuild`、`harmonyTest`、module、product 或 target;HarmonyOS 参数由 CLI 从真实工程配置解析。
|
|
82
68
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```text
|
|
86
|
-
droid2hmos analyze <android|harmony|all> <ANDROID_PROJECT>
|
|
87
|
-
```
|
|
69
|
+
`androidBuild` 默认为 `null`。只有用户明确要求 Android/HarmonyOS 双端运行对照时,才记录用户提供的 Android 构建命令;本 Skill 不执行该命令。
|
|
88
70
|
|
|
89
|
-
|
|
71
|
+
## 设备状态采集
|
|
90
72
|
|
|
91
|
-
|
|
73
|
+
当现有 Preflight 报告缺少当前设备状态,或调用方明确需要刷新设备状态时,可运行:
|
|
92
74
|
|
|
93
75
|
```text
|
|
94
76
|
droid2hmos device check <android|harmony>
|
|
95
77
|
```
|
|
96
78
|
|
|
97
|
-
|
|
79
|
+
只记录设备发现、Shell 响应、目标歧义和返回的 remediation。多个目标、认证、签名或设备离线问题进入 `externalBlockers` 或 `capabilityBlockers`,由调用方决定何时处理。本 Skill 不因设备问题暂停并要求用户作流程选择。
|
|
98
80
|
|
|
99
|
-
##
|
|
81
|
+
## 恢复
|
|
100
82
|
|
|
101
|
-
|
|
83
|
+
恢复时不得重新初始化已有 `ohos/`。运行:
|
|
102
84
|
|
|
103
85
|
```text
|
|
104
86
|
droid2hmos status <ANDROID_PROJECT>
|
|
105
|
-
droid2hmos checkpoint status <ANDROID_PROJECT>
|
|
106
87
|
droid2hmos config validate <ANDROID_PROJECT>
|
|
107
88
|
```
|
|
108
89
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
仅当工具链、配置、工程壳或设备环境可能变化,或 CLI 明确要求刷新 Preflight 时,重新运行 `preflight`。不要在这里检查或创建 checkpoint,也不要补跑 `analyze`、`build`、`test` 或全量回归;这些属于调用方根据当前工作单元和状态决定的后续动作。
|
|
91
|
+
|
|
92
|
+
不得处理、覆盖、提交或删除用户已有改动。
|
|
93
|
+
|
|
94
|
+
## 结构化结果
|
|
95
|
+
|
|
96
|
+
始终返回同一就绪度结构:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"baselineReady": true,
|
|
101
|
+
"deviceReady": false,
|
|
102
|
+
"externalBlockers": [],
|
|
103
|
+
"capabilityBlockers": [
|
|
104
|
+
{
|
|
105
|
+
"capability": "device-validation",
|
|
106
|
+
"check": "harmony-device",
|
|
107
|
+
"reason": "no responsive target",
|
|
108
|
+
"remediation": "connect or start one HarmonyOS target"
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"allowedNonDeviceWork": true,
|
|
112
|
+
"allowedActions": [],
|
|
113
|
+
"evidence": [".migration/preflight-report.json"],
|
|
114
|
+
"suggestedRemediation": []
|
|
115
|
+
}
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
## 继续条件
|
|
118
|
+
字段语义:
|
|
120
119
|
|
|
121
|
-
- `
|
|
122
|
-
-
|
|
120
|
+
- `baselineReady`:工程定位、迁移配置和非设备基础能力是否足以支持 CLI 明确允许的后续工作;不能仅用 Preflight 总体退出码代替;
|
|
121
|
+
- `deviceReady`:当前 HarmonyOS 目标是否满足设备类工作要求;
|
|
122
|
+
- `externalBlockers`:需要用户、账号、签名、物理设备或外部环境变化的阻塞项;
|
|
123
|
+
- `capabilityBlockers`:按能力说明阻塞范围,不能写成笼统的“迁移停止”;
|
|
124
|
+
- `allowedNonDeviceWork`:当前是否仍可继续源码阅读、静态分析或非设备实现;
|
|
125
|
+
- `allowedActions`:原样返回 CLI 快照中的允许动作;
|
|
126
|
+
- `evidence`:本次读取或生成的状态、配置和 Preflight 报告;
|
|
127
|
+
- `suggestedRemediation`:CLI 给出的可执行补救,不臆造成功结论。
|
|
123
128
|
|
|
124
|
-
|
|
129
|
+
本 Skill 不推进外部状态机、不更新迁移报告、不创建 checkpoint、不调用 `complete`,也不决定定向测试或全量回归。调用方根据上述结果决定下一步。
|
|
@@ -4,34 +4,10 @@
|
|
|
4
4
|
"preflight": ["preflight"],
|
|
5
5
|
"requiredCapabilities": [
|
|
6
6
|
"status",
|
|
7
|
-
"complete",
|
|
8
7
|
"config init",
|
|
9
8
|
"config validate",
|
|
10
|
-
"checkpoint status",
|
|
11
|
-
"checkpoint create",
|
|
12
|
-
"build android",
|
|
13
|
-
"build harmony",
|
|
14
|
-
"test android",
|
|
15
|
-
"test harmony",
|
|
16
9
|
"device check android",
|
|
17
|
-
"device check harmony"
|
|
18
|
-
"analyze android",
|
|
19
|
-
"analyze harmony",
|
|
20
|
-
"evidence capture",
|
|
21
|
-
"evidence flow",
|
|
22
|
-
"evidence compare",
|
|
23
|
-
"report init",
|
|
24
|
-
"report update",
|
|
25
|
-
"report validate",
|
|
26
|
-
"report render",
|
|
27
|
-
"mock init",
|
|
28
|
-
"service start",
|
|
29
|
-
"service status",
|
|
30
|
-
"service stop",
|
|
31
|
-
"logs list",
|
|
32
|
-
"logs show",
|
|
33
|
-
"logs failures",
|
|
34
|
-
"logs stats"
|
|
10
|
+
"device check harmony"
|
|
35
11
|
]
|
|
36
12
|
},
|
|
37
13
|
"appgraph": {
|