bpmax-cli 0.1.43 → 0.1.44-beta.0

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.
Files changed (251) hide show
  1. package/README.md +3 -3
  2. package/dist/bin.js +3372 -453
  3. package/dist/bin.js.map +1 -1
  4. package/package.json +1 -1
  5. package/skills/bpmax-api-platform-editor/SKILL.md +321 -0
  6. package/skills/bpmax-api-platform-editor/agents/openai.yaml +4 -0
  7. package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +34 -0
  8. package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +41 -0
  9. package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +41 -0
  10. package/skills/bpmax-api-platform-editor/references/platform-api-map.md +52 -0
  11. package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +32 -0
  12. package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +1276 -0
  13. package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +64 -0
  14. package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +40 -0
  15. package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +212 -0
  16. package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +62 -0
  17. package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +75 -0
  18. package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +287 -0
  19. package/skills/bpmax-auth/SKILL.md +6 -17
  20. package/skills/bpmax-builder-shared/SKILL.md +44 -0
  21. package/skills/bpmax-builder-shared/base_url.py +81 -0
  22. package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +71 -0
  23. package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +34 -0
  24. package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +123 -0
  25. package/skills/bpmax-builder-shared/runtime_script_rules.py +272 -0
  26. package/skills/bpmax-builder-shared/skill_audit.py +374 -0
  27. package/skills/bpmax-builder-shared/template_script_hard_rules.py +280 -0
  28. package/skills/bpmax-builder-shared/tests/test_base_url.py +80 -0
  29. package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +115 -0
  30. package/skills/bpmax-builder-shared/tests/test_skill_audit.py +231 -0
  31. package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +281 -0
  32. package/skills/bpmax-cli/SKILL.md +2 -0
  33. package/skills/bpmax-config-latest/SKILL.md +71 -0
  34. package/skills/bpmax-console-template-editor/SKILL.md +536 -0
  35. package/skills/bpmax-console-template-editor/agents/openai.yaml +4 -0
  36. package/skills/bpmax-console-template-editor/references/filter-integration.md +60 -0
  37. package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +114 -0
  38. package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +69 -0
  39. package/skills/bpmax-console-template-editor/references/module-catalog.md +100 -0
  40. package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +91 -0
  41. package/skills/bpmax-console-template-editor/references/template-shape.md +149 -0
  42. package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +38 -0
  43. package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +33 -0
  44. package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +964 -0
  45. package/skills/bpmax-console-template-editor/scripts/export_console_template.py +99 -0
  46. package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +46 -0
  47. package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +99 -0
  48. package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +383 -0
  49. package/skills/bpmax-dataset-field-template-editor/SKILL.md +600 -0
  50. package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +25 -0
  51. package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +35 -0
  52. package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +24 -0
  53. package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +61 -0
  54. package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +27 -0
  55. package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +127 -0
  56. package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +67 -0
  57. package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +37 -0
  58. package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +784 -0
  59. package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +62 -0
  60. package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +104 -0
  61. package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +83 -0
  62. package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +35 -0
  63. package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +95 -0
  64. package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +709 -0
  65. package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +59 -0
  66. package/skills/bpmax-dataset-template-editor/SKILL.md +779 -0
  67. package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +18 -0
  68. package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +73 -0
  69. package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +186 -0
  70. package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +106 -0
  71. package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +28 -0
  72. package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +47 -0
  73. package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +23 -0
  74. package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +97 -0
  75. package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +65 -0
  76. package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +38 -0
  77. package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +650 -0
  78. package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +155 -0
  79. package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +42 -0
  80. package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +43 -0
  81. package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +27 -0
  82. package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +115 -0
  83. package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +52 -0
  84. package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +39 -0
  85. package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +373 -0
  86. package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +151 -0
  87. package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +4 -0
  88. package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +60 -0
  89. package/skills/bpmax-e2e-flow-test-operator/SKILL.md +371 -0
  90. package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +5 -0
  91. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +97 -0
  92. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +105 -0
  93. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +36 -0
  94. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +40 -0
  95. package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +33 -0
  96. package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +17 -0
  97. package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +40 -0
  98. package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +19 -0
  99. package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +75 -0
  100. package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +107 -0
  101. package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +29 -0
  102. package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +54 -0
  103. package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +58 -0
  104. package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +287 -0
  105. package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +59 -0
  106. package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +687 -0
  107. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +95 -0
  108. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +288 -0
  109. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +161 -0
  110. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +138 -0
  111. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +396 -0
  112. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +341 -0
  113. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +185 -0
  114. package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +138 -0
  115. package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +69 -0
  116. package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +4 -0
  117. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +42 -0
  118. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +38 -0
  119. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +86 -0
  120. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +68 -0
  121. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +39 -0
  122. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +41 -0
  123. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +110 -0
  124. package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +278 -0
  125. package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +203 -0
  126. package/skills/bpmax-filter-template-editor/SKILL.md +564 -0
  127. package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +38 -0
  128. package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +57 -0
  129. package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +141 -0
  130. package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +287 -0
  131. package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +115 -0
  132. package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +94 -0
  133. package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +25 -0
  134. package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +22 -0
  135. package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +57 -0
  136. package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +348 -0
  137. package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +8 -0
  138. package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +26 -0
  139. package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +62 -0
  140. package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +231 -0
  141. package/skills/bpmax-flow-template-editor/SKILL.md +1043 -0
  142. package/skills/bpmax-flow-template-editor/agents/openai.yaml +4 -0
  143. package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +62 -0
  144. package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +270 -0
  145. package/skills/bpmax-flow-template-editor/references/diff-strategy.md +67 -0
  146. package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +25 -0
  147. package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +159 -0
  148. package/skills/bpmax-flow-template-editor/references/intent-model.md +117 -0
  149. package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +147 -0
  150. package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +97 -0
  151. package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +163 -0
  152. package/skills/bpmax-flow-template-editor/references/payload-checklist.md +133 -0
  153. package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +54 -0
  154. package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +149 -0
  155. package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +41 -0
  156. package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +155 -0
  157. package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +179 -0
  158. package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +91 -0
  159. package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +93 -0
  160. package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +57 -0
  161. package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +69 -0
  162. package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +52 -0
  163. package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +114 -0
  164. package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +1084 -0
  165. package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +159 -0
  166. package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +636 -0
  167. package/skills/bpmax-form-template-editor/SKILL.md +1074 -0
  168. package/skills/bpmax-form-template-editor/agents/openai.yaml +4 -0
  169. package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +193 -0
  170. package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +125 -0
  171. package/skills/bpmax-form-template-editor/references/payload-checklist.md +77 -0
  172. package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +49 -0
  173. package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +37 -0
  174. package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +145 -0
  175. package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +67 -0
  176. package/skills/bpmax-form-template-editor/scripts/export_form_template.py +89 -0
  177. package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +1745 -0
  178. package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +30 -0
  179. package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +67 -0
  180. package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +163 -0
  181. package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +1303 -0
  182. package/skills/bpmax-list-template-editor/SKILL.md +468 -0
  183. package/skills/bpmax-list-template-editor/agents/openai.yaml +4 -0
  184. package/skills/bpmax-list-template-editor/references/browser-page-contract.md +81 -0
  185. package/skills/bpmax-list-template-editor/references/content-config-shape.md +148 -0
  186. package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +60 -0
  187. package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +103 -0
  188. package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +102 -0
  189. package/skills/bpmax-list-template-editor/references/payload-checklist.md +47 -0
  190. package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +140 -0
  191. package/skills/bpmax-list-template-editor/references/special-formats.md +394 -0
  192. package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +37 -0
  193. package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +33 -0
  194. package/skills/bpmax-list-template-editor/scripts/export_list_template.py +89 -0
  195. package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +34 -0
  196. package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +54 -0
  197. package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +955 -0
  198. package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +55 -0
  199. package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +117 -0
  200. package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +441 -0
  201. package/skills/bpmax-nav-config-editor/SKILL.md +347 -0
  202. package/skills/bpmax-nav-config-editor/agents/openai.yaml +4 -0
  203. package/skills/bpmax-nav-config-editor/references/api-workflow.md +68 -0
  204. package/skills/bpmax-nav-config-editor/references/config-shape.md +78 -0
  205. package/skills/bpmax-nav-config-editor/references/icon-selection.md +83 -0
  206. package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +46 -0
  207. package/skills/bpmax-nav-config-editor/references/payload-checklist.md +41 -0
  208. package/skills/bpmax-nav-config-editor/references/runtime-probing.md +47 -0
  209. package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +34 -0
  210. package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +32 -0
  211. package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +56 -0
  212. package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +33 -0
  213. package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +812 -0
  214. package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +44 -0
  215. package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +33 -0
  216. package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +358 -0
  217. package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +138 -0
  218. package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +58 -0
  219. package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +51 -0
  220. package/skills/bpmax-project/SKILL.md +1 -1
  221. package/skills/bpmax-project-detail-template-editor/SKILL.md +329 -0
  222. package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +4 -0
  223. package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +59 -0
  224. package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +47 -0
  225. package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +33 -0
  226. package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +44 -0
  227. package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +30 -0
  228. package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +33 -0
  229. package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +87 -0
  230. package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +37 -0
  231. package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +507 -0
  232. package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +120 -0
  233. package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +369 -0
  234. package/skills/bpmax-role-editor/SKILL.md +251 -0
  235. package/skills/bpmax-role-editor/references/api-workflow.md +30 -0
  236. package/skills/bpmax-role-editor/references/runtime-page-shape.md +18 -0
  237. package/skills/bpmax-role-editor/references/work-file-mapping.md +32 -0
  238. package/skills/bpmax-role-editor/scripts/build_submit_payload.py +38 -0
  239. package/skills/bpmax-role-editor/scripts/confirm_role.py +33 -0
  240. package/skills/bpmax-role-editor/scripts/export_role.py +163 -0
  241. package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +38 -0
  242. package/skills/bpmax-role-editor/scripts/role_editor_common.py +1231 -0
  243. package/skills/bpmax-role-editor/scripts/submit_role.py +144 -0
  244. package/skills/bpmax-role-editor/tests/test_role_editor.py +343 -0
  245. package/skills/bpmax-shared/SKILL.md +1 -1
  246. package/skills/form-control-library/SKILL.md +82 -0
  247. package/skills/form-control-library/agents/openai.yaml +4 -0
  248. package/skills/form-control-library/references/form-controls.md +199 -0
  249. package/skills/form-control-library/references/form-template-submit-schema.md +180 -0
  250. package/skills/form-control-library/references/group-select-runtime.md +191 -0
  251. package/skills/form-control-library/scripts/rebuild_form_control_library.py +55 -0
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import sys
5
+
6
+ print(
7
+ "Legacy config submit scripts are disabled in bpmax-cli. Use `bpmax-cli config nav-config submit` so capability, dry-run, confirmation, audit, and baseline checks are enforced.",
8
+ file=sys.stderr,
9
+ )
10
+ sys.exit(2)
11
+
12
+ import argparse
13
+
14
+ from nav_config_editor_common import build_client, build_submission_plan, dump_json, ensure_submission_allowed, load_json, paths_for
15
+
16
+
17
+ def main() -> int:
18
+ parser = argparse.ArgumentParser(description="Submit BPMAX nav configuration payloads.")
19
+ parser.add_argument("--stem", required=True)
20
+ parser.add_argument("--workspace")
21
+ parser.add_argument("--base-url")
22
+ parser.add_argument("--language", default="zhCN")
23
+ parser.add_argument("--cookie-header")
24
+ parser.add_argument("--timeout", type=float, default=30)
25
+ parser.add_argument("--insecure", action="store_true")
26
+ args = parser.parse_args()
27
+
28
+ paths = paths_for(args.stem)
29
+ submit_payload = load_json(paths["submit"])
30
+ ensure_submission_allowed(paths["meta"], paths["work"], paths["submit"], paths["lint"])
31
+ client = build_client(args)
32
+ responses: dict[str, object] = {}
33
+ for step in build_submission_plan(submit_payload):
34
+ if step["method"] == "PUT":
35
+ responses[step["type"]] = client.update_configuration(step["id"], step["payload"])
36
+ else:
37
+ responses[step["type"]] = client.create_configuration(step["payload"])
38
+ dump_json(paths["response"], responses)
39
+ print(paths["response"])
40
+ return 0
41
+
42
+
43
+ if __name__ == "__main__":
44
+ raise SystemExit(main())
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import argparse
5
+
6
+ from nav_config_editor_common import CONFIG_TYPES, build_client, dump_json, load_json, paths_for, summarize_verification
7
+
8
+
9
+ def main() -> int:
10
+ parser = argparse.ArgumentParser(description="Verify readback for BPMAX nav configuration payloads.")
11
+ parser.add_argument("--stem", required=True)
12
+ parser.add_argument("--workspace")
13
+ parser.add_argument("--base-url")
14
+ parser.add_argument("--language", default="zhCN")
15
+ parser.add_argument("--cookie-header")
16
+ parser.add_argument("--timeout", type=float, default=30)
17
+ parser.add_argument("--insecure", action="store_true")
18
+ args = parser.parse_args()
19
+
20
+ paths = paths_for(args.stem)
21
+ submit_payload = load_json(paths["submit"])
22
+ client = build_client(args)
23
+ readback = {config_type: client.read_configuration(config_type) for config_type in CONFIG_TYPES}
24
+ verify = summarize_verification(submit_payload, readback, language=client.language)
25
+ dump_json(paths["readback"], readback)
26
+ dump_json(paths["verify"], verify)
27
+ print(paths["readback"])
28
+ print(paths["verify"])
29
+ return 0 if verify.get("ok") else 1
30
+
31
+
32
+ if __name__ == "__main__":
33
+ raise SystemExit(main())
@@ -0,0 +1,358 @@
1
+ import copy
2
+ import hashlib
3
+ import json
4
+ import os
5
+ import sys
6
+ import tempfile
7
+ import unittest
8
+ from pathlib import Path
9
+ from unittest import mock
10
+
11
+
12
+ SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
13
+ if str(SCRIPT_DIR) not in sys.path:
14
+ sys.path.insert(0, str(SCRIPT_DIR))
15
+
16
+ import nav_config_editor_common as nav_common # noqa: E402
17
+
18
+
19
+ def make_raw_bundle() -> dict:
20
+ return {
21
+ "workspace": "store_mgr",
22
+ "baseUrl": "https://bpmax.example.com",
23
+ "language": "zhCN",
24
+ "requestUrls": {},
25
+ "configs": {
26
+ "navmenu": {
27
+ "id": 101,
28
+ "guid": "guid-navmenu",
29
+ "type": "navmenu",
30
+ "name": "工作区导航",
31
+ "content": {
32
+ "navConfig": [
33
+ {
34
+ "id": "pc-root",
35
+ "name": "库存",
36
+ "icon": "ri ri_archive-stack-line",
37
+ "permission": "",
38
+ "path": "/",
39
+ "color": "",
40
+ "sub": [
41
+ {
42
+ "id": "pc-child",
43
+ "name": "物料库存",
44
+ "icon": "ri ri_archive-stack-line",
45
+ "permission": "ALL",
46
+ "path": "/project?flow_type=flow956693507",
47
+ "color": "",
48
+ "sub": [],
49
+ "permissionType": "PERMISSION_POINT",
50
+ "visibility": "public",
51
+ "visibility_scope": "",
52
+ }
53
+ ],
54
+ "permissionType": "PERMISSION_POINT",
55
+ "visibility": "public",
56
+ "visibility_scope": "",
57
+ }
58
+ ],
59
+ "enableMultiLevel": False,
60
+ },
61
+ },
62
+ "shortcut": {
63
+ "id": 102,
64
+ "guid": "guid-shortcut",
65
+ "type": "shortcut",
66
+ "name": "快捷入口",
67
+ "content": {
68
+ "shortcutConfig": [
69
+ {
70
+ "id": "pc-shortcut",
71
+ "name": "换货下发",
72
+ "icon": "ri ri_exchange-box-line",
73
+ "permission": "",
74
+ "path": "/project?flow_type=flow579647382",
75
+ "color": "",
76
+ "sub": [],
77
+ "permissionType": "PERMISSION_POINT",
78
+ "visibility": "public",
79
+ "visibility_scope": "",
80
+ }
81
+ ],
82
+ "enableMultiLevel": False,
83
+ },
84
+ },
85
+ "navmenu_mobile": {
86
+ "id": 103,
87
+ "guid": "guid-nav-mobile",
88
+ "type": "navmenu_mobile",
89
+ "name": "H5导航",
90
+ "content": {
91
+ "navMobileConfig": [
92
+ {
93
+ "id": "h5-item",
94
+ "name": "扫码入库",
95
+ "icon": "ri ri_qr-scan-2-line",
96
+ "permission": "kucun",
97
+ "path": "/pages/index/project?flow_type=flow816069530",
98
+ "color": "#14B8A6",
99
+ "sub": [],
100
+ "permissionType": "PERMISSION_POINT",
101
+ "visibility": "public",
102
+ "visibility_scope": "",
103
+ }
104
+ ],
105
+ "enableMultiLevel": False,
106
+ },
107
+ },
108
+ "shortcut_mobile": {
109
+ "id": None,
110
+ "guid": None,
111
+ "type": "shortcut_mobile",
112
+ "name": "H5快捷入口",
113
+ "content": {
114
+ "shortcutMobileConfig": [
115
+ {
116
+ "id": "h5-shortcut",
117
+ "name": "换货下发",
118
+ "icon": "ri ri_exchange-box-line",
119
+ "permission": "",
120
+ "path": "/pages/index/project?flow_type=flow579647382",
121
+ "color": "#F59E0B",
122
+ "sub": [],
123
+ "permissionType": "PERMISSION_POINT",
124
+ "visibility": "public",
125
+ "visibility_scope": "",
126
+ }
127
+ ],
128
+ "enableMultiLevel": False,
129
+ },
130
+ },
131
+ },
132
+ }
133
+
134
+
135
+ class NavConfigEditorTests(unittest.TestCase):
136
+ def test_bundle_to_work_payload_preserves_enable_multi_level(self) -> None:
137
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
138
+ self.assertEqual(work["workspace"], "store_mgr")
139
+ self.assertFalse(work["configs"]["navmenu"]["enableMultiLevel"])
140
+ self.assertEqual(work["configs"]["shortcut_mobile"]["id"], None)
141
+
142
+ def test_build_submit_payload_keeps_post_and_put_split(self) -> None:
143
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
144
+ submit = nav_common.build_submit_payload(work)
145
+ operations = {item["type"]: item for item in submit["operations"]}
146
+ self.assertEqual(operations["navmenu"]["method"], "PUT")
147
+ self.assertEqual(operations["shortcut_mobile"]["method"], "POST")
148
+ self.assertIn("is_default_action=1", operations["navmenu"]["path"])
149
+
150
+ def test_default_base_url_is_empty_until_runtime_configured(self) -> None:
151
+ self.assertEqual(nav_common.DEFAULT_BASE_URL, "")
152
+
153
+ def test_build_client_uses_environment_origin_with_api_prefix(self) -> None:
154
+ args = type(
155
+ "Args",
156
+ (),
157
+ {
158
+ "base_url": None,
159
+ "workspace": "store_mgr",
160
+ "language": "zhCN",
161
+ "cookie_header": "token=demo",
162
+ "timeout": 30,
163
+ "insecure": False,
164
+ },
165
+ )()
166
+ with mock.patch.dict(os.environ, {"BPMAX_BASE_URL": "https://bpmax.example.com/"}, clear=False):
167
+ client = nav_common.build_client(args)
168
+ self.assertEqual(
169
+ client._build_url("/configuration?q_type=navmenu&page=1"),
170
+ "https://bpmax.example.com/api/configuration?q_type=navmenu&page=1&$workspace=store_mgr&$language=zhCN",
171
+ )
172
+
173
+ def test_resolve_runtime_base_url_falls_back_to_agents_default(self) -> None:
174
+ with tempfile.TemporaryDirectory() as tmpdir:
175
+ agents_path = Path(tmpdir) / "AGENTS.md"
176
+ agents_path.write_text("BPMAX_DEFAULT_ORIGIN: https://repo-default.example.com\n", encoding="utf-8")
177
+ with mock.patch.object(nav_common, "AGENTS_PATH", agents_path):
178
+ with mock.patch.dict(os.environ, {}, clear=True):
179
+ resolved = nav_common.resolve_runtime_base_url(None, env={})
180
+ self.assertEqual(resolved, "https://repo-default.example.com")
181
+
182
+ def test_build_requires_work_confirmation(self) -> None:
183
+ with tempfile.TemporaryDirectory() as tmpdir:
184
+ root = Path(tmpdir)
185
+ meta_path = root / "meta.json"
186
+ work_path = root / "work.json"
187
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
188
+ work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
189
+ meta_path.write_text(
190
+ json.dumps({"stem": "nav-store_mgr", "status": "exported", "workSha256": "old"}, ensure_ascii=False),
191
+ encoding="utf-8",
192
+ )
193
+ with self.assertRaises(SystemExit):
194
+ nav_common.ensure_build_allowed(meta_path, work_path)
195
+
196
+ def test_submit_requires_submit_confirmation(self) -> None:
197
+ with tempfile.TemporaryDirectory() as tmpdir:
198
+ root = Path(tmpdir)
199
+ raw_path = root / "raw.json"
200
+ work_path = root / "work.json"
201
+ submit_path = root / "submit.json"
202
+ lint_path = root / "lint.json"
203
+ meta_path = root / "meta.json"
204
+ raw = make_raw_bundle()
205
+ work = nav_common.bundle_to_work_payload(raw)
206
+ submit = nav_common.build_submit_payload(work)
207
+ lint = nav_common.lint_nav_config_semantics(work, raw_payload=raw, submit_payload=submit)
208
+ raw_path.write_text(json.dumps(raw, ensure_ascii=False), encoding="utf-8")
209
+ work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
210
+ submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
211
+ lint_path.write_text(json.dumps(lint, ensure_ascii=False), encoding="utf-8")
212
+ meta_path.write_text(
213
+ json.dumps(
214
+ {
215
+ "stem": "nav-store_mgr",
216
+ "workspace": "store_mgr",
217
+ "workSha256": hashlib.sha256(work_path.read_bytes()).hexdigest(),
218
+ "submitSha256": hashlib.sha256(submit_path.read_bytes()).hexdigest(),
219
+ "workConfirmedAt": "2026-04-21T00:00:00+00:00",
220
+ "lintCheckedAt": "2026-04-21T00:00:30+00:00",
221
+ "lintOk": True,
222
+ "lintWorkSha256": hashlib.sha256(work_path.read_bytes()).hexdigest(),
223
+ "lintSubmitSha256": hashlib.sha256(submit_path.read_bytes()).hexdigest(),
224
+ "status": "lint_passed",
225
+ },
226
+ ensure_ascii=False,
227
+ ),
228
+ encoding="utf-8",
229
+ )
230
+ with self.assertRaises(SystemExit):
231
+ nav_common.ensure_submission_allowed(meta_path, work_path, submit_path, raw_path, lint_path)
232
+
233
+ def test_build_meta_invalidates_old_confirmation_after_work_change(self) -> None:
234
+ with tempfile.TemporaryDirectory() as tmpdir:
235
+ root = Path(tmpdir)
236
+ meta_path = root / "meta.json"
237
+ work_path = root / "work.json"
238
+ submit_path = root / "submit.json"
239
+ work_path.write_text(json.dumps({"workspace": "store_mgr", "configs": {}}, ensure_ascii=False), encoding="utf-8")
240
+ submit_path.write_text(json.dumps({"workspace": "store_mgr", "operations": []}, ensure_ascii=False), encoding="utf-8")
241
+ meta_path.write_text(
242
+ json.dumps(
243
+ {
244
+ "stem": "nav-store_mgr",
245
+ "workspace": "store_mgr",
246
+ "workSha256": "old",
247
+ "status": "submit_confirmed",
248
+ "workConfirmedAt": "2026-04-21T00:00:00+00:00",
249
+ "submitConfirmedAt": "2026-04-21T00:01:00+00:00",
250
+ },
251
+ ensure_ascii=False,
252
+ ),
253
+ encoding="utf-8",
254
+ )
255
+ nav_common.update_build_meta(meta_path, stem="nav-store_mgr", work_path=work_path, submit_path=submit_path)
256
+ meta = nav_common.load_json(meta_path)
257
+ self.assertIsNone(meta["workConfirmedAt"])
258
+ self.assertIsNone(meta["submitConfirmedAt"])
259
+ self.assertEqual(meta["status"], "submit_built")
260
+
261
+ def test_two_stage_confirmation_flow(self) -> None:
262
+ with tempfile.TemporaryDirectory() as tmpdir:
263
+ root = Path(tmpdir)
264
+ meta_path = root / "meta.json"
265
+ work_path = root / "work.json"
266
+ submit_path = root / "submit.json"
267
+ lint_path = root / "lint.json"
268
+ raw = make_raw_bundle()
269
+ work = nav_common.bundle_to_work_payload(raw)
270
+ submit = nav_common.build_submit_payload(work)
271
+ lint = nav_common.lint_nav_config_semantics(work, raw_payload=raw, submit_payload=submit)
272
+ work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
273
+ submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
274
+ lint_path.write_text(json.dumps(lint, ensure_ascii=False), encoding="utf-8")
275
+ nav_common.update_confirmation_state(meta_path, stem="nav-store_mgr", actor="tester", stage="work", work_path=work_path)
276
+ meta = nav_common.load_json(meta_path)
277
+ self.assertEqual(meta["status"], "work_confirmed")
278
+ nav_common.update_build_meta(meta_path, stem="nav-store_mgr", work_path=work_path, submit_path=submit_path)
279
+ nav_common.update_lint_meta(
280
+ meta_path,
281
+ stem="nav-store_mgr",
282
+ work_path=work_path,
283
+ submit_path=submit_path,
284
+ lint_path=lint_path,
285
+ lint_report=lint,
286
+ )
287
+ nav_common.update_confirmation_state(
288
+ meta_path,
289
+ stem="nav-store_mgr",
290
+ actor="tester",
291
+ stage="submit",
292
+ work_path=work_path,
293
+ submit_path=submit_path,
294
+ )
295
+ meta = nav_common.load_json(meta_path)
296
+ self.assertEqual(meta["status"], "submit_confirmed")
297
+ self.assertEqual(meta["submitConfirmedBy"], "tester")
298
+
299
+ def test_lint_blocks_missing_type(self) -> None:
300
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
301
+ del work["configs"]["shortcut_mobile"]
302
+ report = nav_common.lint_nav_config_semantics(work)
303
+ self.assertFalse(report["ok"])
304
+ self.assertTrue(any("missing config types" in error for error in report["errors"]))
305
+
306
+ def test_lint_blocks_invalid_permission_cleanup(self) -> None:
307
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
308
+ node = work["configs"]["shortcut"]["items"][0]
309
+ node["permissionType"] = "VISIBILITY_SCOPE"
310
+ node["permission"] = "point.alpha"
311
+ node["visibility"] = "custom"
312
+ node["visibility_scope"] = json.dumps({"config": {"user": [], "group": [], "role": []}}, ensure_ascii=False)
313
+ report = nav_common.lint_nav_config_semantics(work)
314
+ self.assertFalse(report["ok"])
315
+ self.assertTrue(any(".permission must be empty" in error for error in report["errors"]))
316
+
317
+ def test_lint_blocks_nested_shortcut(self) -> None:
318
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
319
+ work["configs"]["shortcut"]["items"][0]["sub"] = [
320
+ copy.deepcopy(work["configs"]["shortcut"]["items"][0])
321
+ ]
322
+ report = nav_common.lint_nav_config_semantics(work)
323
+ self.assertFalse(report["ok"])
324
+ self.assertTrue(any("must stay empty for flat shortcut configs" in error for error in report["errors"]))
325
+
326
+ def test_lint_blocks_bad_ri_icon_format(self) -> None:
327
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
328
+ work["configs"]["shortcut"]["items"][0]["icon"] = "ri_exchange-box-line"
329
+ report = nav_common.lint_nav_config_semantics(work)
330
+ self.assertFalse(report["ok"])
331
+ self.assertTrue(any(".icon must be" in error for error in report["errors"]))
332
+
333
+ def test_lint_blocks_pc_h5_path_mixups(self) -> None:
334
+ work = nav_common.bundle_to_work_payload(make_raw_bundle())
335
+ work["configs"]["shortcut"]["items"][0]["path"] = "/pages/index/project?flow_type=flow579647382"
336
+ work["configs"]["navmenu_mobile"]["items"][0]["path"] = "/project?flow_type=flow816069530"
337
+ report = nav_common.lint_nav_config_semantics(work)
338
+ self.assertFalse(report["ok"])
339
+ self.assertTrue(any("PC route instead of H5 route" in error for error in report["errors"]))
340
+ self.assertTrue(any("H5 route instead of PC route" in error for error in report["errors"]))
341
+
342
+ def test_summarize_verification_detects_enable_multi_level_drift(self) -> None:
343
+ raw = make_raw_bundle()
344
+ work = nav_common.bundle_to_work_payload(raw)
345
+ submit = nav_common.build_submit_payload(work)
346
+ readback = make_raw_bundle()
347
+ readback["configs"]["shortcut"]["content"]["enableMultiLevel"] = True
348
+ verify = nav_common.summarize_verification(submit, readback, language="zhCN")
349
+ self.assertFalse(verify["ok"])
350
+ self.assertEqual(verify["completionStatus"], "readback_only")
351
+
352
+ def test_summarize_verification_marks_non_zhcn_manual_followup(self) -> None:
353
+ raw = make_raw_bundle()
354
+ work = nav_common.bundle_to_work_payload(raw)
355
+ submit = nav_common.build_submit_payload(work)
356
+ verify = nav_common.summarize_verification(submit, raw, language="enUS")
357
+ self.assertTrue(verify["ok"])
358
+ self.assertEqual(verify["completionStatus"], "manual_followup_required")
@@ -0,0 +1,138 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ import tempfile
5
+ import unittest
6
+ from pathlib import Path
7
+
8
+
9
+ SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
10
+ if str(SCRIPT_DIR) not in sys.path:
11
+ sys.path.insert(0, str(SCRIPT_DIR))
12
+
13
+ import nav_config_editor_common as common # noqa: E402
14
+
15
+
16
+ def make_details() -> dict[str, object]:
17
+ return {
18
+ "navmenu": {
19
+ "id": 11,
20
+ "type": "navmenu",
21
+ "name": "工作区导航",
22
+ "content": {
23
+ "navConfig": [
24
+ {
25
+ "id": "pc-home",
26
+ "name": "工作台",
27
+ "icon": "ri ri_home-5-line",
28
+ "permission": "",
29
+ "path": "/myProject",
30
+ "color": "",
31
+ "sub": [],
32
+ "permissionType": "PERMISSION_POINT",
33
+ "visibility": "public",
34
+ "visibility_scope": "",
35
+ }
36
+ ],
37
+ "enableMultiLevel": True,
38
+ },
39
+ },
40
+ "shortcut": {
41
+ "id": 12,
42
+ "type": "shortcut",
43
+ "name": "工作区快捷入口",
44
+ "content": {
45
+ "shortcutConfig": [
46
+ {
47
+ "id": "pc-shortcut-home",
48
+ "name": "工作台",
49
+ "icon": "ri ri_home-5-line",
50
+ "permission": "",
51
+ "path": "/myProject",
52
+ "color": "",
53
+ "sub": [],
54
+ "permissionType": "PERMISSION_POINT",
55
+ "visibility": "public",
56
+ "visibility_scope": "",
57
+ }
58
+ ]
59
+ },
60
+ },
61
+ "navmenu_mobile": {
62
+ "id": 13,
63
+ "type": "navmenu_mobile",
64
+ "name": "移动导航",
65
+ "content": {
66
+ "navMobileConfig": [
67
+ {
68
+ "id": "h5-home",
69
+ "name": "工作台",
70
+ "icon": "ri ri_home-5-line",
71
+ "permission": "",
72
+ "path": "/pages/index/project?flow_type=flow123",
73
+ "color": "",
74
+ "sub": [],
75
+ "permissionType": "PERMISSION_POINT",
76
+ "visibility": "public",
77
+ "visibility_scope": "",
78
+ }
79
+ ]
80
+ },
81
+ },
82
+ "shortcut_mobile": {
83
+ "id": 14,
84
+ "type": "shortcut_mobile",
85
+ "name": "移动快捷入口",
86
+ "content": {
87
+ "shortcutMobileConfig": [
88
+ {
89
+ "id": "h5-shortcut-home",
90
+ "name": "工作台",
91
+ "icon": "ri ri_home-5-line",
92
+ "permission": "",
93
+ "path": "/pages/index/project?flow_type=flow123",
94
+ "color": "",
95
+ "sub": [],
96
+ "permissionType": "PERMISSION_POINT",
97
+ "visibility": "public",
98
+ "visibility_scope": "",
99
+ }
100
+ ]
101
+ },
102
+ },
103
+ }
104
+
105
+
106
+ class NavConfigEditorCommonTests(unittest.TestCase):
107
+ def test_export_build_round_trip_preserves_four_configs_and_enable_multi_level(self) -> None:
108
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
109
+ submit = common.build_submit_payload(work)
110
+ self.assertEqual(set(submit["configs"].keys()), set(common.CONFIG_TYPES))
111
+ self.assertTrue(submit["configs"]["navmenu"]["content"]["enableMultiLevel"])
112
+ self.assertEqual(
113
+ submit["configs"]["shortcut_mobile"]["content"]["shortcutMobileConfig"][0]["path"],
114
+ "/pages/index/project?flow_type=flow123",
115
+ )
116
+
117
+ def test_meta_gate_blocks_submit_until_confirm_and_lint_are_fresh(self) -> None:
118
+ with tempfile.TemporaryDirectory() as tmpdir:
119
+ tmp_root = Path(tmpdir)
120
+ meta = tmp_root / "meta.json"
121
+ work = tmp_root / "work.json"
122
+ submit = tmp_root / "submit.json"
123
+ lint = tmp_root / "lint.json"
124
+ common.dump_json(work, common.detail_to_work_payload(make_details(), workspace="store_mgr"))
125
+ common.dump_json(submit, common.build_submit_payload(common.load_json(work)))
126
+ common.dump_json(lint, {"ok": True})
127
+ common.dump_json(meta, common.ensure_meta_shape({}, stem="store_mgr", workspace="store_mgr"))
128
+ common.update_confirmation_state(meta, stem="store_mgr", workspace="store_mgr", actor="codex", stage="work", work_path=work)
129
+ common.update_build_meta(meta, stem="store_mgr", workspace="store_mgr", work_path=work, submit_path=submit)
130
+ common.update_lint_meta(meta, stem="store_mgr", workspace="store_mgr", work_path=work, submit_path=submit, lint_path=lint, lint_report={"ok": True})
131
+ with self.assertRaises(SystemExit):
132
+ common.ensure_submission_allowed(meta, work, submit, lint)
133
+ common.update_confirmation_state(meta, stem="store_mgr", workspace="store_mgr", actor="codex", stage="submit", work_path=work, submit_path=submit)
134
+ common.ensure_submission_allowed(meta, work, submit, lint)
135
+
136
+
137
+ if __name__ == "__main__":
138
+ unittest.main()
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ import unittest
5
+ from pathlib import Path
6
+
7
+
8
+ SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
9
+ if str(SCRIPT_DIR) not in sys.path:
10
+ sys.path.insert(0, str(SCRIPT_DIR))
11
+
12
+ import nav_config_editor_common as common # noqa: E402
13
+ from test_nav_config_editor_common import make_details # noqa: E402
14
+
15
+
16
+ class NavConfigLintTests(unittest.TestCase):
17
+ def test_missing_config_type_fails(self) -> None:
18
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
19
+ del work["configs"]["shortcut"]
20
+ report = common.lint_nav_config_semantics(work)
21
+ self.assertFalse(report["ok"])
22
+ self.assertTrue(any("missing config type shortcut" in item for item in report["errors"]))
23
+
24
+ def test_shortcut_must_stay_flat(self) -> None:
25
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
26
+ work["configs"]["shortcut"]["content"]["shortcutConfig"][0]["sub"] = [work["configs"]["shortcut"]["content"]["shortcutConfig"][0].copy()]
27
+ report = common.lint_nav_config_semantics(work)
28
+ self.assertFalse(report["ok"])
29
+ self.assertTrue(any(".sub must stay empty for shortcut configs" in item for item in report["errors"]))
30
+
31
+ def test_icon_must_use_full_class(self) -> None:
32
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
33
+ work["configs"]["navmenu"]["content"]["navConfig"][0]["icon"] = "ri_home-5-line"
34
+ report = common.lint_nav_config_semantics(work)
35
+ self.assertFalse(report["ok"])
36
+ self.assertTrue(any(".icon must use a full icon class" in item for item in report["errors"]))
37
+
38
+ def test_mobile_path_must_not_use_pc_route(self) -> None:
39
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
40
+ work["configs"]["navmenu_mobile"]["content"]["navMobileConfig"][0]["path"] = "/project?flow_type=flow123"
41
+ report = common.lint_nav_config_semantics(work)
42
+ self.assertFalse(report["ok"])
43
+ self.assertTrue(any("must use an H5 path" in item for item in report["errors"]))
44
+
45
+ def test_visibility_scope_mode_requires_permission_to_be_empty(self) -> None:
46
+ work = common.detail_to_work_payload(make_details(), workspace="store_mgr")
47
+ node = work["configs"]["navmenu"]["content"]["navConfig"][0]
48
+ node["permissionType"] = "VISIBILITY_SCOPE"
49
+ node["permission"] = "point.demo"
50
+ node["visibility"] = "custom"
51
+ node["visibility_scope"] = {"config": {"user": [1], "group": [], "role": []}}
52
+ report = common.lint_nav_config_semantics(work)
53
+ self.assertFalse(report["ok"])
54
+ self.assertTrue(any(".permission must be empty in VISIBILITY_SCOPE mode" in item for item in report["errors"]))
55
+
56
+
57
+ if __name__ == "__main__":
58
+ unittest.main()