@buaa_smat/hometrans 26.0.3 → 26.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/agents/code-reviewer.md +91 -21
- package/env-requirements.json +1 -1
- package/i18n/agents/code-reviewer.md +93 -21
- package/i18n/skills/a2h-app-migrate/SKILL.md +19 -11
- package/i18n/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/i18n/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/i18n/skills/a2h-app-migrate/references/workflow.yaml +320 -73
- package/i18n/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/i18n/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/i18n/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/i18n/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/i18n/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/i18n/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/i18n/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/i18n/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/i18n/skills/a2h-arch-generate/SKILL.md +20 -17
- package/i18n/skills/a2h-arch-generate/references/database-schema-recovery.md +2 -2
- package/i18n/skills/a2h-arch-generate/references/harmony-project-inspection.md +8 -8
- package/i18n/skills/a2h-arch-generate/references/homegraph-workflow.md +25 -14
- package/i18n/skills/a2h-arch-generate/references/source-baseline.md +4 -4
- package/i18n/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +304 -0
- package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/i18n/skills/a2h-arkts-logic-coder/references/spec-design.md +52 -11
- package/i18n/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/i18n/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +245 -0
- package/i18n/skills/a2h-batch-ui-align/SKILL.md +70 -21
- package/i18n/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/i18n/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/i18n/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/i18n/skills/a2h-batch-ui-align/references/state-mgmt/_decorator-quickref.md +31 -0
- package/i18n/skills/a2h-batch-ui-align/references/step3-capture.md +22 -6
- package/i18n/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +386 -16
- package/i18n/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/i18n/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/i18n/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/i18n/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +133 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/i18n/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/i18n/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/i18n/skills/a2h-dashboard-render/scripts/device_capture.mjs +11 -9
- package/i18n/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/i18n/skills/a2h-page-specgen/SKILL.md +123 -20
- package/i18n/skills/a2h-page-specgen/references/behavior-ledger.md +1174 -0
- package/i18n/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/i18n/skills/a2h-page-specgen/references/gates.md +119 -52
- package/i18n/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +274 -0
- package/i18n/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/i18n/skills/a2h-page-specgen/references/spec-template.md +113 -110
- package/i18n/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/i18n/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/i18n/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/i18n/skills/a2h-page-specgen/scripts/facts-build.mjs +171 -62
- package/i18n/skills/a2h-page-specgen/scripts/footprint.mjs +314 -192
- package/i18n/skills/a2h-page-specgen/scripts/gate.mjs +364 -76
- package/i18n/skills/a2h-page-specgen/scripts/interactions.mjs +216 -8
- package/i18n/skills/a2h-page-specgen/scripts/inventory.mjs +371 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -223
- package/i18n/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/hg.mjs +521 -13
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/i18n/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/i18n/skills/a2h-page-specgen/scripts/lib/source-text.mjs +497 -0
- package/i18n/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/i18n/skills/a2h-page-specgen/scripts/prepare.mjs +483 -125
- package/i18n/skills/a2h-page-specgen/scripts/render.mjs +10 -33
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +25 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +47 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +267 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +57 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +373 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +300 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +553 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +546 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +655 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1234 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +520 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1516 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +759 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +630 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +118 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +798 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +886 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +134 -163
- package/i18n/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/i18n/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +206 -9
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/i18n/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/gate.test.mjs +862 -12
- package/i18n/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/i18n/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/i18n/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +166 -3
- package/i18n/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/i18n/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +531 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/i18n/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/i18n/skills/a2h-page-specgen/scripts/test/render.test.mjs +69 -44
- package/i18n/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/submit.test.mjs +658 -120
- package/i18n/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/i18n/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/i18n/skills/a2h-resource-convert/SKILL.md +9 -1
- package/i18n/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/i18n/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/i18n/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/i18n/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/i18n/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/i18n/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/i18n/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/i18n/skills/a2h-spec-design-pipeline/SKILL.md +69 -109
- package/i18n/skills/a2h-spec-design-pipeline/references/coding-loop.md +135 -37
- package/i18n/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +307 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/initialization.md +103 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/i18n/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/review-loop.md +71 -0
- package/i18n/skills/a2h-spec-design-pipeline/references/scripts.md +24 -13
- package/i18n/skills/a2h-spec-design-pipeline/references/state-and-resume.md +246 -0
- package/i18n/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +170 -7
- package/i18n/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/i18n/skills/a2h-spec-generate/SKILL.md +2 -2
- package/i18n/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/i18n/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/i18n/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +74 -84
- package/i18n/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/i18n/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/i18n/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +252 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/i18n/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +211 -61
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/i18n/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +724 -47
- package/i18n/skills/a2h-utg-static/SKILL.md +6 -2
- package/i18n/skills/a2h-utg-static/scripts/assemble.mjs +82 -12
- package/i18n/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/i18n/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/i18n/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/i18n/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/i18n/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/i18n/skills/a2h-utg-static/scripts/hybrid_scope.mjs +50 -5
- package/i18n/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/i18n/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/i18n/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/i18n/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/i18n/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +17 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +113 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +181 -17
- package/i18n/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/i18n/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +118 -19
- package/i18n/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/i18n/skills/a2h-utg-static/scripts/uniapp_nav.mjs +113 -70
- package/package.json +3 -6
- package/skills/a2h-app-migrate/SKILL.md +19 -11
- package/skills/a2h-app-migrate/references/feature-scope.md +121 -0
- package/skills/a2h-app-migrate/references/stage-map.md +2 -2
- package/skills/a2h-app-migrate/references/workflow.yaml +307 -74
- package/skills/a2h-app-migrate/scripts/android_index.mjs +35 -8
- package/skills/a2h-app-migrate/scripts/check_module_docs_done.mjs +39 -1
- package/skills/a2h-app-migrate/scripts/check_spec_gen_done.mjs +78 -5
- package/skills/a2h-app-migrate/scripts/check_spec_pipeline_done.mjs +144 -9
- package/skills/a2h-app-migrate/scripts/check_ui_batch_done.mjs +14 -1
- package/skills/a2h-app-migrate/scripts/check_utg_static_done.mjs +46 -5
- package/skills/a2h-app-migrate/scripts/diagnose.mjs +162 -0
- package/skills/a2h-app-migrate/scripts/env_preflight.mjs +79 -11
- package/skills/a2h-app-migrate/scripts/feature_scope.mjs +347 -0
- package/skills/a2h-app-migrate/scripts/human_review_gate.mjs +75 -4
- package/skills/a2h-app-migrate/scripts/infer_android_root.mjs +17 -1
- package/skills/a2h-app-migrate/scripts/ledger.mjs +64 -6
- package/skills/a2h-app-migrate/scripts/migration_manifest.mjs +351 -0
- package/skills/a2h-app-migrate/scripts/paths_preflight.mjs +9 -23
- package/skills/a2h-app-migrate/scripts/resume_plan.mjs +33 -9
- package/skills/a2h-app-migrate/scripts/reuse_static_utg.mjs +33 -1
- package/skills/a2h-app-migrate/scripts/run_dir.mjs +27 -17
- package/skills/a2h-app-migrate/scripts/scope_model.mjs +255 -0
- package/skills/a2h-app-migrate/scripts/scope_report.mjs +128 -0
- package/skills/a2h-app-migrate/scripts/source_fp.mjs +120 -0
- package/skills/a2h-app-migrate/test/test_android_index.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_env_requirements.mjs +25 -10
- package/skills/a2h-app-migrate/test/test_feature_scope.mjs +217 -0
- package/skills/a2h-app-migrate/test/test_finalize.mjs +35 -7
- package/skills/a2h-app-migrate/test/test_hmos_fingerprint.mjs +7 -7
- package/skills/a2h-app-migrate/test/test_incremental_acceptance.mjs +145 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2.mjs +223 -0
- package/skills/a2h-app-migrate/test/test_incremental_phase2_acceptance.mjs +157 -0
- package/skills/a2h-app-migrate/test/test_incremental_profile.mjs +84 -0
- package/skills/a2h-app-migrate/test/test_infer_android_root.mjs +10 -0
- package/skills/a2h-app-migrate/test/test_json_io.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_leaf_questions.mjs +39 -0
- package/skills/a2h-app-migrate/test/test_migration_manifest.mjs +225 -0
- package/skills/a2h-app-migrate/test/test_module_docs_done.mjs +33 -0
- package/skills/a2h-app-migrate/test/test_resume_plan.mjs +52 -0
- package/skills/a2h-app-migrate/test/test_resume_summary.mjs +26 -0
- package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +36 -0
- package/skills/a2h-app-migrate/test/test_run_dir.mjs +71 -7
- package/skills/a2h-app-migrate/test/test_scope_model.mjs +172 -0
- package/skills/a2h-app-migrate/test/test_spec_engine_contract.mjs +13 -5
- package/skills/a2h-app-migrate/test/test_spec_gen_done.mjs +117 -0
- package/skills/a2h-app-migrate/test/test_spec_gen_gate.mjs +7 -3
- package/skills/a2h-app-migrate/test/test_spec_pipeline_done.mjs +170 -3
- package/skills/a2h-app-migrate/test/test_specs_json_preflight.mjs +1 -1
- package/skills/a2h-app-migrate/test/test_ui_batch_capture_audit.mjs +106 -0
- package/skills/a2h-app-migrate/test/test_ui_batch_done.mjs +12 -0
- package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +38 -2
- package/skills/a2h-arch-generate/SKILL.md +20 -17
- package/skills/a2h-arch-generate/references/homegraph-workflow.md +10 -8
- package/skills/a2h-arch-generate/references/source-baseline.md +2 -2
- package/skills/a2h-arch-generate/scripts/cleanup_intermediates.mjs +34 -3
- package/skills/a2h-arch-generate/scripts/create_project.mjs +24 -1
- package/skills/a2h-arch-generate/scripts/inspect_and_route.mjs +29 -5
- package/skills/a2h-arch-generate/scripts/tests/run_tests.mjs +3 -3
- package/skills/a2h-arch-generate/scripts/tests/test_cleanup.mjs +17 -0
- package/skills/a2h-arch-generate/scripts/tests/test_router.mjs +26 -0
- package/skills/a2h-arch-generate/scripts/validate_incremental_docs.mjs +4 -2
- package/skills/a2h-arkts-logic-coder/SKILL.md +146 -17
- package/skills/a2h-arkts-logic-coder/references/ISSUES.md +2 -1
- package/skills/a2h-arkts-logic-coder/references/code-generation.md +59 -2
- package/skills/a2h-arkts-logic-coder/references/spec-design.md +42 -11
- package/skills/a2h-arkts-logic-coder/scripts/state_doc.mjs +328 -38
- package/skills/a2h-arkts-logic-coder/test/test_state_doc.mjs +244 -0
- package/skills/a2h-batch-ui-align/SKILL.md +72 -22
- package/skills/a2h-batch-ui-align/assets/ColorUtils.ets +16 -2
- package/skills/a2h-batch-ui-align/references/cards/alignment.md +5 -1
- package/skills/a2h-batch-ui-align/references/cards/geometry.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/interaction.md +2 -1
- package/skills/a2h-batch-ui-align/references/cards/resources.md +6 -4
- package/skills/a2h-batch-ui-align/references/cards/widgets.md +5 -0
- package/skills/a2h-batch-ui-align/references/cards/window.md +2 -1
- package/skills/a2h-batch-ui-align/references/checker-rules.md +236 -11
- package/skills/a2h-batch-ui-align/references/conversion-procedure.md +8 -5
- package/skills/a2h-batch-ui-align/references/host-dispatch.md +2 -0
- package/skills/a2h-batch-ui-align/references/incremental-scope.md +28 -9
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +7 -4
- package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +28 -1
- package/skills/a2h-batch-ui-align/references/state-mgmt/_/350/243/205/351/245/260/345/231/250/351/200/237/346/237/245.md +30 -0
- package/skills/a2h-batch-ui-align/references/step3-capture.md +25 -6
- package/skills/a2h-batch-ui-align/references/step4-prepare.md +3 -0
- package/skills/a2h-batch-ui-align/references/step5-convert.md +26 -4
- package/skills/a2h-batch-ui-align/scripts/branch_coverage.mjs +155 -0
- package/skills/a2h-batch-ui-align/scripts/build_conversion_set.mjs +380 -16
- package/skills/a2h-batch-ui-align/scripts/capture_audit.mjs +474 -0
- package/skills/a2h-batch-ui-align/scripts/capture_fast.mjs +665 -0
- package/skills/a2h-batch-ui-align/scripts/capture_verify.mjs +552 -0
- package/skills/a2h-batch-ui-align/scripts/detach.mjs +5 -2
- package/skills/a2h-batch-ui-align/scripts/evidence_gate.mjs +39 -5
- package/skills/a2h-batch-ui-align/scripts/export_ui_info.mjs +19 -1
- package/skills/a2h-batch-ui-align/scripts/group_pack.mjs +134 -11
- package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +213 -30
- package/skills/a2h-batch-ui-align/scripts/icon_coverage.mjs +147 -0
- package/skills/a2h-batch-ui-align/scripts/list_existing.mjs +141 -0
- package/skills/a2h-batch-ui-align/scripts/measure_pack.ts +231 -5
- package/skills/a2h-batch-ui-align/scripts/page_gap.mjs +210 -0
- package/skills/a2h-batch-ui-align/scripts/phase5_check.mjs +82 -8
- package/skills/a2h-batch-ui-align/scripts/progress_identity.mjs +208 -0
- package/skills/a2h-batch-ui-align/scripts/scroll_verdict.mjs +62 -0
- package/skills/a2h-batch-ui-align/scripts/shell_contract.mjs +21 -7
- package/skills/a2h-batch-ui-align/scripts/shell_requests.mjs +273 -0
- package/skills/a2h-batch-ui-align/scripts/state_doc.mjs +9 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/core/baseline.ts +79 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/core/parse.ts +90 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/core/scan.ts +44 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +48 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +24 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/a11y.ts +3 -17
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/attr_chain.ts +1 -19
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/dialog_backboard.ts +91 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/event_default_click.ts +179 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/hit_test.ts +339 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/image_source.ts +84 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/input_traps.ts +249 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/layout_placement.ts +234 -5
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/lottie_host.ts +145 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/media_tint.ts +45 -11
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_binds.ts +56 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_string.ts +96 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/padding_in_size.ts +60 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/percent_height_in_scroll.ts +3 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/relative_container_height.ts +102 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/root_weight.ts +54 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/runtime_traps.ts +440 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/scroll_align.ts +75 -23
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/swiper_index.ts +65 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/theme_color.ts +63 -2
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/waterflow_sections.ts +231 -0
- package/skills/a2h-batch-ui-align/scripts/static_check/rules/wide_constant_width.ts +4 -4
- package/skills/a2h-batch-ui-align/scripts/static_check/scan_file.ts +24 -2
- package/skills/a2h-batch-ui-align/scripts/tests/agent_cli.test.mjs +14 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_baseline.test.mjs +129 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_runtime2.test.mjs +697 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_hit_test.test.mjs +298 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_input_runtime.test.mjs +514 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_layout_placement.test.mjs +224 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_lottie.test.mjs +199 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_rule_smoke.test.mjs +41 -7
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_runtime_api.test.mjs +346 -0
- package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_theme_runtime.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/branch_coverage.test.mjs +116 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set.test.mjs +126 -0
- package/skills/a2h-batch-ui-align/scripts/tests/build_conversion_set_scope.test.mjs +1 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_audit.test.mjs +179 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_fast.test.mjs +56 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_gate.test.mjs +197 -0
- package/skills/a2h-batch-ui-align/scripts/tests/capture_review_fixes.test.mjs +322 -0
- package/skills/a2h-batch-ui-align/scripts/tests/color_utils_asset.test.mjs +19 -0
- package/skills/a2h-batch-ui-align/scripts/tests/evidence_gate.test.mjs +15 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/SearchMenuDialog.buggy.ets +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/meta.json +21 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/screenshot.png +0 -0
- package/skills/a2h-batch-ui-align/scripts/tests/fixtures/icon_drift_search_sheet/page_0002_SearchMenuFragment/view.xml +35 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_pack_evidence.test.mjs +95 -0
- package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +155 -1
- package/skills/a2h-batch-ui-align/scripts/tests/icon_coverage.test.mjs +314 -0
- package/skills/a2h-batch-ui-align/scripts/tests/list_existing.test.mjs +157 -0
- package/skills/a2h-batch-ui-align/scripts/tests/measure_pack.test.mjs +5 -3
- package/skills/a2h-batch-ui-align/scripts/tests/page_gap.test.mjs +115 -0
- package/skills/a2h-batch-ui-align/scripts/tests/phase5_check.test.mjs +33 -2
- package/skills/a2h-batch-ui-align/scripts/tests/progress_identity.test.mjs +174 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_contract.test.mjs +5 -0
- package/skills/a2h-batch-ui-align/scripts/tests/shell_requests.test.mjs +158 -0
- package/skills/a2h-batch-ui-align/scripts/tests/skill_doc_contract.test.mjs +12 -0
- package/skills/a2h-batch-ui-align/scripts/tests/state_doc.test.mjs +8 -0
- package/skills/a2h-coldstart-smoke-gate/SKILL.md +7 -4
- package/skills/a2h-dashboard-render/test/test_device_locale_dialogs.mjs +17 -0
- package/skills/a2h-module-semantic-docs/SKILL.md +51 -13
- package/skills/a2h-module-semantic-docs/scripts/scan_modules.mjs +66 -11
- package/skills/a2h-module-semantic-docs/test/test_incremental_fingerprint.mjs +94 -0
- package/skills/a2h-page-specgen/SKILL.md +124 -20
- package/skills/a2h-page-specgen/references/behavior-ledger.md +1170 -0
- package/skills/a2h-page-specgen/references/body-language.md +11 -9
- package/skills/a2h-page-specgen/references/evidence.md +35 -0
- package/skills/a2h-page-specgen/references/execution-model.md +135 -26
- package/skills/a2h-page-specgen/references/footprint-and-grouping.md +20 -15
- package/skills/a2h-page-specgen/references/gates.md +120 -52
- package/skills/a2h-page-specgen/references/page-inventory.md +69 -22
- package/skills/a2h-page-specgen/references/scenario-authoring.md +272 -0
- package/skills/a2h-page-specgen/references/spec-example.md +312 -0
- package/skills/a2h-page-specgen/references/spec-template.md +112 -109
- package/skills/a2h-page-specgen/scripts/behavior-audit.mjs +2436 -0
- package/skills/a2h-page-specgen/scripts/behavior-discovery.mjs +1833 -0
- package/skills/a2h-page-specgen/scripts/behavior-model.mjs +181 -0
- package/skills/a2h-page-specgen/scripts/behavior-reconcile.mjs +1205 -0
- package/skills/a2h-page-specgen/scripts/dispatch.mjs +8 -5
- package/skills/a2h-page-specgen/scripts/entry-evidence.mjs +1123 -0
- package/skills/a2h-page-specgen/scripts/facts-build.mjs +170 -61
- package/skills/a2h-page-specgen/scripts/finalize.mjs +466 -63
- package/skills/a2h-page-specgen/scripts/footprint.mjs +302 -180
- package/skills/a2h-page-specgen/scripts/gate.mjs +372 -82
- package/skills/a2h-page-specgen/scripts/interactions.mjs +215 -8
- package/skills/a2h-page-specgen/scripts/inventory.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/contracts.mjs +116 -216
- package/skills/a2h-page-specgen/scripts/lib/draft-store.mjs +105 -13
- package/skills/a2h-page-specgen/scripts/lib/graph-evidence.mjs +235 -0
- package/skills/a2h-page-specgen/scripts/lib/hg.mjs +520 -12
- package/skills/a2h-page-specgen/scripts/lib/homegraph-process.mjs +102 -0
- package/skills/a2h-page-specgen/scripts/lib/homegraph-query.mjs +161 -0
- package/skills/a2h-page-specgen/scripts/lib/ledger.mjs +129 -6
- package/skills/a2h-page-specgen/scripts/lib/main-module.mjs +24 -0
- package/skills/a2h-page-specgen/scripts/lib/operation-reviews.mjs +913 -0
- package/skills/a2h-page-specgen/scripts/lib/prose.mjs +12 -8
- package/skills/a2h-page-specgen/scripts/lib/recovery-policy.mjs +28 -0
- package/skills/a2h-page-specgen/scripts/lib/scope.mjs +355 -0
- package/skills/a2h-page-specgen/scripts/lib/semantic-detail.mjs +353 -0
- package/skills/a2h-page-specgen/scripts/lib/source-text.mjs +106 -0
- package/skills/a2h-page-specgen/scripts/operation-evidence.mjs +1542 -0
- package/skills/a2h-page-specgen/scripts/prepare.mjs +470 -122
- package/skills/a2h-page-specgen/scripts/render.mjs +11 -34
- package/skills/a2h-page-specgen/scripts/report.mjs +339 -6
- package/skills/a2h-page-specgen/scripts/submission.mjs +253 -88
- package/skills/a2h-page-specgen/scripts/submit.mjs +12 -6
- package/skills/a2h-page-specgen/scripts/test/acceptance/acceptance.mjs +288 -7
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.java +15 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.json +26 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/PlainDisplayPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.java +36 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.json +43 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/SilentFailurePage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.discovery.json +2694 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.json +726 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.post-review.json +108 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.review.md +65 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/UniAppSourcePage.worker.md +265 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.java +47 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.json +54 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.prompt.md +347 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/ValidatedSearchPage.worker.md +298 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/branch-checklist.md +32 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/gate-results.json +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/manifest.json +111 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/portability.test.mjs +141 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/review.md +22 -0
- package/skills/a2h-page-specgen/scripts/test/acceptance/authoring/run.mjs +515 -0
- package/skills/a2h-page-specgen/scripts/test/android-entry-evidence.test.mjs +585 -0
- package/skills/a2h-page-specgen/scripts/test/android-operation-evidence.test.mjs +755 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-group.test.mjs +543 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-post.test.mjs +652 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-audit-pre.test.mjs +1231 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-component-gate.test.mjs +494 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-discovery.test.mjs +1513 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-finalize.test.mjs +758 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-fixtures.mjs +623 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-model.test.mjs +116 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-reconcile.test.mjs +795 -0
- package/skills/a2h-page-specgen/scripts/test/behavior-regression.test.mjs +883 -0
- package/skills/a2h-page-specgen/scripts/test/contracts.test.mjs +135 -137
- package/skills/a2h-page-specgen/scripts/test/entry-evidence.test.mjs +475 -0
- package/skills/a2h-page-specgen/scripts/test/facts.test.mjs +40 -1
- package/skills/a2h-page-specgen/scripts/test/finalize.test.mjs +178 -9
- package/skills/a2h-page-specgen/scripts/test/fixtures/hg.mkdb.mjs +19 -1
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.java +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanels.kt +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/BottomPanelsKotlinForms.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ChildContent.java +6 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ComposeLifecycle.kt +26 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleCallAndOverride.java +10 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/LifecycleHooks.kt +31 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ManyLifecycleHooks.kt +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshOnResume.java +7 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/RefreshResultNoise.kt +36 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/SelectionView.java +5 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ShowPage.vue +12 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/ThirdPartyLifecycle.kt +25 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/src/fragment_detail.xml +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/App.vue +1 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-conflict-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/bundle-record.json +17 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/manifest.json +3 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages/list/index.vue +80 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/pages.json +14 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/source-record.json +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/components/RefreshPanel.vue +15 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/composables/useRefresh.ts +50 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/pages/help/index.vue +9 -0
- package/skills/a2h-page-specgen/scripts/test/fixtures/uniapp-source/src/state/store.ts +4 -0
- package/skills/a2h-page-specgen/scripts/test/footprint-resolve.test.mjs +459 -188
- package/skills/a2h-page-specgen/scripts/test/gate-partial.test.mjs +89 -0
- package/skills/a2h-page-specgen/scripts/test/gate.test.mjs +869 -13
- package/skills/a2h-page-specgen/scripts/test/graph-evidence.test.mjs +332 -0
- package/skills/a2h-page-specgen/scripts/test/helpers.mjs +139 -5
- package/skills/a2h-page-specgen/scripts/test/hg.test.mjs +378 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-process-fixture.mjs +130 -0
- package/skills/a2h-page-specgen/scripts/test/homegraph-query.test.mjs +288 -0
- package/skills/a2h-page-specgen/scripts/test/integration.test.mjs +69 -2
- package/skills/a2h-page-specgen/scripts/test/interactions.test.mjs +267 -2
- package/skills/a2h-page-specgen/scripts/test/inventory.test.mjs +111 -0
- package/skills/a2h-page-specgen/scripts/test/keys.test.mjs +10 -8
- package/skills/a2h-page-specgen/scripts/test/ledger-lock.test.mjs +77 -0
- package/skills/a2h-page-specgen/scripts/test/ledger.test.mjs +1 -1
- package/skills/a2h-page-specgen/scripts/test/main-module.test.mjs +43 -0
- package/skills/a2h-page-specgen/scripts/test/operation-reviews.test.mjs +1002 -0
- package/skills/a2h-page-specgen/scripts/test/plan-build.test.mjs +143 -51
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph-reproduction.mjs +365 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-homegraph.test.mjs +569 -0
- package/skills/a2h-page-specgen/scripts/test/prepare-index.test.mjs +42 -2
- package/skills/a2h-page-specgen/scripts/test/prepare-pipeline.test.mjs +326 -0
- package/skills/a2h-page-specgen/scripts/test/prompt-tpl.test.mjs +171 -3
- package/skills/a2h-page-specgen/scripts/test/prose.test.mjs +13 -5
- package/skills/a2h-page-specgen/scripts/test/protocol-docs.test.mjs +365 -1
- package/skills/a2h-page-specgen/scripts/test/recovery-e2e.test.mjs +102 -7
- package/skills/a2h-page-specgen/scripts/test/recovery-policy.test.mjs +14 -0
- package/skills/a2h-page-specgen/scripts/test/recovery.test.mjs +1308 -72
- package/skills/a2h-page-specgen/scripts/test/render.test.mjs +85 -42
- package/skills/a2h-page-specgen/scripts/test/report.test.mjs +296 -0
- package/skills/a2h-page-specgen/scripts/test/review-followup.test.mjs +467 -0
- package/skills/a2h-page-specgen/scripts/test/scope.test.mjs +292 -0
- package/skills/a2h-page-specgen/scripts/test/semantic-detail.test.mjs +949 -0
- package/skills/a2h-page-specgen/scripts/test/submit.test.mjs +645 -115
- package/skills/a2h-page-specgen/scripts/test/uniapp-operation-evidence.test.mjs +639 -0
- package/skills/a2h-page-specgen/scripts/test/utg-footprint-contract.test.mjs +274 -0
- package/skills/a2h-page-specgen/scripts/test/waker-process.test.mjs +101 -65
- package/skills/a2h-page-specgen/scripts/test/waker.test.mjs +88 -74
- package/skills/a2h-page-specgen/scripts/test/watchdog.test.mjs +30 -1
- package/skills/a2h-page-specgen/scripts/waker.mjs +79 -12
- package/skills/a2h-page-specgen/scripts/watchdog.mjs +18 -17
- package/skills/a2h-resource-convert/SKILL.md +9 -1
- package/skills/a2h-resource-convert/references/code-vector-icon-rules.md +2 -1
- package/skills/a2h-resource-convert/references/incremental-page-migration.md +23 -2
- package/skills/a2h-resource-convert/references/lottie-conversion-rules.md +7 -0
- package/skills/a2h-resource-convert/references/step4-resource-types.md +2 -0
- package/skills/a2h-resource-convert/scripts/a2h_resource_convert.ts +67 -3
- package/skills/a2h-resource-convert/scripts/a2h_resource_incremental.ts +68 -0
- package/skills/a2h-resource-convert/scripts/code_vector_icons.ts +45 -3
- package/skills/a2h-resource-convert/scripts/extract_page_resources.ts +42 -5
- package/skills/a2h-resource-convert/scripts/lottie_hosts.ts +415 -0
- package/skills/a2h-resource-convert/scripts/lottie_refs.ts +398 -0
- package/skills/a2h-resource-convert/scripts/merge_mapping.ts +316 -0
- package/skills/a2h-resource-convert/scripts/svg_fidelity_check.ts +2 -1
- package/skills/a2h-resource-convert/scripts/tests/code_vector_guard.test.mjs +75 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_hosts.test.mjs +222 -0
- package/skills/a2h-resource-convert/scripts/tests/lottie_incremental.test.mjs +178 -0
- package/skills/a2h-resource-convert/scripts/tests/merge_mapping.test.mjs +201 -0
- package/skills/a2h-spec-design-pipeline/SKILL.md +48 -72
- package/skills/a2h-spec-design-pipeline/references/coding-loop.md +123 -37
- package/skills/a2h-spec-design-pipeline/references/execution-model.md +40 -8
- package/skills/a2h-spec-design-pipeline/references/final-report-template.md +5 -4
- package/skills/a2h-spec-design-pipeline/references/homegraph-cli.md +229 -0
- package/skills/a2h-spec-design-pipeline/references/initialization.md +37 -5
- package/skills/a2h-spec-design-pipeline/references/merge-queue.md +126 -23
- package/skills/a2h-spec-design-pipeline/references/permission-index.json +206 -0
- package/skills/a2h-spec-design-pipeline/references/post-loop.md +23 -0
- package/skills/a2h-spec-design-pipeline/references/resolver-prompt.md +7 -1
- package/skills/a2h-spec-design-pipeline/references/review-loop.md +46 -0
- package/skills/a2h-spec-design-pipeline/references/scripts.md +38 -14
- package/skills/a2h-spec-design-pipeline/references/shared-layer.md +127 -4
- package/skills/a2h-spec-design-pipeline/references/state-and-resume.md +90 -24
- package/skills/a2h-spec-design-pipeline/references/static-defect-gate.md +65 -34
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleMeta.json +11 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/config/ruleSet.json +10 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/README.md +47 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-param-contract.json +31 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/data/api-permission-map.json +698 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-cn.md +96 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/api-permission-declared-en.md +103 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-cn.md +124 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/arkui-runtime-pitfall-en.md +138 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-cn.md +106 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/platform-api-contract-en.md +113 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ApiPermissionDeclaredCheck.js +705 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/ArkUIRuntimePitfallCheck.js +1063 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/PlatformApiContractCheck.js +473 -0
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/checker/{HttpExtraDataEmptyStringCheck.js → platform/ExtraDataSubCheck.js} +27 -30
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/lib/index.js +4 -2
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/package.json +3 -2
- package/skills/a2h-spec-design-pipeline/scripts/check_design_map.ts +108 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_permissions.ts +420 -0
- package/skills/a2h-spec-design-pipeline/scripts/check_review_evidence.ts +45 -0
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/evidence.mjs +55 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/fold.mjs +138 -7
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/landing.mjs +10 -13
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/progress.mjs +21 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/reconcile.mjs +63 -4
- package/skills/a2h-spec-design-pipeline/scripts/dispatch/wait.mjs +32 -2
- package/skills/a2h-spec-design-pipeline/scripts/dispatch.mjs +109 -13
- package/skills/a2h-spec-design-pipeline/scripts/ensure_index.ts +866 -0
- package/skills/a2h-spec-design-pipeline/scripts/fixtures/homecheck-stub.cjs +47 -0
- package/skills/a2h-spec-design-pipeline/scripts/homecheck_scan.ts +12 -17
- package/skills/a2h-spec-design-pipeline/scripts/plan_groups.ts +172 -7
- package/skills/a2h-spec-design-pipeline/scripts/resolver_prompt.ts +36 -16
- package/skills/a2h-spec-design-pipeline/scripts/sync_permission_index.ts +340 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_api_permission_declared.ts +281 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_arkui_runtime_pitfall.ts +690 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_design_map.ts +46 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_check_permissions.ts +201 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_commands.mjs +27 -3
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_e2e.mjs +20 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_evidence.mjs +143 -13
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_fold.mjs +168 -7
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_landing.mjs +139 -2
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_progress.mjs +25 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_reconcile.mjs +92 -4
- package/skills/a2h-spec-design-pipeline/scripts/test_dispatch_wait.mjs +37 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index.ts +572 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_index_real.ts +56 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_homecheck_scan.ts +4 -5
- package/skills/a2h-spec-design-pipeline/scripts/test_homegraph_docs.ts +217 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_permission_index.ts +214 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_plan_groups.ts +155 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_platform_api_contract.ts +308 -0
- package/skills/a2h-spec-design-pipeline/scripts/test_resolver_prompt.ts +59 -8
- package/skills/a2h-spec-design-pipeline/scripts/test_shared_layer_docs.ts +44 -0
- package/skills/a2h-spec-generate/SKILL.md +2 -2
- package/skills/a2h-spec-generate/references/specs.schema.json +24 -11
- package/skills/a2h-spec-generate/scripts/ensure-index.mjs +1 -2
- package/skills/a2h-spec-generate/test/ensure-index.test.mjs +1 -2
- package/skills/a2h-utg-explorer/SKILL.md +9 -3
- package/skills/a2h-utg-explorer/references/architecture.md +3 -0
- package/skills/a2h-utg-explorer/scripts/audit.mjs +8 -2
- package/skills/a2h-utg-explorer/scripts/compile_tasks.mjs +56 -5
- package/skills/a2h-utg-explorer/scripts/direct_launch.mjs +47 -2
- package/skills/a2h-utg-explorer/scripts/hybrid_route_cdp.mjs +376 -0
- package/skills/a2h-utg-explorer/scripts/plan.mjs +8 -0
- package/skills/a2h-utg-explorer/scripts/recover_d.mjs +288 -21
- package/skills/a2h-utg-explorer/scripts/report.mjs +89 -0
- package/skills/a2h-utg-explorer/scripts/run_cycle.mjs +67 -10
- package/skills/a2h-utg-explorer/scripts/run_device.mjs +10 -2
- package/skills/a2h-utg-explorer/scripts/seed_recipes.mjs +426 -0
- package/skills/a2h-utg-explorer/scripts/tests/blank_wait.test.mjs +126 -0
- package/skills/a2h-utg-explorer/scripts/tests/default_override.test.mjs +109 -0
- package/skills/a2h-utg-explorer/scripts/tests/device_locale_dialogs.test.mjs +29 -0
- package/skills/a2h-utg-explorer/scripts/tests/diagnostics.test.mjs +254 -0
- package/skills/a2h-utg-explorer/scripts/tests/foreground_spelling.test.mjs +155 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route.test.mjs +120 -0
- package/skills/a2h-utg-explorer/scripts/tests/hybrid_route_identity.test.mjs +146 -0
- package/skills/a2h-utg-explorer/scripts/tests/interruptions.test.mjs +122 -0
- package/skills/a2h-utg-explorer/scripts/tests/launch_bridge.test.mjs +15 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr169_review_fixes.test.mjs +218 -0
- package/skills/a2h-utg-explorer/scripts/tests/pr191_review_fixes.test.mjs +292 -0
- package/skills/a2h-utg-explorer/scripts/tests/recover_d_grounding.test.mjs +164 -0
- package/skills/a2h-utg-explorer/scripts/tests/replay_reroute.test.mjs +143 -0
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle.test.mjs +6 -2
- package/skills/a2h-utg-explorer/scripts/tests/run_cycle_follow.test.mjs +35 -0
- package/skills/a2h-utg-explorer/scripts/tests/seed_recipes.test.mjs +261 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/adapters.mjs +122 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/diagnostics.mjs +196 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/hybrid_route.mjs +140 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/semantics.mjs +138 -4
- package/skills/a2h-utg-explorer/scripts/utg_explorer/state_phase.mjs +47 -0
- package/skills/a2h-utg-explorer/scripts/utg_explorer/strings.mjs +22 -13
- package/skills/a2h-utg-explorer/scripts/utg_explorer/task_runner.mjs +718 -42
- package/skills/a2h-utg-explorer/scripts/variant.mjs +57 -11
- package/skills/a2h-utg-static/SKILL.md +6 -2
- package/skills/a2h-utg-static/scripts/assemble.mjs +65 -0
- package/skills/a2h-utg-static/scripts/click_paths.mjs +116 -5
- package/skills/a2h-utg-static/scripts/compose_body_text.mjs +3 -3
- package/skills/a2h-utg-static/scripts/compose_overlay.mjs +8 -1
- package/skills/a2h-utg-static/scripts/compose_titles.mjs +5 -5
- package/skills/a2h-utg-static/scripts/compose_widgets.mjs +4 -4
- package/skills/a2h-utg-static/scripts/data_model.mjs +590 -0
- package/skills/a2h-utg-static/scripts/data_producers.mjs +431 -0
- package/skills/a2h-utg-static/scripts/hybrid_scope.mjs +46 -1
- package/skills/a2h-utg-static/scripts/label_resolve.mjs +49 -4
- package/skills/a2h-utg-static/scripts/lib/hybrid-provenance.mjs +201 -0
- package/skills/a2h-utg-static/scripts/lib/uniapp-routes.mjs +195 -0
- package/skills/a2h-utg-static/scripts/menu_nav.mjs +1 -1
- package/skills/a2h-utg-static/scripts/nl_hints.mjs +32 -4
- package/skills/a2h-utg-static/scripts/run_pipeline.mjs +86 -4
- package/skills/a2h-utg-static/scripts/tests/test_carry_answers.mjs +30 -0
- package/skills/a2h-utg-static/scripts/tests/test_compose_res_text.mjs +18 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_model.mjs +120 -0
- package/skills/a2h-utg-static/scripts/tests/test_data_producers.mjs +114 -0
- package/skills/a2h-utg-static/scripts/tests/test_guard_kinds_locale.mjs +12 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_provenance.mjs +150 -0
- package/skills/a2h-utg-static/scripts/tests/test_hybrid_scope.mjs +165 -1
- package/skills/a2h-utg-static/scripts/tests/test_library_activity.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_module_strings.mjs +35 -1
- package/skills/a2h-utg-static/scripts/tests/test_nl_hints_default_override.mjs +50 -0
- package/skills/a2h-utg-static/scripts/tests/test_pipeline_llm_phases.mjs +21 -0
- package/skills/a2h-utg-static/scripts/tests/test_pr169_review_fixes.mjs +172 -0
- package/skills/a2h-utg-static/scripts/tests/test_redirect_path_cost.mjs +136 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_route_jump.mjs +175 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_routes.mjs +161 -0
- package/skills/a2h-utg-static/scripts/tests/test_uniapp_source.mjs +99 -0
- package/skills/a2h-utg-static/scripts/tests/test_utg_specgen_boundary.mjs +45 -0
- package/skills/a2h-utg-static/scripts/tests/test_vm_nav_helper_navigate.mjs +21 -0
- package/skills/a2h-utg-static/scripts/uniapp_nav.mjs +112 -69
- package/skills/a2h-utg-static/scripts/vm_nav.mjs +9 -1
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-cn.md +0 -55
- package/skills/a2h-spec-design-pipeline/rules/migration-rules/document/checker/hometrans/http-extra-data-empty-string-en.md +0 -60
- package/skills/a2h-spec-design-pipeline/scripts/ensure_wt_index.ts +0 -948
- package/skills/a2h-spec-design-pipeline/scripts/test_ensure_wt_index.ts +0 -1014
|
@@ -3,21 +3,42 @@
|
|
|
3
3
|
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
6
|
import { exec as nodeExec } from "node:child_process";
|
|
8
7
|
import { promisify } from "node:util";
|
|
9
8
|
import { ensureDir, slugify, writeTextAtomic, writeJsonAtomic, readJson } from "./lib/fsx.mjs";
|
|
10
9
|
import { loadUtg, loadClickPaths } from "./lib/utg-io.mjs";
|
|
11
10
|
import { attachReach } from "./lib/reach.mjs";
|
|
12
11
|
import { openReadOnly } from "./lib/hg.mjs";
|
|
13
|
-
import { buildPages } from "./inventory.mjs";
|
|
14
|
-
import { computeFootprint, buildPlan } from "./footprint.mjs";
|
|
15
|
-
import {
|
|
12
|
+
import { buildPages, redirectingInterceptors } from "./inventory.mjs";
|
|
13
|
+
import { computeFootprint, buildPlan, buildPageOwnerIndex } from "./footprint.mjs";
|
|
14
|
+
import { enrichBehaviorEvidence, writeBehaviorEvidence } from "./behavior-discovery.mjs";
|
|
15
|
+
import { discoverEntryEvidence } from "./entry-evidence.mjs";
|
|
16
|
+
import { discoverOperations } from "./operation-evidence.mjs";
|
|
17
|
+
import { stemOf } from "./render.mjs";
|
|
18
|
+
import { collectFacts, writeFacts } from "./facts-build.mjs";
|
|
19
|
+
import { queryHomeGraph } from "./lib/homegraph-query.mjs";
|
|
20
|
+
import { createGraphEvidence } from "./lib/graph-evidence.mjs";
|
|
16
21
|
import { appendEvent, fold } from "./lib/ledger.mjs";
|
|
17
22
|
import { stopWaker } from "./waker.mjs";
|
|
23
|
+
import { applyScope, featureScopeByPage, logicUnits, readScopeDoc, scopeFeatureOperations } from "./lib/scope.mjs";
|
|
24
|
+
import { isMainModule } from "./lib/main-module.mjs";
|
|
25
|
+
import { stableDigest } from "./behavior-model.mjs";
|
|
18
26
|
|
|
19
27
|
const execAsync = promisify(nodeExec);
|
|
20
28
|
|
|
29
|
+
/** Embed the rule document without introducing a second H1 or sibling H2 sections. */
|
|
30
|
+
export function formatScenarioAuthoringRules(markdown) {
|
|
31
|
+
return String(markdown ?? "")
|
|
32
|
+
.trim()
|
|
33
|
+
.replace(/^# [^\n]*(?:\n+|$)/, "")
|
|
34
|
+
.replace(/^(#{1,5}) /gm, "#$1 ");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const SCENARIO_AUTHORING_RULES = formatScenarioAuthoringRules(fs.readFileSync(
|
|
38
|
+
new URL("../references/scenario-authoring.md", import.meta.url),
|
|
39
|
+
"utf8",
|
|
40
|
+
));
|
|
41
|
+
|
|
21
42
|
/** Reject every non-empty output that is not a valid strict-v2 run, without writing. */
|
|
22
43
|
export function preflightOutput(outDir) {
|
|
23
44
|
if (!fs.existsSync(outDir)) return { mode: "new" };
|
|
@@ -38,6 +59,90 @@ export function preflightOutput(outDir) {
|
|
|
38
59
|
return { mode: "resume", planVersion: state.plan_version };
|
|
39
60
|
}
|
|
40
61
|
|
|
62
|
+
/**
|
|
63
|
+
* The content a group's SPECs are derived from: its plan row, its units, and the full page records
|
|
64
|
+
* of its pages (behavior evidence included). Two plans with the same digest for a group would hand
|
|
65
|
+
* that group's worker identical inputs.
|
|
66
|
+
*/
|
|
67
|
+
export function groupContentDigest(plan, groupId) {
|
|
68
|
+
const group = (plan?.groups ?? []).find((g) => g.group_id === groupId);
|
|
69
|
+
if (!group) return null;
|
|
70
|
+
const pageIds = new Set(group.pages ?? []);
|
|
71
|
+
return stableDigest({
|
|
72
|
+
group: [group.kind, group.deps ?? [], group.pages ?? [], group.spec_ids ?? []],
|
|
73
|
+
units: (plan.spec_units ?? []).filter((u) => u.dir === groupId)
|
|
74
|
+
.map((u) => [u.spec_id, u.page_id, u.dir, u.est]),
|
|
75
|
+
pages: (plan.pages ?? []).filter((p) => pageIds.has(p.page_id))
|
|
76
|
+
.sort((a, b) => a.page_id.localeCompare(b.page_id)),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* M10: bring forward from a previous run every group whose content is unchanged, so a plan that
|
|
82
|
+
* moved elsewhere (or a run published with holes) does not regenerate it. A group is carried only
|
|
83
|
+
* when the previous run submitted it whole and did not list it in `incomplete.failedShards`; its
|
|
84
|
+
* drafts and behavior artifacts are copied at the same attempt number (the artifacts carry it) and
|
|
85
|
+
* a `carry` event marks it submitted. finalize then gates it like any submission of this run.
|
|
86
|
+
* Returns the carried group ids.
|
|
87
|
+
*/
|
|
88
|
+
export function carryForward(outDir, plan, fromDir) {
|
|
89
|
+
const prevPlanPath = path.join(fromDir, "plan.json");
|
|
90
|
+
if (!fs.existsSync(prevPlanPath) || !fs.existsSync(path.join(fromDir, "ledger.jsonl"))) return [];
|
|
91
|
+
const prevPlan = readJson(prevPlanPath);
|
|
92
|
+
const prevState = fold(fromDir);
|
|
93
|
+
let failedShards = new Set();
|
|
94
|
+
try {
|
|
95
|
+
failedShards = new Set(readJson(path.join(fromDir, "specs.json"))?.incomplete?.failedShards ?? []);
|
|
96
|
+
} catch { /* not finalized: every submitted group still qualifies */ }
|
|
97
|
+
const state = fold(outDir);
|
|
98
|
+
const carried = [];
|
|
99
|
+
for (const group of plan.groups ?? []) {
|
|
100
|
+
const gid = group.group_id;
|
|
101
|
+
const prev = prevState.groups.get(gid);
|
|
102
|
+
if (!prev || prev.state !== "submitted" || failedShards.has(gid)) continue;
|
|
103
|
+
if (state.groups.get(gid)?.state !== "pending" || state.groups.get(gid)?.attempt !== 0) continue;
|
|
104
|
+
if (groupContentDigest(plan, gid) !== groupContentDigest(prevPlan, gid)) continue;
|
|
105
|
+
const attempt = prev.attempt;
|
|
106
|
+
const drafts = (group.spec_ids ?? []).map((specId) => [
|
|
107
|
+
path.join(fromDir, "drafts", `attempt-${attempt}`, `${stemOf(specId)}.json`),
|
|
108
|
+
path.join(outDir, "drafts", `attempt-${attempt}`, `${stemOf(specId)}.json`),
|
|
109
|
+
]);
|
|
110
|
+
if (!drafts.every(([from]) => fs.existsSync(from))) continue;
|
|
111
|
+
const behaviorFrom = path.join(fromDir, "behavior", `attempt-${attempt}`, gid);
|
|
112
|
+
const behaviorTo = path.join(outDir, "behavior", `attempt-${attempt}`, gid);
|
|
113
|
+
for (const [from, to] of drafts) {
|
|
114
|
+
ensureDir(path.dirname(to));
|
|
115
|
+
fs.copyFileSync(from, to);
|
|
116
|
+
}
|
|
117
|
+
if (fs.existsSync(behaviorFrom)) {
|
|
118
|
+
fs.rmSync(behaviorTo, { recursive: true, force: true });
|
|
119
|
+
fs.cpSync(behaviorFrom, behaviorTo, { recursive: true });
|
|
120
|
+
}
|
|
121
|
+
appendEvent(outDir, { ev: "carry", group: gid, attempt, from: path.resolve(fromDir) });
|
|
122
|
+
carried.push(gid);
|
|
123
|
+
}
|
|
124
|
+
return carried;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const INTERCEPTION_RE = /登录拦截|路由拦截|拦截器|未登录[^。\n]{0,12}(?:跳转|进入|打开)[^。\n]{0,6}登录|login (?:guard|interceptor|interception)|requires? (?:a )?login|redirects? to (?:the )?login/i;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* K3: the architecture documents a navigation precondition (login interception) but the static UTG
|
|
131
|
+
* recorded none — no page `<axis>_interceptor`, no edge guard with a redirect. Measured (coolmall): the
|
|
132
|
+
* interception lived in an interceptor class no page owned, every guard was null, and no SPEC carried it.
|
|
133
|
+
* Returns { doc, excerpt } for a run-level gap, or null.
|
|
134
|
+
*/
|
|
135
|
+
export function detectNavigationGuardGap(pages, hmos) {
|
|
136
|
+
const guarded = (pages ?? []).some((p) => redirectingInterceptors(p.interceptors).length > 0
|
|
137
|
+
|| (p.out_edges ?? []).some((e) => e?.guard && typeof e.guard === "object" && e.guard.redirect_when_unmet));
|
|
138
|
+
if (guarded || !hmos) return null;
|
|
139
|
+
const doc = path.join(hmos, ".hometrans", "project_design.md");
|
|
140
|
+
let text = "";
|
|
141
|
+
try { text = fs.readFileSync(doc, "utf8"); } catch { return null; }
|
|
142
|
+
const m = INTERCEPTION_RE.exec(text);
|
|
143
|
+
return m ? { doc: ".hometrans/project_design.md", excerpt: m[0] } : null;
|
|
144
|
+
}
|
|
145
|
+
|
|
41
146
|
/** Recheck the immutable plan identity after planning and before every output write. */
|
|
42
147
|
export function assertSamePlanVersion(outDir, builtPlan) {
|
|
43
148
|
const preflight = preflightOutput(outDir);
|
|
@@ -77,13 +182,11 @@ export function decideIndexAction(status, utgMtime) {
|
|
|
77
182
|
return "index";
|
|
78
183
|
}
|
|
79
184
|
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}
|
|
185
|
+
// N15: utg.json's mtime is not a staleness signal for the Android source index. The snapshot is
|
|
186
|
+
// re-copied every run (cpSync keeps no timestamps) and discover.utg_snapshot runs after
|
|
187
|
+
// discover.android_index, so it was always "newer" and every first prepare rebuilt the whole
|
|
188
|
+
// index (up to 10 min). Source edits show up in pendingChanges below; `utgMtime` is kept in the
|
|
189
|
+
// signature for callers but no longer decides anything.
|
|
87
190
|
|
|
88
191
|
// Pending changes trigger a sync
|
|
89
192
|
if (status.pendingChanges && Object.keys(status.pendingChanges).length > 0) {
|
|
@@ -196,6 +299,50 @@ export async function ensureIndex(sourceProject, { exec, status, utgMtime }) {
|
|
|
196
299
|
* @param {object} plan - plan metadata (outDir, failureReason, etc.)
|
|
197
300
|
* @returns {string} prompt text
|
|
198
301
|
*/
|
|
302
|
+
/**
|
|
303
|
+
* Incremental feature scope: the group's pages that already exist in HarmonyOS and get only this round's features
|
|
304
|
+
* (SUP / CHG). The SPEC covers exactly those behaviors; everything else on the page is excluded through the legal
|
|
305
|
+
* out-of-scope path (behavior-ledger.md 3.2), so the coverage gate still closes. A NEW page appears only when its
|
|
306
|
+
* feature quotes its requirement: written whole, minus what the requirement excludes. Empty for every other group.
|
|
307
|
+
* The operations prepare judged outside the features (lib/scope.mjs scopeFeatureOperations) are listed per page.
|
|
308
|
+
*/
|
|
309
|
+
export function renderFeatureScope(group, pages) {
|
|
310
|
+
const scoped = (group.pages ?? []).map((id) => [id, pages.get(id)?.feature_scope]).filter(([, fs]) => fs);
|
|
311
|
+
if (!scoped.length) return "";
|
|
312
|
+
const partial = scoped.some(([, fs]) => fs.types.some((t) => t !== "NEW"));
|
|
313
|
+
const quoted = scoped.some(([, fs]) => fs.features.some((f) => f.requirement));
|
|
314
|
+
let s = `\n## Incremental feature scope (write only this round's features; exclude the rest as out of scope)\n\n`;
|
|
315
|
+
if (partial) {
|
|
316
|
+
s += `Pages marked SUP / CHG already exist in the HarmonyOS project; this round migrates only the features listed. The SPEC covers only their behavior:\n`;
|
|
317
|
+
s += `- An assertion whose evidence lies outside the sources / texts below: planned \`out-of-scope\` with \`scope_rule: "explicitly-excluded-source"\`, current evidence and a supported review;\n`;
|
|
318
|
+
s += ` a candidate of the same kind gets \`waived\` + \`out-of-scope\` + the same scope_rule, and the same reason in \`coverage.excluded[]\`.\n`;
|
|
319
|
+
s += `- Navigation (out_edges) and widgets unrelated to these features go to \`coverage.excluded\` with the reason \`out-of-feature-scope\`.\n`;
|
|
320
|
+
s += `- Network operations: an \`operation_candidates\` entry with \`owner: "out-of-feature-scope"\` was judged by prepare, from the feature evidence, to lie outside this round (listed per page below): `;
|
|
321
|
+
s += `write no \`operation_reviews\` for it and project it into no endpoint; put its \`operation_id\` as the item in \`coverage.excluded\` with the reason \`out-of-feature-scope\`, `;
|
|
322
|
+
s += `and exclude the assertions on it as above. Every other operation is reviewed and projected as usual.\n`;
|
|
323
|
+
s += `- A behavior you are unsure belongs to the features, and that the requirement text does not explicitly exclude, is written in (better one too many than one missed).\n`;
|
|
324
|
+
}
|
|
325
|
+
if (quoted) {
|
|
326
|
+
s += `- **The requirement text is the feature's boundary**: when it says something is out of scope, or covers only one state (e.g. "only the empty queue"), the excluded behaviors and states are excluded as above, `;
|
|
327
|
+
s += `even when the Android source implements them fully; a page marked only NEW follows the same rule (the page is written whole, minus what the requirement excludes).\n`;
|
|
328
|
+
}
|
|
329
|
+
for (const [id, fs] of scoped) {
|
|
330
|
+
const whole = fs.types.every((t) => t === "NEW");
|
|
331
|
+
s += `\n### ${id} (${fs.types.join(" / ")}${whole ? ", new page written whole" : ""})\n`;
|
|
332
|
+
for (const f of fs.features) {
|
|
333
|
+
s += `- Feature \`${f.id}\`: ${f.title}${f.origin ? ` (from ${f.origin})` : ""}\n`;
|
|
334
|
+
if (f.source_refs.length) s += ` - Sources: ${f.source_refs.map((r) => `\`${r}\``).join(", ")}\n`;
|
|
335
|
+
if (f.string_keys.length) s += ` - Text keys: ${f.string_keys.map((k) => `\`${k}\``).join(", ")}\n`;
|
|
336
|
+
if (f.requirement) s += ` - Requirement text:\n${f.requirement.split(/\r?\n/).map((l) => ` > ${l}`).join("\n")}\n`;
|
|
337
|
+
}
|
|
338
|
+
if (fs.change.length) s += `- Changed behavior: ${fs.change.join("; ")} (write the new behavior and state the difference from the old one in summary)\n`;
|
|
339
|
+
if (fs.missing.length) s += `- Missing on the HarmonyOS side: ${fs.missing.map((m) => `\`${m.type}/${m.name}\``).join(", ")}\n`;
|
|
340
|
+
const outOps = fs.operation_scope?.excluded ?? [];
|
|
341
|
+
if (outOps.length) s += `- Out-of-scope operations (out-of-feature-scope): ${outOps.map((o) => `\`${o.operation_id}\` (${o.at})`).join(", ")}\n`;
|
|
342
|
+
}
|
|
343
|
+
return s;
|
|
344
|
+
}
|
|
345
|
+
|
|
199
346
|
export function renderPrompt(group, units, pages, plan) {
|
|
200
347
|
const { outDir, failureReason } = plan;
|
|
201
348
|
|
|
@@ -221,8 +368,19 @@ export function renderPrompt(group, units, pages, plan) {
|
|
|
221
368
|
}
|
|
222
369
|
}
|
|
223
370
|
|
|
371
|
+
prompt += renderFeatureScope(group, pages);
|
|
372
|
+
|
|
224
373
|
prompt += `\n## Evidence paths\n\n`;
|
|
225
|
-
prompt += `
|
|
374
|
+
prompt += `The page evidence ledger is written by prepare and is read-only:\n`;
|
|
375
|
+
for (const pageId of group.pages) {
|
|
376
|
+
const page = pages.get(pageId);
|
|
377
|
+
const label = page?.label ? ` (${page.label})` : "";
|
|
378
|
+
prompt += `- ${pageId}${label}:\n`;
|
|
379
|
+
for (const file of ["composition.json", "candidates.json", "assertions.json", "unknowns.json"]) {
|
|
380
|
+
prompt += ` - \`evidence/${stemOf(pageId)}/${file}\`\n`;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
prompt += `Do not edit anything under \`evidence/\`.\n`;
|
|
226
384
|
prompt += `The global fact base lives under \`${outDir}/facts/\`:\n`;
|
|
227
385
|
prompt += `- symbols.json: {symbols: [...]}\n`;
|
|
228
386
|
prompt += `- entities.json, endpoints.json, stores.json, strings.json, libs.json\n`;
|
|
@@ -237,22 +395,41 @@ export function renderPrompt(group, units, pages, plan) {
|
|
|
237
395
|
prompt += `The writing rules are platform-neutral: Android reads Kotlin/Java and res, uni-app reads .js/.ts/.vue.\n`;
|
|
238
396
|
}
|
|
239
397
|
|
|
398
|
+
prompt += `\n## Behavior evidence verification order\n\n`;
|
|
399
|
+
prompt += `Read \`references/behavior-ledger.md\` for the complete field, unknown, waiver, and link protocol before writing audit artifacts.\n`;
|
|
400
|
+
prompt += `Work in this order on every attempt:\n`;
|
|
401
|
+
prompt += `1. Read interaction_scans and locate the failed and truncated units: Inspect interaction_scans for every SourceUnit. A record whose status is not ok, or whose truncated flag is true, is the unit this attempt must reconsider first.\n`;
|
|
402
|
+
prompt += `2. Read each SourceUnit and the related resources it needs: first read the page evidence ledger (composition / candidates / assertions / unknowns) and the source; the source is authoritative for values and branches. Read embedded content, folded overlays, and the same source reused across pages; one file may be both a host page's embedded unit and an overlay page's body, and assertions and reviews still follow page ownership.\n`;
|
|
403
|
+
prompt += `3. Add semantic assertions and candidate_ids[]: candidate_ids[] must retain every source of a merged promoted candidate. Do not keep just one.\n`;
|
|
404
|
+
prompt += `4. Write each SourceUnit conclusion and the complete assertion_ids: The only completed conclusions are assertions-found and no-assertions-found. assertion_ids must exactly cover every assertion attributed to the SourceUnit.\n`;
|
|
405
|
+
prompt += `5. Write an explicit resolution for every fully reviewed truncated unit and every composition unknown: A reviewed truncated SourceUnit closes only through an explicit resolved resolution; every unresolved scope:"composition" entry in \`unknowns.json\` also needs its own \`resolved\` or \`no-user-observable\` record with current evidence. Omitting them leaves composition open and keeps the page partial.\n`;
|
|
406
|
+
prompt += `6. Settle candidate dispositions and planned dispositions: A terminal candidate review requires a terminal disposition; supported / refuted / insufficient reviews must be disposed, a promoted review needs a promotions record, and a waived review needs a legal reason and current evidence. pending or failed candidates stay undisposed and keep the page partial, so never write a disposition before the review completes. Every assertion needs a terminal disposition.\n`;
|
|
407
|
+
prompt += `7. Write each page's static discovery to \`behavior/attempt-{{attempt}}/${group.group_id}/discovery.json\` in \`group.pages\` order, persisting each page before moving to the next. Never write \`gen.mjs\` or any unified generator.\n`;
|
|
408
|
+
prompt += `8. Run the pre-audit: \`node scripts/behavior-audit.mjs ${outDir} pre ${group.group_id} --attempt {{attempt}}\`; when it fails, fix discovery.json and rerun.\n`;
|
|
409
|
+
prompt += `9. Once the pre-audit passes, write each SPEC's draft to \`drafts/attempt-{{attempt}}/<stem>.json\` (<stem> comes from stemOf(spec_id)) as described in the output path below; process pages in the same order and persist each draft before moving to the next page.\n`;
|
|
410
|
+
prompt += `10. After drafting, write \`behavior/attempt-{{attempt}}/${group.group_id}/post-review.json\`. Compute drafts_digest with \`node scripts/behavior-audit.mjs ${outDir} digest ${group.group_id} --attempt {{attempt}}\`; never infer it from a failure message.\n`;
|
|
411
|
+
prompt += `11. Run the post-audit: \`node scripts/behavior-audit.mjs ${outDir} post ${group.group_id} --attempt {{attempt}}\`; when it fails, fix the draft for the stated failure and rerun.\n`;
|
|
412
|
+
prompt += `12. Submit immediately once the post-audit passes, using the submit command below.\n`;
|
|
413
|
+
prompt += `Align coverage with candidate disposition while drafting: Promoted interactions use coverage.interactions; waived interactions use coverage.excluded; unknown interactions keep the page partial. A candidate-backed interaction signal that is unknown or unfinished needs neither a claim nor an exclusion in coverage; the page stays partial.\n`;
|
|
414
|
+
prompt += `Submission and finalize re-read the live source bytes: a file that changes after review is source-changed, the page returns to partial, and a recorded review cannot launder it back to complete.\n`;
|
|
415
|
+
prompt += `Both pre and post artifacts live in the same \`behavior/attempt-{{attempt}}/${group.group_id}/\` directory; do not create another.\n`;
|
|
416
|
+
|
|
240
417
|
prompt += `\n## Output path\n\n`;
|
|
241
|
-
prompt += `Write each SPEC's draft to \`drafts/attempt
|
|
418
|
+
prompt += `Write each SPEC's draft to \`drafts/attempt-{{attempt}}/<stem>.json\`, where <stem> comes from stemOf(spec_id).\n`;
|
|
242
419
|
|
|
243
420
|
prompt += `\n## Body discipline\n\n`;
|
|
244
|
-
prompt += `
|
|
245
|
-
prompt +=
|
|
246
|
-
prompt +=
|
|
247
|
-
prompt += `- no source symbols (class/method/field names)\n`;
|
|
421
|
+
prompt += `Scenario prose (\`summary\` and \`scenarios\`) is read by both a reviewer and the downstream coder:\n`;
|
|
422
|
+
prompt += `it carries the user-perceivable behaviour AND the data facts needed to implement it.\n`;
|
|
423
|
+
prompt += `- no class or method names; data field, key, parameter, and enum names keep their source spelling\n`;
|
|
248
424
|
prompt += `- no file:line references\n`;
|
|
249
425
|
prompt += `- no framework type names (Activity, Fragment, ViewModel, etc.)\n`;
|
|
250
|
-
prompt += `- no dp/sp/px sizes and no colour values\n`;
|
|
251
|
-
prompt += `-
|
|
252
|
-
prompt += `Write the body in English. The summary must hold at least 40 words and every step at least 5 words
|
|
253
|
-
prompt += `**
|
|
254
|
-
prompt += `
|
|
255
|
-
prompt += `
|
|
426
|
+
prompt += `- no dp/sp/px/dip sizes (including a bare unit name) and no colour values\n`;
|
|
427
|
+
prompt += `- no assignment expressions; write data values as sentences ("the code field is 1001")\n`;
|
|
428
|
+
prompt += `Write the body in English. The summary must hold at least 40 words and every step at least 5 words.\n\n`;
|
|
429
|
+
prompt += `**Fact base** (\`scenarios[].contracts\`) is the structured input for the merge and never appears in\n`;
|
|
430
|
+
prompt += `the final document. Put implementation detail in the directly consuming scenario; never abbreviate\n`;
|
|
431
|
+
prompt += `it to "etc." or another vague phrase. A shared fact may be repeated in multiple scenarios.\n`;
|
|
432
|
+
prompt += `Do not write page-level \`contracts\`:\n`;
|
|
256
433
|
prompt += `- \`endpoints\`: for every network endpoint, the method, the complete URL, every parameter name and\n`;
|
|
257
434
|
prompt += ` type, whether it is required, the response fields, and the timeouts\n`;
|
|
258
435
|
prompt += `- \`stores\`: for every persistence key, the key name, type, default value and the **complete value\n`;
|
|
@@ -263,16 +440,44 @@ export function renderPrompt(group, units, pages, plan) {
|
|
|
263
440
|
prompt += `- \`rules\`: conversion formulas, boundary values, rounding and formatting rules, written as\n`;
|
|
264
441
|
prompt += ` statements a coder can follow\n\n`;
|
|
265
442
|
prompt += `Contracts come from entities.json / endpoints.json / stores.json under \`facts/\` and from the\n`;
|
|
266
|
-
prompt += `evidence slices; the \`contracts\` field structure is in \`references/spec-template.md
|
|
267
|
-
prompt += `nothing to write, omit \`contracts\`
|
|
268
|
-
prompt += `
|
|
443
|
+
prompt += `evidence slices; the \`scenarios[].contracts\` field structure is in \`references/spec-template.md\`.\n`;
|
|
444
|
+
prompt += `When a scenario has nothing to write, omit that scenario's \`contracts\` rather than padding it\n`;
|
|
445
|
+
prompt += `with empty arrays.\n`;
|
|
446
|
+
prompt += `Framework type names and file:line are still forbidden inside the fact base — writing \`Fragment\` there\n`;
|
|
269
447
|
prompt += `would make the coder implement a Fragment.\n`;
|
|
448
|
+
prompt += `Start behavior drafting from entry candidates, operation_candidates, response_spans, and evidence assertions; use operation_reviews to keep each behavior in its owned scenario and steps.\n`;
|
|
449
|
+
prompt += `contracts only add implementation facts; they never replace triggers, state transitions, visible UI content, exception handling, or boundary behavior.\n`;
|
|
450
|
+
prompt += `Semantic categories are evidence-owned, not a fixed eight-item checklist. Put operation_id, category, and claim_token on each corresponding coverage.behaviors link and point it to steps containing that exact observable claim.\n`;
|
|
451
|
+
prompt += `Real response_spans map callback, promise, complete, and response-interceptor to ui-result, ui-result, reset, and state-transition. Without category/assertion_id, bind the response span to an assertion by exact evidence_refs location and record unrecognized roles or explicit categories as scoped unknowns; an invalid category never falls back to the real-role mapping. Audit each response branch independently. When one assertion owns multiple branches, every specified link needs a distinct exact response_span/response_role backed by that branch's evidence and scenario/step ownership; true duplicates and identity-less sharing remain failures; entry-only semantic ownership needs no synthetic operation candidate.\n`;
|
|
452
|
+
|
|
453
|
+
prompt += `\n## Final step: merge the facts naturally\n\n`;
|
|
454
|
+
prompt += `Before submitting the draft, rewrite every fact from each scenario's \`contracts\` into that scenario's\n`;
|
|
455
|
+
prompt += `\`steps\`, so the SPEC expresses the implementation facts through the steps alone:\n`;
|
|
456
|
+
prompt += `- Write each fact into the step that consumes it: request facts into the step that issues the request;\n`;
|
|
457
|
+
prompt += ` key names, defaults, and enum values into the step that reads or writes persistence; field names, types,\n`;
|
|
458
|
+
prompt += ` and units into the step that displays or computes them; conversion and boundary rules into the step\n`;
|
|
459
|
+
prompt += ` that converts or decides. Use full sentences, not a parameter list.\n`;
|
|
460
|
+
prompt += `- Do not change the existing step count or order: do not delete, merge, or reorder steps, only rewrite\n`;
|
|
461
|
+
prompt += ` their text; appending at the end of a scenario is the only allowed addition, and existing step numbers\n`;
|
|
462
|
+
prompt += ` stay fixed.\n`;
|
|
463
|
+
prompt += `- Copy data facts with their source spelling (URL, parameter names, key names, enum values, field names);\n`;
|
|
464
|
+
prompt += ` do not write class or method names, file:line, assignment expressions, dp/sp/px/dip (including a bare unit name), or colour values;\n`;
|
|
465
|
+
prompt += ` field, parameter, and key names are facts that must appear, not source symbols; rewrite visual values as business descriptions ("the size is large").\n`;
|
|
466
|
+
prompt += `- Repeat a shared fact in full in every scenario that consumes it; never write "same as above" or\n`;
|
|
467
|
+
prompt += ` "as in scenario 1".\n`;
|
|
468
|
+
prompt += `- After the merge, \`steps\` must contain no "Implementation Contract" or "Network Endpoints" sub-heading\n`;
|
|
469
|
+
prompt += ` or note paragraph.\n`;
|
|
470
|
+
prompt += `- Self-check: walk the \`contracts\` entries and confirm that the URL, method, every parameter name,\n`;
|
|
471
|
+
prompt += ` response field, every key name, default, all enum values, and every field name appear in this\n`;
|
|
472
|
+
prompt += ` scenario's steps; add any missing one.\n`;
|
|
473
|
+
|
|
474
|
+
prompt += `\n## Scenario and step authoring rules\n\n${SCENARIO_AUTHORING_RULES}\n`;
|
|
270
475
|
|
|
271
476
|
prompt += `\n## Heartbeat command\n\n`;
|
|
272
477
|
prompt += `While working, report progress with \`node scripts/dispatch.mjs ${outDir} beat ${group.group_id} --token {{token}}\`.\n`;
|
|
273
478
|
|
|
274
479
|
prompt += `\n## Submit command and lock contention\n\n`;
|
|
275
|
-
prompt += `Submit as soon as the
|
|
480
|
+
prompt += `Submit as soon as the post-audit (step 11) passes; do not wait or do unrelated work first. If discovery, pre-audit or post-review is missing, submit rejects with \`Audit incomplete\`; write the missing artifact and submit again in the same attempt:\n`;
|
|
276
481
|
prompt += `\`node scripts/submit.mjs ${outDir} ${group.group_id} --token {{token}} --draft <draft.json>\`.\n`;
|
|
277
482
|
prompt += `If start, beat or submit hits \`ledger busy\`, make at most three attempts in total (the first\n`;
|
|
278
483
|
prompt += `one included), with bounded 50ms and 100ms backoff.\n`;
|
|
@@ -282,6 +487,176 @@ export function renderPrompt(group, units, pages, plan) {
|
|
|
282
487
|
return prompt;
|
|
283
488
|
}
|
|
284
489
|
|
|
490
|
+
/** Bind the claim identity to a prepared prompt without guessing an attempt. */
|
|
491
|
+
export function bindPrompt(prompt, { token, attempt } = {}) {
|
|
492
|
+
if (typeof prompt !== "string") throw new TypeError("bindPrompt: prompt must be a string");
|
|
493
|
+
if (typeof token !== "string" || token === "") throw new TypeError("bindPrompt: token is required");
|
|
494
|
+
if (!Number.isInteger(attempt) || attempt < 1) {
|
|
495
|
+
throw new TypeError("bindPrompt: attempt must be a positive integer");
|
|
496
|
+
}
|
|
497
|
+
return prompt
|
|
498
|
+
.replaceAll("{{token}}", token)
|
|
499
|
+
.replaceAll("{{attempt}}", String(attempt));
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
function writePreparedPlan({ outDir, builtPlan }) {
|
|
503
|
+
const planJsonPath = path.join(outDir, "plan.json");
|
|
504
|
+
writeJsonAtomic(planJsonPath, builtPlan);
|
|
505
|
+
console.log(`Plan written to: ${planJsonPath}`);
|
|
506
|
+
|
|
507
|
+
const state = fold(outDir);
|
|
508
|
+
if (state.plan_version !== builtPlan.plan_version) {
|
|
509
|
+
appendEvent(outDir, {
|
|
510
|
+
ev: "plan",
|
|
511
|
+
ledger_version: 2,
|
|
512
|
+
plan_version: builtPlan.plan_version,
|
|
513
|
+
groups: builtPlan.groups.map(g => ({
|
|
514
|
+
group_id: g.group_id,
|
|
515
|
+
kind: g.kind,
|
|
516
|
+
pages: g.pages,
|
|
517
|
+
spec_ids: g.spec_ids,
|
|
518
|
+
})),
|
|
519
|
+
});
|
|
520
|
+
console.log(`Ledger plan event appended (plan_version=${builtPlan.plan_version})`);
|
|
521
|
+
} else {
|
|
522
|
+
console.log(`Ledger already has plan_version=${builtPlan.plan_version}, skipping duplicate event`);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function writePreparedPrompts({ outDir, builtPlan, sourceProject }) {
|
|
527
|
+
const promptsDir = path.join(outDir, "prompts");
|
|
528
|
+
ensureDir(promptsDir);
|
|
529
|
+
const specUnits = builtPlan.spec_units || [];
|
|
530
|
+
const pagesMap = new Map((builtPlan.pages || []).map(p => [p.page_id, p]));
|
|
531
|
+
|
|
532
|
+
for (const group of (builtPlan.groups || [])) {
|
|
533
|
+
const groupUnits = specUnits.filter(u => u.dir === group.group_id);
|
|
534
|
+
const promptText = renderPrompt(group, groupUnits, pagesMap, {
|
|
535
|
+
outDir,
|
|
536
|
+
sourceProject,
|
|
537
|
+
failureReason: group.failure_reason || null,
|
|
538
|
+
});
|
|
539
|
+
const promptPath = path.join(promptsDir, `${group.group_id}.md`);
|
|
540
|
+
writeTextAtomic(promptPath, promptText);
|
|
541
|
+
console.log(`Generated prompt for group ${group.group_id}`);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function runPreparePipeline({
|
|
546
|
+
pages,
|
|
547
|
+
db,
|
|
548
|
+
sourceProject,
|
|
549
|
+
outDir,
|
|
550
|
+
index,
|
|
551
|
+
inputs,
|
|
552
|
+
params,
|
|
553
|
+
deps = {},
|
|
554
|
+
} = {}) {
|
|
555
|
+
const compute = deps.computeFootprint ?? computeFootprint;
|
|
556
|
+
const collect = deps.collectFacts ?? collectFacts;
|
|
557
|
+
const discoverEntries = deps.discoverEntryEvidence ?? discoverEntryEvidence;
|
|
558
|
+
const discoverOps = deps.discoverOperations ?? discoverOperations;
|
|
559
|
+
const scopeOps = deps.scopeFeatureOperations ?? scopeFeatureOperations;
|
|
560
|
+
const graphEvidenceFor = deps.createGraphEvidence ?? createGraphEvidence;
|
|
561
|
+
const enrich = deps.enrichBehaviorEvidence ?? enrichBehaviorEvidence;
|
|
562
|
+
const closeDb = deps.closeDb ?? (() => db.close());
|
|
563
|
+
const plan = deps.buildPlan ?? buildPlan;
|
|
564
|
+
const assertIdentity = deps.assertSamePlanVersion ?? assertSamePlanVersion;
|
|
565
|
+
const stop = deps.stopWaker ?? stopWaker;
|
|
566
|
+
const writeEvidence = deps.writeBehaviorEvidence ?? writeBehaviorEvidence;
|
|
567
|
+
const writeFactBase = deps.writeFacts ?? writeFacts;
|
|
568
|
+
const warn = deps.warn ?? console.warn;
|
|
569
|
+
|
|
570
|
+
// The read-only DB handle answers producers/callees directly (`dbProducers`,
|
|
571
|
+
// `dbCallees`, `dbCalls` in the evidence modules). Spawning `homegraph
|
|
572
|
+
// callers`/`callees` per symbol on top of that duplicates the same table read:
|
|
573
|
+
// on a real run it cost 278 spawns and ~524 s. Only fall back to the CLI when
|
|
574
|
+
// no usable DB handle was provided.
|
|
575
|
+
const usableDb = db !== null && db !== undefined && typeof db.prepare === "function";
|
|
576
|
+
const query = deps.query !== undefined
|
|
577
|
+
? deps.query
|
|
578
|
+
: usableDb
|
|
579
|
+
? null
|
|
580
|
+
: ((args) => queryHomeGraph({ sourceProject, ...args }));
|
|
581
|
+
let footprint;
|
|
582
|
+
let facts;
|
|
583
|
+
let entryEvidence;
|
|
584
|
+
let operations;
|
|
585
|
+
let graphEvidence;
|
|
586
|
+
let behaviors;
|
|
587
|
+
try {
|
|
588
|
+
footprint = compute({ pages, sourceProject, db });
|
|
589
|
+
facts = collect({ sourceProject });
|
|
590
|
+
entryEvidence = discoverEntries({ pages, db, sourceProject, query });
|
|
591
|
+
operations = discoverOps({
|
|
592
|
+
pages, entryEvidence, db, sourceProject, endpoints: facts.endpoints, query, facts, footprint,
|
|
593
|
+
});
|
|
594
|
+
// incremental SUP / CHG pages: operations outside this round's features become out-of-feature-scope (no-op otherwise)
|
|
595
|
+
scopeOps({ pages, operations, db });
|
|
596
|
+
graphEvidence = graphEvidenceFor({
|
|
597
|
+
index,
|
|
598
|
+
query: deps.graphQuery ?? [],
|
|
599
|
+
sourceUnits: deps.sourceUnits ?? [],
|
|
600
|
+
});
|
|
601
|
+
behaviors = enrich({
|
|
602
|
+
pages, footprint, sourceProject, entryEvidence, operations, graphEvidence, facts,
|
|
603
|
+
// Ownership is a graph question, so it is only enabled when the handle is
|
|
604
|
+
// usable; a fixture without one keeps the legacy "no ownership filter"
|
|
605
|
+
// behavior instead of silently dropping every non-body lifecycle signal.
|
|
606
|
+
resolveOwners: deps.resolveOwners !== undefined
|
|
607
|
+
? deps.resolveOwners
|
|
608
|
+
: usableDb
|
|
609
|
+
? buildPageOwnerIndex({ db, footprint }).ownersOf
|
|
610
|
+
: null,
|
|
611
|
+
});
|
|
612
|
+
for (const page of pages) page.behavior = behaviors.get(page.page_id);
|
|
613
|
+
} finally {
|
|
614
|
+
closeDb(db);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const builtPlan = plan({ pages, footprint, params, inputs });
|
|
618
|
+
builtPlan.index = index;
|
|
619
|
+
deps.configurePlan?.(builtPlan);
|
|
620
|
+
assertIdentity(outDir, builtPlan);
|
|
621
|
+
deps.ensureOutput?.(outDir, builtPlan);
|
|
622
|
+
stop(outDir, builtPlan.plan_version);
|
|
623
|
+
writeEvidence({ outDir, behaviors });
|
|
624
|
+
try {
|
|
625
|
+
writeFactBase({ outDir, facts });
|
|
626
|
+
} catch (err) {
|
|
627
|
+
// Facts are an aid, not the evidence of record. Serialization and disk
|
|
628
|
+
// failures degrade that aid without sacrificing the prepared run.
|
|
629
|
+
warn(`Warning: could not build facts/ (${err.message}); drafts will rely on source.`);
|
|
630
|
+
}
|
|
631
|
+
deps.writePlan?.(builtPlan);
|
|
632
|
+
deps.writePrompts?.(builtPlan);
|
|
633
|
+
|
|
634
|
+
return { builtPlan, behaviors, facts, entryEvidence, operations, graphEvidence };
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Applies an incremental scope to the buildPages() inventory (null = whole app, returned unchanged).
|
|
639
|
+
*
|
|
640
|
+
* Scoped, the run-level unknowns (unclassified nodes, orphan overlays) are dropped from the plan: they belong
|
|
641
|
+
* to the whole graph, and counting them would mark every scoped SPEC set incomplete over surfaces outside the
|
|
642
|
+
* scope. Their counts stay visible in `plan.scope.dropped_unknowns`.
|
|
643
|
+
*/
|
|
644
|
+
export function scopeInventory(inventory, scopeIds, scopeId = null) {
|
|
645
|
+
const { pages, unclassified = [], orphanOverlays = [] } = inventory;
|
|
646
|
+
if (scopeIds === null || scopeIds === undefined) return { pages, unclassified, orphanOverlays, scope: null };
|
|
647
|
+
const { pages: kept, scope } = applyScope(pages, scopeIds, scopeId);
|
|
648
|
+
return {
|
|
649
|
+
pages: kept,
|
|
650
|
+
unclassified: [],
|
|
651
|
+
orphanOverlays: [],
|
|
652
|
+
scope: {
|
|
653
|
+
...scope,
|
|
654
|
+
pages_total: pages.length,
|
|
655
|
+
dropped_unknowns: { unclassified: unclassified.length, orphan_overlays: orphanOverlays.length },
|
|
656
|
+
},
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
285
660
|
/**
|
|
286
661
|
* CLI entry point.
|
|
287
662
|
*/
|
|
@@ -289,7 +664,7 @@ async function main() {
|
|
|
289
664
|
const args = process.argv.slice(2);
|
|
290
665
|
|
|
291
666
|
if (args.length < 3) {
|
|
292
|
-
console.error("Usage: node scripts/prepare.mjs <source> <utg-workspace> <hmos> [--
|
|
667
|
+
console.error("Usage: node scripts/prepare.mjs <source> <utg-workspace> <hmos> [--concurrency 8] [--out <dir>] [--design-dir <dir>] [--engine-mode <auto|off|required>] [--scope <scope.json>] [--carry-from <previous output>]");
|
|
293
668
|
process.exit(1);
|
|
294
669
|
}
|
|
295
670
|
|
|
@@ -298,18 +673,22 @@ async function main() {
|
|
|
298
673
|
const hmos = path.resolve(args[2]);
|
|
299
674
|
|
|
300
675
|
let outDir = null;
|
|
301
|
-
let chunkBudget = 32;
|
|
302
676
|
let concurrency = 8;
|
|
303
677
|
let designDir = null;
|
|
304
678
|
let engineMode = null;
|
|
679
|
+
let scopeFile = null;
|
|
680
|
+
let carryFrom = null;
|
|
305
681
|
|
|
306
682
|
// Parse optional flags
|
|
307
683
|
for (let i = 3; i < args.length; i++) {
|
|
308
|
-
if (args[i] === "--
|
|
309
|
-
|
|
684
|
+
if (args[i] === "--carry-from" && i + 1 < args.length) {
|
|
685
|
+
carryFrom = path.resolve(args[i + 1]);
|
|
310
686
|
i++;
|
|
311
|
-
} else if (args[i] === "--
|
|
312
|
-
|
|
687
|
+
} else if (args[i] === "--scope" && i + 1 < args.length) {
|
|
688
|
+
scopeFile = path.resolve(args[i + 1]);
|
|
689
|
+
i++;
|
|
690
|
+
} else if (args[i] === "--out" && i + 1 < args.length) {
|
|
691
|
+
outDir = path.resolve(args[i + 1]);
|
|
313
692
|
i++;
|
|
314
693
|
} else if (args[i] === "--concurrency" && i + 1 < args.length) {
|
|
315
694
|
concurrency = parseInt(args[i + 1], 10);
|
|
@@ -323,6 +702,19 @@ async function main() {
|
|
|
323
702
|
}
|
|
324
703
|
}
|
|
325
704
|
|
|
705
|
+
// Read the scope before any index or planning work: a bad scope file fails in seconds, not after indexing.
|
|
706
|
+
let scopeIds = null;
|
|
707
|
+
let declaredScopeId = null;
|
|
708
|
+
let scopeDocV2 = null;
|
|
709
|
+
if (scopeFile !== null) {
|
|
710
|
+
try {
|
|
711
|
+
({ ids: scopeIds, scopeId: declaredScopeId, doc: scopeDocV2 } = readScopeDoc(scopeFile));
|
|
712
|
+
} catch (err) {
|
|
713
|
+
console.error(err.message);
|
|
714
|
+
process.exit(1);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
|
|
326
718
|
// Derive output directory if not specified
|
|
327
719
|
if (!outDir) {
|
|
328
720
|
const caseIdSlug = slugify(path.basename(hmos));
|
|
@@ -331,7 +723,6 @@ async function main() {
|
|
|
331
723
|
}
|
|
332
724
|
|
|
333
725
|
preflightOutput(outDir);
|
|
334
|
-
ensureDir(outDir);
|
|
335
726
|
|
|
336
727
|
// Get utg.json mtime
|
|
337
728
|
const utgJsonPath = path.join(utgWorkspace, "utg.json");
|
|
@@ -386,10 +777,20 @@ async function main() {
|
|
|
386
777
|
const graph = loadUtg(utgWorkspace);
|
|
387
778
|
|
|
388
779
|
console.log("Building page inventory...");
|
|
389
|
-
const
|
|
780
|
+
const inventory = buildPages({
|
|
390
781
|
nodes: graph.nodes,
|
|
391
782
|
links: graph.links,
|
|
392
783
|
});
|
|
784
|
+
const { pages, unclassified, orphanOverlays, scope } = scopeInventory(inventory, scopeIds, declaredScopeId);
|
|
785
|
+
// feature scope: a page that already exists gets only this round's features (prompt + plan.json carry them)
|
|
786
|
+
const featureByPage = featureScopeByPage(scopeDocV2);
|
|
787
|
+
for (const page of pages) {
|
|
788
|
+
if (featureByPage.has(page.page_id)) page.feature_scope = featureByPage.get(page.page_id);
|
|
789
|
+
}
|
|
790
|
+
if (scope) {
|
|
791
|
+
console.log(`Scope ${scope.scope_id}: ${scope.pages.length} page(s) of ${inventory.pages.length}`
|
|
792
|
+
+ (scope.unmatched.length ? `; unmatched node id(s): ${scope.unmatched.join(", ")}` : ""));
|
|
793
|
+
}
|
|
393
794
|
|
|
394
795
|
// evidence slicing: record the navigation evidence on every page that has a click path.
|
|
395
796
|
// `click_paths.json` is optional evidence — a workspace without it
|
|
@@ -399,106 +800,63 @@ async function main() {
|
|
|
399
800
|
const clickPaths = loadClickPaths(utgWorkspace);
|
|
400
801
|
attachReach(pages, clickPaths.paths);
|
|
401
802
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
footprint = computeFootprint({ pages, sourceProject, db });
|
|
407
|
-
} finally {
|
|
408
|
-
db.close();
|
|
803
|
+
const navigationGuardGap = detectNavigationGuardGap(pages, hmos);
|
|
804
|
+
if (navigationGuardGap) {
|
|
805
|
+
console.warn(`Warning: ${navigationGuardGap.doc} documents navigation interception ("${navigationGuardGap.excerpt}") `
|
|
806
|
+
+ "but the UTG records no guard or interceptor: published with a gap (navigation-guards-absent)");
|
|
409
807
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
const
|
|
808
|
+
console.log("Computing footprint and discovering evidence...");
|
|
809
|
+
const db = openReadOnly(sourceProject);
|
|
810
|
+
const inputs = {
|
|
811
|
+
sourceProject,
|
|
812
|
+
pageEnumeration: graph.meta?.denominator ?? null,
|
|
813
|
+
unclassified,
|
|
814
|
+
orphanOverlays,
|
|
815
|
+
...(navigationGuardGap ? { navigationGuardGap } : {}),
|
|
816
|
+
};
|
|
817
|
+
const { facts } = runPreparePipeline({
|
|
413
818
|
pages,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
819
|
+
db,
|
|
820
|
+
sourceProject,
|
|
821
|
+
outDir,
|
|
822
|
+
index: planIndex,
|
|
823
|
+
inputs,
|
|
824
|
+
params: { concurrency, contractsPerGroup: 8, maxPages: 12 },
|
|
825
|
+
deps: {
|
|
826
|
+
configurePlan: (plan) => {
|
|
827
|
+
if (scope) {
|
|
828
|
+
// no-UI units are covered only through a g00 shared unit of a scoped page (sharedIdOf names it shared:<stem>);
|
|
829
|
+
// an uncovered one is published as a hole, never dropped
|
|
830
|
+
const unitIds = new Set((plan.spec_units ?? []).map((u) => u.spec_id));
|
|
831
|
+
const logic = logicUnits(scopeDocV2).map((unit) => ({ unit, covered: unitIds.has(unit) }));
|
|
832
|
+
plan.scope = { ...scope, ...(logic.length ? { logic } : {}) };
|
|
833
|
+
}
|
|
834
|
+
if (designDir !== null) plan.design_dir = designDir;
|
|
835
|
+
if (engineMode !== null) plan.engine_mode = engineMode;
|
|
836
|
+
},
|
|
837
|
+
ensureOutput: (dir) => ensureDir(dir),
|
|
838
|
+
writePlan: (plan) => {
|
|
839
|
+
writePreparedPlan({ outDir, builtPlan: plan });
|
|
840
|
+
// M10: carry runs after the plan ledger event, so the carried groups exist in this run's ledger
|
|
841
|
+
if (carryFrom !== null && path.resolve(carryFrom) !== path.resolve(outDir)) {
|
|
842
|
+
const carried = carryForward(outDir, plan, carryFrom);
|
|
843
|
+
console.log(`Carried ${carried.length} unchanged group(s) from ${carryFrom}${carried.length ? `: ${carried.join(", ")}` : ""}`);
|
|
844
|
+
}
|
|
845
|
+
},
|
|
846
|
+
writePrompts: (plan) => writePreparedPrompts({ outDir, builtPlan: plan, sourceProject }),
|
|
421
847
|
},
|
|
422
848
|
});
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (designDir !== null) builtPlan.design_dir = designDir;
|
|
427
|
-
if (engineMode !== null) builtPlan.engine_mode = engineMode;
|
|
428
|
-
|
|
429
|
-
// Planning and index work may be expensive. Recheck that no concurrent or stale
|
|
430
|
-
// output changed identity before the first facts/plan/prompt/waker mutation.
|
|
431
|
-
assertSamePlanVersion(outDir, builtPlan);
|
|
432
|
-
stopWaker(outDir, builtPlan.plan_version);
|
|
433
|
-
|
|
434
|
-
// Build the fact base before dispatch. `prepare.mjs` is the single writer of the output tree.
|
|
435
|
-
if (typeof buildFacts === "function") {
|
|
436
|
-
try {
|
|
437
|
-
buildFacts({ sourceProject, outDir });
|
|
438
|
-
console.log(`Facts built at: ${path.join(outDir, "facts")}`);
|
|
439
|
-
} catch (err) {
|
|
440
|
-
// A fact base is an AID, not the evidence of record: the prompt now also points at
|
|
441
|
-
// <source-project>, so a drafting agent can still read the source. Failing the whole run
|
|
442
|
-
// over it would trade a degraded aid for no run at all.
|
|
443
|
-
console.warn(`Warning: could not build facts/ (${err.message}); drafts will rely on source.`);
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
// Write plan.json
|
|
448
|
-
const planJsonPath = path.join(outDir, "plan.json");
|
|
449
|
-
writeJsonAtomic(planJsonPath, builtPlan);
|
|
450
|
-
console.log(`Plan written to: ${planJsonPath}`);
|
|
451
|
-
|
|
452
|
-
// Append plan ledger event idempotently — only if plan_version differs from what's already in the ledger.
|
|
453
|
-
// Include full group objects with pages so the ledger can track expectedPages per group
|
|
454
|
-
// (required for the SUBMITTED state transition in submit.mjs).
|
|
455
|
-
const state = fold(outDir);
|
|
456
|
-
if (state.plan_version !== builtPlan.plan_version) {
|
|
457
|
-
appendEvent(outDir, {
|
|
458
|
-
ev: "plan",
|
|
459
|
-
ledger_version: 2,
|
|
460
|
-
plan_version: builtPlan.plan_version,
|
|
461
|
-
groups: builtPlan.groups.map(g => ({
|
|
462
|
-
group_id: g.group_id,
|
|
463
|
-
kind: g.kind,
|
|
464
|
-
pages: g.pages,
|
|
465
|
-
spec_ids: g.spec_ids,
|
|
466
|
-
})),
|
|
467
|
-
});
|
|
468
|
-
console.log(`Ledger plan event appended (plan_version=${builtPlan.plan_version})`);
|
|
469
|
-
} else {
|
|
470
|
-
console.log(`Ledger already has plan_version=${builtPlan.plan_version}, skipping duplicate event`);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// Generate prompts for each group
|
|
474
|
-
const promptsDir = path.join(outDir, "prompts");
|
|
475
|
-
ensureDir(promptsDir);
|
|
476
|
-
|
|
477
|
-
const specUnits = builtPlan.spec_units || [];
|
|
478
|
-
const pagesMap = new Map((builtPlan.pages || []).map(p => [p.page_id, p]));
|
|
479
|
-
|
|
480
|
-
for (const group of (builtPlan.groups || [])) {
|
|
481
|
-
// filter spec_units on the `dir` field (not group_id — units have no group_id field)
|
|
482
|
-
const groupUnits = specUnits.filter(u => u.dir === group.group_id);
|
|
483
|
-
const promptText = renderPrompt(group, groupUnits, pagesMap, {
|
|
484
|
-
outDir,
|
|
485
|
-
sourceProject,
|
|
486
|
-
failureReason: group.failure_reason || null,
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
const promptPath = path.join(promptsDir, `${group.group_id}.md`);
|
|
490
|
-
writeTextAtomic(promptPath, promptText);
|
|
491
|
-
console.log(`Generated prompt for group ${group.group_id}`);
|
|
849
|
+
console.log(`Facts built at: ${path.join(outDir, "facts")}`);
|
|
850
|
+
if (facts.unknowns.length > 0) {
|
|
851
|
+
console.warn("Warning: some facts are partial; affected drafts will rely on source evidence.");
|
|
492
852
|
}
|
|
493
853
|
|
|
494
854
|
console.log("Preparation complete.");
|
|
495
855
|
console.log(`Output directory: ${outDir}`);
|
|
496
856
|
}
|
|
497
857
|
|
|
498
|
-
//
|
|
499
|
-
|
|
500
|
-
const _argv1 = process.argv[1];
|
|
501
|
-
if (_argv1 !== undefined && modulePath === path.resolve(_argv1)) {
|
|
858
|
+
// main guard: compares real paths so a symlinked/junctioned install still runs
|
|
859
|
+
if (isMainModule(import.meta.url)) {
|
|
502
860
|
main().catch((err) => {
|
|
503
861
|
console.error(err);
|
|
504
862
|
process.exit(1);
|