bpmax-cli 0.1.43 → 0.1.44-beta.1

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 +3397 -433
  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,95 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ from pathlib import Path
5
+
6
+
7
+ def main():
8
+ parser = argparse.ArgumentParser()
9
+ parser.add_argument("--state", required=True)
10
+ parser.add_argument("--output", required=True)
11
+ args = parser.parse_args()
12
+
13
+ state = json.loads(Path(args.state).read_text(encoding="utf-8"))
14
+ scenarios = state.get("scenarios", [])
15
+ issues = state.get("issues", [])
16
+ counts = {"pass": 0, "fail": 0, "blocked": 0, "pending": 0}
17
+ for item in scenarios:
18
+ counts[item["status"]] = counts.get(item["status"], 0) + 1
19
+
20
+ lines = []
21
+ lines.append(f"# {state['title']}测试文档")
22
+ lines.append("")
23
+ lines.append("## 1. 流程范围")
24
+ lines.append(f"- 工作区:`{state.get('workspace', '')}`")
25
+ lines.append(f"- `flow_type`:`{state.get('flow_type', '')}`")
26
+ if state.get("dependencies"):
27
+ lines.append("- 关键依赖:")
28
+ for k, v in state["dependencies"].items():
29
+ lines.append(f" - `{k}`: `{v}`")
30
+ lines.append("")
31
+ lines.append("## 2. AI 自动测试结论")
32
+ lines.append(f"- 已测场景数:`{len(scenarios)}`")
33
+ lines.append(f"- 通过:`{counts['pass']}`")
34
+ lines.append(f"- 失败:`{counts['fail']}`")
35
+ lines.append(f"- 阻塞:`{counts['blocked']}`")
36
+ lines.append(f"- 待测:`{counts['pending']}`")
37
+ lines.append("")
38
+ lines.append("### 2.1 已测场景")
39
+ for item in scenarios:
40
+ lines.append(f"- `{item['id']}` {item['title']}:`{item['status']}`")
41
+ if item.get("sample"):
42
+ lines.append(f" - 样本:`{item['sample']}`")
43
+ if item.get("note"):
44
+ lines.append(f" - 说明:{item['note']}")
45
+ lines.append("")
46
+ lines.append("### 2.2 尚存问题")
47
+ if issues:
48
+ for item in issues:
49
+ lines.append(f"- `{item['status']}` {item['title']}")
50
+ if item.get("note"):
51
+ lines.append(f" - {item['note']}")
52
+ else:
53
+ lines.append("- 无")
54
+ if state.get("artifacts"):
55
+ lines.append("")
56
+ lines.append("### 2.3 证据产物")
57
+ for item in state.get("artifacts", []):
58
+ lines.append(f"- `{item.get('kind', 'artifact')}` {item.get('path', '')}")
59
+ if item.get("note"):
60
+ lines.append(f" - {item['note']}")
61
+ if state.get("browser_only_steps"):
62
+ lines.append("")
63
+ lines.append("### 2.4 浏览器保留点")
64
+ for item in state.get("browser_only_steps", []):
65
+ lines.append(f"- {item.get('title', '')}")
66
+ if item.get("reason"):
67
+ lines.append(f" - {item['reason']}")
68
+ lines.append("")
69
+ lines.append("## 3. 给测试人员的操作手册")
70
+ lines.append("### 3.1 前置数据")
71
+ lines.append("- 按业务准备测试账号、门店、物料、库存 SN、历史销售单或补录数据。")
72
+ lines.append("- 优先复用本文档 2.1 中已验证样本对应的数据口径。")
73
+ lines.append("")
74
+ lines.append("### 3.2 测试步骤")
75
+ for item in scenarios:
76
+ lines.append(f"- {item['id']}:{item['title']}")
77
+ lines.append("")
78
+ lines.append("### 3.3 预期结果")
79
+ lines.append("- 逐场景以 2.1 中的通过标准为准。")
80
+ if state.get("runtime_bindings"):
81
+ lines.append("")
82
+ lines.append("## 4. 运行时绑定")
83
+ for k, v in state["runtime_bindings"].items():
84
+ lines.append(f"- `{k}`: `{v}`")
85
+ if state.get("next_step"):
86
+ lines.append("")
87
+ lines.append("## 5. 下一步")
88
+ lines.append(f"- {state['next_step']}")
89
+
90
+ Path(args.output).write_text("\n".join(lines) + "\n", encoding="utf-8")
91
+ print(args.output)
92
+
93
+
94
+ if __name__ == "__main__":
95
+ main()
@@ -0,0 +1,288 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ from datetime import datetime, timezone
5
+ from pathlib import Path
6
+
7
+
8
+ ROOT = Path(__file__).resolve().parents[4]
9
+ STATE_DIR = ROOT / ".codex" / "tmp" / "e2e_states"
10
+
11
+
12
+ def now_iso():
13
+ return datetime.now(timezone.utc).astimezone().isoformat(timespec="seconds")
14
+
15
+
16
+ def state_path(state_id: str) -> Path:
17
+ return STATE_DIR / f"{state_id}.json"
18
+
19
+
20
+ def load(path: Path) -> dict:
21
+ if not path.exists():
22
+ raise SystemExit(f"state not found: {path}")
23
+ return json.loads(path.read_text(encoding="utf-8"))
24
+
25
+
26
+ def save(path: Path, data: dict) -> None:
27
+ path.parent.mkdir(parents=True, exist_ok=True)
28
+ data["updated_at"] = now_iso()
29
+ path.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
30
+
31
+
32
+ def parse_kv_pairs(items):
33
+ result = {}
34
+ for item in items or []:
35
+ if "=" not in item:
36
+ continue
37
+ k, v = item.split("=", 1)
38
+ result[k.strip()] = v.strip()
39
+ return result
40
+
41
+
42
+ def cmd_init(args):
43
+ path = state_path(args.id)
44
+ data = {
45
+ "id": args.id,
46
+ "title": args.title,
47
+ "workspace": args.workspace,
48
+ "flow_type": args.flow_type,
49
+ "dependencies": parse_kv_pairs(args.dep),
50
+ "scenarios": [],
51
+ "samples": [],
52
+ "issues": [],
53
+ "artifacts": [],
54
+ "endpoint_calls": [],
55
+ "browser_only_steps": [],
56
+ "runtime_bindings": {},
57
+ "next_step": "",
58
+ }
59
+ save(path, data)
60
+ print(path)
61
+
62
+
63
+ def upsert_scenario(data, scenario_id, title=None):
64
+ for item in data["scenarios"]:
65
+ if item["id"] == scenario_id:
66
+ if title:
67
+ item["title"] = title
68
+ return item
69
+ item = {"id": scenario_id, "title": title or scenario_id, "status": "pending", "sample": "", "note": ""}
70
+ data["scenarios"].append(item)
71
+ return item
72
+
73
+
74
+ def cmd_record(args):
75
+ path = state_path(args.id)
76
+ data = load(path)
77
+ item = upsert_scenario(data, args.scenario, args.title)
78
+ item["status"] = args.status
79
+ if args.sample:
80
+ item["sample"] = args.sample
81
+ data["samples"].append({"scenario": args.scenario, "value": args.sample, "at": now_iso()})
82
+ if args.note:
83
+ item["note"] = args.note
84
+ save(path, data)
85
+ print(json.dumps(item, ensure_ascii=False, indent=2))
86
+
87
+
88
+ def cmd_issue(args):
89
+ path = state_path(args.id)
90
+ data = load(path)
91
+ data["issues"].append({
92
+ "title": args.title,
93
+ "status": args.status,
94
+ "owner_skill": args.owner_skill,
95
+ "note": args.note,
96
+ "at": now_iso(),
97
+ })
98
+ save(path, data)
99
+ print("ok")
100
+
101
+
102
+ def cmd_next(args):
103
+ path = state_path(args.id)
104
+ data = load(path)
105
+ data["next_step"] = args.text
106
+ save(path, data)
107
+ print(data["next_step"])
108
+
109
+
110
+ def record_artifacts(state_id: str, items):
111
+ path = state_path(state_id)
112
+ data = load(path)
113
+ data.setdefault("artifacts", [])
114
+ data["artifacts"].extend(items or [])
115
+ save(path, data)
116
+
117
+
118
+ def record_endpoint_calls(state_id: str, items):
119
+ path = state_path(state_id)
120
+ data = load(path)
121
+ data.setdefault("endpoint_calls", [])
122
+ data["endpoint_calls"].extend(items or [])
123
+ save(path, data)
124
+
125
+
126
+ def record_browser_only_steps(state_id: str, items):
127
+ path = state_path(state_id)
128
+ data = load(path)
129
+ data.setdefault("browser_only_steps", [])
130
+ data["browser_only_steps"].extend(items or [])
131
+ save(path, data)
132
+
133
+
134
+ def record_runtime_bindings(state_id: str, mapping):
135
+ path = state_path(state_id)
136
+ data = load(path)
137
+ data.setdefault("runtime_bindings", {})
138
+ data["runtime_bindings"].update(mapping or {})
139
+ save(path, data)
140
+
141
+
142
+ def cmd_artifact(args):
143
+ record_artifacts(
144
+ args.id,
145
+ [
146
+ {
147
+ "kind": args.kind,
148
+ "path": args.path,
149
+ "note": args.note,
150
+ "at": now_iso(),
151
+ }
152
+ ],
153
+ )
154
+ print("ok")
155
+
156
+
157
+ def cmd_endpoint(args):
158
+ body = parse_kv_pairs(args.body)
159
+ record_endpoint_calls(
160
+ args.id,
161
+ [
162
+ {
163
+ "method": args.method,
164
+ "path": args.path,
165
+ "status": args.status,
166
+ "note": args.note,
167
+ "body": body,
168
+ "at": now_iso(),
169
+ }
170
+ ],
171
+ )
172
+ print("ok")
173
+
174
+
175
+ def cmd_browser_step(args):
176
+ record_browser_only_steps(
177
+ args.id,
178
+ [
179
+ {
180
+ "title": args.title,
181
+ "reason": args.reason,
182
+ "at": now_iso(),
183
+ }
184
+ ],
185
+ )
186
+ print("ok")
187
+
188
+
189
+ def cmd_runtime_binding(args):
190
+ record_runtime_bindings(args.id, parse_kv_pairs(args.binding))
191
+ print("ok")
192
+
193
+
194
+ def cmd_summary(args):
195
+ path = state_path(args.id)
196
+ data = load(path)
197
+ total = len(data["scenarios"])
198
+ counts = {"pass": 0, "fail": 0, "blocked": 0, "pending": 0}
199
+ for item in data["scenarios"]:
200
+ counts[item["status"]] = counts.get(item["status"], 0) + 1
201
+ summary = {
202
+ "id": data["id"],
203
+ "title": data["title"],
204
+ "workspace": data["workspace"],
205
+ "flow_type": data["flow_type"],
206
+ "scenario_total": total,
207
+ "counts": counts,
208
+ "issues_open": [i for i in data["issues"] if i["status"] != "fixed"],
209
+ "artifact_count": len(data.get("artifacts", [])),
210
+ "endpoint_call_count": len(data.get("endpoint_calls", [])),
211
+ "browser_only_step_count": len(data.get("browser_only_steps", [])),
212
+ "runtime_bindings": data.get("runtime_bindings", {}),
213
+ "next_step": data.get("next_step", ""),
214
+ }
215
+ print(json.dumps(summary, ensure_ascii=False, indent=2))
216
+
217
+
218
+ def main():
219
+ parser = argparse.ArgumentParser()
220
+ sub = parser.add_subparsers(dest="cmd", required=True)
221
+
222
+ p = sub.add_parser("init")
223
+ p.add_argument("--id", required=True)
224
+ p.add_argument("--title", required=True)
225
+ p.add_argument("--workspace", required=True)
226
+ p.add_argument("--flow-type", required=True)
227
+ p.add_argument("--dep", action="append")
228
+ p.set_defaults(func=cmd_init)
229
+
230
+ p = sub.add_parser("record")
231
+ p.add_argument("--id", required=True)
232
+ p.add_argument("--scenario", required=True)
233
+ p.add_argument("--title")
234
+ p.add_argument("--status", required=True, choices=["pass", "fail", "blocked", "pending"])
235
+ p.add_argument("--sample")
236
+ p.add_argument("--note")
237
+ p.set_defaults(func=cmd_record)
238
+
239
+ p = sub.add_parser("issue")
240
+ p.add_argument("--id", required=True)
241
+ p.add_argument("--title", required=True)
242
+ p.add_argument("--status", default="open")
243
+ p.add_argument("--owner-skill", default="")
244
+ p.add_argument("--note", default="")
245
+ p.set_defaults(func=cmd_issue)
246
+
247
+ p = sub.add_parser("next")
248
+ p.add_argument("--id", required=True)
249
+ p.add_argument("--text", required=True)
250
+ p.set_defaults(func=cmd_next)
251
+
252
+ p = sub.add_parser("artifact")
253
+ p.add_argument("--id", required=True)
254
+ p.add_argument("--kind", required=True)
255
+ p.add_argument("--path", required=True)
256
+ p.add_argument("--note", default="")
257
+ p.set_defaults(func=cmd_artifact)
258
+
259
+ p = sub.add_parser("endpoint")
260
+ p.add_argument("--id", required=True)
261
+ p.add_argument("--method", required=True)
262
+ p.add_argument("--path", required=True)
263
+ p.add_argument("--status", default="")
264
+ p.add_argument("--note", default="")
265
+ p.add_argument("--body", action="append")
266
+ p.set_defaults(func=cmd_endpoint)
267
+
268
+ p = sub.add_parser("browser-step")
269
+ p.add_argument("--id", required=True)
270
+ p.add_argument("--title", required=True)
271
+ p.add_argument("--reason", default="")
272
+ p.set_defaults(func=cmd_browser_step)
273
+
274
+ p = sub.add_parser("runtime-binding")
275
+ p.add_argument("--id", required=True)
276
+ p.add_argument("--binding", action="append")
277
+ p.set_defaults(func=cmd_runtime_binding)
278
+
279
+ p = sub.add_parser("summary")
280
+ p.add_argument("--id", required=True)
281
+ p.set_defaults(func=cmd_summary)
282
+
283
+ args = parser.parse_args()
284
+ args.func(args)
285
+
286
+
287
+ if __name__ == "__main__":
288
+ main()
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ from bpmax_session import load_json, save_json
8
+ from flow_test_profile import FlowTestProfile, find_uuid_dir, resolve_profile
9
+ from flow_filter_fields import build_report as build_filter_report
10
+ from flow_form_runtime import _load_flow_nodes
11
+
12
+
13
+ def build_object_mapping(profile: FlowTestProfile) -> Dict[str, Any]:
14
+ return {
15
+ "profile": profile.name,
16
+ "workspace": profile.workspace,
17
+ "flow_type": profile.flow_type,
18
+ "data_set_uuid": profile.data_set_uuid,
19
+ "list_template_uuid": profile.list_template_uuid,
20
+ "filter_template_uuid": profile.filter_template_uuid,
21
+ "form_template_uuid": profile.form_template_uuid,
22
+ "form_template_name": profile.form_template_name,
23
+ "flow_name": profile.flow_name,
24
+ }
25
+
26
+
27
+ def build_node_chain(profile: FlowTestProfile) -> List[Dict[str, Any]]:
28
+ nodes = _load_flow_nodes(profile)
29
+ ordered = []
30
+ step_ids = profile.node_chain_ids or sorted(nodes.keys())
31
+ for step_id in step_ids:
32
+ node = nodes.get(step_id, {})
33
+ ordered.append(
34
+ {
35
+ "flow_step_id": step_id,
36
+ "name": node.get("name"),
37
+ "approve_actions": node.get("approve_actions", []),
38
+ "approve_fail_actions": node.get("approve_fail_actions", []),
39
+ "approve_to_step": node.get("approve_to_step"),
40
+ "approve_fail": node.get("approve_fail"),
41
+ }
42
+ )
43
+ return ordered
44
+
45
+
46
+ def build_endpoints(profile: FlowTestProfile) -> List[Dict[str, Any]]:
47
+ overrides = profile.endpoint_overrides or {}
48
+ detail_paths = overrides.get("project_detail_paths") or ["/project/{project_id}?steps=1", "/api/project/{project_id}?steps=1"]
49
+ step_get_paths = overrides.get("step_get_paths") or ["/step/{step_id}", "/api/step/{step_id}"]
50
+ step_action_paths = overrides.get("step_action_paths") or ["/step/{step_id}?action={action}", "/api/step/{step_id}?action={action}"]
51
+ return [
52
+ {
53
+ "name": "list_projects",
54
+ "method": "POST",
55
+ "path": "/bpmax/project/list?page=1&page_size={page_size}&level=0",
56
+ "purpose": "列表页与筛选器查询",
57
+ "request_source": ".codex/tmp/step10424_approve.json 中同类项目列表查询形态 + 本地筛选模板配置",
58
+ "notes": ["优先传 data_set_id 或 flow_type", f"默认 profile: {profile.name}"],
59
+ },
60
+ {
61
+ "name": "create_project",
62
+ "method": "POST",
63
+ "path": "/api/project",
64
+ "purpose": "创建流程项目",
65
+ "request_source": ".codex/tmp/project_create_8631_clone.json 的真实 /api/project 骨架",
66
+ "notes": [f"flow_type 由 profile 提供: {profile.flow_type}", "优先从运行时详情回读生成 projectForm.value", "不要手写最小化 payload"],
67
+ },
68
+ {
69
+ "name": "project_detail",
70
+ "method": "GET",
71
+ "paths": detail_paths,
72
+ "purpose": "详情页、当前环节、metaForm 回读",
73
+ "request_source": "运行时详情接口;优先按 profile endpoint_overrides 声明的 fallback 顺序尝试",
74
+ "notes": ["回读 current_flow_step_name、metaForm.value、step_owner_list"],
75
+ },
76
+ {
77
+ "name": "step_detail",
78
+ "method": "GET",
79
+ "paths": step_get_paths,
80
+ "purpose": "步骤详情或运行态 step_form 取证",
81
+ "request_source": "运行时步骤接口;优先按 profile endpoint_overrides 声明的 fallback 顺序尝试",
82
+ "notes": ["通常只有 detail 中 step_form 不完整时才需要单独读取 step"],
83
+ },
84
+ {
85
+ "name": "step_approve",
86
+ "method": "PUT",
87
+ "paths": [path.replace("{action}", "approve") for path in step_action_paths],
88
+ "purpose": "审批流转",
89
+ "request_source": "列表模板前端内联动作与 .codex/tmp/step10424_approve.json 请求骨架",
90
+ "notes": ["审批步骤无表单时可发最小 body", "有 step_form 时必须携带完整 value/key_to_value/field_to_value 结构"],
91
+ },
92
+ {
93
+ "name": "step_reject",
94
+ "method": "PUT",
95
+ "paths": [path.replace("{action}", "refuse") for path in step_action_paths],
96
+ "purpose": "驳回到修改配置",
97
+ "request_source": "前端项目动作模板中 `?action=refuse` 真实调用形态",
98
+ "notes": ["至少带 project_id 与 flow_step_id", "目标环节从 flow.data 推导"],
99
+ },
100
+ ]
101
+
102
+
103
+ def build_list_template_shape(profile: FlowTestProfile) -> Dict[str, Any]:
104
+ content = load_json(find_uuid_dir("think_flow_page_template", profile.list_template_uuid) / "flow_page_template.content")
105
+ columns = []
106
+ for item in content.get("config", []) or []:
107
+ columns.append({"title": item.get("title"), "icon": item.get("icon")})
108
+ meta = load_json(find_uuid_dir("think_form_template", profile.form_template_uuid) / "form_template")
109
+ return {"list_columns": columns, "form_template_name": meta.get("name")}
110
+
111
+
112
+ def build_matrix(profile: Optional[FlowTestProfile] = None) -> Dict[str, Any]:
113
+ profile = profile or resolve_profile()
114
+ return {
115
+ "objects": build_object_mapping(profile),
116
+ "node_chain": build_node_chain(profile),
117
+ "endpoints": build_endpoints(profile),
118
+ "list_and_form_shape": build_list_template_shape(profile),
119
+ "filter_fields": build_filter_report(None, profile),
120
+ "browser_only_steps": profile.browser_only_steps,
121
+ "runtime_binding_notes": [
122
+ "节点链路以 flow.data live 配置为准。",
123
+ "审批节点无 form_template 时,接口 runner 才退回最小 step body;只要运行态可拿到 step_form,就优先保留完整结构。",
124
+ "创建 skeleton 优先来自 live 项目详情或真实浏览器请求,其次才退回本地表单模板。",
125
+ ],
126
+ }
127
+
128
+
129
+ def main() -> None:
130
+ p = argparse.ArgumentParser(description="Output the flow API matrix and runtime object bindings.")
131
+ p.add_argument("--profile", default="negative_sale")
132
+ p.add_argument("--profile-file")
133
+ p.add_argument("--workspace")
134
+ p.add_argument("--flow-type")
135
+ p.add_argument("--data-set-uuid")
136
+ p.add_argument("--list-template-uuid")
137
+ p.add_argument("--filter-template-uuid")
138
+ p.add_argument("--form-template-uuid")
139
+ p.add_argument("--form-template-name")
140
+ p.add_argument("--output")
141
+ args = p.parse_args()
142
+
143
+ profile = resolve_profile(
144
+ args.profile,
145
+ profile_file=args.profile_file,
146
+ workspace=args.workspace,
147
+ flow_type=args.flow_type,
148
+ data_set_uuid=args.data_set_uuid,
149
+ list_template_uuid=args.list_template_uuid,
150
+ filter_template_uuid=args.filter_template_uuid,
151
+ form_template_uuid=args.form_template_uuid,
152
+ form_template_name=args.form_template_name,
153
+ )
154
+ matrix = build_matrix(profile)
155
+ if args.output:
156
+ save_json(Path(args.output), matrix)
157
+ print(json.dumps(matrix, ensure_ascii=False, indent=2))
158
+
159
+
160
+ if __name__ == "__main__":
161
+ main()
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ from pathlib import Path
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ from bpmax_session import build_client, load_json, parse_jsonish, save_json
8
+ from flow_test_profile import FlowTestProfile, find_uuid_dir, resolve_profile
9
+
10
+
11
+ def collect_data_set_fields(profile: FlowTestProfile) -> List[Dict[str, Any]]:
12
+ fields = []
13
+ base = find_uuid_dir("think_data_set", profile.data_set_uuid) / "think_data_set_data_set_fields_think_data_set_field"
14
+ for path in sorted(base.glob("*/data_set_data_set_fields_think_data_set_field")):
15
+ key = path.parent.name.split("___key'", 1)[-1].split("___is_del", 1)[0]
16
+ fields.append({"field": key, "source": "data_set_relation"})
17
+ return fields
18
+
19
+
20
+ def collect_filter_template_fields(profile: FlowTestProfile) -> List[Dict[str, Any]]:
21
+ content = load_json(find_uuid_dir("think_flow_page_template", profile.filter_template_uuid) / "flow_page_template.content")
22
+ fields = []
23
+ for item in content.get("config", []) or []:
24
+ fields.append(
25
+ {
26
+ "field": item.get("field"),
27
+ "label": item.get("label"),
28
+ "widget": item.get("is"),
29
+ "query_type": item.get("type"),
30
+ "source": "filter_template",
31
+ }
32
+ )
33
+ return fields
34
+
35
+
36
+ def collect_runtime_query_fields(runtime_payload: Any) -> List[Dict[str, Any]]:
37
+ if not runtime_payload:
38
+ return []
39
+ payload = runtime_payload.get("data", runtime_payload) if isinstance(runtime_payload, dict) else runtime_payload
40
+ if isinstance(payload, dict) and "data" in payload:
41
+ payload = payload.get("data")
42
+ if not isinstance(payload, list) or not payload:
43
+ return []
44
+ keys = set()
45
+ for row in payload:
46
+ normalized = parse_jsonish(row)
47
+ if isinstance(normalized, dict):
48
+ keys.update(normalized.keys())
49
+ return [{"field": key, "source": "runtime_list"} for key in sorted(keys)]
50
+
51
+
52
+ def build_report(
53
+ runtime_payload: Any = None,
54
+ profile: Optional[FlowTestProfile] = None,
55
+ fixed_priority_fields: Optional[List[str]] = None,
56
+ ) -> Dict[str, Any]:
57
+ profile = profile or resolve_profile()
58
+ data_set_fields = collect_data_set_fields(profile)
59
+ filter_fields = collect_filter_template_fields(profile)
60
+ runtime_fields = collect_runtime_query_fields(runtime_payload)
61
+ ordered = []
62
+ seen = set()
63
+ priority_fields = fixed_priority_fields or profile.priority_filter_fields
64
+ for field in priority_fields:
65
+ if field not in seen:
66
+ ordered.append(field)
67
+ seen.add(field)
68
+ for bucket in (filter_fields, data_set_fields, runtime_fields):
69
+ for item in bucket:
70
+ field = item.get("field")
71
+ if field and field not in seen:
72
+ ordered.append(field)
73
+ seen.add(field)
74
+ return {
75
+ "data_set_fields": data_set_fields,
76
+ "filter_template_fields": filter_fields,
77
+ "runtime_query_fields": runtime_fields,
78
+ "recommended_fields": ordered,
79
+ }
80
+
81
+
82
+ def main() -> None:
83
+ p = argparse.ArgumentParser(description="Discover flow filter fields from local config and runtime list responses.")
84
+ p.add_argument("--runtime-list-file")
85
+ p.add_argument("--fetch-runtime", action="store_true")
86
+ p.add_argument("--profile", default="negative_sale")
87
+ p.add_argument("--profile-file")
88
+ p.add_argument("--flow-type")
89
+ p.add_argument("--data-set-uuid")
90
+ p.add_argument("--filter-template-uuid")
91
+ p.add_argument("--list-template-uuid")
92
+ p.add_argument("--form-template-uuid")
93
+ p.add_argument("--form-template-name")
94
+ p.add_argument("--priority-field", action="append")
95
+ p.add_argument("--data-set-id", type=int, default=0)
96
+ p.add_argument("--cookie-header")
97
+ p.add_argument("--header-file")
98
+ p.add_argument("--workspace")
99
+ p.add_argument("--base-url")
100
+ p.add_argument("--language", default="zhCN")
101
+ p.add_argument("--timeout", default=30)
102
+ p.add_argument("--insecure", action="store_true")
103
+ p.add_argument("--output")
104
+ args = p.parse_args()
105
+ profile = resolve_profile(
106
+ args.profile,
107
+ profile_file=args.profile_file,
108
+ workspace=args.workspace,
109
+ flow_type=args.flow_type,
110
+ data_set_uuid=args.data_set_uuid,
111
+ filter_template_uuid=args.filter_template_uuid,
112
+ list_template_uuid=args.list_template_uuid,
113
+ form_template_uuid=args.form_template_uuid,
114
+ form_template_name=args.form_template_name,
115
+ )
116
+
117
+ runtime_payload = None
118
+ if args.runtime_list_file:
119
+ runtime_payload = load_json(Path(args.runtime_list_file))
120
+ elif args.fetch_runtime:
121
+ client = build_client(args)
122
+ runtime_payload = client.post_project_list(
123
+ {
124
+ "data_set_id": args.data_set_id,
125
+ "flow_type": profile.flow_type,
126
+ "query": {},
127
+ },
128
+ page_size=5,
129
+ )
130
+
131
+ report = build_report(runtime_payload, profile, args.priority_field)
132
+ if args.output:
133
+ save_json(Path(args.output), report)
134
+ print(json.dumps(report, ensure_ascii=False, indent=2))
135
+
136
+
137
+ if __name__ == "__main__":
138
+ main()