@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
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* The pointer ${WORK}/reqgen/current.json (run_pointer/v4) records "which run is current" and for which spec engine;
|
|
10
10
|
* SPEC_DIR / checkpoint probing / gates / adopt all find this run's outputs through it. Old run directories are kept,
|
|
11
11
|
* not deleted. One run directory belongs to one engine: switching engine starts a new run and leaves the other
|
|
12
|
-
* engine's run untouched. Legacy v3 (flat {run_dir, mode})
|
|
13
|
-
*
|
|
12
|
+
* engine's run untouched. Legacy v3 (flat {run_dir, mode}), v1 and the pipeline entry of v2 (one entry per engine)
|
|
13
|
+
* predate a2h-page-specgen, so they read as spec-generate (LEGACY_SPEC_ENGINE), never as the current default.
|
|
14
14
|
*
|
|
15
15
|
* node run_dir.mjs --work <WORK> --show [--json]
|
|
16
16
|
* Prints the current pointer's run_dir (--json: {run_dir, mode, engine, spec_dir, req_dir});
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
* node run_dir.mjs --work <WORK> --describe <run_dir> [--engine <e>]
|
|
20
20
|
* Read-only, does not touch the pointer: prints {run_dir, mode:"describe", engine, spec_dir, req_dir} from the layout
|
|
21
21
|
* (bootstrap uses it to backfill SPEC_DIR when the user gave run_dir explicitly)
|
|
22
|
-
* node run_dir.mjs --work <WORK> [--run-dir <explicit user value>] [--fresh] [--engine <e>]
|
|
22
|
+
* node run_dir.mjs --work <WORK> [--run-dir <explicit user value>] [--fresh] [--engine <e>] [--scope-id <id>]
|
|
23
23
|
* Before enrich.spec_gen starts, decides this run's directory and writes the pointer; stdout is one JSON line
|
|
24
24
|
* {run_dir, mode, engine, spec_dir, req_dir}
|
|
25
|
-
* mode = explicit (user gave run_dir) | resume (the pointer's run is unfinished, same engine, no --fresh) | new
|
|
25
|
+
* mode = explicit (user gave run_dir) | resume (the pointer's run is unfinished, same engine, same scope, no --fresh) | new
|
|
26
|
+
* --scope-id: the incremental scope this run is for (profile=incremental; progress_identity.mjs scope-id prints it).
|
|
27
|
+
* An unfinished run of ANOTHER scope is never resumed: its plan covers other pages, and page-specgen refuses
|
|
28
|
+
* a changed plan in the same output. No --scope-id = a whole-app run (matches only a pointer without one).
|
|
26
29
|
* engine = page-specgen (default) | spec-generate
|
|
27
|
-
* node run_dir.mjs --work <WORK> --record <actual run_dir> [--engine <e>]
|
|
30
|
+
* node run_dir.mjs --work <WORK> --record <actual run_dir> [--engine <e>] [--scope-id <id>]
|
|
28
31
|
* When the directory reported by the leaf differs from the expected one, update the pointer to the actual one
|
|
29
32
|
* node run_dir.mjs --work <WORK> --abandon
|
|
30
33
|
* Drop the pointer (renamed aside, the run directory is kept); prints {abandoned, to}
|
|
@@ -52,6 +55,8 @@ export function pointerPath(work) {
|
|
|
52
55
|
|
|
53
56
|
export const SPEC_ENGINES = ["spec-generate", "page-specgen"];
|
|
54
57
|
export const DEFAULT_SPEC_ENGINE = "page-specgen";
|
|
58
|
+
/** Engine of every pointer / ledger written before engines were recorded: only spec-generate existed then. */
|
|
59
|
+
export const LEGACY_SPEC_ENGINE = "spec-generate";
|
|
55
60
|
const POINTER_SCHEMA = "run_pointer/v4";
|
|
56
61
|
|
|
57
62
|
/** Known engine -> itself; empty -> default; anything else is returned as-is so the CLI can reject it. */
|
|
@@ -102,7 +107,8 @@ export function engineFamilyMismatch(dir, engine) {
|
|
|
102
107
|
/**
|
|
103
108
|
* Pointer file -> { run_dir, mode, engine }; absent / corrupt -> null.
|
|
104
109
|
* v4 / v3 / v1 are a flat {run_dir, mode} (v4 also carries the engine); v2 (one entry per engine) reads only the
|
|
105
|
-
* pipeline entry
|
|
110
|
+
* pipeline entry. v1 / v2 / v3 were all written by a2h-spec-generate, so they map to LEGACY_SPEC_ENGINE: resuming them
|
|
111
|
+
* under the default page-specgen would hand one engine's run directory to the other.
|
|
106
112
|
*/
|
|
107
113
|
function readPointerFile(work) {
|
|
108
114
|
let data;
|
|
@@ -114,17 +120,18 @@ function readPointerFile(work) {
|
|
|
114
120
|
if (!data || typeof data !== "object") return null;
|
|
115
121
|
if (data.schema === POINTER_SCHEMA) {
|
|
116
122
|
return typeof data.run_dir === "string"
|
|
117
|
-
? { run_dir: data.run_dir, mode: String(data.mode || ""), engine: normalizeEngine(data.engine)
|
|
123
|
+
? { run_dir: data.run_dir, mode: String(data.mode || ""), engine: normalizeEngine(data.engine),
|
|
124
|
+
scope_id: typeof data.scope_id === "string" && data.scope_id ? data.scope_id : null }
|
|
118
125
|
: null;
|
|
119
126
|
}
|
|
120
127
|
if (data.schema === "run_pointer/v2" && data.engines && typeof data.engines === "object") {
|
|
121
128
|
const mine = data.engines.pipeline;
|
|
122
129
|
return mine && typeof mine.run_dir === "string"
|
|
123
|
-
? { run_dir: mine.run_dir, mode: String(mine.mode || ""), engine:
|
|
130
|
+
? { run_dir: mine.run_dir, mode: String(mine.mode || ""), engine: LEGACY_SPEC_ENGINE }
|
|
124
131
|
: null;
|
|
125
132
|
}
|
|
126
133
|
if (typeof data.run_dir !== "string") return null;
|
|
127
|
-
return { run_dir: data.run_dir, mode: String(data.mode || ""), engine:
|
|
134
|
+
return { run_dir: data.run_dir, mode: String(data.mode || ""), engine: LEGACY_SPEC_ENGINE };
|
|
128
135
|
}
|
|
129
136
|
|
|
130
137
|
/** Pointer entry; absent / corrupt -> null. */
|
|
@@ -149,6 +156,7 @@ export function writePointer(work, runDir, mode, now = new Date(), extra = {}) {
|
|
|
149
156
|
engine: normalizeEngine(extra.engine),
|
|
150
157
|
run_dir: slash(runDir),
|
|
151
158
|
mode,
|
|
159
|
+
...(extra.scopeId ? { scope_id: String(extra.scopeId) } : {}),
|
|
152
160
|
updated_at: now.toISOString(),
|
|
153
161
|
};
|
|
154
162
|
const tmp = `${pointerPath(work)}.tmp-${process.pid}`;
|
|
@@ -196,24 +204,26 @@ function stamp(now) {
|
|
|
196
204
|
* Decide this run's directory and write the pointer. Does not create the run directory itself (a2h-spec-generate requires a new run directory to be nonexistent or empty).
|
|
197
205
|
* A run belongs to the engine that produced it: resume only when the pointer's engine matches, otherwise start a new run.
|
|
198
206
|
*/
|
|
199
|
-
export function resolveRunDir({ work, engine = DEFAULT_SPEC_ENGINE, explicit = "", fresh = false, now = new Date() }) {
|
|
207
|
+
export function resolveRunDir({ work, engine = DEFAULT_SPEC_ENGINE, explicit = "", fresh = false, now = new Date(), scopeId = "" }) {
|
|
200
208
|
const wanted = normalizeEngine(engine);
|
|
209
|
+
const scope = scopeId ? String(scopeId) : null;
|
|
201
210
|
if (explicit) {
|
|
202
211
|
const mismatch = engineFamilyMismatch(explicit, wanted);
|
|
203
212
|
if (mismatch) throw new Error(mismatch);
|
|
204
|
-
writePointer(work, explicit, "explicit", now, { engine: wanted });
|
|
213
|
+
writePointer(work, explicit, "explicit", now, { engine: wanted, scopeId: scope });
|
|
205
214
|
return describe(explicit, "explicit", wanted);
|
|
206
215
|
}
|
|
207
216
|
const mine = readPointerInfo(work);
|
|
208
217
|
const current = mine ? mine.run_dir : "";
|
|
209
218
|
const sameEngine = Boolean(mine) && normalizeEngine(mine.engine) === wanted;
|
|
210
|
-
|
|
211
|
-
|
|
219
|
+
const sameScope = Boolean(mine) && (mine.scope_id ?? null) === scope;
|
|
220
|
+
if (!fresh && current && fs.existsSync(current) && sameEngine && sameScope && !isRunComplete(current)) {
|
|
221
|
+
writePointer(work, current, "resume", now, { engine: wanted, scopeId: scope });
|
|
212
222
|
return describe(current, "resume", wanted);
|
|
213
223
|
}
|
|
214
224
|
let candidate = path.join(reqgenRoot(work), `run-${stamp(now)}`);
|
|
215
225
|
for (let i = 2; fs.existsSync(candidate); i++) candidate = path.join(reqgenRoot(work), `run-${stamp(now)}-${i}`);
|
|
216
|
-
writePointer(work, candidate, "new", now, { engine: wanted });
|
|
226
|
+
writePointer(work, candidate, "new", now, { engine: wanted, scopeId: scope });
|
|
217
227
|
return describe(candidate, "new", wanted);
|
|
218
228
|
}
|
|
219
229
|
|
|
@@ -230,7 +240,7 @@ export function abandonPointer(work, now = new Date()) {
|
|
|
230
240
|
function main() {
|
|
231
241
|
const args = parseArgs(process.argv.slice(2), {
|
|
232
242
|
required: ["work"],
|
|
233
|
-
defaults: { runDir: "", record: "", describe: "", engine: DEFAULT_SPEC_ENGINE },
|
|
243
|
+
defaults: { runDir: "", record: "", describe: "", engine: DEFAULT_SPEC_ENGINE, scopeId: "" },
|
|
234
244
|
flags: ["show", "fresh", "json", "abandon"],
|
|
235
245
|
});
|
|
236
246
|
const engine = normalizeEngine(args.engine);
|
|
@@ -258,7 +268,7 @@ function main() {
|
|
|
258
268
|
if (args.record) {
|
|
259
269
|
const bad = validateRunDirArg(args.record, { mustExist: true });
|
|
260
270
|
if (bad) throw new Error(`--record: ${bad}`);
|
|
261
|
-
writePointer(args.work, args.record, "recorded", new Date(), { engine });
|
|
271
|
+
writePointer(args.work, args.record, "recorded", new Date(), { engine, scopeId: args.scopeId });
|
|
262
272
|
process.stdout.write(JSON.stringify(describe(args.record, "recorded", engine)) + "\n");
|
|
263
273
|
return 0;
|
|
264
274
|
}
|
|
@@ -266,7 +276,7 @@ function main() {
|
|
|
266
276
|
const bad = validateRunDirArg(args.runDir, { mustExist: false });
|
|
267
277
|
if (bad) throw new Error(`--run-dir: ${bad}`);
|
|
268
278
|
}
|
|
269
|
-
const result = resolveRunDir({ work: args.work, engine, explicit: args.runDir, fresh: args.fresh });
|
|
279
|
+
const result = resolveRunDir({ work: args.work, engine, explicit: args.runDir, fresh: args.fresh, scopeId: args.scopeId });
|
|
270
280
|
process.stdout.write(JSON.stringify(result) + "\n");
|
|
271
281
|
return 0;
|
|
272
282
|
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Incremental scope model: ${HMOS}/.hometrans/incremental/scope.json, v1 (pages) and v2 (features).
|
|
4
|
+
*
|
|
5
|
+
* v1 — phase 1, written by a2h-batch-ui-align at I4: {"scope": ["<utg node id>", ...]}
|
|
6
|
+
* v2 — feature scope (hometrans-feature-scope-plan.html F-1):
|
|
7
|
+
* {
|
|
8
|
+
* "version": 2, "scope_id": "inc-<n>-<sha12>",
|
|
9
|
+
* "intent": "<the user's words / document title>", // optional
|
|
10
|
+
* "inputs": [{"kind": "pages|description|doc|android-diff|supplement", ...}], // optional provenance
|
|
11
|
+
* "features": [{
|
|
12
|
+
* "id": "f-…", "title": "…", "origin": "<doc#section | user words>", // origin optional
|
|
13
|
+
* "requirement": "<the requirement text, verbatim>", // optional: F1 quote; bounds the SPEC
|
|
14
|
+
* "source_refs": ["<android file[:line]>", ...], // F2 evidence (optional for NEW)
|
|
15
|
+
* "work": [
|
|
16
|
+
* {"type": "NEW", "page": "<utg node id>"},
|
|
17
|
+
* {"type": "SUP", "page": "<utg node id>", "missing": {...page_gap.mjs output...}},
|
|
18
|
+
* {"type": "CHG", "page": "<utg node id>", "change": "<what changed>"},
|
|
19
|
+
* {"type": "LOGIC", "unit": "<shared:<stem> | source unit>"},
|
|
20
|
+
* {"type": "SKIP", "page"|"unit": "…", "reason": "<already present | history-covered | new-development>"}
|
|
21
|
+
* ]}],
|
|
22
|
+
* "history": [...], // optional: requirement-scope.md history
|
|
23
|
+
* "pages": ["<utg node id>", ...] // DERIVED: NEW + SUP + CHG pages
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* `pages` keeps every phase-1 reader working unchanged (build_conversion_set --scope, page-specgen --scope,
|
|
27
|
+
* progress_identity); readers take `scope_id` from the file when present, so the three lanes agree on one id.
|
|
28
|
+
*
|
|
29
|
+
* scope_id: v1 = inc-<n>-sha256(sorted unique ids)/12 (unchanged, so phase-1 runs keep resuming); v2 = inc-<n>-
|
|
30
|
+
* sha256(canonical features: id + sorted work items)/12 with n = derived page count. Two v2 scopes over the same
|
|
31
|
+
* pages with different work (another feature, another missing list) are different runs.
|
|
32
|
+
*
|
|
33
|
+
* node scope_model.mjs validate <scope.json> → normalized JSON; exit 1 with the errors
|
|
34
|
+
* node scope_model.mjs write --from <draft.json> --out <scope.json>
|
|
35
|
+
* validates a draft (v2 without scope_id / pages), derives pages, computes scope_id, writes atomically
|
|
36
|
+
* node scope_model.mjs upgrade <v1.json> --out <v2.json> → v1 as v2 (one NEW feature per page, v1 scope_id kept)
|
|
37
|
+
* node scope_model.mjs check <scope.json> [--existing <existing.json>] [--ledger <migration_manifest.json>]
|
|
38
|
+
* discover.feature_scope's success check (see checkScope): fit to drive the run, or exit 1 with the reasons.
|
|
39
|
+
* `write` takes the same --existing / --ledger and refuses a NEW page the project already has.
|
|
40
|
+
* Exit: 0 ok; 1 invalid scope / check failed; 2 usage.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
import { createHash } from "node:crypto";
|
|
44
|
+
import fs from "node:fs";
|
|
45
|
+
import path from "node:path";
|
|
46
|
+
import { fileURLToPath } from "node:url";
|
|
47
|
+
|
|
48
|
+
import { pageExists } from "./feature_scope.mjs";
|
|
49
|
+
|
|
50
|
+
export const WORK_TYPES = ["NEW", "SUP", "CHG", "LOGIC", "SKIP"];
|
|
51
|
+
const PAGE_TYPES = new Set(["NEW", "SUP", "CHG"]);
|
|
52
|
+
|
|
53
|
+
const sha12 = (s) => createHash("sha256").update(s, "utf8").digest("hex").slice(0, 12);
|
|
54
|
+
|
|
55
|
+
/** v1 digest — byte-identical to build_conversion_set scopeIdOf / page-specgen lib/scope.mjs scopeIdOf. */
|
|
56
|
+
export function v1ScopeId(ids) {
|
|
57
|
+
const set = [...new Set(ids.map(String))].sort();
|
|
58
|
+
if (!set.length) throw new Error("scope holds no node id");
|
|
59
|
+
return `inc-${set.length}-${sha12(set.join("\n"))}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Stable JSON: object keys sorted at every level (arrays keep their order). */
|
|
63
|
+
function canonical(v) {
|
|
64
|
+
if (Array.isArray(v)) return `[${v.map(canonical).join(",")}]`;
|
|
65
|
+
if (v && typeof v === "object") {
|
|
66
|
+
return `{${Object.keys(v).sort().map((k) => `${JSON.stringify(k)}:${canonical(v[k])}`).join(",")}}`;
|
|
67
|
+
}
|
|
68
|
+
return JSON.stringify(v);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const workKey = (w) => `${w.type}\u0000${w.page ?? ""}\u0000${w.unit ?? ""}`;
|
|
72
|
+
|
|
73
|
+
/** Pages a v2 scope converts / supplements / changes (SKIP and LOGIC carry no page work). */
|
|
74
|
+
export function derivePages(features) {
|
|
75
|
+
const out = new Set();
|
|
76
|
+
for (const f of features) for (const w of f.work ?? []) if (PAGE_TYPES.has(w.type) && w.page) out.add(w.page);
|
|
77
|
+
return [...out].sort();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** v2 scope_id over the confirmed features: ids, and each item's type, target and content. */
|
|
81
|
+
export function v2ScopeId(features) {
|
|
82
|
+
const pages = derivePages(features);
|
|
83
|
+
const body = [...features]
|
|
84
|
+
.sort((a, b) => String(a.id).localeCompare(String(b.id)))
|
|
85
|
+
.map((f) => ({
|
|
86
|
+
id: f.id,
|
|
87
|
+
work: [...(f.work ?? [])].sort((a, b) => workKey(a).localeCompare(workKey(b)))
|
|
88
|
+
.map((w) => ({ type: w.type, page: w.page ?? null, unit: w.unit ?? null, missing: w.missing ?? null, change: w.change ?? null })),
|
|
89
|
+
}));
|
|
90
|
+
return `inc-${pages.length}-${sha12(canonical(body))}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Structural errors of a v2 draft or file (empty = valid). */
|
|
94
|
+
export function validateV2(doc) {
|
|
95
|
+
const errors = [];
|
|
96
|
+
if (!doc || typeof doc !== "object") return ["scope is not an object"];
|
|
97
|
+
if (!Array.isArray(doc.features) || !doc.features.length) errors.push("features must be a non-empty array");
|
|
98
|
+
const ids = new Set();
|
|
99
|
+
for (const [i, f] of (Array.isArray(doc.features) ? doc.features : []).entries()) {
|
|
100
|
+
const at = `features[${i}]`;
|
|
101
|
+
if (typeof f?.id !== "string" || !f.id) errors.push(`${at}.id missing`);
|
|
102
|
+
else if (ids.has(f.id)) errors.push(`${at}.id duplicates ${f.id}`);
|
|
103
|
+
else ids.add(f.id);
|
|
104
|
+
if (typeof f?.title !== "string" || !f.title) errors.push(`${at}.title missing`);
|
|
105
|
+
if (f?.requirement !== undefined && typeof f.requirement !== "string") errors.push(`${at}.requirement must be a string (the quoted requirement text)`);
|
|
106
|
+
if (!Array.isArray(f?.work) || !f.work.length) { errors.push(`${at}.work must be a non-empty array`); continue; }
|
|
107
|
+
for (const [j, w] of f.work.entries()) {
|
|
108
|
+
const wat = `${at}.work[${j}]`;
|
|
109
|
+
if (!WORK_TYPES.includes(w?.type)) { errors.push(`${wat}.type must be one of ${WORK_TYPES.join("|")}`); continue; }
|
|
110
|
+
if (PAGE_TYPES.has(w.type) && (typeof w.page !== "string" || !w.page)) errors.push(`${wat}: ${w.type} needs page`);
|
|
111
|
+
if (w.type === "LOGIC" && (typeof w.unit !== "string" || !w.unit)) errors.push(`${wat}: LOGIC needs unit`);
|
|
112
|
+
if (w.type === "SUP" && (!w.missing || typeof w.missing !== "object")) errors.push(`${wat}: SUP needs missing (page_gap.mjs output)`);
|
|
113
|
+
if (w.type === "SKIP" && (typeof w.reason !== "string" || !w.reason)) errors.push(`${wat}: SKIP needs reason`);
|
|
114
|
+
if (w.type === "SKIP" && !w.page && !w.unit) errors.push(`${wat}: SKIP needs page or unit`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(doc.features) && doc.features.length && !derivePages(doc.features).length
|
|
118
|
+
&& !doc.features.some((f) => (f.work ?? []).some((w) => w.type === "LOGIC"))) {
|
|
119
|
+
errors.push("scope has no NEW / SUP / CHG page and no LOGIC unit: nothing to migrate");
|
|
120
|
+
}
|
|
121
|
+
if (doc.scope_id !== undefined && doc.features && !errors.length && doc.scope_id !== v2ScopeId(doc.features)) {
|
|
122
|
+
errors.push(`scope_id ${doc.scope_id} does not match its features (${v2ScopeId(doc.features)}): edit the draft and re-run write`);
|
|
123
|
+
}
|
|
124
|
+
return errors;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Any scope file (v1 / v2) → { version, scope_id, pages, features, ... }. v1 becomes one NEW feature per page and
|
|
129
|
+
* keeps the v1 digest. Throws on an invalid scope.
|
|
130
|
+
*/
|
|
131
|
+
export function normalizeScope(doc) {
|
|
132
|
+
const v1List = Array.isArray(doc) ? doc : Array.isArray(doc?.scope) ? doc.scope : Array.isArray(doc?.nodes) ? doc.nodes : null;
|
|
133
|
+
if (doc?.version !== 2 && v1List) {
|
|
134
|
+
const ids = v1List.map((x) => (typeof x === "string" ? x : x?.id ?? x?.node)).filter((x) => typeof x === "string" && x);
|
|
135
|
+
const scope_id = v1ScopeId(ids);
|
|
136
|
+
const pages = [...new Set(ids)].sort();
|
|
137
|
+
return {
|
|
138
|
+
version: 2, scope_id, upgraded_from: 1,
|
|
139
|
+
features: pages.map((p) => ({ id: `page:${p}`, title: p, work: [{ type: "NEW", page: p }] })),
|
|
140
|
+
pages,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const errors = validateV2(doc);
|
|
144
|
+
if (errors.length) throw new Error(`invalid scope: ${errors.join("; ")}`);
|
|
145
|
+
const scope_id = typeof doc.scope_id === "string" && doc.scope_id ? doc.scope_id : v2ScopeId(doc.features);
|
|
146
|
+
return { ...doc, version: 2, scope_id, pages: derivePages(doc.features) };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** A v2 draft (no scope_id / pages needed) → the file to write. */
|
|
150
|
+
export function finalizeDraft(draft) {
|
|
151
|
+
const { scope_id: _drop, pages: _drop2, ...rest } = draft ?? {};
|
|
152
|
+
const errors = validateV2(rest);
|
|
153
|
+
if (errors.length) throw new Error(`invalid scope draft: ${errors.join("; ")}`);
|
|
154
|
+
return { version: 2, scope_id: v2ScopeId(rest.features), ...rest, pages: derivePages(rest.features) };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** NEW items whose page the HarmonyOS project already has (existing.json / ledger): those are SUP, not NEW. */
|
|
158
|
+
export function newOnExisting(features, existing = [], ledger = null) {
|
|
159
|
+
const out = [];
|
|
160
|
+
for (const f of features ?? []) {
|
|
161
|
+
for (const w of f.work ?? []) {
|
|
162
|
+
if (w.type !== "NEW" || !w.page || w.existing_ack) continue;
|
|
163
|
+
const ex = pageExists(w.page, existing, ledger);
|
|
164
|
+
if (ex.exists) out.push({ feature: f.id, page: w.page, via: ex.via });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return out;
|
|
168
|
+
}
|
|
169
|
+
const newOnExistingErrors = (hits) => hits.map((h) =>
|
|
170
|
+
`${h.feature}: NEW ${h.page} but the project already has it (${h.via}) — that is SUP: run feature_scope.mjs map + fill-gap `
|
|
171
|
+
+ `(or, when it really is a different page, add "existing_ack": "<why>" to the item)`);
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Is this scope.json fit to drive the run? (discover.feature_scope success check)
|
|
175
|
+
* - a valid v2 scope;
|
|
176
|
+
* - no NEW page the project already has (newOnExisting): an existing page is SUP, with its gap from fill-gap;
|
|
177
|
+
* - no SUP still marked needs_gap (fill-gap not run for it).
|
|
178
|
+
* Who confirmed the scope (the user under interactive, the model under auto) is not checked: these are the
|
|
179
|
+
* mechanical facts either confirmation must respect.
|
|
180
|
+
*/
|
|
181
|
+
export function checkScope(doc, { existing = [], ledger = null } = {}) {
|
|
182
|
+
let scope;
|
|
183
|
+
try { scope = normalizeScope(doc); } catch (err) { return { ok: false, errors: [err.message] }; }
|
|
184
|
+
const hasNew = scope.features.some((f) => (f.work ?? []).some((w) => w.type === "NEW"));
|
|
185
|
+
const errors = existing === null && hasNew
|
|
186
|
+
? ["existing.json is missing: run a2h-batch-ui-align/scripts/list_existing.mjs (feature-scope.md F3) so NEW can be told from SUP"]
|
|
187
|
+
: newOnExistingErrors(newOnExisting(scope.features, existing ?? [], ledger));
|
|
188
|
+
for (const f of scope.features) {
|
|
189
|
+
for (const w of f.work ?? []) if (w.type === "SUP" && w.needs_gap) errors.push(`${f.id}: SUP ${w.page} still needs_gap — run feature_scope.mjs fill-gap`);
|
|
190
|
+
}
|
|
191
|
+
const count = (t) => scope.features.reduce((n, f) => n + (f.work ?? []).filter((w) => w.type === t).length, 0);
|
|
192
|
+
return {
|
|
193
|
+
ok: !errors.length, errors, scope_id: scope.scope_id, features: scope.features.length, pages: scope.pages.length,
|
|
194
|
+
new: count("NEW"), sup: count("SUP"), chg: count("CHG"), logic: count("LOGIC"), skipped: count("SKIP"),
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function writeAtomic(file, doc) {
|
|
199
|
+
fs.mkdirSync(path.dirname(path.resolve(file)), { recursive: true });
|
|
200
|
+
const tmp = `${file}.tmp-${process.pid}`;
|
|
201
|
+
fs.writeFileSync(tmp, `${JSON.stringify(doc, null, 1)}\n`, "utf8");
|
|
202
|
+
fs.renameSync(tmp, file);
|
|
203
|
+
}
|
|
204
|
+
const readJson = (p) => JSON.parse(fs.readFileSync(p, "utf8"));
|
|
205
|
+
const existingList = (p) => (p && fs.existsSync(p) ? readJson(p).existing ?? [] : []);
|
|
206
|
+
const ledgerDoc = (p) => (p && fs.existsSync(p) ? readJson(p) : null);
|
|
207
|
+
|
|
208
|
+
export function main(argv = process.argv.slice(2)) {
|
|
209
|
+
const [cmd, ...rest] = argv;
|
|
210
|
+
const opt = (name) => { const i = rest.indexOf(name); return i >= 0 ? rest[i + 1] : undefined; };
|
|
211
|
+
const pos = rest.filter((x, i) => !x.startsWith("--") && !(i > 0 && rest[i - 1].startsWith("--")));
|
|
212
|
+
try {
|
|
213
|
+
if (cmd === "validate" && pos.length === 1) {
|
|
214
|
+
process.stdout.write(JSON.stringify(normalizeScope(readJson(pos[0]))) + "\n");
|
|
215
|
+
return 0;
|
|
216
|
+
}
|
|
217
|
+
if (cmd === "write" && opt("--from") && opt("--out")) {
|
|
218
|
+
const doc = finalizeDraft(readJson(opt("--from")));
|
|
219
|
+
if (opt("--existing") || opt("--ledger")) {
|
|
220
|
+
const errs = newOnExistingErrors(newOnExisting(doc.features, existingList(opt("--existing")), ledgerDoc(opt("--ledger"))));
|
|
221
|
+
if (errs.length) throw new Error(`invalid scope draft: ${errs.join("; ")}`);
|
|
222
|
+
}
|
|
223
|
+
writeAtomic(opt("--out"), doc);
|
|
224
|
+
process.stdout.write(JSON.stringify({ out: opt("--out"), scope_id: doc.scope_id, pages: doc.pages.length, features: doc.features.length }) + "\n");
|
|
225
|
+
return 0;
|
|
226
|
+
}
|
|
227
|
+
if (cmd === "check" && pos.length === 1) {
|
|
228
|
+
const r = checkScope(readJson(pos[0]), {
|
|
229
|
+
existing: opt("--existing") && !fs.existsSync(opt("--existing")) ? null : existingList(opt("--existing")), ledger: ledgerDoc(opt("--ledger")),
|
|
230
|
+
});
|
|
231
|
+
process.stdout.write(JSON.stringify(r) + "\n");
|
|
232
|
+
return r.ok ? 0 : 1;
|
|
233
|
+
}
|
|
234
|
+
if (cmd === "upgrade" && pos.length === 1 && opt("--out")) {
|
|
235
|
+
const doc = normalizeScope(readJson(pos[0]));
|
|
236
|
+
writeAtomic(opt("--out"), doc);
|
|
237
|
+
process.stdout.write(JSON.stringify({ out: opt("--out"), scope_id: doc.scope_id }) + "\n");
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
} catch (err) {
|
|
241
|
+
process.stderr.write(`[scope_model] ${err.message}\n`);
|
|
242
|
+
return /invalid scope/.test(err.message) ? 1 : 2;
|
|
243
|
+
}
|
|
244
|
+
process.stderr.write("usage: scope_model.mjs validate <scope.json> | write --from <draft.json> --out <scope.json> [--existing <existing.json>] | check <scope.json> [--existing …] [--ledger …] | upgrade <v1.json> --out <v2.json>\n");
|
|
245
|
+
return 2;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function canonicalScriptPath(p) {
|
|
249
|
+
let out;
|
|
250
|
+
try { out = fs.realpathSync.native(p); } catch { out = path.resolve(p); }
|
|
251
|
+
return process.platform === "win32" ? out.toLowerCase() : out;
|
|
252
|
+
}
|
|
253
|
+
if (process.argv[1] && canonicalScriptPath(process.argv[1]) === canonicalScriptPath(fileURLToPath(import.meta.url))) {
|
|
254
|
+
process.exitCode = main();
|
|
255
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Incremental phase 2 (W1.6): the report section of an incremental run — what this round's scope was and how each
|
|
3
|
+
// feature ended, what was skipped (SKIP items, specs carried from the previous campaign, scope pages no spec matched),
|
|
4
|
+
// and what the next scope should hold (unfinished features, Android pages changed since they were migrated, pages
|
|
5
|
+
// never migrated). Deterministic: run after logic.finalize step 4 (the ledger is current), print markdown (--json for
|
|
6
|
+
// the structured form). Never fails the node: a missing input only drops its part.
|
|
7
|
+
//
|
|
8
|
+
// node scope_report.mjs --hmos <HMOS> --scope-json <SCOPE_JSON> [--specs-json <specs.json>]
|
|
9
|
+
// [--android <ANDROID> --utg <utg.json>] [--work <WORK>] [--lang zh|en] [--json]
|
|
10
|
+
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
14
|
+
import { normalizeScope } from "./scope_model.mjs";
|
|
15
|
+
import { diagnose } from "./diagnose.mjs";
|
|
16
|
+
|
|
17
|
+
const readJsonOr = (p) => { try { return p ? JSON.parse(fs.readFileSync(p, "utf8")) : null; } catch { return null; } };
|
|
18
|
+
|
|
19
|
+
const T = {
|
|
20
|
+
zh: {
|
|
21
|
+
title: "## 增量范围", none: "这轮不是增量迁移(没有范围文件),本节从略。",
|
|
22
|
+
scope: "### 本轮范围", feature: "功能", status: "结果", work: "工作项",
|
|
23
|
+
st: { done: "已完成", partial: "部分完成", pending: "未完成", skipped: "全部跳过", unknown: "台账没有记录" },
|
|
24
|
+
skipped: "### 跳过的内容", skipItem: "范围里标为跳过", carried: "上一轮已落地且没有变化、本轮没有重新编码的功能清单",
|
|
25
|
+
unmatched: "范围里的页面没有生成功能清单", noSkip: "没有跳过的内容。",
|
|
26
|
+
next: "### 下一轮建议", unfinished: "本轮没做完的功能(下一轮继续)", changed: "迁移后 Android 侧又改过的页面",
|
|
27
|
+
fresh: "Android 新增、还没迁移过的页面", noNext: "没有需要下一轮处理的内容。",
|
|
28
|
+
hint: "下一轮可以直接用 SCOPE=auto,它会按台账和源码指纹推荐上面这些页面。",
|
|
29
|
+
},
|
|
30
|
+
en: {
|
|
31
|
+
title: "## Incremental scope", none: "This was not an incremental run (no scope file); section omitted.",
|
|
32
|
+
scope: "### This round's scope", feature: "Feature", status: "Result", work: "Work items",
|
|
33
|
+
st: { done: "done", partial: "partly done", pending: "not done", skipped: "all skipped", unknown: "not in the ledger" },
|
|
34
|
+
skipped: "### Skipped", skipItem: "marked SKIP in the scope", carried: "specs landed by the previous campaign and unchanged, not re-coded",
|
|
35
|
+
unmatched: "scope pages no spec was generated for", noSkip: "Nothing was skipped.",
|
|
36
|
+
next: "### Suggested next scope", unfinished: "features not finished this round (continue next round)",
|
|
37
|
+
changed: "pages whose Android source changed after they were migrated", fresh: "pages new on Android, never migrated",
|
|
38
|
+
noNext: "Nothing is left for a next round.",
|
|
39
|
+
hint: "The next round can use SCOPE=auto: it recommends these pages from the ledger and source fingerprints.",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const workLabel = (w) => `${w.type}${w.page ? ` ${w.page}` : ""}${w.unit ? ` ${w.unit}` : ""}`;
|
|
44
|
+
|
|
45
|
+
export function scopeReport({ hmos, scopeJson = "", specsJson = "", android = "", utg = "", work = "" }) {
|
|
46
|
+
const raw = readJsonOr(scopeJson);
|
|
47
|
+
if (!raw) return { incremental: false };
|
|
48
|
+
let scope;
|
|
49
|
+
try { scope = normalizeScope(raw); } catch (e) { return { incremental: true, error: String(e.message ?? e) }; }
|
|
50
|
+
const manifest = readJsonOr(path.join(hmos, ".hometrans", "migration_manifest.json"));
|
|
51
|
+
const ledgerFeatures = manifest?.features ?? {};
|
|
52
|
+
|
|
53
|
+
const features = scope.features.map((f) => ({
|
|
54
|
+
id: f.id, title: f.title ?? f.id,
|
|
55
|
+
status: ledgerFeatures[f.id]?.status ?? "unknown",
|
|
56
|
+
work: (f.work ?? []).map(workLabel),
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
const skipItems = scope.features.flatMap((f) => (f.work ?? []).filter((w) => w.type === "SKIP")
|
|
60
|
+
.map((w) => ({ feature: f.id, target: w.page ?? w.unit, reason: w.reason })));
|
|
61
|
+
const state = readJsonOr(path.join(hmos, ".hometrans", "spec_pipeline_state.json"));
|
|
62
|
+
const carried = Array.isArray(state?.carried) ? state.carried.map((c) => c.spec_id) : [];
|
|
63
|
+
const specs = readJsonOr(specsJson);
|
|
64
|
+
const unmatched = [...new Set([...(specs?.incomplete?.scopeUnmatched ?? []), ...(specs?.scope?.unmatched ?? [])].map(String))].sort();
|
|
65
|
+
|
|
66
|
+
const unfinished = features.filter((f) => f.status === "partial" || f.status === "pending").map((f) => f.id);
|
|
67
|
+
let changed = [], fresh = [];
|
|
68
|
+
if (android && utg) {
|
|
69
|
+
try {
|
|
70
|
+
const d = diagnose({ hmos, work, android, utg });
|
|
71
|
+
changed = (d.changed ?? []).map((c) => c.page);
|
|
72
|
+
fresh = d.new_pages ?? [];
|
|
73
|
+
} catch { /* no page graph / no ledger: no source-based suggestion */ }
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
incremental: true, scope_id: scope.scope_id, features,
|
|
77
|
+
skipped: { items: skipItems, carried, unmatched },
|
|
78
|
+
next: { unfinished, changed, new_pages: fresh },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function renderMarkdown(r, lang = "zh") {
|
|
83
|
+
const t = T[lang] ?? T.zh;
|
|
84
|
+
if (!r.incremental) return `${t.title}\n\n${t.none}\n`;
|
|
85
|
+
if (r.error) return `${t.title}\n\n${r.error}\n`;
|
|
86
|
+
const zh = t === T.zh;
|
|
87
|
+
const paren = (s) => (zh ? `(${s})` : ` (${s})`);
|
|
88
|
+
const colon = zh ? ":" : ": ";
|
|
89
|
+
const codes = (xs) => xs.map((x) => `\`${x}\``).join(", ");
|
|
90
|
+
const out = [t.title, "", `${t.scope}${paren(`scope_id \`${r.scope_id}\``)}`, "",
|
|
91
|
+
`| ${t.feature} | ${t.status} | ${t.work} |`, "|---|---|---|"];
|
|
92
|
+
for (const f of r.features) out.push(`| ${f.title} (\`${f.id}\`) | ${t.st[f.status] ?? f.status} | ${f.work.join("; ")} |`);
|
|
93
|
+
out.push("", t.skipped, "");
|
|
94
|
+
const s = r.skipped;
|
|
95
|
+
if (!s.items.length && !s.carried.length && !s.unmatched.length) out.push(t.noSkip);
|
|
96
|
+
if (s.items.length) out.push(`- ${t.skipItem}${colon.trim()}`, ...s.items.map((x) => ` - \`${x.target}\`${paren(x.feature)} — ${x.reason}`));
|
|
97
|
+
if (s.carried.length) out.push(`- ${t.carried}${paren(s.carried.length)}${colon}${codes(s.carried)}`);
|
|
98
|
+
if (s.unmatched.length) out.push(`- ${t.unmatched}${colon}${codes(s.unmatched)}`);
|
|
99
|
+
out.push("", t.next, "");
|
|
100
|
+
const n = r.next;
|
|
101
|
+
if (!n.unfinished.length && !n.changed.length && !n.new_pages.length) out.push(t.noNext);
|
|
102
|
+
else {
|
|
103
|
+
if (n.unfinished.length) out.push(`- ${t.unfinished}${colon}${codes(n.unfinished)}`);
|
|
104
|
+
if (n.changed.length) out.push(`- ${t.changed}${colon}${codes(n.changed)}`);
|
|
105
|
+
if (n.new_pages.length) out.push(`- ${t.fresh}${colon}${codes(n.new_pages)}`);
|
|
106
|
+
if (n.changed.length || n.new_pages.length) out.push("", t.hint);
|
|
107
|
+
}
|
|
108
|
+
return `${out.join("\n")}\n`;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function main(argv = process.argv.slice(2)) {
|
|
112
|
+
const opt = (name) => { const i = argv.indexOf(name); return i >= 0 ? argv[i + 1] : undefined; };
|
|
113
|
+
const hmos = opt("--hmos");
|
|
114
|
+
if (!hmos) { process.stderr.write("usage: scope_report.mjs --hmos <HMOS> --scope-json <file> [--specs-json f] [--android d --utg f] [--work d] [--lang zh|en] [--json]\n"); return 2; }
|
|
115
|
+
const r = scopeReport({ hmos, scopeJson: opt("--scope-json") ?? "", specsJson: opt("--specs-json") ?? "",
|
|
116
|
+
android: opt("--android") ?? "", utg: opt("--utg") ?? "", work: opt("--work") ?? "" });
|
|
117
|
+
process.stdout.write(argv.includes("--json") ? `${JSON.stringify(r, null, 1)}\n` : renderMarkdown(r, opt("--lang") ?? "zh"));
|
|
118
|
+
return 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function canonical(p) {
|
|
122
|
+
let out;
|
|
123
|
+
try { out = fs.realpathSync.native(p); } catch { out = path.resolve(p); }
|
|
124
|
+
return process.platform === "win32" ? out.toLowerCase() : out;
|
|
125
|
+
}
|
|
126
|
+
if (process.argv[1] && canonical(process.argv[1]) === canonical(fileURLToPath(import.meta.url))) {
|
|
127
|
+
process.exitCode = main();
|
|
128
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* source_fp.mjs — per-page Android source fingerprint (incremental phase 2, W3.1).
|
|
4
|
+
*
|
|
5
|
+
* The migration ledger says which pages were migrated; it did not say from which source. Without that, a page the
|
|
6
|
+
* Android team changed after its migration looks "done" forever, unless the user knows and passes a git range. This
|
|
7
|
+
* fingerprints what a page is made of, so a later run compares and lists the changed pages itself.
|
|
8
|
+
*
|
|
9
|
+
* node source_fp.mjs --android <dir> --utg <utg.json> [--pages <id,id,…>] [--out <fp.json>]
|
|
10
|
+
* → {pages: {<page id>: {fp, files: [<rel path>], missing: [<anchor not found>]}}}
|
|
11
|
+
*
|
|
12
|
+
* A page's files: its UTG anchors (declared_at, identity_text_from, widgets[].at — the same anchors feature_scope.mjs
|
|
13
|
+
* maps features with), resolved in the current Android tree by path suffix (UTG paths may be absolute paths of the
|
|
14
|
+
* machine that built the graph), plus every layout they reference (R.layout.x / @layout/x), recursively through
|
|
15
|
+
* <include>. fp = sha256 over (sorted relative path + sha256 of the content with line endings normalised), so a
|
|
16
|
+
* CRLF / LF difference is not a change. An anchor that resolves to nothing is listed in `missing` (a deleted file is
|
|
17
|
+
* a change too: it changes fp).
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createHash } from "node:crypto";
|
|
21
|
+
import fs from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
|
|
25
|
+
import { pageFiles, sameFile, walk } from "./feature_scope.mjs";
|
|
26
|
+
|
|
27
|
+
const slash = (p) => String(p ?? "").replace(/\\/g, "/");
|
|
28
|
+
const sha = (s) => createHash("sha256").update(s, "utf8").digest("hex");
|
|
29
|
+
|
|
30
|
+
/** An index of the Android tree: relative paths, and layouts by name. */
|
|
31
|
+
export function treeIndex(android) {
|
|
32
|
+
const root = path.resolve(android);
|
|
33
|
+
const rels = walk(root).map((f) => slash(path.relative(root, f)));
|
|
34
|
+
const layouts = new Map();
|
|
35
|
+
for (const r of rels) {
|
|
36
|
+
const m = r.match(/(?:^|\/)res\/layout[^/]*\/([\w]+)\.xml$/);
|
|
37
|
+
if (m) layouts.set(m[1], [...(layouts.get(m[1]) ?? []), r]);
|
|
38
|
+
}
|
|
39
|
+
return { root, rels, layouts };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Resolve one UTG anchor path to a relative path in the tree (longest suffix match), or null. */
|
|
43
|
+
export function resolveAnchor(index, anchor) {
|
|
44
|
+
const hits = index.rels.filter((r) => sameFile(r, anchor));
|
|
45
|
+
if (!hits.length) return null;
|
|
46
|
+
return hits.sort((a, b) => b.length - a.length)[0];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The files a page is made of: resolved anchors + referenced layouts (recursive). */
|
|
50
|
+
export function pageSourceFiles(index, anchors) {
|
|
51
|
+
const files = new Set();
|
|
52
|
+
const missing = [];
|
|
53
|
+
for (const a of anchors) {
|
|
54
|
+
const r = resolveAnchor(index, a);
|
|
55
|
+
if (r) files.add(r); else missing.push(slash(a));
|
|
56
|
+
}
|
|
57
|
+
const queue = [...files];
|
|
58
|
+
while (queue.length) {
|
|
59
|
+
const rel = queue.shift();
|
|
60
|
+
let text;
|
|
61
|
+
try { text = fs.readFileSync(path.join(index.root, rel), "utf8"); } catch { continue; }
|
|
62
|
+
for (const m of text.matchAll(/(?:R\.layout\.|@layout\/)(\w+)/g)) {
|
|
63
|
+
for (const l of index.layouts.get(m[1]) ?? []) {
|
|
64
|
+
if (!files.has(l)) { files.add(l); queue.push(l); }
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return { files: [...files].sort(), missing: [...new Set(missing)].sort() };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** fp over the sorted files' paths and normalised contents (a missing anchor contributes its name). */
|
|
72
|
+
export function fingerprint(index, { files, missing }) {
|
|
73
|
+
const h = createHash("sha256");
|
|
74
|
+
for (const rel of files) {
|
|
75
|
+
let text = "";
|
|
76
|
+
try { text = fs.readFileSync(path.join(index.root, rel), "utf8"); } catch { text = "\u0000unreadable"; }
|
|
77
|
+
h.update(`${rel}\u0000${sha(text.replace(/\r\n?/g, "\n"))}\n`);
|
|
78
|
+
}
|
|
79
|
+
for (const m of missing) h.update(`missing\u0000${m}\n`);
|
|
80
|
+
return h.digest("hex");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** page id -> {fp, files, missing} for the requested pages (all pages of the UTG by default). */
|
|
84
|
+
export function pageFingerprints({ android, utgDoc, pages = null }) {
|
|
85
|
+
const index = treeIndex(android);
|
|
86
|
+
const byPage = pageFiles(utgDoc);
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const [id, p] of byPage) {
|
|
89
|
+
if (pages && !pages.includes(id)) continue;
|
|
90
|
+
const src = pageSourceFiles(index, p.files);
|
|
91
|
+
out[id] = { fp: fingerprint(index, src), files: src.files, ...(src.missing.length ? { missing: src.missing } : {}) };
|
|
92
|
+
}
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function main(argv = process.argv.slice(2)) {
|
|
97
|
+
const o = {};
|
|
98
|
+
for (let i = 0; i < argv.length; i++) {
|
|
99
|
+
const a = argv[i]; const v = argv[i + 1];
|
|
100
|
+
if (!a.startsWith("--") || v === undefined || v.startsWith("--")) { process.stderr.write(`[source_fp] bad argument ${a}\n`); return 2; }
|
|
101
|
+
o[a.slice(2)] = v; i += 1;
|
|
102
|
+
}
|
|
103
|
+
if (!o.android || !o.utg) { process.stderr.write("usage: source_fp.mjs --android <dir> --utg <utg.json> [--pages a,b] [--out <fp.json>]\n"); return 2; }
|
|
104
|
+
let utgDoc;
|
|
105
|
+
try { utgDoc = JSON.parse(fs.readFileSync(o.utg, "utf8")); } catch (e) { process.stderr.write(`[source_fp] cannot read ${o.utg}: ${e.message}\n`); return 2; }
|
|
106
|
+
const pages = o.pages ? o.pages.split(",").map((s) => s.trim()).filter(Boolean) : null;
|
|
107
|
+
const doc = { android: slash(path.resolve(o.android)), pages: pageFingerprints({ android: o.android, utgDoc, pages }) };
|
|
108
|
+
if (o.out) { fs.mkdirSync(path.dirname(path.resolve(o.out)), { recursive: true }); fs.writeFileSync(o.out, `${JSON.stringify(doc, null, 1)}\n`, "utf8"); }
|
|
109
|
+
process.stdout.write(JSON.stringify({ pages: Object.keys(doc.pages).length, out: o.out ?? null }) + "\n");
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function canonical(p) {
|
|
114
|
+
let out;
|
|
115
|
+
try { out = fs.realpathSync.native(p); } catch { out = path.resolve(p); }
|
|
116
|
+
return process.platform === "win32" ? out.toLowerCase() : out;
|
|
117
|
+
}
|
|
118
|
+
if (process.argv[1] && canonical(process.argv[1]) === canonical(fileURLToPath(import.meta.url))) {
|
|
119
|
+
process.exitCode = main();
|
|
120
|
+
}
|