@buaa_smat/hometrans 0.1.17 → 0.1.19
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 +120 -56
- package/agents/code-reviewer.md +321 -65
- package/agents/logic-coder.md +113 -88
- package/agents/logic-context-builder.md +47 -29
- package/agents/scripts/hmos-precheck/backends/arkts.mjs +567 -0
- package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +159 -0
- package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +398 -0
- package/agents/scripts/hmos-precheck/backends/codelinter.mjs +250 -0
- package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +321 -0
- package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +247 -0
- package/agents/scripts/hmos-precheck/core/config.mjs +184 -0
- package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +20 -0
- package/agents/scripts/hmos-precheck/core/process_adapter.mjs +47 -0
- package/agents/scripts/hmos-precheck/core/project_catalog.mjs +50 -0
- package/agents/scripts/hmos-precheck/core/result_projection.mjs +147 -0
- package/agents/scripts/hmos-precheck/core/scope_plan.mjs +131 -0
- package/agents/scripts/hmos-precheck/core/sdk_context.mjs +67 -0
- package/agents/scripts/hmos-precheck/docs/architecture.md +37 -0
- package/agents/scripts/hmos-precheck/docs/performance-optimization.md +28 -0
- package/agents/scripts/hmos-precheck/docs/upstream-reference.json +19 -0
- package/agents/scripts/hmos-precheck/docs/validation.md +50 -0
- package/agents/scripts/hmos-precheck/index.mjs +17 -0
- package/agents/scripts/hmos-precheck/invocation.mjs +231 -0
- package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +32 -0
- package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +64 -0
- package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +59 -0
- package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +54 -0
- package/agents/scripts/platform_query.mjs +626 -0
- package/agents/scripts/platform_query.test.mjs +422 -0
- package/agents/self-test-fixer.md +36 -34
- package/agents/self-tester.md +123 -143
- package/agents/test-case-generation-generator.md +317 -0
- package/agents/test-case-generation-validator.md +231 -0
- package/dist/cli/config-store.js +16 -63
- package/dist/cli/env-vars.js +1 -3
- package/dist/cli/index.js +0 -11
- package/dist/cli/init.js +123 -204
- package/dist/cli/uninstall.js +3 -127
- package/dist/utils/regex.js +8 -0
- package/env-requirements.json +55 -54
- package/package.json +6 -6
- package/resource/convert_pipeline_process.svg +103 -0
- package/resource/project_architecture.svg +122 -0
- package/resource/title_dark.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +345 -43
- package/skills/hmos-batch-ui-align/references/conversion-procedure.md +661 -180
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
- package/skills/hmos-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
- package/skills/hmos-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
- package/skills/hmos-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
- package/skills/hmos-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
- package/skills/hmos-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
- package/skills/hmos-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
- package/skills/hmos-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
- package/skills/hmos-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
- package/skills/hmos-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
- package/skills/hmos-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
- package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -911
- package/skills/hmos-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
- package/skills/hmos-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
- package/skills/hmos-batch-ui-align/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +133 -0
- package/skills/hmos-batch-ui-align/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
- package/skills/hmos-batch-ui-align/scripts/android_parse_fast.ts +1798 -0
- package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +1592 -0
- package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +752 -0
- package/skills/hmos-convert-pipeline/SKILL.md +168 -121
- package/skills/hmos-fix-build-errors/SKILL.md +87 -67
- package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -219
- package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -157
- package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -131
- package/skills/hmos-incremental-ui-align/README.md +53 -36
- package/skills/hmos-incremental-ui-align/SKILL.md +179 -23
- package/skills/hmos-incremental-ui-align/diff_analysis.md +52 -52
- package/skills/hmos-incremental-ui-align/page_align.md +62 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +38 -2
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -648
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2088 -2088
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -1033
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -1183
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -576
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -297
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -395
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +902 -902
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -106
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -1178
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/MVVM/346/250/241/345/274/217V1.md +911 -911
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +354 -354
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -11
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md +206 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md +373 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md +158 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md +750 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md +1704 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md +1012 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md +164 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md +840 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md +856 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md +83 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md +294 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md +1407 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +1220 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md +47 -0
- package/skills/hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md +840 -0
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +74 -0
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +34 -4
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -117
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +937 -0
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +343 -0
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +44 -5
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +977 -0
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +188 -0
- package/skills/hmos-integration-test/README.md +61 -70
- package/skills/hmos-integration-test/SKILL.md +128 -111
- package/skills/hmos-resources-convert/SKILL.md +334 -66
- package/skills/hmos-resources-convert/references/code-vector-icon-rules.md +335 -0
- package/skills/hmos-resources-convert/references/conversion-rules.md +676 -663
- package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +410 -388
- package/skills/hmos-resources-convert/references/lottie-conversion-rules.md +219 -0
- package/skills/hmos-resources-convert/references/resource-mapping-rules.md +482 -457
- package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +592 -513
- package/skills/hmos-resources-convert/scripts/a2h_resource_convert.ts +2163 -0
- package/skills/hmos-resources-convert/scripts/code_vector_icons.ts +591 -0
- package/skills/hmos-resources-convert/scripts/svg_fidelity_check.ts +632 -0
- package/skills/hmos-spec-generate/SKILL.md +293 -214
- package/skills/hmos-spec-generate/scripts/parse_requirements.ts +515 -0
- package/skills/hmos-spec-generate/template/REQ.txt +22 -0
- package/skills/hmos-spec-generate/template/REQ.xlsx +0 -0
- package/skills/hmos-test-case-generation/README.md +241 -0
- package/skills/hmos-test-case-generation/SKILL.md +324 -0
- package/skills/hmos-test-case-generation/references/contract.md +315 -0
- package/skills/hmos-test-case-generation/references/review-notes-template.md +84 -0
- package/skills/hmos-test-case-generation/references/ui-elements-schema.md +142 -0
- package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +550 -0
- package/skills/hmos-test-case-generation/tools/validate.ts +1312 -0
- package/tools/bfs-crawl/README.md +73 -0
- package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +1662 -0
- package/tools/test-tools/autotest/config.ts +175 -0
- package/tools/test-tools/autotest/deps/autotest-agent-0.1.1.tgz +0 -0
- package/tools/test-tools/autotest/docs/README.md +266 -0
- package/tools/test-tools/autotest/{testcases_schema.md → docs/testcases_schema.md} +1 -1
- package/tools/test-tools/autotest/engine/batch-launcher.ts +327 -0
- package/tools/test-tools/autotest/engine/report-tool.ts +773 -0
- package/tools/test-tools/autotest/engine/self-test-runner.ts +961 -0
- package/tools/test-tools/autotest/engine/testcases-tool.ts +246 -0
- package/tools/test-tools/autotest/paths.ts +41 -0
- package/tools/test-tools/autotest/resolve-metadata-tool.ts +143 -0
- package/tools/test-tools/autotest/runner/logger.ts +45 -0
- package/tools/test-tools/autotest/runner/process-utils.ts +41 -0
- package/tools/test-tools/autotest/validate.ts +167 -0
- package/agents/build-fixer.md +0 -385
- package/agents/logic-coder/scripts/platform_context_query.py +0 -568
- package/agents/review-fixer.md +0 -405
- package/agents/spec-generator.md +0 -541
- package/dist/cli/mcp-setup.js +0 -258
- package/dist/cli/mcp.js +0 -94
- package/dist/context/index.js +0 -694
- package/resource/migration_process.svg +0 -94
- package/resource/migration_process_transparent.svg +0 -93
- package/skills/hmos-batch-ui-align/scripts/android_parse_fast.py +0 -1606
- package/skills/hmos-incremental-ui-align/scripts/__pycache__/app_feature_verify.cpython-314.pyc +0 -0
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.py +0 -542
- package/skills/hmos-incremental-ui-align/scripts/page_capture.py +0 -597
- package/skills/hmos-resources-convert/evals/evals.json +0 -171
- package/skills/hmos-resources-convert/template/AppScope/app.json5 +0 -10
- package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +0 -8
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +0 -7
- package/skills/hmos-resources-convert/template/build-profile.json5 +0 -42
- package/skills/hmos-resources-convert/template/code-linter.json5 +0 -32
- package/skills/hmos-resources-convert/template/entry/build-profile.json5 +0 -33
- package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +0 -6
- package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +0 -23
- package/skills/hmos-resources-convert/template/entry/oh-package.json5 +0 -10
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +0 -48
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +0 -16
- package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +0 -23
- package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +0 -55
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +0 -16
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +0 -7
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +0 -3
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +0 -5
- package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +0 -8
- package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +0 -2
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +0 -35
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +0 -5
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +0 -16
- package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +0 -5
- package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +0 -33
- package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +0 -23
- package/skills/hmos-resources-convert/template/hvigorfile.ts +0 -6
- package/skills/hmos-resources-convert/template/oh-package-lock.json5 +0 -28
- package/skills/hmos-resources-convert/template/oh-package.json5 +0 -10
- package/skills/hmos-resources-convert/tools/apktool_3.0.1.jar +0 -0
- package/skills/hmos-spec-generate/references/android-platform-tokens.md +0 -105
- package/skills/hmos-spec-generate/references/spec-sample-1.md +0 -78
- package/skills/hmos-spec-generate/references/spec-sample-2.md +0 -58
- package/skills/hmos-spec-generate/references/spec-sample-3.md +0 -116
- package/skills/hmos-spec-generate/references/step4-report-template.md +0 -33
- package/tools/test-tools/autotest/README.md +0 -238
- package/tools/test-tools/autotest/pyproject.toml +0 -26
- package/tools/test-tools/autotest/report_tool.py +0 -759
- package/tools/test-tools/autotest/self_test_runner.py +0 -895
- package/tools/test-tools/autotest/testcases_tool.py +0 -215
- package/tools/test-tools/autotest/uv.lock +0 -3156
- package/tools/test-tools/harmony_autotest-0.1.0-py3-none-any.whl +0 -0
- package/tools/test-tools/hypium-6.1.0.210-py3-none-any.whl +0 -0
- package/tools/test-tools/hypium_mcp-0.6.5-py3-none-any.whl +0 -0
- package/tools/test-tools/xdevice-6.1.0.210-py3-none-any.whl +0 -0
- package/tools/test-tools/xdevice_devicetest-6.1.0.210-py3-none-any.whl +0 -0
- package/tools/test-tools/xdevice_ohos-6.1.0.210-py3-none-any.whl +0 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { writeFile } from "node:fs/promises";
|
|
2
|
+
import { exists } from "./process_adapter.mjs";
|
|
3
|
+
|
|
4
|
+
function repairHint(item) {
|
|
5
|
+
const rule = String(item.rule ?? "");
|
|
6
|
+
const file = String(item.file ?? "the flagged file");
|
|
7
|
+
const line = item.line ?? "?";
|
|
8
|
+
const message = String(item.message ?? "");
|
|
9
|
+
if (item.profile === "arkts-diff") return `Edit the ArkTS code at ${file}:${line} to satisfy compiler rule \`${rule}\`. Resolve the exact reported error: ${message}`;
|
|
10
|
+
if (item.profile === "codelinter-diff") return `Edit ${file}:${line} to satisfy linter rule \`${rule}\`. Apply the rule-specific fix implied by: ${message}`;
|
|
11
|
+
return `Edit ${file}:${line} to remove the blocking condition reported as \`${rule}\`: ${message}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function warningHint(item) {
|
|
15
|
+
const profile = String(item.profile ?? "");
|
|
16
|
+
const rule = String(item.rule ?? "");
|
|
17
|
+
if (rule === "git-diff-failed") return "Use a valid git base/head ref and ensure the repository has the required history.";
|
|
18
|
+
if (rule === "invalid-profile") return "Remove unsupported profiles from CLI/config and use only supported profiles.";
|
|
19
|
+
if (profile === "arkts-diff") return "Configure HarmonyOS command-line tools if you need ArkTS validation.";
|
|
20
|
+
if (profile === "codelinter-diff") return "Install or configure codelinter if you need lint validation.";
|
|
21
|
+
return "Restore the skipped validation path if you need full confidence from this check run.";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function warningIssue(item, blocking) {
|
|
25
|
+
const profile = String(item.profile ?? "validation");
|
|
26
|
+
const message = String(item.message ?? "check unavailable");
|
|
27
|
+
const label = profile.endsWith("-diff") ? profile.slice(0, -5) : profile;
|
|
28
|
+
const rule = String(item.rule ?? "");
|
|
29
|
+
const problem = ["git-diff-failed", "invalid-profile"].includes(rule) ? message : `${label} check skipped: ${message}`;
|
|
30
|
+
return { kind: rule || "environment-issue", blocking, agent_fixable: false, problem, fix: warningHint(item), fix_policy: "off", origin: { profile, source_class: String(item.source_class ?? "policy") }, evidence: { status: String(item.evidence?.status ?? "partial") } };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function fileExists(pathname) {
|
|
34
|
+
return Boolean(pathname) && await exists(String(pathname));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function sanitizeIssueEvidence(evidence) {
|
|
38
|
+
if (!evidence) return null;
|
|
39
|
+
let status = String(evidence.status ?? "partial");
|
|
40
|
+
const candidates = [...(Array.isArray(evidence.raw_files) ? evidence.raw_files : []), evidence.raw_file].filter((item) => typeof item === "string");
|
|
41
|
+
const rawFiles = [];
|
|
42
|
+
for (const file of candidates) if (await fileExists(file) && !rawFiles.includes(file)) rawFiles.push(file);
|
|
43
|
+
if (status === "raw_structured" && !rawFiles.length) status = "partial";
|
|
44
|
+
return rawFiles.length ? { status, raw_files: rawFiles } : { status };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function dedupeIssues(issues) {
|
|
48
|
+
const deduped = [];
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
for (const issue of issues) {
|
|
51
|
+
const key = JSON.stringify([issue.kind, issue.file, issue.line, issue.column, issue.rule, issue.problem, issue.fix]);
|
|
52
|
+
if (seen.has(key)) continue;
|
|
53
|
+
seen.add(key);
|
|
54
|
+
deduped.push(issue);
|
|
55
|
+
}
|
|
56
|
+
return deduped;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function rawArtifactCandidates(value, output = []) {
|
|
60
|
+
if (!value || typeof value !== "object") return output;
|
|
61
|
+
for (const [key, child] of Object.entries(value)) {
|
|
62
|
+
if (key === "raw_json" && typeof child === "string") output.push(child);
|
|
63
|
+
else if (child && typeof child === "object") rawArtifactCandidates(child, output);
|
|
64
|
+
}
|
|
65
|
+
return [...new Set(output)];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function existingRawFiles(backend) {
|
|
69
|
+
const files = [];
|
|
70
|
+
for (const candidate of rawArtifactCandidates(backend.artifact_paths)) if (await fileExists(candidate)) files.push(candidate);
|
|
71
|
+
return files;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function effectiveBackendEvidenceStatus(backend) {
|
|
75
|
+
const status = String(backend.evidence_status ?? "partial");
|
|
76
|
+
if (status === "raw_structured" && !(await existingRawFiles(backend)).length) return "partial";
|
|
77
|
+
return status;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function repairIssue(item) {
|
|
81
|
+
const issue = { kind: String(item.rule ?? "code-issue"), blocking: true, agent_fixable: true, file: item.file ?? null, line: item.line ?? null, column: item.column ?? null, rule: item.rule ?? null, problem: item.message ?? "", fix: repairHint(item), fix_policy: String(item.fix_policy ?? "off"), confidence: String(item.confidence ?? "unknown"), origin: { profile: String(item.profile ?? "validation"), source_class: String(item.source_class ?? "policy"), raw_rule: String(item.raw_rule ?? item.rule ?? "") } };
|
|
82
|
+
const evidence = await sanitizeIssueEvidence(item.evidence && typeof item.evidence === "object" ? item.evidence : null);
|
|
83
|
+
if (evidence) issue.evidence = evidence;
|
|
84
|
+
return issue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function repairSummary(hardFindings) {
|
|
88
|
+
const fileCount = new Set(hardFindings.map((item) => item.file).filter(Boolean)).size;
|
|
89
|
+
return `Fix ${hardFindings.length} blocking issue(s) across ${fileCount || 1} file(s).`;
|
|
90
|
+
}
|
|
91
|
+
function blockingEnvironmentSummary(count) { return `Resolve ${count} blocking environment issue(s).`; }
|
|
92
|
+
function degradedSummary(count) { return `No blocking code issues, but ${count} profile(s) were not fully checked.`; }
|
|
93
|
+
|
|
94
|
+
function overallStatus(summaryCounts, backendResults, findings = []) {
|
|
95
|
+
if (summaryCounts.hard_fixable) return "fail";
|
|
96
|
+
if (summaryCounts.not_checked) return "fail";
|
|
97
|
+
return "pass";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async function projectAgentResult(payload) {
|
|
101
|
+
const rawFiles = [...new Set((await Promise.all(Object.values(payload.backend_results).map((backend) => existingRawFiles(backend)))).flat())];
|
|
102
|
+
const evidenceStatuses = new Set(await Promise.all(Object.values(payload.backend_results).map((backend) => effectiveBackendEvidenceStatus(backend))));
|
|
103
|
+
let evidenceStatus = "partial";
|
|
104
|
+
if (evidenceStatuses.size === 1 && evidenceStatuses.has("raw_structured")) evidenceStatus = "raw_structured";
|
|
105
|
+
else if (evidenceStatuses.has("derived_from_text")) evidenceStatus = "derived_from_text";
|
|
106
|
+
const hardFindings = payload.findings.filter((item) => item.classification === "hard_fixable");
|
|
107
|
+
const blockingFindings = payload.findings.filter((item) => item.classification === "not_checked");
|
|
108
|
+
const blockingIssues = dedupeIssues(blockingFindings.map((item) => warningIssue(item, payload.status === "fail")));
|
|
109
|
+
if (hardFindings.length) {
|
|
110
|
+
const issues = dedupeIssues((await Promise.all(hardFindings.map((item) => repairIssue(item)))).concat(blockingIssues));
|
|
111
|
+
let summary = repairSummary(hardFindings);
|
|
112
|
+
if (blockingIssues.length) summary = `${summary} ${blockingEnvironmentSummary(blockingIssues.length)}`;
|
|
113
|
+
return { ok: false, schema_version: "hmos_precheck.agent.v1", status: "fail", run_id: payload.run_id, read_file: payload.artifact_paths?.json, summary, evidence_status: evidenceStatus, raw_files: rawFiles, issues };
|
|
114
|
+
}
|
|
115
|
+
if (payload.status === "warn") return { ok: false, degraded: true, schema_version: "hmos_precheck.agent.v1", run_id: payload.run_id, read_file: payload.artifact_paths?.json, status: "warn", summary: degradedSummary(blockingIssues.length || 1), evidence_status: evidenceStatus, raw_files: rawFiles, issues: blockingIssues };
|
|
116
|
+
if (payload.status === "pass") return { ok: true };
|
|
117
|
+
return { ok: false, schema_version: "hmos_precheck.agent.v1", status: "fail", run_id: payload.run_id, read_file: payload.artifact_paths?.json, summary: blockingEnvironmentSummary(blockingIssues.length || 1), evidence_status: evidenceStatus, raw_files: rawFiles, issues: blockingIssues };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function compactRunResult(payload) {
|
|
121
|
+
const hasHard = payload.findings.some((item) => item.classification === "hard_fixable");
|
|
122
|
+
if (hasHard || payload.status === "fail") return { ok: false, ...(payload.artifact_paths.json ? { read_file: payload.artifact_paths.json } : {}) };
|
|
123
|
+
if (payload.status === "warn") return { ok: false, degraded: true, ...(payload.artifact_paths.json ? { read_file: payload.artifact_paths.json } : {}) };
|
|
124
|
+
return { ok: true };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async function writeSummary(payload, pathname) {
|
|
128
|
+
const findings = Array.isArray(payload.findings) ? payload.findings : [];
|
|
129
|
+
const hard = findings.filter((item) => item.classification === "hard_fixable");
|
|
130
|
+
const lines = ["# HMOS Precheck Summary", "", `- ok: ${String(payload.ok ?? false)}`, `- compact_summary: ${String(payload.compact_summary ?? "")}`, `- profiles: ${Array.isArray(payload.profiles) ? payload.profiles.join(", ") : ""}`, `- hard_fixable: ${String(payload.summary_counts?.hard_fixable ?? 0)}`, `- strong_warn_hidden_from_fixer: ${String(payload.summary_counts?.strong_warn ?? 0)}`, `- not_checked: ${String(payload.summary_counts?.not_checked ?? 0)}`, `- scope: ${String(payload.scope ?? "")}`, "", "## Fixer Findings"];
|
|
131
|
+
if (!hard.length) lines.push("- none");
|
|
132
|
+
for (const item of hard.slice(0, 40)) lines.push(`- [${String(item.profile ?? "")}] ${String(item.file ?? "<unknown>")}:${String(item.line ?? "?")}:${String(item.column ?? "?")} [${String(item.rule ?? "no-rule")}] ${String(item.message ?? "")}`);
|
|
133
|
+
await writeFile(pathname, `${lines.join("\n")}\n`, "utf8");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function writeArktsSummary(payload, pathname, maxErrors = 30) {
|
|
137
|
+
const repairSource = Array.isArray(payload.repair_errors) ? payload.repair_errors : payload.errors;
|
|
138
|
+
const errors = (Array.isArray(repairSource) ? repairSource : []).filter((item) => item.severity === "error" && item.default_mode !== "shadow");
|
|
139
|
+
const warnings = (Array.isArray(payload.errors) ? payload.errors : []).filter((item) => item.severity === "warning" || item.default_mode === "shadow");
|
|
140
|
+
const suppressed = Array.isArray(payload.suppressed_diagnostics) ? payload.suppressed_diagnostics : [];
|
|
141
|
+
const lines = ["# ArkTS Precheck Fix Summary", "", `- status: ${String(payload.tool_status ?? "")}`, `- checked_files: ${Array.isArray(payload.checked_files) ? payload.checked_files.length : 0}`, `- errors: ${errors.length}`, `- warnings_hidden_from_fixer: ${warnings.length}`, `- suppressed_project_config_diagnostics: ${suppressed.length}`, `- diagnostic_scope: ${String(payload.diagnostic_scope?.status ?? "full")}`, `- outside_changed_lines: ${payload.diagnostic_scope?.outside_changed_lines?.length ?? 0}`, "", "## Blocking Errors"];
|
|
142
|
+
if (!errors.length) lines.push("- none");
|
|
143
|
+
for (const item of errors.slice(0, maxErrors)) lines.push(`- ${String(item.file ?? "<unknown>")}:${String(item.line ?? "?")}:${String(item.column ?? "?")} [${String(item.rule ?? "no-rule")}] ${String(item.message ?? "")}`);
|
|
144
|
+
await writeFile(pathname, `${lines.join("\n")}\n`, "utf8");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export { compactRunResult, overallStatus, projectAgentResult, rawArtifactCandidates, writeArktsSummary, writeSummary };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { collectEtsFiles } from "./project_catalog.mjs";
|
|
4
|
+
import { runProcess } from "./process_adapter.mjs";
|
|
5
|
+
|
|
6
|
+
async function runGit(projectRoot, args) {
|
|
7
|
+
return await runProcess("git", args, { cwd: projectRoot });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function parseUnifiedZeroHunks(diffText) {
|
|
11
|
+
const ranges = {};
|
|
12
|
+
let currentFile = null;
|
|
13
|
+
for (const line of diffText.split(/\r?\n/)) {
|
|
14
|
+
if (line.startsWith("+++ b/")) {
|
|
15
|
+
currentFile = line.slice(6);
|
|
16
|
+
ranges[currentFile] ??= [];
|
|
17
|
+
} else if (currentFile && line.startsWith("@@")) {
|
|
18
|
+
const match = /@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(line);
|
|
19
|
+
if (!match) continue;
|
|
20
|
+
const start = Number.parseInt(match[1], 10);
|
|
21
|
+
const count = match[2] === undefined ? 1 : Number.parseInt(match[2], 10);
|
|
22
|
+
if (count > 0) ranges[currentFile].push([start, start + count - 1]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return ranges;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function expandRelativeImportCallers(projectRoot, changedFiles) {
|
|
29
|
+
const allFiles = await collectEtsFiles(projectRoot);
|
|
30
|
+
const all = new Set(allFiles.map((file) => path.resolve(file)));
|
|
31
|
+
const reverse = new Map();
|
|
32
|
+
await Promise.all(allFiles.map(async (importer) => {
|
|
33
|
+
const source = await readFile(importer, "utf8");
|
|
34
|
+
const pattern = /(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s*)(['"])(\.\.?\/[^'"]+)\1/g;
|
|
35
|
+
for (const match of source.matchAll(pattern)) {
|
|
36
|
+
const base = path.resolve(path.dirname(importer), match[2]);
|
|
37
|
+
for (const candidate of [base, `${base}.ets`, path.join(base, "index.ets")]) {
|
|
38
|
+
const callers = reverse.get(candidate) ?? new Set();
|
|
39
|
+
callers.add(importer);
|
|
40
|
+
reverse.set(candidate, callers);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
const selected = new Set(changedFiles.map((file) => path.resolve(file)));
|
|
45
|
+
const queue = [...selected];
|
|
46
|
+
while (queue.length) {
|
|
47
|
+
for (const caller of reverse.get(queue.shift()) ?? []) {
|
|
48
|
+
if (selected.has(caller)) continue;
|
|
49
|
+
selected.add(caller);
|
|
50
|
+
queue.push(caller);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [...selected].filter((file) => all.has(file)).map((file) => path.relative(projectRoot, file).replace(/\\/g, "/")).sort();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function projectImpactFiles(projectRoot, changedProjectFiles) {
|
|
57
|
+
const allFiles = (await collectEtsFiles(projectRoot)).map((file) => path.relative(projectRoot, file).replace(/\\/g, "/"));
|
|
58
|
+
const affected = new Set();
|
|
59
|
+
for (const changed of changedProjectFiles) {
|
|
60
|
+
if (["build-profile.json5", "oh-package.json5", "oh-package-lock.json5"].includes(changed) || changed.startsWith("AppScope/resources/")) {
|
|
61
|
+
allFiles.forEach((file) => affected.add(file));
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
let modulePrefix = null;
|
|
65
|
+
const srcMarker = changed.indexOf("/src/main/");
|
|
66
|
+
if (srcMarker >= 0 && (changed.endsWith("/src/main/module.json5") || changed.includes("/src/main/resources/"))) {
|
|
67
|
+
modulePrefix = changed.slice(0, srcMarker);
|
|
68
|
+
} else if (/^[^/]+\/(?:build-profile|oh-package(?:-lock)?)\.json5$/.test(changed)) {
|
|
69
|
+
modulePrefix = changed.slice(0, changed.indexOf("/"));
|
|
70
|
+
}
|
|
71
|
+
if (modulePrefix !== null) {
|
|
72
|
+
const prefix = modulePrefix ? `${modulePrefix}/src/main/ets/` : "src/main/ets/";
|
|
73
|
+
allFiles.filter((file) => file.startsWith(prefix)).forEach((file) => affected.add(file));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return [...affected].sort();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function gitChangedFiles(projectRoot, baseRef, headRef) {
|
|
80
|
+
const args = ["diff", "--name-only", baseRef];
|
|
81
|
+
if (headRef) args.push(headRef);
|
|
82
|
+
const result = await runGit(projectRoot, args);
|
|
83
|
+
if (result.code !== 0) throw new Error(`git diff failed: ${(result.stderr || result.stdout || `exit_code=${result.code}`).trim()}`);
|
|
84
|
+
const files = result.stdout.split(/\r?\n/).filter(Boolean).map((line) => line.replace(/\\/g, "/"));
|
|
85
|
+
if (headRef !== null) return [...new Set(files)];
|
|
86
|
+
const untracked = await runGit(projectRoot, ["ls-files", "--others", "--exclude-standard"]);
|
|
87
|
+
if (untracked.code !== 0) throw new Error(`git ls-files failed: ${(untracked.stderr || untracked.stdout || `exit_code=${untracked.code}`).trim()}`);
|
|
88
|
+
return [...new Set([...files, ...untracked.stdout.split(/\r?\n/).filter(Boolean).map((line) => line.replace(/\\/g, "/"))])];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async function createScopePlan(options) {
|
|
92
|
+
const projectRoot = path.resolve(options.projectRoot);
|
|
93
|
+
const incremental = Boolean(options.incremental);
|
|
94
|
+
if (!incremental) {
|
|
95
|
+
const checkedFiles = (await collectEtsFiles(projectRoot)).map((file) => path.relative(projectRoot, file).replace(/\\/g, "/")).sort();
|
|
96
|
+
return {
|
|
97
|
+
incremental: false,
|
|
98
|
+
scope: "full",
|
|
99
|
+
changed_project_files: [],
|
|
100
|
+
changed_ets_files: [],
|
|
101
|
+
checked_files: checkedFiles,
|
|
102
|
+
impacted_ets_files: [],
|
|
103
|
+
changed_line_ranges: {},
|
|
104
|
+
impact_basis: "full_project_ets_scan"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const baseRef = options.baseRef ?? "HEAD";
|
|
108
|
+
const headRef = options.headRef ?? null;
|
|
109
|
+
const changedProjectFiles = await gitChangedFiles(projectRoot, baseRef, headRef);
|
|
110
|
+
const diffArgs = ["diff", "--unified=0", baseRef];
|
|
111
|
+
if (headRef) diffArgs.push(headRef);
|
|
112
|
+
const diff = await runGit(projectRoot, diffArgs);
|
|
113
|
+
if (diff.code !== 0) throw new Error(`git diff failed: ${(diff.stderr || diff.stdout || `exit_code=${diff.code}`).trim()}`);
|
|
114
|
+
const changedLineRanges = parseUnifiedZeroHunks(diff.stdout);
|
|
115
|
+
const changedEtsFiles = changedProjectFiles.filter((file) => file.endsWith(".ets"));
|
|
116
|
+
if (headRef === null) for (const file of changedEtsFiles) changedLineRanges[file] ??= [[1, Number.MAX_SAFE_INTEGER]];
|
|
117
|
+
const contextFiles = await projectImpactFiles(projectRoot, changedProjectFiles);
|
|
118
|
+
const checkedFiles = await expandRelativeImportCallers(projectRoot, [...new Set([...changedEtsFiles, ...contextFiles])].map((file) => path.join(projectRoot, file)));
|
|
119
|
+
return {
|
|
120
|
+
incremental: true,
|
|
121
|
+
scope: "incremental",
|
|
122
|
+
changed_project_files: [...changedProjectFiles].sort(),
|
|
123
|
+
changed_ets_files: [...changedEtsFiles].sort(),
|
|
124
|
+
checked_files: checkedFiles,
|
|
125
|
+
impacted_ets_files: checkedFiles.filter((file) => !changedEtsFiles.includes(file)).sort(),
|
|
126
|
+
changed_line_ranges: changedLineRanges,
|
|
127
|
+
impact_basis: "module_context_resources_and_transitive_relative_import_callers"
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { createScopePlan };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { parse as parseJsonc } from "jsonc-parser";
|
|
5
|
+
import { exists } from "./process_adapter.mjs";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const parserCache = new Map();
|
|
9
|
+
|
|
10
|
+
function candidateRoots(commandlineTools) {
|
|
11
|
+
const resolved = path.resolve(commandlineTools);
|
|
12
|
+
return [...new Set([resolved, path.dirname(resolved)])];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function toolRoots(commandlineTools) {
|
|
16
|
+
if (!commandlineTools) return [];
|
|
17
|
+
const roots = [];
|
|
18
|
+
let current = path.resolve(commandlineTools);
|
|
19
|
+
for (let depth = 0; depth < 4; depth += 1) {
|
|
20
|
+
roots.push(current);
|
|
21
|
+
const parent = path.dirname(current);
|
|
22
|
+
if (parent === current) break;
|
|
23
|
+
current = parent;
|
|
24
|
+
}
|
|
25
|
+
return roots;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function findJson5Parser(commandlineTools) {
|
|
29
|
+
const key = commandlineTools ? path.resolve(commandlineTools) : "";
|
|
30
|
+
if (parserCache.has(key)) return parserCache.get(key);
|
|
31
|
+
for (const root of toolRoots(commandlineTools)) {
|
|
32
|
+
for (const candidate of [
|
|
33
|
+
path.join(root, "hvigor", "hvigor", "node_modules", "@ohos", "hvigor-common"),
|
|
34
|
+
path.join(root, "hvigor", "hvigor-ohos-plugin", "node_modules", "@ohos", "hvigor-common")
|
|
35
|
+
]) {
|
|
36
|
+
try {
|
|
37
|
+
const parser = require(candidate).parseJsonText;
|
|
38
|
+
if (typeof parser === "function") {
|
|
39
|
+
parserCache.set(key, parser);
|
|
40
|
+
return parser;
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
// Continue from an SDK directory toward the command-line tools root.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
parserCache.set(key, null);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function parseStructuredConfig(text, pathname, parseJson5) {
|
|
52
|
+
try {
|
|
53
|
+
const errors = [];
|
|
54
|
+
const value = parseJson5 ? parseJson5(text) : parseJsonc(text, errors, { allowTrailingComma: true, disallowComments: false });
|
|
55
|
+
if (errors.length || !value || typeof value !== "object" || Array.isArray(value)) throw new Error("expected an object");
|
|
56
|
+
return value;
|
|
57
|
+
} catch (error) {
|
|
58
|
+
throw new Error(`invalid JSON5 in ${pathname}: ${error instanceof Error ? error.message : String(error)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function readStructuredConfig(pathname, parseJson5, missingValue = {}) {
|
|
63
|
+
if (!await exists(pathname)) return missingValue;
|
|
64
|
+
return parseStructuredConfig(await readFile(pathname, "utf8"), pathname, parseJson5);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { candidateRoots, findJson5Parser, parseStructuredConfig, readStructuredConfig, toolRoots };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# HMOS Precheck Architecture
|
|
2
|
+
|
|
3
|
+
## Directory ownership
|
|
4
|
+
|
|
5
|
+
- `index.mjs`: executable entry only.
|
|
6
|
+
- `invocation.mjs`: CLI lifecycle, configuration, doctor and command routing.
|
|
7
|
+
- `backends/`: the local ArkTS checker, ArkTS changed-line scope seam, CodeLinter
|
|
8
|
+
adapter, local ArkTS project rules, and static result orchestration. The
|
|
9
|
+
former upstream checker is an external parity reference only and is not a
|
|
10
|
+
production dependency.
|
|
11
|
+
- `core/`: shared execution mechanics: process execution, SDK/project context,
|
|
12
|
+
scope planning, diagnostic scope and agent-facing result projection.
|
|
13
|
+
- `rules/`: semantic rule governance: stable rule IDs, aliases, grouping,
|
|
14
|
+
enabled/shadow/disabled modes, confidence and fix policy. It does not launch
|
|
15
|
+
SDK tools or orchestrate checks.
|
|
16
|
+
- `runtime-risk/`: independent ArkUI V1/V2 AST risk analyzer. It is not loaded
|
|
17
|
+
by the default static precheck and is excluded from the published package.
|
|
18
|
+
- `tests/`: nine responsibility-grouped suites covering core foundation,
|
|
19
|
+
project analysis, output contracts, rule contracts, rule accuracy, backend
|
|
20
|
+
adapters, precheck orchestration, runtime-risk and performance.
|
|
21
|
+
- Process task records are not part of this deliverable. Durable runtime-risk
|
|
22
|
+
design and promotion constraints live in `runtime-risk/DESIGN.md`.
|
|
23
|
+
|
|
24
|
+
## Dependency direction
|
|
25
|
+
|
|
26
|
+
`index -> invocation -> backends -> core/rules`. Backends acquire diagnostics
|
|
27
|
+
and orchestrate execution; core supplies reusable mechanics; rules normalize
|
|
28
|
+
the resulting diagnostics and decide their policy. Core and rules do not
|
|
29
|
+
import backends, and rules do not import core. Runtime-risk owns its facts and
|
|
30
|
+
rules and has no dependency from the default entry path.
|
|
31
|
+
|
|
32
|
+
## Evidence policy
|
|
33
|
+
|
|
34
|
+
Backend or capability absence is `not_checked`/unavailable, never success.
|
|
35
|
+
Malformed structured reports fail closed. Heuristic project and ArkUI rules
|
|
36
|
+
remain shadow until an independent oracle supports promotion. Source mutation
|
|
37
|
+
is not implemented and the CLI rejects `--fix`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Minimal Performance Optimization
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
- [x] Keep `arkts-diff` and `codelinter-diff` concurrent.
|
|
6
|
+
- [x] Reuse the existing incremental `scope_plan` and transitive relative-import expansion.
|
|
7
|
+
- [x] Reuse immutable SDK discovery results within one Node process, keyed by resolved SDK path.
|
|
8
|
+
- [x] Reuse the SDK JSON5 parser lookup within one Node process.
|
|
9
|
+
- [x] Preserve one-shot checker execution, raw artifacts, and fail-closed behavior.
|
|
10
|
+
- [x] Measure cold, warm, incremental, combined and RSS paths.
|
|
11
|
+
|
|
12
|
+
## Deliberately Deferred
|
|
13
|
+
|
|
14
|
+
- [ ] Persistent cross-request diagnostic cache.
|
|
15
|
+
- [ ] Warm daemon or shared checker server.
|
|
16
|
+
- [ ] Shared cache invalidation protocol.
|
|
17
|
+
- [ ] Cache reuse across SDK versions, projects or configuration fingerprints.
|
|
18
|
+
|
|
19
|
+
These require a measured request-volume benefit and a cache key covering source
|
|
20
|
+
closure, module configuration, resources, SDK/tool version and checker options.
|
|
21
|
+
Until then, one-shot execution is the simpler correctness boundary.
|
|
22
|
+
|
|
23
|
+
## Acceptance
|
|
24
|
+
|
|
25
|
+
The optimization must preserve raw structured evidence, changed-line
|
|
26
|
+
classification, impacted-file warnings, shadow policy, and unavailable fail-closed results.
|
|
27
|
+
Performance receipts belong in `docs/validation.md` and must include wall time,
|
|
28
|
+
RSS, checked-file count and finding count.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"captured_at": "2026-08-09T23:31:08-09:00",
|
|
3
|
+
"checker": {
|
|
4
|
+
"sha256": "235d8e1c9618afdb56e648fc2e591c8556be1545ed05439fcda50353964262e3",
|
|
5
|
+
"bytes": 114780
|
|
6
|
+
},
|
|
7
|
+
"wrapper": {
|
|
8
|
+
"sha256": "e61936c4383fa32da842cc323ea22c155cfea38e852c51cb01cb5be8469a0035",
|
|
9
|
+
"bytes": 9346,
|
|
10
|
+
"license_header": "Apache-2.0"
|
|
11
|
+
},
|
|
12
|
+
"notes": {
|
|
13
|
+
"sha256": "0ce4b19f96a0b213ca83f2fac7a692e72d910ac10c618aed197496aea1b25d79",
|
|
14
|
+
"bytes": 2098
|
|
15
|
+
},
|
|
16
|
+
"source_provenance": "User-supplied local download; canonical upstream URL and commit were not present.",
|
|
17
|
+
"production_eligible": false,
|
|
18
|
+
"sdk_distribution": "6.0.2.650"
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Final Validation Receipt
|
|
2
|
+
|
|
3
|
+
## Functional lanes
|
|
4
|
+
|
|
5
|
+
- Before cutover, the SDK plus pinned reference lane passed `54 / 54`; this is
|
|
6
|
+
the deletion-before receipt for the former upstream execution path.
|
|
7
|
+
- After cutover, the full default suite passed `76`, skipped `20`, failed `0`.
|
|
8
|
+
- After cutover with SDK 6.0.2.650, the full suite passed `94`, skipped `2`,
|
|
9
|
+
failed `0`. The two skips require an explicit
|
|
10
|
+
project-scale performance corpus.
|
|
11
|
+
- Production exposes one local `arkts-diff` implementation and the independent
|
|
12
|
+
`codelinter-diff` profile. Removed upstream/union/fix CLI options fail
|
|
13
|
+
explicitly instead of falling back.
|
|
14
|
+
|
|
15
|
+
## Accuracy gates
|
|
16
|
+
|
|
17
|
+
- Static rule matrix covers every enabled/shadow detector and requires positive,
|
|
18
|
+
near-negative, boundary, suppression, known-limit and oracle fields.
|
|
19
|
+
- Official checker fixtures assert exact compiler rules/messages and valid-file
|
|
20
|
+
absence of errors.
|
|
21
|
+
- Ten locally implemented text/structure rules retain explicit positive,
|
|
22
|
+
near-negative, boundary, suppression and known-limit fixtures. Regex rules
|
|
23
|
+
remain shadow because comment/string false positives and multiline false
|
|
24
|
+
negatives are still possible.
|
|
25
|
+
- Project integrity fails closed when a required permission catalog is absent;
|
|
26
|
+
the production ArkTS seam propagates `unavailable/partial/success=false`.
|
|
27
|
+
- All three structured adapters reject JSON objects missing their required
|
|
28
|
+
diagnostics schema instead of projecting an empty successful report.
|
|
29
|
+
- The pinned upstream checker is used only as a test oracle. Its hashes are in
|
|
30
|
+
`docs/upstream-reference.json`; its canonical source URL/commit is unknown,
|
|
31
|
+
so it is not production-eligible.
|
|
32
|
+
- Runtime-risk has a seven-rule matrix with executable positive and
|
|
33
|
+
near-negative fact cases; V1/V2 findings remain shadow and runtime-required.
|
|
34
|
+
|
|
35
|
+
## Performance and packaging
|
|
36
|
+
|
|
37
|
+
Catima measured 31 findings across 12 files. Latest canonical cold, warm and
|
|
38
|
+
incremental local ArkTS runs measured `5.39s / 471708 KiB`, `4.11s / 473924
|
|
39
|
+
KiB`, and `4.34s / 475480 KiB`; the CodeLinter profile measured `7.31s /
|
|
40
|
+
481300 KiB`. All remain below the provisional `10s / 1 GiB` workflow budget;
|
|
41
|
+
run-to-run variance is larger than the small in-process discovery optimization.
|
|
42
|
+
The official SDK compiler owns most RSS. Incremental precheck now runs one
|
|
43
|
+
ArkTS checker over changed and impacted files; it creates no Git worktree and
|
|
44
|
+
does not compile a baseline checkout.
|
|
45
|
+
|
|
46
|
+
Production `node --check`, full test lanes, the canonical performance lane,
|
|
47
|
+
and `npm pack --dry-run --ignore-scripts --json` passed. Tests, runtime-risk,
|
|
48
|
+
and task records are excluded from the package; production backend modules are
|
|
49
|
+
included. Static precheck does not prove Hvigor build or device/runtime
|
|
50
|
+
behavior, and automatic source fixes are not implemented.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { runInvocation } from "./invocation.mjs";
|
|
6
|
+
|
|
7
|
+
export { runInvocation as main };
|
|
8
|
+
|
|
9
|
+
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
10
|
+
runInvocation().then(
|
|
11
|
+
(code) => { process.exitCode = code; },
|
|
12
|
+
(error) => {
|
|
13
|
+
console.log(JSON.stringify({ ok: false, error: error instanceof Error ? error.message : String(error) }));
|
|
14
|
+
process.exitCode = 1;
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|