@buaa_smat/hometrans 26.0.0-devecocli.3 → 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.
- package/README.md +433 -0
- package/agents/build-fixer.md +1 -2
- package/agents/code-reviewer.md +31 -15
- package/agents/model-render-worker.md +9 -5
- package/dist/cli/config-store.js +128 -0
- package/dist/cli/config.js +48 -0
- package/dist/cli/editors.json +114 -0
- package/dist/cli/env-vars.js +127 -0
- package/dist/cli/index.js +73 -0
- package/dist/cli/init.js +2513 -0
- package/dist/cli/uninstall.js +406 -0
- package/dist/platform/compose.js +228 -0
- package/dist/platform/frontmatter.js +151 -0
- package/dist/platform/installer.js +417 -0
- package/dist/platform/registry.js +337 -0
- package/dist/platform/transform.js +363 -0
- package/dist/platform/types.js +9 -0
- package/dist/platform/validate.js +152 -0
- package/dist/utils/regex.js +7 -0
- package/env-requirements.json +511 -0
- package/package.json +240 -11
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +1 -1
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +1 -1
- package/resource/choose_editor.png +0 -0
- package/resource/convert_pipeline_process.svg +114 -0
- package/resource/project_architecture.svg +120 -0
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/resource/set_sdk.png +0 -0
- package/resource/title_dark.png +0 -0
- package/skills/a2h-app-migrate/SKILL.md +17 -11
- package/skills/a2h-app-migrate/references/stage-map.md +22 -7
- package/skills/a2h-app-migrate/references/workflow.yaml +276 -209
- package/skills/a2h-app-migrate/scripts/android_index.mjs +34 -16
- package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +12 -12
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +12 -12
- package/skills/a2h-app-migrate/scripts/check_signing.mjs +16 -16
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +17 -16
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +141 -62
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +12 -12
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +26 -26
- package/skills/a2h-app-migrate/scripts/cli_values.mjs +7 -7
- package/skills/a2h-app-migrate/scripts/ensure_utg_snapshot.mjs +144 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +474 -365
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +115 -108
- package/skills/a2h-app-migrate/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-app-migrate/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +6 -6
- package/skills/a2h-app-migrate/scripts/json_io.mjs +1 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +15 -15
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +99 -99
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +25 -25
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +9 -9
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +33 -33
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +13 -11
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +128 -80
- package/skills/a2h-app-migrate/scripts/write_resume_summary.mjs +349 -0
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +21 -21
- package/skills/a2h-arch-generate/scripts/create_project.mjs +23 -23
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +48 -40
- package/skills/a2h-arch-generate/scripts/generate_state.mjs +7 -7
- package/skills/a2h-arch-generate/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-arch-generate/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +10 -1
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +41 -36
- package/skills/a2h-arch-generate/scripts/lib/contract_terms.mjs +40 -0
- package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1 -1
- package/skills/a2h-arch-generate/scripts/module_create/create.mjs +17 -17
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +54 -50
- package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +42 -42
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +69 -44
- package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +62 -17
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +5 -4
- package/skills/a2h-arkts-logic-coder/SKILL.md +39 -8
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +28 -17
- package/skills/{a2h-spec-design/SKILL.md → a2h-arkts-logic-coder/references/spec-design.md} +45 -78
- package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +1 -1
- package/skills/a2h-arkts-logic-coder/scripts/check_units.ts +448 -0
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.d.mts +5 -0
- package/skills/a2h-arkts-logic-coder/scripts/design/i18n-term.mjs +54 -0
- package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/inspect_spec_design_inputs.mjs +18 -12
- package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/lib/py_compat.mjs +1 -1
- package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/move_spec_technical_reference.mjs +10 -7
- package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/resolve_module_design.mjs +13 -7
- package/skills/{a2h-spec-design/scripts → a2h-arkts-logic-coder/scripts/design}/validate_spec_design_output.mjs +57 -41
- package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +66 -323
- package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +66 -108
- package/skills/a2h-arkts-logic-coder/scripts/test_check_units.ts +149 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +5 -18
- package/skills/a2h-batch-ui-align/SKILL.md +39 -39
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +31 -0
- package/skills/a2h-batch-ui-align/references/cards/build.md +13 -0
- package/skills/a2h-batch-ui-align/references/cards/canvas.md +17 -0
- package/skills/a2h-batch-ui-align/references/cards/dynamics.md +27 -0
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +80 -0
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +22 -0
- package/skills/a2h-batch-ui-align/references/cards/resources.md +83 -0
- package/skills/a2h-batch-ui-align/references/cards/state-v1.md +29 -0
- package/skills/a2h-batch-ui-align/references/cards/state.md +14 -0
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +38 -0
- package/skills/a2h-batch-ui-align/references/cards/window.md +29 -0
- package/skills/a2h-batch-ui-align/references/checker-rules.md +642 -0
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +69 -260
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +34 -0
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +16 -4
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -1
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +32 -1
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +7 -1
- 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
- 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
- package/skills/a2h-batch-ui-align/references/step3-capture.md +11 -9
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +13 -8
- package/skills/a2h-batch-ui-align/references/step5-convert.md +21 -18
- package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +44 -44
- package/skills/a2h-batch-ui-align/scripts/android_parse_fast.ts +237 -236
- package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +42 -3834
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +34 -32
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +1 -1
- package/skills/a2h-batch-ui-align/scripts/detect_paradigm.mjs +240 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +139 -33
- package/skills/a2h-batch-ui-align/scripts/gen_rule_docs.mjs +100 -0
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +26 -25
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +1 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +159 -12
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +145 -21
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +8 -8
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +1 -1
- package/skills/a2h-batch-ui-align/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-batch-ui-align/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-batch-ui-align/scripts/image_probe.mjs +228 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +444 -266
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +66 -32
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +141 -57
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +410 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +80 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/cli.ts +134 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/findings.ts +21 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/i18n.ts +22 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/meta.ts +34 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +668 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +392 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +167 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/package.json +3 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +101 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +629 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/android_immersive.ts +125 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +67 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/block_comment_break.ts +64 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/blur_mirrored.ts +134 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_call_sites.ts +242 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/builder_invokes_callback.ts +71 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/canvas.ts +255 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/color_string.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/column_shrink.ts +154 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/constant_coordinate.ts +39 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/container_align.ts +140 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_root_builtin.ts +69 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/entry_route.ts +114 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/fixed_size_safe_area.ts +103 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/format_string.ts +157 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/framework_picker.ts +115 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +551 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_content.ts +138 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +310 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/offset_in_scroll.ts +163 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/orphan_component.ts +119 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/page_reachability.ts +94 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/path_commands_vp.ts +50 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +80 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/popup_menu.ts +64 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/r_template_string.ts +37 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/request_permission.ts +98 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/resource_as_string.ts +68 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +97 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/safe_area_clipping.ts +168 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sdk_api.ts +195 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/shared_chrome.ts +73 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/sheet_blur.ts +95 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/shell_content.ts +198 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/stack_occluding.ts +118 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/state_decorators.ts +73 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/state_name_shadows.ts +93 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/string_quote_leak.ts +73 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/surface_stroke.ts +50 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/track_getter.ts +132 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +53 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_mode.ts +68 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +153 -0
- package/skills/a2h-batch-ui-align/scripts/text_color_diff.mjs +65 -65
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +8 -6
- package/skills/a2h-dashboard-render/SKILL.md +15 -7
- package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +5 -35
- package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +4 -4
- package/skills/a2h-dashboard-render/references/dashboard-guide.md +91 -0
- package/skills/a2h-dashboard-render/scripts/check-registry.mjs +17 -17
- package/skills/a2h-dashboard-render/scripts/dashboard.css +3546 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +1021 -941
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +104 -65
- package/skills/a2h-dashboard-render/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-dashboard-render/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-dashboard-render/scripts/page_capture.mjs +8 -8
- package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +67 -37
- package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +4 -4
- package/skills/a2h-fix-build-errors/SKILL.md +1 -2
- package/skills/a2h-resource-convert/SKILL.md +1 -3
- package/skills/a2h-resource-convert/references/step7-report-template.md +2 -2
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +366 -361
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +170 -170
- package/skills/a2h-resource-convert/scripts/app_identity.ts +162 -162
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +95 -95
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +132 -132
- package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +220 -220
- package/skills/a2h-resource-convert/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-resource-convert/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +74 -74
- package/skills/a2h-spec-design-pipeline/SKILL.md +113 -63
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +226 -56
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +315 -62
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +4 -2
- package/skills/a2h-spec-design-pipeline/references/initialization.md +12 -9
- package/skills/a2h-spec-design-pipeline/references/legacy-cleanup.md +18 -0
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +109 -8
- package/skills/a2h-spec-design-pipeline/references/scripts.md +29 -16
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +116 -8
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +179 -0
- package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +33 -5
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +36 -16
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +93 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +915 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/ledger.mjs +234 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/plan.mjs +33 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +31 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +94 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/state-mirror.mjs +55 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/timeouts.mjs +34 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +92 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/waker.mjs +60 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/worktree.mjs +89 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +551 -0
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +267 -33
- package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +30 -10
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +634 -0
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-spec-design-pipeline/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/io.mjs +33 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +107 -19
- package/skills/a2h-spec-design-pipeline/scripts/stage_design_inputs.ts +79 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +4 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +121 -38
- package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +58 -11
- package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +31 -31
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +564 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +339 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +161 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +1024 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_ledger.mjs +178 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_plan.mjs +60 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +58 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +91 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +60 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_waker.mjs +95 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_worktree.mjs +81 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +183 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +29 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +294 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_i18n_term.ts +70 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +157 -30
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +2 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_stage_design_inputs.ts +72 -0
- package/skills/a2h-spec-generate/SKILL.md +34 -10
- package/skills/a2h-spec-generate/references/batch-mode.md +4 -1
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +90 -21
- package/skills/a2h-spec-generate/references/recall-guide.md +1 -0
- package/skills/a2h-spec-generate/references/requirement-scope.md +1 -1
- package/skills/a2h-spec-generate/references/specs.schema.json +6 -0
- package/skills/a2h-spec-generate/references/worker-rules.md +2 -1
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +305 -116
- package/skills/a2h-spec-generate/scripts/check_spec.ts +136 -114
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +19 -4
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +74 -14
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +4 -2
- package/skills/a2h-spec-generate/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-spec-generate/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-spec-generate/scripts/parse_requirements.ts +65 -65
- package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +8 -2
- package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +8 -2
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +80 -5
- package/skills/a2h-spec-generate/scripts/regroup-by-page.mjs +670 -0
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +37 -30
- package/skills/a2h-spec-generate/scripts/report.mjs +7 -3
- package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +26 -26
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +2 -2
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +2 -2
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +4 -4
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +6 -6
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +3 -3
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +23 -23
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +16 -16
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +27 -26
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +7 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +32 -31
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +3 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +26 -20
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +92 -69
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +7 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/behavior-seed.ts +545 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/library-evidence.ts +545 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +177 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +424 -29
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +133 -7
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +302 -103
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/zip.ts +99 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.d.mts +5 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/i18n-term.mjs +54 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +8 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +5 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +39 -33
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +4 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +4 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +48 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +366 -5
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +102 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +81 -52
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +21 -11
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +2 -1
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +13 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +2 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +2 -2
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +4 -4
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +6 -6
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +3 -3
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +16 -16
- package/skills/a2h-utg-explorer/assets/final_viewer.html +21 -21
- package/skills/a2h-utg-explorer/references/architecture.md +7 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +108 -9
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +21 -3
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +4 -1
- package/skills/a2h-utg-explorer/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-utg-explorer/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-utg-explorer/scripts/panel_routes.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +45 -2
- package/skills/a2h-utg-explorer/scripts/recover_b.mjs +2 -1
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +17 -6
- package/skills/a2h-utg-explorer/scripts/report.mjs +38 -18
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +16 -6
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +179 -18
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +21 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +454 -43
- package/skills/a2h-utg-static/SKILL.md +7 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +29 -2
- package/skills/a2h-utg-static/scripts/click_paths.mjs +42 -26
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +6 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +4 -2
- package/skills/a2h-utg-static/scripts/i18n-term.d.mts +5 -0
- package/skills/a2h-utg-static/scripts/i18n-term.mjs +54 -0
- package/skills/a2h-utg-static/scripts/manifest.mjs +91 -10
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +68 -3
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +2 -1
- package/skills/a2h-utg-static/scripts/route_interceptor.mjs +374 -0
- package/skills/a2h-utg-static/scripts/static_prior.mjs +87 -33
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +240 -8
- package/skills/a2h-utg-static/scripts/utg_html.mjs +51 -51
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +100 -100
- package/devecocli-plugin/common.ts +0 -2203
- package/devecocli-plugin/install.ts +0 -61
- package/devecocli-plugin/uninstall.ts +0 -26
- package/devecocli-plugin/update.ts +0 -66
- package/index.js +0 -1418
- package/plugin.jsonc +0 -12
- package/skills/a2h-app-migrate/test/test_android_index.mjs +0 -80
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +0 -63
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +0 -54
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +0 -92
- package/skills/a2h-app-migrate/test/test_config_example.mjs +0 -42
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +0 -93
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +0 -544
- package/skills/a2h-app-migrate/test/test_finalize.mjs +0 -89
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +0 -146
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +0 -68
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +0 -91
- package/skills/a2h-app-migrate/test/test_interaction.mjs +0 -122
- package/skills/a2h-app-migrate/test/test_json_io.mjs +0 -32
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +0 -109
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +0 -53
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +0 -69
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +0 -93
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +0 -144
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +0 -100
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +0 -315
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +0 -133
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +0 -133
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +0 -158
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +0 -181
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +0 -76
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +0 -53
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +0 -226
- package/skills/a2h-app-migrate/test/test_uniapp_preflight.mjs +0 -83
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +0 -39
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +0 -168
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +0 -50
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +0 -11
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +0 -12
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +0 -8
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +0 -17
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +0 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +0 -8
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +0 -14
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +0 -7
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +0 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +0 -7
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +0 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +0 -7
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +0 -3
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +0 -1
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +0 -7
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +0 -9
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +0 -7
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +0 -10
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +0 -6
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +0 -16
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +0 -5
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +0 -548
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +0 -1122
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +0 -191
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +0 -52
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +0 -34
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +0 -138
- package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +0 -224
- package/skills/a2h-batch-ui-align/flowchart.html +0 -271
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/skills/a2h-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +0 -911
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +0 -217
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +0 -253
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_canvas_pct.test.mjs +0 -312
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_fidelity.test.mjs +0 -241
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +0 -341
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_review_fixes.test.mjs +0 -298
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +0 -365
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +0 -91
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +0 -445
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +0 -356
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +0 -290
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +0 -74
- package/skills/a2h-batch-ui-align/scripts/tests/export_scroll_states.test.mjs +0 -31
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +0 -564
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +0 -123
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +0 -126
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +0 -241
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +0 -1451
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +0 -215
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +0 -95
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +0 -115
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +0 -170
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +0 -102
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +0 -244
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +0 -166
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +0 -49
- package/skills/a2h-batch-ui-align/scripts/tests/text_color_diff.test.mjs +0 -219
- package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +0 -83
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +0 -1
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +0 -156
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +0 -1
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +0 -1
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +0 -1
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +0 -170
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +0 -99
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +0 -182
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +0 -64
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +0 -1172
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +0 -251
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +0 -81
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +0 -115
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +0 -303
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +0 -147
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +0 -444
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +0 -187
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +0 -351
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +0 -495
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +0 -157
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +0 -388
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +0 -182
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +0 -206
- package/skills/a2h-spec-design/test/golden/inspect_happy.json +0 -20
- package/skills/a2h-spec-design/test/golden/move_design.md +0 -18
- package/skills/a2h-spec-design/test/golden/move_design_crlf.md +0 -18
- package/skills/a2h-spec-design/test/golden/move_spec.md +0 -7
- package/skills/a2h-spec-design/test/golden/resolve_cases.json +0 -36
- package/skills/a2h-spec-design/test/golden/validate_issue_file.md +0 -12
- package/skills/a2h-spec-design/test/golden/validate_issues.json +0 -57
- package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +0 -381
- package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +0 -944
- package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +0 -95
- package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +0 -218
- package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +0 -64
- package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +0 -452
- package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +0 -182
- package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +0 -289
- package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +0 -441
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +0 -50
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +0 -75
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +0 -256
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +0 -576
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +0 -290
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +0 -1323
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +0 -574
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +0 -339
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +0 -831
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +0 -548
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +0 -117
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +0 -396
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +0 -175
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +0 -298
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +0 -1061
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +0 -286
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +0 -25
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +0 -159
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +0 -632
- package/skills/a2h-spec-generate/test/check-spec.test.ts +0 -200
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +0 -538
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +0 -37
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +0 -45
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +0 -147
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +0 -3
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +0 -3
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +0 -3
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +0 -9
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +0 -8
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +0 -9
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +0 -1
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +0 -6
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +0 -4
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +0 -1
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +0 -33
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +0 -1
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +0 -23
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +0 -3
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +0 -8
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +0 -1
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +0 -54
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +0 -157
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +0 -282
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +0 -593
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +0 -66
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +0 -45
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +0 -243
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +0 -104
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +0 -223
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +0 -88
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +0 -187
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +0 -130
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +0 -136
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +0 -135
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +0 -16
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +0 -251
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +0 -42
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +0 -162
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +0 -193
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +0 -204
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +0 -355
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +0 -240
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +0 -212
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +0 -173
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +0 -267
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +0 -213
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +0 -345
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +0 -453
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +0 -131
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +0 -229
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +0 -336
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +0 -102
- package/skills/a2h-utg-explorer/scripts/tests/state_ambiguity.test.mjs +0 -92
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +0 -119
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +0 -346
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +0 -112
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +0 -63
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +0 -24
- package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +0 -28
- package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +0 -108
- package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +0 -90
- package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +0 -61
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +0 -1261
- package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +0 -90
- package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +0 -106
- package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +0 -58
- package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +0 -19
- package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +0 -30
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +0 -103
- package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +0 -60
- package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +0 -111
- package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +0 -113
- package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +0 -117
- package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +0 -166
- package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +0 -112
- package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +0 -284
- package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +0 -71
- package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +0 -77
- package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +0 -99
- package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +0 -69
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +0 -96
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +0 -37
- package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +0 -42
- package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +0 -140
- package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +0 -111
- package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +0 -70
- package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +0 -69
- package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +0 -43
- package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +0 -67
- package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +0 -38
- package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +0 -85
- package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +0 -92
- package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +0 -55
- package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +0 -86
- package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +0 -119
- package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +0 -68
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +0 -74
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +0 -181
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +0 -293
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +0 -118
- package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +0 -272
- package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +0 -51
- package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +0 -69
- package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +0 -187
- package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +0 -70
- package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +0 -67
- package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +0 -103
- package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +0 -79
- package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +0 -47
- package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +0 -40
- package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +0 -84
- package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +0 -68
- package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +0 -172
- package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +0 -33
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +0 -44
- package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +0 -80
- package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +0 -35
- package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +0 -42
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +0 -85
- package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +0 -57
- package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +0 -62
- package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +0 -72
- package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +0 -86
- package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +0 -78
- package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +0 -65
- package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +0 -172
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +0 -107
- package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +0 -167
- package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +0 -117
- package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +0 -98
- package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +0 -87
- package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +0 -183
- package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +0 -48
- package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +0 -41
- package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +0 -126
- package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +0 -142
- package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +0 -135
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +0 -66
- package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +0 -236
- package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +0 -85
- package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +0 -148
- package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +0 -63
- package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +0 -58
- package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +0 -41
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +0 -109
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +0 -68
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +0 -127
- package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +0 -130
- package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +0 -51
- package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +0 -81
- package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +0 -58
- package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +0 -68
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +0 -91
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +0 -110
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +0 -89
- package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +0 -98
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +0 -231
- package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +0 -104
- package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +0 -69
- package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +0 -346
- package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +0 -340
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +0 -98
- package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +0 -92
- package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +0 -158
- package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +0 -65
|
@@ -1,1122 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// 统一标记语法与三个解析/校验脚本的金样本测试。
|
|
3
|
-
//
|
|
4
|
-
// 覆盖:
|
|
5
|
-
// 1. validate_architecture_docs.py —— 统一标记 `# [EXISTING] [HAP|HAR|HSP]`
|
|
6
|
-
// (EXISTING 在前)的正反例:generate/reconcile 两模式、--allow-existing
|
|
7
|
-
// 门控、token 顺序/未知/重复、旧 <!-- EXISTING_TARGET --> 迁移提示。
|
|
8
|
-
// 2. module_create/generate.py —— 脚手架解析器对同一语法的解析一致性
|
|
9
|
-
// (EXISTING 前缀被忽略、仅 EXISTING 的行不是模块根、非法注释报错)。
|
|
10
|
-
// 3. validate_incremental_docs.py —— # EXISTING 的磁盘存在性、inspection
|
|
11
|
-
// 新鲜度、调和一致性(existing_targets / planned_only / disposition)。
|
|
12
|
-
//
|
|
13
|
-
// 用法: node scripts/tests/run_tests.mjs
|
|
14
|
-
|
|
15
|
-
import { fileURLToPath } from "node:url";
|
|
16
|
-
import os from "node:os";
|
|
17
|
-
import { spawnSync } from "node:child_process";
|
|
18
|
-
import {
|
|
19
|
-
fs, path, process, pyJsonDump, parseStrictJson, pyRepr, runCapture,
|
|
20
|
-
resolveLikePython, isFile,
|
|
21
|
-
} from "../lib/py_compat.mjs";
|
|
22
|
-
import { parseDocument, DesignError } from "../module_create/generate.mjs";
|
|
23
|
-
|
|
24
|
-
const TESTS_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
25
|
-
const SCRIPTS_DIR = path.dirname(TESTS_DIR);
|
|
26
|
-
const TESTDATA = path.join(SCRIPTS_DIR, "module_create", "testdata");
|
|
27
|
-
const VALIDATOR = path.join(SCRIPTS_DIR, "validate_architecture_docs.mjs");
|
|
28
|
-
const DATA_VALIDATOR = path.join(SCRIPTS_DIR, "validate_data_docs.mjs");
|
|
29
|
-
const INCREMENTAL = path.join(SCRIPTS_DIR, "validate_incremental_docs.mjs");
|
|
30
|
-
|
|
31
|
-
const ANNOTATED = [
|
|
32
|
-
"common/utils",
|
|
33
|
-
"common/utils/src/main/ets/utils",
|
|
34
|
-
"features/home",
|
|
35
|
-
"features/home/src/main/ets/pages",
|
|
36
|
-
"features/sync",
|
|
37
|
-
"products/app",
|
|
38
|
-
"products/app/src/main/ets/pages",
|
|
39
|
-
].sort();
|
|
40
|
-
const MODULE_DIRS = ["products/app", "features/home", "features/sync", "common/utils"];
|
|
41
|
-
|
|
42
|
-
const EMPTY_DB = "# database_design\n\n## 存储总览\n\n| 数据库 | 用途 |\n|---|---|\n\n## 数据库表\n";
|
|
43
|
-
const EMPTY_PREF = "# Preferences\n\n## Preferences 相关键\n";
|
|
44
|
-
|
|
45
|
-
let PASS = 0;
|
|
46
|
-
let FAIL = 0;
|
|
47
|
-
const FAILURES = [];
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function pyGet(obj, key, dflt = null) {
|
|
51
|
-
return obj !== null && obj !== undefined && Object.hasOwn(obj, key) ? obj[key] : dflt;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
function deepRepr(value) {
|
|
56
|
-
if (typeof value === "string") return pyRepr(value);
|
|
57
|
-
if (value === null || value === undefined) return "None";
|
|
58
|
-
if (value === true) return "True";
|
|
59
|
-
if (value === false) return "False";
|
|
60
|
-
if (typeof value === "bigint") return String(value);
|
|
61
|
-
if (typeof value === "number") return String(value);
|
|
62
|
-
if (value instanceof Set) {
|
|
63
|
-
const items = [...value];
|
|
64
|
-
return items.length === 0 ? "set()" : `{${items.map(deepRepr).join(", ")}}`;
|
|
65
|
-
}
|
|
66
|
-
if (Array.isArray(value)) return `[${value.map(deepRepr).join(", ")}]`;
|
|
67
|
-
if (typeof value === "object") {
|
|
68
|
-
const items = Object.entries(value).map(([k, v]) => `${pyRepr(k)}: ${deepRepr(v)}`);
|
|
69
|
-
return `{${items.join(", ")}}`;
|
|
70
|
-
}
|
|
71
|
-
return String(value);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
function pyStr(value) {
|
|
76
|
-
if (value === null || value === undefined) return "None";
|
|
77
|
-
if (value === true) return "True";
|
|
78
|
-
if (value === false) return "False";
|
|
79
|
-
if (typeof value === "object") return deepRepr(value);
|
|
80
|
-
return String(value);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
function deepEq(a, b) {
|
|
85
|
-
if (a === b) return true;
|
|
86
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
87
|
-
return a.length === b.length && a.every((x, i) => deepEq(x, b[i]));
|
|
88
|
-
}
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
function check(name, ok, detail = "") {
|
|
94
|
-
if (ok) {
|
|
95
|
-
PASS += 1;
|
|
96
|
-
process.stdout.write(` PASS ${name}\n`);
|
|
97
|
-
} else {
|
|
98
|
-
FAIL += 1;
|
|
99
|
-
FAILURES.push(`${name} :: ${detail}`);
|
|
100
|
-
process.stdout.write(` FAIL ${name} ${detail}\n`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
function baseDoc(name) {
|
|
106
|
-
return fs.readFileSync(path.join(TESTDATA, name), "utf8");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
function mutate(text, oldStr, newStr) {
|
|
111
|
-
if (!text.includes(oldStr)) throw new Error(`mutation source not found: ${pyRepr(oldStr)}`);
|
|
112
|
-
return text.replace(oldStr, newStr);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
function runValidator(doc, packaging, conversion, allowExisting, report, projectKind = "application") {
|
|
117
|
-
const cmd = [
|
|
118
|
-
process.execPath, VALIDATOR,
|
|
119
|
-
"--document", doc,
|
|
120
|
-
"--packaging-mode", packaging,
|
|
121
|
-
"--conversion-mode", conversion,
|
|
122
|
-
"--project-kind", projectKind,
|
|
123
|
-
"--report", report,
|
|
124
|
-
];
|
|
125
|
-
if (allowExisting) cmd.push("--allow-existing");
|
|
126
|
-
const proc = runCapture(cmd);
|
|
127
|
-
const data = parseStrictJson(fs.readFileSync(report, "utf8"));
|
|
128
|
-
return [proc.returncode, data];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
function errorCodes(data) {
|
|
133
|
-
return new Set((data.blocking_errors || []).map((e) => e.code ?? ""));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function incErrorCodes(data) {
|
|
138
|
-
return new Set((data.errors || []).map((e) => e.code ?? ""));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
function incWarningCodes(data) {
|
|
143
|
-
return new Set((data.warnings || []).map((w) => w.code ?? ""));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
function testStructural(tmp) {
|
|
148
|
-
process.stdout.write("== validate_architecture_docs.mjs(统一标记语法) ==\n");
|
|
149
|
-
const three = baseDoc("three-layer-PROJECT_DESIGN.md");
|
|
150
|
-
const single = baseDoc("single-entry-PROJECT_DESIGN.md");
|
|
151
|
-
const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md");
|
|
152
|
-
|
|
153
|
-
const doc = (text, name) => {
|
|
154
|
-
const p = path.join(tmp, name);
|
|
155
|
-
fs.writeFileSync(p, text, "utf8");
|
|
156
|
-
return p;
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
let [code, data] = runValidator(doc(three, "t01.md"), "layered", "direct", false, path.join(tmp, "r01.json"));
|
|
160
|
-
check("T01 three-layer generate 正向",
|
|
161
|
-
code === 0 && data.validation_status === "complete",
|
|
162
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
163
|
-
|
|
164
|
-
[code, data] = runValidator(doc(single, "t02.md"), "single-entry", "logical", false, path.join(tmp, "r02.json"));
|
|
165
|
-
check("T02 single-entry generate 正向",
|
|
166
|
-
code === 0 && data.validation_status === "complete",
|
|
167
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
168
|
-
|
|
169
|
-
[code, data] = runValidator(doc(recon, "t03.md"), "layered", "direct", true, path.join(tmp, "r03.json"));
|
|
170
|
-
check("T03 reconcile 正向(--allow-existing)+ existing_annotations 集合",
|
|
171
|
-
code === 0 && data.validation_status === "complete"
|
|
172
|
-
&& deepEq([...data.existing_annotations].sort(), ANNOTATED)
|
|
173
|
-
&& data.allow_existing === true,
|
|
174
|
-
`exit=${code} status=${pyStr(pyGet(data, "validation_status"))} `
|
|
175
|
-
+ `existing=${deepRepr([...pyGet(data, "existing_annotations", [])].sort())} `
|
|
176
|
-
+ `errors=${deepRepr(errorCodes(data))}`);
|
|
177
|
-
|
|
178
|
-
[code, data] = runValidator(doc(recon, "t04.md"), "layered", "direct", false, path.join(tmp, "r04.json"));
|
|
179
|
-
check("T04 reconcile 文档缺 --allow-existing → existing_annotation_not_allowed",
|
|
180
|
-
code === 2 && errorCodes(data).has("existing_annotation_not_allowed"),
|
|
181
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
182
|
-
|
|
183
|
-
let text = mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ # HSP EXISTING");
|
|
184
|
-
[code, data] = runValidator(doc(text, "t05.md"), "layered", "direct", true, path.join(tmp, "r05.json"));
|
|
185
|
-
check("T05 类型在前(# HSP EXISTING)→ tree_annotation 顺序错误",
|
|
186
|
-
code === 2 && errorCodes(data).has("tree_annotation")
|
|
187
|
-
&& (data.blocking_errors || []).some((e) => (e.message ?? "").includes("EXISTING 必须写在包类型之前")),
|
|
188
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
189
|
-
|
|
190
|
-
text = mutate(three, "└── trade/ # HSP", "└── trade/ # FOO");
|
|
191
|
-
[code, data] = runValidator(doc(text, "t06.md"), "layered", "direct", false, path.join(tmp, "r06.json"));
|
|
192
|
-
check("T06 未知 token(# FOO)→ tree_annotation",
|
|
193
|
-
code === 2 && errorCodes(data).has("tree_annotation"),
|
|
194
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
195
|
-
|
|
196
|
-
text = mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ # EXISTING EXISTING");
|
|
197
|
-
[code, data] = runValidator(doc(text, "t07.md"), "layered", "direct", true, path.join(tmp, "r07.json"));
|
|
198
|
-
check("T07 重复 token(# EXISTING EXISTING)→ tree_annotation",
|
|
199
|
-
code === 2 && errorCodes(data).has("tree_annotation"),
|
|
200
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
201
|
-
|
|
202
|
-
text = mutate(three, "└── trade/ # HSP", "└── trade/ <!-- EXISTING_TARGET -->");
|
|
203
|
-
[code, data] = runValidator(doc(text, "t08.md"), "layered", "direct", true, path.join(tmp, "r08.json"));
|
|
204
|
-
check("T08 旧 <!-- EXISTING_TARGET --> → legacy_annotation_form",
|
|
205
|
-
code === 2 && errorCodes(data).has("legacy_annotation_form"),
|
|
206
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
207
|
-
|
|
208
|
-
text = mutate(three, "└── trade/ # HSP", "└── trade/ # HAP # HAP");
|
|
209
|
-
[code, data] = runValidator(doc(text, "t09.md"), "layered", "direct", false, path.join(tmp, "r09.json"));
|
|
210
|
-
check("T09 一行双注释(# HAP # HAP)→ tree_annotation",
|
|
211
|
-
code === 2 && errorCodes(data).has("tree_annotation"),
|
|
212
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
213
|
-
|
|
214
|
-
text = mutate(recon, "├── home/ # EXISTING HAR", "├── home/ # EXISTING");
|
|
215
|
-
[code, data] = runValidator(doc(text, "t10.md"), "layered", "direct", true, path.join(tmp, "r10.json"));
|
|
216
|
-
check("T10 模块根仅 # EXISTING(失去类型)→ module_without_type_marker",
|
|
217
|
-
code === 2 && errorCodes(data).has("module_without_type_marker")
|
|
218
|
-
&& !errorCodes(data).has("existing_annotation_not_allowed"),
|
|
219
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
function testScaffoldParser() {
|
|
224
|
-
process.stdout.write("== module_create/generate.mjs(脚手架解析一致性) ==\n");
|
|
225
|
-
|
|
226
|
-
let [design, modules] = parseDocument(baseDoc("three-layer-PROJECT_DESIGN.md"));
|
|
227
|
-
check("S01 three-layer 模块解析(类型注释原样兼容)",
|
|
228
|
-
deepEq(modules, [["products/app", "HAP"], ["features/home", "HAR"],
|
|
229
|
-
["features/trade", "HSP"], ["common/utils", "HAR"]]),
|
|
230
|
-
deepRepr(modules));
|
|
231
|
-
|
|
232
|
-
[design, modules] = parseDocument(baseDoc("single-entry-PROJECT_DESIGN.md"));
|
|
233
|
-
check("S02 single-entry 模块解析",
|
|
234
|
-
deepEq(modules, [["entry", "HAP"]]),
|
|
235
|
-
deepRepr(modules));
|
|
236
|
-
|
|
237
|
-
[design, modules] = parseDocument(baseDoc("reconcile-layer-PROJECT_DESIGN.md"));
|
|
238
|
-
check("S03 reconcile 解析:EXISTING 前缀被忽略、仅 EXISTING 行非模块根",
|
|
239
|
-
deepEq(modules, [["products/app", "HAP"], ["features/home", "HAR"],
|
|
240
|
-
["features/payment", "HAR"], ["features/sync", "HSP"],
|
|
241
|
-
["common/utils", "HAR"]]),
|
|
242
|
-
deepRepr(modules));
|
|
243
|
-
|
|
244
|
-
let bad = mutate(baseDoc("reconcile-layer-PROJECT_DESIGN.md"),
|
|
245
|
-
"└── sync/ # EXISTING HSP", "└── sync/ # HSP EXISTING");
|
|
246
|
-
try {
|
|
247
|
-
parseDocument(bad);
|
|
248
|
-
check("S04 顺序颠倒(# HSP EXISTING)→ DesignError", false, "no exception raised");
|
|
249
|
-
} catch (exc) {
|
|
250
|
-
if (!(exc instanceof DesignError)) throw exc;
|
|
251
|
-
check("S04 顺序颠倒(# HSP EXISTING)→ DesignError",
|
|
252
|
-
String(exc).includes("EXISTING") || String(exc).includes("非法注释"), String(exc));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
bad = mutate(baseDoc("three-layer-PROJECT_DESIGN.md"),
|
|
256
|
-
"└── trade/ # HSP", "└── trade/ # FOO");
|
|
257
|
-
try {
|
|
258
|
-
parseDocument(bad);
|
|
259
|
-
check("S05 未知 token(# FOO)→ DesignError", false, "no exception raised");
|
|
260
|
-
} catch (exc) {
|
|
261
|
-
if (!(exc instanceof DesignError)) throw exc;
|
|
262
|
-
check("S05 未知 token(# FOO)→ DesignError", String(exc).includes("非法注释"), String(exc));
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
function buildFakeProject(root, docText, { dropDirs = new Set(), staleInspection = false, dropDisposition = false } = {}) {
|
|
268
|
-
const hometrans = path.join(root, ".hometrans");
|
|
269
|
-
const arch = path.join(hometrans, "arch_generate");
|
|
270
|
-
fs.mkdirSync(path.join(arch, "reconcile"), { recursive: true });
|
|
271
|
-
fs.writeFileSync(path.join(hometrans, "project_design.md"), docText, "utf8");
|
|
272
|
-
fs.writeFileSync(path.join(hometrans, "database_design.md"), EMPTY_DB, "utf8");
|
|
273
|
-
fs.writeFileSync(path.join(hometrans, "preferences_design.md"), EMPTY_PREF, "utf8");
|
|
274
|
-
|
|
275
|
-
for (const p of ANNOTATED) {
|
|
276
|
-
if (!dropDirs.has(p)) fs.mkdirSync(path.join(root, p), { recursive: true });
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
let directories = [...new Set([...ANNOTATED,
|
|
280
|
-
"products/app/src/main", "products/app/src/main/ets", "products/app/src/main/resources",
|
|
281
|
-
"features/home/src/main", "features/home/src/main/ets", "features/home/src/main/resources",
|
|
282
|
-
"features/sync/src/main", "features/sync/src/main/ets", "features/sync/src/main/resources",
|
|
283
|
-
"common/utils/src/main", "common/utils/src/main/ets", "common/utils/src/main/resources",
|
|
284
|
-
"entry/src/main/ets/pages",
|
|
285
|
-
])].sort();
|
|
286
|
-
let modules = [
|
|
287
|
-
{ name: "app", directory: "products/app", type: "entry",
|
|
288
|
-
declared_dependencies: ["home", "sync", "utils"], source_roots: ["products/app/src/main/ets"],
|
|
289
|
-
build_file: "products/app/build-profile.json5" },
|
|
290
|
-
{ name: "home", directory: "features/home", type: "har",
|
|
291
|
-
declared_dependencies: ["utils"], source_roots: ["features/home/src/main/ets"],
|
|
292
|
-
build_file: "features/home/build-profile.json5" },
|
|
293
|
-
{ name: "sync", directory: "features/sync", type: "hsp",
|
|
294
|
-
declared_dependencies: ["utils"], source_roots: ["features/sync/src/main/ets"],
|
|
295
|
-
build_file: "features/sync/build-profile.json5" },
|
|
296
|
-
{ name: "utils", directory: "common/utils", type: "har",
|
|
297
|
-
declared_dependencies: [], source_roots: ["common/utils/src/main/ets"],
|
|
298
|
-
build_file: "common/utils/build-profile.json5" },
|
|
299
|
-
];
|
|
300
|
-
if (staleInspection) {
|
|
301
|
-
directories = directories.filter((d) => d !== "features/sync");
|
|
302
|
-
modules = modules.filter((m) => m.directory !== "features/sync");
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
const targetInspection = {
|
|
306
|
-
schema_version: 1,
|
|
307
|
-
target_project_dir: String(root),
|
|
308
|
-
harmony_project: { valid: true, markers: ["build-profile.json5"], app_name: "fakenote",
|
|
309
|
-
api_level: "12", products: ["default"] },
|
|
310
|
-
modules: modules,
|
|
311
|
-
directories: directories,
|
|
312
|
-
storage: { database_present: false, preference_present: false,
|
|
313
|
-
databases: [], preference_stores: [] },
|
|
314
|
-
homegraph: { available: false, mode: "unavailable", index_present: false, reason: "test fixture" },
|
|
315
|
-
warnings: [],
|
|
316
|
-
};
|
|
317
|
-
fs.writeFileSync(path.join(arch, "target_inspection.json"), pyJsonDump(targetInspection), "utf8");
|
|
318
|
-
|
|
319
|
-
const responsibilities = [
|
|
320
|
-
{ id: "r001", source_responsibilities: ["module::app / HomeActivity"],
|
|
321
|
-
source_description: "首页信息流展示", disposition: "reuse-existing",
|
|
322
|
-
target: "products/app/src/main/ets/pages", target_exists: true,
|
|
323
|
-
reason: "现有页面已承载该职责", notes: null },
|
|
324
|
-
{ id: "r002", source_responsibilities: ["module::feature / FeedFragment"],
|
|
325
|
-
source_description: "首页刷新能力", disposition: "adapt-existing",
|
|
326
|
-
target: "features/home/src/main/ets/pages", target_exists: true,
|
|
327
|
-
reason: "现有模块需扩展刷新职责", notes: null },
|
|
328
|
-
{ id: "r003", source_responsibilities: ["module::pay / CheckoutActivity"],
|
|
329
|
-
source_description: "收款与账单查询", disposition: "introduce-planned",
|
|
330
|
-
target: "features/payment/src/main/ets/pages", target_exists: false,
|
|
331
|
-
reason: "现工程无支付承载", notes: null },
|
|
332
|
-
{ id: "r004", source_responsibilities: ["module::core / SyncWorker"],
|
|
333
|
-
source_description: "后台数据同步", disposition: "reuse-existing",
|
|
334
|
-
target: "features/sync/src/main/ets/engine", target_exists: true,
|
|
335
|
-
reason: "现有同步引擎已承载该职责", notes: null },
|
|
336
|
-
];
|
|
337
|
-
if (dropDisposition) delete responsibilities[1].disposition;
|
|
338
|
-
|
|
339
|
-
const existingTargets = ANNOTATED.map((p) => ({
|
|
340
|
-
path: p,
|
|
341
|
-
kind: MODULE_DIRS.includes(p) ? "module" : "directory",
|
|
342
|
-
current_responsibility: "现状职责描述",
|
|
343
|
-
fate: "retained", reason: null, absorbed_into: null,
|
|
344
|
-
}));
|
|
345
|
-
const reconciliation = {
|
|
346
|
-
schema_version: 1,
|
|
347
|
-
generated_by: "a2h-arch-generate",
|
|
348
|
-
inputs: {
|
|
349
|
-
scope_json: path.join(arch, "scope.json"),
|
|
350
|
-
inspection_json: path.join(arch, "inspection.json"),
|
|
351
|
-
target_inspection_json: path.join(arch, "target_inspection.json"),
|
|
352
|
-
},
|
|
353
|
-
responsibilities: responsibilities,
|
|
354
|
-
existing_targets: existingTargets,
|
|
355
|
-
planned_only: [{ path: "features/payment", reason: "现工程无支付承载" }],
|
|
356
|
-
review_required: [],
|
|
357
|
-
warnings: [],
|
|
358
|
-
};
|
|
359
|
-
fs.writeFileSync(path.join(arch, "reconcile", "architecture_reconciliation.json"),
|
|
360
|
-
pyJsonDump(reconciliation), "utf8");
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
function runIncremental(root) {
|
|
365
|
-
const report = path.join(root, ".hometrans", "arch_generate", "incremental_report.json");
|
|
366
|
-
const proc = runCapture([
|
|
367
|
-
process.execPath, INCREMENTAL,
|
|
368
|
-
"--arch-gen-dir", path.join(root, ".hometrans", "arch_generate"),
|
|
369
|
-
"--project-design", path.join(root, ".hometrans", "project_design.md"),
|
|
370
|
-
"--database-doc", path.join(root, ".hometrans", "database_design.md"),
|
|
371
|
-
"--preferences-doc", path.join(root, ".hometrans", "preferences_design.md"),
|
|
372
|
-
"--report", report,
|
|
373
|
-
"--packaging-mode", "layered",
|
|
374
|
-
"--conversion-mode", "direct",
|
|
375
|
-
"--project-kind", "application",
|
|
376
|
-
]);
|
|
377
|
-
const data = parseStrictJson(fs.readFileSync(report, "utf8"));
|
|
378
|
-
return [proc.returncode, data];
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
function testIncremental(tmp) {
|
|
383
|
-
process.stdout.write("== validate_incremental_docs.mjs(EXISTING 语义校验) ==\n");
|
|
384
|
-
const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md");
|
|
385
|
-
|
|
386
|
-
let root = path.join(tmp, "inc01");
|
|
387
|
-
buildFakeProject(root, recon);
|
|
388
|
-
let [code, data] = runIncremental(root);
|
|
389
|
-
check("I01 一致项目通过且标注集合正确",
|
|
390
|
-
code === 0 && data.passed === true
|
|
391
|
-
&& deepEq(data.annotated_paths, ANNOTATED)
|
|
392
|
-
&& deepEq(data.errors, []) && deepEq(data.warnings, []),
|
|
393
|
-
`exit=${code} errors=${deepRepr(incErrorCodes(data))} warnings=${deepRepr(incWarningCodes(data))}`);
|
|
394
|
-
|
|
395
|
-
root = path.join(tmp, "inc02");
|
|
396
|
-
buildFakeProject(root, mutate(recon, "├── payment/ # HAR", "├── payment/ # EXISTING HAR"));
|
|
397
|
-
[code, data] = runIncremental(root);
|
|
398
|
-
let codes = incErrorCodes(data);
|
|
399
|
-
check("I02 planned-only 路径被标注 → planned_only_annotated + annotation_missing_in_reconcile",
|
|
400
|
-
code === 1 && ["planned_only_annotated", "annotation_missing_in_reconcile"].every((c) => codes.has(c)),
|
|
401
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
402
|
-
|
|
403
|
-
root = path.join(tmp, "inc03");
|
|
404
|
-
buildFakeProject(root, recon, { dropDirs: new Set(["common/utils/src/main/ets/utils"]) });
|
|
405
|
-
[code, data] = runIncremental(root);
|
|
406
|
-
codes = incErrorCodes(data);
|
|
407
|
-
check("I03 标注路径不在磁盘 → annotation_path_missing",
|
|
408
|
-
code === 1 && codes.has("annotation_path_missing"),
|
|
409
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
410
|
-
|
|
411
|
-
root = path.join(tmp, "inc04");
|
|
412
|
-
buildFakeProject(root, recon, { staleInspection: true });
|
|
413
|
-
[code, data] = runIncremental(root);
|
|
414
|
-
check("I04 inspection 过期(磁盘有但未记录)→ warning annotation_not_in_inspection",
|
|
415
|
-
code === 0 && data.passed === true
|
|
416
|
-
&& incWarningCodes(data).has("annotation_not_in_inspection"),
|
|
417
|
-
`exit=${code} errors=${deepRepr(incErrorCodes(data))} warnings=${deepRepr(incWarningCodes(data))}`);
|
|
418
|
-
|
|
419
|
-
root = path.join(tmp, "inc05");
|
|
420
|
-
buildFakeProject(root, recon, { dropDisposition: true });
|
|
421
|
-
[code, data] = runIncremental(root);
|
|
422
|
-
codes = incErrorCodes(data);
|
|
423
|
-
check("I05 责任缺 disposition → missing_disposition",
|
|
424
|
-
code === 1 && codes.has("missing_disposition"),
|
|
425
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
426
|
-
|
|
427
|
-
root = path.join(tmp, "inc06");
|
|
428
|
-
buildFakeProject(root, mutate(recon, "└── sync/ # EXISTING HSP", "└── sync/ <!-- EXISTING_TARGET -->"));
|
|
429
|
-
[code, data] = runIncremental(root);
|
|
430
|
-
codes = incErrorCodes(data);
|
|
431
|
-
check("I06 旧 <!-- --> 形式 → legacy_annotation_form(含结构委托)",
|
|
432
|
-
code === 1 && (codes.has("legacy_annotation_form") || codes.has("structural_legacy_annotation_form")),
|
|
433
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
function makeSyntheticInspection(dbPresent, prefPresent) {
|
|
438
|
-
const inspection = {
|
|
439
|
-
storage_presence: { database: dbPresent, preferences: prefPresent },
|
|
440
|
-
database_schemas: [],
|
|
441
|
-
preference_stores: [],
|
|
442
|
-
};
|
|
443
|
-
if (dbPresent) {
|
|
444
|
-
inspection.database_schemas = [{
|
|
445
|
-
name: "app.db",
|
|
446
|
-
source_kind: "room_source_entities",
|
|
447
|
-
confidence: "authoritative",
|
|
448
|
-
tables: [{
|
|
449
|
-
name: "notes",
|
|
450
|
-
columns: [
|
|
451
|
-
{ field: "id", type: "Long", key: "PK", constraints: [] },
|
|
452
|
-
{ field: "title", type: "String", key: "", constraints: ["NOT NULL"] },
|
|
453
|
-
],
|
|
454
|
-
}],
|
|
455
|
-
}];
|
|
456
|
-
}
|
|
457
|
-
if (prefPresent) {
|
|
458
|
-
inspection.preference_stores = [{
|
|
459
|
-
name: "settings",
|
|
460
|
-
confidence: "authoritative",
|
|
461
|
-
keys: [
|
|
462
|
-
{ key: "seen", type: "Boolean", default: null },
|
|
463
|
-
{ key: "theme", type: "String", default: "light" },
|
|
464
|
-
],
|
|
465
|
-
}];
|
|
466
|
-
}
|
|
467
|
-
return inspection;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const POPULATED_DB_DOC = `# database_design
|
|
472
|
-
|
|
473
|
-
## 存储总览
|
|
474
|
-
|
|
475
|
-
| 数据库 | 用途 |
|
|
476
|
-
|---|---|
|
|
477
|
-
| app.db | 规划数据库 |
|
|
478
|
-
|
|
479
|
-
## 数据库表
|
|
480
|
-
|
|
481
|
-
### \`app.db\`
|
|
482
|
-
|
|
483
|
-
#### \`notes\`
|
|
484
|
-
|
|
485
|
-
| 字段 | 类型 | 键 | 约束 |
|
|
486
|
-
|---|---|---|---|
|
|
487
|
-
| id | INTEGER | PK | |
|
|
488
|
-
| title | TEXT | | NOT NULL |
|
|
489
|
-
`;
|
|
490
|
-
|
|
491
|
-
const POPULATED_PREF_DOC = `# Preferences
|
|
492
|
-
|
|
493
|
-
## Preferences 相关键
|
|
494
|
-
|
|
495
|
-
### \`settings\`
|
|
496
|
-
|
|
497
|
-
| 键 | 类型 | 默认值 |
|
|
498
|
-
|---|---|---|
|
|
499
|
-
| seen | Boolean | |
|
|
500
|
-
| theme | String | light |
|
|
501
|
-
`;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
function runDataValidator(archDir, dbDoc, prefDoc, report) {
|
|
505
|
-
const proc = runCapture([
|
|
506
|
-
process.execPath, DATA_VALIDATOR,
|
|
507
|
-
"--inspection", path.join(archDir, "inspection.json"),
|
|
508
|
-
"--database-doc", dbDoc,
|
|
509
|
-
"--preferences-doc", prefDoc,
|
|
510
|
-
"--report", report,
|
|
511
|
-
]);
|
|
512
|
-
const data = parseStrictJson(fs.readFileSync(report, "utf8"));
|
|
513
|
-
return [proc.returncode, data];
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
function testDataDocConstraints(tmp) {
|
|
518
|
-
process.stdout.write("== validate_data_docs 约束(类型亲和 / null 默认值 / 超集语义) ==\n");
|
|
519
|
-
|
|
520
|
-
const writeArch = (name, inspection, withReconcile) => {
|
|
521
|
-
const arch = path.join(tmp, name);
|
|
522
|
-
fs.mkdirSync(arch, { recursive: true });
|
|
523
|
-
fs.writeFileSync(path.join(arch, "inspection.json"), pyJsonDump(inspection, { indent: null }), "utf8");
|
|
524
|
-
if (withReconcile) {
|
|
525
|
-
fs.mkdirSync(path.join(arch, "reconcile"), { recursive: true });
|
|
526
|
-
fs.writeFileSync(path.join(arch, "reconcile", "architecture_reconciliation.json"), "{}", "utf8");
|
|
527
|
-
}
|
|
528
|
-
return arch;
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
const dbDoc = path.join(tmp, "db_affinity.md");
|
|
532
|
-
fs.writeFileSync(dbDoc, POPULATED_DB_DOC, "utf8");
|
|
533
|
-
const prefDoc = path.join(tmp, "pref_null_default.md");
|
|
534
|
-
fs.writeFileSync(prefDoc, POPULATED_PREF_DOC, "utf8");
|
|
535
|
-
|
|
536
|
-
let arch = writeArch("arch_t11", makeSyntheticInspection(true, true), false);
|
|
537
|
-
let [code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t11.json"));
|
|
538
|
-
let codes = errorCodes(data);
|
|
539
|
-
check("T11 类型亲和:Kotlin Long/String 对 INTEGER/TEXT 通过 + null 默认值跳过",
|
|
540
|
-
code === 0 && !["database_type_mismatch", "preference_type_mismatch", "preference_default_mismatch"].some((c) => codes.has(c)),
|
|
541
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
542
|
-
|
|
543
|
-
const badDb = path.join(tmp, "db_mismatch.md");
|
|
544
|
-
fs.writeFileSync(badDb, POPULATED_DB_DOC.replaceAll("| title | TEXT |", "| title | INTEGER |"), "utf8");
|
|
545
|
-
[code, data] = runDataValidator(arch, badDb, prefDoc, path.join(tmp, "r_t11b.json"));
|
|
546
|
-
codes = errorCodes(data);
|
|
547
|
-
check("T11 类型亲和失败:TEXT 对 INTEGER 仍报 mismatch",
|
|
548
|
-
code === 2 && codes.has("database_type_mismatch"),
|
|
549
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
550
|
-
|
|
551
|
-
const emptyDb = path.join(tmp, "db_empty.md");
|
|
552
|
-
fs.writeFileSync(emptyDb, "# database_design\n\n## 存储总览\n\n| 数据库 | 用途 |\n|---|---|\n\n## 数据库表\n", "utf8");
|
|
553
|
-
const emptyPref = path.join(tmp, "pref_empty.md");
|
|
554
|
-
fs.writeFileSync(emptyPref, "# Preferences\n\n## Preferences 相关键\n", "utf8");
|
|
555
|
-
|
|
556
|
-
arch = writeArch("arch_t13a", makeSyntheticInspection(false, false), true);
|
|
557
|
-
[code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t13a.json"));
|
|
558
|
-
const warningCodes = new Set((data.warnings || []).map((w) => w.code ?? ""));
|
|
559
|
-
check("T13a 超集:源无存储 + reconcile 目录 → 内容放行(仅提示性警告)",
|
|
560
|
-
code === 0 && warningCodes.size === 1 && warningCodes.has("content_beyond_source_storage")
|
|
561
|
-
&& data.reconcile_mode === true,
|
|
562
|
-
`exit=${code} warnings=${deepRepr(warningCodes)}`);
|
|
563
|
-
|
|
564
|
-
arch = writeArch("arch_t13b", makeSyntheticInspection(false, false), false);
|
|
565
|
-
[code, data] = runDataValidator(arch, dbDoc, prefDoc, path.join(tmp, "r_t13b.json"));
|
|
566
|
-
codes = errorCodes(data);
|
|
567
|
-
check("T13b 无 reconcile 目录 → invented_* 阻断错误(generate 严格性不变)",
|
|
568
|
-
code === 2 && ["invented_database_content", "invented_preferences_content"].every((c) => codes.has(c))
|
|
569
|
-
&& data.reconcile_mode === false,
|
|
570
|
-
`exit=${code} errors=${deepRepr(codes)}`);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
function testTreeEdgeCases(tmp) {
|
|
575
|
-
process.stdout.write("== 树边缘约束(测试目录豁免 / 数字开头目录段) ==\n");
|
|
576
|
-
|
|
577
|
-
const doc = (text, name) => {
|
|
578
|
-
const p = path.join(tmp, name);
|
|
579
|
-
fs.writeFileSync(p, text, "utf8");
|
|
580
|
-
return p;
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
const t14 = `## 项目结构
|
|
584
|
-
|
|
585
|
-
\`\`\`text
|
|
586
|
-
entry/ # HAP
|
|
587
|
-
└── src/
|
|
588
|
-
├── main/
|
|
589
|
-
│ ├── ets/
|
|
590
|
-
│ │ └── pages/
|
|
591
|
-
│ └── resources/
|
|
592
|
-
├── ohosTest/
|
|
593
|
-
├── test/
|
|
594
|
-
└── mock/
|
|
595
|
-
\`\`\`
|
|
596
|
-
|
|
597
|
-
## 模块语义
|
|
598
|
-
|
|
599
|
-
| 模块路径 | 模块功能 |
|
|
600
|
-
|---|---|
|
|
601
|
-
| entry/src/main/ets/pages | 应用唯一入口的页面装配,承载启动流程与首页展示。 |
|
|
602
|
-
`;
|
|
603
|
-
let [code, data] = runValidator(doc(t14, "t14.md"), "single-entry", "logical", false, path.join(tmp, "r_t14.json"));
|
|
604
|
-
check("T14 结构目录(src/ohosTest、src/test、src/mock)豁免叶子语义行",
|
|
605
|
-
code === 0 && data.validation_status === "complete",
|
|
606
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
607
|
-
|
|
608
|
-
const t15 = `## 项目结构
|
|
609
|
-
|
|
610
|
-
\`\`\`text
|
|
611
|
-
360safe/ # HAP
|
|
612
|
-
└── src/
|
|
613
|
-
└── main/
|
|
614
|
-
└── ets/
|
|
615
|
-
└── pages/
|
|
616
|
-
\`\`\`
|
|
617
|
-
|
|
618
|
-
## 模块语义
|
|
619
|
-
|
|
620
|
-
| 模块路径 | 模块功能 |
|
|
621
|
-
|---|---|
|
|
622
|
-
| 360safe/src/main/ets/pages | 库入口页面装配,承载核心能力展示。 |
|
|
623
|
-
`;
|
|
624
|
-
[code, data] = runValidator(doc(t15, "t15.md"), "single-entry", "direct", false, path.join(tmp, "r_t15.json"), "library");
|
|
625
|
-
check("T15 数字开头目录段(360safe/)合法",
|
|
626
|
-
code === 0 && data.validation_status === "complete",
|
|
627
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const CREATE_PROJECT = path.join(SCRIPTS_DIR, "create_project.mjs");
|
|
632
|
-
|
|
633
|
-
const DEVECOCLI_STUB = `#!/bin/bash
|
|
634
|
-
# 测试桩:记录收到的参数,并创建最小工程以便 clear_modules 后处理。
|
|
635
|
-
echo "$@" > "$STUB_LOG"
|
|
636
|
-
path=""
|
|
637
|
-
prev=""
|
|
638
|
-
for arg in "$@"; do
|
|
639
|
-
if [ "$prev" = "--project-path" ]; then path="$arg"; fi
|
|
640
|
-
prev="$arg"
|
|
641
|
-
done
|
|
642
|
-
mkdir -p "$path"
|
|
643
|
-
printf '{\\n "modules": [\\n { "name": "entry", "srcPath": "./entry" }\\n ]\\n}\\n' > "$path/build-profile.json5"
|
|
644
|
-
exit 0
|
|
645
|
-
`;
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
function runCreateProject(binDir, log, ...extra) {
|
|
649
|
-
const stub = path.join(binDir, "devecocli");
|
|
650
|
-
fs.writeFileSync(stub, DEVECOCLI_STUB, "utf8");
|
|
651
|
-
fs.chmodSync(stub, 0o755);
|
|
652
|
-
const env = { ...process.env, STUB_LOG: log };
|
|
653
|
-
const proc = spawnSync(process.execPath, [CREATE_PROJECT, ...extra, "--devecocli-bin", stub],
|
|
654
|
-
{ encoding: "utf8", env });
|
|
655
|
-
const argv = isFile(log) ? fs.readFileSync(log, "utf8").split(/\s+/).filter((s) => s !== "") : [];
|
|
656
|
-
return [proc.status, argv, proc.stderr ?? ""];
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
function testCreateProjectAppName(tmp) {
|
|
661
|
-
process.stdout.write("== create_project.mjs 建壳链路(devecocli/json5 桩) ==\n");
|
|
662
|
-
|
|
663
|
-
const binDir = path.join(tmp, "stubbin");
|
|
664
|
-
fs.mkdirSync(binDir, { recursive: true });
|
|
665
|
-
|
|
666
|
-
const proj1 = path.join(tmp, "proj1");
|
|
667
|
-
const [code, argv, err] = runCreateProject(binDir, path.join(tmp, "log1.txt"), "--output-root", proj1);
|
|
668
|
-
const derivedOk = (
|
|
669
|
-
code === 0
|
|
670
|
-
&& argv[argv.indexOf("--app-name") + 1] === "proj1"
|
|
671
|
-
&& argv[argv.indexOf("--project-path") + 1] === resolveLikePython(proj1)
|
|
672
|
-
&& deepEq(parseStrictJson(fs.readFileSync(path.join(proj1, "build-profile.json5"), "utf8")).modules, [])
|
|
673
|
-
);
|
|
674
|
-
check("C01 缺省:目录名推导的应用名传入 devecocli,且 modules 被清空",
|
|
675
|
-
derivedOk, `exit=${code} argv=${deepRepr(argv)} err=${err.slice(-150)}`);
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
// Regression tests for the PR #43 review fixes.
|
|
680
|
-
function testReviewFixes(tmp) {
|
|
681
|
-
process.stdout.write("== 审视修复回归(globPattern / strip / pyOr / 根目录 / TOML 单引号) ==\n");
|
|
682
|
-
|
|
683
|
-
// 1. globPattern: multi-level patterns (was single-level only)
|
|
684
|
-
{
|
|
685
|
-
const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
|
|
686
|
-
const start = src.indexOf("function segmentMatcher");
|
|
687
|
-
const end = src.indexOf("export function readText");
|
|
688
|
-
const pathExists = (p) => { try { fs.statSync(p); return true; } catch { return false; } };
|
|
689
|
-
const mod = new Function("fs", "path", "pathExists", src.slice(start, end) + "; return { globPattern };")(
|
|
690
|
-
fs, path, pathExists);
|
|
691
|
-
const root = fs.mkdtempSync(path.join(tmp, "glob-"));
|
|
692
|
-
fs.mkdirSync(path.join(root, "src", "main", "java"), { recursive: true });
|
|
693
|
-
fs.writeFileSync(path.join(root, "src", "A.java"), "x");
|
|
694
|
-
fs.writeFileSync(path.join(root, "src", "main", "java", "B.java"), "x");
|
|
695
|
-
const single = mod.globPattern(root, "src/*.java").map((p) => path.relative(root, p));
|
|
696
|
-
const deep = mod.globPattern(root, "src/**/*.java").map((p) => path.relative(root, p));
|
|
697
|
-
check("R01 globPattern src/*.java 匹配一层",
|
|
698
|
-
single.length === 1 && single[0] === "src/A.java", JSON.stringify(single));
|
|
699
|
-
check("R02 globPattern src/**/*.java 匹配多层",
|
|
700
|
-
deep.length === 2, JSON.stringify(deep));
|
|
701
|
-
fs.rmSync(root, { recursive: true, force: true });
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
// 2. strip(",") semantics — DECIMAL(10,2) not corrupted
|
|
705
|
-
{
|
|
706
|
-
const stripped = "DECIMAL(10,2)".replace(/^[,]+|[,]+$/g, "");
|
|
707
|
-
check("R03 strip(\",\") 仅去首尾(DECIMAL(10,2) 不变)",
|
|
708
|
-
stripped === "DECIMAL(10,2)", stripped);
|
|
709
|
-
const stripped2 = ",INTEGER,".replace(/^[,]+|[,]+$/g, "");
|
|
710
|
-
check("R04 strip(\",\") 去首尾逗号",
|
|
711
|
-
stripped2 === "INTEGER", stripped2);
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
// 3. ?? -> or: empty array falls through
|
|
715
|
-
{
|
|
716
|
-
const pyOr = (...values) => {
|
|
717
|
-
for (const value of values) {
|
|
718
|
-
if (value === null || value === undefined) continue;
|
|
719
|
-
if (Array.isArray(value) && value.length === 0) continue;
|
|
720
|
-
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) continue;
|
|
721
|
-
if (typeof value === "string" && value === "") continue;
|
|
722
|
-
if (typeof value === "number" && value === 0) continue;
|
|
723
|
-
if (value === false) continue;
|
|
724
|
-
return value;
|
|
725
|
-
}
|
|
726
|
-
return undefined;
|
|
727
|
-
};
|
|
728
|
-
check("R05 pyOr 空数组回退到下一项",
|
|
729
|
-
JSON.stringify(pyOr([], ["a"])) === JSON.stringify(["a"]));
|
|
730
|
-
check("R06 pyOr 非空数组不回退",
|
|
731
|
-
JSON.stringify(pyOr(["x"], ["a"])) === JSON.stringify(["x"]));
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
// 4. relOrAbs: root module → "."
|
|
735
|
-
{
|
|
736
|
-
const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
|
|
737
|
-
const start = src.indexOf("function relOrAbs");
|
|
738
|
-
const end = src.indexOf("// ------", start);
|
|
739
|
-
const mod = new Function("path", "resolveLikePython",
|
|
740
|
-
src.slice(start, end).replace("function relOrAbs", "function relOrAbs") + "; return { relOrAbs };")(
|
|
741
|
-
path, (p) => path.resolve(p));
|
|
742
|
-
check("R07 relOrAbs 根目录模块输出 \".\"",
|
|
743
|
-
mod.relOrAbs("/tmp/proj", "/tmp/proj") === ".", mod.relOrAbs("/tmp/proj", "/tmp/proj"));
|
|
744
|
-
check("R08 relOrAbs 子模块输出相对路径",
|
|
745
|
-
mod.relOrAbs("/tmp/proj/entry", "/tmp/proj") === "entry", mod.relOrAbs("/tmp/proj/entry", "/tmp/proj"));
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
// 5. TOML single-quoted literal strings
|
|
749
|
-
{
|
|
750
|
-
const src = fs.readFileSync(path.join(SCRIPTS_DIR, "inspect_android_project.mjs"), "utf8");
|
|
751
|
-
const start = src.indexOf("function parseTomlSubset");
|
|
752
|
-
const end = src.indexOf("function findTomlComment");
|
|
753
|
-
const pyStrip = (x) => x.trim();
|
|
754
|
-
const findTomlComment = (v) => { let inS = false; for (let i = 0; i < v.length; i++) { if (v[i] === '"') inS = !inS; if (v[i] === "#" && !inS) return i; } return -1; };
|
|
755
|
-
const splitTomlInline = (v) => { const parts = []; let cur = ""; let inS = false; for (const ch of v) { if (ch === '"') inS = !inS; if (ch === "," && !inS) { parts.push(cur); cur = ""; continue; } cur += ch; } if (pyStrip(cur) !== "") parts.push(cur); return parts; };
|
|
756
|
-
const mod = new Function("fs", "pyStrip", "findTomlComment", "splitTomlInline",
|
|
757
|
-
src.slice(start, end) + "; return { parseTomlSubset };")(fs, pyStrip, findTomlComment, splitTomlInline);
|
|
758
|
-
const data = mod.parseTomlSubset("\n[plugins]\nkotlin = 'org.jetbrains.kotlin.android'\n");
|
|
759
|
-
check("R09 TOML 单引号字面字符串解析",
|
|
760
|
-
data.plugins?.kotlin === "org.jetbrains.kotlin.android", JSON.stringify(data));
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
// 多 application 的 Gradle 工程:两个 app 都依赖 :lib。
|
|
765
|
-
function buildMultiAppRepo(root) {
|
|
766
|
-
const write = (rel, text) => {
|
|
767
|
-
const p = path.join(root, rel);
|
|
768
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
769
|
-
fs.writeFileSync(p, text, "utf8");
|
|
770
|
-
};
|
|
771
|
-
write("settings.gradle", "include ':a', ':b', ':lib'\n");
|
|
772
|
-
write("build.gradle", "\n");
|
|
773
|
-
for (const m of ["a", "b"]) {
|
|
774
|
-
write(`${m}/build.gradle`, "plugins { id 'com.android.application' }\ndependencies { implementation project(':lib') }\n");
|
|
775
|
-
write(`${m}/src/main/AndroidManifest.xml`, `<manifest package="x.${m}"><application/></manifest>\n`);
|
|
776
|
-
}
|
|
777
|
-
write("lib/build.gradle", "plugins { id 'com.android.library' }\n");
|
|
778
|
-
write("lib/src/main/AndroidManifest.xml", "<manifest package=\"x.lib\"/>\n");
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
function testExistingProjectFixes(tmp) {
|
|
783
|
-
process.stdout.write("== 既有工程兼容(--app-module / 既有拓扑 / 纯资源模块 / 表格转义) ==\n");
|
|
784
|
-
const INSPECT = path.join(SCRIPTS_DIR, "inspect_project.mjs");
|
|
785
|
-
const repo = path.join(tmp, "multi_app");
|
|
786
|
-
buildMultiAppRepo(repo);
|
|
787
|
-
|
|
788
|
-
let proc = runCapture([process.execPath, INSPECT, repo, "--target-project-dir", path.join(tmp, "ma_auto")]);
|
|
789
|
-
check("A01 多 application 未指定 → 报歧义并提示 --app-module",
|
|
790
|
-
proc.returncode !== 0 && proc.stderr.includes("--app-module"),
|
|
791
|
-
`exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
|
|
792
|
-
|
|
793
|
-
const target = path.join(tmp, "ma_a");
|
|
794
|
-
proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":a", "--target-project-dir", target]);
|
|
795
|
-
let scope = {};
|
|
796
|
-
if (proc.returncode === 0) {
|
|
797
|
-
scope = parseStrictJson(fs.readFileSync(path.join(target, ".hometrans", "arch_generate", "scope.json"), "utf8"));
|
|
798
|
-
}
|
|
799
|
-
check("A02 --app-module :a 透传 → 只选 :a 及其依赖闭包",
|
|
800
|
-
proc.returncode === 0 && deepEq(scope.selected_modules, [":a", ":lib"])
|
|
801
|
-
&& scope.requested_app_module === ":a",
|
|
802
|
-
`exit=${proc.returncode} selected=${deepRepr(scope.selected_modules)} stderr=${proc.stderr.slice(0, 200)}`);
|
|
803
|
-
|
|
804
|
-
proc = runCapture([process.execPath, INSPECT, repo, "--app-module", "b", "--target-project-dir", path.join(tmp, "ma_b")]);
|
|
805
|
-
check("A03 --app-module 接受不带冒号的别名 b",
|
|
806
|
-
proc.returncode === 0, `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
|
|
807
|
-
|
|
808
|
-
proc = runCapture([process.execPath, INSPECT, repo, "--app-module", "nope", "--target-project-dir", path.join(tmp, "ma_x")]);
|
|
809
|
-
check("A04 --app-module 指向不存在的模块 → 明确报错",
|
|
810
|
-
proc.returncode !== 0 && proc.stderr.includes("Requested module was not found: nope"),
|
|
811
|
-
`exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
|
|
812
|
-
|
|
813
|
-
const libTarget = path.join(tmp, "ma_lib");
|
|
814
|
-
proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":lib", "--target-project-dir", libTarget]);
|
|
815
|
-
scope = proc.returncode === 0
|
|
816
|
-
? parseStrictJson(fs.readFileSync(path.join(libTarget, ".hometrans", "arch_generate", "scope.json"), "utf8"))
|
|
817
|
-
: {};
|
|
818
|
-
check("A05 --app-module 指向 library → 按 library 工程只选该模块",
|
|
819
|
-
proc.returncode === 0 && scope.project_kind === "library" && deepEq(scope.selected_modules, [":lib"]),
|
|
820
|
-
`exit=${proc.returncode} kind=${pyStr(scope.project_kind)} selected=${deepRepr(scope.selected_modules)}`);
|
|
821
|
-
|
|
822
|
-
// 既有工程:顶层是 feature/ 而非 features/,且有一个纯资源 HAR。
|
|
823
|
-
const recon = baseDoc("reconcile-layer-PROJECT_DESIGN.md").replace(/\r\n/g, "\n");
|
|
824
|
-
const renamed = recon
|
|
825
|
-
.replace("features/\n", "feature/\n")
|
|
826
|
-
.replaceAll("| features/", "| feature/");
|
|
827
|
-
const doc = (text, name) => {
|
|
828
|
-
const p = path.join(tmp, name);
|
|
829
|
-
fs.writeFileSync(p, text, "utf8");
|
|
830
|
-
return p;
|
|
831
|
-
};
|
|
832
|
-
let [code, data] = runValidator(doc(renamed, "e01.md"), "layered", "direct", true, path.join(tmp, "re01.json"));
|
|
833
|
-
check("E01 reconcile 既有分组名 feature/ → 不再要求 features/",
|
|
834
|
-
code === 0 && !errorCodes(data).has("layered_layout_missing_root"),
|
|
835
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
836
|
-
|
|
837
|
-
[code, data] = runValidator(doc(renamed, "e02.md"), "layered", "direct", false, path.join(tmp, "re02.json"));
|
|
838
|
-
check("E02 generate 仍强制 products/features/common 字面根名",
|
|
839
|
-
code === 2 && errorCodes(data).has("layered_layout_missing_root"),
|
|
840
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
841
|
-
|
|
842
|
-
const noHap = mutate(recon, "└── app/ # EXISTING HAP", "└── app/ # EXISTING HAR");
|
|
843
|
-
[code, data] = runValidator(doc(noHap, "e03.md"), "layered", "direct", true, path.join(tmp, "re03.json"));
|
|
844
|
-
check("E03 reconcile application 无任何 HAP → existing_layout_missing_hap",
|
|
845
|
-
code === 2 && errorCodes(data).has("existing_layout_missing_hap"),
|
|
846
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
847
|
-
|
|
848
|
-
const resourceOnly = mutate(recon,
|
|
849
|
-
"common/\n└── utils/ # EXISTING HAR\n",
|
|
850
|
-
"common/\n├── res/ # EXISTING HAR\n│ └── src/\n│ └── main/\n│ └── resources/\n└── utils/ # EXISTING HAR\n");
|
|
851
|
-
[code, data] = runValidator(doc(resourceOnly, "e04.md"), "layered", "direct", true, path.join(tmp, "re04.json"));
|
|
852
|
-
const warnCodes = new Set((data.warnings || []).map((w) => w.code ?? ""));
|
|
853
|
-
check("E04 reconcile 既有纯资源 HAR(无 ets、有 resources)→ 警告放行",
|
|
854
|
-
code === 0 && !errorCodes(data).has("module_marker_without_src_main_ets")
|
|
855
|
-
&& warnCodes.has("existing_resource_only_module"),
|
|
856
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))} warnings=${deepRepr(warnCodes)}`);
|
|
857
|
-
|
|
858
|
-
const plannedResource = mutate(resourceOnly, "├── res/ # EXISTING HAR", "├── res/ # HAR");
|
|
859
|
-
[code, data] = runValidator(doc(plannedResource, "e05.md"), "layered", "direct", true, path.join(tmp, "re05.json"));
|
|
860
|
-
check("E05 新规划模块缺 ets 仍报 module_marker_without_src_main_ets",
|
|
861
|
-
code === 2 && errorCodes(data).has("module_marker_without_src_main_ets"),
|
|
862
|
-
`exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
863
|
-
|
|
864
|
-
// 偏好默认值含 `|` 与 `\`:渲染后 validator 必须能逐格还原。
|
|
865
|
-
const arch = path.join(tmp, "pipe_arch");
|
|
866
|
-
fs.mkdirSync(arch, { recursive: true });
|
|
867
|
-
const inspection = makeSyntheticInspection(false, true);
|
|
868
|
-
inspection.preference_stores[0].keys.push(
|
|
869
|
-
{ key: "ai_tabs", type: "String", default: "translation|transcribe" },
|
|
870
|
-
{ key: "sep", type: "String", default: "a\\b" },
|
|
871
|
-
);
|
|
872
|
-
fs.writeFileSync(path.join(arch, "inspection.json"), pyJsonDump(inspection, { indent: null }), "utf8");
|
|
873
|
-
fs.writeFileSync(path.join(arch, "scope.json"), pyJsonDump({ source_kind: "android" }, { indent: null }), "utf8");
|
|
874
|
-
const out = path.join(tmp, "pipe_out");
|
|
875
|
-
proc = runCapture([
|
|
876
|
-
process.execPath, path.join(SCRIPTS_DIR, "generate_source_baseline.mjs"),
|
|
877
|
-
"--scope", path.join(arch, "scope.json"),
|
|
878
|
-
"--inspection", path.join(arch, "inspection.json"),
|
|
879
|
-
"--output-dir", out,
|
|
880
|
-
]);
|
|
881
|
-
const prefText = proc.returncode === 0 ? fs.readFileSync(path.join(out, "preferences_design.md"), "utf8") : "";
|
|
882
|
-
check("P01 默认值中的 | 和 \\ 渲染时转义",
|
|
883
|
-
prefText.includes("| ai_tabs | String | translation\\|transcribe |")
|
|
884
|
-
&& prefText.includes("| sep | String | a\\\\b |"),
|
|
885
|
-
`exit=${proc.returncode} stderr=${proc.stderr.slice(0, 200)}`);
|
|
886
|
-
if (proc.returncode === 0) {
|
|
887
|
-
[code, data] = runDataValidator(arch, path.join(out, "database_design.md"), path.join(out, "preferences_design.md"), path.join(tmp, "rp01.json"));
|
|
888
|
-
check("P02 转义后的表格通过 data validator(无 invalid_table_row / 默认值不一致)",
|
|
889
|
-
code === 0, `exit=${code} errors=${deepRepr(errorCodes(data))}`);
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
function writeTree(root, files) {
|
|
895
|
-
for (const [rel, text] of Object.entries(files)) {
|
|
896
|
-
const p = path.join(root, rel);
|
|
897
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
898
|
-
fs.writeFileSync(p, text, "utf8");
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
function testStorageExtraction(tmp) {
|
|
904
|
-
process.stdout.write("== 存储提取(DB 名 / 注释 / 偏好接收器 / sourceSets / 鸿蒙归属) ==\n");
|
|
905
|
-
const INSPECT = path.join(SCRIPTS_DIR, "inspect_project.mjs");
|
|
906
|
-
const repo = path.join(tmp, "legacy_repo");
|
|
907
|
-
writeTree(repo, {
|
|
908
|
-
"settings.gradle": "include ':app', ':lib'\n",
|
|
909
|
-
"build.gradle": "\n",
|
|
910
|
-
"app/build.gradle": "plugins { id 'com.android.application' }\ndependencies { implementation project(':lib') }\n",
|
|
911
|
-
"app/src/main/AndroidManifest.xml": "<manifest package=\"x.app\"><application/></manifest>\n",
|
|
912
|
-
"lib/build.gradle": [
|
|
913
|
-
"plugins { id 'com.android.library' }",
|
|
914
|
-
"android {",
|
|
915
|
-
" sourceSets {",
|
|
916
|
-
" main {",
|
|
917
|
-
" manifest.srcFile 'AndroidManifest.xml'",
|
|
918
|
-
" java.srcDirs = ['src']",
|
|
919
|
-
" res.srcDirs = ['res']",
|
|
920
|
-
" }",
|
|
921
|
-
" }",
|
|
922
|
-
"}",
|
|
923
|
-
"",
|
|
924
|
-
].join("\n"),
|
|
925
|
-
"lib/AndroidManifest.xml": "<manifest package=\"x.lib\"/>\n",
|
|
926
|
-
"lib/res/values/strings.xml": "<resources/>\n",
|
|
927
|
-
"lib/src/com/x/db/ReaderDbHelper.java": [
|
|
928
|
-
"package com.x.db;",
|
|
929
|
-
"public class ReaderDbHelper extends SQLiteOpenHelper {",
|
|
930
|
-
" private static final String DB_NAME = \"ReaderReader.db\";",
|
|
931
|
-
" private static final int DB_VERSION = 6;",
|
|
932
|
-
" public ReaderDbHelper(Context ctx) { super(ctx, DB_NAME, null, DB_VERSION); }",
|
|
933
|
-
" public void onCreate(SQLiteDatabase db) {",
|
|
934
|
-
" db.execSQL(HighLightTable.CREATE_SQL);",
|
|
935
|
-
" // db.execSQL(\"CREATE TABLE old_table (id INTEGER)\");",
|
|
936
|
-
" }",
|
|
937
|
-
"}",
|
|
938
|
-
"",
|
|
939
|
-
].join("\n"),
|
|
940
|
-
"lib/src/com/x/db/HighLightTable.java": [
|
|
941
|
-
"package com.x.db;",
|
|
942
|
-
"public class HighLightTable {",
|
|
943
|
-
" public static final String CREATE_SQL = \"CREATE TABLE highlight (id INTEGER PRIMARY KEY, text TEXT)\";",
|
|
944
|
-
" /* CREATE TABLE ghost (a TEXT) */",
|
|
945
|
-
"}",
|
|
946
|
-
"",
|
|
947
|
-
].join("\n"),
|
|
948
|
-
"lib/src/com/x/db/PassDbHelper.java": [
|
|
949
|
-
"package com.x.db;",
|
|
950
|
-
"public class PassDbHelper extends SQLiteOpenHelper {",
|
|
951
|
-
" public PassDbHelper(Context ctx, String name, int version) { super(ctx, name, null, version); }",
|
|
952
|
-
" public void onCreate(SQLiteDatabase db) { db.execSQL(\"CREATE TABLE pass_item (id INTEGER)\"); }",
|
|
953
|
-
"}",
|
|
954
|
-
"",
|
|
955
|
-
].join("\n"),
|
|
956
|
-
"lib/src/com/x/util/Misc.kt": "package com.x.util\nfun f() {\n val name = \"unrelated.db\"\n val version = 9\n}\n",
|
|
957
|
-
"lib/src/com/x/pref/Settings.java": [
|
|
958
|
-
"package com.x.pref;",
|
|
959
|
-
"public class Settings {",
|
|
960
|
-
" void read(Context c, JSONObject json, Intent intent) {",
|
|
961
|
-
" SharedPreferences prefs = c.getSharedPreferences(\"AppSetting\", 0);",
|
|
962
|
-
" boolean a = prefs.getBoolean(\"show_tab_name\", true);",
|
|
963
|
-
" String s = json.getString(\"server_field\");",
|
|
964
|
-
" Bundle b = intent.getExtras(); String q = b.getString(\"bundle_key\");",
|
|
965
|
-
" String e = intent.getExtras().getString(\"extra_key\");",
|
|
966
|
-
" String t = getString(\"helper_key\", \"\");",
|
|
967
|
-
" }",
|
|
968
|
-
"}",
|
|
969
|
-
"",
|
|
970
|
-
].join("\n"),
|
|
971
|
-
});
|
|
972
|
-
const target = path.join(tmp, "legacy_target");
|
|
973
|
-
const proc = runCapture([process.execPath, INSPECT, repo, "--app-module", ":app", "--target-project-dir", target]);
|
|
974
|
-
const arch = path.join(target, ".hometrans", "arch_generate");
|
|
975
|
-
const inspection = proc.returncode === 0 ? parseStrictJson(fs.readFileSync(path.join(arch, "inspection.json"), "utf8")) : {};
|
|
976
|
-
const scope = proc.returncode === 0 ? parseStrictJson(fs.readFileSync(path.join(arch, "scope.json"), "utf8")) : {};
|
|
977
|
-
check("S01 检查完成", proc.returncode === 0, `exit=${proc.returncode} stderr=${proc.stderr.slice(0, 300)}`);
|
|
978
|
-
|
|
979
|
-
const libRoots = pyGet(pyGet(scope, "selected_source_roots", {}), ":lib", []);
|
|
980
|
-
check("S02 build.gradle sourceSets.main 声明的 src/、res/、manifest 被纳入扫描",
|
|
981
|
-
deepEq([...libRoots].sort(), ["lib/AndroidManifest.xml", "lib/res", "lib/src"]),
|
|
982
|
-
`roots=${deepRepr(libRoots)}`);
|
|
983
|
-
|
|
984
|
-
const dbs = pyGet(inspection, "database_schemas", []);
|
|
985
|
-
const reader = dbs.find((db) => db.name === "ReaderReader.db");
|
|
986
|
-
check("S03 库名取自 super(ctx, DB_NAME, …) 常量,而不是 helper 类名",
|
|
987
|
-
reader !== undefined && !dbs.some((db) => db.name === "ReaderDbHelper" || db.name === "HighLightTable"),
|
|
988
|
-
`dbs=${deepRepr(dbs.map((db) => db.name))}`);
|
|
989
|
-
check("S04 版本号取自 DB_VERSION 常量",
|
|
990
|
-
reader !== undefined && Number(reader.version) === 6, `version=${pyStr(reader?.version)}`);
|
|
991
|
-
const tables = reader ? reader.tables.map((t) => t.name).sort() : [];
|
|
992
|
-
check("S05 常量类里的 DDL 归属到引用它的 helper;注释里的 CREATE TABLE 不入库",
|
|
993
|
-
deepEq(tables, ["highlight"]) && !dbs.some((db) => (db.tables ?? []).some((t) => ["ghost", "old_table"].includes(t.name))),
|
|
994
|
-
`tables=${deepRepr(tables)}`);
|
|
995
|
-
|
|
996
|
-
const pass = dbs.find((db) => (db.tables ?? []).some((t) => t.name === "pass_item"));
|
|
997
|
-
check("S09 super(ctx, name, …) 透传构造参数不解析成别处无关的 val name = \"…\"",
|
|
998
|
-
pass !== undefined && pass.name !== "unrelated.db" && pass.confidence === "review_required"
|
|
999
|
-
&& pass.version === undefined,
|
|
1000
|
-
`pass=${deepRepr(pass ? { name: pass.name, confidence: pass.confidence, version: pass.version } : null)}`);
|
|
1001
|
-
|
|
1002
|
-
const stores = pyGet(inspection, "preference_stores", []);
|
|
1003
|
-
const appSetting = stores.find((st) => st.name === "AppSetting");
|
|
1004
|
-
const keyConf = Object.fromEntries((appSetting?.keys ?? []).map((k) => [k.key, k.confidence]));
|
|
1005
|
-
check("S06 SharedPreferences 实例上的键保留为 authoritative",
|
|
1006
|
-
keyConf.show_tab_name === "authoritative", `keys=${deepRepr(keyConf)}`);
|
|
1007
|
-
const allKeys = new Set(stores.flatMap((st) => (st.keys ?? []).map((k) => k.key)));
|
|
1008
|
-
check("S07 JSONObject / Bundle / getExtras() 上的 getString 不再算偏好键",
|
|
1009
|
-
!["server_field", "bundle_key", "extra_key"].some((k) => allKeys.has(k)),
|
|
1010
|
-
`keys=${deepRepr([...allKeys].sort())}`);
|
|
1011
|
-
check("S08 接收器不明的 getString(\"k\", def) 保留但降为 review_required",
|
|
1012
|
-
keyConf.helper_key === "review_required", `keys=${deepRepr(keyConf)}`);
|
|
1013
|
-
|
|
1014
|
-
// HarmonyOS target: two RDB stores in different files; DDL lives in a
|
|
1015
|
-
// separate file imported only by the second opener; a third file has
|
|
1016
|
-
// commented-out store code.
|
|
1017
|
-
const hmos = path.join(tmp, "hmos_storage");
|
|
1018
|
-
const ets = "entry/src/main/ets";
|
|
1019
|
-
writeTree(hmos, {
|
|
1020
|
-
"build-profile.json5": "{\"app\": {}, \"modules\": [{\"name\": \"entry\", \"srcPath\": \"./entry\"}]}\n",
|
|
1021
|
-
"entry/build-profile.json5": "{\"targets\": []}\n",
|
|
1022
|
-
"entry/src/main/module.json5": "{\"module\": {\"name\": \"entry\", \"type\": \"entry\"}}\n",
|
|
1023
|
-
[`${ets}/db/EventsDb.ets`]: [
|
|
1024
|
-
"import relationalStore from '@ohos.data.relationalStore';",
|
|
1025
|
-
"const STORE_NAME = 'events.db';",
|
|
1026
|
-
"export async function open(ctx) {",
|
|
1027
|
-
" const store = await relationalStore.getRdbStore(ctx, { name: STORE_NAME, securityLevel: 1 });",
|
|
1028
|
-
" await store.executeSql('CREATE TABLE IF NOT EXISTS event (id INTEGER PRIMARY KEY, title TEXT)');",
|
|
1029
|
-
"}",
|
|
1030
|
-
"",
|
|
1031
|
-
].join("\n"),
|
|
1032
|
-
[`${ets}/db/TingDb.ets`]: [
|
|
1033
|
-
"import relationalStore from '@ohos.data.relationalStore';",
|
|
1034
|
-
"import { TING_SQL } from './TingSchema';",
|
|
1035
|
-
"export async function open(ctx) {",
|
|
1036
|
-
" const store = await relationalStore.getRdbStore(ctx, { name: 'eudic_ting.db', securityLevel: 1 });",
|
|
1037
|
-
" await store.executeSql(TING_SQL);",
|
|
1038
|
-
"}",
|
|
1039
|
-
"",
|
|
1040
|
-
].join("\n"),
|
|
1041
|
-
[`${ets}/db/TingSchema.ets`]: "export const TING_SQL = 'CREATE TABLE IF NOT EXISTS ting_item (id INTEGER, name TEXT)';\n",
|
|
1042
|
-
[`${ets}/db/Legacy.ets`]: "// relationalStore.getRdbStore(ctx, { name: 'old.db' })\n// 'CREATE TABLE zombie (a TEXT)'\n",
|
|
1043
|
-
[`${ets}/pref/A.ets`]: "const p = preferences.getPreferencesSync(ctx, { name: 'x' });\nconst s = dataPreferences.getPreferences(ctx, 'settings');\ns.get('theme', 'light');\n",
|
|
1044
|
-
[`${ets}/pref/B.ets`]: "const q = dataPreferences.getPreferences(ctx, 'other');\nq.get('volume', 3);\n",
|
|
1045
|
-
[`${ets}/pref/C.ets`]: "import { PreferencesUtil } from './PreferencesUtil';\nPreferencesUtil.get('orphan', 1);\n",
|
|
1046
|
-
});
|
|
1047
|
-
const hReport = path.join(tmp, "hmos_target_inspection.json");
|
|
1048
|
-
const hp = runCapture([
|
|
1049
|
-
process.execPath, path.join(SCRIPTS_DIR, "inspect_harmony_target.mjs"),
|
|
1050
|
-
"--target-project-dir", hmos, "--report", hReport,
|
|
1051
|
-
]);
|
|
1052
|
-
const hData = isFile(hReport) ? parseStrictJson(fs.readFileSync(hReport, "utf8")) : {};
|
|
1053
|
-
const hdbs = pyGet(pyGet(hData, "storage", {}), "databases", []);
|
|
1054
|
-
const tablesOf = (name) => (hdbs.find((db) => db.name === name)?.tables ?? []).map((t) => t.name).sort();
|
|
1055
|
-
check("H01 鸿蒙检查完成", hp.returncode === 0 && isFile(hReport), `exit=${hp.returncode} stderr=${hp.stderr.slice(0, 300)}`);
|
|
1056
|
-
check("H02 同文件常量 name: STORE_NAME 解析出 events.db,表归属本库",
|
|
1057
|
-
deepEq(tablesOf("events.db"), ["event"]), `dbs=${deepRepr(hdbs.map((db) => [db.name, db.tables.map((t) => t.name)]))}`);
|
|
1058
|
-
check("H03 独立 schema 文件的表归属到 import 它的那个库,而不是第一个发现的库",
|
|
1059
|
-
deepEq(tablesOf("eudic_ting.db"), ["ting_item"]) && !tablesOf("events.db").includes("ting_item"),
|
|
1060
|
-
`dbs=${deepRepr(hdbs.map((db) => [db.name, db.tables.map((t) => t.name)]))}`);
|
|
1061
|
-
check("H04 注释掉的 getRdbStore / CREATE TABLE 不产生库或表",
|
|
1062
|
-
!hdbs.some((db) => db.name === "old.db" || (db.tables ?? []).some((t) => t.name === "zombie")),
|
|
1063
|
-
`dbs=${deepRepr(hdbs.map((db) => db.name))}`);
|
|
1064
|
-
const hprefs = pyGet(pyGet(hData, "storage", {}), "preference_stores", []);
|
|
1065
|
-
const prefKeys = Object.fromEntries(hprefs.map((st) => [st.name, (st.keys ?? []).map((k) => k.key).sort()]));
|
|
1066
|
-
check("H05 偏好键归属本文件打开的 store,不串到第一个发现的 store",
|
|
1067
|
-
deepEq(prefKeys.other ?? [], ["volume"]) && !(prefKeys.settings ?? []).includes("volume"),
|
|
1068
|
-
`prefs=${deepRepr(prefKeys)}`);
|
|
1069
|
-
check("H06 多个 store 时,不打开 store 的文件里的键不归属任何 store",
|
|
1070
|
-
!Object.values(prefKeys).some((keys) => keys.includes("orphan")), `prefs=${deepRepr(prefKeys)}`);
|
|
1071
|
-
|
|
1072
|
-
// Single-store module: a PreferencesUtil wrapper opens the store, pages
|
|
1073
|
-
// only call the wrapper; their keys still belong to that one store.
|
|
1074
|
-
const hmosOne = path.join(tmp, "hmos_single_store");
|
|
1075
|
-
writeTree(hmosOne, {
|
|
1076
|
-
"build-profile.json5": "{\"app\": {}, \"modules\": [{\"name\": \"entry\", \"srcPath\": \"./entry\"}]}\n",
|
|
1077
|
-
"entry/build-profile.json5": "{\"targets\": []}\n",
|
|
1078
|
-
"entry/src/main/module.json5": "{\"module\": {\"name\": \"entry\", \"type\": \"entry\"}}\n",
|
|
1079
|
-
[`${ets}/util/PreferencesUtil.ets`]: "const store = dataPreferences.getPreferencesSync(ctx, 'app_prefs');\nexport function get(k, d) { return store.getSync(k, d); }\n",
|
|
1080
|
-
[`${ets}/pages/Index.ets`]: "import { PreferencesUtil } from '../util/PreferencesUtil';\nconst size = PreferencesUtil.get('font_size', 14);\n",
|
|
1081
|
-
});
|
|
1082
|
-
const oneReport = path.join(tmp, "hmos_single_inspection.json");
|
|
1083
|
-
runCapture([
|
|
1084
|
-
process.execPath, path.join(SCRIPTS_DIR, "inspect_harmony_target.mjs"),
|
|
1085
|
-
"--target-project-dir", hmosOne, "--report", oneReport,
|
|
1086
|
-
]);
|
|
1087
|
-
const oneData = isFile(oneReport) ? parseStrictJson(fs.readFileSync(oneReport, "utf8")) : {};
|
|
1088
|
-
const oneKeys = Object.fromEntries(pyGet(pyGet(oneData, "storage", {}), "preference_stores", [])
|
|
1089
|
-
.map((st) => [st.name, (st.keys ?? []).map((k) => k.key).sort()]));
|
|
1090
|
-
check("H07 模块只有一个 store 时,经封装类调用的键归属这个 store",
|
|
1091
|
-
(oneKeys.app_prefs ?? []).includes("font_size"), `prefs=${deepRepr(oneKeys)}`);
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
function main() {
|
|
1096
|
-
const td = fs.mkdtempSync(path.join(os.tmpdir(), "arch_marker_tests_"));
|
|
1097
|
-
try {
|
|
1098
|
-
const tmp = td;
|
|
1099
|
-
testStructural(tmp);
|
|
1100
|
-
testTreeEdgeCases(tmp);
|
|
1101
|
-
testDataDocConstraints(tmp);
|
|
1102
|
-
testScaffoldParser();
|
|
1103
|
-
if (process.platform !== "win32") testCreateProjectAppName(tmp); // C01 uses a #!/bin/bash stub
|
|
1104
|
-
testReviewFixes(tmp);
|
|
1105
|
-
testExistingProjectFixes(tmp);
|
|
1106
|
-
testStorageExtraction(tmp);
|
|
1107
|
-
testIncremental(tmp);
|
|
1108
|
-
} finally {
|
|
1109
|
-
fs.rmSync(td, { recursive: true, force: true });
|
|
1110
|
-
}
|
|
1111
|
-
process.stdout.write("\n");
|
|
1112
|
-
process.stdout.write(`总计: ${PASS} 通过, ${FAIL} 失败\n`);
|
|
1113
|
-
if (FAILURES.length > 0) {
|
|
1114
|
-
process.stdout.write("失败明细:\n");
|
|
1115
|
-
for (const f of FAILURES) {
|
|
1116
|
-
process.stdout.write(` - ${f}\n`);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
return FAIL > 0 ? 1 : 0;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
process.exitCode = main();
|