@buaa_smat/hometrans 26.0.3 → 26.0.4
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 +1 -1
- package/agents/code-reviewer.md +91 -21
- package/env-requirements.json +1 -1
- package/i18n/agents/code-reviewer.md +93 -21
- package/i18n/skills/a2h-app-migrate/SKILL.md +19 -11
- package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +320 -73
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/i18n/skills/a2h-arch-generate/SKILL.md +20 -17
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +4 -4
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +52 -11
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +70 -21
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +22 -6
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +386 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +133 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +11 -9
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/i18n/skills/a2h-page-specgen/SKILL.md +123 -20
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/i18n/skills/a2h-page-specgen/references/gates.md +119 -52
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +113 -110
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +171 -62
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +314 -192
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +364 -76
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +216 -8
- package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -223
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +521 -13
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +483 -125
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +10 -33
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +134 -163
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +206 -9
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +862 -12
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +166 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +69 -44
- package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +658 -120
- package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/i18n/skills/a2h-resource-convert/SKILL.md +9 -1
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +69 -109
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +135 -37
- package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +24 -13
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +170 -7
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +2 -2
- package/i18n/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +74 -84
- package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +211 -61
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +724 -47
- package/i18n/skills/a2h-utg-static/SKILL.md +6 -2
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +82 -12
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +50 -5
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +17 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +181 -17
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +118 -19
- package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +113 -70
- package/package.json +3 -6
- package/skills/a2h-app-migrate/SKILL.md +19 -11
- package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +307 -74
- package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
- package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +64 -6
- package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +33 -9
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +27 -17
- package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
- package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
- package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +7 -7
- package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
- package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +10 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +33 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +13 -5
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +170 -3
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/skills/a2h-arch-generate/SKILL.md +20 -17
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +10 -8
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
- package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +17 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +26 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +146 -17
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +42 -11
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +244 -0
- package/skills/a2h-batch-ui-align/SKILL.md +72 -22
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- 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 +30 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +380 -16
- package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
- package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
- package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +39 -5
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +213 -30
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +24 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +24 -2
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +14 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +41 -7
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +1 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +19 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +155 -1
- package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
- package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +5 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
- package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
- package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
- package/skills/a2h-page-specgen/SKILL.md +124 -20
- package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
- package/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/skills/a2h-page-specgen/references/evidence.md +35 -0
- package/skills/a2h-page-specgen/references/execution-model.md +135 -26
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +20 -15
- package/skills/a2h-page-specgen/references/gates.md +120 -52
- package/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
- package/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/skills/a2h-page-specgen/references/spec-template.md +112 -109
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +8 -5
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +170 -61
- package/skills/a2h-page-specgen/scripts/finalize.mjs +466 -63
- package/skills/a2h-page-specgen/scripts/footprint.mjs +302 -180
- package/skills/a2h-page-specgen/scripts/gate.mjs +372 -82
- package/skills/a2h-page-specgen/scripts/interactions.mjs +215 -8
- package/skills/a2h-page-specgen/scripts/inventory.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -216
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +105 -13
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +520 -12
- package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +129 -6
- package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
- package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +106 -0
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +470 -122
- package/skills/a2h-page-specgen/scripts/render.mjs +11 -34
- package/skills/a2h-page-specgen/scripts/report.mjs +339 -6
- package/skills/a2h-page-specgen/scripts/submission.mjs +253 -88
- package/skills/a2h-page-specgen/scripts/submit.mjs +12 -6
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
- package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +135 -137
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +178 -9
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +19 -1
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +869 -13
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +42 -2
- package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +171 -3
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +365 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +85 -42
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
- package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
- package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +645 -115
- package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +88 -74
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +30 -1
- package/skills/a2h-page-specgen/scripts/waker.mjs +79 -12
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +18 -17
- package/skills/a2h-resource-convert/SKILL.md +9 -1
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
- package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
- package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
- package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
- package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +48 -72
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +123 -37
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +40 -8
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +5 -4
- package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +37 -5
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +38 -14
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +127 -4
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +90 -24
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +65 -34
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +11 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +10 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/{HttpExtraDataEmptyStringCheck.js → platform/ExtraDataSubCheck.js} +27 -30
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +4 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +3 -2
- package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +55 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +138 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +10 -13
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +21 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +32 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +109 -13
- package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
- package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +12 -17
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +172 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +36 -16
- package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +27 -3
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +20 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +143 -13
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +168 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +139 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +25 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +37 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +4 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +59 -8
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +44 -0
- package/skills/a2h-spec-generate/SKILL.md +2 -2
- package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +1 -2
- package/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +56 -5
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
- package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
- package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
- package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
- package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
- package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +122 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +138 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +22 -13
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
- package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
- package/skills/a2h-utg-static/SKILL.md +6 -2
- package/skills/a2h-utg-static/scripts/assemble.mjs +65 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +8 -1
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
- package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +0 -55
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +0 -60
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -948
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -1014
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* data_model.mjs — what app data each page needs before a path can reach it.
|
|
4
|
+
*
|
|
5
|
+
* data_model.mjs <workspace> --project <src>
|
|
6
|
+
* reads <ws>/utg.json, <ws>/click_paths.json
|
|
7
|
+
* writes <ws>/data_model.json, and stamps `data_requirements` on the utg.json nodes
|
|
8
|
+
*
|
|
9
|
+
* A page that lists records shows its controls per record, and a record's controls depend on its
|
|
10
|
+
* state: an order card offers "Confirm receipt" only `if (order.status == 2)`. An account with no record in
|
|
11
|
+
* that state shows an empty list or a card without the control, and every page behind it is out of
|
|
12
|
+
* reach however the path is written (measured, coolmall 2026-11-16: 13 pages behind an empty order
|
|
13
|
+
* list). This stage names, for every page, the records and record states its path needs:
|
|
14
|
+
*
|
|
15
|
+
* instance a typed route that takes a record id (`data class Detail(val orderId: Long)`, a
|
|
16
|
+
* `"detail/{orderId}"` route) opens one existing record of that entity;
|
|
17
|
+
* state a control the path taps whose text is rendered only under a condition on a record
|
|
18
|
+
* field (`if (x.status == 2)`, `x.status in listOf(1, 2)`, `listOf(..).contains(x.f)`,
|
|
19
|
+
* `x.f != v && x.f != w`, or a `when (x.f) { v -> R.string.label }` branch).
|
|
20
|
+
*
|
|
21
|
+
* The tapped texts come from the click path itself (each step's quoted hint text and non-code
|
|
22
|
+
* label); their resources are found by value in strings.xml, and every place that renders one is
|
|
23
|
+
* read with its enclosing `if` / `else` / `when` blocks, up to its function. Only predicates on a
|
|
24
|
+
* `<record>.<field>` against literals or constants count; `if (isLoggedIn)` or `if (list.isEmpty())`
|
|
25
|
+
* are no record state. A text rendered in several places counts only where it is guarded, and the
|
|
26
|
+
* guarded places must agree, else the text decides nothing. Names come from the code (the record
|
|
27
|
+
* variable, the route parameter), never from a vocabulary.
|
|
28
|
+
*
|
|
29
|
+
* data_model.json: { entities: { <entity>: { fields: { <field>: { values: {<v>: <label>} } },
|
|
30
|
+
* sources: [{ kind, name, http?, at }] } }, nodes: { <id>: [requirement] } }
|
|
31
|
+
* requirement: { entity, kind: 'instance' | 'state', field?, op?: 'in' | 'not-in', values?, via, evidence }
|
|
32
|
+
*
|
|
33
|
+
* Exports: idParamEntity, checkEntities, recordNouns, quotedTexts, routeInstanceParams, guardsAt, parsePredicate,
|
|
34
|
+
* labelGuards, fieldValueLabels, dataSources, buildDataModel, main
|
|
35
|
+
*/
|
|
36
|
+
import * as path from 'node:path';
|
|
37
|
+
import { pathToFileURL } from 'node:url';
|
|
38
|
+
import {
|
|
39
|
+
ArgumentParser, jsonDumps, jsonLoads, readText, writeText, pyPrint, pyPrintErr, runMain, truthy, get,
|
|
40
|
+
} from './_py.mjs';
|
|
41
|
+
import { loadProjectStrings, _stripComments } from './label_resolve.mjs';
|
|
42
|
+
import { walkSources } from './fragment_nav.mjs';
|
|
43
|
+
import { producersFor } from './data_producers.mjs';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* idParamEntity(word, known): the entity a record-id name stands for, lowercase, or null. `orderId` /
|
|
47
|
+
* `order_id` / `goodsID` / `order_Id` -> order / goods. An all-lowercase `orderid` (Java, uni-app) only when
|
|
48
|
+
* its stem names a record class of the project (`known`, recordNouns): a word that merely ends in "id"
|
|
49
|
+
* (`isvalid`, `paid`, `rigid`) never does, with no word list to keep up to date.
|
|
50
|
+
*/
|
|
51
|
+
export function idParamEntity(word, known = null) {
|
|
52
|
+
const w = String(word);
|
|
53
|
+
const m = /^([a-z][A-Za-z0-9]*?)(?:_id|_ID|_Id|Id|ID)$/.exec(w);
|
|
54
|
+
if (m) { return m[1].toLowerCase(); }
|
|
55
|
+
const l = /^([a-z][a-z0-9]+)id$/.exec(w);
|
|
56
|
+
return l && known && known.has(l[1]) ? l[1] : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The entities a check names through its id words (`addressId == null` -> [address]), in order. */
|
|
60
|
+
export function checkEntities(check, known) {
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const m of String(check).matchAll(/\b([a-z]\w*)\b/g)) { const e = idParamEntity(m[1], known); if (e && !out.includes(e)) { out.push(e); } }
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Lowercase nouns of the project's classes: `OrderInfo` -> orderinfo, order, info. */
|
|
67
|
+
export function recordNouns(files) {
|
|
68
|
+
const out = new Set();
|
|
69
|
+
for (const [, raw] of files) {
|
|
70
|
+
for (const m of raw.matchAll(/\bclass\s+([A-Z]\w*)/g)) {
|
|
71
|
+
const w = m[1].replace(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase().split(/\s+/);
|
|
72
|
+
out.add(w.join('')); for (const x of w) { out.add(x); }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const lineOf = (text, pos) => text.slice(0, pos).split('\n').length;
|
|
79
|
+
const rel = (project, p) => path.relative(project, p).replace(/\\/g, '/');
|
|
80
|
+
|
|
81
|
+
/** Quoted on-screen texts of a hint, its parenthesised commentary dropped (the hint grammar). */
|
|
82
|
+
export function quotedTexts(hint) {
|
|
83
|
+
const s = String(hint || '').replace(/([^)]*)|\([^)]*\)/g, ' ');
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const m of s.matchAll(/“([^”]{1,40})”|「([^」]{1,40})」|"([^"\n]{1,40})"/g)) {
|
|
86
|
+
const t = (m[1] ?? m[2] ?? m[3]).trim();
|
|
87
|
+
if (t && !out.includes(t)) { out.push(t); }
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Blank string-literal contents (quotes kept) so braces inside them never count. */
|
|
93
|
+
function blankStrings(src) {
|
|
94
|
+
return src.replace(/"""[\s\S]*?"""|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])'/g, (t) => t[0] + t.slice(1, -1).replace(/[^\n]/g, ' ') + t.slice(-1));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* routeInstanceParams(files): typed routes that take a record id.
|
|
99
|
+
* Map `<Holder>.<Name>` and `<Name>` -> [{ entity, param, at }]: `data class Name(val orderId: Long)`
|
|
100
|
+
* nested in `object|interface|class Holder`, required parameters only (no default value).
|
|
101
|
+
*/
|
|
102
|
+
const STRING_ROUTE_HINT = /"[^"\n]*\{\w+\}/;
|
|
103
|
+
export function routeInstanceParams(files, project, known = recordNouns(files)) {
|
|
104
|
+
const out = new Map();
|
|
105
|
+
for (const [p, raw] of files) {
|
|
106
|
+
// typed routes need a data class; string routes (`"order/detail/{orderId}"`) a literal with a `{param}`
|
|
107
|
+
const typed = raw.includes('data class');
|
|
108
|
+
if (!typed && !STRING_ROUTE_HINT.test(raw)) { continue; }
|
|
109
|
+
const text = _stripComments(raw);
|
|
110
|
+
const holders = typed ? [...text.matchAll(/\b(?:object|interface|class)\s+([A-Z]\w*)\b[^{\n]*\{/g)].map((m) => [m.index, m[1]]) : [];
|
|
111
|
+
for (const m of typed ? text.matchAll(/\bdata\s+class\s+([A-Z]\w*)\s*\(([^)]*)\)/g) : []) {
|
|
112
|
+
const params = [];
|
|
113
|
+
for (const part of m[2].split(',')) {
|
|
114
|
+
const pm = /^\s*(?:@\w+(?:\([^)]*\))?\s*)*(?:val|var)\s+(\w+)\s*:\s*[\w.?<>]+\s*(=.*)?$/s.exec(part);
|
|
115
|
+
if (!pm || pm[2]) { continue; }
|
|
116
|
+
const ent = idParamEntity(pm[1], known);
|
|
117
|
+
if (ent) { params.push({ entity: ent, param: pm[1], at: `${rel(project, p)}:${lineOf(raw, m.index)}` }); }
|
|
118
|
+
}
|
|
119
|
+
if (!params.length) { continue; }
|
|
120
|
+
const holder = holders.filter(([i]) => i < m.index).at(-1)?.[1];
|
|
121
|
+
for (const k of [holder ? `${holder}.${m[1]}` : null, m[1]]) {
|
|
122
|
+
if (!k) { continue; }
|
|
123
|
+
if (!out.has(k)) { out.set(k, []); }
|
|
124
|
+
out.get(k).push(...params);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// string routes: "order/detail/{orderId}", "order/detail/{orderId}?from={from}"
|
|
128
|
+
for (const m of text.matchAll(/"([\w/?=&.-]*\{\w+\}[\w/?=&.{}-]*)"/g)) {
|
|
129
|
+
// the record-id parameters of the route's PATH: a query argument (`?orderId={orderId}`) is optional
|
|
130
|
+
// in Navigation-Compose (it must have a default), so it requires no record
|
|
131
|
+
const params = [...m[1].split('?')[0].matchAll(/\{(\w+)\}/g)].map((x) => [x[1], idParamEntity(x[1], known)]).filter(([, e]) => e);
|
|
132
|
+
if (!params.length) { continue; }
|
|
133
|
+
// the literal as written, and as compose_nav keys its node (up to the first `{`: `order/detail`)
|
|
134
|
+
const head = m[1].split('{')[0].replace(/^\/+|\/+$/g, '');
|
|
135
|
+
const keys = new Set([`route:${m[1]}`, ...(head.length >= 2 ? [`route:${head}`] : [])]);
|
|
136
|
+
for (const k of keys) {
|
|
137
|
+
if (!out.has(k)) { out.set(k, []); }
|
|
138
|
+
for (const [param, entity] of params) { out.get(k).push({ entity, param, at: `${rel(project, p)}:${lineOf(raw, m.index)}` }); }
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* guardsAt(text, pos): the conditions enclosing `pos` inside its function, innermost first:
|
|
147
|
+
* [{ kind: 'if', cond, negated }] and [{ kind: 'when', subject, branch }]. `text` is comment- and
|
|
148
|
+
* string-blanked source (offsets equal to the original).
|
|
149
|
+
*/
|
|
150
|
+
export function guardsAt(text, pos) {
|
|
151
|
+
const stack = [];
|
|
152
|
+
let lastIf = null;
|
|
153
|
+
let i = 0;
|
|
154
|
+
while (i < pos) {
|
|
155
|
+
const c = text[i];
|
|
156
|
+
if (c === '{') {
|
|
157
|
+
const start = Math.max(text.lastIndexOf('{', i - 1), text.lastIndexOf('}', i - 1), text.lastIndexOf(';', i - 1)) + 1;
|
|
158
|
+
const head = text.slice(start, i);
|
|
159
|
+
let frame = { kind: 'block', head, open: i };
|
|
160
|
+
const im = /\b(else\s+)?if\s*\(([\s\S]*)\)\s*$/.exec(head);
|
|
161
|
+
const wm = /\bwhen\s*\(([\s\S]*)\)\s*$/.exec(head);
|
|
162
|
+
if (/\bfun\s+\w+/.test(head) || /\bfun\s+[\w.<>]+\s*\.\s*\w+/.test(head)) { frame = { kind: 'fun', head, open: i }; }
|
|
163
|
+
else if (im) { frame = { kind: 'if', cond: im[2].trim(), negated: false, open: i }; }
|
|
164
|
+
else if (/^\s*else\s*$/.test(head) && lastIf) { frame = { kind: 'if', cond: lastIf, negated: true, open: i }; }
|
|
165
|
+
else if (wm) { frame = { kind: 'when', subject: wm[1].trim(), open: i }; }
|
|
166
|
+
stack.push(frame);
|
|
167
|
+
lastIf = null;
|
|
168
|
+
} else if (c === '}') {
|
|
169
|
+
const f = stack.pop();
|
|
170
|
+
lastIf = f && f.kind === 'if' && !f.negated ? f.cond : null;
|
|
171
|
+
} else if (!/\s/.test(c)) {
|
|
172
|
+
if (lastIf !== null && /^else\b/.test(text.slice(i, i + 5))) { i += 4; continue; }
|
|
173
|
+
lastIf = null;
|
|
174
|
+
}
|
|
175
|
+
i++;
|
|
176
|
+
}
|
|
177
|
+
const out = [];
|
|
178
|
+
for (let k = stack.length - 1; k >= 0; k--) {
|
|
179
|
+
const f = stack[k];
|
|
180
|
+
if (f.kind === 'fun') { break; }
|
|
181
|
+
if (f.kind === 'if') { out.push({ kind: 'if', cond: f.cond, negated: f.negated }); }
|
|
182
|
+
if (f.kind === 'when') {
|
|
183
|
+
// the branch head: the `X ->` at depth 0 of the when body last opened before pos
|
|
184
|
+
const body = text.slice(f.open + 1, pos);
|
|
185
|
+
let depth = 0; let headStart = 0; let head = null;
|
|
186
|
+
for (let j = 0; j < body.length; j++) {
|
|
187
|
+
const ch = body[j];
|
|
188
|
+
if ('({['.includes(ch)) { depth++; } else if (')}]'.includes(ch)) { depth--; }
|
|
189
|
+
else if (depth === 0 && ch === '\n') { headStart = j + 1; }
|
|
190
|
+
else if (depth === 0 && body.startsWith('->', j)) { head = body.slice(headStart, j).trim(); headStart = j + 2; }
|
|
191
|
+
}
|
|
192
|
+
if (head !== null) { out.push({ kind: 'when', subject: f.subject, branch: head }); }
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return out;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const LIT = String.raw`(-?\d+(?:\.\d+)?[LlFf]?|"[^"]*"|'[^']'|true|false|[A-Z]\w*(?:\.[A-Za-z_]\w*)+)`;
|
|
199
|
+
const FIELD = String.raw`([a-z]\w*)\s*\??\.\s*([a-z]\w*)`;
|
|
200
|
+
const normLit = (v) => v.replace(/[LlFf]$/, '').replace(/^"(.*)"$/, '$1');
|
|
201
|
+
|
|
202
|
+
/** One predicate on a record field, or null: { entity, field, op: 'in'|'not-in', values }. */
|
|
203
|
+
export function parsePredicate(cond) {
|
|
204
|
+
const c = String(cond).trim().replace(/^\((.*)\)$/s, '$1').trim();
|
|
205
|
+
let m = new RegExp(`^${FIELD}\\s*(==|!=)\\s*${LIT}$`).exec(c);
|
|
206
|
+
if (m) { return { entity: m[1], field: m[2], op: m[3] === '==' ? 'in' : 'not-in', values: [normLit(m[4])] }; }
|
|
207
|
+
m = new RegExp(`^${LIT}\\s*(==|!=)\\s*${FIELD}$`).exec(c);
|
|
208
|
+
if (m) { return { entity: m[3], field: m[4], op: m[2] === '==' ? 'in' : 'not-in', values: [normLit(m[1])] }; }
|
|
209
|
+
m = new RegExp(`^(?:listOf|setOf|arrayOf|intArrayOf)\\s*\\(([^()]*)\\)\\s*\\.\\s*contains\\s*\\(\\s*${FIELD}\\s*\\)$`).exec(c)
|
|
210
|
+
|| new RegExp(`^${FIELD}\\s+(!?in)\\s+(?:listOf|setOf|arrayOf|intArrayOf)\\s*\\(([^()]*)\\)$`).exec(c);
|
|
211
|
+
if (m) {
|
|
212
|
+
const contains = c.includes('contains');
|
|
213
|
+
const [entity, field] = contains ? [m[2], m[3]] : [m[1], m[2]];
|
|
214
|
+
const list = contains ? m[1] : m[4];
|
|
215
|
+
const values = list.split(',').map((s) => s.trim()).filter(Boolean);
|
|
216
|
+
if (!values.every((v) => new RegExp(`^${LIT}$`).test(v))) { return null; }
|
|
217
|
+
return { entity, field, op: !contains && m[3] === '!in' ? 'not-in' : 'in', values: values.map(normLit) };
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/** Top-level split of a condition by an operator (`||`, `&&`), parentheses respected. */
|
|
223
|
+
function splitTop(cond, op) {
|
|
224
|
+
const out = []; let depth = 0; let start = 0;
|
|
225
|
+
for (let i = 0; i < cond.length; i++) {
|
|
226
|
+
const ch = cond[i];
|
|
227
|
+
if (ch === '(') { depth++; } else if (ch === ')') { depth--; }
|
|
228
|
+
else if (depth === 0 && cond.startsWith(op, i)) { out.push(cond.slice(start, i)); start = i + op.length; i += op.length - 1; }
|
|
229
|
+
}
|
|
230
|
+
out.push(cond.slice(start));
|
|
231
|
+
return out.map((s) => s.trim()).filter(Boolean);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const keyOf = (p) => `${p.entity}.${p.field}`;
|
|
235
|
+
|
|
236
|
+
/** A guard as one predicate per field, or null: `a || b` of the same field -> union, `a && b` -> intersection. */
|
|
237
|
+
function predicateOfGuard(g) {
|
|
238
|
+
if (g.kind === 'when') {
|
|
239
|
+
const s = new RegExp(`^${FIELD}$`).exec(g.subject.trim());
|
|
240
|
+
if (!s || g.branch === 'else') { return null; }
|
|
241
|
+
const values = g.branch.split(',').map((v) => v.trim());
|
|
242
|
+
if (!values.every((v) => new RegExp(`^${LIT}$`).test(v))) { return null; }
|
|
243
|
+
return { entity: s[1], field: s[2], op: 'in', values: values.map(normLit) };
|
|
244
|
+
}
|
|
245
|
+
const ors = splitTop(g.cond, '||').map((d) => {
|
|
246
|
+
const ands = splitTop(d, '&&').map(parsePredicate);
|
|
247
|
+
if (!ands.length || ands.some((x) => !x) || new Set(ands.map(keyOf)).size !== 1) { return null; }
|
|
248
|
+
return ands.reduce(combineAnd);
|
|
249
|
+
});
|
|
250
|
+
if (!ors.length || ors.some((x) => !x) || new Set(ors.map(keyOf)).size !== 1) { return null; }
|
|
251
|
+
const p = ors.reduce(combineOr);
|
|
252
|
+
return g.negated ? { ...p, op: p.op === 'in' ? 'not-in' : 'in' } : p;
|
|
253
|
+
}
|
|
254
|
+
function combineOr(a, b) {
|
|
255
|
+
if (a.op === 'in' && b.op === 'in') { return { ...a, values: [...new Set([...a.values, ...b.values])] }; }
|
|
256
|
+
if (a.op === 'not-in' && b.op === 'not-in') { return { ...a, values: a.values.filter((v) => b.values.includes(v)) }; }
|
|
257
|
+
const [inn, out] = a.op === 'in' ? [a, b] : [b, a];
|
|
258
|
+
return { ...out, values: out.values.filter((v) => !inn.values.includes(v)) };
|
|
259
|
+
}
|
|
260
|
+
function combineAnd(a, b) {
|
|
261
|
+
if (a.op === 'in' && b.op === 'in') { return { ...a, values: a.values.filter((v) => b.values.includes(v)) }; }
|
|
262
|
+
if (a.op === 'not-in' && b.op === 'not-in') { return { ...a, values: [...new Set([...a.values, ...b.values])] }; }
|
|
263
|
+
const [inn, out] = a.op === 'in' ? [a, b] : [b, a];
|
|
264
|
+
return { ...inn, values: inn.values.filter((v) => !out.values.includes(v)) };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Places that render a text: `R.string.<key>` (qualified or not) of every key with that value, and the literal. */
|
|
268
|
+
function renderSites(files, keys, text) {
|
|
269
|
+
const out = [];
|
|
270
|
+
const pats = [...keys.map((k) => new RegExp(String.raw`(?:[a-z]\w*\.)*R\.string\.${k}\b`, 'g'))];
|
|
271
|
+
if (text) { pats.push(new RegExp(`"${text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}"`, 'g')); }
|
|
272
|
+
for (const [p, raw, blank] of files) {
|
|
273
|
+
for (const re of pats) { for (const m of raw.matchAll(re)) { out.push([p, raw, blank, m.index]); } }
|
|
274
|
+
}
|
|
275
|
+
return out;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* labelGuards(files, keysByValue, text, project): the record-state predicate under which `text` is
|
|
280
|
+
* rendered, or null. Every guarded place must give the same predicate; unguarded places (a tab or
|
|
281
|
+
* title with the same words) are reported but decide nothing.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* stateEntity(blank, pos, receiver): the entity a guard's receiver holds, named like a route's instance
|
|
285
|
+
* entity (lowercase): the receiver's declared type nearest before the guard (`item: OrderInfo`, Java
|
|
286
|
+
* `OrderInfo item`) -> `orderinfo`, else the receiver itself lowercased. A generic receiver with no
|
|
287
|
+
* declared type (`it`, `item`) -> `?it`, for buildDataModel to settle on the page's record. A screen's
|
|
288
|
+
* own state (`uiState.selectedTab`, a `…UiState` / `…ViewState` type) is no record -> null.
|
|
289
|
+
*/
|
|
290
|
+
export function stateEntity(blank, pos, receiver) {
|
|
291
|
+
const before = blank.slice(0, pos);
|
|
292
|
+
const res = [new RegExp(String.raw`\b${receiver}\s*:\s*([A-Z]\w*)`, 'g'), new RegExp(String.raw`\b([A-Z]\w*)(?:<[^<>]*>)?\s+${receiver}\s*[,);=]`, 'g')];
|
|
293
|
+
let best = null;
|
|
294
|
+
for (const re of res) {
|
|
295
|
+
for (const m of before.matchAll(re)) { if ((!best || m.index > best.index) && inScopeAt(before, m.index)) { best = { index: m.index, type: m[1] }; } }
|
|
296
|
+
}
|
|
297
|
+
// a declared type decides (`state: OrderInfo` is a record); only an untyped `…state` name is the screen's state
|
|
298
|
+
if (best ? /(?:Ui|View|Screen|Page)State$/.test(best.type) : /state$/i.test(receiver)) { return null; }
|
|
299
|
+
if (!best && GENERIC_RECEIVERS.has(receiver)) { return '?' + receiver; }
|
|
300
|
+
return (best ? best.type : receiver).toLowerCase();
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* inScopeAt(text, at): a declaration at `at` is still in scope at the end of `text` (the guard). A
|
|
304
|
+
* parameter (inside a `(` that closes before its body) scopes the body after it, which must still be
|
|
305
|
+
* open; a local (`val x: T`, `T x =`) scopes its block, which must never close between it and the guard.
|
|
306
|
+
* Another function's `state: OrderInfo` never types this one's `state`.
|
|
307
|
+
*/
|
|
308
|
+
function inScopeAt(text, at) {
|
|
309
|
+
let paren = 0; let param = false;
|
|
310
|
+
for (let i = at; i < text.length; i++) {
|
|
311
|
+
const c = text[i];
|
|
312
|
+
if (c === '(') { paren++; } else if (c === ')') { if (--paren < 0) { param = true; break; } }
|
|
313
|
+
else if (paren === 0 && (c === '{' || c === ';' || c === '\n')) { break; }
|
|
314
|
+
}
|
|
315
|
+
let depth = 0; let opened = false;
|
|
316
|
+
for (let j = at; j < text.length; j++) {
|
|
317
|
+
const c = text[j];
|
|
318
|
+
if (c === '{') { depth++; opened = true; } else if (c === '}') {
|
|
319
|
+
depth--;
|
|
320
|
+
if (depth < 0 || (param && opened && depth === 0)) { return false; }
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return param ? depth >= 1 : true;
|
|
324
|
+
}
|
|
325
|
+
const GENERIC_RECEIVERS = new Set(['it', 'item', 'data', 'bean', 'model', 'entity', 'info', 'record', 'row', 'value', 'element', 'x', 'e', 'o']);
|
|
326
|
+
|
|
327
|
+
export function labelGuards(files, keysByValue, text, project) {
|
|
328
|
+
const sites = renderSites(files, keysByValue.get(text) || [], text);
|
|
329
|
+
const preds = [];
|
|
330
|
+
let unguarded = 0;
|
|
331
|
+
for (const [p, raw, blank, pos] of sites) {
|
|
332
|
+
const gs = guardsAt(blank, pos).map(predicateOfGuard).filter(Boolean);
|
|
333
|
+
if (!gs.length) { unguarded++; continue; }
|
|
334
|
+
const pred = gs.reduce((a, b) => (keyOf(a) === keyOf(b) ? combineAnd(a, b) : a));
|
|
335
|
+
const entity = stateEntity(blank, pos, pred.entity);
|
|
336
|
+
if (entity === null) { unguarded++; continue; }
|
|
337
|
+
preds.push({ ...pred, entity, at: `${rel(project, p)}:${lineOf(raw, pos)}` });
|
|
338
|
+
}
|
|
339
|
+
if (!preds.length) { return null; }
|
|
340
|
+
const sig = (q) => JSON.stringify([keyOf(q), q.op, [...q.values].sort()]);
|
|
341
|
+
if (new Set(preds.map(sig)).size !== 1) { return null; }
|
|
342
|
+
return { ...preds[0], also_unguarded: unguarded };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** `when (x.f) { v -> R.string.k }`: Map `entity.field` -> { value: label }, for readable reports. */
|
|
346
|
+
export function fieldValueLabels(files, strings) {
|
|
347
|
+
const out = new Map();
|
|
348
|
+
for (const [, raw, blank] of files) {
|
|
349
|
+
for (const m of blank.matchAll(new RegExp(`\\bwhen\\s*\\(\\s*${FIELD}\\s*\\)\\s*\\{`, 'g'))) {
|
|
350
|
+
const open = m.index + m[0].length - 1;
|
|
351
|
+
let depth = 0; let end = open;
|
|
352
|
+
for (let j = open; j < blank.length; j++) { if (blank[j] === '{') { depth++; } else if (blank[j] === '}') { depth--; if (!depth) { end = j; break; } } }
|
|
353
|
+
const body = raw.slice(open + 1, end);
|
|
354
|
+
const k = `${m[1]}.${m[2]}`;
|
|
355
|
+
for (const b of body.matchAll(new RegExp(`(?:^|\\n)\\s*${LIT}\\s*->\\s*(?:(?:[a-z]\\w*\\.)*R\\.string\\.(\\w+)|"([^"]+)")`, 'g'))) {
|
|
356
|
+
const label = b[2] ? strings[b[2]] : b[3];
|
|
357
|
+
if (!label) { continue; }
|
|
358
|
+
if (!out.has(k)) { out.set(k, {}); }
|
|
359
|
+
out.get(k)[normLit(b[1])] ??= label;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return out;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const PREPOSITIONS = new Set(['by', 'for', 'with', 'from', 'in', 'of', 'to', 'on', 'at', 'via']);
|
|
367
|
+
const COLLECTION_WORDS = new Set(['page', 'list', 'info', 'detail', 'details', 'count', 'items', 'item', 'data', 'all', 'recent', 'paged', 'id', 'ids']);
|
|
368
|
+
|
|
369
|
+
/** Data-layer methods naming an entity (Retrofit `@GET/@POST/...`, Room `@Query/@Insert/...`). */
|
|
370
|
+
export function dataSources(files, entities, project) {
|
|
371
|
+
const out = new Map(entities.map((e) => [e, []]));
|
|
372
|
+
// nouns that name a record class of the project: `data class GoodsComment` -> goodscomment, comment
|
|
373
|
+
const classNouns = new Set();
|
|
374
|
+
for (const [, raw] of files) {
|
|
375
|
+
for (const m of raw.matchAll(/\bdata\s+class\s+([A-Z]\w*)/g)) {
|
|
376
|
+
const w = m[1].replace(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase().split(/\s+/);
|
|
377
|
+
classNouns.add(w.join('')); classNouns.add(w.at(-1));
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
const re = /@(GET|POST|PUT|PATCH|DELETE|Query|Insert|Update|Upsert|Delete)\s*(?:\(\s*(?:value\s*=\s*)?"([^"]*)"[^)]*\))?\s*(?:@\w+(?:\([^)]*\))?\s*)*(?:suspend\s+)?fun\s+(\w+)/g;
|
|
381
|
+
for (const [p, raw] of files) {
|
|
382
|
+
if (!/@(?:GET|POST|PUT|PATCH|DELETE|Query|Insert|Update|Upsert|Delete)\b/.test(raw)) { continue; }
|
|
383
|
+
for (const m of raw.matchAll(re)) {
|
|
384
|
+
const http = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'].includes(m[1]);
|
|
385
|
+
// words of the method name, and (HTTP only) segments of its path: a SQL `ORDER BY` names no entity
|
|
386
|
+
// the method's head noun: its last word before a preposition (`deleteCartByGoodsId` -> cart,
|
|
387
|
+
// `submitGoodsComment` -> comment), collection words (`getOrderPage`) skipped; a name with no
|
|
388
|
+
// noun of its own (`getPage`) falls back to the HTTP path's segments
|
|
389
|
+
const words = m[3].replace(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase().split(/\s+/);
|
|
390
|
+
const cut = words.findIndex((w, i) => i > 0 && PREPOSITIONS.has(w));
|
|
391
|
+
const nouns = (cut > 0 ? words.slice(1, cut) : words.slice(1)).filter((w) => !COLLECTION_WORDS.has(w));
|
|
392
|
+
const head = nouns.at(-1) ?? null;
|
|
393
|
+
const segs = http ? (m[2] || '').toLowerCase().split(/[/?&={}._-]+/) : [];
|
|
394
|
+
// a head noun that is no record class of the project (`confirmReceive`) names an action: the path decides
|
|
395
|
+
const ownNoun = head !== null && classNouns.has(head);
|
|
396
|
+
for (const e of entities) {
|
|
397
|
+
const named = head === e || head === `${e}s`;
|
|
398
|
+
if (!named && !(!ownNoun && (segs.includes(e) || segs.includes(`${e}s`)))) { continue; }
|
|
399
|
+
out.get(e).push({ kind: http ? 'http' : 'room', name: m[3], ...(http ? { http: `${m[1]} ${m[2] || ''}`.trim() } : { sql: m[1] }),
|
|
400
|
+
at: `${rel(project, p)}:${lineOf(raw, m.index)}` });
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return out;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* aggregateNeeds(requirements) -> [needs, conflicts]: one record per entity, its state as one
|
|
409
|
+
* predicate per field. Texts tapped at the SAME step are alternatives (a hint naming "Cancel order" or
|
|
410
|
+
* "Confirm receipt"): their predicates are unioned. Steps along one path tap the same record (the card
|
|
411
|
+
* opened, then its button): their predicates are intersected. An empty intersection is a path that
|
|
412
|
+
* no single record can walk (a completed order opened, then "Confirm receipt", offered only before
|
|
413
|
+
* receipt): reported as a conflict, and the deepest step, the one that opens the page, decides.
|
|
414
|
+
*/
|
|
415
|
+
export function aggregateNeeds(reqs) {
|
|
416
|
+
const out = new Map(); const conflicts = [];
|
|
417
|
+
for (const r of reqs.filter((x) => x.kind === 'instance')) { if (!out.has(r.entity)) { out.set(r.entity, { entity: r.entity, states: {} }); } }
|
|
418
|
+
const byStep = new Map();
|
|
419
|
+
for (const r of reqs.filter((x) => x.kind === 'state')) {
|
|
420
|
+
const k = `${r.entity}.${r.field}|${r.step ?? -1}`;
|
|
421
|
+
byStep.set(k, byStep.has(k) ? combineOr(byStep.get(k), r) : { entity: r.entity, field: r.field, op: r.op, values: r.values, step: r.step ?? -1 });
|
|
422
|
+
}
|
|
423
|
+
const byField = new Map();
|
|
424
|
+
for (const p of [...byStep.values()].sort((a, b) => a.step - b.step)) {
|
|
425
|
+
const k = `${p.entity}.${p.field}`;
|
|
426
|
+
if (!byField.has(k)) { byField.set(k, p); continue; }
|
|
427
|
+
const prev = byField.get(k); const both = combineAnd(prev, p);
|
|
428
|
+
if (both.op === 'in' && !both.values.length) {
|
|
429
|
+
conflicts.push({ entity: p.entity, field: p.field, earlier: { step: prev.step, op: prev.op, values: prev.values }, later: { step: p.step, op: p.op, values: p.values } });
|
|
430
|
+
byField.set(k, p);
|
|
431
|
+
} else { byField.set(k, { ...both, step: p.step }); }
|
|
432
|
+
}
|
|
433
|
+
for (const p of byField.values()) {
|
|
434
|
+
if (!out.has(p.entity)) { out.set(p.entity, { entity: p.entity, states: {} }); }
|
|
435
|
+
out.get(p.entity).states[p.field] = { op: p.op, values: [...p.values].sort() };
|
|
436
|
+
}
|
|
437
|
+
return [[...out.values()], conflicts];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* entityDefaults(files, entity): Map field -> literal default of the entity's data class (the class
|
|
442
|
+
* named like the entity, `order` -> `data class Order(`), literals only (numbers, strings, booleans).
|
|
443
|
+
*/
|
|
444
|
+
export function entityDefaults(files, entity) {
|
|
445
|
+
// Entities are lowercase (`orderinfo`): the class is matched without case (`OrderInfo`).
|
|
446
|
+
const out = new Map();
|
|
447
|
+
for (const [, raw, blank] of files) {
|
|
448
|
+
const m = [...blank.matchAll(/\bdata\s+class\s+(\w+)\s*\(/g)].find((x) => x[1].toLowerCase() === String(entity).toLowerCase());
|
|
449
|
+
if (!m) { continue; }
|
|
450
|
+
let d = 0; let close = -1;
|
|
451
|
+
for (let j = m.index + m[0].length - 1; j < blank.length; j++) { if (blank[j] === '(') { d++; } else if (blank[j] === ')') { d--; if (!d) { close = j; break; } } }
|
|
452
|
+
const params = raw.slice(m.index + m[0].length, close);
|
|
453
|
+
for (const pm of params.matchAll(/\b(?:val|var)\s+(\w+)\s*:\s*[\w.?<>]+\s*=\s*(-?\d+(?:\.\d+)?[LlFf]?|"[^"]*"|true|false)\s*(?=,|$)/gm)) {
|
|
454
|
+
out.set(pm[1], normLit(pm[2]));
|
|
455
|
+
}
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
return out;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** The typed-route key of a node: `compose-route:OrderRoutes.Detail` -> `OrderRoutes.Detail`. */
|
|
462
|
+
const routeKeyOf = (id) => String(id).split(':').slice(1).join(':').split('#')[0].split('@')[0];
|
|
463
|
+
|
|
464
|
+
/** buildDataModel(graph, clickPaths, project) -> { entities, nodes }. */
|
|
465
|
+
export function buildDataModel(graph, clickPaths, project) {
|
|
466
|
+
const files = walkSources(project).map(([p, raw]) => [p, raw, blankStrings(_stripComments(raw))]);
|
|
467
|
+
const strings = loadProjectStrings(project) || {};
|
|
468
|
+
const keysByValue = new Map();
|
|
469
|
+
for (const k of Object.keys(strings)) {
|
|
470
|
+
const v = String(strings[k]).trim();
|
|
471
|
+
if (!keysByValue.has(v)) { keysByValue.set(v, []); }
|
|
472
|
+
keysByValue.get(v).push(k);
|
|
473
|
+
}
|
|
474
|
+
const known = recordNouns(files);
|
|
475
|
+
const routes = routeInstanceParams(files.map(([p, raw]) => [p, raw]), project, known);
|
|
476
|
+
const paths = get(clickPaths, 'paths', {}) || {};
|
|
477
|
+
const guardCache = new Map();
|
|
478
|
+
const guardOf = (t) => { if (!guardCache.has(t)) { guardCache.set(t, labelGuards(files, keysByValue, t, project)); } return guardCache.get(t); };
|
|
479
|
+
const nodes = {};
|
|
480
|
+
const add = (id, req) => {
|
|
481
|
+
const list = (nodes[id] ??= []);
|
|
482
|
+
const s = JSON.stringify([req.entity, req.kind, req.field, req.op, req.values && [...req.values].sort()]);
|
|
483
|
+
if (!list.some((r) => JSON.stringify([r.entity, r.kind, r.field, r.op, r.values && [...r.values].sort()]) === s)) { list.push(req); }
|
|
484
|
+
};
|
|
485
|
+
for (const n of get(graph, 'nodes', [])) {
|
|
486
|
+
const rk = routeKeyOf(n.id);
|
|
487
|
+
// string routes are stored `route:<path>` (node ids carry the bare path)
|
|
488
|
+
const params = routes.get(rk) || routes.get(`route:${rk}`) || routes.get(rk.split('.').pop()) || [];
|
|
489
|
+
if (routes.has(rk) || routes.has(`route:${rk}`) || (rk.split('.').length === 1 && params.length)) {
|
|
490
|
+
for (const r of params) { add(n.id, { entity: r.entity, kind: 'instance', via: `route parameter ${r.param}`, evidence: r.at }); }
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
for (const id of Object.keys(nodes)) { for (const r of nodes[id]) { r.own = true; } }
|
|
494
|
+
for (const id of Object.keys(paths)) {
|
|
495
|
+
const steps = get(paths[id], 'steps', []) || [];
|
|
496
|
+
for (const [i, st] of steps.entries()) {
|
|
497
|
+
const texts = [...quotedTexts(get(st, 'nl_hint'))];
|
|
498
|
+
if (truthy(get(st, 'label')) && get(st, 'label_source') !== 'code-name' && !texts.includes(st.label)) { texts.push(st.label); }
|
|
499
|
+
for (const t of texts) {
|
|
500
|
+
const g = guardOf(t);
|
|
501
|
+
if (!g) { continue; }
|
|
502
|
+
// an untyped generic receiver (`it.status`) is the record the path's pages need, when exactly one
|
|
503
|
+
let entity = g.entity;
|
|
504
|
+
if (entity.startsWith('?')) {
|
|
505
|
+
// the pages' own route instances only: inherited ones depend on the order paths are processed
|
|
506
|
+
const own = new Set([...(nodes[id] || []), ...steps.flatMap((s) => nodes[s.target_id] || [])].filter((r) => r.own && r.kind === 'instance').map((r) => r.entity));
|
|
507
|
+
if (own.size !== 1) { continue; }
|
|
508
|
+
[entity] = own;
|
|
509
|
+
}
|
|
510
|
+
add(id, { entity, kind: 'state', field: g.field, op: g.op, values: g.values, step: i,
|
|
511
|
+
via: `tap "${t}" at step ${i}${st.target_id ? ` (to ${st.target_id})` : ''}`, evidence: g.at });
|
|
512
|
+
}
|
|
513
|
+
// an intermediate page that itself needs a record: so does every page behind it
|
|
514
|
+
const own = (nodes[st.target_id] || []).filter((r) => r.own && r.kind === 'instance');
|
|
515
|
+
if (st.target_id !== id) { for (const r of own) { add(id, { ...r, own: undefined, via: `${r.via} of ${st.target_id}` }); } }
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
for (const list of Object.values(nodes)) { for (const r of list) { delete r.own; } }
|
|
519
|
+
const needs = {}; const conflicts = {};
|
|
520
|
+
for (const [id, list] of Object.entries(nodes)) {
|
|
521
|
+
const [need, conflict] = aggregateNeeds(list);
|
|
522
|
+
needs[id] = need;
|
|
523
|
+
if (conflict.length) { conflicts[id] = conflict; }
|
|
524
|
+
}
|
|
525
|
+
const entities = [...new Set(Object.values(nodes).flat().map((r) => r.entity))].sort();
|
|
526
|
+
const labels = fieldValueLabels(files.map(([p, raw, blank]) => [p, raw, blank]), strings);
|
|
527
|
+
const sources = dataSources(files, entities, project);
|
|
528
|
+
const producers = producersFor(files, strings, graph, sources, project, rel);
|
|
529
|
+
// Entities a producer's early exit names (`addressId == null` -> address): a recipe must create
|
|
530
|
+
// one first, so they are modelled too (sources and producers), two rounds at most.
|
|
531
|
+
for (let round = 0; round < 2; round++) {
|
|
532
|
+
const named = new Set();
|
|
533
|
+
for (const list of Object.values(producers)) {
|
|
534
|
+
for (const p of list) {
|
|
535
|
+
for (const c of p.checks || []) {
|
|
536
|
+
for (const e of checkEntities(c, known)) { if (!entities.includes(e)) { named.add(e); } }
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (!named.size) { break; }
|
|
541
|
+
const extra = [...named].sort();
|
|
542
|
+
entities.push(...extra);
|
|
543
|
+
const more = dataSources(files, extra, project);
|
|
544
|
+
for (const [e, v] of more) { sources.set(e, v); }
|
|
545
|
+
Object.assign(producers, producersFor(files, strings, graph, more, project, rel));
|
|
546
|
+
}
|
|
547
|
+
entities.sort();
|
|
548
|
+
// each producer check with the entities it names, for the explorer (seed_recipes preconditions):
|
|
549
|
+
// id names are read in this one place, so both sides always agree
|
|
550
|
+
for (const list of Object.values(producers)) {
|
|
551
|
+
for (const p of list) { p.check_entities = (p.checks || []).map((c) => ({ check: c, entities: checkEntities(c, known) })); }
|
|
552
|
+
}
|
|
553
|
+
const model = { entities: {}, nodes, needs, conflicts };
|
|
554
|
+
for (const e of entities) {
|
|
555
|
+
const fields = {};
|
|
556
|
+
for (const r of Object.values(nodes).flat()) {
|
|
557
|
+
if (r.entity !== e || r.kind !== 'state') { continue; }
|
|
558
|
+
const f = (fields[r.field] ??= { values: {} });
|
|
559
|
+
for (const [v, l] of Object.entries(labels.get(`${e}.${r.field}`) || {})) { f.values[v] ??= l; }
|
|
560
|
+
}
|
|
561
|
+
// the value a new record starts in: the field's default in the entity's data class (`val status: Int = 0`)
|
|
562
|
+
const initial = entityDefaults(files, e);
|
|
563
|
+
for (const [name, f] of Object.entries(fields)) { if (initial.has(name)) { f.initial = initial.get(name); } }
|
|
564
|
+
model.entities[e] = { fields, sources: sources.get(e) || [], producers: producers[e] || [] };
|
|
565
|
+
}
|
|
566
|
+
return model;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/** CLI: stamp `data_requirements` on utg.json nodes and write data_model.json. */
|
|
570
|
+
export function main(argv = process.argv.slice(2)) {
|
|
571
|
+
const ap = new ArgumentParser({ prog: 'data_model.mjs' });
|
|
572
|
+
ap.add_argument('workspace'); ap.add_argument('--project', { required: true });
|
|
573
|
+
const a = ap.parse_args(argv);
|
|
574
|
+
const utgPath = path.join(a.workspace, 'utg.json');
|
|
575
|
+
const cpPath = path.join(a.workspace, 'click_paths.json');
|
|
576
|
+
const graph = jsonLoads(readText(utgPath, { encoding: 'utf-8' }));
|
|
577
|
+
let cp = {};
|
|
578
|
+
try { cp = jsonLoads(readText(cpPath, { encoding: 'utf-8' })); } catch { pyPrintErr('[data_model] no click_paths.json: instance requirements only'); }
|
|
579
|
+
const model = buildDataModel(graph, cp, a.project);
|
|
580
|
+
for (const n of get(graph, 'nodes', [])) {
|
|
581
|
+
if (model.nodes[n.id]) { n.data_requirements = model.nodes[n.id]; n.data_needs = model.needs[n.id]; } else { delete n.data_requirements; delete n.data_needs; }
|
|
582
|
+
if (model.conflicts[n.id]) { n.data_path_conflicts = model.conflicts[n.id]; } else { delete n.data_path_conflicts; }
|
|
583
|
+
}
|
|
584
|
+
writeText(utgPath, jsonDumps(graph, { ensure_ascii: false, indent: 2 }) + '\n');
|
|
585
|
+
writeText(path.join(a.workspace, 'data_model.json'), jsonDumps(model, { ensure_ascii: false, indent: 1 }) + '\n');
|
|
586
|
+
const states = Object.values(model.nodes).flat().filter((r) => r.kind === 'state').length;
|
|
587
|
+
pyPrint(`[data_model] entities=${Object.keys(model.entities).length} pages_with_requirements=${Object.keys(model.nodes).length} state_requirements=${states}`);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) { runMain(main); }
|