@buaa_smat/hometrans 0.1.20 → 26.0.0-devecocli.2
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/agents/build-fixer.md +406 -0
- package/agents/code-reviewer.md +461 -496
- package/agents/model-render-worker.md +34 -0
- package/agents/model-worker.md +23 -0
- package/agents/specgen-worker.md +18 -0
- package/commands/hometrans.md +17 -0
- package/devecocli-plugin/common.ts +2203 -0
- package/devecocli-plugin/install.ts +61 -0
- package/devecocli-plugin/uninstall.ts +26 -0
- package/devecocli-plugin/update.ts +66 -0
- package/index.js +1418 -0
- package/package.json +81 -64
- package/platforms/atomcode/agents/build-fixer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/code-reviewer.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-render-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/model-worker.frontmatter.md +6 -0
- package/platforms/atomcode/agents/specgen-worker.frontmatter.md +6 -0
- package/platforms/deveco/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/deveco/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/model-worker.frontmatter.md +5 -0
- package/platforms/deveco/agents/specgen-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/build-fixer.frontmatter.md +5 -0
- package/platforms/opencode/agents/code-reviewer.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-render-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/model-worker.frontmatter.md +5 -0
- package/platforms/opencode/agents/specgen-worker.frontmatter.md +5 -0
- package/plugin.jsonc +12 -0
- package/skills/a2h-app-migrate/SKILL.md +181 -0
- package/skills/a2h-app-migrate/references/config.example.json +27 -0
- package/skills/a2h-app-migrate/references/specs.example.json +19 -0
- package/skills/a2h-app-migrate/references/stage-map.md +33 -0
- package/skills/a2h-app-migrate/references/workflow.yaml +1600 -0
- package/skills/a2h-app-migrate/scripts/android_index.mjs +109 -0
- package/skills/a2h-app-migrate/scripts/check_arch_done.mjs +80 -0
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +95 -0
- package/skills/a2h-app-migrate/scripts/check_signing.mjs +152 -0
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +114 -0
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +277 -0
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +77 -0
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +147 -0
- package/skills/a2h-app-migrate/scripts/cli_values.mjs +32 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +1388 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +651 -0
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +53 -0
- package/skills/a2h-app-migrate/scripts/json_io.mjs +35 -0
- package/skills/a2h-app-migrate/scripts/ledger.mjs +104 -0
- package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +288 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +713 -0
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +205 -0
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +121 -0
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +212 -0
- package/skills/a2h-app-migrate/scripts/spec_layout.mjs +30 -0
- package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +455 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +80 -0
- package/skills/a2h-app-migrate/test/test_apk_preflight.mjs +63 -0
- package/skills/a2h-app-migrate/test/test_arch_done.mjs +54 -0
- package/skills/a2h-app-migrate/test/test_build_fixer_contract.mjs +92 -0
- package/skills/a2h-app-migrate/test/test_config_example.mjs +42 -0
- package/skills/a2h-app-migrate/test/test_entry_guards.mjs +93 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +505 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +89 -0
- package/skills/a2h-app-migrate/test/test_gate_checkpoint.mjs +146 -0
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +68 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +91 -0
- package/skills/a2h-app-migrate/test/test_interaction.mjs +122 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +32 -0
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +109 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_parse_args.mjs +69 -0
- package/skills/a2h-app-migrate/test/test_preflight_report.mjs +83 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +144 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +100 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +315 -0
- package/skills/a2h-app-migrate/test/test_skill_doc.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +133 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +158 -0
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +181 -0
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +76 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +53 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_gate.mjs +226 -0
- package/skills/a2h-app-migrate/test/test_utg_dirs.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +168 -0
- package/skills/a2h-app-migrate/test/test_validate_races.mjs +50 -0
- package/skills/a2h-arch-generate/SKILL.md +375 -0
- package/skills/a2h-arch-generate/examples/reconcile-existing-project.md +107 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-android.md +103 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-backend.md +70 -0
- package/skills/a2h-arch-generate/examples/simple-conversion-uniapp.md +106 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.generate.md +120 -0
- package/skills/a2h-arch-generate/references/artifact-contracts.reconcile.md +123 -0
- package/skills/a2h-arch-generate/references/bpta-layered-architecture-design.md +88 -0
- package/skills/a2h-arch-generate/references/clustering-guidance.md +33 -0
- package/skills/a2h-arch-generate/references/database-schema-recovery.md +107 -0
- package/skills/a2h-arch-generate/references/existing-target-annotation.md +68 -0
- package/skills/a2h-arch-generate/references/harmony-project-inspection.md +150 -0
- package/skills/a2h-arch-generate/references/harmony-target-architecture.md +94 -0
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +120 -0
- package/skills/a2h-arch-generate/references/module-evidence-subagent.md +45 -0
- package/skills/a2h-arch-generate/references/reconciliation-model.md +204 -0
- package/skills/a2h-arch-generate/references/scope-policy.md +28 -0
- package/skills/a2h-arch-generate/references/semantic-review.md +65 -0
- package/skills/a2h-arch-generate/references/source-baseline.md +93 -0
- package/skills/a2h-arch-generate/references/source-ecosystems.md +54 -0
- package/skills/a2h-arch-generate/references/transformation-model.md +78 -0
- package/skills/a2h-arch-generate/scripts/check_module_staleness.mjs +284 -0
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +260 -0
- package/skills/a2h-arch-generate/scripts/compute_processing_order.mjs +325 -0
- package/skills/a2h-arch-generate/scripts/create_project.mjs +149 -0
- package/skills/a2h-arch-generate/scripts/dump_core_facts.mjs +151 -0
- package/skills/a2h-arch-generate/scripts/extract_core_components.mjs +167 -0
- package/skills/a2h-arch-generate/scripts/generate_source_baseline.mjs +363 -0
- package/skills/a2h-arch-generate/scripts/generate_state.mjs +60 -0
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +326 -0
- package/skills/a2h-arch-generate/scripts/inspect_android_project.mjs +3739 -0
- package/skills/a2h-arch-generate/scripts/inspect_harmony_target.mjs +800 -0
- package/skills/a2h-arch-generate/scripts/inspect_project.mjs +251 -0
- package/skills/a2h-arch-generate/scripts/inspect_uniapp_project.mjs +809 -0
- package/skills/a2h-arch-generate/scripts/lib/py_compat.mjs +1454 -0
- package/skills/a2h-arch-generate/scripts/module_create/create.mjs +136 -0
- package/skills/a2h-arch-generate/scripts/module_create/generate.mjs +636 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/build-profile.json5 +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/applicationability/ApplicationAbility.ets +43 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/ets/pages/Index.ets +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/module.json5 +26 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/color.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/element/string.json +16 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/background.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/foreground.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/mock/mock-config.json5 +2 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hap/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/ets/components/MainPage.ets +19 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/module.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/har/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/Index.ets +1 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/build-profile.json5 +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/consumer-rules.txt +0 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/hvigorfile.ts +6 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/obfuscation-rules.txt +23 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/oh-package.json5 +10 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/pages/Index.ets +20 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/ets/utils/Calc.ets +3 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/module.json5 +12 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/float.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/element/string.json +8 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/ohosTest/module.json5 +11 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/List.test.ets +5 -0
- package/skills/a2h-arch-generate/scripts/module_create/hsp/src/test/LocalUnit.test.ets +33 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/reconcile-layer-PROJECT_DESIGN.md +47 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/single-entry-PROJECT_DESIGN.md +15 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/three-layer-PROJECT_DESIGN.md +36 -0
- package/skills/a2h-arch-generate/scripts/module_create/testdata/verification-report.md +150 -0
- package/skills/a2h-arch-generate/scripts/resolve_android_stores.mjs +529 -0
- package/skills/a2h-arch-generate/scripts/scaffold_project.mjs +230 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/build.gradle +11 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/AndroidManifest.xml +12 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/MainActivity.kt +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/app/src/main/java/com/example/notes/NotesStore.kt +17 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/build.gradle +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/android_source/settings.gradle +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/AppScope/app.json5 +8 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/build-profile.json5 +14 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/common/utils/src/main/ets/utils/Format.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/home/src/main/ets/pages/Home.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/features/sync/src/main/ets/engine/SyncEngine.ets +3 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/hvigorfile.ts +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/oh-package.json5 +1 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/build-profile.json5 +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/oh-package.json5 +9 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/harmony_target/products/app/src/main/ets/pages/Index.ets +7 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/App.vue +10 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/manifest.json +6 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages/index/index.vue +16 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/fixtures/uniapp_source/pages.json +5 -0
- package/skills/a2h-arch-generate/scripts/tests/e2e/run_e2e.mjs +548 -0
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +1122 -0
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +191 -0
- package/skills/a2h-arch-generate/scripts/tests/test_console_encoding.mjs +52 -0
- package/skills/a2h-arch-generate/scripts/tests/test_git_root.mjs +34 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +138 -0
- package/skills/a2h-arch-generate/scripts/validate_architecture_docs.mjs +829 -0
- package/skills/a2h-arch-generate/scripts/validate_data_docs.mjs +937 -0
- package/skills/a2h-arch-generate/scripts/validate_homegraph_artifacts.mjs +542 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +415 -0
- package/skills/a2h-arkts-logic-coder/SKILL.md +125 -0
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +6 -0
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +124 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_module_scope.ts +224 -0
- package/skills/a2h-arkts-logic-coder/scripts/check_mvvm.ts +377 -0
- package/skills/a2h-arkts-logic-coder/scripts/stop_check_hook.ts +443 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_check_scripts.ts +211 -0
- package/skills/a2h-arkts-logic-coder/scripts/test_worktree_compat.ts +81 -0
- package/skills/a2h-batch-ui-align/SKILL.md +309 -0
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +81 -0
- package/skills/a2h-batch-ui-align/flowchart.html +271 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/conversion-procedure.md +523 -661
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +139 -0
- package/skills/a2h-batch-ui-align/references/lottie-integration.md +43 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +8 -8
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +3 -0
- package/skills/a2h-batch-ui-align/references/source-only-tier.md +32 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +211 -0
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +192 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +202 -0
- package/skills/a2h-batch-ui-align/scripts/agent_cli.mjs +572 -0
- package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/scripts/android_parse_fast.ts +246 -39
- package/skills/a2h-batch-ui-align/scripts/answers_check.mjs +86 -0
- package/skills/a2h-batch-ui-align/scripts/arkts_static_check.ts +2689 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +1656 -0
- package/skills/a2h-batch-ui-align/scripts/databinding_analyzer_design.md +79 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +258 -0
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +1524 -0
- package/skills/a2h-batch-ui-align/scripts/generate_pages_json.mjs +612 -0
- package/skills/a2h-batch-ui-align/scripts/group_commit.mjs +166 -0
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +1437 -0
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +1869 -0
- package/skills/a2h-batch-ui-align/scripts/group_watch.mjs +696 -0
- package/skills/a2h-batch-ui-align/scripts/harmony_index.mjs +218 -0
- package/skills/a2h-batch-ui-align/scripts/host_env.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +1229 -0
- package/skills/a2h-batch-ui-align/scripts/occlusion.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +1124 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +996 -0
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +217 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_align_tint.test.mjs +253 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rules.test.mjs +365 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_shell.test.mjs +72 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_weight_color.test.mjs +353 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +345 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +290 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +74 -0
- package/skills/a2h-batch-ui-align/scripts/tests/export_ui_info.test.mjs +507 -0
- package/skills/a2h-batch-ui-align/scripts/tests/generate_pages_json.test.mjs +123 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_commit.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack.test.mjs +189 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +1451 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_watch.test.mjs +215 -0
- package/skills/a2h-batch-ui-align/scripts/tests/harmony_index.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/host_env.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +170 -0
- package/skills/a2h-batch-ui-align/scripts/tests/occlusion.test.mjs +102 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +244 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +130 -0
- package/skills/a2h-batch-ui-align/scripts/tests/test_bfs_exit.ts +49 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +57 -0
- package/skills/a2h-dashboard-render/SKILL.md +65 -0
- package/skills/a2h-dashboard-render/references/artifact-contract.jsonc +147 -0
- package/skills/a2h-dashboard-render/references/artifact-registry-spec.md +67 -0
- package/skills/a2h-dashboard-render/references/dashboard.config.example.json +19 -0
- package/skills/a2h-dashboard-render/references//347/234/213/346/235/277/350/257/264/346/230/216.md +83 -0
- package/skills/a2h-dashboard-render/scripts/artifact_contract.mjs +138 -0
- package/skills/a2h-dashboard-render/scripts/check-registry.mjs +87 -0
- package/skills/a2h-dashboard-render/scripts/dashboard.mjs +3215 -0
- package/skills/a2h-dashboard-render/scripts/device_capture.mjs +2010 -0
- package/skills/a2h-dashboard-render/scripts/page_capture.mjs +828 -0
- package/skills/a2h-dashboard-render/scripts/usage_readers.mjs +459 -0
- package/skills/a2h-dashboard-render/scripts/usage_worker.mjs +13 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/broken.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/expected.json +156 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/hmos.json +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/list.xml +1 -0
- package/skills/a2h-dashboard-render/test/fixtures/page_capture/nested_scroll.xml +1 -0
- package/skills/a2h-dashboard-render/test/test_artifact_contract.mjs +170 -0
- package/skills/a2h-dashboard-render/test/test_cli_check_registry.mjs +99 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_architecture.mjs +182 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_build.mjs +64 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_node.mjs +1172 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_spec_pipeline.mjs +251 -0
- package/skills/a2h-dashboard-render/test/test_dashboard_ui_pipeline.mjs +81 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_env.mjs +115 -0
- package/skills/a2h-dashboard-render/test/test_device_capture_policy.mjs +303 -0
- package/skills/a2h-dashboard-render/test/test_page_capture.mjs +147 -0
- package/skills/a2h-dashboard-render/test/test_usage_readers.mjs +444 -0
- package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/SKILL.md +305 -293
- package/skills/a2h-module-semantic-docs/SKILL.md +227 -0
- package/skills/a2h-module-semantic-docs/scripts/commit_module_state.mjs +168 -0
- package/skills/a2h-module-semantic-docs/scripts/lib/py_compat.mjs +688 -0
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +1021 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_structure.json +187 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_understanding.json +351 -0
- package/skills/a2h-module-semantic-docs/test/golden/module_update_plan.json +495 -0
- package/skills/a2h-module-semantic-docs/test/golden/project_directory_structure.json +157 -0
- package/skills/a2h-module-semantic-docs/test/test_scan_and_commit.mjs +388 -0
- package/skills/a2h-resource-convert/SKILL.md +369 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/code-vector-icon-rules.md +4 -4
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/conversion-rules.md +16 -5
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +251 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/lottie-conversion-rules.md +17 -17
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/resource-mapping-rules.md +15 -4
- package/skills/a2h-resource-convert/references/step3_5-dependency-filter.md +54 -0
- package/skills/a2h-resource-convert/references/step4-qualifiers-and-values.md +142 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +249 -0
- package/skills/a2h-resource-convert/references/step5-reference-resolution.md +154 -0
- package/skills/a2h-resource-convert/references/step7-report-template.md +217 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/references/xml-drawable-to-svg-rules.md +38 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/a2h_resource_convert.ts +456 -90
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +1072 -0
- package/skills/a2h-resource-convert/scripts/app_identity.ts +947 -0
- package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/code_vector_icons.ts +19 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +989 -0
- package/skills/a2h-resource-convert/scripts/extract_project_resources.ts +1464 -0
- package/skills/a2h-resource-convert/scripts/tests/adaptive_icon.test.mjs +182 -0
- package/skills/a2h-resource-convert/scripts/tests/app_identity.test.mjs +206 -0
- package/skills/a2h-spec-design/SKILL.md +336 -0
- package/skills/a2h-spec-design/scripts/inspect_spec_design_inputs.mjs +146 -0
- package/skills/a2h-spec-design/scripts/lib/py_compat.mjs +481 -0
- package/skills/a2h-spec-design/scripts/move_spec_technical_reference.mjs +159 -0
- package/skills/a2h-spec-design/scripts/resolve_module_design.mjs +102 -0
- package/skills/a2h-spec-design/scripts/validate_spec_design_output.mjs +285 -0
- package/skills/a2h-spec-design/test/golden/inspect_happy.json +20 -0
- package/skills/a2h-spec-design/test/golden/move_design.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_design_crlf.md +18 -0
- package/skills/a2h-spec-design/test/golden/move_spec.md +7 -0
- package/skills/a2h-spec-design/test/golden/resolve_cases.json +36 -0
- package/skills/a2h-spec-design/test/golden/validate_issue_file.md +12 -0
- package/skills/a2h-spec-design/test/golden/validate_issues.json +57 -0
- package/skills/a2h-spec-design/test/test_spec_design_scripts.mjs +381 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +228 -0
- package/skills/a2h-spec-design-pipeline/package.json +4 -0
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +63 -0
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +69 -0
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +24 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +57 -0
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +21 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +27 -0
- package/skills/a2h-spec-design-pipeline/references/specs.example.json +19 -0
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +21 -0
- package/skills/a2h-spec-design-pipeline/scripts/atomic_write.ts +42 -0
- package/skills/a2h-spec-design-pipeline/scripts/audit_claims.ts +252 -0
- package/skills/a2h-spec-design-pipeline/scripts/branch_landed.ts +77 -0
- package/skills/a2h-spec-design-pipeline/scripts/deps_ready.ts +195 -0
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +651 -0
- package/skills/a2h-spec-design-pipeline/scripts/git_baseline.ts +124 -0
- package/skills/a2h-spec-design-pipeline/scripts/inflight.mjs +944 -0
- package/skills/a2h-spec-design-pipeline/scripts/lib/bgcli.mjs +95 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +502 -0
- package/skills/a2h-spec-design-pipeline/scripts/plan_waves.ts +475 -0
- package/skills/a2h-spec-design-pipeline/scripts/reconcile.mjs +218 -0
- package/skills/a2h-spec-design-pipeline/scripts/resolve_wiring.ts +164 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_atomic_write.ts +44 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_audit_claims.ts +301 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_bgcli.mjs +64 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_branch_landed.ts +87 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_deps_ready.ts +265 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +675 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_git_baseline.ts +105 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_inflight.mjs +452 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +375 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_waves.ts +561 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_reconcile.mjs +182 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolve_wiring.ts +138 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_watchdog.mjs +289 -0
- package/skills/a2h-spec-design-pipeline/scripts/watchdog.mjs +441 -0
- package/skills/a2h-spec-generate/SKILL.md +285 -0
- package/skills/a2h-spec-generate/package.json +9 -0
- package/skills/a2h-spec-generate/references/batch-mode.md +151 -0
- package/skills/a2h-spec-generate/references/delete-blast-radius.md +3 -0
- package/skills/a2h-spec-generate/references/fusion-task-contract.md +114 -0
- package/skills/a2h-spec-generate/references/input-formats.md +27 -0
- package/skills/a2h-spec-generate/references/library-evidence.md +3 -0
- package/skills/a2h-spec-generate/references/method-discipline.md +64 -0
- package/skills/a2h-spec-generate/references/optional-gates.json +45 -0
- package/skills/a2h-spec-generate/references/recall-guide.md +83 -0
- package/skills/a2h-spec-generate/references/recall-terse.md +3 -0
- package/skills/a2h-spec-generate/references/recall-uniapp.md +10 -0
- package/skills/a2h-spec-generate/references/requirement-scope.md +122 -0
- package/skills/a2h-spec-generate/references/review-checklist.md +21 -0
- package/skills/a2h-spec-generate/references/spec-sample-complex.md +80 -0
- package/skills/a2h-spec-generate/references/spec-sample-transfer.md +43 -0
- package/skills/a2h-spec-generate/references/spec-samples.md +65 -0
- package/skills/a2h-spec-generate/references/specs.schema.json +79 -0
- package/skills/a2h-spec-generate/references/synthesis-rules.md +143 -0
- package/skills/a2h-spec-generate/references/transfer-file.md +5 -0
- package/skills/a2h-spec-generate/references/transfer-socket.md +5 -0
- package/skills/a2h-spec-generate/references/worker-rules.md +126 -0
- package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +514 -0
- package/skills/a2h-spec-generate/scripts/check_spec.ts +361 -0
- package/skills/a2h-spec-generate/scripts/collect-specs.mjs +470 -0
- package/skills/a2h-spec-generate/scripts/detect-project.mjs +271 -0
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +188 -0
- package/skills/a2h-spec-generate/scripts/feature-stem.mjs +150 -0
- package/skills/a2h-spec-generate/scripts/inspect-uniapp.mjs +733 -0
- package/skills/{hmos-spec-generate → a2h-spec-generate}/scripts/parse_requirements.ts +1 -1
- package/skills/a2h-spec-generate/scripts/prepare-facts.mjs +307 -0
- package/skills/a2h-spec-generate/scripts/publication-verdict.mjs +171 -0
- package/skills/a2h-spec-generate/scripts/publish-specs.mjs +280 -0
- package/skills/a2h-spec-generate/scripts/render-tasks.mjs +399 -0
- package/skills/a2h-spec-generate/scripts/report.mjs +132 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/dashboard.html +149 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-api.js +49 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-code-view.js +140 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-format.js +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-handoff.js +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-splitters.js +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-state.js +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-tree.js +194 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz-virtual-list.js +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.css +245 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.html +99 -0
- package/skills/a2h-spec-generate/scripts/reqgen/assets/viz.js +220 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package-lock.json +47 -0
- package/skills/a2h-spec-generate/scripts/reqgen/package.json +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/agent-render/serve.ts +95 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/callback-call-sites.ts +82 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/area-ownership.ts +496 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/build.ts +2217 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/callback-flow.ts +386 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/component-variants.ts +845 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/graph/index.ts +24 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/index.ts +22 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/policy.ts +572 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/names/traceability.ts +580 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/build.ts +1270 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/index.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/projection.ts +804 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/req-model/render-projection.ts +51 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/android-interaction-registry.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/builder.ts +453 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/compose-api-registry.ts +526 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/analysis/source-facts/index.ts +15 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/connector/utg-inbound.ts +763 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/area-graph.ts +383 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/artifact.ts +68 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/common.ts +88 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/diagnostic.ts +64 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/gap-audit.ts +113 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/index.ts +12 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/name-traceability.ts +108 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/raw-fact.ts +377 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/req-model.ts +238 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/run.ts +134 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/semantic-completeness.ts +35 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/source-facts.ts +48 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/contracts/utg.ts +133 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/output-guard.ts +42 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/core/stable-id.ts +118 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/cross-area-tally-cli.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dashboard-cli.ts +188 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/dump.ts +1184 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/dump-cli.ts +373 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-facts.ts +1014 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/area-output.ts +32 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/schema.ts +142 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/selfcheck.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/spec-bindings.ts +310 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +685 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/graph/paths.ts +575 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/homegraph-cli.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/android-resource-resolver.ts +391 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/androidx-preference-contracts.ts +44 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/contracts.ts +640 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/cross-area.ts +207 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/finalizer.ts +1297 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/identity.ts +186 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/index.ts +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/planner.ts +312 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/preference-enrichment.ts +793 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/raw-facts.ts +355 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/rules.ts +271 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/scanner.ts +666 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/schema.ts +365 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/stable-key.ts +144 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/task-contract.ts +301 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/tree-sitter-adapter.ts +923 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/uniapp-utg-adapter.ts +543 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/interaction-analysis/xml-adapter.ts +262 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/assemble.ts +2079 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/contracts.ts +157 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/finalize.ts +809 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/index.ts +17 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/io.ts +165 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/prepare.ts +806 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/query.ts +360 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/seeds.ts +218 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/spec-bindings-sidecar.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model/task.ts +359 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/model-cli.ts +500 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/index.ts +7 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/pipeline/output.ts +307 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/requirement-scope.ts +172 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/index.ts +1 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-cov/source-cov.ts +176 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/source-index/homegraph.ts +1039 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/area-graph.ts +490 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/index.ts +23 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-model.ts +957 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/req-text.ts +248 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/semantic-area-graph.ts +1600 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/validation/types.ts +10 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/artifact-data.ts +201 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-api.ts +74 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-code-view.ts +180 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-format.ts +18 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-handoff.ts +55 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-splitters.ts +78 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-state.ts +66 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-tree.ts +232 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz-virtual-list.ts +179 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/client/viz.ts +240 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/contracts.d.ts +86 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/index.ts +3 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/server.ts +239 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz/source-project.ts +316 -0
- package/skills/a2h-spec-generate/scripts/reqgen/src/viz-cli.ts +200 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-fact-join.test.ts +50 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/control-name-uniapp.test.ts +75 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/cross-area-anchor.test.ts +256 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-area-facts.test.ts +576 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-contract.test.ts +290 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-finalize.test.ts +1323 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-prepare.test.ts +574 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-scope.test.ts +339 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-selfcheck.test.ts +831 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +548 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-cli-blockers.test.ts +117 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-scope.test.ts +396 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-seeds.test.ts +175 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-task-contract.test.ts +298 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/model-v4.test.ts +1061 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/specgen-completeness.test.ts +286 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/stagem-stored-path.test.ts +25 -0
- package/skills/a2h-spec-generate/scripts/reqgen/test/uniapp-scanner.test.ts +159 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.json +16 -0
- package/skills/a2h-spec-generate/scripts/reqgen/tsconfig.viz-client.json +12 -0
- package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +632 -0
- package/skills/a2h-spec-generate/test/check-spec.test.ts +200 -0
- package/skills/a2h-spec-generate/test/collect-specs.test.mjs +538 -0
- package/skills/a2h-spec-generate/test/detect-project.test.mjs +37 -0
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +45 -0
- package/skills/a2h-spec-generate/test/feature-stem.test.mjs +147 -0
- package/skills/a2h-spec-generate/test/fixtures/android/app/src/main/AndroidManifest.xml +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/build.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/android/settings.gradle +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/package.json +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/App.vue +8 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/components/MyCard.vue +9 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/feature/editor/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/main.ts +6 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/manifest.json +4 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/detail/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/home/index.vue +33 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages/settings/index.vue +1 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/pages.json +23 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/src/services/items.ts +3 -0
- package/skills/a2h-spec-generate/test/fixtures/uniapp-src/tsconfig.json +8 -0
- package/skills/a2h-spec-generate/test/fixtures/unknown/README.txt +1 -0
- package/skills/a2h-spec-generate/test/inspect-uniapp.test.mjs +54 -0
- package/skills/a2h-spec-generate/test/publication-verdict.test.mjs +157 -0
- package/skills/a2h-spec-generate/test/publish-specs.test.mjs +282 -0
- package/skills/a2h-spec-generate/test/render-tasks.test.mjs +593 -0
- package/skills/a2h-utg-explorer/SKILL.md +120 -0
- package/skills/a2h-utg-explorer/assets/final_viewer.html +64 -0
- package/skills/a2h-utg-explorer/assets/u2.LICENSE +21 -0
- package/skills/a2h-utg-explorer/assets/u2.NOTICE +25 -0
- package/skills/a2h-utg-explorer/assets/u2.jar +0 -0
- package/skills/a2h-utg-explorer/references/architecture.md +270 -0
- package/skills/a2h-utg-explorer/references/protocol.md +9 -0
- package/skills/a2h-utg-explorer/scripts/app_settings.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +167 -0
- package/skills/a2h-utg-explorer/scripts/close_phases.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +749 -0
- package/skills/a2h-utg-explorer/scripts/d_prereqs.mjs +597 -0
- package/skills/a2h-utg-explorer/scripts/device_health.mjs +227 -0
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +276 -0
- package/skills/a2h-utg-explorer/scripts/evidence.mjs +108 -0
- package/skills/a2h-utg-explorer/scripts/final_utg.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/hint_check.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +258 -0
- package/skills/a2h-utg-explorer/scripts/promote_dynamic.mjs +170 -0
- package/skills/a2h-utg-explorer/scripts/recover.mjs +467 -0
- package/skills/a2h-utg-explorer/scripts/recover_b.mjs +542 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +302 -0
- package/skills/a2h-utg-explorer/scripts/rejudge.mjs +203 -0
- package/skills/a2h-utg-explorer/scripts/report.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +831 -0
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +137 -0
- package/skills/a2h-utg-explorer/scripts/tests/attest.test.mjs +66 -0
- package/skills/a2h-utg-explorer/scripts/tests/chain.test.mjs +45 -0
- package/skills/a2h-utg-explorer/scripts/tests/compose_identity.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/coverage_rules.test.mjs +104 -0
- package/skills/a2h-utg-explorer/scripts/tests/d_prereqs.test.mjs +223 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_health.test.mjs +88 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_lock_retry.test.mjs +187 -0
- package/skills/a2h-utg-explorer/scripts/tests/direct_launch.test.mjs +130 -0
- package/skills/a2h-utg-explorer/scripts/tests/explorer_review_fixes.test.mjs +136 -0
- package/skills/a2h-utg-explorer/scripts/tests/final_utg.test.mjs +135 -0
- package/skills/a2h-utg-explorer/scripts/tests/first_round_phases.test.mjs +16 -0
- package/skills/a2h-utg-explorer/scripts/tests/generalization_fixes.test.mjs +251 -0
- package/skills/a2h-utg-explorer/scripts/tests/hint_check.test.mjs +42 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +162 -0
- package/skills/a2h-utg-explorer/scripts/tests/node_coverage.test.mjs +193 -0
- package/skills/a2h-utg-explorer/scripts/tests/overflow_prefix.test.mjs +204 -0
- package/skills/a2h-utg-explorer/scripts/tests/page_identity_tiers.test.mjs +355 -0
- package/skills/a2h-utg-explorer/scripts/tests/pipeline.test.mjs +240 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover.test.mjs +212 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_b.test.mjs +173 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d.test.mjs +207 -0
- package/skills/a2h-utg-explorer/scripts/tests/review_fixes.test.mjs +213 -0
- package/skills/a2h-utg-explorer/scripts/tests/robustness_fixes.test.mjs +345 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +453 -0
- package/skills/a2h-utg-explorer/scripts/tests/runner_capabilities.test.mjs +131 -0
- package/skills/a2h-utg-explorer/scripts/tests/scope.test.mjs +229 -0
- package/skills/a2h-utg-explorer/scripts/tests/scroll_sweep.test.mjs +321 -0
- package/skills/a2h-utg-explorer/scripts/tests/semantics.test.mjs +102 -0
- package/skills/a2h-utg-explorer/scripts/tests/twin_opener.test.mjs +119 -0
- package/skills/a2h-utg-explorer/scripts/tests/u2_backend.test.mjs +346 -0
- package/skills/a2h-utg-explorer/scripts/tests/ui_state_anchors.test.mjs +112 -0
- package/skills/a2h-utg-explorer/scripts/tests/variant_strings.test.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/tests/worklist_parts.test.mjs +24 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_device_io.mjs +244 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/_py.mjs +2097 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +1213 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/attest.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/chain.mjs +63 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/coverage.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/device_lock.mjs +46 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +1136 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +1513 -0
- package/skills/a2h-utg-explorer/scripts/variant.mjs +75 -0
- package/skills/a2h-utg-explorer/scripts/worklist_parts.mjs +122 -0
- package/skills/a2h-utg-static/SKILL.md +361 -0
- package/skills/a2h-utg-static/config.json +19 -0
- package/skills/a2h-utg-static/references/extractors.md +217 -0
- package/skills/a2h-utg-static/references/ui-elements-static-utg-schema.md +248 -0
- package/skills/a2h-utg-static/references/view-interactions.md +215 -0
- package/skills/a2h-utg-static/scripts/_graph.mjs +361 -0
- package/skills/a2h-utg-static/scripts/_py.mjs +2177 -0
- package/skills/a2h-utg-static/scripts/_spawn.mjs +45 -0
- package/skills/a2h-utg-static/scripts/activity_nav.mjs +738 -0
- package/skills/a2h-utg-static/scripts/activity_widgets.mjs +254 -0
- package/skills/a2h-utg-static/scripts/adapter_nav.mjs +229 -0
- package/skills/a2h-utg-static/scripts/androidfragment_nav.mjs +208 -0
- package/skills/a2h-utg-static/scripts/assemble.mjs +2065 -0
- package/skills/a2h-utg-static/scripts/audit.mjs +268 -0
- package/skills/a2h-utg-static/scripts/carry_answers.mjs +201 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +594 -0
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +172 -0
- package/skills/a2h-utg-static/scripts/compose_merge.mjs +263 -0
- package/skills/a2h-utg-static/scripts/compose_nav.mjs +1216 -0
- package/skills/a2h-utg-static/scripts/compose_navbar_nav.mjs +238 -0
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +2760 -0
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +365 -0
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +498 -0
- package/skills/a2h-utg-static/scripts/dialog_listener_nav.mjs +237 -0
- package/skills/a2h-utg-static/scripts/dialogshow_nav.mjs +308 -0
- package/skills/a2h-utg-static/scripts/fragfactory_nav.mjs +170 -0
- package/skills/a2h-utg-static/scripts/fragment_nav.mjs +1136 -0
- package/skills/a2h-utg-static/scripts/guard_subjects.mjs +162 -0
- package/skills/a2h-utg-static/scripts/hg_query.mjs +137 -0
- package/skills/a2h-utg-static/scripts/host_resolve.mjs +393 -0
- package/skills/a2h-utg-static/scripts/hybrid_bundle.mjs +165 -0
- package/skills/a2h-utg-static/scripts/hybrid_pages.mjs +713 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +660 -0
- package/skills/a2h-utg-static/scripts/interaction_sites.mjs +267 -0
- package/skills/a2h-utg-static/scripts/io_utils.mjs +59 -0
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +864 -0
- package/skills/a2h-utg-static/scripts/launch_extras.mjs +91 -0
- package/skills/a2h-utg-static/scripts/layout_resolve.mjs +148 -0
- package/skills/a2h-utg-static/scripts/manifest.mjs +483 -0
- package/skills/a2h-utg-static/scripts/measure/measure_corpus.mjs +297 -0
- package/skills/a2h-utg-static/scripts/measure/measure_guards.mjs +98 -0
- package/skills/a2h-utg-static/scripts/media_browse_nav.mjs +356 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +603 -0
- package/skills/a2h-utg-static/scripts/navactions_nav.mjs +255 -0
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +453 -0
- package/skills/a2h-utg-static/scripts/orphan_overlay_nav.mjs +89 -0
- package/skills/a2h-utg-static/scripts/phase_plan.mjs +108 -0
- package/skills/a2h-utg-static/scripts/phase_planner.mjs +119 -0
- package/skills/a2h-utg-static/scripts/plaindialog_nav.mjs +411 -0
- package/skills/a2h-utg-static/scripts/preference_nav.mjs +761 -0
- package/skills/a2h-utg-static/scripts/preference_widgets.mjs +142 -0
- package/skills/a2h-utg-static/scripts/presenter_nav.mjs +490 -0
- package/skills/a2h-utg-static/scripts/registry_nav.mjs +288 -0
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +870 -0
- package/skills/a2h-utg-static/scripts/scope_utils.mjs +430 -0
- package/skills/a2h-utg-static/scripts/screen_merge.mjs +287 -0
- package/skills/a2h-utg-static/scripts/screen_nav.mjs +279 -0
- package/skills/a2h-utg-static/scripts/single_host_nav.mjs +291 -0
- package/skills/a2h-utg-static/scripts/starter_nav.mjs +198 -0
- package/skills/a2h-utg-static/scripts/state_guard.mjs +579 -0
- package/skills/a2h-utg-static/scripts/static_prior.mjs +904 -0
- package/skills/a2h-utg-static/scripts/tests/_zipw.mjs +28 -0
- package/skills/a2h-utg-static/scripts/tests/probe_autoload.mjs +108 -0
- package/skills/a2h-utg-static/scripts/tests/probe_layout_fragments.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/probe_unknown_scope.mjs +61 -0
- package/skills/a2h-utg-static/scripts/tests/regression_matrix.mjs +1261 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_alias_launcher.mjs +90 -0
- package/skills/a2h-utg-static/scripts/tests/test_activity_supertype_chain.mjs +106 -0
- package/skills/a2h-utg-static/scripts/tests/test_bottom_sheet_container.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_branch_guard.mjs +19 -0
- package/skills/a2h-utg-static/scripts/tests/test_callee_string_default.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_chrome_tokens.mjs +60 -0
- package/skills/a2h-utg-static/scripts/tests/test_commented_out_trigger.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_commit_scope.mjs +113 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_file_private_route.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_nested_graph.mjs +166 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_route_holder_collision.mjs +112 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_vm_nav.mjs +267 -0
- package/skills/a2h-utg-static/scripts/tests/test_custom_source_root.mjs +71 -0
- package/skills/a2h-utg-static/scripts/tests/test_defensive_null_guard.mjs +77 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_orphan_entries.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialog_page_owner.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_builder_forms.mjs +96 -0
- package/skills/a2h-utg-static/scripts/tests/test_dialogshow_java_factory.mjs +37 -0
- package/skills/a2h-utg-static/scripts/tests/test_disabled_guard.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_drawer_panel_gesture.mjs +140 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_dedupe_by_gesture.mjs +111 -0
- package/skills/a2h-utg-static/scripts/tests/test_edge_provenance_lint.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_enclosing_gesture.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_external_surface_roots.mjs +43 -0
- package/skills/a2h-utg-static/scripts/tests/test_find_package_indirect.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_forwarding_wrapper.mjs +38 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_containment.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_fragment_helper_trigger.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_graph.mjs +55 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_clause.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_hint_language.mjs +119 -0
- package/skills/a2h-utg-static/scripts/tests/test_host_kind_by_chain.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundle_attribution.mjs +74 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_bundled_pages.mjs +181 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +293 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_title_renders.mjs +118 -0
- package/skills/a2h-utg-static/scripts/tests/test_interaction_sites.mjs +272 -0
- package/skills/a2h-utg-static/scripts/tests/test_item_data_instance.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_kotlin_fn_spans.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_accessor_forms.mjs +187 -0
- package/skills/a2h-utg-static/scripts/tests/test_label_source.mjs +70 -0
- package/skills/a2h-utg-static/scripts/tests/test_launch_intent_guard.mjs +67 -0
- package/skills/a2h-utg-static/scripts/tests/test_layout_declared_fragment.mjs +103 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_call_forms.mjs +79 -0
- package/skills/a2h-utg-static/scripts/tests/test_listener_receiver_binding.mjs +47 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_exported_default.mjs +40 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_filters_modules.mjs +84 -0
- package/skills/a2h-utg-static/scripts/tests/test_manifest_srcfile.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_mode_and_cb_param.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_namespace.mjs +33 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +44 -0
- package/skills/a2h-utg-static/scripts/tests/test_multiple_entry_contracts.mjs +80 -0
- package/skills/a2h-utg-static/scripts/tests/test_nav_graph_xml.mjs +35 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hint_grammar.mjs +42 -0
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_gate.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_node_id_collision.mjs +57 -0
- package/skills/a2h-utg-static/scripts/tests/test_non_gesture_step_flag.mjs +62 -0
- package/skills/a2h-utg-static/scripts/tests/test_out_of_scope_and_settings.mjs +72 -0
- package/skills/a2h-utg-static/scripts/tests/test_overload_and_climb.mjs +86 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_page_source.mjs +78 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_position_zero.mjs +65 -0
- package/skills/a2h-utg-static/scripts/tests/test_pager_variant_guard.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +107 -0
- package/skills/a2h-utg-static/scripts/tests/test_plain_dialog_nodes.mjs +167 -0
- package/skills/a2h-utg-static/scripts/tests/test_plaindialog_shared_anchor.mjs +117 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_click_nav.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_host_binding.mjs +87 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_nesting.mjs +183 -0
- package/skills/a2h-utg-static/scripts/tests/test_preference_widgets.mjs +48 -0
- package/skills/a2h-utg-static/scripts/tests/test_read_text_crlf.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_resolver_tier_parity.mjs +126 -0
- package/skills/a2h-utg-static/scripts/tests/test_result_launcher.mjs +142 -0
- package/skills/a2h-utg-static/scripts/tests/test_review_fixes.mjs +135 -0
- package/skills/a2h-utg-static/scripts/tests/test_route_token_words.mjs +66 -0
- package/skills/a2h-utg-static/scripts/tests/test_same_name_decl_scope.mjs +236 -0
- package/skills/a2h-utg-static/scripts/tests/test_scope_utils.mjs +85 -0
- package/skills/a2h-utg-static/scripts/tests/test_sealed_dialog_state.mjs +148 -0
- package/skills/a2h-utg-static/scripts/tests/test_shared_overlay_split.mjs +63 -0
- package/skills/a2h-utg-static/scripts/tests/test_slug_parity.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_starter_node_id.mjs +41 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_arity.mjs +109 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_commented_candidates.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_guard_model_gates.mjs +127 -0
- package/skills/a2h-utg-static/scripts/tests/test_state_specific_hop.mjs +130 -0
- package/skills/a2h-utg-static/scripts/tests/test_synthetic_label_identity.mjs +51 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_method_layout.mjs +81 -0
- package/skills/a2h-utg-static/scripts/tests/test_template_title.mjs +58 -0
- package/skills/a2h-utg-static/scripts/tests/test_trigger_id_spelling.mjs +68 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_action_override.mjs +91 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_flow_filter.mjs +110 -0
- package/skills/a2h-utg-static/scripts/tests/test_ui_elements_nl_hint_key.mjs +89 -0
- package/skills/a2h-utg-static/scripts/tests/test_uiless_host_fold.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +231 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_click_refs.mjs +104 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_id_label.mjs +69 -0
- package/skills/a2h-utg-static/scripts/tests/test_view_interactions.mjs +346 -0
- package/skills/a2h-utg-static/scripts/tests/test_viewpage_nav.mjs +273 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +98 -0
- package/skills/a2h-utg-static/scripts/tests/test_widget_class_scope.mjs +92 -0
- package/skills/a2h-utg-static/scripts/tests/test_window_nav_kotlin.mjs +158 -0
- package/skills/a2h-utg-static/scripts/tests/test_worklist_parts.mjs +65 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +1119 -0
- package/skills/a2h-utg-static/scripts/uniapp_widgets.mjs +244 -0
- package/skills/a2h-utg-static/scripts/utg_html.mjs +721 -0
- package/skills/a2h-utg-static/scripts/view_interactions.mjs +799 -0
- package/skills/a2h-utg-static/scripts/view_widgets.mjs +512 -0
- package/skills/a2h-utg-static/scripts/viewpage_nav.mjs +485 -0
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +422 -0
- package/skills/a2h-utg-static/scripts/window_nav.mjs +240 -0
- package/skills/a2h-utg-static/scripts/worklist_parts.mjs +154 -0
- package/skills/a2h-utg-static/tools/convert_static_utg_to_ui_elements.ts +769 -0
- package/skills/a2h-utg-static/tools/package.json +3 -0
- package/README.md +0 -445
- package/agents/logic-coder.md +0 -224
- package/agents/logic-context-builder.md +0 -212
- package/agents/scripts/hmos-precheck/backends/arkts.mjs +0 -567
- package/agents/scripts/hmos-precheck/backends/arkts_diff.mjs +0 -159
- package/agents/scripts/hmos-precheck/backends/arkts_project_rules.mjs +0 -398
- package/agents/scripts/hmos-precheck/backends/codelinter.mjs +0 -250
- package/agents/scripts/hmos-precheck/backends/project_integrity.mjs +0 -321
- package/agents/scripts/hmos-precheck/backends/static_precheck.mjs +0 -247
- package/agents/scripts/hmos-precheck/core/config.mjs +0 -184
- package/agents/scripts/hmos-precheck/core/diagnostic_scope.mjs +0 -20
- package/agents/scripts/hmos-precheck/core/process_adapter.mjs +0 -47
- package/agents/scripts/hmos-precheck/core/project_catalog.mjs +0 -50
- package/agents/scripts/hmos-precheck/core/result_projection.mjs +0 -147
- package/agents/scripts/hmos-precheck/core/scope_plan.mjs +0 -131
- package/agents/scripts/hmos-precheck/core/sdk_context.mjs +0 -67
- package/agents/scripts/hmos-precheck/docs/architecture.md +0 -37
- package/agents/scripts/hmos-precheck/docs/performance-optimization.md +0 -28
- package/agents/scripts/hmos-precheck/docs/upstream-reference.json +0 -19
- package/agents/scripts/hmos-precheck/docs/validation.md +0 -50
- package/agents/scripts/hmos-precheck/index.mjs +0 -17
- package/agents/scripts/hmos-precheck/invocation.mjs +0 -231
- package/agents/scripts/hmos-precheck/rules/rule_case_matrix.csv +0 -32
- package/agents/scripts/hmos-precheck/rules/rule_inventory.csv +0 -64
- package/agents/scripts/hmos-precheck/rules/rule_inventory.mjs +0 -59
- package/agents/scripts/hmos-precheck/rules/rule_policy.mjs +0 -54
- package/agents/scripts/platform_query.mjs +0 -626
- package/agents/scripts/platform_query.test.mjs +0 -422
- package/agents/self-test-fixer.md +0 -298
- package/agents/self-tester.md +0 -55
- package/agents/test-case-generation-generator.md +0 -317
- package/agents/test-case-generation-validator.md +0 -231
- package/dist/cli/config-store.js +0 -310
- package/dist/cli/config.js +0 -44
- package/dist/cli/env-vars.js +0 -127
- package/dist/cli/index.js +0 -56
- package/dist/cli/init.js +0 -1187
- package/dist/cli/uninstall.js +0 -427
- package/dist/utils/regex.js +0 -8
- package/env-requirements.json +0 -179
- package/resource/choose_editor.png +0 -0
- package/resource/convert_pipeline_process.svg +0 -103
- package/resource/project_architecture.svg +0 -122
- package/resource/set_environment.png +0 -0
- package/resource/set_multimodel.png +0 -0
- package/resource/set_sdk.png +0 -0
- package/resource/title_dark.png +0 -0
- package/skills/hmos-batch-ui-align/SKILL.md +0 -413
- package/skills/hmos-batch-ui-align/scripts/arkts_static_check.ts +0 -1592
- package/skills/hmos-batch-ui-align/scripts/measure_pack.ts +0 -752
- package/skills/hmos-convert-pipeline/SKILL.md +0 -486
- package/skills/hmos-incremental-ui-align/README.md +0 -251
- package/skills/hmos-incremental-ui-align/SKILL.md +0 -375
- package/skills/hmos-incremental-ui-align/diff_analysis.md +0 -53
- package/skills/hmos-incremental-ui-align/page_align.md +0 -62
- package/skills/hmos-incremental-ui-align/references/Comparison_Template.md +0 -38
- 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 +0 -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 +0 -2089
- 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 +0 -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 +0 -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 +0 -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 +0 -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 +0 -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 +0 -903
- 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 +0 -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 +0 -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 +0 -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 +0 -355
- 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 +0 -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 +0 -206
- 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 +0 -373
- 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 +0 -158
- 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 +0 -750
- 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 +0 -1704
- 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 +0 -1012
- 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 +0 -164
- 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 +0 -840
- 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 +0 -856
- 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 +0 -83
- 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 +0 -294
- 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 +0 -1220
- 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 +0 -47
- 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 +0 -840
- package/skills/hmos-incremental-ui-align/references/State_Model_Template.md +0 -74
- package/skills/hmos-incremental-ui-align/references/UI_Analysis_Template.md +0 -34
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +0 -2533
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-interaction-mapping-reference.md +0 -555
- package/skills/hmos-incremental-ui-align/references/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -117
- package/skills/hmos-incremental-ui-align/scripts/app_feature_verify.ts +0 -937
- package/skills/hmos-incremental-ui-align/scripts/extract_checklist.ts +0 -343
- package/skills/hmos-incremental-ui-align/scripts/navigation-capure.md +0 -76
- package/skills/hmos-incremental-ui-align/scripts/page_capture.ts +0 -977
- package/skills/hmos-incremental-ui-align/scripts/page_capture_burst.ts +0 -188
- package/skills/hmos-integration-test/README.md +0 -341
- package/skills/hmos-integration-test/SKILL.md +0 -464
- package/skills/hmos-integration-test/scripts/report-tool.ts +0 -791
- package/skills/hmos-integration-test/scripts/resolve-metadata-tool.ts +0 -125
- package/skills/hmos-integration-test/scripts/self-test-runner.ts +0 -756
- package/skills/hmos-integration-test/scripts/testcases-tool.ts +0 -239
- package/skills/hmos-resources-convert/SKILL.md +0 -891
- package/skills/hmos-spec-generate/SKILL.md +0 -404
- package/skills/hmos-test-case-generation/README.md +0 -241
- package/skills/hmos-test-case-generation/SKILL.md +0 -324
- package/skills/hmos-test-case-generation/references/contract.md +0 -315
- package/skills/hmos-test-case-generation/references/review-notes-template.md +0 -84
- package/skills/hmos-test-case-generation/references/ui-elements-schema.md +0 -142
- package/skills/hmos-test-case-generation/tools/convert_to_ui_elements.ts +0 -550
- package/skills/hmos-test-case-generation/tools/validate.ts +0 -1312
- package/tools/bfs-crawl/README.md +0 -73
- package/tools/bfs-crawl/android_viewtree_bfs_crawler.ts +0 -1662
- /package/skills/{hmos-batch-ui-align/references/mvvm-v2/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" → a2h-arch-generate/references/arkts-mvvm-v2.md} +0 -0
- /package/{README.en.md → skills/a2h-arch-generate/scripts/module_create/har/consumer-rules.txt} +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/!!/350/257/255/346/263/225/357/274/232/345/217/214/345/220/221/347/273/221/345/256/232.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Computed/350/243/205/351/245/260/345/231/250/357/274/232/350/256/241/347/256/227/345/261/236/346/200/247.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Event/350/243/205/351/245/260/345/231/250/357/274/232/350/247/204/350/214/203/347/273/204/344/273/266/350/276/223/345/207/272.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Local/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/351/203/250/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Monitor/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/344/277/256/346/224/271/345/274/202/346/255/245/347/233/221/345/220/254.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@ObservedV2/350/243/205/351/245/260/345/231/250/345/222/214@Trace/350/243/205/351/245/260/345/231/250/357/274/232/347/261/273/345/261/236/346/200/247/345/217/230/345/214/226/350/247/202/346/265/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Once/350/243/205/351/245/260/345/231/250/357/274/232/345/210/235/345/247/213/345/214/226/345/220/214/346/255/245/344/270/200/346/254/241.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Param/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/244/226/351/203/250/350/276/223/345/205/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Provider/350/243/205/351/245/260/345/231/250/345/222/214@Consumer/350/243/205/351/245/260/345/231/250/357/274/232/350/267/250/347/273/204/344/273/266/345/261/202/347/272/247/345/217/214/345/220/221/345/220/214/346/255/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/@Type/350/243/205/351/245/260/345/231/250/357/274/232/346/240/207/350/256/260/347/261/273/345/261/236/346/200/247/347/232/204/347/261/273/345/236/213.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/AppStorageV2/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200UI/347/212/266/346/200/201/345/255/230/345/202/250.md" +0 -0
- /package/skills/{hmos-incremental-ui-align/references/MVVM/345/274/200/345/217/221/346/226/207/346/241/243V2 → a2h-batch-ui-align/references/mvvm-v2}/MVVM/346/250/241/345/274/217/357/274/210V2/357/274/211.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/PersistenceV2/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/214/203/345/274/217/351/200/211/346/213/251/350/257/264/346/230/216.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md" +0 -0
- /package/skills/{hmos-batch-ui-align → a2h-batch-ui-align}/references/mvvm-v2//347/212/266/346/200/201/347/256/241/347/220/206V1/345/220/221V2/350/277/201/347/247/273/344/270/216/346/267/267/347/224/250/346/214/207/345/257/274.md" +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/arkts-strict-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/known-patterns.md +0 -0
- /package/skills/{hmos-fix-build-errors → a2h-fix-build-errors}/references/rdb-entity-pattern.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/references/dependency-analysis-rules.md +0 -0
- /package/skills/{hmos-resources-convert → a2h-resource-convert}/scripts/svg_fidelity_check.ts +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.txt +0 -0
- /package/skills/{hmos-spec-generate → a2h-spec-generate}/template/REQ.xlsx +0 -0
|
@@ -0,0 +1,1454 @@
|
|
|
1
|
+
// Python-compatibility helpers shared by the a2h-spec-design scripts.
|
|
2
|
+
//
|
|
3
|
+
// The .mjs ports stay behaviorally identical to the former Python scripts:
|
|
4
|
+
// argparse-style argument parsing (usage errors on stderr with exit code 2),
|
|
5
|
+
// json.dumps(ensure_ascii=False, indent=2) output formatting, pathlib
|
|
6
|
+
// resolve/stat semantics, Python str.strip()/str.splitlines() whitespace and
|
|
7
|
+
// line-boundary rules, and tempfile.mkstemp-style atomic writes. The skill
|
|
8
|
+
// directory ships standalone, so nothing here may depend on node_modules or
|
|
9
|
+
// on other skills.
|
|
10
|
+
|
|
11
|
+
import fs from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
import os from "node:os";
|
|
14
|
+
import process from "node:process";
|
|
15
|
+
import { randomBytes } from "node:crypto";
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Python string semantics
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
// Python str.isspace()/strip() and re \s whitespace set (unicode, no BOM).
|
|
22
|
+
const PY_WS = new Set([
|
|
23
|
+
" ", "\t", "\n", "\v", "\f", "\r", "\x1c", "\x1d", "\x1e", "\x1f", "\x85",
|
|
24
|
+
"\xa0", "\u1680", "\u2028", "\u2029", "\u202f", "\u205f", "\u3000",
|
|
25
|
+
]);
|
|
26
|
+
for (let c = 0x2000; c <= 0x200a; c += 1) PY_WS.add(String.fromCodePoint(c));
|
|
27
|
+
|
|
28
|
+
export function pyIsSpace(ch) {
|
|
29
|
+
return PY_WS.has(ch);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// str.strip() / str.rstrip() with no argument: strip Python whitespace.
|
|
33
|
+
export function pyStrip(s) {
|
|
34
|
+
let start = 0;
|
|
35
|
+
let end = s.length;
|
|
36
|
+
while (start < end && PY_WS.has(s[start])) start += 1;
|
|
37
|
+
while (end > start && PY_WS.has(s[end - 1])) end -= 1;
|
|
38
|
+
return s.slice(start, end);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function pyRstrip(s) {
|
|
42
|
+
let end = s.length;
|
|
43
|
+
while (end > 0 && PY_WS.has(s[end - 1])) end -= 1;
|
|
44
|
+
return s.slice(0, end);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// str.rstrip(chars): strip any trailing character from the given set.
|
|
48
|
+
export function pyRstripChars(s, chars) {
|
|
49
|
+
let end = s.length;
|
|
50
|
+
const set = new Set(chars);
|
|
51
|
+
while (end > 0 && set.has(s[end - 1])) end -= 1;
|
|
52
|
+
return s.slice(0, end);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// str.splitlines() line boundaries. Note \x1f is whitespace for strip() but
|
|
56
|
+
// NOT a splitlines boundary (matching Python).
|
|
57
|
+
const LINE_BOUNDARIES = new Set(["\n", "\v", "\f", "\r", "\x1c", "\x1d", "\x1e", "\x85", "\u2028", "\u2029"]);
|
|
58
|
+
|
|
59
|
+
function isLineBoundary(ch) {
|
|
60
|
+
return LINE_BOUNDARIES.has(ch);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function splitLinesKeepEnds(text) {
|
|
64
|
+
const lines = [];
|
|
65
|
+
let current = "";
|
|
66
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
67
|
+
const ch = text[i];
|
|
68
|
+
if (ch === "\r" && text[i + 1] === "\n") {
|
|
69
|
+
lines.push(`${current}\r\n`);
|
|
70
|
+
current = "";
|
|
71
|
+
i += 1;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (isLineBoundary(ch)) {
|
|
75
|
+
lines.push(current + ch);
|
|
76
|
+
current = "";
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
current += ch;
|
|
80
|
+
}
|
|
81
|
+
if (current.length > 0) lines.push(current);
|
|
82
|
+
return lines;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function splitLines(text) {
|
|
86
|
+
return splitLinesKeepEnds(text).map(pyRstrip);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// Path helpers (pathlib semantics)
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
export function expanduser(p) {
|
|
94
|
+
if (p === "~") return os.homedir();
|
|
95
|
+
if (p.startsWith("~/")) return path.join(os.homedir(), p.slice(2));
|
|
96
|
+
return p;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const resolveCache = new Map();
|
|
100
|
+
|
|
101
|
+
// pathlib.Path.resolve(): absolute + every symlink component resolved,
|
|
102
|
+
// missing trailing components tolerated (strict=False).
|
|
103
|
+
export function resolveLikePython(inputPath) {
|
|
104
|
+
const abs = path.resolve(inputPath);
|
|
105
|
+
if (resolveCache.has(abs)) return resolveCache.get(abs);
|
|
106
|
+
const root = path.parse(abs).root;
|
|
107
|
+
const parts = abs.slice(root.length).split(path.sep).filter((part) => part.length > 0);
|
|
108
|
+
let current = root;
|
|
109
|
+
for (const part of parts) {
|
|
110
|
+
const next = path.join(current, part);
|
|
111
|
+
try {
|
|
112
|
+
const linkTarget = fs.readlinkSync(next);
|
|
113
|
+
current = resolveLikePython(path.resolve(current, linkTarget));
|
|
114
|
+
} catch {
|
|
115
|
+
current = next;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const result = path.normalize(current);
|
|
119
|
+
resolveCache.set(abs, result);
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function isUnderResolved(candidate, base) {
|
|
124
|
+
if (candidate === base) return true;
|
|
125
|
+
const rel = path.relative(base, candidate);
|
|
126
|
+
return rel !== "" && rel !== ".." && !rel.startsWith(`..${path.sep}`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function statFollowing(p) {
|
|
130
|
+
try {
|
|
131
|
+
return fs.statSync(p);
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function isFile(p) {
|
|
138
|
+
const stat = statFollowing(p);
|
|
139
|
+
return stat !== null && stat.isFile();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function isDir(p) {
|
|
143
|
+
const stat = statFollowing(p);
|
|
144
|
+
return stat !== null && stat.isDirectory();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function pathExists(p) {
|
|
148
|
+
return statFollowing(p) !== null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// pathlib.PurePath.stem: filename minus its last suffix (".gitignore" and
|
|
152
|
+
// "file." keep their full name because there is no valid suffix).
|
|
153
|
+
export function stemOf(name) {
|
|
154
|
+
const i = name.lastIndexOf(".");
|
|
155
|
+
if (i <= 0 || i === name.length - 1) return name;
|
|
156
|
+
return name.slice(0, i);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// str(PurePath(text)): drop empty and "." components, keep "..", forward
|
|
160
|
+
// slashes; "" maps to ".".
|
|
161
|
+
export function purePosixDisplay(text) {
|
|
162
|
+
const parts = text.split("/").filter((part) => part.length > 0 && part !== ".");
|
|
163
|
+
if (parts.length === 0) return ".";
|
|
164
|
+
return parts.join("/");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
// JSON serialization (json.dumps ensure_ascii=False, indent=2)
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
function pyJsonString(value, ensureAscii) {
|
|
172
|
+
let out = '"';
|
|
173
|
+
for (const ch of value) {
|
|
174
|
+
const code = ch.codePointAt(0);
|
|
175
|
+
if (ch === '"') {
|
|
176
|
+
out += '\\"';
|
|
177
|
+
} else if (ch === "\\") {
|
|
178
|
+
out += "\\\\";
|
|
179
|
+
} else if (code === 0x08) {
|
|
180
|
+
out += "\\b";
|
|
181
|
+
} else if (code === 0x09) {
|
|
182
|
+
out += "\\t";
|
|
183
|
+
} else if (code === 0x0a) {
|
|
184
|
+
out += "\\n";
|
|
185
|
+
} else if (code === 0x0c) {
|
|
186
|
+
out += "\\f";
|
|
187
|
+
} else if (code === 0x0d) {
|
|
188
|
+
out += "\\r";
|
|
189
|
+
} else if (code < 0x20) {
|
|
190
|
+
out += `\\u${code.toString(16).padStart(4, "0")}`;
|
|
191
|
+
} else if (ensureAscii && code > 0x7e) {
|
|
192
|
+
if (code > 0xffff) {
|
|
193
|
+
const v = code - 0x10000;
|
|
194
|
+
const hi = 0xd800 + (v >> 10);
|
|
195
|
+
const lo = 0xdc00 + (v & 0x3ff);
|
|
196
|
+
out += `\\u${hi.toString(16).padStart(4, "0")}\\u${lo.toString(16).padStart(4, "0")}`;
|
|
197
|
+
} else {
|
|
198
|
+
out += `\\u${code.toString(16).padStart(4, "0")}`;
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
out += ch;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return `${out}"`;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function compareCodePoints(a, b) {
|
|
208
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// json.dumps(value, ...): options { indent (null = single line), ensureAscii,
|
|
212
|
+
// sortKeys }. Default matches json.dumps(x, ensure_ascii=False, indent=2).
|
|
213
|
+
// With indent=null the separators are (", ", ": ") like Python's default.
|
|
214
|
+
export function pyJsonDump(value, options = {}) {
|
|
215
|
+
const indent = options.indent === undefined ? 2 : options.indent;
|
|
216
|
+
const ensureAscii = options.ensureAscii === undefined ? false : options.ensureAscii;
|
|
217
|
+
const sortKeys = options.sortKeys === undefined ? false : options.sortKeys;
|
|
218
|
+
|
|
219
|
+
const dump = (item, level) => {
|
|
220
|
+
if (item === null || item === undefined) return "null";
|
|
221
|
+
if (typeof item === "boolean") return item ? "true" : "false";
|
|
222
|
+
if (typeof item === "number") {
|
|
223
|
+
if (Number.isInteger(item)) return String(item);
|
|
224
|
+
return String(item);
|
|
225
|
+
}
|
|
226
|
+
if (typeof item === "bigint") return item.toString();
|
|
227
|
+
if (typeof item === "string") return pyJsonString(item, ensureAscii);
|
|
228
|
+
if (Array.isArray(item)) {
|
|
229
|
+
if (item.length === 0) return "[]";
|
|
230
|
+
const entries = item.map((entry) => dump(entry, indent === null ? level : level + 1));
|
|
231
|
+
if (indent === null) return `[${entries.join(", ")}]`;
|
|
232
|
+
const unit = " ".repeat(indent);
|
|
233
|
+
const inner = unit.repeat(level + 1);
|
|
234
|
+
const body = entries.map((entry) => inner + entry).join(",\n");
|
|
235
|
+
return `[\n${body}\n${unit.repeat(level)}]`;
|
|
236
|
+
}
|
|
237
|
+
if (item !== null && typeof item === "object") {
|
|
238
|
+
let keys = Object.keys(item);
|
|
239
|
+
if (sortKeys) keys = [...keys].sort(compareCodePoints);
|
|
240
|
+
if (keys.length === 0) return "{}";
|
|
241
|
+
const entries = keys.map((key) => [key, item[key]]);
|
|
242
|
+
if (indent === null) {
|
|
243
|
+
return `{${entries.map(([key, entry]) => `${pyJsonString(String(key), ensureAscii)}: ${dump(entry, 0)}`).join(", ")}}`;
|
|
244
|
+
}
|
|
245
|
+
const unit = " ".repeat(indent);
|
|
246
|
+
const inner = unit.repeat(level + 1);
|
|
247
|
+
const body = entries
|
|
248
|
+
.map(([key, entry]) => `${inner}${pyJsonString(String(key), ensureAscii)}: ${dump(entry, level + 1)}`)
|
|
249
|
+
.join(",\n");
|
|
250
|
+
return `{\n${body}\n${unit.repeat(level)}}`;
|
|
251
|
+
}
|
|
252
|
+
throw new TypeError(`cannot serialize value of type ${typeof item}`);
|
|
253
|
+
};
|
|
254
|
+
return dump(value, 0);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// ---------------------------------------------------------------------------
|
|
258
|
+
// argparse (subset used by these scripts)
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
// shutil.get_terminal_size(): COLUMNS env wins, else the real stdout tty
|
|
262
|
+
// width, else the (80, 24) fallback.
|
|
263
|
+
function terminalColumns() {
|
|
264
|
+
const envCols = Number.parseInt(process.env.COLUMNS || "", 10);
|
|
265
|
+
if (Number.isInteger(envCols) && envCols > 0) return envCols;
|
|
266
|
+
if (process.stdout && process.stdout.isTTY && process.stdout.columns > 0) {
|
|
267
|
+
return process.stdout.columns;
|
|
268
|
+
}
|
|
269
|
+
return 80;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export class ArgParser {
|
|
273
|
+
constructor(prog, description = "") {
|
|
274
|
+
this.prog = prog;
|
|
275
|
+
this.description = description;
|
|
276
|
+
this.positionals = [];
|
|
277
|
+
this.declared = []; // declaration order: {kind:"positional"} | {kind:"option"}
|
|
278
|
+
this.options = new Map(); // flag -> { flag, choices, default, help, ... }
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
addPositional(name) {
|
|
282
|
+
this.positionals.push(name);
|
|
283
|
+
this.declared.push({ kind: "positional", name });
|
|
284
|
+
return this;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
addOption(flag, {
|
|
288
|
+
choices = null,
|
|
289
|
+
default: defaultValue = null,
|
|
290
|
+
help = "",
|
|
291
|
+
short = null,
|
|
292
|
+
storeTrue = false,
|
|
293
|
+
version = null,
|
|
294
|
+
type = null,
|
|
295
|
+
required = false,
|
|
296
|
+
} = {}) {
|
|
297
|
+
const opt = { flag, choices, default: defaultValue, help, short, storeTrue, version, type, required };
|
|
298
|
+
this.options.set(flag, opt);
|
|
299
|
+
if (short) this.options.set(short, opt);
|
|
300
|
+
this.declared.push({ kind: "option", opt });
|
|
301
|
+
return this;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
static destOf(flag) {
|
|
305
|
+
return flag.replace(/^--/, "").replace(/-/g, "_");
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// argparse._format_usage port: single line when it fits, else the option
|
|
309
|
+
// block wraps first (first line prefixed with "usage: <prog>"), then the
|
|
310
|
+
// positional block wraps separately on fresh lines at the same indent.
|
|
311
|
+
usageLine() {
|
|
312
|
+
const optParts = ["[-h]"];
|
|
313
|
+
const seen = new Set();
|
|
314
|
+
for (const opt of this.options.values()) {
|
|
315
|
+
if (seen.has(opt.flag)) continue;
|
|
316
|
+
seen.add(opt.flag);
|
|
317
|
+
const metavar = opt.choices
|
|
318
|
+
? `{${opt.choices.join(",")}}`
|
|
319
|
+
: opt.storeTrue || opt.version
|
|
320
|
+
? null
|
|
321
|
+
: ArgParser.destOf(opt.flag).toUpperCase();
|
|
322
|
+
if (opt.required) {
|
|
323
|
+
// argparse's usage-wrap part regexp splits the unbracketed required
|
|
324
|
+
// form on whitespace (flag and metavar become separate parts).
|
|
325
|
+
if (metavar) {
|
|
326
|
+
optParts.push(opt.flag, metavar);
|
|
327
|
+
} else {
|
|
328
|
+
optParts.push(opt.flag);
|
|
329
|
+
}
|
|
330
|
+
} else {
|
|
331
|
+
optParts.push(metavar ? `[${opt.flag} ${metavar}]` : `[${opt.flag}]`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const posParts = [...this.positionals];
|
|
335
|
+
|
|
336
|
+
const prefix = "usage: ";
|
|
337
|
+
const prog = this.prog;
|
|
338
|
+
const textWidth = terminalColumns() - 2;
|
|
339
|
+
const usage = [prog, ...optParts, ...posParts].filter(Boolean).join(" ");
|
|
340
|
+
if (prefix.length + usage.length <= textWidth) {
|
|
341
|
+
return `${prefix}${usage}`;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const getLines = (parts, indent, linePrefix = null) => {
|
|
345
|
+
const lines = [];
|
|
346
|
+
let line = [];
|
|
347
|
+
const indentLength = indent.length;
|
|
348
|
+
let lineLen = linePrefix !== null ? linePrefix.length - 1 : indentLength - 1;
|
|
349
|
+
for (const part of parts) {
|
|
350
|
+
if (lineLen + 1 + part.length > textWidth && line.length > 0) {
|
|
351
|
+
lines.push(indent + line.join(" "));
|
|
352
|
+
line = [];
|
|
353
|
+
lineLen = indentLength - 1;
|
|
354
|
+
}
|
|
355
|
+
line.push(part);
|
|
356
|
+
lineLen += part.length + 1;
|
|
357
|
+
}
|
|
358
|
+
if (line.length > 0) {
|
|
359
|
+
lines.push(indent + line.join(" "));
|
|
360
|
+
}
|
|
361
|
+
if (linePrefix !== null && lines.length > 0) {
|
|
362
|
+
lines[0] = lines[0].slice(indentLength);
|
|
363
|
+
}
|
|
364
|
+
return lines;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
let lines;
|
|
368
|
+
if (prefix.length + prog.length <= 0.75 * textWidth) {
|
|
369
|
+
const indent = " ".repeat(prefix.length + prog.length + 1);
|
|
370
|
+
if (optParts.length > 0) {
|
|
371
|
+
lines = getLines([prog, ...optParts], indent, prefix);
|
|
372
|
+
lines.push(...getLines(posParts, indent));
|
|
373
|
+
} else if (posParts.length > 0) {
|
|
374
|
+
lines = getLines([prog, ...posParts], indent, prefix);
|
|
375
|
+
} else {
|
|
376
|
+
lines = [prog];
|
|
377
|
+
}
|
|
378
|
+
} else {
|
|
379
|
+
const indent = " ".repeat(prefix.length);
|
|
380
|
+
let candidate = getLines([...optParts, ...posParts], indent);
|
|
381
|
+
if (candidate.length > 1) {
|
|
382
|
+
candidate = [
|
|
383
|
+
...getLines(optParts, indent),
|
|
384
|
+
...getLines(posParts, indent),
|
|
385
|
+
];
|
|
386
|
+
}
|
|
387
|
+
lines = [prog, ...candidate];
|
|
388
|
+
}
|
|
389
|
+
return `${prefix}${lines.join("\n")}`;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
printHelp() {
|
|
393
|
+
const lines = [this.usageLine(), ""];
|
|
394
|
+
if (this.description) {
|
|
395
|
+
lines.push(this.description, "");
|
|
396
|
+
}
|
|
397
|
+
lines.push("options:");
|
|
398
|
+
lines.push(" -h, --help show this help message and exit");
|
|
399
|
+
const width = Math.max(...[...this.options.values()].map((o) => o.flag.length), 0);
|
|
400
|
+
for (const opt of this.options.values()) {
|
|
401
|
+
const metavar = opt.choices
|
|
402
|
+
? `{${opt.choices.join(",")}}`
|
|
403
|
+
: ArgParser.destOf(opt.flag).toUpperCase();
|
|
404
|
+
const left = ` ${opt.flag} ${metavar}`.padEnd(width + 8);
|
|
405
|
+
let right = opt.help;
|
|
406
|
+
if (opt.choices) right += ` (choices: ${opt.choices.join(", ")})`;
|
|
407
|
+
if (opt.default !== null && opt.default !== undefined) right += ` (default: ${opt.default})`;
|
|
408
|
+
lines.push(`${left}${right}`);
|
|
409
|
+
}
|
|
410
|
+
process.stdout.write(`${lines.join("\n")}\n`);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
error(message) {
|
|
414
|
+
process.stderr.write(`${this.usageLine()}\n${this.prog}: error: ${message}\n`);
|
|
415
|
+
process.exit(2);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Returns { opt } on a hit, { ambiguous: flags } on an ambiguous
|
|
419
|
+
// abbreviation, { opt: null } when nothing matches.
|
|
420
|
+
resolveOption(name) {
|
|
421
|
+
if (this.options.has(name)) return { opt: this.options.get(name), ambiguous: null };
|
|
422
|
+
if (!name.startsWith("--")) return { opt: null, ambiguous: null };
|
|
423
|
+
const matches = [...this.options.keys()].filter((flag) => flag.startsWith(name) && flag.startsWith("--"));
|
|
424
|
+
if (matches.length === 1) return { opt: this.options.get(matches[0]), ambiguous: null };
|
|
425
|
+
if (matches.length > 1) return { opt: null, ambiguous: matches };
|
|
426
|
+
return { opt: null, ambiguous: null };
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
applyOption(values, name, opt, inlineValue, _argv, _setI, _atEnd, _nextValue) {
|
|
430
|
+
if (opt.version) {
|
|
431
|
+
process.stdout.write(`${this.prog} ${opt.version}\n`);
|
|
432
|
+
process.exit(0);
|
|
433
|
+
}
|
|
434
|
+
if (opt.storeTrue) {
|
|
435
|
+
values[ArgParser.destOf(opt.flag)] = true;
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
let value = inlineValue;
|
|
439
|
+
if (value === undefined) {
|
|
440
|
+
if (_atEnd()) this.error(`argument ${name}: expected one argument`);
|
|
441
|
+
value = _nextValue();
|
|
442
|
+
}
|
|
443
|
+
if (opt.type === "int") {
|
|
444
|
+
if (!/^[+-]?\d+$/.test(String(value).trim())) {
|
|
445
|
+
this.error(`argument ${name}: invalid int value: '${value}'`);
|
|
446
|
+
}
|
|
447
|
+
value = Number.parseInt(String(value), 10);
|
|
448
|
+
}
|
|
449
|
+
if (opt.choices && !opt.choices.includes(value)) {
|
|
450
|
+
this.error(`argument ${name}: invalid choice: '${value}' (choose from ${opt.choices.join(", ")})`);
|
|
451
|
+
}
|
|
452
|
+
values[ArgParser.destOf(opt.flag)] = value;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
parse(argv) {
|
|
456
|
+
const values = {};
|
|
457
|
+
const requiredOptions = [];
|
|
458
|
+
const seenFlags = new Set();
|
|
459
|
+
for (const opt of this.options.values()) {
|
|
460
|
+
if (!seenFlags.has(opt.flag)) {
|
|
461
|
+
seenFlags.add(opt.flag);
|
|
462
|
+
values[ArgParser.destOf(opt.flag)] = opt.default;
|
|
463
|
+
if (opt.required) requiredOptions.push(opt);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const positionalCandidates = [];
|
|
468
|
+
const extras = [];
|
|
469
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
470
|
+
const arg = argv[i];
|
|
471
|
+
if (arg === "-h" || arg === "--help") {
|
|
472
|
+
this.printHelp();
|
|
473
|
+
process.exit(0);
|
|
474
|
+
}
|
|
475
|
+
if (arg === "--") {
|
|
476
|
+
positionalCandidates.push(...argv.slice(i + 1));
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
if (arg.startsWith("--")) {
|
|
480
|
+
let name = arg;
|
|
481
|
+
let inlineValue;
|
|
482
|
+
const eq = arg.indexOf("=");
|
|
483
|
+
if (eq >= 0) {
|
|
484
|
+
name = arg.slice(0, eq);
|
|
485
|
+
inlineValue = arg.slice(eq + 1);
|
|
486
|
+
}
|
|
487
|
+
const { opt, ambiguous } = this.resolveOption(name);
|
|
488
|
+
if (ambiguous) {
|
|
489
|
+
this.error(`ambiguous option: ${name} could match ${ambiguous.join(", ")}`);
|
|
490
|
+
}
|
|
491
|
+
if (!opt) {
|
|
492
|
+
// argparse does not consume the following value for an unknown flag.
|
|
493
|
+
extras.push(arg);
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
this.applyOption(values, name, opt, inlineValue, argv, (n) => { i = n; }, () => i + 1 >= argv.length, () => argv[(i += 1)]);
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
if (arg.startsWith("-") && arg.length > 1 && !arg.startsWith("--")) {
|
|
500
|
+
// short option: "-o value" or "-ovalue"
|
|
501
|
+
const name = arg.slice(0, 2);
|
|
502
|
+
const attached = arg.slice(2);
|
|
503
|
+
const { opt } = this.resolveOption(name);
|
|
504
|
+
if (opt) {
|
|
505
|
+
this.applyOption(values, name, opt, attached.length > 0 ? attached : undefined, argv, (n) => { i = n; }, () => i + 1 >= argv.length, () => argv[(i += 1)]);
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
positionalCandidates.push(arg);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
// argparse order: missing required positionals are reported before any
|
|
513
|
+
// unrecognized extras.
|
|
514
|
+
// argparse reports every missing required action (positionals and options
|
|
515
|
+
// together) in declaration order.
|
|
516
|
+
const missingRequired = [];
|
|
517
|
+
let positionalIndex = 0;
|
|
518
|
+
for (const entry of this.declared) {
|
|
519
|
+
if (entry.kind === "positional") {
|
|
520
|
+
if (positionalIndex >= positionalCandidates.length) {
|
|
521
|
+
missingRequired.push(entry.name);
|
|
522
|
+
}
|
|
523
|
+
positionalIndex += 1;
|
|
524
|
+
} else if (
|
|
525
|
+
entry.opt.required
|
|
526
|
+
&& (values[ArgParser.destOf(entry.opt.flag)] === null
|
|
527
|
+
|| values[ArgParser.destOf(entry.opt.flag)] === undefined)
|
|
528
|
+
) {
|
|
529
|
+
missingRequired.push(entry.opt.flag);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (missingRequired.length > 0) {
|
|
533
|
+
this.error(`the following arguments are required: ${missingRequired.join(", ")}`);
|
|
534
|
+
}
|
|
535
|
+
if (positionalCandidates.length > this.positionals.length) {
|
|
536
|
+
extras.push(...positionalCandidates.slice(this.positionals.length));
|
|
537
|
+
}
|
|
538
|
+
if (extras.length > 0) {
|
|
539
|
+
this.error(`unrecognized arguments: ${extras.join(" ")}`);
|
|
540
|
+
}
|
|
541
|
+
this.positionals.forEach((name, idx) => {
|
|
542
|
+
values[name] = positionalCandidates[idx];
|
|
543
|
+
});
|
|
544
|
+
return values;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// ---------------------------------------------------------------------------
|
|
549
|
+
// Atomic writes (tempfile.mkstemp + os.replace)
|
|
550
|
+
// ---------------------------------------------------------------------------
|
|
551
|
+
|
|
552
|
+
// Create a unique temp file next to `p` (like tempfile.mkstemp with prefix),
|
|
553
|
+
// write `content` UTF-8 with no newline translation, and give it the source
|
|
554
|
+
// file's permission bits. Returns the temp path; the caller renames it.
|
|
555
|
+
export function writeTempBeside(p, content, { prefix = null } = {}) {
|
|
556
|
+
const mode = fs.statSync(p).mode & 0o7777;
|
|
557
|
+
const dir = path.dirname(p);
|
|
558
|
+
const prefixValue = prefix === null ? `.${path.basename(p)}.` : prefix;
|
|
559
|
+
for (;;) {
|
|
560
|
+
const candidate = path.join(dir, prefix + randomBytes(8).toString("hex"));
|
|
561
|
+
let fd;
|
|
562
|
+
try {
|
|
563
|
+
fd = fs.openSync(candidate, "wx");
|
|
564
|
+
} catch (err) {
|
|
565
|
+
if (err && err.code === "EEXIST") continue;
|
|
566
|
+
throw err;
|
|
567
|
+
}
|
|
568
|
+
try {
|
|
569
|
+
fs.writeFileSync(fd, content, "utf8");
|
|
570
|
+
} catch (err) {
|
|
571
|
+
try {
|
|
572
|
+
fs.closeSync(fd);
|
|
573
|
+
} catch { /* best effort */ }
|
|
574
|
+
try {
|
|
575
|
+
fs.unlinkSync(candidate);
|
|
576
|
+
} catch { /* best effort */ }
|
|
577
|
+
throw err;
|
|
578
|
+
}
|
|
579
|
+
fs.closeSync(fd);
|
|
580
|
+
fs.chmodSync(candidate, mode);
|
|
581
|
+
return candidate;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export function unlinkMissingOk(p) {
|
|
586
|
+
try {
|
|
587
|
+
fs.unlinkSync(p);
|
|
588
|
+
} catch (err) {
|
|
589
|
+
if (err && err.code === "ENOENT") return;
|
|
590
|
+
throw err;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Python SystemExit(message): message to stderr, exit status 1.
|
|
595
|
+
export function systemExit(message) {
|
|
596
|
+
process.stderr.write(`${message}\n`);
|
|
597
|
+
process.exit(1);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
// ---------------------------------------------------------------------------
|
|
601
|
+
// JSON parser (self-contained; replaces the Python `json5` dependency).
|
|
602
|
+
//
|
|
603
|
+
// Two modes:
|
|
604
|
+
// - lenient (parseJson5): full JSON5 grammar for build-profile.json5 /
|
|
605
|
+
// module.json5 (comments, trailing commas, unquoted keys, hex, ...).
|
|
606
|
+
// - strict (parseStrictJson): exact JSON grammar for the scanner's own
|
|
607
|
+
// artifacts, replacing JSON.parse. Plain integers parse as BigInt because
|
|
608
|
+
// nanosecond mtimes exceed Number.MAX_SAFE_INTEGER; JSON.parse would
|
|
609
|
+
// silently round them (Python json.load keeps arbitrary-precision ints).
|
|
610
|
+
// ---------------------------------------------------------------------------
|
|
611
|
+
|
|
612
|
+
const LENIENT_WHITESPACE = new Set([
|
|
613
|
+
"\t", "\v", "\f", "\r", "\n", " ", "\u00a0", "\u1680", "\u2028", "\u2029",
|
|
614
|
+
"\u202f", "\u205f", "\u3000", "\ufeff",
|
|
615
|
+
]);
|
|
616
|
+
for (let c = 0x2000; c <= 0x200a; c += 1) LENIENT_WHITESPACE.add(String.fromCodePoint(c));
|
|
617
|
+
const STRICT_WHITESPACE = new Set(["\t", "\n", "\r", " "]);
|
|
618
|
+
|
|
619
|
+
const DECIMAL_DIGITS = "0123456789";
|
|
620
|
+
const HEX_DIGITS = "0123456789abcdefABCDEF";
|
|
621
|
+
|
|
622
|
+
function isIdentifierStart(ch) {
|
|
623
|
+
if (ch === "$" || ch === "_") return true;
|
|
624
|
+
const code = ch.codePointAt(0);
|
|
625
|
+
if ((code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a)) return true;
|
|
626
|
+
return code >= 0x80;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function isIdentifierPart(ch) {
|
|
630
|
+
return isIdentifierStart(ch) || DECIMAL_DIGITS.includes(ch);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
class Json5Parser {
|
|
634
|
+
constructor(text, strict = false) {
|
|
635
|
+
this.text = text;
|
|
636
|
+
this.pos = 0;
|
|
637
|
+
this.length = text.length;
|
|
638
|
+
this.strict = strict;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
fail(message) {
|
|
642
|
+
throw new SyntaxError(`${message} at position ${this.pos}`);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
peek(offset = 0) {
|
|
646
|
+
return this.text[this.pos + offset];
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
skipTrivia() {
|
|
650
|
+
const whitespace = this.strict ? STRICT_WHITESPACE : LENIENT_WHITESPACE;
|
|
651
|
+
while (this.pos < this.length) {
|
|
652
|
+
const ch = this.text[this.pos];
|
|
653
|
+
if (whitespace.has(ch)) {
|
|
654
|
+
this.pos += 1;
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
if (!this.strict && ch === "/" && this.peek(1) === "/") {
|
|
658
|
+
while (this.pos < this.length && this.text[this.pos] !== "\n") this.pos += 1;
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (!this.strict && ch === "/" && this.peek(1) === "*") {
|
|
662
|
+
const end = this.text.indexOf("*/", this.pos + 2);
|
|
663
|
+
if (end < 0) this.fail("unterminated block comment");
|
|
664
|
+
this.pos = end + 2;
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
parseValue() {
|
|
672
|
+
this.skipTrivia();
|
|
673
|
+
if (this.pos >= this.length) this.fail("unexpected end of input");
|
|
674
|
+
const ch = this.peek();
|
|
675
|
+
if (ch === "{") return this.parseObject();
|
|
676
|
+
if (ch === "[") return this.parseArray();
|
|
677
|
+
if (ch === '"') return this.parseString();
|
|
678
|
+
if (!this.strict && ch === "'") return this.parseString();
|
|
679
|
+
if (!this.strict && (ch === "+" || ch === "-" || ch === ".")) return this.parseNumber();
|
|
680
|
+
if (this.strict && ch === "-") return this.parseNumber();
|
|
681
|
+
if (DECIMAL_DIGITS.includes(ch)) return this.parseNumber();
|
|
682
|
+
if (isIdentifierStart(ch)) return this.parseWordOrNumber();
|
|
683
|
+
this.fail(`unexpected character '${ch}'`);
|
|
684
|
+
return undefined;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
parseWordOrNumber() {
|
|
688
|
+
const start = this.pos;
|
|
689
|
+
const word = this.parseIdentifierName();
|
|
690
|
+
if (word === "true") return true;
|
|
691
|
+
if (word === "false") return false;
|
|
692
|
+
if (word === "null") return null;
|
|
693
|
+
if (this.strict) {
|
|
694
|
+
this.pos = start;
|
|
695
|
+
this.fail(`unexpected token '${word}'`);
|
|
696
|
+
}
|
|
697
|
+
if (word === "undefined") return null;
|
|
698
|
+
if (word === "Infinity") return Infinity;
|
|
699
|
+
if (word === "NaN") return NaN;
|
|
700
|
+
this.pos = start;
|
|
701
|
+
this.fail(`unexpected token '${word}'`);
|
|
702
|
+
return undefined;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
parseIdentifierName() {
|
|
706
|
+
let name = "";
|
|
707
|
+
if (this.peek() === "\\") {
|
|
708
|
+
name += this.parseUnicodeEscapeSequence();
|
|
709
|
+
} else {
|
|
710
|
+
const ch = this.peek();
|
|
711
|
+
if (ch === undefined || !isIdentifierStart(ch)) this.fail("invalid identifier");
|
|
712
|
+
name += ch;
|
|
713
|
+
this.pos += 1;
|
|
714
|
+
}
|
|
715
|
+
while (this.pos < this.length) {
|
|
716
|
+
if (this.peek() === "\\") {
|
|
717
|
+
name += this.parseUnicodeEscapeSequence();
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
const ch = this.peek();
|
|
721
|
+
if (ch === undefined || !isIdentifierPart(ch)) break;
|
|
722
|
+
name += ch;
|
|
723
|
+
this.pos += 1;
|
|
724
|
+
}
|
|
725
|
+
return name;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
parseUnicodeEscapeSequence() {
|
|
729
|
+
if (this.peek(1) !== "u") this.fail("invalid escape in identifier");
|
|
730
|
+
this.pos += 2;
|
|
731
|
+
if (this.peek() === "{") {
|
|
732
|
+
this.pos += 1;
|
|
733
|
+
let hex = "";
|
|
734
|
+
while (this.peek() !== "}" && this.pos < this.length) {
|
|
735
|
+
hex += this.peek();
|
|
736
|
+
this.pos += 1;
|
|
737
|
+
}
|
|
738
|
+
if (this.peek() !== "}" || hex.length === 0 || hex.length > 6) this.fail("invalid unicode escape");
|
|
739
|
+
this.pos += 1;
|
|
740
|
+
const code = Number.parseInt(hex, 16);
|
|
741
|
+
if (!Number.isFinite(code)) this.fail("invalid unicode escape");
|
|
742
|
+
return String.fromCodePoint(code);
|
|
743
|
+
}
|
|
744
|
+
let hex = "";
|
|
745
|
+
for (let i = 0; i < 4; i += 1) {
|
|
746
|
+
const ch = this.peek();
|
|
747
|
+
if (ch === undefined || !HEX_DIGITS.includes(ch)) this.fail("invalid unicode escape");
|
|
748
|
+
hex += ch;
|
|
749
|
+
this.pos += 1;
|
|
750
|
+
}
|
|
751
|
+
return String.fromCodePoint(Number.parseInt(hex, 16));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
parseObject() {
|
|
755
|
+
this.pos += 1; // consume '{'
|
|
756
|
+
const result = {};
|
|
757
|
+
this.skipTrivia();
|
|
758
|
+
if (this.peek() === "}") {
|
|
759
|
+
this.pos += 1;
|
|
760
|
+
return result;
|
|
761
|
+
}
|
|
762
|
+
for (;;) {
|
|
763
|
+
this.skipTrivia();
|
|
764
|
+
const key = this.parseMemberKey();
|
|
765
|
+
this.skipTrivia();
|
|
766
|
+
if (this.peek() !== ":") this.fail("expected ':' after object key");
|
|
767
|
+
this.pos += 1;
|
|
768
|
+
const value = this.parseValue();
|
|
769
|
+
result[key] = value;
|
|
770
|
+
this.skipTrivia();
|
|
771
|
+
const ch = this.peek();
|
|
772
|
+
if (ch === ",") {
|
|
773
|
+
this.pos += 1;
|
|
774
|
+
this.skipTrivia();
|
|
775
|
+
if (!this.strict && this.peek() === "}") {
|
|
776
|
+
this.pos += 1;
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
779
|
+
continue;
|
|
780
|
+
}
|
|
781
|
+
if (ch === "}") {
|
|
782
|
+
this.pos += 1;
|
|
783
|
+
return result;
|
|
784
|
+
}
|
|
785
|
+
this.fail("expected ',' or '}' in object");
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
parseMemberKey() {
|
|
790
|
+
const ch = this.peek();
|
|
791
|
+
if (ch === '"') return this.parseString();
|
|
792
|
+
if (!this.strict && ch === "'") return this.parseString();
|
|
793
|
+
if (!this.strict && (isIdentifierStart(ch) || ch === "\\")) return this.parseIdentifierName();
|
|
794
|
+
this.fail(`invalid object key '${ch}'`);
|
|
795
|
+
return undefined;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
parseArray() {
|
|
799
|
+
this.pos += 1; // consume '['
|
|
800
|
+
const result = [];
|
|
801
|
+
this.skipTrivia();
|
|
802
|
+
if (this.peek() === "]") {
|
|
803
|
+
this.pos += 1;
|
|
804
|
+
return result;
|
|
805
|
+
}
|
|
806
|
+
for (;;) {
|
|
807
|
+
const value = this.parseValue();
|
|
808
|
+
result.push(value);
|
|
809
|
+
this.skipTrivia();
|
|
810
|
+
const ch = this.peek();
|
|
811
|
+
if (ch === ",") {
|
|
812
|
+
this.pos += 1;
|
|
813
|
+
this.skipTrivia();
|
|
814
|
+
if (!this.strict && this.peek() === "]") {
|
|
815
|
+
this.pos += 1;
|
|
816
|
+
return result;
|
|
817
|
+
}
|
|
818
|
+
continue;
|
|
819
|
+
}
|
|
820
|
+
if (ch === "]") {
|
|
821
|
+
this.pos += 1;
|
|
822
|
+
return result;
|
|
823
|
+
}
|
|
824
|
+
this.fail("expected ',' or ']' in array");
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
parseString() {
|
|
829
|
+
const quote = this.peek();
|
|
830
|
+
this.pos += 1;
|
|
831
|
+
let out = "";
|
|
832
|
+
for (;;) {
|
|
833
|
+
if (this.pos >= this.length) this.fail("unterminated string");
|
|
834
|
+
const ch = this.text[this.pos];
|
|
835
|
+
if (ch === quote) {
|
|
836
|
+
this.pos += 1;
|
|
837
|
+
return out;
|
|
838
|
+
}
|
|
839
|
+
if (ch === "\n" || ch === "\r") this.fail("unescaped line terminator in string");
|
|
840
|
+
if (ch === "\\") {
|
|
841
|
+
this.pos += 1;
|
|
842
|
+
out += this.parseEscape(quote);
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
out += ch;
|
|
846
|
+
this.pos += 1;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
parseEscape(quote) {
|
|
851
|
+
const ch = this.peek();
|
|
852
|
+
if (ch === undefined) this.fail("unterminated escape");
|
|
853
|
+
if (ch === quote || ch === "\\") {
|
|
854
|
+
this.pos += 1;
|
|
855
|
+
return ch;
|
|
856
|
+
}
|
|
857
|
+
if (this.strict && ch === "/") {
|
|
858
|
+
this.pos += 1;
|
|
859
|
+
return "/";
|
|
860
|
+
}
|
|
861
|
+
if (ch === "b") { this.pos += 1; return "\b"; }
|
|
862
|
+
if (ch === "f") { this.pos += 1; return "\f"; }
|
|
863
|
+
if (ch === "n") { this.pos += 1; return "\n"; }
|
|
864
|
+
if (ch === "r") { this.pos += 1; return "\r"; }
|
|
865
|
+
if (ch === "t") { this.pos += 1; return "\t"; }
|
|
866
|
+
if (this.strict) this.fail(`invalid escape '\\${ch}'`);
|
|
867
|
+
if (ch === "v") { this.pos += 1; return "\v"; }
|
|
868
|
+
if (ch === "0") {
|
|
869
|
+
this.pos += 1;
|
|
870
|
+
if (this.peek() !== undefined && DECIMAL_DIGITS.includes(this.peek())) this.fail("invalid escape: legacy octal");
|
|
871
|
+
return "\x00";
|
|
872
|
+
}
|
|
873
|
+
if (ch === "x") {
|
|
874
|
+
this.pos += 1;
|
|
875
|
+
let hex = "";
|
|
876
|
+
for (let i = 0; i < 2; i += 1) {
|
|
877
|
+
const digit = this.peek();
|
|
878
|
+
if (digit === undefined || !HEX_DIGITS.includes(digit)) this.fail("invalid \\x escape");
|
|
879
|
+
hex += digit;
|
|
880
|
+
this.pos += 1;
|
|
881
|
+
}
|
|
882
|
+
return String.fromCodePoint(Number.parseInt(hex, 16));
|
|
883
|
+
}
|
|
884
|
+
if (ch === "u") {
|
|
885
|
+
this.pos += 1;
|
|
886
|
+
if (this.peek() === "{") {
|
|
887
|
+
this.pos += 1;
|
|
888
|
+
let hex = "";
|
|
889
|
+
while (this.peek() !== "}" && this.pos < this.length) {
|
|
890
|
+
hex += this.peek();
|
|
891
|
+
this.pos += 1;
|
|
892
|
+
}
|
|
893
|
+
if (this.peek() !== "}" || hex.length === 0) this.fail("invalid \\u{...} escape");
|
|
894
|
+
this.pos += 1;
|
|
895
|
+
const code = Number.parseInt(hex, 16);
|
|
896
|
+
if (!Number.isFinite(code) || code > 0x10ffff) this.fail("invalid \\u{...} escape");
|
|
897
|
+
return String.fromCodePoint(code);
|
|
898
|
+
}
|
|
899
|
+
let hex = "";
|
|
900
|
+
for (let i = 0; i < 4; i += 1) {
|
|
901
|
+
const digit = this.peek();
|
|
902
|
+
if (digit === undefined || !HEX_DIGITS.includes(digit)) this.fail("invalid \\u escape");
|
|
903
|
+
hex += digit;
|
|
904
|
+
this.pos += 1;
|
|
905
|
+
}
|
|
906
|
+
return String.fromCodePoint(Number.parseInt(hex, 16));
|
|
907
|
+
}
|
|
908
|
+
// Line continuation: backslash followed by a line terminator produces nothing.
|
|
909
|
+
if (ch === "\n") { this.pos += 1; return ""; }
|
|
910
|
+
if (ch === "\r") {
|
|
911
|
+
this.pos += 1;
|
|
912
|
+
if (this.peek() === "\n") this.pos += 1;
|
|
913
|
+
return "";
|
|
914
|
+
}
|
|
915
|
+
if (ch === "\u2028" || ch === "\u2029") { this.pos += 1; return ""; }
|
|
916
|
+
this.fail(`invalid escape '\\${ch}'`);
|
|
917
|
+
return undefined;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
parseNumber() {
|
|
921
|
+
const start = this.pos;
|
|
922
|
+
let sign = "";
|
|
923
|
+
if (this.peek() === "+" || this.peek() === "-") {
|
|
924
|
+
if (this.strict && this.peek() === "+") this.fail("leading '+' is not valid JSON");
|
|
925
|
+
sign = this.peek();
|
|
926
|
+
this.pos += 1;
|
|
927
|
+
}
|
|
928
|
+
if (!this.strict && this.peek() === "I") {
|
|
929
|
+
const word = this.parseIdentifierName();
|
|
930
|
+
if (word !== "Infinity") this.fail("invalid number");
|
|
931
|
+
return sign === "-" ? -Infinity : Infinity;
|
|
932
|
+
}
|
|
933
|
+
if (!this.strict && this.peek() === "N") {
|
|
934
|
+
const word = this.parseIdentifierName();
|
|
935
|
+
if (word !== "NaN") this.fail("invalid number");
|
|
936
|
+
return NaN;
|
|
937
|
+
}
|
|
938
|
+
let literal = "";
|
|
939
|
+
let isInteger = true;
|
|
940
|
+
if (!this.strict && this.peek() === "0" && "xX".includes(this.peek(1))) {
|
|
941
|
+
literal = "0x";
|
|
942
|
+
this.pos += 2;
|
|
943
|
+
let digits = "";
|
|
944
|
+
while (this.peek() !== undefined && HEX_DIGITS.includes(this.peek())) {
|
|
945
|
+
digits += this.peek();
|
|
946
|
+
this.pos += 1;
|
|
947
|
+
}
|
|
948
|
+
if (digits.length === 0) this.fail("invalid hex literal");
|
|
949
|
+
literal += digits;
|
|
950
|
+
} else {
|
|
951
|
+
let intDigits = "";
|
|
952
|
+
while (this.peek() !== undefined && DECIMAL_DIGITS.includes(this.peek())) {
|
|
953
|
+
intDigits += this.peek();
|
|
954
|
+
this.pos += 1;
|
|
955
|
+
}
|
|
956
|
+
if (intDigits === "") this.fail("invalid number");
|
|
957
|
+
if (this.strict && intDigits.length > 1 && intDigits[0] === "0") this.fail("leading zeros are not valid JSON");
|
|
958
|
+
literal = intDigits;
|
|
959
|
+
if (this.peek() === ".") {
|
|
960
|
+
isInteger = false;
|
|
961
|
+
literal += ".";
|
|
962
|
+
this.pos += 1;
|
|
963
|
+
let fracDigits = "";
|
|
964
|
+
while (this.peek() !== undefined && DECIMAL_DIGITS.includes(this.peek())) {
|
|
965
|
+
fracDigits += this.peek();
|
|
966
|
+
this.pos += 1;
|
|
967
|
+
}
|
|
968
|
+
if (this.strict && fracDigits.length === 0) this.fail("digits required after decimal point in strict JSON");
|
|
969
|
+
// JSON5 allows a trailing dot ("5."); it stays a float.
|
|
970
|
+
literal += fracDigits;
|
|
971
|
+
}
|
|
972
|
+
if (this.peek() === "e" || this.peek() === "E") {
|
|
973
|
+
isInteger = false;
|
|
974
|
+
let exponent = "e";
|
|
975
|
+
this.pos += 1;
|
|
976
|
+
if (this.peek() === "+" || this.peek() === "-") {
|
|
977
|
+
exponent += this.peek();
|
|
978
|
+
this.pos += 1;
|
|
979
|
+
}
|
|
980
|
+
let expDigits = "";
|
|
981
|
+
while (this.peek() !== undefined && DECIMAL_DIGITS.includes(this.peek())) {
|
|
982
|
+
expDigits += this.peek();
|
|
983
|
+
this.pos += 1;
|
|
984
|
+
}
|
|
985
|
+
if (expDigits.length === 0) this.fail("invalid exponent");
|
|
986
|
+
literal += exponent + expDigits;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
const next = this.peek();
|
|
990
|
+
if (next !== undefined && (isIdentifierPart(next) || next === ".")) this.fail("invalid number termination");
|
|
991
|
+
if (isInteger) {
|
|
992
|
+
// Python json/json5 load integers as arbitrary-precision int; nanosecond
|
|
993
|
+
// mtimes exceed Number.MAX_SAFE_INTEGER, so keep integers exact as BigInt.
|
|
994
|
+
try {
|
|
995
|
+
return BigInt(`${sign}${literal}`);
|
|
996
|
+
} catch {
|
|
997
|
+
this.pos = start;
|
|
998
|
+
this.fail("invalid integer literal");
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return Number(`${sign}${literal}`);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
function parseWith(parser) {
|
|
1006
|
+
const value = parser.parseValue();
|
|
1007
|
+
parser.skipTrivia();
|
|
1008
|
+
if (parser.pos < parser.length) parser.fail("unexpected trailing characters");
|
|
1009
|
+
return value;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
export function parseJson5(text) {
|
|
1013
|
+
return parseWith(new Json5Parser(text, false));
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// Exact-JSON replacement for JSON.parse: rejects JSON5 extensions and keeps
|
|
1017
|
+
// integer literals at full precision (BigInt) instead of rounding to double.
|
|
1018
|
+
export function parseStrictJson(text) {
|
|
1019
|
+
return parseWith(new Json5Parser(text, true));
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
// Python repr() for strings (used by f-string {!r} in error messages):
|
|
1024
|
+
// single quotes by default; double quotes when the value contains ' but no ".
|
|
1025
|
+
export function pyRepr(value) {
|
|
1026
|
+
if (typeof value !== "string") return String(value);
|
|
1027
|
+
const quote = value.includes("'") && !value.includes('"') ? '"' : "'";
|
|
1028
|
+
let out = quote;
|
|
1029
|
+
for (const ch of value) {
|
|
1030
|
+
const code = ch.codePointAt(0);
|
|
1031
|
+
if (ch === quote) {
|
|
1032
|
+
out += `\\${ch}`;
|
|
1033
|
+
} else if (ch === "\\") {
|
|
1034
|
+
out += "\\\\";
|
|
1035
|
+
} else if (ch === "\n") {
|
|
1036
|
+
out += "\\n";
|
|
1037
|
+
} else if (ch === "\r") {
|
|
1038
|
+
out += "\\r";
|
|
1039
|
+
} else if (ch === "\t") {
|
|
1040
|
+
out += "\\t";
|
|
1041
|
+
} else if (code < 0x20 || code === 0x7f) {
|
|
1042
|
+
out += `\\x${code.toString(16).padStart(2, "0")}`;
|
|
1043
|
+
} else {
|
|
1044
|
+
out += ch;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return `${out}${quote}`;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// ---------------------------------------------------------------------------
|
|
1051
|
+
// Subprocess / shell helpers (subprocess.run with encoding="utf-8",
|
|
1052
|
+
// errors="replace")
|
|
1053
|
+
// ---------------------------------------------------------------------------
|
|
1054
|
+
|
|
1055
|
+
import { spawnSync } from "node:child_process";
|
|
1056
|
+
|
|
1057
|
+
export function runCapture(args, options = {}) {
|
|
1058
|
+
// Windows: npm-installed CLIs are .cmd shims; spawnSync refuses to exec them
|
|
1059
|
+
// directly (EINVAL post-CVE-2024-27980). Route .cmd/.bat through cmd.exe.
|
|
1060
|
+
const isCmd = process.platform === "win32"
|
|
1061
|
+
&& /\.(cmd|bat)$/i.test(String(args[0]));
|
|
1062
|
+
const spawnOpts = {
|
|
1063
|
+
cwd: options.cwd,
|
|
1064
|
+
encoding: "utf8",
|
|
1065
|
+
captureOutput: true,
|
|
1066
|
+
timeout: options.timeout === undefined ? undefined : options.timeout,
|
|
1067
|
+
...(isCmd ? { shell: true } : {}),
|
|
1068
|
+
};
|
|
1069
|
+
const result = isCmd
|
|
1070
|
+
? spawnSync(args.join(" "), spawnOpts)
|
|
1071
|
+
: spawnSync(args[0], args.slice(1), spawnOpts);
|
|
1072
|
+
if (result.error) {
|
|
1073
|
+
const err = new Error(result.error.message);
|
|
1074
|
+
if (result.error.code === "ENOENT") {
|
|
1075
|
+
err.code = "ENOENT";
|
|
1076
|
+
} else if (result.error.code === "ETIMEDOUT" || result.signal === "SIGTERM") {
|
|
1077
|
+
// Python subprocess.TimeoutExpired is a SubprocessError subclass
|
|
1078
|
+
err.code = "SUBPROCESS_TIMEOUT";
|
|
1079
|
+
} else {
|
|
1080
|
+
err.code = result.error.code;
|
|
1081
|
+
}
|
|
1082
|
+
throw err;
|
|
1083
|
+
}
|
|
1084
|
+
return {
|
|
1085
|
+
returncode: result.status,
|
|
1086
|
+
stdout: result.stdout === undefined ? "" : result.stdout,
|
|
1087
|
+
stderr: result.stderr === undefined ? "" : result.stderr,
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
// shutil.which(): first executable match on PATH. On Windows, npm-installed
|
|
1092
|
+
// CLIs are .cmd shims — shutil.which probes PATHEXT extensions (.COM;.EXE;.BAT;.CMD
|
|
1093
|
+
// plus the bare name for extensionless shims). Node's spawnSync cannot exec a
|
|
1094
|
+
// .cmd directly (post-CVE-2024-27980 EINVAL), so runCapture handles that.
|
|
1095
|
+
export function which(command) {
|
|
1096
|
+
if (command.includes("/") || command.includes("\\")) {
|
|
1097
|
+
return isFile(command) ? command : null;
|
|
1098
|
+
}
|
|
1099
|
+
const dirs = (process.env.PATH || "").split(path.delimiter).filter(Boolean);
|
|
1100
|
+
const extensions = process.platform === "win32"
|
|
1101
|
+
? String(process.env.PATHEXT || ".COM;.EXE;.BAT;.CMD")
|
|
1102
|
+
.split(";")
|
|
1103
|
+
.filter(Boolean)
|
|
1104
|
+
.map((ext) => (ext.startsWith(".") ? ext : `.${ext}`))
|
|
1105
|
+
: [""];
|
|
1106
|
+
for (const dir of dirs) {
|
|
1107
|
+
for (const ext of extensions) {
|
|
1108
|
+
const candidate = path.join(dir, command + ext);
|
|
1109
|
+
if (isFile(candidate)) {
|
|
1110
|
+
if (process.platform === "win32") {
|
|
1111
|
+
return candidate;
|
|
1112
|
+
}
|
|
1113
|
+
try {
|
|
1114
|
+
fs.accessSync(candidate, fs.constants.X_OK);
|
|
1115
|
+
return candidate;
|
|
1116
|
+
} catch {
|
|
1117
|
+
// keep searching
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
// On Windows also probe the bare name (extensionless shims like git's bash).
|
|
1122
|
+
if (process.platform === "win32") {
|
|
1123
|
+
const bare = path.join(dir, command);
|
|
1124
|
+
if (isFile(bare)) {
|
|
1125
|
+
return bare;
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
return null;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// shutil.copytree(src, dst, dirs_exist_ok=True)
|
|
1133
|
+
export function copyTree(src, dst) {
|
|
1134
|
+
fs.cpSync(src, dst, { recursive: true });
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
// shutil.rmtree(path, ignore_errors=...)
|
|
1138
|
+
export function rmTree(p, { force = false } = {}) {
|
|
1139
|
+
fs.rmSync(p, { recursive: true, force });
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
// ---------------------------------------------------------------------------
|
|
1144
|
+
// Minimal xml.etree.ElementTree-compatible parser (the subset used by the
|
|
1145
|
+
// skill: namespaced tags/attribs in ET "{uri}local" form, .text, children
|
|
1146
|
+
// iteration, .iter(), comments skipped, built-in + numeric entities, CDATA).
|
|
1147
|
+
// ---------------------------------------------------------------------------
|
|
1148
|
+
|
|
1149
|
+
export class XmlElement {
|
|
1150
|
+
constructor(tag, attrib = {}) {
|
|
1151
|
+
this.tag = tag;
|
|
1152
|
+
this.attrib = attrib;
|
|
1153
|
+
this.text = null;
|
|
1154
|
+
this.tail = null;
|
|
1155
|
+
this.children = [];
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
*[Symbol.iterator]() {
|
|
1159
|
+
yield* this.children;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
*iter() {
|
|
1163
|
+
yield this;
|
|
1164
|
+
for (const child of this.children) {
|
|
1165
|
+
yield* child.iter();
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
function decodeXmlEntities(input, extra) {
|
|
1171
|
+
let out = "";
|
|
1172
|
+
let i = 0;
|
|
1173
|
+
while (i < input.length) {
|
|
1174
|
+
const ch = input[i];
|
|
1175
|
+
if (ch !== "&") {
|
|
1176
|
+
out += ch;
|
|
1177
|
+
i += 1;
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
const semi = input.indexOf(";", i);
|
|
1181
|
+
if (semi < 0) throw new SyntaxError("unclosed entity in XML");
|
|
1182
|
+
const entity = input.slice(i + 1, semi);
|
|
1183
|
+
if (entity === "amp") out += "&";
|
|
1184
|
+
else if (entity === "lt") out += "<";
|
|
1185
|
+
else if (entity === "gt") out += ">";
|
|
1186
|
+
else if (entity === "quot") out += '"';
|
|
1187
|
+
else if (entity === "apos") out += "'";
|
|
1188
|
+
else if (entity.startsWith("#x") || entity.startsWith("#X")) {
|
|
1189
|
+
out += String.fromCodePoint(Number.parseInt(entity.slice(2), 16));
|
|
1190
|
+
} else if (entity.startsWith("#")) {
|
|
1191
|
+
out += String.fromCodePoint(Number.parseInt(entity.slice(1), 10));
|
|
1192
|
+
} else if (extra && Object.prototype.hasOwnProperty.call(extra, entity)) {
|
|
1193
|
+
out += extra[entity];
|
|
1194
|
+
} else {
|
|
1195
|
+
throw new SyntaxError(`unknown entity &${entity};`);
|
|
1196
|
+
}
|
|
1197
|
+
i = semi + 1;
|
|
1198
|
+
}
|
|
1199
|
+
return out;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
export function parseXmlText(text) {
|
|
1203
|
+
let pos = 0;
|
|
1204
|
+
const len = text.length;
|
|
1205
|
+
const fail = (msg) => { throw new SyntaxError(`${msg} at offset ${pos}`); };
|
|
1206
|
+
const skipInsignificant = () => {
|
|
1207
|
+
for (;;) {
|
|
1208
|
+
while (pos < len && " \t\r\n".includes(text[pos])) pos += 1;
|
|
1209
|
+
if (text.startsWith("<!--", pos)) {
|
|
1210
|
+
const end = text.indexOf("-->", pos + 4);
|
|
1211
|
+
if (end < 0) fail("unterminated comment");
|
|
1212
|
+
pos = end + 3;
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
if (text.startsWith("<?", pos)) {
|
|
1216
|
+
const end = text.indexOf("?>", pos + 2);
|
|
1217
|
+
if (end < 0) fail("unterminated processing instruction");
|
|
1218
|
+
pos = end + 2;
|
|
1219
|
+
continue;
|
|
1220
|
+
}
|
|
1221
|
+
if (text.startsWith("<!", pos)) {
|
|
1222
|
+
// DOCTYPE and friends: skip to the matching '>' (no nested subset support)
|
|
1223
|
+
const end = text.indexOf(">", pos);
|
|
1224
|
+
if (end < 0) fail("unterminated declaration");
|
|
1225
|
+
pos = end + 1;
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
const parseName = () => {
|
|
1232
|
+
const start = pos;
|
|
1233
|
+
while (pos < len && !" \t\r\n=/?>".includes(text[pos])) pos += 1;
|
|
1234
|
+
if (pos === start) fail("expected a name");
|
|
1235
|
+
return text.slice(start, pos);
|
|
1236
|
+
};
|
|
1237
|
+
const parseQuoted = () => {
|
|
1238
|
+
const quote = text[pos];
|
|
1239
|
+
if (quote !== '"' && quote !== "'") fail("expected a quoted attribute value");
|
|
1240
|
+
pos += 1;
|
|
1241
|
+
const end = text.indexOf(quote, pos);
|
|
1242
|
+
if (end < 0) fail("unterminated attribute value");
|
|
1243
|
+
const raw = text.slice(pos, end);
|
|
1244
|
+
pos = end + 1;
|
|
1245
|
+
return raw;
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
const parseElement = (nsBindings) => {
|
|
1249
|
+
if (text[pos] !== "<") fail("expected '<'");
|
|
1250
|
+
pos += 1;
|
|
1251
|
+
const rawTag = parseName();
|
|
1252
|
+
const attrib = {};
|
|
1253
|
+
const localBindings = new Map(nsBindings);
|
|
1254
|
+
for (;;) {
|
|
1255
|
+
while (pos < len && " \t\r\n".includes(text[pos])) pos += 1;
|
|
1256
|
+
if (text[pos] === ">" || text.startsWith("/>", pos)) break;
|
|
1257
|
+
const attrName = parseName();
|
|
1258
|
+
while (pos < len && " \t\r\n".includes(text[pos])) pos += 1;
|
|
1259
|
+
if (text[pos] !== "=") fail("expected '=' in attribute");
|
|
1260
|
+
pos += 1;
|
|
1261
|
+
const rawValue = parseQuoted();
|
|
1262
|
+
if (attrName === "xmlns") {
|
|
1263
|
+
localBindings.set("", rawValue);
|
|
1264
|
+
} else if (attrName.startsWith("xmlns:")) {
|
|
1265
|
+
localBindings.set(attrName.slice(6), rawValue);
|
|
1266
|
+
} else {
|
|
1267
|
+
const resolved = attrName.includes(":")
|
|
1268
|
+
? `{${localBindings.get(attrName.slice(0, attrName.indexOf(":"))) || ""}}${attrName.slice(attrName.indexOf(":") + 1)}`
|
|
1269
|
+
: attrName;
|
|
1270
|
+
attrib[resolved] = rawValue;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
const resolveTag = (name) => {
|
|
1274
|
+
if (name.startsWith(":")) fail(`invalid tag name ${name}`);
|
|
1275
|
+
const colon = name.indexOf(":");
|
|
1276
|
+
if (colon < 0) {
|
|
1277
|
+
const uri = localBindings.get("");
|
|
1278
|
+
return uri ? `{${uri}}${name}` : name;
|
|
1279
|
+
}
|
|
1280
|
+
const uri = localBindings.get(name.slice(0, colon));
|
|
1281
|
+
return `{${uri || ""}}${name.slice(colon + 1)}`;
|
|
1282
|
+
};
|
|
1283
|
+
const element = new XmlElement(resolveTag(rawTag), attrib);
|
|
1284
|
+
for (const [key, value] of Object.entries(attrib)) {
|
|
1285
|
+
attrib[key] = decodeXmlEntities(value);
|
|
1286
|
+
}
|
|
1287
|
+
if (text.startsWith("/>", pos)) {
|
|
1288
|
+
pos += 2;
|
|
1289
|
+
return element;
|
|
1290
|
+
}
|
|
1291
|
+
if (text[pos] !== ">") fail("expected '>' after attributes");
|
|
1292
|
+
pos += 1;
|
|
1293
|
+
|
|
1294
|
+
let textBuffer = "";
|
|
1295
|
+
let sawElement = false;
|
|
1296
|
+
const flushText = () => {
|
|
1297
|
+
if (textBuffer.length === 0) return;
|
|
1298
|
+
if (element.children.length === 0) {
|
|
1299
|
+
element.text = textBuffer;
|
|
1300
|
+
} else {
|
|
1301
|
+
const last = element.children[element.children.length - 1];
|
|
1302
|
+
last.tail = (last.tail || "") + textBuffer;
|
|
1303
|
+
}
|
|
1304
|
+
textBuffer = "";
|
|
1305
|
+
};
|
|
1306
|
+
for (;;) {
|
|
1307
|
+
if (pos >= len) fail("unexpected end of document inside element");
|
|
1308
|
+
if (text.startsWith("</", pos)) {
|
|
1309
|
+
pos += 2;
|
|
1310
|
+
const closeTag = parseName();
|
|
1311
|
+
while (pos < len && " \t\r\n".includes(text[pos])) pos += 1;
|
|
1312
|
+
if (text[pos] !== ">") fail("expected '>' in closing tag");
|
|
1313
|
+
pos += 1;
|
|
1314
|
+
if (closeTag !== rawTag) fail(`mismatched closing tag </${closeTag}> for <${rawTag}>`);
|
|
1315
|
+
flushText();
|
|
1316
|
+
if (element.text === "") element.text = null;
|
|
1317
|
+
return element;
|
|
1318
|
+
}
|
|
1319
|
+
if (text.startsWith("<!--", pos) || text.startsWith("<?", pos)) {
|
|
1320
|
+
skipInsignificant();
|
|
1321
|
+
continue;
|
|
1322
|
+
}
|
|
1323
|
+
if (text.startsWith("<![CDATA[", pos)) {
|
|
1324
|
+
const end = text.indexOf("]]>", pos + 9);
|
|
1325
|
+
if (end < 0) fail("unterminated CDATA");
|
|
1326
|
+
textBuffer += text.slice(pos + 9, end);
|
|
1327
|
+
pos = end + 3;
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1330
|
+
if (text[pos] === "<") {
|
|
1331
|
+
sawElement = true;
|
|
1332
|
+
flushText();
|
|
1333
|
+
element.children.push(parseElement(localBindings));
|
|
1334
|
+
continue;
|
|
1335
|
+
}
|
|
1336
|
+
const next = text.indexOf("<", pos);
|
|
1337
|
+
const chunkEnd = next < 0 ? len : next;
|
|
1338
|
+
textBuffer += decodeXmlEntities(text.slice(pos, chunkEnd));
|
|
1339
|
+
pos = chunkEnd;
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
|
|
1343
|
+
skipInsignificant();
|
|
1344
|
+
if (pos >= len || text[pos] !== "<") fail("no root element");
|
|
1345
|
+
const root = parseElement(new Map());
|
|
1346
|
+
skipInsignificant();
|
|
1347
|
+
if (pos < len) fail("trailing content after root element");
|
|
1348
|
+
return root;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// Python read_text(encoding="utf-8") with default errors="strict": invalid
|
|
1352
|
+
// bytes raise UnicodeDecodeError (callers skip the file). readFileSync with
|
|
1353
|
+
// "utf8" would silently replace them with U+FFFD instead.
|
|
1354
|
+
export function readTextFatal(p) {
|
|
1355
|
+
const buffer = fs.readFileSync(p);
|
|
1356
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(buffer);
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
export function parseXmlFile(p) {
|
|
1360
|
+
return parseXmlText(fs.readFileSync(p, "utf8"));
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
// ET.tostring(element, encoding="unicode")-compatible serialization:
|
|
1364
|
+
// ns0/ns1 prefixes assigned in first-use order, xmlns declarations precede
|
|
1365
|
+
// attributes, empty elements close with " />", text escapes & < >,
|
|
1366
|
+
// attributes escape & < > " plus newline/carriage-return as char refs.
|
|
1367
|
+
export function etToString(element) {
|
|
1368
|
+
// ET.tostring collects every namespace used anywhere in the serialized
|
|
1369
|
+
// subtree (tags and attributes, document order) and declares them all on
|
|
1370
|
+
// the subtree root as ns0/ns1/..., regardless of where they are used.
|
|
1371
|
+
const nsToPrefix = new Map();
|
|
1372
|
+
let nextNs = 0;
|
|
1373
|
+
|
|
1374
|
+
const assignPrefixes = (el) => {
|
|
1375
|
+
const resolve = (name) => {
|
|
1376
|
+
if (!name.startsWith("{")) return;
|
|
1377
|
+
const end = name.indexOf("}");
|
|
1378
|
+
const uri = name.slice(1, end);
|
|
1379
|
+
if (!nsToPrefix.has(uri)) {
|
|
1380
|
+
nsToPrefix.set(uri, `ns${nextNs}`);
|
|
1381
|
+
nextNs += 1;
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
resolve(el.tag);
|
|
1385
|
+
for (const key of Object.keys(el.attrib)) {
|
|
1386
|
+
resolve(key);
|
|
1387
|
+
}
|
|
1388
|
+
for (const child of el.children) {
|
|
1389
|
+
assignPrefixes(child);
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
assignPrefixes(element);
|
|
1393
|
+
|
|
1394
|
+
const escapeText = (s) => s
|
|
1395
|
+
.replace(/&/g, "&")
|
|
1396
|
+
.replace(/</g, "<")
|
|
1397
|
+
.replace(/>/g, ">");
|
|
1398
|
+
|
|
1399
|
+
const escapeAttrib = (s) => s
|
|
1400
|
+
.replace(/&/g, "&")
|
|
1401
|
+
.replace(/</g, "<")
|
|
1402
|
+
.replace(/>/g, ">")
|
|
1403
|
+
.replace(/"/g, """)
|
|
1404
|
+
.replace(/\n/g, " ")
|
|
1405
|
+
.replace(/\r/g, " ");
|
|
1406
|
+
|
|
1407
|
+
const qualifiedName = (name) => {
|
|
1408
|
+
if (!name.startsWith("{")) return name;
|
|
1409
|
+
const end = name.indexOf("}");
|
|
1410
|
+
const uri = name.slice(1, end);
|
|
1411
|
+
return `${nsToPrefix.get(uri)}:${name.slice(end + 1)}`;
|
|
1412
|
+
};
|
|
1413
|
+
|
|
1414
|
+
const rootDecls = nsToPrefix.size > 0
|
|
1415
|
+
? [...nsToPrefix.entries()].map(([uri, prefix]) => ` xmlns:${prefix}="${uri}"`).join("")
|
|
1416
|
+
: "";
|
|
1417
|
+
|
|
1418
|
+
const serialize = (el, isRoot = false) => {
|
|
1419
|
+
const tagName = qualifiedName(el.tag);
|
|
1420
|
+
let out = `<${tagName}`;
|
|
1421
|
+
if (isRoot) {
|
|
1422
|
+
out += rootDecls;
|
|
1423
|
+
}
|
|
1424
|
+
for (const [key, value] of Object.entries(el.attrib)) {
|
|
1425
|
+
out += ` ${qualifiedName(key)}="${escapeAttrib(value)}"`;
|
|
1426
|
+
}
|
|
1427
|
+
const hasContent = el.children.length > 0 || (el.text !== null && el.text !== "");
|
|
1428
|
+
if (!hasContent) return `${out} />`;
|
|
1429
|
+
out += ">";
|
|
1430
|
+
if (el.text !== null && el.text !== "") out += escapeText(el.text);
|
|
1431
|
+
for (const child of el.children) {
|
|
1432
|
+
out += serialize(child);
|
|
1433
|
+
if (child.tail !== null && child.tail !== "") out += escapeText(child.tail);
|
|
1434
|
+
}
|
|
1435
|
+
return `${out}</${tagName}>`;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
return serialize(element, true);
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// datetime.now(timezone.utc).isoformat() — always "+00:00" and six fractional
|
|
1442
|
+
// digits ("2026-10-19T08:30:00.123000+00:00").
|
|
1443
|
+
export function pythonUtcNowIso({ timespec = "microseconds" } = {}) {
|
|
1444
|
+
const now = new Date();
|
|
1445
|
+
const pad = (n, width) => String(n).padStart(width, "0");
|
|
1446
|
+
const base = (
|
|
1447
|
+
`${now.getUTCFullYear()}-${pad(now.getUTCMonth() + 1, 2)}-${pad(now.getUTCDate(), 2)}`
|
|
1448
|
+
+ `T${pad(now.getUTCHours(), 2)}:${pad(now.getUTCMinutes(), 2)}:${pad(now.getUTCSeconds(), 2)}`
|
|
1449
|
+
);
|
|
1450
|
+
if (timespec === "seconds") return `${base}+00:00`;
|
|
1451
|
+
return `${base}.${pad(now.getUTCMilliseconds(), 3)}000+00:00`;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
export { fs, path, process };
|