@buaa_smat/hometrans 26.0.0-devecocli.4 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (715) hide show
  1. package/README.md +433 -0
  2. package/agents/build-fixer.md +1 -2
  3. package/agents/code-reviewer.md +31 -15
  4. package/agents/model-render-worker.md +9 -5
  5. package/dist/cli/config-store.js +128 -0
  6. package/dist/cli/config.js +48 -0
  7. package/dist/cli/editors.json +114 -0
  8. package/dist/cli/env-vars.js +127 -0
  9. package/dist/cli/index.js +73 -0
  10. package/dist/cli/init.js +2513 -0
  11. package/dist/cli/uninstall.js +406 -0
  12. package/dist/platform/compose.js +228 -0
  13. package/dist/platform/frontmatter.js +151 -0
  14. package/dist/platform/installer.js +417 -0
  15. package/dist/platform/registry.js +337 -0
  16. package/dist/platform/transform.js +363 -0
  17. package/dist/platform/types.js +9 -0
  18. package/dist/platform/validate.js +152 -0
  19. package/dist/utils/regex.js +7 -0
  20. package/env-requirements.json +511 -0
  21. package/package.json +240 -11
  22. package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
  23. package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
  24. package/resource/choose_editor.png +0 -0
  25. package/resource/convert_pipeline_process.svg +114 -0
  26. package/resource/project_architecture.svg +120 -0
  27. package/resource/set_environment.png +0 -0
  28. package/resource/set_multimodel.png +0 -0
  29. package/resource/set_sdk.png +0 -0
  30. package/resource/title_dark.png +0 -0
  31. package/skills/a2h-app-migrate/SKILL.md +17 -11
  32. package/skills/a2h-app-migrate/references/stage-map.md +22 -7
  33. package/skills/a2h-app-migrate/references/workflow.yaml +276 -209
  34. package/skills/a2h-app-migrate/scripts/android_index.mjs +34 -16
  35. package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +12 -12
  36. package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +12 -12
  37. package/skills/a2h-app-migrate/scripts/check_signing.mjs +16 -16
  38. package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +17 -16
  39. package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +141 -62
  40. package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +12 -12
  41. package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +26 -26
  42. package/skills/a2h-app-migrate/scripts/cli_values.mjs +7 -7
  43. package/skills/a2h-app-migrate/scripts/ensure_utg_snapshot.mjs +144 -0
  44. package/skills/a2h-app-migrate/scripts/env_preflight.mjs +474 -365
  45. package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +115 -108
  46. package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +5 -0
  47. package/skills/a2h-app-migrate/scripts/i18n-term.mjs +54 -0
  48. package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +6 -6
  49. package/skills/a2h-app-migrate/scripts/json_io.mjs +1 -1
  50. package/skills/a2h-app-migrate/scripts/ledger.mjs +15 -15
  51. package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +99 -99
  52. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +25 -25
  53. package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +9 -9
  54. package/skills/a2h-app-migrate/scripts/run_dir.mjs +33 -33
  55. package/skills/a2h-app-migrate/scripts/spec_layout.mjs +13 -11
  56. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +128 -80
  57. package/skills/a2h-app-migrate/scripts/write_resume_summary.mjs +349 -0
  58. package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +21 -21
  59. package/skills/a2h-arch-generate/scripts/create_project.mjs +23 -23
  60. package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +48 -40
  61. package/skills/a2h-arch-generate/scripts/generate_state.mjs +7 -7
  62. package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +5 -0
  63. package/skills/a2h-arch-generate/scripts/i18n-term.mjs +54 -0
  64. package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +10 -1
  65. package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +41 -36
  66. package/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
  67. package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1 -1
  68. package/skills/a2h-arch-generate/scripts/module_create/create.mjs +17 -17
  69. package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +54 -50
  70. package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +42 -42
  71. package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +69 -44
  72. package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +62 -17
  73. package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +5 -4
  74. package/skills/a2h-arkts-logic-coder/SKILL.md +39 -8
  75. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
  76. package/skills/a2h-arkts-logic-coder/references/code-generation.md +28 -17
  77. package/skills/{a2h-spec-design/SKILL.md → a2h-arkts-logic-coder/references/spec-design.md} +45 -78
  78. package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +1 -1
  79. package/skills/a2h-arkts-logic-coder/scripts/check_units.ts +448 -0
  80. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +5 -0
  81. package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +54 -0
  82. package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/inspect_spec_design_inputs.mjs +18 -12
  83. package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/lib/py_compat.mjs +1 -1
  84. package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/move_spec_technical_reference.mjs +10 -7
  85. package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/resolve_module_design.mjs +13 -7
  86. package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/validate_spec_design_output.mjs +57 -41
  87. package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +66 -323
  88. package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +66 -108
  89. package/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
  90. package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +5 -18
  91. package/skills/a2h-batch-ui-align/SKILL.md +39 -39
  92. package/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
  93. package/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
  94. package/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
  95. package/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
  96. package/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
  97. package/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
  98. package/skills/a2h-batch-ui-align/references/cards/resources.md +83 -0
  99. package/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
  100. package/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
  101. package/skills/a2h-batch-ui-align/references/cards/widgets.md +38 -0
  102. package/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
  103. package/skills/a2h-batch-ui-align/references/checker-rules.md +642 -0
  104. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +69 -260
  105. package/skills/a2h-batch-ui-align/references/host-dispatch.md +34 -0
  106. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +16 -4
  107. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -1
  108. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +32 -1
  109. package/skills/a2h-batch-ui-align/references/source-only-tier.md +7 -1
  110. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +28 -0
  111. package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +220 -0
  112. package/skills/a2h-batch-ui-align/references/step3-capture.md +11 -9
  113. package/skills/a2h-batch-ui-align/references/step4-prepare.md +13 -8
  114. package/skills/a2h-batch-ui-align/references/step5-convert.md +21 -18
  115. package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +44 -44
  116. package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +237 -236
  117. package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +42 -3854
  118. package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +34 -32
  119. package/skills/a2h-batch-ui-align/scripts/detach.mjs +1 -1
  120. package/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +240 -0
  121. package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +139 -33
  122. package/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
  123. package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +26 -25
  124. package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +1 -1
  125. package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +159 -12
  126. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +145 -21
  127. package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +8 -8
  128. package/skills/a2h-batch-ui-align/scripts/host_env.mjs +1 -1
  129. package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +5 -0
  130. package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +54 -0
  131. package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +228 -0
  132. package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +444 -266
  133. package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +66 -32
  134. package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +141 -57
  135. package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +410 -0
  136. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +80 -0
  137. package/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
  138. package/skills/a2h-batch-ui-align/scripts/static_check/core/findings.ts +21 -0
  139. package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +22 -0
  140. package/skills/a2h-batch-ui-align/scripts/static_check/core/meta.ts +34 -0
  141. package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +668 -0
  142. package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +392 -0
  143. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +167 -0
  144. package/skills/a2h-batch-ui-align/scripts/static_check/package.json +3 -0
  145. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +101 -0
  146. package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
  147. package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
  148. package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
  149. package/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
  150. package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
  151. package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
  152. package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +71 -0
  153. package/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
  154. package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +102 -0
  155. package/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
  156. package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
  157. package/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
  158. package/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
  159. package/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
  160. package/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
  161. package/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
  162. package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
  163. package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
  164. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
  165. package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +310 -0
  166. package/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
  167. package/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
  168. package/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
  169. package/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
  170. package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
  171. package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +64 -0
  172. package/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
  173. package/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
  174. package/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
  175. package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
  176. package/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
  177. package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
  178. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
  179. package/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
  180. package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
  181. package/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
  182. package/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
  183. package/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
  184. package/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
  185. package/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
  186. package/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
  187. package/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
  188. package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
  189. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +68 -0
  190. package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +153 -0
  191. package/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +65 -65
  192. package/skills/a2h-coldstart-smoke-gate/SKILL.md +8 -6
  193. package/skills/a2h-dashboard-render/SKILL.md +15 -7
  194. package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +5 -35
  195. package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +4 -4
  196. package/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
  197. package/skills/a2h-dashboard-render/scripts/check-registry.mjs +17 -17
  198. package/skills/a2h-dashboard-render/scripts/dashboard.css +3546 -0
  199. package/skills/a2h-dashboard-render/scripts/dashboard.mjs +1021 -941
  200. package/skills/a2h-dashboard-render/scripts/device_capture.mjs +104 -65
  201. package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +5 -0
  202. package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +54 -0
  203. package/skills/a2h-dashboard-render/scripts/page_capture.mjs +8 -8
  204. package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +67 -37
  205. package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +4 -4
  206. package/skills/a2h-fix-build-errors/SKILL.md +1 -2
  207. package/skills/a2h-resource-convert/SKILL.md +1 -3
  208. package/skills/a2h-resource-convert/references/step7-report-template.md +2 -2
  209. package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +366 -361
  210. package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +170 -170
  211. package/skills/a2h-resource-convert/scripts/app_identity.ts +162 -162
  212. package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +95 -95
  213. package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +132 -132
  214. package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +220 -220
  215. package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +5 -0
  216. package/skills/a2h-resource-convert/scripts/i18n-term.mjs +54 -0
  217. package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +74 -74
  218. package/skills/a2h-spec-design-pipeline/SKILL.md +113 -63
  219. package/skills/a2h-spec-design-pipeline/references/coding-loop.md +226 -56
  220. package/skills/a2h-spec-design-pipeline/references/execution-model.md +315 -62
  221. package/skills/a2h-spec-design-pipeline/references/final-report-template.md +4 -2
  222. package/skills/a2h-spec-design-pipeline/references/initialization.md +12 -9
  223. package/skills/a2h-spec-design-pipeline/references/legacy-cleanup.md +18 -0
  224. package/skills/a2h-spec-design-pipeline/references/merge-queue.md +109 -8
  225. package/skills/a2h-spec-design-pipeline/references/scripts.md +29 -16
  226. package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +116 -8
  227. package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +179 -0
  228. package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +33 -5
  229. package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +36 -16
  230. package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +93 -0
  231. package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +915 -0
  232. package/skills/a2h-spec-design-pipeline/scripts/dispatch/ledger.mjs +234 -0
  233. package/skills/a2h-spec-design-pipeline/scripts/dispatch/plan.mjs +33 -0
  234. package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +31 -0
  235. package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +94 -0
  236. package/skills/a2h-spec-design-pipeline/scripts/dispatch/state-mirror.mjs +55 -0
  237. package/skills/a2h-spec-design-pipeline/scripts/dispatch/timeouts.mjs +34 -0
  238. package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +92 -0
  239. package/skills/a2h-spec-design-pipeline/scripts/dispatch/waker.mjs +60 -0
  240. package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +89 -0
  241. package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +551 -0
  242. package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +267 -33
  243. package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +30 -10
  244. package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +634 -0
  245. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +5 -0
  246. package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +54 -0
  247. package/skills/a2h-spec-design-pipeline/scripts/lib/io.mjs +33 -0
  248. package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +107 -19
  249. package/skills/a2h-spec-design-pipeline/scripts/stage_design_inputs.ts +79 -0
  250. package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +4 -4
  251. package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +121 -38
  252. package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +58 -11
  253. package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +31 -31
  254. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +564 -0
  255. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +339 -0
  256. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +161 -0
  257. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +1024 -0
  258. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_ledger.mjs +178 -0
  259. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_plan.mjs +60 -0
  260. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +58 -0
  261. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +91 -0
  262. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +60 -0
  263. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_waker.mjs +95 -0
  264. package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_worktree.mjs +81 -0
  265. package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +183 -2
  266. package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +29 -2
  267. package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +294 -0
  268. package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +70 -0
  269. package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +157 -30
  270. package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +2 -2
  271. package/skills/a2h-spec-design-pipeline/scripts/test_stage_design_inputs.ts +72 -0
  272. package/skills/a2h-spec-generate/SKILL.md +34 -10
  273. package/skills/a2h-spec-generate/references/batch-mode.md +4 -1
  274. package/skills/a2h-spec-generate/references/fusion-task-contract.md +90 -21
  275. package/skills/a2h-spec-generate/references/recall-guide.md +1 -0
  276. package/skills/a2h-spec-generate/references/requirement-scope.md +1 -1
  277. package/skills/a2h-spec-generate/references/specs.schema.json +6 -0
  278. package/skills/a2h-spec-generate/references/worker-rules.md +2 -1
  279. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +305 -116
  280. package/skills/a2h-spec-generate/scripts/check_spec.ts +136 -114
  281. package/skills/a2h-spec-generate/scripts/collect-specs.mjs +19 -4
  282. package/skills/a2h-spec-generate/scripts/ensure-index.mjs +74 -14
  283. package/skills/a2h-spec-generate/scripts/feature-stem.mjs +4 -2
  284. package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +5 -0
  285. package/skills/a2h-spec-generate/scripts/i18n-term.mjs +54 -0
  286. package/skills/a2h-spec-generate/scripts/parse_requirements.ts +65 -65
  287. package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +8 -2
  288. package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +8 -2
  289. package/skills/a2h-spec-generate/scripts/publish-specs.mjs +80 -5
  290. package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +670 -0
  291. package/skills/a2h-spec-generate/scripts/render-tasks.mjs +37 -30
  292. package/skills/a2h-spec-generate/scripts/report.mjs +7 -3
  293. package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +26 -26
  294. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +2 -2
  295. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +2 -2
  296. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +4 -4
  297. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +6 -6
  298. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +3 -3
  299. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +23 -23
  300. package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +16 -16
  301. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +27 -26
  302. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +7 -4
  303. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +32 -31
  304. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +3 -2
  305. package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +26 -20
  306. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +92 -69
  307. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +7 -3
  308. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +545 -0
  309. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +545 -0
  310. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +177 -2
  311. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +424 -29
  312. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +133 -7
  313. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +302 -103
  314. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/zip.ts +99 -0
  315. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +5 -0
  316. package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +54 -0
  317. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +8 -0
  318. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +5 -1
  319. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +39 -33
  320. package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +4 -3
  321. package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +4 -0
  322. package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +48 -6
  323. package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +366 -5
  324. package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +102 -3
  325. package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +81 -52
  326. package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +21 -11
  327. package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +2 -1
  328. package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +13 -4
  329. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +2 -2
  330. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +2 -2
  331. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +4 -4
  332. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +6 -6
  333. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +3 -3
  334. package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +16 -16
  335. package/skills/a2h-utg-explorer/assets/final_viewer.html +21 -21
  336. package/skills/a2h-utg-explorer/references/architecture.md +7 -2
  337. package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +108 -9
  338. package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +21 -3
  339. package/skills/a2h-utg-explorer/scripts/hint_check.mjs +4 -1
  340. package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +5 -0
  341. package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +54 -0
  342. package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +229 -0
  343. package/skills/a2h-utg-explorer/scripts/plan.mjs +45 -2
  344. package/skills/a2h-utg-explorer/scripts/recover_b.mjs +2 -1
  345. package/skills/a2h-utg-explorer/scripts/report.mjs +38 -18
  346. package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +9 -2
  347. package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +179 -18
  348. package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +21 -4
  349. package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +449 -42
  350. package/skills/a2h-utg-static/SKILL.md +7 -0
  351. package/skills/a2h-utg-static/scripts/assemble.mjs +29 -2
  352. package/skills/a2h-utg-static/scripts/click_paths.mjs +42 -26
  353. package/skills/a2h-utg-static/scripts/fragment_nav.mjs +4 -2
  354. package/skills/a2h-utg-static/scripts/i18n-term.d.mts +5 -0
  355. package/skills/a2h-utg-static/scripts/i18n-term.mjs +54 -0
  356. package/skills/a2h-utg-static/scripts/manifest.mjs +91 -10
  357. package/skills/a2h-utg-static/scripts/nl_hints.mjs +68 -3
  358. package/skills/a2h-utg-static/scripts/presenter_nav.mjs +2 -1
  359. package/skills/a2h-utg-static/scripts/route_interceptor.mjs +374 -0
  360. package/skills/a2h-utg-static/scripts/static_prior.mjs +87 -33
  361. package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +240 -8
  362. package/skills/a2h-utg-static/scripts/utg_html.mjs +51 -51
  363. package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +100 -100
  364. package/devecocli-plugin/common.ts +0 -2203
  365. package/devecocli-plugin/install.ts +0 -61
  366. package/devecocli-plugin/uninstall.ts +0 -26
  367. package/devecocli-plugin/update.ts +0 -66
  368. package/index.js +0 -1418
  369. package/plugin.jsonc +0 -12
  370. package/skills/a2h-app-migrate/test/test_android_index.mjs +0 -80
  371. package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +0 -63
  372. package/skills/a2h-app-migrate/test/test_arch_done.mjs +0 -54
  373. package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +0 -92
  374. package/skills/a2h-app-migrate/test/test_config_example.mjs +0 -42
  375. package/skills/a2h-app-migrate/test/test_entry_guards.mjs +0 -93
  376. package/skills/a2h-app-migrate/test/test_env_requirements.mjs +0 -544
  377. package/skills/a2h-app-migrate/test/test_finalize.mjs +0 -89
  378. package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +0 -146
  379. package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +0 -68
  380. package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +0 -91
  381. package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -122
  382. package/skills/a2h-app-migrate/test/test_json_io.mjs +0 -32
  383. package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +0 -109
  384. package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +0 -53
  385. package/skills/a2h-app-migrate/test/test_parse_args.mjs +0 -69
  386. package/skills/a2h-app-migrate/test/test_preflight_report.mjs +0 -93
  387. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +0 -144
  388. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +0 -100
  389. package/skills/a2h-app-migrate/test/test_run_dir.mjs +0 -315
  390. package/skills/a2h-app-migrate/test/test_skill_doc.mjs +0 -133
  391. package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +0 -133
  392. package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +0 -158
  393. package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +0 -181
  394. package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +0 -76
  395. package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +0 -53
  396. package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +0 -226
  397. package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +0 -83
  398. package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +0 -39
  399. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +0 -168
  400. package/skills/a2h-app-migrate/test/test_validate_races.mjs +0 -50
  401. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +0 -11
  402. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +0 -12
  403. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +0 -8
  404. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +0 -17
  405. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +0 -3
  406. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +0 -1
  407. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +0 -8
  408. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +0 -14
  409. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +0 -7
  410. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +0 -1
  411. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +0 -3
  412. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +0 -7
  413. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +0 -1
  414. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +0 -3
  415. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +0 -7
  416. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +0 -1
  417. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +0 -3
  418. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +0 -1
  419. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +0 -1
  420. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +0 -7
  421. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +0 -9
  422. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +0 -7
  423. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +0 -10
  424. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +0 -6
  425. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +0 -16
  426. package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +0 -5
  427. package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +0 -548
  428. package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +0 -1122
  429. package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +0 -191
  430. package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +0 -52
  431. package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +0 -34
  432. package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +0 -138
  433. package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +0 -224
  434. package/skills/a2h-batch-ui-align/flowchart.html +0 -271
  435. package/skills/a2h-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -648
  436. package/skills/a2h-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +0 -2089
  437. package/skills/a2h-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +0 -1033
  438. package/skills/a2h-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -1183
  439. package/skills/a2h-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +0 -576
  440. package/skills/a2h-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +0 -297
  441. package/skills/a2h-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +0 -395
  442. package/skills/a2h-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -903
  443. package/skills/a2h-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +0 -106
  444. package/skills/a2h-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -1178
  445. package/skills/a2h-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +0 -911
  446. package/skills/a2h-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -355
  447. package/skills/a2h-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +0 -11
  448. package/skills/a2h-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +0 -206
  449. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +0 -373
  450. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +0 -158
  451. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +0 -750
  452. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +0 -1704
  453. package/skills/a2h-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +0 -1012
  454. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +0 -164
  455. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +0 -840
  456. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +0 -856
  457. package/skills/a2h-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +0 -83
  458. package/skills/a2h-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +0 -294
  459. package/skills/a2h-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +0 -1407
  460. package/skills/a2h-batch-ui-align/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +0 -1220
  461. package/skills/a2h-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +0 -47
  462. package/skills/a2h-batch-ui-align/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +0 -133
  463. package/skills/a2h-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +0 -840
  464. package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +0 -217
  465. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +0 -253
  466. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +0 -312
  467. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +0 -241
  468. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +0 -365
  469. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +0 -298
  470. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +0 -365
  471. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +0 -91
  472. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +0 -473
  473. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +0 -356
  474. package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +0 -290
  475. package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +0 -74
  476. package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +0 -31
  477. package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +0 -564
  478. package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +0 -123
  479. package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +0 -126
  480. package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +0 -241
  481. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +0 -1451
  482. package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +0 -215
  483. package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +0 -95
  484. package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +0 -115
  485. package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +0 -170
  486. package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +0 -102
  487. package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +0 -244
  488. package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +0 -166
  489. package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +0 -49
  490. package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +0 -219
  491. package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +0 -83
  492. package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +0 -1
  493. package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +0 -156
  494. package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +0 -1
  495. package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +0 -1
  496. package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +0 -1
  497. package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +0 -170
  498. package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +0 -99
  499. package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +0 -182
  500. package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +0 -64
  501. package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +0 -1172
  502. package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +0 -251
  503. package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +0 -81
  504. package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +0 -115
  505. package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +0 -303
  506. package/skills/a2h-dashboard-render/test/test_page_capture.mjs +0 -147
  507. package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +0 -444
  508. package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +0 -187
  509. package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +0 -351
  510. package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +0 -495
  511. package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +0 -157
  512. package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +0 -388
  513. package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +0 -182
  514. package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +0 -206
  515. package/skills/a2h-spec-design/test/golden/inspect_happy.json +0 -20
  516. package/skills/a2h-spec-design/test/golden/move_design.md +0 -18
  517. package/skills/a2h-spec-design/test/golden/move_design_crlf.md +0 -18
  518. package/skills/a2h-spec-design/test/golden/move_spec.md +0 -7
  519. package/skills/a2h-spec-design/test/golden/resolve_cases.json +0 -36
  520. package/skills/a2h-spec-design/test/golden/validate_issue_file.md +0 -12
  521. package/skills/a2h-spec-design/test/golden/validate_issues.json +0 -57
  522. package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +0 -381
  523. package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +0 -944
  524. package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +0 -95
  525. package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +0 -218
  526. package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +0 -64
  527. package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +0 -452
  528. package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +0 -182
  529. package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +0 -289
  530. package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +0 -441
  531. package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +0 -50
  532. package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +0 -75
  533. package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +0 -256
  534. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +0 -576
  535. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +0 -290
  536. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +0 -1323
  537. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +0 -574
  538. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +0 -339
  539. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +0 -831
  540. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +0 -548
  541. package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +0 -117
  542. package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +0 -396
  543. package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +0 -175
  544. package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +0 -298
  545. package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +0 -1061
  546. package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +0 -286
  547. package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +0 -25
  548. package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +0 -159
  549. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +0 -632
  550. package/skills/a2h-spec-generate/test/check-spec.test.ts +0 -200
  551. package/skills/a2h-spec-generate/test/collect-specs.test.mjs +0 -538
  552. package/skills/a2h-spec-generate/test/detect-project.test.mjs +0 -37
  553. package/skills/a2h-spec-generate/test/ensure-index.test.mjs +0 -45
  554. package/skills/a2h-spec-generate/test/feature-stem.test.mjs +0 -147
  555. package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +0 -3
  556. package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +0 -3
  557. package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +0 -3
  558. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +0 -9
  559. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +0 -8
  560. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +0 -9
  561. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +0 -1
  562. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +0 -6
  563. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +0 -4
  564. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +0 -1
  565. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +0 -33
  566. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +0 -1
  567. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +0 -23
  568. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +0 -3
  569. package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +0 -8
  570. package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +0 -1
  571. package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +0 -54
  572. package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +0 -157
  573. package/skills/a2h-spec-generate/test/publish-specs.test.mjs +0 -282
  574. package/skills/a2h-spec-generate/test/render-tasks.test.mjs +0 -593
  575. package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +0 -66
  576. package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +0 -45
  577. package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +0 -243
  578. package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +0 -104
  579. package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +0 -223
  580. package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +0 -88
  581. package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +0 -187
  582. package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +0 -130
  583. package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +0 -136
  584. package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +0 -135
  585. package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +0 -16
  586. package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +0 -251
  587. package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +0 -42
  588. package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +0 -162
  589. package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +0 -193
  590. package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +0 -204
  591. package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +0 -355
  592. package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +0 -240
  593. package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +0 -212
  594. package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +0 -173
  595. package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +0 -280
  596. package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +0 -213
  597. package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +0 -345
  598. package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +0 -453
  599. package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +0 -131
  600. package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +0 -229
  601. package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +0 -336
  602. package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +0 -102
  603. package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +0 -92
  604. package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +0 -119
  605. package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +0 -346
  606. package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +0 -112
  607. package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +0 -63
  608. package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +0 -24
  609. package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +0 -28
  610. package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +0 -108
  611. package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +0 -90
  612. package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +0 -61
  613. package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +0 -1261
  614. package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +0 -90
  615. package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +0 -106
  616. package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +0 -58
  617. package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +0 -19
  618. package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +0 -30
  619. package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +0 -103
  620. package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +0 -60
  621. package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +0 -111
  622. package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +0 -113
  623. package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +0 -117
  624. package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +0 -166
  625. package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +0 -112
  626. package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +0 -289
  627. package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +0 -71
  628. package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +0 -77
  629. package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +0 -99
  630. package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +0 -69
  631. package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +0 -96
  632. package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +0 -37
  633. package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +0 -42
  634. package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +0 -140
  635. package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +0 -111
  636. package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +0 -70
  637. package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +0 -69
  638. package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +0 -43
  639. package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +0 -67
  640. package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +0 -38
  641. package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +0 -85
  642. package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +0 -92
  643. package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +0 -55
  644. package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +0 -86
  645. package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +0 -119
  646. package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +0 -68
  647. package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +0 -74
  648. package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +0 -181
  649. package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +0 -293
  650. package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +0 -118
  651. package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +0 -272
  652. package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +0 -51
  653. package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +0 -69
  654. package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +0 -187
  655. package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +0 -70
  656. package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +0 -67
  657. package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +0 -103
  658. package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +0 -79
  659. package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +0 -47
  660. package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +0 -40
  661. package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +0 -84
  662. package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +0 -68
  663. package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +0 -172
  664. package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +0 -33
  665. package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +0 -44
  666. package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +0 -80
  667. package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +0 -35
  668. package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +0 -42
  669. package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +0 -85
  670. package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +0 -57
  671. package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +0 -62
  672. package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +0 -72
  673. package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +0 -86
  674. package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +0 -78
  675. package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +0 -65
  676. package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +0 -172
  677. package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +0 -107
  678. package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +0 -167
  679. package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +0 -117
  680. package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +0 -98
  681. package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +0 -87
  682. package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +0 -183
  683. package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +0 -48
  684. package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +0 -41
  685. package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +0 -126
  686. package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +0 -142
  687. package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +0 -135
  688. package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +0 -66
  689. package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +0 -236
  690. package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +0 -85
  691. package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +0 -148
  692. package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +0 -63
  693. package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +0 -58
  694. package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +0 -41
  695. package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +0 -109
  696. package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +0 -68
  697. package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +0 -127
  698. package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +0 -130
  699. package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +0 -51
  700. package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +0 -81
  701. package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +0 -58
  702. package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +0 -68
  703. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +0 -91
  704. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +0 -110
  705. package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +0 -89
  706. package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +0 -98
  707. package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +0 -231
  708. package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +0 -104
  709. package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +0 -69
  710. package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +0 -346
  711. package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +0 -340
  712. package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +0 -98
  713. package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +0 -92
  714. package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +0 -158
  715. package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +0 -65
@@ -17,11 +17,12 @@ import { Worker } from 'node:worker_threads';
17
17
  import { DeviceCaptureManager } from './device_capture.mjs';
18
18
  import { lookupArtifactRegistry, resolveArtifact } from './artifact_contract.mjs';
19
19
  import { collectUsage, resolveUsageSources } from './usage_readers.mjs';
20
+ import { term, termLang } from './i18n-term.mjs';
20
21
 
21
22
  const usageWorkerUrl = new URL('./usage_worker.mjs', import.meta.url);
22
23
 
23
- // worker 收到的 projects 最小化形状:只需工程根目录——归属(目录/内容
24
- // 匹配)与时间窗口(.hometrans mtime)都从 root 推导。
24
+ // Minimal projects payload the worker receives: only the project root —
25
+ // attribution (directory/content match) and the time window (.hometrans mtimes) are both derived from root.
25
26
  function usageProjectsPayload(projects) {
26
27
  return projects.map((project) => ({ root: project.root }));
27
28
  }
@@ -32,6 +33,10 @@ function exists(file) {
32
33
  try { return fs.existsSync(file); } catch { return false; }
33
34
  }
34
35
 
36
+ function isDirectoryPath(file) {
37
+ try { return fs.statSync(file).isDirectory(); } catch { return false; }
38
+ }
39
+
35
40
  function parseTimestamp(raw) {
36
41
  if (typeof raw === 'number' && Number.isFinite(raw)) {
37
42
  if (raw <= 0) return null;
@@ -81,6 +86,412 @@ function escapeHtml(value) {
81
86
  .replaceAll("'", '&#39;');
82
87
  }
83
88
 
89
+ // --- Display-language layer (board chrome i18n) -----------------------------
90
+ // Board chrome ships in Chinese (zh) and English (en). Data-derived text (page
91
+ // names, spec titles, report quotes) and the file-parsing vocabularies stay
92
+ // as-is; only chrome labels go through tr(). The HTTP layer resolves the
93
+ // language once per request (query > cookie > browser > fallback) and hands it
94
+ // to renderHtml via options.lang; renders are synchronous, so the module-level
95
+ // RENDER_LANG below cannot interleave between requests. The English dictionary
96
+ // is keyed by the exact Chinese source string — zh rendering stays byte-identical.
97
+ // Terminal output (console/throw/--help) is developer-surface text and stays English —
98
+ // no tr() on it; agents bind to the [a2h-dashboard-render] prefix, URLs and exit codes.
99
+ let RENDER_LANG = 'zh';
100
+ const EN_STRINGS = Object.assign(Object.create(null), {
101
+ // shell / nav / header
102
+ 'HomeTrans 转换看板': 'HomeTrans Conversion Dashboard',
103
+ '转换看板': 'Conversion Dashboard',
104
+ '工作空间': 'Workspace',
105
+ '未选择工程': 'No project selected',
106
+ '总览': 'Overview',
107
+ '架构生成': 'Architecture',
108
+ 'UI界面迁移': 'UI Migration',
109
+ '需求规格生成': 'Spec Generation',
110
+ '逻辑代码转换': 'Logic Conversion',
111
+ '收起 / 展开导航': 'Collapse / expand nav',
112
+ '收起导航': 'Collapse nav',
113
+ '展开导航': 'Expand nav',
114
+ '实时 · 30 秒自动刷新': 'Live · auto-refresh every 30s',
115
+ '生成时间:': 'Generated: ',
116
+ '(自动刷新只重新扫描磁盘产物;设备截图只在启动看板命令时采集一次)': ' (auto-refresh rescans artifacts on disk only; device screenshots are captured once at dashboard startup)',
117
+ '切换语言': 'Switch language',
118
+ '切换亮色 / 暗色主题': 'Switch light / dark theme',
119
+ '切换亮色或暗色主题': 'Switch between light and dark themes',
120
+ // shutdown flow
121
+ '停止看板服务': 'Stop dashboard',
122
+ '停止看板服务进程(等价于在启动终端按 Ctrl+C)': 'Stop the dashboard server (equivalent to Ctrl+C in the launching terminal)',
123
+ '确定关闭看板服务吗?关闭后本页面不可用,需到启动看板的终端重新运行命令。': 'Stop the dashboard server? This page becomes unavailable; rerun the command in the launching terminal to view it again.',
124
+ '正在关闭…': 'Stopping…',
125
+ '<strong>看板服务已停止</strong><br>本页面已不可用,可以关闭此标签页。<br><small>如需再次查看,请在启动看板的终端重新运行命令。</small>': '<strong>Dashboard server stopped</strong><br>This page is no longer available; you can close this tab.<br><small>To view it again, rerun the command in the terminal that launched the dashboard.</small>',
126
+ // canonical status vocabulary (buckets -> display words)
127
+ '已完成': 'Done',
128
+ '未完成': 'Pending',
129
+ '进行中': 'In progress',
130
+ '阻塞': 'Blocked',
131
+ '已跳过': 'Skipped',
132
+ '未记录': 'Not recorded',
133
+ '未开始': 'Not started',
134
+ '未生成': 'Not generated',
135
+ // overview
136
+ '总体进度': 'Overall progress',
137
+ ' 步骤完成': ' steps done',
138
+ 'UI 界面迁移': 'UI Migration',
139
+ '转换步骤': 'Conversion steps',
140
+ '查看架构生成详情': 'View architecture details',
141
+ '查看UI界面迁移详情': 'View UI migration details',
142
+ '查看需求规格生成详情': 'View spec generation details',
143
+ '查看逻辑代码转换详情': 'View logic conversion details',
144
+ '数据消耗统计': 'Agent usage',
145
+ 'Agent 用量正在后台线程统计中,稍后自动刷新出现;大会话库首扫可能需要更久。': 'Agent usage is being computed on a background thread and appears after an auto-refresh; the first scan of a large session store can take longer.',
146
+ '统计口径:按会话归属工程目录(启动目录匹配或内容引用),归属会话的全部 Token 计入。': 'Accounting: sessions are attributed to projects by directory (startup path match or content reference); all tokens of an attributed session are counted.',
147
+ '普通输入 Token': 'Input tokens',
148
+ '缓存写入 Token': 'Cache write tokens',
149
+ '缓存读取 Token': 'Cache read tokens',
150
+ '输出 Token': 'Output tokens',
151
+ '推理 Token': 'Reasoning tokens',
152
+ '未含缓存提示词等部分': 'excluding cached prompt portions',
153
+ '该 Agent 未提供时默认为 0': '0 when the agent does not report it',
154
+ '缓存命中部分,按模型缓存价合并': 'cache hits, priced at the model cache rate',
155
+ '模型实际生成内容': 'content actually generated by the model',
156
+ '平台未记录时显示 0': 'shown as 0 when the platform does not record it',
157
+ '平台未提供': 'not provided',
158
+ // stage label maps (values translated at the use site)
159
+ 'UI 设计': 'UI design',
160
+ '页面迁移': 'Page migration',
161
+ '合规检查': 'Compliance check',
162
+ '构建验证': 'Build verification',
163
+ '提交': 'Commit',
164
+ '逻辑开发': 'Logic development',
165
+ '编译构建': 'Build',
166
+ '代码评审循环': 'Code review loop',
167
+ '设计文档': 'Design doc',
168
+ '逻辑转换': 'Logic conversion',
169
+ '语义文档': 'Semantic docs',
170
+ 'Spec 提交': 'Spec commit',
171
+ // architecture tab
172
+ '尚未发现架构设计产物(project_design.md / spec_pipeline_state.json)。请先运行 a2h-arch-generate 或 a2h-spec-design-pipeline 生成架构设计文档。': 'No architecture design artifacts found (project_design.md / spec_pipeline_state.json). Run a2h-arch-generate or a2h-spec-design-pipeline first to generate the architecture design documents.',
173
+ '生成流程': 'Generation flow',
174
+ 'HarmonyOS 目标架构设计': 'HarmonyOS target architecture design',
175
+ '数据库设计': 'Database design',
176
+ 'Preferences 设计': 'Preferences design',
177
+ // ';' stays: the review-round "this round" row still uses it as a separator.
178
+ ';': '; ',
179
+ '尚未生成该阶段的产物文件': 'No artifact files generated for this stage yet',
180
+ // source lines / shared fragments
181
+ '截图缓存目录': 'Capture cache directory',
182
+ '迁移任务来源': 'Migration task source',
183
+ 'Spec 文件': 'Spec file',
184
+ // UI tab
185
+ '真实页面': 'Pages',
186
+ '已迁移': 'Migrated',
187
+ '交互数不一致': 'Marker count mismatch',
188
+ '无可用鸿蒙截图': 'No usable HarmonyOS capture',
189
+ '搜页面标题,如 Main Page(忽略大小写与空格)': 'Search page titles, e.g. Main Page (ignores case and spaces)',
190
+ '按页面标题跳转': 'Jump to page title',
191
+ '跳转': 'Jump',
192
+ ' 只看未完成任务': ' Pending only',
193
+ '← 上一页': '← Prev',
194
+ '上一页': 'Previous page',
195
+ '下一页 →': 'Next →',
196
+ '下一页': 'Next page',
197
+ '支持键盘 ← → 翻页': 'Use ← → keys to page',
198
+ '已缓存设备截图': 'Cached device capture',
199
+ '真实采集缓存': 'Live capture cache',
200
+ '当前筛选条件下没有 UI 迁移任务,请取消“只看未完成”。': 'No UI migration tasks match the current filter; untick "Pending only".',
201
+ '尚未生成 batch_progress.json 或其中没有 UI 迁移任务,也未读取到鸿蒙侧截图缓存。': 'batch_progress.json was not generated or contains no UI migration tasks, and no HarmonyOS capture cache was found.',
202
+ '截图已缓存': ' capture cached',
203
+ '页面任务已完成': 'Page task completed',
204
+ '交互数一致': 'Marker counts match',
205
+ '交互数 ': 'Markers ',
206
+ '未记录截图文件': 'No screenshot file recorded',
207
+ '未记录目标代码文件': 'No target code file recorded',
208
+ '当前设备主动采集': 'Captured from the connected device',
209
+ '正在主动采集': 'Capturing from the connected device',
210
+ '本地缓存回退': 'Local cache fallback',
211
+ '鸿蒙设备': 'HarmonyOS device',
212
+ '鸿蒙侧正在采集,完成后刷新看板即可显示截图。': 'The HarmonyOS side is capturing; refresh the dashboard when it finishes to see the screenshots.',
213
+ '未读取到鸿蒙侧截图缓存': 'No HarmonyOS capture cache was read',
214
+ ':尚未运行过鸿蒙设备采集': ': no HarmonyOS device capture has been run yet',
215
+ '。连接设备并完成采集后刷新看板。': '. Connect a device, finish a capture, and refresh the dashboard.',
216
+ ':': ': ',
217
+ '未读取到该任务对应的': 'No ',
218
+ '截图。': ' screenshot was read for this task.',
219
+ '鸿蒙侧已有其他页面的截图缓存,但该页没有对应截图;按同任务配对规则不做跨任务借用。可重新运行鸿蒙采集覆盖该页,或在看板配置的 ui_hmos_content_map 中为该任务指定截图序号。': 'The HarmonyOS side has capture caches for other pages, but not for this one; the same-task pairing rule never borrows across tasks. Re-run the HarmonyOS capture to cover this page, or assign a capture seq for this task via ui_hmos_content_map in the dashboard config.',
220
+ '迁移前 · ': 'Before migration · ',
221
+ '迁移后 · ': 'After migration · ',
222
+ '(UI 迁移产物)': ' (UI migration artifacts)',
223
+ ' · 去重长图': ' · stitched (dedup)',
224
+ '未找到该页面的 UI 迁移产物截图(ui_info / 迁移采集缓存)': 'No UI migration artifact screenshot found for this page (ui_info / capture cache)',
225
+ '截图校验未通过': ' screenshot validation failed',
226
+ '与源页不完全匹配': 'does not fully match the source page',
227
+ '(首轮内部已重试 ': ' (internal retries in the first round: ',
228
+ ' 次)': ')',
229
+ '。截图已保留在采集缓存中;修复后重新采集并通过校验即可展示。': '. The screenshot was kept in the capture cache; recapture after fixing and pass validation to display it.',
230
+ '缺少 UI 迁移产物截图': 'Missing UI migration artifact screenshot',
231
+ ' 迁移产物截图': ' migration artifact screenshot',
232
+ '截图': ' screenshot',
233
+ ' 帧': ' frames',
234
+ '交互点 · ': 'Markers · ',
235
+ '编号按各侧采集顺序对照,仅表示同号是否存在。': 'Numbers pair by per-side capture order and only indicate whether the same number exists on both sides.',
236
+ '未检测到可交互元素': 'No interactive elements detected',
237
+ '对侧同号存在': 'same number exists on the other side',
238
+ '对侧未找到同号': 'same number not found on the other side',
239
+ // spec tab
240
+ '搜索 ': 'Search ',
241
+ ' 个 Spec': ' specs',
242
+ '搜索 Spec': 'Search specs',
243
+ 'Spec 总览': 'Spec overview',
244
+ ' 场景已完整生成': ' scenarios fully generated',
245
+ '尚未生成场景': 'No scenarios generated',
246
+ '无匹配 Spec': 'No matching specs',
247
+ '已完整生成': 'Fully generated',
248
+ '未完整生成': 'Not fully generated',
249
+ ' 个场景': ' scenarios',
250
+ '场景概述': 'Scenario overview',
251
+ '场景逻辑步骤': 'Scenario logic steps',
252
+ '该 Spec 尚未生成场景。': 'This spec has no scenarios generated yet.',
253
+ '尚未发现 Spec 产物。': 'No spec artifacts found.',
254
+ // logic tab
255
+ '尚未发现分组式流水线产物': 'No grouped-pipeline artifacts found',
256
+ ' 个 Spec 完成': ' specs done',
257
+ '点击只看该阶段未完成的 Spec': 'Click to show only pending specs of this stage',
258
+ '3.1-3.3 已全部处理': '3.1-3.3 all processed',
259
+ ' 个阶段已处理': ' stages processed',
260
+ 'Spec:': 'Spec: ',
261
+ '证据:': 'Evidence: ',
262
+ // scenario evidence 3.1-3.3 and review rounds
263
+ '3.1 场景编码记录': '3.1 Scenario coding record',
264
+ '期望结果:': 'Expected result: ',
265
+ '3.1 编码核对:': '3.1 coding check: ',
266
+ 'coverage-ledger.md 中没有当前场景对应记录': 'No matching record for this scenario in coverage-ledger.md',
267
+ '场景规格(Spec)': 'Scenario spec',
268
+ '触发入口': 'Trigger entry',
269
+ '目标符号 / 调用链': 'Target symbol / call chain',
270
+ '3.2 Spec 编译构建记录': '3.2 Spec build record',
271
+ '尚未开始,未发现步骤三的编译构建报告。': 'Not started: no step-3 build report found.',
272
+ '状态已更新,但当前未发现可读取的编译构建报告。': 'Status updated, but no readable build report was found.',
273
+ '构建时间': 'Build time',
274
+ '构建结束时间': 'Build end time',
275
+ '构建模式': 'Build type',
276
+ '构建命令': 'Build command',
277
+ '总耗时': 'Total duration',
278
+ 'Hvigor 耗时': 'Hvigor duration',
279
+ 'ArkTS 编译': 'ArkTS compile',
280
+ 'HAP 打包': 'HAP package',
281
+ 'HAP 签名': 'HAP signing',
282
+ '编译错误': 'Compile errors',
283
+ '本轮修复错误数': 'Errors fixed this round',
284
+ '编译警告': 'Compile warnings',
285
+ '构建产物': 'Build artifacts',
286
+ '构建报告:': 'Build report: ',
287
+ '该构建结果由本 Spec 下所有场景共享,不表示每个场景被单独构建。': 'This build result is shared by all scenarios of this spec; it does not mean each scenario was built individually.',
288
+ '3.3 Spec 代码评审记录': '3.3 Spec code review record',
289
+ '尚未开始,未发现步骤三的代码评审报告。': 'Not started: no step-3 code review report found.',
290
+ '状态已更新,但当前未发现可读取的代码评审报告。': 'Status updated, but no readable code review report was found.',
291
+ ' 运行期未验证(原始 UNABLE TO VERIFY)': ' runtime-unverified (raw UNABLE TO VERIFY)',
292
+ ',': ', ',
293
+ '已结束(共记录 ': 'Finished (',
294
+ ' 轮)': ' rounds recorded)',
295
+ '评审说明': 'Review notes',
296
+ '未记录结论': 'No verdict recorded',
297
+ '静态评审完成 · 运行期未验证': 'Static review done · runtime unverified',
298
+ '运行期未验证': 'Runtime unverified',
299
+ '原始报告判定': 'Raw report verdict',
300
+ '评审结论': 'Review conclusion',
301
+ '关键差距': 'Key gaps',
302
+ '修复状态': 'Fix status',
303
+ '评审汇总包含该场景,但报告没有提供更细的证据段落。': 'The review summary covers this scenario, but the report provides no finer evidence sections.',
304
+ '评审场景': 'Scenarios reviewed',
305
+ '确认缺陷': 'Confirmed defects',
306
+ '第 ': 'Round ',
307
+ ' 轮逐场景评审': ' — per-scenario review',
308
+ '报告原始判定:': 'Raw report verdict: ',
309
+ '报告原始判定': 'Raw report verdict',
310
+ '静态快照': 'Static snapshot',
311
+ '逐场景评审明细': 'Per-scenario review details',
312
+ '展开场景查看评审依据、未验证项和修复状态': 'Expand a scenario to see its review evidence, unverified items, and fix status',
313
+ '本轮记录:': 'This round: ',
314
+ '3.3 循环状态': '3.3 loop status',
315
+ '最终记录轮次': 'Final recorded round',
316
+ '场景判定汇总': 'Scenario verdict summary',
317
+ '确认问题': 'Confirmed issues',
318
+ '成功修复': 'Successfully fixed',
319
+ '修复失败': 'Fix failed',
320
+ '停止原因': 'Stop reason',
321
+ '已确认并处理的问题': 'Confirmed and handled issues',
322
+ '评审证据文件': 'Review evidence files',
323
+ '阶段是否完成依据 spec_group_{G}/review-round_*/ 下的评审报告判断。UNABLE TO VERIFY 表示静态评审已完成、运行期结果未验证,不表示 3.3 未完成。': 'Stage completion is judged by the review reports under spec_group_{G}/review-round_*/. UNABLE TO VERIFY means the static review finished but runtime results are unverified — it does not mean 3.3 is incomplete.',
324
+ '尚未发现该 Spec 的步骤三产物。': 'No step-3 artifacts found for this spec.',
325
+ '3.1 只展示当前场景的编码记录;3.2~3.3 展示当前 Spec 的共享结果。': "3.1 shows the current scenario's coding record only; 3.2-3.3 show the shared results of the current spec.",
326
+ '当前 Spec 共享结果': 'Current spec shared results',
327
+ '以下构建和评审记录属于当前 Spec,不是其他 Spec,也不是逐场景重复执行。': 'The build and review records below belong to this spec — not to other specs, and not repeated per scenario.',
328
+ });
329
+ const tr = (s) => {
330
+ if (RENDER_LANG !== 'en') return s;
331
+ const exact = EN_STRINGS[s];
332
+ if (exact != null) return exact;
333
+ for (const [pattern, render] of EN_PATTERNS) {
334
+ const match = pattern.exec(s);
335
+ if (match) return render(match);
336
+ }
337
+ return s;
338
+ };
339
+ // Composed strings whose dynamic parts defeat exact dictionary keys.
340
+ const EN_PATTERNS = [
341
+ [/^可点击元素 (\d+)$/, (m) => `Clickable element ${m[1]}`],
342
+ ];
343
+
344
+ // Marker labels are app UI text captured from device dumps (data-derived — they
345
+ // must stay as produced); only the synthetic "可点击元素 N" fallback is board chrome.
346
+ const trMarkerLabel = (s) => {
347
+ if (RENDER_LANG !== 'en') return s;
348
+ for (const [pattern, render] of EN_PATTERNS) {
349
+ const match = pattern.exec(s);
350
+ if (match) return render(match);
351
+ }
352
+ return s;
353
+ };
354
+
355
+ // Scenario names synthesized by parseScenarios ("场景 N" / "场景 N:title", or
356
+ // "Scenario N" / "Scenario N: title" in an English install, via term()) — the
357
+ // numbered prefix is board chrome, the title after the colon is report data.
358
+ // A Chinese install only ever synthesizes the zh form, so the en -> zh direction
359
+ // runs only in an English install and the zh output stays byte-identical.
360
+ const translateScenarioName = (s) => {
361
+ if (RENDER_LANG !== 'en') {
362
+ if (termLang() !== 'en') return s;
363
+ const en = /^Scenario\s*(\d+)\s*(?:[::]\s*(.*))?$/.exec(String(s ?? '').trim());
364
+ if (!en) return s;
365
+ return en[2] ? `场景 ${en[1]}:${en[2]}` : `场景 ${en[1]}`;
366
+ }
367
+ const m = /^(?:场景|Scenario)\s*(\d+)\s*(?:[::]\s*(.*))?$/.exec(String(s ?? '').trim());
368
+ if (!m) return s;
369
+ return m[2] ? `Scenario ${m[1]}: ${m[2]}` : `Scenario ${m[1]}`;
370
+ };
371
+
372
+ // The language toggle writes this cookie client-side; it wins over the browser
373
+ // preference on later visits. ?lang= (bookmarkable) outranks the cookie.
374
+ const LANG_COOKIE = 'dashboard_lang';
375
+
376
+ function langFromAcceptHeader(header) {
377
+ const parts = String(header ?? '')
378
+ .split(',')
379
+ .map((part) => {
380
+ const [tag, ...params] = part.trim().split(';');
381
+ let q = 1;
382
+ for (const param of params) {
383
+ const match = /q=([\d.]+)/.exec(param);
384
+ if (match) {
385
+ const parsed = Number.parseFloat(match[1]);
386
+ if (Number.isFinite(parsed)) q = parsed;
387
+ }
388
+ }
389
+ return { tag: tag.trim().toLowerCase(), q };
390
+ })
391
+ .filter((item) => item.tag && item.q > 0)
392
+ .sort((a, b) => b.q - a.q);
393
+ for (const item of parts) {
394
+ if (item.tag === 'zh' || item.tag.startsWith('zh-')) return 'zh';
395
+ if (item.tag === 'en' || item.tag.startsWith('en-')) return 'en';
396
+ }
397
+ return null;
398
+ }
399
+
400
+ function resolveDisplayLang(url = '', cookieHeader = '', acceptLanguage = '') {
401
+ const query = /[?&]lang=(zh|en)(?:&|$)/.exec(String(url ?? ''));
402
+ if (query) return query[1];
403
+ const cookie = new RegExp(`(?:^|;\\s*)${LANG_COOKIE}=(zh|en)(?:;|$)`).exec(String(cookieHeader ?? ''));
404
+ if (cookie) return cookie[1];
405
+ return langFromAcceptHeader(acceptLanguage) ?? 'zh';
406
+ }
407
+
408
+ // Capture-state captions produced by device_capture.mjs carry dynamic page
409
+ // counts and nested error payloads, so exact-string dictionary keys cannot
410
+ // cover them. The display layer rewrites the known caption shapes; any payload
411
+ // after a colon stays verbatim (it is producer-side debug detail, same as
412
+ // other data-derived text). Unmatched captions fall back to the raw text.
413
+ // device_capture.mjs writes them in the installed language (term()): the en
414
+ // renderings below are exactly the English templates it emits in an English
415
+ // install, so English source text passes through en display unchanged, and
416
+ // CAPTURE_DETAIL_PATTERNS_EN maps it back for zh display.
417
+ const CAPTURE_DETAIL_PATTERNS = [
418
+ // the composed capturing state ends with a fixed suffix — match it first so
419
+ // the payload patterns cannot swallow the suffix
420
+ [/^(.+?),正在主动采集$/, (m) => `${trCaptureDetail(m[1])}, capturing from the connected device`],
421
+ [/^已从当前 HarmonyOS 设备主动采集 (\d+) 个页面$/, (m) => `Captured ${m[1]} page(s) from the connected HarmonyOS device`],
422
+ [/^已从当前 HarmonyOS 设备主动采集 (\d+) 个页面,其中 (\d+) 张与源页不完全匹配(已保留)$/, (m) => `Captured ${m[1]} page(s) from the connected HarmonyOS device, ${m[2]} of them do not fully match the source page (kept)`],
423
+ [/^HarmonyOS 主动采集 (\d+)\/(\d+) 页成功,其余已用缓存$/, (m) => `HarmonyOS capture succeeded for ${m[1]}/${m[2]} page(s); the rest fell back to the local cache`],
424
+ [/^HarmonyOS 采集未能开始:(.+)$/, (m) => `HarmonyOS capture could not start: ${m[1]}`],
425
+ [/^设备采集异常,正在使用本地缓存:(.+)$/, (m) => `Device capture failed; using the local cache: ${m[1]}`],
426
+ [/^未找到 hdc;正在使用本地缓存$/, () => 'hdc not found; using the local cache'],
427
+ [/^hdc 检查失败:(.+)$/, (m) => `hdc check failed: ${m[1]}`],
428
+ [/^已连接:([^,]+)$/, (m) => `Connected: ${m[1]}`],
429
+ [/^未检测到 HarmonyOS 设备;正在使用本地缓存$/, () => 'No HarmonyOS device detected; using the local cache'],
430
+ [/^正在检查 UI 迁移产物截图$/, () => 'Checking UI migration artifact screenshots'],
431
+ [/^正在检查 HDC 设备$/, () => 'Checking HDC devices'],
432
+ [/^使用 UI 迁移产物截图 (\d+)\/(\d+) 个,缺失页面在源端显示占位$/, (m) => `Using ${m[1]}/${m[2]} UI migration artifact screenshot(s); missing pages show a placeholder on the source side`],
433
+ [/^已复用 UI 迁移产物截图 (\d+) 个$/, (m) => `Reused ${m[1]} UI migration artifact screenshot(s)`],
434
+ // validation verdicts (device_capture screenshot validation)
435
+ [/^目标状态文字不符(已定位的 (\d+) 个带文字元素中仅 (\d+) 个与目标一致)$/, (m) => `Target-state text mismatch (${m[1]} text-bearing elements located, only ${m[2]} of them agree with the target)`],
436
+ [/^页面结构与目标状态不符((\d+)\/(\d+) 个元素位置对应)$/, (m) => `Page structure does not match the target state (${m[1]}/${m[2]} element positions correspond)`],
437
+ [/^截图中出现 (\d+) 个不属于目标状态的文字元素((.*)),疑似悬浮层或对话框残留$/, (m) => `The screenshot shows ${m[1]} text element(s) that do not belong to the target state (${m[2]}); likely a leftover overlay or dialog`],
438
+ [/^目标状态缺少可见内容:(.+)$/, (m) => `Target state is missing visible content: ${m[1]}`],
439
+ [/^实际页面为 (.+?),与目标 (.+) 不一致$/, (m) => `The actual page is ${m[1] === '未知页面' ? 'unknown page' : m[1]}, which does not match the target ${m[2]}`],
440
+ [/^前台页面不属于 (.+?)(实际为 (.+?))$/, (m) => `The foreground page does not belong to ${m[1]} (actually ${m[2]})`],
441
+ [/^前台页面不属于 (.+)$/, (m) => `The foreground page does not belong to ${m[1]}`],
442
+ [/^截图出现了其他状态的内容:(.+)$/, (m) => `The screenshot shows content from another state: ${m[1]}`],
443
+ [/^点击后页面结构没有变化,目标页面或弹窗实际未打开$/, () => 'The page structure did not change after the tap; the target page or dialog did not actually open'],
444
+ [/^缺少 meta.json 或截图文件$/, () => 'meta.json or the screenshot file is missing'],
445
+ [/^缺少 meta.json、view.xml 或截图文件$/, () => 'meta.json, view.xml, or the screenshot file is missing'],
446
+ [/^HDC 未返回可校验的 page_name$/, () => 'HDC returned no verifiable page_name'],
447
+ [/^HDC 页面树未返回前台应用 bundle,无法确认截图归属$/, () => 'The HDC page tree returned no foreground app bundle; the screenshot cannot be attributed'],
448
+ ];
449
+
450
+ // English source captions (an English install) rendered for zh display: the
451
+ // inverse of CAPTURE_DETAIL_PATTERNS. Used only in an English install, so a
452
+ // Chinese install's zh display is unchanged.
453
+ const CAPTURE_DETAIL_PATTERNS_EN = [
454
+ [/^(.+?), capturing from the connected device$/, (m) => `${trCaptureDetail(m[1])},正在主动采集`],
455
+ [/^Captured (\d+) page\(s\) from the connected HarmonyOS device$/, (m) => `已从当前 HarmonyOS 设备主动采集 ${m[1]} 个页面`],
456
+ [/^Captured (\d+) page\(s\) from the connected HarmonyOS device, (\d+) of them do not fully match the source page \(kept\)$/, (m) => `已从当前 HarmonyOS 设备主动采集 ${m[1]} 个页面,其中 ${m[2]} 张与源页不完全匹配(已保留)`],
457
+ [/^HarmonyOS capture succeeded for (\d+)\/(\d+) page\(s\); the rest fell back to the local cache$/, (m) => `HarmonyOS 主动采集 ${m[1]}/${m[2]} 页成功,其余已用缓存`],
458
+ [/^HarmonyOS capture could not start: (.+)$/, (m) => `HarmonyOS 采集未能开始:${m[1]}`],
459
+ [/^Device capture failed; using the local cache: (.+)$/, (m) => `设备采集异常,正在使用本地缓存:${m[1]}`],
460
+ [/^hdc not found; using the local cache$/, () => '未找到 hdc;正在使用本地缓存'],
461
+ [/^hdc check failed: (.+)$/, (m) => `hdc 检查失败:${m[1]}`],
462
+ [/^Connected: (.+)$/, (m) => `已连接:${m[1]}`],
463
+ [/^No HarmonyOS device detected; using the local cache$/, () => '未检测到 HarmonyOS 设备;正在使用本地缓存'],
464
+ [/^Checking UI migration artifact screenshots$/, () => '正在检查 UI 迁移产物截图'],
465
+ [/^Checking HDC devices$/, () => '正在检查 HDC 设备'],
466
+ [/^Using (\d+)\/(\d+) UI migration artifact screenshot\(s\); missing pages show a placeholder on the source side$/, (m) => `使用 UI 迁移产物截图 ${m[1]}/${m[2]} 个,缺失页面在源端显示占位`],
467
+ [/^Reused (\d+) UI migration artifact screenshot\(s\)$/, (m) => `已复用 UI 迁移产物截图 ${m[1]} 个`],
468
+ [/^Target-state text mismatch \((\d+) text-bearing elements located, only (\d+) of them agree with the target\)$/, (m) => `目标状态文字不符(已定位的 ${m[1]} 个带文字元素中仅 ${m[2]} 个与目标一致)`],
469
+ [/^Page structure does not match the target state \((\d+)\/(\d+) element positions correspond\)$/, (m) => `页面结构与目标状态不符(${m[1]}/${m[2]} 个元素位置对应)`],
470
+ [/^The screenshot shows (\d+) text element\(s\) that do not belong to the target state \((.*)\); likely a leftover overlay or dialog$/, (m) => `截图中出现 ${m[1]} 个不属于目标状态的文字元素(${m[2]}),疑似悬浮层或对话框残留`],
471
+ [/^Target state is missing visible content: (.+)$/, (m) => `目标状态缺少可见内容:${m[1]}`],
472
+ [/^The actual page is (.+?), which does not match the target (.+)$/, (m) => `实际页面为 ${m[1] === 'unknown page' ? '未知页面' : m[1]},与目标 ${m[2]} 不一致`],
473
+ [/^The foreground page does not belong to (.+?) \(actually (.+?)\)$/, (m) => `前台页面不属于 ${m[1]}(实际为 ${m[2]})`],
474
+ [/^The foreground page does not belong to (.+)$/, (m) => `前台页面不属于 ${m[1]}`],
475
+ [/^The screenshot shows content from another state: (.+)$/, (m) => `截图出现了其他状态的内容:${m[1]}`],
476
+ [/^The page structure did not change after the tap; the target page or dialog did not actually open$/, () => '点击后页面结构没有变化,目标页面或弹窗实际未打开'],
477
+ [/^meta\.json or the screenshot file is missing$/, () => '缺少 meta.json 或截图文件'],
478
+ [/^meta\.json, view\.xml, or the screenshot file is missing$/, () => '缺少 meta.json、view.xml 或截图文件'],
479
+ [/^HDC returned no verifiable page_name$/, () => 'HDC 未返回可校验的 page_name'],
480
+ [/^The HDC page tree returned no foreground app bundle; the screenshot cannot be attributed$/, () => 'HDC 页面树未返回前台应用 bundle,无法确认截图归属'],
481
+ ];
482
+
483
+ function trCaptureDetail(text) {
484
+ const s = String(text ?? '').trim();
485
+ if (!s) return s;
486
+ if (RENDER_LANG !== 'en' && termLang() !== 'en') return s;
487
+ const patterns = RENDER_LANG === 'en' ? CAPTURE_DETAIL_PATTERNS : CAPTURE_DETAIL_PATTERNS_EN;
488
+ for (const [pattern, render] of patterns) {
489
+ const match = pattern.exec(s);
490
+ if (match) return render(match);
491
+ }
492
+ return s;
493
+ }
494
+
84
495
  function readText(file) {
85
496
  try { return fs.readFileSync(file, 'utf8'); } catch { return null; }
86
497
  }
@@ -97,26 +508,20 @@ function firstExisting(candidates) {
97
508
  return candidates.find(exists) ?? null;
98
509
  }
99
510
 
100
- function listFiles(dir, predicate = () => true) {
101
- try {
102
- return fs.readdirSync(dir, { withFileTypes: true })
103
- .filter((entry) => entry.isFile())
104
- .map((entry) => path.join(dir, entry.name))
105
- .filter(predicate);
106
- } catch { return []; }
107
- }
108
-
109
511
  function statusBucket(raw) {
110
512
  const value = String(raw ?? '').trim().toLowerCase();
513
+ // Negative words first: "未通过/不通过" mean failed rather than done, "未完成/尚未…" mean not started rather
514
+ // than done — the positive words (完成/通过) are substrings of them and must be intercepted first.
515
+ if (/fail|error|block|失败|阻塞|未通过|不通过/.test(value)) return 'blocked';
516
+ if (/^(未|暂未|尚未|没)/.test(value)) return 'not_started';
111
517
  if (/^(done|complete|completed|success|passed|pass|ok|implemented|encoded)$/.test(value) || /已完成|完成|通过|已实现|已编码/.test(value)) return 'done';
112
- if (/block|fail|error|阻塞|失败/.test(value)) return 'blocked';
113
518
  if (/running|progress|active|进行|执行中/.test(value)) return 'in_progress';
114
519
  if (/skip|跳过/.test(value)) return 'skipped';
115
520
  return 'not_started';
116
521
  }
117
522
 
118
523
  function statusLabel(bucket) {
119
- return ({ done: '已完成', blocked: '阻塞', in_progress: '进行中', skipped: '已跳过', not_started: '未完成' })[bucket] ?? '未完成';
524
+ return ({ done: tr('已完成'), blocked: tr('阻塞'), in_progress: tr('进行中'), skipped: tr('已跳过'), not_started: tr('未完成') })[bucket] ?? tr('未完成');
120
525
  }
121
526
 
122
527
  function parseArgs(argv) {
@@ -128,6 +533,7 @@ function parseArgs(argv) {
128
533
  else if (token === '--port') { args.port = Number(argv[++i] ?? 8765); args.portExplicit = true; }
129
534
  else if (token === '--once') args.once = true;
130
535
  else if (token === '--out') args.out = argv[++i] ?? '';
536
+ else if (token === '--lang') args.lang = argv[++i] ?? '';
131
537
  else if (token === '--no-open') args.open = false;
132
538
  else if (token === '--codex') args.usageSources.push('codex');
133
539
  else if (token === '--claude-code') args.usageSources.push('claude');
@@ -138,38 +544,44 @@ function parseArgs(argv) {
138
544
  while (argv[i + 1] && !argv[i + 1].startsWith('--')) args.requirements.push(argv[++i]);
139
545
  } else if (token === '--help' || token === '-h') args.help = true;
140
546
  else if (!token.startsWith('--')) args.projects.push(token);
141
- else throw new Error(`不支持的参数:${token}`);
547
+ else throw new Error(`Unsupported argument: ${token}`);
142
548
  }
143
- if (!Number.isInteger(args.port) || args.port < 1 || args.port > 65535) throw new Error(`端口无效:${args.port}`);
549
+ if (!Number.isInteger(args.port) || args.port < 1 || args.port > 65535) throw new Error(`Invalid port: ${args.port}`);
550
+ if (args.lang && args.lang !== 'zh' && args.lang !== 'en') throw new Error(`--lang must be zh or en: ${args.lang}`);
551
+ if (args.lang && !args.once) throw new Error('--lang applies to the --once static export; omit it for the live server.');
144
552
  return args;
145
553
  }
146
554
 
147
555
  function helpText() {
148
- return `HomeTrans Node 看板(Node.js >=22.18.0,不需要 Python)
556
+ return `HomeTrans Node dashboard (Node.js >=22.18.0, no Python required)
149
557
 
150
- 用法:
151
- node dashboard.mjs <Harmony工程...>
558
+ Usage:
559
+ node dashboard.mjs <HarmonyOS project...>
152
560
  node dashboard.mjs --config dashboard.config.json
153
561
  node dashboard.mjs --config dashboard.config.json --port 8765
154
562
  node dashboard.mjs --config dashboard.config.json --once --out dashboard.html
155
563
 
156
- 参数:
157
- --config <file> 读取与 Python 版兼容的 projects 配置
158
- --hmos-hap <file> 单工程模式显式指定工程外的 signed HAP;多工程请在各 project 中配置 hmos_hap
159
- --requirements <...> 显式指定 REQ.txt
160
- --usage-source <id> Agent 用量来源:auto/claude/codex/opencode/deveco/none(可重复)
161
- --claude-code 仅读取 Claude Code,等价于 --usage-source claude
162
- --codex 仅读取 Codex,等价于 --usage-source codex
163
- --opencode 仅读取 OpenCode,等价于 --usage-source opencode
164
- --deveco-code 仅读取 DevEco Code,等价于 --usage-source deveco
165
- --port <number> 动态服务端口,默认 8765;默认端口被占用时自动向后顺延(最多 +20),
166
- 显式 --port 指定的端口被占用则直接报错
167
- --once --out <file> 导出静态看板
168
- --no-open 不自动打开浏览器
169
-
170
- 关闭:
171
- 动态服务可点击页面左下角「停止看板服务」按钮,或在启动终端按 Ctrl+C;
172
- --once 静态导出没有服务进程。`;
564
+ Options:
565
+ --config <file> Read a projects config compatible with the Python version
566
+ --hmos-hap <file> Single-project mode: point at a signed HAP outside the project;
567
+ for multiple projects configure hmos_hap per project
568
+ --requirements <...> REQ.txt files, explicitly
569
+ --usage-source <id> Agent usage sources: auto/claude/codex/opencode/deveco/none (repeatable)
570
+ --claude-code Read Claude Code only; same as --usage-source claude
571
+ --codex Read Codex only; same as --usage-source codex
572
+ --opencode Read OpenCode only; same as --usage-source opencode
573
+ --deveco-code Read DevEco Code only; same as --usage-source deveco
574
+ --port <number> Dynamic server port, default 8765; when the default port is busy the
575
+ server shifts upward automatically (up to +20); an explicitly
576
+ requested busy port fails immediately
577
+ --once --out <file> Export a static dashboard
578
+ --lang <zh|en> Language for the --once static export (default zh); requires --once
579
+ --no-open Do not open the browser automatically
580
+
581
+ Stopping:
582
+ The live server stops via the "Stop dashboard" button in the page's bottom-left
583
+ corner, or Ctrl+C in the launching terminal; --once static export has no server
584
+ process.`;
173
585
  }
174
586
 
175
587
  function pipelineRunContext(root) {
@@ -222,11 +634,11 @@ function loadEntries(args) {
222
634
  if (args.config) {
223
635
  const configPath = path.resolve(args.config);
224
636
  const config = readJson(configPath);
225
- if (!config) throw new Error(`配置文件不是有效的 UTF-8 JSON:${configPath}`);
637
+ if (!config) throw new Error(`Config file is not valid UTF-8 JSON: ${configPath}`);
226
638
  const base = path.dirname(configPath);
227
- const resolveConfiguredPath = (value, key = '配置项') => {
639
+ const resolveConfiguredPath = (value, key = 'Config value') => {
228
640
  if (!value) return '';
229
- if (typeof value !== 'string') throw new Error(`${key} 必须是路径字符串`);
641
+ if (typeof value !== 'string') throw new Error(`${key} must be a path string`);
230
642
  return path.isAbsolute(value) ? value : path.resolve(base, value);
231
643
  };
232
644
  entries = (config.projects ?? []).map((item) => {
@@ -257,14 +669,14 @@ function loadEntries(args) {
257
669
  'specs_json', 'spec_pipeline_state', 'spec_design_dir',
258
670
  ].map((key) => [key, resolveConfiguredPath(config[key], key)]).filter(([, value]) => value));
259
671
  }
260
- if (!entries.length) throw new Error('没有目标工程。请传入工程路径或使用 --config。');
672
+ if (!entries.length) throw new Error('No target projects. Pass project paths or use --config.');
261
673
  for (const entry of entries) {
262
674
  if (!fs.existsSync(path.join(entry.path, '.hometrans'))) {
263
- throw new Error(`鸿蒙工程路径不存在或缺少 .hometrans 目录:${entry.path}`);
675
+ throw new Error(`HarmonyOS project path does not exist or lacks a .hometrans directory: ${entry.path}`);
264
676
  }
265
677
  }
266
678
  if (args.hmosHap) {
267
- if (entries.length !== 1) throw new Error('--hmos-hap 只适用于单工程;多工程请分别配置 projects[].hmos_hap。');
679
+ if (entries.length !== 1) throw new Error('--hmos-hap applies to a single project only; for multiple projects configure hmos_hap per project.');
268
680
  entries[0].hmos_hap = path.resolve(args.hmosHap);
269
681
  }
270
682
  const resolvedEntries = entries.map((entry, index) => inferEntryPaths({
@@ -285,7 +697,7 @@ function loadEntries(args) {
285
697
  ? (path.isAbsolute(entry.hmos_hap) ? entry.hmos_hap : path.resolve(entry.hmos_hap))
286
698
  : '',
287
699
  }));
288
- // utg_static 通过产物契约定位(约定兜底在 device_capture 内)。
700
+ // utg_static is located through the artifact contract (the convention fallback lives inside device_capture).
289
701
  for (const entry of resolvedEntries) {
290
702
  if (!entry.utg_static_dir) {
291
703
  const hit = resolveArtifact('utg_static', { root: entry.path });
@@ -376,16 +788,16 @@ const UI_STAGE_LABELS = {
376
788
  };
377
789
  function uiStageLabel(row) {
378
790
  const current = String(row.current_stage || '').toLowerCase();
379
- if (current && UI_STAGE_LABELS[current]) return UI_STAGE_LABELS[current];
791
+ if (current && UI_STAGE_LABELS[current]) return tr(UI_STAGE_LABELS[current]);
380
792
  if (current) return current;
381
793
  const overall = statusBucket(row.status);
382
- return overall === 'done' ? '已完成' : '未记录';
794
+ return overall === 'done' ? tr('已完成') : tr('未记录');
383
795
  }
384
796
 
385
797
  function findUiProgress(root, entry = {}, config = {}) {
386
798
  const inventory = sourceScreenshotInventory(root, entry);
387
799
  const file = firstExisting([
388
- // 显式配置(entry.ui_info_root 指向的台账)优先于契约默认值。
800
+ // Explicit configuration (the ledger pointed to by entry.ui_info_root) wins over the contract default.
389
801
  path.join(inventory.root, 'batch_progress.json'),
390
802
  resolveArtifact('batch_progress', { root }).found,
391
803
  path.join(root, 'ui_info', 'batch_progress.json'),
@@ -449,30 +861,33 @@ function parseScenarios(text) {
449
861
  const description = body.match(/###\s*(?:场景概述|Scenario\s+(?:Overview|Description))\s*\r?\n+([\s\S]*?)(?=\r?\n###|$)/i)?.[1]?.trim() ?? '';
450
862
  const steps = body.match(/###\s*(?:场景逻辑步骤|Scenario\s+(?:Steps|Logic))\s*\r?\n+([\s\S]*?)(?=\r?\n###|$)/i)?.[1]?.trim() ?? '';
451
863
  const expected = body.match(/###\s*(?:期望结果|预期结果|Expected\s+Result)\s*\r?\n+([\s\S]*?)(?=\r?\n###|$)/i)?.[1]?.trim() ?? description;
452
- return { name: `场景${match[1].trim() || index + 1}`, description, steps, expected, complete: Boolean(description && steps) };
864
+ return { name: term('场景{n}', { n: match[1].trim() || index + 1 }), description, steps, expected, complete: Boolean(description && steps) };
453
865
  });
454
866
 
455
867
  // UTG generate-spec uses one `## 原子场景` section and puts each atomic
456
868
  // scenario under an H3 heading. Keep this parser separate from the legacy
457
869
  // H2 shape so headings such as `### 场景概述` cannot become scenarios.
458
- const atomicStart = /^##\s+原子场景\s*$/im.exec(text);
870
+ // Both languages are read (i18n/terms.json): zh `## 原子场景` / `### 场景 N:<title>`
871
+ // / `语义:` / `触发与流程:` / `签名:`, en `## Atomic Scenarios` / `### Scenario N: <title>`
872
+ // / `Semantics:` / `Trigger and Flow:` / `Signature:` (English numbers are digits only).
873
+ const atomicStart = /^##\s+(?:原子场景|Atomic Scenarios)\s*$/im.exec(text);
459
874
  const atomicBodyStart = atomicStart ? atomicStart.index + atomicStart[0].length : -1;
460
875
  const nextH2 = atomicBodyStart >= 0 ? /^##\s+/m.exec(text.slice(atomicBodyStart)) : null;
461
876
  const atomicSection = atomicBodyStart < 0
462
877
  ? ''
463
878
  : text.slice(atomicBodyStart, nextH2 ? atomicBodyStart + nextH2.index : text.length);
464
- const atomicHeading = /^###\s+场景\s+([^::\r\n]+?)(?:\s*[::]\s*([^\r\n]+))?\s*$/gim;
879
+ const atomicHeading = /^###\s+(?:场景\s+([^::\r\n]+?)|Scenario\s+(\d+))(?:\s*[::]\s*([^\r\n]+))?\s*$/gim;
465
880
  const atomicMatches = [...atomicSection.matchAll(atomicHeading)];
466
881
  return atomicMatches.map((match, index) => {
467
882
  const start = match.index + match[0].length;
468
883
  const end = atomicMatches[index + 1]?.index ?? atomicSection.length;
469
884
  const body = atomicSection.slice(start, end);
470
- const description = body.match(/^语义\s*[::]\s*([^\r\n]+(?:\r?\n(?!\s*(?:触发与流程|签名)\s*[::])[\s\S]*?)?)(?=^\s*(?:触发与流程|签名)\s*[::]|$)/im)?.[1]?.trim() ?? '';
471
- const steps = body.match(/^触发与流程\s*[::]\s*\r?\n+([\s\S]*?)$/im)?.[1]?.trim() ?? '';
472
- const number = match[1].trim() || String(index + 1);
473
- const title = match[2]?.trim();
885
+ const description = body.match(/^(?:语义|Semantics)\s*[::]\s*([^\r\n]+(?:\r?\n(?!\s*(?:触发与流程|签名|Trigger and Flow|Signature)\s*[::])[\s\S]*?)?)(?=^\s*(?:触发与流程|签名|Trigger and Flow|Signature)\s*[::]|$)/im)?.[1]?.trim() ?? '';
886
+ const steps = body.match(/^(?:触发与流程|Trigger and Flow)\s*[::]\s*\r?\n+([\s\S]*?)$/im)?.[1]?.trim() ?? '';
887
+ const number = (match[1] ?? match[2]).trim() || String(index + 1);
888
+ const title = match[3]?.trim();
474
889
  return {
475
- name: title ? `场景 ${number}:${title}` : `场景 ${number}`,
890
+ name: title ? term('场景 {n}:{title}', { n: number, title }) : term('场景 {n}', { n: number }),
476
891
  description,
477
892
  steps,
478
893
  expected: description,
@@ -491,17 +906,24 @@ function specStageStatus(raw) {
491
906
  return 'not_started';
492
907
  }
493
908
 
494
- // 默认跳过的目录名(大小写不敏感)。只覆盖显然不可能放 reqgen 产物的大噪声目录。
909
+ // Directory names skipped by default (case-insensitive): only the obviously noisy directories that can never hold reqgen artifacts.
495
910
  const DEFAULT_SPEC_PRUNE = ['node_modules', 'oh_modules', '.git', '.idea', '.hvigor', 'build', '.cxx', '.preview', '.claude', '.codebuddy', 'entry', 'AppScope', 'hvigor', 'products'];
496
911
 
497
- // 兜底后缀扫描:基座 = registry 声明的 spec_root(若有)+ .hometrans +
498
- // 配置 app_reqgen_dirs 追加目录,取并集。不遍历工程源码树——{root}/specs、
499
- // {root}/spec、hometrans_output/**/spec 这些根层布局已随旧机制删除,skill
500
- // 规定的产物位置都在 .hometrans 或声明/登记的目录里。
501
- function collectSpecMarkdown(root, config = {}, extraBases = []) {
912
+ // Suffix scan: the base set = the registry-declared spec_root (**exclusive**) or the default full
913
+ // .hometrans scan, plus the configured app_reqgen_dirs extras, unioned. Why exclusive: the publish
914
+ // roots in the producer layout all live inside .hometrans, and the same batch of SPECs has sibling
915
+ // copy roots (the page-group root generation/pages and the idx root generation/specs each hold a
916
+ // byte-identical copy) — a full union would collect the same document twice via two paths, and
917
+ // file-level dedup cannot merge different paths. When the declaration exists and is a directory it is
918
+ // the producer's single authoritative SPEC root; when it goes stale (missing / not a directory) fall
919
+ // back to the full .hometrans scan — fallback resilience unchanged. The project source tree is never
920
+ // walked — the root-level layouts {root}/specs, {root}/spec, hometrans_output/**/spec were removed
921
+ // with the old mechanism; the skill's artifact locations all live in .hometrans or declared/registered
922
+ // directories.
923
+ function collectSpecMarkdown(root, config = {}, declaredRoot = null) {
502
924
  const prune = new Set((Array.isArray(config.spec_prune_names) ? config.spec_prune_names : DEFAULT_SPEC_PRUNE).map((s) => String(s).toLowerCase()));
503
925
  const result = [];
504
- const bases = [...extraBases, path.join(root, '.hometrans')];
926
+ const bases = declaredRoot ? [declaredRoot] : [path.join(root, '.hometrans')];
505
927
  for (const raw of (Array.isArray(config.app_reqgen_dirs) ? config.app_reqgen_dirs : [])) {
506
928
  if (!raw) continue;
507
929
  bases.push(path.isAbsolute(raw) ? raw : path.resolve(root, raw));
@@ -522,8 +944,8 @@ function collectSpecMarkdown(root, config = {}, extraBases = []) {
522
944
  if (entry.isDirectory()) {
523
945
  if (!prune.has(entry.name.toLowerCase())) stack.push(full);
524
946
  } else if (entry.isFile() && /-SPEC\.md$/i.test(entry.name)) {
525
- // 基座可能互相嵌套(如声明的 spec_root 在 .hometrans 内部),文件级
526
- // 去重保证同一文档只出现一次。
947
+ // The bases may nest or overlap (e.g. a configured app_reqgen_dirs dir inside .hometrans);
948
+ // file-level dedup guarantees each document appears exactly once.
527
949
  const fileKey = path.resolve(full).toLowerCase();
528
950
  if (seenFiles.has(fileKey)) continue;
529
951
  seenFiles.add(fileKey);
@@ -536,12 +958,16 @@ function collectSpecMarkdown(root, config = {}, extraBases = []) {
536
958
  }
537
959
 
538
960
  function findSpecs(root, specNames = {}, config = {}) {
539
- // SPEC 文档发现:优先 registry 声明的 spec_root(生产者自己声明的根目录,
540
- // 相对工程根),与默认 .hometrans 扫描取并集——声明失效时兜底仍完整覆盖。
541
- // 清单(specs.json / spec_pipeline_state.json)不参与发现——它们只提供
542
- // 进度分母与流水线状态(见 specPipelineModel)。
961
+ // SPEC document discovery: the registry-declared spec_root (the producer's own root, relative to
962
+ // the project root) is **exclusive** — the same batch of SPECs has sibling copy roots (the
963
+ // page-group root + the idx root, both inside .hometrans), so unioning with the full .hometrans
964
+ // scan would collect each document twice via two paths. When the declaration goes stale (missing /
965
+ // not a directory) fall back to the full .hometrans scan — the fallback still covers everything.
966
+ // Manifests (specs.json / spec_pipeline_state.json) do not participate in discovery — they only
967
+ // provide progress denominators and pipeline state (see specPipelineModel).
543
968
  const declared = lookupArtifactRegistry(root, 'spec_root');
544
- const specs = collectSpecMarkdown(root, config, declared ? [declared.path] : []).map((file, index) => {
969
+ const declaredRoot = declared && isDirectoryPath(declared.path) ? declared.path : null;
970
+ const specs = collectSpecMarkdown(root, config, declaredRoot).map((file, index) => {
545
971
  const text = readText(file) ?? '';
546
972
  const scenarios = parseScenarios(text);
547
973
  return {
@@ -581,9 +1007,11 @@ function specPipelineModel(root, specNames = {}, config = {}, legacy = null) {
581
1007
  const specRow = state.specs.find((r) => Number(r['so-id']) === soId);
582
1008
  if (!specRow) return '';
583
1009
  const group = state.groups.find((r) => Number(r.G) === Number(specRow.group));
584
- if (!group || !group.design_file) return '';
585
- return path.isAbsolute(group.design_file) ? group.design_file
586
- : path.join(designDir, group.design_file);
1010
+ if (!group || !Array.isArray(group.chunks)) return '';
1011
+ const chunk = group.chunks.find((c) => Array.isArray(c.spec_ids) && c.spec_ids.includes(soId));
1012
+ if (!chunk || !chunk.design_file) return '';
1013
+ return path.isAbsolute(chunk.design_file) ? chunk.design_file
1014
+ : path.join(designDir, chunk.design_file);
587
1015
  };
588
1016
  const normSpecPath = (file) => path.resolve(file).replace(/\\/g, '/').toLowerCase();
589
1017
  const stateByPath = new Map();
@@ -604,9 +1032,9 @@ function specPipelineModel(root, specNames = {}, config = {}, legacy = null) {
604
1032
 
605
1033
  // No full set available → fall back to state.specs as the whole set, so
606
1034
  // projects without specs.json do not regress (total = state.specs.length).
607
- // state.spec_file 是迁移当时的绝对路径——工程被拷贝/换机后失效。此时按
608
- // 尾部相对结构(…/generation/specs/<batch>/<file>)或文件名在本地
609
- // .hometrans 里重定位,避免整板 0/N 的假进度。
1035
+ // state.spec_file is the absolute path from migration time — it breaks when the project is copied or moved
1036
+ // to another machine. Re-locate the file inside the local .hometrans by the trailing relative structure
1037
+ // (…/generation/specs/<batch>/<file>) or by file name, avoiding a fake 0/N board.
610
1038
  if (!fullSet.length) {
611
1039
  const localSpecRoots = [
612
1040
  path.join(root, '.hometrans', 'app-migrate', 'reqgen', 'generation', 'specs'),
@@ -618,19 +1046,30 @@ function specPipelineModel(root, specNames = {}, config = {}, legacy = null) {
618
1046
  if (!localSpecsByBase.has(base)) localSpecsByBase.set(base, file);
619
1047
  }
620
1048
  const resolveStateSpecFile = (row) => {
621
- const raw = String(row.spec_file || '');
1049
+ // state.spec_file is the absolute path at migration time and may come from another machine / another OS:
1050
+ // path.basename on Linux does not split a Windows backslash path, so the whole string would be used as the file name
1051
+ // and the lookup always misses; normalize to forward slashes before taking the tail and basename.
1052
+ const raw = String(row.spec_file || '').replace(/\\/g, '/');
622
1053
  if (!raw) return '';
623
1054
  if (exists(raw)) return raw;
624
- const marker = '/generation/specs/';
625
- const idx = raw.toLowerCase().lastIndexOf(marker);
626
- const tail = idx >= 0 ? raw.slice(idx + marker.length) : '';
1055
+ // Tail structure markers: both the idx root and the Step 5b page-grouped root are recognized (take the one appearing
1056
+ // last in the path, to support multi-level layouts with generation nested inside a run directory).
1057
+ let tail = '';
1058
+ let tailAt = -1;
1059
+ for (const marker of ['/generation/pages/', '/generation/specs/']) {
1060
+ const at = raw.toLowerCase().lastIndexOf(marker);
1061
+ if (at > tailAt) {
1062
+ tailAt = at;
1063
+ tail = raw.slice(at + marker.length);
1064
+ }
1065
+ }
627
1066
  if (tail) {
628
1067
  for (const localRoot of localSpecRoots) {
629
1068
  const candidate = path.join(localRoot, ...tail.split('/'));
630
1069
  if (exists(candidate)) return candidate;
631
1070
  }
632
1071
  }
633
- return localSpecsByBase.get(path.basename(raw).toLowerCase()) || '';
1072
+ return localSpecsByBase.get(raw.split('/').pop().toLowerCase()) || '';
634
1073
  };
635
1074
  const specs = state.specs.map((row, index) => {
636
1075
  const file = resolveStateSpecFile(row);
@@ -638,7 +1077,7 @@ function specPipelineModel(root, specNames = {}, config = {}, legacy = null) {
638
1077
  const id = `S${Number(row.index) || index + 1}`;
639
1078
  const stages = buildStateStages(row);
640
1079
  // `complete` reflects whether the SPEC.md scenarios are fully authored
641
- // (step 3 — 需求规格生成), NOT whether the conversion pipeline ran.
1080
+ // (step 3 — spec generation), NOT whether the conversion pipeline ran.
642
1081
  // The pipeline status lives in `status`/`pipelineStages` (step 4).
643
1082
  const scenarios = parseScenarios(text);
644
1083
  const complete = scenarios.length > 0 && scenarios.every((scene) => scene.complete);
@@ -681,7 +1120,7 @@ function specPipelineModel(root, specNames = {}, config = {}, legacy = null) {
681
1120
  designFile: String(stateRow.design_file || ''),
682
1121
  group: Number(stateRow.group) || null,
683
1122
  wave: Number((state.groups || []).find((g) => Number(g.G) === Number(stateRow.group))?.wave) || null,
684
- // `complete` = step 3 (需求规格生成) done = SPEC.md scenarios fully
1123
+ // `complete` = step 3 (spec generation) done = SPEC.md scenarios fully
685
1124
  // authored. The pipeline run status is in `status`/`pipelineStages`.
686
1125
  complete: scenarios.length > 0 && scenarios.every((scene) => scene.complete),
687
1126
  };
@@ -795,9 +1234,9 @@ function manifestArktsRowStatus(cells) {
795
1234
  if (/\d{4}-\d{2}-\d{2}T/.test(start)) return 'done';
796
1235
  return 'not_started';
797
1236
  }
798
- // 分组式流水线的波次归属:state.specs[].group → state.groups[].wave →
799
- // {hometrans}/wave_N/。构建证据(HAP + build-fix-report)是波次级的——一次
800
- // 构建覆盖该波次的所有组,在组目录或 per-spec 目录里永远找不到它。
1237
+ // Grouped-pipeline wave attribution: state.specs[].group → state.groups[].wave →
1238
+ // {hometrans}/wave_N/. Build evidence (HAP + build-fix-report) is wave-level — one
1239
+ // build covers every group in the wave; it can never be found in group or per-spec directories.
801
1240
  function waveDirForSpec(root, spec) {
802
1241
  const stateFile = resolveArtifact('spec_pipeline_state', { root }).found
803
1242
  || path.join(root, '.hometrans', 'spec_pipeline_state.json');
@@ -815,11 +1254,11 @@ function waveDirForSpec(root, spec) {
815
1254
  }
816
1255
 
817
1256
  function logicForSpec(root, spec, index, config = {}) {
818
- // 逻辑证据只有一种口径:分组式流水线(a2h-spec-design-pipeline)。
819
- // 归属链全部来自 spec_pipeline_state.json:specs[].group → groups[].wave。
820
- // 3.1 = 组 chunk 提交(commit-info.md);3.2 = 波次构建产物(HAP +
821
- // build-fix-report.md);3.3 = 组评审轮报告(code-review-report.md)。
822
- // 无 group/wave 归属的 Spec:各阶段如实显示未完成。
1257
+ // Logic evidence has exactly one caliber: the grouped pipeline (a2h-spec-design-pipeline).
1258
+ // The attribution chain comes entirely from spec_pipeline_state.json: specs[].group → groups[].wave.
1259
+ // 3.1 = group chunk commit (commit-info.md); 3.2 = wave build artifacts (HAP +
1260
+ // build-fix-report.md); 3.3 = group review-round reports (code-review-report.md).
1261
+ // Specs without a group/wave attribution: every stage honestly shows not done.
823
1262
  const hometrans = path.join(root, '.hometrans');
824
1263
  const group = Number(spec.group) || 0;
825
1264
  const wave = Number(spec.wave) || 0;
@@ -878,7 +1317,7 @@ function captureFrames(dir, preferLong = false) {
878
1317
  .filter((item) => item.isFile() && /^screenshot_scroll_\d+\.(?:png|jpe?g)$/i.test(item.name))
879
1318
  .map((item) => path.join(dir, item.name))
880
1319
  .sort((left, right) => Number(path.basename(left).match(/(\d+)/)?.[1] || 0) - Number(path.basename(right).match(/(\d+)/)?.[1] || 0));
881
- } catch {}
1320
+ } catch { }
882
1321
  return [primary, ...files.filter((file) => path.resolve(file) !== path.resolve(primary))];
883
1322
  }
884
1323
 
@@ -1070,7 +1509,7 @@ function imageSize(file) {
1070
1509
  offset += 2 + segmentLength;
1071
1510
  }
1072
1511
  }
1073
- } catch {}
1512
+ } catch { }
1074
1513
  return { width: 0, height: 0 };
1075
1514
  }
1076
1515
 
@@ -1116,10 +1555,10 @@ function captureMarkers(dir, screenshot) {
1116
1555
  }));
1117
1556
  }
1118
1557
 
1119
- // 爬虫内部工作目录(_attempts、_dyn_tmp_*):内部同样落截图与 meta,
1120
- // 内容信号无法与真实页面区分,必须按名字排除;下划线前缀是爬虫的内部
1121
- // 机制命名,比页面命名稳定得多。点前缀目录(.pending_* 采集暂存等)
1122
- // 同理排除。
1558
+ // Crawler-internal working directories (_attempts, _dyn_tmp_*): they also drop screenshots and meta
1559
+ // files, indistinguishable from real pages by content signal — they must be excluded by name; the
1560
+ // underscore prefix is the crawler's internal naming convention, far more stable than page names. Dot-prefixed
1561
+ // directories (.pending_* capture staging, etc.) are excluded for the same reason.
1123
1562
  const CRAWLER_INTERNAL_DIRS = [/^_attempts$/i, /^_dyn_tmp/i, /^\./];
1124
1563
  function isCrawlerInternalDir(name) {
1125
1564
  return CRAWLER_INTERNAL_DIRS.some((pattern) => pattern.test(String(name || '')));
@@ -1174,36 +1613,17 @@ function findCaptures(entry) {
1174
1613
  for (const captureRoot of roots) {
1175
1614
  let entries = [];
1176
1615
  try { entries = fs.readdirSync(captureRoot, { withFileTypes: true }); } catch { continue; }
1177
- // pages.json is in topological NAVIGATION order (written by a2h-batch-ui-align, or by the
1178
- // removed a2h-utg-crawler in older captures) — that order reflects how pages were discovered (e.g. settings before search
1179
- // because it tapped settings first), NOT a display order. Pairing by that
1180
- // rank misaligns Android source captures against HarmonyOS pages whose
1181
- // sequence follows the app's natural nav (home → search → settings →
1182
- // language/temperature/pressure/wind). So for crawler folders we assign seq
1183
- // from a fixed semantic-priority table that mirrors the HarmonyOS side;
1184
- // pages.json rank is only a fallback for folders the table does not name.
1616
+ // pages.json rank is the seq source for crawler slug dirs (no number in the
1617
+ // name): a2h-batch-ui-align writes it and the HarmonyOS device capture numbers
1618
+ // its pages in the same batch-task order, so both sides land on one seq —
1619
+ // one alignment mechanism, no per-project tables in generic code. Names
1620
+ // missing from pages.json fall to a tail slot.
1185
1621
  const crawlerPages = readJson(path.join(captureRoot, 'pages.json'));
1186
1622
  const crawlerRank = new Map((Array.isArray(crawlerPages?.pages) ? crawlerPages.pages : [])
1187
1623
  .map((row, index) => [path.basename(String(row?.page_dir || '')), index + 1]));
1188
- // Semantic display order (lower = earlier). Mirrors the HarmonyOS capture
1189
- // sequence so an Android source page lands opposite its HarmonyOS twin.
1190
- const SEMANTIC_ORDER = [
1191
- 'activity_MainActivity', // home
1192
- 'dyn_001', // search (SearchMenuFragment twin)
1193
- 'dyn_002', // settings (MainSettingsFragment twin, EN)
1194
- 'dyn_003', // MainFragment host region
1195
- 'pref-dialog_languagePrefs',
1196
- 'pref-dialog_temperaturePrefs',
1197
- 'pref-dialog_airPressurePrefs',
1198
- 'pref-dialog_windSpeedPrefs',
1199
- 'dyn_004', // settings (RU, post-Russian)
1200
- ];
1201
- const semanticRank = new Map(SEMANTIC_ORDER.map((name, index) => [name, index + 1]));
1202
- // Semantic-known dirs are processed first so a crawler-ranked dir can
1203
- // never steal the seq of a dir the semantic table explicitly names; the
1204
- // name tiebreak keeps unknown-named pages in a deterministic order.
1205
- entries.sort((a, b) => (semanticRank.has(b.name) ? 1 : 0) - (semanticRank.has(a.name) ? 1 : 0)
1206
- || a.name.localeCompare(b.name));
1624
+ // Deterministic iteration order; seq comes from the chain below, not from
1625
+ // directory listing order.
1626
+ entries.sort((a, b) => a.name.localeCompare(b.name));
1207
1627
  for (const item of entries) {
1208
1628
  if (!item.isDirectory()) continue;
1209
1629
  if (isCrawlerInternalDir(item.name)) continue;
@@ -1215,18 +1635,16 @@ function findCaptures(entry) {
1215
1635
  // change. Known conventions still donate platform/seq below.
1216
1636
  if (!dual && !legacy && !isCapturePageDir(path.join(captureRoot, item.name))) continue;
1217
1637
  const platform = dual ? dual[1].toLowerCase() : 'android';
1218
- // Crawler slug folders use the semantic table first (stable display
1219
- // order that pairs with HarmonyOS), then pages.json rank, then a tail
1220
- // slot for names no table knows.
1638
+ // Crawler slug folders take pages.json rank (which pairs with the
1639
+ // HarmonyOS capture numbering), then a tail slot for names it omits.
1221
1640
  let seq = Number(dual ? dual[2] : legacy?.[1])
1222
- || semanticRank.get(item.name) || 0
1223
1641
  || crawlerRank.get(item.name) || 0
1224
1642
  || autoSeq++;
1225
1643
  // Two ANDROID/source capture dirs must never share one pairing slot: a
1226
- // slug the semantic table doesn't name (e.g. overlay_windSpeedPrefs) can
1227
- // pick a crawlerRank that collides with a semantic seq and would
1228
- // overwrite the earlier row's screenshot. hmos dirs joining an occupied
1229
- // slot are the intended dual-platform pairing, never a collision.
1644
+ // slug missing from pages.json (e.g. overlay_windSpeedPrefs) falls to the
1645
+ // tail slot and could still collide with a named slug's rank — bump
1646
+ // instead of overwriting the earlier row's screenshot. hmos dirs joining
1647
+ // an occupied slot are the intended dual-platform pairing, never a collision.
1230
1648
  while (pairs.has(String(seq))
1231
1649
  && platform !== 'hmos'
1232
1650
  && pairs.get(String(seq)).source
@@ -1352,6 +1770,20 @@ function taskFriendlyTitle(task) {
1352
1770
  return first || task.id;
1353
1771
  }
1354
1772
 
1773
+ function shortPageName(task) {
1774
+ // The page NAME is the id's X: page_0001_MainActivity -> "MainActivity",
1775
+ // activity_MainActivity -> "MainActivity", dyn_002 -> "002",
1776
+ // pref-dialog_languagePrefs -> "languagePrefs". The summary is page content
1777
+ // notes, not a name — it stays on the slide and in the hover tooltip.
1778
+ const id = String(task.captureOnly ? (task.captureName || task.id) : task.id);
1779
+ const stripped = id
1780
+ .replace(/^page_[0-9]+_/, '')
1781
+ .replace(/^activity_/, '')
1782
+ .replace(/^dyn_/, '')
1783
+ .replace(/^pref-dialog_/, '')
1784
+ .replace(/^pref_/, '');
1785
+ return stripped || id;
1786
+ }
1355
1787
  function evidenceExcerpt(file, limit = 5000) {
1356
1788
  const text = readText(file);
1357
1789
  if (!text) return '';
@@ -1505,6 +1937,7 @@ function reviewScenarioTitleKey(value) {
1505
1937
  return cleanMarkdown(value)
1506
1938
  .replace(/^\s*\d+\s*[.、:]\s*/, '')
1507
1939
  .replace(/^\s*场景\s*[一二三四五六七八九十百零〇0-9]+\s*[::、.]\s*/, '')
1940
+ .replace(/^\s*Scenario\s*\d+\s*[:.]\s*/, '')
1508
1941
  .replace(/[\s`*_,。、“”'"()()::·-]+/g, '')
1509
1942
  .toLowerCase();
1510
1943
  }
@@ -1591,7 +2024,7 @@ function parseReviewScenarios(text) {
1591
2024
  const detail = details.find((item) => item.key && item.key === key) ?? details[index] ?? null;
1592
2025
  return {
1593
2026
  number: valueFor(row, ['#', '编号', '序号']) || String(index + 1),
1594
- name: name || detail?.title || `场景 ${index + 1}`,
2027
+ name: name || detail?.title || term('场景 {n}', { n: index + 1 }),
1595
2028
  result,
1596
2029
  conclusion,
1597
2030
  gap,
@@ -1699,324 +2132,109 @@ function projectModel(entry, specNames, captureState = null, config = entry.dash
1699
2132
 
1700
2133
 
1701
2134
 
1702
-
1703
-
1704
-
1705
-
1706
-
1707
-
1708
-
1709
-
1710
-
1711
-
1712
-
1713
-
1714
-
1715
-
1716
-
1717
-
1718
-
1719
-
1720
-
1721
-
1722
-
1723
-
1724
-
1725
-
1726
- // OpenCode / DevEco Code(opencode 同构发行版)的会话都存在本地 SQLite
1727
- // (~/.local/share/<产品>/xxx.db),session 表自带聚合 token 列——直读比 CLI
1728
- // (session list 按当前目录过滤、逐个 export)覆盖更全:历史会话只有 DB 里查得到。
1729
-
1730
-
1731
-
1732
-
1733
-
1734
-
1735
-
1736
-
1737
-
1738
-
1739
-
2135
+ // OpenCode / DevEco Code (an isomorphic distribution of opencode) both keep sessions in local SQLite
2136
+ // (~/.local/share/<product>/xxx.db) where the session table carries aggregated token columns — reading
2137
+ // the DB directly covers more than the CLI (session list filters by cwd, export is per-session): history is only findable in the DB.
1740
2138
 
1741
2139
 
1742
2140
 
1743
2141
  const ARCHITECTURE_BOARDS = [
1744
- { id: 'project_design', title: 'HarmonyOS \u76ee\u6807\u67b6\u6784\u8bbe\u8ba1', purpose: 'project_design.md\uff1a\u9879\u76ee\u7ed3\u6784\u6811 + \u6a21\u5757\u8bed\u4e49\u8868' },
1745
- { id: 'database_design', title: '\u6570\u636e\u5e93\u8bbe\u8ba1', purpose: 'database_design.md\uff1a\u8868\u7ed3\u6784\u3001\u5b57\u6bb5\u3001\u952e\u7ea6\u675f\uff08\u65e0\u6570\u636e\u5e93\u65f6\u4e3a\u7a7a\u72b6\u6001\u683c\u5f0f\uff09' },
1746
- { id: 'preferences_design', title: 'Preferences \u8bbe\u8ba1', purpose: 'preferences_design.md\uff1a\u952e\u503c\u5b58\u50a8\u7684\u952e\u3001\u7c7b\u578b\u3001\u9ed8\u8ba4\u503c\uff08\u65e0 KV \u5b58\u50a8\u65f6\u4e3a\u7a7a\u72b6\u6001\u683c\u5f0f\uff09' },
1747
- { id: 'analysis_artifacts', title: 'Android \u9879\u76ee\u5206\u6790\u7ed3\u679c\u3001HomeGraph \u8bed\u4e49\u6587\u6863\u3001\u9a8c\u8bc1\u62a5\u544a', purpose: 'scope/inspection/source_homegraph/\u5404\u9a8c\u8bc1\u62a5\u544a' },
2142
+ { id: 'project_design', title: 'HarmonyOS \u76ee\u6807\u67b6\u6784\u8bbe\u8ba1' },
2143
+ { id: 'database_design', title: '\u6570\u636e\u5e93\u8bbe\u8ba1' },
2144
+ { id: 'preferences_design', title: 'Preferences \u8bbe\u8ba1' },
1748
2145
  ]
1749
2146
 
1750
- function validationBucket(report, file = '') {
1751
- if (file && exists(file) && !report) return 'blocked';
1752
- const value = String(report?.validation_status ?? '').toLowerCase();
1753
- if (value === 'incomplete') return 'blocked';
1754
- if (value === 'complete' || value === 'complete_with_warnings') return 'done';
1755
- return 'not_started';
1756
- }
1757
-
1758
2147
  function architectureModel(config = {}) {
1759
- const outputDir = config.architectureOutputDir || '';
1760
- const artifactsDir = config.architectureArtifactsDir || config.architectureOutputDir || '';
1761
- const scopeFile = artifactsDir ? path.join(artifactsDir, 'scope.json') : '';
1762
- // inspection.json is the current name; android_inspection.json the pre-uniapp one.
1763
- const inspectionFile = artifactsDir
1764
- ? [path.join(artifactsDir, 'inspection.json'), path.join(artifactsDir, 'android_inspection.json')].find(exists) || path.join(artifactsDir, 'inspection.json')
1765
- : '';
1766
- const scope = scopeFile ? readJson(scopeFile) : null;
1767
- const inspection = inspectionFile ? readJson(inspectionFile) : null;
1768
- const homegraphDir = artifactsDir ? path.join(artifactsDir, 'source_homegraph') : '';
1769
- const homegraphStatusFile = homegraphDir ? path.join(homegraphDir, 'status.json') : '';
1770
- const homegraphStatus = homegraphStatusFile ? readJson(homegraphStatusFile) : null;
1771
- const reportFiles = {
1772
- homegraph: homegraphDir ? path.join(homegraphDir, 'validation_report.json') : '',
1773
- architecture: artifactsDir ? path.join(artifactsDir, 'architecture_validation_report.json') : '',
1774
- data: artifactsDir ? path.join(artifactsDir, 'data_validation_report.json') : '',
1775
- };
1776
- const reports = Object.fromEntries(Object.entries(reportFiles).map(([key, file]) => [key, file ? readJson(file) : null]));
1777
- const formal = scope?.formal_documents ?? {};
1778
- const projectDesign = formal.project_design || (outputDir ? path.join(outputDir, 'project_design.md') : '');
1779
- const databaseDesign = formal.database_design || (outputDir ? path.join(outputDir, 'database_design.md') : '');
1780
- const preferencesDesign = formal.preferences_design || (outputDir ? path.join(outputDir, 'preferences_design.md') : '');
1781
- const configured = Boolean(scopeFile && exists(scopeFile));
1782
- if (!configured) {
1783
- // === Fallback: spec-driven 新流水线(无旧版 scope.json 等架构产物)===
1784
- // 新流水线的架构生成阶段产出 .hometrans/project_design.md +
1785
- // spec_pipeline_state.json + .hometrans/spec_design/SPEC_DESIGN_N.md,而非旧版
1786
- // scope.json/inspection.json/source_homegraph 那套。探测这些产物,命中则
1787
- // 构造一个 configured 的 architecture 对象,让架构 Tab 与总览进度能显示。
1788
- const root = (Array.isArray(config.entries) && config.entries[0] && config.entries[0].path)
1789
- || config.root
1790
- || (config.architectureOutputDir ? path.resolve(config.architectureOutputDir, '..') : '');
1791
- // Artifact contract: the producers' declared locations are tried before
1792
- // any built-in convention, so a tool that moves its outputs stays
1793
- // recognized by editing the contract file — not this code.
1794
- const ctx = { root: root || '', android: (Array.isArray(config.entries) && config.entries[0] && config.entries[0].android_project_dir) || '' };
1795
- const designHit = resolveArtifact('project_design', ctx);
1796
- const designFound = designHit.found;
1797
- const pipelineStateFile = resolveArtifact('spec_pipeline_state', ctx).found;
1798
- const pipelineState = pipelineStateFile && exists(pipelineStateFile) ? readJson(pipelineStateFile) : null;
1799
- const specDesignDir = config.spec_design_dir
1800
- || resolveArtifact('spec_design_dir', ctx).found
1801
- || (root ? path.join(root, '.hometrans', 'spec_design') : '');
1802
- const specDesignFiles = specDesignDir && exists(specDesignDir)
1803
- ? listFiles(specDesignDir, (file) => /SPEC_DESIGN_\d+\.md$/i.test(path.basename(file)))
1804
- : [];
1805
- // 新流水线的架构生成阶段同样产出 database_design.md / preferences_design.md
1806
- // (无数据库/KV 存储时为规范空状态文档,仍算已生成)。
1807
- const databaseDesignFile = resolveArtifact('database_design', ctx).found;
1808
- const preferencesDesignFile = resolveArtifact('preferences_design', ctx).found;
1809
- const databaseDesignFound = databaseDesignFile && exists(databaseDesignFile) ? databaseDesignFile : '';
1810
- const preferencesDesignFound = preferencesDesignFile && exists(preferencesDesignFile) ? preferencesDesignFile : '';
1811
- if (designFound || pipelineState) {
1812
- // 声明跟随:scope.json 自带 formal_documents(三份设计文档的路径)。
1813
- // 生产方已经声明了位置,看板照着读,而不是再猜一遍。
1814
- const scopeHit = resolveArtifact('scope', ctx);
1815
- const androidScopeFile = scopeHit.found;
1816
- const androidScope = androidScopeFile ? readJson(androidScopeFile) : null;
1817
- const formal = androidScope?.formal_documents && typeof androidScope.formal_documents === 'object' ? androidScope.formal_documents : {};
1818
- const formalPick = (value) => (value && exists(value) ? value : '');
1819
- const designFollowed = formalPick(formal.project_design);
1820
- const designFinal = designFollowed || designFound;
1821
- const databaseFinal = formalPick(formal.database_design) || databaseDesignFound;
1822
- const preferencesFinal = formalPick(formal.preferences_design) || preferencesDesignFound;
1823
- const androidInspectionFile = resolveArtifact('android_inspection', ctx).found;
1824
- const androidInspection = androidInspectionFile && exists(androidInspectionFile) ? readJson(androidInspectionFile) : null;
1825
- const archSummary = (androidInspection && androidInspection.summary && typeof androidInspection.summary === 'object')
1826
- ? androidInspection.summary
1827
- : (androidScope && androidScope.summary && typeof androidScope.summary === 'object')
1828
- ? androidScope.summary : {};
1829
- const contractReportHits = ['architecture_validation_report', 'data_validation_report']
1830
- .map((kind) => resolveArtifact(kind, ctx).found).filter(Boolean);
1831
- const androidArchEvidence = [androidScopeFile, androidInspectionFile, ...contractReportHits].filter(Boolean).filter(exists);
1832
- const evidenceFiles = [
1833
- designFinal,
1834
- databaseFinal,
1835
- preferencesFinal,
1836
- pipelineStateFile,
1837
- ...specDesignFiles,
1838
- ...androidArchEvidence,
1839
- ].filter(Boolean).filter(exists);
1840
- const stages = ARCHITECTURE_BOARDS.map((def) => {
1841
- let status = 'not_started';
1842
- if (def.id === 'project_design') status = designFinal ? 'done' : 'not_started';
1843
- else if (def.id === 'database_design') status = databaseFinal ? 'done' : 'not_started';
1844
- else if (def.id === 'preferences_design') status = preferencesFinal ? 'done' : 'not_started';
1845
- else if (def.id === 'analysis_artifacts') status = androidArchEvidence.length ? 'done' : 'skipped';
1846
- const evidence = def.id === 'project_design'
1847
- ? [designFinal].filter(Boolean)
1848
- : def.id === 'database_design' ? [databaseFinal].filter(Boolean)
2148
+ // Single path: artifact detection for the current tool (spec-driven pipeline) — stage status = whether the design document file exists.
2149
+ const root = (Array.isArray(config.entries) && config.entries[0] && config.entries[0].path)
2150
+ || config.root
2151
+ || (config.architectureOutputDir ? path.resolve(config.architectureOutputDir, '..') : '');
2152
+ // Artifact contract: the producers' declared locations are tried before
2153
+ // any built-in convention, so a tool that moves its outputs stays
2154
+ // recognized by editing the contract file — not this code.
2155
+ const ctx = { root: root || '', android: (Array.isArray(config.entries) && config.entries[0] && config.entries[0].android_project_dir) || '' };
2156
+ const designHit = resolveArtifact('project_design', ctx);
2157
+ const designFound = designHit.found;
2158
+ const pipelineStateFile = resolveArtifact('spec_pipeline_state', ctx).found;
2159
+ const pipelineState = pipelineStateFile && exists(pipelineStateFile) ? readJson(pipelineStateFile) : null;
2160
+ // Without a database / KV store, database/preferences are canonical empty-state documents and still count as generated
2161
+ const databaseDesignFile = resolveArtifact('database_design', ctx).found;
2162
+ const preferencesDesignFile = resolveArtifact('preferences_design', ctx).found;
2163
+ const databaseDesignFound = databaseDesignFile && exists(databaseDesignFile) ? databaseDesignFile : '';
2164
+ const preferencesDesignFound = preferencesDesignFile && exists(preferencesDesignFile) ? preferencesDesignFile : '';
2165
+ if (designFound || pipelineState) {
2166
+ // Declaration following: when the (Android) scope.json carries formal_documents (paths of the three design docs),
2167
+ // read what the producer declared instead of guessing again
2168
+ const scopeHit = resolveArtifact('scope', ctx);
2169
+ const androidScopeFile = scopeHit.found;
2170
+ const androidScope = androidScopeFile ? readJson(androidScopeFile) : null;
2171
+ const formal = androidScope?.formal_documents && typeof androidScope.formal_documents === 'object' ? androidScope.formal_documents : {};
2172
+ const formalPick = (value) => (value && exists(value) ? value : '');
2173
+ const designFinal = formalPick(formal.project_design) || designFound;
2174
+ const databaseFinal = formalPick(formal.database_design) || databaseDesignFound;
2175
+ const preferencesFinal = formalPick(formal.preferences_design) || preferencesDesignFound;
2176
+ const stages = ARCHITECTURE_BOARDS.map((def) => {
2177
+ let status = 'not_started';
2178
+ if (def.id === 'project_design') status = designFinal ? 'done' : 'not_started';
2179
+ else if (def.id === 'database_design') status = databaseFinal ? 'done' : 'not_started';
2180
+ else if (def.id === 'preferences_design') status = preferencesFinal ? 'done' : 'not_started';
2181
+ const evidence = def.id === 'project_design'
2182
+ ? [designFinal].filter(Boolean)
2183
+ : def.id === 'database_design' ? [databaseFinal].filter(Boolean)
1849
2184
  : def.id === 'preferences_design' ? [preferencesFinal].filter(Boolean)
1850
- : def.id === 'analysis_artifacts' ? androidArchEvidence : [];
1851
- return { ...def, status, evidence, caveat: def.id === 'analysis_artifacts' ? (androidArchEvidence.length ? '复用 Android 源工程 a2h-arch-generate 产物(scope.json / android_inspection.json)' : '新流水线不产生 scope/source_homegraph 产物,此阶段按设计跳过') : '' };
1852
- });
1853
- const completed = stages.filter((s) => s.status === 'done' || s.status === 'skipped').length;
1854
- const blocked = stages.some((s) => s.status === 'blocked');
1855
- const overallStatus = blocked ? 'blocked' : (completed === stages.length ? 'done' : completed > 0 ? 'in_progress' : 'not_started');
1856
- const formalDocuments = {
1857
- projectDesign: designFinal,
1858
- databaseDesign: databaseFinal,
1859
- preferencesDesign: preferencesFinal,
1860
- };
1861
- return {
1862
- configured: true,
1863
- source: 'new-pipeline',
1864
- outputDir, artifactsDir,
1865
- scope: androidScope || null, inspection: androidInspection || null,
1866
- stages, completed, total: stages.length,
1867
- overallStatus,
1868
- summary: archSummary,
1869
- selectedModules: [],
1870
- conversionMode: pipelineState?.config?.engine ? String(pipelineState.config.engine) : '',
1871
- packagingMode: '',
1872
- formalDocuments,
1873
- reports,
1874
- evidenceFiles,
1875
- };
1876
- }
1877
- return { configured: false, outputDir, artifactsDir, scope: null, inspection: null, stages: ARCHITECTURE_BOARDS, completed: 0, total: 0, overallStatus: 'not_started', summary: {}, selectedModules: [], conversionMode: '', packagingMode: '', formalDocuments: {}, reports };
1878
- }
1879
- const scopeExists = Boolean(scopeFile && exists(scopeFile));
1880
- const inspectionExists = Boolean(inspectionFile && exists(inspectionFile));
1881
- const inspectionPresent = Number(scopeExists) + Number(inspectionExists);
1882
- const inspectionStatus = (scopeExists && !scope) || (inspectionExists && !inspection)
1883
- ? 'blocked'
1884
- : inspectionPresent === 2 ? 'done' : inspectionPresent ? 'in_progress' : 'not_started';
1885
- // HomeGraph is never required by a2h-arch-generate: failed/unavailable means
1886
- // the run continued with local inspection, so the semantic stage is skipped.
1887
- const homegraphValidation = validationBucket(reports.homegraph, reportFiles.homegraph);
1888
- const homegraphRawStatus = String(homegraphStatus?.status ?? '').toLowerCase();
1889
- let homegraphStageStatus = homegraphValidation;
1890
- if (homegraphValidation === 'not_started' && ['failed', 'unavailable'].includes(homegraphRawStatus)) {
1891
- homegraphStageStatus = 'skipped';
1892
- } else if (homegraphValidation === 'not_started' && ['generated', 'updated', 'reused'].includes(homegraphRawStatus)) {
1893
- homegraphStageStatus = 'in_progress';
2185
+ : [];
2186
+ return { ...def, status, evidence };
2187
+ });
2188
+ const completed = stages.filter((s) => s.status === 'done').length;
2189
+ const overallStatus = completed === stages.length ? 'done' : completed > 0 ? 'in_progress' : 'not_started';
2190
+ const formalDocuments = {
2191
+ projectDesign: designFinal,
2192
+ databaseDesign: databaseFinal,
2193
+ preferencesDesign: preferencesFinal,
2194
+ };
2195
+ return {
2196
+ configured: true,
2197
+ source: 'new-pipeline',
2198
+ stages, completed, total: stages.length,
2199
+ overallStatus,
2200
+ conversionMode: pipelineState?.config?.engine ? String(pipelineState.config.engine) : '',
2201
+ formalDocuments,
2202
+ };
1894
2203
  }
1895
- const targetStatus = validationBucket(reports.architecture, reportFiles.architecture);
1896
- const dataStatus = validationBucket(reports.data, reportFiles.data);
1897
- const boardStatusMap = {
1898
- project_design: targetStatus,
1899
- database_design: dataStatus,
1900
- preferences_design: dataStatus,
1901
- analysis_artifacts: (inspectionStatus === 'done' && (homegraphStageStatus === 'done' || homegraphStageStatus === 'skipped'))
1902
- ? 'done'
1903
- : (inspectionStatus === 'blocked' || homegraphStageStatus === 'blocked') ? 'blocked'
1904
- : (inspectionStatus !== 'not_started' || homegraphStageStatus !== 'not_started') ? 'in_progress'
1905
- : 'not_started',
1906
- };
1907
- // Map each board to its real evidence files on disk
1908
- const homegraphDocsRoot = homegraphStatus?.docs_root
1909
- ? (path.isAbsolute(homegraphStatus.docs_root) ? homegraphStatus.docs_root : path.resolve(homegraphDir, homegraphStatus.docs_root))
1910
- : (homegraphDir ? path.join(homegraphDir, 'docs') : '');
1911
- const homegraphDocs = homegraphDocsRoot
1912
- ? listFiles(homegraphDocsRoot, (file) => file.toLowerCase().endsWith('.md'))
1913
- : [];
1914
- const boardEvidence = {
1915
- project_design: [reportFiles.architecture, projectDesign].filter(Boolean).filter(exists),
1916
- database_design: [reportFiles.data, databaseDesign].filter(Boolean).filter(exists),
1917
- preferences_design: [reportFiles.data, preferencesDesign].filter(Boolean).filter(exists),
1918
- analysis_artifacts: [
1919
- scopeFile, inspectionFile, homegraphStatusFile, reportFiles.homegraph,
1920
- ...homegraphDocs,
1921
- ].filter(Boolean).filter(exists),
1922
- };
1923
- const stages = ARCHITECTURE_BOARDS.map((def) => ({ ...def, status: boardStatusMap[def.id] || 'not_started', evidence: boardEvidence[def.id] || [], caveat: '' }));
1924
- const completed = stages.filter((s) => s.status === 'done' || s.status === 'skipped').length;
1925
- const blocked = stages.some((s) => s.status === 'blocked');
1926
- const overallStatus = blocked ? 'blocked' : (completed === stages.length ? 'done' : completed > 0 ? 'in_progress' : 'not_started');
1927
- const summary = inspection?.summary ?? scope?.summary ?? {};
1928
- const selectedModules = scope?.selected_modules ?? [];
1929
- const conversionMode = scope?.conversion_mode ?? '';
1930
- const packagingMode = scope?.packaging_mode ?? '';
1931
- const formalDocuments = { projectDesign, databaseDesign, preferencesDesign };
1932
- return { configured: true, outputDir, artifactsDir, scope, inspection, stages, completed, total: stages.length, overallStatus, summary, selectedModules, conversionMode, packagingMode, formalDocuments, reports };
2204
+ return { configured: false, stages: ARCHITECTURE_BOARDS, completed: 0, total: 0, overallStatus: 'not_started', conversionMode: '', formalDocuments: {} };
1933
2205
  }
1934
2206
 
2207
+ function tabHero(icon, title, subHtml, ringHtml, tint) {
2208
+ const sub = subHtml ? '<p class="tab-hero-sub">' + subHtml + '</p>' : '';
2209
+ return '<div class="tab-hero' + (tint ? ' tint-' + tint : '') + '"><div class="tab-hero-main"><div class="tab-hero-title"><span class="tab-hero-icon">' + icon
2210
+ + '</span><h2>' + escapeHtml(title) + '</h2></div>' + sub + '</div>' + (ringHtml || '') + '</div>';
2211
+ }
1935
2212
  function renderArchitectureEvidence(evidence) {
1936
- if (!evidence || !evidence.length) return '<div class="arch-evidence-empty">暂无验证证据文件</div>';
2213
+ if (!evidence || !evidence.length) return '<div class="arch-evidence-empty">' + tr('尚未生成该阶段的产物文件') + '</div>';
1937
2214
  return '<div class="arch-evidence">' + evidence.map((file) => '<div class="arch-evidence-file">' + escapeHtml(path.basename(file)) + '<small>' + escapeHtml(file) + '</small></div>').join('') + '</div>';
1938
2215
  }
1939
2216
 
1940
2217
  function renderArchitecture(architecture, projects = []) {
1941
2218
  const arch = architecture || architectureModel();
1942
2219
  if (!arch.configured) {
1943
- return '<section class="tab" id="architecture"><h2>架构生成</h2><div class="card empty">尚未配置架构产物目录。请在 dashboard.config.json 中设置 architecture_output_dir 和 architecture_artifacts_dir。</div>' + '</section>';
2220
+ return '<section class="tab" id="architecture">' + tabHero(ICONS.architecture, tr('架构生成'), tr('尚未发现架构设计产物(project_design.md / spec_pipeline_state.json)。请先运行 a2h-arch-generate 或 a2h-spec-design-pipeline 生成架构设计文档。'), ring(0, 0, '0/0'), '') + '</section>';
1944
2221
  }
1945
- const summary = arch.summary || {};
1946
- const statusText = arch.overallStatus === 'done' ? '全部可验证阶段均已有通过证据。' : arch.overallStatus === 'blocked' ? '存在阻塞报告,请展开对应阶段查看。' : '正在等待架构产物或验证报告继续落盘。';
1947
- const statCards = [
1948
- { label: '入口', value: Number(summary.entry_points || 0) },
1949
- { label: '系统集成', value: Number(summary.system_integrations || 0) },
1950
- { label: '数据库', value: Number(summary.databases || 0) },
1951
- { label: '键值存储', value: Number(summary.preference_stores || 0) },
1952
- ].map((item) => '<div class="arch-stat-card"><strong>' + item.value + '</strong><span>' + item.label + '</span></div>').join('');
1953
- const archCard = '<article class="card arch-overview"><div class="arch-ring-col">' + ring(arch.completed, arch.total, arch.completed + '/' + arch.total) + '</div><div class="arch-info-col"><h3>架构证据门禁</h3><p>' + statusText + '</p><div class="arch-overview-tags">' + badge(arch.overallStatus) + (arch.conversionMode ? '<span>转换模式:' + escapeHtml(arch.conversionMode) + '</span>' : '') + (arch.packagingMode ? '<span>打包模式:' + escapeHtml(arch.packagingMode) + '</span>' : '') + '</div></div><div class="arch-stats-grid">' + statCards + '</div></article>';
1954
- const stageCards = arch.stages.map((stage, index) => '<details class="card arch-stage-card ' + escapeHtml(stage.status) + '" ' + '' + '><summary><span class="arch-stage-index">' + (index + 1) + '</span><span><strong>' + escapeHtml(stage.title) + '</strong><small>' + escapeHtml(stage.purpose) + '</small></span>' + badge(stage.status) + '</summary><div class="arch-stage-body">' + renderArchitectureEvidence(stage.evidence) + '</div></details>').join('');
1955
-
1956
- const formalDocs = arch.formalDocuments || {};
1957
- const docDefs = [
1958
- { name: 'project_design.md', fallbackDesc: '目标项目结构 + 模块语义', fallbackDetail: '定义 HarmonyOS 目录树、模块职责、HAP/HAR/HSP 边界和依赖方向;它是后续 UI 与业务实现共同遵循的架构接口。', file: formalDocs.projectDesign },
1959
- { name: 'database_design.md', fallbackDesc: '数据库设计', fallbackDetail: '记录恢复出的数据库、表、字段、主外键与约束;源项目没有数据库时仍生成规范的空状态文档。', file: formalDocs.databaseDesign },
1960
- { name: 'preferences_design.md', fallbackDesc: '键值存储设计', fallbackDetail: '记录 Preferences、DataStore、MMKV 等存储的键、类型和真实默认值;没有键值存储时生成规范空状态文档。', file: formalDocs.preferencesDesign },
1961
- ];
1962
- const docCards = docDefs.map((item) => {
1963
- const docExists = item.file && exists(item.file);
1964
- let desc = item.fallbackDesc;
1965
- let detail = item.fallbackDetail;
1966
- if (docExists) {
1967
- const text = readText(item.file) ?? '';
1968
- const headings = [...text.matchAll(/^##\s+(.+)$/gm)].map((m) => m[1].trim());
1969
- if (headings.length) desc = headings.join('、');
1970
- const firstHeading = text.match(/^#\s+(.+)$/m);
1971
- if (firstHeading) desc = firstHeading[1].trim();
1972
- // detail: first meaningful line after headings, or first table row count
1973
- const tables = text.match(/\|[^\n]+\|[^\n]*\n\|[-:|\s]+\|/g);
1974
- const rowMatches = text.match(/^\|[^|\n]+\|/gm);
1975
- const rowCount = rowMatches ? rowMatches.length - 1 : 0; // minus header separator
1976
- if (item.name === 'project_design.md') {
1977
- const moduleRows = text.match(/^\|[^|]+\|[^|]+\|/gm);
1978
- const moduleCount = moduleRows ? moduleRows.length - 1 : 0;
1979
- detail = 'HarmonyOS 目录树 + ' + moduleCount + ' 个模块语义行;' + (headings.length ? headings.join('、') : '');
1980
- } else if (item.name === 'database_design.md') {
1981
- const dbMatch = text.match(/\|\s*(.+?)\s*\|\s*(.+?)\s*\|/);
1982
- detail = rowCount > 0 ? rowCount + ' 行数据库表定义' : '空状态文档(源项目没有数据库)';
1983
- } else if (item.name === 'preferences_design.md') {
1984
- const prefStores = [...text.matchAll(/^###\s+(.+)$/gm)].map((m) => m[1].trim());
1985
- const keyRows = text.match(/^\|[^|]+\|[^|]+\|[^|]+\|/gm);
1986
- const keyCount = keyRows ? keyRows.length - 1 : 0;
1987
- detail = (prefStores.length ? prefStores.join('、') + ';' : '') + keyCount + ' 个键值定义';
1988
- }
1989
- }
1990
- return '<article class="arch-doc-card"><div class="arch-doc-head"><strong>' + escapeHtml(item.name) + '</strong>' + badge(docExists ? 'done' : 'not_started', docExists ? '已生成' : '未生成') + '</div><p class="arch-doc-desc">' + escapeHtml(desc) + '</p><p class="arch-doc-detail">' + escapeHtml(detail) + '</p>' + (item.file ? '<div class="arch-doc-file">文件:' + escapeHtml(item.file) + '</div>' : '') + '</article>';
1991
- }).join('');
1992
- const formalBlock = '<h2 class="arch-subtitle">已生成的架构设计文档</h2><div class="arch-doc-grid">' + docCards + '</div>';
1993
-
1994
- const selectedModules = arch.selectedModules || [];
1995
- const modulesText = selectedModules.length ? selectedModules.map((m) => escapeHtml(String(m))).join('、') : '未选择';
1996
- let scopeBlock;
1997
- if (arch.source === 'new-pipeline') {
1998
- // 新流水线:架构设计产物(.hometrans/project_design.md + spec_design 等)+ 复用
1999
- // Android 源工程 a2h-arch-generate 的分析产物(scope.json/android_inspection.json)。
2000
- const newEvidenceDesc = '新流水线(spec-driven)的架构设计证据由 .hometrans/project_design.md、spec_pipeline_state.json(各 spec 的 A/B/B2/C 状态)与 .hometrans/spec_design/SPEC_DESIGN_N.md 构成;入口数、系统集成数等源码分析事实复用 Android 源工程 a2h-arch-generate 产出的 scope.json / android_inspection.json。';
2001
- scopeBlock = '<h2 class="arch-subtitle">架构与设计产物</h2><article class="card arch-scope-card"><p>' + escapeHtml(newEvidenceDesc) + '</p><div class="arch-stage-body">' + renderArchitectureEvidence(arch.evidenceFiles || []) + '</div></article>';
2002
- } else {
2003
- const evidenceDesc = 'scope.json 固定本次分析范围;inspection.json 记录入口、系统能力、原生边界与存储事实;source_homegraph/ 保存基于 HomeGraph 的源码语义恢复结果(不可用时降级为本地分析);各校验报告共同构成进入后续迁移的门禁依据。';
2004
- scopeBlock = '<h2 class="arch-subtitle">同时保存的证据产物</h2><article class="card arch-scope-card"><p>' + escapeHtml(evidenceDesc) + '</p><div class="arch-scope-modules"><strong>已选择 Android 模块:</strong><span>' + modulesText + '</span></div></article>';
2005
- }
2006
-
2007
- return '<section class="tab" id="architecture"><h2>架构生成</h2>' + archCard + '<h2 class="arch-subtitle">生成流程与实时状态</h2><div class="arch-stage-grid">' + stageCards + '</div>' + formalBlock + scopeBlock + '</section>';
2222
+ // Stage cards list only the evidence files; content quality lives in the
2223
+ // arch producers' own validation reports, not in board-side line counts.
2224
+ const stageCards = arch.stages.map((stage, index) => '<details class="card arch-stage-card ' + escapeHtml(stage.status) + '" ' + '' + '><summary><span class="arch-stage-index">' + (index + 1) + '</span><span><strong>' + escapeHtml(tr(stage.title)) + '</strong></span>' + badge(stage.status) + '</summary><div class="arch-stage-body">' + renderArchitectureEvidence(stage.evidence) + '</div></details>').join('');
2225
+ return '<section class="tab" id="architecture">' + tabHero(ICONS.architecture, tr('架构生成'), '', ring(arch.completed, arch.total, arch.completed + '/' + arch.total), '') + '<h2 class="arch-subtitle">' + tr('生成流程') + '</h2><div class="arch-stage-grid">' + stageCards + '</div></section>';
2008
2226
  }
2009
2227
  function logicStageScore(projects) {
2010
2228
  const specs = projects.flatMap((project) => project.spec.specs);
2011
- if (!specs.length) return { stages: [], ratio: 0, done: 0, total: 100 };
2229
+ if (!specs.length) return { stages: [], ratio: 0, done: 0, total: 0, strictDone: 0, specTotal: 0, started: 0 };
2012
2230
  const specTotal = specs.length;
2013
2231
  const stageDoneCount = (id) => specs.filter((spec) => {
2014
2232
  const stage = (spec.pipelineStages || []).find((item) => item.id === id);
2015
2233
  return stage && (stage.status === 'done' || stage.status === 'skipped');
2016
2234
  }).length;
2017
- // B 的完成数与逻辑 Tab 的证据口径一致:该 Spec 的 3.1/3.2/3.3 全部有物证
2018
- // 才算完成——状态文件的 B 是流水线自述,可能与物证脱节(总览与详情页
2019
- // 必须同一依据)。
2235
+ // B's done count shares the logic tab's evidence caliber: the spec counts as done only when 3.1/3.2/3.3 all have
2236
+ // evidence — the state file's B is the pipeline's self-report and can drift from evidence (overview and
2237
+ // detail pages must share one basis).
2020
2238
  const bDone = projects.reduce((sum, project) => sum + (project.logic || [])
2021
2239
  .filter((logic) => (logic.stages || []).length > 0
2022
2240
  && logic.stages.every((stage) => ['done', 'skipped'].includes(stage.status))).length, 0);
@@ -2028,19 +2246,34 @@ function logicStageScore(projects) {
2028
2246
  { id: 'B2', done: stageDoneCount('B2'), total: specTotal, ratio: specTotal ? stageDoneCount('B2') / specTotal : 0 },
2029
2247
  { id: 'C', done: stageDoneCount('C'), total: specTotal, ratio: specTotal ? stageDoneCount('C') / specTotal : 0 },
2030
2248
  ];
2031
- const ratio = stages.reduce((sum, stage) => sum + stage.ratio, 0) / stages.length;
2032
- return { stages, ratio, done: Math.round(ratio * 100), total: 100 };
2249
+ // Strict spec count: a spec counts as logic-converted only when ALL FOUR stages
2250
+ // (A / B / B2 / C) are done — B by its 3.1/3.2/3.3 evidence, the others by state.
2251
+ let strictDone = 0;
2252
+ let started = 0;
2253
+ for (const project of projects) {
2254
+ for (const spec of project.spec.specs) {
2255
+ const stageDone = (id) => {
2256
+ const stage = (spec.pipelineStages || []).find((item) => item.id === id);
2257
+ return Boolean(stage && ['done', 'skipped'].includes(stage.status));
2258
+ };
2259
+ const row = (project.logic || []).find((item) => item.id === spec.id);
2260
+ const bEvidenceDone = Boolean(row && (row.stages || []).length > 0
2261
+ && row.stages.every((stage) => ['done', 'skipped'].includes(stage.status)));
2262
+ if (stageDone('A') && bEvidenceDone && stageDone('B2') && stageDone('C')) strictDone++;
2263
+ // progress caliber: any recognized stage activity (or a 3.x evidence row) means
2264
+ // the spec's logic conversion has begun — the step-status badge must not read a
2265
+ // campaign fully inside stage B as "not started"
2266
+ const anyStageActive = (spec.pipelineStages || []).some((item) => item && ['done', 'skipped', 'in_progress', 'blocked'].includes(item.status));
2267
+ if (anyStageActive || (row && (row.stages || []).length > 0)) started++;
2268
+ }
2269
+ }
2270
+ const ratio = specTotal ? strictDone / specTotal : 0;
2271
+ return { stages, ratio, done: strictDone, total: specTotal, strictDone, specTotal, started };
2033
2272
  }
2034
2273
  function overview(projects, architecture = null) {
2035
2274
  const archCompleted = architecture && architecture.configured ? architecture.completed : 0;
2036
2275
  const archTotal = architecture && architecture.configured ? architecture.total : 0;
2037
2276
  const archRatio = archTotal ? Math.min(1, archCompleted / archTotal) : 0;
2038
- // 门禁链放宽:新流水线(source='new-pipeline')不产生旧版 scope.json 架构产物,
2039
- // 架构步骤视为"不适用"而非"未完成",不锁死后置 UI/Spec/逻辑进度。
2040
- // 已配置旧版架构产物(configured 且 source 非 new-pipeline)的项目走原逻辑。
2041
- const archDone = (architecture && architecture.source === 'new-pipeline')
2042
- ? true
2043
- : (archTotal > 0 && archCompleted >= archTotal);
2044
2277
 
2045
2278
  const uiDoneCount = projects.reduce((sum, project) => sum + Number(project.ui.done || 0), 0);
2046
2279
  const uiTotalCount = projects.reduce((sum, project) => sum + Number(project.ui.total || 0), 0);
@@ -2048,83 +2281,64 @@ function overview(projects, architecture = null) {
2048
2281
  const specTotalCount = projects.reduce((sum, project) => sum + Number(project.spec.total || 0), 0);
2049
2282
  const uiRatio = uiTotalCount ? Math.min(1, uiDoneCount / uiTotalCount) : 0;
2050
2283
  const specRatio = specTotalCount ? Math.min(1, specDoneCount / specTotalCount) : 0;
2051
- const rawLogic = logicStageScore(projects);
2052
- const uiUnlocked = archDone;
2053
- const uiDone = uiTotalCount > 0 && uiDoneCount >= uiTotalCount;
2054
- const specUnlocked = uiUnlocked && uiDone;
2055
- const specDone = specTotalCount > 0 && specDoneCount >= specTotalCount;
2056
- const logicUnlocked = specUnlocked && specDone;
2057
- const effectiveUiRatio = uiUnlocked ? uiRatio : 0;
2058
- const effectiveSpecRatio = specUnlocked ? specRatio : 0;
2059
- const effectiveLogicRatio = logicUnlocked ? rawLogic.ratio : 0;
2060
- const logic = {
2061
- ...rawLogic,
2062
- rawDone: rawLogic.done,
2063
- rawRatio: rawLogic.ratio,
2064
- done: logicUnlocked ? rawLogic.done : 0,
2065
- ratio: effectiveLogicRatio,
2066
- blocked: rawLogic.total > 0 && !logicUnlocked,
2067
- };
2068
- const percentage = Math.round(archRatio * 10 + effectiveUiRatio * 20 + effectiveSpecRatio * 10 + effectiveLogicRatio * 60);
2284
+ const logic = logicStageScore(projects);
2285
+ // Single caliber: every overview progress number comes straight from disk evidence (the same
2286
+ // spec.complete / ui.done as the progress boxes and detail tabs) — no stage-gate zeroing. Step ordering is
2287
+ // expressed only through card order and status badges; the weighted total stays additive with the step cards.
2288
+ const percentage = Math.round(archRatio * 10 + uiRatio * 20 + specRatio * 10 + logic.ratio * 60);
2069
2289
  return {
2070
- archDone,
2071
- arch: { done: archCompleted, total: archTotal, ratio: archRatio, score: archRatio * 10, blocked: archTotal > 0 && !archDone },
2072
- uiDone: uiUnlocked && uiDone,
2073
- specDone: specUnlocked && specDone,
2290
+ arch: { done: archCompleted, total: archTotal, ratio: archRatio, score: archRatio * 10 },
2291
+ uiDone: uiTotalCount > 0 && uiDoneCount >= uiTotalCount,
2292
+ specDone: specTotalCount > 0 && specDoneCount >= specTotalCount,
2074
2293
  ui: {
2075
- done: uiUnlocked ? uiDoneCount : 0,
2076
- rawDone: uiDoneCount,
2294
+ done: uiDoneCount,
2077
2295
  total: uiTotalCount,
2078
- ratio: effectiveUiRatio,
2079
- rawRatio: uiRatio,
2080
- score: effectiveUiRatio * 20,
2081
- blocked: uiTotalCount > 0 && !uiUnlocked,
2296
+ ratio: uiRatio,
2297
+ score: uiRatio * 20,
2082
2298
  },
2083
2299
  spec: {
2084
- done: specUnlocked ? specDoneCount : 0,
2085
- rawDone: specDoneCount,
2300
+ done: specDoneCount,
2086
2301
  total: specTotalCount,
2087
- ratio: effectiveSpecRatio,
2088
- rawRatio: specRatio,
2089
- score: effectiveSpecRatio * 10,
2090
- blocked: specTotalCount > 0 && !specUnlocked,
2302
+ ratio: specRatio,
2303
+ score: specRatio * 10,
2091
2304
  },
2092
2305
  logic,
2093
2306
  percentage,
2094
2307
  };
2095
2308
  }
2096
2309
 
2097
- function badge(status, text = statusLabel(status)) {
2098
- return `<span class="badge ${escapeHtml(status)}">${escapeHtml(text)}</span>`;
2310
+ function badge(status, text = statusLabel(status), title = '') {
2311
+ return `<span class="badge ${escapeHtml(status)}"${title ? ` title="${escapeHtml(title)}"` : ''}>${escapeHtml(text)}</span>`;
2099
2312
  }
2100
2313
 
2101
2314
  function ring(done, total, label) {
2102
2315
  const ratio = total ? Math.max(0, Math.min(1, done / total)) : 0;
2103
- return `<div class="ring ${total ? '' : 'zero'}" style="--p:${ratio * 360}deg"><span>${escapeHtml(label)}</span></div>`;
2316
+ // Long labels (3-4 digit counts) auto-shrink the label font and grow the ring so
2317
+ // the number never overflows the inner circle (hole ≈ ring diameter - 2×inset).
2318
+ const fit = Math.min(18, Math.floor((label.length >= 7 ? 120 : 103) / Math.max(1, label.length)));
2319
+ // Hero rings are one size up (88px ring, 20px label) — same auto-fit idea, hero geometry.
2320
+ const fitHero = Math.min(20, Math.floor(110 / Math.max(1, label.length)));
2321
+ const grow = label.length >= 7 ? ';--ring-d:90px' : '';
2322
+ return `<div class="ring ${total ? '' : 'zero'}" style="--p:${ratio * 360}deg;--ring-fs:${fit}px;--ring-fs-hero:${fitHero}px${grow}"><span>${escapeHtml(label)}</span></div>`;
2104
2323
  }
2105
2324
 
2106
2325
  function sourceLine(label, file) {
2107
- return `<div class="source"><strong>${escapeHtml(label)}:</strong>${file ? escapeHtml(file) : '未生成'}</div>`;
2326
+ return `<div class="source"><strong>${escapeHtml(tr(label))}${tr(':')}</strong>${file ? escapeHtml(file) : tr('未生成')}</div>`;
2108
2327
  }
2109
2328
 
2110
2329
  function stepStatus(done, total) {
2111
- if (!total) return 'not_started';
2330
+ // Read the status straight from the numbers: 0 done → not done; partial → in progress; complete → done
2331
+ if (!total || !done) return 'not_started';
2112
2332
  return done >= total ? 'done' : 'in_progress';
2113
2333
  }
2114
2334
 
2115
- function renderTaskRows(projects) {
2116
- const rows = projects.flatMap((project) => project.ui.tasks.map((task) => ({ project, task })));
2117
- return rows.length ? rows.map(({ project, task }) => `<div class="row"><div><strong>${escapeHtml(taskFriendlyTitle(task))}</strong><small>${escapeHtml(project.name)} · ${escapeHtml(task.id)}${task.output ? ` · ${escapeHtml(task.output)}` : ''}</small></div>${task.captureOnly ? badge('done', '已缓存设备截图') : badge(task.status, task.status === 'done' ? '可展示' : statusLabel(task.status))}</div>`).join('') : '<div class="empty">尚未登记 UI 迁移任务</div>';
2118
- }
2119
-
2120
- function renderSpecRows(projects) {
2121
- const rows = projects.flatMap((project) => project.spec.specs.map((spec) => ({ project, spec })));
2122
- return rows.length ? rows.map(({ project, spec }) => `<div class="row"><div><strong>${escapeHtml(spec.title)}</strong><small>${escapeHtml(project.name)} · ${spec.scenarios.filter((x) => x.complete).length}/${spec.scenarios.length} 个场景完整生成</small></div>${badge(spec.complete ? 'done' : (spec.liveStatus || 'in_progress'), spec.complete ? '已完整生成' : statusLabel(spec.liveStatus || 'in_progress'))}</div>`).join('') : '<div class="empty">尚未发现 Spec</div>';
2123
- }
2124
-
2125
- function renderScenarioRows(projects) {
2126
- const rows = projects.flatMap((project) => project.spec.specs.flatMap((spec) => spec.scenarios.map((scene) => ({ project, spec, scene }))));
2127
- return rows.length ? rows.map(({ spec, scene }) => `<div class="row"><div><strong>${escapeHtml(scene.name)}(${escapeHtml(spec.title)})</strong><small>${escapeHtml(scene.description || '场景概述尚未生成')}</small></div>${badge(scene.complete ? 'done' : 'in_progress', scene.complete ? '已完整生成' : '生成中')}</div>`).join('') : '<div class="empty">尚未生成场景</div>';
2335
+ // Step status uses the progress caliber (any spec activity), not the strict full-chain
2336
+ // completion caliber that rings and weights use — otherwise a campaign fully inside
2337
+ // stage B reads as "not started" while the logic tab shows work in progress.
2338
+ function logicStepStatus(logic) {
2339
+ if (!logic.specTotal) return 'not_started';
2340
+ if (logic.strictDone >= logic.specTotal) return 'done';
2341
+ return logic.started > 0 ? 'in_progress' : 'not_started';
2128
2342
  }
2129
2343
 
2130
2344
  const LOGIC_STAGE_NAMES = {
@@ -2144,50 +2358,26 @@ function logicStageProgress(row) {
2144
2358
  return { done, total: row.stages.length };
2145
2359
  }
2146
2360
 
2147
- function renderStepLedgers(projects, kind, architecture = null) {
2148
- if (kind === 'arch') {
2149
- const arch = architecture || architectureModel();
2150
- if (!arch.configured) return '<div class="step-ledger-row"><strong>架构产物目录</strong><span>未配置 architecture_output_dir / architecture_artifacts_dir</span></div>';
2151
- return arch.stages.map((stage) => `<div class="step-ledger-row"><strong>${escapeHtml(stage.title)}</strong><span>${stage.status === 'done' ? '已通过验证' : stage.status === 'blocked' ? '阻塞' : stage.status === 'in_progress' ? '进行中' : stage.status === 'skipped' ? '已降级跳过' : '未完成'}</span></div>`).join('');
2152
- }
2153
- if (kind === 'ui') {
2154
- return projects.map((project) => `<div class="step-ledger-row"><strong>${escapeHtml(project.name)}</strong><span>${project.ui.done}/${project.ui.total || 0} 个真实页面已修复 · ${project.ui.taskDone || 0}/${project.ui.taskTotal || 0} 条迁移任务完成</span></div>`).join('');
2155
- }
2156
- if (kind === 'spec') {
2157
- return projects.flatMap((project) => project.spec.specs.map((spec) => {
2158
- const done = spec.scenarios.filter((scene) => scene.complete).length;
2159
- return `<div class="step-ledger-row"><strong>${escapeHtml(spec.title)}</strong><span>${done}/${spec.scenarios.length} 个场景完整生成</span></div>`;
2160
- })).join('');
2161
- }
2162
- // 逻辑进度的四个阶段计数直接复用 logicStageScore 的结果(与圆环图同源),
2163
- // 不再独立读 pipelineStages——避免总览内部出现两套数字。
2164
- const stageLabels = { A: '设计文档', B: '逻辑转换', B2: '语义文档', C: 'Spec 提交' };
2165
- const score = logicStageScore(projects);
2166
- const specTotal = score.stages.length ? score.stages[0].total : 0;
2167
- const stageRows = score.stages.map((stage) => {
2168
- return `<div class="step-ledger-row"><strong>Stage ${escapeHtml(stage.id)} · ${stageLabels[stage.id]}</strong><span>${stage.done}/${specTotal || 0} 个 Spec 完成</span></div>`;
2169
- });
2170
- return stageRows.join('');
2171
- }
2172
2361
  function usageNumber(value) {
2173
- return value == null ? '平台未提供' : Number(value).toLocaleString('en-US');
2362
+ return value == null ? tr('平台未提供') : Number(value).toLocaleString('en-US');
2174
2363
  }
2175
2364
 
2176
2365
  function renderConsumption(projects, usages, scanningNote = '') {
2177
- // 只展示“实际用过”的 Agent(有归属会话);没用过的工具不展示。
2366
+ // Show only agents actually used (with attributed sessions); unused tools are not displayed.
2178
2367
  const used = usages.filter((usage) => usage.available && (Number(usage.files) || 0) > 0);
2179
2368
  const usageCards = used.map((usage) => `<div class="usage-agent"><div class="usage-head"><h3>${escapeHtml(usage.label)}</h3></div><div class="metric-grid">
2180
- <div class="metric"><span>普通输入 Token</span><strong>${usageNumber(usage.inputTokens)}</strong><small>未含缓存提示词等部分</small></div>
2181
- <div class="metric"><span>缓存写入 Token</span><strong>${usageNumber(usage.cacheCreationTokens)}</strong><small>该 Agent 未提供时默认为 0</small></div>
2182
- <div class="metric"><span>缓存读取 Token</span><strong>${usageNumber(usage.cacheReadTokens)}</strong><small>缓存命中部分,按模型缓存价合并</small></div>
2183
- <div class="metric"><span>输出 Token</span><strong>${usageNumber(usage.outputTokens)}</strong><small>模型实际生成内容</small></div>
2184
- <div class="metric"><span>推理 Token</span><strong>${usageNumber(usage.reasoningTokens)}</strong><small>平台未记录时显示 0</small></div>
2369
+ <div class="metric"><span>${tr('普通输入 Token')}</span><strong>${usageNumber(usage.inputTokens)}</strong><small>${tr('未含缓存提示词等部分')}</small></div>
2370
+ <div class="metric"><span>${tr('缓存写入 Token')}</span><strong>${usageNumber(usage.cacheCreationTokens)}</strong><small>${tr('该 Agent 未提供时默认为 0')}</small></div>
2371
+ <div class="metric"><span>${tr('缓存读取 Token')}</span><strong>${usageNumber(usage.cacheReadTokens)}</strong><small>${tr('缓存命中部分,按模型缓存价合并')}</small></div>
2372
+ <div class="metric"><span>${tr('输出 Token')}</span><strong>${usageNumber(usage.outputTokens)}</strong><small>${tr('模型实际生成内容')}</small></div>
2373
+ <div class="metric"><span>${tr('推理 Token')}</span><strong>${usageNumber(usage.reasoningTokens)}</strong><small>${tr('平台未记录时显示 0')}</small></div>
2185
2374
  </div></div>`).join('');
2186
2375
  const scanningHtml = scanningNote ? `<p class="usage-note">${escapeHtml(scanningNote)}</p>` : '';
2187
2376
 
2188
- return `<section class="card consumption"><h2>数据消耗统计</h2>${usageCards}${scanningHtml}<p class="usage-note">统计口径:按会话归属工程目录(启动目录匹配或内容引用),归属会话的全部 Token 计入。</p></section>`;
2377
+ return `<section class="card consumption"><h2>${tr('数据消耗统计')}</h2>${usageCards}${scanningHtml}<p class="usage-note">${tr('统计口径:按会话归属工程目录(启动目录匹配或内容引用),归属会话的全部 Token 计入。')}</p></section>`;
2189
2378
  }
2190
2379
 
2380
+ const ICONS = { "overview": "<svg viewBox=\"0 0 24 24\"><rect x=\"4\" y=\"4\" width=\"6\" height=\"6\"/><rect x=\"14\" y=\"4\" width=\"6\" height=\"6\"/><rect x=\"4\" y=\"14\" width=\"6\" height=\"6\"/><rect x=\"14\" y=\"14\" width=\"6\" height=\"6\"/></svg>", "architecture": "<svg viewBox=\"0 0 24 24\"><path d=\"m12 3 8 4-8 4-8-4 8-4Z\"/><path d=\"m4 12 8 4 8-4M4 17l8 4 8-4\"/></svg>", "ui": "<svg viewBox=\"0 0 24 24\"><rect x=\"7\" y=\"2.5\" width=\"10\" height=\"19\" rx=\"2\"/><path d=\"M10 18.5h4\"/></svg>", "spec": "<svg viewBox=\"0 0 24 24\"><circle cx=\"5\" cy=\"12\" r=\"2\"/><circle cx=\"19\" cy=\"6\" r=\"2\"/><circle cx=\"19\" cy=\"18\" r=\"2\"/><path d=\"M7 12h4c3 0 3-6 6-6M11 12c3 0 3 6 6 6\"/></svg>", "logic": "<svg viewBox=\"0 0 24 24\"><path d=\"m8 8-4 4 4 4M16 8l4 4-4 4M14 4l-4 16\"/></svg>", "folder": "<svg viewBox=\"0 0 24 24\"><path d=\"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z\"/></svg>", "collapse": "<svg viewBox=\"0 0 24 24\"><path d=\"m11 17-5-5 5-5M18 17l-5-5 5-5\"/></svg>" };
2191
2381
  function renderOverview(projects, usages, architecture = null, usageScanning = false) {
2192
2382
  const arch = architecture || architectureModel();
2193
2383
  const total = overview(projects, arch);
@@ -2195,35 +2385,39 @@ function renderOverview(projects, usages, architecture = null, usageScanning = f
2195
2385
  const archTotal = arch.configured ? arch.total : 0;
2196
2386
  const uiDone = projects.reduce((sum, project) => sum + project.ui.done, 0);
2197
2387
  const uiTotal = projects.reduce((sum, project) => sum + project.ui.total, 0);
2198
- const uiTaskDone = projects.reduce((sum, project) => sum + Number(project.ui.taskDone || 0), 0);
2199
- const uiTaskTotal = projects.reduce((sum, project) => sum + Number(project.ui.taskTotal || 0), 0);
2200
- const specDone = projects.reduce((sum, project) => sum + project.spec.done, 0);
2201
2388
  const specTotal = projects.reduce((sum, project) => sum + project.spec.total, 0);
2202
- const sceneTotal = projects.reduce((sum, project) => sum + project.spec.specs.reduce((n, spec) => n + spec.scenarios.length, 0), 0);
2203
- const inventoryFallback = projects.some((project) => project.ui.inferredFromInventory);
2204
- const logicProgressCopy = 'A 设计文档 / B 逻辑转换 / B2 语义文档 / C 提交各按 Spec 完成数 / Spec 总数计分,四项各占 25%。';
2205
- const logicFlowCopy = '步骤四按 Stage A→B→B2→C 推进(spec_pipeline_state.json 权威记录这四个值);Stage B 逻辑转换由 a2h-spec-design-pipeline 按 wave 派发,按 3.1 逻辑编码 → 3.2 编译构建 → 3.3 代码评审(Stage 3→3a→3b 评审循环) 推进,评审循环多轮迭代直至收敛。';
2206
- const logicPct = Math.round((total.logic.ratio || 0) * 100);
2389
+ const pctOf = (done, t) => (t ? Math.min(100, Math.round((done / t) * 100)) : 0);
2390
+ const archPct = pctOf(archDone, archTotal);
2391
+ const uiPct = pctOf(uiDone, uiTotal);
2392
+ const specPct = pctOf(total.spec.done, specTotal);
2393
+ const stepStatuses = [stepStatus(archDone, archTotal), stepStatus(uiDone, uiTotal), stepStatus(total.spec.done, specTotal), logicStepStatus(total.logic)];
2394
+ const doneSteps = stepStatuses.filter((s) => s === 'done').length;
2395
+ const overallRun = stepStatuses.every((s) => s === 'done') ? 'done' : (stepStatuses.every((s) => s === 'not_started') ? 'idle' : 'partial');
2396
+ const overallRunLabel = overallRun === 'done' ? tr('已完成') : overallRun === 'idle' ? tr('未开始') : tr('进行中');
2397
+ // Bar count shows the step's weighted-score contribution (achieved% / full weight%), not raw counts:
2398
+ // the four numerators sum to the overall ring (same single-caliber weighted sum as overview()).
2399
+ const fmtScore = (v) => { const r = Math.round(v * 10) / 10; return Number.isInteger(r) ? String(r) : r.toFixed(1); };
2400
+ const oBar = (label, done, t, weight) => `<div class="o-bar"><span class="o-bar-label">${escapeHtml(label)}</span><span class="o-bar-track"><i class="o-bar-fill${stepStatus(done, t) === 'done' ? '' : ' partial'}" style="width:${pctOf(done, t)}%"></i></span><span class="o-bar-count">${fmtScore((t ? done / t : 0) * weight)}% / ${weight}%</span></div>`;
2207
2401
  return `<section class="tab active" id="overview">
2208
- <div class="overall card"><div><h2>总体进度</h2><p>按全局阶段加权:架构生成占 10%,按已验证阶段数/阶段总数计分;UI界面迁移占 20%,按真实可展示页面的已修复数/页面总数计分;需求规格生成占 10%,按已完整生成 Spec 数/Spec 总数计分;逻辑代码转换占 60%,${escapeHtml(logicProgressCopy)}</p></div>${ring(total.percentage, 100, `${total.percentage}%`)}</div>
2209
- <div class="section-heading"><h2>转换步骤</h2><p>步骤一 架构生成 → 步骤二 UI界面迁移 → 步骤三 需求规格生成 → 步骤四 逻辑代码转换;${escapeHtml(logicFlowCopy)}</p></div>
2402
+ <div class="overall card">${ring(total.percentage, 100, `${total.percentage}%`)}<div class="overall-main"><div class="overall-head"><h2>${tr('总体进度')}</h2><span class="run-status run-status--${overallRun}"><i></i>${overallRunLabel}</span><span class="overall-detail">${doneSteps}/4${tr(' 步骤完成')}</span></div><div class="overall-bars">${oBar(tr('架构生成'), archDone, archTotal, 10)}${oBar(tr('UI 界面迁移'), uiDone, uiTotal, 20)}${oBar(tr('需求规格生成'), total.spec.done, specTotal, 10)}${oBar(tr('逻辑代码转换'), total.logic.strictDone, total.logic.specTotal, 60)}</div></div></div>
2403
+ <div class="section-heading"><h2>${tr('转换步骤')}</h2></div>
2210
2404
  <div class="step-grid">
2211
- <article class="card">${ring(archDone, archTotal, `${archDone}/${archTotal || 0}`)}<h3>步骤一 · 架构生成</h3><p>源码架构恢复与 HarmonyOS 目标架构设计;按已通过验证的阶段数/阶段总数计分(范围探测、源码架构、目标设计、数据设计、门禁校验、目录结构)。</p><div class="step-ledger">${renderStepLedgers(projects, 'arch', arch)}</div><button class="outline" onclick="show('architecture')">展开看细节</button><div>${badge(stepStatus(archDone, archTotal))}</div></article>
2212
- <article class="card">${ring(uiDone, uiTotal, `${uiDone}/${uiTotal || 0}`)}<h3>步骤二 · UI界面迁移</h3><p>${inventoryFallback ? 'UTG 未生成 batch_progress.json 时,以 ui_info/index.json 中有基础截图的 page_NNNN_* 作为总页面数;只有逐页台账或已配对的鸿蒙展示证据才增加完成数,滚动帧和交互状态不重复计页。' : '沿用 Python discover_pages_ets 口径:扫描 pages 下页面和 components 下真正整屏的组件,小型复用组件、滚动帧和交互状态不重复计页;按已修复页面数/真实页面总数计分。'}</p><div class="step-ledger">${renderStepLedgers(projects, 'ui')}</div><button class="outline" onclick="show('ui')">展开看细节</button><div>${total.ui.blocked ? badge('not_started', '等待步骤一完成') : badge(stepStatus(uiDone, uiTotal))}</div></article>
2213
- <article class="card">${ring(total.spec.done, specTotal, `${total.spec.done}/${specTotal || 0}`)}<h3>步骤三 · 需求规格生成</h3><p>从需求生成完整 Spec 场景;以场景概述和场景逻辑步骤是否完整为准,并持续显示每个 Spec 的场景完成数。</p><div class="step-ledger">${renderStepLedgers(projects, 'spec')}</div><button class="outline" onclick="show('spec')">展开看细节</button><div>${total.spec.blocked ? badge('not_started', '等待步骤二完成') : badge(stepStatus(total.spec.done, specTotal))}</div></article>
2214
- <article class="card">${ring(logicPct, 100, `${logicPct}%`)}<h3>步骤四 · 逻辑代码转换</h3><p>${escapeHtml(logicProgressCopy)}</p><div class="step-ledger">${renderStepLedgers(projects, 'logic')}</div><button class="outline" onclick="show('logic')">展开看细节</button><div>${total.logic.blocked ? badge('not_started', total.spec.blocked ? '等待步骤三完成' : '等待步骤二完成') : badge(stepStatus(logicPct, 100))}</div></article>
2405
+ <article class="card step-card" role="button" tabindex="0" aria-label="${tr('查看架构生成详情')}" onclick="show('architecture')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();show('architecture')}" title="${tr('查看架构生成详情')}" data-status="${stepStatus(archDone, archTotal)}"><div class="step-head"><span class="step-no">01</span><span class="step-icon">${ICONS.architecture}</span><h3>${tr('架构生成')}</h3>${ring(archDone, archTotal, `${archDone}/${archTotal || 0}`)}</div></article>
2406
+ <article class="card step-card" role="button" tabindex="0" aria-label="${tr('查看UI界面迁移详情')}" onclick="show('ui')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();show('ui')}" title="${tr('查看UI界面迁移详情')}" data-status="${stepStatus(uiDone, uiTotal)}"><div class="step-head"><span class="step-no">02</span><span class="step-icon orange">${ICONS.ui}</span><h3>${tr('UI界面迁移')}</h3>${ring(uiDone, uiTotal, `${uiDone}/${uiTotal || 0}`)}</div></article>
2407
+ <article class="card step-card" role="button" tabindex="0" aria-label="${tr('查看需求规格生成详情')}" onclick="show('spec')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();show('spec')}" title="${tr('查看需求规格生成详情')}" data-status="${stepStatus(total.spec.done, specTotal)}"><div class="step-head"><span class="step-no">03</span><span class="step-icon">${ICONS.spec}</span><h3>${tr('需求规格生成')}</h3>${ring(total.spec.done, specTotal, `${total.spec.done}/${specTotal || 0}`)}</div></article>
2408
+ <article class="card step-card" role="button" tabindex="0" aria-label="${tr('查看逻辑代码转换详情')}" onclick="show('logic')" onkeydown="if(event.key==='Enter'||event.key===' '){event.preventDefault();show('logic')}" title="${tr('查看逻辑代码转换详情')}" data-status="${logicStepStatus(total.logic)}"><div class="step-head"><span class="step-no">04</span><span class="step-icon orange">${ICONS.logic}</span><h3>${tr('逻辑代码转换')}</h3>${ring(total.logic.strictDone, total.logic.specTotal, `${total.logic.strictDone}/${total.logic.specTotal || 0}`)}</div></article>
2215
2409
  </div>
2216
- <div class="progress-grid"><article class="card compact"><h2>UI 迁移任务进度</h2><p class="lead">真实可展示页面修复进度 ${uiDone}/${uiTotal || 0};${inventoryFallback ? `UTG 页面快照任务 ${uiTaskDone}/${uiTaskTotal || 0} 已有完成证据。` : `batch_progress.json 任务记录 ${uiTaskDone}/${uiTaskTotal || 0} 完成。`}</p><div class="scroll-list">${renderTaskRows(projects)}</div></article><article class="card compact"><h2>Spec 生成进度</h2><p class="lead">每一行一个 Spec,共 ${specTotal} 个。</p><div class="scroll-list">${renderSpecRows(projects)}</div></article><article class="card compact"><h2>场景生成进度</h2><p class="lead">每一行是 Spec 中一个场景,共 ${sceneTotal} 个。</p><div class="scroll-list">${renderScenarioRows(projects)}</div></article></div>
2217
- ${renderConsumption(projects, usages, usageScanning ? 'Agent 用量正在后台线程统计中,稍后自动刷新出现;大会话库首扫可能需要更久。' : '')}
2410
+
2411
+ ${renderConsumption(projects, usages, usageScanning ? tr('Agent 用量正在后台线程统计中,稍后自动刷新出现;大会话库首扫可能需要更久。') : '')}
2218
2412
  </section>`;
2219
2413
  }
2220
2414
  function renderMarkerLegend(markers = [], counterpart = []) {
2221
- if (!markers.length) return '<div class="capture-legend-empty">未检测到可交互元素</div>';
2415
+ if (!markers.length) return '<div class="capture-legend-empty">' + tr('未检测到可交互元素') + '</div>';
2222
2416
  const counterpartNumbers = new Set(counterpart.map((marker) => marker.number));
2223
- return `<div class="capture-legend-list">${markers.map((marker) => `<div class="capture-legend-row" data-marker="${marker.number}" tabindex="0"><span class="capture-legend-no">${marker.number}</span><span class="capture-legend-label">${escapeHtml(marker.label)}</span><span class="capture-legend-state ${counterpartNumbers.has(marker.number) ? 'matched' : 'missing'}">${counterpartNumbers.has(marker.number) ? '对侧同号存在' : '对侧未找到同号'}</span></div>`).join('')}</div>`;
2417
+ return `<div class="capture-legend-list">${markers.map((marker) => `<div class="capture-legend-row" data-marker="${marker.number}" tabindex="0"><span class="capture-legend-no">${marker.number}</span><span class="capture-legend-label">${escapeHtml(trMarkerLabel(marker.label))}</span><span class="capture-legend-state ${counterpartNumbers.has(marker.number) ? 'matched' : 'missing'}">${counterpartNumbers.has(marker.number) ? tr('对侧同号存在') : tr('对侧未找到同号')}</span></div>`).join('')}</div>`;
2224
2418
  }
2225
2419
 
2226
- function renderCapture(pair, side, featureHtml = '', hmosDevice = '鸿蒙设备') {
2420
+ function renderCapture(pair, side, featureHtml = '', hmosDevice = '鸿蒙设备', hmosChip = '') {
2227
2421
  const uri = side === 'source' ? pair.sourceUri : pair.hmosUri;
2228
2422
  const frameUris = side === 'source' ? pair.sourceUris : pair.hmosUris;
2229
2423
  const frameRegions = side === 'source' ? pair.sourceFrameClips : pair.hmosFrameClips;
@@ -2231,16 +2425,15 @@ function renderCapture(pair, side, featureHtml = '', hmosDevice = '鸿蒙设备'
2231
2425
  const markers = side === 'source' ? pair.sourceMarkers : pair.hmosMarkers;
2232
2426
  const counterpart = side === 'source' ? pair.hmosMarkers : pair.sourceMarkers;
2233
2427
  const sourcePlatform = (pair.sourcePlatform || 'Android').toUpperCase();
2234
- const label = side === 'source' ? `迁移前 · ${sourcePlatform}(UI 迁移产物)` : `迁移后 · ${hmosDevice}`;
2235
- const subtitle = side === 'source' ? 'UI 迁移产物截图' : `${hmosDevice}自动采集`;
2236
- const markerHtml = (markers || []).map((marker) => `<button class="capture-marker" type="button" title="${escapeHtml(marker.label)}" aria-label="${escapeHtml(marker.label)}" style="left:${marker.left.toFixed(3)}%;top:${marker.top.toFixed(3)}%;width:${marker.width.toFixed(3)}%;height:${marker.height.toFixed(3)}%" data-marker="${marker.number}"><span class="capture-marker-badge">${marker.number}</span></button>`).join('');
2428
+ const label = side === 'source' ? `${tr('迁移前 · ')}${sourcePlatform}${tr('(UI 迁移产物)')}` : `${tr('迁移后 · ')}${tr(hmosDevice)}`;
2429
+ const markerHtml = (markers || []).map((marker) => `<button class="capture-marker" type="button" title="${escapeHtml(trMarkerLabel(marker.label))}" aria-label="${escapeHtml(trMarkerLabel(marker.label))}" style="left:${marker.left.toFixed(3)}%;top:${marker.top.toFixed(3)}%;width:${marker.width.toFixed(3)}%;height:${marker.height.toFixed(3)}%" data-marker="${marker.number}"><span class="capture-marker-badge">${marker.number}</span></button>`).join('');
2237
2430
  const frames = Array.isArray(frameUris) && frameUris.length ? frameUris : (uri ? [uri] : []);
2238
2431
  const regions = Array.isArray(frameRegions) ? frameRegions : [];
2239
2432
  const offsets = Array.isArray(frameOffsets) ? frameOffsets : [];
2240
2433
  const frameHtml = frames.length > 1
2241
- ? `<div class="phone-image-layer capture-stitch" data-capture-stitch data-frame-count="${frames.length}" data-scroll-regions="${escapeHtml(JSON.stringify(regions))}" data-scroll-offsets="${escapeHtml(JSON.stringify(offsets))}"><canvas aria-label="${escapeHtml(label)} · 去重长图"></canvas><div hidden>${frames.map((frame, index) => `<img src="${frame}" data-stitch-frame="${index}" alt="">`).join('')}</div>${markerHtml}</div>`
2434
+ ? `<div class="phone-image-layer capture-stitch" data-capture-stitch data-frame-count="${frames.length}" data-scroll-regions="${escapeHtml(JSON.stringify(regions))}" data-scroll-offsets="${escapeHtml(JSON.stringify(offsets))}"><canvas aria-label="${escapeHtml(label)}${tr(' · 去重长图')}"></canvas><div hidden>${frames.map((frame, index) => `<img src="${frame}" data-stitch-frame="${index}" alt="">`).join('')}</div>${markerHtml}</div>`
2242
2435
  : frames.map((frame) => `<div class="phone-image-layer" data-capture-frame="0"><img src="${frame}" alt="${escapeHtml(label)}">${markerHtml}</div>`).join('');
2243
- const emptyHint = '未找到该页面的 UI 迁移产物截图(ui_info / 迁移采集缓存)';
2436
+ const emptyHint = tr('未找到该页面的 UI 迁移产物截图(ui_info / 迁移采集缓存)');
2244
2437
  // Validation-failed HarmonyOS captures stay on disk as evidence, but the
2245
2438
  // board refuses to display them: the card states the failure reason and
2246
2439
  // where the capture is kept. A missing capture states why it is missing.
@@ -2248,16 +2441,16 @@ function renderCapture(pair, side, featureHtml = '', hmosDevice = '鸿蒙设备'
2248
2441
  const bodyHtml = frames.length && !mismatched
2249
2442
  ? `<div class="phone-shell"><span class="phone-notch" aria-hidden="true"></span><div class="phone-screen">${frameHtml}</div></div>`
2250
2443
  : side === 'hmos'
2251
- ? `<div class="capture-empty-card"><h4>${mismatched ? `${escapeHtml(hmosDevice)}截图校验未通过` : `未展示${escapeHtml(hmosDevice)}截图`}</h4><p>${escapeHtml(mismatched
2252
- ? `${String(pair.hmosValidation.reason || '与源页不完全匹配')}${Number(pair.hmosValidation.state_retries) > 0 ? `(首轮内部已重试 ${pair.hmosValidation.state_retries} 次)` : ''}。截图已保留在采集缓存中;修复后重新采集并通过校验即可展示。`
2253
- : (pair.hmosEmptyReason || `未读取到该任务对应的${hmosDevice}截图。`))}</p></div>`
2254
- : `<div class="phone-shell"><span class="phone-notch" aria-hidden="true"></span><div class="phone-screen"><div class="capture-empty"><strong>缺少 UI 迁移产物截图</strong><span>${escapeHtml(emptyHint)}</span></div></div></div>`;
2444
+ ? `<div class="capture-empty-card"><h4>${mismatched ? `${escapeHtml(tr(hmosDevice))}${tr('截图校验未通过')}` : RENDER_LANG === 'en' ? `${escapeHtml(tr(hmosDevice))} screenshot not shown` : `未展示${escapeHtml(hmosDevice)}截图`}</h4><p>${escapeHtml(mismatched
2445
+ ? `${trCaptureDetail(String(pair.hmosValidation.reason || '与源页不完全匹配'))}${Number(pair.hmosValidation.state_retries) > 0 ? `${tr('(首轮内部已重试 ')}${pair.hmosValidation.state_retries}${tr(' 次)')}` : ''}${tr('。截图已保留在采集缓存中;修复后重新采集并通过校验即可展示。')}`
2446
+ : (pair.hmosEmptyReason || `${tr('未读取到该任务对应的')}${tr(hmosDevice)}${tr('截图。')}`))}</p></div>`
2447
+ : `<div class="phone-shell"><span class="phone-notch" aria-hidden="true"></span><div class="phone-screen"><div class="capture-empty"><strong>${tr('缺少 UI 迁移产物截图')}</strong><span>${escapeHtml(emptyHint)}</span></div></div></div>`;
2255
2448
  // Advisory capture verdict: the screenshot was kept, and the flag travels
2256
2449
  // with it so a mismatched page is visible right on the card.
2257
2450
  const mismatch = side === 'hmos' && pair.hmosValidation?.verdict === 'mismatch'
2258
- ? `<span class="capture-mismatch" title="${escapeHtml(String(pair.hmosValidation.reason || '与源页不完全匹配'))}">⚠ 与源页不完全匹配</span>`
2451
+ ? `<span class="capture-mismatch" title="${escapeHtml(trCaptureDetail(String(pair.hmosValidation.reason || '与源页不完全匹配')))}">⚠ ${tr('与源页不完全匹配')}</span>`
2259
2452
  : '';
2260
- return `<article class="capture phone-card"><div class="compare-tag ${side === 'source' ? '' : 'compare-tag-after'}">${escapeHtml(label)}${mismatch}</div><div class="phone-card-head"><h3>${side === 'source' ? `${sourcePlatform} 迁移产物截图` : `${hmosDevice}截图`}</h3><p>${escapeHtml(subtitle)}${frames.length > 1 ? ` · ${frames.length} 帧滚动截图` : ''}</p></div><div class="phone-body-row">${bodyHtml}<aside class="capture-legend"><h4>交互点 · ${(markers || []).length}</h4><p>编号按各侧采集顺序对照,仅表示同号是否存在。</p>${renderMarkerLegend(markers || [], counterpart || [])}${featureHtml}</aside></div></article>`;
2453
+ return `<article class="capture phone-card"><div class="compare-tag ${side === 'source' ? '' : 'compare-tag-after'}">${escapeHtml(label)}${mismatch}</div><div class="phone-card-head"><h3>${side === 'source' ? `${sourcePlatform}${tr(' 迁移产物截图')}` : `${tr(hmosDevice)}${tr('截图')}`}${frames.length > 1 ? ` · ${frames.length}${tr(' 帧')}` : ''}${side === 'hmos' ? hmosChip : ''}</h3></div><div class="phone-body-row">${bodyHtml}<aside class="capture-legend"><h4>${tr('交互点 · ')}${(markers || []).length}</h4><p>${tr('编号按各侧采集顺序对照,仅表示同号是否存在。')}</p>${renderMarkerLegend(markers || [], counterpart || [])}${featureHtml}</aside></div></article>`;
2261
2454
  }
2262
2455
 
2263
2456
  function renderUiTaskSummary(project, task, capture) {
@@ -2265,29 +2458,23 @@ function renderUiTaskSummary(project, task, capture) {
2265
2458
  const hmosCount = capture.hmosMarkers?.length ?? 0;
2266
2459
  const delta = hmosCount - sourceCount;
2267
2460
  const countStatus = sourceCount === hmosCount ? 'done' : 'in_progress';
2268
- return `<div class="ui-page-summary">
2269
- <div class="ui-summary-block"><span class="ui-summary-label">${task.captureOnly ? '设备截图状态' : '页面迁移结论'}</span><strong>${task.captureOnly ? `${hmosDeviceLabel(project)}截图已缓存` : (task.status === 'done' ? '页面任务已完成' : statusLabel(task.status))}</strong><small>迁移前 ${sourceCount} 个交互点,迁移后 ${hmosCount} 个${delta ? `,数量相差 ${Math.abs(delta)} 个` : ',数量一致'}</small>${task.captureOnly ? badge('done', '真实采集缓存') : badge(countStatus, sourceCount === hmosCount ? '交互数一致' : '建议核对')}</div>
2270
- <div class="ui-summary-block"><span class="ui-summary-label">${task.captureOnly ? '截图证据' : '迁移证据'}</span><strong>${escapeHtml(task.id)}</strong><small>${task.output ? escapeHtml(task.output) : (task.captureOnly ? '未记录截图文件' : '未记录目标代码文件')}</small></div>
2271
- </div>`;
2461
+ return `<div class="ui-page-summary"><div class="ui-summary-block"><div class="ui-summary-head"><strong>${task.captureOnly ? `${tr(hmosDeviceLabel(project))}${tr('截图已缓存')}` : (task.status === 'done' ? tr('页面任务已完成') : statusLabel(task.status))}</strong>${task.captureOnly ? badge('done', tr('真实采集缓存')) : badge(countStatus, sourceCount === hmosCount ? tr('交互数一致') : `${tr('交互数 ')}${sourceCount} → ${hmosCount}`, sourceCount === hmosCount ? '' : RENDER_LANG === 'en' ? `Before migration: ${sourceCount} markers, after migration: ${hmosCount}, a difference of ${Math.abs(delta)}` : `迁移前 ${sourceCount} 个交互点,迁移后 ${hmosCount} 个,数量相差 ${Math.abs(delta)} 个`)}</div><div class="ui-summary-evidence"><strong>${escapeHtml(task.id)}</strong><small>${task.output ? escapeHtml(task.output) : (task.captureOnly ? tr('未记录截图文件') : tr('未记录目标代码文件'))}</small></div></div></div>`;
2272
2462
  }
2273
2463
 
2274
- function renderLiveCaptureState(project) {
2464
+ function hmosCaptureChip(project) {
2275
2465
  const state = project.captureState;
2276
2466
  if (!state) return '';
2277
2467
  const item = state.hmos || {};
2278
2468
  const bucket = item.status === 'ready' ? 'done' : item.status === 'capturing' || item.status === 'checking' ? 'in_progress' : item.status === 'error' ? 'blocked' : 'not_started';
2279
- const mode = item.status === 'ready' ? '当前设备主动采集' : item.status === 'capturing' ? '正在主动采集' : '本地缓存回退';
2280
- return `<div class="device-capture-bar"><span class="device-capture-state ${bucket}"><span class="dot ${bucket}"></span><b>鸿蒙截图</b><small>${escapeHtml(mode)} · ${escapeHtml(item.detail || '')}</small></span></div>`;
2469
+ const mode = item.status === 'ready' ? tr('当前设备主动采集') : item.status === 'capturing' ? tr('正在主动采集') : tr('本地缓存回退');
2470
+ const text = item.detail ? mode + tr(' · ') + trCaptureDetail(item.detail) : mode;
2471
+ return `<span class="hmos-capture-chip ${bucket}"><span class="dot ${bucket}"></span>${escapeHtml(text)}</span>`;
2281
2472
  }
2282
2473
 
2283
- // The HarmonyOS side runs on whatever hdc target is connected — the emulator
2284
- // (loopback target) or a real device. The labels must not claim 真机 when the
2285
- // screenshots came from the emulator.
2474
+ // The board does not distinguish emulator vs real device — whatever hdc target
2475
+ // is connected is just the HarmonyOS side.
2286
2476
  function hmosDeviceLabel(project) {
2287
- const targets = ((project.captureState?.hmos?.targets) || []).map((target) => String(target));
2288
- if (targets.some((target) => /^(?:127\.0\.0\.1|localhost|::1)(?::|$)/i.test(target) || /emulator/i.test(target))) return '鸿蒙模拟器';
2289
- if (targets.length) return '鸿蒙真机';
2290
- return '鸿蒙设备';
2477
+ return tr('鸿蒙设备');
2291
2478
  }
2292
2479
 
2293
2480
  // Empty HarmonyOS slides must say WHY instead of showing a blank phone shell.
@@ -2296,21 +2483,21 @@ function hmosDeviceLabel(project) {
2296
2483
  // (pairing or coverage problem — the no-borrow rule keeps the slide empty).
2297
2484
  function hmosEmptyReason(project, hasHmosCaptures) {
2298
2485
  const state = project.captureState?.hmos || {};
2299
- if (state.status === 'capturing' || state.status === 'checking') return '鸿蒙侧正在采集,完成后刷新看板即可显示截图。';
2486
+ if (state.status === 'capturing' || state.status === 'checking') return tr('鸿蒙侧正在采集,完成后刷新看板即可显示截图。');
2300
2487
  if (!hasHmosCaptures) {
2301
2488
  const detail = String(state.detail || '').trim();
2302
- return `未读取到鸿蒙侧截图缓存${detail ? `:${detail}` : ':尚未运行过鸿蒙设备采集'}。连接设备并完成采集后刷新看板。`;
2489
+ return `${tr('未读取到鸿蒙侧截图缓存')}${detail ? `${tr(':')}${trCaptureDetail(detail)}` : tr(':尚未运行过鸿蒙设备采集')}${tr('。连接设备并完成采集后刷新看板。')}`;
2303
2490
  }
2304
- return '鸿蒙侧已有其他页面的截图缓存,但该页没有对应截图;按同任务配对规则不做跨任务借用。可重新运行鸿蒙采集覆盖该页,或在看板配置的 ui_hmos_content_map 中为该任务指定截图序号。';
2491
+ return tr('鸿蒙侧已有其他页面的截图缓存,但该页没有对应截图;按同任务配对规则不做跨任务借用。可重新运行鸿蒙采集覆盖该页,或在看板配置的 ui_hmos_content_map 中为该任务指定截图序号。');
2305
2492
  }
2306
2493
 
2307
2494
  function captureForTask(project, task, index) {
2308
2495
  const taskId = String(task.id || '').toLowerCase();
2309
2496
  const sequence = Number(taskId.match(/page_(\d+)/i)?.[1]);
2310
2497
  // Pairing is config-driven, not keyword-heuristic. Two independent maps in
2311
- // my-weatherapp.config.json tell each task which capture seq to use on each
2498
+ // the dashboard config tell each task which capture seq to use on each
2312
2499
  // side, because the Android slug captures and the HarmonyOS page_N captures
2313
- // use different seq spaces (Android slug seq comes from SEMANTIC_ORDER in
2500
+ // use different seq spaces (Android slug seq comes from pages.json rank in
2314
2501
  // findCaptures; HarmonyOS seq comes from the page_N number in its folder
2315
2502
  // name), so a single seq cannot select both sides correctly.
2316
2503
  // ui_capture_map : task.id -> Android source seq
@@ -2373,7 +2560,18 @@ function captureForTask(project, task, index) {
2373
2560
  : { ...taskCapture, hmos: hmosFile, hmosUri: hmosCapture ? hmosCapture.hmosUri : '', hmosRoot: hmosCapture ? hmosCapture.hmosRoot : '', hmosMarkers: hmosCapture ? hmosCapture.hmosMarkers : [], hmosValidation, hmosCaptureSeq, hmosUris: hmosCapture ? hmosCapture.hmosUris : [], hmosFrameClips: hmosCapture ? hmosCapture.hmosFrameClips : [], hmosFrameOffsets: hmosCapture ? hmosCapture.hmosFrameOffsets : [] };
2374
2561
  }
2375
2562
 
2563
+ function uiStatsStrip(stats) {
2564
+ const card = (cls, label, value) => '<div class="ui-stat ' + cls + '"><strong>' + value + '</strong><span>' + label + '</span></div>';
2565
+ return '<div class="ui-stats">'
2566
+ + card('stat-total', tr('真实页面'), stats.total)
2567
+ + card('stat-done', tr('已迁移'), stats.done)
2568
+ + card('stat-warn', tr('交互数不一致'), stats.mismatchCount)
2569
+ + card('stat-miss', tr('无可用鸿蒙截图'), stats.noHmos)
2570
+ + '</div>';
2571
+ }
2376
2572
  function renderUi(projects) {
2573
+ const uiDone = projects.reduce((sum, project) => sum + project.ui.done, 0);
2574
+ const uiTotal = projects.reduce((sum, project) => sum + project.ui.total, 0);
2377
2575
  const hmosPresence = new Map();
2378
2576
  for (const project of projects) {
2379
2577
  const originalCaptures = project.captures;
@@ -2381,9 +2579,22 @@ function renderUi(projects) {
2381
2579
  || (Array.isArray(row.hmosVariants) && row.hmosVariants.some((variant) => variant && variant.hmosUri)))));
2382
2580
  project.captures = project.ui.tasks.map((task, index) => captureForTask({ ...project, captures: originalCaptures }, task, index));
2383
2581
  }
2384
- return `<section class="tab" id="ui"><h2>UI界面迁移</h2>
2385
- ${projects.map((project, projectIndex) => `<article class="card ui-project" data-ui-project="${projectIndex}"><div class="ui-toolbar"><div class="ui-toolbar-main"><div class="ui-title-jump"><input type="search" data-ui-title-search placeholder="搜页面标题跳转,如 Main Page" aria-label="按页面标题跳转"><button class="outline" type="button" data-ui-title-jump>跳转</button></div><label class="ui-pending-filter"><input type="checkbox" data-ui-pending-only> 只看未完成任务</label></div><div class="pager"><button class="outline" type="button" data-ui-prev aria-label="上一页">← 上一页</button><span class="page-counter" data-ui-count>1 / ${Math.max(1, project.ui.tasks.length)}</span><button class="outline" type="button" data-ui-next aria-label="下一页">下一页 →</button></div></div><div class="ui-switch-hint">键盘 ← 上一页 · → 下一页。标题搜索忽略大小写与空格。</div>${renderLiveCaptureState(project)}<div class="ui-project-meta"><div><h2>${escapeHtml(project.name)} · ${project.ui.captureOnly ? `${project.ui.tasks.length} 张${hmosDeviceLabel(project)}截图` : `${project.ui.done}/${project.ui.total} 个真实页面已修复`}</h2>${project.ui.captureOnly ? sourceLine('截图缓存目录', project.ui.captureSource) : sourceLine('迁移任务来源', project.ui.file)}</div></div>
2386
- ${project.ui.tasks.length ? `<div class="ui-stack" data-ui-stack>${project.ui.tasks.map((task, index) => { const capture = project.captures[index] || {}; if (!capture.hmosUri && !(Array.isArray(capture.hmosUris) && capture.hmosUris.length)) capture.hmosEmptyReason = hmosEmptyReason(project, hmosPresence.get(project)); const title = taskFriendlyTitle(task); return `<section class="ui-slide" data-ui-slide="${index}" data-ui-status="${escapeHtml(task.status)}" data-ui-title="${escapeHtml(title.toLowerCase().replace(/\s+/g, ''))}" ${index ? 'hidden' : ''}><div class="page-title"><div><h2>${escapeHtml(title)}</h2><small data-ui-position>${task.captureOnly ? '设备截图' : 'UI 迁移任务'} ${index + 1} / ${project.ui.tasks.length}</small></div>${task.captureOnly ? badge('done', '已缓存设备截图') : badge(task.status, task.status === 'done' ? '可展示' : statusLabel(task.status))}</div>${renderUiTaskSummary(project, task, capture)}<div class="capture-grid">${renderCapture(capture, 'source')}<div class="arrow" aria-hidden="true">→</div>${renderCapture(capture, 'hmos', '', hmosDeviceLabel(project))}</div></section>`; }).join('')}<div class="ui-filter-empty" data-ui-filter-empty hidden>当前筛选条件下没有 UI 迁移任务,请取消“只看未完成”。</div></div>` : '<div class="empty">尚未生成 batch_progress.json 或其中没有 UI 迁移任务,也未读取到鸿蒙侧截图缓存。</div>'}
2582
+ const uiStats = { total: 0, done: 0, mismatchCount: 0, noHmos: 0 };
2583
+ for (const project of projects) {
2584
+ for (const [index, task] of project.ui.tasks.entries()) {
2585
+ uiStats.total++;
2586
+ if (task.status === 'done') uiStats.done++;
2587
+ const capture = project.captures[index] || {};
2588
+ const hmosUsable = Boolean((capture.hmosUri || (Array.isArray(capture.hmosUris) && capture.hmosUris.length))
2589
+ && capture.hmosValidation?.verdict !== 'mismatch');
2590
+ if (!hmosUsable) { uiStats.noHmos++; continue; }
2591
+ if ((capture.sourceMarkers?.length ?? 0) !== (capture.hmosMarkers?.length ?? 0)) uiStats.mismatchCount++;
2592
+ }
2593
+ }
2594
+ return `<section class="tab" id="ui">${tabHero(ICONS.ui, tr('UI界面迁移'), '', ring(uiDone, uiTotal, `${uiDone}/${uiTotal || 0}`), 'orange')}${uiStatsStrip(uiStats)}
2595
+ ${projects.map((project, projectIndex) => `<article class="card ui-project" data-ui-project="${projectIndex}"><div class="ui-toolbar"><div class="ui-toolbar-main"><div class="ui-title-jump"><input type="search" data-ui-title-search placeholder="${tr('搜页面标题,如 Main Page(忽略大小写与空格)')}" aria-label="${tr('按页面标题跳转')}"><button class="outline" type="button" data-ui-title-jump>${tr('跳转')}</button></div><label class="ui-pending-filter"><input type="checkbox" data-ui-pending-only>${tr(' 只看未完成任务')}</label></div><div class="pager"><button class="outline" type="button" data-ui-prev aria-label="${tr('上一页')}">← ${tr('上一页')}</button><span class="page-counter" data-ui-count>1 / ${Math.max(1, project.ui.tasks.length)}</span><button class="outline" type="button" data-ui-next aria-label="${tr('下一页')}">${tr('下一页')} →</button></div></div><div class="pager-kbd">${tr('支持键盘 ← → 翻页')}</div><div class="ui-project-meta"><div>${project.ui.captureOnly ? sourceLine(tr('截图缓存目录'), project.ui.captureSource) : sourceLine(tr('迁移任务来源'), project.ui.file)}</div></div>
2596
+ <div class="page-grid">${project.ui.tasks.map((task, index) => { const capture = project.captures[index] || {}; const sourceCount = capture.sourceMarkers?.length ?? 0; const hmosCount = capture.hmosMarkers?.length ?? 0; return `<button type="button" class="page-card" data-page-card="${index}" data-ui-status="${escapeHtml(task.status)}" title="${escapeHtml(taskFriendlyTitle(task))}"><span class="page-card-dot ${escapeHtml(task.status)}"></span><span class="page-card-no">${String(index + 1).padStart(2, '0')}</span><strong class="page-card-title">${escapeHtml(shortPageName(task))}</strong></button>`; }).join('')}</div>
2597
+ ${project.ui.tasks.length ? `<div class="ui-stack" data-ui-stack>${project.ui.tasks.map((task, index) => { const capture = project.captures[index] || {}; if (!capture.hmosUri && !(Array.isArray(capture.hmosUris) && capture.hmosUris.length)) capture.hmosEmptyReason = hmosEmptyReason(project, hmosPresence.get(project)); const title = taskFriendlyTitle(task); return `<section class="ui-slide" data-ui-slide="${index}" data-ui-status="${escapeHtml(task.status)}" data-ui-title="${escapeHtml((shortPageName(task) + ' ' + title).toLowerCase().replace(/\s+/g, ''))}" ${index ? 'hidden' : ''}><div class="page-title"><div><h2>${escapeHtml(shortPageName(task))}</h2></div>${task.captureOnly ? badge('done', tr('已缓存设备截图')) : badge(task.status)}</div>${renderUiTaskSummary(project, task, capture)}<div class="capture-grid">${renderCapture(capture, 'source')}<div class="arrow" aria-hidden="true">→</div>${renderCapture(capture, 'hmos', '', hmosDeviceLabel(project), hmosCaptureChip(project))}</div></section>`; }).join('')}<div class="ui-filter-empty" data-ui-filter-empty hidden>${tr('当前筛选条件下没有 UI 迁移任务,请取消“只看未完成”。')}</div></div>` : `<div class="empty">${tr('尚未生成 batch_progress.json 或其中没有 UI 迁移任务,也未读取到鸿蒙侧截图缓存。')}${hmosCaptureChip(project) ? `<div class="ui-capture-state">${hmosCaptureChip(project)}</div>` : ''}</div>`}
2387
2598
  </article>`).join('')}
2388
2599
  </section>`;
2389
2600
  }
@@ -2404,17 +2615,17 @@ function renderScenario31Evidence(logic, scene, sceneIndex, stage) {
2404
2615
  const row = scenarioCoverageRow(logic, scene, sceneIndex);
2405
2616
  const specification = scene.description || scene.expected || '';
2406
2617
  const check = row
2407
- ? [row.status || statusLabel(stage.status), row.target].filter(Boolean).join(':')
2408
- : 'coverage-ledger.md 中没有当前场景对应记录';
2618
+ ? [row.status || statusLabel(stage.status), row.target].filter(Boolean).join(tr(':'))
2619
+ : tr('coverage-ledger.md 中没有当前场景对应记录');
2409
2620
  const traceRows = [
2410
- ['场景规格(Spec)', specification],
2411
- ['触发入口', row?.source],
2412
- ['目标符号 / 调用链', row?.target],
2621
+ [tr('场景规格(Spec)'), specification],
2622
+ [tr('触发入口'), row?.source],
2623
+ [tr('目标符号 / 调用链'), row?.target],
2413
2624
  ].filter((item) => item[1]);
2414
2625
  return `<div class="scenario-build-record scenario-stage31">
2415
- <div class="scenario-build-head"><span class="scenario-stage-dot ${escapeHtml(stage.status)}"></span><span class="scenario-stage-heading"><strong>3.1 场景编码记录</strong><span class="scenario-stage3-caption">${escapeHtml(scene.description || scene.name || '')}</span></span><span class="scenario-stage-status ${escapeHtml(stage.status)}">${escapeHtml(statusLabel(stage.status))}</span></div>
2416
- <div class="scenario-summary-lines"><p><strong>期望结果:</strong>${escapeHtml(scene.expected || scene.description || '未记录')}</p><p><strong>3.1 编码核对:</strong>${escapeHtml(check)}</p></div>
2417
- ${traceRows.length ? `<div class="scenario-inline-spec">${traceRows.map(([label, value]) => `<div class="scenario-inline-row"><strong>${escapeHtml(label)}:</strong>${escapeHtml(value)}</div>`).join('')}</div>` : ''}
2626
+ <div class="scenario-build-head"><span class="scenario-stage-dot ${escapeHtml(stage.status)}"></span><span class="scenario-stage-heading"><strong>${tr('3.1 场景编码记录')}</strong><span class="scenario-stage3-caption">${escapeHtml(scene.description || scene.name || '')}</span></span><span class="scenario-stage-status ${escapeHtml(stage.status)}">${escapeHtml(statusLabel(stage.status))}</span></div>
2627
+ <div class="scenario-summary-lines"><p><strong>${tr('期望结果:')}</strong>${escapeHtml(scene.expected || scene.description || tr('未记录'))}</p><p><strong>${tr('3.1 编码核对:')}</strong>${escapeHtml(check)}</p></div>
2628
+ ${traceRows.length ? `<div class="scenario-inline-spec">${traceRows.map(([label, value]) => `<div class="scenario-inline-row"><strong>${escapeHtml(label)}${tr(':')}</strong>${escapeHtml(value)}</div>`).join('')}</div>` : ''}
2418
2629
  </div>`;
2419
2630
  }
2420
2631
 
@@ -2423,21 +2634,21 @@ function renderScenarioStageRecord(stage, title, note, body) {
2423
2634
  }
2424
2635
 
2425
2636
  function scenarioInlineRows(rows) {
2426
- return rows.filter((row) => row[1]).map(([label, value]) => `<div class="scenario-inline-row"><strong>${escapeHtml(label)}:</strong>${escapeHtml(value)}</div>`).join('');
2637
+ return rows.filter((row) => row[1]).map(([label, value]) => `<div class="scenario-inline-row"><strong>${escapeHtml(tr(label))}${tr(':')}</strong>${escapeHtml(value)}</div>`).join('');
2427
2638
  }
2428
2639
 
2429
2640
  function renderScenario32Evidence(logic, stage) {
2430
2641
  const evidence = parseBuildEvidence(logic);
2431
- if (!evidence) return renderScenarioStageRecord(stage, '3.2 Spec 编译构建记录', '', `<div class="scenario-stage3-empty">${stage.status === 'not_started' ? '尚未开始,未发现步骤三的编译构建报告。' : '状态已更新,但当前未发现可读取的编译构建报告。'}</div>`);
2642
+ if (!evidence) return renderScenarioStageRecord(stage, tr('3.2 Spec 编译构建记录'), '', `<div class="scenario-stage3-empty">${stage.status === 'not_started' ? tr('尚未开始,未发现步骤三的编译构建报告。') : tr('状态已更新,但当前未发现可读取的编译构建报告。')}</div>`);
2432
2643
  const rows = scenarioInlineRows([
2433
- ['构建时间', evidence.buildTime], ['构建结束时间', evidence.endTime], ['构建模式', evidence.mode],
2434
- ['构建命令', evidence.command], ['总耗时', evidence.duration], ['Hvigor 耗时', evidence.hvigorDuration],
2435
- ['ArkTS 编译', evidence.compile], ['HAP 打包', evidence.package], ['HAP 签名', evidence.sign],
2436
- ['编译错误', evidence.errors], ['本轮修复错误数', evidence.errorsFixed], ['编译警告', evidence.warnings], ['SHA-256', evidence.sha256],
2644
+ [tr('构建时间'), evidence.buildTime], [tr('构建结束时间'), evidence.endTime], [tr('构建模式'), evidence.mode],
2645
+ [tr('构建命令'), evidence.command], [tr('总耗时'), evidence.duration], [tr('Hvigor 耗时'), evidence.hvigorDuration],
2646
+ [tr('ArkTS 编译'), evidence.compile], [tr('HAP 打包'), evidence.package], [tr('HAP 签名'), evidence.sign],
2647
+ [tr('编译错误'), evidence.errors], [tr('本轮修复错误数'), evidence.errorsFixed], [tr('编译警告'), evidence.warnings], ['SHA-256', evidence.sha256],
2437
2648
  ]);
2438
2649
  const artifacts = evidence.artifacts.map((item) => `<div class="scenario-build-artifact">${escapeHtml(item)}</div>`).join('');
2439
- const body = `<div class="scenario-inline-detail">${rows}${artifacts ? `<div class="scenario-inline-evidence-title">构建产物</div>${artifacts}` : ''}${evidence.reportPath ? `<div class="scenario-inline-row scenario-evidence-file"><strong>构建报告:</strong>${escapeHtml(evidence.reportPath)}</div>` : ''}</div>`;
2440
- return renderScenarioStageRecord(stage, '3.2 Spec 编译构建记录', '该构建结果由本 Spec 下所有场景共享,不表示每个场景被单独构建。', body);
2650
+ const body = `<div class="scenario-inline-detail">${rows}${artifacts ? `<div class="scenario-inline-evidence-title">${tr('构建产物')}</div>${artifacts}` : ''}${evidence.reportPath ? `<div class="scenario-inline-row scenario-evidence-file"><strong>${tr('构建报告:')}</strong>${escapeHtml(evidence.reportPath)}</div>` : ''}</div>`;
2651
+ return renderScenarioStageRecord(stage, tr('3.2 Spec 编译构建记录'), tr('该构建结果由本 Spec 下所有场景共享,不表示每个场景被单独构建。'), body);
2441
2652
  }
2442
2653
 
2443
2654
  function reviewVerdictStatus(value, fallback = 'not_started') {
@@ -2445,7 +2656,7 @@ function reviewVerdictStatus(value, fallback = 'not_started') {
2445
2656
  if (!normalized) return fallback;
2446
2657
  if (/SKIP|跳过/.test(normalized)) return 'skipped';
2447
2658
  if (/PARTIAL|UNABLE TO VERIFY|PASS WITH ISSUES|未验证|部分/.test(normalized)) return 'in_progress';
2448
- if (/(^|\W)FAIL(?:ED)?($|\W)|失败|阻塞/.test(normalized)) return 'blocked';
2659
+ if (/(^|\W)FAIL(?:ED)?($|\W)|失败|阻塞|未通过|不通过/.test(normalized)) return 'blocked';
2449
2660
  if (/(^|\W)PASS(?:ED)?($|\W)|通过|已完成/.test(normalized)) return 'done';
2450
2661
  return fallback;
2451
2662
  }
@@ -2457,42 +2668,46 @@ function reviewVerdictPresentation(value, stageStatus = 'not_started') {
2457
2668
  return {
2458
2669
  raw,
2459
2670
  status: stageStatus === 'done' ? 'done' : 'in_progress',
2460
- label: stageStatus === 'done' ? '静态评审完成 · 运行期未验证' : '运行期未验证',
2671
+ label: stageStatus === 'done' ? tr('静态评审完成 · 运行期未验证') : tr('运行期未验证'),
2461
2672
  };
2462
2673
  }
2463
- return { raw, status: reviewVerdictStatus(raw, stageStatus), label: raw || '未记录结论' };
2674
+ return { raw, status: reviewVerdictStatus(raw, stageStatus), label: raw || tr('未记录结论') };
2464
2675
  }
2465
2676
 
2466
2677
  function reviewDetailLabel(value) {
2467
2678
  const label = String(value ?? '').trim();
2679
+ // English mode shows the report's own labels (the map below is a zh display
2680
+ // translation of those English labels); synthesized zh fallbacks still
2681
+ // translate through the dictionary.
2682
+ if (RENDER_LANG === 'en') return (EN_STRINGS[label] ?? label) || 'Review notes';
2468
2683
  const translated = {
2469
- Description: '场景说明',
2470
- Result: '详细结论',
2471
- Verdict: '详细结论',
2472
- 'Fix Status': '修复状态',
2473
- 'Spec expectation': 'Spec 期望',
2474
- 'Implementation evidence': '实现证据',
2475
- Evidence: '实现证据',
2476
- 'Why this is not marked PASS': '未判定通过原因',
2477
- 'Review conclusion': '评审结论',
2478
- Gaps: '关键差距 / 未验证项',
2479
- 'Fixes Applied': '已执行修复',
2684
+ Description: tr('场景说明'),
2685
+ Result: tr('详细结论'),
2686
+ Verdict: tr('详细结论'),
2687
+ 'Fix Status': tr('修复状态'),
2688
+ 'Spec expectation': tr('Spec 期望'),
2689
+ 'Implementation evidence': tr('实现证据'),
2690
+ Evidence: tr('实现证据'),
2691
+ 'Why this is not marked PASS': tr('未判定通过原因'),
2692
+ 'Review conclusion': tr('评审结论'),
2693
+ Gaps: tr('关键差距 / 未验证项'),
2694
+ 'Fixes Applied': tr('已执行修复'),
2480
2695
  };
2481
- return translated[label] || label || '评审说明';
2696
+ return translated[label] || label || tr('评审说明');
2482
2697
  }
2483
2698
 
2484
2699
  function renderReviewScenario(round, scenario, index, stage) {
2485
2700
  const verdict = scenario.result
2486
2701
  || scenario.detail?.fields.find((field) => /^(Result|Verdict|结论|结果)$/i.test(field.label))?.value
2487
- || '未记录结论';
2702
+ || tr('未记录结论');
2488
2703
  const presentation = reviewVerdictPresentation(verdict, stage.status);
2489
2704
  const status = presentation.status;
2490
2705
  const summary = scenario.conclusion || scenario.gap || scenario.detail?.fields.find((field) => /^Description$/i.test(field.label))?.value || '';
2491
2706
  const topRows = scenarioInlineRows([
2492
- ['原始报告判定', presentation.label !== verdict ? verdict : ''],
2493
- ['评审结论', scenario.conclusion],
2494
- ['关键差距', scenario.gap],
2495
- ['修复状态', scenario.fixStatus],
2707
+ [tr('原始报告判定'), presentation.label !== verdict ? verdict : ''],
2708
+ [tr('评审结论'), scenario.conclusion],
2709
+ [tr('关键差距'), scenario.gap],
2710
+ [tr('修复状态'), scenario.fixStatus],
2496
2711
  ]);
2497
2712
  const detailFields = (scenario.detail?.fields ?? [])
2498
2713
  .filter((field) => !/^(Result|Verdict|结论|结果)$/i.test(field.label))
@@ -2501,350 +2716,200 @@ function renderReviewScenario(round, scenario, index, stage) {
2501
2716
  const detailBlocks = (scenario.detail?.blocks ?? []).map((block) => `<section class="logic-review-detail-section"><h5>${escapeHtml(reviewDetailLabel(block.title))}</h5><ul>${block.lines.map((line) => `<li>${escapeHtml(line)}</li>`).join('')}</ul></section>`).join('');
2502
2717
  const detailBody = topRows || detailFields || detailBlocks
2503
2718
  ? `<div class="logic-review-scenario-body">${topRows ? `<div class="logic-review-summary-rows">${topRows}</div>` : ''}${detailFields ? `<div class="logic-review-fields">${detailFields}</div>` : ''}${detailBlocks ? `<div class="logic-review-detail-grid">${detailBlocks}</div>` : ''}</div>`
2504
- : '<div class="logic-review-scenario-empty">评审汇总包含该场景,但报告没有提供更细的证据段落。</div>';
2719
+ : `<div class="logic-review-scenario-empty">${tr('评审汇总包含该场景,但报告没有提供更细的证据段落。')}</div>`;
2720
+ // the "场景 N" prefix is synthesized by our parser; the title part after the
2721
+ // colon is report data and stays as produced
2722
+ const scenarioName = translateScenarioName(scenario.name || (RENDER_LANG === 'en' ? `Scenario ${index + 1}` : `场景 ${index + 1}`));
2505
2723
  return `<details class="logic-review-scenario" data-review-scenario="${escapeHtml(scenario.number || index + 1)}" data-review-status="${escapeHtml(status)}" >
2506
- <summary><span class="logic-review-scenario-index">${escapeHtml(scenario.number || index + 1)}</span><span class="logic-review-scenario-copy"><strong>${escapeHtml(scenario.name || `场景 ${index + 1}`)}</strong>${summary ? `<small>${escapeHtml(summary)}</small>` : ''}</span>${badge(status, presentation.label)}<i class="logic-review-scenario-chevron" aria-hidden="true">⌄</i></summary>
2724
+ <summary><span class="logic-review-scenario-index">${escapeHtml(scenario.number || index + 1)}</span><span class="logic-review-scenario-copy"><strong>${escapeHtml(scenarioName)}</strong>${summary ? `<small>${escapeHtml(summary)}</small>` : ''}</span>${badge(status, presentation.label)}<i class="logic-review-scenario-chevron" aria-hidden="true">⌄</i></summary>
2507
2725
  ${detailBody}
2508
2726
  </details>`;
2509
2727
  }
2510
2728
 
2511
2729
  function renderReviewRound(round, stage) {
2512
2730
  const metrics = [
2513
- ['评审场景', round.reviewed, 'reviewed'],
2731
+ [tr('评审场景'), round.reviewed, 'reviewed'],
2514
2732
  ['PASS', round.pass, 'done'],
2515
2733
  ['PARTIAL', round.partial, 'in_progress'],
2516
2734
  ['FAIL', round.fail, 'blocked'],
2517
- ['运行期未验证', round.unable, 'runtime'],
2518
- ['确认缺陷', round.confirmed, 'blocked'],
2735
+ [tr('运行期未验证'), round.unable, 'runtime'],
2736
+ [tr('确认缺陷'), round.confirmed, 'blocked'],
2519
2737
  ].filter((item) => item[1] !== '' && item[1] != null);
2520
2738
  const metricHtml = metrics.map(([label, value, status]) => `<div class="logic-review-metric ${escapeHtml(status)}"><span>${escapeHtml(label)}</span><strong>${escapeHtml(value)}</strong></div>`).join('');
2521
2739
  const scenarioHtml = (round.scenarios ?? []).map((scenario, index) => renderReviewScenario(round, scenario, index, stage)).join('');
2522
2740
  return `<section class="logic-review-round" data-review-round="${escapeHtml(round.round || '?')}">
2523
- <div class="logic-review-round-head"><div><strong>第 ${escapeHtml(round.round || '?')} 轮逐场景评审</strong><span>报告原始判定:${escapeHtml(round.verdict || '未记录')}</span></div>${round.reportPath ? `<small>${escapeHtml(round.reportPath)}</small>` : ''}</div>
2741
+ <div class="logic-review-round-head"><div><strong>${tr('第 ')}${escapeHtml(round.round || '?')}${tr(' 轮逐场景评审')}</strong><span>${tr('报告原始判定:')}${escapeHtml(round.verdict || tr('未记录'))}</span></div>${round.reportPath ? `<small>${escapeHtml(round.reportPath)}</small>` : ''}</div>
2524
2742
  ${metricHtml ? `<div class="logic-review-metrics">${metricHtml}</div>` : ''}
2525
- ${scenarioHtml ? `<div class="logic-review-scenarios"><div class="logic-review-scenarios-title"><strong>逐场景评审明细</strong><span>展开场景查看评审依据、未验证项和修复状态</span></div>${scenarioHtml}</div>` : `<div class="scenario-inline-row"><strong>本轮记录:</strong>${escapeHtml(round.verdict || '未记录结论')}${round.reportPath ? `;${escapeHtml(round.reportPath)}` : ''}</div>`}
2743
+ ${scenarioHtml ? `<div class="logic-review-scenarios"><div class="logic-review-scenarios-title"><strong>${tr('逐场景评审明细')}</strong><span>${tr('展开场景查看评审依据、未验证项和修复状态')}</span></div>${scenarioHtml}</div>` : `<div class="scenario-inline-row"><strong>${tr('本轮记录:')}</strong>${escapeHtml(round.verdict || tr('未记录结论'))}${round.reportPath ? `${tr(';')}${escapeHtml(round.reportPath)}` : ''}</div>`}
2526
2744
  </section>`;
2527
2745
  }
2528
2746
 
2529
2747
  function renderScenario33Evidence(logic, stage) {
2530
2748
  const evidence = parseReviewEvidence(logic);
2531
- if (!evidence) return renderScenarioStageRecord(stage, '3.3 Spec 代码评审记录', '', `<div class="scenario-stage3-empty">${stage.status === 'not_started' ? '尚未开始,未发现步骤三的代码评审报告。' : '状态已更新,但当前未发现可读取的代码评审报告。'}</div>`);
2749
+ if (!evidence) return renderScenarioStageRecord(stage, tr('3.3 Spec 代码评审记录'), '', `<div class="scenario-stage3-empty">${stage.status === 'not_started' ? tr('尚未开始,未发现步骤三的代码评审报告。') : tr('状态已更新,但当前未发现可读取的代码评审报告。')}</div>`);
2532
2750
  const lastRound = evidence.rounds.at(-1);
2533
2751
  const reviewCounts = [
2534
2752
  lastRound?.pass ? `${lastRound.pass} PASS` : '',
2535
2753
  lastRound?.partial ? `${lastRound.partial} PARTIAL` : '',
2536
2754
  lastRound?.fail ? `${lastRound.fail} FAIL` : '',
2537
- lastRound?.unable ? `${lastRound.unable} 运行期未验证(原始 UNABLE TO VERIFY)` : '',
2538
- ].filter(Boolean).join(',');
2755
+ lastRound?.unable ? `${lastRound.unable}${tr(' 运行期未验证(原始 UNABLE TO VERIFY)')}` : '',
2756
+ ].filter(Boolean).join(tr(','));
2539
2757
  const loopState = stage.status === 'done'
2540
- ? `已结束(共记录 ${evidence.rounds.length || evidence.finalRound || 0} 轮)`
2541
- : stage.status === 'skipped' ? '已跳过' : statusLabel(stage.status);
2758
+ ? `${tr('已结束(共记录 ')}${evidence.rounds.length || evidence.finalRound || 0}${tr(' 轮)')}`
2759
+ : statusLabel(stage.status);
2542
2760
  const rows = scenarioInlineRows([
2543
- ['3.3 循环状态', loopState], ['最终记录轮次', evidence.finalRound], ['报告原始判定', evidence.verdict],
2544
- ['场景判定汇总', reviewCounts || evidence.scenarioResult],
2545
- ['确认问题', evidence.confirmed], ['成功修复', evidence.fixed], ['修复失败', evidence.failed], ['停止原因', evidence.stopReason],
2761
+ [tr('3.3 循环状态'), loopState], [tr('最终记录轮次'), evidence.finalRound], [tr('报告原始判定'), evidence.verdict],
2762
+ [tr('场景判定汇总'), reviewCounts || evidence.scenarioResult],
2763
+ [tr('确认问题'), evidence.confirmed], [tr('成功修复'), evidence.fixed], [tr('修复失败'), evidence.failed], [tr('停止原因'), evidence.stopReason],
2546
2764
  ]);
2547
2765
  const rounds = evidence.rounds.map((round) => renderReviewRound(round, stage)).join('');
2548
2766
  const findings = evidence.findings.map((item) => `<div class="scenario-build-artifact">${escapeHtml(item)}</div>`).join('');
2549
2767
  const paths = [evidence.reportPath, evidence.fixReportPath].filter(Boolean).map((item) => `<div class="scenario-build-artifact">${escapeHtml(item)}</div>`).join('');
2550
- const body = `<div class="scenario-inline-detail logic-review-overview">${rows}${findings ? `<div class="scenario-inline-evidence-title">已确认并处理的问题</div>${findings}` : ''}${paths ? `<div class="scenario-inline-evidence-title">评审证据文件</div>${paths}` : ''}</div>${rounds}`;
2551
- return renderScenarioStageRecord(stage, '3.3 Spec 代码评审记录', '阶段是否完成依据 spec_group_{G}/review-round_*/ 下的评审报告判断。UNABLE TO VERIFY 表示静态评审已完成、运行期结果未验证,不表示 3.3 未完成。', body);
2768
+ const body = `<div class="scenario-inline-detail logic-review-overview">${rows}${findings ? `<div class="scenario-inline-evidence-title">${tr('已确认并处理的问题')}</div>${findings}` : ''}${paths ? `<div class="scenario-inline-evidence-title">${tr('评审证据文件')}</div>${paths}` : ''}</div>${rounds}`;
2769
+ return renderScenarioStageRecord(stage, tr('3.3 Spec 代码评审记录'), tr('阶段是否完成依据 spec_group_{G}/review-round_*/ 下的评审报告判断。UNABLE TO VERIFY 表示静态评审已完成、运行期结果未验证,不表示 3.3 未完成。'), body);
2552
2770
  }
2553
2771
 
2554
2772
  function renderScenarioLogicEvidence(logic, scene, sceneIndex) {
2555
- if (!logic) return '<div class="stage-empty">尚未发现该 Spec 的步骤三产物。</div>';
2773
+ if (!logic) return `<div class="stage-empty">${tr('尚未发现该 Spec 的步骤三产物。')}</div>`;
2556
2774
  const stages = ['3.1', '3.2', '3.3'].map((stageId) => logic.stages.find((stage) => stage.stage === stageId) || { stage: stageId, status: 'not_started', files: [] });
2557
- return `<p class="scenario-note">3.1 只展示当前场景的编码记录;3.2~3.3 展示当前 Spec 的共享结果。</p>
2558
- <div class="stage-strip">${stages.map((stage) => `<div><span>${stage.stage} · ${escapeHtml(LOGIC_STAGE_NAMES[stage.stage])}</span>${badge(stage.status)}</div>`).join('')}</div>
2559
- <div class="scenario-evidence">${renderScenario31Evidence(logic, scene, sceneIndex, stages[0])}<div class="scenario-shared-divider"><strong>当前 Spec 共享结果</strong><span>以下构建和评审记录属于当前 Spec,不是其他 Spec,也不是逐场景重复执行。</span></div>${renderScenario32Evidence(logic, stages[1])}${renderScenario33Evidence(logic, stages[2])}</div>`;
2775
+ return `<p class="scenario-note">${tr('3.1 只展示当前场景的编码记录;3.2~3.3 展示当前 Spec 的共享结果。')}</p>
2776
+ <div class="stage-strip">${stages.map((stage) => `<div><span>${stage.stage} · ${escapeHtml(tr(LOGIC_STAGE_NAMES[stage.stage] || stage.stage))}</span>${badge(stage.status)}</div>`).join('')}</div>
2777
+ <div class="scenario-evidence">${renderScenario31Evidence(logic, scene, sceneIndex, stages[0])}<div class="scenario-shared-divider"><strong>${tr('当前 Spec 共享结果')}</strong><span>${tr('以下构建和评审记录属于当前 Spec,不是其他 Spec,也不是逐场景重复执行。')}</span></div>${renderScenario32Evidence(logic, stages[1])}${renderScenario33Evidence(logic, stages[2])}</div>`;
2560
2778
  }
2561
2779
 
2562
2780
  function renderSpec(projects) {
2563
- return `<section class="tab" id="spec"><h2>Spec / 场景</h2><p class="lead">先选 Spec,再展开步骤二生成的场景。本页只展示场景概述和场景逻辑步骤;步骤三的编码、构建和评审记录统一放在“逻辑代码转换”页。</p>
2564
- ${projects.map((project, projectIndex) => `<article class="scenario-graph" data-spec-board="${projectIndex}">${project.spec.specs.length ? `<svg class="graph-lines" aria-hidden="true"></svg>
2565
- <div class="graph-col graph-col-spec">${project.spec.specs.map((spec, specIndex) => `<button type="button" class="drill-card graph-node spec-node ${specIndex === 0 ? 'is-active' : ''}" data-spec-index="${specIndex}"><span class="scenario-confirm">标记已人工确认</span><span class="drill-card-title">Spec:${escapeHtml(spec.title)}</span><span class="drill-card-sub">${spec.scenarios.length} 个场景</span><span class="mini-progress"><i style="width:${spec.scenarios.length ? Math.round(spec.scenarios.filter((x) => x.complete).length / spec.scenarios.length * 100) : 0}%"></i></span><span class="drill-card-count">${spec.scenarios.filter((x) => x.complete).length}/${spec.scenarios.length} 个场景已完整生成</span><span class="card-hint">点击展开/收起这个 Spec 的场景 →</span></button>`).join('')}</div>
2566
- <div class="graph-col graph-col-scenario">${project.spec.specs.map((spec, specIndex) => `<div class="scenario-group" data-scenario-group="${specIndex}" ${specIndex ? 'hidden' : ''}><div class="scenario-group-label">${escapeHtml(spec.title)} · ${spec.scenarios.length} 个场景</div>${spec.scenarios.map((scene, sceneIndex) => `<button type="button" class="drill-card graph-node scenario-node ${!specIndex && sceneIndex === 0 ? 'is-active' : ''}" data-spec-index="${specIndex}" data-scene-index="${sceneIndex}"><span class="drill-card-title">${escapeHtml(scene.name)}</span><span class="drill-card-sub">${escapeHtml(scene.description || '场景概述尚未生成')}</span><span class="mini-progress"><i style="width:${scene.complete ? 100 : 35}%"></i></span><span class="drill-card-count">${scene.complete ? '1/1 已完整生成' : '0/1 未完整生成'}</span><span class="card-hint">点击查看/收起这个场景的内容 →</span></button>`).join('') || '<div class="graph-feature-empty">该 Spec 尚未生成场景。</div>'}</div>`).join('')}</div>
2567
- <div class="graph-col graph-col-feature">${project.spec.specs.map((spec, specIndex) => spec.scenarios.map((scene, sceneIndex) => `<article class="graph-feature-panel" data-scene-detail="${specIndex}:${sceneIndex}" ${specIndex || sceneIndex ? 'hidden' : ''}><div class="graph-feature-heading"><h3 class="graph-feature-title">${escapeHtml(scene.name)}</h3><span class="scenario-confirm">标记已人工确认</span></div><section class="scenario-intro"><h4>场景内容</h4><strong>场景概述</strong><p>${escapeHtml(scene.description || '未生成')}</p><strong>场景逻辑步骤</strong><div class="scenario-steps">${escapeHtml(scene.steps || '未生成')}</div></section>${sourceLine('Spec 文件', spec.file)}</article>`).join('')).join('')}</div>` : '<div class="card empty">尚未发现 Spec 产物。</div>'}</article>`).join('')}
2781
+ const specDone = projects.reduce((sum, project) => sum + project.spec.done, 0);
2782
+ const specTotal = projects.reduce((sum, project) => sum + project.spec.total, 0);
2783
+ // Spec explorer: left = spec overview list, right = the selected spec's full
2784
+ // detail (all of its scenarios stacked) — mirrors the example's two-column layout.
2785
+ const dot = (complete) => `<i class="spec-dot ${complete ? 'done' : ''}"></i>`;
2786
+ const completeCount = (spec) => spec.scenarios.filter((scene) => scene.complete).length;
2787
+ return `<section class="tab" id="spec">${tabHero(ICONS.spec, tr('需求规格生成'), '', ring(specDone, specTotal, `${specDone}/${specTotal || 0}`), '')}
2788
+ ${projects.map((project, projectIndex) => `<article class="spec-explorer" data-spec-board="${projectIndex}">${project.spec.specs.length ? `<div class="spec-side"><div class="spec-search"><input type="search" data-spec-search placeholder="${tr('搜索 ')}${project.spec.specs.length}${tr(' 个 Spec')}" aria-label="${tr('搜索 Spec')}"></div><div class="spec-name-list" aria-label="${tr('Spec 总览')}">${project.spec.specs.map((spec, specIndex) => {
2789
+ const total = spec.scenarios.length;
2790
+ const complete = total > 0 && completeCount(spec) === total;
2791
+ return `<button type="button" class="spec-name-item ${specIndex === 0 ? 'is-active' : ''}" data-spec-index="${specIndex}" data-spec-title="${escapeHtml(spec.title.toLowerCase())}"><span class="spec-name-head">${dot(complete)}<strong>${escapeHtml(spec.title)}</strong></span><small>${total ? `${completeCount(spec)}/${total}${tr(' 场景已完整生成')}` : tr('尚未生成场景')}</small></button>`;
2792
+ }).join('')}</div><div class="spec-scene-empty" data-spec-empty hidden>${tr('无匹配 Spec')}</div></div>${project.spec.specs.map((spec, specIndex) => {
2793
+ const total = spec.scenarios.length;
2794
+ const complete = total > 0 && completeCount(spec) === total;
2795
+ return `<article class="spec-detail-panel" data-spec-detail="${specIndex}" ${specIndex ? 'hidden' : ''}><header class="spec-detail-head"><h3>${escapeHtml(spec.title)}</h3><span class="spec-detail-meta">${total}${tr(' 个场景')}</span>${badge(complete ? 'done' : 'in_progress', complete ? tr('已完整生成') : tr('未完整生成'))}</header>${sourceLine(tr('Spec 文件'), spec.file)}<div class="spec-scene-list">${spec.scenarios.map((scene) => `<section class="scenario-intro spec-scene"><h4>${dot(scene.complete)}${escapeHtml(scene.name)}</h4><strong>${tr('场景概述')}</strong><p>${escapeHtml(scene.description || tr('未生成'))}</p><strong>${tr('场景逻辑步骤')}</strong><div class="scenario-steps">${escapeHtml(scene.steps || tr('未生成'))}</div></section>`).join('') || `<div class="spec-scene-empty">${tr('该 Spec 尚未生成场景。')}</div>`}</div></article>`;
2796
+ }).join('')}` : `<div class="card empty">${tr('尚未发现 Spec 产物。')}</div>`}</article>`).join('')}
2568
2797
  </section>`;
2569
2798
  }
2570
2799
 
2571
- function renderLogicStageEvidence(project, logic, stage) {
2572
- if (stage.stage === '3.1') {
2573
- const spec = project.spec.specs.find((item) => item.id === logic.id);
2574
- if (!spec?.scenarios.length) return '<div class="logic-stage-evidence"><div class="stage-empty">当前 Spec 尚未生成可关联的场景编码记录。</div></div>';
2575
- return `<div class="logic-stage-evidence" data-stage-evidence="3.1"><div class="logic-stage-evidence-title"><strong>各场景编码记录</strong><span>每条记录只读取该场景自己的 coverage 证据。</span></div>${spec.scenarios.map((scene, sceneIndex) => {
2576
- const coverage = scenarioCoverageRow(logic, scene, sceneIndex);
2577
- const sceneStatus = coverage ? statusBucket(coverage.status) : stage.status;
2578
- const sceneStage = { ...stage, status: sceneStatus };
2579
- return `<details class="logic-scenario-record" data-logic-scene="${sceneIndex}" ><summary><span><strong>${escapeHtml(scene.name)}</strong><small>${escapeHtml(scene.description || '场景概述尚未生成')}</small></span>${badge(sceneStatus)}</summary><div class="logic-scenario-record-body">${renderScenario31Evidence(logic, scene, sceneIndex, sceneStage)}</div></details>`;
2580
- }).join('')}</div>`;
2581
- }
2582
- const renderers = {
2583
- '3.2': renderScenario32Evidence,
2584
- '3.3': renderScenario33Evidence,
2585
- };
2586
- const render = renderers[stage.stage];
2587
- return `<div class="logic-stage-evidence" data-stage-evidence="${escapeHtml(stage.stage)}">${render ? render(logic, stage) : '<div class="stage-empty">未发现该阶段证据。</div>'}</div>`;
2588
- }
2589
-
2590
-
2591
-
2592
-
2593
-
2594
-
2595
-
2596
2800
  function renderLogic(projects) {
2597
2801
  const allSpecs = projects.flatMap((project) => project.spec.specs);
2598
- const allLogic = projects.flatMap((project) => project.logic);
2599
- const stageMeta = [
2600
- { id: 'A', label: '生成设计文档', desc: '生成并校验 SPEC_DESIGN_N.md' },
2601
- { id: 'B', label: '逻辑转换', desc: '按设计约束生成业务逻辑代码并构建(3.1 编码 → 3.2 构建 → 3.3 评审循环)' },
2602
- { id: 'B2', label: '语义文档', desc: '增量刷新 project/module semantic docs' },
2603
- { id: 'C', label: 'Spec 提交', desc: '以 spec N 提交本 spec 剩余产物' },
2604
- ];
2605
- const isSpecStage = (id) => id === 'A' || id === 'B2' || id === 'C';
2606
- const stageSections = stageMeta.map((meta) => {
2607
- let stageStatus = 'not_started';
2608
- let stageDetail = '';
2609
- let rows = '';
2610
- if (isSpecStage(meta.id)) {
2611
- const doneCount = allSpecs.filter((spec) => {
2612
- const stage = (spec.pipelineStages || []).find((item) => item.id === meta.id);
2613
- return stage && (stage.status === 'done' || stage.status === 'skipped');
2614
- }).length;
2615
- const specTotal = allSpecs.length || 0;
2616
- stageStatus = specTotal > 0 && doneCount >= specTotal ? 'done' : doneCount > 0 ? 'in_progress' : 'not_started';
2617
- stageDetail = doneCount + '/' + specTotal + ' 个 Spec 完成';
2618
- rows = projects.map((project) => project.spec.specs.map((spec) => {
2619
- const stage = (spec.pipelineStages || []).find((item) => item.id === meta.id);
2620
- const status = stage ? (stage.status === 'done' || stage.status === 'skipped' ? 'done' : stage.status) : 'not_started';
2621
- const note = stage && stage.note ? stage.note : (status === 'done' ? '已完成' : '未完成');
2622
- let evidenceHtml = '';
2623
- if (meta.id === 'A') {
2624
- // A 只读状态文件:设计文档名由 a2h-spec-design-pipeline 写入
2625
- // design_file 字段,不做磁盘搜索与存在性判定——文档是否随工程
2626
- // 副本存在不影响状态口径。
2627
- const configuredDesign = String(spec.designFile || '').trim().replace(/\\/g, '/');
2628
- evidenceHtml = configuredDesign
2629
- ? '<small>' + escapeHtml(path.basename(configuredDesign)) + '</small>'
2630
- : '<small>' + escapeHtml(note) + '</small>';
2631
- }
2632
- return '<div class="logic-spec-row"><div><strong>' + escapeHtml(spec.title) + '</strong>' + (evidenceHtml || '<small>' + escapeHtml(note) + '</small>') + '</div>' + badge(status) + '</div>';
2633
- }).join('')).join('') || '<div class="logic-empty">尚未发现 Spec</div>';
2802
+ const allLogic = projects.flatMap((project) => project.logic || []);
2803
+ const specTotal = allSpecs.length;
2804
+ const stageLabels = { A: tr('设计文档'), B: tr('逻辑转换'), B2: tr('语义文档'), C: tr('Spec 提交') };
2805
+ // The stage summary strip shares its source with the step-4 ring / overview ledger (logicStageScore):
2806
+ // A/B2/C read spec_pipeline_state.json, B uses the 3.1-3.3 disk-evidence caliber — one basis for overview and detail pages.
2807
+ const score = logicStageScore(projects);
2808
+ const hasWaveEvidence = allLogic.some((logic) => (logic.stages ?? []).length > 0);
2809
+ const strip = '<div class="logic-stage-strip">' + ['A', 'B', 'B2', 'C'].map((id) => {
2810
+ const scored = score.stages.find((stage) => stage.id === id) || { done: 0, total: specTotal };
2811
+ let status = 'not_started';
2812
+ let detail = '';
2813
+ if (id === 'B' && !hasWaveEvidence) {
2814
+ detail = tr('尚未发现分组式流水线产物');
2634
2815
  } else {
2635
- const hasStages = allLogic.some((logic) => (logic.stages ?? []).length);
2636
- if (hasStages) {
2637
- const specRows = allLogic.map((logic) => {
2638
- const stages = ['3.1', '3.2', '3.3'].map((id) => logic.stages.find((s) => s.stage === id) || { stage: id, status: 'not_started', files: [] });
2639
- const processed = stages.filter((s) => ['done', 'skipped'].includes(s.status)).length;
2640
- const headline = processed === stages.length ? '3.1-3.3 已全部处理' : processed + '/' + stages.length + ' 个阶段已处理';
2641
- const segments = stages.map((s) => '<i class="' + escapeHtml(s.status) + '"></i>').join('');
2642
- const stageBlocks = stages.map((s) => {
2643
- const fileList = (s.files ?? []).filter(exists).map((f) => path.basename(f)).join(' · ');
2644
- return '<div class="logic-progress-stage"><div class="logic-progress-stage-summary"><i class="scenario-stage-dot ' + escapeHtml(s.status) + '"></i><strong>' + escapeHtml(s.stage) + ' · ' + escapeHtml(LOGIC_STAGE_NAMES[s.stage] || s.stage) + '</strong>' + badge(s.status) + '</div>' + (fileList ? '<small>证据:' + escapeHtml(fileList) + '</small>' : '') + '</div>';
2645
- }).join('');
2646
- return '<div class="logic-progress-spec"><div class="logic-progress-summary"><strong>Spec:' + escapeHtml(logic.title) + '</strong><span class="logic-progress-segments">' + segments + '</span><span class="logic-progress-headline">' + escapeHtml(headline) + '</span></div><div class="logic-progress-body">' + stageBlocks + '</div></div>';
2647
- });
2648
- stageStatus = allLogic.every((logic) => ['3.1', '3.2', '3.3'].every((id) => ['done', 'skipped'].includes((logic.stages.find((s) => s.stage === id) || {}).status || 'not_started'))) ? 'done' : 'in_progress';
2649
- const totalProcessed = allLogic.reduce((sum, logic) => sum + (logic.stages || []).filter((s) => ['done', 'skipped'].includes(s.status)).length, 0);
2650
- const totalStages = allLogic.reduce((sum, logic) => sum + (logic.stages || []).length, 0);
2651
- stageDetail = totalProcessed + '/' + totalStages + ' 个阶段已处理';
2652
- rows = specRows.join('');
2653
- }
2654
- if (!hasStages) rows = '<div class="logic-empty">尚未发现分组式流水线产物(spec_pipeline_state.json + spec_group_N/wave_N)。</div>';
2816
+ status = scored.total > 0 && scored.done >= scored.total ? 'done' : (scored.done > 0 || (id === 'B' && hasWaveEvidence)) ? 'in_progress' : 'not_started';
2817
+ detail = scored.done + '/' + scored.total + tr(' 个 Spec 完成');
2655
2818
  }
2656
- const stageDone = stageStatus === 'done' || stageStatus === 'skipped';
2657
- const badgeClass = stageDone ? 'done' : stageStatus === 'blocked' ? 'blocked' : stageStatus === 'in_progress' ? 'in_progress' : 'not_started';
2658
- return '<details class="logic-stage-section ' + escapeHtml(badgeClass) + '"><summary class="logic-stage-header"><span class="logic-stage-badge">' + escapeHtml(meta.id) + '</span><span class="logic-stage-title"><strong>Stage ' + escapeHtml(meta.id) + ' · ' + escapeHtml(meta.label) + '</strong><small>' + escapeHtml(meta.desc) + '</small></span><span class="logic-stage-meta"><strong>' + escapeHtml(stageDetail) + '</strong>' + badge(stageStatus) + '</span></summary><div class="logic-stage-body">' + rows + '</div></details>';
2659
- }).join('');
2660
- const intro = '逻辑代码转换按 Stage A → B → B2 → C 四阶段推进(spec_pipeline_state.json 权威记录这四个值)。Stage A 设计文档、Stage B2 语义文档、Stage C 提交均按 Spec 维度展开;Stage B 逻辑转换由 a2h-spec-design-pipeline 按 wave 派发、按 Spec 维度展开(3.1 逻辑编码 → 3.2 编译构建 → 3.3 代码评审(3→3a→3b 循环)),其完成度以磁盘物证为准。';
2661
- return '<section class="tab" id="logic"><h2>逻辑代码转换</h2><p class="lead">' + escapeHtml(intro) + '</p><div class="logic-progress-list">' + (stageSections || '<div class="card empty">尚未发现逻辑转换阶段产物。</div>') + '</div>' + '</section>';
2662
- }
2819
+ return '<button type="button" class="logic-stage-chip" data-logic-stage="' + escapeHtml(id) + '" title="' + escapeHtml(tr('点击只看该阶段未完成的 Spec')) + '"><span class="logic-stage-chip-id">' + escapeHtml(id) + '</span><span class="logic-stage-chip-text"><strong>' + escapeHtml('Stage ' + id + ' · ' + stageLabels[id]) + '</strong><small>' + escapeHtml(detail) + '</small></span>' + badge(status) + '</button>';
2820
+ }).join('') + '</div>';
2821
+
2822
+ // Spec cards: one card presents the spec's full A → B(3.1/3.2/3.3) → B2 → C trail.
2823
+ // B only trusts disk evidence (same caliber as logicStageScore's bDone); the state file's B is the
2824
+ // pipeline's self-report and can drift from evidence — not used for display. skipped is shown honestly
2825
+ // as skipped, never folded into done; the totals count done+skipped as processed.
2826
+ const specEntries = projects.flatMap((project) => (project.spec.specs || []).map((spec) => {
2827
+ const stageOf = (id) => (spec.pipelineStages || []).find((item) => item.id === id);
2828
+ const logicEntry = (project.logic || []).find((logic) => logic.id === spec.id) || null;
2829
+ const bStages = ['3.1', '3.2', '3.3'].map((id) => ((logicEntry && Array.isArray(logicEntry.stages) ? logicEntry.stages.find((s) => s.stage === id) : null)) || { stage: id, status: 'not_started', files: [] });
2830
+ const bProcessed = bStages.filter((s) => ['done', 'skipped'].includes(s.status)).length;
2831
+ const bStatus = bStages.some((s) => s.status === 'blocked') ? 'blocked' : bProcessed === bStages.length ? 'done' : bStages.some((s) => s.status !== 'not_started') ? 'in_progress' : 'not_started';
2832
+ const trail = [
2833
+ { key: 'A', status: (stageOf('A') || {}).status || 'not_started' },
2834
+ ...bStages.map((s) => ({ key: s.stage, status: s.status })),
2835
+ { key: 'B2', status: (stageOf('B2') || {}).status || 'not_started' },
2836
+ { key: 'C', status: (stageOf('C') || {}).status || 'not_started' },
2837
+ ];
2838
+ const processed = trail.filter((item) => ['done', 'skipped'].includes(item.status)).length;
2839
+ const cardStatus = trail.some((item) => item.status === 'blocked') ? 'blocked' : processed === trail.length ? 'done' : processed > 0 ? 'in_progress' : 'not_started';
2840
+
2841
+ const pipelineRow = (id) => {
2842
+ const stage = stageOf(id);
2843
+ const status = stage ? stage.status : 'not_started';
2844
+ const note = stage && stage.note ? stage.note : statusLabel(status);
2845
+ let evidence = escapeHtml(note);
2846
+ if (id === 'A') {
2847
+ // A only reads the state file: the design doc name is written by a2h-spec-design-pipeline into
2848
+ // the design_file field — no disk search or existence check; whether the document exists in the
2849
+ // project copy does not affect the status caliber.
2850
+ const configuredDesign = String(spec.designFile || '').trim().replace(/\\/g, '/');
2851
+ if (configuredDesign) evidence = escapeHtml(path.basename(configuredDesign));
2852
+ }
2853
+ return '<div class="logic-spec-row"><div><span class="logic-spec-stage-head"><i class="scenario-stage-dot ' + escapeHtml(status) + '"></i><strong>' + escapeHtml('Stage ' + id + ' · ' + stageLabels[id]) + '</strong></span><small>' + evidence + '</small></div>' + badge(status) + '</div>';
2854
+ };
2855
+ const bHeadline = bProcessed === bStages.length ? tr('3.1-3.3 已全部处理') : bProcessed + '/' + bStages.length + tr(' 个阶段已处理');
2856
+ const bBlocks = bStages.map((s) => {
2857
+ const fileList = (s.files ?? []).filter(exists).map((file) => path.basename(file)).join(' · ');
2858
+ return '<div class="logic-progress-stage"><div class="logic-progress-stage-summary"><i class="scenario-stage-dot ' + escapeHtml(s.status) + '"></i><strong>' + escapeHtml(s.stage + ' · ' + (LOGIC_STAGE_NAMES[s.stage] ? tr(LOGIC_STAGE_NAMES[s.stage]) : s.stage)) + '</strong>' + badge(s.status) + '</div>' + (fileList ? '<small>' + tr('证据:') + escapeHtml(fileList) + '</small>' : '') + '</div>';
2859
+ }).join('');
2860
+ const bRow = '<div class="logic-spec-stage-block"><div class="logic-progress-summary"><strong>Stage B · ' + escapeHtml(stageLabels.B) + '</strong><span class="logic-progress-segments">' + bStages.map((s) => '<i class="' + escapeHtml(s.status) + '"></i>').join('') + '</span><span class="logic-progress-headline' + (bStatus === 'blocked' ? ' blocked' : '') + '">' + escapeHtml(bHeadline) + '</span></div>' + bBlocks + '</div>';
2861
+ const trailDots = trail.map((item) => '<i class="scenario-stage-dot ' + escapeHtml(item.status) + '" title="' + escapeHtml(item.key) + '"></i>').join('');
2862
+ return {
2863
+ rank: ({ blocked: 0, in_progress: 1, not_started: 2, skipped: 3, done: 4 }[cardStatus] ?? 4), html: '<details data-logic-card data-logic-title="' + escapeHtml(spec.title.toLowerCase()) + '" data-stage-status="' + escapeHtml('A=' + trail[0].status + ';B=' + bStatus + ';B2=' + trail[4].status + ';C=' + trail[5].status) + '" class="logic-progress-spec logic-spec-card ' + escapeHtml(cardStatus) + '"><summary><span class="logic-progress-summary"><strong>' + escapeHtml(tr('Spec:')) + escapeHtml(spec.title) + '</strong><span class="logic-spec-trail">' + trailDots + '</span><span class="logic-spec-card-count">' + escapeHtml(processed + '/' + trail.length + tr(' 个阶段已处理')) + '</span></span>' + badge(cardStatus) + '</summary><div class="logic-progress-body">'
2864
+ + pipelineRow('A')
2865
+ + bRow
2866
+ + pipelineRow('B2')
2867
+ + pipelineRow('C')
2868
+ + '</div></details>'
2869
+ };
2870
+ }));
2871
+ specEntries.sort((a, b) => a.rank - b.rank);
2872
+ const specCards = specEntries.map((entry) => entry.html).join('');
2663
2873
 
2874
+ return '<section class="tab" id="logic" data-logic-board>' + tabHero(ICONS.logic, tr('逻辑代码转换'), '', ring(score.strictDone, score.specTotal, score.strictDone + '/' + score.specTotal), 'orange') + strip + '<div class="spec-search logic-search-row"><input type="search" data-logic-search placeholder="' + escapeHtml(tr('搜索 ') + specTotal + tr(' 个 Spec')) + '" aria-label="' + escapeHtml(tr('搜索 Spec')) + '"></div>' + '<div class="logic-progress-list">' + (specCards || '<div class="card empty">' + tr('尚未发现 Spec 产物。') + '</div>') + '</div><div class="spec-scene-empty" data-logic-empty hidden>' + tr('无匹配 Spec') + '</div></section>';
2875
+ }
2664
2876
 
2665
2877
 
2878
+ // Dashboard stylesheet lives next to this script; re-read on every render so CSS
2879
+ // edits take effect with the 30-second auto-refresh without restarting the server.
2880
+ const DASHBOARD_CSS_PATH = path.join(path.dirname(fileURLToPath(import.meta.url)), 'dashboard.css');
2881
+ function dashboardCss() {
2882
+ try {
2883
+ return fs.readFileSync(DASHBOARD_CSS_PATH, 'utf8');
2884
+ } catch (error) {
2885
+ throw new Error('dashboard.css is missing next to dashboard.mjs (' + DASHBOARD_CSS_PATH + '): ' + error.message);
2886
+ }
2887
+ }
2666
2888
  function renderHtml(projects, usages = [], architecture = null, options = {}) {
2889
+ RENDER_LANG = options.lang === 'en' || options.lang === 'zh' ? options.lang : 'zh';
2667
2890
  const arch = architecture || architectureModel();
2668
- const generated = new Date().toLocaleString('zh-CN', { hour12: false });
2891
+ // Nav status dots derive from the same overview() caliber as the overview page — no second source of truth.
2892
+ const navOv = overview(projects, arch);
2893
+ const navArch = stepStatus(navOv.arch.done, navOv.arch.total);
2894
+ const navUi = stepStatus(navOv.ui.done, navOv.ui.total);
2895
+ const navSpec = stepStatus(navOv.spec.done, navOv.spec.total);
2896
+ const navLogic = logicStepStatus(navOv.logic);
2897
+ const dotCls = (s) => (s === 'done' ? ' nav-state--done' : s === 'in_progress' ? ' nav-state--active' : '');
2898
+ const generated = new Date().toLocaleString(RENDER_LANG === 'en' ? 'en-US' : 'zh-CN', { hour12: false });
2669
2899
  const shutdownControl = options.shutdownButton
2670
- ? '<div class="shutdown-wrap"><button id="shutdown-btn" type="button" title="停止看板服务进程(等价于在启动终端按 Ctrl+C)">停止看板服务</button></div>'
2900
+ ? `<div class="shutdown-wrap"><button id="shutdown-btn" type="button" title="${escapeHtml(tr('停止看板服务进程(等价于在启动终端按 Ctrl+C)'))}">${tr('停止看板服务')}</button></div>`
2671
2901
  : '';
2672
2902
  const shutdownScript = options.shutdownButton
2673
- ? `document.getElementById('shutdown-btn')?.addEventListener('click',async()=>{if(!confirm('确定关闭看板服务吗?关闭后本页面不可用,需到启动看板的终端重新运行命令。'))return;window.__a2hShutdown=true;const btn=document.getElementById('shutdown-btn');btn.disabled=true;btn.textContent='正在关闭…';try{await fetch('/shutdown',{method:'POST',cache:'no-store'})}catch{/* 服务可能已停止 */}document.body.insertAdjacentHTML('beforeend','<div class="shutdown-overlay"><div><strong>看板服务已停止</strong><br>本页面已不可用,可以关闭此标签页。<br><small>如需再次查看,请在启动看板的终端重新运行命令。</small></div></div>')});`
2903
+ ? `document.getElementById('shutdown-btn')?.addEventListener('click',async()=>{if(!confirm('${tr("确定关闭看板服务吗?关闭后本页面不可用,需到启动看板的终端重新运行命令。")}'))return;window.__a2hShutdown=true;const btn=document.getElementById('shutdown-btn');btn.disabled=true;btn.textContent='${tr("正在关闭…")}';try{await fetch('/shutdown',{method:'POST',cache:'no-store'})}catch{/* 服务可能已停止 */}document.body.insertAdjacentHTML('beforeend','<div class="shutdown-overlay"><div>${tr("<strong>看板服务已停止</strong><br>本页面已不可用,可以关闭此标签页。<br><small>如需再次查看,请在启动看板的终端重新运行命令。</small>")}</div></div>')});`
2674
2904
  : '';
2675
2905
  const shutdownCss = options.shutdownButton
2676
- ? '.shutdown-wrap{margin-top:10px;padding:0 18px 16px}#shutdown-btn{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--muted);font:inherit;font-size:13px;cursor:pointer;transition:color .15s,border-color .15s,background .15s}#shutdown-btn:hover{color:var(--red);border-color:var(--red);background:#fbf1ee}#shutdown-btn:disabled{opacity:.55;cursor:default}.shutdown-overlay{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(33,31,28,.55)}.shutdown-overlay>div{background:#fff;border-radius:12px;padding:28px 32px;max-width:420px;text-align:center;color:var(--text);font-size:15px;line-height:1.8;box-shadow:0 12px 40px rgba(0,0,0,.25)}.shutdown-overlay strong{font-size:17px}'
2906
+ ? '.shutdown-wrap{margin-top:10px;padding:0 18px 16px}#shutdown-btn{width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--secondary);font:inherit;font-size:13px;cursor:pointer;transition:color .15s,border-color .15s,background .15s}#shutdown-btn:hover{color:var(--red);border-color:var(--red);background:var(--danger-dim)}#shutdown-btn:disabled{opacity:.55;cursor:default}.shutdown-overlay{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:var(--scrim)}.shutdown-overlay>div{background:var(--panel);border-radius:12px;padding:28px 32px;max-width:420px;text-align:center;color:var(--text);font-size:15px;line-height:1.8;box-shadow:0 12px 40px rgba(0,0,0,.25)}.shutdown-overlay strong{font-size:17px}'
2677
2907
  : '';
2678
- return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>HomeTrans 转换看板</title>
2679
- <style>
2680
- :root{--bg:#fbfaf7;--panel:#fff;--line:#e7ded1;--text:#211f1c;--muted:#958879;--accent:#db7658;--green:#6f925d;--amber:#c9943c;--red:#a75a51;--gray:#a59c8e}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--bg);color:var(--text);font-family:Inter,"Segoe UI","Microsoft YaHei",sans-serif}.layout{display:grid;grid-template-columns:286px minmax(0,1fr);min-height:100vh}aside{position:sticky;top:0;height:100vh;padding:30px 24px;background:#f5f0e7;border-right:1px solid var(--line)}.brand{display:flex;gap:10px;align-items:center;font-weight:800;font-size:20px;padding-bottom:24px;border-bottom:1px solid var(--line);margin-bottom:18px}.logo{display:grid;place-items:center;width:38px;height:38px;border-radius:10px;background:#d77b5c;color:#fff}.brand span{display:block;color:var(--muted);font-size:13px;font-weight:400}nav button{width:100%;border:0;background:transparent;text-align:left;padding:15px 17px;margin:5px 0;border-radius:10px;font-size:16px;color:#776e63;cursor:pointer}nav button.active{color:var(--accent);background:#eee7dc;box-shadow:inset 3px 0 var(--accent)}main{padding:34px 38px;max-width:1800px;width:100%;margin:auto}.top h1{font-size:40px;font-weight:330;margin:0}.top p,.lead,.source,small{color:var(--muted)}.live{display:inline-block;color:#557744;background:#edf4e8;border:1px solid #cbdcbe;border-radius:999px;padding:4px 10px;font-size:13px;font-weight:700;margin-right:10px}.tab{display:none}.tab.active{display:block}h2{font-family:Georgia,"Songti SC",serif;font-size:26px;border-bottom:1px solid var(--line);padding-bottom:9px;margin:24px 0 8px}h3{margin:8px 0 10px}.card{background:var(--panel);border:1px solid var(--line);border-radius:13px;padding:22px;margin:16px 0;box-shadow:0 2px 4px #00000008}.overall{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:40px;padding:28px 34px}.overall .ring{width:128px;height:128px}.overall-copy{display:flex;flex-direction:column;gap:10px}.overall-copy strong{color:var(--green);font-size:22px}.step-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.progress-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.step-grid article{text-align:center;min-height:280px}.step-grid p{min-height:48px;color:#72685d}.outline{border:1px solid var(--accent);background:#fff;color:var(--accent);border-radius:7px;padding:8px 16px;margin:9px;cursor:pointer;font-weight:600}.ring{width:94px;height:94px;margin:0 auto 16px;border-radius:50%;display:grid;place-items:center;background:conic-gradient(var(--green) var(--p),#e9e0d0 0);position:relative}.ring.zero{background:#e9e0d0}.ring:before{content:"";position:absolute;inset:10px;background:white;border-radius:50%}.ring span{position:relative;font-weight:800;font-size:17px}.badge{display:inline-block;border-radius:999px;padding:3px 10px;font-size:13px;background:#eee9df;color:#6d665c;white-space:nowrap}.badge.done{background:#e7f0e1;color:#557744}.badge.in_progress{background:#f7e9c9;color:#946516}.badge.blocked{background:#f3deda;color:#93483f}.badge.skipped,.badge.not_started{background:#eeeae3;color:#847c70}.compact{min-width:0}.compact h2,.consumption h2{font-size:24px;margin-top:0}.scroll-list{max-height:310px;overflow:auto}.row{display:flex;justify-content:space-between;gap:18px;padding:13px 2px;border-top:1px solid var(--line)}.row:first-child{border-top:0}.row small{display:block;margin-top:6px}.consumption .usage-note{margin-top:12px;color:var(--muted);font-size:12px;line-height:1.5}
2681
- .consumption{margin-top:22px}.usage-agent{border:1px solid var(--line);background:#fdfbf8;border-radius:10px;padding:17px;margin-top:14px}.usage-head,.section-head,.page-title{display:flex;justify-content:space-between;align-items:center;gap:20px}.usage-head h3{margin:0}.metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-top:14px}.metric{border:1px solid var(--line);background:#fff;border-radius:9px;padding:16px;min-height:118px}.metric span,.metric small{display:block}.metric strong{display:block;font-size:24px;margin:11px 0}.unavailable{background:#f4efe7;border-left:4px solid #b9ae9f;border-radius:8px;padding:13px;color:#766d62}.ui-project{background:#f4eddf}.ui-slide{background:#fff;border-radius:12px;padding:18px;margin-top:15px}.capture-grid{display:grid;grid-template-columns:1fr auto 1fr;gap:22px;align-items:center;margin-top:16px}.capture{text-align:center}.phone{margin:auto;width:min(390px,100%);height:690px;background:#191919;border:10px solid #191919;border-radius:40px;overflow:auto;box-shadow:0 4px 14px #0002}.phone img{width:100%;height:auto;display:block}.capture-empty{height:300px;display:grid;place-items:center;border:1px dashed var(--line);border-radius:18px;color:var(--muted);background:#faf8f3}.arrow{font-size:36px;color:#9b8f7e}.pager{display:flex;align-items:center}.spec-board,.logic-project{margin-top:18px}.spec-detail,.logic-spec{border:1px solid var(--line);background:#fff;border-radius:12px;padding:15px 18px;margin:14px 0}.spec-detail>summary,.logic-spec>summary,.scenario-card>summary,.stage-report>summary{display:flex;justify-content:space-between;gap:18px;cursor:pointer;list-style:none}.spec-detail>summary small{display:block;margin-top:7px}.scenario-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:16px 0}.scenario-card{border:1px solid var(--line);border-radius:10px;padding:14px;background:#fbfaf7}.scenario-card summary p{color:var(--muted);margin:6px 0}.scenario-content{grid-column:1/-1;padding-top:14px}.scenario-content section{border:1px solid var(--line);border-radius:9px;padding:14px;margin-top:10px;background:#fff}.scenario-content pre,.evidence pre{white-space:pre-wrap;word-break:break-word;font-family:inherit;line-height:1.7}.stage-strip{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:15px 0}.stage-strip>div{display:flex;justify-content:space-between;align-items:center;border:1px solid var(--line);border-radius:8px;padding:10px;background:#faf8f3}.stage-report{border-top:1px solid var(--line);padding:14px 0}.evidence{background:#faf8f3;border:1px solid var(--line);border-radius:8px;padding:13px;margin-top:10px}.evidence pre{max-height:460px;overflow:auto;font-family:Consolas,monospace;font-size:13px}.dot{display:inline-block;width:25px;height:8px;border-radius:8px;background:var(--gray);margin-left:5px}.dot.done{background:var(--green)}.dot.in_progress{background:var(--amber)}.dot.blocked{background:var(--red)}.empty{padding:32px;color:var(--muted);text-align:center}.footer{color:var(--muted);margin-top:32px;font-size:13px;padding-bottom:30px}@media(max-width:1100px){.progress-grid,.metric-grid{grid-template-columns:repeat(2,1fr)}.capture-grid{grid-template-columns:1fr}.arrow{transform:rotate(90deg)}}@media(max-width:820px){.layout{grid-template-columns:1fr}aside{position:static;height:auto}nav{display:flex;overflow:auto}.step-grid{grid-template-columns:repeat(2,1fr)}.progress-grid,.metric-grid,.scenario-grid,.stage-strip{grid-template-columns:1fr}main{padding:20px}.overall{grid-template-columns:1fr;text-align:center}.top h1{font-size:32px}}
2682
- .scenario-check{background:#faf8f3;border:1px solid var(--line);border-radius:8px;padding:10px 14px;margin-top:10px}.scenario-check p{margin:6px 0;line-height:1.6}
2683
- .scenario-stage3-head{display:flex;align-items:baseline;gap:8px;min-width:0}.scenario-stage3-caption{font-weight:400;color:#74695e}
2684
- .scenario-summary-lines{padding:4px 4px 7px}.scenario-summary-lines p{margin:7px 0;line-height:1.55}
2685
- .scenario-inline-spec,.scenario-inline-detail{background:#faf8f3;border:1px solid var(--line);border-radius:8px;padding:12px 15px;margin-top:11px}
2686
- .scenario-inline-row{font-size:13px;line-height:1.55;color:#62574c;margin:5px 0}
2687
- .scenario-inline-evidence-title{margin:0 0 8px;padding-top:2px;font-size:12px;font-weight:700;color:#8a7d70;text-transform:uppercase}
2688
- .scenario-inline-completion{border-top:1px solid #e6dfd8;margin-top:8px;padding-top:7px;font-family:Consolas,monospace;font-size:12px;line-height:1.5;color:#4d463f}
2689
- .scenario-inline-completion p{margin:3px 0}.scenario-evidence-file{border-top:1px solid #e6dfd8;margin-top:8px;padding-top:8px}
2690
- .arch-overview{display:grid;grid-template-columns:auto 1fr auto;gap:24px;align-items:center;padding:24px}
2691
- .arch-ring-col{display:grid;place-items:center;min-width:120px}
2692
- .arch-info-col{min-width:0}
2693
- .arch-info-col h3{margin:0 0 8px;font-size:22px}
2694
- .arch-info-col p{margin:0 0 12px;color:var(--muted);font-size:15px}
2695
- .arch-overview-tags{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
2696
- .arch-overview-tags span{font-size:14px;color:#776e63}
2697
- .arch-stats-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;min-width:200px}
2698
- .arch-stat-card{display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:10px;padding:14px 18px;background:#fdfbf8;text-align:center}
2699
- .arch-stat-card strong{font-size:32px;color:var(--accent)}
2700
- .arch-stat-card span{font-size:14px;color:var(--muted);margin-top:4px}
2701
- .arch-subtitle{margin:28px 0 12px;font-size:24px}
2702
- .arch-stage-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
2703
- .arch-stage-card{margin:0}
2704
- .arch-stage-card summary{display:flex;align-items:center;gap:14px;cursor:pointer;list-style:none}
2705
- .arch-stage-card summary::-webkit-details-marker{display:none}
2706
- .arch-stage-index{display:grid;place-items:center;width:36px;height:36px;border-radius:9px;background:#f0e9dd;color:#7a6f62;font-weight:700;font-size:18px;flex:none}
2707
- .arch-stage-card summary span:nth-child(2){flex:1;min-width:0}
2708
- .arch-stage-card summary strong{display:block;font-size:17px}
2709
- .arch-stage-card summary small{display:block;color:var(--muted);font-size:13px;margin-top:3px}
2710
- .arch-stage-body{padding:16px 20px;border-top:1px solid var(--line);font-size:14px}
2711
- .arch-evidence{display:flex;flex-direction:column;gap:8px}
2712
- .arch-evidence-file{background:#faf8f3;border:1px solid var(--line);border-radius:7px;padding:10px 14px;font-size:14px}
2713
- .arch-evidence-file small{display:block;color:var(--muted);font-size:12px;margin-top:3px;word-break:break-all}
2714
- .arch-evidence-empty,.arch-stage-body .arch-evidence-empty{color:var(--muted);font-size:14px;padding:10px 0}
2715
- .arch-stage-card.done .arch-stage-index{background:#e7f0e1;color:#557744}
2716
- .arch-stage-card.blocked .arch-stage-index{background:#f3deda;color:#93483f}
2717
- .arch-stage-card.in_progress .arch-stage-index{background:#f7e9c9;color:#946516}
2718
- .logic-stage-section{border:1px solid var(--line);border-radius:12px;background:#fff;margin:18px 0;overflow:hidden}
2719
- .logic-stage-header{display:flex;align-items:center;gap:14px;padding:16px 20px;cursor:pointer;background:#fdfbf8;border-bottom:1px solid var(--line)}
2720
- .logic-stage-header:hover{background:#f9f5ee}
2721
- .logic-stage-badge{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:#f0e9dd;color:#7a6f62;font-weight:800;font-size:14px;flex:none}
2722
- .logic-stage-header .logic-stage-title{flex:1;min-width:0}
2723
- .logic-stage-header .logic-stage-title strong{font-size:17px;display:block}
2724
- .logic-stage-header .logic-stage-title small{color:var(--muted);font-size:13px}
2725
- .logic-stage-meta{display:flex;gap:18px;align-items:center;font-size:13px;color:#776e63}
2726
- .logic-stage-meta strong{color:var(--text)}
2727
- .logic-stage-body{padding:16px 20px}
2728
- .logic-spec-row,.logic-wave-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 14px;border:1px solid var(--line);border-radius:9px;margin:8px 0;background:#fdfbf8}
2729
- .logic-spec-row strong,.logic-wave-row strong{font-size:14px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
2730
- .logic-spec-row small,.logic-wave-row small{display:block;color:var(--muted);font-size:12px;margin-top:3px}
2731
- .logic-empty{padding:24px;color:var(--muted);text-align:center}
2732
- .arch-doc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:18px}
2733
- .arch-doc-card{border:1px solid var(--line);border-radius:12px;background:#fff;padding:18px 20px;display:flex;flex-direction:column;gap:8px}
2734
- .arch-doc-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
2735
- .arch-doc-head strong{font-size:16px;font-family:Consolas,monospace}
2736
- .arch-doc-desc{font-size:14px;font-weight:600;color:var(--text);margin:0}
2737
- .arch-doc-detail{font-size:13px;color:var(--muted);line-height:1.6;margin:0}
2738
- .arch-doc-file{font-size:12px;color:var(--muted);word-break:break-all;background:#faf8f3;border:1px solid var(--line);border-radius:7px;padding:8px 11px;margin-top:4px}
2739
- .arch-scope-card{padding:20px 24px}
2740
- .arch-scope-card p{font-size:14px;line-height:1.7;color:#5d5349;margin:0 0 14px}
2741
- .arch-scope-modules{font-size:15px;display:flex;gap:8px;align-items:center}
2742
- .arch-scope-modules span{font-weight:700;color:var(--accent)}
2743
- </style>
2744
- <style>
2745
- /* Keep the Node renderer visually compatible with the original dashboard. */
2746
- :root{--bg:#faf9f5;--panel:#fff;--line:#e6dfd8;--text:#141413;--muted:#948879;--accent:#cc785c;--green:#6f925d}
2747
- body{background:var(--bg);font-family:"Segoe UI","Microsoft YaHei",Arial,sans-serif;font-size:15px;line-height:1.45}
2748
- .layout{grid-template-columns:320px minmax(0,1fr)}
2749
- aside{padding:24px 20px;background:#f5f0e8}
2750
- .brand{padding:0 6px 22px;margin-bottom:14px;font-size:19px}.logo{width:36px;height:36px;border-radius:9px}
2751
- nav button{display:flex;align-items:center;gap:13px;height:50px;padding:0 16px;margin:3px 0;border-radius:9px;font-size:16px}
2752
- nav button>span{display:inline-flex;align-items:center;line-height:1.2}
2753
- nav button svg{position:relative;top:-1px;width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;flex:none}
2754
- nav button.active{background:#efe9de;box-shadow:inset 3px 0 var(--accent)}
2755
- main{max-width:none;padding:24px 32px;margin:0}.top h1{font-size:36px;line-height:1.2}.top p{margin:10px 0 22px}
2756
- h2{font-size:24px;margin:22px 0 8px}h3{font-size:18px}.lead{margin:7px 0 17px}
2757
- .card{border-radius:10px;padding:24px 26px;margin:14px 0;box-shadow:0 2px 5px #392e2510}
2758
- .overall{min-height:190px;grid-template-columns:1fr auto 1fr;gap:34px;padding:26px 30px}.overall h2{margin-top:0}.overall .ring{width:116px;height:116px}.overall-copy strong{font-size:21px}
2759
- .step-grid{gap:12px}.progress-grid{gap:18px}.step-grid article{min-height:238px;padding:18px 14px}.step-grid h3{margin:6px 0;font-size:16px}.step-grid p{min-height:40px;margin:6px 0;color:#756a5f;font-size:13px}.step-grid .ring{width:66px;height:66px;margin-bottom:10px}.step-grid .ring:before{inset:7px}.step-grid .ring span{font-size:14px}.step-grid .outline{font-size:13px;padding:6px 12px;margin:6px}
2760
- .outline{border-radius:6px;padding:7px 15px;margin:8px}.progress-grid>.compact{height:350px;min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:22px 24px}.compact h2{font-size:22px}.progress-grid>.compact>h2,.progress-grid>.compact>.lead{flex:0 0 auto}.progress-grid>.compact>.scroll-list{flex:1 1 auto;min-height:0;max-height:none;overflow-x:hidden;overflow-y:auto;padding-right:8px;scrollbar-gutter:stable;overscroll-behavior:contain}
2761
- .row{align-items:center;padding:11px 1px}.row>div{min-width:0}.row strong{display:block;font-size:15px}.row small{line-height:1.35;overflow-wrap:anywhere}
2762
- .badge{display:inline-flex!important;align-items:center;justify-content:center;flex:0 0 auto!important;align-self:center;width:auto!important;height:auto!important;min-width:0!important;min-height:0!important;border-radius:4px!important;padding:2px 8px!important;font-size:12px!important;line-height:1.35!important;font-weight:600!important}
2763
- .usage-agent{padding:16px 18px}.metric{min-height:108px}.metric strong{font-size:22px}
2764
- .ui-project{background:#f3ecde;padding:18px;overflow:hidden}.ui-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:12px}.ui-toolbar-main{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.ui-switch-hint{color:var(--muted);font-size:13px}.device-capture-bar{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 7px}.device-capture-state{display:flex;align-items:center;gap:7px;min-width:260px;padding:8px 11px;border:1px solid #dfd5c8;border-radius:8px;background:#fff}.device-capture-state small{color:var(--muted);overflow-wrap:anywhere}.device-capture-state.done{border-color:#c6d9bb;background:#f8fcf6}.device-capture-state.blocked{border-color:#e4c8a1;background:#fffaf1}.ui-project-meta{padding:0 4px 5px}.ui-project-meta h2{margin:7px 0 5px}.pager{gap:7px}.page-counter{font-family:Consolas,monospace;font-weight:700;background:#fff;border:1px solid #ded3c4;border-radius:999px;padding:5px 11px;white-space:nowrap}.ui-stack{position:relative;isolation:isolate;padding:0 10px 12px 0}.ui-stack:before,.ui-stack:after{content:"";position:absolute;inset:12px 0 0 12px;background:#fff9;border:1px solid #e6dccd;border-radius:12px;z-index:-2;box-shadow:0 4px 10px #392e2510}.ui-stack:after{inset:6px 6px 6px 6px;background:#fff;z-index:-1}.ui-slide{position:relative;background:#fff;border:1px solid var(--line);border-radius:12px;padding:20px;margin-top:15px;box-shadow:0 5px 15px #392e2512;transform-origin:center top}.ui-slide.ui-enter-next{animation:hmUiNext .34s cubic-bezier(.22,.75,.32,1) both}.ui-slide.ui-enter-prev{animation:hmUiPrev .34s cubic-bezier(.22,.75,.32,1) both}.ui-slide .page-title h2{margin:0 0 4px;border:0;padding:0}.ui-filter-empty{margin-top:15px;padding:34px;border:1px dashed #d8ccbc;border-radius:12px;background:#fff;color:var(--muted);text-align:center}.capture-grid{display:grid;grid-template-columns:minmax(300px,1fr) auto minmax(300px,1fr);gap:22px;align-items:start;background:#f4eddf;border-radius:13px;padding:16px}.phone-card{min-width:0;background:#fff;border:1px solid var(--line);border-radius:13px;padding:14px;box-shadow:0 2px 7px #392e2512}.phone-card-head{text-align:left;margin-bottom:10px}.phone-card-head h3{font-family:Georgia,"Songti SC",serif;font-size:19px;margin:0}.phone-card-head p{color:var(--muted);font-size:13px;margin:3px 0}.compare-tag{text-align:center;color:#74695e;font-weight:700;font-size:13px;margin-bottom:8px}.compare-tag-after{color:var(--accent)}.capture-mismatch{display:inline-block;color:#946516;background:#f7e9c9;border:1px solid #e4c8a1;border-radius:999px;padding:2px 10px;margin-left:10px;font-size:12px;font-weight:700;cursor:help;white-space:nowrap}.phone-shell{position:relative;width:min(370px,100%);height:680px;margin:auto;border:8px solid #1b1b1b;border-radius:34px;background:#1b1b1b;overflow:hidden;box-shadow:0 4px 12px #0002}.phone-notch{position:absolute;z-index:2;left:50%;top:-1px;transform:translateX(-50%);width:112px;height:21px;background:#1b1b1b;border-radius:0 0 12px 12px}.phone-screen{height:100%;overflow:auto;background:#fff;border-radius:25px}.phone-screen img{display:block;width:100%;height:auto;min-height:100%;object-fit:cover;object-position:top}.capture-empty{height:100%;min-height:100%;display:grid;align-content:center;justify-items:center;gap:8px;padding:28px;text-align:center;color:var(--muted);background:linear-gradient(180deg,#fbfaf7,#f5f0e8)}.capture-empty strong{color:#776d62;font-size:16px}.capture-empty span{max-width:240px;font-size:13px;line-height:1.6}.capture-empty-card{height:100%;min-height:520px;display:grid;align-content:center;justify-items:start;gap:8px;padding:26px;border:1px dashed #d8ccbc;border-radius:13px;background:#fffdf9;color:var(--muted);text-align:left}.capture-empty-card h4{margin:0;font-family:Georgia,"Songti SC",serif;font-size:17px;color:#776d62}.capture-empty-card p{margin:0;max-width:380px;line-height:1.7;font-size:13.5px;overflow-wrap:anywhere}.capture-grid>.arrow{align-self:center;font-size:34px;color:#9b8f7e}.ui-slide:focus-visible{outline:3px solid #cc785c66;outline-offset:3px}
2765
- .phone-notch{z-index:9}.phone-image-layer{position:relative;width:100%;min-height:100%}.phone-image-layer img,.capture-stitch canvas{display:block;width:100%;height:auto;min-height:0;object-fit:contain;object-position:top}.capture-stitch{min-height:0}.capture-marker{position:absolute;z-index:8;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;color:#fff;cursor:crosshair;transition:opacity .14s ease,filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.capture-marker-badge{position:absolute;right:-8px;top:-8px;display:grid;place-items:center;width:22px;height:22px;border:2px solid #fff;border-radius:50%;background:#ad5b49;color:#fff;font:700 11px/18px "Segoe UI","Microsoft YaHei",sans-serif;box-shadow:0 1px 5px #0009;transition:transform .16s ease,background .16s ease,box-shadow .16s ease}.capture-marker:hover,.capture-marker:focus-visible,.capture-marker.marker-peer-active{background:#cc785c33;border-color:transparent;box-shadow:inset 0 0 0 2px var(--accent),0 8px 22px #a9583e38;outline:0}.capture-marker:hover .capture-marker-badge,.capture-marker:focus-visible .capture-marker-badge,.capture-marker.marker-peer-active .capture-marker-badge{transform:scale(1.18);background:#ef7956;box-shadow:0 0 0 4px #ef795655,0 2px 7px #0008}.ui-slide.marker-linking [data-marker]{transition:opacity .14s ease,filter .14s ease,background .14s ease,border-color .14s ease,box-shadow .14s ease}.ui-slide.marker-linking [data-marker]:not(.marker-peer-active){opacity:.34;filter:grayscale(.45)}.capture-legend-row{cursor:default}.capture-legend-row.marker-peer-active,.capture-legend-row:focus-visible{opacity:1!important;filter:none!important;border-color:var(--accent);background:#fff8f3;box-shadow:0 0 0 3px #cc785c29,0 6px 16px #a9583e1f;outline:0}.capture-legend-row.marker-peer-active .capture-legend-no,.capture-legend-row:focus-visible .capture-legend-no{background:#ef7956;transform:scale(1.08)}
2766
- .scenario-graph{position:relative;display:flex;align-items:flex-start;gap:44px;margin:16px 0 28px;padding:6px 0 28px;min-height:430px}
2767
- .graph-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:0}
2768
- .graph-col{position:relative;z-index:1}.graph-col-spec,.graph-col-scenario{width:250px;flex:0 0 250px}.graph-col-feature{flex:1;min-width:360px}
2769
- .scenario-group{display:flex;flex-direction:column;gap:12px}.scenario-group[hidden],.graph-feature-panel[hidden],.graph-col[hidden]{display:none!important}
2770
- .drill-card{display:block;width:100%;border:2px solid transparent;background:#fff;color:var(--text);border-radius:10px;padding:15px 17px;margin:0 0 12px;text-align:left;font:inherit;cursor:pointer;box-shadow:0 2px 6px #30271f12;transition:border-color .15s,transform .15s,box-shadow .15s}
2771
- .drill-card:hover{transform:translateY(-1px);box-shadow:0 5px 14px #30271f18}.drill-card.is-active{border-color:var(--accent);box-shadow:0 4px 12px #cc785c24}
2772
- .drill-card span{display:block}.drill-card-title{font-family:Georgia,"Songti SC",serif;font-size:17px;font-weight:700;line-height:1.25}.drill-card-sub,.drill-card-count{color:var(--muted);font-size:13px;line-height:1.45;margin-top:6px}.mini-progress{height:5px;border-radius:5px;background:#eee8dd;margin-top:10px;overflow:hidden}.mini-progress i{display:block;height:100%;background:var(--green);border-radius:inherit}
2773
- .graph-feature-panel{background:#fff;border:1px solid var(--line);border-radius:10px;padding:18px 20px;box-shadow:0 2px 6px #30271f12}.graph-feature-title{font-family:Georgia,"Songti SC",serif;font-size:21px;margin:0 0 13px}.scenario-intro,.scenario-logic{border:1px solid var(--line);border-radius:9px;background:#fcfaf6;padding:15px 17px;margin-top:13px}.scenario-intro h4,.scenario-logic h4{font-size:17px;margin:0 0 12px}.scenario-intro strong{display:block;margin-top:10px;color:#766b60}.scenario-intro p{margin:5px 0}.scenario-steps{white-space:pre-line;line-height:1.7}.scenario-note{color:var(--muted)}.graph-feature-empty,.stage-empty{padding:18px;color:var(--muted);background:#f4efe7;border-left:4px solid #b9ae9f;border-radius:8px}
2774
- .logic-project{margin-top:18px}.logic-spec{padding:0;background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0;margin:0}.logic-spec>summary{align-items:center;padding:17px 8px;font-size:18px}.logic-spec[open]>summary{border-bottom:1px solid var(--line)}.logic-headline{display:flex;align-items:center;gap:2px;color:var(--green);font-size:13px}.logic-headline b{margin-left:10px}.stage-strip{margin:16px 8px}.stage-strip>div{padding:8px 11px}
2775
- .stage-report{padding:15px 8px}.stage-report>summary{align-items:center}.stage-report>summary strong{font-size:16px}.report-card{margin-top:12px;border:1px solid var(--line);border-radius:9px;background:#fcfaf6;padding:16px 18px}.report-card h4{margin:0 0 13px;font-size:17px}.report-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 24px}.report-row{display:grid;grid-template-columns:110px minmax(0,1fr);gap:12px;padding:8px 0;border-bottom:1px solid #eee7dc}.report-row span{color:var(--muted)}.report-row strong{font-weight:500;overflow-wrap:anywhere}.report-source{display:flex;gap:12px;margin-top:14px;padding-top:12px;border-top:1px solid var(--line);font-size:12px;color:var(--muted);overflow-wrap:anywhere}.report-source strong{color:#766b60;flex:none}.report-prose p{margin:6px 0}
2776
- .footer{border-top:1px solid var(--line);padding-top:18px}
2777
-
2778
- /* Python dashboard parity: preserve the original information density and
2779
- visual hierarchy while keeping all values generated by the Node reader. */
2780
- .overall{grid-template-columns:minmax(420px,1fr) 150px;justify-content:start;max-width:none;min-height:178px}.overall>div:first-child{max-width:650px}.overall>div:first-child p{max-width:560px;color:#786e63;line-height:1.75}.overall .ring{justify-self:start}
2781
- .section-heading{margin-top:26px}.section-heading h2{margin-bottom:0}.section-heading p{margin:8px 0 17px;color:var(--muted)}
2782
- .step-grid article{display:flex;flex-direction:column;align-items:center;min-height:300px}.step-grid article>p{min-height:64px;max-width:94%;line-height:1.6}.step-grid .outline{margin-top:auto}
2783
- .step-ledger{width:100%;margin:4px 0 7px;text-align:left;border-top:1px solid var(--line)}.step-ledger:empty{display:none}.step-ledger-row{display:flex;justify-content:space-between;gap:12px;padding:7px 2px;border-bottom:1px solid #eee8df;font-size:12px}.step-ledger-row strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.step-ledger-row span{color:var(--muted);text-align:right;white-space:nowrap}
2784
- .badge.done{background:var(--green)!important;color:#fff!important}.badge.in_progress{background:var(--amber)!important;color:#fff!important}.badge.blocked{background:var(--red)!important;color:#fff!important}.badge.skipped,.badge.not_started{background:#eee9df!important;color:#746c61!important}
2785
- .scenario-confirm{float:right!important;display:inline-flex!important;width:auto!important;margin:-5px -7px 7px 8px!important;padding:3px 9px!important;border:1px solid #e5dacb;border-radius:999px;color:#8e806e!important;background:#f6f1e9;font-size:11px!important;font-family:"Segoe UI","Microsoft YaHei",sans-serif!important;font-weight:600!important}.graph-feature-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}.graph-feature-heading .scenario-confirm{float:none!important;flex:none;margin:0!important}.scenario-evidence{margin-top:12px}.scenario-evidence .stage-report{padding:11px 0}.scenario-evidence .report-card{max-height:440px;overflow:auto}
2786
- .scenario-build-record{border-top:1px solid var(--line);padding:15px 0}.scenario-build-record:first-child{border-top:0}.scenario-build-head{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:baseline;gap:9px;padding:0 2px}.scenario-stage-heading{display:flex;align-items:baseline;gap:8px;min-width:0;flex-wrap:wrap}.scenario-stage-dot{align-self:center;width:10px;height:10px;border-radius:50%;background:var(--gray)}.scenario-stage-dot.done{background:var(--green)}.scenario-stage-dot.in_progress{background:var(--amber)}.scenario-stage-dot.blocked{background:var(--red)}.scenario-stage-status{font-size:13px;white-space:nowrap;color:var(--gray)}.scenario-stage-status.done{color:var(--green)}.scenario-stage-status.in_progress{color:var(--amber)}.scenario-stage-status.blocked{color:var(--red)}.scenario-substage-note{margin:3px 0 10px;padding-left:21px;color:var(--muted);font-size:13px;line-height:1.5}.scenario-build-artifact{font-family:Consolas,"SFMono-Regular",monospace;font-size:12px;line-height:1.55;color:#4d463f;margin:4px 0;overflow-wrap:anywhere}.scenario-stage3-empty{margin-top:10px;padding:13px 15px;border-left:4px solid #b9ae9f;border-radius:8px;background:#f4efe7;color:#81776b}.scenario-build-record .scenario-inline-detail,.scenario-build-record .scenario-inline-spec{max-height:none;overflow:visible}.scenario-build-record .scenario-inline-row{overflow-wrap:anywhere}.scenario-build-record .scenario-inline-evidence-title:not(:first-child){border-top:1px solid var(--line);margin-top:11px;padding-top:10px}
2787
- .logic-progress-list{margin-top:22px;border-top:1px solid #d9c7aa}.logic-progress-spec{border-bottom:1px solid #d9c7aa;padding:0 8px}.logic-progress-spec>summary{display:flex;align-items:center;justify-content:space-between;gap:18px;list-style:none;cursor:pointer;padding:22px 2px}.logic-progress-spec>summary::-webkit-details-marker{display:none}.logic-progress-summary{display:flex;align-items:center;gap:14px;min-width:0;flex-wrap:wrap}.logic-progress-summary>strong{font-family:Georgia,"Songti SC",serif;font-size:19px}.logic-progress-segments{display:flex;gap:4px}.logic-progress-segments i{display:block;width:28px;height:8px;border-radius:999px;background:var(--gray)}.logic-progress-segments i.done{background:var(--green)}.logic-progress-segments i.in_progress{background:var(--amber)}.logic-progress-segments i.blocked{background:var(--red)}.logic-progress-headline{font-size:13px;font-weight:700;color:var(--green)}.logic-progress-headline.blocked{color:var(--red)}.logic-progress-body{padding:0 0 20px}.logic-progress-stage{padding:0;border-top:1px solid var(--line)}.logic-progress-stage>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px 2px;list-style:none;cursor:pointer}.logic-progress-stage>summary::-webkit-details-marker{display:none}.logic-progress-stage>summary>span{display:flex;align-items:center;gap:9px}.logic-progress-stage>summary strong{font-size:16px}.logic-stage-chevron{display:inline-block;color:#9a8e80;font-style:normal;transition:transform .16s ease}.logic-progress-stage[open] .logic-stage-chevron{transform:rotate(180deg)}.logic-progress-stage-body{padding:0 0 18px}.logic-progress-card{border:1px solid var(--line);border-radius:9px;background:#faf7f1;padding:16px 18px}.logic-progress-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}.logic-progress-card-head>span{display:flex;align-items:center;gap:9px}.logic-progress-card-metrics{display:grid!important;justify-items:end;gap:5px!important}.logic-progress-card-metrics>span{display:flex;align-items:center;gap:7px}.logic-progress-substep:first-child{border-top:0}.logic-progress-substep strong{font-size:14px}.logic-stage-evidence{margin-top:15px;padding-top:15px;border-top:1px dashed #d8ccbc}.logic-stage-evidence-title{display:flex;align-items:baseline;justify-content:space-between;gap:14px;margin-bottom:10px}.logic-stage-evidence-title span{color:var(--muted);font-size:12px}.logic-scenario-record{border:1px solid var(--line);border-radius:8px;background:#fff;margin-top:8px;overflow:hidden}.logic-scenario-record>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:11px 13px;cursor:pointer;list-style:none}.logic-scenario-record>summary::-webkit-details-marker{display:none}.logic-scenario-record>summary>span:first-child{min-width:0}.logic-scenario-record>summary strong,.logic-scenario-record>summary small{display:block}.logic-scenario-record>summary small{margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.logic-scenario-record-body{padding:0 13px 7px;border-top:1px solid var(--line)}.logic-scenario-record-body .scenario-build-record{padding-bottom:8px}
2788
- .logic-review-overview{margin-bottom:14px}.logic-review-round{margin-top:14px;border:1px solid #ded3c5;border-radius:9px;background:#fff;padding:15px}.logic-review-round-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding-bottom:12px;border-bottom:1px solid var(--line)}.logic-review-round-head>div{display:flex;align-items:baseline;gap:11px;flex-wrap:wrap}.logic-review-round-head>div>strong{font-size:15px}.logic-review-round-head>div>span{color:#776c60;font-size:13px}.logic-review-round-head>small{max-width:48%;text-align:right;overflow-wrap:anywhere}.logic-review-metrics{display:grid;grid-template-columns:repeat(6,minmax(88px,1fr));gap:8px;margin:12px 0}.logic-review-metric{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;border:1px solid var(--line);border-left:4px solid var(--gray);border-radius:7px;background:#faf8f3;padding:8px 10px}.logic-review-metric span{color:#766b60;font-size:11px;overflow-wrap:anywhere}.logic-review-metric strong{font-size:16px}.logic-review-metric.done{border-left-color:var(--green)}.logic-review-metric.in_progress{border-left-color:var(--amber)}.logic-review-metric.runtime{border-left-color:#5f82a8}.logic-review-metric.blocked{border-left-color:var(--red)}.logic-review-scenarios{margin-top:13px}.logic-review-scenarios-title{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:7px}.logic-review-scenarios-title strong{font-size:13px}.logic-review-scenarios-title span{color:var(--muted);font-size:11px}.logic-review-scenario{border:1px solid var(--line);border-radius:8px;background:#fcfaf6;margin-top:7px;overflow:hidden}.logic-review-scenario>summary{display:grid;grid-template-columns:28px minmax(0,1fr) auto 14px;align-items:center;gap:10px;padding:11px 12px;list-style:none;cursor:pointer}.logic-review-scenario>summary::-webkit-details-marker{display:none}.logic-review-scenario-index{display:grid;place-items:center;width:25px;height:25px;border-radius:50%;background:#eee7dc;color:#6d6257;font-size:11px;font-weight:800}.logic-review-scenario[data-review-status="done"] .logic-review-scenario-index{background:#e7f0e1;color:#557744}.logic-review-scenario[data-review-status="in_progress"] .logic-review-scenario-index{background:#f7e9c9;color:#946516}.logic-review-scenario[data-review-status="blocked"] .logic-review-scenario-index{background:#f3deda;color:#93483f}.logic-review-scenario-copy{min-width:0}.logic-review-scenario-copy strong,.logic-review-scenario-copy small{display:block}.logic-review-scenario-copy strong{font-size:13px}.logic-review-scenario-copy small{margin-top:3px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.logic-review-scenario-chevron{color:#9a8e80;font-style:normal;transition:transform .16s ease}.logic-review-scenario[open] .logic-review-scenario-chevron{transform:rotate(180deg)}.logic-review-scenario-body,.logic-review-scenario-empty{padding:12px 14px 14px;border-top:1px solid var(--line)}.logic-review-scenario-empty{color:var(--muted);font-size:12px}.logic-review-summary-rows{padding:9px 11px;border:1px solid #e7ded1;border-radius:7px;background:#fff}.logic-review-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:10px}.logic-review-field{display:grid;grid-template-columns:92px minmax(0,1fr);gap:9px;padding:9px 10px;border:1px solid var(--line);border-radius:7px;background:#fff;font-size:12px}.logic-review-field strong{color:#776b60}.logic-review-field span{overflow-wrap:anywhere}.logic-review-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin-top:10px}.logic-review-detail-section{min-width:0;border:1px solid var(--line);border-radius:7px;background:#fff;padding:11px 12px}.logic-review-detail-section h5{margin:0 0 7px;color:#6e6257;font-size:12px}.logic-review-detail-section ul{margin:0;padding-left:17px}.logic-review-detail-section li{margin:4px 0;color:#514940;font-size:12px;line-height:1.55;overflow-wrap:anywhere}
2789
-
2790
-
2791
- /* UI migration parity: one page per stack card, with source-backed diff,
2792
- interaction legend and Spec association next to the phone previews. */
2793
- .ui-title-jump{display:flex;align-items:center;gap:6px}.ui-title-jump input{width:250px;border:1px solid #d8ccbc;background:#fff;color:var(--text);border-radius:7px;padding:8px 11px;font:inherit}.ui-title-jump .outline{margin:0}.ui-title-jump input.is-invalid{border-color:var(--red);animation:hmShake .28s ease}.ui-pending-filter{display:inline-flex;align-items:center;gap:5px;color:#62584e;font-size:13px;white-space:nowrap}.ui-pending-filter input{accent-color:var(--accent)}
2794
- .ui-page-summary{display:grid;grid-template-columns:1.05fr 1.35fr;gap:12px;margin:14px 0 18px}.ui-summary-block{min-width:0;border:1px solid var(--line);background:#faf8f3;border-radius:9px;padding:13px 14px}.ui-summary-block>strong,.ui-summary-block>small{display:block;overflow-wrap:anywhere}.ui-summary-block>strong{margin:5px 0}.ui-summary-label{display:block;color:#8a7d70;font-size:12px;font-weight:800;letter-spacing:.05em}.ui-summary-block .badge{margin-top:8px}
2795
- .capture-grid{grid-template-columns:minmax(500px,1fr) auto minmax(500px,1fr)}.phone-body-row{display:grid;grid-template-columns:minmax(250px,320px) minmax(165px,1fr);gap:14px;align-items:start}.phone-body-row .phone-shell{width:100%}.capture-legend{text-align:left;position:static;height:680px;padding:1px 0 0 14px;border-left:1px dashed #d8ccbc;background:transparent;overflow:auto}.capture-legend h4{margin:0 0 4px;font:700 15px Georgia,"Songti SC",serif}.capture-legend>p{margin:0 0 10px;color:var(--muted);font-size:12px;line-height:1.5}.capture-legend-list{display:flex;flex-direction:column;gap:7px}.capture-legend-row{display:grid;grid-template-columns:24px minmax(0,1fr);gap:3px 7px;align-items:start;padding:8px;border:1px solid var(--line);border-radius:7px;background:#faf8f3}.capture-legend-no{grid-row:1/3;display:grid;place-items:center;width:22px;height:22px;border-radius:50%;background:#ad5b49;color:#fff;font-size:11px;font-weight:800}.capture-legend-label{font-size:12px;line-height:1.4;overflow-wrap:anywhere}.capture-legend-state{font-size:11px;font-weight:700}.capture-legend-state.matched{color:#557744}.capture-legend-state.missing{color:#946516}.capture-legend-empty{padding:18px 8px;color:var(--muted);font-size:12px;text-align:center;border:1px dashed var(--line);border-radius:7px}
2796
-
2797
- /* Spec graph parity: exactly one Spec owns the visible scenario list and
2798
- detail panel, so scenarios from different Specs can never be mixed. */
2799
- .scenario-group{margin-bottom:18px}.scenario-group-label{margin:0 0 8px;padding:0 4px;color:#8a7d70;font-size:12px;font-weight:800;line-height:1.45}.card-hint{margin-top:8px;color:#a19384;font-size:11px;line-height:1.4}
2800
- .scenario-shared-divider{display:flex;align-items:baseline;gap:10px;margin:7px 0 0;padding:11px 2px 8px;border-top:1px dashed #d8ccbc;color:#786d61}.scenario-shared-divider strong{flex:none;font-size:13px;color:#665b50}.scenario-shared-divider span{font-size:12px;color:var(--muted);line-height:1.5}
2801
-
2802
- /* Motion system carried over from the original dashboard. Keep it subtle:
2803
- motion explains state changes, while the evidence and progress values stay
2804
- entirely source-backed. */
2805
- @property --p{syntax:"<angle>";inherits:false;initial-value:0deg}
2806
- @keyframes hmPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.42;transform:scale(.72)}}
2807
- @keyframes hmShellEnter{from{opacity:0;transform:translateY(14px) scale(.988)}to{opacity:1;transform:none}}
2808
- @keyframes hmTabIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
2809
- @keyframes hmStepPanelIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
2810
- @keyframes hmEnter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
2811
- @keyframes hmRingFill{from{--p:0deg}}
2812
- @keyframes hmLineDraw{from{stroke-dashoffset:1;opacity:.18}to{stroke-dashoffset:0;opacity:1}}
2813
- @keyframes hmDetailsReveal{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}
2814
- @keyframes hmProgressGrow{from{transform:scaleX(0)}to{transform:scaleX(1)}}
2815
- @keyframes hmUiNext{from{opacity:0;transform:translateX(42px) rotate(.35deg) scale(.992)}to{opacity:1;transform:none}}
2816
- @keyframes hmUiPrev{from{opacity:0;transform:translateX(-42px) rotate(-.35deg) scale(.992)}to{opacity:1;transform:none}}
2817
- @keyframes hmShake{0%,100%{transform:translateX(0)}30%{transform:translateX(-5px)}70%{transform:translateX(5px)}}
2818
- .layout{animation:hmShellEnter .55s cubic-bezier(.22,.75,.32,1) both}
2819
- .live{display:inline-flex;align-items:center;gap:6px}.live-dot{width:6px;height:6px;border-radius:50%;background:var(--green);animation:hmPulse 1.8s ease-in-out infinite}
2820
- .tab.active{animation:hmTabIn .28s ease both}
2821
- .step-grid>.card{animation:hmStepPanelIn .42s cubic-bezier(.2,.7,.3,1) both;transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
2822
- .step-grid>.card:nth-child(2){animation-delay:.055s}.step-grid>.card:nth-child(3){animation-delay:.11s}
2823
- .step-grid>.card:hover{transform:translateY(-3px);box-shadow:0 8px 22px #392e2516;border-color:#ded2c5}
2824
- .progress-grid>.card,.consumption{animation:hmEnter .36s ease both}
2825
- .progress-grid>.card:nth-child(2){animation-delay:.045s}.progress-grid>.card:nth-child(3){animation-delay:.09s}
2826
- .ring{animation:hmRingFill .8s cubic-bezier(.22,.75,.32,1) both}
2827
- .mini-progress i{transform-origin:left center;animation:hmProgressGrow .55s cubic-bezier(.22,.75,.32,1) both}
2828
- nav button{transition:background .18s ease,color .18s ease,box-shadow .18s ease,transform .18s ease}
2829
- nav button:hover{transform:translateX(3px)}nav button svg{transition:transform .22s ease}nav button:hover svg{transform:scale(1.08)}
2830
- .outline{transition:background .16s ease,color .16s ease,transform .16s ease,box-shadow .16s ease}.outline:hover{background:var(--accent);color:#fff;transform:translateY(-1px);box-shadow:0 4px 10px #cc785c22}.outline:active{transform:translateY(0) scale(.98)}
2831
- .scenario-node:not([hidden]),.graph-feature-panel:not([hidden]),.ui-slide:not([hidden]){animation:hmEnter .3s ease both}
2832
- .graph-line{fill:none;stroke-dasharray:1;stroke-dashoffset:0;animation:hmLineDraw .5s cubic-bezier(.22,.75,.32,1) both}
2833
- details[open]>*:not(summary){animation:hmDetailsReveal .24s ease both}
2834
- summary{transition:background .15s ease,color .15s ease}summary:hover{background:#f7f2eb}
2835
- .kinetic-text{display:inline-flex;flex-wrap:wrap}.kinetic-text>span{display:inline-block;transition:font-weight .3s ease,color .3s ease,transform .3s ease,-webkit-text-stroke-color .3s ease;-webkit-text-stroke-width:.015em;-webkit-text-stroke-color:transparent}.kinetic-text>span:hover{font-weight:900;color:var(--accent);transform:translateY(-1px);-webkit-text-stroke-color:var(--accent)}.kinetic-text>span.is-near{font-weight:600;color:#9c6958}
2836
- .hm-reenter{animation:hmEnter .3s ease both!important}
2837
- @media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.layout,.tab.active,.step-grid>.card,.progress-grid>.card,.consumption,.ring,.mini-progress i,.scenario-node,.graph-feature-panel,.ui-slide,.graph-line,details[open]>*:not(summary),.live-dot,.hm-reenter{animation:none!important}*,*::before,*::after{transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}
2838
- @media(max-width:1250px){.scenario-graph{gap:18px}.graph-col-spec,.graph-col-scenario{width:220px;flex-basis:220px}.report-grid{grid-template-columns:1fr}.logic-review-metrics{grid-template-columns:repeat(3,minmax(88px,1fr))}}
2839
- @media(max-width:1450px){.capture-grid{grid-template-columns:1fr}.capture-grid>.arrow{transform:rotate(90deg);justify-self:center}.phone-card{max-width:760px;width:100%;justify-self:center}}
2840
- @media(max-width:1250px){.phone-shell,.capture-legend{height:640px}.ui-page-summary{grid-template-columns:1fr 1fr}.ui-summary-block:last-child{grid-column:1/-1}}
2841
- @media(max-width:900px){.layout{grid-template-columns:1fr}.scenario-graph{display:grid;grid-template-columns:1fr}.graph-col-spec,.graph-col-scenario,.graph-col-feature{width:auto;min-width:0}.overall{grid-template-columns:1fr;text-align:center}.overall .ring{justify-self:center}.ui-title-jump,.ui-title-jump input{min-width:0;width:100%}.ui-toolbar-main{width:100%}.ui-page-summary{grid-template-columns:1fr}.ui-summary-block:last-child{grid-column:auto}.phone-body-row{grid-template-columns:1fr}.capture-legend{height:auto;max-height:320px;border-left:0;border-top:1px dashed #d8ccbc;padding:12px 0 0}.step-ledger-row{display:block}.step-ledger-row span{display:block;text-align:left;margin-top:3px;white-space:normal}.logic-review-round-head{display:block}.logic-review-round-head>small{display:block;max-width:none;text-align:left;margin-top:5px}.logic-review-metrics{grid-template-columns:repeat(2,minmax(88px,1fr))}.logic-review-fields,.logic-review-detail-grid{grid-template-columns:1fr}.logic-review-scenario>summary{grid-template-columns:28px minmax(0,1fr) 14px}.logic-review-scenario>summary>.badge{grid-column:2;justify-self:start}.logic-review-scenario-chevron{grid-column:3;grid-row:1}}
2842
- ${shutdownCss}</style></head><body><div class="layout"><aside><div class="brand"><b class="logo">HT</b><div>HomeTrans<span>转换看板</span></div></div><nav><button data-tab="overview"><svg viewBox="0 0 24 24"><rect x="4" y="4" width="6" height="6"/><rect x="14" y="4" width="6" height="6"/><rect x="4" y="14" width="6" height="6"/><rect x="14" y="14" width="6" height="6"/></svg><span>总览</span></button><button data-tab="architecture"><svg viewBox="0 0 24 24"><path d="m12 3 8 4-8 4-8-4 8-4Z"/><path d="m4 12 8 4 8-4M4 17l8 4 8-4"/></svg><span>架构生成</span></button><button data-tab="ui"><svg viewBox="0 0 24 24"><rect x="7" y="2.5" width="10" height="19" rx="2"/><path d="M10 18.5h4"/></svg><span>UI界面迁移</span></button><button data-tab="spec"><svg viewBox="0 0 24 24"><circle cx="5" cy="12" r="2"/><circle cx="19" cy="6" r="2"/><circle cx="19" cy="18" r="2"/><path d="M7 12h4c3 0 3-6 6-6M11 12c3 0 3 6 6 6"/></svg><span>需求规格生成</span></button><button data-tab="logic"><svg viewBox="0 0 24 24"><path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 4l-4 16"/></svg><span>逻辑代码转换</span></button></nav>${shutdownControl}</aside><main><header class="top"><h1>HomeTrans 转换看板</h1><p><span class="live"><i class="live-dot"></i>实时 · 30 秒自动刷新</span>生成时间:${escapeHtml(generated)}(自动刷新只重新扫描磁盘产物;设备截图只在启动看板命令时采集一次)</p></header>${renderOverview(projects, usages, arch, options.usageScanning === true)}${renderArchitecture(arch, projects)}${renderUi(projects)}${renderSpec(projects)}${renderLogic(projects)}</main></div>
2908
+ return `<!doctype html><html lang="${RENDER_LANG === 'en' ? 'en' : 'zh-CN'}" data-theme="light"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${tr('HomeTrans 转换看板')}</title><script>(function(){try{var t=localStorage.getItem('a2h-dashboard-render-theme');if(t==='dark'||t==='light')document.documentElement.dataset.theme=t}catch(e){}})()</script>
2909
+ <style>${dashboardCss()}${shutdownCss}</style></head><body><div class="layout" id="layout"><aside><div class="brand"><b class="logo" aria-hidden="true"><i></i><i></i></b><div class="brand-copy">HomeTrans<span>${tr('转换看板')}</span></div></div><div class="workspace"><div class="workspace-label">${tr('工作空间')}</div><div class="workspace-button" title="${escapeHtml(projects.map((p) => p.name).join('、'))}">${ICONS.folder}<span>${escapeHtml(projects.length === 0 ? tr('未选择工程') : projects.length === 1 ? projects[0].name : RENDER_LANG === 'en' ? `${projects[0].name} + ${projects.length - 1} more` : projects[0].name + ' 等 ' + projects.length + ' 个工程')}</span></div></div><nav><button data-tab="overview"><svg viewBox="0 0 24 24"><rect x="4" y="4" width="6" height="6"/><rect x="14" y="4" width="6" height="6"/><rect x="4" y="14" width="6" height="6"/><rect x="14" y="14" width="6" height="6"/></svg><span>${tr('总览')}</span></button><button data-tab="architecture"><svg viewBox="0 0 24 24"><path d="m12 3 8 4-8 4-8-4 8-4Z"/><path d="m4 12 8 4 8-4M4 17l8 4 8-4"/></svg><span>${tr('架构生成')}</span><i class="nav-state${dotCls(navArch)}"></i></button><button data-tab="ui"><svg viewBox="0 0 24 24"><rect x="7" y="2.5" width="10" height="19" rx="2"/><path d="M10 18.5h4"/></svg><span>${tr('UI界面迁移')}</span><i class="nav-state${dotCls(navUi)}"></i></button><button data-tab="spec"><svg viewBox="0 0 24 24"><circle cx="5" cy="12" r="2"/><circle cx="19" cy="6" r="2"/><circle cx="19" cy="18" r="2"/><path d="M7 12h4c3 0 3-6 6-6M11 12c3 0 3 6 6 6"/></svg><span>${tr('需求规格生成')}</span><i class="nav-state${dotCls(navSpec)}"></i></button><button data-tab="logic"><svg viewBox="0 0 24 24"><path d="m8 8-4 4 4 4M16 8l4 4-4 4M14 4l-4 16"/></svg><span>${tr('逻辑代码转换')}</span><i class="nav-state${dotCls(navLogic)}"></i></button></nav><div class="sidebar-footer">${shutdownControl}<button id="collapse-btn" class="collapse-button" type="button" title="${escapeHtml(tr('收起 / 展开导航'))}">${ICONS.collapse}<span>${tr('收起导航')}</span></button></div></aside><main><header class="top"><h1>${tr('HomeTrans 转换看板')}</h1><p>${options.once ? `<span class="live snapshot">${tr('静态快照')}</span>` : `<span class="live"><i class="live-dot"></i>${tr('实时 · 30 秒自动刷新')}</span>`}${tr('生成时间:')}${escapeHtml(generated)}${options.once ? '' : tr('(自动刷新只重新扫描磁盘产物;设备截图只在启动看板命令时采集一次)')}</p>${options.once ? '' : `<button id="lang-toggle" class="lang-toggle" type="button" title="${escapeHtml(tr('切换语言'))}" aria-label="${escapeHtml(tr('切换语言'))}">${RENDER_LANG === 'en' ? '中文' : 'EN'}</button>`}<button id="theme-toggle" class="theme-toggle" type="button" title="${escapeHtml(tr('切换亮色 / 暗色主题'))}" aria-label="${escapeHtml(tr('切换亮色或暗色主题'))}"><svg class="icon-moon" viewBox="0 0 24 24"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"/></svg><svg class="icon-sun" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg></button></header>${renderOverview(projects, usages, arch, options.usageScanning === true)}${renderArchitecture(arch, projects)}${renderUi(projects)}${renderSpec(projects)}${renderLogic(projects)}</main></div>
2843
2910
  <script>
2844
2911
  const tabKey='a2h-dashboard-render-node-tab', scrollKey='a2h-dashboard-render-scroll', openKey='a2h-dashboard-render-open', sceneKey='a2h-dashboard-render-scene', uiPageKey='a2h-dashboard-render-ui-page';
2845
2912
  function replay(node){if(!node)return;node.classList.remove('hm-reenter');void node.offsetWidth;node.classList.add('hm-reenter')}
2846
- function kinetic(node){if(!node||node.dataset.kinetic)return;const label=node.textContent;node.dataset.kinetic='1';node.classList.add('kinetic-text');node.setAttribute('aria-label',label);node.innerHTML=[...label].map((char)=>'<span aria-hidden="true">'+(char===' '?'&nbsp;':char)+'</span>').join('');const chars=[...node.children];chars.forEach((char,index)=>{char.addEventListener('mouseenter',()=>{chars[index-1]?.classList.add('is-near');chars[index+1]?.classList.add('is-near')});char.addEventListener('mouseleave',()=>chars.forEach((item)=>item.classList.remove('is-near')))})}
2847
- document.querySelectorAll('.top h1,nav button>span').forEach(kinetic);
2848
2913
  function framePixels(img,width,height){const canvas=document.createElement('canvas');canvas.width=width;canvas.height=height;const ctx=canvas.getContext('2d',{willReadFrequently:true});ctx.drawImage(img,0,0,width,height);return {canvas,ctx,data:ctx.getImageData(0,0,width,height).data}}
2849
2914
  function clampRegion(region,width,height){const left=Math.max(0,Math.min(width,Number(region?.left)||0)),top=Math.max(0,Math.min(height,Number(region?.top)||0)),right=Math.max(left,Math.min(width,Number(region?.right)||width)),bottom=Math.max(top,Math.min(height,Number(region?.bottom)||height));return {left,top,right,bottom,area:(right-left)*(bottom-top)}}
2850
2915
  function regionDifference(a,b,region,width){const xs=Math.max(2,Math.floor((region.right-region.left)/48)),ys=Math.max(2,Math.floor((region.bottom-region.top)/90));let error=0,count=0;for(let y=region.top;y<region.bottom;y+=ys){for(let x=region.left;x<region.right;x+=xs){const p=(Math.floor(y)*width+Math.floor(x))*4;error+=Math.abs(a.data[p]-b.data[p])+Math.abs(a.data[p+1]-b.data[p+1])+Math.abs(a.data[p+2]-b.data[p+2]);count+=3}}return error/Math.max(1,count)}
@@ -2925,18 +2990,25 @@ function renderHtml(projects, usages = [], architecture = null, options = {}) {
2925
2990
  document.querySelectorAll('[data-capture-stitch]').forEach((box)=>stitchCapture(box));
2926
2991
  function show(id){document.querySelectorAll('.tab').forEach(x=>x.classList.toggle('active',x.id===id));document.querySelectorAll('nav button').forEach(x=>x.classList.toggle('active',x.dataset.tab===id));localStorage.setItem(tabKey,id);window.scrollTo({top:0,left:0,behavior:'auto'})}
2927
2992
  window.show=show;document.querySelectorAll('nav button').forEach(x=>x.onclick=()=>show(x.dataset.tab));show(location.hash.slice(1)||localStorage.getItem(tabKey)||'overview');
2993
+ const themeToggle=document.getElementById('theme-toggle');themeToggle?.addEventListener('click',()=>{const next=document.documentElement.dataset.theme==='dark'?'light':'dark';document.documentElement.dataset.theme=next;try{localStorage.setItem('a2h-dashboard-render-theme',next)}catch{}dispatchEvent(new Event('resize'))});
2994
+ document.getElementById('lang-toggle')?.addEventListener('click',()=>{const target=document.documentElement.lang==='en'?'zh':'en';const prefs=(navigator.languages&&navigator.languages.length?navigator.languages:[navigator.language||'']);let browserPref='zh';for(const p of prefs){const t=String(p||'').toLowerCase();if(t==='zh'||t.startsWith('zh-')){browserPref='zh';break}if(t==='en'||t.startsWith('en-')){browserPref='en';break}}try{if(target===browserPref)document.cookie='dashboard_lang=;path=/;max-age=0;SameSite=Lax';else document.cookie='dashboard_lang='+target+';path=/;max-age=31536000;SameSite=Lax'}catch{}try{const u=new URL(location.href);if(u.searchParams.has('lang')){u.searchParams.delete('lang');history.replaceState(null,'',u)}}catch{}location.reload()});
2995
+ const navKey='a2h-dashboard-render-nav';
2996
+ function navCollapsed(){try{return localStorage.getItem(navKey)==='collapsed'}catch{return false}}
2997
+ function applyNavState(){document.getElementById('layout')?.classList.toggle('nav-collapsed',navCollapsed());const span=document.querySelector('#collapse-btn span');if(span)span.textContent=navCollapsed()?'${tr("展开导航")}':'${tr("收起导航")}'}
2998
+ document.getElementById('collapse-btn')?.addEventListener('click',()=>{try{localStorage.setItem(navKey,navCollapsed()?'expanded':'collapsed')}catch{}applyNavState()});
2999
+ try{applyNavState()}catch{}
2928
3000
  function storedObject(key){try{const value=JSON.parse(localStorage.getItem(key)||'{}');return value&&typeof value==='object'?value:{}}catch{return {}}}
2929
- function detailOpenId(detail,index){const summary=(detail.querySelector(':scope > summary')?.textContent||'').trim();const stage=(detail.closest('.logic-stage-section')?.querySelector(':scope > .logic-stage-title')?.textContent||'').trim();const scene=detail.closest('[data-scene-detail]')?.dataset.sceneDetail||'';return detail.dataset.openKey||detail.id||[detail.closest('.tab')?.id||'page',stage,scene,summary||index].join(':')}
3001
+ function detailOpenId(detail,index){const summary=(detail.querySelector(':scope > summary')?.textContent||'').trim();const stage=(detail.closest('.logic-spec-card')?.querySelector(':scope > summary .logic-progress-summary > strong')?.textContent||'').trim();return detail.dataset.openKey||detail.id||[detail.closest('.tab')?.id||'page',stage,summary||index].join(':')}
2930
3002
  const savedOpen=storedObject(openKey);document.querySelectorAll('details').forEach((d,i)=>{const id=detailOpenId(d,i);if(Object.prototype.hasOwnProperty.call(savedOpen,id))d.open=Boolean(savedOpen[id]);d.addEventListener('toggle',()=>{const now=storedObject(openKey);now[id]=d.open;localStorage.setItem(openKey,JSON.stringify(now))})});
2931
3003
  const uiSaved=storedObject(uiPageKey),uiControllers=[];let activeUiController=null;
2932
- document.querySelectorAll('.ui-project').forEach(box=>{const slides=[...box.querySelectorAll('[data-ui-slide]')],projectId=box.dataset.uiProject||String(uiControllers.length),pendingOnlyInput=box.querySelector('[data-ui-pending-only]'),titleSearch=box.querySelector('[data-ui-title-search]'),titleJump=box.querySelector('[data-ui-title-jump]'),count=box.querySelector('[data-ui-count]'),stack=box.querySelector('[data-ui-stack]'),empty=box.querySelector('[data-ui-filter-empty]');const saved=uiSaved[projectId];let pendingOnly=Boolean(typeof saved==='object'&&saved?.pendingOnly);let i=Math.max(0,Math.min(slides.length-1,Number(typeof saved==='object'&&saved?saved.index:saved)||0));
3004
+ document.querySelectorAll('.ui-project').forEach(box=>{const slides=[...box.querySelectorAll('[data-ui-slide]')],pageCards=[...box.querySelectorAll('[data-page-card]')],projectId=box.dataset.uiProject||String(uiControllers.length),pendingOnlyInput=box.querySelector('[data-ui-pending-only]'),titleSearch=box.querySelector('[data-ui-title-search]'),titleJump=box.querySelector('[data-ui-title-jump]'),count=box.querySelector('[data-ui-count]'),stack=box.querySelector('[data-ui-stack]'),empty=box.querySelector('[data-ui-filter-empty]');const saved=uiSaved[projectId];let pendingOnly=Boolean(typeof saved==='object'&&saved?.pendingOnly);let i=Math.max(0,Math.min(slides.length-1,Number(typeof saved==='object'&&saved?saved.index:saved)||0));
2933
3005
  function inScope(slide){return !pendingOnly||slide.dataset.uiStatus!=='done'}
2934
3006
  function visible(){return slides.filter(inScope)}
2935
3007
  function persist(){uiSaved[projectId]={index:i,pendingOnly};localStorage.setItem(uiPageKey,JSON.stringify(uiSaved))}
2936
- function paint(direction=0){const scoped=visible();if(!scoped.some((slide)=>Number(slide.dataset.uiSlide)===i)&&scoped.length)i=Number(scoped[0].dataset.uiSlide);slides.forEach((slide)=>{const active=Number(slide.dataset.uiSlide)===i&&inScope(slide);slide.hidden=!active;slide.classList.remove('ui-enter-next','ui-enter-prev');slide.tabIndex=active?0:-1});const current=slides.find((slide)=>Number(slide.dataset.uiSlide)===i&&inScope(slide));if(current&&direction){void current.offsetWidth;current.classList.add(direction>0?'ui-enter-next':'ui-enter-prev')}const rank=current?scoped.indexOf(current)+1:0;if(count)count.textContent=rank+' / '+scoped.length;current?.querySelector('[data-ui-position]')?.replaceChildren(document.createTextNode('当前筛选范围内任务 '+rank+' / '+scoped.length));if(empty)empty.hidden=scoped.length>0;if(pendingOnlyInput)pendingOnlyInput.checked=pendingOnly;persist()}
3008
+ function paint(direction=0){const scoped=visible();if(!scoped.some((slide)=>Number(slide.dataset.uiSlide)===i)&&scoped.length)i=Number(scoped[0].dataset.uiSlide);slides.forEach((slide)=>{const active=Number(slide.dataset.uiSlide)===i&&inScope(slide);slide.hidden=!active;slide.classList.remove('ui-enter-next','ui-enter-prev');slide.tabIndex=active?0:-1});pageCards.forEach((card)=>{const idx=Number(card.dataset.pageCard);card.hidden=pendingOnly&&card.dataset.uiStatus==='done';card.classList.toggle('is-active',idx===i&&(!pendingOnly||card.dataset.uiStatus!=='done'))});const current=slides.find((slide)=>Number(slide.dataset.uiSlide)===i&&inScope(slide));if(current&&direction){void current.offsetWidth;current.classList.add(direction>0?'ui-enter-next':'ui-enter-prev')}const rank=current?scoped.indexOf(current)+1:0;if(count)count.textContent=rank+' / '+scoped.length;const activeCard=pageCards.find((card)=>Number(card.dataset.pageCard)===i&&card.offsetParent);if(activeCard){const grid=activeCard.closest('.page-grid');if(grid){const g=grid.getBoundingClientRect(),c=activeCard.getBoundingClientRect();if(c.top<g.top)grid.scrollTop+=c.top-g.top;else if(c.bottom>g.bottom)grid.scrollTop+=c.bottom-g.bottom}}if(empty)empty.hidden=scoped.length>0||!slides.length;if(pendingOnlyInput)pendingOnlyInput.checked=pendingOnly;persist()}
2937
3009
  function go(delta){const scoped=visible();if(!scoped.length)return;const current=scoped.findIndex((slide)=>Number(slide.dataset.uiSlide)===i);const next=(Math.max(0,current)+delta+scoped.length)%scoped.length;i=Number(scoped[next].dataset.uiSlide);paint(delta)}
2938
- function jumpToTitle(){const query=String(titleSearch?.value||'').toLowerCase().replace(/\s+/g,'');const match=query?visible().find((slide)=>(slide.dataset.uiTitle||'').includes(query)):null;if(!match){titleSearch?.classList.remove('is-invalid');void titleSearch?.offsetWidth;titleSearch?.classList.add('is-invalid');setTimeout(()=>titleSearch?.classList.remove('is-invalid'),420);return}i=Number(match.dataset.uiSlide);paint(1)}
2939
- const controller={box,go};uiControllers.push(controller);activeUiController??=controller;box.addEventListener('pointerenter',()=>{activeUiController=controller});box.addEventListener('focusin',()=>{activeUiController=controller});box.querySelector('[data-ui-prev]')?.addEventListener('click',(event)=>{event.stopPropagation();go(-1)});box.querySelector('[data-ui-next]')?.addEventListener('click',(event)=>{event.stopPropagation();go(1)});pendingOnlyInput?.addEventListener('change',()=>{pendingOnly=pendingOnlyInput.checked;i=Number(visible()[0]?.dataset.uiSlide||0);paint(1)});titleJump?.addEventListener('click',(event)=>{event.stopPropagation();jumpToTitle()});titleSearch?.addEventListener('keydown',(event)=>{if(event.key==='Enter'){event.preventDefault();jumpToTitle()}});paint()});
3010
+ function jumpToTitle(){const query=String(titleSearch?.value||'').toLowerCase().replace(/\\s+/g,'');const match=query?visible().find((slide)=>(slide.dataset.uiTitle||'').includes(query)):null;if(!match){titleSearch?.classList.remove('is-invalid');void titleSearch?.offsetWidth;titleSearch?.classList.add('is-invalid');setTimeout(()=>titleSearch?.classList.remove('is-invalid'),420);return}i=Number(match.dataset.uiSlide);paint(1)}
3011
+ const controller={box,go};uiControllers.push(controller);activeUiController??=controller;box.addEventListener('pointerenter',()=>{activeUiController=controller});box.addEventListener('focusin',()=>{activeUiController=controller});box.querySelector('[data-ui-prev]')?.addEventListener('click',(event)=>{event.stopPropagation();go(-1)});box.querySelector('[data-ui-next]')?.addEventListener('click',(event)=>{event.stopPropagation();go(1)});pageCards.forEach((card)=>card.addEventListener('click',function(){i=Number(card.dataset.pageCard);paint(1);var target=box.querySelector('[data-ui-slide="'+i+'"]');if(target)target.scrollIntoView({behavior:'smooth',block:'nearest'})}));pendingOnlyInput?.addEventListener('change',()=>{pendingOnly=pendingOnlyInput.checked;i=Number(visible()[0]?.dataset.uiSlide||0);paint(1)});titleJump?.addEventListener('click',(event)=>{event.stopPropagation();jumpToTitle()});titleSearch?.addEventListener('keydown',(event)=>{if(event.key==='Enter'){event.preventDefault();jumpToTitle()}});paint()});
2940
3012
  function markerLinkTarget(node){return node?.closest?.('[data-marker]')||null}
2941
3013
  function setMarkerLink(target){const keyed=markerLinkTarget(target);if(!keyed)return;const scope=keyed.closest('.ui-slide');if(!scope)return;const key=keyed.dataset.marker;scope.classList.add('marker-linking');scope.querySelectorAll('[data-marker]').forEach((peer)=>peer.classList.toggle('marker-peer-active',peer.dataset.marker===key))}
2942
3014
  function clearMarkerLink(scope){if(!scope)return;scope.classList.remove('marker-linking');scope.querySelectorAll('.marker-peer-active').forEach((peer)=>peer.classList.remove('marker-peer-active'))}
@@ -2946,22 +3018,20 @@ function renderHtml(projects, usages = [], architecture = null, options = {}) {
2946
3018
  document.addEventListener('focusout',(event)=>{const from=markerLinkTarget(event.target);if(!from)return;const to=markerLinkTarget(event.relatedTarget);if(to&&to.dataset.marker===from.dataset.marker)return;clearMarkerLink(from.closest('.ui-slide'))});
2947
3019
  addEventListener('keydown',(event)=>{if(!document.getElementById('ui')?.classList.contains('active'))return;if(event.altKey||event.ctrlKey||event.metaKey||event.shiftKey)return;const target=event.target;if(target?.matches?.('input,textarea,select,[contenteditable="true"]'))return;if(event.key==='ArrowLeft'||event.key==='ArrowRight'){event.preventDefault();(activeUiController||uiControllers[0])?.go(event.key==='ArrowLeft'?-1:1)}});
2948
3020
  const sceneState=storedObject(sceneKey);
2949
- document.querySelectorAll('[data-spec-board]').forEach((board)=>{const boardId=board.dataset.specBoard;const specs=[...board.querySelectorAll('.spec-node')];const scenes=[...board.querySelectorAll('.scenario-node')];const groups=[...board.querySelectorAll('[data-scenario-group]')];const details=[...board.querySelectorAll('[data-scene-detail]')];const scenarioColumn=board.querySelector('.graph-col-scenario'),detailColumn=board.querySelector('.graph-col-feature'),lines=board.querySelector('.graph-lines');const saved=sceneState[boardId]||{};const savedExpanded=Array.isArray(saved.expandedSpecs)?saved.expandedSpecs.map(Number).filter((value)=>specs[value]):[Number(saved.spec)||0];const savedActive=Number(saved.activeSpec??saved.spec);const initialSpec=specs[savedActive]?savedActive:(savedExpanded.at(-1)??(specs.length?0:null));const initialScene=Number(saved.activeScene??saved.scene)||0;let current={expandedSpecs:new Set(initialSpec==null?[]:[initialSpec]),activeSpec:initialSpec??0,activeScene:scenes.some((scene)=>Number(scene.dataset.specIndex)===initialSpec&&Number(scene.dataset.sceneIndex)===initialScene)?initialScene:0,detailOpen:saved.detailOpen!==false};
2950
- function curve(from,to,color,width,active){const x1=from.right-rootBox.left,y1=from.top+from.height/2-rootBox.top,x2=to.left-rootBox.left,y2=to.top+to.height/2-rootBox.top,mid=(x1+x2)/2;return '<path class="graph-line'+(active?' graph-line-active':'')+'" pathLength="1" d="M '+x1+' '+y1+' C '+mid+' '+y1+', '+mid+' '+y2+', '+x2+' '+y2+'" fill="none" stroke="'+color+'" stroke-width="'+width+'"/>'}
2951
- let rootBox;
2952
- function draw(){if(!lines||innerWidth<901)return;rootBox=board.getBoundingClientRect();lines.setAttribute('viewBox','0 0 '+rootBox.width+' '+rootBox.height);let paths='';for(const specIndex of current.expandedSpecs){const from=specs[specIndex]?.getBoundingClientRect();if(!from)continue;const owned=scenes.filter((node)=>Number(node.dataset.specIndex)===specIndex&&!node.closest('[hidden]'));paths+=owned.map((node)=>curve(from,node.getBoundingClientRect(),'#d9c8aa','1.6',false)).join('')}const selected=scenes.find((node)=>Number(node.dataset.specIndex)===current.activeSpec&&Number(node.dataset.sceneIndex)===current.activeScene&&!node.closest('[hidden]'));const detail=current.detailOpen?details.find((node)=>!node.hidden)?.getBoundingClientRect():null;if(selected&&detail)paths+=curve(selected.getBoundingClientRect(),detail,'#cc785c','2.2',true);lines.innerHTML=paths}
2953
- function serializable(){return {expandedSpecs:[...current.expandedSpecs],activeSpec:current.activeSpec,activeScene:current.activeScene,detailOpen:current.detailOpen}}
2954
- function paint(){sceneState[boardId]=serializable();localStorage.setItem(sceneKey,JSON.stringify(sceneState));const anyOpen=current.expandedSpecs.size>0;if(scenarioColumn)scenarioColumn.hidden=!anyOpen;if(detailColumn)detailColumn.hidden=!anyOpen||!current.detailOpen;specs.forEach((x)=>{const active=current.expandedSpecs.has(Number(x.dataset.specIndex));x.classList.toggle('is-active',active);x.setAttribute('aria-expanded',String(active))});groups.forEach((x)=>x.hidden=!current.expandedSpecs.has(Number(x.dataset.scenarioGroup)));scenes.forEach((x)=>{const active=current.expandedSpecs.has(Number(x.dataset.specIndex))&&Number(x.dataset.specIndex)===current.activeSpec&&Number(x.dataset.sceneIndex)===current.activeScene;x.classList.toggle('is-active',active);x.setAttribute('aria-expanded',String(active&&current.detailOpen))});details.forEach((x)=>x.hidden=!anyOpen||!current.detailOpen||x.dataset.sceneDetail!==current.activeSpec+':'+current.activeScene);groups.filter((x)=>!x.hidden).forEach(replay);replay(details.find((x)=>!x.hidden));requestAnimationFrame(draw)}
2955
- function selectFirstExpanded(){const nextSpec=[...current.expandedSpecs][0];const first=scenes.find((scene)=>Number(scene.dataset.specIndex)===nextSpec);current.activeSpec=nextSpec??0;current.activeScene=first?Number(first.dataset.sceneIndex):0;current.detailOpen=Boolean(first)}
2956
- function toggleSpec(specIndex){if(current.expandedSpecs.has(specIndex)){current.expandedSpecs.clear();selectFirstExpanded()}else{current.expandedSpecs=new Set([specIndex]);const first=scenes.find((scene)=>Number(scene.dataset.specIndex)===specIndex);current.activeSpec=specIndex;current.activeScene=first?Number(first.dataset.sceneIndex):0;current.detailOpen=Boolean(first)}paint()}
2957
- function toggleScene(specIndex,sceneIndex){if(current.activeSpec===specIndex&&current.activeScene===sceneIndex&&current.detailOpen){current.detailOpen=false}else{current.expandedSpecs=new Set([specIndex]);current.activeSpec=specIndex;current.activeScene=sceneIndex;current.detailOpen=true}paint()}
2958
- specs.forEach((x)=>x.addEventListener('click',()=>toggleSpec(Number(x.dataset.specIndex))));scenes.forEach((x)=>x.addEventListener('click',()=>toggleScene(Number(x.dataset.specIndex),Number(x.dataset.sceneIndex))));paint();addEventListener('resize',draw)});
3021
+ document.querySelectorAll('[data-spec-board]').forEach((board)=>{const boardId=board.dataset.specBoard;const items=[...board.querySelectorAll('.spec-name-item')];const panels=[...board.querySelectorAll('[data-spec-detail]')];const saved=sceneState[boardId]||{};const savedActive=Number(saved.activeSpec);const current={activeSpec:items[savedActive]?savedActive:0};
3022
+ function paint(){sceneState[boardId]={activeSpec:current.activeSpec};localStorage.setItem(sceneKey,JSON.stringify(sceneState));items.forEach((x)=>{const active=Number(x.dataset.specIndex)===current.activeSpec;x.classList.toggle('is-active',active);x.setAttribute('aria-current',active?'true':'false')});panels.forEach((x)=>x.hidden=Number(x.dataset.specDetail)!==current.activeSpec);const activeItem=items[current.activeSpec];if(activeItem&&!activeItem.hidden){const list=activeItem.closest('.spec-name-list');if(list){const l=list.getBoundingClientRect(),a=activeItem.getBoundingClientRect();if(a.top<l.top)list.scrollTop+=a.top-l.top;else if(a.bottom>l.bottom)list.scrollTop+=a.bottom-l.bottom}}replay(panels.find((x)=>!x.hidden))}
3023
+ items.forEach((x)=>x.addEventListener('click',()=>{current.activeSpec=Number(x.dataset.specIndex);paint()}));const search=board.querySelector('[data-spec-search]'),empty=board.querySelector('[data-spec-empty]');if(search)search.addEventListener('input',()=>{const query=search.value.trim().toLowerCase();let any=false;items.forEach((x)=>{const hit=!query||String(x.dataset.specTitle).includes(query);x.hidden=!hit;any=any||hit});if(empty)empty.hidden=any||!items.length});paint();});
3024
+ document.querySelectorAll('[data-logic-board]').forEach((board)=>{const cards=[...board.querySelectorAll('[data-logic-card]')];const chips=[...board.querySelectorAll('[data-logic-stage]')];const search=board.querySelector('[data-logic-search]');const empty=board.querySelector('[data-logic-empty]');const problems=['blocked','in_progress','not_started'];let stageFilter=null,query='';
3025
+ function paint(){let any=false;cards.forEach((x)=>{const okStage=!stageFilter||String(x.dataset.stageStatus).split(';').some((pair)=>pair.startsWith(stageFilter+'=')&&problems.includes(pair.slice(stageFilter.length+1)));const okQuery=!query||String(x.dataset.logicTitle).includes(query);const show=okStage&&okQuery;x.hidden=!show;any=any||show});if(empty)empty.hidden=any||!cards.length;chips.forEach((x)=>x.classList.toggle('is-active',x.dataset.logicStage===stageFilter))}
3026
+ chips.forEach((x)=>x.addEventListener('click',()=>{stageFilter=stageFilter===x.dataset.logicStage?null:x.dataset.logicStage;paint()}));
3027
+ if(search)search.addEventListener('input',()=>{query=search.value.trim().toLowerCase();paint()});
3028
+ paint();});
2959
3029
  function snapshotState(){const now={};document.querySelectorAll('details').forEach((d,i)=>{now[detailOpenId(d,i)]=d.open});localStorage.setItem(openKey,JSON.stringify(now));localStorage.setItem(scrollKey,JSON.stringify({tab:document.querySelector('.tab.active')?.id||'overview',y:scrollY}))}
2960
3030
  let savedScroll={};try{const parsed=JSON.parse(localStorage.getItem(scrollKey)||'{}');savedScroll=typeof parsed==='number'?{y:parsed}:parsed||{}}catch{savedScroll={y:Number(localStorage.getItem(scrollKey))||0}}requestAnimationFrame(()=>scrollTo(0,Number(savedScroll.y)||0));addEventListener('pagehide',snapshotState);addEventListener('beforeunload',snapshotState);
2961
- // Probe before reloading: a healthy server picks up new artifacts every 30
3031
+ ${options.once ? '' : ` // Probe before reloading: a healthy server picks up new artifacts every 30
2962
3032
  // seconds; a stopped server leaves the current rendered dashboard visible.
2963
3033
  // Reloading only rebuilds HTML and never starts another device capture.
2964
- setTimeout(async()=>{if(window.__a2hShutdown)return;try{const response=await fetch(location.href,{cache:'no-store',headers:{'x-a2h-dashboard-render-probe':'1'}});if(!response.ok)return;snapshotState();location.reload()}catch{/* Keep the current dashboard visible while the server is unavailable. */}},30000);
3034
+ setTimeout(async()=>{if(window.__a2hShutdown)return;try{const response=await fetch(location.href,{cache:'no-store',headers:{'x-a2h-dashboard-render-probe':'1'}});if(!response.ok)return;snapshotState();location.reload()}catch{/* Keep the current dashboard visible while the server is unavailable. */}},30000);`}
2965
3035
  ${shutdownScript}
2966
3036
  </script></body></html>`;
2967
3037
  }
@@ -2973,7 +3043,7 @@ function build(config, captureState = null) {
2973
3043
  function listenWithFallback(server, startPort, maxAttempts = 20, onFallback = null) {
2974
3044
  return new Promise((resolve, reject) => {
2975
3045
  if (!Number.isInteger(startPort) || startPort < 1 || startPort > 65535) {
2976
- reject(new Error(`端口无效:${startPort}`));
3046
+ reject(new Error(`Invalid port: ${startPort}`));
2977
3047
  return;
2978
3048
  }
2979
3049
  const attemptsAllowed = Math.max(1, Math.min(Number(maxAttempts) || 1, 65536 - startPort));
@@ -3009,7 +3079,7 @@ function openBrowser(url) {
3009
3079
  // can fail; never let that surface as an uncaught exception — just tell the
3010
3080
  // user where the board lives.
3011
3081
  child.on('error', (error) => {
3012
- console.error(`[a2h-dashboard-render] 无法自动打开浏览器:${error.message};请手动访问:${url}`);
3082
+ console.error(`[a2h-dashboard-render] Failed to open the browser automatically: ${error.message}; visit ${url} manually`);
3013
3083
  });
3014
3084
  child.unref();
3015
3085
  }
@@ -3017,7 +3087,7 @@ function openBrowser(url) {
3017
3087
  async function main() {
3018
3088
  try {
3019
3089
  if (!supportsNodeVersion()) {
3020
- throw new Error(`Node.js 版本过低:当前 ${process.versions.node},要求 >=22.18.0`);
3090
+ throw new Error(`Node.js version too old: running ${process.versions.node}, >=22.18.0 required`);
3021
3091
  }
3022
3092
  const args = parseArgs(process.argv.slice(2));
3023
3093
  if (args.help) { console.log(helpText()); return; }
@@ -3025,55 +3095,55 @@ async function main() {
3025
3095
  const captureManager = new DeviceCaptureManager(config.entries);
3026
3096
  if (args.once) {
3027
3097
  const out = path.resolve(args.out || 'dashboard-node.html');
3028
- console.log('[a2h-dashboard-render] 正在从当前 HarmonyOS 设备采集截图(安卓侧直接使用 UI 迁移产物,不连接设备);失败时保留并回退本地缓存...');
3098
+ console.log('[a2h-dashboard-render] Capturing screenshots from the connected HarmonyOS device (the Android side reuses UI migration artifacts, no device attached); on failure the local cache is kept as fallback...');
3029
3099
  await captureManager.refresh({ force: true });
3030
3100
  const projects = build(config, captureManager.snapshot());
3031
3101
  const usageSources = resolveUsageSources(config.usageSources);
3032
3102
  let usages = [];
3033
3103
  if (usageSources.length) {
3034
- console.log(`[a2h-dashboard-render] 正在统计 Agent 用量(${usageSources.join(', ')}),本地会话库很大时可能需要数分钟...`);
3104
+ console.log(`[a2h-dashboard-render] Collecting Agent usage (${usageSources.join(', ')}); a large local session store can take minutes...`);
3035
3105
  const usageStartedAt = Date.now();
3036
3106
  usages = collectUsage(projects, config.usageSources);
3037
- console.log(`[a2h-dashboard-render] Agent 用量统计完成,耗时 ${((Date.now() - usageStartedAt) / 1000).toFixed(1)} 秒。`);
3107
+ console.log(`[a2h-dashboard-render] Agent usage collected in ${((Date.now() - usageStartedAt) / 1000).toFixed(1)}s.`);
3038
3108
  }
3039
3109
  fs.mkdirSync(path.dirname(out), { recursive: true });
3040
- fs.writeFileSync(out, renderHtml(projects, usages, architectureModel(config)), 'utf8');
3041
- console.log(`[a2h-dashboard-render] Node 静态看板:${out}`);
3110
+ fs.writeFileSync(out, renderHtml(projects, usages, architectureModel(config), { once: true, lang: args.lang || 'zh' }), 'utf8');
3111
+ console.log(`[a2h-dashboard-render] Node static dashboard written: ${out}`);
3042
3112
  if (args.open) openBrowser(out);
3043
3113
  return;
3044
3114
  }
3045
3115
  captureManager.start();
3046
- // 用量统计在 worker 线程后台刷新:collectUsage 同步扫描本机会话库,
3047
- // 大会上分钟级——绝不能进请求路径。请求永远只读 usageCache;
3048
- // 首扫完成前页面显示"统计采集中"。
3116
+ // Usage stats refresh on a background worker thread: collectUsage scans the local session database
3117
+ // synchronously — minutes on large libraries; it must never enter the request path. Requests only ever
3118
+ // read usageCache; the page shows "collecting" until the first scan completes.
3049
3119
  const usageCache = { value: [], scanning: false };
3050
3120
  const usageRefresh = () => {
3051
3121
  if (usageCache.scanning) return;
3052
3122
  usageCache.scanning = true;
3053
3123
  let worker;
3054
3124
  try {
3055
- // payload 每轮重建:迁移进行中 manifest 的 TOTAL End 会后移、
3056
- // 新 Spec 会加入 logic——沿用启动时的窗口会让 token 总量停在旧值。
3125
+ // The payload is rebuilt every round: during an active migration the manifest's TOTAL End moves later
3126
+ // and new Specs join logic — reusing the startup window would freeze the token totals at stale values.
3057
3127
  worker = new Worker(usageWorkerUrl, { workerData: { projects: usageProjectsPayload(build(config, null)), requested: config.usageSources } });
3058
3128
  } catch (error) {
3059
3129
  usageCache.scanning = false;
3060
- console.error(`[a2h-dashboard-render] 用量扫描线程启动失败:${error?.message || error}`);
3130
+ console.error(`[a2h-dashboard-render] Usage scan worker failed to start: ${error?.message || error}`);
3061
3131
  return;
3062
3132
  }
3063
3133
  const timeout = setTimeout(() => {
3064
- console.error('[a2h-dashboard-render] 用量扫描超过 5 分钟,本轮结果丢弃。');
3134
+ console.error('[a2h-dashboard-render] Usage scan exceeded 5 minutes; this round is discarded.');
3065
3135
  try { worker.terminate(); } catch { /* already dead */ }
3066
3136
  }, 5 * 60_000).unref();
3067
3137
  worker.on('message', (msg) => {
3068
3138
  clearTimeout(timeout);
3069
3139
  usageCache.scanning = false;
3070
3140
  if (msg?.ok) usageCache.value = msg.usage;
3071
- else console.error(`[a2h-dashboard-render] 用量扫描失败:${msg?.error || '未知错误'}`);
3141
+ else console.error(`[a2h-dashboard-render] Usage scan failed: ${msg?.error || 'unknown error'}`);
3072
3142
  });
3073
3143
  worker.on('error', (error) => {
3074
3144
  clearTimeout(timeout);
3075
3145
  usageCache.scanning = false;
3076
- console.error(`[a2h-dashboard-render] 用量扫描线程异常:${error?.message || error}`);
3146
+ console.error(`[a2h-dashboard-render] Usage scan worker crashed: ${error?.message || error}`);
3077
3147
  });
3078
3148
  worker.on('exit', () => {
3079
3149
  clearTimeout(timeout);
@@ -3088,10 +3158,10 @@ async function main() {
3088
3158
  if (request.url === '/shutdown') {
3089
3159
  if (request.method !== 'POST') {
3090
3160
  response.writeHead(405, { 'content-type': 'text/plain; charset=utf-8', allow: 'POST' });
3091
- response.end('关闭看板请使用 POST 请求(页面左下角「停止看板服务」按钮)。');
3161
+ response.end('Send a POST request to shut down (the "Stop dashboard" button in the page\'s bottom-left corner).');
3092
3162
  return;
3093
3163
  }
3094
- console.error('[a2h-dashboard-render] 收到网页关闭请求,正在停止看板服务。');
3164
+ console.error('[a2h-dashboard-render] Received a shutdown request from the web page; stopping the dashboard server.');
3095
3165
  response.writeHead(200, { 'content-type': 'text/plain; charset=utf-8', 'cache-control': 'no-store' });
3096
3166
  response.end('ok');
3097
3167
  response.on('finish', () => {
@@ -3100,7 +3170,7 @@ async function main() {
3100
3170
  captureManager.stop();
3101
3171
  server.closeAllConnections?.();
3102
3172
  server.close(() => {
3103
- console.error('[a2h-dashboard-render] 看板服务已停止。');
3173
+ console.error('[a2h-dashboard-render] Dashboard server stopped.');
3104
3174
  process.exit(0);
3105
3175
  });
3106
3176
  setTimeout(() => process.exit(0), 1500).unref();
@@ -3109,61 +3179,61 @@ async function main() {
3109
3179
  }
3110
3180
  try {
3111
3181
  const projects = build(config, captureManager.snapshot());
3112
- const body = renderHtml(projects, usageCache.value, architectureModel(config), { shutdownButton: true, usageScanning: usageCache.scanning && !usageCache.value.length });
3182
+ const body = renderHtml(projects, usageCache.value, architectureModel(config), { shutdownButton: true, usageScanning: usageCache.scanning && !usageCache.value.length, lang: resolveDisplayLang(request.url, request.headers.cookie, request.headers['accept-language']) });
3113
3183
  response.writeHead(200, { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-store' });
3114
3184
  response.end(body);
3115
3185
  } catch (error) {
3116
3186
  response.writeHead(500, { 'content-type': 'text/plain; charset=utf-8' });
3117
- response.end(`看板生成失败:${error.stack || error}`);
3187
+ response.end(`Dashboard render failed: ${error.stack || error}`);
3118
3188
  }
3119
3189
  });
3120
3190
  let listeningPort = args.port;
3121
3191
  try {
3122
3192
  listeningPort = await listenWithFallback(server, args.port, args.portExplicit ? 1 : 20, (from, to) => {
3123
- console.error(`[a2h-dashboard-render] 端口 ${from} 被占用,自动改用 ${to}。`);
3193
+ console.error(`[a2h-dashboard-render] Port ${from} is in use; falling back to ${to}.`);
3124
3194
  });
3125
3195
  } catch (error) {
3126
- console.error(`[a2h-dashboard-render] 无法监听端口 ${args.port}:${error.code ? `${error.code} ` : ''}${error.message}`);
3196
+ console.error(`[a2h-dashboard-render] Cannot listen on port ${args.port}: ${error.code ? `${error.code} ` : ''}${error.message}`);
3127
3197
  console.error(args.portExplicit
3128
- ? '该端口由 --port 显式指定,不会自动顺延;请换一个端口或释放被占用的端口后重试。'
3129
- : '默认端口及其后的候选端口均被占用,请用 --port 显式指定一个可用端口。');
3198
+ ? 'This port was explicitly requested via --port and will not be shifted; free it or pick another one.'
3199
+ : 'The default port and all its fallback candidates are busy; pass --port explicitly with a free port.');
3130
3200
  captureManager.stop();
3131
3201
  process.exit(1);
3132
3202
  }
3133
3203
  server.on('error', (error) => {
3134
- console.error(`[a2h-dashboard-render] HTTP 服务错误:${error.stack || error}`);
3204
+ console.error(`[a2h-dashboard-render] HTTP server error: ${error.stack || error}`);
3135
3205
  });
3136
3206
  const url = `http://127.0.0.1:${listeningPort}/`;
3137
3207
  console.log(`[a2h-dashboard-render] Node.js ${process.version}`);
3138
- console.log(`[a2h-dashboard-render] 跟踪 ${config.entries.length} 个工程`);
3139
- console.log(`[a2h-dashboard-render] 打开 ${url}(Ctrl+C 或页面左下角「停止看板服务」按钮停止)`);
3208
+ console.log(`[a2h-dashboard-render] Tracking ${config.entries.length} project(s)`);
3209
+ console.log(`[a2h-dashboard-render] Open ${url} (stop via Ctrl+C or the "Stop dashboard" button in the page's bottom-left corner)`);
3140
3210
  if (args.open) openBrowser(url);
3141
3211
  // Keep one explicit referenced handle for the dashboard lifetime. The
3142
3212
  // service may only shut itself down after a foreground Ctrl+C (SIGINT);
3143
3213
  // capture completion, an empty event loop, or a recoverable error must not
3144
3214
  // make the PowerShell prompt return by itself.
3145
- const keepAlive = setInterval(() => {}, 60_000);
3215
+ const keepAlive = setInterval(() => { }, 60_000);
3146
3216
  const stop = () => {
3147
- console.error('[a2h-dashboard-render] 收到 Ctrl+C,正在停止看板服务。');
3217
+ console.error('[a2h-dashboard-render] Received Ctrl+C; stopping the dashboard server.');
3148
3218
  clearInterval(keepAlive);
3149
3219
  captureManager.stop();
3150
- server.close(() => console.error('[a2h-dashboard-render] 看板服务已停止。'));
3220
+ server.close(() => console.error('[a2h-dashboard-render] Dashboard server stopped.'));
3151
3221
  };
3152
3222
  process.once('SIGINT', stop);
3153
3223
  process.on('SIGTERM', () => {
3154
- console.error('[a2h-dashboard-render] 收到 SIGTERM,但按运行规则继续服务;请在前台按 Ctrl+C 停止。');
3224
+ console.error('[a2h-dashboard-render] Received SIGTERM; per the run rules the server keeps running — stop it with a foreground Ctrl+C.');
3155
3225
  });
3156
3226
  process.on('uncaughtException', (error, origin) => {
3157
- console.error(`[a2h-dashboard-render] 未捕获异常(${origin}),看板服务继续运行:${error.stack || error}`);
3227
+ console.error(`[a2h-dashboard-render] Uncaught exception (${origin}); the dashboard server keeps running: ${error.stack || error}`);
3158
3228
  });
3159
3229
  process.on('unhandledRejection', (reason) => {
3160
- console.error(`[a2h-dashboard-render] 未处理的异步异常,看板服务继续运行:${reason?.stack || reason}`);
3230
+ console.error(`[a2h-dashboard-render] Unhandled rejection; the dashboard server keeps running: ${reason?.stack || reason}`);
3161
3231
  });
3162
3232
  process.once('beforeExit', (code) => {
3163
- console.error(`[a2h-dashboard-render] Node 事件循环意外结束(exitCode=${code})。`);
3233
+ console.error(`[a2h-dashboard-render] Node event loop ended unexpectedly (exitCode=${code}).`);
3164
3234
  });
3165
3235
  process.once('exit', (code) => {
3166
- console.error(`[a2h-dashboard-render] Node 进程退出(exitCode=${code})。`);
3236
+ console.error(`[a2h-dashboard-render] Node process exiting (exitCode=${code}).`);
3167
3237
  });
3168
3238
  } catch (error) {
3169
3239
  console.error(`[a2h-dashboard-render] ${error.message}`);
@@ -3182,16 +3252,26 @@ export {
3182
3252
  listenWithFallback,
3183
3253
  loadEntries,
3184
3254
  logicForSpec,
3255
+ logicStepStatus,
3185
3256
  overview,
3186
3257
  parseArgs,
3187
3258
  parseScenarios,
3188
3259
  projectModel,
3189
3260
  renderArchitecture,
3190
3261
  renderHtml,
3262
+ resolveDisplayLang,
3263
+ langFromAcceptHeader,
3264
+ trCaptureDetail,
3191
3265
  resolveUsageSources,
3192
3266
  specPipelineModel,
3267
+ reviewScenarioTitleKey,
3268
+ reviewVerdictStatus,
3193
3269
  statusBucket,
3270
+ statusLabel,
3194
3271
  supportsNodeVersion,
3272
+ tr,
3273
+ trMarkerLabel,
3274
+ translateScenarioName,
3195
3275
  nestedStitchBoundary,
3196
3276
  stitchOverlapDecision,
3197
3277
  usageProjectsPayload,