bpmax-cli 0.1.44-beta.9 → 0.1.44

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 (258) hide show
  1. package/README.md +5 -3
  2. package/dist/bin.js +461 -4663
  3. package/dist/bin.js.map +1 -1
  4. package/package.json +1 -1
  5. package/scripts/install-skills.mjs +0 -98
  6. package/skills/bpmax-auth/SKILL.md +17 -6
  7. package/skills/bpmax-cli/SKILL.md +0 -2
  8. package/skills/bpmax-project/SKILL.md +2 -1
  9. package/skills/bpmax-shared/SKILL.md +1 -1
  10. package/skills/bpmax-api-platform-editor/SKILL.md +0 -321
  11. package/skills/bpmax-api-platform-editor/agents/openai.yaml +0 -4
  12. package/skills/bpmax-api-platform-editor/references/api-doc-debug-workflow.md +0 -34
  13. package/skills/bpmax-api-platform-editor/references/api-proxy-shape.md +0 -41
  14. package/skills/bpmax-api-platform-editor/references/instance-config-shape.md +0 -41
  15. package/skills/bpmax-api-platform-editor/references/platform-api-map.md +0 -52
  16. package/skills/bpmax-api-platform-editor/references/runtime-workflow.md +0 -32
  17. package/skills/bpmax-api-platform-editor/scripts/api_platform_editor_common.py +0 -1276
  18. package/skills/bpmax-api-platform-editor/scripts/build_submit_payload.py +0 -64
  19. package/skills/bpmax-api-platform-editor/scripts/capture_write_contract.py +0 -40
  20. package/skills/bpmax-api-platform-editor/scripts/export_layer_bundle.py +0 -212
  21. package/skills/bpmax-api-platform-editor/scripts/record_doc_debug_acceptance.py +0 -62
  22. package/skills/bpmax-api-platform-editor/scripts/submit_and_verify_layer.py +0 -75
  23. package/skills/bpmax-api-platform-editor/tests/test_api_platform_editor.py +0 -287
  24. package/skills/bpmax-builder-shared/SKILL.md +0 -44
  25. package/skills/bpmax-builder-shared/base_url.py +0 -81
  26. package/skills/bpmax-builder-shared/runtime-script-site-matrix.json +0 -71
  27. package/skills/bpmax-builder-shared/runtime-script-site-matrix.md +0 -34
  28. package/skills/bpmax-builder-shared/runtime-script-template-catalog.md +0 -123
  29. package/skills/bpmax-builder-shared/runtime_script_rules.py +0 -272
  30. package/skills/bpmax-builder-shared/skill_audit.py +0 -374
  31. package/skills/bpmax-builder-shared/template_script_hard_rules.py +0 -280
  32. package/skills/bpmax-builder-shared/tests/test_base_url.py +0 -80
  33. package/skills/bpmax-builder-shared/tests/test_runtime_script_rules.py +0 -115
  34. package/skills/bpmax-builder-shared/tests/test_skill_audit.py +0 -231
  35. package/skills/bpmax-builder-shared/tests/test_template_script_hard_rules.py +0 -281
  36. package/skills/bpmax-config-latest/SKILL.md +0 -71
  37. package/skills/bpmax-console-template-editor/SKILL.md +0 -536
  38. package/skills/bpmax-console-template-editor/agents/openai.yaml +0 -4
  39. package/skills/bpmax-console-template-editor/references/filter-integration.md +0 -60
  40. package/skills/bpmax-console-template-editor/references/lessons-from-resume-dashboard.md +0 -114
  41. package/skills/bpmax-console-template-editor/references/local-temp-workflow.md +0 -69
  42. package/skills/bpmax-console-template-editor/references/module-catalog.md +0 -100
  43. package/skills/bpmax-console-template-editor/references/runtime-page-shape.md +0 -91
  44. package/skills/bpmax-console-template-editor/references/template-shape.md +0 -149
  45. package/skills/bpmax-console-template-editor/scripts/build_submit_payload.py +0 -38
  46. package/skills/bpmax-console-template-editor/scripts/confirm_console_template.py +0 -33
  47. package/skills/bpmax-console-template-editor/scripts/console_template_editor_common.py +0 -964
  48. package/skills/bpmax-console-template-editor/scripts/export_console_template.py +0 -99
  49. package/skills/bpmax-console-template-editor/scripts/lint_console_template.py +0 -46
  50. package/skills/bpmax-console-template-editor/scripts/submit_console_template.py +0 -99
  51. package/skills/bpmax-console-template-editor/tests/test_console_template_editor.py +0 -383
  52. package/skills/bpmax-dataset-field-template-editor/SKILL.md +0 -600
  53. package/skills/bpmax-dataset-field-template-editor/references/create-request-gotchas.md +0 -25
  54. package/skills/bpmax-dataset-field-template-editor/references/field-classify-mapping.md +0 -35
  55. package/skills/bpmax-dataset-field-template-editor/references/nested-field-patterns.md +0 -24
  56. package/skills/bpmax-dataset-field-template-editor/references/runtime-verified-field-page-shape.md +0 -61
  57. package/skills/bpmax-dataset-field-template-editor/references/virtual-field-patterns.md +0 -27
  58. package/skills/bpmax-dataset-field-template-editor/references/work-file-to-submit-mapping.md +0 -127
  59. package/skills/bpmax-dataset-field-template-editor/scripts/build_submit_payload.py +0 -67
  60. package/skills/bpmax-dataset-field-template-editor/scripts/confirm_dataset_field.py +0 -37
  61. package/skills/bpmax-dataset-field-template-editor/scripts/dataset_field_editor_common.py +0 -784
  62. package/skills/bpmax-dataset-field-template-editor/scripts/export_dataset_field.py +0 -62
  63. package/skills/bpmax-dataset-field-template-editor/scripts/init_create_dataset_field.py +0 -104
  64. package/skills/bpmax-dataset-field-template-editor/scripts/inspect_dataset_field_runtime.py +0 -83
  65. package/skills/bpmax-dataset-field-template-editor/scripts/lint_dataset_field_semantics.py +0 -35
  66. package/skills/bpmax-dataset-field-template-editor/scripts/submit_dataset_field.py +0 -95
  67. package/skills/bpmax-dataset-field-template-editor/tests/test_dataset_field_editor.py +0 -709
  68. package/skills/bpmax-dataset-field-template-editor/tests/test_init_create_dataset_field.py +0 -59
  69. package/skills/bpmax-dataset-template-editor/SKILL.md +0 -779
  70. package/skills/bpmax-dataset-template-editor/references/custom-key-usage-patterns.md +0 -18
  71. package/skills/bpmax-dataset-template-editor/references/dataset-script-runtime-matrix.md +0 -73
  72. package/skills/bpmax-dataset-template-editor/references/pre-process-script-authoring-guide.md +0 -186
  73. package/skills/bpmax-dataset-template-editor/references/pre-process-script-example-catalog.md +0 -106
  74. package/skills/bpmax-dataset-template-editor/references/runtime-gotchas.md +0 -28
  75. package/skills/bpmax-dataset-template-editor/references/runtime-verified-dataset-page-shape.md +0 -47
  76. package/skills/bpmax-dataset-template-editor/references/ui-to-backend-field-map.md +0 -23
  77. package/skills/bpmax-dataset-template-editor/references/work-file-to-submit-mapping.md +0 -97
  78. package/skills/bpmax-dataset-template-editor/scripts/basic_table_audit.py +0 -65
  79. package/skills/bpmax-dataset-template-editor/scripts/build_submit_payload.py +0 -38
  80. package/skills/bpmax-dataset-template-editor/scripts/dataset_editor_common.py +0 -650
  81. package/skills/bpmax-dataset-template-editor/scripts/export_dataset.py +0 -155
  82. package/skills/bpmax-dataset-template-editor/scripts/lint_dataset_template.py +0 -42
  83. package/skills/bpmax-dataset-template-editor/scripts/resolve_dataset.py +0 -43
  84. package/skills/bpmax-dataset-template-editor/scripts/scan_custom_key_references.py +0 -27
  85. package/skills/bpmax-dataset-template-editor/scripts/submit_dataset.py +0 -115
  86. package/skills/bpmax-dataset-template-editor/scripts/verify_dataset_list.py +0 -52
  87. package/skills/bpmax-dataset-template-editor/scripts/verify_publish_health.py +0 -39
  88. package/skills/bpmax-dataset-template-editor/tests/test_dataset_editor.py +0 -373
  89. package/skills/bpmax-e2e-flow-config-orchestrator/SKILL.md +0 -177
  90. package/skills/bpmax-e2e-flow-config-orchestrator/agents/openai.yaml +0 -4
  91. package/skills/bpmax-e2e-flow-config-orchestrator/references/orchestration-matrix.md +0 -60
  92. package/skills/bpmax-e2e-flow-test-operator/SKILL.md +0 -394
  93. package/skills/bpmax-e2e-flow-test-operator/agents/openai.yaml +0 -5
  94. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale.json +0 -97
  95. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_final_v2.json +0 -105
  96. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_main.json +0 -36
  97. package/skills/bpmax-e2e-flow-test-operator/profiles/negative_sale_region.json +0 -40
  98. package/skills/bpmax-e2e-flow-test-operator/references/browser-only-checkpoints.md +0 -41
  99. package/skills/bpmax-e2e-flow-test-operator/references/failure-update-loop.md +0 -17
  100. package/skills/bpmax-e2e-flow-test-operator/references/filter-field-discovery.md +0 -40
  101. package/skills/bpmax-e2e-flow-test-operator/references/minimal-test-loop.md +0 -24
  102. package/skills/bpmax-e2e-flow-test-operator/references/negative-sale-api-matrix.md +0 -75
  103. package/skills/bpmax-e2e-flow-test-operator/references/profile-schema.md +0 -107
  104. package/skills/bpmax-e2e-flow-test-operator/references/skill-experience-coverage-matrix.md +0 -29
  105. package/skills/bpmax-e2e-flow-test-operator/references/stale-runtime-and-clean-sample-rules.md +0 -54
  106. package/skills/bpmax-e2e-flow-test-operator/references/state-schema.md +0 -83
  107. package/skills/bpmax-e2e-flow-test-operator/scripts/bpmax_session.py +0 -287
  108. package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_plan.json +0 -59
  109. package/skills/bpmax-e2e-flow-test-operator/scripts/dealer_sample_on_shelf_runner.py +0 -687
  110. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_doc.py +0 -121
  111. package/skills/bpmax-e2e-flow-test-operator/scripts/e2e_state.py +0 -288
  112. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_api_matrix.py +0 -161
  113. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_filter_fields.py +0 -138
  114. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_form_runtime.py +0 -396
  115. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_runner.py +0 -341
  116. package/skills/bpmax-e2e-flow-test-operator/scripts/flow_test_profile.py +0 -185
  117. package/skills/bpmax-e2e-flow-test-operator/tests/test_negative_sale_api_tools.py +0 -138
  118. package/skills/bpmax-feishu-chat-flow-plugin-editor/SKILL.md +0 -69
  119. package/skills/bpmax-feishu-chat-flow-plugin-editor/agents/openai.yaml +0 -4
  120. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-checklist.md +0 -42
  121. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-recipes.md +0 -38
  122. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/config-shape.md +0 -86
  123. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/gate-lint.md +0 -68
  124. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/hoocoo-patterns.md +0 -39
  125. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/runtime-behavior.md +0 -41
  126. package/skills/bpmax-feishu-chat-flow-plugin-editor/references/script-authoring.md +0 -110
  127. package/skills/bpmax-feishu-chat-flow-plugin-editor/scripts/lint_feishu_chat_plugin.py +0 -278
  128. package/skills/bpmax-feishu-chat-flow-plugin-editor/tests/test_lint_feishu_chat_plugin.py +0 -203
  129. package/skills/bpmax-filter-template-editor/SKILL.md +0 -564
  130. package/skills/bpmax-filter-template-editor/references/experience-coverage-matrix.md +0 -38
  131. package/skills/bpmax-filter-template-editor/references/filter-and-flow-binding.md +0 -57
  132. package/skills/bpmax-filter-template-editor/references/filter-content-schema.md +0 -141
  133. package/skills/bpmax-filter-template-editor/references/filter-request-shape.md +0 -287
  134. package/skills/bpmax-filter-template-editor/references/filter-runtime-patterns.md +0 -115
  135. package/skills/bpmax-filter-template-editor/references/runtime-verified-filter-page-shape.md +0 -94
  136. package/skills/bpmax-filter-template-editor/scripts/build_submit_payload.py +0 -25
  137. package/skills/bpmax-filter-template-editor/scripts/confirm_filter_template.py +0 -22
  138. package/skills/bpmax-filter-template-editor/scripts/export_filter_template.py +0 -57
  139. package/skills/bpmax-filter-template-editor/scripts/filter_template_editor_common.py +0 -348
  140. package/skills/bpmax-filter-template-editor/scripts/init_create_filter_template.py +0 -8
  141. package/skills/bpmax-filter-template-editor/scripts/lint_filter_template_semantics.py +0 -26
  142. package/skills/bpmax-filter-template-editor/scripts/submit_filter_template.py +0 -62
  143. package/skills/bpmax-filter-template-editor/tests/test_filter_template_editor.py +0 -231
  144. package/skills/bpmax-flow-template-editor/SKILL.md +0 -1058
  145. package/skills/bpmax-flow-template-editor/agents/openai.yaml +0 -4
  146. package/skills/bpmax-flow-template-editor/references/before-next-step-script-runtime-gotchas.md +0 -62
  147. package/skills/bpmax-flow-template-editor/references/config-surfaces-and-placeholders.md +0 -270
  148. package/skills/bpmax-flow-template-editor/references/diff-strategy.md +0 -67
  149. package/skills/bpmax-flow-template-editor/references/editor-runtime-vs-draft.md +0 -25
  150. package/skills/bpmax-flow-template-editor/references/flow-template-api-workflow.md +0 -174
  151. package/skills/bpmax-flow-template-editor/references/intent-model.md +0 -117
  152. package/skills/bpmax-flow-template-editor/references/lessons-from-price-plan-flow.md +0 -147
  153. package/skills/bpmax-flow-template-editor/references/local-temp-workflow.md +0 -97
  154. package/skills/bpmax-flow-template-editor/references/matrix-flow-form-nav-collaboration.md +0 -165
  155. package/skills/bpmax-flow-template-editor/references/payload-checklist.md +0 -133
  156. package/skills/bpmax-flow-template-editor/references/project-create-runtime-gotchas.md +0 -54
  157. package/skills/bpmax-flow-template-editor/references/requirement-to-node-mapping.md +0 -149
  158. package/skills/bpmax-flow-template-editor/references/runtime-verified-flow-detail-shape.md +0 -41
  159. package/skills/bpmax-flow-template-editor/references/runtime-verified-meta-fields.md +0 -155
  160. package/skills/bpmax-flow-template-editor/references/runtime-verified-node-fields.md +0 -179
  161. package/skills/bpmax-flow-template-editor/references/save-draft-request-shape.md +0 -91
  162. package/skills/bpmax-flow-template-editor/references/script-review-hard-rules.md +0 -93
  163. package/skills/bpmax-flow-template-editor/references/work-file-to-submit-mapping.md +0 -57
  164. package/skills/bpmax-flow-template-editor/scripts/build_submit_payload.py +0 -69
  165. package/skills/bpmax-flow-template-editor/scripts/confirm_flow_template.py +0 -52
  166. package/skills/bpmax-flow-template-editor/scripts/export_flow_template.py +0 -114
  167. package/skills/bpmax-flow-template-editor/scripts/flow_template_editor_common.py +0 -1084
  168. package/skills/bpmax-flow-template-editor/scripts/submit_flow_template.py +0 -159
  169. package/skills/bpmax-flow-template-editor/tests/test_flow_template_editor.py +0 -636
  170. package/skills/bpmax-form-template-editor/SKILL.md +0 -1099
  171. package/skills/bpmax-form-template-editor/agents/openai.yaml +0 -4
  172. package/skills/bpmax-form-template-editor/references/form-template-api-workflow.md +0 -203
  173. package/skills/bpmax-form-template-editor/references/local-temp-workflow.md +0 -125
  174. package/skills/bpmax-form-template-editor/references/payload-checklist.md +0 -77
  175. package/skills/bpmax-form-template-editor/references/sub-form-patterns.md +0 -49
  176. package/skills/bpmax-form-template-editor/scripts/build_submit_payload.py +0 -37
  177. package/skills/bpmax-form-template-editor/scripts/check_form_template_consistency.py +0 -145
  178. package/skills/bpmax-form-template-editor/scripts/confirm_form_template.py +0 -67
  179. package/skills/bpmax-form-template-editor/scripts/export_form_template.py +0 -91
  180. package/skills/bpmax-form-template-editor/scripts/form_template_editor_common.py +0 -1762
  181. package/skills/bpmax-form-template-editor/scripts/lint_form_template_semantics.py +0 -30
  182. package/skills/bpmax-form-template-editor/scripts/record_runtime_acceptance.py +0 -67
  183. package/skills/bpmax-form-template-editor/scripts/submit_form_template.py +0 -163
  184. package/skills/bpmax-form-template-editor/tests/test_form_template_editor.py +0 -1292
  185. package/skills/bpmax-list-template-editor/SKILL.md +0 -468
  186. package/skills/bpmax-list-template-editor/agents/openai.yaml +0 -4
  187. package/skills/bpmax-list-template-editor/references/browser-page-contract.md +0 -81
  188. package/skills/bpmax-list-template-editor/references/content-config-shape.md +0 -148
  189. package/skills/bpmax-list-template-editor/references/dataset-field-mapping.md +0 -60
  190. package/skills/bpmax-list-template-editor/references/list-template-api-workflow.md +0 -103
  191. package/skills/bpmax-list-template-editor/references/local-temp-workflow.md +0 -102
  192. package/skills/bpmax-list-template-editor/references/payload-checklist.md +0 -47
  193. package/skills/bpmax-list-template-editor/references/runtime-verified-workflow.md +0 -140
  194. package/skills/bpmax-list-template-editor/references/special-formats.md +0 -394
  195. package/skills/bpmax-list-template-editor/scripts/build_submit_payload.py +0 -37
  196. package/skills/bpmax-list-template-editor/scripts/confirm_list_template.py +0 -33
  197. package/skills/bpmax-list-template-editor/scripts/export_list_template.py +0 -89
  198. package/skills/bpmax-list-template-editor/scripts/fetch_data_set.py +0 -34
  199. package/skills/bpmax-list-template-editor/scripts/lint_list_template_semantics.py +0 -54
  200. package/skills/bpmax-list-template-editor/scripts/list_template_editor_common.py +0 -955
  201. package/skills/bpmax-list-template-editor/scripts/record_acceptance.py +0 -55
  202. package/skills/bpmax-list-template-editor/scripts/submit_list_template.py +0 -117
  203. package/skills/bpmax-list-template-editor/tests/test_list_template_editor_common.py +0 -441
  204. package/skills/bpmax-memory-protocol/SKILL.md +0 -72
  205. package/skills/bpmax-nav-config-editor/SKILL.md +0 -347
  206. package/skills/bpmax-nav-config-editor/agents/openai.yaml +0 -4
  207. package/skills/bpmax-nav-config-editor/references/api-workflow.md +0 -68
  208. package/skills/bpmax-nav-config-editor/references/config-shape.md +0 -78
  209. package/skills/bpmax-nav-config-editor/references/icon-selection.md +0 -83
  210. package/skills/bpmax-nav-config-editor/references/path-mapping-rules.md +0 -46
  211. package/skills/bpmax-nav-config-editor/references/payload-checklist.md +0 -41
  212. package/skills/bpmax-nav-config-editor/references/runtime-probing.md +0 -47
  213. package/skills/bpmax-nav-config-editor/scripts/build_submit_payload.py +0 -34
  214. package/skills/bpmax-nav-config-editor/scripts/confirm_nav_config.py +0 -32
  215. package/skills/bpmax-nav-config-editor/scripts/export_nav_config.py +0 -56
  216. package/skills/bpmax-nav-config-editor/scripts/lint_nav_config_semantics.py +0 -33
  217. package/skills/bpmax-nav-config-editor/scripts/nav_config_editor_common.py +0 -812
  218. package/skills/bpmax-nav-config-editor/scripts/submit_nav_config.py +0 -44
  219. package/skills/bpmax-nav-config-editor/scripts/verify_nav_config.py +0 -33
  220. package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor.py +0 -358
  221. package/skills/bpmax-nav-config-editor/tests/test_nav_config_editor_common.py +0 -138
  222. package/skills/bpmax-nav-config-editor/tests/test_nav_config_lint.py +0 -58
  223. package/skills/bpmax-nav-config-editor/tests/test_nav_config_submit_verify.py +0 -51
  224. package/skills/bpmax-project-detail-template-editor/SKILL.md +0 -329
  225. package/skills/bpmax-project-detail-template-editor/agents/openai.yaml +0 -4
  226. package/skills/bpmax-project-detail-template-editor/references/local-temp-workflow.md +0 -59
  227. package/skills/bpmax-project-detail-template-editor/references/module-catalog-and-config-notes.md +0 -47
  228. package/skills/bpmax-project-detail-template-editor/references/payload-checklist.md +0 -33
  229. package/skills/bpmax-project-detail-template-editor/references/project-detail-template-api-workflow.md +0 -44
  230. package/skills/bpmax-project-detail-template-editor/scripts/build_submit_payload.py +0 -30
  231. package/skills/bpmax-project-detail-template-editor/scripts/confirm_project_detail_template.py +0 -33
  232. package/skills/bpmax-project-detail-template-editor/scripts/export_project_detail_template.py +0 -87
  233. package/skills/bpmax-project-detail-template-editor/scripts/lint_project_detail_template_semantics.py +0 -37
  234. package/skills/bpmax-project-detail-template-editor/scripts/project_detail_template_editor_common.py +0 -507
  235. package/skills/bpmax-project-detail-template-editor/scripts/submit_project_detail_template.py +0 -120
  236. package/skills/bpmax-project-detail-template-editor/tests/test_project_detail_template_editor.py +0 -369
  237. package/skills/bpmax-role-editor/SKILL.md +0 -251
  238. package/skills/bpmax-role-editor/references/api-workflow.md +0 -30
  239. package/skills/bpmax-role-editor/references/runtime-page-shape.md +0 -18
  240. package/skills/bpmax-role-editor/references/work-file-mapping.md +0 -32
  241. package/skills/bpmax-role-editor/scripts/build_submit_payload.py +0 -38
  242. package/skills/bpmax-role-editor/scripts/confirm_role.py +0 -33
  243. package/skills/bpmax-role-editor/scripts/export_role.py +0 -163
  244. package/skills/bpmax-role-editor/scripts/lint_role_semantics.py +0 -38
  245. package/skills/bpmax-role-editor/scripts/role_editor_common.py +0 -1231
  246. package/skills/bpmax-role-editor/scripts/submit_role.py +0 -144
  247. package/skills/bpmax-role-editor/tests/test_role_editor.py +0 -343
  248. package/skills/bpmax-user-mock-operator/SKILL.md +0 -106
  249. package/skills/bpmax-user-mock-operator/agents/openai.yaml +0 -4
  250. package/skills/bpmax-user-mock-operator/scripts/switch_user_identity.py +0 -37
  251. package/skills/bpmax-user-mock-operator/scripts/user_mock_operator_common.py +0 -136
  252. package/skills/bpmax-user-mock-operator/tests/test_user_mock_operator.py +0 -138
  253. package/skills/form-control-library/SKILL.md +0 -82
  254. package/skills/form-control-library/agents/openai.yaml +0 -4
  255. package/skills/form-control-library/references/form-controls.md +0 -199
  256. package/skills/form-control-library/references/form-template-submit-schema.md +0 -180
  257. package/skills/form-control-library/references/group-select-runtime.md +0 -191
  258. package/skills/form-control-library/scripts/rebuild_form_control_library.py +0 -55
@@ -1,636 +0,0 @@
1
- import json
2
- import os
3
- import sys
4
- import tempfile
5
- import unittest
6
- from pathlib import Path
7
- from unittest import mock
8
-
9
-
10
- SCRIPT_DIR = Path(__file__).resolve().parents[1] / "scripts"
11
- if str(SCRIPT_DIR) not in sys.path:
12
- sys.path.insert(0, str(SCRIPT_DIR))
13
-
14
- from flow_template_editor_common import ( # noqa: E402
15
- ApiClient,
16
- build_client,
17
- build_drift_report,
18
- build_submit_payload,
19
- detail_to_work_payload,
20
- evaluate_lints,
21
- ensure_submission_allowed,
22
- lint_work_payload,
23
- lint_flow_semantics,
24
- load_json,
25
- normalize_flow_detail,
26
- resolve_export_detail,
27
- summarize_verification,
28
- update_build_meta,
29
- update_confirmation_state,
30
- )
31
-
32
-
33
- def make_detail() -> dict:
34
- return {
35
- "name": "ST销售出库",
36
- "flow_type": "flow352878207",
37
- "update_time": "2026-04-02 20:48:50",
38
- "data": {
39
- "periods": ["销售出库", "归档"],
40
- "nodes": [
41
- {
42
- "id": "1775218151534",
43
- "name": "提交申请",
44
- "period": "销售出库",
45
- "approve_to_step": "1776676101001",
46
- "approve_fail": "",
47
- "form_template": 990702287,
48
- "need_confirm": False,
49
- "owner_is_creater": True,
50
- "owner_roles": [],
51
- "enableBeforeNextStepScript": True,
52
- "beforeNextStepScript": "return true;",
53
- "condational_nodes": [],
54
- },
55
- {
56
- "id": "1776676101001",
57
- "name": "主管审批",
58
- "period": "销售出库",
59
- "approve_to_step": "",
60
- "approve_fail": "1775218151534",
61
- "need_confirm": False,
62
- "owner_is_creater": True,
63
- "owner_roles": [],
64
- "condational_nodes": [],
65
- },
66
- ],
67
- "meta": {
68
- "isMeta": True,
69
- "name": "开始",
70
- "form_template": 990702239,
71
- "project_name_template": "return 'ST销售出库';",
72
- },
73
- "group": [],
74
- },
75
- }
76
-
77
-
78
- def make_runtime_submit_data() -> dict:
79
- return copy_for_runtime(make_detail()["data"])
80
-
81
-
82
- def copy_for_runtime(data: dict) -> dict:
83
- return json.loads(json.dumps(data, ensure_ascii=False))
84
-
85
-
86
- def make_semantic_work() -> dict:
87
- return detail_to_work_payload(make_detail(), workspace="store_mgr")
88
-
89
-
90
- class FlowTemplateEditorCommonTests(unittest.TestCase):
91
- def test_detail_to_work_payload_maps_real_shape(self) -> None:
92
- work = detail_to_work_payload(make_detail(), workspace="store_mgr")
93
- self.assertEqual(work["mode"], "edit")
94
- self.assertEqual(work["identity"]["scope"], "main")
95
- self.assertEqual(work["basic"]["name"], "ST销售出库")
96
- self.assertEqual(work["basic"]["updateTime"], "2026-04-02 20:48:50")
97
- self.assertEqual(work["data"]["periods"][0], "销售出库")
98
- self.assertEqual(work["preserve"]["nodeCount"], 2)
99
-
100
- def test_build_submit_payload_preserves_full_data_shape(self) -> None:
101
- work = detail_to_work_payload(make_detail(), workspace="store_mgr")
102
- submit = build_submit_payload(work)
103
- self.assertEqual(set(submit.keys()), {"name", "data"})
104
- self.assertEqual(submit["name"], "ST销售出库")
105
- self.assertEqual(submit["data"], work["data"])
106
-
107
- def test_build_submit_payload_rejects_missing_node_target(self) -> None:
108
- work = detail_to_work_payload(make_detail(), workspace="store_mgr")
109
- work["data"]["nodes"][0]["approve_to_step"] = "不存在的节点"
110
- with self.assertRaises(SystemExit):
111
- build_submit_payload(work)
112
-
113
- def test_evaluate_lints_can_ignore_preexisting_raw_errors_only(self) -> None:
114
- raw_detail = make_detail()
115
- raw_detail["data"]["nodes"][0]["approve_to_step"] = "[source]"
116
- work = detail_to_work_payload(raw_detail, workspace="store_mgr")
117
-
118
- structure_lint, semantic_lint = evaluate_lints(
119
- work,
120
- raw_payload=raw_detail,
121
- allow_preexisting_lint_errors=True,
122
- )
123
-
124
- self.assertTrue(structure_lint["ok"])
125
- self.assertFalse(structure_lint["errors"])
126
- self.assertTrue(structure_lint["ignoredPreexistingErrors"])
127
- self.assertTrue(semantic_lint["ok"])
128
-
129
- work["data"]["nodes"][1]["approve_fail"] = "新坏节点"
130
- structure_lint, _ = evaluate_lints(
131
- work,
132
- raw_payload=raw_detail,
133
- allow_preexisting_lint_errors=True,
134
- )
135
- self.assertFalse(structure_lint["ok"])
136
- self.assertTrue(any("新坏节点" in err for err in structure_lint["errors"]))
137
-
138
- def test_runtime_fallback_accepts_bare_get_submit_data_shape(self) -> None:
139
- runtime_detail = make_runtime_submit_data()
140
- work = detail_to_work_payload(
141
- runtime_detail,
142
- workspace="store_mgr",
143
- flow_type="flow352878207",
144
- source="runtime_fallback",
145
- )
146
- self.assertEqual(work["basic"]["flowType"], "flow352878207")
147
- self.assertEqual(work["data"]["group"], [])
148
-
149
- def test_semantic_lint_requires_before_next_step_enable_flag(self) -> None:
150
- work = make_semantic_work()
151
- work["data"]["nodes"][0]["enableBeforeNextStepScript"] = False
152
- report = lint_flow_semantics(work)
153
- self.assertFalse(report["ok"])
154
- self.assertTrue(any("enableBeforeNextStepScript" in err for err in report["errors"]))
155
-
156
- def test_work_lint_requires_group_array(self) -> None:
157
- work = make_semantic_work()
158
- work["data"]["group"] = {}
159
- report = lint_work_payload(work)
160
- self.assertFalse(report["ok"])
161
- self.assertTrue(any("data.group must be an array" in err for err in report["errors"]))
162
-
163
- def test_semantic_lint_rejects_object_shaped_group(self) -> None:
164
- work = make_semantic_work()
165
- work["data"]["group"] = {}
166
- report = lint_flow_semantics(work)
167
- self.assertFalse(report["ok"])
168
- self.assertTrue(any("FlowMap rendering" in err for err in report["errors"]))
169
-
170
- def test_semantic_lint_rejects_bare_auto_trigger_flow_form(self) -> None:
171
- work = make_semantic_work()
172
- work["data"]["nodes"][0]["auto_trigger_flows"] = {
173
- "flows": [
174
- {
175
- "create_rule": "return [{ form: { robo_serialno: sn } }];"
176
- }
177
- ]
178
- }
179
- report = lint_flow_semantics(work)
180
- self.assertFalse(report["ok"])
181
- self.assertTrue(any("bare form object" in err for err in report["errors"]))
182
-
183
- def test_semantic_lint_rejects_approval_count_on_non_approval_step(self) -> None:
184
- work = make_semantic_work()
185
- work["data"]["nodes"][0]["name"] = "成员评分"
186
- work["data"]["nodes"][0]["approve_count_required"] = 1
187
-
188
- report = lint_flow_semantics(work)
189
-
190
- self.assertFalse(report["ok"])
191
- self.assertTrue(any("non-approval steps must use 0" in err for err in report["errors"]))
192
-
193
- def test_semantic_lint_rejects_approval_step_without_explicit_reject_target(self) -> None:
194
- work = make_semantic_work()
195
- work["data"]["nodes"][1]["name"] = "评分确认"
196
- work["data"]["nodes"][1]["approve_count_required"] = 1
197
- work["data"]["nodes"][1]["approve_to_step"] = "1775218151534"
198
- work["data"]["nodes"][1]["approve_fail"] = ""
199
- work["data"]["nodes"][1]["approve_fail_actions"] = []
200
-
201
- report = lint_flow_semantics(work)
202
-
203
- self.assertFalse(report["ok"])
204
- self.assertTrue(any("no explicit reject target" in err for err in report["errors"]))
205
-
206
- def test_semantic_lint_rejects_approval_and_reject_to_same_target(self) -> None:
207
- work = make_semantic_work()
208
- work["data"]["nodes"][1]["name"] = "评分确认"
209
- work["data"]["nodes"][1]["approve_count_required"] = 1
210
- work["data"]["nodes"][1]["approve_to_step"] = "1775218151534"
211
- work["data"]["nodes"][1]["approve_fail"] = "1775218151534"
212
-
213
- report = lint_flow_semantics(work)
214
-
215
- self.assertFalse(report["ok"])
216
- self.assertTrue(any("approval and reject routing target the same node" in err for err in report["errors"]))
217
-
218
- def test_semantic_lint_rejects_non_numeric_form_template_refs(self) -> None:
219
- work = make_semantic_work()
220
- work["data"]["nodes"][0]["form_template"] = "uuid'abc'"
221
- work["data"]["meta"]["form_template"] = "uuid'def'"
222
- report = lint_flow_semantics(work)
223
- self.assertFalse(report["ok"])
224
- self.assertGreaterEqual(len(report["errors"]), 2)
225
- self.assertGreaterEqual(len(report["hardErrors"]), 2)
226
-
227
- def test_semantic_lint_rejects_non_numeric_online_template_refs(self) -> None:
228
- work = make_semantic_work()
229
- work["data"]["meta"]["table_list_template"] = "uuid'list'"
230
- work["data"]["meta"]["table_filter_template"] = "uuid'filter'"
231
- work["data"]["meta"]["step_detail_id"] = "uuid'meta-detail'"
232
- work["data"]["nodes"][0]["step_detail_id"] = "uuid'node-detail'"
233
-
234
- report = lint_flow_semantics(work)
235
-
236
- self.assertFalse(report["ok"])
237
- self.assertTrue(any("meta.table_list_template" in err for err in report["errors"]))
238
- self.assertTrue(any("meta.table_filter_template" in err for err in report["errors"]))
239
- self.assertTrue(any("meta.step_detail_id" in err for err in report["errors"]))
240
- self.assertTrue(any("提交申请.step_detail_id" in err for err in report["errors"]))
241
- self.assertEqual(len(report["hardErrors"]), 4)
242
-
243
- def test_evaluate_lints_does_not_ignore_preexisting_online_template_ref_errors(self) -> None:
244
- raw_detail = make_detail()
245
- raw_detail["data"]["meta"]["table_list_template"] = "uuid'legacy-list'"
246
- work = detail_to_work_payload(raw_detail, workspace="store_mgr")
247
-
248
- structure_lint, semantic_lint = evaluate_lints(
249
- work,
250
- raw_payload=raw_detail,
251
- allow_preexisting_lint_errors=True,
252
- )
253
-
254
- self.assertTrue(structure_lint["ok"])
255
- self.assertFalse(semantic_lint["ok"])
256
- self.assertTrue(any("meta.table_list_template" in err for err in semantic_lint["errors"]))
257
- self.assertFalse(semantic_lint["ignoredPreexistingErrors"])
258
-
259
- def test_semantic_lint_blocks_project_list_query(self) -> None:
260
- work = make_semantic_work()
261
- work["data"]["nodes"][0]["beforeNextStepScript"] = (
262
- "return ctx.$axios.post('/bpmax/project/list?page=1', { flow_type: 'flow716', query: {} });"
263
- )
264
-
265
- report = lint_flow_semantics(work)
266
-
267
- self.assertFalse(report["ok"])
268
- self.assertTrue(any("project/list" in err for err in report["errors"]))
269
-
270
- def test_build_submit_payload_blocks_hard_template_ref_errors(self) -> None:
271
- work = make_semantic_work()
272
- work["data"]["meta"]["table_list_template"] = "uuid'bad'"
273
-
274
- with self.assertRaises(SystemExit):
275
- build_submit_payload(work)
276
-
277
- def test_build_meta_resets_submit_confirmation_after_work_change(self) -> None:
278
- with tempfile.TemporaryDirectory() as tmpdir:
279
- root = Path(tmpdir)
280
- work_path = root / "work.json"
281
- submit_path = root / "submit.json"
282
- meta_path = root / "meta.json"
283
- work_path.write_text(json.dumps({"name": "v1"}, ensure_ascii=False), encoding="utf-8")
284
- submit_path.write_text(json.dumps({"name": "s1"}, ensure_ascii=False), encoding="utf-8")
285
- meta_path.write_text(
286
- json.dumps(
287
- {
288
- "stem": "flow352878207",
289
- "mode": "edit",
290
- "workspace": "store_mgr",
291
- "workSha256": "old",
292
- "status": "submit_confirmed",
293
- "workConfirmedAt": "2026-04-21T00:00:00+00:00",
294
- "submitConfirmedAt": "2026-04-21T00:01:00+00:00",
295
- },
296
- ensure_ascii=False,
297
- ),
298
- encoding="utf-8",
299
- )
300
- update_build_meta(meta_path, stem="flow352878207", work_path=work_path, submit_path=submit_path)
301
- meta = load_json(meta_path)
302
- self.assertIsNone(meta["workConfirmedAt"])
303
- self.assertIsNone(meta["submitConfirmedAt"])
304
- self.assertEqual(meta["status"], "submit_built")
305
-
306
- def test_update_build_meta_persists_allow_preexisting_lint_errors_flag(self) -> None:
307
- with tempfile.TemporaryDirectory() as tmpdir:
308
- root = Path(tmpdir)
309
- work_path = root / "work.json"
310
- submit_path = root / "submit.json"
311
- meta_path = root / "meta.json"
312
- work_path.write_text(json.dumps({"name": "v1"}, ensure_ascii=False), encoding="utf-8")
313
- submit_path.write_text(json.dumps({"name": "s1"}, ensure_ascii=False), encoding="utf-8")
314
- update_build_meta(
315
- meta_path,
316
- stem="flow352878207",
317
- work_path=work_path,
318
- submit_path=submit_path,
319
- allow_preexisting_lint_errors=True,
320
- )
321
- meta = load_json(meta_path)
322
- self.assertTrue(meta["allowPreexistingLintErrors"])
323
-
324
- def test_confirm_flow_template_handles_two_stage_confirmation(self) -> None:
325
- with tempfile.TemporaryDirectory() as tmpdir:
326
- root = Path(tmpdir)
327
- work_path = root / "work.json"
328
- submit_path = root / "submit.json"
329
- meta_path = root / "meta.json"
330
- work_path.write_text(json.dumps(detail_to_work_payload(make_detail(), workspace="store_mgr"), ensure_ascii=False), encoding="utf-8")
331
- submit_path.write_text(json.dumps({"name": "ST销售出库", "data": {}}, ensure_ascii=False), encoding="utf-8")
332
- update_confirmation_state(meta_path, stem="flow352878207", actor="tester", stage="work", work_path=work_path, submit_path=submit_path)
333
- meta = load_json(meta_path)
334
- self.assertEqual(meta["status"], "work_confirmed")
335
- update_confirmation_state(meta_path, stem="flow352878207", actor="tester", stage="submit", work_path=work_path, submit_path=submit_path)
336
- meta = load_json(meta_path)
337
- self.assertEqual(meta["status"], "submit_confirmed")
338
-
339
- def test_work_confirmation_persists_runtime_acceptance_requirements(self) -> None:
340
- with tempfile.TemporaryDirectory() as tmpdir:
341
- root = Path(tmpdir)
342
- work_path = root / "work.json"
343
- meta_path = root / "meta.json"
344
- work_path.write_text(json.dumps(detail_to_work_payload(make_detail(), workspace="store_mgr"), ensure_ascii=False), encoding="utf-8")
345
-
346
- update_confirmation_state(
347
- meta_path,
348
- stem="flow352878207",
349
- actor="tester",
350
- stage="work",
351
- work_path=work_path,
352
- runtime_acceptance={
353
- "required": True,
354
- "flowType": "flow352878207",
355
- "acceptancePage": "/w:store_mgr/project/create?flow_type=flow352878207",
356
- "freshInstanceRequired": True,
357
- },
358
- )
359
-
360
- meta = load_json(meta_path)
361
- self.assertTrue(meta["runtimeAcceptance"]["required"])
362
- self.assertEqual(meta["runtimeAcceptance"]["flowType"], "flow352878207")
363
- self.assertTrue(meta["runtimeAcceptance"]["freshInstanceRequired"])
364
-
365
- def test_work_confirmation_preserves_existing_runtime_acceptance_when_unspecified(self) -> None:
366
- with tempfile.TemporaryDirectory() as tmpdir:
367
- root = Path(tmpdir)
368
- work_path = root / "work.json"
369
- meta_path = root / "meta.json"
370
- work_path.write_text(json.dumps(detail_to_work_payload(make_detail(), workspace="store_mgr"), ensure_ascii=False), encoding="utf-8")
371
-
372
- update_confirmation_state(
373
- meta_path,
374
- stem="flow352878207",
375
- actor="tester",
376
- stage="work",
377
- work_path=work_path,
378
- runtime_acceptance={
379
- "required": True,
380
- "flowType": "flow352878207",
381
- "acceptancePage": "/w:store_mgr/project/create?flow_type=flow352878207",
382
- "freshInstanceRequired": True,
383
- },
384
- )
385
- first_meta = load_json(meta_path)
386
-
387
- update_confirmation_state(
388
- meta_path,
389
- stem="flow352878207",
390
- actor="tester-2",
391
- stage="work",
392
- work_path=work_path,
393
- runtime_acceptance=None,
394
- )
395
- meta = load_json(meta_path)
396
- self.assertEqual(meta["runtimeAcceptance"], first_meta["runtimeAcceptance"])
397
-
398
- def test_work_file_change_invalidates_submit_gate(self) -> None:
399
- with tempfile.TemporaryDirectory() as tmpdir:
400
- root = Path(tmpdir)
401
- raw_path = root / "raw.json"
402
- work_path = root / "work.json"
403
- submit_path = root / "submit.json"
404
- meta_path = root / "meta.json"
405
- raw_detail = make_detail()
406
- work = detail_to_work_payload(raw_detail, workspace="store_mgr")
407
- submit = build_submit_payload(work)
408
- raw_path.write_text(json.dumps(raw_detail, ensure_ascii=False), encoding="utf-8")
409
- work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
410
- submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
411
- update_confirmation_state(meta_path, stem="flow352878207", actor="tester", stage="work", work_path=work_path, submit_path=submit_path)
412
- update_confirmation_state(meta_path, stem="flow352878207", actor="tester", stage="submit", work_path=work_path, submit_path=submit_path)
413
- meta = load_json(meta_path)
414
- meta.update(
415
- {
416
- "mode": "edit",
417
- "workspace": "store_mgr",
418
- "updateTime": "2026-04-02 20:48:50",
419
- "flowType": "flow352878207",
420
- "workSha256": meta["workSha256"],
421
- "submitSha256": meta["submitSha256"],
422
- }
423
- )
424
- meta_path.write_text(json.dumps(meta, ensure_ascii=False), encoding="utf-8")
425
- work["data"]["periods"].append("新增阶段")
426
- work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
427
- with self.assertRaises(SystemExit):
428
- ensure_submission_allowed(meta_path, work_path, submit_path, raw_path)
429
-
430
- def test_submit_gate_allows_preexisting_raw_errors_when_flag_enabled(self) -> None:
431
- with tempfile.TemporaryDirectory() as tmpdir:
432
- root = Path(tmpdir)
433
- raw_path = root / "raw.json"
434
- work_path = root / "work.json"
435
- submit_path = root / "submit.json"
436
- meta_path = root / "meta.json"
437
- raw_detail = make_detail()
438
- raw_detail["data"]["nodes"][0]["approve_to_step"] = "[source]"
439
- work = detail_to_work_payload(raw_detail, workspace="store_mgr")
440
- submit = build_submit_payload(
441
- work,
442
- raw_payload=raw_detail,
443
- allow_preexisting_lint_errors=True,
444
- )
445
- raw_path.write_text(json.dumps(raw_detail, ensure_ascii=False), encoding="utf-8")
446
- work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
447
- submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
448
- meta_path.write_text(
449
- json.dumps(
450
- {
451
- "stem": "flow352878207",
452
- "mode": "edit",
453
- "workspace": "store_mgr",
454
- "flowType": "flow352878207",
455
- "updateTime": "2026-04-02 20:48:50",
456
- "workSha256": __import__("hashlib").sha256(work_path.read_bytes()).hexdigest(),
457
- "submitSha256": __import__("hashlib").sha256(submit_path.read_bytes()).hexdigest(),
458
- "workConfirmedAt": "2026-04-21T00:00:00+00:00",
459
- "submitConfirmedAt": "2026-04-21T00:01:00+00:00",
460
- "allowPreexistingLintErrors": True,
461
- "status": "submit_confirmed",
462
- },
463
- ensure_ascii=False,
464
- ),
465
- encoding="utf-8",
466
- )
467
- meta = ensure_submission_allowed(meta_path, work_path, submit_path, raw_path)
468
- self.assertTrue(meta["allowPreexistingLintErrors"])
469
-
470
- def test_submit_gate_blocks_obvious_structure_regression(self) -> None:
471
- with tempfile.TemporaryDirectory() as tmpdir:
472
- root = Path(tmpdir)
473
- raw_path = root / "raw.json"
474
- work_path = root / "work.json"
475
- submit_path = root / "submit.json"
476
- meta_path = root / "meta.json"
477
- raw_detail = make_detail()
478
- work = detail_to_work_payload(raw_detail, workspace="store_mgr")
479
- work["data"]["nodes"] = []
480
- submit = {"name": work["basic"]["name"], "data": work["data"]}
481
- raw_path.write_text(json.dumps(raw_detail, ensure_ascii=False), encoding="utf-8")
482
- work_path.write_text(json.dumps(work, ensure_ascii=False), encoding="utf-8")
483
- submit_path.write_text(json.dumps(submit, ensure_ascii=False), encoding="utf-8")
484
- meta_path.write_text(
485
- json.dumps(
486
- {
487
- "stem": "flow352878207",
488
- "mode": "edit",
489
- "workspace": "store_mgr",
490
- "flowType": "flow352878207",
491
- "updateTime": "2026-04-02 20:48:50",
492
- "workSha256": __import__("hashlib").sha256(work_path.read_bytes()).hexdigest(),
493
- "submitSha256": __import__("hashlib").sha256(submit_path.read_bytes()).hexdigest(),
494
- "workConfirmedAt": "2026-04-21T00:00:00+00:00",
495
- "submitConfirmedAt": "2026-04-21T00:01:00+00:00",
496
- "status": "submit_confirmed",
497
- },
498
- ensure_ascii=False,
499
- ),
500
- encoding="utf-8",
501
- )
502
- with self.assertRaises(SystemExit):
503
- ensure_submission_allowed(meta_path, work_path, submit_path, raw_path)
504
-
505
- def test_verification_detects_drift_in_readback(self) -> None:
506
- submit = build_submit_payload(detail_to_work_payload(make_detail(), workspace="store_mgr"))
507
- readback = make_detail()
508
- readback["data"]["nodes"][1]["approve_fail"] = ""
509
- verify = summarize_verification(submit, readback)
510
- self.assertFalse(verify["ok"])
511
- self.assertFalse(verify["checks"]["nodeSummaries"]["match"])
512
-
513
- def test_drift_report_highlights_submit_to_draft_change(self) -> None:
514
- submit = build_submit_payload(detail_to_work_payload(make_detail(), workspace="store_mgr"))
515
- readback = make_detail()
516
- readback["data"]["meta"] = {}
517
- drift = build_drift_report(submit, readback)
518
- self.assertFalse(drift["ok"])
519
- self.assertIn("metaKeys", drift["submitToDraft"]["changes"])
520
-
521
- def test_empty_api_flow_can_fallback_to_runtime_skeleton(self) -> None:
522
- api_detail = {"name": "未命名的流程", "data": {}}
523
- runtime_detail = make_runtime_submit_data()
524
- resolved, source = resolve_export_detail(api_detail, runtime_detail)
525
- self.assertEqual(source, "runtime_fallback")
526
- self.assertEqual(resolved["periods"][0], "销售出库")
527
-
528
- def test_runtime_fallback_normalize_can_fill_name_and_update_time_from_live(self) -> None:
529
- runtime_detail = make_runtime_submit_data()
530
- normalized = normalize_flow_detail(
531
- runtime_detail,
532
- flow_type="flow352878207",
533
- name="ST销售出库",
534
- update_time="2026-04-22 16:58:41",
535
- )
536
- self.assertEqual(normalized["name"], "ST销售出库")
537
- self.assertEqual(normalized["update_time"], "2026-04-22 16:58:41")
538
-
539
- def test_flow_api_url_matches_live_editor(self) -> None:
540
- client = ApiClient(
541
- base_url="https://bpmax.example.com",
542
- workspace="store_mgr",
543
- language="zhCN",
544
- cookie_header="token=demo",
545
- timeout=30,
546
- )
547
- self.assertEqual(
548
- client._build_url("/api/flow?flow_type=flow352878207&draft=1&skip_i18n=true"),
549
- "https://bpmax.example.com/api/flow?flow_type=flow352878207&draft=1&skip_i18n=true&$workspace=store_mgr&$language=zhCN",
550
- )
551
-
552
- def test_publish_flow_uses_publish_1_endpoint(self) -> None:
553
- client = ApiClient(
554
- base_url="https://bpmax.example.com",
555
- workspace="store_mgr",
556
- language="zhCN",
557
- cookie_header="token=demo",
558
- timeout=30,
559
- )
560
- with mock.patch.object(client, "request", return_value={"code": 0}) as request:
561
- client.publish_flow(
562
- flow_type="flow352878207",
563
- update_time="2026-04-02 20:48:50",
564
- body={"name": "ST销售出库", "data": {}},
565
- )
566
- request.assert_called_once()
567
- self.assertIn("publish=1", request.call_args.args[1])
568
-
569
- def test_legacy_submit_script_is_disabled(self) -> None:
570
- with self.assertRaises(SystemExit) as ctx:
571
- __import__("submit_flow_template")
572
- self.assertEqual(ctx.exception.code, 2)
573
-
574
- def test_build_client_uses_environment_base_url(self) -> None:
575
- args = type(
576
- "Args",
577
- (),
578
- {
579
- "base_url": None,
580
- "workspace": "store_mgr",
581
- "language": "zhCN",
582
- "cookie_header": "token=demo",
583
- "timeout": 30,
584
- "insecure": False,
585
- },
586
- )()
587
- with mock.patch.dict(os.environ, {"BPMAX_BASE_URL": "https://bpmax.example.com/"}, clear=False):
588
- client = build_client(args)
589
- self.assertEqual(client.base_url, "https://bpmax.example.com")
590
-
591
- def test_build_client_requires_runtime_origin_when_not_explicitly_configured(self) -> None:
592
- args = type(
593
- "Args",
594
- (),
595
- {
596
- "base_url": None,
597
- "workspace": "store_mgr",
598
- "language": "zhCN",
599
- "cookie_header": "token=demo",
600
- "timeout": 30,
601
- "insecure": False,
602
- },
603
- )()
604
- with mock.patch.dict(os.environ, {}, clear=True):
605
- with self.assertRaises(SystemExit) as ctx:
606
- build_client(args)
607
- self.assertIn("BPMAX_BASE_URL", str(ctx.exception))
608
-
609
- def test_skill_references_exist(self) -> None:
610
- skill_path = Path(__file__).resolve().parents[1] / "SKILL.md"
611
- content = skill_path.read_text(encoding="utf-8")
612
- expected = [
613
- "scripts/export_flow_template.py",
614
- "scripts/build_submit_payload.py",
615
- "scripts/confirm_flow_template.py",
616
- "scripts/submit_flow_template.py",
617
- "references/local-temp-workflow.md",
618
- "references/work-file-to-submit-mapping.md",
619
- ".codex/tmp/flow-template-editor/",
620
- "semantic-lint.json",
621
- "runtime-acceptance.json",
622
- "已自动化",
623
- "仍需人工确认",
624
- ]
625
- for item in expected:
626
- self.assertIn(item, content)
627
- for relative in [
628
- "references/local-temp-workflow.md",
629
- "references/work-file-to-submit-mapping.md",
630
- "references/runtime-verified-flow-detail-shape.md",
631
- ]:
632
- self.assertTrue((skill_path.parent / relative).exists(), relative)
633
-
634
-
635
- if __name__ == "__main__":
636
- unittest.main()