@buaa_smat/hometrans 0.1.17 → 0.1.20
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 +138 -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 +35 -376
- package/agents/test-case-generation-generator.md +317 -0
- package/agents/test-case-generation-validator.md +231 -0
- package/dist/cli/config-store.js +19 -146
- package/dist/cli/config.js +6 -8
- package/dist/cli/env-vars.js +1 -3
- package/dist/cli/index.js +0 -11
- package/dist/cli/init.js +147 -235
- package/dist/cli/uninstall.js +5 -129
- package/dist/utils/regex.js +8 -0
- package/env-requirements.json +57 -55
- package/package.json +6 -8
- 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 +188 -131
- 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 +57 -40
- package/skills/hmos-incremental-ui-align/SKILL.md +180 -24
- 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 +111 -79
- package/skills/hmos-integration-test/SKILL.md +216 -132
- package/skills/hmos-integration-test/scripts/report-tool.ts +791 -0
- package/skills/hmos-integration-test/scripts/resolve-metadata-tool.ts +125 -0
- package/skills/hmos-integration-test/scripts/self-test-runner.ts +756 -0
- package/skills/hmos-integration-test/scripts/testcases-tool.ts +239 -0
- 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/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_schema.md +0 -143
- 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,422 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import os from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import test from 'node:test';
|
|
6
|
+
|
|
7
|
+
import { __test__, main } from './platform_query.mjs';
|
|
8
|
+
|
|
9
|
+
async function withTempDir(run) {
|
|
10
|
+
const tempDir = await mkdtemp(path.join(os.tmpdir(), 'platform-query-test-'));
|
|
11
|
+
try {
|
|
12
|
+
return await run(tempDir);
|
|
13
|
+
} finally {
|
|
14
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function writeRequest(tempDir, request) {
|
|
19
|
+
const requestPath = path.join(tempDir, 'request.json');
|
|
20
|
+
await writeFile(requestPath, `${JSON.stringify(request, null, 2)}\n`, 'utf8');
|
|
21
|
+
return requestPath;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function readJson(filePath) {
|
|
25
|
+
return JSON.parse(await readFile(filePath, 'utf8'));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function runMainQuietly(args) {
|
|
29
|
+
const writes = [];
|
|
30
|
+
const originalWrite = process.stdout.write;
|
|
31
|
+
process.stdout.write = ((chunk, encoding, callback) => {
|
|
32
|
+
writes.push(String(chunk));
|
|
33
|
+
if (typeof encoding === 'function') encoding();
|
|
34
|
+
if (typeof callback === 'function') callback();
|
|
35
|
+
return true;
|
|
36
|
+
});
|
|
37
|
+
try {
|
|
38
|
+
const exitCode = await main(args);
|
|
39
|
+
return { exitCode, stdout: writes.join('') };
|
|
40
|
+
} finally {
|
|
41
|
+
process.stdout.write = originalWrite;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function mockResponse({ ok = true, status = 200, statusText = 'OK', body = '' }) {
|
|
46
|
+
return {
|
|
47
|
+
ok,
|
|
48
|
+
status,
|
|
49
|
+
statusText,
|
|
50
|
+
async text() {
|
|
51
|
+
return body;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
test('parseArgs parses required flags and dry-run mode', () => {
|
|
57
|
+
const parsed = __test__.parseArgs([
|
|
58
|
+
'--request',
|
|
59
|
+
'/tmp/request.json',
|
|
60
|
+
'--out-dir',
|
|
61
|
+
'/tmp/out',
|
|
62
|
+
'--api-level',
|
|
63
|
+
'24',
|
|
64
|
+
'--dry-run',
|
|
65
|
+
]);
|
|
66
|
+
assert.deepEqual(parsed, {
|
|
67
|
+
request: '/tmp/request.json',
|
|
68
|
+
outDir: '/tmp/out',
|
|
69
|
+
apiLevel: 24,
|
|
70
|
+
dryRun: true,
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test('parseArgs rejects partially numeric API levels', () => {
|
|
75
|
+
assert.throws(
|
|
76
|
+
() => __test__.parseArgs(['--request', 'r', '--out-dir', 'o', '--api-level', '22oops']),
|
|
77
|
+
/--api-level must be an integer/,
|
|
78
|
+
);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
test('validateRequest normalizes fields and deduplicates query types', () => {
|
|
82
|
+
const request = __test__.validateRequest({
|
|
83
|
+
stage: ' coder ',
|
|
84
|
+
focus_point: ' photo picker ',
|
|
85
|
+
task_excerpt: ' use system picker ',
|
|
86
|
+
project_evidence: ' entry/src/main ',
|
|
87
|
+
platform_surfaces: [' PhotoAccessHelper ', '', 'PhotoAccessHelper'],
|
|
88
|
+
extra_constraints: [' one ', ' ', 'two'],
|
|
89
|
+
query_types: [' api ', 'pattern', 'api'],
|
|
90
|
+
}, 22);
|
|
91
|
+
assert.deepEqual(request, {
|
|
92
|
+
stage: 'coder',
|
|
93
|
+
api_level: 22,
|
|
94
|
+
focus_point: 'photo picker',
|
|
95
|
+
task_excerpt: 'use system picker',
|
|
96
|
+
project_evidence: 'entry/src/main',
|
|
97
|
+
platform_surfaces: ['PhotoAccessHelper', 'PhotoAccessHelper'],
|
|
98
|
+
extra_constraints: ['one', 'two'],
|
|
99
|
+
query_types: ['api', 'pattern'],
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('request normalization accepts scalar list fields and common aliases', () => {
|
|
104
|
+
const warnings = [];
|
|
105
|
+
const canonical = __test__.canonicalizeRequest({
|
|
106
|
+
stage: 'planner',
|
|
107
|
+
focus_point: 'ForEach identity',
|
|
108
|
+
task_excerpt: 'verify retained item updates',
|
|
109
|
+
platformSurfaces: 'ForEach',
|
|
110
|
+
extra_contraints: { mutation: 'array replacement', key: 'stable id' },
|
|
111
|
+
}, warnings);
|
|
112
|
+
const request = __test__.validateRequest(canonical, 22, warnings);
|
|
113
|
+
|
|
114
|
+
assert.deepEqual(request.platform_surfaces, ['ForEach']);
|
|
115
|
+
assert.deepEqual(request.extra_constraints, ['{"mutation":"array replacement","key":"stable id"}']);
|
|
116
|
+
assert.deepEqual(warnings, [
|
|
117
|
+
'platformSurfaces was normalized to platform_surfaces',
|
|
118
|
+
'extra_contraints was normalized to extra_constraints',
|
|
119
|
+
'platform_surfaces was normalized to a one-item list',
|
|
120
|
+
'extra_constraints was normalized to a one-item list',
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('request normalization repairs common query type shapes but rejects malformed content', () => {
|
|
125
|
+
const scalarWarnings = [];
|
|
126
|
+
const scalar = __test__.validateRequest({
|
|
127
|
+
stage: 'planner',
|
|
128
|
+
focus_point: 'migration path',
|
|
129
|
+
task_excerpt: 'verify replacement',
|
|
130
|
+
query_types: 'migration',
|
|
131
|
+
}, 22, scalarWarnings);
|
|
132
|
+
assert.deepEqual(scalar.query_types, ['migration']);
|
|
133
|
+
assert.deepEqual(scalarWarnings, ['query_types was normalized to a one-item list']);
|
|
134
|
+
|
|
135
|
+
const emptyWarnings = [];
|
|
136
|
+
const empty = __test__.validateRequest({
|
|
137
|
+
stage: 'coder',
|
|
138
|
+
focus_point: 'ForEach update',
|
|
139
|
+
task_excerpt: 'verify rendering',
|
|
140
|
+
query_types: [],
|
|
141
|
+
}, 22, emptyWarnings);
|
|
142
|
+
assert.deepEqual(empty.query_types, []);
|
|
143
|
+
assert.deepEqual(emptyWarnings, []);
|
|
144
|
+
|
|
145
|
+
assert.throws(
|
|
146
|
+
() => __test__.normalizeList([['ForEach']], 'platform_surfaces'),
|
|
147
|
+
/platform_surfaces must contain only strings or objects/,
|
|
148
|
+
);
|
|
149
|
+
assert.throws(
|
|
150
|
+
() => __test__.normalizeList([22], 'platform_surfaces'),
|
|
151
|
+
/platform_surfaces must contain only strings or objects/,
|
|
152
|
+
);
|
|
153
|
+
assert.throws(
|
|
154
|
+
() => __test__.validateRequest({
|
|
155
|
+
stage: 'planner',
|
|
156
|
+
focus_point: { name: 'ForEach' },
|
|
157
|
+
task_excerpt: 'verify rendering',
|
|
158
|
+
}, 22),
|
|
159
|
+
/focus_point must be a non-empty string/,
|
|
160
|
+
);
|
|
161
|
+
assert.throws(
|
|
162
|
+
() => __test__.validateRequest({
|
|
163
|
+
stage: 'planner',
|
|
164
|
+
focus_point: 'ForEach',
|
|
165
|
+
task_excerpt: { mutation: 'replace' },
|
|
166
|
+
}, 22),
|
|
167
|
+
/task_excerpt must be a non-empty string/,
|
|
168
|
+
);
|
|
169
|
+
assert.throws(
|
|
170
|
+
() => __test__.validateRequest({
|
|
171
|
+
stage: 'planner',
|
|
172
|
+
focus_point: 'ForEach',
|
|
173
|
+
task_excerpt: 'verify rendering',
|
|
174
|
+
project_evidence: { file: 'Index.ets' },
|
|
175
|
+
}, 22),
|
|
176
|
+
/project_evidence must be a string/,
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('buildQueries uses stage-appropriate slots and query count', () => {
|
|
181
|
+
const queries = __test__.buildQueries({
|
|
182
|
+
stage: 'planner',
|
|
183
|
+
api_level: 22,
|
|
184
|
+
focus_point: 'media picker',
|
|
185
|
+
task_excerpt: 'pick a photo',
|
|
186
|
+
project_evidence: 'none',
|
|
187
|
+
platform_surfaces: ['PhotoAccessHelper'],
|
|
188
|
+
extra_constraints: ['Caller-specific constraint'],
|
|
189
|
+
query_types: ['api', 'pattern'],
|
|
190
|
+
});
|
|
191
|
+
assert.equal(queries.length, 2);
|
|
192
|
+
assert.equal(queries[0].module, 'planner_media_picker');
|
|
193
|
+
assert.match(queries[0].query, /Use these slots when applicable: feasibility, owner_boundary/);
|
|
194
|
+
assert.match(queries[0].query, /Anchor on the named surfaces; do not silently substitute them/);
|
|
195
|
+
assert.equal((queries[0].query.match(/OUTPUT CONTRACT: Total response must be at most 1800 characters and 8 lines/g) ?? []).length, 2);
|
|
196
|
+
assert.match(queries[0].query, /Caller-specific constraint/);
|
|
197
|
+
assert.match(queries[1].query, /Platform surfaces: PhotoAccessHelper\./);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('cleanEvidenceResponse preserves structured, unknown, and unmatched evidence', () => {
|
|
201
|
+
const cleaned = __test__.cleanEvidenceResponse(`
|
|
202
|
+
Summary:
|
|
203
|
+
The user is asking for a platform fact check.
|
|
204
|
+
- exact_api: use ohos.file.photoAccessHelper.createPhotoViewPicker()
|
|
205
|
+
- strange_slot: keep this fact
|
|
206
|
+
Here are details
|
|
207
|
+
- extra:custom: already namespaced
|
|
208
|
+
Source conflict: API level differs between documents
|
|
209
|
+
View this search on DeepWiki: https://deepwiki.com/search/example
|
|
210
|
+
`);
|
|
211
|
+
assert.equal(cleaned.structured, true);
|
|
212
|
+
assert.equal(
|
|
213
|
+
cleaned.cleaned,
|
|
214
|
+
[
|
|
215
|
+
'- exact_api: use ohos.file.photoAccessHelper.createPhotoViewPicker()',
|
|
216
|
+
'- extra:strange_slot: keep this fact',
|
|
217
|
+
'- extra:custom: already namespaced',
|
|
218
|
+
'- extra:unstructured: Source conflict: API level differs between documents',
|
|
219
|
+
].join('\n'),
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const truncated = __test__.cleanEvidenceResponse('- exact_api: use picker\n[truncated]');
|
|
223
|
+
assert.equal(truncated.structured, false);
|
|
224
|
+
assert.match(truncated.cleaned, /extra:unstructured: \[truncated\]/);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
test('truncateResponse keeps only complete evidence lines', () => {
|
|
228
|
+
const first = `- exact_api: ${'x'.repeat(1200)}`;
|
|
229
|
+
const second = `- return_error: ${'y'.repeat(1400)}`;
|
|
230
|
+
const truncated = __test__.truncateResponse(`${first}\n${second}`);
|
|
231
|
+
assert.equal(truncated, `${first}\n[truncated]`);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test('parseSseResponse extracts text payload and surfaces provider errors', () => {
|
|
235
|
+
const content = [
|
|
236
|
+
'data: {"result":{"content":[{"type":"text","text":"- exact_api: use picker"}]}}',
|
|
237
|
+
'data: {"result":{"content":[{"type":"text","text":"\\n- local_validation: no extra permission"}]}}',
|
|
238
|
+
].join('\n');
|
|
239
|
+
assert.equal(
|
|
240
|
+
__test__.parseSseResponse(content),
|
|
241
|
+
'- exact_api: use picker\n- local_validation: no extra permission',
|
|
242
|
+
);
|
|
243
|
+
assert.equal(
|
|
244
|
+
__test__.parseSseResponse('data: {"error":"rate limited"}'),
|
|
245
|
+
'[provider_error] rate limited',
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test('askDeepwikiOnce retries only fetch transport TypeErrors', async () => {
|
|
250
|
+
const originalFetch = global.fetch;
|
|
251
|
+
try {
|
|
252
|
+
global.fetch = async () => { throw new TypeError('fetch failed'); };
|
|
253
|
+
assert.equal((await __test__.askDeepwikiOnce('repo', 'question')).retryable, true);
|
|
254
|
+
|
|
255
|
+
global.fetch = async () => { throw new TypeError('response parsing bug'); };
|
|
256
|
+
assert.equal((await __test__.askDeepwikiOnce('repo', 'question')).retryable, false);
|
|
257
|
+
} finally {
|
|
258
|
+
global.fetch = originalFetch;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test('main dry-run writes request, query, result, and trace artifacts', async () => {
|
|
263
|
+
await withTempDir(async (tempDir) => {
|
|
264
|
+
const outDir = path.join(tempDir, 'out');
|
|
265
|
+
const requestPath = await writeRequest(tempDir, {
|
|
266
|
+
stage: 'coder',
|
|
267
|
+
focus_point: 'photo picker',
|
|
268
|
+
task_excerpt: 'verify exact API usage',
|
|
269
|
+
project_evidence: ' ',
|
|
270
|
+
platformSurfaces: 'PhotoAccessHelper',
|
|
271
|
+
extraConstraints: { permission: 'none' },
|
|
272
|
+
});
|
|
273
|
+
const { exitCode, stdout } = await runMainQuietly([
|
|
274
|
+
'--request',
|
|
275
|
+
requestPath,
|
|
276
|
+
'--out-dir',
|
|
277
|
+
outDir,
|
|
278
|
+
'--dry-run',
|
|
279
|
+
]);
|
|
280
|
+
|
|
281
|
+
assert.equal(exitCode, 0);
|
|
282
|
+
assert.match(stdout, /platform-context-result\.json/);
|
|
283
|
+
|
|
284
|
+
const result = await readJson(path.join(outDir, 'platform-context-result.json'));
|
|
285
|
+
const trace = await readJson(path.join(outDir, 'platform-context-trace.json'));
|
|
286
|
+
const queries = await readJson(path.join(outDir, 'provider', 'provider-queries.json'));
|
|
287
|
+
|
|
288
|
+
assert.equal(result.status, 'dry_run');
|
|
289
|
+
assert.deepEqual(result.platform_surfaces, ['PhotoAccessHelper']);
|
|
290
|
+
assert.equal(result.normalization_warnings, undefined);
|
|
291
|
+
assert.deepEqual(trace.normalization_warnings, [
|
|
292
|
+
'platformSurfaces was normalized to platform_surfaces',
|
|
293
|
+
'extraConstraints was normalized to extra_constraints',
|
|
294
|
+
'project_evidence was normalized to none',
|
|
295
|
+
'platform_surfaces was normalized to a one-item list',
|
|
296
|
+
'extra_constraints was normalized to a one-item list',
|
|
297
|
+
]);
|
|
298
|
+
assert.equal(result.evidence_count, 0);
|
|
299
|
+
assert.equal(result.structured_missing_count, 0);
|
|
300
|
+
assert.equal(trace.status, 'dry_run');
|
|
301
|
+
assert.equal(trace.query_count, 2);
|
|
302
|
+
assert.equal(queries.length, 2);
|
|
303
|
+
assert.match(queries[0].query, /Project evidence: none\./);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
test('main rejects partially numeric request API levels', async () => {
|
|
308
|
+
await withTempDir(async (tempDir) => {
|
|
309
|
+
const requestPath = await writeRequest(tempDir, {
|
|
310
|
+
stage: 'planner',
|
|
311
|
+
focus_point: 'API gate',
|
|
312
|
+
task_excerpt: 'verify availability',
|
|
313
|
+
api_level: '22oops',
|
|
314
|
+
});
|
|
315
|
+
await assert.rejects(
|
|
316
|
+
() => runMainQuietly(['--request', requestPath, '--out-dir', path.join(tempDir, 'out'), '--dry-run']),
|
|
317
|
+
/api_level must be an integer/,
|
|
318
|
+
);
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test('main returns partial_ok when at least one provider query succeeds', async () => {
|
|
323
|
+
await withTempDir(async (tempDir) => {
|
|
324
|
+
const outDir = path.join(tempDir, 'out');
|
|
325
|
+
const requestPath = await writeRequest(tempDir, {
|
|
326
|
+
stage: 'coder',
|
|
327
|
+
focus_point: 'photo picker',
|
|
328
|
+
task_excerpt: 'verify exact API usage',
|
|
329
|
+
project_evidence: 'entry/src/main/ets/pages/Index.ets',
|
|
330
|
+
platform_surfaces: ['PhotoAccessHelper'],
|
|
331
|
+
query_types: ['api', 'pattern'],
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
const originalFetch = global.fetch;
|
|
335
|
+
const responses = [
|
|
336
|
+
new TypeError('fetch failed'),
|
|
337
|
+
mockResponse({
|
|
338
|
+
body: 'data: {"result":{"content":[{"type":"text","text":"- exact_api: use PhotoAccessHelper.createPicker()"}]}}\n',
|
|
339
|
+
}),
|
|
340
|
+
mockResponse({
|
|
341
|
+
ok: false,
|
|
342
|
+
status: 503,
|
|
343
|
+
statusText: 'Service Unavailable',
|
|
344
|
+
}),
|
|
345
|
+
mockResponse({
|
|
346
|
+
ok: false,
|
|
347
|
+
status: 503,
|
|
348
|
+
statusText: 'Service Unavailable',
|
|
349
|
+
}),
|
|
350
|
+
];
|
|
351
|
+
global.fetch = async () => {
|
|
352
|
+
const next = responses.shift();
|
|
353
|
+
assert.ok(next, 'unexpected extra fetch call');
|
|
354
|
+
if (next instanceof Error) throw next;
|
|
355
|
+
return next;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
try {
|
|
359
|
+
const { exitCode } = await runMainQuietly([
|
|
360
|
+
'--request',
|
|
361
|
+
requestPath,
|
|
362
|
+
'--out-dir',
|
|
363
|
+
outDir,
|
|
364
|
+
]);
|
|
365
|
+
assert.equal(exitCode, 0);
|
|
366
|
+
const result = await readJson(path.join(outDir, 'platform-context-result.json'));
|
|
367
|
+
const trace = await readJson(path.join(outDir, 'platform-context-trace.json'));
|
|
368
|
+
assert.equal(result.status, 'partial_ok');
|
|
369
|
+
assert.equal(result.verified_evidence_count, 1);
|
|
370
|
+
assert.equal(result.failed_evidence_count, 1);
|
|
371
|
+
assert.equal(result.structured_evidence.some((item) => item.structured), true);
|
|
372
|
+
assert.match(trace.provider_stderr, /provider_error|http_error/);
|
|
373
|
+
assert.equal(responses.length, 0);
|
|
374
|
+
} finally {
|
|
375
|
+
global.fetch = originalFetch;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
test('main returns provider_failed when all provider queries fail', async () => {
|
|
381
|
+
await withTempDir(async (tempDir) => {
|
|
382
|
+
const outDir = path.join(tempDir, 'out');
|
|
383
|
+
const requestPath = await writeRequest(tempDir, {
|
|
384
|
+
stage: 'planner',
|
|
385
|
+
focus_point: 'media permission',
|
|
386
|
+
task_excerpt: 'check feasibility',
|
|
387
|
+
project_evidence: 'none',
|
|
388
|
+
platform_surfaces: ['PhotoAccessHelper'],
|
|
389
|
+
query_types: ['api'],
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
const originalFetch = global.fetch;
|
|
393
|
+
const responses = Array.from({ length: 3 }, () => mockResponse({
|
|
394
|
+
ok: false,
|
|
395
|
+
status: 429,
|
|
396
|
+
statusText: 'Too Many Requests',
|
|
397
|
+
}));
|
|
398
|
+
global.fetch = async () => {
|
|
399
|
+
const next = responses.shift();
|
|
400
|
+
assert.ok(next, 'unexpected extra fetch call');
|
|
401
|
+
return next;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
try {
|
|
405
|
+
const { exitCode } = await runMainQuietly([
|
|
406
|
+
'--request',
|
|
407
|
+
requestPath,
|
|
408
|
+
'--out-dir',
|
|
409
|
+
outDir,
|
|
410
|
+
]);
|
|
411
|
+
assert.equal(exitCode, 1);
|
|
412
|
+
const result = await readJson(path.join(outDir, 'platform-context-result.json'));
|
|
413
|
+
const trace = await readJson(path.join(outDir, 'platform-context-trace.json'));
|
|
414
|
+
assert.equal(result.status, 'provider_failed');
|
|
415
|
+
assert.equal(result.verified_evidence_count, 0);
|
|
416
|
+
assert.equal(result.failed_evidence_count, 1);
|
|
417
|
+
assert.equal(trace.status, 'provider_failed');
|
|
418
|
+
} finally {
|
|
419
|
+
global.fetch = originalFetch;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: self-test-fixer
|
|
3
3
|
description: Fixes issues identified by self-testing — reads self-test report, white-box verifies failures in HarmonyOS code, plans and executes fixes in order, produces detailed report
|
|
4
|
-
color:
|
|
4
|
+
color: info
|
|
5
|
+
mode: subagent
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Self-Test Fixer Agent
|
|
@@ -108,8 +109,8 @@ For each fix item in the plan:
|
|
|
108
109
|
- Use the Android behavior as the specification for the fix
|
|
109
110
|
|
|
110
111
|
2. **Look up HarmonyOS APIs**:
|
|
111
|
-
-
|
|
112
|
-
- Use WebSearch
|
|
112
|
+
- Prefer `npx --yes devecocli docs search` / `npx --yes devecocli docs read` for relevant ArkTS / ArkUI API documentation.
|
|
113
|
+
- Use WebSearch only if the local docs flow does not provide enough detail.
|
|
113
114
|
- **Do not guess API signatures** — verify them
|
|
114
115
|
|
|
115
116
|
3. **Implement the fix**:
|
|
@@ -124,72 +125,72 @@ For each fix item in the plan:
|
|
|
124
125
|
|
|
125
126
|
### 3c. Compile Once After All Fixes
|
|
126
127
|
|
|
127
|
-
After **all** fix items are complete,
|
|
128
|
+
After **all** fix items are complete, invoke the `hmos-fix-build-errors` skill **once** to verify compilation:
|
|
128
129
|
|
|
129
|
-
- Pass `
|
|
130
|
-
- If compilation fails,
|
|
131
|
-
- Compilation issues do NOT count as effective fix attempts
|
|
130
|
+
- Pass the current HarmonyOS project path into `hmos-fix-build-errors`. The skill itself detects signing mode from `build-profile.json5` — do not pass `--signed` unless the caller has an explicit reason to assert signed output.
|
|
131
|
+
- If compilation fails, let the skill handle the compile-error fix loop — these retries do **not** count as an effective attempt.
|
|
132
|
+
- Compilation issues introduced by the cumulative fixes do NOT count as effective fix attempts.
|
|
132
133
|
|
|
133
|
-
> **Design rationale**: Compiling once at the end (not per-scenario) saves significant time.
|
|
134
|
+
> **Design rationale**: Compiling once at the end (not per-scenario) saves significant time. `hmos-fix-build-errors` handles any compilation errors introduced by the cumulative changes.
|
|
135
|
+
|
|
136
|
+
### 3d. Retry Logic (Maximum 2 Effective Attempts)
|
|
137
|
+
|
|
138
|
+
An "effective attempt" = code was modified AND compilation succeeded, but code review suggests the fix may be incomplete.
|
|
139
|
+
|
|
140
|
+
- After successful compilation in 3c, review all changes holistically
|
|
141
|
+
- If any fix item appears incomplete or incorrect:
|
|
142
|
+
- This counts as 1 effective attempt for the affected scenario(s)
|
|
143
|
+
- If attempts < 2: revise the fix, then re-invoke `hmos-fix-build-errors` to re-compile
|
|
144
|
+
- If attempts = 2: mark as failed, move on
|
|
145
|
+
- Scenarios that are fixed correctly on the first attempt are marked as success
|
|
134
146
|
|
|
135
147
|
### 3.5 Git Commit (if fixes were applied)
|
|
136
148
|
|
|
137
|
-
After Step
|
|
149
|
+
After Step 3d retry logic completes (all fixes and retries are done), commit the changes if any source files were modified.
|
|
138
150
|
|
|
139
151
|
**Condition**: Run this step only when at least one confirmed failure was successfully fixed (i.e., modified source files exist).
|
|
140
152
|
|
|
141
153
|
1. **Check if the project is in a git repository**:
|
|
142
154
|
```bash
|
|
143
|
-
cd "<
|
|
155
|
+
cd "<harmony_project_dir>" && git rev-parse --is-inside-work-tree
|
|
144
156
|
```
|
|
145
157
|
|
|
146
|
-
2. **If yes, commit
|
|
158
|
+
2. **If yes, stage and commit only the modified files** (never use `git add -A` or `git add .` — that would sweep pipeline artifacts into the app repo):
|
|
147
159
|
```bash
|
|
148
|
-
cd "<
|
|
149
|
-
git add
|
|
160
|
+
cd "<harmony_project_dir>"
|
|
161
|
+
# Stage only the files modified during 3b/3d — one explicit git add per path
|
|
162
|
+
git add "<file1>" "<file2>" ...
|
|
163
|
+
git status --short # verify the staged set matches the All Modified Files table
|
|
150
164
|
git commit -m "fix(test): fix {N} self-test failures
|
|
151
165
|
|
|
152
166
|
Fixed: {N}/{M} failed scenarios
|
|
153
167
|
"
|
|
154
168
|
```
|
|
155
|
-
(where N = successfully fixed confirmed failures, M = total confirmed failures)
|
|
169
|
+
(where N = successfully fixed confirmed failures, M = total confirmed failures; the file list comes from the fix records accumulated in 3b step 4 and any 3d retries)
|
|
156
170
|
|
|
157
171
|
3. **Capture the commit ID**:
|
|
158
172
|
```bash
|
|
159
|
-
cd "<
|
|
173
|
+
cd "<harmony_project_dir>" && git rev-parse HEAD
|
|
160
174
|
```
|
|
161
175
|
|
|
162
|
-
4. **Write commit info** to `<output_path>/self-test-fix-commit-info.md
|
|
176
|
+
4. **Write commit info** to `<output_path>/self-test-fix-commit-info.md` (if `output_path` was not provided, default to cwd):
|
|
163
177
|
```
|
|
164
178
|
commit_id: <commit_id>
|
|
165
179
|
```
|
|
166
180
|
|
|
167
181
|
**If no files were modified** (all failures were false positives):
|
|
168
|
-
- Write `<output_path>/self-test-fix-commit-info.md` with:
|
|
182
|
+
- Write `<output_path>/self-test-fix-commit-info.md` (or cwd) with:
|
|
169
183
|
```
|
|
170
184
|
commit_id: none
|
|
171
185
|
```
|
|
172
186
|
|
|
173
187
|
**If not in a git repository**:
|
|
174
188
|
- Record issue "Not a git repository — skipped commit" in `self-test-fix-report.md`.
|
|
175
|
-
- Write `<output_path>/self-test-fix-commit-info.md` with:
|
|
189
|
+
- Write `<output_path>/self-test-fix-commit-info.md` (or cwd) with:
|
|
176
190
|
```
|
|
177
191
|
commit_id: none
|
|
178
192
|
```
|
|
179
193
|
|
|
180
|
-
**If `output_path` was not provided**, skip writing `self-test-fix-commit-info.md`.
|
|
181
|
-
|
|
182
|
-
### 3d. Retry Logic (Maximum 2 Effective Attempts)
|
|
183
|
-
|
|
184
|
-
An "effective attempt" = code was modified AND compilation succeeded, but code review suggests the fix may be incomplete.
|
|
185
|
-
|
|
186
|
-
- After successful compilation in 3c, review all changes holistically
|
|
187
|
-
- If any fix item appears incomplete or incorrect:
|
|
188
|
-
- This counts as 1 effective attempt for the affected scenario(s)
|
|
189
|
-
- If attempts < 2: revise the fix, re-compile
|
|
190
|
-
- If attempts = 2: mark as failed, move on
|
|
191
|
-
- Scenarios that are fixed correctly on the first attempt are marked as success
|
|
192
|
-
|
|
193
194
|
---
|
|
194
195
|
|
|
195
196
|
## Step 4 — Generate Detailed Fix Report
|
|
@@ -259,8 +260,8 @@ Write `self-test-fix-report.md` to `output_path`. The report must be comprehensi
|
|
|
259
260
|
|
|
260
261
|
## 编译验证
|
|
261
262
|
|
|
262
|
-
- **编译结果**: 通过 / 失败后由 build-
|
|
263
|
-
-
|
|
263
|
+
- **编译结果**: 通过 / 失败后由 `hmos-fix-build-errors` 处理
|
|
264
|
+
- **编译阶段处理的问题**: <list if any>
|
|
264
265
|
|
|
265
266
|
---
|
|
266
267
|
|
|
@@ -287,7 +288,8 @@ Write `self-test-fix-report.md` to `output_path`. The report must be comprehensi
|
|
|
287
288
|
- **Do not hardcode report format**: Read and understand `self-test-report.md` as-is. Adapt to whatever structure it uses.
|
|
288
289
|
- **White-box before fixing**: Always verify failures through code analysis before modifying anything. Do not blindly trust test agent results.
|
|
289
290
|
- **Sequential execution only**: Never launch parallel subagents for code modifications. Fix one item at a time in the planned order.
|
|
290
|
-
- **Look up before you guess**:
|
|
291
|
+
- **Look up before you guess**: Prefer `npx --yes devecocli docs search` / `npx --yes devecocli docs read` to verify HarmonyOS API usage. Fall back to WebSearch only when the local docs flow is insufficient. Do not assume API signatures.
|
|
292
|
+
- **Use device logs for runtime evidence**: When a self-test failure needs device-side confirmation, prefer `npx --yes devecocli log --level E` and `npx --yes devecocli log --crash --bundle-name <bundle>` before broader manual diagnosis.
|
|
291
293
|
- **Read before you edit**: Always read a file before modifying it. Understand the surrounding context.
|
|
292
294
|
- **Minimal changes**: Only fix the specific feature failure. Do not refactor or "improve" unrelated code.
|
|
293
295
|
- **Android as specification**: When available, treat the Android implementation as the ground truth for expected behavior.
|