@harmonyos-arkts/d2h 0.1.29 → 0.1.32
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/.claude-plugin/plugin.json +1 -1
- package/README.md +6 -2
- package/agents/d2h.md +23 -14
- package/dist/bin/install-opencode.js +17 -4
- package/dist/src/install-opencode.js +6 -4
- package/dist/src/install-tui-extension.js +1 -1
- package/dist/src/metrics-plugin.js +4 -3
- package/dist/src/poc.js +53 -0
- package/docs/architecture-plan-guide.zh-CN.md +30 -46
- package/docs/poc-rule-evaluation.md +38 -0
- package/package.json +3 -2
- package/schemas/code-stats.schema.json +245 -0
- package/skills/android2hmos_resources_convert/SKILL.md +1 -9
- package/skills/d2h-app-solution/SKILL.md +3 -3
- package/skills/d2h-app-solution/references/inventory-schema.md +2 -2
- package/skills/d2h-architecture-plan/SKILL.md +23 -22
- package/skills/d2h-architecture-plan/references/architecture-plan.example.json +650 -76
- package/skills/d2h-architecture-plan/references/directory-creation.md +7 -7
- package/skills/d2h-architecture-plan/references/hybrid-design.md +63 -63
- package/skills/d2h-architecture-plan/references/json-contract.md +42 -27
- package/skills/d2h-architecture-plan/references/layout-reference.md +25 -72
- package/skills/d2h-architecture-plan/references/plan-contract.md +24 -34
- package/skills/d2h-architecture-plan/references/source-review.md +10 -7
- package/skills/d2h-architecture-plan/scripts/architecture_plan.py +50 -16
- package/skills/d2h-code-audit/SKILL.md +68 -0
- package/skills/d2h-code-audit/references/code-stats-schema.md +260 -0
- package/skills/d2h-code-audit/references/metrics.md +94 -0
- package/skills/d2h-code-audit/scripts/code_stats.py +600 -0
- package/skills/d2h-code-audit/scripts/validate_code_stats.py +446 -0
- package/skills/d2h-dashboard/SKILL.md +59 -33
- package/skills/d2h-dashboard/app/assets/Analysis-9GrmuIjp.css +1 -0
- package/skills/d2h-dashboard/app/assets/Analysis-Dj-4QEJi.js +1 -0
- package/skills/d2h-dashboard/app/assets/CodeAudit-Ctt3XEec.css +1 -0
- package/skills/d2h-dashboard/app/assets/CodeAudit-TcIcLwQL.js +1 -0
- package/skills/d2h-dashboard/app/assets/FeaturesList-C5yGUbRo.js +1 -0
- package/skills/d2h-dashboard/app/assets/FeaturesList-CZ40orVY.css +1 -0
- package/skills/d2h-dashboard/app/assets/Overview-CNkA3J9F.js +1 -0
- package/skills/d2h-dashboard/app/assets/Overview-Cmz8yjX-.css +1 -0
- package/skills/d2h-dashboard/app/assets/PageHeading-B5I3tpO8.js +1 -0
- package/skills/d2h-dashboard/app/assets/PageHeading-BIDu_a9G.css +1 -0
- package/skills/d2h-dashboard/app/assets/Project-BC9Tz1WY.js +1 -0
- package/skills/d2h-dashboard/app/assets/Project-BRyXCzsB.css +1 -0
- package/skills/d2h-dashboard/app/assets/Review-BfWvqlU9.js +1 -0
- package/skills/d2h-dashboard/app/assets/SpecDetail-BHB6smtT.css +1 -0
- package/skills/d2h-dashboard/app/assets/SpecDetail-DguVmqAE.js +1 -0
- package/skills/d2h-dashboard/app/assets/SpecItemDetail-7s7SaF3O.js +69 -0
- package/skills/d2h-dashboard/app/assets/SpecItemDetail-Bf4pGDEN.css +1 -0
- package/skills/d2h-dashboard/app/assets/_plugin-vue_export-helper-B9l48Cov.js +1 -0
- package/skills/d2h-dashboard/app/assets/batchReport-B3IzPnHF.js +1 -0
- package/skills/d2h-dashboard/app/assets/datetime-CHrzCsjX.js +1 -0
- package/skills/d2h-dashboard/app/assets/index-B3nfIPBm.js +3 -0
- package/skills/d2h-dashboard/app/assets/index-CnjP19Vs.css +1 -0
- package/skills/d2h-dashboard/app/assets/navigation-d1Uf6TR4.js +1 -0
- package/skills/d2h-dashboard/app/dataApi.mjs +387 -0
- package/skills/d2h-dashboard/app/index.html +14 -0
- package/skills/d2h-dashboard/app/package.json +12 -0
- package/skills/d2h-dashboard/app/serve.mjs +310 -0
- package/skills/d2h-hypium-forge/SKILL.md +6 -1
- package/skills/d2h-spec-develop/SKILL.md +24 -25
- package/skills/d2h-spec-develop/scripts/__pycache__/check_acceptance.cpython-313.pyc +0 -0
- package/skills/d2h-spec-develop/scripts/check_acceptance.py +66 -0
- package/skills/d2h-spec-generate/SKILL.md +2 -0
- package/skills/d2h-spec-plan/SKILL.md +6 -0
- package/skills/{cpp → language/cpp}/d2h-native-library-verify/scripts/__pycache__/native_common.cpython-313.pyc +0 -0
- package/skills/d2h-architecture-plan/scripts/test_architecture_plan.py +0 -241
- package/skills/d2h-spec-generate/assets/spec-template.md +0 -109
- package/skills/d2h-spec-generate/references/from-plan.md +0 -27
- package/skills/d2h-spec-generate/references/spec-content.md +0 -32
- package/skills/maintaining-migration-report/SKILL.md +0 -144
- package/skills/maintaining-migration-report/references/final-acceptance.md +0 -48
- package/skills/maintaining-migration-report/references/source-provenance.md +0 -66
- /package/skills/{cpp → language/cpp}/d2h-native-library-analyse/SKILL.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-analyse/scripts/analyse-android-so.py +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-build/SKILL.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-build/references/build-config-mapping.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-build/references/jni-to-napi-mapping.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-build/scripts/check-android-so.py +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/SKILL.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-build-sign-run.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/AppScope/app.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/AppScope/resources/base/element/string.json +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/README.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/build-profile.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/build-profile.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/hvigorfile.ts +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/oh-package.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/ets/entryability/EntryAbility.ets +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/ets/pages/Index.ets +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/ets/pages/NativeVerifyDemo.ets +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/module.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/resources/base/element/color.json +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/resources/base/element/string.json +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/main/resources/base/profile/main_pages.json +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/ohosTest/ets/test/FFmpegVerify.test.ets +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/ohosTest/ets/test/List.test.ets +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/entry/src/ohosTest/module.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/hvigor/hvigor-config.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/hvigorfile.ts +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-project-template/oh-package.json5 +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/demo-template.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/references/hypium-test-template.md +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/scripts/device-verify.py +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/scripts/native_common.py +0 -0
- /package/skills/{cpp → language/cpp}/d2h-native-library-verify/scripts/verify-ohos-native.py +0 -0
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"""Final-display contract checks. No source or HarmonyOS project is touched."""
|
|
2
|
-
|
|
3
|
-
import copy
|
|
4
|
-
import json
|
|
5
|
-
import os
|
|
6
|
-
from pathlib import Path
|
|
7
|
-
import subprocess
|
|
8
|
-
import sys
|
|
9
|
-
import tempfile
|
|
10
|
-
import unittest
|
|
11
|
-
|
|
12
|
-
from architecture_plan import ContractError, directory_tree, load_json, validate_plan
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
SKILL_ROOT = Path(__file__).resolve().parents[1]
|
|
16
|
-
HELPER = SKILL_ROOT / "scripts" / "architecture_plan.py"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class ArchitecturePlanTests(unittest.TestCase):
|
|
20
|
-
def setUp(self):
|
|
21
|
-
self.plan = load_json(SKILL_ROOT / "references" / "architecture-plan.example.json")
|
|
22
|
-
|
|
23
|
-
def nodes(self):
|
|
24
|
-
def visit(node):
|
|
25
|
-
yield node
|
|
26
|
-
for child in node["children"]:
|
|
27
|
-
yield from visit(child)
|
|
28
|
-
return list(visit(self.plan["directoryTree"]))
|
|
29
|
-
|
|
30
|
-
def node(self, path):
|
|
31
|
-
return next(node for node in self.nodes() if node["path"] == path)
|
|
32
|
-
|
|
33
|
-
def cli(self, *args, env=None):
|
|
34
|
-
return subprocess.run([sys.executable, "-X", "utf8", "-B", str(HELPER), *map(str, args)],
|
|
35
|
-
capture_output=True, encoding="utf-8", env=env, check=False)
|
|
36
|
-
|
|
37
|
-
def test_example_is_one_final_tree_with_decision_notes(self):
|
|
38
|
-
before = copy.deepcopy(self.plan)
|
|
39
|
-
validate_plan(self.plan)
|
|
40
|
-
self.assertEqual(self.plan, before)
|
|
41
|
-
self.assertEqual(set(self.plan), {"projectName", "directoryTree", "decisions"})
|
|
42
|
-
paths = directory_tree(self.plan["directoryTree"])
|
|
43
|
-
self.assertIn("entry/src/main/ets/features/mail/messageview", paths)
|
|
44
|
-
self.assertNotIn("products/thunderbird", paths)
|
|
45
|
-
self.assertTrue(self.plan["decisions"])
|
|
46
|
-
|
|
47
|
-
def test_missing_extra_and_legacy_top_fields_are_rejected(self):
|
|
48
|
-
for key in self.plan:
|
|
49
|
-
changed = copy.deepcopy(self.plan)
|
|
50
|
-
del changed[key]
|
|
51
|
-
with self.subTest(missing=key), self.assertRaises(ContractError):
|
|
52
|
-
validate_plan(changed)
|
|
53
|
-
for key in ("project", "androidAnalysis", "proposals", "recommendedProposalId", "recommendationReason",
|
|
54
|
-
"selectedProposalId", "selection", "planId", "revision", "schemaVersion", "targetRoot", "dependencies"):
|
|
55
|
-
with self.subTest(extra=key), self.assertRaises(ContractError):
|
|
56
|
-
validate_plan({**self.plan, key: None})
|
|
57
|
-
|
|
58
|
-
def test_project_name_and_decision_fields_must_be_nonempty_text(self):
|
|
59
|
-
for value in (None, True, 0, [], {}, "", " \n"):
|
|
60
|
-
with self.subTest(projectName=value), self.assertRaises(ContractError):
|
|
61
|
-
validate_plan({**self.plan, "projectName": value})
|
|
62
|
-
for key in ("title", "description"):
|
|
63
|
-
changed = copy.deepcopy(self.plan)
|
|
64
|
-
changed["decisions"][0][key] = value
|
|
65
|
-
with self.subTest(decision=key, value=value), self.assertRaises(ContractError):
|
|
66
|
-
validate_plan(changed)
|
|
67
|
-
|
|
68
|
-
def test_decisions_require_a_nonempty_exactly_shaped_array(self):
|
|
69
|
-
for value in (None, {}, "decision", [], [{}], [{"title": "保留"}],
|
|
70
|
-
[{"title": "保留", "description": "原包族", "confirmed": True}]):
|
|
71
|
-
with self.subTest(value=value), self.assertRaises(ContractError):
|
|
72
|
-
validate_plan({**self.plan, "decisions": value})
|
|
73
|
-
|
|
74
|
-
def test_old_dependency_array_and_embedded_relationship_fields_are_rejected(self):
|
|
75
|
-
for value in ([], [{"fromPath": "entry", "toPath": "AppScope", "description": "旧关系模型"}]):
|
|
76
|
-
with self.subTest(value=value), self.assertRaises(ContractError):
|
|
77
|
-
validate_plan({**self.plan, "dependencies": value})
|
|
78
|
-
for key, value in (("fromPath", "entry"), ("toPath", "AppScope"), ("dependencies", [])):
|
|
79
|
-
changed = copy.deepcopy(self.plan)
|
|
80
|
-
changed["decisions"][0][key] = value
|
|
81
|
-
with self.subTest(key=key), self.assertRaises(ContractError):
|
|
82
|
-
validate_plan(changed)
|
|
83
|
-
|
|
84
|
-
def test_nodes_require_description_children_and_known_fields(self):
|
|
85
|
-
for key in ("name", "path", "description", "children"):
|
|
86
|
-
changed = copy.deepcopy(self.plan)
|
|
87
|
-
del changed["directoryTree"][key]
|
|
88
|
-
with self.subTest(missing=key), self.assertRaises(ContractError):
|
|
89
|
-
validate_plan(changed)
|
|
90
|
-
for key, value in (("description", ""), ("children", {}), ("kind", "module"),
|
|
91
|
-
("kind", None), ("selected", True)):
|
|
92
|
-
changed = copy.deepcopy(self.plan)
|
|
93
|
-
changed["directoryTree"][key] = value
|
|
94
|
-
with self.subTest(key=key), self.assertRaises(ContractError):
|
|
95
|
-
validate_plan(changed)
|
|
96
|
-
|
|
97
|
-
def test_root_is_a_normal_directory_at_dot(self):
|
|
98
|
-
for key, value in (("path", "entry"), ("kind", "HAP")):
|
|
99
|
-
changed = copy.deepcopy(self.plan)
|
|
100
|
-
changed["directoryTree"][key] = value
|
|
101
|
-
with self.subTest(key=key), self.assertRaises(ContractError):
|
|
102
|
-
validate_plan(changed)
|
|
103
|
-
|
|
104
|
-
def test_names_and_direct_nesting_must_match_paths(self):
|
|
105
|
-
for path, name in (("entry/src/main", "main"), ("entry/src", "sources")):
|
|
106
|
-
changed = copy.deepcopy(self.plan)
|
|
107
|
-
node = changed["directoryTree"]["children"][1]["children"][0]
|
|
108
|
-
node.update(path=path, name=name)
|
|
109
|
-
with self.subTest(path=path, name=name), self.assertRaises(ContractError):
|
|
110
|
-
validate_plan(changed)
|
|
111
|
-
|
|
112
|
-
def test_unsafe_and_placeholder_paths_are_rejected(self):
|
|
113
|
-
for path in ("/absolute", "E:/target", "../source", "a/../b", "a//b", "./entry", "a\\b",
|
|
114
|
-
"pages/*", "{pages,state}", "<产品>", "…", "CON", "NUL.txt", "aux", "COM¹", "lpt².log", "a.", "a ",
|
|
115
|
-
"bad\x00path", "bad?path"):
|
|
116
|
-
changed = copy.deepcopy(self.plan)
|
|
117
|
-
changed["directoryTree"]["children"][0].update(path=path, name=path.split("/")[-1])
|
|
118
|
-
with self.subTest(path=path), self.assertRaises(ContractError):
|
|
119
|
-
validate_plan(changed)
|
|
120
|
-
|
|
121
|
-
def test_duplicate_and_case_conflicting_paths_are_rejected(self):
|
|
122
|
-
for name in ("AppScope", "appscope"):
|
|
123
|
-
changed = copy.deepcopy(self.plan)
|
|
124
|
-
duplicate = copy.deepcopy(changed["directoryTree"]["children"][0])
|
|
125
|
-
duplicate.update(name=name, path=name)
|
|
126
|
-
changed["directoryTree"]["children"].append(duplicate)
|
|
127
|
-
with self.subTest(name=name), self.assertRaisesRegex(ContractError, "duplicate/case-conflicting"):
|
|
128
|
-
validate_plan(changed)
|
|
129
|
-
|
|
130
|
-
def test_application_hap_and_expanded_production_root_are_required(self):
|
|
131
|
-
changed = copy.deepcopy(self.plan)
|
|
132
|
-
changed["directoryTree"]["children"] = []
|
|
133
|
-
with self.assertRaisesRegex(ContractError, "application HAP"):
|
|
134
|
-
validate_plan(changed)
|
|
135
|
-
self.node("entry")["kind"] = "HAR"
|
|
136
|
-
with self.assertRaisesRegex(ContractError, "application HAP"):
|
|
137
|
-
validate_plan(self.plan)
|
|
138
|
-
self.node("entry")["kind"] = "HAP"
|
|
139
|
-
self.node("entry")["children"] = []
|
|
140
|
-
with self.assertRaisesRegex(ContractError, "src/main"):
|
|
141
|
-
validate_plan(self.plan)
|
|
142
|
-
|
|
143
|
-
def test_empty_hap_production_root_is_rejected(self):
|
|
144
|
-
self.node("entry/src/main")["children"] = []
|
|
145
|
-
with self.assertRaisesRegex(ContractError, "src/main"):
|
|
146
|
-
validate_plan(self.plan)
|
|
147
|
-
|
|
148
|
-
def test_hap_tree_validation_is_not_tied_to_one_source_language(self):
|
|
149
|
-
for name in ("js", "cpp"):
|
|
150
|
-
changed = copy.deepcopy(self.plan)
|
|
151
|
-
source = next(node for node in self.nodes() if node["path"] == "entry/src/main/ets")
|
|
152
|
-
source = copy.deepcopy(source)
|
|
153
|
-
def rebase(node):
|
|
154
|
-
node["path"] = node["path"].replace("entry/src/main/ets", f"entry/src/main/{name}", 1)
|
|
155
|
-
for child in node["children"]:
|
|
156
|
-
rebase(child)
|
|
157
|
-
rebase(source)
|
|
158
|
-
source["name"] = name
|
|
159
|
-
changed["directoryTree"]["children"][1]["children"][0]["children"][0]["children"][0] = source
|
|
160
|
-
with self.subTest(source=name):
|
|
161
|
-
validate_plan(changed)
|
|
162
|
-
|
|
163
|
-
def test_module_cannot_be_inside_another_modules_source_tree(self):
|
|
164
|
-
for kind in ("HAP", "HAR", "HSP"):
|
|
165
|
-
self.node("entry/src/main/ets/features")["kind"] = kind
|
|
166
|
-
with self.subTest(kind=kind), self.assertRaisesRegex(ContractError, "source tree"):
|
|
167
|
-
validate_plan(self.plan)
|
|
168
|
-
|
|
169
|
-
def test_module_grouping_outside_a_source_tree_is_not_rejected_as_nesting(self):
|
|
170
|
-
self.node("entry")["children"].append({
|
|
171
|
-
"name": "libraries", "path": "entry/libraries", "description": "库目录分组", "children": [{
|
|
172
|
-
"name": "mail", "path": "entry/libraries/mail", "kind": "HAR",
|
|
173
|
-
"description": "由独立构建配置注册的库模块", "children": [{
|
|
174
|
-
"name": "src", "path": "entry/libraries/mail/src", "description": "库源码", "children": [{
|
|
175
|
-
"name": "main", "path": "entry/libraries/mail/src/main", "description": "生产根", "children": [{
|
|
176
|
-
"name": "ets", "path": "entry/libraries/mail/src/main/ets",
|
|
177
|
-
"description": "库的 ArkTS 源码", "children": [],
|
|
178
|
-
}],
|
|
179
|
-
}],
|
|
180
|
-
}],
|
|
181
|
-
}],
|
|
182
|
-
})
|
|
183
|
-
validate_plan(self.plan)
|
|
184
|
-
|
|
185
|
-
def test_multiple_hap_modules_and_sibling_libraries_are_supported(self):
|
|
186
|
-
for kind in ("HAP", "HAR", "HSP"):
|
|
187
|
-
with self.subTest(kind=kind):
|
|
188
|
-
changed = copy.deepcopy(self.plan)
|
|
189
|
-
module = copy.deepcopy(changed["directoryTree"]["children"][1])
|
|
190
|
-
def rebase(node):
|
|
191
|
-
node["path"] = "second" + node["path"][len("entry"):]
|
|
192
|
-
for child in node["children"]:
|
|
193
|
-
rebase(child)
|
|
194
|
-
rebase(module)
|
|
195
|
-
module.update(name="second", kind=kind)
|
|
196
|
-
changed["directoryTree"]["children"].append(module)
|
|
197
|
-
validate_plan(changed)
|
|
198
|
-
|
|
199
|
-
def test_invalid_json_duplicate_keys_and_nonstandard_numbers_are_rejected(self):
|
|
200
|
-
with tempfile.TemporaryDirectory() as temporary:
|
|
201
|
-
path = Path(temporary) / "plan.json"
|
|
202
|
-
for content in ('{"projectName": "a", "projectName": "b"}', '{"bad": NaN}',
|
|
203
|
-
'{"bad": Infinity}', '{"bad": -Infinity}', '{broken', 'null'):
|
|
204
|
-
path.write_text(content, encoding="utf-8")
|
|
205
|
-
with self.subTest(content=content), self.assertRaises(ValueError):
|
|
206
|
-
validate_plan(load_json(path))
|
|
207
|
-
|
|
208
|
-
def test_cli_validates_utf8_bom_and_makes_no_writes_or_confirmation_files(self):
|
|
209
|
-
with tempfile.TemporaryDirectory() as temporary:
|
|
210
|
-
path = Path(temporary) / "architecture-plan.json"
|
|
211
|
-
path.write_text(json.dumps(self.plan, ensure_ascii=False), encoding="utf-8-sig")
|
|
212
|
-
before = path.read_bytes()
|
|
213
|
-
result = self.cli("validate", path, env={**os.environ, "PYTHONIOENCODING": "ascii"})
|
|
214
|
-
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
|
215
|
-
self.assertEqual(json.loads(result.stdout), {"status": "valid", "projectName": "示例邮件客户端"})
|
|
216
|
-
self.assertEqual(path.read_bytes(), before)
|
|
217
|
-
self.assertEqual([p.name for p in path.parent.iterdir()], [path.name])
|
|
218
|
-
|
|
219
|
-
def test_cli_errors_do_not_rewrite_input_and_missing_file_is_reported(self):
|
|
220
|
-
with tempfile.TemporaryDirectory() as temporary:
|
|
221
|
-
path = Path(temporary) / "architecture-plan.json"
|
|
222
|
-
for content in ('{"proposals": []}', '{broken', '[]'):
|
|
223
|
-
path.write_text(content, encoding="utf-8")
|
|
224
|
-
result = self.cli("validate", path)
|
|
225
|
-
self.assertEqual(result.returncode, 1)
|
|
226
|
-
self.assertEqual(json.loads(result.stdout)["status"], "error")
|
|
227
|
-
self.assertEqual(path.read_text(encoding="utf-8"), content)
|
|
228
|
-
result = self.cli("validate", path.parent / "missing.json")
|
|
229
|
-
self.assertEqual(result.returncode, 1)
|
|
230
|
-
self.assertEqual(json.loads(result.stdout)["status"], "error")
|
|
231
|
-
|
|
232
|
-
def test_legacy_selection_commands_are_unavailable(self):
|
|
233
|
-
for command in ("apply-selection", "read-selection"):
|
|
234
|
-
result = self.cli(command, "architecture-plan.json")
|
|
235
|
-
with self.subTest(command=command):
|
|
236
|
-
self.assertNotEqual(result.returncode, 0)
|
|
237
|
-
self.assertIn("invalid choice", result.stderr)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if __name__ == "__main__":
|
|
241
|
-
unittest.main()
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# <页面名称> 迁移 Spec
|
|
2
|
-
|
|
3
|
-
## 文档基线与轮次对照
|
|
4
|
-
|
|
5
|
-
- 页面:`<page_id>`;目录:`<package>`
|
|
6
|
-
- 功能来源:`<features.json 绝对路径>`;revision:`<revision>`;内容哈希:`<feature_hash>`
|
|
7
|
-
- 计划来源:`<pages.json 绝对路径>`;revision:`<revision>`
|
|
8
|
-
- Android / HarmonyOS 根目录:`<android_root>` / `<harmony_root>`
|
|
9
|
-
- 源码依据版本:`<真实提交/来源标识>`;适用交付目标:`<已授权目标或未配置>`
|
|
10
|
-
|
|
11
|
-
| feature_id / scope_id | 里程碑 / round_id | batch_id | spec_id | checks | 范围去向及原因 |
|
|
12
|
-
|---|---|---|---|---|---|
|
|
13
|
-
| `<feature>/<scope>` | `<milestone>/<round>` | `<batch>` | `<spec>` | `<真实 check_id>` | `<本轮/后续轮/延期/未决/排除及理由>` |
|
|
14
|
-
|
|
15
|
-
> 成员和边界与 pages.json、features.json 保持一致。延期/未决未分配项不虚构 batch_id 或 spec_id。此文档不保存运行中完成状态,当前验收读取 batch_report.json 的派生结果。
|
|
16
|
-
|
|
17
|
-
## 页面范围
|
|
18
|
-
|
|
19
|
-
- 页面标识:`<page_id>`;类型:`<page/dialog/sheet/mode/other>`
|
|
20
|
-
- Android 到达路径:`<从真实入口开始,说明前置状态、导航、参数及适用渠道>`
|
|
21
|
-
- HarmonyOS 正式入口:`<已核验入口,或明确标记为 planned 的设计入口>`
|
|
22
|
-
- 负责范围:`<当前页面负责的状态、行为与 scope_refs>`
|
|
23
|
-
- 排除范围:`<相邻责任与实际归属;排除本 Spec 不等于排除用户需求>`
|
|
24
|
-
- 页面结构与共享状态:`<容器、状态来源、初始化、生命周期、跨轮次保留部分>`
|
|
25
|
-
|
|
26
|
-
## 开发顺序
|
|
27
|
-
|
|
28
|
-
- 所属轮次与目标:`<round_id/goal>`;目标路径检查:`<goal_checks>`
|
|
29
|
-
- 前置能力:`<requires/provides、负责 Spec 及消费者>`
|
|
30
|
-
- 分组依据与预算:`<同轮同页的代码/状态/测试准备复用,实际 max_specs/max_effort_hours>`
|
|
31
|
-
- 选择理由:`<用户约束、必要前置、风险与增量价值;不以页名或编号替代依据>`
|
|
32
|
-
- 暂缓范围与去向:`<关联 scope_id、后续轮次或上游处置、原因>`
|
|
33
|
-
|
|
34
|
-
## 页面功能
|
|
35
|
-
|
|
36
|
-
| feature_id / scope_id | 条件与触发 | 可观察结果 | 本轮/后续及负责 spec_id |
|
|
37
|
-
|---|---|---|---|
|
|
38
|
-
| `<feature>/<scope>` | `<适用条件 → 用户动作或外部触发>` | `<界面、导航、数据或平台结果>` | `<本轮负责者或明确延期去向>` |
|
|
39
|
-
|
|
40
|
-
> 保留已知页面行为和约定范围,不因选择 MVP 删除全量长尾。每个已授权且已分配范围有唯一负责 Spec。共享背景可以引用本页章节,逐 Spec 的行为与断言不能仅写“同上”或“完善页面”。
|
|
41
|
-
|
|
42
|
-
## UI 操作与验收
|
|
43
|
-
|
|
44
|
-
### Spec: `<spec_id>`
|
|
45
|
-
|
|
46
|
-
#### 目标与范围
|
|
47
|
-
|
|
48
|
-
- feature_refs / scope_refs:`<稳定 ID 与具体范围>`
|
|
49
|
-
- 轮次 / 批次:`<round_id>` / `<batch_id>`
|
|
50
|
-
- 目标、负责与明确排除:`<独立可交付结果,以及不夹带的后续范围>`
|
|
51
|
-
- 拆分理由:`<独立交付、能力解锁、风险/验证差异或跨轮延期;不为凑数量拆分>`
|
|
52
|
-
|
|
53
|
-
#### 行为与数据契约
|
|
54
|
-
|
|
55
|
-
- 前置状态、入口及输入:`<可复现的到达路径、路由参数、输入边界>`
|
|
56
|
-
- 正常路径:`<触发 → 处理中状态 → 结果 → 后续导航/数据效果>`
|
|
57
|
-
- 必要分支:`<适用的空、错误、重复操作、权限拒绝、取消返回、恢复等;不适用时写明理由>`
|
|
58
|
-
- 数据与副作用:`<读写对象、持久化键/表、初始化、生命周期及共享消费者>`
|
|
59
|
-
- 不变量:`<必须持续成立的约束>`
|
|
60
|
-
- requires / provides:`<能力约束与负责 Spec;设计接口和实际接口回执分开>`
|
|
61
|
-
- 已知风险与坑:`<源码或真实失败依据;无已知项经核对后注明>`
|
|
62
|
-
|
|
63
|
-
#### 检查: `<check_id>`
|
|
64
|
-
|
|
65
|
-
- 对应范围:`<feature_id/scope_id>`;验证层级:`<static/logic/integration/device>`
|
|
66
|
-
- 时机:`<immediate/batch>`;最晚验证点与理由:`<与计划一致>`
|
|
67
|
-
- 场景与前置:`<状态、数据、权限、网络或设备条件>`
|
|
68
|
-
1. 从 `<真实应用入口或能力输入>` 到达 `<目标状态>`。
|
|
69
|
-
2. 对 `<有源码依据的语义控件/接口>` 执行 `<动作或输入>`。
|
|
70
|
-
3. 断言 `<明确可观察状态、导航、数据、副作用或错误结果>`。
|
|
71
|
-
- 源码/用户依据:`<对应证据表的引用;source-derived 路径不算设备通过>`
|
|
72
|
-
|
|
73
|
-
> 按实际 checks 重复检查小节,覆盖当前 Spec 的每个检查。纯展示行为给出到达与可见断言;非 UI Spec 写输入、调用、输出与副作用,不虚构页面控件。静态/逻辑前置检查不冒充当前候选的正式设备 PASS。
|
|
74
|
-
|
|
75
|
-
#### 实施与开工缺口
|
|
76
|
-
|
|
77
|
-
- HarmonyOS 目标路径与职责:`<引用下方实现表,并说明本 Spec 改动边界>`
|
|
78
|
-
- 工作量:`<复用 Spec.effort 的 low/expected/high、置信度与不确定性>`
|
|
79
|
-
- 评分依据:`<与 Spec.ratings 一致的里程碑贡献、解锁、用户价值、风险消减和反馈理由>`
|
|
80
|
-
- 分工与路径所有权:`<allocation.recommended_workers、owned_paths 及理由;当前实际仍单 worker>`
|
|
81
|
-
- 阻止可靠实施的问题:`<implementation_brief.open_questions 与外部条件;核对后无则写无>`
|
|
82
|
-
- 本次不实施的后续完善:`<scope_id、去向、原因>`
|
|
83
|
-
|
|
84
|
-
> 同页有多个独立 Spec 时,按稳定 spec_id 重复上述完整章节。后续未临近轮次可只记录已知范围、前置、验收目标和待细化内容,并明确“未细化、不可派发”;接近执行前补完整,不能用摘要代替当前潜在派发成员的实施规格。
|
|
85
|
-
|
|
86
|
-
## Android 证据
|
|
87
|
-
|
|
88
|
-
| 证据 | 路径 / Ref | 支持的行为、分支与 Spec/check |
|
|
89
|
-
|---|---|---|
|
|
90
|
-
| Android 源码 | `<android_root 相对路径、符号/行>` | `<触发、状态转移、持久化、异常或平台结果>` |
|
|
91
|
-
| Facts(有则引用) | `<真实 surface/entry/control/interaction/native-libs ref>` | `<支持的范围及覆盖限制>` |
|
|
92
|
-
| UTG(有则引用) | `<真实 page.json node_id>` | `<正式到达路径、前置、guard 与来源限制>` |
|
|
93
|
-
| 用户新增需求(适用时) | `<用户消息或记录标识>` | `<来源码外授权行为,不伪装 extracted 事实>` |
|
|
94
|
-
|
|
95
|
-
## HarmonyOS 实现范围
|
|
96
|
-
|
|
97
|
-
| 相对路径 | 状态 | 负责 Spec | 预期职责 / 校验点 |
|
|
98
|
-
|---|---|---|---|
|
|
99
|
-
| `<harmony_root 下的真实或规划路径>` | `<existing/planned>` | `<spec_id>` | `<UI、逻辑、数据、共享影响与验收定位>` |
|
|
100
|
-
|
|
101
|
-
> existing 路径须核对存在;新设计路径标 planned。计划中的接口、代码或文件不作为已实现证明。
|
|
102
|
-
|
|
103
|
-
## 未决项与平台差异
|
|
104
|
-
|
|
105
|
-
| 范围 / Spec | 问题、依据及影响 | 阻止什么 | 处置 / 负责方 / 后续去向 |
|
|
106
|
-
|---|---|---|---|
|
|
107
|
-
| `<scope_id/spec_id>` | `<真实未知项或差异>` | `<开工、能力解锁、验证或交付>` | `<需确认/需配置/方案/延期,不虚构结论>` |
|
|
108
|
-
|
|
109
|
-
核对后确无未决项时明确写“无”。涉及原生库时说明源码重编/patch、JNI→NAPI、闭源替代或明确差异,并引用负责 Spec 与消费者;缺失产物不能用静默 stub 掩盖。
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# 消费已有增量计划生成规格
|
|
2
|
-
|
|
3
|
-
唯一流程是消费选定的增量计划,不执行全量拆页、评分排序或账本初始化。结构与生命周期见公共 `d2h workflow contract generation`、`contract plan`、`contract dispatch`,不读取生产者 Skill 的私有资源。
|
|
4
|
-
|
|
5
|
-
## 核对输入与生成选择
|
|
6
|
-
|
|
7
|
-
读取计划/功能清单、明确 revision/hash 和选定 spec_ids,核对所属 round/batch、scope_refs/checks、requires/provides、目标文件所有权及当前执行摘要。缺失选择或身份变化返回 needs-input/needs-revision,不默认全量生成。AI 逐项核对 scope_id 到行为、页面和非页面入口的证据;UTG 节点只提供到达/采集线索,不逐节点生成任务。
|
|
8
|
-
|
|
9
|
-
若交接包含原始 inventory.json,按其稳定来源映射核对选定成员未关联 should_develop=false 的功能;与 features.json/pages.json 不一致时返回范围修订请求,不直接过滤成员或改写计划。should_develop=true 也不授权展开计划外子范围。生成只消费已确认的 scope_refs/checks;清单开关变化不自动重生成已有正文。
|
|
10
|
-
|
|
11
|
-
已有有效分析与架构直接复用,仅对当前范围补读源码。需要平台知识、原生依赖或架构结论时返回 requests,说明证据、缺口和受影响 Spec,由调用方选择能力;不加载其他 Skill。用户新增需求记录用户来源,不伪造 Android 实现证据。
|
|
12
|
-
|
|
13
|
-
## 内容质量
|
|
14
|
-
|
|
15
|
-
用户明确要求复用且不重新生成时,只做已有正文和绑定的只读核对,按下节复用与绑定复核返回 reused、需修订成员和缺口;不执行下面的正文展开或写入绑定步骤。
|
|
16
|
-
|
|
17
|
-
按入口 Workflow 的完整证据索引、页面归属核验与逐项源码追踪执行,保留导航/状态/持久化/取消和异常覆盖、真实路径核对;用 [完整内容要求](spec-content.md) 和 [正式模板](../assets/spec-template.md) 展开当前成员。保留七个核心章节与逐项操作、预期可观察结果、源码和平台依据;不以分组摘要替代成员。正式模板的目录、顺序和依赖从输入计划读取,不执行旧 page_score 公式,不把未选登录方式等整页扩展夹带进来。
|
|
18
|
-
|
|
19
|
-
仅修改所选成员块和必要共享背景。同页追加新成员时保留原内容、独立 spec_id 和验收状态;未来成员可没有文件或明确待细化,不能拿占位内容登记为完整。使用公共契约规定的成员边界,保证全部 check_id 及对应断言出现在其块内。当前页面的公共章节保留原七章布局,放在所有成员块之外(可在成员之后),逐成员的具体来源/目标实现定位写在该成员块内。
|
|
20
|
-
|
|
21
|
-
生成中发现规划边界、前置能力、文件耦合、测试准备、风险或 implementation_brief 与计划假设不符时,返回受影响成员、proposed_plan_updates 和源码证据,不自行分组或调整测试策略。计划维护者应用后增加 revision,调用方重新选定版本,再完成绑定。生成方不能修改 pages.json、features.json、batch_report.json、旧批次报告或实际工程代码。
|
|
22
|
-
|
|
23
|
-
返回 status、输入与内容版本、generated/updated/reused 的 spec_ids、绝对产物路径、unresolved/requests、已核对成员及建议修订,未审查范围不标为已复核;已复用规格仍核对逐成员绑定。确认结构与正文完整后,使用公共 generation 命令记录明确成员,得到 generation.json;它是文件绑定,不是用户授权或运行通过。发现现有页面不符合本模式边界,先保留备份并返回显式迁移请求,不能覆盖旧文档或旧账本。
|
|
24
|
-
|
|
25
|
-
## 复用与绑定复核
|
|
26
|
-
|
|
27
|
-
逐成员核对正文与共享上下文、规划摘要及关联范围。全局计划或功能哈希变化不自动要求重生全部正文;缺少旧输入或成员绑定失效时保留原文,返回具体修订请求,不用当前哈希覆盖旧值作为有效性证明。仅复核或用户禁止重生时不写 spec.md、generation.json,也不自动搬迁目录;reused 只表示正文保留,不能宣称可开工或已验收。
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# 完整 Spec 模板与按组细化
|
|
2
|
-
|
|
3
|
-
生成新页面文档、细化当前轮次或审查实施内容时读取 [spec-template.md](../assets/spec-template.md)。模板恢复原页面 Spec 中已使用的七个核心章节:页面范围、开发顺序、页面功能、UI 操作与验收、Android 证据、HarmonyOS 实现范围、未决项与平台差异;在此基础上增加当前增量流程的稳定范围、轮次、批次及逐 spec_id 内容。
|
|
4
|
-
|
|
5
|
-
## 生成组织
|
|
6
|
-
|
|
7
|
-
1. 从选定计划读取完整功能范围去向、稳定 spec_id、依赖、轮次与同轮同页的 page_batches,不重新决定或改写计划。优先通过分组复用上下文,不以减少 Spec 数量或压缩文档为目标。
|
|
8
|
-
2. 每页目录仍只有一份 spec.md;当前流程的七个公共章节保留原布局并置于所有成员块之外,各成员的来源与实现细节保留在自己的稳定块内;页面共用入口、状态与证据写一次,当前轮次的每个 Spec 使用 `### Spec: <spec_id>` 稳定标题,逐项写清范围、行为、异常、数据、副作用及检查。一个文件含多个 Spec 不等于合成一个执行/验收单元。
|
|
9
|
-
3. 只细化调用方在固定版本上选定的成员;其中可以包含尚待提供者解锁的消费者,但不能因其属于同组就自行扩大选择。未知契约保留开工问题,不臆造接口。选定成员分别完整,不用组摘要替代。
|
|
10
|
-
4. 远期内容保留真实已知的范围、前置、验收目标、延期去向与待细化内容,不提前扩成完整实施工单。已授权范围仍须符合 scope_refs 覆盖要求;到达轮次前补齐内容与工作包。
|
|
11
|
-
5. 开发组、成员数量、依赖、风险权衡和预算以选定计划为准,生成方不重新分组。可为上下文容量分次完成正文,但不改变 spec_id/round_id/batch_id、范围或验收身份,也不创建新的开发批次。分组证据由 pages.json 维护,正文只引用计划身份;发现问题返回修订请求。
|
|
12
|
-
|
|
13
|
-
## 写入前核验(延续原生成要求)
|
|
14
|
-
|
|
15
|
-
- 打开引用的 Android 源码到符号/行,沿事件处理、数据层、状态转移、导航、持久化及失败处理核对可观察结果。用户新增行为标明用户来源,不伪造源码证据。
|
|
16
|
-
- 有 UTG 时核对真实入口、参数、前置状态、guard 和预期到达;有 Facts 时核对范围与覆盖限制。两者不能代替源码理解或实际运行证据。
|
|
17
|
-
- UI 控件的语义名称来自源码/资源/事实;未知定位保持未决,不能为了可测试而发明控件。非 UI 能力按输入/输出及副作用描述。
|
|
18
|
-
- 核对 Android 路径真实存在,HarmonyOS existing 路径真实存在;规划文件标 planned。原生、权限或平台差异按实际领域技能核验,不把规划 API 或签名当当前实际接口。
|
|
19
|
-
- 用户显式跳过扫描时不强制重建 Facts/UTG;复用已有材料并定向核对必要局部证据,注明已知缺口。没有可靠依据时生成待澄清内容,不冒充完整分析或可派发规格。
|
|
20
|
-
|
|
21
|
-
## 派发前内容审查
|
|
22
|
-
|
|
23
|
-
主 Agent 对照固定计划版本、功能范围和原始证据,核对当前成员:
|
|
24
|
-
|
|
25
|
-
- 每个范围有唯一负责 Spec,文档与 scope_refs、轮次/批次成员一致;未选范围有去向,没有被“合并”隐去。
|
|
26
|
-
- 每个 check 都有可执行场景、入口/输入、操作、明确断言及验证层级/时机。断言不能只写“正常”“成功”或“符合预期”。
|
|
27
|
-
- 正常与必要失败分支、数据读写与共享生命周期、HarmonyOS 路径、契约边界及阻塞问题足以可靠实施;背景可引用,核心行为不能仅写“同上”。
|
|
28
|
-
- 同页修订只更新受影响 Spec 章节,保留其他成员、已验收身份和历史。补解释文字不自动撤销验收;改范围、checks 或共享契约由调用方按实际影响修订计划并衔接账本。
|
|
29
|
-
|
|
30
|
-
内容缺失时主 Agent 返回具体 spec_id/check_id 和待补内容,不派发该成员。现有 readiness_gaps 校验工作包字段与接口等结构约束,并不解析 Markdown、证明章节语义完整;不能因为模板标题存在或程序通过就省略此审查。若后续需要程序化内容门禁,应另行设计显式策略,不能假装当前已有。
|
|
31
|
-
|
|
32
|
-
实际派发仍由 derive/context/start_batch 决定并固定窗口,组内逐 Spec 执行、逐项验收。worker 必须能定位并阅读对应完整章节;裁剪上下文不足时回读该章节和相关共享契约,不根据分组摘要自行补造行为。
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: maintaining-migration-report
|
|
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
|
-
---
|
|
5
|
-
|
|
6
|
-
# Maintain the migration ledger
|
|
7
|
-
|
|
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
|
-
|
|
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.
|
|
24
|
-
|
|
25
|
-
## Invariants
|
|
26
|
-
|
|
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.
|
|
29
|
-
- Do not edit `.migration/report/index.json` or `validation.json`; host scripts own indexes, hashes, counts, and validation output.
|
|
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.
|
|
35
|
-
|
|
36
|
-
## Initialize and select work
|
|
37
|
-
|
|
38
|
-
Run once when no report exists:
|
|
39
|
-
|
|
40
|
-
```text
|
|
41
|
-
droid2hmos report init <android-project>
|
|
42
|
-
```
|
|
43
|
-
|
|
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.
|
|
45
|
-
|
|
46
|
-
## Update one item
|
|
47
|
-
|
|
48
|
-
Update while implementation and source context are fresh. Preserve `ref`, `kind`, `factLabel`, and `controlRef`. Maintain only:
|
|
49
|
-
|
|
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.
|
|
55
|
-
|
|
56
|
-
Use the safe update interface:
|
|
57
|
-
|
|
58
|
-
```text
|
|
59
|
-
droid2hmos report update <android-project> --ref <ref> [--status <status>] [--harmony-file <path>...] [--android-source <path>...] [--evidence <path>...] [--difference <text>|--clear-difference]
|
|
60
|
-
```
|
|
61
|
-
|
|
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.
|
|
63
|
-
|
|
64
|
-
Use statuses strictly:
|
|
65
|
-
|
|
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`.
|
|
70
|
-
|
|
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.
|
|
72
|
-
|
|
73
|
-
## Record analyzer omissions
|
|
74
|
-
|
|
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.
|
|
76
|
-
|
|
77
|
-
Validate immediately after changing discoveries. A discovery is not automatically verified merely because its file exists.
|
|
78
|
-
|
|
79
|
-
## Maintain final acceptance
|
|
80
|
-
|
|
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.
|
|
82
|
-
|
|
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.
|
|
84
|
-
|
|
85
|
-
## Maintain the user summary
|
|
86
|
-
|
|
87
|
-
`summary.json` is the only free-form user summary. Keep it concise and limited to:
|
|
88
|
-
|
|
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.
|
|
93
|
-
|
|
94
|
-
Before updating the summary, run `report validate` and read `.migration/report/validation.json`. The prose must agree with that machine result:
|
|
95
|
-
|
|
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.
|
|
100
|
-
|
|
101
|
-
## Validate and return
|
|
102
|
-
|
|
103
|
-
After every semantic update, run:
|
|
104
|
-
|
|
105
|
-
```text
|
|
106
|
-
droid2hmos report validate <android-project>
|
|
107
|
-
```
|
|
108
|
-
|
|
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.
|
|
110
|
-
|
|
111
|
-
Return a structured result:
|
|
112
|
-
|
|
113
|
-
```json
|
|
114
|
-
{
|
|
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
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
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.
|
|
143
|
-
|
|
144
|
-
The caller owns workflow transitions, test execution, checkpoint timing, completion gates, visual/business judgment, and final report delivery.
|
|
@@ -1,48 +0,0 @@
|
|
|
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.
|